-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 | |||
@@ -275,84 +275,88 @@ void MainWindow :: initProgressWidget() | |||
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 | ||
279 | void MainWindow :: init() | 279 | void 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 | /* | |
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 ); |
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 | */ | |
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 | { |
347 | findBar->show(); | 351 | findBar->show(); |
348 | findEdit->setFocus(); | 352 | findEdit->setFocus(); |
349 | } | 353 | } |
350 | 354 | ||
351 | void MainWindow :: repeatFind() | 355 | void MainWindow :: repeatFind() |
352 | { | 356 | { |
353 | searchForPackage( findEdit->text() ); | 357 | searchForPackage( findEdit->text() ); |
354 | } | 358 | } |
355 | 359 | ||
356 | void MainWindow :: findPackage( const QString &text ) | 360 | void MainWindow :: findPackage( const QString &text ) |
357 | { | 361 | { |
358 | actionFindNext->setEnabled( !text.isEmpty() ); | 362 | actionFindNext->setEnabled( !text.isEmpty() ); |
@@ -707,120 +711,117 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
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 | ||
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 ); |
745 | packagesList->setCurrentItem( item ); | 749 | packagesList->setCurrentItem( item ); |
746 | break; | 750 | break; |
747 | } | 751 | } |
748 | } | 752 | } |
749 | } | 753 | } |
750 | } | 754 | } |
751 | 755 | ||
752 | void MainWindow :: updateServer() | 756 | void 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 | ||
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 , |
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 ) |
@@ -843,50 +844,49 @@ void MainWindow :: upgradePackages() | |||
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 | ||
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 |
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 | ||
@@ -919,99 +919,95 @@ void MainWindow :: downloadSelectedPackages() | |||
919 | 919 | ||
920 | void MainWindow :: downloadRemotePackage() | 920 | void 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(); | ||
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 | { |
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(); | ||
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 |
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 |
1008 | InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | 1004 | InstallData 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() ) |
@@ -1100,48 +1096,56 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | |||
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 | ||
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; |
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 ); |
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 | |||
@@ -70,58 +70,59 @@ private: | |||
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 | ||
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(); |
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 | ||
121 | private slots: | 122 | private 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(); |