summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/installdlgimpl.cpp
authordrw <drw>2003-02-06 01:19:25 (UTC)
committer drw <drw>2003-02-06 01:19:25 (UTC)
commit79588befde53765db0a92977c6890a4d226096e7 (patch) (unidiff)
tree83b6dd14c49733b9759fad04147bf0bee50793fe /noncore/settings/aqpkg/installdlgimpl.cpp
parentbbb3690f12191763a407e6a0edd521113b3c25ac (diff)
downloadopie-79588befde53765db0a92977c6890a4d226096e7.zip
opie-79588befde53765db0a92977c6890a4d226096e7.tar.gz
opie-79588befde53765db0a92977c6890a4d226096e7.tar.bz2
Change all vector<> to QList<>. First step in removing dependency on libstdc++.
Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp84
1 files changed, 47 insertions, 37 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index 19fe46a..9339086 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -41,7 +41,7 @@
41#include "utils.h" 41#include "utils.h"
42#include "global.h" 42#include "global.h"
43 43
44InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title ) 44InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title )
45 : QWidget( 0, 0, 0 ) 45 : QWidget( 0, 0, 0 )
46{ 46{
47 setCaption( title ); 47 setCaption( title );
@@ -50,7 +50,6 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
50 pIpkg = 0; 50 pIpkg = 0;
51 upgradePackages = false; 51 upgradePackages = false;
52 dataMgr = dataManager; 52 dataMgr = dataManager;
53 vector<Destination>::iterator dit;
54 53
55 QString defaultDest = "root"; 54 QString defaultDest = "root";
56#ifdef QWS 55#ifdef QWS
@@ -74,45 +73,52 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
74 // setup destination data 73 // setup destination data
75 int defIndex = 0; 74 int defIndex = 0;
76 int i; 75 int i;
77 for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) 76 QListIterator<Destination> dit( dataMgr->getDestinationList() );
77 for ( i = 0; dit.current(); ++dit, ++i )
78 { 78 {
79 destination->insertItem( dit->getDestinationName() ); 79 destination->insertItem( dit.current()->getDestinationName() );
80 if ( dit->getDestinationName() == defaultDest ) 80 if ( dit.current()->getDestinationName() == defaultDest )
81 defIndex = i; 81 defIndex = i;
82 } 82 }
83 83
84 destination->setCurrentItem( defIndex ); 84 destination->setCurrentItem( defIndex );
85 85
86 vector<InstallData>::iterator it; 86 QListIterator<InstallData> it( packageList );
87 // setup package data 87 // setup package data
88 QString remove = tr( "Remove\n" ); 88 QString remove = tr( "Remove\n" );
89 QString install = tr( "Install\n" ); 89 QString install = tr( "Install\n" );
90 QString upgrade = tr( "Upgrade\n" ); 90 QString upgrade = tr( "Upgrade\n" );
91 for ( it = packageList.begin() ; it != packageList.end() ; ++it ) 91 for ( ; it.current(); ++it )
92 { 92 {
93 InstallData item = *it; 93 InstallData *item = it.current();
94 if ( item.option == "I" ) 94 InstallData *newitem = new InstallData();
95
96 newitem->option = item->option;
97 newitem->packageName = item->packageName;
98 newitem->destination = item->destination;
99 newitem->recreateLinks = item->recreateLinks;
100
101 if ( item->option == "I" )
95 { 102 {
96 installList.push_back( item ); 103 installList.append( newitem );
97 install.append( QString( " %1\n" ).arg( item.packageName ) ); 104 install.append( QString( " %1\n" ).arg( item->packageName ) );
98 } 105 }
99 else if ( item.option == "D" ) 106 else if ( item->option == "D" )
100 { 107 {
101 removeList.push_back( item ); 108 removeList.append( newitem );
102 remove.append( QString( " %1\n" ).arg( item.packageName ) ); 109 remove.append( QString( " %1\n" ).arg( item->packageName ) );
103 } 110 }
104 else if ( item.option == "U" || item.option == "R" ) 111 else if ( item->option == "U" || item->option == "R" )
105 { 112 {
106 updateList.push_back( item ); 113 updateList.append( newitem );
107 QString type; 114 QString type;
108 if ( item.option == "R" ) 115 if ( item->option == "R" )
109 type = tr( "(ReInstall)" ); 116 type = tr( "(ReInstall)" );
110 else 117 else
111 type = tr( "(Upgrade)" ); 118 type = tr( "(Upgrade)" );
112 upgrade.append( QString( " %1 %2\n" ).arg( item.packageName ).arg( type ) ); 119 upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) );
113 } 120 }
114 } 121 }
115
116 output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); 122 output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) );
117 123
118 displayAvailableSpace( destination->currentText() ); 124 displayAvailableSpace( destination->currentText() );
@@ -213,7 +219,7 @@ void InstallDlgImpl :: installSelected()
213 emit reloadData( this ); 219 emit reloadData( this );
214 return; 220 return;
215 } 221 }
216 222
217 // Disable buttons 223 // Disable buttons
218 btnOptions->setEnabled( false ); 224 btnOptions->setEnabled( false );
219// btnInstall->setEnabled( false ); 225// btnInstall->setEnabled( false );
@@ -229,7 +235,7 @@ void InstallDlgImpl :: installSelected()
229 else 235 else
230 { 236 {
231 output->setText( "" ); 237 output->setText( "" );
232 vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() ); 238 Destination *d = dataMgr->getDestination( destination->currentText() );
233 QString dest = d->getDestinationName(); 239 QString dest = d->getDestinationName();
234 QString destDir = d->getDestinationPath(); 240 QString destDir = d->getDestinationPath();
235 int instFlags = flags; 241 int instFlags = flags;
@@ -247,16 +253,18 @@ void InstallDlgImpl :: installSelected()
247 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 253 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
248 254
249 // First run through the remove list, then the install list then the upgrade list 255 // First run through the remove list, then the install list then the upgrade list
250 vector<InstallData>::iterator it;
251 pIpkg->setOption( "remove" ); 256 pIpkg->setOption( "remove" );
252 for ( it = removeList.begin() ; it != removeList.end() ; ++it ) 257 QListIterator<InstallData> it( removeList );
258 InstallData *idata;
259 for ( ; it.current(); ++it )
253 { 260 {
254 pIpkg->setDestination( it->destination->getDestinationName() ); 261 idata = it.current();
255 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 262 pIpkg->setDestination( idata->destination->getDestinationName() );
256 pIpkg->setPackage( it->packageName ); 263 pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
264 pIpkg->setPackage( idata->packageName );
257 265
258 int tmpFlags = flags; 266 int tmpFlags = flags;
259 if ( it->destination->linkToRoot() ) 267 if ( idata->destination->linkToRoot() )
260 tmpFlags |= MAKE_LINKS; 268 tmpFlags |= MAKE_LINKS;
261 269
262 pIpkg->setFlags( tmpFlags ); 270 pIpkg->setFlags( tmpFlags );
@@ -267,25 +275,28 @@ void InstallDlgImpl :: installSelected()
267 pIpkg->setDestination( dest ); 275 pIpkg->setDestination( dest );
268 pIpkg->setDestinationDir( destDir ); 276 pIpkg->setDestinationDir( destDir );
269 pIpkg->setFlags( instFlags ); 277 pIpkg->setFlags( instFlags );
270 for ( it = installList.begin() ; it != installList.end() ; ++it ) 278 QListIterator<InstallData> it2( installList );
279 for ( ; it2.current(); ++it2 )
271 { 280 {
272 pIpkg->setPackage( it->packageName ); 281 pIpkg->setPackage( it2.current()->packageName );
273 pIpkg->runIpkg(); 282 pIpkg->runIpkg();
274 } 283 }
275 284
276 flags |= FORCE_REINSTALL; 285 flags |= FORCE_REINSTALL;
277 for ( it = updateList.begin() ; it != updateList.end() ; ++it ) 286 QListIterator<InstallData> it3( updateList );
287 for ( ; it3.current() ; ++it3 )
278 { 288 {
279 if ( it->option == "R" ) 289 idata = it3.current();
290 if ( idata->option == "R" )
280 pIpkg->setOption( "reinstall" ); 291 pIpkg->setOption( "reinstall" );
281 else 292 else
282 pIpkg->setOption( "upgrade" ); 293 pIpkg->setOption( "upgrade" );
283 pIpkg->setDestination( it->destination->getDestinationName() ); 294 pIpkg->setDestination( idata->destination->getDestinationName() );
284 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 295 pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
285 pIpkg->setPackage( it->packageName ); 296 pIpkg->setPackage( idata->packageName );
286 297
287 int tmpFlags = flags; 298 int tmpFlags = flags;
288 if ( it->destination->linkToRoot() && it->recreateLinks ) 299 if ( idata->destination->linkToRoot() && idata->recreateLinks )
289 tmpFlags |= MAKE_LINKS; 300 tmpFlags |= MAKE_LINKS;
290 pIpkg->setFlags( tmpFlags ); 301 pIpkg->setFlags( tmpFlags );
291 pIpkg->runIpkg(); 302 pIpkg->runIpkg();
@@ -307,7 +318,6 @@ void InstallDlgImpl :: installSelected()
307 318
308void InstallDlgImpl :: displayText(const QString &text ) 319void InstallDlgImpl :: displayText(const QString &text )
309{ 320{
310 //output->setText( QString( "%1\n%2" ).arg( output->text() ).arg( text ) );
311 QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); 321 QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text );
312 output->setText( newtext ); 322 output->setText( newtext );
313 output->setCursorPosition( output->numLines(), 0 ); 323 output->setCursorPosition( output->numLines(), 0 );
@@ -316,7 +326,7 @@ void InstallDlgImpl :: displayText(const QString &text )
316 326
317void InstallDlgImpl :: displayAvailableSpace( const QString &text ) 327void InstallDlgImpl :: displayAvailableSpace( const QString &text )
318{ 328{
319 vector<Destination>::iterator d = dataMgr->getDestination( text ); 329 Destination *d = dataMgr->getDestination( text );
320 QString destDir = d->getDestinationPath(); 330 QString destDir = d->getDestinationPath();
321 331
322 long blockSize = 0; 332 long blockSize = 0;