summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-07-02 15:33:56 (UTC)
committer ulf69 <ulf69>2004-07-02 15:33:56 (UTC)
commitbb7ad945c1541684a02e853fdaabd0e3ba74f8df (patch) (unidiff)
tree4ccde1ffdcb3b14cc6ef4945be87a6e82ff174b4
parentdf5b4df6bc00ea8acfee0b11a335a9d2f39d04dc (diff)
downloadkdepimpi-bb7ad945c1541684a02e853fdaabd0e3ba74f8df.zip
kdepimpi-bb7ad945c1541684a02e853fdaabd0e3ba74f8df.tar.gz
kdepimpi-bb7ad945c1541684a02e853fdaabd0e3ba74f8df.tar.bz2
removed reentrant solution, for something better
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kglobal.cpp14
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
@@ -16,43 +16,33 @@ KLocale *KGlobal::locale()
16 ASSERT(mAppName); 16 ASSERT(mAppName);
17 17
18 mLocale = new KLocale();//mAppName); 18 mLocale = new KLocale();//mAppName);
19 } 19 }
20 20
21 return mLocale; 21 return mLocale;
22} 22}
23 23
24//US 24//US
25void KGlobal::setLocale(KLocale *kg) 25void KGlobal::setLocale(KLocale *kg)
26{ 26{
27 mLocale = kg; 27 mLocale = kg;
28} 28}
29 29
30KConfig *KGlobal::config() 30KConfig *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
46KGlobal::Size KGlobal::getDesktopSize() 36KGlobal::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;
55#endif 45#endif
56} 46}
57 47
58KGlobal::Orientation KGlobal::getOrientation() 48KGlobal::Orientation KGlobal::getOrientation()
@@ -82,32 +72,34 @@ KIconLoader *KGlobal::iconLoader()
82 72
83 return mIconLoader; 73 return mIconLoader;
84} 74}
85 75
86KStandardDirs *KGlobal::dirs() 76KStandardDirs *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
95void KGlobal::setAppName( const QString &appName ) 85void 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
101QString KGlobal::getAppName() 93QString KGlobal::getAppName()
102{ 94{
103 return mAppName; 95 return mAppName;
104} 96}
105QString KGlobal::formatMessage ( QString mess, int maxlen ) 97QString 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();
110 QString retVal = ""; 102 QString retVal = "";
111 int nl, space; 103 int nl, space;
112 while ( (end - start) > maxlen ) { 104 while ( (end - start) > maxlen ) {
113 nl = mess.find( "\n", start ); 105 nl = mess.find( "\n", start );