summaryrefslogtreecommitdiff
authorchicken <chicken>2004-03-01 16:23:00 (UTC)
committer chicken <chicken>2004-03-01 16:23:00 (UTC)
commit032f2d909293fb29e6c7e3cf9cce1a12484c80f7 (patch) (unidiff)
tree368c696aff4d167727aaa564176b6ab1eb0df5cd
parent9bc70bb8a0bdd3a7bc0013f2cacce7c039b88b38 (diff)
downloadopie-032f2d909293fb29e6c7e3cf9cce1a12484c80f7.zip
opie-032f2d909293fb29e6c7e3cf9cce1a12484c80f7.tar.gz
opie-032f2d909293fb29e6c7e3cf9cce1a12484c80f7.tar.bz2
fix includes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/rotateapplet/rotate.cpp4
-rw-r--r--core/applets/rotateapplet/rotate.h1
-rw-r--r--core/applets/screenshotapplet/inputDialog.cpp3
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp1
-rw-r--r--core/applets/suspendapplet/suspend.cpp2
-rw-r--r--core/applets/volumeapplet/oledbox.cpp1
-rw-r--r--core/applets/volumeapplet/volume.cpp4
-rw-r--r--core/applets/volumeapplet/volumeappletimpl.cpp2
-rw-r--r--core/applets/vtapplet/vt.cpp3
-rw-r--r--core/apps/calibrate/main.cpp1
-rw-r--r--core/obex/obex.cc4
-rw-r--r--core/obex/obexhandler.cpp1
-rw-r--r--core/obex/obexsend.cpp4
-rw-r--r--core/obex/receiver.cpp4
14 files changed, 0 insertions, 35 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
index cf3f28b..dcbf809 100644
--- a/core/applets/rotateapplet/rotate.cpp
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -1,256 +1,252 @@
1/* 1/*
2 This file is part of the OPIE Project 2 This file is part of the OPIE Project
3 Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> 3 Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org>
4 Copyright (C) 2003 Greg Gilbert <ggilbert@treke.net> 4 Copyright (C) 2003 Greg Gilbert <ggilbert@treke.net>
5               =. Copyright (C) 2004 Michael Lauer <mickey@Vanille.de> 5               =. Copyright (C) 2004 Michael Lauer <mickey@Vanille.de>
6             .=l. 6             .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This library is free software; you can 8 _;:,     .>    :=|. This library is free software; you can
9.> <,   >  .   <= redistribute it and/or modify it under 9.> <,   >  .   <= redistribute it and/or modify it under
10:=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%+i>       _;_. 14    .%+i>       _;_.
15    .i_,=:_.      -<s. This library is distributed in the hope that 15    .i_,=:_.      -<s. This library is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .     .: details. 21++=   -.     .     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-= this library; see the file COPYING.LIB. 25    --        :-= this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include "rotate.h" 31#include "rotate.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie/odevice.h> 34#include <opie/odevice.h>
35#include <qpe/applnk.h>
36#include <qpe/config.h> 35#include <qpe/config.h>
37#include <qpe/power.h> 36#include <qpe/power.h>
38#include <qpe/qpeapplication.h>
39#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
40#include <qpe/resource.h> 38#include <qpe/resource.h>
41using namespace Opie; 39using namespace Opie;
42 40
43/* QT */ 41/* QT */
44#include <qiconset.h>
45#include <qpopupmenu.h>
46 42
47#include <time.h> 43#include <time.h>
48 44
49RotateApplet::RotateApplet() 45RotateApplet::RotateApplet()
50 :QObject( 0, "RotateApplet" ), m_flipped( false ) 46 :QObject( 0, "RotateApplet" ), m_flipped( false )
51{ 47{
52 48
53#if !defined(QT_NO_COP) 49#if !defined(QT_NO_COP)
54 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); 50 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this );
55 connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 51 connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
56 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 52 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
57#endif 53#endif
58 54
59} 55}
60 56
61RotateApplet::~RotateApplet ( ) 57RotateApplet::~RotateApplet ( )
62{} 58{}
63 59
64/** 60/**
65 * Qcop receive method. 61 * Qcop receive method.
66 */ 62 */
67void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) 63void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data )
68{ 64{
69 qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg ); 65 qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg );
70 66
71 if ( ODevice::inst()->hasHingeSensor() ) 67 if ( ODevice::inst()->hasHingeSensor() )
72 { 68 {
73 struct timespec interval; 69 struct timespec interval;
74 struct timespec remain; 70 struct timespec remain;
75 interval.tv_sec = 0; 71 interval.tv_sec = 0;
76 interval.tv_nsec = 600000; 72 interval.tv_nsec = 600000;
77 ::nanosleep( &interval, &remain ); 73 ::nanosleep( &interval, &remain );
78 OHingeStatus status = ODevice::inst()->readHingeSensor(); 74 OHingeStatus status = ODevice::inst()->readHingeSensor();
79 qDebug( "RotateApplet::readHingeSensor = %d", (int) status ); 75 qDebug( "RotateApplet::readHingeSensor = %d", (int) status );
80 76
81 Config cfg( "apm" ); 77 Config cfg( "apm" );
82 cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); 78 cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" );
83 int action = cfg.readNumEntry( "CloseHingeAction", 0 ); 79 int action = cfg.readNumEntry( "CloseHingeAction", 0 );
84 80
85 if ( status == CASE_CLOSED ) 81 if ( status == CASE_CLOSED )
86 { 82 {
87 switch ( action ) 83 switch ( action )
88 { 84 {
89 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break; 85 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break;
90 case 2: /* SUSPEND */ ODevice::inst()->suspend(); break; 86 case 2: /* SUSPEND */ ODevice::inst()->suspend(); break;
91 default: /* IGNORE */ break; 87 default: /* IGNORE */ break;
92 } 88 }
93 } 89 }
94 else /* status != CASE_CLOSED */ 90 else /* status != CASE_CLOSED */
95 { 91 {
96 switch ( action ) 92 switch ( action )
97 { 93 {
98 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break; 94 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break;
99 case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break; 95 case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break;
100 default: /* IGNORE */ break; 96 default: /* IGNORE */ break;
101 } 97 }
102 } 98 }
103 qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) ); 99 qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) );
104 } 100 }
105 101
106 QDataStream stream( data, IO_ReadOnly ); 102 QDataStream stream( data, IO_ReadOnly );
107 if ( msg == "flip()" ) 103 if ( msg == "flip()" )
108 { 104 {
109 activated ( ); 105 activated ( );
110 } 106 }
111 else if ( msg == "rotateDefault()") 107 else if ( msg == "rotateDefault()")
112 { 108 {
113 rotateDefault(); 109 rotateDefault();
114 } 110 }
115} 111}
116 112
117int RotateApplet::position() const 113int RotateApplet::position() const
118{ 114{
119 return 3; 115 return 3;
120} 116}
121 117
122QString RotateApplet::name() const 118QString RotateApplet::name() const
123{ 119{
124 return tr( "Rotate shortcut" ); 120 return tr( "Rotate shortcut" );
125} 121}
126 122
127QString RotateApplet::text() const 123QString RotateApplet::text() const
128{ 124{
129 return tr( "Rotate" ); 125 return tr( "Rotate" );
130} 126}
131 127
132/*QString RotateApplet::tr( const char* s ) const 128/*QString RotateApplet::tr( const char* s ) const
133{ 129{
134 return qApp->translate( "RotateApplet", s, 0 ); 130 return qApp->translate( "RotateApplet", s, 0 );
135} 131}
136 132
137QString RotateApplet::tr( const char* s, const char* p ) const 133QString RotateApplet::tr( const char* s, const char* p ) const
138{ 134{
139 return qApp->translate( "RotateApplet", s, p ); 135 return qApp->translate( "RotateApplet", s, p );
140} 136}
141*/ 137*/
142 138
143QIconSet RotateApplet::icon() const 139QIconSet RotateApplet::icon() const
144{ 140{
145 QPixmap pix; 141 QPixmap pix;
146 QImage img = Resource::loadImage( "Rotation" ); 142 QImage img = Resource::loadImage( "Rotation" );
147 if ( !img.isNull() ) 143 if ( !img.isNull() )
148 pix.convertFromImage( img.smoothScale( 14, 14 ) ); 144 pix.convertFromImage( img.smoothScale( 14, 14 ) );
149 return pix; 145 return pix;
150} 146}
151 147
152QPopupMenu* RotateApplet::popup(QWidget*) const 148QPopupMenu* RotateApplet::popup(QWidget*) const
153{ 149{
154 return 0; 150 return 0;
155} 151}
156 152
157void RotateApplet::rotateDefault() 153void RotateApplet::rotateDefault()
158{ 154{
159 int rot = ODevice::inst()->rotation(); 155 int rot = ODevice::inst()->rotation();
160 156
161 switch (rot) 157 switch (rot)
162 { 158 {
163 case Rot0: rot=0; break; 159 case Rot0: rot=0; break;
164 case Rot90: rot=90; break; 160 case Rot90: rot=90; break;
165 case Rot180: rot=180; break; 161 case Rot180: rot=180; break;
166 case Rot270: rot=270; break; 162 case Rot270: rot=270; break;
167 default: rot=0; break; 163 default: rot=0; break;
168 } 164 }
169 165
170 Config cfg( "qpe" ); 166 Config cfg( "qpe" );
171 cfg.setGroup( "Appearance" ); 167 cfg.setGroup( "Appearance" );
172 168
173 bool rotateEnabled = cfg.readBoolEntry( "rotateEnabled",true ); 169 bool rotateEnabled = cfg.readBoolEntry( "rotateEnabled",true );
174 170
175 if ( !rotateEnabled) return; 171 if ( !rotateEnabled) return;
176 172
177 // hide inputs methods before rotation 173 // hide inputs methods before rotation
178 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); 174 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" );
179 175
180 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); 176 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" );
181 env << rot; 177 env << rot;
182 178
183 m_flipped = false; 179 m_flipped = false;
184 180
185} 181}
186void RotateApplet::activated() 182void RotateApplet::activated()
187{ 183{
188 int defaultRotation = QPEApplication::defaultRotation(); 184 int defaultRotation = QPEApplication::defaultRotation();
189 int newRotation = defaultRotation; 185 int newRotation = defaultRotation;
190 186
191 Config cfg( "qpe" ); 187 Config cfg( "qpe" );
192 cfg.setGroup( "Appearance" ); 188 cfg.setGroup( "Appearance" );
193 189
194 int rotDirection = cfg.readNumEntry( "rotatedir" ); 190 int rotDirection = cfg.readNumEntry( "rotatedir" );
195 ODirection rot = CW; 191 ODirection rot = CW;
196 192
197 if (rotDirection == -1) 193 if (rotDirection == -1)
198 { 194 {
199 rot = ODevice::inst()->direction(); 195 rot = ODevice::inst()->direction();
200 } 196 }
201 else 197 else
202 { 198 {
203 rot = (ODirection) rotDirection; 199 rot = (ODirection) rotDirection;
204 } 200 }
205 201
206 // hide inputs methods before rotation 202 // hide inputs methods before rotation
207 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); 203 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" );
208 204
209 if ( m_flipped ) 205 if ( m_flipped )
210 { 206 {
211 // if flipped, flip back to the original state, 207 // if flipped, flip back to the original state,
212 // regardless of rotation direction 208 // regardless of rotation direction
213 newRotation = defaultRotation; 209 newRotation = defaultRotation;
214 } 210 }
215 else 211 else
216 { 212 {
217 if ( rot == CCW ) 213 if ( rot == CCW )
218 { 214 {
219 newRotation = ( defaultRotation + 90 ) % 360; 215 newRotation = ( defaultRotation + 90 ) % 360;
220 } 216 }
221 else if ( rot == CW ) 217 else if ( rot == CW )
222 { 218 {
223 newRotation = ( defaultRotation + 270 ) % 360; 219 newRotation = ( defaultRotation + 270 ) % 360;
224 } 220 }
225 else if ( rot == Flip ) 221 else if ( rot == Flip )
226 { 222 {
227 newRotation = ( defaultRotation + 180 ) % 360; 223 newRotation = ( defaultRotation + 180 ) % 360;
228 } 224 }
229 } 225 }
230 226
231 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); 227 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" );
232 env << newRotation; 228 env << newRotation;
233 229
234 m_flipped = !m_flipped; 230 m_flipped = !m_flipped;
235} 231}
236 232
237 233
238QRESULT RotateApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 234QRESULT RotateApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
239{ 235{
240 *iface = 0; 236 *iface = 0;
241 if ( uuid == IID_QUnknown ) 237 if ( uuid == IID_QUnknown )
242 *iface = this; 238 *iface = this;
243 else if ( uuid == IID_MenuApplet ) 239 else if ( uuid == IID_MenuApplet )
244 *iface = this; 240 *iface = this;
245 else 241 else
246 return QS_FALSE; 242 return QS_FALSE;
247 243
248 if ( *iface ) 244 if ( *iface )
249 (*iface)->addRef(); 245 (*iface)->addRef();
250 return QS_OK; 246 return QS_OK;
251} 247}
252 248
253Q_EXPORT_INTERFACE() 249Q_EXPORT_INTERFACE()
254{ 250{
255 Q_CREATE_INSTANCE( RotateApplet ) 251 Q_CREATE_INSTANCE( RotateApplet )
256} 252}
diff --git a/core/applets/rotateapplet/rotate.h b/core/applets/rotateapplet/rotate.h
index 2396993..bdccea0 100644
--- a/core/applets/rotateapplet/rotate.h
+++ b/core/applets/rotateapplet/rotate.h
@@ -1,71 +1,70 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org> 3             .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library is free software; you can
6.> <_,   >  .   <= redistribute it and/or modify it under 6.> <_,   >  .   <= redistribute it and/or modify it under
7:=1 )Y*s>-.--   : the terms of the GNU Library General Public 7:=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%+i>       _;_. 11    .%+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .     .: details. 18++=   -.     .     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-= this library; see the file COPYING.LIB. 22    --        :-= this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29 29
30 30
31#ifndef __OPIE_ROTATE_APPLET_H__ 31#ifndef __OPIE_ROTATE_APPLET_H__
32#define __OPIE_ROTATE_APPLET_H__ 32#define __OPIE_ROTATE_APPLET_H__
33 33
34#include <qpe/menuappletinterface.h> 34#include <qpe/menuappletinterface.h>
35#include <qobject.h> 35#include <qobject.h>
36 36
37#include <qobject.h>
38 37
39class RotateApplet : public QObject, public MenuAppletInterface 38class RotateApplet : public QObject, public MenuAppletInterface
40{ 39{
41 40
42 Q_OBJECT 41 Q_OBJECT
43 42
44public: 43public:
45 RotateApplet ( ); 44 RotateApplet ( );
46 virtual ~RotateApplet ( ); 45 virtual ~RotateApplet ( );
47 46
48 QRESULT queryInterface( const QUuid&, QUnknownInterface** ); 47 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
49 Q_REFCOUNT 48 Q_REFCOUNT
50 49
51 virtual int position() const; 50 virtual int position() const;
52 51
53 virtual QString name ( ) const; 52 virtual QString name ( ) const;
54 virtual QIconSet icon ( ) const; 53 virtual QIconSet icon ( ) const;
55 virtual QString text ( ) const; 54 virtual QString text ( ) const;
56 /* virtual QString tr( const char* ) const; 55 /* virtual QString tr( const char* ) const;
57 virtual QString tr( const char*, const char* ) const; 56 virtual QString tr( const char*, const char* ) const;
58 */ 57 */
59 virtual QPopupMenu *popup ( QWidget *parent ) const; 58 virtual QPopupMenu *popup ( QWidget *parent ) const;
60 virtual void activated ( ); 59 virtual void activated ( );
61 virtual void rotateDefault ( ); 60 virtual void rotateDefault ( );
62 61
63private slots: 62private slots:
64 void channelReceived( const QCString &msg, const QByteArray & data ); 63 void channelReceived( const QCString &msg, const QByteArray & data );
65 64
66private: 65private:
67 bool m_flipped : 1; 66 bool m_flipped : 1;
68 67
69}; 68};
70 69
71#endif 70#endif
diff --git a/core/applets/screenshotapplet/inputDialog.cpp b/core/applets/screenshotapplet/inputDialog.cpp
index f506dfd..73ec773 100644
--- a/core/applets/screenshotapplet/inputDialog.cpp
+++ b/core/applets/screenshotapplet/inputDialog.cpp
@@ -1,67 +1,64 @@
1/**************************************************************************** 1/****************************************************************************
2** Form implementation generated from reading ui file 'inputDialog.ui' 2** Form implementation generated from reading ui file 'inputDialog.ui'
3** 3**
4** Created: Sat Mar 2 07:55:03 2002 4** Created: Sat Mar 2 07:55:03 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#include "inputDialog.h" 9#include "inputDialog.h"
10 10
11#include <qpe/resource.h> 11#include <qpe/resource.h>
12 12
13#include <opie2/ofiledialog.h> 13#include <opie2/ofiledialog.h>
14 14
15#include <qlineedit.h> 15#include <qlineedit.h>
16#include <qlayout.h>
17#include <qvariant.h>
18#include <qpushbutton.h> 16#include <qpushbutton.h>
19#include <qwhatsthis.h>
20 17
21InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 18InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
22 : QDialog( parent, name, modal, fl ) 19 : QDialog( parent, name, modal, fl )
23{ 20{
24 if ( !name ) 21 if ( !name )
25 setName( "InputDialog" ); 22 setName( "InputDialog" );
26 resize( 234, 115); 23 resize( 234, 115);
27 setMaximumSize( QSize( 240, 40)); 24 setMaximumSize( QSize( 240, 40));
28 setCaption( tr(name ) ); 25 setCaption( tr(name ) );
29 26
30 QPushButton *browserButton; 27 QPushButton *browserButton;
31 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); 28 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
32 browserButton->setGeometry( QRect( 205, 10, 22, 22)); 29 browserButton->setGeometry( QRect( 205, 10, 22, 22));
33 connect( browserButton, SIGNAL(released()),this,SLOT(browse())); 30 connect( browserButton, SIGNAL(released()),this,SLOT(browse()));
34 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 31 LineEdit1 = new QLineEdit( this, "LineEdit1" );
35 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); 32 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) );
36} 33}
37 34
38/* 35/*
39 * Destroys the object and frees any allocated resources 36 * Destroys the object and frees any allocated resources
40 */ 37 */
41InputDialog::~InputDialog() 38InputDialog::~InputDialog()
42{ 39{
43 inputText= LineEdit1->text(); 40 inputText= LineEdit1->text();
44 41
45} 42}
46 43
47void InputDialog::browse() { 44void InputDialog::browse() {
48 45
49 MimeTypes types; 46 MimeTypes types;
50 QStringList audio, video, all; 47 QStringList audio, video, all;
51 audio << "audio/*"; 48 audio << "audio/*";
52 audio << "playlist/plain"; 49 audio << "playlist/plain";
53 audio << "audio/x-mpegurl"; 50 audio << "audio/x-mpegurl";
54 51
55 video << "video/*"; 52 video << "video/*";
56 video << "playlist/plain"; 53 video << "playlist/plain";
57 54
58 all += audio; 55 all += audio;
59 all += video; 56 all += video;
60 types.insert("All Media Files", all ); 57 types.insert("All Media Files", all );
61 types.insert("Audio", audio ); 58 types.insert("Audio", audio );
62 types.insert("Video", video ); 59 types.insert("Video", video );
63 60
64 QString str = Opie::OFileDialog::getOpenFileName( 1,"/","", types, 0 ); 61 QString str = Opie::OFileDialog::getOpenFileName( 1,"/","", types, 0 );
65 LineEdit1->setText(str); 62 LineEdit1->setText(str);
66} 63}
67 64
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 5f83539..56a031c 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -1,292 +1,291 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com 2** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com
3** All rights reserved. 3** All rights reserved.
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14 14
15#include "screenshot.h" 15#include "screenshot.h"
16#include "inputDialog.h" 16#include "inputDialog.h"
17 17
18#include <stdlib.h> 18#include <stdlib.h>
19#include <sys/socket.h> 19#include <sys/socket.h>
20#include <netinet/in.h> 20#include <netinet/in.h>
21#include <netdb.h> 21#include <netdb.h>
22#include <unistd.h> 22#include <unistd.h>
23 23
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26 26
27#include <qlineedit.h> 27#include <qlineedit.h>
28#include <qdir.h> 28#include <qdir.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qpainter.h> 31#include <qpainter.h>
32#include <qspinbox.h> 32#include <qspinbox.h>
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36#include <qimage.h>
37 36
38 37
39/* XPM */ 38/* XPM */
40static char * snapshot_xpm[] = { 39static char * snapshot_xpm[] = {
41"32 32 177 2", 40"32 32 177 2",
42 " c None", 41 " c None",
43 ". c #042045", 42 ". c #042045",
44 "+ c #0D2B47", 43 "+ c #0D2B47",
45 "@ c #0E325E", 44 "@ c #0E325E",
46 "# c #0D2E50", 45 "# c #0D2E50",
47 "$ c #0A1C32", 46 "$ c #0A1C32",
48 "% c #0F3A69", 47 "% c #0F3A69",
49 "& c #164680", 48 "& c #164680",
50 "* c #165EAE", 49 "* c #165EAE",
51 "= c #134D89", 50 "= c #134D89",
52 "- c #0A3A6E", 51 "- c #0A3A6E",
53 "; c #031024", 52 "; c #031024",
54 "> c #031B36", 53 "> c #031B36",
55 ", c #1A5EA3", 54 ", c #1A5EA3",
56 "' c #1862B1", 55 "' c #1862B1",
57 ") c #1866B9", 56 ") c #1866B9",
58 "! c #0F5AAC", 57 "! c #0F5AAC",
59 "~ c #0F56A8", 58 "~ c #0F56A8",
60 "{ c #0C4C96", 59 "{ c #0C4C96",
61 "] c #030918", 60 "] c #030918",
62 "^ c #060206", 61 "^ c #060206",
63 "/ c #20242C", 62 "/ c #20242C",
64 "( c #3E3B3B", 63 "( c #3E3B3B",
65 "_ c #186ABD", 64 "_ c #186ABD",
66 ": c #115EB3", 65 ": c #115EB3",
67 "< c #082644", 66 "< c #082644",
68 "[ c #222C38", 67 "[ c #222C38",
69 "} c #5A5859", 68 "} c #5A5859",
70 "| c #091921", 69 "| c #091921",
71 "1 c #1E7EDE", 70 "1 c #1E7EDE",
72 "2 c #1A7ADA", 71 "2 c #1A7ADA",
73 "3 c #1970CD", 72 "3 c #1970CD",
74 "4 c #1758A1", 73 "4 c #1758A1",
75 "5 c #0E529A", 74 "5 c #0E529A",
76 "6 c #094388", 75 "6 c #094388",
77 "7 c #22364E", 76 "7 c #22364E",
78 "8 c #384454", 77 "8 c #384454",
79 "9 c #04162C", 78 "9 c #04162C",
80 "0 c #123451", 79 "0 c #123451",
81 "a c #3296B4", 80 "a c #3296B4",
82 "b c #298AB1", 81 "b c #298AB1",
83 "c c #2484AC", 82 "c c #2484AC",
84 "d c #033D86", 83 "d c #033D86",
85 "e c #033677", 84 "e c #033677",
86 "f c #072C58", 85 "f c #072C58",
87 "g c #525862", 86 "g c #525862",
88 "h c #5E5E5E", 87 "h c #5E5E5E",
89 "i c #23492A", 88 "i c #23492A",
90 "j c #4FBD3F", 89 "j c #4FBD3F",
91 "k c #50B24C", 90 "k c #50B24C",
92 "l c #51C72E", 91 "l c #51C72E",
93 "m c #42C64A", 92 "m c #42C64A",
94 "n c #2686CA", 93 "n c #2686CA",
95 "o c #0B52A4", 94 "o c #0B52A4",
96 "p c #054A9A", 95 "p c #054A9A",
97 "q c #053B7C", 96 "q c #053B7C",
98 "r c #2B2325", 97 "r c #2B2325",
99 "s c #6E7070", 98 "s c #6E7070",
100 "t c #0D240E", 99 "t c #0D240E",
101 "u c #1E423E", 100 "u c #1E423E",
102 "v c #468ABE", 101 "v c #468ABE",
103 "w c #6A8AC2", 102 "w c #6A8AC2",
104 "x c #7EAA8E", 103 "x c #7EAA8E",
105 "y c #84BE4E", 104 "y c #84BE4E",
106 "z c #65C639", 105 "z c #65C639",
107 "A c #064EA0", 106 "A c #064EA0",
108 "B c #0A4DA0", 107 "B c #0A4DA0",
109 "C c #4E5242", 108 "C c #4E5242",
110 "D c #62362E", 109 "D c #62362E",
111 "E c #721A1A", 110 "E c #721A1A",
112 "F c #6E0A0A", 111 "F c #6E0A0A",
113 "G c #3E0E0E", 112 "G c #3E0E0E",
114 "H c #6AB85E", 113 "H c #6AB85E",
115 "I c #7E8ECA", 114 "I c #7E8ECA",
116 "J c #929CD4", 115 "J c #929CD4",
117 "K c #9EAECA", 116 "K c #9EAECA",
118 "L c #9EBEAE", 117 "L c #9EBEAE",
119 "M c #8EC26A", 118 "M c #8EC26A",
120 "N c #32A276", 119 "N c #32A276",
121 "O c #20518C", 120 "O c #20518C",
122 "P c #46566E", 121 "P c #46566E",
123 "Q c #614A51", 122 "Q c #614A51",
124 "R c #AE2A26", 123 "R c #AE2A26",
125 "S c #C41C1A", 124 "S c #C41C1A",
126 "T c #CE0A0A", 125 "T c #CE0A0A",
127 "U c #A60606", 126 "U c #A60606",
128 "V c #921616", 127 "V c #921616",
129 "W c #863735", 128 "W c #863735",
130 "X c #866A66", 129 "X c #866A66",
131 "Y c #9E9EA2", 130 "Y c #9E9EA2",
132 "Z c #1E5212", 131 "Z c #1E5212",
133 "` c #7EC652", 132 "` c #7EC652",
134 " .c #B2B2F2", 133 " .c #B2B2F2",
135 "..c #CACAF6", 134 "..c #CACAF6",
136 "+.c #AECEC6", 135 "+.c #AECEC6",
137 "@.c #92CE72", 136 "@.c #92CE72",
138 "#.c #42AA86", 137 "#.c #42AA86",
139 "$.c #365E96", 138 "$.c #365E96",
140 "%.c #B82420", 139 "%.c #B82420",
141 "&.c #E20E0E", 140 "&.c #E20E0E",
142 "*.c #EF0E0B", 141 "*.c #EF0E0B",
143 "=.c #566A86", 142 "=.c #566A86",
144 "-.c #92929A", 143 "-.c #92929A",
145 ";.c #16260E", 144 ";.c #16260E",
146 ">.c #2E571A", 145 ">.c #2E571A",
147 ",.c #7ED64E", 146 ",.c #7ED64E",
148 "'.c #9ECEB2", 147 "'.c #9ECEB2",
149 ").c #C6D5EF", 148 ").c #C6D5EF",
150 "!.c #E2E0FE", 149 "!.c #E2E0FE",
151 "~.c #A2DE8A", 150 "~.c #A2DE8A",
152 "{.c #4AAA5B", 151 "{.c #4AAA5B",
153 "].c #2A6AB2", 152 "].c #2A6AB2",
154 "^.c #9A7A6E", 153 "^.c #9A7A6E",
155 "/.c #D25A52", 154 "/.c #D25A52",
156 "(.c #F62626", 155 "(.c #F62626",
157 "_.c #FA0206", 156 "_.c #FA0206",
158 ":.c #DE1E16", 157 ":.c #DE1E16",
159 "<.c #B63A26", 158 "<.c #B63A26",
160 "[.c #865A2E", 159 "[.c #865A2E",
161 "}.c #26568E", 160 "}.c #26568E",
162 "|.c #435F7D", 161 "|.c #435F7D",
163 "1.c #7AE246", 162 "1.c #7AE246",
164 "2.c #96EA6E", 163 "2.c #96EA6E",
165 "3.c #BEEAAE", 164 "3.c #BEEAAE",
166 "4.c #D0EADC", 165 "4.c #D0EADC",
167 "5.c #B6CEFE", 166 "5.c #B6CEFE",
168 "6.c #9ADE8A", 167 "6.c #9ADE8A",
169 "7.c #2A609A", 168 "7.c #2A609A",
170 "8.c #7E623E", 169 "8.c #7E623E",
171 "9.c #CA7A72", 170 "9.c #CA7A72",
172 "0.c #F26E6E", 171 "0.c #F26E6E",
173 "a.c #FE5252", 172 "a.c #FE5252",
174 "b.c #FA3638", 173 "b.c #FA3638",
175 "c.c #DA2E28", 174 "c.c #DA2E28",
176 "d.c #9E3E3A", 175 "d.c #9E3E3A",
177 "e.c #3E7656", 176 "e.c #3E7656",
178 "f.c #76CB3A", 177 "f.c #76CB3A",
179 "g.c #90DE44", 178 "g.c #90DE44",
180 "h.c #A2EE6A", 179 "h.c #A2EE6A",
181 "i.c #9EEA9A", 180 "i.c #9EEA9A",
182 "j.c #92BEDE", 181 "j.c #92BEDE",
183 "k.c #7ADA7E", 182 "k.c #7ADA7E",
184 "l.c #5ECE52", 183 "l.c #5ECE52",
185 "m.c #6A5E52", 184 "m.c #6A5E52",
186 "n.c #A83238", 185 "n.c #A83238",
187 "o.c #FA5656", 186 "o.c #FA5656",
188 "p.c #F29A92", 187 "p.c #F29A92",
189 "q.c #D29E92", 188 "q.c #D29E92",
190 "r.c #8A7A62", 189 "r.c #8A7A62",
191 "s.c #05336B", 190 "s.c #05336B",
192 "t.c #59C631", 191 "t.c #59C631",
193 "u.c #8AD23A", 192 "u.c #8AD23A",
194 "v.c #66E242", 193 "v.c #66E242",
195 "w.c #1D6FC1", 194 "w.c #1D6FC1",
196 "x.c #E61212", 195 "x.c #E61212",
197 "y.c #CA261E", 196 "y.c #CA261E",
198 "z.c #5A763E", 197 "z.c #5A763E",
199 "A.c #1E6E9A", 198 "A.c #1E6E9A",
200 "B.c #023272", 199 "B.c #023272",
201 "C.c #329696", 200 "C.c #329696",
202 "D.c #2074B6", 201 "D.c #2074B6",
203 "E.c #3E4E76", 202 "E.c #3E4E76",
204 "F.c #5A525E", 203 "F.c #5A525E",
205 "G.c #425868", 204 "G.c #425868",
206 "H.c #04448E", 205 "H.c #04448E",
207 "I.c #28828A", 206 "I.c #28828A",
208 "J.c #2D8593", 207 "J.c #2D8593",
209 "K.c #12427A", 208 "K.c #12427A",
210 "L.c #054696", 209 "L.c #054696",
211 "M.c #042B5E", 210 "M.c #042B5E",
212 "N.c #134F95", 211 "N.c #134F95",
213 "O.c #1E6ABB", 212 "O.c #1E6ABB",
214 "P.c #1A5E96", 213 "P.c #1A5E96",
215 "Q.c #022E67", 214 "Q.c #022E67",
216 "R.c #0C3E7C", 215 "R.c #0C3E7C",
217 "S.c #023E8A", 216 "S.c #023E8A",
218 "T.c #021A3E", 217 "T.c #021A3E",
219" ", 218" ",
220" ", 219" ",
221" ", 220" ",
222" . + @ # + ", 221" . + @ # + ",
223" $ # % & * * = - # $ ", 222" $ # % & * * = - # $ ",
224"; > % @ = , ' ) ' ! ~ { % @ . ] ^ / ( ", 223"; > % @ = , ' ) ' ! ~ { % @ . ] ^ / ( ",
225"; + ' * ) _ ) ) ' : : ! { { % < . [ ( } ", 224"; + ' * ) _ ) ) ' : : ! { { % < . [ ( } ",
226"| @ 1 2 3 _ _ ) ' : : : : 4 5 6 6 # 7 8 } ", 225"| @ 1 2 3 _ _ ) ' : : : : 4 5 6 6 # 7 8 } ",
227"9 0 a b b b c _ ) : : ! ! ~ ~ 5 ~ d e f [ 8 g h h } ", 226"9 0 a b b b c _ ) : : ! ! ~ ~ 5 ~ d e f [ 8 g h h } ",
228"| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ", 227"| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ",
229"t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ", 228"t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ",
230"| u H I J K L M H k N 3 3 : ~ o o 5 O P Q R S T T U V W X Y ", 229"| u H I J K L M H k N 3 3 : ~ o o 5 O P Q R S T T U V W X Y ",
231"| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ", 230"| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ",
232";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ", 231";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ",
233";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ", 232";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ",
234";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ", 233";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ",
235"t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ", 234"t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ",
236"| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ", 235"| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ",
237"; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ", 236"; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ",
238"9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ", 237"9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ",
239"9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ", 238"9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ",
240"; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ", 239"; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ",
241"; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ", 240"; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ",
242" ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ", 241" ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ",
243" # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ", 242" # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ",
244" + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ", 243" + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ",
245" < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ", 244" < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ",
246" $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ", 245" $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ",
247" ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ", 246" ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ",
248" | > e L.d L.H.e M.. ; ] ] ", 247" | > e L.d L.H.e M.. ; ] ] ",
249" > 9 . S.Q.. ; ] ", 248" > 9 . S.Q.. ; ] ",
250" T.; ] "}; 249" T.; ] "};
251 250
252static const char *SCAP_hostname = "www.handhelds.org"; 251static const char *SCAP_hostname = "www.handhelds.org";
253static const int SCAP_port = 80; 252static const int SCAP_port = 80;
254 253
255 254
256ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) 255ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name )
257 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) 256 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
258{ 257{
259 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 258 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
260 QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 ); 259 QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 );
261 QHBoxLayout *hbox; 260 QHBoxLayout *hbox;
262 261
263 hbox = new QHBoxLayout ( vbox ); 262 hbox = new QHBoxLayout ( vbox );
264 263
265 QLabel *l = new QLabel ( tr( "Delay" ), this ); 264 QLabel *l = new QLabel ( tr( "Delay" ), this );
266 hbox-> addWidget ( l ); 265 hbox-> addWidget ( l );
267 266
268 delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" ); 267 delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" );
269 delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus ); 268 delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus );
270 delaySpin-> setSuffix ( tr( "sec" )); 269 delaySpin-> setSuffix ( tr( "sec" ));
271 delaySpin-> setFocusPolicy( QWidget::NoFocus ); 270 delaySpin-> setFocusPolicy( QWidget::NoFocus );
272 delaySpin-> setValue ( 1 ); 271 delaySpin-> setValue ( 1 );
273 hbox-> addWidget ( delaySpin ); 272 hbox-> addWidget ( delaySpin );
274 273
275 saveNamedCheck = new QCheckBox ( tr( "Save named" ), this); 274 saveNamedCheck = new QCheckBox ( tr( "Save named" ), this);
276 saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus ); 275 saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus );
277 vbox->addWidget( saveNamedCheck); 276 vbox->addWidget( saveNamedCheck);
278 277
279 vbox-> addSpacing ( 3 ); 278 vbox-> addSpacing ( 3 );
280 279
281 l = new QLabel ( tr( "Save screenshot as..." ), this ); 280 l = new QLabel ( tr( "Save screenshot as..." ), this );
282 vbox-> addWidget ( l, AlignCenter ); 281 vbox-> addWidget ( l, AlignCenter );
283 282
284 hbox = new QHBoxLayout ( vbox ); 283 hbox = new QHBoxLayout ( vbox );
285 284
286 grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" ); 285 grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" );
287 grabItButton ->setFocusPolicy( QWidget::TabFocus ); 286 grabItButton ->setFocusPolicy( QWidget::TabFocus );
288 hbox-> addWidget ( grabItButton ); 287 hbox-> addWidget ( grabItButton );
289 288
290 scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" ); 289 scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" );
291 scapButton ->setFocusPolicy( QWidget::TabFocus ); 290 scapButton ->setFocusPolicy( QWidget::TabFocus );
292 hbox-> addWidget ( scapButton ); 291 hbox-> addWidget ( scapButton );
diff --git a/core/applets/suspendapplet/suspend.cpp b/core/applets/suspendapplet/suspend.cpp
index e17142b..0eb94cb 100644
--- a/core/applets/suspendapplet/suspend.cpp
+++ b/core/applets/suspendapplet/suspend.cpp
@@ -1,87 +1,85 @@
1#include <qpe/resource.h> 1#include <qpe/resource.h>
2#include <qpe/qcopenvelope_qws.h> 2#include <qpe/qcopenvelope_qws.h>
3 3
4#include <qapplication.h> 4#include <qapplication.h>
5#include <qiconset.h>
6#include <qpopupmenu.h>
7 5
8#include "suspend.h" 6#include "suspend.h"
9 7
10 8
11SuspendApplet::SuspendApplet ( ) 9SuspendApplet::SuspendApplet ( )
12 : QObject ( 0, "SuspendApplet" ) 10 : QObject ( 0, "SuspendApplet" )
13{ 11{
14} 12}
15 13
16SuspendApplet::~SuspendApplet ( ) 14SuspendApplet::~SuspendApplet ( )
17{ 15{
18} 16}
19 17
20int SuspendApplet::position ( ) const 18int SuspendApplet::position ( ) const
21{ 19{
22 return 2; 20 return 2;
23} 21}
24 22
25QString SuspendApplet::name ( ) const 23QString SuspendApplet::name ( ) const
26{ 24{
27 return tr( "Suspend shortcut" ); 25 return tr( "Suspend shortcut" );
28} 26}
29 27
30QString SuspendApplet::text ( ) const 28QString SuspendApplet::text ( ) const
31{ 29{
32 return tr( "Suspend" ); 30 return tr( "Suspend" );
33} 31}
34 32
35QString SuspendApplet::tr( const char* s ) const 33QString SuspendApplet::tr( const char* s ) const
36{ 34{
37 return qApp->translate( "SuspendApplet", s, 0 ); 35 return qApp->translate( "SuspendApplet", s, 0 );
38} 36}
39 37
40QString SuspendApplet::tr( const char* s, const char* p ) const 38QString SuspendApplet::tr( const char* s, const char* p ) const
41{ 39{
42 return qApp->translate( "SuspendApplet", s, p ); 40 return qApp->translate( "SuspendApplet", s, p );
43} 41}
44 42
45QIconSet SuspendApplet::icon ( ) const 43QIconSet SuspendApplet::icon ( ) const
46{ 44{
47 QPixmap pix; 45 QPixmap pix;
48 QImage img = Resource::loadImage ( "suspend" ); 46 QImage img = Resource::loadImage ( "suspend" );
49 47
50 if ( !img. isNull ( )) 48 if ( !img. isNull ( ))
51 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 49 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
52 return pix; 50 return pix;
53} 51}
54 52
55QPopupMenu *SuspendApplet::popup ( QWidget * ) const 53QPopupMenu *SuspendApplet::popup ( QWidget * ) const
56{ 54{
57 return 0; 55 return 0;
58} 56}
59 57
60void SuspendApplet::activated ( ) 58void SuspendApplet::activated ( )
61{ 59{
62 // suspend 60 // suspend
63 QCopEnvelope ( "QPE/System", "suspend()" ); 61 QCopEnvelope ( "QPE/System", "suspend()" );
64} 62}
65 63
66 64
67QRESULT SuspendApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 65QRESULT SuspendApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
68{ 66{
69 *iface = 0; 67 *iface = 0;
70 if ( uuid == IID_QUnknown ) 68 if ( uuid == IID_QUnknown )
71 *iface = this; 69 *iface = this;
72 else if ( uuid == IID_MenuApplet ) 70 else if ( uuid == IID_MenuApplet )
73 *iface = this; 71 *iface = this;
74 else 72 else
75 return QS_FALSE; 73 return QS_FALSE;
76 74
77 if ( *iface ) 75 if ( *iface )
78 (*iface)-> addRef ( ); 76 (*iface)-> addRef ( );
79 return QS_OK; 77 return QS_OK;
80} 78}
81 79
82Q_EXPORT_INTERFACE( ) 80Q_EXPORT_INTERFACE( )
83{ 81{
84 Q_CREATE_INSTANCE( SuspendApplet ) 82 Q_CREATE_INSTANCE( SuspendApplet )
85} 83}
86 84
87 85
diff --git a/core/applets/volumeapplet/oledbox.cpp b/core/applets/volumeapplet/oledbox.cpp
index 7547287..bf275a9 100644
--- a/core/applets/volumeapplet/oledbox.cpp
+++ b/core/applets/volumeapplet/oledbox.cpp
@@ -1,258 +1,257 @@
1 1
2#include <qpixmap.h>
3#include <qbitmap.h> 2#include <qbitmap.h>
4#include <qpainter.h> 3#include <qpainter.h>
5 4
6#include "oledbox.h" 5#include "oledbox.h"
7 6
8 7
9#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC 8#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC
10 9
11/* XPM */ 10/* XPM */
12static const char * ledborder_xpm[] = { 11static const char * ledborder_xpm[] = {
13"16 16 11 1", 12"16 16 11 1",
14 " c None", 13 " c None",
15 ".c #626562", 14 ".c #626562",
16 "+c #7B7D7B", 15 "+c #7B7D7B",
17 "@c #949594", 16 "@c #949594",
18 "#c #ACAEAC", 17 "#c #ACAEAC",
19 "$c #CDCACD", 18 "$c #CDCACD",
20 "%c #CDCECD", 19 "%c #CDCECD",
21 ";c #E6E6E6", 20 ";c #E6E6E6",
22 ">c #FFFFFF", 21 ">c #FFFFFF",
23 ",c #E6E2E6", 22 ",c #E6E2E6",
24 "'c #FFFAFF", 23 "'c #FFFAFF",
25" .++@@# ", 24" .++@@# ",
26" ...++@@##$ ", 25" ...++@@##$ ",
27" .....+@##$$% ", 26" .....+@##$$% ",
28" ..... #$%%% ", 27" ..... #$%%% ",
29" ... %%; ", 28" ... %%; ",
30".... ;;;;", 29".... ;;;;",
31"++. ;>>", 30"++. ;>>",
32"+++ >>>", 31"+++ >>>",
33"@@@ >>>", 32"@@@ >>>",
34"@@# >>>", 33"@@# >>>",
35"#### >>>>", 34"#### >>>>",
36" #$$ >>> ", 35" #$$ >>> ",
37" $$,,' >>>>> ", 36" $$,,' >>>>> ",
38" ,,,''>>>>>>> ", 37" ,,,''>>>>>>> ",
39" ,''>>>>>>> ", 38" ,''>>>>>>> ",
40" '>>>>> "}; 39" '>>>>> "};
41 40
42 41
43QPixmap *OLedBox::s_border_pix = 0; 42QPixmap *OLedBox::s_border_pix = 0;
44 43
45#endif 44#endif
46 45
47 46
48OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWidget ( parent, name ) 47OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWidget ( parent, name )
49{ 48{
50 m_color = col; 49 m_color = col;
51 m_on = false; 50 m_on = false;
52 51
53 m_pix [ 0 ] = m_pix [ 1 ] = false; 52 m_pix [ 0 ] = m_pix [ 1 ] = false;
54 53
55 setBackgroundMode ( PaletteBackground ); 54 setBackgroundMode ( PaletteBackground );
56 55
57#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC 56#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC
58 if ( !s_border_pix ) 57 if ( !s_border_pix )
59 s_border_pix = new QPixmap ( ledborder_xpm ); 58 s_border_pix = new QPixmap ( ledborder_xpm );
60#endif 59#endif
61} 60}
62 61
63OLedBox::~OLedBox ( ) 62OLedBox::~OLedBox ( )
64{ 63{
65 delete m_pix [ 0 ]; 64 delete m_pix [ 0 ];
66 delete m_pix [ 1 ]; 65 delete m_pix [ 1 ];
67} 66}
68 67
69QSize OLedBox::sizeHint ( ) const 68QSize OLedBox::sizeHint ( ) const
70{ 69{
71 return QSize ( 16, 16 ); 70 return QSize ( 16, 16 );
72} 71}
73 72
74bool OLedBox::isOn ( ) const 73bool OLedBox::isOn ( ) const
75{ 74{
76 return m_on; 75 return m_on;
77} 76}
78 77
79QColor OLedBox::color ( ) const 78QColor OLedBox::color ( ) const
80{ 79{
81 return m_color; 80 return m_color;
82} 81}
83 82
84void OLedBox::setOn ( bool b ) 83void OLedBox::setOn ( bool b )
85{ 84{
86 if ( m_on != b ) { 85 if ( m_on != b ) {
87 m_on = b; 86 m_on = b;
88 update ( ); 87 update ( );
89 } 88 }
90} 89}
91 90
92void OLedBox::toggle ( ) 91void OLedBox::toggle ( )
93{ 92{
94 setOn ( !isOn ( ) ); 93 setOn ( !isOn ( ) );
95} 94}
96 95
97void OLedBox::setColor ( const QColor &col ) 96void OLedBox::setColor ( const QColor &col )
98{ 97{
99 if ( m_color != col ) { 98 if ( m_color != col ) {
100 m_color = col; 99 m_color = col;
101 100
102 delete m_pix [ 0 ]; 101 delete m_pix [ 0 ];
103 delete m_pix [ 1 ]; 102 delete m_pix [ 1 ];
104 103
105 update ( ); 104 update ( );
106 } 105 }
107} 106}
108 107
109void OLedBox::mousePressEvent ( QMouseEvent *e ) 108void OLedBox::mousePressEvent ( QMouseEvent *e )
110{ 109{
111 if ( e-> button ( ) == LeftButton ) { 110 if ( e-> button ( ) == LeftButton ) {
112 m_on = !m_on; 111 m_on = !m_on;
113 update ( ); 112 update ( );
114 emit toggled ( m_on ); 113 emit toggled ( m_on );
115 } 114 }
116} 115}
117 116
118 117
119void OLedBox::resizeEvent ( QResizeEvent * ) 118void OLedBox::resizeEvent ( QResizeEvent * )
120{ 119{
121 delete m_pix [ 0 ]; 120 delete m_pix [ 0 ];
122 delete m_pix [ 1 ]; 121 delete m_pix [ 1 ];
123 122
124 update ( ); 123 update ( );
125} 124}
126 125
127void OLedBox::paintEvent ( QPaintEvent *e ) 126void OLedBox::paintEvent ( QPaintEvent *e )
128{ 127{
129 int ind = m_on ? 1 : 0; 128 int ind = m_on ? 1 : 0;
130 129
131 if ( !m_pix [ ind ] ) { 130 if ( !m_pix [ ind ] ) {
132 m_pix [ ind ] = new QPixmap ( size ( )); 131 m_pix [ ind ] = new QPixmap ( size ( ));
133 132
134 drawLed ( m_pix [ ind ], m_on ? m_color : m_color. dark ( 300 ) ); 133 drawLed ( m_pix [ ind ], m_on ? m_color : m_color. dark ( 300 ) );
135 } 134 }
136 if ( !e-> erased ( )) 135 if ( !e-> erased ( ))
137 erase ( ); 136 erase ( );
138 137
139 QPainter p ( this ); 138 QPainter p ( this );
140 p. drawPixmap ( 0, 0, *m_pix [ ind ] ); 139 p. drawPixmap ( 0, 0, *m_pix [ ind ] );
141} 140}
142 141
143// From KDE libkdeui / led.cpp 142// From KDE libkdeui / led.cpp
144 143
145void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNKEN led lamp 144void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNKEN led lamp
146{ 145{
147 QPainter paint; 146 QPainter paint;
148 QColor color; 147 QColor color;
149 QBrush brush; 148 QBrush brush;
150 QPen pen; 149 QPen pen;
151 150
152 pix-> fill ( black ); 151 pix-> fill ( black );
153 152
154 // First of all we want to know what area should be updated 153 // First of all we want to know what area should be updated
155 // Initialize coordinates, width, and height of the LED 154 // Initialize coordinates, width, and height of the LED
156 int width = pix-> width ( ); 155 int width = pix-> width ( );
157 156
158 // Make sure the LED is round! 157 // Make sure the LED is round!
159 if ( width > pix-> height ( )) 158 if ( width > pix-> height ( ))
160 width = pix-> height ( ); 159 width = pix-> height ( );
161 width -= 2; // leave one pixel border 160 width -= 2; // leave one pixel border
162 if ( width < 0 ) 161 if ( width < 0 )
163 width = 0; 162 width = 0;
164 163
165 // maybe we could stop HERE, if width <=0 ? 164 // maybe we could stop HERE, if width <=0 ?
166 165
167 // start painting widget 166 // start painting widget
168 // 167 //
169 paint.begin( pix ); 168 paint.begin( pix );
170 169
171 // Set the color of the LED according to given parameters 170 // Set the color of the LED according to given parameters
172 color = col; 171 color = col;
173 172
174 // Set the brush to SolidPattern, this fills the entire area 173 // Set the brush to SolidPattern, this fills the entire area
175 // of the ellipse which is drawn first 174 // of the ellipse which is drawn first
176 brush.setStyle( QBrush::SolidPattern ); 175 brush.setStyle( QBrush::SolidPattern );
177 brush.setColor( color ); 176 brush.setColor( color );
178 paint.setBrush( brush ); // Assign the brush to the painter 177 paint.setBrush( brush ); // Assign the brush to the painter
179 178
180 // Draws a "flat" LED with the given color: 179 // Draws a "flat" LED with the given color:
181 paint.drawEllipse( 1, 1, width, width ); 180 paint.drawEllipse( 1, 1, width, width );
182 181
183 // Draw the bright light spot of the LED now, using modified "old" 182 // Draw the bright light spot of the LED now, using modified "old"
184 // painter routine taken from KDEUIs KLed widget: 183 // painter routine taken from KDEUIs KLed widget:
185 184
186 // Setting the new width of the pen is essential to avoid "pixelized" 185 // Setting the new width of the pen is essential to avoid "pixelized"
187 // shadow like it can be observed with the old LED code 186 // shadow like it can be observed with the old LED code
188 pen.setWidth( 2 ); 187 pen.setWidth( 2 );
189 188
190 // shrink the light on the LED to a size about 2/3 of the complete LED 189 // shrink the light on the LED to a size about 2/3 of the complete LED
191 int pos = width / 5 + 1; 190 int pos = width / 5 + 1;
192 int light_width = width; 191 int light_width = width;
193 light_width *= 2; 192 light_width *= 2;
194 light_width /= 3; 193 light_width /= 3;
195 194
196 // Calculate the LEDs "light factor": 195 // Calculate the LEDs "light factor":
197 int light_quote = ( 130 * 2 / ( light_width ? light_width : 1 ) ) + 100; 196 int light_quote = ( 130 * 2 / ( light_width ? light_width : 1 ) ) + 100;
198 197
199 // Now draw the bright spot on the LED: 198 // Now draw the bright spot on the LED:
200 while ( light_width ) 199 while ( light_width )
201 { 200 {
202 color = color.light( light_quote ); // make color lighter 201 color = color.light( light_quote ); // make color lighter
203 pen.setColor( color ); // set color as pen color 202 pen.setColor( color ); // set color as pen color
204 paint.setPen( pen ); // select the pen for drawing 203 paint.setPen( pen ); // select the pen for drawing
205 paint.drawEllipse( pos, pos, light_width, light_width ); // draw the ellipse (circle) 204 paint.drawEllipse( pos, pos, light_width, light_width ); // draw the ellipse (circle)
206 light_width--; 205 light_width--;
207 if ( !light_width ) 206 if ( !light_width )
208 break; 207 break;
209 paint.drawEllipse( pos, pos, light_width, light_width ); 208 paint.drawEllipse( pos, pos, light_width, light_width );
210 light_width--; 209 light_width--;
211 if ( !light_width ) 210 if ( !light_width )
212 break; 211 break;
213 paint.drawEllipse( pos, pos, light_width, light_width ); 212 paint.drawEllipse( pos, pos, light_width, light_width );
214 pos++; 213 pos++;
215 light_width--; 214 light_width--;
216 } 215 }
217 216
218 // Drawing of bright spot finished, now draw a thin border 217 // Drawing of bright spot finished, now draw a thin border
219 // around the LED which resembles a shadow with light coming 218 // around the LED which resembles a shadow with light coming
220 // from the upper left. 219 // from the upper left.
221 220
222#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC 221#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC
223 paint. drawPixmap ( 0, 0, *s_border_pix ); 222 paint. drawPixmap ( 0, 0, *s_border_pix );
224 paint. end ( ); 223 paint. end ( );
225 224
226 pix-> setMask ( pix-> createHeuristicMask ( )); 225 pix-> setMask ( pix-> createHeuristicMask ( ));
227 226
228#else 227#else
229 pen.setWidth( 3 ); 228 pen.setWidth( 3 );
230 brush.setStyle( QBrush::NoBrush ); // Switch off the brush 229 brush.setStyle( QBrush::NoBrush ); // Switch off the brush
231 paint.setBrush( brush ); // This avoids filling of the ellipse 230 paint.setBrush( brush ); // This avoids filling of the ellipse
232 231
233 // Set the initial color value to 200 (bright) and start 232 // Set the initial color value to 200 (bright) and start
234 // drawing the shadow border at 45 (45*16 = 720). 233 // drawing the shadow border at 45 (45*16 = 720).
235 int shadow_color = 200, angle; 234 int shadow_color = 200, angle;
236 235
237 for ( angle = 720; angle < 6480; angle += 240 ) 236 for ( angle = 720; angle < 6480; angle += 240 )
238 { 237 {
239 color.setRgb( shadow_color, shadow_color, shadow_color ); 238 color.setRgb( shadow_color, shadow_color, shadow_color );
240 pen.setColor( color ); 239 pen.setColor( color );
241 paint.setPen( pen ); 240 paint.setPen( pen );
242 paint.drawArc( 0, 0, width+2, width+2, angle, 240 ); 241 paint.drawArc( 0, 0, width+2, width+2, angle, 240 );
243 paint.drawArc( 1, 1, width, width, angle, 240 ); 242 paint.drawArc( 1, 1, width, width, angle, 240 );
244 paint.drawArc( 2, 2, width-2, width-2, angle, 240 ); 243 paint.drawArc( 2, 2, width-2, width-2, angle, 240 );
245 if ( angle < 2320 ) { 244 if ( angle < 2320 ) {
246 shadow_color -= 25; // set color to a darker value 245 shadow_color -= 25; // set color to a darker value
247 if ( shadow_color < 100 ) 246 if ( shadow_color < 100 )
248 shadow_color = 100; 247 shadow_color = 100;
249 } 248 }
250 else if ( ( angle > 2320 ) && ( angle < 5760 ) ) { 249 else if ( ( angle > 2320 ) && ( angle < 5760 ) ) {
251 shadow_color += 25; // set color to a brighter value 250 shadow_color += 25; // set color to a brighter value
252 if ( shadow_color > 255 ) 251 if ( shadow_color > 255 )
253 shadow_color = 255; 252 shadow_color = 255;
254 } 253 }
255 else { 254 else {
256 shadow_color -= 25; // set color to a darker value again 255 shadow_color -= 25; // set color to a darker value again
257 if ( shadow_color < 100 ) 256 if ( shadow_color < 100 )
258 shadow_color = 100; 257 shadow_color = 100;
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
index 38f827e..c736437 100644
--- a/core/applets/volumeapplet/volume.cpp
+++ b/core/applets/volumeapplet/volume.cpp
@@ -1,298 +1,294 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <stdio.h> 21#include <stdio.h>
22 22
23#include "volume.h" 23#include "volume.h"
24 24
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/qpeapplication.h>
27#include <qpe/applnk.h> 26#include <qpe/applnk.h>
28#include <qpe/config.h> 27#include <qpe/config.h>
29#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 28#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
30#include <qpe/qcopenvelope_qws.h> 29#include <qpe/qcopenvelope_qws.h>
31#endif 30#endif
32 31
33#include <qpainter.h> 32#include <qpainter.h>
34#include <qcheckbox.h> 33#include <qcheckbox.h>
35#include <qslider.h> 34#include <qslider.h>
36#include <qlayout.h> 35#include <qlayout.h>
37#include <qframe.h>
38#include <qpixmap.h>
39#include <qvbox.h> 36#include <qvbox.h>
40#include <qlabel.h> 37#include <qlabel.h>
41 38
42#include <qtoolbutton.h>
43#include <qpushbutton.h> 39#include <qpushbutton.h>
44#include <qtimer.h> 40#include <qtimer.h>
45 41
46#include <opie/odevice.h> 42#include <opie/odevice.h>
47 43
48#include "oledbox.h" 44#include "oledbox.h"
49 45
50using namespace Opie; 46using namespace Opie;
51 47
52#define RATE_TIMER_INTERVAL 100 48#define RATE_TIMER_INTERVAL 100
53// Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time 49// Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time
54// results in "hanging" buttons on the iPAQ due to quite high CPU consumption. 50// results in "hanging" buttons on the iPAQ due to quite high CPU consumption.
55 51
56 52
57/* XPM */ 53/* XPM */
58static const char * vol_xpm[] = { 54static const char * vol_xpm[] = {
59"20 20 3 1", 55"20 20 3 1",
60" c None", 56" c None",
61". c #0000FF", 57". c #0000FF",
62"+ c #000000", 58"+ c #000000",
63" ", 59" ",
64" . ", 60" . ",
65" . . . . ", 61" . . . . ",
66" . . . . . . ", 62" . . . . . . ",
67" . . . . . . . ", 63" . . . . . . . ",
68" . . ..... . . ", 64" . . ..... . . ",
69" . ... ..... ... ", 65" . ... ..... ... ",
70" ........... .... ", 66" ........... .... ",
71" ................. ", 67" ................. ",
72"++++++++++++++++++++", 68"++++++++++++++++++++",
73" .................. ", 69" .................. ",
74" . ............. . ", 70" . ............. . ",
75" . ..... ....... ", 71" . ..... ....... ",
76" . ... ..... . ", 72" . ... ..... . ",
77" . ... ..... . ", 73" . ... ..... . ",
78" . ... ..... ", 74" . ... ..... ",
79" . . . . . ", 75" . . . . . ",
80" . . . ", 76" . . . ",
81" . . . ", 77" . . . ",
82" "}; 78" "};
83/* XPM */ 79/* XPM */
84static const char * mic_xpm[] = { 80static const char * mic_xpm[] = {
85"20 20 21 1", 81"20 20 21 1",
86" c None", 82" c None",
87". c #000000", 83". c #000000",
88"+ c #EEEEEE", 84"+ c #EEEEEE",
89"@ c #B4B6B4", 85"@ c #B4B6B4",
90"# c #8B8D8B", 86"# c #8B8D8B",
91"$ c #D5D6D5", 87"$ c #D5D6D5",
92"% c #E6E6E6", 88"% c #E6E6E6",
93"& c #9C9D9C", 89"& c #9C9D9C",
94"* c #6A696A", 90"* c #6A696A",
95"= c #E6E2E6", 91"= c #E6E2E6",
96"- c #F6F2F6", 92"- c #F6F2F6",
97"; c #CDC6CD", 93"; c #CDC6CD",
98"> c #737573", 94"> c #737573",
99", c #4A484A", 95", c #4A484A",
100"' c #DEDEDE", 96"' c #DEDEDE",
101") c #F6EEF6", 97") c #F6EEF6",
102"! c #414041", 98"! c #414041",
103"~ c #202020", 99"~ c #202020",
104"{ c #ACAEAC", 100"{ c #ACAEAC",
105"] c #838583", 101"] c #838583",
106"^ c #6A656A", 102"^ c #6A656A",
107" ", 103" ",
108" .... ", 104" .... ",
109" .+@+#. ", 105" .+@+#. ",
110" ..$%&%*. ", 106" ..$%&%*. ",
111" .=-.;=>=,. ", 107" .=-.;=>=,. ",
112" .'+).&+!+. ", 108" .'+).&+!+. ",
113" .+;+;.~+~. ", 109" .+;+;.~+~. ",
114" ..%{%,.... ", 110" ..%{%,.... ",
115" ..&=>=~.. ", 111" ..&=>=~.. ",
116" .+..]^,.. ", 112" .+..]^,.. ",
117" .+....... ", 113" .+....... ",
118" .%... ", 114" .%... ",
119" .=... ", 115" .=... ",
120" .+... ", 116" .+... ",
121" .+... ", 117" .+... ",
122" .... ", 118" .... ",
123" .... ", 119" .... ",
124" .. ", 120" .. ",
125" . ", 121" . ",
126". "}; 122". "};
127 123
128 124
129static const char * bass_xpm[] = { 125static const char * bass_xpm[] = {
130"20 20 3 1", 126"20 20 3 1",
131" c None", 127" c None",
132". c #000000", 128". c #000000",
133"+ c #0000FF", 129"+ c #0000FF",
134" ", 130" ",
135" ", 131" ",
136" ", 132" ",
137"..... +++ ......", 133"..... +++ ......",
138" +++++++ ", 134" +++++++ ",
139" ++ ++ ", 135" ++ ++ ",
140"... ++ ... ++ ++ .", 136"... ++ ... ++ ++ .",
141" +++ ++ ++ ", 137" +++ ++ ++ ",
142" ++++ ++ ", 138" ++++ ++ ",
143"... ++++ .. ++ .....", 139"... ++++ .. ++ .....",
144" ++ ++ ", 140" ++ ++ ",
145" ++ ++ ", 141" ++ ++ ",
146"..........++ ++ .", 142"..........++ ++ .",
147" ++ ", 143" ++ ",
148" ++ ", 144" ++ ",
149"...... ++ .........", 145"...... ++ .........",
150" + ", 146" + ",
151" ", 147" ",
152" ", 148" ",
153" "}; 149" "};
154 150
155 151
156static const char * treble_xpm[] = { 152static const char * treble_xpm[] = {
157"20 20 3 1", 153"20 20 3 1",
158" c None", 154" c None",
159". c #0000FF", 155". c #0000FF",
160"+ c #000000", 156"+ c #000000",
161" .. ", 157" .. ",
162" . .. ", 158" . .. ",
163" . .. ", 159" . .. ",
164"++++++++ . .. ++++++", 160"++++++++ . .. ++++++",
165" . . ", 161" . . ",
166" ... ", 162" ... ",
167"++++++++ . +++++++", 163"++++++++ . +++++++",
168" .. ", 164" .. ",
169" .. . ", 165" .. . ",
170"+++ .. ... +++++++", 166"+++ .. ... +++++++",
171" .. .. .. ", 167" .. .. .. ",
172" .. . . .. ", 168" .. . . .. ",
173"+++ .. . . + . +++++", 169"+++ .. . . + . +++++",
174" .. . .. ", 170" .. . .. ",
175" .. . .. ", 171" .. . .. ",
176"++++ ...... +++++++", 172"++++ ...... +++++++",
177" . ", 173" . ",
178" .. . ", 174" .. . ",
179" .. . ", 175" .. . ",
180" .. "}; 176" .. "};
181 177
182 178
183 179
184 180
185/* XPM */ 181/* XPM */
186static const char * alarm_xpm[] = { 182static const char * alarm_xpm[] = {
187"20 20 33 1", 183"20 20 33 1",
188" c None", 184" c None",
189". c #080602", 185". c #080602",
190"+ c #AAA602", 186"+ c #AAA602",
191"@ c #252002", 187"@ c #252002",
192"# c #434202", 188"# c #434202",
193"$ c #795602", 189"$ c #795602",
194"% c #C3C20D", 190"% c #C3C20D",
195"& c #DADAC2", 191"& c #DADAC2",
196"* c #826002", 192"* c #826002",
197"= c #740502", 193"= c #740502",
198"- c #D6D602", 194"- c #D6D602",
199"; c #322E02", 195"; c #322E02",
200"> c #826A02", 196"> c #826A02",
201", c #F1F195", 197", c #F1F195",
202"' c #959215", 198"' c #959215",
203") c #423602", 199") c #423602",
204"! c #4B0302", 200"! c #4B0302",
205"~ c #844315", 201"~ c #844315",
206"{ c #AAAA2A", 202"{ c #AAAA2A",
207"] c #E2DE42", 203"] c #E2DE42",
208"^ c #BA7E04", 204"^ c #BA7E04",
209"/ c #7F7502", 205"/ c #7F7502",
210"( c #828276", 206"( c #828276",
211"_ c #FEFE4E", 207"_ c #FEFE4E",
212": c #7D1902", 208": c #7D1902",
213"< c #989656", 209"< c #989656",
214"[ c #260B02", 210"[ c #260B02",
215"} c #F7F7D8", 211"} c #F7F7D8",
216"| c #DCDA5A", 212"| c #DCDA5A",
217"1 c #823102", 213"1 c #823102",
218"2 c #B1AC6B", 214"2 c #B1AC6B",
219"3 c #F7F710", 215"3 c #F7F710",
220"4 c #838204", 216"4 c #838204",
221" ", 217" ",
222" ", 218" ",
223" 4'4/ ", 219" 4'4/ ",
224" /-^= ", 220" /-^= ",
225" 42{4>4 ", 221" 42{4>4 ",
226" '2|+*$44 ", 222" '2|+*$44 ",
227" +2&3+$1*44 ", 223" +2&3+$1*44 ",
228" (%_}_+/$:>/4 ", 224" (%_}_+/$:>/4 ",
229" 4%_}3+#;>:*4 ", 225" 4%_}3+#;>:*4 ",
230" 4%_}&+#[1$/4 ", 226" 4%_}&+#[1$/4 ",
231" 4%_,2')[~~>4 ", 227" 4%_,2')[~~>4 ",
232" 4%33'4#@~1>4 ", 228" 4%33'4#@~1>4 ",
233" 4%3344#[:>/4 ", 229" 4%3344#[:>/4 ",
234" 42&_3'4#@>:*44 ", 230" 42&_3'4#@>:*44 ",
235" 42|}}3'4#[;$)$44 ", 231" 42|}}3'4#[;$)$44 ",
236"444{]]2^~~:!!#.@##/ ", 232"444{]]2^~~:!!#.@##/ ",
237"4444-%*:==!!=...../ ", 233"4444-%*:==!!=...../ ",
238" /:[.. ", 234" /:[.. ",
239" /@. ", 235" /@. ",
240" "}; 236" "};
241 237
242VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *parent, const char *name ) 238VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *parent, const char *name )
243 : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup ) 239 : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup )
244{ 240{
245 m_icon = icon; 241 m_icon = icon;
246 242
247 bool has_wav_alarm = true; 243 bool has_wav_alarm = true;
248 bool has_bass = true; 244 bool has_bass = true;
249 bool has_treble = true; 245 bool has_treble = true;
250 246
251 switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually 247 switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually
252 case Model_Zaurus_SL5000: 248 case Model_Zaurus_SL5000:
253 has_wav_alarm = false; //poor guys probably feeling left out... 249 has_wav_alarm = false; //poor guys probably feeling left out...
254 break; 250 break;
255 default: 251 default:
256 break; 252 break;
257 } 253 }
258 254
259 if ( !ODevice::inst ( )-> series ( ) == Model_iPAQ ) { 255 if ( !ODevice::inst ( )-> series ( ) == Model_iPAQ ) {
260 has_bass = false; 256 has_bass = false;
261 has_treble = false; 257 has_treble = false;
262 } 258 }
263 259
264 260
265 setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); 261 setFrameStyle ( QFrame::PopupPanel | QFrame::Raised );
266 262
267 QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); 263 QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 );
268 grid-> setSpacing ( 4 ); 264 grid-> setSpacing ( 4 );
269 grid-> setMargin ( 6 ); 265 grid-> setMargin ( 6 );
270 266
271 QVBoxLayout *vbox; 267 QVBoxLayout *vbox;
272 QLabel *l; 268 QLabel *l;
273 269
274 vbox = new QVBoxLayout ( ); 270 vbox = new QVBoxLayout ( );
275 vbox-> setSpacing ( 4 ); 271 vbox-> setSpacing ( 4 );
276 grid-> addLayout ( vbox, 1, 0 ); 272 grid-> addLayout ( vbox, 1, 0 );
277 273
278 upButton = new QPushButton ( this ); 274 upButton = new QPushButton ( this );
279 upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); 275 upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding ));
280 upButton-> setPixmap ( Resource::loadPixmap ( "up" )); 276 upButton-> setPixmap ( Resource::loadPixmap ( "up" ));
281 upButton-> setFocusPolicy ( QWidget::NoFocus ); 277 upButton-> setFocusPolicy ( QWidget::NoFocus );
282 278
283 vbox-> addWidget ( upButton ); 279 vbox-> addWidget ( upButton );
284 280
285 downButton = new QPushButton ( this ); 281 downButton = new QPushButton ( this );
286 downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); 282 downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding ));
287 downButton-> setPixmap ( Resource::loadPixmap ( "down" )); 283 downButton-> setPixmap ( Resource::loadPixmap ( "down" ));
288 downButton-> setFocusPolicy ( QWidget::NoFocus ); 284 downButton-> setFocusPolicy ( QWidget::NoFocus );
289 285
290 vbox-> addWidget ( downButton ); 286 vbox-> addWidget ( downButton );
291 287
292 volSlider = new QSlider ( this ); 288 volSlider = new QSlider ( this );
293 volSlider-> setRange ( 0, 100 ); 289 volSlider-> setRange ( 0, 100 );
294 volSlider-> setTickmarks ( QSlider::Both ); 290 volSlider-> setTickmarks ( QSlider::Both );
295 volSlider-> setTickInterval ( 20 ); 291 volSlider-> setTickInterval ( 20 );
296 volSlider-> setFocusPolicy ( QWidget::NoFocus ); 292 volSlider-> setFocusPolicy ( QWidget::NoFocus );
297 293
298 l = new QLabel ( this ); 294 l = new QLabel ( this );
diff --git a/core/applets/volumeapplet/volumeappletimpl.cpp b/core/applets/volumeapplet/volumeappletimpl.cpp
index 4cbab31..9c7dea3 100644
--- a/core/applets/volumeapplet/volumeappletimpl.cpp
+++ b/core/applets/volumeapplet/volumeappletimpl.cpp
@@ -1,67 +1,65 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "volume.h" 20#include "volume.h"
21#include "volumeappletimpl.h" 21#include "volumeappletimpl.h"
22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/config.h>
24 22
25VolumeAppletImpl::VolumeAppletImpl() 23VolumeAppletImpl::VolumeAppletImpl()
26 : volume(0) 24 : volume(0)
27{ 25{
28} 26}
29 27
30VolumeAppletImpl::~VolumeAppletImpl() 28VolumeAppletImpl::~VolumeAppletImpl()
31{ 29{
32 delete volume; 30 delete volume;
33} 31}
34 32
35QWidget *VolumeAppletImpl::applet( QWidget *parent ) 33QWidget *VolumeAppletImpl::applet( QWidget *parent )
36{ 34{
37 if ( !volume ) 35 if ( !volume )
38 volume = new VolumeApplet( parent ); 36 volume = new VolumeApplet( parent );
39 return volume; 37 return volume;
40} 38}
41 39
42int VolumeAppletImpl::position() const 40int VolumeAppletImpl::position() const
43{ 41{
44 return 6; 42 return 6;
45} 43}
46 44
47QRESULT VolumeAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 45QRESULT VolumeAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
48{ 46{
49 *iface = 0; 47 *iface = 0;
50 if ( uuid == IID_QUnknown ) 48 if ( uuid == IID_QUnknown )
51 *iface = this; 49 *iface = this;
52 else if ( uuid == IID_TaskbarApplet ) 50 else if ( uuid == IID_TaskbarApplet )
53 *iface = this; 51 *iface = this;
54 else 52 else
55 return QS_FALSE; 53 return QS_FALSE;
56 54
57 if ( *iface ) 55 if ( *iface )
58 (*iface)->addRef(); 56 (*iface)->addRef();
59 return QS_OK; 57 return QS_OK;
60} 58}
61 59
62Q_EXPORT_INTERFACE() 60Q_EXPORT_INTERFACE()
63{ 61{
64 Q_CREATE_INSTANCE( VolumeAppletImpl ) 62 Q_CREATE_INSTANCE( VolumeAppletImpl )
65} 63}
66 64
67 65
diff --git a/core/applets/vtapplet/vt.cpp b/core/applets/vtapplet/vt.cpp
index 881eb41..bd39093 100644
--- a/core/applets/vtapplet/vt.cpp
+++ b/core/applets/vtapplet/vt.cpp
@@ -1,164 +1,161 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** Contact me @ mickeyl@handhelds.org 4** Contact me @ mickeyl@handhelds.org
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17#include <qpe/qcopenvelope_qws.h>
18 17
19#include <qapplication.h>
20#include <qiconset.h>
21#include <qpopupmenu.h> 18#include <qpopupmenu.h>
22 19
23#include <fcntl.h> 20#include <fcntl.h>
24#include <unistd.h> 21#include <unistd.h>
25#include <sys/types.h> 22#include <sys/types.h>
26#include <sys/stat.h> 23#include <sys/stat.h>
27#include <sys/ioctl.h> 24#include <sys/ioctl.h>
28#include <linux/vt.h> 25#include <linux/vt.h>
29 26
30#include "vt.h" 27#include "vt.h"
31 28
32VTApplet::VTApplet ( ) 29VTApplet::VTApplet ( )
33 : QObject ( 0, "VTApplet" ) 30 : QObject ( 0, "VTApplet" )
34{ 31{
35} 32}
36 33
37VTApplet::~VTApplet ( ) 34VTApplet::~VTApplet ( )
38{ 35{
39} 36}
40 37
41int VTApplet::position ( ) const 38int VTApplet::position ( ) const
42{ 39{
43 return 2; 40 return 2;
44} 41}
45 42
46QString VTApplet::name ( ) const 43QString VTApplet::name ( ) const
47{ 44{
48 return tr( "VT shortcut" ); 45 return tr( "VT shortcut" );
49} 46}
50 47
51QString VTApplet::text ( ) const 48QString VTApplet::text ( ) const
52{ 49{
53 return tr( "Terminal" ); 50 return tr( "Terminal" );
54} 51}
55 52
56/* 53/*
57QString VTApplet::tr( const char* s ) const 54QString VTApplet::tr( const char* s ) const
58{ 55{
59 return qApp->translate( "VTApplet", s, 0 ); 56 return qApp->translate( "VTApplet", s, 0 );
60} 57}
61 58
62QString VTApplet::tr( const char* s, const char* p ) const 59QString VTApplet::tr( const char* s, const char* p ) const
63{ 60{
64 return qApp->translate( "VTApplet", s, p ); 61 return qApp->translate( "VTApplet", s, p );
65} 62}
66*/ 63*/
67 64
68QIconSet VTApplet::icon ( ) const 65QIconSet VTApplet::icon ( ) const
69{ 66{
70 QPixmap pix; 67 QPixmap pix;
71 QImage img = Resource::loadImage ( "terminal" ); 68 QImage img = Resource::loadImage ( "terminal" );
72 69
73 if ( !img. isNull ( )) 70 if ( !img. isNull ( ))
74 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 71 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
75 return pix; 72 return pix;
76} 73}
77 74
78QPopupMenu *VTApplet::popup ( QWidget* parent ) const 75QPopupMenu *VTApplet::popup ( QWidget* parent ) const
79{ 76{
80 qDebug( "VTApplet::popup" ); 77 qDebug( "VTApplet::popup" );
81 78
82 struct vt_stat vtstat; 79 struct vt_stat vtstat;
83 int fd = ::open( "/dev/tty0", O_RDWR ); 80 int fd = ::open( "/dev/tty0", O_RDWR );
84 if ( fd == -1 ) return 0; 81 if ( fd == -1 ) return 0;
85 if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0; 82 if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0;
86 83
87 m_subMenu = new QPopupMenu( parent ); 84 m_subMenu = new QPopupMenu( parent );
88 m_subMenu->setCheckable( true ); 85 m_subMenu->setCheckable( true );
89 for ( int i = 1; i < 10; ++i ) 86 for ( int i = 1; i < 10; ++i )
90 { 87 {
91 int id = m_subMenu->insertItem( QString::number( i ), 500+i ); 88 int id = m_subMenu->insertItem( QString::number( i ), 500+i );
92 m_subMenu->setItemChecked( id, id-500 == vtstat.v_active ); 89 m_subMenu->setItemChecked( id, id-500 == vtstat.v_active );
93 } 90 }
94 ::close( fd ); 91 ::close( fd );
95 92
96 connect( m_subMenu, SIGNAL( activated(int) ), this, SLOT( changeVT(int) ) ); 93 connect( m_subMenu, SIGNAL( activated(int) ), this, SLOT( changeVT(int) ) );
97 connect( m_subMenu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) ); 94 connect( m_subMenu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) );
98 95
99 return m_subMenu; 96 return m_subMenu;
100} 97}
101 98
102 99
103void VTApplet::changeVT( int index ) 100void VTApplet::changeVT( int index )
104{ 101{
105 //qDebug( "VTApplet::changeVT( %d )", index-500 ); 102 //qDebug( "VTApplet::changeVT( %d )", index-500 );
106 103
107 int fd = ::open("/dev/tty0", O_RDWR); 104 int fd = ::open("/dev/tty0", O_RDWR);
108 if ( fd == -1 ) return; 105 if ( fd == -1 ) return;
109 ioctl( fd, VT_ACTIVATE, index-500 ); 106 ioctl( fd, VT_ACTIVATE, index-500 );
110} 107}
111 108
112 109
113void VTApplet::updateMenu() 110void VTApplet::updateMenu()
114{ 111{
115 //qDebug( "VTApplet::updateMenu()" ); 112 //qDebug( "VTApplet::updateMenu()" );
116 113
117 int fd = ::open( "/dev/console", O_RDONLY ); 114 int fd = ::open( "/dev/console", O_RDONLY );
118 if ( fd == -1 ) return; 115 if ( fd == -1 ) return;
119 116
120 for ( int i = 1; i < 10; ++i ) 117 for ( int i = 1; i < 10; ++i )
121 { 118 {
122 int result = ioctl( fd, VT_DISALLOCATE, i ); 119 int result = ioctl( fd, VT_DISALLOCATE, i );
123 120
124 /* 121 /*
125 if ( result == -1 ) 122 if ( result == -1 )
126 qDebug( "VT %d disallocated == free", i ); 123 qDebug( "VT %d disallocated == free", i );
127 else 124 else
128 qDebug( "VT %d _not_ disallocated == busy", i ); 125 qDebug( "VT %d _not_ disallocated == busy", i );
129 */ 126 */
130 127
131 m_subMenu->setItemEnabled( 500+i, result == -1 ); 128 m_subMenu->setItemEnabled( 500+i, result == -1 );
132 } 129 }
133 130
134 ::close( fd ); 131 ::close( fd );
135} 132}
136 133
137 134
138void VTApplet::activated() 135void VTApplet::activated()
139{ 136{
140 qDebug( "VTApplet::activated()" ); 137 qDebug( "VTApplet::activated()" );
141} 138}
142 139
143 140
144QRESULT VTApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 141QRESULT VTApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
145{ 142{
146 *iface = 0; 143 *iface = 0;
147 if ( uuid == IID_QUnknown ) 144 if ( uuid == IID_QUnknown )
148 *iface = this; 145 *iface = this;
149 else if ( uuid == IID_MenuApplet ) 146 else if ( uuid == IID_MenuApplet )
150 *iface = this; 147 *iface = this;
151 else 148 else
152 return QS_FALSE; 149 return QS_FALSE;
153 150
154 if ( *iface ) 151 if ( *iface )
155 (*iface)-> addRef ( ); 152 (*iface)-> addRef ( );
156 return QS_OK; 153 return QS_OK;
157} 154}
158 155
159Q_EXPORT_INTERFACE( ) 156Q_EXPORT_INTERFACE( )
160{ 157{
161 Q_CREATE_INSTANCE( VTApplet ) 158 Q_CREATE_INSTANCE( VTApplet )
162} 159}
163 160
164 161
diff --git a/core/apps/calibrate/main.cpp b/core/apps/calibrate/main.cpp
index ec9b5ec..0da0fe0 100644
--- a/core/apps/calibrate/main.cpp
+++ b/core/apps/calibrate/main.cpp
@@ -1,47 +1,46 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "calibrate.h" 21#include "calibrate.h"
22 22
23#include <qfile.h>
24#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
25 24
26#ifdef QWS 25#ifdef QWS
27#include <qwindowsystem_qws.h> 26#include <qwindowsystem_qws.h>
28#endif 27#endif
29 28
30int main( int argc, char ** argv ) 29int main( int argc, char ** argv )
31{ 30{
32 QPEApplication a( argc, argv ); 31 QPEApplication a( argc, argv );
33 int retval = 0; 32 int retval = 0;
34 33
35#ifdef QWS 34#ifdef QWS
36 if ( QWSServer::mouseHandler() && 35 if ( QWSServer::mouseHandler() &&
37 QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { 36 QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) {
38#endif 37#endif
39 // Make sure calibration widget starts on top. 38 // Make sure calibration widget starts on top.
40 Calibrate cal; 39 Calibrate cal;
41 a.setMainWidget(&cal); 40 a.setMainWidget(&cal);
42 a.showMainWidget(&cal); 41 a.showMainWidget(&cal);
43 return a.exec(); 42 return a.exec();
44#ifdef QWS 43#ifdef QWS
45 } 44 }
46#endif 45#endif
47} 46}
diff --git a/core/obex/obex.cc b/core/obex/obex.cc
index 2a306de..50e5201 100644
--- a/core/obex/obex.cc
+++ b/core/obex/obex.cc
@@ -1,203 +1,199 @@
1 1
2#include <qapplication.h>
3#include <qfile.h>
4#include <qfileinfo.h> 2#include <qfileinfo.h>
5#include <qtextcodec.h>
6 3
7#include <qpe/qcopenvelope_qws.h>
8 4
9#include <opie/oprocess.h> 5#include <opie/oprocess.h>
10#include "obex.h" 6#include "obex.h"
11 7
12using namespace OpieObex; 8using namespace OpieObex;
13 9
14/* TRANSLATOR OpieObex::Obex */ 10/* TRANSLATOR OpieObex::Obex */
15 11
16Obex::Obex( QObject *parent, const char* name ) 12Obex::Obex( QObject *parent, const char* name )
17 : QObject(parent, name ) 13 : QObject(parent, name )
18{ 14{
19 m_rec = 0; 15 m_rec = 0;
20 m_send=0; 16 m_send=0;
21 m_count = 0; 17 m_count = 0;
22 m_receive = false; 18 m_receive = false;
23 connect( this, SIGNAL(error(int) ), // for recovering to receive 19 connect( this, SIGNAL(error(int) ), // for recovering to receive
24 SLOT(slotError() ) ); 20 SLOT(slotError() ) );
25 connect( this, SIGNAL(sent(bool) ), 21 connect( this, SIGNAL(sent(bool) ),
26 SLOT(slotError() ) ); 22 SLOT(slotError() ) );
27}; 23};
28Obex::~Obex() { 24Obex::~Obex() {
29 delete m_rec; 25 delete m_rec;
30 delete m_send; 26 delete m_send;
31} 27}
32void Obex::receive() { 28void Obex::receive() {
33 m_receive = true; 29 m_receive = true;
34 m_outp = QString::null; 30 m_outp = QString::null;
35 qWarning("Receive" ); 31 qWarning("Receive" );
36 m_rec = new OProcess(); 32 m_rec = new OProcess();
37 *m_rec << "irobex_palm3"; 33 *m_rec << "irobex_palm3";
38 // connect to the necessary slots 34 // connect to the necessary slots
39 connect(m_rec, SIGNAL(processExited(OProcess*) ), 35 connect(m_rec, SIGNAL(processExited(OProcess*) ),
40 this, SLOT(slotExited(OProcess*) ) ); 36 this, SLOT(slotExited(OProcess*) ) );
41 37
42 connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ), 38 connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
43 this, SLOT(slotStdOut(OProcess*, char*, int) ) ); 39 this, SLOT(slotStdOut(OProcess*, char*, int) ) );
44 40
45 if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 41 if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
46 qWarning("could not start :("); 42 qWarning("could not start :(");
47 emit done( false ); 43 emit done( false );
48 delete m_rec; 44 delete m_rec;
49 m_rec = 0; 45 m_rec = 0;
50 } 46 }
51// emit currentTry(m_count ); 47// emit currentTry(m_count );
52 48
53} 49}
54void Obex::send( const QString& fileName) { // if currently receiving stop it send receive 50void Obex::send( const QString& fileName) { // if currently receiving stop it send receive
55 m_count = 0; 51 m_count = 0;
56 m_file = fileName; 52 m_file = fileName;
57 qWarning("send %s", fileName.latin1() ); 53 qWarning("send %s", fileName.latin1() );
58 if (m_rec != 0 ) { 54 if (m_rec != 0 ) {
59 qWarning("running"); 55 qWarning("running");
60 if (m_rec->isRunning() ) { 56 if (m_rec->isRunning() ) {
61 emit error(-1 ); 57 emit error(-1 );
62 qWarning("is running"); 58 qWarning("is running");
63 delete m_rec; 59 delete m_rec;
64 m_rec = 0; 60 m_rec = 0;
65 61
66 }else{ 62 }else{
67 qWarning("is not running"); 63 qWarning("is not running");
68 emit error( -1 ); // we did not delete yet but it's not running slotExited is pending 64 emit error( -1 ); // we did not delete yet but it's not running slotExited is pending
69 return; 65 return;
70 } 66 }
71 } 67 }
72 sendNow(); 68 sendNow();
73} 69}
74void Obex::sendNow(){ 70void Obex::sendNow(){
75 qWarning("sendNow"); 71 qWarning("sendNow");
76 if ( m_count >= 25 ) { // could not send 72 if ( m_count >= 25 ) { // could not send
77 emit error(-1 ); 73 emit error(-1 );
78 emit sent(false); 74 emit sent(false);
79 return; 75 return;
80 } 76 }
81 // OProcess inititialisation 77 // OProcess inititialisation
82 m_send = new OProcess(); 78 m_send = new OProcess();
83 *m_send << "irobex_palm3"; 79 *m_send << "irobex_palm3";
84 *m_send << QFile::encodeName(m_file); 80 *m_send << QFile::encodeName(m_file);
85 81
86 // connect to slots Exited and and StdOut 82 // connect to slots Exited and and StdOut
87 connect(m_send, SIGNAL(processExited(OProcess*) ), 83 connect(m_send, SIGNAL(processExited(OProcess*) ),
88 this, SLOT(slotExited(OProcess*)) ); 84 this, SLOT(slotExited(OProcess*)) );
89 connect(m_send, SIGNAL(receivedStdout(OProcess*, char*, int )), 85 connect(m_send, SIGNAL(receivedStdout(OProcess*, char*, int )),
90 this, SLOT(slotStdOut(OProcess*, char*, int) ) ); 86 this, SLOT(slotStdOut(OProcess*, char*, int) ) );
91 87
92 // now start it 88 // now start it
93 if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) { 89 if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) {
94 qWarning("could not send" ); 90 qWarning("could not send" );
95 m_count = 25; 91 m_count = 25;
96 emit error(-1 ); 92 emit error(-1 );
97 delete m_send; 93 delete m_send;
98 m_send=0; 94 m_send=0;
99 } 95 }
100 // end 96 // end
101 m_count++; 97 m_count++;
102 emit currentTry( m_count ); 98 emit currentTry( m_count );
103} 99}
104 100
105void Obex::slotExited(OProcess* proc ){ 101void Obex::slotExited(OProcess* proc ){
106 if (proc == m_rec ) { // receive process 102 if (proc == m_rec ) { // receive process
107 received(); 103 received();
108 }else if ( proc == m_send ) { 104 }else if ( proc == m_send ) {
109 sendEnd(); 105 sendEnd();
110 } 106 }
111} 107}
112void Obex::slotStdOut(OProcess* proc, char* buf, int len){ 108void Obex::slotStdOut(OProcess* proc, char* buf, int len){
113 if ( proc == m_rec ) { // only receive 109 if ( proc == m_rec ) { // only receive
114 QByteArray ar( len ); 110 QByteArray ar( len );
115 memcpy( ar.data(), buf, len ); 111 memcpy( ar.data(), buf, len );
116 qWarning("parsed: %s", ar.data() ); 112 qWarning("parsed: %s", ar.data() );
117 m_outp.append( ar ); 113 m_outp.append( ar );
118 } 114 }
119} 115}
120 116
121void Obex::received() { 117void Obex::received() {
122 if (m_rec->normalExit() ) { 118 if (m_rec->normalExit() ) {
123 if ( m_rec->exitStatus() == 0 ) { // we got one 119 if ( m_rec->exitStatus() == 0 ) { // we got one
124 QString filename = parseOut(); 120 QString filename = parseOut();
125 qWarning("ACHTUNG %s", filename.latin1() ); 121 qWarning("ACHTUNG %s", filename.latin1() );
126 emit receivedFile( filename ); 122 emit receivedFile( filename );
127 } 123 }
128 }else{ 124 }else{
129 emit done(false); 125 emit done(false);
130 }; 126 };
131 delete m_rec; 127 delete m_rec;
132 m_rec = 0; 128 m_rec = 0;
133 receive(); 129 receive();
134} 130}
135 131
136void Obex::sendEnd() { 132void Obex::sendEnd() {
137 if (m_send->normalExit() ) { 133 if (m_send->normalExit() ) {
138 if ( m_send->exitStatus() == 0 ) { 134 if ( m_send->exitStatus() == 0 ) {
139 delete m_send; 135 delete m_send;
140 m_send=0; 136 m_send=0;
141 qWarning("done" ); 137 qWarning("done" );
142 emit sent(true); 138 emit sent(true);
143 }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready 139 }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready
144 // let's try it again 140 // let's try it again
145 delete m_send; 141 delete m_send;
146 m_send = 0; 142 m_send = 0;
147 qWarning("try sending again" ); 143 qWarning("try sending again" );
148 sendNow(); 144 sendNow();
149 } 145 }
150 }else { 146 }else {
151 emit error( -1 ); 147 emit error( -1 );
152 delete m_send; 148 delete m_send;
153 m_send = 0; 149 m_send = 0;
154 } 150 }
155} 151}
156QString Obex::parseOut( ){ 152QString Obex::parseOut( ){
157 QString path; 153 QString path;
158 QStringList list = QStringList::split("\n", m_outp); 154 QStringList list = QStringList::split("\n", m_outp);
159 QStringList::Iterator it; 155 QStringList::Iterator it;
160 for (it = list.begin(); it != list.end(); ++it ) { 156 for (it = list.begin(); it != list.end(); ++it ) {
161 if ( (*it).startsWith("Wrote" ) ) { 157 if ( (*it).startsWith("Wrote" ) ) {
162 int pos = (*it).findRev('(' ); 158 int pos = (*it).findRev('(' );
163 if ( pos > 0 ) { 159 if ( pos > 0 ) {
164 qWarning( "%d %s", pos, (*it).mid(6 ).latin1() ) ; 160 qWarning( "%d %s", pos, (*it).mid(6 ).latin1() ) ;
165 qWarning("%d %d", (*it).length(), (*it).length()-pos ); 161 qWarning("%d %d", (*it).length(), (*it).length()-pos );
166 162
167 path = (*it).remove( pos, (*it).length() - pos ); 163 path = (*it).remove( pos, (*it).length() - pos );
168 qWarning("%s", path.latin1() ); 164 qWarning("%s", path.latin1() );
169 path = path.mid(6 ); 165 path = path.mid(6 );
170 path = path.stripWhiteSpace(); 166 path = path.stripWhiteSpace();
171 qWarning("path %s", path.latin1() ); 167 qWarning("path %s", path.latin1() );
172 } 168 }
173 } 169 }
174 } 170 }
175 return path; 171 return path;
176} 172}
177/** 173/**
178 * when sent is done slotError is called we will start receive again 174 * when sent is done slotError is called we will start receive again
179 */ 175 */
180void Obex::slotError() { 176void Obex::slotError() {
181 qWarning("slotError"); 177 qWarning("slotError");
182 if ( m_receive ) 178 if ( m_receive )
183 receive(); 179 receive();
184}; 180};
185void Obex::setReceiveEnabled( bool receive ) { 181void Obex::setReceiveEnabled( bool receive ) {
186 if ( !receive ) { // 182 if ( !receive ) { //
187 m_receive = false; 183 m_receive = false;
188 shutDownReceive(); 184 shutDownReceive();
189 } 185 }
190} 186}
191 187
192void Obex::shutDownReceive() { 188void Obex::shutDownReceive() {
193 if (m_rec != 0 ) { 189 if (m_rec != 0 ) {
194 qWarning("running"); 190 qWarning("running");
195 if (m_rec->isRunning() ) { 191 if (m_rec->isRunning() ) {
196 emit error(-1 ); 192 emit error(-1 );
197 qWarning("is running"); 193 qWarning("is running");
198 delete m_rec; 194 delete m_rec;
199 m_rec = 0; 195 m_rec = 0;
200 } 196 }
201 } 197 }
202 198
203} 199}
diff --git a/core/obex/obexhandler.cpp b/core/obex/obexhandler.cpp
index c237555..4034560 100644
--- a/core/obex/obexhandler.cpp
+++ b/core/obex/obexhandler.cpp
@@ -1,68 +1,67 @@
1#include <qcopchannel_qws.h>
2 1
3#include <qpe/qcopenvelope_qws.h> 2#include <qpe/qcopenvelope_qws.h>
4#include <qpe/qpeapplication.h> 3#include <qpe/qpeapplication.h>
5 4
6#include "obexsend.h" 5#include "obexsend.h"
7#include "receiver.h" 6#include "receiver.h"
8#include "obexhandler.h" 7#include "obexhandler.h"
9 8
10using namespace OpieObex; 9using namespace OpieObex;
11 10
12/* TRANSLATOR OpieObex::ObexHandler */ 11/* TRANSLATOR OpieObex::ObexHandler */
13 12
14ObexHandler::ObexHandler() { 13ObexHandler::ObexHandler() {
15 m_wasRec = false; 14 m_wasRec = false;
16 m_sender = 0l; 15 m_sender = 0l;
17 m_receiver = 0l; 16 m_receiver = 0l;
18 QCopChannel* chan = new QCopChannel("QPE/Obex"); 17 QCopChannel* chan = new QCopChannel("QPE/Obex");
19 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 18 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
20 this, SLOT(irdaMessage(const QCString&, const QByteArray& ) ) ); 19 this, SLOT(irdaMessage(const QCString&, const QByteArray& ) ) );
21} 20}
22ObexHandler::~ObexHandler() { 21ObexHandler::~ObexHandler() {
23 delete m_sender; 22 delete m_sender;
24 delete m_receiver; 23 delete m_receiver;
25} 24}
26void ObexHandler::doSend(const QString& str, const QString& desc) { 25void ObexHandler::doSend(const QString& str, const QString& desc) {
27 delete m_sender; 26 delete m_sender;
28 m_sender = new SendWidget; 27 m_sender = new SendWidget;
29 m_sender->raise(); 28 m_sender->raise();
30 QPEApplication::showWidget( m_sender ); 29 QPEApplication::showWidget( m_sender );
31 connect(m_sender, SIGNAL(done() ), 30 connect(m_sender, SIGNAL(done() ),
32 this, SLOT(slotSent() ) ); 31 this, SLOT(slotSent() ) );
33 m_sender->send( str, desc ); 32 m_sender->send( str, desc );
34} 33}
35void ObexHandler::doReceive(bool b) { 34void ObexHandler::doReceive(bool b) {
36 if (m_receiver && b ) return; // we should enable receiver and it is on 35 if (m_receiver && b ) return; // we should enable receiver and it is on
37 else if (!m_receiver && !b ) return; // we should disbale receiver and it is off 36 else if (!m_receiver && !b ) return; // we should disbale receiver and it is off
38 else if (m_receiver && !b ) { 37 else if (m_receiver && !b ) {
39 delete m_receiver; 38 delete m_receiver;
40 m_receiver=0; 39 m_receiver=0;
41 }else if (!m_receiver && b ) { 40 }else if (!m_receiver && b ) {
42 m_receiver= new Receiver; 41 m_receiver= new Receiver;
43 } 42 }
44} 43}
45void ObexHandler::slotSent() { 44void ObexHandler::slotSent() {
46 QString file = m_sender->file(); 45 QString file = m_sender->file();
47 delete m_sender; 46 delete m_sender;
48 m_sender = 0; 47 m_sender = 0;
49 QCopEnvelope e ("QPE/Obex", "done(QString)" ); 48 QCopEnvelope e ("QPE/Obex", "done(QString)" );
50 e << file; 49 e << file;
51 doReceive(m_wasRec ); 50 doReceive(m_wasRec );
52 m_wasRec = false; 51 m_wasRec = false;
53} 52}
54void ObexHandler::irdaMessage( const QCString& msg, const QByteArray& data) { 53void ObexHandler::irdaMessage( const QCString& msg, const QByteArray& data) {
55 QDataStream stream( data, IO_ReadOnly ); 54 QDataStream stream( data, IO_ReadOnly );
56 if ( msg == "send(QString,QString,QString)" ) { 55 if ( msg == "send(QString,QString,QString)" ) {
57 QString name, desc; 56 QString name, desc;
58 stream >> desc; 57 stream >> desc;
59 stream >> name; 58 stream >> name;
60 m_wasRec = (m_receiver != 0 ); 59 m_wasRec = (m_receiver != 0 );
61 doReceive( false ); 60 doReceive( false );
62 doSend(name, desc); 61 doSend(name, desc);
63 }else if (msg == "receive(int)") { 62 }else if (msg == "receive(int)") {
64 int rec; 63 int rec;
65 stream >> rec; 64 stream >> rec;
66 doReceive(rec); 65 doReceive(rec);
67 } 66 }
68} 67}
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index cf5d958..6b8d467 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -1,266 +1,262 @@
1#include <qpushbutton.h> 1#include <qpushbutton.h>
2#include <qlabel.h> 2#include <qlabel.h>
3#include <qhbox.h>
4#include <qlayout.h> 3#include <qlayout.h>
5#include <qtimer.h> 4#include <qtimer.h>
6#include <qtl.h>
7 5
8#include <qcopchannel_qws.h>
9 6
10#include <qpe/resource.h>
11#include <qpe/qcopenvelope_qws.h> 7#include <qpe/qcopenvelope_qws.h>
12 8
13#include "obex.h" 9#include "obex.h"
14#include "obexsend.h" 10#include "obexsend.h"
15 11
16using namespace OpieObex; 12using namespace OpieObex;
17 13
18/* TRANSLATOR OpieObex::SendWidget */ 14/* TRANSLATOR OpieObex::SendWidget */
19 15
20 16
21SendWidget::SendWidget( QWidget* parent, const char* name ) 17SendWidget::SendWidget( QWidget* parent, const char* name )
22 : QWidget( parent, name ) { 18 : QWidget( parent, name ) {
23 initUI(); 19 initUI();
24} 20}
25SendWidget::~SendWidget() { 21SendWidget::~SendWidget() {
26} 22}
27void SendWidget::initUI() { 23void SendWidget::initUI() {
28 m_obex = new Obex(this, "obex"); 24 m_obex = new Obex(this, "obex");
29 connect(m_obex, SIGNAL(error(int) ), 25 connect(m_obex, SIGNAL(error(int) ),
30 this, SLOT(slotIrError(int) ) ); 26 this, SLOT(slotIrError(int) ) );
31 connect(m_obex, SIGNAL(sent(bool) ), 27 connect(m_obex, SIGNAL(sent(bool) ),
32 this, SLOT(slotIrSent(bool) ) ); 28 this, SLOT(slotIrSent(bool) ) );
33 connect(m_obex, SIGNAL(currentTry(unsigned int ) ), 29 connect(m_obex, SIGNAL(currentTry(unsigned int ) ),
34 this, SLOT(slotIrTry(unsigned int ) ) ); 30 this, SLOT(slotIrTry(unsigned int ) ) );
35 31
36 QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this ); 32 QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this );
37 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 33 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
38 this, SLOT(dispatchIrda(const QCString&, const QByteArray& ) ) ); 34 this, SLOT(dispatchIrda(const QCString&, const QByteArray& ) ) );
39 35
40 chan = new QCopChannel("QPE/BluetoothBack", this ); 36 chan = new QCopChannel("QPE/BluetoothBack", this );
41 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 37 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
42 this, SLOT(dispatchBt(const QCString&, const QByteArray& ) ) ); 38 this, SLOT(dispatchBt(const QCString&, const QByteArray& ) ) );
43 39
44 QVBoxLayout* lay = new QVBoxLayout(this); 40 QVBoxLayout* lay = new QVBoxLayout(this);
45 41
46 QHBox* nameBox = new QHBox(this); 42 QHBox* nameBox = new QHBox(this);
47 QLabel* name = new QLabel(nameBox); 43 QLabel* name = new QLabel(nameBox);
48 name->setText( tr("<qt><h1>Sending:</h1></qt>") ); 44 name->setText( tr("<qt><h1>Sending:</h1></qt>") );
49 name->setAlignment( AlignLeft | AlignTop ); 45 name->setAlignment( AlignLeft | AlignTop );
50 m_lblFile = new QLabel(nameBox); 46 m_lblFile = new QLabel(nameBox);
51 lay->addWidget(nameBox, 0); 47 lay->addWidget(nameBox, 0);
52 48
53 QFrame* frame = new QFrame(this); 49 QFrame* frame = new QFrame(this);
54 frame->setFrameShape( QFrame::HLine ); 50 frame->setFrameShape( QFrame::HLine );
55 frame->setFrameShadow( QFrame::Sunken ); 51 frame->setFrameShadow( QFrame::Sunken );
56 lay->addWidget(frame, 10); 52 lay->addWidget(frame, 10);
57 53
58 QLabel* devices = new QLabel(this); 54 QLabel* devices = new QLabel(this);
59 devices->setText("<qt><b>Devices:</b></qt>"); 55 devices->setText("<qt><b>Devices:</b></qt>");
60 devices->setAlignment( AlignLeft | AlignTop ); 56 devices->setAlignment( AlignLeft | AlignTop );
61 lay->addWidget( devices,10 ); 57 lay->addWidget( devices,10 );
62 58
63 m_devBox = new DeviceBox(this); 59 m_devBox = new DeviceBox(this);
64 lay->addWidget( m_devBox, 50 ); 60 lay->addWidget( m_devBox, 50 );
65 connect(m_devBox, SIGNAL(selectedDevice(int, int ) ), 61 connect(m_devBox, SIGNAL(selectedDevice(int, int ) ),
66 this, SLOT(slotSelectedDevice(int, int) ) ); 62 this, SLOT(slotSelectedDevice(int, int) ) );
67 63
68 QPushButton *but = new QPushButton(this); 64 QPushButton *but = new QPushButton(this);
69 but->setText(tr("Done") ); 65 but->setText(tr("Done") );
70 connect(but, SIGNAL(clicked() ), 66 connect(but, SIGNAL(clicked() ),
71 this, SLOT(slotDone() ) ); 67 this, SLOT(slotDone() ) );
72 68
73 lay->addWidget( but ); 69 lay->addWidget( but );
74 m_lay = lay; 70 m_lay = lay;
75 71
76 // QT does not like if you add items to an layout which already exits.... 72 // QT does not like if you add items to an layout which already exits....
77 // and was layouted invalidate() does not help too 73 // and was layouted invalidate() does not help too
78 // so we use RichText.... 74 // so we use RichText....
79} 75}
80 76
81/* 77/*
82 * in send we'll first set everything up 78 * in send we'll first set everything up
83 * and then wait for a list of devices. 79 * and then wait for a list of devices.
84 */ 80 */
85void SendWidget::send( const QString& file, const QString& desc ) { 81void SendWidget::send( const QString& file, const QString& desc ) {
86 m_file = file; 82 m_file = file;
87 m_irDa.clear(); 83 m_irDa.clear();
88 m_start = 0; 84 m_start = 0;
89 m_lblFile->setText(desc.isEmpty() ? file : desc ); 85 m_lblFile->setText(desc.isEmpty() ? file : desc );
90 86
91 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) { 87 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) {
92 m_irDeSearch = m_devBox->addDevice( tr("IrDa is not enabled!"), DeviceBox::Error ); 88 m_irDeSearch = m_devBox->addDevice( tr("IrDa is not enabled!"), DeviceBox::Error );
93 m_start++; 89 m_start++;
94 }else 90 }else
95 m_irDeSearch = m_devBox->addDevice( tr("Searching for IrDa Devices."), DeviceBox::Search ); 91 m_irDeSearch = m_devBox->addDevice( tr("Searching for IrDa Devices."), DeviceBox::Search );
96 92
97 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) { 93 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) {
98 m_btDeSearch = m_devBox->addDevice( tr("Bluetooth is not available"), DeviceBox::Error ); 94 m_btDeSearch = m_devBox->addDevice( tr("Bluetooth is not available"), DeviceBox::Error );
99 m_start++; 95 m_start++;
100 }else 96 }else
101 m_btDeSearch = m_devBox->addDevice( tr("Searching for bluetooth Devices."), DeviceBox::Search ); 97 m_btDeSearch = m_devBox->addDevice( tr("Searching for bluetooth Devices."), DeviceBox::Search );
102 98
103 if (m_start != 2 ) { 99 if (m_start != 2 ) {
104 QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()"); 100 QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()");
105 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); 101 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()");
106 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 102 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
107 QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); 103 QCopEnvelope e3("QPE/Bluetooth", "listDevices()");
108 } 104 }
109} 105}
110void SendWidget::slotIrDaDevices( const QStringList& list) { 106void SendWidget::slotIrDaDevices( const QStringList& list) {
111 qWarning("slot it irda devices "); 107 qWarning("slot it irda devices ");
112 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { 108 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) {
113 int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") ); 109 int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") );
114 m_irDa.insert( id, (*it) ); 110 m_irDa.insert( id, (*it) );
115 } 111 }
116 m_devBox->removeDevice( m_irDeSearch ); 112 m_devBox->removeDevice( m_irDeSearch );
117 m_irDaIt = m_irDa.begin(); 113 m_irDaIt = m_irDa.begin();
118 114
119 slotStartIrda(); 115 slotStartIrda();
120} 116}
121 117
122void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) { 118void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) {
123 for(QMap<QString, QString>::ConstIterator it = str.begin(); it != str.end(); ++it ) { 119 for(QMap<QString, QString>::ConstIterator it = str.begin(); it != str.end(); ++it ) {
124 int id = m_devBox->addDevice( it.key(), DeviceBox::BT, tr("Click to beam") ); 120 int id = m_devBox->addDevice( it.key(), DeviceBox::BT, tr("Click to beam") );
125 m_bt.insert( id, Pair( it.key(), it.data() ) ); 121 m_bt.insert( id, Pair( it.key(), it.data() ) );
126 } 122 }
127 m_devBox->removeDevice( m_btDeSearch ); 123 m_devBox->removeDevice( m_btDeSearch );
128} 124}
129void SendWidget::slotSelectedDevice( int name, int dev ) { 125void SendWidget::slotSelectedDevice( int name, int dev ) {
130 qWarning("Start beam? %d %d", name, dev ); 126 qWarning("Start beam? %d %d", name, dev );
131 if ( name == m_irDeSearch ) { 127 if ( name == m_irDeSearch ) {
132 for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it ) 128 for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it )
133 m_devBox->removeDevice( it.key() ); 129 m_devBox->removeDevice( it.key() );
134 130
135 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 131 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
136 } 132 }
137} 133}
138void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) { 134void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) {
139 qWarning("dispatch irda %s", str.data() ); 135 qWarning("dispatch irda %s", str.data() );
140 if ( str == "devices(QStringList)" ) { 136 if ( str == "devices(QStringList)" ) {
141 QDataStream stream( ar, IO_ReadOnly ); 137 QDataStream stream( ar, IO_ReadOnly );
142 QStringList list; 138 QStringList list;
143 stream >> list; 139 stream >> list;
144 slotIrDaDevices( list ); 140 slotIrDaDevices( list );
145 } 141 }
146} 142}
147void SendWidget::dispatchBt( const QCString&, const QByteArray& ) { 143void SendWidget::dispatchBt( const QCString&, const QByteArray& ) {
148 144
149} 145}
150void SendWidget::slotIrError( int ) { 146void SendWidget::slotIrError( int ) {
151 147
152} 148}
153void SendWidget::slotIrSent( bool b) { 149void SendWidget::slotIrSent( bool b) {
154 qWarning("irda sent!!"); 150 qWarning("irda sent!!");
155 QString text = b ? tr("Sent") : tr("Failure"); 151 QString text = b ? tr("Sent") : tr("Failure");
156 m_devBox->setStatus( m_irDaIt.key(), text ); 152 m_devBox->setStatus( m_irDaIt.key(), text );
157 ++m_irDaIt; 153 ++m_irDaIt;
158 slotStartIrda(); 154 slotStartIrda();
159} 155}
160void SendWidget::slotIrTry(unsigned int trI) { 156void SendWidget::slotIrTry(unsigned int trI) {
161 m_devBox->setStatus( m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) ) ); 157 m_devBox->setStatus( m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) ) );
162} 158}
163void SendWidget::slotStartIrda() { 159void SendWidget::slotStartIrda() {
164 if (m_irDaIt == m_irDa.end() ) { 160 if (m_irDaIt == m_irDa.end() ) {
165 m_irDeSearch = m_devBox->addDevice(tr("Search again for IrDa."), DeviceBox::Search ); 161 m_irDeSearch = m_devBox->addDevice(tr("Search again for IrDa."), DeviceBox::Search );
166 return; 162 return;
167 } 163 }
168 m_devBox->setStatus( m_irDaIt.key(), tr("Start sending") ); 164 m_devBox->setStatus( m_irDaIt.key(), tr("Start sending") );
169 m_obex->send( m_file ); 165 m_obex->send( m_file );
170} 166}
171void SendWidget::closeEvent( QCloseEvent* e) { 167void SendWidget::closeEvent( QCloseEvent* e) {
172 e->accept(); // make sure 168 e->accept(); // make sure
173 QTimer::singleShot(0, this, SLOT(slotDone() ) ); 169 QTimer::singleShot(0, this, SLOT(slotDone() ) );
174} 170}
175void SendWidget::slotDone() { 171void SendWidget::slotDone() {
176 QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()"); 172 QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()");
177 QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()"); 173 QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()");
178 emit done(); 174 emit done();
179} 175}
180QString SendWidget::file()const { 176QString SendWidget::file()const {
181 return m_file; 177 return m_file;
182} 178}
183DeviceBox::DeviceBox( QWidget* parent ) 179DeviceBox::DeviceBox( QWidget* parent )
184 : QTextBrowser( parent ) { 180 : QTextBrowser( parent ) {
185 181
186} 182}
187DeviceBox::~DeviceBox() { 183DeviceBox::~DeviceBox() {
188 184
189} 185}
190int DeviceBox::addDevice( const QString& name, int dev, const QString& status ) { 186int DeviceBox::addDevice( const QString& name, int dev, const QString& status ) {
191 /* return a id for a range of devices */ 187 /* return a id for a range of devices */
192 int id = idFor ( dev ); 188 int id = idFor ( dev );
193 DeviceItem item( name, status, dev,id ); 189 DeviceItem item( name, status, dev,id );
194 m_dev.insert( id, item ); 190 m_dev.insert( id, item );
195 setText( allText() ); 191 setText( allText() );
196 192
197 return id; 193 return id;
198} 194}
199void DeviceBox::removeDevice( int id ) { 195void DeviceBox::removeDevice( int id ) {
200 if (!m_dev.contains(id) ) return; 196 if (!m_dev.contains(id) ) return;
201 197
202 m_dev.remove( id ); 198 m_dev.remove( id );
203 setText( allText() ); 199 setText( allText() );
204} 200}
205void DeviceBox::setStatus( int id, const QString& status ) { 201void DeviceBox::setStatus( int id, const QString& status ) {
206 if ( !m_dev.contains(id) ) return; 202 if ( !m_dev.contains(id) ) return;
207 m_dev[id].setStatus(status ); 203 m_dev[id].setStatus(status );
208 setText( allText() ); 204 setText( allText() );
209} 205}
210void DeviceBox::setSource( const QString& str ) { 206void DeviceBox::setSource( const QString& str ) {
211 qWarning("SetSource:%d", str.toInt() ); 207 qWarning("SetSource:%d", str.toInt() );
212 int id = str.toInt(); 208 int id = str.toInt();
213 emit selectedDevice( id, m_dev[id].device() ); 209 emit selectedDevice( id, m_dev[id].device() );
214} 210}
215int DeviceBox::idFor ( int id ) { 211int DeviceBox::idFor ( int id ) {
216 static int irId = 1501; 212 static int irId = 1501;
217 static int irBT = 1001; 213 static int irBT = 1001;
218 static int irSr = 501; 214 static int irSr = 501;
219 static int irEr = 0; 215 static int irEr = 0;
220 216
221 int ret = -1; 217 int ret = -1;
222 switch(id ) { 218 switch(id ) {
223 case IrDa: 219 case IrDa:
224 ret = irId; 220 ret = irId;
225 irId++; 221 irId++;
226 break; 222 break;
227 case BT: 223 case BT:
228 ret = irBT; 224 ret = irBT;
229 irBT++; 225 irBT++;
230 break; 226 break;
231 case Search: 227 case Search:
232 ret = irSr; 228 ret = irSr;
233 irSr++; 229 irSr++;
234 break; 230 break;
235 case Error: 231 case Error:
236 ret = irEr; 232 ret = irEr;
237 irEr++; 233 irEr++;
238 break; 234 break;
239 } 235 }
240 return ret; 236 return ret;
241} 237}
242QString DeviceBox::allText() { 238QString DeviceBox::allText() {
243 QString str; 239 QString str;
244 typedef QMap<int, DeviceItem> DeviceMap; 240 typedef QMap<int, DeviceItem> DeviceMap;
245 241
246 for (QMap<int, DeviceItem>::Iterator it = m_dev.begin(); it != m_dev.end(); ++it ) { 242 for (QMap<int, DeviceItem>::Iterator it = m_dev.begin(); it != m_dev.end(); ++it ) {
247 str += it.data().toString() + "<br>"; 243 str += it.data().toString() + "<br>";
248 } 244 }
249 return str; 245 return str;
250} 246}
251 247
252DeviceItem::DeviceItem( const QString& name, 248DeviceItem::DeviceItem( const QString& name,
253 const QString& status, int dev, int id) 249 const QString& status, int dev, int id)
254{ 250{
255 m_name = name; 251 m_name = name;
256 m_status = status; 252 m_status = status;
257 m_dev = dev; 253 m_dev = dev;
258 m_id = id; 254 m_id = id;
259} 255}
260int DeviceItem::id()const { 256int DeviceItem::id()const {
261 return m_id; 257 return m_id;
262} 258}
263QString DeviceItem::name()const { 259QString DeviceItem::name()const {
264 return m_name; 260 return m_name;
265} 261}
266QString DeviceItem::status()const { 262QString DeviceItem::status()const {
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp
index bf9e30c..7d9f7ec 100644
--- a/core/obex/receiver.cpp
+++ b/core/obex/receiver.cpp
@@ -1,203 +1,199 @@
1#include <sys/types.h> 1#include <sys/types.h>
2#include <sys/stat.h> 2#include <sys/stat.h>
3#include <sys/mman.h> 3#include <sys/mman.h>
4#include <stdlib.h> // int system 4#include <stdlib.h> // int system
5#include <unistd.h> 5#include <unistd.h>
6 6
7#include <fcntl.h> 7#include <fcntl.h>
8 8
9#include <qfile.h>
10#include <qfileinfo.h> 9#include <qfileinfo.h>
11#include <qlabel.h> 10#include <qlabel.h>
12#include <qhbox.h>
13#include <qregexp.h>
14#include <qtextview.h> 11#include <qtextview.h>
15#include <qpushbutton.h> 12#include <qpushbutton.h>
16 13
17#include <qpe/applnk.h> 14#include <qpe/applnk.h>
18#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
19#include <qpe/qcopenvelope_qws.h> 16#include <qpe/qcopenvelope_qws.h>
20#include <qpe/global.h>
21 17
22#include "obex.h" 18#include "obex.h"
23#include "receiver.h" 19#include "receiver.h"
24 20
25using namespace OpieObex; 21using namespace OpieObex;
26 22
27/* TRANSLATOR OpieObex::Receiver */ 23/* TRANSLATOR OpieObex::Receiver */
28 24
29Receiver::Receiver() { 25Receiver::Receiver() {
30 m_obex = new Obex(this, "Receiver"); 26 m_obex = new Obex(this, "Receiver");
31 connect(m_obex, SIGNAL(receivedFile(const QString& ) ), 27 connect(m_obex, SIGNAL(receivedFile(const QString& ) ),
32 this, SLOT(slotReceived(const QString& ) ) ); 28 this, SLOT(slotReceived(const QString& ) ) );
33 m_obex->receive(); 29 m_obex->receive();
34} 30}
35Receiver::~Receiver() { 31Receiver::~Receiver() {
36 m_obex->setReceiveEnabled( false ); 32 m_obex->setReceiveEnabled( false );
37 delete m_obex; 33 delete m_obex;
38} 34}
39void Receiver::slotReceived( const QString& _file ) { 35void Receiver::slotReceived( const QString& _file ) {
40 QString file = _file; 36 QString file = _file;
41 int check = checkFile(file); 37 int check = checkFile(file);
42 if ( check == AddressBook ) 38 if ( check == AddressBook )
43 handleAddr( file ); 39 handleAddr( file );
44 else if ( check == Datebook ) 40 else if ( check == Datebook )
45 handleDateTodo( file ); 41 handleDateTodo( file );
46 else 42 else
47 handleOther( file ); 43 handleOther( file );
48} 44}
49void Receiver::handleAddr( const QString& str ) { 45void Receiver::handleAddr( const QString& str ) {
50 QCopEnvelope e("QPE/Application/addressbook", "setDocument(QString)" ); 46 QCopEnvelope e("QPE/Application/addressbook", "setDocument(QString)" );
51 e << str; 47 e << str;
52} 48}
53/* we can not say for sure if it's a VEevent ot VTodo */ 49/* we can not say for sure if it's a VEevent ot VTodo */
54void Receiver::handleDateTodo( const QString& str ) { 50void Receiver::handleDateTodo( const QString& str ) {
55 QCopEnvelope e0("QPE/Application/todolist", "setDocument(QString)"); 51 QCopEnvelope e0("QPE/Application/todolist", "setDocument(QString)");
56 e0 << str; 52 e0 << str;
57 QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" ); 53 QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" );
58 e1 << str; 54 e1 << str;
59} 55}
60/* 56/*
61 * Handle other asks if it should accept the 57 * Handle other asks if it should accept the
62 * beamed object and creates a DocLnk 58 * beamed object and creates a DocLnk
63 */ 59 */
64void Receiver::handleOther( const QString& other ) { 60void Receiver::handleOther( const QString& other ) {
65 OtherHandler* hand = new OtherHandler(); 61 OtherHandler* hand = new OtherHandler();
66 hand->handle( other ); 62 hand->handle( other );
67} 63}
68void Receiver::tidyUp( QString& _file, const QString& ending) { 64void Receiver::tidyUp( QString& _file, const QString& ending) {
69 /* libversit fails on BASE64 encoding we try to sed it away */ 65 /* libversit fails on BASE64 encoding we try to sed it away */
70 QString file = _file; 66 QString file = _file;
71 char foo[24]; // big enough 67 char foo[24]; // big enough
72 (void)::strcpy(foo, "/tmp/opie-XXXXXX"); 68 (void)::strcpy(foo, "/tmp/opie-XXXXXX");
73 69
74 int fd = ::mkstemp(foo); 70 int fd = ::mkstemp(foo);
75 71
76 if ( fd == -1 ) 72 if ( fd == -1 )
77 return; 73 return;
78 74
79 (void)::strncat( foo, ending.latin1(), 4 ); 75 (void)::strncat( foo, ending.latin1(), 4 );
80 _file = QString::fromLatin1( foo ); 76 _file = QString::fromLatin1( foo );
81 QString cmd = QString("sed -e \"s/^\\(X-MICROSOFT-BODYINK\\)\\;/\\1:/;\" < %2 > %2 ").arg( Global::shellQuote(file)).arg( Global::shellQuote(_file) ); 77 QString cmd = QString("sed -e \"s/^\\(X-MICROSOFT-BODYINK\\)\\;/\\1:/;\" < %2 > %2 ").arg( Global::shellQuote(file)).arg( Global::shellQuote(_file) );
82 qWarning("Executing: %s", cmd.latin1() ); 78 qWarning("Executing: %s", cmd.latin1() );
83 (void)::system( cmd.latin1() ); 79 (void)::system( cmd.latin1() );
84 80
85 cmd = QString("rm %1").arg( Global::shellQuote(file) ); 81 cmd = QString("rm %1").arg( Global::shellQuote(file) );
86 (void)::system( cmd.latin1() ); 82 (void)::system( cmd.latin1() );
87} 83}
88int Receiver::checkFile( QString& file ) { 84int Receiver::checkFile( QString& file ) {
89 qWarning("check file!! %s", file.latin1() ); 85 qWarning("check file!! %s", file.latin1() );
90 int ret; 86 int ret;
91 QString ending; 87 QString ending;
92 88
93 if (file.right(4) == ".vcs" ) { 89 if (file.right(4) == ".vcs" ) {
94 ret = Datebook; 90 ret = Datebook;
95 ending = QString::fromLatin1(".vcs"); 91 ending = QString::fromLatin1(".vcs");
96 }else if ( file.right(4) == ".vcf") { 92 }else if ( file.right(4) == ".vcf") {
97 ret = AddressBook; 93 ret = AddressBook;
98 ending = QString::fromLatin1(".vcf"); 94 ending = QString::fromLatin1(".vcf");
99 }else 95 }else
100 ret = Other; 96 ret = Other;
101 97
102 98
103 if (ending.isEmpty() ) 99 if (ending.isEmpty() )
104 return ret; 100 return ret;
105 101
106 /** 102 /**
107 * currently the parser is broken in regard of BASE64 encoding 103 * currently the parser is broken in regard of BASE64 encoding
108 * and M$ likes to send that. So we will executed a small 104 * and M$ likes to send that. So we will executed a small
109 * tidy up system sed script 105 * tidy up system sed script
110 * At this point we can also remove umlaute from the filename 106 * At this point we can also remove umlaute from the filename
111 */ 107 */
112 tidyUp( file, ending ); 108 tidyUp( file, ending );
113 109
114 qWarning("check it now %d", ret ); 110 qWarning("check it now %d", ret );
115 return ret; 111 return ret;
116} 112}
117 113
118/* TRANSLATOR OpieObex::OtherHandler */ 114/* TRANSLATOR OpieObex::OtherHandler */
119 115
120OtherHandler::OtherHandler() 116OtherHandler::OtherHandler()
121 : QVBox() 117 : QVBox()
122{ 118{
123 QHBox* box = new QHBox(this); 119 QHBox* box = new QHBox(this);
124 QLabel* lbl = new QLabel(box); 120 QLabel* lbl = new QLabel(box);
125 lbl->setText(tr("<qt><b>Received:</b></qt>")); 121 lbl->setText(tr("<qt><b>Received:</b></qt>"));
126 m_na = new QLabel(box); 122 m_na = new QLabel(box);
127 123
128 QFrame* frame = new QFrame(this); 124 QFrame* frame = new QFrame(this);
129 frame->setFrameShape( QFrame::HLine ); 125 frame->setFrameShape( QFrame::HLine );
130 frame->setFrameShadow( QFrame::Sunken ); 126 frame->setFrameShadow( QFrame::Sunken );
131 127
132 m_view = new QTextView(this); 128 m_view = new QTextView(this);
133 129
134 box = new QHBox(this); 130 box = new QHBox(this);
135 QPushButton *but = new QPushButton(box); 131 QPushButton *but = new QPushButton(box);
136 but->setText(tr("Accept") ); 132 but->setText(tr("Accept") );
137 connect(but, SIGNAL(clicked() ), 133 connect(but, SIGNAL(clicked() ),
138 this, SLOT(accept()) ); 134 this, SLOT(accept()) );
139 135
140 but = new QPushButton(box); 136 but = new QPushButton(box);
141 but->setText(tr("Deny") ); 137 but->setText(tr("Deny") );
142 connect(but, SIGNAL(clicked() ), 138 connect(but, SIGNAL(clicked() ),
143 this, SLOT(deny() ) ); 139 this, SLOT(deny() ) );
144 140
145 raise(); 141 raise();
146 showMaximized(); 142 showMaximized();
147} 143}
148OtherHandler::~OtherHandler() { 144OtherHandler::~OtherHandler() {
149 145
150} 146}
151void OtherHandler::handle( const QString& file ) { 147void OtherHandler::handle( const QString& file ) {
152 m_file = file; 148 m_file = file;
153 m_na->setText(file); 149 m_na->setText(file);
154 DocLnk lnk(file); 150 DocLnk lnk(file);
155 qWarning(" %s %s", lnk.type().latin1(), lnk.icon().latin1() ); 151 qWarning(" %s %s", lnk.type().latin1(), lnk.icon().latin1() );
156 152
157 QString str = tr("<p>You received a file of type %1 (<img src=\"%2\"> )What do you want to do?").arg(lnk.type() ).arg(lnk.icon() ); 153 QString str = tr("<p>You received a file of type %1 (<img src=\"%2\"> )What do you want to do?").arg(lnk.type() ).arg(lnk.icon() );
158 m_view->setText( str ); 154 m_view->setText( str );
159} 155}
160 156
161/* 157/*
162 * hehe evil evil mmap ahead :) 158 * hehe evil evil mmap ahead :)
163 * we quickly copy the file and then we'll create a DocLnk for it 159 * we quickly copy the file and then we'll create a DocLnk for it
164 */ 160 */
165void OtherHandler::accept() { 161void OtherHandler::accept() {
166 QString na = targetName( m_file ); 162 QString na = targetName( m_file );
167 copy(m_file, na ); 163 copy(m_file, na );
168 DocLnk lnk(na); 164 DocLnk lnk(na);
169 lnk.writeLink(); 165 lnk.writeLink();
170 QFile::remove(m_file); 166 QFile::remove(m_file);
171 delete this; 167 delete this;
172} 168}
173void OtherHandler::deny() { 169void OtherHandler::deny() {
174 QFile::remove( m_file ); 170 QFile::remove( m_file );
175 delete this; 171 delete this;
176} 172}
177QString OtherHandler::targetName( const QString& file ) { 173QString OtherHandler::targetName( const QString& file ) {
178 QFileInfo info( file ); 174 QFileInfo info( file );
179 175
180 /* $HOME needs to be set!!!! */ 176 /* $HOME needs to be set!!!! */
181 Global::createDocDir(); 177 Global::createDocDir();
182 178
183 QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName(); 179 QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName();
184 QString newFileBase = newFile; 180 QString newFileBase = newFile;
185 181
186 int trie = 0; 182 int trie = 0;
187 while (QFile::exists(newFile + "."+info.extension() ) ) { 183 while (QFile::exists(newFile + "."+info.extension() ) ) {
188 newFile = newFileBase + "_"+QString::number(trie) ; 184 newFile = newFileBase + "_"+QString::number(trie) ;
189 trie++; 185 trie++;
190 } 186 }
191 newFile += "." + info.extension(); 187 newFile += "." + info.extension();
192 188
193 return newFile; 189 return newFile;
194} 190}
195 191
196/* fast cpy */ 192/* fast cpy */
197void OtherHandler::copy(const QString& src, const QString& file) { 193void OtherHandler::copy(const QString& src, const QString& file) {
198 qWarning("src %s, dest %s", src.latin1(),file.latin1() ); 194 qWarning("src %s, dest %s", src.latin1(),file.latin1() );
199 QString cmd = QString("mv %1 %2").arg( Global::shellQuote( src )). 195 QString cmd = QString("mv %1 %2").arg( Global::shellQuote( src )).
200 arg( Global::shellQuote( file ) ); 196 arg( Global::shellQuote( file ) );
201 ::system( cmd.latin1() ); 197 ::system( cmd.latin1() );
202 // done 198 // done
203} 199}