summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp14
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp7
2 files changed, 18 insertions, 3 deletions
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index 3d2c621..417ee95 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -222,50 +222,58 @@ void OIpkg::setConfigItems( OConfItemList *configList )
m_ipkgArgs.noaction = false;
m_ipkgArgs.force_defaults = true;
}
void OIpkg::saveSettings()
{
// Save Ipkg execution options to application configuration file
if ( m_config )
{
m_config->setGroup( "Ipkg" );
m_config->writeEntry( "ExecOptions", m_ipkgExecOptions );
m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity );
}
}
OPackageList *OIpkg::availablePackages( const QString &server )
{
// Load Ipkg configuration info if not already cached
if ( !m_confInfo )
loadConfiguration();
// Build new server list (caller is responsible for deleting)
OPackageList *pl = new OPackageList;
+ // Get directory where server lists are located
+ QString listsDir;
+ OConfItem *confItem = findConfItem( OConfItem::Other, "lists_dir" );
+ if ( confItem )
+ listsDir = confItem->value();
+ else
+ listsDir = IPKG_PKG_PATH;
+
// Open package list file
- QFile f( IPKG_PKG_PATH + "/" + server );
+ QFile f( listsDir + "/" + server );
if ( !f.open( IO_ReadOnly ) )
return NULL;
QTextStream t( &f );
// Process all information in package list file
OPackage *package = NULL;
QString line = t.readLine();
while ( !t.eof() )
{
// Determine key/value pair
int pos = line.find( ':', 0 );
QString key;
if ( pos > -1 )
key = line.mid( 0, pos );
else
key = QString::null;
QString value = line.mid( pos+2, line.length()-pos );
// Allocate new package and insert into list
if ( package == NULL && !key.isEmpty() )
{
package = new OPackage( value );
package->setSource( server );
pl->append( package );
@@ -586,48 +594,52 @@ void OIpkg::loadConfiguration()
// value = value
// features = name (from configuration file)
QString typeStr = line.left( pos - 1 );
OConfItem::Type type;
QString features;
if ( typeStr == "src" )
type = OConfItem::Source;
else if ( typeStr == "src/gz" )
{
type = OConfItem::Source;
features = "Compressed";
}
else if ( typeStr == "dest" )
type = OConfItem::Destination;
else if ( typeStr == "option" )
type = OConfItem::Option;
else if ( typeStr == "arch" )
type = OConfItem::Arch;
else if ( typeStr == "lists_dir" )
{
type = OConfItem::Other;
features = name;
name = typeStr;
+
+ // Default value when not defined
+ if ( value == QString::null || value == "" )
+ value = IPKG_PKG_PATH;
}
else
recognizedOption = false;
// Add to list
if ( recognizedOption )
m_confInfo->append( new OConfItem( type, name, value, features, active ) );
}
}
f.close();
}
}
// Load Ipkg execution options from application configuration file
if ( m_config )
{
m_config->setGroup( "Ipkg" );
m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions );
m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity );
}
}
OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter )
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index d234251..0ad1c82 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -107,54 +107,57 @@ void OIpkgConfigDlg::accept()
if ( confItem )
{
confItem->setValue( m_proxyFtpServer->text() );
confItem->setActive( m_proxyFtpActive->isChecked() );
}
else
m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy",
m_proxyFtpServer->text(), QString::null,
m_proxyFtpActive->isChecked() ) );
confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" );
if ( confItem )
confItem->setValue( m_proxyUsername->text() );
else
m_configs->append( new OConfItem( OConfItem::Option, "proxy_username",
m_proxyUsername->text() ) );
confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" );
if ( confItem )
confItem->setValue( m_proxyPassword->text() );
else
m_configs->append( new OConfItem( OConfItem::Option, "proxy_password",
m_proxyPassword->text() ) );
+ QString listsDir = m_optSourceLists->text();
+ if ( listsDir == QString::null || listsDir == "" )
+ listsDir = "/usr/lib/ipkg/lists"; // TODO - use proper libipkg define
confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" );
if ( confItem )
- confItem->setValue( m_optSourceLists->text() );
+ confItem->setValue( listsDir );
else
m_configs->append( new OConfItem( OConfItem::Other, "lists_dir",
- m_optSourceLists->text(), "name" ) );
+ listsDir, "name" ) );
m_ipkg->setConfigItems( m_configs );
}
// Save options configuration
int options = 0;
if ( m_optForceDepends->isChecked() )
options |= FORCE_DEPENDS;
if ( m_optForceReinstall->isChecked() )
options |= FORCE_REINSTALL;
if ( m_optForceRemove->isChecked() )
options |= FORCE_REMOVE;
if ( m_optForceOverwrite->isChecked() )
options |= FORCE_OVERWRITE;
m_ipkg->setIpkgExecOptions( options );
m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() );
QDialog::accept();
}
void OIpkgConfigDlg::reject()
{
if ( m_configs )
delete m_configs;