author | drw <drw> | 2003-01-23 01:47:41 (UTC) |
---|---|---|
committer | drw <drw> | 2003-01-23 01:47:41 (UTC) |
commit | c464d34970bedca56a518310deef7ce08474033c (patch) (unidiff) | |
tree | 8f0e9c1c75daf0cdd53bdd5e3cdaf22a3b5b60b3 /noncore | |
parent | 454eba9982f1a898e914b558f2ceac913fdf3b5c (diff) | |
download | opie-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
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 40 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 3 |
2 files changed, 24 insertions, 19 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 | |||
@@ -287,25 +287,25 @@ void MainWindow :: init() | |||
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 | /* | |
300 | void MainWindow :: setDocument( const QString &doc ) | 300 | void 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 ); |
@@ -317,30 +317,34 @@ void MainWindow :: setDocument( const QString &doc ) | |||
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 | */ | |
330 | void MainWindow :: displaySettings() | 330 | void 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 | ||
338 | void MainWindow :: displayHelp() | 342 | void 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 | ||
345 | void MainWindow :: displayFindBar() | 349 | void MainWindow :: displayFindBar() |
346 | { | 350 | { |
@@ -719,26 +723,26 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
719 | stack->raiseWidget( networkPkgWindow ); | 723 | stack->raiseWidget( networkPkgWindow ); |
720 | } | 724 | } |
721 | } | 725 | } |
722 | 726 | ||
723 | void MainWindow :: searchForPackage( const QString &text ) | 727 | void 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 ); |
@@ -758,27 +762,26 @@ void MainWindow :: updateServer() | |||
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 | ||
776 | void MainWindow :: upgradePackages() | 779 | void 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 , |
@@ -788,27 +791,25 @@ void MainWindow :: upgradePackages() | |||
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(); |
@@ -855,26 +856,25 @@ void MainWindow :: upgradePackages() | |||
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 | ||
872 | void MainWindow :: downloadSelectedPackages() | 872 | void 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 |
@@ -931,27 +931,25 @@ void MainWindow :: downloadRemotePackage() | |||
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(); | ||
945 | serverSelected(-1); | ||
946 | 944 | ||
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 | ||
956 | void MainWindow :: applyChanges() | 954 | void MainWindow :: applyChanges() |
957 | { | 955 | { |
@@ -979,27 +977,25 @@ void MainWindow :: applyChanges() | |||
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(); | ||
993 | serverSelected(-1); | ||
994 | 990 | ||
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 |
@@ -1112,24 +1108,32 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | |||
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 | ||
1120 | void MainWindow :: reloadData() | ||
1121 | { | ||
1122 | stack->raiseWidget( progressWindow ); | ||
1123 | mgr->reloadServerData(); | ||
1124 | serverSelected( -1, FALSE ); | ||
1125 | stack->raiseWidget( networkPkgWindow ); | ||
1126 | } | ||
1127 | |||
1124 | void MainWindow :: letterPushed( QString t ) | 1128 | void 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; |
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 | |||
@@ -82,34 +82,35 @@ private: | |||
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 | ||
102 | public slots: | 103 | public 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(); |