author | zautrix <zautrix> | 2005-04-22 17:32:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-22 17:32:45 (UTC) |
commit | e6feb1ca0c45397ba7b922198c87fe9b95b7d872 (patch) (unidiff) | |
tree | 61b56d5a17f3eba87fef958d264e2da679496bda /kaddressbook | |
parent | 81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261 (diff) | |
download | kdepimpi-e6feb1ca0c45397ba7b922198c87fe9b95b7d872.zip kdepimpi-e6feb1ca0c45397ba7b922198c87fe9b95b7d872.tar.gz kdepimpi-e6feb1ca0c45397ba7b922198c87fe9b95b7d872.tar.bz2 |
fixxxx
-rw-r--r-- | kaddressbook/kabcore.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 9c40142..a4f3579 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -456,212 +456,246 @@ void KABCore::toggleBeamReceive( ) | |||
456 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 456 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
457 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 457 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
458 | #endif | 458 | #endif |
459 | } | 459 | } |
460 | 460 | ||
461 | 461 | ||
462 | void KABCore::disableBR(bool b) | 462 | void KABCore::disableBR(bool b) |
463 | { | 463 | { |
464 | #ifndef DESKTOP_VERSION | 464 | #ifndef DESKTOP_VERSION |
465 | if ( b ) { | 465 | if ( b ) { |
466 | if ( infrared ) { | 466 | if ( infrared ) { |
467 | toggleBeamReceive( ); | 467 | toggleBeamReceive( ); |
468 | } | 468 | } |
469 | mBRdisabled = true; | 469 | mBRdisabled = true; |
470 | } else { | 470 | } else { |
471 | if ( mBRdisabled ) { | 471 | if ( mBRdisabled ) { |
472 | mBRdisabled = false; | 472 | mBRdisabled = false; |
473 | //toggleBeamReceive( ); | 473 | //toggleBeamReceive( ); |
474 | } | 474 | } |
475 | } | 475 | } |
476 | #endif | 476 | #endif |
477 | 477 | ||
478 | } | 478 | } |
479 | void KABCore::recieve( QString fn ) | 479 | void KABCore::recieve( QString fn ) |
480 | { | 480 | { |
481 | //qDebug("KABCore::recieve "); | 481 | //qDebug("KABCore::recieve "); |
482 | int count = mAddressBook->importFromFile( fn, true ); | 482 | int count = mAddressBook->importFromFile( fn, true ); |
483 | if ( count ) | 483 | if ( count ) |
484 | setModified( true ); | 484 | setModified( true ); |
485 | mViewManager->refreshView(); | 485 | mViewManager->refreshView(); |
486 | message(i18n("%1 contact(s) received!").arg( count )); | 486 | message(i18n("%1 contact(s) received!").arg( count )); |
487 | topLevelWidget()->showMaximized(); | 487 | topLevelWidget()->showMaximized(); |
488 | topLevelWidget()->raise(); | 488 | topLevelWidget()->raise(); |
489 | } | 489 | } |
490 | void KABCore::restoreSettings() | 490 | void KABCore::restoreSettings() |
491 | { | 491 | { |
492 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 492 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
493 | 493 | ||
494 | bool state; | 494 | bool state; |
495 | 495 | ||
496 | if (mMultipleViewsAtOnce) | 496 | if (mMultipleViewsAtOnce) |
497 | state = KABPrefs::instance()->mDetailsPageVisible; | 497 | state = KABPrefs::instance()->mDetailsPageVisible; |
498 | else | 498 | else |
499 | state = false; | 499 | state = false; |
500 | 500 | ||
501 | mActionDetails->setChecked( state ); | 501 | mActionDetails->setChecked( state ); |
502 | setDetailsVisible( state ); | 502 | setDetailsVisible( state ); |
503 | 503 | ||
504 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 504 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
505 | 505 | ||
506 | mActionJumpBar->setChecked( state ); | 506 | mActionJumpBar->setChecked( state ); |
507 | setJumpButtonBarVisible( state ); | 507 | setJumpButtonBarVisible( state ); |
508 | /*US | 508 | /*US |
509 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 509 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
510 | if ( splitterSize.count() == 0 ) { | 510 | if ( splitterSize.count() == 0 ) { |
511 | splitterSize.append( width() / 2 ); | 511 | splitterSize.append( width() / 2 ); |
512 | splitterSize.append( width() / 2 ); | 512 | splitterSize.append( width() / 2 ); |
513 | } | 513 | } |
514 | mMiniSplitter->setSizes( splitterSize ); | 514 | mMiniSplitter->setSizes( splitterSize ); |
515 | if ( mExtensionBarSplitter ) { | 515 | if ( mExtensionBarSplitter ) { |
516 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 516 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
517 | if ( splitterSize.count() == 0 ) { | 517 | if ( splitterSize.count() == 0 ) { |
518 | splitterSize.append( width() / 2 ); | 518 | splitterSize.append( width() / 2 ); |
519 | splitterSize.append( width() / 2 ); | 519 | splitterSize.append( width() / 2 ); |
520 | } | 520 | } |
521 | mExtensionBarSplitter->setSizes( splitterSize ); | 521 | mExtensionBarSplitter->setSizes( splitterSize ); |
522 | 522 | ||
523 | } | 523 | } |
524 | */ | 524 | */ |
525 | mViewManager->restoreSettings(); | 525 | mViewManager->restoreSettings(); |
526 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 526 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
527 | mExtensionManager->restoreSettings(); | 527 | mExtensionManager->restoreSettings(); |
528 | #ifdef DESKTOP_VERSION | 528 | #ifdef DESKTOP_VERSION |
529 | int wid = width(); | 529 | int wid = width(); |
530 | if ( wid < 10 ) | 530 | if ( wid < 10 ) |
531 | wid = 400; | 531 | wid = 400; |
532 | #else | 532 | #else |
533 | int wid = QApplication::desktop()->width(); | 533 | int wid = QApplication::desktop()->width(); |
534 | if ( wid < 640 ) | 534 | if ( wid < 640 ) |
535 | wid = QApplication::desktop()->height(); | 535 | wid = QApplication::desktop()->height(); |
536 | #endif | 536 | #endif |
537 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 537 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
538 | if ( true /*splitterSize.count() == 0*/ ) { | 538 | if ( true /*splitterSize.count() == 0*/ ) { |
539 | splitterSize.append( wid / 2 ); | 539 | splitterSize.append( wid / 2 ); |
540 | splitterSize.append( wid / 2 ); | 540 | splitterSize.append( wid / 2 ); |
541 | } | 541 | } |
542 | mMiniSplitter->setSizes( splitterSize ); | 542 | mMiniSplitter->setSizes( splitterSize ); |
543 | if ( mExtensionBarSplitter ) { | 543 | if ( mExtensionBarSplitter ) { |
544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
545 | if ( true /*splitterSize.count() == 0*/ ) { | 545 | if ( true /*splitterSize.count() == 0*/ ) { |
546 | splitterSize.append( wid / 2 ); | 546 | splitterSize.append( wid / 2 ); |
547 | splitterSize.append( wid / 2 ); | 547 | splitterSize.append( wid / 2 ); |
548 | } | 548 | } |
549 | mExtensionBarSplitter->setSizes( splitterSize ); | 549 | mExtensionBarSplitter->setSizes( splitterSize ); |
550 | 550 | ||
551 | } | 551 | } |
552 | 552 | #ifdef DESKTOP_VERSION | |
553 | 553 | KConfig *config = KABPrefs::instance()->getConfig(); | |
554 | config->setGroup("WidgetLayout"); | ||
555 | QStringList list; | ||
556 | list = config->readListEntry("MainLayout"); | ||
557 | int x,y,w,h; | ||
558 | if ( ! list.isEmpty() ) { | ||
559 | x = list[0].toInt(); | ||
560 | y = list[1].toInt(); | ||
561 | w = list[2].toInt(); | ||
562 | h = list[3].toInt(); | ||
563 | KApplication::testCoords( &x,&y,&w,&h ); | ||
564 | topLevelWidget()->setGeometry(x,y,w,h); | ||
565 | |||
566 | } else { | ||
567 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | ||
568 | } | ||
569 | #endif | ||
554 | } | 570 | } |
555 | 571 | ||
556 | void KABCore::saveSettings() | 572 | void KABCore::saveSettings() |
557 | { | 573 | { |
558 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 574 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
559 | if ( mExtensionBarSplitter ) | 575 | if ( mExtensionBarSplitter ) |
560 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 576 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
561 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 577 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
562 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 578 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
563 | #ifndef KAB_EMBEDDED | 579 | #ifndef KAB_EMBEDDED |
564 | 580 | ||
565 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 581 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
566 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 582 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
567 | #endif //KAB_EMBEDDED | 583 | #endif //KAB_EMBEDDED |
568 | mExtensionManager->saveSettings(); | 584 | mExtensionManager->saveSettings(); |
569 | mViewManager->saveSettings(); | 585 | mViewManager->saveSettings(); |
570 | 586 | ||
571 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 587 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
588 | #ifdef DESKTOP_VERSION | ||
589 | KConfig *config = KABPrefs::instance()->getConfig(); | ||
590 | config->setGroup("WidgetLayout"); | ||
591 | QStringList list ;//= config->readListEntry("MainLayout"); | ||
592 | int x,y,w,h; | ||
593 | QWidget* wid; | ||
594 | wid = topLevelWidget(); | ||
595 | x = wid->geometry().x(); | ||
596 | y = wid->geometry().y(); | ||
597 | w = wid->width(); | ||
598 | h = wid->height(); | ||
599 | list.clear(); | ||
600 | list << QString::number( x ); | ||
601 | list << QString::number( y ); | ||
602 | list << QString::number( w ); | ||
603 | list << QString::number( h ); | ||
604 | config->writeEntry("MainLayout",list ); | ||
605 | #endif | ||
572 | KABPrefs::instance()->writeConfig(); | 606 | KABPrefs::instance()->writeConfig(); |
573 | qDebug("KA: KABCore::saveSettings() "); | 607 | qDebug("KA: KABCore::saveSettings() "); |
574 | } | 608 | } |
575 | 609 | ||
576 | KABC::AddressBook *KABCore::addressBook() const | 610 | KABC::AddressBook *KABCore::addressBook() const |
577 | { | 611 | { |
578 | return mAddressBook; | 612 | return mAddressBook; |
579 | } | 613 | } |
580 | 614 | ||
581 | KConfig *KABCore::config() | 615 | KConfig *KABCore::config() |
582 | { | 616 | { |
583 | #ifndef KAB_EMBEDDED | 617 | #ifndef KAB_EMBEDDED |
584 | return KABPrefs::instance()->config(); | 618 | return KABPrefs::instance()->config(); |
585 | #else //KAB_EMBEDDED | 619 | #else //KAB_EMBEDDED |
586 | return KABPrefs::instance()->getConfig(); | 620 | return KABPrefs::instance()->getConfig(); |
587 | #endif //KAB_EMBEDDED | 621 | #endif //KAB_EMBEDDED |
588 | } | 622 | } |
589 | 623 | ||
590 | KActionCollection *KABCore::actionCollection() const | 624 | KActionCollection *KABCore::actionCollection() const |
591 | { | 625 | { |
592 | return mGUIClient->actionCollection(); | 626 | return mGUIClient->actionCollection(); |
593 | } | 627 | } |
594 | 628 | ||
595 | KABC::Field *KABCore::currentSearchField() const | 629 | KABC::Field *KABCore::currentSearchField() const |
596 | { | 630 | { |
597 | if (mIncSearchWidget) | 631 | if (mIncSearchWidget) |
598 | return mIncSearchWidget->currentField(); | 632 | return mIncSearchWidget->currentField(); |
599 | else | 633 | else |
600 | return 0; | 634 | return 0; |
601 | } | 635 | } |
602 | 636 | ||
603 | QStringList KABCore::selectedUIDs() const | 637 | QStringList KABCore::selectedUIDs() const |
604 | { | 638 | { |
605 | return mViewManager->selectedUids(); | 639 | return mViewManager->selectedUids(); |
606 | } | 640 | } |
607 | 641 | ||
608 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 642 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
609 | { | 643 | { |
610 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 644 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
611 | 645 | ||
612 | QPtrList<KRES::Resource> kresResources; | 646 | QPtrList<KRES::Resource> kresResources; |
613 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 647 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
614 | KABC::Resource *resource; | 648 | KABC::Resource *resource; |
615 | while ( ( resource = resIt.current() ) != 0 ) { | 649 | while ( ( resource = resIt.current() ) != 0 ) { |
616 | ++resIt; | 650 | ++resIt; |
617 | if ( !resource->readOnly() ) { | 651 | if ( !resource->readOnly() ) { |
618 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 652 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
619 | if ( res ) | 653 | if ( res ) |
620 | kresResources.append( res ); | 654 | kresResources.append( res ); |
621 | } | 655 | } |
622 | } | 656 | } |
623 | 657 | ||
624 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 658 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
625 | return static_cast<KABC::Resource*>( res ); | 659 | return static_cast<KABC::Resource*>( res ); |
626 | } | 660 | } |
627 | 661 | ||
628 | #ifndef KAB_EMBEDDED | 662 | #ifndef KAB_EMBEDDED |
629 | KAboutData *KABCore::createAboutData() | 663 | KAboutData *KABCore::createAboutData() |
630 | #else //KAB_EMBEDDED | 664 | #else //KAB_EMBEDDED |
631 | void KABCore::createAboutData() | 665 | void KABCore::createAboutData() |
632 | #endif //KAB_EMBEDDED | 666 | #endif //KAB_EMBEDDED |
633 | { | 667 | { |
634 | 668 | ||
635 | 669 | ||
636 | QString version; | 670 | QString version; |
637 | #include <../version> | 671 | #include <../version> |
638 | QMessageBox::about( this, "About KAddressbook/Pi", | 672 | QMessageBox::about( this, "About KAddressbook/Pi", |
639 | "KAddressbook/Platform-independent\n" | 673 | "KAddressbook/Platform-independent\n" |
640 | "(KA/Pi) " +version + " - " + | 674 | "(KA/Pi) " +version + " - " + |
641 | #ifdef DESKTOP_VERSION | 675 | #ifdef DESKTOP_VERSION |
642 | "Desktop Edition\n" | 676 | "Desktop Edition\n" |
643 | #else | 677 | #else |
644 | "PDA-Edition\n" | 678 | "PDA-Edition\n" |
645 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 679 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
646 | #endif | 680 | #endif |
647 | 681 | ||
648 | "(c) 2004 Ulf Schenk\n" | 682 | "(c) 2004 Ulf Schenk\n" |
649 | "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" | 683 | "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" |
650 | "(c) 1997-2003, The KDE PIM Team\n" | 684 | "(c) 1997-2003, The KDE PIM Team\n" |
651 | "Tobias Koenig Maintainer\n" | 685 | "Tobias Koenig Maintainer\n" |
652 | "Don Sanders Original author\n" | 686 | "Don Sanders Original author\n" |
653 | "Cornelius Schumacher Co-maintainer\n" | 687 | "Cornelius Schumacher Co-maintainer\n" |
654 | "Mike Pilone GUI and framework redesign\n" | 688 | "Mike Pilone GUI and framework redesign\n" |
655 | "Greg Stern DCOP interface\n" | 689 | "Greg Stern DCOP interface\n" |
656 | "Mark Westcot Contact pinning\n" | 690 | "Mark Westcot Contact pinning\n" |
657 | "Michel Boyer de la Giroday LDAP Lookup\n" | 691 | "Michel Boyer de la Giroday LDAP Lookup\n" |
658 | "Steffen Hansen LDAP Lookup" | 692 | "Steffen Hansen LDAP Lookup" |
659 | #ifdef _WIN32_ | 693 | #ifdef _WIN32_ |
660 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 694 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
661 | #endif | 695 | #endif |
662 | ); | 696 | ); |
663 | } | 697 | } |
664 | 698 | ||
665 | void KABCore::setContactSelected( const QString &uid ) | 699 | void KABCore::setContactSelected( const QString &uid ) |
666 | { | 700 | { |
667 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 701 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |