summaryrefslogtreecommitdiff
authordrw <drw>2003-04-26 23:11:13 (UTC)
committer drw <drw>2003-04-26 23:11:13 (UTC)
commit77bed0e99aa0c912e5d86f257131c1f93afcee77 (patch) (unidiff)
treec9ecc864e802a395c066bfb7d345e16dc1fc0968
parent98a9291263e167b8882ac916330e7215ebd884b4 (diff)
downloadopie-77bed0e99aa0c912e5d86f257131c1f93afcee77.zip
opie-77bed0e99aa0c912e5d86f257131c1f93afcee77.tar.gz
opie-77bed0e99aa0c912e5d86f257131c1f93afcee77.tar.bz2
Fix for bug #887 - do not perform documents update when doing a 'ipkg update'
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp19
-rw-r--r--noncore/settings/aqpkg/mainwin.h1
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
@@ -735,78 +735,80 @@ void MainWindow :: searchForPackage( const QString &text )
735 break; 735 break;
736 } 736 }
737 } 737 }
738 } 738 }
739} 739}
740 740
741void MainWindow :: updateServer() 741void 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
765void MainWindow :: upgradePackages() 766void 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
794void MainWindow :: downloadPackage() 796void 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
@@ -907,87 +909,89 @@ void MainWindow :: downloadSelectedPackages()
907 909
908void MainWindow :: downloadRemotePackage() 910void 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
936void MainWindow :: applyChanges() 939void 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
979InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) 983InstallData *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() )
@@ -1085,54 +1089,57 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
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
1095void MainWindow :: reloadData( InstallDlgImpl *dlg ) 1099void 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
1120void MainWindow :: letterPushed( QString t ) 1127void 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
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
@@ -67,48 +67,49 @@ private:
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
108public slots: 109public 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();