Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
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 | |||
@@ -169,24 +169,27 @@ ODevice::ODevice() | |||
169 | d->m_sysverstr = "0.0"; | 169 | d->m_sysverstr = "0.0"; |
170 | d->m_rotation = Rot0; | 170 | d->m_rotation = Rot0; |
171 | d->m_direction = CW; | 171 | d->m_direction = CW; |
172 | 172 | ||
173 | d->m_holdtime = 1000; // 1000ms | 173 | d->m_holdtime = 1000; // 1000ms |
174 | d->m_buttons = 0; | 174 | d->m_buttons = 0; |
175 | d->m_cpu_frequencies = new QStrList; | 175 | d->m_cpu_frequencies = new QStrList; |
176 | 176 | ||
177 | 177 | ||
178 | /* mixer */ | 178 | /* mixer */ |
179 | d->m_sound = d->m_vol = d->m_mixer = -1; | 179 | d->m_sound = d->m_vol = d->m_mixer = -1; |
180 | 180 | ||
181 | /* System QCopChannel created */ | ||
182 | d->m_initializedButtonQcop = false; | ||
183 | |||
181 | // New distribution detection code first checks for legacy distributions, | 184 | // New distribution detection code first checks for legacy distributions, |
182 | // identified by /etc/familiar-version or /etc/oz_version. | 185 | // identified by /etc/familiar-version or /etc/oz_version. |
183 | // Then check for OpenEmbedded and lastly, read /etc/issue | 186 | // Then check for OpenEmbedded and lastly, read /etc/issue |
184 | 187 | ||
185 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) | 188 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) |
186 | { | 189 | { |
187 | if ( QFile::exists( distributions[i].sysvfile ) ) | 190 | if ( QFile::exists( distributions[i].sysvfile ) ) |
188 | { | 191 | { |
189 | d->m_systemstr = distributions[i].sysstr; | 192 | d->m_systemstr = distributions[i].sysstr; |
190 | d->m_system = distributions[i].system; | 193 | d->m_system = distributions[i].system; |
191 | d->m_sysverstr = "<Unknown>"; | 194 | d->m_sysverstr = "<Unknown>"; |
192 | QFile f( distributions[i].sysvfile ); | 195 | QFile f( distributions[i].sysvfile ); |
@@ -224,27 +227,24 @@ void ODevice::initButtons() | |||
224 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { | 227 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { |
225 | default_button *db = default_buttons + i; | 228 | default_button *db = default_buttons + i; |
226 | ODeviceButton b; | 229 | ODeviceButton b; |
227 | b. setKeycode ( db->code ); | 230 | b. setKeycode ( db->code ); |
228 | b. setUserText ( QObject::tr ( "Button", db->utext )); | 231 | b. setUserText ( QObject::tr ( "Button", db->utext )); |
229 | b. setPixmap ( Resource::loadPixmap ( db->pix )); | 232 | b. setPixmap ( Resource::loadPixmap ( db->pix )); |
230 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); | 233 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); |
231 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); | 234 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); |
232 | d->m_buttons->append ( b ); | 235 | d->m_buttons->append ( b ); |
233 | } | 236 | } |
234 | 237 | ||
235 | reloadButtonMapping(); | 238 | reloadButtonMapping(); |
236 | |||
237 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | ||
238 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | ||
239 | } | 239 | } |
240 | 240 | ||
241 | ODevice::~ODevice() | 241 | ODevice::~ODevice() |
242 | { | 242 | { |
243 | // we leak m_devicebuttons and m_cpu_frequency | 243 | // we leak m_devicebuttons and m_cpu_frequency |
244 | // but it's a singleton and it is not so importantant | 244 | // but it's a singleton and it is not so importantant |
245 | // -zecke | 245 | // -zecke |
246 | delete d; | 246 | delete d; |
247 | } | 247 | } |
248 | 248 | ||
249 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 249 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
250 | { | 250 | { |
@@ -637,24 +637,31 @@ const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) | |||
637 | 637 | ||
638 | for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) { | 638 | for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) { |
639 | if ( (*it). keycode() == code ) | 639 | if ( (*it). keycode() == code ) |
640 | return &(*it); | 640 | return &(*it); |
641 | } | 641 | } |
642 | return 0; | 642 | return 0; |
643 | } | 643 | } |
644 | 644 | ||
645 | void ODevice::reloadButtonMapping() | 645 | void ODevice::reloadButtonMapping() |
646 | { | 646 | { |
647 | initButtons(); | 647 | initButtons(); |
648 | 648 | ||
649 | if(!d->m_initializedButtonQcop) { | ||
650 | QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel"); | ||
651 | connect(chan,SIGNAL(received(const QCString&,const QByteArray&)), | ||
652 | this,SLOT(systemMessage(const QCString&,const QByteArray&))); | ||
653 | d->m_initializedButtonQcop = true; | ||
654 | } | ||
655 | |||
649 | Config cfg ( "ButtonSettings" ); | 656 | Config cfg ( "ButtonSettings" ); |
650 | 657 | ||
651 | for ( uint i = 0; i < d->m_buttons->count(); i++ ) { | 658 | for ( uint i = 0; i < d->m_buttons->count(); i++ ) { |
652 | ODeviceButton &b = ( *d->m_buttons ) [i]; | 659 | ODeviceButton &b = ( *d->m_buttons ) [i]; |
653 | QString group = "Button" + QString::number ( i ); | 660 | QString group = "Button" + QString::number ( i ); |
654 | 661 | ||
655 | QCString pch, hch; | 662 | QCString pch, hch; |
656 | QCString pm, hm; | 663 | QCString pm, hm; |
657 | QByteArray pdata, hdata; | 664 | QByteArray pdata, hdata; |
658 | 665 | ||
659 | if ( cfg. hasGroup ( group )) { | 666 | if ( cfg. hasGroup ( group )) { |
660 | cfg. setGroup ( group ); | 667 | cfg. setGroup ( group ); |