-rw-r--r-- | core/tools/quicklauncher/.cvsignore | 4 | ||||
-rw-r--r-- | core/tools/quicklauncher/Makefile | 238 | ||||
-rw-r--r-- | core/tools/quicklauncher/Makefile.in | 106 | ||||
-rw-r--r-- | core/tools/quicklauncher/dropins.h | 61 | ||||
-rw-r--r-- | core/tools/quicklauncher/main.cpp | 12 | ||||
-rw-r--r-- | core/tools/quicklauncher/quicklauncher.pro | 10 |
6 files changed, 81 insertions, 350 deletions
diff --git a/core/tools/quicklauncher/.cvsignore b/core/tools/quicklauncher/.cvsignore new file mode 100644 index 0000000..2a38e61 --- a/dev/null +++ b/core/tools/quicklauncher/.cvsignore @@ -0,0 +1,4 @@ +Makefile +*.moc +.moc/ +.obj/
\ No newline at end of file diff --git a/core/tools/quicklauncher/Makefile b/core/tools/quicklauncher/Makefile deleted file mode 100644 index 23b2fd0..0000000 --- a/core/tools/quicklauncher/Makefile +++ b/dev/null @@ -1,238 +0,0 @@ -############################################################################# -# Automatically generated from tools/quicklauncher/Makefile.in -# Build options from -############################################################################# - -default: all # package - -CONTROL = tools/quicklauncher/qpe-quicklauncher.control - -# Compiling -INTERFACE_DECL_PATH = . -SYSCONF_CXX = g++ -SYSCONF_CC = gcc -DASHCROSS = - -# Compiling with support libraries -SYSCONF_CXXFLAGS_X11 = -SYSCONF_CXXFLAGS_QT = -I$(QTDIR)/include -SYSCONF_CXXFLAGS_QTOPIA = -I$(QPEDIR)/include -SYSCONF_CFLAGS_QTOPIA = -I$(QPEDIR)/include -SYSCONF_CXXFLAGS_OPENGL = -I/usr/X11R6/include - -# Compiling YACC output -SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses - -# Linking with support libraries -SYSCONF_RPATH_X11 = -SYSCONF_RPATH_QT = -Wl,-rpath,$(QTDIR)/lib -SYSCONF_RPATH_QTOPIA = -Wl,-rpath,$(QPEDIR)/lib -SYSCONF_RPATH_OPENGL = -Wl,-rpath,/usr/X11R6/lib - -# Linking with support libraries -# X11 -SYSCONF_LFLAGS_X11 = -SYSCONF_LIBS_X11 = -# Qt, Qt+OpenGL -SYSCONF_LFLAGS_QT = -L$(QTDIR)/lib -SYSCONF_LFLAGS_QTOPIA = -L$(QPEDIR)/lib -SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX) -SYSCONF_LIBS_QT_OPENGL = -SYSCONF_LIBS_QTOPIA = -lqtopia -# OpenGL -SYSCONF_LFLAGS_OPENGL = -L/usr/X11R6/lib -SYSCONF_LIBS_OPENGL = -# Yacc -SYSCONF_LIBS_YACC = - -# Linking applications -SYSCONF_LINK = gcc -SYSCONF_LFLAGS = -SYSCONF_LIBS = - -# Link flags for shared objects -SYSCONF_LFLAGS_SHOBJ = -shared - -# Flags for threading -SYSCONF_CFLAGS_THREAD = -D_REENTRANT -SYSCONF_CXXFLAGS_THREAD = -D_REENTRANT -SYSCONF_LFLAGS_THREAD = -SYSCONF_LIBS_THREAD = -lpthread - -# Meta-object compiler -SYSCONF_MOC = $(QTDIR)/bin/moc - -# UI compiler -SYSCONF_UIC = $(QTDIR)/bin/uic - -# Linking shared libraries -# - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2 -# - Place target in $(DESTDIR) - which has a trailing / -# - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH) -# -SYSCONF_LINK_SHLIB = gcc -SYSCONF_LINK_TARGET_SHARED = lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH) -SYSCONF_LINK_LIB_SHARED = $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \ - $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \ - $(OBJECTS) $(OBJMOC) $(LIBS) && \ - mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \ - cd $(DESTDIR) && \ - rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \ - ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \ - ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \ - ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN) - -# Linking static libraries -# - Build the $(TARGET) library, eg. lib$(TARGET).a -# - Place target in $(DESTDIR) - which has a trailing / -# -SYSCONF_AR = ar cqs -SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a -SYSCONF_LINK_LIB_STATIC = rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \ - $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC) -# Compiling application source -SYSCONF_CXXFLAGS = -pipe -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W -DNO_DEBUG -SYSCONF_CFLAGS = -pipe -O2 -Wall -W -# Default link type (static linking is still be used where required) -SYSCONF_LINK_LIB = $(SYSCONF_LINK_LIB_SHARED) -SYSCONF_LINK_TARGET = $(SYSCONF_LINK_TARGET_SHARED) -# Compiling library source -SYSCONF_CXXFLAGS_LIB = -fPIC -SYSCONF_CFLAGS_LIB = -fPIC -# Compiling shared-object source -SYSCONF_CXXFLAGS_SHOBJ = -fPIC -SYSCONF_CFLAGS_SHOBJ = -fPIC -# Linking Qt -SYSCONF_LIBS_QTLIB = $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) -# Linking Qt applications -SYSCONF_LIBS_QTAPP = - -# Platform output directories -MOC_DIR = .moc/linux-generic-g++/ -OBJECTS_DIR = .obj/linux-generic-g++/ - -############################################################################# - -####### Compiler, tools and options - -CXX = $(SYSCONF_CXX) $(QT_CXX_MT) -CXXFLAGS= $(SYSCONF_CXXFLAGS_QTOPIA) $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) -DQTOPIA_APP_INTERFACE -CC = $(SYSCONF_CC) $(QT_C_MT) -CFLAGS = $(SYSCONF_CFLAGS_QTOPIA) $(SYSCONF_CFLAGS) -DQTOPIA_APP_INTERFACE -INCPATH = -I$(MOC_DIR) -LFLAGS = $(SYSCONF_LFLAGS_QTOPIA) $(SYSCONF_RPATH_QTOPIA) $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) -LIBS = $(SUBLIBS) -lqpepim -lpthread -lqpe $(SYSCONF_LIBS_QTOPIA) $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) -MOC = $(SYSCONF_MOC) -UIC = $(SYSCONF_UIC) - -####### Target - -DESTDIR = $(QPEDIR)/bin/ -VER_MAJ = 1 -VER_MIN = 0 -VER_PATCH = 0 -TARGET = quicklauncher -TARGET1 = lib$(TARGET).so.$(VER_MAJ) - -####### Files - -HEADERS = -SOURCES = main.cpp -OBJECTS = $(OBJECTS_DIR)/main.o -INTERFACES = -UICDECLS = -UICIMPLS = -SRCMOC = $(MOC_DIR)/main.moc -OBJMOC = - - -####### Implicit rules - -.SUFFIXES: .cpp .cxx .cc .C .c - -.cpp.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.cxx.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.cc.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.C.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.c.o: - $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< - -####### Build rules - - -all: $(DESTDIR)$(TARGET) - -$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) - $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) - -moc: $(SRCMOC) - -tmake: - tmake quicklauncher.pro - -clean: - -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) - -rm -f *~ core - -rm -f allmoc.cpp - -####### Extension Modules - -listpromodules: - @echo - -listallmodules: - @echo - -listaddonpromodules: - @echo - -listaddonentmodules: - @echo - - -REQUIRES= - -####### Sub-libraries - - -###### Combined headers - - - -####### Compile - -$(OBJECTS_DIR)/main.o: main.cpp \ - $(MOC_DIR)/main.moc - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/main.o main.cpp - -$(MOC_DIR)/main.moc: main.cpp - $(MOC) main.cpp -o $(MOC_DIR)/main.moc - - - -lupdate-check: - @true - -lupdate: - @true - -lrelease: - @echo "No TRANSLATIONS" - - -ipkg: $(DESTDIR)$(TARGET) # among other things... - CTL="$(CONTROL)"; for ctrl in $$CTL; do cd $(QPEDIR)/ipkg; ../bin/mkipks -platform generic $(QPEDIR)/src/$$ctrl ; done - -package: ipkg - cd $(QPEDIR)/ipkg; ../bin/mkPackages - -Makefile: quicklauncher.pro - cd $(QPEDIR)/src; ./configure -platform generic -make tools/quicklauncher diff --git a/core/tools/quicklauncher/Makefile.in b/core/tools/quicklauncher/Makefile.in deleted file mode 100644 index 8c7892a..0000000 --- a/core/tools/quicklauncher/Makefile.in +++ b/dev/null @@ -1,106 +0,0 @@ -############################################################################# - -####### Compiler, tools and options - -CXX = $(SYSCONF_CXX) $(QT_CXX_MT) -CXXFLAGS= $(SYSCONF_CXXFLAGS_QTOPIA) $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) -DQTOPIA_APP_INTERFACE -CC = $(SYSCONF_CC) $(QT_C_MT) -CFLAGS = $(SYSCONF_CFLAGS_QTOPIA) $(SYSCONF_CFLAGS) -DQTOPIA_APP_INTERFACE -INCPATH = -I$(MOC_DIR) -LFLAGS = $(SYSCONF_LFLAGS_QTOPIA) $(SYSCONF_RPATH_QTOPIA) $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) -LIBS = $(SUBLIBS) -lqpepim -lpthread -lqpe $(SYSCONF_LIBS_QTOPIA) $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) -MOC = $(SYSCONF_MOC) -UIC = $(SYSCONF_UIC) - -####### Target - -DESTDIR = $(QPEDIR)/bin/ -VER_MAJ = 1 -VER_MIN = 0 -VER_PATCH = 0 -TARGET = quicklauncher -TARGET1 = lib$(TARGET).so.$(VER_MAJ) - -####### Files - -HEADERS = -SOURCES = main.cpp -OBJECTS = $(OBJECTS_DIR)/main.o -INTERFACES = -UICDECLS = -UICIMPLS = -SRCMOC = $(MOC_DIR)/main.moc -OBJMOC = - - -####### Implicit rules - -.SUFFIXES: .cpp .cxx .cc .C .c - -.cpp.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.cxx.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.cc.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.C.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.c.o: - $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< - -####### Build rules - - -all: $(DESTDIR)$(TARGET) - -$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) - $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) - -moc: $(SRCMOC) - -tmake: - tmake quicklauncher.pro - -clean: - -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) - -rm -f *~ core - -rm -f allmoc.cpp - -####### Extension Modules - -listpromodules: - @echo - -listallmodules: - @echo - -listaddonpromodules: - @echo - -listaddonentmodules: - @echo - - -REQUIRES= - -####### Sub-libraries - - -###### Combined headers - - - -####### Compile - -$(OBJECTS_DIR)/main.o: main.cpp \ - $(MOC_DIR)/main.moc - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/main.o main.cpp - -$(MOC_DIR)/main.moc: main.cpp - $(MOC) main.cpp -o $(MOC_DIR)/main.moc - - diff --git a/core/tools/quicklauncher/dropins.h b/core/tools/quicklauncher/dropins.h new file mode 100644 index 0000000..ac8d8cc --- a/dev/null +++ b/core/tools/quicklauncher/dropins.h @@ -0,0 +1,61 @@ + +#include <qstring.h> +#include <qtopia/qcom.h> +#include <qtopia/qlibrary.h> +#include <qtopia/applicationinterface.h> +#include <qtopia/resource.h> + +#include <opie/owait.h> + +#include <qmetaobject.h> +#include <qmap.h> + +namespace Opie { + + struct PluginLoader { + PluginLoader( const char* ) { + } + + QRESULT queryInterface( const QString& app, const QUuid&, QUnknownInterface** ); + void releaseInterface( QUnknownInterface* ); + QMap<QUnknownInterface*, QLibrary*> libs; + }; + + /* + * We can skip installing a Translator here because Opies QPEApplication + * will do that in initApp for us as well + */ + QRESULT PluginLoader::queryInterface( const QString& libFile, const QUuid& uuid, QUnknownInterface** iface ) { + QRESULT res = QS_FALSE; + *iface = 0; + + // Below lines from TT then mine again + QString name = libFile; + if ( libFile.findRev(".so") == (int)libFile.length()-3 ) { + name = libFile.left( libFile.length()-3 ); + if ( name.find( "lib" ) == 0 ) + name = name.mid( 3 ); + } + QString path = QPEApplication::qpeDir() + "/plugins/applications/lib"+name+".so"; + + QLibrary *lib = new QLibrary( path ); + if ( lib->queryInterface( uuid, iface ) == QS_OK && iface ) { + libs.insert( *iface, lib ); + res = QS_OK; + } + + return res; + } + + void PluginLoader::releaseInterface( QUnknownInterface* iface ) { + if ( libs.contains( iface ) ) { + iface->release(); + delete libs[iface]; + libs.remove( iface ); // we only handle pointers so even if the object is not valid the address-space is + } + } + +} + +/* small hack ;) */ +using namespace Opie; diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp index e509908..7d368ab 100644 --- a/core/tools/quicklauncher/main.cpp +++ b/core/tools/quicklauncher/main.cpp @@ -1,84 +1,83 @@ /********************************************************************** ** Copyright (C) 2000-2003 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qpainter.h> #include <qstrlist.h> #include <qtimer.h> #include <qguardedptr.h> #include <qcopchannel_qws.h> #define QTOPIA_INTERNAL_INITAPP -#include <qtopia/timezone.h> #include <qtopia/qpeapplication.h> -#include <qtopia/resource.h> -#include <qtopia/pluginloader.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include "dropins.h" + static QPEApplication *app = 0; static PluginLoader *loader = 0; static ApplicationInterface *appIface = 0; static QGuardedPtr<QWidget> mainWindow; #ifdef _OS_LINUX_ static char **argv0 = 0; static int argv_lth; extern char **environ; #ifndef SPT_BUFSIZE #define SPT_BUFSIZE 2048 #endif #include <stdarg.h> void setproctitle (const char *fmt,...) { int i; char buf[SPT_BUFSIZE]; va_list ap; if (!argv0) return; va_start(ap, fmt); (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap); va_end(ap); i = strlen (buf); if (i > argv_lth - 2) { i = argv_lth - 2; buf[i] = '\0'; } memset(argv0[0], '\0', argv_lth); /* clear the memory area */ (void) strcpy (argv0[0], buf); argv0[1] = NULL; } #endif class QuickLauncher : public QObject { Q_OBJECT public: QuickLauncher() : QObject() { QCString ch("QPE/QuickLauncher-"); ch += QString::number(getpid()); qlChannel = new QCopChannel( ch, this); connect( qlChannel, SIGNAL(received(const QCString&, const QByteArray&)), @@ -165,77 +164,84 @@ int main( int argc, char** argv ) loader = new PluginLoader( "application" ); unsetenv( "LD_BIND_NOW" ); QCString arg0 = argv[0]; int sep = arg0.findRev( '/' ); if ( sep > 0 ) arg0 = arg0.mid( sep+1 ); if ( arg0 != "quicklauncher" ) { qDebug( "QuickLauncher invoked as: %s", arg0.data() ); QuickLauncher::exec( argc, argv ); } else { #ifdef _OS_LINUX_ // Setup to change proc title int i; char **envp = environ; /* Move the environment so we can reuse the memory. * (Code borrowed from sendmail.) */ for (i = 0; envp[i] != NULL; i++) continue; environ = (char **) malloc(sizeof(char *) * (i + 1)); if (environ == NULL) return -1; for (i = 0; envp[i] != NULL; i++) if ((environ[i] = strdup(envp[i])) == NULL) return -1; environ[i] = NULL; argv0 = argv; if (i > 0) argv_lth = envp[i-1] + strlen(envp[i-1]) - argv0[0]; else argv_lth = argv0[argc-1] + strlen(argv0[argc-1]) - argv0[0]; #endif (void)new QuickLauncher(); qDebug( "QuickLauncher running" ); // Pre-load default fonts QFontMetrics fm( QApplication::font() ); fm.ascent(); // causes font load. QFont f( QApplication::font() ); f.setWeight( QFont::Bold ); QFontMetrics fmb( f ); fmb.ascent(); // causes font load. // Each of the following force internal structures/internal // initialization to be performed. This may mean allocating // memory that is not needed by all applications. +#if 0 TimeZone::current().isValid(); // popuplate timezone cache TimeString::currentDateFormat(); // create internal structures TimeString::currentAMPM(); +#endif Resource::loadIconSet("new"); // do internal init + /* make sure libopie gets lined in */ + { + OWait item; + } + // Create a widget to force initialization of title bar images, etc. QObject::disconnect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); QWidget *w = new QWidget(0,0,Qt::WDestructiveClose|Qt::WStyle_ContextHelp|Qt::WStyle_Tool); w->setGeometry( -100, -100, 10, 10 ); w->show(); QTimer::singleShot( 0, w, SLOT(close()) ); app->enter_loop(); } int rv = app->exec(); if ( mainWindow ) delete (QWidget*)mainWindow; if ( appIface ) loader->releaseInterface( appIface ); delete loader; delete app; return rv; } #include "main.moc" diff --git a/core/tools/quicklauncher/quicklauncher.pro b/core/tools/quicklauncher/quicklauncher.pro index 52e2106..6ab5fc8 100644 --- a/core/tools/quicklauncher/quicklauncher.pro +++ b/core/tools/quicklauncher/quicklauncher.pro @@ -1,11 +1,15 @@ TEMPLATE = app CONFIG += qtopia warn_on release -DESTDIR = $(QPEDIR)/bin +DESTDIR = $(OPIEDIR)/bin -HEADERS = +HEADERS = dropins.h SOURCES = main.cpp INTERFACES = -unix:LIBS += -lqpepim -lpthread +INCLUDEPATH += $(OPIEDIR)/include +LIBS += -lqpe -lopie TARGET = quicklauncher + + +include ( $(OPIEDIR)/include.pro )
\ No newline at end of file |