summaryrefslogtreecommitdiff
path: root/libopie/odevicebutton.cpp
Unidiff
Diffstat (limited to 'libopie/odevicebutton.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevicebutton.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libopie/odevicebutton.cpp b/libopie/odevicebutton.cpp
index 2270343..4b22358 100644
--- a/libopie/odevicebutton.cpp
+++ b/libopie/odevicebutton.cpp
@@ -25,97 +25,97 @@
25#include <opie/odevicebutton.h> 25#include <opie/odevicebutton.h>
26 26
27using namespace Opie; 27using namespace Opie;
28 28
29 29
30class OQCopMessageData { 30class OQCopMessageData {
31 public: 31 public:
32 QCString m_channel; 32 QCString m_channel;
33 QCString m_message; 33 QCString m_message;
34 QByteArray m_data; 34 QByteArray m_data;
35}; 35};
36 36
37 37
38OQCopMessage::OQCopMessage ( ) 38OQCopMessage::OQCopMessage ( )
39 : d ( 0 ) 39 : d ( 0 )
40{ 40{
41 init ( QCString ( ), QCString ( ), QByteArray ( )); 41 init ( QCString ( ), QCString ( ), QByteArray ( ));
42} 42}
43 43
44OQCopMessage::OQCopMessage ( const OQCopMessage &copy ) 44OQCopMessage::OQCopMessage ( const OQCopMessage &copy )
45 : d ( 0 ) 45 : d ( 0 )
46{ 46{
47 init ( copy. channel ( ), copy. message ( ), copy. data ( )); 47 init ( copy. channel ( ), copy. message ( ), copy. data ( ));
48} 48}
49 49
50OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign ) 50OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign )
51{ 51{
52 init ( assign. channel ( ), assign. message ( ), assign. data ( )); 52 init ( assign. channel ( ), assign. message ( ), assign. data ( ));
53 return *this; 53 return *this;
54} 54}
55 55
56OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg ) 56OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg )
57 : d ( 0 ) 57 : d ( 0 )
58{ 58{
59 init ( ch, m, arg ); 59 init ( ch, m, arg );
60} 60}
61 61
62void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg ) 62void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg )
63{ 63{
64 if ( !d ) 64 if ( !d )
65 d = new OQCopMessageData ( ); 65 d = new OQCopMessageData ( );
66 d-> m_channel = ch; 66 d-> m_channel = ch;
67 d-> m_message = m; 67 d-> m_message = m;
68 d-> m_data = arg; 68 d-> m_data = arg;
69} 69}
70 70
71bool OQCopMessage::send ( ) 71bool OQCopMessage::send ( )
72{ 72{
73 if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( )) 73 if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( ) )
74 return false; 74 return false;
75 75
76 QCopEnvelope e ( d-> m_channel, d-> m_message ); 76 QCopEnvelope e ( d-> m_channel, d-> m_message );
77 77
78 if ( d-> m_data. size ( )) 78 if ( d-> m_data. size ( ))
79 e. writeRawBytes ( d-> m_data. data ( ), d-> m_data. size ( )); 79 e. writeRawBytes ( d-> m_data. data ( ), d-> m_data. size ( ));
80 80
81 return true; 81 return true;
82} 82}
83 83
84QCString OQCopMessage::channel ( ) const 84QCString OQCopMessage::channel ( ) const
85{ 85{
86 return d-> m_channel; 86 return d-> m_channel;
87} 87}
88 88
89QCString OQCopMessage::message ( ) const 89QCString OQCopMessage::message ( ) const
90{ 90{
91 return d-> m_message; 91 return d-> m_message;
92} 92}
93 93
94QByteArray OQCopMessage::data ( ) const 94QByteArray OQCopMessage::data ( ) const
95{ 95{
96 return d-> m_data; 96 return d-> m_data;
97} 97}
98 98
99void OQCopMessage::setChannel ( const QCString &ch ) 99void OQCopMessage::setChannel ( const QCString &ch )
100{ 100{
101 d-> m_channel = ch; 101 d-> m_channel = ch;
102} 102}
103 103
104void OQCopMessage::setMessage ( const QCString &m ) 104void OQCopMessage::setMessage ( const QCString &m )
105{ 105{
106 d-> m_message = m; 106 d-> m_message = m;
107} 107}
108 108
109void OQCopMessage::setData ( const QByteArray &data ) 109void OQCopMessage::setData ( const QByteArray &data )
110{ 110{
111 d-> m_data = data; 111 d-> m_data = data;
112} 112}
113 113
114/*! \class ODeviceButton 114/*! \class ODeviceButton
115 \brief The ODeviceButton class represents a physical user mappable button on a Qtopia device. 115 \brief The ODeviceButton class represents a physical user mappable button on a Qtopia device.
116 116
117 This class represents a physical button on a Qtopia device. A 117 This class represents a physical button on a Qtopia device. A
118 device may have "user programmable" buttons. 118 device may have "user programmable" buttons.
119 The location and number of buttons will vary from device to 119 The location and number of buttons will vary from device to
120 device. userText() and pixmap() may be used to describe this button 120 device. userText() and pixmap() may be used to describe this button
121 to the user in help documentation. 121 to the user in help documentation.
@@ -173,62 +173,63 @@ OQCopMessage ODeviceButton::factoryPresetPressedAction() const
173 */ 173 */
174OQCopMessage ODeviceButton::pressedAction() const 174OQCopMessage ODeviceButton::pressedAction() const
175{ 175{
176 if (m_PressedAction.channel().isEmpty()) 176 if (m_PressedAction.channel().isEmpty())
177 return factoryPresetPressedAction(); 177 return factoryPresetPressedAction();
178 return m_PressedAction; 178 return m_PressedAction;
179} 179}
180 180
181/*! 181/*!
182 This function returns the factory preset (default) action for when this button 182 This function returns the factory preset (default) action for when this button
183 is pressed and held. The return value is a legal QCop message. 183 is pressed and held. The return value is a legal QCop message.
184 */ 184 */
185OQCopMessage ODeviceButton::factoryPresetHeldAction() const 185OQCopMessage ODeviceButton::factoryPresetHeldAction() const
186{ 186{
187 return m_FactoryPresetHeldAction; 187 return m_FactoryPresetHeldAction;
188} 188}
189 189
190/*! 190/*!
191 This function returns the user assigned action for when this button is pressed 191 This function returns the user assigned action for when this button is pressed
192 and held. If no action is assigned, factoryPresetAction() is returned. 192 and held. If no action is assigned, factoryPresetAction() is returned.
193 */ 193 */
194OQCopMessage ODeviceButton::heldAction() const 194OQCopMessage ODeviceButton::heldAction() const
195{ 195{
196 if (m_HeldAction.channel().isEmpty()) 196 if (m_HeldAction.channel().isEmpty())
197 return factoryPresetHeldAction(); 197 return factoryPresetHeldAction();
198 return m_HeldAction; 198 return m_HeldAction;
199} 199}
200 200
201void ODeviceButton::setKeycode(ushort keycode) 201void ODeviceButton::setKeycode(ushort keycode)
202{ 202{
203 m_Keycode = keycode; 203 m_Keycode = keycode;
204} 204}
205 205
206void ODeviceButton::setUserText(const QString& text) 206void ODeviceButton::setUserText(const QString& text)
207{ 207{
208 m_UserText = text; 208 m_UserText = text;
209} 209}
210 210
211void ODeviceButton::setPixmap(const QPixmap& picture) 211void ODeviceButton::setPixmap(const QPixmap& picture)
212{ 212{
213 m_Pixmap = picture; 213 m_Pixmap = picture;
214} 214}
215 215
216void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action) 216void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action)
217{ 217{
218 m_FactoryPresetPressedAction = action; 218 m_FactoryPresetPressedAction = action;
219} 219}
220 220
221
221void ODeviceButton::setPressedAction(const OQCopMessage& action) 222void ODeviceButton::setPressedAction(const OQCopMessage& action)
222{ 223{
223 m_PressedAction = action; 224 m_PressedAction = action;
224} 225}
225 226
226void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) 227void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action)
227{ 228{
228 m_FactoryPresetHeldAction = action; 229 m_FactoryPresetHeldAction = action;
229} 230}
230 231
231void ODeviceButton::setHeldAction(const OQCopMessage& action) 232void ODeviceButton::setHeldAction(const OQCopMessage& action)
232{ 233{
233 m_HeldAction = action; 234 m_HeldAction = action;
234} 235}