summaryrefslogtreecommitdiff
path: root/core/applets
authoralwin <alwin>2004-03-02 12:14:15 (UTC)
committer alwin <alwin>2004-03-02 12:14:15 (UTC)
commit0d59c780513da78033f4d9040475dee9db0256d4 (patch) (unidiff)
tree503d320b4aa3daae9982082e7b34e3e2c48bdfb7 /core/applets
parenta0981652d61776d70f25980f035748b21339e946 (diff)
downloadopie-0d59c780513da78033f4d9040475dee9db0256d4.zip
opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.gz
opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.bz2
run the optimize_connect script
the whole cvs is tagged with "before_optimize_connect" if there are problems you can check the diff (but it had compiled and run here)
Diffstat (limited to 'core/applets') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/cardmon/cardmon.cpp8
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp8
-rw-r--r--core/applets/clockapplet/clock.cpp6
-rw-r--r--core/applets/irdaapplet/irda.cpp4
-rw-r--r--core/applets/multikeyapplet/multikey.cpp4
-rw-r--r--core/applets/rotateapplet/rotate.cpp4
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp6
-rw-r--r--core/applets/vmemo/vmemo.cpp4
-rw-r--r--core/applets/volumeapplet/volume.cpp36
9 files changed, 40 insertions, 40 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp
index 7625545..e8072c6 100644
--- a/core/applets/cardmon/cardmon.cpp
+++ b/core/applets/cardmon/cardmon.cpp
@@ -1,157 +1,157 @@
1/* 1/*
2* cardmon.cpp 2* cardmon.cpp
3* 3*
4* --------------------- 4* ---------------------
5* 5*
6* copyright : (c) 2002 by Maximilian Reiss 6* copyright : (c) 2002 by Maximilian Reiss
7* email : max.reiss@gmx.de 7* email : max.reiss@gmx.de
8* based on two apps by Devin Butterfield 8* based on two apps by Devin Butterfield
9*/ 9*/
10/*************************************************************************** 10/***************************************************************************
11 * * 11 * *
12 * This program is free software; you can redistribute it and/or modify * 12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by * 13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or * 14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. * 15 * (at your option) any later version. *
16 * * 16 * *
17 ***************************************************************************/ 17 ***************************************************************************/
18 18
19#include "cardmon.h" 19#include "cardmon.h"
20 20
21/* OPIE */ 21/* OPIE */
22#include <opie2/odevice.h> 22#include <opie2/odevice.h>
23#include <opie2/otaskbarapplet.h> 23#include <opie2/otaskbarapplet.h>
24#include <qpe/applnk.h> 24#include <qpe/applnk.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26 26
27/* QT */ 27/* QT */
28#include <qcopchannel_qws.h> 28#include <qcopchannel_qws.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qtextstream.h> 31#include <qtextstream.h>
32#include <qsound.h> 32#include <qsound.h>
33#include <qtimer.h> 33#include <qtimer.h>
34 34
35/* STD */ 35/* STD */
36#include <stdio.h> 36#include <stdio.h>
37#include <unistd.h> 37#include <unistd.h>
38#include <stdlib.h> 38#include <stdlib.h>
39#include <string.h> 39#include <string.h>
40#include <fcntl.h> 40#include <fcntl.h>
41 41
42#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 42#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
43#include <sys/vfs.h> 43#include <sys/vfs.h>
44#include <mntent.h> 44#include <mntent.h>
45#endif 45#endif
46 46
47using namespace Opie; 47using namespace Opie;
48 48
49CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ), 49CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ),
50 pm( Resource::loadPixmap( "cardmon/pcmcia" ) ) 50 pm( Resource::loadPixmap( "cardmon/pcmcia" ) )
51{ 51{
52 52
53 QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); 53 QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this );
54 connect( pcmciaChannel, 54 connect( pcmciaChannel,
55 SIGNAL( received( const QCString &, const QByteArray & ) ), this, 55 SIGNAL( received(const QCString&,const QByteArray&) ), this,
56 SLOT( cardMessage( const QCString &, const QByteArray & ) ) ); 56 SLOT( cardMessage(const QCString&,const QByteArray&) ) );
57 57
58 QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this ); 58 QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this );
59 connect( sdChannel, 59 connect( sdChannel,
60 SIGNAL( received( const QCString &, const QByteArray & ) ), this, 60 SIGNAL( received(const QCString&,const QByteArray&) ), this,
61 SLOT( cardMessage( const QCString &, const QByteArray & ) ) ); 61 SLOT( cardMessage(const QCString&,const QByteArray&) ) );
62 62
63 cardInPcmcia0 = FALSE; 63 cardInPcmcia0 = FALSE;
64 cardInPcmcia1 = FALSE; 64 cardInPcmcia1 = FALSE;
65 cardInSd = FALSE; 65 cardInSd = FALSE;
66 66
67 setFocusPolicy( NoFocus ); 67 setFocusPolicy( NoFocus );
68 68
69 setFixedWidth ( AppLnk::smallIconSize() ); 69 setFixedWidth ( AppLnk::smallIconSize() );
70 setFixedHeight ( AppLnk::smallIconSize() ); 70 setFixedHeight ( AppLnk::smallIconSize() );
71 71
72 getStatusPcmcia( TRUE ); 72 getStatusPcmcia( TRUE );
73 getStatusSd( TRUE ); 73 getStatusSd( TRUE );
74 repaint( FALSE ); 74 repaint( FALSE );
75 popupMenu = 0; 75 popupMenu = 0;
76} 76}
77 77
78CardMonitor::~CardMonitor() 78CardMonitor::~CardMonitor()
79{ 79{
80 if ( popupMenu ) 80 if ( popupMenu )
81 { 81 {
82 delete popupMenu; 82 delete popupMenu;
83 } 83 }
84} 84}
85 85
86void CardMonitor::popUp( QString message, QString icon ) 86void CardMonitor::popUp( QString message, QString icon )
87{ 87{
88 if ( !popupMenu ) 88 if ( !popupMenu )
89 { 89 {
90 popupMenu = new QPopupMenu( this ); 90 popupMenu = new QPopupMenu( this );
91 } 91 }
92 92
93 popupMenu->clear(); 93 popupMenu->clear();
94 if ( icon.isEmpty() ) 94 if ( icon.isEmpty() )
95 { 95 {
96 popupMenu->insertItem( message, 0 ); 96 popupMenu->insertItem( message, 0 );
97 } 97 }
98 else 98 else
99 { 99 {
100 popupMenu->insertItem( QIconSet( Resource::loadPixmap( icon ) ), 100 popupMenu->insertItem( QIconSet( Resource::loadPixmap( icon ) ),
101 message, 0 ); 101 message, 0 );
102 } 102 }
103 103
104 QPoint p = mapToGlobal( QPoint( 0, 0 ) ); 104 QPoint p = mapToGlobal( QPoint( 0, 0 ) );
105 QSize s = popupMenu->sizeHint(); 105 QSize s = popupMenu->sizeHint();
106 popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), 106 popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ),
107 p.y() - s.height() ), 0 ); 107 p.y() - s.height() ), 0 );
108 108
109 QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); 109 QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) );
110} 110}
111 111
112void CardMonitor::popupTimeout() 112void CardMonitor::popupTimeout()
113{ 113{
114 popupMenu->hide(); 114 popupMenu->hide();
115} 115}
116 116
117void CardMonitor::mousePressEvent( QMouseEvent * ) 117void CardMonitor::mousePressEvent( QMouseEvent * )
118{ 118{
119 QPopupMenu * menu = new QPopupMenu( this ); 119 QPopupMenu * menu = new QPopupMenu( this );
120 QString cmd; 120 QString cmd;
121 int err = 0; 121 int err = 0;
122 122
123 if ( cardInSd ) 123 if ( cardInSd )
124 { 124 {
125 menu->insertItem( QIconSet( Resource::loadPixmap( "cardmon/ide" ) ), 125 menu->insertItem( QIconSet( Resource::loadPixmap( "cardmon/ide" ) ),
126 tr( "Eject SD/MMC card" ), 0 ); 126 tr( "Eject SD/MMC card" ), 0 );
127 } 127 }
128 128
129 if ( cardInPcmcia0 ) 129 if ( cardInPcmcia0 )
130 { 130 {
131 menu-> 131 menu->
132 insertItem( QIconSet 132 insertItem( QIconSet
133 ( Resource::loadPixmap( "cardmon/" + cardInPcmcia0Type ) ), 133 ( Resource::loadPixmap( "cardmon/" + cardInPcmcia0Type ) ),
134 tr( "Eject card 0: %1" ).arg( cardInPcmcia0Name ), 1 ); 134 tr( "Eject card 0: %1" ).arg( cardInPcmcia0Name ), 1 );
135 } 135 }
136 136
137 if ( cardInPcmcia1 ) 137 if ( cardInPcmcia1 )
138 { 138 {
139 menu-> 139 menu->
140 insertItem( QIconSet 140 insertItem( QIconSet
141 ( Resource::loadPixmap( "cardmon/" + cardInPcmcia1Type ) ), 141 ( Resource::loadPixmap( "cardmon/" + cardInPcmcia1Type ) ),
142 tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 ); 142 tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 );
143 } 143 }
144 144
145 QPoint p = mapToGlobal( QPoint( 0, 0 ) ); 145 QPoint p = mapToGlobal( QPoint( 0, 0 ) );
146 QSize s = menu->sizeHint(); 146 QSize s = menu->sizeHint();
147 int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), 147 int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ),
148 p.y() - s.height() ), 0 ); 148 p.y() - s.height() ), 0 );
149 149
150 if ( opt == 1 ) 150 if ( opt == 1 )
151 { 151 {
152 cmd = "/sbin/cardctl eject 0"; 152 cmd = "/sbin/cardctl eject 0";
153 err = system( ( const char * ) cmd ); 153 err = system( ( const char * ) cmd );
154 if ( err != 0 ) 154 if ( err != 0 )
155 { 155 {
156 qDebug( "Could not execute `/sbin/cardctl eject 0'! err=%d", 156 qDebug( "Could not execute `/sbin/cardctl eject 0'! err=%d",
157 err ); 157 err );
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index 34d151e..4fc8076 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -1,189 +1,189 @@
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 "clipboard.h" 21#include "clipboard.h"
22 22
23#include <opie2/otaskbarapplet.h> 23#include <opie2/otaskbarapplet.h>
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26 26
27#include <qpainter.h> 27#include <qpainter.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qwindowsystem_qws.h> 29#include <qwindowsystem_qws.h>
30#include <qapplication.h> 30#include <qapplication.h>
31#include <qclipboard.h> 31#include <qclipboard.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34//=========================================================================== 34//===========================================================================
35 35
36 36
37ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) 37ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name )
38{ 38{
39 setFixedWidth ( AppLnk::smallIconSize() ); 39 setFixedWidth ( AppLnk::smallIconSize() );
40 setFixedHeight ( AppLnk::smallIconSize() ); 40 setFixedHeight ( AppLnk::smallIconSize() );
41 41
42 QImage img = Resource::loadImage( "paste"); 42 QImage img = Resource::loadImage( "paste");
43 img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 43 img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
44 44
45 m_clipboardPixmap.convertFromImage( img ); 45 m_clipboardPixmap.convertFromImage( img );
46 46
47 m_timer = new QTimer ( this ); 47 m_timer = new QTimer ( this );
48 48
49 connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); 49 connect ( QApplication::clipboard ( ), SIGNAL( dataChanged()), this, SLOT( newData()));
50 connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); 50 connect ( m_timer, SIGNAL( timeout()), this, SLOT( newData()));
51 connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); 51 connect ( qApp, SIGNAL( aboutToQuit()), this, SLOT( shutdown()));
52 52
53 m_menu = 0; 53 m_menu = 0;
54 m_dirty = true; 54 m_dirty = true;
55 m_lasttext = QString::null; 55 m_lasttext = QString::null;
56 56
57 m_timer-> start ( 0, true ); 57 m_timer-> start ( 0, true );
58} 58}
59 59
60ClipboardApplet::~ClipboardApplet ( ) 60ClipboardApplet::~ClipboardApplet ( )
61{ 61{
62} 62}
63 63
64int ClipboardApplet::position() 64int ClipboardApplet::position()
65{ 65{
66 return 6; 66 return 6;
67} 67}
68 68
69void ClipboardApplet::shutdown ( ) 69void ClipboardApplet::shutdown ( )
70{ 70{
71 // the timer has to be stopped, or Qt/E will hang on quit() 71 // the timer has to be stopped, or Qt/E will hang on quit()
72 // see launcher/desktop.cpp 72 // see launcher/desktop.cpp
73 73
74 m_timer-> stop ( ); 74 m_timer-> stop ( );
75} 75}
76 76
77void ClipboardApplet::mousePressEvent ( QMouseEvent *) 77void ClipboardApplet::mousePressEvent ( QMouseEvent *)
78{ 78{
79 if ( m_dirty ) { 79 if ( m_dirty ) {
80 delete m_menu; 80 delete m_menu;
81 81
82 m_menu = new QPopupMenu ( this ); 82 m_menu = new QPopupMenu ( this );
83 m_menu-> setCheckable ( true ); 83 m_menu-> setCheckable ( true );
84 84
85 if ( m_history. count ( )) { 85 if ( m_history. count ( )) {
86 for ( unsigned int i = 0; i < m_history. count ( ); i++ ) { 86 for ( unsigned int i = 0; i < m_history. count ( ); i++ ) {
87 QString str = m_history [i]; 87 QString str = m_history [i];
88 88
89 if ( str. length ( ) > 20 ) 89 if ( str. length ( ) > 20 )
90 str = str. left ( 20 ) + "..."; 90 str = str. left ( 20 ) + "...";
91 91
92 m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i ); 92 m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i );
93 m_menu-> setItemChecked ( i, false ); 93 m_menu-> setItemChecked ( i, false );
94 } 94 }
95 m_menu-> setItemChecked ( m_history. count ( ) - 1, true ); 95 m_menu-> setItemChecked ( m_history. count ( ) - 1, true );
96 m_menu-> insertSeparator ( ); 96 m_menu-> insertSeparator ( );
97 } 97 }
98 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 ); 98 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 );
99 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 ); 99 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 );
100 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 ); 100 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 );
101 101
102 connect ( m_menu, SIGNAL( activated ( int )), this, SLOT( action ( int ))); 102 connect ( m_menu, SIGNAL( activated(int)), this, SLOT( action(int)));
103 103
104 m_dirty = false; 104 m_dirty = false;
105 } 105 }
106 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 106 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
107 QSize s = m_menu-> sizeHint ( ); 107 QSize s = m_menu-> sizeHint ( );
108 108
109 m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ))); 109 m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )));
110} 110}
111 111
112void ClipboardApplet::action(int id) 112void ClipboardApplet::action(int id)
113{ 113{
114 ushort unicode = 0; 114 ushort unicode = 0;
115 int scan = 0; 115 int scan = 0;
116 116
117 switch ( id ) { 117 switch ( id ) {
118 case 100: 118 case 100:
119 unicode = 'X' - '@'; 119 unicode = 'X' - '@';
120 scan = Key_X; // Cut 120 scan = Key_X; // Cut
121 break; 121 break;
122 case 101: 122 case 101:
123 unicode = 'C' - '@'; 123 unicode = 'C' - '@';
124 scan = Key_C; // Copy 124 scan = Key_C; // Copy
125 break; 125 break;
126 case 102: 126 case 102:
127 unicode = 'V' - '@'; 127 unicode = 'V' - '@';
128 scan = Key_V; // Paste 128 scan = Key_V; // Paste
129 break; 129 break;
130 130
131 default: 131 default:
132 if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) { 132 if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) {
133 QApplication::clipboard ( )-> setText ( m_history [id] ); 133 QApplication::clipboard ( )-> setText ( m_history [id] );
134 134
135 for ( uint i = 0; i < m_history. count ( ); i++ ) 135 for ( uint i = 0; i < m_history. count ( ); i++ )
136 m_menu-> setItemChecked ( i, i == uint( id )); 136 m_menu-> setItemChecked ( i, i == uint( id ));
137 137
138 unicode = 'V' - '@'; 138 unicode = 'V' - '@';
139 scan = Key_V; 139 scan = Key_V;
140 } 140 }
141 break; 141 break;
142 } 142 }
143 143
144 if ( scan ) { 144 if ( scan ) {
145 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); 145 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false );
146 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); 146 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false );
147 } 147 }
148} 148}
149 149
150void ClipboardApplet::paintEvent ( QPaintEvent* ) 150void ClipboardApplet::paintEvent ( QPaintEvent* )
151{ 151{
152 QPainter p ( this ); 152 QPainter p ( this );
153 /* center the height but our pixmap is as big as the height ;)*/ 153 /* center the height but our pixmap is as big as the height ;)*/
154 p. drawPixmap( 0, 0, 154 p. drawPixmap( 0, 0,
155 m_clipboardPixmap ); 155 m_clipboardPixmap );
156} 156}
157 157
158void ClipboardApplet::newData ( ) 158void ClipboardApplet::newData ( )
159{ 159{
160 static bool excllock = false; 160 static bool excllock = false;
161 161
162 if ( excllock ) 162 if ( excllock )
163 return; 163 return;
164 else 164 else
165 excllock = true; 165 excllock = true;
166 166
167 m_timer-> stop ( ); 167 m_timer-> stop ( );
168 168
169 QCString type = "plain"; 169 QCString type = "plain";
170 QString txt = QApplication::clipboard ( )-> text ( type ); 170 QString txt = QApplication::clipboard ( )-> text ( type );
171 171
172 if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { 172 if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) {
173 m_history. append ( txt ); 173 m_history. append ( txt );
174 174
175 if ( m_history. count ( ) > 5 ) 175 if ( m_history. count ( ) > 5 )
176 m_history. remove ( m_history. begin ( )); 176 m_history. remove ( m_history. begin ( ));
177 177
178 m_dirty = true; 178 m_dirty = true;
179 } 179 }
180 180
181 m_timer-> start ( 1500, true ); 181 m_timer-> start ( 1500, true );
182 182
183 excllock = false; 183 excllock = false;
184} 184}
185 185
186Q_EXPORT_INTERFACE() 186Q_EXPORT_INTERFACE()
187{ 187{
188 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ClipboardApplet> ); 188 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ClipboardApplet> );
189} 189}
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp
index 9fead03..120a019 100644
--- a/core/applets/clockapplet/clock.cpp
+++ b/core/applets/clockapplet/clock.cpp
@@ -1,121 +1,121 @@
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 "clock.h" 21#include "clock.h"
22 22
23#include <opie2/otaskbarapplet.h> 23#include <opie2/otaskbarapplet.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27 27
28LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) 28LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent )
29{ 29{
30 // If you want a sunken border around the clock do this: 30 // If you want a sunken border around the clock do this:
31 // setFrameStyle( QFrame::Panel | QFrame::Sunken ); 31 // setFrameStyle( QFrame::Panel | QFrame::Sunken );
32 //setFont( QFont( "Helvetica", , QFont::Normal ) ); 32 //setFont( QFont( "Helvetica", , QFont::Normal ) );
33 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); 33 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime() ) );
34 connect( qApp, SIGNAL( clockChanged( bool ) ), 34 connect( qApp, SIGNAL( clockChanged(bool) ),
35 this, SLOT( slotClockChanged( bool ) ) ); 35 this, SLOT( slotClockChanged(bool) ) );
36 readConfig(); 36 readConfig();
37 timerId = 0; 37 timerId = 0;
38 timerEvent( 0 ); 38 timerEvent( 0 );
39 show(); 39 show();
40} 40}
41 41
42int LauncherClock::position() 42int LauncherClock::position()
43{ 43{
44 return 10; 44 return 10;
45} 45}
46 46
47void LauncherClock::readConfig() { 47void LauncherClock::readConfig() {
48 Config config( "qpe" ); 48 Config config( "qpe" );
49 config.setGroup( "Time" ); 49 config.setGroup( "Time" );
50 ampmFormat = config.readBoolEntry( "AMPM", TRUE ); 50 ampmFormat = config.readBoolEntry( "AMPM", TRUE );
51 config.setGroup( "Date" ); 51 config.setGroup( "Date" );
52 format = config.readNumEntry("ClockApplet",0); 52 format = config.readNumEntry("ClockApplet",0);
53} 53}
54 54
55void LauncherClock::mouseReleaseEvent( QMouseEvent * ) 55void LauncherClock::mouseReleaseEvent( QMouseEvent * )
56{ 56{
57 QCString setTimeApp; 57 QCString setTimeApp;
58 setTimeApp="systemtime"; 58 setTimeApp="systemtime";
59 QCopEnvelope e("QPE/Application/"+setTimeApp, "raise()"); 59 QCopEnvelope e("QPE/Application/"+setTimeApp, "raise()");
60} 60}
61 61
62 62
63void LauncherClock::timerEvent( QTimerEvent *e ) 63void LauncherClock::timerEvent( QTimerEvent *e )
64{ 64{
65 if ( !e || e->timerId() == timerId ) { 65 if ( !e || e->timerId() == timerId ) {
66 killTimer( timerId ); 66 killTimer( timerId );
67 changeTime(); 67 changeTime();
68 QTime t = QTime::currentTime(); 68 QTime t = QTime::currentTime();
69 int ms = (60 - t.second())*1000 - t.msec(); 69 int ms = (60 - t.second())*1000 - t.msec();
70 timerId = startTimer( ms ); 70 timerId = startTimer( ms );
71 } else { 71 } else {
72 QLabel::timerEvent( e ); 72 QLabel::timerEvent( e );
73 } 73 }
74} 74}
75 75
76void LauncherClock::updateTime( void ) 76void LauncherClock::updateTime( void )
77{ 77{
78 changeTime(); 78 changeTime();
79} 79}
80 80
81void LauncherClock::changeTime( void ) 81void LauncherClock::changeTime( void )
82{ 82{
83 QTime tm = QDateTime::currentDateTime().time(); 83 QTime tm = QDateTime::currentDateTime().time();
84 QString s; 84 QString s;
85 if( ampmFormat ) { 85 if( ampmFormat ) {
86 int hour = tm.hour(); 86 int hour = tm.hour();
87 if (hour == 0) 87 if (hour == 0)
88 hour = 12; 88 hour = 12;
89 if (hour > 12) 89 if (hour > 12)
90 hour -= 12; 90 hour -= 12;
91 s.sprintf( "%2d:%02d %s", hour, tm.minute(), 91 s.sprintf( "%2d:%02d %s", hour, tm.minute(),
92 (tm.hour() >= 12) ? "PM" : "AM" ); 92 (tm.hour() >= 12) ? "PM" : "AM" );
93 } else 93 } else
94 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); 94 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
95 95
96 if (format==1) { 96 if (format==1) {
97 QDate dm = QDate::currentDate(); 97 QDate dm = QDate::currentDate();
98 QString d; 98 QString d;
99 d.sprintf("%d/%d ", dm.day(), dm.month()); 99 d.sprintf("%d/%d ", dm.day(), dm.month());
100 setText( d+s ); 100 setText( d+s );
101 } else if (format==2) { 101 } else if (format==2) {
102 QDate dm = QDate::currentDate(); 102 QDate dm = QDate::currentDate();
103 QString d; 103 QString d;
104 d.sprintf("%d/%d ", dm.month(), dm.day()); 104 d.sprintf("%d/%d ", dm.month(), dm.day());
105 setText( d+s ); 105 setText( d+s );
106 } else { 106 } else {
107 setText( s ); 107 setText( s );
108 } 108 }
109} 109}
110 110
111void LauncherClock::slotClockChanged( bool pm ) 111void LauncherClock::slotClockChanged( bool pm )
112{ 112{
113 readConfig(); 113 readConfig();
114 updateTime(); 114 updateTime();
115} 115}
116 116
117Q_EXPORT_INTERFACE() 117Q_EXPORT_INTERFACE()
118{ 118{
119 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<LauncherClock> ); 119 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<LauncherClock> );
120} 120}
121 121
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index afc0592..dde8050 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -1,196 +1,196 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org> 2** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org>
3** Max Reiss <harlekin@handhelds.org> [trivial stuff] 3** Max Reiss <harlekin@handhelds.org> [trivial stuff]
4** Robert Griebl <sandman@handhelds.org> 4** Robert Griebl <sandman@handhelds.org>
5** Holger Freyther <zecke@handhelds.org> QCOP Interface 5** Holger Freyther <zecke@handhelds.org> QCOP Interface
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15**********************************************************************/ 15**********************************************************************/
16 16
17#include "irda.h" 17#include "irda.h"
18 18
19/* OPIE */ 19/* OPIE */
20#include <opie2/otaskbarapplet.h> 20#include <opie2/otaskbarapplet.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23 23
24/* QT */ 24/* QT */
25#include <qpainter.h> 25#include <qpainter.h>
26#include <qfile.h> 26#include <qfile.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qtextstream.h> 28#include <qtextstream.h>
29 29
30/* STD */ 30/* STD */
31#include <unistd.h> 31#include <unistd.h>
32#include <net/if.h> 32#include <net/if.h>
33#include <netinet/in.h> 33#include <netinet/in.h>
34#include <sys/types.h> 34#include <sys/types.h>
35#include <sys/socket.h> 35#include <sys/socket.h>
36#include <sys/ioctl.h> 36#include <sys/ioctl.h>
37 37
38//=========================================================================== 38//===========================================================================
39 39
40IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) 40IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
41 : QWidget ( parent, name ) 41 : QWidget ( parent, name )
42{ 42{
43 setFixedHeight ( 18 ); 43 setFixedHeight ( 18 );
44 setFixedWidth ( 14 ); 44 setFixedWidth ( 14 );
45 45
46 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); 46 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP );
47 47
48 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); 48 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" );
49 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); 49 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" );
50 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); 50 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" );
51 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); 51 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" );
52 52
53 m_irda_active = false; 53 m_irda_active = false;
54 m_irda_discovery_active = false; 54 m_irda_discovery_active = false;
55 m_receive_active = false; 55 m_receive_active = false;
56 m_receive_state_changed = false; 56 m_receive_state_changed = false;
57 m_popup = 0; 57 m_popup = 0;
58 m_wasOn = false; 58 m_wasOn = false;
59 m_wasDiscover = false; 59 m_wasDiscover = false;
60 60
61 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); 61 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this );
62 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 62 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
63 this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) ); 63 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) );
64} 64}
65 65
66int IrdaApplet::position() 66int IrdaApplet::position()
67{ 67{
68 return 6; 68 return 6;
69} 69}
70 70
71void IrdaApplet::show() 71void IrdaApplet::show()
72{ 72{
73 QWidget::show ( ); 73 QWidget::show ( );
74 startTimer ( 2000 ); 74 startTimer ( 2000 );
75} 75}
76 76
77IrdaApplet::~IrdaApplet() 77IrdaApplet::~IrdaApplet()
78{ 78{
79 if ( m_sockfd >= 0 ) 79 if ( m_sockfd >= 0 )
80 ::close ( m_sockfd ); 80 ::close ( m_sockfd );
81} 81}
82 82
83void IrdaApplet::popup ( QString message, QString icon ) 83void IrdaApplet::popup ( QString message, QString icon )
84{ 84{
85 if ( !m_popup ) 85 if ( !m_popup )
86 m_popup = new QPopupMenu ( this ); 86 m_popup = new QPopupMenu ( this );
87 87
88 m_popup-> clear ( ); 88 m_popup-> clear ( );
89 89
90 if ( icon. isEmpty ( )) 90 if ( icon. isEmpty ( ))
91 m_popup-> insertItem ( message, 0 ); 91 m_popup-> insertItem ( message, 0 );
92 else 92 else
93 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); 93 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 );
94 94
95 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 95 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
96 QSize s = m_popup-> sizeHint ( ); 96 QSize s = m_popup-> sizeHint ( );
97 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), 97 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ),
98 p. y ( ) - s. height ( ))); 98 p. y ( ) - s. height ( )));
99 99
100 QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( ))); 100 QTimer::singleShot ( 2000, this, SLOT( popupTimeout()));
101} 101}
102 102
103void IrdaApplet::popupTimeout ( ) 103void IrdaApplet::popupTimeout ( )
104{ 104{
105 m_popup-> hide ( ); 105 m_popup-> hide ( );
106} 106}
107 107
108bool IrdaApplet::checkIrdaStatus ( ) 108bool IrdaApplet::checkIrdaStatus ( )
109{ 109{
110 struct ifreq ifr; 110 struct ifreq ifr;
111 strcpy ( ifr. ifr_name, "irda0" ); 111 strcpy ( ifr. ifr_name, "irda0" );
112 112
113 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 113 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
114 return false; 114 return false;
115 115
116 return ( ifr. ifr_flags & IFF_UP ); 116 return ( ifr. ifr_flags & IFF_UP );
117} 117}
118 118
119bool IrdaApplet::setIrdaStatus ( bool b ) 119bool IrdaApplet::setIrdaStatus ( bool b )
120{ 120{
121 struct ifreq ifr; 121 struct ifreq ifr;
122 strcpy ( ifr. ifr_name, "irda0" ); 122 strcpy ( ifr. ifr_name, "irda0" );
123 123
124 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 124 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
125 return false; 125 return false;
126 126
127 if ( b ) { 127 if ( b ) {
128 ifr. ifr_flags |= IFF_UP; 128 ifr. ifr_flags |= IFF_UP;
129 } 129 }
130 else { 130 else {
131 setIrdaDiscoveryStatus ( 0 ); 131 setIrdaDiscoveryStatus ( 0 );
132 setIrdaReceiveStatus ( 0 ); 132 setIrdaReceiveStatus ( 0 );
133 ifr. ifr_flags &= ~IFF_UP; 133 ifr. ifr_flags &= ~IFF_UP;
134 } 134 }
135 135
136 if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 ) 136 if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 )
137 return false; 137 return false;
138 138
139 return true; 139 return true;
140} 140}
141 141
142bool IrdaApplet::checkIrdaDiscoveryStatus ( ) 142bool IrdaApplet::checkIrdaDiscoveryStatus ( )
143{ 143{
144 QFile discovery ( "/proc/sys/net/irda/discovery" ); 144 QFile discovery ( "/proc/sys/net/irda/discovery" );
145 145
146 QString streamIn = "0"; 146 QString streamIn = "0";
147 147
148 if ( discovery. open ( IO_ReadOnly )) { 148 if ( discovery. open ( IO_ReadOnly )) {
149 QTextStream stream ( &discovery ); 149 QTextStream stream ( &discovery );
150 streamIn = stream. read ( ); 150 streamIn = stream. read ( );
151 } 151 }
152 152
153 return streamIn. toInt ( ) > 0; 153 return streamIn. toInt ( ) > 0;
154} 154}
155 155
156 156
157bool IrdaApplet::setIrdaDiscoveryStatus ( bool d ) 157bool IrdaApplet::setIrdaDiscoveryStatus ( bool d )
158{ 158{
159 QFile discovery ( "/proc/sys/net/irda/discovery" ); 159 QFile discovery ( "/proc/sys/net/irda/discovery" );
160 160
161 if ( discovery. open ( IO_WriteOnly | IO_Raw )) { 161 if ( discovery. open ( IO_WriteOnly | IO_Raw )) {
162 discovery.putch ( d ? '1' : '0' ); 162 discovery.putch ( d ? '1' : '0' );
163 return true; 163 return true;
164 } 164 }
165 return false; 165 return false;
166} 166}
167 167
168 168
169bool IrdaApplet::setIrdaReceiveStatus ( bool d ) 169bool IrdaApplet::setIrdaReceiveStatus ( bool d )
170{ 170{
171 QCopEnvelope e ( "QPE/Obex", "receive(int)" ); 171 QCopEnvelope e ( "QPE/Obex", "receive(int)" );
172 e << ( d ? 1 : 0 ); 172 e << ( d ? 1 : 0 );
173 173
174 m_receive_active = d; 174 m_receive_active = d;
175 m_receive_state_changed = true; 175 m_receive_state_changed = true;
176 176
177 return true; 177 return true;
178} 178}
179 179
180 180
181void IrdaApplet::showDiscovered ( ) 181void IrdaApplet::showDiscovered ( )
182{ 182{
183 //static Sound snd_found ( "irdaapplet/irdaon" ); 183 //static Sound snd_found ( "irdaapplet/irdaon" );
184 //static Sound snd_lost ( "irdaapplet/irdaoff" ); 184 //static Sound snd_lost ( "irdaapplet/irdaoff" );
185 185
186 QFile discovery ( "/proc/net/irda/discovery" ); 186 QFile discovery ( "/proc/net/irda/discovery" );
187 187
188 if ( discovery. open ( IO_ReadOnly )) { 188 if ( discovery. open ( IO_ReadOnly )) {
189 bool qcopsend = false; 189 bool qcopsend = false;
190 190
191 QString discoveredDevice; 191 QString discoveredDevice;
192 QString deviceAddr; 192 QString deviceAddr;
193 193
194 // since it is /proc we _must_ use QTextStream 194 // since it is /proc we _must_ use QTextStream
195 QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); 195 QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( ));
196 196
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp
index b17498d..fc5f093 100644
--- a/core/applets/multikeyapplet/multikey.cpp
+++ b/core/applets/multikeyapplet/multikey.cpp
@@ -1,124 +1,124 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru 2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru
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 "multikey.h" 15#include "multikey.h"
16 16
17/* OPIE */ 17/* OPIE */
18#include <opie2/otaskbarapplet.h> 18#include <opie2/otaskbarapplet.h>
19#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
20 20
21/* QT */ 21/* QT */
22#include <qdir.h> 22#include <qdir.h>
23 23
24Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") 24Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN")
25{ 25{
26 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); 26 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this);
27 connect( swChannel, SIGNAL(received(const QCString &, const QByteArray &)), 27 connect( swChannel, SIGNAL(received(const QCString&,const QByteArray&)),
28 this, SLOT(message(const QCString &, const QByteArray &))); 28 this, SLOT(message(const QCString&,const QByteArray&)));
29 29
30 setFont( QFont( "Helvetica", 10, QFont::Normal ) ); 30 setFont( QFont( "Helvetica", 10, QFont::Normal ) );
31 QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); 31 QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold);
32 lang = 0; 32 lang = 0;
33 QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); 33 QCopEnvelope e("MultiKey/Keyboard", "getmultikey()");
34 setText("EN"); 34 setText("EN");
35 popupMenu.insertItem("EN", 0); 35 popupMenu.insertItem("EN", 0);
36 show(); 36 show();
37} 37}
38 38
39void Multikey::mousePressEvent(QMouseEvent *ev) 39void Multikey::mousePressEvent(QMouseEvent *ev)
40{ 40{
41 if (!sw_maps.count()) 41 if (!sw_maps.count())
42 return; 42 return;
43 43
44 if (ev->button() == RightButton) { 44 if (ev->button() == RightButton) {
45 45
46 QPoint p = mapToGlobal(QPoint(0, 0)); 46 QPoint p = mapToGlobal(QPoint(0, 0));
47 QSize s = popupMenu.sizeHint(); 47 QSize s = popupMenu.sizeHint();
48 int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), 48 int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2),
49 p.y() - s.height()), 0); 49 p.y() - s.height()), 0);
50 50
51 if (opt == -1) 51 if (opt == -1)
52 return; 52 return;
53 lang = opt; 53 lang = opt;
54 54
55 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); 55 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
56 e << sw_maps[lang]; 56 e << sw_maps[lang];
57 setText(labels[lang]); 57 setText(labels[lang]);
58 } 58 }
59 QWidget::mousePressEvent(ev); 59 QWidget::mousePressEvent(ev);
60} 60}
61 61
62void Multikey::mouseReleaseEvent(QMouseEvent *ev) 62void Multikey::mouseReleaseEvent(QMouseEvent *ev)
63{ 63{
64 if (!sw_maps.count()) 64 if (!sw_maps.count())
65 return; 65 return;
66 66
67 lang = lang < sw_maps.count()-1 ? lang+1 : 0; 67 lang = lang < sw_maps.count()-1 ? lang+1 : 0;
68 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); 68 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
69 //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii()); 69 //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii());
70 e << sw_maps[lang]; 70 e << sw_maps[lang];
71 setText(labels[lang]); 71 setText(labels[lang]);
72} 72}
73 73
74void Multikey::message(const QCString &message, const QByteArray &data) 74void Multikey::message(const QCString &message, const QByteArray &data)
75{ 75{
76 if ( message == "setsw(QString,QString)" ) { 76 if ( message == "setsw(QString,QString)" ) {
77 77
78 QDataStream stream(data, IO_ReadOnly); 78 QDataStream stream(data, IO_ReadOnly);
79 QString maps, current_map; 79 QString maps, current_map;
80 stream >> maps >> current_map; 80 stream >> maps >> current_map;
81 QStringList sw = QStringList::split(QChar('|'), maps); 81 QStringList sw = QStringList::split(QChar('|'), maps);
82 sw.append(current_map); 82 sw.append(current_map);
83 83
84 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey/", "*.keymap"); 84 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey/", "*.keymap");
85 lang = 0; 85 lang = 0;
86 labels.clear(); 86 labels.clear();
87 sw_maps.clear(); 87 sw_maps.clear();
88 popupMenu.clear(); 88 popupMenu.clear();
89 89
90 for (uint i = 0; i < sw.count(); ++i) { 90 for (uint i = 0; i < sw.count(); ++i) {
91 QString keymap_map; 91 QString keymap_map;
92 if (sw[i][0] != '/') { 92 if (sw[i][0] != '/') {
93 93
94 keymap_map = map_dir.absPath() + "/" + sw[i]; 94 keymap_map = map_dir.absPath() + "/" + sw[i];
95 } else { 95 } else {
96 96
97 if ((map_dir.exists(QFileInfo(sw[i]).fileName(), false) 97 if ((map_dir.exists(QFileInfo(sw[i]).fileName(), false)
98 && i != sw.count()-1) || !QFile::exists(sw[i])) { 98 && i != sw.count()-1) || !QFile::exists(sw[i])) {
99 continue; 99 continue;
100 } 100 }
101 keymap_map = sw[i]; 101 keymap_map = sw[i];
102 } 102 }
103 103
104 QFile map(keymap_map); 104 QFile map(keymap_map);
105 if (map.open(IO_ReadOnly)) { 105 if (map.open(IO_ReadOnly)) {
106 QString line; 106 QString line;
107 107
108 map.readLine(line, 1024); 108 map.readLine(line, 1024);
109 while (!map.atEnd()) { 109 while (!map.atEnd()) {
110 110
111 if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) { 111 if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) {
112 112
113 if (i != sw.count()-1) { 113 if (i != sw.count()-1) {
114 if (keymap_map == current_map) { 114 if (keymap_map == current_map) {
115 lang = i; 115 lang = i;
116 } 116 }
117 sw_maps.append(keymap_map); 117 sw_maps.append(keymap_map);
118 labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 118 labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
119 popupMenu.insertItem(labels[labels.count()-1], labels.count()-1); 119 popupMenu.insertItem(labels[labels.count()-1], labels.count()-1);
120 } else { 120 } else {
121 current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace(); 121 current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace();
122 } 122 }
123 break; 123 break;
124 } 124 }
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
index dcbf809..0488c36 100644
--- a/core/applets/rotateapplet/rotate.cpp
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -1,148 +1,148 @@
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/config.h> 35#include <qpe/config.h>
36#include <qpe/power.h> 36#include <qpe/power.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39using namespace Opie; 39using namespace Opie;
40 40
41/* QT */ 41/* QT */
42 42
43#include <time.h> 43#include <time.h>
44 44
45RotateApplet::RotateApplet() 45RotateApplet::RotateApplet()
46 :QObject( 0, "RotateApplet" ), m_flipped( false ) 46 :QObject( 0, "RotateApplet" ), m_flipped( false )
47{ 47{
48 48
49#if !defined(QT_NO_COP) 49#if !defined(QT_NO_COP)
50 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); 50 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this );
51 connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 51 connect ( rotateChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
52 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 52 this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) );
53#endif 53#endif
54 54
55} 55}
56 56
57RotateApplet::~RotateApplet ( ) 57RotateApplet::~RotateApplet ( )
58{} 58{}
59 59
60/** 60/**
61 * Qcop receive method. 61 * Qcop receive method.
62 */ 62 */
63void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) 63void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data )
64{ 64{
65 qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg ); 65 qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg );
66 66
67 if ( ODevice::inst()->hasHingeSensor() ) 67 if ( ODevice::inst()->hasHingeSensor() )
68 { 68 {
69 struct timespec interval; 69 struct timespec interval;
70 struct timespec remain; 70 struct timespec remain;
71 interval.tv_sec = 0; 71 interval.tv_sec = 0;
72 interval.tv_nsec = 600000; 72 interval.tv_nsec = 600000;
73 ::nanosleep( &interval, &remain ); 73 ::nanosleep( &interval, &remain );
74 OHingeStatus status = ODevice::inst()->readHingeSensor(); 74 OHingeStatus status = ODevice::inst()->readHingeSensor();
75 qDebug( "RotateApplet::readHingeSensor = %d", (int) status ); 75 qDebug( "RotateApplet::readHingeSensor = %d", (int) status );
76 76
77 Config cfg( "apm" ); 77 Config cfg( "apm" );
78 cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); 78 cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" );
79 int action = cfg.readNumEntry( "CloseHingeAction", 0 ); 79 int action = cfg.readNumEntry( "CloseHingeAction", 0 );
80 80
81 if ( status == CASE_CLOSED ) 81 if ( status == CASE_CLOSED )
82 { 82 {
83 switch ( action ) 83 switch ( action )
84 { 84 {
85 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break; 85 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break;
86 case 2: /* SUSPEND */ ODevice::inst()->suspend(); break; 86 case 2: /* SUSPEND */ ODevice::inst()->suspend(); break;
87 default: /* IGNORE */ break; 87 default: /* IGNORE */ break;
88 } 88 }
89 } 89 }
90 else /* status != CASE_CLOSED */ 90 else /* status != CASE_CLOSED */
91 { 91 {
92 switch ( action ) 92 switch ( action )
93 { 93 {
94 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break; 94 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break;
95 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;
96 default: /* IGNORE */ break; 96 default: /* IGNORE */ break;
97 } 97 }
98 } 98 }
99 qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) ); 99 qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) );
100 } 100 }
101 101
102 QDataStream stream( data, IO_ReadOnly ); 102 QDataStream stream( data, IO_ReadOnly );
103 if ( msg == "flip()" ) 103 if ( msg == "flip()" )
104 { 104 {
105 activated ( ); 105 activated ( );
106 } 106 }
107 else if ( msg == "rotateDefault()") 107 else if ( msg == "rotateDefault()")
108 { 108 {
109 rotateDefault(); 109 rotateDefault();
110 } 110 }
111} 111}
112 112
113int RotateApplet::position() const 113int RotateApplet::position() const
114{ 114{
115 return 3; 115 return 3;
116} 116}
117 117
118QString RotateApplet::name() const 118QString RotateApplet::name() const
119{ 119{
120 return tr( "Rotate shortcut" ); 120 return tr( "Rotate shortcut" );
121} 121}
122 122
123QString RotateApplet::text() const 123QString RotateApplet::text() const
124{ 124{
125 return tr( "Rotate" ); 125 return tr( "Rotate" );
126} 126}
127 127
128/*QString RotateApplet::tr( const char* s ) const 128/*QString RotateApplet::tr( const char* s ) const
129{ 129{
130 return qApp->translate( "RotateApplet", s, 0 ); 130 return qApp->translate( "RotateApplet", s, 0 );
131} 131}
132 132
133QString RotateApplet::tr( const char* s, const char* p ) const 133QString RotateApplet::tr( const char* s, const char* p ) const
134{ 134{
135 return qApp->translate( "RotateApplet", s, p ); 135 return qApp->translate( "RotateApplet", s, p );
136} 136}
137*/ 137*/
138 138
139QIconSet RotateApplet::icon() const 139QIconSet RotateApplet::icon() const
140{ 140{
141 QPixmap pix; 141 QPixmap pix;
142 QImage img = Resource::loadImage( "Rotation" ); 142 QImage img = Resource::loadImage( "Rotation" );
143 if ( !img.isNull() ) 143 if ( !img.isNull() )
144 pix.convertFromImage( img.smoothScale( 14, 14 ) ); 144 pix.convertFromImage( img.smoothScale( 14, 14 ) );
145 return pix; 145 return pix;
146} 146}
147 147
148QPopupMenu* RotateApplet::popup(QWidget*) const 148QPopupMenu* RotateApplet::popup(QWidget*) const
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 5d6bce4..20e1c9b 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -206,195 +206,195 @@ static char * snapshot_xpm[] = {
206 "F.c #5A525E", 206 "F.c #5A525E",
207 "G.c #425868", 207 "G.c #425868",
208 "H.c #04448E", 208 "H.c #04448E",
209 "I.c #28828A", 209 "I.c #28828A",
210 "J.c #2D8593", 210 "J.c #2D8593",
211 "K.c #12427A", 211 "K.c #12427A",
212 "L.c #054696", 212 "L.c #054696",
213 "M.c #042B5E", 213 "M.c #042B5E",
214 "N.c #134F95", 214 "N.c #134F95",
215 "O.c #1E6ABB", 215 "O.c #1E6ABB",
216 "P.c #1A5E96", 216 "P.c #1A5E96",
217 "Q.c #022E67", 217 "Q.c #022E67",
218 "R.c #0C3E7C", 218 "R.c #0C3E7C",
219 "S.c #023E8A", 219 "S.c #023E8A",
220 "T.c #021A3E", 220 "T.c #021A3E",
221" ", 221" ",
222" ", 222" ",
223" ", 223" ",
224" . + @ # + ", 224" . + @ # + ",
225" $ # % & * * = - # $ ", 225" $ # % & * * = - # $ ",
226"; > % @ = , ' ) ' ! ~ { % @ . ] ^ / ( ", 226"; > % @ = , ' ) ' ! ~ { % @ . ] ^ / ( ",
227"; + ' * ) _ ) ) ' : : ! { { % < . [ ( } ", 227"; + ' * ) _ ) ) ' : : ! { { % < . [ ( } ",
228"| @ 1 2 3 _ _ ) ' : : : : 4 5 6 6 # 7 8 } ", 228"| @ 1 2 3 _ _ ) ' : : : : 4 5 6 6 # 7 8 } ",
229"9 0 a b b b c _ ) : : ! ! ~ ~ 5 ~ d e f [ 8 g h h } ", 229"9 0 a b b b c _ ) : : ! ! ~ ~ 5 ~ d e f [ 8 g h h } ",
230"| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ", 230"| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ",
231"t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ", 231"t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ",
232"| 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 ", 232"| 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 ",
233"| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ", 233"| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ",
234";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ", 234";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ",
235";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ", 235";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ",
236";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ", 236";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ",
237"t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ", 237"t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ",
238"| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ", 238"| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ",
239"; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ", 239"; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ",
240"9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ", 240"9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ",
241"9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ", 241"9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ",
242"; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ", 242"; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ",
243"; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ", 243"; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ",
244" ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ", 244" ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ",
245" # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ", 245" # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ",
246" + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ", 246" + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ",
247" < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ", 247" < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ",
248" $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ", 248" $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ",
249" ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ", 249" ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ",
250" | > e L.d L.H.e M.. ; ] ] ", 250" | > e L.d L.H.e M.. ; ] ] ",
251" > 9 . S.Q.. ; ] ", 251" > 9 . S.Q.. ; ] ",
252" T.; ] "}; 252" T.; ] "};
253 253
254static const char *SCAP_hostname = "www.handhelds.org"; 254static const char *SCAP_hostname = "www.handhelds.org";
255static const int SCAP_port = 80; 255static const int SCAP_port = 80;
256 256
257 257
258ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) 258ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name )
259 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) 259 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
260{ 260{
261 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 261 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
262 QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 ); 262 QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 );
263 QHBoxLayout *hbox; 263 QHBoxLayout *hbox;
264 264
265 hbox = new QHBoxLayout ( vbox ); 265 hbox = new QHBoxLayout ( vbox );
266 266
267 QLabel *l = new QLabel ( tr( "Delay" ), this ); 267 QLabel *l = new QLabel ( tr( "Delay" ), this );
268 hbox-> addWidget ( l ); 268 hbox-> addWidget ( l );
269 269
270 delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" ); 270 delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" );
271 delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus ); 271 delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus );
272 delaySpin-> setSuffix ( tr( "sec" )); 272 delaySpin-> setSuffix ( tr( "sec" ));
273 delaySpin-> setFocusPolicy( QWidget::NoFocus ); 273 delaySpin-> setFocusPolicy( QWidget::NoFocus );
274 delaySpin-> setValue ( 1 ); 274 delaySpin-> setValue ( 1 );
275 hbox-> addWidget ( delaySpin ); 275 hbox-> addWidget ( delaySpin );
276 276
277 saveNamedCheck = new QCheckBox ( tr( "Save named" ), this); 277 saveNamedCheck = new QCheckBox ( tr( "Save named" ), this);
278 saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus ); 278 saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus );
279 vbox->addWidget( saveNamedCheck); 279 vbox->addWidget( saveNamedCheck);
280 280
281 vbox-> addSpacing ( 3 ); 281 vbox-> addSpacing ( 3 );
282 282
283 l = new QLabel ( tr( "Save screenshot as..." ), this ); 283 l = new QLabel ( tr( "Save screenshot as..." ), this );
284 vbox-> addWidget ( l, AlignCenter ); 284 vbox-> addWidget ( l, AlignCenter );
285 285
286 hbox = new QHBoxLayout ( vbox ); 286 hbox = new QHBoxLayout ( vbox );
287 287
288 grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" ); 288 grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" );
289 grabItButton ->setFocusPolicy( QWidget::TabFocus ); 289 grabItButton ->setFocusPolicy( QWidget::TabFocus );
290 hbox-> addWidget ( grabItButton ); 290 hbox-> addWidget ( grabItButton );
291 291
292 scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" ); 292 scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" );
293 scapButton ->setFocusPolicy( QWidget::TabFocus ); 293 scapButton ->setFocusPolicy( QWidget::TabFocus );
294 hbox-> addWidget ( scapButton ); 294 hbox-> addWidget ( scapButton );
295 295
296 setFixedSize ( sizeHint ( )); 296 setFixedSize ( sizeHint ( ));
297 setFocusPolicy ( QWidget::NoFocus ); 297 setFocusPolicy ( QWidget::NoFocus );
298 298
299 299
300 grabTimer = new QTimer ( this, "grab timer"); 300 grabTimer = new QTimer ( this, "grab timer");
301 301
302 connect ( grabTimer, SIGNAL( timeout ( )), this, SLOT( performGrab ( ))); 302 connect ( grabTimer, SIGNAL( timeout()), this, SLOT( performGrab()));
303 connect ( grabItButton, SIGNAL( clicked ( )), SLOT( slotGrab ( ))); 303 connect ( grabItButton, SIGNAL( clicked()), SLOT( slotGrab()));
304 connect ( scapButton, SIGNAL( clicked ( )), SLOT( slotScap ( ))); 304 connect ( scapButton, SIGNAL( clicked()), SLOT( slotScap()));
305} 305}
306 306
307void ScreenshotControl::slotGrab() 307void ScreenshotControl::slotGrab()
308{ 308{
309 buttonPushed = 1; 309 buttonPushed = 1;
310 hide(); 310 hide();
311 311
312 setFileName = FALSE; 312 setFileName = FALSE;
313 if ( saveNamedCheck->isChecked()) { 313 if ( saveNamedCheck->isChecked()) {
314 setFileName = TRUE; 314 setFileName = TRUE;
315 InputDialog *fileDlg; 315 InputDialog *fileDlg;
316 316
317 fileDlg = new InputDialog( 0 , tr("Name of screenshot "), TRUE, 0); 317 fileDlg = new InputDialog( 0 , tr("Name of screenshot "), TRUE, 0);
318 fileDlg->exec(); 318 fileDlg->exec();
319 fileDlg->raise(); 319 fileDlg->raise();
320 QString fileName, list; 320 QString fileName, list;
321 if ( fileDlg->result() == 1 ) { 321 if ( fileDlg->result() == 1 ) {
322 fileName = fileDlg->LineEdit1->text(); 322 fileName = fileDlg->LineEdit1->text();
323 323
324 if (fileName.find("/", 0, TRUE) == -1) 324 if (fileName.find("/", 0, TRUE) == -1)
325 FileNamePath = QDir::homeDirPath() + "/Documents/image/png/" + fileName; 325 FileNamePath = QDir::homeDirPath() + "/Documents/image/png/" + fileName;
326 else 326 else
327 FileNamePath = fileName; 327 FileNamePath = fileName;
328 328
329 } 329 }
330 delete fileDlg; 330 delete fileDlg;
331 } 331 }
332 332
333 if ( delaySpin->value() ) 333 if ( delaySpin->value() )
334 grabTimer->start( delaySpin->value() * 1000, true ); 334 grabTimer->start( delaySpin->value() * 1000, true );
335 else 335 else
336 show(); 336 show();
337} 337}
338 338
339void ScreenshotControl::slotScap() 339void ScreenshotControl::slotScap()
340{ 340{
341 buttonPushed = 2; 341 buttonPushed = 2;
342 hide(); 342 hide();
343 343
344 if ( delaySpin->value() ) 344 if ( delaySpin->value() )
345 grabTimer->start( delaySpin->value() * 1000, true ); 345 grabTimer->start( delaySpin->value() * 1000, true );
346 else 346 else
347 show(); 347 show();
348} 348}
349 349
350 350
351void ScreenshotControl::savePixmap() 351void ScreenshotControl::savePixmap()
352{ 352{
353 DocLnk lnk; 353 DocLnk lnk;
354 QString fileName; 354 QString fileName;
355 355
356 if ( setFileName) { 356 if ( setFileName) {
357 fileName = FileNamePath; 357 fileName = FileNamePath;
358 //not sure why this is needed here, but it forgets fileName 358 //not sure why this is needed here, but it forgets fileName
359 // if this is below the braces 359 // if this is below the braces
360 360
361 if (fileName.right(3) != "png") 361 if (fileName.right(3) != "png")
362 fileName = fileName + ".png"; 362 fileName = fileName + ".png";
363 lnk.setFile(fileName); //sets File property 363 lnk.setFile(fileName); //sets File property
364 qDebug("saving file " + fileName); 364 qDebug("saving file " + fileName);
365 snapshot.save( fileName, "PNG"); 365 snapshot.save( fileName, "PNG");
366 QFileInfo fi( fileName); 366 QFileInfo fi( fileName);
367 lnk.setName( fi.fileName()); //sets file name 367 lnk.setName( fi.fileName()); //sets file name
368 368
369 if (!lnk.writeLink()) 369 if (!lnk.writeLink())
370 qDebug("Writing doclink did not work"); 370 qDebug("Writing doclink did not work");
371 } 371 }
372 else { 372 else {
373 373
374 fileName = "sc_" + QDateTime::currentDateTime().toString(); 374 fileName = "sc_" + QDateTime::currentDateTime().toString();
375 fileName.replace(QRegExp("'"), ""); 375 fileName.replace(QRegExp("'"), "");
376 fileName.replace(QRegExp(" "), "_"); 376 fileName.replace(QRegExp(" "), "_");
377 fileName.replace(QRegExp(":"), "."); 377 fileName.replace(QRegExp(":"), ".");
378 fileName.replace(QRegExp(","), ""); 378 fileName.replace(QRegExp(","), "");
379 QString dirName = QDir::homeDirPath() + "/Documents/image/png/"; 379 QString dirName = QDir::homeDirPath() + "/Documents/image/png/";
380 380
381 if ( !QDir( dirName).exists() ) { 381 if ( !QDir( dirName).exists() ) {
382 qDebug("making dir " + dirName); 382 qDebug("making dir " + dirName);
383 QString msg = "mkdir -p " + dirName; 383 QString msg = "mkdir -p " + dirName;
384 system(msg.latin1()); 384 system(msg.latin1());
385 } 385 }
386 fileName = dirName + fileName; 386 fileName = dirName + fileName;
387 if (fileName.right(3) != "png") 387 if (fileName.right(3) != "png")
388 fileName = fileName + ".png"; 388 fileName = fileName + ".png";
389 lnk.setFile(fileName); //sets File property 389 lnk.setFile(fileName); //sets File property
390 qDebug("saving file " + fileName); 390 qDebug("saving file " + fileName);
391 snapshot.save( fileName, "PNG"); 391 snapshot.save( fileName, "PNG");
392 QFileInfo fi( fileName); 392 QFileInfo fi( fileName);
393 lnk.setName( fi.fileName()); //sets file name 393 lnk.setName( fi.fileName()); //sets file name
394 394
395 if (!lnk.writeLink()) 395 if (!lnk.writeLink())
396 qDebug("Writing doclink did not work"); 396 qDebug("Writing doclink did not work");
397 397
398 } 398 }
399 399
400 QPEApplication::beep(); 400 QPEApplication::beep();
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 563d110..27f6015 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -120,194 +120,194 @@ static char * vmemo_xpm[] = {
120 "f c #5B5B60", 120 "f c #5B5B60",
121 "g c #8A8A8F", 121 "g c #8A8A8F",
122 "h c #6B6B6E", 122 "h c #6B6B6E",
123 "i c #ADADB2", 123 "i c #ADADB2",
124 "j c #828289", 124 "j c #828289",
125 "k c #3E3E41", 125 "k c #3E3E41",
126 "l c #CFCFD7", 126 "l c #CFCFD7",
127 "m c #4C4C50", 127 "m c #4C4C50",
128 "n c #000000", 128 "n c #000000",
129 "o c #66666A", 129 "o c #66666A",
130 "p c #505054", 130 "p c #505054",
131 "q c #838388", 131 "q c #838388",
132 "r c #A1A1A7", 132 "r c #A1A1A7",
133 "s c #A9A9AE", 133 "s c #A9A9AE",
134 "t c #A8A8B0", 134 "t c #A8A8B0",
135 "u c #5E5E63", 135 "u c #5E5E63",
136 "v c #3A3A3E", 136 "v c #3A3A3E",
137 "w c #BDBDC6", 137 "w c #BDBDC6",
138 "x c #59595E", 138 "x c #59595E",
139 "y c #76767C", 139 "y c #76767C",
140 "z c #373738", 140 "z c #373738",
141 "A c #717174", 141 "A c #717174",
142 "B c #727278", 142 "B c #727278",
143 "C c #1C1C1E", 143 "C c #1C1C1E",
144 "D c #3C3C3F", 144 "D c #3C3C3F",
145 "E c #ADADB6", 145 "E c #ADADB6",
146 "F c #54555A", 146 "F c #54555A",
147 "G c #8B8C94", 147 "G c #8B8C94",
148 "H c #5A5A5F", 148 "H c #5A5A5F",
149 "I c #BBBBC3", 149 "I c #BBBBC3",
150 "J c #C4C4CB", 150 "J c #C4C4CB",
151 "K c #909098", 151 "K c #909098",
152 "L c #737379", 152 "L c #737379",
153 "M c #343437", 153 "M c #343437",
154 "N c #8F8F98", 154 "N c #8F8F98",
155 "O c #000407", 155 "O c #000407",
156 "P c #2D3137", 156 "P c #2D3137",
157 "Q c #B0B1BC", 157 "Q c #B0B1BC",
158 "R c #3B3C40", 158 "R c #3B3C40",
159 "S c #6E6E74", 159 "S c #6E6E74",
160 "T c #95959C", 160 "T c #95959C",
161 "U c #74747A", 161 "U c #74747A",
162 "V c #1D1D1E", 162 "V c #1D1D1E",
163 "W c #91929A", 163 "W c #91929A",
164 "X c #42444A", 164 "X c #42444A",
165 "Y c #22282E", 165 "Y c #22282E",
166 "Z c #B0B2BC", 166 "Z c #B0B2BC",
167 "` c #898A90", 167 "` c #898A90",
168 " . c #65656A", 168 " . c #65656A",
169 ".. c #999AA2", 169 ".. c #999AA2",
170 "+. c #52535A", 170 "+. c #52535A",
171 "@. c #151B21", 171 "@. c #151B21",
172 "#. c #515257", 172 "#. c #515257",
173 "$. c #B5B5BE", 173 "$. c #B5B5BE",
174 "%. c #616167", 174 "%. c #616167",
175 "&. c #1A1D22", 175 "&. c #1A1D22",
176 "*. c #000713", 176 "*. c #000713",
177 "=. c #1F1F21", 177 "=. c #1F1F21",
178 " ", 178 " ",
179 " . + @ # ", 179 " . + @ # ",
180 " $ % & * = - ", 180 " $ % & * = - ",
181 " ; > , ' ) ! ~ ", 181 " ; > , ' ) ! ~ ",
182 " { ] ^ / ( _ : ", 182 " { ] ^ / ( _ : ",
183 " < [ } | 1 2 3 ", 183 " < [ } | 1 2 3 ",
184 " 4 5 6 7 8 9 0 a b c ", 184 " 4 5 6 7 8 9 0 a b c ",
185 " d e f g h i j 3 k l m n ", 185 " d e f g h i j 3 k l m n ",
186 " o p q r s t u v w n ", 186 " o p q r s t u v w n ",
187 " o x y z A B C D E n ", 187 " o x y z A B C D E n ",
188 " F G H I J K L M N O ", 188 " F G H I J K L M N O ",
189 " P Q R S T U V W X ", 189 " P Q R S T U V W X ",
190 " Y Z ` b ...+. ", 190 " Y Z ` b ...+. ",
191 " @.#.$.%.&. ", 191 " @.#.$.%.&. ",
192 " *.B =. ", 192 " *.B =. ",
193 " n n n n n n n n n "}; 193 " n n n n n n n n n "};
194 194
195 195
196VMemo::VMemo( QWidget *parent, const char *_name ) 196VMemo::VMemo( QWidget *parent, const char *_name )
197 : QWidget( parent, _name ) { 197 : QWidget( parent, _name ) {
198 setFixedHeight( 18 ); 198 setFixedHeight( 18 );
199 setFixedWidth( 14 ); 199 setFixedWidth( 14 );
200 200
201 t_timer = new QTimer( this ); 201 t_timer = new QTimer( this );
202 connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) ); 202 connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) );
203 203
204 Config vmCfg("Vmemo"); 204 Config vmCfg("Vmemo");
205 vmCfg.setGroup("Defaults"); 205 vmCfg.setGroup("Defaults");
206 int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); 206 int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1));
207 useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); 207 useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0);
208 208
209 qDebug("toggleKey %d", toggleKey); 209 qDebug("toggleKey %d", toggleKey);
210 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 210 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
211 systemZaurus=TRUE; 211 systemZaurus=TRUE;
212 else 212 else
213 systemZaurus=FALSE; 213 systemZaurus=FALSE;
214 214
215 myChannel = new QCopChannel( "QPE/VMemo", this ); 215 myChannel = new QCopChannel( "QPE/VMemo", this );
216 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), 216 connect( myChannel, SIGNAL(received(const QCString&,const QByteArray&)),
217 this, SLOT(receive(const QCString&, const QByteArray&)) ); 217 this, SLOT(receive(const QCString&,const QByteArray&)) );
218 218
219 if( toggleKey != -1 ) { 219 if( toggleKey != -1 ) {
220 // keyRegister(key, channel, message) 220 // keyRegister(key, channel, message)
221 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); 221 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)");
222 // e << 4096; // Key_Escape 222 // e << 4096; // Key_Escape
223 // e << Key_F5; //4148 223 // e << Key_F5; //4148
224 e << toggleKey; 224 e << toggleKey;
225 e << QString("QPE/VMemo"); 225 e << QString("QPE/VMemo");
226 e << QString("toggleRecord()"); 226 e << QString("toggleRecord()");
227 } 227 }
228 if(toggleKey == 1) 228 if(toggleKey == 1)
229 usingIcon=TRUE; 229 usingIcon=TRUE;
230 else 230 else
231 usingIcon=FALSE; 231 usingIcon=FALSE;
232 if( vmCfg.readNumEntry("hideIcon",0) == 1) 232 if( vmCfg.readNumEntry("hideIcon",0) == 1)
233 hide(); 233 hide();
234 recording = FALSE; 234 recording = FALSE;
235 // } 235 // }
236} 236}
237 237
238VMemo::~VMemo() { 238VMemo::~VMemo() {
239} 239}
240 240
241int VMemo::position() 241int VMemo::position()
242{ 242{
243 return 6; 243 return 6;
244} 244}
245 245
246void VMemo::receive( const QCString &msg, const QByteArray &data ) { 246void VMemo::receive( const QCString &msg, const QByteArray &data ) {
247 qDebug("receive"); 247 qDebug("receive");
248 QDataStream stream( data, IO_ReadOnly ); 248 QDataStream stream( data, IO_ReadOnly );
249 249
250 if (msg == "toggleRecord()") { 250 if (msg == "toggleRecord()") {
251 if (recording) { 251 if (recording) {
252 fromToggle = TRUE; 252 fromToggle = TRUE;
253 stopRecording(); 253 stopRecording();
254 } else { 254 } else {
255 fromToggle = TRUE; 255 fromToggle = TRUE;
256 startRecording(); 256 startRecording();
257 } 257 }
258 } 258 }
259} 259}
260 260
261void VMemo::paintEvent( QPaintEvent* ) { 261void VMemo::paintEvent( QPaintEvent* ) {
262 QPainter p(this); 262 QPainter p(this);
263 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); 263 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
264} 264}
265 265
266void VMemo::mousePressEvent( QMouseEvent * me) { 266void VMemo::mousePressEvent( QMouseEvent * me) {
267 /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions 267 /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions
268 mousePressEvent and mouseReleaseEvent with a NULL parameter. */ 268 mousePressEvent and mouseReleaseEvent with a NULL parameter. */
269 269
270// if (!systemZaurus && me != NULL) 270// if (!systemZaurus && me != NULL)
271// return; 271// return;
272// } 272// }
273 273
274 if(!recording) 274 if(!recording)
275 startRecording(); 275 startRecording();
276 else 276 else
277 stopRecording(); 277 stopRecording();
278} 278}
279 279
280void VMemo::mouseReleaseEvent( QMouseEvent * ) { 280void VMemo::mouseReleaseEvent( QMouseEvent * ) {
281} 281}
282 282
283bool VMemo::startRecording() { 283bool VMemo::startRecording() {
284 Config config( "Vmemo" ); 284 Config config( "Vmemo" );
285 config.setGroup( "System" ); 285 config.setGroup( "System" );
286 286
287 useAlerts = config.readBoolEntry("Alert",1); 287 useAlerts = config.readBoolEntry("Alert",1);
288 if(useAlerts) { 288 if(useAlerts) {
289 289
290 msgLabel = new QLabel( 0, "alertLabel" ); 290 msgLabel = new QLabel( 0, "alertLabel" );
291 msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); 291 msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>");
292 msgLabel->show(); 292 msgLabel->show();
293 } 293 }
294 294
295 qDebug("Start recording engines"); 295 qDebug("Start recording engines");
296 recording = TRUE; 296 recording = TRUE;
297 297
298 if (openDSP() == -1) { 298 if (openDSP() == -1) {
299 recording = FALSE; 299 recording = FALSE;
300 return FALSE; 300 return FALSE;
301 } 301 }
302 302
303 config.setGroup("Defaults"); 303 config.setGroup("Defaults");
304 304
305 date = TimeString::dateString( QDateTime::currentDateTime(),false,true); 305 date = TimeString::dateString( QDateTime::currentDateTime(),false,true);
306 date.replace(QRegExp("'"),""); 306 date.replace(QRegExp("'"),"");
307 date.replace(QRegExp(" "),"_"); 307 date.replace(QRegExp(" "),"_");
308 date.replace(QRegExp(":"),"."); 308 date.replace(QRegExp(":"),".");
309 date.replace(QRegExp(","),""); 309 date.replace(QRegExp(","),"");
310 310
311 QString fName; 311 QString fName;
312 config.setGroup( "System" ); 312 config.setGroup( "System" );
313 fName = QPEApplication::documentDir() ; 313 fName = QPEApplication::documentDir() ;
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
index 8fd88f6..942cebb 100644
--- a/core/applets/volumeapplet/volume.cpp
+++ b/core/applets/volumeapplet/volume.cpp
@@ -315,213 +315,213 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
315 bassSlider->setMaximumHeight( 40 ); 315 bassSlider->setMaximumHeight( 40 );
316 bassSlider-> setFocusPolicy ( QWidget::NoFocus ); 316 bassSlider-> setFocusPolicy ( QWidget::NoFocus );
317 317
318 QLabel *bassLabel = new QLabel ( this ); 318 QLabel *bassLabel = new QLabel ( this );
319 bassLabel-> setPixmap ( QPixmap ( bass_xpm )); 319 bassLabel-> setPixmap ( QPixmap ( bass_xpm ));
320 320
321 QLabel *trebleLabel = new QLabel( this ); 321 QLabel *trebleLabel = new QLabel( this );
322 trebleLabel->setPixmap( QPixmap ( treble_xpm ) ); 322 trebleLabel->setPixmap( QPixmap ( treble_xpm ) );
323 323
324 grid->addWidget( trebleLabel, 0, 4, AlignCenter ); 324 grid->addWidget( trebleLabel, 0, 4, AlignCenter );
325 grid->addWidget( basstrebleBox, 1, 4, AlignCenter ); 325 grid->addWidget( basstrebleBox, 1, 4, AlignCenter );
326 grid-> addWidget ( bassLabel, 2, 4, AlignCenter ); 326 grid-> addWidget ( bassLabel, 2, 4, AlignCenter );
327 327
328 if ( !has_bass ) { 328 if ( !has_bass ) {
329 bassSlider->hide(); 329 bassSlider->hide();
330 bassLabel->hide(); 330 bassLabel->hide();
331 } 331 }
332 332
333 if ( !has_treble ) { 333 if ( !has_treble ) {
334 trebleSlider->hide(); 334 trebleSlider->hide();
335 trebleLabel->hide(); 335 trebleLabel->hide();
336 } 336 }
337 337
338 micSlider = new QSlider ( this ); 338 micSlider = new QSlider ( this );
339 micSlider-> setRange ( 0, 100 ); 339 micSlider-> setRange ( 0, 100 );
340 micSlider-> setTickmarks ( QSlider::Both ); 340 micSlider-> setTickmarks ( QSlider::Both );
341 micSlider-> setTickInterval ( 20 ); 341 micSlider-> setTickInterval ( 20 );
342 micSlider-> setFocusPolicy ( QWidget::NoFocus ); 342 micSlider-> setFocusPolicy ( QWidget::NoFocus );
343 343
344 l = new QLabel ( this ); 344 l = new QLabel ( this );
345 l-> setPixmap ( QPixmap ( mic_xpm )); 345 l-> setPixmap ( QPixmap ( mic_xpm ));
346 346
347 grid-> addWidget ( l, 0, 2, AlignCenter ); 347 grid-> addWidget ( l, 0, 2, AlignCenter );
348 grid-> addWidget ( micSlider, 1, 2, AlignCenter ); 348 grid-> addWidget ( micSlider, 1, 2, AlignCenter );
349 349
350 micLed = new OLedBox ( red, this ); 350 micLed = new OLedBox ( red, this );
351 micLed-> setFocusPolicy ( QWidget::NoFocus ); 351 micLed-> setFocusPolicy ( QWidget::NoFocus );
352 micLed-> setFixedSize ( 16, 16 ); 352 micLed-> setFixedSize ( 16, 16 );
353 353
354 grid-> addWidget ( micLed, 2, 2, AlignCenter ); 354 grid-> addWidget ( micLed, 2, 2, AlignCenter );
355 355
356 alarmSlider = new QSlider ( this ); 356 alarmSlider = new QSlider ( this );
357 alarmSlider-> setRange ( 0, 100 ); 357 alarmSlider-> setRange ( 0, 100 );
358 alarmSlider-> setTickmarks ( QSlider::Both ); 358 alarmSlider-> setTickmarks ( QSlider::Both );
359 alarmSlider-> setTickInterval ( 20 ); 359 alarmSlider-> setTickInterval ( 20 );
360 alarmSlider-> setFocusPolicy ( QWidget::NoFocus ); 360 alarmSlider-> setFocusPolicy ( QWidget::NoFocus );
361 361
362 QLabel *alarmLabel = new QLabel ( this ); 362 QLabel *alarmLabel = new QLabel ( this );
363 alarmLabel-> setPixmap ( QPixmap ( alarm_xpm )); 363 alarmLabel-> setPixmap ( QPixmap ( alarm_xpm ));
364 364
365 grid-> addWidget ( alarmLabel, 0, 3, AlignCenter ); 365 grid-> addWidget ( alarmLabel, 0, 3, AlignCenter );
366 grid-> addWidget ( alarmSlider, 1, 3, AlignCenter ); 366 grid-> addWidget ( alarmSlider, 1, 3, AlignCenter );
367 367
368 alarmLed = new OLedBox ( yellow, this ); 368 alarmLed = new OLedBox ( yellow, this );
369 alarmLed-> setFocusPolicy ( QWidget::NoFocus ); 369 alarmLed-> setFocusPolicy ( QWidget::NoFocus );
370 alarmLed-> setFixedSize ( 16, 16 ); 370 alarmLed-> setFixedSize ( 16, 16 );
371 371
372 grid-> addWidget ( alarmLed, 2, 3, AlignCenter ); 372 grid-> addWidget ( alarmLed, 2, 3, AlignCenter );
373 373
374 if ( !has_wav_alarm ) { 374 if ( !has_wav_alarm ) {
375 alarmSlider-> hide ( ); 375 alarmSlider-> hide ( );
376 alarmLabel-> hide ( ); 376 alarmLabel-> hide ( );
377 alarmLed-> hide ( ); 377 alarmLed-> hide ( );
378 } 378 }
379 379
380 grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft ); 380 grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft );
381 381
382 vbox = new QVBoxLayout ( ); 382 vbox = new QVBoxLayout ( );
383 vbox-> setSpacing ( 4 ); 383 vbox-> setSpacing ( 4 );
384 grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 ); 384 grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 );
385 385
386 tapBox = new QCheckBox ( tr( "Screen Taps" ), this ); 386 tapBox = new QCheckBox ( tr( "Screen Taps" ), this );
387 tapBox-> setFocusPolicy ( QWidget::NoFocus ); 387 tapBox-> setFocusPolicy ( QWidget::NoFocus );
388 388
389 vbox-> addWidget ( tapBox, AlignVCenter | AlignLeft ); 389 vbox-> addWidget ( tapBox, AlignVCenter | AlignLeft );
390 390
391 keyBox = new QCheckBox ( tr( "Key Clicks" ), this ); 391 keyBox = new QCheckBox ( tr( "Key Clicks" ), this );
392 keyBox-> setFocusPolicy ( QWidget::NoFocus ); 392 keyBox-> setFocusPolicy ( QWidget::NoFocus );
393 393
394 vbox-> addWidget ( keyBox, AlignVCenter | AlignLeft ); 394 vbox-> addWidget ( keyBox, AlignVCenter | AlignLeft );
395 395
396 alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this ); 396 alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this );
397 alarmBox-> setFocusPolicy ( QWidget::NoFocus ); 397 alarmBox-> setFocusPolicy ( QWidget::NoFocus );
398 398
399 vbox-> addWidget ( alarmBox, AlignVCenter | AlignLeft ); 399 vbox-> addWidget ( alarmBox, AlignVCenter | AlignLeft );
400 400
401 if ( has_wav_alarm ) { 401 if ( has_wav_alarm ) {
402 alarmBox-> hide ( ); 402 alarmBox-> hide ( );
403 } 403 }
404 404
405 vbox-> addStretch ( 100 ); 405 vbox-> addStretch ( 100 );
406 406
407 setFixedSize ( sizeHint ( )); 407 setFixedSize ( sizeHint ( ));
408 setFocusPolicy ( QWidget::NoFocus ); 408 setFocusPolicy ( QWidget::NoFocus );
409 409
410 rateTimer = new QTimer( this ); 410 rateTimer = new QTimer( this );
411 connect ( rateTimer, SIGNAL( timeout ( )), this, SLOT( rateTimerDone ( ))); 411 connect ( rateTimer, SIGNAL( timeout()), this, SLOT( rateTimerDone()));
412 412
413 connect ( upButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); 413 connect ( upButton, SIGNAL( pressed()), this, SLOT( buttonChanged()));
414 connect ( upButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); 414 connect ( upButton, SIGNAL( released()), this, SLOT( buttonChanged()));
415 connect ( downButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); 415 connect ( downButton, SIGNAL( pressed()), this, SLOT( buttonChanged()));
416 connect ( downButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); 416 connect ( downButton, SIGNAL( released()), this, SLOT( buttonChanged()));
417 417
418 connect ( micSlider, SIGNAL( valueChanged ( int )), this, SLOT( micMoved( int ))); 418 connect ( micSlider, SIGNAL( valueChanged(int)), this, SLOT( micMoved(int)));
419 connect ( volSlider, SIGNAL( valueChanged ( int )), this, SLOT( volMoved( int ))); 419 connect ( volSlider, SIGNAL( valueChanged(int)), this, SLOT( volMoved(int)));
420 connect ( alarmSlider, SIGNAL( valueChanged ( int )), this, SLOT( alarmMoved( int ))); 420 connect ( alarmSlider, SIGNAL( valueChanged(int)), this, SLOT( alarmMoved(int)));
421 connect ( bassSlider, SIGNAL( valueChanged ( int )), this, SLOT( bassMoved( int ))); 421 connect ( bassSlider, SIGNAL( valueChanged(int)), this, SLOT( bassMoved(int)));
422 connect ( trebleSlider, SIGNAL( valueChanged ( int )), this, SLOT( trebleMoved( int ))); 422 connect ( trebleSlider, SIGNAL( valueChanged(int)), this, SLOT( trebleMoved(int)));
423 423
424 424
425 connect ( volLed, SIGNAL( toggled ( bool )), this, SLOT( volMuteToggled ( bool ))); 425 connect ( volLed, SIGNAL( toggled(bool)), this, SLOT( volMuteToggled(bool)));
426 connect ( micLed, SIGNAL( toggled ( bool )), this, SLOT( micMuteToggled ( bool ))); 426 connect ( micLed, SIGNAL( toggled(bool)), this, SLOT( micMuteToggled(bool)));
427 connect ( alarmLed, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); 427 connect ( alarmLed, SIGNAL( toggled(bool)), this, SLOT( alarmSoundToggled(bool)));
428 428
429 connect ( alarmBox, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); 429 connect ( alarmBox, SIGNAL( toggled(bool)), this, SLOT( alarmSoundToggled(bool)));
430 connect ( keyBox, SIGNAL( toggled ( bool )), this, SLOT( keyClickToggled ( bool ))); 430 connect ( keyBox, SIGNAL( toggled(bool)), this, SLOT( keyClickToggled(bool)));
431 connect ( tapBox, SIGNAL( toggled ( bool )), this, SLOT( screenTapToggled ( bool ))); 431 connect ( tapBox, SIGNAL( toggled(bool)), this, SLOT( screenTapToggled(bool)));
432 432
433 // initialize variables 433 // initialize variables
434 434
435 readConfig ( true ); 435 readConfig ( true );
436 436
437 // initialize the config file, in case some entries are missing 437 // initialize the config file, in case some entries are missing
438 438
439 writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None ); 439 writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None );
440 writeConfigEntry ( "BassPercent", m_vol_percent, UPD_None ); 440 writeConfigEntry ( "BassPercent", m_vol_percent, UPD_None );
441 writeConfigEntry ( "TreblePercent", m_vol_percent, UPD_None ); 441 writeConfigEntry ( "TreblePercent", m_vol_percent, UPD_None );
442 writeConfigEntry ( "Mute", m_vol_muted, UPD_None ); 442 writeConfigEntry ( "Mute", m_vol_muted, UPD_None );
443 writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); 443 writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None );
444 writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None ); 444 writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None );
445 writeConfigEntry ( "KeySound", m_snd_key, UPD_None ); 445 writeConfigEntry ( "KeySound", m_snd_key, UPD_None );
446 writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); 446 writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol );
447 447
448 writeConfigEntry ( "Mic", m_mic_percent, UPD_None ); 448 writeConfigEntry ( "Mic", m_mic_percent, UPD_None );
449 writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); 449 writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic );
450} 450}
451 451
452bool VolumeControl::volMuted ( ) const 452bool VolumeControl::volMuted ( ) const
453{ 453{
454 return m_vol_muted; 454 return m_vol_muted;
455} 455}
456 456
457int VolumeControl::volPercent ( ) const 457int VolumeControl::volPercent ( ) const
458{ 458{
459 return m_vol_percent; 459 return m_vol_percent;
460} 460}
461 461
462void VolumeControl::keyPressEvent ( QKeyEvent *e ) 462void VolumeControl::keyPressEvent ( QKeyEvent *e )
463{ 463{
464 switch ( e-> key ( )) { 464 switch ( e-> key ( )) {
465 case Key_Up: 465 case Key_Up:
466 volSlider-> subtractStep ( ); 466 volSlider-> subtractStep ( );
467 break; 467 break;
468 case Key_Down: 468 case Key_Down:
469 volSlider-> addStep ( ); 469 volSlider-> addStep ( );
470 break; 470 break;
471 case Key_Space: 471 case Key_Space:
472 volLed-> toggle ( ); 472 volLed-> toggle ( );
473 break; 473 break;
474 case Key_Escape: 474 case Key_Escape:
475 hide ( ); 475 hide ( );
476 break; 476 break;
477 } 477 }
478} 478}
479 479
480void VolumeControl::buttonChanged ( ) 480void VolumeControl::buttonChanged ( )
481{ 481{
482 if ( upButton-> isDown ( ) || downButton->isDown ( )) { 482 if ( upButton-> isDown ( ) || downButton->isDown ( )) {
483 rateTimerDone ( ); // Call it one time manually, otherwise it wont get 483 rateTimerDone ( ); // Call it one time manually, otherwise it wont get
484 // called at all when a button is pressed for a time 484 // called at all when a button is pressed for a time
485 // shorter than RATE_TIMER_INTERVAL. 485 // shorter than RATE_TIMER_INTERVAL.
486 rateTimer-> start ( RATE_TIMER_INTERVAL, false ); 486 rateTimer-> start ( RATE_TIMER_INTERVAL, false );
487 } 487 }
488 else 488 else
489 rateTimer-> stop ( ); 489 rateTimer-> stop ( );
490} 490}
491 491
492void VolumeControl::rateTimerDone ( ) 492void VolumeControl::rateTimerDone ( )
493{ 493{
494 if ( upButton-> isDown ( )) 494 if ( upButton-> isDown ( ))
495 volSlider-> setValue ( volSlider-> value ( ) - 2 ); 495 volSlider-> setValue ( volSlider-> value ( ) - 2 );
496 else // if ( downButton-> isDown ( )) 496 else // if ( downButton-> isDown ( ))
497 volSlider-> setValue ( volSlider-> value ( ) + 2 ); 497 volSlider-> setValue ( volSlider-> value ( ) + 2 );
498} 498}
499 499
500void VolumeControl::show ( bool /*showMic*/ ) 500void VolumeControl::show ( bool /*showMic*/ )
501{ 501{
502 readConfig ( ); 502 readConfig ( );
503 503
504 QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 )); 504 QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 ));
505 505
506 int w = sizeHint ( ). width ( ); 506 int w = sizeHint ( ). width ( );
507 int x = curPos.x ( ) - ( w / 2 ); 507 int x = curPos.x ( ) - ( w / 2 );
508 508
509 if (( x + w ) > QPEApplication::desktop ( )-> width ( )) 509 if (( x + w ) > QPEApplication::desktop ( )-> width ( ))
510 x = QPEApplication::desktop ( )-> width ( ) - w; 510 x = QPEApplication::desktop ( )-> width ( ) - w;
511 511
512 move ( x, curPos. y ( ) - sizeHint ( ). height ( )); 512 move ( x, curPos. y ( ) - sizeHint ( ). height ( ));
513 QFrame::show ( ); 513 QFrame::show ( );
514 514
515} 515}
516 516
517void VolumeControl::readConfig ( bool force ) 517void VolumeControl::readConfig ( bool force )
518{ 518{
519 Config cfg ( "qpe" ); 519 Config cfg ( "qpe" );
520 cfg. setGroup ( "Volume" ); 520 cfg. setGroup ( "Volume" );
521 521
522 int old_vp = m_vol_percent; 522 int old_vp = m_vol_percent;
523 int old_mp = m_mic_percent; 523 int old_mp = m_mic_percent;
524 int old_bass = m_bass_percent; 524 int old_bass = m_bass_percent;
525 int old_treble = m_treble_percent; 525 int old_treble = m_treble_percent;
526 bool old_vm = m_vol_muted; 526 bool old_vm = m_vol_muted;
527 bool old_mm = m_mic_muted; 527 bool old_mm = m_mic_muted;
@@ -631,153 +631,153 @@ void VolumeControl::volMoved ( int percent )
631 // clamp volume percent to be between 0 and 100 631 // clamp volume percent to be between 0 and 100
632 m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent ); 632 m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent );
633 // repaint just the little volume rectangle 633 // repaint just the little volume rectangle
634 m_icon-> redraw ( false ); 634 m_icon-> redraw ( false );
635 635
636 writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol ); 636 writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol );
637} 637}
638 638
639void VolumeControl::micMoved ( int percent ) 639void VolumeControl::micMoved ( int percent )
640{ 640{
641 m_mic_percent = 100 - percent; 641 m_mic_percent = 100 - percent;
642 642
643 // clamp volume percent to be between 0 and 100 643 // clamp volume percent to be between 0 and 100
644 m_mic_percent = ( m_mic_percent < 0 ) ? 0 : (( m_mic_percent > 100 ) ? 100 : m_mic_percent ); 644 m_mic_percent = ( m_mic_percent < 0 ) ? 0 : (( m_mic_percent > 100 ) ? 100 : m_mic_percent );
645 645
646 writeConfigEntry ( "Mic", m_mic_percent, UPD_Mic ); 646 writeConfigEntry ( "Mic", m_mic_percent, UPD_Mic );
647} 647}
648 648
649void VolumeControl::alarmMoved ( int percent ) 649void VolumeControl::alarmMoved ( int percent )
650{ 650{
651 m_alarm_percent = 100 - percent; 651 m_alarm_percent = 100 - percent;
652 652
653 // clamp volume percent to be between 0 and 100 653 // clamp volume percent to be between 0 and 100
654 m_alarm_percent = ( m_alarm_percent < 0 ) ? 0 : (( m_alarm_percent > 100 ) ? 100 : m_alarm_percent ); 654 m_alarm_percent = ( m_alarm_percent < 0 ) ? 0 : (( m_alarm_percent > 100 ) ? 100 : m_alarm_percent );
655 655
656 writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); 656 writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None );
657} 657}
658 658
659 659
660void VolumeControl::bassMoved ( int percent ) 660void VolumeControl::bassMoved ( int percent )
661{ 661{
662 m_bass_percent = 100 - percent; 662 m_bass_percent = 100 - percent;
663 663
664 // clamp bass percent to be between 0 and 100 664 // clamp bass percent to be between 0 and 100
665 m_bass_percent = ( m_bass_percent < 0 ) ? 0 : (( m_bass_percent > 100 ) ? 100 : m_bass_percent ); 665 m_bass_percent = ( m_bass_percent < 0 ) ? 0 : (( m_bass_percent > 100 ) ? 100 : m_bass_percent );
666 666
667 writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass ); 667 writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass );
668} 668}
669 669
670 670
671 671
672void VolumeControl::trebleMoved ( int percent ) 672void VolumeControl::trebleMoved ( int percent )
673{ 673{
674 m_treble_percent = 100 - percent; 674 m_treble_percent = 100 - percent;
675 675
676 // clamp treble percent to be between 0 and 100 676 // clamp treble percent to be between 0 and 100
677 m_treble_percent = ( m_treble_percent < 0 ) ? 0 : (( m_treble_percent > 100 ) ? 100 : m_treble_percent ); 677 m_treble_percent = ( m_treble_percent < 0 ) ? 0 : (( m_treble_percent > 100 ) ? 100 : m_treble_percent );
678 678
679 writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble ); 679 writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble );
680} 680}
681 681
682 682
683 683
684void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) 684void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd )
685{ 685{
686 Config cfg ( "qpe" ); 686 Config cfg ( "qpe" );
687 cfg. setGroup ( "Volume" ); 687 cfg. setGroup ( "Volume" );
688 cfg. writeEntry ( entry, val ); 688 cfg. writeEntry ( entry, val );
689// cfg. write ( ); 689// cfg. write ( );
690 690
691#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 691#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
692 switch ( upd ) { 692 switch ( upd ) {
693 case UPD_Vol: { 693 case UPD_Vol: {
694 QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; 694 QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted;
695 break; 695 break;
696 } 696 }
697 case UPD_Mic: { 697 case UPD_Mic: {
698 QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; 698 QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted;
699 break; 699 break;
700 } 700 }
701 case UPD_Bass: { 701 case UPD_Bass: {
702 QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; 702 QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true;
703 break; 703 break;
704 } 704 }
705 case UPD_Treble: { 705 case UPD_Treble: {
706 QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; 706 QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true;
707 break; 707 break;
708 } 708 }
709 709
710 case UPD_None: 710 case UPD_None:
711 break; 711 break;
712 } 712 }
713#endif 713#endif
714} 714}
715 715
716//=========================================================================== 716//===========================================================================
717 717
718VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) 718VolumeApplet::VolumeApplet( QWidget *parent, const char *name )
719 : QWidget( parent, name ) 719 : QWidget( parent, name )
720{ 720{
721 setFixedWidth ( AppLnk::smallIconSize() ); 721 setFixedWidth ( AppLnk::smallIconSize() );
722 setFixedHeight ( AppLnk::smallIconSize()+4 ); 722 setFixedHeight ( AppLnk::smallIconSize()+4 );
723 723
724 m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); 724 m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" ));
725 m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); 725 m_dialog = new VolumeControl ( this, true, this, "volumecontrol" );
726 726
727 connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); 727 connect ( qApp, SIGNAL( volumeChanged(bool)), m_dialog, SLOT( volumeChanged(bool)));
728 connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); 728 connect ( qApp, SIGNAL( micChanged(bool)), m_dialog, SLOT ( micChanged(bool)));
729} 729}
730 730
731VolumeApplet::~VolumeApplet() 731VolumeApplet::~VolumeApplet()
732{ 732{
733 delete m_pixmap; 733 delete m_pixmap;
734} 734}
735 735
736int VolumeApplet::position() 736int VolumeApplet::position()
737{ 737{
738 return 6; 738 return 6;
739} 739}
740 740
741void VolumeApplet::mousePressEvent ( QMouseEvent * ) 741void VolumeApplet::mousePressEvent ( QMouseEvent * )
742{ 742{
743 if ( m_dialog-> isVisible ( )) 743 if ( m_dialog-> isVisible ( ))
744 m_dialog-> hide ( ); 744 m_dialog-> hide ( );
745 else 745 else
746 m_dialog-> show ( true ); 746 m_dialog-> show ( true );
747} 747}
748 748
749void VolumeApplet::redraw ( bool all ) 749void VolumeApplet::redraw ( bool all )
750{ 750{
751 if ( all ) 751 if ( all )
752 repaint ( true ); 752 repaint ( true );
753 else 753 else
754 repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false ); 754 repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false );
755} 755}
756 756
757 757
758void VolumeApplet::paintEvent ( QPaintEvent * ) 758void VolumeApplet::paintEvent ( QPaintEvent * )
759{ 759{
760 QPainter p ( this ); 760 QPainter p ( this );
761 761
762 p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap ); 762 p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap );
763 p. setPen ( darkGray ); 763 p. setPen ( darkGray );
764 p. drawRect ( 1, height() - 4, width() - 2, 4 ); 764 p. drawRect ( 1, height() - 4, width() - 2, 4 );
765 765
766 int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; 766 int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100;
767 p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); 767 p. fillRect ( 2, height() - 3, pixelsWide, 2, red );
768 p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); 768 p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray );
769 769
770 if ( m_dialog-> volMuted ( )) { 770 if ( m_dialog-> volMuted ( )) {
771 p. setPen ( red ); 771 p. setPen ( red );
772 p. drawLine ( 1, 2, width() - 2, height() - 5 ); 772 p. drawLine ( 1, 2, width() - 2, height() - 5 );
773 p. drawLine ( 1, 3, width() - 2, height() - 4 ); 773 p. drawLine ( 1, 3, width() - 2, height() - 4 );
774 p. drawLine ( width() - 2, 2, 1, height() - 5 ); 774 p. drawLine ( width() - 2, 2, 1, height() - 5 );
775 p. drawLine ( width() - 2, 3, 1, height() - 4 ); 775 p. drawLine ( width() - 2, 3, 1, height() - 4 );
776 } 776 }
777} 777}
778 778
779 779
780Q_EXPORT_INTERFACE() 780Q_EXPORT_INTERFACE()
781{ 781{
782 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VolumeApplet> ); 782 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VolumeApplet> );
783} 783}