From 72065f1f1aa12882ae63f8b063312e96dd683156 Mon Sep 17 00:00:00 2001 From: zecke Date: Wed, 13 Oct 2004 13:00:45 +0000 Subject: -Create the QPE/System channel in ODevice to listen for button remapping -Remove various connect and QCopChannel creation from actual device implementations Let us see if that breaks anything, I hope SIMpad still will do fine. We might need to guard if a qApp exists? --- diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 8b64c41..67cae1c 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp @@ -177,6 +177,9 @@ ODevice::ODevice() /* mixer */ d->m_sound = d->m_vol = d->m_mixer = -1; + + /* System QCopChannel created */ + d->m_initializedButtonQcop = false; // New distribution detection code first checks for legacy distributions, // identified by /etc/familiar-version or /etc/oz_version. @@ -233,9 +236,6 @@ void ODevice::initButtons() } reloadButtonMapping(); - - QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); - connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); } ODevice::~ODevice() @@ -645,6 +645,13 @@ const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) void ODevice::reloadButtonMapping() { initButtons(); + + if(!d->m_initializedButtonQcop) { + QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel"); + connect(chan,SIGNAL(received(const QCString&,const QByteArray&)), + this,SLOT(systemMessage(const QCString&,const QByteArray&))); + d->m_initializedButtonQcop = true; + } Config cfg ( "ButtonSettings" ); diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 6f0d036..21fcc3f 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h @@ -357,6 +357,7 @@ class ODeviceData { QValueList *m_buttons; uint m_holdtime; QStrList *m_cpu_frequencies; + bool m_initializedButtonQcop : 1; /* values for changeMixerForAlarm */ int m_sound, m_vol, m_mixer; diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 6193ddc..9e01a0c 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp @@ -189,9 +189,6 @@ void iPAQ::initButtons() } } reloadButtonMapping(); - - QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); - connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); } QValueList iPAQ::ledList() const diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 2cab0c8..8141f1c 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp @@ -140,9 +140,6 @@ void Jornada::initButtons() } } reloadButtonMapping(); - - QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); - connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); } int Jornada::displayBrightnessResolution() const diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp index a06d7ec..8f22514 100644 --- a/libopie2/opiecore/device/odevice_yopy.cpp +++ b/libopie2/opiecore/device/odevice_yopy.cpp @@ -109,10 +109,6 @@ void Yopy::initButtons() d->m_buttons->append ( b ); } reloadButtonMapping(); - - QCopChannel *sysch = new QCopChannel( "QPE/System", this ); - connect( sysch, SIGNAL( received(const QCString&,const QByteArray&) ), - this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); } diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 733479e..ebe1949 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp @@ -238,10 +238,6 @@ void Zaurus::initButtons() } reloadButtonMapping(); - - QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); - connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), - this, SLOT( systemMessage(const QCString&,const QByteArray&))); } #include -- cgit v0.9.0.2