summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-16 15:34:05 (UTC)
committer zecke <zecke>2002-10-16 15:34:05 (UTC)
commit321cea04e34658fde3de47c104682b5cefce6eeb (patch) (side-by-side diff)
treeabdf45ae54d24dedfd20e4e40371df5f39687139
parent61f2f6ef32685002710f197dc8990fd9e99d83a5 (diff)
downloadopie-321cea04e34658fde3de47c104682b5cefce6eeb.zip
opie-321cea04e34658fde3de47c104682b5cefce6eeb.tar.gz
opie-321cea04e34658fde3de47c104682b5cefce6eeb.tar.bz2
more implementation!!
OCOPClient now tries to start the server
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--x11/ipc/client/ocopclient.cpp21
-rw-r--r--x11/ipc/client/ocopclient.h4
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.cpp207
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.h23
4 files changed, 241 insertions, 14 deletions
diff --git a/x11/ipc/client/ocopclient.cpp b/x11/ipc/client/ocopclient.cpp
index 43e426c..ac6e4a3 100644
--- a/x11/ipc/client/ocopclient.cpp
+++ b/x11/ipc/client/ocopclient.cpp
@@ -1,129 +1,150 @@
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <sys/un.h>
#include <qfile.h>
#include <qtimer.h>
#include "../common/ocoppacket.h"
#include "ocopclient.h"
OCOPClient::OCOPClient( const QString& path, QObject* obj )
: QObject( obj )
{
+ m_tries = 0;
init(QFile::encodeName(path) );
}
OCOPClient::~OCOPClient() {
+ delete m_notify;
close( m_socket );
}
+void OCOPClient::init() {
+ // failed start ther server NOW!!!
+ startUP();
+ QCString str;
+ init(str );
+}
void OCOPClient::init( const QCString& ) {
+ m_tries++;
struct sockaddr_un unix_adr;
if ( (m_socket = socket(PF_UNIX, SOCK_STREAM, 0) ) < 0 ) {
qWarning("could not socket");
+ if ( m_tries < 8 )
QTimer::singleShot(400, this,SLOT(init() ) );
return;
}
memset(&unix_adr, 0, sizeof(unix_adr ) );
unix_adr.sun_family = AF_UNIX;
sprintf(unix_adr.sun_path,"%s/.opie.cop", getenv("HOME") );
int length = sizeof(unix_adr.sun_family) + strlen(unix_adr.sun_path);
if ( ::connect(m_socket, (struct sockaddr*)&unix_adr, length ) < 0 ) {
qWarning("could not connect %d", errno );
close( m_socket );
+ if ( m_tries < 8 )
QTimer::singleShot(400, this, SLOT(init() ) );
return;
}
m_notify = new QSocketNotifier(m_socket, QSocketNotifier::Read, this );
connect( m_notify, SIGNAL(activated(int) ),
this, SLOT(newData() ) );
}
/**
* new data
* read the header check magic number
* and maybe read body
*/
void OCOPClient::newData() {
OCOPPacket pack = packet();
if ( pack.channel().isEmpty() )
return;
switch( pack.type() ) {
case OCOPPacket::Register:
case OCOPPacket::Unregister:
case OCOPPacket::Method:
case OCOPPacket::RegisterChannel:
case OCOPPacket::UnregisterChannel:
case OCOPPacket::Return:
case OCOPPacket::Signal:
/* is Registered should be handled sync */
case OCOPPacket::IsRegistered:
break;
/* emit the signal */
case OCOPPacket::Call:
emit called( pack.channel(), pack.header(), pack.content() );
break;
}
}
OCOPPacket OCOPClient::packet() const{
QCString chan;
QCString func;
QByteArray ar;
OCOPHead head;
memset(&head, 0, sizeof(head) );
read(m_socket, &head, sizeof(head) );
if ( head.magic == 47 ) {
read(m_socket, chan.data(), head.chlen );
read(m_socket, func.data(), head.funclen );
read(m_socket, ar.data(), head.datalen );
}
OCOPPacket pack(head.type, chan, func, ar );
return pack;
}
/*
* we've blocking IO here on these sockets
* so we send and go on read
* this will be blocked
*/
bool OCOPClient::isRegistered( const QCString& chan ) const{
/* should I disconnect the socket notfier? */
OCOPPacket packe(OCOPPacket::IsRegistered, chan );
OCOPHead head = packe.head();
write(m_socket, &head, sizeof(head) );
/* block */
OCOPPacket pack = packet();
/* connect here again */
if ( pack.channel() == chan ) {
QCString func = pack.header();
if (func[0] == 1 )
return true;
}
return false;
};
void OCOPClient::send( const QCString& chan, const QCString& fu, const QByteArray& arr ) {
OCOPPacket pack(OCOPPacket::Call, chan, fu, arr );
call( pack );
}
void OCOPClient::addChannel(const QCString& channel) {
OCOPPacket pack(OCOPPacket::RegisterChannel, channel );
call( pack );
}
void OCOPClient::delChannel(const QCString& chan ) {
OCOPPacket pack(OCOPPacket::UnregisterChannel, chan );
call( pack );
}
void OCOPClient::call( const OCOPPacket& pack ) {
OCOPHead head = pack.head();
write(m_socket, &head, sizeof(head) );
write(m_socket, pack.channel().data(), pack.channel().size() );
write(m_socket, pack.header().data(), pack.header().size() );
write(m_socket, pack.content().data(), pack.content().size() );
}
+void OCOPClient::startUP() {
+ qWarning("Start me up");
+ pid_t pi = fork();
+ if ( pi == 0 ) {
+ setsid();
+ execlp("opie-ipc", "opie-ipc", NULL );
+ _exit(1);
+ }
+}
diff --git a/x11/ipc/client/ocopclient.h b/x11/ipc/client/ocopclient.h
index e9544b9..53018a5 100644
--- a/x11/ipc/client/ocopclient.h
+++ b/x11/ipc/client/ocopclient.h
@@ -1,59 +1,61 @@
#ifndef OPIE_OCOP_CLIENT_H
#define OPIE_OCOP_CLIENT_H
#include <qobject.h>
#include <qcstring.h>
#include <qmap.h>
#include <qsignal.h>
#include <qstring.h>
#include <qsocketnotifier.h>
/**
* This is the OCOP client
* It currently only supports
* asking if a Channel is registered,
* calling and receiving calls
*/
class OCOPPacket;
class OCOPClient : public QObject{
Q_OBJECT
public:
/**
* Occasionally I decide to start a Server from here
*/
OCOPClient(const QString& pathToServer = QString::null, QObject* obj = 0l);
~OCOPClient();
bool isRegistered( const QCString& )const;
void send( const QCString& chan, const QCString&, const QByteArray& msg );
/**
* add a channel and does connect to a signal
* callback is the object
* slot is the SLOT()
*/
void addChannel( const QCString& channel );
void delChannel( const QCString& channel );
/* make it singleton? */
//static OCOPClient* self();
/* no direct signals due the design */
signals:
void called(const QCString&, const QCString&, const QByteArray& );
private slots:
+ void init();
void init(const QCString& pa);
void newData();
private:
+ void startUP();
OCOPPacket packet()const;
void call( const OCOPPacket& );
QSocketNotifier* m_notify;
int m_socket;
-private slots:
+ int m_tries;
};
#endif
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp
index 891e132..6e4a96c 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.cpp
+++ b/x11/libqpe-x11/qpe/qpeapplication.cpp
@@ -158,334 +158,515 @@ void QPEApplication::Private::loadImageCodecs() {
// ### it exists now; need to remember if we can delete it
}
}
else {
lib->unload();
delete lib;
}
}
}
// The Help System hook
namespace {
class ResourceMimeFactory : public QMimeSourceFactory
{
public:
ResourceMimeFactory();
~ResourceMimeFactory();
const QMimeSource* data( const QString& abs_name )const;
};
ResourceMimeFactory::ResourceMimeFactory()
{
setFilePath( Global::helpPath() );
setExtensionType( "html", "text/html;charset=UTF-8" );
}
ResourceMimeFactory::~ResourceMimeFactory() {
}
const QMimeSource* ResourceMimeFactory::data( const QString& abs_name ) const
{
const QMimeSource * r = QMimeSourceFactory::data( abs_name );
if ( !r ) {
int sl = abs_name.length();
do {
sl = abs_name.findRev( '/', sl - 1 );
QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name;
int dot = name.findRev( '.' );
if ( dot >= 0 )
name = name.left( dot );
QImage img = Resource::loadImage( name );
if ( !img.isNull() )
r = new QImageDrag( img );
}
while ( !r && sl > 0 );
}
return r;
};
};
// QPEApplication
+QPEApplication::~QPEApplication() {
+ qWarning("~QPEApplication");
+ ungrabKeyboard();
+ qWarning("UngrabKeyboard");
+
+// delete m_sys;
+// delete m_pid;
+
+ delete d;
+}
QPEApplication::QPEApplication(int &arg, char** argv, Type t)
: QApplication( arg, argv, t ) {
d = new Private;
d->loadTextCodecs();
d->loadImageCodecs();
int dw = desktop()->width();
if ( dw < 200 ) {
setFont( QFont( "helvetica", 8 ) );
AppLnk::setSmallIconSize( 10 );
AppLnk::setBigIconSize( 28 );
}else if ( dw > 600 ) {
setFont( QFont( "helvetica", 12 ) );
AppLnk::setSmallIconSize( 24 );
AppLnk::setBigIconSize( 48 );
}else if ( dw > 200 ) {
setFont( QFont( "helvetica", 10 ) );
AppLnk::setSmallIconSize( 16 );
AppLnk::setBigIconSize( 32 );
}
QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory );
connect( this, SIGNAL( lastWindowClosed() ), this, SLOT(hideOrQuit() ) );
QString qcopfn( "/tmp/qcop-msg-" );
qcopfn += QString( argv[0] ); // append command name to the QCOP name
QFile file( qcopfn );
if (file.open(IO_ReadOnly ) ) {
flock( file.handle(), LOCK_EX );
}
- m_sys = new QCopChannel( "QPE/System", this );
+ /* Hmmm damn we need to make the parent 0l otherwise it get's deleted
+ * past the QApplication
+ */
+ m_sys = new QCopChannel( "QPE/System", 0l);
connect(m_sys, SIGNAL( received( const QCString&, const QByteArray& ) ),
this, SLOT(systemMessage( const QCString&, const QByteArray& ) ) );
// private channel QPE/Application/appname
QCString channel = QCString( argv[0] );
channel.replace( QRegExp( ".*/"), "" );
d->appName = channel;
channel = "QPE/Application/"+ channel;
- m_pid = new QCopChannel( channel, this );
+ m_pid = new QCopChannel( channel, 0l );
connect(m_pid, SIGNAL( received( const QCString&, const QByteArray& ) ),
this, SLOT( pidMessage( const QCString&, const QByteArray& ) ) );
// read the Pre QCOP Stuff from the file
if ( file.isOpen() ) {
d->keep_running = FALSE;
QDataStream ds( &file );
QCString chanel, message;
QByteArray data;
while (!ds.atEnd() ) {
ds >> chanel >> message >> data;
d->enqueueQCop( chanel, message, data );
}
flock( file.handle(), LOCK_UN );
file.close();
file.remove();
}
// read in some stuff from the command line
// we do not have setArgs so we need to take
// care of that
for ( int a = 0; a < arg; a++ ) {
if ( qstrcmp( argv[a], "-preload" ) == 0 ) {
d->preloaded = TRUE;
}else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) {
d->preloaded = TRUE;
d->forceshow = TRUE;
}
}
initTranslations();
applyStyle();
if ( type() == GuiServer )
;
installEventFilter( this );
QPEMenuToolFocusManager::initialize();
}
void QPEApplication::initTranslations() {
// Translations add it
QStringList langs = Global::languageList();
for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) {
QString lang = *it;
QTranslator * trans;
QString tfn;
trans = new QTranslator( this );
tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm";
if ( trans->load( tfn ) )
installTranslator( trans );
else
delete trans;
trans = new QTranslator( this );
tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm";
if ( trans->load( tfn ) )
installTranslator( trans );
else
delete trans;
}
}
-QPEApplication::~QPEApplication() {
- delete d;
-}
QString QPEApplication::qpeDir() {
const char * base = getenv( "OPIEDIR" );
if ( base )
return QString( base ) + "/";
return QString( "../" );
}
QString QPEApplication::documentDir() {
const char* base = getenv( "HOME");
if ( base )
return QString( base ) + "/Documents";
return QString( "../Documents" );
}
void QPEApplication::applyStyle() {
Config config( "qpe" );
config.setGroup( "Appearance" );
// Widget style
QString style = config.readEntry( "Style", "Light" );
internalSetStyle( style );
// Colors
QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) );
QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) );
QPalette pal( btncolor, bgcolor );
QString color = config.readEntry( "Highlight", "#800000" );
pal.setColor( QColorGroup::Highlight, QColor( color ) );
color = config.readEntry( "HighlightedText", "#FFFFFF" );
pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
color = config.readEntry( "Text", "#000000" );
pal.setColor( QColorGroup::Text, QColor( color ) );
color = config.readEntry( "ButtonText", "#000000" );
pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
color = config.readEntry( "Base", "#FFFFFF" );
pal.setColor( QColorGroup::Base, QColor( color ) );
pal.setColor( QPalette::Disabled, QColorGroup::Text,
pal.color( QPalette::Active, QColorGroup::Background ).dark() );
setPalette( pal, TRUE );
// Font
QString ff = config.readEntry( "FontFamily", font().family() );
int fs = config.readNumEntry( "FontSize", font().pointSize() );
setFont( QFont(ff, fs) );
}
int QPEApplication::defaultRotation() {
return 0;
}
void QPEApplication::setDefaultRotation(int r ) {
}
void QPEApplication::grabKeyboard() {
QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d;
if ( qApp->type() == QApplication::GuiServer )
d->kbgrabber = 0;
else {
QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
e << d->appName;
d->kbgrabber = 2; // me
}
}
void QPEApplication::ungrabKeyboard() {
QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d;
if ( d->kbgrabber == 2 ) {
QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
e << QString::null;
d->kbregrab = FALSE;
d->kbgrabber = 0;
}
}
-void QPEApplication::setStylusOperation( QWidget*, StylusMode ) {
-
-}
-QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* ) {
-
-}
void QPEApplication::showMainWidget( QWidget* wid, bool b) {
d->show(wid, b );
}
void QPEApplication::showMainDocumentWidget( QWidget* mw, bool m) {
if ( mw && argc() == 2 )
Global::setDocument( mw, QString::fromUtf8(argv()[1] ) );
d->show(mw, m );
}
void QPEApplication::showDialog( QDialog* d, bool nomax ) {
QSize sh = d->sizeHint();
int w = QMAX(sh.width(),d->width());
int h = QMAX(sh.height(),d->height());
if ( !nomax
&& ( w > qApp->desktop()->width()*3/4
|| h > qApp->desktop()->height()*3/4 ) )
{
d->showMaximized();
} else {
d->resize(w,h);
d->show();
}
}
int QPEApplication::execDialog( QDialog* d, bool nomax) {
showDialog(d,nomax);
return d->exec();
}
void QPEApplication::setKeepRunning() {
if ( qApp && qApp->inherits( "QPEApplication" ) ) {
QPEApplication * qpeApp = ( QPEApplication* ) qApp;
qpeApp->d->keep_running = TRUE;
}
}
bool QPEApplication::keepRunning()const {
return d->keep_running;
}
bool QPEApplication::keyboardGrabbed()const {
return d->kbgrabber;
}
int QPEApplication::exec() {
/* now send the QCOP stuff gotten from the file */
d->sendQCopQ();
- if ( d->keep_running )
- return QApplication::exec();
+ if ( d->keep_running ) {
+ qWarning("going to exec");
+ int a = QApplication::exec();
+ qWarning("left");
+ return a;
+ }
{
QCopEnvelope e( "QPE/System", "closing(QString)" );
e << d->appName;
}
+ qWarning("processing events!");
processEvents();
return 0;
}
void QPEApplication::internalSetStyle( const QString& ) {
}
+void QPEApplication::systemMessage( const QCString&, const QByteArray& ) {
+
+}
+void QPEApplication::pidMessage( const QCString&, const QByteArray& ) {
+
+}
+void QPEApplication::timerEvent( QTimerEvent* e ) {
+ if ( e->timerId() == d->presstimer && d->presswidget ) {
+ // Right pressed
+ postEvent( d->presswidget,
+ new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
+ RightButton, LeftButton ) );
+ killTimer( d->presstimer );
+ d->presstimer = 0;
+ }
+}
+
+// InputMethods Hints
+namespace {
+ static QPtrDict<void>* inputMethodDict = 0;
+ static void createInputMethodDict(){
+ if ( !inputMethodDict )
+ inputMethodDict = new QPtrDict<void>;
+ }
+
+ static QPtrDict<void>* stylusDict = 0;
+ static void createDict() {
+ if ( !stylusDict )
+ stylusDict = new QPtrDict<void>;
+ }
+};
+
+void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) {
+ createInputMethodDict();
+ if ( mode == Normal ) {
+ inputMethodDict->remove
+ ( w );
+ }else {
+ inputMethodDict->insert( w, ( void* ) mode );
+ }
+}
+QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w) {
+ if ( inputMethodDict && w )
+ return ( InputMethodHint ) ( int ) inputMethodDict->find( w );
+ return Normal;
+}
+void QPEApplication::removeSenderFromStylusDict() {
+ stylusDict->remove( ( void* ) sender() );
+ if ( d->presswidget == sender() )
+ d->presswidget = 0;
+}
+void QPEApplication::setStylusOperation( QWidget* w, StylusMode mode) {
+ createDict();
+ if ( mode == LeftOnly ) {
+ stylusDict->remove
+ ( w );
+ w->removeEventFilter( qApp );
+ }else {
+ stylusDict->insert( w, ( void* ) mode );
+ connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) );
+ w->installEventFilter( qApp );
+ }
+}
+QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) {
+ if ( stylusDict )
+ return ( StylusMode ) ( int ) stylusDict->find( w );
+ return LeftOnly;
+}
+
+// eventFilter......
+bool QPEApplication::eventFilter( QObject* o, QEvent* e ) {
+ if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
+ QMouseEvent * me = ( QMouseEvent* ) e;
+ StylusMode mode = (StylusMode)(int)stylusDict->find(o);
+ switch (mode) {
+ case RightOnHold:
+ switch ( me->type() ) {
+ case QEvent::MouseButtonPress:
+ if ( me->button() == LeftButton ) {
+ d->presstimer = startTimer(500); // #### pref.
+ d->presswidget = (QWidget*)o;
+ d->presspos = me->pos();
+ d->rightpressed = FALSE;
+ }
+ break;
+ case QEvent::MouseMove:
+ if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
+ killTimer(d->presstimer);
+ d->presstimer = 0;
+ }
+ break;
+ case QEvent::MouseButtonRelease:
+ if ( me->button() == LeftButton ) {
+ if ( d->presstimer ) {
+ killTimer(d->presstimer);
+ d->presstimer = 0;
+ }
+ if ( d->rightpressed && d->presswidget ) {
+ // Right released
+ postEvent( d->presswidget,
+ new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
+ RightButton, LeftButton + RightButton ) );
+ // Left released, off-widget
+ postEvent( d->presswidget,
+ new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1),
+ LeftButton, LeftButton ) );
+ postEvent( d->presswidget,
+ new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1),
+ LeftButton, LeftButton ) );
+ d->rightpressed = FALSE;
+ return TRUE; // don't send the real Left release
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ ;
+ }
+ }
+ else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
+ QKeyEvent *ke = (QKeyEvent *)e;
+ if ( ke->key() == Key_Enter ) {
+ if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) {
+ postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ',
+ ke->state(), " ", ke->isAutoRepeat(), ke->count() ) );
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+// Quit stuff
+void QPEApplication::restart() {
+
+}
+void QPEApplication::shutdown() {
+
+}
+void QPEApplication::tryQuit() {
+ qWarning("TryQuit!!");
+ if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 )
+ return ; // Inside modal loop or konsole. Too hard to save state.
+ {
+ QCopEnvelope e( "QPE/System", "closing(QString)" );
+ e << d->appName;
+ }
+ processEvents();
+
+ quit();
+}
+void QPEApplication::hideOrQuit() {
+ qWarning("hide or close");
+ processEvents();
+ qWarning("past processing");
+
+ // If we are a preloaded application we don't actually quit, so emit
+ // a System message indicating we're quasi-closing.
+ if ( d->preloaded && d->qpe_main_widget )
+
+ {
+ qWarning("hiding");
+ QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
+ e << d->appName;
+ d->qpe_main_widget->hide();
+ }
+ else
+ quit();
+}
#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
// The libraries with the skiff package (and possibly others) have
// completely useless implementations of builtin new and delete that
// use about 50% of your CPU. Here we revert to the simple libc
// functions.
void* operator new[]( size_t size )
{
return malloc( size );
}
void* operator new( size_t size )
{
return malloc( size );
}
void operator delete[]( void* p )
{
free( p );
}
void operator delete[]( void* p, size_t /*size*/ )
{
free( p );
}
void operator delete( void* p )
{
free( p );
}
void operator delete( void* p, size_t /*size*/ )
{
free( p );
}
#endif
diff --git a/x11/libqpe-x11/qpe/qpeapplication.h b/x11/libqpe-x11/qpe/qpeapplication.h
index cd385db..2af1c66 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.h
+++ b/x11/libqpe-x11/qpe/qpeapplication.h
@@ -1,70 +1,93 @@
#ifndef OPIE_QPE_APPLICATION_H
#define OPIE_QPE_APPLICATION_H
/**
* LGPLed
*/
#include <qapplication.h>
+#include <qevent.h>
#include <qpe/timestring.h>
class QCopChannel;
class QPEApplication : public QApplication {
Q_OBJECT
public:
QPEApplication(int& argc, char** argv, Type=GuiClient );
~QPEApplication();
+
static QString qpeDir();
static QString documentDir();
void applyStyle();
static int defaultRotation();
static void setDefaultRotation( int r );
static void grabKeyboard();
static void ungrabKeyboard();
enum StylusMode {
LeftOnly,
RightOnHold
};
static void setStylusOperation( QWidget*, StylusMode );
static StylusMode stylusOperation( QWidget* );
+ enum InputMethodHint {
+ Normal,
+ AlwaysOff,
+ AlwaysOn
+ };
+ static void setInputMethodHint( QWidget*, InputMethodHint );
+ static InputMethodHint inputMethodHint( QWidget* );
+
void showMainWidget( QWidget*, bool nomax = FALSE );
void showMainDocumentWidget( QWidget*, bool nomax = FALSE );
static void showDialog( QDialog*, bool nomax = FALSE );
static int execDialog( QDialog*, bool nomax = FALSE );
static void setKeepRunning();
bool keepRunning()const;
bool keyboardGrabbed()const;
int exec();
signals:
void clientMoused();
void timeChanged();
void clockChanged( bool pm );
void micChanged( bool muted );
void volumeChanged( bool muted );
void appMessage( const QCString& msg, const QByteArray& data);
void weekChanged( bool startOnMonday );
void dateFormatChanged( DateFormat );
void flush();
void reload();
private:
void initTranslations();
void internalSetStyle(const QString&);
+private slots:
+ void hideOrQuit();
+ void systemMessage( const QCString&, const QByteArray& );
+ void pidMessage( const QCString&, const QByteArray& );
+ void removeSenderFromStylusDict();
+protected:
+ virtual void restart();
+ virtual void shutdown();
+ bool eventFilter( QObject*, QEvent* );
+ void timerEvent( QTimerEvent* );
+ void raiseAppropriateWindow();
+ virtual void tryQuit();
+
private:
class Private;
Private* d;
QCopChannel *m_sys;
QCopChannel *m_pid;
};
#endif