summaryrefslogtreecommitdiff
path: root/core/tools
authorwimpie <wimpie>2005-01-09 03:02:21 (UTC)
committer wimpie <wimpie>2005-01-09 03:02:21 (UTC)
commit67d1d0b292553af550219d770cbd5c00987d8b8b (patch) (side-by-side diff)
tree517759c7fbda44a40ff733e3b5d5667d90558caa /core/tools
parent987bc9a2c5b39ddd4dc2a665cea65688bfd2179e (diff)
downloadopie-67d1d0b292553af550219d770cbd5c00987d8b8b.zip
opie-67d1d0b292553af550219d770cbd5c00987d8b8b.tar.gz
opie-67d1d0b292553af550219d770cbd5c00987d8b8b.tar.bz2
CONTROL files : reset version to 'standard' format
(partly rolls back my drastic all-applicatoins-same-version change) now format is x.y(.z)$EXTRAVERSION where x.y (and aptionally .z) are x : major version y : minor version z : application patch and extra version is seconds-since-epoch this value can be used to automatically upgrade versions with minor changes (without manual update of the control file)
Diffstat (limited to 'core/tools') (more/less context) (ignore whitespace changes)
-rw-r--r--core/tools/quicklauncher/main.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp
index fbed5a1..59dd17e 100644
--- a/core/tools/quicklauncher/main.cpp
+++ b/core/tools/quicklauncher/main.cpp
@@ -24,194 +24,193 @@
/* OPIE */
#include <opie2/odebug.h>
#include <opie2/oapplication.h>
/* QT */
#include <qpainter.h>
#include <qstrlist.h>
#include <qtimer.h>
#include <qguardedptr.h>
#include <qcopchannel_qws.h>
#ifdef private
# undef private
#endif
#define private public
#include <qtopia/qpeapplication.h>
#undef private
/* STD */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef _OS_LINUX_
#include <sys/prctl.h>
#ifndef PR_SET_NAME
#define PR_SET_NAME 15
#endif
#endif
#include <unistd.h>
using QuickPrivate::PluginLoader;
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&)),
this, SLOT(message(const QCString&,const QByteArray&)) );
}
static void exec( int /*argc*/, char **argv )
{
QString appName = argv[0];
int sep = appName.findRev( '/' );
if ( sep > 0 )
appName = appName.mid( sep+1 );
appIface = 0;
- if ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) != QS_OK ) {
- owarn << "Plugin does not support QuickLauncher interface" << oendl;
+ if ( ! ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) == QS_OK ) ) {
exit(-1);
}
mainWindow = appIface->createMainWindow( appName );
if ( mainWindow ) {
if ( mainWindow->metaObject()->slotNames().contains("setDocument(const QString&)") ) {
app->showMainDocumentWidget( mainWindow );
} else {
app->showMainWidget( mainWindow );
}
} else {
owarn << "Could not create application main window" << oendl;
exit(-1);
}
}
private slots:
void message(const QCString &msg, const QByteArray & data)
{
QStrList argList;
if ( msg == "execute(QStrList)" ) {
delete qlChannel;
QDataStream stream( data, IO_ReadOnly );
QStrList argList;
stream >> argList;
odebug << "QuickLauncher execute: " << argList.at(0) << oendl;
doQuickLaunch( argList );
delete this;
} else if ( msg == "execute(QString)" ) {
delete qlChannel;
QDataStream stream( data, IO_ReadOnly );
QString arg;
stream >> arg;
odebug << "QuickLauncher execute: " << arg << oendl;
QStrList argList;
argList.append( arg.utf8() );
doQuickLaunch( argList );
delete this;
}
}
private:
void doQuickLaunch( QStrList &argList )
{
static int myargc = argList.count();
static char **myargv = new char *[myargc + 1];
for ( int j = 0; j < myargc; j++ ) {
myargv[j] = new char [strlen(argList.at(j))+1];
strcpy( myargv[j], argList.at(j) );
}
myargv[myargc] = NULL;
#ifdef _OS_LINUX_
// Change name of process
setproctitle(myargv[0]);
prctl( PR_SET_NAME, (unsigned long)myargv[0], 0, 0, 0 );
#endif
connect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit()));
app->exit_loop();
app->initApp( myargc, myargv );
exec( myargc, myargv );
}
private:
QCopChannel *qlChannel;
};
int main( int argc, char** argv )
{
app = new Opie::Core::OApplication( argc, 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" ) {
odebug << "QuickLauncher invoked as: " << arg0.data() << oendl;
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++)