author | erik <erik> | 2007-02-08 01:45:16 (UTC) |
---|---|---|
committer | erik <erik> | 2007-02-08 01:45:16 (UTC) |
commit | 2e497f7cae45184184e2416114887095735958f5 (patch) (unidiff) | |
tree | a6b399d9bce5854dc7ad6c985b48965cf20680b0 /noncore/settings | |
parent | 853b61f97e718359bef95147ab3c7beb0705acda (diff) | |
download | opie-2e497f7cae45184184e2416114887095735958f5.zip opie-2e497f7cae45184184e2416114887095735958f5.tar.gz opie-2e497f7cae45184184e2416114887095735958f5.tar.bz2 |
Each file in this commit has a problem where it is possible to dereference
a pointer without that pointer being valid. This commit fixes each instance
of that.
-rw-r--r-- | noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp | 3 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp index 9069c09..3fd877f 100644 --- a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp +++ b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp | |||
@@ -202,128 +202,131 @@ void OTSDPAttribute::setInt(const OTSDPAttribute::int128_t & val) { | |||
202 | void OTSDPAttribute::setUInt(const uint128_t & val) { | 202 | void OTSDPAttribute::setUInt(const uint128_t & val) { |
203 | type = UINT; | 203 | type = UINT; |
204 | Value.uintVal = new uint128_t(val); | 204 | Value.uintVal = new uint128_t(val); |
205 | } | 205 | } |
206 | 206 | ||
207 | void OTSDPAttribute::setUUID(const OTUUID & val) { | 207 | void OTSDPAttribute::setUUID(const OTUUID & val) { |
208 | type = UUID; | 208 | type = UUID; |
209 | Value.uuidVal = new OTUUID( val ); | 209 | Value.uuidVal = new OTUUID( val ); |
210 | } | 210 | } |
211 | 211 | ||
212 | void OTSDPAttribute::setBool(bool val) { | 212 | void OTSDPAttribute::setBool(bool val) { |
213 | type = BOOLEAN; | 213 | type = BOOLEAN; |
214 | Value.boolVal = val; | 214 | Value.boolVal = val; |
215 | } | 215 | } |
216 | 216 | ||
217 | void OTSDPAttribute::setString( const QString & val) { | 217 | void OTSDPAttribute::setString( const QString & val) { |
218 | type = STRING; | 218 | type = STRING; |
219 | Value.stringVal = new QString( val ); | 219 | Value.stringVal = new QString( val ); |
220 | } | 220 | } |
221 | 221 | ||
222 | void OTSDPAttribute::setURL( const QString & val) { | 222 | void OTSDPAttribute::setURL( const QString & val) { |
223 | type = URL; | 223 | type = URL; |
224 | Value.stringVal = new QString(val); | 224 | Value.stringVal = new QString(val); |
225 | } | 225 | } |
226 | 226 | ||
227 | void OTSDPAttribute::setSequence(const AttributeVector& val) { | 227 | void OTSDPAttribute::setSequence(const AttributeVector& val) { |
228 | type = SEQUENCE; | 228 | type = SEQUENCE; |
229 | Value.sequenceVal = new AttributeVector(); | 229 | Value.sequenceVal = new AttributeVector(); |
230 | Value.sequenceVal->setAutoDelete( TRUE ); | 230 | Value.sequenceVal->setAutoDelete( TRUE ); |
231 | *Value.sequenceVal = val; | 231 | *Value.sequenceVal = val; |
232 | } | 232 | } |
233 | 233 | ||
234 | void OTSDPAttribute::setAlternative(const AttributeVector& val) { | 234 | void OTSDPAttribute::setAlternative(const AttributeVector& val) { |
235 | type = ALTERNATIVE; | 235 | type = ALTERNATIVE; |
236 | Value.sequenceVal = new AttributeVector(); | 236 | Value.sequenceVal = new AttributeVector(); |
237 | Value.sequenceVal->setAutoDelete( TRUE ); | 237 | Value.sequenceVal->setAutoDelete( TRUE ); |
238 | *Value.sequenceVal = val; | 238 | *Value.sequenceVal = val; |
239 | } | 239 | } |
240 | 240 | ||
241 | QString OTSDPAttribute::getString() { | 241 | QString OTSDPAttribute::getString() { |
242 | assert(type == STRING); | 242 | assert(type == STRING); |
243 | return *Value.stringVal; | 243 | return *Value.stringVal; |
244 | } | 244 | } |
245 | 245 | ||
246 | QString OTSDPAttribute::getURL() { | 246 | QString OTSDPAttribute::getURL() { |
247 | assert(type == URL); | 247 | assert(type == URL); |
248 | return *Value.stringVal; | 248 | return *Value.stringVal; |
249 | } | 249 | } |
250 | 250 | ||
251 | const OTSDPAttribute::int128_t & OTSDPAttribute::getInt() { | 251 | const OTSDPAttribute::int128_t & OTSDPAttribute::getInt() { |
252 | assert(type == INT); | 252 | assert(type == INT); |
253 | return *Value.intVal; | 253 | return *Value.intVal; |
254 | } | 254 | } |
255 | 255 | ||
256 | 256 | ||
257 | const OTSDPAttribute::uint128_t & OTSDPAttribute::getUInt() { | 257 | const OTSDPAttribute::uint128_t & OTSDPAttribute::getUInt() { |
258 | assert(type == UINT); | 258 | assert(type == UINT); |
259 | return *Value.uintVal; | 259 | return *Value.uintVal; |
260 | } | 260 | } |
261 | 261 | ||
262 | const OTUUID & OTSDPAttribute::getUUID() { | 262 | const OTUUID & OTSDPAttribute::getUUID() { |
263 | assert(type == UUID); | 263 | assert(type == UUID); |
264 | return *Value.uuidVal; | 264 | return *Value.uuidVal; |
265 | } | 265 | } |
266 | 266 | ||
267 | bool OTSDPAttribute::getBool() { | 267 | bool OTSDPAttribute::getBool() { |
268 | assert(type == BOOLEAN); | 268 | assert(type == BOOLEAN); |
269 | return Value.boolVal; | 269 | return Value.boolVal; |
270 | } | 270 | } |
271 | 271 | ||
272 | AttributeVector * OTSDPAttribute::getSequence() { | 272 | AttributeVector * OTSDPAttribute::getSequence() { |
273 | assert(type == SEQUENCE); | 273 | assert(type == SEQUENCE); |
274 | return Value.sequenceVal; | 274 | return Value.sequenceVal; |
275 | } | 275 | } |
276 | 276 | ||
277 | AttributeVector * OTSDPAttribute::getAlternative() { | 277 | AttributeVector * OTSDPAttribute::getAlternative() { |
278 | assert(type == ALTERNATIVE); | 278 | assert(type == ALTERNATIVE); |
279 | return Value.sequenceVal; | 279 | return Value.sequenceVal; |
280 | } | 280 | } |
281 | 281 | ||
282 | UUIDVector OTSDPAttribute::getAllUUIDs() { | 282 | UUIDVector OTSDPAttribute::getAllUUIDs() { |
283 | 283 | ||
284 | UUIDVector uuids; | 284 | UUIDVector uuids; |
285 | 285 | ||
286 | if (getType() == UUID) { | 286 | if (getType() == UUID) { |
287 | uuids.resize( uuids.size()+1 ); | 287 | uuids.resize( uuids.size()+1 ); |
288 | uuids[uuids.size()-1] = getUUID(); | 288 | uuids[uuids.size()-1] = getUUID(); |
289 | } else { | 289 | } else { |
290 | AttributeVector * subAttributes = 0 ; | 290 | AttributeVector * subAttributes = 0 ; |
291 | 291 | ||
292 | if (getType() == SEQUENCE) { | 292 | if (getType() == SEQUENCE) { |
293 | subAttributes = getSequence(); | 293 | subAttributes = getSequence(); |
294 | } else if (getType() == ALTERNATIVE) { | 294 | } else if (getType() == ALTERNATIVE) { |
295 | subAttributes = getAlternative(); | 295 | subAttributes = getAlternative(); |
296 | } | 296 | } |
297 | 297 | ||
298 | if (!subAttributes) | ||
299 | return 0; | ||
300 | |||
298 | int os; | 301 | int os; |
299 | for( unsigned int i = 0; i < subAttributes->count(); i++ ) { | 302 | for( unsigned int i = 0; i < subAttributes->count(); i++ ) { |
300 | UUIDVector subUUIDs = (*subAttributes)[i]->getAllUUIDs(); | 303 | UUIDVector subUUIDs = (*subAttributes)[i]->getAllUUIDs(); |
301 | 304 | ||
302 | os = uuids.size(); | 305 | os = uuids.size(); |
303 | uuids.resize( uuids.size()+subUUIDs.count() ); | 306 | uuids.resize( uuids.size()+subUUIDs.count() ); |
304 | 307 | ||
305 | for( unsigned int k = 0; k < subUUIDs.count(); k++ ) { | 308 | for( unsigned int k = 0; k < subUUIDs.count(); k++ ) { |
306 | uuids[os + k] = subUUIDs[k]; | 309 | uuids[os + k] = subUUIDs[k]; |
307 | } | 310 | } |
308 | } | 311 | } |
309 | } | 312 | } |
310 | return uuids; | 313 | return uuids; |
311 | } | 314 | } |
312 | 315 | ||
313 | static char * Attr2String[] = { | 316 | static char * Attr2String[] = { |
314 | "Invalid", | 317 | "Invalid", |
315 | "Nil", | 318 | "Nil", |
316 | "UInt", | 319 | "UInt", |
317 | "int", | 320 | "int", |
318 | "UUID", | 321 | "UUID", |
319 | "Boolean", | 322 | "Boolean", |
320 | "String", | 323 | "String", |
321 | "Sequence", | 324 | "Sequence", |
322 | "Alternative", | 325 | "Alternative", |
323 | "URL", | 326 | "URL", |
324 | "Unknown" | 327 | "Unknown" |
325 | }; | 328 | }; |
326 | 329 | ||
327 | const char * OTSDPAttribute::getTypeString() { | 330 | const char * OTSDPAttribute::getTypeString() { |
328 | return Attr2String[type]; | 331 | return Attr2String[type]; |
329 | } | 332 | } |
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index d014378..78a18f7 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -343,207 +343,209 @@ void OIpkgConfigDlg::initOptionsWidget() | |||
343 | m_optForceRecursive = new QCheckBox( tr( "Force Recursive" ), container ); | 343 | m_optForceRecursive = new QCheckBox( tr( "Force Recursive" ), container ); |
344 | QWhatsThis::add( m_optForceRecursive, tr( "Tap here to enable or disable the '-recursive' option for Ipkg." ) ); | 344 | QWhatsThis::add( m_optForceRecursive, tr( "Tap here to enable or disable the '-recursive' option for Ipkg." ) ); |
345 | layout->addMultiCellWidget( m_optForceRecursive, 4, 4, 0, 1 ); | 345 | layout->addMultiCellWidget( m_optForceRecursive, 4, 4, 0, 1 ); |
346 | 346 | ||
347 | m_optVerboseWget = new QCheckBox( tr( "Verbose fetch" ), container ); | 347 | m_optVerboseWget = new QCheckBox( tr( "Verbose fetch" ), container ); |
348 | QWhatsThis::add( m_optVerboseWget, tr( "Tap here to enable or disable the '-verbose_wget' option for Ipkg." ) ); | 348 | QWhatsThis::add( m_optVerboseWget, tr( "Tap here to enable or disable the '-verbose_wget' option for Ipkg." ) ); |
349 | layout->addMultiCellWidget( m_optVerboseWget, 5, 5, 0, 1 ); | 349 | layout->addMultiCellWidget( m_optVerboseWget, 5, 5, 0, 1 ); |
350 | 350 | ||
351 | QLabel *l = new QLabel( tr( "Information level:" ), container ); | 351 | QLabel *l = new QLabel( tr( "Information level:" ), container ); |
352 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); | 352 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); |
353 | layout->addMultiCellWidget( l, 6, 6, 0, 1 ); | 353 | layout->addMultiCellWidget( l, 6, 6, 0, 1 ); |
354 | 354 | ||
355 | m_optVerboseIpkg = new QComboBox( container ); | 355 | m_optVerboseIpkg = new QComboBox( container ); |
356 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); | 356 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); |
357 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); | 357 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); |
358 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); | 358 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); |
359 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); | 359 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); |
360 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); | 360 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); |
361 | layout->addMultiCellWidget( m_optVerboseIpkg, 7, 7, 0, 1 ); | 361 | layout->addMultiCellWidget( m_optVerboseIpkg, 7, 7, 0, 1 ); |
362 | 362 | ||
363 | l = new QLabel( tr( "Package source lists directory:" ), container ); | 363 | l = new QLabel( tr( "Package source lists directory:" ), container ); |
364 | QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) ); | 364 | QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) ); |
365 | layout->addMultiCellWidget( l, 8, 8, 0, 1 ); | 365 | layout->addMultiCellWidget( l, 8, 8, 0, 1 ); |
366 | 366 | ||
367 | m_optSourceLists = new QLineEdit( container ); | 367 | m_optSourceLists = new QLineEdit( container ); |
368 | QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) ); | 368 | QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) ); |
369 | layout->addWidget( m_optSourceLists, 9, 0 ); | 369 | layout->addWidget( m_optSourceLists, 9, 0 ); |
370 | 370 | ||
371 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ), | 371 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ), |
372 | QString::null, container ); | 372 | QString::null, container ); |
373 | btn->setMinimumHeight( AppLnk::smallIconSize()+4 ); | 373 | btn->setMinimumHeight( AppLnk::smallIconSize()+4 ); |
374 | btn->setMaximumWidth( btn->height() ); | 374 | btn->setMaximumWidth( btn->height() ); |
375 | QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); | 375 | QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); |
376 | connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); | 376 | connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); |
377 | layout->addWidget( btn, 9, 1 ); | 377 | layout->addWidget( btn, 9, 1 ); |
378 | 378 | ||
379 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 379 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
380 | } | 380 | } |
381 | 381 | ||
382 | void OIpkgConfigDlg::initData() | 382 | void OIpkgConfigDlg::initData() |
383 | { | 383 | { |
384 | // Read ipkg configuration (server/destination/proxy) information | 384 | // Read ipkg configuration (server/destination/proxy) information |
385 | if ( m_ipkg && !m_installOptions ) | 385 | if ( m_ipkg && !m_installOptions ) |
386 | { | 386 | { |
387 | m_configs = m_ipkg->configItems(); | 387 | m_configs = m_ipkg->configItems(); |
388 | if ( m_configs ) | 388 | if ( m_configs ) |
389 | { | 389 | { |
390 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) | 390 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) |
391 | { | 391 | { |
392 | OConfItem *config = configIt.current(); | 392 | OConfItem *config = configIt.current(); |
393 | 393 | ||
394 | // Add configuration item to the appropriate dialog controls | 394 | // Add configuration item to the appropriate dialog controls |
395 | if ( config ) | 395 | if ( config ) |
396 | { | 396 | { |
397 | switch ( config->type() ) | 397 | switch ( config->type() ) |
398 | { | 398 | { |
399 | case OConfItem::Source : m_serverList->insertItem( config->name() ); break; | 399 | case OConfItem::Source : m_serverList->insertItem( config->name() ); break; |
400 | case OConfItem::Destination : m_destList->insertItem( config->name() ); break; | 400 | case OConfItem::Destination : m_destList->insertItem( config->name() ); break; |
401 | case OConfItem::Option : | 401 | case OConfItem::Option : |
402 | { | 402 | { |
403 | if ( config->name() == "http_proxy" ) | 403 | if ( config->name() == "http_proxy" ) |
404 | { | 404 | { |
405 | m_proxyHttpServer->setText( config->value() ); | 405 | m_proxyHttpServer->setText( config->value() ); |
406 | m_proxyHttpActive->setChecked( config->active() ); | 406 | m_proxyHttpActive->setChecked( config->active() ); |
407 | } | 407 | } |
408 | else if ( config->name() == "ftp_proxy" ) | 408 | else if ( config->name() == "ftp_proxy" ) |
409 | { | 409 | { |
410 | m_proxyFtpServer->setText( config->value() ); | 410 | m_proxyFtpServer->setText( config->value() ); |
411 | m_proxyFtpActive->setChecked( config->active() ); | 411 | m_proxyFtpActive->setChecked( config->active() ); |
412 | } | 412 | } |
413 | else if ( config->name() == "proxy_username" ) | 413 | else if ( config->name() == "proxy_username" ) |
414 | { | 414 | { |
415 | m_proxyUsername->setText( config->value() ); | 415 | m_proxyUsername->setText( config->value() ); |
416 | } | 416 | } |
417 | else if ( config->name() == "proxy_password" ) | 417 | else if ( config->name() == "proxy_password" ) |
418 | { | 418 | { |
419 | m_proxyPassword->setText( config->value() ); | 419 | m_proxyPassword->setText( config->value() ); |
420 | } | 420 | } |
421 | } | 421 | } |
422 | break; | 422 | break; |
423 | case OConfItem::Other : | 423 | case OConfItem::Other : |
424 | { | 424 | { |
425 | if ( config->name() == "lists_dir" ) | 425 | if ( config->name() == "lists_dir" ) |
426 | m_optSourceLists->setText( config->value() ); | 426 | m_optSourceLists->setText( config->value() ); |
427 | else // TODO - use proper libipkg define | 427 | else // TODO - use proper libipkg define |
428 | m_optSourceLists->setText( "/usr/lib/ipkg/lists" ); | 428 | m_optSourceLists->setText( "/usr/lib/ipkg/lists" ); |
429 | } | 429 | } |
430 | break; | 430 | break; |
431 | default : break; | 431 | default : break; |
432 | }; | 432 | }; |
433 | } | 433 | } |
434 | } | 434 | } |
435 | } | 435 | } |
436 | } | 436 | } |
437 | 437 | ||
438 | // Get Ipkg execution options | 438 | // Get Ipkg execution options |
439 | int options = m_ipkg->ipkgExecOptions(); | 439 | int options = 0; |
440 | if ( m_ipkg ) | ||
441 | options = m_ipkg->ipkgExecOptions(); | ||
440 | if ( options & FORCE_DEPENDS ) | 442 | if ( options & FORCE_DEPENDS ) |
441 | m_optForceDepends->setChecked( true ); | 443 | m_optForceDepends->setChecked( true ); |
442 | if ( options & FORCE_REINSTALL ) | 444 | if ( options & FORCE_REINSTALL ) |
443 | m_optForceReinstall->setChecked( true ); | 445 | m_optForceReinstall->setChecked( true ); |
444 | if ( options & FORCE_REMOVE ) | 446 | if ( options & FORCE_REMOVE ) |
445 | m_optForceRemove->setChecked( true ); | 447 | m_optForceRemove->setChecked( true ); |
446 | if ( options & FORCE_OVERWRITE ) | 448 | if ( options & FORCE_OVERWRITE ) |
447 | m_optForceOverwrite->setChecked( true ); | 449 | m_optForceOverwrite->setChecked( true ); |
448 | if ( options & FORCE_RECURSIVE ) | 450 | if ( options & FORCE_RECURSIVE ) |
449 | m_optForceRecursive->setChecked( true ); | 451 | m_optForceRecursive->setChecked( true ); |
450 | if ( options & FORCE_VERBOSE_WGET ) | 452 | if ( options & FORCE_VERBOSE_WGET ) |
451 | m_optVerboseWget->setChecked( true ); | 453 | m_optVerboseWget->setChecked( true ); |
452 | 454 | ||
453 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); | 455 | m_optVerboseIpkg->setCurrentItem( ( m_ipkg ? m_ipkg->ipkgExecVerbosity() : 0 ) ); |
454 | } | 456 | } |
455 | 457 | ||
456 | void OIpkgConfigDlg::slotServerSelected( int index ) | 458 | void OIpkgConfigDlg::slotServerSelected( int index ) |
457 | { | 459 | { |
458 | m_serverCurrent = index; | 460 | m_serverCurrent = index; |
459 | 461 | ||
460 | // Enable Edit and Delete buttons | 462 | // Enable Edit and Delete buttons |
461 | m_serverEditBtn->setEnabled( true ); | 463 | m_serverEditBtn->setEnabled( true ); |
462 | m_serverDeleteBtn->setEnabled( true ); | 464 | m_serverDeleteBtn->setEnabled( true ); |
463 | } | 465 | } |
464 | 466 | ||
465 | void OIpkgConfigDlg::slotServerNew() | 467 | void OIpkgConfigDlg::slotServerNew() |
466 | { | 468 | { |
467 | OConfItem *server = new OConfItem( OConfItem::Source ); | 469 | OConfItem *server = new OConfItem( OConfItem::Source ); |
468 | 470 | ||
469 | OIpkgServerDlg dlg( server, this ); | 471 | OIpkgServerDlg dlg( server, this ); |
470 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 472 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
471 | { | 473 | { |
472 | // Add to configuration option list | 474 | // Add to configuration option list |
473 | m_configs->append( server ); | 475 | m_configs->append( server ); |
474 | m_configs->sort(); | 476 | m_configs->sort(); |
475 | 477 | ||
476 | // Add to server list | 478 | // Add to server list |
477 | m_serverList->insertItem( server->name() ); | 479 | m_serverList->insertItem( server->name() ); |
478 | m_serverList->setCurrentItem( m_serverList->count() ); | 480 | m_serverList->setCurrentItem( m_serverList->count() ); |
479 | } | 481 | } |
480 | else | 482 | else |
481 | delete server; | 483 | delete server; |
482 | } | 484 | } |
483 | 485 | ||
484 | void OIpkgConfigDlg::slotServerEdit() | 486 | void OIpkgConfigDlg::slotServerEdit() |
485 | { | 487 | { |
486 | // Find selected server in list | 488 | // Find selected server in list |
487 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); | 489 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); |
488 | 490 | ||
489 | // Edit server | 491 | // Edit server |
490 | if ( server ) | 492 | if ( server ) |
491 | { | 493 | { |
492 | QString origName = server->name(); | 494 | QString origName = server->name(); |
493 | OIpkgServerDlg dlg( server, this ); | 495 | OIpkgServerDlg dlg( server, this ); |
494 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 496 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
495 | { | 497 | { |
496 | // Check to see if name has changed, if so update the server list | 498 | // Check to see if name has changed, if so update the server list |
497 | if ( server->name() != origName ) | 499 | if ( server->name() != origName ) |
498 | m_serverList->changeItem( server->name(), m_serverCurrent ); | 500 | m_serverList->changeItem( server->name(), m_serverCurrent ); |
499 | } | 501 | } |
500 | } | 502 | } |
501 | } | 503 | } |
502 | 504 | ||
503 | void OIpkgConfigDlg::slotServerDelete() | 505 | void OIpkgConfigDlg::slotServerDelete() |
504 | { | 506 | { |
505 | // Find selected server in list | 507 | // Find selected server in list |
506 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); | 508 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); |
507 | 509 | ||
508 | // Delete server | 510 | // Delete server |
509 | if ( server ) | 511 | if ( server ) |
510 | { | 512 | { |
511 | m_configs->removeRef( server ); | 513 | m_configs->removeRef( server ); |
512 | m_serverList->removeItem( m_serverCurrent ); | 514 | m_serverList->removeItem( m_serverCurrent ); |
513 | } | 515 | } |
514 | } | 516 | } |
515 | 517 | ||
516 | void OIpkgConfigDlg::slotDestSelected( int index ) | 518 | void OIpkgConfigDlg::slotDestSelected( int index ) |
517 | { | 519 | { |
518 | m_destCurrent = index; | 520 | m_destCurrent = index; |
519 | 521 | ||
520 | // Enable Edit and Delete buttons | 522 | // Enable Edit and Delete buttons |
521 | m_destEditBtn->setEnabled( true ); | 523 | m_destEditBtn->setEnabled( true ); |
522 | m_destDeleteBtn->setEnabled( true ); | 524 | m_destDeleteBtn->setEnabled( true ); |
523 | } | 525 | } |
524 | 526 | ||
525 | void OIpkgConfigDlg::slotDestNew() | 527 | void OIpkgConfigDlg::slotDestNew() |
526 | { | 528 | { |
527 | OConfItem *dest = new OConfItem( OConfItem::Destination ); | 529 | OConfItem *dest = new OConfItem( OConfItem::Destination ); |
528 | 530 | ||
529 | OIpkgDestDlg dlg( dest, this ); | 531 | OIpkgDestDlg dlg( dest, this ); |
530 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 532 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
531 | { | 533 | { |
532 | // Add to configuration option list | 534 | // Add to configuration option list |
533 | m_configs->append( dest ); | 535 | m_configs->append( dest ); |
534 | m_configs->sort(); | 536 | m_configs->sort(); |
535 | 537 | ||
536 | // Add to destination list | 538 | // Add to destination list |
537 | m_destList->insertItem( dest->name() ); | 539 | m_destList->insertItem( dest->name() ); |
538 | m_destList->setCurrentItem( m_destList->count() ); | 540 | m_destList->setCurrentItem( m_destList->count() ); |
539 | } | 541 | } |
540 | else | 542 | else |
541 | delete dest; | 543 | delete dest; |
542 | } | 544 | } |
543 | 545 | ||
544 | void OIpkgConfigDlg::slotDestEdit() | 546 | void OIpkgConfigDlg::slotDestEdit() |
545 | { | 547 | { |
546 | // Find selected destination in list | 548 | // Find selected destination in list |
547 | OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); | 549 | OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); |
548 | 550 | ||
549 | // Edit destination | 551 | // Edit destination |