summaryrefslogtreecommitdiff
path: root/noncore/applets
Unidiff
Diffstat (limited to 'noncore/applets') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/autorotateapplet/autorotate.cpp10
-rw-r--r--noncore/applets/memoryapplet/swapfile.cpp21
-rw-r--r--noncore/applets/networkapplet/networkapplet.cpp16
-rw-r--r--noncore/applets/notesapplet/config.in2
-rw-r--r--noncore/applets/notesapplet/notes.cpp54
-rw-r--r--noncore/applets/notesapplet/notesapplet.pro18
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp44
-rw-r--r--noncore/applets/zkbapplet/zkbwidget.cpp2
8 files changed, 89 insertions, 78 deletions
diff --git a/noncore/applets/autorotateapplet/autorotate.cpp b/noncore/applets/autorotateapplet/autorotate.cpp
index ae7fbd0..34802fb 100644
--- a/noncore/applets/autorotateapplet/autorotate.cpp
+++ b/noncore/applets/autorotateapplet/autorotate.cpp
@@ -4,34 +4,34 @@
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/odebug.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>
21using namespace Opie::Core;
21 22
22/* QT */ 23/* QT */
23#include <qpainter.h> 24#include <qpainter.h>
24 25
25using namespace Opie::Ui;
26AutoRotate::AutoRotate(QWidget * parent):QWidget(parent) 26AutoRotate::AutoRotate(QWidget * parent):QWidget(parent)
27{ 27{
28 setFixedWidth( AppLnk::smallIconSize() ); 28 setFixedWidth( AppLnk::smallIconSize() );
29 setFixedHeight( AppLnk::smallIconSize() ); 29 setFixedHeight( AppLnk::smallIconSize() );
30 30
31 enabledPm.convertFromImage( Resource::loadImage("autorotate/rotate").smoothScale( height(), width() ) ); 31 enabledPm.convertFromImage( Resource::loadImage("autorotate/rotate").smoothScale( height(), width() ) );
32 disabledPm.convertFromImage( Resource::loadImage("autorotate/norotate").smoothScale( height(), width() ) ); 32 disabledPm.convertFromImage( Resource::loadImage("autorotate/norotate").smoothScale( height(), width() ) );
33 33
34 repaint(true); 34 repaint(true);
35 popupMenu = 0; 35 popupMenu = 0;
36 show(); 36 show();
37} 37}
@@ -78,20 +78,20 @@ void AutoRotate::setRotateEnabled(bool status)
78 cfg.setGroup( "Appearance" ); 78 cfg.setGroup( "Appearance" );
79 cfg.writeEntry( "rotateEnabled", status ); 79 cfg.writeEntry( "rotateEnabled", status );
80 80
81} 81}
82bool AutoRotate::isRotateEnabled() 82bool AutoRotate::isRotateEnabled()
83{ 83{
84 Config cfg( "qpe" ); 84 Config cfg( "qpe" );
85 cfg.setGroup( "Appearance" ); 85 cfg.setGroup( "Appearance" );
86 86
87 bool res = cfg.readBoolEntry( "rotateEnabled" ); 87 bool res = cfg.readBoolEntry( "rotateEnabled" );
88 88
89 if (res ) 89 if (res )
90 qDebug("Enabled"); 90 odebug << "Enabled" << oendl;
91 else 91 else
92 qDebug("Disabled"); 92 odebug << "Disabled" << oendl;
93 return res; 93 return res;
94} 94}
95 95
96EXPORT_OPIE_APPLET_v1( AutoRotate ) 96EXPORT_OPIE_APPLET_v1( AutoRotate )
97 97
diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp
index 9416db3..a71078f 100644
--- a/noncore/applets/memoryapplet/swapfile.cpp
+++ b/noncore/applets/memoryapplet/swapfile.cpp
@@ -11,80 +11,85 @@
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 "swapfile.h" 21#include "swapfile.h"
22 22
23/* OPIE */
24#include <opie2/odebug.h>
25#include <qpe/resource.h>
26using namespace Opie::Core;
27
28/* QT */
23#include <qfile.h> 29#include <qfile.h>
24#include <qtextstream.h> 30#include <qtextstream.h>
25#include <qlabel.h> 31#include <qlabel.h>
26#include <qtimer.h> 32#include <qtimer.h>
27#include <qlayout.h> 33#include <qlayout.h>
28#include <qpushbutton.h> 34#include <qpushbutton.h>
29#include <qhbuttongroup.h> 35#include <qhbuttongroup.h>
30#include <qradiobutton.h> 36#include <qradiobutton.h>
31#include <qlineedit.h> 37#include <qlineedit.h>
32#include <qprogressbar.h> 38#include <qprogressbar.h>
33#include <qcombobox.h> 39#include <qcombobox.h>
34#include <qvgroupbox.h> 40#include <qvgroupbox.h>
35#include <qhbox.h> 41#include <qhbox.h>
36#include <qmessagebox.h> 42#include <qmessagebox.h>
43#include <qcopchannel_qws.h>
44
45/* STD */
37#include <stdio.h> 46#include <stdio.h>
38#include <stdlib.h> 47#include <stdlib.h>
39#include <string.h> 48#include <string.h>
40
41#include <qcopchannel_qws.h>
42#include <qpe/resource.h>
43
44#include <unistd.h> 49#include <unistd.h>
45#include <fcntl.h> 50#include <fcntl.h>
46#include <sys/vfs.h> 51#include <sys/vfs.h>
47#include <mntent.h> 52#include <mntent.h>
48#include <unistd.h> 53#include <unistd.h>
49#include <sys/types.h> 54#include <sys/types.h>
50 55
51Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) 56Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f )
52 : QWidget( parent, name, f ) 57 : QWidget( parent, name, f )
53{ 58{
54 // are we running as root? 59 // are we running as root?
55 isRoot = geteuid() == 0; 60 isRoot = geteuid() == 0;
56 61
57 QVBoxLayout* vb = new QVBoxLayout(this, 5); 62 QVBoxLayout* vb = new QVBoxLayout(this, 5);
58 63
59 QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this); 64 QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this);
60 cfsdRBG->setRadioButtonExclusive(true); 65 cfsdRBG->setRadioButtonExclusive(true);
61 vb->addWidget(cfsdRBG); 66 vb->addWidget(cfsdRBG);
62 67
63 ramRB = new QRadioButton(tr("RAM"), cfsdRBG); 68 ramRB = new QRadioButton(tr("RAM"), cfsdRBG);
64 cfRB = new QRadioButton(tr("CF Card"), cfsdRBG); 69 cfRB = new QRadioButton(tr("CF Card"), cfsdRBG);
65 sdRB = new QRadioButton(tr("SD Card"), cfsdRBG); 70 sdRB = new QRadioButton(tr("SD Card"), cfsdRBG);
66 71
67 QHBox *hb1 = new QHBox(this); 72 QHBox *hb1 = new QHBox(this);
68 hb1->setSpacing(5); 73 hb1->setSpacing(5);
69 74
70 swapPath1 = new QLineEdit(hb1); 75 swapPath1 = new QLineEdit(hb1);
71 swapPath1->setEnabled(false); 76 swapPath1->setEnabled(false);
72 77
73 QPushButton* swapOn = new QPushButton(tr(" On "), hb1); 78 QPushButton* swapOn = new QPushButton(tr(" On "), hb1);
74 QPushButton* swapOff = new QPushButton(tr(" Off "), hb1); 79 QPushButton* swapOff = new QPushButton(tr(" Off "), hb1);
75 vb->addWidget(hb1); 80 vb->addWidget(hb1);
76 81
77 QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this); 82 QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this);
78 vb->addWidget(box1); 83 vb->addWidget(box1);
79 84
80 QHBox *hb2 = new QHBox(box1); 85 QHBox *hb2 = new QHBox(box1);
81 hb2->setSpacing(5); 86 hb2->setSpacing(5);
82 QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2); 87 QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2);
83 QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2); 88 QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2);
84 89
85 QHBox *hb3 = new QHBox(box1); 90 QHBox *hb3 = new QHBox(box1);
86 hb3->setSpacing(5); 91 hb3->setSpacing(5);
87 swapSize = new QComboBox(hb3); 92 swapSize = new QComboBox(hb3);
88 swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb"))); 93 swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb")));
89 94
90 mkswapProgress = new QProgressBar(3, hb3); 95 mkswapProgress = new QProgressBar(3, hb3);
@@ -204,25 +209,25 @@ void Swapfile::getStatusPcmcia()
204 209
205 if (cardWas1 != cardInPcmcia1) { 210 if (cardWas1 != cardInPcmcia1) {
206 if (cardInPcmcia1) { 211 if (cardInPcmcia1) {
207 cfRB->setEnabled(TRUE); 212 cfRB->setEnabled(TRUE);
208 } else { 213 } else {
209 cfRB->setChecked(FALSE); 214 cfRB->setChecked(FALSE);
210 cfRB->setEnabled(FALSE); 215 cfRB->setEnabled(FALSE);
211 } 216 }
212 } 217 }
213 } 218 }
214 } else { 219 } else {
215 // no file found 220 // no file found
216 qDebug("no file found"); 221 odebug << "no file found" << oendl;
217 cardInPcmcia0 = FALSE; 222 cardInPcmcia0 = FALSE;
218 cardInPcmcia1 = FALSE; 223 cardInPcmcia1 = FALSE;
219 } 224 }
220 Swapfile::cfsdchecked(); 225 Swapfile::cfsdchecked();
221} 226}
222 227
223 228
224void Swapfile::getStatusSd() 229void Swapfile::getStatusSd()
225{ 230{
226 231
227 bool cardWas = cardInSd;// remember last state 232 bool cardWas = cardInSd;// remember last state
228 cardInSd = FALSE; 233 cardInSd = FALSE;
diff --git a/noncore/applets/networkapplet/networkapplet.cpp b/noncore/applets/networkapplet/networkapplet.cpp
index 5eb5ad2..534a8d0 100644
--- a/noncore/applets/networkapplet/networkapplet.cpp
+++ b/noncore/applets/networkapplet/networkapplet.cpp
@@ -27,35 +27,37 @@
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> 39using namespace Opie::Core;
40using namespace Opie::Ui;
41using namespace Opie::Net;
40 42
41/* QT */ 43/* QT */
44#include <qpainter.h>
42#include <qlabel.h> 45#include <qlabel.h>
43#include <qlayout.h> 46#include <qlayout.h>
44#include <qobjectlist.h> 47#include <qobjectlist.h>
45 48
49/* STD */
46#include <assert.h> 50#include <assert.h>
47 51
48using namespace Opie::Ui;
49using namespace Opie::Net;
50IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name ) 52IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name )
51 :QToolButton( parent, name ) 53 :QToolButton( parent, name )
52{ 54{
53 _iface = ONetwork::instance()->interface( name ); 55 _iface = ONetwork::instance()->interface( name );
54 assert( _iface ); 56 assert( _iface );
55 setToggleButton( true ); 57 setToggleButton( true );
56 //setAutoRaise( true ); 58 //setAutoRaise( true );
57 setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) ); 59 setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) );
58 setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) ); 60 setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) );
59 setOn( _iface->isUp() ); 61 setOn( _iface->isUp() );
60 //setFixedWidth( 16 ); 62 //setFixedWidth( 16 );
61 connect( this, SIGNAL( clicked() ), this, SLOT( clicked() ) ); 63 connect( this, SIGNAL( clicked() ), this, SLOT( clicked() ) );
@@ -158,61 +160,61 @@ QString NetworkAppletControl::guessDevice( ONetworkInterface* iface )
158 if ( QString( iface->name() ).contains( "ir" ) ) 160 if ( QString( iface->name() ).contains( "ir" ) )
159 return "networksettings/irda"; 161 return "networksettings/irda";
160 162
161 //TODO: Insert neat symbol and check for tunnel devices 163 //TODO: Insert neat symbol and check for tunnel devices
162 164
163 return "networksettings/lan"; 165 return "networksettings/lan";
164 166
165} 167}
166 168
167 169
168void NetworkAppletControl::showEvent( QShowEvent* e ) 170void NetworkAppletControl::showEvent( QShowEvent* e )
169{ 171{
170 qDebug( "showEvent" ); 172 odebug << "showEvent" << oendl;
171 build(); 173 build();
172 QWidget::showEvent( e ); 174 QWidget::showEvent( e );
173} 175}
174 176
175 177
176void NetworkAppletControl::hideEvent( QHideEvent* e ) 178void NetworkAppletControl::hideEvent( QHideEvent* e )
177{ 179{
178 qDebug( "hideEvent" ); 180 odebug << "hideEvent" << oendl;
179 QWidget::hideEvent( e ); 181 QWidget::hideEvent( e );
180 182
181 delete l; 183 delete l;
182 184
183 // delete all child widgets from this frame 185 // delete all child widgets from this frame
184 QObjectList* list = const_cast<QObjectList*>( children() ); 186 QObjectList* list = const_cast<QObjectList*>( children() );
185 QObjectListIt it(*list); 187 QObjectListIt it(*list);
186 QObject* obj; 188 QObject* obj;
187 while ( (obj=it.current()) ) 189 while ( (obj=it.current()) )
188 { 190 {
189 ++it; 191 ++it;
190 delete obj; 192 delete obj;
191 } 193 }
192 194
193 list = const_cast<QObjectList*>( children() ); 195 list = const_cast<QObjectList*>( children() );
194 if ( list ) 196 if ( list )
195 qWarning( "D'oh! We still have %d children...", list->count() ); 197 owarn << "D'oh! We still have " << list->count() << " children..." << oendl;
196 198
197 // renew layout 199 // renew layout
198 l = new QVBoxLayout( this, 4, 2 ); 200 l = new QVBoxLayout( this, 4, 2 );
199 resize( 0, 0 ); 201 resize( 0, 0 );
200} 202}
201 203
202 204
203QSize NetworkAppletControl::sizeHint() const 205QSize NetworkAppletControl::sizeHint() const
204{ 206{
205 ONetwork::instance()->synchronize(); // rebuild interface database 207 ONetwork::instance()->synchronize(); // rebuild interface database
206 qDebug( "sizeHint (#ifaces=%d)", ONetwork::instance()->count() ); 208 odebug << "sizeHint (#ifaces=" << ONetwork::instance()->count() << ")" << oendl;
207 return QSize( 14+35+105+14 + 8, ONetwork::instance()->count() * 26 ); 209 return QSize( 14+35+105+14 + 8, ONetwork::instance()->count() * 26 );
208} 210}
209 211
210 212
211NetworkApplet::NetworkApplet( QWidget *parent, const char *name ) 213NetworkApplet::NetworkApplet( QWidget *parent, const char *name )
212 :OTaskbarApplet( parent, name ) 214 :OTaskbarApplet( parent, name )
213{ 215{
214 setFixedHeight( AppLnk::smallIconSize() ); 216 setFixedHeight( AppLnk::smallIconSize() );
215 setFixedWidth( AppLnk::smallIconSize() ); 217 setFixedWidth( AppLnk::smallIconSize() );
216 _pixmap.convertFromImage( Resource::loadImage( "networkapplet/network" ).smoothScale( height(), width() ) ); 218 _pixmap.convertFromImage( Resource::loadImage( "networkapplet/network" ).smoothScale( height(), width() ) );
217 _control = new NetworkAppletControl( this, "control" ); 219 _control = new NetworkAppletControl( this, "control" );
218} 220}
diff --git a/noncore/applets/notesapplet/config.in b/noncore/applets/notesapplet/config.in
index 27a8187..c92c1d5 100644
--- a/noncore/applets/notesapplet/config.in
+++ b/noncore/applets/notesapplet/config.in
@@ -1,4 +1,4 @@
1 config NOTESAPPLET 1 config NOTESAPPLET
2 boolean "opie-notesapplet (quick note taking applet)" 2 boolean "opie-notesapplet (quick note taking applet)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp
index 13f7cf3..b3e72a7 100644
--- a/noncore/applets/notesapplet/notes.cpp
+++ b/noncore/applets/notesapplet/notes.cpp
@@ -6,56 +6,58 @@
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "notes.h" 16#include "notes.h"
17 17
18#include <qapplication.h> 18/* OPIE */
19#include <stdlib.h> 19#include <opie2/odebug.h>
20#include <qstringlist.h>
21
22#include <opie2/otaskbarapplet.h> 20#include <opie2/otaskbarapplet.h>
23#include <qpe/filemanager.h> 21#include <qpe/filemanager.h>
24#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
25#include <qpe/timestring.h> 23#include <qpe/timestring.h>
26#include <qpe/applnk.h> 24#include <qpe/applnk.h>
27#include <qpe/ir.h> 25#include <qpe/ir.h>
28#include <qpe/config.h> 26#include <qpe/config.h>
27using namespace Opie::Core;
28using namespace Opie::Ui;
29 29
30// #include <qsocket.h> 30/* QT */
31// #include <qclipboard.h>
32#include <qmultilineedit.h> 31#include <qmultilineedit.h>
33#include <qlistbox.h> 32#include <qlistbox.h>
34#include <qpopupmenu.h> 33#include <qpopupmenu.h>
35#include <qmessagebox.h> 34#include <qmessagebox.h>
36 35#include <qapplication.h>
37#include <qdir.h> 36#include <qdir.h>
38#include <qfile.h> 37#include <qfile.h>
39#include <qpoint.h> 38#include <qpoint.h>
40#include <qpushbutton.h> 39#include <qpushbutton.h>
41#include <qpainter.h> 40#include <qpainter.h>
42#include <qlayout.h> 41#include <qlayout.h>
43#include <qframe.h> 42#include <qframe.h>
44#include <qpixmap.h> 43#include <qpixmap.h>
45#include <qstring.h> 44#include <qstring.h>
45#include <qstringlist.h>
46#include <qtimer.h> 46#include <qtimer.h>
47 47
48/* STD */
49#include <stdlib.h>
50
48/* XPM */ 51/* XPM */
49using namespace Opie::Ui;
50static char * notes_xpm[] = { 52static char * notes_xpm[] = {
51"16 16 11 1", 53"16 16 11 1",
52" c None", 54" c None",
53". c #000000", 55". c #000000",
54"+ c #7F7F7F", 56"+ c #7F7F7F",
55"@ c #BFBFBF", 57"@ c #BFBFBF",
56"# c #BFC1FF", 58"# c #BFC1FF",
57"$ c #FF0000", 59"$ c #FF0000",
58"% c #FFFFFF", 60"% c #FFFFFF",
59"& c #00037F", 61"& c #00037F",
60"* c #0006FF", 62"* c #0006FF",
61"= c #0005BF", 63"= c #0005BF",
@@ -75,27 +77,27 @@ static char * notes_xpm[] = {
75" ..=**=#&=&=.. ", 77" ..=**=#&=&=.. ",
76" ..=*=&=.. ", 78" ..=*=&=.. ",
77" ..=.. ", 79" ..=.. ",
78" . "}; 80" . "};
79 81
80 82
81NotesControl::NotesControl( QWidget *, const char * ) 83NotesControl::NotesControl( QWidget *, const char * )
82 : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop ) 84 : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop )
83// : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) 85// : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
84{ 86{
85 QDir d( QDir::homeDirPath()+"/notes"); 87 QDir d( QDir::homeDirPath()+"/notes");
86 if( !d.exists()) { 88 if( !d.exists()) {
87 qDebug("make dir"); 89 odebug << "make dir" << oendl;
88 if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) 90 if(!d.mkdir( QDir::homeDirPath()+"/notes", true))
89 qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed"); 91 odebug << "<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed" << oendl;
90 } 92 }
91 Config cfg("Notes"); 93 Config cfg("Notes");
92 cfg.setGroup("Options"); 94 cfg.setGroup("Options");
93 showMax = cfg.readBoolEntry("ShowMax", false); 95 showMax = cfg.readBoolEntry("ShowMax", false);
94 96
95 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 97 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
96 loaded=false; 98 loaded=false;
97 edited=false; 99 edited=false;
98 doPopulate=true; 100 doPopulate=true;
99 isNew=false; 101 isNew=false;
100 QVBox *vbox = new QVBox( this, "Vlayout" ); 102 QVBox *vbox = new QVBox( this, "Vlayout" );
101 QHBox *hbox = new QHBox( this, "HLayout" ); 103 QHBox *hbox = new QHBox( this, "HLayout" );
@@ -156,55 +158,55 @@ void NotesControl::slotDeleteButtonClicked() {
156 switch ( QMessageBox::warning(this,tr("Delete?") 158 switch ( QMessageBox::warning(this,tr("Delete?")
157 ,tr("Do you really want to<BR><B> delete</B> this note ?") 159 ,tr("Do you really want to<BR><B> delete</B> this note ?")
158 ,tr("Yes"),tr("No"),0,1,1) ) { 160 ,tr("Yes"),tr("No"),0,1,1) ) {
159 case 0: 161 case 0:
160 slotDeleteButton(); 162 slotDeleteButton();
161 break; 163 break;
162 }; 164 };
163} 165}
164 166
165void NotesControl::slotDeleteButton() { 167void NotesControl::slotDeleteButton() {
166 168
167 QString selectedText = box->currentText(); 169 QString selectedText = box->currentText();
168 qDebug("deleting "+selectedText); 170 odebug << "deleting "+selectedText << oendl;
169 171
170 if( !selectedText.isEmpty()) { 172 if( !selectedText.isEmpty()) {
171 173
172 Config cfg("Notes"); 174 Config cfg("Notes");
173 cfg.setGroup("Docs"); 175 cfg.setGroup("Docs");
174 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 176 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
175 QString entryName, entryName2;; 177 QString entryName, entryName2;;
176 for ( int i = 0; i < noOfFiles; i++ ) { 178 for ( int i = 0; i < noOfFiles; i++ ) {
177 entryName.sprintf( "File%i", i + 1 ); 179 entryName.sprintf( "File%i", i + 1 );
178 if(selectedText == cfg.readEntry( entryName )) { 180 if(selectedText == cfg.readEntry( entryName )) {
179 qDebug("removing %s, %d", selectedText.latin1(), i); 181 odebug << "removing " << selectedText.latin1() << ", " << i << "" << oendl;
180 for ( int j = i; j < noOfFiles; j++ ) { 182 for ( int j = i; j < noOfFiles; j++ ) {
181 entryName.sprintf( "File%i", i + 1 ); 183 entryName.sprintf( "File%i", i + 1 );
182 entryName2.sprintf( "File%i", i + 2 ); 184 entryName2.sprintf( "File%i", i + 2 );
183 QString temp = cfg.readEntry(entryName2); 185 QString temp = cfg.readEntry(entryName2);
184 qDebug("move "+temp); 186 odebug << "move "+temp << oendl;
185 cfg.writeEntry(entryName, temp); 187 cfg.writeEntry(entryName, temp);
186 i++; 188 i++;
187 } 189 }
188 cfg.writeEntry("NumberOfFiles", noOfFiles-1 ); 190 cfg.writeEntry("NumberOfFiles", noOfFiles-1 );
189 entryName.sprintf( "File%i", noOfFiles ); 191 entryName.sprintf( "File%i", noOfFiles );
190 cfg.removeEntry(entryName); 192 cfg.removeEntry(entryName);
191 cfg.write(); 193 cfg.write();
192 DocLnk nf(selectedText); 194 DocLnk nf(selectedText);
193 nf.removeFiles(); 195 nf.removeFiles();
194 QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; 196 QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop";
195 qDebug(fi); 197 odebug << fi << oendl;
196 198
197 QFile f( fi); 199 QFile f( fi);
198 if( !f.remove()) qDebug(".desktop file not removed"); 200 if( !f.remove()) odebug << ".desktop file not removed" << oendl;
199 201
200 } 202 }
201 } 203 }
202 view->clear(); 204 view->clear();
203 205
204 populateBox(); 206 populateBox();
205 } 207 }
206} 208}
207 209
208void NotesControl::slotNewButton() { 210void NotesControl::slotNewButton() {
209 if(edited) save(); 211 if(edited) save();
210 view->clear(); 212 view->clear();
@@ -274,81 +276,81 @@ void NotesControl::focusOutEvent ( QFocusEvent * e) {
274 if(!loaded) { 276 if(!loaded) {
275 populateBox(); 277 populateBox();
276 load(); 278 load();
277 } 279 }
278 } 280 }
279 QWidget::focusOutEvent(e); 281 QWidget::focusOutEvent(e);
280} 282}
281 283
282void NotesControl::save() { 284void NotesControl::save() {
283 Config cfg("Notes"); 285 Config cfg("Notes");
284 cfg.setGroup("Docs"); 286 cfg.setGroup("Docs");
285 if( edited) { 287 if( edited) {
286// qDebug("is edited"); 288// odebug << "is edited" << oendl;
287 QString rt = view->text(); 289 QString rt = view->text();
288 if( rt.length()>1) { 290 if( rt.length()>1) {
289 QString pt = rt.simplifyWhiteSpace(); 291 QString pt = rt.simplifyWhiteSpace();
290 int i = pt.find( ' ', pt.find( ' ' )+2 ); 292 int i = pt.find( ' ', pt.find( ' ' )+2 );
291 QString docname = pt; 293 QString docname = pt;
292 if ( i > 0 ) 294 if ( i > 0 )
293 docname = pt.left(i); 295 docname = pt.left(i);
294 // remove "." at the beginning 296 // remove "." at the beginning
295 while( docname.startsWith( "." ) ) 297 while( docname.startsWith( "." ) )
296 docname = docname.mid( 1 ); 298 docname = docname.mid( 1 );
297 docname.replace( QRegExp("/"), "_" ); 299 docname.replace( QRegExp("/"), "_" );
298 // cut the length. filenames longer than that don't make sense 300 // cut the length. filenames longer than that don't make sense
299 // and something goes wrong when they get too long. 301 // and something goes wrong when they get too long.
300 if ( docname.length() > 40 ) 302 if ( docname.length() > 40 )
301 docname = docname.left(40); 303 docname = docname.left(40);
302 if ( docname.isEmpty() ) 304 if ( docname.isEmpty() )
303 docname = "Empty Text"; 305 docname = "Empty Text";
304// qDebug(docname); 306// odebug << docname << oendl;
305 307
306 if( oldDocName != docname) { 308 if( oldDocName != docname) {
307 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 309 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
308 QString entryName; 310 QString entryName;
309 entryName.sprintf( "File%i", noOfFiles + 1 ); 311 entryName.sprintf( "File%i", noOfFiles + 1 );
310 cfg.writeEntry( entryName,docname ); 312 cfg.writeEntry( entryName,docname );
311 cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); 313 cfg.writeEntry("NumberOfFiles", noOfFiles+1 );
312 cfg.write(); 314 cfg.write();
313 } 315 }
314// else 316// else
315// qDebug("oldname equals docname"); 317// odebug << "oldname equals docname" << oendl;
316 318
317 doc = new DocLnk(docname); 319 doc = new DocLnk(docname);
318 if(QFile(doc->linkFile()).exists()) 320 if(QFile(doc->linkFile()).exists())
319 qDebug("puppie"); 321 odebug << "puppie" << oendl;
320 doc->setType("text/plain"); 322 doc->setType("text/plain");
321 doc->setName(docname); 323 doc->setName(docname);
322 QString temp = docname.replace( QRegExp(" "), "_" ); 324 QString temp = docname.replace( QRegExp(" "), "_" );
323 doc->setFile( QDir::homeDirPath()+"/notes/"+temp); 325 doc->setFile( QDir::homeDirPath()+"/notes/"+temp);
324 FileManager fm; 326 FileManager fm;
325 if ( !fm.saveFile( *doc, rt ) ) { 327 if ( !fm.saveFile( *doc, rt ) ) {
326 } 328 }
327 329
328 oldDocName=docname; 330 oldDocName=docname;
329 edited=false; 331 edited=false;
330// qDebug("save"); 332// odebug << "save" << oendl;
331 if (doPopulate) 333 if (doPopulate)
332 populateBox(); 334 populateBox();
333 } 335 }
334 cfg.writeEntry( "LastDoc",oldDocName ); 336 cfg.writeEntry( "LastDoc",oldDocName );
335 cfg.write(); 337 cfg.write();
336 338
337 } 339 }
338} 340}
339 341
340void NotesControl::populateBox() { 342void NotesControl::populateBox() {
341 box->clear(); 343 box->clear();
342// qDebug("populate"); 344// odebug << "populate" << oendl;
343 Config cfg("Notes"); 345 Config cfg("Notes");
344 cfg.setGroup("Docs"); 346 cfg.setGroup("Docs");
345 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 347 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
346 QStringList list; 348 QStringList list;
347 QString entryName; 349 QString entryName;
348 for ( int i = 0; i < noOfFiles; i++ ) { 350 for ( int i = 0; i < noOfFiles; i++ ) {
349 entryName.sprintf( "File%i", i + 1 ); 351 entryName.sprintf( "File%i", i + 1 );
350 list.append(cfg.readEntry( entryName )); 352 list.append(cfg.readEntry( entryName ));
351 } 353 }
352 list.sort(); 354 list.sort();
353 box->insertStringList(list,-1); 355 box->insertStringList(list,-1);
354 doPopulate=false; 356 doPopulate=false;
@@ -365,25 +367,25 @@ void NotesControl::load() {
365 nf.setType("text/plain"); 367 nf.setType("text/plain");
366 nf.setFile(lastDoc); 368 nf.setFile(lastDoc);
367 369
368 loadDoc(nf); 370 loadDoc(nf);
369 loaded=true; 371 loaded=true;
370 oldDocName=lastDoc; 372 oldDocName=lastDoc;
371 cfg.writeEntry( "LastDoc",oldDocName ); 373 cfg.writeEntry( "LastDoc",oldDocName );
372 cfg.write(); 374 cfg.write();
373 } 375 }
374} 376}
375 377
376void NotesControl::load(const QString & file) { 378void NotesControl::load(const QString & file) {
377 qDebug("loading "+file); 379 odebug << "loading "+file << oendl;
378 QString name = file; 380 QString name = file;
379 QString temp; 381 QString temp;
380 if( !QFile( QDir::homeDirPath()+"/"+file).exists() ) 382 if( !QFile( QDir::homeDirPath()+"/"+file).exists() )
381 temp = QDir::homeDirPath()+"/notes/"+ name.replace( QRegExp(" "), "_" ); 383 temp = QDir::homeDirPath()+"/notes/"+ name.replace( QRegExp(" "), "_" );
382 else 384 else
383 temp = name; 385 temp = name;
384 if(!loaded) { 386 if(!loaded) {
385 DocLnk nf; 387 DocLnk nf;
386 nf.setType("text/plain"); 388 nf.setType("text/plain");
387 nf.setFile( temp); 389 nf.setFile( temp);
388 if(!temp.isEmpty()) 390 if(!temp.isEmpty())
389 loadDoc(nf); 391 loadDoc(nf);
@@ -392,25 +394,25 @@ void NotesControl::load(const QString & file) {
392// view->setFocus(); 394// view->setFocus();
393 oldDocName=file; 395 oldDocName=file;
394 Config cfg("Notes"); 396 Config cfg("Notes");
395 cfg.setGroup("Docs"); 397 cfg.setGroup("Docs");
396 cfg.writeEntry( "LastDoc",oldDocName ); 398 cfg.writeEntry( "LastDoc",oldDocName );
397 cfg.write(); 399 cfg.write();
398} 400}
399 401
400void NotesControl::loadDoc( const DocLnk &f) { 402void NotesControl::loadDoc( const DocLnk &f) {
401 FileManager fm; 403 FileManager fm;
402 QString txt; 404 QString txt;
403 if ( !fm.loadFile( f, txt ) ) { 405 if ( !fm.loadFile( f, txt ) ) {
404 qDebug("could not load file "+f.file()); 406 odebug << "could not load file "+f.file() << oendl;
405 return; 407 return;
406 } 408 }
407 view->setText(txt); 409 view->setText(txt);
408} 410}
409 411
410void NotesControl::slotViewEdited() { 412void NotesControl::slotViewEdited() {
411 if(loaded) { 413 if(loaded) {
412 edited=true; 414 edited=true;
413 } 415 }
414} 416}
415 417
416 418
@@ -426,25 +428,25 @@ void NotesControl::slotShowMax() {
426void NotesControl::slotSearch() { 428void NotesControl::slotSearch() {
427 int boxCount = box->count(); 429 int boxCount = box->count();
428 for(int i=0;i< boxCount;i++) { 430 for(int i=0;i< boxCount;i++) {
429 431
430 } 432 }
431} 433}
432 434
433// void NotesControl::keyReleaseEvent( QKeyEvent *e) { 435// void NotesControl::keyReleaseEvent( QKeyEvent *e) {
434 436
435// switch ( e->state() ) { 437// switch ( e->state() ) {
436// case ControlButton: 438// case ControlButton:
437// if(e->key() == Key_C) { //copy 439// if(e->key() == Key_C) { //copy
438// qDebug("copy"); 440// odebug << "copy" << oendl;
439// QClipboard *cb = QApplication::clipboard(); 441// QClipboard *cb = QApplication::clipboard();
440// QString text; 442// QString text;
441 443
442// // Copy text from the clipboard (paste) 444// // Copy text from the clipboard (paste)
443// text = cb->text(); 445// text = cb->text();
444// } 446// }
445// if(e->key() == Key_X) { //cut 447// if(e->key() == Key_X) { //cut
446// } 448// }
447// if(e->key() == Key_V) { //paste 449// if(e->key() == Key_V) { //paste
448// QClipboard *cb = QApplication::clipboard(); 450// QClipboard *cb = QApplication::clipboard();
449// QString text; 451// QString text;
450// //view 452// //view
@@ -473,28 +475,28 @@ int NotesApplet::position()
473 return 6; 475 return 6;
474} 476}
475 477
476void NotesApplet::mousePressEvent( QMouseEvent *) { 478void NotesApplet::mousePressEvent( QMouseEvent *) {
477 if( !vc->isHidden()) { 479 if( !vc->isHidden()) {
478 vc->doPopulate=false; 480 vc->doPopulate=false;
479 vc->save(); 481 vc->save();
480 vc->close(); 482 vc->close();
481 } else { 483 } else {
482// vc = new NotesControl; 484// vc = new NotesControl;
483// QPoint curPos = mapToGlobal( rect().topLeft() ); 485// QPoint curPos = mapToGlobal( rect().topLeft() );
484 if(vc->showMax) { 486 if(vc->showMax) {
485 qDebug("show max"); 487 odebug << "show max" << oendl;
486 vc->showMaximized(); 488 vc->showMaximized();
487 } else { 489 } else {
488 qDebug("no show max"); 490 odebug << "no show max" << oendl;
489 QWidget *wid = QPEApplication::desktop(); 491 QWidget *wid = QPEApplication::desktop();
490 QRect rect = QApplication::desktop()->geometry(); 492 QRect rect = QApplication::desktop()->geometry();
491 vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); 493 vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180);
492 vc->move ( (rect.center()/2) - (vc->rect().center()/2)); 494 vc->move ( (rect.center()/2) - (vc->rect().center()/2));
493// vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); 495// vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28);
494 } 496 }
495 vc->show(); 497 vc->show();
496 vc->doPopulate=true; 498 vc->doPopulate=true;
497 vc->populateBox(); 499 vc->populateBox();
498 vc->doPopulate=false; 500 vc->doPopulate=false;
499 vc->loaded=false; 501 vc->loaded=false;
500 502
diff --git a/noncore/applets/notesapplet/notesapplet.pro b/noncore/applets/notesapplet/notesapplet.pro
index 44e5b34..c3f9b1c 100644
--- a/noncore/applets/notesapplet/notesapplet.pro
+++ b/noncore/applets/notesapplet/notesapplet.pro
@@ -1,12 +1,12 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on 2CONFIG += qt plugin warn_on
3HEADERS = notes.h 3HEADERS = notes.h
4SOURCES = notes.cpp 4SOURCES = notes.cpp
5TARGET = notesapplet 5TARGET = notesapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe -lopiecore2
10VERSION = 1.0.0 10VERSION = 1.0.1
11 11
12include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index 0491a86..364f3ad 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -7,53 +7,55 @@
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 17
18/* OPIE */ 18/* OPIE */
19#include <opie2/odebug.h>
19#include <opie2/onetwork.h> 20#include <opie2/onetwork.h>
20#include <opie2/otaskbarapplet.h> 21#include <opie2/otaskbarapplet.h>
21#include <qpe/config.h> 22#include <qpe/config.h>
22#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24using namespace Opie::Core;
25using namespace Opie::Ui;
26using namespace Opie::Net;
23 27
24/* QT */ 28/* QT */
25#include <qradiobutton.h> 29#include <qradiobutton.h>
26#include <qpushbutton.h> 30#include <qpushbutton.h>
27#include <qpainter.h> 31#include <qpainter.h>
28#include <qlabel.h> 32#include <qlabel.h>
29#include <qslider.h> 33#include <qslider.h>
30#include <qbuttongroup.h> 34#include <qbuttongroup.h>
31#include <qlayout.h> 35#include <qlayout.h>
32#include <qfile.h> 36#include <qfile.h>
33#include <qtextstream.h> 37#include <qtextstream.h>
34 38
35/* STD */ 39/* STD */
36#include <math.h> 40#include <math.h>
37#include <sys/types.h> 41#include <sys/types.h>
38#include <signal.h> 42#include <signal.h>
39#if defined (__GNUC__) && (__GNUC__ < 3) 43#if defined (__GNUC__) && (__GNUC__ < 3)
40#define round qRound 44#define round qRound
41#endif 45#endif
42 46
43//#define MDEBUG 47//#define MDEBUG
44#undef MDEBUG 48#undef MDEBUG
45 49
46using namespace Opie::Ui;
47using namespace Opie::Net;
48WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) 50WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name )
49 : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) 51 : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet )
50{ 52{
51 53
52 readConfig(); 54 readConfig();
53 writeConfigEntry( "UpdateFrequency", updateFrequency ); 55 writeConfigEntry( "UpdateFrequency", updateFrequency );
54 56
55 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 57 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
56 QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); 58 QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" );
57 59
58 /* status label */ 60 /* status label */
59 61
@@ -198,84 +200,84 @@ void WirelessApplet::checkInterface()
198 ONetwork* net = ONetwork::instance(); 200 ONetwork* net = ONetwork::instance();
199 net->synchronize(); 201 net->synchronize();
200 ONetwork::InterfaceIterator it = net->iterator(); 202 ONetwork::InterfaceIterator it = net->iterator();
201 203
202 while ( it.current() && !it.current()->isWireless() ) ++it; 204 while ( it.current() && !it.current()->isWireless() ) ++it;
203 205
204 if ( it.current() && it.current()->isWireless() ) 206 if ( it.current() && it.current()->isWireless() )
205 interface = static_cast<OWirelessNetworkInterface*>( it.current() ); 207 interface = static_cast<OWirelessNetworkInterface*>( it.current() );
206 208
207 if ( interface ) 209 if ( interface )
208 { 210 {
209#ifdef MDEBUG 211#ifdef MDEBUG
210 qDebug( "WIFIAPPLET: using interface '%s'", ( const char* ) interface->name() ); 212 odebug << "WIFIAPPLET: using interface '" << ( const char* ) interface->name() << "'" << oendl;
211#endif 213#endif
212 214
213 } 215 }
214 else 216 else
215 { 217 {
216#ifdef MDEBUG 218#ifdef MDEBUG
217 qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" ); 219 odebug << "WIFIAPPLET: D'oh! No Wireless interface present... :(" << oendl;
218#endif 220#endif
219 hide(); 221 hide();
220 } 222 }
221} 223}
222 224
223void WirelessApplet::renewDHCP() 225void WirelessApplet::renewDHCP()
224{ 226{
225#ifdef MDEBUG 227#ifdef MDEBUG
226 qDebug( "WIFIAPPLET: Going to request a DHCP configuration renew." ); 228 odebug << "WIFIAPPLET: Going to request a DHCP configuration renew." << oendl;
227#endif 229#endif
228 230
229 QString pidfile; 231 QString pidfile;
230 if ( !interface ) 232 if ( !interface )
231 return ; 233 return ;
232 QString ifacename( interface->name() ); 234 QString ifacename( interface->name() );
233 235
234 // At first we are trying dhcpcd 236 // At first we are trying dhcpcd
235 237
236 pidfile.sprintf( "/var/run/dhcpcd-%s.pid", ( const char* ) ifacename ); 238 pidfile.sprintf( "/var/run/dhcpcd-%s.pid", ( const char* ) ifacename );
237#ifdef MDEBUG 239#ifdef MDEBUG
238 qDebug( "WIFIAPPLET: dhcpcd pidfile is '%s'", ( const char* ) pidfile ); 240 odebug << "WIFIAPPLET: dhcpcd pidfile is '" << ( const char* ) pidfile << "'" << oendl;
239#endif 241#endif
240 int pid; 242 int pid;
241 QFile pfile( pidfile ); 243 QFile pfile( pidfile );
242 bool hasFile = pfile.open( IO_ReadOnly ); 244 bool hasFile = pfile.open( IO_ReadOnly );
243 QTextStream s( &pfile ); 245 QTextStream s( &pfile );
244 if ( hasFile ) 246 if ( hasFile )
245 { 247 {
246 s >> pid; 248 s >> pid;
247#ifdef MDEBUG 249#ifdef MDEBUG
248 qDebug( "WIFIAPPLET: sent SIGALARM to pid %d", pid ); 250 odebug << "WIFIAPPLET: sent SIGALARM to pid " << pid << "" << oendl;
249#endif 251#endif
250 kill( pid, SIGALRM ); 252 kill( pid, SIGALRM );
251 return ; 253 return ;
252 } 254 }
253 255
254 // No dhcpcd, so we are trying udhcpc 256 // No dhcpcd, so we are trying udhcpc
255#ifdef MDEBUG 257#ifdef MDEBUG
256 qDebug( "WIFIAPPLET: dhcpcd not available." ); 258 odebug << "WIFIAPPLET: dhcpcd not available." << oendl;
257#endif 259#endif
258 pidfile.sprintf( "/var/run/udhcpc.%s.pid", ( const char* ) ifacename ); 260 pidfile.sprintf( "/var/run/udhcpc.%s.pid", ( const char* ) ifacename );
259#ifdef MDEBUG 261#ifdef MDEBUG
260 qDebug( "WIFIAPPLET: udhcpc pidfile is '%s'", ( const char* ) pidfile ); 262 odebug << "WIFIAPPLET: udhcpc pidfile is '" << ( const char* ) pidfile << "'" << oendl;
261#endif 263#endif
262 QFile pfile2( pidfile ); 264 QFile pfile2( pidfile );
263 hasFile = pfile2.open( IO_ReadOnly ); 265 hasFile = pfile2.open( IO_ReadOnly );
264 QTextStream s2( &pfile2 ); 266 QTextStream s2( &pfile2 );
265 if ( hasFile ) 267 if ( hasFile )
266 { 268 {
267 s2 >> pid; 269 s2 >> pid;
268#ifdef MDEBUG 270#ifdef MDEBUG
269 qDebug( "WIFIAPPLET: sent SIGUSR1 to pid %d", pid ); 271 odebug << "WIFIAPPLET: sent SIGUSR1 to pid " << pid << "" << oendl;
270#endif 272#endif
271 kill( pid, SIGUSR1 ); 273 kill( pid, SIGUSR1 );
272 return ; 274 return ;
273 } 275 }
274} 276}
275 277
276void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE ) 278void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE )
277{ 279{
278 rocESSID = ESSID; 280 rocESSID = ESSID;
279 rocFREQ = FREQ; 281 rocFREQ = FREQ;
280 rocAP = AP; 282 rocAP = AP;
281 rocMODE = MODE; 283 rocMODE = MODE;
@@ -294,42 +296,42 @@ void WirelessApplet::updateDelayChange( int delay )
294void WirelessApplet::displayStyleChange( int style ) 296void WirelessApplet::displayStyleChange( int style )
295{ 297{
296 visualStyle = style; 298 visualStyle = style;
297 repaint(); 299 repaint();
298} 300}
299 301
300WirelessApplet::~WirelessApplet() 302WirelessApplet::~WirelessApplet()
301{} 303{}
302 304
303void WirelessApplet::timerEvent( QTimerEvent* ) 305void WirelessApplet::timerEvent( QTimerEvent* )
304{ 306{
305#ifdef MDEBUG 307#ifdef MDEBUG
306 qDebug( "WirelessApplet::timerEvent" ); 308 odebug << "WirelessApplet::timerEvent" << oendl;
307#endif 309#endif
308 if ( interface ) 310 if ( interface )
309 { 311 {
310 if ( !ONetwork::instance()->isPresent( (const char*) interface->name() ) ) 312 if ( !ONetwork::instance()->isPresent( (const char*) interface->name() ) )
311 { 313 {
312#ifdef MDEBUG 314#ifdef MDEBUG
313 qDebug( "WIFIAPPLET: Interface no longer present." ); 315 odebug << "WIFIAPPLET: Interface no longer present." << oendl;
314#endif 316#endif
315 interface = 0L; 317 interface = 0L;
316 mustRepaint(); 318 mustRepaint();
317 return; 319 return;
318 } 320 }
319 321
320 if ( mustRepaint() ) 322 if ( mustRepaint() )
321 { 323 {
322#ifdef MDEBUG 324#ifdef MDEBUG
323 qDebug( "WIFIAPPLET: A value has changed -> repainting." ); 325 odebug << "WIFIAPPLET: A value has changed -> repainting." << oendl;
324#endif 326#endif
325 repaint(); 327 repaint();
326 } 328 }
327 329
328 if ( status->isVisible() ) 330 if ( status->isVisible() )
329 { 331 {
330 updatePopupWindow(); 332 updatePopupWindow();
331 } 333 }
332 } 334 }
333 else 335 else
334 { 336 {
335 checkInterface(); 337 checkInterface();
@@ -347,32 +349,32 @@ void WirelessApplet::mousePressEvent( QMouseEvent * )
347bool WirelessApplet::mustRepaint() 349bool WirelessApplet::mustRepaint()
348{ 350{
349 // check if there are enough changes to justify a (flickering) repaint 351 // check if there are enough changes to justify a (flickering) repaint
350 352
351 // has the interface changed? 353 // has the interface changed?
352 354
353 if ( interface != oldiface ) 355 if ( interface != oldiface )
354 { 356 {
355 oldiface = interface; 357 oldiface = interface;
356 if ( interface ) 358 if ( interface )
357 { 359 {
358#ifdef MDEBUG 360#ifdef MDEBUG
359 qDebug( "WIFIAPPLET: We had no interface but now we have one! :-)" ); 361 odebug << "WIFIAPPLET: We had no interface but now we have one! :-)" << oendl;
360#endif 362#endif
361 show(); 363 show();
362 } 364 }
363 else 365 else
364 { 366 {
365#ifdef MDEBUG 367#ifdef MDEBUG
366 qDebug( "WIFIAPPLET: We had a interface but now we don't have one! ;-(" ); 368 odebug << "WIFIAPPLET: We had a interface but now we don't have one! ;-(" << oendl;
367#endif 369#endif
368 hide(); 370 hide();
369 return true; 371 return true;
370 } 372 }
371 } 373 }
372 374
373 int rings = numberOfRings(); 375 int rings = numberOfRings();
374 376
375 if ( rings != oldrings ) 377 if ( rings != oldrings )
376 { 378 {
377 oldrings = rings; 379 oldrings = rings;
378 return true; 380 return true;
@@ -386,46 +388,46 @@ bool WirelessApplet::mustRepaint()
386 || ( signalH != oldsignalH ) 388 || ( signalH != oldsignalH )
387 || ( qualityH != oldqualityH ) ) 389 || ( qualityH != oldqualityH ) )
388 { 390 {
389 oldnoiseH = noiseH; 391 oldnoiseH = noiseH;
390 oldsignalH = signalH; 392 oldsignalH = signalH;
391 oldqualityH = qualityH; 393 oldqualityH = qualityH;
392 return true; 394 return true;
393 } 395 }
394 396
395 if ( rocESSID && ( oldESSID != interface->SSID() ) ) 397 if ( rocESSID && ( oldESSID != interface->SSID() ) )
396 { 398 {
397#ifdef MDEBUG 399#ifdef MDEBUG
398 qDebug( "WIFIAPPLET: ESSID has changed." ); 400 odebug << "WIFIAPPLET: ESSID has changed." << oendl;
399#endif 401#endif
400 renewDHCP(); 402 renewDHCP();
401 } 403 }
402 else if ( rocFREQ && ( oldFREQ != interface->frequency() ) ) 404 else if ( rocFREQ && ( oldFREQ != interface->frequency() ) )
403 { 405 {
404#ifdef MDEBUG 406#ifdef MDEBUG
405 qDebug( "WIFIAPPLET: FREQ has changed." ); 407 odebug << "WIFIAPPLET: FREQ has changed." << oendl;
406#endif 408#endif
407 renewDHCP(); 409 renewDHCP();
408 } 410 }
409 else if ( rocAP && ( oldAP != interface->associatedAP().toString() ) ) 411 else if ( rocAP && ( oldAP != interface->associatedAP().toString() ) )
410 { 412 {
411#ifdef MDEBUG 413#ifdef MDEBUG
412 qDebug( "WIFIAPPLET: AP has changed." ); 414 odebug << "WIFIAPPLET: AP has changed." << oendl;
413#endif 415#endif
414 renewDHCP(); 416 renewDHCP();
415 } 417 }
416 else if ( rocMODE && ( oldMODE != interface->mode() ) ) 418 else if ( rocMODE && ( oldMODE != interface->mode() ) )
417 { 419 {
418#ifdef MDEBUG 420#ifdef MDEBUG
419 qDebug( "WIFIAPPLET: MODE has changed." ); 421 odebug << "WIFIAPPLET: MODE has changed." << oendl;
420#endif 422#endif
421 renewDHCP(); 423 renewDHCP();
422 } 424 }
423 425
424 oldESSID = interface->SSID(); 426 oldESSID = interface->SSID();
425 oldMODE = interface->mode(); 427 oldMODE = interface->mode();
426 oldFREQ = interface->frequency(); 428 oldFREQ = interface->frequency();
427 oldAP = interface->associatedAP().toString(); 429 oldAP = interface->associatedAP().toString();
428 430
429 return false; 431 return false;
430} 432}
431 433
@@ -441,25 +443,25 @@ void WirelessApplet::updatePopupWindow()
441 freqString.sprintf( "%.3f GHz", interface->frequency() ); 443 freqString.sprintf( "%.3f GHz", interface->frequency() );
442 status->statusLabel->setText( "Station: " + interface->nickName() + "<br>" + 444 status->statusLabel->setText( "Station: " + interface->nickName() + "<br>" +
443 "ESSID: " + interface->SSID() + "<br>" + 445 "ESSID: " + interface->SSID() + "<br>" +
444 "MODE: " + interface->mode() + "<br>" + 446 "MODE: " + interface->mode() + "<br>" +
445 "FREQ: " + freqString + "<br>" + 447 "FREQ: " + freqString + "<br>" +
446 cell + " " + interface->associatedAP().toString() ); 448 cell + " " + interface->associatedAP().toString() );
447} 449}
448 450
449int WirelessApplet::numberOfRings() 451int WirelessApplet::numberOfRings()
450{ 452{
451 if ( !interface ) return -1; 453 if ( !interface ) return -1;
452 int qualityH = interface->signalStrength(); 454 int qualityH = interface->signalStrength();
453 qDebug( "quality = %d", qualityH ); 455 odebug << "quality = " << qualityH << "" << oendl;
454 if ( qualityH < 1 ) return -1; 456 if ( qualityH < 1 ) return -1;
455 if ( qualityH < 20 ) return 0; 457 if ( qualityH < 20 ) return 0;
456 if ( qualityH < 40 ) return 1; 458 if ( qualityH < 40 ) return 1;
457 if ( qualityH < 60 ) return 2; 459 if ( qualityH < 60 ) return 2;
458 if ( qualityH < 65 ) return 3; 460 if ( qualityH < 65 ) return 3;
459 return 4; 461 return 4;
460} 462}
461 463
462void WirelessApplet::paintEvent( QPaintEvent* ) 464void WirelessApplet::paintEvent( QPaintEvent* )
463{ 465{
464 QPainter p( this ); 466 QPainter p( this );
465 int h = height(); 467 int h = height();
@@ -472,25 +474,25 @@ void WirelessApplet::paintEvent( QPaintEvent* )
472 p.drawLine( w-m, h-m-1, m, h-m-1 ); 474 p.drawLine( w-m, h-m-1, m, h-m-1 );
473 475
474 int rings = numberOfRings(); 476 int rings = numberOfRings();
475 477
476 if ( rings == -1 ) 478 if ( rings == -1 )
477 { 479 {
478 p.setPen( QPen( QColor( 200, 20, 20 ), 2 ) ); 480 p.setPen( QPen( QColor( 200, 20, 20 ), 2 ) );
479 p.drawLine( w/2-m-m, h/2-m-m, w/2+m+m, h/2+m+m ); 481 p.drawLine( w/2-m-m, h/2-m-m, w/2+m+m, h/2+m+m );
480 p.drawLine( w/2+m+m, h/2-m-m, w/2-m-m, h/2+m+m ); 482 p.drawLine( w/2+m+m, h/2-m-m, w/2-m-m, h/2+m+m );
481 return; 483 return;
482 } 484 }
483 485
484 qDebug( "WirelessApplet: painting %d rings", rings ); 486 odebug << "WirelessApplet: painting " << rings << " rings" << oendl;
485 int radius = 2; 487 int radius = 2;
486 int rstep = 4; 488 int rstep = 4;
487 int maxrings = w/rstep; 489 int maxrings = w/rstep;
488 490
489 p.setPen( QColor( 200, 20, 20 ) ); 491 p.setPen( QColor( 200, 20, 20 ) );
490 for ( int i = 0; i < rings; ++i ) 492 for ( int i = 0; i < rings; ++i )
491 { 493 {
492 p.drawEllipse( w/2 - radius/2, h/3 - radius/2, radius, radius ); 494 p.drawEllipse( w/2 - radius/2, h/3 - radius/2, radius, radius );
493 radius += rstep; 495 radius += rstep;
494 }; 496 };
495 497
496 498
diff --git a/noncore/applets/zkbapplet/zkbwidget.cpp b/noncore/applets/zkbapplet/zkbwidget.cpp
index 3acff1e..13d554c 100644
--- a/noncore/applets/zkbapplet/zkbwidget.cpp
+++ b/noncore/applets/zkbapplet/zkbwidget.cpp
@@ -85,25 +85,25 @@ bool ZkbWidget::loadKeymap() {
85 hide(); 85 hide();
86 } else { 86 } else {
87 show(); 87 show();
88 } 88 }
89 return true; 89 return true;
90} 90}
91 91
92QSize ZkbWidget::sizeHint() const { 92QSize ZkbWidget::sizeHint() const {
93 return QSize(AppLnk::smallIconSize(),AppLnk::smallIconSize()); 93 return QSize(AppLnk::smallIconSize(),AppLnk::smallIconSize());
94} 94}
95 95
96void ZkbWidget::stateChanged(const QString& s) { 96void ZkbWidget::stateChanged(const QString& s) {
97 //qDebug("stateChanged: %s\n", (const char*) s.utf8()); 97 //odebug << "stateChanged: " << (const char*) s.utf8() << "\n" << oendl;
98 setText(s); 98 setText(s);
99} 99}
100 100
101void ZkbWidget::labelChanged(int id) { 101void ZkbWidget::labelChanged(int id) {
102 if (id == 0) { 102 if (id == 0) {
103 keymap->disable(); 103 keymap->disable();
104 setPixmap(disabled); 104 setPixmap(disabled);
105 return; 105 return;
106 } 106 }
107 107
108 keymap->enable(); 108 keymap->enable();
109 109