summaryrefslogtreecommitdiff
authordrw <drw>2003-01-23 01:47:41 (UTC)
committer drw <drw>2003-01-23 01:47:41 (UTC)
commitc464d34970bedca56a518310deef7ce08474033c (patch) (unidiff)
tree8f0e9c1c75daf0cdd53bdd5e3cdaf22a3b5b60b3
parent454eba9982f1a898e914b558f2ceac913fdf3b5c (diff)
downloadopie-c464d34970bedca56a518310deef7ce08474033c.zip
opie-c464d34970bedca56a518310deef7ce08474033c.tar.gz
opie-c464d34970bedca56a518310deef7ce08474033c.tar.bz2
Minor fix for find function and more liberal use of progress widget to give feedback to user
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp44
-rw-r--r--noncore/settings/aqpkg/mainwin.h3
2 files changed, 26 insertions, 21 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index c9963bc..8090646 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -203,228 +203,232 @@ MainWindow :: MainWindow()
203 stack = new QWidgetStack( this ); 203 stack = new QWidgetStack( this );
204 stack->addWidget( progressWindow, 2 ); 204 stack->addWidget( progressWindow, 2 );
205 stack->addWidget( networkPkgWindow, 1 ); 205 stack->addWidget( networkPkgWindow, 1 );
206 setCentralWidget( stack ); 206 setCentralWidget( stack );
207 stack->raiseWidget( progressWindow ); 207 stack->raiseWidget( progressWindow );
208 208
209 // Delayed call to finish initialization 209 // Delayed call to finish initialization
210 QTimer::singleShot( 100, this, SLOT( init() ) ); 210 QTimer::singleShot( 100, this, SLOT( init() ) );
211} 211}
212 212
213MainWindow :: ~MainWindow() 213MainWindow :: ~MainWindow()
214{ 214{
215 delete mgr; 215 delete mgr;
216} 216}
217 217
218void MainWindow :: initMainWidget() 218void MainWindow :: initMainWidget()
219{ 219{
220 networkPkgWindow = new QWidget( this ); 220 networkPkgWindow = new QWidget( this );
221 221
222 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); 222 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow );
223 223
224 serversList = new QComboBox( networkPkgWindow ); 224 serversList = new QComboBox( networkPkgWindow );
225 connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) ); 225 connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) );
226 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); 226 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) );
227 227
228 installedIcon = Resource::loadPixmap( "aqpkg/installed" ); 228 installedIcon = Resource::loadPixmap( "aqpkg/installed" );
229 updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); 229 updatedIcon = Resource::loadPixmap( "aqpkg/updated" );
230 230
231 packagesList = new QListView( networkPkgWindow ); 231 packagesList = new QListView( networkPkgWindow );
232 packagesList->addColumn( tr( "Packages" ), 225 ); 232 packagesList->addColumn( tr( "Packages" ), 225 );
233 QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\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\nClick inside the box at the left to select a package." ) ); 233 QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\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\nClick inside the box at the left to select a package." ) );
234 234
235 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); 235 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 );
236 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); 236 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
237 hbox1->addWidget( l ); 237 hbox1->addWidget( l );
238 hbox1->addWidget( serversList ); 238 hbox1->addWidget( serversList );
239 239
240 240
241 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 ); 241 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 );
242 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 ); 242 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 );
243 243
244 if ( showJumpTo ) 244 if ( showJumpTo )
245 { 245 {
246 char text[2]; 246 char text[2];
247 text[1] = '\0'; 247 text[1] = '\0';
248 for ( int i = 0 ; i < 26 ; ++i ) 248 for ( int i = 0 ; i < 26 ; ++i )
249 { 249 {
250 text[0] = 'A' + i; 250 text[0] = 'A' + i;
251 LetterPushButton *b = new LetterPushButton( text, networkPkgWindow ); 251 LetterPushButton *b = new LetterPushButton( text, networkPkgWindow );
252 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 252 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
253 if ( i < 13 ) 253 if ( i < 13 )
254 hbox3->addWidget( b ); 254 hbox3->addWidget( b );
255 else 255 else
256 hbox4->addWidget( b ); 256 hbox4->addWidget( b );
257 } 257 }
258 } 258 }
259 259
260 vbox->addWidget( packagesList ); 260 vbox->addWidget( packagesList );
261 261
262 downloadEnabled = TRUE; 262 downloadEnabled = TRUE;
263} 263}
264 264
265void MainWindow :: initProgressWidget() 265void MainWindow :: initProgressWidget()
266{ 266{
267 progressWindow = new QWidget( this ); 267 progressWindow = new QWidget( this );
268 268
269 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); 269 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 );
270 270
271 m_status = new QLabel( progressWindow ); 271 m_status = new QLabel( progressWindow );
272 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 272 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
273 layout->addWidget( m_status ); 273 layout->addWidget( m_status );
274 274
275 m_progress = new QProgressBar( progressWindow ); 275 m_progress = new QProgressBar( progressWindow );
276 layout->addWidget( m_progress ); 276 layout->addWidget( m_progress );
277} 277}
278 278
279void MainWindow :: init() 279void MainWindow :: init()
280{ 280{
281 stack->raiseWidget( progressWindow ); 281 stack->raiseWidget( progressWindow );
282 282
283 mgr = new DataManager(); 283 mgr = new DataManager();
284 connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); 284 connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) );
285 connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), 285 connect( mgr, SIGNAL( progressSetMessage( const QString & ) ),
286 this, SLOT( setProgressMessage( const QString & ) ) ); 286 this, SLOT( setProgressMessage( const QString & ) ) );
287 connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); 287 connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) );
288 mgr->loadServers(); 288 mgr->loadServers();
289 289
290 showUninstalledPkgs = false; 290 showUninstalledPkgs = false;
291 showInstalledPkgs = false; 291 showInstalledPkgs = false;
292 showUpgradedPkgs = false; 292 showUpgradedPkgs = false;
293 categoryFilterEnabled = false; 293 categoryFilterEnabled = false;
294 294
295 updateData(); 295 updateData();
296 296
297 stack->raiseWidget( networkPkgWindow ); 297 stack->raiseWidget( networkPkgWindow );
298} 298}
299 299/*
300void MainWindow :: setDocument( const QString &doc ) 300void MainWindow :: setDocument( const QString &doc )
301{ 301{
302 // Remove path from package 302 // Remove path from package
303 QString package = Utils::getPackageNameFromIpkFilename( doc ); 303 QString package = Utils::getPackageNameFromIpkFilename( doc );
304// std::cout << "Selecting package " << package << std::endl; 304// std::cout << "Selecting package " << package << std::endl;
305 305
306 // First select local server 306 // First select local server
307 for ( int i = 0 ; i < serversList->count() ; ++i ) 307 for ( int i = 0 ; i < serversList->count() ; ++i )
308 { 308 {
309 if ( serversList->text( i ) == LOCAL_IPKGS ) 309 if ( serversList->text( i ) == LOCAL_IPKGS )
310 { 310 {
311 serversList->setCurrentItem( i ); 311 serversList->setCurrentItem( i );
312 break; 312 break;
313 } 313 }
314 } 314 }
315 serverSelected( 0 ); 315 serverSelected( 0 );
316 316
317 // Now set the check box of the selected package 317 // Now set the check box of the selected package
318 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 318 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
319 item != 0 ; 319 item != 0 ;
320 item = (QCheckListItem *)item->nextSibling() ) 320 item = (QCheckListItem *)item->nextSibling() )
321 { 321 {
322 if ( item->text().startsWith( package ) ) 322 if ( item->text().startsWith( package ) )
323 { 323 {
324 item->setOn( true ); 324 item->setOn( true );
325 break; 325 break;
326 } 326 }
327 } 327 }
328} 328}
329 329*/
330void MainWindow :: displaySettings() 330void MainWindow :: displaySettings()
331{ 331{
332 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); 332 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
333 if ( dlg->showDlg( 0 ) ) 333 if ( dlg->showDlg( 0 ) )
334 {
335 stack->raiseWidget( progressWindow );
334 updateData(); 336 updateData();
337 stack->raiseWidget( networkPkgWindow );
338 }
335 delete dlg; 339 delete dlg;
336} 340}
337 341
338void MainWindow :: displayHelp() 342void MainWindow :: displayHelp()
339{ 343{
340 HelpWindow *dlg = new HelpWindow( this ); 344 HelpWindow *dlg = new HelpWindow( this );
341 dlg->exec(); 345 dlg->exec();
342 delete dlg; 346 delete dlg;
343} 347}
344 348
345void MainWindow :: displayFindBar() 349void MainWindow :: displayFindBar()
346{ 350{
347 findBar->show(); 351 findBar->show();
348 findEdit->setFocus(); 352 findEdit->setFocus();
349} 353}
350 354
351void MainWindow :: repeatFind() 355void MainWindow :: repeatFind()
352{ 356{
353 searchForPackage( findEdit->text() ); 357 searchForPackage( findEdit->text() );
354} 358}
355 359
356void MainWindow :: findPackage( const QString &text ) 360void MainWindow :: findPackage( const QString &text )
357{ 361{
358 actionFindNext->setEnabled( !text.isEmpty() ); 362 actionFindNext->setEnabled( !text.isEmpty() );
359 searchForPackage( text ); 363 searchForPackage( text );
360} 364}
361 365
362void MainWindow :: hideFindBar() 366void MainWindow :: hideFindBar()
363{ 367{
364 findBar->hide(); 368 findBar->hide();
365} 369}
366 370
367void MainWindow :: displayAbout() 371void MainWindow :: displayAbout()
368{ 372{
369 QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) ); 373 QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) );
370} 374}
371 375
372void MainWindow :: filterUninstalledPackages() 376void MainWindow :: filterUninstalledPackages()
373{ 377{
374 showUninstalledPkgs = actionUninstalled->isOn(); 378 showUninstalledPkgs = actionUninstalled->isOn();
375 if ( showUninstalledPkgs ) 379 if ( showUninstalledPkgs )
376 { 380 {
377 showInstalledPkgs = FALSE; 381 showInstalledPkgs = FALSE;
378 showUpgradedPkgs = FALSE; 382 showUpgradedPkgs = FALSE;
379 } 383 }
380 serverSelected( -1 ); 384 serverSelected( -1 );
381 385
382 actionInstalled->setOn( FALSE ); 386 actionInstalled->setOn( FALSE );
383 actionUpdated->setOn( FALSE ); 387 actionUpdated->setOn( FALSE );
384} 388}
385 389
386void MainWindow :: filterInstalledPackages() 390void MainWindow :: filterInstalledPackages()
387{ 391{
388 showInstalledPkgs = actionInstalled->isOn(); 392 showInstalledPkgs = actionInstalled->isOn();
389 if ( showInstalledPkgs ) 393 if ( showInstalledPkgs )
390 { 394 {
391 showUninstalledPkgs = FALSE; 395 showUninstalledPkgs = FALSE;
392 showUpgradedPkgs = FALSE; 396 showUpgradedPkgs = FALSE;
393 } 397 }
394 serverSelected( -1 ); 398 serverSelected( -1 );
395 399
396 actionUninstalled->setOn( FALSE ); 400 actionUninstalled->setOn( FALSE );
397 actionUpdated->setOn( FALSE ); 401 actionUpdated->setOn( FALSE );
398} 402}
399 403
400void MainWindow :: filterUpgradedPackages() 404void MainWindow :: filterUpgradedPackages()
401{ 405{
402 showUpgradedPkgs = actionUpdated->isOn(); 406 showUpgradedPkgs = actionUpdated->isOn();
403 if ( showUpgradedPkgs ) 407 if ( showUpgradedPkgs )
404 { 408 {
405 showUninstalledPkgs = FALSE; 409 showUninstalledPkgs = FALSE;
406 showInstalledPkgs = FALSE; 410 showInstalledPkgs = FALSE;
407 } 411 }
408 serverSelected( -1 ); 412 serverSelected( -1 );
409 413
410 actionUninstalled->setOn( FALSE ); 414 actionUninstalled->setOn( FALSE );
411 actionInstalled->setOn( FALSE ); 415 actionInstalled->setOn( FALSE );
412} 416}
413 417
414bool MainWindow :: setFilterCategory() 418bool MainWindow :: setFilterCategory()
415{ 419{
416 // Get categories; 420 // Get categories;
417 CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); 421 CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this );
418 if ( dlg.exec() == QDialog::Accepted ) 422 if ( dlg.exec() == QDialog::Accepted )
419 { 423 {
420 categoryFilter = dlg.getSelectedFilter(); 424 categoryFilter = dlg.getSelectedFilter();
421 425
422 if ( categoryFilter == "" ) 426 if ( categoryFilter == "" )
423 return false; 427 return false;
424 428
425 categoryFilterEnabled = true; 429 categoryFilterEnabled = true;
426 serverSelected( -1 ); 430 serverSelected( -1 );
427 actionFilter->setOn( TRUE ); 431 actionFilter->setOn( TRUE );
428 return true; 432 return true;
429 } 433 }
430 434
@@ -635,521 +639,521 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
635 639
636 QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox ); 640 QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox );
637 641
638 if ( it->isInstalled() ) 642 if ( it->isInstalled() )
639 { 643 {
640 // If a different version of package is available, show update available icon 644 // If a different version of package is available, show update available icon
641 // Otherwise, show installed icon 645 // Otherwise, show installed icon
642 if ( it->getVersion() != it->getInstalledVersion() && 646 if ( it->getVersion() != it->getInstalledVersion() &&
643 compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1) 647 compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1)
644 { 648 {
645 649
646 item->setPixmap( 0, updatedIcon ); 650 item->setPixmap( 0, updatedIcon );
647 } 651 }
648 else 652 else
649 { 653 {
650 item->setPixmap( 0, installedIcon ); 654 item->setPixmap( 0, installedIcon );
651 } 655 }
652 656
653 QString destName = ""; 657 QString destName = "";
654 if ( it->getLocalPackage() ) 658 if ( it->getLocalPackage() )
655 { 659 {
656 if ( it->getLocalPackage()->getInstalledTo() ) 660 if ( it->getLocalPackage()->getInstalledTo() )
657 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); 661 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName();
658 } 662 }
659 else 663 else
660 { 664 {
661 if ( it->getInstalledTo() ) 665 if ( it->getInstalledTo() )
662 destName = it->getInstalledTo()->getDestinationName(); 666 destName = it->getInstalledTo()->getDestinationName();
663 } 667 }
664 if ( destName != "" ) 668 if ( destName != "" )
665 new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); 669 new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) );
666 } 670 }
667 else 671 else
668 { 672 {
669 item->setPixmap( 0, nullIcon ); 673 item->setPixmap( 0, nullIcon );
670 } 674 }
671 675
672 if ( !it->isPackageStoredLocally() ) 676 if ( !it->isPackageStoredLocally() )
673 { 677 {
674 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) ); 678 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) );
675 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) ); 679 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) );
676 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) ); 680 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) );
677 } 681 }
678 else 682 else
679 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) ); 683 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) );
680 684
681 if ( serverName == LOCAL_SERVER ) 685 if ( serverName == LOCAL_SERVER )
682 { 686 {
683 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) ); 687 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) );
684 } 688 }
685 else 689 else
686 { 690 {
687 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) ); 691 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) );
688 if ( it->getLocalPackage() ) 692 if ( it->getLocalPackage() )
689 { 693 {
690 if ( it->isInstalled() ) 694 if ( it->isInstalled() )
691 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) ); 695 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) );
692 } 696 }
693 } 697 }
694 698
695 packagesList->insertItem( item ); 699 packagesList->insertItem( item );
696 } 700 }
697 701
698 // If the local server or the local ipkgs server disable the download button 702 // If the local server or the local ipkgs server disable the download button
699 if ( serverName == LOCAL_SERVER ) 703 if ( serverName == LOCAL_SERVER )
700 { 704 {
701 downloadEnabled = TRUE; 705 downloadEnabled = TRUE;
702 actionUpgrade->setEnabled( FALSE ); 706 actionUpgrade->setEnabled( FALSE );
703 } 707 }
704 else if ( serverName == LOCAL_IPKGS ) 708 else if ( serverName == LOCAL_IPKGS )
705 { 709 {
706 downloadEnabled = FALSE; 710 downloadEnabled = FALSE;
707 actionUpgrade->setEnabled( FALSE ); 711 actionUpgrade->setEnabled( FALSE );
708 } 712 }
709 else 713 else
710 { 714 {
711 downloadEnabled = TRUE; 715 downloadEnabled = TRUE;
712 actionUpgrade->setEnabled( TRUE ); 716 actionUpgrade->setEnabled( TRUE );
713 } 717 }
714 enableDownload( downloadEnabled ); 718 enableDownload( downloadEnabled );
715 719
716 // Display this widget once everything is done 720 // Display this widget once everything is done
717 if ( doProgress && raiseProgress ) 721 if ( doProgress && raiseProgress )
718 { 722 {
719 stack->raiseWidget( networkPkgWindow ); 723 stack->raiseWidget( networkPkgWindow );
720 } 724 }
721} 725}
722 726
723void MainWindow :: searchForPackage( const QString &text ) 727void MainWindow :: searchForPackage( const QString &text )
724{ 728{
725 if ( !text.isEmpty() ) 729 if ( !text.isEmpty() )
726 { 730 {
727// cout << "searching for " << text << endl; 731// cout << "searching for " << text << endl;
728 // look through package list for text startng at current position 732 // look through package list for text startng at current position
729 vector<InstallData> workingPackages; 733 vector<InstallData> workingPackages;
730 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 734 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
731 if ( start != 0 ) 735// if ( start != 0 )
732 start = (QCheckListItem *)start->nextSibling(); 736// start = (QCheckListItem *)start->nextSibling();
733 737
734 if ( start == 0 ) 738 if ( start == 0 )
735 start = (QCheckListItem *)packagesList->firstChild(); 739 start = (QCheckListItem *)packagesList->firstChild();
736 740
737 for ( QCheckListItem *item = start; item != 0 ; 741 for ( QCheckListItem *item = start; item != 0 ;
738 item = (QCheckListItem *)item->nextSibling() ) 742 item = (QCheckListItem *)item->nextSibling() )
739 { 743 {
740// cout << "checking " << item->text().lower() << endl; 744// cout << "checking " << item->text().lower() << endl;
741 if ( item->text().lower().find( text ) != -1 ) 745 if ( item->text().lower().find( text ) != -1 )
742 { 746 {
743// cout << "matched " << item->text() << endl; 747// cout << "matched " << item->text() << endl;
744 packagesList->ensureItemVisible( item ); 748 packagesList->ensureItemVisible( item );
745 packagesList->setCurrentItem( item ); 749 packagesList->setCurrentItem( item );
746 break; 750 break;
747 } 751 }
748 } 752 }
749 } 753 }
750} 754}
751 755
752void MainWindow :: updateServer() 756void MainWindow :: updateServer()
753{ 757{
754 QString serverName = serversList->currentText(); 758 QString serverName = serversList->currentText();
755 759
756 // Update the current server 760 // Update the current server
757 // Display dialog 761 // Display dialog
758 762
759 // Disable buttons to stop silly people clicking lots on them :) 763 // Disable buttons to stop silly people clicking lots on them :)
760 764
761 // First, write out ipkg_conf file so that ipkg can use it 765 // First, write out ipkg_conf file so that ipkg can use it
762 mgr->writeOutIpkgConf(); 766 mgr->writeOutIpkgConf();
763 767
764 Ipkg ipkg; 768 Ipkg ipkg;
765 ipkg.setOption( "update" ); 769 ipkg.setOption( "update" );
766 770
767 InstallDlgImpl dlg( &ipkg, tr( "Refreshing server package lists" ), this, tr( "Upgrade" ), true ); 771 InstallDlgImpl dlg( &ipkg, tr( "Refreshing server package lists" ), this, tr( "Upgrade" ), true );
768 dlg.showDlg(); 772 dlg.showDlg();
769 773
770 // Reload data 774 reloadData();
771 mgr->reloadServerData(); 775
772 serverSelected(-1);
773// delete progDlg; 776// delete progDlg;
774} 777}
775 778
776void MainWindow :: upgradePackages() 779void MainWindow :: upgradePackages()
777{ 780{
778 // We're gonna do an upgrade of all packages 781 // We're gonna do an upgrade of all packages
779 // First warn user that this isn't recommended 782 // First warn user that this isn't recommended
780 // TODO - ODevice???? 783 // TODO - ODevice????
781 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); 784 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" );
782 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, 785 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
783 QMessageBox::Yes, 786 QMessageBox::Yes,
784 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , 787 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
785 0, this ); 788 0, this );
786 warn.adjustSize(); 789 warn.adjustSize();
787 790
788 if ( warn.exec() == QMessageBox::Yes ) 791 if ( warn.exec() == QMessageBox::Yes )
789 { 792 {
790 // First, write out ipkg_conf file so that ipkg can use it 793 // First, write out ipkg_conf file so that ipkg can use it
791 mgr->writeOutIpkgConf(); 794 mgr->writeOutIpkgConf();
792 795
793 // Now run upgrade 796 // Now run upgrade
794 Ipkg ipkg; 797 Ipkg ipkg;
795 ipkg.setOption( "upgrade" ); 798 ipkg.setOption( "upgrade" );
796 799
797 InstallDlgImpl dlg( &ipkg, tr( "Upgrading installed packages" ), this, tr( "Upgrade" ), true ); 800 InstallDlgImpl dlg( &ipkg, tr( "Upgrading installed packages" ), this, tr( "Upgrade" ), true );
798 dlg.showDlg(); 801 dlg.showDlg();
799 802
800 // Reload data 803 reloadData();
801 mgr->reloadServerData();
802 serverSelected(-1);
803 } 804 }
804} 805}
805 void MainWindow :: downloadPackage() 806 void MainWindow :: downloadPackage()
806{ 807{
807 bool doUpdate = true; 808 bool doUpdate = true;
808 if ( downloadEnabled ) 809 if ( downloadEnabled )
809 { 810 {
810 // See if any packages are selected 811 // See if any packages are selected
811 bool found = false; 812 bool found = false;
812 if ( serversList->currentText() != LOCAL_SERVER ) 813 if ( serversList->currentText() != LOCAL_SERVER )
813 { 814 {
814 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 815 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
815 item != 0 && !found; 816 item != 0 && !found;
816 item = (QCheckListItem *)item->nextSibling() ) 817 item = (QCheckListItem *)item->nextSibling() )
817 { 818 {
818 if ( item->isOn() ) 819 if ( item->isOn() )
819 found = true; 820 found = true;
820 } 821 }
821 } 822 }
822 823
823 // If user selected some packages then download the and store the locally 824 // If user selected some packages then download the and store the locally
824 // otherwise, display dialog asking user what package to download from an http server 825 // otherwise, display dialog asking user what package to download from an http server
825 // and whether to install it 826 // and whether to install it
826 if ( found ) 827 if ( found )
827 downloadSelectedPackages(); 828 downloadSelectedPackages();
828 else 829 else
829 downloadRemotePackage(); 830 downloadRemotePackage();
830 831
831 } 832 }
832 else 833 else
833 { 834 {
834 doUpdate = false; 835 doUpdate = false;
835 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 836 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
836 item != 0 ; 837 item != 0 ;
837 item = (QCheckListItem *)item->nextSibling() ) 838 item = (QCheckListItem *)item->nextSibling() )
838 { 839 {
839 if ( item->isOn() ) 840 if ( item->isOn() )
840 { 841 {
841 QString name = item->text(); 842 QString name = item->text();
842 int pos = name.find( "*" ); 843 int pos = name.find( "*" );
843 name.truncate( pos ); 844 name.truncate( pos );
844 845
845 // if (there is a (installed), remove it 846 // if (there is a (installed), remove it
846 pos = name.find( "(installed)" ); 847 pos = name.find( "(installed)" );
847 if ( pos > 0 ) 848 if ( pos > 0 )
848 name.truncate( pos - 1 ); 849 name.truncate( pos - 1 );
849 850
850 Package *p = mgr->getServer( serversList->currentText() )->getPackage( name ); 851 Package *p = mgr->getServer( serversList->currentText() )->getPackage( name );
851 852
852 QString msgtext; 853 QString msgtext;
853 msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() ); 854 msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() );
854 if ( QMessageBox::information( this, tr( "Are you sure?" ), 855 if ( QMessageBox::information( this, tr( "Are you sure?" ),
855 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) 856 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
856 { 857 {
857 doUpdate = true; 858 doUpdate = true;
858 QFile f( p->getFilename() ); 859 QFile f( p->getFilename() );
859 f.remove(); 860 f.remove();
860 } 861 }
861 } 862 }
862 } 863 }
863 } 864 }
864 865
865 if ( doUpdate ) 866 if ( doUpdate )
866 { 867 {
867 mgr->reloadServerData(); 868 reloadData();
868 serverSelected( -1 );
869 } 869 }
870} 870}
871 871
872void MainWindow :: downloadSelectedPackages() 872void MainWindow :: downloadSelectedPackages()
873{ 873{
874 // First, write out ipkg_conf file so that ipkg can use it 874 // First, write out ipkg_conf file so that ipkg can use it
875 mgr->writeOutIpkgConf(); 875 mgr->writeOutIpkgConf();
876 876
877 // Display dialog to user asking where to download the files to 877 // Display dialog to user asking where to download the files to
878 bool ok = FALSE; 878 bool ok = FALSE;
879 QString dir = ""; 879 QString dir = "";
880#ifdef QWS 880#ifdef QWS
881 // read download directory from config file 881 // read download directory from config file
882 Config cfg( "aqpkg" ); 882 Config cfg( "aqpkg" );
883 cfg.setGroup( "settings" ); 883 cfg.setGroup( "settings" );
884 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); 884 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
885#endif 885#endif
886 886
887 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); 887 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
888 if ( ok && !text.isEmpty() ) 888 if ( ok && !text.isEmpty() )
889 dir = text; // user entered something and pressed ok 889 dir = text; // user entered something and pressed ok
890 else 890 else
891 return; // user entered nothing or pressed cancel 891 return; // user entered nothing or pressed cancel
892 892
893#ifdef QWS 893#ifdef QWS
894 // Store download directory in config file 894 // Store download directory in config file
895 cfg.writeEntry( "downloadDir", dir ); 895 cfg.writeEntry( "downloadDir", dir );
896#endif 896#endif
897 897
898 // Get starting directory 898 // Get starting directory
899 char initDir[PATH_MAX]; 899 char initDir[PATH_MAX];
900 getcwd( initDir, PATH_MAX ); 900 getcwd( initDir, PATH_MAX );
901 901
902 // Download each package 902 // Download each package
903 Ipkg ipkg; 903 Ipkg ipkg;
904 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 904 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
905 905
906 ipkg.setOption( "download" ); 906 ipkg.setOption( "download" );
907 ipkg.setRuntimeDirectory( dir ); 907 ipkg.setRuntimeDirectory( dir );
908 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 908 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
909 item != 0 ; 909 item != 0 ;
910 item = (QCheckListItem *)item->nextSibling() ) 910 item = (QCheckListItem *)item->nextSibling() )
911 { 911 {
912 if ( item->isOn() ) 912 if ( item->isOn() )
913 { 913 {
914 ipkg.setPackage( item->text() ); 914 ipkg.setPackage( item->text() );
915 ipkg.runIpkg( ); 915 ipkg.runIpkg( );
916 } 916 }
917 } 917 }
918} 918}
919 919
920void MainWindow :: downloadRemotePackage() 920void MainWindow :: downloadRemotePackage()
921{ 921{
922 // Display dialog 922 // Display dialog
923 bool ok; 923 bool ok;
924 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); 924 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this );
925 if ( !ok || package.isEmpty() ) 925 if ( !ok || package.isEmpty() )
926 return; 926 return;
927// DownloadRemoteDlgImpl dlg( this, "Install", true ); 927// DownloadRemoteDlgImpl dlg( this, "Install", true );
928// if ( dlg.exec() == QDialog::Rejected ) 928// if ( dlg.exec() == QDialog::Rejected )
929// return; 929// return;
930 930
931 // grab details from dialog 931 // grab details from dialog
932// QString package = dlg.getPackageLocation(); 932// QString package = dlg.getPackageLocation();
933 933
934 InstallData item; 934 InstallData item;
935 item.option = "I"; 935 item.option = "I";
936 item.packageName = package; 936 item.packageName = package;
937 vector<InstallData> workingPackages; 937 vector<InstallData> workingPackages;
938 workingPackages.push_back( item ); 938 workingPackages.push_back( item );
939 939
940 InstallDlgImpl dlg2( workingPackages, mgr, this, "Install", true ); 940 InstallDlgImpl dlg2( workingPackages, mgr, this, "Install", true );
941 dlg2.showDlg(); 941 dlg2.showDlg();
942 942
943 // Reload data 943 reloadData();
944 mgr->reloadServerData(); 944
945 serverSelected(-1);
946
947#ifdef QWS 945#ifdef QWS
948 // Finally let the main system update itself 946 // Finally let the main system update itself
949 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 947 QCopEnvelope e("QPE/System", "linkChanged(QString)");
950 QString lf = QString::null; 948 QString lf = QString::null;
951 e << lf; 949 e << lf;
952#endif 950#endif
953} 951}
954 952
955 953
956void MainWindow :: applyChanges() 954void MainWindow :: applyChanges()
957{ 955{
958 stickyOption = ""; 956 stickyOption = "";
959 957
960 // First, write out ipkg_conf file so that ipkg can use it 958 // First, write out ipkg_conf file so that ipkg can use it
961 mgr->writeOutIpkgConf(); 959 mgr->writeOutIpkgConf();
962 960
963 // Now for each selected item 961 // Now for each selected item
964 // deal with it 962 // deal with it
965 963
966 vector<InstallData> workingPackages; 964 vector<InstallData> workingPackages;
967 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 965 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
968 item != 0 ; 966 item != 0 ;
969 item = (QCheckListItem *)item->nextSibling() ) 967 item = (QCheckListItem *)item->nextSibling() )
970 { 968 {
971 if ( item->isOn() ) 969 if ( item->isOn() )
972 { 970 {
973 InstallData data = dealWithItem( item ); 971 InstallData data = dealWithItem( item );
974 workingPackages.push_back( data ); 972 workingPackages.push_back( data );
975 } 973 }
976 } 974 }
977 975
978 if ( workingPackages.size() == 0 ) 976 if ( workingPackages.size() == 0 )
979 { 977 {
980 // Nothing to do 978 // Nothing to do
981 QMessageBox::information( this, tr( "Nothing to do" ), 979 QMessageBox::information( this, tr( "Nothing to do" ),
982 tr( "No packages selected" ), tr( "OK" ) ); 980 tr( "No packages selected" ), tr( "OK" ) );
983 981
984 return; 982 return;
985 } 983 }
986 984
987 // do the stuff 985 // do the stuff
988 InstallDlgImpl dlg( workingPackages, mgr, this, "Install", true ); 986 InstallDlgImpl dlg( workingPackages, mgr, this, "Install", true );
989 dlg.showDlg(); 987 dlg.showDlg();
990 988
991 // Reload data 989 reloadData();
992 mgr->reloadServerData(); 990
993 serverSelected(-1);
994
995#ifdef QWS 991#ifdef QWS
996 // Finally let the main system update itself 992 // Finally let the main system update itself
997 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 993 QCopEnvelope e("QPE/System", "linkChanged(QString)");
998 QString lf = QString::null; 994 QString lf = QString::null;
999 e << lf; 995 e << lf;
1000#endif 996#endif
1001} 997}
1002 998
1003// decide what to do - either remove, upgrade or install 999// decide what to do - either remove, upgrade or install
1004// Current rules: 1000// Current rules:
1005// If not installed - install 1001// If not installed - install
1006// If installed and different version available - upgrade 1002// If installed and different version available - upgrade
1007// If installed and version up to date - remove 1003// If installed and version up to date - remove
1008InstallData MainWindow :: dealWithItem( QCheckListItem *item ) 1004InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1009{ 1005{
1010 QString name = item->text(); 1006 QString name = item->text();
1011 1007
1012 // Get package 1008 // Get package
1013 vector<Server>::iterator s = mgr->getServer( serversList->currentText() ); 1009 vector<Server>::iterator s = mgr->getServer( serversList->currentText() );
1014 Package *p = s->getPackage( name ); 1010 Package *p = s->getPackage( name );
1015 1011
1016 // If the package has a filename then it is a local file 1012 // If the package has a filename then it is a local file
1017 if ( p->isPackageStoredLocally() ) 1013 if ( p->isPackageStoredLocally() )
1018 name = p->getFilename(); 1014 name = p->getFilename();
1019 1015
1020 QString option; 1016 QString option;
1021 QString dest = "root"; 1017 QString dest = "root";
1022 if ( !p->isInstalled() ) 1018 if ( !p->isInstalled() )
1023 { 1019 {
1024 InstallData item; 1020 InstallData item;
1025 item.option = "I"; 1021 item.option = "I";
1026 item.packageName = name; 1022 item.packageName = name;
1027 return item; 1023 return item;
1028 } 1024 }
1029 else 1025 else
1030 { 1026 {
1031 InstallData item; 1027 InstallData item;
1032 item.option = "D"; 1028 item.option = "D";
1033 if ( !p->isPackageStoredLocally() ) 1029 if ( !p->isPackageStoredLocally() )
1034 item.packageName = p->getInstalledPackageName(); 1030 item.packageName = p->getInstalledPackageName();
1035 else 1031 else
1036 item.packageName = name; 1032 item.packageName = name;
1037 1033
1038 if ( p->getInstalledTo() ) 1034 if ( p->getInstalledTo() )
1039 { 1035 {
1040 item.destination = p->getInstalledTo(); 1036 item.destination = p->getInstalledTo();
1041// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; 1037// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl;
1042// cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; 1038// cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl;
1043 } 1039 }
1044 else 1040 else
1045 { 1041 {
1046 item.destination = p->getLocalPackage()->getInstalledTo(); 1042 item.destination = p->getLocalPackage()->getInstalledTo();
1047 } 1043 }
1048 1044
1049 // Now see if version is newer or not 1045 // Now see if version is newer or not
1050 int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); 1046 int val = compareVersions( p->getInstalledVersion(), p->getVersion() );
1051 1047
1052 // If the version requested is older and user selected a local ipk file, then reinstall the file 1048 // If the version requested is older and user selected a local ipk file, then reinstall the file
1053 if ( p->isPackageStoredLocally() && val == -1 ) 1049 if ( p->isPackageStoredLocally() && val == -1 )
1054 val = 0; 1050 val = 0;
1055 1051
1056 if ( val == -2 ) 1052 if ( val == -2 )
1057 { 1053 {
1058 // Error - should handle 1054 // Error - should handle
1059 } 1055 }
1060 else if ( val == -1 ) 1056 else if ( val == -1 )
1061 { 1057 {
1062 // Version available is older - remove only 1058 // Version available is older - remove only
1063 item.option = "D"; 1059 item.option = "D";
1064 } 1060 }
1065 else 1061 else
1066 { 1062 {
1067 QString caption; 1063 QString caption;
1068 QString text; 1064 QString text;
1069 QString secondButton; 1065 QString secondButton;
1070 QString secondOption; 1066 QString secondOption;
1071 if ( val == 0 ) 1067 if ( val == 0 )
1072 { 1068 {
1073 // Version available is the same - option to remove or reinstall 1069 // Version available is the same - option to remove or reinstall
1074 caption = tr( "Do you wish to remove or reinstall\n%1?" ); 1070 caption = tr( "Do you wish to remove or reinstall\n%1?" );
1075 text = tr( "Remove or ReInstall" ); 1071 text = tr( "Remove or ReInstall" );
1076 secondButton = tr( "ReInstall" ); 1072 secondButton = tr( "ReInstall" );
1077 secondOption = tr( "R" ); 1073 secondOption = tr( "R" );
1078 } 1074 }
1079 else if ( val == 1 ) 1075 else if ( val == 1 )
1080 { 1076 {
1081 // Version available is newer - option to remove or upgrade 1077 // Version available is newer - option to remove or upgrade
1082 caption = tr( "Do you wish to remove or upgrade\n%1?" ); 1078 caption = tr( "Do you wish to remove or upgrade\n%1?" );
1083 text = tr( "Remove or Upgrade" ); 1079 text = tr( "Remove or Upgrade" );
1084 secondButton = tr( "Upgrade" ); 1080 secondButton = tr( "Upgrade" );
1085 secondOption = tr( "U" ); 1081 secondOption = tr( "U" );
1086 } 1082 }
1087 1083
1088 // Sticky option not implemented yet, but will eventually allow 1084 // Sticky option not implemented yet, but will eventually allow
1089 // the user to say something like 'remove all' 1085 // the user to say something like 'remove all'
1090 if ( stickyOption == "" ) 1086 if ( stickyOption == "" )
1091 { 1087 {
1092 QString msgtext; 1088 QString msgtext;
1093 msgtext = caption.arg( ( const char * )name ); 1089 msgtext = caption.arg( ( const char * )name );
1094 switch( QMessageBox::information( this, text, 1090 switch( QMessageBox::information( this, text,
1095 msgtext, tr( "Remove" ), secondButton ) ) 1091 msgtext, tr( "Remove" ), secondButton ) )
1096 { 1092 {
1097 case 0: // Try again or Enter 1093 case 0: // Try again or Enter
1098 // option 0 = Remove 1094 // option 0 = Remove
1099 item.option = "D"; 1095 item.option = "D";
1100 break; 1096 break;
1101 case 1: // Quit or Escape 1097 case 1: // Quit or Escape
1102 item.option = secondOption; 1098 item.option = secondOption;
1103 break; 1099 break;
1104 } 1100 }
1105 } 1101 }
1106 else 1102 else
1107 { 1103 {
1108// item.option = stickyOption; 1104// item.option = stickyOption;
1109 } 1105 }
1110 } 1106 }
1111 1107
1112 1108
1113 // Check if we are reinstalling the same version 1109 // Check if we are reinstalling the same version
1114 if ( item.option != "R" ) 1110 if ( item.option != "R" )
1115 item.recreateLinks = true; 1111 item.recreateLinks = true;
1116 else 1112 else
1117 item.recreateLinks = false; 1113 item.recreateLinks = false;
1118 1114
1119 // User hit cancel (on dlg - assume remove) 1115 // User hit cancel (on dlg - assume remove)
1120 return item; 1116 return item;
1121 } 1117 }
1122} 1118}
1123 1119
1120void MainWindow :: reloadData()
1121{
1122 stack->raiseWidget( progressWindow );
1123 mgr->reloadServerData();
1124 serverSelected( -1, FALSE );
1125 stack->raiseWidget( networkPkgWindow );
1126}
1127
1124void MainWindow :: letterPushed( QString t ) 1128void MainWindow :: letterPushed( QString t )
1125{ 1129{
1126 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); 1130 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
1127 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 1131 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
1128 if ( packagesList->firstChild() == 0 ) 1132 if ( packagesList->firstChild() == 0 )
1129 return; 1133 return;
1130 1134
1131 QCheckListItem *item; 1135 QCheckListItem *item;
1132 if ( start == 0 ) 1136 if ( start == 0 )
1133 { 1137 {
1134 item = (QCheckListItem *)packagesList->firstChild(); 1138 item = (QCheckListItem *)packagesList->firstChild();
1135 start = top; 1139 start = top;
1136 } 1140 }
1137 else 1141 else
1138 item = (QCheckListItem *)start->nextSibling(); 1142 item = (QCheckListItem *)start->nextSibling();
1139 1143
1140 if ( item == 0 ) 1144 if ( item == 0 )
1141 item = (QCheckListItem *)packagesList->firstChild(); 1145 item = (QCheckListItem *)packagesList->firstChild();
1142 do 1146 do
1143 { 1147 {
1144 if ( item->text().lower().startsWith( t.lower() ) ) 1148 if ( item->text().lower().startsWith( t.lower() ) )
1145 { 1149 {
1146 packagesList->setSelected( item, true ); 1150 packagesList->setSelected( item, true );
1147 packagesList->ensureItemVisible( item ); 1151 packagesList->ensureItemVisible( item );
1148 break; 1152 break;
1149 } 1153 }
1150 1154
1151 item = (QCheckListItem *)item->nextSibling(); 1155 item = (QCheckListItem *)item->nextSibling();
1152 if ( !item ) 1156 if ( !item )
1153 item = (QCheckListItem *)packagesList->firstChild(); 1157 item = (QCheckListItem *)packagesList->firstChild();
1154 } while ( item != start); 1158 } while ( item != start);
1155} 1159}
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index 46b5fae..be30668 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -1,133 +1,134 @@
1/*************************************************************************** 1/***************************************************************************
2 mainwin.h - description 2 mainwin.h - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 13:32:30 BST 2002 4 begin : Mon Aug 26 13:32:30 BST 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#ifndef MAINWIN_H 18#ifndef MAINWIN_H
19#define MAINWIN_H 19#define MAINWIN_H
20 20
21#include <qmainwindow.h> 21#include <qmainwindow.h>
22#include <qpixmap.h> 22#include <qpixmap.h>
23 23
24class DataManager; 24class DataManager;
25class InstallData; 25class InstallData;
26 26
27class QAction; 27class QAction;
28class QCheckListItem; 28class QCheckListItem;
29class QComboBox; 29class QComboBox;
30class QLabel; 30class QLabel;
31class QLineEdit; 31class QLineEdit;
32class QListView; 32class QListView;
33class QPEToolBar; 33class QPEToolBar;
34class QProgressBar; 34class QProgressBar;
35class QWidgetStack; 35class QWidgetStack;
36 36
37class MainWindow :public QMainWindow 37class MainWindow :public QMainWindow
38{ 38{
39 Q_OBJECT 39 Q_OBJECT
40public: 40public:
41 41
42 MainWindow(); 42 MainWindow();
43 ~MainWindow(); 43 ~MainWindow();
44 44
45private: 45private:
46 DataManager *mgr; 46 DataManager *mgr;
47 47
48 QWidgetStack *stack; 48 QWidgetStack *stack;
49 49
50 QPEToolBar *findBar; 50 QPEToolBar *findBar;
51 QLineEdit *findEdit; 51 QLineEdit *findEdit;
52 QAction *actionFindNext; 52 QAction *actionFindNext;
53 QAction *actionFilter; 53 QAction *actionFilter;
54 QAction *actionUpgrade; 54 QAction *actionUpgrade;
55 QAction *actionDownload; 55 QAction *actionDownload;
56 QAction *actionUninstalled; 56 QAction *actionUninstalled;
57 QAction *actionInstalled; 57 QAction *actionInstalled;
58 QAction *actionUpdated; 58 QAction *actionUpdated;
59 59
60 QPixmap iconDownload; 60 QPixmap iconDownload;
61 QPixmap iconRemove; 61 QPixmap iconRemove;
62 62
63 int mnuShowUninstalledPkgsId; 63 int mnuShowUninstalledPkgsId;
64 int mnuShowInstalledPkgsId; 64 int mnuShowInstalledPkgsId;
65 int mnuShowUpgradedPkgsId; 65 int mnuShowUpgradedPkgsId;
66 int mnuFilterByCategory; 66 int mnuFilterByCategory;
67 int mnuSetFilterCategory; 67 int mnuSetFilterCategory;
68 68
69 // Main package list widget 69 // Main package list widget
70 QWidget *networkPkgWindow; 70 QWidget *networkPkgWindow;
71 QComboBox *serversList; 71 QComboBox *serversList;
72 QListView *packagesList; 72 QListView *packagesList;
73 QPixmap installedIcon; 73 QPixmap installedIcon;
74 QPixmap updatedIcon; 74 QPixmap updatedIcon;
75 QString currentlySelectedServer; 75 QString currentlySelectedServer;
76 QString categoryFilter; 76 QString categoryFilter;
77 QString stickyOption; 77 QString stickyOption;
78 78
79 bool categoryFilterEnabled; 79 bool categoryFilterEnabled;
80 bool showJumpTo; 80 bool showJumpTo;
81 bool showUninstalledPkgs; 81 bool showUninstalledPkgs;
82 bool showInstalledPkgs; 82 bool showInstalledPkgs;
83 bool showUpgradedPkgs; 83 bool showUpgradedPkgs;
84 bool downloadEnabled; 84 bool downloadEnabled;
85 85
86 void initMainWidget(); 86 void initMainWidget();
87 void updateData(); 87 void updateData();
88 void serverSelected( int index, bool showProgress ); 88 void serverSelected( int index, bool showProgress );
89 void searchForPackage( const QString & ); 89 void searchForPackage( const QString & );
90 bool filterByCategory( bool val ); 90 bool filterByCategory( bool val );
91 void downloadSelectedPackages(); 91 void downloadSelectedPackages();
92 void downloadRemotePackage(); 92 void downloadRemotePackage();
93 InstallData dealWithItem( QCheckListItem *item ); 93 InstallData dealWithItem( QCheckListItem *item );
94 void reloadData();
94 95
95 // Progress widget 96 // Progress widget
96 QWidget *progressWindow; 97 QWidget *progressWindow;
97 QLabel *m_status; 98 QLabel *m_status;
98 QProgressBar *m_progress; 99 QProgressBar *m_progress;
99 100
100 void initProgressWidget(); 101 void initProgressWidget();
101 102
102public slots: 103public slots:
103 void setDocument( const QString &doc ); 104// void setDocument( const QString &doc );
104 void displayHelp(); 105 void displayHelp();
105 void displayFindBar(); 106 void displayFindBar();
106 void repeatFind(); 107 void repeatFind();
107 void findPackage( const QString & ); 108 void findPackage( const QString & );
108 void hideFindBar(); 109 void hideFindBar();
109 void displayAbout(); 110 void displayAbout();
110 void displaySettings(); 111 void displaySettings();
111 void filterUninstalledPackages(); 112 void filterUninstalledPackages();
112 void filterInstalledPackages(); 113 void filterInstalledPackages();
113 void filterUpgradedPackages(); 114 void filterUpgradedPackages();
114 void filterCategory(); 115 void filterCategory();
115 bool setFilterCategory(); 116 bool setFilterCategory();
116 void raiseMainWidget(); 117 void raiseMainWidget();
117 void raiseProgressWidget(); 118 void raiseProgressWidget();
118 void enableUpgrade( bool ); 119 void enableUpgrade( bool );
119 void enableDownload( bool ); 120 void enableDownload( bool );
120 121
121private slots: 122private slots:
122 void init(); 123 void init();
123 void setProgressSteps( int ); 124 void setProgressSteps( int );
124 void setProgressMessage( const QString & ); 125 void setProgressMessage( const QString & );
125 void updateProgress( int ); 126 void updateProgress( int );
126 void serverSelected( int index ); 127 void serverSelected( int index );
127 void updateServer(); 128 void updateServer();
128 void upgradePackages(); 129 void upgradePackages();
129 void downloadPackage(); 130 void downloadPackage();
130 void applyChanges(); 131 void applyChanges();
131 void letterPushed( QString t ); 132 void letterPushed( QString t );
132}; 133};
133#endif 134#endif