summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/installdlgimpl.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp82
1 files changed, 46 insertions, 36 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
@@ -43,3 +43,3 @@
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 )
@@ -52,3 +52,2 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
52 dataMgr = dataManager; 52 dataMgr = dataManager;
53 vector<Destination>::iterator dit;
54 53
@@ -76,6 +75,7 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
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;
@@ -85,3 +85,3 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
85 85
86 vector<InstallData>::iterator it; 86 QListIterator<InstallData> it( packageList );
87 // setup package data 87 // setup package data
@@ -90,20 +90,27 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
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)" );
@@ -111,6 +118,5 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
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 ) );
@@ -231,3 +237,3 @@ void InstallDlgImpl :: installSelected()
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();
@@ -249,12 +255,14 @@ void InstallDlgImpl :: installSelected()
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;
@@ -269,5 +277,6 @@ void InstallDlgImpl :: installSelected()
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();
@@ -276,5 +285,7 @@ void InstallDlgImpl :: installSelected()
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" );
@@ -282,8 +293,8 @@ void InstallDlgImpl :: installSelected()
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;
@@ -309,3 +320,2 @@ void 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 );
@@ -318,3 +328,3 @@ void 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();