summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2004-09-22 03:08:05 (UTC)
committer zautrix <zautrix>2004-09-22 03:08:05 (UTC)
commitd63eac7a612a9724705bc58ad98c65c6ac052d07 (patch) (unidiff)
treedc584a0ddcbd5f828ea36b86b6af640e46e137f2 /libkdepim
parent633522024e48efc423155a04b71083a03696211d (diff)
downloadkdepimpi-d63eac7a612a9724705bc58ad98c65c6ac052d07.zip
kdepimpi-d63eac7a612a9724705bc58ad98c65c6ac052d07.tar.gz
kdepimpi-d63eac7a612a9724705bc58ad98c65c6ac052d07.tar.bz2
connected global config
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp2
-rw-r--r--libkdepim/kpimglobalprefs.cpp17
-rw-r--r--libkdepim/kpimglobalprefs.h4
3 files changed, 19 insertions, 4 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 00a07d9..2819ab1 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -555,217 +555,217 @@ void KDEPIMConfigWidget::updateClientWidgets()
555 555
556 } 556 }
557 557
558 bool readonly; 558 bool readonly;
559 bool enabled; 559 bool enabled;
560 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 560 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
561 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 561 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
562 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 562 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
563 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 563 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
564 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 564 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
565 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) 565 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)))
566 { 566 {
567 readonly = false; 567 readonly = false;
568 } 568 }
569 else 569 else
570 { 570 {
571 readonly = true; 571 readonly = true;
572 } 572 }
573 573
574 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) 574 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
575 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) 575 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
576 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) 576 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
577 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) 577 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
578 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) 578 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))
579 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) 579 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC)))
580 { 580 {
581 enabled = false; 581 enabled = false;
582 } 582 }
583 else 583 else
584 { 584 {
585 enabled = true; 585 enabled = true;
586 } 586 }
587 587
588 588
589 mChannel->setReadOnly(readonly); 589 mChannel->setReadOnly(readonly);
590 mMessage->setReadOnly(readonly); 590 mMessage->setReadOnly(readonly);
591 mParameters->setReadOnly(readonly); 591 mParameters->setReadOnly(readonly);
592 mMessage2->setReadOnly(readonly); 592 mMessage2->setReadOnly(readonly);
593 mParameters2->setReadOnly(readonly); 593 mParameters2->setReadOnly(readonly);
594 594
595 mChannel->setEnabled(enabled); 595 mChannel->setEnabled(enabled);
596 mMessage->setEnabled(enabled); 596 mMessage->setEnabled(enabled);
597 mParameters->setEnabled(enabled); 597 mParameters->setEnabled(enabled);
598 mMessage2->setEnabled(enabled); 598 mMessage2->setEnabled(enabled);
599 mParameters2->setEnabled(enabled); 599 mParameters2->setEnabled(enabled);
600 600
601 601
602 602
603 mClient->setCurrentItem(mCurrentClient); 603 mClient->setCurrentItem(mCurrentClient);
604 604
605 605
606 // enable/disable the extra message/parameter field 606 // enable/disable the extra message/parameter field
607 if (mCurrentApp == ExternalAppHandler::EMAIL) 607 if (mCurrentApp == ExternalAppHandler::EMAIL)
608 { 608 {
609 } 609 }
610 else 610 else
611 { 611 {
612 mMessage2->setText( "" ); 612 mMessage2->setText( "" );
613 mParameters2->setText( "" ); 613 mParameters2->setText( "" );
614 } 614 }
615 615
616 if (enabled == true) { 616 if (enabled == true) {
617 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 617 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
618 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 618 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
619 } 619 }
620 620
621 621
622 blockSignals( blocked ); 622 blockSignals( blocked );
623 623
624} 624}
625 625
626void KDEPIMConfigWidget::usrReadConfig() 626void KDEPIMConfigWidget::usrReadConfig()
627{ 627{
628 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 628 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
629 629
630 bool blocked = signalsBlocked(); 630 bool blocked = signalsBlocked();
631 blockSignals( true ); 631 blockSignals( true );
632 632
633 QString dummy = prefs->mUserDateFormatLong; 633 QString dummy = prefs->mUserDateFormatLong;
634 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 634 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
635 dummy = prefs->mUserDateFormatShort; 635 dummy = prefs->mUserDateFormatShort;
636 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 636 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
637 637
638 QDate current ( 2001, 1,1); 638 QDate current ( 2001, 1,1);
639 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); 639 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
640 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); 640 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
641 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); 641 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
642 642
643 643
644 644
645 645
646 mEmailClient = prefs->mEmailClient; 646 mEmailClient = prefs->mEmailClient;
647 mEmailOtherChannel = prefs->mEmailOtherChannel; 647 mEmailOtherChannel = prefs->mEmailOtherChannel;
648 mEmailOtherMessage = prefs->mEmailOtherMessage; 648 mEmailOtherMessage = prefs->mEmailOtherMessage;
649 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; 649 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
650 mEmailOtherMessage2 = prefs->mEmailOtherMessage2; 650 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
651 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; 651 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
652 652
653 mPhoneClient = prefs->mPhoneClient; 653 mPhoneClient = prefs->mPhoneClient;
654 mPhoneOtherChannel = prefs->mPhoneOtherChannel; 654 mPhoneOtherChannel = prefs->mPhoneOtherChannel;
655 mPhoneOtherMessage = prefs->mPhoneOtherMessage; 655 mPhoneOtherMessage = prefs->mPhoneOtherMessage;
656 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; 656 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
657 657
658 mFaxClient = prefs->mFaxClient; 658 mFaxClient = prefs->mFaxClient;
659 mFaxOtherChannel = prefs->mFaxOtherChannel; 659 mFaxOtherChannel = prefs->mFaxOtherChannel;
660 mFaxOtherMessage = prefs->mFaxOtherMessage; 660 mFaxOtherMessage = prefs->mFaxOtherMessage;
661 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; 661 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
662 662
663 mSMSClient = prefs->mSMSClient; 663 mSMSClient = prefs->mSMSClient;
664 mSMSOtherChannel = prefs->mSMSOtherChannel; 664 mSMSOtherChannel = prefs->mSMSOtherChannel;
665 mSMSOtherMessage = prefs->mSMSOtherMessage; 665 mSMSOtherMessage = prefs->mSMSOtherMessage;
666 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; 666 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
667 667
668 mPagerClient = prefs->mPagerClient; 668 mPagerClient = prefs->mPagerClient;
669 mPagerOtherChannel = prefs->mPagerOtherChannel; 669 mPagerOtherChannel = prefs->mPagerOtherChannel;
670 mPagerOtherMessage = prefs->mPagerOtherMessage; 670 mPagerOtherMessage = prefs->mPagerOtherMessage;
671 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; 671 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
672 672
673 mSipClient = prefs->mPagerClient; 673 mSipClient = prefs->mPagerClient;
674 mSipOtherChannel = prefs->mSipOtherChannel; 674 mSipOtherChannel = prefs->mSipOtherChannel;
675 mSipOtherMessage = prefs->mSipOtherMessage; 675 mSipOtherMessage = prefs->mSipOtherMessage;
676 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; 676 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
677 677
678 mCurrentApp = ExternalAppHandler::EMAIL; 678 mCurrentApp = ExternalAppHandler::EMAIL;
679 mCurrentClient = mEmailClient; 679 mCurrentClient = mEmailClient;
680 680
681 updateClientWidgets(); 681 updateClientWidgets();
682 682
683 blockSignals( blocked ); 683 blockSignals( blocked );
684 684
685} 685}
686 686
687void KDEPIMConfigWidget::usrWriteConfig() 687void KDEPIMConfigWidget::usrWriteConfig()
688{ 688{
689 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 689 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
690 690
691 saveEditFieldSettings(); 691 saveEditFieldSettings();
692 692
693 693
694 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 694 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
695 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 695 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
696 696
697 prefs->mTimeZoneId = mTimeZoneCombo->currentText(); 697 prefs->mTimeZoneId = mTimeZoneCombo->currentText();
698 QDate date; 698 QDate date;
699 date = mStartDateSavingEdit->date(); 699 date = mStartDateSavingEdit->date();
700 int sub = 0; 700 int sub = 0;
701 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 701 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
702 sub = 1; 702 sub = 1;
703 prefs->mDaylightsavingStart = date.dayOfYear()-sub; 703 prefs->mDaylightsavingStart = date.dayOfYear()-sub;
704 date = mEndDateSavingEdit->date(); 704 date = mEndDateSavingEdit->date();
705 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 705 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
706 sub = 1; 706 sub = 1;
707 else 707 else
708 sub = 0; 708 sub = 0;
709 prefs->mDaylightsavingEnd = date.dayOfYear()-sub; 709 prefs->mDaylightsavingEnd = date.dayOfYear()-sub;
710 710
711 711
712 prefs->mEmailClient = mEmailClient; 712 prefs->mEmailClient = mEmailClient;
713 prefs->mEmailOtherChannel = mEmailOtherChannel; 713 prefs->mEmailOtherChannel = mEmailOtherChannel;
714 prefs->mEmailOtherMessage = mEmailOtherMessage; 714 prefs->mEmailOtherMessage = mEmailOtherMessage;
715 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; 715 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
716 prefs->mEmailOtherMessage2 = mEmailOtherMessage2; 716 prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
717 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; 717 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
718 718
719 prefs->mPhoneClient = mPhoneClient; 719 prefs->mPhoneClient = mPhoneClient;
720 prefs->mPhoneOtherChannel = mPhoneOtherChannel; 720 prefs->mPhoneOtherChannel = mPhoneOtherChannel;
721 prefs->mPhoneOtherMessage = mPhoneOtherMessage; 721 prefs->mPhoneOtherMessage = mPhoneOtherMessage;
722 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; 722 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
723 723
724 prefs->mFaxClient = mFaxClient; 724 prefs->mFaxClient = mFaxClient;
725 prefs->mFaxOtherChannel = mFaxOtherChannel; 725 prefs->mFaxOtherChannel = mFaxOtherChannel;
726 prefs->mFaxOtherMessage = mFaxOtherMessage; 726 prefs->mFaxOtherMessage = mFaxOtherMessage;
727 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; 727 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
728 728
729 prefs->mSMSClient = mSMSClient; 729 prefs->mSMSClient = mSMSClient;
730 prefs->mSMSOtherChannel = mSMSOtherChannel; 730 prefs->mSMSOtherChannel = mSMSOtherChannel;
731 prefs->mSMSOtherMessage = mSMSOtherMessage; 731 prefs->mSMSOtherMessage = mSMSOtherMessage;
732 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; 732 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
733 733
734 prefs->mPagerClient = mPagerClient; 734 prefs->mPagerClient = mPagerClient;
735 prefs->mPagerOtherChannel = mPagerOtherChannel; 735 prefs->mPagerOtherChannel = mPagerOtherChannel;
736 prefs->mPagerOtherMessage = mPagerOtherMessage; 736 prefs->mPagerOtherMessage = mPagerOtherMessage;
737 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; 737 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
738 738
739 739
740 prefs->mSipClient = mSipClient; 740 prefs->mSipClient = mSipClient;
741 prefs->mSipOtherChannel = mSipOtherChannel; 741 prefs->mSipOtherChannel = mSipOtherChannel;
742 prefs->mSipOtherMessage = mSipOtherMessage; 742 prefs->mSipOtherMessage = mSipOtherMessage;
743 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; 743 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters;
744 744
745 //release the cache that other views can access the changed values instantanious 745 //release the cache that other views can access the changed values instantanious
746 ExternalAppHandler::instance()->loadConfig(); 746 ExternalAppHandler::instance()->loadConfig();
747 747 KPimGlobalPrefs::instance()->setGlobalConfig();
748} 748}
749 749
750 750
751void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, 751void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text,
752 const QStringList *tags) 752 const QStringList *tags)
753{ 753{
754 if (tags) { 754 if (tags) {
755 int i = tags->findIndex(text); 755 int i = tags->findIndex(text);
756 if (i > 0) combo->setCurrentItem(i); 756 if (i > 0) combo->setCurrentItem(i);
757 } else { 757 } else {
758 for(int i=0;i<combo->count();++i) { 758 for(int i=0;i<combo->count();++i) {
759 if (combo->text(i) == text) { 759 if (combo->text(i) == text) {
760 combo->setCurrentItem(i); 760 combo->setCurrentItem(i);
761 break; 761 break;
762 } 762 }
763 } 763 }
764 } 764 }
765} 765}
766 766
767 767
768void KDEPIMConfigWidget::textChanged( const QString& text ) 768void KDEPIMConfigWidget::textChanged( const QString& text )
769{ 769{
770 emit changed( true ); 770 emit changed( true );
771} 771}
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 12a503d..a896a0f 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -1,115 +1,132 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kdebug.h> 34#include <kdebug.h>
35#include <kstaticdeleter.h> 35#include <kstaticdeleter.h>
36 36
37#include "kpimglobalprefs.h" 37#include "kpimglobalprefs.h"
38 38
39KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; 39KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
40static KStaticDeleter<KPimGlobalPrefs> staticDeleter; 40static KStaticDeleter<KPimGlobalPrefs> staticDeleter;
41 41
42 42
43KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 43KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
44 : KPrefs("microkdeglobalrc") 44 : KPrefs("microkdeglobalrc")
45{ 45{
46 46
47 KPrefs::setCurrentGroup("Locale"); 47 KPrefs::setCurrentGroup("Locale");
48 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 48 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
49 addItemInt("PreferredTime",&mPreferredTime,0); 49 addItemInt("PreferredTime",&mPreferredTime,0);
50 addItemInt("PreferredDate",&mPreferredDate,0); 50 addItemInt("PreferredDate",&mPreferredDate,0);
51 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 51 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
52 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); 52 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
53 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 53 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
54 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 54 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
55 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 55 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
56 56
57 KPrefs::setCurrentGroup("Time & Date"); 57 KPrefs::setCurrentGroup("Time & Date");
58 58
59 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 59 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
60 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 60 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
61 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 61 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
62 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 62 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
63 63
64 64
65 65
66 66
67 KPrefs::setCurrentGroup( "ExternalApplications" ); 67 KPrefs::setCurrentGroup( "ExternalApplications" );
68 68
69 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 69 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
70 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 70 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
71 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 71 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
72 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 72 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
73 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 73 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
74 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 74 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
75 75
76 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 76 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
77 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 77 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
78 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 78 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
79 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 79 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
80 80
81 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 81 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
82 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 82 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
85 85
86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
87 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 87 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
90 90
91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
92 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 92 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
95 95
96 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC ); 96 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC );
97 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 97 addItemString( "SIPChannel", &mSipOtherChannel, "" );
98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
100 100
101} 101}
102 102
103void KPimGlobalPrefs::setGlobalConfig()
104{
105
106 KGlobal::locale()->setHore24Format( !mPreferredTime );
107 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
108 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
109 KGlobal::locale()->setLanguage( mPreferredLanguage );
110 QString dummy = mUserDateFormatLong;
111 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
112 dummy = mUserDateFormatShort;
113 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
114 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
115 mDaylightsavingStart,
116 mDaylightsavingEnd );
117 KGlobal::locale()->setTimezone( mTimeZoneId );
118
119}
103KPimGlobalPrefs::~KPimGlobalPrefs() 120KPimGlobalPrefs::~KPimGlobalPrefs()
104{ 121{
105} 122}
106 123
107KPimGlobalPrefs *KPimGlobalPrefs::instance() 124KPimGlobalPrefs *KPimGlobalPrefs::instance()
108{ 125{
109 if ( !sInstance ) { 126 if ( !sInstance ) {
110 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); 127 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() );
111 sInstance->readConfig(); 128 sInstance->readConfig();
112 } 129 }
113 130
114 return sInstance; 131 return sInstance;
115} 132}
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index dad78e6..84ba689 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -1,137 +1,135 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#ifndef KPIMGLOBALPREFS_H 31#ifndef KPIMGLOBALPREFS_H
32#define KPIMGLOBALPREFS_H 32#define KPIMGLOBALPREFS_H
33 33
34#include "kprefs.h" 34#include "kprefs.h"
35 35
36class KPimGlobalPrefs : public KPrefs 36class KPimGlobalPrefs : public KPrefs
37{ 37{
38 public: 38 public:
39 39
40 void setGlobalConfig();
40 static KPimGlobalPrefs *instance(); 41 static KPimGlobalPrefs *instance();
41 42
42 43
43 virtual ~KPimGlobalPrefs(); 44 virtual ~KPimGlobalPrefs();
44 45
45 46
46 enum EMailClients { 47 enum EMailClients {
47 NONE_EMC = 0, 48 NONE_EMC = 0,
48 OTHER_EMC = 1, 49 OTHER_EMC = 1,
49 OMPI_EMC = 2, 50 OMPI_EMC = 2,
50 QTOPIA_EMC = 3, 51 QTOPIA_EMC = 3,
51 OPIE_EMC = 4 52 OPIE_EMC = 4
52 }; 53 };
53 54
54 enum PhoneClients { 55 enum PhoneClients {
55 NONE_PHC = 0, 56 NONE_PHC = 0,
56 OTHER_PHC = 1, 57 OTHER_PHC = 1,
57 KPPI_PHC = 2 58 KPPI_PHC = 2
58 }; 59 };
59 60
60 enum FaxClients { 61 enum FaxClients {
61 NONE_FAC = 0, 62 NONE_FAC = 0,
62 OTHER_FAC = 1 63 OTHER_FAC = 1
63 }; 64 };
64 65
65 enum SMSClients { 66 enum SMSClients {
66 NONE_SMC = 0, 67 NONE_SMC = 0,
67 OTHER_SMC = 1 68 OTHER_SMC = 1
68 }; 69 };
69 70
70 enum PagerClients { 71 enum PagerClients {
71 NONE_PAC = 0, 72 NONE_PAC = 0,
72 OTHER_PAC = 1 73 OTHER_PAC = 1
73 }; 74 };
74 75
75 enum SIPClients { 76 enum SIPClients {
76 NONE_SIC = 0, 77 NONE_SIC = 0,
77 OTHER_SIC = 1 78 OTHER_SIC = 1
78 }; 79 };
79 80
80 private: 81 private:
81 KPimGlobalPrefs( const QString &name = QString::null ); 82 KPimGlobalPrefs( const QString &name = QString::null );
82 83
83 static KPimGlobalPrefs *sInstance; 84 static KPimGlobalPrefs *sInstance;
84 85
85 86
86 public: 87 public:
87 //US I copied the following "locale" settings from KOPrefs 88 //US I copied the following "locale" settings from KOPrefs
88 int mPreferredDate; 89 int mPreferredDate;
89 QString mUserDateFormatLong; 90 QString mUserDateFormatLong;
90 QString mUserDateFormatShort; 91 QString mUserDateFormatShort;
91 int mPreferredLanguage; 92 int mPreferredLanguage;
92 int mPreferredTime; 93 int mPreferredTime;
93 bool mWeekStartsOnSunday; 94 bool mWeekStartsOnSunday;
94 QString mTimeZoneId; 95 QString mTimeZoneId;
95 bool mUseDaylightsaving; 96 bool mUseDaylightsaving;
96 int mDaylightsavingStart; 97 int mDaylightsavingStart;
97 int mDaylightsavingEnd; 98 int mDaylightsavingEnd;
98 99
99
100
101
102 int mEmailClient; 100 int mEmailClient;
103 QString mEmailOtherChannel; 101 QString mEmailOtherChannel;
104 QString mEmailOtherMessage; 102 QString mEmailOtherMessage;
105 QString mEmailOtherMessageParameters; 103 QString mEmailOtherMessageParameters;
106 QString mEmailOtherMessage2; 104 QString mEmailOtherMessage2;
107 QString mEmailOtherMessageParameters2; 105 QString mEmailOtherMessageParameters2;
108 106
109 int mPhoneClient; 107 int mPhoneClient;
110 QString mPhoneOtherChannel; 108 QString mPhoneOtherChannel;
111 QString mPhoneOtherMessage; 109 QString mPhoneOtherMessage;
112 QString mPhoneOtherMessageParameters; 110 QString mPhoneOtherMessageParameters;
113 111
114 int mFaxClient; 112 int mFaxClient;
115 QString mFaxOtherChannel; 113 QString mFaxOtherChannel;
116 QString mFaxOtherMessage; 114 QString mFaxOtherMessage;
117 QString mFaxOtherMessageParameters; 115 QString mFaxOtherMessageParameters;
118 116
119 int mSMSClient; 117 int mSMSClient;
120 QString mSMSOtherChannel; 118 QString mSMSOtherChannel;
121 QString mSMSOtherMessage; 119 QString mSMSOtherMessage;
122 QString mSMSOtherMessageParameters; 120 QString mSMSOtherMessageParameters;
123 121
124 int mPagerClient; 122 int mPagerClient;
125 QString mPagerOtherChannel; 123 QString mPagerOtherChannel;
126 QString mPagerOtherMessage; 124 QString mPagerOtherMessage;
127 QString mPagerOtherMessageParameters; 125 QString mPagerOtherMessageParameters;
128 126
129 int mSipClient; 127 int mSipClient;
130 QString mSipOtherChannel; 128 QString mSipOtherChannel;
131 QString mSipOtherMessage; 129 QString mSipOtherMessage;
132 QString mSipOtherMessageParameters; 130 QString mSipOtherMessageParameters;
133 131
134 132
135}; 133};
136 134
137#endif 135#endif