summaryrefslogtreecommitdiff
path: root/libopie/odevicebutton.cpp
authormickeyl <mickeyl>2004-11-16 19:14:18 (UTC)
committer mickeyl <mickeyl>2004-11-16 19:14:18 (UTC)
commitea3945a9bd8f9830f70b1efa133f9df13b19362f (patch) (unidiff)
treef2ea22cc50e9aa8aa73ee7dea148f41c563c9666 /libopie/odevicebutton.cpp
parent1c6f490e8541626f68422e0a3a7c7281d7f5b7d3 (diff)
downloadopie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.zip
opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.tar.gz
opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.tar.bz2
libopie1 goes into unsupported
Diffstat (limited to 'libopie/odevicebutton.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevicebutton.cpp237
1 files changed, 0 insertions, 237 deletions
diff --git a/libopie/odevicebutton.cpp b/libopie/odevicebutton.cpp
deleted file mode 100644
index 647ac4b..0000000
--- a/libopie/odevicebutton.cpp
+++ b/dev/null
@@ -1,237 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21
22#include <qpe/qcopenvelope_qws.h>
23#include <opie/odevicebutton.h>
24
25using namespace Opie;
26
27
28class OQCopMessageData {
29public:
30 QCString m_channel;
31 QCString m_message;
32 QByteArray m_data;
33};
34
35
36OQCopMessage::OQCopMessage ( )
37 : d ( 0 )
38{
39 init ( QCString ( ), QCString ( ), QByteArray ( ));
40}
41
42OQCopMessage::OQCopMessage ( const OQCopMessage &copy )
43 : d ( 0 )
44{
45 init ( copy. channel ( ), copy. message ( ), copy. data ( ));
46}
47
48OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign )
49{
50 init ( assign. channel ( ), assign. message ( ), assign. data ( ));
51 return *this;
52}
53
54OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg )
55 : d ( 0 )
56{
57 init ( ch, m, arg );
58}
59
60void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg )
61{
62 if ( !d )
63 d = new OQCopMessageData ( );
64 d-> m_channel = ch;
65 d-> m_message = m;
66 d-> m_data = arg;
67}
68
69bool OQCopMessage::send ( )
70{
71 if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( ) )
72 return false;
73
74 QCopEnvelope e ( d-> m_channel, d-> m_message );
75
76 if ( d-> m_data. size ( ))
77 e. writeRawBytes ( d-> m_data. data ( ), d-> m_data. size ( ));
78
79 return true;
80}
81
82QCString OQCopMessage::channel ( ) const
83{
84 return d-> m_channel;
85}
86
87QCString OQCopMessage::message ( ) const
88{
89 return d-> m_message;
90}
91
92QByteArray OQCopMessage::data ( ) const
93{
94 return d-> m_data;
95}
96
97bool OQCopMessage::isNull() const
98{
99 return d-> m_message.isNull() || d-> m_channel.isNull();
100}
101void OQCopMessage::setChannel ( const QCString &ch )
102{
103 d-> m_channel = ch;
104}
105
106void OQCopMessage::setMessage ( const QCString &m )
107{
108 d-> m_message = m;
109}
110
111void OQCopMessage::setData ( const QByteArray &data )
112{
113 d-> m_data = data;
114}
115
116/*! \class Opie::ODeviceButton
117 \brief The Opie::ODeviceButton class represents a physical user mappable button on a Qtopia device.
118
119 This class represents a physical button on a Qtopia device. A
120 device may have "user programmable" buttons.
121 The location and number of buttons will vary from device to
122 device. userText() and pixmap() may be used to describe this button
123 to the user in help documentation.
124
125 \ingroup qtopiaemb
126 \internal
127*/
128
129ODeviceButton::ODeviceButton()
130{
131}
132
133ODeviceButton::~ODeviceButton()
134{
135}
136
137/*!
138 Returns the button's keycode.
139 */
140ushort ODeviceButton::keycode() const
141{
142 return m_Keycode;
143}
144
145
146/*!
147 This function returns a human readable, translated description of the button.
148 */
149QString ODeviceButton::userText() const
150{
151 return m_UserText;
152}
153
154/*!
155 This function returns the pixmap for this button. If there isn't one
156 it will return an empty (null) pixmap.
157 */
158QPixmap ODeviceButton::pixmap() const
159{
160 return m_Pixmap;
161}
162
163/*!
164 This function returns the factory preset (default) action for when this button
165 is pressed. The return value is a legal QCop message.
166 */
167OQCopMessage ODeviceButton::factoryPresetPressedAction() const
168{
169 return m_FactoryPresetPressedAction;
170}
171
172/*!
173 This function returns the user assigned action for when this button is pressed.
174 If no action is assigned, factoryPresetAction() is returned.
175 */
176OQCopMessage ODeviceButton::pressedAction() const
177{
178 if (m_PressedAction.channel().isEmpty())
179 return factoryPresetPressedAction();
180 return m_PressedAction;
181}
182
183/*!
184 This function returns the factory preset (default) action for when this button
185 is pressed and held. The return value is a legal QCop message.
186 */
187OQCopMessage ODeviceButton::factoryPresetHeldAction() const
188{
189 return m_FactoryPresetHeldAction;
190}
191
192/*!
193 This function returns the user assigned action for when this button is pressed
194 and held. If no action is assigned, factoryPresetAction() is returned.
195 */
196OQCopMessage ODeviceButton::heldAction() const
197{
198 if (m_HeldAction.channel().isEmpty())
199 return factoryPresetHeldAction();
200 return m_HeldAction;
201}
202
203void ODeviceButton::setKeycode(ushort keycode)
204{
205 m_Keycode = keycode;
206}
207
208void ODeviceButton::setUserText(const QString& text)
209{
210 m_UserText = text;
211}
212
213void ODeviceButton::setPixmap(const QPixmap& picture)
214{
215 m_Pixmap = picture;
216}
217
218void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action)
219{
220 m_FactoryPresetPressedAction = action;
221}
222
223
224void ODeviceButton::setPressedAction(const OQCopMessage& action)
225{
226 m_PressedAction = action;
227}
228
229void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action)
230{
231 m_FactoryPresetHeldAction = action;
232}
233
234void ODeviceButton::setHeldAction(const OQCopMessage& action)
235{
236 m_HeldAction = action;
237}