author | drw <drw> | 2005-03-11 16:32:21 (UTC) |
---|---|---|
committer | drw <drw> | 2005-03-11 16:32:21 (UTC) |
commit | abcc52307706794537bb579daff1a82668ebde00 (patch) (unidiff) | |
tree | 4c25d4ea425a22d0b881c79418ff5b51b829be49 | |
parent | 3dc7db665775377453f999a3eaee8c225af45a79 (diff) | |
download | opie-abcc52307706794537bb579daff1a82668ebde00.zip opie-abcc52307706794537bb579daff1a82668ebde00.tar.gz opie-abcc52307706794537bb579daff1a82668ebde00.tar.bz2 |
Fix bug where lists_dir was not being honored at startup - thanks to hrw for identifying, also provide default value for lists_dir when none is entered in the configuration dialog
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 14 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 7 |
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 | |||
@@ -230,34 +230,42 @@ void OIpkg::saveSettings() | |||
230 | { | 230 | { |
231 | m_config->setGroup( "Ipkg" ); | 231 | m_config->setGroup( "Ipkg" ); |
232 | m_config->writeEntry( "ExecOptions", m_ipkgExecOptions ); | 232 | m_config->writeEntry( "ExecOptions", m_ipkgExecOptions ); |
233 | m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity ); | 233 | m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity ); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | OPackageList *OIpkg::availablePackages( const QString &server ) | 237 | OPackageList *OIpkg::availablePackages( const QString &server ) |
238 | { | 238 | { |
239 | // Load Ipkg configuration info if not already cached | 239 | // Load Ipkg configuration info if not already cached |
240 | if ( !m_confInfo ) | 240 | if ( !m_confInfo ) |
241 | loadConfiguration(); | 241 | loadConfiguration(); |
242 | 242 | ||
243 | // Build new server list (caller is responsible for deleting) | 243 | // Build new server list (caller is responsible for deleting) |
244 | OPackageList *pl = new OPackageList; | 244 | OPackageList *pl = new OPackageList; |
245 | 245 | ||
246 | // Get directory where server lists are located | ||
247 | QString listsDir; | ||
248 | OConfItem *confItem = findConfItem( OConfItem::Other, "lists_dir" ); | ||
249 | if ( confItem ) | ||
250 | listsDir = confItem->value(); | ||
251 | else | ||
252 | listsDir = IPKG_PKG_PATH; | ||
253 | |||
246 | // Open package list file | 254 | // Open package list file |
247 | QFile f( IPKG_PKG_PATH + "/" + server ); | 255 | QFile f( listsDir + "/" + server ); |
248 | if ( !f.open( IO_ReadOnly ) ) | 256 | if ( !f.open( IO_ReadOnly ) ) |
249 | return NULL; | 257 | return NULL; |
250 | QTextStream t( &f ); | 258 | QTextStream t( &f ); |
251 | 259 | ||
252 | // Process all information in package list file | 260 | // Process all information in package list file |
253 | OPackage *package = NULL; | 261 | OPackage *package = NULL; |
254 | QString line = t.readLine(); | 262 | QString line = t.readLine(); |
255 | while ( !t.eof() ) | 263 | while ( !t.eof() ) |
256 | { | 264 | { |
257 | // Determine key/value pair | 265 | // Determine key/value pair |
258 | int pos = line.find( ':', 0 ); | 266 | int pos = line.find( ':', 0 ); |
259 | QString key; | 267 | QString key; |
260 | if ( pos > -1 ) | 268 | if ( pos > -1 ) |
261 | key = line.mid( 0, pos ); | 269 | key = line.mid( 0, pos ); |
262 | else | 270 | else |
263 | key = QString::null; | 271 | key = QString::null; |
@@ -594,32 +602,36 @@ void OIpkg::loadConfiguration() | |||
594 | else if ( typeStr == "src/gz" ) | 602 | else if ( typeStr == "src/gz" ) |
595 | { | 603 | { |
596 | type = OConfItem::Source; | 604 | type = OConfItem::Source; |
597 | features = "Compressed"; | 605 | features = "Compressed"; |
598 | } | 606 | } |
599 | else if ( typeStr == "dest" ) | 607 | else if ( typeStr == "dest" ) |
600 | type = OConfItem::Destination; | 608 | type = OConfItem::Destination; |
601 | else if ( typeStr == "option" ) | 609 | else if ( typeStr == "option" ) |
602 | type = OConfItem::Option; | 610 | type = OConfItem::Option; |
603 | else if ( typeStr == "arch" ) | 611 | else if ( typeStr == "arch" ) |
604 | type = OConfItem::Arch; | 612 | type = OConfItem::Arch; |
605 | else if ( typeStr == "lists_dir" ) | 613 | else if ( typeStr == "lists_dir" ) |
606 | { | 614 | { |
607 | type = OConfItem::Other; | 615 | type = OConfItem::Other; |
608 | features = name; | 616 | features = name; |
609 | name = typeStr; | 617 | name = typeStr; |
618 | |||
619 | // Default value when not defined | ||
620 | if ( value == QString::null || value == "" ) | ||
621 | value = IPKG_PKG_PATH; | ||
610 | } | 622 | } |
611 | else | 623 | else |
612 | recognizedOption = false; | 624 | recognizedOption = false; |
613 | 625 | ||
614 | // Add to list | 626 | // Add to list |
615 | if ( recognizedOption ) | 627 | if ( recognizedOption ) |
616 | m_confInfo->append( new OConfItem( type, name, value, features, active ) ); | 628 | m_confInfo->append( new OConfItem( type, name, value, features, active ) ); |
617 | } | 629 | } |
618 | } | 630 | } |
619 | 631 | ||
620 | f.close(); | 632 | f.close(); |
621 | } | 633 | } |
622 | } | 634 | } |
623 | 635 | ||
624 | // Load Ipkg execution options from application configuration file | 636 | // Load Ipkg execution options from application configuration file |
625 | if ( m_config ) | 637 | if ( m_config ) |
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 | |||
@@ -115,38 +115,41 @@ void OIpkgConfigDlg::accept() | |||
115 | m_proxyFtpActive->isChecked() ) ); | 115 | m_proxyFtpActive->isChecked() ) ); |
116 | 116 | ||
117 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); | 117 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); |
118 | if ( confItem ) | 118 | if ( confItem ) |
119 | confItem->setValue( m_proxyUsername->text() ); | 119 | confItem->setValue( m_proxyUsername->text() ); |
120 | else | 120 | else |
121 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", | 121 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", |
122 | m_proxyUsername->text() ) ); | 122 | m_proxyUsername->text() ) ); |
123 | 123 | ||
124 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); | 124 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); |
125 | if ( confItem ) | 125 | if ( confItem ) |
126 | confItem->setValue( m_proxyPassword->text() ); | 126 | confItem->setValue( m_proxyPassword->text() ); |
127 | else | 127 | else |
128 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", | 128 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", |
129 | m_proxyPassword->text() ) ); | 129 | m_proxyPassword->text() ) ); |
130 | 130 | ||
131 | QString listsDir = m_optSourceLists->text(); | ||
132 | if ( listsDir == QString::null || listsDir == "" ) | ||
133 | listsDir = "/usr/lib/ipkg/lists"; // TODO - use proper libipkg define | ||
131 | confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); | 134 | confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); |
132 | if ( confItem ) | 135 | if ( confItem ) |
133 | confItem->setValue( m_optSourceLists->text() ); | 136 | confItem->setValue( listsDir ); |
134 | else | 137 | else |
135 | m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", | 138 | m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", |
136 | m_optSourceLists->text(), "name" ) ); | 139 | listsDir, "name" ) ); |
137 | 140 | ||
138 | m_ipkg->setConfigItems( m_configs ); | 141 | m_ipkg->setConfigItems( m_configs ); |
139 | } | 142 | } |
140 | 143 | ||
141 | // Save options configuration | 144 | // Save options configuration |
142 | int options = 0; | 145 | int options = 0; |
143 | if ( m_optForceDepends->isChecked() ) | 146 | if ( m_optForceDepends->isChecked() ) |
144 | options |= FORCE_DEPENDS; | 147 | options |= FORCE_DEPENDS; |
145 | if ( m_optForceReinstall->isChecked() ) | 148 | if ( m_optForceReinstall->isChecked() ) |
146 | options |= FORCE_REINSTALL; | 149 | options |= FORCE_REINSTALL; |
147 | if ( m_optForceRemove->isChecked() ) | 150 | if ( m_optForceRemove->isChecked() ) |
148 | options |= FORCE_REMOVE; | 151 | options |= FORCE_REMOVE; |
149 | if ( m_optForceOverwrite->isChecked() ) | 152 | if ( m_optForceOverwrite->isChecked() ) |
150 | options |= FORCE_OVERWRITE; | 153 | options |= FORCE_OVERWRITE; |
151 | m_ipkg->setIpkgExecOptions( options ); | 154 | m_ipkg->setIpkgExecOptions( options ); |
152 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); | 155 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); |