-rw-r--r-- | kaddressbook/kabcore.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 | ||||
-rw-r--r-- | kaddressbook/xxportselectdialog.cpp | 11 |
3 files changed, 13 insertions, 8 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index e34951a..ce5c755 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2328,428 +2328,431 @@ void KABCore::showLicence() | |||
2328 | void KABCore::manageCategories( ) | 2328 | void KABCore::manageCategories( ) |
2329 | { | 2329 | { |
2330 | KABCatPrefs* cp = new KABCatPrefs(); | 2330 | KABCatPrefs* cp = new KABCatPrefs(); |
2331 | cp->show(); | 2331 | cp->show(); |
2332 | int w =cp->sizeHint().width() ; | 2332 | int w =cp->sizeHint().width() ; |
2333 | int h = cp->sizeHint().height() ; | 2333 | int h = cp->sizeHint().height() ; |
2334 | int dw = QApplication::desktop()->width(); | 2334 | int dw = QApplication::desktop()->width(); |
2335 | int dh = QApplication::desktop()->height(); | 2335 | int dh = QApplication::desktop()->height(); |
2336 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2336 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2337 | if ( !cp->exec() ) { | 2337 | if ( !cp->exec() ) { |
2338 | delete cp; | 2338 | delete cp; |
2339 | return; | 2339 | return; |
2340 | } | 2340 | } |
2341 | int count = 0; | 2341 | int count = 0; |
2342 | int cc = 0; | 2342 | int cc = 0; |
2343 | message( i18n("Please wait, processing categories...")); | 2343 | message( i18n("Please wait, processing categories...")); |
2344 | if ( cp->addCat() ) { | 2344 | if ( cp->addCat() ) { |
2345 | KABC::AddressBook::Iterator it; | 2345 | KABC::AddressBook::Iterator it; |
2346 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2346 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2347 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2347 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2348 | ++cc; | 2348 | ++cc; |
2349 | if ( cc %10 == 0) | 2349 | if ( cc %10 == 0) |
2350 | message(i18n("Processing contact #%1").arg(cc)); | 2350 | message(i18n("Processing contact #%1").arg(cc)); |
2351 | QStringList catIncList = (*it).categories(); | 2351 | QStringList catIncList = (*it).categories(); |
2352 | int i; | 2352 | int i; |
2353 | for( i = 0; i< catIncList.count(); ++i ) { | 2353 | for( i = 0; i< catIncList.count(); ++i ) { |
2354 | if ( !catList.contains (catIncList[i])) { | 2354 | if ( !catList.contains (catIncList[i])) { |
2355 | catList.append( catIncList[i] ); | 2355 | catList.append( catIncList[i] ); |
2356 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2356 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2357 | ++count; | 2357 | ++count; |
2358 | } | 2358 | } |
2359 | } | 2359 | } |
2360 | } | 2360 | } |
2361 | catList.sort(); | 2361 | catList.sort(); |
2362 | KABPrefs::instance()->mCustomCategories = catList; | 2362 | KABPrefs::instance()->mCustomCategories = catList; |
2363 | KABPrefs::instance()->writeConfig(); | 2363 | KABPrefs::instance()->writeConfig(); |
2364 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2364 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2365 | } else { | 2365 | } else { |
2366 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2366 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2367 | QStringList catIncList; | 2367 | QStringList catIncList; |
2368 | QStringList newCatList; | 2368 | QStringList newCatList; |
2369 | KABC::AddressBook::Iterator it; | 2369 | KABC::AddressBook::Iterator it; |
2370 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2370 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2371 | ++cc; | 2371 | ++cc; |
2372 | if ( cc %10 == 0) | 2372 | if ( cc %10 == 0) |
2373 | message(i18n("Processing contact #%1").arg(cc)); | 2373 | message(i18n("Processing contact #%1").arg(cc)); |
2374 | QStringList catIncList = (*it).categories(); | 2374 | QStringList catIncList = (*it).categories(); |
2375 | int i; | 2375 | int i; |
2376 | if ( catIncList.count() ) { | 2376 | if ( catIncList.count() ) { |
2377 | newCatList.clear(); | 2377 | newCatList.clear(); |
2378 | for( i = 0; i< catIncList.count(); ++i ) { | 2378 | for( i = 0; i< catIncList.count(); ++i ) { |
2379 | if ( catList.contains (catIncList[i])) { | 2379 | if ( catList.contains (catIncList[i])) { |
2380 | newCatList.append( catIncList[i] ); | 2380 | newCatList.append( catIncList[i] ); |
2381 | } | 2381 | } |
2382 | } | 2382 | } |
2383 | newCatList.sort(); | 2383 | newCatList.sort(); |
2384 | (*it).setCategories( newCatList ); | 2384 | (*it).setCategories( newCatList ); |
2385 | mAddressBook->insertAddressee( (*it) ); | 2385 | mAddressBook->insertAddressee( (*it) ); |
2386 | } | 2386 | } |
2387 | } | 2387 | } |
2388 | setModified( true ); | 2388 | setModified( true ); |
2389 | mViewManager->refreshView(); | 2389 | mViewManager->refreshView(); |
2390 | message( i18n("Removing categories done!")); | 2390 | message( i18n("Removing categories done!")); |
2391 | } | 2391 | } |
2392 | delete cp; | 2392 | delete cp; |
2393 | } | 2393 | } |
2394 | void KABCore::removeVoice() | 2394 | void KABCore::removeVoice() |
2395 | { | 2395 | { |
2396 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2396 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2397 | return; | 2397 | return; |
2398 | XXPortSelectDialog dlg( this, false, this ); | 2398 | XXPortSelectDialog dlg( this, false, this ); |
2399 | if ( !dlg.exec() ) | 2399 | if ( !dlg.exec() ) |
2400 | return; | 2400 | return; |
2401 | mAddressBook->setUntagged(); | 2401 | mAddressBook->setUntagged(); |
2402 | dlg.tagSelected(); | 2402 | dlg.tagSelected(); |
2403 | message(i18n("Removing voice..."), false ); | 2403 | message(i18n("Removing voice..."), false ); |
2404 | KABC::AddressBook::Iterator it; | 2404 | KABC::AddressBook::Iterator it; |
2405 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2405 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2406 | if ( (*it).tagged() ) { | 2406 | if ( (*it).tagged() ) { |
2407 | (*it).removeVoice(); | 2407 | (*it).removeVoice(); |
2408 | } | 2408 | } |
2409 | } | 2409 | } |
2410 | message(i18n("Refreshing view...") ); | 2410 | message(i18n("Refreshing view...") ); |
2411 | qApp->processEvents(); | 2411 | qApp->processEvents(); |
2412 | mViewManager->refreshView( "" ); | 2412 | mViewManager->refreshView( "" ); |
2413 | Addressee add; | 2413 | Addressee add; |
2414 | mDetails->setAddressee( add ); | 2414 | mDetails->setAddressee( add ); |
2415 | message(i18n("Remove voice completed!") ); | 2415 | message(i18n("Remove voice completed!") ); |
2416 | 2416 | ||
2417 | 2417 | ||
2418 | 2418 | ||
2419 | } | 2419 | } |
2420 | 2420 | ||
2421 | void KABCore::setFormattedName() | 2421 | void KABCore::setFormattedName() |
2422 | { | 2422 | { |
2423 | KABFormatPrefs setpref; | 2423 | KABFormatPrefs setpref; |
2424 | if ( !setpref.exec() ) { | 2424 | if ( !setpref.exec() ) { |
2425 | return; | 2425 | return; |
2426 | } | 2426 | } |
2427 | XXPortSelectDialog dlg( this, false, this ); | 2427 | XXPortSelectDialog dlg( this, false, this ); |
2428 | if ( !dlg.exec() ) | 2428 | if ( !dlg.exec() ) |
2429 | return; | 2429 | return; |
2430 | mAddressBook->setUntagged(); | 2430 | mAddressBook->setUntagged(); |
2431 | dlg.tagSelected(); | 2431 | dlg.tagSelected(); |
2432 | int count = 0; | 2432 | int count = 0; |
2433 | KABC::AddressBook::Iterator it; | 2433 | KABC::AddressBook::Iterator it; |
2434 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2434 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2435 | if ( (*it).tagged() ) { | 2435 | if ( (*it).tagged() ) { |
2436 | ++count; | 2436 | ++count; |
2437 | if ( count %10 == 0 ) | 2437 | if ( count %10 == 0 ) |
2438 | message(i18n("Changing contact #%1").arg( count ) ); | 2438 | message(i18n("Changing contact #%1").arg( count ) ); |
2439 | qApp->processEvents(); | 2439 | qApp->processEvents(); |
2440 | QString fName; | 2440 | QString fName; |
2441 | if ( setpref.simple->isChecked() ) | 2441 | if ( setpref.simple->isChecked() ) |
2442 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2442 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2443 | else if ( setpref.full->isChecked() ) | 2443 | else if ( setpref.full->isChecked() ) |
2444 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2444 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2445 | else if ( setpref.reverse->isChecked() ) | 2445 | else if ( setpref.reverse->isChecked() ) |
2446 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2446 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2447 | else | 2447 | else |
2448 | fName = (*it).organization(); | 2448 | fName = (*it).organization(); |
2449 | if ( setpref.setCompany->isChecked() ) | 2449 | if ( setpref.setCompany->isChecked() ) |
2450 | if ( fName.isEmpty() || fName =="," ) | 2450 | if ( fName.isEmpty() || fName =="," ) |
2451 | fName = (*it).organization(); | 2451 | fName = (*it).organization(); |
2452 | (*it).setFormattedName( fName ); | 2452 | (*it).setFormattedName( fName ); |
2453 | } | 2453 | } |
2454 | } | 2454 | } |
2455 | message(i18n("Refreshing view...") ); | 2455 | message(i18n("Refreshing view...") ); |
2456 | qApp->processEvents(); | 2456 | qApp->processEvents(); |
2457 | mViewManager->refreshView( "" ); | 2457 | mViewManager->refreshView( "" ); |
2458 | Addressee add; | 2458 | Addressee add; |
2459 | mDetails->setAddressee( add ); | 2459 | mDetails->setAddressee( add ); |
2460 | message(i18n("Setting formatted name completed!") ); | 2460 | message(i18n("Setting formatted name completed!") ); |
2461 | } | 2461 | } |
2462 | 2462 | ||
2463 | void KABCore::clipboardDataChanged() | 2463 | void KABCore::clipboardDataChanged() |
2464 | { | 2464 | { |
2465 | 2465 | ||
2466 | if ( mReadWrite ) | 2466 | if ( mReadWrite ) |
2467 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2467 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2468 | 2468 | ||
2469 | } | 2469 | } |
2470 | 2470 | ||
2471 | void KABCore::updateActionMenu() | 2471 | void KABCore::updateActionMenu() |
2472 | { | 2472 | { |
2473 | UndoStack *undo = UndoStack::instance(); | 2473 | UndoStack *undo = UndoStack::instance(); |
2474 | RedoStack *redo = RedoStack::instance(); | 2474 | RedoStack *redo = RedoStack::instance(); |
2475 | 2475 | ||
2476 | if ( undo->isEmpty() ) | 2476 | if ( undo->isEmpty() ) |
2477 | mActionUndo->setText( i18n( "Undo" ) ); | 2477 | mActionUndo->setText( i18n( "Undo" ) ); |
2478 | else | 2478 | else |
2479 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2479 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2480 | 2480 | ||
2481 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2481 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2482 | 2482 | ||
2483 | if ( !redo->top() ) | 2483 | if ( !redo->top() ) |
2484 | mActionRedo->setText( i18n( "Redo" ) ); | 2484 | mActionRedo->setText( i18n( "Redo" ) ); |
2485 | else | 2485 | else |
2486 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2486 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2487 | 2487 | ||
2488 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2488 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2489 | } | 2489 | } |
2490 | 2490 | ||
2491 | void KABCore::configureKeyBindings() | 2491 | void KABCore::configureKeyBindings() |
2492 | { | 2492 | { |
2493 | #ifndef KAB_EMBEDDED | 2493 | #ifndef KAB_EMBEDDED |
2494 | KKeyDialog::configure( actionCollection(), true ); | 2494 | KKeyDialog::configure( actionCollection(), true ); |
2495 | #else //KAB_EMBEDDED | 2495 | #else //KAB_EMBEDDED |
2496 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2496 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2497 | #endif //KAB_EMBEDDED | 2497 | #endif //KAB_EMBEDDED |
2498 | } | 2498 | } |
2499 | 2499 | ||
2500 | #ifdef KAB_EMBEDDED | 2500 | #ifdef KAB_EMBEDDED |
2501 | void KABCore::configureResources() | 2501 | void KABCore::configureResources() |
2502 | { | 2502 | { |
2503 | KRES::KCMKResources dlg( this, "" , 0 ); | 2503 | KRES::KCMKResources dlg( this, "" , 0 ); |
2504 | 2504 | ||
2505 | if ( !dlg.exec() ) | 2505 | if ( !dlg.exec() ) |
2506 | return; | 2506 | return; |
2507 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2507 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2508 | } | 2508 | } |
2509 | #endif //KAB_EMBEDDED | 2509 | #endif //KAB_EMBEDDED |
2510 | 2510 | ||
2511 | 2511 | ||
2512 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2512 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2513 | * for the attendees list of an event. | 2513 | * for the attendees list of an event. |
2514 | */ | 2514 | */ |
2515 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2515 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2516 | { | 2516 | { |
2517 | 2517 | ||
2518 | bool ok = false; | 2518 | bool ok = false; |
2519 | mEmailSourceChannel = sourceChannel; | 2519 | mEmailSourceChannel = sourceChannel; |
2520 | mEmailSourceUID = uid; | ||
2521 | callContactdialog(); | ||
2522 | #if 0 | ||
2520 | int wid = uid.toInt( &ok ); | 2523 | int wid = uid.toInt( &ok ); |
2521 | qDebug("UID %s ", uid.latin1()); | 2524 | qDebug("UID %s ", uid.latin1()); |
2522 | if ( ok ) { | 2525 | if ( ok ) { |
2523 | if ( wid != QApplication::desktop()->width() ) { | 2526 | if ( wid != QApplication::desktop()->width() ) { |
2524 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); | 2527 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); |
2525 | message( i18n("Resizing, please wait...") ); | 2528 | message( i18n("Resizing, please wait...") ); |
2526 | mMainWindow->showMinimized(); | 2529 | mMainWindow->showMinimized(); |
2527 | /* | 2530 | /* |
2528 | { | 2531 | { |
2529 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2532 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2530 | } | 2533 | } |
2531 | */ | 2534 | */ |
2532 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); | 2535 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); |
2533 | return; | 2536 | return; |
2534 | } | 2537 | } |
2535 | 2538 | ||
2536 | } else { | 2539 | } else { |
2537 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); | 2540 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); |
2538 | } | 2541 | } |
2539 | callContactdialog(); | 2542 | callContactdialog(); |
2540 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2543 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2541 | 2544 | #endif | |
2542 | } | 2545 | } |
2543 | void KABCore::resizeAndCallContactdialog() | 2546 | void KABCore::resizeAndCallContactdialog() |
2544 | { | 2547 | { |
2545 | updateMainWindow(); | 2548 | updateMainWindow(); |
2546 | QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) ); | 2549 | QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) ); |
2547 | } | 2550 | } |
2548 | 2551 | ||
2549 | void KABCore::callContactdialog() | 2552 | void KABCore::callContactdialog() |
2550 | { | 2553 | { |
2551 | QStringList nameList; | 2554 | QStringList nameList; |
2552 | QStringList emailList; | 2555 | QStringList emailList; |
2553 | QStringList uidList; | 2556 | QStringList uidList; |
2554 | qDebug("WIDTH %d ", QApplication::desktop()->width() ); | 2557 | qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); |
2555 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2558 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2556 | uint i=0; | 2559 | uint i=0; |
2557 | for (i=0; i < list.count(); i++) | 2560 | for (i=0; i < list.count(); i++) |
2558 | { | 2561 | { |
2559 | nameList.append(list[i].realName()); | 2562 | nameList.append(list[i].realName()); |
2560 | emailList.append(list[i].preferredEmail()); | 2563 | emailList.append(list[i].preferredEmail()); |
2561 | uidList.append(list[i].uid()); | 2564 | uidList.append(list[i].uid()); |
2562 | } | 2565 | } |
2563 | QString uid = "unnamed"; | 2566 | QString uid = mEmailSourceUID; |
2564 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); | 2567 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); |
2565 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); | 2568 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); |
2566 | 2569 | ||
2567 | } | 2570 | } |
2568 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2571 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2569 | * to put them into the calendar. | 2572 | * to put them into the calendar. |
2570 | */ | 2573 | */ |
2571 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2574 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2572 | { | 2575 | { |
2573 | // qDebug("KABCore::requestForBirthdayList"); | 2576 | // qDebug("KABCore::requestForBirthdayList"); |
2574 | QStringList birthdayList; | 2577 | QStringList birthdayList; |
2575 | QStringList anniversaryList; | 2578 | QStringList anniversaryList; |
2576 | QStringList realNameList; | 2579 | QStringList realNameList; |
2577 | QStringList preferredEmailList; | 2580 | QStringList preferredEmailList; |
2578 | QStringList assembledNameList; | 2581 | QStringList assembledNameList; |
2579 | QStringList uidList; | 2582 | QStringList uidList; |
2580 | 2583 | ||
2581 | KABC::AddressBook::Iterator it; | 2584 | KABC::AddressBook::Iterator it; |
2582 | 2585 | ||
2583 | int count = 0; | 2586 | int count = 0; |
2584 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2587 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2585 | ++count; | 2588 | ++count; |
2586 | } | 2589 | } |
2587 | QProgressBar bar(count,0 ); | 2590 | QProgressBar bar(count,0 ); |
2588 | int w = 300; | 2591 | int w = 300; |
2589 | if ( QApplication::desktop()->width() < 320 ) | 2592 | if ( QApplication::desktop()->width() < 320 ) |
2590 | w = 220; | 2593 | w = 220; |
2591 | int h = bar.sizeHint().height() ; | 2594 | int h = bar.sizeHint().height() ; |
2592 | int dw = QApplication::desktop()->width(); | 2595 | int dw = QApplication::desktop()->width(); |
2593 | int dh = QApplication::desktop()->height(); | 2596 | int dh = QApplication::desktop()->height(); |
2594 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2597 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2595 | bar.show(); | 2598 | bar.show(); |
2596 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2599 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2597 | qApp->processEvents(); | 2600 | qApp->processEvents(); |
2598 | 2601 | ||
2599 | QDate bday; | 2602 | QDate bday; |
2600 | QString anni; | 2603 | QString anni; |
2601 | QString formattedbday; | 2604 | QString formattedbday; |
2602 | 2605 | ||
2603 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2606 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2604 | { | 2607 | { |
2605 | if ( ! bar.isVisible() ) | 2608 | if ( ! bar.isVisible() ) |
2606 | return; | 2609 | return; |
2607 | bar.setProgress( count++ ); | 2610 | bar.setProgress( count++ ); |
2608 | qApp->processEvents(); | 2611 | qApp->processEvents(); |
2609 | bday = (*it).birthday().date(); | 2612 | bday = (*it).birthday().date(); |
2610 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2613 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2611 | 2614 | ||
2612 | if ( bday.isValid() || !anni.isEmpty()) | 2615 | if ( bday.isValid() || !anni.isEmpty()) |
2613 | { | 2616 | { |
2614 | if (bday.isValid()) | 2617 | if (bday.isValid()) |
2615 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2618 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2616 | else | 2619 | else |
2617 | formattedbday = "NOTVALID"; | 2620 | formattedbday = "NOTVALID"; |
2618 | if (anni.isEmpty()) | 2621 | if (anni.isEmpty()) |
2619 | anni = "INVALID"; | 2622 | anni = "INVALID"; |
2620 | 2623 | ||
2621 | birthdayList.append(formattedbday); | 2624 | birthdayList.append(formattedbday); |
2622 | anniversaryList.append(anni); //should be ISODate | 2625 | anniversaryList.append(anni); //should be ISODate |
2623 | realNameList.append((*it).realName()); | 2626 | realNameList.append((*it).realName()); |
2624 | preferredEmailList.append((*it).preferredEmail()); | 2627 | preferredEmailList.append((*it).preferredEmail()); |
2625 | assembledNameList.append((*it).assembledName()); | 2628 | assembledNameList.append((*it).assembledName()); |
2626 | uidList.append((*it).uid()); | 2629 | uidList.append((*it).uid()); |
2627 | 2630 | ||
2628 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2631 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2629 | } | 2632 | } |
2630 | } | 2633 | } |
2631 | 2634 | ||
2632 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2635 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2633 | 2636 | ||
2634 | } | 2637 | } |
2635 | 2638 | ||
2636 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2639 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2637 | */ | 2640 | */ |
2638 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2641 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2639 | { | 2642 | { |
2640 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2643 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2641 | 2644 | ||
2642 | QString foundUid = QString::null; | 2645 | QString foundUid = QString::null; |
2643 | if ( ! uid.isEmpty() ) { | 2646 | if ( ! uid.isEmpty() ) { |
2644 | Addressee adrr = mAddressBook->findByUid( uid ); | 2647 | Addressee adrr = mAddressBook->findByUid( uid ); |
2645 | if ( !adrr.isEmpty() ) { | 2648 | if ( !adrr.isEmpty() ) { |
2646 | foundUid = uid; | 2649 | foundUid = uid; |
2647 | } | 2650 | } |
2648 | if ( email == "sendbacklist" ) { | 2651 | if ( email == "sendbacklist" ) { |
2649 | //qDebug("ssssssssssssssssssssssend "); | 2652 | //qDebug("ssssssssssssssssssssssend "); |
2650 | QStringList nameList; | 2653 | QStringList nameList; |
2651 | QStringList emailList; | 2654 | QStringList emailList; |
2652 | QStringList uidList; | 2655 | QStringList uidList; |
2653 | nameList.append(adrr.realName()); | 2656 | nameList.append(adrr.realName()); |
2654 | emailList = adrr.emails(); | 2657 | emailList = adrr.emails(); |
2655 | uidList.append( adrr.preferredEmail()); | 2658 | uidList.append( adrr.preferredEmail()); |
2656 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2659 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2657 | return; | 2660 | return; |
2658 | } | 2661 | } |
2659 | 2662 | ||
2660 | } | 2663 | } |
2661 | 2664 | ||
2662 | if ( email == "sendbacklist" ) | 2665 | if ( email == "sendbacklist" ) |
2663 | return; | 2666 | return; |
2664 | if (foundUid.isEmpty()) | 2667 | if (foundUid.isEmpty()) |
2665 | { | 2668 | { |
2666 | //find the uid of the person first | 2669 | //find the uid of the person first |
2667 | Addressee::List namelist; | 2670 | Addressee::List namelist; |
2668 | Addressee::List emaillist; | 2671 | Addressee::List emaillist; |
2669 | 2672 | ||
2670 | if (!name.isEmpty()) | 2673 | if (!name.isEmpty()) |
2671 | namelist = mAddressBook->findByName( name ); | 2674 | namelist = mAddressBook->findByName( name ); |
2672 | 2675 | ||
2673 | if (!email.isEmpty()) | 2676 | if (!email.isEmpty()) |
2674 | emaillist = mAddressBook->findByEmail( email ); | 2677 | emaillist = mAddressBook->findByEmail( email ); |
2675 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2678 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2676 | //check if we have a match in Namelist and Emaillist | 2679 | //check if we have a match in Namelist and Emaillist |
2677 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2680 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2678 | foundUid = emaillist[0].uid(); | 2681 | foundUid = emaillist[0].uid(); |
2679 | } | 2682 | } |
2680 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2683 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2681 | foundUid = namelist[0].uid(); | 2684 | foundUid = namelist[0].uid(); |
2682 | else | 2685 | else |
2683 | { | 2686 | { |
2684 | for (int i = 0; i < namelist.count(); i++) | 2687 | for (int i = 0; i < namelist.count(); i++) |
2685 | { | 2688 | { |
2686 | for (int j = 0; j < emaillist.count(); j++) | 2689 | for (int j = 0; j < emaillist.count(); j++) |
2687 | { | 2690 | { |
2688 | if (namelist[i] == emaillist[j]) | 2691 | if (namelist[i] == emaillist[j]) |
2689 | { | 2692 | { |
2690 | foundUid = namelist[i].uid(); | 2693 | foundUid = namelist[i].uid(); |
2691 | } | 2694 | } |
2692 | } | 2695 | } |
2693 | } | 2696 | } |
2694 | } | 2697 | } |
2695 | } | 2698 | } |
2696 | else | 2699 | else |
2697 | { | 2700 | { |
2698 | foundUid = uid; | 2701 | foundUid = uid; |
2699 | } | 2702 | } |
2700 | 2703 | ||
2701 | if (!foundUid.isEmpty()) | 2704 | if (!foundUid.isEmpty()) |
2702 | { | 2705 | { |
2703 | 2706 | ||
2704 | // raise Ka/Pi if it is in the background | 2707 | // raise Ka/Pi if it is in the background |
2705 | #ifndef DESKTOP_VERSION | 2708 | #ifndef DESKTOP_VERSION |
2706 | #ifndef KORG_NODCOP | 2709 | #ifndef KORG_NODCOP |
2707 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2710 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2708 | #endif | 2711 | #endif |
2709 | #endif | 2712 | #endif |
2710 | 2713 | ||
2711 | mMainWindow->showMaximized(); | 2714 | mMainWindow->showMaximized(); |
2712 | mMainWindow-> raise(); | 2715 | mMainWindow-> raise(); |
2713 | 2716 | ||
2714 | mViewManager->setSelected( "", false); | 2717 | mViewManager->setSelected( "", false); |
2715 | mViewManager->refreshView( "" ); | 2718 | mViewManager->refreshView( "" ); |
2716 | mViewManager->setSelected( foundUid, true ); | 2719 | mViewManager->setSelected( foundUid, true ); |
2717 | mViewManager->refreshView( foundUid ); | 2720 | mViewManager->refreshView( foundUid ); |
2718 | 2721 | ||
2719 | if ( !mMultipleViewsAtOnce ) | 2722 | if ( !mMultipleViewsAtOnce ) |
2720 | { | 2723 | { |
2721 | setDetailsVisible( true ); | 2724 | setDetailsVisible( true ); |
2722 | mActionDetails->setChecked(true); | 2725 | mActionDetails->setChecked(true); |
2723 | } | 2726 | } |
2724 | } | 2727 | } |
2725 | } | 2728 | } |
2726 | 2729 | ||
2727 | void KABCore::whatsnew() | 2730 | void KABCore::whatsnew() |
2728 | { | 2731 | { |
2729 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2732 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2730 | } | 2733 | } |
2731 | void KABCore::synchowto() | 2734 | void KABCore::synchowto() |
2732 | { | 2735 | { |
2733 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2736 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2734 | } | 2737 | } |
2735 | void KABCore::kdesynchowto() | 2738 | void KABCore::kdesynchowto() |
2736 | { | 2739 | { |
2737 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 2740 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
2738 | } | 2741 | } |
2739 | void KABCore::multisynchowto() | 2742 | void KABCore::multisynchowto() |
2740 | { | 2743 | { |
2741 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 2744 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
2742 | } | 2745 | } |
2743 | void KABCore::faq() | 2746 | void KABCore::faq() |
2744 | { | 2747 | { |
2745 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2748 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2746 | } | 2749 | } |
2747 | 2750 | ||
2748 | #include <libkcal/syncdefines.h> | 2751 | #include <libkcal/syncdefines.h> |
2749 | 2752 | ||
2750 | KABC::Addressee KABCore::getLastSyncAddressee() | 2753 | KABC::Addressee KABCore::getLastSyncAddressee() |
2751 | { | 2754 | { |
2752 | Addressee lse; | 2755 | Addressee lse; |
2753 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2756 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2754 | 2757 | ||
2755 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 2758 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index d89daee..4cef73a 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -201,325 +201,326 @@ class KABCore : public QWidget, public KSyncInterface | |||
201 | void deleteContacts(); | 201 | void deleteContacts(); |
202 | 202 | ||
203 | /** | 203 | /** |
204 | Deletes given contacts from the address book. | 204 | Deletes given contacts from the address book. |
205 | 205 | ||
206 | @param uids The uids of the contacts, which shall be deleted. | 206 | @param uids The uids of the contacts, which shall be deleted. |
207 | */ | 207 | */ |
208 | void deleteContacts( const QStringList &uids ); | 208 | void deleteContacts( const QStringList &uids ); |
209 | 209 | ||
210 | /** | 210 | /** |
211 | Copys the selected contacts into clipboard for later pasting. | 211 | Copys the selected contacts into clipboard for later pasting. |
212 | */ | 212 | */ |
213 | void copyContacts(); | 213 | void copyContacts(); |
214 | 214 | ||
215 | /** | 215 | /** |
216 | Cuts the selected contacts and stores them for later pasting. | 216 | Cuts the selected contacts and stores them for later pasting. |
217 | */ | 217 | */ |
218 | void cutContacts(); | 218 | void cutContacts(); |
219 | 219 | ||
220 | /** | 220 | /** |
221 | Paste contacts from clipboard into the address book. | 221 | Paste contacts from clipboard into the address book. |
222 | */ | 222 | */ |
223 | void pasteContacts(); | 223 | void pasteContacts(); |
224 | 224 | ||
225 | /** | 225 | /** |
226 | Paste given contacts into the address book. | 226 | Paste given contacts into the address book. |
227 | 227 | ||
228 | @param list The list of addressee, which shall be pasted. | 228 | @param list The list of addressee, which shall be pasted. |
229 | */ | 229 | */ |
230 | void pasteContacts( KABC::Addressee::List &list ); | 230 | void pasteContacts( KABC::Addressee::List &list ); |
231 | 231 | ||
232 | /** | 232 | /** |
233 | Sets the whoAmI contact, that is used by many other programs to | 233 | Sets the whoAmI contact, that is used by many other programs to |
234 | get personal information about the current user. | 234 | get personal information about the current user. |
235 | */ | 235 | */ |
236 | void setWhoAmI(); | 236 | void setWhoAmI(); |
237 | 237 | ||
238 | /** | 238 | /** |
239 | Displays the category dialog and applies the result to all | 239 | Displays the category dialog and applies the result to all |
240 | selected contacts. | 240 | selected contacts. |
241 | */ | 241 | */ |
242 | void setCategories(); | 242 | void setCategories(); |
243 | void manageCategories(); | 243 | void manageCategories(); |
244 | void editCategories(); | 244 | void editCategories(); |
245 | 245 | ||
246 | /** | 246 | /** |
247 | Sets the field list of the Incremental Search Widget. | 247 | Sets the field list of the Incremental Search Widget. |
248 | */ | 248 | */ |
249 | void setSearchFields( const KABC::Field::List &fields ); | 249 | void setSearchFields( const KABC::Field::List &fields ); |
250 | 250 | ||
251 | /** | 251 | /** |
252 | Search with the current search field for a contact, that matches | 252 | Search with the current search field for a contact, that matches |
253 | the given text, and selects it in the view. | 253 | the given text, and selects it in the view. |
254 | */ | 254 | */ |
255 | void incrementalSearch( const QString& text ); | 255 | void incrementalSearch( const QString& text ); |
256 | void incrementalSearchJump( const QString& text ); | 256 | void incrementalSearchJump( const QString& text ); |
257 | 257 | ||
258 | /** | 258 | /** |
259 | Marks the address book as modified. | 259 | Marks the address book as modified. |
260 | */ | 260 | */ |
261 | void setModified(); | 261 | void setModified(); |
262 | /** | 262 | /** |
263 | Marks the address book as modified without refreshing the view. | 263 | Marks the address book as modified without refreshing the view. |
264 | */ | 264 | */ |
265 | void setModifiedWOrefresh(); | 265 | void setModifiedWOrefresh(); |
266 | 266 | ||
267 | /** | 267 | /** |
268 | Marks the address book as modified concerning the argument. | 268 | Marks the address book as modified concerning the argument. |
269 | */ | 269 | */ |
270 | void setModified( bool modified ); | 270 | void setModified( bool modified ); |
271 | 271 | ||
272 | /** | 272 | /** |
273 | Returns whether the address book is modified. | 273 | Returns whether the address book is modified. |
274 | */ | 274 | */ |
275 | bool modified() const; | 275 | bool modified() const; |
276 | 276 | ||
277 | /** | 277 | /** |
278 | Called whenever an contact is modified in the contact editor | 278 | Called whenever an contact is modified in the contact editor |
279 | dialog or the quick edit. | 279 | dialog or the quick edit. |
280 | */ | 280 | */ |
281 | void contactModified( const KABC::Addressee &addr ); | 281 | void contactModified( const KABC::Addressee &addr ); |
282 | void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); | 282 | void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); |
283 | 283 | ||
284 | /** | 284 | /** |
285 | DCOP METHODS. | 285 | DCOP METHODS. |
286 | */ | 286 | */ |
287 | void addEmail( QString addr ); | 287 | void addEmail( QString addr ); |
288 | void importVCard( const KURL& url, bool showPreview ); | 288 | void importVCard( const KURL& url, bool showPreview ); |
289 | void importVCard( const QString& vCard, bool showPreview ); | 289 | void importVCard( const QString& vCard, bool showPreview ); |
290 | void newContact(); | 290 | void newContact(); |
291 | QString getNameByPhone( const QString& phone ); | 291 | QString getNameByPhone( const QString& phone ); |
292 | /** | 292 | /** |
293 | END DCOP METHODS | 293 | END DCOP METHODS |
294 | */ | 294 | */ |
295 | 295 | ||
296 | /** | 296 | /** |
297 | Saves the contents of the AddressBook back to disk. | 297 | Saves the contents of the AddressBook back to disk. |
298 | */ | 298 | */ |
299 | void save(); | 299 | void save(); |
300 | 300 | ||
301 | /** | 301 | /** |
302 | Undos the last command using the undo stack. | 302 | Undos the last command using the undo stack. |
303 | */ | 303 | */ |
304 | void undo(); | 304 | void undo(); |
305 | 305 | ||
306 | /** | 306 | /** |
307 | Redos the last command that was undone, using the redo stack. | 307 | Redos the last command that was undone, using the redo stack. |
308 | */ | 308 | */ |
309 | void redo(); | 309 | void redo(); |
310 | 310 | ||
311 | /** | 311 | /** |
312 | Shows the edit dialog for the given uid. If the uid is QString::null, | 312 | Shows the edit dialog for the given uid. If the uid is QString::null, |
313 | the method will try to find a selected addressee in the view. | 313 | the method will try to find a selected addressee in the view. |
314 | */ | 314 | */ |
315 | void editContact( const QString &uid /*US = QString::null*/ ); | 315 | void editContact( const QString &uid /*US = QString::null*/ ); |
316 | //US added a second method without defaultparameter | 316 | //US added a second method without defaultparameter |
317 | void editContact2(); | 317 | void editContact2(); |
318 | 318 | ||
319 | /** | 319 | /** |
320 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 320 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
321 | the method will try to find a selected addressee in the view. | 321 | the method will try to find a selected addressee in the view. |
322 | */ | 322 | */ |
323 | void executeContact( const QString &uid /*US = QString::null*/ ); | 323 | void executeContact( const QString &uid /*US = QString::null*/ ); |
324 | 324 | ||
325 | /** | 325 | /** |
326 | Launches the configuration dialog. | 326 | Launches the configuration dialog. |
327 | */ | 327 | */ |
328 | void openConfigDialog(); | 328 | void openConfigDialog(); |
329 | 329 | ||
330 | /** | 330 | /** |
331 | Launches the ldap search dialog. | 331 | Launches the ldap search dialog. |
332 | */ | 332 | */ |
333 | void openLDAPDialog(); | 333 | void openLDAPDialog(); |
334 | 334 | ||
335 | /** | 335 | /** |
336 | Creates a KAddressBookPrinter, which will display the print | 336 | Creates a KAddressBookPrinter, which will display the print |
337 | dialog and do the printing. | 337 | dialog and do the printing. |
338 | */ | 338 | */ |
339 | void print(); | 339 | void print(); |
340 | 340 | ||
341 | /** | 341 | /** |
342 | Registers a new GUI client, so plugins can register its actions. | 342 | Registers a new GUI client, so plugins can register its actions. |
343 | */ | 343 | */ |
344 | void addGUIClient( KXMLGUIClient *client ); | 344 | void addGUIClient( KXMLGUIClient *client ); |
345 | 345 | ||
346 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 346 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
347 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 347 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
348 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 348 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
349 | 349 | ||
350 | 350 | ||
351 | signals: | 351 | signals: |
352 | void contactSelected( const QString &name ); | 352 | void contactSelected( const QString &name ); |
353 | void contactSelected( const QPixmap &pixmap ); | 353 | void contactSelected( const QPixmap &pixmap ); |
354 | public slots: | 354 | public slots: |
355 | void recieve(QString cmsg ); | 355 | void recieve(QString cmsg ); |
356 | void getFile( bool success ); | 356 | void getFile( bool success ); |
357 | void syncFileRequest(); | 357 | void syncFileRequest(); |
358 | void setDetailsVisible( bool visible ); | 358 | void setDetailsVisible( bool visible ); |
359 | void setDetailsToState(); | 359 | void setDetailsToState(); |
360 | 360 | ||
361 | void saveSettings(); | 361 | void saveSettings(); |
362 | 362 | ||
363 | private slots: | 363 | private slots: |
364 | void updateToolBar(); | 364 | void updateToolBar(); |
365 | void updateMainWindow(); | 365 | void updateMainWindow(); |
366 | void receive( const QCString& cmsg, const QByteArray& data ); | 366 | void receive( const QCString& cmsg, const QByteArray& data ); |
367 | void toggleBeamReceive( ); | 367 | void toggleBeamReceive( ); |
368 | void disableBR(bool); | 368 | void disableBR(bool); |
369 | void setJumpButtonBarVisible( bool visible ); | 369 | void setJumpButtonBarVisible( bool visible ); |
370 | void setJumpButtonBar( bool visible ); | 370 | void setJumpButtonBar( bool visible ); |
371 | void setCaptionBack(); | 371 | void setCaptionBack(); |
372 | void resizeAndCallContactdialog(); | 372 | void resizeAndCallContactdialog(); |
373 | void callContactdialog(); | 373 | void callContactdialog(); |
374 | 374 | ||
375 | void importFromOL(); | 375 | void importFromOL(); |
376 | void extensionModified( const KABC::Addressee::List &list ); | 376 | void extensionModified( const KABC::Addressee::List &list ); |
377 | void extensionChanged( int id ); | 377 | void extensionChanged( int id ); |
378 | void clipboardDataChanged(); | 378 | void clipboardDataChanged(); |
379 | void updateActionMenu(); | 379 | void updateActionMenu(); |
380 | void configureKeyBindings(); | 380 | void configureKeyBindings(); |
381 | void removeVoice(); | 381 | void removeVoice(); |
382 | void setFormattedName(); | 382 | void setFormattedName(); |
383 | #ifdef KAB_EMBEDDED | 383 | #ifdef KAB_EMBEDDED |
384 | void configureResources(); | 384 | void configureResources(); |
385 | #endif //KAB_EMBEDDED | 385 | #endif //KAB_EMBEDDED |
386 | 386 | ||
387 | void slotEditorDestroyed( const QString &uid ); | 387 | void slotEditorDestroyed( const QString &uid ); |
388 | void configurationChanged(); | 388 | void configurationChanged(); |
389 | void addressBookChanged(); | 389 | void addressBookChanged(); |
390 | 390 | ||
391 | private: | 391 | private: |
392 | QString mEmailSourceChannel; | 392 | QString mEmailSourceChannel; |
393 | QString mEmailSourceUID; | ||
393 | void resizeEvent(QResizeEvent* e ); | 394 | void resizeEvent(QResizeEvent* e ); |
394 | bool mBRdisabled; | 395 | bool mBRdisabled; |
395 | #ifndef DESKTOP_VERSION | 396 | #ifndef DESKTOP_VERSION |
396 | QCopChannel* infrared; | 397 | QCopChannel* infrared; |
397 | #endif | 398 | #endif |
398 | QTimer *mMessageTimer; | 399 | QTimer *mMessageTimer; |
399 | void initGUI(); | 400 | void initGUI(); |
400 | void initActions(); | 401 | void initActions(); |
401 | QString getPhoneFile(); | 402 | QString getPhoneFile(); |
402 | 403 | ||
403 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 404 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
404 | const char *name = 0 ); | 405 | const char *name = 0 ); |
405 | 406 | ||
406 | KXMLGUIClient *mGUIClient; | 407 | KXMLGUIClient *mGUIClient; |
407 | 408 | ||
408 | KABC::AddressBook *mAddressBook; | 409 | KABC::AddressBook *mAddressBook; |
409 | 410 | ||
410 | ViewManager *mViewManager; | 411 | ViewManager *mViewManager; |
411 | // QSplitter *mDetailsSplitter; | 412 | // QSplitter *mDetailsSplitter; |
412 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 413 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
413 | ViewContainer *mDetails; | 414 | ViewContainer *mDetails; |
414 | KDGanttMinimizeSplitter* mMiniSplitter; | 415 | KDGanttMinimizeSplitter* mMiniSplitter; |
415 | XXPortManager *mXXPortManager; | 416 | XXPortManager *mXXPortManager; |
416 | JumpButtonBar *mJumpButtonBar; | 417 | JumpButtonBar *mJumpButtonBar; |
417 | IncSearchWidget *mIncSearchWidget; | 418 | IncSearchWidget *mIncSearchWidget; |
418 | ExtensionManager *mExtensionManager; | 419 | ExtensionManager *mExtensionManager; |
419 | 420 | ||
420 | KCMultiDialog *mConfigureDialog; | 421 | KCMultiDialog *mConfigureDialog; |
421 | 422 | ||
422 | #ifndef KAB_EMBEDDED | 423 | #ifndef KAB_EMBEDDED |
423 | LDAPSearchDialog *mLdapSearchDialog; | 424 | LDAPSearchDialog *mLdapSearchDialog; |
424 | #endif //KAB_EMBEDDED | 425 | #endif //KAB_EMBEDDED |
425 | // QDict<AddresseeEditorDialog> mEditorDict; | 426 | // QDict<AddresseeEditorDialog> mEditorDict; |
426 | AddresseeEditorDialog *mEditorDialog; | 427 | AddresseeEditorDialog *mEditorDialog; |
427 | bool mReadWrite; | 428 | bool mReadWrite; |
428 | bool mModified; | 429 | bool mModified; |
429 | bool mIsPart; | 430 | bool mIsPart; |
430 | bool mMultipleViewsAtOnce; | 431 | bool mMultipleViewsAtOnce; |
431 | 432 | ||
432 | 433 | ||
433 | //US file menu | 434 | //US file menu |
434 | KAction *mActionMail; | 435 | KAction *mActionMail; |
435 | KAction *mActionBeam; | 436 | KAction *mActionBeam; |
436 | KToggleAction *mActionBR; | 437 | KToggleAction *mActionBR; |
437 | KAction *mActionExport2phone; | 438 | KAction *mActionExport2phone; |
438 | KAction* mActionPrint; | 439 | KAction* mActionPrint; |
439 | KAction* mActionPrintDetails; | 440 | KAction* mActionPrintDetails; |
440 | KAction* mActionNewContact; | 441 | KAction* mActionNewContact; |
441 | KAction *mActionSave; | 442 | KAction *mActionSave; |
442 | KAction *mActionEditAddressee; | 443 | KAction *mActionEditAddressee; |
443 | KAction *mActionMailVCard; | 444 | KAction *mActionMailVCard; |
444 | KAction *mActionBeamVCard; | 445 | KAction *mActionBeamVCard; |
445 | 446 | ||
446 | KAction *mActionQuit; | 447 | KAction *mActionQuit; |
447 | 448 | ||
448 | //US edit menu | 449 | //US edit menu |
449 | KAction *mActionCopy; | 450 | KAction *mActionCopy; |
450 | KAction *mActionCut; | 451 | KAction *mActionCut; |
451 | KAction *mActionPaste; | 452 | KAction *mActionPaste; |
452 | KAction *mActionSelectAll; | 453 | KAction *mActionSelectAll; |
453 | KAction *mActionUndo; | 454 | KAction *mActionUndo; |
454 | KAction *mActionRedo; | 455 | KAction *mActionRedo; |
455 | KAction *mActionDelete; | 456 | KAction *mActionDelete; |
456 | 457 | ||
457 | //US settings menu | 458 | //US settings menu |
458 | KAction *mActionConfigResources; | 459 | KAction *mActionConfigResources; |
459 | KAction *mActionConfigKAddressbook; | 460 | KAction *mActionConfigKAddressbook; |
460 | KAction *mActionConfigShortcuts; | 461 | KAction *mActionConfigShortcuts; |
461 | KAction *mActionConfigureToolbars; | 462 | KAction *mActionConfigureToolbars; |
462 | KAction *mActionKeyBindings; | 463 | KAction *mActionKeyBindings; |
463 | KToggleAction *mActionJumpBar; | 464 | KToggleAction *mActionJumpBar; |
464 | KToggleAction *mActionDetails; | 465 | KToggleAction *mActionDetails; |
465 | KAction *mActionWhoAmI; | 466 | KAction *mActionWhoAmI; |
466 | KAction *mActionCategories; | 467 | KAction *mActionCategories; |
467 | KAction *mActionEditCategories; | 468 | KAction *mActionEditCategories; |
468 | KAction *mActionManageCategories; | 469 | KAction *mActionManageCategories; |
469 | KAction *mActionAboutKAddressbook; | 470 | KAction *mActionAboutKAddressbook; |
470 | KAction *mActionLicence; | 471 | KAction *mActionLicence; |
471 | KAction *mActionFaq; | 472 | KAction *mActionFaq; |
472 | KAction *mActionWN; | 473 | KAction *mActionWN; |
473 | KAction *mActionSyncHowto; | 474 | KAction *mActionSyncHowto; |
474 | KAction *mActionKdeSyncHowto; | 475 | KAction *mActionKdeSyncHowto; |
475 | KAction *mActionMultiSyncHowto; | 476 | KAction *mActionMultiSyncHowto; |
476 | 477 | ||
477 | KAction *mActionDeleteView; | 478 | KAction *mActionDeleteView; |
478 | 479 | ||
479 | QPopupMenu *viewMenu; | 480 | QPopupMenu *viewMenu; |
480 | QPopupMenu *filterMenu; | 481 | QPopupMenu *filterMenu; |
481 | QPopupMenu *settingsMenu; | 482 | QPopupMenu *settingsMenu; |
482 | QPopupMenu *changeMenu; | 483 | QPopupMenu *changeMenu; |
483 | QPopupMenu *beamMenu; | 484 | QPopupMenu *beamMenu; |
484 | //US QAction *mActionSave; | 485 | //US QAction *mActionSave; |
485 | QPopupMenu *ImportMenu; | 486 | QPopupMenu *ImportMenu; |
486 | QPopupMenu *ExportMenu; | 487 | QPopupMenu *ExportMenu; |
487 | //LR additional methods | 488 | //LR additional methods |
488 | KAction *mActionRemoveVoice; | 489 | KAction *mActionRemoveVoice; |
489 | KAction *mActionSetFormattedName; | 490 | KAction *mActionSetFormattedName; |
490 | KAction * mActionImportOL; | 491 | KAction * mActionImportOL; |
491 | 492 | ||
492 | #ifndef KAB_EMBEDDED | 493 | #ifndef KAB_EMBEDDED |
493 | KAddressBookService *mAddressBookService; | 494 | KAddressBookService *mAddressBookService; |
494 | #endif //KAB_EMBEDDED | 495 | #endif //KAB_EMBEDDED |
495 | 496 | ||
496 | class KABCorePrivate; | 497 | class KABCorePrivate; |
497 | KABCorePrivate *d; | 498 | KABCorePrivate *d; |
498 | //US bool mBlockSaveFlag; | 499 | //US bool mBlockSaveFlag; |
499 | 500 | ||
500 | #ifdef KAB_EMBEDDED | 501 | #ifdef KAB_EMBEDDED |
501 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 502 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
502 | #endif //KAB_EMBEDDED | 503 | #endif //KAB_EMBEDDED |
503 | 504 | ||
504 | //this are the overwritten callbackmethods from the syncinterface | 505 | //this are the overwritten callbackmethods from the syncinterface |
505 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 506 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
506 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 507 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
507 | virtual void removeSyncInfo( QString syncProfile); | 508 | virtual void removeSyncInfo( QString syncProfile); |
508 | bool syncPhone(); | 509 | bool syncPhone(); |
509 | void message( QString m , bool startTimer = true); | 510 | void message( QString m , bool startTimer = true); |
510 | 511 | ||
511 | // LR ******************************* | 512 | // LR ******************************* |
512 | // sync stuff! | 513 | // sync stuff! |
513 | QString sentSyncFile(); | 514 | QString sentSyncFile(); |
514 | QPopupMenu *syncMenu; | 515 | QPopupMenu *syncMenu; |
515 | KSyncManager* syncManager; | 516 | KSyncManager* syncManager; |
516 | int mGlobalSyncMode; | 517 | int mGlobalSyncMode; |
517 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 518 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
518 | KABC::Addressee getLastSyncAddressee(); | 519 | KABC::Addressee getLastSyncAddressee(); |
519 | QDateTime mLastAddressbookSync; | 520 | QDateTime mLastAddressbookSync; |
520 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 521 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
521 | // ********************* | 522 | // ********************* |
522 | 523 | ||
523 | }; | 524 | }; |
524 | 525 | ||
525 | #endif | 526 | #endif |
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp index e7bc8c0..0127fc0 100644 --- a/kaddressbook/xxportselectdialog.cpp +++ b/kaddressbook/xxportselectdialog.cpp | |||
@@ -53,282 +53,283 @@ $Id$ | |||
53 | #include "xxportselectdialog.h" | 53 | #include "xxportselectdialog.h" |
54 | 54 | ||
55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, | 55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, |
56 | QWidget* parent, const char* name ) | 56 | QWidget* parent, const char* name ) |
57 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, | 57 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, |
58 | Ok, parent, name, true, true ), mCore( core ), | 58 | Ok, parent, name, true, true ), mCore( core ), |
59 | mUseSorting( sort ) | 59 | mUseSorting( sort ) |
60 | { | 60 | { |
61 | initGUI(); | 61 | initGUI(); |
62 | 62 | ||
63 | connect( mFiltersCombo, SIGNAL( activated( int ) ), | 63 | connect( mFiltersCombo, SIGNAL( activated( int ) ), |
64 | SLOT( filterChanged( int ) ) ); | 64 | SLOT( filterChanged( int ) ) ); |
65 | connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), | 65 | connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), |
66 | SLOT( categoryClicked( QListViewItem* ) ) ); | 66 | SLOT( categoryClicked( QListViewItem* ) ) ); |
67 | 67 | ||
68 | // setup filters | 68 | // setup filters |
69 | #ifndef KAB_EMBEDDED | 69 | #ifndef KAB_EMBEDDED |
70 | mFilters = Filter::restore( kapp->config(), "Filter" ); | 70 | mFilters = Filter::restore( kapp->config(), "Filter" ); |
71 | Filter::List::iterator filterIt; | 71 | Filter::List::iterator filterIt; |
72 | #else //KAB_EMBEDDED | 72 | #else //KAB_EMBEDDED |
73 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); | 73 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); |
74 | Filter::List::Iterator filterIt; | 74 | Filter::List::Iterator filterIt; |
75 | #endif //KAB_EMBEDDED | 75 | #endif //KAB_EMBEDDED |
76 | QStringList filters; | 76 | QStringList filters; |
77 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 77 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
78 | filters.append( (*filterIt).name() ); | 78 | filters.append( (*filterIt).name() ); |
79 | 79 | ||
80 | mFiltersCombo->insertStringList( filters ); | 80 | mFiltersCombo->insertStringList( filters ); |
81 | mUseFilters->setEnabled( filters.count() > 0 ); | 81 | mUseFilters->setEnabled( filters.count() > 0 ); |
82 | 82 | ||
83 | // setup categories | 83 | // setup categories |
84 | QStringList categories = KABPrefs::instance()->mCustomCategories; | 84 | QStringList categories = KABPrefs::instance()->mCustomCategories; |
85 | QStringList::Iterator it; | 85 | QStringList::Iterator it; |
86 | for ( it = categories.begin(); it != categories.end(); ++it ) | 86 | for ( it = categories.begin(); it != categories.end(); ++it ) |
87 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); | 87 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); |
88 | mUseCategories->setEnabled( categories.count() > 0 ); | 88 | mUseCategories->setEnabled( categories.count() > 0 ); |
89 | 89 | ||
90 | int count = mCore->selectedUIDs().count(); | 90 | int count = mCore->selectedUIDs().count(); |
91 | mUseSelection->setEnabled( count != 0 ); | 91 | mUseSelection->setEnabled( count != 0 ); |
92 | mUseSelection->setChecked( count > 1 ); | 92 | mUseSelection->setChecked( count > 1 ); |
93 | 93 | ||
94 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); | 94 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); |
95 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); | 95 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); |
96 | 96 | ||
97 | mFields = mCore->addressBook()->fields( KABC::Field::All ); | 97 | mFields = mCore->addressBook()->fields( KABC::Field::All ); |
98 | KABC::Field::List::Iterator fieldIt; | 98 | KABC::Field::List::Iterator fieldIt; |
99 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) | 99 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) |
100 | mFieldCombo->insertItem( (*fieldIt)->label() ); | 100 | mFieldCombo->insertItem( (*fieldIt)->label() ); |
101 | } | 101 | } |
102 | 102 | ||
103 | QStringList XXPortSelectDialog::uids() | 103 | QStringList XXPortSelectDialog::uids() |
104 | { | 104 | { |
105 | QStringList uidlist; | 105 | QStringList uidlist; |
106 | KABC::AddresseeList list = contacts(); | 106 | KABC::AddresseeList list = contacts(); |
107 | KABC::Addressee::List::Iterator it; | 107 | KABC::Addressee::List::Iterator it; |
108 | for ( it = list.begin(); it != list.end(); ++it ) | 108 | for ( it = list.begin(); it != list.end(); ++it ) |
109 | uidlist.append((*it).uid()); | 109 | uidlist.append((*it).uid()); |
110 | return uidlist; | 110 | return uidlist; |
111 | } | 111 | } |
112 | void XXPortSelectDialog::tagSelected() | 112 | void XXPortSelectDialog::tagSelected() |
113 | { | 113 | { |
114 | if ( mUseSelection->isChecked() ) { | 114 | if ( mUseSelection->isChecked() ) { |
115 | 115 | ||
116 | QStringList selection = mCore->selectedUIDs(); | 116 | QStringList selection = mCore->selectedUIDs(); |
117 | KABC::AddressBook::Iterator it; | 117 | KABC::AddressBook::Iterator it; |
118 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 118 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
119 | if ( selection.findIndex((*it).uid()) >= 0 ) | 119 | if ( selection.findIndex((*it).uid()) >= 0 ) |
120 | (*it).setTagged( true ); | 120 | (*it).setTagged( true ); |
121 | } | 121 | } |
122 | } else if ( mUseFilters->isChecked() ) { | 122 | } else if ( mUseFilters->isChecked() ) { |
123 | // find contacts that can pass selected filter | 123 | // find contacts that can pass selected filter |
124 | Filter::List::Iterator filterIt; | 124 | Filter::List::Iterator filterIt; |
125 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 125 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
126 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) | 126 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) |
127 | break; | 127 | break; |
128 | KABC::AddressBook::Iterator it; | 128 | KABC::AddressBook::Iterator it; |
129 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 129 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
130 | if ( (*filterIt).filterAddressee( *it ) ) | 130 | if ( (*filterIt).filterAddressee( *it ) ) |
131 | (*it).setTagged( true ); | 131 | (*it).setTagged( true ); |
132 | } | 132 | } |
133 | } else if ( mUseCategories->isChecked() ) { | 133 | } else if ( mUseCategories->isChecked() ) { |
134 | QStringList categorieList = categories(); | 134 | QStringList categorieList = categories(); |
135 | KABC::AddressBook::Iterator it; | 135 | KABC::AddressBook::Iterator it; |
136 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 136 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
137 | QStringList tmp( (*it).categories() ); | 137 | QStringList tmp( (*it).categories() ); |
138 | QStringList::Iterator tmpIt; | 138 | QStringList::Iterator tmpIt; |
139 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) | 139 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) |
140 | if ( categorieList.contains( *tmpIt ) ) { | 140 | if ( categorieList.contains( *tmpIt ) ) { |
141 | (*it).setTagged( true ); | 141 | (*it).setTagged( true ); |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | } else { | 145 | } else { |
146 | // create a string list of all entries: | 146 | // create a string list of all entries: |
147 | KABC::AddressBook::Iterator it; | 147 | KABC::AddressBook::Iterator it; |
148 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) | 148 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) |
149 | (*it).setTagged( true ); | 149 | (*it).setTagged( true ); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | KABC::AddresseeList XXPortSelectDialog::contacts() | 152 | KABC::AddresseeList XXPortSelectDialog::contacts() |
153 | { | 153 | { |
154 | 154 | ||
155 | KABC::AddresseeList list; | 155 | KABC::AddresseeList list; |
156 | if ( mUseSelection->isChecked() ) { | 156 | if ( mUseSelection->isChecked() ) { |
157 | QStringList::Iterator it; | 157 | QStringList::Iterator it; |
158 | QStringList selection = mCore->selectedUIDs(); | 158 | QStringList selection = mCore->selectedUIDs(); |
159 | for ( it = selection.begin(); it != selection.end(); ++it ) { | 159 | for ( it = selection.begin(); it != selection.end(); ++it ) { |
160 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); | 160 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); |
161 | if ( !addr.isEmpty() ) | 161 | if ( !addr.isEmpty() ) |
162 | list.append( addr ); | 162 | list.append( addr ); |
163 | } | 163 | } |
164 | } else if ( mUseFilters->isChecked() ) { | 164 | } else if ( mUseFilters->isChecked() ) { |
165 | // find contacts that can pass selected filter | 165 | // find contacts that can pass selected filter |
166 | Filter::List::Iterator filterIt; | 166 | Filter::List::Iterator filterIt; |
167 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 167 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
168 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) | 168 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) |
169 | break; | 169 | break; |
170 | 170 | ||
171 | KABC::AddressBook::Iterator it; | 171 | KABC::AddressBook::Iterator it; |
172 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 172 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
173 | if ( (*filterIt).filterAddressee( *it ) ) | 173 | if ( (*filterIt).filterAddressee( *it ) ) |
174 | list.append( *it ); | 174 | list.append( *it ); |
175 | } | 175 | } |
176 | } else if ( mUseCategories->isChecked() ) { | 176 | } else if ( mUseCategories->isChecked() ) { |
177 | QStringList categorieList = categories(); | 177 | QStringList categorieList = categories(); |
178 | KABC::AddressBook::Iterator it; | 178 | KABC::AddressBook::Iterator it; |
179 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 179 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
180 | QStringList tmp( (*it).categories() ); | 180 | QStringList tmp( (*it).categories() ); |
181 | QStringList::Iterator tmpIt; | 181 | QStringList::Iterator tmpIt; |
182 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) | 182 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) |
183 | if ( categorieList.contains( *tmpIt ) ) { | 183 | if ( categorieList.contains( *tmpIt ) ) { |
184 | list.append( *it ); | 184 | list.append( *it ); |
185 | break; | 185 | break; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | } else { | 188 | } else { |
189 | // create a string list of all entries: | 189 | // create a string list of all entries: |
190 | KABC::AddressBook::Iterator it; | 190 | KABC::AddressBook::Iterator it; |
191 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) | 191 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) |
192 | list.append( *it ); | 192 | list.append( *it ); |
193 | } | 193 | } |
194 | 194 | ||
195 | if ( mUseSorting ) { | 195 | if ( mUseSorting ) { |
196 | list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); | 196 | list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); |
197 | uint pos = mFieldCombo->currentItem(); | 197 | uint pos = mFieldCombo->currentItem(); |
198 | if ( pos < mFields.count() ) | 198 | if ( pos < mFields.count() ) |
199 | list.sortByField( mFields[ pos ] ); | 199 | list.sortByField( mFields[ pos ] ); |
200 | } | 200 | } |
201 | 201 | ||
202 | return list; | 202 | return list; |
203 | } | 203 | } |
204 | 204 | ||
205 | QStringList XXPortSelectDialog::categories() const | 205 | QStringList XXPortSelectDialog::categories() const |
206 | { | 206 | { |
207 | QStringList list; | 207 | QStringList list; |
208 | 208 | ||
209 | QListViewItemIterator it( mCategoriesView ); | 209 | QListViewItemIterator it( mCategoriesView ); |
210 | for ( ; it.current(); ++it ) { | 210 | for ( ; it.current(); ++it ) { |
211 | QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); | 211 | QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); |
212 | if ( qcli->isOn() ) | 212 | if ( qcli->isOn() ) |
213 | list.append( it.current()->text( 0 ) ); | 213 | list.append( it.current()->text( 0 ) ); |
214 | } | 214 | } |
215 | 215 | ||
216 | return list; | 216 | return list; |
217 | } | 217 | } |
218 | 218 | ||
219 | void XXPortSelectDialog::filterChanged( int ) | 219 | void XXPortSelectDialog::filterChanged( int ) |
220 | { | 220 | { |
221 | mUseFilters->setChecked( true ); | 221 | mUseFilters->setChecked( true ); |
222 | } | 222 | } |
223 | 223 | ||
224 | void XXPortSelectDialog::categoryClicked( QListViewItem *i ) | 224 | void XXPortSelectDialog::categoryClicked( QListViewItem *i ) |
225 | { | 225 | { |
226 | QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); | 226 | QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); |
227 | if ( qcli->isOn() ) | 227 | if ( qcli->isOn() ) |
228 | mUseCategories->setChecked( true ); | 228 | mUseCategories->setChecked( true ); |
229 | } | 229 | } |
230 | 230 | ||
231 | void XXPortSelectDialog::slotHelp() | 231 | void XXPortSelectDialog::slotHelp() |
232 | { | 232 | { |
233 | #ifndef KAB_EMBEDDED | 233 | #ifndef KAB_EMBEDDED |
234 | kapp->invokeHelp( "import-and-export" ); | 234 | kapp->invokeHelp( "import-and-export" ); |
235 | #else //KAB_EMBEDDED | 235 | #else //KAB_EMBEDDED |
236 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); | 236 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); |
237 | #endif //KAB_EMBEDDED | 237 | #endif //KAB_EMBEDDED |
238 | 238 | ||
239 | } | 239 | } |
240 | 240 | ||
241 | void XXPortSelectDialog::initGUI() | 241 | void XXPortSelectDialog::initGUI() |
242 | { | 242 | { |
243 | QFrame *page = plainPage(); | 243 | QFrame *page = plainPage(); |
244 | 244 | ||
245 | QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(), | 245 | QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHintSmall(), |
246 | KDialog::spacingHint() ); | 246 | KDialog::spacingHintSmall() ); |
247 | 247 | ||
248 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); | 248 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); |
249 | topLayout->addWidget( label ); | 249 | topLayout->addWidget( label ); |
250 | 250 | ||
251 | mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); | 251 | mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); |
252 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); | 252 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); |
253 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); | 253 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); |
254 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); | 254 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); |
255 | 255 | ||
256 | QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); | 256 | QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); |
257 | groupLayout->setAlignment( Qt::AlignTop ); | 257 | groupLayout->setAlignment( Qt::AlignTop ); |
258 | 258 | ||
259 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); | 259 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); |
260 | mUseWholeBook->setChecked( true ); | 260 | mUseWholeBook->setChecked( true ); |
261 | QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); | 261 | QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); |
262 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); | 262 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); |
263 | 263 | ||
264 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); | 264 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); |
265 | QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" | 265 | QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" |
266 | "This option is disabled if no contacts are selected." ) ); | 266 | "This option is disabled if no contacts are selected." ) ); |
267 | groupLayout->addWidget( mUseSelection, 1, 0 ); | 267 | groupLayout->addWidget( mUseSelection, 1, 0 ); |
268 | 268 | ||
269 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); | 269 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); |
270 | QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" | 270 | QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" |
271 | "This option is disabled if you haven't defined any filters" ) ); | 271 | "This option is disabled if you haven't defined any filters" ) ); |
272 | groupLayout->addWidget( mUseFilters, 2, 0 ); | 272 | groupLayout->addWidget( mUseFilters, 2, 0 ); |
273 | 273 | ||
274 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); | 274 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); |
275 | QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" | 275 | QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" |
276 | "This option is disabled if you have no categories." ) ); | 276 | "This option is disabled if you have no categories." ) ); |
277 | groupLayout->addWidget( mUseCategories, 3, 0 ); | 277 | groupLayout->addWidget( mUseCategories, 3, 0 ); |
278 | 278 | ||
279 | mFiltersCombo = new QComboBox( false, mButtonGroup ); | 279 | mFiltersCombo = new QComboBox( false, mButtonGroup ); |
280 | mFiltersCombo->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | ||
280 | QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); | 281 | QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); |
281 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); | 282 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); |
282 | 283 | ||
283 | mCategoriesView = new QListView( mButtonGroup ); | 284 | mCategoriesView = new QListView( mButtonGroup ); |
284 | mCategoriesView->addColumn( "" ); | 285 | mCategoriesView->addColumn( "" ); |
285 | mCategoriesView->header()->hide(); | 286 | mCategoriesView->header()->hide(); |
286 | QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); | 287 | QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); |
287 | groupLayout->addWidget( mCategoriesView, 3, 1 ); | 288 | groupLayout->addWidget( mCategoriesView, 3, 1 ); |
288 | 289 | mCategoriesView->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | |
289 | if (QApplication::desktop()->height() == 480 ) | 290 | //if (QApplication::desktop()->height() == 480 ) |
290 | mCategoriesView->setMaximumHeight( 240 ); | 291 | // mCategoriesView->setMaximumHeight( 240 ); |
291 | topLayout->addWidget( mButtonGroup ); | 292 | topLayout->addWidget( mButtonGroup ); |
292 | 293 | ||
293 | QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); | 294 | QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); |
294 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); | 295 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); |
295 | QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, | 296 | QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, |
296 | KDialog::spacingHint() ); | 297 | KDialog::spacingHint() ); |
297 | sortLayout->setAlignment( Qt::AlignTop ); | 298 | sortLayout->setAlignment( Qt::AlignTop ); |
298 | 299 | ||
299 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); | 300 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); |
300 | sortLayout->addWidget( label, 0, 0 ); | 301 | sortLayout->addWidget( label, 0, 0 ); |
301 | 302 | ||
302 | #ifndef KAB_EMBEDDED | 303 | #ifndef KAB_EMBEDDED |
303 | mFieldCombo = new KComboBox( false, sortingGroup ); | 304 | mFieldCombo = new KComboBox( false, sortingGroup ); |
304 | #else //KAB_EMBEDDED | 305 | #else //KAB_EMBEDDED |
305 | //US Combobox is not editable anyway | 306 | //US Combobox is not editable anyway |
306 | mFieldCombo = new KComboBox( sortingGroup ); | 307 | mFieldCombo = new KComboBox( sortingGroup ); |
307 | #endif //KAB_EMBEDDED | 308 | #endif //KAB_EMBEDDED |
308 | sortLayout->addWidget( mFieldCombo, 0, 1 ); | 309 | sortLayout->addWidget( mFieldCombo, 0, 1 ); |
309 | 310 | ||
310 | label = new QLabel( i18n( "Order:" ), sortingGroup ); | 311 | label = new QLabel( i18n( "Order:" ), sortingGroup ); |
311 | sortLayout->addWidget( label, 1, 0 ); | 312 | sortLayout->addWidget( label, 1, 0 ); |
312 | 313 | ||
313 | #ifndef KAB_EMBEDDED | 314 | #ifndef KAB_EMBEDDED |
314 | mSortTypeCombo = new KComboBox( false, sortingGroup ); | 315 | mSortTypeCombo = new KComboBox( false, sortingGroup ); |
315 | #else //KAB_EMBEDDED | 316 | #else //KAB_EMBEDDED |
316 | //US Combobox is not editable anyway | 317 | //US Combobox is not editable anyway |
317 | mSortTypeCombo = new KComboBox( sortingGroup ); | 318 | mSortTypeCombo = new KComboBox( sortingGroup ); |
318 | #endif //KAB_EMBEDDED | 319 | #endif //KAB_EMBEDDED |
319 | sortLayout->addWidget( mSortTypeCombo, 1, 1 ); | 320 | sortLayout->addWidget( mSortTypeCombo, 1, 1 ); |
320 | 321 | ||
321 | topLayout->addWidget( sortingGroup ); | 322 | topLayout->addWidget( sortingGroup ); |
322 | 323 | ||
323 | if ( !mUseSorting ) | 324 | if ( !mUseSorting ) |
324 | sortingGroup->hide(); | 325 | sortingGroup->hide(); |
325 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
326 | hideButtons(); | 327 | hideButtons(); |
327 | #endif | 328 | #endif |
328 | } | 329 | } |
329 | 330 | ||
330 | #ifndef KAB_EMBEDDED | 331 | #ifndef KAB_EMBEDDED |
331 | #include "xxportselectdialog.moc" | 332 | #include "xxportselectdialog.moc" |
332 | #endif //KAB_EMBEDDED | 333 | #endif //KAB_EMBEDDED |
333 | 334 | ||
334 | 335 | ||