summaryrefslogtreecommitdiff
path: root/core/settings/button
Unidiff
Diffstat (limited to 'core/settings/button') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/button/remapdlg.cpp72
1 files changed, 39 insertions, 33 deletions
diff --git a/core/settings/button/remapdlg.cpp b/core/settings/button/remapdlg.cpp
index 4effebc..cadb955 100644
--- a/core/settings/button/remapdlg.cpp
+++ b/core/settings/button/remapdlg.cpp
@@ -1 +1,9 @@
1
2#include "remapdlg.h"
3#include "buttonutils.h"
4
5/* OPIE */
6#include <opie2/odebug.h>
7
8/* QT */
1#include <qlistview.h> 9#include <qlistview.h>
@@ -4,4 +12,2 @@
4 12
5#include "remapdlg.h"
6#include "buttonutils.h"
7 13
@@ -17,3 +23,3 @@ public:
17 } 23 }
18 24
19 void setDefault ( bool b ) 25 void setDefault ( bool b )
@@ -22,3 +28,3 @@ public:
22 } 28 }
23 29
24 virtual QString key ( int /*column*/, bool /*ascending*/ ) const 30 virtual QString key ( int /*column*/, bool /*ascending*/ ) const
@@ -27,13 +33,13 @@ public:
27 } 33 }
28 34
29 virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ) 35 virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align )
30 { 36 {
31 if ( m_def ) { 37 if ( m_def ) {
32 QFont f ( listView ( )-> font ( )); 38 QFont f ( listView ( )-> font ( ));
33 f. setBold ( true ); 39 f. setBold ( true );
34 p-> setFont ( f ); 40 p-> setFont ( f );
35 } 41 }
36 QListViewItem::paintCell ( p, cg, column, width, align ); 42 QListViewItem::paintCell ( p, cg, column, width, align );
37 } 43 }
38 44
39private: 45private:
@@ -50,9 +56,9 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par
50 m_current = 0; 56 m_current = 0;
51 57
52 static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 }; 58 static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 };
53 w_channel-> insertStrList ((const char **) def_channels ); 59 w_channel-> insertStrList ((const char **) def_channels );
54 60
55 m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( ); 61 m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( );
56 m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( ); 62 m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( );
57 63
58 m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" )); 64 m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" ));
@@ -60,3 +66,3 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par
60 ((NoSortItem *) m_map_preset )-> setDefault ( true ); 66 ((NoSortItem *) m_map_preset )-> setDefault ( true );
61 67
62 if (m_msg. channel ( ) == "ignore") 68 if (m_msg. channel ( ) == "ignore")
@@ -64,3 +70,3 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par
64 m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); 70 m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg_preset. channel ( ), m_msg_preset. message ( ));
65 71
66 m_current = m_map_none; 72 m_current = m_map_none;
@@ -72,11 +78,11 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par
72 } 78 }
73 79
74 QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" )); 80 QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" ));
75 ButtonUtils::inst ( )-> insertActions ( it ); 81 ButtonUtils::inst ( )-> insertActions ( it );
76 it-> setOpen ( true ); 82 it-> setOpen ( true );
77 83
78 m_map_show = new NoSortItem ( w_list, 4, tr( "Show" )); 84 m_map_show = new NoSortItem ( w_list, 4, tr( "Show" ));
79 85
80 w_list-> setCurrentItem ( m_current ); 86 w_list-> setCurrentItem ( m_current );
81 87
82 QTimer::singleShot ( 0, this, SLOT( delayedInit())); 88 QTimer::singleShot ( 0, this, SLOT( delayedInit()));
@@ -92,7 +98,7 @@ void RemapDlg::delayedInit ( )
92 w_list-> viewport ( )-> setUpdatesEnabled ( false ); 98 w_list-> viewport ( )-> setUpdatesEnabled ( false );
93 99
94 ButtonUtils::inst ( )-> insertAppLnks ( m_map_show ); 100 ButtonUtils::inst ( )-> insertAppLnks ( m_map_show );
95 101
96 w_list-> viewport ( )-> setUpdatesEnabled ( b ); 102 w_list-> viewport ( )-> setUpdatesEnabled ( b );
97 103
98 m_map_show-> repaint ( ); 104 m_map_show-> repaint ( );
@@ -104,3 +110,3 @@ void RemapDlg::itemChanged ( QListViewItem *it )
104 OQCopMessage m; 110 OQCopMessage m;
105 111
106 m_current = it; 112 m_current = it;
@@ -110,3 +116,3 @@ void RemapDlg::itemChanged ( QListViewItem *it )
110 m_msg = m = OQCopMessage ( "ignore", 0 ); 116 m_msg = m = OQCopMessage ( "ignore", 0 );
111 qDebug ("***ignoring"); 117 odebug << "***ignoring" << oendl;
112 } 118 }
@@ -115,7 +121,7 @@ void RemapDlg::itemChanged ( QListViewItem *it )
115 m_msg = m = m_msg_preset; 121 m_msg = m = m_msg_preset;
116 qDebug ("***Preset"); 122 odebug << "***Preset" << oendl;
117 } 123 }
118 else if ( it && !it-> childCount ( ) ) 124 else if ( it && !it-> childCount ( ) )
119 { 125 {
120 qDebug ("***Custom: %s %s ",it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); 126 odebug << "***Custom: " << it-> text ( 1 ). latin1 ( ) << " " << it-> text ( 2 ). latin1 ( ) << oendl;
121 enabled = ( it == m_map_custom ); 127 enabled = ( it == m_map_custom );
@@ -123,9 +129,9 @@ void RemapDlg::itemChanged ( QListViewItem *it )
123 } 129 }
124 130
125 w_channel-> setEnabled ( enabled ); 131 w_channel-> setEnabled ( enabled );
126 w_message-> setEnabled ( enabled ); 132 w_message-> setEnabled ( enabled );
127 133
128 w_channel-> setEditText ( m. channel ( )); 134 w_channel-> setEditText ( m. channel ( ));
129//hack for if user has typed in a message, such as 'suspend()' 135//hack for if user has typed in a message, such as 'suspend()'
130//so raise() is always present 136//so raise() is always present
131 if(m. message ( ) != "raise()") 137 if(m. message ( ) != "raise()")
@@ -151,3 +157,3 @@ OQCopMessage RemapDlg::message ( )
151//make sure to update message if typed in 157//make sure to update message if typed in
152 itemChanged(w_list->currentItem()); 158 itemChanged(w_list->currentItem());
153 return m_msg; 159 return m_msg;