author | zautrix <zautrix> | 2004-10-23 11:40:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-23 11:40:59 (UTC) |
commit | 25b0233d54a6d4bea457fd843073e57183d8bea0 (patch) (unidiff) | |
tree | 4d85c3cec59e8b085738be7111c7e2bb0ee7219e | |
parent | ba2583db0431059cd7368be23c9653e81af16d29 (diff) | |
download | kdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.zip kdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.tar.gz kdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.tar.bz2 |
global settings bugfixes
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 73 | ||||
-rw-r--r-- | kaddressbook/kabprefs.h | 1 | ||||
-rw-r--r-- | kmicromail/koprefs.h | 2 | ||||
-rw-r--r-- | korganizer/kodialogmanager.cpp | 5 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 88 | ||||
-rw-r--r-- | korganizer/koprefs.h | 16 | ||||
-rw-r--r-- | korganizer/ktimeedit.cpp | 5 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 3 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 76 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.h | 2 | ||||
-rw-r--r-- | microkde/kstaticdeleter.h | 5 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmprefs.cpp | 12 |
13 files changed, 105 insertions, 185 deletions
@@ -1,27 +1,27 @@ | |||
1 | ############################################################################# | 1 | ############################################################################# |
2 | # Makefile for building: kdepim-desktop | 2 | # Makefile for building: kdepim-desktop |
3 | # Generated by qmake (1.07a) (Qt 3.3.3) on: Sat Oct 23 09:29:11 2004 | 3 | # Generated by qmake (1.07a) (Qt 3.3.3) on: Sat Oct 23 12:23:49 2004 |
4 | # Project: kdepim-desktop.pro | 4 | # Project: kdepim-desktop.pro |
5 | # Template: subdirs | 5 | # Template: subdirs |
6 | # Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro | 6 | # Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro |
7 | ############################################################################# | 7 | ############################################################################# |
8 | 8 | ||
9 | MAKEFILE =Makefile | 9 | MAKEFILE =Makefile |
10 | QMAKE =qmake | 10 | QMAKE =qmake |
11 | DEL_FILE = rm -f | 11 | DEL_FILE = rm -f |
12 | CHK_DIR_EXISTS= test -d | 12 | CHK_DIR_EXISTS= test -d |
13 | MKDIR = mkdir -p | 13 | MKDIR = mkdir -p |
14 | INSTALL_FILE= | 14 | INSTALL_FILE= |
15 | INSTALL_DIR = | 15 | INSTALL_DIR = |
16 | SUBTARGETS = \ | 16 | SUBTARGETS = \ |
17 | sub-gammu-emb-common \ | 17 | sub-gammu-emb-common \ |
18 | sub-gammu-emb-gammu \ | 18 | sub-gammu-emb-gammu \ |
19 | sub-libical \ | 19 | sub-libical \ |
20 | sub-libkcal \ | 20 | sub-libkcal \ |
21 | sub-microkde \ | 21 | sub-microkde \ |
22 | sub-libkdepim \ | 22 | sub-libkdepim \ |
23 | sub-kabc \ | 23 | sub-kabc \ |
24 | sub-korganizer \ | 24 | sub-korganizer \ |
25 | sub-kaddressbook \ | 25 | sub-kaddressbook \ |
26 | sub-kabc-plugins-file \ | 26 | sub-kabc-plugins-file \ |
27 | sub-kabc-plugins-dir \ | 27 | sub-kabc-plugins-dir \ |
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 01c935f..3cbcc9a 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -22,192 +22,129 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | //US#ifdef KAB_EMBEDDED | 24 | //US#ifdef KAB_EMBEDDED |
25 | //#include <qstring.h> | 25 | //#include <qstring.h> |
26 | //#endif //KAB_EMBEDDED | 26 | //#endif //KAB_EMBEDDED |
27 | 27 | ||
28 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qregexp.h> | 30 | #include <qregexp.h> |
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <libkdepim/kpimglobalprefs.h> | 32 | #include <libkdepim/kpimglobalprefs.h> |
33 | 33 | ||
34 | #include <kconfig.h> | 34 | #include <kconfig.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kstaticdeleter.h> | 36 | #include <kstaticdeleter.h> |
37 | //US#include <kdebug.h> // defines kdDebug() | 37 | //US#include <kdebug.h> // defines kdDebug() |
38 | 38 | ||
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | 40 | ||
41 | #ifdef DESKTOP_VERSION | 41 | #ifdef DESKTOP_VERSION |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | KABPrefs *KABPrefs::sInstance = 0; | 45 | KABPrefs *KABPrefs::sInstance = 0; |
46 | static KStaticDeleter<KABPrefs> staticDeleter; | 46 | static KStaticDeleter<KABPrefs> staticDeleterAB; |
47 | 47 | ||
48 | KABPrefs::KABPrefs() | 48 | KABPrefs::KABPrefs() |
49 | : KPimPrefs("kaddressbookrc") | 49 | : KPimPrefs("kaddressbookrc") |
50 | { | 50 | { |
51 | |||
52 | mLocaleDict = 0; | ||
53 | mDetailsFont = QFont("helvetica",12); | 51 | mDetailsFont = QFont("helvetica",12); |
54 | KPrefs::setCurrentGroup( "Views" ); | 52 | KPrefs::setCurrentGroup( "Views" ); |
55 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); | 53 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); |
56 | 54 | ||
57 | KPrefs::setCurrentGroup( "General" ); | 55 | KPrefs::setCurrentGroup( "General" ); |
58 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); | 56 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); |
59 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); | 57 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); |
60 | 58 | ||
61 | #ifdef KAB_EMBEDDED | 59 | #ifdef KAB_EMBEDDED |
62 | addItemBool("AskForQuit",&mAskForQuit,true); | 60 | addItemBool("AskForQuit",&mAskForQuit,true); |
63 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 61 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
64 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 62 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
65 | addItemBool("SearchWithReturn",&mSearchWithReturn, true ); | 63 | addItemBool("SearchWithReturn",&mSearchWithReturn, true ); |
66 | addItemFont("DetailsFont",&mDetailsFont); | 64 | addItemFont("DetailsFont",&mDetailsFont); |
67 | 65 | ||
68 | 66 | ||
69 | #endif //KAB_EMBEDDED | 67 | #endif //KAB_EMBEDDED |
70 | 68 | ||
71 | KPrefs::setCurrentGroup( "MainWindow" ); | 69 | KPrefs::setCurrentGroup( "MainWindow" ); |
72 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); | 70 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); |
73 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); | 71 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); |
74 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); | 72 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); |
75 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); | 73 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); |
76 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); | 74 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); |
77 | 75 | ||
78 | 76 | ||
79 | KPrefs::setCurrentGroup( "Extensions_General" ); | 77 | KPrefs::setCurrentGroup( "Extensions_General" ); |
80 | QStringList defaultExtensions; | 78 | QStringList defaultExtensions; |
81 | defaultExtensions << "merge"; | 79 | defaultExtensions << "merge"; |
82 | defaultExtensions << "distribution_list_editor"; | 80 | defaultExtensions << "distribution_list_editor"; |
83 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); | 81 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); |
84 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); | 82 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); |
85 | 83 | ||
86 | KPrefs::setCurrentGroup( "Views" ); | 84 | KPrefs::setCurrentGroup( "Views" ); |
87 | QString defaultView = i18n( "Default Table View" ); | 85 | QString defaultView = i18n( "Default Table View" ); |
88 | addItemString( "CurrentView", &mCurrentView, defaultView ); | 86 | addItemString( "CurrentView", &mCurrentView, defaultView ); |
89 | addItemStringList( "ViewNames", &mViewNames, defaultView ); | 87 | addItemStringList( "ViewNames", &mViewNames, defaultView ); |
90 | 88 | ||
91 | KPrefs::setCurrentGroup( "Filters" ); | 89 | KPrefs::setCurrentGroup( "Filters" ); |
92 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); | 90 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); |
93 | 91 | ||
94 | } | 92 | } |
95 | 93 | ||
96 | KABPrefs::~KABPrefs() | 94 | KABPrefs::~KABPrefs() |
97 | { | 95 | { |
98 | //qDebug("KABPrefs::~KABPrefs() "); | 96 | //qDebug("KABPrefs::~KABPrefs() "); |
99 | setLocaleDict( 0 ); | 97 | if (sInstance == this) |
100 | if ( mLocaleDict ) | 98 | sInstance = staticDeleterAB.setObject(0); |
101 | delete mLocaleDict; | ||
102 | } | 99 | } |
103 | 100 | ||
104 | KABPrefs *KABPrefs::instance() | 101 | KABPrefs *KABPrefs::instance() |
105 | { | 102 | { |
106 | if ( !sInstance ) { | 103 | if ( !sInstance ) { |
107 | #ifdef KAB_EMBEDDED | 104 | #ifdef KAB_EMBEDDED |
108 | sInstance = staticDeleter.setObject( new KABPrefs() ); | 105 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); |
109 | #else //KAB_EMBEDDED | 106 | #else //KAB_EMBEDDED |
110 | //US the following line has changed ???. Why | 107 | //US the following line has changed ???. Why |
111 | staticDeleter.setObject( sInstance, new KABPrefs() ); | 108 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); |
112 | #endif //KAB_EMBEDDED | 109 | #endif //KAB_EMBEDDED |
113 | sInstance->readConfig(); | 110 | sInstance->readConfig(); |
114 | } | 111 | } |
115 | 112 | ||
116 | return sInstance; | 113 | return sInstance; |
117 | } | 114 | } |
118 | 115 | ||
119 | void KABPrefs::setCategoryDefaults() | 116 | void KABPrefs::setCategoryDefaults() |
120 | { | 117 | { |
121 | mCustomCategories.clear(); | 118 | mCustomCategories.clear(); |
122 | 119 | ||
123 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) | 120 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) |
124 | << i18n( "Customer" ) << i18n( "Friend" ); | 121 | << i18n( "Customer" ) << i18n( "Friend" ); |
125 | } | 122 | } |
126 | 123 | ||
127 | // US introduce a nonconst way to return the config object. | 124 | // US introduce a nonconst way to return the config object. |
128 | KConfig* KABPrefs::getConfig() | 125 | KConfig* KABPrefs::getConfig() |
129 | { | 126 | { |
130 | return config(); | 127 | return config(); |
131 | } | 128 | } |
132 | void KABPrefs::usrReadConfig() | 129 | void KABPrefs::usrReadConfig() |
133 | { | 130 | { |
134 | QString fileName ; | ||
135 | #ifndef DESKTOP_VERSION | ||
136 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/"; | ||
137 | #else | ||
138 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/"; | ||
139 | #endif | ||
140 | int mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | ||
141 | mLocaleDict = 0; | ||
142 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { | ||
143 | |||
144 | if ( mPreferredLanguage == 1 ) | ||
145 | fileName = fileName+"germantranslation.txt"; | ||
146 | else if ( mPreferredLanguage == 4 ) | ||
147 | fileName = fileName+"usertranslation.txt"; | ||
148 | else if ( mPreferredLanguage == 2 ) | ||
149 | fileName = fileName+"frenchtranslation.txt"; | ||
150 | else if ( mPreferredLanguage == 3 ) | ||
151 | fileName = fileName+"italiantranslation.txt"; | ||
152 | QFile file( fileName ); | ||
153 | if (file.open( IO_ReadOnly ) ) { | ||
154 | QTextStream ts( &file ); | ||
155 | ts.setEncoding( QTextStream::Latin1 ); | ||
156 | //ts.setCodec( QTextCodec::latin1 ); | ||
157 | QString text = ts.read(); | ||
158 | file.close(); | ||
159 | text.replace( QRegExp("\\\\n"), "\n" ); | ||
160 | QString line; | ||
161 | QString we; | ||
162 | QString wt; | ||
163 | int br = 0; | ||
164 | int nbr; | ||
165 | nbr = text.find ( "},", br ); | ||
166 | line = text.mid( br, nbr - br ); | ||
167 | br = nbr+1; | ||
168 | int se, ee, st, et; | ||
169 | mLocaleDict = new QDict<QString>; | ||
170 | QString end = "{ \"\",\"\" }"; | ||
171 | while ( (line != end) && (br > 1) ) { | ||
172 | //qDebug("%d *%s* ", br, line.latin1()); | ||
173 | se = line.find("\"")+1; | ||
174 | et = line.findRev("\"",-1); | ||
175 | ee = line.find("\",\""); | ||
176 | st = ee+3; | ||
177 | we = line.mid( se, ee-se ); | ||
178 | wt = line.mid( st, et-st ); | ||
179 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | ||
180 | mLocaleDict->insert( we, new QString (wt) ); | ||
181 | nbr = text.find ( "}", br ); | ||
182 | line = text.mid( br, nbr - br ); | ||
183 | br = nbr+1; | ||
184 | } | ||
185 | //qDebug("end *%s* ", end.latin1()); | ||
186 | |||
187 | setLocaleDict( mLocaleDict ); | ||
188 | } else { | ||
189 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | ||
190 | } | ||
191 | |||
192 | |||
193 | } | ||
194 | KPimPrefs::usrReadConfig(); | 131 | KPimPrefs::usrReadConfig(); |
195 | } | 132 | } |
196 | 133 | ||
197 | 134 | ||
198 | /*US | 135 | /*US |
199 | void KABPrefs::usrSetDefaults() | 136 | void KABPrefs::usrSetDefaults() |
200 | { | 137 | { |
201 | KPimPrefs::usrSetDefaults(); | 138 | KPimPrefs::usrSetDefaults(); |
202 | } | 139 | } |
203 | 140 | ||
204 | void KABPrefs::usrReadConfig() | 141 | void KABPrefs::usrReadConfig() |
205 | { | 142 | { |
206 | KPimPrefs::usrReadConfig(); | 143 | KPimPrefs::usrReadConfig(); |
207 | } | 144 | } |
208 | 145 | ||
209 | void KABPrefs::usrWriteConfig() | 146 | void KABPrefs::usrWriteConfig() |
210 | { | 147 | { |
211 | KPimPrefs::usrWriteConfig(); | 148 | KPimPrefs::usrWriteConfig(); |
212 | } | 149 | } |
213 | */ | 150 | */ |
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index 1098f4c..cc8413e 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h | |||
@@ -68,29 +68,28 @@ class KABPrefs : public KPimPrefs | |||
68 | bool mJumpButtonBarVisible; | 68 | bool mJumpButtonBarVisible; |
69 | bool mDetailsPageVisible; | 69 | bool mDetailsPageVisible; |
70 | bool mMultipleViewsAtOnce; | 70 | bool mMultipleViewsAtOnce; |
71 | bool mSearchWithReturn; | 71 | bool mSearchWithReturn; |
72 | QValueList<int> mExtensionsSplitter; | 72 | QValueList<int> mExtensionsSplitter; |
73 | QValueList<int> mDetailsSplitter; | 73 | QValueList<int> mDetailsSplitter; |
74 | 74 | ||
75 | // Extensions stuff | 75 | // Extensions stuff |
76 | int mCurrentExtension; | 76 | int mCurrentExtension; |
77 | QStringList mActiveExtensions; | 77 | QStringList mActiveExtensions; |
78 | 78 | ||
79 | // Views stuff | 79 | // Views stuff |
80 | QString mCurrentView; | 80 | QString mCurrentView; |
81 | QStringList mViewNames; | 81 | QStringList mViewNames; |
82 | 82 | ||
83 | // Filter | 83 | // Filter |
84 | int mCurrentFilter; | 84 | int mCurrentFilter; |
85 | 85 | ||
86 | void setCategoryDefaults(); | 86 | void setCategoryDefaults(); |
87 | QFont mDetailsFont; | 87 | QFont mDetailsFont; |
88 | 88 | ||
89 | private: | 89 | private: |
90 | KABPrefs(); | 90 | KABPrefs(); |
91 | 91 | ||
92 | QDict<QString> *mLocaleDict; | ||
93 | static KABPrefs *sInstance; | 92 | static KABPrefs *sInstance; |
94 | }; | 93 | }; |
95 | 94 | ||
96 | #endif | 95 | #endif |
diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h index a47642b..f0a4463 100644 --- a/kmicromail/koprefs.h +++ b/kmicromail/koprefs.h | |||
@@ -2,78 +2,76 @@ | |||
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 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 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | #include <qdict.h> | ||
27 | 26 | ||
28 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
29 | 28 | ||
30 | class KConfig; | 29 | class KConfig; |
31 | class QFont; | 30 | class QFont; |
32 | class QColor; | 31 | class QColor; |
33 | class QStringList; | 32 | class QStringList; |
34 | 33 | ||
35 | class KOPrefs : public KPimPrefs | 34 | class KOPrefs : public KPimPrefs |
36 | { | 35 | { |
37 | public: | 36 | public: |
38 | virtual ~KOPrefs(); | 37 | virtual ~KOPrefs(); |
39 | 38 | ||
40 | /** Get instance of KOPrefs. It is made sure that there is only one | 39 | /** Get instance of KOPrefs. It is made sure that there is only one |
41 | instance. */ | 40 | instance. */ |
42 | static KOPrefs *instance(); | 41 | static KOPrefs *instance(); |
43 | 42 | ||
44 | /** Set preferences to default values */ | 43 | /** Set preferences to default values */ |
45 | void usrSetDefaults(); | 44 | void usrSetDefaults(); |
46 | 45 | ||
47 | /** Read preferences from config file */ | 46 | /** Read preferences from config file */ |
48 | void usrReadConfig(); | 47 | void usrReadConfig(); |
49 | 48 | ||
50 | /** Write preferences to config file */ | 49 | /** Write preferences to config file */ |
51 | void usrWriteConfig(); | 50 | void usrWriteConfig(); |
52 | void setCategoryDefaults(){;}; | 51 | void setCategoryDefaults(){;}; |
53 | 52 | ||
54 | protected: | 53 | protected: |
55 | 54 | ||
56 | /** Fill empty mail fields with default values. */ | 55 | /** Fill empty mail fields with default values. */ |
57 | void fillMailDefaults(); | 56 | void fillMailDefaults(); |
58 | 57 | ||
59 | private: | 58 | private: |
60 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 59 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
61 | object. */ | 60 | object. */ |
62 | KOPrefs(); | 61 | KOPrefs(); |
63 | 62 | ||
64 | static KOPrefs *mInstance; | 63 | static KOPrefs *mInstance; |
65 | QDict<QString> *mLocaleDict; | ||
66 | public: | 64 | public: |
67 | // preferences data | 65 | // preferences data |
68 | KConfig* getConfig(); | 66 | KConfig* getConfig(); |
69 | QFont mAppFont; | 67 | QFont mAppFont; |
70 | QFont mComposeFont; | 68 | QFont mComposeFont; |
71 | QFont mReadFont; | 69 | QFont mReadFont; |
72 | QString mName; | 70 | QString mName; |
73 | QString mEmail; | 71 | QString mEmail; |
74 | bool mSendLater, mViewAsHtml, mUseKapi; | 72 | bool mSendLater, mViewAsHtml, mUseKapi; |
75 | private: | 73 | private: |
76 | 74 | ||
77 | }; | 75 | }; |
78 | 76 | ||
79 | #endif | 77 | #endif |
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp index 58198a2..db7c3f2 100644 --- a/korganizer/kodialogmanager.cpp +++ b/korganizer/kodialogmanager.cpp | |||
@@ -68,69 +68,68 @@ KODialogManager::~KODialogManager() | |||
68 | delete mFilterEditDialog; | 68 | delete mFilterEditDialog; |
69 | #ifndef KORG_NOPLUGINS | 69 | #ifndef KORG_NOPLUGINS |
70 | delete mPluginDialog; | 70 | delete mPluginDialog; |
71 | #endif | 71 | #endif |
72 | } | 72 | } |
73 | 73 | ||
74 | OutgoingDialog *KODialogManager::outgoingDialog() | 74 | OutgoingDialog *KODialogManager::outgoingDialog() |
75 | { | 75 | { |
76 | createOutgoingDialog(); | 76 | createOutgoingDialog(); |
77 | return mOutgoingDialog; | 77 | return mOutgoingDialog; |
78 | } | 78 | } |
79 | 79 | ||
80 | void KODialogManager::createOutgoingDialog() | 80 | void KODialogManager::createOutgoingDialog() |
81 | { | 81 | { |
82 | if (!mOutgoingDialog) { | 82 | if (!mOutgoingDialog) { |
83 | mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); | 83 | mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); |
84 | if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); | 84 | if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); |
85 | connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), | 85 | connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), |
86 | mMainView,SIGNAL(numOutgoingChanged(int))); | 86 | mMainView,SIGNAL(numOutgoingChanged(int))); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | void KODialogManager::showOptionsDialog( bool showSync ) | 90 | void KODialogManager::showOptionsDialog( bool showSync ) |
91 | { | 91 | { |
92 | int curLanguage = KOPrefs::instance()->mPreferredLanguage; | 92 | |
93 | if (!mOptionsDialog) { | 93 | if (!mOptionsDialog) { |
94 | mOptionsDialog = new KOPrefsDialog(mMainView); | 94 | mOptionsDialog = new KOPrefsDialog(mMainView); |
95 | //mOptionsDialog->readConfig(); | 95 | //mOptionsDialog->readConfig(); |
96 | connect(mOptionsDialog,SIGNAL(configChanged()), | 96 | connect(mOptionsDialog,SIGNAL(configChanged()), |
97 | mMainView,SLOT(updateConfig())); | 97 | mMainView,SLOT(updateConfig())); |
98 | //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), | 98 | //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), |
99 | // mOptionsDialog,SLOT(updateCategories())); | 99 | // mOptionsDialog,SLOT(updateCategories())); |
100 | 100 | ||
101 | } | 101 | } |
102 | mOptionsDialog->readConfig(); | 102 | mOptionsDialog->readConfig(); |
103 | #ifndef DESKTOP_VERSION | 103 | #ifndef DESKTOP_VERSION |
104 | mOptionsDialog->showMaximized(); | 104 | mOptionsDialog->showMaximized(); |
105 | #else | 105 | #else |
106 | mOptionsDialog->show(); | 106 | mOptionsDialog->show(); |
107 | #endif | 107 | #endif |
108 | if ( showSync ) | 108 | if ( showSync ) |
109 | mOptionsDialog->showSyncPage(); | 109 | mOptionsDialog->showSyncPage(); |
110 | mOptionsDialog->exec(); | 110 | mOptionsDialog->exec(); |
111 | if ( curLanguage != KOPrefs::instance()->mPreferredLanguage ) | 111 | |
112 | KOPrefs::instance()->mLanguageChanged = true; | ||
113 | } | 112 | } |
114 | void KODialogManager::showSyncOptions() | 113 | void KODialogManager::showSyncOptions() |
115 | { | 114 | { |
116 | showOptionsDialog( true ); | 115 | showOptionsDialog( true ); |
117 | 116 | ||
118 | } | 117 | } |
119 | void KODialogManager::showOutgoingDialog() | 118 | void KODialogManager::showOutgoingDialog() |
120 | { | 119 | { |
121 | createOutgoingDialog(); | 120 | createOutgoingDialog(); |
122 | mOutgoingDialog->show(); | 121 | mOutgoingDialog->show(); |
123 | mOutgoingDialog->raise(); | 122 | mOutgoingDialog->raise(); |
124 | } | 123 | } |
125 | 124 | ||
126 | IncomingDialog *KODialogManager::incomingDialog() | 125 | IncomingDialog *KODialogManager::incomingDialog() |
127 | { | 126 | { |
128 | createOutgoingDialog(); | 127 | createOutgoingDialog(); |
129 | if (!mIncomingDialog) { | 128 | if (!mIncomingDialog) { |
130 | mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); | 129 | mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); |
131 | connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), | 130 | connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), |
132 | mMainView,SIGNAL(numIncomingChanged(int))); | 131 | mMainView,SIGNAL(numIncomingChanged(int))); |
133 | connect(mIncomingDialog,SIGNAL(calendarUpdated()), | 132 | connect(mIncomingDialog,SIGNAL(calendarUpdated()), |
134 | mMainView,SLOT(updateView())); | 133 | mMainView,SLOT(updateView())); |
135 | } | 134 | } |
136 | return mIncomingDialog; | 135 | return mIncomingDialog; |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index ba1c6d1..f44debc 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -25,103 +25,97 @@ | |||
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kemailsettings.h> | 42 | #include <kemailsettings.h> |
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "mainwindow.h" | 47 | #include "mainwindow.h" |
48 | 48 | ||
49 | const char *germanwords[][2] = { | ||
50 | #include "wordsgerman.h" | ||
51 | "", "" | ||
52 | }; | ||
53 | |||
54 | KOPrefs *KOPrefs::mInstance = 0; | 49 | KOPrefs *KOPrefs::mInstance = 0; |
55 | static KStaticDeleter<KOPrefs> insd; | 50 | static KStaticDeleter<KOPrefs> insd; |
56 | 51 | ||
57 | KOPrefs::KOPrefs() : | 52 | KOPrefs::KOPrefs() : |
58 | KPimPrefs("korganizerrc") | 53 | KPimPrefs("korganizerrc") |
59 | { | 54 | { |
60 | mCategoryColors.setAutoDelete(true); | 55 | mCategoryColors.setAutoDelete(true); |
61 | mLocaleDict = 0; | ||
62 | fillMailDefaults(); | 56 | fillMailDefaults(); |
63 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 57 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
64 | QColor defaultHolidayColor = QColor(255,0,0); | 58 | QColor defaultHolidayColor = QColor(255,0,0); |
65 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 59 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
66 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 60 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
67 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 61 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
68 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 62 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
69 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 63 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
70 | 64 | ||
71 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); | 65 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); |
72 | mDefaultViewFont = QFont("helvetica",10); | 66 | mDefaultViewFont = QFont("helvetica",10); |
73 | mDefaultMonthViewFont = QFont("helvetica",8); | 67 | mDefaultMonthViewFont = QFont("helvetica",8); |
74 | mMarcusBainsFont= QFont("helvetica",10); | 68 | mMarcusBainsFont= QFont("helvetica",10); |
75 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | 69 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); |
76 | mEditBoxFont = QFont("helvetica",12); | 70 | mEditBoxFont = QFont("helvetica",12); |
77 | mJornalViewFont = QFont("helvetica",12); | 71 | mJornalViewFont = QFont("helvetica",12); |
78 | 72 | ||
79 | KPrefs::setCurrentGroup("General"); | 73 | KPrefs::setCurrentGroup("General"); |
80 | 74 | ||
81 | 75 | ||
82 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 76 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
83 | 77 | ||
84 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 78 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
85 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 79 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
86 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 80 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
87 | addItemBool("ShowIconList",&mShowIconList,true); | 81 | addItemBool("ShowIconList",&mShowIconList,true); |
88 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 82 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
89 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 83 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
90 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 84 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
91 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 85 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
92 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 86 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
93 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 87 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
94 | addItemBool("ShowIconBack",&mShowIconBack,true); | 88 | addItemBool("ShowIconBack",&mShowIconBack,true); |
95 | addItemBool("ShowIconToday",&mShowIconToday,true); | 89 | addItemBool("ShowIconToday",&mShowIconToday,true); |
96 | addItemBool("ShowIconForward",&mShowIconForward,true); | 90 | addItemBool("ShowIconForward",&mShowIconForward,true); |
97 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 91 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
98 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); | 92 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); |
99 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
100 | addItemBool("ShowIconNext",&mShowIconNext,true); | 94 | addItemBool("ShowIconNext",&mShowIconNext,true); |
101 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
102 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
103 | addItemBool("LanguageChanged",&mLanguageChanged,false); | 97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
104 | 98 | ||
105 | addItemBool("AskForQuit",&mAskForQuit,false); | 99 | addItemBool("AskForQuit",&mAskForQuit,false); |
106 | 100 | ||
107 | #ifndef DESKTOP_VERSION | 101 | #ifndef DESKTOP_VERSION |
108 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 102 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
109 | #else | 103 | #else |
110 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 104 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
111 | #endif | 105 | #endif |
112 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 106 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
113 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 107 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
114 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 108 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
115 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 109 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
116 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 110 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
117 | 111 | ||
118 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 112 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
119 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 113 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
120 | addItemInt("AllDay Size",&mAllDaySize,28); | 114 | addItemInt("AllDay Size",&mAllDaySize,28); |
121 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 115 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
122 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 116 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
123 | 117 | ||
124 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 118 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
125 | addItemStringList("EventSummary User",&mEventSummaryUser); | 119 | addItemStringList("EventSummary User",&mEventSummaryUser); |
126 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 120 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
127 | 121 | ||
@@ -183,55 +177,49 @@ KOPrefs::KOPrefs() : | |||
183 | // addItemBool("WriteBackFile",&mWriteBackFile,true); | 177 | // addItemBool("WriteBackFile",&mWriteBackFile,true); |
184 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); | 178 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); |
185 | // addItemBool("AskForPreferences",&mAskForPreferences,true); | 179 | // addItemBool("AskForPreferences",&mAskForPreferences,true); |
186 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | 180 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); |
187 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 181 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
188 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 182 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
189 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 183 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
190 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 184 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
191 | 185 | ||
192 | #ifdef _WIN32_ | 186 | #ifdef _WIN32_ |
193 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 187 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
194 | #else | 188 | #else |
195 | QString hdp= locateLocal("data","korganizer")+"/"; | 189 | QString hdp= locateLocal("data","korganizer")+"/"; |
196 | #endif | 190 | #endif |
197 | 191 | ||
198 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 192 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
199 | 193 | ||
200 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 194 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
201 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 195 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
202 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 196 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
203 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 197 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
204 | 198 | ||
205 | 199 | ||
206 | KPrefs::setCurrentGroup("Locale"); | 200 | KPrefs::setCurrentGroup("Locale"); |
207 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | ||
208 | addItemInt("PreferredTime",&mPreferredTime,0); | ||
209 | addItemInt("PreferredDate",&mPreferredDate,0); | ||
210 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | ||
211 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 201 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
212 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | ||
213 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | ||
214 | 202 | ||
215 | 203 | ||
216 | KPrefs::setCurrentGroup("Colors"); | 204 | KPrefs::setCurrentGroup("Colors"); |
217 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 205 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
218 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 206 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
219 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 207 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
220 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 208 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
221 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 209 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
222 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 210 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
223 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 211 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
224 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 212 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
225 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 213 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
226 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 214 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
227 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 215 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
228 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 216 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
229 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 217 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
230 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 218 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
231 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 219 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
232 | addItemBool("UseAppColors",&mUseAppColors,false); | 220 | addItemBool("UseAppColors",&mUseAppColors,false); |
233 | 221 | ||
234 | 222 | ||
235 | 223 | ||
236 | KPrefs::setCurrentGroup("Views"); | 224 | KPrefs::setCurrentGroup("Views"); |
237 | addItemInt("Hour Size",&mHourSize,8); | 225 | addItemInt("Hour Size",&mHourSize,8); |
@@ -295,51 +283,49 @@ KOPrefs::KOPrefs() : | |||
295 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 283 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
296 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 284 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
297 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 285 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
298 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 286 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
299 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 287 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
300 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 288 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
301 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 289 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
302 | 290 | ||
303 | KPrefs::setCurrentGroup( "Editors" ); | 291 | KPrefs::setCurrentGroup( "Editors" ); |
304 | 292 | ||
305 | addItemStringList( "EventTemplates", &mEventTemplates ); | 293 | addItemStringList( "EventTemplates", &mEventTemplates ); |
306 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 294 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
307 | 295 | ||
308 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 296 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
309 | 297 | ||
310 | 298 | ||
311 | 299 | ||
312 | } | 300 | } |
313 | 301 | ||
314 | 302 | ||
315 | KOPrefs::~KOPrefs() | 303 | KOPrefs::~KOPrefs() |
316 | { | 304 | { |
317 | if (mInstance == this) | 305 | if (mInstance == this) |
318 | mInstance = insd.setObject(0); | 306 | mInstance = insd.setObject(0); |
319 | setLocaleDict( 0 ); | 307 | |
320 | if ( mLocaleDict ) | ||
321 | delete mLocaleDict; | ||
322 | //qDebug("KOPrefs::~KOPrefs() "); | 308 | //qDebug("KOPrefs::~KOPrefs() "); |
323 | } | 309 | } |
324 | 310 | ||
325 | 311 | ||
326 | KOPrefs *KOPrefs::instance() | 312 | KOPrefs *KOPrefs::instance() |
327 | { | 313 | { |
328 | if (!mInstance) { | 314 | if (!mInstance) { |
329 | mInstance = insd.setObject(new KOPrefs()); | 315 | mInstance = insd.setObject(new KOPrefs()); |
330 | mInstance->readConfig(); | 316 | mInstance->readConfig(); |
331 | } | 317 | } |
332 | 318 | ||
333 | return mInstance; | 319 | return mInstance; |
334 | } | 320 | } |
335 | 321 | ||
336 | void KOPrefs::usrSetDefaults() | 322 | void KOPrefs::usrSetDefaults() |
337 | { | 323 | { |
338 | 324 | ||
339 | } | 325 | } |
340 | 326 | ||
341 | void KOPrefs::fillMailDefaults() | 327 | void KOPrefs::fillMailDefaults() |
342 | { | 328 | { |
343 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 329 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
344 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 330 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
345 | } | 331 | } |
@@ -356,122 +342,58 @@ void KOPrefs::setCategoryDefaults() | |||
356 | 342 | ||
357 | QStringList::Iterator it; | 343 | QStringList::Iterator it; |
358 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 344 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
359 | setCategoryColor(*it,mDefaultCategoryColor); | 345 | setCategoryColor(*it,mDefaultCategoryColor); |
360 | } | 346 | } |
361 | } | 347 | } |
362 | 348 | ||
363 | QStringList KOPrefs::getDefaultList() | 349 | QStringList KOPrefs::getDefaultList() |
364 | { | 350 | { |
365 | QStringList retval ; | 351 | QStringList retval ; |
366 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 352 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
367 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 353 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
368 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 354 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
369 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 355 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
370 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 356 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
371 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 357 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
372 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 358 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
373 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 359 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
374 | retval.sort(); | 360 | retval.sort(); |
375 | return retval; | 361 | return retval; |
376 | } | 362 | } |
377 | 363 | ||
378 | void KOPrefs::usrReadConfig() | 364 | void KOPrefs::usrReadConfig() |
379 | { | 365 | { |
380 | mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | ||
381 | mLocaleDict = 0; | ||
382 | // pending LR fix translation | ||
383 | // qDebug("KOPrefs::usrReadConfig() fix translation "); | ||
384 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { | ||
385 | if ( mPreferredLanguage == 1 ) { | ||
386 | mLocaleDict = new QDict<QString>; | ||
387 | int i = 0; | ||
388 | QString fw ( germanwords[i] [0]); | ||
389 | while ( !fw.isEmpty() ) { | ||
390 | mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); | ||
391 | ++i; | ||
392 | fw = germanwords[i] [0]; | ||
393 | } | ||
394 | |||
395 | setLocaleDict( mLocaleDict ); | ||
396 | } else { | ||
397 | QString fileName ; | ||
398 | if ( mPreferredLanguage == 4 ) | ||
399 | fileName = MainWindow::resourcePath()+"usertranslation.txt"; | ||
400 | else if ( mPreferredLanguage == 2 ) | ||
401 | fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; | ||
402 | else if ( mPreferredLanguage == 3 ) | ||
403 | fileName = MainWindow::resourcePath()+"italiantranslation.txt"; | ||
404 | QFile file( fileName ); | ||
405 | if (file.open( IO_ReadOnly ) ) { | ||
406 | QTextStream ts( &file ); | ||
407 | ts.setEncoding( QTextStream::Latin1 ); | ||
408 | //ts.setCodec( QTextCodec::latin1 ); | ||
409 | QString text = ts.read(); | ||
410 | file.close(); | ||
411 | text.replace( QRegExp("\\\\n"), "\n" ); | ||
412 | QString line; | ||
413 | QString we; | ||
414 | QString wt; | ||
415 | int br = 0; | ||
416 | int nbr; | ||
417 | nbr = text.find ( "},", br ); | ||
418 | line = text.mid( br, nbr - br ); | ||
419 | br = nbr+1; | ||
420 | int se, ee, st, et; | ||
421 | mLocaleDict = new QDict<QString>; | ||
422 | QString end = "{ \"\",\"\" }"; | ||
423 | while ( (line != end) && (br > 1) ) { | ||
424 | //qDebug("%d *%s* ", br, line.latin1()); | ||
425 | se = line.find("\"")+1; | ||
426 | et = line.findRev("\"",-1); | ||
427 | ee = line.find("\",\""); | ||
428 | st = ee+3; | ||
429 | we = line.mid( se, ee-se ); | ||
430 | wt = line.mid( st, et-st ); | ||
431 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | ||
432 | mLocaleDict->insert( we, new QString (wt) ); | ||
433 | nbr = text.find ( "}", br ); | ||
434 | line = text.mid( br, nbr - br ); | ||
435 | br = nbr+1; | ||
436 | } | ||
437 | //qDebug("end *%s* ", end.latin1()); | ||
438 | |||
439 | setLocaleDict( mLocaleDict ); | ||
440 | } else { | ||
441 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | ||
442 | } | ||
443 | |||
444 | } | ||
445 | } | ||
446 | config()->setGroup("General"); | 366 | config()->setGroup("General"); |
447 | 367 | ||
448 | mCustomCategories = config()->readListEntry("Custom Categories"); | 368 | mCustomCategories = config()->readListEntry("Custom Categories"); |
449 | if ( KOPrefs::instance()->mLanguageChanged ) { | 369 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { |
450 | mLocationDefaults.clear(); | 370 | mLocationDefaults.clear(); |
451 | mEventSummaryUser.clear(); | 371 | mEventSummaryUser.clear(); |
452 | mTodoSummaryUser.clear(); | 372 | mTodoSummaryUser.clear(); |
453 | } | 373 | } |
374 | mOldLoadedLanguage = mOldLanguage ; | ||
375 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | ||
454 | if (mLocationDefaults.isEmpty()) { | 376 | if (mLocationDefaults.isEmpty()) { |
455 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 377 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
456 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 378 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
457 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 379 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
458 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 380 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
459 | mLocationDefaults.sort(); | 381 | mLocationDefaults.sort(); |
460 | } | 382 | } |
461 | 383 | ||
462 | if (mEventSummaryUser.isEmpty()) { | 384 | if (mEventSummaryUser.isEmpty()) { |
463 | mEventSummaryUser = getDefaultList() ; | 385 | mEventSummaryUser = getDefaultList() ; |
464 | } | 386 | } |
465 | if (mTodoSummaryUser.isEmpty()) { | 387 | if (mTodoSummaryUser.isEmpty()) { |
466 | mTodoSummaryUser = getDefaultList() ; | 388 | mTodoSummaryUser = getDefaultList() ; |
467 | } | 389 | } |
468 | 390 | ||
469 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 391 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
470 | 392 | ||
471 | config()->setGroup("Personal Settings"); | 393 | config()->setGroup("Personal Settings"); |
472 | mName = config()->readEntry("user_name",""); | 394 | mName = config()->readEntry("user_name",""); |
473 | mEmail = config()->readEntry("user_email",""); | 395 | mEmail = config()->readEntry("user_email",""); |
474 | fillMailDefaults(); | 396 | fillMailDefaults(); |
475 | 397 | ||
476 | config()->setGroup("Category Colors"); | 398 | config()->setGroup("Category Colors"); |
477 | QStringList::Iterator it; | 399 | QStringList::Iterator it; |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index c74b0ef..0656644 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -2,96 +2,95 @@ | |||
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 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 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | #include <qdict.h> | ||
27 | 26 | ||
28 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | ||
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | class QFont; | 31 | class QFont; |
32 | class QColor; | 32 | class QColor; |
33 | class QStringList; | 33 | class QStringList; |
34 | 34 | ||
35 | class KOPrefs : public KPimPrefs | 35 | class KOPrefs : public KPimPrefs |
36 | { | 36 | { |
37 | public: | 37 | public: |
38 | enum { FormatVCalendar, FormatICalendar }; | 38 | enum { FormatVCalendar, FormatICalendar }; |
39 | enum { MailClientKMail, MailClientSendmail }; | 39 | enum { MailClientKMail, MailClientSendmail }; |
40 | enum { IMIPDummy, IMIPKMail }; | 40 | enum { IMIPDummy, IMIPKMail }; |
41 | enum { IMIPOutbox, IMIPdirectsend }; | 41 | enum { IMIPOutbox, IMIPdirectsend }; |
42 | enum { neverAuto, addressbookAuto, selectedAuto }; | 42 | enum { neverAuto, addressbookAuto, selectedAuto }; |
43 | enum { standardDestination, askDestination }; | 43 | enum { standardDestination, askDestination }; |
44 | 44 | ||
45 | virtual ~KOPrefs(); | 45 | virtual ~KOPrefs(); |
46 | 46 | ||
47 | /** Get instance of KOPrefs. It is made sure that there is only one | 47 | /** Get instance of KOPrefs. It is made sure that there is only one |
48 | instance. */ | 48 | instance. */ |
49 | static KOPrefs *instance(); | 49 | static KOPrefs *instance(); |
50 | 50 | ||
51 | /** Set preferences to default values */ | 51 | /** Set preferences to default values */ |
52 | void usrSetDefaults(); | 52 | void usrSetDefaults(); |
53 | 53 | ||
54 | /** Read preferences from config file */ | 54 | /** Read preferences from config file */ |
55 | void usrReadConfig(); | 55 | void usrReadConfig(); |
56 | 56 | ||
57 | /** Write preferences to config file */ | 57 | /** Write preferences to config file */ |
58 | void usrWriteConfig(); | 58 | void usrWriteConfig(); |
59 | void setCategoryDefaults(); | 59 | void setCategoryDefaults(); |
60 | 60 | ||
61 | protected: | 61 | protected: |
62 | void setTimeZoneIdDefault(); | 62 | void setTimeZoneIdDefault(); |
63 | 63 | ||
64 | /** Fill empty mail fields with default values. */ | 64 | /** Fill empty mail fields with default values. */ |
65 | void fillMailDefaults(); | 65 | void fillMailDefaults(); |
66 | 66 | ||
67 | private: | 67 | private: |
68 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 68 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
69 | object. */ | 69 | object. */ |
70 | KOPrefs(); | 70 | KOPrefs(); |
71 | 71 | ||
72 | static KOPrefs *mInstance; | 72 | static KOPrefs *mInstance; |
73 | QDict<QString> *mLocaleDict; | ||
74 | QStringList getDefaultList(); | 73 | QStringList getDefaultList(); |
75 | public: | 74 | public: |
76 | // preferences data | 75 | // preferences data |
77 | KConfig* getConfig(); | 76 | KConfig* getConfig(); |
78 | void setFullName(const QString &); | 77 | void setFullName(const QString &); |
79 | QString fullName(); | 78 | QString fullName(); |
80 | void setEmail(const QString &); | 79 | void setEmail(const QString &); |
81 | QString email(); | 80 | QString email(); |
82 | 81 | ||
83 | QString mAdditional; | 82 | QString mAdditional; |
84 | 83 | ||
85 | bool mEmailControlCenter; | 84 | bool mEmailControlCenter; |
86 | 85 | ||
87 | bool mBcc; | 86 | bool mBcc; |
88 | bool mAutoSave; | 87 | bool mAutoSave; |
89 | int mAutoSaveInterval; | 88 | int mAutoSaveInterval; |
90 | bool mConfirm; | 89 | bool mConfirm; |
91 | 90 | ||
92 | bool mEnableGroupScheduling; | 91 | bool mEnableGroupScheduling; |
93 | bool mEnableProjectView; | 92 | bool mEnableProjectView; |
94 | 93 | ||
95 | int mDefaultFormat; | 94 | int mDefaultFormat; |
96 | int mMailClient; | 95 | int mMailClient; |
97 | 96 | ||
@@ -137,49 +136,48 @@ class KOPrefs : public KPimPrefs | |||
137 | QColor mAppColor2; | 136 | QColor mAppColor2; |
138 | bool mUseAppColors; | 137 | bool mUseAppColors; |
139 | 138 | ||
140 | int mDayBegins; | 139 | int mDayBegins; |
141 | int mHourSize; | 140 | int mHourSize; |
142 | int mAllDaySize; | 141 | int mAllDaySize; |
143 | bool mShowFullMenu; | 142 | bool mShowFullMenu; |
144 | bool mDailyRecur; | 143 | bool mDailyRecur; |
145 | bool mWeeklyRecur; | 144 | bool mWeeklyRecur; |
146 | bool mMonthDailyRecur; | 145 | bool mMonthDailyRecur; |
147 | bool mMonthWeeklyRecur; | 146 | bool mMonthWeeklyRecur; |
148 | bool mMonthShowIcons; | 147 | bool mMonthShowIcons; |
149 | bool mMonthShowShort; | 148 | bool mMonthShowShort; |
150 | bool mEnableToolTips; | 149 | bool mEnableToolTips; |
151 | bool mEnableMonthScroll; | 150 | bool mEnableMonthScroll; |
152 | bool mFullViewMonth; | 151 | bool mFullViewMonth; |
153 | bool mMonthViewUsesCategoryColor; | 152 | bool mMonthViewUsesCategoryColor; |
154 | bool mFullViewTodo; | 153 | bool mFullViewTodo; |
155 | bool mShowCompletedTodo; | 154 | bool mShowCompletedTodo; |
156 | bool mMarcusBainsEnabled; | 155 | bool mMarcusBainsEnabled; |
157 | int mNextXDays; | 156 | int mNextXDays; |
158 | int mWhatsNextDays; | 157 | int mWhatsNextDays; |
159 | int mWhatsNextPrios; | 158 | int mWhatsNextPrios; |
160 | bool mEnableQuickTodo; | 159 | bool mEnableQuickTodo; |
161 | bool mLanguageChanged; | ||
162 | 160 | ||
163 | bool mCompactDialogs; | 161 | bool mCompactDialogs; |
164 | bool mVerticalScreen; | 162 | bool mVerticalScreen; |
165 | 163 | ||
166 | bool mShowIconNewTodo; | 164 | bool mShowIconNewTodo; |
167 | bool mShowIconNewEvent; | 165 | bool mShowIconNewEvent; |
168 | bool mShowIconSearch; | 166 | bool mShowIconSearch; |
169 | bool mShowIconList; | 167 | bool mShowIconList; |
170 | bool mShowIconDay1; | 168 | bool mShowIconDay1; |
171 | bool mShowIconDay5; | 169 | bool mShowIconDay5; |
172 | bool mShowIconDay7; | 170 | bool mShowIconDay7; |
173 | bool mShowIconMonth; | 171 | bool mShowIconMonth; |
174 | bool mShowIconTodoview; | 172 | bool mShowIconTodoview; |
175 | bool mShowIconBackFast; | 173 | bool mShowIconBackFast; |
176 | bool mShowIconBack; | 174 | bool mShowIconBack; |
177 | bool mShowIconToday; | 175 | bool mShowIconToday; |
178 | bool mShowIconForward; | 176 | bool mShowIconForward; |
179 | bool mShowIconForwardFast; | 177 | bool mShowIconForwardFast; |
180 | bool mShowIconWhatsThis; | 178 | bool mShowIconWhatsThis; |
181 | bool mShowIconNextDays; | 179 | bool mShowIconNextDays; |
182 | bool mShowIconNext; | 180 | bool mShowIconNext; |
183 | bool mShowIconJournal; | 181 | bool mShowIconJournal; |
184 | 182 | ||
185 | bool mShowIconStretch; | 183 | bool mShowIconStretch; |
@@ -232,52 +230,44 @@ class KOPrefs : public KPimPrefs | |||
232 | bool mSetTimeToDayStartAt; | 230 | bool mSetTimeToDayStartAt; |
233 | bool mHighlightCurrentDay; | 231 | bool mHighlightCurrentDay; |
234 | bool mUseHighlightLightColor; | 232 | bool mUseHighlightLightColor; |
235 | bool mListViewMonthTimespan; | 233 | bool mListViewMonthTimespan; |
236 | bool mWNViewShowsParents; | 234 | bool mWNViewShowsParents; |
237 | bool mWNViewShowLocation; | 235 | bool mWNViewShowLocation; |
238 | bool mTodoViewShowsPercentage; | 236 | bool mTodoViewShowsPercentage; |
239 | bool mTodoViewUsesCatColors; | 237 | bool mTodoViewUsesCatColors; |
240 | bool mTodoViewUsesSmallFont; | 238 | bool mTodoViewUsesSmallFont; |
241 | bool mTodoViewUsesForegroundColor; | 239 | bool mTodoViewUsesForegroundColor; |
242 | bool mMonthViewUsesForegroundColor; | 240 | bool mMonthViewUsesForegroundColor; |
243 | 241 | ||
244 | bool mHightlightDateTimeEdit; | 242 | bool mHightlightDateTimeEdit; |
245 | bool mShortDateInViewer; | 243 | bool mShortDateInViewer; |
246 | 244 | ||
247 | QStringList mLocationDefaults; | 245 | QStringList mLocationDefaults; |
248 | QStringList mEventSummaryUser; | 246 | QStringList mEventSummaryUser; |
249 | QStringList mTodoSummaryUser; | 247 | QStringList mTodoSummaryUser; |
250 | 248 | ||
251 | bool mUseInternalAlarmNotification; | 249 | bool mUseInternalAlarmNotification; |
252 | int mAlarmPlayBeeps; | 250 | int mAlarmPlayBeeps; |
253 | int mAlarmSuspendTime; | 251 | int mAlarmSuspendTime; |
254 | int mAlarmSuspendCount; | 252 | int mAlarmSuspendCount; |
255 | int mAlarmBeepInterval; | 253 | int mAlarmBeepInterval; |
254 | int mOldLanguage; | ||
255 | int mOldLoadedLanguage; | ||
256 | 256 | ||
257 | 257 | ||
258 | QString mActiveSyncPort; | 258 | QString mActiveSyncPort; |
259 | QString mActiveSyncIP; | 259 | QString mActiveSyncIP; |
260 | 260 | ||
261 | |||
262 | //US I copied the following settings into KPimGlobalPrefs | ||
263 | // that allows us later to easily remove the settings from here. | ||
264 | int mPreferredDate; | ||
265 | QString mUserDateFormatLong; | ||
266 | QString mUserDateFormatShort; | ||
267 | int mPreferredLanguage; | ||
268 | int mPreferredTime; | ||
269 | bool mWeekStartsOnSunday; | ||
270 | |||
271 | private: | 261 | private: |
272 | QDict<QColor> mCategoryColors; | 262 | QDict<QColor> mCategoryColors; |
273 | QColor mDefaultCategoryColor; | 263 | QColor mDefaultCategoryColor; |
274 | 264 | ||
275 | QFont mDefaultTimeBarFont; | 265 | QFont mDefaultTimeBarFont; |
276 | QFont mDefaultViewFont; | 266 | QFont mDefaultViewFont; |
277 | QFont mDefaultMonthViewFont; | 267 | QFont mDefaultMonthViewFont; |
278 | 268 | ||
279 | QString mName; | 269 | QString mName; |
280 | QString mEmail; | 270 | QString mEmail; |
281 | }; | 271 | }; |
282 | 272 | ||
283 | #endif | 273 | #endif |
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp index cf07a1a..f5a1c50 100644 --- a/korganizer/ktimeedit.cpp +++ b/korganizer/ktimeedit.cpp | |||
@@ -10,48 +10,49 @@ | |||
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 | #include <qkeycode.h> | 24 | #include <qkeycode.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qdatetime.h> | 26 | #include <qdatetime.h> |
27 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
28 | #include <qapplication.h> | 28 | #include <qapplication.h> |
29 | 29 | ||
30 | #include <kmessagebox.h> | 30 | #include <kmessagebox.h> |
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kpimglobalprefs.h> | ||
34 | 35 | ||
35 | #include "ktimeedit.h" | 36 | #include "ktimeedit.h" |
36 | #include "koprefs.h" | 37 | #include "koprefs.h" |
37 | #include <qvalidator.h> | 38 | #include <qvalidator.h> |
38 | 39 | ||
39 | // Validator for a time value with only hours and minutes (no seconds) | 40 | // Validator for a time value with only hours and minutes (no seconds) |
40 | // Mostly locale aware. Author: David Faure <faure@kde.org> | 41 | // Mostly locale aware. Author: David Faure <faure@kde.org> |
41 | class KOTimeValidator : public QValidator | 42 | class KOTimeValidator : public QValidator |
42 | { | 43 | { |
43 | public: | 44 | public: |
44 | KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {} | 45 | KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {} |
45 | 46 | ||
46 | virtual State validate(QString& str, int& /*cursorPos*/) const | 47 | virtual State validate(QString& str, int& /*cursorPos*/) const |
47 | { | 48 | { |
48 | return Acceptable; | 49 | return Acceptable; |
49 | bool ok = false; | 50 | bool ok = false; |
50 | // TODO use KLocale::WithoutSeconds in HEAD | 51 | // TODO use KLocale::WithoutSeconds in HEAD |
51 | /*QTime time =*/ KGlobal::locale()->readTime(str, &ok); | 52 | /*QTime time =*/ KGlobal::locale()->readTime(str, &ok); |
52 | if ( ok ) | 53 | if ( ok ) |
53 | return Acceptable; | 54 | return Acceptable; |
54 | // readTime doesn't help knowing when the string is "Intermediate". | 55 | // readTime doesn't help knowing when the string is "Intermediate". |
55 | int length = str.length(); | 56 | int length = str.length(); |
56 | if ( !str ) // empty string? | 57 | if ( !str ) // empty string? |
57 | return Invalid; // there should always be a ':' in it, right? | 58 | return Invalid; // there should always be a ':' in it, right? |
@@ -90,49 +91,49 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) | |||
90 | if ( QApplication::desktop()->width() < 650 ) | 91 | if ( QApplication::desktop()->width() < 650 ) |
91 | setSizeLimit ( 6 ); | 92 | setSizeLimit ( 6 ); |
92 | mTime = qt; | 93 | mTime = qt; |
93 | 94 | ||
94 | // mNoTimeString = i18n("No Time"); | 95 | // mNoTimeString = i18n("No Time"); |
95 | // insertItem( mNoTimeString ); | 96 | // insertItem( mNoTimeString ); |
96 | 97 | ||
97 | // Fill combo box with selection of times in localized format. | 98 | // Fill combo box with selection of times in localized format. |
98 | QTime timeEntry(0,0,0); | 99 | QTime timeEntry(0,0,0); |
99 | do { | 100 | do { |
100 | insertItem(KGlobal::locale()->formatTime(timeEntry)); | 101 | insertItem(KGlobal::locale()->formatTime(timeEntry)); |
101 | timeEntry = timeEntry.addSecs(60*15); | 102 | timeEntry = timeEntry.addSecs(60*15); |
102 | } while (!timeEntry.isNull()); | 103 | } while (!timeEntry.isNull()); |
103 | // Add end of day. | 104 | // Add end of day. |
104 | insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); | 105 | insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); |
105 | 106 | ||
106 | updateText(); | 107 | updateText(); |
107 | setFocusPolicy(QWidget::StrongFocus); | 108 | setFocusPolicy(QWidget::StrongFocus); |
108 | 109 | ||
109 | connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); | 110 | connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); |
110 | connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); | 111 | connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); |
111 | connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); | 112 | connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); |
112 | QFontMetrics fm ( font() ); | 113 | QFontMetrics fm ( font() ); |
113 | QString timeString = "24:00"; | 114 | QString timeString = "24:00"; |
114 | if ( KOPrefs::instance()->mPreferredTime == 1 ) | 115 | if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ) |
115 | timeString = "02:00pm"; | 116 | timeString = "02:00pm"; |
116 | int addSpace = 32; | 117 | int addSpace = 32; |
117 | if ( QApplication::desktop()->width() > 320 ) | 118 | if ( QApplication::desktop()->width() > 320 ) |
118 | timeString += ":00"; | 119 | timeString += ":00"; |
119 | setFixedWidth(fm.width( timeString ) + 32 ); | 120 | setFixedWidth(fm.width( timeString ) + 32 ); |
120 | 121 | ||
121 | // Highlight Background and Textcolor change from default | 122 | // Highlight Background and Textcolor change from default |
122 | QPalette palette = QWidget::palette(); | 123 | QPalette palette = QWidget::palette(); |
123 | unsigned char red, green, blue; | 124 | unsigned char red, green, blue; |
124 | red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; | 125 | red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; |
125 | green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; | 126 | green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; |
126 | blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; | 127 | blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; |
127 | palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); | 128 | palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); |
128 | palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); | 129 | palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); |
129 | setPalette( palette ); | 130 | setPalette( palette ); |
130 | } | 131 | } |
131 | 132 | ||
132 | KOTimeEdit::~KOTimeEdit() | 133 | KOTimeEdit::~KOTimeEdit() |
133 | { | 134 | { |
134 | } | 135 | } |
135 | 136 | ||
136 | bool KOTimeEdit::hasTime() const | 137 | bool KOTimeEdit::hasTime() const |
137 | { | 138 | { |
138 | // Can't happen | 139 | // Can't happen |
@@ -217,49 +218,49 @@ void KOTimeEdit::subTime(QTime qt, bool update) | |||
217 | 218 | ||
218 | // void KOTimeEdit::focusInEvent ( QFocusEvent * ) | 219 | // void KOTimeEdit::focusInEvent ( QFocusEvent * ) |
219 | // { | 220 | // { |
220 | // qDebug("focusInEvent ( QFocusEvent * ) "); | 221 | // qDebug("focusInEvent ( QFocusEvent * ) "); |
221 | // } | 222 | // } |
222 | 223 | ||
223 | void KOTimeEdit::keyReleaseEvent(QKeyEvent *e) | 224 | void KOTimeEdit::keyReleaseEvent(QKeyEvent *e) |
224 | { | 225 | { |
225 | if ( !e->isAutoRepeat() ) { | 226 | if ( !e->isAutoRepeat() ) { |
226 | mFlagKeyPressed = false; | 227 | mFlagKeyPressed = false; |
227 | } | 228 | } |
228 | 229 | ||
229 | } | 230 | } |
230 | void KOTimeEdit::setSelect( int from, int to ) | 231 | void KOTimeEdit::setSelect( int from, int to ) |
231 | { | 232 | { |
232 | if ( KOPrefs::instance()->mHightlightDateTimeEdit) | 233 | if ( KOPrefs::instance()->mHightlightDateTimeEdit) |
233 | lineEdit()->setSelection( from , to ); | 234 | lineEdit()->setSelection( from , to ); |
234 | } | 235 | } |
235 | 236 | ||
236 | 237 | ||
237 | void KOTimeEdit::keyPressEvent(QKeyEvent *e) | 238 | void KOTimeEdit::keyPressEvent(QKeyEvent *e) |
238 | { | 239 | { |
239 | 240 | ||
240 | qApp->processEvents(); | 241 | qApp->processEvents(); |
241 | bool hour12Format = ( KOPrefs::instance()->mPreferredTime == 1 ); | 242 | bool hour12Format = ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ); |
242 | int maxpos = hour12Format?7:5; | 243 | int maxpos = hour12Format?7:5; |
243 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 244 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
244 | e->ignore(); | 245 | e->ignore(); |
245 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 246 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
246 | return; | 247 | return; |
247 | } | 248 | } |
248 | if (! e->isAutoRepeat() ) { | 249 | if (! e->isAutoRepeat() ) { |
249 | mFlagKeyPressed = true; | 250 | mFlagKeyPressed = true; |
250 | } | 251 | } |
251 | // Tap -> Focus Next Widget | 252 | // Tap -> Focus Next Widget |
252 | if ( e->key() == Key_Tab ) { | 253 | if ( e->key() == Key_Tab ) { |
253 | QComboBox::keyPressEvent(e); | 254 | QComboBox::keyPressEvent(e); |
254 | return; | 255 | return; |
255 | } | 256 | } |
256 | 257 | ||
257 | // save Text from QLineEdit and CursorPosition | 258 | // save Text from QLineEdit and CursorPosition |
258 | QString text = lineEdit()->text(); | 259 | QString text = lineEdit()->text(); |
259 | int cpos = lineEdit()->cursorPosition(); | 260 | int cpos = lineEdit()->cursorPosition(); |
260 | // qDebug("cpos %d ", cpos); | 261 | // qDebug("cpos %d ", cpos); |
261 | 262 | ||
262 | // Switch for arrows, backspace and escape | 263 | // Switch for arrows, backspace and escape |
263 | switch(e->key()) { | 264 | switch(e->key()) { |
264 | case Key_Escape: | 265 | case Key_Escape: |
265 | lineEdit()->deselect(); | 266 | lineEdit()->deselect(); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index fbfcd20..dc2026b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -204,52 +204,51 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
204 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 204 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
205 | finfo.setFile( oldFile ); | 205 | finfo.setFile( oldFile ); |
206 | if (finfo.exists() ) { | 206 | if (finfo.exists() ) { |
207 | KMessageBox::information( this, message); | 207 | KMessageBox::information( this, message); |
208 | mView->openCalendar( oldFile ); | 208 | mView->openCalendar( oldFile ); |
209 | qApp->processEvents(); | 209 | qApp->processEvents(); |
210 | } else { | 210 | } else { |
211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
212 | finfo.setFile( oldFile ); | 212 | finfo.setFile( oldFile ); |
213 | if (finfo.exists() ) { | 213 | if (finfo.exists() ) { |
214 | KMessageBox::information( this, message); | 214 | KMessageBox::information( this, message); |
215 | mView->openCalendar( oldFile ); | 215 | mView->openCalendar( oldFile ); |
216 | qApp->processEvents(); | 216 | qApp->processEvents(); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | mView->saveCalendar( defaultFileName() ); | 219 | mView->saveCalendar( defaultFileName() ); |
220 | newFile = true; | 220 | newFile = true; |
221 | } | 221 | } |
222 | 222 | ||
223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
224 | mView->openCalendar( defaultFileName() ); | 224 | mView->openCalendar( defaultFileName() ); |
225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
227 | 227 | ||
228 | if ( KOPrefs::instance()->mLanguageChanged ) { | 228 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
229 | KOPrefs::instance()->setCategoryDefaults(); | 229 | KOPrefs::instance()->setCategoryDefaults(); |
230 | int count = mView->addCategories(); | 230 | int count = mView->addCategories(); |
231 | KOPrefs::instance()->mLanguageChanged = false; | ||
232 | } | 231 | } |
233 | processIncidenceSelection( 0 ); | 232 | processIncidenceSelection( 0 ); |
234 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 233 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
235 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 234 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
236 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 235 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
237 | SLOT( slotModifiedChanged( bool ) ) ); | 236 | SLOT( slotModifiedChanged( bool ) ) ); |
238 | 237 | ||
239 | 238 | ||
240 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 239 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
241 | SLOT( disableBR(bool) ) ); | 240 | SLOT( disableBR(bool) ) ); |
242 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 241 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
243 | mView->setModified( false ); | 242 | mView->setModified( false ); |
244 | mBlockAtStartup = false; | 243 | mBlockAtStartup = false; |
245 | mView->setModified( false ); | 244 | mView->setModified( false ); |
246 | setCentralWidget( mView ); | 245 | setCentralWidget( mView ); |
247 | globalFlagBlockStartup = 0; | 246 | globalFlagBlockStartup = 0; |
248 | mView->show(); | 247 | mView->show(); |
249 | delete splash; | 248 | delete splash; |
250 | if ( newFile ) | 249 | if ( newFile ) |
251 | mView->updateConfig(); | 250 | mView->updateConfig(); |
252 | // qApp->processEvents(); | 251 | // qApp->processEvents(); |
253 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 252 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
254 | //fillSyncMenu(); | 253 | //fillSyncMenu(); |
255 | 254 | ||
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index 0a580ca..5298f0c 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -14,58 +14,61 @@ | |||
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 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (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 <qregexp.h> | 37 | #include <qregexp.h> |
38 | #include <qfile.h> | ||
39 | #include <qtextstream.h> | ||
40 | #include <qapplication.h> | ||
38 | #include "kpimglobalprefs.h" | 41 | #include "kpimglobalprefs.h" |
39 | 42 | ||
40 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; | 43 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; |
41 | static KStaticDeleter<KPimGlobalPrefs> staticDeleter; | 44 | static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; |
42 | 45 | ||
43 | 46 | ||
44 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) | 47 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) |
45 | : KPrefs("microkdeglobalrc") | 48 | : KPrefs("microkdeglobalrc") |
46 | { | 49 | { |
47 | 50 | mLocaleDict = 0; | |
48 | KPrefs::setCurrentGroup("Locale"); | 51 | KPrefs::setCurrentGroup("Locale"); |
49 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 52 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
50 | addItemInt("PreferredTime",&mPreferredTime,0); | 53 | addItemInt("PreferredTime",&mPreferredTime,0); |
51 | addItemInt("PreferredDate",&mPreferredDate,0); | 54 | addItemInt("PreferredDate",&mPreferredDate,0); |
52 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 55 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
53 | //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); | 56 | //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); |
54 | // addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 57 | // addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
55 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | 58 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); |
56 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 59 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
57 | 60 | ||
58 | KPrefs::setCurrentGroup("Time & Date"); | 61 | KPrefs::setCurrentGroup("Time & Date"); |
59 | 62 | ||
60 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); | 63 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); |
61 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 64 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
62 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); | 65 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); |
63 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 66 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
64 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 67 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
65 | 68 | ||
66 | KPrefs::setCurrentGroup( "ExternalApplications" ); | 69 | KPrefs::setCurrentGroup( "ExternalApplications" ); |
67 | 70 | ||
68 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); | 71 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); |
69 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); | 72 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); |
70 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); | 73 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); |
71 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); | 74 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); |
@@ -83,57 +86,122 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) | |||
83 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); | 86 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); |
84 | 87 | ||
85 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); | 88 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); |
86 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); | 89 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); |
87 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); | 90 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); |
88 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); | 91 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); |
89 | 92 | ||
90 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); | 93 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); |
91 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); | 94 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); |
92 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); | 95 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); |
93 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); | 96 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); |
94 | 97 | ||
95 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); | 98 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); |
96 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); | 99 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); |
97 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); | 100 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); |
98 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); | 101 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); |
99 | 102 | ||
100 | KPrefs::setCurrentGroup( "PhoneAccess" ); | 103 | KPrefs::setCurrentGroup( "PhoneAccess" ); |
101 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); | 104 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); |
102 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); | 105 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); |
103 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); | 106 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); |
104 | 107 | ||
105 | } | 108 | } |
106 | 109 | ||
107 | |||
108 | void KPimGlobalPrefs::setGlobalConfig() | 110 | void KPimGlobalPrefs::setGlobalConfig() |
109 | { | 111 | { |
112 | if ( mLocaleDict == 0 ) { | ||
113 | QString fileName ; | ||
114 | QString name = KGlobal::getAppName() +"/"; | ||
115 | #ifndef DESKTOP_VERSION | ||
116 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name | ||
117 | #else | ||
118 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; | ||
119 | #endif | ||
120 | mLocaleDict = 0; | ||
121 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { | ||
122 | |||
123 | if ( mPreferredLanguage == 1 ) | ||
124 | fileName = fileName+"germantranslation.txt"; | ||
125 | else if ( mPreferredLanguage == 4 ) | ||
126 | fileName = fileName+"usertranslation.txt"; | ||
127 | else if ( mPreferredLanguage == 2 ) | ||
128 | fileName = fileName+"frenchtranslation.txt"; | ||
129 | else if ( mPreferredLanguage == 3 ) | ||
130 | fileName = fileName+"italiantranslation.txt"; | ||
131 | QFile file( fileName ); | ||
132 | if (file.open( IO_ReadOnly ) ) { | ||
133 | QTextStream ts( &file ); | ||
134 | ts.setEncoding( QTextStream::Latin1 ); | ||
135 | //ts.setCodec( QTextCodec::latin1 ); | ||
136 | QString text = ts.read(); | ||
137 | file.close(); | ||
138 | text.replace( QRegExp("\\\\n"), "\n" ); | ||
139 | QString line; | ||
140 | QString we; | ||
141 | QString wt; | ||
142 | int br = 0; | ||
143 | int nbr; | ||
144 | nbr = text.find ( "},", br ); | ||
145 | line = text.mid( br, nbr - br ); | ||
146 | br = nbr+1; | ||
147 | int se, ee, st, et; | ||
148 | mLocaleDict = new QDict<QString>; | ||
149 | QString end = "{ \"\",\"\" }"; | ||
150 | while ( (line != end) && (br > 1) ) { | ||
151 | //qDebug("%d *%s* ", br, line.latin1()); | ||
152 | se = line.find("\"")+1; | ||
153 | et = line.findRev("\"",-1); | ||
154 | ee = line.find("\",\""); | ||
155 | st = ee+3; | ||
156 | we = line.mid( se, ee-se ); | ||
157 | wt = line.mid( st, et-st ); | ||
158 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | ||
159 | mLocaleDict->insert( we, new QString (wt) ); | ||
160 | nbr = text.find ( "}", br ); | ||
161 | line = text.mid( br, nbr - br ); | ||
162 | br = nbr+1; | ||
163 | } | ||
164 | //qDebug("end *%s* ", end.latin1()); | ||
165 | |||
166 | setLocaleDict( mLocaleDict ); | ||
167 | } else { | ||
168 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | ||
169 | } | ||
170 | } | ||
171 | } | ||
110 | 172 | ||
111 | KGlobal::locale()->setHore24Format( !mPreferredTime ); | 173 | KGlobal::locale()->setHore24Format( !mPreferredTime ); |
112 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); | 174 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); |
113 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); | 175 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); |
114 | KGlobal::locale()->setLanguage( mPreferredLanguage ); | 176 | KGlobal::locale()->setLanguage( mPreferredLanguage ); |
115 | QString dummy = mUserDateFormatLong; | 177 | QString dummy = mUserDateFormatLong; |
116 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 178 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
117 | dummy = mUserDateFormatShort; | 179 | dummy = mUserDateFormatShort; |
118 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 180 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
119 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, | 181 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, |
120 | mDaylightsavingStart, | 182 | mDaylightsavingStart, |
121 | mDaylightsavingEnd ); | 183 | mDaylightsavingEnd ); |
122 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); | 184 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); |
123 | 185 | ||
124 | } | 186 | } |
125 | KPimGlobalPrefs::~KPimGlobalPrefs() | 187 | KPimGlobalPrefs::~KPimGlobalPrefs() |
126 | { | 188 | { |
189 | if (sInstance == this) | ||
190 | sInstance = staticDeleterGP.setObject(0); | ||
191 | else | ||
192 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); | ||
127 | //qDebug("KPimGlobalPrefs::~KPimGlobalPrefs() "); | 193 | //qDebug("KPimGlobalPrefs::~KPimGlobalPrefs() "); |
128 | writeConfig(); | 194 | writeConfig(); |
195 | if ( mLocaleDict ) | ||
196 | delete mLocaleDict; | ||
129 | } | 197 | } |
130 | 198 | ||
131 | KPimGlobalPrefs *KPimGlobalPrefs::instance() | 199 | KPimGlobalPrefs *KPimGlobalPrefs::instance() |
132 | { | 200 | { |
133 | if ( !sInstance ) { | 201 | if ( !sInstance ) { |
134 | sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); | 202 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); |
135 | sInstance->readConfig(); | 203 | sInstance->readConfig(); |
136 | } | 204 | } |
137 | 205 | ||
138 | return sInstance; | 206 | return sInstance; |
139 | } | 207 | } |
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h index d09c3da..11c534a 100644 --- a/libkdepim/kpimglobalprefs.h +++ b/libkdepim/kpimglobalprefs.h | |||
@@ -11,48 +11,49 @@ | |||
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 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (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 | #include <qdict.h> | ||
35 | 36 | ||
36 | class KPimGlobalPrefs : public KPrefs | 37 | class KPimGlobalPrefs : public KPrefs |
37 | { | 38 | { |
38 | public: | 39 | public: |
39 | 40 | ||
40 | void setGlobalConfig(); | 41 | void setGlobalConfig(); |
41 | static KPimGlobalPrefs *instance(); | 42 | static KPimGlobalPrefs *instance(); |
42 | 43 | ||
43 | 44 | ||
44 | virtual ~KPimGlobalPrefs(); | 45 | virtual ~KPimGlobalPrefs(); |
45 | 46 | ||
46 | 47 | ||
47 | enum EMailClients { | 48 | enum EMailClients { |
48 | NONE_EMC = 0, | 49 | NONE_EMC = 0, |
49 | OTHER_EMC = 1, | 50 | OTHER_EMC = 1, |
50 | OMPI_EMC = 2, | 51 | OMPI_EMC = 2, |
51 | QTOPIA_EMC = 3, | 52 | QTOPIA_EMC = 3, |
52 | OPIE_EMC = 4 | 53 | OPIE_EMC = 4 |
53 | }; | 54 | }; |
54 | 55 | ||
55 | enum PhoneClients { | 56 | enum PhoneClients { |
56 | NONE_PHC = 0, | 57 | NONE_PHC = 0, |
57 | OTHER_PHC = 1, | 58 | OTHER_PHC = 1, |
58 | KPPI_PHC = 2 | 59 | KPPI_PHC = 2 |
@@ -62,48 +63,49 @@ class KPimGlobalPrefs : public KPrefs | |||
62 | NONE_FAC = 0, | 63 | NONE_FAC = 0, |
63 | OTHER_FAC = 1 | 64 | OTHER_FAC = 1 |
64 | }; | 65 | }; |
65 | 66 | ||
66 | enum SMSClients { | 67 | enum SMSClients { |
67 | NONE_SMC = 0, | 68 | NONE_SMC = 0, |
68 | OTHER_SMC = 1 | 69 | OTHER_SMC = 1 |
69 | }; | 70 | }; |
70 | 71 | ||
71 | enum PagerClients { | 72 | enum PagerClients { |
72 | NONE_PAC = 0, | 73 | NONE_PAC = 0, |
73 | OTHER_PAC = 1 | 74 | OTHER_PAC = 1 |
74 | }; | 75 | }; |
75 | 76 | ||
76 | enum SIPClients { | 77 | enum SIPClients { |
77 | NONE_SIC = 0, | 78 | NONE_SIC = 0, |
78 | OTHER_SIC = 1, | 79 | OTHER_SIC = 1, |
79 | KPPI_SIC = 2 | 80 | KPPI_SIC = 2 |
80 | }; | 81 | }; |
81 | 82 | ||
82 | private: | 83 | private: |
83 | KPimGlobalPrefs( const QString &name = QString::null ); | 84 | KPimGlobalPrefs( const QString &name = QString::null ); |
84 | 85 | ||
85 | static KPimGlobalPrefs *sInstance; | 86 | static KPimGlobalPrefs *sInstance; |
87 | QDict<QString> *mLocaleDict; | ||
86 | 88 | ||
87 | 89 | ||
88 | public: | 90 | public: |
89 | //US I copied the following "locale" settings from KOPrefs | 91 | //US I copied the following "locale" settings from KOPrefs |
90 | int mPreferredDate; | 92 | int mPreferredDate; |
91 | QString mUserDateFormatLong; | 93 | QString mUserDateFormatLong; |
92 | QString mUserDateFormatShort; | 94 | QString mUserDateFormatShort; |
93 | int mPreferredLanguage; | 95 | int mPreferredLanguage; |
94 | int mPreferredTime; | 96 | int mPreferredTime; |
95 | bool mWeekStartsOnSunday; | 97 | bool mWeekStartsOnSunday; |
96 | QString mTimeZoneId; | 98 | QString mTimeZoneId; |
97 | bool mUseDaylightsaving; | 99 | bool mUseDaylightsaving; |
98 | int mDaylightsavingStart; | 100 | int mDaylightsavingStart; |
99 | int mDaylightsavingEnd; | 101 | int mDaylightsavingEnd; |
100 | bool mTimeZoneAdd30min; | 102 | bool mTimeZoneAdd30min; |
101 | 103 | ||
102 | int mEmailClient; | 104 | int mEmailClient; |
103 | QString mEmailOtherChannel; | 105 | QString mEmailOtherChannel; |
104 | QString mEmailOtherMessage; | 106 | QString mEmailOtherMessage; |
105 | QString mEmailOtherMessageParameters; | 107 | QString mEmailOtherMessageParameters; |
106 | QString mEmailOtherMessage2; | 108 | QString mEmailOtherMessage2; |
107 | QString mEmailOtherMessageParameters2; | 109 | QString mEmailOtherMessageParameters2; |
108 | 110 | ||
109 | int mPhoneClient; | 111 | int mPhoneClient; |
diff --git a/microkde/kstaticdeleter.h b/microkde/kstaticdeleter.h index dfd3929..d9c2b72 100644 --- a/microkde/kstaticdeleter.h +++ b/microkde/kstaticdeleter.h | |||
@@ -7,31 +7,32 @@ | |||
7 | * modify it under the terms of the GNU Library General Public | 7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either | 8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. | 9 | * version 2 of the License, or (at your option) any later version. |
10 | * | 10 | * |
11 | * This library is distributed in the hope that it will be useful, | 11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Library General Public License for more details. | 14 | * Library General Public License for more details. |
15 | * | 15 | * |
16 | * You should have received a copy of the GNU Library General Public License | 16 | * You should have received a copy of the GNU Library General Public License |
17 | * along with this library; see the file COPYING.LIB. If not, write to | 17 | * along with this library; see the file COPYING.LIB. If not, write to |
18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | * Boston, MA 02111-1307, USA. | 19 | * Boston, MA 02111-1307, USA. |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifndef _KSTATIC_DELETER_H_ | 23 | #ifndef _KSTATIC_DELETER_H_ |
24 | #define _KSTATIC_DELETER_H_ | 24 | #define _KSTATIC_DELETER_H_ |
25 | 25 | ||
26 | template<class type> | 26 | template<class type> |
27 | class KStaticDeleter | 27 | class KStaticDeleter |
28 | { | 28 | { |
29 | public: | 29 | public: |
30 | KStaticDeleter() {}; | 30 | KStaticDeleter() {}; |
31 | type *setObject( type *obj, bool isArray = false) { _mobj = obj;return obj; } | 31 | type *setObject( type *obj, bool isArray = false) { _mobj = obj;_isArray = isArray;return obj; } |
32 | virtual ~KStaticDeleter() {delete _mobj;}; | 32 | virtual ~KStaticDeleter() {if (_isArray) delete[] _mobj; else delete _mobj;}; |
33 | private: | 33 | private: |
34 | type* _mobj; | 34 | type* _mobj; |
35 | bool _isArray; | ||
35 | }; | 36 | }; |
36 | 37 | ||
37 | #endif | 38 | #endif |
diff --git a/pwmanager/pwmanager/pwmprefs.cpp b/pwmanager/pwmanager/pwmprefs.cpp index fdc34e0..68d5b68 100644 --- a/pwmanager/pwmanager/pwmprefs.cpp +++ b/pwmanager/pwmanager/pwmprefs.cpp | |||
@@ -10,96 +10,100 @@ | |||
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 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | 26 | ||
27 | #include <kconfig.h> | 27 | #include <kconfig.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | #include <kstaticdeleter.h> | 29 | #include <kstaticdeleter.h> |
30 | 30 | ||
31 | #include "pwmprefs.h" | 31 | #include "pwmprefs.h" |
32 | 32 | ||
33 | PWMPrefs *PWMPrefs::sInstance = 0; | 33 | PWMPrefs *PWMPrefs::sInstance = 0; |
34 | static KStaticDeleter<PWMPrefs> staticDeleter; | 34 | static KStaticDeleter<PWMPrefs> staticDeleterPP; |
35 | 35 | ||
36 | PWMPrefs::PWMPrefs() | 36 | PWMPrefs::PWMPrefs() |
37 | : KPimPrefs("pwmanagerrc") | 37 | : KPimPrefs("pwmanagerrc") |
38 | { | 38 | { |
39 | KPrefs::setCurrentGroup( "Global" ); | 39 | KPrefs::setCurrentGroup( "Global" ); |
40 | 40 | ||
41 | addItemString( "autoStart", &mAutoStart, "" ); | 41 | addItemString( "autoStart", &mAutoStart, "" ); |
42 | addItemString( "browserCommand", &mBrowserCommand, "" ); | 42 | addItemString( "browserCommand", &mBrowserCommand, "" ); |
43 | addItemString( "xtermCommand", &mXTermCommand, CONF_DEFAULT_XTERMCOMMAND); | 43 | addItemString( "xtermCommand", &mXTermCommand, CONF_DEFAULT_XTERMCOMMAND); |
44 | addItemFont( "entryFont", &mEntryFont); | 44 | addItemFont( "entryFont", &mEntryFont); |
45 | addItemInt( "pwTimeout", &mPwTimeout, CONF_DEFAULT_PWTIMEOUT ); | 45 | addItemInt( "pwTimeout", &mPwTimeout, CONF_DEFAULT_PWTIMEOUT ); |
46 | addItemInt( "lockTimeout", &mLockTimeout, CONF_DEFAULT_LOCKTIMEOUT ); | 46 | addItemInt( "lockTimeout", &mLockTimeout, CONF_DEFAULT_LOCKTIMEOUT ); |
47 | addItemInt( "compression", &mCompression, CONF_DEFAULT_COMPRESSION ); | 47 | addItemInt( "compression", &mCompression, CONF_DEFAULT_COMPRESSION ); |
48 | addItemInt("cryptAlgo", &mCryptAlgo, CONF_DEFAULT_CRYPTALGO); | 48 | addItemInt("cryptAlgo", &mCryptAlgo, CONF_DEFAULT_CRYPTALGO); |
49 | addItemInt("hashAlgo", &mHashAlgo, CONF_DEFAULT_HASHALGO); | 49 | addItemInt("hashAlgo", &mHashAlgo, CONF_DEFAULT_HASHALGO); |
50 | addItemInt( "filePermissions", &mFilePermissions, CONF_DEFAULT_FILEPERMISSIONS ); | 50 | addItemInt( "filePermissions", &mFilePermissions, CONF_DEFAULT_FILEPERMISSIONS ); |
51 | addItemInt( "minimizeLock", &mMinimizeLock, CONF_DEFAULT_MINIMIZELOCK ); | 51 | addItemInt( "minimizeLock", &mMinimizeLock, CONF_DEFAULT_MINIMIZELOCK ); |
52 | addItemBool( "unlockOnOpen", &mUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN ); | 52 | addItemBool( "unlockOnOpen", &mUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN ); |
53 | addItemBool( "tray", &mTray, CONF_DEFAULT_TRAY ); | 53 | addItemBool( "tray", &mTray, CONF_DEFAULT_TRAY ); |
54 | addItemBool( "makeFileBackup", &mMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP ); | 54 | addItemBool( "makeFileBackup", &mMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP ); |
55 | addItemBool( "autostartDeepLocked", &mAutostartDeeplocked, CONF_DEFAULT_AUTOSTART_DEEPL ); | 55 | addItemBool( "autostartDeepLocked", &mAutostartDeeplocked, CONF_DEFAULT_AUTOSTART_DEEPL ); |
56 | addItemBool( "autoDeepLock", &mAutoDeeplock, CONF_DEFAULT_AUTODEEPLOCK ); | 56 | addItemBool( "autoDeepLock", &mAutoDeeplock, CONF_DEFAULT_AUTODEEPLOCK ); |
57 | addItemBool( "kwalletEmu", &mKWalletEmu, CONF_DEFAULT_KWALLETEMU ); | 57 | addItemBool( "kwalletEmu", &mKWalletEmu, CONF_DEFAULT_KWALLETEMU ); |
58 | addItemBool( "newEntrLockStat", &mNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT ); | 58 | addItemBool( "newEntrLockStat", &mNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT ); |
59 | 59 | ||
60 | KPrefs::setCurrentGroup( "Wnd" ); | 60 | KPrefs::setCurrentGroup( "Wnd" ); |
61 | 61 | ||
62 | addItemSize( "MainWndSize", &mMainWndSize); | 62 | addItemSize( "MainWndSize", &mMainWndSize); |
63 | addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE ); | 63 | addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE ); |
64 | addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE ); | 64 | addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE ); |
65 | addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE ); | 65 | addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE ); |
66 | addItemIntList( "commentSplitter", &mCommentSplitter ); | 66 | addItemIntList( "commentSplitter", &mCommentSplitter ); |
67 | addItemIntList( "categorySplitter", &mCategorySplitter ); | 67 | addItemIntList( "categorySplitter", &mCategorySplitter ); |
68 | } | 68 | } |
69 | 69 | ||
70 | PWMPrefs::~PWMPrefs() | 70 | PWMPrefs::~PWMPrefs() |
71 | { | 71 | { |
72 | if (sInstance == this) | ||
73 | sInstance = staticDeleterPP.setObject(0); | ||
74 | else | ||
75 | qDebug("Whats this? Error in PWMPrefs::~PWMPrefs()?"); | ||
72 | } | 76 | } |
73 | 77 | ||
74 | PWMPrefs *PWMPrefs::instance() | 78 | PWMPrefs *PWMPrefs::instance() |
75 | { | 79 | { |
76 | if ( !sInstance ) { | 80 | if ( !sInstance ) { |
77 | #ifdef PWM_EMBEDDED | 81 | #ifdef PWM_EMBEDDED |
78 | sInstance = staticDeleter.setObject( new PWMPrefs() ); | 82 | sInstance = staticDeleterPP.setObject( new PWMPrefs() ); |
79 | #else //PWM_EMBEDDED | 83 | #else //PWM_EMBEDDED |
80 | //US the following line has changed ???. Why | 84 | //US the following line has changed ???. Why |
81 | staticDeleter.setObject( sInstance, new PWMPrefs() ); | 85 | staticDeleterPP.setObject( sInstance, new PWMPrefs() ); |
82 | #endif //KAB_EMBEDDED | 86 | #endif //KAB_EMBEDDED |
83 | sInstance->readConfig(); | 87 | sInstance->readConfig(); |
84 | } | 88 | } |
85 | 89 | ||
86 | return sInstance; | 90 | return sInstance; |
87 | } | 91 | } |
88 | 92 | ||
89 | // US introduce a nonconst way to return the config object. | 93 | // US introduce a nonconst way to return the config object. |
90 | KConfig* PWMPrefs::getConfig() | 94 | KConfig* PWMPrefs::getConfig() |
91 | { | 95 | { |
92 | return config(); | 96 | return config(); |
93 | } | 97 | } |
94 | 98 | ||
95 | /******************************************************************* | 99 | /******************************************************************* |
96 | * functions for reading the configuration settings | 100 | * functions for reading the configuration settings |
97 | *******************************************************************/ | 101 | *******************************************************************/ |
98 | 102 | ||
99 | QString PWMPrefs::confGlobAutoStart() | 103 | QString PWMPrefs::confGlobAutoStart() |
100 | { | 104 | { |
101 | return mAutoStart; | 105 | return mAutoStart; |
102 | } | 106 | } |
103 | 107 | ||
104 | QString PWMPrefs::confGlobBrowserCommand() | 108 | QString PWMPrefs::confGlobBrowserCommand() |
105 | { | 109 | { |