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 /pwmanager | |
parent | ba2583db0431059cd7368be23c9653e81af16d29 (diff) | |
download | kdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.zip kdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.tar.gz kdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.tar.bz2 |
global settings bugfixes
-rw-r--r-- | pwmanager/pwmanager/pwmprefs.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
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 | { |