-rw-r--r-- | microkde/kglobal.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/microkde/kglobal.cpp b/microkde/kglobal.cpp index 0aba952..6fa0dd6 100644 --- a/microkde/kglobal.cpp +++ b/microkde/kglobal.cpp | |||
@@ -1,80 +1,88 @@ | |||
1 | #include "kglobal.h" | 1 | #include "kglobal.h" |
2 | #include "kstandarddirs.h" | ||
2 | #include <qkeycode.h> | 3 | #include <qkeycode.h> |
3 | #include <qapplication.h> | 4 | #include <qapplication.h> |
4 | 5 | ||
5 | KLocale *KGlobal::mLocale = 0; | 6 | KLocale *KGlobal::mLocale = 0; |
6 | KConfig *KGlobal::mConfig = 0; | 7 | KConfig *KGlobal::mConfig = 0; |
7 | KIconLoader *KGlobal::mIconLoader = 0; | 8 | KIconLoader *KGlobal::mIconLoader = 0; |
8 | KStandardDirs *KGlobal::mDirs = 0; | 9 | KStandardDirs *KGlobal::mDirs = 0; |
9 | 10 | ||
10 | QString KGlobal::mAppName = "godot"; | 11 | QString KGlobal::mAppName = "godot"; |
11 | 12 | ||
12 | KLocale *KGlobal::locale() | 13 | KLocale *KGlobal::locale() |
13 | { | 14 | { |
14 | if ( !mLocale ) { | 15 | if ( !mLocale ) { |
15 | ASSERT(mAppName); | 16 | ASSERT(mAppName); |
16 | 17 | ||
17 | mLocale = new KLocale();//mAppName); | 18 | mLocale = new KLocale();//mAppName); |
18 | } | 19 | } |
19 | 20 | ||
20 | return mLocale; | 21 | return mLocale; |
21 | } | 22 | } |
22 | 23 | ||
23 | //US | 24 | //US |
24 | void KGlobal::setLocale(KLocale *kg) | 25 | void KGlobal::setLocale(KLocale *kg) |
25 | { | 26 | { |
26 | mLocale = kg; | 27 | mLocale = kg; |
27 | } | 28 | } |
28 | 29 | ||
29 | KConfig *KGlobal::config() | 30 | KConfig *KGlobal::config() |
30 | { | 31 | { |
32 | static bool reentrant = false; | ||
33 | |||
34 | if (reentrant) | ||
35 | return 0; | ||
36 | |||
31 | if ( !mConfig ) { | 37 | if ( !mConfig ) { |
32 | mConfig = new KConfig( KStandardDirs::appDir() + mAppName + "rc" ); | 38 | reentrant = true; |
39 | mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) ); | ||
40 | reentrant = false; | ||
33 | } | 41 | } |
34 | 42 | ||
35 | return mConfig; | 43 | return mConfig; |
36 | } | 44 | } |
37 | 45 | ||
38 | KGlobal::Size KGlobal::getDesktopSize() | 46 | KGlobal::Size KGlobal::getDesktopSize() |
39 | { | 47 | { |
40 | #ifdef DESKTOP_VERSION | 48 | #ifdef DESKTOP_VERSION |
41 | return KGlobal::Desktop; | 49 | return KGlobal::Desktop; |
42 | #else | 50 | #else |
43 | if ( QApplication::desktop()->width() < 480 ) | 51 | if ( QApplication::desktop()->width() < 480 ) |
44 | return KGlobal::Small; | 52 | return KGlobal::Small; |
45 | else | 53 | else |
46 | return KGlobal::Medium; | 54 | return KGlobal::Medium; |
47 | #endif | 55 | #endif |
48 | } | 56 | } |
49 | 57 | ||
50 | KGlobal::Orientation KGlobal::getOrientation() | 58 | KGlobal::Orientation KGlobal::getOrientation() |
51 | { | 59 | { |
52 | if (QApplication::desktop()->width() > QApplication::desktop()->height()) | 60 | if (QApplication::desktop()->width() > QApplication::desktop()->height()) |
53 | return KGlobal::Landscape; | 61 | return KGlobal::Landscape; |
54 | else | 62 | else |
55 | return KGlobal::Portrait; | 63 | return KGlobal::Portrait; |
56 | } | 64 | } |
57 | 65 | ||
58 | int KGlobal::getDesktopWidth() | 66 | int KGlobal::getDesktopWidth() |
59 | { | 67 | { |
60 | return QApplication::desktop()->width(); | 68 | return QApplication::desktop()->width(); |
61 | } | 69 | } |
62 | 70 | ||
63 | int KGlobal::getDesktopHeight() | 71 | int KGlobal::getDesktopHeight() |
64 | { | 72 | { |
65 | return QApplication::desktop()->height(); | 73 | return QApplication::desktop()->height(); |
66 | } | 74 | } |
67 | 75 | ||
68 | 76 | ||
69 | KIconLoader *KGlobal::iconLoader() | 77 | KIconLoader *KGlobal::iconLoader() |
70 | { | 78 | { |
71 | if ( !mIconLoader ) { | 79 | if ( !mIconLoader ) { |
72 | mIconLoader = new KIconLoader(); | 80 | mIconLoader = new KIconLoader(); |
73 | } | 81 | } |
74 | 82 | ||
75 | return mIconLoader; | 83 | return mIconLoader; |
76 | } | 84 | } |
77 | 85 | ||
78 | KStandardDirs *KGlobal::dirs() | 86 | KStandardDirs *KGlobal::dirs() |
79 | { | 87 | { |
80 | if ( !mDirs ) { | 88 | if ( !mDirs ) { |