Author: tgoettlicher Date: Mon May 14 16:43:24 2007 New Revision: 5543 URL: http://svn.opensuse.org/viewcvs/zypp?rev=5543&view=rev Log: Enable/disable Buttons when plugin capabilites are changed while runtime. Modified: branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp Modified: branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp?rev=5543&r1=5542&r2=5543&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp Mon May 14 16:43:24 2007 @@ -51,12 +51,23 @@ +void MainWindow::setUpdaterCapabilities(const UpdaterCapabilities &caps) +{ + kdDebug() << "CAPS" << _caps.canSelectIndividualUpdates << endl; + + _caps = caps; + + if (_caps.canSelectIndividualUpdates==false) + disableButtons(true); + else + disableButtons(false); +} + + MainWindow::MainWindow( const UpdaterCapabilities &caps, QWidget *parent) : KMainWindow(parent) - , _caps(caps) { - kdDebug() << "CAPS" << _caps.canSelectIndividualUpdates << endl; KIconLoader iconLoader(PROGRAM_NAME); @@ -131,29 +142,17 @@ installButton = new KPushButton(KStdGuiItem::ok(), centralWidget); installButton->setText(i18n("Install")); - if ( _caps.canSelectIndividualUpdates ) - { - selectAllButton = new KPushButton(i18n("Select All"), centralWidget); - clearSelectionButton = new KPushButton(i18n("Clear Selection"), centralWidget); - } - else - { - selectAllButton = 0L; - clearSelectionButton = 0L; - updateList->setSelectionMode ( QListView::NoSelection ); - } + selectAllButton = new KPushButton(i18n("Select All"), centralWidget); + clearSelectionButton = new KPushButton(i18n("Clear Selection"), centralWidget); +// updateList->setSelectionMode ( QListView::NoSelection ); mainBox->addWidget(header, 0, 0); mainBox->addWidget(updateList, 0, 0); selectionButtonsLayout = new QHBoxLayout(mainBox); - - if ( _caps.canSelectIndividualUpdates ) - { - selectionButtonsLayout->addWidget(selectAllButton, false, Qt::AlignLeft); - selectionButtonsLayout->addWidget(clearSelectionButton, false, Qt::AlignRight); - } + selectionButtonsLayout->addWidget(selectAllButton, false, Qt::AlignLeft); + selectionButtonsLayout->addWidget(clearSelectionButton, false, Qt::AlignRight); packageDescription->setReadOnly(true); packageDescription->setMinimumHeight(125); @@ -169,13 +168,8 @@ connect(configureButton, SIGNAL(clicked()), this, SLOT(serverButtonClicked())); connect(installButton, SIGNAL(clicked()), this, SLOT(installButtonClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(hide())); - - - if ( _caps.canSelectIndividualUpdates ) - { - connect(selectAllButton, SIGNAL(clicked()), this, SLOT(selectButtonClicked())); - connect(clearSelectionButton, SIGNAL(clicked()), this, SLOT(clearButtonClicked())); - } + connect(selectAllButton, SIGNAL(clicked()), this, SLOT(selectButtonClicked())); + connect(clearSelectionButton, SIGNAL(clicked()), this, SLOT(clearButtonClicked())); header->setDescription(i18n("<b>Available Updates:</b><br> The following are software upgrades and patches to add features and fix bugs.<br>")); @@ -411,15 +405,15 @@ //Selection/Fetch Description slots void MainWindow::slotPackageSelected(QListViewItem *packageSelected) { - if (selectAllButton != NULL) { +// if (selectAllButton != NULL) { //We have to enable the select buttons here, if they exist - disableButtons(false); - } +// disableButtons(false); +// } emit(updateSelected(packageSelected)); } void MainWindow::slotPackageClicked(QListViewItem *pack) { - disableButtons(false); +// disableButtons(false); } //Menu/Lock Menu Slot Modified: branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h?rev=5543&r1=5542&r2=5543&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h Mon May 14 16:43:24 2007 @@ -73,12 +73,16 @@ Q_OBJECT public: + void setUpdaterCapabilities( const UpdaterCapabilities &caps ); + /** Init function @param parent the parent window, always null in our case. */ MainWindow( const UpdaterCapabilities &caps, QWidget *parent=0); + + signals: void settingsChanged(); Modified: branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp?rev=5543&r1=5542&r2=5543&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp Mon May 14 16:43:24 2007 @@ -47,6 +47,7 @@ connectToPlugin(); + _main->setUpdaterCapabilities(UpdaterCapabilities()); } void UpdaterApplication::connectToPlugin() -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org