author | zautrix <zautrix> | 2005-06-17 10:27:21 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-17 10:27:21 (UTC) |
commit | ec691904e9c129fda7514179910c5be9bf0d908b (patch) (side-by-side diff) | |
tree | 75984d135b97049af03ba22eab7f7db53a8a7922 /microkde/kglobal.cpp | |
parent | 56f20e7a0a6b8ecf84d11ced19f870241a13c17d (diff) | |
download | kdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.zip kdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.tar.gz kdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.tar.bz2 |
fixxx
-rw-r--r-- | microkde/kglobal.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/microkde/kglobal.cpp b/microkde/kglobal.cpp index bf7e238..53edd08 100644 --- a/microkde/kglobal.cpp +++ b/microkde/kglobal.cpp @@ -70,64 +70,71 @@ 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; + if ( maxlen == 0 ) { + maxlen = QApplication::desktop()->width()/10; + if ( maxlen > 32 ) + maxlen = (maxlen * 3) / 4; + if ( maxlen > 100 ) + maxlen = 100; + } 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"; start += maxlen ; } else { retVal += mess.mid( start, space - start ) +"\n"; start = space+ 1; } } } retVal += mess.mid( start, end - start ); return retVal; } int KGlobal::knumkeykonv( int k ) { int key; switch( k ) { case Qt::Key_Q : key = Qt::Key_1; break; case Qt::Key_W : |