summaryrefslogtreecommitdiff
authorjeremy <jeremy>2002-02-15 21:12:53 (UTC)
committer jeremy <jeremy>2002-02-15 21:12:53 (UTC)
commitb0768575b7bc1e4fe477d37a49cccc7e3d92bf85 (patch) (side-by-side diff)
tree4c66c26f74ec710204f3f2e4303a6d6d8968c6a7
parentb15950bcf97b5590d37373ec2beedab80e40ded6 (diff)
downloadopie-b0768575b7bc1e4fe477d37a49cccc7e3d92bf85.zip
opie-b0768575b7bc1e4fe477d37a49cccc7e3d92bf85.tar.gz
opie-b0768575b7bc1e4fe477d37a49cccc7e3d92bf85.tar.bz2
Added new QCop support. Desktop now listens on channel QPE/Desktop to the
keyRegister(int key, QString channel, QString message) message. What this will do is allow an app to reiceve keyboard input for a particular key no matter if they have focus or not.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/desktop.cpp56
-rw-r--r--core/launcher/desktop.h4
-rw-r--r--core/launcher/opie-taskbar.control2
3 files changed, 61 insertions, 1 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index d39af25..ce99bad 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -44,15 +44,37 @@
#include <qgfx_qws.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qtimer.h>
#include <qwindowsystem_qws.h>
+#include <qvaluelist.h>
+
#include <stdlib.h>
#include <unistd.h>
+
+class QCopKeyRegister
+{
+public:
+ QCopKeyRegister() : keyCode(0) { }
+ QCopKeyRegister(int k, const QString &c, const QString &m)
+ : keyCode(k), channel(c), message(m) { }
+
+ int getKeyCode() const { return keyCode; }
+ QString getChannel() const { return channel; }
+ QString getMessage() const { return message; }
+
+private:
+ int keyCode;
+ QString channel, message;
+};
+
+typedef QValueList<QCopKeyRegister> KeyRegisterList;
+KeyRegisterList keyRegisterList;
+
static Desktop* qpedesktop = 0;
static int loggedin=0;
static void login(bool at_poweron)
{
if ( !loggedin ) {
Global::terminateBuiltin("calibrate");
@@ -120,21 +142,41 @@ DesktopApplication::DesktopApplication( int& argc, char **argv, Type t )
QTimer *t = new QTimer( this );
connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) );
t->start( 10000 );
ps = new PowerStatus;
pa = new DesktopPowerAlerter( 0 );
+
+ channel = new QCopChannel( "QPE/Desktop", this );
+ connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
+ this, SLOT(receive(const QCString&, const QByteArray&)) );
}
DesktopApplication::~DesktopApplication()
{
delete ps;
delete pa;
}
+void DesktopApplication::receive( const QCString &msg, const QByteArray &data )
+{
+ QDataStream stream( data, IO_ReadOnly );
+ if (msg == "keyRegister(int key, QString channel, QString message)")
+ {
+ int k;
+ QString c, m;
+
+ stream >> k;
+ stream >> c;
+ stream >> m;
+
+ qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m);
+ keyRegisterList.append(QCopKeyRegister(k,c,m));
+ }
+}
enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown;
#ifdef Q_WS_QWS
bool DesktopApplication::qwsEventFilter( QWSEvent *e )
{
@@ -142,12 +184,20 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e )
if ( e->type == QWSEvent::Key ) {
QWSKeyEvent *ke = (QWSKeyEvent *)e;
if ( !loggedin && ke->simpleData.keycode != Key_F34 )
return TRUE;
bool press = ke->simpleData.is_press;
+
+ KeyRegisterList::Iterator it;
+ for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it )
+ {
+ if ((*it).getKeyCode() == ke->simpleData.keycode)
+ QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8());
+ }
+
if ( !keyboardGrabbed() ) {
if ( ke->simpleData.keycode == Key_F9 ) {
if ( press ) emit datebook();
return TRUE;
}
if ( ke->simpleData.keycode == Key_F10 ) {
@@ -175,12 +225,18 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e )
}
if ( ke->simpleData.keycode == Key_F13 ) {
if ( press ) emit email();
return TRUE;
}
}
+ /*
+ if ( ke->simpleData.keycode == 4096 ) {
+ QCopEnvelope e("QPE/VMemo", "toggleRecord()");
+ return TRUE;
+ }
+ */
if ( ke->simpleData.keycode == Key_F34 ) {
if ( press ) emit power();
return TRUE;
}
if ( ke->simpleData.keycode == Key_F35 ) {
if ( press ) emit backlight();
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h
index dfdbeab..f0a7cba 100644
--- a/core/launcher/desktop.h
+++ b/core/launcher/desktop.h
@@ -60,20 +60,24 @@ protected:
#ifdef Q_WS_QWS
bool qwsEventFilter( QWSEvent * );
#endif
void shutdown();
void restart();
+public slots:
+ void receive( const QCString &msg, const QByteArray &data );
+
protected slots:
void shutdown(ShutdownImpl::Type);
void psTimeout();
void sendCard();
private:
DesktopPowerAlerter *pa;
PowerStatus *ps;
QTimer *cardSendTimer;
+ QCopChannel *channel;
};
class Desktop : public QWidget {
Q_OBJECT
public:
diff --git a/core/launcher/opie-taskbar.control b/core/launcher/opie-taskbar.control
index 53daa82..3db0480 100644
--- a/core/launcher/opie-taskbar.control
+++ b/core/launcher/opie-taskbar.control
@@ -1,9 +1,9 @@
Files: bin/qpe apps/Settings/Calibrate.desktop
Priority: required
Section: opie/system
Maintainer: Warwick Allison <warwick@trolltech.com>
Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
+Version: $QPE_VERSION-$SUB_VERSION.1
Depends: qt-embedded (>=$QTE_VERSION)
Description: Launcher for Opie
The "finder" or "explorer", or whatever you want to call it.