summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp28
-rw-r--r--libkdepim/kpimglobalprefs.cpp6
-rw-r--r--libkdepim/kpimprefs.cpp3
-rw-r--r--libkdepim/kpimprefs.h1
4 files changed, 32 insertions, 6 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index fbfbc45..93538ec 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -87,116 +87,125 @@ $Id$
87#include "kdepimconfigwidget.h" 87#include "kdepimconfigwidget.h"
88#include <kprefs.h> 88#include <kprefs.h>
89#include <kmessagebox.h> 89#include <kmessagebox.h>
90 90
91 91
92KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 92KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
93 : KPrefsWidget(prefs, parent, name ) 93 : KPrefsWidget(prefs, parent, name )
94{ 94{
95 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 95 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
96 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 96 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
97 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 97 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
98 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 98 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
99 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 99 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
100 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 100 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
101 101
102 102
103 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 103 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
104 KDialog::spacingHint() ); 104 KDialog::spacingHint() );
105 105
106 tabWidget = new QTabWidget( this ); 106 tabWidget = new QTabWidget( this );
107 topLayout->addWidget( tabWidget ); 107 topLayout->addWidget( tabWidget );
108 108
109 109
110 setupLocaleTab(); 110 setupLocaleTab();
111 setupLocaleDateTab(); 111 setupLocaleDateTab();
112 setupTimeZoneTab(); 112 setupTimeZoneTab();
113 setupExternalAppTab(); 113 setupExternalAppTab();
114 setupStoreTab(); 114 setupStoreTab();
115 setupBackupTab(); 115 setupBackupTab();
116} 116}
117void KDEPIMConfigWidget::showTimeZoneTab() 117void KDEPIMConfigWidget::showTimeZoneTab()
118{ 118{
119 tabWidget->setCurrentPage ( 3 ) ; 119 tabWidget->setCurrentPage ( 3 ) ;
120} 120}
121void KDEPIMConfigWidget::setupBackupTab() 121void KDEPIMConfigWidget::setupBackupTab()
122{ 122{
123 QVBox *colorPage = new QVBox( this ); 123 QVBox *colorPage = new QVBox( this );
124 tabWidget->addTab( colorPage, i18n( "Backup" ) ); 124 tabWidget->addTab( colorPage, i18n( "Backup" ) );
125 QWidget* topFrame = new QWidget( colorPage ); 125 QWidget* topFrame = new QWidget( colorPage );
126 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 126 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
127 KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), 127 KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"),
128 &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); 128 &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame);
129 topLayout->addWidget((QWidget*)sb->checkBox()); 129 topLayout->addWidget((QWidget*)sb->checkBox());
130 QWidget* bupFrame = new QWidget( topFrame ); 130 QWidget* bupFrame = new QWidget( topFrame );
131 topLayout->addWidget((bupFrame)); 131 topLayout->addWidget((bupFrame));
132 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); 132 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) );
133 QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); 133 QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame);
134 sb = addWidBool(i18n("Use standard backup dir"), 134 sb = addWidBool(i18n("Use standard backup dir"),
135 &(KPimGlobalPrefs::instance()->mBackupEnabled),bupFrame); 135 &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame);
136 bupLayout->addWidget((QWidget*)sb->checkBox()); 136 bupLayout->addWidget((QWidget*)sb->checkBox());
137 mBackupUrl = new KURLRequester( bupFrame ); 137 mBackupUrl = new KURLRequester( bupFrame );
138 mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); 138 mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
139 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); 139 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) );
140 bupLayout->addWidget( mBackupUrl ); 140 bupLayout->addWidget( mBackupUrl );
141 141
142 142 mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir );
143 bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled );
143 QHBox *dummy = new QHBox(bupFrame); 144 QHBox *dummy = new QHBox(bupFrame);
144 new QLabel(i18n("Number of Backups:"),dummy); 145 new QLabel(i18n("Number of Backups:"),dummy);
145 mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); 146 mBackupNumbersSpin = new QSpinBox(1,21,1,dummy);
146 new QLabel(i18n(" "),dummy); 147 new QLabel(i18n(" "),dummy);
147 bupLayout->addWidget( dummy ); 148 bupLayout->addWidget( dummy );
148 149
149 dummy = new QHBox(bupFrame); 150 dummy = new QHBox(bupFrame);
150 new QLabel(i18n("Make backup every "),dummy); 151 new QLabel(i18n("Make backup every "),dummy);
151 mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); 152 mBackupDayCountSpin = new QSpinBox(1,28,1,dummy);
152 new QLabel(i18n(" days"),dummy); 153 new QLabel(i18n(" days"),dummy);
153 new QLabel(i18n(" "),dummy); 154 new QLabel(i18n(" "),dummy);
154 bupLayout->addWidget( dummy ); 155 bupLayout->addWidget( dummy );
156 QString localKdeDir;
157 localKdeDir = readEnvPath("LOCALMICROKDEHOME");
158 if ( ! localKdeDir.isEmpty() ) {
159 sb->checkBox()->setEnabled( false );
160 sb->checkBox()->setChecked( true );
161 mBackupUrl->setEnabled( false );
162 KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true;
163 }
155 164
156} 165}
157void KDEPIMConfigWidget::setupStoreTab() 166void KDEPIMConfigWidget::setupStoreTab()
158{ 167{
159 QVBox *colorPage = new QVBox( this ); 168 QVBox *colorPage = new QVBox( this );
160 tabWidget->addTab( colorPage, i18n( "Colors" ) ); 169 tabWidget->addTab( colorPage, i18n( "Colors" ) );
161 QWidget* cw = new QWidget( colorPage ); 170 QWidget* cw = new QWidget( colorPage );
162 KPrefsWidColor *holidayColor = 171 KPrefsWidColor *holidayColor =
163 addWidColor(i18n("Alternating background of list views"), 172 addWidColor(i18n("Alternating background of list views"),
164 &(KPimGlobalPrefs::instance()->mAlternateColor),cw); 173 &(KPimGlobalPrefs::instance()->mAlternateColor),cw);
165 QHBoxLayout *topLayout = new QHBoxLayout(cw); 174 QHBoxLayout *topLayout = new QHBoxLayout(cw);
166 topLayout->addWidget(holidayColor->label()); 175 topLayout->addWidget(holidayColor->label());
167 topLayout->addWidget( (QWidget* )holidayColor->button()); 176 topLayout->addWidget( (QWidget* )holidayColor->button());
168 177
169 178
170 QVBox *storePage = new QVBox( this ); 179 QVBox *storePage = new QVBox( this );
171 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); 180 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage );
172 new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); 181 new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
173 mStoreUrl = new KURLRequester( storePage ); 182 mStoreUrl = new KURLRequester( storePage );
174 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); 183 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
175#ifdef DESKTOP_VERSION 184#ifdef DESKTOP_VERSION
176 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; 185 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
177 QFileInfo fi ( confFile ); 186 QFileInfo fi ( confFile );
178 if ( fi.exists() ) { 187 if ( fi.exists() ) {
179 KConfig cfg ( confFile ); 188 KConfig cfg ( confFile );
180 cfg.setGroup("Global"); 189 cfg.setGroup("Global");
181 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); 190 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" );
182 if ( localKdeDir != "x_x_x" ) { 191 if ( localKdeDir != "x_x_x" ) {
183 mStoreUrl->setURL( localKdeDir ); 192 mStoreUrl->setURL( localKdeDir );
184 qDebug("Reading config from %s ", confFile.latin1()); 193 qDebug("Reading config from %s ", confFile.latin1());
185 } 194 }
186 } 195 }
187 196
188#endif 197#endif
189 new QLabel( i18n("New dirs are created automatically"), storePage ); 198 new QLabel( i18n("New dirs are created automatically"), storePage );
190 QHBox *bb = new QHBox( storePage ); 199 QHBox *bb = new QHBox( storePage );
191 QPushButton * pb; 200 QPushButton * pb;
192 if ( QApplication::desktop()->width() < 640 ) 201 if ( QApplication::desktop()->width() < 640 )
193 pb = new QPushButton ( i18n("Save"), bb ); 202 pb = new QPushButton ( i18n("Save"), bb );
194 else 203 else
195 pb = new QPushButton ( i18n("Save settings"), bb ); 204 pb = new QPushButton ( i18n("Save settings"), bb );
196 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); 205 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
197 pb = new QPushButton ( i18n("Save standard"), bb ); 206 pb = new QPushButton ( i18n("Save standard"), bb );
198 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); 207 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
199#ifdef DESKTOP_VERSION 208#ifdef DESKTOP_VERSION
200 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); 209 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb );
201 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); 210 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) );
202#endif 211#endif
@@ -761,156 +770,163 @@ void KDEPIMConfigWidget::updateClientWidgets()
761 enabled = true; 770 enabled = true;
762 } 771 }
763 772
764 773
765 mChannel->setReadOnly(readonly); 774 mChannel->setReadOnly(readonly);
766 mMessage->setReadOnly(readonly); 775 mMessage->setReadOnly(readonly);
767 mParameters->setReadOnly(readonly); 776 mParameters->setReadOnly(readonly);
768 mMessage2->setReadOnly(readonly); 777 mMessage2->setReadOnly(readonly);
769 mParameters2->setReadOnly(readonly); 778 mParameters2->setReadOnly(readonly);
770 779
771 mChannel->setEnabled(enabled); 780 mChannel->setEnabled(enabled);
772 mMessage->setEnabled(enabled); 781 mMessage->setEnabled(enabled);
773 mParameters->setEnabled(enabled); 782 mParameters->setEnabled(enabled);
774 mMessage2->setEnabled(enabled); 783 mMessage2->setEnabled(enabled);
775 mParameters2->setEnabled(enabled); 784 mParameters2->setEnabled(enabled);
776 785
777 786
778 787
779 mClient->setCurrentItem(mCurrentClient); 788 mClient->setCurrentItem(mCurrentClient);
780 789
781 790
782 // enable/disable the extra message/parameter field 791 // enable/disable the extra message/parameter field
783 if (mCurrentApp == ExternalAppHandler::EMAIL) 792 if (mCurrentApp == ExternalAppHandler::EMAIL)
784 { 793 {
785 } 794 }
786 else 795 else
787 { 796 {
788 mMessage2->setText( "" ); 797 mMessage2->setText( "" );
789 mParameters2->setText( "" ); 798 mParameters2->setText( "" );
790 } 799 }
791 800
792 if (enabled == true) { 801 if (enabled == true) {
793 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 802 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
794 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 803 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
795 } 804 }
796 805
797 806
798 blockSignals( blocked ); 807 blockSignals( blocked );
799 808
800} 809}
801 810
802void KDEPIMConfigWidget::usrReadConfig() 811void KDEPIMConfigWidget::usrReadConfig()
803{ 812{
804 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 813 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
805 814
806 bool blocked = signalsBlocked(); 815 bool blocked = signalsBlocked();
807 blockSignals( true ); 816 blockSignals( true );
808 817
818 if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir )
819 mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
820 else
821 mBackupUrl->setURL(prefs->mBackupDatadir);
822 mBackupNumbersSpin->setValue( prefs->mBackupNumbers );
823 mBackupDayCountSpin->setValue( prefs->mBackupDayCount);
824
809 QString dummy = prefs->mUserDateFormatLong; 825 QString dummy = prefs->mUserDateFormatLong;
810 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 826 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
811 dummy = prefs->mUserDateFormatShort; 827 dummy = prefs->mUserDateFormatShort;
812 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 828 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
813 829
814 QDate current ( 2001, 1,1); 830 QDate current ( 2001, 1,1);
815 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); 831 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
816 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); 832 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
817 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); 833 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
818 834
819
820
821
822 mEmailClient = prefs->mEmailClient; 835 mEmailClient = prefs->mEmailClient;
823 mEmailOtherChannel = prefs->mEmailOtherChannel; 836 mEmailOtherChannel = prefs->mEmailOtherChannel;
824 mEmailOtherMessage = prefs->mEmailOtherMessage; 837 mEmailOtherMessage = prefs->mEmailOtherMessage;
825 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; 838 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
826 mEmailOtherMessage2 = prefs->mEmailOtherMessage2; 839 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
827 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; 840 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
828 841
829 mPhoneClient = prefs->mPhoneClient; 842 mPhoneClient = prefs->mPhoneClient;
830 mPhoneOtherChannel = prefs->mPhoneOtherChannel; 843 mPhoneOtherChannel = prefs->mPhoneOtherChannel;
831 mPhoneOtherMessage = prefs->mPhoneOtherMessage; 844 mPhoneOtherMessage = prefs->mPhoneOtherMessage;
832 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; 845 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
833 846
834 mFaxClient = prefs->mFaxClient; 847 mFaxClient = prefs->mFaxClient;
835 mFaxOtherChannel = prefs->mFaxOtherChannel; 848 mFaxOtherChannel = prefs->mFaxOtherChannel;
836 mFaxOtherMessage = prefs->mFaxOtherMessage; 849 mFaxOtherMessage = prefs->mFaxOtherMessage;
837 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; 850 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
838 851
839 mSMSClient = prefs->mSMSClient; 852 mSMSClient = prefs->mSMSClient;
840 mSMSOtherChannel = prefs->mSMSOtherChannel; 853 mSMSOtherChannel = prefs->mSMSOtherChannel;
841 mSMSOtherMessage = prefs->mSMSOtherMessage; 854 mSMSOtherMessage = prefs->mSMSOtherMessage;
842 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; 855 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
843 856
844 mPagerClient = prefs->mPagerClient; 857 mPagerClient = prefs->mPagerClient;
845 mPagerOtherChannel = prefs->mPagerOtherChannel; 858 mPagerOtherChannel = prefs->mPagerOtherChannel;
846 mPagerOtherMessage = prefs->mPagerOtherMessage; 859 mPagerOtherMessage = prefs->mPagerOtherMessage;
847 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; 860 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
848 861
849 mSipClient = prefs->mSipClient; 862 mSipClient = prefs->mSipClient;
850 mSipOtherChannel = prefs->mSipOtherChannel; 863 mSipOtherChannel = prefs->mSipOtherChannel;
851 mSipOtherMessage = prefs->mSipOtherMessage; 864 mSipOtherMessage = prefs->mSipOtherMessage;
852 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; 865 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
853 866
854 mCurrentApp = ExternalAppHandler::EMAIL; 867 mCurrentApp = ExternalAppHandler::EMAIL;
855 mCurrentClient = mEmailClient; 868 mCurrentClient = mEmailClient;
856 869
857 updateClientWidgets(); 870 updateClientWidgets();
858 871
859 blockSignals( blocked ); 872 blockSignals( blocked );
860 873
861} 874}
862 875
863void KDEPIMConfigWidget::usrWriteConfig() 876void KDEPIMConfigWidget::usrWriteConfig()
864{ 877{
865 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 878 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
866 879
867 saveEditFieldSettings(); 880 saveEditFieldSettings();
868 881
882 prefs->mBackupNumbers = mBackupNumbersSpin->value();
883 prefs->mBackupDayCount = mBackupDayCountSpin->value();
884 prefs->mBackupDatadir = mBackupUrl->url();
869 885
870 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 886 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
871 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 887 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
872 888
873 prefs->mTimeZoneId = mTimeZoneCombo->currentText(); 889 prefs->mTimeZoneId = mTimeZoneCombo->currentText();
874 QDate date; 890 QDate date;
875 date = mStartDateSavingEdit->date(); 891 date = mStartDateSavingEdit->date();
876 int sub = 0; 892 int sub = 0;
877 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 893 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
878 sub = 1; 894 sub = 1;
879 prefs->mDaylightsavingStart = date.dayOfYear()-sub; 895 prefs->mDaylightsavingStart = date.dayOfYear()-sub;
880 date = mEndDateSavingEdit->date(); 896 date = mEndDateSavingEdit->date();
881 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 897 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
882 sub = 1; 898 sub = 1;
883 else 899 else
884 sub = 0; 900 sub = 0;
885 prefs->mDaylightsavingEnd = date.dayOfYear()-sub; 901 prefs->mDaylightsavingEnd = date.dayOfYear()-sub;
886 902
887 903
888 prefs->mEmailClient = mEmailClient; 904 prefs->mEmailClient = mEmailClient;
889 prefs->mEmailOtherChannel = mEmailOtherChannel; 905 prefs->mEmailOtherChannel = mEmailOtherChannel;
890 prefs->mEmailOtherMessage = mEmailOtherMessage; 906 prefs->mEmailOtherMessage = mEmailOtherMessage;
891 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; 907 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
892 prefs->mEmailOtherMessage2 = mEmailOtherMessage2; 908 prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
893 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; 909 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
894 910
895 prefs->mPhoneClient = mPhoneClient; 911 prefs->mPhoneClient = mPhoneClient;
896 prefs->mPhoneOtherChannel = mPhoneOtherChannel; 912 prefs->mPhoneOtherChannel = mPhoneOtherChannel;
897 prefs->mPhoneOtherMessage = mPhoneOtherMessage; 913 prefs->mPhoneOtherMessage = mPhoneOtherMessage;
898 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; 914 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
899 915
900 prefs->mFaxClient = mFaxClient; 916 prefs->mFaxClient = mFaxClient;
901 prefs->mFaxOtherChannel = mFaxOtherChannel; 917 prefs->mFaxOtherChannel = mFaxOtherChannel;
902 prefs->mFaxOtherMessage = mFaxOtherMessage; 918 prefs->mFaxOtherMessage = mFaxOtherMessage;
903 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; 919 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
904 920
905 prefs->mSMSClient = mSMSClient; 921 prefs->mSMSClient = mSMSClient;
906 prefs->mSMSOtherChannel = mSMSOtherChannel; 922 prefs->mSMSOtherChannel = mSMSOtherChannel;
907 prefs->mSMSOtherMessage = mSMSOtherMessage; 923 prefs->mSMSOtherMessage = mSMSOtherMessage;
908 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; 924 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
909 925
910 prefs->mPagerClient = mPagerClient; 926 prefs->mPagerClient = mPagerClient;
911 prefs->mPagerOtherChannel = mPagerOtherChannel; 927 prefs->mPagerOtherChannel = mPagerOtherChannel;
912 prefs->mPagerOtherMessage = mPagerOtherMessage; 928 prefs->mPagerOtherMessage = mPagerOtherMessage;
913 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; 929 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
914 930
915 931
916 prefs->mSipClient = mSipClient; 932 prefs->mSipClient = mSipClient;
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 90321b2..9c28425 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -155,69 +155,75 @@ void KPimGlobalPrefs::setGlobalConfig()
155 int br = 0; 155 int br = 0;
156 int nbr; 156 int nbr;
157 nbr = text.find ( "},", br ); 157 nbr = text.find ( "},", br );
158 line = text.mid( br, nbr - br ); 158 line = text.mid( br, nbr - br );
159 br = nbr+1; 159 br = nbr+1;
160 int se, ee, st, et; 160 int se, ee, st, et;
161 mLocaleDict = new QDict<QString>; 161 mLocaleDict = new QDict<QString>;
162 mLocaleDict->setAutoDelete( true ); 162 mLocaleDict->setAutoDelete( true );
163 QString end = "{ \"\",\"\" }"; 163 QString end = "{ \"\",\"\" }";
164 while ( (line != end) && (br > 1) ) { 164 while ( (line != end) && (br > 1) ) {
165 //qDebug("%d *%s* ", br, line.latin1()); 165 //qDebug("%d *%s* ", br, line.latin1());
166 se = line.find("\"")+1; 166 se = line.find("\"")+1;
167 et = line.findRev("\"",-1); 167 et = line.findRev("\"",-1);
168 ee = line.find("\",\""); 168 ee = line.find("\",\"");
169 st = ee+3; 169 st = ee+3;
170 we = line.mid( se, ee-se ); 170 we = line.mid( se, ee-se );
171 if ( mPreferredLanguage == 4 ) 171 if ( mPreferredLanguage == 4 )
172 wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); 172 wt = QString::fromUtf8(line.mid( st, et-st ).latin1());
173 else 173 else
174 wt = line.mid( st, et-st ); 174 wt = line.mid( st, et-st );
175 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); 175 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
176 mLocaleDict->insert( we, new QString (wt) ); 176 mLocaleDict->insert( we, new QString (wt) );
177 nbr = text.find ( "}", br ); 177 nbr = text.find ( "}", br );
178 line = text.mid( br, nbr - br ); 178 line = text.mid( br, nbr - br );
179 br = nbr+1; 179 br = nbr+1;
180 } 180 }
181 //qDebug("end *%s* ", end.latin1()); 181 //qDebug("end *%s* ", end.latin1());
182 182
183 setLocaleDict( mLocaleDict ); 183 setLocaleDict( mLocaleDict );
184 } else { 184 } else {
185 qDebug("KO: Cannot find translation file %s",fileName.latin1() ); 185 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
186 } 186 }
187 } 187 }
188 } 188 }
189 189
190 KGlobal::locale()->setHore24Format( !mPreferredTime ); 190 KGlobal::locale()->setHore24Format( !mPreferredTime );
191 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); 191 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
192 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); 192 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
193 KGlobal::locale()->setLanguage( mPreferredLanguage ); 193 KGlobal::locale()->setLanguage( mPreferredLanguage );
194 QString dummy = mUserDateFormatLong; 194 QString dummy = mUserDateFormatLong;
195 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 195 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
196 dummy = mUserDateFormatShort; 196 dummy = mUserDateFormatShort;
197 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 197 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
198 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 198 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
199 mDaylightsavingStart, 199 mDaylightsavingStart,
200 mDaylightsavingEnd ); 200 mDaylightsavingEnd );
201 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); 201 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
202 KGlobalSettings::setAlternateBackgroundColor(mAlternateColor); 202 KGlobalSettings::setAlternateBackgroundColor(mAlternateColor);
203 QString localKdeDir;
204 localKdeDir = readEnvPath("LOCALMICROKDEHOME");
205 if ( ! localKdeDir.isEmpty() ) {
206 mBackupUseDefaultDir = true;
207 mBackupDatadir = KGlobalSettings::backupDataDir();
208 }
203 209
204} 210}
205KPimGlobalPrefs::~KPimGlobalPrefs() 211KPimGlobalPrefs::~KPimGlobalPrefs()
206{ 212{
207 if (sInstance == this) 213 if (sInstance == this)
208 sInstance = staticDeleterGP.setObject(0); 214 sInstance = staticDeleterGP.setObject(0);
209 else 215 else
210 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); 216 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?");
211 if ( mLocaleDict ) 217 if ( mLocaleDict )
212 delete mLocaleDict; 218 delete mLocaleDict;
213} 219}
214 220
215KPimGlobalPrefs *KPimGlobalPrefs::instance() 221KPimGlobalPrefs *KPimGlobalPrefs::instance()
216{ 222{
217 if ( !sInstance ) { 223 if ( !sInstance ) {
218 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); 224 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() );
219 sInstance->readConfig(); 225 sInstance->readConfig();
220 } 226 }
221 227
222 return sInstance; 228 return sInstance;
223} 229}
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index d68ccb6..714d1b7 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -5,78 +5,81 @@
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 35
36#include "kpimprefs.h" 36#include "kpimprefs.h"
37 37
38KPimPrefs::KPimPrefs( const QString &name ) : 38KPimPrefs::KPimPrefs( const QString &name ) :
39 KPrefs( name ) 39 KPrefs( name )
40{ 40{
41#ifdef _WIN32_ 41#ifdef _WIN32_
42 QString hdp= locateLocal("data","korganizer")+"\\\\"; 42 QString hdp= locateLocal("data","korganizer")+"\\\\";
43#else 43#else
44 QString hdp= locateLocal("data","korganizer")+"/"; 44 QString hdp= locateLocal("data","korganizer")+"/";
45#endif 45#endif
46 setCurrentGroup("SyncOptions"); 46 setCurrentGroup("SyncOptions");
47 addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); 47 addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
48 addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); 48 addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
49 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); 49 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
50 addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false ); 50 addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false );
51 addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false ); 51 addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false );
52 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); 52 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
53
54 setCurrentGroup("BackupDate");
55 addItemInt("LastBackupDate",&mLastBackupDate,0);
53} 56}
54 57
55KPimPrefs::~KPimPrefs() 58KPimPrefs::~KPimPrefs()
56{ 59{
57} 60}
58 61
59void KPimPrefs::usrSetDefaults() 62void KPimPrefs::usrSetDefaults()
60{ 63{
61 setCategoryDefaults(); 64 setCategoryDefaults();
62} 65}
63 66
64void KPimPrefs::usrReadConfig() 67void KPimPrefs::usrReadConfig()
65{ 68{
66 config()->setGroup("General"); 69 config()->setGroup("General");
67 mCustomCategories = config()->readListEntry("Custom Categories"); 70 mCustomCategories = config()->readListEntry("Custom Categories");
68 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 71 if (mCustomCategories.isEmpty()) setCategoryDefaults();
69} 72}
70 73
71 74
72void KPimPrefs::usrWriteConfig() 75void KPimPrefs::usrWriteConfig()
73{ 76{
74 config()->setGroup("General"); 77 config()->setGroup("General");
75 config()->writeEntry("Custom Categories",mCustomCategories); 78 config()->writeEntry("Custom Categories",mCustomCategories);
76} 79}
77 80
78void KPimPrefs::setCategoryDefaults() 81void KPimPrefs::setCategoryDefaults()
79{ 82{
80 // empty implementation 83 // empty implementation
81} 84}
82 85
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index c177bd6..bf80042 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -16,58 +16,59 @@
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 KPIMPREFS_H 31#ifndef KPIMPREFS_H
32#define KPIMPREFS_H 32#define KPIMPREFS_H
33 33
34#include <qstringlist.h> 34#include <qstringlist.h>
35 35
36#include "kprefs.h" 36#include "kprefs.h"
37 37
38class KPimPrefs : public KPrefs 38class KPimPrefs : public KPrefs
39{ 39{
40 public: 40 public:
41 41
42 KPimPrefs( const QString &name = QString::null ); 42 KPimPrefs( const QString &name = QString::null );
43 43
44 virtual ~KPimPrefs(); 44 virtual ~KPimPrefs();
45 45
46 /** Set preferences to default values */ 46 /** Set preferences to default values */
47 void usrSetDefaults(); 47 void usrSetDefaults();
48 48
49 /** Read preferences from config file */ 49 /** Read preferences from config file */
50 void usrReadConfig(); 50 void usrReadConfig();
51 51
52 /** Write preferences to config file */ 52 /** Write preferences to config file */
53 void usrWriteConfig(); 53 void usrWriteConfig();
54 54
55 55
56 public: 56 public:
57 QStringList mCustomCategories; 57 QStringList mCustomCategories;
58 QString mPassiveSyncPort; 58 QString mPassiveSyncPort;
59 QString mPassiveSyncPw; 59 QString mPassiveSyncPw;
60 bool mPassiveSyncWithDesktop; 60 bool mPassiveSyncWithDesktop;
61 bool mPassiveSyncAutoStart; 61 bool mPassiveSyncAutoStart;
62 int mRingSyncAlgoPrefs; 62 int mRingSyncAlgoPrefs;
63 QString mLastSyncedLocalFile; 63 QString mLastSyncedLocalFile;
64 int mLastBackupDate;
64 65
65 66
66 protected: 67 protected:
67 virtual void setCategoryDefaults(); 68 virtual void setCategoryDefaults();
68 69
69 70
70 71
71}; 72};
72 73
73#endif 74#endif