summaryrefslogtreecommitdiff
path: root/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/deployment/gui/dp_gui_updatedialog.cxx')
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx281
1 files changed, 111 insertions, 170 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index b71cc23a058f..89e00abfbf3f 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -483,31 +483,15 @@ bool UpdateDialog::Thread::update(
return ret;
}
+
// UpdateDialog ----------------------------------------------------------
UpdateDialog::UpdateDialog(
uno::Reference< uno::XComponentContext > const & context,
Window * parent,
- const std::vector<uno::Reference< deployment::XPackage > > &vExtensionList,
+ const std::vector<uno::Reference< deployment::XPackage > > &vExtensionList,
std::vector< dp_gui::UpdateData > * updateData):
- ModalDialog(parent,DpGuiResId(RID_DLG_UPDATE)),
+ ModalDialog(parent, "UpdateDialog", "desktop/ui/updatedialog.ui"),
m_context(context),
- m_checking(this, DpGuiResId(RID_DLG_UPDATE_CHECKING)),
- m_throbber(this, DpGuiResId(RID_DLG_UPDATE_THROBBER)),
- m_update(this, DpGuiResId(RID_DLG_UPDATE_UPDATE)),
- m_updates(
- *this, DpGuiResId(RID_DLG_UPDATE_UPDATES),
- Image(DpGuiResId(RID_DLG_UPDATE_NORMALALERT))),
- m_all(this, DpGuiResId(RID_DLG_UPDATE_ALL)),
- m_description(this, DpGuiResId(RID_DLG_UPDATE_DESCRIPTION)),
- m_PublisherLabel(this, DpGuiResId(RID_DLG_UPDATE_PUBLISHER_LABEL)),
- m_PublisherLink(this, DpGuiResId(RID_DLG_UPDATE_PUBLISHER_LINK)),
- m_ReleaseNotesLabel(this, DpGuiResId(RID_DLG_UPDATE_RELEASENOTES_LABEL)),
- m_ReleaseNotesLink(this, DpGuiResId(RID_DLG_UPDATE_RELEASENOTES_LINK)),
- m_descriptions(this, DpGuiResId(RID_DLG_UPDATE_DESCRIPTIONS)),
- m_line(this, DpGuiResId(RID_DLG_UPDATE_LINE)),
- m_help(this, DpGuiResId(RID_DLG_UPDATE_HELP)),
- m_ok(this, DpGuiResId(RID_DLG_UPDATE_OK)),
- m_close(this, DpGuiResId(RID_DLG_UPDATE_CLOSE)),
m_error(DPGUI_RESSTR(RID_DLG_UPDATE_ERROR)),
m_none(DPGUI_RESSTR(RID_DLG_UPDATE_NONE)),
m_noInstallable(DPGUI_RESSTR(RID_DLG_UPDATE_NOINSTALLABLE)),
@@ -532,6 +516,28 @@ UpdateDialog::UpdateDialog(
// ,
// m_extensionManagerDialog(extensionManagerDialog)
{
+ get(m_pchecking, "UPDATE_CHECKING");
+ get(m_pthrobber, "THROBBER");
+ get(m_pUpdate, "UPDATE_LABEL");
+ get(m_pContainer, "UPDATES_CONTAINER");
+ m_pUpdates = new UpdateDialog::CheckListBox(m_pContainer, *this);
+ Size aSize(LogicToPixel(Size(240, 51), MAP_APPFONT));
+ m_pUpdates->set_width_request(aSize.Width());
+ m_pUpdates->set_height_request(aSize.Height());
+ m_pUpdates->Show();
+ get(m_pAll, "UPDATE_ALL");
+ get(m_pDescription, "DESCRIPTION_LABEL");
+ get(m_pPublisherLabel, "PUBLISHER_LABEL");
+ get(m_pPublisherLink, "PUBLISHER_LINK");
+ get(m_pReleaseNotesLabel, "RELEASE_NOTES_LABEL");
+ get(m_pReleaseNotesLink, "RELEASE_NOTES_LINK");
+ get(m_pDescriptions, "DESCRIPTIONS");
+ aSize = LogicToPixel(Size(240, 59), MAP_APPFONT);
+ m_pDescriptions->set_width_request(aSize.Width());
+ m_pDescriptions->set_height_request(aSize.Height());
+ get(m_pOk, "INSTALL");
+ get(m_pClose, "gtk-close");
+ get(m_pHelp, "gtk-help");
OSL_ASSERT(updateData != NULL);
m_xExtensionManager = deployment::ExtensionManager::get( context );
@@ -544,13 +550,12 @@ UpdateDialog::UpdateDialog(
} catch (const uno::Exception & e) {
throw uno::RuntimeException(e.Message, e.Context);
}
- m_updates.SetSelectHdl(LINK(this, UpdateDialog, selectionHandler));
- m_all.SetToggleHdl(LINK(this, UpdateDialog, allHandler));
- m_ok.SetClickHdl(LINK(this, UpdateDialog, okHandler));
- m_close.SetClickHdl(LINK(this, UpdateDialog, closeHandler));
+ m_pUpdates->SetSelectHdl(LINK(this, UpdateDialog, selectionHandler));
+ m_pAll->SetToggleHdl(LINK(this, UpdateDialog, allHandler));
+ m_pOk->SetClickHdl(LINK(this, UpdateDialog, okHandler));
+ m_pClose->SetClickHdl(LINK(this, UpdateDialog, closeHandler));
if ( ! dp_misc::office_is_running())
- m_help.Disable();
- FreeResource();
+ m_pHelp->Disable();
initDescription();
getIgnoredUpdates();
@@ -569,6 +574,7 @@ UpdateDialog::~UpdateDialog()
{
delete (*i);
}
+ delete m_pUpdates;
}
@@ -578,23 +584,20 @@ bool UpdateDialog::Close() {
}
short UpdateDialog::Execute() {
- m_throbber.start();
+ m_pthrobber->start();
m_thread->launch();
return ModalDialog::Execute();
}
-
-
-
-UpdateDialog::CheckListBox::CheckListBox( UpdateDialog & dialog, ResId const & resource,
- Image const & normalStaticImage ):
- SvxCheckListBox( &dialog, resource, normalStaticImage ),
+UpdateDialog::CheckListBox::CheckListBox( Window* pParent, UpdateDialog & dialog):
+ SvxCheckListBox( pParent, WinBits(WB_BORDER) ),
m_ignoreUpdate( DPGUI_RESSTR( RID_DLG_UPDATE_IGNORE ) ),
m_ignoreAllUpdates( DPGUI_RESSTR( RID_DLG_UPDATE_IGNORE_ALL ) ),
m_enableUpdate( DPGUI_RESSTR( RID_DLG_UPDATE_ENABLE ) ),
m_dialog(dialog)
-{}
-
+{
+ SetNormalStaticImage(Image(DpGuiResId(RID_DLG_UPDATE_NORMALALERT)));
+}
UpdateDialog::CheckListBox::~CheckListBox() {}
@@ -689,12 +692,12 @@ void UpdateDialog::CheckListBox::handlePopupMenu( const Point &rPos )
sal_uInt16 UpdateDialog::insertItem( UpdateDialog::Index *pEntry, SvLBoxButtonKind kind )
{
- m_updates.InsertEntry( pEntry->m_aName, TREELIST_APPEND, static_cast< void * >( pEntry ), kind );
+ m_pUpdates->InsertEntry( pEntry->m_aName, TREELIST_APPEND, static_cast< void * >( pEntry ), kind );
- for ( sal_uInt16 i = m_updates.getItemCount(); i != 0 ; )
+ for ( sal_uInt16 i = m_pUpdates->getItemCount(); i != 0 ; )
{
i -= 1;
- UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData( i ) );
+ UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_pUpdates->GetEntryData( i ) );
if ( p == pEntry )
return i;
}
@@ -705,14 +708,14 @@ sal_uInt16 UpdateDialog::insertItem( UpdateDialog::Index *pEntry, SvLBoxButtonKi
void UpdateDialog::addAdditional( UpdateDialog::Index * index, SvLBoxButtonKind kind )
{
- m_all.Enable();
- if (m_all.IsChecked())
+ m_pAll->Enable();
+ if (m_pAll->IsChecked())
{
insertItem( index, kind );
- m_update.Enable();
- m_updates.Enable();
- m_description.Enable();
- m_descriptions.Enable();
+ m_pUpdate->Enable();
+ m_pUpdates->Enable();
+ m_pDescription->Enable();
+ m_pDescriptions->Enable();
}
}
@@ -732,15 +735,15 @@ void UpdateDialog::addEnabledUpdate( OUString const & name,
if ( ! isIgnoredUpdate( pEntry ) )
{
sal_uInt16 nPos = insertItem( pEntry, SvLBoxButtonKind_enabledCheckbox );
- m_updates.CheckEntryPos( nPos );
+ m_pUpdates->CheckEntryPos( nPos );
}
else
addAdditional( pEntry, SvLBoxButtonKind_disabledCheckbox );
- m_update.Enable();
- m_updates.Enable();
- m_description.Enable();
- m_descriptions.Enable();
+ m_pUpdate->Enable();
+ m_pUpdates->Enable();
+ m_pDescription->Enable();
+ m_pDescriptions->Enable();
}
@@ -775,27 +778,27 @@ void UpdateDialog::addSpecificError( UpdateDialog::SpecificError & data )
}
void UpdateDialog::checkingDone() {
- m_checking.Hide();
- m_throbber.stop();
- m_throbber.Hide();
- if (m_updates.getItemCount() == 0)
+ m_pchecking->Hide();
+ m_pthrobber->stop();
+ m_pthrobber->Hide();
+ if (m_pUpdates->getItemCount() == 0)
{
clearDescription();
- m_description.Enable();
- m_descriptions.Enable();
+ m_pDescription->Enable();
+ m_pDescriptions->Enable();
if ( m_disabledUpdates.empty() && m_specificErrors.empty() && m_ignoredUpdates.empty() )
- showDescription( m_none, false );
+ showDescription( m_none );
else
- showDescription( m_noInstallable, false );
+ showDescription( m_noInstallable );
}
enableOk();
}
void UpdateDialog::enableOk() {
- if (!m_checking.IsVisible()) {
- m_ok.Enable(m_updates.GetCheckedEntryCount() != 0);
+ if (!m_pchecking->IsVisible()) {
+ m_pOk->Enable(m_pUpdates->GetCheckedEntryCount() != 0);
}
}
@@ -869,11 +872,11 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly )
if ( ! bRecheckOnly )
{
sal_Int32 nCount = 0;
- for ( sal_Int16 i = 0; i < m_updates.getItemCount(); ++i )
+ for ( sal_Int16 i = 0; i < m_pUpdates->getItemCount(); ++i )
{
uno::Sequence< OUString > aItem(2);
- UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >(m_updates.GetEntryData(i));
+ UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >(m_pUpdates->GetEntryData(i));
if ( p->m_eKind == ENABLED_UPDATE )
{
@@ -900,70 +903,29 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly )
void UpdateDialog::initDescription()
{
- m_PublisherLabel.Hide();
- m_PublisherLink.Hide();
- m_ReleaseNotesLabel.Hide();
- m_ReleaseNotesLink.Hide();
- m_descriptions.Hide();
+ m_pPublisherLabel->Hide();
+ m_pPublisherLink->Hide();
+ m_pReleaseNotesLabel->Hide();
+ m_pReleaseNotesLink->Hide();
+ m_pDescriptions->Hide();
Link aLink = LINK( this, UpdateDialog, hyperlink_clicked );
- m_PublisherLink.SetClickHdl( aLink );
- m_ReleaseNotesLink.SetClickHdl( aLink );
-
- long nTextWidth = m_PublisherLabel.GetCtrlTextWidth( m_PublisherLabel.GetText() );
- long nTemp = m_ReleaseNotesLabel.GetTextWidth( m_ReleaseNotesLabel.GetText() );
- if ( nTemp > nTextWidth )
- nTextWidth = nTemp;
- nTextWidth = nTextWidth * 110 / 100;
-
- Size aNewSize = m_PublisherLabel.GetSizePixel();
- if ( nTextWidth > aNewSize.Width() )
- {
- long nDelta = nTextWidth - aNewSize.Width();
- aNewSize.Width() = nTextWidth;
- m_PublisherLabel.SetSizePixel( aNewSize );
- m_ReleaseNotesLabel.SetSizePixel( aNewSize );
-
- aNewSize = m_PublisherLink.GetSizePixel();
- aNewSize.Width() = aNewSize.Width() - nDelta;
- Point aNewPos = m_PublisherLink.GetPosPixel();
- aNewPos.X() = aNewPos.X() + nDelta;
- m_PublisherLink.SetPosSizePixel( aNewPos, aNewSize );
- aNewPos.Y() = m_ReleaseNotesLink.GetPosPixel().Y();
- m_ReleaseNotesLink.SetPosSizePixel( aNewPos, aNewSize );
- }
-
- m_aFirstLinePos = m_descriptions.GetPosPixel();
- m_aFirstLineSize = m_descriptions.GetSizePixel();
- Size aMarginSize = LogicToPixel( Size( RSC_SP_CTRL_GROUP_X, RSC_SP_CTRL_GROUP_Y ), MAP_APPFONT );
- Point aThirdLinePos = m_ReleaseNotesLabel.GetPosPixel();
- aThirdLinePos.Y() = aThirdLinePos.Y() + m_ReleaseNotesLabel.GetSizePixel().Height() + aMarginSize.Height();
- m_nFirstLineDelta = aThirdLinePos.Y() - m_aFirstLinePos.Y();
- m_nOneLineMissing = m_ReleaseNotesLabel.GetPosPixel().Y() - m_PublisherLabel.GetPosPixel().Y();
+ m_pPublisherLink->SetClickHdl( aLink );
+ m_pReleaseNotesLink->SetClickHdl( aLink );
}
void UpdateDialog::clearDescription()
{
OUString sEmpty;
- m_PublisherLabel.Hide();
- m_PublisherLink.Hide();
- m_PublisherLink.SetText( sEmpty );
- m_PublisherLink.SetURL( sEmpty );
- m_ReleaseNotesLabel.Hide();
- m_ReleaseNotesLink.Hide();
- m_ReleaseNotesLink.SetURL( sEmpty );
- if ( m_PublisherLabel.GetPosPixel().Y() == m_ReleaseNotesLabel.GetPosPixel().Y() )
- {
- Point aNewPos = m_ReleaseNotesLabel.GetPosPixel();
- aNewPos.Y() += m_nOneLineMissing;
- m_ReleaseNotesLabel.SetPosPixel( aNewPos );
- aNewPos = m_ReleaseNotesLink.GetPosPixel();
- aNewPos.Y() += m_nOneLineMissing;
- m_ReleaseNotesLink.SetPosPixel( aNewPos );
- }
- m_descriptions.Hide();
- m_descriptions.Clear();
- m_descriptions.SetPosSizePixel( m_aFirstLinePos, m_aFirstLineSize );
+ m_pPublisherLabel->Hide();
+ m_pPublisherLink->Hide();
+ m_pPublisherLink->SetText( sEmpty );
+ m_pPublisherLink->SetURL( sEmpty );
+ m_pReleaseNotesLabel->Hide();
+ m_pReleaseNotesLink->Hide();
+ m_pReleaseNotesLink->SetURL( sEmpty );
+ m_pDescriptions->Hide();
+ m_pDescriptions->Clear();
}
bool UpdateDialog::showDescription(uno::Reference< xml::dom::XNode > const & aUpdateInfo)
@@ -991,51 +953,31 @@ bool UpdateDialog::showDescription(std::pair< OUString, OUString > const & pairP
// nothing to show
return false;
- bool bPublisher = false;
if ( !sPub.isEmpty() )
{
- m_PublisherLabel.Show();
- m_PublisherLink.Show();
- m_PublisherLink.SetText( sPub );
- m_PublisherLink.SetURL( sURL );
- bPublisher = true;
+ m_pPublisherLabel->Show();
+ m_pPublisherLink->Show();
+ m_pPublisherLink->SetText( sPub );
+ m_pPublisherLink->SetURL( sURL );
}
if ( !sReleaseNotes.isEmpty() )
{
- if ( !bPublisher )
- {
- m_ReleaseNotesLabel.SetPosPixel( m_PublisherLabel.GetPosPixel() );
- m_ReleaseNotesLink.SetPosPixel( m_PublisherLink.GetPosPixel() );
- }
- m_ReleaseNotesLabel.Show();
- m_ReleaseNotesLink.Show();
- m_ReleaseNotesLink.SetURL( sReleaseNotes );
+ m_pReleaseNotesLabel->Show();
+ m_pReleaseNotesLink->Show();
+ m_pReleaseNotesLink->SetURL( sReleaseNotes );
}
return true;
}
-bool UpdateDialog::showDescription( const OUString& rDescription, bool bWithPublisher )
+bool UpdateDialog::showDescription( const OUString& rDescription)
{
if ( rDescription.isEmpty() )
// nothing to show
return false;
- if ( bWithPublisher )
- {
- bool bOneLineMissing = !m_ReleaseNotesLabel.IsVisible() || !m_PublisherLabel.IsVisible();
- Point aNewPos = m_aFirstLinePos;
- aNewPos.Y() += m_nFirstLineDelta;
- if ( bOneLineMissing )
- aNewPos.Y() -= m_nOneLineMissing;
- Size aNewSize = m_aFirstLineSize;
- aNewSize.Height() -= m_nFirstLineDelta;
- if ( bOneLineMissing )
- aNewSize.Height() += m_nOneLineMissing;
- m_descriptions.SetPosSizePixel( aNewPos, aNewSize );
- }
- m_descriptions.Show();
- m_descriptions.SetText( rDescription );
+ m_pDescriptions->Show();
+ m_pDescriptions->SetText( rDescription );
return true;
}
@@ -1199,9 +1141,8 @@ void UpdateDialog::setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore,
IMPL_LINK_NOARG(UpdateDialog, selectionHandler)
{
OUStringBuffer b;
- bool bInserted = false;
UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >(
- m_updates.GetEntryData(m_updates.GetSelectEntryPos()));
+ m_pUpdates->GetEntryData(m_pUpdates->GetSelectEntryPos()));
clearDescription();
if ( p != NULL )
@@ -1213,9 +1154,9 @@ IMPL_LINK_NOARG(UpdateDialog, selectionHandler)
case ENABLED_UPDATE:
{
if ( m_enabledUpdates[ pos ].aUpdateSource.is() )
- bInserted = showDescription( m_enabledUpdates[ pos ].aUpdateSource );
+ showDescription( m_enabledUpdates[ pos ].aUpdateSource );
else
- bInserted = showDescription( m_enabledUpdates[ pos ].aUpdateInfo );
+ showDescription( m_enabledUpdates[ pos ].aUpdateInfo );
if ( p->m_bIgnored )
b.append( m_ignoredUpdate );
@@ -1225,7 +1166,7 @@ IMPL_LINK_NOARG(UpdateDialog, selectionHandler)
case DISABLED_UPDATE:
{
if ( !m_disabledUpdates.empty() )
- bInserted = showDescription( m_disabledUpdates[pos].aUpdateInfo );
+ showDescription( m_disabledUpdates[pos].aUpdateInfo );
if ( p->m_bIgnored )
b.append( m_ignoredUpdate );
@@ -1292,18 +1233,18 @@ IMPL_LINK_NOARG(UpdateDialog, selectionHandler)
if ( b.isEmpty() )
b.append( m_noDescription );
- showDescription( b.makeStringAndClear(), bInserted );
+ showDescription( b.makeStringAndClear() );
return 0;
}
IMPL_LINK_NOARG(UpdateDialog, allHandler)
{
- if (m_all.IsChecked())
+ if (m_pAll->IsChecked())
{
- m_update.Enable();
- m_updates.Enable();
- m_description.Enable();
- m_descriptions.Enable();
+ m_pUpdate->Enable();
+ m_pUpdates->Enable();
+ m_pDescription->Enable();
+ m_pDescriptions->Enable();
for (std::vector< UpdateDialog::Index* >::iterator i( m_ListboxEntries.begin() );
i != m_ListboxEntries.end(); ++i )
@@ -1314,26 +1255,26 @@ IMPL_LINK_NOARG(UpdateDialog, allHandler)
}
else
{
- for ( sal_uInt16 i = 0; i < m_updates.getItemCount(); )
+ for ( sal_uInt16 i = 0; i < m_pUpdates->getItemCount(); )
{
- UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData(i) );
+ UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_pUpdates->GetEntryData(i) );
if ( p->m_bIgnored || ( p->m_eKind != ENABLED_UPDATE ) )
{
- m_updates.RemoveEntry(i);
+ m_pUpdates->RemoveEntry(i);
} else {
++i;
}
}
- if (m_updates.getItemCount() == 0)
+ if (m_pUpdates->getItemCount() == 0)
{
clearDescription();
- m_update.Disable();
- m_updates.Disable();
- if (m_checking.IsVisible())
- m_description.Disable();
+ m_pUpdate->Disable();
+ m_pUpdates->Disable();
+ if (m_pchecking->IsVisible())
+ m_pDescription->Disable();
else
- showDescription(m_noInstallable,false);
+ showDescription(m_noInstallable);
}
}
return 0;
@@ -1352,11 +1293,11 @@ IMPL_LINK_NOARG(UpdateDialog, okHandler)
}
- for (sal_uInt16 i = 0; i < m_updates.getItemCount(); ++i) {
+ for (sal_uInt16 i = 0; i < m_pUpdates->getItemCount(); ++i) {
UpdateDialog::Index const * p =
static_cast< UpdateDialog::Index const * >(
- m_updates.GetEntryData(i));
- if (p->m_eKind == ENABLED_UPDATE && m_updates.IsChecked(i)) {
+ m_pUpdates->GetEntryData(i));
+ if (p->m_eKind == ENABLED_UPDATE && m_pUpdates->IsChecked(i)) {
m_updateData.push_back( m_enabledUpdates[ p->m_nIndex ] );
}
}