summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-07-02 15:33:56 (UTC)
committer ulf69 <ulf69>2004-07-02 15:33:56 (UTC)
commitbb7ad945c1541684a02e853fdaabd0e3ba74f8df (patch) (side-by-side diff)
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
@@ -8,59 +8,49 @@ KConfig *KGlobal::mConfig = 0;
KIconLoader *KGlobal::mIconLoader = 0;
KStandardDirs *KGlobal::mDirs = 0;
QString KGlobal::mAppName = "godot";
KLocale *KGlobal::locale()
{
if ( !mLocale ) {
ASSERT(mAppName);
mLocale = new KLocale();//mAppName);
}
return mLocale;
}
//US
void KGlobal::setLocale(KLocale *kg)
{
mLocale = kg;
}
KConfig *KGlobal::config()
{
- static bool reentrant = false;
-
- if (reentrant)
- return 0;
-
- if ( !mConfig ) {
- reentrant = true;
- mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) );
- reentrant = false;
- }
-
+ //mConfig is set inside setAppName. Though it has to be the first function you call.
return mConfig;
}
KGlobal::Size KGlobal::getDesktopSize()
{
#ifdef DESKTOP_VERSION
return KGlobal::Desktop;
#else
if ( QApplication::desktop()->width() < 480 )
return KGlobal::Small;
else
return KGlobal::Medium;
#endif
}
KGlobal::Orientation KGlobal::getOrientation()
{
if (QApplication::desktop()->width() > QApplication::desktop()->height())
return KGlobal::Landscape;
else
return KGlobal::Portrait;
}
int KGlobal::getDesktopWidth()
@@ -74,48 +64,50 @@ int KGlobal::getDesktopHeight()
}
KIconLoader *KGlobal::iconLoader()
{
if ( !mIconLoader ) {
mIconLoader = new KIconLoader();
}
return mIconLoader;
}
KStandardDirs *KGlobal::dirs()
{
if ( !mDirs ) {
mDirs = new KStandardDirs();
}
return mDirs;
}
void KGlobal::setAppName( const QString &appName )
{
mAppName = appName;
+
+ mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) );
}
//US
QString KGlobal::getAppName()
{
return mAppName;
}
QString KGlobal::formatMessage ( QString mess, int maxlen )
{
//int maxlen = 80;
int start = 0;
int end = mess.length();
QString retVal = "";
int nl, space;
while ( (end - start) > maxlen ) {
nl = mess.find( "\n", start );
if ( nl > 0 && nl < start + maxlen ) {
nl += 1;
retVal += mess.mid( start, nl - start);
start = nl;
} else {
space = mess.findRev( " ", start + maxlen );
if ( space < start ) {
retVal += mess.mid( start, maxlen) +"\n";