summaryrefslogtreecommitdiff
authorgroucho <groucho>2003-03-19 11:36:34 (UTC)
committer groucho <groucho>2003-03-19 11:36:34 (UTC)
commit28be0fcc9bda71175c3ee17e79fce2ac24340ff2 (patch) (side-by-side diff)
treef09c80460e4f0219eb308d612a2e67df57f2c254
parent18c6c51705de3b1897f671e54b25929e74d11f23 (diff)
downloadopie-28be0fcc9bda71175c3ee17e79fce2ac24340ff2.zip
opie-28be0fcc9bda71175c3ee17e79fce2ac24340ff2.tar.gz
opie-28be0fcc9bda71175c3ee17e79fce2ac24340ff2.tar.bz2
Fixed bug #744 where non mapped buttons in buttonsettings were not saved by introducing the "
ignore" statement. Also removed unsed debug code
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp25
-rw-r--r--core/launcher/desktop.h2
-rw-r--r--core/settings/button/buttonsettings.cpp3
-rw-r--r--core/settings/button/buttonutils.cpp3
-rw-r--r--core/settings/button/remapdlg.cpp26
-rw-r--r--libopie/odevice.cpp15
-rw-r--r--libopie/odevicebutton.cpp3
7 files changed, 55 insertions, 22 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 59f2aea..fbcce7c 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -343,22 +343,32 @@ void DesktopApplication::sendHeldAction ( )
-void DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat )
+bool DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat )
{
if ( db ) {
if ( !press && !autoRepeat && m_button_timer-> isActive ( )) {
m_button_timer-> stop ( );
- if ( !db-> pressedAction ( ). channel ( ). isEmpty ( )) {
- db-> pressedAction ( ). send ( );
+
+ if (!db-> pressedAction ( ). channel ( ) .isEmpty())
+ {
+ if ( db-> pressedAction ( ). channel ( )!="ignore") {
+ db-> pressedAction ( ). send ( );
+ }
+ else return false;
}
}
else if ( press && !autoRepeat ) {
m_button_timer-> stop ( );
+ if (!db-> pressedAction ( ). channel ( ) .isEmpty())
+ {
- if ( !db-> heldAction ( ). channel ( ). isEmpty ( )) {
- m_last_button = db;
- m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true );
+ if ( db-> heldAction ( ). channel ( )!="ignore") {
+ m_last_button = db;
+ m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true );
+ }
+ else return false;
}
}
}
+ return true;
}
@@ -371,6 +381,5 @@ bool DesktopApplication::eventFilter ( QObject *o, QEvent *e )
if ( db ) {
- checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( ));
- return true;
+ return checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( ));
}
}
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h
index db0173e..4024c38 100644
--- a/core/launcher/desktop.h
+++ b/core/launcher/desktop.h
@@ -84,5 +84,5 @@ protected slots:
protected:
virtual bool eventFilter ( QObject *o, QEvent *e );
- void checkButtonAction ( const Opie::ODeviceButton *db, int keycode, bool press, bool autoRepeat );
+ bool checkButtonAction ( const Opie::ODeviceButton *db, int keycode, bool press, bool autoRepeat );
private:
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp
index eabb779..942d5e4 100644
--- a/core/settings/button/buttonsettings.cpp
+++ b/core/settings/button/buttonsettings.cpp
@@ -209,5 +209,4 @@ void ButtonSettings::keyTimeout ( )
void ButtonSettings::edit ( buttoninfo *bi, bool hold )
{
- qDebug ( "remap %s for %s", hold ? "hold" : "press", bi-> m_button-> userText ( ). latin1 ( ));
if ( m_lock )
@@ -219,5 +218,5 @@ void ButtonSettings::edit ( buttoninfo *bi, bool hold )
d-> showMaximized ( );
if ( d-> exec ( ) == QDialog::Accepted ) {
- qDebug ( " -> %s %s", d-> message ( ). channel ( ). data ( ), d-> message ( ). message ( ). data ( ));
+
if ( hold ) {
diff --git a/core/settings/button/buttonutils.cpp b/core/settings/button/buttonutils.cpp
index 91d2af3..27a2f38 100644
--- a/core/settings/button/buttonutils.cpp
+++ b/core/settings/button/buttonutils.cpp
@@ -66,5 +66,6 @@ qCopInfo ButtonUtils::messageToInfo ( const OQCopMessage &c )
QCString f = c. message ( );
- if ( ch. isNull ( ))
+
+ if ( ch == "ignore" )
return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Ignored</nobr>" ));
diff --git a/core/settings/button/remapdlg.cpp b/core/settings/button/remapdlg.cpp
index a251bd4..b6ee60b 100644
--- a/core/settings/button/remapdlg.cpp
+++ b/core/settings/button/remapdlg.cpp
@@ -60,5 +60,16 @@ RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, c
m_map_preset = new NoSortItem ( w_list, 1, tr( "Default" ), m_msg_preset. channel ( ), m_msg_preset. message ( ));
((NoSortItem *) m_map_preset )-> setDefault ( true );
- m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( ));
+
+ if (m_msg. channel ( ) == "ignore")
+ {
+ m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg_preset. channel ( ), m_msg_preset. message ( ));
+
+ m_current = m_map_none;
+ }
+ else
+ {
+ m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( ));
+ m_current = m_map_custom;
+ }
QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" ));
@@ -68,5 +79,4 @@ RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, c
m_map_show = new NoSortItem ( w_list, 4, tr( "Show" ));
- m_current = m_map_custom;
w_list-> setCurrentItem ( m_current );
@@ -98,8 +108,16 @@ void RemapDlg::itemChanged ( QListViewItem *it )
if ( it == m_map_none )
- m_msg = m = OQCopMessage ( 0, 0 );
+ {
+ m_msg = m = OQCopMessage ( "ignore", 0 );
+ qDebug ("***ignoring");
+ }
else if ( it == m_map_preset )
+ {
m_msg = m = m_msg_preset;
- else if ( it && !it-> childCount ( )) {
+ qDebug ("***Preset");
+ }
+ else if ( it && !it-> childCount ( ))
+ {
+ qDebug ("***Custom: %s %s ",it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( ));
enabled = ( it == m_map_custom );
m_msg = m = OQCopMessage ( it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( ));
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 9e97c56..d5e3c5c 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -281,5 +281,4 @@ void ODevice::init ( )
b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
-
d-> m_buttons. append ( b );
}
@@ -517,6 +516,7 @@ void ODevice::reloadButtonMapping ( )
// hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" ));
}
-
+
b. setPressedAction ( OQCopMessage ( pch, pm, pdata ));
+
b. setHeldAction ( OQCopMessage ( hch, hm, hdata ));
}
@@ -525,13 +525,18 @@ void ODevice::reloadButtonMapping ( )
void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
{
+ QString mb_chan;
+
if ( button >= (int) d-> m_buttons. count ( ))
return;
+
ODeviceButton &b = d-> m_buttons [button];
- b. setPressedAction ( action );
+ b. setPressedAction ( action );
+
+ mb_chan=b. pressedAction ( ). channel ( );
Config buttonFile ( "ButtonSettings" );
buttonFile. setGroup ( "Button" + QString::number ( button ));
- buttonFile. writeEntry ( "PressedActionChannel", (const char*) b. pressedAction ( ). channel ( ));
+ buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan);
buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( ));
@@ -547,5 +552,5 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
ODeviceButton &b = d-> m_buttons [button];
- b. setHeldAction ( action );
+ b. setHeldAction ( action );
Config buttonFile ( "ButtonSettings" );
diff --git a/libopie/odevicebutton.cpp b/libopie/odevicebutton.cpp
index 2270343..4b22358 100644
--- a/libopie/odevicebutton.cpp
+++ b/libopie/odevicebutton.cpp
@@ -71,5 +71,5 @@ void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArra
bool OQCopMessage::send ( )
{
- if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( ))
+ if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( ) )
return false;
@@ -219,4 +219,5 @@ void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action)
}
+
void ODeviceButton::setPressedAction(const OQCopMessage& action)
{