Author: tgoettlicher Date: Fri May 18 16:31:35 2007 New Revision: 5565 URL: http://svn.opensuse.org/viewcvs/zypp?rev=5565&view=rev Log: - button logic for backends that use QListView with and without package selection - code clean-up Modified: branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidget.cpp branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidgetUI.ui 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/Updater.h branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp branches/work/updater-kde-refactoring/updater-kde/updater/dummy/DummyUpdater.cpp branches/work/updater-kde-refactoring/updater-kde/updater/dummy/DummyUpdater.h branches/work/updater-kde-refactoring/updater-kde/updater/opensusestart.desktop branches/work/updater-kde-refactoring/updater-kde/updater/opensuseupdater_backend.desktop Modified: branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidget.cpp URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidget.cpp?rev=5565&r1=5564&r2=5565&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidget.cpp (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidget.cpp Fri May 18 16:31:35 2007 @@ -77,8 +77,9 @@ comboBackendPlugin->setCurrentItem(comboBackendPlugin->count()-1); } - // when the config file contains no valid plugin name (e.g. empty because of first program start)) // we write the selected combobox item to the config file + // because we want to prevent, that the config file contains no valid plugin name + // (e.g. empty because of first program start)) UpdaterSettings::self()->setBackendPlugin(pluginMap[comboBackendPlugin->currentItem()]); UpdaterSettings::self()->writeConfig(); } Modified: branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidgetUI.ui URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidgetUI.ui?rev=5565&r1=5564&r2=5565&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidgetUI.ui (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidgetUI.ui Fri May 18 16:31:35 2007 @@ -1,90 +1,83 @@ <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> <class>ConfigWidgetUI</class> <widget class="QWidget"> - <property name="name"> - <cstring>ConfigWidgetUI</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>600</width> - <height>166</height> - </rect> - </property> - <property name="caption"> - <string>Form1</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QSpinBox"> - <property name="name"> - <cstring>kcfg_Interval</cstring> - </property> - <property name="prefix"> - <string>Check For Updates Every </string> - </property> - <property name="suffix"> - <string> Hours</string> - </property> - <property name="minValue"> - <number>1</number> - </property> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>kcfg_Autostart</cstring> - </property> - <property name="text"> - <string>Automa&tically start updater on login</string> - </property> - <property name="accel"> - <string>Alt+T</string> - </property> - </widget> - - - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - - - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel</cstring> - </property> - <property name="text"> - <string>Backend:</string> - </property> - </widget> - - <widget class="QFrame" row="2" column="2"> - <property name="name"> - <cstring>BackendFrame</cstring> - </property> - <property name="frameShape"> - <enum>NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>Plain</enum> - </property> - </widget> - - - - - </hbox> - - - + <property name="name"> + <cstring>ConfigWidgetUI</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>166</height> + </rect> + </property> + <property name="caption"> + <string>Form1</string> + </property> + + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + + <widget class="QSpinBox"> + <property name="name"> + <cstring>kcfg_Interval</cstring> + </property> + <property name="prefix"> + <string>Check For Updates Every </string> + </property> + <property name="suffix"> + <string> Hours</string> + </property> + <property name="minValue"> + <number>1</number> + </property> + </widget> - </vbox> + <widget class="QCheckBox"> + <property name="name"> + <cstring>kcfg_Autostart</cstring> + </property> + <property name="text"> + <string>Automa&tically start updater on login</string> + </property> + <property name="accel"> + <string>Alt+T</string> + </property> </widget> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel</cstring> + </property> + <property name="text"> + <string>Backend:</string> + </property> + </widget> + + <widget class="QFrame" row="2" column="2"> + <property name="name"> + <cstring>BackendFrame</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + </widget> + + </hbox> + </vbox> +</widget> <layoutdefaults spacing="6" margin="11"/> </UI> 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=5565&r1=5564&r2=5565&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp Fri May 18 16:31:35 2007 @@ -174,11 +174,11 @@ hide(); } -void MainWindow::updateButtons() { - -// if there are updates selected for installation, enable this button -if ( (_caps.canSelectIndividualUpdates==true && updatesSelected > 0) ) // || -// (_caps.canSelectIndividualUpdates==false && > 0) ) +void MainWindow::updateButtons() +{ + // when are updates are selected for installation, enable "Install" button + if ( (_caps.canSelectIndividualUpdates==true && updatesSelected > 0) || + (_caps.canSelectIndividualUpdates==false && updateList->childCount() > 0 ) ) { installButton->setDisabled(false); } @@ -248,49 +248,10 @@ } - -// TODO void MainWindow::populateDone() { kdDebug() << "populateDone()" << endl; - - //if selectAllButton is not NULL, then we have check boxes - if (selectAllButton != NULL) { - //UpdateListItems we have (yoda am I in this comment) - QListViewItem *item = updateList->firstChild(); - - /* - We loop through the list here, giving each UpdateListItem a reference to count. - This count variable is basically just a semephore type thing that controls which - buttons are enabled. Only useful for those backends that use checkboxes. - */ - - while (item != NULL) { - //((UpdateListItem*)item)->setCount(updatesSelected); - item = item->nextSibling(); - } - } - //applet->setUpdates(updateList->childCount()); - updateButtons(); - -} - - -// TODO -void MainWindow::disableSelectButtons() { - - //if selectAllButton is not NULL, we have not yet disabled it - if (selectAllButton != NULL) { - selectionButtonsLayout->remove(selectAllButton); - selectionButtonsLayout->remove(clearSelectionButton); - - delete selectAllButton; - delete clearSelectionButton; - delete selectionButtonsLayout; - selectAllButton = clearSelectionButton = NULL; - update(); - } } void MainWindow::gotDescription(QString description) { @@ -357,12 +318,6 @@ return true; } -/************************************************************************* - NOTE: These two functions assume we pack the list with QCheckListItems. - If this is not the case, the Updater class needs to disable these buttons. - You do this by emitting the "disableSelectButtons" signal. -*************************************************************************/ - void MainWindow::selectButtonClicked() { QCheckListItem *item = (QCheckListItem*)updateList->firstChild(); @@ -433,6 +388,7 @@ void MainWindow::slotPackageClicked(QListViewItem *pack) { + emit(updateSelected(pack)); } //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=5565&r1=5564&r2=5565&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h Fri May 18 16:31:35 2007 @@ -174,12 +174,6 @@ /** - Hides and deletes the "Select All" and "Clear Selection" - buttons. This is for backends which do not QCheckListItems. - */ - void disableSelectButtons(); - - /** Gets the description from the backend. We probably just sent an "updateSelected" signal to signal for the description. Modified: branches/work/updater-kde-refactoring/updater-kde/updater/Updater.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/Updater.h?rev=5565&r1=5564&r2=5565&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/Updater.h (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/Updater.h Fri May 18 16:31:35 2007 @@ -104,14 +104,6 @@ void refreshList(); /** - Send this signal to disable the two selection buttons - on the GUI. You do this if you are not going to load - the list with UpdateListItems. If you don't disable - these buttons, we assume you are using UpdateListItems. - **/ - void disableSelectButtons(); - - /** Fire this signal to deliver the description of the currently selected update back to the main window. 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=5565&r1=5564&r2=5565&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp Fri May 18 16:31:35 2007 @@ -165,9 +165,6 @@ //Signal which allows updater "plugins" to force an update refresh connect(updater, SIGNAL(refreshList()), _main, SLOT(checkUpdates())); - //Signal to hide selection buttons if updater doesn't pack QCheckListItems - connect(updater, SIGNAL(disableSelectButtons()), _main, SLOT(disableSelectButtons())); - //Starts installation connect(_main, SIGNAL(startInstall()), updater, SLOT(startInstall())); Modified: branches/work/updater-kde-refactoring/updater-kde/updater/dummy/DummyUpdater.cpp URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/dummy/DummyUpdater.cpp?rev=5565&r1=5564&r2=5565&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/dummy/DummyUpdater.cpp (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/dummy/DummyUpdater.cpp Fri May 18 16:31:35 2007 @@ -101,7 +101,7 @@ // Since this is a dummy backend we have no real updates // We will construct an example patch - int patchcount=1; + int patchcount=3; QCheckListItem *newItem; QCheckListItem *newItem2; @@ -175,10 +175,6 @@ doCheckForUpdates(); } -void DummyUpdater::updateSelected(QListViewItem *item) -{ -} - void DummyUpdater::updateMenu(QListViewItem *item, const QPoint& point) { } @@ -209,5 +205,14 @@ inst_source->start( KProcess::NotifyOnExit ); } + +void DummyUpdater::updateSelected(QListViewItem *item) +{ + // retrieve description + kdDebug() << "updating item" << endl; + emit(returnDescription("This path does nothing.")); +} + + #include "DummyUpdater.moc" Modified: branches/work/updater-kde-refactoring/updater-kde/updater/dummy/DummyUpdater.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/dummy/DummyUpdater.h?rev=5565&r1=5564&r2=5565&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/dummy/DummyUpdater.h (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/dummy/DummyUpdater.h Fri May 18 16:31:35 2007 @@ -103,6 +103,7 @@ void slotProcessExited( KProcess *proc ); void slotReceivedStdout(KProcess *proc, char *buffer, int buflen); void slotReceivedStderr(KProcess *proc, char *buffer, int buflen); + private: Modified: branches/work/updater-kde-refactoring/updater-kde/updater/opensusestart.desktop URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/opensusestart.desktop?rev=5565&r1=5564&r2=5565&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/opensusestart.desktop (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/opensusestart.desktop Fri May 18 16:31:35 2007 @@ -8,4 +8,4 @@ X-KDE-StartupNotify=false X-KDE-autostart-condition=opensuseupdaterrc:General:Autostart:true X-KDE-autostart-after=panel -NotShowIn=KDE \ No newline at end of file +NotShowIn=KDE Modified: branches/work/updater-kde-refactoring/updater-kde/updater/opensuseupdater_backend.desktop URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/opensuseupdater_backend.desktop?rev=5565&r1=5564&r2=5565&view=diff ============================================================================== --- branches/work/updater-kde-refactoring/updater-kde/updater/opensuseupdater_backend.desktop (original) +++ branches/work/updater-kde-refactoring/updater-kde/updater/opensuseupdater_backend.desktop Fri May 18 16:31:35 2007 @@ -1,4 +1,4 @@ [Desktop Entry] Type=ServiceType X-KDE-ServiceType=openSUSEUpdater/Backend -Comment=Backend for openSUSE updater applet \ No newline at end of file +Comment=Backend for openSUSE updater applet -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org