author | ulf69 <ulf69> | 2004-07-02 15:33:56 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-02 15:33:56 (UTC) |
commit | bb7ad945c1541684a02e853fdaabd0e3ba74f8df (patch) (unidiff) | |
tree | 4ccde1ffdcb3b14cc6ef4945be87a6e82ff174b4 | |
parent | df5b4df6bc00ea8acfee0b11a335a9d2f39d04dc (diff) | |
download | kdepimpi-bb7ad945c1541684a02e853fdaabd0e3ba74f8df.zip kdepimpi-bb7ad945c1541684a02e853fdaabd0e3ba74f8df.tar.gz kdepimpi-bb7ad945c1541684a02e853fdaabd0e3ba74f8df.tar.bz2 |
removed reentrant solution, for something better
-rw-r--r-- | microkde/kglobal.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/microkde/kglobal.cpp b/microkde/kglobal.cpp index 6fa0dd6..2b1bd34 100644 --- a/microkde/kglobal.cpp +++ b/microkde/kglobal.cpp | |||
@@ -20,35 +20,25 @@ KLocale *KGlobal::locale() | |||
20 | 20 | ||
21 | return mLocale; | 21 | return mLocale; |
22 | } | 22 | } |
23 | 23 | ||
24 | //US | 24 | //US |
25 | void KGlobal::setLocale(KLocale *kg) | 25 | void KGlobal::setLocale(KLocale *kg) |
26 | { | 26 | { |
27 | mLocale = kg; | 27 | mLocale = kg; |
28 | } | 28 | } |
29 | 29 | ||
30 | KConfig *KGlobal::config() | 30 | KConfig *KGlobal::config() |
31 | { | 31 | { |
32 | static bool reentrant = false; | 32 | //mConfig is set inside setAppName. Though it has to be the first function you call. |
33 | |||
34 | if (reentrant) | ||
35 | return 0; | ||
36 | |||
37 | if ( !mConfig ) { | ||
38 | reentrant = true; | ||
39 | mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) ); | ||
40 | reentrant = false; | ||
41 | } | ||
42 | |||
43 | return mConfig; | 33 | return mConfig; |
44 | } | 34 | } |
45 | 35 | ||
46 | KGlobal::Size KGlobal::getDesktopSize() | 36 | KGlobal::Size KGlobal::getDesktopSize() |
47 | { | 37 | { |
48 | #ifdef DESKTOP_VERSION | 38 | #ifdef DESKTOP_VERSION |
49 | return KGlobal::Desktop; | 39 | return KGlobal::Desktop; |
50 | #else | 40 | #else |
51 | if ( QApplication::desktop()->width() < 480 ) | 41 | if ( QApplication::desktop()->width() < 480 ) |
52 | return KGlobal::Small; | 42 | return KGlobal::Small; |
53 | else | 43 | else |
54 | return KGlobal::Medium; | 44 | return KGlobal::Medium; |
@@ -86,24 +76,26 @@ KIconLoader *KGlobal::iconLoader() | |||
86 | KStandardDirs *KGlobal::dirs() | 76 | KStandardDirs *KGlobal::dirs() |
87 | { | 77 | { |
88 | if ( !mDirs ) { | 78 | if ( !mDirs ) { |
89 | mDirs = new KStandardDirs(); | 79 | mDirs = new KStandardDirs(); |
90 | } | 80 | } |
91 | 81 | ||
92 | return mDirs; | 82 | return mDirs; |
93 | } | 83 | } |
94 | 84 | ||
95 | void KGlobal::setAppName( const QString &appName ) | 85 | void KGlobal::setAppName( const QString &appName ) |
96 | { | 86 | { |
97 | mAppName = appName; | 87 | mAppName = appName; |
88 | |||
89 | mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) ); | ||
98 | } | 90 | } |
99 | 91 | ||
100 | //US | 92 | //US |
101 | QString KGlobal::getAppName() | 93 | QString KGlobal::getAppName() |
102 | { | 94 | { |
103 | return mAppName; | 95 | return mAppName; |
104 | } | 96 | } |
105 | QString KGlobal::formatMessage ( QString mess, int maxlen ) | 97 | QString KGlobal::formatMessage ( QString mess, int maxlen ) |
106 | { | 98 | { |
107 | //int maxlen = 80; | 99 | //int maxlen = 80; |
108 | int start = 0; | 100 | int start = 0; |
109 | int end = mess.length(); | 101 | int end = mess.length(); |