summaryrefslogtreecommitdiff
path: root/core
Unidiff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp11
-rw-r--r--core/applets/clipboardapplet/clipboard.h1
-rw-r--r--core/applets/clipboardapplet/clipboardapplet.pro4
-rw-r--r--core/applets/clipboardapplet/clipboardappletimpl.cpp66
-rw-r--r--core/applets/clipboardapplet/clipboardappletimpl.h43
-rw-r--r--core/applets/clockapplet/clock.cpp12
-rw-r--r--core/applets/clockapplet/clock.h1
-rw-r--r--core/applets/clockapplet/clockapplet.pro4
-rw-r--r--core/applets/clockapplet/clockappletimpl.cpp67
-rw-r--r--core/applets/clockapplet/clockappletimpl.h45
-rw-r--r--core/applets/irdaapplet/irda.cpp17
-rw-r--r--core/applets/irdaapplet/irda.h1
-rw-r--r--core/applets/irdaapplet/irdaapplet.pro14
-rw-r--r--core/applets/irdaapplet/irdaappletimpl.cpp66
-rw-r--r--core/applets/irdaapplet/irdaappletimpl.h45
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp25
-rw-r--r--core/applets/screenshotapplet/screenshot.h1
-rw-r--r--core/applets/screenshotapplet/screenshotapplet.pro6
-rw-r--r--core/applets/screenshotapplet/screenshotappletimpl.cpp66
-rw-r--r--core/applets/screenshotapplet/screenshotappletimpl.h43
-rw-r--r--core/applets/vmemo/vmemo.cpp12
-rw-r--r--core/applets/vmemo/vmemo.h1
-rw-r--r--core/applets/vmemo/vmemo.pro4
-rw-r--r--core/applets/vmemo/vmemoimpl.cpp61
-rw-r--r--core/applets/vmemo/vmemoimpl.h40
-rw-r--r--core/applets/volumeapplet/volume.cpp20
-rw-r--r--core/applets/volumeapplet/volume.h1
-rw-r--r--core/applets/volumeapplet/volumeapplet.pro4
-rw-r--r--core/applets/volumeapplet/volumeappletimpl.cpp65
-rw-r--r--core/applets/volumeapplet/volumeappletimpl.h43
-rw-r--r--core/obex/obex.pro6
31 files changed, 107 insertions, 688 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index bb0db9b..34d151e 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -1,178 +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 <qpe/resource.h> 24#include <qpe/resource.h>
24#include <qpe/applnk.h> 25#include <qpe/applnk.h>
25 26
26#include <qpainter.h> 27#include <qpainter.h>
27#include <qpopupmenu.h> 28#include <qpopupmenu.h>
28#include <qwindowsystem_qws.h> 29#include <qwindowsystem_qws.h>
29#include <qapplication.h> 30#include <qapplication.h>
30#include <qclipboard.h> 31#include <qclipboard.h>
31#include <qtimer.h> 32#include <qtimer.h>
32 33
33//=========================================================================== 34//===========================================================================
34 35
35 36
36ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) 37ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name )
37{ 38{
38 setFixedWidth ( AppLnk::smallIconSize() ); 39 setFixedWidth ( AppLnk::smallIconSize() );
39 setFixedHeight ( AppLnk::smallIconSize() ); 40 setFixedHeight ( AppLnk::smallIconSize() );
40 41
41 QImage img = Resource::loadImage( "paste"); 42 QImage img = Resource::loadImage( "paste");
42 img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 43 img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
43 44
44 m_clipboardPixmap.convertFromImage( img ); 45 m_clipboardPixmap.convertFromImage( img );
45 46
46 m_timer = new QTimer ( this ); 47 m_timer = new QTimer ( this );
47 48
48 connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); 49 connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( )));
49 connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); 50 connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( )));
50 connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); 51 connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( )));
51 52
52 m_menu = 0; 53 m_menu = 0;
53 m_dirty = true; 54 m_dirty = true;
54 m_lasttext = QString::null; 55 m_lasttext = QString::null;
55 56
56 m_timer-> start ( 0, true ); 57 m_timer-> start ( 0, true );
57} 58}
58 59
59ClipboardApplet::~ClipboardApplet ( ) 60ClipboardApplet::~ClipboardApplet ( )
60{ 61{
61} 62}
62 63
64int ClipboardApplet::position()
65{
66 return 6;
67}
68
63void ClipboardApplet::shutdown ( ) 69void ClipboardApplet::shutdown ( )
64{ 70{
65 // 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()
66 // see launcher/desktop.cpp 72 // see launcher/desktop.cpp
67 73
68 m_timer-> stop ( ); 74 m_timer-> stop ( );
69} 75}
70 76
71void ClipboardApplet::mousePressEvent ( QMouseEvent *) 77void ClipboardApplet::mousePressEvent ( QMouseEvent *)
72{ 78{
73 if ( m_dirty ) { 79 if ( m_dirty ) {
74 delete m_menu; 80 delete m_menu;
75 81
76 m_menu = new QPopupMenu ( this ); 82 m_menu = new QPopupMenu ( this );
77 m_menu-> setCheckable ( true ); 83 m_menu-> setCheckable ( true );
78 84
79 if ( m_history. count ( )) { 85 if ( m_history. count ( )) {
80 for ( unsigned int i = 0; i < m_history. count ( ); i++ ) { 86 for ( unsigned int i = 0; i < m_history. count ( ); i++ ) {
81 QString str = m_history [i]; 87 QString str = m_history [i];
82 88
83 if ( str. length ( ) > 20 ) 89 if ( str. length ( ) > 20 )
84 str = str. left ( 20 ) + "..."; 90 str = str. left ( 20 ) + "...";
85 91
86 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 );
87 m_menu-> setItemChecked ( i, false ); 93 m_menu-> setItemChecked ( i, false );
88 } 94 }
89 m_menu-> setItemChecked ( m_history. count ( ) - 1, true ); 95 m_menu-> setItemChecked ( m_history. count ( ) - 1, true );
90 m_menu-> insertSeparator ( ); 96 m_menu-> insertSeparator ( );
91 } 97 }
92 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 ); 98 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 );
93 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 ); 99 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 );
94 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 ); 100 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 );
95 101
96 connect ( m_menu, SIGNAL( activated ( int )), this, SLOT( action ( int ))); 102 connect ( m_menu, SIGNAL( activated ( int )), this, SLOT( action ( int )));
97 103
98 m_dirty = false; 104 m_dirty = false;
99 } 105 }
100 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 106 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
101 QSize s = m_menu-> sizeHint ( ); 107 QSize s = m_menu-> sizeHint ( );
102 108
103 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 ( )));
104} 110}
105 111
106void ClipboardApplet::action(int id) 112void ClipboardApplet::action(int id)
107{ 113{
108 ushort unicode = 0; 114 ushort unicode = 0;
109 int scan = 0; 115 int scan = 0;
110 116
111 switch ( id ) { 117 switch ( id ) {
112 case 100: 118 case 100:
113 unicode = 'X' - '@'; 119 unicode = 'X' - '@';
114 scan = Key_X; // Cut 120 scan = Key_X; // Cut
115 break; 121 break;
116 case 101: 122 case 101:
117 unicode = 'C' - '@'; 123 unicode = 'C' - '@';
118 scan = Key_C; // Copy 124 scan = Key_C; // Copy
119 break; 125 break;
120 case 102: 126 case 102:
121 unicode = 'V' - '@'; 127 unicode = 'V' - '@';
122 scan = Key_V; // Paste 128 scan = Key_V; // Paste
123 break; 129 break;
124 130
125 default: 131 default:
126 if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) { 132 if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) {
127 QApplication::clipboard ( )-> setText ( m_history [id] ); 133 QApplication::clipboard ( )-> setText ( m_history [id] );
128 134
129 for ( uint i = 0; i < m_history. count ( ); i++ ) 135 for ( uint i = 0; i < m_history. count ( ); i++ )
130 m_menu-> setItemChecked ( i, i == uint( id )); 136 m_menu-> setItemChecked ( i, i == uint( id ));
131 137
132 unicode = 'V' - '@'; 138 unicode = 'V' - '@';
133 scan = Key_V; 139 scan = Key_V;
134 } 140 }
135 break; 141 break;
136 } 142 }
137 143
138 if ( scan ) { 144 if ( scan ) {
139 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); 145 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false );
140 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); 146 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false );
141 } 147 }
142} 148}
143 149
144void ClipboardApplet::paintEvent ( QPaintEvent* ) 150void ClipboardApplet::paintEvent ( QPaintEvent* )
145{ 151{
146 QPainter p ( this ); 152 QPainter p ( this );
147 /* 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 ;)*/
148 p. drawPixmap( 0, 0, 154 p. drawPixmap( 0, 0,
149 m_clipboardPixmap ); 155 m_clipboardPixmap );
150} 156}
151 157
152void ClipboardApplet::newData ( ) 158void ClipboardApplet::newData ( )
153{ 159{
154 static bool excllock = false; 160 static bool excllock = false;
155 161
156 if ( excllock ) 162 if ( excllock )
157 return; 163 return;
158 else 164 else
159 excllock = true; 165 excllock = true;
160 166
161 m_timer-> stop ( ); 167 m_timer-> stop ( );
162 168
163 QCString type = "plain"; 169 QCString type = "plain";
164 QString txt = QApplication::clipboard ( )-> text ( type ); 170 QString txt = QApplication::clipboard ( )-> text ( type );
165 171
166 if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { 172 if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) {
167 m_history. append ( txt ); 173 m_history. append ( txt );
168 174
169 if ( m_history. count ( ) > 5 ) 175 if ( m_history. count ( ) > 5 )
170 m_history. remove ( m_history. begin ( )); 176 m_history. remove ( m_history. begin ( ));
171 177
172 m_dirty = true; 178 m_dirty = true;
173 } 179 }
174 180
175 m_timer-> start ( 1500, true ); 181 m_timer-> start ( 1500, true );
176 182
177 excllock = false; 183 excllock = false;
178} 184}
185
186Q_EXPORT_INTERFACE()
187{
188 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ClipboardApplet> );
189}
diff --git a/core/applets/clipboardapplet/clipboard.h b/core/applets/clipboardapplet/clipboard.h
index ec87d39..bbda0ff 100644
--- a/core/applets/clipboardapplet/clipboard.h
+++ b/core/applets/clipboardapplet/clipboard.h
@@ -1,57 +1,58 @@
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#ifndef __CLIPBOARD_APPLET_H__ 20#ifndef __CLIPBOARD_APPLET_H__
21#define __CLIPBOARD_APPLET_H__ 21#define __CLIPBOARD_APPLET_H__
22 22
23#include <qwidget.h> 23#include <qwidget.h>
24#include <qpixmap.h> 24#include <qpixmap.h>
25#include <qstringlist.h> 25#include <qstringlist.h>
26 26
27class QTimer; 27class QTimer;
28 28
29class ClipboardApplet : public QWidget 29class ClipboardApplet : public QWidget
30{ 30{
31 Q_OBJECT 31 Q_OBJECT
32public: 32public:
33 ClipboardApplet ( QWidget *parent = 0, const char *name=0 ); 33 ClipboardApplet ( QWidget *parent = 0, const char *name=0 );
34 ~ClipboardApplet ( ); 34 ~ClipboardApplet ( );
35 static int position();
35 36
36protected: 37protected:
37 void mousePressEvent ( QMouseEvent *); 38 void mousePressEvent ( QMouseEvent *);
38 void paintEvent ( QPaintEvent* ); 39 void paintEvent ( QPaintEvent* );
39 40
40private slots: 41private slots:
41 void action ( int ); 42 void action ( int );
42 void newData ( ); 43 void newData ( );
43 void shutdown ( ); 44 void shutdown ( );
44 45
45private: 46private:
46 QPopupMenu * m_menu; 47 QPopupMenu * m_menu;
47 QStringList m_history; 48 QStringList m_history;
48 bool m_dirty; 49 bool m_dirty;
49 QString m_lasttext; 50 QString m_lasttext;
50 QTimer * m_timer; 51 QTimer * m_timer;
51 52
52 QPixmap m_clipboardPixmap; 53 QPixmap m_clipboardPixmap;
53}; 54};
54 55
55 56
56#endif // __CLIPBOARD_APPLET_H__ 57#endif // __CLIPBOARD_APPLET_H__
57 58
diff --git a/core/applets/clipboardapplet/clipboardapplet.pro b/core/applets/clipboardapplet/clipboardapplet.pro
index f6842a2..74cf48c 100644
--- a/core/applets/clipboardapplet/clipboardapplet.pro
+++ b/core/applets/clipboardapplet/clipboardapplet.pro
@@ -1,13 +1,13 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt plugin warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= clipboard.h clipboardappletimpl.h 3 HEADERS = clipboard.h
4 SOURCES= clipboard.cpp clipboardappletimpl.cpp 4 SOURCES = clipboard.cpp
5 TARGET = clipboardapplet 5 TARGET = clipboardapplet
6 DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets
diff --git a/core/applets/clipboardapplet/clipboardappletimpl.cpp b/core/applets/clipboardapplet/clipboardappletimpl.cpp
deleted file mode 100644
index f454529..0000000
--- a/core/applets/clipboardapplet/clipboardappletimpl.cpp
+++ b/dev/null
@@ -1,66 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "clipboard.h"
21#include "clipboardappletimpl.h"
22
23
24ClipboardAppletImpl::ClipboardAppletImpl()
25 : clipboard(0)
26{
27}
28
29ClipboardAppletImpl::~ClipboardAppletImpl()
30{
31 delete clipboard;
32}
33
34QWidget *ClipboardAppletImpl::applet( QWidget *parent )
35{
36 if ( !clipboard )
37 clipboard = new ClipboardApplet( parent );
38 return clipboard;
39}
40
41int ClipboardAppletImpl::position() const
42{
43 return 6;
44}
45
46QRESULT ClipboardAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
47{
48 *iface = 0;
49 if ( uuid == IID_QUnknown )
50 *iface = this;
51 else if ( uuid == IID_TaskbarApplet )
52 *iface = this;
53 else
54 return QS_FALSE;
55
56 if ( *iface )
57 (*iface)->addRef();
58 return QS_OK;
59}
60
61Q_EXPORT_INTERFACE()
62{
63 Q_CREATE_INSTANCE( ClipboardAppletImpl )
64}
65
66
diff --git a/core/applets/clipboardapplet/clipboardappletimpl.h b/core/applets/clipboardapplet/clipboardappletimpl.h
deleted file mode 100644
index 497360c..0000000
--- a/core/applets/clipboardapplet/clipboardappletimpl.h
+++ b/dev/null
@@ -1,43 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef CLIPBOARDAPPLETIMPL_H
21#define CLIPBOARDAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class ClipboardApplet;
26
27class ClipboardAppletImpl : public TaskbarAppletInterface
28{
29public:
30 ClipboardAppletImpl();
31 virtual ~ClipboardAppletImpl();
32
33 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
34 Q_REFCOUNT
35
36 virtual QWidget *applet( QWidget *parent );
37 virtual int position() const;
38
39private:
40 ClipboardApplet *clipboard;
41};
42
43#endif
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp
index aadd9b6..9fead03 100644
--- a/core/applets/clockapplet/clock.cpp
+++ b/core/applets/clockapplet/clock.cpp
@@ -1,109 +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 <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
24#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
25#include <qpe/config.h> 26#include <qpe/config.h>
26 27
27LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) 28LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent )
28{ 29{
29 // If you want a sunken border around the clock do this: 30 // If you want a sunken border around the clock do this:
30 // setFrameStyle( QFrame::Panel | QFrame::Sunken ); 31 // setFrameStyle( QFrame::Panel | QFrame::Sunken );
31 //setFont( QFont( "Helvetica", , QFont::Normal ) ); 32 //setFont( QFont( "Helvetica", , QFont::Normal ) );
32 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); 33 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) );
33 connect( qApp, SIGNAL( clockChanged( bool ) ), 34 connect( qApp, SIGNAL( clockChanged( bool ) ),
34 this, SLOT( slotClockChanged( bool ) ) ); 35 this, SLOT( slotClockChanged( bool ) ) );
35 readConfig(); 36 readConfig();
36 timerId = 0; 37 timerId = 0;
37 timerEvent( 0 ); 38 timerEvent( 0 );
38 show(); 39 show();
39} 40}
40 41
42int LauncherClock::position()
43{
44 return 10;
45}
46
41void LauncherClock::readConfig() { 47void LauncherClock::readConfig() {
42 Config config( "qpe" ); 48 Config config( "qpe" );
43 config.setGroup( "Time" ); 49 config.setGroup( "Time" );
44 ampmFormat = config.readBoolEntry( "AMPM", TRUE ); 50 ampmFormat = config.readBoolEntry( "AMPM", TRUE );
45 config.setGroup( "Date" ); 51 config.setGroup( "Date" );
46 format = config.readNumEntry("ClockApplet",0); 52 format = config.readNumEntry("ClockApplet",0);
47} 53}
48 54
49void LauncherClock::mouseReleaseEvent( QMouseEvent * ) 55void LauncherClock::mouseReleaseEvent( QMouseEvent * )
50{ 56{
51 QCString setTimeApp; 57 QCString setTimeApp;
52 setTimeApp="systemtime"; 58 setTimeApp="systemtime";
53 QCopEnvelope e("QPE/Application/"+setTimeApp, "raise()"); 59 QCopEnvelope e("QPE/Application/"+setTimeApp, "raise()");
54} 60}
55 61
56 62
57void LauncherClock::timerEvent( QTimerEvent *e ) 63void LauncherClock::timerEvent( QTimerEvent *e )
58{ 64{
59 if ( !e || e->timerId() == timerId ) { 65 if ( !e || e->timerId() == timerId ) {
60 killTimer( timerId ); 66 killTimer( timerId );
61 changeTime(); 67 changeTime();
62 QTime t = QTime::currentTime(); 68 QTime t = QTime::currentTime();
63 int ms = (60 - t.second())*1000 - t.msec(); 69 int ms = (60 - t.second())*1000 - t.msec();
64 timerId = startTimer( ms ); 70 timerId = startTimer( ms );
65 } else { 71 } else {
66 QLabel::timerEvent( e ); 72 QLabel::timerEvent( e );
67 } 73 }
68} 74}
69 75
70void LauncherClock::updateTime( void ) 76void LauncherClock::updateTime( void )
71{ 77{
72 changeTime(); 78 changeTime();
73} 79}
74 80
75void LauncherClock::changeTime( void ) 81void LauncherClock::changeTime( void )
76{ 82{
77 QTime tm = QDateTime::currentDateTime().time(); 83 QTime tm = QDateTime::currentDateTime().time();
78 QString s; 84 QString s;
79 if( ampmFormat ) { 85 if( ampmFormat ) {
80 int hour = tm.hour(); 86 int hour = tm.hour();
81 if (hour == 0) 87 if (hour == 0)
82 hour = 12; 88 hour = 12;
83 if (hour > 12) 89 if (hour > 12)
84 hour -= 12; 90 hour -= 12;
85 s.sprintf( "%2d:%02d %s", hour, tm.minute(), 91 s.sprintf( "%2d:%02d %s", hour, tm.minute(),
86 (tm.hour() >= 12) ? "PM" : "AM" ); 92 (tm.hour() >= 12) ? "PM" : "AM" );
87 } else 93 } else
88 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); 94 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
89 95
90 if (format==1) { 96 if (format==1) {
91 QDate dm = QDate::currentDate(); 97 QDate dm = QDate::currentDate();
92 QString d; 98 QString d;
93 d.sprintf("%d/%d ", dm.day(), dm.month()); 99 d.sprintf("%d/%d ", dm.day(), dm.month());
94 setText( d+s ); 100 setText( d+s );
95 } else if (format==2) { 101 } else if (format==2) {
96 QDate dm = QDate::currentDate(); 102 QDate dm = QDate::currentDate();
97 QString d; 103 QString d;
98 d.sprintf("%d/%d ", dm.month(), dm.day()); 104 d.sprintf("%d/%d ", dm.month(), dm.day());
99 setText( d+s ); 105 setText( d+s );
100 } else { 106 } else {
101 setText( s ); 107 setText( s );
102 } 108 }
103} 109}
104 110
105void LauncherClock::slotClockChanged( bool pm ) 111void LauncherClock::slotClockChanged( bool pm )
106{ 112{
107 readConfig(); 113 readConfig();
108 updateTime(); 114 updateTime();
109} 115}
116
117Q_EXPORT_INTERFACE()
118{
119 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<LauncherClock> );
120}
121
diff --git a/core/applets/clockapplet/clock.h b/core/applets/clockapplet/clock.h
index caa0c5f..996fb56 100644
--- a/core/applets/clockapplet/clock.h
+++ b/core/applets/clockapplet/clock.h
@@ -1,48 +1,49 @@
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#ifndef __LAUNCHER_CLOCK_H__ 20#ifndef __LAUNCHER_CLOCK_H__
21#define __LAUNCHER_CLOCK_H__ 21#define __LAUNCHER_CLOCK_H__
22 22
23 23
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26 26
27class LauncherClock : public QLabel 27class LauncherClock : public QLabel
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30public: 30public:
31 LauncherClock( QWidget *parent ); 31 LauncherClock( QWidget *parent );
32 static int position();
32 33
33protected slots: 34protected slots:
34 void updateTime( void ); 35 void updateTime( void );
35 void slotClockChanged( bool pm ); 36 void slotClockChanged( bool pm );
36 37
37protected: 38protected:
38 void mouseReleaseEvent( QMouseEvent * ); 39 void mouseReleaseEvent( QMouseEvent * );
39 void timerEvent( QTimerEvent * ); 40 void timerEvent( QTimerEvent * );
40 void changeTime( void ); 41 void changeTime( void );
41 void readConfig(); 42 void readConfig();
42 bool ampmFormat; 43 bool ampmFormat;
43 int timerId; 44 int timerId;
44 int format; 45 int format;
45}; 46};
46 47
47 48
48#endif // __LAUNCHER_CLOCK_H__ 49#endif // __LAUNCHER_CLOCK_H__
diff --git a/core/applets/clockapplet/clockapplet.pro b/core/applets/clockapplet/clockapplet.pro
index 057e332..8ce3f6f 100644
--- a/core/applets/clockapplet/clockapplet.pro
+++ b/core/applets/clockapplet/clockapplet.pro
@@ -1,13 +1,13 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt plugin warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= clock.h clockappletimpl.h 3 HEADERS = clock.h
4 SOURCES= clock.cpp clockappletimpl.cpp 4 SOURCES = clock.cpp
5 TARGET = clockapplet 5 TARGET = clockapplet
6 DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include .. 8DEPENDPATH += ../$(OPIEDIR)/include ..
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets
diff --git a/core/applets/clockapplet/clockappletimpl.cpp b/core/applets/clockapplet/clockappletimpl.cpp
deleted file mode 100644
index 7481f19..0000000
--- a/core/applets/clockapplet/clockappletimpl.cpp
+++ b/dev/null
@@ -1,67 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "clock.h"
21#include "clockappletimpl.h"
22
23
24ClockAppletImpl::ClockAppletImpl()
25 : clock(0)
26{
27}
28
29ClockAppletImpl::~ClockAppletImpl()
30{
31 delete clock;
32}
33
34QWidget *ClockAppletImpl::applet( QWidget *parent )
35{
36 if ( !clock )
37 clock = new LauncherClock( parent );
38 return clock;
39}
40
41int ClockAppletImpl::position() const
42{
43 return 10;
44}
45
46#ifndef QT_NO_COMPONENT
47QRESULT ClockAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
48{
49 *iface = 0;
50 if ( uuid == IID_QUnknown )
51 *iface = this;
52 else if ( uuid == IID_TaskbarApplet )
53 *iface = this;
54 else
55 return QS_FALSE;
56
57 if ( *iface )
58 (*iface)->addRef();
59 return QS_OK;
60}
61
62Q_EXPORT_INTERFACE()
63{
64 Q_CREATE_INSTANCE( ClockAppletImpl )
65}
66#endif
67
diff --git a/core/applets/clockapplet/clockappletimpl.h b/core/applets/clockapplet/clockappletimpl.h
deleted file mode 100644
index 1f9c8f0..0000000
--- a/core/applets/clockapplet/clockappletimpl.h
+++ b/dev/null
@@ -1,45 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef CLOCKAPPLETIMPL_H
21#define CLOCKAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class LauncherClock;
26
27class ClockAppletImpl : public TaskbarAppletInterface
28{
29public:
30 ClockAppletImpl();
31 virtual ~ClockAppletImpl();
32
33#ifndef QT_NO_COMPONENT
34 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
35 Q_REFCOUNT
36#endif
37
38 virtual QWidget *applet( QWidget *parent );
39 virtual int position() const;
40
41private:
42 LauncherClock *clock;
43};
44
45#endif
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index a47f33d..afc0592 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -1,158 +1,166 @@
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 18
19/* OPIE */
20#include <opie2/otaskbarapplet.h>
18#include <qpe/resource.h> 21#include <qpe/resource.h>
19#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
20 23
24/* QT */
21#include <qpainter.h> 25#include <qpainter.h>
22#include <qfile.h> 26#include <qfile.h>
23#include <qtimer.h> 27#include <qtimer.h>
24#include <qtextstream.h> 28#include <qtextstream.h>
25 29
30/* STD */
26#include <unistd.h> 31#include <unistd.h>
27#include <net/if.h> 32#include <net/if.h>
28#include <netinet/in.h> 33#include <netinet/in.h>
29#include <sys/types.h> 34#include <sys/types.h>
30#include <sys/socket.h> 35#include <sys/socket.h>
31#include <sys/ioctl.h> 36#include <sys/ioctl.h>
32 37
33#include "irda.h"
34
35//=========================================================================== 38//===========================================================================
36 39
37IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) 40IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
38 : QWidget ( parent, name ) 41 : QWidget ( parent, name )
39{ 42{
40 setFixedHeight ( 18 ); 43 setFixedHeight ( 18 );
41 setFixedWidth ( 14 ); 44 setFixedWidth ( 14 );
42 45
43 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); 46 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP );
44 47
45 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); 48 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" );
46 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); 49 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" );
47 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); 50 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" );
48 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); 51 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" );
49 52
50 m_irda_active = false; 53 m_irda_active = false;
51 m_irda_discovery_active = false; 54 m_irda_discovery_active = false;
52 m_receive_active = false; 55 m_receive_active = false;
53 m_receive_state_changed = false; 56 m_receive_state_changed = false;
54 m_popup = 0; 57 m_popup = 0;
55 m_wasOn = false; 58 m_wasOn = false;
56 m_wasDiscover = false; 59 m_wasDiscover = false;
57 60
58 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); 61 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this );
59 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 62 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
60 this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) ); 63 this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) );
61} 64}
62 65
66int IrdaApplet::position()
67{
68 return 6;
69}
70
63void IrdaApplet::show() 71void IrdaApplet::show()
64{ 72{
65 QWidget::show ( ); 73 QWidget::show ( );
66 startTimer ( 2000 ); 74 startTimer ( 2000 );
67} 75}
68 76
69IrdaApplet::~IrdaApplet() 77IrdaApplet::~IrdaApplet()
70{ 78{
71 if ( m_sockfd >= 0 ) 79 if ( m_sockfd >= 0 )
72 ::close ( m_sockfd ); 80 ::close ( m_sockfd );
73} 81}
74 82
75void IrdaApplet::popup ( QString message, QString icon ) 83void IrdaApplet::popup ( QString message, QString icon )
76{ 84{
77 if ( !m_popup ) 85 if ( !m_popup )
78 m_popup = new QPopupMenu ( this ); 86 m_popup = new QPopupMenu ( this );
79 87
80 m_popup-> clear ( ); 88 m_popup-> clear ( );
81 89
82 if ( icon. isEmpty ( )) 90 if ( icon. isEmpty ( ))
83 m_popup-> insertItem ( message, 0 ); 91 m_popup-> insertItem ( message, 0 );
84 else 92 else
85 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); 93 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 );
86 94
87 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 95 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
88 QSize s = m_popup-> sizeHint ( ); 96 QSize s = m_popup-> sizeHint ( );
89 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), 97 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ),
90 p. y ( ) - s. height ( ))); 98 p. y ( ) - s. height ( )));
91 99
92 QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( ))); 100 QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( )));
93} 101}
94 102
95void IrdaApplet::popupTimeout ( ) 103void IrdaApplet::popupTimeout ( )
96{ 104{
97 m_popup-> hide ( ); 105 m_popup-> hide ( );
98} 106}
99 107
100bool IrdaApplet::checkIrdaStatus ( ) 108bool IrdaApplet::checkIrdaStatus ( )
101{ 109{
102 struct ifreq ifr; 110 struct ifreq ifr;
103 strcpy ( ifr. ifr_name, "irda0" ); 111 strcpy ( ifr. ifr_name, "irda0" );
104 112
105 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 113 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
106 return false; 114 return false;
107 115
108 return ( ifr. ifr_flags & IFF_UP ); 116 return ( ifr. ifr_flags & IFF_UP );
109} 117}
110 118
111bool IrdaApplet::setIrdaStatus ( bool b ) 119bool IrdaApplet::setIrdaStatus ( bool b )
112{ 120{
113 struct ifreq ifr; 121 struct ifreq ifr;
114 strcpy ( ifr. ifr_name, "irda0" ); 122 strcpy ( ifr. ifr_name, "irda0" );
115 123
116 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 124 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
117 return false; 125 return false;
118 126
119 if ( b ) { 127 if ( b ) {
120 ifr. ifr_flags |= IFF_UP; 128 ifr. ifr_flags |= IFF_UP;
121 } 129 }
122 else { 130 else {
123 setIrdaDiscoveryStatus ( 0 ); 131 setIrdaDiscoveryStatus ( 0 );
124 setIrdaReceiveStatus ( 0 ); 132 setIrdaReceiveStatus ( 0 );
125 ifr. ifr_flags &= ~IFF_UP; 133 ifr. ifr_flags &= ~IFF_UP;
126 } 134 }
127 135
128 if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 ) 136 if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 )
129 return false; 137 return false;
130 138
131 return true; 139 return true;
132} 140}
133 141
134bool IrdaApplet::checkIrdaDiscoveryStatus ( ) 142bool IrdaApplet::checkIrdaDiscoveryStatus ( )
135{ 143{
136 QFile discovery ( "/proc/sys/net/irda/discovery" ); 144 QFile discovery ( "/proc/sys/net/irda/discovery" );
137 145
138 QString streamIn = "0"; 146 QString streamIn = "0";
139 147
140 if ( discovery. open ( IO_ReadOnly )) { 148 if ( discovery. open ( IO_ReadOnly )) {
141 QTextStream stream ( &discovery ); 149 QTextStream stream ( &discovery );
142 streamIn = stream. read ( ); 150 streamIn = stream. read ( );
143 } 151 }
144 152
145 return streamIn. toInt ( ) > 0; 153 return streamIn. toInt ( ) > 0;
146} 154}
147 155
148 156
149bool IrdaApplet::setIrdaDiscoveryStatus ( bool d ) 157bool IrdaApplet::setIrdaDiscoveryStatus ( bool d )
150{ 158{
151 QFile discovery ( "/proc/sys/net/irda/discovery" ); 159 QFile discovery ( "/proc/sys/net/irda/discovery" );
152 160
153 if ( discovery. open ( IO_WriteOnly | IO_Raw )) { 161 if ( discovery. open ( IO_WriteOnly | IO_Raw )) {
154 discovery.putch ( d ? '1' : '0' ); 162 discovery.putch ( d ? '1' : '0' );
155 return true; 163 return true;
156 } 164 }
157 return false; 165 return false;
158} 166}
@@ -257,96 +265,101 @@ void IrdaApplet::mousePressEvent ( QMouseEvent * )
257 if ( m_irda_active ) { 265 if ( m_irda_active ) {
258 menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 ); 266 menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 );
259 menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 ); 267 menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 );
260 } 268 }
261 269
262 QPoint p = mapToGlobal ( QPoint ( 0, 0 ) ); 270 QPoint p = mapToGlobal ( QPoint ( 0, 0 ) );
263 QSize s = menu-> sizeHint ( ); 271 QSize s = menu-> sizeHint ( );
264 272
265 p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )); 273 p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ));
266 274
267 switch ( menu-> exec ( p )) { 275 switch ( menu-> exec ( p )) {
268 case 0: 276 case 0:
269 setIrdaStatus ( !m_irda_active ); 277 setIrdaStatus ( !m_irda_active );
270 timerEvent ( 0 ); 278 timerEvent ( 0 );
271 break; 279 break;
272 case 1: 280 case 1:
273 setIrdaDiscoveryStatus ( !m_irda_discovery_active ); 281 setIrdaDiscoveryStatus ( !m_irda_discovery_active );
274 timerEvent ( 0 ); 282 timerEvent ( 0 );
275 break; 283 break;
276 case 2: 284 case 2:
277 setIrdaReceiveStatus ( !m_receive_active ); 285 setIrdaReceiveStatus ( !m_receive_active );
278 timerEvent( 0 ); 286 timerEvent( 0 );
279 break; 287 break;
280 } 288 }
281 289
282 delete menu; 290 delete menu;
283} 291}
284 292
285void IrdaApplet::timerEvent ( QTimerEvent * ) 293void IrdaApplet::timerEvent ( QTimerEvent * )
286{ 294{
287 bool oldactive = m_irda_active; 295 bool oldactive = m_irda_active;
288 bool olddiscovery = m_irda_discovery_active; 296 bool olddiscovery = m_irda_discovery_active;
289 bool receiveUpdate = false; 297 bool receiveUpdate = false;
290 298
291 if ( m_receive_state_changed ) { 299 if ( m_receive_state_changed ) {
292 receiveUpdate = true; 300 receiveUpdate = true;
293 m_receive_state_changed = false; 301 m_receive_state_changed = false;
294 } 302 }
295 303
296 m_irda_active = checkIrdaStatus ( ); 304 m_irda_active = checkIrdaStatus ( );
297 m_irda_discovery_active = checkIrdaDiscoveryStatus ( ); 305 m_irda_discovery_active = checkIrdaDiscoveryStatus ( );
298 306
299 if ( m_irda_discovery_active ) 307 if ( m_irda_discovery_active )
300 showDiscovered ( ); 308 showDiscovered ( );
301 309
302 if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate ) 310 if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate )
303 update ( ); 311 update ( );
304} 312}
305 313
306void IrdaApplet::paintEvent ( QPaintEvent * ) 314void IrdaApplet::paintEvent ( QPaintEvent * )
307{ 315{
308 QPainter p ( this ); 316 QPainter p ( this );
309 317
310 p. drawPixmap ( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap ); 318 p. drawPixmap ( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap );
311 319
312 if ( m_irda_discovery_active ) 320 if ( m_irda_discovery_active )
313 p. drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap ); 321 p. drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap );
314 322
315 if ( m_receive_active ) 323 if ( m_receive_active )
316 p. drawPixmap( 0, 1, m_receiveActivePixmap ); 324 p. drawPixmap( 0, 1, m_receiveActivePixmap );
317} 325}
318/* 326/*
319 * We know 3 calls 327 * We know 3 calls
320 * a) enable 328 * a) enable
321 * b) disable 329 * b) disable
322 * a and b will temp enable the IrDa device and disable will disable it again if it wasn't on 330 * a and b will temp enable the IrDa device and disable will disable it again if it wasn't on
323 * c) listDevices: We will return a list of known devices 331 * c) listDevices: We will return a list of known devices
324 */ 332 */
325void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) { 333void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) {
326 if ( str == "enableIrda()") { 334 if ( str == "enableIrda()") {
327 m_wasOn = checkIrdaStatus(); 335 m_wasOn = checkIrdaStatus();
328 m_wasDiscover = checkIrdaDiscoveryStatus(); 336 m_wasDiscover = checkIrdaDiscoveryStatus();
329 if (!m_wasOn) { 337 if (!m_wasOn) {
330 setIrdaStatus( true ); 338 setIrdaStatus( true );
331 } 339 }
332 if ( !m_wasDiscover ) { 340 if ( !m_wasDiscover ) {
333 setIrdaDiscoveryStatus ( true ); 341 setIrdaDiscoveryStatus ( true );
334 } 342 }
335 } else if ( str == "disableIrda()") { 343 } else if ( str == "disableIrda()") {
336 if (!m_wasOn) { 344 if (!m_wasOn) {
337 setIrdaStatus( false ); 345 setIrdaStatus( false );
338 } 346 }
339 if ( !m_wasDiscover ) { 347 if ( !m_wasDiscover ) {
340 setIrdaDiscoveryStatus ( false ); 348 setIrdaDiscoveryStatus ( false );
341 } 349 }
342 } else if ( str == "listDevices()") { 350 } else if ( str == "listDevices()") {
343 QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)"); 351 QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)");
344 352
345 QStringList list; 353 QStringList list;
346 QMap<QString, QString>::Iterator it; 354 QMap<QString, QString>::Iterator it;
347 for (it = m_devices.begin(); it != m_devices.end(); ++it ) 355 for (it = m_devices.begin(); it != m_devices.end(); ++it )
348 list << (*it); 356 list << (*it);
349 357
350 e << list; 358 e << list;
351 } 359 }
352} 360}
361
362Q_EXPORT_INTERFACE()
363{
364 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<IrdaApplet> );
365}
diff --git a/core/applets/irdaapplet/irda.h b/core/applets/irdaapplet/irda.h
index ec1d32c..f713bbe 100644
--- a/core/applets/irdaapplet/irda.h
+++ b/core/applets/irdaapplet/irda.h
@@ -1,76 +1,77 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com, 2** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com,
3** Robert Griebl sandman@handhelds.org 3** Robert Griebl sandman@handhelds.org
4** All rights reserved. 4** All rights reserved.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef __OPIE_IRDA_APPLET_H__ 16#ifndef __OPIE_IRDA_APPLET_H__
17#define __OPIE_IRDA_APPLET_H__ 17#define __OPIE_IRDA_APPLET_H__
18 18
19#include <qwidget.h> 19#include <qwidget.h>
20#include <qpixmap.h> 20#include <qpixmap.h>
21#include <qpopupmenu.h> 21#include <qpopupmenu.h>
22#include <qmap.h> 22#include <qmap.h>
23 23
24class IrdaApplet : public QWidget 24class IrdaApplet : public QWidget
25{ 25{
26 Q_OBJECT 26 Q_OBJECT
27 27
28public: 28public:
29 IrdaApplet( QWidget *parent = 0, const char *name = 0 ); 29 IrdaApplet( QWidget *parent = 0, const char *name = 0 );
30 ~IrdaApplet(); 30 ~IrdaApplet();
31 static int position();
31 32
32 virtual void show ( ); 33 virtual void show ( );
33 34
34protected: 35protected:
35 virtual void timerEvent ( QTimerEvent * ); 36 virtual void timerEvent ( QTimerEvent * );
36 virtual void mousePressEvent ( QMouseEvent * ); 37 virtual void mousePressEvent ( QMouseEvent * );
37 virtual void paintEvent ( QPaintEvent* ); 38 virtual void paintEvent ( QPaintEvent* );
38 39
39private slots: 40private slots:
40 void popupTimeout ( ); 41 void popupTimeout ( );
41 void slotMessage( const QCString& , const QByteArray& ); 42 void slotMessage( const QCString& , const QByteArray& );
42 43
43private: 44private:
44 void popup( QString message, QString icon = QString::null ); 45 void popup( QString message, QString icon = QString::null );
45 46
46 bool checkIrdaStatus ( ); 47 bool checkIrdaStatus ( );
47 bool setIrdaStatus ( bool ); 48 bool setIrdaStatus ( bool );
48 bool checkIrdaDiscoveryStatus (); 49 bool checkIrdaDiscoveryStatus ();
49 bool setIrdaDiscoveryStatus ( bool ); 50 bool setIrdaDiscoveryStatus ( bool );
50 bool setIrdaReceiveStatus ( bool ); 51 bool setIrdaReceiveStatus ( bool );
51 52
52 void showDiscovered(); 53 void showDiscovered();
53 54
54private: 55private:
55 QPixmap m_irdaOnPixmap; 56 QPixmap m_irdaOnPixmap;
56 QPixmap m_irdaOffPixmap; 57 QPixmap m_irdaOffPixmap;
57 QPixmap m_irdaDiscoveryOnPixmap; 58 QPixmap m_irdaDiscoveryOnPixmap;
58 QPixmap m_receiveActivePixmap; 59 QPixmap m_receiveActivePixmap;
59 60
60 bool m_irda_active; 61 bool m_irda_active;
61 bool m_irda_discovery_active; 62 bool m_irda_discovery_active;
62 bool m_receive_active; 63 bool m_receive_active;
63 bool m_receive_state_changed; 64 bool m_receive_state_changed;
64 65
65 QPopupMenu *m_popup; 66 QPopupMenu *m_popup;
66 67
67 int m_sockfd; 68 int m_sockfd;
68 69
69 QMap <QString, QString> m_devices; 70 QMap <QString, QString> m_devices;
70 71
71 bool m_wasOn; // if IrDa was enabled 72 bool m_wasOn; // if IrDa was enabled
72 bool m_wasDiscover; 73 bool m_wasDiscover;
73}; 74};
74 75
75 76
76#endif // __OPIE_IRDA_APPLET_H__ 77#endif // __OPIE_IRDA_APPLET_H__
diff --git a/core/applets/irdaapplet/irdaapplet.pro b/core/applets/irdaapplet/irdaapplet.pro
index 4e94dfb..31e8691 100644
--- a/core/applets/irdaapplet/irdaapplet.pro
+++ b/core/applets/irdaapplet/irdaapplet.pro
@@ -1,13 +1,13 @@
1TEMPLATE = lib 1 TEMPLATE = lib
2CONFIG += qt plugin warn_on release 2 CONFIG += qt plugin warn_on release
3HEADERS = irda.h irdaappletimpl.h 3 HEADERS = irda.h
4SOURCES = irda.cpp irdaappletimpl.cpp 4 SOURCES = irda.cpp
5TARGET = irdaapplet 5 TARGET = irdaapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7 INCLUDEPATH+= $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets
diff --git a/core/applets/irdaapplet/irdaappletimpl.cpp b/core/applets/irdaapplet/irdaappletimpl.cpp
deleted file mode 100644
index 33d98af..0000000
--- a/core/applets/irdaapplet/irdaappletimpl.cpp
+++ b/dev/null
@@ -1,66 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "irda.h"
21#include "irdaappletimpl.h"
22
23
24IrdaAppletImpl::IrdaAppletImpl()
25 : irda(0)
26{
27}
28
29IrdaAppletImpl::~IrdaAppletImpl()
30{
31 delete irda;
32}
33
34QWidget *IrdaAppletImpl::applet( QWidget *parent )
35{
36 if ( !irda )
37 irda = new IrdaApplet( parent );
38 return irda;
39}
40
41int IrdaAppletImpl::position() const
42{
43 return 6;
44}
45
46QRESULT IrdaAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
47{
48 *iface = 0;
49 if ( uuid == IID_QUnknown )
50 *iface = this;
51 else if ( uuid == IID_TaskbarApplet )
52 *iface = this;
53 else
54 return QS_FALSE;
55
56 if ( *iface )
57 (*iface)->addRef();
58 return QS_OK;
59}
60
61Q_EXPORT_INTERFACE()
62{
63 Q_CREATE_INSTANCE( IrdaAppletImpl )
64}
65
66
diff --git a/core/applets/irdaapplet/irdaappletimpl.h b/core/applets/irdaapplet/irdaappletimpl.h
deleted file mode 100644
index 024cc06..0000000
--- a/core/applets/irdaapplet/irdaappletimpl.h
+++ b/dev/null
@@ -1,45 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef IRDAAPPLETIMPL_H
21#define IRDAAPPLETIMPL_H
22
23#include <qwidget.h>
24
25#include <qpe/taskbarappletinterface.h>
26
27class IrdaApplet;
28
29class IrdaAppletImpl : public TaskbarAppletInterface
30{
31public:
32 IrdaAppletImpl();
33 virtual ~IrdaAppletImpl();
34
35 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
36 Q_REFCOUNT
37
38 virtual QWidget *applet( QWidget *parent );
39 virtual int position() const;
40
41private:
42 IrdaApplet *irda;
43};
44
45#endif
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 56a031c..5d6bce4 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -1,132 +1,135 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com 2** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com
3** All rights reserved. 3** All rights reserved.
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14 14
15#include "screenshot.h" 15#include "screenshot.h"
16#include "inputDialog.h" 16#include "inputDialog.h"
17 17
18#include <stdlib.h> 18/* OPIE */
19#include <sys/socket.h> 19#include <opie2/otaskbarapplet.h>
20#include <netinet/in.h>
21#include <netdb.h>
22#include <unistd.h>
23
24#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
25#include <qpe/applnk.h> 21#include <qpe/applnk.h>
26 22
23/* QT */
27#include <qlineedit.h> 24#include <qlineedit.h>
28#include <qdir.h> 25#include <qdir.h>
29#include <qlabel.h> 26#include <qlabel.h>
30#include <qpushbutton.h> 27#include <qpushbutton.h>
31#include <qpainter.h> 28#include <qpainter.h>
32#include <qspinbox.h> 29#include <qspinbox.h>
33#include <qlayout.h> 30#include <qlayout.h>
34#include <qcheckbox.h> 31#include <qcheckbox.h>
35#include <qmessagebox.h> 32#include <qmessagebox.h>
36 33
34/* STD */
35#include <stdlib.h>
36#include <sys/socket.h>
37#include <netinet/in.h>
38#include <netdb.h>
39#include <unistd.h>
37 40
38/* XPM */ 41/* XPM */
39static char * snapshot_xpm[] = { 42static char * snapshot_xpm[] = {
40"32 32 177 2", 43"32 32 177 2",
41 " c None", 44 " c None",
42 ". c #042045", 45 ". c #042045",
43 "+ c #0D2B47", 46 "+ c #0D2B47",
44 "@ c #0E325E", 47 "@ c #0E325E",
45 "# c #0D2E50", 48 "# c #0D2E50",
46 "$ c #0A1C32", 49 "$ c #0A1C32",
47 "% c #0F3A69", 50 "% c #0F3A69",
48 "& c #164680", 51 "& c #164680",
49 "* c #165EAE", 52 "* c #165EAE",
50 "= c #134D89", 53 "= c #134D89",
51 "- c #0A3A6E", 54 "- c #0A3A6E",
52 "; c #031024", 55 "; c #031024",
53 "> c #031B36", 56 "> c #031B36",
54 ", c #1A5EA3", 57 ", c #1A5EA3",
55 "' c #1862B1", 58 "' c #1862B1",
56 ") c #1866B9", 59 ") c #1866B9",
57 "! c #0F5AAC", 60 "! c #0F5AAC",
58 "~ c #0F56A8", 61 "~ c #0F56A8",
59 "{ c #0C4C96", 62 "{ c #0C4C96",
60 "] c #030918", 63 "] c #030918",
61 "^ c #060206", 64 "^ c #060206",
62 "/ c #20242C", 65 "/ c #20242C",
63 "( c #3E3B3B", 66 "( c #3E3B3B",
64 "_ c #186ABD", 67 "_ c #186ABD",
65 ": c #115EB3", 68 ": c #115EB3",
66 "< c #082644", 69 "< c #082644",
67 "[ c #222C38", 70 "[ c #222C38",
68 "} c #5A5859", 71 "} c #5A5859",
69 "| c #091921", 72 "| c #091921",
70 "1 c #1E7EDE", 73 "1 c #1E7EDE",
71 "2 c #1A7ADA", 74 "2 c #1A7ADA",
72 "3 c #1970CD", 75 "3 c #1970CD",
73 "4 c #1758A1", 76 "4 c #1758A1",
74 "5 c #0E529A", 77 "5 c #0E529A",
75 "6 c #094388", 78 "6 c #094388",
76 "7 c #22364E", 79 "7 c #22364E",
77 "8 c #384454", 80 "8 c #384454",
78 "9 c #04162C", 81 "9 c #04162C",
79 "0 c #123451", 82 "0 c #123451",
80 "a c #3296B4", 83 "a c #3296B4",
81 "b c #298AB1", 84 "b c #298AB1",
82 "c c #2484AC", 85 "c c #2484AC",
83 "d c #033D86", 86 "d c #033D86",
84 "e c #033677", 87 "e c #033677",
85 "f c #072C58", 88 "f c #072C58",
86 "g c #525862", 89 "g c #525862",
87 "h c #5E5E5E", 90 "h c #5E5E5E",
88 "i c #23492A", 91 "i c #23492A",
89 "j c #4FBD3F", 92 "j c #4FBD3F",
90 "k c #50B24C", 93 "k c #50B24C",
91 "l c #51C72E", 94 "l c #51C72E",
92 "m c #42C64A", 95 "m c #42C64A",
93 "n c #2686CA", 96 "n c #2686CA",
94 "o c #0B52A4", 97 "o c #0B52A4",
95 "p c #054A9A", 98 "p c #054A9A",
96 "q c #053B7C", 99 "q c #053B7C",
97 "r c #2B2325", 100 "r c #2B2325",
98 "s c #6E7070", 101 "s c #6E7070",
99 "t c #0D240E", 102 "t c #0D240E",
100 "u c #1E423E", 103 "u c #1E423E",
101 "v c #468ABE", 104 "v c #468ABE",
102 "w c #6A8AC2", 105 "w c #6A8AC2",
103 "x c #7EAA8E", 106 "x c #7EAA8E",
104 "y c #84BE4E", 107 "y c #84BE4E",
105 "z c #65C639", 108 "z c #65C639",
106 "A c #064EA0", 109 "A c #064EA0",
107 "B c #0A4DA0", 110 "B c #0A4DA0",
108 "C c #4E5242", 111 "C c #4E5242",
109 "D c #62362E", 112 "D c #62362E",
110 "E c #721A1A", 113 "E c #721A1A",
111 "F c #6E0A0A", 114 "F c #6E0A0A",
112 "G c #3E0E0E", 115 "G c #3E0E0E",
113 "H c #6AB85E", 116 "H c #6AB85E",
114 "I c #7E8ECA", 117 "I c #7E8ECA",
115 "J c #929CD4", 118 "J c #929CD4",
116 "K c #9EAECA", 119 "K c #9EAECA",
117 "L c #9EBEAE", 120 "L c #9EBEAE",
118 "M c #8EC26A", 121 "M c #8EC26A",
119 "N c #32A276", 122 "N c #32A276",
120 "O c #20518C", 123 "O c #20518C",
121 "P c #46566E", 124 "P c #46566E",
122 "Q c #614A51", 125 "Q c #614A51",
123 "R c #AE2A26", 126 "R c #AE2A26",
124 "S c #C41C1A", 127 "S c #C41C1A",
125 "T c #CE0A0A", 128 "T c #CE0A0A",
126 "U c #A60606", 129 "U c #A60606",
127 "V c #921616", 130 "V c #921616",
128 "W c #863735", 131 "W c #863735",
129 "X c #866A66", 132 "X c #866A66",
130 "Y c #9E9EA2", 133 "Y c #9E9EA2",
131 "Z c #1E5212", 134 "Z c #1E5212",
132 "` c #7EC652", 135 "` c #7EC652",
@@ -404,127 +407,137 @@ void ScreenshotControl::performGrab()
404 if (buttonPushed == 1) { 407 if (buttonPushed == 1) {
405 qDebug("grabbing screen"); 408 qDebug("grabbing screen");
406 grabTimer->stop(); 409 grabTimer->stop();
407 show(); 410 show();
408 qApp->processEvents(); 411 qApp->processEvents();
409 savePixmap(); 412 savePixmap();
410 } else { 413 } else {
411 grabTimer->stop(); 414 grabTimer->stop();
412 415
413 struct sockaddr_in raddr; 416 struct sockaddr_in raddr;
414 struct hostent *rhost_info; 417 struct hostent *rhost_info;
415 int sock = -1; 418 int sock = -1;
416 bool ok = false; 419 bool ok = false;
417 420
418 QString displayEnv = getenv("QWS_DISPLAY"); 421 QString displayEnv = getenv("QWS_DISPLAY");
419 qDebug(displayEnv); 422 qDebug(displayEnv);
420 423
421 if(( displayEnv.left(2) != ":0" ) && (!displayEnv.isEmpty())) { 424 if(( displayEnv.left(2) != ":0" ) && (!displayEnv.isEmpty())) {
422 425
423 if (( rhost_info = (struct hostent *) ::gethostbyname ((char *) SCAP_hostname )) != 0 ) { 426 if (( rhost_info = (struct hostent *) ::gethostbyname ((char *) SCAP_hostname )) != 0 ) {
424 ::memset ( &raddr, 0, sizeof (struct sockaddr_in)); 427 ::memset ( &raddr, 0, sizeof (struct sockaddr_in));
425 ::memcpy ( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); 428 ::memcpy ( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length );
426 raddr. sin_family = rhost_info-> h_addrtype; 429 raddr. sin_family = rhost_info-> h_addrtype;
427 raddr. sin_port = htons ( SCAP_port ); 430 raddr. sin_port = htons ( SCAP_port );
428 431
429 if (( sock = ::socket ( AF_INET, SOCK_STREAM, 0 )) >= 0 ) { 432 if (( sock = ::socket ( AF_INET, SOCK_STREAM, 0 )) >= 0 ) {
430 if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) { 433 if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) {
431 434
432 QString header; 435 QString header;
433 436
434 QPixmap pix; 437 QPixmap pix;
435 438
436 QString SCAP_model=""; 439 QString SCAP_model="";
437#warning FIXME: model string should be filled with actual device model 440#warning FIXME: model string should be filled with actual device model
438 if( snapshot.width() > 320) 441 if( snapshot.width() > 320)
439 SCAP_model ="Corgi"; 442 SCAP_model ="Corgi";
440 443
441 if(displayEnv == "QVFb:0") {//set this if you plan on using this app in qvfb!! 444 if(displayEnv == "QVFb:0") {//set this if you plan on using this app in qvfb!!
442 pix = snapshot.xForm(QWMatrix().rotate(90)); 445 pix = snapshot.xForm(QWMatrix().rotate(90));
443 } else 446 } else
444 pix = ( snapshot.width() > snapshot.height() ) ? snapshot : snapshot.xForm( QWMatrix().rotate(90) ); 447 pix = ( snapshot.width() > snapshot.height() ) ? snapshot : snapshot.xForm( QWMatrix().rotate(90) );
445 448
446 QImage img = pix.convertToImage().convertDepth( 16 ); // could make that also depth independent, if hh.org/scap can handle it 449 QImage img = pix.convertToImage().convertDepth( 16 ); // could make that also depth independent, if hh.org/scap can handle it
447 450
448 header = "POST /scap/capture.cgi?%1+%2 HTTP/1.1\n" // 1: model / 2: user 451 header = "POST /scap/capture.cgi?%1+%2 HTTP/1.1\n" // 1: model / 2: user
449 "Content-length: %3\n" // 3: content length 452 "Content-length: %3\n" // 3: content length
450 "Content-Type: image/png\n" 453 "Content-Type: image/png\n"
451 "Host: %4\n" // 4: scap host 454 "Host: %4\n" // 4: scap host
452 "\n"; 455 "\n";
453 456
454 457
455 header = header.arg( SCAP_model).arg( ::getenv( "USER" ) ).arg( img.numBytes() ).arg( SCAP_hostname ); 458 header = header.arg( SCAP_model).arg( ::getenv( "USER" ) ).arg( img.numBytes() ).arg( SCAP_hostname );
456 qDebug(header); 459 qDebug(header);
457 460
458 if ( !pix.isNull() ) { 461 if ( !pix.isNull() ) {
459 const char *ascii = header.latin1( ); 462 const char *ascii = header.latin1( );
460 uint ascii_len = ::strlen( ascii ); 463 uint ascii_len = ::strlen( ascii );
461 ::write ( sock, ascii, ascii_len ); 464 ::write ( sock, ascii, ascii_len );
462 ::write ( sock, img.bits(), img.numBytes() ); 465 ::write ( sock, img.bits(), img.numBytes() );
463 466
464 ok = true; 467 ok = true;
465 } 468 }
466 } 469 }
467 ::close ( sock ); 470 ::close ( sock );
468 } 471 }
469 } 472 }
470 if ( ok ) { 473 if ( ok ) {
471 QMessageBox::information( 0, tr( "Success" ), QString( "<p>%1</p>" ).arg ( tr( "Screenshot was uploaded to %1" )).arg( SCAP_hostname )); 474 QMessageBox::information( 0, tr( "Success" ), QString( "<p>%1</p>" ).arg ( tr( "Screenshot was uploaded to %1" )).arg( SCAP_hostname ));
472 } else { 475 } else {
473 QMessageBox::warning( 0, tr( "Error" ), QString( "<p>%1</p>" ).arg( tr( "Connection to %1 failed." )).arg( SCAP_hostname )); 476 QMessageBox::warning( 0, tr( "Error" ), QString( "<p>%1</p>" ).arg( tr( "Connection to %1 failed." )).arg( SCAP_hostname ));
474 } 477 }
475 } else { 478 } else {
476 QMessageBox::warning( 0, tr( "Error" ),tr("Please set <b>QWS_DISPLAY</b> environmental variable.")); 479 QMessageBox::warning( 0, tr( "Error" ),tr("Please set <b>QWS_DISPLAY</b> environmental variable."));
477 } 480 }
478 } 481 }
479 482
480} 483}
481 484
482 485
483 486
484//=========================================================================== 487//===========================================================================
485 488
486ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name ) 489ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name )
487 : QWidget( parent, name ) 490 : QWidget( parent, name )
488{ 491{
489 setFixedWidth( AppLnk::smallIconSize()); 492 setFixedWidth( AppLnk::smallIconSize());
490 493
491 QImage img = (const char **)snapshot_xpm; 494 QImage img = (const char **)snapshot_xpm;
492 img = img.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize()); 495 img = img.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize());
493 m_icon.convertFromImage(img); 496 m_icon.convertFromImage(img);
494} 497}
495 498
496ScreenshotApplet::~ScreenshotApplet() 499ScreenshotApplet::~ScreenshotApplet()
497{ 500{
498} 501}
499 502
503int ScreenshotApplet::position()
504{
505 return 6;
506}
507
500void ScreenshotApplet::mousePressEvent( QMouseEvent *) 508void ScreenshotApplet::mousePressEvent( QMouseEvent *)
501{ 509{
502 ScreenshotControl *sc = new ScreenshotControl ( ); 510 ScreenshotControl *sc = new ScreenshotControl ( );
503 QPoint curPos = mapToGlobal ( QPoint ( 0, 0 )); 511 QPoint curPos = mapToGlobal ( QPoint ( 0, 0 ));
504 512
505 // windowPosX is the windows position centered above the applets icon. 513 // windowPosX is the windows position centered above the applets icon.
506 // If the icon is near the edge of the screen, the window would leave the visible area 514 // If the icon is near the edge of the screen, the window would leave the visible area
507 // so we check the position against the screen width and correct the difference if needed 515 // so we check the position against the screen width and correct the difference if needed
508 516
509 int screenWidth = qApp->desktop()->width(); 517 int screenWidth = qApp->desktop()->width();
510 int windowPosX = curPos. x ( ) - ( sc-> sizeHint ( ). width ( ) - width ( )) / 2 ; 518 int windowPosX = curPos. x ( ) - ( sc-> sizeHint ( ). width ( ) - width ( )) / 2 ;
511 int ZwindowPosX, XwindowPosX; 519 int ZwindowPosX, XwindowPosX;
512 520
513 // the window would be placed beyond the screen wich doesn't look tooo good 521 // the window would be placed beyond the screen wich doesn't look tooo good
514 if ( (windowPosX + sc-> sizeHint ( ). width ( )) > screenWidth ) { 522 if ( (windowPosX + sc-> sizeHint ( ). width ( )) > screenWidth ) {
515 XwindowPosX = windowPosX + sc-> sizeHint ( ). width ( ) - screenWidth; 523 XwindowPosX = windowPosX + sc-> sizeHint ( ). width ( ) - screenWidth;
516 ZwindowPosX = windowPosX - XwindowPosX - 1; 524 ZwindowPosX = windowPosX - XwindowPosX - 1;
517 } else { 525 } else {
518 ZwindowPosX = windowPosX; 526 ZwindowPosX = windowPosX;
519 } 527 }
520 528
521 sc-> move ( ZwindowPosX, curPos. y ( ) - sc-> sizeHint ( ). height ( ) ); 529 sc-> move ( ZwindowPosX, curPos. y ( ) - sc-> sizeHint ( ). height ( ) );
522 sc-> show ( ); 530 sc-> show ( );
523} 531}
524 532
525void ScreenshotApplet::paintEvent( QPaintEvent* ) 533void ScreenshotApplet::paintEvent( QPaintEvent* )
526{ 534{
527 QPainter p ( this ); 535 QPainter p ( this );
528 p.drawPixmap( 0,0, m_icon ); 536 p.drawPixmap( 0,0, m_icon );
529} 537}
530 538
539Q_EXPORT_INTERFACE()
540{
541 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ScreenshotApplet> );
542}
543
diff --git a/core/applets/screenshotapplet/screenshot.h b/core/applets/screenshotapplet/screenshot.h
index 74cc5e6..b753583 100644
--- a/core/applets/screenshotapplet/screenshot.h
+++ b/core/applets/screenshotapplet/screenshot.h
@@ -1,70 +1,71 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com 2** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com
3** All rights reserved. 3** All rights reserved.
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14 14
15#ifndef __SCREENSHOT_APPLET_H__ 15#ifndef __SCREENSHOT_APPLET_H__
16#define __SCREENSHOT_APPLET_H__ 16#define __SCREENSHOT_APPLET_H__
17 17
18 18
19 19
20#include <qwidget.h> 20#include <qwidget.h>
21#include <qframe.h> 21#include <qframe.h>
22#include <qpixmap.h> 22#include <qpixmap.h>
23#include <qguardedptr.h> 23#include <qguardedptr.h>
24#include <qtimer.h> 24#include <qtimer.h>
25 25
26class QComboBox; 26class QComboBox;
27class QCheckBox; 27class QCheckBox;
28class QSpinBox; 28class QSpinBox;
29class QPushButton; 29class QPushButton;
30//class QImage; 30//class QImage;
31 31
32class ScreenshotControl : public QFrame 32class ScreenshotControl : public QFrame
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35public: 35public:
36 ScreenshotControl( QWidget *parent=0, const char *name=0 ); 36 ScreenshotControl( QWidget *parent=0, const char *name=0 );
37 37
38private: 38private:
39 QPushButton *grabItButton, *scapButton; 39 QPushButton *grabItButton, *scapButton;
40 QPixmap snapshot; 40 QPixmap snapshot;
41 QTimer* grabTimer; 41 QTimer* grabTimer;
42 QCheckBox *saveNamedCheck; 42 QCheckBox *saveNamedCheck;
43 QString FileNamePath; 43 QString FileNamePath;
44 bool setFileName; 44 bool setFileName;
45 QSpinBox *delaySpin; 45 QSpinBox *delaySpin;
46 int buttonPushed; 46 int buttonPushed;
47 47
48private slots: 48private slots:
49 void slotGrab(); 49 void slotGrab();
50 void slotScap(); 50 void slotScap();
51 void savePixmap(); 51 void savePixmap();
52 void performGrab(); 52 void performGrab();
53}; 53};
54 54
55class ScreenshotApplet : public QWidget { 55class ScreenshotApplet : public QWidget {
56public: 56public:
57 ScreenshotApplet( QWidget *parent = 0, const char *name=0 ); 57 ScreenshotApplet( QWidget *parent = 0, const char *name=0 );
58 ~ScreenshotApplet(); 58 ~ScreenshotApplet();
59 static int position();
59 60
60protected: 61protected:
61 void mousePressEvent( QMouseEvent * ); 62 void mousePressEvent( QMouseEvent * );
62 void paintEvent( QPaintEvent* ); 63 void paintEvent( QPaintEvent* );
63 64
64private: 65private:
65 QPixmap m_icon; 66 QPixmap m_icon;
66}; 67};
67 68
68 69
69#endif // __SCREENSHOT_APPLET_H__ 70#endif // __SCREENSHOT_APPLET_H__
70 71
diff --git a/core/applets/screenshotapplet/screenshotapplet.pro b/core/applets/screenshotapplet/screenshotapplet.pro
index 45a5759..c7fcc3e 100644
--- a/core/applets/screenshotapplet/screenshotapplet.pro
+++ b/core/applets/screenshotapplet/screenshotapplet.pro
@@ -1,15 +1,13 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = screenshot.h inputDialog.h screenshotappletimpl.h 3HEADERS = screenshot.h inputDialog.h
4SOURCES = screenshot.cpp inputDialog.cpp screenshotappletimpl.cpp 4SOURCES = screenshot.cpp inputDialog.cpp
5TARGET = screenshotapplet 5TARGET = screenshotapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11MOC_DIR=opieobj
12OBJECTS_DIR=opieobj
13 11
14include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
15target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets
diff --git a/core/applets/screenshotapplet/screenshotappletimpl.cpp b/core/applets/screenshotapplet/screenshotappletimpl.cpp
deleted file mode 100644
index e99ecb0..0000000
--- a/core/applets/screenshotapplet/screenshotappletimpl.cpp
+++ b/dev/null
@@ -1,66 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "screenshot.h"
21#include "screenshotappletimpl.h"
22
23
24ScreenshotAppletImpl::ScreenshotAppletImpl()
25 : screenshot(0)
26{
27}
28
29ScreenshotAppletImpl::~ScreenshotAppletImpl()
30{
31 delete screenshot;
32}
33
34QWidget *ScreenshotAppletImpl::applet( QWidget *parent )
35{
36 if ( !screenshot )
37 screenshot = new ScreenshotApplet( parent );
38 return screenshot;
39}
40
41int ScreenshotAppletImpl::position() const
42{
43 return 6;
44}
45
46QRESULT ScreenshotAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
47{
48 *iface = 0;
49 if ( uuid == IID_QUnknown )
50 *iface = this;
51 else if ( uuid == IID_TaskbarApplet )
52 *iface = this;
53 else
54 return QS_FALSE;
55
56 if ( *iface )
57 (*iface)->addRef();
58 return QS_OK;
59}
60
61Q_EXPORT_INTERFACE()
62{
63 Q_CREATE_INSTANCE( ScreenshotAppletImpl )
64}
65
66
diff --git a/core/applets/screenshotapplet/screenshotappletimpl.h b/core/applets/screenshotapplet/screenshotappletimpl.h
deleted file mode 100644
index 988a34c..0000000
--- a/core/applets/screenshotapplet/screenshotappletimpl.h
+++ b/dev/null
@@ -1,43 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef SCREENSHOTAPPLETIMPL_H
21#define SCREENSHOTAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class ScreenshotApplet;
26
27class ScreenshotAppletImpl : public TaskbarAppletInterface
28{
29public:
30 ScreenshotAppletImpl();
31 virtual ~ScreenshotAppletImpl();
32
33 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
34 Q_REFCOUNT
35
36 virtual QWidget *applet( QWidget *parent );
37 virtual int position() const;
38
39private:
40 ScreenshotApplet *screenshot;
41};
42
43#endif
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index fe8ebfd..563d110 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -1,335 +1,341 @@
1/************************************************************************************ 1/************************************************************************************
2 ** 2 **
3 ** This file may be distributed and/or modified under the terms of the 3 ** This file may be distributed and/or modified under the terms of the
4 ** GNU General Public License version 2 as published by the Free Software 4 ** GNU General Public License version 2 as published by the Free Software
5 ** Foundation and appearing in the file LICENSE.GPL included in the 5 ** Foundation and appearing in the file LICENSE.GPL included in the
6 ** packaging of this file. 6 ** packaging of this file.
7 ** 7 **
8 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 ** 10 **
11 ************************************************************************************/ 11 ************************************************************************************/
12// copyright 2002 Jeremy Cowgar <jc@cowgar.com> 12// copyright 2002 Jeremy Cowgar <jc@cowgar.com>
13// copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com> 13// copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com>
14 14
15extern "C" { 15extern "C" {
16#include "adpcm.h" 16#include "adpcm.h"
17} 17}
18 18
19#include <unistd.h> 19#include <unistd.h>
20#include <stdio.h> 20#include <stdio.h>
21#include <fcntl.h> 21#include <fcntl.h>
22#include <sys/ioctl.h> 22#include <sys/ioctl.h>
23#include <linux/soundcard.h> 23#include <linux/soundcard.h>
24 24
25#include <errno.h> 25#include <errno.h>
26 26
27typedef struct _waveheader { 27typedef struct _waveheader {
28 u_long main_chunk; /* 'RIFF' */ 28 u_long main_chunk; /* 'RIFF' */
29 u_long length; /* filelen */ 29 u_long length; /* filelen */
30 u_long chunk_type; /* 'WAVE' */ 30 u_long chunk_type; /* 'WAVE' */
31 u_long sub_chunk; /* 'fmt ' */ 31 u_long sub_chunk; /* 'fmt ' */
32 u_long sc_len; /* length of sub_chunk, =16 32 u_long sc_len; /* length of sub_chunk, =16
33 (chunckSize) format len */ 33 (chunckSize) format len */
34 u_short format; /* should be 1 for PCM-code (formatTag) */ 34 u_short format; /* should be 1 for PCM-code (formatTag) */
35 35
36 u_short modus; /* 1 Mono, 2 Stereo (channels) */ 36 u_short modus; /* 1 Mono, 2 Stereo (channels) */
37 u_long sample_fq; /* samples per second (samplesPerSecond) */ 37 u_long sample_fq; /* samples per second (samplesPerSecond) */
38 u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */ 38 u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */
39 u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */ 39 u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */
40 u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */ 40 u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */
41 41
42 u_long data_chunk; /* 'data' */ 42 u_long data_chunk; /* 'data' */
43 43
44 u_long data_length;/* samplecount */ 44 u_long data_length;/* samplecount */
45} WaveHeader; 45} WaveHeader;
46 46
47#define RIFF 0x46464952 47#define RIFF 0x46464952
48#define WAVE 0x45564157 48#define WAVE 0x45564157
49#define FMT 0x20746D66 49#define FMT 0x20746D66
50#define DATA 0x61746164 50#define DATA 0x61746164
51#define PCM_CODE 1 51#define PCM_CODE 1
52#define WAVE_MONO 1 52#define WAVE_MONO 1
53#define WAVE_STEREO 2 53#define WAVE_STEREO 2
54 54
55struct adpcm_state encoder_state; 55struct adpcm_state encoder_state;
56//struct adpcm_state decoder_state; 56//struct adpcm_state decoder_state;
57 57
58#define WAVE_FORMAT_DVI_ADPCM (0x0011) 58#define WAVE_FORMAT_DVI_ADPCM (0x0011)
59#define WAVE_FORMAT_PCM (0x0001) 59#define WAVE_FORMAT_PCM (0x0001)
60 60
61 61
62#include "vmemo.h" 62#include "vmemo.h"
63 63
64#include <opie2/otaskbarapplet.h>
64#include <qpe/qpeapplication.h> 65#include <qpe/qpeapplication.h>
65#include <qpe/config.h> 66#include <qpe/config.h>
66 67
67#include <qpainter.h> 68#include <qpainter.h>
68#include <qmessagebox.h> 69#include <qmessagebox.h>
69 70
70int seq = 0; 71int seq = 0;
71 72
72/* XPM */ 73/* XPM */
73static char * vmemo_xpm[] = { 74static char * vmemo_xpm[] = {
74 "16 16 102 2", 75 "16 16 102 2",
75 " c None", 76 " c None",
76 ". c #60636A", 77 ". c #60636A",
77 "+ c #6E6E72", 78 "+ c #6E6E72",
78 "@ c #68696E", 79 "@ c #68696E",
79 "# c #4D525C", 80 "# c #4D525C",
80 "$ c #6B6C70", 81 "$ c #6B6C70",
81 "% c #E3E3E8", 82 "% c #E3E3E8",
82 "& c #EEEEF2", 83 "& c #EEEEF2",
83 "* c #EAEAEF", 84 "* c #EAEAEF",
84 "= c #CACAD0", 85 "= c #CACAD0",
85 "- c #474A51", 86 "- c #474A51",
86 "; c #171819", 87 "; c #171819",
87 "> c #9B9B9F", 88 "> c #9B9B9F",
88 ", c #EBEBF0", 89 ", c #EBEBF0",
89 "' c #F4F4F7", 90 "' c #F4F4F7",
90 ") c #F1F1F5", 91 ") c #F1F1F5",
91 "! c #DEDEE4", 92 "! c #DEDEE4",
92 "~ c #57575C", 93 "~ c #57575C",
93 "{ c #010101", 94 "{ c #010101",
94 "] c #A2A2A6", 95 "] c #A2A2A6",
95 "^ c #747477", 96 "^ c #747477",
96 "/ c #B5B5B8", 97 "/ c #B5B5B8",
97 "( c #AEAEB2", 98 "( c #AEAEB2",
98 "_ c #69696D", 99 "_ c #69696D",
99 ": c #525256", 100 ": c #525256",
100 "< c #181C24", 101 "< c #181C24",
101 "[ c #97979B", 102 "[ c #97979B",
102 "} c #A7A7AC", 103 "} c #A7A7AC",
103 "| c #B0B0B4", 104 "| c #B0B0B4",
104 "1 c #C8C8D1", 105 "1 c #C8C8D1",
105 "2 c #75757B", 106 "2 c #75757B",
106 "3 c #46464A", 107 "3 c #46464A",
107 "4 c #494A4F", 108 "4 c #494A4F",
108 "5 c #323234", 109 "5 c #323234",
109 "6 c #909095", 110 "6 c #909095",
110 "7 c #39393B", 111 "7 c #39393B",
111 "8 c #757578", 112 "8 c #757578",
112 "9 c #87878E", 113 "9 c #87878E",
113 "0 c #222224", 114 "0 c #222224",
114 "a c #414144", 115 "a c #414144",
115 "b c #6A6A6E", 116 "b c #6A6A6E",
116 "c c #020C16", 117 "c c #020C16",
117 "d c #6B6B6F", 118 "d c #6B6B6F",
118 "e c #68686D", 119 "e c #68686D",
119 "f c #5B5B60", 120 "f c #5B5B60",
120 "g c #8A8A8F", 121 "g c #8A8A8F",
121 "h c #6B6B6E", 122 "h c #6B6B6E",
122 "i c #ADADB2", 123 "i c #ADADB2",
123 "j c #828289", 124 "j c #828289",
124 "k c #3E3E41", 125 "k c #3E3E41",
125 "l c #CFCFD7", 126 "l c #CFCFD7",
126 "m c #4C4C50", 127 "m c #4C4C50",
127 "n c #000000", 128 "n c #000000",
128 "o c #66666A", 129 "o c #66666A",
129 "p c #505054", 130 "p c #505054",
130 "q c #838388", 131 "q c #838388",
131 "r c #A1A1A7", 132 "r c #A1A1A7",
132 "s c #A9A9AE", 133 "s c #A9A9AE",
133 "t c #A8A8B0", 134 "t c #A8A8B0",
134 "u c #5E5E63", 135 "u c #5E5E63",
135 "v c #3A3A3E", 136 "v c #3A3A3E",
136 "w c #BDBDC6", 137 "w c #BDBDC6",
137 "x c #59595E", 138 "x c #59595E",
138 "y c #76767C", 139 "y c #76767C",
139 "z c #373738", 140 "z c #373738",
140 "A c #717174", 141 "A c #717174",
141 "B c #727278", 142 "B c #727278",
142 "C c #1C1C1E", 143 "C c #1C1C1E",
143 "D c #3C3C3F", 144 "D c #3C3C3F",
144 "E c #ADADB6", 145 "E c #ADADB6",
145 "F c #54555A", 146 "F c #54555A",
146 "G c #8B8C94", 147 "G c #8B8C94",
147 "H c #5A5A5F", 148 "H c #5A5A5F",
148 "I c #BBBBC3", 149 "I c #BBBBC3",
149 "J c #C4C4CB", 150 "J c #C4C4CB",
150 "K c #909098", 151 "K c #909098",
151 "L c #737379", 152 "L c #737379",
152 "M c #343437", 153 "M c #343437",
153 "N c #8F8F98", 154 "N c #8F8F98",
154 "O c #000407", 155 "O c #000407",
155 "P c #2D3137", 156 "P c #2D3137",
156 "Q c #B0B1BC", 157 "Q c #B0B1BC",
157 "R c #3B3C40", 158 "R c #3B3C40",
158 "S c #6E6E74", 159 "S c #6E6E74",
159 "T c #95959C", 160 "T c #95959C",
160 "U c #74747A", 161 "U c #74747A",
161 "V c #1D1D1E", 162 "V c #1D1D1E",
162 "W c #91929A", 163 "W c #91929A",
163 "X c #42444A", 164 "X c #42444A",
164 "Y c #22282E", 165 "Y c #22282E",
165 "Z c #B0B2BC", 166 "Z c #B0B2BC",
166 "` c #898A90", 167 "` c #898A90",
167 " . c #65656A", 168 " . c #65656A",
168 ".. c #999AA2", 169 ".. c #999AA2",
169 "+. c #52535A", 170 "+. c #52535A",
170 "@. c #151B21", 171 "@. c #151B21",
171 "#. c #515257", 172 "#. c #515257",
172 "$. c #B5B5BE", 173 "$. c #B5B5BE",
173 "%. c #616167", 174 "%. c #616167",
174 "&. c #1A1D22", 175 "&. c #1A1D22",
175 "*. c #000713", 176 "*. c #000713",
176 "=. c #1F1F21", 177 "=. c #1F1F21",
177 " ", 178 " ",
178 " . + @ # ", 179 " . + @ # ",
179 " $ % & * = - ", 180 " $ % & * = - ",
180 " ; > , ' ) ! ~ ", 181 " ; > , ' ) ! ~ ",
181 " { ] ^ / ( _ : ", 182 " { ] ^ / ( _ : ",
182 " < [ } | 1 2 3 ", 183 " < [ } | 1 2 3 ",
183 " 4 5 6 7 8 9 0 a b c ", 184 " 4 5 6 7 8 9 0 a b c ",
184 " 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 ",
185 " o p q r s t u v w n ", 186 " o p q r s t u v w n ",
186 " o x y z A B C D E n ", 187 " o x y z A B C D E n ",
187 " F G H I J K L M N O ", 188 " F G H I J K L M N O ",
188 " P Q R S T U V W X ", 189 " P Q R S T U V W X ",
189 " Y Z ` b ...+. ", 190 " Y Z ` b ...+. ",
190 " @.#.$.%.&. ", 191 " @.#.$.%.&. ",
191 " *.B =. ", 192 " *.B =. ",
192 " n n n n n n n n n "}; 193 " n n n n n n n n n "};
193 194
194 195
195VMemo::VMemo( QWidget *parent, const char *_name ) 196VMemo::VMemo( QWidget *parent, const char *_name )
196 : QWidget( parent, _name ) { 197 : QWidget( parent, _name ) {
197 setFixedHeight( 18 ); 198 setFixedHeight( 18 );
198 setFixedWidth( 14 ); 199 setFixedWidth( 14 );
199 200
200 t_timer = new QTimer( this ); 201 t_timer = new QTimer( this );
201 connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) ); 202 connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) );
202 203
203 Config vmCfg("Vmemo"); 204 Config vmCfg("Vmemo");
204 vmCfg.setGroup("Defaults"); 205 vmCfg.setGroup("Defaults");
205 int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); 206 int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1));
206 useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); 207 useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0);
207 208
208 qDebug("toggleKey %d", toggleKey); 209 qDebug("toggleKey %d", toggleKey);
209 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 210 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
210 systemZaurus=TRUE; 211 systemZaurus=TRUE;
211 else 212 else
212 systemZaurus=FALSE; 213 systemZaurus=FALSE;
213 214
214 myChannel = new QCopChannel( "QPE/VMemo", this ); 215 myChannel = new QCopChannel( "QPE/VMemo", this );
215 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), 216 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)),
216 this, SLOT(receive(const QCString&, const QByteArray&)) ); 217 this, SLOT(receive(const QCString&, const QByteArray&)) );
217 218
218 if( toggleKey != -1 ) { 219 if( toggleKey != -1 ) {
219 // keyRegister(key, channel, message) 220 // keyRegister(key, channel, message)
220 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); 221 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)");
221 // e << 4096; // Key_Escape 222 // e << 4096; // Key_Escape
222 // e << Key_F5; //4148 223 // e << Key_F5; //4148
223 e << toggleKey; 224 e << toggleKey;
224 e << QString("QPE/VMemo"); 225 e << QString("QPE/VMemo");
225 e << QString("toggleRecord()"); 226 e << QString("toggleRecord()");
226 } 227 }
227 if(toggleKey == 1) 228 if(toggleKey == 1)
228 usingIcon=TRUE; 229 usingIcon=TRUE;
229 else 230 else
230 usingIcon=FALSE; 231 usingIcon=FALSE;
231 if( vmCfg.readNumEntry("hideIcon",0) == 1) 232 if( vmCfg.readNumEntry("hideIcon",0) == 1)
232 hide(); 233 hide();
233 recording = FALSE; 234 recording = FALSE;
234 // } 235 // }
235} 236}
236 237
237VMemo::~VMemo() { 238VMemo::~VMemo() {
238} 239}
239 240
241int VMemo::position()
242{
243 return 6;
244}
245
240void VMemo::receive( const QCString &msg, const QByteArray &data ) { 246void VMemo::receive( const QCString &msg, const QByteArray &data ) {
241 qDebug("receive"); 247 qDebug("receive");
242 QDataStream stream( data, IO_ReadOnly ); 248 QDataStream stream( data, IO_ReadOnly );
243 249
244 if (msg == "toggleRecord()") { 250 if (msg == "toggleRecord()") {
245 if (recording) { 251 if (recording) {
246 fromToggle = TRUE; 252 fromToggle = TRUE;
247 stopRecording(); 253 stopRecording();
248 } else { 254 } else {
249 fromToggle = TRUE; 255 fromToggle = TRUE;
250 startRecording(); 256 startRecording();
251 } 257 }
252 } 258 }
253} 259}
254 260
255void VMemo::paintEvent( QPaintEvent* ) { 261void VMemo::paintEvent( QPaintEvent* ) {
256 QPainter p(this); 262 QPainter p(this);
257 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); 263 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
258} 264}
259 265
260void VMemo::mousePressEvent( QMouseEvent * me) { 266void VMemo::mousePressEvent( QMouseEvent * me) {
261 /* 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
262 mousePressEvent and mouseReleaseEvent with a NULL parameter. */ 268 mousePressEvent and mouseReleaseEvent with a NULL parameter. */
263 269
264// if (!systemZaurus && me != NULL) 270// if (!systemZaurus && me != NULL)
265// return; 271// return;
266// } 272// }
267 273
268 if(!recording) 274 if(!recording)
269 startRecording(); 275 startRecording();
270 else 276 else
271 stopRecording(); 277 stopRecording();
272} 278}
273 279
274void VMemo::mouseReleaseEvent( QMouseEvent * ) { 280void VMemo::mouseReleaseEvent( QMouseEvent * ) {
275} 281}
276 282
277bool VMemo::startRecording() { 283bool VMemo::startRecording() {
278 Config config( "Vmemo" ); 284 Config config( "Vmemo" );
279 config.setGroup( "System" ); 285 config.setGroup( "System" );
280 286
281 useAlerts = config.readBoolEntry("Alert",1); 287 useAlerts = config.readBoolEntry("Alert",1);
282 if(useAlerts) { 288 if(useAlerts) {
283 289
284 msgLabel = new QLabel( 0, "alertLabel" ); 290 msgLabel = new QLabel( 0, "alertLabel" );
285 msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); 291 msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>");
286 msgLabel->show(); 292 msgLabel->show();
287 } 293 }
288 294
289 qDebug("Start recording engines"); 295 qDebug("Start recording engines");
290 recording = TRUE; 296 recording = TRUE;
291 297
292 if (openDSP() == -1) { 298 if (openDSP() == -1) {
293 recording = FALSE; 299 recording = FALSE;
294 return FALSE; 300 return FALSE;
295 } 301 }
296 302
297 config.setGroup("Defaults"); 303 config.setGroup("Defaults");
298 304
299 date = TimeString::dateString( QDateTime::currentDateTime(),false,true); 305 date = TimeString::dateString( QDateTime::currentDateTime(),false,true);
300 date.replace(QRegExp("'"),""); 306 date.replace(QRegExp("'"),"");
301 date.replace(QRegExp(" "),"_"); 307 date.replace(QRegExp(" "),"_");
302 date.replace(QRegExp(":"),"."); 308 date.replace(QRegExp(":"),".");
303 date.replace(QRegExp(","),""); 309 date.replace(QRegExp(","),"");
304 310
305 QString fName; 311 QString fName;
306 config.setGroup( "System" ); 312 config.setGroup( "System" );
307 fName = QPEApplication::documentDir() ; 313 fName = QPEApplication::documentDir() ;
308 fileName = config.readEntry("RecLocation", fName); 314 fileName = config.readEntry("RecLocation", fName);
309 315
310 int s; 316 int s;
311 s=fileName.find(':'); 317 s=fileName.find(':');
312 if(s) 318 if(s)
313 fileName=fileName.right(fileName.length()-s-2); 319 fileName=fileName.right(fileName.length()-s-2);
314 qDebug("pathname will be "+fileName); 320 qDebug("pathname will be "+fileName);
315 321
316 if( fileName.left(1).find('/') == -1) 322 if( fileName.left(1).find('/') == -1)
317 fileName="/"+fileName; 323 fileName="/"+fileName;
318 if( fileName.right(1).find('/') == -1) 324 if( fileName.right(1).find('/') == -1)
319 fileName+="/"; 325 fileName+="/";
320 fName = "vm_"+ date+ ".wav"; 326 fName = "vm_"+ date+ ".wav";
321 327
322 fileName+=fName; 328 fileName+=fName;
323 qDebug("filename is "+fileName); 329 qDebug("filename is "+fileName);
324// open tmp file here 330// open tmp file here
325 char *pointer; 331 char *pointer;
326 pointer=tmpnam(NULL); 332 pointer=tmpnam(NULL);
327 qDebug("Opening tmp file %s",pointer); 333 qDebug("Opening tmp file %s",pointer);
328 334
329 if(openWAV(pointer ) == -1) { 335 if(openWAV(pointer ) == -1) {
330 336
331 QString err("Could not open the temp file\n"); 337 QString err("Could not open the temp file\n");
332 err += fileName; 338 err += fileName;
333 QMessageBox::critical(0, "vmemo", err, "Abort"); 339 QMessageBox::critical(0, "vmemo", err, "Abort");
334 ::close(dsp); 340 ::close(dsp);
335 return FALSE; 341 return FALSE;
@@ -538,96 +544,102 @@ bool VMemo::record() {
538 qApp->processEvents(); 544 qApp->processEvents();
539 } 545 }
540 // qDebug("file has length of %d lasting %d seconds", 546 // qDebug("file has length of %d lasting %d seconds",
541 // length, (( length / speed) / channels) / 2 ); 547 // length, (( length / speed) / channels) / 2 );
542 // } 548 // }
543 549
544 //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<// 550 //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<//
545 551
546 value = length+36; 552 value = length+36;
547 553
548 lseek(wav, 4, SEEK_SET); 554 lseek(wav, 4, SEEK_SET);
549 write(wav, &value, 4); 555 write(wav, &value, 4);
550 lseek(wav, 40, SEEK_SET); 556 lseek(wav, 40, SEEK_SET);
551 557
552 write(wav, &length, 4); 558 write(wav, &length, 4);
553 559
554 track.close(); 560 track.close();
555 qDebug("Track closed"); 561 qDebug("Track closed");
556 562
557 if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) 563 if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1)
558 perror("ioctl(\"SNDCTL_DSP_RESET\")"); 564 perror("ioctl(\"SNDCTL_DSP_RESET\")");
559 565
560 ::close(dsp); 566 ::close(dsp);
561 567
562 Config cfgO("OpieRec"); 568 Config cfgO("OpieRec");
563 cfgO.setGroup("Sounds"); 569 cfgO.setGroup("Sounds");
564 570
565 int nFiles = cfgO.readNumEntry( "NumberofFiles",0); 571 int nFiles = cfgO.readNumEntry( "NumberofFiles",0);
566 572
567 QString currentFileName = fileName; 573 QString currentFileName = fileName;
568 QString currentFile = "vm_"+ date; 574 QString currentFile = "vm_"+ date;
569 575
570 float numberOfRecordedSeconds=(float) length / (float)speed * (float)2; 576 float numberOfRecordedSeconds=(float) length / (float)speed * (float)2;
571 577
572 cfgO.writeEntry( "NumberofFiles", nFiles + 1); 578 cfgO.writeEntry( "NumberofFiles", nFiles + 1);
573 cfgO.writeEntry( QString::number( nFiles + 1), currentFile); 579 cfgO.writeEntry( QString::number( nFiles + 1), currentFile);
574 cfgO.writeEntry( currentFile, currentFileName); 580 cfgO.writeEntry( currentFile, currentFileName);
575 581
576 QString time; 582 QString time;
577 time.sprintf("%.2f", numberOfRecordedSeconds); 583 time.sprintf("%.2f", numberOfRecordedSeconds);
578 cfgO.writeEntry( currentFileName, time ); 584 cfgO.writeEntry( currentFileName, time );
579 // qDebug("writing config numberOfRecordedSeconds "+time); 585 // qDebug("writing config numberOfRecordedSeconds "+time);
580 586
581 cfgO.write(); 587 cfgO.write();
582 588
583 qDebug("done recording "+fileName); 589 qDebug("done recording "+fileName);
584 590
585 Config cfg("qpe"); 591 Config cfg("qpe");
586 cfg.setGroup("Volume"); 592 cfg.setGroup("Volume");
587 QString foo = cfg.readEntry("Mute","TRUE"); 593 QString foo = cfg.readEntry("Mute","TRUE");
588 if(foo.find("TRUE",0,TRUE) != -1) 594 if(foo.find("TRUE",0,TRUE) != -1)
589 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute 595 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute
590return TRUE; 596return TRUE;
591} 597}
592 598
593int VMemo::setToggleButton(int tog) { 599int VMemo::setToggleButton(int tog) {
594 600
595 for( int i=0; i < 10;i++) { 601 for( int i=0; i < 10;i++) {
596 switch (tog) { 602 switch (tog) {
597 case 0: 603 case 0:
598 return -1; 604 return -1;
599 break; 605 break;
600 case 1: 606 case 1:
601 return 0; 607 return 0;
602 break; 608 break;
603 case 2: 609 case 2:
604 return Key_F24; //was Escape 610 return Key_F24; //was Escape
605 break; 611 break;
606 case 3: 612 case 3:
607 return Key_Space; 613 return Key_Space;
608 break; 614 break;
609 case 4: 615 case 4:
610 return Key_F12; 616 return Key_F12;
611 break; 617 break;
612 case 5: 618 case 5:
613 return Key_F9; 619 return Key_F9;
614 break; 620 break;
615 case 6: 621 case 6:
616 return Key_F10; 622 return Key_F10;
617 break; 623 break;
618 case 7: 624 case 7:
619 return Key_F11; 625 return Key_F11;
620 break; 626 break;
621 case 8: 627 case 8:
622 return Key_F13; 628 return Key_F13;
623 break; 629 break;
624 }; 630 };
625 } 631 }
626 return -1; 632 return -1;
627} 633}
628 634
629void VMemo::timerBreak() { 635void VMemo::timerBreak() {
630 //stop 636 //stop
631 stopRecording(); 637 stopRecording();
632 QMessageBox::message("Vmemo","Vmemo recording has ended"); 638 QMessageBox::message("Vmemo","Vmemo recording has ended");
633} 639}
640
641Q_EXPORT_INTERFACE()
642{
643 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VMemo> );
644}
645
diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h
index 31d0a25..1bd735f 100644
--- a/core/applets/vmemo/vmemo.h
+++ b/core/applets/vmemo/vmemo.h
@@ -1,64 +1,65 @@
1/**************************************************************************************94x78** 1/**************************************************************************************94x78**
2** 2**
3** This file may be distributed and/or modified under the terms of the 3** This file may be distributed and/or modified under the terms of the
4** GNU General Public License version 2 as published by the Free Software 4** GNU General Public License version 2 as published by the Free Software
5** Foundation and appearing in the file LICENSE.GPL included in the 5** Foundation and appearing in the file LICENSE.GPL included in the
6** packaging of this file. 6** packaging of this file.
7** 7**
8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10** 10**
11*********************************************************************************************/ 11*********************************************************************************************/
12 12
13/* 13/*
14 * $Id$ 14 * $Id$
15 */ 15 */
16 16
17#ifndef __VMEMO_H__ 17#ifndef __VMEMO_H__
18#define __VMEMO_H__ 18#define __VMEMO_H__
19 19
20 20
21#include <qwidget.h> 21#include <qwidget.h>
22#include <qpixmap.h> 22#include <qpixmap.h>
23#include <qpe/applnk.h> 23#include <qpe/applnk.h>
24#include <qfile.h> 24#include <qfile.h>
25#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qtimer.h> 27#include <qtimer.h>
28 28
29class VMemo : public QWidget 29class VMemo : public QWidget
30{ 30{
31 Q_OBJECT 31 Q_OBJECT
32public: 32public:
33 VMemo( QWidget *parent, const char *name = NULL); 33 VMemo( QWidget *parent, const char *name = NULL);
34 ~VMemo(); 34 ~VMemo();
35 static int position();
35 QFile track; 36 QFile track;
36 int length; 37 int length;
37 QString fileName, errorMsg, date; 38 QString fileName, errorMsg, date;
38 QLabel* msgLabel; 39 QLabel* msgLabel;
39 QTimer *t_timer; 40 QTimer *t_timer;
40bool usingIcon, useADPCM; 41bool usingIcon, useADPCM;
41public slots: 42public slots:
42 bool record(); 43 bool record();
43 void mousePressEvent( QMouseEvent * ); 44 void mousePressEvent( QMouseEvent * );
44 void mouseReleaseEvent( QMouseEvent * ); 45 void mouseReleaseEvent( QMouseEvent * );
45 void receive( const QCString &msg, const QByteArray &data ); 46 void receive( const QCString &msg, const QByteArray &data );
46 bool startRecording(); 47 bool startRecording();
47 void stopRecording(); 48 void stopRecording();
48 void timerBreak(); 49 void timerBreak();
49private: 50private:
50 bool useAlerts; 51 bool useAlerts;
51 void paintEvent( QPaintEvent* ); 52 void paintEvent( QPaintEvent* );
52 int setToggleButton(int); 53 int setToggleButton(int);
53 int openDSP(); 54 int openDSP();
54 int openWAV(const char *filename); 55 int openWAV(const char *filename);
55 bool fromToggle; 56 bool fromToggle;
56 QPixmap vmemoPixmap; 57 QPixmap vmemoPixmap;
57 QCopChannel *myChannel; 58 QCopChannel *myChannel;
58 bool systemZaurus; 59 bool systemZaurus;
59 int dsp, wav, rate, speed, channels, format, resolution; 60 int dsp, wav, rate, speed, channels, format, resolution;
60 bool recording; 61 bool recording;
61}; 62};
62 63
63#endif // __VMEMO_H__ 64#endif // __VMEMO_H__
64 65
diff --git a/core/applets/vmemo/vmemo.pro b/core/applets/vmemo/vmemo.pro
index f83a53f..2deedfd 100644
--- a/core/applets/vmemo/vmemo.pro
+++ b/core/applets/vmemo/vmemo.pro
@@ -1,13 +1,13 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = vmemo.h vmemoimpl.h adpcm.h 3HEADERS = vmemo.h adpcm.h
4SOURCES = vmemo.cpp vmemoimpl.cpp adpcm.c 4SOURCES = vmemo.cpp adpcm.c
5TARGET = vmemoapplet 5TARGET = vmemoapplet
6DESTDIR =$(OPIEDIR)/plugins/applets 6DESTDIR =$(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets
diff --git a/core/applets/vmemo/vmemoimpl.cpp b/core/applets/vmemo/vmemoimpl.cpp
deleted file mode 100644
index 7779b83..0000000
--- a/core/applets/vmemo/vmemoimpl.cpp
+++ b/dev/null
@@ -1,61 +0,0 @@
1/**************************************************************************************94x78**
2 **
3 ** This file may be distributed and/or modified under the terms of the
4 ** GNU General Public License version 2 as published by the Free Software
5 ** Foundation and appearing in the file LICENSE.GPL included in the
6 ** packaging of this file.
7 **
8 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 **
11 *********************************************************************************************/
12
13/*
14 * $Id$
15 */
16
17#include "vmemo.h"
18#include "vmemoimpl.h"
19
20
21VMemoAppletImpl::VMemoAppletImpl()
22 : vmemo(0)
23{
24}
25
26VMemoAppletImpl::~VMemoAppletImpl()
27{
28 delete vmemo;
29}
30
31QWidget *VMemoAppletImpl::applet( QWidget *parent )
32{
33 if ( !vmemo )
34 vmemo = new VMemo( parent );
35 return vmemo;
36}
37
38int VMemoAppletImpl::position() const
39{
40 return 6;
41}
42
43QRESULT VMemoAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
44{
45 *iface = 0;
46 if ( uuid == IID_QUnknown )
47 *iface = this;
48 else if ( uuid == IID_TaskbarApplet )
49 *iface = this;
50 else
51 return QS_FALSE;
52
53 if ( *iface )
54 (*iface)->addRef();
55 return QS_OK;
56}
57
58Q_EXPORT_INTERFACE()
59{
60 Q_CREATE_INSTANCE( VMemoAppletImpl )
61 }
diff --git a/core/applets/vmemo/vmemoimpl.h b/core/applets/vmemo/vmemoimpl.h
deleted file mode 100644
index 985138b..0000000
--- a/core/applets/vmemo/vmemoimpl.h
+++ b/dev/null
@@ -1,40 +0,0 @@
1/**************************************************************************************94x78**
2**
3** This file may be distributed and/or modified under the terms of the
4** GNU General Public License version 2 as published by the Free Software
5** Foundation and appearing in the file LICENSE.GPL included in the
6** packaging of this file.
7**
8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10**
11*********************************************************************************************/
12
13/*
14 * $Id$
15 */
16
17#ifndef __VMEMOIMPLAPPLETIMPL_H__
18#define __VMEMOIMPLAPPLETIMPL_H__
19
20#include <qpe/taskbarappletinterface.h>
21
22class VMemo;
23
24class VMemoAppletImpl : public TaskbarAppletInterface
25{
26public:
27 VMemoAppletImpl();
28 virtual ~VMemoAppletImpl();
29
30 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
31 Q_REFCOUNT
32
33 virtual QWidget *applet( QWidget *parent );
34 virtual int position() const;
35
36private:
37 VMemo *vmemo;
38};
39
40#endif
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
index c736437..8fd88f6 100644
--- a/core/applets/volumeapplet/volume.cpp
+++ b/core/applets/volumeapplet/volume.cpp
@@ -1,140 +1,136 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <stdio.h>
22
23#include "volume.h" 21#include "volume.h"
22#include "oledbox.h"
24 23
24#include <opie2/odevice.h>
25#include <opie2/otaskbarapplet.h>
25#include <qpe/resource.h> 26#include <qpe/resource.h>
26#include <qpe/applnk.h> 27#include <qpe/applnk.h>
27#include <qpe/config.h> 28#include <qpe/config.h>
28#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
29#include <qpe/qcopenvelope_qws.h> 29#include <qpe/qcopenvelope_qws.h>
30#endif
31 30
32#include <qpainter.h> 31#include <qpainter.h>
33#include <qcheckbox.h> 32#include <qcheckbox.h>
34#include <qslider.h> 33#include <qslider.h>
35#include <qlayout.h> 34#include <qlayout.h>
36#include <qvbox.h> 35#include <qvbox.h>
37#include <qlabel.h> 36#include <qlabel.h>
38
39#include <qpushbutton.h> 37#include <qpushbutton.h>
40#include <qtimer.h> 38#include <qtimer.h>
41 39
42#include <opie/odevice.h> 40#include <stdio.h>
43
44#include "oledbox.h"
45 41
46using namespace Opie; 42using namespace Opie;
47 43
48#define RATE_TIMER_INTERVAL 100 44#define RATE_TIMER_INTERVAL 100
49// Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time 45// Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time
50// results in "hanging" buttons on the iPAQ due to quite high CPU consumption. 46// results in "hanging" buttons on the iPAQ due to quite high CPU consumption.
51 47
52 48
53/* XPM */ 49/* XPM */
54static const char * vol_xpm[] = { 50static const char * vol_xpm[] = {
55"20 20 3 1", 51"20 20 3 1",
56" c None", 52" c None",
57". c #0000FF", 53". c #0000FF",
58"+ c #000000", 54"+ c #000000",
59" ", 55" ",
60" . ", 56" . ",
61" . . . . ", 57" . . . . ",
62" . . . . . . ", 58" . . . . . . ",
63" . . . . . . . ", 59" . . . . . . . ",
64" . . ..... . . ", 60" . . ..... . . ",
65" . ... ..... ... ", 61" . ... ..... ... ",
66" ........... .... ", 62" ........... .... ",
67" ................. ", 63" ................. ",
68"++++++++++++++++++++", 64"++++++++++++++++++++",
69" .................. ", 65" .................. ",
70" . ............. . ", 66" . ............. . ",
71" . ..... ....... ", 67" . ..... ....... ",
72" . ... ..... . ", 68" . ... ..... . ",
73" . ... ..... . ", 69" . ... ..... . ",
74" . ... ..... ", 70" . ... ..... ",
75" . . . . . ", 71" . . . . . ",
76" . . . ", 72" . . . ",
77" . . . ", 73" . . . ",
78" "}; 74" "};
79/* XPM */ 75/* XPM */
80static const char * mic_xpm[] = { 76static const char * mic_xpm[] = {
81"20 20 21 1", 77"20 20 21 1",
82" c None", 78" c None",
83". c #000000", 79". c #000000",
84"+ c #EEEEEE", 80"+ c #EEEEEE",
85"@ c #B4B6B4", 81"@ c #B4B6B4",
86"# c #8B8D8B", 82"# c #8B8D8B",
87"$ c #D5D6D5", 83"$ c #D5D6D5",
88"% c #E6E6E6", 84"% c #E6E6E6",
89"& c #9C9D9C", 85"& c #9C9D9C",
90"* c #6A696A", 86"* c #6A696A",
91"= c #E6E2E6", 87"= c #E6E2E6",
92"- c #F6F2F6", 88"- c #F6F2F6",
93"; c #CDC6CD", 89"; c #CDC6CD",
94"> c #737573", 90"> c #737573",
95", c #4A484A", 91", c #4A484A",
96"' c #DEDEDE", 92"' c #DEDEDE",
97") c #F6EEF6", 93") c #F6EEF6",
98"! c #414041", 94"! c #414041",
99"~ c #202020", 95"~ c #202020",
100"{ c #ACAEAC", 96"{ c #ACAEAC",
101"] c #838583", 97"] c #838583",
102"^ c #6A656A", 98"^ c #6A656A",
103" ", 99" ",
104" .... ", 100" .... ",
105" .+@+#. ", 101" .+@+#. ",
106" ..$%&%*. ", 102" ..$%&%*. ",
107" .=-.;=>=,. ", 103" .=-.;=>=,. ",
108" .'+).&+!+. ", 104" .'+).&+!+. ",
109" .+;+;.~+~. ", 105" .+;+;.~+~. ",
110" ..%{%,.... ", 106" ..%{%,.... ",
111" ..&=>=~.. ", 107" ..&=>=~.. ",
112" .+..]^,.. ", 108" .+..]^,.. ",
113" .+....... ", 109" .+....... ",
114" .%... ", 110" .%... ",
115" .=... ", 111" .=... ",
116" .+... ", 112" .+... ",
117" .+... ", 113" .+... ",
118" .... ", 114" .... ",
119" .... ", 115" .... ",
120" .. ", 116" .. ",
121" . ", 117" . ",
122". "}; 118". "};
123 119
124 120
125static const char * bass_xpm[] = { 121static const char * bass_xpm[] = {
126"20 20 3 1", 122"20 20 3 1",
127" c None", 123" c None",
128". c #000000", 124". c #000000",
129"+ c #0000FF", 125"+ c #0000FF",
130" ", 126" ",
131" ", 127" ",
132" ", 128" ",
133"..... +++ ......", 129"..... +++ ......",
134" +++++++ ", 130" +++++++ ",
135" ++ ++ ", 131" ++ ++ ",
136"... ++ ... ++ ++ .", 132"... ++ ... ++ ++ .",
137" +++ ++ ++ ", 133" +++ ++ ++ ",
138" ++++ ++ ", 134" ++++ ++ ",
139"... ++++ .. ++ .....", 135"... ++++ .. ++ .....",
140" ++ ++ ", 136" ++ ++ ",
@@ -644,136 +640,144 @@ void VolumeControl::micMoved ( int percent )
644{ 640{
645 m_mic_percent = 100 - percent; 641 m_mic_percent = 100 - percent;
646 642
647 // clamp volume percent to be between 0 and 100 643 // clamp volume percent to be between 0 and 100
648 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 );
649 645
650 writeConfigEntry ( "Mic", m_mic_percent, UPD_Mic ); 646 writeConfigEntry ( "Mic", m_mic_percent, UPD_Mic );
651} 647}
652 648
653void VolumeControl::alarmMoved ( int percent ) 649void VolumeControl::alarmMoved ( int percent )
654{ 650{
655 m_alarm_percent = 100 - percent; 651 m_alarm_percent = 100 - percent;
656 652
657 // clamp volume percent to be between 0 and 100 653 // clamp volume percent to be between 0 and 100
658 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 );
659 655
660 writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); 656 writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None );
661} 657}
662 658
663 659
664void VolumeControl::bassMoved ( int percent ) 660void VolumeControl::bassMoved ( int percent )
665{ 661{
666 m_bass_percent = 100 - percent; 662 m_bass_percent = 100 - percent;
667 663
668 // clamp bass percent to be between 0 and 100 664 // clamp bass percent to be between 0 and 100
669 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 );
670 666
671 writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass ); 667 writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass );
672} 668}
673 669
674 670
675 671
676void VolumeControl::trebleMoved ( int percent ) 672void VolumeControl::trebleMoved ( int percent )
677{ 673{
678 m_treble_percent = 100 - percent; 674 m_treble_percent = 100 - percent;
679 675
680 // clamp treble percent to be between 0 and 100 676 // clamp treble percent to be between 0 and 100
681 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 );
682 678
683 writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble ); 679 writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble );
684} 680}
685 681
686 682
687 683
688void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) 684void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd )
689{ 685{
690 Config cfg ( "qpe" ); 686 Config cfg ( "qpe" );
691 cfg. setGroup ( "Volume" ); 687 cfg. setGroup ( "Volume" );
692 cfg. writeEntry ( entry, val ); 688 cfg. writeEntry ( entry, val );
693// cfg. write ( ); 689// cfg. write ( );
694 690
695#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)
696 switch ( upd ) { 692 switch ( upd ) {
697 case UPD_Vol: { 693 case UPD_Vol: {
698 QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; 694 QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted;
699 break; 695 break;
700 } 696 }
701 case UPD_Mic: { 697 case UPD_Mic: {
702 QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; 698 QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted;
703 break; 699 break;
704 } 700 }
705 case UPD_Bass: { 701 case UPD_Bass: {
706 QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; 702 QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true;
707 break; 703 break;
708 } 704 }
709 case UPD_Treble: { 705 case UPD_Treble: {
710 QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; 706 QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true;
711 break; 707 break;
712 } 708 }
713 709
714 case UPD_None: 710 case UPD_None:
715 break; 711 break;
716 } 712 }
717#endif 713#endif
718} 714}
719 715
720//=========================================================================== 716//===========================================================================
721 717
722VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) 718VolumeApplet::VolumeApplet( QWidget *parent, const char *name )
723 : QWidget( parent, name ) 719 : QWidget( parent, name )
724{ 720{
725 setFixedWidth ( AppLnk::smallIconSize() ); 721 setFixedWidth ( AppLnk::smallIconSize() );
726 setFixedHeight ( AppLnk::smallIconSize()+4 ); 722 setFixedHeight ( AppLnk::smallIconSize()+4 );
727 723
728 m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); 724 m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" ));
729 m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); 725 m_dialog = new VolumeControl ( this, true, this, "volumecontrol" );
730 726
731 connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); 727 connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool )));
732 connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); 728 connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool )));
733} 729}
734 730
735VolumeApplet::~VolumeApplet() 731VolumeApplet::~VolumeApplet()
736{ 732{
737 delete m_pixmap; 733 delete m_pixmap;
738} 734}
739 735
736int VolumeApplet::position()
737{
738 return 6;
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()
781{
782 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VolumeApplet> );
783}
diff --git a/core/applets/volumeapplet/volume.h b/core/applets/volumeapplet/volume.h
index d2345b5..454a688 100644
--- a/core/applets/volumeapplet/volume.h
+++ b/core/applets/volumeapplet/volume.h
@@ -24,111 +24,112 @@
24 24
25#include <qframe.h> 25#include <qframe.h>
26 26
27class QPixmap; 27class QPixmap;
28class QTimer; 28class QTimer;
29class QSlider; 29class QSlider;
30class QCheckBox; 30class QCheckBox;
31class QButton; 31class QButton;
32class OLedBox; 32class OLedBox;
33 33
34class VolumeApplet; 34class VolumeApplet;
35 35
36class VolumeControl : public QFrame { 36class VolumeControl : public QFrame {
37 Q_OBJECT 37 Q_OBJECT
38 38
39public: 39public:
40 VolumeControl ( VolumeApplet *icon, bool showMic = false, QWidget *parent=0, const char *name=0 ); 40 VolumeControl ( VolumeApplet *icon, bool showMic = false, QWidget *parent=0, const char *name=0 );
41 41
42 bool volMuted ( ) const; 42 bool volMuted ( ) const;
43 int volPercent ( ) const; 43 int volPercent ( ) const;
44 44
45 virtual void show ( bool showmic ); 45 virtual void show ( bool showmic );
46 46
47protected: 47protected:
48 virtual void keyPressEvent ( QKeyEvent * e ); 48 virtual void keyPressEvent ( QKeyEvent * e );
49 49
50protected slots: 50protected slots:
51 void volumeChanged ( bool muted ); 51 void volumeChanged ( bool muted );
52 void micChanged ( bool muted ); 52 void micChanged ( bool muted );
53 53
54private slots: 54private slots:
55 void volMoved ( int percent ); 55 void volMoved ( int percent );
56 void micMoved ( int percent ); 56 void micMoved ( int percent );
57 void alarmMoved ( int percent ); 57 void alarmMoved ( int percent );
58 void bassMoved( int percent ); 58 void bassMoved( int percent );
59 void trebleMoved( int percent ); 59 void trebleMoved( int percent );
60 60
61 void volMuteToggled ( bool ); 61 void volMuteToggled ( bool );
62 void micMuteToggled ( bool ); 62 void micMuteToggled ( bool );
63 void alarmSoundToggled ( bool ); 63 void alarmSoundToggled ( bool );
64 void keyClickToggled ( bool ); 64 void keyClickToggled ( bool );
65 void screenTapToggled ( bool ); 65 void screenTapToggled ( bool );
66 66
67 void buttonChanged ( ); 67 void buttonChanged ( );
68 void rateTimerDone ( ); 68 void rateTimerDone ( );
69 69
70private: 70private:
71 void readConfig ( bool force = false ); 71 void readConfig ( bool force = false );
72 72
73 enum eUpdate { 73 enum eUpdate {
74 UPD_None, 74 UPD_None,
75 UPD_Vol, 75 UPD_Vol,
76 UPD_Mic, 76 UPD_Mic,
77 UPD_Bass, 77 UPD_Bass,
78 UPD_Treble 78 UPD_Treble
79 }; 79 };
80 void writeConfigEntry ( const char *entry, int val, eUpdate upd ); 80 void writeConfigEntry ( const char *entry, int val, eUpdate upd );
81 81
82 82
83private: 83private:
84 QSlider *volSlider; 84 QSlider *volSlider;
85 QSlider *bassSlider; 85 QSlider *bassSlider;
86 QSlider *trebleSlider; 86 QSlider *trebleSlider;
87 QSlider *micSlider; 87 QSlider *micSlider;
88 QSlider *alarmSlider; 88 QSlider *alarmSlider;
89 OLedBox *volLed; 89 OLedBox *volLed;
90 OLedBox *micLed; 90 OLedBox *micLed;
91 OLedBox *alarmLed; 91 OLedBox *alarmLed;
92 92
93 QCheckBox *alarmBox; 93 QCheckBox *alarmBox;
94 QCheckBox *tapBox; 94 QCheckBox *tapBox;
95 QCheckBox *keyBox; 95 QCheckBox *keyBox;
96 QPushButton *upButton; 96 QPushButton *upButton;
97 QPushButton *downButton; 97 QPushButton *downButton;
98 QTimer *rateTimer; 98 QTimer *rateTimer;
99 99
100 int m_vol_percent; 100 int m_vol_percent;
101 int m_mic_percent; 101 int m_mic_percent;
102 int m_alarm_percent; 102 int m_alarm_percent;
103 int m_bass_percent; 103 int m_bass_percent;
104 int m_treble_percent; 104 int m_treble_percent;
105 bool m_vol_muted; 105 bool m_vol_muted;
106 bool m_mic_muted; 106 bool m_mic_muted;
107 bool m_snd_alarm; 107 bool m_snd_alarm;
108 bool m_snd_touch; 108 bool m_snd_touch;
109 bool m_snd_key; 109 bool m_snd_key;
110 110
111 VolumeApplet *m_icon; 111 VolumeApplet *m_icon;
112}; 112};
113 113
114class VolumeApplet : public QWidget { 114class VolumeApplet : public QWidget {
115 Q_OBJECT 115 Q_OBJECT
116 116
117public: 117public:
118 VolumeApplet ( QWidget *parent = 0, const char *name=0 ); 118 VolumeApplet ( QWidget *parent = 0, const char *name=0 );
119 ~VolumeApplet ( ); 119 ~VolumeApplet ( );
120 static int position();
120 121
121 void redraw ( bool all = true ); 122 void redraw ( bool all = true );
122 123
123protected: 124protected:
124 virtual void mousePressEvent ( QMouseEvent * ); 125 virtual void mousePressEvent ( QMouseEvent * );
125 virtual void paintEvent ( QPaintEvent* ); 126 virtual void paintEvent ( QPaintEvent* );
126 127
127private: 128private:
128 QPixmap * m_pixmap; 129 QPixmap * m_pixmap;
129 VolumeControl *m_dialog; 130 VolumeControl *m_dialog;
130}; 131};
131 132
132 133
133#endif // __VOLUME_APPLET_H__ 134#endif // __VOLUME_APPLET_H__
134 135
diff --git a/core/applets/volumeapplet/volumeapplet.pro b/core/applets/volumeapplet/volumeapplet.pro
index 92c6b0a..b14956e 100644
--- a/core/applets/volumeapplet/volumeapplet.pro
+++ b/core/applets/volumeapplet/volumeapplet.pro
@@ -1,13 +1,13 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt plugin warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= volume.h volumeappletimpl.h oledbox.h 3 HEADERS = volume.h oledbox.h
4 SOURCES= volume.cpp volumeappletimpl.cpp oledbox.cpp 4 SOURCES = volume.cpp oledbox.cpp
5 TARGET = volumeapplet 5 TARGET = volumeapplet
6 DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets
diff --git a/core/applets/volumeapplet/volumeappletimpl.cpp b/core/applets/volumeapplet/volumeappletimpl.cpp
deleted file mode 100644
index 9c7dea3..0000000
--- a/core/applets/volumeapplet/volumeappletimpl.cpp
+++ b/dev/null
@@ -1,65 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "volume.h"
21#include "volumeappletimpl.h"
22
23VolumeAppletImpl::VolumeAppletImpl()
24 : volume(0)
25{
26}
27
28VolumeAppletImpl::~VolumeAppletImpl()
29{
30 delete volume;
31}
32
33QWidget *VolumeAppletImpl::applet( QWidget *parent )
34{
35 if ( !volume )
36 volume = new VolumeApplet( parent );
37 return volume;
38}
39
40int VolumeAppletImpl::position() const
41{
42 return 6;
43}
44
45QRESULT VolumeAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
46{
47 *iface = 0;
48 if ( uuid == IID_QUnknown )
49 *iface = this;
50 else if ( uuid == IID_TaskbarApplet )
51 *iface = this;
52 else
53 return QS_FALSE;
54
55 if ( *iface )
56 (*iface)->addRef();
57 return QS_OK;
58}
59
60Q_EXPORT_INTERFACE()
61{
62 Q_CREATE_INSTANCE( VolumeAppletImpl )
63}
64
65
diff --git a/core/applets/volumeapplet/volumeappletimpl.h b/core/applets/volumeapplet/volumeappletimpl.h
deleted file mode 100644
index a9221c6..0000000
--- a/core/applets/volumeapplet/volumeappletimpl.h
+++ b/dev/null
@@ -1,43 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef VOLUMEAPPLETIMPL_H
21#define VOLUMEAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class VolumeApplet;
26
27class VolumeAppletImpl : public TaskbarAppletInterface
28{
29public:
30 VolumeAppletImpl();
31 virtual ~VolumeAppletImpl();
32
33 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
34 Q_REFCOUNT
35
36 virtual QWidget *applet( QWidget *parent );
37 virtual int position() const;
38
39private:
40 VolumeApplet *volume;
41};
42
43#endif
diff --git a/core/obex/obex.pro b/core/obex/obex.pro
index 6f0e6d1..a296b2c 100644
--- a/core/obex/obex.pro
+++ b/core/obex/obex.pro
@@ -1,13 +1,13 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt warn_on release
3 HEADERS= obex.h obeximpl.h obexhandler.h obexsend.h receiver.h 3 HEADERS= obex.h obexhandler.h obexsend.h receiver.h
4 SOURCES= obex.cc obeximpl.cpp obexsend.cpp obexhandler.cpp receiver.cpp 4 SOURCES= obex.cc obexsend.cpp obexhandler.cpp receiver.cpp
5 TARGET = opieobex 5 TARGET = opieobex
6 DESTDIR = $(OPIEDIR)/plugins/obex 6 DESTDIR = $(OPIEDIR)/plugins/obex
7INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher 7INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe -lopie 9LIBS += -lqpe -lopiecore2
10 VERSION = 0.0.2 10 VERSION = 0.0.2
11 11
12include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets