summaryrefslogtreecommitdiffabout
path: root/microkde/kglobal.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kglobal.cpp') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kglobal.cpp7
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
@@ -54,96 +54,103 @@ KGlobal::Orientation KGlobal::getOrientation()
else
return KGlobal::Portrait;
}
int KGlobal::getDesktopWidth()
{
return QApplication::desktop()->width();
}
int KGlobal::getDesktopHeight()
{
return QApplication::desktop()->height();
}
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 :
key = Qt::Key_2;
break;
case Qt::Key_E :
key = Qt::Key_3;
break;
case Qt::Key_R :
key = Qt::Key_4;
break;
case Qt::Key_T :
key = Qt::Key_5;
break;
case Qt::Key_Z :
key = Qt::Key_6;
break;
case Qt::Key_Y :
key = Qt::Key_6;