-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() | |||
70 | { | 70 | { |
71 | if ( !mIconLoader ) { | 71 | if ( !mIconLoader ) { |
72 | mIconLoader = new KIconLoader(); | 72 | mIconLoader = new KIconLoader(); |
73 | } | 73 | } |
74 | 74 | ||
75 | return mIconLoader; | 75 | return mIconLoader; |
76 | } | 76 | } |
77 | 77 | ||
78 | KStandardDirs *KGlobal::dirs() | 78 | KStandardDirs *KGlobal::dirs() |
79 | { | 79 | { |
80 | if ( !mDirs ) { | 80 | if ( !mDirs ) { |
81 | mDirs = new KStandardDirs(); | 81 | mDirs = new KStandardDirs(); |
82 | } | 82 | } |
83 | 83 | ||
84 | return mDirs; | 84 | return mDirs; |
85 | } | 85 | } |
86 | 86 | ||
87 | void KGlobal::setAppName( const QString &appName ) | 87 | void KGlobal::setAppName( const QString &appName ) |
88 | { | 88 | { |
89 | mAppName = appName; | 89 | mAppName = appName; |
90 | 90 | ||
91 | mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) ); | 91 | mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) ); |
92 | } | 92 | } |
93 | 93 | ||
94 | //US | 94 | //US |
95 | QString KGlobal::getAppName() | 95 | QString KGlobal::getAppName() |
96 | { | 96 | { |
97 | return mAppName; | 97 | return mAppName; |
98 | } | 98 | } |
99 | QString KGlobal::formatMessage ( QString mess, int maxlen ) | 99 | QString KGlobal::formatMessage ( QString mess, int maxlen ) |
100 | { | 100 | { |
101 | //int maxlen = 80; | 101 | //int maxlen = 80; |
102 | if ( maxlen == 0 ) { | ||
103 | maxlen = QApplication::desktop()->width()/10; | ||
104 | if ( maxlen > 32 ) | ||
105 | maxlen = (maxlen * 3) / 4; | ||
106 | if ( maxlen > 100 ) | ||
107 | maxlen = 100; | ||
108 | } | ||
102 | int start = 0; | 109 | int start = 0; |
103 | int end = mess.length(); | 110 | int end = mess.length(); |
104 | QString retVal = ""; | 111 | QString retVal = ""; |
105 | int nl, space; | 112 | int nl, space; |
106 | while ( (end - start) > maxlen ) { | 113 | while ( (end - start) > maxlen ) { |
107 | nl = mess.find( "\n", start ); | 114 | nl = mess.find( "\n", start ); |
108 | if ( nl > 0 && nl < start + maxlen ) { | 115 | if ( nl > 0 && nl < start + maxlen ) { |
109 | nl += 1; | 116 | nl += 1; |
110 | retVal += mess.mid( start, nl - start); | 117 | retVal += mess.mid( start, nl - start); |
111 | start = nl; | 118 | start = nl; |
112 | } else { | 119 | } else { |
113 | space = mess.findRev( " ", start + maxlen ); | 120 | space = mess.findRev( " ", start + maxlen ); |
114 | if ( space < start ) { | 121 | if ( space < start ) { |
115 | retVal += mess.mid( start, maxlen) +"\n"; | 122 | retVal += mess.mid( start, maxlen) +"\n"; |
116 | start += maxlen ; | 123 | start += maxlen ; |
117 | } else { | 124 | } else { |
118 | retVal += mess.mid( start, space - start ) +"\n"; | 125 | retVal += mess.mid( start, space - start ) +"\n"; |
119 | start = space+ 1; | 126 | start = space+ 1; |
120 | } | 127 | } |
121 | } | 128 | } |
122 | } | 129 | } |
123 | retVal += mess.mid( start, end - start ); | 130 | retVal += mess.mid( start, end - start ); |
124 | return retVal; | 131 | return retVal; |
125 | } | 132 | } |
126 | int KGlobal::knumkeykonv( int k ) | 133 | int KGlobal::knumkeykonv( int k ) |
127 | { | 134 | { |
128 | int key; | 135 | int key; |
129 | switch( k ) { | 136 | switch( k ) { |
130 | case Qt::Key_Q : | 137 | case Qt::Key_Q : |
131 | key = Qt::Key_1; | 138 | key = Qt::Key_1; |
132 | break; | 139 | break; |
133 | case Qt::Key_W : | 140 | case Qt::Key_W : |