summaryrefslogtreecommitdiff
path: root/core/tools/quicklauncher/main.cpp
Unidiff
Diffstat (limited to 'core/tools/quicklauncher/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/tools/quicklauncher/main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp
index cc411fd..1d6774c 100644
--- a/core/tools/quicklauncher/main.cpp
+++ b/core/tools/quicklauncher/main.cpp
@@ -41,98 +41,98 @@
41 41
42static QPEApplication *app = 0; 42static QPEApplication *app = 0;
43static PluginLoader *loader = 0; 43static PluginLoader *loader = 0;
44static ApplicationInterface *appIface = 0; 44static ApplicationInterface *appIface = 0;
45static QGuardedPtr<QWidget> mainWindow; 45static QGuardedPtr<QWidget> mainWindow;
46 46
47#ifdef _OS_LINUX_ 47#ifdef _OS_LINUX_
48static char **argv0 = 0; 48static char **argv0 = 0;
49static int argv_lth; 49static int argv_lth;
50extern char **environ; 50extern char **environ;
51#ifndef SPT_BUFSIZE 51#ifndef SPT_BUFSIZE
52#define SPT_BUFSIZE 2048 52#define SPT_BUFSIZE 2048
53#endif 53#endif
54#include <stdarg.h> 54#include <stdarg.h>
55void setproctitle (const char *fmt,...) { 55void setproctitle (const char *fmt,...) {
56 int i; 56 int i;
57 char buf[SPT_BUFSIZE]; 57 char buf[SPT_BUFSIZE];
58 va_list ap; 58 va_list ap;
59 59
60 if (!argv0) 60 if (!argv0)
61 return; 61 return;
62 62
63 va_start(ap, fmt); 63 va_start(ap, fmt);
64 (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap); 64 (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap);
65 va_end(ap); 65 va_end(ap);
66 66
67 i = strlen (buf); 67 i = strlen (buf);
68 if (i > argv_lth - 2) { 68 if (i > argv_lth - 2) {
69 i = argv_lth - 2; 69 i = argv_lth - 2;
70 buf[i] = '\0'; 70 buf[i] = '\0';
71 } 71 }
72 memset(argv0[0], '\0', argv_lth); /* clear the memory area */ 72 memset(argv0[0], '\0', argv_lth); /* clear the memory area */
73 (void) strcpy (argv0[0], buf); 73 (void) strcpy (argv0[0], buf);
74 74
75 argv0[1] = NULL; 75 argv0[1] = NULL;
76} 76}
77#endif 77#endif
78 78
79 79
80class QuickLauncher : public QObject 80class QuickLauncher : public QObject
81{ 81{
82 Q_OBJECT 82 Q_OBJECT
83public: 83public:
84 QuickLauncher() : QObject() 84 QuickLauncher() : QObject()
85 { 85 {
86 QCString ch("QPE/QuickLauncher-"); 86 QCString ch("QPE/QuickLauncher-");
87 ch += QString::number(getpid()); 87 ch += QString::number(getpid());
88 qlChannel = new QCopChannel( ch, this); 88 qlChannel = new QCopChannel( ch, this);
89 connect( qlChannel, SIGNAL(received(const QCString&, const QByteArray&)), 89 connect( qlChannel, SIGNAL(received(const QCString&,const QByteArray&)),
90 this, SLOT(message(const QCString&, const QByteArray&)) ); 90 this, SLOT(message(const QCString&,const QByteArray&)) );
91 } 91 }
92 92
93 static void exec( int /*argc*/, char **argv ) 93 static void exec( int /*argc*/, char **argv )
94 { 94 {
95 QString appName = argv[0]; 95 QString appName = argv[0];
96 int sep = appName.findRev( '/' ); 96 int sep = appName.findRev( '/' );
97 if ( sep > 0 ) 97 if ( sep > 0 )
98 appName = appName.mid( sep+1 ); 98 appName = appName.mid( sep+1 );
99 99
100 appIface = 0; 100 appIface = 0;
101 if ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) == QS_OK ) { 101 if ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) == QS_OK ) {
102 mainWindow = appIface->createMainWindow( appName ); 102 mainWindow = appIface->createMainWindow( appName );
103 } 103 }
104 if ( mainWindow ) { 104 if ( mainWindow ) {
105 if ( mainWindow->metaObject()->slotNames().contains("setDocument(const QString&)") ) { 105 if ( mainWindow->metaObject()->slotNames().contains("setDocument(const QString&)") ) {
106 app->showMainDocumentWidget( mainWindow ); 106 app->showMainDocumentWidget( mainWindow );
107 } else { 107 } else {
108 app->showMainWidget( mainWindow ); 108 app->showMainWidget( mainWindow );
109 } 109 }
110 } else { 110 } else {
111 qWarning( "Could not create application main window" ); 111 qWarning( "Could not create application main window" );
112 exit(-1); 112 exit(-1);
113 } 113 }
114 } 114 }
115 115
116private slots: 116private slots:
117 void message(const QCString &msg, const QByteArray & data) 117 void message(const QCString &msg, const QByteArray & data)
118 { 118 {
119 QStrList argList; 119 QStrList argList;
120 120
121 if ( msg == "execute(QStrList)" ) { 121 if ( msg == "execute(QStrList)" ) {
122 delete qlChannel; 122 delete qlChannel;
123 QDataStream stream( data, IO_ReadOnly ); 123 QDataStream stream( data, IO_ReadOnly );
124 QStrList argList; 124 QStrList argList;
125 stream >> argList; 125 stream >> argList;
126 qDebug( "QuickLauncher execute: %s", argList.at(0) ); 126 qDebug( "QuickLauncher execute: %s", argList.at(0) );
127 doQuickLaunch( argList ); 127 doQuickLaunch( argList );
128 delete this; 128 delete this;
129 } else if ( msg == "execute(QString)" ) { 129 } else if ( msg == "execute(QString)" ) {
130 delete qlChannel; 130 delete qlChannel;
131 QDataStream stream( data, IO_ReadOnly ); 131 QDataStream stream( data, IO_ReadOnly );
132 QString arg; 132 QString arg;
133 stream >> arg; 133 stream >> arg;
134 qDebug( "QuickLauncher execute: %s", arg.latin1() ); 134 qDebug( "QuickLauncher execute: %s", arg.latin1() );
135 QStrList argList; 135 QStrList argList;
136 argList.append( arg.utf8() ); 136 argList.append( arg.utf8() );
137 doQuickLaunch( argList ); 137 doQuickLaunch( argList );
138 delete this; 138 delete this;