summaryrefslogtreecommitdiffabout
path: root/microkde/kglobal.cpp
Unidiff
Diffstat (limited to 'microkde/kglobal.cpp') (more/less context) (ignore 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
@@ -38,128 +38,135 @@ KGlobal::Size KGlobal::getDesktopSize()
38#ifdef DESKTOP_VERSION 38#ifdef DESKTOP_VERSION
39 return KGlobal::Desktop; 39 return KGlobal::Desktop;
40#else 40#else
41 if ( QApplication::desktop()->width() <= 320 ) 41 if ( QApplication::desktop()->width() <= 320 )
42 return KGlobal::Small; 42 return KGlobal::Small;
43 else if ( QApplication::desktop()->width() > 480) 43 else if ( QApplication::desktop()->width() > 480)
44 return KGlobal::Desktop; 44 return KGlobal::Desktop;
45 else 45 else
46 return KGlobal::Medium; 46 return KGlobal::Medium;
47#endif 47#endif
48} 48}
49 49
50KGlobal::Orientation KGlobal::getOrientation() 50KGlobal::Orientation KGlobal::getOrientation()
51{ 51{
52 if (QApplication::desktop()->width() > QApplication::desktop()->height()) 52 if (QApplication::desktop()->width() > QApplication::desktop()->height())
53 return KGlobal::Landscape; 53 return KGlobal::Landscape;
54 else 54 else
55 return KGlobal::Portrait; 55 return KGlobal::Portrait;
56} 56}
57 57
58int KGlobal::getDesktopWidth() 58int KGlobal::getDesktopWidth()
59{ 59{
60 return QApplication::desktop()->width(); 60 return QApplication::desktop()->width();
61} 61}
62 62
63int KGlobal::getDesktopHeight() 63int KGlobal::getDesktopHeight()
64{ 64{
65 return QApplication::desktop()->height(); 65 return QApplication::desktop()->height();
66} 66}
67 67
68 68
69KIconLoader *KGlobal::iconLoader() 69KIconLoader *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
78KStandardDirs *KGlobal::dirs() 78KStandardDirs *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
87void KGlobal::setAppName( const QString &appName ) 87void 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
95QString KGlobal::getAppName() 95QString KGlobal::getAppName()
96{ 96{
97 return mAppName; 97 return mAppName;
98} 98}
99QString KGlobal::formatMessage ( QString mess, int maxlen ) 99QString 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}
126int KGlobal::knumkeykonv( int k ) 133int KGlobal::knumkeykonv( int k )
127{ 134{
128 int key; 135 int key;
129switch( k ) { 136switch( 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 :
134 key = Qt::Key_2; 141 key = Qt::Key_2;
135 break; 142 break;
136 case Qt::Key_E : 143 case Qt::Key_E :
137 key = Qt::Key_3; 144 key = Qt::Key_3;
138 break; 145 break;
139 case Qt::Key_R : 146 case Qt::Key_R :
140 key = Qt::Key_4; 147 key = Qt::Key_4;
141 break; 148 break;
142 case Qt::Key_T : 149 case Qt::Key_T :
143 key = Qt::Key_5; 150 key = Qt::Key_5;
144 break; 151 break;
145 case Qt::Key_Z : 152 case Qt::Key_Z :
146 key = Qt::Key_6; 153 key = Qt::Key_6;
147 break; 154 break;
148 case Qt::Key_Y : 155 case Qt::Key_Y :
149 key = Qt::Key_6; 156 key = Qt::Key_6;
150 break; 157 break;
151 case Qt::Key_U : 158 case Qt::Key_U :
152 key = Qt::Key_7; 159 key = Qt::Key_7;
153 break; 160 break;
154 case Qt::Key_I : 161 case Qt::Key_I :
155 key = Qt::Key_8; 162 key = Qt::Key_8;
156 break; 163 break;
157 case Qt::Key_O : 164 case Qt::Key_O :
158 key = Qt::Key_9; 165 key = Qt::Key_9;
159 break; 166 break;
160 case Qt::Key_P : 167 case Qt::Key_P :
161 key = Qt::Key_0; 168 key = Qt::Key_0;
162 break; 169 break;
163 default: 170 default:
164 key = k; 171 key = k;
165 break; 172 break;