-rw-r--r-- | noncore/settings/packagemanager/ChangeLog | 4 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 51 |
2 files changed, 48 insertions, 7 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog index 744122f..6ad724f 100644 --- a/noncore/settings/packagemanager/ChangeLog +++ b/noncore/settings/packagemanager/ChangeLog | |||
@@ -1,21 +1,25 @@ | |||
1 | 2004-02-13 Dan Williams <drw@handhelds.org> | ||
2 | |||
3 | * Fix handling of filtering options in View menu | ||
4 | |||
1 | 2004-02-12 Dan Williams <drw@handhelds.org> | 5 | 2004-02-12 Dan Williams <drw@handhelds.org> |
2 | 6 | ||
3 | * Package information dialog implemented | 7 | * Package information dialog implemented |
4 | * What's This app icon enabled | 8 | * What's This app icon enabled |
5 | * Changed all QDialog::exec() occurences to QPEApplication::execDialog() | 9 | * Changed all QDialog::exec() occurences to QPEApplication::execDialog() |
6 | 10 | ||
7 | 2004-01-23 Dan Williams <drw@handhelds.org> | 11 | 2004-01-23 Dan Williams <drw@handhelds.org> |
8 | 12 | ||
9 | * Added package download functionality | 13 | * Added package download functionality |
10 | * Have Opie update links after install/removal so that apps | 14 | * Have Opie update links after install/removal so that apps |
11 | will display properly in Launcher | 15 | will display properly in Launcher |
12 | 16 | ||
13 | 2004-01-20 Dan Williams <drw@handhelds.org> | 17 | 2004-01-20 Dan Williams <drw@handhelds.org> |
14 | 18 | ||
15 | * Released version 0.2.0 | 19 | * Released version 0.2.0 |
16 | * Converted to use libipkg in place of spawning ipkg process | 20 | * Converted to use libipkg in place of spawning ipkg process |
17 | 21 | ||
18 | 2004-01-13 Dan Williams <drw@handhelds.org> | 22 | 2004-01-13 Dan Williams <drw@handhelds.org> |
19 | 23 | ||
20 | * Released version 0.1.0 | 24 | * Released version 0.1.0 |
21 | * Initial check-in of new package management client to eventually replace AQPkg | 25 | * Initial check-in of new package management client to eventually replace AQPkg |
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 2cb11ba..8fd960f 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -120,204 +120,204 @@ void MainWindow::initPackageList() | |||
120 | QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); | 120 | QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); |
121 | connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), | 121 | connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), |
122 | this, SLOT(slotDisplayPackageInfo(QListViewItem *)) ); | 122 | this, SLOT(slotDisplayPackageInfo(QListViewItem *)) ); |
123 | } | 123 | } |
124 | 124 | ||
125 | void MainWindow::initStatusWidget() | 125 | void MainWindow::initStatusWidget() |
126 | { | 126 | { |
127 | QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); | 127 | QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); |
128 | 128 | ||
129 | m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 129 | m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
130 | layout->addWidget( &m_statusText ); | 130 | layout->addWidget( &m_statusText ); |
131 | 131 | ||
132 | connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); | 132 | connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); |
133 | connect( &m_packman, SIGNAL(statusText(const QString &)), this, SLOT(slotStatusText(const QString &)) ); | 133 | connect( &m_packman, SIGNAL(statusText(const QString &)), this, SLOT(slotStatusText(const QString &)) ); |
134 | connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); | 134 | connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); |
135 | 135 | ||
136 | layout->addWidget( &m_statusBar ); | 136 | layout->addWidget( &m_statusBar ); |
137 | } | 137 | } |
138 | 138 | ||
139 | void MainWindow::initUI() | 139 | void MainWindow::initUI() |
140 | { | 140 | { |
141 | // Build menu and tool bars | 141 | // Build menu and tool bars |
142 | setToolBarsMovable( false ); | 142 | setToolBarsMovable( false ); |
143 | 143 | ||
144 | m_menuBar.setHorizontalStretchable( true ); | 144 | m_menuBar.setHorizontalStretchable( true ); |
145 | QMenuBar *mb = new QMenuBar( &m_menuBar ); | 145 | QMenuBar *mb = new QMenuBar( &m_menuBar ); |
146 | mb->setMargin( 0 ); | 146 | mb->setMargin( 0 ); |
147 | 147 | ||
148 | // Find toolbar | 148 | // Find toolbar |
149 | addToolBar( &m_findBar, QMainWindow::Top, true ); | 149 | addToolBar( &m_findBar, QMainWindow::Top, true ); |
150 | m_findBar.setHorizontalStretchable( true ); | 150 | m_findBar.setHorizontalStretchable( true ); |
151 | m_findEdit = new QLineEdit( &m_findBar ); | 151 | m_findEdit = new QLineEdit( &m_findBar ); |
152 | QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); | 152 | QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); |
153 | m_findBar.setStretchableWidget( m_findEdit ); | 153 | m_findBar.setStretchableWidget( m_findEdit ); |
154 | connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) ); | 154 | connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) ); |
155 | 155 | ||
156 | // Packages menu | 156 | // Packages menu |
157 | QPopupMenu *popup = new QPopupMenu( this ); | 157 | QPopupMenu *popup = new QPopupMenu( this ); |
158 | 158 | ||
159 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); | 159 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); |
160 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 160 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
161 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); | 161 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); |
162 | a->addTo( popup ); | 162 | a->addTo( popup ); |
163 | a->addTo( &m_toolBar ); | 163 | a->addTo( &m_toolBar ); |
164 | 164 | ||
165 | QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); | 165 | QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); |
166 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 166 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
167 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); | 167 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); |
168 | actionUpgrade->addTo( popup ); | 168 | actionUpgrade->addTo( popup ); |
169 | actionUpgrade->addTo( &m_toolBar ); | 169 | actionUpgrade->addTo( &m_toolBar ); |
170 | 170 | ||
171 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); | 171 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); |
172 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); | 172 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); |
173 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 173 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
174 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 174 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
175 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); | 175 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); |
176 | actionDownload->addTo( popup ); | 176 | actionDownload->addTo( popup ); |
177 | actionDownload->addTo( &m_toolBar ); | 177 | actionDownload->addTo( &m_toolBar ); |
178 | 178 | ||
179 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); | 179 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); |
180 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 180 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
181 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); | 181 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); |
182 | a->addTo( popup ); | 182 | a->addTo( popup ); |
183 | a->addTo( &m_toolBar ); | 183 | a->addTo( &m_toolBar ); |
184 | 184 | ||
185 | popup->insertSeparator(); | 185 | popup->insertSeparator(); |
186 | 186 | ||
187 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 187 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); |
188 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 188 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
189 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); | 189 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); |
190 | a->addTo( popup ); | 190 | a->addTo( popup ); |
191 | mb->insertItem( tr( "Actions" ), popup ); | 191 | mb->insertItem( tr( "Actions" ), popup ); |
192 | 192 | ||
193 | // View menu | 193 | // View menu |
194 | popup = new QPopupMenu( this ); | 194 | popup = new QPopupMenu( this ); |
195 | 195 | ||
196 | m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 196 | m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
197 | m_actionShowNotInstalled->setToggleAction( true ); | 197 | m_actionShowNotInstalled->setToggleAction( true ); |
198 | m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); | 198 | m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); |
199 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); | 199 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); |
200 | m_actionShowNotInstalled->addTo( popup ); | 200 | m_actionShowNotInstalled->addTo( popup ); |
201 | 201 | ||
202 | m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); | 202 | m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); |
203 | m_actionShowInstalled->setToggleAction( true ); | 203 | m_actionShowInstalled->setToggleAction( true ); |
204 | m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); | 204 | m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); |
205 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); | 205 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); |
206 | m_actionShowInstalled->addTo( popup ); | 206 | m_actionShowInstalled->addTo( popup ); |
207 | 207 | ||
208 | m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | 208 | m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); |
209 | m_actionShowUpdated->setToggleAction( true ); | 209 | m_actionShowUpdated->setToggleAction( true ); |
210 | m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); | 210 | m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); |
211 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); | 211 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); |
212 | m_actionShowUpdated->addTo( popup ); | 212 | m_actionShowUpdated->addTo( popup ); |
213 | 213 | ||
214 | popup->insertSeparator(); | 214 | popup->insertSeparator(); |
215 | 215 | ||
216 | a = new QAction( tr( "Configure filter" ), QString::null, 0, this, 0 ); | ||
217 | a->setWhatsThis( tr( "Click here to change package filter criteria." ) ); | ||
218 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); | ||
219 | a->addTo( popup ); | ||
220 | |||
221 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), | 216 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), |
222 | QString::null, 0, this, 0 ); | 217 | QString::null, 0, this, 0 ); |
223 | m_actionFilter->setToggleAction( true ); | 218 | m_actionFilter->setToggleAction( true ); |
224 | m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); | 219 | m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); |
225 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); | 220 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); |
226 | m_actionFilter->addTo( popup ); | 221 | m_actionFilter->addTo( popup ); |
227 | 222 | ||
223 | a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); | ||
224 | a->setWhatsThis( tr( "Click here to change the package filter criteria." ) ); | ||
225 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); | ||
226 | a->addTo( popup ); | ||
227 | |||
228 | popup->insertSeparator(); | 228 | popup->insertSeparator(); |
229 | 229 | ||
230 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 230 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
231 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | 231 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); |
232 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); | 232 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); |
233 | a->addTo( popup ); | 233 | a->addTo( popup ); |
234 | 234 | ||
235 | m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 235 | m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); |
236 | m_actionFindNext->setEnabled( false ); | 236 | m_actionFindNext->setEnabled( false ); |
237 | m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | 237 | m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); |
238 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); | 238 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); |
239 | m_actionFindNext->addTo( popup ); | 239 | m_actionFindNext->addTo( popup ); |
240 | m_actionFindNext->addTo( &m_findBar ); | 240 | m_actionFindNext->addTo( &m_findBar ); |
241 | 241 | ||
242 | mb->insertItem( tr( "View" ), popup ); | 242 | mb->insertItem( tr( "View" ), popup ); |
243 | 243 | ||
244 | // Finish find toolbar creation | 244 | // Finish find toolbar creation |
245 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 245 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
246 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | 246 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); |
247 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); | 247 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); |
248 | a->addTo( &m_findBar ); | 248 | a->addTo( &m_findBar ); |
249 | m_findBar.hide(); | 249 | m_findBar.hide(); |
250 | } | 250 | } |
251 | 251 | ||
252 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) | 252 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) |
253 | { | 253 | { |
254 | if ( clearList ) | 254 | if ( clearList ) |
255 | m_packageList.clear(); | 255 | m_packageList.clear(); |
256 | 256 | ||
257 | if ( packages ) | 257 | if ( packages ) |
258 | { | 258 | { |
259 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) | 259 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) |
260 | { | 260 | { |
261 | OPackage *package = packageIt.current(); | 261 | OPackage *package = packageIt.current(); |
262 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), | 262 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), |
263 | QCheckListItem::CheckBox ); | 263 | QCheckListItem::CheckBox ); |
264 | m_packageList.insertItem( item ); | 264 | m_packageList.insertItem( item ); |
265 | 265 | ||
266 | // If a different version of package is available, show update available icon | 266 | // If a different version of package is available, show update available icon |
267 | // Otherwise, show installed icon | 267 | // Otherwise, show installed icon |
268 | if ( !package->versionInstalled().isNull() ) | 268 | if ( !package->versionInstalled().isNull() ) |
269 | { | 269 | { |
270 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) | 270 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) |
271 | item->setPixmap( 0, m_iconUpdated ); | 271 | item->setPixmap( 0, m_iconUpdated ); |
272 | else | 272 | else |
273 | item->setPixmap( 0, m_iconInstalled ); | 273 | item->setPixmap( 0, m_iconInstalled ); |
274 | } | 274 | } |
275 | else | 275 | else |
276 | item->setPixmap( 0, m_iconNull ); | 276 | item->setPixmap( 0, m_iconNull ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | void MainWindow::searchForPackage( const QString &text ) | 281 | void MainWindow::searchForPackage( const QString &text ) |
282 | { | 282 | { |
283 | if ( !text.isEmpty() ) | 283 | if ( !text.isEmpty() ) |
284 | { | 284 | { |
285 | // look through package list for text startng at current position | 285 | // look through package list for text startng at current position |
286 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); | 286 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); |
287 | if ( start == 0 ) | 287 | if ( start == 0 ) |
288 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 288 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
289 | 289 | ||
290 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; | 290 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; |
291 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; | 291 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; |
292 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 292 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
293 | { | 293 | { |
294 | if ( item->text().lower().find( text ) != -1 ) | 294 | if ( item->text().lower().find( text ) != -1 ) |
295 | { | 295 | { |
296 | m_packageList.ensureItemVisible( item ); | 296 | m_packageList.ensureItemVisible( item ); |
297 | m_packageList.setCurrentItem( item ); | 297 | m_packageList.setCurrentItem( item ); |
298 | break; | 298 | break; |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | } | 302 | } |
303 | 303 | ||
304 | void MainWindow::initPackageInfo() | 304 | void MainWindow::initPackageInfo() |
305 | { | 305 | { |
306 | m_widgetStack.raiseWidget( &m_statusWidget ); | 306 | m_widgetStack.raiseWidget( &m_statusWidget ); |
307 | 307 | ||
308 | // Load package list | 308 | // Load package list |
309 | m_packman.loadAvailablePackages(); | 309 | m_packman.loadAvailablePackages(); |
310 | m_packman.loadInstalledPackages(); | 310 | m_packman.loadInstalledPackages(); |
311 | 311 | ||
312 | OPackageList *packageList = m_packman.packages(); | 312 | OPackageList *packageList = m_packman.packages(); |
313 | if ( packageList ) | 313 | if ( packageList ) |
314 | { | 314 | { |
315 | loadPackageList( packageList, true ); | 315 | loadPackageList( packageList, true ); |
316 | delete packageList; | 316 | delete packageList; |
317 | } | 317 | } |
318 | 318 | ||
319 | m_widgetStack.raiseWidget( &m_packageList ); | 319 | m_widgetStack.raiseWidget( &m_packageList ); |
320 | } | 320 | } |
321 | 321 | ||
322 | void MainWindow::slotWidgetStackShow( QWidget *widget ) | 322 | void MainWindow::slotWidgetStackShow( QWidget *widget ) |
323 | { | 323 | { |
@@ -461,222 +461,259 @@ void MainWindow::slotApply() | |||
461 | else | 461 | else |
462 | { | 462 | { |
463 | // Remove/reinstall package | 463 | // Remove/reinstall package |
464 | int answer = PromptDlg::ask( tr( "Remove or reinstall" ), | 464 | int answer = PromptDlg::ask( tr( "Remove or reinstall" ), |
465 | tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), | 465 | tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), |
466 | tr( "Remove" ), tr( "Reinstall" ), this ); | 466 | tr( "Remove" ), tr( "Reinstall" ), this ); |
467 | if ( answer == 1 ) // Remove | 467 | if ( answer == 1 ) // Remove |
468 | { | 468 | { |
469 | if ( !removeList ) | 469 | if ( !removeList ) |
470 | removeList = new QStringList(); | 470 | removeList = new QStringList(); |
471 | removeList->append( item->text() ); | 471 | removeList->append( item->text() ); |
472 | } | 472 | } |
473 | else if ( answer == 2 ) // Reinstall | 473 | else if ( answer == 2 ) // Reinstall |
474 | { | 474 | { |
475 | if ( !installList ) | 475 | if ( !installList ) |
476 | installList = new QStringList(); | 476 | installList = new QStringList(); |
477 | installList->append( item->text() ); | 477 | installList->append( item->text() ); |
478 | } | 478 | } |
479 | } | 479 | } |
480 | } | 480 | } |
481 | else | 481 | else |
482 | { | 482 | { |
483 | // Install package | 483 | // Install package |
484 | if ( !installList ) | 484 | if ( !installList ) |
485 | installList = new QStringList(); | 485 | installList = new QStringList(); |
486 | installList->append( item->text() ); | 486 | installList->append( item->text() ); |
487 | } | 487 | } |
488 | } | 488 | } |
489 | } | 489 | } |
490 | } | 490 | } |
491 | 491 | ||
492 | // If nothing is selected, display message and exit | 492 | // If nothing is selected, display message and exit |
493 | if ( !removeList && !installList && !upgradeList ) | 493 | if ( !removeList && !installList && !upgradeList ) |
494 | { | 494 | { |
495 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); | 495 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
496 | return; | 496 | return; |
497 | } | 497 | } |
498 | 498 | ||
499 | // Send command only if there are packages to process | 499 | // Send command only if there are packages to process |
500 | OPackage::Command removeCmd = OPackage::NotDefined; | 500 | OPackage::Command removeCmd = OPackage::NotDefined; |
501 | if ( removeList && !removeList->isEmpty() ) | 501 | if ( removeList && !removeList->isEmpty() ) |
502 | removeCmd = OPackage::Remove; | 502 | removeCmd = OPackage::Remove; |
503 | OPackage::Command installCmd = OPackage::NotDefined; | 503 | OPackage::Command installCmd = OPackage::NotDefined; |
504 | if ( installList && !installList->isEmpty() ) | 504 | if ( installList && !installList->isEmpty() ) |
505 | installCmd = OPackage::Install; | 505 | installCmd = OPackage::Install; |
506 | OPackage::Command upgradeCmd = OPackage::NotDefined; | 506 | OPackage::Command upgradeCmd = OPackage::NotDefined; |
507 | if ( upgradeList && !upgradeList->isEmpty() ) | 507 | if ( upgradeList && !upgradeList->isEmpty() ) |
508 | upgradeCmd = OPackage::Upgrade; | 508 | upgradeCmd = OPackage::Upgrade; |
509 | 509 | ||
510 | // Create package manager output widget | 510 | // Create package manager output widget |
511 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, | 511 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, |
512 | removeCmd, removeList, | 512 | removeCmd, removeList, |
513 | installCmd, installList, | 513 | installCmd, installList, |
514 | upgradeCmd, upgradeList ); | 514 | upgradeCmd, upgradeList ); |
515 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 515 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
516 | 516 | ||
517 | // Display widget | 517 | // Display widget |
518 | m_widgetStack.addWidget( dlg, 3 ); | 518 | m_widgetStack.addWidget( dlg, 3 ); |
519 | m_widgetStack.raiseWidget( dlg ); | 519 | m_widgetStack.raiseWidget( dlg ); |
520 | } | 520 | } |
521 | 521 | ||
522 | void MainWindow::slotCloseDlg() | 522 | void MainWindow::slotCloseDlg() |
523 | { | 523 | { |
524 | // Close install dialog | 524 | // Close install dialog |
525 | delete m_widgetStack.visibleWidget(); | 525 | delete m_widgetStack.visibleWidget(); |
526 | 526 | ||
527 | // Reload package list | 527 | // Reload package list |
528 | initPackageInfo(); | 528 | initPackageInfo(); |
529 | 529 | ||
530 | // Update Opie launcher links | 530 | // Update Opie launcher links |
531 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 531 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
532 | QString lf = QString::null; | 532 | QString lf = QString::null; |
533 | e << lf; | 533 | e << lf; |
534 | } | 534 | } |
535 | 535 | ||
536 | void MainWindow::slotConfigure() | 536 | void MainWindow::slotConfigure() |
537 | { | 537 | { |
538 | if ( m_packman.configureDlg( false ) ) | 538 | if ( m_packman.configureDlg( false ) ) |
539 | { | 539 | { |
540 | if ( PromptDlg::ask( tr( "Config updated" ), | 540 | if ( PromptDlg::ask( tr( "Config updated" ), |
541 | tr( "The configuration has been updated. Do you want to update server and package information now?" ), | 541 | tr( "The configuration has been updated. Do you want to update server and package information now?" ), |
542 | tr( "Yes" ), tr( "No" ), this ) == 1 ) | 542 | tr( "Yes" ), tr( "No" ), this ) == 1 ) |
543 | { | 543 | { |
544 | // Update package list and reload package info | 544 | // Update package list and reload package info |
545 | slotUpdate(); | 545 | slotUpdate(); |
546 | } | 546 | } |
547 | } | 547 | } |
548 | } | 548 | } |
549 | 549 | ||
550 | void MainWindow::slotShowNotInstalled() | 550 | void MainWindow::slotShowNotInstalled() |
551 | { | 551 | { |
552 | OPackageList *packageList; | 552 | OPackageList *packageList; |
553 | if ( m_actionShowNotInstalled->isOn() ) | 553 | if ( m_actionShowNotInstalled->isOn() ) |
554 | { | 554 | { |
555 | m_actionShowInstalled->setOn( false ); | 555 | m_actionShowInstalled->setOn( false ); |
556 | m_actionShowUpdated->setOn( false ); | 556 | m_actionShowUpdated->setOn( false ); |
557 | m_actionFilter->setOn( false ); | ||
557 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 558 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
558 | OPackageManager::NotInstalled, QString::null ); | 559 | OPackageManager::NotInstalled, QString::null ); |
559 | } | 560 | } |
560 | else | 561 | else |
561 | packageList = m_packman.packages(); | 562 | packageList = m_packman.packages(); |
562 | 563 | ||
563 | if ( packageList ) | 564 | if ( packageList ) |
564 | { | 565 | { |
565 | loadPackageList( packageList, true ); | 566 | loadPackageList( packageList, true ); |
566 | delete packageList; | 567 | delete packageList; |
567 | } | 568 | } |
568 | } | 569 | } |
569 | 570 | ||
570 | void MainWindow::slotShowInstalled() | 571 | void MainWindow::slotShowInstalled() |
571 | { | 572 | { |
572 | OPackageList *packageList; | 573 | OPackageList *packageList; |
573 | if ( m_actionShowInstalled->isOn() ) | 574 | if ( m_actionShowInstalled->isOn() ) |
574 | { | 575 | { |
575 | m_actionShowNotInstalled->setOn( false ); | 576 | m_actionShowNotInstalled->setOn( false ); |
576 | m_actionShowUpdated->setOn( false ); | 577 | m_actionShowUpdated->setOn( false ); |
578 | m_actionFilter->setOn( false ); | ||
577 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 579 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
578 | OPackageManager::Installed, QString::null ); | 580 | OPackageManager::Installed, QString::null ); |
579 | } | 581 | } |
580 | else | 582 | else |
581 | packageList = m_packman.packages(); | 583 | packageList = m_packman.packages(); |
582 | 584 | ||
583 | if ( packageList ) | 585 | if ( packageList ) |
584 | { | 586 | { |
585 | loadPackageList( packageList, true ); | 587 | loadPackageList( packageList, true ); |
586 | delete packageList; | 588 | delete packageList; |
587 | } | 589 | } |
588 | } | 590 | } |
589 | 591 | ||
590 | void MainWindow::slotShowUpdated() | 592 | void MainWindow::slotShowUpdated() |
591 | { | 593 | { |
592 | OPackageList *packageList; | 594 | OPackageList *packageList; |
593 | if ( m_actionShowUpdated->isOn() ) | 595 | if ( m_actionShowUpdated->isOn() ) |
594 | { | 596 | { |
595 | m_actionShowInstalled->setOn( false ); | 597 | m_actionShowInstalled->setOn( false ); |
596 | m_actionShowNotInstalled->setOn( false ); | 598 | m_actionShowNotInstalled->setOn( false ); |
599 | m_actionFilter->setOn( false ); | ||
597 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 600 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
598 | OPackageManager::Updated, QString::null ); | 601 | OPackageManager::Updated, QString::null ); |
599 | } | 602 | } |
600 | else | 603 | else |
601 | packageList = m_packman.packages(); | 604 | packageList = m_packman.packages(); |
602 | 605 | ||
603 | if ( packageList ) | 606 | if ( packageList ) |
604 | { | 607 | { |
605 | loadPackageList( packageList, true ); | 608 | loadPackageList( packageList, true ); |
606 | delete packageList; | 609 | delete packageList; |
607 | } | 610 | } |
608 | } | 611 | } |
609 | 612 | ||
610 | void MainWindow::slotFilterChange() | 613 | void MainWindow::slotFilterChange() |
611 | { | 614 | { |
612 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, | 615 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, |
613 | m_filterCategory ); | 616 | m_filterCategory ); |
614 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 617 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
615 | { | 618 | { |
616 | m_filterName = dlg.name(); | 619 | m_filterName = dlg.name(); |
617 | m_filterServer = dlg.server(); | 620 | m_filterServer = dlg.server(); |
618 | m_filterDest = dlg.destination(); | 621 | m_filterDest = dlg.destination(); |
619 | m_filterStatus = dlg.status(); | 622 | m_filterStatus = dlg.status(); |
620 | m_filterCategory = dlg.category(); | 623 | m_filterCategory = dlg.category(); |
621 | m_actionFilter->setOn( true ); | 624 | m_actionFilter->setOn( true ); |
622 | slotFilter( true ); | 625 | slotFilter( true ); |
623 | } | 626 | } |
624 | else | 627 | else |
625 | { | 628 | { |
626 | m_actionFilter->setOn( false ); | 629 | m_actionFilter->setOn( false ); |
627 | slotFilter( false ); | 630 | slotFilter( false ); |
628 | } | 631 | } |
629 | } | 632 | } |
630 | 633 | ||
631 | void MainWindow::slotFilter( bool isOn ) | 634 | void MainWindow::slotFilter( bool isOn ) |
632 | { | 635 | { |
633 | OPackageList *packageList; | 636 | OPackageList *packageList; |
634 | if ( isOn ) | 637 | if ( isOn ) |
635 | { | 638 | { |
636 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | 639 | // Turn off other filtering options |
637 | m_filterStatus, m_filterCategory ); | 640 | m_actionShowNotInstalled->setOn( false ); |
641 | m_actionShowInstalled->setOn( false ); | ||
642 | m_actionShowUpdated->setOn( false ); | ||
643 | |||
644 | // If the filter settings have not been set yet, display filter dialog | ||
645 | if ( m_filterName.isNull() && m_filterServer.isNull() && m_filterDest.isNull() && | ||
646 | m_filterStatus == OPackageManager::NotDefined && m_filterCategory.isNull() ) | ||
647 | { | ||
648 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, | ||
649 | m_filterCategory ); | ||
650 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | ||
651 | { | ||
652 | m_filterName = dlg.name(); | ||
653 | m_filterServer = dlg.server(); | ||
654 | m_filterDest = dlg.destination(); | ||
655 | m_filterStatus = dlg.status(); | ||
656 | m_filterCategory = dlg.category(); | ||
657 | m_actionFilter->setOn( true ); | ||
658 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | ||
659 | m_filterStatus, m_filterCategory ); | ||
660 | } | ||
661 | else | ||
662 | { | ||
663 | m_actionFilter->setOn( false ); | ||
664 | packageList = m_packman.packages(); | ||
665 | } | ||
666 | } | ||
667 | else | ||
668 | { | ||
669 | m_actionFilter->setOn( true ); | ||
670 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | ||
671 | m_filterStatus, m_filterCategory ); | ||
672 | } | ||
673 | |||
674 | |||
638 | } | 675 | } |
639 | else | 676 | else |
640 | packageList = m_packman.packages(); | 677 | packageList = m_packman.packages(); |
641 | 678 | ||
642 | if ( packageList ) | 679 | if ( packageList ) |
643 | { | 680 | { |
644 | loadPackageList( packageList, true ); | 681 | loadPackageList( packageList, true ); |
645 | delete packageList; | 682 | delete packageList; |
646 | } | 683 | } |
647 | } | 684 | } |
648 | 685 | ||
649 | void MainWindow::slotFindShowToolbar() | 686 | void MainWindow::slotFindShowToolbar() |
650 | { | 687 | { |
651 | m_findBar.show(); | 688 | m_findBar.show(); |
652 | m_findEdit->setFocus(); | 689 | m_findEdit->setFocus(); |
653 | } | 690 | } |
654 | 691 | ||
655 | void MainWindow::slotFindHideToolbar() | 692 | void MainWindow::slotFindHideToolbar() |
656 | { | 693 | { |
657 | m_findBar.hide(); | 694 | m_findBar.hide(); |
658 | } | 695 | } |
659 | 696 | ||
660 | void MainWindow::slotFindChanged( const QString &findText ) | 697 | void MainWindow::slotFindChanged( const QString &findText ) |
661 | { | 698 | { |
662 | 699 | ||
663 | m_actionFindNext->setEnabled( !findText.isEmpty() ); | 700 | m_actionFindNext->setEnabled( !findText.isEmpty() ); |
664 | searchForPackage( findText ); | 701 | searchForPackage( findText ); |
665 | } | 702 | } |
666 | 703 | ||
667 | void MainWindow::slotFindNext() | 704 | void MainWindow::slotFindNext() |
668 | { | 705 | { |
669 | searchForPackage( m_findEdit->text() ); | 706 | searchForPackage( m_findEdit->text() ); |
670 | } | 707 | } |
671 | 708 | ||
672 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) | 709 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) |
673 | { | 710 | { |
674 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); | 711 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); |
675 | 712 | ||
676 | // Create package manager output widget | 713 | // Create package manager output widget |
677 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); | 714 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); |
678 | 715 | ||
679 | // Display widget | 716 | // Display widget |
680 | m_widgetStack.addWidget( dlg, 3 ); | 717 | m_widgetStack.addWidget( dlg, 3 ); |
681 | m_widgetStack.raiseWidget( dlg ); | 718 | m_widgetStack.raiseWidget( dlg ); |
682 | } | 719 | } |