summaryrefslogtreecommitdiff
authorandyq <andyq>2002-10-22 18:00:55 (UTC)
committer andyq <andyq>2002-10-22 18:00:55 (UTC)
commitd7cca919f20d602bd755b7690c25e31f6e9520b1 (patch) (unidiff)
treeb5ffe24d905ace7563c21be0eea06b39402430aa
parent6843a1bd8f8e679c220431f8377abcd2ffd2019b (diff)
downloadopie-d7cca919f20d602bd755b7690c25e31f6e9520b1.zip
opie-d7cca919f20d602bd755b7690c25e31f6e9520b1.tar.gz
opie-d7cca919f20d602bd755b7690c25e31f6e9520b1.tar.bz2
Changed so that refreshing server packages shows status dialog
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp58
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h4
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp5
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp23
4 files changed, 46 insertions, 44 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index e122064..a924daf 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -96,18 +96,15 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
96 } 96 }
97 } 97 }
98 98
99 output->setText( remove + install + upgrade ); 99 output->setText( remove + install + upgrade );
100
101 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
102} 100}
103 101
104InstallDlgImpl::InstallDlgImpl( QWidget *parent, const char *name, bool modal, WFlags fl ) 102InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl )
105 : InstallDlg( parent, name, modal, fl ) 103 : InstallDlg( parent, name, modal, fl )
106{ 104{
107 upgradePackages = true; 105 pIpkg = ipkg;
108 output->setText( "Upgrading installed packages" ); 106 output->setText( initialText );
109 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
110} 107}
111 108
112 109
113InstallDlgImpl::~InstallDlgImpl() 110InstallDlgImpl::~InstallDlgImpl()
@@ -154,16 +151,14 @@ void InstallDlgImpl :: installSelected()
154 } 151 }
155 152
156 btnInstall->setEnabled( false ); 153 btnInstall->setEnabled( false );
157 154
158 if ( upgradePackages ) 155 if ( pIpkg )
159 { 156 {
160 output->setText( "" ); 157 output->setText( "" );
161 158
162 Ipkg ipkg; 159 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
163 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 160 pIpkg->runIpkg();
164 ipkg.setOption( "upgrade" );
165 ipkg.runIpkg();
166 } 161 }
167 else 162 else
168 { 163 {
169 output->setText( "" ); 164 output->setText( "" );
@@ -180,49 +175,54 @@ void InstallDlgImpl :: installSelected()
180 cfg.setGroup( "settings" ); 175 cfg.setGroup( "settings" );
181 cfg.writeEntry( "dest", dest ); 176 cfg.writeEntry( "dest", dest );
182#endif 177#endif
183 178
179 pIpkg = new Ipkg;
180 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
181
184 // First run through the remove list, then the install list then the upgrade list 182 // First run through the remove list, then the install list then the upgrade list
185 vector<InstallData>::iterator it; 183 vector<InstallData>::iterator it;
186 ipkg.setOption( "remove" ); 184 pIpkg->setOption( "remove" );
187 for ( it = removeList.begin() ; it != removeList.end() ; ++it ) 185 for ( it = removeList.begin() ; it != removeList.end() ; ++it )
188 { 186 {
189 ipkg.setDestination( it->destination->getDestinationName() ); 187 pIpkg->setDestination( it->destination->getDestinationName() );
190 ipkg.setDestinationDir( it->destination->getDestinationPath() ); 188 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
191 ipkg.setPackage( it->packageName ); 189 pIpkg->setPackage( it->packageName );
192 190
193 int tmpFlags = flags; 191 int tmpFlags = flags;
194 if ( it->destination->linkToRoot() ) 192 if ( it->destination->linkToRoot() )
195 tmpFlags |= MAKE_LINKS; 193 tmpFlags |= MAKE_LINKS;
196 194
197 ipkg.setFlags( tmpFlags ); 195 pIpkg->setFlags( tmpFlags );
198 ipkg.runIpkg(); 196 pIpkg->runIpkg();
199 } 197 }
200 198
201 ipkg.setOption( "install" ); 199 pIpkg->setOption( "install" );
202 ipkg.setDestination( dest ); 200 pIpkg->setDestination( dest );
203 ipkg.setDestinationDir( destDir ); 201 pIpkg->setDestinationDir( destDir );
204 ipkg.setFlags( instFlags ); 202 pIpkg->setFlags( instFlags );
205 for ( it = installList.begin() ; it != installList.end() ; ++it ) 203 for ( it = installList.begin() ; it != installList.end() ; ++it )
206 { 204 {
207 ipkg.setPackage( it->packageName ); 205 pIpkg->setPackage( it->packageName );
208 ipkg.runIpkg(); 206 pIpkg->runIpkg();
209 } 207 }
210 208
211 flags |= FORCE_REINSTALL; 209 flags |= FORCE_REINSTALL;
212 ipkg.setOption( "reinstall" ); 210 pIpkg->setOption( "reinstall" );
213 for ( it = updateList.begin() ; it != updateList.end() ; ++it ) 211 for ( it = updateList.begin() ; it != updateList.end() ; ++it )
214 { 212 {
215 ipkg.setDestination( it->destination->getDestinationName() ); 213 pIpkg->setDestination( it->destination->getDestinationName() );
216 ipkg.setDestinationDir( it->destination->getDestinationPath() ); 214 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
217 ipkg.setPackage( it->packageName ); 215 pIpkg->setPackage( it->packageName );
218 216
219 int tmpFlags = flags; 217 int tmpFlags = flags;
220 if ( it->destination->linkToRoot() && it->recreateLinks ) 218 if ( it->destination->linkToRoot() && it->recreateLinks )
221 tmpFlags |= MAKE_LINKS; 219 tmpFlags |= MAKE_LINKS;
222 ipkg.setFlags( tmpFlags ); 220 pIpkg->setFlags( tmpFlags );
223 ipkg.runIpkg(); 221 pIpkg->runIpkg();
224 } 222 }
223
224 delete pIpkg;
225 } 225 }
226 226
227 btnInstall->setEnabled( true ); 227 btnInstall->setEnabled( true );
228 btnInstall->setText( tr( "Close" ) ); 228 btnInstall->setText( tr( "Close" ) );
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h
index 3a5d8b8..6716ced 100644
--- a/noncore/settings/aqpkg/installdlgimpl.h
+++ b/noncore/settings/aqpkg/installdlgimpl.h
@@ -37,9 +37,9 @@ public:
37class InstallDlgImpl : public InstallDlg 37class InstallDlgImpl : public InstallDlg
38{ 38{
39public: 39public:
40 InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); 40 InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
41 InstallDlgImpl( QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); 41 InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
42 ~InstallDlgImpl(); 42 ~InstallDlgImpl();
43 43
44 bool showDlg(); 44 bool showDlg();
45 bool upgradeServer( QString &server ); 45 bool upgradeServer( QString &server );
@@ -51,9 +51,9 @@ private:
51 vector<InstallData> installList; 51 vector<InstallData> installList;
52 vector<InstallData> removeList; 52 vector<InstallData> removeList;
53 vector<InstallData> updateList; 53 vector<InstallData> updateList;
54 int flags; 54 int flags;
55 Ipkg ipkg; 55 Ipkg *pIpkg;
56 bool upgradePackages; 56 bool upgradePackages;
57 57
58 bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); 58 bool runIpkg( QString &option, const QString& package, const QString& dest, int flags );
59 59
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 02d4258..eacef76 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -104,10 +104,11 @@ bool Ipkg :: runIpkg( )
104 if ( option != "upgrade" ) 104 if ( option != "upgrade" )
105 cmd += " " + package; 105 cmd += " " + package;
106 cmd += " 2>&1"; 106 cmd += " 2>&1";
107 107
108 108
109 emit outputText( QString( "Dealing with package " ) + package ); 109 if ( package != "" )
110 emit outputText( QString( "Dealing with package " ) + package );
110 111
111 qApp->processEvents(); 112 qApp->processEvents();
112 113
113 // If we are removing packages and make links option is selected 114 // If we are removing packages and make links option is selected
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 52d95a8..6874ded 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -267,30 +267,28 @@ void NetworkPackageManager :: updateServer()
267 QString serverName = serversList->currentText(); 267 QString serverName = serversList->currentText();
268 268
269 // Update the current server 269 // Update the current server
270 // Display dialog 270 // Display dialog
271 ProgressDlg *dlg = new ProgressDlg( this ); 271// ProgressDlg *progDlg = new ProgressDlg( this );
272 QString status = "Updating package lists..."; 272// QString status = "Updating package lists...";
273 dlg->show(); 273// progDlg->show();
274 dlg->setText( status ); 274// progDlg->setText( status );
275 275
276 // Disable buttons to stop silly people clicking lots on them :) 276 // Disable buttons to stop silly people clicking lots on them :)
277 277
278 // First, write out ipkg_conf file so that ipkg can use it 278 // First, write out ipkg_conf file so that ipkg can use it
279 dataMgr->writeOutIpkgConf(); 279 dataMgr->writeOutIpkgConf();
280 280
281 QString option = "update";
282 QString dummy = "";
283 Ipkg ipkg; 281 Ipkg ipkg;
284 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 282 ipkg.setOption( "update" );
285 ipkg.setOption( option );
286 283
287 ipkg.runIpkg( ); 284 InstallDlgImpl dlg( &ipkg, "Refreshing server package lists", this, "Upgrade", true );
285 dlg.showDlg();
288 286
289 // Reload data 287 // Reload data
290 dataMgr->reloadServerData( serversList->currentText() ); 288 dataMgr->reloadServerData( serversList->currentText() );
291 serverSelected(-1); 289 serverSelected(-1);
292 delete dlg; 290// delete progDlg;
293} 291}
294 292
295void NetworkPackageManager :: upgradePackages() 293void NetworkPackageManager :: upgradePackages()
296{ 294{
@@ -308,9 +306,12 @@ void NetworkPackageManager :: upgradePackages()
308 // First, write out ipkg_conf file so that ipkg can use it 306 // First, write out ipkg_conf file so that ipkg can use it
309 dataMgr->writeOutIpkgConf(); 307 dataMgr->writeOutIpkgConf();
310 308
311 // Now run upgrade 309 // Now run upgrade
312 InstallDlgImpl dlg( this, "Upgrade", true ); 310 Ipkg ipkg;
311 ipkg.setOption( "upgrade" );
312
313 InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true );
313 dlg.showDlg(); 314 dlg.showDlg();
314 315
315 // Reload data 316 // Reload data
316 dataMgr->reloadServerData( LOCAL_SERVER ); 317 dataMgr->reloadServerData( LOCAL_SERVER );