author | zautrix <zautrix> | 2004-07-05 08:28:21 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-05 08:28:21 (UTC) |
commit | c2d4beeaeda44694a3e1c0b72a5808d2f518b286 (patch) (unidiff) | |
tree | ea8fffd3b18595781b6664f7a4aa705615351085 | |
parent | 9f0d4ee43ce6f8c61abbd546376ef4f262261a1e (diff) | |
download | kdepimpi-c2d4beeaeda44694a3e1c0b72a5808d2f518b286.zip kdepimpi-c2d4beeaeda44694a3e1c0b72a5808d2f518b286.tar.gz kdepimpi-c2d4beeaeda44694a3e1c0b72a5808d2f518b286.tar.bz2 |
Fix of Jumpbuttonbar on 5500 screen
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 68d3d2d..8d08713 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -417,1193 +417,1193 @@ void KABCore::setContactSelected( const QString &uid ) | |||
417 | 417 | ||
418 | mExtensionManager->setSelectionChanged(); | 418 | mExtensionManager->setSelectionChanged(); |
419 | 419 | ||
420 | // update the actions | 420 | // update the actions |
421 | bool selected = !uid.isEmpty(); | 421 | bool selected = !uid.isEmpty(); |
422 | 422 | ||
423 | if ( mReadWrite ) { | 423 | if ( mReadWrite ) { |
424 | mActionCut->setEnabled( selected ); | 424 | mActionCut->setEnabled( selected ); |
425 | mActionPaste->setEnabled( selected ); | 425 | mActionPaste->setEnabled( selected ); |
426 | } | 426 | } |
427 | 427 | ||
428 | mActionCopy->setEnabled( selected ); | 428 | mActionCopy->setEnabled( selected ); |
429 | mActionDelete->setEnabled( selected ); | 429 | mActionDelete->setEnabled( selected ); |
430 | mActionEditAddressee->setEnabled( selected ); | 430 | mActionEditAddressee->setEnabled( selected ); |
431 | mActionMail->setEnabled( selected ); | 431 | mActionMail->setEnabled( selected ); |
432 | mActionMailVCard->setEnabled( selected ); | 432 | mActionMailVCard->setEnabled( selected ); |
433 | mActionWhoAmI->setEnabled( selected ); | 433 | mActionWhoAmI->setEnabled( selected ); |
434 | mActionCategories->setEnabled( selected ); | 434 | mActionCategories->setEnabled( selected ); |
435 | } | 435 | } |
436 | 436 | ||
437 | void KABCore::sendMail() | 437 | void KABCore::sendMail() |
438 | { | 438 | { |
439 | #ifndef KAB_EMBEDDED | 439 | #ifndef KAB_EMBEDDED |
440 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 440 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
441 | #else //KAB_EMBEDDED | 441 | #else //KAB_EMBEDDED |
442 | qDebug("KABCore::sendMail() ust be fixed"); | 442 | qDebug("KABCore::sendMail() ust be fixed"); |
443 | #endif //KAB_EMBEDDED | 443 | #endif //KAB_EMBEDDED |
444 | } | 444 | } |
445 | 445 | ||
446 | void KABCore::sendMail( const QString& email ) | 446 | void KABCore::sendMail( const QString& email ) |
447 | { | 447 | { |
448 | #ifndef KAB_EMBEDDED | 448 | #ifndef KAB_EMBEDDED |
449 | kapp->invokeMailer( email, "" ); | 449 | kapp->invokeMailer( email, "" ); |
450 | #else //KAB_EMBEDDED | 450 | #else //KAB_EMBEDDED |
451 | qDebug("KABCore::sendMail(const QString& email) ust be fixed"); | 451 | qDebug("KABCore::sendMail(const QString& email) ust be fixed"); |
452 | #endif //KAB_EMBEDDED | 452 | #endif //KAB_EMBEDDED |
453 | } | 453 | } |
454 | 454 | ||
455 | void KABCore::mailVCard() | 455 | void KABCore::mailVCard() |
456 | { | 456 | { |
457 | #ifndef KAB_EMBEDDED | 457 | #ifndef KAB_EMBEDDED |
458 | QStringList uids = mViewManager->selectedUids(); | 458 | QStringList uids = mViewManager->selectedUids(); |
459 | if ( !uids.isEmpty() ) | 459 | if ( !uids.isEmpty() ) |
460 | mailVCard( uids ); | 460 | mailVCard( uids ); |
461 | #else //KAB_EMBEDDED | 461 | #else //KAB_EMBEDDED |
462 | qDebug("KABCore::mailVCard() must be fixed"); | 462 | qDebug("KABCore::mailVCard() must be fixed"); |
463 | #endif //KAB_EMBEDDED | 463 | #endif //KAB_EMBEDDED |
464 | } | 464 | } |
465 | 465 | ||
466 | void KABCore::mailVCard( const QStringList& uids ) | 466 | void KABCore::mailVCard( const QStringList& uids ) |
467 | { | 467 | { |
468 | #ifndef KAB_EMBEDDED | 468 | #ifndef KAB_EMBEDDED |
469 | QStringList urls; | 469 | QStringList urls; |
470 | 470 | ||
471 | // Create a temp dir, so that we can put the files in it with proper names | 471 | // Create a temp dir, so that we can put the files in it with proper names |
472 | KTempFile tempDir; | 472 | KTempFile tempDir; |
473 | if ( tempDir.status() != 0 ) { | 473 | if ( tempDir.status() != 0 ) { |
474 | kdWarning() << strerror( tempDir.status() ) << endl; | 474 | kdWarning() << strerror( tempDir.status() ) << endl; |
475 | return; | 475 | return; |
476 | } | 476 | } |
477 | 477 | ||
478 | QString dirName = tempDir.name(); | 478 | QString dirName = tempDir.name(); |
479 | tempDir.unlink(); | 479 | tempDir.unlink(); |
480 | QDir().mkdir( dirName, true ); | 480 | QDir().mkdir( dirName, true ); |
481 | 481 | ||
482 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 482 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
483 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 483 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
484 | 484 | ||
485 | if ( a.isEmpty() ) | 485 | if ( a.isEmpty() ) |
486 | continue; | 486 | continue; |
487 | 487 | ||
488 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 488 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
489 | 489 | ||
490 | QString fileName = dirName + "/" + name; | 490 | QString fileName = dirName + "/" + name; |
491 | 491 | ||
492 | QFile outFile(fileName); | 492 | QFile outFile(fileName); |
493 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 493 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
494 | KABC::VCardConverter converter; | 494 | KABC::VCardConverter converter; |
495 | QString vcard; | 495 | QString vcard; |
496 | 496 | ||
497 | converter.addresseeToVCard( a, vcard ); | 497 | converter.addresseeToVCard( a, vcard ); |
498 | 498 | ||
499 | QTextStream t( &outFile ); // use a text stream | 499 | QTextStream t( &outFile ); // use a text stream |
500 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 500 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
501 | t << vcard; | 501 | t << vcard; |
502 | 502 | ||
503 | outFile.close(); | 503 | outFile.close(); |
504 | 504 | ||
505 | urls.append( fileName ); | 505 | urls.append( fileName ); |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 509 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
510 | QString::null, // subject | 510 | QString::null, // subject |
511 | QString::null, // body | 511 | QString::null, // body |
512 | QString::null, | 512 | QString::null, |
513 | urls ); // attachments | 513 | urls ); // attachments |
514 | #else //KAB_EMBEDDED | 514 | #else //KAB_EMBEDDED |
515 | qDebug("KABCore::mailVCard( must be fixed"); | 515 | qDebug("KABCore::mailVCard( must be fixed"); |
516 | #endif //KAB_EMBEDDED | 516 | #endif //KAB_EMBEDDED |
517 | 517 | ||
518 | } | 518 | } |
519 | 519 | ||
520 | void KABCore::browse( const QString& url ) | 520 | void KABCore::browse( const QString& url ) |
521 | { | 521 | { |
522 | #ifndef KAB_EMBEDDED | 522 | #ifndef KAB_EMBEDDED |
523 | kapp->invokeBrowser( url ); | 523 | kapp->invokeBrowser( url ); |
524 | #else //KAB_EMBEDDED | 524 | #else //KAB_EMBEDDED |
525 | qDebug("KABCore::browse must be fixed"); | 525 | qDebug("KABCore::browse must be fixed"); |
526 | #endif //KAB_EMBEDDED | 526 | #endif //KAB_EMBEDDED |
527 | } | 527 | } |
528 | 528 | ||
529 | void KABCore::selectAllContacts() | 529 | void KABCore::selectAllContacts() |
530 | { | 530 | { |
531 | mViewManager->setSelected( QString::null, true ); | 531 | mViewManager->setSelected( QString::null, true ); |
532 | } | 532 | } |
533 | 533 | ||
534 | void KABCore::deleteContacts() | 534 | void KABCore::deleteContacts() |
535 | { | 535 | { |
536 | QStringList uidList = mViewManager->selectedUids(); | 536 | QStringList uidList = mViewManager->selectedUids(); |
537 | deleteContacts( uidList ); | 537 | deleteContacts( uidList ); |
538 | } | 538 | } |
539 | 539 | ||
540 | void KABCore::deleteContacts( const QStringList &uids ) | 540 | void KABCore::deleteContacts( const QStringList &uids ) |
541 | { | 541 | { |
542 | if ( uids.count() > 0 ) { | 542 | if ( uids.count() > 0 ) { |
543 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 543 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
544 | UndoStack::instance()->push( command ); | 544 | UndoStack::instance()->push( command ); |
545 | RedoStack::instance()->clear(); | 545 | RedoStack::instance()->clear(); |
546 | 546 | ||
547 | // now if we deleted anything, refresh | 547 | // now if we deleted anything, refresh |
548 | setContactSelected( QString::null ); | 548 | setContactSelected( QString::null ); |
549 | setModified( true ); | 549 | setModified( true ); |
550 | } | 550 | } |
551 | } | 551 | } |
552 | 552 | ||
553 | void KABCore::copyContacts() | 553 | void KABCore::copyContacts() |
554 | { | 554 | { |
555 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 555 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
556 | 556 | ||
557 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 557 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
558 | 558 | ||
559 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 559 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
560 | 560 | ||
561 | QClipboard *cb = QApplication::clipboard(); | 561 | QClipboard *cb = QApplication::clipboard(); |
562 | cb->setText( clipText ); | 562 | cb->setText( clipText ); |
563 | } | 563 | } |
564 | 564 | ||
565 | void KABCore::cutContacts() | 565 | void KABCore::cutContacts() |
566 | { | 566 | { |
567 | QStringList uidList = mViewManager->selectedUids(); | 567 | QStringList uidList = mViewManager->selectedUids(); |
568 | 568 | ||
569 | //US if ( uidList.size() > 0 ) { | 569 | //US if ( uidList.size() > 0 ) { |
570 | if ( uidList.count() > 0 ) { | 570 | if ( uidList.count() > 0 ) { |
571 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 571 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
572 | UndoStack::instance()->push( command ); | 572 | UndoStack::instance()->push( command ); |
573 | RedoStack::instance()->clear(); | 573 | RedoStack::instance()->clear(); |
574 | 574 | ||
575 | setModified( true ); | 575 | setModified( true ); |
576 | } | 576 | } |
577 | } | 577 | } |
578 | 578 | ||
579 | void KABCore::pasteContacts() | 579 | void KABCore::pasteContacts() |
580 | { | 580 | { |
581 | QClipboard *cb = QApplication::clipboard(); | 581 | QClipboard *cb = QApplication::clipboard(); |
582 | 582 | ||
583 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 583 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
584 | 584 | ||
585 | pasteContacts( list ); | 585 | pasteContacts( list ); |
586 | } | 586 | } |
587 | 587 | ||
588 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 588 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
589 | { | 589 | { |
590 | KABC::Resource *resource = requestResource( this ); | 590 | KABC::Resource *resource = requestResource( this ); |
591 | KABC::Addressee::List::Iterator it; | 591 | KABC::Addressee::List::Iterator it; |
592 | for ( it = list.begin(); it != list.end(); ++it ) | 592 | for ( it = list.begin(); it != list.end(); ++it ) |
593 | (*it).setResource( resource ); | 593 | (*it).setResource( resource ); |
594 | 594 | ||
595 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 595 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
596 | UndoStack::instance()->push( command ); | 596 | UndoStack::instance()->push( command ); |
597 | RedoStack::instance()->clear(); | 597 | RedoStack::instance()->clear(); |
598 | 598 | ||
599 | setModified( true ); | 599 | setModified( true ); |
600 | } | 600 | } |
601 | 601 | ||
602 | void KABCore::setWhoAmI() | 602 | void KABCore::setWhoAmI() |
603 | { | 603 | { |
604 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 604 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
605 | 605 | ||
606 | if ( addrList.count() > 1 ) { | 606 | if ( addrList.count() > 1 ) { |
607 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 607 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
608 | return; | 608 | return; |
609 | } | 609 | } |
610 | 610 | ||
611 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 611 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
612 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 612 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
613 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 613 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
614 | } | 614 | } |
615 | 615 | ||
616 | void KABCore::setCategories() | 616 | void KABCore::setCategories() |
617 | { | 617 | { |
618 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 618 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
619 | if ( !dlg.exec() ) | 619 | if ( !dlg.exec() ) |
620 | return; | 620 | return; |
621 | 621 | ||
622 | bool merge = false; | 622 | bool merge = false; |
623 | QString msg = i18n( "Merge with existing categories?" ); | 623 | QString msg = i18n( "Merge with existing categories?" ); |
624 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 624 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
625 | merge = true; | 625 | merge = true; |
626 | 626 | ||
627 | QStringList categories = dlg.selectedCategories(); | 627 | QStringList categories = dlg.selectedCategories(); |
628 | 628 | ||
629 | QStringList uids = mViewManager->selectedUids(); | 629 | QStringList uids = mViewManager->selectedUids(); |
630 | QStringList::Iterator it; | 630 | QStringList::Iterator it; |
631 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 631 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
632 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 632 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
633 | if ( !addr.isEmpty() ) { | 633 | if ( !addr.isEmpty() ) { |
634 | if ( !merge ) | 634 | if ( !merge ) |
635 | addr.setCategories( categories ); | 635 | addr.setCategories( categories ); |
636 | else { | 636 | else { |
637 | QStringList addrCategories = addr.categories(); | 637 | QStringList addrCategories = addr.categories(); |
638 | QStringList::Iterator catIt; | 638 | QStringList::Iterator catIt; |
639 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 639 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
640 | if ( !addrCategories.contains( *catIt ) ) | 640 | if ( !addrCategories.contains( *catIt ) ) |
641 | addrCategories.append( *catIt ); | 641 | addrCategories.append( *catIt ); |
642 | } | 642 | } |
643 | addr.setCategories( addrCategories ); | 643 | addr.setCategories( addrCategories ); |
644 | } | 644 | } |
645 | 645 | ||
646 | mAddressBook->insertAddressee( addr ); | 646 | mAddressBook->insertAddressee( addr ); |
647 | } | 647 | } |
648 | } | 648 | } |
649 | 649 | ||
650 | if ( uids.count() > 0 ) | 650 | if ( uids.count() > 0 ) |
651 | setModified( true ); | 651 | setModified( true ); |
652 | } | 652 | } |
653 | 653 | ||
654 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 654 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
655 | { | 655 | { |
656 | mIncSearchWidget->setFields( fields ); | 656 | mIncSearchWidget->setFields( fields ); |
657 | } | 657 | } |
658 | 658 | ||
659 | void KABCore::incrementalSearch( const QString& text ) | 659 | void KABCore::incrementalSearch( const QString& text ) |
660 | { | 660 | { |
661 | mViewManager->setSelected( QString::null, false ); | 661 | mViewManager->setSelected( QString::null, false ); |
662 | 662 | ||
663 | if ( !text.isEmpty() ) { | 663 | if ( !text.isEmpty() ) { |
664 | KABC::Field *field = mIncSearchWidget->currentField(); | 664 | KABC::Field *field = mIncSearchWidget->currentField(); |
665 | 665 | ||
666 | QString pattern = text.lower(); | 666 | QString pattern = text.lower(); |
667 | 667 | ||
668 | #if KDE_VERSION >= 319 | 668 | #if KDE_VERSION >= 319 |
669 | KABC::AddresseeList list( mAddressBook->allAddressees() ); | 669 | KABC::AddresseeList list( mAddressBook->allAddressees() ); |
670 | if ( field ) { | 670 | if ( field ) { |
671 | list.sortByField( field ); | 671 | list.sortByField( field ); |
672 | KABC::AddresseeList::Iterator it; | 672 | KABC::AddresseeList::Iterator it; |
673 | for ( it = list.begin(); it != list.end(); ++it ) { | 673 | for ( it = list.begin(); it != list.end(); ++it ) { |
674 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 674 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
675 | mViewManager->setSelected( (*it).uid(), true ); | 675 | mViewManager->setSelected( (*it).uid(), true ); |
676 | return; | 676 | return; |
677 | } | 677 | } |
678 | } | 678 | } |
679 | } else { | 679 | } else { |
680 | KABC::AddresseeList::Iterator it; | 680 | KABC::AddresseeList::Iterator it; |
681 | for ( it = list.begin(); it != list.end(); ++it ) { | 681 | for ( it = list.begin(); it != list.end(); ++it ) { |
682 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 682 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
683 | KABC::Field::List::ConstIterator fieldIt; | 683 | KABC::Field::List::ConstIterator fieldIt; |
684 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 684 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
685 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 685 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
686 | mViewManager->setSelected( (*it).uid(), true ); | 686 | mViewManager->setSelected( (*it).uid(), true ); |
687 | return; | 687 | return; |
688 | } | 688 | } |
689 | } | 689 | } |
690 | } | 690 | } |
691 | } | 691 | } |
692 | #else | 692 | #else |
693 | KABC::AddressBook::Iterator it; | 693 | KABC::AddressBook::Iterator it; |
694 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 694 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
695 | if ( field ) { | 695 | if ( field ) { |
696 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 696 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
697 | mViewManager->setSelected( (*it).uid(), true ); | 697 | mViewManager->setSelected( (*it).uid(), true ); |
698 | return; | 698 | return; |
699 | } | 699 | } |
700 | } else { | 700 | } else { |
701 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 701 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
702 | KABC::Field::List::ConstIterator fieldIt; | 702 | KABC::Field::List::ConstIterator fieldIt; |
703 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 703 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
704 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 704 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
705 | mViewManager->setSelected( (*it).uid(), true ); | 705 | mViewManager->setSelected( (*it).uid(), true ); |
706 | return; | 706 | return; |
707 | } | 707 | } |
708 | } | 708 | } |
709 | } | 709 | } |
710 | } | 710 | } |
711 | #endif | 711 | #endif |
712 | } | 712 | } |
713 | } | 713 | } |
714 | 714 | ||
715 | void KABCore::setModified() | 715 | void KABCore::setModified() |
716 | { | 716 | { |
717 | setModified( true ); | 717 | setModified( true ); |
718 | } | 718 | } |
719 | 719 | ||
720 | void KABCore::setModifiedWOrefresh() | 720 | void KABCore::setModifiedWOrefresh() |
721 | { | 721 | { |
722 | // qDebug("KABCore::setModifiedWOrefresh() "); | 722 | // qDebug("KABCore::setModifiedWOrefresh() "); |
723 | mModified = true; | 723 | mModified = true; |
724 | mActionSave->setEnabled( mModified ); | 724 | mActionSave->setEnabled( mModified ); |
725 | #ifdef DESKTOP_VERSION | 725 | #ifdef DESKTOP_VERSION |
726 | mDetails->refreshView(); | 726 | mDetails->refreshView(); |
727 | #endif | 727 | #endif |
728 | 728 | ||
729 | } | 729 | } |
730 | void KABCore::setModified( bool modified ) | 730 | void KABCore::setModified( bool modified ) |
731 | { | 731 | { |
732 | mModified = modified; | 732 | mModified = modified; |
733 | mActionSave->setEnabled( mModified ); | 733 | mActionSave->setEnabled( mModified ); |
734 | 734 | ||
735 | if ( modified ) | 735 | if ( modified ) |
736 | mJumpButtonBar->recreateButtons(); | 736 | mJumpButtonBar->recreateButtons(); |
737 | 737 | ||
738 | mViewManager->refreshView(); | 738 | mViewManager->refreshView(); |
739 | mDetails->refreshView(); | 739 | mDetails->refreshView(); |
740 | 740 | ||
741 | } | 741 | } |
742 | 742 | ||
743 | bool KABCore::modified() const | 743 | bool KABCore::modified() const |
744 | { | 744 | { |
745 | return mModified; | 745 | return mModified; |
746 | } | 746 | } |
747 | 747 | ||
748 | void KABCore::contactModified( const KABC::Addressee &addr ) | 748 | void KABCore::contactModified( const KABC::Addressee &addr ) |
749 | { | 749 | { |
750 | 750 | ||
751 | Command *command = 0; | 751 | Command *command = 0; |
752 | QString uid; | 752 | QString uid; |
753 | 753 | ||
754 | // check if it exists already | 754 | // check if it exists already |
755 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 755 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
756 | if ( origAddr.isEmpty() ) | 756 | if ( origAddr.isEmpty() ) |
757 | command = new PwNewCommand( mAddressBook, addr ); | 757 | command = new PwNewCommand( mAddressBook, addr ); |
758 | else { | 758 | else { |
759 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 759 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
760 | uid = addr.uid(); | 760 | uid = addr.uid(); |
761 | } | 761 | } |
762 | 762 | ||
763 | UndoStack::instance()->push( command ); | 763 | UndoStack::instance()->push( command ); |
764 | RedoStack::instance()->clear(); | 764 | RedoStack::instance()->clear(); |
765 | 765 | ||
766 | setModified( true ); | 766 | setModified( true ); |
767 | } | 767 | } |
768 | 768 | ||
769 | void KABCore::newContact() | 769 | void KABCore::newContact() |
770 | { | 770 | { |
771 | AddresseeEditorDialog *dialog = 0; | 771 | AddresseeEditorDialog *dialog = 0; |
772 | 772 | ||
773 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 773 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
774 | 774 | ||
775 | QPtrList<KRES::Resource> kresResources; | 775 | QPtrList<KRES::Resource> kresResources; |
776 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 776 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
777 | KABC::Resource *resource; | 777 | KABC::Resource *resource; |
778 | while ( ( resource = it.current() ) != 0 ) { | 778 | while ( ( resource = it.current() ) != 0 ) { |
779 | ++it; | 779 | ++it; |
780 | if ( !resource->readOnly() ) { | 780 | if ( !resource->readOnly() ) { |
781 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 781 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
782 | if ( res ) | 782 | if ( res ) |
783 | kresResources.append( res ); | 783 | kresResources.append( res ); |
784 | } | 784 | } |
785 | } | 785 | } |
786 | 786 | ||
787 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 787 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
788 | resource = static_cast<KABC::Resource*>( res ); | 788 | resource = static_cast<KABC::Resource*>( res ); |
789 | 789 | ||
790 | if ( resource ) { | 790 | if ( resource ) { |
791 | KABC::Addressee addr; | 791 | KABC::Addressee addr; |
792 | addr.setResource( resource ); | 792 | addr.setResource( resource ); |
793 | dialog = createAddresseeEditorDialog( this ); | 793 | dialog = createAddresseeEditorDialog( this ); |
794 | dialog->setAddressee( addr ); | 794 | dialog->setAddressee( addr ); |
795 | 795 | ||
796 | } else | 796 | } else |
797 | return; | 797 | return; |
798 | 798 | ||
799 | mEditorDict.insert( dialog->addressee().uid(), dialog ); | 799 | mEditorDict.insert( dialog->addressee().uid(), dialog ); |
800 | 800 | ||
801 | dialog->show(); | 801 | dialog->show(); |
802 | 802 | ||
803 | } | 803 | } |
804 | 804 | ||
805 | void KABCore::addEmail( QString aStr ) | 805 | void KABCore::addEmail( QString aStr ) |
806 | { | 806 | { |
807 | #ifndef KAB_EMBEDDED | 807 | #ifndef KAB_EMBEDDED |
808 | QString fullName, email; | 808 | QString fullName, email; |
809 | 809 | ||
810 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 810 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
811 | 811 | ||
812 | // Try to lookup the addressee matching the email address | 812 | // Try to lookup the addressee matching the email address |
813 | bool found = false; | 813 | bool found = false; |
814 | QStringList emailList; | 814 | QStringList emailList; |
815 | KABC::AddressBook::Iterator it; | 815 | KABC::AddressBook::Iterator it; |
816 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 816 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
817 | emailList = (*it).emails(); | 817 | emailList = (*it).emails(); |
818 | if ( emailList.contains( email ) > 0 ) { | 818 | if ( emailList.contains( email ) > 0 ) { |
819 | found = true; | 819 | found = true; |
820 | (*it).setNameFromString( fullName ); | 820 | (*it).setNameFromString( fullName ); |
821 | editContact( (*it).uid() ); | 821 | editContact( (*it).uid() ); |
822 | } | 822 | } |
823 | } | 823 | } |
824 | 824 | ||
825 | if ( !found ) { | 825 | if ( !found ) { |
826 | KABC::Addressee addr; | 826 | KABC::Addressee addr; |
827 | addr.setNameFromString( fullName ); | 827 | addr.setNameFromString( fullName ); |
828 | addr.insertEmail( email, true ); | 828 | addr.insertEmail( email, true ); |
829 | 829 | ||
830 | mAddressBook->insertAddressee( addr ); | 830 | mAddressBook->insertAddressee( addr ); |
831 | mViewManager->refreshView( addr.uid() ); | 831 | mViewManager->refreshView( addr.uid() ); |
832 | editContact( addr.uid() ); | 832 | editContact( addr.uid() ); |
833 | } | 833 | } |
834 | #else //KAB_EMBEDDED | 834 | #else //KAB_EMBEDDED |
835 | qDebug("KABCore::addEmail finsih method"); | 835 | qDebug("KABCore::addEmail finsih method"); |
836 | #endif //KAB_EMBEDDED | 836 | #endif //KAB_EMBEDDED |
837 | } | 837 | } |
838 | 838 | ||
839 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 839 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
840 | { | 840 | { |
841 | mXXPortManager->importVCard( url, showPreview ); | 841 | mXXPortManager->importVCard( url, showPreview ); |
842 | } | 842 | } |
843 | 843 | ||
844 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 844 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
845 | { | 845 | { |
846 | mXXPortManager->importVCard( vCard, showPreview ); | 846 | mXXPortManager->importVCard( vCard, showPreview ); |
847 | } | 847 | } |
848 | 848 | ||
849 | //US added a second method without defaultparameter | 849 | //US added a second method without defaultparameter |
850 | void KABCore::editContact2() { | 850 | void KABCore::editContact2() { |
851 | editContact( QString::null ); | 851 | editContact( QString::null ); |
852 | } | 852 | } |
853 | 853 | ||
854 | void KABCore::editContact( const QString &uid ) | 854 | void KABCore::editContact( const QString &uid ) |
855 | { | 855 | { |
856 | 856 | ||
857 | if ( mExtensionManager->isQuickEditVisible() ) | 857 | if ( mExtensionManager->isQuickEditVisible() ) |
858 | return; | 858 | return; |
859 | 859 | ||
860 | // First, locate the contact entry | 860 | // First, locate the contact entry |
861 | QString localUID = uid; | 861 | QString localUID = uid; |
862 | if ( localUID.isNull() ) { | 862 | if ( localUID.isNull() ) { |
863 | QStringList uidList = mViewManager->selectedUids(); | 863 | QStringList uidList = mViewManager->selectedUids(); |
864 | if ( uidList.count() > 0 ) | 864 | if ( uidList.count() > 0 ) |
865 | localUID = *( uidList.at( 0 ) ); | 865 | localUID = *( uidList.at( 0 ) ); |
866 | } | 866 | } |
867 | 867 | ||
868 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 868 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
869 | if ( !addr.isEmpty() ) { | 869 | if ( !addr.isEmpty() ) { |
870 | AddresseeEditorDialog *dialog = mEditorDict.find( addr.uid() ); | 870 | AddresseeEditorDialog *dialog = mEditorDict.find( addr.uid() ); |
871 | if ( !dialog ) { | 871 | if ( !dialog ) { |
872 | dialog = createAddresseeEditorDialog( this ); | 872 | dialog = createAddresseeEditorDialog( this ); |
873 | 873 | ||
874 | mEditorDict.insert( addr.uid(), dialog ); | 874 | mEditorDict.insert( addr.uid(), dialog ); |
875 | 875 | ||
876 | dialog->setAddressee( addr ); | 876 | dialog->setAddressee( addr ); |
877 | } | 877 | } |
878 | 878 | ||
879 | dialog->raise(); | 879 | dialog->raise(); |
880 | dialog->show(); | 880 | dialog->show(); |
881 | } | 881 | } |
882 | } | 882 | } |
883 | 883 | ||
884 | void KABCore::save() | 884 | void KABCore::save() |
885 | { | 885 | { |
886 | if ( !mModified ) | 886 | if ( !mModified ) |
887 | return; | 887 | return; |
888 | QString text = i18n( "There was an error while attempting to save\n the " | 888 | QString text = i18n( "There was an error while attempting to save\n the " |
889 | "address book. Please check that some \nother application is " | 889 | "address book. Please check that some \nother application is " |
890 | "not using it. " ); | 890 | "not using it. " ); |
891 | statusMessage(i18n("Saving addressbook ... ")); | 891 | statusMessage(i18n("Saving addressbook ... ")); |
892 | #ifndef KAB_EMBEDDED | 892 | #ifndef KAB_EMBEDDED |
893 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 893 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
894 | if ( !b || !b->save() ) { | 894 | if ( !b || !b->save() ) { |
895 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 895 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
896 | } | 896 | } |
897 | #else //KAB_EMBEDDED | 897 | #else //KAB_EMBEDDED |
898 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 898 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
899 | if ( !b || !b->save() ) { | 899 | if ( !b || !b->save() ) { |
900 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 900 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
901 | } | 901 | } |
902 | #endif //KAB_EMBEDDED | 902 | #endif //KAB_EMBEDDED |
903 | 903 | ||
904 | statusMessage(i18n("Addressbook saved!")); | 904 | statusMessage(i18n("Addressbook saved!")); |
905 | setModified( false ); | 905 | setModified( false ); |
906 | } | 906 | } |
907 | 907 | ||
908 | void KABCore::statusMessage(QString mess , int time ) | 908 | void KABCore::statusMessage(QString mess , int time ) |
909 | { | 909 | { |
910 | //topLevelWidget()->setCaption( mess ); | 910 | //topLevelWidget()->setCaption( mess ); |
911 | // pending setting timer to revome message | 911 | // pending setting timer to revome message |
912 | } | 912 | } |
913 | void KABCore::undo() | 913 | void KABCore::undo() |
914 | { | 914 | { |
915 | UndoStack::instance()->undo(); | 915 | UndoStack::instance()->undo(); |
916 | 916 | ||
917 | // Refresh the view | 917 | // Refresh the view |
918 | mViewManager->refreshView(); | 918 | mViewManager->refreshView(); |
919 | } | 919 | } |
920 | 920 | ||
921 | void KABCore::redo() | 921 | void KABCore::redo() |
922 | { | 922 | { |
923 | RedoStack::instance()->redo(); | 923 | RedoStack::instance()->redo(); |
924 | 924 | ||
925 | // Refresh the view | 925 | // Refresh the view |
926 | mViewManager->refreshView(); | 926 | mViewManager->refreshView(); |
927 | } | 927 | } |
928 | 928 | ||
929 | void KABCore::setJumpButtonBarVisible( bool visible ) | 929 | void KABCore::setJumpButtonBarVisible( bool visible ) |
930 | { | 930 | { |
931 | if ( visible ) | 931 | if ( visible ) |
932 | mJumpButtonBar->show(); | 932 | mJumpButtonBar->show(); |
933 | else | 933 | else |
934 | mJumpButtonBar->hide(); | 934 | mJumpButtonBar->hide(); |
935 | } | 935 | } |
936 | void KABCore::setDetailsToState() | 936 | void KABCore::setDetailsToState() |
937 | { | 937 | { |
938 | setDetailsVisible( mActionDetails->isChecked() ); | 938 | setDetailsVisible( mActionDetails->isChecked() ); |
939 | } | 939 | } |
940 | 940 | ||
941 | void KABCore::setDetailsVisible( bool visible ) | 941 | void KABCore::setDetailsVisible( bool visible ) |
942 | { | 942 | { |
943 | if ( visible ) | 943 | if ( visible ) |
944 | mDetails->show(); | 944 | mDetails->show(); |
945 | else | 945 | else |
946 | mDetails->hide(); | 946 | mDetails->hide(); |
947 | } | 947 | } |
948 | 948 | ||
949 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 949 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
950 | { | 950 | { |
951 | 951 | ||
952 | if ( list.count() != 0 ) { | 952 | if ( list.count() != 0 ) { |
953 | KABC::Addressee::List::ConstIterator it; | 953 | KABC::Addressee::List::ConstIterator it; |
954 | for ( it = list.begin(); it != list.end(); ++it ) | 954 | for ( it = list.begin(); it != list.end(); ++it ) |
955 | mAddressBook->insertAddressee( *it ); | 955 | mAddressBook->insertAddressee( *it ); |
956 | if ( list.count() > 1 ) | 956 | if ( list.count() > 1 ) |
957 | setModified(); | 957 | setModified(); |
958 | else | 958 | else |
959 | setModifiedWOrefresh(); | 959 | setModifiedWOrefresh(); |
960 | } | 960 | } |
961 | if ( list.count() == 0 ) | 961 | if ( list.count() == 0 ) |
962 | mViewManager->refreshView(); | 962 | mViewManager->refreshView(); |
963 | else | 963 | else |
964 | mViewManager->refreshView( list[ 0 ].uid() ); | 964 | mViewManager->refreshView( list[ 0 ].uid() ); |
965 | 965 | ||
966 | 966 | ||
967 | 967 | ||
968 | } | 968 | } |
969 | 969 | ||
970 | QString KABCore::getNameByPhone( const QString &phone ) | 970 | QString KABCore::getNameByPhone( const QString &phone ) |
971 | { | 971 | { |
972 | #ifndef KAB_EMBEDDED | 972 | #ifndef KAB_EMBEDDED |
973 | QRegExp r( "[/*/-/ ]" ); | 973 | QRegExp r( "[/*/-/ ]" ); |
974 | QString localPhone( phone ); | 974 | QString localPhone( phone ); |
975 | 975 | ||
976 | bool found = false; | 976 | bool found = false; |
977 | QString ownerName = ""; | 977 | QString ownerName = ""; |
978 | KABC::AddressBook::Iterator iter; | 978 | KABC::AddressBook::Iterator iter; |
979 | KABC::PhoneNumber::List::Iterator phoneIter; | 979 | KABC::PhoneNumber::List::Iterator phoneIter; |
980 | KABC::PhoneNumber::List phoneList; | 980 | KABC::PhoneNumber::List phoneList; |
981 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 981 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
982 | phoneList = (*iter).phoneNumbers(); | 982 | phoneList = (*iter).phoneNumbers(); |
983 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 983 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
984 | ++phoneIter) { | 984 | ++phoneIter) { |
985 | // Get rid of separator chars so just the numbers are compared. | 985 | // Get rid of separator chars so just the numbers are compared. |
986 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 986 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
987 | ownerName = (*iter).formattedName(); | 987 | ownerName = (*iter).formattedName(); |
988 | found = true; | 988 | found = true; |
989 | } | 989 | } |
990 | } | 990 | } |
991 | } | 991 | } |
992 | 992 | ||
993 | return ownerName; | 993 | return ownerName; |
994 | #else //KAB_EMBEDDED | 994 | #else //KAB_EMBEDDED |
995 | qDebug("KABCore::getNameByPhone finsih method"); | 995 | qDebug("KABCore::getNameByPhone finsih method"); |
996 | return ""; | 996 | return ""; |
997 | #endif //KAB_EMBEDDED | 997 | #endif //KAB_EMBEDDED |
998 | 998 | ||
999 | } | 999 | } |
1000 | 1000 | ||
1001 | void KABCore::openConfigDialog() | 1001 | void KABCore::openConfigDialog() |
1002 | { | 1002 | { |
1003 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1003 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1004 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1004 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1005 | ConfigureDialog->addModule(kabcfg ); | 1005 | ConfigureDialog->addModule(kabcfg ); |
1006 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1006 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1007 | this, SLOT( configurationChanged() ) ); | 1007 | this, SLOT( configurationChanged() ) ); |
1008 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1008 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1009 | this, SLOT( configurationChanged() ) ); | 1009 | this, SLOT( configurationChanged() ) ); |
1010 | saveSettings(); | 1010 | saveSettings(); |
1011 | ConfigureDialog->showMaximized(); | 1011 | ConfigureDialog->showMaximized(); |
1012 | if ( ConfigureDialog->exec() ) | 1012 | if ( ConfigureDialog->exec() ) |
1013 | KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); | 1013 | KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); |
1014 | delete ConfigureDialog; | 1014 | delete ConfigureDialog; |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | void KABCore::openLDAPDialog() | 1017 | void KABCore::openLDAPDialog() |
1018 | { | 1018 | { |
1019 | #ifndef KAB_EMBEDDED | 1019 | #ifndef KAB_EMBEDDED |
1020 | if ( !mLdapSearchDialog ) { | 1020 | if ( !mLdapSearchDialog ) { |
1021 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1021 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1022 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1022 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1023 | SLOT( refreshView() ) ); | 1023 | SLOT( refreshView() ) ); |
1024 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1024 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1025 | SLOT( setModified() ) ); | 1025 | SLOT( setModified() ) ); |
1026 | } else | 1026 | } else |
1027 | mLdapSearchDialog->restoreSettings(); | 1027 | mLdapSearchDialog->restoreSettings(); |
1028 | 1028 | ||
1029 | if ( mLdapSearchDialog->isOK() ) | 1029 | if ( mLdapSearchDialog->isOK() ) |
1030 | mLdapSearchDialog->exec(); | 1030 | mLdapSearchDialog->exec(); |
1031 | #else //KAB_EMBEDDED | 1031 | #else //KAB_EMBEDDED |
1032 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1032 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1033 | #endif //KAB_EMBEDDED | 1033 | #endif //KAB_EMBEDDED |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | void KABCore::print() | 1036 | void KABCore::print() |
1037 | { | 1037 | { |
1038 | #ifndef KAB_EMBEDDED | 1038 | #ifndef KAB_EMBEDDED |
1039 | KPrinter printer; | 1039 | KPrinter printer; |
1040 | if ( !printer.setup( this ) ) | 1040 | if ( !printer.setup( this ) ) |
1041 | return; | 1041 | return; |
1042 | 1042 | ||
1043 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1043 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1044 | mViewManager->selectedUids(), this ); | 1044 | mViewManager->selectedUids(), this ); |
1045 | 1045 | ||
1046 | wizard.exec(); | 1046 | wizard.exec(); |
1047 | #else //KAB_EMBEDDED | 1047 | #else //KAB_EMBEDDED |
1048 | qDebug("KABCore::print() finsih method"); | 1048 | qDebug("KABCore::print() finsih method"); |
1049 | #endif //KAB_EMBEDDED | 1049 | #endif //KAB_EMBEDDED |
1050 | 1050 | ||
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | 1053 | ||
1054 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1054 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1055 | { | 1055 | { |
1056 | if ( mGUIClient ) | 1056 | if ( mGUIClient ) |
1057 | mGUIClient->insertChildClient( client ); | 1057 | mGUIClient->insertChildClient( client ); |
1058 | else | 1058 | else |
1059 | KMessageBox::error( this, "no KXMLGUICLient"); | 1059 | KMessageBox::error( this, "no KXMLGUICLient"); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | 1062 | ||
1063 | void KABCore::configurationChanged() | 1063 | void KABCore::configurationChanged() |
1064 | { | 1064 | { |
1065 | mExtensionManager->reconfigure(); | 1065 | mExtensionManager->reconfigure(); |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | void KABCore::addressBookChanged() | 1068 | void KABCore::addressBookChanged() |
1069 | { | 1069 | { |
1070 | #ifndef KAB_EMBEDDED | 1070 | #ifndef KAB_EMBEDDED |
1071 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1071 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1072 | while ( it.current() ) { | 1072 | while ( it.current() ) { |
1073 | if ( it.current()->dirty() ) { | 1073 | if ( it.current()->dirty() ) { |
1074 | QString text = i18n( "Data has been changed externally. Unsaved " | 1074 | QString text = i18n( "Data has been changed externally. Unsaved " |
1075 | "changes will be lost." ); | 1075 | "changes will be lost." ); |
1076 | KMessageBox::information( this, text ); | 1076 | KMessageBox::information( this, text ); |
1077 | } | 1077 | } |
1078 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1078 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1079 | ++it; | 1079 | ++it; |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | mViewManager->refreshView(); | 1082 | mViewManager->refreshView(); |
1083 | #else //KAB_EMBEDDED | 1083 | #else //KAB_EMBEDDED |
1084 | qDebug("KABCore::addressBookChanged() finsih method"); | 1084 | qDebug("KABCore::addressBookChanged() finsih method"); |
1085 | #endif //KAB_EMBEDDED | 1085 | #endif //KAB_EMBEDDED |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1088 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1089 | const char *name ) | 1089 | const char *name ) |
1090 | { | 1090 | { |
1091 | AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, | 1091 | AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, |
1092 | name ? name : "editorDialog" ); | 1092 | name ? name : "editorDialog" ); |
1093 | 1093 | ||
1094 | //US | 1094 | //US |
1095 | dialog->setMaximumSize( 640, 480 ); | 1095 | dialog->setMaximumSize( 640, 480 ); |
1096 | dialog->showMaximized(); | 1096 | dialog->showMaximized(); |
1097 | 1097 | ||
1098 | connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1098 | connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1099 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1099 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1100 | connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), | 1100 | connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), |
1101 | SLOT( slotEditorDestroyed( const QString& ) ) ); | 1101 | SLOT( slotEditorDestroyed( const QString& ) ) ); |
1102 | 1102 | ||
1103 | return dialog; | 1103 | return dialog; |
1104 | } | 1104 | } |
1105 | 1105 | ||
1106 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1106 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1107 | { | 1107 | { |
1108 | mEditorDict.remove( uid ); | 1108 | mEditorDict.remove( uid ); |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | void KABCore::initGUI() | 1111 | void KABCore::initGUI() |
1112 | { | 1112 | { |
1113 | #ifndef KAB_EMBEDDED | 1113 | #ifndef KAB_EMBEDDED |
1114 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1114 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1115 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1115 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1116 | 1116 | ||
1117 | mExtensionBarSplitter = new QSplitter( this ); | 1117 | mExtensionBarSplitter = new QSplitter( this ); |
1118 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1118 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1119 | 1119 | ||
1120 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1120 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1121 | 1121 | ||
1122 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1122 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1123 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1123 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1124 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1124 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1125 | SLOT( incrementalSearch( const QString& ) ) ); | 1125 | SLOT( incrementalSearch( const QString& ) ) ); |
1126 | 1126 | ||
1127 | mViewManager = new ViewManager( this, viewSpace ); | 1127 | mViewManager = new ViewManager( this, viewSpace ); |
1128 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1128 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1129 | 1129 | ||
1130 | mDetails = new ViewContainer( mDetailsSplitter ); | 1130 | mDetails = new ViewContainer( mDetailsSplitter ); |
1131 | 1131 | ||
1132 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1132 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1133 | 1133 | ||
1134 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1134 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1135 | 1135 | ||
1136 | topLayout->addWidget( mExtensionBarSplitter ); | 1136 | topLayout->addWidget( mExtensionBarSplitter ); |
1137 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1137 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1138 | topLayout->addWidget( mJumpButtonBar ); | 1138 | topLayout->addWidget( mJumpButtonBar ); |
1139 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1139 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1140 | 1140 | ||
1141 | mXXPortManager = new XXPortManager( this, this ); | 1141 | mXXPortManager = new XXPortManager( this, this ); |
1142 | 1142 | ||
1143 | #else //KAB_EMBEDDED | 1143 | #else //KAB_EMBEDDED |
1144 | //US initialize viewMenu before settingup viewmanager. | 1144 | //US initialize viewMenu before settingup viewmanager. |
1145 | // Viewmanager needs this menu to plugin submenues. | 1145 | // Viewmanager needs this menu to plugin submenues. |
1146 | viewMenu = new QPopupMenu( this ); | 1146 | viewMenu = new QPopupMenu( this ); |
1147 | settingsMenu = new QPopupMenu( this ); | 1147 | settingsMenu = new QPopupMenu( this ); |
1148 | //filterMenu = new QPopupMenu( this ); | 1148 | //filterMenu = new QPopupMenu( this ); |
1149 | ImportMenu = new QPopupMenu( this ); | 1149 | ImportMenu = new QPopupMenu( this ); |
1150 | ExportMenu = new QPopupMenu( this ); | 1150 | ExportMenu = new QPopupMenu( this ); |
1151 | 1151 | ||
1152 | 1152 | ||
1153 | //US since we have no splitter for the embedded system, setup | 1153 | //US since we have no splitter for the embedded system, setup |
1154 | // a layout with two frames. One left and one right. | 1154 | // a layout with two frames. One left and one right. |
1155 | 1155 | ||
1156 | QBoxLayout *topLayout; | 1156 | QBoxLayout *topLayout; |
1157 | 1157 | ||
1158 | // = new QHBoxLayout( this ); | 1158 | // = new QHBoxLayout( this ); |
1159 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1159 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1160 | 1160 | ||
1161 | // QWidget *mainBox = new QWidget( this ); | 1161 | // QWidget *mainBox = new QWidget( this ); |
1162 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1162 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1163 | 1163 | ||
1164 | #ifdef DESKTOP_VERSION | 1164 | #ifdef DESKTOP_VERSION |
1165 | topLayout = new QHBoxLayout( this ); | 1165 | topLayout = new QHBoxLayout( this ); |
1166 | 1166 | ||
1167 | 1167 | ||
1168 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1168 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1169 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1169 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1170 | 1170 | ||
1171 | topLayout->addWidget(mMiniSplitter ); | 1171 | topLayout->addWidget(mMiniSplitter ); |
1172 | 1172 | ||
1173 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1173 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1174 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1174 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1175 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1175 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1176 | mDetails = new ViewContainer( mMiniSplitter ); | 1176 | mDetails = new ViewContainer( mMiniSplitter ); |
1177 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1177 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1178 | #else | 1178 | #else |
1179 | if ( QApplication::desktop()->width() > 480 ) { | 1179 | if ( QApplication::desktop()->width() > 480 ) { |
1180 | topLayout = new QHBoxLayout( this ); | 1180 | topLayout = new QHBoxLayout( this ); |
1181 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1181 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1182 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1182 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1183 | } else { | 1183 | } else { |
1184 | 1184 | ||
1185 | topLayout = new QVBoxLayout( this ); | 1185 | topLayout = new QHBoxLayout( this ); |
1186 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1186 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1187 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1187 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | topLayout->addWidget(mMiniSplitter ); | 1190 | topLayout->addWidget(mMiniSplitter ); |
1191 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1191 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1192 | mDetails = new ViewContainer( mMiniSplitter ); | 1192 | mDetails = new ViewContainer( mMiniSplitter ); |
1193 | 1193 | ||
1194 | 1194 | ||
1195 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1195 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1196 | #endif | 1196 | #endif |
1197 | //eh->hide(); | 1197 | //eh->hide(); |
1198 | // topLayout->addWidget(mExtensionManager ); | 1198 | // topLayout->addWidget(mExtensionManager ); |
1199 | 1199 | ||
1200 | 1200 | ||
1201 | /*US | 1201 | /*US |
1202 | #ifndef KAB_NOSPLITTER | 1202 | #ifndef KAB_NOSPLITTER |
1203 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1203 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1204 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1204 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1205 | topLayout->setSpacing( 10 ); | 1205 | topLayout->setSpacing( 10 ); |
1206 | 1206 | ||
1207 | mDetailsSplitter = new QSplitter( this ); | 1207 | mDetailsSplitter = new QSplitter( this ); |
1208 | 1208 | ||
1209 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1209 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1210 | 1210 | ||
1211 | mViewManager = new ViewManager( this, viewSpace ); | 1211 | mViewManager = new ViewManager( this, viewSpace ); |
1212 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1212 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1213 | 1213 | ||
1214 | mDetails = new ViewContainer( mDetailsSplitter ); | 1214 | mDetails = new ViewContainer( mDetailsSplitter ); |
1215 | 1215 | ||
1216 | topLayout->addWidget( mDetailsSplitter ); | 1216 | topLayout->addWidget( mDetailsSplitter ); |
1217 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1217 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1218 | #else //KAB_NOSPLITTER | 1218 | #else //KAB_NOSPLITTER |
1219 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1219 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1220 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1220 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1221 | topLayout->setSpacing( 10 ); | 1221 | topLayout->setSpacing( 10 ); |
1222 | 1222 | ||
1223 | // mDetailsSplitter = new QSplitter( this ); | 1223 | // mDetailsSplitter = new QSplitter( this ); |
1224 | 1224 | ||
1225 | QVBox *viewSpace = new QVBox( this ); | 1225 | QVBox *viewSpace = new QVBox( this ); |
1226 | 1226 | ||
1227 | mViewManager = new ViewManager( this, viewSpace ); | 1227 | mViewManager = new ViewManager( this, viewSpace ); |
1228 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1228 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1229 | 1229 | ||
1230 | mDetails = new ViewContainer( this ); | 1230 | mDetails = new ViewContainer( this ); |
1231 | 1231 | ||
1232 | topLayout->addWidget( viewSpace ); | 1232 | topLayout->addWidget( viewSpace ); |
1233 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1233 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1234 | topLayout->addWidget( mDetails ); | 1234 | topLayout->addWidget( mDetails ); |
1235 | #endif //KAB_NOSPLITTER | 1235 | #endif //KAB_NOSPLITTER |
1236 | */ | 1236 | */ |
1237 | 1237 | ||
1238 | 1238 | ||
1239 | #endif //KAB_EMBEDDED | 1239 | #endif //KAB_EMBEDDED |
1240 | initActions(); | 1240 | initActions(); |
1241 | 1241 | ||
1242 | #ifdef KAB_EMBEDDED | 1242 | #ifdef KAB_EMBEDDED |
1243 | addActionsManually(); | 1243 | addActionsManually(); |
1244 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1244 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1245 | mXXPortManager = new XXPortManager( this, this ); | 1245 | mXXPortManager = new XXPortManager( this, this ); |
1246 | 1246 | ||
1247 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1247 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1248 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1248 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1249 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1249 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1250 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1250 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1251 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1251 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1252 | // mIncSearchWidget->hide(); | 1252 | // mIncSearchWidget->hide(); |
1253 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1253 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1254 | SLOT( incrementalSearch( const QString& ) ) ); | 1254 | SLOT( incrementalSearch( const QString& ) ) ); |
1255 | 1255 | ||
1256 | 1256 | ||
1257 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1257 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1258 | 1258 | ||
1259 | topLayout->addWidget( mJumpButtonBar ); | 1259 | topLayout->addWidget( mJumpButtonBar ); |
1260 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1260 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1261 | 1261 | ||
1262 | // mMainWindow->getIconToolBar()->raise(); | 1262 | // mMainWindow->getIconToolBar()->raise(); |
1263 | 1263 | ||
1264 | #endif //KAB_EMBEDDED | 1264 | #endif //KAB_EMBEDDED |
1265 | 1265 | ||
1266 | } | 1266 | } |
1267 | void KABCore::initActions() | 1267 | void KABCore::initActions() |
1268 | { | 1268 | { |
1269 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1269 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1270 | 1270 | ||
1271 | #ifndef KAB_EMBEDDED | 1271 | #ifndef KAB_EMBEDDED |
1272 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1272 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1273 | SLOT( clipboardDataChanged() ) ); | 1273 | SLOT( clipboardDataChanged() ) ); |
1274 | #endif //KAB_EMBEDDED | 1274 | #endif //KAB_EMBEDDED |
1275 | 1275 | ||
1276 | // file menu | 1276 | // file menu |
1277 | if ( mIsPart ) { | 1277 | if ( mIsPart ) { |
1278 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1278 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1279 | SLOT( sendMail() ), actionCollection(), | 1279 | SLOT( sendMail() ), actionCollection(), |
1280 | "kaddressbook_mail" ); | 1280 | "kaddressbook_mail" ); |
1281 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1281 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1282 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1282 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1283 | 1283 | ||
1284 | } else { | 1284 | } else { |
1285 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1285 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1286 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1286 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1287 | } | 1287 | } |
1288 | 1288 | ||
1289 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1289 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1290 | SLOT( save() ), actionCollection(), "file_sync" ); | 1290 | SLOT( save() ), actionCollection(), "file_sync" ); |
1291 | 1291 | ||
1292 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1292 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1293 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1293 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1294 | 1294 | ||
1295 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1295 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1296 | this, SLOT( mailVCard() ), | 1296 | this, SLOT( mailVCard() ), |
1297 | actionCollection(), "file_mail_vcard"); | 1297 | actionCollection(), "file_mail_vcard"); |
1298 | 1298 | ||
1299 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1299 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1300 | this, SLOT( editContact2() ), | 1300 | this, SLOT( editContact2() ), |
1301 | actionCollection(), "file_properties" ); | 1301 | actionCollection(), "file_properties" ); |
1302 | 1302 | ||
1303 | #ifdef KAB_EMBEDDED | 1303 | #ifdef KAB_EMBEDDED |
1304 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1304 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1305 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1305 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1306 | mMainWindow, SLOT( exit() ), | 1306 | mMainWindow, SLOT( exit() ), |
1307 | actionCollection(), "quit" ); | 1307 | actionCollection(), "quit" ); |
1308 | #endif //KAB_EMBEDDED | 1308 | #endif //KAB_EMBEDDED |
1309 | 1309 | ||
1310 | // edit menu | 1310 | // edit menu |
1311 | if ( mIsPart ) { | 1311 | if ( mIsPart ) { |
1312 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1312 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1313 | SLOT( copyContacts() ), actionCollection(), | 1313 | SLOT( copyContacts() ), actionCollection(), |
1314 | "kaddressbook_copy" ); | 1314 | "kaddressbook_copy" ); |
1315 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1315 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1316 | SLOT( cutContacts() ), actionCollection(), | 1316 | SLOT( cutContacts() ), actionCollection(), |
1317 | "kaddressbook_cut" ); | 1317 | "kaddressbook_cut" ); |
1318 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1318 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1319 | SLOT( pasteContacts() ), actionCollection(), | 1319 | SLOT( pasteContacts() ), actionCollection(), |
1320 | "kaddressbook_paste" ); | 1320 | "kaddressbook_paste" ); |
1321 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1321 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1322 | SLOT( selectAllContacts() ), actionCollection(), | 1322 | SLOT( selectAllContacts() ), actionCollection(), |
1323 | "kaddressbook_select_all" ); | 1323 | "kaddressbook_select_all" ); |
1324 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1324 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1325 | SLOT( undo() ), actionCollection(), | 1325 | SLOT( undo() ), actionCollection(), |
1326 | "kaddressbook_undo" ); | 1326 | "kaddressbook_undo" ); |
1327 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1327 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1328 | this, SLOT( redo() ), actionCollection(), | 1328 | this, SLOT( redo() ), actionCollection(), |
1329 | "kaddressbook_redo" ); | 1329 | "kaddressbook_redo" ); |
1330 | } else { | 1330 | } else { |
1331 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1331 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1332 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1332 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1333 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1333 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1334 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1334 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1335 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1335 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1336 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1336 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1337 | } | 1337 | } |
1338 | 1338 | ||
1339 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1339 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1340 | Key_Delete, this, SLOT( deleteContacts() ), | 1340 | Key_Delete, this, SLOT( deleteContacts() ), |
1341 | actionCollection(), "edit_delete" ); | 1341 | actionCollection(), "edit_delete" ); |
1342 | 1342 | ||
1343 | mActionUndo->setEnabled( false ); | 1343 | mActionUndo->setEnabled( false ); |
1344 | mActionRedo->setEnabled( false ); | 1344 | mActionRedo->setEnabled( false ); |
1345 | 1345 | ||
1346 | // settings menu | 1346 | // settings menu |
1347 | #ifdef KAB_EMBEDDED | 1347 | #ifdef KAB_EMBEDDED |
1348 | //US special menuentry to configure the addressbook resources. On KDE | 1348 | //US special menuentry to configure the addressbook resources. On KDE |
1349 | // you do that through the control center !!! | 1349 | // you do that through the control center !!! |
1350 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1350 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1351 | SLOT( configureResources() ), actionCollection(), | 1351 | SLOT( configureResources() ), actionCollection(), |
1352 | "kaddressbook_configure_resources" ); | 1352 | "kaddressbook_configure_resources" ); |
1353 | #endif //KAB_EMBEDDED | 1353 | #endif //KAB_EMBEDDED |
1354 | 1354 | ||
1355 | if ( mIsPart ) { | 1355 | if ( mIsPart ) { |
1356 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1356 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1357 | SLOT( openConfigDialog() ), actionCollection(), | 1357 | SLOT( openConfigDialog() ), actionCollection(), |
1358 | "kaddressbook_configure" ); | 1358 | "kaddressbook_configure" ); |
1359 | 1359 | ||
1360 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1360 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1361 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1361 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1362 | "kaddressbook_configure_shortcuts" ); | 1362 | "kaddressbook_configure_shortcuts" ); |
1363 | #ifdef KAB_EMBEDDED | 1363 | #ifdef KAB_EMBEDDED |
1364 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1364 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1365 | mActionConfigureToolbars->setEnabled( false ); | 1365 | mActionConfigureToolbars->setEnabled( false ); |
1366 | #endif //KAB_EMBEDDED | 1366 | #endif //KAB_EMBEDDED |
1367 | 1367 | ||
1368 | } else { | 1368 | } else { |
1369 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1369 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1370 | 1370 | ||
1371 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1371 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1374 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1375 | actionCollection(), "options_show_jump_bar" ); | 1375 | actionCollection(), "options_show_jump_bar" ); |
1376 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1376 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1377 | 1377 | ||
1378 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, | 1378 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, |
1379 | actionCollection(), "options_show_details" ); | 1379 | actionCollection(), "options_show_details" ); |
1380 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1380 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1381 | 1381 | ||
1382 | // misc | 1382 | // misc |
1383 | // only enable LDAP lookup if we can handle the protocol | 1383 | // only enable LDAP lookup if we can handle the protocol |
1384 | #ifndef KAB_EMBEDDED | 1384 | #ifndef KAB_EMBEDDED |
1385 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1385 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1386 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1386 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1387 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1387 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1388 | "ldap_lookup" ); | 1388 | "ldap_lookup" ); |
1389 | } | 1389 | } |
1390 | #else //KAB_EMBEDDED | 1390 | #else //KAB_EMBEDDED |
1391 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1391 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1392 | #endif //KAB_EMBEDDED | 1392 | #endif //KAB_EMBEDDED |
1393 | 1393 | ||
1394 | 1394 | ||
1395 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1395 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1396 | SLOT( setWhoAmI() ), actionCollection(), | 1396 | SLOT( setWhoAmI() ), actionCollection(), |
1397 | "set_personal" ); | 1397 | "set_personal" ); |
1398 | 1398 | ||
1399 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1399 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1400 | SLOT( setCategories() ), actionCollection(), | 1400 | SLOT( setCategories() ), actionCollection(), |
1401 | "edit_set_categories" ); | 1401 | "edit_set_categories" ); |
1402 | 1402 | ||
1403 | #ifdef KAB_EMBEDDED | 1403 | #ifdef KAB_EMBEDDED |
1404 | 1404 | ||
1405 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1405 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1406 | this, SLOT( createAboutData() ), actionCollection(), | 1406 | this, SLOT( createAboutData() ), actionCollection(), |
1407 | "kaddressbook_about_data" ); | 1407 | "kaddressbook_about_data" ); |
1408 | #endif //KAB_EMBEDDED | 1408 | #endif //KAB_EMBEDDED |
1409 | 1409 | ||
1410 | clipboardDataChanged(); | 1410 | clipboardDataChanged(); |
1411 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1411 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1412 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1412 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1413 | } | 1413 | } |
1414 | 1414 | ||
1415 | //US we need this function, to plug all actions into the correct menues. | 1415 | //US we need this function, to plug all actions into the correct menues. |
1416 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1416 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1417 | void KABCore::addActionsManually() | 1417 | void KABCore::addActionsManually() |
1418 | { | 1418 | { |
1419 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1419 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1420 | 1420 | ||
1421 | #ifdef KAB_EMBEDDED | 1421 | #ifdef KAB_EMBEDDED |
1422 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1422 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1423 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1423 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1424 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1424 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1425 | 1425 | ||
1426 | KToolBar* tb = mMainWindow->toolBar(); | 1426 | KToolBar* tb = mMainWindow->toolBar(); |
1427 | 1427 | ||
1428 | #ifdef DESKTOP_VERSION | 1428 | #ifdef DESKTOP_VERSION |
1429 | QMenuBar* mb = mMainWindow->menuBar(); | 1429 | QMenuBar* mb = mMainWindow->menuBar(); |
1430 | 1430 | ||
1431 | //US setup menubar. | 1431 | //US setup menubar. |
1432 | //Disable the following block if you do not want to have a menubar. | 1432 | //Disable the following block if you do not want to have a menubar. |
1433 | mb->insertItem( "&File", fileMenu ); | 1433 | mb->insertItem( "&File", fileMenu ); |
1434 | mb->insertItem( "&Edit", editMenu ); | 1434 | mb->insertItem( "&Edit", editMenu ); |
1435 | mb->insertItem( "&View", viewMenu ); | 1435 | mb->insertItem( "&View", viewMenu ); |
1436 | mb->insertItem( "&Settings", settingsMenu ); | 1436 | mb->insertItem( "&Settings", settingsMenu ); |
1437 | mb->insertItem( "&Help", helpMenu ); | 1437 | mb->insertItem( "&Help", helpMenu ); |
1438 | mIncSearchWidget = new IncSearchWidget( tb ); | 1438 | mIncSearchWidget = new IncSearchWidget( tb ); |
1439 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1439 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1440 | 1440 | ||
1441 | #else | 1441 | #else |
1442 | //US setup toolbar | 1442 | //US setup toolbar |
1443 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1443 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1444 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1444 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1445 | menuBarTB->insertItem( "ME", popupBarTB); | 1445 | menuBarTB->insertItem( "ME", popupBarTB); |
1446 | tb->insertWidget(-1, 0, menuBarTB); | 1446 | tb->insertWidget(-1, 0, menuBarTB); |
1447 | mIncSearchWidget = new IncSearchWidget( tb ); | 1447 | mIncSearchWidget = new IncSearchWidget( tb ); |
1448 | 1448 | ||
1449 | tb->enableMoving(false); | 1449 | tb->enableMoving(false); |
1450 | popupBarTB->insertItem( "&File", fileMenu ); | 1450 | popupBarTB->insertItem( "&File", fileMenu ); |
1451 | popupBarTB->insertItem( "&Edit", editMenu ); | 1451 | popupBarTB->insertItem( "&Edit", editMenu ); |
1452 | popupBarTB->insertItem( "&View", viewMenu ); | 1452 | popupBarTB->insertItem( "&View", viewMenu ); |
1453 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1453 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1454 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1454 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1455 | popupBarTB->insertItem( "&Help", helpMenu ); | 1455 | popupBarTB->insertItem( "&Help", helpMenu ); |
1456 | if (QApplication::desktop()->width() > 320 ) { | 1456 | if (QApplication::desktop()->width() > 320 ) { |
1457 | // mViewManager->getFilterAction()->plug ( tb); | 1457 | // mViewManager->getFilterAction()->plug ( tb); |
1458 | } | 1458 | } |
1459 | #endif | 1459 | #endif |
1460 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1460 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1461 | 1461 | ||
1462 | 1462 | ||
1463 | 1463 | ||
1464 | //US Now connect the actions with the menue entries. | 1464 | //US Now connect the actions with the menue entries. |
1465 | mActionPrint->plug( fileMenu ); | 1465 | mActionPrint->plug( fileMenu ); |
1466 | mActionMail->plug( fileMenu ); | 1466 | mActionMail->plug( fileMenu ); |
1467 | fileMenu->insertSeparator(); | 1467 | fileMenu->insertSeparator(); |
1468 | 1468 | ||
1469 | mActionNewContact->plug( fileMenu ); | 1469 | mActionNewContact->plug( fileMenu ); |
1470 | mActionNewContact->plug( tb ); | 1470 | mActionNewContact->plug( tb ); |
1471 | 1471 | ||
1472 | mActionEditAddressee->plug( fileMenu ); | 1472 | mActionEditAddressee->plug( fileMenu ); |
1473 | fileMenu->insertSeparator(); | 1473 | fileMenu->insertSeparator(); |
1474 | mActionSave->plug( fileMenu ); | 1474 | mActionSave->plug( fileMenu ); |
1475 | fileMenu->insertItem( "&Import", ImportMenu ); | 1475 | fileMenu->insertItem( "&Import", ImportMenu ); |
1476 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1476 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1477 | fileMenu->insertSeparator(); | 1477 | fileMenu->insertSeparator(); |
1478 | mActionMailVCard->plug( fileMenu ); | 1478 | mActionMailVCard->plug( fileMenu ); |
1479 | fileMenu->insertSeparator(); | 1479 | fileMenu->insertSeparator(); |
1480 | mActionQuit->plug( fileMenu ); | 1480 | mActionQuit->plug( fileMenu ); |
1481 | 1481 | ||
1482 | 1482 | ||
1483 | // edit menu | 1483 | // edit menu |
1484 | mActionUndo->plug( editMenu ); | 1484 | mActionUndo->plug( editMenu ); |
1485 | mActionRedo->plug( editMenu ); | 1485 | mActionRedo->plug( editMenu ); |
1486 | editMenu->insertSeparator(); | 1486 | editMenu->insertSeparator(); |
1487 | mActionCut->plug( editMenu ); | 1487 | mActionCut->plug( editMenu ); |
1488 | mActionCopy->plug( editMenu ); | 1488 | mActionCopy->plug( editMenu ); |
1489 | mActionPaste->plug( editMenu ); | 1489 | mActionPaste->plug( editMenu ); |
1490 | mActionDelete->plug( editMenu ); | 1490 | mActionDelete->plug( editMenu ); |
1491 | editMenu->insertSeparator(); | 1491 | editMenu->insertSeparator(); |
1492 | mActionSelectAll->plug( editMenu ); | 1492 | mActionSelectAll->plug( editMenu ); |
1493 | 1493 | ||
1494 | 1494 | ||
1495 | // settings menu | 1495 | // settings menu |
1496 | //US special menuentry to configure the addressbook resources. On KDE | 1496 | //US special menuentry to configure the addressbook resources. On KDE |
1497 | // you do that through the control center !!! | 1497 | // you do that through the control center !!! |
1498 | mActionConfigResources->plug( settingsMenu ); | 1498 | mActionConfigResources->plug( settingsMenu ); |
1499 | settingsMenu->insertSeparator(); | 1499 | settingsMenu->insertSeparator(); |
1500 | 1500 | ||
1501 | mActionConfigKAddressbook->plug( settingsMenu ); | 1501 | mActionConfigKAddressbook->plug( settingsMenu ); |
1502 | 1502 | ||
1503 | if ( mIsPart ) { | 1503 | if ( mIsPart ) { |
1504 | mActionConfigShortcuts->plug( settingsMenu ); | 1504 | mActionConfigShortcuts->plug( settingsMenu ); |
1505 | mActionConfigureToolbars->plug( settingsMenu ); | 1505 | mActionConfigureToolbars->plug( settingsMenu ); |
1506 | 1506 | ||
1507 | } else { | 1507 | } else { |
1508 | mActionKeyBindings->plug( settingsMenu ); | 1508 | mActionKeyBindings->plug( settingsMenu ); |
1509 | } | 1509 | } |
1510 | 1510 | ||
1511 | settingsMenu->insertSeparator(); | 1511 | settingsMenu->insertSeparator(); |
1512 | 1512 | ||
1513 | mActionJumpBar->plug( settingsMenu ); | 1513 | mActionJumpBar->plug( settingsMenu ); |
1514 | mActionDetails->plug( settingsMenu ); | 1514 | mActionDetails->plug( settingsMenu ); |
1515 | settingsMenu->insertSeparator(); | 1515 | settingsMenu->insertSeparator(); |
1516 | 1516 | ||
1517 | mActionWhoAmI->plug( settingsMenu ); | 1517 | mActionWhoAmI->plug( settingsMenu ); |
1518 | mActionCategories->plug( settingsMenu ); | 1518 | mActionCategories->plug( settingsMenu ); |
1519 | 1519 | ||
1520 | mActionAboutKAddressbook->plug( helpMenu ); | 1520 | mActionAboutKAddressbook->plug( helpMenu ); |
1521 | 1521 | ||
1522 | 1522 | ||
1523 | if (QApplication::desktop()->width() > 320 ) { | 1523 | if (QApplication::desktop()->width() > 320 ) { |
1524 | 1524 | ||
1525 | mActionEditAddressee->plug( tb ); | 1525 | mActionEditAddressee->plug( tb ); |
1526 | mActionSave->plug( tb ); | 1526 | mActionSave->plug( tb ); |
1527 | mViewManager->getFilterAction()->plug ( tb); | 1527 | mViewManager->getFilterAction()->plug ( tb); |
1528 | if (QApplication::desktop()->width() > 480 ) { | 1528 | if (QApplication::desktop()->width() > 480 ) { |
1529 | mActionUndo->plug( tb ); | 1529 | mActionUndo->plug( tb ); |
1530 | mActionDelete->plug( tb ); | 1530 | mActionDelete->plug( tb ); |
1531 | mActionRedo->plug( tb ); | 1531 | mActionRedo->plug( tb ); |
1532 | } | 1532 | } |
1533 | } | 1533 | } |
1534 | //mActionQuit->plug ( tb ); | 1534 | //mActionQuit->plug ( tb ); |
1535 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1535 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1536 | 1536 | ||
1537 | //US link the searchwidget first to this. | 1537 | //US link the searchwidget first to this. |
1538 | // The real linkage to the toolbar happens later. | 1538 | // The real linkage to the toolbar happens later. |
1539 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1539 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1540 | //US tb->insertItem( mIncSearchWidget ); | 1540 | //US tb->insertItem( mIncSearchWidget ); |
1541 | /*US | 1541 | /*US |
1542 | mIncSearchWidget = new IncSearchWidget( tb ); | 1542 | mIncSearchWidget = new IncSearchWidget( tb ); |
1543 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1543 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1544 | SLOT( incrementalSearch( const QString& ) ) ); | 1544 | SLOT( incrementalSearch( const QString& ) ) ); |
1545 | 1545 | ||
1546 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1546 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1547 | 1547 | ||
1548 | //US topLayout->addWidget( mJumpButtonBar ); | 1548 | //US topLayout->addWidget( mJumpButtonBar ); |
1549 | this->layout()->add( mJumpButtonBar ); | 1549 | this->layout()->add( mJumpButtonBar ); |
1550 | */ | 1550 | */ |
1551 | 1551 | ||
1552 | #endif //KAB_EMBEDDED | 1552 | #endif //KAB_EMBEDDED |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | 1555 | ||
1556 | 1556 | ||
1557 | void KABCore::clipboardDataChanged() | 1557 | void KABCore::clipboardDataChanged() |
1558 | { | 1558 | { |
1559 | 1559 | ||
1560 | if ( mReadWrite ) | 1560 | if ( mReadWrite ) |
1561 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1561 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1562 | 1562 | ||
1563 | } | 1563 | } |
1564 | 1564 | ||
1565 | void KABCore::updateActionMenu() | 1565 | void KABCore::updateActionMenu() |
1566 | { | 1566 | { |
1567 | UndoStack *undo = UndoStack::instance(); | 1567 | UndoStack *undo = UndoStack::instance(); |
1568 | RedoStack *redo = RedoStack::instance(); | 1568 | RedoStack *redo = RedoStack::instance(); |
1569 | 1569 | ||
1570 | if ( undo->isEmpty() ) | 1570 | if ( undo->isEmpty() ) |
1571 | mActionUndo->setText( i18n( "Undo" ) ); | 1571 | mActionUndo->setText( i18n( "Undo" ) ); |
1572 | else | 1572 | else |
1573 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1573 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1574 | 1574 | ||
1575 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1575 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1576 | 1576 | ||
1577 | if ( !redo->top() ) | 1577 | if ( !redo->top() ) |
1578 | mActionRedo->setText( i18n( "Redo" ) ); | 1578 | mActionRedo->setText( i18n( "Redo" ) ); |
1579 | else | 1579 | else |
1580 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1580 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1581 | 1581 | ||
1582 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1582 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1583 | } | 1583 | } |
1584 | 1584 | ||
1585 | void KABCore::configureKeyBindings() | 1585 | void KABCore::configureKeyBindings() |
1586 | { | 1586 | { |
1587 | #ifndef KAB_EMBEDDED | 1587 | #ifndef KAB_EMBEDDED |
1588 | KKeyDialog::configure( actionCollection(), true ); | 1588 | KKeyDialog::configure( actionCollection(), true ); |
1589 | #else //KAB_EMBEDDED | 1589 | #else //KAB_EMBEDDED |
1590 | qDebug("KABCore::configureKeyBindings() not implemented"); | 1590 | qDebug("KABCore::configureKeyBindings() not implemented"); |
1591 | #endif //KAB_EMBEDDED | 1591 | #endif //KAB_EMBEDDED |
1592 | } | 1592 | } |
1593 | 1593 | ||
1594 | #ifdef KAB_EMBEDDED | 1594 | #ifdef KAB_EMBEDDED |
1595 | void KABCore::configureResources() | 1595 | void KABCore::configureResources() |
1596 | { | 1596 | { |
1597 | KRES::KCMKResources dlg( this, "" , 0 ); | 1597 | KRES::KCMKResources dlg( this, "" , 0 ); |
1598 | 1598 | ||
1599 | if ( !dlg.exec() ) | 1599 | if ( !dlg.exec() ) |
1600 | return; | 1600 | return; |
1601 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 1601 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
1602 | } | 1602 | } |
1603 | #endif //KAB_EMBEDDED | 1603 | #endif //KAB_EMBEDDED |
1604 | 1604 | ||
1605 | 1605 | ||
1606 | 1606 | ||
1607 | #ifndef KAB_EMBEDDED | 1607 | #ifndef KAB_EMBEDDED |
1608 | #include "kabcore.moc" | 1608 | #include "kabcore.moc" |
1609 | #endif //KAB_EMBEDDED | 1609 | #endif //KAB_EMBEDDED |