-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 | |||
@@ -528,68 +528,102 @@ void KABCore::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 |