-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 | |||
@@ -150,194 +150,202 @@ void OIpkg::setConfigItems( OConfItemList *configList ) | |||
150 | 150 | ||
151 | // Only write out valid conf items | 151 | // Only write out valid conf items |
152 | if ( item->type() != OConfItem::NotDefined ) | 152 | if ( item->type() != OConfItem::NotDefined ) |
153 | { | 153 | { |
154 | QString confLine; | 154 | QString confLine; |
155 | QString name = item->name(); | 155 | QString name = item->name(); |
156 | if ( !item->active() ) | 156 | if ( !item->active() ) |
157 | confLine = "#"; | 157 | confLine = "#"; |
158 | 158 | ||
159 | switch ( item->type() ) | 159 | switch ( item->type() ) |
160 | { | 160 | { |
161 | case OConfItem::Source : | 161 | case OConfItem::Source : |
162 | { | 162 | { |
163 | if ( item->features().contains( "Compressed" ) ) | 163 | if ( item->features().contains( "Compressed" ) ) |
164 | confLine.append( "src/gz" ); | 164 | confLine.append( "src/gz" ); |
165 | else | 165 | else |
166 | confLine.append( "src" ); | 166 | confLine.append( "src" ); |
167 | } | 167 | } |
168 | break; | 168 | break; |
169 | case OConfItem::Destination : confLine.append( "dest" ); break; | 169 | case OConfItem::Destination : confLine.append( "dest" ); break; |
170 | case OConfItem::Option : confLine.append( "option" ); break; | 170 | case OConfItem::Option : confLine.append( "option" ); break; |
171 | case OConfItem::Arch : confLine.append( "arch" ); break; | 171 | case OConfItem::Arch : confLine.append( "arch" ); break; |
172 | case OConfItem::Other : | 172 | case OConfItem::Other : |
173 | { | 173 | { |
174 | // For options w/type = Other, the mapping is as follows: | 174 | // For options w/type = Other, the mapping is as follows: |
175 | // name = typeStr (e.g. "lists_dir") | 175 | // name = typeStr (e.g. "lists_dir") |
176 | // value = value | 176 | // value = value |
177 | // features = name (from configuration file) | 177 | // features = name (from configuration file) |
178 | confLine.append( item->name() ); | 178 | confLine.append( item->name() ); |
179 | name = item->features(); | 179 | name = item->features(); |
180 | } | 180 | } |
181 | break; | 181 | break; |
182 | default : break; | 182 | default : break; |
183 | }; | 183 | }; |
184 | 184 | ||
185 | confStream << confLine << " " << name << " " << item->value() << "\n"; | 185 | confStream << confLine << " " << name << " " << item->value() << "\n"; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
189 | confFile.close(); | 189 | confFile.close(); |
190 | } | 190 | } |
191 | else | 191 | else |
192 | { | 192 | { |
193 | // Problem writing to /etc/ipkg.conf, exit before removing other conf files | 193 | // Problem writing to /etc/ipkg.conf, exit before removing other conf files |
194 | return; | 194 | return; |
195 | } | 195 | } |
196 | 196 | ||
197 | // Delete /etc/ipkg/*.conf files (/etc/ipkg.conf should now have all settings | 197 | // Delete /etc/ipkg/*.conf files (/etc/ipkg.conf should now have all settings |
198 | QStringList confFiles; | 198 | QStringList confFiles; |
199 | QDir confDir( IPKG_CONF_DIR ); | 199 | QDir confDir( IPKG_CONF_DIR ); |
200 | if ( confDir.exists() ) | 200 | if ( confDir.exists() ) |
201 | { | 201 | { |
202 | confDir.setNameFilter( "*.conf" ); | 202 | confDir.setNameFilter( "*.conf" ); |
203 | confDir.setFilter( QDir::Files ); | 203 | confDir.setFilter( QDir::Files ); |
204 | confFiles = confDir.entryList( "*.conf", QDir::Files ); | 204 | confFiles = confDir.entryList( "*.conf", QDir::Files ); |
205 | 205 | ||
206 | QStringList::Iterator lastFile = confFiles.end(); | 206 | QStringList::Iterator lastFile = confFiles.end(); |
207 | for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) | 207 | for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) |
208 | { | 208 | { |
209 | // Create absolute file path if necessary | 209 | // Create absolute file path if necessary |
210 | QString absFile = (*it); | 210 | QString absFile = (*it); |
211 | if ( !absFile.startsWith( "/" ) ) | 211 | if ( !absFile.startsWith( "/" ) ) |
212 | absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); | 212 | absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); |
213 | 213 | ||
214 | // Delete file | 214 | // Delete file |
215 | QFile::remove( absFile ); | 215 | QFile::remove( absFile ); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | // Reinitialize libipkg to pick up new configuration | 219 | // Reinitialize libipkg to pick up new configuration |
220 | ipkg_deinit( &m_ipkgArgs ); | 220 | ipkg_deinit( &m_ipkgArgs ); |
221 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); | 221 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); |
222 | m_ipkgArgs.noaction = false; | 222 | m_ipkgArgs.noaction = false; |
223 | m_ipkgArgs.force_defaults = true; | 223 | m_ipkgArgs.force_defaults = true; |
224 | } | 224 | } |
225 | 225 | ||
226 | void OIpkg::saveSettings() | 226 | void OIpkg::saveSettings() |
227 | { | 227 | { |
228 | // Save Ipkg execution options to application configuration file | 228 | // Save Ipkg execution options to application configuration file |
229 | if ( m_config ) | 229 | if ( m_config ) |
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; |
264 | QString value = line.mid( pos+2, line.length()-pos ); | 272 | QString value = line.mid( pos+2, line.length()-pos ); |
265 | 273 | ||
266 | // Allocate new package and insert into list | 274 | // Allocate new package and insert into list |
267 | if ( package == NULL && !key.isEmpty() ) | 275 | if ( package == NULL && !key.isEmpty() ) |
268 | { | 276 | { |
269 | package = new OPackage( value ); | 277 | package = new OPackage( value ); |
270 | package->setSource( server ); | 278 | package->setSource( server ); |
271 | pl->append( package ); | 279 | pl->append( package ); |
272 | } | 280 | } |
273 | 281 | ||
274 | // Update package data | 282 | // Update package data |
275 | if ( key == "Package" ) | 283 | if ( key == "Package" ) |
276 | package->setName( value ); | 284 | package->setName( value ); |
277 | else if ( key == "Version" ) | 285 | else if ( key == "Version" ) |
278 | package->setVersion( value ); | 286 | package->setVersion( value ); |
279 | else if ( key == "Section" ) | 287 | else if ( key == "Section" ) |
280 | package->setCategory( value ); | 288 | package->setCategory( value ); |
281 | //DataManager::setAvailableCategories( value ); | 289 | //DataManager::setAvailableCategories( value ); |
282 | else if ( key.isEmpty() && value.isEmpty() ) | 290 | else if ( key.isEmpty() && value.isEmpty() ) |
283 | package = NULL; | 291 | package = NULL; |
284 | 292 | ||
285 | // Skip past all description lines | 293 | // Skip past all description lines |
286 | if ( key == "Description" ) | 294 | if ( key == "Description" ) |
287 | { | 295 | { |
288 | line = t.readLine(); | 296 | line = t.readLine(); |
289 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) | 297 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) |
290 | line = t.readLine(); | 298 | line = t.readLine(); |
291 | } | 299 | } |
292 | else | 300 | else |
293 | line = t.readLine(); | 301 | line = t.readLine(); |
294 | } | 302 | } |
295 | 303 | ||
296 | f.close(); | 304 | f.close(); |
297 | 305 | ||
298 | return pl; | 306 | return pl; |
299 | } | 307 | } |
300 | 308 | ||
301 | OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath ) | 309 | OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath ) |
302 | { | 310 | { |
303 | // Load Ipkg configuration info if not already cached | 311 | // Load Ipkg configuration info if not already cached |
304 | if ( !m_confInfo ) | 312 | if ( !m_confInfo ) |
305 | loadConfiguration(); | 313 | loadConfiguration(); |
306 | 314 | ||
307 | // Build new server list (caller is responsible for deleting) | 315 | // Build new server list (caller is responsible for deleting) |
308 | OPackageList *pl = new OPackageList; | 316 | OPackageList *pl = new OPackageList; |
309 | 317 | ||
310 | // Open status file | 318 | // Open status file |
311 | QString path = destPath; | 319 | QString path = destPath; |
312 | if ( path.right( 1 ) != "/" ) | 320 | if ( path.right( 1 ) != "/" ) |
313 | path.append( "/" ); | 321 | path.append( "/" ); |
314 | path.append( IPKG_STATUS_PATH ); | 322 | path.append( IPKG_STATUS_PATH ); |
315 | 323 | ||
316 | QFile f( path ); | 324 | QFile f( path ); |
317 | if ( !f.open( IO_ReadOnly ) ) | 325 | if ( !f.open( IO_ReadOnly ) ) |
318 | return NULL; | 326 | return NULL; |
319 | QTextStream t( &f ); | 327 | QTextStream t( &f ); |
320 | 328 | ||
321 | // Process all information in status file | 329 | // Process all information in status file |
322 | bool newPackage = false; | 330 | bool newPackage = false; |
323 | QString line = t.readLine(); | 331 | QString line = t.readLine(); |
324 | QString name; | 332 | QString name; |
325 | QString version; | 333 | QString version; |
326 | QString status; | 334 | QString status; |
327 | 335 | ||
328 | while ( !t.eof() ) | 336 | while ( !t.eof() ) |
329 | { | 337 | { |
330 | // Determine key/value pair | 338 | // Determine key/value pair |
331 | int pos = line.find( ':', 0 ); | 339 | int pos = line.find( ':', 0 ); |
332 | QString key; | 340 | QString key; |
333 | if ( pos > -1 ) | 341 | if ( pos > -1 ) |
334 | key = line.mid( 0, pos ); | 342 | key = line.mid( 0, pos ); |
335 | else | 343 | else |
336 | key = QString::null; | 344 | key = QString::null; |
337 | QString value = line.mid( pos+2, line.length()-pos ); | 345 | QString value = line.mid( pos+2, line.length()-pos ); |
338 | 346 | ||
339 | // Allocate new package and insert into list | 347 | // Allocate new package and insert into list |
340 | if ( newPackage && !key.isEmpty() ) | 348 | if ( newPackage && !key.isEmpty() ) |
341 | { | 349 | { |
342 | // Add to list only if it has a valid name and is installed | 350 | // Add to list only if it has a valid name and is installed |
343 | if ( !name.isNull() && status.contains( " installed" ) ) | 351 | if ( !name.isNull() && status.contains( " installed" ) ) |
@@ -514,192 +522,196 @@ void OIpkg::ipkgStatus( char *status ) | |||
514 | 522 | ||
515 | void OIpkg::ipkgList( char *filelist ) | 523 | void OIpkg::ipkgList( char *filelist ) |
516 | { | 524 | { |
517 | emit signalIpkgList( filelist ); | 525 | emit signalIpkgList( filelist ); |
518 | } | 526 | } |
519 | 527 | ||
520 | void OIpkg::loadConfiguration() | 528 | void OIpkg::loadConfiguration() |
521 | { | 529 | { |
522 | if ( m_confInfo ) | 530 | if ( m_confInfo ) |
523 | delete m_confInfo; | 531 | delete m_confInfo; |
524 | 532 | ||
525 | // Load configuration item list | 533 | // Load configuration item list |
526 | m_confInfo = new OConfItemList(); | 534 | m_confInfo = new OConfItemList(); |
527 | 535 | ||
528 | QStringList confFiles; | 536 | QStringList confFiles; |
529 | QDir confDir( IPKG_CONF_DIR ); | 537 | QDir confDir( IPKG_CONF_DIR ); |
530 | if ( confDir.exists() ) | 538 | if ( confDir.exists() ) |
531 | { | 539 | { |
532 | confDir.setNameFilter( "*.conf" ); | 540 | confDir.setNameFilter( "*.conf" ); |
533 | confDir.setFilter( QDir::Files ); | 541 | confDir.setFilter( QDir::Files ); |
534 | confFiles = confDir.entryList( "*.conf", QDir::Files ); | 542 | confFiles = confDir.entryList( "*.conf", QDir::Files ); |
535 | } | 543 | } |
536 | confFiles << IPKG_CONF; | 544 | confFiles << IPKG_CONF; |
537 | 545 | ||
538 | QStringList::Iterator lastFile = confFiles.end(); | 546 | QStringList::Iterator lastFile = confFiles.end(); |
539 | for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) | 547 | for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) |
540 | { | 548 | { |
541 | // Create absolute file path if necessary | 549 | // Create absolute file path if necessary |
542 | QString absFile = (*it); | 550 | QString absFile = (*it); |
543 | if ( !absFile.startsWith( "/" ) ) | 551 | if ( !absFile.startsWith( "/" ) ) |
544 | absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); | 552 | absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); |
545 | 553 | ||
546 | // Read in file | 554 | // Read in file |
547 | QFile f( absFile ); | 555 | QFile f( absFile ); |
548 | if ( f.open( IO_ReadOnly ) ) | 556 | if ( f.open( IO_ReadOnly ) ) |
549 | { | 557 | { |
550 | QTextStream s( &f ); | 558 | QTextStream s( &f ); |
551 | while ( !s.eof() ) | 559 | while ( !s.eof() ) |
552 | { | 560 | { |
553 | 561 | ||
554 | QString line = s.readLine().simplifyWhiteSpace(); | 562 | QString line = s.readLine().simplifyWhiteSpace(); |
555 | 563 | ||
556 | // Parse line and save info to the conf options list | 564 | // Parse line and save info to the conf options list |
557 | if ( !line.isEmpty() ) | 565 | if ( !line.isEmpty() ) |
558 | { | 566 | { |
559 | // Strip leading comment marker if exists | 567 | // Strip leading comment marker if exists |
560 | bool comment = false; | 568 | bool comment = false; |
561 | if ( line.startsWith( "#" ) ) | 569 | if ( line.startsWith( "#" ) ) |
562 | { | 570 | { |
563 | line.remove( 0, 1 ); | 571 | line.remove( 0, 1 ); |
564 | line = line.simplifyWhiteSpace(); | 572 | line = line.simplifyWhiteSpace(); |
565 | comment = true; | 573 | comment = true; |
566 | } | 574 | } |
567 | 575 | ||
568 | bool recognizedOption = true; | 576 | bool recognizedOption = true; |
569 | int pos = line.find( ' ', 1 ) + 1; | 577 | int pos = line.find( ' ', 1 ) + 1; |
570 | int endpos = line.find( ' ', pos ); | 578 | int endpos = line.find( ' ', pos ); |
571 | 579 | ||
572 | // Name | 580 | // Name |
573 | QString name = line.mid( pos, endpos - pos ); | 581 | QString name = line.mid( pos, endpos - pos ); |
574 | 582 | ||
575 | // Value | 583 | // Value |
576 | QString value = ""; | 584 | QString value = ""; |
577 | if ( endpos > -1 ) | 585 | if ( endpos > -1 ) |
578 | value = line.right( line.length() - endpos - 1 ); | 586 | value = line.right( line.length() - endpos - 1 ); |
579 | 587 | ||
580 | // Active | 588 | // Active |
581 | bool active = !comment; | 589 | bool active = !comment; |
582 | 590 | ||
583 | // Type | 591 | // Type |
584 | // For options w/type = Other, the mapping is as follows: | 592 | // For options w/type = Other, the mapping is as follows: |
585 | // name = typeStr (e.g. "lists_dir") | 593 | // name = typeStr (e.g. "lists_dir") |
586 | // value = value | 594 | // value = value |
587 | // features = name (from configuration file) | 595 | // features = name (from configuration file) |
588 | 596 | ||
589 | QString typeStr = line.left( pos - 1 ); | 597 | QString typeStr = line.left( pos - 1 ); |
590 | OConfItem::Type type; | 598 | OConfItem::Type type; |
591 | QString features; | 599 | QString features; |
592 | if ( typeStr == "src" ) | 600 | if ( typeStr == "src" ) |
593 | type = OConfItem::Source; | 601 | type = OConfItem::Source; |
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 ) |
626 | { | 638 | { |
627 | m_config->setGroup( "Ipkg" ); | 639 | m_config->setGroup( "Ipkg" ); |
628 | m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions ); | 640 | m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions ); |
629 | m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity ); | 641 | m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity ); |
630 | } | 642 | } |
631 | } | 643 | } |
632 | 644 | ||
633 | OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter ) | 645 | OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter ) |
634 | { | 646 | { |
635 | // Load Ipkg configuration info if not already cached | 647 | // Load Ipkg configuration info if not already cached |
636 | if ( !m_confInfo ) | 648 | if ( !m_confInfo ) |
637 | loadConfiguration(); | 649 | loadConfiguration(); |
638 | 650 | ||
639 | // Build new server list (caller is responsible for deleting) | 651 | // Build new server list (caller is responsible for deleting) |
640 | OConfItemList *sl = new OConfItemList; | 652 | OConfItemList *sl = new OConfItemList; |
641 | 653 | ||
642 | // If typefilter is empty, retrieve all items | 654 | // If typefilter is empty, retrieve all items |
643 | bool retrieveAll = ( typefilter == OConfItem::NotDefined ); | 655 | bool retrieveAll = ( typefilter == OConfItem::NotDefined ); |
644 | 656 | ||
645 | // Parse configuration info for servers | 657 | // Parse configuration info for servers |
646 | OConfItemListIterator it( *m_confInfo ); | 658 | OConfItemListIterator it( *m_confInfo ); |
647 | for ( ; it.current(); ++it ) | 659 | for ( ; it.current(); ++it ) |
648 | { | 660 | { |
649 | OConfItem *item = it.current(); | 661 | OConfItem *item = it.current(); |
650 | if ( retrieveAll || item->type() == typefilter ) | 662 | if ( retrieveAll || item->type() == typefilter ) |
651 | { | 663 | { |
652 | sl->append( item ); | 664 | sl->append( item ); |
653 | } | 665 | } |
654 | } | 666 | } |
655 | 667 | ||
656 | return sl; | 668 | return sl; |
657 | } | 669 | } |
658 | 670 | ||
659 | const QString &OIpkg::rootPath() | 671 | const QString &OIpkg::rootPath() |
660 | { | 672 | { |
661 | if ( m_rootPath.isEmpty() ) | 673 | if ( m_rootPath.isEmpty() ) |
662 | { | 674 | { |
663 | OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" ); | 675 | OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" ); |
664 | rootDest ? m_rootPath = rootDest->value() | 676 | rootDest ? m_rootPath = rootDest->value() |
665 | : m_rootPath = '/'; | 677 | : m_rootPath = '/'; |
666 | if ( m_rootPath.right( 1 ) == '/' ) | 678 | if ( m_rootPath.right( 1 ) == '/' ) |
667 | m_rootPath.truncate( m_rootPath.length() - 1 ); | 679 | m_rootPath.truncate( m_rootPath.length() - 1 ); |
668 | } | 680 | } |
669 | return m_rootPath; | 681 | return m_rootPath; |
670 | } | 682 | } |
671 | 683 | ||
672 | void OIpkg::linkPackageDir( const QString &dest ) | 684 | void OIpkg::linkPackageDir( const QString &dest ) |
673 | { | 685 | { |
674 | if ( !dest.isNull() ) | 686 | if ( !dest.isNull() ) |
675 | { | 687 | { |
676 | OConfItem *destConfItem = findConfItem( OConfItem::Destination, dest ); | 688 | OConfItem *destConfItem = findConfItem( OConfItem::Destination, dest ); |
677 | 689 | ||
678 | emit signalIpkgMessage( tr( "Linking packages installed in: %1" ).arg( dest ) ); | 690 | emit signalIpkgMessage( tr( "Linking packages installed in: %1" ).arg( dest ) ); |
679 | 691 | ||
680 | // Set package destination directory | 692 | // Set package destination directory |
681 | QString destDir = destConfItem->value(); | 693 | QString destDir = destConfItem->value(); |
682 | QString destInfoDir = destDir; | 694 | QString destInfoDir = destDir; |
683 | if ( destInfoDir.right( 1 ) != '/' ) | 695 | if ( destInfoDir.right( 1 ) != '/' ) |
684 | destInfoDir.append( '/' ); | 696 | destInfoDir.append( '/' ); |
685 | destInfoDir.append( IPKG_INFO_PATH ); | 697 | destInfoDir.append( IPKG_INFO_PATH ); |
686 | 698 | ||
687 | // Get list of installed packages in destination | 699 | // Get list of installed packages in destination |
688 | QDir packageDir( destInfoDir ); | 700 | QDir packageDir( destInfoDir ); |
689 | QStringList packageFiles; | 701 | QStringList packageFiles; |
690 | if ( packageDir.exists() ) | 702 | if ( packageDir.exists() ) |
691 | { | 703 | { |
692 | packageDir.setNameFilter( "*.list" ); | 704 | packageDir.setNameFilter( "*.list" ); |
693 | packageDir.setFilter( QDir::Files ); | 705 | packageDir.setFilter( QDir::Files ); |
694 | packageFiles = packageDir.entryList( "*.list", QDir::Files ); | 706 | packageFiles = packageDir.entryList( "*.list", QDir::Files ); |
695 | } | 707 | } |
696 | 708 | ||
697 | // Link all files for every package installed in desination | 709 | // Link all files for every package installed in desination |
698 | QStringList::Iterator lastFile = packageFiles.end(); | 710 | QStringList::Iterator lastFile = packageFiles.end(); |
699 | for ( QStringList::Iterator it = packageFiles.begin(); it != lastFile; ++it ) | 711 | for ( QStringList::Iterator it = packageFiles.begin(); it != lastFile; ++it ) |
700 | { | 712 | { |
701 | //emit signalIpkgMessage( QString( "Processing: %1/%2" ).arg( destInfoDir ).arg (*it) ); | 713 | //emit signalIpkgMessage( QString( "Processing: %1/%2" ).arg( destInfoDir ).arg (*it) ); |
702 | QString packageFileName = destInfoDir; | 714 | QString packageFileName = destInfoDir; |
703 | packageFileName.append( '/' ); | 715 | packageFileName.append( '/' ); |
704 | packageFileName.append( (*it) ); | 716 | packageFileName.append( (*it) ); |
705 | QFile packageFile( packageFileName ); | 717 | QFile packageFile( packageFileName ); |
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 | |||
@@ -35,198 +35,201 @@ _;:, .> :=|. This program is free software; you can | |||
35 | 35 | ||
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | 38 | ||
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qgroupbox.h> | 41 | #include <qgroupbox.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
44 | #include <qlistbox.h> | 44 | #include <qlistbox.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qscrollview.h> | 46 | #include <qscrollview.h> |
47 | #include <qwhatsthis.h> | 47 | #include <qwhatsthis.h> |
48 | 48 | ||
49 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) | 49 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) |
50 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 50 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
51 | , m_ipkg( ipkg ) | 51 | , m_ipkg( ipkg ) |
52 | , m_configs( 0l ) | 52 | , m_configs( 0l ) |
53 | , m_installOptions( installOptions ) | 53 | , m_installOptions( installOptions ) |
54 | , m_serverCurrent( -1 ) | 54 | , m_serverCurrent( -1 ) |
55 | , m_destCurrent( -1 ) | 55 | , m_destCurrent( -1 ) |
56 | , m_layout( this, 2, 4 ) | 56 | , m_layout( this, 2, 4 ) |
57 | , m_tabWidget( this ) | 57 | , m_tabWidget( this ) |
58 | { | 58 | { |
59 | setCaption( tr( "Configuration" ) ); | 59 | setCaption( tr( "Configuration" ) ); |
60 | 60 | ||
61 | // Initialize configuration widgets | 61 | // Initialize configuration widgets |
62 | if ( !installOptions ) | 62 | if ( !installOptions ) |
63 | { | 63 | { |
64 | initServerWidget(); | 64 | initServerWidget(); |
65 | initDestinationWidget(); | 65 | initDestinationWidget(); |
66 | initProxyWidget(); | 66 | initProxyWidget(); |
67 | } | 67 | } |
68 | initOptionsWidget(); | 68 | initOptionsWidget(); |
69 | 69 | ||
70 | // Load configuration information | 70 | // Load configuration information |
71 | initData(); | 71 | initData(); |
72 | 72 | ||
73 | // Setup tabs for all info | 73 | // Setup tabs for all info |
74 | m_layout.addWidget( &m_tabWidget ); | 74 | m_layout.addWidget( &m_tabWidget ); |
75 | if ( !m_installOptions ) | 75 | if ( !m_installOptions ) |
76 | { | 76 | { |
77 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); | 77 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); |
78 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); | 78 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); |
79 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); | 79 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); |
80 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 80 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
81 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); | 81 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); |
82 | } | 82 | } |
83 | else | 83 | else |
84 | { | 84 | { |
85 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 85 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | void OIpkgConfigDlg::accept() | 89 | void OIpkgConfigDlg::accept() |
90 | { | 90 | { |
91 | // Save server, destination and proxy configuration | 91 | // Save server, destination and proxy configuration |
92 | if ( !m_installOptions ) | 92 | if ( !m_installOptions ) |
93 | { | 93 | { |
94 | // Update proxy information before saving settings | 94 | // Update proxy information before saving settings |
95 | OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); | 95 | OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); |
96 | if ( confItem ) | 96 | if ( confItem ) |
97 | { | 97 | { |
98 | confItem->setValue( m_proxyHttpServer->text() ); | 98 | confItem->setValue( m_proxyHttpServer->text() ); |
99 | confItem->setActive( m_proxyHttpActive->isChecked() ); | 99 | confItem->setActive( m_proxyHttpActive->isChecked() ); |
100 | } | 100 | } |
101 | else | 101 | else |
102 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", | 102 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", |
103 | m_proxyHttpServer->text(), QString::null, | 103 | m_proxyHttpServer->text(), QString::null, |
104 | m_proxyHttpActive->isChecked() ) ); | 104 | m_proxyHttpActive->isChecked() ) ); |
105 | 105 | ||
106 | confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); | 106 | confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); |
107 | if ( confItem ) | 107 | if ( confItem ) |
108 | { | 108 | { |
109 | confItem->setValue( m_proxyFtpServer->text() ); | 109 | confItem->setValue( m_proxyFtpServer->text() ); |
110 | confItem->setActive( m_proxyFtpActive->isChecked() ); | 110 | confItem->setActive( m_proxyFtpActive->isChecked() ); |
111 | } | 111 | } |
112 | else | 112 | else |
113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", | 113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", |
114 | m_proxyFtpServer->text(), QString::null, | 114 | m_proxyFtpServer->text(), QString::null, |
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() ); |
153 | 156 | ||
154 | QDialog::accept(); | 157 | QDialog::accept(); |
155 | } | 158 | } |
156 | 159 | ||
157 | void OIpkgConfigDlg::reject() | 160 | void OIpkgConfigDlg::reject() |
158 | { | 161 | { |
159 | if ( m_configs ) | 162 | if ( m_configs ) |
160 | delete m_configs; | 163 | delete m_configs; |
161 | } | 164 | } |
162 | 165 | ||
163 | void OIpkgConfigDlg::initServerWidget() | 166 | void OIpkgConfigDlg::initServerWidget() |
164 | { | 167 | { |
165 | m_serverWidget = new QWidget( this ); | 168 | m_serverWidget = new QWidget( this ); |
166 | 169 | ||
167 | // Initialize UI | 170 | // Initialize UI |
168 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); | 171 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); |
169 | QScrollView *sv = new QScrollView( m_serverWidget ); | 172 | QScrollView *sv = new QScrollView( m_serverWidget ); |
170 | vb->addWidget( sv, 0, 0 ); | 173 | vb->addWidget( sv, 0, 0 ); |
171 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 174 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
172 | sv->setFrameStyle( QFrame::NoFrame ); | 175 | sv->setFrameStyle( QFrame::NoFrame ); |
173 | QWidget *container = new QWidget( sv->viewport() ); | 176 | QWidget *container = new QWidget( sv->viewport() ); |
174 | sv->addChild( container ); | 177 | sv->addChild( container ); |
175 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); | 178 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); |
176 | 179 | ||
177 | m_serverList = new QListBox( container ); | 180 | m_serverList = new QListBox( container ); |
178 | QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); | 181 | QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); |
179 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 182 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
180 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); | 183 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); |
181 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); | 184 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); |
182 | 185 | ||
183 | QPixmap pic; | 186 | QPixmap pic; |
184 | pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 187 | pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
185 | QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); | 188 | QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); |
186 | btn->setMinimumHeight( AppLnk::smallIconSize() ); | 189 | btn->setMinimumHeight( AppLnk::smallIconSize() ); |
187 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | 190 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); |
188 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); | 191 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); |
189 | layout->addWidget( btn, 1, 0 ); | 192 | layout->addWidget( btn, 1, 0 ); |
190 | 193 | ||
191 | pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 194 | pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
192 | m_serverEditBtn = new QPushButton( pic, tr( "Edit" ), container ); | 195 | m_serverEditBtn = new QPushButton( pic, tr( "Edit" ), container ); |
193 | m_serverEditBtn->setMinimumHeight( AppLnk::smallIconSize() ); | 196 | m_serverEditBtn->setMinimumHeight( AppLnk::smallIconSize() ); |
194 | m_serverEditBtn->setEnabled( false ); | 197 | m_serverEditBtn->setEnabled( false ); |
195 | QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); | 198 | QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); |
196 | connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); | 199 | connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); |
197 | layout->addWidget( m_serverEditBtn, 1, 1 ); | 200 | layout->addWidget( m_serverEditBtn, 1, 1 ); |
198 | 201 | ||
199 | pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 202 | pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
200 | m_serverDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); | 203 | m_serverDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); |
201 | m_serverDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() ); | 204 | m_serverDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() ); |
202 | m_serverDeleteBtn->setEnabled( false ); | 205 | m_serverDeleteBtn->setEnabled( false ); |
203 | QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); | 206 | QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); |
204 | connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); | 207 | connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); |
205 | layout->addWidget( m_serverDeleteBtn, 1, 2 ); | 208 | layout->addWidget( m_serverDeleteBtn, 1, 2 ); |
206 | } | 209 | } |
207 | 210 | ||
208 | void OIpkgConfigDlg::initDestinationWidget() | 211 | void OIpkgConfigDlg::initDestinationWidget() |
209 | { | 212 | { |
210 | m_destWidget = new QWidget( this ); | 213 | m_destWidget = new QWidget( this ); |
211 | 214 | ||
212 | // Initialize UI | 215 | // Initialize UI |
213 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); | 216 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); |
214 | QScrollView *sv = new QScrollView( m_destWidget ); | 217 | QScrollView *sv = new QScrollView( m_destWidget ); |
215 | vb->addWidget( sv, 0, 0 ); | 218 | vb->addWidget( sv, 0, 0 ); |
216 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 219 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
217 | sv->setFrameStyle( QFrame::NoFrame ); | 220 | sv->setFrameStyle( QFrame::NoFrame ); |
218 | QWidget *container = new QWidget( sv->viewport() ); | 221 | QWidget *container = new QWidget( sv->viewport() ); |
219 | sv->addChild( container ); | 222 | sv->addChild( container ); |
220 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); | 223 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); |
221 | 224 | ||
222 | m_destList = new QListBox( container ); | 225 | m_destList = new QListBox( container ); |
223 | QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); | 226 | QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); |
224 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 227 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
225 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); | 228 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); |
226 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); | 229 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); |
227 | 230 | ||
228 | QPixmap pic; | 231 | QPixmap pic; |
229 | pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 232 | pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
230 | QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); | 233 | QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); |
231 | btn->setMinimumHeight( AppLnk::smallIconSize() ); | 234 | btn->setMinimumHeight( AppLnk::smallIconSize() ); |
232 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | 235 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); |