summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/applauncher.cpp11
-rw-r--r--core/launcher/config.in6
-rw-r--r--core/launcher/documentlist.cpp11
-rw-r--r--core/launcher/main.cpp9
-rw-r--r--core/launcher/qcopbridge.cpp7
-rw-r--r--core/launcher/screensaver.cpp2
-rw-r--r--core/launcher/server.cpp4
-rw-r--r--core/launcher/server.pro7
-rw-r--r--core/launcher/startmenu.cpp2
-rw-r--r--core/launcher/transferserver.cpp5
-rw-r--r--core/launcher/wait.cpp2
11 files changed, 34 insertions, 32 deletions
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp
index 0db99dd..f161e98 100644
--- a/core/launcher/applauncher.cpp
+++ b/core/launcher/applauncher.cpp
@@ -1,112 +1,111 @@
/**********************************************************************
** Copyright (C) 2000-2002 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.
**
**********************************************************************/
#ifndef QTOPIA_INTERNAL_PRELOADACCESS
#define QTOPIA_INTERNAL_PRELOADACCESS
#endif
#ifndef QTOPIA_INTERNAL_FILEOPERATIONS
#define QTOPIA_INTERNAL_FILEOPERATIONS
#endif
#ifndef QTOPIA_PROGRAM_MONITOR
#define QTOPIA_PROGRAM_MONITOR
#endif
-#include <qtopia/global.h>
+#include <opie2/oglobal.h>
#ifndef Q_OS_WIN32
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/file.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <errno.h>
#else
#include <process.h>
#include <windows.h>
#include <winbase.h>
#endif
#include <signal.h>
#include <sys/types.h>
#include <stdlib.h>
#include <qtimer.h>
#include <qwindowsystem_qws.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qtopia/qcopenvelope_qws.h>
#include <qtopia/applnk.h>
#include <qtopia/qpeapplication.h>
#include <qtopia/config.h>
#include <qtopia/global.h>
#include "applauncher.h"
#include "documentlist.h"
-#include "launcherglobal.h"
const int AppLauncher::RAISE_TIMEOUT_MS = 5000;
//---------------------------------------------------------------------------
static AppLauncher* appLauncherPtr;
const int appStopEventID = 1290;
class AppStoppedEvent : public QCustomEvent
{
public:
AppStoppedEvent(int pid, int status)
: QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { }
int pid() { return mPid; }
int status() { return mStatus; }
private:
int mPid, mStatus;
};
AppLauncher::AppLauncher(QObject *parent, const char *name)
: QObject(parent, name), qlPid(0), qlReady(FALSE),
appKillerBox(0)
{
connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&)));
connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&)));
QCopChannel* channel = new QCopChannel( "QPE/System", this );
connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT(received(const QCString&, const QByteArray&)) );
channel = new QCopChannel( "QPE/Server", this );
connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT(received(const QCString&, const QByteArray&)) );
#ifndef Q_OS_WIN32
signal(SIGCHLD, signalHandler);
#else
runningAppsProc.setAutoDelete( TRUE );
#endif
QString tmp = qApp->argv()[0];
int pos = tmp.findRev('/');
if ( pos > -1 )
tmp = tmp.mid(++pos);
runningApps[::getpid()] = tmp;
appLauncherPtr = this;
@@ -359,190 +358,190 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus)
Config cfg("Launcher");
cfg.setGroup("Preload");
QStringList apps = cfg.readListEntry("Apps",',');
QString exe = app->exec();
apps.remove(exe);
cfg.writeEntry("Apps",apps,',');
preloadDisabled = TRUE;
}
// clean up
if ( exitStatus ) {
QCopEnvelope e("QPE/System", "notBusy(QString)");
e << app->exec();
}
/*
// debug info
for (it = runningApps.begin(); it != runningApps.end(); ++it) {
qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() );
}
*/
#ifdef QTOPIA_PROGRAM_MONITOR
if ( crashed ) {
QString sig;
switch( exitStatus ) {
case SIGABRT: sig = "SIGABRT"; break;
case SIGALRM: sig = "SIGALRM"; break;
case SIGBUS: sig = "SIGBUS"; break;
case SIGFPE: sig = "SIGFPE"; break;
case SIGHUP: sig = "SIGHUP"; break;
case SIGILL: sig = "SIGILL"; break;
case SIGKILL: sig = "SIGKILL"; break;
case SIGPIPE: sig = "SIGPIPE"; break;
case SIGQUIT: sig = "SIGQUIT"; break;
case SIGSEGV: sig = "SIGSEGV"; break;
case SIGTERM: sig = "SIGTERM"; break;
case SIGTRAP: sig = "SIGTRAP"; break;
default: sig = QString("Unkown %1").arg(exitStatus);
}
if ( preloadDisabled )
sig += tr("<qt><p>Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.</qt>");
QString str = tr("<qt><b>%1</b> was terminated due to signal code %2</qt>").arg( app->name() ).arg( sig );
QMessageBox::information(0, tr("Application terminated"), str );
} else {
if ( exitStatus == 255 ) { //could not find app (because global returns -1)
QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) );
} else {
- QFileInfo fi(Opie::Global::tempDir() + "qcop-msg-" + appName);
+ QFileInfo fi(OGlobal::tempDirPath() + "qcop-msg-" + appName);
if ( fi.exists() && fi.size() ) {
emit terminated(sigPid, appName);
qWarning("Re executing obmitted for %s", appName.latin1() );
// execute( appName, QString::null );
return;
}
}
}
#endif
emit terminated(sigPid, appName);
}
#else
void AppLauncher::sigStopped(int sigPid, int sigStatus)
{
qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)");
}
#endif // Q_OS_WIN32
bool AppLauncher::isRunning(const QString &app)
{
for (QMap<int,QString>::ConstIterator it = runningApps.begin(); it != runningApps.end(); ++it) {
if ( *it == app ) {
#ifdef Q_OS_UNIX
pid_t t = ::__getpgid( it.key() );
if ( t == -1 ) {
qDebug("appLauncher bug, %s believed running, but pid %d is not existing", app.data(), it.key() );
runningApps.remove( it.key() );
return FALSE;
}
#endif
return TRUE;
}
}
return FALSE;
}
bool AppLauncher::executeBuiltin(const QString &c, const QString &document)
{
- Global::Command* builtin = Opie::Global::builtinCommands();
- QGuardedPtr<QWidget> *running = Opie::Global::builtinRunning();
+ Global::Command* builtin = OGlobal::builtinCommands();
+ QGuardedPtr<QWidget> *running = OGlobal::builtinRunning();
// Attempt to execute the app using a builtin class for the app
if (builtin) {
for (int i = 0; builtin[i].file; i++) {
if ( builtin[i].file == c ) {
if ( running[i] ) {
if ( !document.isNull() && builtin[i].documentary )
Global::setDocument(running[i], document);
running[i]->raise();
running[i]->show();
running[i]->setActiveWindow();
} else {
running[i] = builtin[i].func( builtin[i].maximized );
}
#ifndef QT_NO_COP
QCopEnvelope e("QPE/System", "notBusy(QString)" );
e << c; // that was quick ;-)
#endif
return TRUE;
}
}
}
// Convert the command line in to a list of arguments
QStringList list = QStringList::split(QRegExp(" *"),c);
QString ap=list[0];
if ( ap == "suspend" ) { // No tr
QWSServer::processKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
return TRUE;
}
return FALSE;
}
bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise)
{
qWarning("AppLauncher::execute");
// Convert the command line in to a list of arguments
QStringList list = QStringList::split(QRegExp(" *"),c);
if ( !docParam.isEmpty() )
list.append( docParam );
QString appName = list[0];
if ( isRunning(appName) ) {
QCString channel = "QPE/Application/";
channel += appName.latin1();
// Need to lock it to avoid race conditions with QPEApplication::processQCopFile
- QFile f(Opie::Global::tempDir() + "qcop-msg-" + appName);
+ QFile f(OGlobal::tempDirPath() + "qcop-msg-" + appName);
if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) {
#ifndef Q_OS_WIN32
flock(f.handle(), LOCK_EX);
#endif
QDataStream ds(&f);
QByteArray b;
QDataStream bstream(b, IO_WriteOnly);
if ( !f.size() ) {
ds << channel << QCString("raise()") << b;
if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) {
int id = startTimer(RAISE_TIMEOUT_MS);
waitingHeartbeat.insert( appName, id );
}
}
if ( !docParam.isEmpty() ) {
bstream << docParam;
ds << channel << QCString("setDocument(QString)") << b;
}
f.flush();
#ifndef Q_OS_WIN32
flock(f.handle(), LOCK_UN);
#endif
f.close();
}
if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings
QCopChannel::send(channel,"QPEProcessQCop()");
return TRUE;
}
#ifdef QT_NO_QWS_MULTIPROCESS
QMessageBox::warning( 0, tr("Error"), tr("<qt>Could not find the application %1</qt>").arg(c),
tr("OK"), 0, 0, 0, 1 );
#else
QStrList slist;
unsigned j;
for ( j = 0; j < list.count(); j++ )
slist.append( list[j].utf8() );
const char **args = new const char *[slist.count() + 1];
for ( j = 0; j < slist.count(); j++ )
args[j] = slist.at(j);
args[j] = NULL;
#ifndef Q_OS_WIN32
diff --git a/core/launcher/config.in b/core/launcher/config.in
index 2d9c1c2..db39210 100644
--- a/core/launcher/config.in
+++ b/core/launcher/config.in
@@ -1,16 +1,16 @@
config LAUNCHER
boolean "opie-taskbar (program launcher qpe for Opie)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI
if LAUNCHER
config PRELOAD
boolean
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LAUNCHER
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && LAUNCHER
config LAUNCHER_CORE
boolean
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LAUNCHER && PRELOAD
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && LAUNCHER && PRELOAD
endif
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index ece6931..440bf1e 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -1,141 +1,144 @@
/**********************************************************************
** Copyright (C) 2000-2002 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 "documentlist.h"
#include "serverinterface.h"
-#include "launcherglobal.h"
+
+#include <opie2/oglobal.h>
#include <qtopia/config.h>
#include <qtopia/mimetype.h>
#include <qtopia/resource.h>
-#include <qtopia/global.h>
#include <qtopia/private/categories.h>
#include <qtopia/qpeapplication.h>
#include <qtopia/applnk.h>
#include <qtopia/storage.h>
#ifdef Q_WS_QWS
#include <qtopia/qcopenvelope_qws.h>
#endif
#include <qtimer.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include <qfile.h>
#include <qdir.h>
#include <qpainter.h>
#include <qimage.h>
#include <qcopchannel_qws.h>
#include <qlistview.h>
#include <qlist.h>
#include <qpixmap.h>
AppLnkSet *DocumentList::appLnkSet = 0;
static const int MAX_SEARCH_DEPTH = 10;
class DocumentListPrivate : public QObject {
Q_OBJECT
public:
DocumentListPrivate( ServerInterface *gui );
~DocumentListPrivate();
void initialize();
const QString nextFile();
const DocLnk *iterate();
bool store( DocLnk* dl );
void estimatedPercentScanned();
DocLnkSet dls;
QDict<void> reference;
QDictIterator<void> *dit;
enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state;
QStringList docPaths;
unsigned int docPathsSearched;
int searchDepth;
QDir *listDirs[MAX_SEARCH_DEPTH];
const QFileInfoList *lists[MAX_SEARCH_DEPTH];
unsigned int listPositions[MAX_SEARCH_DEPTH];
StorageInfo *storage;
int tid;
ServerInterface *serverGui;
bool needToSendAllDocLinks;
bool sendAppLnks;
bool sendDocLnks;
bool scanDocs;
};
-DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs,
+/*
+ * scandocs will be read from Config
+ */
+DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/,
QObject *parent, const char *name )
: QObject( parent, name )
{
appLnkSet = new AppLnkSet( MimeType::appsFolderName() );
d = new DocumentListPrivate( serverGui );
d->needToSendAllDocLinks = false;
Config cfg( "Launcher" );
cfg.setGroup( "DocTab" );
d->scanDocs = cfg.readBoolEntry( "Enable", true );
qDebug( "DocumentList::DocumentList() : scanDocs = %d", d->scanDocs );
QTimer::singleShot( 10, this, SLOT( startInitialScan() ) );
}
void DocumentList::startInitialScan()
{
reloadAppLnks();
reloadDocLnks();
}
DocumentList::~DocumentList()
{
delete appLnkSet;
delete d;
}
void DocumentList::add( const DocLnk& doc )
{
if ( d->serverGui && QFile::exists( doc.file() ) )
d->serverGui->documentAdded( doc );
}
void DocumentList::start()
{
resume();
}
void DocumentList::pause()
{
//qDebug("pause %i", d->tid);
killTimer( d->tid );
d->tid = 0;
}
@@ -224,97 +227,97 @@ void DocumentList::reloadAppLnks()
pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
}
//qDebug("adding type %s", (*ittypes).latin1());
// ### our current launcher expects docs tab to be last
d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm );
}
prevTypeList.remove(*ittypes);
}
}
for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) {
//qDebug("removing type %s", (*ittypes).latin1());
d->serverGui->typeRemoved(*ittypes);
}
prevTypeList = types;
}
QListIterator<AppLnk> itapp( appLnkSet->children() );
AppLnk* l;
while ( (l=itapp.current()) ) {
++itapp;
if ( d->sendAppLnks && d->serverGui )
d->serverGui->applicationAdded( l->type(), *l );
}
if ( d->sendAppLnks && d->serverGui )
d->serverGui->applicationScanningProgress( 100 );
}
void DocumentList::reloadDocLnks()
{
if ( !d->scanDocs )
return;
if ( d->sendDocLnks && d->serverGui ) {
d->serverGui->documentScanningProgress( 0 );
d->serverGui->allDocumentsRemoved();
}
rescan();
}
void DocumentList::linkChanged( QString arg )
{
//qDebug( "linkchanged( %s )", arg.latin1() );
- if ( arg.isNull() || Opie::Global::isAppLnkFileName( arg ) ) {
+ if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) {
reloadAppLnks();
} else {
const QList<DocLnk> &list = d->dls.children();
QListIterator<DocLnk> it( list );
while ( it.current() ) {
DocLnk *doc = it.current();
++it;
if ( ( doc->linkFileKnown() && doc->linkFile() == arg )
|| ( doc->fileKnown() && doc->file() == arg ) ) {
//qDebug( "found old link" );
DocLnk* dl = new DocLnk( arg );
// add new one if it exists and matches the mimetype
if ( d->store( dl ) ) {
// Existing link has been changed, send old link ref and a ref
// to the new link
//qDebug( "change case" );
if ( d->serverGui )
d->serverGui->documentChanged( *doc, *dl );
} else {
// Link has been removed or doesn't match the mimetypes any more
// so we aren't interested in it, so take it away from the list
//qDebug( "removal case" );
if ( d->serverGui )
d->serverGui->documentRemoved( *doc );
}
d->dls.remove( doc ); // remove old link from docLnkSet
delete doc;
return;
}
}
// Didn't find existing link, must be new
DocLnk* dl = new DocLnk( arg );
if ( d->store( dl ) ) {
// Add if it's a link we are interested in
//qDebug( "add case" );
add( *dl );
}
}
}
void DocumentList::restoreDone()
{
reloadAppLnks();
reloadDocLnks();
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 988e432..bf06e75 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -1,122 +1,123 @@
/**********************************************************************
** Copyright (C) 2000-2002 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.
**
**********************************************************************/
#ifndef QTOPIA_INTERNAL_FILEOPERATIONS
#define QTOPIA_INTERNAL_FILEOPERATIONS
#endif
#include "server.h"
#include "serverapp.h"
#include "taskbar.h"
#include "stabmon.h"
#include "launcher.h"
#include "firstuse.h"
-#include "launcherglobal.h"
+
+#include <opie2/oglobal.h>
#include <qtopia/qpeapplication.h>
#include <qtopia/network.h>
#include <qtopia/config.h>
//#include <qtopia/custom.h>
-#include <qtopia/global.h>
+
#include <qfile.h>
#include <qdir.h>
#ifdef QWS
#include <qwindowsystem_qws.h>
#include <qtopia/qcopenvelope_qws.h>
#endif
#include <qtopia/alarmserver.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#ifndef Q_OS_WIN32
#include <unistd.h>
#else
#include <process.h>
#endif
#include "calibrate.h"
#ifdef QT_QWS_LOGIN
#include "../login/qdmdialogimpl.h"
#endif
#ifdef Q_WS_QWS
#include <qkeyboard_qws.h>
#endif
#include <qmessagebox.h>
-#include <opie/odevice.h>
+#include <opie2/odevice.h>
using namespace Opie;
static void cleanup()
{
- QDir dir( Opie::Global::tempDir(), "qcop-msg-*" );
+ QDir dir( OGlobal::tempDirPath(), "qcop-msg-*" );
QStringList stale = dir.entryList();
QStringList::Iterator it;
for ( it = stale.begin(); it != stale.end(); ++it ) {
dir.remove( *it );
}
}
static void refreshTimeZoneConfig()
{
/* ### FIXME timezone handling */
#if 0
// We need to help WorldTime in setting up its configuration for
// the current translation
// BEGIN no tr
const char *defaultTz[] = {
"America/New_York",
"America/Los_Angeles",
"Europe/Oslo",
"Asia/Tokyo",
"Asia/Hong_Kong",
"Australia/Brisbane",
0
};
// END no tr
TimeZone curZone;
QString zoneID;
int zoneIndex;
Config cfg = Config( "WorldTime" );
cfg.setGroup( "TimeZones" );
if (!cfg.hasKey( "Zone0" )){
// We have no existing timezones use the defaults which are untranslated strings
QString currTz = TimeZone::current().id();
QStringList zoneDefaults;
zoneDefaults.append( currTz );
for ( int i = 0; defaultTz[i] && zoneDefaults.count() < 6; i++ ) {
if ( defaultTz[i] != currTz )
zoneDefaults.append( defaultTz[i] );
}
zoneIndex = 0;
for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){
cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it);
zoneIndex++;
}
}
// We have an existing list of timezones refresh the
// translations of TimeZone name
diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp
index 9cb56ce..b45f0cc 100644
--- a/core/launcher/qcopbridge.cpp
+++ b/core/launcher/qcopbridge.cpp
@@ -1,106 +1,107 @@
/**********************************************************************
** Copyright (C) 2000-2002 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 "qcopbridge.h"
#include "transferserver.h"
+#include <opie2/oglobal.h>
+
#ifdef Q_WS_QWS
#include <qtopia/qcopenvelope_qws.h>
#endif
#include <qtopia/qpeapplication.h>
-#include <qtopia/global.h>
+
#include <qtopia/version.h>
#include <qtopia/config.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qdatastream.h>
#include <qcstring.h>
#include <qstringlist.h>
#include <qfileinfo.h>
#include <qregexp.h>
#include <qtimer.h>
#ifdef Q_WS_QWS
#include <qcopchannel_qws.h>
#endif
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#endif
#ifndef Q_OS_WIN32
#include <pwd.h>
#include <unistd.h>
#include <sys/types.h>
#endif
#if defined(_OS_LINUX_)
#include <shadow.h>
#endif
-#include "launcherglobal.h"
//#define INSECURE
const int block_size = 51200;
QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent,
const char* name )
: QServerSocket( port, 1, parent, name ),
desktopChannel( 0 ),
cardChannel( 0 )
{
if ( !ok() )
qWarning( "Failed to bind to port %d", port );
else {
#ifndef QT_NO_COP
desktopChannel = new QCopChannel( "QPE/Desktop", this );
connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)),
this, SLOT(desktopMessage( const QCString &, const QByteArray &)) );
cardChannel = new QCopChannel( "QPE/Card", this );
connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)),
this, SLOT(desktopMessage( const QCString &, const QByteArray &)) );
#endif
}
sendSync = FALSE;
openConnections.setAutoDelete( TRUE );
authorizeConnections();
}
QCopBridge::~QCopBridge()
{
#ifndef QT_NO_COP
delete desktopChannel;
#endif
}
void QCopBridge::authorizeConnections()
{
Config cfg("Security");
cfg.setGroup("SyncMode");
m_mode = Mode(cfg.readNumEntry("Mode", Sharp ));
QListIterator<QCopBridgePI> it(openConnections);
while ( it.current() ) {
if ( !it.current()->verifyAuthorised() ) {
disconnect ( it.current(), SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( closed( QCopBridgePI *) ) );
openConnections.removeRef( it.current() );
} else
++it;
}
@@ -280,97 +281,97 @@ QCopBridgePI::QCopBridgePI( int socket, QObject *parent, const char* name )
intro += "loginname="; intro += SyncAuthentication::loginName(); intro += ";";
intro += "displayname="; intro += SyncAuthentication::ownerName(); intro += ";";
send( intro );
state = Wait_USER;
}
sendSync = FALSE;
connect( this, SIGNAL( connectionClosed() ), SLOT( myConnectionClosed() ) );
// idle timer to close connections when not used anymore
timer = new QTimer(this);
connect( timer, SIGNAL(timeout()), this, SLOT(myConnectionClosed()) );
timer->start( 300000, TRUE );
}
QCopBridgePI::~QCopBridgePI()
{
}
bool QCopBridgePI::verifyAuthorised()
{
if ( !SyncAuthentication::isAuthorized(peerAddress()) ) {
state = Forbidden;
return FALSE;
}
return TRUE;
}
void QCopBridgePI::myConnectionClosed()
{
emit connectionClosed( this );
}
void QCopBridgePI::sendDesktopMessage( const QString &msg )
{
QString str = "CALL QPE/Desktop " + msg; // No tr
send ( str );
}
void QCopBridgePI::sendDesktopMessage( const QCString &msg, const QByteArray& data )
{
if ( !isOpen() ) // eg. Forbidden
return;
const char hdr[]="CALLB QPE/Desktop ";
writeBlock(hdr,sizeof(hdr)-1);
writeBlock(msg,msg.length());
writeBlock(" ",1);
- QByteArray b64 = Opie::Global::encodeBase64(data);
+ QByteArray b64 = OGlobal::encodeBase64(data);
writeBlock(b64.data(),b64.size());
writeBlock("\r\n",2);
}
void QCopBridgePI::send( const QString& msg )
{
if ( !isOpen() ) // eg. Forbidden
return;
QTextStream os( this );
os << msg << endl;
//qDebug( "sending qcop message: %s", msg.latin1() );
}
void QCopBridgePI::read()
{
while ( canReadLine() ) {
timer->start( 300000, TRUE );
process( readLine().stripWhiteSpace() );
}
}
void QCopBridgePI::process( const QString& message )
{
//qDebug( "Command: %s", message.latin1() );
// split message using "," as separator
QStringList msg = QStringList::split( " ", message );
if ( msg.isEmpty() ) return;
// command token
QString cmd = msg[0].upper();
// argument token
QString arg;
if ( msg.count() >= 2 )
arg = msg[1];
// we always respond to QUIT, regardless of state
if ( cmd == "QUIT" ) {
send( "211 Have a nice day!" ); // No tr
close();
return;
}
// connected to client
if ( Connected == state )
diff --git a/core/launcher/screensaver.cpp b/core/launcher/screensaver.cpp
index 48770e8..1146dcd 100644
--- a/core/launcher/screensaver.cpp
+++ b/core/launcher/screensaver.cpp
@@ -1,56 +1,56 @@
#include "screensaver.h"
#include <qpe/config.h>
#include <qpe/power.h>
#include <qpe/network.h>
-#include <opie/odevice.h>
+#include <opie2/odevice.h>
using namespace Opie;
OpieScreenSaver::OpieScreenSaver ( )
: QObject ( 0, "screensaver" ), QWSScreenSaver ( )
{
m_disable_suspend = 100;
m_enable_dim = false;
m_enable_lightoff = false;
m_enable_suspend = false;
m_onlylcdoff = false;
m_enable_dim_ac = false;
m_enable_lightoff_ac = false;
m_enable_suspend_ac = false;
m_onlylcdoff_ac = false;
m_use_light_sensor = false;
m_backlight_sensor = -1;
::memset ( m_sensordata, 0xff, LS_Count * sizeof( m_sensordata [0] ));
m_lcd_status = true;
m_backlight_normal = -1;
m_backlight_current = -1;
m_backlight_forcedoff = false;
m_on_ac = false;
m_level = -1;
// Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off)
ODevice::inst ( )-> setDisplayStatus ( true );
setBacklight ( -1 );
}
/**
* Stops the screen saver
*/
void OpieScreenSaver::restore()
{
m_level = -1;
if ( !m_lcd_status ) { // We must have turned it off
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index b9580c7..32fcdd0 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -6,98 +6,98 @@
** 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 "server.h"
#include "serverapp.h"
#include "launcher.h"
#include "startmenu.h"
#include "transferserver.h"
#include "qcopbridge.h"
#include "irserver.h"
#include "packageslave.h"
#include "calibrate.h"
#include "qrsync.h"
#include "syncdialog.h"
#include "launcher.h"
#include "shutdownimpl.h"
#include "applauncher.h"
#if 0
#include "suspendmonitor.h"
#endif
#include "documentlist.h"
#include <qtopia/applnk.h>
#include <qtopia/private/categories.h>
#include <qtopia/mimetype.h>
#include <qtopia/config.h>
#include <qtopia/resource.h>
#include <qtopia/version.h>
#include <qtopia/storage.h>
#include <qtopia/qcopenvelope_qws.h>
#include <qwindowsystem_qws.h>
#include <qgfx_qws.h>
#include <qtopia/global.h>
//#include <qtopia/custom.h>
-#include <opie/odevicebutton.h>
-#include <opie/odevice.h>
+#include <opie2/odevicebutton.h>
+#include <opie2/odevice.h>
#include <unistd.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qtimer.h>
#include <qtextstream.h>
#include <stdlib.h>
extern QRect qt_maxWindowRect;
using namespace Opie;
static QWidget *calibrate(bool)
{
#ifdef Q_WS_QWS
Calibrate *c = new Calibrate;
c->show();
return c;
#else
return 0;
#endif
}
#define FACTORY(T) \
static QWidget *new##T( bool maximized ) { \
QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
if ( maximized ) { \
if ( qApp->desktop()->width() <= 350 ) { \
w->showMaximized(); \
} else { \
w->resize( QSize( 300, 300 ) ); \
} \
} \
w->show(); \
return w; \
}
#ifdef SINGLE_APP
#define APP(a,b,c,d) FACTORY(b)
#include "apps.h"
#undef APP
#endif // SINGLE_APP
static Global::Command builtins[] = {
#ifdef SINGLE_APP
diff --git a/core/launcher/server.pro b/core/launcher/server.pro
index 0513536..f82c741 100644
--- a/core/launcher/server.pro
+++ b/core/launcher/server.pro
@@ -1,125 +1,124 @@
TEMPLATE = app
CONFIG += qtopia warn_on release
DESTDIR = $$(OPIEDIR)/bin
HEADERS += server.h \
serverinterface.h \
launchertab.h \
documentlist.h \
appicons.h \
taskbar.h \
runningappbar.h \
applauncher.h \
stabmon.h \
inputmethods.h \
systray.h \
wait.h \
shutdownimpl.h \
launcher.h \
launcherview.h \
$$(OPIEDIR)/core/apps/calibrate/calibrate.h \
startmenu.h \
transferserver.h \
qcopbridge.h \
packageslave.h \
irserver.h \
firstuse.h \
$$(OPIEDIR)/rsync/buf.h \
$$(OPIEDIR)/rsync/checksum.h \
$$(OPIEDIR)/rsync/command.h \
$$(OPIEDIR)/rsync/emit.h \
$$(OPIEDIR)/rsync/job.h \
$$(OPIEDIR)/rsync/netint.h \
$$(OPIEDIR)/rsync/protocol.h \
$$(OPIEDIR)/rsync/prototab.h \
$$(OPIEDIR)/rsync/rsync.h \
$$(OPIEDIR)/rsync/search.h \
$$(OPIEDIR)/rsync/stream.h \
$$(OPIEDIR)/rsync/sumset.h \
$$(OPIEDIR)/rsync/trace.h \
$$(OPIEDIR)/rsync/types.h \
$$(OPIEDIR)/rsync/util.h \
$$(OPIEDIR)/rsync/whole.h \
$$(OPIEDIR)/rsync/config_rsync.h \
$$(OPIEDIR)/rsync/qrsync.h \
syncdialog.h \
serverapp.h \
- launcherglobal.h \
qprocess.h \
screensaver.h
SOURCES += server.cpp \
serverinterface.cpp \
launchertab.cpp \
documentlist.cpp \
appicons.cpp \
taskbar.cpp \
runningappbar.cpp \
applauncher.cpp \
stabmon.cpp \
inputmethods.cpp \
systray.cpp \
wait.cpp \
shutdownimpl.cpp \
launcher.cpp \
launcherview.cpp \
$$(OPIEDIR)/core/apps/calibrate/calibrate.cpp \
transferserver.cpp \
packageslave.cpp \
irserver.cpp \
qcopbridge.cpp \
startmenu.cpp \
main.cpp \
firstuse.cpp \
$$(OPIEDIR)/rsync/base64.c \
$$(OPIEDIR)/rsync/buf.c \
$$(OPIEDIR)/rsync/checksum.c \
$$(OPIEDIR)/rsync/command.c \
$$(OPIEDIR)/rsync/delta.c \
$$(OPIEDIR)/rsync/emit.c \
$$(OPIEDIR)/rsync/hex.c \
$$(OPIEDIR)/rsync/job.c \
$$(OPIEDIR)/rsync/mdfour.c \
$$(OPIEDIR)/rsync/mksum.c \
$$(OPIEDIR)/rsync/msg.c \
$$(OPIEDIR)/rsync/netint.c \
$$(OPIEDIR)/rsync/patch.c \
$$(OPIEDIR)/rsync/prototab.c \
$$(OPIEDIR)/rsync/readsums.c \
$$(OPIEDIR)/rsync/scoop.c \
$$(OPIEDIR)/rsync/search.c \
$$(OPIEDIR)/rsync/stats.c \
$$(OPIEDIR)/rsync/stream.c \
$$(OPIEDIR)/rsync/sumset.c \
$$(OPIEDIR)/rsync/trace.c \
$$(OPIEDIR)/rsync/tube.c \
$$(OPIEDIR)/rsync/util.c \
$$(OPIEDIR)/rsync/version.c \
$$(OPIEDIR)/rsync/whole.c \
$$(OPIEDIR)/rsync/qrsync.cpp \
syncdialog.cpp \
serverapp.cpp \
- launcherglobal.cpp \
qprocess.cpp \
qprocess_unix.cpp \
screensaver.cpp
INCLUDEPATH += $(OPIEDIR)/core/apps/calibrate
DEPENDPATH += $(OPIEDIR)/core/apps/calibrate
INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/rsync
DEPENDPATH += $(OPIEDIR)/rsync
TARGET = qpe
+#needs OWait and ODevice
CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX )
contains( CONFTEST, y ){
- LIBS += -lqpe -lopie
+ LIBS += -lqpe -lopiecore2 -lopieui2
}else{
- LIBS += -lcrypt -lqpe -lopie
+ LIBS += -lcrypt -lqpe -lopiecore2 -lopieui2
}
include ( $(OPIEDIR)/include.pro )
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index b84eed8..c199063 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -309,86 +309,86 @@ void StartMenu::clearApplets()
void StartMenu::loadApplets()
{
Config cfg( "StartMenu" );
cfg.setGroup( "Applets" );
// SafeMode causes too much problems, so we disable it for now --
// maybe we should reenable it for OPIE 1.0 - sandman 26.09.02
// removed in the remerge PluginManager could handle it
// we don't currently use it -zecke
QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
QString lang = getenv( "LANG" );
QString path = QPEApplication::qpeDir() + "/plugins/applets";
QDir dir( path, "lib*.so" );
QStringList list = dir.entryList();
QStringList::Iterator it;
int napplets = 0;
MenuApplet* *xapplets = new MenuApplet*[list.count()];
for ( it = list.begin(); it != list.end(); ++it ) {
if ( exclude.find( *it ) != exclude.end() )
continue;
MenuAppletInterface *iface = 0;
QLibrary *lib = new QLibrary( path + "/" + *it );
if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
MenuApplet *applet = new MenuApplet;
xapplets[napplets++] = applet;
applet->library = lib;
applet->iface = iface;
QTranslator *trans = new QTranslator(qApp);
QString type = (*it).left( (*it).find(".") );
QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
if ( trans->load( tfn ))
qApp->installTranslator( trans );
else
delete trans;
} else {
exclude += *it;
delete lib;
}
}
cfg.writeEntry( "ExcludeApplets", exclude, ',' );
qsort(xapplets, napplets, sizeof(menuApplets[0]), compareAppletPositions);
while ( napplets-- ) {
MenuApplet *applet = xapplets[napplets];
-
applet->popup = applet->iface->popup( this );
// menuApplets got an id < -1
menuApplets.insert( -( currentItem + 2 ), new MenuApplet( *applet ) );
currentItem++;
}
delete [] xapplets;
addApplets( launchMenu );
}
/*
* Launcher calls loadMenu too often fix that
*/
void StartMenu::addApplets(QPopupMenu* pop) {
QIntDict<MenuApplet> dict;
if( pop-> count ( ))
pop-> insertSeparator ( );
for ( QIntDictIterator<MenuApplet> it( menuApplets ); it.current(); ++it ) {
MenuApplet *applet = it.current();
if ( applet->popup )
applet->id = pop->insertItem( applet->iface->icon(),
applet->iface->text(), applet->popup );
else
applet->id = pop->insertItem( applet->iface->icon(),
applet->iface->text() );
+
dict.insert( applet->id, new MenuApplet( *applet ) );
}
/* need to update the key */
menuApplets.setAutoDelete( true );
menuApplets.clear();
menuApplets.setAutoDelete( false );
menuApplets = dict;
}
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index 9519d11..9cb9d7a 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -1,165 +1,164 @@
/**********************************************************************
** Copyright (C) 2000-2002 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.
**
**********************************************************************/
//#define _XOPEN_SOURCE
-#include <qtopia/global.h>
+#include <opie2/oglobal.h>
#include <qtopia/qpeapplication.h>
#ifndef Q_OS_WIN32
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#ifndef Q_OS_MACX
#include <shadow.h>
#include <crypt.h>
#endif /* Q_OS_MACX */
#else
#include <stdlib.h>
#include <time.h>
#endif
#if defined(_OS_LINUX_)
#include <shadow.h>
#endif
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qdatastream.h>
#include <qmessagebox.h>
#include <qstringlist.h>
#include <qfileinfo.h>
#include <qregexp.h>
//#include <qtopia/qcopchannel_qws.h>
#include <qtopia/process.h>
#include <qtopia/global.h>
#include <qtopia/config.h>
#include <qtopia/private/contact.h>
#include <qtopia/quuid.h>
#include <qtopia/version.h>
#ifdef Q_WS_QWS
#include <qtopia/qcopenvelope_qws.h>
#endif
-#include "launcherglobal.h"
#include "transferserver.h"
#include <qtopia/qprocess.h>
const int block_size = 51200;
TransferServer::TransferServer( Q_UINT16 port, QObject *parent,
const char* name)
: QServerSocket( port, 1, parent, name )
{
connections.setAutoDelete( TRUE );
if ( !ok() )
qWarning( "Failed to bind to port %d", port );
}
void TransferServer::authorizeConnections()
{
QListIterator<ServerPI> it(connections);
while ( it.current() ) {
if ( !it.current()->verifyAuthorised() ) {
disconnect( it.current(), SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) );
connections.removeRef( it.current() );
} else
++it;
}
}
void TransferServer::closed(ServerPI *item)
{
connections.removeRef(item);
}
TransferServer::~TransferServer()
{
}
void TransferServer::newConnection( int socket )
{
ServerPI *ptr = new ServerPI( socket, this );
connect( ptr, SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) );
connections.append( ptr );
}
QString SyncAuthentication::serverId()
{
Config cfg("Security");
cfg.setGroup("Sync");
QString r = cfg.readEntry("serverid");
if ( r.isEmpty() ) {
- r = Opie::Global::uuid();
+ r = OGlobal::generateUuid();
cfg.writeEntry("serverid", r );
}
return r;
}
QString SyncAuthentication::ownerName()
{
QString vfilename = Global::applicationFileName("addressbook",
"businesscard.vcf");
if (QFile::exists(vfilename)) {
Contact c;
c = Contact::readVCard( vfilename )[0];
return c.fullName();
}
return QString::null;
}
QString SyncAuthentication::loginName()
{
struct passwd *pw = 0L;
#ifndef Q_OS_WIN32
pw = getpwuid( geteuid() );
return QString::fromLocal8Bit( pw->pw_name );
#else
//### revise
return QString();
#endif
}
int SyncAuthentication::isAuthorized(QHostAddress peeraddress)
{
Config cfg("Security");
cfg.setGroup("Sync");
// QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0");
uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100);
// QHostAddress allowed;
// allowed.setAddress(allowedstr);
// uint auth_peer = allowed.ip4Addr();
uint auth_peer_bits = cfg.readNumEntry("auth_peer_bits", 24);
uint mask = auth_peer_bits >= 32 // shifting by 32 is not defined
? 0xffffffff : (((1 << auth_peer_bits) - 1) << (32 - auth_peer_bits));
return (peeraddress.ip4Addr() & mask) == auth_peer;
}
bool SyncAuthentication::checkUser( const QString& user )
diff --git a/core/launcher/wait.cpp b/core/launcher/wait.cpp
index ab53a07..34ffd1a 100644
--- a/core/launcher/wait.cpp
+++ b/core/launcher/wait.cpp
@@ -1,74 +1,74 @@
/**********************************************************************
** Copyright (C) 2000-2002 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 "wait.h"
#include <qtopia/resource.h>
#include <qtopia/config.h>
-#include <opie/owait.h>
+#include <opie2/owait.h>
#include <qwidget.h>
#include <qpixmap.h>
#include <qpainter.h>
Wait *lastWaitObject = NULL;
Wait::Wait( QWidget *parent ) : QWidget( parent ),
pm( Resource::loadPixmap( "wait" ) ), waiting( FALSE )
{
setFixedSize( pm.size() );
lastWaitObject = this;
m_centralWait = new OWait( 0l );
m_centralWait->hide();
hide();
}
Wait *Wait::getWaitObject()
{
return lastWaitObject;
}
void Wait::setWaiting( bool w )
{
Config cfg ( "Launcher" );
cfg.setGroup("GUI");
waiting = w;
if ( w ) {
if ( cfg. readBoolEntry( "BigBusy" ) )
m_centralWait->show();
else
show();
}else{
m_centralWait->hide();
hide();
}
}
void Wait::paintEvent( QPaintEvent * )
{
QPainter p( this );