summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp82
-rw-r--r--noncore/settings/aqpkg/datamgr.h15
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp84
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h12
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp143
-rw-r--r--noncore/settings/aqpkg/mainwin.h2
-rw-r--r--noncore/settings/aqpkg/server.cpp75
-rw-r--r--noncore/settings/aqpkg/server.h8
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp38
9 files changed, 245 insertions, 214 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index 2c83e28..79f36e1 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -39,2 +39,5 @@ DataManager::DataManager()
39 availableCategories = "#"; 39 availableCategories = "#";
40
41 serverList.setAutoDelete( TRUE );
42 destList.setAutoDelete( TRUE );
40} 43}
@@ -45,10 +48,7 @@ DataManager::~DataManager()
45 48
46vector<Server>::iterator DataManager :: getServer( const char *name ) 49Server *DataManager :: getServer( const char *name )
47{ 50{
48 vector<Server>::iterator it = serverList.begin(); 51 QListIterator<Server> it( serverList );
49 while ( it != serverList.end() ) 52 while ( it.current() && it.current()->getServerName() != name )
50 { 53 {
51 if ( it->getServerName() == name )
52 return it;
53
54 ++it; 54 ++it;
@@ -56,13 +56,10 @@ vector<Server>::iterator DataManager :: getServer( const char *name )
56 56
57 return serverList.end(); 57 return it.current();
58} 58}
59 59
60vector<Destination>::iterator DataManager :: getDestination( const char *name ) 60Destination *DataManager :: getDestination( const char *name )
61{ 61{
62 vector<Destination>::iterator it = destList.begin(); 62 QListIterator<Destination> it( destList );
63 while ( it != destList.end() ) 63 while ( it.current() && it.current()->getDestinationName() != name )
64 { 64 {
65 if ( it->getDestinationName() == name )
66 return it;
67
68 ++it; 65 ++it;
@@ -70,3 +67,3 @@ vector<Destination>::iterator DataManager :: getDestination( const char *name )
70 67
71 return destList.end(); 68 return it.current();
72} 69}
@@ -77,4 +74,4 @@ void DataManager :: loadServers()
77 // the local config (which packages are installed) 74 // the local config (which packages are installed)
78 serverList.push_back( Server( LOCAL_SERVER, "" ) ); 75 serverList.append( new Server( LOCAL_SERVER, "" ) );
79 serverList.push_back( Server( LOCAL_IPKGS, "" ) ); 76 serverList.append( new Server( LOCAL_IPKGS, "" ) );
80 77
@@ -111,9 +108,9 @@ void DataManager :: loadServers()
111 sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); 108 sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url );
112 Server s( alias, url ); 109 Server *s = new Server( alias, url );
113 if ( lineStr.startsWith( "src" ) ) 110 if ( lineStr.startsWith( "src" ) )
114 s.setActive( true ); 111 s->setActive( true );
115 else 112 else
116 s.setActive( false ); 113 s->setActive( false );
117 114
118 serverList.push_back( s ); 115 serverList.append( s );
119 116
@@ -125,3 +122,3 @@ void DataManager :: loadServers()
125 sscanf( lineStr, "%*[^ ] %s %s", alias, path ); 122 sscanf( lineStr, "%*[^ ] %s %s", alias, path );
126 Destination d( alias, path ); 123 Destination *d = new Destination( alias, path );
127 bool linkToRoot = true; 124 bool linkToRoot = true;
@@ -132,5 +129,5 @@ void DataManager :: loadServers()
132#endif 129#endif
133 d.linkToRoot( linkToRoot ); 130 d->linkToRoot( linkToRoot );
134 131
135 destList.push_back( d ); 132 destList.append( d );
136 } 133 }
@@ -171,11 +168,14 @@ void DataManager :: reloadServerData( )
171{ 168{
172 emit progressSetSteps( serverList.size() ); 169 emit progressSetSteps( serverList.count() );
173 emit progressSetMessage( tr( "Reading configuration..." ) ); 170 emit progressSetMessage( tr( "Reading configuration..." ) );
174 171
175 vector<Server>::iterator it = serverList.begin();
176 QString serverName; 172 QString serverName;
177 int i = 0; 173 int i = 0;
178 for ( it = serverList.begin() ; it != serverList.end() ; ++it ) 174
175 Server *server;
176 QListIterator<Server> it( serverList );
177 for ( ; it.current(); ++it )
179 { 178 {
180 serverName = it->getServerName(); 179 server = it.current();
180 serverName = server->getServerName();
181 i++; 181 i++;
@@ -190,7 +190,7 @@ void DataManager :: reloadServerData( )
190 if ( serverName == LOCAL_SERVER ) 190 if ( serverName == LOCAL_SERVER )
191 it->readStatusFile( destList ); 191 server->readStatusFile( destList );
192 else if ( serverName == LOCAL_IPKGS ) 192 else if ( serverName == LOCAL_IPKGS )
193 it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) ); 193 server->readLocalIpks( getServer( LOCAL_SERVER ) );
194 else 194 else
195 it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) ); 195 server->readPackageFile( getServer( LOCAL_SERVER ) );
196 } 196 }
@@ -219,6 +219,8 @@ void DataManager :: writeOutIpkgConf()
219 // Write out servers 219 // Write out servers
220 vector<Server>::iterator it = serverList.begin(); 220 Server *server;
221 while ( it != serverList.end() ) 221 QListIterator<Server> it( serverList );
222 while ( it.current() )
222 { 223 {
223 QString alias = it->getServerName(); 224 server = it.current();
225 QString alias = server->getServerName();
224 // Don't write out local as its a dummy 226 // Don't write out local as its a dummy
@@ -226,5 +228,5 @@ void DataManager :: writeOutIpkgConf()
226 { 228 {
227 QString url = it->getServerUrl();; 229 QString url = server->getServerUrl();;
228 230
229 if ( !it->isServerActive() ) 231 if ( !server->isServerActive() )
230 out << "#"; 232 out << "#";
@@ -233,3 +235,3 @@ void DataManager :: writeOutIpkgConf()
233 235
234 it++; 236 ++it;
235 } 237 }
@@ -239,7 +241,7 @@ void DataManager :: writeOutIpkgConf()
239 // Write out destinations 241 // Write out destinations
240 vector<Destination>::iterator it2 = destList.begin(); 242 QListIterator<Destination> it2( destList );
241 while ( it2 != destList.end() ) 243 while ( it2.current() )
242 { 244 {
243 out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl; 245 out << "dest " << it2.current()->getDestinationName() << " " << it2.current()->getDestinationPath() << endl;
244 it2++; 246 ++it2;
245 } 247 }
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h
index 90328ab..7fa42c1 100644
--- a/noncore/settings/aqpkg/datamgr.h
+++ b/noncore/settings/aqpkg/datamgr.h
@@ -23,2 +23,3 @@ using namespace std;
23 23
24#include <qlist.h>
24#include <qobject.h> 25#include <qobject.h>
@@ -47,8 +48,8 @@ public:
47 48
48 Server *getLocalServer() { return &( *getServer( LOCAL_SERVER ) ); } 49 Server *getLocalServer() { return ( getServer( LOCAL_SERVER ) ); }
49 vector<Server> &getServerList() { return serverList; } 50 QList<Server> &getServerList() { return serverList; }
50 vector<Server>::iterator getServer( const char *name ); 51 Server *getServer( const char *name );
51 52
52 vector<Destination> &getDestinationList() { return destList; } 53 QList<Destination> &getDestinationList() { return destList; }
53 vector<Destination>::iterator getDestination( const char *name ); 54 Destination *getDestination( const char *name );
54 55
@@ -88,4 +89,4 @@ private:
88 89
89 vector<Server> serverList; 90 QList<Server> serverList;
90 vector<Destination> destList; 91 QList<Destination> destList;
91 92
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 ) );
@@ -215,3 +221,3 @@ void InstallDlgImpl :: installSelected()
215 } 221 }
216 222
217 // Disable buttons 223 // Disable buttons
@@ -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();
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h
index 4c9f087..d7509bb 100644
--- a/noncore/settings/aqpkg/installdlgimpl.h
+++ b/noncore/settings/aqpkg/installdlgimpl.h
@@ -19,7 +19,7 @@
19 19
20#include <vector>
21using namespace std; 20using namespace std;
22 21
23#include <qwidget.h> 22#include <qlist.h>
24#include <qstring.h> 23#include <qstring.h>
24#include <qwidget.h>
25 25
@@ -47,3 +47,3 @@ class InstallDlgImpl : public QWidget
47public: 47public:
48 InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ); 48 InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title = 0 );
49 InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ); 49 InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 );
@@ -57,5 +57,5 @@ private:
57 DataManager *dataMgr; 57 DataManager *dataMgr;
58 vector<InstallData> installList; 58 QList<InstallData> installList;
59 vector<InstallData> removeList; 59 QList<InstallData> removeList;
60 vector<InstallData> updateList; 60 QList<InstallData> updateList;
61 int flags; 61 int flags;
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 361946c..8ae5815 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -545,3 +545,3 @@ void MainWindow :: updateData()
545{ 545{
546 m_progress->setTotalSteps( mgr->getServerList().size() ); 546 m_progress->setTotalSteps( mgr->getServerList().count() );
547 547
@@ -550,9 +550,13 @@ void MainWindow :: updateData()
550 550
551 vector<Server>::iterator it;
552 int activeItem = -1; 551 int activeItem = -1;
553 int i; 552 int i = 0;
554 QString serverName; 553 QString serverName;
555 for ( i = 0, it = mgr->getServerList().begin() ; it != mgr->getServerList().end() ; ++it, ++i ) 554
555 QListIterator<Server> it( mgr->getServerList() );
556 Server *server;
557
558 for ( ; it.current(); ++it, ++i )
556 { 559 {
557 serverName = it->getServerName(); 560 server = it.current();
561 serverName = server->getServerName();
558 m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); 562 m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) );
@@ -562,3 +566,3 @@ void MainWindow :: updateData()
562// cout << "Adding " << it->getServerName() << " to combobox" << endl; 566// cout << "Adding " << it->getServerName() << " to combobox" << endl;
563 if ( !it->isServerActive() ) 567 if ( !server->isServerActive() )
564 { 568 {
@@ -594,9 +598,9 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
594 598
595 vector<Server>::iterator s = mgr->getServer( serverName ); 599 Server *s = mgr->getServer( serverName );
596 600
597 vector<Package> &list = s->getPackageList(); 601 QList<Package> &list = s->getPackageList();
598 vector<Package>::iterator it; 602 QListIterator<Package> it( list );
599 603
600 // Display progress widget while loading list 604 // Display progress widget while loading list
601 bool doProgress = ( list.size() > 200 ); 605 bool doProgress = ( list.count() > 200 );
602 if ( doProgress ) 606 if ( doProgress )
@@ -607,3 +611,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
607 } 611 }
608 m_progress->setTotalSteps( list.size() ); 612 m_progress->setTotalSteps( list.count() );
609 m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); 613 m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) );
@@ -621,3 +625,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
621 int i = 0; 625 int i = 0;
622 for ( it = list.begin() ; it != list.end() ; ++it ) 626 Package *package;
627 for ( ; it.current(); ++it )
623 { 628 {
@@ -635,5 +640,7 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
635 QString text = ""; 640 QString text = "";
641
642 package = it.current();
636 643
637 // Apply show only uninstalled packages filter 644 // Apply show only uninstalled packages filter
638 if ( showUninstalledPkgs && it->isInstalled() ) 645 if ( showUninstalledPkgs && package->isInstalled() )
639 continue; 646 continue;
@@ -641,3 +648,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
641 // Apply show only installed packages filter 648 // Apply show only installed packages filter
642 if ( showInstalledPkgs && !it->isInstalled() ) 649 if ( showInstalledPkgs && !package->isInstalled() )
643 continue; 650 continue;
@@ -647,4 +654,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
647 { 654 {
648 if ( !it->isInstalled() || 655 if ( !package->isInstalled() ||
649 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) 656 compareVersions( package->getInstalledVersion(), package->getVersion() ) != 1 )
650 continue; 657 continue;
@@ -655,3 +662,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
655 { 662 {
656 if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 ) 663 if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 )
657 continue; 664 continue;
@@ -660,3 +667,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
660 // If the local server, only display installed packages 667 // If the local server, only display installed packages
661 if ( serverName == LOCAL_SERVER && !it->isInstalled() ) 668 if ( serverName == LOCAL_SERVER && !package->isInstalled() )
662 continue; 669 continue;
@@ -664,5 +671,6 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
664 671
665 QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox ); 672 QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(),
673 QCheckListItem::CheckBox );
666 674
667 if ( it->isInstalled() ) 675 if ( package->isInstalled() )
668 { 676 {
@@ -670,4 +678,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
670 // Otherwise, show installed icon 678 // Otherwise, show installed icon
671 if ( it->getVersion() != it->getInstalledVersion() && 679 if ( package->getVersion() != package->getInstalledVersion() &&
672 compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1) 680 compareVersions( package->getInstalledVersion(), package->getVersion() ) == 1)
673 { 681 {
@@ -682,6 +690,6 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
682 QString destName = ""; 690 QString destName = "";
683 if ( it->getLocalPackage() ) 691 if ( package->getLocalPackage() )
684 { 692 {
685 if ( it->getLocalPackage()->getInstalledTo() ) 693 if ( package->getLocalPackage()->getInstalledTo() )
686 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); 694 destName = package->getLocalPackage()->getInstalledTo()->getDestinationName();
687 } 695 }
@@ -689,4 +697,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
689 { 697 {
690 if ( it->getInstalledTo() ) 698 if ( package->getInstalledTo() )
691 destName = it->getInstalledTo()->getDestinationName(); 699 destName = package->getInstalledTo()->getDestinationName();
692 } 700 }
@@ -700,10 +708,10 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
700 708
701 if ( !it->isPackageStoredLocally() ) 709 if ( !package->isPackageStoredLocally() )
702 { 710 {
703 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) ); 711 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) );
704 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) ); 712 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) );
705 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) ); 713 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( package->getSection() ) ) );
706 } 714 }
707 else 715 else
708 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) ); 716 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( package->getFilename() ) ) );
709 717
@@ -711,3 +719,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
711 { 719 {
712 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) ); 720 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getVersion() ) ) );
713 } 721 }
@@ -715,7 +723,7 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
715 { 723 {
716 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) ); 724 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( package->getVersion() ) ) );
717 if ( it->getLocalPackage() ) 725 if ( package->getLocalPackage() )
718 { 726 {
719 if ( it->isInstalled() ) 727 if ( package->isInstalled() )
720 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) ); 728 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getInstalledVersion() ) ) );
721 } 729 }
@@ -757,3 +765,3 @@ void MainWindow :: searchForPackage( const QString &text )
757 // look through package list for text startng at current position 765 // look through package list for text startng at current position
758 vector<InstallData> workingPackages; 766// vector<InstallData> workingPackages;
759 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 767 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
@@ -959,7 +967,8 @@ void MainWindow :: downloadRemotePackage()
959 967
960 InstallData item; 968 InstallData *item = new InstallData();
961 item.option = "I"; 969 item->option = "I";
962 item.packageName = package; 970 item->packageName = package;
963 vector<InstallData> workingPackages; 971 QList<InstallData> workingPackages;
964 workingPackages.push_back( item ); 972 workingPackages.setAutoDelete( TRUE );
973 workingPackages.append( item );
965 974
@@ -981,3 +990,4 @@ void MainWindow :: applyChanges()
981 990
982 vector<InstallData> workingPackages; 991 QList<InstallData> workingPackages;
992 workingPackages.setAutoDelete( TRUE );
983 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 993 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
@@ -988,4 +998,3 @@ void MainWindow :: applyChanges()
988 { 998 {
989 InstallData data = dealWithItem( item ); 999 workingPackages.append( dealWithItem( item ) );
990 workingPackages.push_back( data );
991 } 1000 }
@@ -993,3 +1002,3 @@ void MainWindow :: applyChanges()
993 1002
994 if ( workingPackages.size() == 0 ) 1003 if ( workingPackages.count() == 0 )
995 { 1004 {
@@ -1013,3 +1022,3 @@ void MainWindow :: applyChanges()
1013// If installed and version up to date - remove 1022// If installed and version up to date - remove
1014InstallData MainWindow :: dealWithItem( QCheckListItem *item ) 1023InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
1015{ 1024{
@@ -1018,3 +1027,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1018 // Get package 1027 // Get package
1019 vector<Server>::iterator s = mgr->getServer( serversList->currentText() ); 1028 Server *s = mgr->getServer( serversList->currentText() );
1020 Package *p = s->getPackage( name ); 1029 Package *p = s->getPackage( name );
@@ -1029,6 +1038,6 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1029 { 1038 {
1030 InstallData item; 1039 InstallData *newitem = new InstallData();;
1031 item.option = "I"; 1040 newitem->option = "I";
1032 item.packageName = name; 1041 newitem->packageName = name;
1033 return item; 1042 return newitem;
1034 } 1043 }
@@ -1036,8 +1045,8 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1036 { 1045 {
1037 InstallData item; 1046 InstallData *newitem = new InstallData();;
1038 item.option = "D"; 1047 newitem->option = "D";
1039 if ( !p->isPackageStoredLocally() ) 1048 if ( !p->isPackageStoredLocally() )
1040 item.packageName = p->getInstalledPackageName(); 1049 newitem->packageName = p->getInstalledPackageName();
1041 else 1050 else
1042 item.packageName = name; 1051 newitem->packageName = name;
1043 1052
@@ -1045,3 +1054,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1045 { 1054 {
1046 item.destination = p->getInstalledTo(); 1055 newitem->destination = p->getInstalledTo();
1047// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; 1056// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl;
@@ -1051,3 +1060,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1051 { 1060 {
1052 item.destination = p->getLocalPackage()->getInstalledTo(); 1061 newitem->destination = p->getLocalPackage()->getInstalledTo();
1053 } 1062 }
@@ -1068,3 +1077,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1068 // Version available is older - remove only 1077 // Version available is older - remove only
1069 item.option = "D"; 1078 newitem->option = "D";
1070 } 1079 }
@@ -1104,6 +1113,6 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1104 // option 0 = Remove 1113 // option 0 = Remove
1105 item.option = "D"; 1114 newitem->option = "D";
1106 break; 1115 break;
1107 case 1: // Quit or Escape 1116 case 1: // Quit or Escape
1108 item.option = secondOption; 1117 newitem->option = secondOption;
1109 break; 1118 break;
@@ -1113,3 +1122,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1113 { 1122 {
1114// item.option = stickyOption; 1123// newitem->option = stickyOption;
1115 } 1124 }
@@ -1119,9 +1128,9 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1119 // Check if we are reinstalling the same version 1128 // Check if we are reinstalling the same version
1120 if ( item.option != "R" ) 1129 if ( newitem->option != "R" )
1121 item.recreateLinks = true; 1130 newitem->recreateLinks = true;
1122 else 1131 else
1123 item.recreateLinks = false; 1132 newitem->recreateLinks = false;
1124 1133
1125 // User hit cancel (on dlg - assume remove) 1134 // User hit cancel (on dlg - assume remove)
1126 return item; 1135 return newitem;
1127 } 1136 }
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index d0777fb..db06e16 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -94,3 +94,3 @@ private:
94 void downloadRemotePackage(); 94 void downloadRemotePackage();
95 InstallData dealWithItem( QCheckListItem *item ); 95 InstallData *dealWithItem( QCheckListItem *item );
96 96
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp
index fc5ed12..04f5ab7 100644
--- a/noncore/settings/aqpkg/server.cpp
+++ b/noncore/settings/aqpkg/server.cpp
@@ -61,3 +61,3 @@ void Server :: cleanUp()
61 61
62void Server :: readStatusFile( vector<Destination> &destList ) 62void Server :: readStatusFile( QList<Destination> &destList )
63{ 63{
@@ -65,9 +65,11 @@ void Server :: readStatusFile( vector<Destination> &destList )
65 65
66 vector<Destination>::iterator dit; 66 Destination *dest;
67 QListIterator<Destination> dit( destList );
67 bool rootRead = false; 68 bool rootRead = false;
68 for ( dit = destList.begin() ; dit != destList.end() ; ++dit ) 69 for ( ; dit.current(); ++dit )
69 { 70 {
71 dest = dit.current();
70 bool installingToRoot = false; 72 bool installingToRoot = false;
71 73
72 QString path = dit->getDestinationPath(); 74 QString path = dest->getDestinationPath();
73 if ( path.right( 1 ) != "/" ) 75 if ( path.right( 1 ) != "/" )
@@ -82,3 +84,3 @@ void Server :: readStatusFile( vector<Destination> &destList )
82 packageFile = path + "usr/lib/ipkg/status"; 84 packageFile = path + "usr/lib/ipkg/status";
83 readPackageFile( 0, false, installingToRoot, &( *dit ) ); 85 readPackageFile( 0, false, installingToRoot, &( *dest ) );
84 } 86 }
@@ -117,8 +119,8 @@ void Server :: readLocalIpks( Server *local )
117 QString ver = Utils::getPackageVersionFromIpkFilename( file ); 119 QString ver = Utils::getPackageVersionFromIpkFilename( file );
118 packageList.push_back( Package( packageName ) ); 120 Package *package = new Package( packageName );
119 packageList.back().setVersion( ver ); 121 package->setVersion( ver );
120 packageList.back().setFilename( file ); 122 package->setFilename( file );
121 packageList.back().setPackageStoredLocally( true ); 123 package->setPackageStoredLocally( true );
122 124 packageList.append( package );
123 } 125 }
124#else 126#else
@@ -182,6 +184,6 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
182 { 184 {
183 packageList.push_back( Package( value ) ); 185 Package *package = new Package( value );
184 currPackage = &(packageList.back()); 186 packageList.append( package );
187 currPackage = package;
185 currPackage->setInstalledTo( dest ); 188 currPackage->setInstalledTo( dest );
186
187 if ( installingToRoot ) 189 if ( installingToRoot )
@@ -241,5 +243,8 @@ void Server :: buildLocalPackages( Server *local )
241{ 243{
242 for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) 244 Package *curr;
245 QListIterator<Package> it( packageList );
246 for ( ; it.current(); ++it )
243 { 247 {
244 QString name = packageList[i].getPackageName(); 248 curr = it.current();
249 QString name = curr->getPackageName();
245 250
@@ -247,3 +252,3 @@ void Server :: buildLocalPackages( Server *local )
247 if ( name.find( ".ipk" ) != -1 ) 252 if ( name.find( ".ipk" ) != -1 )
248 name = Utils::getPackageNameFromIpkFilename( packageList[i].getFilename() ); 253 name = Utils::getPackageNameFromIpkFilename( curr->getFilename() );
249 254
@@ -252,3 +257,3 @@ void Server :: buildLocalPackages( Server *local )
252 Package *p = local->getPackage( name ); 257 Package *p = local->getPackage( name );
253 packageList[i].setLocalPackage( p ); 258 curr->setLocalPackage( p );
254 if ( p ) 259 if ( p )
@@ -256,7 +261,7 @@ void Server :: buildLocalPackages( Server *local )
256 // Set some default stuff like size and things 261 // Set some default stuff like size and things
257 if ( p->getInstalledVersion() == packageList[i].getVersion() ) 262 if ( p->getInstalledVersion() == curr->getVersion() )
258 { 263 {
259 p->setPackageSize( packageList[i].getPackageSize() ); 264 p->setPackageSize( curr->getPackageSize() );
260 p->setSection( packageList[i].getSection() ); 265 p->setSection( curr->getSection() );
261 p->setDescription( packageList[i].getDescription() ); 266 p->setDescription( curr->getDescription() );
262 } 267 }
@@ -266,3 +271,3 @@ void Server :: buildLocalPackages( Server *local )
266 else 271 else
267 packageList[i].setLocalPackage( 0 ); 272 curr->setLocalPackage( 0 );
268 } 273 }
@@ -280,7 +285,8 @@ Package *Server :: getPackage( const char *name )
280 285
281 for ( unsigned int i = 0 ; i < packageList.size() && ret == 0; ++i ) 286 QListIterator<Package> it( packageList );
287 for ( ; it.current(); ++it )
282 { 288 {
283 if ( packageList[i].getPackageName() == name ) 289 if ( it.current()->getPackageName() == name )
284 ret = &packageList[i]; 290 ret = it.current();
285 } 291 }
286 292
@@ -291,8 +297,9 @@ QString Server :: toString()
291{ 297{
292 QString ret = "Server\n name - " + serverName + 298 QString ret = QString( "Server\n name - %1\n url - %2\n" ).arg( serverName ).arg( serverUrl );
293 "\n url - " + serverUrl + 299
294 "\n"; 300 QListIterator<Package> it( packageList );
295 301 for ( ; it.current(); ++it )
296 for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) 302 {
297 ret += "\n " + packageList[i].toString(); 303 ret.append( QString( "\n %1" ).arg( it.current()->toString() ) );
304 }
298 305
@@ -302,3 +309,3 @@ QString Server :: toString()
302 309
303vector<Package> &Server::getPackageList() 310QList<Package> &Server::getPackageList()
304{ 311{
diff --git a/noncore/settings/aqpkg/server.h b/noncore/settings/aqpkg/server.h
index f585b8f..02746e0 100644
--- a/noncore/settings/aqpkg/server.h
+++ b/noncore/settings/aqpkg/server.h
@@ -19,5 +19,5 @@
19 19
20#include <qlist.h>
20#include <qstring.h> 21#include <qstring.h>
21 22
22#include <vector>
23using namespace std; 23using namespace std;
@@ -37,3 +37,3 @@ public:
37 37
38 void readStatusFile( vector<Destination> &v ); 38 void readStatusFile( QList<Destination> &v );
39 void readLocalIpks( Server *local ); 39 void readLocalIpks( Server *local );
@@ -44,3 +44,3 @@ public:
44 QString toString(); 44 QString toString();
45 vector<Package> &getPackageList(); 45 QList<Package> &getPackageList();
46 bool isServerActive() { return active; } 46 bool isServerActive() { return active; }
@@ -62,3 +62,3 @@ private:
62 62
63 vector<Package> packageList; 63 QList<Package> packageList;
64}; 64};
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index c5a55d2..7541f0b 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -256,9 +256,11 @@ void SettingsImpl :: setupData()
256 // add servers 256 // add servers
257 vector<Server>::iterator it; 257 QString serverName;
258 for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it ) 258 QListIterator<Server> it( dataMgr->getServerList() );
259 for ( ; it.current(); ++it )
259 { 260 {
260 if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS ) 261 serverName = it.current()->getServerName();
262 if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS )
261 continue; 263 continue;
262 264
263 servers->insertItem( it->getServerName() ); 265 servers->insertItem( serverName );
264 } 266 }
@@ -267,5 +269,5 @@ void SettingsImpl :: setupData()
267 // add destinations 269 // add destinations
268 vector<Destination>::iterator it2; 270 QListIterator<Destination> it2( dataMgr->getDestinationList() );
269 for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 ) 271 for ( ; it2.current(); ++it2 )
270 destinations->insertItem( it2->getDestinationName() ); 272 destinations->insertItem( it2.current()->getDestinationName() );
271 273
@@ -285,3 +287,3 @@ void SettingsImpl :: editServer( int sel )
285 currentSelectedServer = sel; 287 currentSelectedServer = sel;
286 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); 288 Server *s = dataMgr->getServer( servers->currentText() );
287 serverName = s->getServerName(); 289 serverName = s->getServerName();
@@ -304,4 +306,4 @@ void SettingsImpl :: removeServer()
304 changed = true; 306 changed = true;
305 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); 307 Server *s = dataMgr->getServer( servers->currentText() );
306 dataMgr->getServerList().erase( s ); 308 dataMgr->getServerList().removeRef( s );
307 servers->removeItem( currentSelectedServer ); 309 servers->removeItem( currentSelectedServer );
@@ -316,3 +318,3 @@ void SettingsImpl :: changeServerDetails()
316 { 318 {
317 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); 319 Server *s = dataMgr->getServer( servers->currentText() );
318 320
@@ -340,4 +342,4 @@ void SettingsImpl :: changeServerDetails()
340 Server s( newName, serverurl->text() ); 342 Server s( newName, serverurl->text() );
341 dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) ); 343 dataMgr->getServerList().append( new Server( newName, serverurl->text() ) );
342 dataMgr->getServerList().end()->setActive( active->isChecked() ); 344 dataMgr->getServerList().last()->setActive( active->isChecked() );
343 servers->insertItem( newName ); 345 servers->insertItem( newName );
@@ -353,3 +355,3 @@ void SettingsImpl :: editDestination( int sel )
353 currentSelectedDestination = sel; 355 currentSelectedDestination = sel;
354 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); 356 Destination *d = dataMgr->getDestination( destinations->currentText() );
355 destinationName = d->getDestinationName(); 357 destinationName = d->getDestinationName();
@@ -372,4 +374,4 @@ void SettingsImpl :: removeDestination()
372 changed = true; 374 changed = true;
373 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); 375 Destination *d = dataMgr->getDestination( destinations->currentText() );
374 dataMgr->getDestinationList().erase( d ); 376 dataMgr->getDestinationList().removeRef( d );
375 destinations->removeItem( currentSelectedDestination ); 377 destinations->removeItem( currentSelectedDestination );
@@ -389,3 +391,3 @@ void SettingsImpl :: changeDestinationDetails()
389 { 391 {
390 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); 392 Destination *d = dataMgr->getDestination( destinations->currentText() );
391 393
@@ -413,3 +415,3 @@ void SettingsImpl :: changeDestinationDetails()
413 { 415 {
414 dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) ); 416 dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) );
415 destinations->insertItem( newName ); 417 destinations->insertItem( newName );