summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 67cae1c..e57cdef 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -599,101 +599,101 @@ bool ODevice::setCurrentCpuFrequency(uint index)
const int count = sprintf(writeCommand, "%s\n", freq);
int res = (::write(fd, writeCommand, count) != -1);
::close(fd);
return res;
}
return false;
}
/**
* @return a list of hardware buttons
*/
const QValueList <ODeviceButton> &ODevice::buttons()
{
initButtons();
return *d->m_buttons;
}
/**
* @return The amount of time that would count as a hold
*/
uint ODevice::buttonHoldTime() const
{
return d->m_holdtime;
}
/**
* This method return a ODeviceButton for a key code
* or 0 if no special hardware button is available for the device
*
* @return The devicebutton or 0l
* @see ODeviceButton
*/
const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
{
initButtons();
for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) {
if ( (*it). keycode() == code )
return &(*it);
}
return 0;
}
void ODevice::reloadButtonMapping()
{
- initButtons();
+ if(!d->m_buttons)
+ initButtons();
if(!d->m_initializedButtonQcop) {
- QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel");
- connect(chan,SIGNAL(received(const QCString&,const QByteArray&)),
+ connect(qApp,SIGNAL(systemMessageSignal(const QCString&,const QByteArray&)),
this,SLOT(systemMessage(const QCString&,const QByteArray&)));
d->m_initializedButtonQcop = true;
}
Config cfg ( "ButtonSettings" );
for ( uint i = 0; i < d->m_buttons->count(); i++ ) {
ODeviceButton &b = ( *d->m_buttons ) [i];
QString group = "Button" + QString::number ( i );
QCString pch, hch;
QCString pm, hm;
QByteArray pdata, hdata;
if ( cfg. hasGroup ( group )) {
cfg. setGroup ( group );
pch = cfg. readEntry ( "PressedActionChannel" ). latin1();
pm = cfg. readEntry ( "PressedActionMessage" ). latin1();
// pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" ));
hch = cfg. readEntry ( "HeldActionChannel" ). latin1();
hm = cfg. readEntry ( "HeldActionMessage" ). latin1();
// hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" ));
}
b. setPressedAction ( OQCopMessage ( pch, pm, pdata ));
b. setHeldAction ( OQCopMessage ( hch, hm, hdata ));
}
}
void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
{
initButtons();
QString mb_chan;
if ( button >= (int) d->m_buttons->count())
return;
ODeviceButton &b = ( *d->m_buttons ) [button];
b. setPressedAction ( action );
mb_chan=b. pressedAction(). channel();
Config buttonFile ( "ButtonSettings" );
buttonFile. setGroup ( "Button" + QString::number ( button ));
buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan);