summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index cf76000..755fb19 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -115,129 +115,140 @@ public:
115 bool kbgrabbed : 1; 115 bool kbgrabbed : 1;
116 bool notbusysent : 1; 116 bool notbusysent : 1;
117 bool preloaded : 1; 117 bool preloaded : 1;
118 bool forceshow : 1; 118 bool forceshow : 1;
119 bool nomaximize : 1; 119 bool nomaximize : 1;
120 bool keep_running : 1; 120 bool keep_running : 1;
121 bool qcopQok : 1; 121 bool qcopQok : 1;
122 122
123 123
124 QStringList langs; 124 QStringList langs;
125 QString appName; 125 QString appName;
126 struct QCopRec 126 struct QCopRec
127 { 127 {
128 QCopRec( const QCString &ch, const QCString &msg, 128 QCopRec( const QCString &ch, const QCString &msg,
129 const QByteArray &d ) : 129 const QByteArray &d ) :
130 channel( ch ), message( msg ), data( d ) 130 channel( ch ), message( msg ), data( d )
131 { } 131 { }
132 132
133 QCString channel; 133 QCString channel;
134 QCString message; 134 QCString message;
135 QByteArray data; 135 QByteArray data;
136 }; 136 };
137 QWidget* qpe_main_widget; 137 QWidget* qpe_main_widget;
138 QGuardedPtr<QWidget> lastraised; 138 QGuardedPtr<QWidget> lastraised;
139 QQueue<QCopRec> qcopq; 139 QQueue<QCopRec> qcopq;
140 QString styleName; 140 QString styleName;
141 QString decorationName; 141 QString decorationName;
142 142
143 void enqueueQCop( const QCString &ch, const QCString &msg, 143 void enqueueQCop( const QCString &ch, const QCString &msg,
144 const QByteArray &data ) 144 const QByteArray &data )
145 { 145 {
146 qcopq.enqueue( new QCopRec( ch, msg, data ) ); 146 qcopq.enqueue( new QCopRec( ch, msg, data ) );
147 } 147 }
148 void sendQCopQ() 148 void sendQCopQ()
149 { 149 {
150 if (!qcopQok ) 150 if (!qcopQok )
151 return; 151 return;
152 152
153 QCopRec * r; 153 QCopRec * r;
154 154
155 while((r=qcopq.dequeue())) { 155 while((r=qcopq.dequeue())) {
156 // remove from queue before sending... 156 // remove from queue before sending...
157 // event loop can come around again before getting 157 // event loop can come around again before getting
158 // back from sendLocally 158 // back from sendLocally
159#ifndef QT_NO_COP 159#ifndef QT_NO_COP
160 QCopChannel::sendLocally( r->channel, r->message, r->data ); 160 QCopChannel::sendLocally( r->channel, r->message, r->data );
161#endif 161#endif
162 162
163 delete r; 163 delete r;
164 } 164 }
165 } 165 }
166 static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null ) 166 static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null )
167 { 167 {
168 168
169 // ugly hack, remove that later after finding a sane solution 169 // ugly hack, remove that later after finding a sane solution
170 // Addendum: Only Sharp currently has models with high resolution but (physically) small displays, 170 // Addendum: Only Sharp currently has models with high resolution but (physically) small displays,
171 // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has 171 // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has
172 // a (physically) large enough display to use the small icons 172 // a (physically) large enough display to use the small icons
173#if defined(OPIE_HIGH_RES_SMALL_PHY) 173#if defined(OPIE_HIGH_RES_SMALL_PHY)
174 if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { 174 if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) {
175 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); 175 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true );
176 } 176 }
177#endif 177#endif
178 178
179 QPEApplication::showWidget( mw, nomaximize ); 179 if ( mw->layout() && mw->inherits("QDialog") ) {
180 QPEApplication::showDialog((QDialog*)mw, nomaximize);
181 }
182 else {
183#ifdef Q_WS_QWS
184 if ( !nomaximize )
185 mw->showMaximized();
186 else
187#endif
188
189 mw->show();
190 }
180 } 191 }
181 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) 192 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ )
182 { 193 {
183 /* 194 /*
184 // This works but disable it for now until it is safe to apply 195 // This works but disable it for now until it is safe to apply
185 // What is does is scan the .desktop files of all the apps for 196 // What is does is scan the .desktop files of all the apps for
186 // the applnk that has the corresponding argv[0] as this program 197 // the applnk that has the corresponding argv[0] as this program
187 // then it uses the name stored in the .desktop file as the caption 198 // then it uses the name stored in the .desktop file as the caption
188 // for the main widget. This saves duplicating translations for 199 // for the main widget. This saves duplicating translations for
189 // the app name in the program and in the .desktop files. 200 // the app name in the program and in the .desktop files.
190 201
191 AppLnkSet apps( appsPath ); 202 AppLnkSet apps( appsPath );
192 203
193 QList<AppLnk> appsList = apps.children(); 204 QList<AppLnk> appsList = apps.children();
194 for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { 205 for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) {
195 if ( (*it)->exec() == appName ) { 206 if ( (*it)->exec() == appName ) {
196 mw->setCaption( (*it)->name() ); 207 mw->setCaption( (*it)->name() );
197 return TRUE; 208 return TRUE;
198 } 209 }
199 } 210 }
200 */ 211 */
201 return FALSE; 212 return FALSE;
202 } 213 }
203 214
204 215
205 void show(QWidget* mw, bool nomax) 216 void show(QWidget* mw, bool nomax)
206 { 217 {
207 setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); 218 setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" );
208 nomaximize = nomax; 219 nomaximize = nomax;
209 qpe_main_widget = mw; 220 qpe_main_widget = mw;
210 qcopQok = TRUE; 221 qcopQok = TRUE;
211#ifndef QT_NO_COP 222#ifndef QT_NO_COP
212 223
213 sendQCopQ(); 224 sendQCopQ();
214#endif 225#endif
215 226
216 if ( preloaded ) { 227 if ( preloaded ) {
217 if (forceshow) 228 if (forceshow)
218 show_mx(mw, nomax); 229 show_mx(mw, nomax);
219 } 230 }
220 else if ( keep_running ) { 231 else if ( keep_running ) {
221 show_mx(mw, nomax); 232 show_mx(mw, nomax);
222 } 233 }
223 } 234 }
224 235
225 void loadTextCodecs() 236 void loadTextCodecs()
226 { 237 {
227 QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; 238 QString path = QPEApplication::qpeDir() + "/plugins/textcodecs";
228#ifdef Q_OS_MACX 239#ifdef Q_OS_MACX
229 QDir dir( path, "lib*.dylib" ); 240 QDir dir( path, "lib*.dylib" );
230#else 241#else
231 QDir dir( path, "lib*.so" ); 242 QDir dir( path, "lib*.so" );
232#endif 243#endif
233 QStringList list; 244 QStringList list;
234 if ( dir. exists ( )) 245 if ( dir. exists ( ))
235 list = dir.entryList(); 246 list = dir.entryList();
236 QStringList::Iterator it; 247 QStringList::Iterator it;
237 for ( it = list.begin(); it != list.end(); ++it ) { 248 for ( it = list.begin(); it != list.end(); ++it ) {
238 TextCodecInterface *iface = 0; 249 TextCodecInterface *iface = 0;
239 QLibrary *lib = new QLibrary( path + "/" + *it ); 250 QLibrary *lib = new QLibrary( path + "/" + *it );
240 if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { 251 if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
241 QValueList<int> mibs = iface->mibEnums(); 252 QValueList<int> mibs = iface->mibEnums();
242 for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { 253 for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) {
243 (void)iface->createForMib(*i); 254 (void)iface->createForMib(*i);