summaryrefslogtreecommitdiff
Side-by-side diff
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()
availableCategories = "#";
+
+ serverList.setAutoDelete( TRUE );
+ destList.setAutoDelete( TRUE );
}
@@ -45,10 +48,7 @@ DataManager::~DataManager()
-vector<Server>::iterator DataManager :: getServer( const char *name )
+Server *DataManager :: getServer( const char *name )
{
- vector<Server>::iterator it = serverList.begin();
- while ( it != serverList.end() )
+ QListIterator<Server> it( serverList );
+ while ( it.current() && it.current()->getServerName() != name )
{
- if ( it->getServerName() == name )
- return it;
-
++it;
@@ -56,13 +56,10 @@ vector<Server>::iterator DataManager :: getServer( const char *name )
- return serverList.end();
+ return it.current();
}
-vector<Destination>::iterator DataManager :: getDestination( const char *name )
+Destination *DataManager :: getDestination( const char *name )
{
- vector<Destination>::iterator it = destList.begin();
- while ( it != destList.end() )
+ QListIterator<Destination> it( destList );
+ while ( it.current() && it.current()->getDestinationName() != name )
{
- if ( it->getDestinationName() == name )
- return it;
-
++it;
@@ -70,3 +67,3 @@ vector<Destination>::iterator DataManager :: getDestination( const char *name )
- return destList.end();
+ return it.current();
}
@@ -77,4 +74,4 @@ void DataManager :: loadServers()
// the local config (which packages are installed)
- serverList.push_back( Server( LOCAL_SERVER, "" ) );
- serverList.push_back( Server( LOCAL_IPKGS, "" ) );
+ serverList.append( new Server( LOCAL_SERVER, "" ) );
+ serverList.append( new Server( LOCAL_IPKGS, "" ) );
@@ -111,9 +108,9 @@ void DataManager :: loadServers()
sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url );
- Server s( alias, url );
+ Server *s = new Server( alias, url );
if ( lineStr.startsWith( "src" ) )
- s.setActive( true );
+ s->setActive( true );
else
- s.setActive( false );
+ s->setActive( false );
- serverList.push_back( s );
+ serverList.append( s );
@@ -125,3 +122,3 @@ void DataManager :: loadServers()
sscanf( lineStr, "%*[^ ] %s %s", alias, path );
- Destination d( alias, path );
+ Destination *d = new Destination( alias, path );
bool linkToRoot = true;
@@ -132,5 +129,5 @@ void DataManager :: loadServers()
#endif
- d.linkToRoot( linkToRoot );
+ d->linkToRoot( linkToRoot );
- destList.push_back( d );
+ destList.append( d );
}
@@ -171,11 +168,14 @@ void DataManager :: reloadServerData( )
{
- emit progressSetSteps( serverList.size() );
+ emit progressSetSteps( serverList.count() );
emit progressSetMessage( tr( "Reading configuration..." ) );
- vector<Server>::iterator it = serverList.begin();
QString serverName;
int i = 0;
- for ( it = serverList.begin() ; it != serverList.end() ; ++it )
+
+ Server *server;
+ QListIterator<Server> it( serverList );
+ for ( ; it.current(); ++it )
{
- serverName = it->getServerName();
+ server = it.current();
+ serverName = server->getServerName();
i++;
@@ -190,7 +190,7 @@ void DataManager :: reloadServerData( )
if ( serverName == LOCAL_SERVER )
- it->readStatusFile( destList );
+ server->readStatusFile( destList );
else if ( serverName == LOCAL_IPKGS )
- it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) );
+ server->readLocalIpks( getServer( LOCAL_SERVER ) );
else
- it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) );
+ server->readPackageFile( getServer( LOCAL_SERVER ) );
}
@@ -219,6 +219,8 @@ void DataManager :: writeOutIpkgConf()
// Write out servers
- vector<Server>::iterator it = serverList.begin();
- while ( it != serverList.end() )
+ Server *server;
+ QListIterator<Server> it( serverList );
+ while ( it.current() )
{
- QString alias = it->getServerName();
+ server = it.current();
+ QString alias = server->getServerName();
// Don't write out local as its a dummy
@@ -226,5 +228,5 @@ void DataManager :: writeOutIpkgConf()
{
- QString url = it->getServerUrl();;
+ QString url = server->getServerUrl();;
- if ( !it->isServerActive() )
+ if ( !server->isServerActive() )
out << "#";
@@ -233,3 +235,3 @@ void DataManager :: writeOutIpkgConf()
- it++;
+ ++it;
}
@@ -239,7 +241,7 @@ void DataManager :: writeOutIpkgConf()
// Write out destinations
- vector<Destination>::iterator it2 = destList.begin();
- while ( it2 != destList.end() )
+ QListIterator<Destination> it2( destList );
+ while ( it2.current() )
{
- out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl;
- it2++;
+ out << "dest " << it2.current()->getDestinationName() << " " << it2.current()->getDestinationPath() << endl;
+ ++it2;
}
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;
+#include <qlist.h>
#include <qobject.h>
@@ -47,8 +48,8 @@ public:
- Server *getLocalServer() { return &( *getServer( LOCAL_SERVER ) ); }
- vector<Server> &getServerList() { return serverList; }
- vector<Server>::iterator getServer( const char *name );
+ Server *getLocalServer() { return ( getServer( LOCAL_SERVER ) ); }
+ QList<Server> &getServerList() { return serverList; }
+ Server *getServer( const char *name );
- vector<Destination> &getDestinationList() { return destList; }
- vector<Destination>::iterator getDestination( const char *name );
+ QList<Destination> &getDestinationList() { return destList; }
+ Destination *getDestination( const char *name );
@@ -88,4 +89,4 @@ private:
- vector<Server> serverList;
- vector<Destination> destList;
+ QList<Server> serverList;
+ QList<Destination> destList;
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 @@
-InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title )
+InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title )
: QWidget( 0, 0, 0 )
@@ -52,3 +52,2 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
dataMgr = dataManager;
- vector<Destination>::iterator dit;
@@ -76,6 +75,7 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
int i;
- for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i )
+ QListIterator<Destination> dit( dataMgr->getDestinationList() );
+ for ( i = 0; dit.current(); ++dit, ++i )
{
- destination->insertItem( dit->getDestinationName() );
- if ( dit->getDestinationName() == defaultDest )
+ destination->insertItem( dit.current()->getDestinationName() );
+ if ( dit.current()->getDestinationName() == defaultDest )
defIndex = i;
@@ -85,3 +85,3 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
- vector<InstallData>::iterator it;
+ QListIterator<InstallData> it( packageList );
// setup package data
@@ -90,20 +90,27 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
QString upgrade = tr( "Upgrade\n" );
- for ( it = packageList.begin() ; it != packageList.end() ; ++it )
+ for ( ; it.current(); ++it )
{
- InstallData item = *it;
- if ( item.option == "I" )
+ InstallData *item = it.current();
+ InstallData *newitem = new InstallData();
+
+ newitem->option = item->option;
+ newitem->packageName = item->packageName;
+ newitem->destination = item->destination;
+ newitem->recreateLinks = item->recreateLinks;
+
+ if ( item->option == "I" )
{
- installList.push_back( item );
- install.append( QString( " %1\n" ).arg( item.packageName ) );
+ installList.append( newitem );
+ install.append( QString( " %1\n" ).arg( item->packageName ) );
}
- else if ( item.option == "D" )
+ else if ( item->option == "D" )
{
- removeList.push_back( item );
- remove.append( QString( " %1\n" ).arg( item.packageName ) );
+ removeList.append( newitem );
+ remove.append( QString( " %1\n" ).arg( item->packageName ) );
}
- else if ( item.option == "U" || item.option == "R" )
+ else if ( item->option == "U" || item->option == "R" )
{
- updateList.push_back( item );
+ updateList.append( newitem );
QString type;
- if ( item.option == "R" )
+ if ( item->option == "R" )
type = tr( "(ReInstall)" );
@@ -111,6 +118,5 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
type = tr( "(Upgrade)" );
- upgrade.append( QString( " %1 %2\n" ).arg( item.packageName ).arg( type ) );
+ upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) );
}
}
-
output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) );
@@ -215,3 +221,3 @@ void InstallDlgImpl :: installSelected()
}
-
+
// Disable buttons
@@ -231,3 +237,3 @@ void InstallDlgImpl :: installSelected()
output->setText( "" );
- vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() );
+ Destination *d = dataMgr->getDestination( destination->currentText() );
QString dest = d->getDestinationName();
@@ -249,12 +255,14 @@ void InstallDlgImpl :: installSelected()
// First run through the remove list, then the install list then the upgrade list
- vector<InstallData>::iterator it;
pIpkg->setOption( "remove" );
- for ( it = removeList.begin() ; it != removeList.end() ; ++it )
+ QListIterator<InstallData> it( removeList );
+ InstallData *idata;
+ for ( ; it.current(); ++it )
{
- pIpkg->setDestination( it->destination->getDestinationName() );
- pIpkg->setDestinationDir( it->destination->getDestinationPath() );
- pIpkg->setPackage( it->packageName );
+ idata = it.current();
+ pIpkg->setDestination( idata->destination->getDestinationName() );
+ pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
+ pIpkg->setPackage( idata->packageName );
int tmpFlags = flags;
- if ( it->destination->linkToRoot() )
+ if ( idata->destination->linkToRoot() )
tmpFlags |= MAKE_LINKS;
@@ -269,5 +277,6 @@ void InstallDlgImpl :: installSelected()
pIpkg->setFlags( instFlags );
- for ( it = installList.begin() ; it != installList.end() ; ++it )
+ QListIterator<InstallData> it2( installList );
+ for ( ; it2.current(); ++it2 )
{
- pIpkg->setPackage( it->packageName );
+ pIpkg->setPackage( it2.current()->packageName );
pIpkg->runIpkg();
@@ -276,5 +285,7 @@ void InstallDlgImpl :: installSelected()
flags |= FORCE_REINSTALL;
- for ( it = updateList.begin() ; it != updateList.end() ; ++it )
+ QListIterator<InstallData> it3( updateList );
+ for ( ; it3.current() ; ++it3 )
{
- if ( it->option == "R" )
+ idata = it3.current();
+ if ( idata->option == "R" )
pIpkg->setOption( "reinstall" );
@@ -282,8 +293,8 @@ void InstallDlgImpl :: installSelected()
pIpkg->setOption( "upgrade" );
- pIpkg->setDestination( it->destination->getDestinationName() );
- pIpkg->setDestinationDir( it->destination->getDestinationPath() );
- pIpkg->setPackage( it->packageName );
+ pIpkg->setDestination( idata->destination->getDestinationName() );
+ pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
+ pIpkg->setPackage( idata->packageName );
int tmpFlags = flags;
- if ( it->destination->linkToRoot() && it->recreateLinks )
+ if ( idata->destination->linkToRoot() && idata->recreateLinks )
tmpFlags |= MAKE_LINKS;
@@ -309,3 +320,2 @@ void InstallDlgImpl :: displayText(const QString &text )
{
- //output->setText( QString( "%1\n%2" ).arg( output->text() ).arg( text ) );
QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text );
@@ -318,3 +328,3 @@ void InstallDlgImpl :: displayAvailableSpace( const QString &text )
{
- vector<Destination>::iterator d = dataMgr->getDestination( text );
+ Destination *d = dataMgr->getDestination( text );
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 @@
-#include <vector>
using namespace std;
-#include <qwidget.h>
+#include <qlist.h>
#include <qstring.h>
+#include <qwidget.h>
@@ -47,3 +47,3 @@ class InstallDlgImpl : public QWidget
public:
- InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 );
+ InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title = 0 );
InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 );
@@ -57,5 +57,5 @@ private:
DataManager *dataMgr;
- vector<InstallData> installList;
- vector<InstallData> removeList;
- vector<InstallData> updateList;
+ QList<InstallData> installList;
+ QList<InstallData> removeList;
+ QList<InstallData> updateList;
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()
{
- m_progress->setTotalSteps( mgr->getServerList().size() );
+ m_progress->setTotalSteps( mgr->getServerList().count() );
@@ -550,9 +550,13 @@ void MainWindow :: updateData()
- vector<Server>::iterator it;
int activeItem = -1;
- int i;
+ int i = 0;
QString serverName;
- for ( i = 0, it = mgr->getServerList().begin() ; it != mgr->getServerList().end() ; ++it, ++i )
+
+ QListIterator<Server> it( mgr->getServerList() );
+ Server *server;
+
+ for ( ; it.current(); ++it, ++i )
{
- serverName = it->getServerName();
+ server = it.current();
+ serverName = server->getServerName();
m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) );
@@ -562,3 +566,3 @@ void MainWindow :: updateData()
// cout << "Adding " << it->getServerName() << " to combobox" << endl;
- if ( !it->isServerActive() )
+ if ( !server->isServerActive() )
{
@@ -594,9 +598,9 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
- vector<Server>::iterator s = mgr->getServer( serverName );
+ Server *s = mgr->getServer( serverName );
- vector<Package> &list = s->getPackageList();
- vector<Package>::iterator it;
+ QList<Package> &list = s->getPackageList();
+ QListIterator<Package> it( list );
// Display progress widget while loading list
- bool doProgress = ( list.size() > 200 );
+ bool doProgress = ( list.count() > 200 );
if ( doProgress )
@@ -607,3 +611,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
}
- m_progress->setTotalSteps( list.size() );
+ m_progress->setTotalSteps( list.count() );
m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) );
@@ -621,3 +625,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
int i = 0;
- for ( it = list.begin() ; it != list.end() ; ++it )
+ Package *package;
+ for ( ; it.current(); ++it )
{
@@ -635,5 +640,7 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
QString text = "";
+
+ package = it.current();
// Apply show only uninstalled packages filter
- if ( showUninstalledPkgs && it->isInstalled() )
+ if ( showUninstalledPkgs && package->isInstalled() )
continue;
@@ -641,3 +648,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
// Apply show only installed packages filter
- if ( showInstalledPkgs && !it->isInstalled() )
+ if ( showInstalledPkgs && !package->isInstalled() )
continue;
@@ -647,4 +654,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
{
- if ( !it->isInstalled() ||
- compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 )
+ if ( !package->isInstalled() ||
+ compareVersions( package->getInstalledVersion(), package->getVersion() ) != 1 )
continue;
@@ -655,3 +662,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
{
- if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 )
+ if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 )
continue;
@@ -660,3 +667,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
// If the local server, only display installed packages
- if ( serverName == LOCAL_SERVER && !it->isInstalled() )
+ if ( serverName == LOCAL_SERVER && !package->isInstalled() )
continue;
@@ -664,5 +671,6 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
- QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox );
+ QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(),
+ QCheckListItem::CheckBox );
- if ( it->isInstalled() )
+ if ( package->isInstalled() )
{
@@ -670,4 +678,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
// Otherwise, show installed icon
- if ( it->getVersion() != it->getInstalledVersion() &&
- compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1)
+ if ( package->getVersion() != package->getInstalledVersion() &&
+ compareVersions( package->getInstalledVersion(), package->getVersion() ) == 1)
{
@@ -682,6 +690,6 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
QString destName = "";
- if ( it->getLocalPackage() )
+ if ( package->getLocalPackage() )
{
- if ( it->getLocalPackage()->getInstalledTo() )
- destName = it->getLocalPackage()->getInstalledTo()->getDestinationName();
+ if ( package->getLocalPackage()->getInstalledTo() )
+ destName = package->getLocalPackage()->getInstalledTo()->getDestinationName();
}
@@ -689,4 +697,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
{
- if ( it->getInstalledTo() )
- destName = it->getInstalledTo()->getDestinationName();
+ if ( package->getInstalledTo() )
+ destName = package->getInstalledTo()->getDestinationName();
}
@@ -700,10 +708,10 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
- if ( !it->isPackageStoredLocally() )
+ if ( !package->isPackageStoredLocally() )
{
- new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) );
- new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) );
- new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) );
+ new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) );
+ new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) );
+ new QCheckListItem( item, QString( tr( "Section - %1" ).arg( package->getSection() ) ) );
}
else
- new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) );
+ new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( package->getFilename() ) ) );
@@ -711,3 +719,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
{
- new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) );
+ new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getVersion() ) ) );
}
@@ -715,7 +723,7 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
{
- new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) );
- if ( it->getLocalPackage() )
+ new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( package->getVersion() ) ) );
+ if ( package->getLocalPackage() )
{
- if ( it->isInstalled() )
- new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) );
+ if ( package->isInstalled() )
+ new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getInstalledVersion() ) ) );
}
@@ -757,3 +765,3 @@ void MainWindow :: searchForPackage( const QString &text )
// look through package list for text startng at current position
- vector<InstallData> workingPackages;
+// vector<InstallData> workingPackages;
QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
@@ -959,7 +967,8 @@ void MainWindow :: downloadRemotePackage()
- InstallData item;
- item.option = "I";
- item.packageName = package;
- vector<InstallData> workingPackages;
- workingPackages.push_back( item );
+ InstallData *item = new InstallData();
+ item->option = "I";
+ item->packageName = package;
+ QList<InstallData> workingPackages;
+ workingPackages.setAutoDelete( TRUE );
+ workingPackages.append( item );
@@ -981,3 +990,4 @@ void MainWindow :: applyChanges()
- vector<InstallData> workingPackages;
+ QList<InstallData> workingPackages;
+ workingPackages.setAutoDelete( TRUE );
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
@@ -988,4 +998,3 @@ void MainWindow :: applyChanges()
{
- InstallData data = dealWithItem( item );
- workingPackages.push_back( data );
+ workingPackages.append( dealWithItem( item ) );
}
@@ -993,3 +1002,3 @@ void MainWindow :: applyChanges()
- if ( workingPackages.size() == 0 )
+ if ( workingPackages.count() == 0 )
{
@@ -1013,3 +1022,3 @@ void MainWindow :: applyChanges()
// If installed and version up to date - remove
-InstallData MainWindow :: dealWithItem( QCheckListItem *item )
+InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
{
@@ -1018,3 +1027,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
// Get package
- vector<Server>::iterator s = mgr->getServer( serversList->currentText() );
+ Server *s = mgr->getServer( serversList->currentText() );
Package *p = s->getPackage( name );
@@ -1029,6 +1038,6 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
{
- InstallData item;
- item.option = "I";
- item.packageName = name;
- return item;
+ InstallData *newitem = new InstallData();;
+ newitem->option = "I";
+ newitem->packageName = name;
+ return newitem;
}
@@ -1036,8 +1045,8 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
{
- InstallData item;
- item.option = "D";
+ InstallData *newitem = new InstallData();;
+ newitem->option = "D";
if ( !p->isPackageStoredLocally() )
- item.packageName = p->getInstalledPackageName();
+ newitem->packageName = p->getInstalledPackageName();
else
- item.packageName = name;
+ newitem->packageName = name;
@@ -1045,3 +1054,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
{
- item.destination = p->getInstalledTo();
+ newitem->destination = p->getInstalledTo();
// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl;
@@ -1051,3 +1060,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
{
- item.destination = p->getLocalPackage()->getInstalledTo();
+ newitem->destination = p->getLocalPackage()->getInstalledTo();
}
@@ -1068,3 +1077,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
// Version available is older - remove only
- item.option = "D";
+ newitem->option = "D";
}
@@ -1104,6 +1113,6 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
// option 0 = Remove
- item.option = "D";
+ newitem->option = "D";
break;
case 1: // Quit or Escape
- item.option = secondOption;
+ newitem->option = secondOption;
break;
@@ -1113,3 +1122,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
{
-// item.option = stickyOption;
+// newitem->option = stickyOption;
}
@@ -1119,9 +1128,9 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
// Check if we are reinstalling the same version
- if ( item.option != "R" )
- item.recreateLinks = true;
+ if ( newitem->option != "R" )
+ newitem->recreateLinks = true;
else
- item.recreateLinks = false;
+ newitem->recreateLinks = false;
// User hit cancel (on dlg - assume remove)
- return item;
+ return newitem;
}
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:
void downloadRemotePackage();
- InstallData dealWithItem( QCheckListItem *item );
+ InstallData *dealWithItem( QCheckListItem *item );
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()
-void Server :: readStatusFile( vector<Destination> &destList )
+void Server :: readStatusFile( QList<Destination> &destList )
{
@@ -65,9 +65,11 @@ void Server :: readStatusFile( vector<Destination> &destList )
- vector<Destination>::iterator dit;
+ Destination *dest;
+ QListIterator<Destination> dit( destList );
bool rootRead = false;
- for ( dit = destList.begin() ; dit != destList.end() ; ++dit )
+ for ( ; dit.current(); ++dit )
{
+ dest = dit.current();
bool installingToRoot = false;
- QString path = dit->getDestinationPath();
+ QString path = dest->getDestinationPath();
if ( path.right( 1 ) != "/" )
@@ -82,3 +84,3 @@ void Server :: readStatusFile( vector<Destination> &destList )
packageFile = path + "usr/lib/ipkg/status";
- readPackageFile( 0, false, installingToRoot, &( *dit ) );
+ readPackageFile( 0, false, installingToRoot, &( *dest ) );
}
@@ -117,8 +119,8 @@ void Server :: readLocalIpks( Server *local )
QString ver = Utils::getPackageVersionFromIpkFilename( file );
- packageList.push_back( Package( packageName ) );
- packageList.back().setVersion( ver );
- packageList.back().setFilename( file );
- packageList.back().setPackageStoredLocally( true );
-
- }
+ Package *package = new Package( packageName );
+ package->setVersion( ver );
+ package->setFilename( file );
+ package->setPackageStoredLocally( true );
+ packageList.append( package );
+ }
#else
@@ -182,6 +184,6 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
{
- packageList.push_back( Package( value ) );
- currPackage = &(packageList.back());
+ Package *package = new Package( value );
+ packageList.append( package );
+ currPackage = package;
currPackage->setInstalledTo( dest );
-
if ( installingToRoot )
@@ -241,5 +243,8 @@ void Server :: buildLocalPackages( Server *local )
{
- for ( unsigned int i = 0 ; i < packageList.size() ; ++i )
+ Package *curr;
+ QListIterator<Package> it( packageList );
+ for ( ; it.current(); ++it )
{
- QString name = packageList[i].getPackageName();
+ curr = it.current();
+ QString name = curr->getPackageName();
@@ -247,3 +252,3 @@ void Server :: buildLocalPackages( Server *local )
if ( name.find( ".ipk" ) != -1 )
- name = Utils::getPackageNameFromIpkFilename( packageList[i].getFilename() );
+ name = Utils::getPackageNameFromIpkFilename( curr->getFilename() );
@@ -252,3 +257,3 @@ void Server :: buildLocalPackages( Server *local )
Package *p = local->getPackage( name );
- packageList[i].setLocalPackage( p );
+ curr->setLocalPackage( p );
if ( p )
@@ -256,7 +261,7 @@ void Server :: buildLocalPackages( Server *local )
// Set some default stuff like size and things
- if ( p->getInstalledVersion() == packageList[i].getVersion() )
+ if ( p->getInstalledVersion() == curr->getVersion() )
{
- p->setPackageSize( packageList[i].getPackageSize() );
- p->setSection( packageList[i].getSection() );
- p->setDescription( packageList[i].getDescription() );
+ p->setPackageSize( curr->getPackageSize() );
+ p->setSection( curr->getSection() );
+ p->setDescription( curr->getDescription() );
}
@@ -266,3 +271,3 @@ void Server :: buildLocalPackages( Server *local )
else
- packageList[i].setLocalPackage( 0 );
+ curr->setLocalPackage( 0 );
}
@@ -280,7 +285,8 @@ Package *Server :: getPackage( const char *name )
- for ( unsigned int i = 0 ; i < packageList.size() && ret == 0; ++i )
+ QListIterator<Package> it( packageList );
+ for ( ; it.current(); ++it )
{
- if ( packageList[i].getPackageName() == name )
- ret = &packageList[i];
- }
+ if ( it.current()->getPackageName() == name )
+ ret = it.current();
+ }
@@ -291,8 +297,9 @@ QString Server :: toString()
{
- QString ret = "Server\n name - " + serverName +
- "\n url - " + serverUrl +
- "\n";
-
- for ( unsigned int i = 0 ; i < packageList.size() ; ++i )
- ret += "\n " + packageList[i].toString();
+ QString ret = QString( "Server\n name - %1\n url - %2\n" ).arg( serverName ).arg( serverUrl );
+
+ QListIterator<Package> it( packageList );
+ for ( ; it.current(); ++it )
+ {
+ ret.append( QString( "\n %1" ).arg( it.current()->toString() ) );
+ }
@@ -302,3 +309,3 @@ QString Server :: toString()
-vector<Package> &Server::getPackageList()
+QList<Package> &Server::getPackageList()
{
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 @@
+#include <qlist.h>
#include <qstring.h>
-#include <vector>
using namespace std;
@@ -37,3 +37,3 @@ public:
- void readStatusFile( vector<Destination> &v );
+ void readStatusFile( QList<Destination> &v );
void readLocalIpks( Server *local );
@@ -44,3 +44,3 @@ public:
QString toString();
- vector<Package> &getPackageList();
+ QList<Package> &getPackageList();
bool isServerActive() { return active; }
@@ -62,3 +62,3 @@ private:
- vector<Package> packageList;
+ QList<Package> packageList;
};
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()
// add servers
- vector<Server>::iterator it;
- for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it )
+ QString serverName;
+ QListIterator<Server> it( dataMgr->getServerList() );
+ for ( ; it.current(); ++it )
{
- if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS )
+ serverName = it.current()->getServerName();
+ if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS )
continue;
- servers->insertItem( it->getServerName() );
+ servers->insertItem( serverName );
}
@@ -267,5 +269,5 @@ void SettingsImpl :: setupData()
// add destinations
- vector<Destination>::iterator it2;
- for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 )
- destinations->insertItem( it2->getDestinationName() );
+ QListIterator<Destination> it2( dataMgr->getDestinationList() );
+ for ( ; it2.current(); ++it2 )
+ destinations->insertItem( it2.current()->getDestinationName() );
@@ -285,3 +287,3 @@ void SettingsImpl :: editServer( int sel )
currentSelectedServer = sel;
- vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
+ Server *s = dataMgr->getServer( servers->currentText() );
serverName = s->getServerName();
@@ -304,4 +306,4 @@ void SettingsImpl :: removeServer()
changed = true;
- vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
- dataMgr->getServerList().erase( s );
+ Server *s = dataMgr->getServer( servers->currentText() );
+ dataMgr->getServerList().removeRef( s );
servers->removeItem( currentSelectedServer );
@@ -316,3 +318,3 @@ void SettingsImpl :: changeServerDetails()
{
- vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
+ Server *s = dataMgr->getServer( servers->currentText() );
@@ -340,4 +342,4 @@ void SettingsImpl :: changeServerDetails()
Server s( newName, serverurl->text() );
- dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) );
- dataMgr->getServerList().end()->setActive( active->isChecked() );
+ dataMgr->getServerList().append( new Server( newName, serverurl->text() ) );
+ dataMgr->getServerList().last()->setActive( active->isChecked() );
servers->insertItem( newName );
@@ -353,3 +355,3 @@ void SettingsImpl :: editDestination( int sel )
currentSelectedDestination = sel;
- vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
+ Destination *d = dataMgr->getDestination( destinations->currentText() );
destinationName = d->getDestinationName();
@@ -372,4 +374,4 @@ void SettingsImpl :: removeDestination()
changed = true;
- vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
- dataMgr->getDestinationList().erase( d );
+ Destination *d = dataMgr->getDestination( destinations->currentText() );
+ dataMgr->getDestinationList().removeRef( d );
destinations->removeItem( currentSelectedDestination );
@@ -389,3 +391,3 @@ void SettingsImpl :: changeDestinationDetails()
{
- vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
+ Destination *d = dataMgr->getDestination( destinations->currentText() );
@@ -413,3 +415,3 @@ void SettingsImpl :: changeDestinationDetails()
{
- dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) );
+ dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) );
destinations->insertItem( newName );