author | zecke <zecke> | 2002-10-16 01:09:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-16 01:09:22 (UTC) |
commit | 543e54de7170c606b6883ac4152567e7faf13182 (patch) (side-by-side diff) | |
tree | 8a7d623e96cab0135a2f7cb11aa9f7491bfda9a2 /library | |
parent | 3e973543b77631d053a9616b5540966dbe51ab47 (diff) | |
download | opie-543e54de7170c606b6883ac4152567e7faf13182.zip opie-543e54de7170c606b6883ac4152567e7faf13182.tar.gz opie-543e54de7170c606b6883ac4152567e7faf13182.tar.bz2 |
Remove #ifdef QWS HELL
a Platform which is not supporting IPC compatible
to QCopChannel/Envelope is not of much use nowadays..
so be sure your platform is supporting it
-rw-r--r-- | library/alarmserver.cpp | 2 | ||||
-rw-r--r-- | library/applnk.cpp | 4 | ||||
-rw-r--r-- | library/fileselector.cpp | 2 | ||||
-rw-r--r-- | library/fontdatabase.cpp | 2 | ||||
-rw-r--r-- | library/fontmanager.cpp | 2 | ||||
-rw-r--r-- | library/global.cpp | 28 | ||||
-rw-r--r-- | library/ir.cpp | 2 | ||||
-rw-r--r-- | library/lnkproperties.cpp | 2 | ||||
-rw-r--r-- | library/network.cpp | 2 | ||||
-rw-r--r-- | library/networkinterface.cpp | 2 | ||||
-rw-r--r-- | library/password.cpp | 2 | ||||
-rw-r--r-- | library/qpedecoration_qws.cpp | 2 | ||||
-rw-r--r-- | library/tzselect.cpp | 4 |
13 files changed, 11 insertions, 45 deletions
diff --git a/library/alarmserver.cpp b/library/alarmserver.cpp index 177a0cb..02bca3d 100644 --- a/library/alarmserver.cpp +++ b/library/alarmserver.cpp @@ -1,81 +1,79 @@ /********************************************************************** ** 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 <qdir.h> #include <qfile.h> #include <qmessagebox.h> #include <qtextstream.h> #include <qpe/qpeapplication.h> #include "global.h" #include "resource.h" -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) #include <qpe/qcopenvelope_qws.h> -#endif #include "alarmserver.h" #include <qpe/timeconversion.h> #include <sys/types.h> #include <sys/stat.h> #include <stdlib.h> #include <unistd.h> struct timerEventItem { time_t UTCtime; QCString channel, message; int data; bool operator==( const timerEventItem &right ) const { return ( UTCtime == right.UTCtime && channel == right.channel && message == right.message && data == right.data ); } }; class TimerReceiverObject : public QObject { public: TimerReceiverObject() { } ~TimerReceiverObject() { } void resetTimer(); void setTimerEventItem(); void deleteTimer(); protected: void timerEvent( QTimerEvent *te ); private: QString atfilename; }; TimerReceiverObject *timerEventReceiver = NULL; QList<timerEventItem> timerEventList; timerEventItem *nearestTimerEvent = NULL; // set the timer to go off on the next event in the list void setNearestTimerEvent() { nearestTimerEvent = NULL; QListIterator<timerEventItem> it( timerEventList ); if ( *it ) nearestTimerEvent = *it; diff --git a/library/applnk.cpp b/library/applnk.cpp index a56da5d..5763c62 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp @@ -1,93 +1,89 @@ /********************************************************************** ** 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 QTOPIA_INTERNAL_MIMEEXT #define QTOPIA_INTERNAL_PRELOADACCESS #define QTOPIA_INTERNAL_APPLNKASSIGN #include "applnk.h" #include <qpe/qpeapplication.h> #include <qpe/categories.h> #include <qpe/categoryselect.h> -#ifdef QWS #include <qpe/qcopenvelope_qws.h> -#endif #include <qpe/global.h> #include <qpe/mimetype.h> #include <qpe/config.h> #include <qpe/storage.h> #include <qpe/resource.h> #include <qdict.h> #include <qdir.h> #include <qregexp.h> -#ifdef Q_WS_QWS #include <qgfx_qws.h> -#endif #include <stdlib.h> int AppLnk::lastId = 5000; static int smallSize = 14; static int bigSize = 32; static QString safeFileName(const QString& n) { QString safename=n; safename.replace(QRegExp("[^0-9A-Za-z.]"),"_"); safename.replace(QRegExp("^[^A-Za-z]*"),""); if ( safename.isEmpty() ) safename = "_"; return safename; } static bool prepareDirectories(const QString& lf) { if ( !QFile::exists(lf) ) { // May need to create directories QFileInfo fi(lf); if ( system(("mkdir -p "+fi.dirPath(TRUE))) ) return FALSE; } return TRUE; } class AppLnkPrivate { public: /* the size of the Pixmap */ enum Size {Normal = 0, Big }; AppLnkPrivate() { /* we want one normal and one big item */ QPixmap pix; mPixmaps.insert(0, pix ); mPixmaps.insert(1, pix); } QStringList mCatList; // always correct QArray<int> mCat; // cached value; correct if not empty QMap<int, QPixmap> mPixmaps; void updateCatListFromArray() { diff --git a/library/fileselector.cpp b/library/fileselector.cpp index 052a29e..4039243 100644 --- a/library/fileselector.cpp +++ b/library/fileselector.cpp @@ -1,83 +1,81 @@ /********************************************************************** ** 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. ** **********************************************************************/ // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT // have this class. #define QTOPIA_INTERNAL_FSLP #include "fileselector.h" #include "fileselector_p.h" #include "global.h" #include "resource.h" #include "config.h" #include "applnk.h" #include "storage.h" #include "qpemenubar.h" -#ifdef QWS #include <qcopchannel_qws.h> -#endif #include "lnkproperties.h" #include "applnk.h" #include <qpe/qpeapplication.h> #include "categorymenu.h" #include "categoryselect.h" #include "mimetype.h" #include <qpe/categories.h> #include <stdlib.h> #include <qdir.h> #include <qwidget.h> #include <qpopupmenu.h> #include <qtoolbutton.h> #include <qpushbutton.h> #include <qheader.h> #include <qtooltip.h> #include <qwhatsthis.h> class TypeCombo : public QComboBox { Q_OBJECT public: TypeCombo( QWidget *parent, const char *name=0 ) : QComboBox( parent, name ) { connect( this, SIGNAL(activated(int)), this, SLOT(selectType(int)) ); } void reread( DocLnkSet &files, const QString &filter ); signals: void selected( const QString & ); protected slots: void selectType( int idx ) { emit selected( typelist[idx] ); } protected: QStringList typelist; QString prev; }; void TypeCombo::reread( DocLnkSet &files, const QString &filter ) { typelist.clear(); QStringList filters = QStringList::split( ';', filter ); diff --git a/library/fontdatabase.cpp b/library/fontdatabase.cpp index 2b5e0d2..147134c 100644 --- a/library/fontdatabase.cpp +++ b/library/fontdatabase.cpp @@ -1,77 +1,75 @@ /********************************************************************** ** 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 <qpe/qpeapplication.h> #include "fontfactoryinterface.h" #include "fontdatabase.h" #include <qpe/qlibrary.h> -#ifdef QWS #include <qfontmanager_qws.h> -#endif #include <qdir.h> #include <qdict.h> #include <stdio.h> #include <stdlib.h> static QString fontDir() { QString qtdir = getenv("QTDIR"); if ( qtdir.isEmpty() ) qtdir = "/usr/local/qt-embedded"; return qtdir+"/lib/fonts/"; } #ifdef QT_NO_FONTDATABASE static QString fontFamily( const QString& key ) { int u0 = key.find('_'); int u1 = key.find('_',u0+1); int u2 = key.find('_',u1+1); QString family = key.left(u0); //int pointSize = key.mid(u0+1,u1-u0-1).toInt(); //int weight = key.mid(u1+1,u2-u1-1).toInt(); //bool italic = key.mid(u2-1,1) == "i"; // #### ignores _t and _I fields return family; } #endif QValueList<FontFactory> *FontDatabase::factoryList = 0; /*! \class FontDatabase fontdatabase.h \brief The FontDatabase class provides information about available fonts. Most often you will simply want to query the database for the available font families(). Use FontDatabase rather than QFontDatabase when you may need access to fonts that are not normally available. For example, if the freetype library and the Qtopia freetype plugin are installed, TrueType fonts will be available to your application. Font renderer plugins have greater resource requirements than system fonts so they should be used only when necessary. You can force the loading of font renderer plugins with loadRenderers(). \ingroup qtopiaemb */ /*! diff --git a/library/fontmanager.cpp b/library/fontmanager.cpp index 28a5212..c854133 100644 --- a/library/fontmanager.cpp +++ b/library/fontmanager.cpp @@ -1,103 +1,101 @@ /********************************************************************** ** 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. ** **********************************************************************/ -#ifdef QWS #include "fontmanager.h" #include <qfile.h> #include <stdlib.h> #include <qgfx_qws.h> /* QFontInfo doesn't work in QWS at the moment, otherwise we would just have used that to check the real values For now, there are only two Unicode fonts in the known universe... */ bool FontManager::hasUnicodeFont() { QString fontDir = getenv("QTDIR") + QString("/lib/fonts/"); QString suffix; if ( qt_screen->isTransformed() ) { suffix += "_t"; QPoint a = qt_screen->mapToDevice(QPoint(0,0),QSize(2,2)); QPoint b = qt_screen->mapToDevice(QPoint(1,1),QSize(2,2)); suffix += QString::number( a.x()*8+a.y()*4+(1-b.x())*2+(1-b.y()) ); } suffix += ".qpf"; return QFile::exists( fontDir+"cyberbit_120_50"+suffix ) || QFile::exists( fontDir+"unifont_160_50"+suffix ) || QFile::exists( fontDir+"arial_140_50" + suffix ); } QFont FontManager::unicodeFont( Spacing sp ) { QString key; QString fontName; QString fontDir = getenv("QTDIR") + QString("/lib/fonts/"); int size; if ( sp == Proportional ) { fontName = "Arial"; size=14; key = "arial_140_50"; } else { fontName = "Unifont"; size=16; key = "unifont_160_50"; } QString suffix; if ( qt_screen->isTransformed() ) { suffix += "_t"; QPoint a = qt_screen->mapToDevice(QPoint(0,0),QSize(2,2)); QPoint b = qt_screen->mapToDevice(QPoint(1,1),QSize(2,2)); suffix += QString::number( a.x()*8+a.y()*4+(1-b.x())*2+(1-b.y()) ); } suffix += ".qpf"; // if we cannot find it, try the other one if ( !QFile::exists(fontDir+key+suffix) ) { key = (sp == Fixed ) ? "arial_140_50" : "unifont_160_50"; if ( QFile::exists(fontDir+key+suffix) ) { fontName = (sp == Fixed) ? "Arial" : "Unifont"; size = (sp == Fixed) ? 14 : 16; } else { key = "cyberbit_120_50"; if ( QFile::exists(fontDir+key+suffix) ) { fontName = "Cyberbit"; size = 12; } else { fontName = "Helvetica"; size = 14; } } } return QFont(fontName,size); } -#endif diff --git a/library/global.cpp b/library/global.cpp index 9b908bf..d02e711 100644 --- a/library/global.cpp +++ b/library/global.cpp @@ -1,167 +1,161 @@ /********************************************************************** ** 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 QTOPIA_INTERNAL_LANGLIST #include <qpe/qpedebug.h> #include <qpe/global.h> #include <qpe/qdawg.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/storage.h> #include <qpe/applnk.h> -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) -#include "qpe/qcopenvelope_qws.h" -#endif +#include <qpe/qcopenvelope_qws.h> #include <qfile.h> #include <qlabel.h> #include <qtimer.h> #include <qmap.h> #include <qdict.h> #include <qdir.h> #include <qmessagebox.h> #include <qregexp.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/wait.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> -#ifdef QWS #include <qwindowsystem_qws.h> // for qwsServer -#endif #include <qdatetime.h> #include <qfile.h> namespace { // checks if the storage should be searched bool checkStorage(const QString &path ){ // this is a small Config replacement cause config is too limited -zecke QFile file(path ); if(!file.open(IO_ReadOnly ) ) return true; QByteArray array = file.readAll(); QStringList list = QStringList::split('\n', QString( array ) ); for(QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ if( (*it).startsWith("autocheck = 0" ) ){ return false; }else if( (*it).startsWith("autocheck = 1" ) ){ return true; } } return true; } } //#include "quickexec_p.h" class Emitter : public QObject { Q_OBJECT public: Emitter( QWidget* receiver, const QString& document ) { connect(this, SIGNAL(setDocument(const QString&)), receiver, SLOT(setDocument(const QString&))); emit setDocument(document); disconnect(this, SIGNAL(setDocument(const QString&)), receiver, SLOT(setDocument(const QString&))); } signals: void setDocument(const QString&); }; class StartingAppList : public QObject { Q_OBJECT public: static void add( const QString& name ); static bool isStarting( const QString name ); private slots: void handleNewChannel( const QString &); private: StartingAppList( QObject *parent=0, const char* name=0 ) ; QDict<QTime> dict; static StartingAppList *appl; }; StartingAppList* StartingAppList::appl = 0; StartingAppList::StartingAppList( QObject *parent, const char* name ) :QObject( parent, name ) { -#ifdef QWS #if QT_VERSION >= 232 && !defined(QT_NO_COP) connect( qwsServer, SIGNAL( newChannel(const QString&)), this, SLOT( handleNewChannel(const QString&)) ); dict.setAutoDelete( TRUE ); #endif -#endif } void StartingAppList::add( const QString& name ) { #if QT_VERSION >= 232 && !defined(QT_NO_COP) if ( !appl ) appl = new StartingAppList; QTime *t = new QTime; t->start(); appl->dict.insert( "QPE/Application/" + name, t ); #endif } bool StartingAppList::isStarting( const QString name ) { #if QT_VERSION >= 232 && !defined(QT_NO_COP) if ( appl ) { QTime *t = appl->dict.find( "QPE/Application/" + name ); if ( !t ) return FALSE; if ( t->elapsed() > 10000 ) { // timeout in case of crash or something appl->dict.remove( "QPE/Application/" + name ); return FALSE; } return TRUE; } #endif return FALSE; } void StartingAppList::handleNewChannel( const QString & name ) { #if QT_VERSION >= 232 && !defined(QT_NO_COP) dict.remove( name ); #endif } static bool docDirCreated = FALSE; static QDawg* fixed_dawg = 0; static QDict<QDawg> *named_dawg = 0; static QString qpeDir() { QString dir = getenv("OPIEDIR"); if ( dir.isEmpty() ) dir = ".."; return dir; } @@ -348,164 +342,164 @@ void Global::addWords(const QString& dictname, const QStringList& wordlist) // #### Re-read the dawg here if we use mmap(). // #### Signal other processes to re-read. } /*! Returns the full path for the application called \a appname, with the given \a filename. Returns QString::null if there was a problem creating the directory tree for \a appname. If \a filename contains "/", it is the caller's responsibility to ensure that those directories exist. */ QString Global::applicationFileName(const QString& appname, const QString& filename) { QDir d; QString r = getenv("HOME"); r += "/Applications/"; if ( !QFile::exists( r ) ) if ( d.mkdir(r) == false ) return QString::null; r += appname; if ( !QFile::exists( r ) ) if ( d.mkdir(r) == false ) return QString::null; r += "/"; r += filename; return r; } /*! \internal */ void Global::createDocDir() { if ( !docDirCreated ) { docDirCreated = TRUE; mkdir( QPEApplication::documentDir().latin1(), 0755 ); } } /*! Displays a status \a message to the user. This usually appears in the taskbar for a short amount of time, then disappears. */ void Global::statusMessage(const QString& message) { -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if!defined(QT_NO_COP) QCopEnvelope e( "QPE/TaskBar", "message(QString)" ); e << message; #endif } /*! \internal */ void Global::applyStyle() { -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) QCopChannel::send( "QPE/System", "applyStyle()" ); #else ((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version #endif } /*! \internal */ QWidget *Global::shutdown( bool ) { -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) QCopChannel::send( "QPE/System", "shutdown()" ); #endif return 0; } /*! \internal */ QWidget *Global::restart( bool ) { -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) QCopChannel::send( "QPE/System", "restart()" ); #endif return 0; } /*! Explicitly show the current input method. Input methods are indicated in the taskbar by a small icon. If the input method is activated (shown) then it takes up some proportion of the bottom of the screen, to allow the user to interact (input characters) with it. \sa hideInputMethod() */ void Global::showInputMethod() { -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) QCopChannel::send( "QPE/TaskBar", "showInputMethod()" ); #endif } /*! Explicitly hide the current input method. The current input method is still indicated in the taskbar, but no longer takes up screen space, and can no longer be interacted with. \sa showInputMethod() */ void Global::hideInputMethod() { -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) QCopChannel::send( "QPE/TaskBar", "hideInputMethod()" ); #endif } /*! \internal */ bool Global::isBuiltinCommand( const QString &name ) { if(!builtin) return FALSE; // yes, it can happen for (int i = 0; builtin[i].file; i++) { if ( builtin[i].file == name ) { return TRUE; } } return FALSE; } Global::Command* Global::builtin=0; QGuardedPtr<QWidget> *Global::running=0; /*! \class Global::Command \brief The Global::Command class is internal. \internal */ /*! \internal */ void Global::setBuiltinCommands( Command* list ) { if ( running ) delete [] running; builtin = list; int count = 0; if (!builtin) return; while ( builtin[count].file ) count++; running = new QGuardedPtr<QWidget> [ count ]; } /*! @@ -514,214 +508,214 @@ void Global::setBuiltinCommands( Command* list ) void Global::setDocument( QWidget* receiver, const QString& document ) { Emitter emitter(receiver,document); } /*! \internal */ bool Global::terminateBuiltin( const QString& n ) { if (!builtin) return FALSE; for (int i = 0; builtin[i].file; i++) { if ( builtin[i].file == n ) { delete running[i]; return TRUE; } } return FALSE; } /*! \internal */ void Global::terminate( const AppLnk* app ) { //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this #ifndef QT_NO_COP QCString channel = "QPE/Application/" + app->exec().utf8(); if ( QCopChannel::isRegistered(channel) ) { QCopEnvelope e(channel, "quit()"); } #endif } /*! Low-level function to run command \a c. \warning Do not use this function. Use execute instead. \sa execute() */ void Global::invoke(const QString &c) { // Convert the command line in to a list of arguments QStringList list = QStringList::split(QRegExp(" *"),c); -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) QString ap=list[0]; // see if the application is already running // XXX should lock file /tmp/qcop-msg-ap if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { // If the channel is already register, the app is already running, so show it. { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } QCopEnvelope e("QPE/System", "notBusy(QString)" ); e << ap; return; } // XXX should unlock file /tmp/qcop-msg-ap //see if it is being started if ( StartingAppList::isStarting( ap ) ) { QCopEnvelope e("QPE/System", "notBusy(QString)" ); e << ap; return; } #endif #ifdef QT_NO_QWS_MULTIPROCESS QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); #else QStrList slist; unsigned int 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; -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) // an attempt to show a wait... // more logic should be used, but this will be fine for the moment... QCopEnvelope ( "QPE/System", "busy()" ); #endif #ifdef HAVE_QUICKEXEC QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; qDebug("libfile = %s", libexe.latin1() ); if ( QFile::exists( libexe ) ) { qDebug("calling quickexec %s", libexe.latin1() ); quickexecv( libexe.utf8().data(), (const char **)args ); } else #endif { if ( !::vfork() ) { for ( int fd = 3; fd < 100; fd++ ) ::close( fd ); ::setpgid( ::getpid(), ::getppid() ); // Try bindir first, so that foo/bar works too ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); ::execvp( args[0], (char * const *)args ); _exit( -1 ); } } StartingAppList::add( list[0] ); #endif //QT_NO_QWS_MULTIPROCESS } /*! Executes the application identfied by \a c, passing \a document if it isn't null. Note that a better approach might be to send a QCop message to the application's QPE/Application/\e{appname} channel. */ void Global::execute( const QString &c, const QString& document ) { if ( qApp->type() != QApplication::GuiServer ) { // ask the server to do the work -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) if ( document.isNull() ) { QCopEnvelope e( "QPE/System", "execute(QString)" ); e << c; } else { QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); e << c << document; } #endif return; } // Attempt to execute the app using a builtin class for the app first // else try and find it in the bin directory if (builtin) { for (int i = 0; builtin[i].file; i++) { if ( builtin[i].file == c ) { if ( running[i] ) { if ( !document.isNull() && builtin[i].documentary ) 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; } } } //Global::invoke(c, document); // Convert the command line in to a list of arguments QStringList list = QStringList::split(QRegExp(" *"),c); -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) QString ap=list[0]; qDebug("executing %s", ap.latin1() ); /* if need be, sending a qcop message will result in an invoke, see preceeding function */ invoke( ap ); //{ QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } if ( !document.isEmpty() ) { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" ); env << document; } #endif } /*! Returns the string \a s with the characters '\', '"', and '$' quoted by a preceeding '\'. \sa stringQuote() */ QString Global::shellQuote(const QString& s) { QString r="\""; for (int i=0; i<(int)s.length(); i++) { char c = s[i].latin1(); switch (c) { case '\\': case '"': case '$': r+="\\"; } r += s[i]; } r += "\""; return r; } /*! Returns the string \a s with the characters '\' and '"' quoted by a preceeding '\'. \sa shellQuote() */ QString Global::stringQuote(const QString& s) { QString r="\""; for (int i=0; i<(int)s.length(); i++) { char c = s[i].latin1(); switch (c) { diff --git a/library/ir.cpp b/library/ir.cpp index a7cf7b1..b5b726d 100644 --- a/library/ir.cpp +++ b/library/ir.cpp @@ -1,75 +1,73 @@ /********************************************************************** ** 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 "ir.h" #include <qstring.h> -#ifdef QWS #include "qcopenvelope_qws.h" #include <qcopchannel_qws.h> -#endif #include "applnk.h" /*! \class Ir ir.h \brief The Ir class implements basic support for sending objects over an infrared communication link. Both \link doclnk.html DocLnk\endlink objects and files can be sent to another device via the infrared link using the send() function. When the send has completed the done() signal is emitted. The supported() function returns whether the device supports infrared communication or not. \ingroup qtopiaemb */ /*! Constructs an Ir object. The \a parent and \a name classes are the standard QObject parameters. */ Ir::Ir( QObject *parent, const char *name ) : QObject( parent, name ) { #ifndef QT_NO_COP ch = new QCopChannel( "QPE/Obex" ); connect( ch, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(obexMessage( const QCString &, const QByteArray &)) ); #endif } /*! Returns TRUE if the system supports infrared communication; otherwise returns FALSE. */ bool Ir::supported() { #ifndef QT_NO_COP return QCopChannel::isRegistered( "QPE/Obex" ); #endif } /*! Sends the object in file \a fn over the infrared link. The \a description is used in the text shown to the user while sending is in progress. The optional \a mimetype parameter specifies the mimetype of the object. If this parameter is not set, it is diff --git a/library/lnkproperties.cpp b/library/lnkproperties.cpp index 0b50bae..50cf5af 100644 --- a/library/lnkproperties.cpp +++ b/library/lnkproperties.cpp @@ -1,83 +1,81 @@ /********************************************************************** ** 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. ** **********************************************************************/ // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT // have this class. #define QTOPIA_INTERNAL_FSLP #include "lnkproperties.h" #include "lnkproperties.h" #include "lnkpropertiesbase_p.h" #include "ir.h" #include <qpe/qpeapplication.h> #include <qpe/applnk.h> #include <qpe/global.h> #include <qpe/categorywidget.h> -#ifdef QWS #include <qpe/qcopenvelope_qws.h> -#endif #include <qpe/filemanager.h> #include <qpe/config.h> #include <qpe/storage.h> #include <qpe/qpemessagebox.h> #include <qpe/mimetype.h> #include <qlineedit.h> #include <qtoolbutton.h> #include <qpushbutton.h> #include <qgroupbox.h> #include <qcheckbox.h> #include <qlabel.h> #include <qlayout.h> #include <qfile.h> #include <qfileinfo.h> #include <qmessagebox.h> #include <qsize.h> #include <qcombobox.h> #include <qregexp.h> #include <qbuttongroup.h> #include <stdlib.h> LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 ) { setCaption( tr("Properties") ); QVBoxLayout *vbox = new QVBoxLayout( this ); d = new LnkPropertiesBase( this ); vbox->add( d ); d->docname->setText(l->name()); QString inf; if ( l->type().isEmpty() ) { d->type->hide(); d->typeLabel->hide(); } else { d->type->setText( l->type() ); } if ( l->comment().isEmpty() ) { d->comment->hide(); d->commentLabel->hide(); } else { d->comment->setText( l->comment() ); } diff --git a/library/network.cpp b/library/network.cpp index 185b147..3568809 100644 --- a/library/network.cpp +++ b/library/network.cpp @@ -1,78 +1,76 @@ /********************************************************************** ** 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 QTOPIA_INTERNAL_LANGLIST #include "qpe/network.h" #include "qpe/networkinterface.h" #include "qpe/global.h" #include "qpe/config.h" #include "qpe/resource.h" #include "qpe/qpeapplication.h" -#ifdef QWS #include <qpe/qcopenvelope_qws.h> -#endif #include <qpe/qlibrary.h> #include <qlistbox.h> #include <qdir.h> #include <qlayout.h> #include <qdict.h> #include <qtranslator.h> #include <stdlib.h> #ifndef QT_NO_COP class NetworkEmitter : public QCopChannel { Q_OBJECT public: NetworkEmitter() : QCopChannel("QPE/Network",qApp) { } void receive(const QCString &msg, const QByteArray&) { if ( msg == "choicesChanged()" ) emit changed(); } signals: void changed(); }; /*! \internal Requests that the service \a choice be started. The \a password is the password to use if required. */ void Network::start(const QString& choice, const QString& password) { QCopEnvelope e("QPE/Network", "start(QString,QString)"); e << choice << password; } /*! \class Network network.h \brief The Network class provides network access functionality. \internal */ // copy the proxy settings of the active config over to the Proxies.conf file /*! diff --git a/library/networkinterface.cpp b/library/networkinterface.cpp index 2b5c77e..0ba773a 100644 --- a/library/networkinterface.cpp +++ b/library/networkinterface.cpp @@ -1,98 +1,96 @@ /********************************************************************** ** 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 "networkinterface.h" #include "network.h" #include "config.h" #include <stdio.h> QString NetworkInterface::device( Config& cfg ) const { return cfg.readEntry("Device"); } bool NetworkInterface::isActive( Config& cfg ) const { QString dev = device(cfg); if ( dev.isEmpty() ) return FALSE; QString dev0 = dev+'0'; FILE* f; f = fopen("/proc/net/dev", "r"); if ( f ) { char line[1024]; char devname[80]; while ( fgets( line, 1024, f ) ) { if ( sscanf(line," %[^:]:", devname)==1 ) { if ( devname == dev || devname == dev0 ) { fclose(f); -#ifdef QWS Network::writeProxySettings( cfg ); -#endif return TRUE; } } } fclose(f); } return FALSE; } QString NetworkInterface::cardType( Config& cfg ) const { return cfg.readEntry("CardType"); } bool NetworkInterface::isAvailable( Config& cfg ) const { QString ct = cardType(cfg); if ( ct.isEmpty() ) return FALSE; FILE* f = fopen("/var/run/stab", "r"); if (!f) f = fopen("/var/state/pcmcia/stab", "r"); if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); if ( f ) { char line[1024]; char devtype[80]; while ( fgets( line, 1024, f ) ) { if ( sscanf(line,"%*d %s %*s", devtype )==1 ) { if ( ct == devtype ) { fclose(f); return TRUE; } } } fclose(f); } return FALSE; } bool NetworkInterface::start( Config& cfg, const QString& /*password*/ ) { return start(cfg); } bool NetworkInterface::needPassword( Config& ) const diff --git a/library/password.cpp b/library/password.cpp index 41b3358..4b22b65 100644 --- a/library/password.cpp +++ b/library/password.cpp @@ -1,80 +1,78 @@ /********************************************************************** ** 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 "password.h" #include "config.h" #include "global.h" #include "backend/contact.h" #include <qlabel.h> #include <qlineedit.h> #include <qtextview.h> #include <qstring.h> #include <qapplication.h> #include <qfile.h> -#ifdef QWS #include <qwindowsystem_qws.h> -#endif #include <qdialog.h> #include <unistd.h> //for sleep #include "passwordbase_p.h" class PasswordDialog : public PasswordBase { Q_OBJECT public: PasswordDialog( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~PasswordDialog(); void clear(); void setPrompt( const QString& ); signals: void passwordEntered( const QString& ); protected: bool eventFilter( QObject*, QEvent* ); void keyPressEvent( QKeyEvent * ); private: void input( QString ); friend class Password; QString text; }; extern "C" char *crypt(const char *key, const char *salt); static QString qcrypt(const QString& k, const char *salt) { return QString::fromUtf8(crypt(k.utf8(),salt)); } /* * Constructs a PasswordDialog which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ PasswordDialog::PasswordDialog( QWidget* parent, const char* name, WFlags fl ) : PasswordBase( parent, name, fl ) { QRect desk = qApp->desktop()->geometry(); if ( desk.width() < 220 ) { QFont f( font() ); diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp index 214c721..9cbe92b 100644 --- a/library/qpedecoration_qws.cpp +++ b/library/qpedecoration_qws.cpp @@ -1,68 +1,67 @@ /********************************************************************** ** 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. ** **********************************************************************/ -#ifdef QWS #define QTOPIA_INTERNAL_LANGLIST #include <qapplication.h> #include <qstyle.h> #include <qwidget.h> #include <qpainter.h> #include <qtimer.h> #include <qwhatsthis.h> #include "qcopenvelope_qws.h" #include "qpedecoration_qws.h" #include <qdialog.h> #include <qdrawutil.h> #include <qgfx_qws.h> #include "qpeapplication.h" #include "resource.h" #include "global.h" #include "qlibrary.h" #include "windowdecorationinterface.h" #include <qfile.h> #include <qsignal.h> #include <stdlib.h> extern QRect qt_maxWindowRect; #define WHATSTHIS_MODE #ifndef QT_NO_QWS_QPE_WM_STYLE #ifndef QT_NO_IMAGEIO_XPM /* XPM */ static const char * const qpe_close_xpm[] = { "16 16 3 1", " c None", ". c #FFFFFF", "+ c #000000", " ", " ", " ..... ", " ..+++++.. ", " .+++++++++. ", " .+..+++..+. ", " .++...+...++. ", " .+++.....+++. ", " .++++...++++. ", " .+++.....+++. ", " .++...+...++. ", " .+..+++..+. ", @@ -866,49 +865,48 @@ void QPEDecoration::minimize( QWidget *widget ) help( widget ); } } void QPEDecoration::help( QWidget *w ) { if ( helpExists ) { Global::execute( "helpbrowser", helpFile ); } else if ( w && w->testWFlags(Qt::WStyle_ContextHelp) ) { QWhatsThis::enterWhatsThisMode(); QWhatsThis::leaveWhatsThisMode( qApp->tr( "<Qt>Comprehensive help is not available for this application, " "however there is context-sensitive help.<p>To use context-sensitive help:<p>" "<ol><li>click and hold the help button." "<li>when the title bar shows <b>What's this...</b>, " "click on any control.</ol></Qt>" ) ); } } void QPEDecoration::windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const { wd.rect = w->rect(); if ( qpeManager->whatsThisWidget() == w ) wd.caption = qApp->tr("What's this..." ); else wd.caption = w->caption(); wd.palette = qApp->palette(); wd.flags = 0; wd.flags |= w->isMaximized() ? WindowDecorationInterface::WindowData::Maximized : 0; wd.flags |= w->testWFlags(Qt::WStyle_Dialog) ? WindowDecorationInterface::WindowData::Dialog : 0; const QWidget *active = qpeManager->activeWidget(); wd.flags |= w == active ? WindowDecorationInterface::WindowData::Active : 0; wd.reserved = 1; } /* #ifndef QT_NO_POPUPMENU QPopupMenu *QPEDecoration::menu(QWSManager*, const QWidget*, const QPoint&) { return 0; } #endif */ #endif // QT_NO_QWS_QPE_WM_STYLE -#endif diff --git a/library/tzselect.cpp b/library/tzselect.cpp index 9436867..2e5a433 100644 --- a/library/tzselect.cpp +++ b/library/tzselect.cpp @@ -1,125 +1,121 @@ /********************************************************************** ** 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 QTOPIA_INTERNAL_TZSELECT_INC_LOCAL #include "tzselect.h" #include "resource.h" #include "global.h" #include "config.h" #include <qtoolbutton.h> #include <qfile.h> #include <stdlib.h> -#ifdef Q_WS_QWS #include <qcopchannel_qws.h> -#endif class TimeZoneSelectorPrivate { public: TimeZoneSelectorPrivate() : includeLocal(FALSE) {} bool includeLocal; }; TZCombo::TZCombo( QWidget *p, const char* n ) : QComboBox( p, n ) { updateZones(); // check to see if TZ is set, if it is set the current item to that QString tz = getenv("TZ"); if (parent()->inherits("TimeZoneSelector")) { if ( ((TimeZoneSelector *)parent())->localIncluded() ) { // overide to the 'local' type. tz = "None"; } } if ( !tz.isNull() ) { int n = 0, index = 0; for ( QStringList::Iterator it=identifiers.begin(); it!=identifiers.end(); ++it) { if ( *it == tz ) index = n; n++; } setCurrentItem(index); } else { setCurrentItem(0); } // listen on QPE/System -#if defined(Q_WS_QWS) #if !defined(QT_NO_COP) QCopChannel *channel = new QCopChannel( "QPE/System", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) ); #endif -#endif } TZCombo::~TZCombo() { } void TZCombo::updateZones() { QString cur = currentText(); clear(); identifiers.clear(); int curix=0; QString tz = getenv("TZ"); bool tzFound = FALSE; Config cfg("CityTime"); cfg.setGroup("TimeZones"); int listIndex = 0; if (parent()->inherits("TimeZoneSelector")) { if ( ((TimeZoneSelector *)parent())->localIncluded() ) { // overide to the 'local' type. identifiers.append( "None" ); insertItem( tr("None") ); if ( cur == tr("None")) curix = 0; listIndex++; } } int cfgIndex = 0; while (1) { QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null); if ( zn.isNull() ) break; if ( zn == tz ) tzFound = TRUE; QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex)); identifiers.append(zn); insertItem(nm); if ( nm == cur ) curix = listIndex; ++cfgIndex; ++listIndex; } if ( !listIndex ) { QStringList list = timezoneDefaults(); for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) { QString zn = *it; |