-rw-r--r-- | core/tools/quicklauncher/Makefile | 238 | ||||
-rw-r--r-- | core/tools/quicklauncher/Makefile.in | 106 | ||||
-rw-r--r-- | core/tools/quicklauncher/main.cpp | 241 | ||||
-rw-r--r-- | core/tools/quicklauncher/qpe-quicklauncher.control | 10 | ||||
-rw-r--r-- | core/tools/quicklauncher/quicklauncher.pro | 11 |
5 files changed, 606 insertions, 0 deletions
diff --git a/core/tools/quicklauncher/Makefile b/core/tools/quicklauncher/Makefile new file mode 100644 index 0000000..23b2fd0 --- a/dev/null +++ b/core/tools/quicklauncher/Makefile | |||
@@ -0,0 +1,238 @@ | |||
1 | ############################################################################# | ||
2 | # Automatically generated from tools/quicklauncher/Makefile.in | ||
3 | # Build options from | ||
4 | ############################################################################# | ||
5 | |||
6 | default: all # package | ||
7 | |||
8 | CONTROL = tools/quicklauncher/qpe-quicklauncher.control | ||
9 | |||
10 | # Compiling | ||
11 | INTERFACE_DECL_PATH = . | ||
12 | SYSCONF_CXX = g++ | ||
13 | SYSCONF_CC = gcc | ||
14 | DASHCROSS = | ||
15 | |||
16 | # Compiling with support libraries | ||
17 | SYSCONF_CXXFLAGS_X11= | ||
18 | SYSCONF_CXXFLAGS_QT= -I$(QTDIR)/include | ||
19 | SYSCONF_CXXFLAGS_QTOPIA= -I$(QPEDIR)/include | ||
20 | SYSCONF_CFLAGS_QTOPIA= -I$(QPEDIR)/include | ||
21 | SYSCONF_CXXFLAGS_OPENGL= -I/usr/X11R6/include | ||
22 | |||
23 | # Compiling YACC output | ||
24 | SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses | ||
25 | |||
26 | # Linking with support libraries | ||
27 | SYSCONF_RPATH_X11= | ||
28 | SYSCONF_RPATH_QT= -Wl,-rpath,$(QTDIR)/lib | ||
29 | SYSCONF_RPATH_QTOPIA= -Wl,-rpath,$(QPEDIR)/lib | ||
30 | SYSCONF_RPATH_OPENGL= -Wl,-rpath,/usr/X11R6/lib | ||
31 | |||
32 | # Linking with support libraries | ||
33 | # X11 | ||
34 | SYSCONF_LFLAGS_X11= | ||
35 | SYSCONF_LIBS_X11= | ||
36 | # Qt, Qt+OpenGL | ||
37 | SYSCONF_LFLAGS_QT= -L$(QTDIR)/lib | ||
38 | SYSCONF_LFLAGS_QTOPIA= -L$(QPEDIR)/lib | ||
39 | SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX) | ||
40 | SYSCONF_LIBS_QT_OPENGL= | ||
41 | SYSCONF_LIBS_QTOPIA= -lqtopia | ||
42 | # OpenGL | ||
43 | SYSCONF_LFLAGS_OPENGL= -L/usr/X11R6/lib | ||
44 | SYSCONF_LIBS_OPENGL= | ||
45 | # Yacc | ||
46 | SYSCONF_LIBS_YACC= | ||
47 | |||
48 | # Linking applications | ||
49 | SYSCONF_LINK = gcc | ||
50 | SYSCONF_LFLAGS = | ||
51 | SYSCONF_LIBS = | ||
52 | |||
53 | # Link flags for shared objects | ||
54 | SYSCONF_LFLAGS_SHOBJ= -shared | ||
55 | |||
56 | # Flags for threading | ||
57 | SYSCONF_CFLAGS_THREAD= -D_REENTRANT | ||
58 | SYSCONF_CXXFLAGS_THREAD= -D_REENTRANT | ||
59 | SYSCONF_LFLAGS_THREAD= | ||
60 | SYSCONF_LIBS_THREAD= -lpthread | ||
61 | |||
62 | # Meta-object compiler | ||
63 | SYSCONF_MOC = $(QTDIR)/bin/moc | ||
64 | |||
65 | # UI compiler | ||
66 | SYSCONF_UIC = $(QTDIR)/bin/uic | ||
67 | |||
68 | # Linking shared libraries | ||
69 | # - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2 | ||
70 | # - Place target in $(DESTDIR) - which has a trailing / | ||
71 | # - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH) | ||
72 | # | ||
73 | SYSCONF_LINK_SHLIB= gcc | ||
74 | SYSCONF_LINK_TARGET_SHARED= lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH) | ||
75 | SYSCONF_LINK_LIB_SHARED= $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \ | ||
76 | $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \ | ||
77 | $(OBJECTS) $(OBJMOC) $(LIBS) && \ | ||
78 | mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \ | ||
79 | cd $(DESTDIR) && \ | ||
80 | rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \ | ||
81 | ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \ | ||
82 | ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \ | ||
83 | ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN) | ||
84 | |||
85 | # Linking static libraries | ||
86 | # - Build the $(TARGET) library, eg. lib$(TARGET).a | ||
87 | # - Place target in $(DESTDIR) - which has a trailing / | ||
88 | # | ||
89 | SYSCONF_AR = ar cqs | ||
90 | SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a | ||
91 | SYSCONF_LINK_LIB_STATIC= rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \ | ||
92 | $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC) | ||
93 | # Compiling application source | ||
94 | SYSCONF_CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W -DNO_DEBUG | ||
95 | SYSCONF_CFLAGS = -pipe -O2 -Wall -W | ||
96 | # Default link type (static linking is still be used where required) | ||
97 | SYSCONF_LINK_LIB= $(SYSCONF_LINK_LIB_SHARED) | ||
98 | SYSCONF_LINK_TARGET= $(SYSCONF_LINK_TARGET_SHARED) | ||
99 | # Compiling library source | ||
100 | SYSCONF_CXXFLAGS_LIB= -fPIC | ||
101 | SYSCONF_CFLAGS_LIB= -fPIC | ||
102 | # Compiling shared-object source | ||
103 | SYSCONF_CXXFLAGS_SHOBJ= -fPIC | ||
104 | SYSCONF_CFLAGS_SHOBJ= -fPIC | ||
105 | # Linking Qt | ||
106 | SYSCONF_LIBS_QTLIB= $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) | ||
107 | # Linking Qt applications | ||
108 | SYSCONF_LIBS_QTAPP= | ||
109 | |||
110 | # Platform output directories | ||
111 | MOC_DIR = .moc/linux-generic-g++/ | ||
112 | OBJECTS_DIR = .obj/linux-generic-g++/ | ||
113 | |||
114 | ############################################################################# | ||
115 | |||
116 | ####### Compiler, tools and options | ||
117 | |||
118 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) | ||
119 | CXXFLAGS=$(SYSCONF_CXXFLAGS_QTOPIA) $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) -DQTOPIA_APP_INTERFACE | ||
120 | CC =$(SYSCONF_CC) $(QT_C_MT) | ||
121 | CFLAGS =$(SYSCONF_CFLAGS_QTOPIA) $(SYSCONF_CFLAGS) -DQTOPIA_APP_INTERFACE | ||
122 | INCPATH =-I$(MOC_DIR) | ||
123 | LFLAGS =$(SYSCONF_LFLAGS_QTOPIA) $(SYSCONF_RPATH_QTOPIA) $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) | ||
124 | LIBS =$(SUBLIBS) -lqpepim -lpthread -lqpe $(SYSCONF_LIBS_QTOPIA) $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) | ||
125 | MOC =$(SYSCONF_MOC) | ||
126 | UIC =$(SYSCONF_UIC) | ||
127 | |||
128 | ####### Target | ||
129 | |||
130 | DESTDIR = $(QPEDIR)/bin/ | ||
131 | VER_MAJ = 1 | ||
132 | VER_MIN = 0 | ||
133 | VER_PATCH = 0 | ||
134 | TARGET= quicklauncher | ||
135 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | ||
136 | |||
137 | ####### Files | ||
138 | |||
139 | HEADERS = | ||
140 | SOURCES =main.cpp | ||
141 | OBJECTS =$(OBJECTS_DIR)/main.o | ||
142 | INTERFACES = | ||
143 | UICDECLS = | ||
144 | UICIMPLS = | ||
145 | SRCMOC =$(MOC_DIR)/main.moc | ||
146 | OBJMOC = | ||
147 | |||
148 | |||
149 | ####### Implicit rules | ||
150 | |||
151 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
152 | |||
153 | .cpp.o: | ||
154 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
155 | |||
156 | .cxx.o: | ||
157 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
158 | |||
159 | .cc.o: | ||
160 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
161 | |||
162 | .C.o: | ||
163 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
164 | |||
165 | .c.o: | ||
166 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
167 | |||
168 | ####### Build rules | ||
169 | |||
170 | |||
171 | all: $(DESTDIR)$(TARGET) | ||
172 | |||
173 | $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
174 | $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
175 | |||
176 | moc: $(SRCMOC) | ||
177 | |||
178 | tmake: | ||
179 | tmake quicklauncher.pro | ||
180 | |||
181 | clean: | ||
182 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) | ||
183 | -rm -f *~ core | ||
184 | -rm -f allmoc.cpp | ||
185 | |||
186 | ####### Extension Modules | ||
187 | |||
188 | listpromodules: | ||
189 | @echo | ||
190 | |||
191 | listallmodules: | ||
192 | @echo | ||
193 | |||
194 | listaddonpromodules: | ||
195 | @echo | ||
196 | |||
197 | listaddonentmodules: | ||
198 | @echo | ||
199 | |||
200 | |||
201 | REQUIRES= | ||
202 | |||
203 | ####### Sub-libraries | ||
204 | |||
205 | |||
206 | ###### Combined headers | ||
207 | |||
208 | |||
209 | |||
210 | ####### Compile | ||
211 | |||
212 | $(OBJECTS_DIR)/main.o: main.cpp \ | ||
213 | $(MOC_DIR)/main.moc | ||
214 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/main.o main.cpp | ||
215 | |||
216 | $(MOC_DIR)/main.moc: main.cpp | ||
217 | $(MOC) main.cpp -o $(MOC_DIR)/main.moc | ||
218 | |||
219 | |||
220 | |||
221 | lupdate-check: | ||
222 | @true | ||
223 | |||
224 | lupdate: | ||
225 | @true | ||
226 | |||
227 | lrelease: | ||
228 | @echo "No TRANSLATIONS" | ||
229 | |||
230 | |||
231 | ipkg: $(DESTDIR)$(TARGET) # among other things... | ||
232 | CTL="$(CONTROL)"; for ctrl in $$CTL; do cd $(QPEDIR)/ipkg; ../bin/mkipks -platform generic $(QPEDIR)/src/$$ctrl ; done | ||
233 | |||
234 | package: ipkg | ||
235 | cd $(QPEDIR)/ipkg; ../bin/mkPackages | ||
236 | |||
237 | Makefile: quicklauncher.pro | ||
238 | cd $(QPEDIR)/src; ./configure -platform generic -make tools/quicklauncher | ||
diff --git a/core/tools/quicklauncher/Makefile.in b/core/tools/quicklauncher/Makefile.in new file mode 100644 index 0000000..8c7892a --- a/dev/null +++ b/core/tools/quicklauncher/Makefile.in | |||
@@ -0,0 +1,106 @@ | |||
1 | ############################################################################# | ||
2 | |||
3 | ####### Compiler, tools and options | ||
4 | |||
5 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) | ||
6 | CXXFLAGS=$(SYSCONF_CXXFLAGS_QTOPIA) $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) -DQTOPIA_APP_INTERFACE | ||
7 | CC =$(SYSCONF_CC) $(QT_C_MT) | ||
8 | CFLAGS =$(SYSCONF_CFLAGS_QTOPIA) $(SYSCONF_CFLAGS) -DQTOPIA_APP_INTERFACE | ||
9 | INCPATH =-I$(MOC_DIR) | ||
10 | LFLAGS =$(SYSCONF_LFLAGS_QTOPIA) $(SYSCONF_RPATH_QTOPIA) $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) | ||
11 | LIBS =$(SUBLIBS) -lqpepim -lpthread -lqpe $(SYSCONF_LIBS_QTOPIA) $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) | ||
12 | MOC =$(SYSCONF_MOC) | ||
13 | UIC =$(SYSCONF_UIC) | ||
14 | |||
15 | ####### Target | ||
16 | |||
17 | DESTDIR = $(QPEDIR)/bin/ | ||
18 | VER_MAJ = 1 | ||
19 | VER_MIN = 0 | ||
20 | VER_PATCH = 0 | ||
21 | TARGET= quicklauncher | ||
22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | ||
23 | |||
24 | ####### Files | ||
25 | |||
26 | HEADERS = | ||
27 | SOURCES =main.cpp | ||
28 | OBJECTS =$(OBJECTS_DIR)/main.o | ||
29 | INTERFACES = | ||
30 | UICDECLS = | ||
31 | UICIMPLS = | ||
32 | SRCMOC =$(MOC_DIR)/main.moc | ||
33 | OBJMOC = | ||
34 | |||
35 | |||
36 | ####### Implicit rules | ||
37 | |||
38 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
39 | |||
40 | .cpp.o: | ||
41 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
42 | |||
43 | .cxx.o: | ||
44 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
45 | |||
46 | .cc.o: | ||
47 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
48 | |||
49 | .C.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .c.o: | ||
53 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | ####### Build rules | ||
56 | |||
57 | |||
58 | all: $(DESTDIR)$(TARGET) | ||
59 | |||
60 | $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
61 | $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
62 | |||
63 | moc: $(SRCMOC) | ||
64 | |||
65 | tmake: | ||
66 | tmake quicklauncher.pro | ||
67 | |||
68 | clean: | ||
69 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) | ||
70 | -rm -f *~ core | ||
71 | -rm -f allmoc.cpp | ||
72 | |||
73 | ####### Extension Modules | ||
74 | |||
75 | listpromodules: | ||
76 | @echo | ||
77 | |||
78 | listallmodules: | ||
79 | @echo | ||
80 | |||
81 | listaddonpromodules: | ||
82 | @echo | ||
83 | |||
84 | listaddonentmodules: | ||
85 | @echo | ||
86 | |||
87 | |||
88 | REQUIRES= | ||
89 | |||
90 | ####### Sub-libraries | ||
91 | |||
92 | |||
93 | ###### Combined headers | ||
94 | |||
95 | |||
96 | |||
97 | ####### Compile | ||
98 | |||
99 | $(OBJECTS_DIR)/main.o: main.cpp \ | ||
100 | $(MOC_DIR)/main.moc | ||
101 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/main.o main.cpp | ||
102 | |||
103 | $(MOC_DIR)/main.moc: main.cpp | ||
104 | $(MOC) main.cpp -o $(MOC_DIR)/main.moc | ||
105 | |||
106 | |||
diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp new file mode 100644 index 0000000..e509908 --- a/dev/null +++ b/core/tools/quicklauncher/main.cpp | |||
@@ -0,0 +1,241 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2003 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #include <qpainter.h> | ||
22 | #include <qstrlist.h> | ||
23 | #include <qtimer.h> | ||
24 | #include <qguardedptr.h> | ||
25 | #include <qcopchannel_qws.h> | ||
26 | #define QTOPIA_INTERNAL_INITAPP | ||
27 | #include <qtopia/timezone.h> | ||
28 | #include <qtopia/qpeapplication.h> | ||
29 | #include <qtopia/resource.h> | ||
30 | #include <qtopia/pluginloader.h> | ||
31 | #include <stdio.h> | ||
32 | #include <stdlib.h> | ||
33 | #include <sys/types.h> | ||
34 | #include <sys/stat.h> | ||
35 | #include <unistd.h> | ||
36 | |||
37 | static QPEApplication *app = 0; | ||
38 | static PluginLoader *loader = 0; | ||
39 | static ApplicationInterface *appIface = 0; | ||
40 | static QGuardedPtr<QWidget> mainWindow; | ||
41 | |||
42 | #ifdef _OS_LINUX_ | ||
43 | static char **argv0 = 0; | ||
44 | static int argv_lth; | ||
45 | extern char **environ; | ||
46 | #ifndef SPT_BUFSIZE | ||
47 | #define SPT_BUFSIZE 2048 | ||
48 | #endif | ||
49 | #include <stdarg.h> | ||
50 | void setproctitle (const char *fmt,...) { | ||
51 | int i; | ||
52 | char buf[SPT_BUFSIZE]; | ||
53 | va_list ap; | ||
54 | |||
55 | if (!argv0) | ||
56 | return; | ||
57 | |||
58 | va_start(ap, fmt); | ||
59 | (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap); | ||
60 | va_end(ap); | ||
61 | |||
62 | i = strlen (buf); | ||
63 | if (i > argv_lth - 2) { | ||
64 | i = argv_lth - 2; | ||
65 | buf[i] = '\0'; | ||
66 | } | ||
67 | memset(argv0[0], '\0', argv_lth); /* clear the memory area */ | ||
68 | (void) strcpy (argv0[0], buf); | ||
69 | |||
70 | argv0[1] = NULL; | ||
71 | } | ||
72 | #endif | ||
73 | |||
74 | |||
75 | class QuickLauncher : public QObject | ||
76 | { | ||
77 | Q_OBJECT | ||
78 | public: | ||
79 | QuickLauncher() : QObject() | ||
80 | { | ||
81 | QCString ch("QPE/QuickLauncher-"); | ||
82 | ch += QString::number(getpid()); | ||
83 | qlChannel = new QCopChannel( ch, this); | ||
84 | connect( qlChannel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
85 | this, SLOT(message(const QCString&, const QByteArray&)) ); | ||
86 | } | ||
87 | |||
88 | static void exec( int /*argc*/, char **argv ) | ||
89 | { | ||
90 | QString appName = argv[0]; | ||
91 | int sep = appName.findRev( '/' ); | ||
92 | if ( sep > 0 ) | ||
93 | appName = appName.mid( sep+1 ); | ||
94 | |||
95 | appIface = 0; | ||
96 | if ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) == QS_OK ) { | ||
97 | mainWindow = appIface->createMainWindow( appName ); | ||
98 | } | ||
99 | if ( mainWindow ) { | ||
100 | if ( mainWindow->metaObject()->slotNames().contains("setDocument(const QString&)") ) { | ||
101 | app->showMainDocumentWidget( mainWindow ); | ||
102 | } else { | ||
103 | app->showMainWidget( mainWindow ); | ||
104 | } | ||
105 | } else { | ||
106 | qWarning( "Could not create application main window" ); | ||
107 | exit(-1); | ||
108 | } | ||
109 | } | ||
110 | |||
111 | private slots: | ||
112 | void message(const QCString &msg, const QByteArray & data) | ||
113 | { | ||
114 | QStrList argList; | ||
115 | |||
116 | if ( msg == "execute(QStrList)" ) { | ||
117 | delete qlChannel; | ||
118 | QDataStream stream( data, IO_ReadOnly ); | ||
119 | QStrList argList; | ||
120 | stream >> argList; | ||
121 | qDebug( "QuickLauncher execute: %s", argList.at(0) ); | ||
122 | doQuickLaunch( argList ); | ||
123 | delete this; | ||
124 | } else if ( msg == "execute(QString)" ) { | ||
125 | delete qlChannel; | ||
126 | QDataStream stream( data, IO_ReadOnly ); | ||
127 | QString arg; | ||
128 | stream >> arg; | ||
129 | qDebug( "QuickLauncher execute: %s", arg.latin1() ); | ||
130 | QStrList argList; | ||
131 | argList.append( arg.utf8() ); | ||
132 | doQuickLaunch( argList ); | ||
133 | delete this; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | private: | ||
138 | void doQuickLaunch( QStrList &argList ) | ||
139 | { | ||
140 | static int myargc = argList.count(); | ||
141 | static char **myargv = new char *[myargc + 1]; | ||
142 | for ( int j = 0; j < myargc; j++ ) { | ||
143 | myargv[j] = new char [strlen(argList.at(j))+1]; | ||
144 | strcpy( myargv[j], argList.at(j) ); | ||
145 | } | ||
146 | myargv[myargc] = NULL; | ||
147 | #ifdef _OS_LINUX_ | ||
148 | // Change name of process | ||
149 | setproctitle(myargv[0]); | ||
150 | #endif | ||
151 | |||
152 | connect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); | ||
153 | app->exit_loop(); | ||
154 | app->initApp( myargc, myargv ); | ||
155 | exec( myargc, myargv ); | ||
156 | } | ||
157 | |||
158 | private: | ||
159 | QCopChannel *qlChannel; | ||
160 | }; | ||
161 | |||
162 | int main( int argc, char** argv ) | ||
163 | { | ||
164 | app = new QPEApplication( argc, argv ); | ||
165 | |||
166 | loader = new PluginLoader( "application" ); | ||
167 | |||
168 | unsetenv( "LD_BIND_NOW" ); | ||
169 | |||
170 | QCString arg0 = argv[0]; | ||
171 | int sep = arg0.findRev( '/' ); | ||
172 | if ( sep > 0 ) | ||
173 | arg0 = arg0.mid( sep+1 ); | ||
174 | if ( arg0 != "quicklauncher" ) { | ||
175 | qDebug( "QuickLauncher invoked as: %s", arg0.data() ); | ||
176 | QuickLauncher::exec( argc, argv ); | ||
177 | } else { | ||
178 | #ifdef _OS_LINUX_ | ||
179 | // Setup to change proc title | ||
180 | int i; | ||
181 | char **envp = environ; | ||
182 | /* Move the environment so we can reuse the memory. | ||
183 | * (Code borrowed from sendmail.) */ | ||
184 | for (i = 0; envp[i] != NULL; i++) | ||
185 | continue; | ||
186 | environ = (char **) malloc(sizeof(char *) * (i + 1)); | ||
187 | if (environ == NULL) | ||
188 | return -1; | ||
189 | for (i = 0; envp[i] != NULL; i++) | ||
190 | if ((environ[i] = strdup(envp[i])) == NULL) | ||
191 | return -1; | ||
192 | environ[i] = NULL; | ||
193 | |||
194 | argv0 = argv; | ||
195 | if (i > 0) | ||
196 | argv_lth = envp[i-1] + strlen(envp[i-1]) - argv0[0]; | ||
197 | else | ||
198 | argv_lth = argv0[argc-1] + strlen(argv0[argc-1]) - argv0[0]; | ||
199 | #endif | ||
200 | (void)new QuickLauncher(); | ||
201 | qDebug( "QuickLauncher running" ); | ||
202 | // Pre-load default fonts | ||
203 | QFontMetrics fm( QApplication::font() ); | ||
204 | fm.ascent(); // causes font load. | ||
205 | QFont f( QApplication::font() ); | ||
206 | f.setWeight( QFont::Bold ); | ||
207 | QFontMetrics fmb( f ); | ||
208 | fmb.ascent(); // causes font load. | ||
209 | |||
210 | // Each of the following force internal structures/internal | ||
211 | // initialization to be performed. This may mean allocating | ||
212 | // memory that is not needed by all applications. | ||
213 | TimeZone::current().isValid(); // popuplate timezone cache | ||
214 | TimeString::currentDateFormat(); // create internal structures | ||
215 | TimeString::currentAMPM(); | ||
216 | Resource::loadIconSet("new"); // do internal init | ||
217 | |||
218 | // Create a widget to force initialization of title bar images, etc. | ||
219 | QObject::disconnect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); | ||
220 | QWidget *w = new QWidget(0,0,Qt::WDestructiveClose|Qt::WStyle_ContextHelp|Qt::WStyle_Tool); | ||
221 | w->setGeometry( -100, -100, 10, 10 ); | ||
222 | w->show(); | ||
223 | QTimer::singleShot( 0, w, SLOT(close()) ); | ||
224 | |||
225 | app->enter_loop(); | ||
226 | } | ||
227 | |||
228 | int rv = app->exec(); | ||
229 | |||
230 | if ( mainWindow ) | ||
231 | delete (QWidget*)mainWindow; | ||
232 | if ( appIface ) | ||
233 | loader->releaseInterface( appIface ); | ||
234 | delete loader; | ||
235 | |||
236 | delete app; | ||
237 | |||
238 | return rv; | ||
239 | } | ||
240 | |||
241 | #include "main.moc" | ||
diff --git a/core/tools/quicklauncher/qpe-quicklauncher.control b/core/tools/quicklauncher/qpe-quicklauncher.control new file mode 100644 index 0000000..f07a7d5 --- a/dev/null +++ b/core/tools/quicklauncher/qpe-quicklauncher.control | |||
@@ -0,0 +1,10 @@ | |||
1 | Files: bin/quicklauncher | ||
2 | Priority: required | ||
3 | Section: qpe/system | ||
4 | Maintainer: Trolltech (www.trolltech.com) | ||
5 | Architecture: $CPU_ARCH | ||
6 | Arch: $DEVICE_ARCH | ||
7 | Version: $QPE_VERSION-12 | ||
8 | Depends: qpe-libqtopia qpe-pim | ||
9 | Description: Quick launcher stub | ||
10 | Launcher stub for quick launch enabled applications. | ||
diff --git a/core/tools/quicklauncher/quicklauncher.pro b/core/tools/quicklauncher/quicklauncher.pro new file mode 100644 index 0000000..52e2106 --- a/dev/null +++ b/core/tools/quicklauncher/quicklauncher.pro | |||
@@ -0,0 +1,11 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG += qtopia warn_on release | ||
3 | DESTDIR = $(QPEDIR)/bin | ||
4 | |||
5 | HEADERS = | ||
6 | SOURCES = main.cpp | ||
7 | INTERFACES= | ||
8 | |||
9 | unix:LIBS += -lqpepim -lpthread | ||
10 | |||
11 | TARGET = quicklauncher | ||