summaryrefslogtreecommitdiff
authorzecke <zecke>2004-03-13 21:53:54 (UTC)
committer zecke <zecke>2004-03-13 21:53:54 (UTC)
commit2eb5c075b612498c4b65f3d49389b8612612a930 (patch) (unidiff)
treea0230cd9007f71bbb387b71b8e58684937e0cf70
parent184a0cd9935d0a249038cdbe05488c181b273d64 (diff)
downloadopie-2eb5c075b612498c4b65f3d49389b8612612a930.zip
opie-2eb5c075b612498c4b65f3d49389b8612612a930.tar.gz
opie-2eb5c075b612498c4b65f3d49389b8612612a930.tar.bz2
Introduce the namespace
and the new APPLET_EXPORT define
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/autorotateapplet/autorotate.cpp8
-rw-r--r--noncore/applets/memoryapplet/memorymeter.cpp26
-rw-r--r--noncore/applets/memoryapplet/memorystatus.cpp1
-rw-r--r--noncore/applets/memoryapplet/memorystatus.h4
-rw-r--r--noncore/applets/networkapplet/networkapplet.cpp7
-rw-r--r--noncore/applets/networkapplet/networkapplet.h18
-rw-r--r--noncore/applets/notesapplet/notes.cpp8
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp9
-rw-r--r--noncore/applets/wirelessapplet/wireless.h9
-rw-r--r--noncore/applets/zkbapplet/zkbwidget.cpp11
10 files changed, 51 insertions, 50 deletions
diff --git a/noncore/applets/autorotateapplet/autorotate.cpp b/noncore/applets/autorotateapplet/autorotate.cpp
index 94be0ae..ae7fbd0 100644
--- a/noncore/applets/autorotateapplet/autorotate.cpp
+++ b/noncore/applets/autorotateapplet/autorotate.cpp
@@ -1,58 +1,57 @@
1/* 1/*
2 * copyright : (c) 2003 by Greg Gilbert 2 * copyright : (c) 2003 by Greg Gilbert
3 * email : greg@treke.net 3 * email : greg@treke.net
4 * based on the cardmon applet by Max Reiss 4 * based on the cardmon applet by Max Reiss
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 * * 10 * *
11 *************************************************************************/ 11 *************************************************************************/
12 12
13#include "autorotate.h" 13#include "autorotate.h"
14 14
15/* OPIE */ 15/* OPIE */
16#include <opie2/odevice.h> 16#include <opie2/odevice.h>
17#include <opie2/otaskbarapplet.h> 17#include <opie2/otaskbarapplet.h>
18#include <qpe/applnk.h> 18#include <qpe/applnk.h>
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21 21
22/* QT */ 22/* QT */
23#include <qpainter.h> 23#include <qpainter.h>
24 24
25using namespace Opie; 25using namespace Opie::Ui;
26
27AutoRotate::AutoRotate(QWidget * parent):QWidget(parent) 26AutoRotate::AutoRotate(QWidget * parent):QWidget(parent)
28{ 27{
29 setFixedWidth( AppLnk::smallIconSize() ); 28 setFixedWidth( AppLnk::smallIconSize() );
30 setFixedHeight( AppLnk::smallIconSize() ); 29 setFixedHeight( AppLnk::smallIconSize() );
31 30
32 enabledPm.convertFromImage( Resource::loadImage("autorotate/rotate").smoothScale( height(), width() ) ); 31 enabledPm.convertFromImage( Resource::loadImage("autorotate/rotate").smoothScale( height(), width() ) );
33 disabledPm.convertFromImage( Resource::loadImage("autorotate/norotate").smoothScale( height(), width() ) ); 32 disabledPm.convertFromImage( Resource::loadImage("autorotate/norotate").smoothScale( height(), width() ) );
34 33
35 repaint(true); 34 repaint(true);
36 popupMenu = 0; 35 popupMenu = 0;
37 show(); 36 show();
38} 37}
39 38
40AutoRotate::~AutoRotate() 39AutoRotate::~AutoRotate()
41{ 40{
42 if (popupMenu) { 41 if (popupMenu) {
43 delete popupMenu; 42 delete popupMenu;
44 } 43 }
45} 44}
46 45
47int AutoRotate::position() 46int AutoRotate::position()
48{ 47{
49 return 7; 48 return 7;
50} 49}
51 50
52void AutoRotate::mousePressEvent(QMouseEvent *) 51void AutoRotate::mousePressEvent(QMouseEvent *)
53{ 52{
54 QPopupMenu *menu = new QPopupMenu(this); 53 QPopupMenu *menu = new QPopupMenu(this);
55 menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 ); 54 menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 );
56 55
57 QPoint p = mapToGlobal(QPoint(0, 0)); 56 QPoint p = mapToGlobal(QPoint(0, 0));
58 QSize s = menu->sizeHint(); 57 QSize s = menu->sizeHint();
@@ -65,37 +64,34 @@ void AutoRotate::mousePressEvent(QMouseEvent *)
65 } 64 }
66 65
67 delete menu; 66 delete menu;
68} 67}
69 68
70void AutoRotate::paintEvent(QPaintEvent *) 69void AutoRotate::paintEvent(QPaintEvent *)
71{ 70{
72 QPainter p(this); 71 QPainter p(this);
73 p.drawPixmap( 0, 0, isRotateEnabled()? enabledPm : disabledPm ); 72 p.drawPixmap( 0, 0, isRotateEnabled()? enabledPm : disabledPm );
74} 73}
75 74
76void AutoRotate::setRotateEnabled(bool status) 75void AutoRotate::setRotateEnabled(bool status)
77{ 76{
78 Config cfg( "qpe" ); 77 Config cfg( "qpe" );
79 cfg.setGroup( "Appearance" ); 78 cfg.setGroup( "Appearance" );
80 cfg.writeEntry( "rotateEnabled", status ); 79 cfg.writeEntry( "rotateEnabled", status );
81 80
82} 81}
83bool AutoRotate::isRotateEnabled() 82bool AutoRotate::isRotateEnabled()
84{ 83{
85 Config cfg( "qpe" ); 84 Config cfg( "qpe" );
86 cfg.setGroup( "Appearance" ); 85 cfg.setGroup( "Appearance" );
87 86
88 bool res = cfg.readBoolEntry( "rotateEnabled" ); 87 bool res = cfg.readBoolEntry( "rotateEnabled" );
89 88
90 if (res ) 89 if (res )
91 qDebug("Enabled"); 90 qDebug("Enabled");
92 else 91 else
93 qDebug("Disabled"); 92 qDebug("Disabled");
94 return res; 93 return res;
95} 94}
96 95
97Q_EXPORT_INTERFACE() 96EXPORT_OPIE_APPLET_v1( AutoRotate )
98{
99 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<AutoRotate> );
100}
101 97
diff --git a/noncore/applets/memoryapplet/memorymeter.cpp b/noncore/applets/memoryapplet/memorymeter.cpp
index 9299f49..9cdeaf4 100644
--- a/noncore/applets/memoryapplet/memorymeter.cpp
+++ b/noncore/applets/memoryapplet/memorymeter.cpp
@@ -2,138 +2,139 @@
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "memorymeter.h" 20#include "memorymeter.h"
21#include "memorystatus.h" 21#include "memorystatus.h"
22 22
23#include <opie2/otaskbarapplet.h> 23#include <opie2/otaskbarapplet.h>
24#include <qtopia/power.h> 24#include <qtopia/power.h>
25#include <qtopia/config.h> 25#include <qtopia/config.h>
26#include <qtopia/qcopenvelope_qws.h> 26#include <qtopia/qcopenvelope_qws.h>
27 27
28#include <qpainter.h> 28#include <qpainter.h>
29#include <qtimer.h> 29#include <qtimer.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32#include <qtopia/applnk.h> 32#include <qtopia/applnk.h>
33 33
34using namespace Opie::Ui;
34MemoryMeter::MemoryMeter( QWidget *parent ) 35MemoryMeter::MemoryMeter( QWidget *parent )
35 : QWidget( parent ), memoryView(0) 36 : QWidget( parent ), memoryView(0)
36{ 37{
37 bvsz = QSize(); 38 bvsz = QSize();
38 if ( qApp->desktop()->height() >= 300 ) 39 if ( qApp->desktop()->height() >= 300 )
39 { 40 {
40 memoryView = new MemoryStatus( 0, WStyle_StaysOnTop | WType_Popup ); 41 memoryView = new MemoryStatus( 0, WStyle_StaysOnTop | WType_Popup );
41 memoryView->setFrameStyle( QFrame::Panel | QFrame::Raised ); 42 memoryView->setFrameStyle( QFrame::Panel | QFrame::Raised );
42 } 43 }
43 else 44 else
44 { 45 {
45 memoryView = new MemoryStatus( 0 ); 46 memoryView = new MemoryStatus( 0 );
46 memoryView->showMaximized(); 47 memoryView->showMaximized();
47 } 48 }
48 49
49 Config config("MemoryPlugin"); 50 Config config("MemoryPlugin");
50 config.setGroup("Warning levels"); 51 config.setGroup("Warning levels");
51 low = config.readNumEntry("low", 40); 52 low = config.readNumEntry("low", 40);
52 critical = config.readNumEntry("critical", 20); 53 critical = config.readNumEntry("critical", 20);
53 54
54 startTimer( 10000 ); 55 startTimer( 10000 );
55 setFixedWidth(10); 56 setFixedWidth(10);
56 setFixedHeight(AppLnk::smallIconSize()); 57 setFixedHeight(AppLnk::smallIconSize());
57 usageTimer = new QTimer( this ); 58 usageTimer = new QTimer( this );
58 connect( usageTimer, SIGNAL(timeout()), this, SLOT(usageTimeout()) ); 59 connect( usageTimer, SIGNAL(timeout()), this, SLOT(usageTimeout()) );
59 timerEvent(0); 60 timerEvent(0);
60} 61}
61 62
62MemoryMeter::~MemoryMeter() 63MemoryMeter::~MemoryMeter()
63{ 64{
64 delete (QWidget *) memoryView; 65 delete (QWidget *) memoryView;
65} 66}
66 67
67int MemoryMeter::position() 68int MemoryMeter::position()
68{ 69{
69 return 7; 70 return 7;
70} 71}
71 72
72QSize MemoryMeter::sizeHint() const 73QSize MemoryMeter::sizeHint() const
73{ 74{
74 return QSize(10, AppLnk::smallIconSize()); 75 return QSize(10, AppLnk::smallIconSize());
75} 76}
76 77
77bool MemoryMeter::updateMemoryViewGeometry() 78bool MemoryMeter::updateMemoryViewGeometry()
78{ 79{
79 if (memoryView != 0) 80 if (memoryView != 0)
80 { 81 {
81 QSize sz = memoryView->sizeHint(); 82 QSize sz = memoryView->sizeHint();
82 if ( sz != bvsz ) 83 if ( sz != bvsz )
83 { 84 {
84 bvsz = sz; 85 bvsz = sz;
85 QRect r(memoryView->pos(), memoryView->sizeHint()); 86 QRect r(memoryView->pos(), memoryView->sizeHint());
86 if ( qApp->desktop()->height() >= 300 ) 87 if ( qApp->desktop()->height() >= 300 )
87 { 88 {
88 QPoint curPos = mapToGlobal( rect().topLeft() ); 89 QPoint curPos = mapToGlobal( rect().topLeft() );
89 int lp = qApp->desktop()->width() - memoryView->sizeHint().width(); 90 int lp = qApp->desktop()->width() - memoryView->sizeHint().width();
90 r.moveTopLeft( QPoint(lp, curPos.y() - memoryView->sizeHint().height()-1) ); 91 r.moveTopLeft( QPoint(lp, curPos.y() - memoryView->sizeHint().height()-1) );
91 } 92 }
92 memoryView->setGeometry(r); 93 memoryView->setGeometry(r);
93 return TRUE; 94 return TRUE;
94 } 95 }
95 return FALSE; 96 return FALSE;
96 } 97 }
97 98
98 return FALSE; 99 return FALSE;
99} 100}
100 101
101void MemoryMeter::mousePressEvent( QMouseEvent *) 102void MemoryMeter::mousePressEvent( QMouseEvent *)
102{ 103{
103 if ( memoryView->isVisible() ) 104 if ( memoryView->isVisible() )
104 { 105 {
105 memoryView->hide(); 106 memoryView->hide();
106 } 107 }
107 else 108 else
108 { 109 {
109 bvsz = QSize(); 110 bvsz = QSize();
110 updateMemoryViewGeometry(); 111 updateMemoryViewGeometry();
111 memoryView->raise(); 112 memoryView->raise();
112 memoryView->show(); 113 memoryView->show();
113 } 114 }
114} 115}
115 116
116void MemoryMeter::timerEvent( QTimerEvent * ) 117void MemoryMeter::timerEvent( QTimerEvent * )
117{ 118{
118 if (memoryView != 0) 119 if (memoryView != 0)
119 { 120 {
120 // read memory status 121 // read memory status
121 percent = (memoryView->percent()); 122 percent = (memoryView->percent());
122 usageTimer->start( 1000 ); 123 usageTimer->start( 1000 );
123 } 124 }
124} 125}
125 126
126void MemoryMeter::usageTimeout() 127void MemoryMeter::usageTimeout()
127{ 128{
128 if (memoryView != 0) 129 if (memoryView != 0)
129 { 130 {
130 percent = (memoryView->percent()); 131 percent = (memoryView->percent());
131 if (updateMemoryViewGeometry() && memoryView->isVisible()) 132 if (updateMemoryViewGeometry() && memoryView->isVisible())
132 { 133 {
133 memoryView->hide(); 134 memoryView->hide();
134 memoryView->show(); 135 memoryView->show();
135 } 136 }
136 137
137 repaint(FALSE); 138 repaint(FALSE);
138 } 139 }
139} 140}
@@ -177,71 +178,68 @@ void MemoryMeter::paintEvent( QPaintEvent* )
177 178
178 batt_width = 4 * band_width + 2;// +2 for 1 pixel border on both sides 179 batt_width = 4 * band_width + 2;// +2 for 1 pixel border on both sides
179 batt_height = height()-2; 180 batt_height = height()-2;
180 batt_xoffset = (width() - batt_width) / 2; 181 batt_xoffset = (width() - batt_width) / 2;
181 batt_yoffset = (height() - batt_height) / 2; 182 batt_yoffset = (height() - batt_height) / 2;
182 183
183 // 184 //
184 // Memory border. +1 to make space for the terminal at row 0. 185 // Memory border. +1 to make space for the terminal at row 0.
185 // 186 //
186 p.setPen(QColor(80, 80, 80)); 187 p.setPen(QColor(80, 80, 80));
187 p.drawRect(batt_xoffset, batt_yoffset + 1, batt_width, batt_height); 188 p.drawRect(batt_xoffset, batt_yoffset + 1, batt_width, batt_height);
188 189
189 // 190 //
190 // Draw terminal. +1 to take into account the left border. 191 // Draw terminal. +1 to take into account the left border.
191 // 192 //
192 //p.drawLine(batt_xoffset + band_width + 1, batt_yoffset, batt_xoffset + 3 * band_width, batt_yoffset); 193 //p.drawLine(batt_xoffset + band_width + 1, batt_yoffset, batt_xoffset + 3 * band_width, batt_yoffset);
193 194
194 batt_height -= 2;// -2 because we don't want to include border 195 batt_height -= 2;// -2 because we don't want to include border
195 batt_yoffset += 2; // +2 to account for border and terminal 196 batt_yoffset += 2; // +2 to account for border and terminal
196 batt_xoffset++; 197 batt_xoffset++;
197 198
198 // 199 //
199 // 100 - percent, since percent is amount remaining, and we draw 200 // 100 - percent, since percent is amount remaining, and we draw
200 // reverse to this. 201 // reverse to this.
201 // 202 //
202 used_height = percent * batt_height / 100; 203 used_height = percent * batt_height / 100;
203 if (used_height < 0) 204 if (used_height < 0)
204 used_height = 0; 205 used_height = 0;
205 206
206 // 207 //
207 // Drained section. 208 // Drained section.
208 // 209 //
209 if (used_height != 0) 210 if (used_height != 0)
210 { 211 {
211 p.setPen(NoPen); 212 p.setPen(NoPen);
212 p.setBrush(gray); 213 p.setBrush(gray);
213 p.drawRect(batt_xoffset, batt_yoffset, band_width, used_height); 214 p.drawRect(batt_xoffset, batt_yoffset, band_width, used_height);
214 p.drawRect(batt_xoffset + 2 * band_width, batt_yoffset, band_width, used_height); 215 p.drawRect(batt_xoffset + 2 * band_width, batt_yoffset, band_width, used_height);
215 216
216 p.setBrush(gray/*.light(130)*/); 217 p.setBrush(gray/*.light(130)*/);
217 p.drawRect(batt_xoffset + band_width, batt_yoffset, band_width, used_height); 218 p.drawRect(batt_xoffset + band_width, batt_yoffset, band_width, used_height);
218 219
219 p.setBrush(gray/*.dark(120)*/); 220 p.setBrush(gray/*.dark(120)*/);
220 p.drawRect(batt_xoffset + 3 * band_width, batt_yoffset, band_width, used_height); 221 p.drawRect(batt_xoffset + 3 * band_width, batt_yoffset, band_width, used_height);
221 } 222 }
222 223
223 // 224 //
224 // Unused section. 225 // Unused section.
225 // 226 //
226 if ( batt_height - used_height > 0 ) 227 if ( batt_height - used_height > 0 )
227 { 228 {
228 int unused_offset = used_height + batt_yoffset; 229 int unused_offset = used_height + batt_yoffset;
229 int unused_height = batt_height - used_height; 230 int unused_height = batt_height - used_height;
230 p.setPen(NoPen); 231 p.setPen(NoPen);
231 p.setBrush(c); 232 p.setBrush(c);
232 p.drawRect(batt_xoffset, unused_offset, band_width, unused_height); 233 p.drawRect(batt_xoffset, unused_offset, band_width, unused_height);
233 p.drawRect(batt_xoffset + 2 * band_width, unused_offset, band_width, unused_height); 234 p.drawRect(batt_xoffset + 2 * band_width, unused_offset, band_width, unused_height);
234 235
235 p.setBrush(lightc); 236 p.setBrush(lightc);
236 p.drawRect(batt_xoffset + band_width, unused_offset, band_width, unused_height); 237 p.drawRect(batt_xoffset + band_width, unused_offset, band_width, unused_height);
237 238
238 p.setBrush(darkc); 239 p.setBrush(darkc);
239 p.drawRect(batt_xoffset + 3 * band_width, unused_offset, band_width, unused_height); 240 p.drawRect(batt_xoffset + 3 * band_width, unused_offset, band_width, unused_height);
240 } 241 }
241} 242}
242 243
243Q_EXPORT_INTERFACE() 244EXPORT_OPIE_APPLET_v1( MemoryMeter )
244{
245 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<MemoryMeter> );
246}
247 245
diff --git a/noncore/applets/memoryapplet/memorystatus.cpp b/noncore/applets/memoryapplet/memorystatus.cpp
index c01ba28..95ae06b 100644
--- a/noncore/applets/memoryapplet/memorystatus.cpp
+++ b/noncore/applets/memoryapplet/memorystatus.cpp
@@ -1,62 +1,63 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "memorystatus.h" 20#include "memorystatus.h"
21#include "../../settings/sysinfo/memory.h" 21#include "../../settings/sysinfo/memory.h"
22#include "swapfile.h" 22#include "swapfile.h"
23 23
24#include <qpainter.h> 24#include <qpainter.h>
25#include <qpushbutton.h> 25#include <qpushbutton.h>
26#include <qdrawutil.h> 26#include <qdrawutil.h>
27#include <qlabel.h> 27#include <qlabel.h>
28 28
29#include <qlayout.h> 29#include <qlayout.h>
30 30
31using namespace Opie::Ui;
31MemoryStatus::MemoryStatus(QWidget *parent, WFlags f ) 32MemoryStatus::MemoryStatus(QWidget *parent, WFlags f )
32 : QFrame(parent, 0, f), mi(0), sf(0) 33 : QFrame(parent, 0, f), mi(0), sf(0)
33{ 34{
34 setCaption( tr("Memory Status") ); 35 setCaption( tr("Memory Status") );
35 //resize( 220, 180 ); 36 //resize( 220, 180 );
36 37
37 QVBoxLayout *lay = new QVBoxLayout( this ); 38 QVBoxLayout *lay = new QVBoxLayout( this );
38 tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); 39 tab = new OTabWidget( this, "tabwidget", OTabWidget::Global );
39 lay->addWidget( tab ); 40 lay->addWidget( tab );
40 tab->addTab( mi = new MemoryInfo( tab ), "memory/memorytabicon", tr("Memory") ); 41 tab->addTab( mi = new MemoryInfo( tab ), "memory/memorytabicon", tr("Memory") );
41 tab->addTab( sf = new Swapfile( tab ), "memory/storagetabicon", tr("Swapfile") ); 42 tab->addTab( sf = new Swapfile( tab ), "memory/storagetabicon", tr("Swapfile") );
42 43
43 QLabel* about = new QLabel(tr("<center><b>Memory Monitor Plugin</b><br>" 44 QLabel* about = new QLabel(tr("<center><b>Memory Monitor Plugin</b><br>"
44 "Copyright (C) 2003 Anton Maslovsky<br>" 45 "Copyright (C) 2003 Anton Maslovsky<br>"
45 "&lt;<a href=\"mailto:my-zaurus@narod.ru\">my-zaurus@narod.ru</a>&gt;<br>" 46 "&lt;<a href=\"mailto:my-zaurus@narod.ru\">my-zaurus@narod.ru</a>&gt;<br>"
46 "<a href=\"http://my-zaurus.narod.ru\">http://my-zaurus.narod.ru</a><br>" 47 "<a href=\"http://my-zaurus.narod.ru\">http://my-zaurus.narod.ru</a><br>"
47 "Based on source code from:<br> qswap (udoseidel@gmx.de) <br> Battery Applet (trolltech.com) <br> SysInfo (OPIE)<br><br>" 48 "Based on source code from:<br> qswap (udoseidel@gmx.de) <br> Battery Applet (trolltech.com) <br> SysInfo (OPIE)<br><br>"
48 "This program is licensed under GNU GPL.</center>"), tab); 49 "This program is licensed under GNU GPL.</center>"), tab);
49 50
50 tab->addTab( about, "memory/info", tr("About") ); 51 tab->addTab( about, "memory/info", tr("About") );
51 52
52 tab->setCurrentTab( tr( "Memory" ) ); 53 tab->setCurrentTab( tr( "Memory" ) );
53} 54}
54 55
55int MemoryStatus::percent() 56int MemoryStatus::percent()
56{ 57{
57 if (mi == 0) 58 if (mi == 0)
58 return 100; 59 return 100;
59 60
60 int total = mi->total; 61 int total = mi->total;
61 if (mi->swaptotal > 0) 62 if (mi->swaptotal > 0)
62 total += mi->swaptotal; 63 total += mi->swaptotal;
diff --git a/noncore/applets/memoryapplet/memorystatus.h b/noncore/applets/memoryapplet/memorystatus.h
index c3926db..d16787b 100644
--- a/noncore/applets/memoryapplet/memorystatus.h
+++ b/noncore/applets/memoryapplet/memorystatus.h
@@ -1,49 +1,49 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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 MEMORY_STATUS_H 20#ifndef MEMORY_STATUS_H
21#define MEMORY_STATUS_H 21#define MEMORY_STATUS_H
22 22
23#include <qframe.h> 23#include <qframe.h>
24 24
25#include <opie2/otabwidget.h> 25#include <opie2/otabwidget.h>
26 26
27class MemoryInfo; 27class MemoryInfo;
28class Swapfile; 28class Swapfile;
29using Opie::OTabWidget; 29
30 30
31class MemoryStatus : public QFrame 31class MemoryStatus : public QFrame
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34public: 34public:
35 MemoryStatus(QWidget *parent = 0, WFlags f = 0); 35 MemoryStatus(QWidget *parent = 0, WFlags f = 0);
36 ~MemoryStatus(); 36 ~MemoryStatus();
37 37
38 QSize sizeHint() const; 38 QSize sizeHint() const;
39 MemoryInfo* mi; 39 MemoryInfo* mi;
40 Swapfile* sf; 40 Swapfile* sf;
41 41
42 int percent(); 42 int percent();
43 43
44private: 44private:
45 OTabWidget *tab; 45 Opie::Ui::OTabWidget *tab;
46}; 46};
47 47
48#endif 48#endif
49 49
diff --git a/noncore/applets/networkapplet/networkapplet.cpp b/noncore/applets/networkapplet/networkapplet.cpp
index 955ed2e..5eb5ad2 100644
--- a/noncore/applets/networkapplet/networkapplet.cpp
+++ b/noncore/applets/networkapplet/networkapplet.cpp
@@ -16,64 +16,66 @@
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#include "networkapplet.h" 31#include "networkapplet.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35#include <opie2/onetwork.h> 35#include <opie2/onetwork.h>
36#include <opie2/otaskbarapplet.h> 36#include <opie2/otaskbarapplet.h>
37#include <qpe/applnk.h> 37#include <qpe/applnk.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39#include <qpainter.h> 39#include <qpainter.h>
40 40
41/* QT */ 41/* QT */
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qlayout.h> 43#include <qlayout.h>
44#include <qobjectlist.h> 44#include <qobjectlist.h>
45 45
46#include <assert.h> 46#include <assert.h>
47 47
48using namespace Opie::Ui;
49using namespace Opie::Net;
48IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name ) 50IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name )
49 :QToolButton( parent, name ) 51 :QToolButton( parent, name )
50{ 52{
51 _iface = ONetwork::instance()->interface( name ); 53 _iface = ONetwork::instance()->interface( name );
52 assert( _iface ); 54 assert( _iface );
53 setToggleButton( true ); 55 setToggleButton( true );
54 //setAutoRaise( true ); 56 //setAutoRaise( true );
55 setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) ); 57 setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) );
56 setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) ); 58 setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) );
57 setOn( _iface->isUp() ); 59 setOn( _iface->isUp() );
58 //setFixedWidth( 16 ); 60 //setFixedWidth( 16 );
59 connect( this, SIGNAL( clicked() ), this, SLOT( clicked() ) ); 61 connect( this, SIGNAL( clicked() ), this, SLOT( clicked() ) );
60} 62}
61 63
62 64
63IfaceUpDownButton::~IfaceUpDownButton() 65IfaceUpDownButton::~IfaceUpDownButton()
64{ 66{
65} 67}
66 68
67 69
68void IfaceUpDownButton::clicked() 70void IfaceUpDownButton::clicked()
69{ 71{
70 _iface->setUp( isOn() ); 72 _iface->setUp( isOn() );
71 setOn( _iface->isUp() ); // it might not have worked... 73 setOn( _iface->isUp() ); // it might not have worked...
72 repaint(); 74 repaint();
73} 75}
74 76
75 77
76IfaceIPAddress::IfaceIPAddress( QWidget* parent, const char* name ) 78IfaceIPAddress::IfaceIPAddress( QWidget* parent, const char* name )
77 :QLineEdit( parent, name ) 79 :QLineEdit( parent, name )
78{ 80{
79 setFont( QFont( "fixed" ) ); 81 setFont( QFont( "fixed" ) );
@@ -217,38 +219,35 @@ NetworkApplet::NetworkApplet( QWidget *parent, const char *name )
217 219
218 220
219NetworkApplet::~NetworkApplet() 221NetworkApplet::~NetworkApplet()
220{ 222{
221} 223}
222 224
223 225
224int NetworkApplet::position() 226int NetworkApplet::position()
225{ 227{
226 return 4; 228 return 4;
227} 229}
228 230
229 231
230void NetworkApplet::paintEvent( QPaintEvent* ) 232void NetworkApplet::paintEvent( QPaintEvent* )
231{ 233{
232 QPainter p(this); 234 QPainter p(this);
233 p.drawPixmap(0, 2, _pixmap ); 235 p.drawPixmap(0, 2, _pixmap );
234} 236}
235 237
236 238
237void NetworkApplet::mousePressEvent( QMouseEvent* ) 239void NetworkApplet::mousePressEvent( QMouseEvent* )
238{ 240{
239 if ( !_control->isVisible() ) 241 if ( !_control->isVisible() )
240 { 242 {
241 popup( _control ); 243 popup( _control );
242 } 244 }
243 else 245 else
244 { 246 {
245 _control->hide(); 247 _control->hide();
246 } 248 }
247} 249}
248 250
251EXPORT_OPIE_APPLET_v1( NetworkApplet )
249 252
250Q_EXPORT_INTERFACE()
251{
252 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<NetworkApplet> );
253}
254 253
diff --git a/noncore/applets/networkapplet/networkapplet.h b/noncore/applets/networkapplet/networkapplet.h
index 8022537..1e2cac8 100644
--- a/noncore/applets/networkapplet/networkapplet.h
+++ b/noncore/applets/networkapplet/networkapplet.h
@@ -9,106 +9,112 @@
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#ifndef NETWORKAPPLET_H 31#ifndef NETWORKAPPLET_H
32#define NETWORKAPPLET_H 32#define NETWORKAPPLET_H
33 33
34#include <opie2/otaskbarapplet.h> 34#include <opie2/otaskbarapplet.h>
35#include <qframe.h> 35#include <qframe.h>
36#include <qstring.h> 36#include <qstring.h>
37#include <qtoolbutton.h> 37#include <qtoolbutton.h>
38#include <qlineedit.h> 38#include <qlineedit.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40 40
41class ONetworkInterface; 41
42namespace Opie {
43namespace Net {
44 class ONetwork;
45 class ONetworkInterface;
46}
47}
42class QShowEvent; 48class QShowEvent;
43class QHideEvent; 49class QHideEvent;
44class QVBoxLayout; 50class QVBoxLayout;
45 51
46class IfaceUpDownButton : public QToolButton 52class IfaceUpDownButton : public QToolButton
47{ 53{
48 Q_OBJECT 54 Q_OBJECT
49 55
50 public: 56 public:
51 IfaceUpDownButton( QWidget* parent, const char* name ); 57 IfaceUpDownButton( QWidget* parent, const char* name );
52 virtual ~IfaceUpDownButton(); 58 virtual ~IfaceUpDownButton();
53 59
54 public slots: 60 public slots:
55 virtual void clicked(); 61 virtual void clicked();
56 62
57 private: 63 private:
58 ONetworkInterface* _iface; 64 Opie::Net::ONetworkInterface* _iface;
59}; 65};
60 66
61 67
62class IfaceIPAddress : public QLineEdit 68class IfaceIPAddress : public QLineEdit
63{ 69{
64 Q_OBJECT 70 Q_OBJECT
65 71
66 public: 72 public:
67 IfaceIPAddress( QWidget* parent, const char* name ); 73 IfaceIPAddress( QWidget* parent, const char* name );
68 virtual ~IfaceIPAddress(); 74 virtual ~IfaceIPAddress();
69 75
70 public slots: 76 public slots:
71 virtual void returnPressed(); 77 virtual void returnPressed();
72 78
73 private: 79 private:
74 ONetworkInterface* _iface; 80 Opie::Net::ONetworkInterface* _iface;
75}; 81};
76 82
77class NetworkAppletControl : public QFrame 83class NetworkAppletControl : public QFrame
78{ 84{
79 public: 85 public:
80 NetworkAppletControl( OTaskbarApplet* parent, const char* name = 0 ); 86 NetworkAppletControl( Opie::Ui::OTaskbarApplet* parent, const char* name = 0 );
81 ~NetworkAppletControl(); 87 ~NetworkAppletControl();
82 88
83 virtual QSize sizeHint() const; 89 virtual QSize sizeHint() const;
84 90
85 protected: 91 protected:
86 virtual void showEvent( QShowEvent* ); 92 virtual void showEvent( QShowEvent* );
87 virtual void hideEvent( QHideEvent* ); 93 virtual void hideEvent( QHideEvent* );
88 QString guessDevice( ONetworkInterface* iface ); 94 QString guessDevice( Opie::Net::ONetworkInterface* iface );
89 void build(); 95 void build();
90 96
91 private: 97 private:
92 QVBoxLayout* l; 98 QVBoxLayout* l;
93 99
94}; 100};
95 101
96 102
97class NetworkApplet : public OTaskbarApplet 103class NetworkApplet : public Opie::Ui::OTaskbarApplet
98{ 104{
99 public: 105 public:
100 NetworkApplet( QWidget* parent = 0, const char* name = 0 ); 106 NetworkApplet( QWidget* parent = 0, const char* name = 0 );
101 ~NetworkApplet(); 107 ~NetworkApplet();
102 108
103 static int position(); 109 static int position();
104 protected: 110 protected:
105 virtual void paintEvent( QPaintEvent* ); 111 virtual void paintEvent( QPaintEvent* );
106 virtual void mousePressEvent( QMouseEvent* ); 112 virtual void mousePressEvent( QMouseEvent* );
107 113
108 private: 114 private:
109 NetworkAppletControl* _control; 115 NetworkAppletControl* _control;
110 QPixmap _pixmap; 116 QPixmap _pixmap;
111}; 117};
112 118
113#endif 119#endif
114 120
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp
index 9b5e475..13f7cf3 100644
--- a/noncore/applets/notesapplet/notes.cpp
+++ b/noncore/applets/notesapplet/notes.cpp
@@ -17,64 +17,65 @@
17 17
18#include <qapplication.h> 18#include <qapplication.h>
19#include <stdlib.h> 19#include <stdlib.h>
20#include <qstringlist.h> 20#include <qstringlist.h>
21 21
22#include <opie2/otaskbarapplet.h> 22#include <opie2/otaskbarapplet.h>
23#include <qpe/filemanager.h> 23#include <qpe/filemanager.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/timestring.h> 25#include <qpe/timestring.h>
26#include <qpe/applnk.h> 26#include <qpe/applnk.h>
27#include <qpe/ir.h> 27#include <qpe/ir.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29 29
30// #include <qsocket.h> 30// #include <qsocket.h>
31// #include <qclipboard.h> 31// #include <qclipboard.h>
32#include <qmultilineedit.h> 32#include <qmultilineedit.h>
33#include <qlistbox.h> 33#include <qlistbox.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <qpoint.h> 39#include <qpoint.h>
40#include <qpushbutton.h> 40#include <qpushbutton.h>
41#include <qpainter.h> 41#include <qpainter.h>
42#include <qlayout.h> 42#include <qlayout.h>
43#include <qframe.h> 43#include <qframe.h>
44#include <qpixmap.h> 44#include <qpixmap.h>
45#include <qstring.h> 45#include <qstring.h>
46#include <qtimer.h> 46#include <qtimer.h>
47 47
48/* XPM */ 48/* XPM */
49using namespace Opie::Ui;
49static char * notes_xpm[] = { 50static char * notes_xpm[] = {
50"16 16 11 1", 51"16 16 11 1",
51" c None", 52" c None",
52". c #000000", 53". c #000000",
53"+ c #7F7F7F", 54"+ c #7F7F7F",
54"@ c #BFBFBF", 55"@ c #BFBFBF",
55"# c #BFC1FF", 56"# c #BFC1FF",
56"$ c #FF0000", 57"$ c #FF0000",
57"% c #FFFFFF", 58"% c #FFFFFF",
58"& c #00037F", 59"& c #00037F",
59"* c #0006FF", 60"* c #0006FF",
60"= c #0005BF", 61"= c #0005BF",
61"- c #7F0000", 62"- c #7F0000",
62" .. ", 63" .. ",
63" .. ", 64" .. ",
64" ... ", 65" ... ",
65" .+ ", 66" .+ ",
66" .@. ", 67" .@. ",
67" . .+ ", 68" . .+ ",
68" ..#.@. ", 69" ..#.@. ",
69" ..###.+.. ", 70" ..###.+.. ",
70" ..###$...##.. ", 71" ..###$...##.. ",
71"..###$$$%+$$##&.", 72"..###$$$%+$$##&.",
72".*=####$-###&=&.", 73".*=####$-###&=&.",
73".=**=###==&=&=..", 74".=**=###==&=&=..",
74" ..=**=#&=&=.. ", 75" ..=**=#&=&=.. ",
75" ..=*=&=.. ", 76" ..=*=&=.. ",
76" ..=.. ", 77" ..=.. ",
77" . "}; 78" . "};
78 79
79 80
80NotesControl::NotesControl( QWidget *, const char * ) 81NotesControl::NotesControl( QWidget *, const char * )
@@ -479,36 +480,35 @@ void NotesApplet::mousePressEvent( QMouseEvent *) {
479 vc->close(); 480 vc->close();
480 } else { 481 } else {
481// vc = new NotesControl; 482// vc = new NotesControl;
482// QPoint curPos = mapToGlobal( rect().topLeft() ); 483// QPoint curPos = mapToGlobal( rect().topLeft() );
483 if(vc->showMax) { 484 if(vc->showMax) {
484 qDebug("show max"); 485 qDebug("show max");
485 vc->showMaximized(); 486 vc->showMaximized();
486 } else { 487 } else {
487 qDebug("no show max"); 488 qDebug("no show max");
488 QWidget *wid = QPEApplication::desktop(); 489 QWidget *wid = QPEApplication::desktop();
489 QRect rect = QApplication::desktop()->geometry(); 490 QRect rect = QApplication::desktop()->geometry();
490 vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); 491 vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180);
491 vc->move ( (rect.center()/2) - (vc->rect().center()/2)); 492 vc->move ( (rect.center()/2) - (vc->rect().center()/2));
492// vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); 493// vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28);
493 } 494 }
494 vc->show(); 495 vc->show();
495 vc->doPopulate=true; 496 vc->doPopulate=true;
496 vc->populateBox(); 497 vc->populateBox();
497 vc->doPopulate=false; 498 vc->doPopulate=false;
498 vc->loaded=false; 499 vc->loaded=false;
499 500
500 vc->load(); 501 vc->load();
501// this->setFocus(); 502// this->setFocus();
502 vc->view->setFocus(); 503 vc->view->setFocus();
503 } 504 }
504} 505}
505 506
506void NotesApplet::paintEvent( QPaintEvent* ) { 507void NotesApplet::paintEvent( QPaintEvent* ) {
507 QPainter p(this); 508 QPainter p(this);
508 p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); 509 p.drawPixmap( 0, 1, ( const char** ) notes_xpm );
509} 510}
510 511
511Q_EXPORT_INTERFACE() 512
512{ 513EXPORT_OPIE_APPLET_v1( NotesApplet )
513 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<NotesApplet> ); 514
514}
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index 6ef2e44..f244426 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -1,82 +1,85 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer <mickey@vanille.de> 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer <mickey@vanille.de>
3** 3**
4** This file may be distributed and/or modified under the terms of the 4** This file may be distributed and/or modified under the terms of the
5** GNU General Public License version 2 as published by the Free Software 5** GNU General Public License version 2 as published by the Free Software
6** Foundation and appearing in the file LICENSE.GPL included in the 6** Foundation and appearing in the file LICENSE.GPL included in the
7** packaging of this file. 7** packaging of this file.
8** 8**
9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11** 11**
12**********************************************************************/ 12**********************************************************************/
13 13
14#include "wireless.h" 14#include "wireless.h"
15#include "mgraph.h" 15#include "mgraph.h"
16#include "advancedconfig.h" 16#include "advancedconfig.h"
17#include "connect0.xpm" 17#include "connect0.xpm"
18#include "connect1.xpm" 18#include "connect1.xpm"
19#include "connect2.xpm" 19#include "connect2.xpm"
20#include "connect3.xpm" 20#include "connect3.xpm"
21#include "connect4.xpm" 21#include "connect4.xpm"
22#include "connect5.xpm" 22#include "connect5.xpm"
23#include "nowireless.xpm" 23#include "nowireless.xpm"
24 24
25/* OPIE */ 25/* OPIE */
26#include <opie2/onetwork.h> 26#include <opie2/onetwork.h>
27#include <opie2/otaskbarapplet.h> 27#include <opie2/otaskbarapplet.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29#include <qpe/qpeapplication.h>
29 30
30/* QT */ 31/* QT */
31#include <qradiobutton.h> 32#include <qradiobutton.h>
32#include <qpushbutton.h> 33#include <qpushbutton.h>
33#include <qpainter.h> 34#include <qpainter.h>
34#include <qlabel.h> 35#include <qlabel.h>
35#include <qslider.h> 36#include <qslider.h>
36#include <qbuttongroup.h> 37#include <qbuttongroup.h>
37#include <qlayout.h> 38#include <qlayout.h>
38#include <qfile.h> 39#include <qfile.h>
39#include <qtextstream.h> 40#include <qtextstream.h>
40 41
41/* STD */ 42/* STD */
42#include <sys/types.h> 43#include <sys/types.h>
43#include <signal.h> 44#include <signal.h>
44 45
45#define STYLE_BARS 0 46#define STYLE_BARS 0
46#define STYLE_ANTENNA 1 47#define STYLE_ANTENNA 1
47 48
48//#define MDEBUG 49//#define MDEBUG
49#undef MDEBUG 50#undef MDEBUG
50 51
52using namespace Opie::Ui;
53using namespace Opie::Net;
51WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) 54WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name )
52 : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) 55 : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet )
53{ 56{
54 57
55 readConfig(); 58 readConfig();
56 writeConfigEntry( "UpdateFrequency", updateFrequency ); 59 writeConfigEntry( "UpdateFrequency", updateFrequency );
57 writeConfigEntry( "DisplayStyle", displayStyle ); 60 writeConfigEntry( "DisplayStyle", displayStyle );
58 61
59 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 62 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
60 QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); 63 QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" );
61 64
62 /* status label */ 65 /* status label */
63 66
64 statusLabel = new QLabel( this, "statuslabel" ); 67 statusLabel = new QLabel( this, "statuslabel" );
65 QString text( "Wireless Status:<br>" 68 QString text( "Wireless Status:<br>"
66 "*** Unknown ***<br>" 69 "*** Unknown ***<br>"
67 "Card not inserted ?<br>" 70 "Card not inserted ?<br>"
68 "Or Sharp ROM ?<br>" 71 "Or Sharp ROM ?<br>"
69 "CELL: 00:00:00:00:00:00" ); 72 "CELL: 00:00:00:00:00:00" );
70 /* QString text( "Station: Unknown<br>" 73 /* QString text( "Station: Unknown<br>"
71 "ESSID: Unknown<br>" 74 "ESSID: Unknown<br>"
72 "MODE: Unknown<br>" 75 "MODE: Unknown<br>"
73 "FREQ: Unknown<br>" 76 "FREQ: Unknown<br>"
74 "CELL: AA:BB:CC:DD:EE:FF" ); */ 77 "CELL: AA:BB:CC:DD:EE:FF" ); */
75 statusLabel->setText( text ); 78 statusLabel->setText( text );
76 statusLabel->setFixedSize( statusLabel->sizeHint() ); 79 statusLabel->setFixedSize( statusLabel->sizeHint() );
77 grid->addWidget( statusLabel, 0, 0 ); 80 grid->addWidget( statusLabel, 0, 0 );
78 81
79 /* visualization group box */ 82 /* visualization group box */
80 83
81 QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this ); 84 QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this );
82 QRadioButton* r1 = new QRadioButton( "Color Bars", group ); 85 QRadioButton* r1 = new QRadioButton( "Color Bars", group );
@@ -521,38 +524,34 @@ void WirelessApplet::paintEvent( QPaintEvent* )
521 // draw signal indicator 524 // draw signal indicator
522 pixelHeight = signalH; 525 pixelHeight = signalH;
523 Hue = 100; 526 Hue = 100;
524 leftoffset += pixelWidth + barSpace; 527 leftoffset += pixelWidth + barSpace;
525 for ( int i = 0; i < pixelHeight; ++i ) 528 for ( int i = 0; i < pixelHeight; ++i )
526 { 529 {
527 intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205; 530 intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205;
528 color.setHsv( Hue, 255, intensity ); 531 color.setHsv( Hue, 255, intensity );
529 p.setPen ( color ); 532 p.setPen ( color );
530 p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i ); 533 p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i );
531 } 534 }
532 535
533 // draw quality indicator 536 // draw quality indicator
534 pixelHeight = qualityH; 537 pixelHeight = qualityH;
535 Hue = 250; 538 Hue = 250;
536 leftoffset += pixelWidth + barSpace; 539 leftoffset += pixelWidth + barSpace;
537 for ( int i = 0; i < pixelHeight; ++i ) 540 for ( int i = 0; i < pixelHeight; ++i )
538 { 541 {
539 intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205; 542 intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205;
540 color.setHsv( Hue, 255, intensity ); 543 color.setHsv( Hue, 255, intensity );
541 p.setPen ( color ); 544 p.setPen ( color );
542 p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i ); 545 p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i );
543 } 546 }
544 } 547 }
545} 548}
546 549
547 550
548int WirelessApplet::position() 551int WirelessApplet::position()
549{ 552{
550 return 6; 553 return 6;
551} 554}
552 555
553 556EXPORT_OPIE_APPLET_v1( WirelessApplet )
554Q_EXPORT_INTERFACE()
555{
556 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<WirelessApplet> );
557}
558 557
diff --git a/noncore/applets/wirelessapplet/wireless.h b/noncore/applets/wirelessapplet/wireless.h
index 27f8c90..b475a46 100644
--- a/noncore/applets/wirelessapplet/wireless.h
+++ b/noncore/applets/wirelessapplet/wireless.h
@@ -1,54 +1,57 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 2** Copyright (C) 2002 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
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 __WIRELESS_APPLET_H__ 15#ifndef __WIRELESS_APPLET_H__
16#define __WIRELESS_APPLET_H__ 16#define __WIRELESS_APPLET_H__
17 17
18#include <qwidget.h> 18#include <qwidget.h>
19#include <qframe.h> 19#include <qframe.h>
20#include <qpixmap.h> 20#include <qpixmap.h>
21 21
22class OWirelessNetworkInterface; 22namespace Opie {namespace Net {
23 class OWirelessNetworkInterface;
24}
25}
23class Y; 26class Y;
24class QLabel; 27class QLabel;
25class WirelessApplet; 28class WirelessApplet;
26class MGraph; 29class MGraph;
27 30
28class WirelessControl : public QFrame 31class WirelessControl : public QFrame
29{ 32{
30 Q_OBJECT 33 Q_OBJECT
31 public: 34 public:
32 WirelessControl( WirelessApplet* icon, QWidget *parent=0, const char *name=0 ); 35 WirelessControl( WirelessApplet* icon, QWidget *parent=0, const char *name=0 );
33 void show( bool ); 36 void show( bool );
34 37
35 void readConfig(); 38 void readConfig();
36 void writeConfigEntry( const char* entry, int val ); 39 void writeConfigEntry( const char* entry, int val );
37 40
38 MGraph* mgraph; 41 MGraph* mgraph;
39 QLabel* statusLabel; 42 QLabel* statusLabel;
40 QLabel* updateLabel; 43 QLabel* updateLabel;
41 44
42 public slots: 45 public slots:
43 void updateDelayChange( int ); 46 void updateDelayChange( int );
44 void displayStyleChange( int ); 47 void displayStyleChange( int );
45 void advancedConfigClicked(); 48 void advancedConfigClicked();
46 49
47 private: 50 private:
48 WirelessApplet* applet; 51 WirelessApplet* applet;
49 52
50 int displayStyle; 53 int displayStyle;
51 int updateFrequency; 54 int updateFrequency;
52 55
53 bool rocESSID; 56 bool rocESSID;
54 bool rocFREQ; 57 bool rocFREQ;
@@ -57,54 +60,54 @@ class WirelessControl : public QFrame
57}; 60};
58 61
59class WirelessApplet : public QWidget 62class WirelessApplet : public QWidget
60{ 63{
61 Q_OBJECT 64 Q_OBJECT
62 public: 65 public:
63 WirelessApplet( QWidget *parent = 0, const char *name=0 ); 66 WirelessApplet( QWidget *parent = 0, const char *name=0 );
64 ~WirelessApplet(); 67 ~WirelessApplet();
65 static int position(); 68 static int position();
66 WirelessControl* status; 69 WirelessControl* status;
67 70
68 virtual void timerEvent( QTimerEvent* ); 71 virtual void timerEvent( QTimerEvent* );
69 void updateDelayChange( int delay ); 72 void updateDelayChange( int delay );
70 void displayStyleChange( int style ); 73 void displayStyleChange( int style );
71 74
72 void updateDHCPConfig( bool, bool, bool, bool ); 75 void updateDHCPConfig( bool, bool, bool, bool );
73 76
74 private: 77 private:
75 void mousePressEvent( QMouseEvent * ); 78 void mousePressEvent( QMouseEvent * );
76 void paintEvent( QPaintEvent* ); 79 void paintEvent( QPaintEvent* );
77 void checkInterface(); 80 void checkInterface();
78 void renewDHCP(); 81 void renewDHCP();
79 82
80 bool mustRepaint(); 83 bool mustRepaint();
81 void updatePopupWindow(); 84 void updatePopupWindow();
82 const char** getQualityPixmap(); 85 const char** getQualityPixmap();
83 86
84 private: 87 private:
85 QPixmap snapshotPixmap; 88 QPixmap snapshotPixmap;
86 int visualStyle; 89 int visualStyle;
87 int timer; 90 int timer;
88 91
89 OWirelessNetworkInterface* interface; 92 Opie::Net::OWirelessNetworkInterface* interface;
90 93
91 private: 94 private:
92 const char** oldpixmap; 95 const char** oldpixmap;
93 OWirelessNetworkInterface* oldiface; 96 Opie::Net::OWirelessNetworkInterface* oldiface;
94 int oldqualityH; 97 int oldqualityH;
95 int oldsignalH; 98 int oldsignalH;
96 int oldnoiseH; 99 int oldnoiseH;
97 100
98 QString oldESSID; 101 QString oldESSID;
99 QString oldAP; 102 QString oldAP;
100 QString oldMODE; 103 QString oldMODE;
101 double oldFREQ; 104 double oldFREQ;
102 105
103 bool rocESSID; 106 bool rocESSID;
104 bool rocFREQ; 107 bool rocFREQ;
105 bool rocAP; 108 bool rocAP;
106 bool rocMODE; 109 bool rocMODE;
107}; 110};
108 111
109#endif // __WIRELESS_APPLET_H__ 112#endif // __WIRELESS_APPLET_H__
110 113
diff --git a/noncore/applets/zkbapplet/zkbwidget.cpp b/noncore/applets/zkbapplet/zkbwidget.cpp
index 0083e9b..3acff1e 100644
--- a/noncore/applets/zkbapplet/zkbwidget.cpp
+++ b/noncore/applets/zkbapplet/zkbwidget.cpp
@@ -1,103 +1,104 @@
1#include <opie2/otaskbarapplet.h> 1#include <opie2/otaskbarapplet.h>
2#include <qpe/qcopenvelope_qws.h> 2#include <qpe/qcopenvelope_qws.h>
3#include <qpe/applnk.h> 3#include <qpe/applnk.h>
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qpe/resource.h> 5#include <qpe/resource.h>
6#include <stdio.h> 6#include <stdio.h>
7#include <unistd.h> 7#include <unistd.h>
8#include "zkbwidget.h" 8#include "zkbwidget.h"
9#include "zkbcfg.h" 9#include "zkbcfg.h"
10 10
11using namespace Opie::Ui;
11ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), 12ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0),
12 disabled(Resource::loadPixmap("zkb-disabled")) { 13 disabled(Resource::loadPixmap("zkb-disabled")) {
13 14
14 labels = new QPopupMenu(); 15 labels = new QPopupMenu();
15 connect(labels, SIGNAL(activated(int)), this, 16 connect(labels, SIGNAL(activated(int)), this,
16 SLOT(labelChanged(int))); 17 SLOT(labelChanged(int)));
17 18
18 loadKeymap(); 19 loadKeymap();
19 20
20 channel = new QCopChannel("QPE/zkb", this); 21 channel = new QCopChannel("QPE/zkb", this);
21 connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), 22 connect(channel, SIGNAL(received(const QCString&,const QByteArray&)),
22 this, SLOT(signalReceived(const QCString&,const QByteArray&))); 23 this, SLOT(signalReceived(const QCString&,const QByteArray&)));
23 setFixedWidth ( AppLnk::smallIconSize() ); 24 setFixedWidth ( AppLnk::smallIconSize() );
24 setFixedHeight ( AppLnk::smallIconSize() ); 25 setFixedHeight ( AppLnk::smallIconSize() );
25} 26}
26 27
27ZkbWidget::~ZkbWidget() { 28ZkbWidget::~ZkbWidget() {
28} 29}
29 30
30int ZkbWidget::position() 31int ZkbWidget::position()
31{ 32{
32 return 8; 33 return 8;
33} 34}
34 35
35bool ZkbWidget::loadKeymap() { 36bool ZkbWidget::loadKeymap() {
36 ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb"); 37 ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb");
37 QFontMetrics fm(font()); 38 QFontMetrics fm(font());
38 39
39 if (keymap != 0) { 40 if (keymap != 0) {
40 delete keymap; 41 delete keymap;
41 keymap = 0; 42 keymap = 0;
42 } 43 }
43 44
44 Keymap* km = new Keymap(); 45 Keymap* km = new Keymap();
45 46
46 if (!c.load("zkb.xml", *km, "")) { 47 if (!c.load("zkb.xml", *km, "")) {
47 delete km; 48 delete km;
48 setPixmap(disabled); 49 setPixmap(disabled);
49 return false; 50 return false;
50 } 51 }
51 52
52 connect(km, SIGNAL(stateChanged(const QString&)), 53 connect(km, SIGNAL(stateChanged(const QString&)),
53 this, SLOT(stateChanged(const QString&))); 54 this, SLOT(stateChanged(const QString&)));
54 55
55 qwsServer->setKeyboardFilter(km); 56 qwsServer->setKeyboardFilter(km);
56 57
57 Keymap* oldkm = keymap; 58 Keymap* oldkm = keymap;
58 keymap = km; 59 keymap = km;
59 60
60 if (oldkm != 0) { 61 if (oldkm != 0) {
61 delete oldkm; 62 delete oldkm;
62 } 63 }
63 64
64 setText(keymap->getCurrentLabel()); 65 setText(keymap->getCurrentLabel());
65 66
66 labels->clear(); 67 labels->clear();
67 QStringList l = keymap->listLabels(); 68 QStringList l = keymap->listLabels();
68 labels->insertItem(disabled, 0, 0); 69 labels->insertItem(disabled, 0, 0);
69 int n = 1; 70 int n = 1;
70 w = 0; 71 w = 0;
71 for(QStringList::Iterator it = l.begin(); it != l.end(); 72 for(QStringList::Iterator it = l.begin(); it != l.end();
72 ++it, n++) { 73 ++it, n++) {
73 74
74 // printf("label: %s\n", (const char*) (*it).utf8()); 75 // printf("label: %s\n", (const char*) (*it).utf8());
75 76
76 labels->insertItem(*it, n, n); 77 labels->insertItem(*it, n, n);
77 int lw = fm.width(*it); 78 int lw = fm.width(*it);
78 if (lw > w) { 79 if (lw > w) {
79 w = lw; 80 w = lw;
80 } 81 }
81 } 82 }
82 83
83 if (w == 0) { 84 if (w == 0) {
84 hide(); 85 hide();
85 } else { 86 } else {
86 show(); 87 show();
87 } 88 }
88 return true; 89 return true;
89} 90}
90 91
91QSize ZkbWidget::sizeHint() const { 92QSize ZkbWidget::sizeHint() const {
92 return QSize(AppLnk::smallIconSize(),AppLnk::smallIconSize()); 93 return QSize(AppLnk::smallIconSize(),AppLnk::smallIconSize());
93} 94}
94 95
95void ZkbWidget::stateChanged(const QString& s) { 96void ZkbWidget::stateChanged(const QString& s) {
96 //qDebug("stateChanged: %s\n", (const char*) s.utf8()); 97 //qDebug("stateChanged: %s\n", (const char*) s.utf8());
97 setText(s); 98 setText(s);
98} 99}
99 100
100void ZkbWidget::labelChanged(int id) { 101void ZkbWidget::labelChanged(int id) {
101 if (id == 0) { 102 if (id == 0) {
102 keymap->disable(); 103 keymap->disable();
103 setPixmap(disabled); 104 setPixmap(disabled);
@@ -126,37 +127,35 @@ void ZkbWidget::mouseReleaseEvent(QMouseEvent*) {
126void ZkbWidget::signalReceived(const QCString& msg, const QByteArray& data) { 127void ZkbWidget::signalReceived(const QCString& msg, const QByteArray& data) {
127 QDataStream stream(data, IO_ReadOnly); 128 QDataStream stream(data, IO_ReadOnly);
128 129
129 if (msg == "enable()") { 130 if (msg == "enable()") {
130 keymap->enable(); 131 keymap->enable();
131 } else if (msg == "disable()") { 132 } else if (msg == "disable()") {
132 keymap->disable(); 133 keymap->disable();
133 } else if (msg == "reload()") { 134 } else if (msg == "reload()") {
134 QCopEnvelope("QPE/System", "busy()"); 135 QCopEnvelope("QPE/System", "busy()");
135 QTimer::singleShot(0, this, SLOT(reload())); 136 QTimer::singleShot(0, this, SLOT(reload()));
136 } else if (msg == "switch(QString)") { 137 } else if (msg == "switch(QString)") {
137 QString lbl; 138 QString lbl;
138 stream >> lbl; 139 stream >> lbl;
139 140
140 if (keymap != 0) { 141 if (keymap != 0) {
141 State* state = keymap->getStateByLabel(lbl); 142 State* state = keymap->getStateByLabel(lbl);
142 if (state != 0) { 143 if (state != 0) {
143 keymap->setCurrentState(state); 144 keymap->setCurrentState(state);
144 setText(lbl); 145 setText(lbl);
145 } 146 }
146 } 147 }
147 } else if (msg == "debug(QString)") { 148 } else if (msg == "debug(QString)") {
148 QString flag; 149 QString flag;
149 stream >> flag; 150 stream >> flag;
150 } 151 }
151} 152}
152 153
153void ZkbWidget::reload() { 154void ZkbWidget::reload() {
154 loadKeymap(); 155 loadKeymap();
155 QCopEnvelope("QPE/System", "notBusy()"); 156 QCopEnvelope("QPE/System", "notBusy()");
156} 157}
157 158
158Q_EXPORT_INTERFACE() 159EXPORT_OPIE_APPLET_v1( ZkbWidget )
159{ 160
160 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ZkbWidget> );
161}
162 161