author | drw <drw> | 2003-04-26 23:11:13 (UTC) |
---|---|---|
committer | drw <drw> | 2003-04-26 23:11:13 (UTC) |
commit | 77bed0e99aa0c912e5d86f257131c1f93afcee77 (patch) (unidiff) | |
tree | c9ecc864e802a395c066bfb7d345e16dc1fc0968 | |
parent | 98a9291263e167b8882ac916330e7215ebd884b4 (diff) | |
download | opie-77bed0e99aa0c912e5d86f257131c1f93afcee77.zip opie-77bed0e99aa0c912e5d86f257131c1f93afcee77.tar.gz opie-77bed0e99aa0c912e5d86f257131c1f93afcee77.tar.bz2 |
Fix for bug #887 - do not perform documents update when doing a 'ipkg update'
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 19 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 1 |
2 files changed, 14 insertions, 6 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 58f6feb..f0e8e48 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -711,126 +711,128 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
711 | 711 | ||
712 | void MainWindow :: searchForPackage( const QString &text ) | 712 | void MainWindow :: searchForPackage( const QString &text ) |
713 | { | 713 | { |
714 | if ( !text.isEmpty() ) | 714 | if ( !text.isEmpty() ) |
715 | { | 715 | { |
716 | // cout << "searching for " << text << endl; | 716 | // cout << "searching for " << text << endl; |
717 | // look through package list for text startng at current position | 717 | // look through package list for text startng at current position |
718 | // vector<InstallData> workingPackages; | 718 | // vector<InstallData> workingPackages; |
719 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 719 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
720 | // if ( start != 0 ) | 720 | // if ( start != 0 ) |
721 | // start = (QCheckListItem *)start->nextSibling(); | 721 | // start = (QCheckListItem *)start->nextSibling(); |
722 | 722 | ||
723 | if ( start == 0 ) | 723 | if ( start == 0 ) |
724 | start = (QCheckListItem *)packagesList->firstChild(); | 724 | start = (QCheckListItem *)packagesList->firstChild(); |
725 | 725 | ||
726 | for ( QCheckListItem *item = start; item != 0 ; | 726 | for ( QCheckListItem *item = start; item != 0 ; |
727 | item = (QCheckListItem *)item->nextSibling() ) | 727 | item = (QCheckListItem *)item->nextSibling() ) |
728 | { | 728 | { |
729 | // cout << "checking " << item->text().lower() << endl; | 729 | // cout << "checking " << item->text().lower() << endl; |
730 | if ( item->text().lower().find( text ) != -1 ) | 730 | if ( item->text().lower().find( text ) != -1 ) |
731 | { | 731 | { |
732 | // cout << "matched " << item->text() << endl; | 732 | // cout << "matched " << item->text() << endl; |
733 | packagesList->ensureItemVisible( item ); | 733 | packagesList->ensureItemVisible( item ); |
734 | packagesList->setCurrentItem( item ); | 734 | packagesList->setCurrentItem( item ); |
735 | break; | 735 | break; |
736 | } | 736 | } |
737 | } | 737 | } |
738 | } | 738 | } |
739 | } | 739 | } |
740 | 740 | ||
741 | void MainWindow :: updateServer() | 741 | void MainWindow :: updateServer() |
742 | { | 742 | { |
743 | QString serverName = serversList->currentText(); | 743 | QString serverName = serversList->currentText(); |
744 | 744 | ||
745 | // Update the current server | 745 | // Update the current server |
746 | // Display dialog | 746 | // Display dialog |
747 | 747 | ||
748 | // Disable buttons to stop silly people clicking lots on them :) | 748 | // Disable buttons to stop silly people clicking lots on them :) |
749 | 749 | ||
750 | // First, write out ipkg_conf file so that ipkg can use it | 750 | // First, write out ipkg_conf file so that ipkg can use it |
751 | mgr->writeOutIpkgConf(); | 751 | mgr->writeOutIpkgConf(); |
752 | 752 | ||
753 | Ipkg *ipkg = new Ipkg; | 753 | Ipkg *ipkg = new Ipkg; |
754 | ipkg->setOption( "update" ); | 754 | ipkg->setOption( "update" ); |
755 | 755 | ||
756 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), | 756 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), |
757 | tr( "Update lists" ) ); | 757 | tr( "Update lists" ) ); |
758 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 758 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
759 | reloadDocuments = FALSE; | ||
759 | stack->addWidget( dlg, 3 ); | 760 | stack->addWidget( dlg, 3 ); |
760 | stack->raiseWidget( dlg ); | 761 | stack->raiseWidget( dlg ); |
761 | 762 | ||
762 | // delete progDlg; | 763 | // delete progDlg; |
763 | } | 764 | } |
764 | 765 | ||
765 | void MainWindow :: upgradePackages() | 766 | void MainWindow :: upgradePackages() |
766 | { | 767 | { |
767 | // We're gonna do an upgrade of all packages | 768 | // We're gonna do an upgrade of all packages |
768 | // First warn user that this isn't recommended | 769 | // First warn user that this isn't recommended |
769 | // TODO - ODevice???? | 770 | // TODO - ODevice???? |
770 | QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); | 771 | QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); |
771 | QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, | 772 | QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, |
772 | QMessageBox::Yes, | 773 | QMessageBox::Yes, |
773 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , | 774 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , |
774 | 0, this ); | 775 | 0, this ); |
775 | warn.adjustSize(); | 776 | warn.adjustSize(); |
776 | 777 | ||
777 | if ( warn.exec() == QMessageBox::Yes ) | 778 | if ( warn.exec() == QMessageBox::Yes ) |
778 | { | 779 | { |
779 | // First, write out ipkg_conf file so that ipkg can use it | 780 | // First, write out ipkg_conf file so that ipkg can use it |
780 | mgr->writeOutIpkgConf(); | 781 | mgr->writeOutIpkgConf(); |
781 | 782 | ||
782 | // Now run upgrade | 783 | // Now run upgrade |
783 | Ipkg *ipkg = new Ipkg; | 784 | Ipkg *ipkg = new Ipkg; |
784 | ipkg->setOption( "upgrade" ); | 785 | ipkg->setOption( "upgrade" ); |
785 | 786 | ||
786 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), | 787 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), |
787 | tr ( "Upgrade" ) ); | 788 | tr ( "Upgrade" ) ); |
788 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 789 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
790 | reloadDocuments = TRUE; | ||
789 | stack->addWidget( dlg, 3 ); | 791 | stack->addWidget( dlg, 3 ); |
790 | stack->raiseWidget( dlg ); | 792 | stack->raiseWidget( dlg ); |
791 | } | 793 | } |
792 | } | 794 | } |
793 | 795 | ||
794 | void MainWindow :: downloadPackage() | 796 | void MainWindow :: downloadPackage() |
795 | { | 797 | { |
796 | bool doUpdate = true; | 798 | bool doUpdate = true; |
797 | if ( downloadEnabled ) | 799 | if ( downloadEnabled ) |
798 | { | 800 | { |
799 | // See if any packages are selected | 801 | // See if any packages are selected |
800 | bool found = false; | 802 | bool found = false; |
801 | if ( serversList->currentText() != LOCAL_SERVER ) | 803 | if ( serversList->currentText() != LOCAL_SERVER ) |
802 | { | 804 | { |
803 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 805 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
804 | item != 0 && !found; | 806 | item != 0 && !found; |
805 | item = (QCheckListItem *)item->nextSibling() ) | 807 | item = (QCheckListItem *)item->nextSibling() ) |
806 | { | 808 | { |
807 | if ( item->isOn() ) | 809 | if ( item->isOn() ) |
808 | found = true; | 810 | found = true; |
809 | } | 811 | } |
810 | } | 812 | } |
811 | 813 | ||
812 | // If user selected some packages then download the and store the locally | 814 | // If user selected some packages then download the and store the locally |
813 | // otherwise, display dialog asking user what package to download from an http server | 815 | // otherwise, display dialog asking user what package to download from an http server |
814 | // and whether to install it | 816 | // and whether to install it |
815 | if ( found ) | 817 | if ( found ) |
816 | downloadSelectedPackages(); | 818 | downloadSelectedPackages(); |
817 | else | 819 | else |
818 | downloadRemotePackage(); | 820 | downloadRemotePackage(); |
819 | 821 | ||
820 | } | 822 | } |
821 | else | 823 | else |
822 | { | 824 | { |
823 | doUpdate = false; | 825 | doUpdate = false; |
824 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 826 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
825 | item != 0 ; | 827 | item != 0 ; |
826 | item = (QCheckListItem *)item->nextSibling() ) | 828 | item = (QCheckListItem *)item->nextSibling() ) |
827 | { | 829 | { |
828 | if ( item->isOn() ) | 830 | if ( item->isOn() ) |
829 | { | 831 | { |
830 | QString name = item->text(); | 832 | QString name = item->text(); |
831 | int pos = name.find( "*" ); | 833 | int pos = name.find( "*" ); |
832 | name.truncate( pos ); | 834 | name.truncate( pos ); |
833 | 835 | ||
834 | // if (there is a (installed), remove it | 836 | // if (there is a (installed), remove it |
835 | pos = name.find( "(installed)" ); | 837 | pos = name.find( "(installed)" ); |
836 | if ( pos > 0 ) | 838 | if ( pos > 0 ) |
@@ -883,135 +885,137 @@ void MainWindow :: downloadSelectedPackages() | |||
883 | cfg.writeEntry( "downloadDir", dir ); | 885 | cfg.writeEntry( "downloadDir", dir ); |
884 | #endif | 886 | #endif |
885 | 887 | ||
886 | // Get starting directory | 888 | // Get starting directory |
887 | char initDir[PATH_MAX]; | 889 | char initDir[PATH_MAX]; |
888 | getcwd( initDir, PATH_MAX ); | 890 | getcwd( initDir, PATH_MAX ); |
889 | 891 | ||
890 | // Download each package | 892 | // Download each package |
891 | Ipkg ipkg; | 893 | Ipkg ipkg; |
892 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 894 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
893 | 895 | ||
894 | ipkg.setOption( "download" ); | 896 | ipkg.setOption( "download" ); |
895 | ipkg.setRuntimeDirectory( dir ); | 897 | ipkg.setRuntimeDirectory( dir ); |
896 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 898 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
897 | item != 0 ; | 899 | item != 0 ; |
898 | item = (QCheckListItem *)item->nextSibling() ) | 900 | item = (QCheckListItem *)item->nextSibling() ) |
899 | { | 901 | { |
900 | if ( item->isOn() ) | 902 | if ( item->isOn() ) |
901 | { | 903 | { |
902 | ipkg.setPackage( item->text() ); | 904 | ipkg.setPackage( item->text() ); |
903 | ipkg.runIpkg( ); | 905 | ipkg.runIpkg( ); |
904 | } | 906 | } |
905 | } | 907 | } |
906 | } | 908 | } |
907 | 909 | ||
908 | void MainWindow :: downloadRemotePackage() | 910 | void MainWindow :: downloadRemotePackage() |
909 | { | 911 | { |
910 | // Display dialog | 912 | // Display dialog |
911 | bool ok; | 913 | bool ok; |
912 | QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); | 914 | QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); |
913 | if ( !ok || package.isEmpty() ) | 915 | if ( !ok || package.isEmpty() ) |
914 | return; | 916 | return; |
915 | // DownloadRemoteDlgImpl dlg( this, "Install", true ); | 917 | // DownloadRemoteDlgImpl dlg( this, "Install", true ); |
916 | // if ( dlg.exec() == QDialog::Rejected ) | 918 | // if ( dlg.exec() == QDialog::Rejected ) |
917 | // return; | 919 | // return; |
918 | 920 | ||
919 | // grab details from dialog | 921 | // grab details from dialog |
920 | // QString package = dlg.getPackageLocation(); | 922 | // QString package = dlg.getPackageLocation(); |
921 | 923 | ||
922 | InstallData *item = new InstallData(); | 924 | InstallData *item = new InstallData(); |
923 | item->option = "I"; | 925 | item->option = "I"; |
924 | item->packageName = package; | 926 | item->packageName = package; |
925 | QList<InstallData> workingPackages; | 927 | QList<InstallData> workingPackages; |
926 | workingPackages.setAutoDelete( TRUE ); | 928 | workingPackages.setAutoDelete( TRUE ); |
927 | workingPackages.append( item ); | 929 | workingPackages.append( item ); |
928 | 930 | ||
929 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); | 931 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); |
930 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 932 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
933 | reloadDocuments = TRUE; | ||
931 | stack->addWidget( dlg, 3 ); | 934 | stack->addWidget( dlg, 3 ); |
932 | stack->raiseWidget( dlg ); | 935 | stack->raiseWidget( dlg ); |
933 | } | 936 | } |
934 | 937 | ||
935 | 938 | ||
936 | void MainWindow :: applyChanges() | 939 | void MainWindow :: applyChanges() |
937 | { | 940 | { |
938 | stickyOption = ""; | 941 | stickyOption = ""; |
939 | 942 | ||
940 | // First, write out ipkg_conf file so that ipkg can use it | 943 | // First, write out ipkg_conf file so that ipkg can use it |
941 | mgr->writeOutIpkgConf(); | 944 | mgr->writeOutIpkgConf(); |
942 | 945 | ||
943 | // Now for each selected item | 946 | // Now for each selected item |
944 | // deal with it | 947 | // deal with it |
945 | 948 | ||
946 | QList<InstallData> workingPackages; | 949 | QList<InstallData> workingPackages; |
947 | workingPackages.setAutoDelete( TRUE ); | 950 | workingPackages.setAutoDelete( TRUE ); |
948 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 951 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
949 | item != 0 ; | 952 | item != 0 ; |
950 | item = (QCheckListItem *)item->nextSibling() ) | 953 | item = (QCheckListItem *)item->nextSibling() ) |
951 | { | 954 | { |
952 | if ( item->isOn() ) | 955 | if ( item->isOn() ) |
953 | { | 956 | { |
954 | workingPackages.append( dealWithItem( item ) ); | 957 | workingPackages.append( dealWithItem( item ) ); |
955 | } | 958 | } |
956 | } | 959 | } |
957 | 960 | ||
958 | if ( workingPackages.count() == 0 ) | 961 | if ( workingPackages.count() == 0 ) |
959 | { | 962 | { |
960 | // Nothing to do | 963 | // Nothing to do |
961 | QMessageBox::information( this, tr( "Nothing to do" ), | 964 | QMessageBox::information( this, tr( "Nothing to do" ), |
962 | tr( "No packages selected" ), tr( "OK" ) ); | 965 | tr( "No packages selected" ), tr( "OK" ) ); |
963 | 966 | ||
964 | return; | 967 | return; |
965 | } | 968 | } |
966 | 969 | ||
967 | // do the stuff | 970 | // do the stuff |
968 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); | 971 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); |
969 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 972 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
973 | reloadDocuments = TRUE; | ||
970 | stack->addWidget( dlg, 3 ); | 974 | stack->addWidget( dlg, 3 ); |
971 | stack->raiseWidget( dlg ); | 975 | stack->raiseWidget( dlg ); |
972 | } | 976 | } |
973 | 977 | ||
974 | // decide what to do - either remove, upgrade or install | 978 | // decide what to do - either remove, upgrade or install |
975 | // Current rules: | 979 | // Current rules: |
976 | // If not installed - install | 980 | // If not installed - install |
977 | // If installed and different version available - upgrade | 981 | // If installed and different version available - upgrade |
978 | // If installed and version up to date - remove | 982 | // If installed and version up to date - remove |
979 | InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) | 983 | InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) |
980 | { | 984 | { |
981 | QString name = item->text(); | 985 | QString name = item->text(); |
982 | 986 | ||
983 | // Get package | 987 | // Get package |
984 | Server *s = mgr->getServer( serversList->currentText() ); | 988 | Server *s = mgr->getServer( serversList->currentText() ); |
985 | Package *p = s->getPackage( name ); | 989 | Package *p = s->getPackage( name ); |
986 | 990 | ||
987 | // If the package has a filename then it is a local file | 991 | // If the package has a filename then it is a local file |
988 | if ( p->isPackageStoredLocally() ) | 992 | if ( p->isPackageStoredLocally() ) |
989 | name = p->getFilename(); | 993 | name = p->getFilename(); |
990 | 994 | ||
991 | QString option; | 995 | QString option; |
992 | QString dest = "root"; | 996 | QString dest = "root"; |
993 | if ( !p->isInstalled() ) | 997 | if ( !p->isInstalled() ) |
994 | { | 998 | { |
995 | InstallData *newitem = new InstallData(); | 999 | InstallData *newitem = new InstallData(); |
996 | newitem->option = "I"; | 1000 | newitem->option = "I"; |
997 | newitem->packageName = name; | 1001 | newitem->packageName = name; |
998 | return newitem; | 1002 | return newitem; |
999 | } | 1003 | } |
1000 | else | 1004 | else |
1001 | { | 1005 | { |
1002 | InstallData *newitem = new InstallData(); | 1006 | InstallData *newitem = new InstallData(); |
1003 | newitem->option = "D"; | 1007 | newitem->option = "D"; |
1004 | if ( !p->isPackageStoredLocally() ) | 1008 | if ( !p->isPackageStoredLocally() ) |
1005 | newitem->packageName = p->getInstalledPackageName(); | 1009 | newitem->packageName = p->getInstalledPackageName(); |
1006 | else | 1010 | else |
1007 | newitem->packageName = name; | 1011 | newitem->packageName = name; |
1008 | 1012 | ||
1009 | if ( p->getInstalledTo() ) | 1013 | if ( p->getInstalledTo() ) |
1010 | { | 1014 | { |
1011 | newitem->destination = p->getInstalledTo(); | 1015 | newitem->destination = p->getInstalledTo(); |
1012 | // cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; | 1016 | // cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; |
1013 | // cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; | 1017 | // cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; |
1014 | } | 1018 | } |
1015 | else | 1019 | else |
1016 | { | 1020 | { |
1017 | newitem->destination = p->getLocalPackage()->getInstalledTo(); | 1021 | newitem->destination = p->getLocalPackage()->getInstalledTo(); |
@@ -1061,98 +1065,101 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1061 | if ( stickyOption == "" ) | 1065 | if ( stickyOption == "" ) |
1062 | { | 1066 | { |
1063 | QString msgtext; | 1067 | QString msgtext; |
1064 | msgtext = caption.arg( ( const char * )name ); | 1068 | msgtext = caption.arg( ( const char * )name ); |
1065 | switch( QMessageBox::information( this, text, | 1069 | switch( QMessageBox::information( this, text, |
1066 | msgtext, tr( "Remove" ), secondButton ) ) | 1070 | msgtext, tr( "Remove" ), secondButton ) ) |
1067 | { | 1071 | { |
1068 | case 0: // Try again or Enter | 1072 | case 0: // Try again or Enter |
1069 | // option 0 = Remove | 1073 | // option 0 = Remove |
1070 | newitem->option = "D"; | 1074 | newitem->option = "D"; |
1071 | break; | 1075 | break; |
1072 | case 1: // Quit or Escape | 1076 | case 1: // Quit or Escape |
1073 | newitem->option = secondOption; | 1077 | newitem->option = secondOption; |
1074 | break; | 1078 | break; |
1075 | } | 1079 | } |
1076 | } | 1080 | } |
1077 | else | 1081 | else |
1078 | { | 1082 | { |
1079 | // newitem->option = stickyOption; | 1083 | // newitem->option = stickyOption; |
1080 | } | 1084 | } |
1081 | } | 1085 | } |
1082 | 1086 | ||
1083 | 1087 | ||
1084 | // Check if we are reinstalling the same version | 1088 | // Check if we are reinstalling the same version |
1085 | if ( newitem->option != "R" ) | 1089 | if ( newitem->option != "R" ) |
1086 | newitem->recreateLinks = true; | 1090 | newitem->recreateLinks = true; |
1087 | else | 1091 | else |
1088 | newitem->recreateLinks = false; | 1092 | newitem->recreateLinks = false; |
1089 | 1093 | ||
1090 | // User hit cancel (on dlg - assume remove) | 1094 | // User hit cancel (on dlg - assume remove) |
1091 | return newitem; | 1095 | return newitem; |
1092 | } | 1096 | } |
1093 | } | 1097 | } |
1094 | 1098 | ||
1095 | void MainWindow :: reloadData( InstallDlgImpl *dlg ) | 1099 | void MainWindow :: reloadData( InstallDlgImpl *dlg ) |
1096 | { | 1100 | { |
1097 | stack->raiseWidget( progressWindow ); | 1101 | stack->raiseWidget( progressWindow ); |
1098 | 1102 | ||
1099 | if ( dlg ) | 1103 | if ( dlg ) |
1100 | { | 1104 | { |
1101 | dlg->close(); | 1105 | dlg->close(); |
1102 | delete dlg; | 1106 | delete dlg; |
1103 | } | 1107 | } |
1104 | 1108 | ||
1105 | mgr->reloadServerData(); | 1109 | mgr->reloadServerData(); |
1106 | serverSelected( -1, FALSE ); | 1110 | serverSelected( -1, FALSE ); |
1107 | 1111 | ||
1108 | #ifdef QWS | 1112 | #ifdef QWS |
1109 | m_status->setText( tr( "Updating Launcher..." ) ); | 1113 | if ( reloadDocuments ) |
1110 | 1114 | { | |
1111 | // Finally let the main system update itself | 1115 | m_status->setText( tr( "Updating Launcher..." ) ); |
1112 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 1116 | |
1113 | QString lf = QString::null; | 1117 | // Finally let the main system update itself |
1114 | e << lf; | 1118 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
1119 | QString lf = QString::null; | ||
1120 | e << lf; | ||
1121 | } | ||
1115 | #endif | 1122 | #endif |
1116 | 1123 | ||
1117 | stack->raiseWidget( networkPkgWindow ); | 1124 | stack->raiseWidget( networkPkgWindow ); |
1118 | } | 1125 | } |
1119 | 1126 | ||
1120 | void MainWindow :: letterPushed( QString t ) | 1127 | void MainWindow :: letterPushed( QString t ) |
1121 | { | 1128 | { |
1122 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); | 1129 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); |
1123 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 1130 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
1124 | if ( packagesList->firstChild() == 0 ) | 1131 | if ( packagesList->firstChild() == 0 ) |
1125 | return; | 1132 | return; |
1126 | 1133 | ||
1127 | QCheckListItem *item; | 1134 | QCheckListItem *item; |
1128 | if ( start == 0 ) | 1135 | if ( start == 0 ) |
1129 | { | 1136 | { |
1130 | item = (QCheckListItem *)packagesList->firstChild(); | 1137 | item = (QCheckListItem *)packagesList->firstChild(); |
1131 | start = top; | 1138 | start = top; |
1132 | } | 1139 | } |
1133 | else | 1140 | else |
1134 | item = (QCheckListItem *)start->nextSibling(); | 1141 | item = (QCheckListItem *)start->nextSibling(); |
1135 | 1142 | ||
1136 | if ( item == 0 ) | 1143 | if ( item == 0 ) |
1137 | item = (QCheckListItem *)packagesList->firstChild(); | 1144 | item = (QCheckListItem *)packagesList->firstChild(); |
1138 | do | 1145 | do |
1139 | { | 1146 | { |
1140 | if ( item->text().lower().startsWith( t.lower() ) ) | 1147 | if ( item->text().lower().startsWith( t.lower() ) ) |
1141 | { | 1148 | { |
1142 | packagesList->setSelected( item, true ); | 1149 | packagesList->setSelected( item, true ); |
1143 | packagesList->ensureItemVisible( item ); | 1150 | packagesList->ensureItemVisible( item ); |
1144 | break; | 1151 | break; |
1145 | } | 1152 | } |
1146 | 1153 | ||
1147 | item = (QCheckListItem *)item->nextSibling(); | 1154 | item = (QCheckListItem *)item->nextSibling(); |
1148 | if ( !item ) | 1155 | if ( !item ) |
1149 | item = (QCheckListItem *)packagesList->firstChild(); | 1156 | item = (QCheckListItem *)packagesList->firstChild(); |
1150 | } while ( item != start); | 1157 | } while ( item != start); |
1151 | } | 1158 | } |
1152 | 1159 | ||
1153 | void MainWindow :: slotDisplayPackage( QListViewItem *item ) | 1160 | void MainWindow :: slotDisplayPackage( QListViewItem *item ) |
1154 | { | 1161 | { |
1155 | QString itemstr( ((QCheckListItem*)item)->text() ); | 1162 | QString itemstr( ((QCheckListItem*)item)->text() ); |
1156 | PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); | 1163 | PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); |
1157 | p->showMaximized(); | 1164 | p->showMaximized(); |
1158 | } | 1165 | } |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index c4548b1..f95c332 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -43,96 +43,97 @@ public: | |||
43 | 43 | ||
44 | MainWindow(); | 44 | MainWindow(); |
45 | ~MainWindow(); | 45 | ~MainWindow(); |
46 | 46 | ||
47 | protected: | 47 | protected: |
48 | void closeEvent( QCloseEvent* e ); | 48 | void closeEvent( QCloseEvent* e ); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | DataManager *mgr; | 51 | DataManager *mgr; |
52 | 52 | ||
53 | QWidgetStack *stack; | 53 | QWidgetStack *stack; |
54 | 54 | ||
55 | QToolBar *findBar; | 55 | QToolBar *findBar; |
56 | QToolBar *jumpBar; | 56 | QToolBar *jumpBar; |
57 | QLineEdit *findEdit; | 57 | QLineEdit *findEdit; |
58 | QAction *actionFindNext; | 58 | QAction *actionFindNext; |
59 | QAction *actionFilter; | 59 | QAction *actionFilter; |
60 | QAction *actionUpgrade; | 60 | QAction *actionUpgrade; |
61 | QAction *actionDownload; | 61 | QAction *actionDownload; |
62 | QAction *actionUninstalled; | 62 | QAction *actionUninstalled; |
63 | QAction *actionInstalled; | 63 | QAction *actionInstalled; |
64 | QAction *actionUpdated; | 64 | QAction *actionUpdated; |
65 | 65 | ||
66 | QPixmap iconDownload; | 66 | QPixmap iconDownload; |
67 | QPixmap iconRemove; | 67 | QPixmap iconRemove; |
68 | 68 | ||
69 | int mnuShowUninstalledPkgsId; | 69 | int mnuShowUninstalledPkgsId; |
70 | int mnuShowInstalledPkgsId; | 70 | int mnuShowInstalledPkgsId; |
71 | int mnuShowUpgradedPkgsId; | 71 | int mnuShowUpgradedPkgsId; |
72 | int mnuFilterByCategory; | 72 | int mnuFilterByCategory; |
73 | int mnuSetFilterCategory; | 73 | int mnuSetFilterCategory; |
74 | 74 | ||
75 | // Main package list widget | 75 | // Main package list widget |
76 | QWidget *networkPkgWindow; | 76 | QWidget *networkPkgWindow; |
77 | QComboBox *serversList; | 77 | QComboBox *serversList; |
78 | QListView *packagesList; | 78 | QListView *packagesList; |
79 | QPixmap installedIcon; | 79 | QPixmap installedIcon; |
80 | QPixmap updatedIcon; | 80 | QPixmap updatedIcon; |
81 | QString currentlySelectedServer; | 81 | QString currentlySelectedServer; |
82 | QString categoryFilter; | 82 | QString categoryFilter; |
83 | QString stickyOption; | 83 | QString stickyOption; |
84 | 84 | ||
85 | bool categoryFilterEnabled; | 85 | bool categoryFilterEnabled; |
86 | bool showJumpTo; | 86 | bool showJumpTo; |
87 | bool showUninstalledPkgs; | 87 | bool showUninstalledPkgs; |
88 | bool showInstalledPkgs; | 88 | bool showInstalledPkgs; |
89 | bool showUpgradedPkgs; | 89 | bool showUpgradedPkgs; |
90 | bool downloadEnabled; | 90 | bool downloadEnabled; |
91 | bool reloadDocuments; | ||
91 | 92 | ||
92 | void initMainWidget(); | 93 | void initMainWidget(); |
93 | void updateData(); | 94 | void updateData(); |
94 | void serverSelected( int index, bool showProgress ); | 95 | void serverSelected( int index, bool showProgress ); |
95 | void searchForPackage( const QString & ); | 96 | void searchForPackage( const QString & ); |
96 | bool filterByCategory( bool val ); | 97 | bool filterByCategory( bool val ); |
97 | void downloadSelectedPackages(); | 98 | void downloadSelectedPackages(); |
98 | void downloadRemotePackage(); | 99 | void downloadRemotePackage(); |
99 | InstallData *dealWithItem( QCheckListItem *item ); | 100 | InstallData *dealWithItem( QCheckListItem *item ); |
100 | 101 | ||
101 | // Progress widget | 102 | // Progress widget |
102 | QWidget *progressWindow; | 103 | QWidget *progressWindow; |
103 | QLabel *m_status; | 104 | QLabel *m_status; |
104 | QProgressBar *m_progress; | 105 | QProgressBar *m_progress; |
105 | 106 | ||
106 | void initProgressWidget(); | 107 | void initProgressWidget(); |
107 | 108 | ||
108 | public slots: | 109 | public slots: |
109 | void setDocument( const QString &doc ); | 110 | void setDocument( const QString &doc ); |
110 | void displayFindBar(); | 111 | void displayFindBar(); |
111 | void displayJumpBar(); | 112 | void displayJumpBar(); |
112 | void repeatFind(); | 113 | void repeatFind(); |
113 | void findPackage( const QString & ); | 114 | void findPackage( const QString & ); |
114 | void hideFindBar(); | 115 | void hideFindBar(); |
115 | void hideJumpBar(); | 116 | void hideJumpBar(); |
116 | void displaySettings(); | 117 | void displaySettings(); |
117 | void filterUninstalledPackages(); | 118 | void filterUninstalledPackages(); |
118 | void filterInstalledPackages(); | 119 | void filterInstalledPackages(); |
119 | void filterUpgradedPackages(); | 120 | void filterUpgradedPackages(); |
120 | void filterCategory(); | 121 | void filterCategory(); |
121 | bool setFilterCategory(); | 122 | bool setFilterCategory(); |
122 | void raiseMainWidget(); | 123 | void raiseMainWidget(); |
123 | void raiseProgressWidget(); | 124 | void raiseProgressWidget(); |
124 | void enableUpgrade( bool ); | 125 | void enableUpgrade( bool ); |
125 | void enableDownload( bool ); | 126 | void enableDownload( bool ); |
126 | void reloadData( InstallDlgImpl * ); | 127 | void reloadData( InstallDlgImpl * ); |
127 | 128 | ||
128 | private slots: | 129 | private slots: |
129 | void init(); | 130 | void init(); |
130 | void setProgressSteps( int ); | 131 | void setProgressSteps( int ); |
131 | void setProgressMessage( const QString & ); | 132 | void setProgressMessage( const QString & ); |
132 | void updateProgress( int ); | 133 | void updateProgress( int ); |
133 | void serverSelected( int index ); | 134 | void serverSelected( int index ); |
134 | void updateServer(); | 135 | void updateServer(); |
135 | void upgradePackages(); | 136 | void upgradePackages(); |
136 | void downloadPackage(); | 137 | void downloadPackage(); |
137 | void applyChanges(); | 138 | void applyChanges(); |
138 | void letterPushed( QString t ); | 139 | void letterPushed( QString t ); |