-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 40 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.h | 3 |
2 files changed, 31 insertions, 12 deletions
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 5a942a1..349094d 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -46,97 +46,97 @@ _;:, .> :=|. This file is free software; you can | |||
46 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
47 | #include <qmenubar.h> | 47 | #include <qmenubar.h> |
48 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
49 | #include <qpopupmenu.h> | 49 | #include <qpopupmenu.h> |
50 | #include <qtimer.h> | 50 | #include <qtimer.h> |
51 | #include <qtoolbar.h> | 51 | #include <qtoolbar.h> |
52 | #include <qwhatsthis.h> | 52 | #include <qwhatsthis.h> |
53 | 53 | ||
54 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) | 54 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) |
55 | : QMainWindow( parent, name, WStyle_ContextHelp ) | 55 | : QMainWindow( parent, name, WStyle_ContextHelp ) |
56 | , m_config( "packman" ) | 56 | , m_config( "packman" ) |
57 | , m_packman( &m_config, this ) | 57 | , m_packman( &m_config, this ) |
58 | , m_menuBar( this ) | 58 | , m_menuBar( this ) |
59 | , m_toolBar( this ) | 59 | , m_toolBar( this ) |
60 | , m_findBar( this ) | 60 | , m_findBar( this ) |
61 | , m_widgetStack( this ) | 61 | , m_widgetStack( this ) |
62 | , m_packageList( this ) | 62 | , m_packageList( this ) |
63 | , m_statusWidget( this ) | 63 | , m_statusWidget( this ) |
64 | , m_statusText( &m_statusWidget ) | 64 | , m_statusText( &m_statusWidget ) |
65 | , m_statusBar( &m_statusWidget ) | 65 | , m_statusBar( &m_statusWidget ) |
66 | , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) | 66 | , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) |
67 | , m_iconInstalled( Resource::loadPixmap( "installed" ) ) | 67 | , m_iconInstalled( Resource::loadPixmap( "installed" ) ) |
68 | , m_iconNull( m_iconUpdated.size() ) | 68 | , m_iconNull( m_iconUpdated.size() ) |
69 | , m_filterName( QString::null ) | 69 | , m_filterName( QString::null ) |
70 | , m_filterServer( QString::null ) | 70 | , m_filterServer( QString::null ) |
71 | , m_filterDest( QString::null ) | 71 | , m_filterDest( QString::null ) |
72 | , m_filterStatus( OPackageManager::NotDefined ) | 72 | , m_filterStatus( OPackageManager::NotDefined ) |
73 | , m_filterCategory( QString::null ) | 73 | , m_filterCategory( QString::null ) |
74 | 74 | ||
75 | { | 75 | { |
76 | // setCaption( tr( "Package Manager" ) ); | 76 | // setCaption( tr( "Package Manager" ) ); |
77 | 77 | ||
78 | m_iconNull.fill( colorGroup().base() ); | 78 | m_iconNull.fill( colorGroup().base() ); |
79 | 79 | ||
80 | connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); | 80 | connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); |
81 | 81 | ||
82 | // Initialize widget stack, package list and status widget | 82 | // Initialize widget stack, package list and status widget |
83 | initStatusWidget(); | 83 | initStatusWidget(); |
84 | initPackageList(); | 84 | initPackageList(); |
85 | 85 | ||
86 | m_widgetStack.addWidget( &m_statusWidget, 2 ); | 86 | m_widgetStack.addWidget( &m_statusWidget, 2 ); |
87 | m_widgetStack.addWidget( &m_packageList, 1 ); | 87 | m_widgetStack.addWidget( &m_packageList, 1 ); |
88 | setCentralWidget( &m_widgetStack ); | 88 | setCentralWidget( &m_widgetStack ); |
89 | 89 | ||
90 | // Initialize remaining user interface items | 90 | // Initialize remaining user interface items |
91 | initUI(); | 91 | initUI(); |
92 | 92 | ||
93 | // Initialize package information | 93 | // Initialize package information |
94 | QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); | 94 | QTimer::singleShot( -1, this, SLOT( initPackageInfo() ) ); |
95 | } | 95 | } |
96 | 96 | ||
97 | void MainWindow::closeEvent( QCloseEvent *event ) | 97 | void MainWindow::closeEvent( QCloseEvent *event ) |
98 | { | 98 | { |
99 | // Close app only if either the package or status widgets are currently active | 99 | // Close app only if either the package or status widgets are currently active |
100 | bool close = m_widgetStack.visibleWidget() == &m_packageList || | 100 | bool close = m_widgetStack.visibleWidget() == &m_packageList || |
101 | m_widgetStack.visibleWidget() == &m_statusWidget; | 101 | m_widgetStack.visibleWidget() == &m_statusWidget; |
102 | if ( close ) | 102 | if ( close ) |
103 | { | 103 | { |
104 | // TODO - write out application configuration settings | 104 | // TODO - write out application configuration settings |
105 | 105 | ||
106 | // Write out package manager configuration settings | 106 | // Write out package manager configuration settings |
107 | m_packman.saveSettings(); | 107 | m_packman.saveSettings(); |
108 | event->accept(); | 108 | event->accept(); |
109 | } | 109 | } |
110 | else | 110 | else |
111 | { | 111 | { |
112 | delete m_widgetStack.visibleWidget(); | 112 | delete m_widgetStack.visibleWidget(); |
113 | m_widgetStack.raiseWidget( &m_packageList ); | 113 | m_widgetStack.raiseWidget( &m_packageList ); |
114 | event->ignore(); | 114 | event->ignore(); |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | void MainWindow::initPackageList() | 118 | void MainWindow::initPackageList() |
119 | { | 119 | { |
120 | m_packageList.addColumn( tr( "Packages" ) ); | 120 | m_packageList.addColumn( tr( "Packages" ) ); |
121 | QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nTap inside the box at the left to select a package. Tap and hold to view package details." ) ); | 121 | QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nTap inside the box at the left to select a package. Tap and hold to view package details." ) ); |
122 | QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); | 122 | QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); |
123 | connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), | 123 | connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), |
124 | this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); | 124 | this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); |
125 | } | 125 | } |
126 | 126 | ||
127 | void MainWindow::initStatusWidget() | 127 | void MainWindow::initStatusWidget() |
128 | { | 128 | { |
129 | QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); | 129 | QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); |
130 | 130 | ||
131 | m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 131 | m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
132 | layout->addWidget( &m_statusText ); | 132 | layout->addWidget( &m_statusText ); |
133 | 133 | ||
134 | connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); | 134 | connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); |
135 | connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) ); | 135 | connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) ); |
136 | connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); | 136 | connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); |
137 | 137 | ||
138 | layout->addWidget( &m_statusBar ); | 138 | layout->addWidget( &m_statusBar ); |
139 | } | 139 | } |
140 | 140 | ||
141 | void MainWindow::initUI() | 141 | void MainWindow::initUI() |
142 | { | 142 | { |
@@ -264,112 +264,137 @@ void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) | |||
264 | 264 | ||
265 | if ( packages ) | 265 | if ( packages ) |
266 | { | 266 | { |
267 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) | 267 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) |
268 | { | 268 | { |
269 | OPackage *package = packageIt.current(); | 269 | OPackage *package = packageIt.current(); |
270 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), | 270 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), |
271 | QCheckListItem::CheckBox ); | 271 | QCheckListItem::CheckBox ); |
272 | m_packageList.insertItem( item ); | 272 | m_packageList.insertItem( item ); |
273 | 273 | ||
274 | // If a different version of package is available, show update available icon | 274 | // If a different version of package is available, show update available icon |
275 | // Otherwise, show installed icon | 275 | // Otherwise, show installed icon |
276 | if ( !package->versionInstalled().isNull() ) | 276 | if ( !package->versionInstalled().isNull() ) |
277 | { | 277 | { |
278 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) | 278 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) |
279 | item->setPixmap( 0, m_iconUpdated ); | 279 | item->setPixmap( 0, m_iconUpdated ); |
280 | else | 280 | else |
281 | item->setPixmap( 0, m_iconInstalled ); | 281 | item->setPixmap( 0, m_iconInstalled ); |
282 | } | 282 | } |
283 | else | 283 | else |
284 | item->setPixmap( 0, m_iconNull ); | 284 | item->setPixmap( 0, m_iconNull ); |
285 | } | 285 | } |
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | void MainWindow::searchForPackage( const QString &text ) | 289 | void MainWindow::searchForPackage( const QString &text ) |
290 | { | 290 | { |
291 | if ( !text.isEmpty() ) | 291 | if ( !text.isEmpty() ) |
292 | { | 292 | { |
293 | // look through package list for text startng at current position | 293 | // look through package list for text startng at current position |
294 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); | 294 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); |
295 | if ( start == 0 ) | 295 | if ( start == 0 ) |
296 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 296 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
297 | 297 | ||
298 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; | 298 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; |
299 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; | 299 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; |
300 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 300 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
301 | { | 301 | { |
302 | if ( item->text().lower().find( text ) != -1 ) | 302 | if ( item->text().lower().find( text ) != -1 ) |
303 | { | 303 | { |
304 | m_packageList.ensureItemVisible( item ); | 304 | m_packageList.ensureItemVisible( item ); |
305 | m_packageList.setCurrentItem( item ); | 305 | m_packageList.setCurrentItem( item ); |
306 | break; | 306 | break; |
307 | } | 307 | } |
308 | } | 308 | } |
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | void MainWindow::installLocalPackage( const QString &ipkFile ) | ||
313 | { | ||
314 | // Install selected file | ||
315 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true, | ||
316 | OPackage::Install, new QStringList( ipkFile ) ); | ||
317 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | ||
318 | |||
319 | // Display widget | ||
320 | m_widgetStack.addWidget( dlg, 3 ); | ||
321 | m_widgetStack.raiseWidget( dlg ); | ||
322 | } | ||
323 | |||
324 | void MainWindow::setDocument( const QString &ipkFile ) | ||
325 | { | ||
326 | QString file = ipkFile; | ||
327 | DocLnk lnk( ipkFile ); | ||
328 | if ( lnk.isValid() ) | ||
329 | file = lnk.file(); | ||
330 | |||
331 | installLocalPackage( file ); | ||
332 | } | ||
333 | |||
312 | void MainWindow::initPackageInfo() | 334 | void MainWindow::initPackageInfo() |
313 | { | 335 | { |
314 | m_widgetStack.raiseWidget( &m_statusWidget ); | 336 | m_widgetStack.raiseWidget( &m_statusWidget ); |
315 | 337 | ||
316 | // Load package list | 338 | // Load package list |
317 | m_packman.loadAvailablePackages(); | 339 | m_packman.loadAvailablePackages(); |
318 | m_packman.loadInstalledPackages(); | 340 | m_packman.loadInstalledPackages(); |
319 | 341 | ||
320 | OPackageList *packageList = m_packman.packages(); | 342 | OPackageList *packageList = m_packman.packages(); |
321 | if ( packageList ) | 343 | if ( packageList ) |
322 | { | 344 | { |
323 | loadPackageList( packageList, true ); | 345 | loadPackageList( packageList, true ); |
324 | delete packageList; | 346 | delete packageList; |
325 | } | 347 | } |
326 | 348 | ||
327 | m_widgetStack.raiseWidget( &m_packageList ); | 349 | QWidget *widget = m_widgetStack.widget( 3 ); |
350 | if ( !widget ) | ||
351 | widget = &m_packageList; | ||
352 | m_widgetStack.raiseWidget( widget ); | ||
328 | } | 353 | } |
329 | 354 | ||
330 | void MainWindow::slotWidgetStackShow( QWidget *widget ) | 355 | void MainWindow::slotWidgetStackShow( QWidget *widget ) |
331 | { | 356 | { |
332 | if ( widget == &m_packageList ) | 357 | if ( widget == &m_packageList ) |
333 | { | 358 | { |
334 | setCaption( tr( "Package Manager" ) ); | 359 | setCaption( tr( "Package Manager" ) ); |
335 | 360 | ||
336 | m_menuBar.show(); | 361 | m_menuBar.show(); |
337 | m_toolBar.show(); | 362 | m_toolBar.show(); |
338 | } | 363 | } |
339 | else | 364 | else |
340 | { | 365 | { |
341 | m_menuBar.hide(); | 366 | m_menuBar.hide(); |
342 | m_toolBar.hide(); | 367 | m_toolBar.hide(); |
343 | } | 368 | } |
344 | } | 369 | } |
345 | 370 | ||
346 | void MainWindow::slotInitStatusBar( int numSteps ) | 371 | void MainWindow::slotInitStatusBar( int numSteps ) |
347 | { | 372 | { |
348 | m_statusBar.setTotalSteps( numSteps ); | 373 | m_statusBar.setTotalSteps( numSteps ); |
349 | } | 374 | } |
350 | 375 | ||
351 | void MainWindow::slotStatusText( const QString &status ) | 376 | void MainWindow::slotStatusText( const QString &status ) |
352 | { | 377 | { |
353 | m_statusText.setText( status ); | 378 | m_statusText.setText( status ); |
354 | } | 379 | } |
355 | 380 | ||
356 | void MainWindow::slotStatusBar( int currStep ) | 381 | void MainWindow::slotStatusBar( int currStep ) |
357 | { | 382 | { |
358 | m_statusBar.setProgress( currStep ); | 383 | m_statusBar.setProgress( currStep ); |
359 | } | 384 | } |
360 | 385 | ||
361 | void MainWindow::slotUpdate() | 386 | void MainWindow::slotUpdate() |
362 | { | 387 | { |
363 | // Create package manager output widget | 388 | // Create package manager output widget |
364 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, | 389 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, |
365 | OPackage::Update ); | 390 | OPackage::Update ); |
366 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 391 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
367 | 392 | ||
368 | // Display widget | 393 | // Display widget |
369 | m_widgetStack.addWidget( dlg, 3 ); | 394 | m_widgetStack.addWidget( dlg, 3 ); |
370 | m_widgetStack.raiseWidget( dlg ); | 395 | m_widgetStack.raiseWidget( dlg ); |
371 | } | 396 | } |
372 | 397 | ||
373 | void MainWindow::slotUpgrade() | 398 | void MainWindow::slotUpgrade() |
374 | { | 399 | { |
375 | // Create package manager output widget | 400 | // Create package manager output widget |
@@ -492,106 +517,97 @@ void MainWindow::slotApply() | |||
492 | if ( !installList ) | 517 | if ( !installList ) |
493 | installList = new QStringList(); | 518 | installList = new QStringList(); |
494 | installList->append( item->text() ); | 519 | installList->append( item->text() ); |
495 | } | 520 | } |
496 | } | 521 | } |
497 | } | 522 | } |
498 | } | 523 | } |
499 | 524 | ||
500 | // If nothing is selected, display message and exit | 525 | // If nothing is selected, display message and exit |
501 | if ( !removeList && !installList && !upgradeList ) | 526 | if ( !removeList && !installList && !upgradeList ) |
502 | { | 527 | { |
503 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); | 528 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
504 | return; | 529 | return; |
505 | } | 530 | } |
506 | 531 | ||
507 | // Send command only if there are packages to process | 532 | // Send command only if there are packages to process |
508 | OPackage::Command removeCmd = OPackage::NotDefined; | 533 | OPackage::Command removeCmd = OPackage::NotDefined; |
509 | if ( removeList && !removeList->isEmpty() ) | 534 | if ( removeList && !removeList->isEmpty() ) |
510 | removeCmd = OPackage::Remove; | 535 | removeCmd = OPackage::Remove; |
511 | OPackage::Command installCmd = OPackage::NotDefined; | 536 | OPackage::Command installCmd = OPackage::NotDefined; |
512 | if ( installList && !installList->isEmpty() ) | 537 | if ( installList && !installList->isEmpty() ) |
513 | installCmd = OPackage::Install; | 538 | installCmd = OPackage::Install; |
514 | OPackage::Command upgradeCmd = OPackage::NotDefined; | 539 | OPackage::Command upgradeCmd = OPackage::NotDefined; |
515 | if ( upgradeList && !upgradeList->isEmpty() ) | 540 | if ( upgradeList && !upgradeList->isEmpty() ) |
516 | upgradeCmd = OPackage::Upgrade; | 541 | upgradeCmd = OPackage::Upgrade; |
517 | 542 | ||
518 | // Create package manager output widget | 543 | // Create package manager output widget |
519 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, | 544 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, |
520 | removeCmd, removeList, | 545 | removeCmd, removeList, |
521 | installCmd, installList, | 546 | installCmd, installList, |
522 | upgradeCmd, upgradeList ); | 547 | upgradeCmd, upgradeList ); |
523 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 548 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
524 | 549 | ||
525 | // Display widget | 550 | // Display widget |
526 | m_widgetStack.addWidget( dlg, 3 ); | 551 | m_widgetStack.addWidget( dlg, 3 ); |
527 | m_widgetStack.raiseWidget( dlg ); | 552 | m_widgetStack.raiseWidget( dlg ); |
528 | } | 553 | } |
529 | 554 | ||
530 | void MainWindow::slotInstallLocal() | 555 | void MainWindow::slotInstallLocal() |
531 | { | 556 | { |
532 | // Display file open dialog with only package files | 557 | // Display file open dialog with only package files |
533 | MimeTypes type; | 558 | MimeTypes type; |
534 | QStringList packages; | 559 | QStringList packages; |
535 | packages << "application/ipkg"; | 560 | packages << "application/ipkg"; |
536 | type.insert( tr( "Application Packages" ), packages ); | 561 | type.insert( tr( "Application Packages" ), packages ); |
537 | QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, | 562 | QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, |
538 | "/", QString::null, type ); | 563 | "/", QString::null, type ); |
539 | if ( !package.isNull() ) | 564 | if ( !package.isNull() ) |
540 | { | 565 | installLocalPackage( package ); |
541 | // Install selected file | ||
542 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true, | ||
543 | OPackage::Install, new QStringList( package ) ); | ||
544 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | ||
545 | |||
546 | // Display widget | ||
547 | m_widgetStack.addWidget( dlg, 3 ); | ||
548 | m_widgetStack.raiseWidget( dlg ); | ||
549 | } | ||
550 | } | 566 | } |
551 | 567 | ||
552 | void MainWindow::slotCloseDlg() | 568 | void MainWindow::slotCloseDlg() |
553 | { | 569 | { |
554 | // Close install dialog | 570 | // Close install dialog |
555 | delete m_widgetStack.visibleWidget(); | 571 | delete m_widgetStack.visibleWidget(); |
556 | 572 | ||
557 | // Reload package list | 573 | // Reload package list |
558 | initPackageInfo(); | 574 | initPackageInfo(); |
559 | 575 | ||
560 | // Update Opie launcher links | 576 | // Update Opie launcher links |
561 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 577 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
562 | QString lf = QString::null; | 578 | QString lf = QString::null; |
563 | e << lf; | 579 | e << lf; |
564 | 580 | ||
565 | // Reapply any filters previously set | 581 | // Reapply any filters previously set |
566 | if ( m_actionShowNotInstalled->isOn() ) | 582 | if ( m_actionShowNotInstalled->isOn() ) |
567 | slotShowNotInstalled(); | 583 | slotShowNotInstalled(); |
568 | else if ( m_actionShowInstalled->isOn() ) | 584 | else if ( m_actionShowInstalled->isOn() ) |
569 | slotShowInstalled(); | 585 | slotShowInstalled(); |
570 | else if ( m_actionShowUpdated->isOn() ) | 586 | else if ( m_actionShowUpdated->isOn() ) |
571 | slotShowUpdated(); | 587 | slotShowUpdated(); |
572 | else if ( m_actionFilter->isOn() ) | 588 | else if ( m_actionFilter->isOn() ) |
573 | slotFilter( true ); | 589 | slotFilter( true ); |
574 | } | 590 | } |
575 | 591 | ||
576 | void MainWindow::slotConfigure() | 592 | void MainWindow::slotConfigure() |
577 | { | 593 | { |
578 | if ( m_packman.configureDlg( false ) ) | 594 | if ( m_packman.configureDlg( false ) ) |
579 | { | 595 | { |
580 | if ( PromptDlg::ask( tr( "Config updated" ), | 596 | if ( PromptDlg::ask( tr( "Config updated" ), |
581 | tr( "The configuration has been updated. Do you want to update server and package information now?" ), | 597 | tr( "The configuration has been updated. Do you want to update server and package information now?" ), |
582 | tr( "Yes" ), tr( "No" ), this ) == 1 ) | 598 | tr( "Yes" ), tr( "No" ), this ) == 1 ) |
583 | { | 599 | { |
584 | // Update package list and reload package info | 600 | // Update package list and reload package info |
585 | slotUpdate(); | 601 | slotUpdate(); |
586 | } | 602 | } |
587 | } | 603 | } |
588 | } | 604 | } |
589 | 605 | ||
590 | void MainWindow::slotShowNotInstalled() | 606 | void MainWindow::slotShowNotInstalled() |
591 | { | 607 | { |
592 | OPackageList *packageList; | 608 | OPackageList *packageList; |
593 | if ( m_actionShowNotInstalled->isOn() ) | 609 | if ( m_actionShowNotInstalled->isOn() ) |
594 | { | 610 | { |
595 | m_actionShowInstalled->setOn( false ); | 611 | m_actionShowInstalled->setOn( false ); |
596 | m_actionShowUpdated->setOn( false ); | 612 | m_actionShowUpdated->setOn( false ); |
597 | m_actionFilter->setOn( false ); | 613 | m_actionFilter->setOn( false ); |
diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h index 7968614..103c664 100644 --- a/noncore/settings/packagemanager/mainwindow.h +++ b/noncore/settings/packagemanager/mainwindow.h | |||
@@ -56,85 +56,88 @@ public: | |||
56 | protected: | 56 | protected: |
57 | void closeEvent( QCloseEvent *event ); | 57 | void closeEvent( QCloseEvent *event ); |
58 | 58 | ||
59 | private: | 59 | private: |
60 | Config m_config; // Configuration file | 60 | Config m_config; // Configuration file |
61 | 61 | ||
62 | OPackageManager m_packman; // Package manager | 62 | OPackageManager m_packman; // Package manager |
63 | 63 | ||
64 | // Toolbars | 64 | // Toolbars |
65 | QToolBar m_menuBar; // Main toolbar containing menu | 65 | QToolBar m_menuBar; // Main toolbar containing menu |
66 | QToolBar m_toolBar; // Main toolbar | 66 | QToolBar m_toolBar; // Main toolbar |
67 | QToolBar m_findBar; // Find toolbar | 67 | QToolBar m_findBar; // Find toolbar |
68 | 68 | ||
69 | QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget | 69 | QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget |
70 | QListView m_packageList; // Main list view of all packages | 70 | QListView m_packageList; // Main list view of all packages |
71 | 71 | ||
72 | QLineEdit *m_findEdit; // Line edit box used for find toolbar | 72 | QLineEdit *m_findEdit; // Line edit box used for find toolbar |
73 | 73 | ||
74 | // Status widget controls | 74 | // Status widget controls |
75 | QWidget m_statusWidget; // Widget to display status during long operations | 75 | QWidget m_statusWidget; // Widget to display status during long operations |
76 | QLabel m_statusText; // Text status message | 76 | QLabel m_statusText; // Text status message |
77 | QProgressBar m_statusBar; // Progress bar showing % completed | 77 | QProgressBar m_statusBar; // Progress bar showing % completed |
78 | 78 | ||
79 | // Icon pixmaps | 79 | // Icon pixmaps |
80 | QPixmap m_iconUpdated; // Cached icon which shows when package can be updated | 80 | QPixmap m_iconUpdated; // Cached icon which shows when package can be updated |
81 | QPixmap m_iconInstalled; // Cached icon which shows when package is installed | 81 | QPixmap m_iconInstalled; // Cached icon which shows when package is installed |
82 | QPixmap m_iconNull; // Cached icon which shows when package is not installed | 82 | QPixmap m_iconNull; // Cached icon which shows when package is not installed |
83 | 83 | ||
84 | // Menu/tool bar actions | 84 | // Menu/tool bar actions |
85 | QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed | 85 | QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed |
86 | QAction *m_actionShowInstalled; // Action to show pakages currently installed | 86 | QAction *m_actionShowInstalled; // Action to show pakages currently installed |
87 | QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available | 87 | QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available |
88 | QAction *m_actionFilter; // Action to filter packages | 88 | QAction *m_actionFilter; // Action to filter packages |
89 | QAction *m_actionFindNext; // Action to find next match | 89 | QAction *m_actionFindNext; // Action to find next match |
90 | 90 | ||
91 | // Cached filter settings | 91 | // Cached filter settings |
92 | QString m_filterName; // Cached name filter value | 92 | QString m_filterName; // Cached name filter value |
93 | QString m_filterServer; // Cached server name filter value | 93 | QString m_filterServer; // Cached server name filter value |
94 | QString m_filterDest; // Cached destination name filter value | 94 | QString m_filterDest; // Cached destination name filter value |
95 | OPackageManager::Status m_filterStatus; // Cached status filter value | 95 | OPackageManager::Status m_filterStatus; // Cached status filter value |
96 | QString m_filterCategory; // Cached category filter value | 96 | QString m_filterCategory; // Cached category filter value |
97 | 97 | ||
98 | void initPackageList(); | 98 | void initPackageList(); |
99 | void initStatusWidget(); | 99 | void initStatusWidget(); |
100 | void initUI(); | 100 | void initUI(); |
101 | 101 | ||
102 | void loadPackageList( OPackageList *packages = 0x0, bool clearList = true ); | 102 | void loadPackageList( OPackageList *packages = 0x0, bool clearList = true ); |
103 | void searchForPackage( const QString &text ); | 103 | void searchForPackage( const QString &text ); |
104 | void installLocalPackage( const QString &ipkFile ); | ||
104 | 105 | ||
105 | private slots: | 106 | private slots: |
107 | void setDocument( const QString &ipkFile ); | ||
108 | |||
106 | void initPackageInfo(); | 109 | void initPackageInfo(); |
107 | void slotWidgetStackShow( QWidget *widget ); | 110 | void slotWidgetStackShow( QWidget *widget ); |
108 | 111 | ||
109 | // Status widget slots | 112 | // Status widget slots |
110 | void slotInitStatusBar( int numSteps ); | 113 | void slotInitStatusBar( int numSteps ); |
111 | void slotStatusText( const QString &status ); | 114 | void slotStatusText( const QString &status ); |
112 | void slotStatusBar( int currStep ); | 115 | void slotStatusBar( int currStep ); |
113 | 116 | ||
114 | // Actions menu action slots | 117 | // Actions menu action slots |
115 | void slotUpdate(); | 118 | void slotUpdate(); |
116 | void slotUpgrade(); | 119 | void slotUpgrade(); |
117 | void slotDownload(); | 120 | void slotDownload(); |
118 | void slotApply(); | 121 | void slotApply(); |
119 | void slotInstallLocal(); | 122 | void slotInstallLocal(); |
120 | void slotCloseDlg(); | 123 | void slotCloseDlg(); |
121 | void slotConfigure(); | 124 | void slotConfigure(); |
122 | 125 | ||
123 | // View menu action slots | 126 | // View menu action slots |
124 | void slotShowNotInstalled(); | 127 | void slotShowNotInstalled(); |
125 | void slotShowInstalled(); | 128 | void slotShowInstalled(); |
126 | void slotShowUpdated(); | 129 | void slotShowUpdated(); |
127 | void slotFilterChange(); | 130 | void slotFilterChange(); |
128 | void slotFilter( bool isOn ); | 131 | void slotFilter( bool isOn ); |
129 | 132 | ||
130 | // Find action slots | 133 | // Find action slots |
131 | void slotFindShowToolbar(); | 134 | void slotFindShowToolbar(); |
132 | void slotFindHideToolbar(); | 135 | void slotFindHideToolbar(); |
133 | void slotFindChanged( const QString &findText ); | 136 | void slotFindChanged( const QString &findText ); |
134 | void slotFindNext(); | 137 | void slotFindNext(); |
135 | 138 | ||
136 | // Other slots | 139 | // Other slots |
137 | void slotDisplayPackageInfo( QListViewItem * ); | 140 | void slotDisplayPackageInfo( QListViewItem * ); |
138 | }; | 141 | }; |
139 | 142 | ||
140 | #endif | 143 | #endif |