summaryrefslogtreecommitdiff
path: root/x11/libqpe-x11
authoralwin <alwin>2004-03-02 12:21:11 (UTC)
committer alwin <alwin>2004-03-02 12:21:11 (UTC)
commitb6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff)
treed3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /x11/libqpe-x11
parent0d59c780513da78033f4d9040475dee9db0256d4 (diff)
downloadopie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'x11/libqpe-x11') (more/less context) (ignore whitespace changes)
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.cpp8
-rw-r--r--x11/libqpe-x11/qt/qcopchannel_qws.cpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp
index 0fce355..3cb8faf 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.cpp
+++ b/x11/libqpe-x11/qpe/qpeapplication.cpp
@@ -246,107 +246,107 @@ QPEApplication::QPEApplication(int &arg, char** argv, Type t)
246 246
247 atoms[n] = &d->wm_take_focus; 247 atoms[n] = &d->wm_take_focus;
248 names[n++] = "WM_TAKE_FOCUS"; 248 names[n++] = "WM_TAKE_FOCUS";
249 249
250 atoms[n] = &d->wm_context_help; 250 atoms[n] = &d->wm_context_help;
251 names[n++] = "_NET_WM_CONTEXT_HELP"; 251 names[n++] = "_NET_WM_CONTEXT_HELP";
252 252
253 atoms[n] = &d->wm_context_accept; 253 atoms[n] = &d->wm_context_accept;
254 names[n++] = "_NET_WM_CONTEXT_ACCEPT"; 254 names[n++] = "_NET_WM_CONTEXT_ACCEPT";
255 255
256 atoms[n] = &d->wm_protocols; 256 atoms[n] = &d->wm_protocols;
257 names[n++] = "WM_PROTOCOLS"; 257 names[n++] = "WM_PROTOCOLS";
258 258
259 XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re); 259 XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re);
260 // now copy the values over to the properties 260 // now copy the values over to the properties
261 for (int i = 0; i < n; i++ ) 261 for (int i = 0; i < n; i++ )
262 *atoms[i] = atoms_re[i]; 262 *atoms[i] = atoms_re[i];
263 // done with X11 Stuff 263 // done with X11 Stuff
264 264
265 int dw = desktop()->width(); 265 int dw = desktop()->width();
266 if ( dw < 200 ) { 266 if ( dw < 200 ) {
267 setFont( QFont( "helvetica", 8 ) ); 267 setFont( QFont( "helvetica", 8 ) );
268 AppLnk::setSmallIconSize( 10 ); 268 AppLnk::setSmallIconSize( 10 );
269 AppLnk::setBigIconSize( 28 ); 269 AppLnk::setBigIconSize( 28 );
270 }else if ( dw > 600 ) { 270 }else if ( dw > 600 ) {
271 setFont( QFont( "helvetica", 12 ) ); 271 setFont( QFont( "helvetica", 12 ) );
272 AppLnk::setSmallIconSize( 24 ); 272 AppLnk::setSmallIconSize( 24 );
273 AppLnk::setBigIconSize( 48 ); 273 AppLnk::setBigIconSize( 48 );
274 }else if ( dw > 200 ) { 274 }else if ( dw > 200 ) {
275 setFont( QFont( "helvetica", 10 ) ); 275 setFont( QFont( "helvetica", 10 ) );
276 AppLnk::setSmallIconSize( 16 ); 276 AppLnk::setSmallIconSize( 16 );
277 AppLnk::setBigIconSize( 32 ); 277 AppLnk::setBigIconSize( 32 );
278 } 278 }
279 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); 279 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory );
280 280
281 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT(hideOrQuit() ) ); 281 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT(hideOrQuit() ) );
282 282
283 QString qcopfn( "/tmp/qcop-msg-" ); 283 QString qcopfn( "/tmp/qcop-msg-" );
284 qcopfn += QString( argv[0] ); // append command name to the QCOP name 284 qcopfn += QString( argv[0] ); // append command name to the QCOP name
285 QFile file( qcopfn ); 285 QFile file( qcopfn );
286 if (file.open(IO_ReadOnly ) ) { 286 if (file.open(IO_ReadOnly ) ) {
287 flock( file.handle(), LOCK_EX ); 287 flock( file.handle(), LOCK_EX );
288 } 288 }
289 289
290 /* Hmmm damn we need to make the parent 0l otherwise it get's deleted 290 /* Hmmm damn we need to make the parent 0l otherwise it get's deleted
291 * past the QApplication 291 * past the QApplication
292 */ 292 */
293 m_sys = new QCopChannel( "QPE/System", 0l); 293 m_sys = new QCopChannel( "QPE/System", 0l);
294 connect(m_sys, SIGNAL( received( const QCString&, const QByteArray& ) ), 294 connect(m_sys, SIGNAL( received(const QCString&,const QByteArray&) ),
295 this, SLOT(systemMessage( const QCString&, const QByteArray& ) ) ); 295 this, SLOT(systemMessage(const QCString&,const QByteArray&) ) );
296 296
297 // private channel QPE/Application/appname 297 // private channel QPE/Application/appname
298 QCString channel = QCString( argv[0] ); 298 QCString channel = QCString( argv[0] );
299 channel.replace( QRegExp( ".*/"), "" ); 299 channel.replace( QRegExp( ".*/"), "" );
300 d->appName = channel; 300 d->appName = channel;
301 channel = "QPE/Application/"+ channel; 301 channel = "QPE/Application/"+ channel;
302 m_pid = new QCopChannel( channel, 0l ); 302 m_pid = new QCopChannel( channel, 0l );
303 connect(m_pid, SIGNAL( received( const QCString&, const QByteArray& ) ), 303 connect(m_pid, SIGNAL( received(const QCString&,const QByteArray&) ),
304 this, SLOT( pidMessage( const QCString&, const QByteArray& ) ) ); 304 this, SLOT( pidMessage(const QCString&,const QByteArray&) ) );
305 305
306 // read the Pre QCOP Stuff from the file 306 // read the Pre QCOP Stuff from the file
307 if ( file.isOpen() ) { 307 if ( file.isOpen() ) {
308 d->keep_running = FALSE; 308 d->keep_running = FALSE;
309 QDataStream ds( &file ); 309 QDataStream ds( &file );
310 QCString chanel, message; 310 QCString chanel, message;
311 QByteArray data; 311 QByteArray data;
312 while (!ds.atEnd() ) { 312 while (!ds.atEnd() ) {
313 ds >> chanel >> message >> data; 313 ds >> chanel >> message >> data;
314 d->enqueueQCop( chanel, message, data ); 314 d->enqueueQCop( chanel, message, data );
315 } 315 }
316 flock( file.handle(), LOCK_UN ); 316 flock( file.handle(), LOCK_UN );
317 file.close(); 317 file.close();
318 file.remove(); 318 file.remove();
319 } 319 }
320 320
321 // read in some stuff from the command line 321 // read in some stuff from the command line
322 // we do not have setArgs so we need to take 322 // we do not have setArgs so we need to take
323 // care of that 323 // care of that
324 for ( int a = 0; a < arg; a++ ) { 324 for ( int a = 0; a < arg; a++ ) {
325 if ( qstrcmp( argv[a], "-preload" ) == 0 ) { 325 if ( qstrcmp( argv[a], "-preload" ) == 0 ) {
326 d->preloaded = TRUE; 326 d->preloaded = TRUE;
327 }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) { 327 }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) {
328 d->preloaded = TRUE; 328 d->preloaded = TRUE;
329 d->forceshow = TRUE; 329 d->forceshow = TRUE;
330 } 330 }
331 } 331 }
332 initTranslations(); 332 initTranslations();
333 applyStyle(); 333 applyStyle();
334 334
335 if ( type() == GuiServer ) 335 if ( type() == GuiServer )
336 ; 336 ;
337 337
338 installEventFilter( this ); 338 installEventFilter( this );
339 QPEMenuToolFocusManager::initialize(); 339 QPEMenuToolFocusManager::initialize();
340} 340}
341void QPEApplication::initTranslations() { 341void QPEApplication::initTranslations() {
342 // Translations add it 342 // Translations add it
343 QStringList langs = Global::languageList(); 343 QStringList langs = Global::languageList();
344 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { 344 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) {
345 QString lang = *it; 345 QString lang = *it;
346 346
347 QTranslator * trans; 347 QTranslator * trans;
348 QString tfn; 348 QString tfn;
349 349
350 trans = new QTranslator( this ); 350 trans = new QTranslator( this );
351 tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; 351 tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm";
352 if ( trans->load( tfn ) ) 352 if ( trans->load( tfn ) )
diff --git a/x11/libqpe-x11/qt/qcopchannel_qws.cpp b/x11/libqpe-x11/qt/qcopchannel_qws.cpp
index 706756e..a82ba4d 100644
--- a/x11/libqpe-x11/qt/qcopchannel_qws.cpp
+++ b/x11/libqpe-x11/qt/qcopchannel_qws.cpp
@@ -1,64 +1,64 @@
1 1
2#include "../../ipc/client/ocopclient.h" 2#include "../../ipc/client/ocopclient.h"
3 3
4#include <qcopchannel_qws.h> 4#include <qcopchannel_qws.h>
5 5
6QList<QCopChannel>* QCopChannel::m_list = 0; 6QList<QCopChannel>* QCopChannel::m_list = 0;
7QMap<QCString, int> QCopChannel::m_refCount; 7QMap<QCString, int> QCopChannel::m_refCount;
8 8
9QCopChannel::QCopChannel( const QCString& channel, QObject* parent, 9QCopChannel::QCopChannel( const QCString& channel, QObject* parent,
10 const char* name ) 10 const char* name )
11 : QObject( parent, name ),m_chan(channel) { 11 : QObject( parent, name ),m_chan(channel) {
12 if (!m_list ) { 12 if (!m_list ) {
13 m_list = new QList<QCopChannel>; 13 m_list = new QList<QCopChannel>;
14 /* only connect once */ 14 /* only connect once */
15 connect(OCOPClient::self(), SIGNAL(called(const QCString&, const QCString&, const QByteArray& ) ), 15 connect(OCOPClient::self(), SIGNAL(called(const QCString&,const QCString&,const QByteArray&) ),
16 this, SLOT(rev(const QCString&, const QCString&, const QByteArray&) ) ); 16 this, SLOT(rev(const QCString&,const QCString&,const QByteArray&) ) );
17 } 17 }
18 /* first registration or ref count is 0 for m_chan*/ 18 /* first registration or ref count is 0 for m_chan*/
19 if (!m_refCount.contains( m_chan ) || !m_refCount[m_chan] ) { 19 if (!m_refCount.contains( m_chan ) || !m_refCount[m_chan] ) {
20 qWarning("adding channel %s", m_chan.data() ); 20 qWarning("adding channel %s", m_chan.data() );
21 m_refCount[m_chan] = 1; 21 m_refCount[m_chan] = 1;
22 OCOPClient::self()->addChannel( m_chan ); 22 OCOPClient::self()->addChannel( m_chan );
23 }else{ 23 }else{
24 qWarning("reffing up for %s %d", m_chan.data(), m_refCount[m_chan] ); 24 qWarning("reffing up for %s %d", m_chan.data(), m_refCount[m_chan] );
25 m_refCount[m_chan]++; 25 m_refCount[m_chan]++;
26 } 26 }
27 27
28 m_list->append(this); 28 m_list->append(this);
29} 29}
30void QCopChannel::receive( const QCString& msg, const QByteArray& ar ) { 30void QCopChannel::receive( const QCString& msg, const QByteArray& ar ) {
31 emit received( msg, ar ); 31 emit received( msg, ar );
32} 32}
33QCopChannel::~QCopChannel() { 33QCopChannel::~QCopChannel() {
34 if (m_refCount[m_chan] == 1 ) { 34 if (m_refCount[m_chan] == 1 ) {
35 OCOPClient::self()->delChannel( m_chan ); 35 OCOPClient::self()->delChannel( m_chan );
36 m_refCount[m_chan] = 0; 36 m_refCount[m_chan] = 0;
37 }else 37 }else
38 m_refCount[m_chan]--; 38 m_refCount[m_chan]--;
39 39
40 40
41 m_list->remove(this); 41 m_list->remove(this);
42 if (m_list->count() == 0 ) { 42 if (m_list->count() == 0 ) {
43 delete m_list; 43 delete m_list;
44 m_list = 0; 44 m_list = 0;
45 } 45 }
46 46
47} 47}
48QCString QCopChannel::channel()const { 48QCString QCopChannel::channel()const {
49 return m_chan; 49 return m_chan;
50} 50}
51bool QCopChannel::isRegistered( const QCString& chan) { 51bool QCopChannel::isRegistered( const QCString& chan) {
52 if (m_refCount.contains(chan) ) { 52 if (m_refCount.contains(chan) ) {
53 qDebug("Client:locally contains"); 53 qDebug("Client:locally contains");
54 return true; 54 return true;
55 } 55 }
56 return OCOPClient::self()->isRegistered( chan ); 56 return OCOPClient::self()->isRegistered( chan );
57} 57}
58bool QCopChannel::send( const QCString& chan, const QCString& msg ) { 58bool QCopChannel::send( const QCString& chan, const QCString& msg ) {
59 QByteArray ar; 59 QByteArray ar;
60 return send(chan, msg, ar ); 60 return send(chan, msg, ar );
61} 61}
62bool QCopChannel::send( const QCString& chan, const QCString& msg, 62bool QCopChannel::send( const QCString& chan, const QCString& msg,
63 const QByteArray& ar ) { 63 const QByteArray& ar ) {
64 OCOPClient::self()->send( chan, msg, ar ); 64 OCOPClient::self()->send( chan, msg, ar );