summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp34
-rw-r--r--noncore/settings/aqpkg/datamgr.h2
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp32
3 files changed, 36 insertions, 32 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index 089c3e3..f342aff 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -126,44 +126,44 @@ void DataManager :: loadServers()
QString key = alias;
key += "_linkToRoot";
linkToRoot = cfg.readBoolEntry( key, true );
#endif
d.linkToRoot( linkToRoot );
destList.push_back( d );
}
}
}
fclose( fp );
- vector<Server>::iterator it;
- for ( it = serverList.begin() ; it != serverList.end() ; ++it )
- reloadServerData( it->getServerName() );
+ reloadServerData( );
}
-void DataManager :: reloadServerData( const char *serverName )
+void DataManager :: reloadServerData( )
{
- Server *s = getServer( serverName );
- // Now we've read the config file in we need to read the servers
- // The local server is a special case. This holds the contents of the
- // status files the number of which depends on how many destinations
- // we've set up
- // The other servers files hold the contents of the server package list
- if ( s->getServerName() == LOCAL_SERVER )
- s->readStatusFile( destList );
- else if ( s->getServerName() == LOCAL_IPKGS )
- s->readLocalIpks( getServer( LOCAL_SERVER ) );
- else
- s->readPackageFile( getServer( LOCAL_SERVER ) );
-
+ vector<Server>::iterator it = serverList.begin();
+ for ( it = serverList.begin() ; it != serverList.end() ; ++it )
+ {
+ // Now we've read the config file in we need to read the servers
+ // The local server is a special case. This holds the contents of the
+ // status files the number of which depends on how many destinations
+ // we've set up
+ // The other servers files hold the contents of the server package list
+ if ( it->getServerName() == LOCAL_SERVER )
+ it->readStatusFile( destList );
+ else if ( it->getServerName() == LOCAL_IPKGS )
+ it->readLocalIpks( getServer( LOCAL_SERVER ) );
+ else
+ it->readPackageFile( getServer( LOCAL_SERVER ) );
+ }
}
void DataManager :: writeOutIpkgConf()
{
QString ipkg_conf = IPKG_CONF;
ofstream out( ipkg_conf );
out << "# Written by AQPkg" << endl;
out << "# Must have one or more source entries of the form:" << endl;
out << "#" << endl;
out << "# src <src-name> <source-url>" << endl;
out << "#" << endl;
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h
index eb802b5..8c6fb0d 100644
--- a/noncore/settings/aqpkg/datamgr.h
+++ b/noncore/settings/aqpkg/datamgr.h
@@ -40,25 +40,25 @@ public:
void setActiveServer( const QString &act ) { activeServer = act; }
QString &getActiveServer( ) { return activeServer; }
Server *getLocalServer() { return getServer( LOCAL_SERVER ); }
vector<Server> &getServerList() { return serverList; }
Server *getServer( const char *name );
vector<Destination> &getDestinationList() { return destList; }
Destination *getDestination( const char *name );
void loadServers();
- void reloadServerData( const char *sn );
+ void reloadServerData( );
void writeOutIpkgConf();
private:
QString activeServer;
vector<Server> serverList;
vector<Destination> destList;
};
#endif
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 02e4e73..b5d7352 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -206,44 +206,45 @@ void NetworkPackageManager :: serverSelected( int )
// display packages
QString serverName = serversList->currentText();
currentlySelectedServer = serverName;
#ifdef QWS
// read download directory from config file
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
cfg.writeEntry( "selectedServer", currentlySelectedServer );
#endif
Server *s = dataMgr->getServer( serverName );
-// dataMgr->setActiveServer( serverName );
vector<Package> &list = s->getPackageList();
vector<Package>::iterator it;
for ( it = list.begin() ; it != list.end() ; ++it )
{
+
QString text = "";
// If the local server, only display installed packages
if ( serverName == LOCAL_SERVER && !it->isInstalled() )
continue;
text += it->getPackageName();
if ( it->isInstalled() )
{
text += " (installed)";
// If a different version of package is available, postfix it with an *
if ( it->getVersion() != it->getInstalledVersion() )
{
+
if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 )
text += "*";
}
}
QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox );
if ( it->isInstalled() )
{
QString destName = "";
if ( it->getLocalPackage() )
{
@@ -255,29 +256,36 @@ void NetworkPackageManager :: serverSelected( int )
if ( it->getInstalledTo() )
destName = it->getInstalledTo()->getDestinationName();
}
if ( destName != "" )
new QCheckListItem( item, QString( "Installed To - " ) + destName );
}
if ( !it->isPackageStoredLocally() )
new QCheckListItem( item, QString( "Description - " ) + it->getDescription() );
else
new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() );
- new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() );
- if ( it->getLocalPackage() )
- {
- if ( it->isInstalled() )
- new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() );
+ if ( serverName == LOCAL_SERVER )
+ {
+ new QCheckListItem( item, QString( "V. Installed - " ) + it->getVersion() );
+ }
+ else
+ {
+ new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() );
+ if ( it->getLocalPackage() )
+ {
+ if ( it->isInstalled() )
+ new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() );
+ }
}
packagesList->insertItem( item );
}
// If the local server or the local ipkgs server disable the download button
if ( serverName == LOCAL_SERVER )
{
upgrade->setEnabled( false );
download->setText( "Download" );
download->setEnabled( false );
}
else if ( serverName == LOCAL_IPKGS )
@@ -308,25 +316,25 @@ void NetworkPackageManager :: updateServer()
// Disable buttons to stop silly people clicking lots on them :)
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
Ipkg ipkg;
ipkg.setOption( "update" );
InstallDlgImpl dlg( &ipkg, "Refreshing server package lists", this, "Upgrade", true );
dlg.showDlg();
// Reload data
- dataMgr->reloadServerData( serversList->currentText() );
+ dataMgr->reloadServerData();
serverSelected(-1);
// delete progDlg;
}
void NetworkPackageManager :: upgradePackages()
{
// We're gonna do an upgrade of all packages
// First warn user that this isn't recommended
QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n";
QMessageBox warn("Warning", text, QMessageBox::Warning,
QMessageBox::Yes,
QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
@@ -337,27 +345,25 @@ void NetworkPackageManager :: upgradePackages()
{
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
// Now run upgrade
Ipkg ipkg;
ipkg.setOption( "upgrade" );
InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true );
dlg.showDlg();
// Reload data
- dataMgr->reloadServerData( LOCAL_SERVER );
-
- dataMgr->reloadServerData( serversList->currentText() );
+ dataMgr->reloadServerData();
serverSelected(-1);
}
}
void NetworkPackageManager :: downloadPackage()
{
if ( download->text() == "Download" )
{
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
@@ -427,25 +433,25 @@ void NetworkPackageManager :: downloadPackage()
// if (there is a (installed), remove it
pos = name.find( "(installed)" );
if ( pos > 0 )
name.truncate( pos - 1 );
Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name );
QFile f( p->getFilename() );
f.remove();
}
}
}
- dataMgr->reloadServerData( LOCAL_IPKGS );
+ dataMgr->reloadServerData();
serverSelected( -1 );
}
void NetworkPackageManager :: applyChanges()
{
stickyOption = "";
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
// Now for each selected item
@@ -468,27 +474,25 @@ void NetworkPackageManager :: applyChanges()
// Nothing to do
QMessageBox::information( this, "Nothing to do",
"No packages selected", "OK" );
return;
}
// do the stuff
InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true );
dlg.showDlg();
// Reload data
- dataMgr->reloadServerData( LOCAL_SERVER );
-
- dataMgr->reloadServerData( serversList->currentText() );
+ dataMgr->reloadServerData();
serverSelected(-1);
#ifdef QWS
// Finally let the main system update itself
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString lf = QString::null;
e << lf;
#endif
}
// decide what to do - either remove, upgrade or install
// Current rules: