summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
committer mickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
commit16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff)
tree0701eae15aa606a0211a2fccfde0eafdac69357c
parent8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff)
downloadopie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2
convert to Opie Debugging Framework
Diffstat (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
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp44
-rw-r--r--noncore/apps/advancedfm/advancedfm.pro24
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp12
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp1681
-rw-r--r--noncore/apps/advancedfm/filePermissions.cpp2
-rw-r--r--noncore/apps/advancedfm/output.cpp23
-rw-r--r--noncore/apps/checkbook/checkbook.pro2
-rw-r--r--noncore/apps/checkbook/listedit.cpp11
-rw-r--r--noncore/apps/checkbook/tabledef.cpp6
-rw-r--r--noncore/apps/checkbook/transaction.cpp6
-rw-r--r--noncore/apps/confedit/confedit.pro24
-rw-r--r--noncore/apps/confedit/config.in2
-rw-r--r--noncore/apps/confedit/listviewconfdir.cpp12
-rw-r--r--noncore/apps/confedit/listviewitemconffile.cpp24
-rw-r--r--noncore/apps/confedit/mainwindow.cpp19
-rw-r--r--noncore/apps/keyz-cfg/cfgfile.cpp12
-rw-r--r--noncore/apps/keyz-cfg/config.in2
-rw-r--r--noncore/apps/keyz-cfg/keyz-cfg.pro16
-rw-r--r--noncore/apps/keyz-cfg/zkb.cpp4
-rw-r--r--noncore/apps/keyz-cfg/zkbcfg.cpp15
-rw-r--r--noncore/apps/opie-bartender/bartender.cpp35
-rw-r--r--noncore/apps/opie-bartender/bartender.pro7
-rw-r--r--noncore/apps/opie-bartender/config.in3
-rw-r--r--noncore/apps/opie-console/MyPty.cpp14
-rw-r--r--noncore/apps/opie-console/TEWidget.cpp6
-rw-r--r--noncore/apps/opie-console/TEmulation.cpp8
-rw-r--r--noncore/apps/opie-console/atconfigdialog.cpp13
-rw-r--r--noncore/apps/opie-console/dialer.cpp27
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp14
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp10
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp9
-rw-r--r--noncore/apps/opie-console/io_bt.cpp7
-rw-r--r--noncore/apps/opie-console/io_irda.cpp8
-rw-r--r--noncore/apps/opie-console/io_modem.cpp8
-rw-r--r--noncore/apps/opie-console/main.cpp2
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp39
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp11
-rw-r--r--noncore/apps/opie-console/opie-console.pro4
-rw-r--r--noncore/apps/opie-console/sz_transfer.cpp6
-rw-r--r--noncore/apps/opie-console/tabwidget.cpp7
-rw-r--r--noncore/apps/opie-console/terminalwidget.cpp11
-rw-r--r--noncore/apps/opie-console/test/senderui.cpp14
-rw-r--r--noncore/apps/opie-console/widget.cpp6
-rw-r--r--noncore/apps/opie-console/widget_layer.cpp4
-rw-r--r--noncore/apps/opie-write/mainwindow.cpp12
-rw-r--r--noncore/apps/opie-write/opie-write.pro3
-rw-r--r--noncore/apps/opie-write/qcomplextext.cpp4
-rw-r--r--noncore/apps/opie-write/qrichtext.cpp28
-rw-r--r--noncore/apps/opie-write/qrichtext_p.cpp15
-rwxr-xr-xnoncore/apps/qashmoney/accountdisplay.cpp13
-rw-r--r--noncore/apps/qashmoney/config.in2
-rwxr-xr-xnoncore/apps/qashmoney/qashmoney.pro2
-rw-r--r--noncore/apps/tableviewer/db/common.cpp28
-rw-r--r--noncore/apps/tableviewer/db/datacache.cpp12
-rw-r--r--noncore/apps/tableviewer/db/xmlsource.cpp30
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp14
-rw-r--r--noncore/apps/tableviewer/tableviewer.pro8
-rw-r--r--noncore/apps/tableviewer/ui/tvlistview.cpp9
-rw-r--r--noncore/apps/tinykate/libkate/libkate.pro147
-rw-r--r--noncore/apps/tinykate/tinykate.pro26
-rw-r--r--noncore/apps/zsafe/config.in2
-rw-r--r--noncore/apps/zsafe/scqtfiledlg.cpp29
-rw-r--r--noncore/apps/zsafe/zsafe.cpp15
-rw-r--r--noncore/apps/zsafe/zsafe.pro14
-rw-r--r--noncore/comm/keypebble/config.in2
-rw-r--r--noncore/comm/keypebble/keypebble.pro9
-rw-r--r--noncore/comm/keypebble/krfbbuffer.cpp24
-rw-r--r--noncore/comm/keypebble/krfbcanvas.cpp8
-rw-r--r--noncore/comm/keypebble/krfbconnection.cpp31
-rw-r--r--noncore/comm/keypebble/krfbdecoder.cpp63
-rw-r--r--noncore/comm/keypebble/krfblogin.cpp41
-rw-r--r--noncore/comm/keypebble/kvncbookmarkdlg.cpp12
-rw-r--r--noncore/games/backgammon/backgammon.cpp16
-rw-r--r--noncore/games/backgammon/moveengine.cpp2
-rw-r--r--noncore/games/bounce/bounce.pro5
-rw-r--r--noncore/games/bounce/game.cpp15
-rw-r--r--noncore/games/go/go.pro15
-rw-r--r--noncore/games/go/gowidget.cpp9
-rw-r--r--noncore/games/kpacman/kpacman.pro4
-rw-r--r--noncore/games/kpacman/kpacmanwidget.cpp5
-rw-r--r--noncore/games/kpacman/status.cpp5
-rw-r--r--noncore/games/mindbreaker/mindbreaker.cpp2
-rw-r--r--noncore/games/oyatzee/oyatzee.cpp50
-rw-r--r--noncore/games/oyatzee/oyatzee.pro2
-rw-r--r--noncore/games/wordgame/wordgame.cpp2
-rw-r--r--noncore/graphics/opie-eye/config.in4
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp14
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_lister.cpp8
-rw-r--r--noncore/graphics/opie-eye/lib/slavemaster.cpp12
-rw-r--r--noncore/graphics/opie-eye/phunk_view.pro2
-rw-r--r--noncore/graphics/opie-eye/slave/jpeg_slave.cpp18
-rw-r--r--noncore/graphics/opie-eye/slave/main.cpp16
-rw-r--r--noncore/graphics/opie-eye/slave/slave.pro6
-rw-r--r--noncore/graphics/opie-eye/slave/slavereciever.cpp22
-rw-r--r--noncore/graphics/opie-eye/slave/thumbnailtool.cpp11
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/om3u.cpp14
-rw-r--r--noncore/multimedia/opieplayer2/playlistselection.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp38
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp24
-rw-r--r--noncore/multimedia/opieplayer2/threadutil.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp8
-rw-r--r--noncore/multimedia/opierec/device.cpp46
-rw-r--r--noncore/multimedia/opierec/helpwindow.cpp11
-rw-r--r--noncore/multimedia/opierec/opierec.pro6
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp129
-rw-r--r--noncore/multimedia/opierec/wavFile.cpp67
-rw-r--r--noncore/multimedia/opierec/waveform.cpp12
-rw-r--r--noncore/multimedia/powerchord/config.in6
-rw-r--r--noncore/multimedia/powerchord/powerchord.pro3
-rw-r--r--noncore/multimedia/powerchord/powerchordbase.cpp12
-rw-r--r--noncore/multimedia/showimg/ImageFileSelector.cpp20
-rw-r--r--noncore/multimedia/showimg/showimg.cpp20
-rw-r--r--noncore/multimedia/showimg/showimg.pro2
-rw-r--r--noncore/multimedia/tonleiter/config.in2
-rw-r--r--noncore/multimedia/tonleiter/editinst.cpp11
-rw-r--r--noncore/multimedia/tonleiter/fretboard.cpp13
-rw-r--r--noncore/multimedia/tonleiter/tonleiter.pro6
-rw-r--r--noncore/multimedia/tonleiter/tonleiterdata.cpp11
-rw-r--r--noncore/multimedia/tonleiter/tonleiterdatahelper.cpp6
-rw-r--r--noncore/net/mail/accountitem.cpp18
-rw-r--r--noncore/net/mail/accountview.cpp12
-rw-r--r--noncore/net/mail/composemail.cpp6
-rw-r--r--noncore/net/mail/editaccounts.cpp22
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp8
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.cpp30
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp14
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp66
-rw-r--r--noncore/net/mail/libmailwrapper/logindialog.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp22
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp60
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp8
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp18
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp30
-rw-r--r--noncore/net/mail/libmailwrapper/statusmail.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.cpp4
-rw-r--r--noncore/net/mail/mainwindow.cpp14
-rw-r--r--noncore/net/mail/nntpgroups.cpp2
-rw-r--r--noncore/net/mail/opiemail.cpp16
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.cpp2
-rw-r--r--noncore/net/mail/viewmail.cpp2
-rw-r--r--noncore/net/opieftp/config.in2
-rw-r--r--noncore/net/opieftp/filePermissions.cpp2
-rw-r--r--noncore/net/opieftp/opieftp.cpp77
-rw-r--r--noncore/net/opieftp/opieftp.pro11
-rw-r--r--noncore/net/opieirc/config.in2
-rw-r--r--noncore/net/opieirc/ircmisc.cpp9
-rw-r--r--noncore/net/opieirc/opieirc.pro13
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp2
-rw-r--r--noncore/net/opietooth/lib/startdunconnection.cpp2
-rw-r--r--noncore/net/opietooth/lib/startpanconnection.cpp8
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp16
-rw-r--r--noncore/net/opietooth/manager/devicehandler.cpp10
-rw-r--r--noncore/net/opietooth/manager/dunpopup.cpp2
-rw-r--r--noncore/net/opietooth/manager/hciconfwrapper.cpp16
-rw-r--r--noncore/net/opietooth/manager/obexdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/obexpopup.cpp4
-rw-r--r--noncore/net/opietooth/manager/panpopup.cpp2
-rw-r--r--noncore/net/opietooth/manager/popuphelper.cpp4
-rw-r--r--noncore/net/opietooth/manager/pppdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp4
-rw-r--r--noncore/net/opietooth/manager/rfcommconfhandler.cpp10
-rw-r--r--noncore/net/opietooth/manager/rfcpopup.cpp8
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp30
-rw-r--r--noncore/net/wellenreiter/gui/gps.cpp12
-rw-r--r--noncore/net/wellenreiter/gui/logwindow.cpp8
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp15
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp57
-rw-r--r--noncore/net/wellenreiter/gui/packetview.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/resource.cpp4
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp77
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp74
-rw-r--r--noncore/settings/backup/backuprestore.cpp28
-rw-r--r--noncore/settings/netsystemtime/settingstabwidget.cpp2
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp20
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp42
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp14
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp38
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/authwidget.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp10
-rw-r--r--noncore/settings/networksettings/ppp/devices.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/interfaceinformationppp.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.cpp14
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp20
-rw-r--r--noncore/settings/networksettings/ppp/modem.cpp48
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.cpp12
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp92
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp20
-rw-r--r--noncore/settings/networksettings/wlan/infoimp.cpp4
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.cpp12
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp6
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp24
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp54
-rw-r--r--noncore/settings/sound/sound.pro11
-rw-r--r--noncore/settings/sound/soundsettings.cpp16
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.cpp10
-rw-r--r--noncore/settings/tabmanager/tabmanager.cpp20
-rw-r--r--noncore/settings/usermanager/userdialog.cpp14
-rw-r--r--noncore/settings/usermanager/usermanager.cpp11
-rw-r--r--noncore/settings/usermanager/usermanager.pro9
-rw-r--r--noncore/styles/liquid/config.in2
-rw-r--r--noncore/styles/liquid/liquid.cpp27
-rw-r--r--noncore/styles/liquid/liquid.pro6
-rw-r--r--noncore/styles/theme/othemebase.cpp27
-rw-r--r--noncore/todayplugins/fortune/fortune.pro1
-rw-r--r--noncore/todayplugins/fortune/fortunepluginwidget.cpp9
-rw-r--r--noncore/todayplugins/stockticker/stockticker/inputDialog.cpp18
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/config.in2
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro5
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp10
-rw-r--r--noncore/tools/calc2/engine.cpp10
-rw-r--r--noncore/tools/calculator/calculator.pro4
-rw-r--r--noncore/tools/calculator/calculatorimpl.cpp11
-rw-r--r--noncore/tools/formatter/formatter.cpp36
-rw-r--r--noncore/tools/formatter/formatter.pro10
232 files changed, 2793 insertions, 2569 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
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index a60d6ce..a47edd8 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -62,53 +62,53 @@ AdvancedFm::~AdvancedFm() {
62void AdvancedFm::cleanUp() { 62void AdvancedFm::cleanUp() {
63 QString sfile=QDir::homeDirPath(); 63 QString sfile=QDir::homeDirPath();
64 if(sfile.right(1) != "/") 64 if(sfile.right(1) != "/")
65 sfile+="/._temp"; 65 sfile+="/._temp";
66 else 66 else
67 sfile+="._temp"; 67 sfile+="._temp";
68 QFile file( sfile); 68 QFile file( sfile);
69 if(file.exists()) 69 if(file.exists())
70 file.remove(); 70 file.remove();
71} 71}
72 72
73void AdvancedFm::tabChanged(QWidget *) { 73void AdvancedFm::tabChanged(QWidget *) {
74// qWarning("tab changed"); 74// owarn << "tab changed" << oendl;
75 QString path = CurrentDir()->canonicalPath(); 75 QString path = CurrentDir()->canonicalPath();
76 currentPathCombo->lineEdit()->setText( path ); 76 currentPathCombo->lineEdit()->setText( path );
77 77
78 if(whichTab == 1) { 78 if(whichTab == 1) {
79 viewMenu->setItemChecked(viewMenu->idAt(0), true); 79 viewMenu->setItemChecked(viewMenu->idAt(0), true);
80 viewMenu->setItemChecked(viewMenu->idAt(1), false); 80 viewMenu->setItemChecked(viewMenu->idAt(1), false);
81 } else { 81 } else {
82 viewMenu->setItemChecked(viewMenu->idAt(0), false); 82 viewMenu->setItemChecked(viewMenu->idAt(0), false);
83 viewMenu->setItemChecked(viewMenu->idAt(1), true); 83 viewMenu->setItemChecked(viewMenu->idAt(1), true);
84 } 84 }
85 85
86 QString fs= getFileSystemType( (const QString &) path); 86 QString fs= getFileSystemType( (const QString &) path);
87 87
88 setCaption(tr("AdvancedFm :: ")+fs+" :: " 88 setCaption(tr("AdvancedFm :: ")+fs+" :: "
89 +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); 89 +checkDiskSpace( (const QString &) path )+ tr(" kB free") );
90 chdir( path.latin1()); 90 chdir( path.latin1());
91} 91}
92 92
93 93
94void AdvancedFm::populateView() { 94void AdvancedFm::populateView() {
95 95
96// qWarning("PopulateView"); 96// owarn << "PopulateView" << oendl;
97 QPixmap pm; 97 QPixmap pm;
98 QListView *thisView = CurrentView(); 98 QListView *thisView = CurrentView();
99 QDir *thisDir = CurrentDir(); 99 QDir *thisDir = CurrentDir();
100 QString path = thisDir->canonicalPath(); 100 QString path = thisDir->canonicalPath();
101 101
102//qWarning("path is "+path); 102//owarn << "path is "+path << oendl;
103 thisView->clear(); 103 thisView->clear();
104 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 104 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
105 thisDir->setMatchAllDirs(TRUE); 105 thisDir->setMatchAllDirs(TRUE);
106 thisDir->setNameFilter(filterStr); 106 thisDir->setNameFilter(filterStr);
107 QString fileL, fileS, fileDate; 107 QString fileL, fileS, fileDate;
108 QString fs= getFileSystemType((const QString &) path); 108 QString fs= getFileSystemType((const QString &) path);
109 setCaption(tr("AdvancedFm :: ")+fs+" :: " 109 setCaption(tr("AdvancedFm :: ")+fs+" :: "
110 +checkDiskSpace((const QString &) path)+ tr(" kB free") ); 110 +checkDiskSpace((const QString &) path)+ tr(" kB free") );
111 bool isDir=FALSE; 111 bool isDir=FALSE;
112 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 112 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
113 QFileInfoListIterator it(*list); 113 QFileInfoListIterator it(*list);
114 QFileInfo *fi; 114 QFileInfo *fi;
@@ -151,87 +151,87 @@ void AdvancedFm::populateView() {
151 } 151 }
152 else if( !fi->isReadable() ) { 152 else if( !fi->isReadable() ) {
153 pm = Resource::loadPixmap( "locked" ); 153 pm = Resource::loadPixmap( "locked" );
154 } 154 }
155 else { //everything else goes by mimetype 155 else { //everything else goes by mimetype
156 MimeType mt(fi->filePath()); 156 MimeType mt(fi->filePath());
157 pm=mt.pixmap(); //sets the correct pixmap for mimetype 157 pm=mt.pixmap(); //sets the correct pixmap for mimetype
158 if(pm.isNull()) { 158 if(pm.isNull()) {
159 pm = unknownXpm; 159 pm = unknownXpm;
160 } 160 }
161 } 161 }
162 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { 162 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
163 // qDebug(" overlay link image"); 163 // odebug << " overlay link image" << oendl;
164 pm= Resource::loadPixmap( "advancedfm/symlink" ); 164 pm= Resource::loadPixmap( "advancedfm/symlink" );
165 // pm= Resource::loadPixmap( "folder" ); 165 // pm= Resource::loadPixmap( "folder" );
166// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 166// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
167// QPainter painter( &pm ); 167// QPainter painter( &pm );
168// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 168// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
169// pm.setMask( pm.createHeuristicMask( FALSE ) ); 169// pm.setMask( pm.createHeuristicMask( FALSE ) );
170 } 170 }
171 item->setPixmap( 0,pm); 171 item->setPixmap( 0,pm);
172 172
173 } 173 }
174 isDir=FALSE; 174 isDir=FALSE;
175 ++it; 175 ++it;
176 } 176 }
177 177
178 if( path.find("dev",0,TRUE) != -1) { 178 if( path.find("dev",0,TRUE) != -1) {
179 struct stat buf; 179 struct stat buf;
180 dev_t devT; 180 dev_t devT;
181 DIR *dir; 181 DIR *dir;
182 struct dirent *mydirent; 182 struct dirent *mydirent;
183 183
184 if((dir = opendir( path.latin1())) != NULL) 184 if((dir = opendir( path.latin1())) != NULL)
185 while ((mydirent = readdir(dir)) != NULL) { 185 while ((mydirent = readdir(dir)) != NULL) {
186 lstat( mydirent->d_name, &buf); 186 lstat( mydirent->d_name, &buf);
187// qDebug(mydirent->d_name); 187// odebug << mydirent->d_name << oendl;
188 fileL.sprintf("%s", mydirent->d_name); 188 fileL.sprintf("%s", mydirent->d_name);
189 devT = buf.st_dev; 189 devT = buf.st_dev;
190 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 190 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
191 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 191 fileDate.sprintf("%s", ctime( &buf.st_mtime));
192 if( fileL.find(".") == -1 ) { 192 if( fileL.find(".") == -1 ) {
193 item= new QListViewItem( thisView, fileL, fileS, fileDate); 193 item= new QListViewItem( thisView, fileL, fileS, fileDate);
194 pm = unknownXpm; 194 pm = unknownXpm;
195 item->setPixmap( 0,pm); 195 item->setPixmap( 0,pm);
196 } 196 }
197 } 197 }
198 198
199 closedir(dir); 199 closedir(dir);
200 } 200 }
201 201
202 thisView->setSorting( 3,FALSE); 202 thisView->setSorting( 3,FALSE);
203 fillCombo( (const QString &) path ); 203 fillCombo( (const QString &) path );
204} 204}
205 205
206void AdvancedFm::rePopulate() { 206void AdvancedFm::rePopulate() {
207 populateView(); 207 populateView();
208 setOtherTabCurrent(); 208 setOtherTabCurrent();
209 populateView(); 209 populateView();
210 210
211// int tmpTab = whichTab; 211// int tmpTab = whichTab;
212// // qDebug("%d", tmpTab); 212// // odebug << "" << tmpTab << "" << oendl;
213 213
214// for(int i =1; i < 3; i++) { 214// for(int i =1; i < 3; i++) {
215// TabWidget->setCurrentWidget(i - 1); 215// TabWidget->setCurrentWidget(i - 1);
216// populateView(); 216// populateView();
217// } 217// }
218// TabWidget->setCurrentWidget( tmpTab - 1); 218// TabWidget->setCurrentWidget( tmpTab - 1);
219} 219}
220 220
221void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 221void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
222//qWarning("listclicked"); 222//owarn << "listclicked" << oendl;
223 if(selectedItem) { 223 if(selectedItem) {
224 QString strItem=selectedItem->text(0); 224 QString strItem=selectedItem->text(0);
225// qWarning(strItem); 225// owarn << strItem << oendl;
226 QString strSize=selectedItem->text(1); 226 QString strSize=selectedItem->text(1);
227 strSize=strSize.stripWhiteSpace(); 227 strSize=strSize.stripWhiteSpace();
228 bool isDirectory = false; 228 bool isDirectory = false;
229 QString strItem2; 229 QString strItem2;
230 230
231 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink 231 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
232 strItem2 = dealWithSymName((const QString&)strItem); 232 strItem2 = dealWithSymName((const QString&)strItem);
233 if(QDir(strItem2).exists() ) 233 if(QDir(strItem2).exists() )
234 strItem = strItem2; 234 strItem = strItem2;
235 } 235 }
236 236
237 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 237 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
@@ -258,31 +258,31 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in
258 cancelRename(); 258 cancelRename();
259 } 259 }
260 } 260 }
261 break; 261 break;
262 case 2: 262 case 2:
263 menuTimer.start( 500, TRUE ); 263 menuTimer.start( 500, TRUE );
264 break; 264 break;
265 }; 265 };
266} 266}
267 267
268 268
269void AdvancedFm::switchToLocalTab() { 269void AdvancedFm::switchToLocalTab() {
270//qWarning("switch to local view"); 270//owarn << "switch to local view" << oendl;
271 TabWidget->setCurrentWidget(0); 271 TabWidget->setCurrentWidget(0);
272 Local_View->setFocus(); 272 Local_View->setFocus();
273} 273}
274 274
275void AdvancedFm::switchToRemoteTab() { 275void AdvancedFm::switchToRemoteTab() {
276//qWarning("switch to local view"); 276//owarn << "switch to local view" << oendl;
277 TabWidget->setCurrentWidget(1); 277 TabWidget->setCurrentWidget(1);
278 Remote_View->setFocus(); 278 Remote_View->setFocus();
279} 279}
280 280
281void AdvancedFm::readConfig() { 281void AdvancedFm::readConfig() {
282 Config cfg("AdvancedFm"); 282 Config cfg("AdvancedFm");
283} 283}
284 284
285void AdvancedFm::writeConfig() { 285void AdvancedFm::writeConfig() {
286 Config cfg("AdvancedFm"); 286 Config cfg("AdvancedFm");
287} 287}
288 288
@@ -320,25 +320,25 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
320 populateView(); 320 populateView();
321 update(); 321 update();
322} 322}
323 323
324QStringList AdvancedFm::getPath() { 324QStringList AdvancedFm::getPath() {
325 QStringList strList; 325 QStringList strList;
326 QListView *thisView=CurrentView(); 326 QListView *thisView=CurrentView();
327 QList<QListViewItem> * getSelectedItems( QListView * thisView ); 327 QList<QListViewItem> * getSelectedItems( QListView * thisView );
328 QListViewItemIterator it( thisView ); 328 QListViewItemIterator it( thisView );
329 for ( ; it.current(); ++it ) { 329 for ( ; it.current(); ++it ) {
330 if ( it.current()->isSelected() ) { 330 if ( it.current()->isSelected() ) {
331 strList << it.current()->text(0); 331 strList << it.current()->text(0);
332// qDebug(it.current()->text(0)); 332// odebug << it.current()->text(0) << oendl;
333 } 333 }
334 } 334 }
335 return strList; 335 return strList;
336} 336}
337 337
338void AdvancedFm::homeButtonPushed() { 338void AdvancedFm::homeButtonPushed() {
339 QString current = QDir::homeDirPath(); 339 QString current = QDir::homeDirPath();
340 chdir( current.latin1() ); 340 chdir( current.latin1() );
341 CurrentDir()->cd( current, TRUE); 341 CurrentDir()->cd( current, TRUE);
342 populateView(); 342 populateView();
343 update(); 343 update();
344} 344}
@@ -371,25 +371,25 @@ void AdvancedFm::CFButtonPushed() {
371 update(); 371 update();
372} 372}
373 373
374 374
375void AdvancedFm::doAbout() { 375void AdvancedFm::doAbout() {
376 QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" 376 QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n"
377 "is copyright 2002-2003 by\n" 377 "is copyright 2002-2003 by\n"
378 "L.J.Potter<llornkcor@handhelds.org>\n" 378 "L.J.Potter<llornkcor@handhelds.org>\n"
379 "and is licensed by the GPL")); 379 "and is licensed by the GPL"));
380} 380}
381 381
382void AdvancedFm::keyPressEvent( QKeyEvent *e) { 382void AdvancedFm::keyPressEvent( QKeyEvent *e) {
383// qWarning("key %d", e->key()); 383// owarn << "key " << e->key() << "" << oendl;
384// if( CurrentView()->hasFocus() ) 384// if( CurrentView()->hasFocus() )
385 { 385 {
386 switch ( e->key() ) { 386 switch ( e->key() ) {
387 case Key_Left: 387 case Key_Left:
388 upDir(); 388 upDir();
389 break; 389 break;
390 case Key_Next: 390 case Key_Next:
391 break; 391 break;
392 case Key_Return: 392 case Key_Return:
393 case Key_Enter: 393 case Key_Enter:
394 navigateToSelected(); 394 navigateToSelected();
395 break; 395 break;
@@ -629,25 +629,25 @@ QString AdvancedFm::checkDiskSpace(const QString &path) {
629 } 629 }
630 return ""; 630 return "";
631} 631}
632 632
633void AdvancedFm::addToDocs() { 633void AdvancedFm::addToDocs() {
634 QStringList strListPaths = getPath(); 634 QStringList strListPaths = getPath();
635 QDir *thisDir = CurrentDir(); 635 QDir *thisDir = CurrentDir();
636 636
637 if( strListPaths.count() > 0) { 637 if( strListPaths.count() > 0) {
638 QString curFile; 638 QString curFile;
639 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 639 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
640 curFile = thisDir->canonicalPath()+"/"+(*it); 640 curFile = thisDir->canonicalPath()+"/"+(*it);
641// qDebug(curFile); 641// odebug << curFile << oendl;
642 QFileInfo fi(curFile); 642 QFileInfo fi(curFile);
643 DocLnk f; 643 DocLnk f;
644// curFile.replace(QRegExp("\\..*"),""); 644// curFile.replace(QRegExp("\\..*"),"");
645 f.setName(fi.baseName() ); 645 f.setName(fi.baseName() );
646 f.setFile( curFile); 646 f.setFile( curFile);
647 f.writeLink(); 647 f.writeLink();
648 } 648 }
649 } 649 }
650} 650}
651 651
652 652
653void AdvancedFm::customDirsToMenu() { 653void AdvancedFm::customDirsToMenu() {
@@ -702,25 +702,25 @@ void AdvancedFm::addCustomDir() {
702 } 702 }
703 if(addIt) { 703 if(addIt) {
704 menuButton->insertItem(dir); 704 menuButton->insertItem(dir);
705// customDirMenu->insertItem(dir); 705// customDirMenu->insertItem(dir);
706 list << dir; 706 list << dir;
707 } 707 }
708 708
709 cfg.writeEntry("CustomDir", list, ','); 709 cfg.writeEntry("CustomDir", list, ',');
710 cfg.write(); 710 cfg.write();
711} 711}
712 712
713void AdvancedFm::removeCustomDir() { 713void AdvancedFm::removeCustomDir() {
714// qDebug("remove custom dir"); 714// odebug << "remove custom dir" << oendl;
715 Config cfg("AdvancedFm"); 715 Config cfg("AdvancedFm");
716 cfg.setGroup("Menu"); 716 cfg.setGroup("Menu");
717 QString dir; 717 QString dir;
718 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); 718 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)',');
719 QStringList list2; 719 QStringList list2;
720 dir = CurrentDir()->canonicalPath(); 720 dir = CurrentDir()->canonicalPath();
721 int ramble=2; 721 int ramble=2;
722// int ramble=-24; 722// int ramble=-24;
723//first remove list 723//first remove list
724 if(list.grep(dir,true).isEmpty()) { 724 if(list.grep(dir,true).isEmpty()) {
725 QMessageBox::message(tr( "AdvancedFm" ), 725 QMessageBox::message(tr( "AdvancedFm" ),
726 tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); 726 tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!"));
@@ -737,25 +737,25 @@ void AdvancedFm::removeCustomDir() {
737 ramble++; 737 ramble++;
738// ramble--; 738// ramble--;
739 } 739 }
740 740
741 cfg.writeEntry("CustomDir", list2, ','); 741 cfg.writeEntry("CustomDir", list2, ',');
742 cfg.write(); 742 cfg.write();
743 } 743 }
744// customDirsToMenu(); 744// customDirsToMenu();
745 745
746} 746}
747 747
748void AdvancedFm::gotoCustomDir(const QString &dir) { 748void AdvancedFm::gotoCustomDir(const QString &dir) {
749// qDebug("gotoCustomDir(const QString &dir) " +dir ); 749// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl;
750// QString curDir = dir; 750// QString curDir = dir;
751// QDir *thisDir = CurrentDir(); 751// QDir *thisDir = CurrentDir();
752// if( curDir.isEmpty()) { 752// if( curDir.isEmpty()) {
753// } 753// }
754 if( dir == s_addBookmark) { 754 if( dir == s_addBookmark) {
755 addCustomDir(); 755 addCustomDir();
756 } 756 }
757 if( dir == s_removeBookmark) { 757 if( dir == s_removeBookmark) {
758 removeCustomDir( ); 758 removeCustomDir( );
759 } else { 759 } else {
760 gotoDirectory( dir); 760 gotoDirectory( dir);
761// if(QDir( curDir).exists() ) 761// if(QDir( curDir).exists() )
@@ -778,68 +778,68 @@ QDir *AdvancedFm::CurrentDir() {
778} 778}
779 779
780QDir *AdvancedFm::OtherDir() { 780QDir *AdvancedFm::OtherDir() {
781 if ( whichTab == 1) { 781 if ( whichTab == 1) {
782 return &currentRemoteDir; 782 return &currentRemoteDir;
783 } else { 783 } else {
784 return &currentDir; 784 return &currentDir;
785 } 785 }
786} 786}
787 787
788QListView * AdvancedFm::CurrentView() { 788QListView * AdvancedFm::CurrentView() {
789 if ( whichTab == 1) { 789 if ( whichTab == 1) {
790// qWarning("CurrentView Tab 1"); 790// owarn << "CurrentView Tab 1" << oendl;
791 return Local_View; 791 return Local_View;
792 } else { 792 } else {
793// qWarning("CurrentView Tab 2"); 793// owarn << "CurrentView Tab 2" << oendl;
794 return Remote_View; 794 return Remote_View;
795 } 795 }
796} 796}
797 797
798QListView * AdvancedFm::OtherView() { 798QListView * AdvancedFm::OtherView() {
799 if ( whichTab == 1) 799 if ( whichTab == 1)
800 return Remote_View; 800 return Remote_View;
801 else 801 else
802 return Local_View; 802 return Local_View;
803} 803}
804 804
805void AdvancedFm::setOtherTabCurrent() { 805void AdvancedFm::setOtherTabCurrent() {
806// qWarning("setOtherTabCurrent() %d", whichTab); 806// owarn << "setOtherTabCurrent() " << whichTab << "" << oendl;
807 if ( whichTab == 1) { 807 if ( whichTab == 1) {
808 TabWidget->setCurrentWidget(1); 808 TabWidget->setCurrentWidget(1);
809 } else { 809 } else {
810 TabWidget->setCurrentWidget(0); 810 TabWidget->setCurrentWidget(0);
811 } 811 }
812 OtherView()->setFocus(); 812 OtherView()->setFocus();
813 OtherView()->setSelected( CurrentView()->firstChild(), true); 813 OtherView()->setSelected( CurrentView()->firstChild(), true);
814} 814}
815 815
816void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 816void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
817// qDebug("qcop message "+msg ); 817// odebug << "qcop message "+msg << oendl;
818 QDataStream stream ( data, IO_ReadOnly ); 818 QDataStream stream ( data, IO_ReadOnly );
819 if ( msg == "openDirectory(QString)" ) { 819 if ( msg == "openDirectory(QString)" ) {
820// qDebug("received"); 820// odebug << "received" << oendl;
821 QString file; 821 QString file;
822 stream >> file; 822 stream >> file;
823 gotoDirectory( (const QString &) file); 823 gotoDirectory( (const QString &) file);
824 } 824 }
825} 825}
826 826
827void AdvancedFm::setDocument(const QString &file) { 827void AdvancedFm::setDocument(const QString &file) {
828 gotoDirectory( file); 828 gotoDirectory( file);
829 829
830} 830}
831 831
832void AdvancedFm::gotoDirectory(const QString &file) { 832void AdvancedFm::gotoDirectory(const QString &file) {
833// qWarning("goto dir "+file); 833// owarn << "goto dir "+file << oendl;
834 QString curDir = file; 834 QString curDir = file;
835 QDir *thisDir = CurrentDir(); 835 QDir *thisDir = CurrentDir();
836 if(QDir( curDir).exists() ) { 836 if(QDir( curDir).exists() ) {
837 thisDir->setPath( curDir ); 837 thisDir->setPath( curDir );
838 chdir( curDir.latin1() ); 838 chdir( curDir.latin1() );
839 thisDir->cd( curDir, TRUE); 839 thisDir->cd( curDir, TRUE);
840 populateView(); 840 populateView();
841 } 841 }
842 else if(QFileInfo(curDir).exists()) { 842 else if(QFileInfo(curDir).exists()) {
843 QFileInfo fileInfo(curDir); 843 QFileInfo fileInfo(curDir);
844 curDir=fileInfo.dirPath(); 844 curDir=fileInfo.dirPath();
845 if(QDir( curDir).exists() ) { 845 if(QDir( curDir).exists() ) {
@@ -857,25 +857,25 @@ void AdvancedFm::findFile(const QString &fileName) {
857 QFileInfo fi(fileName); 857 QFileInfo fi(fileName);
858 QListView *thisView = CurrentView(); 858 QListView *thisView = CurrentView();
859 QListViewItemIterator it( thisView ); 859 QListViewItemIterator it( thisView );
860 for ( ; it.current(); ++it ) { 860 for ( ; it.current(); ++it ) {
861 if(it.current()->text(0) == fi.fileName()) { 861 if(it.current()->text(0) == fi.fileName()) {
862 it.current()->setSelected(true); 862 it.current()->setSelected(true);
863 thisView->ensureItemVisible(it.current()); 863 thisView->ensureItemVisible(it.current());
864 } 864 }
865 } 865 }
866} 866}
867 867
868void AdvancedFm::slotSwitchMenu(int ) { 868void AdvancedFm::slotSwitchMenu(int ) {
869// qDebug("Switch %d", item); 869// odebug << "Switch " << item << "" << oendl;
870 // viewMenu->setItemChecked(item, true); 870 // viewMenu->setItemChecked(item, true);
871} 871}
872 872
873void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) { 873void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) {
874 tabChanged( w); 874 tabChanged( w);
875 if( w == Local_View) { 875 if( w == Local_View) {
876 Remote_View->clearFocus(); 876 Remote_View->clearFocus();
877 } else { 877 } else {
878 Local_View->clearFocus(); 878 Local_View->clearFocus();
879 } 879 }
880} 880}
881 881
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro
index 716343d..f1c518e 100644
--- a/noncore/apps/advancedfm/advancedfm.pro
+++ b/noncore/apps/advancedfm/advancedfm.pro
@@ -1,35 +1,15 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qt warn_on quick-app 2CONFIG += qt warn_on quick-app
3# CONFIG += qt warn_on
4HEADERS = advancedfm.h filePermissions.h output.h 3HEADERS = advancedfm.h filePermissions.h output.h
5SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp 4SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp
6TARGET = advancedfm 5TARGET = advancedfm
7INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 7DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lopiecore2 -lopieui2 8LIBS += -lqpe -lopiecore2 -lopieui2
10
11TRANSLATIONS = ../../../i18n/de/advancedfm.ts \
12 ../../../i18n/nl/advancedfm.ts \
13 ../../../i18n/da/advancedfm.ts \
14 ../../../i18n/xx/advancedfm.ts \
15 ../../../i18n/en/advancedfm.ts \
16 ../../../i18n/es/advancedfm.ts \
17 ../../../i18n/fr/advancedfm.ts \
18 ../../../i18n/hu/advancedfm.ts \
19 ../../../i18n/ja/advancedfm.ts \
20 ../../../i18n/ko/advancedfm.ts \
21 ../../../i18n/no/advancedfm.ts \
22 ../../../i18n/pl/advancedfm.ts \
23 ../../../i18n/pt/advancedfm.ts \
24 ../../../i18n/pt_BR/advancedfm.ts \
25 ../../../i18n/sl/advancedfm.ts \
26 ../../../i18n/zh_CN/advancedfm.ts \
27 ../../../i18n/zh_TW/advancedfm.ts
28
29 9
30!contains(CONFIG,quick-app) { 10!contains(CONFIG,quick-app) {
31 DESTDIR = $(OPIEDIR)/bin 11 DESTDIR = $(OPIEDIR)/bin
32 DEFINES += NOQUICKLAUNCH 12 DEFINES += NOQUICKLAUNCH
33} 13}
34 14
35include ( $(OPIEDIR)/include.pro ) 15include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 2997c55..29335f8 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -2,41 +2,45 @@
2 advancedfmData.cpp 2 advancedfmData.cpp
3 ------------------- 3 -------------------
4** Created: Mon 09-23-2002 13:24:11 4** Created: Mon 09-23-2002 13:24:11
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#include "advancedfm.h" 12#include "advancedfm.h"
13 13
14/* OPIE */
15#include <opie2/odebug.h>
14#include <qpe/storage.h> 16#include <qpe/storage.h>
15#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
16#include <qpe/resource.h> 18#include <qpe/resource.h>
17#include <qpe/menubutton.h> 19#include <qpe/menubutton.h>
20using namespace Opie::Core;
21using namespace Opie::Ui;
18 22
23/* QT */
19#include <qlayout.h> 24#include <qlayout.h>
20#include <qhbox.h> 25#include <qhbox.h>
21#include <qmenubar.h> 26#include <qmenubar.h>
22#include <qcombobox.h> 27#include <qcombobox.h>
23#include <qtoolbutton.h> 28#include <qtoolbutton.h>
24#include <qlineedit.h> 29#include <qlineedit.h>
25#include <qlistview.h> 30#include <qlistview.h>
26 31
32/* STD */
27#include <sys/utsname.h> 33#include <sys/utsname.h>
28 34
29
30using namespace Opie::Ui;
31void AdvancedFm::init() { 35void AdvancedFm::init() {
32 b = false; 36 b = false;
33 setCaption( tr( "AdvancedFm" ) ); 37 setCaption( tr( "AdvancedFm" ) );
34 38
35 QVBoxLayout *layout = new QVBoxLayout( this ); 39 QVBoxLayout *layout = new QVBoxLayout( this );
36 layout->setSpacing( 2); 40 layout->setSpacing( 2);
37 layout->setMargin( 0); // squeeze 41 layout->setMargin( 0); // squeeze
38 42
39 QMenuBar *menuBar = new QMenuBar(this); 43 QMenuBar *menuBar = new QMenuBar(this);
40 menuBar->setMargin( 0 ); // squeeze 44 menuBar->setMargin( 0 ); // squeeze
41 fileMenu = new QPopupMenu( this ); 45 fileMenu = new QPopupMenu( this );
42 viewMenu = new QPopupMenu( this ); 46 viewMenu = new QPopupMenu( this );
@@ -210,29 +214,29 @@ void AdvancedFm::init() {
210 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 214 TabWidget->insertTab( tab_3, tr( "Remote" ) );
211 */ 215 */
212 216
213 /////////////// 217 ///////////////
214 218
215 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 219 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
216 zaurusDevice=TRUE; 220 zaurusDevice=TRUE;
217 else 221 else
218 zaurusDevice=FALSE; 222 zaurusDevice=FALSE;
219 223
220 224
221 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { 225 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) {
222 qDebug("not have sd"); 226 odebug << "not have sd" << oendl;
223 sdButton->hide(); 227 sdButton->hide();
224 } 228 }
225 if( !StorageInfo::hasCf() ) { 229 if( !StorageInfo::hasCf() ) {
226 qDebug("not have cf"); 230 odebug << "not have cf" << oendl;
227 cfButton->hide(); 231 cfButton->hide();
228 } 232 }
229 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 233 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
230 currentDir.setPath( QDir::currentDirPath()); 234 currentDir.setPath( QDir::currentDirPath());
231 235
232 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 236 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
233 currentRemoteDir.setPath( QDir::currentDirPath()); 237 currentRemoteDir.setPath( QDir::currentDirPath());
234 238
235 // b = TRUE; 239 // b = TRUE;
236 240
237 filterStr="*"; 241 filterStr="*";
238 showMenuHidden(); 242 showMenuHidden();
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 81a4318..d34f330 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,839 +1,842 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#include "advancedfm.h" 12
13#include "output.h" 13#include "advancedfm.h"
14#include "filePermissions.h" 14#include "output.h"
15 15#include "filePermissions.h"
16#include <qpe/lnkproperties.h> 16
17#include <qpe/qpeapplication.h> 17/* OPIE */
18#include <qpe/applnk.h> 18#include <opie2/odebug.h>
19 19#include <qpe/lnkproperties.h>
20#include <qmessagebox.h> 20#include <qpe/qpeapplication.h>
21 21#include <qpe/applnk.h>
22 22using namespace Opie::Core;
23#include <qpopupmenu.h> 23
24#include <qlistview.h> 24/* QT*/
25 25
26#include <errno.h> 26#include <qmessagebox.h>
27#include <stdlib.h> 27#include <qpopupmenu.h>
28#include <unistd.h> 28#include <qlistview.h>
29#include <sys/stat.h> 29
30#include <dirent.h> 30/* STD */
31#include <sys/sendfile.h> 31
32#include <fcntl.h> 32#include <errno.h>
33 33#include <stdlib.h>
34 34#include <unistd.h>
35using namespace Opie::Core; 35#include <sys/stat.h>
36using namespace Opie::Core; 36#include <dirent.h>
37void AdvancedFm::doDirChange() { 37#include <sys/sendfile.h>
38 QString pathItem = CurrentView()->currentItem()->text(0); 38#include <fcntl.h>
39 if( pathItem == "../") { 39
40 ListClicked( CurrentView()->currentItem()); 40void AdvancedFm::doDirChange() {
41 } else { 41 QString pathItem = CurrentView()->currentItem()->text(0);
42 if( pathItem.find(" -> ",0,TRUE) != -1) 42 if( pathItem == "../") {
43 pathItem = dealWithSymName((const QString&)pathItem)+"/"; 43 ListClicked( CurrentView()->currentItem());
44// qWarning(pathItem); 44 } else {
45 gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); 45 if( pathItem.find(" -> ",0,TRUE) != -1)
46 } 46 pathItem = dealWithSymName((const QString&)pathItem)+"/";
47} 47// owarn << pathItem << oendl;
48 48 gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
49void AdvancedFm::showMenuHidden() { 49 }
50 if (b) { 50}
51 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 51
52 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 52void AdvancedFm::showMenuHidden() {
53 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 53 if (b) {
54 } else { 54 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
55 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 55 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
56 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 56 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
57 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 57 } else {
58 } 58 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
59 b = !b; 59 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
60 populateView(); 60 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
61} 61 }
62 62 b = !b;
63void AdvancedFm::showHidden() { 63 populateView();
64 if (b) { 64}
65 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 65
66 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 66void AdvancedFm::showHidden() {
67 } else { 67 if (b) {
68 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 68 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
69 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 69 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
70 } 70 } else {
71 populateView(); 71 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
72} 72 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
73 73 }
74QString AdvancedFm::dealWithSymName(const QString &fileName) { 74 populateView();
75 QString strItem = fileName; 75}
76 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 76
77} 77QString AdvancedFm::dealWithSymName(const QString &fileName) {
78 78 QString strItem = fileName;
79void AdvancedFm::runThis() { 79 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
80 if( !CurrentView()->currentItem()) return; 80}
81 QString fs; 81
82 QDir *thisDir = CurrentDir(); 82void AdvancedFm::runThis() {
83 83 if( !CurrentView()->currentItem()) return;
84 QString curFile = CurrentView()->currentItem()->text(0); 84 QString fs;
85 QString path = thisDir->canonicalPath(); 85 QDir *thisDir = CurrentDir();
86 86
87 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 87 QString curFile = CurrentView()->currentItem()->text(0);
88 88 QString path = thisDir->canonicalPath();
89 curFile = dealWithSymName((const QString&)curFile); 89
90 90 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
91 if(curFile != "../") { 91
92 92 curFile = dealWithSymName((const QString&)curFile);
93 fs = getFileSystemType((const QString &) path); 93
94 QFileInfo fileInfo( path + "/" + curFile); 94 if(curFile != "../") {
95// qDebug( fileInfo.owner()); 95
96 96 fs = getFileSystemType((const QString &) path);
97 if( (fileInfo.permission( QFileInfo::ExeUser) 97 QFileInfo fileInfo( path + "/" + curFile);
98 | fileInfo.permission( QFileInfo::ExeGroup) 98// odebug << fileInfo.owner() << oendl;
99 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 99
100 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 100 if( (fileInfo.permission( QFileInfo::ExeUser)
101 QCopEnvelope e("QPE/System", "execute(QString)" ); 101 | fileInfo.permission( QFileInfo::ExeGroup)
102 e << curFile; 102 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
103 } else { 103 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
104 curFile = path + "/" + curFile; 104 QCopEnvelope e("QPE/System", "execute(QString)" );
105 DocLnk nf(curFile); 105 e << curFile;
106 QString execStr = nf.exec(); 106 } else {
107// qDebug( execStr); 107 curFile = path + "/" + curFile;
108 if( execStr.isEmpty() ) { 108 DocLnk nf(curFile);
109 } else { 109 QString execStr = nf.exec();
110 nf.execute(); 110// odebug << execStr << oendl;
111 } 111 if( execStr.isEmpty() ) {
112 } 112 } else {
113 } 113 nf.execute();
114} 114 }
115 115 }
116void AdvancedFm::runText() { 116 }
117 if( !CurrentView()->currentItem()) return; 117}
118 QString curFile = CurrentView()->currentItem()->text(0); 118
119 if(curFile != "../") { 119void AdvancedFm::runText() {
120 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 120 if( !CurrentView()->currentItem()) return;
121 curFile = dealWithSymName((const QString&)curFile); 121 QString curFile = CurrentView()->currentItem()->text(0);
122 curFile = CurrentDir()->canonicalPath()+"/"+curFile; 122 if(curFile != "../") {
123 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 123 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
124 e << curFile; 124 curFile = dealWithSymName((const QString&)curFile);
125 } 125 curFile = CurrentDir()->canonicalPath()+"/"+curFile;
126} 126 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
127 127 e << curFile;
128void AdvancedFm::makeDir() { 128 }
129 InputDialog *fileDlg; 129}
130 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 130
131 fileDlg->exec(); 131void AdvancedFm::makeDir() {
132 if( fileDlg->result() == 1 ) { 132 InputDialog *fileDlg;
133 QDir *thisDir = CurrentDir(); 133 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
134 QString filename = fileDlg->LineEdit1->text(); 134 fileDlg->exec();
135 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); 135 if( fileDlg->result() == 1 ) {
136 } 136 QDir *thisDir = CurrentDir();
137 populateView(); 137 QString filename = fileDlg->LineEdit1->text();
138} 138 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename);
139 139 }
140void AdvancedFm::doDelete() { 140 populateView();
141 QStringList curFileList = getPath(); 141}
142 bool doMsg=true; 142
143 int count = curFileList.count(); 143void AdvancedFm::doDelete() {
144 if( count > 0) { 144 QStringList curFileList = getPath();
145 if(count > 1 ) { 145 bool doMsg=true;
146 QString msg; 146 int count = curFileList.count();
147 msg=tr("Really delete\n%1 files?").arg(count); 147 if( count > 0) {
148 switch ( QMessageBox::warning(this,tr("Delete"),msg 148 if(count > 1 ) {
149 ,tr("Yes"),tr("No"),0,0,1) ) 149 QString msg;
150 { 150 msg=tr("Really delete\n%1 files?").arg(count);
151 case 0: 151 switch ( QMessageBox::warning(this,tr("Delete"),msg
152 doMsg=false; 152 ,tr("Yes"),tr("No"),0,0,1) )
153 break; 153 {
154 case 1: 154 case 0:
155 return; 155 doMsg=false;
156 break; 156 break;
157 }; 157 case 1:
158 } 158 return;
159 159 break;
160 QString myFile; 160 };
161 161 }
162 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 162
163 myFile = (*it); 163 QString myFile;
164 if( myFile.find(" -> ",0,TRUE) != -1) 164
165 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 165 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
166 166 myFile = (*it);
167 QString f = CurrentDir()->canonicalPath(); 167 if( myFile.find(" -> ",0,TRUE) != -1)
168 if(f.right(1).find("/",0,TRUE) == -1) 168 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
169 f += "/"; 169
170 f += myFile; 170 QString f = CurrentDir()->canonicalPath();
171 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 171 if(f.right(1).find("/",0,TRUE) == -1)
172 //if file is a directory 172 f += "/";
173 173 f += myFile;
174 switch ( QMessageBox::warning( this, tr("Delete Directory?"), 174 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
175 tr("Really delete %1\nand all it's contents ?" ).arg( f ) , 175 //if file is a directory
176 tr("Yes"), tr("No"), 0, 0, 1) ) { 176
177 case 0: 177 switch ( QMessageBox::warning( this, tr("Delete Directory?"),
178 { 178 tr("Really delete %1\nand all it's contents ?" ).arg( f ) ,
179 f=f.left(f.length()-1); 179 tr("Yes"), tr("No"), 0, 0, 1) ) {
180 QString cmd="rm -rf "+f; 180 case 0:
181 startProcess( (const QString)cmd.latin1() ); 181 {
182 populateView(); 182 f=f.left(f.length()-1);
183 } 183 QString cmd="rm -rf "+f;
184 break; 184 startProcess( (const QString)cmd.latin1() );
185 case 1: 185 populateView();
186 // exit 186 }
187 break; 187 break;
188 }; 188 case 1:
189 189 // exit
190 } else { 190 break;
191 if(doMsg) { 191 };
192 switch ( QMessageBox::warning(this,tr("Delete"), 192
193 tr("Really delete\n%1?").arg( myFile ), 193 } else {
194 tr("Yes"), tr("No"), 0, 0, 1) ) { 194 if(doMsg) {
195 case 1: 195 switch ( QMessageBox::warning(this,tr("Delete"),
196 return; 196 tr("Really delete\n%1?").arg( myFile ),
197 break; 197 tr("Yes"), tr("No"), 0, 0, 1) ) {
198 }; 198 case 1:
199 } 199 return;
200 200 break;
201 QString cmd="rm "+f; 201 };
202 QFile file(f); 202 }
203 QFileInfo fi(myFile); 203
204 if( fi.fileName().find("../",0,TRUE)==-1) { 204 QString cmd="rm "+f;
205// qDebug("remove link files "+myFile); 205 QFile file(f);
206 206 QFileInfo fi(myFile);
207// DocLnk lnk(f); 207 if( fi.fileName().find("../",0,TRUE)==-1) {
208 DocLnk *lnk; 208// odebug << "remove link files "+myFile << oendl;
209 lnk = new DocLnk(f); 209
210// qDebug("Deleting doclnk " + lnk->linkFile()); 210// DocLnk lnk(f);
211 if(lnk->isValid()) 211 DocLnk *lnk;
212 lnk->removeLinkFile(); 212 lnk = new DocLnk(f);
213 // delete lnk; 213// odebug << "Deleting doclnk " + lnk->linkFile() << oendl;
214 file.remove(); 214 if(lnk->isValid())
215 } 215 lnk->removeLinkFile();
216 } 216 // delete lnk;
217 } 217 file.remove();
218 } 218 }
219 populateView(); 219 }
220} 220 }
221 221 }
222void AdvancedFm::filePerms() { 222 populateView();
223 QStringList curFileList = getPath(); 223}
224 QString filePath; 224
225 225void AdvancedFm::filePerms() {
226 filePath = CurrentDir()->canonicalPath()+"/"; 226 QStringList curFileList = getPath();
227 227 QString filePath;
228 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 228
229 filePermissions *filePerm; 229 filePath = CurrentDir()->canonicalPath()+"/";
230 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 230
231 QPEApplication::execDialog( filePerm ); 231 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
232 if( filePerm ) 232 filePermissions *filePerm;
233 delete filePerm; 233 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
234 } 234 QPEApplication::execDialog( filePerm );
235 populateView(); 235 if( filePerm )
236} 236 delete filePerm;
237 237 }
238void AdvancedFm::doProperties() { 238 populateView();
239#if defined(QT_QWS_OPIE) 239}
240 240
241 QStringList curFileList = getPath(); 241void AdvancedFm::doProperties() {
242 242#if defined(QT_QWS_OPIE)
243 QString filePath; 243
244 filePath = CurrentDir()->canonicalPath()+"/"; 244 QStringList curFileList = getPath();
245 245
246// qDebug("%d",curFileList.count()); 246 QString filePath;
247 247 filePath = CurrentDir()->canonicalPath()+"/";
248 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 248
249// qDebug((filePath+*it)); 249// odebug << "" << curFileList.count() << "" << oendl;
250 DocLnk lnk( (filePath+*it)); 250
251 LnkProperties prop( &lnk ); 251 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
252 QPEApplication::execDialog( &prop ); 252// odebug << (filePath+*it) << oendl;
253 } 253 DocLnk lnk( (filePath+*it));
254#endif 254 LnkProperties prop( &lnk );
255 255 QPEApplication::execDialog( &prop );
256} 256 }
257 257#endif
258void AdvancedFm::upDir() { 258
259 QDir *thisDir = CurrentDir(); 259}
260 QString current = thisDir->canonicalPath(); 260
261 QDir dir(current); 261void AdvancedFm::upDir() {
262 dir.cdUp(); 262 QDir *thisDir = CurrentDir();
263 current = dir.canonicalPath(); 263 QString current = thisDir->canonicalPath();
264 chdir( current.latin1() ); 264 QDir dir(current);
265 thisDir->cd( current, TRUE); 265 dir.cdUp();
266 266 current = dir.canonicalPath();
267 populateView(); 267 chdir( current.latin1() );
268 update(); 268 thisDir->cd( current, TRUE);
269} 269
270 270 populateView();
271void AdvancedFm::copy() { 271 update();
272 qApp->processEvents(); 272}
273 QStringList curFileList = getPath(); 273
274 274void AdvancedFm::copy() {
275 QDir *thisDir = CurrentDir(); 275 qApp->processEvents();
276 QDir *thatDir = OtherDir(); 276 QStringList curFileList = getPath();
277 277
278 bool doMsg=true; 278 QDir *thisDir = CurrentDir();
279 int count=curFileList.count(); 279 QDir *thatDir = OtherDir();
280 if( count > 0) { 280
281 if(count > 1 ){ 281 bool doMsg=true;
282 QString msg; 282 int count=curFileList.count();
283 msg=tr("Really copy\n%1 files?").arg(count); 283 if( count > 0) {
284 switch ( QMessageBox::warning(this,tr("Copy"),msg 284 if(count > 1 ){
285 ,tr("Yes"),tr("No"),0,0,1) ) 285 QString msg;
286 { 286 msg=tr("Really copy\n%1 files?").arg(count);
287 case 0: 287 switch ( QMessageBox::warning(this,tr("Copy"),msg
288 doMsg=false; 288 ,tr("Yes"),tr("No"),0,0,1) )
289 break; 289 {
290 case 1: 290 case 0:
291 return; 291 doMsg=false;
292 break; 292 break;
293 }; 293 case 1:
294 } 294 return;
295 295 break;
296 QString curFile, item, destFile; 296 };
297 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 297 }
298 item=(*it); 298
299 if(item.find("->",0,TRUE)) //symlink 299 QString curFile, item, destFile;
300 item = item.left(item.find("->",0,TRUE)); 300 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
301 301 item=(*it);
302 curFile = thisDir->canonicalPath()+"/"+ item; 302 if(item.find("->",0,TRUE)) //symlink
303 destFile = thatDir->canonicalPath()+"/"+ item; 303 item = item.left(item.find("->",0,TRUE));
304 304
305// qDebug("Destination file is "+destFile); 305 curFile = thisDir->canonicalPath()+"/"+ item;
306// qDebug("CurrentFile file is " + curFile); 306 destFile = thatDir->canonicalPath()+"/"+ item;
307 307
308 QFile f(destFile); 308// odebug << "Destination file is "+destFile << oendl;
309 if( f.exists()) { 309// odebug << "CurrentFile file is " + curFile << oendl;
310 if(doMsg) { 310
311 switch ( QMessageBox::warning(this,tr("File Exists!"), 311 QFile f(destFile);
312 tr("%1 exists. Ok to overwrite?").arg( item ), 312 if( f.exists()) {
313 tr("Yes"),tr("No"),0,0,1) ) { 313 if(doMsg) {
314 case 1: 314 switch ( QMessageBox::warning(this,tr("File Exists!"),
315 return; 315 tr("%1 exists. Ok to overwrite?").arg( item ),
316 break; 316 tr("Yes"),tr("No"),0,0,1) ) {
317 }; 317 case 1:
318 } 318 return;
319 f.remove(); 319 break;
320 } 320 };
321 321 }
322 if( !copyFile( curFile, destFile) ) { 322 f.remove();
323 QMessageBox::message("AdvancedFm", 323 }
324 tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); 324
325 return; 325 if( !copyFile( curFile, destFile) ) {
326 } 326 QMessageBox::message("AdvancedFm",
327 } 327 tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) );
328 setOtherTabCurrent(); 328 return;
329 rePopulate(); 329 }
330 } 330 }
331} 331 setOtherTabCurrent();
332 332 rePopulate();
333void AdvancedFm::copyAs() { 333 }
334 qApp->processEvents(); 334}
335 335
336 QStringList curFileList = getPath(); 336void AdvancedFm::copyAs() {
337 QString curFile, item; 337 qApp->processEvents();
338 InputDialog *fileDlg; 338
339 339 QStringList curFileList = getPath();
340 QDir *thisDir = CurrentDir(); 340 QString curFile, item;
341 QDir *thatDir = OtherDir(); 341 InputDialog *fileDlg;
342 342
343 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 343 QDir *thisDir = CurrentDir();
344 QString destFile; 344 QDir *thatDir = OtherDir();
345 item=(*it); 345
346 curFile = thisDir->canonicalPath()+"/"+(*it); 346 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
347 fileDlg = new InputDialog( this, tr("Copy "+curFile+" As"), TRUE, 0); 347 QString destFile;
348 348 item=(*it);
349 fileDlg->setInputText((const QString &) destFile ); 349 curFile = thisDir->canonicalPath()+"/"+(*it);
350 fileDlg->exec(); 350 fileDlg = new InputDialog( this, tr("Copy "+curFile+" As"), TRUE, 0);
351 351
352 if( fileDlg->result() == 1 ) { 352 fileDlg->setInputText((const QString &) destFile );
353 QString filename = fileDlg->LineEdit1->text(); 353 fileDlg->exec();
354 destFile = thatDir->canonicalPath()+"/"+filename; 354
355 355 if( fileDlg->result() == 1 ) {
356 QFile f( destFile); 356 QString filename = fileDlg->LineEdit1->text();
357 if( f.exists()) { 357 destFile = thatDir->canonicalPath()+"/"+filename;
358 switch (QMessageBox::warning(this,tr("File Exists!"), 358
359 item+tr("\nexists. Ok to overwrite?"), 359 QFile f( destFile);
360 tr("Yes"),tr("No"),0,0,1) ) { 360 if( f.exists()) {
361 case 0: 361 switch (QMessageBox::warning(this,tr("File Exists!"),
362 f.remove(); 362 item+tr("\nexists. Ok to overwrite?"),
363 break; 363 tr("Yes"),tr("No"),0,0,1) ) {
364 case 1: 364 case 0:
365 return; 365 f.remove();
366 break; 366 break;
367 }; 367 case 1:
368 } 368 return;
369 if( !copyFile( curFile, destFile) ) { 369 break;
370 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 370 };
371 +curFile +tr("to\n")+destFile); 371 }
372 return; 372 if( !copyFile( curFile, destFile) ) {
373 } 373 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
374 } 374 +curFile +tr("to\n")+destFile);
375 delete fileDlg; 375 return;
376 376 }
377 } 377 }
378 rePopulate(); 378 delete fileDlg;
379 setOtherTabCurrent(); 379
380} 380 }
381 381 rePopulate();
382void AdvancedFm::copySameDir() { 382 setOtherTabCurrent();
383 qApp->processEvents(); 383}
384 QStringList curFileList = getPath(); 384
385 QString curFile, item, destFile; 385void AdvancedFm::copySameDir() {
386 InputDialog *fileDlg; 386 qApp->processEvents();
387 387 QStringList curFileList = getPath();
388 QDir *thisDir = CurrentDir(); 388 QString curFile, item, destFile;
389 389 InputDialog *fileDlg;
390 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 390
391 item=(*it); 391 QDir *thisDir = CurrentDir();
392 curFile = thisDir->canonicalPath()+"/"+ item; 392
393 393 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
394 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); 394 item=(*it);
395 fileDlg->setInputText((const QString &) destFile ); 395 curFile = thisDir->canonicalPath()+"/"+ item;
396 fileDlg->exec(); 396
397 397 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
398 if( fileDlg->result() == 1 ) { 398 fileDlg->setInputText((const QString &) destFile );
399 399 fileDlg->exec();
400 QString filename = fileDlg->LineEdit1->text(); 400
401 destFile = thisDir->canonicalPath()+"/"+filename; 401 if( fileDlg->result() == 1 ) {
402 402
403 QFile f(destFile); 403 QString filename = fileDlg->LineEdit1->text();
404 if( f.exists()) { 404 destFile = thisDir->canonicalPath()+"/"+filename;
405 switch (QMessageBox::warning(this,tr("Delete"), 405
406 destFile+tr(" already exists.\nDo you really want to delete it?"), 406 QFile f(destFile);
407 tr("Yes"),tr("No"),0,0,1) ) { 407 if( f.exists()) {
408 case 0: 408 switch (QMessageBox::warning(this,tr("Delete"),
409 409 destFile+tr(" already exists.\nDo you really want to delete it?"),
410 f.remove(); 410 tr("Yes"),tr("No"),0,0,1) ) {
411 break; 411 case 0:
412 case 1: 412
413 return; 413 f.remove();
414 break; 414 break;
415 }; 415 case 1:
416 } 416 return;
417 if(!copyFile( curFile,destFile) ) { 417 break;
418 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 418 };
419 +curFile +tr("to\n")+destFile); 419 }
420 return; 420 if(!copyFile( curFile,destFile) ) {
421 } 421 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
422 422 +curFile +tr("to\n")+destFile);
423// qDebug("copy "+curFile+" as "+destFile); 423 return;
424 } 424 }
425 delete fileDlg; 425
426 } 426// odebug << "copy "+curFile+" as "+destFile << oendl;
427 rePopulate(); 427 }
428} 428 delete fileDlg;
429 429 }
430void AdvancedFm::move() { 430 rePopulate();
431 qApp->processEvents(); 431}
432 432
433 QStringList curFileList = getPath(); 433void AdvancedFm::move() {
434 if( curFileList.count() > 0) { 434 qApp->processEvents();
435 QString curFile, destFile, item; 435
436 436 QStringList curFileList = getPath();
437 QDir *thisDir = CurrentDir(); 437 if( curFileList.count() > 0) {
438 QDir *thatDir = OtherDir(); 438 QString curFile, destFile, item;
439 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 439
440 item=(*it); 440 QDir *thisDir = CurrentDir();
441 QString destFile = thatDir->canonicalPath(); 441 QDir *thatDir = OtherDir();
442 442 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
443 if(destFile.right(1).find("/",0,TRUE) == -1) 443 item=(*it);
444 destFile+="/"; 444 QString destFile = thatDir->canonicalPath();
445 destFile += item; 445
446// qDebug("Destination file is "+destFile); 446 if(destFile.right(1).find("/",0,TRUE) == -1)
447 447 destFile+="/";
448 curFile = thisDir->canonicalPath(); 448 destFile += item;
449 if(curFile.right(1).find("/",0,TRUE) == -1) 449// odebug << "Destination file is "+destFile << oendl;
450 curFile +="/"; 450
451 curFile+= item; 451 curFile = thisDir->canonicalPath();
452// qDebug("CurrentFile file is " + curFile); 452 if(curFile.right(1).find("/",0,TRUE) == -1)
453 453 curFile +="/";
454 if(QFileInfo(curFile).isDir()) { 454 curFile+= item;
455 moveDirectory( curFile, destFile ); 455// odebug << "CurrentFile file is " + curFile << oendl;
456 rePopulate(); 456
457 return; 457 if(QFileInfo(curFile).isDir()) {
458 } 458 moveDirectory( curFile, destFile );
459 459 rePopulate();
460 QFile f( curFile); 460 return;
461 if( f.exists()) { 461 }
462 if( !copyFile( curFile, destFile) ) { 462
463 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); 463 QFile f( curFile);
464 return; 464 if( f.exists()) {
465 } else 465 if( !copyFile( curFile, destFile) ) {
466 QFile::remove(curFile); 466 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
467 } 467 return;
468 } 468 } else
469 469 QFile::remove(curFile);
470 } 470 }
471 rePopulate(); 471 }
472 setOtherTabCurrent(); 472
473} 473 }
474 474 rePopulate();
475bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { 475 setOtherTabCurrent();
476 int err = 0; 476}
477 if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; 477
478 err = system((const char*)cmd); 478bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) {
479 } else 479 int err = 0;
480 err = -1; 480 if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src;
481 481 err = system((const char*)cmd);
482 if(err!=0) { 482 } else
483 QMessageBox::message(tr("Note"),tr("Could not move\n") + src); 483 err = -1;
484 return false; 484
485 } 485 if(err!=0) {
486 return true; 486 QMessageBox::message(tr("Note"),tr("Could not move\n") + src);
487} 487 return false;
488 488 }
489bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { 489 return true;
490 490}
491 QString cmd = "/bin/cp -fpR " + src + " " + dest; 491
492 qWarning(cmd); 492bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) {
493 int err = system( (const char *) cmd ); 493
494 if ( err != 0 ) { 494 QString cmd = "/bin/cp -fpR " + src + " " + dest;
495 QMessageBox::message("AdvancedFm", 495 owarn << cmd << oendl;
496 tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); 496 int err = system( (const char *) cmd );
497 return false; 497 if ( err != 0 ) {
498 } 498 QMessageBox::message("AdvancedFm",
499 499 tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) );
500 return true; 500 return false;
501} 501 }
502 502
503 503 return true;
504bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { 504}
505 505
506 506
507 if(QFileInfo(src).isDir()) { 507bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
508 if( copyDirectory( src, dest )) { 508
509 setOtherTabCurrent(); 509
510 populateView(); 510 if(QFileInfo(src).isDir()) {
511 return true; 511 if( copyDirectory( src, dest )) {
512 } 512 setOtherTabCurrent();
513 else 513 populateView();
514 return false; 514 return true;
515 } 515 }
516 516 else
517 517 return false;
518 bool success = true; 518 }
519 struct stat status; 519
520 QFile srcFile(src); 520
521 QFile destFile(dest); 521 bool success = true;
522 int err=0; 522 struct stat status;
523 int read_fd=0; 523 QFile srcFile(src);
524 int write_fd=0; 524 QFile destFile(dest);
525 struct stat stat_buf; 525 int err=0;
526 off_t offset = 0; 526 int read_fd=0;
527 if(!srcFile.open( IO_ReadOnly|IO_Raw)) { 527 int write_fd=0;
528// qWarning("open failed"); 528 struct stat stat_buf;
529 return success = false; 529 off_t offset = 0;
530 } 530 if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
531 read_fd = srcFile.handle(); 531// owarn << "open failed" << oendl;
532 if(read_fd != -1) { 532 return success = false;
533 fstat (read_fd, &stat_buf); 533 }
534 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { 534 read_fd = srcFile.handle();
535// qWarning("destfile open failed"); 535 if(read_fd != -1) {
536 return success = false; 536 fstat (read_fd, &stat_buf);
537 } 537 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
538 write_fd = destFile.handle(); 538// owarn << "destfile open failed" << oendl;
539 if(write_fd != -1) { 539 return success = false;
540 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); 540 }
541 if( err == -1) { 541 write_fd = destFile.handle();
542 QString msg; 542 if(write_fd != -1) {
543 switch(err) { 543 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
544 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; 544 if( err == -1) {
545 case EINVAL: msg = "Descriptor is not valid or locked. "; 545 QString msg;
546 case ENOMEM: msg = "Insufficient memory to read from in_fd."; 546 switch(err) {
547 case EIO: msg = "Unspecified error while reading from in_fd."; 547 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
548 }; 548 case EINVAL: msg = "Descriptor is not valid or locked. ";
549 success = false; 549 case ENOMEM: msg = "Insufficient memory to read from in_fd.";
550// qWarning(msg); 550 case EIO: msg = "Unspecified error while reading from in_fd.";
551 } 551 };
552 } else { 552 success = false;
553 success = false; 553// owarn << msg << oendl;
554 } 554 }
555 } else { 555 } else {
556 success = false; 556 success = false;
557 } 557 }
558 srcFile.close(); 558 } else {
559 destFile.close(); 559 success = false;
560 // Set file permissions 560 }
561 if( stat( (const char *) src, &status ) == 0 ) { 561 srcFile.close();
562 chmod( (const char *) dest, status.st_mode ); 562 destFile.close();
563 } 563 // Set file permissions
564 564 if( stat( (const char *) src, &status ) == 0 ) {
565 return success; 565 chmod( (const char *) dest, status.st_mode );
566} 566 }
567 567
568void AdvancedFm::runCommand() { 568 return success;
569 if( !CurrentView()->currentItem()) return; 569}
570 QDir *thisDir = CurrentDir(); 570
571 571void AdvancedFm::runCommand() {
572 QString curFile; 572 if( !CurrentView()->currentItem()) return;
573 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); 573 QDir *thisDir = CurrentDir();
574 574
575 InputDialog *fileDlg; 575 QString curFile;
576 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 576 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
577 fileDlg->setInputText(curFile); 577
578 fileDlg->exec(); 578 InputDialog *fileDlg;
579 //QString command; 579 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
580 580 fileDlg->setInputText(curFile);
581 if( fileDlg->result() == 1 ) { 581 fileDlg->exec();
582// qDebug(fileDlg->LineEdit1->text()); 582 //QString command;
583 QStringList command; 583
584 584 if( fileDlg->result() == 1 ) {
585 command << "/bin/sh"; 585// odebug << fileDlg->LineEdit1->text() << oendl;
586 command << "-c"; 586 QStringList command;
587 command << fileDlg->LineEdit1->text(); 587
588 Output *outDlg; 588 command << "/bin/sh";
589 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 589 command << "-c";
590 QPEApplication::execDialog( outDlg ); 590 command << fileDlg->LineEdit1->text();
591 qApp->processEvents(); 591 Output *outDlg;
592 592 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
593 } 593 QPEApplication::execDialog( outDlg );
594} 594 qApp->processEvents();
595 595
596void AdvancedFm::runCommandStd() { 596 }
597 if( !CurrentView()->currentItem()) return; 597}
598 QString curFile; 598
599 QDir *thisDir = CurrentDir(); 599void AdvancedFm::runCommandStd() {
600 QListView *thisView = CurrentView(); 600 if( !CurrentView()->currentItem()) return;
601 if( thisView->currentItem()) 601 QString curFile;
602 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); 602 QDir *thisDir = CurrentDir();
603 603 QListView *thisView = CurrentView();
604 InputDialog *fileDlg; 604 if( thisView->currentItem())
605 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 605 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
606 fileDlg->setInputText(curFile); 606
607 fileDlg->exec(); 607 InputDialog *fileDlg;
608 608 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
609 if( fileDlg->result() == 1 ) { 609 fileDlg->setInputText(curFile);
610 qApp->processEvents(); 610 fileDlg->exec();
611 startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); 611
612 } 612 if( fileDlg->result() == 1 ) {
613} 613 qApp->processEvents();
614 614 startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
615void AdvancedFm::fileStatus() { 615 }
616 if( !CurrentView()->currentItem()) return; 616}
617 QString curFile; 617
618 curFile = CurrentView()->currentItem()->text(0); 618void AdvancedFm::fileStatus() {
619 619 if( !CurrentView()->currentItem()) return;
620 QStringList command; 620 QString curFile;
621 command << "/bin/sh"; 621 curFile = CurrentView()->currentItem()->text(0);
622 command << "-c"; 622
623 command << "stat -l "+ curFile; 623 QStringList command;
624 624 command << "/bin/sh";
625 Output *outDlg; 625 command << "-c";
626 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 626 command << "stat -l "+ curFile;
627 QPEApplication::execDialog( outDlg ); 627
628 qApp->processEvents(); 628 Output *outDlg;
629} 629 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
630 630 QPEApplication::execDialog( outDlg );
631 631 qApp->processEvents();
632void AdvancedFm::mkDir() { 632}
633 makeDir(); 633
634} 634
635 635void AdvancedFm::mkDir() {
636void AdvancedFm::rn() { 636 makeDir();
637 renameIt(); 637}
638} 638
639 639void AdvancedFm::rn() {
640void AdvancedFm::del() { 640 renameIt();
641 doDelete(); 641}
642} 642
643 643void AdvancedFm::del() {
644void AdvancedFm::mkSym() { 644 doDelete();
645 QString cmd; 645}
646 QStringList curFileList = getPath(); 646
647 if( curFileList.count() > 0) { 647void AdvancedFm::mkSym() {
648 QDir *thisDir = CurrentDir(); 648 QString cmd;
649 QDir * thatDir = OtherDir(); 649 QStringList curFileList = getPath();
650 650 if( curFileList.count() > 0) {
651 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 651 QDir *thisDir = CurrentDir();
652 652 QDir * thatDir = OtherDir();
653 QString destName = thatDir->canonicalPath()+"/"+(*it); 653
654 if(destName.right(1) == "/") { 654 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
655 destName = destName.left( destName.length() -1); 655
656 } 656 QString destName = thatDir->canonicalPath()+"/"+(*it);
657 657 if(destName.right(1) == "/") {
658 QString curFile = thisDir->canonicalPath()+"/"+(*it); 658 destName = destName.left( destName.length() -1);
659 659 }
660 if( curFile.right(1) == "/") { 660
661 curFile = curFile.left( curFile.length() -1); 661 QString curFile = thisDir->canonicalPath()+"/"+(*it);
662 } 662
663 663 if( curFile.right(1) == "/") {
664 cmd = "ln -s "+curFile+" "+destName; 664 curFile = curFile.left( curFile.length() -1);
665// qDebug(cmd); 665 }
666 startProcess( (const QString)cmd ); 666
667 } 667 cmd = "ln -s "+curFile+" "+destName;
668 rePopulate(); 668// odebug << cmd << oendl;
669 setOtherTabCurrent(); 669 startProcess( (const QString)cmd );
670 } 670 }
671} 671 rePopulate();
672 672 setOtherTabCurrent();
673void AdvancedFm::doBeam() { 673 }
674 Ir ir; 674}
675 if(!ir.supported()) { 675
676 } else { 676void AdvancedFm::doBeam() {
677 QStringList curFileList = getPath(); 677 Ir ir;
678 if( curFileList.count() > 0) { 678 if(!ir.supported()) {
679 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 679 } else {
680 QString curFile = (*it); 680 QStringList curFileList = getPath();
681 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; 681 if( curFileList.count() > 0) {
682 if( curFilePath.right(1) == "/") { 682 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
683 curFilePath = curFilePath.left( curFilePath.length() -1); 683 QString curFile = (*it);
684 } 684 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile;
685 Ir *file = new Ir(this, "IR"); 685 if( curFilePath.right(1) == "/") {
686 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); 686 curFilePath = curFilePath.left( curFilePath.length() -1);
687 file->send( curFilePath, curFile ); 687 }
688 } 688 Ir *file = new Ir(this, "IR");
689 } 689 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*)));
690 } 690 file->send( curFilePath, curFile );
691} 691 }
692 692 }
693void AdvancedFm::fileBeamFinished( Ir *) { 693 }
694 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 694}
695} 695
696 696void AdvancedFm::fileBeamFinished( Ir *) {
697void AdvancedFm::selectAll() { 697 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
698 QListView *thisView = CurrentView(); 698}
699 thisView->selectAll(true); 699
700 thisView->setSelected( thisView->firstChild(),false); 700void AdvancedFm::selectAll() {
701} 701 QListView *thisView = CurrentView();
702 702 thisView->selectAll(true);
703void AdvancedFm::startProcess(const QString & cmd) { 703 thisView->setSelected( thisView->firstChild(),false);
704 QStringList command; 704}
705 OProcess *process; 705
706 process = new OProcess(); 706void AdvancedFm::startProcess(const QString & cmd) {
707 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), 707 QStringList command;
708 this, SLOT( processEnded(Opie::Core::OProcess*))); 708 OProcess *process;
709 709 process = new OProcess();
710 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), 710 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
711 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); 711 this, SLOT( processEnded(Opie::Core::OProcess*)));
712 712
713 command << "/bin/sh"; 713 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
714 command << "-c"; 714 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
715 command << cmd.latin1(); 715
716 *process << command; 716 command << "/bin/sh";
717 if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) 717 command << "-c";
718 qDebug("could not start process"); 718 command << cmd.latin1();
719} 719 *process << command;
720 720 if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
721void AdvancedFm::processEnded(OProcess *) { 721 odebug << "could not start process" << oendl;
722 rePopulate(); 722}
723} 723
724 724void AdvancedFm::processEnded(OProcess *) {
725void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 725 rePopulate();
726// qWarning("received stderrt %d bytes", buflen); 726}
727 727
728 QString lineStr = buffer; 728void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
729 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); 729// owarn << "received stderrt " << buflen << " bytes" << oendl;
730} 730
731 731 QString lineStr = buffer;
732bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { 732 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
733 if ( o->inherits( "QLineEdit" ) ) { 733}
734 if ( e->type() == QEvent::KeyPress ) { 734
735 QKeyEvent *ke = (QKeyEvent*)e; 735bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
736 if ( ke->key() == Key_Return || 736 if ( o->inherits( "QLineEdit" ) ) {
737 ke->key() == Key_Enter ) { 737 if ( e->type() == QEvent::KeyPress ) {
738 okRename(); 738 QKeyEvent *ke = (QKeyEvent*)e;
739 return true; 739 if ( ke->key() == Key_Return ||
740 } 740 ke->key() == Key_Enter ) {
741 else if ( ke->key() == Key_Escape ) { 741 okRename();
742 cancelRename(); 742 return true;
743 return true; 743 }
744 } 744 else if ( ke->key() == Key_Escape ) {
745 } 745 cancelRename();
746 else if ( e->type() == QEvent::FocusOut ) { 746 return true;
747 cancelRename(); 747 }
748 return true; 748 }
749 } 749 else if ( e->type() == QEvent::FocusOut ) {
750 } 750 cancelRename();
751 if ( o->inherits( "QListView" ) ) { 751 return true;
752 if ( e->type() == QEvent::FocusIn ) { 752 }
753 if( o == Local_View) { //keep track of which view 753 }
754 whichTab=1; 754 if ( o->inherits( "QListView" ) ) {
755 } 755 if ( e->type() == QEvent::FocusIn ) {
756 else { 756 if( o == Local_View) { //keep track of which view
757 whichTab=2; 757 whichTab=1;
758 } 758 }
759 } 759 else {
760 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection 760 whichTab=2;
761 } 761 }
762 762 }
763 return QWidget::eventFilter( o, e ); 763 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
764} 764 }
765 765
766 766 return QWidget::eventFilter( o, e );
767void AdvancedFm::cancelRename() { 767}
768// qDebug("cancel rename"); 768
769 QListView * view; 769
770 view = CurrentView(); 770void AdvancedFm::cancelRename() {
771 771// odebug << "cancel rename" << oendl;
772 bool resetFocus = view->viewport()->focusProxy() == renameBox; 772 QListView * view;
773 delete renameBox; 773 view = CurrentView();
774 renameBox = 0; 774
775 if ( resetFocus ) { 775 bool resetFocus = view->viewport()->focusProxy() == renameBox;
776 view->viewport()->setFocusProxy( view); 776 delete renameBox;
777 view->setFocus(); 777 renameBox = 0;
778 } 778 if ( resetFocus ) {
779} 779 view->viewport()->setFocusProxy( view);
780 780 view->setFocus();
781void AdvancedFm::doRename(QListView * view) { 781 }
782 if( !CurrentView()->currentItem()) return; 782}
783 783
784 QRect r = view->itemRect( view->currentItem( )); 784void AdvancedFm::doRename(QListView * view) {
785 r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); 785 if( !CurrentView()->currentItem()) return;
786 r.setX( view->contentsX() ); 786
787 787 QRect r = view->itemRect( view->currentItem( ));
788 if ( r.width() > view->visibleWidth() ) 788 r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
789 r.setWidth( view->visibleWidth() ); 789 r.setX( view->contentsX() );
790 790
791 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); 791 if ( r.width() > view->visibleWidth() )
792 renameBox->setFrame(true); 792 r.setWidth( view->visibleWidth() );
793 793
794 renameBox->setText( view->currentItem()->text(0) ); 794 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
795 795 renameBox->setFrame(true);
796 renameBox->selectAll(); 796
797 renameBox->installEventFilter( this ); 797 renameBox->setText( view->currentItem()->text(0) );
798 798
799 view->addChild( renameBox, r.x(), r.y() ); 799 renameBox->selectAll();
800 800 renameBox->installEventFilter( this );
801 renameBox->resize( r.size() ); 801
802 802 view->addChild( renameBox, r.x(), r.y() );
803 view->viewport()->setFocusProxy( renameBox ); 803
804 804 renameBox->resize( r.size() );
805 renameBox->setFocus(); 805
806 renameBox->show(); 806 view->viewport()->setFocusProxy( renameBox );
807} 807
808 808 renameBox->setFocus();
809 809 renameBox->show();
810void AdvancedFm::renameIt() { 810}
811 if( !CurrentView()->currentItem()) return; 811
812 812
813 QListView *thisView = CurrentView(); 813void AdvancedFm::renameIt() {
814 oldName = thisView->currentItem()->text(0); 814 if( !CurrentView()->currentItem()) return;
815 doRename( thisView ); 815
816} 816 QListView *thisView = CurrentView();
817 817 oldName = thisView->currentItem()->text(0);
818void AdvancedFm::okRename() { 818 doRename( thisView );
819 if( !renameBox) return; 819}
820 820
821 QString newName = renameBox->text(); 821void AdvancedFm::okRename() {
822 cancelRename(); 822 if( !renameBox) return;
823 QListView * view = CurrentView(); 823
824 QString path = CurrentDir()->canonicalPath() + "/"; 824 QString newName = renameBox->text();
825 oldName = path + oldName; 825 cancelRename();
826 newName = path + newName; 826 QListView * view = CurrentView();
827 if( rename( oldName.latin1(), newName.latin1())== -1) 827 QString path = CurrentDir()->canonicalPath() + "/";
828 QMessageBox::message(tr("Note"),tr("Could not rename")); 828 oldName = path + oldName;
829 else 829 newName = path + newName;
830 oldName = ""; 830 if( rename( oldName.latin1(), newName.latin1())== -1)
831 QListViewItem *item = view->currentItem(); 831 QMessageBox::message(tr("Note"),tr("Could not rename"));
832 view->takeItem( item ); 832 else
833 delete item; 833 oldName = "";
834 rePopulate(); 834 QListViewItem *item = view->currentItem();
835} 835 view->takeItem( item );
836 836 delete item;
837void AdvancedFm::openSearch() { 837 rePopulate();
838 QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); 838}
839} 839
840void AdvancedFm::openSearch() {
841 QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
842}
diff --git a/noncore/apps/advancedfm/filePermissions.cpp b/noncore/apps/advancedfm/filePermissions.cpp
index 9698de7..b7d48e8 100644
--- a/noncore/apps/advancedfm/filePermissions.cpp
+++ b/noncore/apps/advancedfm/filePermissions.cpp
@@ -23,25 +23,25 @@
23#include <unistd.h> 23#include <unistd.h>
24#include <sys/stat.h> 24#include <sys/stat.h>
25#include <stdlib.h> 25#include <stdlib.h>
26#include <sys/types.h> 26#include <sys/types.h>
27#include <pwd.h> 27#include <pwd.h>
28#include <grp.h> 28#include <grp.h>
29 29
30filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName ) 30filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName )
31 : QDialog( parent, name, modal, fl ) 31 : QDialog( parent, name, modal, fl )
32{ 32{
33 if ( !name ) 33 if ( !name )
34 setName( tr("filePermissions") ); 34 setName( tr("filePermissions") );
35// qDebug("FilePermissions "+fileName); 35// odebug << "FilePermissions "+fileName << oendl;
36/* resize( 236, 210 ); 36/* resize( 236, 210 );
37 setMaximumSize( QSize( 236, 210 ) ); 37 setMaximumSize( QSize( 236, 210 ) );
38*/ setCaption( tr( "Set File Permissions" ) ); 38*/ setCaption( tr( "Set File Permissions" ) );
39 39
40 TextLabel1 = new QLabel( this, "TextLabel1" ); 40 TextLabel1 = new QLabel( this, "TextLabel1" );
41 TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); 41 TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) );
42 TextLabel1->setText( tr( "Set file permissions for:" ) ); 42 TextLabel1->setText( tr( "Set file permissions for:" ) );
43 43
44 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 44 LineEdit1 = new QLineEdit( this, "LineEdit1" );
45 LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); 45 LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) );
46 LineEdit1->setReadOnly(true); 46 LineEdit1->setReadOnly(true);
47 47
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index 6906298..8c585f4 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -1,32 +1,35 @@
1/**************************************************************************** 1/****************************************************************************
2** outputEdit.cpp 2** outputEdit.cpp
3** 3**
4** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> 4** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com>
5****************************************************************************/ 5****************************************************************************/
6#include "output.h" 6#include "output.h"
7 7
8/* OPIE */
9#include <opie2/odebug.h>
8#include <qpe/qpeapplication.h> 10#include <qpe/qpeapplication.h>
9#include <qpe/applnk.h> 11#include <qpe/applnk.h>
12using namespace Opie::Core;
10 13
14/* QT */
11#include <qfile.h> 15#include <qfile.h>
12#include <qmultilineedit.h> 16#include <qmultilineedit.h>
13#include <qpushbutton.h> 17#include <qpushbutton.h>
14#include <qlayout.h> 18#include <qlayout.h>
15 19
20/* STD */
16#include <errno.h> 21#include <errno.h>
17 22
18/* XPM */ 23/* XPM */
19using namespace Opie::Core;
20using namespace Opie::Core;
21static char * filesave_xpm[] = { 24static char * filesave_xpm[] = {
22"16 16 78 1", 25"16 16 78 1",
23" c None", 26" c None",
24". c #343434", 27". c #343434",
25"+ c #A0A0A0", 28"+ c #A0A0A0",
26"@ c #565656", 29"@ c #565656",
27"# c #9E9E9E", 30"# c #9E9E9E",
28"$ c #525252", 31"$ c #525252",
29"% c #929292", 32"% c #929292",
30"& c #676767", 33"& c #676767",
31"* c #848484", 34"* c #848484",
32"= c #666666", 35"= c #666666",
@@ -112,25 +115,25 @@ static char * filesave_xpm[] = {
112"CzDEvEv;;DssF$ ", 115"CzDEvEv;;DssF$ ",
113"G.H{E{E{IxsJ$+ ", 116"G.H{E{E{IxsJ$+ ",
114" +...vEKxzLM ", 117" +...vEKxzLM ",
115" +...z]n$ ", 118" +...z]n$ ",
116" +... "}; 119" +... "};
117 120
118Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl) 121Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl)
119 : QDialog( parent, name, modal, fl ) 122 : QDialog( parent, name, modal, fl )
120{ 123{
121 QStringList cmmds; 124 QStringList cmmds;
122// cmmds=QStringList::split( " ", commands, false); 125// cmmds=QStringList::split( " ", commands, false);
123 cmmds=commands; 126 cmmds=commands;
124// qDebug("count %d", cmmds.count()); 127// odebug << "count " << cmmds.count() << "" << oendl;
125 if ( !name ) 128 if ( !name )
126 setName( tr("Output")); 129 setName( tr("Output"));
127 resize( 196, 269 ); 130 resize( 196, 269 );
128 setCaption( name ); 131 setCaption( name );
129 132
130 OutputLayout = new QGridLayout( this ); 133 OutputLayout = new QGridLayout( this );
131 OutputLayout->setSpacing( 2); 134 OutputLayout->setSpacing( 2);
132 OutputLayout->setMargin( 2); 135 OutputLayout->setMargin( 2);
133 136
134 QPushButton *docButton; 137 QPushButton *docButton;
135 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); 138 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton");
136 docButton->setFixedSize( QSize( 20, 20 ) ); 139 docButton->setFixedSize( QSize( 20, 20 ) );
@@ -148,25 +151,25 @@ Output::Output( const QStringList commands, QWidget* parent, const char* name,
148 151
149 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), 152 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
150 this, SLOT(commandStdout(Opie::Core::OProcess*,char*,int))); 153 this, SLOT(commandStdout(Opie::Core::OProcess*,char*,int)));
151 154
152 connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), 155 connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
153 this, SLOT(commandStderr(Opie::Core::OProcess*,char*,int))); 156 this, SLOT(commandStderr(Opie::Core::OProcess*,char*,int)));
154 157
155// connect( , SIGNAL(received(const QByteArray&)), 158// connect( , SIGNAL(received(const QByteArray&)),
156// this, SLOT(commandStdin(const QByteArray&))); 159// this, SLOT(commandStdin(const QByteArray&)));
157 160
158// * proc << commands.latin1(); 161// * proc << commands.latin1();
159 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) { 162 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) {
160 qDebug( "%s", (*it).latin1() ); 163 odebug << "" << (*it).latin1() << "" << oendl;
161 * proc << (*it).latin1(); 164 * proc << (*it).latin1();
162 } 165 }
163 166
164 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { 167 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) {
165 168
166 OutputEdit->append(tr("Process could not start") ); 169 OutputEdit->append(tr("Process could not start") );
167 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 170 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
168 perror("Error: "); 171 perror("Error: ");
169 QString errorMsg=tr("Error\n")+(QString)strerror(errno); 172 QString errorMsg=tr("Error\n")+(QString)strerror(errno);
170 OutputEdit->append( errorMsg); 173 OutputEdit->append( errorMsg);
171 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 174 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
172 } 175 }
@@ -177,67 +180,67 @@ Output::~Output() {
177 180
178void Output::saveOutput() { 181void Output::saveOutput() {
179 182
180 InputDialog *fileDlg; 183 InputDialog *fileDlg;
181 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); 184 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0);
182 fileDlg->exec(); 185 fileDlg->exec();
183 if( fileDlg->result() == 1 ) { 186 if( fileDlg->result() == 1 ) {
184 QString filename = QPEApplication::documentDir(); 187 QString filename = QPEApplication::documentDir();
185 if(filename.right(1).find('/') == -1) 188 if(filename.right(1).find('/') == -1)
186 filename+="/"; 189 filename+="/";
187 QString name = fileDlg->LineEdit1->text(); 190 QString name = fileDlg->LineEdit1->text();
188 filename+="text/plain/"+name; 191 filename+="text/plain/"+name;
189 qDebug(filename); 192 odebug << filename << oendl;
190 193
191 QFile f(filename); 194 QFile f(filename);
192 f.open( IO_WriteOnly); 195 f.open( IO_WriteOnly);
193 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { 196 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
194 DocLnk lnk; 197 DocLnk lnk;
195 lnk.setName(name); //sets file name 198 lnk.setName(name); //sets file name
196 lnk.setFile(filename); //sets File property 199 lnk.setFile(filename); //sets File property
197 lnk.setType("text/plain"); 200 lnk.setType("text/plain");
198 if(!lnk.writeLink()) { 201 if(!lnk.writeLink()) {
199 qDebug("Writing doclink did not work"); 202 odebug << "Writing doclink did not work" << oendl;
200 } 203 }
201 } else 204 } else
202 qWarning("Could not write file"); 205 owarn << "Could not write file" << oendl;
203 f.close(); 206 f.close();
204 } 207 }
205} 208}
206 209
207void Output::commandStdout(OProcess*, char *buffer, int buflen) { 210void Output::commandStdout(OProcess*, char *buffer, int buflen) {
208 qWarning("received stdout %d bytes", buflen); 211 owarn << "received stdout " << buflen << " bytes" << oendl;
209 212
210// QByteArray data(buflen); 213// QByteArray data(buflen);
211// data.fill(*buffer, buflen); 214// data.fill(*buffer, buflen);
212// for (uint i = 0; i < data.count(); i++ ) { 215// for (uint i = 0; i < data.count(); i++ ) {
213// printf("%c", buffer[i] ); 216// printf("%c", buffer[i] );
214// } 217// }
215// printf("\n"); 218// printf("\n");
216 219
217 QString lineStr = buffer; 220 QString lineStr = buffer;
218 lineStr=lineStr.left(lineStr.length()-1); 221 lineStr=lineStr.left(lineStr.length()-1);
219 OutputEdit->append(lineStr); 222 OutputEdit->append(lineStr);
220 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 223 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
221} 224}
222 225
223 226
224void Output::commandStdin( const QByteArray &data) { 227void Output::commandStdin( const QByteArray &data) {
225 qWarning("received stdin %d bytes", data.size()); 228 owarn << "received stdin " << data.size() << " bytes" << oendl;
226 // recieved data from the io layer goes to sz 229 // recieved data from the io layer goes to sz
227 proc->writeStdin(data.data(), data.size()); 230 proc->writeStdin(data.data(), data.size());
228} 231}
229 232
230void Output::commandStderr(OProcess*, char *buffer, int buflen) { 233void Output::commandStderr(OProcess*, char *buffer, int buflen) {
231 qWarning("received stderrt %d bytes", buflen); 234 owarn << "received stderrt " << buflen << " bytes" << oendl;
232 235
233 QString lineStr = buffer; 236 QString lineStr = buffer;
234// lineStr=lineStr.left(lineStr.length()-1); 237// lineStr=lineStr.left(lineStr.length()-1);
235 OutputEdit->append(lineStr); 238 OutputEdit->append(lineStr);
236 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 239 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
237} 240}
238 241
239void Output::processFinished() { 242void Output::processFinished() {
240 243
241 delete proc; 244 delete proc;
242 OutputEdit->append( tr("\nFinished\n") ); 245 OutputEdit->append( tr("\nFinished\n") );
243 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 246 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro
index 34641f4..1472df6 100644
--- a/noncore/apps/checkbook/checkbook.pro
+++ b/noncore/apps/checkbook/checkbook.pro
@@ -1,13 +1,13 @@
1CONFIG = qt warn_on quick-app 1CONFIG = qt warn_on quick-app
2HEADERS = mainwindow.h \ 2HEADERS = mainwindow.h \
3 cbinfo.h \ 3 cbinfo.h \
4 traninfo.h \ 4 traninfo.h \
5 graphinfo.h \ 5 graphinfo.h \
6 configuration.h \ 6 configuration.h \
7 password.h \ 7 password.h \
8 checkbook.h \ 8 checkbook.h \
9 transaction.h \ 9 transaction.h \
10 tabledef.h \ 10 tabledef.h \
11 listedit.h \ 11 listedit.h \
12 cfg.h \ 12 cfg.h \
13 graph.h 13 graph.h
diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp
index d00e305..5026c9d 100644
--- a/noncore/apps/checkbook/listedit.cpp
+++ b/noncore/apps/checkbook/listedit.cpp
@@ -18,32 +18,37 @@
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "listedit.h" 29#include "listedit.h"
30
31/* OPIE */
32#include <opie2/odebug.h>
33#include <qpe/resource.h>
34using namespace Opie::Core;
35
36/* QT */
30#include <qlayout.h> 37#include <qlayout.h>
31#include <qlineedit.h> 38#include <qlineedit.h>
32#include <qlistview.h> 39#include <qlistview.h>
33#include <qwidgetstack.h> 40#include <qwidgetstack.h>
34#include <qcombobox.h> 41#include <qcombobox.h>
35#include <qpushbutton.h> 42#include <qpushbutton.h>
36#include <qpe/resource.h>
37
38 43
39// --- ListEdit --------------------------------------------------------------- 44// --- ListEdit ---------------------------------------------------------------
40ListEdit::ListEdit( QWidget *parent, const char *sName ) 45ListEdit::ListEdit( QWidget *parent, const char *sName )
41 : QWidget(parent, sName), TableDef(sName) 46 : QWidget(parent, sName), TableDef(sName)
42{ 47{
43 // get font height 48 // get font height
44 int fh = fontMetrics().height(); 49 int fh = fontMetrics().height();
45 50
46 // create layout 51 // create layout
47 QGridLayout *layout=new QGridLayout(this); 52 QGridLayout *layout=new QGridLayout(this);
48 layout->setSpacing( 2 ); 53 layout->setSpacing( 2 );
49 layout->setMargin( 4 ); 54 layout->setMargin( 4 );
@@ -293,25 +298,25 @@ void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col)
293 _box->setCurrentItem(i); 298 _box->setCurrentItem(i);
294 i=-1; 299 i=-1;
295 break; 300 break;
296 } 301 }
297 i++; 302 i++;
298 } 303 }
299 if( i>=0 ) { 304 if( i>=0 ) {
300 _box->insertItem( _currentItem->text(_currentColumn) ); 305 _box->insertItem( _currentItem->text(_currentColumn) );
301 _box->setCurrentItem(i); 306 _box->setCurrentItem(i);
302 } 307 }
303 _stack->raiseWidget(_box); 308 _stack->raiseWidget(_box);
304 } else { 309 } else {
305 qDebug( "Unsupported column type for column %s", (const char *)pDef->getName() ); 310 odebug << "Unsupported column type for column " << (const char *)pDef->getName() << "" << oendl;
306 _typeEdit->setText(""); 311 _typeEdit->setText("");
307 _stack->raiseWidget(_typeEdit); 312 _stack->raiseWidget(_typeEdit);
308 } 313 }
309} 314}
310 315
311 316
312// --- addColumnDef ----------------------------------------------------------- 317// --- addColumnDef -----------------------------------------------------------
313void ListEdit::addColumnDef(ColumnDef *pDef) 318void ListEdit::addColumnDef(ColumnDef *pDef)
314{ 319{
315 _typeTable->addColumn( pDef->getName() ); 320 _typeTable->addColumn( pDef->getName() );
316 _vColumns.append(pDef); 321 _vColumns.append(pDef);
317} 322}
diff --git a/noncore/apps/checkbook/tabledef.cpp b/noncore/apps/checkbook/tabledef.cpp
index 9a42308..745cd80 100644
--- a/noncore/apps/checkbook/tabledef.cpp
+++ b/noncore/apps/checkbook/tabledef.cpp
@@ -19,46 +19,48 @@
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "tabledef.h" 29#include "tabledef.h"
30 30
31#include <opie2/odebug.h>
32using namespace Opie::Core;
31 33
32// --- ColumnDef -------------------------------------------------------------- 34// --- ColumnDef --------------------------------------------------------------
33ColumnDef::ColumnDef(const char *sName, ColumnType type, const char *sNewValue) 35ColumnDef::ColumnDef(const char *sName, ColumnType type, const char *sNewValue)
34{ 36{
35 _sName=sName; 37 _sName=sName;
36 _type=type; 38 _type=type;
37 _sNewValue=sNewValue; 39 _sNewValue=sNewValue;
38} 40}
39 41
40 42
41// --- addColumnValue --------------------------------------------------------- 43// --- addColumnValue ---------------------------------------------------------
42void ColumnDef::addColumnValue(const QString &sValue) 44void ColumnDef::addColumnValue(const QString &sValue)
43{ 45{
44 if( (_type & 0x00ffffff) !=typeList ) 46 if( (_type & 0x00ffffff) !=typeList )
45 qDebug("Column %s is not a list", (const char *)_sName); 47 odebug << "Column " << (const char *)_sName << " is not a list" << oendl;
46 else 48 else
47 _valueList.append(sValue); 49 _valueList.append(sValue);
48} 50}
49void ColumnDef::addColumnValue(const char *sValue) 51void ColumnDef::addColumnValue(const char *sValue)
50{ 52{
51 if( (_type & 0x00ffffff)!=typeList ) 53 if( (_type & 0x00ffffff)!=typeList )
52 qDebug("Column %s is not a list", (const char *)_sName); 54 odebug << "Column " << (const char *)_sName << " is not a list" << oendl;
53 else 55 else
54 _valueList.append(sValue); 56 _valueList.append(sValue);
55} 57}
56 58
57// --- TableDef --------------------------------------------------------------- 59// --- TableDef ---------------------------------------------------------------
58TableDef::TableDef(const char *sName) 60TableDef::TableDef(const char *sName)
59{ 61{
60 _sName=sName; 62 _sName=sName;
61 _vColumns.setAutoDelete(TRUE); 63 _vColumns.setAutoDelete(TRUE);
62} 64}
63 65
64 66
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp
index 1b08b24..aafb588 100644
--- a/noncore/apps/checkbook/transaction.cpp
+++ b/noncore/apps/checkbook/transaction.cpp
@@ -22,26 +22,30 @@
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "transaction.h" 29#include "transaction.h"
30#include "traninfo.h" 30#include "traninfo.h"
31#include "cfg.h" 31#include "cfg.h"
32#include "checkbook.h" 32#include "checkbook.h"
33 33
34/* OPIE */
35#include <opie2/odebug.h>
34#include <qpe/datebookmonth.h> 36#include <qpe/datebookmonth.h>
37using namespace Opie::Core;
35 38
39/* QT */
36#include <qbuttongroup.h> 40#include <qbuttongroup.h>
37#include <qcombobox.h> 41#include <qcombobox.h>
38#include <qlabel.h> 42#include <qlabel.h>
39#include <qlayout.h> 43#include <qlayout.h>
40#include <qlineedit.h> 44#include <qlineedit.h>
41#include <qmultilineedit.h> 45#include <qmultilineedit.h>
42#include <qradiobutton.h> 46#include <qradiobutton.h>
43#include <qwhatsthis.h> 47#include <qwhatsthis.h>
44 48
45Transaction::Transaction( QWidget *parent, bool bNew, const QString &acctname, 49Transaction::Transaction( QWidget *parent, bool bNew, const QString &acctname,
46 TranInfo *info, Cfg *pCfg ) 50 TranInfo *info, Cfg *pCfg )
47 : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) 51 : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
@@ -323,15 +327,15 @@ void Transaction::slotActivated(const QString &arg )
323 if( pTi ) { 327 if( pTi ) {
324 initFromInfo( pTi, true ); 328 initFromInfo( pTi, true );
325 amtEdit->setFocus(); 329 amtEdit->setFocus();
326 amtEdit->setSelection(0, amtEdit->text().length() ); 330 amtEdit->setSelection(0, amtEdit->text().length() );
327 amtEdit->setCursorPosition(0); 331 amtEdit->setCursorPosition(0);
328 } 332 }
329 } 333 }
330} 334}
331 335
332// slotNotNew ----------------------------------------------------------------- 336// slotNotNew -----------------------------------------------------------------
333void Transaction::slotNotNew() 337void Transaction::slotNotNew()
334{ 338{
335 qDebug("Not new"); 339 odebug << "Not new" << oendl;
336 _bNew=false; 340 _bNew=false;
337} 341}
diff --git a/noncore/apps/confedit/confedit.pro b/noncore/apps/confedit/confedit.pro
index 5a71680..785c588 100644
--- a/noncore/apps/confedit/confedit.pro
+++ b/noncore/apps/confedit/confedit.pro
@@ -1,21 +1,9 @@
1CONFIG = qt warn_on quick-app 1CONFIG = qt warn_on quick-app
2HEADERS = mainwindow.h listviewconfdir.h listviewitemconffile.h listviewitemconfigentry.h editwidget.h listviewitemconf.h 2HEADERS = mainwindow.h listviewconfdir.h listviewitemconffile.h listviewitemconfigentry.h editwidget.h listviewitemconf.h
3SOURCES = main.cpp mainwindow.cpp listviewconfdir.cpp listviewitemconffile.cpp listviewitemconfigentry.cpp editwidget.cpp listviewitemconf.cpp 3SOURCES = main.cpp mainwindow.cpp listviewconfdir.cpp listviewitemconffile.cpp listviewitemconfigentry.cpp editwidget.cpp listviewitemconf.cpp
4INCLUDEPATH += $(OPIEDIR)/include 4INCLUDEPATH += $(OPIEDIR)/include
5DEPENDPATH += $(OPIEDIR)/include 5DEPENDPATH += $(OPIEDIR)/include
6INTERFACES = 6LIBS += -lqpe -lopiecore2
7LIBS += -lopiecore2
8TARGET = confedit 7TARGET = confedit
9 8
10!contains( platform, x11 ) { 9include ( $(OPIEDIR)/include.pro )
11
12 include ( $(OPIEDIR)/include.pro )
13 LIBS += -lqpe
14}
15
16contains( platform, x11 ) {
17 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
18}
19
20
21
diff --git a/noncore/apps/confedit/config.in b/noncore/apps/confedit/config.in
index e377307..d7682dc 100644
--- a/noncore/apps/confedit/config.in
+++ b/noncore/apps/confedit/config.in
@@ -1,4 +1,4 @@
1 config CONFEDIT 1 config CONFEDIT
2 boolean "opie-confeditor (generic editor for all Opie settings)" 2 boolean "opie-confedit (generic editor for all Opie settings)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/noncore/apps/confedit/listviewconfdir.cpp b/noncore/apps/confedit/listviewconfdir.cpp
index 0c2feeb..33bffe1 100644
--- a/noncore/apps/confedit/listviewconfdir.cpp
+++ b/noncore/apps/confedit/listviewconfdir.cpp
@@ -1,61 +1,65 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> 9 // (c) 2002 Patrick S. Vogtp <tille@handhelds.org>
10 10
11#include "listviewconfdir.h" 11#include "listviewconfdir.h"
12#include "listviewitemconffile.h"
12 13
13#include <qmessagebox.h> 14/* OPIE */
15#include <opie2/odebug.h>
16using namespace Opie::Core;
14 17
15#include "listviewitemconffile.h" 18/* QT */
19#include <qmessagebox.h>
16 20
17ListViewConfDir::ListViewConfDir(QString settingsPath, QWidget *parent, const char *name ) 21ListViewConfDir::ListViewConfDir(QString settingsPath, QWidget *parent, const char *name )
18 : QListView(parent,name), confDir(settingsPath) 22 : QListView(parent,name), confDir(settingsPath)
19{ 23{
20 24
21 setRootIsDecorated( true ); 25 setRootIsDecorated( true );
22 addColumn(tr("Files")); 26 addColumn(tr("Files"));
23 27
24 if (!confDir.isReadable()) 28 if (!confDir.isReadable())
25 QMessageBox::critical(this,tr("Could not open"),tr("The directory ")+settingsPath+tr(" could not be opened."),1,0); 29 QMessageBox::critical(this,tr("Could not open"),tr("The directory ")+settingsPath+tr(" could not be opened."),1,0);
26 readConfFiles(); 30 readConfFiles();
27 31
28 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); 32 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
29} 33}
30 34
31 35
32ListViewConfDir::~ListViewConfDir() 36ListViewConfDir::~ListViewConfDir()
33{ 37{
34} 38}
35 39
36void ListViewConfDir::readConfFiles() 40void ListViewConfDir::readConfFiles()
37{ 41{
38 42
39 confDir.setFilter( QDir::Files | QDir::NoSymLinks ); 43 confDir.setFilter( QDir::Files | QDir::NoSymLinks );
40 confDir.setSorting( QDir::Name ); 44 confDir.setSorting( QDir::Name );
41 confDir.setNameFilter("*.conf"); 45 confDir.setNameFilter("*.conf");
42 const QFileInfoList *list = confDir.entryInfoList(); 46 const QFileInfoList *list = confDir.entryInfoList();
43 QFileInfoListIterator it( *list ); 47 QFileInfoListIterator it( *list );
44 QFileInfo *fi; 48 QFileInfo *fi;
45 49
46 ListViewItemConfFile *fileEntry; 50 ListViewItemConfFile *fileEntry;
47 51
48 while ( (fi=it.current()) ) 52 while ( (fi=it.current()) )
49 { 53 {
50 qDebug( "opening: >%s<", fi->fileName().data() ); 54 odebug << "opening: >" << fi->fileName().data() << "<" << oendl;
51 fileEntry = new ListViewItemConfFile( fi, this ); 55 fileEntry = new ListViewItemConfFile( fi, this );
52 QListViewItem *dummy = new QListViewItem(fileEntry, "dummy"); 56 QListViewItem *dummy = new QListViewItem(fileEntry, "dummy");
53 ++it; 57 ++it;
54 } 58 }
55} 59}
56 60
57void ListViewConfDir::expand(QListViewItem *item) 61void ListViewConfDir::expand(QListViewItem *item)
58{ 62{
59 ((ListViewItemConf*)item)->expand(); 63 ((ListViewItemConf*)item)->expand();
60} 64}
61 65
diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp
index 1ff2c44..2958cf5 100644
--- a/noncore/apps/confedit/listviewitemconffile.cpp
+++ b/noncore/apps/confedit/listviewitemconffile.cpp
@@ -1,91 +1,97 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
10 10
11#include "listviewitemconffile.h" 11#include "listviewitemconffile.h"
12#include "listviewitemconfigentry.h"
13
14/* OPIE */
15#include <opie2/odebug.h>
16using namespace Opie::Core;
17
18/* QT */
12#include <qmessagebox.h> 19#include <qmessagebox.h>
13#include <qtextstream.h> 20#include <qtextstream.h>
14#include "listviewitemconfigentry.h"
15 21
16#define tr QObject::tr 22#define tr QObject::tr
17 23
18ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent) 24ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent)
19 : ListViewItemConf(parent), _valid(false) 25 : ListViewItemConf(parent), _valid(false)
20{ 26{
21 confFileInfo = file; 27 confFileInfo = file;
22// parseFile(); 28 // parseFile();
23 displayText(); 29 displayText();
24} 30}
25 31
26ListViewItemConfFile::~ListViewItemConfFile() 32ListViewItemConfFile::~ListViewItemConfFile()
27{ 33{
28} 34}
29 35
30 36
31void ListViewItemConfFile::displayText() 37void ListViewItemConfFile::displayText()
32{ 38{
33 setText(0,(_changed?"*":"")+confFileInfo->fileName()); 39 setText(0,(_changed?"*":"")+confFileInfo->fileName());
34} 40}
35 41
36QString ListViewItemConfFile::fileName() 42QString ListViewItemConfFile::fileName()
37{ 43{
38 return confFileInfo->fileName(); 44 return confFileInfo->fileName();
39} 45}
40 46
41void ListViewItemConfFile::parseFile() 47void ListViewItemConfFile::parseFile()
42{ 48{
43 //qDebug("ListViewItemConfFile::parseFile BEGIN"); 49 //odebug << "ListViewItemConfFile::parseFile BEGIN" << oendl;
44 QFile confFile(confFileInfo->absFilePath()); 50 QFile confFile(confFileInfo->absFilePath());
45 if(! confFile.open(IO_ReadOnly)) 51 if(! confFile.open(IO_ReadOnly))
46 QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); 52 QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0);
47 QTextStream t( &confFile ); 53 QTextStream t( &confFile );
48 QString s; 54 QString s;
49 QString group; 55 QString group;
50 ListViewItemConfigEntry *groupItem; 56 ListViewItemConfigEntry *groupItem;
51 ListViewItemConfigEntry *item; 57 ListViewItemConfigEntry *item;
52 while ( !t.atEnd() ) 58 while ( !t.atEnd() )
53 { 59 {
54 s = t.readLine().stripWhiteSpace(); 60 s = t.readLine().stripWhiteSpace();
55 //qDebug( "line: >%s<\n", s.latin1() ); 61 //odebug << "line: >" << s.latin1() << "<\n" << oendl;
56 if (s.contains("<?xml")) 62 if (s.contains("<?xml"))
57 { 63 {
58 _valid = false; 64 _valid = false;
59 break; 65 break;
60 }else 66 }else
61 if ( s[0] == '[' && s[s.length()-1] == ']' ) 67 if ( s[0] == '[' && s[s.length()-1] == ']' )
62 { 68 {
63 // qDebug("got group"+s); 69 // odebug << "got group"+s << oendl;
64 group = s.mid(1,s.length()-2); 70 group = s.mid(1,s.length()-2);
65 if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") ); 71 if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") );
66 groupItem = new ListViewItemConfigEntry(this, group ); 72 groupItem = new ListViewItemConfigEntry(this, group );
67 insertItem( groupItem ); 73 insertItem( groupItem );
68 } else 74 } else
69 if ( int pos = s.find('=') ) 75 if ( int pos = s.find('=') )
70 { 76 {
71// qDebug("got key"+s); 77// odebug << "got key"+s << oendl;
72 if (!groupItem) qDebug("PANIK NO GROUP! >%s<",group.latin1()); 78 if (!groupItem) odebug << "PANIK NO GROUP! >" << group.latin1() << "<" << oendl;
73 item = new ListViewItemConfigEntry(this, group, s ); 79 item = new ListViewItemConfigEntry(this, group, s );
74 groupItem->insertItem( item ); 80 groupItem->insertItem( item );
75 } 81 }
76 } 82 }
77 confFile.close(); 83 confFile.close();
78 setExpandable( _valid ); 84 setExpandable( _valid );
79 //qDebug("ListViewItemConfFile::parseFile END"); 85 //odebug << "ListViewItemConfFile::parseFile END" << oendl;
80} 86}
81 87
82 88
83void ListViewItemConfFile::remove() 89void ListViewItemConfFile::remove()
84{ 90{
85 QFile::remove(confFileInfo->absFilePath()); 91 QFile::remove(confFileInfo->absFilePath());
86 QFile::remove(backupFileName()); 92 QFile::remove(backupFileName());
87 delete this; 93 delete this;
88} 94}
89 95
90void ListViewItemConfFile::revert() 96void ListViewItemConfFile::revert()
91{ 97{
diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp
index 6ef1043..4b04c97 100644
--- a/noncore/apps/confedit/mainwindow.cpp
+++ b/noncore/apps/confedit/mainwindow.cpp
@@ -2,52 +2,55 @@
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 10// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
11 11
12 12
13#include "mainwindow.h" 13#include "mainwindow.h"
14#include "listviewconfdir.h"
15#include "listviewitemconfigentry.h"
14 16
17/* OPIE */
18#include <opie2/odebug.h>
19using namespace Opie::Core;
20
21/* QT */
15#include <qlabel.h> 22#include <qlabel.h>
16#include <qlayout.h> 23#include <qlayout.h>
17#include <qlineedit.h> 24#include <qlineedit.h>
18 25
19#include "listviewconfdir.h"
20#include "listviewitemconfigentry.h"
21
22
23MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 26MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
24 QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0) 27 QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0)
25{ 28{
26 setCaption( tr("Conf File Editor") ); 29 setCaption( tr("Conf File Editor") );
27 30
28 //setBaseSize( qApp->globalStrut() ); 31 //setBaseSize( qApp->globalStrut() );
29 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); 32 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) );
30 33
31 mainLayout = new QVBoxLayout( this ); 34 mainLayout = new QVBoxLayout( this );
32 mainLayout->setSpacing( 0 ); 35 mainLayout->setSpacing( 0 );
33 mainLayout->setMargin( 0 ); 36 mainLayout->setMargin( 0 );
34 37
35 38
36 qDebug("creating settingList"); 39 odebug << "creating settingList" << oendl;
37 settingList = new ListViewConfDir( QDir::homeDirPath() + "/Settings", this, "settingslist"); 40 settingList = new ListViewConfDir( QDir::homeDirPath() + "/Settings", this, "settingslist");
38 settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); 41 settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) );
39 mainLayout->addWidget( settingList, 0); 42 mainLayout->addWidget( settingList, 0);
40 43
41 qDebug("creating editor"); 44 odebug << "creating editor" << oendl;
42 editor = new EditWidget(this); 45 editor = new EditWidget(this);
43 editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) ); 46 editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) );
44 mainLayout->addWidget( editor, 1 ); 47 mainLayout->addWidget( editor, 1 );
45 editor->layoutType( ListViewItemConf::File ); 48 editor->layoutType( ListViewItemConf::File );
46 49
47 makeMenu(); 50 makeMenu();
48 51
49 connect(settingList, SIGNAL( pressed(QListViewItem*) ), 52 connect(settingList, SIGNAL( pressed(QListViewItem*) ),
50 this, SLOT(setCurrent(QListViewItem*))); 53 this, SLOT(setCurrent(QListViewItem*)));
51 connect( settingList, SIGNAL( clicked(QListViewItem*) ), 54 connect( settingList, SIGNAL( clicked(QListViewItem*) ),
52 this, SLOT( stopTimer(QListViewItem*) ) ); 55 this, SLOT( stopTimer(QListViewItem*) ) );
53 56
@@ -89,25 +92,25 @@ void MainWindow::makeMenu()
89 connect( popupTimer, SIGNAL(timeout()), 92 connect( popupTimer, SIGNAL(timeout()),
90 this, SLOT(showPopup()) ); 93 this, SLOT(showPopup()) );
91} 94}
92 95
93MainWindow::~MainWindow() 96MainWindow::~MainWindow()
94{ 97{
95} 98}
96 99
97 100
98 101
99void MainWindow::setCurrent(QListViewItem *item) 102void MainWindow::setCurrent(QListViewItem *item)
100{ 103{
101 //qDebug("MainWindow::setCurrent"); 104 //odebug << "MainWindow::setCurrent" << oendl;
102 if (!item) return; 105 if (!item) return;
103 _item = (ListViewItemConf*) item; 106 _item = (ListViewItemConf*) item;
104 if (!_item) return; 107 if (!_item) return;
105 popupTimer->start( 750, true ); 108 popupTimer->start( 750, true );
106 if (_item->getType() == ListViewItemConf::File) 109 if (_item->getType() == ListViewItemConf::File)
107 { 110 {
108 editor->layoutType(EditWidget::File); 111 editor->layoutType(EditWidget::File);
109 _currentItem=0; 112 _currentItem=0;
110 _fileItem = (ListViewItemConfFile*)item; 113 _fileItem = (ListViewItemConfFile*)item;
111 return; 114 return;
112 } 115 }
113 _fileItem = 0; 116 _fileItem = 0;
@@ -165,25 +168,25 @@ void MainWindow::revertConfFile()
165 if (!_item) return; 168 if (!_item) return;
166 _item->revert(); 169 _item->revert();
167} 170}
168 171
169void MainWindow::removeConfFile() 172void MainWindow::removeConfFile()
170{ 173{
171 if (!_item) return; 174 if (!_item) return;
172 _item->remove(); 175 _item->remove();
173} 176}
174 177
175void MainWindow::showPopup() 178void MainWindow::showPopup()
176{ 179{
177qDebug("showPopup"); 180odebug << "showPopup" << oendl;
178 if (!_item) return; 181 if (!_item) return;
179 popupActionRevert->setEnabled(_item->revertable()); 182 popupActionRevert->setEnabled(_item->revertable());
180 popupActionSave->setEnabled(_item->isChanged()); 183 popupActionSave->setEnabled(_item->isChanged());
181 if (_fileItem) 184 if (_fileItem)
182 { 185 {
183 popupActionSave->setEnabled(_fileItem->isChanged()); 186 popupActionSave->setEnabled(_fileItem->isChanged());
184 popupMenuFile->popup( QCursor::pos() ); 187 popupMenuFile->popup( QCursor::pos() );
185 }else if(_currentItem) 188 }else if(_currentItem)
186 { 189 {
187 popupMenuEntry->popup( QCursor::pos() ); 190 popupMenuEntry->popup( QCursor::pos() );
188 } 191 }
189} 192}
diff --git a/noncore/apps/keyz-cfg/cfgfile.cpp b/noncore/apps/keyz-cfg/cfgfile.cpp
index b0dc968..81d1ee1 100644
--- a/noncore/apps/keyz-cfg/cfgfile.cpp
+++ b/noncore/apps/keyz-cfg/cfgfile.cpp
@@ -1,15 +1,21 @@
1#include <qmessagebox.h>
2#include "cfgfile.h" 1#include "cfgfile.h"
3 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
7/* QT */
8#include <qmessagebox.h>
9
4// CfgEntry implementation 10// CfgEntry implementation
5CfgEntry::CfgEntry() { 11CfgEntry::CfgEntry() {
6} 12}
7 13
8CfgEntry::CfgEntry(const QString& f, const QString& l): 14CfgEntry::CfgEntry(const QString& f, const QString& l):
9 file(f), label(l) { 15 file(f), label(l) {
10} 16}
11 17
12const QString& CfgEntry::getFile() const { 18const QString& CfgEntry::getFile() const {
13 return file; 19 return file;
14} 20}
15 21
@@ -86,36 +92,36 @@ bool CfgParser::load(QString file, CfgFile& cfg) {
86 QXmlSimpleReader reader; 92 QXmlSimpleReader reader;
87 CfgHandler p(*this); 93 CfgHandler p(*this);
88 94
89 reader.setErrorHandler(this); 95 reader.setErrorHandler(this);
90 reader.setContentHandler(&p); 96 reader.setContentHandler(&p);
91 97
92 err = ""; 98 err = "";
93 ardelay = -1; 99 ardelay = -1;
94 arperiod = -1; 100 arperiod = -1;
95 reader.parse(is); 101 reader.parse(is);
96 102
97 if (!err.isEmpty()) { 103 if (!err.isEmpty()) {
98 qDebug(err); 104 odebug << err << oendl;
99 return false; 105 return false;
100 } 106 }
101 107
102 QMap<QString, QString>::Iterator fit, lit; 108 QMap<QString, QString>::Iterator fit, lit;
103 for(uint i = 0; i < includeList.count(); i++) { 109 for(uint i = 0; i < includeList.count(); i++) {
104 QString file = *includeList.at(i); 110 QString file = *includeList.at(i);
105 fit = includes.find(file); 111 fit = includes.find(file);
106 QString prefix = fit.data(); 112 QString prefix = fit.data();
107 QString label = ""; 113 QString label = "";
108 114
109 qDebug("include: file=" + fit.key() + ", prefix=" + fit.data()); 115 odebug << "include: file=" + fit.key() + ", prefix=" + fit.data() << oendl;
110 lit = labels.find(prefix+":*"); 116 lit = labels.find(prefix+":*");
111 if (lit != labels.end()) { 117 if (lit != labels.end()) {
112 label = lit.data(); 118 label = lit.data();
113 } 119 }
114 120
115 cfg.replaceEntry(file, label); 121 cfg.replaceEntry(file, label);
116 } 122 }
117 123
118 if (ardelay != -1) { 124 if (ardelay != -1) {
119 cfg.setAutorepeatDelay(ardelay); 125 cfg.setAutorepeatDelay(ardelay);
120 } 126 }
121 127
diff --git a/noncore/apps/keyz-cfg/config.in b/noncore/apps/keyz-cfg/config.in
index 29a10f5..8e1be2d 100644
--- a/noncore/apps/keyz-cfg/config.in
+++ b/noncore/apps/keyz-cfg/config.in
@@ -1,4 +1,4 @@
1 config KEYZCFG 1 config KEYZCFG
2 boolean "keyz-cfg (configuration tool for keyz applet)" 2 boolean "keyz-cfg (configuration tool for keyz applet)"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/noncore/apps/keyz-cfg/keyz-cfg.pro b/noncore/apps/keyz-cfg/keyz-cfg.pro
index 44bbb5f..7ac604b 100644
--- a/noncore/apps/keyz-cfg/keyz-cfg.pro
+++ b/noncore/apps/keyz-cfg/keyz-cfg.pro
@@ -1,24 +1,24 @@
1TEMPLATE = app 1TEMPLATE = app
2DESTDIR = $(OPIEDIR)/bin 2DESTDIR = $(OPIEDIR)/bin
3 CONFIG = qt warn_on 3 CONFIG = qt warn_on
4 HEADERS = zkb.h \ 4 HEADERS = zkb.h \
5 zkbcfg.h \ 5 zkbcfg.h \
6 zkbnames.h \ 6 zkbnames.h \
7 zkbxml.h \ 7 zkbxml.h \
8 cfgdlg.h \ 8 cfgdlg.h \
9 cfgfile.h 9 cfgfile.h
10 10
11 SOURCES = main.cpp \ 11 SOURCES = main.cpp \
12 cfgdlg.cpp \ 12 cfgdlg.cpp \
13 cfgfile.cpp \ 13 cfgfile.cpp \
14 zkb.cpp \ 14 zkb.cpp \
15 zkbcfg.cpp \ 15 zkbcfg.cpp \
16 zkbnames.cpp \ 16 zkbnames.cpp \
17 zkbxml.cpp 17 zkbxml.cpp
18 18
19INCLUDEPATH += $(OPIEDIR)/include 19INCLUDEPATH += $(OPIEDIR)/include
20DEPENDPATH += $(OPIEDIR)/include 20DEPENDPATH += $(OPIEDIR)/include
21 LIBS += -lqpe 21 LIBS += -lqpe -lopiecore2
22 TARGET = keyz-cfg 22 TARGET = keyz-cfg
23 23
24include ( $(OPIEDIR)/include.pro ) 24include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/keyz-cfg/zkb.cpp b/noncore/apps/keyz-cfg/zkb.cpp
index f315d4b..8382615 100644
--- a/noncore/apps/keyz-cfg/zkb.cpp
+++ b/noncore/apps/keyz-cfg/zkb.cpp
@@ -355,25 +355,25 @@ State* Keymap::getStateByLabel(const QString& label) {
355 QString name = lit.data(); 355 QString name = lit.data();
356 356
357 int n = name.find(":*"); 357 int n = name.find(":*");
358 if (n>=0 && n==(int)(name.length()-2)) { 358 if (n>=0 && n==(int)(name.length()-2)) {
359 name=name.left(name.length() - 1); 359 name=name.left(name.length() - 1);
360 360
361 n = currentStateName.findRev(":"); 361 n = currentStateName.findRev(":");
362 if (n >= 0) { 362 if (n >= 0) {
363 name += currentStateName.mid(n+1); 363 name += currentStateName.mid(n+1);
364 } 364 }
365 } 365 }
366 366
367 //qDebug("look for: %s\n", (const char*) name.utf8()); 367 //odebug << "look for: " << (const char*) name.utf8() << "\n" << oendl;
368 QMap<QString, State*>::Iterator sit = states.find(name); 368 QMap<QString, State*>::Iterator sit = states.find(name);
369 if (sit != states.end()) { 369 if (sit != states.end()) {
370 state = sit.data(); 370 state = sit.data();
371 } 371 }
372 372
373 return state; 373 return state;
374} 374}
375 375
376bool Keymap::addState(const QString& name, State* state) { 376bool Keymap::addState(const QString& name, State* state) {
377 if (states.find(name) != states.end()) { 377 if (states.find(name) != states.end()) {
378 return false; 378 return false;
379 } 379 }
@@ -407,25 +407,25 @@ bool Keymap::setCurrentState(State* state) {
407 qDebug("state changed: %s\n", (const char*) 407 qDebug("state changed: %s\n", (const char*)
408 currentStateName.utf8()); 408 currentStateName.utf8());
409 409
410 if (!lsmapInSync) { 410 if (!lsmapInSync) {
411 generateLabelStateMaps(); 411 generateLabelStateMaps();
412 } 412 }
413 413
414 QMap<State*, QString>::Iterator tit; 414 QMap<State*, QString>::Iterator tit;
415 tit = stateLabelMap.find(state); 415 tit = stateLabelMap.find(state);
416 if (tit != stateLabelMap.end()) { 416 if (tit != stateLabelMap.end()) {
417 currentLabel = tit.data(); 417 currentLabel = tit.data();
418 } else { 418 } else {
419 // qDebug("no label for: " + currentStateName + "\n"); 419 // odebug << "no label for: " + currentStateName + "\n" << oendl;
420 currentLabel = ""; 420 currentLabel = "";
421 } 421 }
422 422
423 return true; 423 return true;
424 } 424 }
425 } 425 }
426 426
427 return false; 427 return false;
428} 428}
429 429
430bool Keymap::removeState(const QString& name, bool force) { 430bool Keymap::removeState(const QString& name, bool force) {
431 QMap<QString, State*>::Iterator it = states.find(name); 431 QMap<QString, State*>::Iterator it = states.find(name);
diff --git a/noncore/apps/keyz-cfg/zkbcfg.cpp b/noncore/apps/keyz-cfg/zkbcfg.cpp
index 0992b9a..f1d53ba 100644
--- a/noncore/apps/keyz-cfg/zkbcfg.cpp
+++ b/noncore/apps/keyz-cfg/zkbcfg.cpp
@@ -1,46 +1,49 @@
1#include <qfileinfo.h>
2
3#include "zkbcfg.h" 1#include "zkbcfg.h"
4 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
7/* QT */
8#include <qfileinfo.h>
5 9
6// Implementation of XkbConfig class 10// Implementation of XkbConfig class
7ZkbConfig::ZkbConfig(const QString& dir):path(dir) { 11ZkbConfig::ZkbConfig(const QString& dir):path(dir) {
8} 12}
9 13
10ZkbConfig::~ZkbConfig() { 14ZkbConfig::~ZkbConfig() {
11} 15}
12 16
13bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) { 17bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) {
14 bool ret; 18 bool ret;
15 QFile f(path+"/"+file); 19 QFile f(path+"/"+file);
16 QFileInfo fi(f); 20 QFileInfo fi(f);
17 21
18 qDebug("start loading file=%s\n", (const char*) file.utf8()); 22 odebug << "start loading file=" << (const char*) file.utf8() << "\n" << oendl;
19 if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) { 23 if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) {
20 return false; 24 return false;
21 } 25 }
22 26
23 includedFiles.insert(fi.absFilePath(), 1); 27 includedFiles.insert(fi.absFilePath(), 1);
24 QXmlInputSource is(f); 28 QXmlInputSource is(f);
25 QXmlSimpleReader reader; 29 QXmlSimpleReader reader;
26 ZkbHandler h(*this, keymap, prefix); 30 ZkbHandler h(*this, keymap, prefix);
27 31
28 reader.setContentHandler(&h); 32 reader.setContentHandler(&h);
29 reader.setErrorHandler(this); 33 reader.setErrorHandler(this);
30 ret = reader.parse(is); 34 ret = reader.parse(is);
31 includedFiles.remove(fi.absFilePath()); 35 includedFiles.remove(fi.absFilePath());
32 36
33 qDebug("end loading file=%s : status=%s\n", (const char*) file.utf8(), 37 odebug << "end loading file=" << file.utf8() << ": status=" << err.utf8() << oendl;
34 (const char*) err.utf8());
35 return ret; 38 return ret;
36} 39}
37 40
38bool ZkbConfig::warning(const QXmlParseException& e) { 41bool ZkbConfig::warning(const QXmlParseException& e) {
39 QString tmp; 42 QString tmp;
40 43
41 tmp.sprintf("%d: warning: %s\n", e.lineNumber(), 44 tmp.sprintf("%d: warning: %s\n", e.lineNumber(),
42 (const char*) e.message().utf8()); 45 (const char*) e.message().utf8());
43 46
44 err += tmp; 47 err += tmp;
45 48
46 return true; 49 return true;
@@ -113,25 +116,25 @@ bool ZkbHandler::startLabelElement(const QString& label,
113 return false; 116 return false;
114 } 117 }
115 118
116 return true; 119 return true;
117} 120}
118 121
119bool ZkbHandler::startStateElement(const QString& name, 122bool ZkbHandler::startStateElement(const QString& name,
120 const QString& parentName, bool dflt) { 123 const QString& parentName, bool dflt) {
121 124
122 currentStateName = prefix + name; 125 currentStateName = prefix + name;
123 currentState = keymap.getStateByName(currentStateName); 126 currentState = keymap.getStateByName(currentStateName);
124 127
125 //qDebug("state name=%s\n", (const char*) currentStateName.utf8()); 128 //odebug << "state name=" << (const char*) currentStateName.utf8() << "\n" << oendl;
126 129
127 State* parent = 0; 130 State* parent = 0;
128 if (!parentName.isEmpty()) { 131 if (!parentName.isEmpty()) {
129 QString pn = prefix + parentName; 132 QString pn = prefix + parentName;
130 parent = keymap.getStateByName(pn); 133 parent = keymap.getStateByName(pn);
131 if (parent == 0) { 134 if (parent == 0) {
132 err = currentStateName + 135 err = currentStateName +
133 ": undefined parent state: " + pn; 136 ": undefined parent state: " + pn;
134 return false; 137 return false;
135 } 138 }
136 } 139 }
137 140
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp
index e6cb515..59fc242 100644
--- a/noncore/apps/opie-bartender/bartender.cpp
+++ b/noncore/apps/opie-bartender/bartender.cpp
@@ -7,49 +7,52 @@
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12 12
13#include "bartender.h" 13#include "bartender.h"
14#include "showdrinks.h" 14#include "showdrinks.h"
15#include "inputDialog.h" 15#include "inputDialog.h"
16#include "searchresults.h" 16#include "searchresults.h"
17#include "bac.h" 17#include "bac.h"
18 18
19#include <qtoolbar.h> 19/* OPIE */
20#include <qmenubar.h> 20#include <opie2/odebug.h>
21//#include <opie2/colorpopupmenu.h>
22#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
23#include <qpe/resource.h> 22#include <qpe/resource.h>
23using namespace Opie::Core;
24 24
25/* QT */
25#include <qlineedit.h> 26#include <qlineedit.h>
26#include <qdir.h> 27#include <qdir.h>
27#include <qpushbutton.h> 28#include <qpushbutton.h>
28#include <qlistbox.h> 29#include <qlistbox.h>
29#include <qmultilineedit.h> 30#include <qmultilineedit.h>
30#include <qmessagebox.h> 31#include <qmessagebox.h>
31#include <qtextstream.h> 32#include <qtextstream.h>
32#include <qaction.h> 33#include <qaction.h>
33#include <qheader.h> 34#include <qheader.h>
34#include <qlistview.h> 35#include <qlistview.h>
35#include <qlayout.h> 36#include <qlayout.h>
37#include <qtoolbar.h>
38#include <qmenubar.h>
36 39
40/* STD */
37#include <fcntl.h> 41#include <fcntl.h>
38#include <unistd.h> 42#include <unistd.h>
39#include <stdlib.h> 43#include <stdlib.h>
40#include <stdio.h> 44#include <stdio.h>
41#include <errno.h> 45#include <errno.h>
42 46
43
44Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) 47Bartender::Bartender( QWidget* parent, const char* name, WFlags fl )
45 : QMainWindow( parent, name, fl ) { 48 : QMainWindow( parent, name, fl ) {
46 if ( !name ) 49 if ( !name )
47 setName( "Bartender" ); 50 setName( "Bartender" );
48 QGridLayout *layout = new QGridLayout( this ); 51 QGridLayout *layout = new QGridLayout( this );
49 layout->setSpacing( 2); 52 layout->setSpacing( 2);
50 layout->setMargin( 2); 53 layout->setMargin( 2);
51 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 54 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
52 55
53 setCaption( tr( "Bartender" ) ); 56 setCaption( tr( "Bartender" ) );
54 57
55 ToolBar1 = new QToolBar( this, "ToolBar1" ); 58 ToolBar1 = new QToolBar( this, "ToolBar1" );
@@ -135,52 +138,52 @@ void Bartender::initDrinkDb() {
135} 138}
136 139
137void Bartender::fillList() { 140void Bartender::fillList() {
138 dbFile.at(1); 141 dbFile.at(1);
139 DrinkView->clear(); 142 DrinkView->clear();
140 int i=0; 143 int i=0;
141 QListViewItem * item ; 144 QListViewItem * item ;
142 QTextStream t( &dbFile); 145 QTextStream t( &dbFile);
143 QString s; 146 QString s;
144 while ( !t.eof()) { 147 while ( !t.eof()) {
145 s = t.readLine(); 148 s = t.readLine();
146 if(s.find("#",0,TRUE) != -1) { 149 if(s.find("#",0,TRUE) != -1) {
147// qDebug(s.right(s.length()-2)); 150// odebug << s.right(s.length()-2) << oendl;
148 item= new QListViewItem( DrinkView, 0 ); 151 item= new QListViewItem( DrinkView, 0 );
149 item->setText( 0, s.right(s.length()-2)); 152 item->setText( 0, s.right(s.length()-2));
150 i++; 153 i++;
151 } 154 }
152 } 155 }
153 qDebug("there are currently %d of drinks", i); 156 odebug << "there are currently " << i << " of drinks" << oendl;
154} 157}
155 158
156void Bartender::fileNew() { 159void Bartender::fileNew() {
157 160
158 New_Drink *newDrinks; 161 New_Drink *newDrinks;
159 newDrinks = new New_Drink(this,"New Drink....", TRUE); 162 newDrinks = new New_Drink(this,"New Drink....", TRUE);
160 QString newName, newIng; 163 QString newName, newIng;
161 QPEApplication::execDialog( newDrinks ); 164 QPEApplication::execDialog( newDrinks );
162 newName = newDrinks->LineEdit1->text(); 165 newName = newDrinks->LineEdit1->text();
163 newIng= newDrinks->MultiLineEdit1->text(); 166 newIng= newDrinks->MultiLineEdit1->text();
164 167
165 if(dbFile.isOpen()) 168 if(dbFile.isOpen())
166 dbFile.close(); 169 dbFile.close();
167 if ( !dbFile.open( IO_WriteOnly| IO_Append)) { 170 if ( !dbFile.open( IO_WriteOnly| IO_Append)) {
168 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); 171 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) );
169 return; 172 return;
170 } 173 }
171 if(newDrinks ->result() == 1 ) { 174 if(newDrinks ->result() == 1 ) {
172 QString newDrink="\n# "+newName+"\n"; 175 QString newDrink="\n# "+newName+"\n";
173 newDrink.append(newIng+"\n"); 176 newDrink.append(newIng+"\n");
174 qDebug("writing "+newDrink); 177 odebug << "writing "+newDrink << oendl;
175 dbFile.writeBlock( newDrink.latin1(), newDrink.length()); 178 dbFile.writeBlock( newDrink.latin1(), newDrink.length());
176 clearList(); 179 clearList();
177 dbFile.close(); 180 dbFile.close();
178 181
179 initDrinkDb(); 182 initDrinkDb();
180 } 183 }
181 delete newDrinks; 184 delete newDrinks;
182} 185}
183 186
184void Bartender::showDrink(int mouse, QListViewItem * item, const QPoint&, int) { 187void Bartender::showDrink(int mouse, QListViewItem * item, const QPoint&, int) {
185 switch (mouse) { 188 switch (mouse) {
186 case 1: 189 case 1:
@@ -198,25 +201,25 @@ void Bartender::showDrink( QListViewItem *item) {
198 Show_Drink *showDrinks; 201 Show_Drink *showDrinks;
199 QString myDrink=item->text(0); 202 QString myDrink=item->text(0);
200 showDrinks = new Show_Drink(this, myDrink, TRUE); 203 showDrinks = new Show_Drink(this, myDrink, TRUE);
201 QTextStream t( &dbFile); 204 QTextStream t( &dbFile);
202 205
203 QString s, s2; 206 QString s, s2;
204 while ( !t.eof()) { 207 while ( !t.eof()) {
205 s = t.readLine(); 208 s = t.readLine();
206 if(s.find( myDrink, 0, TRUE) != -1) { 209 if(s.find( myDrink, 0, TRUE) != -1) {
207 for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { 210 for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) {
208 s2 = t.readLine(); 211 s2 = t.readLine();
209 if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { 212 if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) {
210// qDebug(s2); 213// odebug << s2 << oendl;
211 showDrinks->MultiLineEdit1->append(s2); 214 showDrinks->MultiLineEdit1->append(s2);
212 } 215 }
213 if( dbFile.atEnd() ) break; 216 if( dbFile.atEnd() ) break;
214 } 217 }
215 } 218 }
216 } 219 }
217 QPEApplication::execDialog( showDrinks ); 220 QPEApplication::execDialog( showDrinks );
218 221
219 if(showDrinks ->result() ==0) { 222 if(showDrinks ->result() ==0) {
220 doEdit(); 223 doEdit();
221 } 224 }
222 delete showDrinks; 225 delete showDrinks;
@@ -239,25 +242,25 @@ void Bartender::askSearch() {
239void Bartender::doSearchByName() { 242void Bartender::doSearchByName() {
240// if( DrinkView->currentItem() == NULL) return; 243// if( DrinkView->currentItem() == NULL) return;
241 QStringList searchList; 244 QStringList searchList;
242 QString searchForDrinkName; 245 QString searchForDrinkName;
243 InputDialog *fileDlg; 246 InputDialog *fileDlg;
244 fileDlg = new InputDialog(this,tr("Find by Drink Name"),TRUE, 0); 247 fileDlg = new InputDialog(this,tr("Find by Drink Name"),TRUE, 0);
245 fileDlg->exec(); 248 fileDlg->exec();
246 if( fileDlg->result() == 1 ) { 249 if( fileDlg->result() == 1 ) {
247 searchForDrinkName = fileDlg->LineEdit1->text(); 250 searchForDrinkName = fileDlg->LineEdit1->text();
248 QListViewItemIterator it( DrinkView ); 251 QListViewItemIterator it( DrinkView );
249 for ( ; it.current(); ++it ) { 252 for ( ; it.current(); ++it ) {
250 if ( it.current()->text(0).find( searchForDrinkName, 0, TRUE) != -1 ) { 253 if ( it.current()->text(0).find( searchForDrinkName, 0, TRUE) != -1 ) {
251// qDebug( it.current()->text(0)); 254// odebug << it.current()->text(0) << oendl;
252 searchList.append(it.current()->text(0)); 255 searchList.append(it.current()->text(0));
253 } 256 }
254 } 257 }
255 if(searchList.count() >0) 258 if(searchList.count() >0)
256 showSearchResult(searchList); 259 showSearchResult(searchList);
257 else 260 else
258 QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+searchForDrinkName); 261 QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+searchForDrinkName);
259 }//end Inputdialog 262 }//end Inputdialog
260 delete fileDlg; 263 delete fileDlg;
261} 264}
262 265
263void Bartender::doSearchByDrink() { 266void Bartender::doSearchByDrink() {
@@ -270,28 +273,28 @@ void Bartender::doSearchByDrink() {
270 fileDlg->exec(); 273 fileDlg->exec();
271 if( fileDlg->result() == 1 ) { 274 if( fileDlg->result() == 1 ) {
272 searchForDrinkName = fileDlg->LineEdit1->text(); 275 searchForDrinkName = fileDlg->LineEdit1->text();
273 276
274 dbFile.at(0); 277 dbFile.at(0);
275 QTextStream t( &dbFile); 278 QTextStream t( &dbFile);
276 279
277 QString s, s2; 280 QString s, s2;
278 while ( !t.eof()) { 281 while ( !t.eof()) {
279 s = t.readLine(); 282 s = t.readLine();
280 if(s.find("#",0,TRUE) != -1) { 283 if(s.find("#",0,TRUE) != -1) {
281 lastDrinkName=s.right(s.length()-2); 284 lastDrinkName=s.right(s.length()-2);
282// qDebug("last drink name "+lastDrinkName); 285// odebug << "last drink name "+lastDrinkName << oendl;
283 } 286 }
284 else if( s.find( searchForDrinkName ,0, FALSE) != -1 && lastDrinkName != tempName ) { 287 else if( s.find( searchForDrinkName ,0, FALSE) != -1 && lastDrinkName != tempName ) {
285// qDebug("appending "+lastDrinkName); 288// odebug << "appending "+lastDrinkName << oendl;
286 searchList.append( lastDrinkName); 289 searchList.append( lastDrinkName);
287 tempName=lastDrinkName; 290 tempName=lastDrinkName;
288 } 291 }
289// if( dbFile.atEnd() ) break; 292// if( dbFile.atEnd() ) break;
290 293
291 } //oef 294 } //oef
292 if(searchList.count() >0) 295 if(searchList.count() >0)
293 showSearchResult(searchList); 296 showSearchResult(searchList);
294 else 297 else
295 QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+ searchForDrinkName); 298 QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+ searchForDrinkName);
296 } 299 }
297 delete fileDlg; 300 delete fileDlg;
@@ -304,25 +307,25 @@ void Bartender::showSearchResult(QStringList &searchList) {
304 searchList.sort(); 307 searchList.sort();
305 308
306 searchDlg = new Search_Results(this, "Search Results", TRUE); 309 searchDlg = new Search_Results(this, "Search Results", TRUE);
307 searchDlg->ListBox1->insertStringList( searchList,-1); 310 searchDlg->ListBox1->insertStringList( searchList,-1);
308 QPEApplication::execDialog( searchDlg ); 311 QPEApplication::execDialog( searchDlg );
309 312
310 if( searchDlg->result() == 1 ) { 313 if( searchDlg->result() == 1 ) {
311 result= searchDlg->ListBox1->currentText(); 314 result= searchDlg->ListBox1->currentText();
312 } 315 }
313 QListViewItemIterator it2( DrinkView ); 316 QListViewItemIterator it2( DrinkView );
314 for ( ; it2.current(); ++it2 ) { 317 for ( ; it2.current(); ++it2 ) {
315 if ( it2.current()->text(0)== result ) { 318 if ( it2.current()->text(0)== result ) {
316// qDebug( it2.current()->text(0)); 319// odebug << it2.current()->text(0) << oendl;
317 showDrink(it2.current()); 320 showDrink(it2.current());
318 } 321 }
319 } 322 }
320delete searchDlg; 323delete searchDlg;
321} 324}
322 325
323void Bartender::doEdit() { 326void Bartender::doEdit() {
324 if(DrinkView->currentItem() == NULL) { 327 if(DrinkView->currentItem() == NULL) {
325 fileNew(); 328 fileNew();
326 } 329 }
327 330
328 QString myDrink; 331 QString myDrink;
@@ -334,25 +337,25 @@ void Bartender::doEdit() {
334 QString newName, newIng; 337 QString newName, newIng;
335 QPEApplication::showDialog( newDrinks ); 338 QPEApplication::showDialog( newDrinks );
336 QTextStream t( &dbFile); 339 QTextStream t( &dbFile);
337 340
338 QString s, s2; 341 QString s, s2;
339 while ( !t.eof()) { 342 while ( !t.eof()) {
340 s = t.readLine(); 343 s = t.readLine();
341 if(s.find( myDrink, 0, TRUE) != -1) { 344 if(s.find( myDrink, 0, TRUE) != -1) {
342 foundAt = dbFile.at() - (s.length()+1); 345 foundAt = dbFile.at() - (s.length()+1);
343 for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { 346 for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) {
344 s2 = t.readLine(); 347 s2 = t.readLine();
345 if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { 348 if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) {
346// qDebug(s2); 349// odebug << s2 << oendl;
347 newDrinks->MultiLineEdit1->append(s2); 350 newDrinks->MultiLineEdit1->append(s2);
348 newDrinks->LineEdit1->setText(myDrink); 351 newDrinks->LineEdit1->setText(myDrink);
349 } 352 }
350 if( dbFile.atEnd() ) break; 353 if( dbFile.atEnd() ) break;
351 } 354 }
352 } 355 }
353 } 356 }
354 newDrinks->exec(); 357 newDrinks->exec();
355 newName = newDrinks->LineEdit1->text(); 358 newName = newDrinks->LineEdit1->text();
356 newIng= newDrinks->MultiLineEdit1->text(); 359 newIng= newDrinks->MultiLineEdit1->text();
357 360
358 if( newDrinks ->result() == 1 ) { 361 if( newDrinks ->result() == 1 ) {
@@ -361,25 +364,25 @@ void Bartender::doEdit() {
361 if ( !dbFile.open( IO_ReadWrite )) { 364 if ( !dbFile.open( IO_ReadWrite )) {
362 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); 365 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) );
363 return; 366 return;
364 } 367 }
365 int fd = dbFile.handle(); 368 int fd = dbFile.handle();
366 lseek( fd, foundAt, SEEK_SET); 369 lseek( fd, foundAt, SEEK_SET);
367 370
368// dbFile.at( foundAt); 371// dbFile.at( foundAt);
369#warning FIXME problems with editing drinks db 372#warning FIXME problems with editing drinks db
370 ////////// FIXME write to user file 373 ////////// FIXME write to user file
371 QString newDrink="# "+newName+"\n"; 374 QString newDrink="# "+newName+"\n";
372 newDrink.append(newIng+"\n"); 375 newDrink.append(newIng+"\n");
373 qDebug("writing "+newDrink); 376 odebug << "writing "+newDrink << oendl;
374 dbFile.writeBlock( newDrink.latin1(), newDrink.length()); 377 dbFile.writeBlock( newDrink.latin1(), newDrink.length());
375 clearList(); 378 clearList();
376 379
377 dbFile.flush(); 380 dbFile.flush();
378 381
379 initDrinkDb(); 382 initDrinkDb();
380 } 383 }
381} 384}
382 385
383void Bartender::clearList() { 386void Bartender::clearList() {
384 DrinkView->clear(); 387 DrinkView->clear();
385} 388}
@@ -388,45 +391,45 @@ void Bartender::doBac() {
388 BacDialog *bacDlg; 391 BacDialog *bacDlg;
389 bacDlg = new BacDialog(this,"BAC",TRUE); 392 bacDlg = new BacDialog(this,"BAC",TRUE);
390 QPEApplication::execDialog( bacDlg ); 393 QPEApplication::execDialog( bacDlg );
391 delete bacDlg; 394 delete bacDlg;
392} 395}
393 396
394void Bartender::openCurrentDrink() { 397void Bartender::openCurrentDrink() {
395 if(DrinkView->currentItem() == NULL) return; 398 if(DrinkView->currentItem() == NULL) return;
396 showDrink(DrinkView->currentItem()); 399 showDrink(DrinkView->currentItem());
397} 400}
398 401
399void Bartender::fileMenuActivated( int item) { 402void Bartender::fileMenuActivated( int item) {
400 qDebug("Item %d", item); 403 odebug << "Item " << item << "" << oendl;
401 switch(item) { 404 switch(item) {
402 case -3: // new -3 405 case -3: // new -3
403 fileNew(); 406 fileNew();
404 break; 407 break;
405 case -4:// open -4 408 case -4:// open -4
406 openCurrentDrink(); 409 openCurrentDrink();
407 break; 410 break;
408 case -5:// drink -5 411 case -5:// drink -5
409 doSearchByName(); 412 doSearchByName();
410 413
411 break; 414 break;
412 case -6:// alcohol -6 415 case -6:// alcohol -6
413 doSearchByDrink(); 416 doSearchByDrink();
414 417
415 break; 418 break;
416 419
417 } 420 }
418} 421}
419 422
420void Bartender::editMenuActivated(int item) { 423void Bartender::editMenuActivated(int item) {
421 qDebug("Item %d", item); 424 odebug << "Item " << item << "" << oendl;
422 /* 425 /*
423 edit -8 426 edit -8
424 */ 427 */
425 switch(item) { 428 switch(item) {
426 case -8: 429 case -8:
427 doEdit() ; 430 doEdit() ;
428 break; 431 break;
429 432
430 } 433 }
431} 434}
432 435
diff --git a/noncore/apps/opie-bartender/bartender.pro b/noncore/apps/opie-bartender/bartender.pro
index 4ad3c31..41fc0e5 100644
--- a/noncore/apps/opie-bartender/bartender.pro
+++ b/noncore/apps/opie-bartender/bartender.pro
@@ -1,12 +1,11 @@
1TEMPLATE = app 1TEMPLATE = app
2#CONFIG = qt warn_on
3CONFIG = qt warn_on 2CONFIG = qt warn_on
4HEADERS = bartender.h newdrinks.h showdrinks.h inputDialog.h searchresults.h bac.h 3HEADERS = bartender.h newdrinks.h showdrinks.h inputDialog.h searchresults.h bac.h
5SOURCES = main.cpp bartender.cpp newdrinks.cpp showdrinks.cpp inputDialog.cpp searchresults.cpp bac.cpp 4SOURCES = main.cpp bartender.cpp newdrinks.cpp showdrinks.cpp inputDialog.cpp searchresults.cpp bac.cpp
6INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lqpe 7LIBS += -lqpe -lopiecore2
9DESTDIR = $(OPIEDIR)/bin 8DESTDIR = $(OPIEDIR)/bin
10TARGET = bartender 9TARGET = bartender
11 10
12include ( $(OPIEDIR)/include.pro ) 11include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/opie-bartender/config.in b/noncore/apps/opie-bartender/config.in
index c6ca2e6..c39a7d6 100644
--- a/noncore/apps/opie-bartender/config.in
+++ b/noncore/apps/opie-bartender/config.in
@@ -1,4 +1,5 @@
1 config BARTENDER 1 config BARTENDER
2 boolean "bartender - bar receipe and blood alcohol estimator" 2 boolean "bartender - bar receipe and blood alcohol estimator"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
5
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index a37f980..6d57703 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -54,59 +54,63 @@
54 other by the operating system. One may think of them as two serial devices 54 other by the operating system. One may think of them as two serial devices
55 linked by a null-modem cable. Being based on devices the number of 55 linked by a null-modem cable. Being based on devices the number of
56 simultanous instances of this class is (globally) limited by the number of 56 simultanous instances of this class is (globally) limited by the number of
57 those device pairs, which is 256. 57 those device pairs, which is 256.
58 58
59 Another technic are UNIX 98 PTY's. These are supported also, and prefered 59 Another technic are UNIX 98 PTY's. These are supported also, and prefered
60 over the (obsolete) predecessor. 60 over the (obsolete) predecessor.
61 61
62 There's a sinister ioctl(2), signal(2) and job control stuff 62 There's a sinister ioctl(2), signal(2) and job control stuff
63 nessesary to make everything work as it should. 63 nessesary to make everything work as it should.
64*/ 64*/
65 65
66#include "procctl.h"
67#include "MyPty.h"
66 68
69/* OPIE */
70#include <opie2/odebug.h>
71using namespace Opie::Core;
72
73/* QT */
67#include <qsocketnotifier.h> 74#include <qsocketnotifier.h>
68#include <qfile.h> 75#include <qfile.h>
69 76
77/* STD */
70#include <stdlib.h> 78#include <stdlib.h>
71#include <stdio.h> 79#include <stdio.h>
72#include <signal.h> 80#include <signal.h>
73#include <fcntl.h> 81#include <fcntl.h>
74#include <unistd.h> 82#include <unistd.h>
75#include <termios.h> 83#include <termios.h>
76#include <sys/types.h> 84#include <sys/types.h>
77#include <sys/ioctl.h> 85#include <sys/ioctl.h>
78#include <sys/wait.h> 86#include <sys/wait.h>
79 87
80#ifdef HAVE_OPENPTY 88#ifdef HAVE_OPENPTY
81#include <pty.h> 89#include <pty.h>
82#endif 90#endif
83 91
84#include "procctl.h"
85#include "MyPty.h"
86
87
88#undef VERBOSE_DEBUG 92#undef VERBOSE_DEBUG
89 93
90 94
91/* -------------------------------------------------------------------------- */ 95/* -------------------------------------------------------------------------- */
92 96
93/*! 97/*!
94 Informs the client program about the 98 Informs the client program about the
95 actual size of the window. 99 actual size of the window.
96*/ 100*/
97 101
98void MyPty::setSize(int lines, int columns) 102void MyPty::setSize(int lines, int columns)
99{ 103{
100 qWarning("setting size"); 104 owarn << "setting size" << oendl;
101 struct winsize wsize; 105 struct winsize wsize;
102 wsize.ws_row = (unsigned short)lines; 106 wsize.ws_row = (unsigned short)lines;
103 wsize.ws_col = (unsigned short)columns; 107 wsize.ws_col = (unsigned short)columns;
104 if(m_fd < 0) return; 108 if(m_fd < 0) return;
105 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); 109 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize);
106} 110}
107 111
108 112
109void MyPty::donePty() 113void MyPty::donePty()
110{ 114{
111 // This is code from the Qt DumbTerminal example 115 // This is code from the Qt DumbTerminal example
112 116
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp
index e535296..d168a5e 100644
--- a/noncore/apps/opie-console/TEWidget.cpp
+++ b/noncore/apps/opie-console/TEWidget.cpp
@@ -1020,25 +1020,25 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e )
1020 static_cast<QKeyEvent *>( e )->ignore(); 1020 static_cast<QKeyEvent *>( e )->ignore();
1021 return true; 1021 return true;
1022 } 1022 }
1023 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) 1023 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
1024 return FALSE; // not us 1024 return FALSE; // not us
1025 if ( e->type() == QEvent::Wheel) { 1025 if ( e->type() == QEvent::Wheel) {
1026 QApplication::sendEvent(scrollbar, e); 1026 QApplication::sendEvent(scrollbar, e);
1027 } 1027 }
1028 1028
1029#ifdef FAKE_CTRL_AND_ALT 1029#ifdef FAKE_CTRL_AND_ALT
1030 static bool control = FALSE; 1030 static bool control = FALSE;
1031 static bool alt = FALSE; 1031 static bool alt = FALSE;
1032// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); 1032// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
1033 bool dele=FALSE; 1033 bool dele=FALSE;
1034 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 1034 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
1035 QKeyEvent* ke = (QKeyEvent*)e; 1035 QKeyEvent* ke = (QKeyEvent*)e;
1036 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 1036 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
1037 switch (ke->key()) { 1037 switch (ke->key()) {
1038 case Key_F9: // let this be "Control" 1038 case Key_F9: // let this be "Control"
1039 control = keydown; 1039 control = keydown;
1040 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 1040 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
1041 dele=TRUE; 1041 dele=TRUE;
1042 break; 1042 break;
1043 case Key_F13: // let this be "Alt" 1043 case Key_F13: // let this be "Alt"
1044 alt = keydown; 1044 alt = keydown;
@@ -1059,29 +1059,29 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e )
1059 ke->ascii(), ke->state()|AltButton, ke->text()); 1059 ke->ascii(), ke->state()|AltButton, ke->text());
1060 dele=TRUE; 1060 dele=TRUE;
1061 } 1061 }
1062 } 1062 }
1063 } 1063 }
1064#endif 1064#endif
1065 1065
1066 if ( e->type() == QEvent::KeyPress ) { 1066 if ( e->type() == QEvent::KeyPress ) {
1067 QKeyEvent* ke = (QKeyEvent*)e; 1067 QKeyEvent* ke = (QKeyEvent*)e;
1068 actSel=0; // Key stroke implies a screen update, so TEWidget won't 1068 actSel=0; // Key stroke implies a screen update, so TEWidget won't
1069 // know where the current selection is. 1069 // know where the current selection is.
1070 1070
1071// qDebug("key pressed is 0x%x",ke->key()); 1071// odebug << "key pressed is 0x" << ke->key() << "" << oendl;
1072 1072
1073 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker 1073 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
1074 1074
1075// qDebug("key pressed 2 is 0x%x",ke->key()); 1075// odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl;
1076 emitText("\\"); // expose 1076 emitText("\\"); // expose
1077 } else 1077 } else
1078 emit keyPressedSignal(ke); // expose 1078 emit keyPressedSignal(ke); // expose
1079 ke->accept(); 1079 ke->accept();
1080#ifdef FAKE_CTRL_AND_ALT 1080#ifdef FAKE_CTRL_AND_ALT
1081 if ( dele ) delete e; 1081 if ( dele ) delete e;
1082#endif 1082#endif
1083 return true; // stop the event 1083 return true; // stop the event
1084 } 1084 }
1085 if ( e->type() == QEvent::Enter ) { 1085 if ( e->type() == QEvent::Enter ) {
1086 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), 1086 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
1087 this, SLOT(onClearSelection()) ); 1087 this, SLOT(onClearSelection()) );
diff --git a/noncore/apps/opie-console/TEmulation.cpp b/noncore/apps/opie-console/TEmulation.cpp
index d0169d7..6ff73af 100644
--- a/noncore/apps/opie-console/TEmulation.cpp
+++ b/noncore/apps/opie-console/TEmulation.cpp
@@ -61,24 +61,30 @@
61 producing the illusion of a permanent and immediate display operation. 61 producing the illusion of a permanent and immediate display operation.
62 62
63 As a sort of catch-all needed for cases where none of the above 63 As a sort of catch-all needed for cases where none of the above
64 conditions catch, the screen refresh is also triggered by a count 64 conditions catch, the screen refresh is also triggered by a count
65 of incoming bulks (`bulk_incnt'). 65 of incoming bulks (`bulk_incnt').
66*/ 66*/
67 67
68/* FIXME 68/* FIXME
69 - evtl. the bulk operations could be made more transparent. 69 - evtl. the bulk operations could be made more transparent.
70*/ 70*/
71 71
72#include "TEmulation.h" 72#include "TEmulation.h"
73
74/* OPIE */
75#include <opie2/odebug.h>
76using namespace Opie::Core;
77
78/* STD */
73#include <stdio.h> 79#include <stdio.h>
74#include <stdlib.h> 80#include <stdlib.h>
75#include <unistd.h> 81#include <unistd.h>
76 82
77 83
78/* ------------------------------------------------------------------------- */ 84/* ------------------------------------------------------------------------- */
79/* */ 85/* */
80/* TEmulation */ 86/* TEmulation */
81/* */ 87/* */
82/* ------------------------------------------------------------------------- */ 88/* ------------------------------------------------------------------------- */
83 89
84#define CNTL(c) ((c)-'@') 90#define CNTL(c) ((c)-'@')
@@ -195,25 +201,25 @@ void TEmulation::onRcvChar(int c)
195 201
196/* ------------------------------------------------------------------------- */ 202/* ------------------------------------------------------------------------- */
197/* */ 203/* */
198/* Keyboard Handling */ 204/* Keyboard Handling */
199/* */ 205/* */
200/* ------------------------------------------------------------------------- */ 206/* ------------------------------------------------------------------------- */
201 207
202/*! 208/*!
203*/ 209*/
204 210
205void TEmulation::onKeyPress( QKeyEvent* ev ) 211void TEmulation::onKeyPress( QKeyEvent* ev )
206{ 212{
207 qWarning("onKeyPress,...."); 213 owarn << "onKeyPress,...." << oendl;
208 if (!connected) return; // someone else gets the keys 214 if (!connected) return; // someone else gets the keys
209 if (scr->getHistCursor() != scr->getHistLines()); 215 if (scr->getHistCursor() != scr->getHistLines());
210 scr->setHistCursor(scr->getHistLines()); 216 scr->setHistCursor(scr->getHistLines());
211 if (!ev->text().isEmpty()) 217 if (!ev->text().isEmpty())
212 { // A block of text 218 { // A block of text
213 // Note that the text is proper unicode. 219 // Note that the text is proper unicode.
214 // We should do a conversion here, but since this 220 // We should do a conversion here, but since this
215 // routine will never be used, we simply emit plain ascii. 221 // routine will never be used, we simply emit plain ascii.
216 emit sndBlock(ev->text().ascii(),ev->text().length()); 222 emit sndBlock(ev->text().ascii(),ev->text().length());
217 } 223 }
218 else if (ev->ascii()>0) 224 else if (ev->ascii()>0)
219 { unsigned char c[1]; 225 { unsigned char c[1];
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp
index 8e91b9e..c998f96 100644
--- a/noncore/apps/opie-console/atconfigdialog.cpp
+++ b/noncore/apps/opie-console/atconfigdialog.cpp
@@ -1,25 +1,28 @@
1#include "atconfigdialog.h"
2#include "io_modem.h"
1 3
4/* OPIE */
5#include <opie2/odebug.h>
6using namespace Opie::Core;
7
8/* QT */
2#include <qlineedit.h> 9#include <qlineedit.h>
3#include <qspinbox.h> 10#include <qspinbox.h>
4#include <qlayout.h> 11#include <qlayout.h>
5#include <qcombobox.h> 12#include <qcombobox.h>
6#include <qtabwidget.h> 13#include <qtabwidget.h>
7#include <qlabel.h> 14#include <qlabel.h>
8#include <qscrollview.h> 15#include <qscrollview.h>
9 16
10#include "atconfigdialog.h"
11#include "io_modem.h"
12
13
14ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 17ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
15 : QDialog( parent, name, modal, fl ) { 18 : QDialog( parent, name, modal, fl ) {
16 19
17 20
18 setCaption( tr( "Dialing parameter setup" ) ); 21 setCaption( tr( "Dialing parameter setup" ) );
19 22
20 QVBoxLayout *layout = new QVBoxLayout( this ); 23 QVBoxLayout *layout = new QVBoxLayout( this );
21 QTabWidget *tabWidget = new QTabWidget( this ); 24 QTabWidget *tabWidget = new QTabWidget( this );
22 25
23 tabWidget->addTab( tab0( this ), tr("Settings1") ); 26 tabWidget->addTab( tab0( this ), tr("Settings1") );
24 tabWidget->addTab( tab1( this ), tr("Settings2") ); 27 tabWidget->addTab( tab1( this ), tr("Settings2") );
25 28
@@ -143,25 +146,25 @@ QWidget* ATConfigDialog::tab1( QWidget* parent ) {
143 multiLineUntagBox = new QComboBox( returnWidget ); 146 multiLineUntagBox = new QComboBox( returnWidget );
144 layout->addWidget( multiLineUntagLabel, 6, 0 ); 147 layout->addWidget( multiLineUntagLabel, 6, 0 );
145 layout->addWidget( multiLineUntagBox, 6, 1 ); 148 layout->addWidget( multiLineUntagBox, 6, 1 );
146 multiLineUntagBox->insertItem( tr("No") ); 149 multiLineUntagBox->insertItem( tr("No") );
147 multiLineUntagBox->insertItem( tr("Yes") ); 150 multiLineUntagBox->insertItem( tr("Yes") );
148 151
149 return returnWidget; 152 return returnWidget;
150 153
151} 154}
152 155
153 156
154void ATConfigDialog::readConfig( const Profile& config ) { 157void ATConfigDialog::readConfig( const Profile& config ) {
155 qWarning("config in atconfigdialog"); 158 owarn << "config in atconfigdialog" << oendl;
156 159
157 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); 160 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
158 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); 161 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
159 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 162 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
160 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 163 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
161 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 164 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
162 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 165 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
163 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 166 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
164 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 167 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
165 connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) ); 168 connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) );
166 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); 169 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
167 dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) ); 170 dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) );
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index 67ad10e..7010594 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -1,29 +1,34 @@
1#include "dialer.h" 1#include "dialer.h"
2#include "io_modem.h"
3
4/* OPIE */
5#include <opie2/odebug.h>
6using namespace Opie::Core;
2 7
8/* QT */
3#include <qlayout.h> 9#include <qlayout.h>
4#include <qprogressbar.h> 10#include <qprogressbar.h>
5#include <qlabel.h> 11#include <qlabel.h>
6#include <qpushbutton.h> 12#include <qpushbutton.h>
7#include <qapp.h> 13#include <qapp.h>
8#include <qtimer.h> 14#include <qtimer.h>
9#include <qmessagebox.h> 15#include <qmessagebox.h>
10 16
17/* STD */
11#include <unistd.h> 18#include <unistd.h>
12#include <string.h> 19#include <string.h>
13#include <fcntl.h> 20#include <fcntl.h>
14#include <errno.h> 21#include <errno.h>
15 22
16#include "io_modem.h"
17
18// State machine: | When an error occurs, we don't have to 23// State machine: | When an error occurs, we don't have to
19// | reset everything. 24// | reset everything.
20// (init) <------+ | But if the user wants to reset, 25// (init) <------+ | But if the user wants to reset,
21// | | | we stop dialing immediately. 26// | | | we stop dialing immediately.
22// v | | 27// v | |
23// (options) ----+ | Following the state machine is necessary 28// (options) ----+ | Following the state machine is necessary
24// | \ | to get determinable results. 29// | \ | to get determinable results.
25// v ^ | 30// v ^ |
26// (dial) ----+ | 31// (dial) ----+ |
27// | ^ | 32// | ^ |
28// v | | 33// v | |
29// (online) --+ | 34// (online) --+ |
@@ -95,25 +100,25 @@ void Dialer::slotCancel()
95 if(state != state_online) 100 if(state != state_online)
96 { 101 {
97 usercancel = 1; 102 usercancel = 1;
98 reset(); 103 reset();
99 } 104 }
100 else { 105 else {
101 accept(); 106 accept();
102 } 107 }
103} 108}
104 109
105void Dialer::reset() 110void Dialer::reset()
106{ 111{
107 qWarning("reset"); 112 owarn << "reset" << oendl;
108 switchState(state_cancel); 113 switchState(state_cancel);
109} 114}
110 115
111void Dialer::slotAutostart() 116void Dialer::slotAutostart()
112{ 117{
113 //state = state_preinit; 118 //state = state_preinit;
114 dial(m_profile.readEntry("Number")); 119 dial(m_profile.readEntry("Number"));
115} 120}
116 121
117void Dialer::dial(const QString& number) 122void Dialer::dial(const QString& number)
118{ 123{
119 while(state != state_online) 124 while(state != state_online)
@@ -127,67 +132,67 @@ void Dialer::dial(const QString& number)
127 } 132 }
128 133
129 if(usercancel) 134 if(usercancel)
130 { 135 {
131 // modem hangup 136 // modem hangup
132 trydial(QString::null); 137 trydial(QString::null);
133 reject(); 138 reject();
134 } 139 }
135} 140}
136 141
137void Dialer::trydial(const QString& number) 142void Dialer::trydial(const QString& number)
138{ 143{
139 qWarning("TryDial:%s", number.latin1() ); 144 owarn << "TryDial:" << number.latin1() << "" << oendl;
140 if(state != state_cancel) switchState(state_preinit); 145 if(state != state_cancel) switchState(state_preinit);
141 if(cleanshutdown) 146 if(cleanshutdown)
142 { 147 {
143 qWarning("HangupString " + m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING)); 148 owarn << "HangupString " << m_profile.readEntry("HangupString") << oendl;
144 send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r"); 149 send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r");
145 } 150 }
146 151
147 if(state != state_cancel) 152 if(state != state_cancel)
148 { 153 {
149 switchState(state_init); 154 switchState(state_init);
150// qWarning("Init String " + m_profile.readEntry("InitString") ); 155// owarn << "Init String " + m_profile.readEntry("InitString") << oendl;
151 send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r"); 156 send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r");
152 QString response2 = receive(); 157 QString response2 = receive();
153 if(!response2.contains("\nOK\r")) 158 if(!response2.contains("\nOK\r"))
154 reset(); 159 reset();
155 } 160 }
156 161
157 /*if(state != state_cancel) 162 /*if(state != state_cancel)
158 { 163 {
159 switchState(state_options); 164 switchState(state_options);
160 165
161 qWarning("ATM3l3"); 166 owarn << "ATM3l3" << oendl;
162 send("ATM3L3\r"); 167 send("ATM3L3\r");
163 QString response3 = receive(); 168 QString response3 = receive();
164 if(!response3.contains("\nOK\r")) 169 if(!response3.contains("\nOK\r"))
165 reset(); 170 reset();
166 } 171 }
167*/ 172*/
168 173
169 if(state != state_cancel) 174 if(state != state_cancel)
170 { 175 {
171 switchState(state_dialtone); 176 switchState(state_dialtone);
172 177
173 send("ATX1\r"); 178 send("ATX1\r");
174 QString response4 = receive(); 179 QString response4 = receive();
175 if(!response4.contains("\nOK\r")) 180 if(!response4.contains("\nOK\r"))
176 reset(); 181 reset();
177 } 182 }
178 183
179 if(state != state_cancel) 184 if(state != state_cancel)
180 { 185 {
181 qWarning("progress"); 186 owarn << "progress" << oendl;
182 switchState(state_dialing); 187 switchState(state_dialing);
183 188
184 // send(QString("ATDT %1\r").arg(number)); 189 // send(QString("ATDT %1\r").arg(number));
185 send(QString("%1 %2\r").arg(m_profile.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 )) 190 send(QString("%1 %2\r").arg(m_profile.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ))
186 .arg(number)); 191 .arg(number));
187 192
188 QString response5 = receive(); 193 QString response5 = receive();
189 if(!response5.contains("CONNECT") ) 194 if(!response5.contains("CONNECT") )
190 { 195 {
191 if(response5.contains("BUSY")) 196 if(response5.contains("BUSY"))
192 switchState(state_dialing); 197 switchState(state_dialing);
193 else 198 else
@@ -205,25 +210,25 @@ void Dialer::trydial(const QString& number)
205 { 210 {
206 state = state_online; 211 state = state_online;
207 slotCancel(); 212 slotCancel();
208 } 213 }
209} 214}
210 215
211void Dialer::send(const QString& msg) 216void Dialer::send(const QString& msg)
212{ 217{
213 QString m = msg; 218 QString m = msg;
214 int bytes; 219 int bytes;
215 QString termination; 220 QString termination;
216 221
217 qWarning("Sending: %s", m.latin1()); 222 owarn << "Sending: " << m.latin1() << "" << oendl;
218 223
219 /*termination = "\r"; 224 /*termination = "\r";
220 //termination = m_profile.readEntry("Termination"); 225 //termination = m_profile.readEntry("Termination");
221 if(termination == "\n") m = m + "\n"; 226 if(termination == "\n") m = m + "\n";
222 else if(termination == "\r") m = m + "\r"; 227 else if(termination == "\r") m = m + "\r";
223 else m = m + "\r\n"; 228 else m = m + "\r\n";
224*/ 229*/
225 m = m.replace(QRegExp("\n"), "\r"); 230 m = m.replace(QRegExp("\n"), "\r");
226 231
227 bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); 232 bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit()));
228 if(bytes < 0) 233 if(bytes < 0)
229 { 234 {
@@ -238,29 +243,29 @@ QString Dialer::receive()
238 int ret; 243 int ret;
239 int counter = 0; 244 int counter = 0;
240 245
241 while(1) 246 while(1)
242 { 247 {
243 ret = ::read(m_fd, buffer, sizeof(buffer)); 248 ret = ::read(m_fd, buffer, sizeof(buffer));
244 249
245 if(ret > 0) 250 if(ret > 0)
246 { 251 {
247 for(int i = 0; i < ret; i++) 252 for(int i = 0; i < ret; i++)
248 buffer[i] = buffer[i] & 0x7F; 253 buffer[i] = buffer[i] & 0x7F;
249 buffer[ret] = 0; 254 buffer[ret] = 0;
250 qWarning("Got: %s", buffer); 255 owarn << "Got: " << buffer << "" << oendl;
251 buf.append(QString(buffer)); 256 buf.append(QString(buffer));
252 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) 257 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY")))
253 { 258 {
254 //qWarning("Receiving: '%s'", buf.latin1()); 259 //owarn << "Receiving: '" << buf.latin1() << "'" << oendl;
255 cleanshutdown = 1; 260 cleanshutdown = 1;
256 return buf; 261 return buf;
257 }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) { 262 }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) {
258 cleanshutdown = 1; 263 cleanshutdown = 1;
259 return QString::null; 264 return QString::null;
260 } 265 }
261 } 266 }
262 else if(ret < 0) 267 else if(ret < 0)
263 { 268 {
264 if(errno != EAGAIN) reset(); 269 if(errno != EAGAIN) reset();
265 else if(!(counter++ % 100)) qApp->processEvents(); 270 else if(!(counter++ % 100)) qApp->processEvents();
266 } 271 }
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 99d069f..89b70c6 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -1,19 +1,21 @@
1
2#include "TEmuVt102.h" 1#include "TEmuVt102.h"
3
4#include "profile.h" 2#include "profile.h"
5#include "emulation_handler.h" 3#include "emulation_handler.h"
6#include "script.h" 4#include "script.h"
7 5
6/* OPIE */
7#include <opie2/odebug.h>
8using namespace Opie::Core;
9
8EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) 10EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
9 : QObject(0, name ) 11 : QObject(0, name )
10{ 12{
11 m_teWid = new TEWidget( parent, "TerminalMain"); 13 m_teWid = new TEWidget( parent, "TerminalMain");
12 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) 14 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar)
13 // use setWrapAt(80) for normal console with scrollbar 15 // use setWrapAt(80) for normal console with scrollbar
14 setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); 16 setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80);
15 m_teWid->setMinimumSize(150, 70 ); 17 m_teWid->setMinimumSize(150, 70 );
16 m_script = 0; 18 m_script = 0;
17 parent->resize( m_teWid->calcSize(80, 24 ) ); 19 parent->resize( m_teWid->calcSize(80, 24 ) );
18 m_teEmu = new TEmuVt102(m_teWid ); 20 m_teEmu = new TEmuVt102(m_teWid );
19 21
@@ -119,53 +121,53 @@ QColor EmulationHandler::foreColor(int col) {
119 QColor co; 121 QColor co;
120 /* we need to switch it */ 122 /* we need to switch it */
121 switch( col ) { 123 switch( col ) {
122 default: 124 default:
123 case Profile::White: 125 case Profile::White:
124 /* color is black */ 126 /* color is black */
125 co = Qt::white; 127 co = Qt::white;
126 break; 128 break;
127 case Profile::Black: 129 case Profile::Black:
128 co = Qt::black; 130 co = Qt::black;
129 break; 131 break;
130 case Profile::Green: 132 case Profile::Green:
131 qWarning("Foreground green"); 133 owarn << "Foreground green" << oendl;
132 co = Qt::green; 134 co = Qt::green;
133 break; 135 break;
134 case Profile::Orange: 136 case Profile::Orange:
135 qWarning("Foreground orange"); 137 owarn << "Foreground orange" << oendl;
136 co.setRgb( 231, 184, 98 ); 138 co.setRgb( 231, 184, 98 );
137 break; 139 break;
138 } 140 }
139 141
140 return co; 142 return co;
141} 143}
142QColor EmulationHandler::backColor(int col ) { 144QColor EmulationHandler::backColor(int col ) {
143 QColor co; 145 QColor co;
144 /* we need to switch it */ 146 /* we need to switch it */
145 switch( col ) { 147 switch( col ) {
146 default: 148 default:
147 case Profile::White: 149 case Profile::White:
148 /* color is white */ 150 /* color is white */
149 co = Qt::black; 151 co = Qt::black;
150 break; 152 break;
151 case Profile::Black: 153 case Profile::Black:
152 co = Qt::white; 154 co = Qt::white;
153 break; 155 break;
154 case Profile::Green: 156 case Profile::Green:
155 qWarning("Background black"); 157 owarn << "Background black" << oendl;
156 co = Qt::black; 158 co = Qt::black;
157 break; 159 break;
158 case Profile::Orange: 160 case Profile::Orange:
159 qWarning("Background black"); 161 owarn << "Background black" << oendl;
160 co = Qt::black; 162 co = Qt::black;
161 break; 163 break;
162 } 164 }
163 165
164 return co; 166 return co;
165} 167}
166 168
167QPushButton* EmulationHandler::cornerButton() { 169QPushButton* EmulationHandler::cornerButton() {
168 return m_teWid->cornerButton(); 170 return m_teWid->cornerButton();
169} 171}
170 172
171 173
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp
index ad8ecba..4688551 100644
--- a/noncore/apps/opie-console/emulation_widget.cpp
+++ b/noncore/apps/opie-console/emulation_widget.cpp
@@ -215,27 +215,27 @@ void EmulationWidget::paintEvent( QPaintEvent* pe )
215 drawAttrString( unistr, painter, QRect( m_blX+tLx+f_width*x,m_bY+tLy+f_height*y,f_width*len,f_height ), m_image[loc(x ,y )], pm != 0l, false ); 215 drawAttrString( unistr, painter, QRect( m_blX+tLx+f_width*x,m_bY+tLy+f_height*y,f_width*len,f_height ), m_image[loc(x ,y )], pm != 0l, false );
216 x +=len -1; 216 x +=len -1;
217 } 217 }
218 delete [] disstrU; 218 delete [] disstrU;
219 drawFrame( &painter ); 219 drawFrame( &painter );
220 painter.end(); 220 painter.end();
221} 221}
222 222
223void EmulationWidget::calcGeometry() 223void EmulationWidget::calcGeometry()
224{ 224{
225 m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() ); 225 m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() );
226 226
227 qDebug( QString(" TEST").arg( contentsRect().width() ) ); 227 odebug << QString(" TEST").arg( contentsRect().width() ) << oendl;
228 qDebug( QString(" TEST").arg( contentsRect().height() ) ); 228 odebug << QString(" TEST").arg( contentsRect().height() ) << oendl;
229 qDebug("NEUER TESTT!!!!!!!!"); 229 odebug << "NEUER TESTT!!!!!!!!" << oendl;
230 230
231 switch( scrollLoc ) 231 switch( scrollLoc )
232 { 232 {
233 case SCRNONE : 233 case SCRNONE :
234 m_columns = ( contentsRect().width() -2 * rimX ) / f_width; 234 m_columns = ( contentsRect().width() -2 * rimX ) / f_width;
235 m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2; 235 m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2;
236 m_brX = m_blX; 236 m_brX = m_blX;
237 m_scrollbar->hide(); 237 m_scrollbar->hide();
238 break; 238 break;
239 case SCRLEFT : 239 case SCRLEFT :
240 m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; 240 m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width;
241 m_brX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; 241 m_brX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2;
@@ -249,39 +249,39 @@ void EmulationWidget::calcGeometry()
249 m_brX = m_blX; 249 m_brX = m_blX;
250 m_scrollbar->move( contentsRect().topRight() - QPoint (m_scrollbar->width()-1,0 ) ); 250 m_scrollbar->move( contentsRect().topRight() - QPoint (m_scrollbar->width()-1,0 ) );
251 m_scrollbar->show(); 251 m_scrollbar->show();
252 break; 252 break;
253 } 253 }
254 254
255 m_lines = ( contentsRect().height() - 2 * rimY ) / f_height; 255 m_lines = ( contentsRect().height() - 2 * rimY ) / f_height;
256 m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2; 256 m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2;
257} 257}
258 258
259void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear ) 259void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear )
260{ 260{
261 qWarning("Color1 %s", color_table[attr.b].color.name().latin1() ); 261 owarn << "Color1 " << color_table[attr.b].color.name().latin1() << "" << oendl;
262 if ( usePixmap && color_table[attr.b].transparent ) 262 if ( usePixmap && color_table[attr.b].transparent )
263 { 263 {
264 painter.setBackgroundMode( TransparentMode ); 264 painter.setBackgroundMode( TransparentMode );
265 if ( clear ) 265 if ( clear )
266 erase( rect ); 266 erase( rect );
267 } 267 }
268 else 268 else
269 { 269 {
270 if ( blinking ) 270 if ( blinking )
271 painter.fillRect( rect, color_table[attr.b].color ); 271 painter.fillRect( rect, color_table[attr.b].color );
272 else 272 else
273 { 273 {
274 painter.setBackgroundMode( OpaqueMode ); 274 painter.setBackgroundMode( OpaqueMode );
275 qWarning("Color %s", color_table[attr.b].color.name().latin1() ); 275 owarn << "Color " << color_table[attr.b].color.name().latin1() << "" << oendl;
276 painter.setBackgroundColor( color_table[attr.b].color ); 276 painter.setBackgroundColor( color_table[attr.b].color );
277 } 277 }
278 } 278 }
279 if ( color_table[attr.f].bold ) 279 if ( color_table[attr.f].bold )
280 painter.setPen( QColor( 0x8F, 0x00, 0x00 ) ); 280 painter.setPen( QColor( 0x8F, 0x00, 0x00 ) );
281 else 281 else
282 painter.setPen( color_table[attr.f].color ); 282 painter.setPen( color_table[attr.f].color );
283 painter.drawText( rect.x(), rect.y() + f_ascent, string ); 283 painter.drawText( rect.x(), rect.y() + f_ascent, string );
284 284
285} 285}
286 286
287 287
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index eb32551..6613183 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -1,14 +1,19 @@
1#include "function_keyboard.h" 1#include "function_keyboard.h"
2 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
7/* QT */
3#include <qlayout.h> 8#include <qlayout.h>
4#include <qlistbox.h> 9#include <qlistbox.h>
5#include <qlabel.h> 10#include <qlabel.h>
6#include <qdir.h> 11#include <qdir.h>
7 12
8#define DEFAULT_ROWS 2 13#define DEFAULT_ROWS 2
9#define DEFAULT_COLS 12 14#define DEFAULT_COLS 12
10 15
11/* FunctionKeyboard {{{1 */ 16/* FunctionKeyboard {{{1 */
12 17
13FunctionKeyboard::FunctionKeyboard(QWidget *parent) : 18FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
14 QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), 19 QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS),
@@ -28,25 +33,25 @@ FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
28 33
29 QString handle = "r" + QString::number(r) + "c" + QString::number(c); 34 QString handle = "r" + QString::number(r) + "c" + QString::number(c);
30 QStringList value_list = conf.readListEntry( handle, '|'); 35 QStringList value_list = conf.readListEntry( handle, '|');
31 36
32 if (value_list.isEmpty()) continue; 37 if (value_list.isEmpty()) continue;
33 38
34 keys.insert( 39 keys.insert(
35 40
36 handle, 41 handle,
37 FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) 42 FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort())
38 ); 43 );
39 } 44 }
40 //qWarning("loaded %d keys", keys.count()); 45 //owarn << "loaded " << keys.count() << " keys" << oendl;
41 */ 46 */
42 if (keys.isEmpty()) loadDefaults(); 47 if (keys.isEmpty()) loadDefaults();
43 48
44 49
45 50
46} 51}
47 52
48FunctionKeyboard::~FunctionKeyboard() {} 53FunctionKeyboard::~FunctionKeyboard() {}
49 54
50void FunctionKeyboard::changeRows(int r) { 55void FunctionKeyboard::changeRows(int r) {
51 56
52 numRows = r; 57 numRows = r;
@@ -247,25 +252,25 @@ void FunctionKeyboard::loadDefaults() {
247 keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); 252 keys.insert( "r1c10", FKey ("F11", 0, 4154, 0));
248 keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); 253 keys.insert( "r1c11", FKey ("F12", 0, 4155, 0));
249 254
250 255
251} 256}
252 257
253/* FunctionKeyboardConfig {{{1 */ 258/* FunctionKeyboardConfig {{{1 */
254 259
255FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) 260FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na )
256 : ProfileDialogKeyWidget(name, parent, na), 261 : ProfileDialogKeyWidget(name, parent, na),
257 selectedRow(0), selectedCol(0) 262 selectedRow(0), selectedCol(0)
258{ 263{
259 qWarning("FunctionKeyboardConfig"); 264 owarn << "FunctionKeyboardConfig" << oendl;
260 265
261 266
262 kb = new FunctionKeyboard(this); 267 kb = new FunctionKeyboard(this);
263 connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), 268 connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)),
264 this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool))); 269 this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool)));
265 270
266 QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); 271 QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this);
267 QLabel *l = new QLabel("Rows", dimentions); 272 QLabel *l = new QLabel("Rows", dimentions);
268 m_rowBox = new QSpinBox(1, 15, 1, dimentions); 273 m_rowBox = new QSpinBox(1, 15, 1, dimentions);
269 connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); 274 connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int)));
270 l = new QLabel("Columns", dimentions); 275 l = new QLabel("Columns", dimentions);
271 m_colBox = new QSpinBox(1, 15, 1, dimentions); 276 m_colBox = new QSpinBox(1, 15, 1, dimentions);
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index a29fa8e..c102427 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -1,16 +1,19 @@
1 1
2#include "io_bt.h" 2#include "io_bt.h"
3 3
4/* OPIE */
5#include <opie2/odebug.h>
4using namespace Opie::Core; 6using namespace Opie::Core;
7
5IOBt::IOBt( const Profile &config ) : IOSerial( config ) { 8IOBt::IOBt( const Profile &config ) : IOSerial( config ) {
6 m_attach = 0; 9 m_attach = 0;
7} 10}
8 11
9 12
10IOBt::~IOBt() { 13IOBt::~IOBt() {
11 if ( m_attach ) { 14 if ( m_attach ) {
12 delete m_attach; 15 delete m_attach;
13 } 16 }
14} 17}
15 18
16 19
@@ -34,25 +37,25 @@ bool IOBt::open() {
34 // hciattach here 37 // hciattach here
35 m_attach = new OProcess(); 38 m_attach = new OProcess();
36 *m_attach << "hciattach /dev/ttyS2 any 57600"; 39 *m_attach << "hciattach /dev/ttyS2 any 57600";
37 40
38 // then start hcid, then rcfomm handling (m_mac) 41 // then start hcid, then rcfomm handling (m_mac)
39 42
40 connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), 43 connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ),
41 this, SLOT( slotExited(Opie::Core::OProcess*) ) ); 44 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
42 45
43 if ( m_attach->start() ) { 46 if ( m_attach->start() ) {
44 ret = IOSerial::open(); 47 ret = IOSerial::open();
45 } else { 48 } else {
46 qWarning("could not attach to device"); 49 owarn << "could not attach to device" << oendl;
47 delete m_attach; 50 delete m_attach;
48 m_attach = 0; 51 m_attach = 0;
49 } 52 }
50 } else { 53 } else {
51 // directly to the normal serial 54 // directly to the normal serial
52 // TODO: look first if the connection really exists. ( is set up ) 55 // TODO: look first if the connection really exists. ( is set up )
53 56
54 ret =IOSerial::open(); 57 ret =IOSerial::open();
55 } 58 }
56 return ret; 59 return ret;
57} 60}
58 61
@@ -80,14 +83,14 @@ void IOBt::slotExited( OProcess* proc ){
80 delete proc; 83 delete proc;
81} 84}
82 85
83QBitArray IOBt::supports() const { 86QBitArray IOBt::supports() const {
84 return QBitArray( 3 ); 87 return QBitArray( 3 );
85} 88}
86 89
87bool IOBt::isConnected() { 90bool IOBt::isConnected() {
88 return false; 91 return false;
89} 92}
90 93
91void IOBt::send(const QByteArray &data) { 94void IOBt::send(const QByteArray &data) {
92 qDebug( "Please overload me..." ); 95 odebug << "Please overload me..." << oendl;
93} 96}
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp
index 07c2b62..38542f5 100644
--- a/noncore/apps/opie-console/io_irda.cpp
+++ b/noncore/apps/opie-console/io_irda.cpp
@@ -1,16 +1,18 @@
1
2#include "io_irda.h" 1#include "io_irda.h"
3 2
3/* OPIE */
4#include <opie2/odebug.h>
4using namespace Opie::Core; 5using namespace Opie::Core;
6
5IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { 7IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) {
6 m_attach = 0; 8 m_attach = 0;
7} 9}
8 10
9 11
10IOIrda::~IOIrda() { 12IOIrda::~IOIrda() {
11 if ( m_attach ) { 13 if ( m_attach ) {
12 delete m_attach; 14 delete m_attach;
13 } 15 }
14} 16}
15 17
16 18
@@ -26,25 +28,25 @@ bool IOIrda::open() {
26 28
27 // irdaattach here 29 // irdaattach here
28 m_attach = new OProcess(); 30 m_attach = new OProcess();
29 *m_attach << "irattach /dev/ttyS2 -s"; 31 *m_attach << "irattach /dev/ttyS2 -s";
30 32
31 connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), 33 connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ),
32 this, SLOT( slotExited(Opie::Core::OProcess*) ) ); 34 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
33 35
34 if ( m_attach->start() ) { 36 if ( m_attach->start() ) {
35 ret= IOSerial::open(); 37 ret= IOSerial::open();
36 } else { 38 } else {
37 // emit error!!! 39 // emit error!!!
38 qWarning("could not attach to device"); 40 owarn << "could not attach to device" << oendl;
39 delete m_attach; 41 delete m_attach;
40 m_attach = 0l; 42 m_attach = 0l;
41 } 43 }
42 return ret; 44 return ret;
43} 45}
44 46
45void IOIrda::reload( const Profile &config ) { 47void IOIrda::reload( const Profile &config ) {
46 m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); 48 m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE);
47 m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); 49 m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD);
48 m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); 50 m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY);
49 m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); 51 m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS);
50 m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); 52 m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS);
@@ -65,14 +67,14 @@ void IOIrda::slotExited(OProcess* proc ){
65 delete proc; 67 delete proc;
66} 68}
67 69
68QBitArray IOIrda::supports()const { 70QBitArray IOIrda::supports()const {
69 return QBitArray( 3 ); 71 return QBitArray( 3 );
70} 72}
71 73
72bool IOIrda::isConnected() { 74bool IOIrda::isConnected() {
73 return false; 75 return false;
74} 76}
75 77
76void IOIrda::send(const QByteArray &data) { 78void IOIrda::send(const QByteArray &data) {
77 qDebug( "Please overload me..." ); 79 odebug << "Please overload me..." << oendl;
78} 80}
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index b74d076..c499dfe 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -1,27 +1,27 @@
1 1
2#include "io_modem.h" 2#include "io_modem.h"
3
4#include "dialer.h" 3#include "dialer.h"
5 4
5/* OPIE */
6#include <opie2/odebug.h>
6using namespace Opie::Core; 7using namespace Opie::Core;
7using namespace Opie::Core; 8
8IOModem::IOModem( const Profile &profile ) 9IOModem::IOModem( const Profile &profile )
9 : IOSerial( profile ) { 10 : IOSerial( profile ) {
10 m_profile = profile; 11 m_profile = profile;
11} 12}
12 13
13 14
14IOModem::~IOModem() { 15IOModem::~IOModem() {
15
16} 16}
17 17
18 18
19void IOModem::close() { 19void IOModem::close() {
20 // Hangup, discarding result 20 // Hangup, discarding result
21 //int fd = rawIO(); 21 //int fd = rawIO();
22 internDetach(); 22 internDetach();
23 Dialer d(m_profile, m_fd); 23 Dialer d(m_profile, m_fd);
24 d.setHangupOnly(); 24 d.setHangupOnly();
25 //d.exec(); 25 //d.exec();
26 internAttach(); 26 internAttach();
27 //closeRawIO(fd); 27 //closeRawIO(fd);
@@ -95,14 +95,14 @@ void IOModem::slotExited(OProcess* proc ){
95 delete proc; 95 delete proc;
96} 96}
97 97
98QBitArray IOModem::supports()const { 98QBitArray IOModem::supports()const {
99 return QBitArray( 3 ); 99 return QBitArray( 3 );
100} 100}
101 101
102bool IOModem::isConnected() { 102bool IOModem::isConnected() {
103 return false; 103 return false;
104} 104}
105 105
106void IOModem::send(const QByteArray &data) { 106void IOModem::send(const QByteArray &data) {
107 qDebug( "Please overload me..." ); 107 odebug << "Please overload me..." << oendl;
108} 108}
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp
index dfb2f83..1bd4338 100644
--- a/noncore/apps/opie-console/main.cpp
+++ b/noncore/apps/opie-console/main.cpp
@@ -82,25 +82,25 @@ void FixIt::fixIt() {
82 file.writeBlock(m_file,strlen(m_file) ); 82 file.writeBlock(m_file,strlen(m_file) );
83 } 83 }
84 file.close(); 84 file.close();
85 ::kill( SIGHUP, 1 ); 85 ::kill( SIGHUP, 1 );
86} 86}
87#endif 87#endif
88 88
89int main(int argc, char **argv) { 89int main(int argc, char **argv) {
90// too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; 90// too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole";
91 QPEApplication app( argc, argv ); 91 QPEApplication app( argc, argv );
92 92
93#ifdef FSCKED_DISTRIBUTION 93#ifdef FSCKED_DISTRIBUTION
94 qWarning("fscked"); 94 owarn << "fscked" << oendl;
95 FixIt it; 95 FixIt it;
96 it.fixIt(); 96 it.fixIt();
97#endif 97#endif
98 98
99 MainWindow mw; 99 MainWindow mw;
100 mw.setCaption(QObject::tr("Opie Console") ); 100 mw.setCaption(QObject::tr("Opie Console") );
101 app.showMainWidget( &mw ); 101 app.showMainWidget( &mw );
102 102
103 int ap = app.exec(); 103 int ap = app.exec();
104 104
105#ifdef FSCKED_DISTRIBUTION 105#ifdef FSCKED_DISTRIBUTION
106 /* should add a signal handler too */ 106 /* should add a signal handler too */
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 06a8f7d..b403b4d 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,39 +1,42 @@
1#include <assert.h>
2
3#include <qaction.h>
4#include <qmenubar.h>
5#include <qtoolbar.h>
6#include <qmessagebox.h>
7#include <qwhatsthis.h>
8#include <qfileinfo.h>
9
10#include <qpe/filemanager.h>
11
12#include <opie2/ofiledialog.h>
13
14#include "TEmulation.h" 1#include "TEmulation.h"
15#include "profileeditordialog.h" 2#include "profileeditordialog.h"
16#include "configdialog.h" 3#include "configdialog.h"
17#include "default.h" 4#include "default.h"
18#include "profilemanager.h" 5#include "profilemanager.h"
19#include "mainwindow.h" 6#include "mainwindow.h"
20#include "tabwidget.h" 7#include "tabwidget.h"
21#include "transferdialog.h" 8#include "transferdialog.h"
22#include "function_keyboard.h" 9#include "function_keyboard.h"
23#include "emulation_handler.h" 10#include "emulation_handler.h"
24#include "script.h" 11#include "script.h"
25 12
26 13/* OPIE */
14#include <opie2/odebug.h>
15#include <opie2/ofiledialog.h>
16#include <qpe/filemanager.h>
17using namespace Opie::Core;
27using namespace Opie::Ui; 18using namespace Opie::Ui;
19
20/* QT */
21#include <qaction.h>
22#include <qmenubar.h>
23#include <qtoolbar.h>
24#include <qmessagebox.h>
25#include <qwhatsthis.h>
26#include <qfileinfo.h>
27
28/* STD */
29#include <assert.h>
30
28MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { 31MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
29 KeyTrans::loadAll(); 32 KeyTrans::loadAll();
30 for (int i = 0; i < KeyTrans::count(); i++ ) { 33 for (int i = 0; i < KeyTrans::count(); i++ ) {
31 KeyTrans* s = KeyTrans::find(i ); 34 KeyTrans* s = KeyTrans::find(i );
32 assert( s ); 35 assert( s );
33 } 36 }
34 m_factory = new MetaFactory(); 37 m_factory = new MetaFactory();
35 Default def(m_factory); 38 Default def(m_factory);
36 m_sessions.setAutoDelete( TRUE ); 39 m_sessions.setAutoDelete( TRUE );
37 m_curSession = 0; 40 m_curSession = 0;
38 m_manager = new ProfileManager( m_factory ); 41 m_manager = new ProfileManager( m_factory );
39 m_manager->load(); 42 m_manager->load();
@@ -437,31 +440,31 @@ void MainWindow::slotConfigure() {
437/* 440/*
438 * we will remove 441 * we will remove
439 * this window from the tabwidget 442 * this window from the tabwidget
440 * remove it from the list 443 * remove it from the list
441 * delete it 444 * delete it
442 * and set the currentSession() 445 * and set the currentSession()
443 */ 446 */
444void MainWindow::slotClose() { 447void MainWindow::slotClose() {
445 if (!currentSession() ) 448 if (!currentSession() )
446 return; 449 return;
447 450
448 Session* ses = currentSession(); 451 Session* ses = currentSession();
449 qWarning("removing! currentSession %s", currentSession()->name().latin1() ); 452 owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl;
450 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ 453 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
451 m_curSession = NULL; 454 m_curSession = NULL;
452 tabWidget()->remove( /*currentSession()*/ses ); 455 tabWidget()->remove( /*currentSession()*/ses );
453 /*it's autodelete */ 456 /*it's autodelete */
454 m_sessions.remove( ses ); 457 m_sessions.remove( ses );
455 qWarning("after remove!!"); 458 owarn << "after remove!!" << oendl;
456 459
457 if (!currentSession() ) { 460 if (!currentSession() ) {
458 m_connect->setEnabled( false ); 461 m_connect->setEnabled( false );
459 m_disconnect->setEnabled( false ); 462 m_disconnect->setEnabled( false );
460 m_terminate->setEnabled( false ); 463 m_terminate->setEnabled( false );
461 m_transfer->setEnabled( false ); 464 m_transfer->setEnabled( false );
462 m_recordScript->setEnabled( false ); 465 m_recordScript->setEnabled( false );
463 m_saveScript->setEnabled( false ); 466 m_saveScript->setEnabled( false );
464 m_scripts->setItemEnabled(m_runScript_id, false); 467 m_scripts->setItemEnabled(m_runScript_id, false);
465 m_fullscreen->setEnabled( false ); 468 m_fullscreen->setEnabled( false );
466 m_wrap->setEnabled( false ); 469 m_wrap->setEnabled( false );
467 m_closewindow->setEnabled( false ); 470 m_closewindow->setEnabled( false );
@@ -561,34 +564,34 @@ void MainWindow::slotOpenKeb(bool state) {
561void MainWindow::slotOpenButtons( bool state ) { 564void MainWindow::slotOpenButtons( bool state ) {
562 565
563 if ( state ) { 566 if ( state ) {
564 m_buttonBar->show(); 567 m_buttonBar->show();
565 } else { 568 } else {
566 m_buttonBar->hide(); 569 m_buttonBar->hide();
567 } 570 }
568} 571}
569 572
570 573
571 574
572void MainWindow::slotSessionChanged( Session* ses ) { 575void MainWindow::slotSessionChanged( Session* ses ) {
573 qWarning("changed!"); 576 owarn << "changed!" << oendl;
574 577
575 if(m_curSession) 578 if(m_curSession)
576 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 579 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
577 if(ses) 580 if(ses)
578 if(ses->transferDialog()) ses->transferDialog()->show(); 581 if(ses->transferDialog()) ses->transferDialog()->show();
579 582
580 if ( ses ) { 583 if ( ses ) {
581 m_curSession = ses; 584 m_curSession = ses;
582 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 585 odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl;
583 if ( m_curSession->layer()->isConnected() ) { 586 if ( m_curSession->layer()->isConnected() ) {
584 m_connect->setEnabled( false ); 587 m_connect->setEnabled( false );
585 m_disconnect->setEnabled( true ); 588 m_disconnect->setEnabled( true );
586 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); 589 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording());
587 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); 590 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording());
588 m_scripts->setItemEnabled(m_runScript_id, true); 591 m_scripts->setItemEnabled(m_runScript_id, true);
589 } else { 592 } else {
590 m_connect->setEnabled( true ); 593 m_connect->setEnabled( true );
591 m_disconnect->setEnabled( false ); 594 m_disconnect->setEnabled( false );
592 m_recordScript->setEnabled( false ); 595 m_recordScript->setEnabled( false );
593 m_saveScript->setEnabled( false ); 596 m_saveScript->setEnabled( false );
594 m_scripts->setItemEnabled(m_runScript_id, false); 597 m_scripts->setItemEnabled(m_runScript_id, false);
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index 3466e3a..9fdaf73 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -1,24 +1,27 @@
1#include "modemconfigwidget.h"
2#include "dialdialog.h"
1 3
4/* OPIE */
5#include <opie2/odebug.h>
2#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7using namespace Opie::Core;
3 8
9/* QT */
4#include <qlabel.h> 10#include <qlabel.h>
5#include <qlayout.h> 11#include <qlayout.h>
6#include <qcombobox.h> 12#include <qcombobox.h>
7#include <qpushbutton.h> 13#include <qpushbutton.h>
8#include <qhbox.h> 14#include <qhbox.h>
9 15
10#include "modemconfigwidget.h"
11#include "dialdialog.h"
12
13namespace { 16namespace {
14 void setCurrent( const QString& str, QComboBox* bo ) { 17 void setCurrent( const QString& str, QComboBox* bo ) {
15 uint b = bo->count(); 18 uint b = bo->count();
16 for (int i = 0; i < bo->count(); i++ ) { 19 for (int i = 0; i < bo->count(); i++ ) {
17 if ( bo->text(i) == str ) { 20 if ( bo->text(i) == str ) {
18 bo->setCurrentItem( i ); 21 bo->setCurrentItem( i );
19 return; 22 return;
20 } 23 }
21 } 24 }
22 bo->insertItem( str ); 25 bo->insertItem( str );
23 bo->setCurrentItem( b ); 26 bo->setCurrentItem( b );
24 } 27 }
@@ -126,25 +129,25 @@ void ModemConfigWidget::load( const Profile& prof ) {
126 129
127 if ( sbits == 2) { 130 if ( sbits == 2) {
128 m_base->setStop( IOLayerBase::Stop_Two ); 131 m_base->setStop( IOLayerBase::Stop_Two );
129 } else if ( sbits == 15 ) { 132 } else if ( sbits == 15 ) {
130 m_base->setStop( IOLayerBase::Stop_OnePointFive ); 133 m_base->setStop( IOLayerBase::Stop_OnePointFive );
131 } else { 134 } else {
132 m_base->setStop( IOLayerBase::Stop_One ); 135 m_base->setStop( IOLayerBase::Stop_One );
133 } 136 }
134 137
135 138
136 atConf->readConfig( prof ); 139 atConf->readConfig( prof );
137 if ( prof.readEntry( "Device" ).isEmpty() ) { 140 if ( prof.readEntry( "Device" ).isEmpty() ) {
138 qWarning("device empty!"); 141 owarn << "device empty!" << oendl;
139 return; 142 return;
140 } 143 }
141 setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); 144 setCurrent( prof.readEntry( "Device" ), m_deviceCmb );
142 145
143 146
144} 147}
145 148
146/* 149/*
147 * save speed, 150 * save speed,
148 * flow, 151 * flow,
149 * parity 152 * parity
150 */ 153 */
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 7a15828..f7e33e9 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -1,16 +1,14 @@
1TEMPLATE = app 1TEMPLATE = app
2TMAKE_CXXFLAGS += -DHAVE_OPENPTY
3CONFIG += qt warn_on 2CONFIG += qt warn_on
4#CONFIG = qt
5DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
6HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ 4HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \
7 file_layer.h filetransfer.h \ 5 file_layer.h filetransfer.h \
8 metafactory.h \ 6 metafactory.h \
9 session.h \ 7 session.h \
10 mainwindow.h \ 8 mainwindow.h \
11 profile.h \ 9 profile.h \
12 profileconfig.h \ 10 profileconfig.h \
13 profilemanager.h \ 11 profilemanager.h \
14 tabwidget.h \ 12 tabwidget.h \
15 configdialog.h \ 13 configdialog.h \
16 keytrans.h \ 14 keytrans.h \
@@ -61,16 +59,16 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \
61 emulation_handler.cpp TEHistory.cpp \ 59 emulation_handler.cpp TEHistory.cpp \
62 TEScreen.cpp TEWidget.cpp \ 60 TEScreen.cpp TEWidget.cpp \
63 TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ 61 TEmuVt102.cpp TEmulation.cpp MyPty.cpp \
64 consoleconfigwidget.cpp 62 consoleconfigwidget.cpp
65 63
66 64
67INTERFACES = configurebase.ui editbase.ui 65INTERFACES = configurebase.ui editbase.ui
68INCLUDEPATH += $(OPIEDIR)/include 66INCLUDEPATH += $(OPIEDIR)/include
69DEPENDPATH += $(OPIEDIR)/include 67DEPENDPATH += $(OPIEDIR)/include
70LIBS += -lqpe -lopiecore2 -lopieui2 -lutil 68LIBS += -lqpe -lopiecore2 -lopieui2 -lutil
71TARGET = opie-console 69TARGET = opie-console
72 70
73 71DEFINES += HAVE_OPENPTY
74 72
75 73
76include ( $(OPIEDIR)/include.pro ) 74include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp
index fbc5306..f505998 100644
--- a/noncore/apps/opie-console/sz_transfer.cpp
+++ b/noncore/apps/opie-console/sz_transfer.cpp
@@ -32,55 +32,55 @@ void SzTransfer::sendFile(const QString& file) {
32 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), 32 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
33 this, SLOT(SzReceivedStdout(Opie::Core::OProcess*,char*,int))); 33 this, SLOT(SzReceivedStdout(Opie::Core::OProcess*,char*,int)));
34 connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), 34 connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
35 this, SLOT(SzReceivedStderr(Opie::Core::OProcess*,char*,int))); 35 this, SLOT(SzReceivedStderr(Opie::Core::OProcess*,char*,int)));
36 connect(layer(), SIGNAL(received(const QByteArray&)), 36 connect(layer(), SIGNAL(received(const QByteArray&)),
37 this, SLOT(receivedStdin(const QByteArray&))); 37 this, SLOT(receivedStdin(const QByteArray&)));
38 proc->start(OProcess::NotifyOnExit, OProcess::All); 38 proc->start(OProcess::NotifyOnExit, OProcess::All);
39 39
40} 40}
41 41
42void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { 42void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) {
43 43
44 qWarning("recieved from sz on stdout %d bytes", buflen); 44 owarn << "recieved from sz on stdout " << buflen << " bytes" << oendl;
45 45
46 QByteArray data(buflen); 46 QByteArray data(buflen);
47 data.fill(*buffer, buflen); 47 data.fill(*buffer, buflen);
48 for (uint i = 0; i < data.count(); i++ ) { 48 for (uint i = 0; i < data.count(); i++ ) {
49 printf("%c", buffer[i] ); 49 printf("%c", buffer[i] );
50 } 50 }
51 printf("\n"); 51 printf("\n");
52 52
53 // send out through the io layer 53 // send out through the io layer
54 layer()->send(data); 54 layer()->send(data);
55} 55}
56 56
57void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { 57void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) {
58 58
59 // parse and show data in a progress dialog/widget 59 // parse and show data in a progress dialog/widget
60 printf("stderr:\n"); 60 printf("stderr:\n");
61 //for (int i = 0; i < length; i++) 61 //for (int i = 0; i < length; i++)
62 // printf("%c", buffer[i]); 62 // printf("%c", buffer[i]);
63 //printf("\n"); 63 //printf("\n");
64} 64}
65 65
66void SzTransfer::receivedStdin(const QByteArray &data) { 66void SzTransfer::receivedStdin(const QByteArray &data) {
67 67
68 qWarning("recieved from io_serial %d bytes", data.size()); 68 owarn << "recieved from io_serial " << data.size() << " bytes" << oendl;
69 69
70 // recieved data from the io layer goes to sz 70 // recieved data from the io layer goes to sz
71 proc->writeStdin(data.data(), data.size()); 71 proc->writeStdin(data.data(), data.size());
72 72
73} 73}
74 74
75void SzTransfer::sent() { 75void SzTransfer::sent() {
76 76
77 qWarning("sent file"); 77 owarn << "sent file" << oendl;
78 78
79 //setcbreak(0); /* default */ 79 //setcbreak(0); /* default */
80 80
81 81
82 delete proc; 82 delete proc;
83 disconnect(layer(), SIGNAL(received(const QByteArray&)), 83 disconnect(layer(), SIGNAL(received(const QByteArray&)),
84 this, SLOT(receivedStdin(const QByteArray&))); 84 this, SLOT(receivedStdin(const QByteArray&)));
85 85
86} 86}
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp
index 6429e3c..41a91ed 100644
--- a/noncore/apps/opie-console/tabwidget.cpp
+++ b/noncore/apps/opie-console/tabwidget.cpp
@@ -1,27 +1,30 @@
1
2#include "tabwidget.h" 1#include "tabwidget.h"
3 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
4using namespace Opie::Ui; 6using namespace Opie::Ui;
7
5TabWidget::TabWidget( QWidget* parent, const char* name ) 8TabWidget::TabWidget( QWidget* parent, const char* name )
6 : OTabWidget( parent, name ) { 9 : OTabWidget( parent, name ) {
7 connect(this, SIGNAL( currentChanged(QWidget*) ), 10 connect(this, SIGNAL( currentChanged(QWidget*) ),
8 this, SLOT( slotCurChanged(QWidget*) ) ); 11 this, SLOT( slotCurChanged(QWidget*) ) );
9} 12}
10 13
11TabWidget::~TabWidget() { 14TabWidget::~TabWidget() {
12} 15}
13 16
14void TabWidget::add( Session* ses ) { 17void TabWidget::add( Session* ses ) {
15 qWarning("session ses " + ses->name() ); 18 owarn << "session ses " + ses->name() << oendl;
16 if ( !ses->widgetStack() ) return; 19 if ( !ses->widgetStack() ) return;
17 //reparent( ses->widgetStack(), QPoint() ); 20 //reparent( ses->widgetStack(), QPoint() );
18 addTab( ses->widgetStack(), "console/konsole", ses->name() ); 21 addTab( ses->widgetStack(), "console/konsole", ses->name() );
19 //addTab( ses->widgetStack(), ses->name() ); 22 //addTab( ses->widgetStack(), ses->name() );
20 m_map.insert( ses->widgetStack(), ses ); 23 m_map.insert( ses->widgetStack(), ses );
21} 24}
22 25
23void TabWidget::remove( Session* ses ) { 26void TabWidget::remove( Session* ses ) {
24 m_map.remove( ses->widgetStack() ); 27 m_map.remove( ses->widgetStack() );
25 removePage( ses->widgetStack() ); 28 removePage( ses->widgetStack() );
26} 29}
27 30
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp
index 6870487..087476b 100644
--- a/noncore/apps/opie-console/terminalwidget.cpp
+++ b/noncore/apps/opie-console/terminalwidget.cpp
@@ -1,22 +1,27 @@
1#include "terminalwidget.h"
2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
7/* QT */
1#include <qlabel.h> 8#include <qlabel.h>
2#include <qcheckbox.h> 9#include <qcheckbox.h>
3#include <qcombobox.h> 10#include <qcombobox.h>
4#include <qradiobutton.h> 11#include <qradiobutton.h>
5#include <qhgroupbox.h> 12#include <qhgroupbox.h>
6#include <qhbuttongroup.h> 13#include <qhbuttongroup.h>
7#include <qlayout.h> 14#include <qlayout.h>
8 15
9#include "terminalwidget.h"
10
11namespace { 16namespace {
12 enum TermIds { 17 enum TermIds {
13 id_term_vt100 = 0, 18 id_term_vt100 = 0,
14 id_term_vt102, 19 id_term_vt102,
15 id_term_linux, 20 id_term_linux,
16 id_term_xterm 21 id_term_xterm
17 }; 22 };
18 23
19 enum ColourIds { 24 enum ColourIds {
20 id_term_black, 25 id_term_black,
21 id_term_white, 26 id_term_white,
22 id_term_green, 27 id_term_green,
@@ -60,25 +65,25 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
60 m_typeBox->add( m_terminal ); 65 m_typeBox->add( m_terminal );
61 m_typeBox->add( m_terminalBox ); 66 m_typeBox->add( m_terminalBox );
62 m_lroot->add( m_groupSize ); 67 m_lroot->add( m_groupSize );
63 68
64 m_colorBox->add( m_colorLabel ); 69 m_colorBox->add( m_colorLabel );
65 m_colorBox->add( m_colorCmb ); 70 m_colorBox->add( m_colorCmb );
66 71
67 m_lroot->add( m_groupConv ); 72 m_lroot->add( m_groupConv );
68 m_lroot->add( m_groupOptions ); 73 m_lroot->add( m_groupOptions );
69 m_lroot->addStretch( 0 ); 74 m_lroot->addStretch( 0 );
70 75
71 // Fill in some options 76 // Fill in some options
72 qWarning("Options for terminal box"); 77 owarn << "Options for terminal box" << oendl;
73 m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); 78 m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ );
74 m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); 79 m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */);
75 m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); 80 m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux );
76 m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); 81 m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm );
77 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); 82 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi );
78 83
79 m_colorCmb->insertItem( tr("black on white"), id_term_black ); 84 m_colorCmb->insertItem( tr("black on white"), id_term_black );
80 m_colorCmb->insertItem( tr("white on black"), id_term_white ); 85 m_colorCmb->insertItem( tr("white on black"), id_term_white );
81 m_colorCmb->insertItem( tr("green on black"), id_term_green ); 86 m_colorCmb->insertItem( tr("green on black"), id_term_green );
82 m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); 87 m_colorCmb->insertItem( tr("orange on black"), id_term_orange );
83 88
84 // signals + slots 89 // signals + slots
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp
index df27055..45fd11d 100644
--- a/noncore/apps/opie-console/test/senderui.cpp
+++ b/noncore/apps/opie-console/test/senderui.cpp
@@ -17,63 +17,63 @@
17 17
18using namespace Opie::Core; 18using namespace Opie::Core;
19using namespace Opie::Core; 19using namespace Opie::Core;
20SenderUI::SenderUI() 20SenderUI::SenderUI()
21 : Sender() { 21 : Sender() {
22 22
23 /* we do that manually */ 23 /* we do that manually */
24 Profile prof; 24 Profile prof;
25 QString str = "/dev/bty0"; 25 QString str = "/dev/bty0";
26 prof.writeEntry("Device",str ); 26 prof.writeEntry("Device",str );
27 prof.writeEntry("Baud", 19200 ); 27 prof.writeEntry("Baud", 19200 );
28 28
29 qWarning("prof " + prof.readEntry("Device") + " " + str); 29 owarn << "prof " + prof.readEntry("Device") + " " + str << oendl;
30 ser = new IOSerial(prof); 30 ser = new IOSerial(prof);
31 connect(ser, SIGNAL(received(const QByteArray&) ), 31 connect(ser, SIGNAL(received(const QByteArray&) ),
32 this, SLOT(got(const QByteArray&) ) ); 32 this, SLOT(got(const QByteArray&) ) );
33 33
34 if ( ser->open() ) 34 if ( ser->open() )
35 qWarning("opened!!!"); 35 owarn << "opened!!!" << oendl;
36 else 36 else
37 qWarning("could not open"); 37 owarn << "could not open" << oendl;
38 38
39 39
40} 40}
41SenderUI::~SenderUI() { 41SenderUI::~SenderUI() {
42 42
43} 43}
44void SenderUI::slotSendFile() { 44void SenderUI::slotSendFile() {
45 45
46 sz = new FileTransfer(FileTransfer::SY, ser); 46 sz = new FileTransfer(FileTransfer::SY, ser);
47 sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); 47 sz->sendFile("/home/ich/bootopie-v06-13.jffs2");
48 48
49 connect (sz, SIGNAL(sent()), 49 connect (sz, SIGNAL(sent()),
50 this, SLOT(fileTransComplete())); 50 this, SLOT(fileTransComplete()));
51} 51}
52 52
53void SenderUI::slotSend() { 53void SenderUI::slotSend() {
54 QCString str = MultiLineEdit1->text().utf8(); 54 QCString str = MultiLineEdit1->text().utf8();
55 qWarning("sending: %s", str.data() ); 55 owarn << "sending: " << str.data() << "" << oendl;
56 str = str.replace( QRegExp("\n"), "\r"); 56 str = str.replace( QRegExp("\n"), "\r");
57 ser->send( str ); 57 ser->send( str );
58} 58}
59void SenderUI::got(const QByteArray& ar) { 59void SenderUI::got(const QByteArray& ar) {
60 qWarning("got:"); 60 owarn << "got:" << oendl;
61 for ( uint i = 0; i < ar.count(); i++ ) { 61 for ( uint i = 0; i < ar.count(); i++ ) {
62 printf("%c", ar[i] ); 62 printf("%c", ar[i] );
63 } 63 }
64 printf("\n"); 64 printf("\n");
65} 65}
66 66
67void SenderUI::fileTransComplete() { 67void SenderUI::fileTransComplete() {
68 68
69 qWarning("file transfer complete"); 69 owarn << "file transfer complete" << oendl;
70} 70}
71void SenderUI::send() { 71void SenderUI::send() {
72 72
73} 73}
74void SenderUI::slotRev(){ 74void SenderUI::slotRev(){
75qWarning("Going to receive!"); 75owarn << "Going to receive!" << oendl;
76FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); 76FileReceive *rev = new FileReceive( FileReceive::SZ, ser );
77rev->receive(); 77rev->receive();
78 78
79} 79}
diff --git a/noncore/apps/opie-console/widget.cpp b/noncore/apps/opie-console/widget.cpp
index e17dfd4..c51983f 100644
--- a/noncore/apps/opie-console/widget.cpp
+++ b/noncore/apps/opie-console/widget.cpp
@@ -986,25 +986,25 @@ bool Widget::eventFilter( QObject *obj, QEvent *e )
986 static_cast<QKeyEvent *>( e )->ignore(); 986 static_cast<QKeyEvent *>( e )->ignore();
987 return true; 987 return true;
988 } 988 }
989 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) 989 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
990 return FALSE; // not us 990 return FALSE; // not us
991 if ( e->type() == QEvent::Wheel) { 991 if ( e->type() == QEvent::Wheel) {
992 QApplication::sendEvent(scrollbar, e); 992 QApplication::sendEvent(scrollbar, e);
993 } 993 }
994 994
995#ifdef FAKE_CTRL_AND_ALT 995#ifdef FAKE_CTRL_AND_ALT
996 static bool control = FALSE; 996 static bool control = FALSE;
997 static bool alt = FALSE; 997 static bool alt = FALSE;
998// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); 998// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
999 bool dele=FALSE; 999 bool dele=FALSE;
1000 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 1000 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
1001 QKeyEvent* ke = (QKeyEvent*)e; 1001 QKeyEvent* ke = (QKeyEvent*)e;
1002 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 1002 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
1003 switch (ke->key()) { 1003 switch (ke->key()) {
1004 case Key_F9: // let this be "Control" 1004 case Key_F9: // let this be "Control"
1005 control = keydown; 1005 control = keydown;
1006 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 1006 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
1007 dele=TRUE; 1007 dele=TRUE;
1008 break; 1008 break;
1009 case Key_F13: // let this be "Alt" 1009 case Key_F13: // let this be "Alt"
1010 alt = keydown; 1010 alt = keydown;
@@ -1025,29 +1025,29 @@ bool Widget::eventFilter( QObject *obj, QEvent *e )
1025 ke->ascii(), ke->state()|AltButton, ke->text()); 1025 ke->ascii(), ke->state()|AltButton, ke->text());
1026 dele=TRUE; 1026 dele=TRUE;
1027 } 1027 }
1028 } 1028 }
1029 } 1029 }
1030#endif 1030#endif
1031 1031
1032 if ( e->type() == QEvent::KeyPress ) { 1032 if ( e->type() == QEvent::KeyPress ) {
1033 QKeyEvent* ke = (QKeyEvent*)e; 1033 QKeyEvent* ke = (QKeyEvent*)e;
1034 actSel=0; // Key stroke implies a screen update, so Widget won't 1034 actSel=0; // Key stroke implies a screen update, so Widget won't
1035 // know where the current selection is. 1035 // know where the current selection is.
1036 1036
1037// qDebug("key pressed is 0x%x",ke->key()); 1037// odebug << "key pressed is 0x" << ke->key() << "" << oendl;
1038 1038
1039 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker 1039 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
1040 1040
1041// qDebug("key pressed 2 is 0x%x",ke->key()); 1041// odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl;
1042 emitText("\\"); // expose 1042 emitText("\\"); // expose
1043 } else 1043 } else
1044 emit keyPressedSignal(ke); // expose 1044 emit keyPressedSignal(ke); // expose
1045 ke->accept(); 1045 ke->accept();
1046#ifdef FAKE_CTRL_AND_ALT 1046#ifdef FAKE_CTRL_AND_ALT
1047 if ( dele ) delete e; 1047 if ( dele ) delete e;
1048#endif 1048#endif
1049 return true; // stop the event 1049 return true; // stop the event
1050 } 1050 }
1051 if ( e->type() == QEvent::Enter ) { 1051 if ( e->type() == QEvent::Enter ) {
1052 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), 1052 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
1053 this, SLOT(onClearSelection()) ); 1053 this, SLOT(onClearSelection()) );
diff --git a/noncore/apps/opie-console/widget_layer.cpp b/noncore/apps/opie-console/widget_layer.cpp
index 96dda1c..ab25919 100644
--- a/noncore/apps/opie-console/widget_layer.cpp
+++ b/noncore/apps/opie-console/widget_layer.cpp
@@ -66,25 +66,25 @@ bool WidgetLayer::eventFilter( QObject *obj, QEvent *e )
66{ 66{
67 if ( (e->type() == QEvent::Accel || 67 if ( (e->type() == QEvent::Accel ||
68 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { 68 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
69 static_cast<QKeyEvent *>( e )->ignore(); 69 static_cast<QKeyEvent *>( e )->ignore();
70 return true; 70 return true;
71 } 71 }
72 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) 72 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
73 return false; // not us 73 return false; // not us
74 74
75#ifdef FAKE_CTRL_AND_ALT 75#ifdef FAKE_CTRL_AND_ALT
76 static bool control = false; 76 static bool control = false;
77 static bool alt = false; 77 static bool alt = false;
78// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); 78// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
79 bool dele = false; 79 bool dele = false;
80 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 80 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
81 QKeyEvent* ke = (QKeyEvent*)e; 81 QKeyEvent* ke = (QKeyEvent*)e;
82 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 82 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
83 switch (ke->key()) { 83 switch (ke->key()) {
84 case Key_F9: // let this be "Control" 84 case Key_F9: // let this be "Control"
85 control = keydown; 85 control = keydown;
86 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 86 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
87 dele=TRUE; 87 dele=TRUE;
88 break; 88 break;
89 case Key_F13: // let this be "Alt" 89 case Key_F13: // let this be "Alt"
90 alt = keydown; 90 alt = keydown;
@@ -106,25 +106,25 @@ QChar(a,0));
106 ke->ascii(), ke->state()|AltButton, ke->text()); 106 ke->ascii(), ke->state()|AltButton, ke->text());
107 dele=TRUE; 107 dele=TRUE;
108 } 108 }
109 } 109 }
110 } 110 }
111#endif 111#endif
112 112
113 if ( e->type() == QEvent::KeyPress ) { 113 if ( e->type() == QEvent::KeyPress ) {
114 QKeyEvent* ke = (QKeyEvent*)e; 114 QKeyEvent* ke = (QKeyEvent*)e;
115 //actSel=0; // Key stroke implies a screen update, so Widget won't 115 //actSel=0; // Key stroke implies a screen update, so Widget won't
116 // know where the current selection is. 116 // know where the current selection is.
117 117
118// qDebug("key pressed is 0x%x",ke->key()); 118// odebug << "key pressed is 0x" << ke->key() << "" << oendl;
119 119
120 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker 120 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
121 insertText("\\"); // expose 121 insertText("\\"); // expose
122 } else 122 } else
123 emit keyPressed( ke ); // expose 123 emit keyPressed( ke ); // expose
124 ke->accept(); 124 ke->accept();
125#ifdef FAKE_CTRL_AND_ALT 125#ifdef FAKE_CTRL_AND_ALT
126 if ( dele ) delete e; 126 if ( dele ) delete e;
127#endif 127#endif
128 return true; // stop the event 128 return true; // stop the event
129 } 129 }
130 return QFrame::eventFilter( obj, e ); 130 return QFrame::eventFilter( obj, e );
diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp
index 90e1a70..aa03060 100644
--- a/noncore/apps/opie-write/mainwindow.cpp
+++ b/noncore/apps/opie-write/mainwindow.cpp
@@ -11,30 +11,34 @@
11** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 11** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
12** PURPOSE. 12** PURPOSE.
13** 13**
14** email sales@trolltech.com for information about Qtopia License 14** email sales@trolltech.com for information about Qtopia License
15** Agreements. 15** Agreements.
16** 16**
17** Contact info@trolltech.com if any conditions of this licensing are 17** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 18** not clear to you.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#include "mainwindow.h" 22#include "mainwindow.h"
23
24/* OPIE */
25#include <opie2/odebug.h>
23#include <qpe/fileselector.h> 26#include <qpe/fileselector.h>
24#include <qpe/applnk.h> 27#include <qpe/applnk.h>
25#include <qpe/resource.h> 28#include <qpe/resource.h>
26#include <qpe/fontdatabase.h> 29#include <qpe/fontdatabase.h>
30using namespace Opie::Core;
27 31
28//#include "qspellchecker.h" 32/* QT */
29#include "qtextedit.h" 33#include "qtextedit.h"
30#include <qaction.h> 34#include <qaction.h>
31#include <qtoolbar.h> 35#include <qtoolbar.h>
32#include <qtoolbutton.h> 36#include <qtoolbutton.h>
33#include <qtabwidget.h> 37#include <qtabwidget.h>
34#include <qapplication.h> 38#include <qapplication.h>
35#include <qfontdatabase.h> 39#include <qfontdatabase.h>
36#include <qcombobox.h> 40#include <qcombobox.h>
37#include <qlineedit.h> 41#include <qlineedit.h>
38#include <qfileinfo.h> 42#include <qfileinfo.h>
39#include <qfile.h> 43#include <qfile.h>
40#include <qfiledialog.h> 44#include <qfiledialog.h>
@@ -435,56 +439,56 @@ void MainWindow::fileOpen()
435{ 439{
436 save(); 440 save();
437 editorStack->raiseWidget( fileSelector ); 441 editorStack->raiseWidget( fileSelector );
438 fileSelector->reread(); 442 fileSelector->reread();
439 hideEditTools(); 443 hideEditTools();
440 fileSelector->setNewVisible( TRUE ); 444 fileSelector->setNewVisible( TRUE );
441 clear(); 445 clear();
442 updateCaption(); 446 updateCaption();
443} 447}
444 448
445void MainWindow::fileRevert() 449void MainWindow::fileRevert()
446{ 450{
447 qDebug( "QMainWindow::fileRevert needs to be done" ); 451 odebug << "QMainWindow::fileRevert needs to be done" << oendl;
448} 452}
449 453
450void MainWindow::fileNew() 454void MainWindow::fileNew()
451{ 455{
452 editor->setTextFormat( Qt::RichText ); 456 editor->setTextFormat( Qt::RichText );
453 save(); 457 save();
454 newFile(DocLnk()); 458 newFile(DocLnk());
455} 459}
456 460
457void MainWindow::insertTable() 461void MainWindow::insertTable()
458{ 462{
459 qDebug( "MainWindow::insertTable() needs to be done" ); 463 odebug << "MainWindow::insertTable() needs to be done" << oendl;
460} 464}
461 465
462void MainWindow::newFile( const DocLnk &dl ) 466void MainWindow::newFile( const DocLnk &dl )
463{ 467{
464 DocLnk nf = dl; 468 DocLnk nf = dl;
465 nf.setType( "text/html" ); 469 nf.setType( "text/html" );
466 clear(); 470 clear();
467 editorStack->raiseWidget( editor ); 471 editorStack->raiseWidget( editor );
468 editor->viewport()->setFocus(); 472 editor->viewport()->setFocus();
469 doc = new DocLnk( nf ); 473 doc = new DocLnk( nf );
470 updateCaption(); 474 updateCaption();
471} 475}
472 476
473void MainWindow::openFile( const DocLnk &dl ) 477void MainWindow::openFile( const DocLnk &dl )
474{ 478{
475 FileManager fm; 479 FileManager fm;
476 QString txt; 480 QString txt;
477 if ( !fm.loadFile( dl, txt ) ) 481 if ( !fm.loadFile( dl, txt ) )
478 qDebug( "couldn't open file" ); 482 odebug << "couldn't open file" << oendl;
479 clear(); 483 clear();
480 editorStack->raiseWidget( editor ); 484 editorStack->raiseWidget( editor );
481 editor->viewport()->setFocus(); 485 editor->viewport()->setFocus();
482 doc = new DocLnk( dl ); 486 doc = new DocLnk( dl );
483 editor->setText( txt ); 487 editor->setText( txt );
484 editor->setModified( FALSE ); 488 editor->setModified( FALSE );
485 updateCaption(); 489 updateCaption();
486} 490}
487 491
488void MainWindow::showEditTools( void ) 492void MainWindow::showEditTools( void )
489{ 493{
490 tbMenu->show(); 494 tbMenu->show();
diff --git a/noncore/apps/opie-write/opie-write.pro b/noncore/apps/opie-write/opie-write.pro
index 044ce7e..8e514d4 100644
--- a/noncore/apps/opie-write/opie-write.pro
+++ b/noncore/apps/opie-write/opie-write.pro
@@ -1,15 +1,14 @@
1 1
2CONFIG += qt warn on quick-app 2CONFIG += qt warn on quick-app
3
4 3
5HEADERS = qcleanuphandler.h \ 4HEADERS = qcleanuphandler.h \
6 qcomplextext_p.h \ 5 qcomplextext_p.h \
7 qrichtext_p.h \ 6 qrichtext_p.h \
8 qstylesheet.h \ 7 qstylesheet.h \
9 qtextedit.h \ 8 qtextedit.h \
10 mainwindow.h 9 mainwindow.h
11 10
12SOURCES = qcomplextext.cpp \ 11SOURCES = qcomplextext.cpp \
13 qstylesheet.cpp \ 12 qstylesheet.cpp \
14 qrichtext_p.cpp \ 13 qrichtext_p.cpp \
15 qrichtext.cpp \ 14 qrichtext.cpp \
diff --git a/noncore/apps/opie-write/qcomplextext.cpp b/noncore/apps/opie-write/qcomplextext.cpp
index 473f184..00a91c5 100644
--- a/noncore/apps/opie-write/qcomplextext.cpp
+++ b/noncore/apps/opie-write/qcomplextext.cpp
@@ -97,43 +97,43 @@ QBidiContext::~QBidiContext()
97 previous and left with next in the above rules ;-) 97 previous and left with next in the above rules ;-)
98*/ 98*/
99 99
100/* 100/*
101 Two small helper functions for arabic shaping. They get the next shape causing character on either 101 Two small helper functions for arabic shaping. They get the next shape causing character on either
102 side of the char in question. Implements rule R1. 102 side of the char in question. Implements rule R1.
103 103
104 leftChar() returns true if the char to the left is a left join-causing char 104 leftChar() returns true if the char to the left is a left join-causing char
105 rightChar() returns true if the char to the right is a right join-causing char 105 rightChar() returns true if the char to the right is a right join-causing char
106*/ 106*/
107static inline const QChar *prevChar( const QString &str, int pos ) 107static inline const QChar *prevChar( const QString &str, int pos )
108{ 108{
109 //qDebug("leftChar: pos=%d", pos); 109 //odebug << "leftChar: pos=" << pos << "" << oendl;
110 pos--; 110 pos--;
111 const QChar *ch = str.unicode() + pos; 111 const QChar *ch = str.unicode() + pos;
112 while( pos > -1 ) { 112 while( pos > -1 ) {
113 if( !ch->isMark() ) 113 if( !ch->isMark() )
114 return ch; 114 return ch;
115 pos--; 115 pos--;
116 ch--; 116 ch--;
117 } 117 }
118 return &QChar::replacement; 118 return &QChar::replacement;
119} 119}
120 120
121static inline const QChar *nextChar( const QString &str, int pos) 121static inline const QChar *nextChar( const QString &str, int pos)
122{ 122{
123 pos++; 123 pos++;
124 int len = str.length(); 124 int len = str.length();
125 const QChar *ch = str.unicode() + pos; 125 const QChar *ch = str.unicode() + pos;
126 while( pos < len ) { 126 while( pos < len ) {
127 //qDebug("rightChar: %d isLetter=%d, joining=%d", pos, ch.isLetter(), ch.joining()); 127 //odebug << "rightChar: " << pos << " isLetter=" << ch.isLetter() << ", joining=" << ch.joining() << "" << oendl;
128 if( !ch->isMark() ) 128 if( !ch->isMark() )
129 return ch; 129 return ch;
130 // assume it's a transparent char, this might not be 100% correct 130 // assume it's a transparent char, this might not be 100% correct
131 pos++; 131 pos++;
132 ch++; 132 ch++;
133 } 133 }
134 return &QChar::replacement; 134 return &QChar::replacement;
135} 135}
136 136
137static inline bool prevVisualCharJoins( const QString &str, int pos) 137static inline bool prevVisualCharJoins( const QString &str, int pos)
138{ 138{
139 return ( prevChar( str, pos )->joining() != QChar::OtherJoining ); 139 return ( prevChar( str, pos )->joining() != QChar::OtherJoining );
diff --git a/noncore/apps/opie-write/qrichtext.cpp b/noncore/apps/opie-write/qrichtext.cpp
index b77a0fc..c27eb1e 100644
--- a/noncore/apps/opie-write/qrichtext.cpp
+++ b/noncore/apps/opie-write/qrichtext.cpp
@@ -28,29 +28,35 @@
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements. 29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information. 30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37 37
38#include "qrichtext_p.h" 38#include "qrichtext_p.h"
39 39
40/* OPIE */
41#include <opie2/odebug.h>
42using namespace Opie::Core;
43
44/* QT */
40#include "qdragobject.h" 45#include "qdragobject.h"
41#include "qpaintdevicemetrics.h" 46#include "qpaintdevicemetrics.h"
42#include "qdrawutil.h" 47#include "qdrawutil.h"
43#include "qcleanuphandler.h" 48#include "qcleanuphandler.h"
44 49
50/* STD */
45#include <stdlib.h> 51#include <stdlib.h>
46 52
47using namespace Qt3; 53using namespace Qt3;
48 54
49static QTextCursor* richTextExportStart = 0; 55static QTextCursor* richTextExportStart = 0;
50static QTextCursor* richTextExportEnd = 0; 56static QTextCursor* richTextExportEnd = 0;
51 57
52static QTextFormatCollection *qFormatCollection = 0; 58static QTextFormatCollection *qFormatCollection = 0;
53 59
54const int border_tolerance = 2; 60const int border_tolerance = 2;
55 61
56#ifdef Q_WS_WIN 62#ifdef Q_WS_WIN
@@ -175,25 +181,25 @@ QTextDeleteCommand::~QTextDeleteCommand()
175{ 181{
176 for ( int i = 0; i < (int)text.size(); ++i ) { 182 for ( int i = 0; i < (int)text.size(); ++i ) {
177 if ( text[ i ].format() ) 183 if ( text[ i ].format() )
178 text[ i ].format()->removeRef(); 184 text[ i ].format()->removeRef();
179 } 185 }
180 text.resize( 0 ); 186 text.resize( 0 );
181} 187}
182 188
183QTextCursor *QTextDeleteCommand::execute( QTextCursor *c ) 189QTextCursor *QTextDeleteCommand::execute( QTextCursor *c )
184{ 190{
185 QTextParagraph *s = doc ? doc->paragAt( id ) : parag; 191 QTextParagraph *s = doc ? doc->paragAt( id ) : parag;
186 if ( !s ) { 192 if ( !s ) {
187 qWarning( "can't locate parag at %d, last parag: %d", id, doc->lastParagraph()->paragId() ); 193 owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl;
188 return 0; 194 return 0;
189 } 195 }
190 196
191 cursor.setParagraph( s ); 197 cursor.setParagraph( s );
192 cursor.setIndex( index ); 198 cursor.setIndex( index );
193 int len = text.size(); 199 int len = text.size();
194 if ( c ) 200 if ( c )
195 *c = cursor; 201 *c = cursor;
196 if ( doc ) { 202 if ( doc ) {
197 doc->setSelectionStart( QTextDocument::Temp, cursor ); 203 doc->setSelectionStart( QTextDocument::Temp, cursor );
198 for ( int i = 0; i < len; ++i ) 204 for ( int i = 0; i < len; ++i )
199 cursor.gotoNextLetter(); 205 cursor.gotoNextLetter();
@@ -203,25 +209,25 @@ QTextCursor *QTextDeleteCommand::execute( QTextCursor *c )
203 *c = cursor; 209 *c = cursor;
204 } else { 210 } else {
205 s->remove( index, len ); 211 s->remove( index, len );
206 } 212 }
207 213
208 return c; 214 return c;
209} 215}
210 216
211QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c ) 217QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c )
212{ 218{
213 QTextParagraph *s = doc ? doc->paragAt( id ) : parag; 219 QTextParagraph *s = doc ? doc->paragAt( id ) : parag;
214 if ( !s ) { 220 if ( !s ) {
215 qWarning( "can't locate parag at %d, last parag: %d", id, doc->lastParagraph()->paragId() ); 221 owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl;
216 return 0; 222 return 0;
217 } 223 }
218 224
219 cursor.setParagraph( s ); 225 cursor.setParagraph( s );
220 cursor.setIndex( index ); 226 cursor.setIndex( index );
221 QString str = QTextString::toString( text ); 227 QString str = QTextString::toString( text );
222 cursor.insert( str, TRUE, &text ); 228 cursor.insert( str, TRUE, &text );
223 cursor.setParagraph( s ); 229 cursor.setParagraph( s );
224 cursor.setIndex( index ); 230 cursor.setIndex( index );
225 if ( c ) { 231 if ( c ) {
226 c->setParagraph( s ); 232 c->setParagraph( s );
227 c->setIndex( index ); 233 c->setIndex( index );
@@ -1535,28 +1541,28 @@ void QTextDocument::setRichTextInternal( const QString &text, QTextCursor* curso
1535 curpar->setAlignment( curtag.alignment ); 1541 curpar->setAlignment( curtag.alignment );
1536 custom = parseTable( attr, format, doc, length, pos, curpar ); 1542 custom = parseTable( attr, format, doc, length, pos, curpar );
1537 } else if ( tagname == "qt" || tagname == "body" ) { 1543 } else if ( tagname == "qt" || tagname == "body" ) {
1538 if ( attr.contains( "bgcolor" ) ) { 1544 if ( attr.contains( "bgcolor" ) ) {
1539 QBrush *b = new QBrush( QColor( attr["bgcolor"] ) ); 1545 QBrush *b = new QBrush( QColor( attr["bgcolor"] ) );
1540 setPaper( b ); 1546 setPaper( b );
1541 } 1547 }
1542 if ( attr.contains( "background" ) ) { 1548 if ( attr.contains( "background" ) ) {
1543 QImage img; 1549 QImage img;
1544 QString bg = attr["background"]; 1550 QString bg = attr["background"];
1545 const QMimeSource* m = factory_->data( bg, contxt ); 1551 const QMimeSource* m = factory_->data( bg, contxt );
1546 if ( !m ) { 1552 if ( !m ) {
1547 qWarning("QRichText: no mimesource for %s", bg.latin1() ); 1553 owarn << "QRichText: no mimesource for " << bg.latin1() << "" << oendl;
1548 } else { 1554 } else {
1549 if ( !QImageDrag::decode( m, img ) ) { 1555 if ( !QImageDrag::decode( m, img ) ) {
1550 qWarning("QTextImage: cannot decode %s", bg.latin1() ); 1556 owarn << "QTextImage: cannot decode " << bg.latin1() << "" << oendl;
1551 } 1557 }
1552 } 1558 }
1553 if ( !img.isNull() ) { 1559 if ( !img.isNull() ) {
1554 QPixmap pm; 1560 QPixmap pm;
1555 pm.convertFromImage( img ); 1561 pm.convertFromImage( img );
1556 QBrush *b = new QBrush( QColor(), pm ); 1562 QBrush *b = new QBrush( QColor(), pm );
1557 setPaper( b ); 1563 setPaper( b );
1558 } 1564 }
1559 } 1565 }
1560 if ( attr.contains( "text" ) ) { 1566 if ( attr.contains( "text" ) ) {
1561 QColor c( attr["text"] ); 1567 QColor c( attr["text"] );
1562 if ( formatCollection()->defaultFormat()->color() != c ) { 1568 if ( formatCollection()->defaultFormat()->color() != c ) {
@@ -2143,25 +2149,25 @@ QString QTextDocument::richText() const
2143 s += QString::number( formatCollection()->defaultFormat()->font().pointSize() ); 2149 s += QString::number( formatCollection()->defaultFormat()->font().pointSize() );
2144 s += "pt;font-family:"; 2150 s += "pt;font-family:";
2145 s += formatCollection()->defaultFormat()->font().family(); 2151 s += formatCollection()->defaultFormat()->font().family();
2146 s +="\">"; 2152 s +="\">";
2147 } 2153 }
2148 QTextParagraph* p = fParag; 2154 QTextParagraph* p = fParag;
2149 2155
2150 QStyleSheetItem* item_p = styleSheet()->item("p"); 2156 QStyleSheetItem* item_p = styleSheet()->item("p");
2151 QStyleSheetItem* item_ul = styleSheet()->item("ul"); 2157 QStyleSheetItem* item_ul = styleSheet()->item("ul");
2152 QStyleSheetItem* item_ol = styleSheet()->item("ol"); 2158 QStyleSheetItem* item_ol = styleSheet()->item("ol");
2153 QStyleSheetItem* item_li = styleSheet()->item("li"); 2159 QStyleSheetItem* item_li = styleSheet()->item("li");
2154 if ( !item_p || !item_ul || !item_ol || !item_li ) { 2160 if ( !item_p || !item_ul || !item_ol || !item_li ) {
2155 qWarning( "QTextEdit: cannot export HTML due to insufficient stylesheet (lack of p, ul, ol, or li)" ); 2161 owarn << "QTextEdit: cannot export HTML due to insufficient stylesheet (lack of p, ul, ol, or li)" << oendl;
2156 return QString::null; 2162 return QString::null;
2157 } 2163 }
2158 int pastListDepth = 0; 2164 int pastListDepth = 0;
2159 int listDepth = 0; 2165 int listDepth = 0;
2160 int futureListDepth = 0; 2166 int futureListDepth = 0;
2161 QMemArray<int> listStyles(10); 2167 QMemArray<int> listStyles(10);
2162 2168
2163 while ( p ) { 2169 while ( p ) {
2164 listDepth = p->listDepth(); 2170 listDepth = p->listDepth();
2165 if ( listDepth < pastListDepth ) { 2171 if ( listDepth < pastListDepth ) {
2166 for ( int i = listDepth+1; i <= pastListDepth; i++ ) 2172 for ( int i = listDepth+1; i <= pastListDepth; i++ )
2167 s += list_is_ordered( listStyles[i] ) ? "</ol>" : "</ul>"; 2173 s += list_is_ordered( listStyles[i] ) ? "</ol>" : "</ul>";
@@ -4087,25 +4093,25 @@ int QTextParagraph::lineHeightOfChar( int i, int *bl, int *y ) const
4087 if ( i >= it.key() ) { 4093 if ( i >= it.key() ) {
4088 if ( bl ) 4094 if ( bl )
4089 *bl = ( *it )->baseLine; 4095 *bl = ( *it )->baseLine;
4090 if ( y ) 4096 if ( y )
4091 *y = ( *it )->y; 4097 *y = ( *it )->y;
4092 return ( *it )->h; 4098 return ( *it )->h;
4093 } 4099 }
4094 if ( it == lineStarts.begin() ) 4100 if ( it == lineStarts.begin() )
4095 break; 4101 break;
4096 --it; 4102 --it;
4097 } 4103 }
4098 4104
4099 qWarning( "QTextParagraph::lineHeightOfChar: couldn't find lh for %d", i ); 4105 owarn << "QTextParagraph::lineHeightOfChar: couldn't find lh for " << i << "" << oendl;
4100 return 15; 4106 return 15;
4101} 4107}
4102 4108
4103QTextStringChar *QTextParagraph::lineStartOfChar( int i, int *index, int *line ) const 4109QTextStringChar *QTextParagraph::lineStartOfChar( int i, int *index, int *line ) const
4104{ 4110{
4105 if ( !isValid() ) 4111 if ( !isValid() )
4106 ( (QTextParagraph*)this )->format(); 4112 ( (QTextParagraph*)this )->format();
4107 4113
4108 int l = (int)lineStarts.count() - 1; 4114 int l = (int)lineStarts.count() - 1;
4109 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.end(); 4115 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.end();
4110 --it; 4116 --it;
4111 for ( ;; ) { 4117 for ( ;; ) {
@@ -4113,25 +4119,25 @@ QTextStringChar *QTextParagraph::lineStartOfChar( int i, int *index, int *line )
4113 if ( index ) 4119 if ( index )
4114 *index = it.key(); 4120 *index = it.key();
4115 if ( line ) 4121 if ( line )
4116 *line = l; 4122 *line = l;
4117 return &str->at( it.key() ); 4123 return &str->at( it.key() );
4118 } 4124 }
4119 if ( it == lineStarts.begin() ) 4125 if ( it == lineStarts.begin() )
4120 break; 4126 break;
4121 --it; 4127 --it;
4122 --l; 4128 --l;
4123 } 4129 }
4124 4130
4125 qWarning( "QTextParagraph::lineStartOfChar: couldn't find %d", i ); 4131 owarn << "QTextParagraph::lineStartOfChar: couldn't find " << i << "" << oendl;
4126 return 0; 4132 return 0;
4127} 4133}
4128 4134
4129int QTextParagraph::lines() const 4135int QTextParagraph::lines() const
4130{ 4136{
4131 if ( !isValid() ) 4137 if ( !isValid() )
4132 ( (QTextParagraph*)this )->format(); 4138 ( (QTextParagraph*)this )->format();
4133 4139
4134 return (int)lineStarts.count(); 4140 return (int)lineStarts.count();
4135} 4141}
4136 4142
4137QTextStringChar *QTextParagraph::lineStartOfLine( int line, int *index ) const 4143QTextStringChar *QTextParagraph::lineStartOfLine( int line, int *index ) const
@@ -4140,25 +4146,25 @@ QTextStringChar *QTextParagraph::lineStartOfLine( int line, int *index ) const
4140 ( (QTextParagraph*)this )->format(); 4146 ( (QTextParagraph*)this )->format();
4141 4147
4142 if ( line >= 0 && line < (int)lineStarts.count() ) { 4148 if ( line >= 0 && line < (int)lineStarts.count() ) {
4143 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin(); 4149 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
4144 while ( line-- > 0 ) 4150 while ( line-- > 0 )
4145 ++it; 4151 ++it;
4146 int i = it.key(); 4152 int i = it.key();
4147 if ( index ) 4153 if ( index )
4148 *index = i; 4154 *index = i;
4149 return &str->at( i ); 4155 return &str->at( i );
4150 } 4156 }
4151 4157
4152 qWarning( "QTextParagraph::lineStartOfLine: couldn't find %d", line ); 4158 owarn << "QTextParagraph::lineStartOfLine: couldn't find " << line << "" << oendl;
4153 return 0; 4159 return 0;
4154} 4160}
4155 4161
4156int QTextParagraph::leftGap() const 4162int QTextParagraph::leftGap() const
4157{ 4163{
4158 if ( !isValid() ) 4164 if ( !isValid() )
4159 ( (QTextParagraph*)this )->format(); 4165 ( (QTextParagraph*)this )->format();
4160 4166
4161 int line = 0; 4167 int line = 0;
4162 int x = str->at(0).x; /* set x to x of first char */ 4168 int x = str->at(0).x; /* set x to x of first char */
4163 if ( str->isBidi() ) { 4169 if ( str->isBidi() ) {
4164 for ( int i = 1; i < str->length()-1; ++i ) 4170 for ( int i = 1; i < str->length()-1; ++i )
@@ -5688,25 +5694,25 @@ QTextFormat *QTextFormatCollection::format( const QFont &f, const QColor &c )
5688 if ( cachedFormat ) { 5694 if ( cachedFormat ) {
5689 cachedFormat->addRef(); 5695 cachedFormat->addRef();
5690 return cachedFormat; 5696 return cachedFormat;
5691 } 5697 }
5692 5698
5693 if ( key == defFormat->key() ) 5699 if ( key == defFormat->key() )
5694 return defFormat; 5700 return defFormat;
5695 5701
5696 cachedFormat = createFormat( f, c ); 5702 cachedFormat = createFormat( f, c );
5697 cachedFormat->collection = this; 5703 cachedFormat->collection = this;
5698 cKey.insert( cachedFormat->key(), cachedFormat ); 5704 cKey.insert( cachedFormat->key(), cachedFormat );
5699 if ( cachedFormat->key() != key ) 5705 if ( cachedFormat->key() != key )
5700 qWarning("ASSERT: keys for format not identical: '%s '%s'", cachedFormat->key().latin1(), key.latin1() ); 5706 owarn << "ASSERT: keys for format not identical: '" << cachedFormat->key().latin1() << " '" << key.latin1() << "'" << oendl;
5701 return cachedFormat; 5707 return cachedFormat;
5702} 5708}
5703 5709
5704void QTextFormatCollection::remove( QTextFormat *f ) 5710void QTextFormatCollection::remove( QTextFormat *f )
5705{ 5711{
5706 if ( lastFormat == f ) 5712 if ( lastFormat == f )
5707 lastFormat = 0; 5713 lastFormat = 0;
5708 if ( cres == f ) 5714 if ( cres == f )
5709 cres = 0; 5715 cres = 0;
5710 if ( cachedFormat == f ) 5716 if ( cachedFormat == f )
5711 cachedFormat = 0; 5717 cachedFormat = 0;
5712 cKey.remove( f->key() ); 5718 cKey.remove( f->key() );
@@ -6074,29 +6080,29 @@ QTextImage::QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, co
6074 pixmap_map = new QMap<QString, QPixmapInt>; 6080 pixmap_map = new QMap<QString, QPixmapInt>;
6075 if ( pixmap_map->contains( imgId ) ) { 6081 if ( pixmap_map->contains( imgId ) ) {
6076 QPixmapInt& pmi = pixmap_map->operator[](imgId); 6082 QPixmapInt& pmi = pixmap_map->operator[](imgId);
6077 pm = pmi.pm; 6083 pm = pmi.pm;
6078 pmi.ref++; 6084 pmi.ref++;
6079 width = pm.width(); 6085 width = pm.width();
6080 height = pm.height(); 6086 height = pm.height();
6081 } else { 6087 } else {
6082 QImage img; 6088 QImage img;
6083 const QMimeSource* m = 6089 const QMimeSource* m =
6084 factory.data( imageName, context ); 6090 factory.data( imageName, context );
6085 if ( !m ) { 6091 if ( !m ) {
6086 qWarning("QTextImage: no mimesource for %s", imageName.latin1() ); 6092 owarn << "QTextImage: no mimesource for " << imageName.latin1() << "" << oendl;
6087 } 6093 }
6088 else { 6094 else {
6089 if ( !QImageDrag::decode( m, img ) ) { 6095 if ( !QImageDrag::decode( m, img ) ) {
6090 qWarning("QTextImage: cannot decode %s", imageName.latin1() ); 6096 owarn << "QTextImage: cannot decode " << imageName.latin1() << "" << oendl;
6091 } 6097 }
6092 } 6098 }
6093 6099
6094 if ( !img.isNull() ) { 6100 if ( !img.isNull() ) {
6095 if ( width == 0 ) { 6101 if ( width == 0 ) {
6096 width = img.width(); 6102 width = img.width();
6097 if ( height != 0 ) { 6103 if ( height != 0 ) {
6098 width = img.width() * height / img.height(); 6104 width = img.width() * height / img.height();
6099 } 6105 }
6100 } 6106 }
6101 if ( height == 0 ) { 6107 if ( height == 0 ) {
6102 height = img.height(); 6108 height = img.height();
diff --git a/noncore/apps/opie-write/qrichtext_p.cpp b/noncore/apps/opie-write/qrichtext_p.cpp
index 6783e0b..2e8b09c 100644
--- a/noncore/apps/opie-write/qrichtext_p.cpp
+++ b/noncore/apps/opie-write/qrichtext_p.cpp
@@ -26,24 +26,27 @@
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27** 27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements. 29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information. 30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37 37
38#include <opie2/odebug.h>
39using namespace Opie::Core;
40
38#include "qrichtext_p.h" 41#include "qrichtext_p.h"
39 42
40using namespace Qt3; 43using namespace Qt3;
41 44
42QTextCommand::~QTextCommand() {} 45QTextCommand::~QTextCommand() {}
43QTextCommand::Commands QTextCommand::type() const { return Invalid; } 46QTextCommand::Commands QTextCommand::type() const { return Invalid; }
44 47
45 48
46QTextCustomItem::~QTextCustomItem() {} 49QTextCustomItem::~QTextCustomItem() {}
47void QTextCustomItem::adjustToPainter( QPainter* p){ if ( p ) width = 0; } 50void QTextCustomItem::adjustToPainter( QPainter* p){ if ( p ) width = 0; }
48QTextCustomItem::Placement QTextCustomItem::placement() const { return PlaceInline; } 51QTextCustomItem::Placement QTextCustomItem::placement() const { return PlaceInline; }
49 52
@@ -128,25 +131,25 @@ QTextDocument *QTextCursor::document() const
128} 131}
129 132
130void QTextCursor::gotoPosition( QTextParagraph* p, int index ) 133void QTextCursor::gotoPosition( QTextParagraph* p, int index )
131{ 134{
132 if ( para && p != para ) { 135 if ( para && p != para ) {
133 while ( para->document() != p->document() && !indices.isEmpty() ) 136 while ( para->document() != p->document() && !indices.isEmpty() )
134 pop(); 137 pop();
135 Q_ASSERT( indices.isEmpty() || para->document() == p->document() ); 138 Q_ASSERT( indices.isEmpty() || para->document() == p->document() );
136 } 139 }
137 para = p; 140 para = p;
138 if ( index < 0 || index >= para->length() ) { 141 if ( index < 0 || index >= para->length() ) {
139#if defined(QT_CHECK_RANGE) 142#if defined(QT_CHECK_RANGE)
140 qWarning( "QTextCursor::gotoParagraph Index: %d out of range", index ); 143 owarn << "QTextCursor::gotoParagraph Index: " << index << " out of range" << oendl;
141#endif 144#endif
142 index = index < 0 ? 0 : para->length() - 1; 145 index = index < 0 ? 0 : para->length() - 1;
143 } 146 }
144 147
145 tmpIndex = -1; 148 tmpIndex = -1;
146 idx = index; 149 idx = index;
147} 150}
148 151
149bool QTextDocument::hasSelection( int id, bool visible ) const 152bool QTextDocument::hasSelection( int id, bool visible ) const
150{ 153{
151 return ( selections.find( id ) != selections.end() && 154 return ( selections.find( id ) != selections.end() &&
152 ( !visible || 155 ( !visible ||
@@ -468,74 +471,74 @@ bool QTextParagraph::fullSelected( int id ) const
468{ 471{
469 if ( !mSelections ) 472 if ( !mSelections )
470 return FALSE; 473 return FALSE;
471 QMap<int, QTextParagraphSelection>::ConstIterator it = mSelections->find( id ); 474 QMap<int, QTextParagraphSelection>::ConstIterator it = mSelections->find( id );
472 if ( it == mSelections->end() ) 475 if ( it == mSelections->end() )
473 return FALSE; 476 return FALSE;
474 return ( *it ).start == 0 && ( *it ).end == str->length() - 1; 477 return ( *it ).start == 0 && ( *it ).end == str->length() - 1;
475} 478}
476 479
477int QTextParagraph::lineY( int l ) const 480int QTextParagraph::lineY( int l ) const
478{ 481{
479 if ( l > (int)lineStarts.count() - 1 ) { 482 if ( l > (int)lineStarts.count() - 1 ) {
480 qWarning( "QTextParagraph::lineY: line %d out of range!", l ); 483 owarn << "QTextParagraph::lineY: line " << l << " out of range!" << oendl;
481 return 0; 484 return 0;
482 } 485 }
483 486
484 if ( !isValid() ) 487 if ( !isValid() )
485 ( (QTextParagraph*)this )->format(); 488 ( (QTextParagraph*)this )->format();
486 489
487 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin(); 490 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
488 while ( l-- > 0 ) 491 while ( l-- > 0 )
489 ++it; 492 ++it;
490 return ( *it )->y; 493 return ( *it )->y;
491} 494}
492 495
493int QTextParagraph::lineBaseLine( int l ) const 496int QTextParagraph::lineBaseLine( int l ) const
494{ 497{
495 if ( l > (int)lineStarts.count() - 1 ) { 498 if ( l > (int)lineStarts.count() - 1 ) {
496 qWarning( "QTextParagraph::lineBaseLine: line %d out of range!", l ); 499 owarn << "QTextParagraph::lineBaseLine: line " << l << " out of range!" << oendl;
497 return 10; 500 return 10;
498 } 501 }
499 502
500 if ( !isValid() ) 503 if ( !isValid() )
501 ( (QTextParagraph*)this )->format(); 504 ( (QTextParagraph*)this )->format();
502 505
503 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin(); 506 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
504 while ( l-- > 0 ) 507 while ( l-- > 0 )
505 ++it; 508 ++it;
506 return ( *it )->baseLine; 509 return ( *it )->baseLine;
507} 510}
508 511
509int QTextParagraph::lineHeight( int l ) const 512int QTextParagraph::lineHeight( int l ) const
510{ 513{
511 if ( l > (int)lineStarts.count() - 1 ) { 514 if ( l > (int)lineStarts.count() - 1 ) {
512 qWarning( "QTextParagraph::lineHeight: line %d out of range!", l ); 515 owarn << "QTextParagraph::lineHeight: line " << l << " out of range!" << oendl;
513 return 15; 516 return 15;
514 } 517 }
515 518
516 if ( !isValid() ) 519 if ( !isValid() )
517 ( (QTextParagraph*)this )->format(); 520 ( (QTextParagraph*)this )->format();
518 521
519 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin(); 522 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
520 while ( l-- > 0 ) 523 while ( l-- > 0 )
521 ++it; 524 ++it;
522 return ( *it )->h; 525 return ( *it )->h;
523} 526}
524 527
525void QTextParagraph::lineInfo( int l, int &y, int &h, int &bl ) const 528void QTextParagraph::lineInfo( int l, int &y, int &h, int &bl ) const
526{ 529{
527 if ( l > (int)lineStarts.count() - 1 ) { 530 if ( l > (int)lineStarts.count() - 1 ) {
528 qWarning( "QTextParagraph::lineInfo: line %d out of range!", l ); 531 owarn << "QTextParagraph::lineInfo: line " << l << " out of range!" << oendl;
529 qDebug( "%d %d", (int)lineStarts.count() - 1, l ); 532 odebug << "" << (int)lineStarts.count() - 1 << " " << l << "" << oendl;
530 y = 0; 533 y = 0;
531 h = 15; 534 h = 15;
532 bl = 10; 535 bl = 10;
533 return; 536 return;
534 } 537 }
535 538
536 if ( !isValid() ) 539 if ( !isValid() )
537 ( (QTextParagraph*)this )->format(); 540 ( (QTextParagraph*)this )->format();
538 541
539 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin(); 542 QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
540 while ( l-- > 0 ) 543 while ( l-- > 0 )
541 ++it; 544 ++it;
diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp
index 0fe5b09..046d997 100755
--- a/noncore/apps/qashmoney/accountdisplay.cpp
+++ b/noncore/apps/qashmoney/accountdisplay.cpp
@@ -1,21 +1,26 @@
1#include <qmessagebox.h>
2#include <qheader.h>
3
4#include "accountdisplay.h" 1#include "accountdisplay.h"
5#include "newaccount.h" 2#include "newaccount.h"
6#include "transaction.h" 3#include "transaction.h"
7#include "transferdialog.h" 4#include "transferdialog.h"
8#include "transfer.h" 5#include "transfer.h"
9 6
7/* OPIE */
8#include <opie2/odebug.h>
9using namespace Opie::Core;
10
11/* QT */
12#include <qmessagebox.h>
13#include <qheader.h>
14
10extern Account *account; 15extern Account *account;
11extern Transaction *transaction; 16extern Transaction *transaction;
12extern Transfer *transfer; 17extern Transfer *transfer;
13extern Preferences *preferences; 18extern Preferences *preferences;
14 19
15AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) 20AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent )
16 { 21 {
17 cleared = 0; 22 cleared = 0;
18 23
19 firstline = new QHBox ( this ); 24 firstline = new QHBox ( this );
20 firstline->setSpacing ( 2 ); 25 firstline->setSpacing ( 2 );
21 26
@@ -258,25 +263,25 @@ void AccountDisplay::getTransferAccounts ( QListViewItem * item )
258 // enter today's date in the date box as default 263 // enter today's date in the date box as default
259 QDate today = QDate::currentDate (); 264 QDate today = QDate::currentDate ();
260 int defaultday = today.day(); 265 int defaultday = today.day();
261 int defaultmonth = today.month(); 266 int defaultmonth = today.month();
262 int defaultyear = today.year(); 267 int defaultyear = today.year();
263 td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); 268 td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) );
264 269
265 if ( td->exec() == QDialog::Accepted ) 270 if ( td->exec() == QDialog::Accepted )
266 { 271 {
267 // set the cleared integer if the checkbox is checked 272 // set the cleared integer if the checkbox is checked
268 if ( td->clearedcheckbox->isChecked() == TRUE ) 273 if ( td->clearedcheckbox->isChecked() == TRUE )
269 cleared = 1; 274 cleared = 1;
270 qDebug("Year from transferdialog = %i",td->getYear()); 275 odebug << "Year from transferdialog = " << td->getYear() << "" << oendl;
271 // add the transfer with a new date if its been edited or use the default date 276 // add the transfer with a new date if its been edited or use the default date
272 if ( td->getDateEdited () == TRUE ) 277 if ( td->getDateEdited () == TRUE )
273 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); 278 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared );
274 else 279 else
275 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); 280 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared );
276 281
277 // update account balances of both accounts and parents if necessary 282 // update account balances of both accounts and parents if necessary
278 account->updateAccountBalance ( firstaccountid ); 283 account->updateAccountBalance ( firstaccountid );
279 if ( account->getParentAccountID ( firstaccountid ) != -1 ) 284 if ( account->getParentAccountID ( firstaccountid ) != -1 )
280 account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) ); 285 account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) );
281 account->updateAccountBalance ( secondaccountid ); 286 account->updateAccountBalance ( secondaccountid );
282 if ( account->getParentAccountID ( secondaccountid ) != -1 ) 287 if ( account->getParentAccountID ( secondaccountid ) != -1 )
diff --git a/noncore/apps/qashmoney/config.in b/noncore/apps/qashmoney/config.in
index 91739fe..aeed298 100644
--- a/noncore/apps/qashmoney/config.in
+++ b/noncore/apps/qashmoney/config.in
@@ -1,4 +1,4 @@
1 config QASHMONEY 1 config QASHMONEY
2 boolean "opie-qashmoney (money manager)" 2 boolean "opie-qashmoney (money manager)"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/noncore/apps/qashmoney/qashmoney.pro b/noncore/apps/qashmoney/qashmoney.pro
index 6ad3db3..8a4302f 100755
--- a/noncore/apps/qashmoney/qashmoney.pro
+++ b/noncore/apps/qashmoney/qashmoney.pro
@@ -34,16 +34,16 @@ SOURCES = qashmoney.cpp \
34 calculator.cpp \ 34 calculator.cpp \
35 datepicker.cpp \ 35 datepicker.cpp \
36 main.cpp \ 36 main.cpp \
37 budget.cpp \ 37 budget.cpp \
38 budgetdisplay.cpp \ 38 budgetdisplay.cpp \
39 currency.cpp 39 currency.cpp
40INCLUDEPATH = $(OPIEDIR)/include 40INCLUDEPATH = $(OPIEDIR)/include
41DEPENDPATH = $(OPIEDIR)/include 41DEPENDPATH = $(OPIEDIR)/include
42 42
43DESTDIR = $(OPIEDIR)/bin 43DESTDIR = $(OPIEDIR)/bin
44 44
45unix:LIBS += -lm 45unix:LIBS += -lm
46LIBS += -lqpe -lqte -lsqlite 46LIBS += -lqpe -lopiecore2 -lsqlite
47 47
48include ( $(OPIEDIR)/include.pro ) 48include ( $(OPIEDIR)/include.pro )
49 49
diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp
index dbf9370..6e544ba 100644
--- a/noncore/apps/tableviewer/db/common.cpp
+++ b/noncore/apps/tableviewer/db/common.cpp
@@ -8,33 +8,41 @@
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 <stdlib.h> 20#include "common.h"
21#include "datacache.h"
22
23/* OPIE */
24#include <opie2/odebug.h>
25#include <qpe/timestring.h>
26using namespace Opie::Core;
27
28/* QT */
21#include <qstring.h> 29#include <qstring.h>
22#include <qheader.h> 30#include <qheader.h>
23#include <qvector.h> 31#include <qvector.h>
24#include <qdatetime.h> 32#include <qdatetime.h>
25#include <qpe/timestring.h> 33
26#include "common.h" 34/* STD */
27#include "datacache.h"
28#include <assert.h> 35#include <assert.h>
36#include <stdlib.h>
29 37
30static const int del_flag = 0x1; 38static const int del_flag = 0x1;
31static const int new_flag = 0x2; 39static const int new_flag = 0x2;
32 40
33/* Helper function */ 41/* Helper function */
34 42
35int parseNextNumber(QString *q) { 43int parseNextNumber(QString *q) {
36 QChar c; 44 QChar c;
37 uint i; 45 uint i;
38 int result = 0; 46 int result = 0;
39 47
40 bool found_digits = FALSE; 48 bool found_digits = FALSE;
@@ -303,25 +311,25 @@ void TVVariant::load(QDataStream &s )
303 s >> *x; 311 s >> *x;
304 d->value.ptr = x; 312 d->value.ptr = x;
305 } 313 }
306 break; 314 break;
307 case Int: 315 case Int:
308 { 316 {
309 int x; 317 int x;
310 s >> x; 318 s >> x;
311 d->value.i = x; 319 d->value.i = x;
312 } 320 }
313 break; 321 break;
314 default: 322 default:
315 qFatal("Unrecognized data type"); 323 ofatal << "Unrecognized data type" << oendl;
316 } 324 }
317} 325}
318 326
319void TVVariant::save( QDataStream &s ) const 327void TVVariant::save( QDataStream &s ) const
320{ 328{
321 s << type(); 329 s << type();
322 330
323 switch( d->typ ) { 331 switch( d->typ ) {
324 case String: 332 case String:
325 s << *((QString *)d->value.ptr); 333 s << *((QString *)d->value.ptr);
326 break; 334 break;
327 case Date: 335 case Date:
@@ -1069,25 +1077,25 @@ QDataStream &operator<<( QDataStream &s, const DataElem &d)
1069 return s; 1077 return s;
1070} 1078}
1071 1079
1072QDataStream &operator>>( QDataStream &s, DataElem &d) 1080QDataStream &operator>>( QDataStream &s, DataElem &d)
1073{ 1081{
1074 int i; 1082 int i;
1075 int size; 1083 int size;
1076 TVVariant t; 1084 TVVariant t;
1077 int index = 0; 1085 int index = 0;
1078 1086
1079 s >> size; /* redundent data but makes streaming easier */ 1087 s >> size; /* redundent data but makes streaming easier */
1080 if (size != d.getNumFields()) { 1088 if (size != d.getNumFields()) {
1081 qWarning("DataSize mis-match"); 1089 owarn << "DataSize mis-match" << oendl;
1082 return s; /* sanity check failed.. don't load */ 1090 return s; /* sanity check failed.. don't load */
1083 } 1091 }
1084 1092
1085 for(i = 0; i < size; i++) { 1093 for(i = 0; i < size; i++) {
1086 s >> (Q_UINT16)index; 1094 s >> (Q_UINT16)index;
1087 s >> t; 1095 s >> t;
1088 d.setField(index, t); 1096 d.setField(index, t);
1089 } 1097 }
1090 return s; 1098 return s;
1091} 1099}
1092 1100
1093/*! Returns the number of possible (not valid) fields in the data element */ 1101/*! Returns the number of possible (not valid) fields in the data element */
@@ -1368,25 +1376,25 @@ bool DataElem::contains(int i, TVVariant v) const
1368 QString qs2 = v.toString().lower(); 1376 QString qs2 = v.toString().lower();
1369 if (qs1.contains(qs2) > 0) return TRUE; 1377 if (qs1.contains(qs2) > 0) return TRUE;
1370 break; 1378 break;
1371 } 1379 }
1372 /* meaningless for ints */ 1380 /* meaningless for ints */
1373 /* meaningless for time */ 1381 /* meaningless for time */
1374 /* meaningless for dates */ 1382 /* meaningless for dates */
1375 case TVVariant::Int: 1383 case TVVariant::Int:
1376 case TVVariant::Time: 1384 case TVVariant::Time:
1377 case TVVariant::Date: 1385 case TVVariant::Date:
1378 break; 1386 break;
1379 default: 1387 default:
1380 qWarning("Tried to compare unknown data type"); 1388 owarn << "Tried to compare unknown data type" << oendl;
1381 } 1389 }
1382 return FALSE; 1390 return FALSE;
1383} 1391}
1384 1392
1385bool DataElem::startsWith(int i, TVVariant v) const 1393bool DataElem::startsWith(int i, TVVariant v) const
1386{ 1394{
1387 if (!hasValidValue(i)) return FALSE; 1395 if (!hasValidValue(i)) return FALSE;
1388 1396
1389 if (getField(i).type() != v.type()) 1397 if (getField(i).type() != v.type())
1390 return FALSE; 1398 return FALSE;
1391 1399
1392 switch(getField(i).type()) { 1400 switch(getField(i).type()) {
@@ -1394,25 +1402,25 @@ bool DataElem::startsWith(int i, TVVariant v) const
1394 QString qs1 = getField(i).toString().lower(); 1402 QString qs1 = getField(i).toString().lower();
1395 QString qs2 = v.toString().lower(); 1403 QString qs2 = v.toString().lower();
1396 return qs1.startsWith(qs2); 1404 return qs1.startsWith(qs2);
1397 } 1405 }
1398 /* meaningless for ints */ 1406 /* meaningless for ints */
1399 /* meaningless for time */ 1407 /* meaningless for time */
1400 /* meaningless for dates */ 1408 /* meaningless for dates */
1401 case TVVariant::Int: 1409 case TVVariant::Int:
1402 case TVVariant::Time: 1410 case TVVariant::Time:
1403 case TVVariant::Date: 1411 case TVVariant::Date:
1404 return FALSE; 1412 return FALSE;
1405 default: 1413 default:
1406 qWarning("Tried to compare unknown data type"); 1414 owarn << "Tried to compare unknown data type" << oendl;
1407 } 1415 }
1408 return FALSE; 1416 return FALSE;
1409} 1417}
1410 1418
1411bool DataElem::endsWith(int i, TVVariant v) const 1419bool DataElem::endsWith(int i, TVVariant v) const
1412{ 1420{
1413 if (!hasValidValue(i)) return FALSE; 1421 if (!hasValidValue(i)) return FALSE;
1414 1422
1415 if (getField(i).type() != v.type()) 1423 if (getField(i).type() != v.type())
1416 return FALSE; 1424 return FALSE;
1417 1425
1418 switch(getField(i).type()) { 1426 switch(getField(i).type()) {
@@ -1420,25 +1428,25 @@ bool DataElem::endsWith(int i, TVVariant v) const
1420 QString qs1 = getField(i).toString().lower(); 1428 QString qs1 = getField(i).toString().lower();
1421 QString qs2 = v.toString().lower(); 1429 QString qs2 = v.toString().lower();
1422 return qs1.startsWith(qs2); 1430 return qs1.startsWith(qs2);
1423 } 1431 }
1424 /* meaningless for ints */ 1432 /* meaningless for ints */
1425 /* meaningless for time */ 1433 /* meaningless for time */
1426 /* meaningless for dates */ 1434 /* meaningless for dates */
1427 case TVVariant::Int: 1435 case TVVariant::Int:
1428 case TVVariant::Time: 1436 case TVVariant::Time:
1429 case TVVariant::Date: 1437 case TVVariant::Date:
1430 return FALSE; 1438 return FALSE;
1431 default: 1439 default:
1432 qWarning("Tried to compare unknown data type"); 1440 owarn << "Tried to compare unknown data type" << oendl;
1433 } 1441 }
1434 return FALSE; 1442 return FALSE;
1435} 1443}
1436 1444
1437/*! 1445/*!
1438 Determins which of the first to parameters are closer to the third, target 1446 Determins which of the first to parameters are closer to the third, target
1439 parameter. 1447 parameter.
1440 1448
1441 \return 1449 \return
1442 <UL> 1450 <UL>
1443 <LI>TRUE if the first element is a closer match to the target than the 1451 <LI>TRUE if the first element is a closer match to the target than the
1444 second element</LI> 1452 second element</LI>
@@ -1452,19 +1460,19 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
1452 1460
1453 if(!d1) return FALSE; 1461 if(!d1) return FALSE;
1454 1462
1455 if (!d1->hasValidValue(column)) return FALSE; 1463 if (!d1->hasValidValue(column)) return FALSE;
1456 1464
1457 if(!target.isValid()) return FALSE; 1465 if(!target.isValid()) return FALSE;
1458 1466
1459 type = d1->getField(column).type(); 1467 type = d1->getField(column).type();
1460 1468
1461 if(d2) { 1469 if(d2) {
1462 if (type != d2->getField(column).type()) { 1470 if (type != d2->getField(column).type()) {
1463 /* can't do compare */ 1471 /* can't do compare */
1464 qWarning("Tried to compare two incompatable types"); 1472 owarn << "Tried to compare two incompatable types" << oendl;
1465 return FALSE; 1473 return FALSE;
1466 } 1474 }
1467 return target.closer(d1->getField(column), d2->getField(column)); 1475 return target.closer(d1->getField(column), d2->getField(column));
1468 } 1476 }
1469 return target.close(d1->getField(column)); 1477 return target.close(d1->getField(column));
1470} 1478}
diff --git a/noncore/apps/tableviewer/db/datacache.cpp b/noncore/apps/tableviewer/db/datacache.cpp
index 7c14eef..6380e1b 100644
--- a/noncore/apps/tableviewer/db/datacache.cpp
+++ b/noncore/apps/tableviewer/db/datacache.cpp
@@ -17,27 +17,35 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20/* 20/*
21 * This file is used to load the xml files that represent the database. 21 * This file is used to load the xml files that represent the database.
22 * The main requirment for said file is each data entry must contain a key, 22 * The main requirment for said file is each data entry must contain a key,
23 * otherwise any other data headings are allowed. 23 * otherwise any other data headings are allowed.
24 */ 24 */
25 25
26#include "datacache.h" 26#include "datacache.h"
27#include "xmlsource.h" 27#include "xmlsource.h"
28#include "csvsource.h" 28#include "csvsource.h"
29#include <stdlib.h> 29
30/* OPIE */
31#include <opie2/odebug.h>
32using namespace Opie::Core;
33
34/* QT */
30#include <qheader.h> 35#include <qheader.h>
31 36
37/* STD */
38#include <stdlib.h>
39
32#define INIT_TABLE_SIZE 128 40#define INIT_TABLE_SIZE 128
33 41
34/*! 42/*!
35 \class DBStore datastore.h 43 \class DBStore datastore.h
36 44
37 \brief The DBStore class is the class responsible for storing, sorting and 45 \brief The DBStore class is the class responsible for storing, sorting and
38 searching the data loaded by the application 46 searching the data loaded by the application
39 47
40*/ 48*/
41 49
42/*! 50/*!
43 Constructs a DBStore item 51 Constructs a DBStore item
@@ -141,25 +149,25 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source)
141 149
142 \param delm An already allocated and initialized data element to be added 150 \param delm An already allocated and initialized data element to be added
143*/ 151*/
144void DBStore::addItem(DataElem *delem) 152void DBStore::addItem(DataElem *delem)
145{ 153{
146 addItemInternal(delem); 154 addItemInternal(delem);
147} 155}
148 156
149void DBStore::addItemInternal(DataElem *delem) 157void DBStore::addItemInternal(DataElem *delem)
150{ 158{
151 /* if already full, don't over fill, do a qWarning though */ 159 /* if already full, don't over fill, do a qWarning though */
152 if (full) { 160 if (full) {
153 qWarning("Attempted to add items to already full table"); 161 owarn << "Attempted to add items to already full table" << oendl;
154 return; 162 return;
155 } 163 }
156 164
157 master_table.insert(number_elems, delem); 165 master_table.insert(number_elems, delem);
158 166
159 current_elem = number_elems; 167 current_elem = number_elems;
160 number_elems++; 168 number_elems++;
161 169
162 if(number_elems >= table_size) { 170 if(number_elems >= table_size) {
163 /* filled current table, double if we can */ 171 /* filled current table, double if we can */
164 table_size = table_size << 1; 172 table_size = table_size << 1;
165 173
diff --git a/noncore/apps/tableviewer/db/xmlsource.cpp b/noncore/apps/tableviewer/db/xmlsource.cpp
index 94fec36..4ca6aee 100644
--- a/noncore/apps/tableviewer/db/xmlsource.cpp
+++ b/noncore/apps/tableviewer/db/xmlsource.cpp
@@ -9,30 +9,36 @@
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 "xmlsource.h" 20#include "xmlsource.h"
21#include <qdict.h>
22#include <stdlib.h>
23#include <qtextstream.h>
24#include "../xmlencodeattr.h" 21#include "../xmlencodeattr.h"
25 22
23/* OPIE */
24#include <opie2/odebug.h>
25using namespace Opie::Core;
26 26
27/* QT */
28#include <qdict.h>
29#include <qtextstream.h>
30
31/* STD */
32#include <stdlib.h>
27 33
28DBXml::DBXml(DBStore *d) 34DBXml::DBXml(DBStore *d)
29{ 35{
30 dstore = d; 36 dstore = d;
31} 37}
32 38
33QString DBXml::type() 39QString DBXml::type()
34{ 40{
35 return "xml"; 41 return "xml";
36} 42}
37 43
38bool DBXml::openSource(QIODevice *inDev) 44bool DBXml::openSource(QIODevice *inDev)
@@ -131,25 +137,25 @@ DBXmlHandler::DBXmlHandler(DBStore *ds)
131 current_keyrep = 0; 137 current_keyrep = 0;
132} 138}
133 139
134/*! 140/*!
135 Destroys the DBXmlHandler 141 Destroys the DBXmlHandler
136*/ 142*/
137DBXmlHandler::~DBXmlHandler() 143DBXmlHandler::~DBXmlHandler()
138{ 144{
139} 145}
140 146
141QString DBXmlHandler::errorProtocol() 147QString DBXmlHandler::errorProtocol()
142{ 148{
143 qWarning("Error reading file"); 149 owarn << "Error reading file" << oendl;
144 return errorProt; 150 return errorProt;
145} 151}
146 152
147bool DBXmlHandler::startDocument() 153bool DBXmlHandler::startDocument()
148{ 154{
149 errorProt = ""; 155 errorProt = "";
150 state = StateInit; 156 state = StateInit;
151 return TRUE; 157 return TRUE;
152} 158}
153 159
154bool DBXmlHandler::startElement(const QString&, const QString&, 160bool DBXmlHandler::startElement(const QString&, const QString&,
155 const QString& qName, const QXmlAttributes& atts) 161 const QString& qName, const QXmlAttributes& atts)
@@ -163,49 +169,49 @@ bool DBXmlHandler::startElement(const QString&, const QString&,
163 if (state == StateDocument && qName == "header") { 169 if (state == StateDocument && qName == "header") {
164 state = StateHeader; 170 state = StateHeader;
165 if (current_keyrep) delete current_keyrep; 171 if (current_keyrep) delete current_keyrep;
166 current_keyrep = new KeyList(); 172 current_keyrep = new KeyList();
167 return TRUE; 173 return TRUE;
168 } 174 }
169 if (state == StateHeader && qName == "key") { 175 if (state == StateHeader && qName == "key") {
170 /* Ok, adding a new key to our KeyList TODO */ 176 /* Ok, adding a new key to our KeyList TODO */
171 state = StateKey; 177 state = StateKey;
172 last_key_type = TVVariant::String; 178 last_key_type = TVVariant::String;
173 key = atts.value("name"); 179 key = atts.value("name");
174 if (key.isEmpty()) { 180 if (key.isEmpty()) {
175 qWarning("empty key name"); 181 owarn << "empty key name" << oendl;
176 return FALSE; 182 return FALSE;
177 } 183 }
178 if(!atts.value("type").isEmpty()) 184 if(!atts.value("type").isEmpty())
179 last_key_type = TVVariant::nameToType(atts.value("type")); 185 last_key_type = TVVariant::nameToType(atts.value("type"));
180 return TRUE; 186 return TRUE;
181 } 187 }
182 if (state == StateDocument && qName == "record") { 188 if (state == StateDocument && qName == "record") {
183 state = StateRecord; 189 state = StateRecord;
184 current_data = new DataElem(data_store); 190 current_data = new DataElem(data_store);
185 // Now expecting a <record> tag 191 // Now expecting a <record> tag
186 return TRUE; 192 return TRUE;
187 } 193 }
188 if (state == StateRecord) { 194 if (state == StateRecord) {
189 state = StateField; 195 state = StateField;
190 /* the qName is the name of a key */ 196 /* the qName is the name of a key */
191 if (!keyIndexList[qName]) { 197 if (!keyIndexList[qName]) {
192 /* invalid key, we failed */ 198 /* invalid key, we failed */
193 qWarning("Invalid key in record"); 199 owarn << "Invalid key in record" << oendl;
194 return FALSE; 200 return FALSE;
195 } 201 }
196 keyIndex = *keyIndexList[qName]; 202 keyIndex = *keyIndexList[qName];
197 return TRUE; 203 return TRUE;
198 } 204 }
199 qWarning("Unable to determine tag type"); 205 owarn << "Unable to determine tag type" << oendl;
200 return FALSE; 206 return FALSE;
201} 207}
202 208
203bool DBXmlHandler::endElement(const QString&, const QString&, 209bool DBXmlHandler::endElement(const QString&, const QString&,
204 const QString& qName) 210 const QString& qName)
205{ 211{
206 switch(state) { 212 switch(state) {
207 case StateField: 213 case StateField:
208 // TODO checks 'could' be done of the popped value 214 // TODO checks 'could' be done of the popped value
209 state = StateRecord; 215 state = StateRecord;
210 break; 216 break;
211 case StateKey: 217 case StateKey:
@@ -216,25 +222,25 @@ bool DBXmlHandler::endElement(const QString&, const QString&,
216 data_store->setKeys(current_keyrep); 222 data_store->setKeys(current_keyrep);
217 state = StateDocument; 223 state = StateDocument;
218 break; 224 break;
219 case StateRecord: 225 case StateRecord:
220 data_store->addItem(current_data); 226 data_store->addItem(current_data);
221 state = StateDocument; 227 state = StateDocument;
222 break; 228 break;
223 case StateDocument: 229 case StateDocument:
224 // we are done... 230 // we are done...
225 break; 231 break;
226 default: 232 default:
227 // should only get a 'endElement' from one of the above states. 233 // should only get a 'endElement' from one of the above states.
228 qWarning("Invalid end tag"); 234 owarn << "Invalid end tag" << oendl;
229 return FALSE; 235 return FALSE;
230 break; 236 break;
231 } 237 }
232 return TRUE; 238 return TRUE;
233} 239}
234 240
235bool DBXmlHandler::characters(const QString& ch) 241bool DBXmlHandler::characters(const QString& ch)
236{ 242{
237 // this is where the 'between tag' stuff happens. 243 // this is where the 'between tag' stuff happens.
238 // e.g. the stuff between tags. 244 // e.g. the stuff between tags.
239 QString ch_simplified = ch.simplifyWhiteSpace(); 245 QString ch_simplified = ch.simplifyWhiteSpace();
240 246
@@ -245,53 +251,53 @@ bool DBXmlHandler::characters(const QString& ch)
245 int *tmp_val = new int; 251 int *tmp_val = new int;
246 /* We just grabbed the display name of a key */ 252 /* We just grabbed the display name of a key */
247 *tmp_val = current_keyrep->addKey(ch_simplified, last_key_type); 253 *tmp_val = current_keyrep->addKey(ch_simplified, last_key_type);
248 keyIndexList.insert(key, tmp_val); 254 keyIndexList.insert(key, tmp_val);
249 return TRUE; 255 return TRUE;
250 } 256 }
251 if (state == StateField) { 257 if (state == StateField) {
252 /* Ok, need to add data here */ 258 /* Ok, need to add data here */
253 current_data->setField(keyIndex, ch_simplified); 259 current_data->setField(keyIndex, ch_simplified);
254 return TRUE; 260 return TRUE;
255 } 261 }
256 262
257 qWarning("Junk characters found... ignored"); 263 owarn << "Junk characters found... ignored" << oendl;
258 return TRUE; 264 return TRUE;
259} 265}
260 266
261QString DBXmlHandler::errorString() 267QString DBXmlHandler::errorString()
262{ 268{
263 return "the document is not in the expected file format"; 269 return "the document is not in the expected file format";
264} 270}
265 271
266bool DBXmlHandler::warning(const QXmlParseException& exception) 272bool DBXmlHandler::warning(const QXmlParseException& exception)
267{ 273{
268 errorProt += QString("warning parsing error: %1 in line %2, column %3\n" ) 274 errorProt += QString("warning parsing error: %1 in line %2, column %3\n" )
269 .arg(exception.message()) 275 .arg(exception.message())
270 .arg(exception.lineNumber()) 276 .arg(exception.lineNumber())
271 .arg(exception.columnNumber()); 277 .arg(exception.columnNumber());
272 278
273 qWarning(errorProt); 279 owarn << errorProt << oendl;
274 return QXmlDefaultHandler::fatalError(exception); 280 return QXmlDefaultHandler::fatalError(exception);
275} 281}
276 282
277bool DBXmlHandler::error(const QXmlParseException& exception) 283bool DBXmlHandler::error(const QXmlParseException& exception)
278{ 284{
279 errorProt += QString("error parsing error: %1 in line %2, column %3\n" ) 285 errorProt += QString("error parsing error: %1 in line %2, column %3\n" )
280 .arg(exception.message()) 286 .arg(exception.message())
281 .arg(exception.lineNumber()) 287 .arg(exception.lineNumber())
282 .arg(exception.columnNumber()); 288 .arg(exception.columnNumber());
283 289
284 qWarning(errorProt); 290 owarn << errorProt << oendl;
285 return QXmlDefaultHandler::fatalError(exception); 291 return QXmlDefaultHandler::fatalError(exception);
286} 292}
287 293
288bool DBXmlHandler::fatalError(const QXmlParseException& exception) 294bool DBXmlHandler::fatalError(const QXmlParseException& exception)
289{ 295{
290 errorProt += QString("fatal parsing error: %1 in line %2, column %3\n" ) 296 errorProt += QString("fatal parsing error: %1 in line %2, column %3\n" )
291 .arg(exception.message()) 297 .arg(exception.message())
292 .arg(exception.lineNumber()) 298 .arg(exception.lineNumber())
293 .arg(exception.columnNumber()); 299 .arg(exception.columnNumber());
294 300
295 qWarning(errorProt); 301 owarn << errorProt << oendl;
296 return QXmlDefaultHandler::fatalError(exception); 302 return QXmlDefaultHandler::fatalError(exception);
297} 303}
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp
index 102b94c..9538cb3 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -9,45 +9,47 @@
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21/* local includes */
22#include "tableviewer.h" 21#include "tableviewer.h"
23#include "ui/tvbrowseview.h" 22#include "ui/tvbrowseview.h"
24#include "ui/tvfilterview.h" 23#include "ui/tvfilterview.h"
25#include "ui/tvlistview.h" 24#include "ui/tvlistview.h"
26#include "ui/tveditview.h" 25#include "ui/tveditview.h"
27#include "ui/tvkeyedit.h" 26#include "ui/tvkeyedit.h"
28#include "db/datacache.h" 27#include "db/datacache.h"
29 28
30/* QPE includes */ 29/* OPIE */
30#include <opie2/odebug.h>
31#include <qpe/fileselector.h> 31#include <qpe/fileselector.h>
32#include <qpe/resource.h> 32#include <qpe/resource.h>
33#include <qtoolbar.h> 33using namespace Opie::Core;
34 34
35/* QTE includes */ 35/* QT */
36#include <qmenubar.h> 36#include <qmenubar.h>
37#include <qtoolbar.h>
37#include <qpopupmenu.h> 38#include <qpopupmenu.h>
38#include <qapplication.h> 39#include <qapplication.h>
39#include <qwidgetstack.h> 40#include <qwidgetstack.h>
40#include <qlayout.h> 41#include <qlayout.h>
41#include <qbuffer.h> 42#include <qbuffer.h>
43
42/*! 44/*!
43 \class TableViewerWindow 45 \class TableViewerWindow
44 \brief The main window widget of the application 46 \brief The main window widget of the application
45 47
46 This is the main widget of the table viewer application. 48 This is the main widget of the table viewer application.
47 It is the co-ordination point. 49 It is the co-ordination point.
48*/ 50*/
49 51
50/*! 52/*!
51 Constructs a new TableViewerWindow 53 Constructs a new TableViewerWindow
52*/ 54*/
53TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f) 55TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f)
@@ -192,25 +194,25 @@ void TableViewerWindow::selectDocument()
192 fileSelector->reread(); 194 fileSelector->reread();
193} 195}
194 196
195void TableViewerWindow::saveDocument() 197void TableViewerWindow::saveDocument()
196{ 198{
197 if(!dirty) 199 if(!dirty)
198 return; 200 return;
199 201
200 FileManager fm; 202 FileManager fm;
201 QIODevice *dev = fm.saveFile(doc); 203 QIODevice *dev = fm.saveFile(doc);
202 204
203 if(!ds->saveSource(dev, doc.type())){ 205 if(!ds->saveSource(dev, doc.type())){
204 qWarning("Save unsuccessful"); 206 owarn << "Save unsuccessful" << oendl;
205 return; 207 return;
206 } 208 }
207 dev->close(); 209 dev->close();
208 dirty = FALSE; 210 dirty = FALSE;
209} 211}
210 212
211void TableViewerWindow::newDocument() 213void TableViewerWindow::newDocument()
212{ 214{
213 DocLnk nf; 215 DocLnk nf;
214 nf.setType("text/x-xml-tableviewer"); 216 nf.setType("text/x-xml-tableviewer");
215 nf.setName("table"); 217 nf.setName("table");
216 218
@@ -279,25 +281,25 @@ void TableViewerWindow::openDocument(const DocLnk &f)
279 listView->first(); 281 listView->first();
280 ts.current_elem = listView->getCurrentData(); 282 ts.current_elem = listView->getCurrentData();
281 browseView->rebuildData(); 283 browseView->rebuildData();
282 listView->rebuildData(); 284 listView->rebuildData();
283 285
284 QString scratch = "Table Viewer";/* later take from constant */ 286 QString scratch = "Table Viewer";/* later take from constant */
285 scratch += " - "; 287 scratch += " - ";
286 scratch += ds->getName(); 288 scratch += ds->getName();
287 setCaption(tr(scratch)); 289 setCaption(tr(scratch));
288 290
289 dirty = FALSE; 291 dirty = FALSE;
290 } else { 292 } else {
291 qWarning(tr("could not load Document")); 293 owarn << tr("could not load Document") << oendl;
292 } 294 }
293 dev->close(); 295 dev->close();
294} 296}
295 297
296/*! 298/*!
297 Moves to the first item of the current table 299 Moves to the first item of the current table
298*/ 300*/
299void TableViewerWindow::firstItem() 301void TableViewerWindow::firstItem()
300{ 302{
301 listView->first(); 303 listView->first();
302 ts.current_elem = listView->getCurrentData(); 304 ts.current_elem = listView->getCurrentData();
303 browseView->rebuildData(); 305 browseView->rebuildData();
diff --git a/noncore/apps/tableviewer/tableviewer.pro b/noncore/apps/tableviewer/tableviewer.pro
index 1de23bb..564f50f 100644
--- a/noncore/apps/tableviewer/tableviewer.pro
+++ b/noncore/apps/tableviewer/tableviewer.pro
@@ -1,13 +1,13 @@
1 CONFIG = qt warn_on quick-app 1 CONFIG = qt warn_on quick-app
2 SUBDIRS = db ui 2 SUBDIRS = db ui
3 HEADERS = tableviewer.h \ 3 HEADERS = tableviewer.h \
4 xmlencodeattr.h \ 4 xmlencodeattr.h \
5 ui/commonwidgets.h \ 5 ui/commonwidgets.h \
6 ui/tvbrowseview.h \ 6 ui/tvbrowseview.h \
7 ui/tvlistview.h \ 7 ui/tvlistview.h \
8 ui/tvfilterview.h \ 8 ui/tvfilterview.h \
9 ui/tveditview.h \ 9 ui/tveditview.h \
10 ui/browsekeyentry.h \ 10 ui/browsekeyentry.h \
11 ui/filterkeyentry.h \ 11 ui/filterkeyentry.h \
12 ui/tvkeyedit.h \ 12 ui/tvkeyedit.h \
13 db/datacache.h \ 13 db/datacache.h \
@@ -22,17 +22,17 @@ SOURCES = main.cpp \
22 ui/tvfilterview.cpp \ 22 ui/tvfilterview.cpp \
23 ui/browsekeyentry.cpp \ 23 ui/browsekeyentry.cpp \
24 ui/filterkeyentry.cpp \ 24 ui/filterkeyentry.cpp \
25 ui/tvlistview.cpp \ 25 ui/tvlistview.cpp \
26 ui/tveditview.cpp \ 26 ui/tveditview.cpp \
27 ui/tvkeyedit.cpp \ 27 ui/tvkeyedit.cpp \
28 db/datacache.cpp \ 28 db/datacache.cpp \
29 db/xmlsource.cpp \ 29 db/xmlsource.cpp \
30 db/csvsource.cpp \ 30 db/csvsource.cpp \
31 db/common.cpp 31 db/common.cpp
32 INTERFACES= ui/tvkeyedit_gen.ui 32 INTERFACES= ui/tvkeyedit_gen.ui
33 TARGET = tableviewer 33 TARGET = tableviewer
34INCLUDEPATH += $(OPIEDIR)/include 34 INCLUDEPATH+= $(OPIEDIR)/include
35DEPENDPATH += $(OPIEDIR)/include 35 DEPENDPATH+= $(OPIEDIR)/include
36 LIBS += -lqpe -lopiecore2 36 LIBS += -lqpe -lopiecore2
37 37
38include ( $(OPIEDIR)/include.pro ) 38include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/tableviewer/ui/tvlistview.cpp b/noncore/apps/tableviewer/ui/tvlistview.cpp
index b10ff1d..c3e6432 100644
--- a/noncore/apps/tableviewer/ui/tvlistview.cpp
+++ b/noncore/apps/tableviewer/ui/tvlistview.cpp
@@ -8,26 +8,33 @@
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20
20#include "tvlistview.h" 21#include "tvlistview.h"
21#include "../db/common.h" 22#include "../db/common.h"
23
24/* OPIE */
25#include <opie2/odebug.h>
26using namespace Opie::Core;
27
28/* QT */
22#include <qtoolbutton.h> 29#include <qtoolbutton.h>
23#include <qlistview.h> 30#include <qlistview.h>
24#include <qlayout.h> 31#include <qlayout.h>
25 32
26void TVListViewPrivate::setColumnWidth(int column, int width) 33void TVListViewPrivate::setColumnWidth(int column, int width)
27{ 34{
28 if(width > 70) width = 70; 35 if(width > 70) width = 70;
29 QListView::setColumnWidth(column, width); 36 QListView::setColumnWidth(column, width);
30} 37}
31 38
32void TVListViewPrivate::setSorting(int column, bool increasing) 39void TVListViewPrivate::setSorting(int column, bool increasing)
33{ 40{
@@ -154,25 +161,25 @@ void TVListView::clearItems()
154 delete it; 161 delete it;
155 it = new QListViewItemIterator(listViewDisplay); 162 it = new QListViewItemIterator(listViewDisplay);
156} 163}
157 164
158void TVListView::first() 165void TVListView::first()
159{ 166{
160 delete it; 167 delete it;
161 it = new QListViewItemIterator(listViewDisplay); 168 it = new QListViewItemIterator(listViewDisplay);
162} 169}
163 170
164void TVListView::last() 171void TVListView::last()
165{ 172{
166 qWarning("TVListView::last not yet implemented"); 173 owarn << "TVListView::last not yet implemented" << oendl;
167} 174}
168 175
169void TVListView::next() 176void TVListView::next()
170{ 177{
171 QListViewItemIterator tmp = *it; 178 QListViewItemIterator tmp = *it;
172 (*it)++; 179 (*it)++;
173 if (!it->current()) { 180 if (!it->current()) {
174 *it = tmp; 181 *it = tmp;
175 } 182 }
176} 183}
177 184
178void TVListView::previous() 185void TVListView::previous()
diff --git a/noncore/apps/tinykate/libkate/libkate.pro b/noncore/apps/tinykate/libkate/libkate.pro
index 11ee275..1552dff 100644
--- a/noncore/apps/tinykate/libkate/libkate.pro
+++ b/noncore/apps/tinykate/libkate/libkate.pro
@@ -1,90 +1,87 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = qt warn_on 2CONFIG = qt warn_on
3HEADERS = microkde/kapplication.h \ 3HEADERS = microkde/kapplication.h \
4 kateconfig.h \ 4 kateconfig.h \
5 microkde/kdebug.h \ 5 microkde/kdebug.h \
6 microkde/kdialog.h \ 6 microkde/kdialog.h \
7 microkde/kdialogbase.h \ 7 microkde/kdialogbase.h \
8 microkde/kfiledialog.h \ 8 microkde/kfiledialog.h \
9 microkde/kglobal.h \ 9 microkde/kglobal.h \
10 microkde/kiconloader.h \ 10 microkde/kiconloader.h \
11 microkde/klineedit.h \ 11 microkde/klineedit.h \
12 microkde/klocale.h \ 12 microkde/klocale.h \
13 microkde/kmessagebox.h \ 13 microkde/kmessagebox.h \
14 microkde/kprinter.h \ 14 microkde/kprinter.h \
15 microkde/krestrictedline.h \ 15 microkde/krestrictedline.h \
16 microkde/kseparator.h \ 16 microkde/kseparator.h \
17 microkde/kstandarddirs.h \ 17 microkde/kstandarddirs.h \
18 microkde/ktempfile.h \ 18 microkde/ktempfile.h \
19 microkde/kunload.h \ 19 microkde/kunload.h \
20 microkde/kurlrequester.h \ 20 microkde/kurlrequester.h \
21 microkde/kfontdialog.h \ 21 microkde/kfontdialog.h \
22 microkde/krun.h \ 22 microkde/krun.h \
23 microkde/knumvalidator.h \ 23 microkde/knumvalidator.h \
24 microkde/kstaticdeleter.h \ 24 microkde/kstaticdeleter.h \
25 microkde/klistview.h \ 25 microkde/klistview.h \
26 microkde/kglobalsettings.h \ 26 microkde/kglobalsettings.h \
27 microkde/kcolorbtn.h \ 27 microkde/kcolorbtn.h \
28 \
29 \ 28 \
30 qt3back/qregexp3.h \ 29 qt3back/qregexp3.h \
31 microkde/ksharedptr.h \ 30 microkde/ksharedptr.h \
32 document/katebuffer.h document/katedialogs.h \ 31 document/katebuffer.h document/katedialogs.h \
33 document/katetextline.h \ 32 document/katetextline.h \
34 document/katecmd.h \ 33 document/katecmd.h \
35 document/katehighlight.h \ 34 document/katehighlight.h \
36 document/katecmds.h document/katedocument.h \ 35 document/katecmds.h document/katedocument.h \
37 document/katesyntaxdocument.h \ 36 document/katesyntaxdocument.h \
38 view/kateundohistory.h \ 37 view/kateundohistory.h \
39 view/kateview.h \ 38 view/kateview.h \
40 view/kateviewdialog.h \ 39 view/kateviewdialog.h \
41 interfaces/view.h \ 40 interfaces/view.h \
42 interfaces/document.h \ 41 interfaces/document.h \
43 ktexteditor/ktexteditor.h 42 ktexteditor/ktexteditor.h
44 43
45SOURCES = microkde/kapplication.cpp \ 44SOURCES = microkde/kapplication.cpp \
46 microkde/kdialogbase.cpp \ 45 microkde/kdialogbase.cpp \
47 kateconfig.cpp \ 46 kateconfig.cpp \
48 microkde/klocale.cpp \ 47 microkde/klocale.cpp \
49 microkde/kmessagebox.cpp \ 48 microkde/kmessagebox.cpp \
50 microkde/kprocess.cpp \ 49 microkde/kprocess.cpp \
51 microkde/kstandarddirs.cpp \ 50 microkde/kstandarddirs.cpp \
52 microkde/ktempfile.cpp \ 51 microkde/ktempfile.cpp \
53 microkde/kurlrequester.cpp \ 52 microkde/kurlrequester.cpp \
54 microkde/kfontdialog.cpp \ 53 microkde/kfontdialog.cpp \
55 microkde/krun.cpp \ 54 microkde/krun.cpp \
56 microkde/knumvalidator.cpp \ 55 microkde/knumvalidator.cpp \
57 microkde/kglobal.cpp \ 56 microkde/kglobal.cpp \
58 microkde/kglobalsettings.cpp \ 57 microkde/kglobalsettings.cpp \
59 microkde/kcolorbtn.cpp \ 58 microkde/kcolorbtn.cpp \
60 \ 59 \
61 \ 60 qt3back/qregexp3.cpp \
62 qt3back/qregexp3.cpp \ 61 ktexteditor/ktexteditor.cpp \
63 ktexteditor/ktexteditor.cpp \ 62 document/katebuffer.cpp document/katedialogs.cpp \
64 document/katebuffer.cpp document/katedialogs.cpp \ 63 document/katehighlight.cpp \
65 document/katehighlight.cpp \ 64 document/katecmd.cpp \
66 document/katecmd.cpp \ 65 document/katesyntaxdocument.cpp document/katecmds.cpp \
67 document/katesyntaxdocument.cpp document/katecmds.cpp \ 66 document/katedocument.cpp document/katetextline.cpp \
68 document/katedocument.cpp document/katetextline.cpp \ 67 view/kateundohistory.cpp \
69 view/kateundohistory.cpp \ 68 view/kateview.cpp \
70 view/kateview.cpp \ 69 view/kateviewdialog.cpp \
71 view/kateviewdialog.cpp \ 70 interfaces/interfaces.cpp
72 interfaces/interfaces.cpp 71INTERFACES =
73 72INCLUDEPATH += $(OPIEDIR)/include \
74INTERFACES =
75INCLUDEPATH += $(OPIEDIR)/include \
76 $(OPIEDIR)/noncore/apps/tinykate/libkate \ 73 $(OPIEDIR)/noncore/apps/tinykate/libkate \
77 $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ 74 $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \
78 $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ 75 $(OPIEDIR)/noncore/apps/tinykate/libkate/document \
79 $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ 76 $(OPIEDIR)/noncore/apps/tinykate/libkate/view \
80 $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ 77 $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \
81 $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ 78 $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \
82 $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back 79 $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back
83DEPENDPATH += $(OPIEDIR)/include 80DEPENDPATH += $(OPIEDIR)/include
84LIBS += -lqpe -lqtaux2 -lopiecore2 -lopieui2 81LIBS += -lqpe -lqtaux2 -lopiecore2 -lopieui2
85TARGET = tinykate 82TARGET = tinykate
86 83
87INCLUDEPATH += $(OPIEDIR)/include 84INCLUDEPATH += $(OPIEDIR)/include
88DESTDIR = $(OPIEDIR)/lib$(PROJMAK) 85DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
89 86
90include ( $(OPIEDIR)/include.pro ) 87include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/tinykate/tinykate.pro b/noncore/apps/tinykate/tinykate.pro
index 6f4baa8..d34e519 100644
--- a/noncore/apps/tinykate/tinykate.pro
+++ b/noncore/apps/tinykate/tinykate.pro
@@ -1,22 +1,20 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on quick-app 2CONFIG = qt warn_on quick-app
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = tinykate.h 4HEADERS = tinykate.h
5SOURCES = tinykate.cpp main.cpp 5SOURCES = tinykate.cpp main.cpp
6INTERFACES =
7INCLUDEPATH += $(OPIEDIR)/include \ 6INCLUDEPATH += $(OPIEDIR)/include \
8 $(OPIEDIR)/noncore/apps/tinykate/libkate \ 7 $(OPIEDIR)/noncore/apps/tinykate/libkate \
9 $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ 8 $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \
10 $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ 9 $(OPIEDIR)/noncore/apps/tinykate/libkate/document \
11 $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ 10 $(OPIEDIR)/noncore/apps/tinykate/libkate/view \
12 $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ 11 $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \
13 $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ 12 $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \
14 $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back 13 $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back
15 14DEPENDPATH += $(OPIEDIR)/include
16DEPENDPATH += $(OPIEDIR)/include 15LIBS += -lqpe -ltinykate -lopiecore2 -lopieui2
17LIBS += -lqpe -ltinykate -lopiecore2 -lopieui2 16TARGET = kate
18TARGET = kate
19 17
20 18
21 19
22include ( $(OPIEDIR)/include.pro ) 20include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/zsafe/config.in b/noncore/apps/zsafe/config.in
index 6e321f3..b6d3ffe 100644
--- a/noncore/apps/zsafe/config.in
+++ b/noncore/apps/zsafe/config.in
@@ -1,5 +1,5 @@
1config ZSAFE 1config ZSAFE
2 boolean "zsafe (Zaurus Password Manager)" 2 boolean "zsafe (Zaurus Password Manager)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI
5 5
diff --git a/noncore/apps/zsafe/scqtfiledlg.cpp b/noncore/apps/zsafe/scqtfiledlg.cpp
index 52b8d0d..c67bbd5 100644
--- a/noncore/apps/zsafe/scqtfiledlg.cpp
+++ b/noncore/apps/zsafe/scqtfiledlg.cpp
@@ -1,22 +1,19 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'scqtfiledlg.ui'
3**
4** Created: Sun Jun 8 15:51:12 2003
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "scqtfiledlg.h" 1#include "scqtfiledlg.h"
10 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
7/* QT */
11#include <qcombobox.h> 8#include <qcombobox.h>
12#include <qlineedit.h> 9#include <qlineedit.h>
13#include <qlistview.h> 10#include <qlistview.h>
14#include <qtoolbutton.h> 11#include <qtoolbutton.h>
15#include <qlayout.h> 12#include <qlayout.h>
16#include <qtooltip.h> 13#include <qtooltip.h>
17#include <qwhatsthis.h> 14#include <qwhatsthis.h>
18 15
19static const char* const image0_data[] = { 16static const char* const image0_data[] = {
20"24 16 3 1", 17"24 16 3 1",
21". c None", 18". c None",
22"# c #000040", 19"# c #000040",
@@ -207,50 +204,50 @@ ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags
207} 204}
208 205
209/* 206/*
210 * Destroys the object and frees any allocated resources 207 * Destroys the object and frees any allocated resources
211 */ 208 */
212ScQtFileDlg::~ScQtFileDlg() 209ScQtFileDlg::~ScQtFileDlg()
213{ 210{
214 // no need to delete child widgets, Qt does it all for us 211 // no need to delete child widgets, Qt does it all for us
215} 212}
216 213
217void ScQtFileDlg::slotCancel() 214void ScQtFileDlg::slotCancel()
218{ 215{
219 qWarning( "ScQtFileDlg::slotCancel(): Not implemented yet!" ); 216 owarn << "ScQtFileDlg::slotCancel(): Not implemented yet!" << oendl;
220} 217}
221 218
222void ScQtFileDlg::slotDirComboBoxChanged( int ) 219void ScQtFileDlg::slotDirComboBoxChanged( int )
223{ 220{
224 qWarning( "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" ); 221 owarn << "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" << oendl;
225} 222}
226 223
227void ScQtFileDlg::slotDoubleClicked(QListViewItem *) 224void ScQtFileDlg::slotDoubleClicked(QListViewItem *)
228{ 225{
229 qWarning( "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" ); 226 owarn << "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" << oendl;
230} 227}
231 228
232void ScQtFileDlg::slotFileTextChanged( const QString & ) 229void ScQtFileDlg::slotFileTextChanged( const QString & )
233{ 230{
234 qWarning( "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" ); 231 owarn << "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" << oendl;
235} 232}
236 233
237void ScQtFileDlg::slotMkDir() 234void ScQtFileDlg::slotMkDir()
238{ 235{
239 qWarning( "ScQtFileDlg::slotMkDir(): Not implemented yet!" ); 236 owarn << "ScQtFileDlg::slotMkDir(): Not implemented yet!" << oendl;
240} 237}
241 238
242void ScQtFileDlg::slotOK() 239void ScQtFileDlg::slotOK()
243{ 240{
244 qWarning( "ScQtFileDlg::slotOK(): Not implemented yet!" ); 241 owarn << "ScQtFileDlg::slotOK(): Not implemented yet!" << oendl;
245} 242}
246 243
247void ScQtFileDlg::slotSelectionChanged(QListViewItem *) 244void ScQtFileDlg::slotSelectionChanged(QListViewItem *)
248{ 245{
249 qWarning( "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" ); 246 owarn << "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" << oendl;
250} 247}
251 248
252void ScQtFileDlg::slotTypeComboBoxChanged( int ) 249void ScQtFileDlg::slotTypeComboBoxChanged( int )
253{ 250{
254 qWarning( "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" ); 251 owarn << "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" << oendl;
255} 252}
256 253
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 3df55eb..bf8f7f4 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -20,35 +20,34 @@
20#include "zsafe.h" 20#include "zsafe.h"
21#include "newdialog.h" 21#include "newdialog.h"
22#include "searchdialog.h" 22#include "searchdialog.h"
23#include "categorydialog.h" 23#include "categorydialog.h"
24#include "passworddialog.h" 24#include "passworddialog.h"
25#include "infoform.h" 25#include "infoform.h"
26#include "zlistview.h" 26#include "zlistview.h"
27#include "shadedlistitem.h" 27#include "shadedlistitem.h"
28 28
29#ifndef DESKTOP 29#ifndef DESKTOP
30#ifndef NO_OPIE 30#ifndef NO_OPIE
31#include <opie2/ofiledialog.h> 31#include <opie2/ofiledialog.h>
32 32#include <opie2/odebug.h>
33using namespace Opie::Core;
33using namespace Opie::Ui; 34using namespace Opie::Ui;
34#else 35#else
35#include "scqtfileedit.h" 36#include "scqtfileedit.h"
36#endif 37#endif
37#endif 38#endif
38 39
39#include <qclipboard.h> 40#include <qclipboard.h>
40 41
41#include <stdio.h>
42
43#include <sys/types.h> 42#include <sys/types.h>
44#include <sys/stat.h> 43#include <sys/stat.h>
45#include <fcntl.h> 44#include <fcntl.h>
46#include <stdlib.h> 45#include <stdlib.h>
47#ifndef WIN32 46#ifndef WIN32
48#include <unistd.h> 47#include <unistd.h>
49#endif 48#endif
50#include <string.h> 49#include <string.h>
51#include <errno.h> 50#include <errno.h>
52 51
53#include <qmenubar.h> 52#include <qmenubar.h>
54#include <qpopupmenu.h> 53#include <qpopupmenu.h>
@@ -2060,45 +2059,43 @@ int ZSafe::loadInit(const char* _filename, const char *password)
2060 return PWERR_OPEN; 2059 return PWERR_OPEN;
2061 2060
2062 buffer = (char *)malloc(load_buffer_length); 2061 buffer = (char *)malloc(load_buffer_length);
2063 for (j = 0; password[j] != '\0'; j++) { 2062 for (j = 0; password[j] != '\0'; j++) {
2064 key[j] = password[j]; 2063 key[j] = password[j];
2065 } 2064 }
2066 keylength = j; 2065 keylength = j;
2067 krc2->rc2_expandkey (key, keylength, 128); 2066 krc2->rc2_expandkey (key, keylength, 128);
2068 2067
2069#ifndef WIN32 2068#ifndef WIN32
2070 size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); 2069 size = read(fileno (fd), (unsigned char *) (charbuf + count), 8);
2071#else 2070#else
2072 printf ("LoadInit() read1");
2073 size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); 2071 size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
2074#endif 2072#endif
2075 2073
2076 if (size < 8) 2074 if (size < 8)
2077 return PWERR_DATA; 2075 return PWERR_DATA;
2078 2076
2079 for (count = 0; count < 4; count++) { 2077 for (count = 0; count < 4; count++) {
2080 count2 = count << 1; 2078 count2 = count << 1;
2081 iv[count] = charbuf[count2] << 8; 2079 iv[count] = charbuf[count2] << 8;
2082 iv[count] += charbuf[count2 + 1]; 2080 iv[count] += charbuf[count2 + 1];
2083 } 2081 }
2084 2082
2085 size = 0; 2083 size = 0;
2086 bufferIndex = 0; 2084 bufferIndex = 0;
2087#ifndef WIN32 2085#ifndef WIN32
2088 while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { 2086 while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) {
2089 while (count < 8) { 2087 while (count < 8) {
2090 count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); 2088 count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8);
2091#else 2089#else
2092 printf ("LoadInit() read2");
2093 while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) { 2090 while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) {
2094 while (count < 8) { 2091 while (count < 8) {
2095 count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); 2092 count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
2096#endif 2093#endif
2097 if (count2 == 0) { 2094 if (count2 == 0) {
2098 return PWERR_DATA; 2095 return PWERR_DATA;
2099 } 2096 }
2100 count += count2; 2097 count += count2;
2101 } /* while (count < 8) */ 2098 } /* while (count < 8) */
2102 2099
2103 size += 8; 2100 size += 8;
2104 for (count2 = 0; count2 < 8; count2 += 2) { 2101 for (count2 = 0; count2 < 8; count2 += 2) {
@@ -2250,25 +2247,25 @@ bool ZSafe::saveDocument(const char* _filename,
2250 strcpy(entry[i++], "password"); 2247 strcpy(entry[i++], "password");
2251 entry[i] = (char*)malloc(strlen("comment")+1); 2248 entry[i] = (char*)malloc(strlen("comment")+1);
2252 strcpy(entry[i++], "comment"); 2249 strcpy(entry[i++], "comment");
2253 2250
2254 entry[i] = (char*)malloc(strlen("field5")+1); 2251 entry[i] = (char*)malloc(strlen("field5")+1);
2255 strcpy(entry[i++], "field5"); 2252 strcpy(entry[i++], "field5");
2256 entry[i] = (char*)malloc(strlen("field6")+1); 2253 entry[i] = (char*)malloc(strlen("field6")+1);
2257 strcpy(entry[i++], "field6"); 2254 strcpy(entry[i++], "field6");
2258 2255
2259 retval = saveEntry(entry); 2256 retval = saveEntry(entry);
2260 for (int z=0; z<i; z++) free(entry[z]); 2257 for (int z=0; z<i; z++) free(entry[z]);
2261 if (retval == PWERR_DATA) { 2258 if (retval == PWERR_DATA) {
2262 qWarning("1: Error writing file, contents not saved"); 2259 owarn << "1: Error writing file, contents not saved" << oendl;
2263 saveFinalize(); 2260 saveFinalize();
2264 return false; 2261 return false;
2265 } 2262 }
2266// #ifndef WIN32 2263// #ifndef WIN32
2267 conf->writeEntry(APP_KEY+"valzsafe", 1); 2264 conf->writeEntry(APP_KEY+"valzsafe", 1);
2268// #endif 2265// #endif
2269 saveConf(); 2266 saveConf();
2270 } 2267 }
2271 2268
2272 QListViewItem *i; 2269 QListViewItem *i;
2273 // step through all categories 2270 // step through all categories
2274 for (i = ListView->firstChild(); 2271 for (i = ListView->firstChild();
@@ -2294,34 +2291,34 @@ bool ZSafe::saveDocument(const char* _filename,
2294 strcpy(entry[j++], si->text(3).utf8()); 2291 strcpy(entry[j++], si->text(3).utf8());
2295 entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); 2292 entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1);
2296 strcpy(entry[j++], si->text(4).utf8()); 2293 strcpy(entry[j++], si->text(4).utf8());
2297 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); 2294 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1);
2298 strcpy(entry[j++], si->text(5).utf8()); 2295 strcpy(entry[j++], si->text(5).utf8());
2299 2296
2300 retval = saveEntry(entry); 2297 retval = saveEntry(entry);
2301 for (int z=0; z<j; z++) 2298 for (int z=0; z<j; z++)
2302 { 2299 {
2303 free(entry[z]); 2300 free(entry[z]);
2304 } 2301 }
2305 if (retval == PWERR_DATA) { 2302 if (retval == PWERR_DATA) {
2306 qWarning("1: Error writing file, contents not saved"); 2303 owarn << "1: Error writing file, contents not saved" << oendl;
2307 saveFinalize(); 2304 saveFinalize();
2308 return false; 2305 return false;
2309 } 2306 }
2310 2307
2311 } 2308 }
2312 } 2309 }
2313 2310
2314 if (saveFinalize() == PWERR_DATA) { 2311 if (saveFinalize() == PWERR_DATA) {
2315 qWarning("2: Error writing file, contents not saved"); 2312 owarn << "2: Error writing file, contents not saved" << oendl;
2316 return false; 2313 return false;
2317 } else { 2314 } else {
2318#ifndef DESKTOP 2315#ifndef DESKTOP
2319 Global::statusMessage (tr("Password file saved.")); 2316 Global::statusMessage (tr("Password file saved."));
2320#endif 2317#endif
2321 modified = false; 2318 modified = false;
2322 return true; 2319 return true;
2323 } 2320 }
2324} 2321}
2325 2322
2326PasswordForm *newPwdDialog; 2323PasswordForm *newPwdDialog;
2327bool newPwdDialogResult = false; 2324bool newPwdDialogResult = false;
@@ -3181,25 +3178,25 @@ void ZSafe::editCategory()
3181 categories.remove (category); 3178 categories.remove (category);
3182// #ifndef WIN32 3179// #ifndef WIN32
3183 conf->removeEntry(category); 3180 conf->removeEntry(category);
3184// #endif 3181// #endif
3185 saveConf(); 3182 saveConf();
3186 } 3183 }
3187 3184
3188 category = dialog->CategoryField->currentText(); 3185 category = dialog->CategoryField->currentText();
3189 icon = dialog->IconField->currentText()+".png"; 3186 icon = dialog->IconField->currentText()+".png";
3190 3187
3191 if (cat) 3188 if (cat)
3192 { 3189 {
3193 qWarning("Category found"); 3190 owarn << "Category found" << oendl;
3194 3191
3195 // if (!icon.isEmpty() && !icon.isNull()) 3192 // if (!icon.isEmpty() && !icon.isNull())
3196 if (icon != "predefined.png") 3193 if (icon != "predefined.png")
3197 { 3194 {
3198 // build the full path 3195 // build the full path
3199 fullIconPath = iconPath + icon; 3196 fullIconPath = iconPath + icon;
3200 pix = new QPixmap (fullIconPath); 3197 pix = new QPixmap (fullIconPath);
3201 if (pix) 3198 if (pix)
3202 { 3199 {
3203 // save the full pixmap name into the config file 3200 // save the full pixmap name into the config file
3204// #ifndef WIN32 3201// #ifndef WIN32
3205 conf->writeEntry(APP_KEY+category, icon); 3202 conf->writeEntry(APP_KEY+category, icon);
diff --git a/noncore/apps/zsafe/zsafe.pro b/noncore/apps/zsafe/zsafe.pro
index 72c8fe9..3cae706 100644
--- a/noncore/apps/zsafe/zsafe.pro
+++ b/noncore/apps/zsafe/zsafe.pro
@@ -1,17 +1,17 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on 2CONFIG = qt warn_on
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \ 4HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \
5 scqtfiledlg.h 5 scqtfiledlg.h
6SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \ 6SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \
7 categorylist.cpp zlistview.cpp shadedlistitem.cpp\ 7 categorylist.cpp zlistview.cpp shadedlistitem.cpp\
8 scqtfileedit.cpp scqtfileedit.moc.cpp \ 8 scqtfileedit.cpp scqtfileedit.moc.cpp \
9 scqtfiledlg.cpp 9 scqtfiledlg.cpp
10INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui 10INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui
11INCLUDEPATH += $(OPIEDIR)/include 11INCLUDEPATH += $(OPIEDIR)/include
12DEPENDPATH += $(OPIEDIR)/include 12DEPENDPATH += $(OPIEDIR)/include
13LIBS += -Wl,-rpath,$(OPIEDIR)/lib -L$(OPIEDIR)/lib -lqpe -lopiecore2 -lopieui2 13LIBS += -lqpe -lopiecore2 -lopieui2
14TARGET = zsafe 14TARGET = zsafe
15 15
16include ( $(OPIEDIR)/include.pro ) 16include ( $(OPIEDIR)/include.pro )
17 17
diff --git a/noncore/comm/keypebble/config.in b/noncore/comm/keypebble/config.in
index 20384aa..8a800b9 100644
--- a/noncore/comm/keypebble/config.in
+++ b/noncore/comm/keypebble/config.in
@@ -1,4 +1,4 @@
1 config KEYPEBBLE 1 config KEYPEBBLE
2 boolean "opie-keypebble (Virtual Network Computing VNC viewer)" 2 boolean "opie-keypebble (Virtual Network Computing VNC viewer)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/noncore/comm/keypebble/keypebble.pro b/noncore/comm/keypebble/keypebble.pro
index 3515016..7631e4e 100644
--- a/noncore/comm/keypebble/keypebble.pro
+++ b/noncore/comm/keypebble/keypebble.pro
@@ -1,35 +1,34 @@
1CONFIG += qt warn_on quick-app 1CONFIG += qt warn_on quick-app
2 HEADERS = d3des.h \ 2 HEADERS = d3des.h \
3 krfbbuffer.h \ 3 krfbbuffer.h \
4 krfbcanvas.h \ 4 krfbcanvas.h \
5 krfbconnection.h \ 5 krfbconnection.h \
6 krfbdecoder.h \ 6 krfbdecoder.h \
7 krfblogin.h \ 7 krfblogin.h \
8 krfbserver.h \ 8 krfbserver.h \
9 krfbserverinfo.h \ 9 krfbserverinfo.h \
10 kvnc.h \ 10 kvnc.h \
11 kvncconndlg.h \ 11 kvncconndlg.h \
12 kvncbookmarkdlg.h \ 12 kvncbookmarkdlg.h \
13 vncauth.h 13 vncauth.h
14 SOURCES = d3des.c \ 14 SOURCES = d3des.c \
15 vncauth.c \ 15 vncauth.c \
16 krfbbuffer.cpp \ 16 krfbbuffer.cpp \
17 krfbcanvas.cpp \ 17 krfbcanvas.cpp \
18 krfbconnection.cpp \ 18 krfbconnection.cpp \
19 krfbdecoder.cpp \ 19 krfbdecoder.cpp \
20 krfblogin.cpp \ 20 krfblogin.cpp \
21 krfbserver.cpp \ 21 krfbserver.cpp \
22 kvnc.cpp \ 22 kvnc.cpp \
23 kvncconndlg.cpp \ 23 kvncconndlg.cpp \
24 kvncbookmarkdlg.cpp \ 24 kvncbookmarkdlg.cpp \
25 main.cpp 25 main.cpp
26 INTERFACES= kvncconndlgbase.ui \ 26 INTERFACES= kvncconndlgbase.ui kvncbookmarkdlgbase.ui
27 kvncbookmarkdlgbase.ui
28 27
29INCLUDEPATH += $(OPIEDIR)/include 28INCLUDEPATH += $(OPIEDIR)/include
30DEPENDPATH += $(OPIEDIR)/include 29DEPENDPATH += $(OPIEDIR)/include
31LIBS += -lqpe 30LIBS += -lqpe -lopiecore2
32 31
33 TARGET = keypebble 32 TARGET = keypebble
34 33
35include ( $(OPIEDIR)/include.pro ) 34include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/comm/keypebble/krfbbuffer.cpp b/noncore/comm/keypebble/krfbbuffer.cpp
index 4cec0c2..4b29612 100644
--- a/noncore/comm/keypebble/krfbbuffer.cpp
+++ b/noncore/comm/keypebble/krfbbuffer.cpp
@@ -1,25 +1,33 @@
1#include <assert.h>
2#include <qimage.h>
3#include <qpainter.h>
4#include <qapplication.h>
5#include "krfbdecoder.h" 1#include "krfbdecoder.h"
6#include "krfbbuffer.h" 2#include "krfbbuffer.h"
7#include "krfbconnection.h" 3#include "krfbconnection.h"
8#include "krfbserverinfo.h" 4#include "krfbserverinfo.h"
9 5
6/* OPIE */
7#include <opie2/odebug.h>
8using namespace Opie::Core;
9
10/* QT */
11#include <qimage.h>
12#include <qpainter.h>
13#include <qapplication.h>
14
15/* STD */
16#include <assert.h>
17
10// 18//
11// Endian stuff 19// Endian stuff
12// 20//
13#ifndef KDE_USE_FINAL 21#ifndef OPIE_NO_DEBUG
14const int endianTest = 1; 22const int endianTest = 1;
15#endif 23#endif
16 24
17#define Swap16IfLE(s) \ 25#define Swap16IfLE(s) \
18 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) 26 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
19 27
20#define Swap32IfLE(l) \ 28#define Swap32IfLE(l) \
21 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ 29 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \
22 (((l) & 0x00ff0000) >> 8) | \ 30 (((l) & 0x00ff0000) >> 8) | \
23 (((l) & 0x0000ff00) << 8) | \ 31 (((l) & 0x0000ff00) << 8) | \
24 (((l) & 0x000000ff) << 24)) : (l)) 32 (((l) & 0x000000ff) << 24)) : (l))
25 33
@@ -30,60 +38,60 @@ KRFBBuffer::KRFBBuffer( KRFBDecoder *decoder,
30 assert( decoder ); 38 assert( decoder );
31 this->decoder = decoder; 39 this->decoder = decoder;
32 pix = new QPixmap(); 40 pix = new QPixmap();
33} 41}
34 42
35KRFBBuffer::~KRFBBuffer() 43KRFBBuffer::~KRFBBuffer()
36{ 44{
37 delete pix; 45 delete pix;
38} 46}
39 47
40void KRFBBuffer::resize( int w, int h ) 48void KRFBBuffer::resize( int w, int h )
41{ 49{
42 qWarning( "Resizing buffer" ); 50 owarn << "Resizing buffer" << oendl;
43 51
44 pix->resize( w, h ); 52 pix->resize( w, h );
45 53
46 QPalette pal = qApp->palette(); 54 QPalette pal = qApp->palette();
47 pix->fill( pal.active().base() ); 55 pix->fill( pal.active().base() );
48 56
49 emit sizeChanged( w, h ); 57 emit sizeChanged( w, h );
50} 58}
51 59
52void KRFBBuffer::soundBell() 60void KRFBBuffer::soundBell()
53{ 61{
54 emit bell(); 62 emit bell();
55} 63}
56 64
57void KRFBBuffer::mouseEvent( QMouseEvent *e ) 65void KRFBBuffer::mouseEvent( QMouseEvent *e )
58{ 66{
59 decoder->sendMouseEvent( e ); 67 decoder->sendMouseEvent( e );
60} 68}
61 69
62void KRFBBuffer::keyPressEvent( QKeyEvent *e ) 70void KRFBBuffer::keyPressEvent( QKeyEvent *e )
63{ 71{
64 qWarning( "Buffer got a key" ); 72 owarn << "Buffer got a key" << oendl;
65 73
66 decoder->sendKeyPressEvent( e ); 74 decoder->sendKeyPressEvent( e );
67} 75}
68 76
69void KRFBBuffer::keyReleaseEvent( QKeyEvent *e ) 77void KRFBBuffer::keyReleaseEvent( QKeyEvent *e )
70{ 78{
71 decoder->sendKeyReleaseEvent( e ); 79 decoder->sendKeyReleaseEvent( e );
72} 80}
73 81
74void KRFBBuffer::copyRect( int srcX, int srcY, 82void KRFBBuffer::copyRect( int srcX, int srcY,
75 int destX, int destY, int w, int h ) 83 int destX, int destY, int w, int h )
76{ 84{
77// qWarning( "Got copy rect" ); 85// owarn << "Got copy rect" << oendl;
78 bitBlt( pix, destX, destY, pix, srcX, srcY, w, h, CopyROP ); 86 bitBlt( pix, destX, destY, pix, srcX, srcY, w, h, CopyROP );
79 87
80 emit updated( destX, destY, w, h ); 88 emit updated( destX, destY, w, h );
81} 89}
82 90
83void KRFBBuffer::drawRawRectChunk( void *data, 91void KRFBBuffer::drawRawRectChunk( void *data,
84 int x, int y, int w, int h ) 92 int x, int y, int w, int h )
85{ 93{
86 QImage img( w, h, 32 ); 94 QImage img( w, h, 32 );
87 95
88 int scaleFactor=decoder->con->options()->scaleFactor; 96 int scaleFactor=decoder->con->options()->scaleFactor;
89 int redMax = Swap16IfLE( decoder->format->redMax ); 97 int redMax = Swap16IfLE( decoder->format->redMax );
diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp
index cd1fda0..b3525df 100644
--- a/noncore/comm/keypebble/krfbcanvas.cpp
+++ b/noncore/comm/keypebble/krfbcanvas.cpp
@@ -1,18 +1,22 @@
1#include "krfbconnection.h" 1#include "krfbconnection.h"
2#include "krfbcanvas.h" 2#include "krfbcanvas.h"
3#include "krfbbuffer.h" 3#include "krfbbuffer.h"
4 4
5/* OPIE */
6#include <opie2/odebug.h>
5#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8using namespace Opie::Core;
6 9
10/* QT */
7#include <qclipboard.h> 11#include <qclipboard.h>
8 12
9KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) 13KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name )
10 : QScrollView( parent, name ) 14 : QScrollView( parent, name )
11{ 15{
12 connection_ = new KRFBConnection(); 16 connection_ = new KRFBConnection();
13 connect( connection_, SIGNAL( loggedIn() ), 17 connect( connection_, SIGNAL( loggedIn() ),
14 this, SLOT( loggedIn() ) ); 18 this, SLOT( loggedIn() ) );
15 19
16 loggedIn_ = false; 20 loggedIn_ = false;
17 21
18 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); 22 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold);
@@ -33,25 +37,25 @@ void KRFBCanvas::openConnection(KRFBServer server)
33{ 37{
34 38
35 39
36 QCString host = server.hostname.latin1(); 40 QCString host = server.hostname.latin1();
37 password=server.password; 41 password=server.password;
38 connection_->connectTo( server); 42 connection_->connectTo( server);
39} 43}
40 44
41 45
42void KRFBCanvas::openURL( const QUrl &url ) 46void KRFBCanvas::openURL( const QUrl &url )
43{ 47{
44 if ( loggedIn_ ) { 48 if ( loggedIn_ ) {
45 qWarning( "openURL invoked when logged in\n" ); 49 owarn << "openURL invoked when logged in\n" << oendl;
46 return; 50 return;
47 } 51 }
48 52
49 QCString host = url.host().latin1(); 53 QCString host = url.host().latin1();
50 int display = url.port(); 54 int display = url.port();
51 55
52// connection_->connectTo( host, display ); 56// connection_->connectTo( host, display );
53} 57}
54 58
55void KRFBCanvas::closeConnection() 59void KRFBCanvas::closeConnection()
56{ 60{
57 loggedIn_ = false; 61 loggedIn_ = false;
@@ -65,25 +69,25 @@ void KRFBCanvas::closeConnection()
65 69
66 70
67void KRFBCanvas::bell() 71void KRFBCanvas::bell()
68{ 72{
69 if ( connection_->options()->deIconify ) { 73 if ( connection_->options()->deIconify ) {
70 topLevelWidget()->raise(); 74 topLevelWidget()->raise();
71 topLevelWidget()->show(); 75 topLevelWidget()->show();
72 } 76 }
73} 77}
74 78
75void KRFBCanvas::loggedIn() 79void KRFBCanvas::loggedIn()
76{ 80{
77 qWarning( "Ok, we're logged in" ); 81 owarn << "Ok, we're logged in" << oendl;
78 82
79 // 83 //
80 // Get ready for action 84 // Get ready for action
81 // 85 //
82 loggedIn_ = true; 86 loggedIn_ = true;
83 viewport()->setMouseTracking( true ); 87 viewport()->setMouseTracking( true );
84 viewport()->setBackgroundMode( NoBackground ); 88 viewport()->setBackgroundMode( NoBackground );
85 setBackgroundMode( NoBackground ); 89 setBackgroundMode( NoBackground );
86 90
87 // Start using the buffer 91 // Start using the buffer
88 connect( connection_->buffer(), SIGNAL( sizeChanged(int,int) ), 92 connect( connection_->buffer(), SIGNAL( sizeChanged(int,int) ),
89 this, SLOT( resizeContents(int,int) ) ); 93 this, SLOT( resizeContents(int,int) ) );
diff --git a/noncore/comm/keypebble/krfbconnection.cpp b/noncore/comm/keypebble/krfbconnection.cpp
index b447046..33e0563 100644
--- a/noncore/comm/keypebble/krfbconnection.cpp
+++ b/noncore/comm/keypebble/krfbconnection.cpp
@@ -1,22 +1,29 @@
1#include <assert.h>
2#include <qsocket.h>
3#include <qtimer.h>
4#include <string.h>
5
6#include "krfbconnection.h" 1#include "krfbconnection.h"
7#include "krfblogin.h" 2#include "krfblogin.h"
8#include "krfbdecoder.h" 3#include "krfbdecoder.h"
9#include "krfbbuffer.h" 4#include "krfbbuffer.h"
10 5
6/* OPIE */
7#include <opie2/odebug.h>
8using namespace Opie::Core;
9
10/* QT */
11#include <qsocket.h>
12#include <qtimer.h>
13
14/* STD */
15#include <assert.h>
16#include <string.h>
17
11KRFBConnection::KRFBConnection( QObject *parent ) 18KRFBConnection::KRFBConnection( QObject *parent )
12 : QObject( parent, "KRFBConnection" ) 19 : QObject( parent, "KRFBConnection" )
13{ 20{
14 portBase_ = 5900; 21 portBase_ = 5900;
15 currentState_ = Disconnected; 22 currentState_ = Disconnected;
16 sock = 0; 23 sock = 0;
17 minData_ = 0; 24 minData_ = 0;
18 options_ = new KRFBServer(); 25 options_ = new KRFBServer();
19 updater = 0; 26 updater = 0;
20 decoder_ = 0; 27 decoder_ = 0;
21 buffer_ = 0; 28 buffer_ = 0;
22} 29}
@@ -34,33 +41,33 @@ void KRFBConnection::connectTo( KRFBServer server)
34 if ( currentState_ != Disconnected ) 41 if ( currentState_ != Disconnected )
35 disconnect(); 42 disconnect();
36 43
37 (*options_)=server; 44 (*options_)=server;
38 45
39 sock = new QSocket( this, "rfbSocket" ); 46 sock = new QSocket( this, "rfbSocket" );
40 CHECK_PTR( sock ); 47 CHECK_PTR( sock );
41 48
42 // Connect to something to notice connection or error 49 // Connect to something to notice connection or error
43 connect( sock, SIGNAL( error(int) ), SLOT( gotSocketError(int) ) ); 50 connect( sock, SIGNAL( error(int) ), SLOT( gotSocketError(int) ) );
44 connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); 51 connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) );
45 52
46 qWarning( "Connecting..." ); 53 owarn << "Connecting..." << oendl;
47 54
48 currentState_ = Connecting; 55 currentState_ = Connecting;
49 sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); 56 sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display );
50} 57}
51 58
52void KRFBConnection::disconnect() 59void KRFBConnection::disconnect()
53{ 60{
54 qWarning( "Disconnecting from server" ); 61 owarn << "Disconnecting from server" << oendl;
55 62
56 if ( ( currentState_ != Disconnected ) 63 if ( ( currentState_ != Disconnected )
57 && ( currentState_ != Disconnecting ) 64 && ( currentState_ != Disconnecting )
58 && sock ) { 65 && sock ) {
59 currentState_ = Disconnecting; 66 currentState_ = Disconnecting;
60 67
61 connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) ); 68 connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) );
62 sock->close(); 69 sock->close();
63 70
64 if ( sock->state() != QSocket::Closing ) 71 if ( sock->state() != QSocket::Closing )
65 disconnectDone(); 72 disconnectDone();
66 } 73 }
@@ -73,36 +80,36 @@ void KRFBConnection::disconnectDone()
73 sock = 0; 80 sock = 0;
74 minData_ = 0; 81 minData_ = 0;
75 delete updater; 82 delete updater;
76 delete decoder_; 83 delete decoder_;
77 delete buffer_; 84 delete buffer_;
78 emit disconnected(); 85 emit disconnected();
79} 86}
80 87
81void KRFBConnection::gotSocketConnection() 88void KRFBConnection::gotSocketConnection()
82{ 89{
83 currentState_ = LoggingIn; 90 currentState_ = LoggingIn;
84 91
85 qWarning( "Connected, logging in..." ); 92 owarn << "Connected, logging in..." << oendl;
86 93
87 static QString statusMsg = tr( "Connected" ); 94 static QString statusMsg = tr( "Connected" );
88 emit statusChanged( statusMsg ); 95 emit statusChanged( statusMsg );
89 96
90 // Do some login stuff 97 // Do some login stuff
91 login = new KRFBLogin( this ); 98 login = new KRFBLogin( this );
92} 99}
93 100
94void KRFBConnection::gotRFBConnection() 101void KRFBConnection::gotRFBConnection()
95{ 102{
96 qWarning( "Logged into server" ); 103 owarn << "Logged into server" << oendl;
97 104
98 currentState_ = Connected; 105 currentState_ = Connected;
99 emit connected(); 106 emit connected();
100 107
101 // Create the decoder and start doing stuff 108 // Create the decoder and start doing stuff
102 decoder_ = new KRFBDecoder( this ); 109 decoder_ = new KRFBDecoder( this );
103 CHECK_PTR( decoder_ ); 110 CHECK_PTR( decoder_ );
104 111
105 buffer_ = new KRFBBuffer( decoder_, this, "RFB Buffer" ); 112 buffer_ = new KRFBBuffer( decoder_, this, "RFB Buffer" );
106 CHECK_PTR( buffer_ ); 113 CHECK_PTR( buffer_ );
107 decoder_->setBuffer( buffer_ ); 114 decoder_->setBuffer( buffer_ );
108 115
@@ -113,25 +120,25 @@ void KRFBConnection::gotRFBConnection()
113 decoder_->start(); 120 decoder_->start();
114 121
115 updater = new QTimer; 122 updater = new QTimer;
116 connect( updater, SIGNAL( timeout() ), SLOT( updateTimer() ) ); 123 connect( updater, SIGNAL( timeout() ), SLOT( updateTimer() ) );
117 updater->start( options_->updateRate ); 124 updater->start( options_->updateRate );
118} 125}
119 126
120void KRFBConnection::gotSocketError( int err ) 127void KRFBConnection::gotSocketError( int err )
121{ 128{
122 currentState_ = Error; 129 currentState_ = Error;
123 130
124 // Do some error handling stuff 131 // Do some error handling stuff
125 qWarning( "KRFBConnection: Socket error %d", err ); 132 owarn << "KRFBConnection: Socket error " << err << "" << oendl;
126 133
127 static QString refused = tr( "Connection Refused" ); 134 static QString refused = tr( "Connection Refused" );
128 static QString host = tr( "Host not found" ); 135 static QString host = tr( "Host not found" );
129 static QString read = tr( "Read Error: QSocket reported an error reading\n" 136 static QString read = tr( "Read Error: QSocket reported an error reading\n"
130 "data, the remote host has probably dropped the\n" 137 "data, the remote host has probably dropped the\n"
131 "connection." ); 138 "connection." );
132 static QString confused = tr( "QSocket reported an invalid error code" ); 139 static QString confused = tr( "QSocket reported an invalid error code" );
133 140
134 QString msg; 141 QString msg;
135 switch ( err ) { 142 switch ( err ) {
136 case QSocket::ErrConnectionRefused: 143 case QSocket::ErrConnectionRefused:
137 msg = refused; 144 msg = refused;
@@ -163,29 +170,29 @@ void KRFBConnection::gotMoreData()
163 QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); 170 QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) );
164 emit gotEnoughData(); 171 emit gotEnoughData();
165 } 172 }
166} 173}
167 174
168void KRFBConnection::waitForData( unsigned int sz ) 175void KRFBConnection::waitForData( unsigned int sz )
169{ 176{
170 assert( minData_ == 0 ); 177 assert( minData_ == 0 );
171 assert( sz > 0 ); 178 assert( sz > 0 );
172 assert( currentState_ != Error ); 179 assert( currentState_ != Error );
173 180
174 if ( sock->size() >= sz ) { 181 if ( sock->size() >= sz ) {
175 // qWarning( "No need to wait for data" ); 182 // owarn << "No need to wait for data" << oendl;
176 emit gotEnoughData(); 183 emit gotEnoughData();
177 } 184 }
178 else { 185 else {
179 // qWarning( "Waiting for %u bytes", sz ); 186 // owarn << "Waiting for " << sz << " bytes" << oendl;
180 minData_ = sz; 187 minData_ = sz;
181 connect( sock, SIGNAL( readyRead() ), SLOT( gotMoreData() ) ); 188 connect( sock, SIGNAL( readyRead() ), SLOT( gotMoreData() ) );
182 } 189 }
183} 190}
184 191
185int KRFBConnection::read( void *buf, int sz ) 192int KRFBConnection::read( void *buf, int sz )
186{ 193{
187 return sock->readBlock( (char *) buf, sz ); 194 return sock->readBlock( (char *) buf, sz );
188} 195}
189 196
190int KRFBConnection::write( void *buf, int sz ) 197int KRFBConnection::write( void *buf, int sz )
191{ 198{
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp
index db95154..69457e2 100644
--- a/noncore/comm/keypebble/krfbdecoder.cpp
+++ b/noncore/comm/keypebble/krfbdecoder.cpp
@@ -1,26 +1,31 @@
1#include "krfbconnection.h" 1#include "krfbconnection.h"
2#include "krfbserverinfo.h" 2#include "krfbserverinfo.h"
3#include "krfbdecoder.h" 3#include "krfbdecoder.h"
4#include "krfbbuffer.h" 4#include "krfbbuffer.h"
5 5
6/* OPIE */
7#include <opie2/odebug.h>
8using namespace Opie::Core;
6 9
10/* QT */
7#include <qpixmap.h> 11#include <qpixmap.h>
8 12
13/* STD */
9#include <assert.h> 14#include <assert.h>
10 15
11// 16//
12// Endian stuff 17// Endian stuff
13// 18//
14#ifndef KDE_USE_FINAL 19#ifndef OPIE_NO_DEBUG
15const int endianTest = 1; 20const int endianTest = 1;
16#endif 21#endif
17 22
18#define Swap16IfLE(s) \ 23#define Swap16IfLE(s) \
19 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) 24 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
20 25
21#define Swap32IfLE(l) \ 26#define Swap32IfLE(l) \
22 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ 27 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \
23 (((l) & 0x00ff0000) >> 8) | \ 28 (((l) & 0x00ff0000) >> 8) | \
24 (((l) & 0x0000ff00) << 8) | \ 29 (((l) & 0x0000ff00) << 8) | \
25 (((l) & 0x000000ff) << 24)) : (l)) 30 (((l) & 0x000000ff) << 24)) : (l))
26 31
@@ -126,37 +131,37 @@ KRFBDecoder::~KRFBDecoder()
126} 131}
127 132
128void KRFBDecoder::start() 133void KRFBDecoder::start()
129{ 134{
130 sendClientInit(); 135 sendClientInit();
131} 136}
132 137
133void KRFBDecoder::sendClientInit() 138void KRFBDecoder::sendClientInit()
134{ 139{
135 con->write( &( con->options()->shared ), 1 ); 140 con->write( &( con->options()->shared ), 1 );
136 141
137 // Wait for server init 142 // Wait for server init
138 qWarning( "Waiting for server init" ); 143 owarn << "Waiting for server init" << oendl;
139 144
140 static QString statusMsg = tr( "Waiting for server initialization..." ); 145 static QString statusMsg = tr( "Waiting for server initialization..." );
141 emit status( statusMsg ); 146 emit status( statusMsg );
142 147
143 currentState = AwaitingServerInit; 148 currentState = AwaitingServerInit;
144 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerInit() ) ); 149 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerInit() ) );
145 con->waitForData( ServerInitLength ); 150 con->waitForData( ServerInitLength );
146} 151}
147 152
148void KRFBDecoder::gotServerInit() 153void KRFBDecoder::gotServerInit()
149{ 154{
150 qWarning( "Got server init" ); 155 owarn << "Got server init" << oendl;
151 disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) ); 156 disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) );
152 157
153 if ( info ) 158 if ( info )
154 delete info; 159 delete info;
155 info = new KRFBServerInfo; 160 info = new KRFBServerInfo;
156 CHECK_PTR( info ); 161 CHECK_PTR( info );
157 162
158 con->read( &(info->width), 2 ); 163 con->read( &(info->width), 2 );
159 info->width = Swap16IfLE( info->width ); 164 info->width = Swap16IfLE( info->width );
160 con->read( &info->height, 2 ); 165 con->read( &info->height, 2 );
161 info->height = Swap16IfLE( info->height ); 166 info->height = Swap16IfLE( info->height );
162 167
@@ -172,63 +177,63 @@ void KRFBDecoder::gotServerInit()
172 con->read( &(info->blueMax), 2 ); 177 con->read( &(info->blueMax), 2 );
173 info->blueMax = Swap16IfLE( info->blueMax ); 178 info->blueMax = Swap16IfLE( info->blueMax );
174 179
175 con->read( &(info->redShift), 1 ); 180 con->read( &(info->redShift), 1 );
176 con->read( &(info->greenShift), 1 ); 181 con->read( &(info->greenShift), 1 );
177 con->read( &(info->blueShift), 1 ); 182 con->read( &(info->blueShift), 1 );
178 183
179 con->read( info->padding, 3 ); 184 con->read( info->padding, 3 );
180 185
181 con->read( &(info->nameLength), 4 ); 186 con->read( &(info->nameLength), 4 );
182 info->nameLength = Swap32IfLE( info->nameLength ); 187 info->nameLength = Swap32IfLE( info->nameLength );
183 188
184 qWarning( "Width = %d, Height = %d", info->width, info->height ); 189 owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl;
185 qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d", 190 qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d",
186 info->bpp, info->depth, info->bigEndian, info->trueColor ); 191 info->bpp, info->depth, info->bigEndian, info->trueColor );
187 qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d", 192 qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d",
188 info->redMax, info->greenMax, info->blueMax ); 193 info->redMax, info->greenMax, info->blueMax );
189 qWarning( "RedShift = %d, GreenShift = %d, BlueShift = %d", 194 qWarning( "RedShift = %d, GreenShift = %d, BlueShift = %d",
190 info->redShift, info->greenShift,info-> blueShift ); 195 info->redShift, info->greenShift,info-> blueShift );
191 196
192 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor); 197 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor);
193 198
194 // Wait for desktop name 199 // Wait for desktop name
195 qWarning( "Waiting for desktop name" ); 200 owarn << "Waiting for desktop name" << oendl;
196 201
197 static QString statusMsg = tr( "Waiting for desktop name..." ); 202 static QString statusMsg = tr( "Waiting for desktop name..." );
198 emit status( statusMsg ); 203 emit status( statusMsg );
199 204
200 currentState = AwaitingDesktopName; 205 currentState = AwaitingDesktopName;
201 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) ); 206 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) );
202 con->waitForData( info->nameLength ); 207 con->waitForData( info->nameLength );
203} 208}
204 209
205void KRFBDecoder::gotDesktopName() 210void KRFBDecoder::gotDesktopName()
206{ 211{
207 assert( info ); 212 assert( info );
208 assert( currentState == AwaitingDesktopName ); 213 assert( currentState == AwaitingDesktopName );
209 214
210 qWarning( "Got desktop name" ); 215 owarn << "Got desktop name" << oendl;
211 216
212 disconnect( con, SIGNAL( gotEnoughData() ), 217 disconnect( con, SIGNAL( gotEnoughData() ),
213 this, SLOT( gotDesktopName() ) ); 218 this, SLOT( gotDesktopName() ) );
214 219
215 char *buf = new char[ info->nameLength + 1 ]; 220 char *buf = new char[ info->nameLength + 1 ];
216 CHECK_PTR( buf ); 221 CHECK_PTR( buf );
217 222
218 con->read( buf, info->nameLength ); 223 con->read( buf, info->nameLength );
219 buf[ info->nameLength ] = '\0'; 224 buf[ info->nameLength ] = '\0';
220 info->name = buf; 225 info->name = buf;
221 226
222 qWarning( "Desktop: %s", info->name.latin1() ); 227 owarn << "Desktop: " << info->name.latin1() << "" << oendl;
223 228
224 delete buf; 229 delete buf;
225 230
226 // Get the format we'll really use and tell the server 231 // Get the format we'll really use and tell the server
227 decidePixelFormat(); 232 decidePixelFormat();
228 sendPixelFormat(); 233 sendPixelFormat();
229 sendAllowedEncodings(); 234 sendAllowedEncodings();
230 currentState = Idle; 235 currentState = Idle;
231 236
232 QString msg; 237 QString msg;
233 msg = tr( "Connected to %1" ); 238 msg = tr( "Connected to %1" );
234 msg = msg.arg( info->name ); 239 msg = msg.arg( info->name );
@@ -362,25 +367,25 @@ void KRFBDecoder::sendUpdateRequest( bool incremental )
362 con->write( &h, 2 ); 367 con->write( &h, 2 );
363 368
364 // Now wait for the update 369 // Now wait for the update
365 currentState = AwaitingUpdate; 370 currentState = AwaitingUpdate;
366 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); 371 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) );
367 con->waitForData( UpdateHeaderLength ); 372 con->waitForData( UpdateHeaderLength );
368} 373}
369 374
370void KRFBDecoder::gotUpdateHeader() 375void KRFBDecoder::gotUpdateHeader()
371{ 376{
372 assert( currentState == AwaitingUpdate ); 377 assert( currentState == AwaitingUpdate );
373 378
374 // qWarning( "Got update header" ); 379 // owarn << "Got update header" << oendl;
375 380
376 disconnect( con, SIGNAL( gotEnoughData() ), 381 disconnect( con, SIGNAL( gotEnoughData() ),
377 this, SLOT( gotUpdateHeader() ) ); 382 this, SLOT( gotUpdateHeader() ) );
378 383
379 CARD8 msgType; 384 CARD8 msgType;
380 con->read( &msgType, 1 ); 385 con->read( &msgType, 1 );
381 386
382 if ( msgType != UpdateId ) { 387 if ( msgType != UpdateId ) {
383 // We might have a bell or server cut 388 // We might have a bell or server cut
384 if ( msgType == ServerCutId ) { 389 if ( msgType == ServerCutId ) {
385 oldState = currentState; 390 oldState = currentState;
386 gotServerCut(); 391 gotServerCut();
@@ -397,37 +402,37 @@ void KRFBDecoder::gotUpdateHeader()
397 currentState = Error; 402 currentState = Error;
398 emit error( protocolError ); 403 emit error( protocolError );
399 } 404 }
400 return; 405 return;
401 } 406 }
402 407
403 CARD8 padding; 408 CARD8 padding;
404 con->read( &padding, 1 ); 409 con->read( &padding, 1 );
405 410
406 con->read( &noRects, 2 ); 411 con->read( &noRects, 2 );
407 noRects = Swap16IfLE( noRects ); 412 noRects = Swap16IfLE( noRects );
408 413
409 // qWarning( "Expecting %d rects", noRects ); 414 // owarn << "Expecting " << noRects << " rects" << oendl;
410 415
411 // Now wait for the data 416 // Now wait for the data
412 currentState = AwaitingRectHeader; 417 currentState = AwaitingRectHeader;
413 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); 418 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
414 con->waitForData( RectHeaderLength ); 419 con->waitForData( RectHeaderLength );
415} 420}
416 421
417void KRFBDecoder::gotRectHeader() 422void KRFBDecoder::gotRectHeader()
418{ 423{
419 assert( currentState == AwaitingRectHeader ); 424 assert( currentState == AwaitingRectHeader );
420 425
421 // qWarning( "Got rect header" ); 426 // owarn << "Got rect header" << oendl;
422 427
423 disconnect( con, SIGNAL( gotEnoughData() ), 428 disconnect( con, SIGNAL( gotEnoughData() ),
424 this, SLOT( gotRectHeader() ) ); 429 this, SLOT( gotRectHeader() ) );
425 430
426 con->read( &x, 2 ); 431 con->read( &x, 2 );
427 x = Swap16IfLE( x ); 432 x = Swap16IfLE( x );
428 con->read( &y, 2 ); 433 con->read( &y, 2 );
429 y = Swap16IfLE( y ); 434 y = Swap16IfLE( y );
430 435
431 con->read( &w, 2 ); 436 con->read( &w, 2 );
432 w = Swap16IfLE( w ); 437 w = Swap16IfLE( w );
433 con->read( &h, 2 ); 438 con->read( &h, 2 );
@@ -437,125 +442,125 @@ void KRFBDecoder::gotRectHeader()
437 442
438 // CARD32 encodingLocal = Swap32IfLE( encoding ); 443 // CARD32 encodingLocal = Swap32IfLE( encoding );
439 // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld", 444 // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld",
440 // x, y, w, h, encodingLocal ); 445 // x, y, w, h, encodingLocal );
441 446
442 // 447 //
443 // Each encoding needs to be handled differently. Some require 448 // Each encoding needs to be handled differently. Some require
444 // waiting for more data, but others like a copyrect do not. 449 // waiting for more data, but others like a copyrect do not.
445 // Our constants have already been byte swapped, so we use 450 // Our constants have already been byte swapped, so we use
446 // the remote value as is. 451 // the remote value as is.
447 // 452 //
448 if ( encoding == RawEncoding ) { 453 if ( encoding == RawEncoding ) {
449 // qWarning( "Raw encoding" ); 454 // owarn << "Raw encoding" << oendl;
450 handleRawRect(); 455 handleRawRect();
451 } 456 }
452 else if ( encoding == CopyRectEncoding ) { 457 else if ( encoding == CopyRectEncoding ) {
453// qWarning( "CopyRect encoding" ); 458// owarn << "CopyRect encoding" << oendl;
454 handleCopyRect(); 459 handleCopyRect();
455 } 460 }
456 else if ( encoding == RreEncoding ) { 461 else if ( encoding == RreEncoding ) {
457 qWarning( "RRE encoding" ); 462 owarn << "RRE encoding" << oendl;
458 handleRRERect(); 463 handleRRERect();
459 } 464 }
460 else if ( encoding == CorreEncoding ) { 465 else if ( encoding == CorreEncoding ) {
461 qWarning( "CoRRE encoding" ); 466 owarn << "CoRRE encoding" << oendl;
462 handleCoRRERect(); 467 handleCoRRERect();
463 } 468 }
464 else if ( encoding == HexTileEncoding ) { 469 else if ( encoding == HexTileEncoding ) {
465 qWarning( "HexTile encoding" ); 470 owarn << "HexTile encoding" << oendl;
466 handleHexTileRect(); 471 handleHexTileRect();
467 } 472 }
468 else { 473 else {
469 int msg = Swap32IfLE( encoding ); 474 int msg = Swap32IfLE( encoding );
470 QString protocolError = tr( "Protocol Error: An unknown encoding was " 475 QString protocolError = tr( "Protocol Error: An unknown encoding was "
471 "used by the server %1" ).arg( msg ); 476 "used by the server %1" ).arg( msg );
472 currentState = Error; 477 currentState = Error;
473 qWarning( "Unknown encoding, %d", msg ); 478 owarn << "Unknown encoding, " << msg << "" << oendl;
474 emit error( protocolError ); 479 emit error( protocolError );
475 return; 480 return;
476 } 481 }
477} 482}
478 483
479// 484//
480// Raw Encoding 485// Raw Encoding
481// 486//
482 487
483void KRFBDecoder::handleRawRect() 488void KRFBDecoder::handleRawRect()
484{ 489{
485 // We need something a bit cleverer here to handle large 490 // We need something a bit cleverer here to handle large
486 // rectanges nicely. The chunking should be based on the 491 // rectanges nicely. The chunking should be based on the
487 // overall size (but has to be in complete lines). 492 // overall size (but has to be in complete lines).
488 493
489 // qWarning( "Handling a raw rect chunk" ); 494 // owarn << "Handling a raw rect chunk" << oendl;
490 495
491 // CARD32 lineCount = w * format->bpp / 8; 496 // CARD32 lineCount = w * format->bpp / 8;
492 497
493 if ( h > RectChunkSize ) { 498 if ( h > RectChunkSize ) {
494 // if ( con->sock->size() / lineCount ) { 499 // if ( con->sock->size() / lineCount ) {
495 // getRawRectChunk( con->sock->size() / lineCount ); 500 // getRawRectChunk( con->sock->size() / lineCount );
496 // } 501 // }
497 // else { 502 // else {
498 getRawRectChunk( RectChunkSize ); 503 getRawRectChunk( RectChunkSize );
499 // } 504 // }
500 } 505 }
501 else { 506 else {
502 getRawRectChunk( h ); 507 getRawRectChunk( h );
503 } 508 }
504} 509}
505 510
506void KRFBDecoder::getRawRectChunk( int lines ) 511void KRFBDecoder::getRawRectChunk( int lines )
507{ 512{
508 this->lines = lines; 513 this->lines = lines;
509 CARD32 count = lines * w * format->bpp / 8; 514 CARD32 count = lines * w * format->bpp / 8;
510 515
511 // Wait for server init 516 // Wait for server init
512 // qWarning( "Waiting for raw rect chunk, %ld", count ); 517 // owarn << "Waiting for raw rect chunk, " << count << "" << oendl;
513 518
514 currentState = AwaitingRawRectChunk; 519 currentState = AwaitingRawRectChunk;
515 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) ); 520 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) );
516 con->waitForData( count ); 521 con->waitForData( count );
517} 522}
518 523
519void KRFBDecoder::gotRawRectChunk() 524void KRFBDecoder::gotRawRectChunk()
520{ 525{
521 assert( currentState == AwaitingRawRectChunk ); 526 assert( currentState == AwaitingRawRectChunk );
522 527
523 disconnect( con, SIGNAL( gotEnoughData() ), 528 disconnect( con, SIGNAL( gotEnoughData() ),
524 this, SLOT( gotRawRectChunk() ) ); 529 this, SLOT( gotRawRectChunk() ) );
525 530
526 // qWarning( "Got raw rect chunk" ); 531 // owarn << "Got raw rect chunk" << oendl;
527 532
528 // 533 //
529 // Read the rect data and copy it to the buffer. 534 // Read the rect data and copy it to the buffer.
530 // 535 //
531 536
532 // TODO: Replace this! 537 // TODO: Replace this!
533 int count = lines * w * format->bpp / 8; 538 int count = lines * w * format->bpp / 8;
534 char *hack = new char[ count ]; 539 char *hack = new char[ count ];
535 con->read( hack, count ); 540 con->read( hack, count );
536 buf->drawRawRectChunk( hack, x, y, w, lines ); 541 buf->drawRawRectChunk( hack, x, y, w, lines );
537 delete hack; 542 delete hack;
538 // /TODO: 543 // /TODO:
539 544
540 h = h - lines; 545 h = h - lines;
541 y = y + lines; 546 y = y + lines;
542 547
543 if ( h > 0 ) { 548 if ( h > 0 ) {
544 handleRawRect(); 549 handleRawRect();
545 } 550 }
546 else { 551 else {
547 noRects--; 552 noRects--;
548 553
549 // qWarning( "There are %d rects left", noRects ); 554 // owarn << "There are " << noRects << " rects left" << oendl;
550 555
551 if ( noRects ) { 556 if ( noRects ) {
552 currentState = AwaitingRectHeader; 557 currentState = AwaitingRectHeader;
553 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); 558 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
554 con->waitForData( RectHeaderLength ); 559 con->waitForData( RectHeaderLength );
555 } 560 }
556 else { 561 else {
557 // we are now ready for the next update - no need to wait for the timer 562 // we are now ready for the next update - no need to wait for the timer
558 currentState = Idle; 563 currentState = Idle;
559 sendUpdateRequest (1); 564 sendUpdateRequest (1);
560 } 565 }
561 } 566 }
@@ -581,48 +586,48 @@ void KRFBDecoder::gotCopyRectPos()
581 CARD16 srcY; 586 CARD16 srcY;
582 587
583 con->read( &srcX, 2 ); 588 con->read( &srcX, 2 );
584 con->read( &srcY, 2 ); 589 con->read( &srcY, 2 );
585 590
586 srcX = Swap16IfLE( srcX ); 591 srcX = Swap16IfLE( srcX );
587 srcY = Swap16IfLE( srcY ); 592 srcY = Swap16IfLE( srcY );
588 593
589 buf->copyRect( srcX, srcY, x, y, w, h ); 594 buf->copyRect( srcX, srcY, x, y, w, h );
590 595
591 noRects--; 596 noRects--;
592 597
593 // qWarning( "There are %d rects left", noRects ); 598 // owarn << "There are " << noRects << " rects left" << oendl;
594 599
595 if ( noRects ) { 600 if ( noRects ) {
596 currentState = AwaitingRectHeader; 601 currentState = AwaitingRectHeader;
597 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); 602 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
598 con->waitForData( RectHeaderLength ); 603 con->waitForData( RectHeaderLength );
599 } 604 }
600 else 605 else
601 currentState = Idle; 606 currentState = Idle;
602} 607}
603 608
604void KRFBDecoder::handleRRERect() 609void KRFBDecoder::handleRRERect()
605{ 610{
606 qWarning( "RRE not implemented" ); 611 owarn << "RRE not implemented" << oendl;
607} 612}
608 613
609void KRFBDecoder::handleCoRRERect() 614void KRFBDecoder::handleCoRRERect()
610{ 615{
611 qWarning( "CoRRE not implemented" ); 616 owarn << "CoRRE not implemented" << oendl;
612} 617}
613 618
614void KRFBDecoder::handleHexTileRect() 619void KRFBDecoder::handleHexTileRect()
615{ 620{
616 qWarning( "HexTile not implemented" ); 621 owarn << "HexTile not implemented" << oendl;
617} 622}
618 623
619void KRFBDecoder::sendMouseEvent( QMouseEvent *e ) 624void KRFBDecoder::sendMouseEvent( QMouseEvent *e )
620{ 625{
621 // Deal with the buttons 626 // Deal with the buttons
622 if ( e->type() != QEvent::MouseMove ) { 627 if ( e->type() != QEvent::MouseMove ) {
623 buttonMask = 0; 628 buttonMask = 0;
624 if ( e->type() == QEvent::MouseButtonPress ) { 629 if ( e->type() == QEvent::MouseButtonPress ) {
625 if ( e->button() & LeftButton ) 630 if ( e->button() & LeftButton )
626 buttonMask |= 0x01; 631 buttonMask |= 0x01;
627 if ( e->button() & MidButton ) 632 if ( e->button() & MidButton )
628 buttonMask |= 0x04; 633 buttonMask |= 0x04;
@@ -664,25 +669,25 @@ void KRFBDecoder::sendCutEvent( const QString &unicode )
664 QCString text = unicode.local8Bit(); 669 QCString text = unicode.local8Bit();
665 CARD32 length = text.length(); 670 CARD32 length = text.length();
666 length = Swap32IfLE( length ); 671 length = Swap32IfLE( length );
667 672
668 con->write( &ClientCutTextId, 1 ); 673 con->write( &ClientCutTextId, 1 );
669 con->write( &padding, 3 ); 674 con->write( &padding, 3 );
670 con->write( &length, 4 ); 675 con->write( &length, 4 );
671 con->write( text.data(), length ); 676 con->write( text.data(), length );
672} 677}
673 678
674void KRFBDecoder::gotServerCut() 679void KRFBDecoder::gotServerCut()
675{ 680{
676 qWarning( "Got server cut" ); 681 owarn << "Got server cut" << oendl;
677 682
678 currentState = AwaitingServerCutLength; 683 currentState = AwaitingServerCutLength;
679 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); 684 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) );
680 con->waitForData( ServerCutLenLength ); 685 con->waitForData( ServerCutLenLength );
681} 686}
682 687
683void KRFBDecoder::gotServerCutLength() 688void KRFBDecoder::gotServerCutLength()
684{ 689{
685 assert( currentState = AwaitingServerCutLength ); 690 assert( currentState = AwaitingServerCutLength );
686 disconnect( con, SIGNAL( gotEnoughData() ), 691 disconnect( con, SIGNAL( gotEnoughData() ),
687 this, SLOT( gotServerCutLength() ) ); 692 this, SLOT( gotServerCutLength() ) );
688 693
@@ -712,62 +717,62 @@ void KRFBDecoder::gotServerCutText()
712 // same. I've reported this problem to the ORL guys, but they apparantly have no 717 // same. I've reported this problem to the ORL guys, but they apparantly have no
713 // immediate plans to fix the issue. :-( (rich) 718 // immediate plans to fix the issue. :-( (rich)
714 // 719 //
715 720
716 char *cutbuf = new char[ serverCutTextLen + 1 ]; 721 char *cutbuf = new char[ serverCutTextLen + 1 ];
717 CHECK_PTR( cutbuf ); 722 CHECK_PTR( cutbuf );
718 723
719 con->read( cutbuf, serverCutTextLen ); 724 con->read( cutbuf, serverCutTextLen );
720 cutbuf[ serverCutTextLen ] = '\0'; 725 cutbuf[ serverCutTextLen ] = '\0';
721 726
722 /* For some reason QApplication::clipboard()->setText() segfaults when called 727 /* For some reason QApplication::clipboard()->setText() segfaults when called
723 * from within keypebble's mass of signals and slots 728 * from within keypebble's mass of signals and slots
724 qWarning( "Server cut: %s", cutbuf ); 729 owarn << "Server cut: " << cutbuf << "" << oendl;
725 730
726 QString cutText( cutbuf ); // DANGER!! 731 QString cutText( cutbuf ); // DANGER!!
727 qApp->clipboard()->setText( cutText ); 732 qApp->clipboard()->setText( cutText );
728 */ 733 */
729 734
730 delete cutbuf; 735 delete cutbuf;
731 // Now wait for the update (again) 736 // Now wait for the update (again)
732 if ( oldState == AwaitingUpdate ) { 737 if ( oldState == AwaitingUpdate ) {
733 currentState = AwaitingUpdate; 738 currentState = AwaitingUpdate;
734 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); 739 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) );
735 con->waitForData( UpdateHeaderLength ); 740 con->waitForData( UpdateHeaderLength );
736 } 741 }
737 else if ( oldState == Idle ) { 742 else if ( oldState == Idle ) {
738 currentState = Idle; 743 currentState = Idle;
739 } 744 }
740 else { 745 else {
741 qWarning( "Async handled in weird state" ); 746 owarn << "Async handled in weird state" << oendl;
742 currentState = oldState; 747 currentState = oldState;
743 }; 748 };
744} 749}
745 750
746void KRFBDecoder::gotBell() 751void KRFBDecoder::gotBell()
747{ 752{
748 qWarning( "Got server bell" ); 753 owarn << "Got server bell" << oendl;
749 buf->soundBell(); 754 buf->soundBell();
750 755
751 // Now wait for the update (again) 756 // Now wait for the update (again)
752 if ( oldState == AwaitingUpdate ) { 757 if ( oldState == AwaitingUpdate ) {
753 currentState = AwaitingUpdate; 758 currentState = AwaitingUpdate;
754 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); 759 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) );
755 con->waitForData( UpdateHeaderLength ); 760 con->waitForData( UpdateHeaderLength );
756 } 761 }
757 else if ( oldState == Idle ) { 762 else if ( oldState == Idle ) {
758 currentState = Idle; 763 currentState = Idle;
759 } 764 }
760 else { 765 else {
761 qWarning( "Async handled in weird state" ); 766 owarn << "Async handled in weird state" << oendl;
762 currentState = oldState; 767 currentState = oldState;
763 }; 768 };
764} 769}
765 770
766void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event ) 771void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event )
767{ 772{
768 int key; 773 int key;
769 key = toKeySym( event ); 774 key = toKeySym( event );
770 if ( key ) { 775 if ( key ) {
771 key = Swap32IfLE( key ); 776 key = Swap32IfLE( key );
772 777
773 CARD8 mask = true; 778 CARD8 mask = true;
diff --git a/noncore/comm/keypebble/krfblogin.cpp b/noncore/comm/keypebble/krfblogin.cpp
index 2bbd110..92005d2 100644
--- a/noncore/comm/keypebble/krfblogin.cpp
+++ b/noncore/comm/keypebble/krfblogin.cpp
@@ -1,23 +1,28 @@
1#include <assert.h> 1#include "krfblogin.h"
2#include "krfbconnection.h"
2 3
4/* OPIE */
5#include <opie2/odebug.h>
6using namespace Opie::Core;
7
8/* QT */
9#include <qtimer.h>
3 10
11/* STD */
12#include <assert.h>
4extern "C" { 13extern "C" {
5#include "vncauth.h" 14#include "vncauth.h"
6} 15}
7 16
8#include "krfblogin.h"
9#include "krfbconnection.h"
10#include <qtimer.h>
11
12// The length of the various messages (used to decide how many bytes to 17// The length of the various messages (used to decide how many bytes to
13// wait for). 18// wait for).
14const int ServerVersionLength = 12; 19const int ServerVersionLength = 12;
15const int ClientVersionLength = 12; 20const int ClientVersionLength = 12;
16const int AuthSchemeLength = 4; 21const int AuthSchemeLength = 4;
17const int FailureReasonSizeLength = 4; 22const int FailureReasonSizeLength = 4;
18const int ChallengeLength = 16; 23const int ChallengeLength = 16;
19const int AuthResultLength = 4; 24const int AuthResultLength = 4;
20 25
21// Authentication results 26// Authentication results
22enum AuthResult { 27enum AuthResult {
23 AuthOk, 28 AuthOk,
@@ -43,154 +48,154 @@ const int endianTest = 1;
43 48
44KRFBLogin::KRFBLogin( KRFBConnection *con ) 49KRFBLogin::KRFBLogin( KRFBConnection *con )
45 : QObject( con, "RFB login manager" ) 50 : QObject( con, "RFB login manager" )
46{ 51{
47 assert( con ); 52 assert( con );
48 this->con = con; 53 this->con = con;
49 currentState = AwaitingServerVersion; 54 currentState = AwaitingServerVersion;
50 55
51 connect( this, SIGNAL( error(const QString&) ), 56 connect( this, SIGNAL( error(const QString&) ),
52 con, SIGNAL( error(const QString&) ) ); 57 con, SIGNAL( error(const QString&) ) );
53 58
54 59
55 qWarning( "Waiting for server version..." ); 60 owarn << "Waiting for server version..." << oendl;
56 61
57 static QString statusMsg = tr( "Waiting for server version..." ); 62 static QString statusMsg = tr( "Waiting for server version..." );
58 emit status( statusMsg ); 63 emit status( statusMsg );
59 64
60 // Kick off the state machine 65 // Kick off the state machine
61 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) ); 66 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) );
62 con->waitForData( ServerVersionLength ); 67 con->waitForData( ServerVersionLength );
63} 68}
64 69
65KRFBLogin::~KRFBLogin() 70KRFBLogin::~KRFBLogin()
66{ 71{
67 72
68} 73}
69 74
70KRFBLogin::State KRFBLogin::state() const 75KRFBLogin::State KRFBLogin::state() const
71{ 76{
72 return currentState; 77 return currentState;
73} 78}
74 79
75void KRFBLogin::gotServerVersion() 80void KRFBLogin::gotServerVersion()
76{ 81{
77 qWarning( "Got server version" ); 82 owarn << "Got server version" << oendl;
78 83
79 disconnect( con, SIGNAL( gotEnoughData() ), 84 disconnect( con, SIGNAL( gotEnoughData() ),
80 this, SLOT( gotServerVersion() ) ); 85 this, SLOT( gotServerVersion() ) );
81 86
82 // Read the server's version message 87 // Read the server's version message
83 char serverVersion[ ServerVersionLength + 1 ]; 88 char serverVersion[ ServerVersionLength + 1 ];
84 con->read( serverVersion, ServerVersionLength ); 89 con->read( serverVersion, ServerVersionLength );
85 serverVersion[ ServerVersionLength ] = '\0'; 90 serverVersion[ ServerVersionLength ] = '\0';
86 91
87 QCString rfbString( serverVersion, ServerVersionLength + 1 ); 92 QCString rfbString( serverVersion, ServerVersionLength + 1 );
88 versionString = rfbString; 93 versionString = rfbString;
89 94
90 QRegExp regexp( "RFB [0-9][0-9][0-9]\\.[0-9][0-9][0-9]\n" ); 95 QRegExp regexp( "RFB [0-9][0-9][0-9]\\.[0-9][0-9][0-9]\n" );
91 96
92 if ( rfbString.find( regexp ) == -1 ) { 97 if ( rfbString.find( regexp ) == -1 ) {
93 static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString ); 98 static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString );
94 99
95 qWarning( msg ); 100 owarn << msg << oendl;
96 emit error( msg ); 101 emit error( msg );
97 currentState = Error; 102 currentState = Error;
98 return; 103 return;
99 } 104 }
100 105
101 // Calculate the actual version number 106 // Calculate the actual version number
102 serverMajor = (serverVersion[4] - '0') * 100 107 serverMajor = (serverVersion[4] - '0') * 100
103 + (serverVersion[5] - '0') * 10 108 + (serverVersion[5] - '0') * 10
104 + (serverVersion[6] - '0'); 109 + (serverVersion[6] - '0');
105 serverMinor = (serverVersion[8] - '0') * 100 110 serverMinor = (serverVersion[8] - '0') * 100
106 + (serverVersion[9] - '0') * 10 111 + (serverVersion[9] - '0') * 10
107 + (serverVersion[10] - '0'); 112 + (serverVersion[10] - '0');
108 113
109 qWarning("Server Version: %03d.%03d", serverMajor, serverMinor ); 114 owarn << "Server Version: " << serverMajor << "." << serverMinor << "" << oendl;
110 115
111 if ( serverMajor != 3 ) { 116 if ( serverMajor != 3 ) {
112 QString msg = tr( "Error: Unsupported server version, %1" ) 117 QString msg = tr( "Error: Unsupported server version, %1" )
113 .arg( rfbString ); 118 .arg( rfbString );
114 119
115 qWarning( msg ); 120 owarn << msg << oendl;
116 emit error( msg ); 121 emit error( msg );
117 currentState = Error; 122 currentState = Error;
118 return; 123 return;
119 } 124 }
120 125
121 if ( serverMinor != 3 ) { 126 if ( serverMinor != 3 ) {
122 qWarning( "Minor version mismatch: %d", serverMinor ); 127 owarn << "Minor version mismatch: " << serverMinor << "" << oendl;
123 } 128 }
124 129
125 // Setup for the next state 130 // Setup for the next state
126 sendClientVersion(); 131 sendClientVersion();
127 132
128 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthScheme() ) ); 133 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthScheme() ) );
129 con->waitForData( AuthSchemeLength ); 134 con->waitForData( AuthSchemeLength );
130} 135}
131 136
132void KRFBLogin::gotAuthScheme() 137void KRFBLogin::gotAuthScheme()
133{ 138{
134 disconnect( con, SIGNAL( gotEnoughData() ), 139 disconnect( con, SIGNAL( gotEnoughData() ),
135 this, SLOT( gotAuthScheme() ) ); 140 this, SLOT( gotAuthScheme() ) );
136 141
137 // Got data 142 // Got data
138 CARD32 scheme; 143 CARD32 scheme;
139 con->read( &scheme, AuthSchemeLength ); 144 con->read( &scheme, AuthSchemeLength );
140 scheme = Swap32IfLE( scheme ); 145 scheme = Swap32IfLE( scheme );
141 146
142 static QString statusMsgOk = tr( "Logged in" ); 147 static QString statusMsgOk = tr( "Logged in" );
143 148
144 switch ( scheme ) { 149 switch ( scheme ) {
145 case 0: 150 case 0:
146 qWarning( "Failed" ); 151 owarn << "Failed" << oendl;
147 // Handle failure 152 // Handle failure
148 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotFailureReasonSize() ) ); 153 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotFailureReasonSize() ) );
149 con->waitForData( FailureReasonSizeLength ); 154 con->waitForData( FailureReasonSizeLength );
150 break; 155 break;
151 case 1: 156 case 1:
152 // Handle no auth 157 // Handle no auth
153 emit status( statusMsgOk ); 158 emit status( statusMsgOk );
154 con->gotRFBConnection(); 159 con->gotRFBConnection();
155 break; 160 break;
156 case 2: 161 case 2:
157 // Handle VNC auth 162 // Handle VNC auth
158 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotChallenge() ) ); 163 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotChallenge() ) );
159 con->waitForData( ChallengeLength ); 164 con->waitForData( ChallengeLength );
160 break; 165 break;
161 default: 166 default:
162 qWarning( "Unknown authentication scheme, 0x%08lx", scheme ); 167 owarn << "Unknown authentication scheme, 0x" << scheme << "" << oendl;
163 currentState = Error; 168 currentState = Error;
164 break; 169 break;
165 }; 170 };
166} 171}
167 172
168void KRFBLogin::gotChallenge() 173void KRFBLogin::gotChallenge()
169{ 174{
170 disconnect( con, SIGNAL( gotEnoughData() ), 175 disconnect( con, SIGNAL( gotEnoughData() ),
171 this, SLOT( gotChallenge() ) ); 176 this, SLOT( gotChallenge() ) );
172 177
173 QTimer::singleShot( 0, this, SLOT(getPassword()) ); 178 QTimer::singleShot( 0, this, SLOT(getPassword()) );
174} 179}
175 180
176void KRFBLogin::getPassword() 181void KRFBLogin::getPassword()
177{ 182{
178 // Got data 183 // Got data
179 CARD8 challenge[ ChallengeLength ]; 184 CARD8 challenge[ ChallengeLength ];
180 con->read( challenge, ChallengeLength ); 185 con->read( challenge, ChallengeLength );
181 186
182 // Last chance to enter a password 187 // Last chance to enter a password
183 if ( con->options_->password.isNull() ) { 188 if ( con->options_->password.isNull() ) {
184 qWarning( "krfblogin needs a password" ); 189 owarn << "krfblogin needs a password" << oendl;
185 emit passwordRequired( con ); 190 emit passwordRequired( con );
186 } 191 }
187 192
188 if ( con->options_->password.isNull() ) { 193 if ( con->options_->password.isNull() ) {
189 QString msg = tr( "Error: This server requires a password, but none " 194 QString msg = tr( "Error: This server requires a password, but none "
190 "has been specified.\n" ); 195 "has been specified.\n" );
191 196
192 emit error( msg ); 197 emit error( msg );
193 return; 198 return;
194 } 199 }
195 200
196 vncEncryptBytes( (unsigned char *) challenge, QCString(con->options_->password.latin1()).data() ); 201 vncEncryptBytes( (unsigned char *) challenge, QCString(con->options_->password.latin1()).data() );
@@ -207,47 +212,47 @@ void KRFBLogin::gotFailureReasonSize()
207} 212}
208 213
209void KRFBLogin::gotAuthResult() 214void KRFBLogin::gotAuthResult()
210{ 215{
211 // Got data 216 // Got data
212 disconnect( con, SIGNAL( gotEnoughData() ), this, 217 disconnect( con, SIGNAL( gotEnoughData() ), this,
213 SLOT( gotAuthResult() ) ); 218 SLOT( gotAuthResult() ) );
214 219
215 long result; 220 long result;
216 con->read( &result, AuthResultLength ); 221 con->read( &result, AuthResultLength );
217 result = Swap32IfLE( result ); 222 result = Swap32IfLE( result );
218 223
219 qWarning( "Authentication Result is 0x%08lx", result ); 224 owarn << "Authentication Result is 0x" << result << "" << oendl;
220 225
221 static QString failed = tr( "Error: The password you specified was incorrect." ); 226 static QString failed = tr( "Error: The password you specified was incorrect." );
222 static QString tooMany = tr( "Error: Too many invalid login attempts have been made\n" 227 static QString tooMany = tr( "Error: Too many invalid login attempts have been made\n"
223 "to this account, please try later." ); 228 "to this account, please try later." );
224 229
225 static QString statusMsgOk = tr( "Logged in" ); 230 static QString statusMsgOk = tr( "Logged in" );
226 static QString statusMsgFailed = tr( "Login Failed" ); 231 static QString statusMsgFailed = tr( "Login Failed" );
227 static QString statusMsgTooMany = tr( "Too many failures" ); 232 static QString statusMsgTooMany = tr( "Too many failures" );
228 233
229 switch( result ) { 234 switch( result ) {
230 case AuthOk: 235 case AuthOk:
231 emit status( statusMsgOk ); 236 emit status( statusMsgOk );
232 con->gotRFBConnection(); 237 con->gotRFBConnection();
233 break; 238 break;
234 case AuthFailed: 239 case AuthFailed:
235 qWarning( "Dammit" ); 240 owarn << "Dammit" << oendl;
236 emit status( statusMsgFailed ); 241 emit status( statusMsgFailed );
237 emit error( failed ); 242 emit error( failed );
238 break; 243 break;
239 case AuthTooMany: 244 case AuthTooMany:
240 emit status( statusMsgTooMany ); 245 emit status( statusMsgTooMany );
241 emit error( tooMany ); 246 emit error( tooMany );
242 break; 247 break;
243 default: 248 default:
244 qWarning( "Invalid authentication result, %lx", result ); 249 owarn << "Invalid authentication result, " << result << "" << oendl;
245 break; 250 break;
246 } 251 }
247} 252}
248 253
249void KRFBLogin::sendClientVersion() 254void KRFBLogin::sendClientVersion()
250{ 255{
251 qWarning( "Sending client version" ); 256 owarn << "Sending client version" << oendl;
252 con->write( (void*)"RFB 003.003\n", ClientVersionLength ); 257 con->write( (void*)"RFB 003.003\n", ClientVersionLength );
253} 258}
diff --git a/noncore/comm/keypebble/kvncbookmarkdlg.cpp b/noncore/comm/keypebble/kvncbookmarkdlg.cpp
index ef2fa12..149c398 100644
--- a/noncore/comm/keypebble/kvncbookmarkdlg.cpp
+++ b/noncore/comm/keypebble/kvncbookmarkdlg.cpp
@@ -1,17 +1,23 @@
1#include "kvncbookmarkdlg.h"
2
3/* OPIE */
4#include <opie2/odebug.h>
5#include <qpe/global.h>
6using namespace Opie::Core;
7
8/* QT */
1#include <qdir.h> 9#include <qdir.h>
2#include <qtextstream.h> 10#include <qtextstream.h>
3#include <qlistbox.h> 11#include <qlistbox.h>
4#include <qpe/global.h>
5#include "kvncbookmarkdlg.h"
6 12
7KVNCBookmarkDlg::KVNCBookmarkDlg( QWidget * parent, const char * name, WFlags f ) 13KVNCBookmarkDlg::KVNCBookmarkDlg( QWidget * parent, const char * name, WFlags f )
8 14
9: KVNCBookmarkDlgBase( parent, name,f) 15: KVNCBookmarkDlgBase( parent, name,f)
10{ 16{
11 readBookmarks(); 17 readBookmarks();
12 refresh(); 18 refresh();
13 19
14} 20}
15 21
16KVNCBookmarkDlg::~KVNCBookmarkDlg() 22KVNCBookmarkDlg::~KVNCBookmarkDlg()
17{ 23{
@@ -166,25 +172,25 @@ void KVNCBookmarkDlg::writeBookmarks(void)
166 QFile f(filename); 172 QFile f(filename);
167 173
168 QString key, val; 174 QString key, val;
169 KRFBServer * server=0; 175 KRFBServer * server=0;
170 176
171 if ( f.open(IO_ReadWrite) ) { 177 if ( f.open(IO_ReadWrite) ) {
172 QTextStream t( &f ); 178 QTextStream t( &f );
173 QString s; 179 QString s;
174 int n = 1; 180 int n = 1;
175 KRFBServer *server; 181 KRFBServer *server;
176 182
177 for ( server=servers.first(); server != 0; server=servers.next() ) { 183 for ( server=servers.first(); server != 0; server=servers.next() ) {
178 qDebug(server->name); 184 odebug << server->name << oendl;
179 t << "server=" << server->name << '\n'; 185 t << "server=" << server->name << '\n';
180 t << "\thostname=" << server->hostname << '\n'; 186 t << "\thostname=" << server->hostname << '\n';
181 t << "\tpassword=" << encipher(server->password )<< '\n'; 187 t << "\tpassword=" << encipher(server->password )<< '\n';
182 t << "\tdisplay=" << server->display << '\n'; 188 t << "\tdisplay=" << server->display << '\n';
183 t << "\thextile=" << server->hexTile << '\n'; 189 t << "\thextile=" << server->hexTile << '\n';
184 t << "\tcorre=" << server->corre << '\n'; 190 t << "\tcorre=" << server->corre << '\n';
185 t << "\trre=" << server->rre << '\n'; 191 t << "\trre=" << server->rre << '\n';
186 t << "\tcopyrect=" << server->copyrect << '\n'; 192 t << "\tcopyrect=" << server->copyrect << '\n';
187 t << "\tshared=" << server->shared << '\n'; 193 t << "\tshared=" << server->shared << '\n';
188 t << "\treadonly=" << server->readOnly << '\n'; 194 t << "\treadonly=" << server->readOnly << '\n';
189 t << "\tdeiconify=" << server->deIconify << '\n'; 195 t << "\tdeiconify=" << server->deIconify << '\n';
190 t << "\tupdaterate=" << server->updateRate << '\n'; 196 t << "\tupdaterate=" << server->updateRate << '\n';
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp
index 51020a0..bdb1c78 100644
--- a/noncore/games/backgammon/backgammon.cpp
+++ b/noncore/games/backgammon/backgammon.cpp
@@ -1,48 +1,52 @@
1#include "backgammon.h" 1#include "backgammon.h"
2
3#include "aidialog.h" 2#include "aidialog.h"
4#include "filedialog.h" 3#include "filedialog.h"
5#include "playerdialog.h" 4#include "playerdialog.h"
6#include "rulesdialog.h" 5#include "rulesdialog.h"
7#include "themedialog.h" 6#include "themedialog.h"
8 7
8/* OPIE */
9#include <opie2/odebug.h>
10#include <qpe/qpeapplication.h>
11#include <qpe/config.h>
12#include <qpe/resource.h>
13using namespace Opie::Core;
14
15/* QT */
9#include <qfile.h> 16#include <qfile.h>
10#include <qlayout.h> 17#include <qlayout.h>
11#include <qmessagebox.h> 18#include <qmessagebox.h>
12#include <qtimer.h> 19#include <qtimer.h>
13#include <qpe/qpeapplication.h>
14#include <qpe/config.h>
15#include <qmenubar.h> 20#include <qmenubar.h>
16#include <qpe/resource.h>
17 21
18#include <stdlib.h> 22#include <stdlib.h>
19 23
20 24
21BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) 25BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
22 : QMainWindow(parent, name, fl) 26 : QMainWindow(parent, name, fl)
23{ 27{
24 if (!name) setName("BackGammon"); 28 if (!name) setName("BackGammon");
25 setCaption(tr( "Backgammon") ); 29 setCaption(tr( "Backgammon") );
26 setIcon( Resource::loadPixmap( "backgammon" ) ); 30 setIcon( Resource::loadPixmap( "backgammon" ) );
27 //general counter varaible 31 //general counter varaible
28 int a=0; 32 int a=0;
29 //the game engine 33 //the game engine
30 move=new MoveEngine(); 34 move=new MoveEngine();
31 35
32 //load the default theme 36 //load the default theme
33 Config conf("backgammon"); 37 Config conf("backgammon");
34 if(!conf.isValid()) 38 if(!conf.isValid())
35 { 39 {
36 qDebug("config file does not exist"); 40 odebug << "config file does not exist" << oendl;
37 conf.setGroup("general"); 41 conf.setGroup("general");
38 conf.writeEntry("theme","default"); 42 conf.writeEntry("theme","default");
39 conf.setGroup("rules"); 43 conf.setGroup("rules");
40 conf.writeEntry("move_with_pieces_out",false); 44 conf.writeEntry("move_with_pieces_out",false);
41 conf.writeEntry("nice_dice",false); 45 conf.writeEntry("nice_dice",false);
42 conf.setGroup("display"); 46 conf.setGroup("display");
43 conf.writeEntry("small",false); 47 conf.writeEntry("small",false);
44 conf.writeEntry("warning",true); 48 conf.writeEntry("warning",true);
45 conf.setGroup("ai"); 49 conf.setGroup("ai");
46 conf.writeEntry("rescue",6); 50 conf.writeEntry("rescue",6);
47 conf.writeEntry("eliminate",4); 51 conf.writeEntry("eliminate",4);
48 conf.writeEntry("expose",1); 52 conf.writeEntry("expose",1);
@@ -69,25 +73,25 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
69 ai.eliminate=conf.readNumEntry("eliminate",4); 73 ai.eliminate=conf.readNumEntry("eliminate",4);
70 ai.expose=conf.readNumEntry("expose",1); 74 ai.expose=conf.readNumEntry("expose",1);
71 ai.protect=conf.readNumEntry("protect",5); 75 ai.protect=conf.readNumEntry("protect",5);
72 ai.safe=conf.readNumEntry("safe",3); 76 ai.safe=conf.readNumEntry("safe",3);
73 ai.empty=conf.readNumEntry("empty",2); 77 ai.empty=conf.readNumEntry("empty",2);
74 move->setAISettings(ai); 78 move->setAISettings(ai);
75 79
76 80
77 //get the theme component names 81 //get the theme component names
78 Config theme(theme_file,Config::File); 82 Config theme(theme_file,Config::File);
79 if(!theme.isValid()) 83 if(!theme.isValid())
80 { 84 {
81 qDebug("theme file does not exist"); 85 odebug << "theme file does not exist" << oendl;
82 theme.setGroup("theme"); 86 theme.setGroup("theme");
83 theme.writeEntry("board","casino_board_1"); 87 theme.writeEntry("board","casino_board_1");
84 theme.writeEntry("pieces1","casino_pieces_blue"); 88 theme.writeEntry("pieces1","casino_pieces_blue");
85 theme.writeEntry("pieces2","casino_pieces_white"); 89 theme.writeEntry("pieces2","casino_pieces_white");
86 theme.writeEntry("dice1","casino_dice"); 90 theme.writeEntry("dice1","casino_dice");
87 theme.writeEntry("dice2","casino_dice"); 91 theme.writeEntry("dice2","casino_dice");
88 theme.writeEntry("table","casino_table_green"); 92 theme.writeEntry("table","casino_table_green");
89 theme.writeEntry("odds","casino_odds"); 93 theme.writeEntry("odds","casino_odds");
90 } 94 }
91 theme.setGroup("theme"); 95 theme.setGroup("theme");
92 board_name=theme.readEntry("board","casino_board_1"); 96 board_name=theme.readEntry("board","casino_board_1");
93 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue"); 97 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue");
diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp
index 7de7147..a4145cc 100644
--- a/noncore/games/backgammon/moveengine.cpp
+++ b/noncore/games/backgammon/moveengine.cpp
@@ -448,25 +448,25 @@ int MoveEngine::getPossibleMoves()
448 } 448 }
449 449
450 int total=0; 450 int total=0;
451 for(int field=0;field<26;field++) 451 for(int field=0;field<26;field++)
452 { 452 {
453 total+=moves[field].weight[0]+moves[field].weight[1]+moves[field].weight[2]+moves[field].weight[3]; 453 total+=moves[field].weight[0]+moves[field].weight[1]+moves[field].weight[2]+moves[field].weight[3];
454 } 454 }
455 return total; 455 return total;
456} 456}
457 457
458void MoveEngine::move(const int& from, int to, const int& dice) 458void MoveEngine::move(const int& from, int to, const int& dice)
459{ 459{
460 //qDebug("%d moves from %d to %d (%d) with dice %d",player,from,to,to-from,dice); 460 //odebug << "" << player << " moves from " << from << " to " << to << " (" << to-from << ") with dice " << dice << "" << oendl;
461 461
462 if(player==1 && to==25) 462 if(player==1 && to==25)
463 to=26; 463 to=26;
464 if(player==2 && to==0) 464 if(player==2 && to==0)
465 to=27; 465 to=27;
466 466
467 //if space is occupied by enemy move pieces to startzone 467 //if space is occupied by enemy move pieces to startzone
468 if(fieldColor(to)==otherplayer) 468 if(fieldColor(to)==otherplayer)
469 { 469 {
470 population[to].total=0; 470 population[to].total=0;
471 if(otherplayer==1) 471 if(otherplayer==1)
472 population[0].total++; 472 population[0].total++;
diff --git a/noncore/games/bounce/bounce.pro b/noncore/games/bounce/bounce.pro
index ba745c8..56a325c 100644
--- a/noncore/games/bounce/bounce.pro
+++ b/noncore/games/bounce/bounce.pro
@@ -1,10 +1,9 @@
1 #CONFIG = qt warn_on 1 CONFIG = qt warn_on quick-app
2 CONFIG = qt warn_on quick-app
3 HEADERS = game.h kbounce.h 2 HEADERS = game.h kbounce.h
4 SOURCES = game.cpp kbounce.cpp main.cpp 3 SOURCES = game.cpp kbounce.cpp main.cpp
5 INCLUDEPATH+= $(OPIEDIR)/include 4 INCLUDEPATH+= $(OPIEDIR)/include
6 DEPENDPATH+= $(OPIEDIR)/include 5 DEPENDPATH+= $(OPIEDIR)/include
7LIBS += -lqpe -lopiecore2 6LIBS += -lqpe -lopiecore2
8 TARGET = bounce 7 TARGET = bounce
9 8
10include ( $(OPIEDIR)/include.pro ) 9include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/games/bounce/game.cpp b/noncore/games/bounce/game.cpp
index 1f1f8cd..bbd3d0b 100644
--- a/noncore/games/bounce/game.cpp
+++ b/noncore/games/bounce/game.cpp
@@ -8,29 +8,36 @@
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public 14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the Free 15 * License along with this program; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */ 17 */
18 18
19 19
20#include <stdlib.h> 20#include "game.h"
21#include <qtimer.h> 21
22/* OPIE */
23#include <opie2/odebug.h>
22#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25using namespace Opie::Core;
23 26
24#include "game.h" 27/* QT */
28#include <qtimer.h>
29
30/* STD */
31#include <stdlib.h>
25 32
26#define TILE_SIZE 9 33#define TILE_SIZE 9
27 34
28#define TILE_FIRST ((FIELD_WIDTH-2)*(FIELD_HEIGHT-2)) 35#define TILE_FIRST ((FIELD_WIDTH-2)*(FIELD_HEIGHT-2))
29#define TILE_FREE (TILE_FIRST + 0) 36#define TILE_FREE (TILE_FIRST + 0)
30#define TILE_BORDER (TILE_FIRST + 1) 37#define TILE_BORDER (TILE_FIRST + 1)
31#define TILE_WALLEND (TILE_FIRST + 2) 38#define TILE_WALLEND (TILE_FIRST + 2)
32#define TILE_WALLUP (TILE_FIRST + 3) 39#define TILE_WALLUP (TILE_FIRST + 3)
33#define TILE_WALLDOWN (TILE_FIRST + 4) 40#define TILE_WALLDOWN (TILE_FIRST + 4)
34#define TILE_WALLLEFT (TILE_FIRST + 5) 41#define TILE_WALLLEFT (TILE_FIRST + 5)
35#define TILE_WALLRIGHT (TILE_FIRST + 6) 42#define TILE_WALLRIGHT (TILE_FIRST + 6)
36 43
@@ -358,25 +365,25 @@ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
358} 365}
359 366
360JezzGame::~JezzGame() 367JezzGame::~JezzGame()
361{ 368{
362 m_balls.clear(); 369 m_balls.clear();
363 delete m_view; 370 delete m_view;
364 delete m_field; 371 delete m_field;
365 delete m_ballPixmaps; 372 delete m_ballPixmaps;
366} 373}
367 374
368void JezzGame::display( QString text, int size ) 375void JezzGame::display( QString text, int size )
369{ 376{
370 qDebug("This function \"display\" shouldn't be called!!!"); 377 odebug << "This function \"display\" shouldn't be called!!!" << oendl;
371 if ( !text.isEmpty() ) 378 if ( !text.isEmpty() )
372 { 379 {
373 QFont font( "Helvetica", size, QFont::Bold ); 380 QFont font( "Helvetica", size, QFont::Bold );
374 font.setStyleHint( QFont::Helvetica ); 381 font.setStyleHint( QFont::Helvetica );
375 m_text->setFont( font ); 382 m_text->setFont( font );
376 m_text->setText( text ); 383 m_text->setText( text );
377 384
378 QRect size = m_text->boundingRect(); 385 QRect size = m_text->boundingRect();
379 m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2, 386 m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2,
380 ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 ); 387 ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 );
381 388
382 m_text->show(); 389 m_text->show();
diff --git a/noncore/games/go/go.pro b/noncore/games/go/go.pro
index b73bbb0..72425a5 100644
--- a/noncore/games/go/go.pro
+++ b/noncore/games/go/go.pro
@@ -1,19 +1,18 @@
1 CONFIG = qt warn_on quick-app 1 CONFIG = qt warn_on quick-app
2 HEADERS = amigo.h \ 2 HEADERS = amigo.h \
3 go.h \ 3 go.h \
4 goplayutils.h \ 4 goplayutils.h \
5 gowidget.h 5 gowidget.h
6 SOURCES = amigo.c \ 6 SOURCES = amigo.c \
7 goplayer.c \ 7 goplayer.c \
8 goplayutils.c \ 8 goplayutils.c \
9 killable.c \ 9 killable.c \
10 gowidget.cpp \ 10 gowidget.cpp \
11 main.cpp 11 main.cpp
12INCLUDEPATH += $(OPIEDIR)/include 12INCLUDEPATH += $(OPIEDIR)/include
13 DEPENDPATH+= $(OPIEDIR)/include 13 DEPENDPATH+= $(OPIEDIR)/include
14LIBS += -lqpe -lopiecore2 14LIBS += -lqpe -lopiecore2
15 TARGET = go 15 TARGET = go
16 16
17 17
18
19include ( $(OPIEDIR)/include.pro ) 18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp
index d134540..ec03c1d 100644
--- a/noncore/games/go/gowidget.cpp
+++ b/noncore/games/go/gowidget.cpp
@@ -11,37 +11,38 @@
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 "gowidget.h" 21#include "gowidget.h"
22 22
23/* OPIE */
24#include <opie2/odebug.h>
23#include <qpe/config.h> 25#include <qpe/config.h>
24#include <qpe/resource.h> 26#include <qpe/resource.h>
27using namespace Opie::Core;
25 28
29/* QT */
26#include <qpainter.h> 30#include <qpainter.h>
27#include <qtoolbar.h> 31#include <qtoolbar.h>
28#include <qmenubar.h> 32#include <qmenubar.h>
29#include <qaction.h> 33#include <qaction.h>
30#include <qapplication.h> //processEvents() 34#include <qapplication.h> //processEvents()
31#include <qlabel.h> 35#include <qlabel.h>
32 36
33//#include <stdio.h>
34
35
36static const enum bVal computer_color = BLACK; 37static const enum bVal computer_color = BLACK;
37 38
38static int current_handicap = 1; 39static int current_handicap = 1;
39 40
40static QBrush *goBrush; 41static QBrush *goBrush;
41//static QImage *newBlackStone; 42//static QImage *newBlackStone;
42//static QImage *blackStone; 43//static QImage *blackStone;
43//static QImage *whiteStone; 44//static QImage *whiteStone;
44static QPixmap *newBlackStone; 45static QPixmap *newBlackStone;
45static QPixmap *blackStone; 46static QPixmap *blackStone;
46static QPixmap *whiteStone; 47static QPixmap *whiteStone;
47 48
@@ -439,22 +440,22 @@ extern "C" {
439 voidremovestone(short x, short y) 440 voidremovestone(short x, short y)
440{ 441{
441 GoWidget::self->removeStone(x,y); 442 GoWidget::self->removeStone(x,y);
442} 443}
443 444
444 voidplacestone (enum bVal c, short x, short y ) 445 voidplacestone (enum bVal c, short x, short y )
445{ 446{
446 GoWidget::self->placeStone(c,x,y); 447 GoWidget::self->placeStone(c,x,y);
447} 448}
448 449
449 voidintrMoveReport(enum bVal c ,char *coord ,char *reason ) 450 voidintrMoveReport(enum bVal c ,char *coord ,char *reason )
450{ 451{
451 qDebug( "intrMoveReport colour %d, %s %s", c, coord, reason ); 452 odebug << "intrMoveReport colour " << c << ", " << coord << " " << reason << "" << oendl;
452} 453}
453 454
454 voidintrPrisonerReport( short blackcnt, short whitecnt ) 455 voidintrPrisonerReport( short blackcnt, short whitecnt )
455{ 456{
456 GoWidget::self->reportPrisoners(blackcnt,whitecnt); 457 GoWidget::self->reportPrisoners(blackcnt,whitecnt);
457} 458}
458 459
459} 460}
460 461
diff --git a/noncore/games/kpacman/kpacman.pro b/noncore/games/kpacman/kpacman.pro
index 8453f78..45314f9 100644
--- a/noncore/games/kpacman/kpacman.pro
+++ b/noncore/games/kpacman/kpacman.pro
@@ -1,16 +1,14 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 #CONFIG = qt warn_on
3 CONFIG = qt warn_on 2 CONFIG = qt warn_on
4 #TMAKE_CXXFLAGS+=
5 HEADERS = kpacmanwidget.h \ 3 HEADERS = kpacmanwidget.h \
6 referee.h \ 4 referee.h \
7 status.h \ 5 status.h \
8 painter.h \ 6 painter.h \
9 score.h \ 7 score.h \
10 pacman.h \ 8 pacman.h \
11 monster.h \ 9 monster.h \
12 keys.h \ 10 keys.h \
13 fruit.h \ 11 fruit.h \
14 energizer.h \ 12 energizer.h \
15 board.h \ 13 board.h \
16 bitfont.h \ 14 bitfont.h \
@@ -25,17 +23,17 @@ SOURCES = kpacmanwidget.cpp \
25 score.cpp \ 23 score.cpp \
26 pacman.cpp \ 24 pacman.cpp \
27 monster.cpp \ 25 monster.cpp \
28 keys.cpp \ 26 keys.cpp \
29 fruit.cpp \ 27 fruit.cpp \
30 energizer.cpp \ 28 energizer.cpp \
31 board.cpp \ 29 board.cpp \
32 bitfont.cpp \ 30 bitfont.cpp \
33 kpacman.cpp \ 31 kpacman.cpp \
34 main.cpp 32 main.cpp
35 INCLUDEPATH+= $(OPIEDIR)/include 33 INCLUDEPATH+= $(OPIEDIR)/include
36 DEPENDPATH+= $(OPIEDIR)/include 34 DEPENDPATH+= $(OPIEDIR)/include
37LIBS += -lqpe 35LIBS += -lqpe -lopiecore2
38DESTDIR = $(OPIEDIR)/bin 36DESTDIR = $(OPIEDIR)/bin
39 TARGET = kpacman 37 TARGET = kpacman
40 38
41include ( $(OPIEDIR)/include.pro ) 39include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/games/kpacman/kpacmanwidget.cpp b/noncore/games/kpacman/kpacmanwidget.cpp
index 9631495..b59dd02 100644
--- a/noncore/games/kpacman/kpacmanwidget.cpp
+++ b/noncore/games/kpacman/kpacmanwidget.cpp
@@ -4,25 +4,26 @@
4#if defined( KDE2_PORT ) 4#if defined( KDE2_PORT )
5#include <kapp.h> 5#include <kapp.h>
6#include <kconfig.h> 6#include <kconfig.h>
7#include <kstddirs.h> 7#include <kstddirs.h>
8#include <kpacmanwidget.h> 8#include <kpacmanwidget.h>
9#include <kpacmanwidget.moc> 9#include <kpacmanwidget.moc>
10#elif defined( QPE_PORT ) 10#elif defined( QPE_PORT )
11#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
12#include <qpe/config.h> 12#include <qpe/config.h>
13#include "kpacmanwidget.h" 13#include "kpacmanwidget.h"
14#endif 14#endif
15 15
16 16#include <opie2/odebug.h>
17using namespace Opie::Core;
17 18
18KpacmanWidget::KpacmanWidget( QWidget *parent, const char *name) 19KpacmanWidget::KpacmanWidget( QWidget *parent, const char *name)
19 : QWidget( parent, name ) 20 : QWidget( parent, name )
20{ 21{
21 score = 0l; 22 score = 0l;
22 referee = 0l; 23 referee = 0l;
23 status = 0l; 24 status = 0l;
24 bitfont = NULL; 25 bitfont = NULL;
25 fontName = ""; 26 fontName = "";
26 27
27 scheme = mode = -1; 28 scheme = mode = -1;
28 confScheme(); 29 confScheme();
@@ -130,24 +131,24 @@ void KpacmanWidget::setScheme(int Scheme, int Mode)
130 131
131 score->setScheme(Scheme, Mode, bitfont); 132 score->setScheme(Scheme, Mode, bitfont);
132 referee->setScheme(Scheme, Mode, bitfont); 133 referee->setScheme(Scheme, Mode, bitfont);
133 status->setScheme(Scheme, Mode); 134 status->setScheme(Scheme, Mode);
134 135
135 score->repaint(FALSE); 136 score->repaint(FALSE);
136 referee->repaint(FALSE); 137 referee->repaint(FALSE);
137 status->repaint(FALSE); 138 status->repaint(FALSE);
138} 139}
139 140
140void KpacmanWidget::resizeEvent( QResizeEvent * ) 141void KpacmanWidget::resizeEvent( QResizeEvent * )
141{ 142{
142 qWarning("Resize"); 143 owarn << "Resize" << oendl;
143 referee->setGeometry(0, bitfont->height()*3, referee->width(), referee->height()); 144 referee->setGeometry(0, bitfont->height()*3, referee->width(), referee->height());
144 referee->setBackgroundColor(BLACK); 145 referee->setBackgroundColor(BLACK);
145 146
146 if(!status ) return; 147 if(!status ) return;
147 status->setGeometry(0, bitfont->height()*3+referee->height(), referee->width(), 148 status->setGeometry(0, bitfont->height()*3+referee->height(), referee->width(),
148 status->height()); 149 status->height());
149 status->setBackgroundColor(BLACK); 150 status->setBackgroundColor(BLACK);
150 151
151 score->setGeometry(0, 0, referee->width(), bitfont->height()*3+referee->height()+status->height()); 152 score->setGeometry(0, 0, referee->width(), bitfont->height()*3+referee->height()+status->height());
152 score->setBackgroundColor(BLACK); 153 score->setBackgroundColor(BLACK);
153} 154}
diff --git a/noncore/games/kpacman/status.cpp b/noncore/games/kpacman/status.cpp
index 02ff63d..db6938e 100644
--- a/noncore/games/kpacman/status.cpp
+++ b/noncore/games/kpacman/status.cpp
@@ -4,32 +4,35 @@
4#if defined( KDE2_PORT ) 4#if defined( KDE2_PORT )
5#include <kapp.h> 5#include <kapp.h>
6#include <klocale.h> 6#include <klocale.h>
7#include <kstddirs.h> 7#include <kstddirs.h>
8#include <status.h> 8#include <status.h>
9#include <status.moc> 9#include <status.moc>
10#elif defined( QPE_PORT ) 10#elif defined( QPE_PORT )
11#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
12#include <qpe/config.h> 12#include <qpe/config.h>
13#include "status.h" 13#include "status.h"
14#endif 14#endif
15 15
16#include <opie2/odebug.h>
17using namespace Opie::Core;
18
16#include <qbitmap.h> 19#include <qbitmap.h>
17#include <qmsgbox.h> 20#include <qmsgbox.h>
18#include <qfileinfo.h> 21#include <qfileinfo.h>
19 22
20Status::Status( QWidget *parent, const char *name, int Scheme, int Mode ) : 23Status::Status( QWidget *parent, const char *name, int Scheme, int Mode ) :
21 QWidget( parent, name ) 24 QWidget( parent, name )
22{ 25{
23 qWarning("Status::Status"); 26 owarn << "Status::Status" << oendl;
24 actualLifes = 0; 27 actualLifes = 0;
25 actualLevel = 0; 28 actualLevel = 0;
26 29
27 lifesPix = NULL; 30 lifesPix = NULL;
28 levelPix = NULL; 31 levelPix = NULL;
29 32
30 scheme = Scheme; 33 scheme = Scheme;
31 mode = Mode; 34 mode = Mode;
32 level = 0; 35 level = 0;
33 36
34 confScheme(); 37 confScheme();
35} 38}
diff --git a/noncore/games/mindbreaker/mindbreaker.cpp b/noncore/games/mindbreaker/mindbreaker.cpp
index 2b924c6..1f554d2 100644
--- a/noncore/games/mindbreaker/mindbreaker.cpp
+++ b/noncore/games/mindbreaker/mindbreaker.cpp
@@ -81,25 +81,25 @@ static void setupBoardSize(int w, int h)
81 // looks a bit dodgy on larger sizes (still does though, but not as much...) 81 // looks a bit dodgy on larger sizes (still does though, but not as much...)
82 if ( adjusted_answerpeg_size > 22 ) 82 if ( adjusted_answerpeg_size > 22 )
83 adjusted_answerpeg_size = 22; 83 adjusted_answerpeg_size = 22;
84 84
85 adjusted_answerpegx = adjusted_panel_width * 159/180 - adjusted_answerpeg_size/2; 85 adjusted_answerpegx = adjusted_panel_width * 159/180 - adjusted_answerpeg_size/2;
86 adjusted_answerpegy = adjusted_panel_height/3 - adjusted_answerpeg_size/2; 86 adjusted_answerpegy = adjusted_panel_height/3 - adjusted_answerpeg_size/2;
87 adjusted_answerpeg_xdiff = adjusted_panel_width * 10/180; 87 adjusted_answerpeg_xdiff = adjusted_panel_width * 10/180;
88 adjusted_answerpeg_ydiff = adjusted_panel_height * 9/25; 88 adjusted_answerpeg_ydiff = adjusted_panel_height * 9/25;
89 89
90 adjusted_board_height = adjusted_title_height + (adjusted_panel_height * 9); 90 adjusted_board_height = adjusted_title_height + (adjusted_panel_height * 9);
91 adjusted_board_width = adjusted_panel_width + (adjusted_bin_margin * 2) + adjusted_peg_size; 91 adjusted_board_width = adjusted_panel_width + (adjusted_bin_margin * 2) + adjusted_peg_size;
92 92
93// qDebug("Adjusted width %d height %d", adjusted_board_width, adjusted_board_height); 93// odebug << "Adjusted width " << adjusted_board_width << " height " << adjusted_board_height << "" << oendl;
94} 94}
95 95
96 96
97/* helper class, */ 97/* helper class, */
98class Peg : public QCanvasRectangle 98class Peg : public QCanvasRectangle
99{ 99{
100public: 100public:
101 Peg(QCanvas *canvas, int type, int go = -1, int pos = -1); 101 Peg(QCanvas *canvas, int type, int go = -1, int pos = -1);
102 int rtti() const {return pegRTTI; } 102 int rtti() const {return pegRTTI; }
103 void advance(int phase); 103 void advance(int phase);
104 104
105 bool hit( const QPoint &) const; 105 bool hit( const QPoint &) const;
diff --git a/noncore/games/oyatzee/oyatzee.cpp b/noncore/games/oyatzee/oyatzee.cpp
index a55aa73..27c0a9f 100644
--- a/noncore/games/oyatzee/oyatzee.cpp
+++ b/noncore/games/oyatzee/oyatzee.cpp
@@ -1,19 +1,25 @@
1#include "oyatzee.h" 1#include "oyatzee.h"
2 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
7/* QT */
3#include <qmessagebox.h> 8#include <qmessagebox.h>
4#include <qpushbutton.h> 9#include <qpushbutton.h>
5#include <qpainter.h> 10#include <qpainter.h>
6#include <qlayout.h> 11#include <qlayout.h>
7 12
13/* STD */
8#include <stdlib.h> 14#include <stdlib.h>
9 15
10OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl ) 16OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl )
11{ 17{
12 QWidget *thing = new QWidget( this ); 18 QWidget *thing = new QWidget( this );
13 setCentralWidget( thing ); 19 setCentralWidget( thing );
14 20
15 setCaption( tr( "OYatzee" ) ); 21 setCaption( tr( "OYatzee" ) );
16 22
17 setPlayerNumber( 4 ); 23 setPlayerNumber( 4 );
18 setRoundsNumber( 1 ); 24 setRoundsNumber( 1 );
19 25
@@ -32,25 +38,25 @@ OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow(
32 connect( sb->pb , SIGNAL( item(int) ), this , SLOT( slotEndRound(int) ) ); 38 connect( sb->pb , SIGNAL( item(int) ), this , SLOT( slotEndRound(int) ) );
33 39
34 dw = new DiceWidget( thing , "dw" ); 40 dw = new DiceWidget( thing , "dw" );
35 dw->setMaximumHeight( this->height()/4 ); 41 dw->setMaximumHeight( this->height()/4 );
36 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) ); 42 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) );
37 43
38 vbox->addWidget( sb ); 44 vbox->addWidget( sb );
39 vbox->addWidget( dw ); 45 vbox->addWidget( dw );
40} 46}
41 47
42void OYatzee::slotEndRound( int item ) 48void OYatzee::slotEndRound( int item )
43{ 49{
44 qDebug( "Der User hat Nummer %d ausgewählt" , item ); 50 odebug << "Der User hat Nummer " << item << " ausgewählt" << oendl;
45 51
46 /* 52 /*
47 * if the user clicked on Total, Bonus or Score and thus not on a 53 * if the user clicked on Total, Bonus or Score and thus not on a
48 * selectable item return and do nothing 54 * selectable item return and do nothing
49 */ 55 */
50 if ( item == 7 || item == 8 || item == 16 ) return; 56 if ( item == 7 || item == 8 || item == 16 ) return;
51 57
52 /* 58 /*
53 * check if the user can really click on that item 59 * check if the user can really click on that item
54 */ 60 */
55 if ( posibilities.find( item ) == posibilities.end() ) return; 61 if ( posibilities.find( item ) == posibilities.end() ) return;
56 62
@@ -100,25 +106,25 @@ void OYatzee::slotEndRound( int item )
100 points = 40; 106 points = 40;
101 break; 107 break;
102 case Yatzee: 108 case Yatzee:
103 points = 50; 109 points = 50;
104 break; 110 break;
105 case Chance: 111 case Chance:
106 points = getPoints ( Chance , numbers ); 112 points = getPoints ( Chance , numbers );
107 } 113 }
108 114
109 sb->nextRB(currentPlayer-1)->updateMap( item , points ); 115 sb->nextRB(currentPlayer-1)->updateMap( item , points );
110 nextPlayer(); 116 nextPlayer();
111 117
112 qDebug( "Punkte: %d" , points ); 118 odebug << "Punkte: " << points << "" << oendl;
113} 119}
114 120
115void OYatzee::nextPlayer() 121void OYatzee::nextPlayer()
116{ 122{
117 currentPlayer++; 123 currentPlayer++;
118 124
119 if ( currentPlayer > numOfPlayers ) 125 if ( currentPlayer > numOfPlayers )
120 { 126 {
121 currentPlayer = 1; 127 currentPlayer = 1;
122 } 128 }
123 129
124 ps.at(currentPlayer-1)->turn = 0; 130 ps.at(currentPlayer-1)->turn = 0;
@@ -147,25 +153,25 @@ int OYatzee::getPoints( const int num , QValueListInt l)
147 } 153 }
148 return c; 154 return c;
149 } 155 }
150 } 156 }
151 157
152OYatzee::~OYatzee() 158OYatzee::~OYatzee()
153{ 159{
154} 160}
155 161
156void OYatzee::detectPosibilities() 162void OYatzee::detectPosibilities()
157{ 163{
158 posibilities.clear(); 164 posibilities.clear();
159 qDebug( "running detectPosibilities()" ); 165 odebug << "running detectPosibilities()" << oendl;
160 166
161 Dice *d = dw->diceList.first(); 167 Dice *d = dw->diceList.first();
162 168
163 QValueListInt numbers; 169 QValueListInt numbers;
164 170
165 for ( ; d != 0 ; d = dw->diceList.next() ) 171 for ( ; d != 0 ; d = dw->diceList.next() )
166 { 172 {
167 numbers.append( d->hasValue() ); 173 numbers.append( d->hasValue() );
168 } 174 }
169 175
170 //the 6 numbers 176 //the 6 numbers
171 QValueListInt::Iterator it; 177 QValueListInt::Iterator it;
@@ -252,65 +258,65 @@ void OYatzee::detectPosibilities()
252 posibilities.append( 13 ); 258 posibilities.append( 13 );
253 } 259 }
254 260
255 posibilities.append( 13 ); //Chance, well, this is allways possible 261 posibilities.append( 13 ); //Chance, well, this is allways possible
256 262
257 displayPossibilites(); 263 displayPossibilites();
258} 264}
259 265
260void OYatzee::displayPossibilites() 266void OYatzee::displayPossibilites()
261{ 267{
262 //X for ( QValueListInt::Iterator it = posibilities.begin() ; it != posibilities.end(); ++it ) 268 //X for ( QValueListInt::Iterator it = posibilities.begin() ; it != posibilities.end(); ++it )
263 //X { 269 //X {
264 //X qDebug( QString::number( *it ) ); 270 //X odebug << QString::number( *it ) << oendl;
265 //X switch ( *it ) 271 //X switch ( *it )
266 //X { 272 //X {
267 //X case Ones: 273 //X case Ones:
268 //X qDebug( "1er" ); 274 //X odebug << "1er" << oendl;
269 //X break; 275 //X break;
270 //X case Twos: 276 //X case Twos:
271 //X qDebug( "2er" ); 277 //X odebug << "2er" << oendl;
272 //X break; 278 //X break;
273 //X case Threes: 279 //X case Threes:
274 //X qDebug( "3er" ); 280 //X odebug << "3er" << oendl;
275 //X break; 281 //X break;
276 //X case Fours: 282 //X case Fours:
277 //X qDebug( "4er" ); 283 //X odebug << "4er" << oendl;
278 //X break; 284 //X break;
279 //X case Fives: 285 //X case Fives:
280 //X qDebug( "5er" ); 286 //X odebug << "5er" << oendl;
281 //X break; 287 //X break;
282 //X case Sixes: 288 //X case Sixes:
283 //X qDebug( "6er" ); 289 //X odebug << "6er" << oendl;
284 //X break; 290 //X break;
285 //X case ThreeOfAKind: 291 //X case ThreeOfAKind:
286 //X qDebug( "3oaK" ); 292 //X odebug << "3oaK" << oendl;
287 //X break; 293 //X break;
288 //X case FourOfAKind: 294 //X case FourOfAKind:
289 //X qDebug( "4oaK" ); 295 //X odebug << "4oaK" << oendl;
290 //X break; 296 //X break;
291 //X case FullHouse: 297 //X case FullHouse:
292 //X qDebug( "Full House" ); 298 //X odebug << "Full House" << oendl;
293 //X break; 299 //X break;
294 //X case SStraight: 300 //X case SStraight:
295 //X qDebug( "Short S" ); 301 //X odebug << "Short S" << oendl;
296 //X break; 302 //X break;
297 //X case LStraight: 303 //X case LStraight:
298 //X qDebug( "Long S" ); 304 //X odebug << "Long S" << oendl;
299 //X break; 305 //X break;
300 //X case Yatzee: 306 //X case Yatzee:
301 //X qDebug( "Yatzee!" ); 307 //X odebug << "Yatzee!" << oendl;
302 //X break; 308 //X break;
303 //X case Chance: 309 //X case Chance:
304 //X qDebug( "Chance" ); 310 //X odebug << "Chance" << oendl;
305 //X break; 311 //X break;
306 //X } 312 //X }
307 //X } 313 //X }
308 314
309 sb->pb->setIntlist( posibilities ); 315 sb->pb->setIntlist( posibilities );
310 sb->pb->update(); 316 sb->pb->update();
311} 317}
312 318
313void OYatzee::startGame() 319void OYatzee::startGame()
314{ 320{
315 /* 321 /*
316 * TODO 322 * TODO
@@ -326,45 +332,45 @@ void OYatzee::setPlayerNumber( const int num )
326 332
327void OYatzee::setRoundsNumber( const int num ) 333void OYatzee::setRoundsNumber( const int num )
328{ 334{
329 numOfRounds = num; 335 numOfRounds = num;
330} 336}
331 337
332void OYatzee::slotStartGame() 338void OYatzee::slotStartGame()
333{ 339{
334} 340}
335 341
336void OYatzee::slotRollDices() 342void OYatzee::slotRollDices()
337{ 343{
338 qDebug( "Roll nummer: %d" , ps.at( currentPlayer-1 )->turn ); 344 odebug << "Roll nummer: " << ps.at( currentPlayer-1 )->turn << "" << oendl;
339 345
340 if ( ps.at( currentPlayer-1 )->turn == 3 ) 346 if ( ps.at( currentPlayer-1 )->turn == 3 )
341 { 347 {
342 QMessageBox::information( this, 348 QMessageBox::information( this,
343 "OYatzee", 349 "OYatzee",
344 tr( "Only three rolls per turn allowed." ) ); 350 tr( "Only three rolls per turn allowed." ) );
345 return; 351 return;
346 } 352 }
347 353
348 Dice *d = dw->diceList.first(); 354 Dice *d = dw->diceList.first();
349 355
350 for ( ; d != 0 ; d = dw->diceList.next() ) 356 for ( ; d != 0 ; d = dw->diceList.next() )
351 { 357 {
352 if ( !d->isSelected ) 358 if ( !d->isSelected )
353 d->roll(); 359 d->roll();
354 } 360 }
355 361
356 //qDebug( "Roll nummer (vorher): %d" , ps.at( currentPlayer-1 )->turn ); 362 //odebug << "Roll nummer (vorher): " << ps.at( currentPlayer-1 )->turn << "" << oendl;
357 ps.at(currentPlayer-1)->turn++; 363 ps.at(currentPlayer-1)->turn++;
358 //qDebug( "Roll nummer (nachher): %d" , ps.at( currentPlayer-1 )->turn ); 364 //odebug << "Roll nummer (nachher): " << ps.at( currentPlayer-1 )->turn << "" << oendl;
359 365
360 detectPosibilities(); 366 detectPosibilities();
361} 367}
362 368
363/* 369/*
364 * Scoreboard 370 * Scoreboard
365 */ 371 */
366Scoreboard::Scoreboard( playerList ps, QWidget *parent, const char *name ) : QWidget( parent , name ) 372Scoreboard::Scoreboard( playerList ps, QWidget *parent, const char *name ) : QWidget( parent , name )
367{ 373{
368 ps_ = ps; 374 ps_ = ps;
369 375
370 pb = new Possibilityboard( this , "pb" ); 376 pb = new Possibilityboard( this , "pb" );
@@ -382,25 +388,25 @@ Scoreboard::Scoreboard( playerList ps, QWidget *parent, const char *name ) : QWi
382 for ( ; r != 0 ; r = rbList.next() ) 388 for ( ; r != 0 ; r = rbList.next() )
383 { 389 {
384 hbox->addWidget( r ); 390 hbox->addWidget( r );
385 } 391 }
386} 392}
387 393
388Resultboard* Scoreboard::nextRB( int currentPlayer ) 394Resultboard* Scoreboard::nextRB( int currentPlayer )
389{ 395{
390 Resultboard *b; 396 Resultboard *b;
391 397
392 b = rbList.at( currentPlayer ); 398 b = rbList.at( currentPlayer );
393 399
394 qDebug( "Anzahl: %d" ,rbList.count() ); 400 odebug << "Anzahl: " << rbList.count() << "" << oendl;
395 401
396 return b; 402 return b;
397 } 403 }
398 404
399void Scoreboard::createResultboards(const int num) 405void Scoreboard::createResultboards(const int num)
400{ 406{
401 Player *p = ps_.first(); 407 Player *p = ps_.first();
402 for ( int i = 0 ; i < num ; ++i , p = ps_.next() ) 408 for ( int i = 0 ; i < num ; ++i , p = ps_.next() )
403 { 409 {
404 QString n = p->playerName; 410 QString n = p->playerName;
405 rbList.append( new Resultboard( n , this ) ); 411 rbList.append( new Resultboard( n , this ) );
406 } 412 }
@@ -599,25 +605,25 @@ Resultboard::Resultboard( QString playerName , QWidget *parent , const char* nam
599void Resultboard::paintEvent( QPaintEvent* ) 605void Resultboard::paintEvent( QPaintEvent* )
600{ 606{
601 QPainter p; 607 QPainter p;
602 p.begin( this ); 608 p.begin( this );
603 609
604 const int cell_width = this->width(); 610 const int cell_width = this->width();
605 const int cell_height = this->height()/17; 611 const int cell_height = this->height()/17;
606 612
607 pointMap::Iterator it = pMap.begin(); 613 pointMap::Iterator it = pMap.begin();
608 for ( ; it != pMap.end() ; ++it ) 614 for ( ; it != pMap.end() ; ++it )
609 { 615 {
610 int i = it.key(); 616 int i = it.key();
611 qDebug( "ok: %d , %d" , i , it.data() ); 617 odebug << "ok: " << i << " , " << it.data() << "" << oendl;
612 p.drawText( 0, i*cell_height , cell_width , cell_height , Qt::AlignCenter , QString::number( it.data() ) ); 618 p.drawText( 0, i*cell_height , cell_width , cell_height , Qt::AlignCenter , QString::number( it.data() ) );
613 } 619 }
614 620
615 p.drawText( 0,0,cell_width,cell_height, Qt::AlignCenter , pName ); //Playername 621 p.drawText( 0,0,cell_width,cell_height, Qt::AlignCenter , pName ); //Playername
616} 622}
617 623
618 624
619void Resultboard::updateMap( int item , int points ) 625void Resultboard::updateMap( int item , int points )
620{ 626{
621 pMap.insert( item , points ); 627 pMap.insert( item , points );
622 628
623 update(); 629 update();
diff --git a/noncore/games/oyatzee/oyatzee.pro b/noncore/games/oyatzee/oyatzee.pro
index 754abd2..f505c66 100644
--- a/noncore/games/oyatzee/oyatzee.pro
+++ b/noncore/games/oyatzee/oyatzee.pro
@@ -1,11 +1,11 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on 2 CONFIG = qt warn_on
3 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS = oyatzee.h 4 HEADERS = oyatzee.h
5 SOURCES = main.cpp oyatzee.cpp 5 SOURCES = main.cpp oyatzee.cpp
6 TARGET = oyatzee 6 TARGET = oyatzee
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8 DEPENDPATH+= $(OPIEDIR)/include 8 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe -lopiecore2
10 10
11include ( $(OPIEDIR)/include.pro ) 11include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp
index a80bd35..47d6725 100644
--- a/noncore/games/wordgame/wordgame.cpp
+++ b/noncore/games/wordgame/wordgame.cpp
@@ -666,25 +666,25 @@ void ComputerPlayer::findBest(QPoint at, const QPoint& d, const QDawg::Node* nod
666 } 666 }
667 findBest(at, d, node->next(), used, nletter, tiles, n, blankvalues, blused); 667 findBest(at, d, node->next(), used, nletter, tiles, n, blankvalues, blused);
668} 668}
669 669
670void ComputerPlayer::noteChoice(const Tile** tiles, int n, const QPoint& d, const Tile* blankvalues, int blused) 670void ComputerPlayer::noteChoice(const Tile** tiles, int n, const QPoint& d, const Tile* blankvalues, int blused)
671{ 671{
672 int s = board->score(current, tiles, n, blankvalues, d, TRUE, 0); 672 int s = board->score(current, tiles, n, blankvalues, d, TRUE, 0);
673/* 673/*
674if (s>0 || current==QPoint(5,1)){ 674if (s>0 || current==QPoint(5,1)){
675QString st; 675QString st;
676for ( int i=0; i<n; i++ ) 676for ( int i=0; i<n; i++ )
677 st += tiles[i]->text(); 677 st += tiles[i]->text();
678qDebug("%d,%d: %s (%d) for %d",current.x(),current.y(),st.latin1(),n,s); 678odebug << "" << current.x() << "," << current.y() << ": " << st.latin1() << " (" << n << ") for " << s << "" << oendl;
679} 679}
680*/ 680*/
681 if ( s > best_score ) { 681 if ( s > best_score ) {
682 int i; 682 int i;
683 for ( i=0; i<n; i++ ) 683 for ( i=0; i<n; i++ )
684 best[i] = tiles[i]; 684 best[i] = tiles[i];
685 for ( i=0; i<blused; i++ ) 685 for ( i=0; i<blused; i++ )
686 best_blankvalues[i] = blankvalues[i]; 686 best_blankvalues[i] = blankvalues[i];
687 best_n = n; 687 best_n = n;
688 best_blused = blused; 688 best_blused = blused;
689 best_score = s; 689 best_score = s;
690 best_dir = d; 690 best_dir = d;
diff --git a/noncore/graphics/opie-eye/config.in b/noncore/graphics/opie-eye/config.in
index 996dcf3..d7f9963 100644
--- a/noncore/graphics/opie-eye/config.in
+++ b/noncore/graphics/opie-eye/config.in
@@ -1,9 +1,9 @@
1 config OPIE_EYE 1 config OPIE_EYE
2 boolean "opie-eye The Image Viewer and Browser" 2 boolean "opie-eye The Image Viewer and Browser"
3 default "y" 3 default "y"
4 depends on ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI 4 depends on ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI
5 5
6 config OPIE_EYE_SLAVE 6 config OPIE_EYE_SLAVE
7 boolean 7 boolean
8 default "y" if OPIE_EYE 8 default "y" if OPIE_EYE
9 depends on ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI 9 depends on ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
index 79f4510..5599ad1 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
@@ -1,26 +1,30 @@
1/* 1/*
2 * GPLv2 2 * GPLv2
3 * zecke@handhelds.org 3 * zecke@handhelds.org
4 */ 4 */
5 5
6#include "dir_ifaceinfo.h"
7
8/* OPIE */
9#include <opie2/odebug.h>
10#include <qpe/config.h>
11using namespace Opie::Core;
12
13/* QT */
6#include <qwidget.h> 14#include <qwidget.h>
7#include <qcheckbox.h> 15#include <qcheckbox.h>
8#include <qhbox.h> 16#include <qhbox.h>
9#include <qlabel.h> 17#include <qlabel.h>
10 18
11#include <qpe/config.h>
12
13#include "dir_ifaceinfo.h"
14
15namespace { 19namespace {
16 class DirImageWidget : public QHBox { 20 class DirImageWidget : public QHBox {
17 public: 21 public:
18 DirImageWidget() { 22 DirImageWidget() {
19 chkbox = new QCheckBox( QObject::tr("Show all files"), this ); 23 chkbox = new QCheckBox( QObject::tr("Show all files"), this );
20 } 24 }
21 ~DirImageWidget() {} 25 ~DirImageWidget() {}
22 QCheckBox* chkbox; 26 QCheckBox* chkbox;
23 }; 27 };
24} 28}
25 29
26 30
@@ -32,16 +36,16 @@ DirInterfaceInfo::~DirInterfaceInfo() {
32QString DirInterfaceInfo::name()const { 36QString DirInterfaceInfo::name()const {
33 return QString::fromLatin1(QObject::tr("DirView" )); 37 return QString::fromLatin1(QObject::tr("DirView" ));
34} 38}
35 39
36QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { 40QWidget* DirInterfaceInfo::configWidget(const Config& cfg) {
37 DirImageWidget* wid = new DirImageWidget(); 41 DirImageWidget* wid = new DirImageWidget();
38 wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); 42 wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) );
39 43
40 return wid; 44 return wid;
41} 45}
42 46
43void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { 47void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) {
44 qWarning( "Write Config" ); 48 owarn << "Write Config" << oendl;
45 DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); 49 DirImageWidget* wid = static_cast<DirImageWidget*>(_wid);
46 cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); 50 cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() );
47} 51}
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
index ffea29e..0a5cff4 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
@@ -1,33 +1,35 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 */ 3 */
4 4
5#include "dir_lister.h" 5#include "dir_lister.h"
6 6
7#include <lib/slavemaster.h> 7#include <lib/slavemaster.h>
8 8
9 9/* OPIE */
10#include <opie2/odebug.h>
10#include <qpe/config.h> 11#include <qpe/config.h>
11#include <qpe/qpeapplication.h> 12#include <qpe/qpeapplication.h>
13using namespace Opie::Core;
12 14
15/* QT */
13#include <qdir.h> 16#include <qdir.h>
14#include <qfileinfo.h> 17#include <qfileinfo.h>
15 18
16
17Dir_DirLister::Dir_DirLister( bool list ) 19Dir_DirLister::Dir_DirLister( bool list )
18 : PDirLister( "dir_dir_lister" ) 20 : PDirLister( "dir_dir_lister" )
19{ 21{
20 m_allFiles = list; 22 m_allFiles = list;
21 qWarning("All Files %d", m_allFiles ); 23 owarn << "All Files " << m_allFiles << "" << oendl;
22 24
23 SlaveMaster* master = SlaveMaster::self(); 25 SlaveMaster* master = SlaveMaster::self();
24 connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); 26 connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) );
25 connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); 27 connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) );
26 connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), 28 connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)),
27 this, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); 29 this, SIGNAL(sig_thumbInfo(const QString&, const QString&)) );
28 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), 30 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)),
29 this, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); 31 this, SIGNAL(sig_fullInfo(const QString&, const QString&)) );
30 connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), 32 connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)),
31 this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); 33 this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) );
32 34
33} 35}
diff --git a/noncore/graphics/opie-eye/lib/slavemaster.cpp b/noncore/graphics/opie-eye/lib/slavemaster.cpp
index 4e28535..5bb7ab8 100644
--- a/noncore/graphics/opie-eye/lib/slavemaster.cpp
+++ b/noncore/graphics/opie-eye/lib/slavemaster.cpp
@@ -1,38 +1,42 @@
1#include "slavemaster.h" 1#include "slavemaster.h"
2 2
3/* OPIE */
4#include <opie2/odebug.h>
3#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
4#include <qpe/qcopenvelope_qws.h> 6#include <qpe/qcopenvelope_qws.h>
7using namespace Opie::Core;
5 8
9/* QT */
6#include <qcopchannel_qws.h> 10#include <qcopchannel_qws.h>
7#include <qtimer.h> 11#include <qtimer.h>
8 12
9QDataStream & operator << (QDataStream & str, bool b) 13QDataStream & operator << (QDataStream & str, bool b)
10{ 14{
11 str << Q_INT8(b); 15 str << Q_INT8(b);
12 return str; 16 return str;
13} 17}
14QDataStream & operator >> (QDataStream & str, bool & b) 18QDataStream & operator >> (QDataStream & str, bool & b)
15{ 19{
16 Q_INT8 l; 20 Q_INT8 l;
17 str >> l; 21 str >> l;
18 b = bool(l); 22 b = bool(l);
19 return str; 23 return str;
20} 24}
21 25
22/* 26/*
23 * ! We don't put a Pixmap in!!!! 27 * ! We don't put a Pixmap in!!!!
24 */ 28 */
25QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { 29QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) {
26 qWarning( "Image request is %s %d %d", inf.file.latin1(), inf.width, inf.height ); 30 owarn << "Image request is " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl;
27 return s << inf.file << inf.width << inf.height; 31 return s << inf.file << inf.width << inf.height;
28} 32}
29QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { 33QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) {
30 s >> inf.file >> inf.pixmap >> inf.width >> inf.height; 34 s >> inf.file >> inf.pixmap >> inf.width >> inf.height;
31 return s; 35 return s;
32} 36}
33QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { 37QDataStream &operator<<( QDataStream& s, const ImageInfo& i) {
34 return s << i.kind << i.file << i.info; 38 return s << i.kind << i.file << i.info;
35} 39}
36QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { 40QDataStream &operator>>( QDataStream& s, ImageInfo& i ) {
37 s >> i.kind >> i.file >> i.info; 41 s >> i.kind >> i.file >> i.info;
38 return s; 42 return s;
@@ -69,52 +73,52 @@ void SlaveMaster::thumbInfo( const QString& str) {
69} 73}
70 74
71void SlaveMaster::imageInfo( const QString& str ) { 75void SlaveMaster::imageInfo( const QString& str ) {
72 m_inImageInfo.append( str ); 76 m_inImageInfo.append( str );
73 if ( !m_started ) { 77 if ( !m_started ) {
74 QTimer::singleShot( 0, this, SLOT(slotTimerStart())); 78 QTimer::singleShot( 0, this, SLOT(slotTimerStart()));
75 m_started = true; 79 m_started = true;
76 } 80 }
77} 81}
78 82
79void SlaveMaster::thumbNail( const QString& str, int w, int h ) { 83void SlaveMaster::thumbNail( const QString& str, int w, int h ) {
80 if ( str.isEmpty() ) { 84 if ( str.isEmpty() ) {
81 qWarning( "Asking for empty nail" ); 85 owarn << "Asking for empty nail" << oendl;
82 return; 86 return;
83 } 87 }
84 qWarning( "Asking for thumbNail in size %d %d" + str, w,h ); 88 owarn << "Asking for thumbNail in size " << w << " " << h << "" + str << oendl;
85 PixmapInfo item; 89 PixmapInfo item;
86 item.file = str; item.width = w; item.height = h; 90 item.file = str; item.width = w; item.height = h;
87 item.pixmap = QPixmap(); 91 item.pixmap = QPixmap();
88 m_inThumbNail.append( item ); 92 m_inThumbNail.append( item );
89 93
90 if ( !m_started ) { 94 if ( !m_started ) {
91 QTimer::singleShot( 0, this, SLOT(slotTimerStart())); 95 QTimer::singleShot( 0, this, SLOT(slotTimerStart()));
92 m_started = true; 96 m_started = true;
93 } 97 }
94} 98}
95 99
96 100
97void SlaveMaster::recieve( const QCString& str, const QByteArray& at) { 101void SlaveMaster::recieve( const QCString& str, const QByteArray& at) {
98 102
99 ImageInfos infos; 103 ImageInfos infos;
100 PixmapInfos pixinfos; 104 PixmapInfos pixinfos;
101 105
102 QDataStream stream( at, IO_ReadOnly ); 106 QDataStream stream( at, IO_ReadOnly );
103 if ( str == "pixmapsHandled(PixmapList)" ) 107 if ( str == "pixmapsHandled(PixmapList)" )
104 stream >> pixinfos; 108 stream >> pixinfos;
105 else if ( str == "pixmapsHandled(StringList)" ) 109 else if ( str == "pixmapsHandled(StringList)" )
106 stream >> infos; 110 stream >> infos;
107 111
108 qWarning( "PixInfos %d", pixinfos.count() ); 112 owarn << "PixInfos " << pixinfos.count() << "" << oendl;
109 113
110 bool got_data = ( !infos.isEmpty() || !pixinfos.isEmpty() ); 114 bool got_data = ( !infos.isEmpty() || !pixinfos.isEmpty() );
111 if ( got_data ) { 115 if ( got_data ) {
112 emit sig_start(); 116 emit sig_start();
113 for ( ImageInfos::Iterator _it = infos.begin(); _it != infos.end(); ++_it ) { 117 for ( ImageInfos::Iterator _it = infos.begin(); _it != infos.end(); ++_it ) {
114 if ( (*_it).kind ) 118 if ( (*_it).kind )
115 emit sig_fullInfo( (*_it).file, (*_it).info ); 119 emit sig_fullInfo( (*_it).file, (*_it).info );
116 else 120 else
117 emit sig_thumbInfo( (*_it).file, (*_it).info ); 121 emit sig_thumbInfo( (*_it).file, (*_it).info );
118 } 122 }
119 123
120 for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) 124 for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it )
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro
index 17fa22c..0e2202a 100644
--- a/noncore/graphics/opie-eye/phunk_view.pro
+++ b/noncore/graphics/opie-eye/phunk_view.pro
@@ -22,15 +22,15 @@ SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \
22 impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ 22 impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \
23 gui/imageinfoui.cpp 23 gui/imageinfoui.cpp
24# A list of source files 24# A list of source files
25 25
26INTERFACES = 26INTERFACES =
27# list of ui files 27# list of ui files
28 28
29INCLUDEPATH += . $(OPIEDIR)/include 29INCLUDEPATH += . $(OPIEDIR)/include
30DEPENDPATH += $(OPIEDIR)/include 30DEPENDPATH += $(OPIEDIR)/include
31 31
32 32
33 33
34LIBS += -lqpe -lopieui2 34LIBS += -lqpe -lopiecore2 -lopieui2
35 35
36include ( $(OPIEDIR)/include.pro ) 36include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
index 086b47f..fb7d5de 100644
--- a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
+++ b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
@@ -1,19 +1,23 @@
1#include "jpeg_slave.h" 1#include "jpeg_slave.h"
2
3#include "thumbnailtool.h" 2#include "thumbnailtool.h"
4 3
5PHUNK_VIEW_INTERFACE( "JPEG", JpegSlave ) 4PHUNK_VIEW_INTERFACE( "JPEG", JpegSlave )
6 5
7#include <qtopia/timestring.h> 6/* OPIE */
7#include <opie2/odebug.h>
8#include <qpe/timestring.h>
9using namespace Opie::Core;
10
11/* QT */
8#include <qobject.h> 12#include <qobject.h>
9#include <qimage.h> 13#include <qimage.h>
10 14
11/** 15/**
12 exif.h 16 exif.h
13*/ 17*/
14 18
15#include <stdio.h> 19#include <stdio.h>
16#include <stdlib.h> 20#include <stdlib.h>
17#include <math.h> 21#include <math.h>
18#include <time.h> 22#include <time.h>
19 23
@@ -110,25 +114,25 @@ public:
110 int getCompressionLevel() { return CompressionLevel; } 114 int getCompressionLevel() { return CompressionLevel; }
111 QString getUserComment() { return UserComment; } 115 QString getUserComment() { return UserComment; }
112 QString getComment() { return Comment; } 116 QString getComment() { return Comment; }
113 QImage getThumbnail(); 117 QImage getThumbnail();
114 bool isThumbnailSane(); 118 bool isThumbnailSane();
115 bool isNullThumbnail() { return !isThumbnailSane(); } 119 bool isNullThumbnail() { return !isThumbnailSane(); }
116}; 120};
117 121
118class FatalError { 122class FatalError {
119 const char* ex; 123 const char* ex;
120public: 124public:
121 FatalError(const char* s) { ex = s; } 125 FatalError(const char* s) { ex = s; }
122 void debug_print() const { qWarning("exception: %s", ex ); } 126 void debug_print() const { owarn << "exception: " << ex << "" << oendl; }
123}; 127};
124 128
125 129
126 130
127static unsigned char * LastExifRefd; 131static unsigned char * LastExifRefd;
128static int ExifSettingsLength; 132static int ExifSettingsLength;
129static double FocalplaneXRes; 133static double FocalplaneXRes;
130static double FocalplaneUnits; 134static double FocalplaneUnits;
131static int MotorolaOrder = 0; 135static int MotorolaOrder = 0;
132static int SectionsRead; 136static int SectionsRead;
133//static int HaveAll; 137//static int HaveAll;
134 138
@@ -253,25 +257,25 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode)
253 int marker = 0; 257 int marker = 0;
254 int got; 258 int got;
255 unsigned int ll,lh; 259 unsigned int ll,lh;
256 unsigned int itemlen; 260 unsigned int itemlen;
257 uchar * Data; 261 uchar * Data;
258 262
259 for (a=0;a<7;a++){ 263 for (a=0;a<7;a++){
260 marker = infile.getch(); 264 marker = infile.getch();
261 if (marker != 0xff) break; 265 if (marker != 0xff) break;
262 266
263 if (a >= 6){ 267 if (a >= 6){
264 268
265 qWarning( "too many padding bytes" ); 269 owarn << "too many padding bytes" << oendl;
266 return false; 270 return false;
267 271
268 } 272 }
269 } 273 }
270 274
271 if (marker == 0xff){ 275 if (marker == 0xff){
272 // 0xff is legal padding, but if we get that many, something's wrong. 276 // 0xff is legal padding, but if we get that many, something's wrong.
273 return false; 277 return false;
274 } 278 }
275 279
276 Sections[SectionsRead].Type = marker; 280 Sections[SectionsRead].Type = marker;
277 281
@@ -318,25 +322,25 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode)
318 return false; 322 return false;
319 } 323 }
320 324
321 Sections[SectionsRead].Data = Data; 325 Sections[SectionsRead].Data = Data;
322 Sections[SectionsRead].Size = size; 326 Sections[SectionsRead].Size = size;
323 Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER; 327 Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER;
324 SectionsRead ++; 328 SectionsRead ++;
325 //HaveAll = 1; 329 //HaveAll = 1;
326 } 330 }
327 return true; 331 return true;
328 332
329 case M_EOI: // in case it's a tables-only JPEG stream 333 case M_EOI: // in case it's a tables-only JPEG stream
330 qWarning( "No image in jpeg!" ); 334 owarn << "No image in jpeg!" << oendl;
331 return false; 335 return false;
332 336
333 case M_COM: // Comment section 337 case M_COM: // Comment section
334 // pieczy 2002-02-12 338 // pieczy 2002-02-12
335 // now the User comment goes to UserComment 339 // now the User comment goes to UserComment
336 // so we can store a Comment section also in READ_EXIF mode 340 // so we can store a Comment section also in READ_EXIF mode
337 process_COM(Data, itemlen); 341 process_COM(Data, itemlen);
338 break; 342 break;
339 343
340 case M_JFIF: 344 case M_JFIF:
341 // Regular jpegs always have this tag, exif images have the exif 345 // Regular jpegs always have this tag, exif images have the exif
342 // marker instead, althogh ACDsee will write images with both markers. 346 // marker instead, althogh ACDsee will write images with both markers.
@@ -717,25 +721,25 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa
717 if (DIR_ENTRY_ADDR(DirStart, NumDirEntries) + 4 <= OffsetBase+ExifLength){ 721 if (DIR_ENTRY_ADDR(DirStart, NumDirEntries) + 4 <= OffsetBase+ExifLength){
718 Offset = Get32u(DIR_ENTRY_ADDR(DirStart, NumDirEntries)); 722 Offset = Get32u(DIR_ENTRY_ADDR(DirStart, NumDirEntries));
719 // There is at least one jpeg from an HP camera having an Offset of almost MAXUINT. 723 // There is at least one jpeg from an HP camera having an Offset of almost MAXUINT.
720 // Adding OffsetBase to it produces an overflow, so compare with ExifLength here. 724 // Adding OffsetBase to it produces an overflow, so compare with ExifLength here.
721 // See http://bugs.kde.org/show_bug.cgi?id=54542 725 // See http://bugs.kde.org/show_bug.cgi?id=54542
722 if (Offset && Offset < ExifLength){ 726 if (Offset && Offset < ExifLength){
723 SubdirStart = OffsetBase + Offset; 727 SubdirStart = OffsetBase + Offset;
724 if (SubdirStart > OffsetBase+ExifLength){ 728 if (SubdirStart > OffsetBase+ExifLength){
725 if (SubdirStart < OffsetBase+ExifLength+20){ 729 if (SubdirStart < OffsetBase+ExifLength+20){
726 // Jhead 1.3 or earlier would crop the whole directory! 730 // Jhead 1.3 or earlier would crop the whole directory!
727 // As Jhead produces this form of format incorrectness, 731 // As Jhead produces this form of format incorrectness,
728 // I'll just let it pass silently 732 // I'll just let it pass silently
729 qWarning( "Thumbnail removed with Jhead 1.3 or earlier" ); 733 owarn << "Thumbnail removed with Jhead 1.3 or earlier" << oendl;
730 }else{ 734 }else{
731 return; 735 return;
732 } 736 }
733 }else{ 737 }else{
734 if (SubdirStart <= OffsetBase+ExifLength){ 738 if (SubdirStart <= OffsetBase+ExifLength){
735 ProcessExifDir(SubdirStart, OffsetBase, ExifLength); 739 ProcessExifDir(SubdirStart, OffsetBase, ExifLength);
736 } 740 }
737 } 741 }
738 } 742 }
739 }else{ 743 }else{
740 // The exif header ends before the last next directory pointer. 744 // The exif header ends before the last next directory pointer.
741 } 745 }
@@ -904,25 +908,25 @@ ExifData::ExifData()
904//-------------------------------------------------------------------------- 908//--------------------------------------------------------------------------
905bool ExifData::scan(const QString & path) 909bool ExifData::scan(const QString & path)
906{ 910{
907 int ret; 911 int ret;
908 912
909 QFile f(path); 913 QFile f(path);
910 f.open(IO_ReadOnly); 914 f.open(IO_ReadOnly);
911 915
912 // Scan the JPEG headers. 916 // Scan the JPEG headers.
913 ret = ReadJpegSections(f, READ_EXIF); 917 ret = ReadJpegSections(f, READ_EXIF);
914 918
915 if (ret == false){ 919 if (ret == false){
916 qWarning( "Not JPEG file!" ); 920 owarn << "Not JPEG file!" << oendl;
917 DiscardData(); 921 DiscardData();
918 f.close(); 922 f.close();
919 return false; 923 return false;
920 } 924 }
921 f.close(); 925 f.close();
922 DiscardData(); 926 DiscardData();
923 927
924 //now make the strings clean, 928 //now make the strings clean,
925 // for exmaple my Casio is a "QV-4000 " 929 // for exmaple my Casio is a "QV-4000 "
926 CameraMake = CameraMake.stripWhiteSpace(); 930 CameraMake = CameraMake.stripWhiteSpace();
927 CameraModel = CameraModel.stripWhiteSpace(); 931 CameraModel = CameraModel.stripWhiteSpace();
928 UserComment = UserComment.stripWhiteSpace(); 932 UserComment = UserComment.stripWhiteSpace();
diff --git a/noncore/graphics/opie-eye/slave/main.cpp b/noncore/graphics/opie-eye/slave/main.cpp
index 37020e6..5b90483 100644
--- a/noncore/graphics/opie-eye/slave/main.cpp
+++ b/noncore/graphics/opie-eye/slave/main.cpp
@@ -22,38 +22,38 @@ int main( int argc, char* argv[] ) {
22 &rec, SLOT(recieveAnswer(const QCString&,const QByteArray&))); 22 &rec, SLOT(recieveAnswer(const QCString&,const QByteArray&)));
23 QObject::connect(qApp,SIGNAL(appMessage(const QCString&, const QByteArray&)), 23 QObject::connect(qApp,SIGNAL(appMessage(const QCString&, const QByteArray&)),
24 &rec, SLOT(recieveAnswer(const QCString&,const QByteArray&))); 24 &rec, SLOT(recieveAnswer(const QCString&,const QByteArray&)));
25 25
26 return app.exec(); 26 return app.exec();
27} 27}
28 28
29#ifdef DEBUG_IT 29#ifdef DEBUG_IT
30int main( int argc, char* argv[] ) { 30int main( int argc, char* argv[] ) {
31 QString str = QString::fromLatin1(argv[2] ); 31 QString str = QString::fromLatin1(argv[2] );
32 QApplication app( argc, argv ); 32 QApplication app( argc, argv );
33 GifSlave slave; 33 GifSlave slave;
34 qWarning( str +" "+slave.iconViewName(str ) ); 34 owarn << str +" "+slave.iconViewName(str ) << oendl;
35 qWarning( str+" "+slave.fullImageInfo( str ) ); 35 owarn << str+" "+slave.fullImageInfo( str ) << oendl;
36 36
37 PNGSlave pngslave; 37 PNGSlave pngslave;
38 qWarning( str + " " + pngslave.iconViewName(str) ); 38 owarn << str + " " + pngslave.iconViewName(str) << oendl;
39 qWarning( str + " " + pngslave.fullImageInfo(str)); 39 owarn << str + " " + pngslave.fullImageInfo(str) << oendl;
40 40
41 41
42 JpegSlave jpgslave; 42 JpegSlave jpgslave;
43 qWarning( str + " " + jpgslave.iconViewName(str ) ); 43 owarn << str + " " + jpgslave.iconViewName(str ) << oendl;
44 qWarning( str + " " + jpgslave.fullImageInfo( str ) ); 44 owarn << str + " " + jpgslave.fullImageInfo( str ) << oendl;
45//return app.exec(); 45//return app.exec();
46 QPixmap pix = ThumbNailTool::getThumb( str, 24, 24 ); 46 QPixmap pix = ThumbNailTool::getThumb( str, 24, 24 );
47 if ( pix.isNull() ) { 47 if ( pix.isNull() ) {
48 qWarning( "No Thumbnail" ); 48 owarn << "No Thumbnail" << oendl;
49 pix = slave.pixmap(str, 24, 24); 49 pix = slave.pixmap(str, 24, 24);
50 } 50 }
51 51
52 if (!pix.isNull() ) { 52 if (!pix.isNull() ) {
53 qWarning( "Saving Thumbnail" ); 53 owarn << "Saving Thumbnail" << oendl;
54 ThumbNailTool::putThumb( str, pix, 24, 24 ); 54 ThumbNailTool::putThumb( str, pix, 24, 24 );
55 } 55 }
56 56
57} 57}
58 58
59#endif 59#endif
diff --git a/noncore/graphics/opie-eye/slave/slave.pro b/noncore/graphics/opie-eye/slave/slave.pro
index 3f42495..903d667 100644
--- a/noncore/graphics/opie-eye/slave/slave.pro
+++ b/noncore/graphics/opie-eye/slave/slave.pro
@@ -1,18 +1,18 @@
1CONFIG += qte 1CONFIG = qt
2TEMPLATE = app 2TEMPLATE = app
3TARGET = opie-eye_slave 3TARGET = opie-eye_slave
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5 5
6HEADERS = gif_slave.h slaveiface.h slavereciever.h \ 6HEADERS = gif_slave.h slaveiface.h slavereciever.h \
7 thumbnailtool.h png_slave.h jpeg_slave.h \ 7 thumbnailtool.h png_slave.h jpeg_slave.h \
8 ../iface/slaveiface.h 8 ../iface/slaveiface.h
9SOURCES = main.cpp gif_slave.cpp slavereciever.cpp \ 9SOURCES = main.cpp gif_slave.cpp slavereciever.cpp \
10 slaveiface.cpp thumbnailtool.cpp png_slave.cpp \ 10 slaveiface.cpp thumbnailtool.cpp png_slave.cpp \
11 jpeg_slave.cpp 11 jpeg_slave.cpp
12 12
13INCLUDEPATH += $(OPIEDIR)/include ../ 13INCLUDEPATH += $(OPIEDIR)/include ../
14DEPENDSPATH += $(OPIEDIR)/include 14DEPENDSPATH += $(OPIEDIR)/include
15 15
16LIBS += -lqpe 16LIBS += -lqpe -lopiecore2
17 17
18include ( $(OPIEDIR)/include.pro ) \ No newline at end of file 18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/graphics/opie-eye/slave/slavereciever.cpp b/noncore/graphics/opie-eye/slave/slavereciever.cpp
index bbbbb30..82b3d23 100644
--- a/noncore/graphics/opie-eye/slave/slavereciever.cpp
+++ b/noncore/graphics/opie-eye/slave/slavereciever.cpp
@@ -1,22 +1,26 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 */ 3 */
4 4
5#include "slavereciever.h" 5#include "slavereciever.h"
6#include "slaveiface.h" 6#include "slaveiface.h"
7 7
8/* OPIE */
9#include <opie2/odebug.h>
8#include <qpe/qcopenvelope_qws.h> 10#include <qpe/qcopenvelope_qws.h>
9#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
12using namespace Opie::Core;
10 13
14/* QT */
11#include <qtimer.h> 15#include <qtimer.h>
12 16
13static SlaveObjects* _slaveObj = 0; 17static SlaveObjects* _slaveObj = 0;
14 18
15QDataStream & operator << (QDataStream & str, bool b) 19QDataStream & operator << (QDataStream & str, bool b)
16{ 20{
17 str << Q_INT8(b); 21 str << Q_INT8(b);
18 return str; 22 return str;
19} 23}
20 24
21QDataStream & operator >> (QDataStream & str, bool & b) 25QDataStream & operator >> (QDataStream & str, bool & b)
22{ 26{
@@ -28,25 +32,25 @@ QDataStream & operator >> (QDataStream & str, bool & b)
28 32
29 33
30 34
31QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { 35QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) {
32 return s << inf.file << inf.pixmap << inf.width << inf.height; 36 return s << inf.file << inf.pixmap << inf.width << inf.height;
33} 37}
34 38
35/* 39/*
36 * GUI sends no QPIxmap!!! 40 * GUI sends no QPIxmap!!!
37 */ 41 */
38QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { 42QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) {
39 s >> inf.file >> inf.width >> inf.height; 43 s >> inf.file >> inf.width >> inf.height;
40 qWarning( "Recieved %s %d %d", inf.file.latin1(), inf.width, inf.height ); 44 owarn << "Recieved " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl;
41 return s; 45 return s;
42} 46}
43QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { 47QDataStream &operator<<( QDataStream& s, const ImageInfo& i) {
44 return s << i.kind << i.file << i.info; 48 return s << i.kind << i.file << i.info;
45} 49}
46QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { 50QDataStream &operator>>( QDataStream& s, ImageInfo& i ) {
47 s >> i.kind >> i.file >> i.info; 51 s >> i.kind >> i.file >> i.info;
48 return s; 52 return s;
49} 53}
50 54
51 55
52 56
@@ -73,60 +77,60 @@ SlaveReciever::SlaveReciever( QObject* par)
73 SlaveObjects *obj = slaveObjects(); // won't be changed 77 SlaveObjects *obj = slaveObjects(); // won't be changed
74 SlaveMap::Iterator it; 78 SlaveMap::Iterator it;
75 SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!! 79 SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!!
76 for(it = map->begin(); it != map->end(); ++it ) { 80 for(it = map->begin(); it != map->end(); ++it ) {
77 obj->insert( it.key(), (*it.data())() ); 81 obj->insert( it.key(), (*it.data())() );
78 } 82 }
79} 83}
80 84
81SlaveReciever::~SlaveReciever() { 85SlaveReciever::~SlaveReciever() {
82} 86}
83 87
84void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) { 88void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) {
85 qWarning( "String is %s", string.data() ); 89 owarn << "String is " << string.data() << "" << oendl;
86 QDataStream stream(ar, IO_ReadOnly ); 90 QDataStream stream(ar, IO_ReadOnly );
87 QStringList lst; 91 QStringList lst;
88 static ImageInfo inf; 92 static ImageInfo inf;
89 static PixmapInfo pix; 93 static PixmapInfo pix;
90 94
91 if ( string == "thumbInfo(QString)" ) { 95 if ( string == "thumbInfo(QString)" ) {
92 stream >> inf.file; 96 stream >> inf.file;
93 m_inList.append(inf); 97 m_inList.append(inf);
94 }else if ( string == "thumbInfos(QStringList)" ) { 98 }else if ( string == "thumbInfos(QStringList)" ) {
95 stream >> lst; 99 stream >> lst;
96 for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { 100 for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
97 qWarning( "Adding thumbinfo for file "+ *it ); 101 owarn << "Adding thumbinfo for file "+ *it << oendl;
98 inf.file = (*it); 102 inf.file = (*it);
99 m_inList.append(inf); 103 m_inList.append(inf);
100 } 104 }
101 }else if ( string == "fullInfo(QString)" ) { 105 }else if ( string == "fullInfo(QString)" ) {
102 inf.kind = true; 106 inf.kind = true;
103 stream >> inf.file; 107 stream >> inf.file;
104 m_inList.append(inf); 108 m_inList.append(inf);
105 }else if ( string == "fullInfos(QStringList)" ) { 109 }else if ( string == "fullInfos(QStringList)" ) {
106 stream >> lst; 110 stream >> lst;
107 for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { 111 for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
108 qWarning( "Adding fullInfo for"+ *it ); 112 owarn << "Adding fullInfo for"+ *it << oendl;
109 inf.file = (*it); 113 inf.file = (*it);
110 inf.kind = true; 114 inf.kind = true;
111 m_inList.append(inf); 115 m_inList.append(inf);
112 } 116 }
113 }else if ( string == "pixmapInfo(QString,int,int)" ) { 117 }else if ( string == "pixmapInfo(QString,int,int)" ) {
114 stream >> pix.file >> pix.width >> pix.height; 118 stream >> pix.file >> pix.width >> pix.height;
115 m_inPix.append(pix); 119 m_inPix.append(pix);
116 }else if ( string == "pixmapInfos(PixmapInfos)" ) { 120 }else if ( string == "pixmapInfos(PixmapInfos)" ) {
117 PixmapList list; 121 PixmapList list;
118 stream >> list; 122 stream >> list;
119 for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) { 123 for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) {
120 qWarning( "Got %d %d " + (*it).file, (*it).width , (*it).height ); 124 owarn << "Got " << (*it).width << " " << (*it).height << " " + (*it).file << oendl;
121 m_inPix.append(*it); 125 m_inPix.append(*it);
122 } 126 }
123 }else if ( string == "refUp()" ) { 127 }else if ( string == "refUp()" ) {
124 m_refs++; 128 m_refs++;
125 }else if ( string == "refDown()" ) { 129 }else if ( string == "refDown()" ) {
126 m_refs--; 130 m_refs--;
127 } 131 }
128 132
129 if (!m_inf->isActive() && !m_inList.isEmpty() ) 133 if (!m_inf->isActive() && !m_inList.isEmpty() )
130 m_inf->start(5); 134 m_inf->start(5);
131 135
132 if (!m_pix->isActive() && !m_inPix.isEmpty() ) 136 if (!m_pix->isActive() && !m_inPix.isEmpty() )
@@ -172,55 +176,55 @@ void SlaveReciever::slotImageInfo() {
172} 176}
173 177
174void SlaveReciever::slotThumbNail() { 178void SlaveReciever::slotThumbNail() {
175 PixmapInfo inf = m_inPix.first(); 179 PixmapInfo inf = m_inPix.first();
176 m_inPix.remove( inf ); 180 m_inPix.remove( inf );
177 181
178 static SlaveObjects::Iterator it; 182 static SlaveObjects::Iterator it;
179 static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!! 183 static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!!
180 for(it = map->begin(); it != map->end(); ++it ) { 184 for(it = map->begin(); it != map->end(); ++it ) {
181 SlaveInterface* iface = it.data(); 185 SlaveInterface* iface = it.data();
182 if( iface->supports(inf.file ) ) { 186 if( iface->supports(inf.file ) ) {
183 /* pixmap */ 187 /* pixmap */
184 qWarning( "Asking for thumbNail in size %d %d for "+inf.file, inf.width, inf.height ); 188 owarn << "Asking for thumbNail in size " << inf.width << " " << inf.height << " for "+inf.file << oendl;
185 inf.pixmap = iface->pixmap(inf.file, 64, 64); 189 inf.pixmap = iface->pixmap(inf.file, 64, 64);
186 m_outPix.append( inf ); 190 m_outPix.append( inf );
187 break; 191 break;
188 } 192 }
189 } 193 }
190 194
191 195
192 196
193 if(m_inPix.isEmpty() ) 197 if(m_inPix.isEmpty() )
194 m_pix->stop(); 198 m_pix->stop();
195 if(!m_out->isActive() && !m_outPix.isEmpty() ) 199 if(!m_out->isActive() && !m_outPix.isEmpty() )
196 m_out->start(100); 200 m_out->start(100);
197} 201}
198 202
199void SlaveReciever::slotSend() { 203void SlaveReciever::slotSend() {
200 204
201 m_out->stop(); 205 m_out->stop();
202 206
203 qWarning( "Sending %d %d", outPix().count(), outInf().count() ); 207 owarn << "Sending " << outPix().count() << " " << outInf().count() << "" << oendl;
204 /* queue it and send */ 208 /* queue it and send */
205 /* if this ever gets a service introduce request queues 209 /* if this ever gets a service introduce request queues
206 * so we can differinatate between different clients 210 * so we can differinatate between different clients
207 */ 211 */
208 if (! m_outPix.isEmpty() ) { 212 if (! m_outPix.isEmpty() ) {
209 QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(PixmapList)" ); 213 QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(PixmapList)" );
210 answer << outPix(); 214 answer << outPix();
211 for ( PixmapList::Iterator it = m_outPix.begin();it!=m_outPix.end();++it ) { 215 for ( PixmapList::Iterator it = m_outPix.begin();it!=m_outPix.end();++it ) {
212 qWarning( "Sending out %s %d %d", (*it).file.latin1(), (*it).width, (*it).height ); 216 owarn << "Sending out " << (*it).file.latin1() << " " << (*it).width << " " << (*it).height << "" << oendl;
213 } 217 }
214 } 218 }
215 if ( !m_outList.isEmpty() ) { 219 if ( !m_outList.isEmpty() ) {
216 QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(StringList)" ); 220 QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(StringList)" );
217 answer << outInf(); 221 answer << outInf();
218 for ( StringList::Iterator it = m_outList.begin();it!=m_outList.end();++it ) { 222 for ( StringList::Iterator it = m_outList.begin();it!=m_outList.end();++it ) {
219 qWarning( "Sending out2 " + (*it).file ); 223 owarn << "Sending out2 " + (*it).file << oendl;
220 } 224 }
221 } 225 }
222 226
223 m_outList.clear(); 227 m_outList.clear();
224 m_outPix.clear(); 228 m_outPix.clear();
225} 229}
226 230
diff --git a/noncore/graphics/opie-eye/slave/thumbnailtool.cpp b/noncore/graphics/opie-eye/slave/thumbnailtool.cpp
index a202457..d2e169c 100644
--- a/noncore/graphics/opie-eye/slave/thumbnailtool.cpp
+++ b/noncore/graphics/opie-eye/slave/thumbnailtool.cpp
@@ -1,14 +1,19 @@
1#include "thumbnailtool.h" 1#include "thumbnailtool.h"
2 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
7/* QT */
3#include <qfileinfo.h> 8#include <qfileinfo.h>
4#include <qdir.h> 9#include <qdir.h>
5#include <qimage.h> 10#include <qimage.h>
6#include <qpixmap.h> 11#include <qpixmap.h>
7#include <qstring.h> 12#include <qstring.h>
8 13
9static bool makeThumbDir( const QFileInfo& inf, bool make = false) { 14static bool makeThumbDir( const QFileInfo& inf, bool make = false) {
10 QDir dir( inf.dirPath()+ "/.opie-eye" ); 15 QDir dir( inf.dirPath()+ "/.opie-eye" );
11 if ( !dir.exists() ) 16 if ( !dir.exists() )
12 if ( make ) 17 if ( make )
13 return dir.mkdir(QString::null); 18 return dir.mkdir(QString::null);
14 else 19 else
@@ -17,40 +22,40 @@ static bool makeThumbDir( const QFileInfo& inf, bool make = false) {
17} 22}
18 23
19 24
20/* 25/*
21 * check if the Opie opie-eye dir exists 26 * check if the Opie opie-eye dir exists
22 * check if a thumbnail exists 27 * check if a thumbnail exists
23 * load the thumbnail 28 * load the thumbnail
24 * /foo/bar/imagefoo.gif 29 * /foo/bar/imagefoo.gif
25 * check for a png in /foo/bar/.opie-eye/%dx%d-imagefoo.gif 30 * check for a png in /foo/bar/.opie-eye/%dx%d-imagefoo.gif
26 */ 31 */
27QPixmap ThumbNailTool::getThumb( const QString& path, int width, int height ) { 32QPixmap ThumbNailTool::getThumb( const QString& path, int width, int height ) {
28 QFileInfo inf( path ); 33 QFileInfo inf( path );
29 qWarning( "Get Thumb" ); 34 owarn << "Get Thumb" << oendl;
30 if ( !makeThumbDir( inf ) ) { 35 if ( !makeThumbDir( inf ) ) {
31 QPixmap pix; 36 QPixmap pix;
32 return pix; 37 return pix;
33 } 38 }
34 QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() ); 39 QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() );
35 qWarning( inf.dirPath()+str ); 40 owarn << inf.dirPath()+str << oendl;
36 return QPixmap( inf.dirPath()+str,"PNG" ); 41 return QPixmap( inf.dirPath()+str,"PNG" );
37 42
38} 43}
39 44
40void ThumbNailTool::putThumb( const QString& path, const QPixmap& pix, int width, int height ) { 45void ThumbNailTool::putThumb( const QString& path, const QPixmap& pix, int width, int height ) {
41 QFileInfo inf( path ); 46 QFileInfo inf( path );
42 makeThumbDir( inf, true ); 47 makeThumbDir( inf, true );
43 QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() ); 48 QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() );
44 qWarning( inf.dirPath()+str ); 49 owarn << inf.dirPath()+str << oendl;
45 pix.save( inf.dirPath()+str, "PNG" ); 50 pix.save( inf.dirPath()+str, "PNG" );
46} 51}
47 52
48 53
49QPixmap ThumbNailTool::scaleImage( QImage& img, int w, int h ) { 54QPixmap ThumbNailTool::scaleImage( QImage& img, int w, int h ) {
50 double hs = (double)h / (double)img.height() ; 55 double hs = (double)h / (double)img.height() ;
51 double ws = (double)w / (double)img.width() ; 56 double ws = (double)w / (double)img.width() ;
52 double scaleFactor = (hs > ws) ? ws : hs; 57 double scaleFactor = (hs > ws) ? ws : hs;
53 int smoothW = (int)(scaleFactor * img.width()); 58 int smoothW = (int)(scaleFactor * img.width());
54 int smoothH = (int)(scaleFactor * img.height()); 59 int smoothH = (int)(scaleFactor * img.height());
55 QPixmap pixmap; 60 QPixmap pixmap;
56 if ( img.width() <= w && img.height() <= h ) 61 if ( img.width() <= w && img.height() <= h )
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 28a42eb..36def67 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -124,25 +124,25 @@ void AudioWidget::sliderPressed() {
124} 124}
125 125
126 126
127void AudioWidget::sliderReleased() { 127void AudioWidget::sliderReleased() {
128 audioSliderBeingMoved = FALSE; 128 audioSliderBeingMoved = FALSE;
129 if ( slider.width() == 0 ) 129 if ( slider.width() == 0 )
130 return; 130 return;
131 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 131 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
132 mediaPlayerState.setPosition( val ); 132 mediaPlayerState.setPosition( val );
133} 133}
134 134
135void AudioWidget::setPosition( long i ) { 135void AudioWidget::setPosition( long i ) {
136 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 136 // odebug << "<<<<<<<<<<<<<<<<<<<<<<<<set position " << i << "" << oendl;
137 updateSlider( i, mediaPlayerState.length() ); 137 updateSlider( i, mediaPlayerState.length() );
138} 138}
139 139
140 140
141void AudioWidget::setLength( long max ) { 141void AudioWidget::setLength( long max ) {
142 updateSlider( mediaPlayerState.position(), max ); 142 updateSlider( mediaPlayerState.position(), max );
143} 143}
144 144
145 145
146void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 146void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
147 if ( mediaType == MediaPlayerState::Audio ) { 147 if ( mediaType == MediaPlayerState::Audio ) {
148 // startTimer( 150 ); 148 // startTimer( 150 );
@@ -178,37 +178,37 @@ void AudioWidget::loadSkin()
178 time.setFocusPolicy( QWidget::NoFocus ); 178 time.setFocusPolicy( QWidget::NoFocus );
179 time.setAlignment( Qt::AlignCenter ); 179 time.setAlignment( Qt::AlignCenter );
180 180
181// time.setFrame(FALSE); 181// time.setFrame(FALSE);
182// changeTextColor( &time ); 182// changeTextColor( &time );
183 183
184 resizeEvent( 0 ); 184 resizeEvent( 0 );
185} 185}
186 186
187void AudioWidget::setSeekable( bool isSeekable ) { 187void AudioWidget::setSeekable( bool isSeekable ) {
188 188
189 if ( !isSeekable ) { 189 if ( !isSeekable ) {
190 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 190 odebug << "<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>" << oendl;
191 if( !slider.isHidden()) { 191 if( !slider.isHidden()) {
192 slider.hide(); 192 slider.hide();
193 } 193 }
194 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 194 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
195 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 195 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
196 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 196 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
197 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 197 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
198 } else { 198 } else {
199 // this stops the slider from being moved, thus 199 // this stops the slider from being moved, thus
200 // does not stop stream when it reaches the end 200 // does not stop stream when it reaches the end
201 slider.show(); 201 slider.show();
202 qDebug( " CONNECT SET POSTION " ); 202 odebug << " CONNECT SET POSTION " << oendl;
203 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 203 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
204 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 204 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
205 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 205 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
206 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 206 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
207 } 207 }
208} 208}
209 209
210 210
211static QString timeAsString( long length ) { 211static QString timeAsString( long length ) {
212 int minutes = length / 60; 212 int minutes = length / 60;
213 int seconds = length % 60; 213 int seconds = length % 60;
214 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 214 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
@@ -262,25 +262,25 @@ void AudioWidget::timerEvent( QTimerEvent * ) {
262 } else if ( skipDirection == -1 ) { 262 } else if ( skipDirection == -1 ) {
263 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 263 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
264 } 264 }
265} 265}
266 266
267void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 267void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
268 switch ( e->key() ) { 268 switch ( e->key() ) {
269 ////////////////////////////// Zaurus keys 269 ////////////////////////////// Zaurus keys
270 case Key_Home: 270 case Key_Home:
271 break; 271 break;
272 case Key_F9: //activity 272 case Key_F9: //activity
273 hide(); 273 hide();
274 // qDebug("Audio F9"); 274 // odebug << "Audio F9" << oendl;
275 e->accept(); 275 e->accept();
276 break; 276 break;
277 case Key_F10: //contacts 277 case Key_F10: //contacts
278 break; 278 break;
279 case Key_F11: //menu 279 case Key_F11: //menu
280 mediaPlayerState.toggleBlank(); 280 mediaPlayerState.toggleBlank();
281 e->accept(); 281 e->accept();
282 break; 282 break;
283 case Key_F12: //home 283 case Key_F12: //home
284 break; 284 break;
285 case Key_F13: //mail 285 case Key_F13: //mail
286 mediaPlayerState.toggleBlank(); 286 mediaPlayerState.toggleBlank();
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index a42b8e5..5c24dbe 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -97,28 +97,28 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
97 } 97 }
98 98
99 if ( initMode == InitializeImmediately ) { 99 if ( initMode == InitializeImmediately ) {
100 initialize(); 100 initialize();
101 m_initialized = true; 101 m_initialized = true;
102 } 102 }
103 else 103 else
104 start(); 104 start();
105} 105}
106 106
107void Lib::run() 107void Lib::run()
108{ 108{
109 qDebug( "Lib::run() started" ); 109 odebug << "Lib::run() started" << oendl;
110 initialize(); 110 initialize();
111 m_initialized = true; 111 m_initialized = true;
112 qDebug( "Lib::run() finished" ); 112 odebug << "Lib::run() finished" << oendl;
113} 113}
114 114
115void Lib::initialize() 115void Lib::initialize()
116{ 116{
117 m_duringInitialization = true; 117 m_duringInitialization = true;
118 m_xine = xine_new( ); 118 m_xine = xine_new( );
119 119
120 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 120 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
121 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 121 xine_config_load( m_xine, QFile::encodeName( configPath ) );
122 122
123 xine_init( m_xine ); 123 xine_init( m_xine );
124 124
@@ -206,25 +206,25 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) {
206 //m_queue = xine_event_new_queue (m_stream); 206 //m_queue = xine_event_new_queue (m_stream);
207 //xine_event_create_listener_thread (m_queue, xine_event_handler, this); 207 //xine_event_create_listener_thread (m_queue, xine_event_handler, this);
208 208
209 if ( !xine_open( m_stream, str.utf8().data() ) ) { 209 if ( !xine_open( m_stream, str.utf8().data() ) ) {
210 return 0; 210 return 0;
211 } 211 }
212 return xine_play( m_stream, startPos, start_time); 212 return xine_play( m_stream, startPos, start_time);
213} 213}
214 214
215void Lib::stop() { 215void Lib::stop() {
216 assert( m_initialized ); 216 assert( m_initialized );
217 217
218 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 218 odebug << "<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>" << oendl;
219 xine_stop( m_stream ); 219 xine_stop( m_stream );
220} 220}
221 221
222void Lib::pause( bool toggle ) { 222void Lib::pause( bool toggle ) {
223 assert( m_initialized ); 223 assert( m_initialized );
224 224
225 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); 225 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
226} 226}
227 227
228int Lib::speed() const { 228int Lib::speed() const {
229 assert( m_initialized ); 229 assert( m_initialized );
230 230
@@ -318,27 +318,27 @@ QString Lib::metaInfo( int number) const {
318 318
319int Lib::error() const { 319int Lib::error() const {
320 assert( m_initialized ); 320 assert( m_initialized );
321 321
322 return xine_get_error( m_stream ); 322 return xine_get_error( m_stream );
323}; 323};
324 324
325void Lib::ensureInitialized() 325void Lib::ensureInitialized()
326{ 326{
327 if ( m_initialized ) 327 if ( m_initialized )
328 return; 328 return;
329 329
330 qDebug( "waiting for initialization thread to finish" ); 330 odebug << "waiting for initialization thread to finish" << oendl;
331 wait(); 331 wait();
332 qDebug( "initialization thread finished!" ); 332 odebug << "initialization thread finished!" << oendl;
333} 333}
334 334
335void Lib::setWidget( XineVideoWidget *widget ) 335void Lib::setWidget( XineVideoWidget *widget )
336{ 336{
337 m_wid = widget; 337 m_wid = widget;
338 resize ( m_wid-> size ( ) ); 338 resize ( m_wid-> size ( ) );
339 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 339 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
340 m_wid->repaint(); 340 m_wid->repaint();
341} 341}
342 342
343void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) 343void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
344{ 344{
@@ -413,20 +413,20 @@ void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) {
413 ( (Lib*)user_data)->handleXineEvent( t ); 413 ( (Lib*)user_data)->handleXineEvent( t );
414} 414}
415 415
416void Lib::xine_display_frame( void* user_data, uint8_t *frame, 416void Lib::xine_display_frame( void* user_data, uint8_t *frame,
417 int width, int height, int bytes ) { 417 int width, int height, int bytes ) {
418 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 418 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
419} 419}
420 420
421void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 421void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
422 assert( m_initialized ); 422 assert( m_initialized );
423 423
424 if ( !m_video ) { 424 if ( !m_video ) {
425 qWarning("not showing video now"); 425 owarn << "not showing video now" << oendl;
426 return; 426 return;
427 } 427 }
428 428
429 assert( m_wid ); 429 assert( m_wid );
430 430
431 m_wid-> setVideoFrame ( frame, width, height, bytes ); 431 m_wid-> setVideoFrame ( frame, width, height, bytes );
432} 432}
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index a236775..7e38fc7 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -143,25 +143,25 @@ void MediaPlayer::next() {
143 143
144 if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist 144 if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
145 if ( playList.next() ) { 145 if ( playList.next() ) {
146 play(); 146 play();
147 } else if ( mediaPlayerState.isLooping() ) { 147 } else if ( mediaPlayerState.isLooping() ) {
148 if ( playList.first() ) { 148 if ( playList.first() ) {
149 play(); 149 play();
150 } 150 }
151 } else { 151 } else {
152 mediaPlayerState.setList(); 152 mediaPlayerState.setList();
153 } 153 }
154 } else { //if playing from file list, let's just stop 154 } else { //if playing from file list, let's just stop
155 qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); 155 odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl;
156 mediaPlayerState.setPlaying(false); 156 mediaPlayerState.setPlaying(false);
157 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); 157 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection );
158 if(l) mediaPlayerState.setLooping(l); 158 if(l) mediaPlayerState.setLooping(l);
159 if(r) mediaPlayerState.setShuffled(r); 159 if(r) mediaPlayerState.setShuffled(r);
160 } 160 }
161 qApp->processEvents(); 161 qApp->processEvents();
162} 162}
163 163
164 164
165void MediaPlayer::startDecreasingVolume() { 165void MediaPlayer::startDecreasingVolume() {
166 volumeDirection = -1; 166 volumeDirection = -1;
167 startTimer( 100 ); 167 startTimer( 100 );
@@ -276,69 +276,69 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
276 } 276 }
277 } 277 }
278} 278}
279 279
280 280
281void MediaPlayer::blank( bool b ) { 281void MediaPlayer::blank( bool b ) {
282 fd=open("/dev/fb0",O_RDWR); 282 fd=open("/dev/fb0",O_RDWR);
283#ifdef QT_QWS_SL5XXX 283#ifdef QT_QWS_SL5XXX
284 fl= open( "/dev/fl", O_RDWR ); 284 fl= open( "/dev/fl", O_RDWR );
285#endif 285#endif
286 if (fd != -1) { 286 if (fd != -1) {
287 if ( b ) { 287 if ( b ) {
288 qDebug("do blanking"); 288 odebug << "do blanking" << oendl;
289#ifdef QT_QWS_SL5XXX 289#ifdef QT_QWS_SL5XXX
290 ioctl( fd, FBIOBLANK, 1 ); 290 ioctl( fd, FBIOBLANK, 1 );
291 if(fl !=-1) { 291 if(fl !=-1) {
292 ioctl( fl, 2 ); 292 ioctl( fl, 2 );
293 ::close(fl); 293 ::close(fl);
294 } 294 }
295#else 295#else
296 ioctl( fd, FBIOBLANK, 3 ); 296 ioctl( fd, FBIOBLANK, 3 );
297#endif 297#endif
298 isBlanked = TRUE; 298 isBlanked = TRUE;
299 } else { 299 } else {
300 qDebug("do unblanking"); 300 odebug << "do unblanking" << oendl;
301 ioctl( fd, FBIOBLANK, 0); 301 ioctl( fd, FBIOBLANK, 0);
302#ifdef QT_QWS_SL5XXX 302#ifdef QT_QWS_SL5XXX
303 if(fl != -1) { 303 if(fl != -1) {
304 ioctl( fl, 1); 304 ioctl( fl, 1);
305 ::close(fl); 305 ::close(fl);
306 } 306 }
307#endif 307#endif
308 isBlanked = FALSE; 308 isBlanked = FALSE;
309 } 309 }
310 close( fd ); 310 close( fd );
311 } else { 311 } else {
312 qDebug("<< /dev/fb0 could not be opened >>"); 312 odebug << "<< /dev/fb0 could not be opened >>" << oendl;
313 } 313 }
314} 314}
315 315
316void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 316void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
317 switch ( e->key() ) { 317 switch ( e->key() ) {
318////////////////////////////// Zaurus keys 318////////////////////////////// Zaurus keys
319 case Key_Home: 319 case Key_Home:
320 break; 320 break;
321 case Key_F9: //activity 321 case Key_F9: //activity
322 break; 322 break;
323 case Key_F10: //contacts 323 case Key_F10: //contacts
324 break; 324 break;
325 case Key_F11: //menu 325 case Key_F11: //menu
326 break; 326 break;
327 case Key_F12: //home 327 case Key_F12: //home
328 qDebug("Blank here"); 328 odebug << "Blank here" << oendl;
329// mediaPlayerState->toggleBlank(); 329// mediaPlayerState->toggleBlank();
330 break; 330 break;
331 case Key_F13: //mail 331 case Key_F13: //mail
332 qDebug("Blank here"); 332 odebug << "Blank here" << oendl;
333 // mediaPlayerState->toggleBlank(); 333 // mediaPlayerState->toggleBlank();
334 break; 334 break;
335 } 335 }
336} 336}
337 337
338void MediaPlayer::cleanUp() {// this happens on closing 338void MediaPlayer::cleanUp() {// this happens on closing
339 Config cfg( "OpiePlayer" ); 339 Config cfg( "OpiePlayer" );
340 mediaPlayerState.writeConfig( cfg ); 340 mediaPlayerState.writeConfig( cfg );
341 playList.writeDefaultPlaylist( ); 341 playList.writeDefaultPlaylist( );
342 342
343// QPEApplication::grabKeyboard(); 343// QPEApplication::grabKeyboard();
344// QPEApplication::ungrabKeyboard(); 344// QPEApplication::ungrabKeyboard();
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp
index 26d5e15..95dbab5 100644
--- a/noncore/multimedia/opieplayer2/om3u.cpp
+++ b/noncore/multimedia/opieplayer2/om3u.cpp
@@ -28,68 +28,68 @@
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "om3u.h" 32#include "om3u.h"
33 33
34 34
35 35
36//extern PlayListWidget *playList; 36//extern PlayListWidget *playList;
37 37
38Om3u::Om3u( const QString &filePath, int mode) 38Om3u::Om3u( const QString &filePath, int mode)
39 : QStringList (){ 39 : QStringList (){
40qDebug("<<<<<<<new m3u "+filePath); 40odebug << "<<<<<<<new m3u "+filePath << oendl;
41 f.setName(filePath); 41 f.setName(filePath);
42 f.open(mode); 42 f.open(mode);
43} 43}
44 44
45Om3u::~Om3u(){} 45Om3u::~Om3u(){}
46 46
47void Om3u::readM3u() { 47void Om3u::readM3u() {
48// qDebug("<<<<<<reading m3u "+f.name()); 48// odebug << "<<<<<<reading m3u "+f.name() << oendl;
49 QTextStream t(&f); 49 QTextStream t(&f);
50 t.setEncoding(QTextStream::UnicodeUTF8); 50 t.setEncoding(QTextStream::UnicodeUTF8);
51 QString s; 51 QString s;
52 while ( !t.atEnd() ) { 52 while ( !t.atEnd() ) {
53 s=t.readLine(); 53 s=t.readLine();
54// qDebug(s); 54// odebug << s << oendl;
55 if( s.find( "#", 0, TRUE) == -1 ) { 55 if( s.find( "#", 0, TRUE) == -1 ) {
56 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 56 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
57 s = s.right( s.length() -2 ); 57 s = s.right( s.length() -2 );
58 QFileInfo f( s ); 58 QFileInfo f( s );
59 QString name = f.baseName(); 59 QString name = f.baseName();
60 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 60 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
61 s=s.replace( QRegExp( "\\" ), "/" ); 61 s=s.replace( QRegExp( "\\" ), "/" );
62 append(s); 62 append(s);
63// qDebug(s); 63// odebug << s << oendl;
64 } else { // is url 64 } else { // is url
65 QString name; 65 QString name;
66 name = s; 66 name = s;
67 append(name); 67 append(name);
68 } 68 }
69 } 69 }
70 } 70 }
71} 71}
72 72
73void Om3u::readPls() { //it's a pls file 73void Om3u::readPls() { //it's a pls file
74 QTextStream t( &f ); 74 QTextStream t( &f );
75 t.setEncoding(QTextStream::UnicodeUTF8); 75 t.setEncoding(QTextStream::UnicodeUTF8);
76 QString s; 76 QString s;
77 while ( !t.atEnd() ) { 77 while ( !t.atEnd() ) {
78 s = t.readLine(); 78 s = t.readLine();
79 if( s.left(4) == "File" ) { 79 if( s.left(4) == "File" ) {
80 s = s.right( s.length() - s.find("=",0,true)-1 ); 80 s = s.right( s.length() - s.find("=",0,true)-1 );
81 s = s.stripWhiteSpace(); 81 s = s.stripWhiteSpace();
82 s.replace( QRegExp( "%20" )," "); 82 s.replace( QRegExp( "%20" )," ");
83// qDebug( "adding " + s + " to playlist" ); 83// odebug << "adding " + s + " to playlist" << oendl;
84 // numberofentries=2 84 // numberofentries=2
85 // File1=http 85 // File1=http
86 // Title 86 // Title
87 // Length 87 // Length
88 // Version 88 // Version
89 // File2=http 89 // File2=http
90 s = s.replace( QRegExp( "\\" ), "/" ); 90 s = s.replace( QRegExp( "\\" ), "/" );
91 QFileInfo f( s ); 91 QFileInfo f( s );
92 QString name = f.baseName(); 92 QString name = f.baseName();
93 if( name.left( 4 ) == "http" ) { 93 if( name.left( 4 ) == "http" ) {
94 name = s.right( s.length() - 7); 94 name = s.right( s.length() - 7);
95 } else { 95 } else {
@@ -105,41 +105,41 @@ void Om3u::readPls() { //it's a pls file
105 append(s); 105 append(s);
106 } 106 }
107 } 107 }
108 } 108 }
109} 109}
110 110
111void Om3u::write() { //writes list to m3u file 111void Om3u::write() { //writes list to m3u file
112 QString list; 112 QString list;
113 QTextStream t(&f); 113 QTextStream t(&f);
114 t.setEncoding(QTextStream::UnicodeUTF8); 114 t.setEncoding(QTextStream::UnicodeUTF8);
115 if(count()>0) { 115 if(count()>0) {
116 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 116 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
117// qDebug(*it); 117// odebug << *it << oendl;
118 t << *it << "\n"; 118 t << *it << "\n";
119 } 119 }
120 } 120 }
121// f.close(); 121// f.close();
122} 122}
123 123
124void Om3u::add(const QString &filePath) { //adds to m3u file 124void Om3u::add(const QString &filePath) { //adds to m3u file
125 append(filePath); 125 append(filePath);
126} 126}
127 127
128void Om3u::remove(const QString &filePath) { //removes from m3u list 128void Om3u::remove(const QString &filePath) { //removes from m3u list
129 QString list, currentFile; 129 QString list, currentFile;
130 if(count()>0) { 130 if(count()>0) {
131 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 131 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
132 currentFile=*it; 132 currentFile=*it;
133 // qDebug(*it); 133 // odebug << *it << oendl;
134 134
135 if( filePath != currentFile) 135 if( filePath != currentFile)
136 list += currentFile+"\n"; 136 list += currentFile+"\n";
137 } 137 }
138 f.writeBlock( list, list.length() ); 138 f.writeBlock( list, list.length() );
139 } 139 }
140} 140}
141 141
142void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file 142void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file
143 f.close(); 143 f.close();
144 f.remove(); 144 f.remove();
145 145
diff --git a/noncore/multimedia/opieplayer2/playlistselection.cpp b/noncore/multimedia/opieplayer2/playlistselection.cpp
index 015896f..3499837 100644
--- a/noncore/multimedia/opieplayer2/playlistselection.cpp
+++ b/noncore/multimedia/opieplayer2/playlistselection.cpp
@@ -35,46 +35,46 @@ public:
35 }; 35 };
36 36
37 const DocLnk *file() const { return fl; } 37 const DocLnk *file() const { return fl; }
38 38
39private: 39private:
40 const DocLnk *fl; 40 const DocLnk *fl;
41}; 41};
42 42
43 43
44PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) 44PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
45 : QListView( parent, name ) 45 : QListView( parent, name )
46{ 46{
47// qDebug("starting playlistselector"); 47// odebug << "starting playlistselector" << oendl;
48// #ifdef USE_PLAYLIST_BACKGROUND 48// #ifdef USE_PLAYLIST_BACKGROUND
49// setStaticBackground( TRUE ); 49// setStaticBackground( TRUE );
50// setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); 50// setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) );
51 51
52// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); 52// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) );
53// #endif 53// #endif
54// addColumn("Title",236); 54// addColumn("Title",236);
55// setAllColumnsShowFocus( TRUE ); 55// setAllColumnsShowFocus( TRUE );
56 addColumn( tr( "Playlist Selection" ) ); 56 addColumn( tr( "Playlist Selection" ) );
57 header()->hide(); 57 header()->hide();
58 setSorting( -1, FALSE ); 58 setSorting( -1, FALSE );
59} 59}
60 60
61 61
62PlayListSelection::~PlayListSelection() { 62PlayListSelection::~PlayListSelection() {
63} 63}
64 64
65 65
66// #ifdef USE_PLAYLIST_BACKGROUND 66// #ifdef USE_PLAYLIST_BACKGROUND
67void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { 67void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
68// qDebug("drawBackground"); 68// odebug << "drawBackground" << oendl;
69 p->fillRect( r, QBrush( white ) ); 69 p->fillRect( r, QBrush( white ) );
70// QImage logo = Resource::loadImage( "launcher/opielogo" ); 70// QImage logo = Resource::loadImage( "launcher/opielogo" );
71// if ( !logo.isNull() ) 71// if ( !logo.isNull() )
72// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 72// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
73} 73}
74// #endif 74// #endif
75 75
76 76
77void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { 77void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
78 if ( event->state() == QMouseEvent::LeftButton ) { 78 if ( event->state() == QMouseEvent::LeftButton ) {
79 QListViewItem *currentItem = selectedItem(); 79 QListViewItem *currentItem = selectedItem();
80 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); 80 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
@@ -175,32 +175,32 @@ bool PlayListSelection::last() {
175 175
176void PlayListSelection::unSelect() 176void PlayListSelection::unSelect()
177{ 177{
178 //QListViewItem *item = selectedItem(); 178 //QListViewItem *item = selectedItem();
179 setSelected( currentItem(), FALSE); 179 setSelected( currentItem(), FALSE);
180} 180}
181 181
182void PlayListSelection::writeCurrent( Config& cfg ) { 182void PlayListSelection::writeCurrent( Config& cfg ) {
183 cfg.setGroup("PlayList"); 183 cfg.setGroup("PlayList");
184 QListViewItem *item = selectedItem(); 184 QListViewItem *item = selectedItem();
185 if ( item ) 185 if ( item )
186 cfg.writeEntry("current", item->text(0) ); 186 cfg.writeEntry("current", item->text(0) );
187 qDebug(item->text(0)); 187 odebug << item->text(0) << oendl;
188 188
189} 189}
190 190
191void PlayListSelection::setSelectedItem(const QString &strk ) { 191void PlayListSelection::setSelectedItem(const QString &strk ) {
192 192
193 unSelect(); 193 unSelect();
194 QListViewItemIterator it( this ); 194 QListViewItemIterator it( this );
195 for ( ; it.current(); ++it ) { 195 for ( ; it.current(); ++it ) {
196// qDebug( it.current()->text(0)); 196// odebug << it.current()->text(0) << oendl;
197 if( strk == it.current()->text(0)) { 197 if( strk == it.current()->text(0)) {
198// qDebug( "We have a match "+strk); 198// odebug << "We have a match "+strk << oendl;
199 setSelected( it.current(), TRUE); 199 setSelected( it.current(), TRUE);
200 ensureItemVisible( it.current() ); 200 ensureItemVisible( it.current() );
201 return; 201 return;
202 } 202 }
203 } 203 }
204// setSelected( item, TRUE ); 204// setSelected( item, TRUE );
205// ensureItemVisible( selectedItem() ); 205// ensureItemVisible( selectedItem() );
206} 206}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 4460833..956d206 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -173,29 +173,29 @@ void PlayListWidget::initializeStates() {
173 d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); 173 d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
174 d->playListFrame->show(); 174 d->playListFrame->show();
175} 175}
176 176
177void PlayListWidget::writeDefaultPlaylist() { 177void PlayListWidget::writeDefaultPlaylist() {
178 178
179 Config config( "OpiePlayer" ); 179 Config config( "OpiePlayer" );
180 config.setGroup( "PlayList" ); 180 config.setGroup( "PlayList" );
181 QString filename=QPEApplication::documentDir() + "/default.m3u"; 181 QString filename=QPEApplication::documentDir() + "/default.m3u";
182 QString currentString = config.readEntry( "CurrentPlaylist", filename); 182 QString currentString = config.readEntry( "CurrentPlaylist", filename);
183 if( currentString == filename) { 183 if( currentString == filename) {
184 Om3u *m3uList; 184 Om3u *m3uList;
185 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 185 // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl;
186 if( d->selectedFiles->first() ) { 186 if( d->selectedFiles->first() ) {
187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
188 do { 188 do {
189 // qDebug(d->selectedFiles->current()->file()); 189 // odebug << d->selectedFiles->current()->file() << oendl;
190 m3uList->add( d->selectedFiles->current()->file() ); 190 m3uList->add( d->selectedFiles->current()->file() );
191 } 191 }
192 while ( d->selectedFiles->next() ); 192 while ( d->selectedFiles->next() );
193 193
194 m3uList->write(); 194 m3uList->write();
195 m3uList->close(); 195 m3uList->close();
196 delete m3uList; 196 delete m3uList;
197 197
198 } 198 }
199 } 199 }
200} 200}
201 201
@@ -316,25 +316,25 @@ void PlayListWidget::addAllVideoToList() {
316 filename = videoIt.current()->text(3); 316 filename = videoIt.current()->text(3);
317 lnk.setName( QFileInfo(filename).baseName() ); //sets name 317 lnk.setName( QFileInfo(filename).baseName() ); //sets name
318 lnk.setFile( filename ); //sets file name 318 lnk.setFile( filename ); //sets file name
319 d->selectedFiles->addToSelection( lnk); 319 d->selectedFiles->addToSelection( lnk);
320 } 320 }
321 tabWidget->setCurrentPage(0); 321 tabWidget->setCurrentPage(0);
322 writeCurrentM3u(); 322 writeCurrentM3u();
323 d->selectedFiles->first(); 323 d->selectedFiles->first();
324} 324}
325 325
326 326
327void PlayListWidget::setDocument( const QString& fileref ) { 327void PlayListWidget::setDocument( const QString& fileref ) {
328 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 328 // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl;
329 fromSetDocument = TRUE; 329 fromSetDocument = TRUE;
330 QFileInfo fileInfo(fileref); 330 QFileInfo fileInfo(fileref);
331 331
332 if ( !fileInfo.exists() ) { 332 if ( !fileInfo.exists() ) {
333 QMessageBox::warning( this, tr( "Invalid File" ), 333 QMessageBox::warning( this, tr( "Invalid File" ),
334 tr( "There was a problem in getting the file." ) ); 334 tr( "There was a problem in getting the file." ) );
335 return; 335 return;
336 } 336 }
337 337
338 clearList(); 338 clearList();
339 QString extension = fileInfo.extension(false); 339 QString extension = fileInfo.extension(false);
340 340
@@ -392,25 +392,25 @@ bool PlayListWidget::prev() {
392 if ( mediaPlayerState->isLooping() ) { 392 if ( mediaPlayerState->isLooping() ) {
393 return d->selectedFiles->last(); 393 return d->selectedFiles->last();
394 } else { 394 } else {
395 return FALSE; 395 return FALSE;
396 } 396 }
397 } 397 }
398 return TRUE; 398 return TRUE;
399 } 399 }
400} 400}
401 401
402 402
403bool PlayListWidget::next() { 403bool PlayListWidget::next() {
404//qDebug("<<<<<<<<<<<<next()"); 404//odebug << "<<<<<<<<<<<<next()" << oendl;
405 if ( mediaPlayerState->isShuffled() ) { 405 if ( mediaPlayerState->isShuffled() ) {
406 return prev(); 406 return prev();
407 } else { 407 } else {
408 if ( !d->selectedFiles->next() ) { 408 if ( !d->selectedFiles->next() ) {
409 if ( mediaPlayerState->isLooping() ) { 409 if ( mediaPlayerState->isLooping() ) {
410 return d->selectedFiles->first(); 410 return d->selectedFiles->first();
411 } else { 411 } else {
412 return FALSE; 412 return FALSE;
413 } 413 }
414 } 414 }
415 return TRUE; 415 return TRUE;
416 } 416 }
@@ -603,25 +603,25 @@ bool PlayListWidget::inFileListMode() const
603 return tab == AudioFiles || tab == VideoFiles; 603 return tab == AudioFiles || tab == VideoFiles;
604} 604}
605 605
606void PlayListWidget::openURL() { 606void PlayListWidget::openURL() {
607 // http://66.28.164.33:2080 607 // http://66.28.164.33:2080
608 // http://somafm.com/star0242.m3u 608 // http://somafm.com/star0242.m3u
609 QString filename, name; 609 QString filename, name;
610 InputDialog *fileDlg; 610 InputDialog *fileDlg;
611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); 611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0);
612 fileDlg->exec(); 612 fileDlg->exec();
613 if( fileDlg->result() == 1 ) { 613 if( fileDlg->result() == 1 ) {
614 filename = fileDlg->text(); 614 filename = fileDlg->text();
615 qDebug( "Selected filename is " + filename ); 615 odebug << "Selected filename is " + filename << oendl;
616 // Om3u *m3uList; 616 // Om3u *m3uList;
617 DocLnk lnk; 617 DocLnk lnk;
618 Config cfg( "OpiePlayer" ); 618 Config cfg( "OpiePlayer" );
619 cfg.setGroup("PlayList"); 619 cfg.setGroup("PlayList");
620 620
621 if(filename.left(4) == "http") { 621 if(filename.left(4) == "http") {
622 QString m3uFile, m3uFilePath; 622 QString m3uFile, m3uFilePath;
623 if(filename.find(":",8,TRUE) != -1) { //found a port 623 if(filename.find(":",8,TRUE) != -1) { //found a port
624 m3uFile = filename.left( filename.find( ":",8,TRUE)); 624 m3uFile = filename.left( filename.find( ":",8,TRUE));
625 m3uFile = m3uFile.right( 7); 625 m3uFile = m3uFile.right( 7);
626 } else if(filename.left(4) == "http"){ 626 } else if(filename.left(4) == "http"){
627 m3uFile=filename; 627 m3uFile=filename;
@@ -679,56 +679,56 @@ void PlayListWidget::openFile() {
679 679
680 QString str = OFileDialog::getOpenFileName( 1, 680 QString str = OFileDialog::getOpenFileName( 1,
681 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", 681 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"",
682 types, 0 ); 682 types, 0 );
683 683
684 if(str.left(2) == "//") { 684 if(str.left(2) == "//") {
685 str=str.right(str.length()-1); 685 str=str.right(str.length()-1);
686 } 686 }
687 cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); 687 cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() );
688 688
689 if( !str.isEmpty() ) { 689 if( !str.isEmpty() ) {
690 690
691 qDebug( "Selected filename is " + str ); 691 odebug << "Selected filename is " + str << oendl;
692 filename = str; 692 filename = str;
693 DocLnk lnk; 693 DocLnk lnk;
694 694
695 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { 695 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
696 readListFromFile( filename ); 696 readListFromFile( filename );
697 } else { 697 } else {
698 lnk.setName( QFileInfo(filename).baseName() ); //sets name 698 lnk.setName( QFileInfo(filename).baseName() ); //sets name
699 lnk.setFile( filename ); //sets file name 699 lnk.setFile( filename ); //sets file name
700 d->selectedFiles->addToSelection( lnk ); 700 d->selectedFiles->addToSelection( lnk );
701 writeCurrentM3u(); 701 writeCurrentM3u();
702 d->selectedFiles->setSelectedItem( lnk.name() ); 702 d->selectedFiles->setSelectedItem( lnk.name() );
703 } 703 }
704 } 704 }
705} 705}
706 706
707 707
708void PlayListWidget::readListFromFile( const QString &filename ) { 708void PlayListWidget::readListFromFile( const QString &filename ) {
709 qDebug( "read list filename " + filename ); 709 odebug << "read list filename " + filename << oendl;
710 QFileInfo fi(filename); 710 QFileInfo fi(filename);
711 Om3u *m3uList; 711 Om3u *m3uList;
712 QString s, name; 712 QString s, name;
713 m3uList = new Om3u( filename, IO_ReadOnly ); 713 m3uList = new Om3u( filename, IO_ReadOnly );
714 if(fi.extension(false).find("m3u",0,false) != -1 ) 714 if(fi.extension(false).find("m3u",0,false) != -1 )
715 m3uList->readM3u(); 715 m3uList->readM3u();
716 else if(fi.extension(false).find("pls",0,false) != -1 ) 716 else if(fi.extension(false).find("pls",0,false) != -1 )
717 m3uList->readPls(); 717 m3uList->readPls();
718 718
719 DocLnk lnk; 719 DocLnk lnk;
720 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 720 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
721 s = *it; 721 s = *it;
722 // qDebug(s); 722 // odebug << s << oendl;
723 if(s.left(4)=="http") { 723 if(s.left(4)=="http") {
724 lnk.setName( s ); //sets file name 724 lnk.setName( s ); //sets file name
725 lnk.setIcon("opieplayer2/musicfile"); 725 lnk.setIcon("opieplayer2/musicfile");
726 lnk.setFile( s ); //sets file name 726 lnk.setFile( s ); //sets file name
727 727
728 } else { //is file 728 } else { //is file
729 lnk.setName( QFileInfo(s).baseName()); 729 lnk.setName( QFileInfo(s).baseName());
730 if(s.left(1) != "/") { 730 if(s.left(1) != "/") {
731 731
732 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 732 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
733 } else { 733 } else {
734 lnk.setFile( s); 734 lnk.setFile( s);
@@ -744,39 +744,39 @@ void PlayListWidget::readListFromFile( const QString &filename ) {
744 currentPlayList=filename; 744 currentPlayList=filename;
745 745
746 m3uList->close(); 746 m3uList->close();
747 delete m3uList; 747 delete m3uList;
748 748
749 d->selectedFiles->setSelectedItem( s); 749 d->selectedFiles->setSelectedItem( s);
750 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 750 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
751 751
752} 752}
753 753
754// writes current playlist to current m3u file */ 754// writes current playlist to current m3u file */
755 void PlayListWidget::writeCurrentM3u() { 755 void PlayListWidget::writeCurrentM3u() {
756 qDebug("writing to current m3u"); 756 odebug << "writing to current m3u" << oendl;
757 Config cfg( "OpiePlayer" ); 757 Config cfg( "OpiePlayer" );
758 cfg.setGroup("PlayList"); 758 cfg.setGroup("PlayList");
759 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 759 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
760 760
761 Om3u *m3uList; 761 Om3u *m3uList;
762 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 762 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
763 if( d->selectedFiles->first()) { 763 if( d->selectedFiles->first()) {
764 764
765 do { 765 do {
766 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); 766 // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl;
767 m3uList->add( d->selectedFiles->current()->file() ); 767 m3uList->add( d->selectedFiles->current()->file() );
768 } 768 }
769 while ( d->selectedFiles->next() ); 769 while ( d->selectedFiles->next() );
770 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 770 // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl;
771 m3uList->write(); 771 m3uList->write();
772 m3uList->close(); 772 m3uList->close();
773 } 773 }
774 delete m3uList; 774 delete m3uList;
775 775
776 } 776 }
777 777
778 /* 778 /*
779 writes current playlist to m3u file */ 779 writes current playlist to m3u file */
780void PlayListWidget::writem3u() { 780void PlayListWidget::writem3u() {
781 //InputDilog *fileDlg; 781 //InputDilog *fileDlg;
782 //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 782 //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
@@ -803,63 +803,63 @@ void PlayListWidget::writem3u() {
803 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", 803 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"",
804 types, 0 ); 804 types, 0 );
805 if(str.left(2) == "//") str=str.right(str.length()-1); 805 if(str.left(2) == "//") str=str.right(str.length()-1);
806 cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); 806 cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath());
807 807
808 808
809 QString name, filename, list; 809 QString name, filename, list;
810 Om3u *m3uList; 810 Om3u *m3uList;
811 811
812 if( !str.isEmpty() ) { 812 if( !str.isEmpty() ) {
813 name = str; 813 name = str;
814 // name = fileDlg->text(); 814 // name = fileDlg->text();
815// qDebug( filename ); 815// odebug << filename << oendl;
816 if( name.find("/",0,true) != -1) {// assume they specify a file path 816 if( name.find("/",0,true) != -1) {// assume they specify a file path
817 filename = name; 817 filename = name;
818 name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); 818 name = name.right(name.length()- name.findRev("/",-1,true) - 1 );
819 } 819 }
820 else //otherwise dump it somewhere noticable 820 else //otherwise dump it somewhere noticable
821 filename = QPEApplication::documentDir() + "/" + name; 821 filename = QPEApplication::documentDir() + "/" + name;
822 822
823 if( filename.right( 3 ) != "m3u" ) //needs filename extension 823 if( filename.right( 3 ) != "m3u" ) //needs filename extension
824 filename += ".m3u"; 824 filename += ".m3u";
825 825
826 if( d->selectedFiles->first()) { //ramble through playlist view 826 if( d->selectedFiles->first()) { //ramble through playlist view
827 m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); 827 m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate);
828 828
829 do { 829 do {
830 m3uList->add( d->selectedFiles->current()->file()); 830 m3uList->add( d->selectedFiles->current()->file());
831 } 831 }
832 while ( d->selectedFiles->next() ); 832 while ( d->selectedFiles->next() );
833 // qDebug( list ); 833 // odebug << list << oendl;
834 m3uList->write(); 834 m3uList->write();
835 m3uList->close(); 835 m3uList->close();
836 delete m3uList; 836 delete m3uList;
837 837
838 //delete fileDlg; 838 //delete fileDlg;
839 839
840 DocLnk lnk; 840 DocLnk lnk;
841 lnk.setFile( filename); 841 lnk.setFile( filename);
842 lnk.setIcon("opieplayer2/playlist2"); 842 lnk.setIcon("opieplayer2/playlist2");
843 lnk.setName( name); //sets file name 843 lnk.setName( name); //sets file name
844 844
845 // qDebug(filename); 845 // odebug << filename << oendl;
846 Config config( "OpiePlayer" ); 846 Config config( "OpiePlayer" );
847 config.setGroup( "PlayList" ); 847 config.setGroup( "PlayList" );
848 848
849 config.writeEntry("CurrentPlaylist",filename); 849 config.writeEntry("CurrentPlaylist",filename);
850 currentPlayList=filename; 850 currentPlayList=filename;
851 851
852 if(!lnk.writeLink()) { 852 if(!lnk.writeLink()) {
853 qDebug("Writing doclink did not work"); 853 odebug << "Writing doclink did not work" << oendl;
854 } 854 }
855 855
856 setCaption(tr("OpiePlayer: ") + name); 856 setCaption(tr("OpiePlayer: ") + name);
857 } 857 }
858 } 858 }
859} 859}
860 860
861void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 861void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
862 switch ( e->key() ) { 862 switch ( e->key() ) {
863 ////////////////////////////// Zaurus keys 863 ////////////////////////////// Zaurus keys
864 case Key_F9: //activity 864 case Key_F9: //activity
865 // if(audioUI->isHidden()) 865 // if(audioUI->isHidden())
@@ -875,25 +875,25 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
875 // doBlank(); 875 // doBlank();
876 break; 876 break;
877 case Key_F13: //mail 877 case Key_F13: //mail
878 // doUnblank(); 878 // doUnblank();
879 break; 879 break;
880 case Key_Q: //add to playlist 880 case Key_Q: //add to playlist
881 addSelected(); 881 addSelected();
882 break; 882 break;
883 case Key_R: //remove from playlist 883 case Key_R: //remove from playlist
884 removeSelected(); 884 removeSelected();
885 break; 885 break;
886 // case Key_P: //play 886 // case Key_P: //play
887 // qDebug("Play"); 887 // odebug << "Play" << oendl;
888 // playSelected(); 888 // playSelected();
889 // break; 889 // break;
890 case Key_Space: 890 case Key_Space:
891 // playSelected(); puh 891 // playSelected(); puh
892 break; 892 break;
893 case Key_1: 893 case Key_1:
894 tabWidget->setCurrentPage( 0 ); 894 tabWidget->setCurrentPage( 0 );
895 break; 895 break;
896 case Key_2: 896 case Key_2:
897 tabWidget->setCurrentPage( 1 ); 897 tabWidget->setCurrentPage( 1 );
898 break; 898 break;
899 case Key_3: 899 case Key_3:
@@ -905,25 +905,25 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
905 case Key_Down: 905 case Key_Down:
906 if ( !d->selectedFiles->next() ) 906 if ( !d->selectedFiles->next() )
907 d->selectedFiles->first(); 907 d->selectedFiles->first();
908 break; 908 break;
909 case Key_Up: 909 case Key_Up:
910 if ( !d->selectedFiles->prev() ) 910 if ( !d->selectedFiles->prev() )
911 // d->selectedFiles->last(); 911 // d->selectedFiles->last();
912 break; 912 break;
913 } 913 }
914} 914}
915 915
916void PlayListWidget::pmViewActivated(int index) { 916void PlayListWidget::pmViewActivated(int index) {
917// qDebug("%d", index); 917// odebug << "" << index << "" << oendl;
918 switch(index) { 918 switch(index) {
919 case -16: 919 case -16:
920 { 920 {
921 mediaPlayerState->toggleFullscreen(); 921 mediaPlayerState->toggleFullscreen();
922 bool b=mediaPlayerState->isFullscreen(); 922 bool b=mediaPlayerState->isFullscreen();
923 pmView->setItemChecked( index, b); 923 pmView->setItemChecked( index, b);
924 Config cfg( "OpiePlayer" ); 924 Config cfg( "OpiePlayer" );
925 cfg.writeEntry( "FullScreen", b ); 925 cfg.writeEntry( "FullScreen", b );
926 } 926 }
927 break; 927 break;
928 }; 928 };
929} 929}
@@ -935,25 +935,25 @@ void PlayListWidget::populateSkinsMenu() {
935 Config cfg( "OpiePlayer" ); 935 Config cfg( "OpiePlayer" );
936 cfg.setGroup("Options" ); 936 cfg.setGroup("Options" );
937 QString skin = cfg.readEntry( "Skin", "default" ); 937 QString skin = cfg.readEntry( "Skin", "default" );
938 938
939 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 939 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
940 skinsDir.setFilter( QDir::Dirs ); 940 skinsDir.setFilter( QDir::Dirs );
941 skinsDir.setSorting(QDir::Name ); 941 skinsDir.setSorting(QDir::Name );
942 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 942 const QFileInfoList *skinslist = skinsDir.entryInfoList();
943 QFileInfoListIterator it( *skinslist ); 943 QFileInfoListIterator it( *skinslist );
944 QFileInfo *fi; 944 QFileInfo *fi;
945 while ( ( fi = it.current() ) ) { 945 while ( ( fi = it.current() ) ) {
946 skinName = fi->fileName(); 946 skinName = fi->fileName();
947// qDebug( fi->fileName() ); 947// odebug << fi->fileName() << oendl;
948 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 948 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
949 item = skinsMenu->insertItem( fi->fileName() ) ; 949 item = skinsMenu->insertItem( fi->fileName() ) ;
950 } 950 }
951 if( skinName == "default" ) { 951 if( skinName == "default" ) {
952 defaultSkinIndex = item; 952 defaultSkinIndex = item;
953 } 953 }
954 if( skinName == skin ) { 954 if( skinName == skin ) {
955 skinsMenu->setItemChecked( item, TRUE ); 955 skinsMenu->setItemChecked( item, TRUE );
956 } 956 }
957 ++it; 957 ++it;
958 } 958 }
959} 959}
@@ -991,25 +991,25 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const
991 return Entry( lnk->name(), lnk->file() ); 991 return Entry( lnk->name(), lnk->file() );
992 } 992 }
993 993
994 return Entry( currentFileListPathName() ); 994 return Entry( currentFileListPathName() );
995} 995}
996 996
997QString PlayListWidget::currentFileListPathName() const { 997QString PlayListWidget::currentFileListPathName() const {
998 return currentFileListView->currentItem()->text( 3 ); 998 return currentFileListView->currentItem()->text( 3 );
999} 999}
1000 1000
1001 1001
1002void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { 1002void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1003 qDebug("qcop message "+msg ); 1003 odebug << "qcop message "+msg << oendl;
1004 QDataStream stream ( data, IO_ReadOnly ); 1004 QDataStream stream ( data, IO_ReadOnly );
1005 if ( msg == "play()" ) { //plays current selection 1005 if ( msg == "play()" ) { //plays current selection
1006 btnPlay( true); 1006 btnPlay( true);
1007 } else if ( msg == "stop()" ) { 1007 } else if ( msg == "stop()" ) {
1008 mediaPlayerState->setPlaying( false); 1008 mediaPlayerState->setPlaying( false);
1009 } else if ( msg == "togglePause()" ) { 1009 } else if ( msg == "togglePause()" ) {
1010 mediaPlayerState->togglePaused(); 1010 mediaPlayerState->togglePaused();
1011 } else if ( msg == "next()" ) { //select next in list 1011 } else if ( msg == "next()" ) { //select next in list
1012 mediaPlayerState->setNext(); 1012 mediaPlayerState->setNext();
1013 } else if ( msg == "prev()" ) { //select previous in list 1013 } else if ( msg == "prev()" ) { //select previous in list
1014 mediaPlayerState->setPrev(); 1014 mediaPlayerState->setPrev();
1015 } else if ( msg == "toggleLooping()" ) { //loop or not loop 1015 } else if ( msg == "toggleLooping()" ) { //loop or not loop
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 2ff190d..922f9d7 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -174,20 +174,20 @@ PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name )
174PlayListWidgetGui::~PlayListWidgetGui() { 174PlayListWidgetGui::~PlayListWidgetGui() {
175} 175}
176 176
177void PlayListWidgetGui::setView( char view ) { 177void PlayListWidgetGui::setView( char view ) {
178 if ( view == 'l' ) 178 if ( view == 'l' )
179 showMaximized(); 179 showMaximized();
180 else 180 else
181 hide(); 181 hide();
182} 182}
183 183
184 184
185void PlayListWidgetGui::setActiveWindow() { 185void PlayListWidgetGui::setActiveWindow() {
186 // qDebug("SETTING active window"); 186 // odebug << "SETTING active window" << oendl;
187 // When we get raised we need to ensure that it switches views 187 // When we get raised we need to ensure that it switches views
188 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType(); 188 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType();
189 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate 189 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
190 mediaPlayerState->setDisplayType( origDisplayType ); // now switch back 190 mediaPlayerState->setDisplayType( origDisplayType ); // now switch back
191} 191}
192 192
193 193
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp
index 7c38983..84f5f87 100644
--- a/noncore/multimedia/opieplayer2/skin.cpp
+++ b/noncore/multimedia/opieplayer2/skin.cpp
@@ -169,29 +169,29 @@ SkinCache::SkinCache()
169 // ... and one background pixmap 169 // ... and one background pixmap
170 m_backgroundPixmapCache.setMaxCost( 1 ); 170 m_backgroundPixmapCache.setMaxCost( 1 );
171} 171}
172 172
173SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &fileNameInfix ) 173SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &fileNameInfix )
174{ 174{
175 QString key = skinPath + fileNameInfix; 175 QString key = skinPath + fileNameInfix;
176 176
177 SkinData *data = m_cache.take( key ); 177 SkinData *data = m_cache.take( key );
178 if ( !data ) 178 if ( !data )
179 data = new SkinData; 179 data = new SkinData;
180 else 180 else
181 qDebug( "SkinCache: hit" ); 181 odebug << "SkinCache: hit" << oendl;
182 182
183 QPixmap *bgPixmap = m_backgroundPixmapCache.find( skinPath ); 183 QPixmap *bgPixmap = m_backgroundPixmapCache.find( skinPath );
184 if ( bgPixmap ) { 184 if ( bgPixmap ) {
185 qDebug( "SkinCache: hit on bgpixmap" ); 185 odebug << "SkinCache: hit on bgpixmap" << oendl;
186 data->backgroundPixmap = *bgPixmap; 186 data->backgroundPixmap = *bgPixmap;
187 } 187 }
188 else 188 else
189 data->backgroundPixmap = QPixmap(); 189 data->backgroundPixmap = QPixmap();
190 190
191 return data; 191 return data;
192} 192}
193 193
194void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ) 194void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data )
195{ 195{
196 QPixmap *backgroundPixmap = new QPixmap( data->backgroundPixmap ); 196 QPixmap *backgroundPixmap = new QPixmap( data->backgroundPixmap );
197 197
@@ -209,114 +209,114 @@ void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, Sk
209} 209}
210 210
211SkinLoader::IncrementalLoader::IncrementalLoader( const Info &info ) 211SkinLoader::IncrementalLoader::IncrementalLoader( const Info &info )
212 : m_skin( info.skinName, info.fileNameInfix ), m_info( info ) 212 : m_skin( info.skinName, info.fileNameInfix ), m_info( info )
213{ 213{
214 m_currentState = LoadBackgroundPixmap; 214 m_currentState = LoadBackgroundPixmap;
215} 215}
216 216
217SkinLoader::IncrementalLoader::LoaderResult SkinLoader::IncrementalLoader::loadStep() 217SkinLoader::IncrementalLoader::LoaderResult SkinLoader::IncrementalLoader::loadStep()
218{ 218{
219 switch ( m_currentState ) { 219 switch ( m_currentState ) {
220 case LoadBackgroundPixmap: 220 case LoadBackgroundPixmap:
221 qDebug( "load bgpixmap" ); 221 odebug << "load bgpixmap" << oendl;
222 m_skin.backgroundPixmap(); 222 m_skin.backgroundPixmap();
223 m_currentState = LoadButtonUpImage; 223 m_currentState = LoadButtonUpImage;
224 break; 224 break;
225 case LoadButtonUpImage: 225 case LoadButtonUpImage:
226 qDebug( "load upimage" ); 226 odebug << "load upimage" << oendl;
227 m_skin.buttonUpImage(); 227 m_skin.buttonUpImage();
228 m_currentState = LoadButtonDownImage; 228 m_currentState = LoadButtonDownImage;
229 break; 229 break;
230 case LoadButtonDownImage: 230 case LoadButtonDownImage:
231 qDebug( "load downimage" ); 231 odebug << "load downimage" << oendl;
232 m_skin.buttonDownImage(); 232 m_skin.buttonDownImage();
233 m_currentState = LoadButtonMasks; 233 m_currentState = LoadButtonMasks;
234 m_currentButton = 0; 234 m_currentButton = 0;
235 break; 235 break;
236 case LoadButtonMasks: 236 case LoadButtonMasks:
237 qDebug( "load button masks %i", m_currentButton ); 237 odebug << "load button masks " << m_currentButton << "" << oendl;
238 m_skin.buttonMaskImage( m_info.buttonInfo[ m_currentButton ].fileName ); 238 m_skin.buttonMaskImage( m_info.buttonInfo[ m_currentButton ].fileName );
239 239
240 m_currentButton++; 240 m_currentButton++;
241 if ( m_currentButton >= m_info.buttonCount ) 241 if ( m_currentButton >= m_info.buttonCount )
242 m_currentState = LoadButtonMask; 242 m_currentState = LoadButtonMask;
243 243
244 break; 244 break;
245 case LoadButtonMask: 245 case LoadButtonMask:
246 qDebug( "load whole mask" ); 246 odebug << "load whole mask" << oendl;
247 m_skin.buttonMask( m_info.buttonInfo, m_info.buttonCount ); 247 m_skin.buttonMask( m_info.buttonInfo, m_info.buttonCount );
248 return LoadingCompleted; 248 return LoadingCompleted;
249 } 249 }
250 250
251 return MoreToCome; 251 return MoreToCome;
252} 252}
253 253
254SkinLoader::SkinLoader() 254SkinLoader::SkinLoader()
255 : m_currentLoader( 0 ), m_timerId( -1 ) 255 : m_currentLoader( 0 ), m_timerId( -1 )
256{ 256{
257} 257}
258 258
259SkinLoader::~SkinLoader() 259SkinLoader::~SkinLoader()
260{ 260{
261 qDebug( "SkinLoader::~SkinLoader()" ); 261 odebug << "SkinLoader::~SkinLoader()" << oendl;
262 killTimers(); 262 killTimers();
263 delete m_currentLoader; 263 delete m_currentLoader;
264} 264}
265 265
266void SkinLoader::schedule( const MediaWidget::GUIInfo &guiInfo ) 266void SkinLoader::schedule( const MediaWidget::GUIInfo &guiInfo )
267{ 267{
268 schedule( Skin::defaultSkinName(), guiInfo ); 268 schedule( Skin::defaultSkinName(), guiInfo );
269} 269}
270 270
271void SkinLoader::schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo ) 271void SkinLoader::schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo )
272{ 272{
273 pendingSkins << Info( skinName, guiInfo ); 273 pendingSkins << Info( skinName, guiInfo );
274} 274}
275 275
276void SkinLoader::start() 276void SkinLoader::start()
277{ 277{
278 assert( m_timerId == -1 ); 278 assert( m_timerId == -1 );
279 m_timerId = startTimer( 100 /* ms */ ); 279 m_timerId = startTimer( 100 /* ms */ );
280 qDebug( "SkinLoader::start() %d jobs", pendingSkins.count() ); 280 odebug << "SkinLoader::start() " << pendingSkins.count() << " jobs" << oendl;
281} 281}
282 282
283void SkinLoader::timerEvent( QTimerEvent *ev ) 283void SkinLoader::timerEvent( QTimerEvent *ev )
284{ 284{
285 if ( ev->timerId() != m_timerId ) { 285 if ( ev->timerId() != m_timerId ) {
286 QObject::timerEvent( ev ); 286 QObject::timerEvent( ev );
287 return; 287 return;
288 } 288 }
289 289
290 if ( !m_currentLoader ) { 290 if ( !m_currentLoader ) {
291 291
292 if ( pendingSkins.isEmpty() ) { 292 if ( pendingSkins.isEmpty() ) {
293 qDebug( "all jobs done" ); 293 odebug << "all jobs done" << oendl;
294 killTimer( m_timerId ); 294 killTimer( m_timerId );
295 m_timerId = -1; 295 m_timerId = -1;
296 // ### qt3: use deleteLater(); 296 // ### qt3: use deleteLater();
297 QTimer::singleShot( 0, this, SLOT( deleteMe() ) ); 297 QTimer::singleShot( 0, this, SLOT( deleteMe() ) );
298 return; 298 return;
299 } 299 }
300 300
301 Info nfo = *pendingSkins.begin(); 301 Info nfo = *pendingSkins.begin();
302 pendingSkins.remove( pendingSkins.begin() ); 302 pendingSkins.remove( pendingSkins.begin() );
303 303
304 m_currentLoader = new IncrementalLoader( nfo ); 304 m_currentLoader = new IncrementalLoader( nfo );
305 qDebug( "new loader %i jobs left", pendingSkins.count() ); 305 odebug << "new loader " << pendingSkins.count() << " jobs left" << oendl;
306 } 306 }
307 307
308 if ( m_currentLoader->loadStep() == IncrementalLoader::LoadingCompleted ) { 308 if ( m_currentLoader->loadStep() == IncrementalLoader::LoadingCompleted ) {
309 delete m_currentLoader; 309 delete m_currentLoader;
310 m_currentLoader = 0; 310 m_currentLoader = 0;
311 } 311 }
312 312
313 qDebug( "finished step" ); 313 odebug << "finished step" << oendl;
314} 314}
315 315
316void SkinLoader::deleteMe() 316void SkinLoader::deleteMe()
317{ 317{
318 delete this; 318 delete this;
319} 319}
320 320
321/* vim: et sw=4 ts=4 321/* vim: et sw=4 ts=4
322 */ 322 */
diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp
index fb951b4..d8b8abe 100644
--- a/noncore/multimedia/opieplayer2/threadutil.cpp
+++ b/noncore/multimedia/opieplayer2/threadutil.cpp
@@ -178,34 +178,34 @@ Thread::Thread()
178 178
179Thread::~Thread() 179Thread::~Thread()
180{ 180{
181 assert( d->isRunning == false ); 181 assert( d->isRunning == false );
182 delete d; 182 delete d;
183} 183}
184 184
185void Thread::start() 185void Thread::start()
186{ 186{
187 AutoLock lock( d->guard ); 187 AutoLock lock( d->guard );
188 188
189 if ( d->isRunning ) { 189 if ( d->isRunning ) {
190 qDebug( "ThreadUtil::Thread::start() called for running thread." ); 190 odebug << "ThreadUtil::Thread::start() called for running thread." << oendl;
191 return; 191 return;
192 } 192 }
193 193
194 pthread_attr_t attributes; 194 pthread_attr_t attributes;
195 pthread_attr_init( &attributes ); 195 pthread_attr_init( &attributes );
196 pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM ); 196 pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM );
197 int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d ); 197 int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d );
198 if ( err != 0 ) { 198 if ( err != 0 ) {
199 qDebug( "ThreadUtil::Thread::start() : can't create thread: %s", strerror( err ) ); 199 odebug << "ThreadUtil::Thread::start() : can't create thread: " << strerror( err ) << "" << oendl;
200 pthread_attr_destroy( &attributes ); 200 pthread_attr_destroy( &attributes );
201 return; 201 return;
202 } 202 }
203 pthread_attr_destroy( &attributes ); 203 pthread_attr_destroy( &attributes );
204} 204}
205 205
206void Thread::terminate() 206void Thread::terminate()
207{ 207{
208 AutoLock lock( d->guard ); 208 AutoLock lock( d->guard );
209 if ( !d->isRunning ) 209 if ( !d->isRunning )
210 return; 210 return;
211 211
@@ -275,25 +275,25 @@ ChannelMessage::ChannelMessage( int type )
275} 275}
276 276
277ChannelMessage::~ChannelMessage() 277ChannelMessage::~ChannelMessage()
278{ 278{
279 if ( m_guard.isLocked() ) 279 if ( m_guard.isLocked() )
280 m_guard.unlock(); 280 m_guard.unlock();
281} 281}
282 282
283void ChannelMessage::reply() 283void ChannelMessage::reply()
284{ 284{
285 if ( !m_isCall ) 285 if ( !m_isCall )
286 { 286 {
287 qDebug( "ChannelMessage::reply() - can't reply oneway message!" ); 287 odebug << "ChannelMessage::reply() - can't reply oneway message!" << oendl;
288 return; 288 return;
289 } 289 }
290 290
291 if ( m_inEventHandler ) 291 if ( m_inEventHandler )
292 { 292 {
293 m_replied = true; 293 m_replied = true;
294 return; 294 return;
295 } 295 }
296 296
297 m_condition.wakeOne(); 297 m_condition.wakeOne();
298 m_guard.unlock(); 298 m_guard.unlock();
299} 299}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 8f11b2e..94f99f8 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -84,43 +84,43 @@ XineControl::~XineControl() {
84 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 84 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
85 } 85 }
86#endif 86#endif
87 delete libXine; 87 delete libXine;
88} 88}
89 89
90void XineControl::play( const QString& fileName ) { 90void XineControl::play( const QString& fileName ) {
91 91
92 hasVideoChannel = FALSE; 92 hasVideoChannel = FALSE;
93 hasAudioChannel = FALSE; 93 hasAudioChannel = FALSE;
94 m_fileName = fileName; 94 m_fileName = fileName;
95 95
96 qDebug("<<FILENAME: " + fileName + ">>>>"); 96 odebug << "<<FILENAME: " + fileName + ">>>>" << oendl;
97 97
98 if ( !libXine->play( fileName, 0, 0 ) ) { 98 if ( !libXine->play( fileName, 0, 0 ) ) {
99 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 99 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
100 // toggle stop so the the play button is reset 100 // toggle stop so the the play button is reset
101 mediaPlayerState.setPlaying( false ); 101 mediaPlayerState.setPlaying( false );
102 return; 102 return;
103 } 103 }
104 mediaPlayerState.setPlaying( true ); 104 mediaPlayerState.setPlaying( true );
105 105
106 MediaPlayerState::DisplayType displayType; 106 MediaPlayerState::DisplayType displayType;
107 if ( !libXine->hasVideo() ) { 107 if ( !libXine->hasVideo() ) {
108 displayType = MediaPlayerState::Audio; 108 displayType = MediaPlayerState::Audio;
109 qDebug("HAS AUDIO"); 109 odebug << "HAS AUDIO" << oendl;
110 libXine->setShowVideo( false ); 110 libXine->setShowVideo( false );
111 hasAudioChannel = TRUE; 111 hasAudioChannel = TRUE;
112 } else { 112 } else {
113 displayType = MediaPlayerState::Video; 113 displayType = MediaPlayerState::Video;
114 qDebug("HAS VIDEO"); 114 odebug << "HAS VIDEO" << oendl;
115 libXine->setShowVideo( true ); 115 libXine->setShowVideo( true );
116 hasVideoChannel = TRUE; 116 hasVideoChannel = TRUE;
117 } 117 }
118 // determine if slider is shown 118 // determine if slider is shown
119 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 119 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
120 120
121 // which gui (video / audio) 121 // which gui (video / audio)
122 mediaPlayerState.setDisplayType( displayType ); 122 mediaPlayerState.setDisplayType( displayType );
123 123
124#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 124#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
125 if ( !disabledSuspendScreenSaver ) { 125 if ( !disabledSuspendScreenSaver ) {
126 disabledSuspendScreenSaver = TRUE; 126 disabledSuspendScreenSaver = TRUE;
@@ -234,25 +234,25 @@ QString XineControl::getMetaInfo() {
234 } 234 }
235 235
236 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 236 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
237 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 237 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
238 } 238 }
239 return returnString; 239 return returnString;
240} 240}
241 241
242QString XineControl::getErrorCode() { 242QString XineControl::getErrorCode() {
243 243
244 int errorCode = libXine->error(); 244 int errorCode = libXine->error();
245 245
246 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); 246 odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl;
247 247
248 if ( errorCode == 1 ) { 248 if ( errorCode == 1 ) {
249 return tr( "No input plugin found for this media type" ); 249 return tr( "No input plugin found for this media type" );
250 } else if ( errorCode == 2 ) { 250 } else if ( errorCode == 2 ) {
251 return tr( "No demux plugin found for this media type" ); 251 return tr( "No demux plugin found for this media type" );
252 } else if ( errorCode == 3 ) { 252 } else if ( errorCode == 3 ) {
253 return tr( "Demuxing failed for this media type" ); 253 return tr( "Demuxing failed for this media type" );
254 } else if ( errorCode == 4 ) { 254 } else if ( errorCode == 4 ) {
255 return tr( "Malformed MRL" ); 255 return tr( "Malformed MRL" );
256 } else { 256 } else {
257 return tr( "Some other error" ); 257 return tr( "Some other error" );
258 } 258 }
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp
index ce49e96..5319d97 100644
--- a/noncore/multimedia/opierec/device.cpp
+++ b/noncore/multimedia/opierec/device.cpp
@@ -1,50 +1,50 @@
1// device.cpp 1// device.cpp
2 2
3#include "device.h" 3#include "device.h"
4 4
5/* OPIE */
6#include <opie2/odebug.h>
5#include <qpe/config.h> 7#include <qpe/config.h>
6#include <qpe/qcopenvelope_qws.h> 8#include <qpe/qcopenvelope_qws.h>
9using namespace Opie::Core;
7 10
8 11/* STD */
9#include <fcntl.h> 12#include <fcntl.h>
10#include <stdio.h> 13#include <stdio.h>
11#include <stdlib.h> 14#include <stdlib.h>
12#include <sys/ioctl.h> 15#include <sys/ioctl.h>
13#include <sys/soundcard.h> 16#include <sys/soundcard.h>
14#include <unistd.h> 17#include <unistd.h>
15#include<sys/wait.h> 18#include <sys/wait.h>
16// #include <sys/stat.h>
17// #include <sys/time.h>
18// #include <sys/types.h>
19#include <unistd.h> 19#include <unistd.h>
20#include <errno.h> 20#include <errno.h>
21 21
22//extern QtRec *qperec; 22//extern QtRec *qperec;
23 23
24Device::Device( QObject * parent, const char * dsp, const char * mixr, bool record ) 24Device::Device( QObject * parent, const char * dsp, const char * mixr, bool record )
25 : QObject( parent) 25 : QObject( parent)
26{ 26{
27 dspstr = (char *)dsp; 27 dspstr = (char *)dsp;
28 mixstr = (char *)mixr; 28 mixstr = (char *)mixr;
29 29
30 devForm=-1; 30 devForm=-1;
31 devCh=-1; 31 devCh=-1;
32 devRate=-1; 32 devRate=-1;
33 33
34 if( !record){ //playing 34 if( !record){ //playing
35 qDebug("setting up DSP for playing"); 35 odebug << "setting up DSP for playing" << oendl;
36 flags = O_WRONLY; 36 flags = O_WRONLY;
37 } else { //recording 37 } else { //recording
38 qDebug("setting up DSP for recording"); 38 odebug << "setting up DSP for recording" << oendl;
39 flags = O_RDWR; 39 flags = O_RDWR;
40// flags = O_RDONLY; 40// flags = O_RDONLY;
41 41
42// selectMicInput(); 42// selectMicInput();
43 43
44 } 44 }
45} 45}
46 46
47bool Device::openDsp() { 47bool Device::openDsp() {
48 if( openDevice( flags) == -1) { 48 if( openDevice( flags) == -1) {
49 perror("<<<<<<<<<<<<<<ioctl(\"Open device\")"); 49 perror("<<<<<<<<<<<<<<ioctl(\"Open device\")");
50 return false; 50 return false;
@@ -87,40 +87,40 @@ int Device::getInVolume() {
87 87
88void Device::changedOutVolume(int vol) { 88void Device::changedOutVolume(int vol) {
89 int level = (vol << 8) + vol; 89 int level = (vol << 8) + vol;
90 int fd = 0; 90 int fd = 0;
91 if ((fd = open("/dev/mixer", O_RDWR))>=0) { 91 if ((fd = open("/dev/mixer", O_RDWR))>=0) {
92 if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &level) == -1) 92 if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &level) == -1)
93 perror("ioctl(\"MIXER_IN_WRITE\")"); 93 perror("ioctl(\"MIXER_IN_WRITE\")");
94 94
95 Config cfg("qpe"); 95 Config cfg("qpe");
96 cfg.setGroup("Volume"); 96 cfg.setGroup("Volume");
97 cfg.writeEntry("VolumePercent", QString::number( vol )); 97 cfg.writeEntry("VolumePercent", QString::number( vol ));
98 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; 98 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
99 qWarning("changing output vol %d", vol); 99 owarn << "changing output vol " << vol << "" << oendl;
100 } 100 }
101 ::close(fd); 101 ::close(fd);
102} 102}
103 103
104void Device::changedInVolume(int vol ) { 104void Device::changedInVolume(int vol ) {
105 int level = (vol << 8) + vol; 105 int level = (vol << 8) + vol;
106 int fd = 0; 106 int fd = 0;
107 if ((fd = open("/dev/mixer", O_RDWR))>=0) { 107 if ((fd = open("/dev/mixer", O_RDWR))>=0) {
108 if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &level) == -1) 108 if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &level) == -1)
109 perror("ioctl(\"MIXER_IN_WRITE\")"); 109 perror("ioctl(\"MIXER_IN_WRITE\")");
110 Config cfg("qpe"); 110 Config cfg("qpe");
111 cfg.setGroup("Volume"); 111 cfg.setGroup("Volume");
112 cfg.writeEntry("Mic", QString::number(vol )); 112 cfg.writeEntry("Mic", QString::number(vol ));
113 QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; 113 QCopEnvelope( "QPE/System", "micChange(bool)" ) << false;
114 qWarning("changing input volume %d", vol); 114 owarn << "changing input volume " << vol << "" << oendl;
115 } 115 }
116 ::close(fd); 116 ::close(fd);
117} 117}
118 118
119bool Device::selectMicInput() { 119bool Device::selectMicInput() {
120 120
121 int md=0; 121 int md=0;
122 int info=MIXER_WRITE(SOUND_MIXER_MIC); 122 int info=MIXER_WRITE(SOUND_MIXER_MIC);
123 md = ::open( "/dev/mixer", O_RDWR ); 123 md = ::open( "/dev/mixer", O_RDWR );
124 if ( md == -1) 124 if ( md == -1)
125 perror("open(\"/dev/mixer\")"); 125 perror("open(\"/dev/mixer\")");
126 else { 126 else {
@@ -140,56 +140,56 @@ int Device::openDevice( int flags) {
140 int pipefd[2]; 140 int pipefd[2];
141 char message[20]; 141 char message[20];
142 if (pipe(pipefd) == -1){ 142 if (pipe(pipefd) == -1){
143 perror ("Error creating pipe"); 143 perror ("Error creating pipe");
144exit(1); 144exit(1);
145 } 145 }
146 switch (pid = fork()) { 146 switch (pid = fork()) {
147 case -1: 147 case -1:
148 perror("The fork failed!"); 148 perror("The fork failed!");
149 break; 149 break;
150 case 0: { 150 case 0: {
151 */ 151 */
152qDebug("Opening %s",dspstr); 152odebug << "Opening " << dspstr << "" << oendl;
153 if (( sd = ::open( dspstr, flags)) == -1) { 153 if (( sd = ::open( dspstr, flags)) == -1) {
154 perror("open(\"/dev/dsp\")"); 154 perror("open(\"/dev/dsp\")");
155 QString errorMsg="Could not open audio device\n /dev/dsp\n" 155 QString errorMsg="Could not open audio device\n /dev/dsp\n"
156 +(QString)strerror(errno); 156 +(QString)strerror(errno);
157 qDebug("XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg); 157 odebug << "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl;
158 return -1; 158 return -1;
159 } 159 }
160 160
161qDebug("Opening mixer"); 161odebug << "Opening mixer" << oendl;
162 int mixerHandle=0; 162 int mixerHandle=0;
163 if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) { 163 if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) {
164 perror("open(\"/dev/mixer\")"); 164 perror("open(\"/dev/mixer\")");
165 QString errorMsg="Could not open audio device\n /dev/dsp\n" 165 QString errorMsg="Could not open audio device\n /dev/dsp\n"
166 +(QString)strerror(errno); 166 +(QString)strerror(errno);
167 qDebug("XXXXXXXXXXXXXXXXXXXXXX "+errorMsg); 167 odebug << "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl;
168 } 168 }
169 169
170 if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){ 170 if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){
171 perror("ioctl RESET"); 171 perror("ioctl RESET");
172 } 172 }
173// sprintf(message, "%d", sd); 173// sprintf(message, "%d", sd);
174 174
175/* QFile f1("/pid"); 175/* QFile f1("/pid");
176 f1.open(IO_WriteOnly ); 176 f1.open(IO_WriteOnly );
177 f1.writeBlock(message, strlen(message)); 177 f1.writeBlock(message, strlen(message));
178 f1.close(); 178 f1.close();
179 */ 179 */
180 /* close(pipefd[0]); 180 /* close(pipefd[0]);
181 write(pipefd[1], message, sizeof(message)); 181 write(pipefd[1], message, sizeof(message));
182 close(pipefd[1]); 182 close(pipefd[1]);
183 // qDebug("%d",soundDevice->sd ); 183 // odebug << "" << soundDevice->sd << "" << oendl;
184 _exit(0); 184 _exit(0);
185 } 185 }
186 default: 186 default:
187 // pid greater than zero is parent getting the child's pid 187 // pid greater than zero is parent getting the child's pid
188 printf("Child's pid is %d\n",pid); 188 printf("Child's pid is %d\n",pid);
189 QString s; 189 QString s;
190 close(pipefd[1]); 190 close(pipefd[1]);
191 read(pipefd[0], message, sizeof(message)); 191 read(pipefd[0], message, sizeof(message));
192 s = message; 192 s = message;
193 close(pipefd[0]); 193 close(pipefd[0]);
194 194
195// while(wait(NULL)!=pid) 195// while(wait(NULL)!=pid)
@@ -197,74 +197,74 @@ qDebug("Opening mixer");
197 printf("child %ld terminated normally, return status is zero\n", (long) pid); 197 printf("child %ld terminated normally, return status is zero\n", (long) pid);
198 */ 198 */
199 // filePara.sd=(long) pid; 199 // filePara.sd=(long) pid;
200 /* QFile f2("/pid"); 200 /* QFile f2("/pid");
201 f2.open(IO_ReadOnly); 201 f2.open(IO_ReadOnly);
202 QTextStream t(&f2); 202 QTextStream t(&f2);
203 // for(int f=0; f < t.atEnd() ;f++) { 203 // for(int f=0; f < t.atEnd() ;f++) {
204 s = t.readLine(); 204 s = t.readLine();
205 // } 205 // }
206 */ 206 */
207// bool ok; 207// bool ok;
208// sd = s.toInt(&ok, 10); 208// sd = s.toInt(&ok, 10);
209// qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); 209// odebug << "<<<<<<<<<<<<<>>>>>>>>>>>>"+s << oendl;
210 210
211// f2.close(); 211// f2.close();
212// } 212// }
213::close(mixerHandle ); 213::close(mixerHandle );
214// qDebug("open device %s", dspstr); 214// odebug << "open device " << dspstr << "" << oendl;
215// qDebug("success! %d",sd); 215// odebug << "success! " << sd << "" << oendl;
216 return sd; 216 return sd;
217} 217}
218 218
219bool Device::closeDevice( bool) { 219bool Device::closeDevice( bool) {
220// if(b) {//close now 220// if(b) {//close now
221// if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) { 221// if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) {
222// perror("ioctl(\"SNDCTL_DSP_RESET\")"); 222// perror("ioctl(\"SNDCTL_DSP_RESET\")");
223// } 223// }
224// } else { //let play 224// } else { //let play
225// if (ioctl( sd, SNDCTL_DSP_SYNC, 0) == -1) { 225// if (ioctl( sd, SNDCTL_DSP_SYNC, 0) == -1) {
226// perror("ioctl(\"SNDCTL_DSP_SYNC\")"); 226// perror("ioctl(\"SNDCTL_DSP_SYNC\")");
227// } 227// }
228// } 228// }
229 229
230 ::close( sd); //close sound device 230 ::close( sd); //close sound device
231// sdfd=0; 231// sdfd=0;
232 // sd=0; 232 // sd=0;
233// qDebug("closed dsp"); 233// odebug << "closed dsp" << oendl;
234 return true; 234 return true;
235} 235}
236 236
237bool Device::setDeviceFormat( int form) { 237bool Device::setDeviceFormat( int form) {
238 qDebug("set device res %d %d", form, sd); 238 odebug << "set device res " << form << " " << sd << "" << oendl;
239 if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format 239 if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format
240 perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); 240 perror("ioctl(\"SNDCTL_DSP_SETFMT\")");
241 return false; 241 return false;
242 } 242 }
243 devRes=form; 243 devRes=form;
244 return true; 244 return true;
245} 245}
246 246
247bool Device::setDeviceChannels( int ch) { 247bool Device::setDeviceChannels( int ch) {
248 qDebug("set channels %d %d", ch, sd); 248 odebug << "set channels " << ch << " " << sd << "" << oendl;
249 if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) { 249 if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) {
250 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); 250 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
251 return false; 251 return false;
252 } 252 }
253 devCh=ch; 253 devCh=ch;
254 return true; 254 return true;
255} 255}
256 256
257bool Device::setDeviceRate( int rate) { 257bool Device::setDeviceRate( int rate) {
258 qDebug("set rate %d %d", rate, sd); 258 odebug << "set rate " << rate << " " << sd << "" << oendl;
259 if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) { 259 if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) {
260 perror("ioctl(\"SNDCTL_DSP_SPEED\")"); 260 perror("ioctl(\"SNDCTL_DSP_SPEED\")");
261 return false; 261 return false;
262 } 262 }
263 263
264 devRate=rate; 264 devRate=rate;
265 265
266 return true; 266 return true;
267} 267}
268 268
269int Device::getRes() { 269int Device::getRes() {
270 return devRes; 270 return devRes;
@@ -309,27 +309,27 @@ int Device::getDeviceBits() {
309int Device::getDeviceChannels() { 309int Device::getDeviceChannels() {
310 int dCh=0; 310 int dCh=0;
311 if (ioctl( sd, SOUND_PCM_READ_CHANNELS, &dCh) == -1) { 311 if (ioctl( sd, SOUND_PCM_READ_CHANNELS, &dCh) == -1) {
312 perror("ioctl(\"SNDCTL_PCM_READ_CHANNELS\")"); 312 perror("ioctl(\"SNDCTL_PCM_READ_CHANNELS\")");
313 } 313 }
314 return dCh; 314 return dCh;
315} 315}
316 316
317int Device::getDeviceFragSize() { 317int Device::getDeviceFragSize() {
318 int frag_size; 318 int frag_size;
319 319
320 if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { 320 if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) {
321 qDebug("no fragsize"); 321 odebug << "no fragsize" << oendl;
322 } else { 322 } else {
323 qDebug("driver says frag size is %d", frag_size); 323 odebug << "driver says frag size is " << frag_size << "" << oendl;
324 } 324 }
325 return frag_size; 325 return frag_size;
326} 326}
327 327
328bool Device::setFragSize(int frag) { 328bool Device::setFragSize(int frag) {
329 if (ioctl(sd, SNDCTL_DSP_SETFRAGMENT, &frag)) { 329 if (ioctl(sd, SNDCTL_DSP_SETFRAGMENT, &frag)) {
330 perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); 330 perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")");
331 return false; 331 return false;
332 } 332 }
333 return true; 333 return true;
334} 334}
335 335
diff --git a/noncore/multimedia/opierec/helpwindow.cpp b/noncore/multimedia/opierec/helpwindow.cpp
index 6aebaa1..7f984c3 100644
--- a/noncore/multimedia/opierec/helpwindow.cpp
+++ b/noncore/multimedia/opierec/helpwindow.cpp
@@ -1,40 +1,45 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
5** 5**
6** This file is part of an example program for Qt. This example 6** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation. 7** program may be used, distributed and modified without limitation.
8** 8**
9*****************************************************************************/ 9*****************************************************************************/
10 10
11#include "helpwindow.h" 11#include "helpwindow.h"
12#include <qlayout.h>
13 12
14#include <qtoolbar.h> 13/* OPIE */
14#include <opie2/odebug.h>
15#include <qpe/resource.h> 15#include <qpe/resource.h>
16using namespace Opie::Core;
16 17
18/* QT */
19#include <qlayout.h>
20#include <qtoolbar.h>
17#include <qaction.h> 21#include <qaction.h>
18#include <qmenubar.h> 22#include <qmenubar.h>
19 23
24/* STD */
20#include <ctype.h> 25#include <ctype.h>
21 26
22HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) 27HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name )
23 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() 28 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
24{ 29{
25 QGridLayout *layout = new QGridLayout( this ); 30 QGridLayout *layout = new QGridLayout( this );
26 layout->setSpacing( 2); 31 layout->setSpacing( 2);
27 layout->setMargin( 2); 32 layout->setMargin( 2);
28 qDebug(_path); 33 odebug << _path << oendl;
29 browser = new QTextBrowser( this ); 34 browser = new QTextBrowser( this );
30 QStringList Strlist; 35 QStringList Strlist;
31 Strlist.append( home_); 36 Strlist.append( home_);
32 browser->mimeSourceFactory()->setFilePath( Strlist ); 37 browser->mimeSourceFactory()->setFilePath( Strlist );
33 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 38 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
34 39
35 connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); 40 connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) );
36 41
37 if ( !home_.isEmpty() ) 42 if ( !home_.isEmpty() )
38 browser->setSource( home_ ); 43 browser->setSource( home_ );
39 QToolBar *toolbar = new QToolBar( this ); 44 QToolBar *toolbar = new QToolBar( this );
40 45
diff --git a/noncore/multimedia/opierec/opierec.pro b/noncore/multimedia/opierec/opierec.pro
index 7b08f0e..ea1bae3 100644
--- a/noncore/multimedia/opierec/opierec.pro
+++ b/noncore/multimedia/opierec/opierec.pro
@@ -1,15 +1,13 @@
1#CONFIG = qt warn_on pdaudio 1CONFIG = qt warn_on
2CONFIG = qt warn_on opie
3#CONFIG = qt warn_on quick-app
4HEADERS = adpcm.h \ 2HEADERS = adpcm.h \
5 pixmaps.h \ 3 pixmaps.h \
6 helpwindow.h \ 4 helpwindow.h \
7 qtrec.h \ 5 qtrec.h \
8 device.h \ 6 device.h \
9 wavFile.h \ 7 wavFile.h \
10 waveform.h 8 waveform.h
11SOURCES = adpcm.c \ 9SOURCES = adpcm.c \
12 helpwindow.cpp \ 10 helpwindow.cpp \
13 main.cpp \ 11 main.cpp \
14 qtrec.cpp \ 12 qtrec.cpp \
15 device.cpp \ 13 device.cpp \
@@ -20,22 +18,22 @@ INTERFACES =
20contains(CONFIG, pdaudio) { 18contains(CONFIG, pdaudio) {
21# LIBS += -L/opt/buildroot-opie/output/staging/target/lib -lqpe -lpthread -ljpeg -lpng -lz 19# LIBS += -L/opt/buildroot-opie/output/staging/target/lib -lqpe -lpthread -ljpeg -lpng -lz
22 LIBS += -L$(QPEDIR)/lib -lqpe -lpthread -ljpeg -lpng -lz -lopiecore2 20 LIBS += -L$(QPEDIR)/lib -lqpe -lpthread -ljpeg -lpng -lz -lopiecore2
23 INCLUDEPATH += $(QPEDIR)/include 21 INCLUDEPATH += $(QPEDIR)/include
24 DEPENDPATH += $(QPEDIR)/include 22 DEPENDPATH += $(QPEDIR)/include
25 DEFINES += PDAUDIO 23 DEFINES += PDAUDIO
26 DEFINES += THREADED 24 DEFINES += THREADED
27 TARGET = qperec 25 TARGET = qperec
28 26
29# DESTDIR=$(QPEDIR)/bin 27# DESTDIR=$(QPEDIR)/bin
30} 28}
31 29
32contains(CONFIG, opie) { 30!contains(CONFIG, pdaudio) {
33 INCLUDEPATH += $(OPIEDIR)/include 31 INCLUDEPATH += $(OPIEDIR)/include
34 DEPENDPATH += $(OPIEDIR)/include 32 DEPENDPATH += $(OPIEDIR)/include
35 DESTDIR=$(OPIEDIR)/bin 33 DESTDIR=$(OPIEDIR)/bin
36 LIBS += -lqpe -lopiecore2 -lpthread 34 LIBS += -lqpe -lopiecore2 -lpthread
37 TARGET = opierec 35 TARGET = opierec
38 include ( $(OPIEDIR)/include.pro ) 36 include ( $(OPIEDIR)/include.pro )
39} 37}
40 38
41 39
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 1c64ab1..2187d5a 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -1,68 +1,67 @@
1/**************************************************************************** 1/****************************************************************************
2 // qtrec.cpp 2 // qtrec.cpp
3 Created: Thu Jan 17 11:19:58 2002 3 Created: Thu Jan 17 11:19:58 2002
4 copyright 2002 by L.J. Potter <ljp@llornkcor.com> 4 copyright 2002 by L.J. Potter <ljp@llornkcor.com>
5****************************************************************************/ 5****************************************************************************/
6#define DEV_VERSION 6#define DEV_VERSION
7 7
8#include "pixmaps.h" 8#include "pixmaps.h"
9#include "qtrec.h" 9#include "qtrec.h"
10#include "waveform.h" 10#include "waveform.h"
11
12#include <pthread.h>
13
14extern "C" { 11extern "C" {
15#include "adpcm.h" 12#include "adpcm.h"
16} 13}
17 14
18#include <sys/soundcard.h> 15/* OPIE */
19 16#include <opie2/odebug.h>
20#include <qpe/config.h> 17#include <qpe/config.h>
21#include <qpe/qcopenvelope_qws.h> 18#include <qpe/qcopenvelope_qws.h>
22#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
23#include <qpe/resource.h> 20#include <qpe/resource.h>
24#include <qpe/storage.h> 21#include <qpe/storage.h>
22using namespace Opie::Core;
25 23
24/* QT */
26#include <qcheckbox.h> 25#include <qcheckbox.h>
27#include <qcombobox.h> 26#include <qcombobox.h>
28//#include <qdatetime.h>
29#include <qdir.h> 27#include <qdir.h>
30#include <qgroupbox.h> 28#include <qgroupbox.h>
31#include <qlabel.h> 29#include <qlabel.h>
32#include <qlayout.h> 30#include <qlayout.h>
33#include <qlistview.h> 31#include <qlistview.h>
34#include <qmessagebox.h> 32#include <qmessagebox.h>
35#include <qpopupmenu.h> 33#include <qpopupmenu.h>
36#include <qpushbutton.h> 34#include <qpushbutton.h>
37#include <qslider.h> 35#include <qslider.h>
38#include <qtabwidget.h> 36#include <qtabwidget.h>
39#include <qtimer.h> 37#include <qtimer.h>
40 38
39/* STD */
41#include <errno.h> 40#include <errno.h>
42#include <fcntl.h> 41#include <fcntl.h>
43#include <math.h> 42#include <math.h>
44#include <mntent.h> 43#include <mntent.h>
45#include <stdio.h> 44#include <stdio.h>
46#include <stdlib.h> 45#include <stdlib.h>
47#include <sys/ioctl.h> 46#include <sys/ioctl.h>
48#include <sys/soundcard.h> 47#include <sys/soundcard.h>
49#include <sys/stat.h> 48#include <sys/stat.h>
50#include <sys/time.h> 49#include <sys/time.h>
51#include <sys/types.h> 50#include <sys/types.h>
52#include <sys/vfs.h> 51#include <sys/vfs.h>
53#include <unistd.h> 52#include <unistd.h>
54#include <sys/wait.h> 53#include <sys/wait.h>
55#include <sys/signal.h> 54#include <sys/signal.h>
56 55#include <pthread.h>
57 56
58#ifdef PDAUDIO //ALSA 57#ifdef PDAUDIO //ALSA
59#include <alsa/asoundlib.h> 58#include <alsa/asoundlib.h>
60static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 }; 59static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 };
61static int deviceBitRates[] = { 8, 16, 24, 32, -1 }; 60static int deviceBitRates[] = { 8, 16, 24, 32, -1 };
62#else //OSS 61#else //OSS
63static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 }; 62static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 };
64static int deviceBitRates[] = { 8, 16, -1 }; 63static int deviceBitRates[] = { 8, 16, -1 };
65#endif 64#endif
66 65
67#if defined(QT_QWS_SL5XXX) 66#if defined(QT_QWS_SL5XXX)
68///#if defined(QT_QWS_EBX) 67///#if defined(QT_QWS_EBX)
@@ -127,55 +126,55 @@ void quickRec()
127 qDebug("samples %d, rate %d, channels %d", 126 qDebug("samples %d, rate %d, channels %d",
128 filePara.numberSamples, filePara.sampleRate, filePara.channels); 127 filePara.numberSamples, filePara.sampleRate, filePara.channels);
129 128
130 int total = 0; // Total number of bytes read in so far. 129 int total = 0; // Total number of bytes read in so far.
131 int bytesWritten, number; 130 int bytesWritten, number;
132 131
133 bytesWritten = 0; 132 bytesWritten = 0;
134 number = 0; 133 number = 0;
135 QString num; 134 QString num;
136 int level = 0; 135 int level = 0;
137 int threshold = 0; 136 int threshold = 0;
138// int bits = filePara.resolution; 137// int bits = filePara.resolution;
139// qDebug("bits %d", bits); 138// odebug << "bits " << bits << "" << oendl;
140 139
141 if( filePara.resolution == 16 ) { //AFMT_S16_LE) 140 if( filePara.resolution == 16 ) { //AFMT_S16_LE)
142// qDebug("AFMT_S16_LE size %d", filePara.SecondsToRecord); 141// odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl;
143// qDebug("samples to record %d", filePara.samplesToRecord); 142// odebug << "samples to record " << filePara.samplesToRecord << "" << oendl;
144// qDebug("%d", filePara.sd); 143// odebug << "" << filePara.sd << "" << oendl;
145 level = 7; 144 level = 7;
146 threshold = 0; 145 threshold = 0;
147 146
148 if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { 147 if( filePara.format == WAVE_FORMAT_DVI_ADPCM) {
149// qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); 148// odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl;
150 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> 149 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>>
151 char abuf[ BUFSIZE/2 ]; 150 char abuf[ BUFSIZE/2 ];
152 short sbuf[ BUFSIZE ]; 151 short sbuf[ BUFSIZE ];
153 short sbuf2[ BUFSIZE ]; 152 short sbuf2[ BUFSIZE ];
154 memset( abuf, 0, BUFSIZE/2); 153 memset( abuf, 0, BUFSIZE/2);
155 memset( sbuf, 0, BUFSIZE); 154 memset( sbuf, 0, BUFSIZE);
156 memset( sbuf2, 0, BUFSIZE); 155 memset( sbuf2, 0, BUFSIZE);
157 156
158 for(;;) { 157 for(;;) {
159 if ( stopped) { 158 if ( stopped) {
160 // qDebug("quickRec:: stopped"); 159 // odebug << "quickRec:: stopped" << oendl;
161 break; 160 break;
162 } 161 }
163 162
164// number=::read( filePara.sd, sbuf, BUFSIZE); 163// number=::read( filePara.sd, sbuf, BUFSIZE);
165 number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE); 164 number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE);
166 165
167 if(number <= 0) { 166 if(number <= 0) {
168 perror("recording error "); 167 perror("recording error ");
169 qDebug( "%s %d", filePara.fileName, number); 168 odebug << "" << filePara.fileName << " " << number << "" << oendl;
170 stopped = true; 169 stopped = true;
171 return; 170 return;
172 } 171 }
173 //if(stereo == 2) { 172 //if(stereo == 2) {
174// adpcm_coder( sbuf2, abuf, number/2, &encoder_state); 173// adpcm_coder( sbuf2, abuf, number/2, &encoder_state);
175 adpcm_coder( sbuf, abuf, number/2, &encoder_state); 174 adpcm_coder( sbuf, abuf, number/2, &encoder_state);
176 175
177 bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); 176 bytesWritten = ::write( filePara.fd , (short *)abuf, number/4);
178 177
179 waveform->newSamples( (const short *)abuf, bytesWritten ); 178 waveform->newSamples( (const short *)abuf, bytesWritten );
180 179
181 total += bytesWritten; 180 total += bytesWritten;
@@ -183,43 +182,43 @@ void quickRec()
183 timeSlider->setValue( total); 182 timeSlider->setValue( total);
184 183
185 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels; 184 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels;
186 185
187 qApp->processEvents(); 186 qApp->processEvents();
188 if( total >= filePara.samplesToRecord) { 187 if( total >= filePara.samplesToRecord) {
189 stopped = true; 188 stopped = true;
190 break; 189 break;
191 } 190 }
192 } 191 }
193 } else { 192 } else {
194 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> 193 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>>
195 qDebug("start recording WAVE_FORMAT_PCM"); 194 odebug << "start recording WAVE_FORMAT_PCM" << oendl;
196 short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; 195 short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ];
197 memset( inbuffer, 0, BUFSIZE); 196 memset( inbuffer, 0, BUFSIZE);
198 memset( outbuffer, 0, BUFSIZE); 197 memset( outbuffer, 0, BUFSIZE);
199 198
200 for(;;) { 199 for(;;) {
201 if ( stopped) { 200 if ( stopped) {
202 qDebug("quickRec:: stopped"); 201 odebug << "quickRec:: stopped" << oendl;
203 stopped = true; 202 stopped = true;
204 break; // stop if playing was set to false 203 break; // stop if playing was set to false
205 return; 204 return;
206 } 205 }
207 206
208 number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); 207 number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE);
209 waveform->newSamples( inbuffer, number ); 208 waveform->newSamples( inbuffer, number );
210 209
211 if( number <= 0) { 210 if( number <= 0) {
212 perror( "recording error "); 211 perror( "recording error ");
213 qDebug( filePara.fileName); 212 odebug << filePara.fileName << oendl;
214 stopped = true; 213 stopped = true;
215 return; 214 return;
216 } 215 }
217 216
218 bytesWritten = ::write( filePara.fd , inbuffer, number); 217 bytesWritten = ::write( filePara.fd , inbuffer, number);
219 218
220 if( bytesWritten < 0) { 219 if( bytesWritten < 0) {
221 perror("File writing error "); 220 perror("File writing error ");
222 stopped = true; 221 stopped = true;
223 return; 222 return;
224 } 223 }
225 224
@@ -241,25 +240,25 @@ void quickRec()
241 } 240 }
242 } 241 }
243 } //end main loop 242 } //end main loop
244 243
245 } else { 244 } else {
246// <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; 245// <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8;
247 unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; 246 unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ];
248 memset( unsigned_inbuffer, 0, BUFSIZE); 247 memset( unsigned_inbuffer, 0, BUFSIZE);
249 memset( unsigned_outbuffer, 0, BUFSIZE); 248 memset( unsigned_outbuffer, 0, BUFSIZE);
250 249
251 for(;;) { 250 for(;;) {
252 if ( stopped) { 251 if ( stopped) {
253 qDebug("quickRec:: stopped"); 252 odebug << "quickRec:: stopped" << oendl;
254 break; // stop if playing was set to false 253 break; // stop if playing was set to false
255 } 254 }
256 255
257 number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE); 256 number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE);
258 bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); 257 bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number);
259 258
260 if(bytesWritten < 0) { 259 if(bytesWritten < 0) {
261 stopped = true; 260 stopped = true;
262 QMessageBox::message("Note","There was a problem\nwriting to the file"); 261 QMessageBox::message("Note","There was a problem\nwriting to the file");
263 perror("File writing error "); 262 perror("File writing error ");
264 return; 263 return;
265 } 264 }
@@ -364,25 +363,25 @@ void playIt()
364 total += bytesWritten; 363 total += bytesWritten;
365 timeSlider->setValue( total); 364 timeSlider->setValue( total);
366 365
367 filePara.numberSamples = total; 366 filePara.numberSamples = total;
368 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; 367 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2;
369 368
370// timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); 369// timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds);
371// timeLabel->setText( timeString + tr(" seconds")); 370// timeLabel->setText( timeString + tr(" seconds"));
372 371
373 qApp->processEvents(); 372 qApp->processEvents();
374 373
375 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { 374 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) {
376 qWarning("Jane! Stop this crazy thing!"); 375 owarn << "Jane! Stop this crazy thing!" << oendl;
377 stopped = true; 376 stopped = true;
378// playing = false; 377// playing = false;
379 break; 378 break;
380 } 379 }
381 } 380 }
382 printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); 381 printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total);
383 fflush(stdout); 382 fflush(stdout);
384 } //end loop 383 } //end loop
385 } else { 384 } else {
386/////////////////////////////// format = AFMT_U8; 385/////////////////////////////// format = AFMT_U8;
387 unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE]; 386 unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE];
388 memset( unsigned_inbuffer, 0, BUFSIZE); 387 memset( unsigned_inbuffer, 0, BUFSIZE);
@@ -709,25 +708,25 @@ void QtRec::init() {
709 waveform->setBackgroundColor ( black ); 708 waveform->setBackgroundColor ( black );
710} 709}
711 710
712void QtRec::initIconView() { 711void QtRec::initIconView() {
713 712
714 ListView1->clear(); 713 ListView1->clear();
715 Config cfg("OpieRec"); 714 Config cfg("OpieRec");
716 cfg.setGroup("Sounds"); 715 cfg.setGroup("Sounds");
717 QString temp; 716 QString temp;
718 QPixmap image0( ( const char** ) image0_data ); 717 QPixmap image0( ( const char** ) image0_data );
719 718
720 int nFiles = cfg.readNumEntry("NumberofFiles",0); 719 int nFiles = cfg.readNumEntry("NumberofFiles",0);
721 // qDebug("init number of files %d", nFiles); 720 // odebug << "init number of files " << nFiles << "" << oendl;
722 721
723 for(int i=1;i<= nFiles;i++) { 722 for(int i=1;i<= nFiles;i++) {
724 723
725 QListViewItem * item; 724 QListViewItem * item;
726 QString fileS, mediaLocation, fileDate, filePath; 725 QString fileS, mediaLocation, fileDate, filePath;
727 726
728 temp.sprintf( "%d",i); 727 temp.sprintf( "%d",i);
729 temp = cfg.readEntry( temp,""); //reads currentFile 728 temp = cfg.readEntry( temp,""); //reads currentFile
730 filePath = cfg.readEntry( temp,""); //currentFileName 729 filePath = cfg.readEntry( temp,""); //currentFileName
731 730
732 QFileInfo info(filePath); 731 QFileInfo info(filePath);
733 fileDate = info.lastModified().toString(); 732 fileDate = info.lastModified().toString();
@@ -851,25 +850,25 @@ void QtRec::initConfig() {
851 if( autoMuteCheckBox->isChecked()) 850 if( autoMuteCheckBox->isChecked())
852 slotAutoMute(true); 851 slotAutoMute(true);
853 else 852 else
854 slotAutoMute(false); 853 slotAutoMute(false);
855 854
856 Config cofg( "qpe"); 855 Config cofg( "qpe");
857 cofg.setGroup( "Volume"); 856 cofg.setGroup( "Volume");
858 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); 857 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0));
859 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); 858 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0));
860} 859}
861 860
862void QtRec::stop() { 861void QtRec::stop() {
863 qWarning("STOP"); 862 owarn << "STOP" << oendl;
864 setRecordButton(false); 863 setRecordButton(false);
865 864
866 if( !recording) 865 if( !recording)
867 endPlaying(); 866 endPlaying();
868 else 867 else
869 endRecording(); 868 endRecording();
870 timeSlider->setValue(0); 869 timeSlider->setValue(0);
871} 870}
872 871
873void QtRec::doPlayBtn() { 872void QtRec::doPlayBtn() {
874 873
875 if(!stopped) { 874 if(!stopped) {
@@ -913,69 +912,69 @@ bool QtRec::rec() { //record
913 912
914 if( setupAudio( true)) 913 if( setupAudio( true))
915 if(setUpFile()) { 914 if(setUpFile()) {
916 int fileSize = 0; 915 int fileSize = 0;
917 Config cfg("OpieRec"); 916 Config cfg("OpieRec");
918 cfg.setGroup("Settings"); 917 cfg.setGroup("Settings");
919// qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", 918// qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d",
920// soundDevice->getDeviceBits(), 919// soundDevice->getDeviceBits(),
921// soundDevice->getDeviceRate(), 920// soundDevice->getDeviceRate(),
922// soundDevice->getDeviceChannels()); 921// soundDevice->getDeviceChannels());
923 922
924 //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); 923 //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050);
925// qDebug("sample rate is %d", filePara.sampleRate); 924// odebug << "sample rate is " << filePara.sampleRate << "" << oendl;
926 filePara.SecondsToRecord = getCurrentSizeLimit(); 925 filePara.SecondsToRecord = getCurrentSizeLimit();
927 926
928// qDebug("size limit %d sec", filePara.SecondsToRecord); 927// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl;
929 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); 928 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName());
930 929
931 if( filePara.SecondsToRecord == 0) { 930 if( filePara.SecondsToRecord == 0) {
932 fileSize = diskSize; 931 fileSize = diskSize;
933 } else if( filePara.format == WAVE_FORMAT_PCM) { 932 } else if( filePara.format == WAVE_FORMAT_PCM) {
934// qDebug("WAVE_FORMAT_PCM"); 933// odebug << "WAVE_FORMAT_PCM" << oendl;
935 fileSize = (filePara.SecondsToRecord ) * filePara.channels 934 fileSize = (filePara.SecondsToRecord ) * filePara.channels
936 * filePara.sampleRate * ( filePara.resolution / 8) + 1000; 935 * filePara.sampleRate * ( filePara.resolution / 8) + 1000;
937 } else { 936 } else {
938// qDebug("WAVE_FORMAT_DVI_ADPCM"); 937// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl;
939 fileSize = ((filePara.SecondsToRecord) * filePara.channels 938 fileSize = ((filePara.SecondsToRecord) * filePara.channels
940 * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; 939 * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250;
941 } 940 }
942 941
943 filePara.samplesToRecord = fileSize; 942 filePara.samplesToRecord = fileSize;
944 qDebug("filesize should be %d, bits %d, rate %d", 943 qDebug("filesize should be %d, bits %d, rate %d",
945 filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); 944 filePara.samplesToRecord, filePara.resolution, filePara.sampleRate);
946 if( paused) { 945 if( paused) {
947 paused = false; 946 paused = false;
948 } 947 }
949 // else { 948 // else {
950 qDebug("Setting timeslider %d", filePara.samplesToRecord); 949 odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl;
951 // if(fileSize != 0) 950 // if(fileSize != 0)
952 timeSlider->setRange(0, filePara.samplesToRecord); 951 timeSlider->setRange(0, filePara.samplesToRecord);
953 // } 952 // }
954 953
955 if( diskSize < fileSize/1024) { 954 if( diskSize < fileSize/1024) {
956 QMessageBox::warning(this, 955 QMessageBox::warning(this,
957 tr("Low Disk Space"), 956 tr("Low Disk Space"),
958 tr("You are running low of\nrecording space\n" 957 tr("You are running low of\nrecording space\n"
959 "or a card isn't being recognized")); 958 "or a card isn't being recognized"));
960 stopped = true; //we need to be stopped 959 stopped = true; //we need to be stopped
961 stop(); 960 stop();
962 } else { 961 } else {
963 QString msg; 962 QString msg;
964 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); 963 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution);
965#ifdef DEV_VERSION 964#ifdef DEV_VERSION
966 setCaption( msg); 965 setCaption( msg);
967#endif 966#endif
968 filePara.fileName=currentFile.latin1(); 967 filePara.fileName=currentFile.latin1();
969 qDebug("Start recording thread"); 968 odebug << "Start recording thread" << oendl;
970 stopped = false; 969 stopped = false;
971 970
972#ifdef THREADED 971#ifdef THREADED
973 pthread_t thread1; 972 pthread_t thread1;
974 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); 973 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/);
975#endif 974#endif
976 toBeginningButton->setEnabled( false); 975 toBeginningButton->setEnabled( false);
977 toEndButton->setEnabled( false); 976 toEndButton->setEnabled( false);
978 977
979 startTimer(1000); 978 startTimer(1000);
980#ifndef THREADED 979#ifndef THREADED
981 quickRec(); 980 quickRec();
@@ -1001,31 +1000,31 @@ void QtRec::thisTab(QWidget* widg) {
1001 } 1000 }
1002 1001
1003 if( index==2) { //help page 1002 if( index==2) { //help page
1004 } 1003 }
1005 1004
1006 qApp->processEvents(); 1005 qApp->processEvents();
1007 update(); 1006 update();
1008 } 1007 }
1009} 1008}
1010 1009
1011void QtRec::getOutVol( ) { 1010void QtRec::getOutVol( ) {
1012 filePara.outVol = soundDevice->getOutVolume(); 1011 filePara.outVol = soundDevice->getOutVolume();
1013// qDebug("out vol %d", filePara.outVol); 1012// odebug << "out vol " << filePara.outVol << "" << oendl;
1014 OutputSlider->setValue( -filePara.outVol); 1013 OutputSlider->setValue( -filePara.outVol);
1015} 1014}
1016 1015
1017void QtRec::getInVol() { 1016void QtRec::getInVol() {
1018 filePara.inVol = soundDevice->getInVolume(); 1017 filePara.inVol = soundDevice->getInVolume();
1019// qDebug("in vol %d", filePara.inVol); 1018// odebug << "in vol " << filePara.inVol << "" << oendl;
1020 InputSlider->setValue( -filePara.inVol); 1019 InputSlider->setValue( -filePara.inVol);
1021} 1020}
1022 1021
1023void QtRec::changedOutVolume() { 1022void QtRec::changedOutVolume() {
1024 soundDevice->changedOutVolume( -OutputSlider->value()); 1023 soundDevice->changedOutVolume( -OutputSlider->value());
1025} 1024}
1026 1025
1027void QtRec::changedInVolume( ) { 1026void QtRec::changedInVolume( ) {
1028 soundDevice->changedInVolume( -InputSlider->value()); 1027 soundDevice->changedInVolume( -InputSlider->value());
1029} 1028}
1030 1029
1031 1030
@@ -1081,53 +1080,53 @@ bool QtRec::setupAudio( bool b) {
1081 sampleformat = SND_PCM_FORMAT_S32; 1080 sampleformat = SND_PCM_FORMAT_S32;
1082 else 1081 else
1083 sampleformat = SND_PCM_FORMAT_U8; 1082 sampleformat = SND_PCM_FORMAT_U8;
1084 1083
1085#else 1084#else
1086 if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") 1085 if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16")
1087 sampleformat = AFMT_S16_LE; 1086 sampleformat = AFMT_S16_LE;
1088 else 1087 else
1089 sampleformat = AFMT_U8; 1088 sampleformat = AFMT_U8;
1090 1089
1091 if( !compressionCheckBox->isChecked()) { 1090 if( !compressionCheckBox->isChecked()) {
1092 filePara.format = WAVE_FORMAT_PCM; 1091 filePara.format = WAVE_FORMAT_PCM;
1093// qDebug("WAVE_FORMAT_PCM"); 1092// odebug << "WAVE_FORMAT_PCM" << oendl;
1094 } else { 1093 } else {
1095 filePara.format = WAVE_FORMAT_DVI_ADPCM; 1094 filePara.format = WAVE_FORMAT_DVI_ADPCM;
1096 sampleformat = AFMT_S16_LE; 1095 sampleformat = AFMT_S16_LE;
1097// qDebug("WAVE_FORMAT_DVI_ADPCM"); 1096// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl;
1098 } 1097 }
1099#endif 1098#endif
1100 1099
1101 stereo = filePara.channels; 1100 stereo = filePara.channels;
1102// filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; 1101// filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100;
1103 flags= O_RDWR; 1102 flags= O_RDWR;
1104// flags= O_RDONLY; 1103// flags= O_RDONLY;
1105 Config hwcfg("OpieRec"); 1104 Config hwcfg("OpieRec");
1106 hwcfg.setGroup("Hardware"); 1105 hwcfg.setGroup("Hardware");
1107 dspString = hwcfg.readEntry( "Audio", DSPSTRIN); 1106 dspString = hwcfg.readEntry( "Audio", DSPSTRIN);
1108 mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN); 1107 mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN);
1109 recording = true; 1108 recording = true;
1110 } 1109 }
1111 1110
1112 // if(soundDevice) delete soundDevice; 1111 // if(soundDevice) delete soundDevice;
1113 qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat); 1112 odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl;
1114 qWarning("change waveform settings"); 1113 owarn << "change waveform settings" << oendl;
1115 waveform->changeSettings( filePara.sampleRate, filePara.channels ); 1114 waveform->changeSettings( filePara.sampleRate, filePara.channels );
1116 1115
1117 soundDevice = new Device( this, dspString, mixerString, b); 1116 soundDevice = new Device( this, dspString, mixerString, b);
1118// soundDevice->openDsp(); 1117// soundDevice->openDsp();
1119 soundDevice->reset(); 1118 soundDevice->reset();
1120 1119
1121 qDebug("device has been made %d", soundDevice->sd); 1120 odebug << "device has been made " << soundDevice->sd << "" << oendl;
1122 1121
1123 ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> 1122 ////////////////// <<<<<<<<<<<<>>>>>>>>>>>>
1124 soundDevice->setDeviceFormat( sampleformat); 1123 soundDevice->setDeviceFormat( sampleformat);
1125 soundDevice->setDeviceChannels( filePara.channels); 1124 soundDevice->setDeviceChannels( filePara.channels);
1126 soundDevice->setDeviceRate( filePara.sampleRate); 1125 soundDevice->setDeviceRate( filePara.sampleRate);
1127 soundDevice->getDeviceFragSize(); 1126 soundDevice->getDeviceFragSize();
1128#ifdef QT_QWS_EBX 1127#ifdef QT_QWS_EBX
1129 int frag = FRAGSIZE; 1128 int frag = FRAGSIZE;
1130 soundDevice->setFragSize( frag); 1129 soundDevice->setFragSize( frag);
1131 soundDevice->getDeviceFragSize(); 1130 soundDevice->getDeviceFragSize();
1132#endif 1131#endif
1133 ///////////////// 1132 /////////////////
@@ -1140,25 +1139,25 @@ bool QtRec::setupAudio( bool b) {
1140 update(); 1139 update();
1141 setCaption( tr( "OpieRecord " )+ QString::number(VERSION) ); 1140 setCaption( tr( "OpieRecord " )+ QString::number(VERSION) );
1142 return false; 1141 return false;
1143 } 1142 }
1144 if(autoMute) 1143 if(autoMute)
1145 doMute(false); 1144 doMute(false);
1146 1145
1147 return true; 1146 return true;
1148} 1147}
1149 1148
1150 1149
1151bool QtRec::setUpFile() { //setup file for recording 1150bool QtRec::setUpFile() { //setup file for recording
1152// qDebug("Setting up wavfile"); 1151// odebug << "Setting up wavfile" << oendl;
1153// if(wavFile) delete wavFile; 1152// if(wavFile) delete wavFile;
1154 wavFile = new WavFile( this, (const QString &)"", 1153 wavFile = new WavFile( this, (const QString &)"",
1155 true, 1154 true,
1156 filePara.sampleRate, 1155 filePara.sampleRate,
1157 filePara.channels, 1156 filePara.channels,
1158 filePara.resolution, 1157 filePara.resolution,
1159 filePara.format); 1158 filePara.format);
1160 1159
1161 filePara.fd = wavFile->wavHandle(); 1160 filePara.fd = wavFile->wavHandle();
1162 if(filePara.fd == -1) { 1161 if(filePara.fd == -1) {
1163 return false; 1162 return false;
1164 } else { 1163 } else {
@@ -1173,25 +1172,25 @@ bool QtRec::doPlay() {
1173 if( !paused) { 1172 if( !paused) {
1174 total = 0; 1173 total = 0;
1175 filePara.numberOfRecordedSeconds = 0; 1174 filePara.numberOfRecordedSeconds = 0;
1176 } else { 1175 } else {
1177 paused = false; 1176 paused = false;
1178 secCount = (int)filePara.numberOfRecordedSeconds; 1177 secCount = (int)filePara.numberOfRecordedSeconds;
1179 } 1178 }
1180 playing = true; 1179 playing = true;
1181 stopped = false; 1180 stopped = false;
1182 recording = false; 1181 recording = false;
1183 1182
1184 QString num; 1183 QString num;
1185 qDebug( "Play number of samples %d", filePara.numberSamples); 1184 odebug << "Play number of samples " << filePara.numberSamples << "" << oendl;
1186 1185
1187// timeSlider->setRange( 0, filePara.numberSamples); 1186// timeSlider->setRange( 0, filePara.numberSamples);
1188 1187
1189 timeString.sprintf("%f", filePara.numberOfRecordedSeconds); 1188 timeString.sprintf("%f", filePara.numberOfRecordedSeconds);
1190 timeLabel->setText( timeString+ tr(" seconds")); 1189 timeLabel->setText( timeString+ tr(" seconds"));
1191 1190
1192 QString msg; 1191 QString msg;
1193 msg.sprintf("%d, %d, %d", 1192 msg.sprintf("%d, %d, %d",
1194 filePara.sampleRate, 1193 filePara.sampleRate,
1195 filePara.channels, 1194 filePara.channels,
1196 filePara.resolution); 1195 filePara.resolution);
1197#ifdef DEV_VERSION 1196#ifdef DEV_VERSION
@@ -1225,45 +1224,45 @@ void QtRec::changebitrateCombo(int i) {
1225 filePara.resolution = bits; 1224 filePara.resolution = bits;
1226 cfg.write(); 1225 cfg.write();
1227} 1226}
1228 1227
1229void QtRec::changesamplerateCombo(int i) { 1228void QtRec::changesamplerateCombo(int i) {
1230 Config cfg("OpieRec"); 1229 Config cfg("OpieRec");
1231 cfg.setGroup("Settings"); 1230 cfg.setGroup("Settings");
1232 int rate=0; 1231 int rate=0;
1233 bool ok; 1232 bool ok;
1234 rate = sampleRateComboBox->text(i).toInt(&ok, 10); 1233 rate = sampleRateComboBox->text(i).toInt(&ok, 10);
1235 cfg.writeEntry( "samplerate",rate); 1234 cfg.writeEntry( "samplerate",rate);
1236 filePara.sampleRate=rate; 1235 filePara.sampleRate=rate;
1237 qDebug( "Change sample rate %d", rate); 1236 odebug << "Change sample rate " << rate << "" << oendl;
1238 cfg.write(); 1237 cfg.write();
1239} 1238}
1240 1239
1241 1240
1242void QtRec::changeDirCombo(int index) { 1241void QtRec::changeDirCombo(int index) {
1243 Config cfg("OpieRec"); 1242 Config cfg("OpieRec");
1244 cfg.setGroup("Settings"); 1243 cfg.setGroup("Settings");
1245 QString sName = directoryComboBox->text(index); 1244 QString sName = directoryComboBox->text(index);
1246 1245
1247 StorageInfo storageInfo; 1246 StorageInfo storageInfo;
1248 const QList<FileSystem> &fs = storageInfo.fileSystems(); 1247 const QList<FileSystem> &fs = storageInfo.fileSystems();
1249 QListIterator<FileSystem> it ( fs ); 1248 QListIterator<FileSystem> it ( fs );
1250 QString storage; 1249 QString storage;
1251 for( ; it.current(); ++it ){ 1250 for( ; it.current(); ++it ){
1252 if( sName == (*it)->name()+" "+ (*it)->path() || 1251 if( sName == (*it)->name()+" "+ (*it)->path() ||
1253 (*it)->name() == sName ) { 1252 (*it)->name() == sName ) {
1254 const QString path = (*it)->path(); 1253 const QString path = (*it)->path();
1255 recDir = path; 1254 recDir = path;
1256 cfg.writeEntry("directory", recDir); 1255 cfg.writeEntry("directory", recDir);
1257 qDebug("new rec dir "+recDir); 1256 odebug << "new rec dir "+recDir << oendl;
1258 } 1257 }
1259 } 1258 }
1260 cfg.write(); 1259 cfg.write();
1261} 1260}
1262 1261
1263 1262
1264void QtRec::changeSizeLimitCombo(int) { 1263void QtRec::changeSizeLimitCombo(int) {
1265 Config cfg("OpieRec"); 1264 Config cfg("OpieRec");
1266 cfg.setGroup("Settings"); 1265 cfg.setGroup("Settings");
1267 cfg.writeEntry("sizeLimit", getCurrentSizeLimit() ); 1266 cfg.writeEntry("sizeLimit", getCurrentSizeLimit() );
1268 cfg.write(); 1267 cfg.write();
1269} 1268}
@@ -1365,25 +1364,25 @@ void QtRec::keyPressEvent( QKeyEvent *e) {
1365 break; 1364 break;
1366 case Key_Space: 1365 case Key_Space:
1367 break; 1366 break;
1368 case Key_Delete: 1367 case Key_Delete:
1369 break; 1368 break;
1370 case Key_Up: 1369 case Key_Up:
1371 // stop(); 1370 // stop();
1372 break; 1371 break;
1373 case Key_Down: 1372 case Key_Down:
1374 // newSound(); 1373 // newSound();
1375 break; 1374 break;
1376 case Key_Left: { 1375 case Key_Left: {
1377 qDebug("rewinding"); 1376 odebug << "rewinding" << oendl;
1378 if( !e->isAutoRepeat()) 1377 if( !e->isAutoRepeat())
1379 rewindPressed(); 1378 rewindPressed();
1380 } 1379 }
1381 break; 1380 break;
1382 case Key_Right: { 1381 case Key_Right: {
1383 if( !e->isAutoRepeat()) 1382 if( !e->isAutoRepeat())
1384 FastforwardPressed(); 1383 FastforwardPressed();
1385 } 1384 }
1386 break; 1385 break;
1387 } 1386 }
1388} 1387}
1389 1388
@@ -1419,37 +1418,37 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
1419 break; 1418 break;
1420 case Key_Space: 1419 case Key_Space:
1421 if(stopped && !recording) 1420 if(stopped && !recording)
1422 newSound(); 1421 newSound();
1423 else 1422 else
1424 stop(); 1423 stop();
1425 break; 1424 break;
1426 case Key_Delete: 1425 case Key_Delete:
1427 deleteSound(); 1426 deleteSound();
1428 break; 1427 break;
1429 case Key_Up: 1428 case Key_Up:
1430 // stop(); 1429 // stop();
1431 qDebug("Up"); 1430 odebug << "Up" << oendl;
1432 break; 1431 break;
1433 case Key_Down: 1432 case Key_Down:
1434 // start(); 1433 // start();
1435 // qDebug("Down"); 1434 // odebug << "Down" << oendl;
1436 // newSound(); 1435 // newSound();
1437 break; 1436 break;
1438 case Key_Left: 1437 case Key_Left:
1439 qDebug("Left"); 1438 odebug << "Left" << oendl;
1440 rewindReleased(); 1439 rewindReleased();
1441 break; 1440 break;
1442 case Key_Right: 1441 case Key_Right:
1443 qDebug("Right"); 1442 odebug << "Right" << oendl;
1444 FastforwardReleased(); 1443 FastforwardReleased();
1445 break; 1444 break;
1446 } 1445 }
1447} 1446}
1448 1447
1449void QtRec::endRecording() { 1448void QtRec::endRecording() {
1450 monitoring = false; 1449 monitoring = false;
1451 recording = false; 1450 recording = false;
1452 stopped = true; 1451 stopped = true;
1453 waveform->reset(); 1452 waveform->reset();
1454 setRecordButton( false); 1453 setRecordButton( false);
1455 1454
@@ -1466,139 +1465,139 @@ void QtRec::endRecording() {
1466 if( wavFile->track.isOpen()) { 1465 if( wavFile->track.isOpen()) {
1467 wavFile->adjustHeaders( filePara.fd, filePara.numberSamples); 1466 wavFile->adjustHeaders( filePara.fd, filePara.numberSamples);
1468 // soundDevice->sd=-1; 1467 // soundDevice->sd=-1;
1469 filePara.numberSamples = 0; 1468 filePara.numberSamples = 0;
1470 // filePara.sd=-1; 1469 // filePara.sd=-1;
1471 wavFile->closeFile(); 1470 wavFile->closeFile();
1472 filePara.fd=0; 1471 filePara.fd=0;
1473 1472
1474 if( wavFile->isTempFile()) { 1473 if( wavFile->isTempFile()) {
1475// move tmp file to regular file 1474// move tmp file to regular file
1476 QString cmd; 1475 QString cmd;
1477 cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); 1476 cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName);
1478// qDebug("moving tmp file to "+currentFileName); 1477// odebug << "moving tmp file to "+currentFileName << oendl;
1479 system( cmd.latin1()); 1478 system( cmd.latin1());
1480 } 1479 }
1481 1480
1482 qDebug("Just moved " + wavFile->currentFileName); 1481 odebug << "Just moved " + wavFile->currentFileName << oendl;
1483 Config cfg("OpieRec"); 1482 Config cfg("OpieRec");
1484 cfg.setGroup("Sounds"); 1483 cfg.setGroup("Sounds");
1485 1484
1486 int nFiles = cfg.readNumEntry( "NumberofFiles",0); 1485 int nFiles = cfg.readNumEntry( "NumberofFiles",0);
1487 1486
1488 currentFile = QFileInfo( wavFile->currentFileName).fileName(); 1487 currentFile = QFileInfo( wavFile->currentFileName).fileName();
1489 currentFile = currentFile.left( currentFile.length() - 4); 1488 currentFile = currentFile.left( currentFile.length() - 4);
1490 1489
1491 cfg.writeEntry( "NumberofFiles", nFiles + 1); 1490 cfg.writeEntry( "NumberofFiles", nFiles + 1);
1492 cfg.writeEntry( QString::number( nFiles + 1), currentFile); 1491 cfg.writeEntry( QString::number( nFiles + 1), currentFile);
1493 cfg.writeEntry( currentFile, wavFile->currentFileName); 1492 cfg.writeEntry( currentFile, wavFile->currentFileName);
1494 1493
1495 QString time; 1494 QString time;
1496 time.sprintf("%.2f", filePara.numberOfRecordedSeconds); 1495 time.sprintf("%.2f", filePara.numberOfRecordedSeconds);
1497 cfg.writeEntry( wavFile->currentFileName, time ); 1496 cfg.writeEntry( wavFile->currentFileName, time );
1498// qDebug("writing config numberOfRecordedSeconds "+time); 1497// odebug << "writing config numberOfRecordedSeconds "+time << oendl;
1499 1498
1500 cfg.write(); 1499 cfg.write();
1501 qDebug("finished recording"); 1500 odebug << "finished recording" << oendl;
1502 timeLabel->setText(""); 1501 timeLabel->setText("");
1503 } 1502 }
1504 1503
1505 if(soundDevice) delete soundDevice; 1504 if(soundDevice) delete soundDevice;
1506 1505
1507 timeSlider->setValue(0); 1506 timeSlider->setValue(0);
1508 initIconView(); 1507 initIconView();
1509 selectItemByName( currentFile); 1508 selectItemByName( currentFile);
1510} 1509}
1511 1510
1512void QtRec::endPlaying() { 1511void QtRec::endPlaying() {
1513 monitoring = false; 1512 monitoring = false;
1514 recording = false; 1513 recording = false;
1515 playing = false; 1514 playing = false;
1516 stopped = true; 1515 stopped = true;
1517 waveform->reset(); 1516 waveform->reset();
1518// errorStop(); 1517// errorStop();
1519// qDebug("end playing"); 1518// odebug << "end playing" << oendl;
1520 setRecordButton( false); 1519 setRecordButton( false);
1521 1520
1522 toBeginningButton->setEnabled( true); 1521 toBeginningButton->setEnabled( true);
1523 toEndButton->setEnabled( true); 1522 toEndButton->setEnabled( true);
1524 1523
1525 if(autoMute) 1524 if(autoMute)
1526 doMute( true); 1525 doMute( true);
1527 1526
1528 soundDevice->closeDevice( false); 1527 soundDevice->closeDevice( false);
1529 soundDevice->sd = -1; 1528 soundDevice->sd = -1;
1530 // if(soundDevice) delete soundDevice; 1529 // if(soundDevice) delete soundDevice;
1531// qDebug("file and sound device closed"); 1530// odebug << "file and sound device closed" << oendl;
1532 timeLabel->setText(""); 1531 timeLabel->setText("");
1533 total = 0; 1532 total = 0;
1534 filePara.numberSamples = 0; 1533 filePara.numberSamples = 0;
1535 filePara.sd = -1; 1534 filePara.sd = -1;
1536// wavFile->closeFile(); 1535// wavFile->closeFile();
1537 filePara.fd = 0; 1536 filePara.fd = 0;
1538// if(wavFile) delete wavFile; //this crashes 1537// if(wavFile) delete wavFile; //this crashes
1539 1538
1540// qDebug("track closed"); 1539// odebug << "track closed" << oendl;
1541 killTimers(); 1540 killTimers();
1542 qWarning("reset slider"); 1541 owarn << "reset slider" << oendl;
1543 timeSlider->setValue(0); 1542 timeSlider->setValue(0);
1544 1543
1545 if(soundDevice) delete soundDevice; 1544 if(soundDevice) delete soundDevice;
1546 1545
1547} 1546}
1548 1547
1549bool QtRec::openPlayFile() { 1548bool QtRec::openPlayFile() {
1550 1549
1551 qApp->processEvents(); 1550 qApp->processEvents();
1552 if( currentFile.isEmpty()) { 1551 if( currentFile.isEmpty()) {
1553 QMessageBox::message(tr("Opierec"),tr("Please select file to play")); 1552 QMessageBox::message(tr("Opierec"),tr("Please select file to play"));
1554 endPlaying(); 1553 endPlaying();
1555 return false; 1554 return false;
1556 } 1555 }
1557 QString currentFileName; 1556 QString currentFileName;
1558 Config cfg("OpieRec"); 1557 Config cfg("OpieRec");
1559 cfg.setGroup("Sounds"); 1558 cfg.setGroup("Sounds");
1560 int nFiles = cfg.readNumEntry( "NumberofFiles", 0); 1559 int nFiles = cfg.readNumEntry( "NumberofFiles", 0);
1561 for(int i=0;i<nFiles+1;i++) { //look for file 1560 for(int i=0;i<nFiles+1;i++) { //look for file
1562 if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { 1561 if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) {
1563 currentFileName = cfg.readEntry( currentFile, "" ); 1562 currentFileName = cfg.readEntry( currentFile, "" );
1564 qDebug("opening for play: " + currentFileName); 1563 odebug << "opening for play: " + currentFileName << oendl;
1565 } 1564 }
1566 } 1565 }
1567 wavFile = new WavFile(this, 1566 wavFile = new WavFile(this,
1568 currentFileName, 1567 currentFileName,
1569 false); 1568 false);
1570 filePara.fd = wavFile->wavHandle(); 1569 filePara.fd = wavFile->wavHandle();
1571 if(filePara.fd == -1) { 1570 if(filePara.fd == -1) {
1572 // if(!track.open(IO_ReadOnly)) { 1571 // if(!track.open(IO_ReadOnly)) {
1573 QString errorMsg = (QString)strerror(errno); 1572 QString errorMsg = (QString)strerror(errno);
1574 monitoring = false; 1573 monitoring = false;
1575 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); 1574 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) );
1576 QMessageBox::message(tr("Note"), tr("Could not open audio file.\n") 1575 QMessageBox::message(tr("Note"), tr("Could not open audio file.\n")
1577 + errorMsg + "\n" + currentFile); 1576 + errorMsg + "\n" + currentFile);
1578 return false; 1577 return false;
1579 } else { 1578 } else {
1580 1579
1581 filePara.numberSamples = wavFile->getNumberSamples(); 1580 filePara.numberSamples = wavFile->getNumberSamples();
1582 filePara.format = wavFile->getFormat(); 1581 filePara.format = wavFile->getFormat();
1583 filePara.sampleRate = wavFile->getSampleRate(); 1582 filePara.sampleRate = wavFile->getSampleRate();
1584 filePara.resolution = wavFile->getResolution(); 1583 filePara.resolution = wavFile->getResolution();
1585 filePara.channels = wavFile->getChannels(); 1584 filePara.channels = wavFile->getChannels();
1586 timeSlider->setPageStep(1); 1585 timeSlider->setPageStep(1);
1587 monitoring = true; 1586 monitoring = true;
1588 1587
1589 qDebug("file %d, samples %d %d", filePara.fd, filePara.numberSamples, filePara.sampleRate); 1588 odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl;
1590 int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8)); 1589 int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8));
1591 1590
1592 qWarning("seconds %d", sec); 1591 owarn << "seconds " << sec << "" << oendl;
1593 1592
1594 timeSlider->setRange(0, filePara.numberSamples ); 1593 timeSlider->setRange(0, filePara.numberSamples );
1595 } 1594 }
1596 1595
1597 return true; 1596 return true;
1598} 1597}
1599 1598
1600void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { 1599void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) {
1601 if(item == NULL ) 1600 if(item == NULL )
1602 return; 1601 return;
1603 switch (mouse) { 1602 switch (mouse) {
1604 case 1: { 1603 case 1: {
@@ -1681,37 +1680,37 @@ void QtRec::doRename() {
1681 1680
1682 renameBox->selectAll(); 1681 renameBox->selectAll();
1683 renameBox->installEventFilter( this ); 1682 renameBox->installEventFilter( this );
1684 ListView1->addChild( renameBox, r.x(), r.y() ); 1683 ListView1->addChild( renameBox, r.x(), r.y() );
1685 renameBox->resize( r.size() ); 1684 renameBox->resize( r.size() );
1686 ListView1->viewport()->setFocusProxy( renameBox ); 1685 ListView1->viewport()->setFocusProxy( renameBox );
1687 renameBox->setFocus(); 1686 renameBox->setFocus();
1688 renameBox->show(); 1687 renameBox->show();
1689 1688
1690} 1689}
1691 1690
1692void QtRec::okRename() { 1691void QtRec::okRename() {
1693 qDebug(renameBox->text()); 1692 odebug << renameBox->text() << oendl;
1694 QString filename = renameBox->text(); 1693 QString filename = renameBox->text();
1695 cancelRename(); 1694 cancelRename();
1696 1695
1697 if( ListView1->currentItem() == NULL) 1696 if( ListView1->currentItem() == NULL)
1698 return; 1697 return;
1699 1698
1700 Config cfg("OpieRec"); 1699 Config cfg("OpieRec");
1701 cfg.setGroup("Sounds"); 1700 cfg.setGroup("Sounds");
1702 1701
1703 QString file = ListView1->currentItem()->text(0); 1702 QString file = ListView1->currentItem()->text(0);
1704 1703
1705 qDebug("filename is " + filename); 1704 odebug << "filename is " + filename << oendl;
1706 1705
1707 int nFiles = cfg.readNumEntry("NumberofFiles",0); 1706 int nFiles = cfg.readNumEntry("NumberofFiles",0);
1708 1707
1709 for(int i=0;i<nFiles+1;i++) { //look for file 1708 for(int i=0;i<nFiles+1;i++) { //look for file
1710 if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { 1709 if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) {
1711 1710
1712 QString filePath = cfg.readEntry(file,""); 1711 QString filePath = cfg.readEntry(file,"");
1713 1712
1714 cfg.writeEntry( QString::number(i), filename ); 1713 cfg.writeEntry( QString::number(i), filename );
1715 cfg.writeEntry( filename, filePath ); 1714 cfg.writeEntry( filename, filePath );
1716 cfg.removeEntry( file); 1715 cfg.removeEntry( file);
1717 cfg.write(); 1716 cfg.write();
@@ -1764,25 +1763,25 @@ void QtRec::timerBreak() {
1764 endPlaying(); 1763 endPlaying();
1765} 1764}
1766 1765
1767void QtRec::doVolMuting(bool b) { 1766void QtRec::doVolMuting(bool b) {
1768 Config cfg( "qpe" ); 1767 Config cfg( "qpe" );
1769 cfg. setGroup( "Volume" ); 1768 cfg. setGroup( "Volume" );
1770 cfg.writeEntry( "Mute",b); 1769 cfg.writeEntry( "Mute",b);
1771 cfg.write(); 1770 cfg.write();
1772 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << b; 1771 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << b;
1773} 1772}
1774 1773
1775void QtRec::doMicMuting(bool b) { 1774void QtRec::doMicMuting(bool b) {
1776 // qDebug("mic mute"); 1775 // odebug << "mic mute" << oendl;
1777 Config cfg( "qpe" ); 1776 Config cfg( "qpe" );
1778 cfg. setGroup( "Volume" ); 1777 cfg. setGroup( "Volume" );
1779 cfg.writeEntry( "MicMute",b); 1778 cfg.writeEntry( "MicMute",b);
1780 cfg.write(); 1779 cfg.write();
1781 QCopEnvelope( "QPE/System", "micChange(bool)" ) << b; 1780 QCopEnvelope( "QPE/System", "micChange(bool)" ) << b;
1782} 1781}
1783 1782
1784void QtRec::compressionSelected(bool b) { 1783void QtRec::compressionSelected(bool b) {
1785 Config cfg("OpieRec"); 1784 Config cfg("OpieRec");
1786 cfg.setGroup("Settings"); 1785 cfg.setGroup("Settings");
1787 cfg.writeEntry("wavCompression", b); 1786 cfg.writeEntry("wavCompression", b);
1788 cfg.writeEntry("bitrate", 16); 1787 cfg.writeEntry("bitrate", 16);
@@ -1820,90 +1819,90 @@ long QtRec::checkDiskSpace(const QString &path) {
1820 1819
1821// short f_fstyp; /* File system type */ 1820// short f_fstyp; /* File system type */
1822// long f_bsize; /* Block size */ 1821// long f_bsize; /* Block size */
1823// long f_frsize; /* Fragment size */ 1822// long f_frsize; /* Fragment size */
1824// long f_blocks; /* Total number of blocks*/ 1823// long f_blocks; /* Total number of blocks*/
1825// long f_bfree; /* Count of free blocks */ 1824// long f_bfree; /* Count of free blocks */
1826// long f_files; /* Total number of file nodes */ 1825// long f_files; /* Total number of file nodes */
1827// long f_ffree; /* Count of free file nodes */ 1826// long f_ffree; /* Count of free file nodes */
1828// char f_fname[6]; /* Volumename */ 1827// char f_fname[6]; /* Volumename */
1829// char f_fpack[6]; /* Pack name */ 1828// char f_fpack[6]; /* Pack name */
1830 1829
1831void QtRec::receive( const QCString &msg, const QByteArray & ) { 1830void QtRec::receive( const QCString &msg, const QByteArray & ) {
1832 qDebug("Voicerecord received message "+msg); 1831 odebug << "Voicerecord received message "+msg << oendl;
1833 1832
1834} 1833}
1835 1834
1836 1835
1837///////////////////////////// timerEvent 1836///////////////////////////// timerEvent
1838void QtRec::timerEvent( QTimerEvent * ) { 1837void QtRec::timerEvent( QTimerEvent * ) {
1839 1838
1840// if(!recording) 1839// if(!recording)
1841// timeSlider->setValue( secCount); 1840// timeSlider->setValue( secCount);
1842// else 1841// else
1843// timeSlider->setValue( filePara.numberOfRecordedSeconds); 1842// timeSlider->setValue( filePara.numberOfRecordedSeconds);
1844 1843
1845 if( stopped && playing) { 1844 if( stopped && playing) {
1846 stop(); 1845 stop();
1847 } 1846 }
1848 1847
1849 if( stopped && recording ){ 1848 if( stopped && recording ){
1850 stop(); 1849 stop();
1851 } 1850 }
1852 1851
1853 if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) { 1852 if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) {
1854 stop(); 1853 stop();
1855 } 1854 }
1856 1855
1857 qDebug( "%d", secCount ); 1856 odebug << "" << secCount << "" << oendl;
1858 QString timeString; 1857 QString timeString;
1859#ifdef DEV_VERSION 1858#ifdef DEV_VERSION
1860 QString msg; 1859 QString msg;
1861 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); 1860 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution);
1862 setCaption( msg +" :: "+QString::number(secCount)); 1861 setCaption( msg +" :: "+QString::number(secCount));
1863#endif 1862#endif
1864 1863
1865 timeString.sprintf("%d", secCount); 1864 timeString.sprintf("%d", secCount);
1866 timeLabel->setText( timeString + " seconds"); 1865 timeLabel->setText( timeString + " seconds");
1867 1866
1868 secCount++; 1867 secCount++;
1869} 1868}
1870 1869
1871void QtRec::changeTimeSlider(int index) { 1870void QtRec::changeTimeSlider(int index) {
1872 if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; 1871 if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return;
1873 // qDebug("Slider moved to %d",index); 1872 // odebug << "Slider moved to " << index << "" << oendl;
1874 paused = true; 1873 paused = true;
1875 stopped = true; 1874 stopped = true;
1876 1875
1877 sliderPos=index; 1876 sliderPos=index;
1878 1877
1879 QString timeString; 1878 QString timeString;
1880 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; 1879 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2;
1881 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); 1880 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds);
1882 secCount = (int)filePara.numberOfRecordedSeconds; 1881 secCount = (int)filePara.numberOfRecordedSeconds;
1883 timeLabel->setText( timeString + tr(" seconds")); 1882 timeLabel->setText( timeString + tr(" seconds"));
1884} 1883}
1885 1884
1886void QtRec::timeSliderPressed() { 1885void QtRec::timeSliderPressed() {
1887 if( ListView1->currentItem() == 0) return; 1886 if( ListView1->currentItem() == 0) return;
1888 // qDebug("slider pressed"); 1887 // odebug << "slider pressed" << oendl;
1889 paused = true; 1888 paused = true;
1890 stopped = true; 1889 stopped = true;
1891} 1890}
1892 1891
1893void QtRec::timeSliderReleased() { 1892void QtRec::timeSliderReleased() {
1894 if( ListView1->currentItem() == 0) return; 1893 if( ListView1->currentItem() == 0) return;
1895 sliderPos = timeSlider->value(); 1894 sliderPos = timeSlider->value();
1896 1895
1897 // qDebug("slider released %d", sliderPos); 1896 // odebug << "slider released " << sliderPos << "" << oendl;
1898 stopped = false; 1897 stopped = false;
1899 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); 1898 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET);
1900 total = newPos*4; 1899 total = newPos*4;
1901 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; 1900 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2;
1902 1901
1903 doPlay(); 1902 doPlay();
1904} 1903}
1905 1904
1906void QtRec::rewindPressed() { 1905void QtRec::rewindPressed() {
1907 if( ListView1->currentItem() == 0) return; 1906 if( ListView1->currentItem() == 0) return;
1908 if( !wavFile->track.isOpen()) { 1907 if( !wavFile->track.isOpen()) {
1909 if( !openPlayFile() ) 1908 if( !openPlayFile() )
@@ -1915,39 +1914,39 @@ void QtRec::rewindPressed() {
1915 killTimers(); 1914 killTimers();
1916 paused = true; 1915 paused = true;
1917 stopped = true; 1916 stopped = true;
1918 rewindTimer->start( 50, false); 1917 rewindTimer->start( 50, false);
1919 } 1918 }
1920} 1919}
1921 1920
1922void QtRec::rewindTimerTimeout() { 1921void QtRec::rewindTimerTimeout() {
1923 int sliderValue = timeSlider->value(); 1922 int sliderValue = timeSlider->value();
1924 sliderValue = sliderValue - ( filePara.numberSamples / 100); 1923 sliderValue = sliderValue - ( filePara.numberSamples / 100);
1925 // if(toBeginningButton->isDown()) 1924 // if(toBeginningButton->isDown())
1926 timeSlider->setValue( sliderValue ) ; 1925 timeSlider->setValue( sliderValue ) ;
1927 // qDebug("%d", sliderValue); 1926 // odebug << "" << sliderValue << "" << oendl;
1928 QString timeString; 1927 QString timeString;
1929 filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; 1928 filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2;
1930 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); 1929 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds);
1931 timeLabel->setText( timeString+ tr(" seconds")); 1930 timeLabel->setText( timeString+ tr(" seconds"));
1932} 1931}
1933 1932
1934void QtRec::rewindReleased() { 1933void QtRec::rewindReleased() {
1935 rewindTimer->stop(); 1934 rewindTimer->stop();
1936 if( wavFile->track.isOpen()) { 1935 if( wavFile->track.isOpen()) {
1937 sliderPos=timeSlider->value(); 1936 sliderPos=timeSlider->value();
1938 stopped = false; 1937 stopped = false;
1939 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); 1938 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET);
1940 total = newPos * 4; 1939 total = newPos * 4;
1941 // qDebug("rewind released %d", total); 1940 // odebug << "rewind released " << total << "" << oendl;
1942 startTimer( 1000); 1941 startTimer( 1000);
1943 doPlay(); 1942 doPlay();
1944 } 1943 }
1945} 1944}
1946 1945
1947void QtRec::FastforwardPressed() { 1946void QtRec::FastforwardPressed() {
1948 if( ListView1->currentItem() == 0) return; 1947 if( ListView1->currentItem() == 0) return;
1949 if( !wavFile->track.isOpen()) 1948 if( !wavFile->track.isOpen())
1950 if( !openPlayFile() ) 1949 if( !openPlayFile() )
1951 return; 1950 return;
1952 else 1951 else
1953 if( !setupAudio( false)) 1952 if( !setupAudio( false))
@@ -1993,25 +1992,25 @@ QString QtRec::getStorage(const QString &fileName) {
1993 const QList<FileSystem> &fs = storageInfo.fileSystems(); 1992 const QList<FileSystem> &fs = storageInfo.fileSystems();
1994 QListIterator<FileSystem> it ( fs ); 1993 QListIterator<FileSystem> it ( fs );
1995 QString storage; 1994 QString storage;
1996 for( ; it.current(); ++it ){ 1995 for( ; it.current(); ++it ){
1997 const QString name = ( *it)->name(); 1996 const QString name = ( *it)->name();
1998 const QString path = ( *it)->path(); 1997 const QString path = ( *it)->path();
1999 const QString disk = ( *it)->disk(); 1998 const QString disk = ( *it)->disk();
2000 if( fileName.find( path,0,true) != -1) 1999 if( fileName.find( path,0,true) != -1)
2001 storage = name; 2000 storage = name;
2002 // const QString options = (*it)->options(); 2001 // const QString options = (*it)->options();
2003 // if( name.find( tr("Internal"),0,true) == -1) { 2002 // if( name.find( tr("Internal"),0,true) == -1) {
2004 // storageComboBox->insertItem( name +" -> "+disk); 2003 // storageComboBox->insertItem( name +" -> "+disk);
2005 // qDebug(name); 2004 // odebug << name << oendl;
2006 } 2005 }
2007 return storage; 2006 return storage;
2008 // struct mntent *me; 2007 // struct mntent *me;
2009 // // if(fileName == "/etc/mtab") { 2008 // // if(fileName == "/etc/mtab") {
2010 // FILE *mntfp = setmntent( fileName.latin1(), "r" ); 2009 // FILE *mntfp = setmntent( fileName.latin1(), "r" );
2011 // if ( mntfp ) { 2010 // if ( mntfp ) {
2012 // while ( (me = getmntent( mntfp )) != 0 ) { 2011 // while ( (me = getmntent( mntfp )) != 0 ) {
2013 // QString filesystemType = me->mnt_type; 2012 // QString filesystemType = me->mnt_type;
2014 2013
2015 // } 2014 // }
2016 // } 2015 // }
2017 // endmntent( mntfp ); 2016 // endmntent( mntfp );
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp
index 35bc14d..7e9b50f 100644
--- a/noncore/multimedia/opierec/wavFile.cpp
+++ b/noncore/multimedia/opierec/wavFile.cpp
@@ -1,274 +1,277 @@
1//wavFile.cpp 1//wavFile.cpp
2#include "wavFile.h" 2#include "wavFile.h"
3#include "qtrec.h" 3#include "qtrec.h"
4 4
5/* OPIE */
6#include <opie2/odebug.h>
7#include <qpe/config.h>
8using namespace Opie::Core;
9
10/* QT */
5#include <qmessagebox.h> 11#include <qmessagebox.h>
6#include <qdir.h> 12#include <qdir.h>
7 13
8#include <qpe/config.h> 14/* STD */
9
10#include <errno.h> 15#include <errno.h>
11
12#include <sys/time.h> 16#include <sys/time.h>
13#include <sys/types.h> 17#include <sys/types.h>
14#include <sys/vfs.h> 18#include <sys/vfs.h>
15
16#include <fcntl.h> 19#include <fcntl.h>
17#include <math.h> 20#include <math.h>
18#include <mntent.h> 21#include <mntent.h>
19#include <stdio.h> 22#include <stdio.h>
20#include <stdlib.h> 23#include <stdlib.h>
21#include <unistd.h> 24#include <unistd.h>
22 25
23WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate, 26WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate,
24 int channels, int resolution, int format ) 27 int channels, int resolution, int format )
25 : QObject( parent) 28 : QObject( parent)
26{ 29{
27//qDebug("new wave file"); 30//odebug << "new wave file" << oendl;
28 bool b = makeNwFile; 31 bool b = makeNwFile;
29 wavSampleRate=sampleRate; 32 wavSampleRate=sampleRate;
30 wavFormat=format; 33 wavFormat=format;
31 wavChannels=channels; 34 wavChannels=channels;
32 wavResolution=resolution; 35 wavResolution=resolution;
33 useTmpFile=false; 36 useTmpFile=false;
34 if( b) { 37 if( b) {
35 newFile(); 38 newFile();
36 } else { 39 } else {
37 openFile(fileName); 40 openFile(fileName);
38 } 41 }
39} 42}
40 43
41bool WavFile::newFile() { 44bool WavFile::newFile() {
42 45
43// qDebug("Set up new file"); 46// odebug << "Set up new file" << oendl;
44 Config cfg("OpieRec"); 47 Config cfg("OpieRec");
45 cfg.setGroup("Settings"); 48 cfg.setGroup("Settings");
46 49
47 currentFileName=cfg.readEntry("directory",QDir::homeDirPath()); 50 currentFileName=cfg.readEntry("directory",QDir::homeDirPath());
48 QString date; 51 QString date;
49 QDateTime dt = QDateTime::currentDateTime(); 52 QDateTime dt = QDateTime::currentDateTime();
50 date = dt.toString();//TimeString::dateString( QDateTime::currentDateTime(),false,true); 53 date = dt.toString();//TimeString::dateString( QDateTime::currentDateTime(),false,true);
51 date.replace(QRegExp("'"),""); 54 date.replace(QRegExp("'"),"");
52 date.replace(QRegExp(" "),"_"); 55 date.replace(QRegExp(" "),"_");
53 date.replace(QRegExp(":"),"."); 56 date.replace(QRegExp(":"),".");
54 date.replace(QRegExp(","),""); 57 date.replace(QRegExp(","),"");
55 58
56 QString currentFile=date; 59 QString currentFile=date;
57 if(currentFileName.right(1).find("/",0,true) == -1) 60 if(currentFileName.right(1).find("/",0,true) == -1)
58 currentFileName += "/" + date; 61 currentFileName += "/" + date;
59 else 62 else
60 currentFileName += date; 63 currentFileName += date;
61 currentFileName+=".wav"; 64 currentFileName+=".wav";
62 65
63// qDebug("set up file for recording: "+currentFileName); 66// odebug << "set up file for recording: "+currentFileName << oendl;
64 char pointer[] = "/tmp/opierec-XXXXXX"; 67 char pointer[] = "/tmp/opierec-XXXXXX";
65 int fd = 0; 68 int fd = 0;
66 69
67 if( currentFileName.find("/mnt",0,true) == -1 70 if( currentFileName.find("/mnt",0,true) == -1
68 && currentFileName.find("/tmp",0,true) == -1 ) { 71 && currentFileName.find("/tmp",0,true) == -1 ) {
69 // if destination file is most likely in flash (assuming jffs2) 72 // if destination file is most likely in flash (assuming jffs2)
70 // we have to write to a different filesystem first 73 // we have to write to a different filesystem first
71 74
72 useTmpFile = true; 75 useTmpFile = true;
73 if(( fd = mkstemp( pointer)) < 0 ) { 76 if(( fd = mkstemp( pointer)) < 0 ) {
74 perror("mkstemp failed"); 77 perror("mkstemp failed");
75 return false; 78 return false;
76 } 79 }
77 80
78// qDebug("Opening tmp file %s",pointer); 81// odebug << "Opening tmp file " << pointer << "" << oendl;
79 track.setName( pointer); 82 track.setName( pointer);
80 83
81 } else { //just use regular file.. no moving 84 } else { //just use regular file.. no moving
82 85
83 useTmpFile = false; 86 useTmpFile = false;
84 track.setName( currentFileName); 87 track.setName( currentFileName);
85 } 88 }
86 if(!track.open( IO_ReadWrite | IO_Truncate)) { 89 if(!track.open( IO_ReadWrite | IO_Truncate)) {
87 QString errorMsg=(QString)strerror(errno); 90 QString errorMsg=(QString)strerror(errno);
88 qDebug(errorMsg); 91 odebug << errorMsg << oendl;
89 QMessageBox::message("Note", "Error opening file.\n" +errorMsg); 92 QMessageBox::message("Note", "Error opening file.\n" +errorMsg);
90 93
91 return false; 94 return false;
92 } else { 95 } else {
93 setWavHeader( track.handle() , &hdr); 96 setWavHeader( track.handle() , &hdr);
94 } 97 }
95return true; 98return true;
96} 99}
97 100
98WavFile::~WavFile() { 101WavFile::~WavFile() {
99 102
100 closeFile(); 103 closeFile();
101} 104}
102 105
103void WavFile::closeFile() { 106void WavFile::closeFile() {
104 if(track.isOpen()) 107 if(track.isOpen())
105 track.close(); 108 track.close();
106} 109}
107 110
108int WavFile::openFile(const QString &currentFileName) { 111int WavFile::openFile(const QString &currentFileName) {
109// qDebug("open play file "+currentFileName); 112// odebug << "open play file "+currentFileName << oendl;
110 closeFile(); 113 closeFile();
111 114
112 track.setName(currentFileName); 115 track.setName(currentFileName);
113 116
114 if(!track.open(IO_ReadOnly)) { 117 if(!track.open(IO_ReadOnly)) {
115 QString errorMsg=(QString)strerror(errno); 118 QString errorMsg=(QString)strerror(errno);
116 qDebug("<<<<<<<<<<< "+errorMsg+currentFileName); 119 odebug << "<<<<<<<<<<< "+errorMsg+currentFileName << oendl;
117 QMessageBox::message("Note", "Error opening file.\n" +errorMsg); 120 QMessageBox::message("Note", "Error opening file.\n" +errorMsg);
118 return -1; 121 return -1;
119 } else { 122 } else {
120 parseWavHeader( track.handle()); 123 parseWavHeader( track.handle());
121 } 124 }
122 return track.handle(); 125 return track.handle();
123} 126}
124 127
125bool WavFile::setWavHeader(int fd, wavhdr *hdr) { 128bool WavFile::setWavHeader(int fd, wavhdr *hdr) {
126 129
127 strncpy((*hdr).riffID, "RIFF", 4); // RIFF 130 strncpy((*hdr).riffID, "RIFF", 4); // RIFF
128 strncpy((*hdr).wavID, "WAVE", 4); //WAVE 131 strncpy((*hdr).wavID, "WAVE", 4); //WAVE
129 strncpy((*hdr).fmtID, "fmt ", 4); // fmt 132 strncpy((*hdr).fmtID, "fmt ", 4); // fmt
130 (*hdr).fmtLen = 16; // format length = 16 133 (*hdr).fmtLen = 16; // format length = 16
131 134
132 if( wavFormat == WAVE_FORMAT_PCM) { 135 if( wavFormat == WAVE_FORMAT_PCM) {
133 (*hdr).fmtTag = 1; // PCM 136 (*hdr).fmtTag = 1; // PCM
134// qDebug("set header WAVE_FORMAT_PCM"); 137// odebug << "set header WAVE_FORMAT_PCM" << oendl;
135 } 138 }
136 else { 139 else {
137 (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM 140 (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM
138 // qDebug("set header WAVE_FORMAT_DVI_ADPCM"); 141 // odebug << "set header WAVE_FORMAT_DVI_ADPCM" << oendl;
139 } 142 }
140 143
141 // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels 144 // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels
142 (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels 145 (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels
143 146
144 (*hdr).sampleRate = wavSampleRate; //samples per second 147 (*hdr).sampleRate = wavSampleRate; //samples per second
145 (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second 148 (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second
146 (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align 149 (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align
147 (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16 150 (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16
148 151
149 strncpy((*hdr).dataID, "data", 4); 152 strncpy((*hdr).dataID, "data", 4);
150 153
151 write( fd,hdr, sizeof(*hdr)); 154 write( fd,hdr, sizeof(*hdr));
152 qDebug("writing header: bitrate%d, samplerate %d, channels %d", 155 qDebug("writing header: bitrate%d, samplerate %d, channels %d",
153 wavResolution, wavSampleRate, wavChannels); 156 wavResolution, wavSampleRate, wavChannels);
154 return true; 157 return true;
155} 158}
156 159
157bool WavFile::adjustHeaders(int fd, int total) { 160bool WavFile::adjustHeaders(int fd, int total) {
158 lseek(fd, 4, SEEK_SET); 161 lseek(fd, 4, SEEK_SET);
159 int i = total + 36; 162 int i = total + 36;
160 write( fd, &i, sizeof(i)); 163 write( fd, &i, sizeof(i));
161 lseek( fd, 40, SEEK_SET); 164 lseek( fd, 40, SEEK_SET);
162 write( fd, &total, sizeof(total)); 165 write( fd, &total, sizeof(total));
163 qDebug("adjusting header %d", total); 166 odebug << "adjusting header " << total << "" << oendl;
164 return true; 167 return true;
165} 168}
166 169
167int WavFile::parseWavHeader(int fd) { 170int WavFile::parseWavHeader(int fd) {
168 qDebug("Parsing wav header"); 171 odebug << "Parsing wav header" << oendl;
169 char string[4]; 172 char string[4];
170 int found; 173 int found;
171 short fmt; 174 short fmt;
172 unsigned short ch, bitrate; 175 unsigned short ch, bitrate;
173 unsigned long samplerrate, longdata; 176 unsigned long samplerrate, longdata;
174 177
175 if (read(fd, string, 4) < 4) { 178 if (read(fd, string, 4) < 4) {
176 qDebug(" Could not read from sound file.\n"); 179 odebug << " Could not read from sound file.\n" << oendl;
177 return -1; 180 return -1;
178 } 181 }
179 if (strncmp(string, "RIFF", 4)) { 182 if (strncmp(string, "RIFF", 4)) {
180 qDebug(" not a valid WAV file.\n"); 183 odebug << " not a valid WAV file.\n" << oendl;
181 return -1; 184 return -1;
182 } 185 }
183 lseek(fd, 4, SEEK_CUR); 186 lseek(fd, 4, SEEK_CUR);
184 if (read(fd, string, 4) < 4) { 187 if (read(fd, string, 4) < 4) {
185 qDebug("Could not read from sound file.\n"); 188 odebug << "Could not read from sound file.\n" << oendl;
186 return -1; 189 return -1;
187 } 190 }
188 if (strncmp(string, "WAVE", 4)) { 191 if (strncmp(string, "WAVE", 4)) {
189 qDebug("not a valid WAV file.\n"); 192 odebug << "not a valid WAV file.\n" << oendl;
190 return -1; 193 return -1;
191 } 194 }
192 found = 0; 195 found = 0;
193 196
194 while (!found) { 197 while (!found) {
195 if (read(fd, string, 4) < 4) { 198 if (read(fd, string, 4) < 4) {
196 qDebug("Could not read from sound file.\n"); 199 odebug << "Could not read from sound file.\n" << oendl;
197 return -1; 200 return -1;
198 } 201 }
199 if (strncmp(string, "fmt ", 4)) { 202 if (strncmp(string, "fmt ", 4)) {
200 if (read(fd, &longdata, 4) < 4) { 203 if (read(fd, &longdata, 4) < 4) {
201 qDebug("Could not read from sound file.\n"); 204 odebug << "Could not read from sound file.\n" << oendl;
202 return -1; 205 return -1;
203 } 206 }
204 lseek(fd, longdata, SEEK_CUR); 207 lseek(fd, longdata, SEEK_CUR);
205 } else { 208 } else {
206 lseek(fd, 4, SEEK_CUR); 209 lseek(fd, 4, SEEK_CUR);
207 if (read(fd, &fmt, 2) < 2) { 210 if (read(fd, &fmt, 2) < 2) {
208 qDebug("Could not read format chunk.\n"); 211 odebug << "Could not read format chunk.\n" << oendl;
209 return -1; 212 return -1;
210 } 213 }
211 if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { 214 if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) {
212 qDebug("Wave file contains unknown format." 215 qDebug("Wave file contains unknown format."
213 " Unable to continue.\n"); 216 " Unable to continue.\n");
214 return -1; 217 return -1;
215 } 218 }
216 wavFormat = fmt; 219 wavFormat = fmt;
217 // compressionFormat=fmt; 220 // compressionFormat=fmt;
218 qDebug("compressionFormat is %d", fmt); 221 odebug << "compressionFormat is " << fmt << "" << oendl;
219 if (read(fd, &ch, 2) < 2) { 222 if (read(fd, &ch, 2) < 2) {
220 qDebug("Could not read format chunk.\n"); 223 odebug << "Could not read format chunk.\n" << oendl;
221 return -1; 224 return -1;
222 } else { 225 } else {
223 wavChannels = ch; 226 wavChannels = ch;
224 qDebug("File has %d channels", ch); 227 odebug << "File has " << ch << " channels" << oendl;
225 } 228 }
226 if (read(fd, &samplerrate, 4) < 4) { 229 if (read(fd, &samplerrate, 4) < 4) {
227 qDebug("Could not read from format chunk.\n"); 230 odebug << "Could not read from format chunk.\n" << oendl;
228 return -1; 231 return -1;
229 } else { 232 } else {
230 wavSampleRate = samplerrate; 233 wavSampleRate = samplerrate;
231 // sampleRate = samplerrate; 234 // sampleRate = samplerrate;
232 qDebug("File has samplerate of %d",(int) samplerrate); 235 odebug << "File has samplerate of " << (int) samplerrate << "" << oendl;
233 } 236 }
234 lseek(fd, 6, SEEK_CUR); 237 lseek(fd, 6, SEEK_CUR);
235 if (read(fd, &bitrate, 2) < 2) { 238 if (read(fd, &bitrate, 2) < 2) {
236 qDebug("Could not read format chunk.\n"); 239 odebug << "Could not read format chunk.\n" << oendl;
237 return -1; 240 return -1;
238 } else { 241 } else {
239 wavResolution=bitrate; 242 wavResolution=bitrate;
240 // resolution = bitrate; 243 // resolution = bitrate;
241 qDebug("File has bitrate of %d", bitrate); 244 odebug << "File has bitrate of " << bitrate << "" << oendl;
242 } 245 }
243 found++; 246 found++;
244 } 247 }
245 } 248 }
246 found = 0; 249 found = 0;
247 while (!found) { 250 while (!found) {
248 if (read(fd, string, 4) < 4) { 251 if (read(fd, string, 4) < 4) {
249 qDebug("Could not read from sound file.\n"); 252 odebug << "Could not read from sound file.\n" << oendl;
250 return -1; 253 return -1;
251 } 254 }
252 255
253 if (strncmp(string, "data", 4)) { 256 if (strncmp(string, "data", 4)) {
254 if (read(fd, &longdata, 4)<4) { 257 if (read(fd, &longdata, 4)<4) {
255 qDebug("Could not read from sound file.\n"); 258 odebug << "Could not read from sound file.\n" << oendl;
256 return -1; 259 return -1;
257 } 260 }
258 261
259 lseek(fd, longdata, SEEK_CUR); 262 lseek(fd, longdata, SEEK_CUR);
260 } else { 263 } else {
261 if (read(fd, &longdata, 4) < 4) { 264 if (read(fd, &longdata, 4) < 4) {
262 qDebug("Could not read from sound file.\n"); 265 odebug << "Could not read from sound file.\n" << oendl;
263 return -1; 266 return -1;
264 } else { 267 } else {
265 wavNumberSamples = longdata; 268 wavNumberSamples = longdata;
266 qDebug("file has length of %d \nlasting %d seconds", (int)longdata, 269 qDebug("file has length of %d \nlasting %d seconds", (int)longdata,
267 (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); 270 (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) );
268// wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); 271// wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8));
269 272
270 return longdata; 273 return longdata;
271 } 274 }
272 } 275 }
273 } 276 }
274 277
diff --git a/noncore/multimedia/opierec/waveform.cpp b/noncore/multimedia/opierec/waveform.cpp
index 9cc40b4..7c9a25f 100644
--- a/noncore/multimedia/opierec/waveform.cpp
+++ b/noncore/multimedia/opierec/waveform.cpp
@@ -10,46 +10,50 @@
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 "waveform.h" 20#include "waveform.h"
21 21
22#include <qpainter.h> 22/* OPIE */
23#include <opie2/odebug.h>
24using namespace Opie::Core;
23 25
26/* QT */
27#include <qpainter.h>
24 28
25Waveform::Waveform( QWidget *parent, const char *name, WFlags fl ) 29Waveform::Waveform( QWidget *parent, const char *name, WFlags fl )
26 : QWidget( parent, name, fl ) 30 : QWidget( parent, name, fl )
27{ 31{
28 pixmap = 0; 32 pixmap = 0;
29 windowSize = 100; 33 windowSize = 100;
30 samplesPerPixel = 8000 / (5 * windowSize); 34 samplesPerPixel = 8000 / (5 * windowSize);
31 currentValue = 0; 35 currentValue = 0;
32 numSamples = 0; 36 numSamples = 0;
33 windowPosn = 0; 37 windowPosn = 0;
34 window = 0; 38 window = 0;
35} 39}
36 40
37 41
38void Waveform::changeSettings( int frequency, int channels ) 42void Waveform::changeSettings( int frequency, int channels )
39{ 43{
40 makePixmap(); 44 makePixmap();
41// qWarning("change waveform %d, %d", frequency, channels); 45// owarn << "change waveform " << frequency << ", " << channels << "" << oendl;
42 samplesPerPixel = frequency * channels / (5 * windowSize); 46 samplesPerPixel = frequency * channels / (5 * windowSize);
43 qWarning("Waveform::changeSettings %d", samplesPerPixel); 47 owarn << "Waveform::changeSettings " << samplesPerPixel << "" << oendl;
44 if ( !samplesPerPixel ) 48 if ( !samplesPerPixel )
45 samplesPerPixel = 1; 49 samplesPerPixel = 1;
46 currentValue = 0; 50 currentValue = 0;
47 numSamples = 0; 51 numSamples = 0;
48 windowPosn = 0; 52 windowPosn = 0;
49 draw(); 53 draw();
50} 54}
51 55
52 56
53Waveform::~Waveform() 57Waveform::~Waveform()
54{ 58{
55 if ( window ) 59 if ( window )
@@ -87,25 +91,25 @@ void Waveform::newSamples( const short *buf, int len )
87 window[windowPosn++] = (short)(currentValue / numSamples); 91 window[windowPosn++] = (short)(currentValue / numSamples);
88 if ( windowPosn >= windowSize ) { 92 if ( windowPosn >= windowSize ) {
89 this->windowPosn = windowPosn; 93 this->windowPosn = windowPosn;
90 draw(); 94 draw();
91 windowPosn = 0; 95 windowPosn = 0;
92 } 96 }
93 numSamples = 0; 97 numSamples = 0;
94 currentValue = 0; 98 currentValue = 0;
95 } 99 }
96 } 100 }
97 101
98 // Copy the final state back to the object. 102 // Copy the final state back to the object.
99//qWarning("%d, %d, %d", currentValue, numSamples, windowPosn); 103//owarn << "" << currentValue << ", " << numSamples << ", " << windowPosn << "" << oendl;
100 this->currentValue = currentValue; 104 this->currentValue = currentValue;
101 this->numSamples = numSamples; 105 this->numSamples = numSamples;
102 this->windowPosn = windowPosn; 106 this->windowPosn = windowPosn;
103} 107}
104 108
105 109
106void Waveform::makePixmap() 110void Waveform::makePixmap()
107{ 111{
108 if ( !pixmap ) { 112 if ( !pixmap ) {
109 pixmap = new QPixmap( size() ); 113 pixmap = new QPixmap( size() );
110 windowSize = pixmap->width(); 114 windowSize = pixmap->width();
111 window = new short [windowSize]; 115 window = new short [windowSize];
diff --git a/noncore/multimedia/powerchord/config.in b/noncore/multimedia/powerchord/config.in
index ab1512b..5db784a 100644
--- a/noncore/multimedia/powerchord/config.in
+++ b/noncore/multimedia/powerchord/config.in
@@ -1,7 +1,7 @@
1 config POWERCHORD 1 config POWERCHORD
2 boolean "opie-powerchord (guitar chord generator and tuning)" 2 boolean "opie-powerchord (guitar chord generator and tuning)"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
5 comment "opie-powerchord needs a libqpe" 5 comment "opie-powerchord needs a libqpe and libopiecore2"
6 depends !(( LIBQPE || LIBQPE-X11 ) ) 6 depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE )
7 7
diff --git a/noncore/multimedia/powerchord/powerchord.pro b/noncore/multimedia/powerchord/powerchord.pro
index 917c88f..f7af6d6 100644
--- a/noncore/multimedia/powerchord/powerchord.pro
+++ b/noncore/multimedia/powerchord/powerchord.pro
@@ -9,19 +9,18 @@ HEADERS = powerchord.h \
9 powerchordbase.h 9 powerchordbase.h
10 10
11 SOURCES = main.cpp \ 11 SOURCES = main.cpp \
12 powerchord.cpp \ 12 powerchord.cpp \
13 fretboard.cpp \ 13 fretboard.cpp \
14 chordengine.cpp \ 14 chordengine.cpp \
15 vumeter.cpp \ 15 vumeter.cpp \
16 gs.cpp gt.cpp \ 16 gs.cpp gt.cpp \
17 powerchordbase.cpp 17 powerchordbase.cpp
18 18
19 INCLUDEPATH+= $(OPIEDIR)/include 19 INCLUDEPATH+= $(OPIEDIR)/include
20 DEPENDPATH+= $(OPIEDIR)/include 20 DEPENDPATH+= $(OPIEDIR)/include
21LIBS += -lqpe 21LIBS += -lqpe -lopiecore2
22 #INTERFACES= powerchordbase.ui
23DESTDIR = $(OPIEDIR)/bin 22DESTDIR = $(OPIEDIR)/bin
24 TARGET = powerchord 23 TARGET = powerchord
25 24
26include ( $(OPIEDIR)/include.pro ) 25include ( $(OPIEDIR)/include.pro )
27 26
diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp
index 4fb5dda..0694ba3 100644
--- a/noncore/multimedia/powerchord/powerchordbase.cpp
+++ b/noncore/multimedia/powerchord/powerchordbase.cpp
@@ -1,34 +1,38 @@
1/**************************************************************************** 1/****************************************************************************
2** Form implementation generated from reading ui file 'powerchordbase.ui' 2** Form implementation generated from reading ui file 'powerchordbase.ui'
3** 3**
4** Created: Sun Jan 13 23:05:11 2002 4** Created: Sun Jan 13 23:05:11 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#include "powerchordbase.h" 9#include "powerchordbase.h"
10
11#include "fretboard.h" 10#include "fretboard.h"
12#include "vumeter.h" 11#include "vumeter.h"
12
13/* OPIE */
14#include <opie2/odebug.h>
15#include <qpe/resource.h>
16using namespace Opie::Core;
17
18/* QT */
13#include <qcombobox.h> 19#include <qcombobox.h>
14#include <qlabel.h> 20#include <qlabel.h>
15#include <qlistbox.h> 21#include <qlistbox.h>
16#include <qpushbutton.h> 22#include <qpushbutton.h>
17#include <qspinbox.h> 23#include <qspinbox.h>
18#include <qtabwidget.h> 24#include <qtabwidget.h>
19#include <qlayout.h> 25#include <qlayout.h>
20#include <qtooltip.h> 26#include <qtooltip.h>
21#include <qpe/resource.h>
22
23 27
24/* 28/*
25 * Constructs a PowerchordBase which is a child of 'parent', with the 29 * Constructs a PowerchordBase which is a child of 'parent', with the
26 * name 'name' and widget flags set to 'f' 30 * name 'name' and widget flags set to 'f'
27 */ 31 */
28PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl ) 32PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl )
29 : QWidget( parent, name, fl ) 33 : QWidget( parent, name, fl )
30{ 34{
31 simulation_timer = 0; 35 simulation_timer = 0;
32 audio_timer = 0; 36 audio_timer = 0;
33 37
34 // setPalette( QPalette( QColor( 232, 227, 215) ) ); 38 // setPalette( QPalette( QColor( 232, 227, 215) ) );
@@ -571,15 +575,15 @@ void PowerchordBase::tuner_simulation_cb(){
571} 575}
572 576
573/* 577/*
574 * Destroys the object and frees any allocated resources 578 * Destroys the object and frees any allocated resources
575 */ 579 */
576PowerchordBase::~PowerchordBase() 580PowerchordBase::~PowerchordBase()
577{ 581{
578 // no need to delete child widgets, Qt does it all for us 582 // no need to delete child widgets, Qt does it all for us
579} 583}
580 584
581void PowerchordBase::change_handler() 585void PowerchordBase::change_handler()
582{ 586{
583 qWarning( "PowerchordBase::change_handler(): Not implemented yet!" ); 587 owarn << "PowerchordBase::change_handler(): Not implemented yet!" << oendl;
584} 588}
585 589
diff --git a/noncore/multimedia/showimg/ImageFileSelector.cpp b/noncore/multimedia/showimg/ImageFileSelector.cpp
index 79ee925..53cc883 100644
--- a/noncore/multimedia/showimg/ImageFileSelector.cpp
+++ b/noncore/multimedia/showimg/ImageFileSelector.cpp
@@ -1,23 +1,25 @@
1#include "ImageFileSelector.h"
1 2
3/* OPIE */
4#include <opie2/odebug.h>
5#include <qpe/qpeapplication.h>
6using namespace Opie::Core;
2 7
3#include "qpe/qpeapplication.h" 8/* QT */
4 9#include <qlabel.h>
5#include <stdlib.h>
6
7#include <qlabel.h>
8#include <qfileinfo.h> 10#include <qfileinfo.h>
9 11
10#include "ImageFileSelector.h" 12/* STD */
11 13#include <stdlib.h>
12 14
13ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,int w) 15ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,int w)
14 : QWidget( parent ),fl(f) 16 : QWidget( parent ),fl(f)
15{ 17{
16 setBackgroundMode(NoBackground); 18 setBackgroundMode(NoBackground);
17 if ( w!=-1 ) 19 if ( w!=-1 )
18 setMinimumSize(w,p.height()+24); 20 setMinimumSize(w,p.height()+24);
19 else 21 else
20 setMinimumSize(p.width(),p.height()+24); 22 setMinimumSize(p.width(),p.height()+24);
21 description=new QLabel(text,this); 23 description=new QLabel(text,this);
22 description->setBackgroundColor(colorGroup().base()); 24 description->setBackgroundColor(colorGroup().base());
23 description->setAlignment(AlignCenter); 25 description->setAlignment(AlignCenter);
@@ -146,25 +148,25 @@ void ImageFileSelector::resizeEvent(QResizeEvent *)
146void ImageFileSelector::updateSizes() 148void ImageFileSelector::updateSizes()
147{ 149{
148 int ww=(detailed->width()-detailed->frameWidth()*2); 150 int ww=(detailed->width()-detailed->frameWidth()*2);
149 double w=(double)ww*0.70; 151 double w=(double)ww*0.70;
150 detailed->setColumnWidth(0,(int)w); 152 detailed->setColumnWidth(0,(int)w);
151 detailed->setColumnWidth(1,ww-(int)w); 153 detailed->setColumnWidth(1,ww-(int)w);
152 background->setMinimumWidth(thumb->visibleWidth()); 154 background->setMinimumWidth(thumb->visibleWidth());
153 thumb->updateScrollBars(); 155 thumb->updateScrollBars();
154} 156}
155 157
156void ImageFileSelector::reread(bool) 158void ImageFileSelector::reread(bool)
157{ 159{
158// qDebug("reread"); 160// odebug << "reread" << oendl;
159 ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->selectedItem(); 161 ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->selectedItem();
160 QString oldFile; 162 QString oldFile;
161 if ( item ) 163 if ( item )
162 oldFile = item->file().file(); 164 oldFile = item->file().file();
163 detailed->clear(); 165 detailed->clear();
164 tList.clear(); 166 tList.clear();
165 DocLnkSet files; 167 DocLnkSet files;
166 Global::findDocuments(&files, "image/*"); 168 Global::findDocuments(&files, "image/*");
167 count = files.children().count(); 169 count = files.children().count();
168 QListIterator<DocLnk> dit( files.children() ); 170 QListIterator<DocLnk> dit( files.children() );
169// int y=0; 171// int y=0;
170// int x=4; 172// int x=4;
@@ -212,25 +214,25 @@ void ImageFileSelector::reread(bool)
212 detailed->setUpdatesEnabled(true); 214 detailed->setUpdatesEnabled(true);
213 thumb->setUpdatesEnabled(true); 215 thumb->setUpdatesEnabled(true);
214 detailed->update(); 216 detailed->update();
215 thumb->update(); 217 thumb->update();
216} 218}
217 219
218int ImageFileSelector::fileCount() 220int ImageFileSelector::fileCount()
219{ 221{
220 return count; 222 return count;
221} 223}
222const DocLnk * ImageFileSelector::selected() 224const DocLnk * ImageFileSelector::selected()
223{ 225{
224 qDebug("image selected"); 226 odebug << "image selected" << oendl;
225 ImageFileSelectorItem *item = (ImageFileSelectorItem *) detailed->selectedItem(); 227 ImageFileSelectorItem *item = (ImageFileSelectorItem *) detailed->selectedItem();
226 if ( item ) 228 if ( item )
227 return new DocLnk( item->file() ); 229 return new DocLnk( item->file() );
228 return 0; 230 return 0;
229} 231}
230 232
231 233
232 234
233void ImageFileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) 235void ImageFileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int )
234{ 236{
235 if ( !i ) 237 if ( !i )
236 return; 238 return;
diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp
index 696a57b..24377ed 100644
--- a/noncore/multimedia/showimg/showimg.cpp
+++ b/noncore/multimedia/showimg/showimg.cpp
@@ -17,41 +17,43 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21// 21//
22// Full-screen and rotation options contributed by Robert Wittams <robert@wittams.com> 22// Full-screen and rotation options contributed by Robert Wittams <robert@wittams.com>
23// 23//
24 24
25#include "showimg.h" 25#include "showimg.h"
26#include "ImageFileSelector.h" 26#include "ImageFileSelector.h"
27#include "settingsdialog.h" 27#include "settingsdialog.h"
28 28
29 29/* OPIE */
30#include <opie2/odebug.h>
30#include <opie2/ofiledialog.h> 31#include <opie2/ofiledialog.h>
31
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/config.h> 33#include <qpe/config.h>
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <qtoolbar.h> 35using namespace Opie::Core;
36using namespace Opie::Ui;
36 37
38/* QT */
39#include <qtoolbar.h>
37#include <qaction.h> 40#include <qaction.h>
38#include <qfiledialog.h> 41#include <qfiledialog.h>
39#include <qmenubar.h> 42#include <qmenubar.h>
40#include <qspinbox.h> 43#include <qspinbox.h>
41 44
45/* STD */
42#include <math.h> 46#include <math.h>
43 47
44
45using namespace Opie::Ui;
46ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent) 48ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent)
47 : QDialog(parent,0,true) 49 : QDialog(parent,0,true)
48{ 50{
49 setCaption(caption); 51 setCaption(caption);
50 52
51 if ( parent ) { 53 if ( parent ) {
52 setPalette(parent->palette()); 54 setPalette(parent->palette());
53 } 55 }
54 56
55 b=brightness; 57 b=brightness;
56 img=image; 58 img=image;
57 59
@@ -277,25 +279,25 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int /*wFlags*/ )
277 279
278 280
279 imagePanel = new ImagePane( stack ); 281 imagePanel = new ImagePane( stack );
280 connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView())); 282 connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView()));
281 283
282 284
283 ImageFileSelector::CURRENT_VIEW cv; 285 ImageFileSelector::CURRENT_VIEW cv;
284 if(showThumbView) 286 if(showThumbView)
285 cv=ImageFileSelector::THUMBNAIL; 287 cv=ImageFileSelector::THUMBNAIL;
286 else 288 else
287 cv=ImageFileSelector::DETAILED; 289 cv=ImageFileSelector::DETAILED;
288 290
289 qDebug("cv = %d",cv); 291 odebug << "cv = " << cv << "" << oendl;
290 292
291 fileSelector = new ImageFileSelector( cv,stack, "fs"); 293 fileSelector = new ImageFileSelector( cv,stack, "fs");
292 294
293 //switchThumbView(); 295 //switchThumbView();
294 296
295 297
296 //fileSelector = new ImageFileSelector("image/*", stack, "fs"); 298 //fileSelector = new ImageFileSelector("image/*", stack, "fs");
297 //fileSelector->setNewVisible(FALSE); 299 //fileSelector->setNewVisible(FALSE);
298 //fileSelector->setCloseVisible(FALSE); 300 //fileSelector->setCloseVisible(FALSE);
299 connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) ); 301 connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) );
300 connect( fileSelector, SIGNAL( fileSelected(const DocLnk&) ), 302 connect( fileSelector, SIGNAL( fileSelected(const DocLnk&) ),
301 this, SLOT( openFile(const DocLnk&) ) ); 303 this, SLOT( openFile(const DocLnk&) ) );
@@ -404,25 +406,25 @@ void ImageViewer::help() {
404 406
405 407
406void ImageViewer::settings() 408void ImageViewer::settings()
407{ 409{
408 SettingsDialog dlg( this, 0, TRUE ); 410 SettingsDialog dlg( this, 0, TRUE );
409 dlg.setDelay( slideDelay ); 411 dlg.setDelay( slideDelay );
410 dlg.setRepeat( slideRepeat ); 412 dlg.setRepeat( slideRepeat );
411 dlg.setReverse( slideReverse ); 413 dlg.setReverse( slideReverse );
412 dlg.setRotate(rotateOnLoad); 414 dlg.setRotate(rotateOnLoad);
413 dlg.setFastLoad(fastLoad); 415 dlg.setFastLoad(fastLoad);
414 416
415 if ( QPEApplication::execDialog(&dlg) == QDialog::Accepted ) { 417 if ( QPEApplication::execDialog(&dlg) == QDialog::Accepted ) {
416 qDebug("<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>"); 418 odebug << "<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>" << oendl;
417 slideDelay = dlg.delay(); 419 slideDelay = dlg.delay();
418 slideRepeat = dlg.repeat(); 420 slideRepeat = dlg.repeat();
419 slideReverse = dlg.reverse(); 421 slideReverse = dlg.reverse();
420 rotateOnLoad = dlg.rotate(); 422 rotateOnLoad = dlg.rotate();
421 fastLoad = dlg.fastLoad(); 423 fastLoad = dlg.fastLoad();
422 424
423 Config config( "ImageViewer" ); 425 Config config( "ImageViewer" );
424 config.setGroup( "SlideShow" ); 426 config.setGroup( "SlideShow" );
425 config.writeEntry( "Delay", slideDelay ); 427 config.writeEntry( "Delay", slideDelay );
426 config.writeEntry( "Repeat", slideRepeat ); 428 config.writeEntry( "Repeat", slideRepeat );
427 config.writeEntry("Reverse", slideReverse); 429 config.writeEntry("Reverse", slideReverse);
428 430
@@ -496,25 +498,25 @@ void ImageViewer::doDelayedLoad()
496{ 498{
497 show(delayLoad); 499 show(delayLoad);
498} 500}
499 501
500void ImageViewer::show() 502void ImageViewer::show()
501{ 503{
502 normalView(); 504 normalView();
503 QMainWindow::show(); 505 QMainWindow::show();
504} 506}
505 507
506void ImageViewer::show(const QString& fileref) 508void ImageViewer::show(const QString& fileref)
507{ 509{
508// qDebug("Show "+fileref); 510// odebug << "Show "+fileref << oendl;
509 bFromDocView = TRUE; 511 bFromDocView = TRUE;
510 closeFileSelector(); 512 closeFileSelector();
511 DocLnk link(fileref); 513 DocLnk link(fileref);
512 if ( link.isValid() ) { 514 if ( link.isValid() ) {
513 openFile(link); 515 openFile(link);
514 } else { 516 } else {
515 filename = fileref; 517 filename = fileref;
516 updateCaption( fileref ); 518 updateCaption( fileref );
517 loadImage( fileref ); 519 loadImage( fileref );
518 } 520 }
519} 521}
520 522
@@ -526,25 +528,25 @@ void ImageViewer::openFile() {
526 528
527 QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 ); 529 QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 );
528 DocLnk link(str); 530 DocLnk link(str);
529// if ( link.isValid() ) 531// if ( link.isValid() )
530 openFile(link); 532 openFile(link);
531 533
532} 534}
533 535
534void ImageViewer::openFile( const DocLnk &link ) 536void ImageViewer::openFile( const DocLnk &link )
535{ 537{
536 closeFileSelector(); 538 closeFileSelector();
537// DocLnk link(file); 539// DocLnk link(file);
538 qDebug("open "+link.name()); 540 odebug << "open "+link.name() << oendl;
539 updateCaption( link.name() ); 541 updateCaption( link.name() );
540 loadImage( link.file() ); 542 loadImage( link.file() );
541 if (slideTimer->isActive()) { 543 if (slideTimer->isActive()) {
542 slideTimer->start(slideDelay * 1000, FALSE); 544 slideTimer->start(slideDelay * 1000, FALSE);
543 } 545 }
544 546
545} 547}
546 548
547void ImageViewer::open() 549void ImageViewer::open()
548{ 550{
549 switchToFileSelector(); 551 switchToFileSelector();
550} 552}
diff --git a/noncore/multimedia/showimg/showimg.pro b/noncore/multimedia/showimg/showimg.pro
index 6fd019e..c905da8 100644
--- a/noncore/multimedia/showimg/showimg.pro
+++ b/noncore/multimedia/showimg/showimg.pro
@@ -1,9 +1,9 @@
1CONFIG += qt warn_on quick-app 1CONFIG += qt warn_on quick-app
2HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h 2HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h
3SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp 3SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp
4TARGET = showimg 4TARGET = showimg
5INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lqpe -lopiecore2 -lopieui2 7LIBS += -lqpe -lopiecore2 -lopieui2
8 8
9include ( $(OPIEDIR)/include.pro ) 9include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/multimedia/tonleiter/config.in b/noncore/multimedia/tonleiter/config.in
index d580ad7..9bd167e 100644
--- a/noncore/multimedia/tonleiter/config.in
+++ b/noncore/multimedia/tonleiter/config.in
@@ -1,4 +1,4 @@
1 config TONLEITER 1 config TONLEITER
2 boolean "tonleiter (shows scales on sting instruments)" 2 boolean "tonleiter (shows scales on sting instruments)"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/noncore/multimedia/tonleiter/editinst.cpp b/noncore/multimedia/tonleiter/editinst.cpp
index ccb4560..a8c20c8 100644
--- a/noncore/multimedia/tonleiter/editinst.cpp
+++ b/noncore/multimedia/tonleiter/editinst.cpp
@@ -1,17 +1,22 @@
1#include "editinst.h" 1#include "editinst.h"
2 2
3#include <qpushbutton.h> 3/* OPIE */
4 4#include <opie2/odebug.h>
5#include <qpe/config.h>
5#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7using namespace Opie::Core;
8
9/* QT */
10#include <qpushbutton.h>
6 11
7Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name) 12Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name)
8:QDialog(parent,name,true,0),data(data) 13:QDialog(parent,name,true,0),data(data)
9{ 14{
10 setCaption("Tonleiter::"+tr("Instrument")); 15 setCaption("Tonleiter::"+tr("Instrument"));
11 QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); 16 QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom);
12 instid=data->getCurrentInstrumentID(); 17 instid=data->getCurrentInstrumentID();
13 stringlist.setAutoDelete(true); 18 stringlist.setAutoDelete(true);
14 19
15 QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); 20 QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight);
16 21
17 //Name combo + Add + Delete 22 //Name combo + Add + Delete
@@ -91,20 +96,20 @@ void Menu::InstEditDialog::deleteString(int id)
91} 96}
92//**************************************************************************** 97//****************************************************************************
93void Menu::InstEditDialog::saveInstrument() 98void Menu::InstEditDialog::saveInstrument()
94{ 99{
95 //auto delete is set to true so widgets _should_ be deleted 100 //auto delete is set to true so widgets _should_ be deleted
96 stringlist.clear(); 101 stringlist.clear();
97} 102}
98//**************************************************************************** 103//****************************************************************************
99void Menu::InstEditDialog::loadInstrument() 104void Menu::InstEditDialog::loadInstrument()
100{ 105{
101 stringlist.clear(); 106 stringlist.clear();
102 Instrument inst=data->getInstrument(instid); 107 Instrument inst=data->getInstrument(instid);
103 qDebug("load Instrument : %d strings",inst.noOfStrings()); 108 odebug << "load Instrument : " << inst.noOfStrings() << " strings" << oendl;
104 for(uint s=0;s<inst.noOfStrings();s++) 109 for(uint s=0;s<inst.noOfStrings();s++)
105 { 110 {
106 stringlist.append(new EditStringWidget(inst.string(s),stringwidget)); 111 stringlist.append(new EditStringWidget(inst.string(s),stringwidget));
107 } 112 }
108} 113}
109//**************************************************************************** 114//****************************************************************************
110//**************************************************************************** 115//****************************************************************************
diff --git a/noncore/multimedia/tonleiter/fretboard.cpp b/noncore/multimedia/tonleiter/fretboard.cpp
index 7e63e01..58bdb86 100644
--- a/noncore/multimedia/tonleiter/fretboard.cpp
+++ b/noncore/multimedia/tonleiter/fretboard.cpp
@@ -1,14 +1,19 @@
1#include "fretboard.h" 1#include "fretboard.h"
2 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
7/* QT */
3#include <qpainter.h> 8#include <qpainter.h>
4 9
5Graph::FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f) 10Graph::FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f)
6:QWidget(parent,name,f),data(data) 11:QWidget(parent,name,f),data(data)
7{ 12{
8 setBackgroundColor(QColor(0,0,0)); 13 setBackgroundColor(QColor(0,0,0));
9 fretpen=QPen(QColor(155,155,155),0); 14 fretpen=QPen(QColor(155,155,155),0);
10 markerbrush=QBrush(QColor(155,155,155)); 15 markerbrush=QBrush(QColor(155,155,155));
11 stringpen=QPen(QColor(255,255,255),3); 16 stringpen=QPen(QColor(255,255,255),3);
12 connect(data,SIGNAL(dataChange()),this,SLOT(dataChange())); 17 connect(data,SIGNAL(dataChange()),this,SLOT(dataChange()));
13} 18}
14//**************************************************************************** 19//****************************************************************************
@@ -18,25 +23,25 @@ Graph::FretBoard::~FretBoard()
18//**************************************************************************** 23//****************************************************************************
19void Graph::FretBoard::dataChange() 24void Graph::FretBoard::dataChange()
20{ 25{
21 repaint(true); 26 repaint(true);
22} 27}
23//**************************************************************************** 28//****************************************************************************
24void Graph::FretBoard::paintEvent(QPaintEvent* pe) 29void Graph::FretBoard::paintEvent(QPaintEvent* pe)
25{ 30{
26 Q_UNUSED(pe); 31 Q_UNUSED(pe);
27 32
28 int instid=data->getCurrentInstrumentID(); 33 int instid=data->getCurrentInstrumentID();
29 inst=data->getInstrument(instid); 34 inst=data->getInstrument(instid);
30 //qDebug("inst %d is %s",instid,inst.instName().data()); 35 //odebug << "inst " << instid << " is " << inst.instName().data() << "" << oendl;
31 36
32 QRect mysize=rect(); 37 QRect mysize=rect();
33 38
34 xmargin=(int)(mysize.width()*0.05); 39 xmargin=(int)(mysize.width()*0.05);
35 xmin=2*xmargin; 40 xmin=2*xmargin;
36 xmax=mysize.width()-xmargin; 41 xmax=mysize.width()-xmargin;
37 xwidth=xmax-xmin; 42 xwidth=xmax-xmin;
38 43
39 ymargin=(int)(mysize.height()*0.1); 44 ymargin=(int)(mysize.height()*0.1);
40 ymin=ymargin; 45 ymin=ymargin;
41 ymax=mysize.height()-2*ymargin; 46 ymax=mysize.height()-2*ymargin;
42 yheight=ymax-ymin; 47 yheight=ymax-ymin;
@@ -134,35 +139,35 @@ void Graph::FretBoard::paintScale(QPainter* p)
134 int y=(int)(stringdist*s)+ymin; 139 int y=(int)(stringdist*s)+ymin;
135 int stingid=inst.noOfStrings()-(s+1); 140 int stingid=inst.noOfStrings()-(s+1);
136 for(int f=0;f<=inst.noOfFrets();f++) 141 for(int f=0;f<=inst.noOfFrets();f++)
137 { 142 {
138 int note=inst.string(stingid)+f; 143 int note=inst.string(stingid)+f;
139 if(scale.noteInScale(data->getCurrentBaseNote(),note)) 144 if(scale.noteInScale(data->getCurrentBaseNote(),note))
140 { 145 {
141 int x=(int)(fretdist*f)+xmin; 146 int x=(int)(fretdist*f)+xmin;
142 147
143 //no more than six octaves can be visualised (there is a zero octave) 148 //no more than six octaves can be visualised (there is a zero octave)
144 int octave=Note::octaveOfBaseNote(data->getCurrentBaseNote(),note)-baseoctave; 149 int octave=Note::octaveOfBaseNote(data->getCurrentBaseNote(),note)-baseoctave;
145 if(octave<0) 150 if(octave<0)
146 qDebug("%d,%d",octave,baseoctave); 151 odebug << "" << octave << "," << baseoctave << "" << oendl;
147 if(octave>5) 152 if(octave>5)
148 { 153 {
149 qDebug("octave out of range"); 154 odebug << "octave out of range" << oendl;
150 octave=5; 155 octave=5;
151 } 156 }
152 157
153 p->setPen(QColor(255,0,0)); 158 p->setPen(QColor(255,0,0));
154 int c= ( (note-12*baseoctave) - (12*octave+data->getCurrentBaseNote()) )*15; 159 int c= ( (note-12*baseoctave) - (12*octave+data->getCurrentBaseNote()) )*15;
155 if(c<0 || c>255) 160 if(c<0 || c>255)
156 qDebug("%d = %d - ( %d + %d)",c,note,12*octave,data->getCurrentBaseNote()); 161 odebug << "" << c << " = " << note << " - ( " << 12*octave << " + " << data->getCurrentBaseNote() << ")" << oendl;
157 QColor dotcolor(255,255,255); 162 QColor dotcolor(255,255,255);
158 163
159 if(octave==0) 164 if(octave==0)
160 dotcolor=QColor(c,c,255); 165 dotcolor=QColor(c,c,255);
161 else if(octave==1) 166 else if(octave==1)
162 dotcolor=QColor(c,255,c); 167 dotcolor=QColor(c,255,c);
163 else if(octave==2) 168 else if(octave==2)
164 dotcolor=QColor(255,c,c); 169 dotcolor=QColor(255,c,c);
165 else if(octave==3) 170 else if(octave==3)
166 dotcolor=QColor(255,255,c); 171 dotcolor=QColor(255,255,c);
167 else if(octave==4) 172 else if(octave==4)
168 dotcolor=QColor(255,c,255); 173 dotcolor=QColor(255,c,255);
diff --git a/noncore/multimedia/tonleiter/tonleiter.pro b/noncore/multimedia/tonleiter/tonleiter.pro
index 4bd1bc2..4be3bef 100644
--- a/noncore/multimedia/tonleiter/tonleiter.pro
+++ b/noncore/multimedia/tonleiter/tonleiter.pro
@@ -1,13 +1,11 @@
1TEMPLATE = app 1TEMPLATE = app
2#CONFIG = qt warn_on
3CONFIG = qt warn_on 2CONFIG = qt warn_on
4HEADERS = mainwidget.h tonleiterdata.h tonleiterdatahelper.h fretboard.h menuwidget.h editinst.h editstringwidget.h editscale.h pianoscale.h 3HEADERS = mainwidget.h tonleiterdata.h tonleiterdatahelper.h fretboard.h menuwidget.h editinst.h editstringwidget.h editscale.h pianoscale.h
5SOURCES = mainwidget.cpp tonleiterdata.cpp tonleiterdatahelper.cpp fretboard.cpp menuwidget.cpp main.cpp editinst.cpp editstringwidget.cpp editscale.cpp pianoscale.cpp 4SOURCES = mainwidget.cpp tonleiterdata.cpp tonleiterdatahelper.cpp fretboard.cpp menuwidget.cpp main.cpp editinst.cpp editstringwidget.cpp editscale.cpp pianoscale.cpp
6INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lqpe 7LIBS += -lqpe -lopiecore2
9INTERFACES =
10TARGET = tonleiter 8TARGET = tonleiter
11DESTDIR = $(OPIEDIR)/bin 9DESTDIR = $(OPIEDIR)/bin
12#TMAKE_CXXFLAGS += -DQT_QWS_VERCEL_IDR -DQWS -fno-exceptions -fno-rtti 10
13include ( $(OPIEDIR)/include.pro ) 11include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/multimedia/tonleiter/tonleiterdata.cpp b/noncore/multimedia/tonleiter/tonleiterdata.cpp
index 33b3c49..564b7f0 100644
--- a/noncore/multimedia/tonleiter/tonleiterdata.cpp
+++ b/noncore/multimedia/tonleiter/tonleiterdata.cpp
@@ -1,18 +1,19 @@
1#include "tonleiterdata.h" 1#include "tonleiterdata.h"
2
3#include <qpe/config.h>
4
5using namespace Data; 2using namespace Data;
6 3
4/* OPIE */
5#include <opie2/odebug.h>
6#include <qpe/config.h>
7using namespace Opie::Core;
7 8
8TonleiterData::TonleiterData(QObject* parent) 9TonleiterData::TonleiterData(QObject* parent)
9:QObject(parent) 10:QObject(parent)
10{ 11{
11 drawnames=true; 12 drawnames=true;
12 loadData(); 13 loadData();
13} 14}
14//**************************************************************************** 15//****************************************************************************
15TonleiterData::~TonleiterData() 16TonleiterData::~TonleiterData()
16{ 17{
17 saveData(); 18 saveData();
18} 19}
@@ -143,47 +144,47 @@ void TonleiterData::saveData()
143//**************************************************************************** 144//****************************************************************************
144int TonleiterData::noOfInstruments() 145int TonleiterData::noOfInstruments()
145{ 146{
146 return (int)instruments.count(); 147 return (int)instruments.count();
147} 148}
148//**************************************************************************** 149//****************************************************************************
149Instrument TonleiterData::getInstrument(int id) 150Instrument TonleiterData::getInstrument(int id)
150{ 151{
151 if(id>=0 && id<noOfInstruments()) 152 if(id>=0 && id<noOfInstruments())
152 return instruments[id]; 153 return instruments[id];
153 else 154 else
154 { 155 {
155 qDebug("undefined insrtument %d of %d",id,instruments.count()); 156 odebug << "undefined insrtument " << id << " of " << instruments.count() << "" << oendl;
156 return Instrument(); 157 return Instrument();
157 } 158 }
158 159
159} 160}
160//**************************************************************************** 161//****************************************************************************
161int TonleiterData::getCurrentInstrumentID() 162int TonleiterData::getCurrentInstrumentID()
162{ 163{
163 return currentInstrumentID; 164 return currentInstrumentID;
164} 165}
165//**************************************************************************** 166//****************************************************************************
166int TonleiterData::noOfScales() 167int TonleiterData::noOfScales()
167{ 168{
168 return (int)scales.count(); 169 return (int)scales.count();
169} 170}
170//**************************************************************************** 171//****************************************************************************
171Scale TonleiterData::getScale(int id) 172Scale TonleiterData::getScale(int id)
172{ 173{
173 if(id>=0 && id<noOfScales()) 174 if(id>=0 && id<noOfScales())
174 return scales[id]; 175 return scales[id];
175 else 176 else
176 { 177 {
177 qDebug("Undefined scale"); 178 odebug << "Undefined scale" << oendl;
178 return Scale(); 179 return Scale();
179 } 180 }
180} 181}
181//**************************************************************************** 182//****************************************************************************
182int TonleiterData::getCurrentScaleID() 183int TonleiterData::getCurrentScaleID()
183{ 184{
184 return currentScaleID; 185 return currentScaleID;
185} 186}
186//**************************************************************************** 187//****************************************************************************
187int TonleiterData::getCurrentBaseNote() 188int TonleiterData::getCurrentBaseNote()
188{ 189{
189 return currentNote; 190 return currentNote;
diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp
index d904a71..285d2c1 100644
--- a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp
+++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp
@@ -25,25 +25,25 @@ int Note::getNoteFromName(QString name,int octave)
25 { 25 {
26 notevalue=a; 26 notevalue=a;
27 break; 27 break;
28 } 28 }
29 } 29 }
30 return notevalue+12*octave; 30 return notevalue+12*octave;
31} 31}
32//**************************************************************************** 32//****************************************************************************
33int Note::octaveOfBaseNote(int base,int note) 33int Note::octaveOfBaseNote(int base,int note)
34{ 34{
35 int normnote = (note>=base) ? note-base : (12-base)+note; 35 int normnote = (note>=base) ? note-base : (12-base)+note;
36 int octave=getOctaveOfNote(normnote); 36 int octave=getOctaveOfNote(normnote);
37 //qDebug("note %d of %d base is norm %d -> ocatve %d",note,base,normnote,octave); 37 //odebug << "note " << note << " of " << base << " base is norm " << normnote << " -> ocatve " << octave << "" << oendl;
38 return octave; 38 return octave;
39} 39}
40//**************************************************************************** 40//****************************************************************************
41//**************************************************************************** 41//****************************************************************************
42Instrument::Instrument() 42Instrument::Instrument()
43{ 43{
44 name="UNDEFINED"; 44 name="UNDEFINED";
45 frets=0; 45 frets=0;
46} 46}
47//**************************************************************************** 47//****************************************************************************
48Instrument::Instrument(QString name,int frets,QValueList<int> strings) 48Instrument::Instrument(QString name,int frets,QValueList<int> strings)
49:name(name),frets(frets),strings(strings) 49:name(name),frets(frets),strings(strings)
@@ -122,23 +122,23 @@ QString Scale::scaleName()
122{ 122{
123 return name; 123 return name;
124} 124}
125//**************************************************************************** 125//****************************************************************************
126bool Scale::noteInScale(int base,int note) 126bool Scale::noteInScale(int base,int note)
127{ 127{
128 int octave=Note::getOctaveOfNote(note); 128 int octave=Note::getOctaveOfNote(note);
129 note-=12*octave; 129 note-=12*octave;
130 int normnote = (note>=base) ? note-base : (12-base)+note; 130 int normnote = (note>=base) ? note-base : (12-base)+note;
131 131
132 if(halftones.contains(normnote)>0) 132 if(halftones.contains(normnote)>0)
133 { 133 {
134 //qDebug("OK : base : %d, note %d -> norm %d",base,note,normnote); 134 //odebug << "OK : base : " << base << ", note " << note << " -> norm " << normnote << "" << oendl;
135 return true; 135 return true;
136 } 136 }
137 else 137 else
138 { 138 {
139 //qDebug("BAD : base : %d, note %d -> norm %d",base,note,normnote); 139 //odebug << "BAD : base : " << base << ", note " << note << " -> norm " << normnote << "" << oendl;
140 return false; 140 return false;
141 } 141 }
142} 142}
143//**************************************************************************** 143//****************************************************************************
144//**************************************************************************** 144//****************************************************************************
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index 54d2da2..ae28313 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -69,25 +69,25 @@ void POP3viewItem::refresh()
69 QValueList<FolderP>::ConstIterator it; 69 QValueList<FolderP>::ConstIterator it;
70 QListViewItem*item = 0; 70 QListViewItem*item = 0;
71 for ( it = folders->begin(); it!=folders->end(); ++it) 71 for ( it = folders->begin(); it!=folders->end(); ++it)
72 { 72 {
73 item = new POP3folderItem( (*it), this , item ); 73 item = new POP3folderItem( (*it), this , item );
74 item->setSelectable( (*it)->may_select()); 74 item->setSelectable( (*it)->may_select());
75 } 75 }
76 delete folders; 76 delete folders;
77} 77}
78 78
79RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) 79RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
80{ 80{
81 qDebug( "POP3 fetchBody" ); 81 odebug << "POP3 fetchBody" << oendl;
82 return wrapper->fetchBody( mail ); 82 return wrapper->fetchBody( mail );
83} 83}
84 84
85QPopupMenu * POP3viewItem::getContextMenu() 85QPopupMenu * POP3viewItem::getContextMenu()
86{ 86{
87 QPopupMenu *m = new QPopupMenu(0); 87 QPopupMenu *m = new QPopupMenu(0);
88 if (m) 88 if (m)
89 { 89 {
90 if (!account->getOffline()) 90 if (!account->getOffline())
91 { 91 {
92 m->insertItem(QObject::tr("Disconnect",contextName),0); 92 m->insertItem(QObject::tr("Disconnect",contextName),0);
93 m->insertItem(QObject::tr("Set offline",contextName),1); 93 m->insertItem(QObject::tr("Set offline",contextName),1);
@@ -260,25 +260,25 @@ void NNTPviewItem::refresh()
260 QValueList<FolderP>::ConstIterator it; 260 QValueList<FolderP>::ConstIterator it;
261 QListViewItem*item = 0; 261 QListViewItem*item = 0;
262 for ( it = folders->begin(); it!=folders->end(); ++it) 262 for ( it = folders->begin(); it!=folders->end(); ++it)
263 { 263 {
264 item = new NNTPfolderItem( (*it), this , item ); 264 item = new NNTPfolderItem( (*it), this , item );
265 item->setSelectable( (*it)->may_select()); 265 item->setSelectable( (*it)->may_select());
266 } 266 }
267 delete folders; 267 delete folders;
268} 268}
269 269
270RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) 270RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
271{ 271{
272 qDebug( "NNTP fetchBody" ); 272 odebug << "NNTP fetchBody" << oendl;
273 return wrapper->fetchBody( mail ); 273 return wrapper->fetchBody( mail );
274} 274}
275 275
276QPopupMenu * NNTPviewItem::getContextMenu() 276QPopupMenu * NNTPviewItem::getContextMenu()
277{ 277{
278 QPopupMenu *m = new QPopupMenu(0); 278 QPopupMenu *m = new QPopupMenu(0);
279 if (m) 279 if (m)
280 { 280 {
281 if (!account->getOffline()) 281 if (!account->getOffline())
282 { 282 {
283 m->insertItem(QObject::tr("Disconnect",contextName),0); 283 m->insertItem(QObject::tr("Disconnect",contextName),0);
284 m->insertItem(QObject::tr("Set offline",contextName),1); 284 m->insertItem(QObject::tr("Set offline",contextName),1);
@@ -451,25 +451,25 @@ void IMAPviewItem::refreshFolders(bool force)
451 QValueList<FolderP>::Iterator it; 451 QValueList<FolderP>::Iterator it;
452 QListViewItem*item = 0; 452 QListViewItem*item = 0;
453 QListViewItem*titem = 0; 453 QListViewItem*titem = 0;
454 QString fname,del,search; 454 QString fname,del,search;
455 int pos; 455 int pos;
456 456
457 for ( it = folders->begin(); it!=folders->end(); ++it) 457 for ( it = folders->begin(); it!=folders->end(); ++it)
458 { 458 {
459 if ((*it)->getDisplayName().lower()=="inbox") 459 if ((*it)->getDisplayName().lower()=="inbox")
460 { 460 {
461 item = new IMAPfolderItem( (*it), this , item ); 461 item = new IMAPfolderItem( (*it), this , item );
462 folders->remove(it); 462 folders->remove(it);
463 qDebug("inbox found"); 463 odebug << "inbox found" << oendl;
464 break; 464 break;
465 } 465 }
466 } 466 }
467 for ( it = folders->begin(); it!=folders->end(); ++it) 467 for ( it = folders->begin(); it!=folders->end(); ++it)
468 { 468 {
469 fname = (*it)->getDisplayName(); 469 fname = (*it)->getDisplayName();
470 currentFolders.append((*it)->getName()); 470 currentFolders.append((*it)->getName());
471 pos = fname.findRev((*it)->Separator()); 471 pos = fname.findRev((*it)->Separator());
472 if (pos != -1) 472 if (pos != -1)
473 { 473 {
474 fname = fname.left(pos); 474 fname = fname.left(pos);
475 } 475 }
@@ -524,25 +524,25 @@ void IMAPviewItem::createNewFolder()
524 { 524 {
525 delemiter = item->Delemiter(); 525 delemiter = item->Delemiter();
526 } 526 }
527 if (wrapper->createMbox(ndir,0,delemiter,makesubs)) 527 if (wrapper->createMbox(ndir,0,delemiter,makesubs))
528 { 528 {
529 refreshFolders(true); 529 refreshFolders(true);
530 } 530 }
531 } 531 }
532} 532}
533 533
534void IMAPviewItem::contextMenuSelected(int id) 534void IMAPviewItem::contextMenuSelected(int id)
535{ 535{
536 qDebug("Id selected: %i",id); 536 odebug << "Id selected: " << id << "" << oendl;
537 switch (id) 537 switch (id)
538 { 538 {
539 case 0: 539 case 0:
540 refreshFolders(true); 540 refreshFolders(true);
541 break; 541 break;
542 case 1: 542 case 1:
543 createNewFolder(); 543 createNewFolder();
544 break; 544 break;
545 case 2: 545 case 2:
546 removeChilds(); 546 removeChilds();
547 wrapper->logout(); 547 wrapper->logout();
548 break; 548 break;
@@ -662,25 +662,25 @@ void IMAPfolderItem::createNewFolder()
662 { 662 {
663 imap->refreshFolders(true); 663 imap->refreshFolders(true);
664 } 664 }
665 } 665 }
666} 666}
667 667
668void IMAPfolderItem::deleteFolder() 668void IMAPfolderItem::deleteFolder()
669{ 669{
670 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 670 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
671 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 671 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
672 QObject::tr("Yes",contextName), 672 QObject::tr("Yes",contextName),
673 QObject::tr("No",contextName),QString::null,1,1); 673 QObject::tr("No",contextName),QString::null,1,1);
674 qDebug("Auswahl: %i",yesno); 674 odebug << "Auswahl: " << yesno << "" << oendl;
675 if (yesno == 0) 675 if (yesno == 0)
676 { 676 {
677 if (imap->getWrapper()->deleteMbox(folder)) 677 if (imap->getWrapper()->deleteMbox(folder))
678 { 678 {
679 QListView*v=listView(); 679 QListView*v=listView();
680 IMAPviewItem * box = imap; 680 IMAPviewItem * box = imap;
681 /* be carefull - after that this object is destroyd so don't use 681 /* be carefull - after that this object is destroyd so don't use
682 * any member of it after that call!!*/ 682 * any member of it after that call!!*/
683 imap->refreshFolders(true); 683 imap->refreshFolders(true);
684 if (v) 684 if (v)
685 { 685 {
686 v->setSelected(box,true); 686 v->setSelected(box,true);
@@ -689,25 +689,25 @@ void IMAPfolderItem::deleteFolder()
689 } 689 }
690} 690}
691 691
692void IMAPfolderItem::downloadMails() 692void IMAPfolderItem::downloadMails()
693{ 693{
694 AccountView*bl = imap->accountView(); 694 AccountView*bl = imap->accountView();
695 if (!bl) return; 695 if (!bl) return;
696 bl->downloadMails(folder,imap->getWrapper()); 696 bl->downloadMails(folder,imap->getWrapper());
697} 697}
698 698
699void IMAPfolderItem::contextMenuSelected(int id) 699void IMAPfolderItem::contextMenuSelected(int id)
700{ 700{
701 qDebug("Selected id: %i",id); 701 odebug << "Selected id: " << id << "" << oendl;
702 AccountView * view = (AccountView*)listView(); 702 AccountView * view = (AccountView*)listView();
703 switch(id) 703 switch(id)
704 { 704 {
705 case 0: 705 case 0:
706 view->refreshCurrent(); 706 view->refreshCurrent();
707 break; 707 break;
708 case 1: 708 case 1:
709 deleteAllMail(imap->getWrapper(),folder); 709 deleteAllMail(imap->getWrapper(),folder);
710 break; 710 break;
711 case 2: 711 case 2:
712 createNewFolder(); 712 createNewFolder();
713 break; 713 break;
@@ -793,25 +793,25 @@ void MHviewItem::refresh(bool force)
793 } 793 }
794 else 794 else
795 { 795 {
796 item = new MHfolderItem( (*it), this , item ); 796 item = new MHfolderItem( (*it), this , item );
797 } 797 }
798 item->setSelectable((*it)->may_select()); 798 item->setSelectable((*it)->may_select());
799 } 799 }
800 delete folders; 800 delete folders;
801} 801}
802 802
803RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) 803RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
804{ 804{
805 qDebug( "MH fetchBody" ); 805 odebug << "MH fetchBody" << oendl;
806 return wrapper->fetchBody( mail ); 806 return wrapper->fetchBody( mail );
807} 807}
808 808
809QPopupMenu * MHviewItem::getContextMenu() 809QPopupMenu * MHviewItem::getContextMenu()
810{ 810{
811 QPopupMenu *m = new QPopupMenu(0); 811 QPopupMenu *m = new QPopupMenu(0);
812 if (m) 812 if (m)
813 { 813 {
814 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 814 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
815 m->insertItem(QObject::tr("Create new folder",contextName),1); 815 m->insertItem(QObject::tr("Create new folder",contextName),1);
816 m->insertItem(QObject::tr("Delete all mails",contextName),2); 816 m->insertItem(QObject::tr("Delete all mails",contextName),2);
817 m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); 817 m->insertItem(QObject::tr("Move/Copie all mails",contextName),3);
@@ -923,25 +923,25 @@ void MHfolderItem::refresh(QValueList<RecMailP>&target)
923 923
924RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) 924RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
925{ 925{
926 return mbox->getWrapper()->fetchBody(aMail); 926 return mbox->getWrapper()->fetchBody(aMail);
927} 927}
928 928
929void MHfolderItem::deleteFolder() 929void MHfolderItem::deleteFolder()
930{ 930{
931 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 931 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
932 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 932 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
933 QObject::tr("Yes",contextName), 933 QObject::tr("Yes",contextName),
934 QObject::tr("No",contextName),QString::null,1,1); 934 QObject::tr("No",contextName),QString::null,1,1);
935 qDebug("Auswahl: %i",yesno); 935 odebug << "Auswahl: " << yesno << "" << oendl;
936 if (yesno == 0) 936 if (yesno == 0)
937 { 937 {
938 if (mbox->getWrapper()->deleteMbox(folder)) 938 if (mbox->getWrapper()->deleteMbox(folder))
939 { 939 {
940 QListView*v=listView(); 940 QListView*v=listView();
941 MHviewItem * box = mbox; 941 MHviewItem * box = mbox;
942 /* be carefull - after that this object is destroyd so don't use 942 /* be carefull - after that this object is destroyd so don't use
943 * any member of it after that call!!*/ 943 * any member of it after that call!!*/
944 mbox->refresh(true); 944 mbox->refresh(true);
945 if (v) 945 if (v)
946 { 946 {
947 v->setSelected(box,true); 947 v->setSelected(box,true);
@@ -1065,25 +1065,25 @@ AccountView*AccountViewItem::accountView()
1065} 1065}
1066 1066
1067void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) 1067void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
1068{ 1068{
1069 if (!wrapper) return; 1069 if (!wrapper) return;
1070 QString fname=""; 1070 QString fname="";
1071 if (folder) fname = folder->getDisplayName(); 1071 if (folder) fname = folder->getDisplayName();
1072 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), 1072 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
1073 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). 1073 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).
1074 arg(fname), 1074 arg(fname),
1075 QObject::tr("Yes",contextName), 1075 QObject::tr("Yes",contextName),
1076 QObject::tr("No",contextName),QString::null,1,1); 1076 QObject::tr("No",contextName),QString::null,1,1);
1077 qDebug("Auswahl: %i",yesno); 1077 odebug << "Auswahl: " << yesno << "" << oendl;
1078 if (yesno == 0) 1078 if (yesno == 0)
1079 { 1079 {
1080 if (wrapper->deleteAllMail(folder)) 1080 if (wrapper->deleteAllMail(folder))
1081 { 1081 {
1082 AccountView * view = (AccountView*)listView(); 1082 AccountView * view = (AccountView*)listView();
1083 if (view) view->refreshCurrent(); 1083 if (view) view->refreshCurrent();
1084 } 1084 }
1085 } 1085 }
1086} 1086}
1087 1087
1088void AccountViewItem::removeChilds() 1088void AccountViewItem::removeChilds()
1089{ 1089{
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index f0a163e..0052061 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -57,48 +57,48 @@ void AccountView::populate( QList<Account> list )
57 57
58 imapAccounts.clear(); 58 imapAccounts.clear();
59 mhAccounts.clear(); 59 mhAccounts.clear();
60 60
61 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); 61 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
62 62
63 Account *it; 63 Account *it;
64 for ( it = list.first(); it; it = list.next() ) 64 for ( it = list.first(); it; it = list.next() )
65 { 65 {
66 if ( it->getType() == MAILLIB::A_IMAP ) 66 if ( it->getType() == MAILLIB::A_IMAP )
67 { 67 {
68 IMAPaccount *imap = static_cast<IMAPaccount *>(it); 68 IMAPaccount *imap = static_cast<IMAPaccount *>(it);
69 qDebug( "added IMAP " + imap->getAccountName() ); 69 odebug << "added IMAP " + imap->getAccountName() << oendl;
70 imapAccounts.append(new IMAPviewItem( imap, this )); 70 imapAccounts.append(new IMAPviewItem( imap, this ));
71 } 71 }
72 else if ( it->getType() == MAILLIB::A_POP3 ) 72 else if ( it->getType() == MAILLIB::A_POP3 )
73 { 73 {
74 POP3account *pop3 = static_cast<POP3account *>(it); 74 POP3account *pop3 = static_cast<POP3account *>(it);
75 qDebug( "added POP3 " + pop3->getAccountName() ); 75 odebug << "added POP3 " + pop3->getAccountName() << oendl;
76 /* must not be hold 'cause it isn't required */ 76 /* must not be hold 'cause it isn't required */
77 (void) new POP3viewItem( pop3, this ); 77 (void) new POP3viewItem( pop3, this );
78 } 78 }
79 else if ( it->getType() == MAILLIB::A_NNTP ) 79 else if ( it->getType() == MAILLIB::A_NNTP )
80 { 80 {
81 NNTPaccount *nntp = static_cast<NNTPaccount *>(it); 81 NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
82 qDebug( "added NNTP " + nntp->getAccountName() ); 82 odebug << "added NNTP " + nntp->getAccountName() << oendl;
83 /* must not be hold 'cause it isn't required */ 83 /* must not be hold 'cause it isn't required */
84 (void) new NNTPviewItem( nntp, this ); 84 (void) new NNTPviewItem( nntp, this );
85 } 85 }
86 } 86 }
87} 87}
88 88
89void AccountView::refresh(QListViewItem *item) 89void AccountView::refresh(QListViewItem *item)
90{ 90{
91 91
92 qDebug("AccountView refresh..."); 92 odebug << "AccountView refresh..." << oendl;
93 if ( item ) 93 if ( item )
94 { 94 {
95 m_currentItem = item; 95 m_currentItem = item;
96 QValueList<RecMailP> headerlist; 96 QValueList<RecMailP> headerlist;
97 AccountViewItem *view = static_cast<AccountViewItem *>(item); 97 AccountViewItem *view = static_cast<AccountViewItem *>(item);
98 view->refresh(headerlist); 98 view->refresh(headerlist);
99 emit refreshMailview(headerlist); 99 emit refreshMailview(headerlist);
100 } 100 }
101} 101}
102 102
103void AccountView::refreshCurrent() 103void AccountView::refreshCurrent()
104{ 104{
@@ -153,24 +153,24 @@ void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrappe
153 targetFolder = sels.currentFolder(); 153 targetFolder = sels.currentFolder();
154 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || 154 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
155 targetFolder.isEmpty()) 155 targetFolder.isEmpty())
156 { 156 {
157 return; 157 return;
158 } 158 }
159 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 159 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
160 { 160 {
161 QMessageBox::critical(0,tr("Error creating new Folder"), 161 QMessageBox::critical(0,tr("Error creating new Folder"),
162 tr("<center>Error while creating<br>new folder - breaking.</center>")); 162 tr("<center>Error while creating<br>new folder - breaking.</center>"));
163 return; 163 return;
164 } 164 }
165 qDebug("Targetfolder: %s",targetFolder.latin1()); 165 odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl;
166 qDebug("Fromfolder: %s",fromFolder->getName().latin1()); 166 odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl;
167 fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); 167 fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails());
168 refreshCurrent(); 168 refreshCurrent();
169} 169}
170 170
171bool AccountView::currentisDraft() 171bool AccountView::currentisDraft()
172{ 172{
173 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); 173 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
174 if (!view) return false; 174 if (!view) return false;
175 return view->isDraftfolder(); 175 return view->isDraftfolder();
176} 176}
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 988a1d9..fa703c4 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -174,25 +174,25 @@ void ComposeMail::removeAttachment()
174 if ( !attList->currentItem() ) { 174 if ( !attList->currentItem() ) {
175 QMessageBox::information( this, tr( "Error" ), 175 QMessageBox::information( this, tr( "Error" ),
176 tr( "<p>Please select a File.</p>" ), 176 tr( "<p>Please select a File.</p>" ),
177 tr( "Ok" ) ); 177 tr( "Ok" ) );
178 } else { 178 } else {
179 attList->takeItem( attList->currentItem() ); 179 attList->takeItem( attList->currentItem() );
180 } 180 }
181} 181}
182 182
183void ComposeMail::accept() 183void ComposeMail::accept()
184{ 184{
185 if ( checkBoxLater->isChecked() ) { 185 if ( checkBoxLater->isChecked() ) {
186 qDebug( "Send later" ); 186 odebug << "Send later" << oendl;
187 } 187 }
188 188
189#if 0 189#if 0
190 qDebug( "Sending Mail with " + 190 qDebug( "Sending Mail with " +
191 smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); 191 smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() );
192#endif 192#endif
193 Opie::Core::OSmartPointer<Mail> mail=new Mail; 193 Opie::Core::OSmartPointer<Mail> mail=new Mail;
194 194
195 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 195 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
196 mail->setMail(fromBox->currentText()); 196 mail->setMail(fromBox->currentText());
197 197
198 if ( !toLine->text().isEmpty() ) { 198 if ( !toLine->text().isEmpty() ) {
@@ -247,25 +247,25 @@ void ComposeMail::reject()
247 mail->setReply( replyLine->text() ); 247 mail->setReply( replyLine->text() );
248 mail->setSubject( subjectLine->text() ); 248 mail->setSubject( subjectLine->text() );
249 if (!m_replyid.isEmpty()) { 249 if (!m_replyid.isEmpty()) {
250 QStringList ids; 250 QStringList ids;
251 ids.append(m_replyid); 251 ids.append(m_replyid);
252 mail->setInreply(ids); 252 mail->setInreply(ids);
253 } 253 }
254 QString txt = message->text(); 254 QString txt = message->text();
255 if ( !sigMultiLine->text().isEmpty() ) { 255 if ( !sigMultiLine->text().isEmpty() ) {
256 txt.append( "\n--\n" ); 256 txt.append( "\n--\n" );
257 txt.append( sigMultiLine->text() ); 257 txt.append( sigMultiLine->text() );
258 } 258 }
259 qDebug(txt); 259 odebug << txt << oendl;
260 mail->setMessage( txt ); 260 mail->setMessage( txt );
261 261
262 /* only use the default drafts folder name! */ 262 /* only use the default drafts folder name! */
263 Storemail wrapper(AbstractMail::draftFolder()); 263 Storemail wrapper(AbstractMail::draftFolder());
264 wrapper.storeMail(mail); 264 wrapper.storeMail(mail);
265 265
266 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 266 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
267 /* attachments we will ignore! */ 267 /* attachments we will ignore! */
268 if ( it != NULL ) { 268 if ( it != NULL ) {
269 QMessageBox::warning(0,tr("Store message"), 269 QMessageBox::warning(0,tr("Store message"),
270 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 270 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
271 } 271 }
@@ -283,20 +283,20 @@ void ComposeMail::reEditMail(const RecMailP&current)
283 message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); 283 message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
284 subjectLine->setText( data->getSubject()); 284 subjectLine->setText( data->getSubject());
285 toLine->setText(data->To().join(",")); 285 toLine->setText(data->To().join(","));
286 ccLine->setText(data->CC().join(",")); 286 ccLine->setText(data->CC().join(","));
287 bccLine->setText(data->Bcc().join(",")); 287 bccLine->setText(data->Bcc().join(","));
288 replyLine->setText(data->Replyto()); 288 replyLine->setText(data->Replyto());
289} 289}
290 290
291AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 291AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
292 : QListViewItem( parent ) 292 : QListViewItem( parent )
293{ 293{
294 attachment = att; 294 attachment = att;
295 qDebug( att->getMimeType() ); 295 odebug << att->getMimeType() << oendl;
296 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? 296 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
297 Resource::loadPixmap( "UnknownDocument-14" ) : 297 Resource::loadPixmap( "UnknownDocument-14" ) :
298 attachment->getDocLnk().pixmap() ); 298 attachment->getDocLnk().pixmap() );
299 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 299 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
300 setText( 1, QString::number( att->getSize() ) ); 300 setText( 1, QString::number( att->getSize() ) );
301} 301}
302 302
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 5c4bdf7..de064ca 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -31,25 +31,25 @@ AccountListItem::AccountListItem( QListView *parent, Account *a)
31 ttext = "SMTP"; 31 ttext = "SMTP";
32 break; 32 break;
33 default: 33 default:
34 ttext = "UNKNOWN"; 34 ttext = "UNKNOWN";
35 break; 35 break;
36 } 36 }
37 setText( 1, ttext); 37 setText( 1, ttext);
38} 38}
39 39
40EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 40EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
41 : EditAccountsUI( parent, name, modal, flags ) 41 : EditAccountsUI( parent, name, modal, flags )
42{ 42{
43 qDebug( "New Account Configuration Widget" ); 43 odebug << "New Account Configuration Widget" << oendl;
44 settings = s; 44 settings = s;
45 45
46 mailList->addColumn( tr( "Account" ) ); 46 mailList->addColumn( tr( "Account" ) );
47 mailList->addColumn( tr( "Type" ) ); 47 mailList->addColumn( tr( "Type" ) );
48 48
49 newsList->addColumn( tr( "Account" ) ); 49 newsList->addColumn( tr( "Account" ) );
50 50
51 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 51 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
52 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 52 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
53 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 53 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
54 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); 54 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
55 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); 55 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
@@ -71,88 +71,88 @@ void EditAccounts::slotFillLists()
71 { 71 {
72 (void) new AccountListItem( newsList, it ); 72 (void) new AccountListItem( newsList, it );
73 } 73 }
74 else 74 else
75 { 75 {
76 (void) new AccountListItem( mailList, it ); 76 (void) new AccountListItem( mailList, it );
77 } 77 }
78 } 78 }
79} 79}
80 80
81void EditAccounts::slotNewMail() 81void EditAccounts::slotNewMail()
82{ 82{
83 qDebug( "New Mail Account" ); 83 odebug << "New Mail Account" << oendl;
84 QString *selection = new QString(); 84 QString *selection = new QString();
85 SelectMailType selType( selection, this, 0, true ); 85 SelectMailType selType( selection, this, 0, true );
86 selType.show(); 86 selType.show();
87 if ( QDialog::Accepted == selType.exec() ) 87 if ( QDialog::Accepted == selType.exec() )
88 { 88 {
89 slotNewAccount( *selection ); 89 slotNewAccount( *selection );
90 } 90 }
91} 91}
92 92
93void EditAccounts::slotNewAccount( const QString &type ) 93void EditAccounts::slotNewAccount( const QString &type )
94{ 94{
95 if ( type.compare( "IMAP" ) == 0 ) 95 if ( type.compare( "IMAP" ) == 0 )
96 { 96 {
97 qDebug( "-> config IMAP" ); 97 odebug << "-> config IMAP" << oendl;
98 IMAPaccount *account = new IMAPaccount(); 98 IMAPaccount *account = new IMAPaccount();
99 IMAPconfig imap( account, this, 0, true ); 99 IMAPconfig imap( account, this, 0, true );
100 if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) 100 if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) )
101 { 101 {
102 settings->addAccount( account ); 102 settings->addAccount( account );
103 account->save(); 103 account->save();
104 slotFillLists(); 104 slotFillLists();
105 } 105 }
106 else 106 else
107 { 107 {
108 account->remove(); 108 account->remove();
109 } 109 }
110 } 110 }
111 else if ( type.compare( "POP3" ) == 0 ) 111 else if ( type.compare( "POP3" ) == 0 )
112 { 112 {
113 qDebug( "-> config POP3" ); 113 odebug << "-> config POP3" << oendl;
114 POP3account *account = new POP3account(); 114 POP3account *account = new POP3account();
115 POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); 115 POP3config pop3( account, this, 0, true, WStyle_ContextHelp );
116 if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) 116 if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) )
117 { 117 {
118 settings->addAccount( account ); 118 settings->addAccount( account );
119 account->save(); 119 account->save();
120 slotFillLists(); 120 slotFillLists();
121 } 121 }
122 else 122 else
123 { 123 {
124 account->remove(); 124 account->remove();
125 } 125 }
126 } 126 }
127 else if ( type.compare( "SMTP" ) == 0 ) 127 else if ( type.compare( "SMTP" ) == 0 )
128 { 128 {
129 qDebug( "-> config SMTP" ); 129 odebug << "-> config SMTP" << oendl;
130 SMTPaccount *account = new SMTPaccount(); 130 SMTPaccount *account = new SMTPaccount();
131 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); 131 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp );
132 if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) 132 if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) )
133 { 133 {
134 settings->addAccount( account ); 134 settings->addAccount( account );
135 account->save(); 135 account->save();
136 slotFillLists(); 136 slotFillLists();
137 137
138 } 138 }
139 else 139 else
140 { 140 {
141 account->remove(); 141 account->remove();
142 } 142 }
143 } 143 }
144 else if ( type.compare( "NNTP" ) == 0 ) 144 else if ( type.compare( "NNTP" ) == 0 )
145 { 145 {
146 qDebug( "-> config NNTP" ); 146 odebug << "-> config NNTP" << oendl;
147 NNTPaccount *account = new NNTPaccount(); 147 NNTPaccount *account = new NNTPaccount();
148 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); 148 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp );
149 if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) 149 if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) )
150 { 150 {
151 settings->addAccount( account ); 151 settings->addAccount( account );
152 account->save(); 152 account->save();
153 slotFillLists(); 153 slotFillLists();
154 } 154 }
155 else 155 else
156 { 156 {
157 account->remove(); 157 account->remove();
158 } 158 }
@@ -203,25 +203,25 @@ void EditAccounts::slotDeleteAccount( Account *account )
203{ 203{
204 if ( QMessageBox::information( this, tr( "Question" ), 204 if ( QMessageBox::information( this, tr( "Question" ),
205 tr( "<p>Do you really want to delete the selected Account?</p>" ), 205 tr( "<p>Do you really want to delete the selected Account?</p>" ),
206 tr( "Yes" ), tr( "No" ) ) == 0 ) 206 tr( "Yes" ), tr( "No" ) ) == 0 )
207 { 207 {
208 settings->delAccount( account ); 208 settings->delAccount( account );
209 slotFillLists(); 209 slotFillLists();
210 } 210 }
211} 211}
212 212
213void EditAccounts::slotEditMail() 213void EditAccounts::slotEditMail()
214{ 214{
215 qDebug( "Edit Mail Account" ); 215 odebug << "Edit Mail Account" << oendl;
216 if ( !mailList->currentItem() ) 216 if ( !mailList->currentItem() )
217 { 217 {
218 QMessageBox::information( this, tr( "Error" ), 218 QMessageBox::information( this, tr( "Error" ),
219 tr( "<p>Please select an account.</p>" ), 219 tr( "<p>Please select an account.</p>" ),
220 tr( "Ok" ) ); 220 tr( "Ok" ) );
221 return; 221 return;
222 } 222 }
223 223
224 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 224 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
225 slotEditAccount( a ); 225 slotEditAccount( a );
226} 226}
227 227
@@ -232,46 +232,46 @@ void EditAccounts::slotDeleteMail()
232 QMessageBox::information( this, tr( "Error" ), 232 QMessageBox::information( this, tr( "Error" ),
233 tr( "<p>Please select an account.</p>" ), 233 tr( "<p>Please select an account.</p>" ),
234 tr( "Ok" ) ); 234 tr( "Ok" ) );
235 return; 235 return;
236 } 236 }
237 237
238 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 238 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
239 slotDeleteAccount( a ); 239 slotDeleteAccount( a );
240} 240}
241 241
242void EditAccounts::slotNewNews() 242void EditAccounts::slotNewNews()
243{ 243{
244 qDebug( "New News Account" ); 244 odebug << "New News Account" << oendl;
245 slotNewAccount( "NNTP" ); 245 slotNewAccount( "NNTP" );
246} 246}
247 247
248void EditAccounts::slotEditNews() 248void EditAccounts::slotEditNews()
249{ 249{
250 qDebug( "Edit News Account" ); 250 odebug << "Edit News Account" << oendl;
251 if ( !newsList->currentItem() ) 251 if ( !newsList->currentItem() )
252 { 252 {
253 QMessageBox::information( this, tr( "Error" ), 253 QMessageBox::information( this, tr( "Error" ),
254 tr( "<p>Please select an account.</p>" ), 254 tr( "<p>Please select an account.</p>" ),
255 tr( "Ok" ) ); 255 tr( "Ok" ) );
256 return; 256 return;
257 } 257 }
258 258
259 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 259 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
260 slotEditAccount( a ); 260 slotEditAccount( a );
261} 261}
262 262
263void EditAccounts::slotDeleteNews() 263void EditAccounts::slotDeleteNews()
264{ 264{
265 qDebug( "Delete News Account" ); 265 odebug << "Delete News Account" << oendl;
266 if ( !newsList->currentItem() ) 266 if ( !newsList->currentItem() )
267 { 267 {
268 QMessageBox::information( this, tr( "Error" ), 268 QMessageBox::information( this, tr( "Error" ),
269 tr( "<p>Please select an account.</p>" ), 269 tr( "<p>Please select an account.</p>" ),
270 tr( "Ok" ) ); 270 tr( "Ok" ) );
271 return; 271 return;
272 } 272 }
273 273
274 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 274 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
275 slotDeleteAccount( a ); 275 slotDeleteAccount( a );
276} 276}
277 277
@@ -569,25 +569,25 @@ void NNTPconfig::save()
569 data->setPort( portLine->text() ); 569 data->setPort( portLine->text() );
570 data->setSSL( sslBox->isChecked() ); 570 data->setSSL( sslBox->isChecked() );
571 data->setLogin( loginBox->isChecked() ); 571 data->setLogin( loginBox->isChecked() );
572 data->setUser( userLine->text() ); 572 data->setUser( userLine->text() );
573 data->setPassword( passLine->text() ); 573 data->setPassword( passLine->text() );
574 574
575 QListViewItemIterator list_it( ListViewGroups ); 575 QListViewItemIterator list_it( ListViewGroups );
576 576
577 QStringList groupList; 577 QStringList groupList;
578 for ( ; list_it.current(); ++list_it ) { 578 for ( ; list_it.current(); ++list_it ) {
579 579
580 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { 580 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
581 qDebug(list_it.current()->text(0) ); 581 odebug << list_it.current()->text(0) << oendl;
582 groupList.append( list_it.current()->text(0) ); 582 groupList.append( list_it.current()->text(0) );
583 } 583 }
584 584
585 } 585 }
586 data->setGroups( groupList ); 586 data->setGroups( groupList );
587} 587}
588 588
589void NNTPconfig::accept() 589void NNTPconfig::accept()
590{ 590{
591 save(); 591 save();
592 QDialog::accept(); 592 QDialog::accept();
593} 593}
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 6bebb7b..1a26351 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -43,67 +43,67 @@ AbstractMail* AbstractMail::getWrapper(Account*a)
43 return new POP3wrapper((POP3account*)a); 43 return new POP3wrapper((POP3account*)a);
44 break; 44 break;
45 case MAILLIB::A_NNTP: 45 case MAILLIB::A_NNTP:
46 return new NNTPwrapper((NNTPaccount*)a); 46 return new NNTPwrapper((NNTPaccount*)a);
47 break; 47 break;
48 default: 48 default:
49 return 0; 49 return 0;
50 } 50 }
51} 51}
52 52
53encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) 53encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
54{ 54{
55 qDebug("Decode string start"); 55 odebug << "Decode string start" << oendl;
56 char*result_text; 56 char*result_text;
57 size_t index = 0; 57 size_t index = 0;
58 /* reset for recursive use! */ 58 /* reset for recursive use! */
59 size_t target_length = 0; 59 size_t target_length = 0;
60 result_text = 0; 60 result_text = 0;
61 int mimetype = MAILMIME_MECHANISM_7BIT; 61 int mimetype = MAILMIME_MECHANISM_7BIT;
62 if (enc.lower()=="quoted-printable") { 62 if (enc.lower()=="quoted-printable") {
63 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 63 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
64 } else if (enc.lower()=="base64") { 64 } else if (enc.lower()=="base64") {
65 mimetype = MAILMIME_MECHANISM_BASE64; 65 mimetype = MAILMIME_MECHANISM_BASE64;
66 } else if (enc.lower()=="8bit") { 66 } else if (enc.lower()=="8bit") {
67 mimetype = MAILMIME_MECHANISM_8BIT; 67 mimetype = MAILMIME_MECHANISM_8BIT;
68 } else if (enc.lower()=="binary") { 68 } else if (enc.lower()=="binary") {
69 mimetype = MAILMIME_MECHANISM_BINARY; 69 mimetype = MAILMIME_MECHANISM_BINARY;
70 } 70 }
71 71
72 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, 72 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
73 &result_text,&target_length); 73 &result_text,&target_length);
74 74
75 encodedString* result = new encodedString(); 75 encodedString* result = new encodedString();
76 if (err == MAILIMF_NO_ERROR) { 76 if (err == MAILIMF_NO_ERROR) {
77 result->setContent(result_text,target_length); 77 result->setContent(result_text,target_length);
78 } 78 }
79 qDebug("Decode string finished"); 79 odebug << "Decode string finished" << oendl;
80 return result; 80 return result;
81} 81}
82 82
83QString AbstractMail::convert_String(const char*text) 83QString AbstractMail::convert_String(const char*text)
84{ 84{
85 //size_t index = 0; 85 //size_t index = 0;
86 char*res = 0; 86 char*res = 0;
87 int err = MAILIMF_NO_ERROR; 87 int err = MAILIMF_NO_ERROR;
88 88
89 QString result(text); 89 QString result(text);
90 90
91 /* due a bug in libetpan it isn't usable this moment */ 91 /* due a bug in libetpan it isn't usable this moment */
92/* int err = mailmime_encoded_phrase_parse("iso-8859-1", 92/* int err = mailmime_encoded_phrase_parse("iso-8859-1",
93 text, strlen(text),&index, "iso-8859-1",&res);*/ 93 text, strlen(text),&index, "iso-8859-1",&res);*/
94 //qDebug("Input: %s",text); 94 //odebug << "Input: " << text << "" << oendl;
95 if (err == MAILIMF_NO_ERROR && res && strlen(res)) { 95 if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
96// result = QString(res); 96// result = QString(res);
97// qDebug("Res: %s, length: %i",res,strlen(res)); 97// odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl;
98 } 98 }
99 if (res) free(res); 99 if (res) free(res);
100 return result; 100 return result;
101} 101}
102 102
103/* cp & paste from launcher */ 103/* cp & paste from launcher */
104QString AbstractMail::gen_attachment_id() 104QString AbstractMail::gen_attachment_id()
105{ 105{
106 QFile file( "/proc/sys/kernel/random/uuid" ); 106 QFile file( "/proc/sys/kernel/random/uuid" );
107 if (!file.open(IO_ReadOnly ) ) 107 if (!file.open(IO_ReadOnly ) )
108 return QString::null; 108 return QString::null;
109 109
diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp
index cb58d82..36ec232 100644
--- a/noncore/net/mail/libmailwrapper/generatemail.cpp
+++ b/noncore/net/mail/libmailwrapper/generatemail.cpp
@@ -88,47 +88,47 @@ mailimf_address_list *Generatemail::parseAddresses(const QString&addr ) {
88 QString s; 88 QString s;
89 unsigned int i = 0; 89 unsigned int i = 0;
90 for (; i < addr.length();++i) { 90 for (; i < addr.length();++i) {
91 switch (addr[i]) { 91 switch (addr[i]) {
92 case '\"': 92 case '\"':
93 literal_open = !literal_open; 93 literal_open = !literal_open;
94 break; 94 break;
95 case ',': 95 case ',':
96 if (!literal_open) { 96 if (!literal_open) {
97 s = addr.mid(startpos,i-startpos); 97 s = addr.mid(startpos,i-startpos);
98 if (!s.isEmpty()) { 98 if (!s.isEmpty()) {
99 list.append(s); 99 list.append(s);
100 qDebug("Appended %s",s.latin1()); 100 odebug << "Appended " << s.latin1() << "" << oendl;
101 } 101 }
102 // !!!! this is a MUST BE! 102 // !!!! this is a MUST BE!
103 startpos = ++i; 103 startpos = ++i;
104 } 104 }
105 break; 105 break;
106 default: 106 default:
107 break; 107 break;
108 } 108 }
109 } 109 }
110 s = addr.mid(startpos,i-startpos); 110 s = addr.mid(startpos,i-startpos);
111 if (!s.isEmpty()) { 111 if (!s.isEmpty()) {
112 list.append(s); 112 list.append(s);
113 qDebug("Appended %s",s.latin1()); 113 odebug << "Appended " << s.latin1() << "" << oendl;
114 } 114 }
115 QStringList::Iterator it; 115 QStringList::Iterator it;
116 for ( it = list.begin(); it != list.end(); it++ ) { 116 for ( it = list.begin(); it != list.end(); it++ ) {
117 int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); 117 int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() );
118 if ( err != MAILIMF_NO_ERROR ) { 118 if ( err != MAILIMF_NO_ERROR ) {
119 qDebug( "Error parsing" ); 119 odebug << "Error parsing" << oendl;
120 qDebug( *it ); 120 odebug << *it << oendl;
121 } else { 121 } else {
122 qDebug( "Parse success! %s",(*it).latin1()); 122 odebug << "Parse success! " << (*it).latin1() << "" << oendl;
123 } 123 }
124 } 124 }
125 return addresses; 125 return addresses;
126} 126}
127 127
128mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { 128mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) {
129 mailmime * filePart = 0; 129 mailmime * filePart = 0;
130 mailmime_fields * fields = 0; 130 mailmime_fields * fields = 0;
131 mailmime_content * content = 0; 131 mailmime_content * content = 0;
132 mailmime_parameter * param = 0; 132 mailmime_parameter * param = 0;
133 char*name = 0; 133 char*name = 0;
134 char*file = 0; 134 char*file = 0;
@@ -166,25 +166,25 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet
166 clist_append(content->ct_parameters,param); 166 clist_append(content->ct_parameters,param);
167 param = 0; 167 param = 0;
168 } 168 }
169 filePart = mailmime_new_empty( content, fields ); 169 filePart = mailmime_new_empty( content, fields );
170 } 170 }
171 if (filePart) { 171 if (filePart) {
172 if (filename.length()>0) { 172 if (filename.length()>0) {
173 err = mailmime_set_body_file( filePart, file ); 173 err = mailmime_set_body_file( filePart, file );
174 } else { 174 } else {
175 err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length()); 175 err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length());
176 } 176 }
177 if (err != MAILIMF_NO_ERROR) { 177 if (err != MAILIMF_NO_ERROR) {
178 qDebug("Error setting body with file %s",file); 178 odebug << "Error setting body with file " << file << "" << oendl;
179 mailmime_free( filePart ); 179 mailmime_free( filePart );
180 filePart = 0; 180 filePart = 0;
181 } 181 }
182 } 182 }
183 183
184 if (!filePart) { 184 if (!filePart) {
185 if ( param != NULL ) { 185 if ( param != NULL ) {
186 mailmime_parameter_free( param ); 186 mailmime_parameter_free( param );
187 } 187 }
188 if (content) { 188 if (content) {
189 mailmime_content_free( content ); 189 mailmime_content_free( content );
190 } 190 }
@@ -197,41 +197,41 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet
197 if (file) { 197 if (file) {
198 free( file ); 198 free( file );
199 } 199 }
200 } 200 }
201 } 201 }
202 return filePart; // Success :) 202 return filePart; // Success :)
203 203
204} 204}
205 205
206void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) { 206void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) {
207 const Attachment *it; 207 const Attachment *it;
208 unsigned int count = files.count(); 208 unsigned int count = files.count();
209 qDebug("List contains %i values",count); 209 odebug << "List contains " << count << " values" << oendl;
210 for ( unsigned int i = 0; i < count; ++i ) { 210 for ( unsigned int i = 0; i < count; ++i ) {
211 qDebug( "Adding file" ); 211 odebug << "Adding file" << oendl;
212 mailmime *filePart; 212 mailmime *filePart;
213 int err; 213 int err;
214 it = ((QList<Attachment>)files).at(i); 214 it = ((QList<Attachment>)files).at(i);
215 215
216 filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); 216 filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" );
217 if ( filePart == NULL ) { 217 if ( filePart == NULL ) {
218 qDebug( "addFileParts: error adding file:" ); 218 odebug << "addFileParts: error adding file:" << oendl;
219 qDebug( it->getFileName() ); 219 odebug << it->getFileName() << oendl;
220 continue; 220 continue;
221 } 221 }
222 err = mailmime_smart_add_part( message, filePart ); 222 err = mailmime_smart_add_part( message, filePart );
223 if ( err != MAILIMF_NO_ERROR ) { 223 if ( err != MAILIMF_NO_ERROR ) {
224 mailmime_free( filePart ); 224 mailmime_free( filePart );
225 qDebug("error smart add"); 225 odebug << "error smart add" << oendl;
226 } 226 }
227 } 227 }
228} 228}
229 229
230mailmime *Generatemail::buildTxtPart(const QString&str ) { 230mailmime *Generatemail::buildTxtPart(const QString&str ) {
231 mailmime *txtPart; 231 mailmime *txtPart;
232 mailmime_fields *fields; 232 mailmime_fields *fields;
233 mailmime_content *content; 233 mailmime_content *content;
234 mailmime_parameter *param; 234 mailmime_parameter *param;
235 int err; 235 int err;
236 236
237 param = mailmime_parameter_new( strdup( "charset" ), 237 param = mailmime_parameter_new( strdup( "charset" ),
@@ -261,25 +261,25 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) {
261 261
262 return txtPart; // Success :) 262 return txtPart; // Success :)
263 263
264err_free_txtPart: 264err_free_txtPart:
265 mailmime_free( txtPart ); 265 mailmime_free( txtPart );
266err_free_fields: 266err_free_fields:
267 mailmime_fields_free( fields ); 267 mailmime_fields_free( fields );
268err_free_content: 268err_free_content:
269 mailmime_content_free( content ); 269 mailmime_content_free( content );
270err_free_param: 270err_free_param:
271 mailmime_parameter_free( param ); 271 mailmime_parameter_free( param );
272err_free: 272err_free:
273 qDebug( "buildTxtPart - error" ); 273 odebug << "buildTxtPart - error" << oendl;
274 274
275 return NULL; // Error :( 275 return NULL; // Error :(
276} 276}
277 277
278mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { 278mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) {
279 return mailimf_mailbox_new( strdup( name.latin1() ), 279 return mailimf_mailbox_new( strdup( name.latin1() ),
280 strdup( mail.latin1() ) ); 280 strdup( mail.latin1() ) );
281} 281}
282 282
283mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail ) 283mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail )
284{ 284{
285 mailimf_fields *fields = NULL; 285 mailimf_fields *fields = NULL;
@@ -336,33 +336,33 @@ mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Ma
336 h.remove(0,1); 336 h.remove(0,1);
337 } 337 }
338 while (h.length()>0 && h[h.length()-1]=='>') { 338 while (h.length()>0 && h[h.length()-1]=='>') {
339 h.remove(h.length()-1,1); 339 h.remove(h.length()-1,1);
340 } 340 }
341 if (h.isEmpty()) continue; 341 if (h.isEmpty()) continue;
342 nsize = strlen(h.latin1()); 342 nsize = strlen(h.latin1());
343 /* yes! must be malloc! */ 343 /* yes! must be malloc! */
344 c_reply = (char*)malloc( (nsize+1)*sizeof(char)); 344 c_reply = (char*)malloc( (nsize+1)*sizeof(char));
345 memset(c_reply,0,nsize+1); 345 memset(c_reply,0,nsize+1);
346 memcpy(c_reply,h.latin1(),nsize); 346 memcpy(c_reply,h.latin1(),nsize);
347 clist_append(in_reply_to,c_reply); 347 clist_append(in_reply_to,c_reply);
348 qDebug("In reply to: %s",c_reply); 348 odebug << "In reply to: " << c_reply << "" << oendl;
349 } 349 }
350 } 350 }
351 351
352 if (res) { 352 if (res) {
353 fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, 353 fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc,
354 in_reply_to, NULL, subject ); 354 in_reply_to, NULL, subject );
355 if ( fields == NULL ) { 355 if ( fields == NULL ) {
356 qDebug("Error creating mailimf fields"); 356 odebug << "Error creating mailimf fields" << oendl;
357 res = 0; 357 res = 0;
358 } 358 }
359 } 359 }
360 if (res) xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), 360 if (res) xmailer = mailimf_field_new_custom( strdup( "User-Agent" ),
361 strdup( USER_AGENT ) ); 361 strdup( USER_AGENT ) );
362 if ( xmailer == NULL ) { 362 if ( xmailer == NULL ) {
363 res = 0; 363 res = 0;
364 } else { 364 } else {
365 err = mailimf_fields_add( fields, xmailer ); 365 err = mailimf_fields_add( fields, xmailer );
366 if ( err != MAILIMF_NO_ERROR ) { 366 if ( err != MAILIMF_NO_ERROR ) {
367 res = 0; 367 res = 0;
368 } 368 }
@@ -426,25 +426,25 @@ mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &ma
426 426
427 addFileParts( message, mail->getAttachments() ); 427 addFileParts( message, mail->getAttachments() );
428 428
429 return message; // Success :) 429 return message; // Success :)
430 430
431err_free_txtPart: 431err_free_txtPart:
432 mailmime_free( txtPart ); 432 mailmime_free( txtPart );
433err_free_message: 433err_free_message:
434 mailmime_free( message ); 434 mailmime_free( message );
435err_free_fields: 435err_free_fields:
436 mailimf_fields_free( fields ); 436 mailimf_fields_free( fields );
437err_free: 437err_free:
438 qDebug( "createMimeMail: error" ); 438 odebug << "createMimeMail: error" << oendl;
439 439
440 return NULL; // Error :( 440 return NULL; // Error :(
441} 441}
442 442
443clist *Generatemail::createRcptList( mailimf_fields *fields ) { 443clist *Generatemail::createRcptList( mailimf_fields *fields ) {
444 clist *rcptList; 444 clist *rcptList;
445 mailimf_field *field; 445 mailimf_field *field;
446 446
447 rcptList = esmtp_address_list_new(); 447 rcptList = esmtp_address_list_new();
448 448
449 field = getField( fields, MAILIMF_FIELD_TO ); 449 field = getField( fields, MAILIMF_FIELD_TO );
450 if ( field && (field->fld_type == MAILIMF_FIELD_TO) 450 if ( field && (field->fld_type == MAILIMF_FIELD_TO)
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index 0c68280..fae4c99 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -126,25 +126,25 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
126 default: 126 default:
127 if (aEnc->enc_token) { 127 if (aEnc->enc_token) {
128 enc = QString(aEnc->enc_token); 128 enc = QString(aEnc->enc_token);
129 } 129 }
130 break; 130 break;
131 } 131 }
132 return enc; 132 return enc;
133} 133}
134 134
135void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) 135void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
136{ 136{
137 if (current_rec >= 10) { 137 if (current_rec >= 10) {
138 qDebug("too deep recursion!"); 138 odebug << "too deep recursion!" << oendl;
139 } 139 }
140 if (!message || !mime) { 140 if (!message || !mime) {
141 return; 141 return;
142 } 142 }
143 int r; 143 int r;
144 char*data = 0; 144 char*data = 0;
145 size_t len; 145 size_t len;
146 clistiter * cur = 0; 146 clistiter * cur = 0;
147 QString b; 147 QString b;
148 RecPartP part = new RecPart(); 148 RecPartP part = new RecPart();
149 149
150 switch (mime->mm_type) { 150 switch (mime->mm_type) {
@@ -263,25 +263,25 @@ QString Genericwrapper::parseAddressList( mailimf_address_list *list )
263 } else { 263 } else {
264 first = false; 264 first = false;
265 } 265 }
266 266
267 switch ( addr->ad_type ) { 267 switch ( addr->ad_type ) {
268 case MAILIMF_ADDRESS_MAILBOX: 268 case MAILIMF_ADDRESS_MAILBOX:
269 result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); 269 result.append( parseMailbox( addr->ad_data.ad_mailbox ) );
270 break; 270 break;
271 case MAILIMF_ADDRESS_GROUP: 271 case MAILIMF_ADDRESS_GROUP:
272 result.append( parseGroup( addr->ad_data.ad_group ) ); 272 result.append( parseGroup( addr->ad_data.ad_group ) );
273 break; 273 break;
274 default: 274 default:
275 qDebug( "Generic: unkown mailimf address type" ); 275 odebug << "Generic: unkown mailimf address type" << oendl;
276 break; 276 break;
277 } 277 }
278 } 278 }
279 279
280 return result; 280 return result;
281} 281}
282 282
283QString Genericwrapper::parseGroup( mailimf_group *group ) 283QString Genericwrapper::parseGroup( mailimf_group *group )
284{ 284{
285 QString result( "" ); 285 QString result( "" );
286 286
287 result.append( group->grp_display_name ); 287 result.append( group->grp_display_name );
@@ -356,25 +356,25 @@ QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part)
356 return text; 356 return text;
357} 357}
358 358
359void Genericwrapper::cleanMimeCache() 359void Genericwrapper::cleanMimeCache()
360{ 360{
361 QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); 361 QMap<QString,encodedString*>::Iterator it = bodyCache.begin();
362 for (;it!=bodyCache.end();++it) { 362 for (;it!=bodyCache.end();++it) {
363 encodedString*t = it.data(); 363 encodedString*t = it.data();
364 //it.setValue(0); 364 //it.setValue(0);
365 if (t) delete t; 365 if (t) delete t;
366 } 366 }
367 bodyCache.clear(); 367 bodyCache.clear();
368 qDebug("Genericwrapper: cache cleaned"); 368 odebug << "Genericwrapper: cache cleaned" << oendl;
369} 369}
370 370
371QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) 371QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
372{ 372{
373 QStringList res; 373 QStringList res;
374 if (!in_replies || !in_replies->mid_list) return res; 374 if (!in_replies || !in_replies->mid_list) return res;
375 clistiter * current = 0; 375 clistiter * current = 0;
376 for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { 376 for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) {
377 QString h((char*)current->data); 377 QString h((char*)current->data);
378 while (h.length()>0 && h[0]=='<') { 378 while (h.length()>0 && h[0]=='<') {
379 h.remove(0,1); 379 h.remove(0,1);
380 } 380 }
@@ -385,44 +385,44 @@ QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
385 res.append(h); 385 res.append(h);
386 } 386 }
387 } 387 }
388 return res; 388 return res;
389} 389}
390 390
391void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) 391void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to)
392{ 392{
393 int r; 393 int r;
394 mailmessage_list * env_list = 0; 394 mailmessage_list * env_list = 0;
395 r = mailsession_get_messages_list(session,&env_list); 395 r = mailsession_get_messages_list(session,&env_list);
396 if (r != MAIL_NO_ERROR) { 396 if (r != MAIL_NO_ERROR) {
397 qDebug("Error message list"); 397 odebug << "Error message list" << oendl;
398 return; 398 return;
399 } 399 }
400 r = mailsession_get_envelopes_list(session, env_list); 400 r = mailsession_get_envelopes_list(session, env_list);
401 if (r != MAIL_NO_ERROR) { 401 if (r != MAIL_NO_ERROR) {
402 qDebug("Error filling message list"); 402 odebug << "Error filling message list" << oendl;
403 if (env_list) { 403 if (env_list) {
404 mailmessage_list_free(env_list); 404 mailmessage_list_free(env_list);
405 } 405 }
406 return; 406 return;
407 } 407 }
408 mailimf_references * refs = 0; 408 mailimf_references * refs = 0;
409 mailimf_in_reply_to * in_replies = 0; 409 mailimf_in_reply_to * in_replies = 0;
410 uint32_t i = 0; 410 uint32_t i = 0;
411 for(; i < carray_count(env_list->msg_tab) ; ++i) { 411 for(; i < carray_count(env_list->msg_tab) ; ++i) {
412 mailmessage * msg; 412 mailmessage * msg;
413 QBitArray mFlags(7); 413 QBitArray mFlags(7);
414 msg = (mailmessage*)carray_get(env_list->msg_tab, i); 414 msg = (mailmessage*)carray_get(env_list->msg_tab, i);
415 if (msg->msg_fields == NULL) { 415 if (msg->msg_fields == NULL) {
416 //qDebug("could not fetch envelope of message %i", i); 416 //odebug << "could not fetch envelope of message " << i << "" << oendl;
417 continue; 417 continue;
418 } 418 }
419 RecMailP mail = new RecMail(); 419 RecMailP mail = new RecMail();
420 mail->setWrapper(this); 420 mail->setWrapper(this);
421 mail_flags * flag_result = 0; 421 mail_flags * flag_result = 0;
422 r = mailmessage_get_flags(msg,&flag_result); 422 r = mailmessage_get_flags(msg,&flag_result);
423 if (r == MAIL_ERROR_NOT_IMPLEMENTED) { 423 if (r == MAIL_ERROR_NOT_IMPLEMENTED) {
424 mFlags.setBit(FLAG_SEEN); 424 mFlags.setBit(FLAG_SEEN);
425 } 425 }
426 mailimf_single_fields single_fields; 426 mailimf_single_fields single_fields;
427 mailimf_single_fields_init(&single_fields, msg->msg_fields); 427 mailimf_single_fields_init(&single_fields, msg->msg_fields);
428 mail->setMsgsize(msg->msg_size); 428 mail->setMsgsize(msg->msg_size);
@@ -439,25 +439,25 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &
439 } else { 439 } else {
440 mail->setTo(mailbox); 440 mail->setTo(mailbox);
441 } 441 }
442 if (single_fields.fld_cc) 442 if (single_fields.fld_cc)
443 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); 443 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
444 if (single_fields.fld_bcc) 444 if (single_fields.fld_bcc)
445 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); 445 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
446 if (single_fields.fld_orig_date) 446 if (single_fields.fld_orig_date)
447 mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); 447 mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) );
448 // crashes when accessing pop3 account? 448 // crashes when accessing pop3 account?
449 if (single_fields.fld_message_id->mid_value) { 449 if (single_fields.fld_message_id->mid_value) {
450 mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); 450 mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
451 qDebug("Msgid == %s",mail->Msgid().latin1()); 451 odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl;
452 } 452 }
453 453
454 if (single_fields.fld_reply_to) { 454 if (single_fields.fld_reply_to) {
455 QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); 455 QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list);
456 if (t.count()>0) { 456 if (t.count()>0) {
457 mail->setReplyto(t[0]); 457 mail->setReplyto(t[0]);
458 } 458 }
459 } 459 }
460#if 0 460#if 0
461 refs = single_fields.fld_references; 461 refs = single_fields.fld_references;
462 if (refs && refs->mid_list && clist_count(refs->mid_list)) { 462 if (refs && refs->mid_list && clist_count(refs->mid_list)) {
463 char * text = (char*)refs->mid_list->first->data; 463 char * text = (char*)refs->mid_list->first->data;
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 657c2ba..35468fe 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -21,69 +21,69 @@ IMAPwrapper::~IMAPwrapper()
21 logout(); 21 logout();
22} 22}
23 23
24/* to avoid to often select statements in loops etc. 24/* to avoid to often select statements in loops etc.
25 we trust that we are logged in and connection is established!*/ 25 we trust that we are logged in and connection is established!*/
26int IMAPwrapper::selectMbox(const QString&mbox) 26int IMAPwrapper::selectMbox(const QString&mbox)
27{ 27{
28 if (mbox == m_Lastmbox) { 28 if (mbox == m_Lastmbox) {
29 return MAILIMAP_NO_ERROR; 29 return MAILIMAP_NO_ERROR;
30 } 30 }
31 int err = mailimap_select( m_imap, (char*)mbox.latin1()); 31 int err = mailimap_select( m_imap, (char*)mbox.latin1());
32 if ( err != MAILIMAP_NO_ERROR ) { 32 if ( err != MAILIMAP_NO_ERROR ) {
33 qDebug("error selecting mailbox: %s",m_imap->imap_response); 33 odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl;
34 m_Lastmbox = ""; 34 m_Lastmbox = "";
35 return err; 35 return err;
36 } 36 }
37 m_Lastmbox = mbox; 37 m_Lastmbox = mbox;
38 return err; 38 return err;
39} 39}
40 40
41void IMAPwrapper::imap_progress( size_t current, size_t maximum ) 41void IMAPwrapper::imap_progress( size_t current, size_t maximum )
42{ 42{
43 qApp->processEvents(); 43 qApp->processEvents();
44 qDebug( "IMAP: %i of %i", current, maximum ); 44 odebug << "IMAP: " << current << " of " << maximum << "" << oendl;
45} 45}
46 46
47bool IMAPwrapper::start_tls(bool force_tls) 47bool IMAPwrapper::start_tls(bool force_tls)
48{ 48{
49 int err; 49 int err;
50 bool try_tls; 50 bool try_tls;
51 mailimap_capability_data * cap_data = 0; 51 mailimap_capability_data * cap_data = 0;
52 52
53 err = mailimap_capability(m_imap,&cap_data); 53 err = mailimap_capability(m_imap,&cap_data);
54 if (err != MAILIMAP_NO_ERROR) { 54 if (err != MAILIMAP_NO_ERROR) {
55 Global::statusMessage("error getting capabilities!"); 55 Global::statusMessage("error getting capabilities!");
56 qDebug("error getting capabilities!"); 56 odebug << "error getting capabilities!" << oendl;
57 return false; 57 return false;
58 } 58 }
59 clistiter * cur; 59 clistiter * cur;
60 for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { 60 for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) {
61 struct mailimap_capability * cap; 61 struct mailimap_capability * cap;
62 cap = (struct mailimap_capability *)clist_content(cur); 62 cap = (struct mailimap_capability *)clist_content(cur);
63 if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { 63 if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) {
64 if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) { 64 if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) {
65 try_tls = true; 65 try_tls = true;
66 break; 66 break;
67 } 67 }
68 } 68 }
69 } 69 }
70 if (cap_data) { 70 if (cap_data) {
71 mailimap_capability_data_free(cap_data); 71 mailimap_capability_data_free(cap_data);
72 } 72 }
73 if (try_tls) { 73 if (try_tls) {
74 err = mailimap_starttls(m_imap); 74 err = mailimap_starttls(m_imap);
75 if (err != MAILIMAP_NO_ERROR && force_tls) { 75 if (err != MAILIMAP_NO_ERROR && force_tls) {
76 Global::statusMessage(tr("Server has no TLS support!")); 76 Global::statusMessage(tr("Server has no TLS support!"));
77 qDebug("Server has no TLS support!"); 77 odebug << "Server has no TLS support!" << oendl;
78 try_tls = false; 78 try_tls = false;
79 } else { 79 } else {
80 mailstream_low * low; 80 mailstream_low * low;
81 mailstream_low * new_low; 81 mailstream_low * new_low;
82 low = mailstream_get_low(m_imap->imap_stream); 82 low = mailstream_get_low(m_imap->imap_stream);
83 if (!low) { 83 if (!low) {
84 try_tls = false; 84 try_tls = false;
85 } else { 85 } else {
86 int fd = mailstream_low_get_fd(low); 86 int fd = mailstream_low_get_fd(low);
87 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { 87 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) {
88 mailstream_low_free(low); 88 mailstream_low_free(low);
89 mailstream_set_low(m_imap->imap_stream, new_low); 89 mailstream_set_low(m_imap->imap_stream, new_low);
@@ -116,48 +116,48 @@ void IMAPwrapper::login()
116 } 116 }
117 server = account->getServer().latin1(); 117 server = account->getServer().latin1();
118 port = account->getPort().toUInt(); 118 port = account->getPort().toUInt();
119 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 119 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
120 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 120 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
121 login.show(); 121 login.show();
122 if ( QDialog::Accepted == login.exec() ) { 122 if ( QDialog::Accepted == login.exec() ) {
123 // ok 123 // ok
124 user = login.getUser().latin1(); 124 user = login.getUser().latin1();
125 pass = login.getPassword().latin1(); 125 pass = login.getPassword().latin1();
126 } else { 126 } else {
127 // cancel 127 // cancel
128 qDebug( "IMAP: Login canceled" ); 128 odebug << "IMAP: Login canceled" << oendl;
129 return; 129 return;
130 } 130 }
131 } else { 131 } else {
132 user = account->getUser().latin1(); 132 user = account->getUser().latin1();
133 pass = account->getPassword().latin1(); 133 pass = account->getPassword().latin1();
134 } 134 }
135 135
136 m_imap = mailimap_new( 20, &imap_progress ); 136 m_imap = mailimap_new( 20, &imap_progress );
137 137
138 /* connect */ 138 /* connect */
139 bool ssl = false; 139 bool ssl = false;
140 bool try_tls = false; 140 bool try_tls = false;
141 bool force_tls = false; 141 bool force_tls = false;
142 142
143 if ( account->ConnectionType() == 2 ) { 143 if ( account->ConnectionType() == 2 ) {
144 ssl = true; 144 ssl = true;
145 } 145 }
146 if (account->ConnectionType()==1) { 146 if (account->ConnectionType()==1) {
147 force_tls = true; 147 force_tls = true;
148 } 148 }
149 149
150 if ( ssl ) { 150 if ( ssl ) {
151 qDebug( "using ssl" ); 151 odebug << "using ssl" << oendl;
152 err = mailimap_ssl_connect( m_imap, (char*)server, port ); 152 err = mailimap_ssl_connect( m_imap, (char*)server, port );
153 } else { 153 } else {
154 err = mailimap_socket_connect( m_imap, (char*)server, port ); 154 err = mailimap_socket_connect( m_imap, (char*)server, port );
155 } 155 }
156 156
157 if ( err != MAILIMAP_NO_ERROR && 157 if ( err != MAILIMAP_NO_ERROR &&
158 err != MAILIMAP_NO_ERROR_AUTHENTICATED && 158 err != MAILIMAP_NO_ERROR_AUTHENTICATED &&
159 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { 159 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
160 QString failure = ""; 160 QString failure = "";
161 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { 161 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) {
162 failure="Connection refused"; 162 failure="Connection refused";
163 } else { 163 } else {
@@ -167,25 +167,25 @@ void IMAPwrapper::login()
167 mailimap_free( m_imap ); 167 mailimap_free( m_imap );
168 m_imap = 0; 168 m_imap = 0;
169 return; 169 return;
170 } 170 }
171 171
172 if (!ssl) { 172 if (!ssl) {
173 try_tls = start_tls(force_tls); 173 try_tls = start_tls(force_tls);
174 } 174 }
175 175
176 bool ok = true; 176 bool ok = true;
177 if (force_tls && !try_tls) { 177 if (force_tls && !try_tls) {
178 Global::statusMessage(tr("Server has no TLS support!")); 178 Global::statusMessage(tr("Server has no TLS support!"));
179 qDebug("Server has no TLS support!"); 179 odebug << "Server has no TLS support!" << oendl;
180 ok = false; 180 ok = false;
181 } 181 }
182 182
183 183
184 /* login */ 184 /* login */
185 185
186 if (ok) { 186 if (ok) {
187 err = mailimap_login_simple( m_imap, (char*)user, (char*)pass ); 187 err = mailimap_login_simple( m_imap, (char*)user, (char*)pass );
188 if ( err != MAILIMAP_NO_ERROR ) { 188 if ( err != MAILIMAP_NO_ERROR ) {
189 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); 189 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response));
190 ok = false; 190 ok = false;
191 } 191 }
@@ -308,35 +308,35 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
308 if ( (bflags = list->mb_flag) ) { 308 if ( (bflags = list->mb_flag) ) {
309 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& 309 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
310 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); 310 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
311 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { 311 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
312 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { 312 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) {
313 no_inferiors = true; 313 no_inferiors = true;
314 } 314 }
315 } 315 }
316 } 316 }
317 folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); 317 folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix()));
318 } 318 }
319 } else { 319 } else {
320 qDebug("error fetching folders: %s",m_imap->imap_response); 320 odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl;
321 } 321 }
322 mailimap_list_result_free( result ); 322 mailimap_list_result_free( result );
323 323
324/* 324/*
325 * second stage - get the other then inbox folders 325 * second stage - get the other then inbox folders
326 */ 326 */
327 mask = "*" ; 327 mask = "*" ;
328 path = account->getPrefix().latin1(); 328 path = account->getPrefix().latin1();
329 if (!path) path = ""; 329 if (!path) path = "";
330 qDebug(path); 330 odebug << path << oendl;
331 err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); 331 err = mailimap_list( m_imap, (char*)path, (char*)mask, &result );
332 if ( err == MAILIMAP_NO_ERROR ) { 332 if ( err == MAILIMAP_NO_ERROR ) {
333 current = result->first; 333 current = result->first;
334 for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { 334 for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
335 no_inferiors = false; 335 no_inferiors = false;
336 list = (mailimap_mailbox_list *) current->data; 336 list = (mailimap_mailbox_list *) current->data;
337 // it is better use the deep copy mechanism of qt itself 337 // it is better use the deep copy mechanism of qt itself
338 // instead of using strdup! 338 // instead of using strdup!
339 temp = list->mb_name; 339 temp = list->mb_name;
340 if (temp.lower()=="inbox") 340 if (temp.lower()=="inbox")
341 continue; 341 continue;
342 if (temp.lower()==account->getPrefix().lower()) 342 if (temp.lower()==account->getPrefix().lower())
@@ -345,25 +345,25 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
345 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& 345 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
346 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); 346 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
347 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { 347 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
348 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { 348 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) {
349 no_inferiors = true; 349 no_inferiors = true;
350 } 350 }
351 } 351 }
352 } 352 }
353 del = list->mb_delimiter; 353 del = list->mb_delimiter;
354 folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); 354 folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix()));
355 } 355 }
356 } else { 356 } else {
357 qDebug("error fetching folders %s",m_imap->imap_response); 357 odebug << "error fetching folders " << m_imap->imap_response << "" << oendl;
358 } 358 }
359 if (result) mailimap_list_result_free( result ); 359 if (result) mailimap_list_result_free( result );
360 return folders; 360 return folders;
361} 361}
362 362
363RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) 363RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
364{ 364{
365 RecMail * m = 0; 365 RecMail * m = 0;
366 mailimap_msg_att_item *item=0; 366 mailimap_msg_att_item *item=0;
367 clistcell *current,*c,*cf; 367 clistcell *current,*c,*cf;
368 mailimap_msg_att_dynamic*flist; 368 mailimap_msg_att_dynamic*flist;
369 mailimap_flag_fetch*cflag; 369 mailimap_flag_fetch*cflag;
@@ -457,26 +457,26 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
457 } 457 }
458 if (h.length()>0) { 458 if (h.length()>0) {
459 m->setInreply(QStringList(h)); 459 m->setInreply(QStringList(h));
460 } 460 }
461 } 461 }
462 if (head->env_message_id) { 462 if (head->env_message_id) {
463 m->setMsgid(QString(head->env_message_id)); 463 m->setMsgid(QString(head->env_message_id));
464 } 464 }
465 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { 465 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
466#if 0 466#if 0
467 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; 467 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
468 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); 468 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
469 qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); 469 odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl;
470 qDebug(da.toString()); 470 odebug << da.toString() << oendl;
471#endif 471#endif
472 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { 472 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) {
473 size = item->att_data.att_static->att_data.att_rfc822_size; 473 size = item->att_data.att_static->att_data.att_rfc822_size;
474 } 474 }
475 } 475 }
476 /* msg is already deleted */ 476 /* msg is already deleted */
477 if (mFlags.testBit(FLAG_DELETED) && m) { 477 if (mFlags.testBit(FLAG_DELETED) && m) {
478 delete m; 478 delete m;
479 m = 0; 479 m = 0;
480 } 480 }
481 if (m) { 481 if (m) {
482 m->setFlags(mFlags); 482 m->setFlags(mFlags);
@@ -515,25 +515,25 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
515 err = mailimap_fetch( m_imap, set, fetchType, &result ); 515 err = mailimap_fetch( m_imap, set, fetchType, &result );
516 mailimap_set_free( set ); 516 mailimap_set_free( set );
517 mailimap_fetch_type_free( fetchType ); 517 mailimap_fetch_type_free( fetchType );
518 518
519 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { 519 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
520 mailimap_msg_att * msg_att; 520 mailimap_msg_att * msg_att;
521 msg_att = (mailimap_msg_att*)current->data; 521 msg_att = (mailimap_msg_att*)current->data;
522 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; 522 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
523 QValueList<int> path; 523 QValueList<int> path;
524 body_desc = item->att_data.att_static->att_data.att_body; 524 body_desc = item->att_data.att_static->att_data.att_body;
525 traverseBody(mail,body_desc,body,0,path); 525 traverseBody(mail,body_desc,body,0,path);
526 } else { 526 } else {
527 qDebug("error fetching body: %s",m_imap->imap_response); 527 odebug << "error fetching body: " << m_imap->imap_response << "" << oendl;
528 } 528 }
529 if (result) mailimap_fetch_list_free(result); 529 if (result) mailimap_fetch_list_free(result);
530 return body; 530 return body;
531} 531}
532 532
533QStringList IMAPwrapper::address_list_to_stringlist(clist*list) 533QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
534{ 534{
535 QStringList l; 535 QStringList l;
536 QString from; 536 QString from;
537 bool named_from; 537 bool named_from;
538 clistcell *current = NULL; 538 clistcell *current = NULL;
539 mailimap_address * current_address=NULL; 539 mailimap_address * current_address=NULL;
@@ -627,25 +627,25 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int
627 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { 627 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
628 msg_att_item = (mailimap_msg_att_item*)clist_content(cur); 628 msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
629 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { 629 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
630 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { 630 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
631 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; 631 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
632 /* detach - we take over the content */ 632 /* detach - we take over the content */
633 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; 633 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
634 res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); 634 res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length);
635 } 635 }
636 } 636 }
637 } 637 }
638 } else { 638 } else {
639 qDebug("error fetching text: %s",m_imap->imap_response); 639 odebug << "error fetching text: " << m_imap->imap_response << "" << oendl;
640 } 640 }
641 if (result) mailimap_fetch_list_free(result); 641 if (result) mailimap_fetch_list_free(result);
642 return res; 642 return res;
643} 643}
644 644
645/* current_recursion is for recursive calls. 645/* current_recursion is for recursive calls.
646 current_count means the position inside the internal loop! */ 646 current_count means the position inside the internal loop! */
647void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, 647void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,
648 int current_recursion,QValueList<int>recList,int current_count) 648 int current_recursion,QValueList<int>recList,int current_count)
649{ 649{
650 if (!body || current_recursion>=10) { 650 if (!body || current_recursion>=10) {
651 return; 651 return;
@@ -654,25 +654,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
654 case MAILIMAP_BODY_1PART: 654 case MAILIMAP_BODY_1PART:
655 { 655 {
656 QValueList<int>countlist = recList; 656 QValueList<int>countlist = recList;
657 countlist.append(current_count); 657 countlist.append(current_count);
658 RecPartP currentPart = new RecPart(); 658 RecPartP currentPart = new RecPart();
659 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; 659 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part;
660 QString id(""); 660 QString id("");
661 currentPart->setPositionlist(countlist); 661 currentPart->setPositionlist(countlist);
662 for (unsigned int j = 0; j < countlist.count();++j) { 662 for (unsigned int j = 0; j < countlist.count();++j) {
663 id+=(j>0?" ":""); 663 id+=(j>0?" ":"");
664 id+=QString("%1").arg(countlist[j]); 664 id+=QString("%1").arg(countlist[j]);
665 } 665 }
666 qDebug("ID = %s",id.latin1()); 666 odebug << "ID = " << id.latin1() << "" << oendl;
667 currentPart->setIdentifier(id); 667 currentPart->setIdentifier(id);
668 fillSinglePart(currentPart,part1); 668 fillSinglePart(currentPart,part1);
669 /* important: Check for is NULL 'cause a body can be empty! 669 /* important: Check for is NULL 'cause a body can be empty!
670 And we put it only into the mail if it is the FIRST part */ 670 And we put it only into the mail if it is the FIRST part */
671 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { 671 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) {
672 QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); 672 QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding());
673 target_body->setDescription(currentPart); 673 target_body->setDescription(currentPart);
674 target_body->setBodytext(body_text); 674 target_body->setBodytext(body_text);
675 if (countlist.count()>1) { 675 if (countlist.count()>1) {
676 target_body->addPart(currentPart); 676 target_body->addPart(currentPart);
677 } 677 }
678 } else { 678 } else {
@@ -695,25 +695,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
695 if (current_body->bd_type==MAILIMAP_BODY_MPART) { 695 if (current_body->bd_type==MAILIMAP_BODY_MPART) {
696 RecPartP targetPart = new RecPart(); 696 RecPartP targetPart = new RecPart();
697 targetPart->setType("multipart"); 697 targetPart->setType("multipart");
698 fillMultiPart(targetPart,mailDescription); 698 fillMultiPart(targetPart,mailDescription);
699 countlist.append(current_count); 699 countlist.append(current_count);
700 targetPart->setPositionlist(countlist); 700 targetPart->setPositionlist(countlist);
701 target_body->addPart(targetPart); 701 target_body->addPart(targetPart);
702 QString id(""); 702 QString id("");
703 for (unsigned int j = 0; j < countlist.count();++j) { 703 for (unsigned int j = 0; j < countlist.count();++j) {
704 id+=(j>0?" ":""); 704 id+=(j>0?" ":"");
705 id+=QString("%1").arg(countlist[j]); 705 id+=QString("%1").arg(countlist[j]);
706 } 706 }
707 qDebug("ID(mpart) = %s",id.latin1()); 707 odebug << "ID(mpart) = " << id.latin1() << "" << oendl;
708 } 708 }
709 traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); 709 traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount);
710 if (current_body->bd_type==MAILIMAP_BODY_MPART) { 710 if (current_body->bd_type==MAILIMAP_BODY_MPART) {
711 countlist = recList; 711 countlist = recList;
712 } 712 }
713 ++ccount; 713 ++ccount;
714 } 714 }
715 } 715 }
716 break; 716 break;
717 default: 717 default:
718 break; 718 break;
719 } 719 }
@@ -739,37 +739,37 @@ void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*D
739 default: 739 default:
740 break; 740 break;
741 } 741 }
742} 742}
743 743
744void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) 744void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which)
745{ 745{
746 if (!which) { 746 if (!which) {
747 return; 747 return;
748 } 748 }
749 QString sub; 749 QString sub;
750 sub = which->bd_media_text; 750 sub = which->bd_media_text;
751 qDebug("Type= text/%s",which->bd_media_text); 751 odebug << "Type= text/" << which->bd_media_text << "" << oendl;
752 target_part->setSubtype(sub.lower()); 752 target_part->setSubtype(sub.lower());
753 target_part->setLines(which->bd_lines); 753 target_part->setLines(which->bd_lines);
754 fillBodyFields(target_part,which->bd_fields); 754 fillBodyFields(target_part,which->bd_fields);
755} 755}
756 756
757void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) 757void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which)
758{ 758{
759 if (!which) { 759 if (!which) {
760 return; 760 return;
761 } 761 }
762 target_part->setSubtype("rfc822"); 762 target_part->setSubtype("rfc822");
763 qDebug("Message part"); 763 odebug << "Message part" << oendl;
764 /* we set this type to text/plain */ 764 /* we set this type to text/plain */
765 target_part->setLines(which->bd_lines); 765 target_part->setLines(which->bd_lines);
766 fillBodyFields(target_part,which->bd_fields); 766 fillBodyFields(target_part,which->bd_fields);
767} 767}
768 768
769void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) 769void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which)
770{ 770{
771 if (!which) return; 771 if (!which) return;
772 QString sub = which->bd_media_subtype; 772 QString sub = which->bd_media_subtype;
773 target_part->setSubtype(sub.lower()); 773 target_part->setSubtype(sub.lower());
774 if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { 774 if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) {
775 clistcell*cur = 0; 775 clistcell*cur = 0;
@@ -810,25 +810,25 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba
810 if (which->bd_media_basic->med_basic_type) { 810 if (which->bd_media_basic->med_basic_type) {
811 type = which->bd_media_basic->med_basic_type; 811 type = which->bd_media_basic->med_basic_type;
812 } else { 812 } else {
813 type = ""; 813 type = "";
814 } 814 }
815 break; 815 break;
816 } 816 }
817 if (which->bd_media_basic->med_subtype) { 817 if (which->bd_media_basic->med_subtype) {
818 sub = which->bd_media_basic->med_subtype; 818 sub = which->bd_media_basic->med_subtype;
819 } else { 819 } else {
820 sub = ""; 820 sub = "";
821 } 821 }
822 qDebug("Type = %s/%s",type.latin1(),sub.latin1()); 822 odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl;
823 target_part->setType(type.lower()); 823 target_part->setType(type.lower());
824 target_part->setSubtype(sub.lower()); 824 target_part->setSubtype(sub.lower());
825 fillBodyFields(target_part,which->bd_fields); 825 fillBodyFields(target_part,which->bd_fields);
826} 826}
827 827
828void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) 828void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which)
829{ 829{
830 if (!which) return; 830 if (!which) return;
831 if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { 831 if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) {
832 clistcell*cur; 832 clistcell*cur;
833 mailimap_single_body_fld_param*param=0; 833 mailimap_single_body_fld_param*param=0;
834 for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { 834 for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) {
@@ -886,34 +886,34 @@ void IMAPwrapper::deleteMail(const RecMailP&mail)
886 if ( err != MAILIMAP_NO_ERROR ) { 886 if ( err != MAILIMAP_NO_ERROR ) {
887 return; 887 return;
888 } 888 }
889 flist = mailimap_flag_list_new_empty(); 889 flist = mailimap_flag_list_new_empty();
890 mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); 890 mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
891 store_flags = mailimap_store_att_flags_new_set_flags(flist); 891 store_flags = mailimap_store_att_flags_new_set_flags(flist);
892 set = mailimap_set_new_single(mail->getNumber()); 892 set = mailimap_set_new_single(mail->getNumber());
893 err = mailimap_store(m_imap,set,store_flags); 893 err = mailimap_store(m_imap,set,store_flags);
894 mailimap_set_free( set ); 894 mailimap_set_free( set );
895 mailimap_store_att_flags_free(store_flags); 895 mailimap_store_att_flags_free(store_flags);
896 896
897 if (err != MAILIMAP_NO_ERROR) { 897 if (err != MAILIMAP_NO_ERROR) {
898 qDebug("error deleting mail: %s",m_imap->imap_response); 898 odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
899 return; 899 return;
900 } 900 }
901 qDebug("deleting mail: %s",m_imap->imap_response); 901 odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
902 /* should we realy do that at this moment? */ 902 /* should we realy do that at this moment? */
903 err = mailimap_expunge(m_imap); 903 err = mailimap_expunge(m_imap);
904 if (err != MAILIMAP_NO_ERROR) { 904 if (err != MAILIMAP_NO_ERROR) {
905 qDebug("error deleting mail: %s",m_imap->imap_response); 905 odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
906 } 906 }
907 qDebug("Delete successfull %s",m_imap->imap_response); 907 odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
908} 908}
909 909
910void IMAPwrapper::answeredMail(const RecMailP&mail) 910void IMAPwrapper::answeredMail(const RecMailP&mail)
911{ 911{
912 mailimap_flag_list*flist; 912 mailimap_flag_list*flist;
913 mailimap_set *set; 913 mailimap_set *set;
914 mailimap_store_att_flags * store_flags; 914 mailimap_store_att_flags * store_flags;
915 int err; 915 int err;
916 login(); 916 login();
917 if (!m_imap) { 917 if (!m_imap) {
918 return; 918 return;
919 } 919 }
@@ -921,25 +921,25 @@ void IMAPwrapper::answeredMail(const RecMailP&mail)
921 if ( err != MAILIMAP_NO_ERROR ) { 921 if ( err != MAILIMAP_NO_ERROR ) {
922 return; 922 return;
923 } 923 }
924 flist = mailimap_flag_list_new_empty(); 924 flist = mailimap_flag_list_new_empty();
925 mailimap_flag_list_add(flist,mailimap_flag_new_answered()); 925 mailimap_flag_list_add(flist,mailimap_flag_new_answered());
926 store_flags = mailimap_store_att_flags_new_add_flags(flist); 926 store_flags = mailimap_store_att_flags_new_add_flags(flist);
927 set = mailimap_set_new_single(mail->getNumber()); 927 set = mailimap_set_new_single(mail->getNumber());
928 err = mailimap_store(m_imap,set,store_flags); 928 err = mailimap_store(m_imap,set,store_flags);
929 mailimap_set_free( set ); 929 mailimap_set_free( set );
930 mailimap_store_att_flags_free(store_flags); 930 mailimap_store_att_flags_free(store_flags);
931 931
932 if (err != MAILIMAP_NO_ERROR) { 932 if (err != MAILIMAP_NO_ERROR) {
933 qDebug("error marking mail: %s",m_imap->imap_response); 933 odebug << "error marking mail: " << m_imap->imap_response << "" << oendl;
934 return; 934 return;
935 } 935 }
936} 936}
937 937
938QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc) 938QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
939{ 939{
940 QString body(""); 940 QString body("");
941 encodedString*res = fetchRawPart(mail,path,internal_call); 941 encodedString*res = fetchRawPart(mail,path,internal_call);
942 encodedString*r = decode_String(res,enc); 942 encodedString*r = decode_String(res,enc);
943 delete res; 943 delete res;
944 if (r) { 944 if (r) {
945 if (r->Length()>0) { 945 if (r->Length()>0) {
@@ -989,57 +989,57 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder)
989 } 989 }
990 flist = mailimap_flag_list_new_empty(); 990 flist = mailimap_flag_list_new_empty();
991 mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); 991 mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
992 store_flags = mailimap_store_att_flags_new_set_flags(flist); 992 store_flags = mailimap_store_att_flags_new_set_flags(flist);
993 set = mailimap_set_new_interval( 1, last ); 993 set = mailimap_set_new_interval( 1, last );
994 err = mailimap_store(m_imap,set,store_flags); 994 err = mailimap_store(m_imap,set,store_flags);
995 mailimap_set_free( set ); 995 mailimap_set_free( set );
996 mailimap_store_att_flags_free(store_flags); 996 mailimap_store_att_flags_free(store_flags);
997 if (err != MAILIMAP_NO_ERROR) { 997 if (err != MAILIMAP_NO_ERROR) {
998 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); 998 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
999 return 0; 999 return 0;
1000 } 1000 }
1001 qDebug("deleting mail: %s",m_imap->imap_response); 1001 odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
1002 /* should we realy do that at this moment? */ 1002 /* should we realy do that at this moment? */
1003 err = mailimap_expunge(m_imap); 1003 err = mailimap_expunge(m_imap);
1004 if (err != MAILIMAP_NO_ERROR) { 1004 if (err != MAILIMAP_NO_ERROR) {
1005 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); 1005 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
1006 return 0; 1006 return 0;
1007 } 1007 }
1008 qDebug("Delete successfull %s",m_imap->imap_response); 1008 odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
1009 return 1; 1009 return 1;
1010} 1010}
1011 1011
1012int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) 1012int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder)
1013{ 1013{
1014 if (folder.length()==0) return 0; 1014 if (folder.length()==0) return 0;
1015 login(); 1015 login();
1016 if (!m_imap) {return 0;} 1016 if (!m_imap) {return 0;}
1017 QString pre = account->getPrefix(); 1017 QString pre = account->getPrefix();
1018 if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { 1018 if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) {
1019 pre+=delemiter; 1019 pre+=delemiter;
1020 } 1020 }
1021 if (parentfolder) { 1021 if (parentfolder) {
1022 pre += parentfolder->getDisplayName()+delemiter; 1022 pre += parentfolder->getDisplayName()+delemiter;
1023 } 1023 }
1024 pre+=folder; 1024 pre+=folder;
1025 if (getsubfolder) { 1025 if (getsubfolder) {
1026 if (delemiter.length()>0) { 1026 if (delemiter.length()>0) {
1027 pre+=delemiter; 1027 pre+=delemiter;
1028 } else { 1028 } else {
1029 Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre)); 1029 Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre));
1030 return 0; 1030 return 0;
1031 } 1031 }
1032 } 1032 }
1033 qDebug("Creating %s",pre.latin1()); 1033 odebug << "Creating " << pre.latin1() << "" << oendl;
1034 int res = mailimap_create(m_imap,pre.latin1()); 1034 int res = mailimap_create(m_imap,pre.latin1());
1035 if (res != MAILIMAP_NO_ERROR) { 1035 if (res != MAILIMAP_NO_ERROR) {
1036 Global::statusMessage(tr("%1").arg(m_imap->imap_response)); 1036 Global::statusMessage(tr("%1").arg(m_imap->imap_response));
1037 return 0; 1037 return 0;
1038 } 1038 }
1039 return 1; 1039 return 1;
1040} 1040}
1041 1041
1042int IMAPwrapper::deleteMbox(const FolderP&folder) 1042int IMAPwrapper::deleteMbox(const FolderP&folder)
1043{ 1043{
1044 if (!folder) return 0; 1044 if (!folder) return 0;
1045 login(); 1045 login();
@@ -1080,108 +1080,108 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
1080 case MAILIMAP_STATUS_ATT_MESSAGES: 1080 case MAILIMAP_STATUS_ATT_MESSAGES:
1081 target_stat.message_count = status_info->st_value; 1081 target_stat.message_count = status_info->st_value;
1082 break; 1082 break;
1083 case MAILIMAP_STATUS_ATT_RECENT: 1083 case MAILIMAP_STATUS_ATT_RECENT:
1084 target_stat.message_recent = status_info->st_value; 1084 target_stat.message_recent = status_info->st_value;
1085 break; 1085 break;
1086 case MAILIMAP_STATUS_ATT_UNSEEN: 1086 case MAILIMAP_STATUS_ATT_UNSEEN:
1087 target_stat.message_unseen = status_info->st_value; 1087 target_stat.message_unseen = status_info->st_value;
1088 break; 1088 break;
1089 } 1089 }
1090 } 1090 }
1091 } else { 1091 } else {
1092 qDebug("Error retrieving status"); 1092 odebug << "Error retrieving status" << oendl;
1093 } 1093 }
1094 if (status) mailimap_mailbox_data_status_free(status); 1094 if (status) mailimap_mailbox_data_status_free(status);
1095 if (att_list) mailimap_status_att_list_free(att_list); 1095 if (att_list) mailimap_status_att_list_free(att_list);
1096} 1096}
1097 1097
1098void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) 1098void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
1099{ 1099{
1100 login(); 1100 login();
1101 if (!m_imap) return; 1101 if (!m_imap) return;
1102 if (!msg) return; 1102 if (!msg) return;
1103 int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); 1103 int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length);
1104 if (r != MAILIMAP_NO_ERROR) { 1104 if (r != MAILIMAP_NO_ERROR) {
1105 Global::statusMessage("Error storing mail!"); 1105 Global::statusMessage("Error storing mail!");
1106 } 1106 }
1107} 1107}
1108 1108
1109MAILLIB::ATYPE IMAPwrapper::getType()const 1109MAILLIB::ATYPE IMAPwrapper::getType()const
1110{ 1110{
1111 return account->getType(); 1111 return account->getType();
1112} 1112}
1113 1113
1114const QString&IMAPwrapper::getName()const 1114const QString&IMAPwrapper::getName()const
1115{ 1115{
1116 qDebug("Get name: %s",account->getAccountName().latin1()); 1116 odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl;
1117 return account->getAccountName(); 1117 return account->getAccountName();
1118} 1118}
1119 1119
1120encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) 1120encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail)
1121{ 1121{
1122 // dummy 1122 // dummy
1123 QValueList<int> path; 1123 QValueList<int> path;
1124 return fetchRawPart(mail,path,false); 1124 return fetchRawPart(mail,path,false);
1125} 1125}
1126 1126
1127void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, 1127void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
1128 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 1128 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
1129{ 1129{
1130 if (targetWrapper != this) { 1130 if (targetWrapper != this) {
1131 AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); 1131 AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
1132 qDebug("Using generic"); 1132 odebug << "Using generic" << oendl;
1133 return; 1133 return;
1134 } 1134 }
1135 mailimap_set *set = 0; 1135 mailimap_set *set = 0;
1136 login(); 1136 login();
1137 if (!m_imap) { 1137 if (!m_imap) {
1138 return; 1138 return;
1139 } 1139 }
1140 int err = selectMbox(fromFolder->getName()); 1140 int err = selectMbox(fromFolder->getName());
1141 if ( err != MAILIMAP_NO_ERROR ) { 1141 if ( err != MAILIMAP_NO_ERROR ) {
1142 return; 1142 return;
1143 } 1143 }
1144 int last = m_imap->imap_selection_info->sel_exists; 1144 int last = m_imap->imap_selection_info->sel_exists;
1145 set = mailimap_set_new_interval( 1, last ); 1145 set = mailimap_set_new_interval( 1, last );
1146 err = mailimap_copy(m_imap,set,targetFolder.latin1()); 1146 err = mailimap_copy(m_imap,set,targetFolder.latin1());
1147 mailimap_set_free( set ); 1147 mailimap_set_free( set );
1148 if ( err != MAILIMAP_NO_ERROR ) { 1148 if ( err != MAILIMAP_NO_ERROR ) {
1149 QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response); 1149 QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response);
1150 Global::statusMessage(error_msg); 1150 Global::statusMessage(error_msg);
1151 qDebug(error_msg); 1151 odebug << error_msg << oendl;
1152 return; 1152 return;
1153 } 1153 }
1154 if (moveit) { 1154 if (moveit) {
1155 deleteAllMail(fromFolder); 1155 deleteAllMail(fromFolder);
1156 } 1156 }
1157} 1157}
1158 1158
1159void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 1159void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
1160{ 1160{
1161 if (targetWrapper != this) { 1161 if (targetWrapper != this) {
1162 qDebug("Using generic"); 1162 odebug << "Using generic" << oendl;
1163 AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); 1163 AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit);
1164 return; 1164 return;
1165 } 1165 }
1166 mailimap_set *set = 0; 1166 mailimap_set *set = 0;
1167 login(); 1167 login();
1168 if (!m_imap) { 1168 if (!m_imap) {
1169 return; 1169 return;
1170 } 1170 }
1171 int err = selectMbox(mail->getMbox()); 1171 int err = selectMbox(mail->getMbox());
1172 if ( err != MAILIMAP_NO_ERROR ) { 1172 if ( err != MAILIMAP_NO_ERROR ) {
1173 return; 1173 return;
1174 } 1174 }
1175 set = mailimap_set_new_single(mail->getNumber()); 1175 set = mailimap_set_new_single(mail->getNumber());
1176 err = mailimap_copy(m_imap,set,targetFolder.latin1()); 1176 err = mailimap_copy(m_imap,set,targetFolder.latin1());
1177 mailimap_set_free( set ); 1177 mailimap_set_free( set );
1178 if ( err != MAILIMAP_NO_ERROR ) { 1178 if ( err != MAILIMAP_NO_ERROR ) {
1179 QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); 1179 QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response);
1180 Global::statusMessage(error_msg); 1180 Global::statusMessage(error_msg);
1181 qDebug(error_msg); 1181 odebug << error_msg << oendl;
1182 return; 1182 return;
1183 } 1183 }
1184 if (moveit) { 1184 if (moveit) {
1185 deleteMail(mail); 1185 deleteMail(mail);
1186 } 1186 }
1187} 1187}
diff --git a/noncore/net/mail/libmailwrapper/logindialog.cpp b/noncore/net/mail/libmailwrapper/logindialog.cpp
index 01d177e..c9ae190 100644
--- a/noncore/net/mail/libmailwrapper/logindialog.cpp
+++ b/noncore/net/mail/libmailwrapper/logindialog.cpp
@@ -15,15 +15,15 @@ LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent,
15 } else { 15 } else {
16 passLine->setFocus(); 16 passLine->setFocus();
17 } 17 }
18} 18}
19 19
20void LoginDialog::accept() 20void LoginDialog::accept()
21{ 21{
22 //_user.replace( 0, _user.length(), userLine->text() ); 22 //_user.replace( 0, _user.length(), userLine->text() );
23 //_pass.replace( 0, _pass.length(), passLine->text() ); 23 //_pass.replace( 0, _pass.length(), passLine->text() );
24 _user = userLine->text(); 24 _user = userLine->text();
25 _pass = passLine->text(); 25 _pass = passLine->text();
26 26
27 qDebug("User im accept: |%s|",_user.latin1()); 27 odebug << "User im accept: |" << _user.latin1() << "|" << oendl;
28 QDialog::accept(); 28 QDialog::accept();
29} 29}
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp
index 90b8865..6d44db4 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.cpp
+++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp
@@ -4,25 +4,25 @@
4using namespace Opie::Core; 4using namespace Opie::Core;
5RecMail::RecMail() 5RecMail::RecMail()
6 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) 6 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7)
7{ 7{
8 init(); 8 init();
9} 9}
10 10
11RecMail::RecMail(const RecMail&old) 11RecMail::RecMail(const RecMail&old)
12 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) 12 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7)
13{ 13{
14 init(); 14 init();
15 copy_old(old); 15 copy_old(old);
16 qDebug("Copy constructor RecMail"); 16 odebug << "Copy constructor RecMail" << oendl;
17} 17}
18 18
19RecMail::~RecMail() 19RecMail::~RecMail()
20{ 20{
21 wrapper = 0; 21 wrapper = 0;
22} 22}
23 23
24void RecMail::copy_old(const RecMail&old) 24void RecMail::copy_old(const RecMail&old)
25{ 25{
26 subject = old.subject; 26 subject = old.subject;
27 date = old.date; 27 date = old.date;
28 mbox = old.mbox; 28 mbox = old.mbox;
@@ -122,25 +122,25 @@ RecPart::RecPart(const RecPart&old)
122 : Opie::Core::ORefCount(), 122 : Opie::Core::ORefCount(),
123 m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) 123 m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
124{ 124{
125 m_type = old.m_type; 125 m_type = old.m_type;
126 m_subtype = old.m_subtype; 126 m_subtype = old.m_subtype;
127 m_identifier = old.m_identifier; 127 m_identifier = old.m_identifier;
128 m_encoding = old.m_encoding; 128 m_encoding = old.m_encoding;
129 m_description = old.m_description; 129 m_description = old.m_description;
130 m_lines = old.m_lines; 130 m_lines = old.m_lines;
131 m_size = old.m_size; 131 m_size = old.m_size;
132 m_Parameters = old.m_Parameters; 132 m_Parameters = old.m_Parameters;
133 m_poslist = old.m_poslist; 133 m_poslist = old.m_poslist;
134 qDebug("RecPart copy constructor"); 134 odebug << "RecPart copy constructor" << oendl;
135} 135}
136 136
137RecPart::~RecPart() 137RecPart::~RecPart()
138{ 138{
139} 139}
140 140
141void RecPart::setSize(unsigned int size) 141void RecPart::setSize(unsigned int size)
142{ 142{
143 m_size = size; 143 m_size = size;
144} 144}
145 145
146const unsigned int RecPart::Size()const 146const unsigned int RecPart::Size()const
@@ -246,25 +246,25 @@ const QValueList<int>& RecPart::Positionlist()const
246RecBody::RecBody() 246RecBody::RecBody()
247 : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) 247 : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart())
248{ 248{
249 m_PartsList.clear(); 249 m_PartsList.clear();
250} 250}
251 251
252RecBody::RecBody(const RecBody&old) 252RecBody::RecBody(const RecBody&old)
253 :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) 253 :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart())
254{ 254{
255 m_BodyText = old.m_BodyText; 255 m_BodyText = old.m_BodyText;
256 m_PartsList = old.m_PartsList; 256 m_PartsList = old.m_PartsList;
257 m_description = old.m_description; 257 m_description = old.m_description;
258 qDebug("Recbody copy constructor"); 258 odebug << "Recbody copy constructor" << oendl;
259} 259}
260 260
261RecBody::~RecBody() 261RecBody::~RecBody()
262{ 262{
263} 263}
264 264
265void RecBody::setBodytext(const QString&bodyText) 265void RecBody::setBodytext(const QString&bodyText)
266{ 266{
267 m_BodyText = bodyText; 267 m_BodyText = bodyText;
268} 268}
269 269
270const QString& RecBody::Bodytext()const 270const QString& RecBody::Bodytext()const
@@ -311,32 +311,32 @@ encodedString::encodedString(const char*nContent,unsigned int nSize)
311} 311}
312 312
313encodedString::encodedString(char*nContent,unsigned int nSize) 313encodedString::encodedString(char*nContent,unsigned int nSize)
314{ 314{
315 init(); 315 init();
316 setContent(nContent,nSize); 316 setContent(nContent,nSize);
317} 317}
318 318
319encodedString::encodedString(const encodedString&old) 319encodedString::encodedString(const encodedString&old)
320{ 320{
321 init(); 321 init();
322 copy_old(old); 322 copy_old(old);
323 qDebug("encodedeString: copy constructor!"); 323 odebug << "encodedeString: copy constructor!" << oendl;
324} 324}
325 325
326encodedString& encodedString::operator=(const encodedString&old) 326encodedString& encodedString::operator=(const encodedString&old)
327{ 327{
328 init(); 328 init();
329 copy_old(old); 329 copy_old(old);
330 qDebug("encodedString: assign operator!"); 330 odebug << "encodedString: assign operator!" << oendl;
331 return *this; 331 return *this;
332} 332}
333 333
334encodedString::~encodedString() 334encodedString::~encodedString()
335{ 335{
336 clean(); 336 clean();
337} 337}
338 338
339void encodedString::init() 339void encodedString::init()
340{ 340{
341 content = 0; 341 content = 0;
342 size = 0; 342 size = 0;
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
index eddc0b9..2b0d112 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
@@ -42,25 +42,25 @@ Folder::~Folder()
42 42
43const QString& Folder::Separator()const 43const QString& Folder::Separator()const
44{ 44{
45 return separator; 45 return separator;
46} 46}
47 47
48IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) 48IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix )
49 : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) 49 : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf)
50{ 50{
51 // Decode IMAP foldername 51 // Decode IMAP foldername
52 nameDisplay = IMAPFolder::decodeFolderName( name ); 52 nameDisplay = IMAPFolder::decodeFolderName( name );
53 /* 53 /*
54 qDebug( "folder " + name + " - displayed as " + nameDisplay ); 54 odebug << "folder " + name + " - displayed as " + nameDisplay << oendl;
55 */ 55 */
56 prefix = aprefix; 56 prefix = aprefix;
57 57
58 if (prefix.length()>0) { 58 if (prefix.length()>0) {
59 if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { 59 if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) {
60 nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); 60 nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length());
61 } 61 }
62 } 62 }
63} 63}
64 64
65IMAPFolder::~IMAPFolder() 65IMAPFolder::~IMAPFolder()
66{ 66{
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
index e3c75f3..df2112f 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
@@ -22,25 +22,25 @@ MBOXwrapper::~MBOXwrapper()
22 22
23void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target ) 23void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target )
24{ 24{
25 mailstorage*storage = mailstorage_new(NULL); 25 mailstorage*storage = mailstorage_new(NULL);
26 QString p = MBOXPath+"/"; 26 QString p = MBOXPath+"/";
27 p+=mailbox; 27 p+=mailbox;
28 28
29 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 29 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
30 mailfolder*folder; 30 mailfolder*folder;
31 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 31 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
32 r = mailfolder_connect(folder); 32 r = mailfolder_connect(folder);
33 if (r != MAIL_NO_ERROR) { 33 if (r != MAIL_NO_ERROR) {
34 qDebug("Error initializing mbox"); 34 odebug << "Error initializing mbox" << oendl;
35 mailfolder_free(folder); 35 mailfolder_free(folder);
36 mailstorage_free(storage); 36 mailstorage_free(storage);
37 return; 37 return;
38 } 38 }
39 39
40 parseList(target,folder->fld_session,mailbox); 40 parseList(target,folder->fld_session,mailbox);
41 41
42 mailfolder_disconnect(folder); 42 mailfolder_disconnect(folder);
43 mailfolder_free(folder); 43 mailfolder_free(folder);
44 mailstorage_free(storage); 44 mailstorage_free(storage);
45 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); 45 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
46} 46}
@@ -61,87 +61,87 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders()
61} 61}
62 62
63void MBOXwrapper::deleteMail(const RecMailP & mail) 63void MBOXwrapper::deleteMail(const RecMailP & mail)
64{ 64{
65 mailstorage*storage = mailstorage_new(NULL); 65 mailstorage*storage = mailstorage_new(NULL);
66 QString p = MBOXPath+"/"; 66 QString p = MBOXPath+"/";
67 p+=mail->getMbox(); 67 p+=mail->getMbox();
68 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 68 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
69 mailfolder*folder; 69 mailfolder*folder;
70 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 70 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
71 r = mailfolder_connect(folder); 71 r = mailfolder_connect(folder);
72 if (r != MAIL_NO_ERROR) { 72 if (r != MAIL_NO_ERROR) {
73 qDebug("Error initializing mbox"); 73 odebug << "Error initializing mbox" << oendl;
74 mailfolder_free(folder); 74 mailfolder_free(folder);
75 mailstorage_free(storage); 75 mailstorage_free(storage);
76 return; 76 return;
77 } 77 }
78 r = mailsession_remove_message(folder->fld_session,mail->getNumber()); 78 r = mailsession_remove_message(folder->fld_session,mail->getNumber());
79 if (r != MAIL_NO_ERROR) { 79 if (r != MAIL_NO_ERROR) {
80 qDebug("error deleting mail"); 80 odebug << "error deleting mail" << oendl;
81 } 81 }
82 mailfolder_free(folder); 82 mailfolder_free(folder);
83 mailstorage_free(storage); 83 mailstorage_free(storage);
84} 84}
85 85
86void MBOXwrapper::answeredMail(const RecMailP&) 86void MBOXwrapper::answeredMail(const RecMailP&)
87{ 87{
88} 88}
89 89
90RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail ) 90RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail )
91{ 91{
92 RecBodyP body = new RecBody(); 92 RecBodyP body = new RecBody();
93 mailstorage*storage = mailstorage_new(NULL); 93 mailstorage*storage = mailstorage_new(NULL);
94 QString p = MBOXPath+"/"; 94 QString p = MBOXPath+"/";
95 p+=mail->getMbox(); 95 p+=mail->getMbox();
96 mailmessage * msg; 96 mailmessage * msg;
97 char*data=0; 97 char*data=0;
98 size_t size; 98 size_t size;
99 99
100 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 100 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
101 mailfolder*folder; 101 mailfolder*folder;
102 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 102 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
103 r = mailfolder_connect(folder); 103 r = mailfolder_connect(folder);
104 if (r != MAIL_NO_ERROR) { 104 if (r != MAIL_NO_ERROR) {
105 qDebug("Error initializing mbox"); 105 odebug << "Error initializing mbox" << oendl;
106 mailfolder_free(folder); 106 mailfolder_free(folder);
107 mailstorage_free(storage); 107 mailstorage_free(storage);
108 return body; 108 return body;
109 } 109 }
110 r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg); 110 r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg);
111 if (r != MAIL_NO_ERROR) { 111 if (r != MAIL_NO_ERROR) {
112 qDebug("Error fetching mail %i",mail->getNumber()); 112 odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
113 mailfolder_free(folder); 113 mailfolder_free(folder);
114 mailstorage_free(storage); 114 mailstorage_free(storage);
115 return body; 115 return body;
116 } 116 }
117 r = mailmessage_fetch(msg,&data,&size); 117 r = mailmessage_fetch(msg,&data,&size);
118 if (r != MAIL_NO_ERROR) { 118 if (r != MAIL_NO_ERROR) {
119 qDebug("Error fetching mail %i",mail->getNumber()); 119 odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
120 mailfolder_free(folder); 120 mailfolder_free(folder);
121 mailstorage_free(storage); 121 mailstorage_free(storage);
122 mailmessage_free(msg); 122 mailmessage_free(msg);
123 return body; 123 return body;
124 } 124 }
125 body = parseMail(msg); 125 body = parseMail(msg);
126 mailmessage_fetch_result_free(msg,data); 126 mailmessage_fetch_result_free(msg,data);
127 mailfolder_free(folder); 127 mailfolder_free(folder);
128 mailstorage_free(storage); 128 mailstorage_free(storage);
129 129
130 return body; 130 return body;
131} 131}
132 132
133void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) 133void MBOXwrapper::mbox_progress( size_t current, size_t maximum )
134{ 134{
135 qDebug("MBOX %i von %i",current,maximum); 135 odebug << "MBOX " << current << " von " << maximum << "" << oendl;
136} 136}
137 137
138int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool ) 138int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool )
139{ 139{
140 QString p = MBOXPath+"/"; 140 QString p = MBOXPath+"/";
141 p+=folder; 141 p+=folder;
142 QFileInfo fi(p); 142 QFileInfo fi(p);
143 if (fi.exists()) { 143 if (fi.exists()) {
144 Global::statusMessage(tr("Mailbox exists.")); 144 Global::statusMessage(tr("Mailbox exists."));
145 return 0; 145 return 0;
146 } 146 }
147 mailmbox_folder*f = 0; 147 mailmbox_folder*f = 0;
@@ -211,45 +211,45 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail)
211 mailstorage_free(storage); 211 mailstorage_free(storage);
212 mailmessage_free(msg); 212 mailmessage_free(msg);
213 return result; 213 return result;
214} 214}
215 215
216void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) 216void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
217{ 217{
218 QString p = MBOXPath+"/"; 218 QString p = MBOXPath+"/";
219 p+=mailbox; 219 p+=mailbox;
220 mailmbox_folder*f = 0; 220 mailmbox_folder*f = 0;
221 int r = mailmbox_init(p.latin1(),0,1,0,&f); 221 int r = mailmbox_init(p.latin1(),0,1,0,&f);
222 if (r != MAIL_NO_ERROR) { 222 if (r != MAIL_NO_ERROR) {
223 qDebug("Error init folder"); 223 odebug << "Error init folder" << oendl;
224 return; 224 return;
225 } 225 }
226 deleteMails(f,target); 226 deleteMails(f,target);
227 mailmbox_done(f); 227 mailmbox_done(f);
228} 228}
229 229
230void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target) 230void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target)
231{ 231{
232 if (!f) return; 232 if (!f) return;
233 int r; 233 int r;
234 QValueList<RecMailP>::ConstIterator it; 234 QValueList<RecMailP>::ConstIterator it;
235 for (it=target.begin(); it != target.end();++it) { 235 for (it=target.begin(); it != target.end();++it) {
236 r = mailmbox_delete_msg(f,(*it)->getNumber()); 236 r = mailmbox_delete_msg(f,(*it)->getNumber());
237 if (r!=MAILMBOX_NO_ERROR) { 237 if (r!=MAILMBOX_NO_ERROR) {
238 qDebug("error delete mail"); 238 odebug << "error delete mail" << oendl;
239 } 239 }
240 } 240 }
241 r = mailmbox_expunge(f); 241 r = mailmbox_expunge(f);
242 if (r != MAILMBOX_NO_ERROR) { 242 if (r != MAILMBOX_NO_ERROR) {
243 qDebug("error expunge mailbox"); 243 odebug << "error expunge mailbox" << oendl;
244 } 244 }
245} 245}
246 246
247int MBOXwrapper::deleteAllMail(const FolderP&tfolder) 247int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
248{ 248{
249 if (!tfolder) return 0; 249 if (!tfolder) return 0;
250 QString p = MBOXPath+"/"+tfolder->getDisplayName(); 250 QString p = MBOXPath+"/"+tfolder->getDisplayName();
251 int res = 1; 251 int res = 1;
252 252
253 mailfolder*folder = 0; 253 mailfolder*folder = 0;
254 mailmessage_list*l=0; 254 mailmessage_list*l=0;
255 mailstorage*storage = mailstorage_new(NULL); 255 mailstorage*storage = mailstorage_new(NULL);
@@ -260,25 +260,25 @@ int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
260 } 260 }
261 if (res) { 261 if (res) {
262 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 262 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
263 r = mailfolder_connect(folder); 263 r = mailfolder_connect(folder);
264 if (r != MAIL_NO_ERROR) { 264 if (r != MAIL_NO_ERROR) {
265 Global::statusMessage(tr("Error initializing mbox")); 265 Global::statusMessage(tr("Error initializing mbox"));
266 res = 0; 266 res = 0;
267 } 267 }
268 } 268 }
269 if (res) { 269 if (res) {
270 r = mailsession_get_messages_list(folder->fld_session,&l); 270 r = mailsession_get_messages_list(folder->fld_session,&l);
271 if (r != MAIL_NO_ERROR) { 271 if (r != MAIL_NO_ERROR) {
272 qDebug("Error message list"); 272 odebug << "Error message list" << oendl;
273 res=0; 273 res=0;
274 } 274 }
275 } 275 }
276 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { 276 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
277 r = mailsession_remove_message(folder->fld_session,i+1); 277 r = mailsession_remove_message(folder->fld_session,i+1);
278 if (r != MAIL_NO_ERROR) { 278 if (r != MAIL_NO_ERROR) {
279 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 279 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
280 res = 0; 280 res = 0;
281 break; 281 break;
282 } 282 }
283 } 283 }
284 if (l) mailmessage_list_free(l); 284 if (l) mailmessage_list_free(l);
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index 12472e9..cd7cecb 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
@@ -7,50 +7,50 @@
7#include <stdlib.h> 7#include <stdlib.h>
8#include <qpe/global.h> 8#include <qpe/global.h>
9#include <opie2/oprocess.h> 9#include <opie2/oprocess.h>
10 10
11using namespace Opie::Core; 11using namespace Opie::Core;
12MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) 12MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
13 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) 13 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
14{ 14{
15 if (MHPath.length()>0) { 15 if (MHPath.length()>0) {
16 if (MHPath[MHPath.length()-1]=='/') { 16 if (MHPath[MHPath.length()-1]=='/') {
17 MHPath=MHPath.left(MHPath.length()-1); 17 MHPath=MHPath.left(MHPath.length()-1);
18 } 18 }
19 qDebug(MHPath); 19 odebug << MHPath << oendl;
20 QDir dir(MHPath); 20 QDir dir(MHPath);
21 if (!dir.exists()) { 21 if (!dir.exists()) {
22 dir.mkdir(MHPath); 22 dir.mkdir(MHPath);
23 } 23 }
24 init_storage(); 24 init_storage();
25 } 25 }
26} 26}
27 27
28void MHwrapper::init_storage() 28void MHwrapper::init_storage()
29{ 29{
30 int r; 30 int r;
31 QString pre = MHPath; 31 QString pre = MHPath;
32 if (!m_storage) { 32 if (!m_storage) {
33 m_storage = mailstorage_new(NULL); 33 m_storage = mailstorage_new(NULL);
34 r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); 34 r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0);
35 if (r != MAIL_NO_ERROR) { 35 if (r != MAIL_NO_ERROR) {
36 qDebug("error initializing storage"); 36 odebug << "error initializing storage" << oendl;
37 mailstorage_free(m_storage); 37 mailstorage_free(m_storage);
38 m_storage = 0; 38 m_storage = 0;
39 return; 39 return;
40 } 40 }
41 } 41 }
42 r = mailstorage_connect(m_storage); 42 r = mailstorage_connect(m_storage);
43 if (r!=MAIL_NO_ERROR) { 43 if (r!=MAIL_NO_ERROR) {
44 qDebug("error connecting storage"); 44 odebug << "error connecting storage" << oendl;
45 mailstorage_free(m_storage); 45 mailstorage_free(m_storage);
46 m_storage = 0; 46 m_storage = 0;
47 } 47 }
48} 48}
49 49
50void MHwrapper::clean_storage() 50void MHwrapper::clean_storage()
51{ 51{
52 if (m_storage) { 52 if (m_storage) {
53 mailstorage_disconnect(m_storage); 53 mailstorage_disconnect(m_storage);
54 mailstorage_free(m_storage); 54 mailstorage_free(m_storage);
55 m_storage = 0; 55 m_storage = 0;
56 } 56 }
@@ -61,105 +61,105 @@ MHwrapper::~MHwrapper()
61 clean_storage(); 61 clean_storage();
62} 62}
63 63
64void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) 64void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target )
65{ 65{
66 init_storage(); 66 init_storage();
67 if (!m_storage) { 67 if (!m_storage) {
68 return; 68 return;
69 } 69 }
70 QString f = buildPath(mailbox); 70 QString f = buildPath(mailbox);
71 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 71 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
72 if (r!=MAIL_NO_ERROR) { 72 if (r!=MAIL_NO_ERROR) {
73 qDebug("listMessages: error selecting folder!"); 73 odebug << "listMessages: error selecting folder!" << oendl;
74 return; 74 return;
75 } 75 }
76 parseList(target,m_storage->sto_session,f); 76 parseList(target,m_storage->sto_session,f);
77 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); 77 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
78} 78}
79 79
80QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() 80QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
81{ 81{
82 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); 82 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
83 /* this is needed! */ 83 /* this is needed! */
84 if (m_storage) mailstorage_disconnect(m_storage); 84 if (m_storage) mailstorage_disconnect(m_storage);
85 init_storage(); 85 init_storage();
86 if (!m_storage) { 86 if (!m_storage) {
87 return folders; 87 return folders;
88 } 88 }
89 mail_list*flist = 0; 89 mail_list*flist = 0;
90 clistcell*current=0; 90 clistcell*current=0;
91 int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); 91 int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist);
92 if (r != MAIL_NO_ERROR || !flist) { 92 if (r != MAIL_NO_ERROR || !flist) {
93 qDebug("error getting folder list"); 93 odebug << "error getting folder list" << oendl;
94 return folders; 94 return folders;
95 } 95 }
96 for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) { 96 for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) {
97 QString t = (char*)current->data; 97 QString t = (char*)current->data;
98 t.replace(0,MHPath.length(),""); 98 t.replace(0,MHPath.length(),"");
99 folders->append(new MHFolder(t,MHPath)); 99 folders->append(new MHFolder(t,MHPath));
100 } 100 }
101 mail_list_free(flist); 101 mail_list_free(flist);
102 return folders; 102 return folders;
103} 103}
104 104
105void MHwrapper::deleteMail(const RecMailP&mail) 105void MHwrapper::deleteMail(const RecMailP&mail)
106{ 106{
107 init_storage(); 107 init_storage();
108 if (!m_storage) { 108 if (!m_storage) {
109 return; 109 return;
110 } 110 }
111 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 111 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
112 if (r!=MAIL_NO_ERROR) { 112 if (r!=MAIL_NO_ERROR) {
113 qDebug("error selecting folder!"); 113 odebug << "error selecting folder!" << oendl;
114 return; 114 return;
115 } 115 }
116 r = mailsession_remove_message(m_storage->sto_session,mail->getNumber()); 116 r = mailsession_remove_message(m_storage->sto_session,mail->getNumber());
117 if (r != MAIL_NO_ERROR) { 117 if (r != MAIL_NO_ERROR) {
118 qDebug("error deleting mail"); 118 odebug << "error deleting mail" << oendl;
119 } 119 }
120} 120}
121 121
122void MHwrapper::answeredMail(const RecMailP&) 122void MHwrapper::answeredMail(const RecMailP&)
123{ 123{
124} 124}
125 125
126RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) 126RecBodyP MHwrapper::fetchBody( const RecMailP &mail )
127{ 127{
128 RecBodyP body = new RecBody(); 128 RecBodyP body = new RecBody();
129 init_storage(); 129 init_storage();
130 if (!m_storage) { 130 if (!m_storage) {
131 return body; 131 return body;
132 } 132 }
133 mailmessage * msg; 133 mailmessage * msg;
134 char*data=0; 134 char*data=0;
135 135
136 /* mail should hold the complete path! */ 136 /* mail should hold the complete path! */
137 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 137 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
138 if (r != MAIL_NO_ERROR) { 138 if (r != MAIL_NO_ERROR) {
139 return body; 139 return body;
140 } 140 }
141 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); 141 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
142 if (r != MAIL_NO_ERROR) { 142 if (r != MAIL_NO_ERROR) {
143 qDebug("Error fetching mail %i",mail->getNumber()); 143 odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
144 return body; 144 return body;
145 } 145 }
146 body = parseMail(msg); 146 body = parseMail(msg);
147 mailmessage_fetch_result_free(msg,data); 147 mailmessage_fetch_result_free(msg,data);
148 return body; 148 return body;
149} 149}
150 150
151void MHwrapper::mbox_progress( size_t current, size_t maximum ) 151void MHwrapper::mbox_progress( size_t current, size_t maximum )
152{ 152{
153 qDebug("MH %i von %i",current,maximum); 153 odebug << "MH " << current << " von " << maximum << "" << oendl;
154} 154}
155 155
156QString MHwrapper::buildPath(const QString&p) 156QString MHwrapper::buildPath(const QString&p)
157{ 157{
158 QString f=""; 158 QString f="";
159 if (p.length()==0||p=="/") 159 if (p.length()==0||p=="/")
160 return MHPath; 160 return MHPath;
161 if (!p.startsWith(MHPath)) { 161 if (!p.startsWith(MHPath)) {
162 f+=MHPath; 162 f+=MHPath;
163 } 163 }
164 if (!p.startsWith("/")) { 164 if (!p.startsWith("/")) {
165 f+="/"; 165 f+="/";
@@ -174,119 +174,119 @@ int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QStri
174 if (!m_storage) { 174 if (!m_storage) {
175 return 0; 175 return 0;
176 } 176 }
177 QString f; 177 QString f;
178 if (!pfolder) { 178 if (!pfolder) {
179 // toplevel folder 179 // toplevel folder
180 f = buildPath(folder); 180 f = buildPath(folder);
181 } else { 181 } else {
182 f = pfolder->getName(); 182 f = pfolder->getName();
183 f+="/"; 183 f+="/";
184 f+=folder; 184 f+=folder;
185 } 185 }
186 qDebug(f); 186 odebug << f << oendl;
187 int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); 187 int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1());
188 if (r != MAIL_NO_ERROR) { 188 if (r != MAIL_NO_ERROR) {
189 qDebug("error creating folder %i",r); 189 odebug << "error creating folder " << r << "" << oendl;
190 return 0; 190 return 0;
191 } 191 }
192 qDebug("Folder created"); 192 odebug << "Folder created" << oendl;
193 return 1; 193 return 1;
194} 194}
195 195
196void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) 196void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
197{ 197{
198 init_storage(); 198 init_storage();
199 if (!m_storage) { 199 if (!m_storage) {
200 return; 200 return;
201 } 201 }
202 QString f = buildPath(Folder); 202 QString f = buildPath(Folder);
203 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 203 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
204 if (r!=MAIL_NO_ERROR) { 204 if (r!=MAIL_NO_ERROR) {
205 qDebug("error selecting folder!"); 205 odebug << "error selecting folder!" << oendl;
206 return; 206 return;
207 } 207 }
208 r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); 208 r = mailsession_append_message(m_storage->sto_session,(char*)msg,length);
209 if (r!=MAIL_NO_ERROR) { 209 if (r!=MAIL_NO_ERROR) {
210 qDebug("error storing mail"); 210 odebug << "error storing mail" << oendl;
211 } 211 }
212 return; 212 return;
213} 213}
214 214
215encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) 215encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
216{ 216{
217 encodedString*result = 0; 217 encodedString*result = 0;
218 init_storage(); 218 init_storage();
219 if (!m_storage) { 219 if (!m_storage) {
220 return result; 220 return result;
221 } 221 }
222 mailmessage * msg = 0; 222 mailmessage * msg = 0;
223 char*data=0; 223 char*data=0;
224 size_t size; 224 size_t size;
225 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 225 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
226 if (r!=MAIL_NO_ERROR) { 226 if (r!=MAIL_NO_ERROR) {
227 qDebug("error selecting folder!"); 227 odebug << "error selecting folder!" << oendl;
228 return result; 228 return result;
229 } 229 }
230 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); 230 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
231 if (r != MAIL_NO_ERROR) { 231 if (r != MAIL_NO_ERROR) {
232 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 232 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
233 return 0; 233 return 0;
234 } 234 }
235 r = mailmessage_fetch(msg,&data,&size); 235 r = mailmessage_fetch(msg,&data,&size);
236 if (r != MAIL_NO_ERROR) { 236 if (r != MAIL_NO_ERROR) {
237 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 237 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
238 if (msg) mailmessage_free(msg); 238 if (msg) mailmessage_free(msg);
239 return 0; 239 return 0;
240 } 240 }
241 result = new encodedString(data,size); 241 result = new encodedString(data,size);
242 if (msg) mailmessage_free(msg); 242 if (msg) mailmessage_free(msg);
243 return result; 243 return result;
244} 244}
245 245
246void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) 246void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
247{ 247{
248 QString f = buildPath(mailbox); 248 QString f = buildPath(mailbox);
249 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 249 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
250 if (r!=MAIL_NO_ERROR) { 250 if (r!=MAIL_NO_ERROR) {
251 qDebug("deleteMails: error selecting folder!"); 251 odebug << "deleteMails: error selecting folder!" << oendl;
252 return; 252 return;
253 } 253 }
254 QValueList<RecMailP>::ConstIterator it; 254 QValueList<RecMailP>::ConstIterator it;
255 for (it=target.begin(); it!=target.end();++it) { 255 for (it=target.begin(); it!=target.end();++it) {
256 r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); 256 r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
257 if (r != MAIL_NO_ERROR) { 257 if (r != MAIL_NO_ERROR) {
258 qDebug("error deleting mail"); 258 odebug << "error deleting mail" << oendl;
259 break; 259 break;
260 } 260 }
261 } 261 }
262} 262}
263 263
264int MHwrapper::deleteAllMail(const FolderP&tfolder) 264int MHwrapper::deleteAllMail(const FolderP&tfolder)
265{ 265{
266 init_storage(); 266 init_storage();
267 if (!m_storage) { 267 if (!m_storage) {
268 return 0; 268 return 0;
269 } 269 }
270 int res = 1; 270 int res = 1;
271 if (!tfolder) return 0; 271 if (!tfolder) return 0;
272 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 272 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
273 if (r!=MAIL_NO_ERROR) { 273 if (r!=MAIL_NO_ERROR) {
274 qDebug("error selecting folder!"); 274 odebug << "error selecting folder!" << oendl;
275 return 0; 275 return 0;
276 } 276 }
277 mailmessage_list*l=0; 277 mailmessage_list*l=0;
278 r = mailsession_get_messages_list(m_storage->sto_session,&l); 278 r = mailsession_get_messages_list(m_storage->sto_session,&l);
279 if (r != MAIL_NO_ERROR) { 279 if (r != MAIL_NO_ERROR) {
280 qDebug("Error message list"); 280 odebug << "Error message list" << oendl;
281 res = 0; 281 res = 0;
282 } 282 }
283 unsigned j = 0; 283 unsigned j = 0;
284 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { 284 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
285 mailmessage * msg; 285 mailmessage * msg;
286 msg = (mailmessage*)carray_get(l->msg_tab, i); 286 msg = (mailmessage*)carray_get(l->msg_tab, i);
287 j = msg->msg_index; 287 j = msg->msg_index;
288 r = mailsession_remove_message(m_storage->sto_session,j); 288 r = mailsession_remove_message(m_storage->sto_session,j);
289 if (r != MAIL_NO_ERROR) { 289 if (r != MAIL_NO_ERROR) {
290 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 290 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
291 res = 0; 291 res = 0;
292 break; 292 break;
@@ -299,46 +299,46 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder)
299int MHwrapper::deleteMbox(const FolderP&tfolder) 299int MHwrapper::deleteMbox(const FolderP&tfolder)
300{ 300{
301 init_storage(); 301 init_storage();
302 if (!m_storage) { 302 if (!m_storage) {
303 return 0; 303 return 0;
304 } 304 }
305 if (!tfolder) return 0; 305 if (!tfolder) return 0;
306 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; 306 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0;
307 307
308 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 308 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
309 309
310 if (r != MAIL_NO_ERROR) { 310 if (r != MAIL_NO_ERROR) {
311 qDebug("error deleting mail box"); 311 odebug << "error deleting mail box" << oendl;
312 return 0; 312 return 0;
313 } 313 }
314 QString cmd = "rm -rf "+tfolder->getName(); 314 QString cmd = "rm -rf "+tfolder->getName();
315 QStringList command; 315 QStringList command;
316 command << "/bin/sh"; 316 command << "/bin/sh";
317 command << "-c"; 317 command << "-c";
318 command << cmd.latin1(); 318 command << cmd.latin1();
319 OProcess *process = new OProcess(); 319 OProcess *process = new OProcess();
320 320
321 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), 321 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
322 this, SLOT( processEnded(Opie::Core::OProcess*))); 322 this, SLOT( processEnded(Opie::Core::OProcess*)));
323 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), 323 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
324 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); 324 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
325 325
326 *process << command; 326 *process << command;
327 removeMboxfailed = false; 327 removeMboxfailed = false;
328 if(!process->start(OProcess::Block, OProcess::All) ) { 328 if(!process->start(OProcess::Block, OProcess::All) ) {
329 qDebug("could not start process"); 329 odebug << "could not start process" << oendl;
330 return 0; 330 return 0;
331 } 331 }
332 qDebug("mail box deleted"); 332 odebug << "mail box deleted" << oendl;
333 return 1; 333 return 1;
334} 334}
335 335
336void MHwrapper::processEnded(OProcess *p) 336void MHwrapper::processEnded(OProcess *p)
337{ 337{
338 if (p) delete p; 338 if (p) delete p;
339} 339}
340 340
341void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) 341void MHwrapper::oprocessStderr(OProcess*, char *buffer, int )
342{ 342{
343 QString lineStr = buffer; 343 QString lineStr = buffer;
344 QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); 344 QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") );
@@ -369,74 +369,74 @@ MAILLIB::ATYPE MHwrapper::getType()const
369 369
370const QString&MHwrapper::getName()const 370const QString&MHwrapper::getName()const
371{ 371{
372 return MHName; 372 return MHName;
373} 373}
374void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 374void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
375{ 375{
376 init_storage(); 376 init_storage();
377 if (!m_storage) { 377 if (!m_storage) {
378 return; 378 return;
379 } 379 }
380 if (targetWrapper != this) { 380 if (targetWrapper != this) {
381 qDebug("Using generic"); 381 odebug << "Using generic" << oendl;
382 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); 382 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
383 return; 383 return;
384 } 384 }
385 qDebug("Using internal routines for move/copy"); 385 odebug << "Using internal routines for move/copy" << oendl;
386 QString tf = buildPath(targetFolder); 386 QString tf = buildPath(targetFolder);
387 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 387 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
388 if (r != MAIL_NO_ERROR) { 388 if (r != MAIL_NO_ERROR) {
389 qDebug("Error selecting source mailbox"); 389 odebug << "Error selecting source mailbox" << oendl;
390 return; 390 return;
391 } 391 }
392 if (moveit) { 392 if (moveit) {
393 r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); 393 r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
394 } else { 394 } else {
395 r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); 395 r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
396 } 396 }
397 if (r != MAIL_NO_ERROR) { 397 if (r != MAIL_NO_ERROR) {
398 qDebug("Error copy/moving mail internal (%i)",r); 398 odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
399 } 399 }
400} 400}
401 401
402void MHwrapper::mvcpAllMails(const FolderP&fromFolder, 402void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
403 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 403 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
404{ 404{
405 init_storage(); 405 init_storage();
406 if (!m_storage) { 406 if (!m_storage) {
407 return; 407 return;
408 } 408 }
409 if (targetWrapper != this) { 409 if (targetWrapper != this) {
410 qDebug("Using generic"); 410 odebug << "Using generic" << oendl;
411 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); 411 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
412 return; 412 return;
413 } 413 }
414 if (!fromFolder) return; 414 if (!fromFolder) return;
415 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); 415 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1());
416 if (r!=MAIL_NO_ERROR) { 416 if (r!=MAIL_NO_ERROR) {
417 qDebug("error selecting source folder!"); 417 odebug << "error selecting source folder!" << oendl;
418 return; 418 return;
419 } 419 }
420 QString tf = buildPath(targetFolder); 420 QString tf = buildPath(targetFolder);
421 mailmessage_list*l=0; 421 mailmessage_list*l=0;
422 r = mailsession_get_messages_list(m_storage->sto_session,&l); 422 r = mailsession_get_messages_list(m_storage->sto_session,&l);
423 if (r != MAIL_NO_ERROR) { 423 if (r != MAIL_NO_ERROR) {
424 qDebug("Error message list"); 424 odebug << "Error message list" << oendl;
425 } 425 }
426 unsigned j = 0; 426 unsigned j = 0;
427 for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) { 427 for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) {
428 mailmessage * msg; 428 mailmessage * msg;
429 msg = (mailmessage*)carray_get(l->msg_tab, i); 429 msg = (mailmessage*)carray_get(l->msg_tab, i);
430 j = msg->msg_index; 430 j = msg->msg_index;
431 if (moveit) { 431 if (moveit) {
432 r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1()); 432 r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1());
433 } else { 433 } else {
434 r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1()); 434 r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1());
435 } 435 }
436 if (r != MAIL_NO_ERROR) { 436 if (r != MAIL_NO_ERROR) {
437 qDebug("Error copy/moving mail internal (%i)",r); 437 odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
438 break; 438 break;
439 } 439 }
440 } 440 }
441 if (l) mailmessage_list_free(l); 441 if (l) mailmessage_list_free(l);
442} 442}
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
index cfded43..5d5011a 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
@@ -20,42 +20,42 @@ NNTPwrapper::NNTPwrapper( NNTPaccount *a )
20 last_msg_id = 0; 20 last_msg_id = 0;
21} 21}
22 22
23NNTPwrapper::~NNTPwrapper() { 23NNTPwrapper::~NNTPwrapper() {
24 logout(); 24 logout();
25 QFile msg_cache(msgTempName); 25 QFile msg_cache(msgTempName);
26 if (msg_cache.exists()) { 26 if (msg_cache.exists()) {
27 msg_cache.remove(); 27 msg_cache.remove();
28 } 28 }
29} 29}
30 30
31void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { 31void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) {
32 qDebug( "NNTP: %i of %i", current, maximum ); 32 odebug << "NNTP: " << current << " of " << maximum << "" << oendl;
33} 33}
34 34
35 35
36RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { 36RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) {
37 int err = NEWSNNTP_NO_ERROR; 37 int err = NEWSNNTP_NO_ERROR;
38 char *message = 0; 38 char *message = 0;
39 size_t length = 0; 39 size_t length = 0;
40 40
41 RecBodyP body = new RecBody(); 41 RecBodyP body = new RecBody();
42 login(); 42 login();
43 if ( !m_nntp ) { 43 if ( !m_nntp ) {
44 return body; 44 return body;
45 } 45 }
46 46
47 mailmessage * mailmsg; 47 mailmessage * mailmsg;
48 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { 48 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
49 qDebug("Message to large: %i",mail->Msgsize()); 49 odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
50 return body; 50 return body;
51 } 51 }
52 52
53 QFile msg_cache(msgTempName); 53 QFile msg_cache(msgTempName);
54 54
55 cleanMimeCache(); 55 cleanMimeCache();
56 56
57 if (mail->getNumber()!=last_msg_id) { 57 if (mail->getNumber()!=last_msg_id) {
58 if (msg_cache.exists()) { 58 if (msg_cache.exists()) {
59 msg_cache.remove(); 59 msg_cache.remove();
60 } 60 }
61 msg_cache.open(IO_ReadWrite|IO_Truncate); 61 msg_cache.open(IO_ReadWrite|IO_Truncate);
@@ -125,25 +125,25 @@ void NNTPwrapper::login()
125 125
126 user = pass = 0; 126 user = pass = 0;
127 127
128 if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) { 128 if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) {
129 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 129 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
130 login.show(); 130 login.show();
131 if ( QDialog::Accepted == login.exec() ) { 131 if ( QDialog::Accepted == login.exec() ) {
132 // ok 132 // ok
133 User = login.getUser().latin1(); 133 User = login.getUser().latin1();
134 Pass = login.getPassword().latin1(); 134 Pass = login.getPassword().latin1();
135 } else { 135 } else {
136 // cancel 136 // cancel
137 qDebug( "NNTP: Login canceled" ); 137 odebug << "NNTP: Login canceled" << oendl;
138 return; 138 return;
139 } 139 }
140 } else { 140 } else {
141 User = account->getUser().latin1(); 141 User = account->getUser().latin1();
142 Pass = account->getPassword().latin1(); 142 Pass = account->getPassword().latin1();
143 } 143 }
144 144
145 if (User.isEmpty()) { 145 if (User.isEmpty()) {
146 user=0; 146 user=0;
147 pass = 0; 147 pass = 0;
148 } else { 148 } else {
149 user=User.latin1(); 149 user=User.latin1();
@@ -162,25 +162,25 @@ void NNTPwrapper::login()
162 } else if ( conntypeset == 1 ) { 162 } else if ( conntypeset == 1 ) {
163 conntype = CONNECTION_TYPE_STARTTLS; 163 conntype = CONNECTION_TYPE_STARTTLS;
164 } else if ( conntypeset == 0 ) { 164 } else if ( conntypeset == 0 ) {
165 conntype = CONNECTION_TYPE_TRY_STARTTLS; 165 conntype = CONNECTION_TYPE_TRY_STARTTLS;
166 } 166 }
167 167
168 nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, 168 nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN,
169 (char*)user,(char*)pass,0,0,0); 169 (char*)user,(char*)pass,0,0,0);
170 170
171 err = mailstorage_connect( m_nntp ); 171 err = mailstorage_connect( m_nntp );
172 172
173 if (err != NEWSNNTP_NO_ERROR) { 173 if (err != NEWSNNTP_NO_ERROR) {
174 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); 174 odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
175 // Global::statusMessage(tr("Error initializing folder")); 175 // Global::statusMessage(tr("Error initializing folder"));
176 mailstorage_free(m_nntp); 176 mailstorage_free(m_nntp);
177 m_nntp = 0; 177 m_nntp = 0;
178 178
179 } else { 179 } else {
180 mailsession * session = m_nntp->sto_session; 180 mailsession * session = m_nntp->sto_session;
181 newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; 181 newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
182 news->nntp_progr_fun = &nntp_progress; 182 news->nntp_progr_fun = &nntp_progress;
183 } 183 }
184 184
185} 185}
186 186
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 5467547..c586c29 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -19,42 +19,42 @@ POP3wrapper::POP3wrapper( POP3account *a )
19 last_msg_id = 0; 19 last_msg_id = 0;
20} 20}
21 21
22POP3wrapper::~POP3wrapper() { 22POP3wrapper::~POP3wrapper() {
23 logout(); 23 logout();
24 QFile msg_cache(msgTempName); 24 QFile msg_cache(msgTempName);
25 if (msg_cache.exists()) { 25 if (msg_cache.exists()) {
26 msg_cache.remove(); 26 msg_cache.remove();
27 } 27 }
28} 28}
29 29
30void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { 30void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
31 qDebug( "POP3: %i of %i", current, maximum ); 31 odebug << "POP3: " << current << " of " << maximum << "" << oendl;
32} 32}
33 33
34RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { 34RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
35 int err = MAILPOP3_NO_ERROR; 35 int err = MAILPOP3_NO_ERROR;
36 char *message = 0; 36 char *message = 0;
37 size_t length = 0; 37 size_t length = 0;
38 38
39 RecBodyP body = new RecBody(); 39 RecBodyP body = new RecBody();
40 40
41 login(); 41 login();
42 if ( !m_pop3 ) { 42 if ( !m_pop3 ) {
43 return body; 43 return body;
44 } 44 }
45 45
46 mailmessage * mailmsg; 46 mailmessage * mailmsg;
47 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { 47 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
48 qDebug("Message to large: %i",mail->Msgsize()); 48 odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
49 return body; 49 return body;
50 } 50 }
51 51
52 QFile msg_cache(msgTempName); 52 QFile msg_cache(msgTempName);
53 53
54 cleanMimeCache(); 54 cleanMimeCache();
55 55
56 if (mail->getNumber()!=last_msg_id) { 56 if (mail->getNumber()!=last_msg_id) {
57 if (msg_cache.exists()) { 57 if (msg_cache.exists()) {
58 msg_cache.remove(); 58 msg_cache.remove();
59 } 59 }
60 msg_cache.open(IO_ReadWrite|IO_Truncate); 60 msg_cache.open(IO_ReadWrite|IO_Truncate);
@@ -121,25 +121,25 @@ void POP3wrapper::login()
121 server = account->getServer().latin1(); 121 server = account->getServer().latin1();
122 port = account->getPort().toUInt(); 122 port = account->getPort().toUInt();
123 123
124 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 124 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
125 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 125 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
126 login.show(); 126 login.show();
127 if ( QDialog::Accepted == login.exec() ) { 127 if ( QDialog::Accepted == login.exec() ) {
128 // ok 128 // ok
129 user = login.getUser().latin1(); 129 user = login.getUser().latin1();
130 pass = login.getPassword().latin1(); 130 pass = login.getPassword().latin1();
131 } else { 131 } else {
132 // cancel 132 // cancel
133 qDebug( "POP3: Login canceled" ); 133 odebug << "POP3: Login canceled" << oendl;
134 return; 134 return;
135 } 135 }
136 } else { 136 } else {
137 user = account->getUser().latin1(); 137 user = account->getUser().latin1();
138 pass = account->getPassword().latin1(); 138 pass = account->getPassword().latin1();
139 } 139 }
140 140
141 // bool ssl = account->getSSL(); 141 // bool ssl = account->getSSL();
142 142
143 m_pop3=mailstorage_new(NULL); 143 m_pop3=mailstorage_new(NULL);
144 144
145 int conntypeset = account->ConnectionType(); 145 int conntypeset = account->ConnectionType();
@@ -153,25 +153,25 @@ void POP3wrapper::login()
153 } else if ( conntypeset == 0 ) { 153 } else if ( conntypeset == 0 ) {
154 conntype = CONNECTION_TYPE_TRY_STARTTLS; 154 conntype = CONNECTION_TYPE_TRY_STARTTLS;
155 } 155 }
156 156
157 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); 157 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
158 158
159 pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, 159 pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
160 (char*)user,(char*)pass,0,0,0); 160 (char*)user,(char*)pass,0,0,0);
161 161
162 162
163 err = mailstorage_connect(m_pop3); 163 err = mailstorage_connect(m_pop3);
164 if (err != MAIL_NO_ERROR) { 164 if (err != MAIL_NO_ERROR) {
165 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); 165 odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
166 Global::statusMessage(tr("Error initializing folder")); 166 Global::statusMessage(tr("Error initializing folder"));
167 mailstorage_free(m_pop3); 167 mailstorage_free(m_pop3);
168 m_pop3 = 0; 168 m_pop3 = 0;
169 } else { 169 } else {
170 mailsession * session = m_pop3->sto_session; 170 mailsession * session = m_pop3->sto_session;
171 mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; 171 mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session;
172 if (mail) { 172 if (mail) {
173 mail->pop3_progr_fun = &pop3_progress; 173 mail->pop3_progr_fun = &pop3_progress;
174 } 174 }
175 } 175 }
176} 176}
177 177
@@ -227,25 +227,25 @@ int POP3wrapper::deleteAllMail(const FolderP&) {
227} 227}
228 228
229void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { 229void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
230 login(); 230 login();
231 target_stat.message_count = 0; 231 target_stat.message_count = 0;
232 target_stat.message_unseen = 0; 232 target_stat.message_unseen = 0;
233 target_stat.message_recent = 0; 233 target_stat.message_recent = 0;
234 if (!m_pop3) 234 if (!m_pop3)
235 return; 235 return;
236 int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, 236 int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count,
237 &target_stat.message_recent,&target_stat.message_unseen); 237 &target_stat.message_recent,&target_stat.message_unseen);
238 if (r != MAIL_NO_ERROR) { 238 if (r != MAIL_NO_ERROR) {
239 qDebug("error getting folter status."); 239 odebug << "error getting folter status." << oendl;
240 } 240 }
241} 241}
242 242
243encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) { 243encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) {
244 char*target=0; 244 char*target=0;
245 size_t length=0; 245 size_t length=0;
246 encodedString*res = 0; 246 encodedString*res = 0;
247 mailmessage * mailmsg = 0; 247 mailmessage * mailmsg = 0;
248 int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); 248 int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
249 err = mailmessage_fetch(mailmsg,&target,&length); 249 err = mailmessage_fetch(mailmsg,&target,&length);
250 if (mailmsg) 250 if (mailmsg)
251 mailmessage_free(mailmsg); 251 mailmessage_free(mailmsg);
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 2c81963..de36eeb 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -17,25 +17,25 @@
17 17
18 18
19Settings::Settings() 19Settings::Settings()
20 : QObject() 20 : QObject()
21{ 21{
22 updateAccounts(); 22 updateAccounts();
23} 23}
24 24
25void Settings::checkDirectory() 25void Settings::checkDirectory()
26{ 26{
27 if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { 27 if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
28 system( "mkdir -p $HOME/Applications/opiemail" ); 28 system( "mkdir -p $HOME/Applications/opiemail" );
29 qDebug( "$HOME/Applications/opiemail created" ); 29 odebug << "$HOME/Applications/opiemail created" << oendl;
30 } 30 }
31} 31}
32 32
33QList<Account> Settings::getAccounts() 33QList<Account> Settings::getAccounts()
34{ 34{
35 return accounts; 35 return accounts;
36} 36}
37 37
38void Settings::addAccount( Account *account ) 38void Settings::addAccount( Account *account )
39{ 39{
40 accounts.append( account ); 40 accounts.append( account );
41} 41}
@@ -45,46 +45,46 @@ void Settings::delAccount( Account *account )
45 accounts.remove( account ); 45 accounts.remove( account );
46 account->remove(); 46 account->remove();
47} 47}
48 48
49void Settings::updateAccounts() 49void Settings::updateAccounts()
50{ 50{
51 accounts.clear(); 51 accounts.clear();
52 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); 52 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
53 QStringList::Iterator it; 53 QStringList::Iterator it;
54 54
55 QStringList imap = dir.entryList( "imap-*" ); 55 QStringList imap = dir.entryList( "imap-*" );
56 for ( it = imap.begin(); it != imap.end(); it++ ) { 56 for ( it = imap.begin(); it != imap.end(); it++ ) {
57 qDebug( "Added IMAP account" ); 57 odebug << "Added IMAP account" << oendl;
58 IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); 58 IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
59 accounts.append( account ); 59 accounts.append( account );
60 } 60 }
61 61
62 QStringList pop3 = dir.entryList( "pop3-*" ); 62 QStringList pop3 = dir.entryList( "pop3-*" );
63 for ( it = pop3.begin(); it != pop3.end(); it++ ) { 63 for ( it = pop3.begin(); it != pop3.end(); it++ ) {
64 qDebug( "Added POP account" ); 64 odebug << "Added POP account" << oendl;
65 POP3account *account = new POP3account( (*it).replace(0, 5, "") ); 65 POP3account *account = new POP3account( (*it).replace(0, 5, "") );
66 accounts.append( account ); 66 accounts.append( account );
67 } 67 }
68 68
69 QStringList smtp = dir.entryList( "smtp-*" ); 69 QStringList smtp = dir.entryList( "smtp-*" );
70 for ( it = smtp.begin(); it != smtp.end(); it++ ) { 70 for ( it = smtp.begin(); it != smtp.end(); it++ ) {
71 qDebug( "Added SMTP account" ); 71 odebug << "Added SMTP account" << oendl;
72 SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); 72 SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
73 accounts.append( account ); 73 accounts.append( account );
74 } 74 }
75 75
76 QStringList nntp = dir.entryList( "nntp-*" ); 76 QStringList nntp = dir.entryList( "nntp-*" );
77 for ( it = nntp.begin(); it != nntp.end(); it++ ) { 77 for ( it = nntp.begin(); it != nntp.end(); it++ ) {
78 qDebug( "Added NNTP account" ); 78 odebug << "Added NNTP account" << oendl;
79 NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); 79 NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
80 accounts.append( account ); 80 accounts.append( account );
81 } 81 }
82 82
83 readAccounts(); 83 readAccounts();
84} 84}
85 85
86void Settings::saveAccounts() 86void Settings::saveAccounts()
87{ 87{
88 checkDirectory(); 88 checkDirectory();
89 Account *it; 89 Account *it;
90 90
@@ -170,25 +170,25 @@ void IMAPaccount::read()
170 user = conf->readEntry( "User","" ); 170 user = conf->readEntry( "User","" );
171 if (user.isNull()) user = ""; 171 if (user.isNull()) user = "";
172 password = conf->readEntryCrypt( "Password","" ); 172 password = conf->readEntryCrypt( "Password","" );
173 if (password.isNull()) password = ""; 173 if (password.isNull()) password = "";
174 prefix = conf->readEntry("MailPrefix",""); 174 prefix = conf->readEntry("MailPrefix","");
175 if (prefix.isNull()) prefix = ""; 175 if (prefix.isNull()) prefix = "";
176 offline = conf->readBoolEntry("Offline",false); 176 offline = conf->readBoolEntry("Offline",false);
177 delete conf; 177 delete conf;
178} 178}
179 179
180void IMAPaccount::save() 180void IMAPaccount::save()
181{ 181{
182 qDebug( "saving " + getFileName() ); 182 odebug << "saving " + getFileName() << oendl;
183 Settings::checkDirectory(); 183 Settings::checkDirectory();
184 184
185 Config *conf = new Config( getFileName(), Config::File ); 185 Config *conf = new Config( getFileName(), Config::File );
186 conf->setGroup( "IMAP Account" ); 186 conf->setGroup( "IMAP Account" );
187 conf->writeEntry( "Account", accountName ); 187 conf->writeEntry( "Account", accountName );
188 conf->writeEntry( "Server", server ); 188 conf->writeEntry( "Server", server );
189 conf->writeEntry( "Port", port ); 189 conf->writeEntry( "Port", port );
190 conf->writeEntry( "SSL", ssl ); 190 conf->writeEntry( "SSL", ssl );
191 conf->writeEntry( "ConnectionType", connectionType ); 191 conf->writeEntry( "ConnectionType", connectionType );
192 conf->writeEntry( "User", user ); 192 conf->writeEntry( "User", user );
193 conf->writeEntryCrypt( "Password", password ); 193 conf->writeEntryCrypt( "Password", password );
194 conf->writeEntry( "MailPrefix",prefix); 194 conf->writeEntry( "MailPrefix",prefix);
@@ -248,25 +248,25 @@ void POP3account::read()
248 server = conf->readEntry( "Server" ); 248 server = conf->readEntry( "Server" );
249 port = conf->readEntry( "Port" ); 249 port = conf->readEntry( "Port" );
250 ssl = conf->readBoolEntry( "SSL" ); 250 ssl = conf->readBoolEntry( "SSL" );
251 connectionType = conf->readNumEntry( "ConnectionType" ); 251 connectionType = conf->readNumEntry( "ConnectionType" );
252 user = conf->readEntry( "User" ); 252 user = conf->readEntry( "User" );
253 password = conf->readEntryCrypt( "Password" ); 253 password = conf->readEntryCrypt( "Password" );
254 offline = conf->readBoolEntry("Offline",false); 254 offline = conf->readBoolEntry("Offline",false);
255 delete conf; 255 delete conf;
256} 256}
257 257
258void POP3account::save() 258void POP3account::save()
259{ 259{
260 qDebug( "saving " + getFileName() ); 260 odebug << "saving " + getFileName() << oendl;
261 Settings::checkDirectory(); 261 Settings::checkDirectory();
262 262
263 Config *conf = new Config( getFileName(), Config::File ); 263 Config *conf = new Config( getFileName(), Config::File );
264 conf->setGroup( "POP3 Account" ); 264 conf->setGroup( "POP3 Account" );
265 conf->writeEntry( "Account", accountName ); 265 conf->writeEntry( "Account", accountName );
266 conf->writeEntry( "Server", server ); 266 conf->writeEntry( "Server", server );
267 conf->writeEntry( "Port", port ); 267 conf->writeEntry( "Port", port );
268 conf->writeEntry( "SSL", ssl ); 268 conf->writeEntry( "SSL", ssl );
269 conf->writeEntry( "ConnectionType", connectionType ); 269 conf->writeEntry( "ConnectionType", connectionType );
270 conf->writeEntry( "User", user ); 270 conf->writeEntry( "User", user );
271 conf->writeEntryCrypt( "Password", password ); 271 conf->writeEntryCrypt( "Password", password );
272 conf->writeEntry( "Offline",offline); 272 conf->writeEntry( "Offline",offline);
@@ -330,25 +330,25 @@ void SMTPaccount::read()
330 server = conf->readEntry( "Server" ); 330 server = conf->readEntry( "Server" );
331 port = conf->readEntry( "Port" ); 331 port = conf->readEntry( "Port" );
332 ssl = conf->readBoolEntry( "SSL" ); 332 ssl = conf->readBoolEntry( "SSL" );
333 connectionType = conf->readNumEntry( "ConnectionType" ); 333 connectionType = conf->readNumEntry( "ConnectionType" );
334 login = conf->readBoolEntry( "Login" ); 334 login = conf->readBoolEntry( "Login" );
335 user = conf->readEntry( "User" ); 335 user = conf->readEntry( "User" );
336 password = conf->readEntryCrypt( "Password" ); 336 password = conf->readEntryCrypt( "Password" );
337 delete conf; 337 delete conf;
338} 338}
339 339
340void SMTPaccount::save() 340void SMTPaccount::save()
341{ 341{
342 qDebug( "saving " + getFileName() ); 342 odebug << "saving " + getFileName() << oendl;
343 Settings::checkDirectory(); 343 Settings::checkDirectory();
344 344
345 Config *conf = new Config( getFileName(), Config::File ); 345 Config *conf = new Config( getFileName(), Config::File );
346 conf->setGroup( "SMTP Account" ); 346 conf->setGroup( "SMTP Account" );
347 conf->writeEntry( "Account", accountName ); 347 conf->writeEntry( "Account", accountName );
348 conf->writeEntry( "Server", server ); 348 conf->writeEntry( "Server", server );
349 conf->writeEntry( "Port", port ); 349 conf->writeEntry( "Port", port );
350 conf->writeEntry( "SSL", ssl ); 350 conf->writeEntry( "SSL", ssl );
351 conf->writeEntry( "ConnectionType", connectionType ); 351 conf->writeEntry( "ConnectionType", connectionType );
352 conf->writeEntry( "Login", login ); 352 conf->writeEntry( "Login", login );
353 conf->writeEntry( "User", user ); 353 conf->writeEntry( "User", user );
354 conf->writeEntryCrypt( "Password", password ); 354 conf->writeEntryCrypt( "Password", password );
@@ -407,25 +407,25 @@ void NNTPaccount::read()
407 server = conf->readEntry( "Server" ); 407 server = conf->readEntry( "Server" );
408 port = conf->readEntry( "Port" ); 408 port = conf->readEntry( "Port" );
409 ssl = conf->readBoolEntry( "SSL" ); 409 ssl = conf->readBoolEntry( "SSL" );
410 login = conf->readBoolEntry( "Login" ); 410 login = conf->readBoolEntry( "Login" );
411 user = conf->readEntry( "User" ); 411 user = conf->readEntry( "User" );
412 password = conf->readEntryCrypt( "Password" ); 412 password = conf->readEntryCrypt( "Password" );
413 subscribedGroups = conf->readListEntry( "Subscribed", ',' ); 413 subscribedGroups = conf->readListEntry( "Subscribed", ',' );
414 delete conf; 414 delete conf;
415} 415}
416 416
417void NNTPaccount::save() 417void NNTPaccount::save()
418{ 418{
419 qDebug( "saving " + getFileName() ); 419 odebug << "saving " + getFileName() << oendl;
420 Settings::checkDirectory(); 420 Settings::checkDirectory();
421 421
422 Config *conf = new Config( getFileName(), Config::File ); 422 Config *conf = new Config( getFileName(), Config::File );
423 conf->setGroup( "NNTP Account" ); 423 conf->setGroup( "NNTP Account" );
424 conf->writeEntry( "Account", accountName ); 424 conf->writeEntry( "Account", accountName );
425 conf->writeEntry( "Server", server ); 425 conf->writeEntry( "Server", server );
426 conf->writeEntry( "Port", port ); 426 conf->writeEntry( "Port", port );
427 conf->writeEntry( "SSL", ssl ); 427 conf->writeEntry( "SSL", ssl );
428 conf->writeEntry( "Login", login ); 428 conf->writeEntry( "Login", login );
429 conf->writeEntry( "User", user ); 429 conf->writeEntry( "User", user );
430 conf->writeEntryCrypt( "Password", password ); 430 conf->writeEntryCrypt( "Password", password );
431 conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); 431 conf->writeEntry( "Subscribed" , subscribedGroups, ',' );
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index e2cea7a..ba78c3b 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -106,25 +106,25 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
106 106
107 from = data = 0; 107 from = data = 0;
108 108
109 mailmessage * msg = 0; 109 mailmessage * msg = 0;
110 msg = mime_message_init(mail); 110 msg = mime_message_init(mail);
111 mime_message_set_tmpdir(msg,getenv( "HOME" )); 111 mime_message_set_tmpdir(msg,getenv( "HOME" ));
112 int r = mailmessage_fetch(msg,&data,&size); 112 int r = mailmessage_fetch(msg,&data,&size);
113 mime_message_detach_mime(msg); 113 mime_message_detach_mime(msg);
114 mailmessage_free(msg); 114 mailmessage_free(msg);
115 if (r != MAIL_NO_ERROR || !data) { 115 if (r != MAIL_NO_ERROR || !data) {
116 if (data) 116 if (data)
117 free(data); 117 free(data);
118 qDebug("Error fetching mime..."); 118 odebug << "Error fetching mime..." << oendl;
119 return; 119 return;
120 } 120 }
121 msg = 0; 121 msg = 0;
122 if (later) { 122 if (later) {
123 storeMail(data,size,"Outgoing"); 123 storeMail(data,size,"Outgoing");
124 if (data) 124 if (data)
125 free( data ); 125 free( data );
126 Config cfg( "mail" ); 126 Config cfg( "mail" );
127 cfg.setGroup( "Status" ); 127 cfg.setGroup( "Status" );
128 cfg.writeEntry( "outgoing", ++m_queuedMail ); 128 cfg.writeEntry( "outgoing", ++m_queuedMail );
129 emit queuedMails( m_queuedMail ); 129 emit queuedMails( m_queuedMail );
130 return; 130 return;
@@ -199,34 +199,34 @@ void SMTPwrapper::connect_server()
199 } 199 }
200 int result = 1; 200 int result = 1;
201 port = m_SmtpAccount->getPort().toUInt(); 201 port = m_SmtpAccount->getPort().toUInt();
202 202
203 m_smtp = mailsmtp_new( 20, &progress ); 203 m_smtp = mailsmtp_new( 20, &progress );
204 if ( m_smtp == NULL ) { 204 if ( m_smtp == NULL ) {
205 /* no failure message cause this happens when problems with memory - than we 205 /* no failure message cause this happens when problems with memory - than we
206 we can not display any messagebox */ 206 we can not display any messagebox */
207 return; 207 return;
208 } 208 }
209 209
210 int err = MAILSMTP_NO_ERROR; 210 int err = MAILSMTP_NO_ERROR;
211 qDebug( "Servername %s at port %i", server, port ); 211 odebug << "Servername " << server << " at port " << port << "" << oendl;
212 if ( ssl ) { 212 if ( ssl ) {
213 qDebug( "SSL session" ); 213 odebug << "SSL session" << oendl;
214 err = mailsmtp_ssl_connect( m_smtp, server, port ); 214 err = mailsmtp_ssl_connect( m_smtp, server, port );
215 } else { 215 } else {
216 qDebug( "No SSL session" ); 216 odebug << "No SSL session" << oendl;
217 err = mailsmtp_socket_connect( m_smtp, server, port ); 217 err = mailsmtp_socket_connect( m_smtp, server, port );
218 } 218 }
219 if ( err != MAILSMTP_NO_ERROR ) { 219 if ( err != MAILSMTP_NO_ERROR ) {
220 qDebug("Error init connection"); 220 odebug << "Error init connection" << oendl;
221 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); 221 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
222 result = 0; 222 result = 0;
223 } 223 }
224 224
225 /* switch to tls after init 'cause there it will send the ehlo */ 225 /* switch to tls after init 'cause there it will send the ehlo */
226 if (result) { 226 if (result) {
227 err = mailsmtp_init( m_smtp ); 227 err = mailsmtp_init( m_smtp );
228 if (err != MAILSMTP_NO_ERROR) { 228 if (err != MAILSMTP_NO_ERROR) {
229 result = 0; 229 result = 0;
230 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); 230 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
231 } 231 }
232 } 232 }
@@ -237,47 +237,47 @@ void SMTPwrapper::connect_server()
237 try_tls = false; 237 try_tls = false;
238 } else { 238 } else {
239 err = mailesmtp_ehlo(m_smtp); 239 err = mailesmtp_ehlo(m_smtp);
240 } 240 }
241 } 241 }
242 242
243 if (!try_tls && force_tls) { 243 if (!try_tls && force_tls) {
244 result = 0; 244 result = 0;
245 failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err)); 245 failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err));
246 } 246 }
247 247
248 if (result==1 && m_SmtpAccount->getLogin() ) { 248 if (result==1 && m_SmtpAccount->getLogin() ) {
249 qDebug("smtp with auth"); 249 odebug << "smtp with auth" << oendl;
250 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { 250 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
251 // get'em 251 // get'em
252 LoginDialog login( m_SmtpAccount->getUser(), 252 LoginDialog login( m_SmtpAccount->getUser(),
253 m_SmtpAccount->getPassword(), NULL, 0, true ); 253 m_SmtpAccount->getPassword(), NULL, 0, true );
254 login.show(); 254 login.show();
255 if ( QDialog::Accepted == login.exec() ) { 255 if ( QDialog::Accepted == login.exec() ) {
256 // ok 256 // ok
257 user = login.getUser().latin1(); 257 user = login.getUser().latin1();
258 pass = login.getPassword().latin1(); 258 pass = login.getPassword().latin1();
259 } else { 259 } else {
260 result = 0; 260 result = 0;
261 failuretext=tr("Login aborted - storing mail to localfolder"); 261 failuretext=tr("Login aborted - storing mail to localfolder");
262 } 262 }
263 } else { 263 } else {
264 user = m_SmtpAccount->getUser().latin1(); 264 user = m_SmtpAccount->getUser().latin1();
265 pass = m_SmtpAccount->getPassword().latin1(); 265 pass = m_SmtpAccount->getPassword().latin1();
266 } 266 }
267 qDebug( "session->auth: %i", m_smtp->auth); 267 odebug << "session->auth: " << m_smtp->auth << "" << oendl;
268 if (result) { 268 if (result) {
269 err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass ); 269 err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass );
270 if ( err == MAILSMTP_NO_ERROR ) { 270 if ( err == MAILSMTP_NO_ERROR ) {
271 qDebug("auth ok"); 271 odebug << "auth ok" << oendl;
272 } else { 272 } else {
273 failuretext = tr("Authentification failed"); 273 failuretext = tr("Authentification failed");
274 result = 0; 274 result = 0;
275 } 275 }
276 } 276 }
277 } 277 }
278} 278}
279 279
280void SMTPwrapper::disc_server() 280void SMTPwrapper::disc_server()
281{ 281{
282 if (m_smtp) { 282 if (m_smtp) {
283 mailsmtp_quit( m_smtp ); 283 mailsmtp_quit( m_smtp );
@@ -298,43 +298,43 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
298 err = mailsmtp_send( m_smtp, from, rcpts, data, size ); 298 err = mailsmtp_send( m_smtp, from, rcpts, data, size );
299 if ( err != MAILSMTP_NO_ERROR ) { 299 if ( err != MAILSMTP_NO_ERROR ) {
300 failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); 300 failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err));
301 result = 0; 301 result = 0;
302 } 302 }
303 } else { 303 } else {
304 result = 0; 304 result = 0;
305 } 305 }
306 306
307 if (!result) { 307 if (!result) {
308 storeFailedMail(data,size,failuretext); 308 storeFailedMail(data,size,failuretext);
309 } else { 309 } else {
310 qDebug( "Mail sent." ); 310 odebug << "Mail sent." << oendl;
311 storeMail(data,size,"Sent"); 311 storeMail(data,size,"Sent");
312 } 312 }
313 return result; 313 return result;
314} 314}
315 315
316void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) 316void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later )
317{ 317{
318 mailmime * mimeMail; 318 mailmime * mimeMail;
319 319
320 mimeMail = createMimeMail(mail ); 320 mimeMail = createMimeMail(mail );
321 if ( mimeMail == NULL ) { 321 if ( mimeMail == NULL ) {
322 qDebug( "sendMail: error creating mime mail" ); 322 odebug << "sendMail: error creating mime mail" << oendl;
323 } else { 323 } else {
324 sendProgress = new progressMailSend(); 324 sendProgress = new progressMailSend();
325 sendProgress->show(); 325 sendProgress->show();
326 sendProgress->setMaxMails(1); 326 sendProgress->setMaxMails(1);
327 smtpSend( mimeMail,later); 327 smtpSend( mimeMail,later);
328 qDebug("Clean up done"); 328 odebug << "Clean up done" << oendl;
329 sendProgress->hide(); 329 sendProgress->hide();
330 delete sendProgress; 330 delete sendProgress;
331 sendProgress = 0; 331 sendProgress = 0;
332 mailmime_free( mimeMail ); 332 mailmime_free( mimeMail );
333 } 333 }
334} 334}
335 335
336int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { 336int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
337 size_t curTok = 0; 337 size_t curTok = 0;
338 mailimf_fields *fields = 0; 338 mailimf_fields *fields = 0;
339 mailimf_field*ffrom = 0; 339 mailimf_field*ffrom = 0;
340 clist *rcpts = 0; 340 clist *rcpts = 0;
@@ -369,45 +369,45 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
369 free(from); 369 free(from);
370 } 370 }
371 if (rcpts) { 371 if (rcpts) {
372 smtp_address_list_free( rcpts ); 372 smtp_address_list_free( rcpts );
373 } 373 }
374 return res; 374 return res;
375} 375}
376 376
377/* this is a special fun */ 377/* this is a special fun */
378bool SMTPwrapper::flushOutbox() { 378bool SMTPwrapper::flushOutbox() {
379 bool returnValue = true; 379 bool returnValue = true;
380 380
381 qDebug("Sending the queue"); 381 odebug << "Sending the queue" << oendl;
382 if (!m_SmtpAccount) { 382 if (!m_SmtpAccount) {
383 qDebug("No smtp account given"); 383 odebug << "No smtp account given" << oendl;
384 return false; 384 return false;
385 } 385 }
386 386
387 bool reset_user_value = false; 387 bool reset_user_value = false;
388 QString localfolders = AbstractMail::defaultLocalfolder(); 388 QString localfolders = AbstractMail::defaultLocalfolder();
389 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 389 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
390 if (!wrap) { 390 if (!wrap) {
391 qDebug("memory error"); 391 odebug << "memory error" << oendl;
392 return false; 392 return false;
393 } 393 }
394 QString oldPw, oldUser; 394 QString oldPw, oldUser;
395 QValueList<RecMailP> mailsToSend; 395 QValueList<RecMailP> mailsToSend;
396 QValueList<RecMailP> mailsToRemove; 396 QValueList<RecMailP> mailsToRemove;
397 QString mbox("Outgoing"); 397 QString mbox("Outgoing");
398 wrap->listMessages(mbox,mailsToSend); 398 wrap->listMessages(mbox,mailsToSend);
399 if (mailsToSend.count()==0) { 399 if (mailsToSend.count()==0) {
400 delete wrap; 400 delete wrap;
401 qDebug("No mails to send"); 401 odebug << "No mails to send" << oendl;
402 return false; 402 return false;
403 } 403 }
404 404
405 oldPw = m_SmtpAccount->getPassword(); 405 oldPw = m_SmtpAccount->getPassword();
406 oldUser = m_SmtpAccount->getUser(); 406 oldUser = m_SmtpAccount->getUser();
407 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { 407 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
408 // get'em 408 // get'em
409 QString user,pass; 409 QString user,pass;
410 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); 410 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
411 login.show(); 411 login.show();
412 if ( QDialog::Accepted == login.exec() ) { 412 if ( QDialog::Accepted == login.exec() ) {
413 // ok 413 // ok
diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp
index b78244d..51383f6 100644
--- a/noncore/net/mail/libmailwrapper/statusmail.cpp
+++ b/noncore/net/mail/libmailwrapper/statusmail.cpp
@@ -34,25 +34,25 @@ void StatusMail::initAccounts(QList<Account>&accounts)
34 currentImapStat.message_count+=currentStat.message_unseen; 34 currentImapStat.message_count+=currentStat.message_unseen;
35 currentImapStat.message_count+=currentStat.message_recent; 35 currentImapStat.message_count+=currentStat.message_recent;
36 currentImapStat.message_count+=currentStat.message_count; 36 currentImapStat.message_count+=currentStat.message_count;
37 } else if ( it->getType() == MAILLIB::A_POP3 && !it->getOffline() ) { 37 } else if ( it->getType() == MAILLIB::A_POP3 && !it->getOffline() ) {
38 POP3account *pop3 = static_cast<POP3account *>(it); 38 POP3account *pop3 = static_cast<POP3account *>(it);
39 current = AbstractMail::getWrapper(pop3); 39 current = AbstractMail::getWrapper(pop3);
40 connectionList.append(current); 40 connectionList.append(current);
41 current->statusFolder(currentStat); 41 current->statusFolder(currentStat);
42 currentPop3Stat.message_count+=currentStat.message_count; 42 currentPop3Stat.message_count+=currentStat.message_count;
43 } 43 }
44 current->logout(); 44 current->logout();
45 } 45 }
46 qDebug("Pop3 init count: %i",currentPop3Stat.message_count); 46 odebug << "Pop3 init count: " << currentPop3Stat.message_count << "" << oendl;
47 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; 47 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
48 lastPop3Stat.message_unseen = currentPop3Stat.message_unseen; 48 lastPop3Stat.message_unseen = currentPop3Stat.message_unseen;
49 lastPop3Stat.message_recent = currentPop3Stat.message_recent; 49 lastPop3Stat.message_recent = currentPop3Stat.message_recent;
50 lastPop3Stat.message_count = currentPop3Stat.message_count; 50 lastPop3Stat.message_count = currentPop3Stat.message_count;
51} 51}
52 52
53void StatusMail::reset_status() 53void StatusMail::reset_status()
54{ 54{
55 lastPop3Stat = currentPop3Stat; 55 lastPop3Stat = currentPop3Stat;
56} 56}
57 57
58void StatusMail::check_current_stat(folderStat&targetStat) 58void StatusMail::check_current_stat(folderStat&targetStat)
@@ -63,28 +63,28 @@ void StatusMail::check_current_stat(folderStat&targetStat)
63 currentPop3Stat.message_count = 0; 63 currentPop3Stat.message_count = 0;
64 currentPop3Stat.message_unseen = 0; 64 currentPop3Stat.message_unseen = 0;
65 currentImapStat = currentPop3Stat; 65 currentImapStat = currentPop3Stat;
66 for ( it = connectionList.first(); it; it = connectionList.next() ) { 66 for ( it = connectionList.first(); it; it = connectionList.next() ) {
67 it->statusFolder(currentStat); 67 it->statusFolder(currentStat);
68 it->logout(); 68 it->logout();
69 if (it->getType() == MAILLIB::A_IMAP) { 69 if (it->getType() == MAILLIB::A_IMAP) {
70 currentImapStat.message_unseen+=currentStat.message_unseen; 70 currentImapStat.message_unseen+=currentStat.message_unseen;
71 currentImapStat.message_recent+=currentStat.message_recent; 71 currentImapStat.message_recent+=currentStat.message_recent;
72 currentImapStat.message_count+=currentStat.message_count; 72 currentImapStat.message_count+=currentStat.message_count;
73 } else if (it->getType() == MAILLIB::A_POP3) { 73 } else if (it->getType() == MAILLIB::A_POP3) {
74 currentPop3Stat.message_count+=currentStat.message_count; 74 currentPop3Stat.message_count+=currentStat.message_count;
75 qDebug("Pop3 count: %i",currentPop3Stat.message_count); 75 odebug << "Pop3 count: " << currentPop3Stat.message_count << "" << oendl;
76 } 76 }
77 } 77 }
78 qDebug("Pop3 last: %i",lastPop3Stat.message_count); 78 odebug << "Pop3 last: " << lastPop3Stat.message_count << "" << oendl;
79 if (currentPop3Stat.message_count > lastPop3Stat.message_count) { 79 if (currentPop3Stat.message_count > lastPop3Stat.message_count) {
80 currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count; 80 currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count;
81 currentPop3Stat.message_unseen = currentPop3Stat.message_recent; 81 currentPop3Stat.message_unseen = currentPop3Stat.message_recent;
82 } else { 82 } else {
83 lastPop3Stat.message_count = currentPop3Stat.message_count; 83 lastPop3Stat.message_count = currentPop3Stat.message_count;
84 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; 84 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
85 } 85 }
86 targetStat = currentImapStat; 86 targetStat = currentImapStat;
87 targetStat.message_unseen+=currentPop3Stat.message_unseen; 87 targetStat.message_unseen+=currentPop3Stat.message_unseen;
88 targetStat.message_recent+=currentPop3Stat.message_recent; 88 targetStat.message_recent+=currentPop3Stat.message_recent;
89 targetStat.message_count+=currentPop3Stat.message_count; 89 targetStat.message_count+=currentPop3Stat.message_count;
90} 90}
diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp
index 914a11d..546d756 100644
--- a/noncore/net/mail/libmailwrapper/storemail.cpp
+++ b/noncore/net/mail/libmailwrapper/storemail.cpp
@@ -49,40 +49,40 @@ Storemail::Storemail(const QString&aFolder)
49Storemail::~Storemail() 49Storemail::~Storemail()
50{ 50{
51} 51}
52 52
53int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) 53int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail)
54{ 54{
55 if (!wrapper) return 0; 55 if (!wrapper) return 0;
56 int ret = 1; 56 int ret = 1;
57 57
58 mailmime * mimeMail = 0; 58 mailmime * mimeMail = 0;
59 mimeMail = createMimeMail(mail ); 59 mimeMail = createMimeMail(mail );
60 if ( mimeMail == NULL ) { 60 if ( mimeMail == NULL ) {
61 qDebug( "storeMail: error creating mime mail" ); 61 odebug << "storeMail: error creating mime mail" << oendl;
62 return 0; 62 return 0;
63 } 63 }
64 char *data; 64 char *data;
65 size_t size; 65 size_t size;
66 data = 0; 66 data = 0;
67 67
68 mailmessage * msg = 0; 68 mailmessage * msg = 0;
69 msg = mime_message_init(mimeMail); 69 msg = mime_message_init(mimeMail);
70 mime_message_set_tmpdir(msg,getenv( "HOME" )); 70 mime_message_set_tmpdir(msg,getenv( "HOME" ));
71 int r = mailmessage_fetch(msg,&data,&size); 71 int r = mailmessage_fetch(msg,&data,&size);
72 mime_message_detach_mime(msg); 72 mime_message_detach_mime(msg);
73 mailmessage_free(msg); 73 mailmessage_free(msg);
74 msg = 0; 74 msg = 0;
75 if (r != MAIL_NO_ERROR || !data) { 75 if (r != MAIL_NO_ERROR || !data) {
76 qDebug("Error fetching mime..."); 76 odebug << "Error fetching mime..." << oendl;
77 ret = 0; 77 ret = 0;
78 } 78 }
79 79
80 if (ret) { 80 if (ret) {
81 wrapper->storeMessage(data,size,m_tfolder); 81 wrapper->storeMessage(data,size,m_tfolder);
82 } 82 }
83 83
84 if (data) { 84 if (data) {
85 free(data); 85 free(data);
86 } 86 }
87 if (mimeMail) { 87 if (mimeMail) {
88 mailmime_free( mimeMail ); 88 mailmime_free( mimeMail );
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index c23ad3f..4c87d64 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -132,25 +132,25 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
132 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 132 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
133#endif 133#endif
134 134
135 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 135 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
136} 136}
137 137
138MainWindow::~MainWindow() 138MainWindow::~MainWindow()
139{ 139{
140} 140}
141 141
142void MainWindow::appMessage(const QCString &, const QByteArray &) 142void MainWindow::appMessage(const QCString &, const QByteArray &)
143{ 143{
144 qDebug("appMessage not reached"); 144 odebug << "appMessage not reached" << oendl;
145} 145}
146 146
147void MainWindow::slotAdjustLayout() { 147void MainWindow::slotAdjustLayout() {
148 148
149 QWidget *d = QApplication::desktop(); 149 QWidget *d = QApplication::desktop();
150 150
151 if ( d->width() < d->height() ) { 151 if ( d->width() < d->height() ) {
152 layout->setDirection( QBoxLayout::TopToBottom ); 152 layout->setDirection( QBoxLayout::TopToBottom );
153 } else { 153 } else {
154 layout->setDirection( QBoxLayout::LeftToRight ); 154 layout->setDirection( QBoxLayout::LeftToRight );
155 } 155 }
156} 156}
@@ -166,50 +166,50 @@ void MainWindow::slotAdjustColumns()
166 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 166 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
167 mailView->setColumnWidth( 2, 80 ); 167 mailView->setColumnWidth( 2, 80 );
168 mailView->setColumnWidth( 3, 50 ); 168 mailView->setColumnWidth( 3, 50 );
169 mailView->setColumnWidth( 4, 50 ); 169 mailView->setColumnWidth( 4, 50 );
170} 170}
171 171
172void MainWindow::slotEditSettings() 172void MainWindow::slotEditSettings()
173{ 173{
174} 174}
175 175
176void MainWindow::slotShowFolders( bool ) 176void MainWindow::slotShowFolders( bool )
177{ 177{
178 qDebug( "slotShowFolders not reached" ); 178 odebug << "slotShowFolders not reached" << oendl;
179} 179}
180 180
181void MainWindow::refreshMailView(const QValueList<RecMailP>&) 181void MainWindow::refreshMailView(const QValueList<RecMailP>&)
182{ 182{
183 qDebug( "refreshMailView not reached" ); 183 odebug << "refreshMailView not reached" << oendl;
184} 184}
185 185
186void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) 186void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
187{ 187{
188 qDebug( "mailLeftClicked not reached" ); 188 odebug << "mailLeftClicked not reached" << oendl;
189} 189}
190 190
191void MainWindow::displayMail() 191void MainWindow::displayMail()
192{ 192{
193 qDebug("displayMail not reached"); 193 odebug << "displayMail not reached" << oendl;
194} 194}
195 195
196void MainWindow::slotDeleteMail() 196void MainWindow::slotDeleteMail()
197{ 197{
198 qDebug("deleteMail not reached"); 198 odebug << "deleteMail not reached" << oendl;
199} 199}
200 200
201void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 201void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
202{ 202{
203 qDebug("mailHold not reached"); 203 odebug << "mailHold not reached" << oendl;
204} 204}
205 205
206void MainWindow::slotSendQueued() 206void MainWindow::slotSendQueued()
207{ 207{
208} 208}
209 209
210void MainWindow::slotEditAccounts() 210void MainWindow::slotEditAccounts()
211{ 211{
212} 212}
213 213
214void MainWindow::slotComposeMail() 214void MainWindow::slotComposeMail()
215{ 215{
diff --git a/noncore/net/mail/nntpgroups.cpp b/noncore/net/mail/nntpgroups.cpp
index 8741c4b..3243ee3 100644
--- a/noncore/net/mail/nntpgroups.cpp
+++ b/noncore/net/mail/nntpgroups.cpp
@@ -44,19 +44,19 @@ void NNTPGroups::fillGroups()
44 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); 44 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
45 item->setOn( true ); 45 item->setOn( true );
46 } 46 }
47} 47}
48 48
49void NNTPGroups::storeValues() 49void NNTPGroups::storeValues()
50{ 50{
51 if (!m_Account) return; 51 if (!m_Account) return;
52 QListViewItemIterator list_it( GroupListView ); 52 QListViewItemIterator list_it( GroupListView );
53 subscribedGroups.clear(); 53 subscribedGroups.clear();
54 for ( ; list_it.current(); ++list_it ) { 54 for ( ; list_it.current(); ++list_it ) {
55 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { 55 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
56 qDebug(list_it.current()->text(0) ); 56 odebug << list_it.current()->text(0) << oendl;
57 subscribedGroups.append( list_it.current()->text(0) ); 57 subscribedGroups.append( list_it.current()->text(0) );
58 } 58 }
59 } 59 }
60 subscribedGroups+=subscribedGroupsNotListed; 60 subscribedGroups+=subscribedGroupsNotListed;
61 m_Account->setGroups( subscribedGroups ); 61 m_Account->setGroups( subscribedGroups );
62} 62}
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 5da2161..0669b5a 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -58,31 +58,31 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email)
58 } 58 }
59 else 59 else
60 { 60 {
61 compose.setTo(email); 61 compose.setTo(email);
62 } 62 }
63 } 63 }
64 compose.slotAdjustColumns(); 64 compose.slotAdjustColumns();
65 QPEApplication::execDialog( &compose ); 65 QPEApplication::execDialog( &compose );
66} 66}
67 67
68void OpieMail::slotComposeMail() 68void OpieMail::slotComposeMail()
69{ 69{
70 qDebug( "Compose Mail" ); 70 odebug << "Compose Mail" << oendl;
71 slotwriteMail(0l,0l); 71 slotwriteMail(0l,0l);
72} 72}
73 73
74void OpieMail::slotSendQueued() 74void OpieMail::slotSendQueued()
75{ 75{
76 qDebug( "Send Queued" ); 76 odebug << "Send Queued" << oendl;
77 SMTPaccount *smtp = 0; 77 SMTPaccount *smtp = 0;
78 78
79 QList<Account> list = settings->getAccounts(); 79 QList<Account> list = settings->getAccounts();
80 QList<SMTPaccount> smtpList; 80 QList<SMTPaccount> smtpList;
81 smtpList.setAutoDelete(false); 81 smtpList.setAutoDelete(false);
82 Account *it; 82 Account *it;
83 for ( it = list.first(); it; it = list.next() ) 83 for ( it = list.first(); it; it = list.next() )
84 { 84 {
85 if ( it->getType() == MAILLIB::A_SMTP ) 85 if ( it->getType() == MAILLIB::A_SMTP )
86 { 86 {
87 smtp = static_cast<SMTPaccount *>(it); 87 smtp = static_cast<SMTPaccount *>(it);
88 smtpList.append(smtp); 88 smtpList.append(smtp);
@@ -111,36 +111,36 @@ void OpieMail::slotSendQueued()
111 { 111 {
112 SMTPwrapper * wrap = new SMTPwrapper(smtp); 112 SMTPwrapper * wrap = new SMTPwrapper(smtp);
113 if ( wrap->flushOutbox() ) 113 if ( wrap->flushOutbox() )
114 { 114 {
115 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 115 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
116 } 116 }
117 delete wrap; 117 delete wrap;
118 } 118 }
119} 119}
120 120
121void OpieMail::slotSearchMails() 121void OpieMail::slotSearchMails()
122{ 122{
123 qDebug( "Search Mails" ); 123 odebug << "Search Mails" << oendl;
124} 124}
125 125
126void OpieMail::slotEditSettings() 126void OpieMail::slotEditSettings()
127{ 127{
128 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 128 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
129 QPEApplication::execDialog( &settingsDialog ); 129 QPEApplication::execDialog( &settingsDialog );
130} 130}
131 131
132void OpieMail::slotEditAccounts() 132void OpieMail::slotEditAccounts()
133{ 133{
134 qDebug( "Edit Accounts" ); 134 odebug << "Edit Accounts" << oendl;
135 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); 135 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
136 eaDialog.slotAdjustColumns(); 136 eaDialog.slotAdjustColumns();
137 QPEApplication::execDialog( &eaDialog ); 137 QPEApplication::execDialog( &eaDialog );
138 if ( settings ) delete settings; 138 if ( settings ) delete settings;
139 settings = new Settings(); 139 settings = new Settings();
140 140
141 folderView->populate( settings->getAccounts() ); 141 folderView->populate( settings->getAccounts() );
142} 142}
143 143
144void OpieMail::displayMail() 144void OpieMail::displayMail()
145{ 145{
146 QListViewItem*item = mailView->currentItem(); 146 QListViewItem*item = mailView->currentItem();
@@ -171,57 +171,57 @@ void OpieMail::slotDeleteMail()
171 { 171 {
172 mail->Wrapper()->deleteMail( mail ); 172 mail->Wrapper()->deleteMail( mail );
173 folderView->refreshCurrent(); 173 folderView->refreshCurrent();
174 } 174 }
175} 175}
176 176
177void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 177void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
178{ 178{
179 if (!mailView->currentItem()) return; 179 if (!mailView->currentItem()) return;
180 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 180 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
181 /* just the RIGHT button - or hold on pda */ 181 /* just the RIGHT button - or hold on pda */
182 if (button!=2) {return;} 182 if (button!=2) {return;}
183 qDebug("Event right/hold"); 183 odebug << "Event right/hold" << oendl;
184 if (!item) return; 184 if (!item) return;
185 QPopupMenu *m = new QPopupMenu(0); 185 QPopupMenu *m = new QPopupMenu(0);
186 if (m) 186 if (m)
187 { 187 {
188 if (mailtype==MAILLIB::A_NNTP) { 188 if (mailtype==MAILLIB::A_NNTP) {
189 m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); 189 m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
190// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); 190// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
191 } else { 191 } else {
192 if (folderView->currentisDraft()) { 192 if (folderView->currentisDraft()) {
193 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); 193 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
194 } 194 }
195 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 195 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
196 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 196 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
197 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); 197 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail()));
198 } 198 }
199 m->setFocus(); 199 m->setFocus();
200 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 200 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
201 delete m; 201 delete m;
202 } 202 }
203} 203}
204 204
205void OpieMail::slotShowFolders( bool show ) 205void OpieMail::slotShowFolders( bool show )
206{ 206{
207 qDebug( "Show Folders" ); 207 odebug << "Show Folders" << oendl;
208 if ( show && folderView->isHidden() ) 208 if ( show && folderView->isHidden() )
209 { 209 {
210 qDebug( "-> showing" ); 210 odebug << "-> showing" << oendl;
211 folderView->show(); 211 folderView->show();
212 } 212 }
213 else if ( !show && !folderView->isHidden() ) 213 else if ( !show && !folderView->isHidden() )
214 { 214 {
215 qDebug( "-> hiding" ); 215 odebug << "-> hiding" << oendl;
216 folderView->hide(); 216 folderView->hide();
217 } 217 }
218} 218}
219 219
220void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 220void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
221{ 221{
222 MailListViewItem*item = 0; 222 MailListViewItem*item = 0;
223 mailView->clear(); 223 mailView->clear();
224 224
225 QValueList<RecMailP>::ConstIterator it; 225 QValueList<RecMailP>::ConstIterator it;
226 for (it = list.begin(); it != list.end();++it) 226 for (it = list.begin(); it != list.end();++it)
227 { 227 {
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp
index f672a36..cac9048 100644
--- a/noncore/net/mail/taskbarapplet/mailapplet.cpp
+++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp
@@ -95,25 +95,25 @@ void MailApplet::slotCheck() {
95 m_intervalTimer->changeInterval( newIntervalMs ); 95 m_intervalTimer->changeInterval( newIntervalMs );
96 m_intervalMs = newIntervalMs; 96 m_intervalMs = newIntervalMs;
97 } 97 }
98 98
99 if (m_statusMail == 0) { 99 if (m_statusMail == 0) {
100 return; 100 return;
101 } 101 }
102 102
103 folderStat stat; 103 folderStat stat;
104 m_statusMail->check_current_stat( stat ); 104 m_statusMail->check_current_stat( stat );
105 int newMailsOld = m_newMails; 105 int newMailsOld = m_newMails;
106 m_newMails = stat.message_unseen; 106 m_newMails = stat.message_unseen;
107 qDebug( QString( "test %1" ).arg( m_newMails ) ); 107 odebug << QString( "test %1" ).arg( m_newMails ) << oendl;
108 if ( m_newMails > 0 && newMailsOld != m_newMails ) { 108 if ( m_newMails > 0 && newMailsOld != m_newMails ) {
109 ODevice *device = ODevice::inst(); 109 ODevice *device = ODevice::inst();
110 if ( isHidden() ) 110 if ( isHidden() )
111 show(); 111 show();
112 if ( m_config->readBoolEntry( "BlinkLed", true ) ) { 112 if ( m_config->readBoolEntry( "BlinkLed", true ) ) {
113 if ( !device->ledList().isEmpty() ) { 113 if ( !device->ledList().isEmpty() ) {
114 OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; 114 OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0];
115 device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); 115 device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On );
116 } 116 }
117 } 117 }
118 if ( m_config->readBoolEntry( "PlaySound", false ) ) 118 if ( m_config->readBoolEntry( "PlaySound", false ) )
119 device->playAlarmSound(); 119 device->playAlarmSound();
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 156e11d..a574ea1 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -130,25 +130,25 @@ void ViewMail::setBody(const RecBodyP&body )
130 } 130 }
131 131
132 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); 132 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist());
133 QString filename = ""; 133 QString filename = "";
134 134
135 for (unsigned int i = 0; i < body->Parts().count();++i) 135 for (unsigned int i = 0; i < body->Parts().count();++i)
136 { 136 {
137 filename = ""; 137 filename = "";
138 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); 138 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype();
139 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); 139 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin();
140 for (;it!=body->Parts()[i]->Parameters().end();++it) 140 for (;it!=body->Parts()[i]->Parameters().end();++it)
141 { 141 {
142 qDebug(it.key()); 142 odebug << it.key() << oendl;
143 if (it.key().lower()=="name") 143 if (it.key().lower()=="name")
144 { 144 {
145 filename=it.data(); 145 filename=it.data();
146 } 146 }
147 } 147 }
148 s = body->Parts()[i]->Size(); 148 s = body->Parts()[i]->Size();
149 w = 0; 149 w = 0;
150 while (s>1024) 150 while (s>1024)
151 { 151 {
152 s/=1024; 152 s/=1024;
153 ++w; 153 ++w;
154 if (w>=2) break; 154 if (w>=2) break;
diff --git a/noncore/net/opieftp/config.in b/noncore/net/opieftp/config.in
index 96e8b27..95cf73c 100644
--- a/noncore/net/opieftp/config.in
+++ b/noncore/net/opieftp/config.in
@@ -1,4 +1,4 @@
1 config OPIEFTP 1 config OPIEFTP
2 boolean "opie-ftp (ftp client for Opie)" 2 boolean "opie-ftp (ftp client for Opie)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && FTPLIB 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && FTPLIB
diff --git a/noncore/net/opieftp/filePermissions.cpp b/noncore/net/opieftp/filePermissions.cpp
index f545c1f..991fcd5 100644
--- a/noncore/net/opieftp/filePermissions.cpp
+++ b/noncore/net/opieftp/filePermissions.cpp
@@ -23,25 +23,25 @@
23#include <unistd.h> 23#include <unistd.h>
24#include <sys/stat.h> 24#include <sys/stat.h>
25#include <stdlib.h> 25#include <stdlib.h>
26#include <sys/types.h> 26#include <sys/types.h>
27#include <pwd.h> 27#include <pwd.h>
28#include <grp.h> 28#include <grp.h>
29 29
30filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName, bool useRemote ) 30filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName, bool useRemote )
31 : QDialog( parent, name, modal, fl ) 31 : QDialog( parent, name, modal, fl )
32{ 32{
33 if ( !name ) 33 if ( !name )
34 setName( tr("filePermissions") ); 34 setName( tr("filePermissions") );
35// qDebug("FilePermissions "+fileName); 35// odebug << "FilePermissions "+fileName << oendl;
36 resize( 236, 210 ); 36 resize( 236, 210 );
37 isRemote=useRemote; 37 isRemote=useRemote;
38 setMaximumSize( QSize( 236, 210 ) ); 38 setMaximumSize( QSize( 236, 210 ) );
39 setCaption( tr( "Set File Permissions" ) ); 39 setCaption( tr( "Set File Permissions" ) );
40 40
41 TextLabel1 = new QLabel( this, "TextLabel1" ); 41 TextLabel1 = new QLabel( this, "TextLabel1" );
42 TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); 42 TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) );
43 TextLabel1->setText( tr( "Set file permissions for:" ) ); 43 TextLabel1->setText( tr( "Set file permissions for:" ) );
44 44
45 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 45 LineEdit1 = new QLineEdit( this, "LineEdit1" );
46 LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); 46 LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) );
47 LineEdit1->setReadOnly(true); 47 LineEdit1->setReadOnly(true);
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 4c39569..fe96103 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -10,67 +10,70 @@
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12//#define DEVELOPERS_VERSION 12//#define DEVELOPERS_VERSION
13 13
14#include "opieftp.h" 14#include "opieftp.h"
15 15
16extern "C" { 16extern "C" {
17#include "../ftplib/ftplib.h" 17#include "../ftplib/ftplib.h"
18} 18}
19 19
20#include "inputDialog.h" 20#include "inputDialog.h"
21 21
22#include <qmenubar.h> 22/* OPIE */
23#include <opie2/odebug.h>
23#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
24#include <qpe/resource.h> 25#include <qpe/resource.h>
25#include <qpe/config.h> 26#include <qpe/config.h>
26#include <qpe/mimetype.h> 27#include <qpe/mimetype.h>
28using namespace Opie::Core;
27 29
28#include <qtextstream.h> 30#include <qtextstream.h>
29#include <qpushbutton.h> 31#include <qpushbutton.h>
30#include <qtoolbutton.h> 32#include <qtoolbutton.h>
31#include <qcombobox.h> 33#include <qcombobox.h>
32#include <qlistview.h> 34#include <qlistview.h>
33#include <qlabel.h> 35#include <qlabel.h>
34#include <qprogressbar.h> 36#include <qprogressbar.h>
35#include <qspinbox.h> 37#include <qspinbox.h>
36#include <qtabwidget.h> 38#include <qtabwidget.h>
37#include <qlayout.h> 39#include <qlayout.h>
38#include <qmessagebox.h> 40#include <qmessagebox.h>
41#include <qmenubar.h>
39#include <qlineedit.h> 42#include <qlineedit.h>
40#include <qlistbox.h> 43#include <qlistbox.h>
41#include <qvbox.h> 44#include <qvbox.h>
42 45
46/* STD */
43#include <unistd.h> 47#include <unistd.h>
44#include <stdlib.h> 48#include <stdlib.h>
45 49
46
47QProgressBar *ProgressBar; 50QProgressBar *ProgressBar;
48static netbuf *conn=NULL; 51static netbuf *conn=NULL;
49 52
50static int log_progress(netbuf *, int xfered, void *) 53static int log_progress(netbuf *, int xfered, void *)
51{ 54{
52// int fsz = *(int *)arg; 55// int fsz = *(int *)arg;
53// int pct = (xfered * 100) / fsz; 56// int pct = (xfered * 100) / fsz;
54// printf("%3d%%\r", pct); 57// printf("%3d%%\r", pct);
55// fflush(stdout); 58// fflush(stdout);
56 ProgressBar->setProgress(xfered); 59 ProgressBar->setProgress(xfered);
57 qApp->processEvents(); 60 qApp->processEvents();
58 return 1; 61 return 1;
59} 62}
60 63
61OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) 64OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
62 : QMainWindow( parent, name, fl ) 65 : QMainWindow( parent, name, fl )
63{ 66{
64 qDebug("OpieFtp constructor"); 67 odebug << "OpieFtp constructor" << oendl;
65 setCaption( tr( "OpieFtp" ) ); 68 setCaption( tr( "OpieFtp" ) );
66 fuckeduphack=FALSE; 69 fuckeduphack=FALSE;
67 70
68 QVBox* wrapperBox = new QVBox( this ); 71 QVBox* wrapperBox = new QVBox( this );
69 setCentralWidget( wrapperBox ); 72 setCentralWidget( wrapperBox );
70 73
71 QWidget *view = new QWidget( wrapperBox ); 74 QWidget *view = new QWidget( wrapperBox );
72 75
73 QGridLayout *layout = new QGridLayout( view ); 76 QGridLayout *layout = new QGridLayout( view );
74 layout->setSpacing( 2); 77 layout->setSpacing( 2);
75 layout->setMargin( 2); 78 layout->setMargin( 2);
76 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 79 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
@@ -325,25 +328,25 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
325 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 328 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
326 ProgressBar->setMaximumHeight(10); 329 ProgressBar->setMaximumHeight(10);
327 filterStr="*"; 330 filterStr="*";
328 b=FALSE; 331 b=FALSE;
329#if 0 332#if 0
330 populateLocalView(); 333 populateLocalView();
331#endif 334#endif
332 readConfig(); 335 readConfig();
333 336
334// ServerComboBox->setCurrentItem(currentServerConfig); 337// ServerComboBox->setCurrentItem(currentServerConfig);
335 338
336 TabWidget->setCurrentPage(2); 339 TabWidget->setCurrentPage(2);
337 qDebug("Constructor done"); 340 odebug << "Constructor done" << oendl;
338} 341}
339 342
340OpieFtp::~OpieFtp() 343OpieFtp::~OpieFtp()
341{ 344{
342} 345}
343 346
344void OpieFtp::cleanUp() 347void OpieFtp::cleanUp()
345{ 348{
346 if(conn) 349 if(conn)
347 FtpQuit(conn); 350 FtpQuit(conn);
348 QString sfile=QDir::homeDirPath(); 351 QString sfile=QDir::homeDirPath();
349 if(sfile.right(1) != "/") 352 if(sfile.right(1) != "/")
@@ -396,25 +399,25 @@ void OpieFtp::newConnection()
396{ 399{
397 UsernameComboBox->lineEdit()->setText(""); 400 UsernameComboBox->lineEdit()->setText("");
398 PasswordEdit->setText( "" ); 401 PasswordEdit->setText( "" );
399 ServerComboBox->lineEdit()->setText( ""); 402 ServerComboBox->lineEdit()->setText( "");
400 remotePath->setText( currentRemoteDir = "/"); 403 remotePath->setText( currentRemoteDir = "/");
401 PortSpinBox->setValue( 21); 404 PortSpinBox->setValue( 21);
402 TabWidget->setCurrentPage(2); 405 TabWidget->setCurrentPage(2);
403} 406}
404 407
405void OpieFtp::serverComboEdited(const QString & ) 408void OpieFtp::serverComboEdited(const QString & )
406{ 409{
407// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { 410// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) {
408// qDebug("ServerComboEdited"); 411// odebug << "ServerComboEdited" << oendl;
409// // currentServerConfig = -1; 412// // currentServerConfig = -1;
410// } 413// }
411} 414}
412 415
413void OpieFtp::UsernameComboBoxEdited(const QString &) { 416void OpieFtp::UsernameComboBoxEdited(const QString &) {
414// currentServerConfig = -1; 417// currentServerConfig = -1;
415} 418}
416 419
417void OpieFtp::PasswordEditEdited(const QString & ) { 420void OpieFtp::PasswordEditEdited(const QString & ) {
418// currentServerConfig = -1; 421// currentServerConfig = -1;
419} 422}
420 423
@@ -521,25 +524,25 @@ void OpieFtp::localUpload()
521 QString strItem = it.current()->text(0); 524 QString strItem = it.current()->text(0);
522 QString localFile = currentDir.canonicalPath()+"/"+strItem; 525 QString localFile = currentDir.canonicalPath()+"/"+strItem;
523 QString remoteFile= currentRemoteDir+strItem; 526 QString remoteFile= currentRemoteDir+strItem;
524 QFileInfo fi(localFile); 527 QFileInfo fi(localFile);
525 if( !fi.isDir()) { 528 if( !fi.isDir()) {
526 fsz=fi.size(); 529 fsz=fi.size();
527 ProgressBar->setTotalSteps(fsz); 530 ProgressBar->setTotalSteps(fsz);
528 531
529 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 532 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
530 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 533 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
531 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 534 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
532 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 535 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
533 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); 536 odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl;
534 537
535 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 538 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
536 QString msg; 539 QString msg;
537 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); 540 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
538 msg.replace(QRegExp(":"),"\n"); 541 msg.replace(QRegExp(":"),"\n");
539 QMessageBox::message(tr("Note"),msg); 542 QMessageBox::message(tr("Note"),msg);
540 } 543 }
541 } else { 544 } else {
542 QMessageBox::message(tr("Note"),tr("Cannot upload directories")); 545 QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
543 } 546 }
544 ProgressBar->reset(); 547 ProgressBar->reset();
545 nullifyCallBack(); 548 nullifyCallBack();
@@ -582,25 +585,25 @@ void OpieFtp::remoteDownload()
582// QString localFile = currentDir.canonicalPath()+"/"+strItem; 585// QString localFile = currentDir.canonicalPath()+"/"+strItem;
583 QString remoteFile= currentRemoteDir+strItem; 586 QString remoteFile= currentRemoteDir+strItem;
584 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) 587 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
585 fsz = 0; 588 fsz = 0;
586 QString temp; 589 QString temp;
587 temp.sprintf( remoteFile+" "+" %dkb", fsz); 590 temp.sprintf( remoteFile+" "+" %dkb", fsz);
588 591
589 ProgressBar->setTotalSteps(fsz); 592 ProgressBar->setTotalSteps(fsz);
590 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 593 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
591 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 594 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
592 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 595 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
593 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 596 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
594 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); 597 odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl;
595 598
596 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 599 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
597 QString msg; 600 QString msg;
598 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); 601 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
599 msg.replace(QRegExp(":"),"\n"); 602 msg.replace(QRegExp(":"),"\n");
600 QMessageBox::message(tr("Note"),msg); 603 QMessageBox::message(tr("Note"),msg);
601 } 604 }
602 ProgressBar->reset(); 605 ProgressBar->reset();
603 nullifyCallBack(); 606 nullifyCallBack();
604 it.current()->setSelected(FALSE); 607 it.current()->setSelected(FALSE);
605 } 608 }
606 } 609 }
@@ -611,82 +614,82 @@ void OpieFtp::remoteDownload()
611 TabWidget->setCurrentPage(0); 614 TabWidget->setCurrentPage(0);
612 populateLocalView(); 615 populateLocalView();
613// QCopEnvelope ( "QPE/System", "notBusy()" ); 616// QCopEnvelope ( "QPE/System", "notBusy()" );
614} 617}
615 618
616bool OpieFtp::remoteDirList(const QString &dir) 619bool OpieFtp::remoteDirList(const QString &dir)
617{ 620{
618 QString tmp = QDir::homeDirPath(); 621 QString tmp = QDir::homeDirPath();
619 if(tmp.right(1) != "/") 622 if(tmp.right(1) != "/")
620 tmp+="/._temp"; 623 tmp+="/._temp";
621 else 624 else
622 tmp+="._temp"; 625 tmp+="._temp";
623// qDebug("Listing remote dir "+tmp); 626// odebug << "Listing remote dir "+tmp << oendl;
624// QCopEnvelope ( "QPE/System", "busy()" ); 627// QCopEnvelope ( "QPE/System", "busy()" );
625 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 628 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
626 QString msg; 629 QString msg;
627 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); 630 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
628 msg.replace(QRegExp(":"),"\n"); 631 msg.replace(QRegExp(":"),"\n");
629 QMessageBox::message(tr("Note"),msg); 632 QMessageBox::message(tr("Note"),msg);
630 return false; 633 return false;
631 } 634 }
632 populateRemoteView() ; 635 populateRemoteView() ;
633// QCopEnvelope ( "QPE/System", "notBusy()" ); 636// QCopEnvelope ( "QPE/System", "notBusy()" );
634 return true; 637 return true;
635} 638}
636 639
637bool OpieFtp::remoteChDir(const QString &dir) 640bool OpieFtp::remoteChDir(const QString &dir)
638{ 641{
639// QCopEnvelope ( "QPE/System", "busy()" ); 642// QCopEnvelope ( "QPE/System", "busy()" );
640 if (!FtpChdir( dir.latin1(), conn )) { 643 if (!FtpChdir( dir.latin1(), conn )) {
641 QString msg; 644 QString msg;
642 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); 645 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
643 msg.replace(QRegExp(":"),"\n"); 646 msg.replace(QRegExp(":"),"\n");
644 QMessageBox::message(tr("Note"),msg); 647 QMessageBox::message(tr("Note"),msg);
645// qDebug(msg); 648// odebug << msg << oendl;
646// QCopEnvelope ( "QPE/System", "notBusy()" ); 649// QCopEnvelope ( "QPE/System", "notBusy()" );
647 return FALSE; 650 return FALSE;
648 } 651 }
649// QCopEnvelope ( "QPE/System", "notBusy()" ); 652// QCopEnvelope ( "QPE/System", "notBusy()" );
650 return TRUE; 653 return TRUE;
651} 654}
652 655
653void OpieFtp::populateLocalView() 656void OpieFtp::populateLocalView()
654{ 657{
655 Local_View->clear(); 658 Local_View->clear();
656 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 659 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
657 currentDir.setMatchAllDirs(TRUE); 660 currentDir.setMatchAllDirs(TRUE);
658 currentDir.setNameFilter(filterStr); 661 currentDir.setNameFilter(filterStr);
659 QString fileL, fileS, fileDate; 662 QString fileL, fileS, fileDate;
660 bool isDir=FALSE; 663 bool isDir=FALSE;
661 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 664 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
662 QFileInfoListIterator it(*list); 665 QFileInfoListIterator it(*list);
663 QFileInfo *fi; 666 QFileInfo *fi;
664 while ( (fi=it.current()) ) { 667 while ( (fi=it.current()) ) {
665 if (fi->isSymLink() ){ 668 if (fi->isSymLink() ){
666 QString symLink=fi->readLink(); 669 QString symLink=fi->readLink();
667 qDebug("Symlink detected "+symLink); 670 odebug << "Symlink detected "+symLink << oendl;
668 QFileInfo sym( symLink); 671 QFileInfo sym( symLink);
669 fileS.sprintf( "%10i", sym.size() ); 672 fileS.sprintf( "%10i", sym.size() );
670 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 673 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
671 fileDate = sym.lastModified().toString(); 674 fileDate = sym.lastModified().toString();
672 } else { 675 } else {
673 qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 676 odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl;
674 fileS.sprintf( "%10i", fi->size() ); 677 fileS.sprintf( "%10i", fi->size() );
675 fileL.sprintf( "%s",fi->fileName().data() ); 678 fileL.sprintf( "%s",fi->fileName().data() );
676 fileDate= fi->lastModified().toString(); 679 fileDate= fi->lastModified().toString();
677 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 680 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
678 fileL+="/"; 681 fileL+="/";
679 isDir=TRUE; 682 isDir=TRUE;
680 qDebug( fileL); 683 odebug << fileL << oendl;
681 } 684 }
682 } 685 }
683 if(fileL !="./" && fi->exists()) { 686 if(fileL !="./" && fi->exists()) {
684 item = new QListViewItem( Local_View,fileL, fileDate, fileS ); 687 item = new QListViewItem( Local_View,fileL, fileDate, fileS );
685 QPixmap pm; 688 QPixmap pm;
686 689
687 if(isDir || fileL.find("/",0,TRUE) != -1) { 690 if(isDir || fileL.find("/",0,TRUE) != -1) {
688 if( !QDir( fi->filePath() ).isReadable()) 691 if( !QDir( fi->filePath() ).isReadable())
689 pm = Resource::loadPixmap( "lockedfolder" ); 692 pm = Resource::loadPixmap( "lockedfolder" );
690 else 693 else
691 pm= Resource::loadPixmap( "folder" ); 694 pm= Resource::loadPixmap( "folder" );
692 item->setPixmap( 0,pm ); 695 item->setPixmap( 0,pm );
@@ -711,25 +714,25 @@ void OpieFtp::populateLocalView()
711 item->setPixmap( 0,pm); 714 item->setPixmap( 0,pm);
712 } 715 }
713 isDir=FALSE; 716 isDir=FALSE;
714 ++it; 717 ++it;
715 } 718 }
716 Local_View->setSorting( 3,FALSE); 719 Local_View->setSorting( 3,FALSE);
717 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); 720 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
718 fillCombo( (const QString &)currentDir); 721 fillCombo( (const QString &)currentDir);
719} 722}
720 723
721bool OpieFtp::populateRemoteView( ) 724bool OpieFtp::populateRemoteView( )
722{ 725{
723// qDebug("populate remoteview"); 726// odebug << "populate remoteview" << oendl;
724 QString sfile=QDir::homeDirPath(); 727 QString sfile=QDir::homeDirPath();
725 if(sfile.right(1) != "/") 728 if(sfile.right(1) != "/")
726 sfile+="/._temp"; 729 sfile+="/._temp";
727 else 730 else
728 sfile+="._temp"; 731 sfile+="._temp";
729 QFile file( sfile); 732 QFile file( sfile);
730 Remote_View->clear(); 733 Remote_View->clear();
731 QString s, File_Name; 734 QString s, File_Name;
732 QListViewItem *itemDir=NULL, *itemFile=NULL; 735 QListViewItem *itemDir=NULL, *itemFile=NULL;
733 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); 736 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] ");
734 QString fileL, fileS, fileDate; 737 QString fileL, fileS, fileDate;
735 if ( file.open(IO_ReadOnly)) { 738 if ( file.open(IO_ReadOnly)) {
@@ -760,69 +763,69 @@ bool OpieFtp::populateRemoteView( )
760// if(itemFile) 763// if(itemFile)
761 item->moveItem(itemDir); 764 item->moveItem(itemDir);
762 item->moveItem(itemFile); 765 item->moveItem(itemFile);
763 itemFile=item; 766 itemFile=item;
764 } 767 }
765 } 768 }
766 QListViewItem * item1 = new QListViewItem( Remote_View, "../"); 769 QListViewItem * item1 = new QListViewItem( Remote_View, "../");
767 item1->setPixmap( 0, Resource::loadPixmap( "folder" )); 770 item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
768 file.close(); 771 file.close();
769 if( file.exists()) 772 if( file.exists())
770 file. remove(); 773 file. remove();
771 } else 774 } else
772 qDebug("temp file not opened successfully "+sfile); 775 odebug << "temp file not opened successfully "+sfile << oendl;
773 Remote_View->setSorting( 4,TRUE); 776 Remote_View->setSorting( 4,TRUE);
774 return true; 777 return true;
775} 778}
776 779
777void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 780void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
778{ 781{
779 if( selectedItem) { 782 if( selectedItem) {
780 // if(selectedItem!= NULL) { 783 // if(selectedItem!= NULL) {
781// QCopEnvelope ( "QPE/System", "busy()" ); 784// QCopEnvelope ( "QPE/System", "busy()" );
782 QString oldRemoteCurrentDir = currentRemoteDir; 785 QString oldRemoteCurrentDir = currentRemoteDir;
783 QString strItem=selectedItem->text(0); 786 QString strItem=selectedItem->text(0);
784 strItem=strItem.simplifyWhiteSpace(); 787 strItem=strItem.simplifyWhiteSpace();
785 if(strItem == "../") { // the user wants to go ^ 788 if(strItem == "../") { // the user wants to go ^
786 if( FtpCDUp( conn) == 0) { 789 if( FtpCDUp( conn) == 0) {
787 QString msg; 790 QString msg;
788 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 791 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
789 msg.replace(QRegExp(":"),"\n"); 792 msg.replace(QRegExp(":"),"\n");
790 QMessageBox::message(tr("Note"),msg); 793 QMessageBox::message(tr("Note"),msg);
791// qDebug(msg); 794// odebug << msg << oendl;
792 } 795 }
793 char path[256]; 796 char path[256];
794 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 797 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
795 QString msg; 798 QString msg;
796 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 799 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
797 msg.replace(QRegExp(":"),"\n"); 800 msg.replace(QRegExp(":"),"\n");
798 QMessageBox::message(tr("Note"),msg); 801 QMessageBox::message(tr("Note"),msg);
799// qDebug(msg); 802// odebug << msg << oendl;
800 } 803 }
801 currentRemoteDir=path; 804 currentRemoteDir=path;
802 } else { 805 } else {
803 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers 806 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
804 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); 807 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
805 strItem = strItem.stripWhiteSpace(); 808 strItem = strItem.stripWhiteSpace();
806 currentRemoteDir = strItem; 809 currentRemoteDir = strItem;
807 if( !remoteChDir( (const QString &)strItem)) { 810 if( !remoteChDir( (const QString &)strItem)) {
808 currentRemoteDir = oldRemoteCurrentDir; 811 currentRemoteDir = oldRemoteCurrentDir;
809 strItem=""; 812 strItem="";
810// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 813// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl;
811 } 814 }
812 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory 815 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
813 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { 816 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
814 currentRemoteDir = oldRemoteCurrentDir; 817 currentRemoteDir = oldRemoteCurrentDir;
815 strItem=""; 818 strItem="";
816// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 819// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl;
817 820
818 } else { 821 } else {
819 currentRemoteDir = currentRemoteDir+strItem; 822 currentRemoteDir = currentRemoteDir+strItem;
820 } 823 }
821 } else { 824 } else {
822// QCopEnvelope ( "QPE/System", "notBusy()" ); 825// QCopEnvelope ( "QPE/System", "notBusy()" );
823 return; 826 return;
824 } 827 }
825 } 828 }
826 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 829 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
827 if(currentRemoteDir.right(1) !="/") 830 if(currentRemoteDir.right(1) !="/")
828 currentRemoteDir +="/"; 831 currentRemoteDir +="/";
@@ -857,25 +860,25 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem)
857 populateLocalView(); 860 populateLocalView();
858 } else { 861 } else {
859 currentDir.cdUp(); 862 currentDir.cdUp();
860 populateLocalView(); 863 populateLocalView();
861 } 864 }
862 if(QDir(strItem).exists()){ 865 if(QDir(strItem).exists()){
863 currentDir.cd(strItem, TRUE); 866 currentDir.cd(strItem, TRUE);
864 populateLocalView(); 867 populateLocalView();
865 } 868 }
866 } else { 869 } else {
867 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 870 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
868 if( QFile::exists(strItem ) ) { 871 if( QFile::exists(strItem ) ) {
869 // qDebug("upload "+strItem); 872 // odebug << "upload "+strItem << oendl;
870 return; 873 return;
871 } 874 }
872 } //end not symlink 875 } //end not symlink
873 chdir(strItem.latin1()); 876 chdir(strItem.latin1());
874 } 877 }
875 Local_View->ensureItemVisible(Local_View->firstChild()); 878 Local_View->ensureItemVisible(Local_View->firstChild());
876 } 879 }
877} 880}
878 881
879void OpieFtp::doLocalCd() 882void OpieFtp::doLocalCd()
880{ 883{
881 localListClicked( Local_View->currentItem()); 884 localListClicked( Local_View->currentItem());
@@ -1161,25 +1164,25 @@ void OpieFtp::fillRemoteCombo(const QString &currentPath) {
1161 1164
1162 currentPathCombo->lineEdit()->setText(currentPath); 1165 currentPathCombo->lineEdit()->setText(currentPath);
1163 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1166 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1164 currentPathCombo->clear(); 1167 currentPathCombo->clear();
1165 remoteDirPathStringList.prepend(currentPath ); 1168 remoteDirPathStringList.prepend(currentPath );
1166 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1169 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1167 } 1170 }
1168} 1171}
1169 1172
1170void OpieFtp::currentPathComboChanged() 1173void OpieFtp::currentPathComboChanged()
1171{ 1174{
1172 QString oldRemoteCurrentDir = currentRemoteDir; 1175 QString oldRemoteCurrentDir = currentRemoteDir;
1173// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); 1176// odebug << "oldRemoteCurrentDir "+oldRemoteCurrentDir << oendl;
1174 if (TabWidget->currentPageIndex() == 0) { 1177 if (TabWidget->currentPageIndex() == 0) {
1175 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 1178 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
1176 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 1179 currentDir.setPath( currentPathCombo->lineEdit()->text() );
1177 populateLocalView(); 1180 populateLocalView();
1178 } else { 1181 } else {
1179 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 1182 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
1180 } 1183 }
1181 } 1184 }
1182 if (TabWidget->currentPageIndex() == 1) { 1185 if (TabWidget->currentPageIndex() == 1) {
1183 currentRemoteDir = currentPathCombo->lineEdit()->text(); 1186 currentRemoteDir = currentPathCombo->lineEdit()->text();
1184 if(currentRemoteDir.right(1) !="/") { 1187 if(currentRemoteDir.right(1) !="/") {
1185 currentRemoteDir = currentRemoteDir +"/"; 1188 currentRemoteDir = currentRemoteDir +"/";
@@ -1207,32 +1210,32 @@ void OpieFtp::switchToRemoteTab()
1207void OpieFtp::switchToConfigTab() 1210void OpieFtp::switchToConfigTab()
1208{ 1211{
1209 TabWidget->setCurrentPage(2); 1212 TabWidget->setCurrentPage(2);
1210} 1213}
1211 1214
1212void OpieFtp::readConfig() 1215void OpieFtp::readConfig()
1213{ 1216{
1214 fillCombos(); 1217 fillCombos();
1215 Config cfg("opieftp"); 1218 Config cfg("opieftp");
1216 cfg.setGroup("Server"); 1219 cfg.setGroup("Server");
1217 currentServerConfig = cfg.readNumEntry("currentServer", -1); 1220 currentServerConfig = cfg.readNumEntry("currentServer", -1);
1218 1221
1219// qDebug("Reading %d", currentServerConfig); 1222// odebug << "Reading " << currentServerConfig << "" << oendl;
1220 serverComboSelected( currentServerConfig-1); 1223 serverComboSelected( currentServerConfig-1);
1221 1224
1222} 1225}
1223 1226
1224void OpieFtp::writeConfig() 1227void OpieFtp::writeConfig()
1225{ 1228{
1226 qDebug("write config"); 1229 odebug << "write config" << oendl;
1227 Config cfg("opieftp"); 1230 Config cfg("opieftp");
1228 cfg.setGroup("Server"); 1231 cfg.setGroup("Server");
1229 1232
1230 QString username, remoteServerStr, remotePathStr, password, port, temp; 1233 QString username, remoteServerStr, remotePathStr, password, port, temp;
1231 1234
1232 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1235 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1233 1236
1234 if( currentServerConfig == -1) { 1237 if( currentServerConfig == -1) {
1235 1238
1236 for (int i = 1; i <= numberOfEntries; i++) { 1239 for (int i = 1; i <= numberOfEntries; i++) {
1237 temp.setNum(i); 1240 temp.setNum(i);
1238 cfg.setGroup("Server"); 1241 cfg.setGroup("Server");
@@ -1245,133 +1248,133 @@ void OpieFtp::writeConfig()
1245 remoteServerStr = cfg.readEntry( temp,""); 1248 remoteServerStr = cfg.readEntry( temp,"");
1246 1249
1247 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1250 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1248 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1251 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1249 1252
1250 temp.setNum(numberOfEntries+1); 1253 temp.setNum(numberOfEntries+1);
1251 cfg.setGroup("Server"); 1254 cfg.setGroup("Server");
1252 1255
1253 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); 1256 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() );
1254 cfg.writeEntry("currentServer", numberOfEntries+1); 1257 cfg.writeEntry("currentServer", numberOfEntries+1);
1255 1258
1256 currentServerConfig = numberOfEntries+1; 1259 currentServerConfig = numberOfEntries+1;
1257 qDebug("setting currentserverconfig to %d", currentServerConfig); 1260 odebug << "setting currentserverconfig to " << currentServerConfig << "" << oendl;
1258 1261
1259 cfg.setGroup(temp); 1262 cfg.setGroup(temp);
1260 if(!newServerName.isEmpty()) 1263 if(!newServerName.isEmpty())
1261 cfg.writeEntry("ServerName", newServerName); 1264 cfg.writeEntry("ServerName", newServerName);
1262 1265
1263 cfg.writeEntry("RemotePath", remotePath->text()); 1266 cfg.writeEntry("RemotePath", remotePath->text());
1264 1267
1265 cfg.writeEntry("Username", UsernameComboBox->currentText()); 1268 cfg.writeEntry("Username", UsernameComboBox->currentText());
1266 1269
1267 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); 1270 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text());
1268 cfg.setGroup("Server"); 1271 cfg.setGroup("Server");
1269 1272
1270 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); 1273 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 ));
1271 1274
1272 } 1275 }
1273} 1276}
1274 1277
1275void OpieFtp::clearCombos() { 1278void OpieFtp::clearCombos() {
1276 qDebug("clearing"); 1279 odebug << "clearing" << oendl;
1277 ServerComboBox->clear(); 1280 ServerComboBox->clear();
1278 UsernameComboBox->clear(); 1281 UsernameComboBox->clear();
1279 PasswordEdit->clear(); 1282 PasswordEdit->clear();
1280 serverListView->clear(); 1283 serverListView->clear();
1281} 1284}
1282 1285
1283 1286
1284void OpieFtp::fillCombos() 1287void OpieFtp::fillCombos()
1285{ 1288{
1286 clearCombos(); 1289 clearCombos();
1287 1290
1288 Config cfg("opieftp"); 1291 Config cfg("opieftp");
1289 cfg.setGroup("Server"); 1292 cfg.setGroup("Server");
1290 QString username, remoteServerStr, remotePathStr, password, port, temp; 1293 QString username, remoteServerStr, remotePathStr, password, port, temp;
1291 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1294 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1292 1295
1293 for (int i = 1; i <= numberOfEntries; i++) { 1296 for (int i = 1; i <= numberOfEntries; i++) {
1294 temp.setNum(i); 1297 temp.setNum(i);
1295 qDebug(temp); 1298 odebug << temp << oendl;
1296 cfg.setGroup("Server"); 1299 cfg.setGroup("Server");
1297 remoteServerStr = cfg.readEntry( temp,""); 1300 remoteServerStr = cfg.readEntry( temp,"");
1298 qDebug( remoteServerStr); 1301 odebug << remoteServerStr << oendl;
1299 1302
1300 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1303 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1301 port = remoteServerStr.right( divider - 1); 1304 port = remoteServerStr.right( divider - 1);
1302 bool ok; 1305 bool ok;
1303 PortSpinBox->setValue( port.toInt(&ok,10)); 1306 PortSpinBox->setValue( port.toInt(&ok,10));
1304 1307
1305 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1308 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1306 qDebug( "remote server string "+remoteServerStr); 1309 odebug << "remote server string "+remoteServerStr << oendl;
1307 ServerComboBox->insertItem( remoteServerStr ); 1310 ServerComboBox->insertItem( remoteServerStr );
1308 1311
1309 cfg.setGroup(temp); 1312 cfg.setGroup(temp);
1310 1313
1311 username = cfg.readEntry(temp); 1314 username = cfg.readEntry(temp);
1312 UsernameComboBox->insertItem(username); 1315 UsernameComboBox->insertItem(username);
1313 password = cfg.readEntryCrypt(username,""); 1316 password = cfg.readEntryCrypt(username,"");
1314 PasswordEdit->setText(password); 1317 PasswordEdit->setText(password);
1315 1318
1316 serverListView->insertItem( cfg.readEntry("ServerName")); 1319 serverListView->insertItem( cfg.readEntry("ServerName"));
1317 } 1320 }
1318} 1321}
1319 1322
1320 1323
1321void OpieFtp::serverComboSelected(int index) 1324void OpieFtp::serverComboSelected(int index)
1322{ 1325{
1323 currentServerConfig = index+1; 1326 currentServerConfig = index+1;
1324 qDebug("server combo selected %d", index+1); 1327 odebug << "server combo selected " << index+1 << "" << oendl;
1325 QString username, remoteServerStr, remotePathStr, password, port, temp; 1328 QString username, remoteServerStr, remotePathStr, password, port, temp;
1326// remoteServerStr = ServerComboBox->text(index); 1329// remoteServerStr = ServerComboBox->text(index);
1327 1330
1328 Config cfg("opieftp"); 1331 Config cfg("opieftp");
1329 cfg.setGroup("Server"); 1332 cfg.setGroup("Server");
1330// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1333// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1331 1334
1332 temp.setNum(index+1); 1335 temp.setNum(index+1);
1333 remoteServerStr = cfg.readEntry( temp,""); 1336 remoteServerStr = cfg.readEntry( temp,"");
1334 1337
1335 qDebug("Group" +temp); 1338 odebug << "Group" +temp << oendl;
1336 cfg.setGroup(temp); 1339 cfg.setGroup(temp);
1337// qDebug(temp); 1340// odebug << temp << oendl;
1338 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1341 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1339 port = remoteServerStr.right( divider - 1); 1342 port = remoteServerStr.right( divider - 1);
1340 bool ok; 1343 bool ok;
1341 int portInt = port.toInt(&ok,10); 1344 int portInt = port.toInt(&ok,10);
1342 if( portInt == 0) portInt = 21; 1345 if( portInt == 0) portInt = 21;
1343 1346
1344 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); 1347 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE)));
1345 1348
1346 PortSpinBox->setValue( portInt); 1349 PortSpinBox->setValue( portInt);
1347 1350
1348 remotePath->setText(cfg.readEntry("RemotePath", "/")); 1351 remotePath->setText(cfg.readEntry("RemotePath", "/"));
1349 1352
1350 username = cfg.readEntry("Username", "anonymous"); 1353 username = cfg.readEntry("Username", "anonymous");
1351 UsernameComboBox->lineEdit()->setText(username); 1354 UsernameComboBox->lineEdit()->setText(username);
1352 qDebug(username); 1355 odebug << username << oendl;
1353// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); 1356// odebug << "Password is "+cfg.readEntryCrypt(username << oendl;
1354 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); 1357 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
1355// UsernameComboBox 1358// UsernameComboBox
1356// PasswordEdit 1359// PasswordEdit
1357 1360
1358 cfg.setGroup("Server"); 1361 cfg.setGroup("Server");
1359 temp.sprintf("%d",currentServerConfig); 1362 temp.sprintf("%d",currentServerConfig);
1360 cfg.writeEntry("currentServer", temp); 1363 cfg.writeEntry("currentServer", temp);
1361 1364
1362 fuckeduphack = TRUE; 1365 fuckeduphack = TRUE;
1363 serverListView->setCurrentItem( index); 1366 serverListView->setCurrentItem( index);
1364 fuckeduphack=FALSE; 1367 fuckeduphack=FALSE;
1365 qDebug("server list set selected %d",index); 1368 odebug << "server list set selected " << index << "" << oendl;
1366 update(); 1369 update();
1367} 1370}
1368 1371
1369void OpieFtp::deleteServer() 1372void OpieFtp::deleteServer()
1370{ 1373{
1371 QString username, remoteServerStr, remotePathStr, password, port, temp, servername; 1374 QString username, remoteServerStr, remotePathStr, password, port, temp, servername;
1372 remoteServerStr = ServerComboBox->currentText( ); 1375 remoteServerStr = ServerComboBox->currentText( );
1373 username = UsernameComboBox->currentText(); 1376 username = UsernameComboBox->currentText();
1374 servername=serverListView->currentText(); 1377 servername=serverListView->currentText();
1375 1378
1376 Config cfg("opieftp"); 1379 Config cfg("opieftp");
1377 cfg.setGroup("Server"); 1380 cfg.setGroup("Server");
@@ -1382,25 +1385,25 @@ void OpieFtp::deleteServer()
1382 temp.setNum(i); 1385 temp.setNum(i);
1383// cfg.setGroup("Server"); 1386// cfg.setGroup("Server");
1384 cfg.setGroup(QString::number(i)); 1387 cfg.setGroup(QString::number(i));
1385 tempname=cfg.readEntry( "ServerName",""); 1388 tempname=cfg.readEntry( "ServerName","");
1386 1389
1387 if( tempname.find( servername,0,TRUE) != -1 ) { 1390 if( tempname.find( servername,0,TRUE) != -1 ) {
1388// servername.find( cfg.readEntry("ServerName")) != -1 && 1391// servername.find( cfg.readEntry("ServerName")) != -1 &&
1389// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && 1392// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 &&
1390// username.find( cfg.readEntry("Username")) != -1) { 1393// username.find( cfg.readEntry("Username")) != -1) {
1391 1394
1392 serverListView->removeItem(i); 1395 serverListView->removeItem(i);
1393 1396
1394 qDebug("OK DELETE "+tempname); 1397 odebug << "OK DELETE "+tempname << oendl;
1395 cfg.removeEntry(QString::number(i)); 1398 cfg.removeEntry(QString::number(i));
1396 for ( ; i <= numberOfEntries; i++) { 1399 for ( ; i <= numberOfEntries; i++) {
1397 cfg.setGroup("Server"); 1400 cfg.setGroup("Server");
1398 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); 1401 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 ));
1399 1402
1400 cfg.setGroup(QString::number(i+1)); //get next server config 1403 cfg.setGroup(QString::number(i+1)); //get next server config
1401 servername=cfg.readEntry("ServerName"); 1404 servername=cfg.readEntry("ServerName");
1402 remoteServerStr=cfg.readEntry("RemotePath"); 1405 remoteServerStr=cfg.readEntry("RemotePath");
1403 username=cfg.readEntry("Username"); 1406 username=cfg.readEntry("Username");
1404 password=cfg.readEntryCrypt( username); 1407 password=cfg.readEntryCrypt( username);
1405 1408
1406 cfg.setGroup(QString::number(i)); 1409 cfg.setGroup(QString::number(i));
@@ -1437,33 +1440,33 @@ void OpieFtp::upDir()
1437 dir.cdUp(); 1440 dir.cdUp();
1438 current = dir.canonicalPath(); 1441 current = dir.canonicalPath();
1439 chdir( current.latin1() ); 1442 chdir( current.latin1() );
1440 currentDir.cd( current, TRUE); 1443 currentDir.cd( current, TRUE);
1441 populateLocalView(); 1444 populateLocalView();
1442 update(); 1445 update();
1443 } else { 1446 } else {
1444 if( FtpCDUp( conn) == 0) { 1447 if( FtpCDUp( conn) == 0) {
1445 QString msg; 1448 QString msg;
1446 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 1449 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
1447 msg.replace(QRegExp(":"),"\n"); 1450 msg.replace(QRegExp(":"),"\n");
1448 QMessageBox::message(tr("Note"),msg); 1451 QMessageBox::message(tr("Note"),msg);
1449// qDebug(msg); 1452// odebug << msg << oendl;
1450 } 1453 }
1451 char path[256]; 1454 char path[256];
1452 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 1455 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
1453 QString msg; 1456 QString msg;
1454 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 1457 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
1455 msg.replace(QRegExp(":"),"\n"); 1458 msg.replace(QRegExp(":"),"\n");
1456 QMessageBox::message(tr("Note"),msg); 1459 QMessageBox::message(tr("Note"),msg);
1457// qDebug(msg); 1460// odebug << msg << oendl;
1458 } 1461 }
1459 currentRemoteDir=path; 1462 currentRemoteDir=path;
1460 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1463 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1461 if(currentRemoteDir.right(1) !="/") 1464 if(currentRemoteDir.right(1) !="/")
1462 currentRemoteDir +="/"; 1465 currentRemoteDir +="/";
1463 currentPathCombo->lineEdit()->setText( currentRemoteDir); 1466 currentPathCombo->lineEdit()->setText( currentRemoteDir);
1464 fillRemoteCombo( (const QString &)currentRemoteDir); 1467 fillRemoteCombo( (const QString &)currentRemoteDir);
1465 1468
1466 } 1469 }
1467} 1470}
1468 1471
1469void OpieFtp::docButtonPushed() { 1472void OpieFtp::docButtonPushed() {
@@ -1506,24 +1509,24 @@ void OpieFtp::NewServer() {
1506 } 1509 }
1507 } 1510 }
1508 currentServerConfig =-1; 1511 currentServerConfig =-1;
1509 writeConfig(); 1512 writeConfig();
1510 serverListView->insertItem( newServerName ); 1513 serverListView->insertItem( newServerName );
1511 serverListView->setCurrentItem( serverListView->count()); 1514 serverListView->setCurrentItem( serverListView->count());
1512 } 1515 }
1513} 1516}
1514 1517
1515void OpieFtp::serverListClicked( const QString &item) { 1518void OpieFtp::serverListClicked( const QString &item) {
1516 if(item.isEmpty()) return; 1519 if(item.isEmpty()) return;
1517 Config cfg("opieftp"); 1520 Config cfg("opieftp");
1518 qDebug("highltined "+item); 1521 odebug << "highltined "+item << oendl;
1519 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1522 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1520 for (int i = 1; i <= numberOfEntries; i++) { 1523 for (int i = 1; i <= numberOfEntries; i++) {
1521 cfg.setGroup(QString::number(i)); 1524 cfg.setGroup(QString::number(i));
1522 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) 1525 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack)
1523 serverComboSelected(i-1); 1526 serverComboSelected(i-1);
1524 } 1527 }
1525} 1528}
1526 1529
1527void OpieFtp::timerOut() { 1530void OpieFtp::timerOut() {
1528 1531
1529} 1532}
diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro
index 2f97dc2..003b166 100644
--- a/noncore/net/opieftp/opieftp.pro
+++ b/noncore/net/opieftp/opieftp.pro
@@ -1,11 +1,10 @@
1#CONFIG += qt warn_on quick-app 1CONFIG += qt warn_on
2CONFIG += qt warn_on 2HEADERS = opieftp.h inputDialog.h
3HEADERS = opieftp.h inputDialog.h 3SOURCES = opieftp.cpp inputDialog.cpp main.cpp
4SOURCES = opieftp.cpp inputDialog.cpp main.cpp 4TARGET = opieftp
5TARGET = opieftp
6INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lqpe -lftplib 7LIBS += -lqpe -lopiecore2 -lftplib
9DESTDIR = $(OPIEDIR)/bin 8DESTDIR = $(OPIEDIR)/bin
10 9
11include ( $(OPIEDIR)/include.pro ) 10include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/opieirc/config.in b/noncore/net/opieirc/config.in
index a61cf70..2c56523 100644
--- a/noncore/net/opieirc/config.in
+++ b/noncore/net/opieirc/config.in
@@ -1,4 +1,4 @@
1 config OPIEIRC 1 config OPIEIRC
2 boolean "opie-irc (chat via your favorite IRC server)" 2 boolean "opie-irc (chat via your favorite IRC server)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && LIBQTAUX 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBQTAUX
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index 22387b3..6d93a34 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -1,15 +1,18 @@
1#include <stdio.h>
2#include "ircmisc.h" 1#include "ircmisc.h"
3 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
4IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { 7IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
5} 8}
6 9
7int IRCTabBar::insertTab(QTab *tab, int index) { 10int IRCTabBar::insertTab(QTab *tab, int index) {
8 /* FIXME: find some nicer way to do this */ 11 /* FIXME: find some nicer way to do this */
9 QExtTab *ext = new QExtTab(); 12 QExtTab *ext = new QExtTab();
10 ext->color = black; 13 ext->color = black;
11 ext->label = tab->text(); 14 ext->label = tab->text();
12 ext->r = tab->rect(); 15 ext->r = tab->rect();
13 ext->enabled = tab->isEnabled(); 16 ext->enabled = tab->isEnabled();
14 ext->iconset = tab->iconSet(); 17 ext->iconset = tab->iconSet();
15 delete tab; 18 delete tab;
@@ -55,29 +58,29 @@ void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
55 if (m_history.count() > 0 && m_index > 0) { 58 if (m_history.count() > 0 && m_index > 0) {
56 m_index--; 59 m_index--;
57 setText(m_history[m_index]); 60 setText(m_history[m_index]);
58 } 61 }
59 if (m_index == 0) { 62 if (m_index == 0) {
60 m_index = -1; 63 m_index = -1;
61 setText(""); 64 setText("");
62 } 65 }
63 } else if (key == Key_Return) { 66 } else if (key == Key_Return) {
64 m_history.prepend(text()); 67 m_history.prepend(text());
65 m_index = -1; 68 m_index = -1;
66 } else if (key == Key_Tab) { 69 } else if (key == Key_Tab) {
67 printf("got tab\n"); 70 odebug << "got tab" << oendl;
68 return; 71 return;
69 } 72 }
70 QLineEdit::keyPressEvent(event); 73 QLineEdit::keyPressEvent(event);
71} 74}
72 75
73bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { 76bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) {
74 if (event->type() == QEvent::KeyPress) { 77 if (event->type() == QEvent::KeyPress) {
75 QKeyEvent *k = (QKeyEvent *) event; 78 QKeyEvent *k = (QKeyEvent *) event;
76 /* Catch tab characters */ 79 /* Catch tab characters */
77 if (k->key() == Key_Tab) { 80 if (k->key() == Key_Tab) {
78 qDebug("tab!"); 81 odebug << "tab!" << oendl;
79 return TRUE; 82 return TRUE;
80 } 83 }
81 } 84 }
82 return QLineEdit::eventFilter(object, event); 85 return QLineEdit::eventFilter(object, event);
83} 86}
diff --git a/noncore/net/opieirc/opieirc.pro b/noncore/net/opieirc/opieirc.pro
index 4f9092f..2455ec4 100644
--- a/noncore/net/opieirc/opieirc.pro
+++ b/noncore/net/opieirc/opieirc.pro
@@ -1,25 +1,24 @@
1 CONFIG = qt warn_on quick-app 1 CONFIG = qt warn_on quick-app
2 HEADERS = ircchannel.h ircconnection.h \ 2HEADERS = ircchannel.h ircconnection.h \
3 ircmessage.h \ 3 ircmessage.h \
4 ircmessageparser.h ircoutput.h \ 4 ircmessageparser.h ircoutput.h \
5 ircperson.h ircserver.h ircsession.h \ 5 ircperson.h ircserver.h ircsession.h \
6 mainwindow.h irctab.h ircservertab.h \ 6 mainwindow.h irctab.h ircservertab.h \
7 ircchanneltab.h ircchannellist.h \ 7 ircchanneltab.h ircchannellist.h \
8 ircserverlist.h ircservereditor.h \ 8 ircserverlist.h ircservereditor.h \
9 ircquerytab.h ircsettings.h ircmisc.h 9 ircquerytab.h ircsettings.h ircmisc.h
10 SOURCES = ircchannel.cpp ircconnection.cpp \ 10 SOURCES = ircchannel.cpp ircconnection.cpp \
11 ircmessage.cpp \ 11 ircmessage.cpp \
12 ircmessageparser.cpp ircoutput.cpp \ 12 ircmessageparser.cpp ircoutput.cpp \
13 ircperson.cpp ircserver.cpp \ 13 ircperson.cpp ircserver.cpp \
14 ircsession.cpp main.cpp mainwindow.cpp \ 14 ircsession.cpp main.cpp mainwindow.cpp \
15 irctab.cpp ircservertab.cpp \ 15 irctab.cpp ircservertab.cpp \
16 ircchanneltab.cpp ircchannellist.cpp \ 16 ircchanneltab.cpp ircchannellist.cpp \
17 ircserverlist.cpp ircservereditor.cpp \ 17 ircserverlist.cpp ircservereditor.cpp \
18 ircquerytab.cpp ircsettings.cpp ircmisc.cpp 18 ircquerytab.cpp ircsettings.cpp ircmisc.cpp
19INCLUDEPATH += $(OPIEDIR)/include 19INCLUDEPATH += $(OPIEDIR)/include
20 DEPENDPATH+= $(OPIEDIR)/include 20DEPENDPATH += $(OPIEDIR)/include
21LIBS += -lqpe -lopieui2 -lqtaux2 21LIBS += -lqpe -lopiecore2 -lopieui2 -lqtaux2
22 22TARGET = opieirc
23 TARGET= opieirc
24 23
25include ( $(OPIEDIR)/include.pro ) 24include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index 8a7f0bc..1d93f5c 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -197,25 +197,25 @@ namespace OpieTooth {
197 197
198 if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { 198 if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) {
199 update(); 199 update();
200 } 200 }
201 } 201 }
202 202
203/** 203/**
204 * Implementation of the paint event 204 * Implementation of the paint event
205 * @param the QPaintEvent 205 * @param the QPaintEvent
206 */ 206 */
207 void BluezApplet::paintEvent( QPaintEvent* ) { 207 void BluezApplet::paintEvent( QPaintEvent* ) {
208 QPainter p(this); 208 QPainter p(this);
209 qDebug("paint bluetooth pixmap"); 209 odebug << "paint bluetooth pixmap" << oendl;
210 210
211 if (bluezactive > 0) { 211 if (bluezactive > 0) {
212 p.drawPixmap( 0, 1, bluezOnPixmap ); 212 p.drawPixmap( 0, 1, bluezOnPixmap );
213 } else { 213 } else {
214 p.drawPixmap( 0, 1, bluezOffPixmap ); 214 p.drawPixmap( 0, 1, bluezOffPixmap );
215 } 215 }
216 216
217 if (bluezDiscoveryActive > 0) { 217 if (bluezDiscoveryActive > 0) {
218 p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); 218 p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap );
219 } 219 }
220 } 220 }
221}; 221};
diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp
index 09b19d2..37f2ae7 100644
--- a/noncore/net/opietooth/lib/startdunconnection.cpp
+++ b/noncore/net/opietooth/lib/startdunconnection.cpp
@@ -36,25 +36,25 @@ StartConnection::ConnectionType StartDunConnection::type() {
36 return m_connectionType; 36 return m_connectionType;
37} 37}
38 38
39void StartDunConnection::start() { 39void StartDunConnection::start() {
40 m_dunConnect = new OProcess(); 40 m_dunConnect = new OProcess();
41 *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; 41 *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac;
42 42
43 connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , 43 connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
44 this, SLOT( slotExited(Opie::Core::OProcess*) ) ); 44 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
45 connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), 45 connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
46 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); 46 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
47 if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 47 if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
48 qWarning( "could not start" ); 48 owarn << "could not start" << oendl;
49 delete m_dunConnect; 49 delete m_dunConnect;
50 } 50 }
51} 51}
52 52
53 53
54void StartDunConnection::slotExited( OProcess* proc ) { 54void StartDunConnection::slotExited( OProcess* proc ) {
55 delete m_dunConnect; 55 delete m_dunConnect;
56} 56}
57 57
58void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) 58void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len)
59{} 59{}
60 60
diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp
index 24ac530..50afc9f 100644
--- a/noncore/net/opietooth/lib/startpanconnection.cpp
+++ b/noncore/net/opietooth/lib/startpanconnection.cpp
@@ -30,55 +30,55 @@ QString StartPanConnection::name() {
30} 30}
31 31
32void StartPanConnection::setConnectionType() { 32void StartPanConnection::setConnectionType() {
33 m_connectionType = Pan; 33 m_connectionType = Pan;
34} 34}
35 35
36StartConnection::ConnectionType StartPanConnection::type() { 36StartConnection::ConnectionType StartPanConnection::type() {
37 return m_connectionType; 37 return m_connectionType;
38} 38}
39 39
40void StartPanConnection::start() { 40void StartPanConnection::start() {
41 m_panConnect = new OProcess(); 41 m_panConnect = new OProcess();
42 qDebug( "IM START " + m_mac ); 42 odebug << "IM START " + m_mac << oendl;
43 *m_panConnect << "pand" << "--connect" << m_mac; 43 *m_panConnect << "pand" << "--connect" << m_mac;
44 44
45 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , 45 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
46 this, SLOT( slotExited(Opie::Core::OProcess*) ) ); 46 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
47 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), 47 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
48 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); 48 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
49 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 49 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
50 qWarning( "could not start" ); 50 owarn << "could not start" << oendl;
51 delete m_panConnect; 51 delete m_panConnect;
52 } 52 }
53} 53}
54 54
55 55
56void StartPanConnection::slotExited( OProcess* proc ) { 56void StartPanConnection::slotExited( OProcess* proc ) {
57 delete m_panConnect; 57 delete m_panConnect;
58 m_panConnect = 0l; 58 m_panConnect = 0l;
59} 59}
60 60
61void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) 61void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len)
62{} 62{}
63 63
64 64
65void StartPanConnection::stop() { 65void StartPanConnection::stop() {
66 if ( m_panConnect ) { 66 if ( m_panConnect ) {
67 delete m_panConnect; 67 delete m_panConnect;
68 m_panConnect = 0l; 68 m_panConnect = 0l;
69 } 69 }
70 m_panConnect = new OProcess(); 70 m_panConnect = new OProcess();
71 qDebug("IM STOP " + m_mac); 71 odebug << "IM STOP " + m_mac << oendl;
72 72
73 *m_panConnect << "pand" << "--kill" << m_mac; 73 *m_panConnect << "pand" << "--kill" << m_mac;
74 74
75 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , 75 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
76 this, SLOT( slotExited(Opie::Core::OProcess*) ) ); 76 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
77 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), 77 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
78 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); 78 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
79 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 79 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
80 qWarning( "could not stop" ); 80 owarn << "could not stop" << oendl;
81 delete m_panConnect; 81 delete m_panConnect;
82 } 82 }
83} 83}
84 84
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 29030ab..b1cddd2 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -146,25 +146,25 @@ void BlueBase::writeConfig()
146 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); 146 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification );
147 cfg.writeEntry( "enablePagescan" , m_enablePagescan ); 147 cfg.writeEntry( "enablePagescan" , m_enablePagescan );
148 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); 148 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan );
149 149
150 writeToHciConfig(); 150 writeToHciConfig();
151} 151}
152 152
153/** 153/**
154 * Modify the hcid.conf file to our needs 154 * Modify the hcid.conf file to our needs
155 */ 155 */
156void BlueBase::writeToHciConfig() 156void BlueBase::writeToHciConfig()
157{ 157{
158 qWarning("writeToHciConfig"); 158 owarn << "writeToHciConfig" << oendl;
159 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); 159 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
160 hciconf.load(); 160 hciconf.load();
161 hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" ); 161 hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" );
162 hciconf.setName( m_deviceName ); 162 hciconf.setName( m_deviceName );
163 hciconf.setEncrypt( m_useEncryption ); 163 hciconf.setEncrypt( m_useEncryption );
164 hciconf.setAuth( m_enableAuthentification ); 164 hciconf.setAuth( m_enableAuthentification );
165 hciconf.setPscan( m_enablePagescan ); 165 hciconf.setPscan( m_enablePagescan );
166 hciconf.setIscan( m_enableInquiryscan ); 166 hciconf.setIscan( m_enableInquiryscan );
167 hciconf.save(); 167 hciconf.save();
168} 168}
169 169
170 170
@@ -358,81 +358,81 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
358 * delete the PopupMenu otherwise it's the responsibility of 358 * delete the PopupMenu otherwise it's the responsibility of
359 * the PopupMenu to delete itself 359 * the PopupMenu to delete itself
360 * 360 *
361 */ 361 */
362 else if ( ((BTListItem*)item)->type() == "service") 362 else if ( ((BTListItem*)item)->type() == "service")
363 { 363 {
364 BTServiceItem* service = (BTServiceItem*)item; 364 BTServiceItem* service = (BTServiceItem*)item;
365 QMap<int, QString> list = service->services().classIdList(); 365 QMap<int, QString> list = service->services().classIdList();
366 QMap<int, QString>::Iterator it = list.begin(); 366 QMap<int, QString>::Iterator it = list.begin();
367 QPopupMenu *popup =0l; 367 QPopupMenu *popup =0l;
368 if ( it != list.end() ) 368 if ( it != list.end() )
369 { 369 {
370 qWarning("Searching id %d %s", it.key(), it.data().latin1() ); 370 owarn << "Searching id " << it.key() << " " << it.data().latin1() << "" << oendl;
371 popup = m_popHelper.find( it.key(), 371 popup = m_popHelper.find( it.key(),
372 service->services(), 372 service->services(),
373 (BTDeviceItem*)service->parent() ); 373 (BTDeviceItem*)service->parent() );
374 } 374 }
375 else 375 else
376 { 376 {
377 qWarning("Empty"); 377 owarn << "Empty" << oendl;
378 } 378 }
379 379
380 if ( popup == 0l ) 380 if ( popup == 0l )
381 { 381 {
382 qWarning("factory returned 0l"); 382 owarn << "factory returned 0l" << oendl;
383 popup = new QPopupMenu(); 383 popup = new QPopupMenu();
384 } 384 }
385 int test1 = popup->insertItem( tr("Test1:"), 2); 385 int test1 = popup->insertItem( tr("Test1:"), 2);
386 386
387 ret = popup->exec( point ); 387 ret = popup->exec( point );
388 qWarning("returned from exec() "); 388 owarn << "returned from exec() " << oendl;
389 if ( ret == -1 ) 389 if ( ret == -1 )
390 { 390 {
391 ; 391 ;
392 } 392 }
393 else if ( ret == test1 ) 393 else if ( ret == test1 )
394 { 394 {
395 ; 395 ;
396 } 396 }
397 delete popup; 397 delete popup;
398 } 398 }
399 delete menu; 399 delete menu;
400} 400}
401 401
402 402
403/** 403/**
404 * Search and display avail. services for a device (on expand from device listing) 404 * Search and display avail. services for a device (on expand from device listing)
405 * @param item the service item returned 405 * @param item the service item returned
406 */ 406 */
407void BlueBase::addServicesToDevice( BTDeviceItem * item ) 407void BlueBase::addServicesToDevice( BTDeviceItem * item )
408{ 408{
409 qDebug("addServicesToDevice"); 409 odebug << "addServicesToDevice" << oendl;
410 // row of mac adress text(3) 410 // row of mac adress text(3)
411 RemoteDevice device = item->remoteDevice(); 411 RemoteDevice device = item->remoteDevice();
412 m_deviceList.insert( item->mac() , item ); 412 m_deviceList.insert( item->mac() , item );
413 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 413 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
414 m_localDevice->searchServices( device ); 414 m_localDevice->searchServices( device );
415} 415}
416 416
417 417
418/** 418/**
419 * Overloaded. This one it the one that is 419 * Overloaded. This one it the one that is
420 ted to the foundServices signal 420 ted to the foundServices signal
421 * @param device the mac address of the remote device 421 * @param device the mac address of the remote device
422 * @param servicesList the list with the service the device has. 422 * @param servicesList the list with the service the device has.
423 */ 423 */
424void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) 424void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList )
425{ 425{
426 qDebug("fill services list"); 426 odebug << "fill services list" << oendl;
427 427
428 QMap<QString,BTDeviceItem*>::Iterator it; 428 QMap<QString,BTDeviceItem*>::Iterator it;
429 BTDeviceItem* deviceItem = 0; 429 BTDeviceItem* deviceItem = 0;
430 430
431 // get the right devices which requested the search 431 // get the right devices which requested the search
432 it = m_deviceList.find( device ); 432 it = m_deviceList.find( device );
433 if( it == m_deviceList.end() ) 433 if( it == m_deviceList.end() )
434 return; 434 return;
435 deviceItem = it.data(); 435 deviceItem = it.data();
436 436
437 // remove previous entries 437 // remove previous entries
438 QList<QListViewItem> tempList; 438 QList<QListViewItem> tempList;
@@ -598,25 +598,25 @@ void BlueBase::deviceActive( const RemoteDevice &device )
598 // We should have a BTDeviceItem there or where does it get added to the map -zecke 598 // We should have a BTDeviceItem there or where does it get added to the map -zecke
599 m_localDevice->isAvailable( device.mac() ); 599 m_localDevice->isAvailable( device.mac() );
600} 600}
601 601
602 602
603/** 603/**
604 * The signal catcher. Set the avail. status on device. 604 * The signal catcher. Set the avail. status on device.
605 * @param device - the mac address 605 * @param device - the mac address
606 * @param connected - if it is avail. or not 606 * @param connected - if it is avail. or not
607 */ 607 */
608void BlueBase::deviceActive( const QString& device, bool connected ) 608void BlueBase::deviceActive( const QString& device, bool connected )
609{ 609{
610 qDebug("deviceActive slot"); 610 odebug << "deviceActive slot" << oendl;
611 611
612 QMap<QString,BTDeviceItem*>::Iterator it; 612 QMap<QString,BTDeviceItem*>::Iterator it;
613 613
614 it = m_deviceList.find( device ); 614 it = m_deviceList.find( device );
615 if( it == m_deviceList.end() ) 615 if( it == m_deviceList.end() )
616 return; 616 return;
617 617
618 BTDeviceItem* deviceItem = it.data(); 618 BTDeviceItem* deviceItem = it.data();
619 619
620 620
621 if ( connected ) 621 if ( connected )
622 { 622 {
diff --git a/noncore/net/opietooth/manager/devicehandler.cpp b/noncore/net/opietooth/manager/devicehandler.cpp
index 9c5b817..bd34351 100644
--- a/noncore/net/opietooth/manager/devicehandler.cpp
+++ b/noncore/net/opietooth/manager/devicehandler.cpp
@@ -24,31 +24,31 @@ QString path = QDir::homeDirPath() + "/Settings/bluetooth";
24 QStringList devicesFileList = deviceListSave.entryList(); 24 QStringList devicesFileList = deviceListSave.entryList();
25 25
26 26
27 // cut .conf of to get the mac and also read the name entry in it. 27 // cut .conf of to get the mac and also read the name entry in it.
28 if (!devicesFileList.isEmpty() ) { 28 if (!devicesFileList.isEmpty() ) {
29 QString name; 29 QString name;
30 QString mac; 30 QString mac;
31 QStringList::Iterator it; 31 QStringList::Iterator it;
32 for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { 32 for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) {
33 if ( (*it) == "." || (*it) == ".." ) 33 if ( (*it) == "." || (*it) == ".." )
34 continue; 34 continue;
35 35
36 qDebug((*it).latin1() ); 36 odebug << (*it).latin1() << oendl;
37 Config conf(path + "/"+(*it), Config::File); 37 Config conf(path + "/"+(*it), Config::File);
38 conf.setGroup("Info"); 38 conf.setGroup("Info");
39 name = conf.readEntry("name", "Error"); 39 name = conf.readEntry("name", "Error");
40 mac = conf.readEntry("mac", QString::null); 40 mac = conf.readEntry("mac", QString::null);
41 qDebug("MAC: " + mac); 41 odebug << "MAC: " + mac << oendl;
42 qDebug("NAME: " + name); 42 odebug << "NAME: " + name << oendl;
43 if (mac.isEmpty() ) 43 if (mac.isEmpty() )
44 continue; 44 continue;
45 RemoteDevice currentDevice( mac , name ); 45 RemoteDevice currentDevice( mac , name );
46 list.append( currentDevice ); 46 list.append( currentDevice );
47 } 47 }
48 } 48 }
49 return list; 49 return list;
50}; 50};
51/* 51/*
52 * This is some how rude but make sure all old devices 52 * This is some how rude but make sure all old devices
53 * are getting deleted 53 * are getting deleted
54 */ 54 */
@@ -57,31 +57,31 @@ void DeviceHandler::save( const RemoteDevice::ValueList& list) {
57 rm += "rm -rf "; 57 rm += "rm -rf ";
58 rm += QDir::homeDirPath() + "/Settings/bluetooth"; 58 rm += QDir::homeDirPath() + "/Settings/bluetooth";
59 system ( rm.data() ); 59 system ( rm.data() );
60 60
61 if (list.isEmpty() ) // no need to create the dir 61 if (list.isEmpty() ) // no need to create the dir
62 return; 62 return;
63 63
64 /** 64 /**
65 * Create a new dir 65 * Create a new dir
66 */ 66 */
67 rm = "mkdir "; 67 rm = "mkdir ";
68 rm += QDir::homeDirPath() + "/Settings/bluetooth"; 68 rm += QDir::homeDirPath() + "/Settings/bluetooth";
69 qWarning("out %s", rm.data() ); 69 owarn << "out " << rm.data() << "" << oendl;
70 system( rm.data() ); 70 system( rm.data() );
71 71
72 RemoteDevice::ValueList::ConstIterator it; 72 RemoteDevice::ValueList::ConstIterator it;
73 // write the config 73 // write the config
74 74
75 for ( it = list.begin(); it != list.end(); ++it ) { 75 for ( it = list.begin(); it != list.end(); ++it ) {
76 qDebug( "/Settings/bluetooth/" + (*it).mac() + ".conf"); 76 odebug << "/Settings/bluetooth/" + (*it).mac() + ".conf" << oendl;
77 77
78 Config conf( QDir::homeDirPath() + 78 Config conf( QDir::homeDirPath() +
79 "/Settings/bluetooth/" + 79 "/Settings/bluetooth/" +
80 (*it).mac() + ".conf", Config::File ); 80 (*it).mac() + ".conf", Config::File );
81 81
82 conf.setGroup( "Info" ); 82 conf.setGroup( "Info" );
83 conf.writeEntry( "name", (*it).name() ); 83 conf.writeEntry( "name", (*it).name() );
84 conf.writeEntry( "mac", (*it).mac() ); 84 conf.writeEntry( "mac", (*it).mac() );
85 } 85 }
86 86
87} 87}
diff --git a/noncore/net/opietooth/manager/dunpopup.cpp b/noncore/net/opietooth/manager/dunpopup.cpp
index 3043f71..5b01d2f 100644
--- a/noncore/net/opietooth/manager/dunpopup.cpp
+++ b/noncore/net/opietooth/manager/dunpopup.cpp
@@ -2,25 +2,25 @@
2 2
3#include <qtimer.h> 3#include <qtimer.h>
4 4
5#include "dunpopup.h" 5#include "dunpopup.h"
6 6
7using namespace OpieTooth; 7using namespace OpieTooth;
8 8
9/* 9/*
10 * c'tor init the QAction 10 * c'tor init the QAction
11 */ 11 */
12DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { 12DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
13 13
14 qWarning("DunPopup c'tor"); 14 owarn << "DunPopup c'tor" << oendl;
15 15
16 m_item = item; 16 m_item = item;
17 QAction *a, *b, *c; 17 QAction *a, *b, *c;
18 18
19 m_dunconnection = 0l; 19 m_dunconnection = 0l;
20 /* connect action */ 20 /* connect action */
21 21
22 22
23 a = new QAction(); // so it's get deleted 23 a = new QAction(); // so it's get deleted
24 a->setText( tr("connect") ); 24 a->setText( tr("connect") );
25 a->addTo( this ); 25 a->addTo( this );
26 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); 26 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp
index 35e9cd9..71c935c 100644
--- a/noncore/net/opietooth/manager/hciconfwrapper.cpp
+++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp
@@ -65,75 +65,75 @@ namespace OpieTooth {
65 65
66 void HciConfWrapper::setValue(const QString &key, const QString &value ) { 66 void HciConfWrapper::setValue(const QString &key, const QString &value ) {
67 67
68 if (m_file.isEmpty() ) // load first 68 if (m_file.isEmpty() ) // load first
69 return; 69 return;
70 70
71 QStringList::Iterator it; 71 QStringList::Iterator it;
72 72
73 QString str; 73 QString str;
74 for (it = m_file.begin(); it != m_file.end(); ++it ) { 74 for (it = m_file.begin(); it != m_file.end(); ++it ) {
75 str = (*it); 75 str = (*it);
76 if( (str.contains(key)) > 0 ) { 76 if( (str.contains(key)) > 0 ) {
77 qDebug("Found"); 77 odebug << "Found" << oendl;
78 // still need to look if its commented out!!! 78 // still need to look if its commented out!!!
79 str.simplifyWhiteSpace(); 79 str.simplifyWhiteSpace();
80 qDebug( key ); 80 odebug << key << oendl;
81 if (str.startsWith("#")) { 81 if (str.startsWith("#")) {
82 str = (key + " " + value + ";"); 82 str = (key + " " + value + ";");
83 } else { 83 } else {
84 str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); 84 str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";");
85 } 85 }
86 qDebug( str ); 86 odebug << str << oendl;
87 it = m_file.remove( it ); 87 it = m_file.remove( it );
88 it = m_file.insert( it, str ); 88 it = m_file.insert( it, str );
89 //return; the regexp is too wide -zecke // all set 89 //return; the regexp is too wide -zecke // all set
90 } 90 }
91 } 91 }
92 92
93 93
94 } 94 }
95 95
96 /** 96 /**
97 * This loads the config file and stores it inside 97 * This loads the config file and stores it inside
98 * the m_file 98 * the m_file
99 */ 99 */
100 void HciConfWrapper::load() { 100 void HciConfWrapper::load() {
101 qWarning("loaded"); 101 owarn << "loaded" << oendl;
102 m_file.clear(); 102 m_file.clear();
103 QFile file( m_fileName ); 103 QFile file( m_fileName );
104 if (!file.open( IO_ReadOnly ) ) { 104 if (!file.open( IO_ReadOnly ) ) {
105 qDebug("Could not open"); 105 odebug << "Could not open" << oendl;
106 return; 106 return;
107 } 107 }
108 108
109 /** 109 /**
110 * readAll() into a QByteArray 110 * readAll() into a QByteArray
111 * QStringList::split('\n', array ) 111 * QStringList::split('\n', array )
112 * would this be faster? -zecke 112 * would this be faster? -zecke
113 */ 113 */
114 QTextStream stream(&file ); 114 QTextStream stream(&file );
115 QString tmp; 115 QString tmp;
116 while ( !stream.atEnd() ) { 116 while ( !stream.atEnd() ) {
117 tmp = stream.readLine(); 117 tmp = stream.readLine();
118 m_file.append( tmp ); 118 m_file.append( tmp );
119 } 119 }
120 } 120 }
121 void HciConfWrapper::save() { 121 void HciConfWrapper::save() {
122 qWarning("save"); 122 owarn << "save" << oendl;
123 if (m_file.isEmpty() ) // load first 123 if (m_file.isEmpty() ) // load first
124 return; 124 return;
125 125
126 QFile file( m_fileName ); 126 QFile file( m_fileName );
127 if ( !file.open(IO_WriteOnly ) ) { 127 if ( !file.open(IO_WriteOnly ) ) {
128 qWarning("could not open %s", m_fileName.latin1() ); 128 owarn << "could not open " << m_fileName.latin1() << "" << oendl;
129 return; 129 return;
130 } 130 }
131 131
132 QTextStream stream(&file ); 132 QTextStream stream(&file );
133 QStringList::Iterator it; 133 QStringList::Iterator it;
134 for ( it = m_file.begin(); it != m_file.end(); ++it ) { 134 for ( it = m_file.begin(); it != m_file.end(); ++it ) {
135 stream << (*it) << endl; 135 stream << (*it) << endl;
136 } 136 }
137 qWarning("saved"); 137 owarn << "saved" << oendl;
138 }; 138 };
139} 139}
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp
index 1ef862a..3a3dbb0 100644
--- a/noncore/net/opietooth/manager/obexdialog.cpp
+++ b/noncore/net/opietooth/manager/obexdialog.cpp
@@ -71,19 +71,19 @@ void ObexDialog::sendData() {
71 QString fileURL = cmdLine->text(); 71 QString fileURL = cmdLine->text();
72 QString file = QFileInfo( fileURL ).fileName(); 72 QString file = QFileInfo( fileURL ).fileName();
73 QString modifiedName = chNameLine->text(); 73 QString modifiedName = chNameLine->text();
74 74
75 // vom popupmenu beziehen 75 // vom popupmenu beziehen
76 OProcess* obexSend = new OProcess(); 76 OProcess* obexSend = new OProcess();
77 if ( !modifiedName.isEmpty() ) { 77 if ( !modifiedName.isEmpty() ) {
78 *obexSend << "ussp-push" << m_device << fileURL << modifiedName; 78 *obexSend << "ussp-push" << m_device << fileURL << modifiedName;
79 } else { 79 } else {
80 *obexSend << "ussp-push" << m_device << fileURL << file; 80 *obexSend << "ussp-push" << m_device << fileURL << file;
81 } 81 }
82 if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { 82 if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) {
83 qWarning("could not start"); 83 owarn << "could not start" << oendl;
84 delete obexSend; 84 delete obexSend;
85 } 85 }
86 86
87 87
88 88
89} 89}
diff --git a/noncore/net/opietooth/manager/obexpopup.cpp b/noncore/net/opietooth/manager/obexpopup.cpp
index d147d52..9a50199 100644
--- a/noncore/net/opietooth/manager/obexpopup.cpp
+++ b/noncore/net/opietooth/manager/obexpopup.cpp
@@ -7,39 +7,39 @@
7 7
8/* QT */ 8/* QT */
9#include <qtimer.h> 9#include <qtimer.h>
10 10
11using namespace OpieTooth; 11using namespace OpieTooth;
12 12
13/* 13/*
14 * c'tor init the QAction 14 * c'tor init the QAction
15 */ 15 */
16ObexPopup::ObexPopup() 16ObexPopup::ObexPopup()
17 : QPopupMenu() 17 : QPopupMenu()
18{ 18{
19 qWarning("RfcCommPopup c'tor"); 19 owarn << "RfcCommPopup c'tor" << oendl;
20 20
21 QAction* a; 21 QAction* a;
22 22
23 /* connect action */ 23 /* connect action */
24 a = new QAction( ); // so it's get deleted 24 a = new QAction( ); // so it's get deleted
25 a->setText("Push file"); 25 a->setText("Push file");
26 a->addTo( this ); 26 a->addTo( this );
27 connect( a, SIGNAL( activated() ), 27 connect( a, SIGNAL( activated() ),
28 this, SLOT( slotPush() ) ); 28 this, SLOT( slotPush() ) );
29}; 29};
30 30
31 31
32ObexPopup::~ObexPopup() 32ObexPopup::~ObexPopup()
33{} 33{}
34 34
35 35
36void ObexPopup::slotPush() 36void ObexPopup::slotPush()
37{ 37{
38 38
39 qWarning("push something"); 39 owarn << "push something" << oendl;
40 40
41 ObexDialog obexDialog; 41 ObexDialog obexDialog;
42 QPEApplication::execDialog( &obexDialog ); 42 QPEApplication::execDialog( &obexDialog );
43} 43}
44 44
45 45
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp
index 8b05964..43c2777 100644
--- a/noncore/net/opietooth/manager/panpopup.cpp
+++ b/noncore/net/opietooth/manager/panpopup.cpp
@@ -2,25 +2,25 @@
2 2
3#include <qtimer.h> 3#include <qtimer.h>
4 4
5#include "panpopup.h" 5#include "panpopup.h"
6 6
7using namespace OpieTooth; 7using namespace OpieTooth;
8 8
9/* 9/*
10 * c'tor init the QAction 10 * c'tor init the QAction
11 */ 11 */
12PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { 12PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
13 13
14 qWarning("PanPopup c'tor"); 14 owarn << "PanPopup c'tor" << oendl;
15 15
16 m_item = item; 16 m_item = item;
17 QAction *a, *b, *c; 17 QAction *a, *b, *c;
18 18
19 m_panconnection = 0l; 19 m_panconnection = 0l;
20 /* connect action */ 20 /* connect action */
21 21
22 22
23 a = new QAction(); // so it's get deleted 23 a = new QAction(); // so it's get deleted
24 a->setText( tr("connect") ); 24 a->setText( tr("connect") );
25 a->addTo( this ); 25 a->addTo( this );
26 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); 26 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp
index ab22fea..19deb19 100644
--- a/noncore/net/opietooth/manager/popuphelper.cpp
+++ b/noncore/net/opietooth/manager/popuphelper.cpp
@@ -7,28 +7,28 @@ using namespace OpieTooth;
7PopupHelper::PopupHelper() { 7PopupHelper::PopupHelper() {
8 init(); 8 init();
9} 9}
10 10
11PopupHelper::~PopupHelper() { 11PopupHelper::~PopupHelper() {
12} 12}
13 13
14void PopupHelper::insert( int id, popupFactory fact ) { 14void PopupHelper::insert( int id, popupFactory fact ) {
15 m_map.insert(id, fact ); 15 m_map.insert(id, fact );
16} 16}
17 17
18QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) { 18QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) {
19 //qWarning("find"); 19 //owarn << "find" << oendl;
20 FactoryMap::Iterator it = m_map.find(id ); 20 FactoryMap::Iterator it = m_map.find(id );
21 if ( it != m_map.end() ) { 21 if ( it != m_map.end() ) {
22 //qWarning("found"); 22 //owarn << "found" << oendl;
23 popupFactory fact = it.data(); 23 popupFactory fact = it.data();
24 return (*fact)(ser, item); 24 return (*fact)(ser, item);
25 } 25 }
26 return 0l; 26 return 0l;
27} 27}
28 28
29void PopupHelper::init() { 29void PopupHelper::init() {
30 insert( 4355, newRfcComPopup ); 30 insert( 4355, newRfcComPopup );
31 insert( 4354, newDunPopup ); 31 insert( 4354, newDunPopup );
32 insert( 4353, newRfcComPopup ); 32 insert( 4353, newRfcComPopup );
33 insert( 4357, newObexPushPopup ); 33 insert( 4357, newObexPushPopup );
34 insert( 4358, newObexPushPopup ); 34 insert( 4358, newObexPushPopup );
diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp
index 78c1501..989bf45 100644
--- a/noncore/net/opietooth/manager/pppdialog.cpp
+++ b/noncore/net/opietooth/manager/pppdialog.cpp
@@ -47,23 +47,23 @@ PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl,
47PPPDialog::~PPPDialog() { 47PPPDialog::~PPPDialog() {
48} 48}
49 49
50void PPPDialog::connectToDevice() { 50void PPPDialog::connectToDevice() {
51 outPut->clear(); 51 outPut->clear();
52 // vom popupmenu beziehen 52 // vom popupmenu beziehen
53 QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); 53 QString connectScript = "/etc/ppp/peers/" + cmdLine->text();
54 OProcess* pppDial = new OProcess(); 54 OProcess* pppDial = new OProcess();
55 *pppDial << "pppd" << m_device << "call" << connectScript; 55 *pppDial << "pppd" << m_device << "call" << connectScript;
56 connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), 56 connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ),
57 this, SLOT(fillOutPut(Opie::Core::OProcess*,char*,int) ) ); 57 this, SLOT(fillOutPut(Opie::Core::OProcess*,char*,int) ) );
58 if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { 58 if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) {
59 qWarning("could not start"); 59 owarn << "could not start" << oendl;
60 delete pppDial; 60 delete pppDial;
61 } 61 }
62} 62}
63 63
64void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { 64void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) {
65 QCString str(cha, len ); 65 QCString str(cha, len );
66 outPut->insertLine( str ); 66 outPut->insertLine( str );
67 delete pppDial; 67 delete pppDial;
68} 68}
69 69
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
index fc76301..4469129 100644
--- a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
+++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
@@ -62,46 +62,46 @@ void RfcommAssignDialog::newDevice( const QString & mac )
62 RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); 62 RfcommDialogItem *newDev = new RfcommDialogItem( &dialog );
63 newDev->setIdent( i ); 63 newDev->setIdent( i );
64 newDev->setMac( mac ); 64 newDev->setMac( mac );
65 65
66 if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted ) 66 if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted )
67 { 67 {
68 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); 68 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
69 m_itemList.insert( i , rfcomm ); 69 m_itemList.insert( i , rfcomm );
70 rfcomm->setIdent( i ); 70 rfcomm->setIdent( i );
71 rfcomm->setMac( mac ); 71 rfcomm->setMac( mac );
72 rfcomm->setChannel( newDev->channel() ); 72 rfcomm->setChannel( newDev->channel() );
73 rfcomm->setComment( newDev->comment() ); 73 rfcomm->setComment( newDev->comment() );
74 qDebug( "New device set up" ); 74 odebug << "New device set up" << oendl;
75 } 75 }
76 } 76 }
77 } 77 }
78} 78}
79 79
80void RfcommAssignDialog::loadConfig() 80void RfcommAssignDialog::loadConfig()
81{ 81{
82 82
83 //Config cfg( "bluetoothmanager-rfcommbind" ); 83 //Config cfg( "bluetoothmanager-rfcommbind" );
84 84
85 for ( int i = 0 ; i < m_range; i++ ) 85 for ( int i = 0 ; i < m_range; i++ )
86 { 86 {
87 // cfg.setGroup( QString("%1").arg( i ) ); 87 // cfg.setGroup( QString("%1").arg( i ) );
88 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); 88 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
89 m_itemList.insert( i , rfcomm ); 89 m_itemList.insert( i , rfcomm );
90 rfcomm->setIdent( i ); 90 rfcomm->setIdent( i );
91 QMap<QString, RfCommConfObject*>::Iterator it; 91 QMap<QString, RfCommConfObject*>::Iterator it;
92 it = confHandler->foundEntries().find( QString("%1").arg( i ) ); 92 it = confHandler->foundEntries().find( QString("%1").arg( i ) );
93 if ( it != confHandler->foundEntries().end() ) 93 if ( it != confHandler->foundEntries().end() )
94 { 94 {
95 qDebug( "Found key in foundEntries() " ); 95 odebug << "Found key in foundEntries() " << oendl;
96 rfcomm->setMac( it.data()->mac() ); 96 rfcomm->setMac( it.data()->mac() );
97 rfcomm->setChannel( it.data()->channel() ); 97 rfcomm->setChannel( it.data()->channel() );
98 rfcomm->setComment( it.data()->comment() ); 98 rfcomm->setComment( it.data()->comment() );
99 } 99 }
100 /* Use rfcomm.conf directly for now 100 /* Use rfcomm.conf directly for now
101 * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); 101 * rfcomm->setMac( cfg.readEntry( "mac", "" ) );
102 * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); 102 * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) );
103 * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); 103 * rfcomm->setComment( cfg.readEntry( "comment", "" ) );
104 */ 104 */
105 } 105 }
106} 106}
107 107
diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp
index 20453e8..2ef95ff 100644
--- a/noncore/net/opietooth/manager/rfcommconfhandler.cpp
+++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp
@@ -83,32 +83,32 @@ void RfCommConfHandler::load() {
83 83
84 QString number; 84 QString number;
85 QString mac; 85 QString mac;
86 QString channel; 86 QString channel;
87 QString comment; 87 QString comment;
88 88
89 for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) { 89 for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) {
90 90
91 QString tmpLine = ( *line ).stripWhiteSpace(); 91 QString tmpLine = ( *line ).stripWhiteSpace();
92 92
93 if ( tmpLine.startsWith("rfcomm") ) { 93 if ( tmpLine.startsWith("rfcomm") ) {
94 QString number = tmpLine.mid( 6,1 ); 94 QString number = tmpLine.mid( 6,1 );
95 qDebug( tmpLine ); 95 odebug << tmpLine << oendl;
96 qDebug( "TEST " + number ); 96 odebug << "TEST " + number << oendl;
97 } else if ( tmpLine.startsWith( "}" ) ) { 97 } else if ( tmpLine.startsWith( "}" ) ) {
98 m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) ); 98 m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) );
99 } else if ( tmpLine.startsWith( "device" ) ) { 99 } else if ( tmpLine.startsWith( "device" ) ) {
100 mac = tmpLine.mid( 7, 17 ); 100 mac = tmpLine.mid( 7, 17 );
101 qDebug( "mac" + mac ); 101 odebug << "mac" + mac << oendl;
102 } else if ( tmpLine.startsWith( "channel" ) ) { 102 } else if ( tmpLine.startsWith( "channel" ) ) {
103 channel = tmpLine.mid( 8, 1 ); 103 channel = tmpLine.mid( 8, 1 );
104 qDebug ( "Channel :" + channel ); 104 qDebug ( "Channel :" + channel );
105 } else if ( tmpLine.startsWith( "comment" ) ) { 105 } else if ( tmpLine.startsWith( "comment" ) ) {
106 comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 ); 106 comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 );
107 qDebug( "Comment: " + comment ); 107 odebug << "Comment: " + comment << oendl;
108 } 108 }
109 } 109 }
110 rfCommConf.close(); 110 rfCommConf.close();
111 } 111 }
112 save( m_foundEntries ); 112 save( m_foundEntries );
113 qDebug( QString( "ENTries: %1").arg( m_foundEntries.count() ) ); 113 odebug << QString( "ENTries: %1").arg( m_foundEntries.count() ) << oendl;
114} 114}
diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp
index 04bfe48..01ad616 100644
--- a/noncore/net/opietooth/manager/rfcpopup.cpp
+++ b/noncore/net/opietooth/manager/rfcpopup.cpp
@@ -8,25 +8,25 @@
8 8
9/* QT */ 9/* QT */
10#include <qtimer.h> 10#include <qtimer.h>
11 11
12using namespace OpieTooth; 12using namespace OpieTooth;
13 13
14/* 14/*
15 * c'tor init the QAction 15 * c'tor init the QAction
16 */ 16 */
17RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) 17RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
18 : QPopupMenu() 18 : QPopupMenu()
19{ 19{
20 qWarning("RfcCommPopup c'tor"); 20 owarn << "RfcCommPopup c'tor" << oendl;
21 21
22 QAction* a; 22 QAction* a;
23 23
24 24
25 m_item = item; 25 m_item = item;
26 26
27 /* connect action */ 27 /* connect action */
28 a = new QAction( ); // so it's get deleted 28 a = new QAction( ); // so it's get deleted
29 a->setText("Connect"); 29 a->setText("Connect");
30 a->addTo( this ); 30 a->addTo( this );
31 connect( a, SIGNAL( activated() ), 31 connect( a, SIGNAL( activated() ),
32 this, SLOT( slotConnect() ) ); 32 this, SLOT( slotConnect() ) );
@@ -61,43 +61,43 @@ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
61RfcCommPopup::~RfcCommPopup() 61RfcCommPopup::~RfcCommPopup()
62{ 62{
63 /* delete m_con; 63 /* delete m_con;
64 delete m_dis; 64 delete m_dis;
65 delete m_foo; 65 delete m_foo;
66 delete m_bar; */ 66 delete m_bar; */
67} 67}
68 68
69 69
70void RfcCommPopup::slotConnect() 70void RfcCommPopup::slotConnect()
71{ 71{
72 72
73 qWarning("connect"); 73 owarn << "connect" << oendl;
74 74
75 PPPDialog pppDialog; 75 PPPDialog pppDialog;
76 QPEApplication::execDialog( &pppDialog ); 76 QPEApplication::execDialog( &pppDialog );
77} 77}
78 78
79 79
80void RfcCommPopup::slotDisconnect() 80void RfcCommPopup::slotDisconnect()
81{ 81{
82 qWarning("slot disconnected"); 82 owarn << "slot disconnected" << oendl;
83} 83}
84 84
85 85
86void RfcCommPopup::slotBind() 86void RfcCommPopup::slotBind()
87{ 87{
88 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); 88 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
89 89
90 rfcommAssign.newDevice( m_item->mac() ); 90 rfcommAssign.newDevice( m_item->mac() );
91 91
92 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) 92 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted )
93 { 93 {
94 rfcommAssign.saveConfig(); 94 rfcommAssign.saveConfig();
95 } 95 }
96} 96}
97 97
98 98
99void RfcCommPopup::slotBar() 99void RfcCommPopup::slotBar()
100{ 100{
101 qWarning("slotBar"); 101 owarn << "slotBar" << oendl;
102}; 102};
103 103
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
index c8ea3e3..3b005c4 100644
--- a/noncore/net/opietooth/manager/scandialog.cpp
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -146,16 +146,16 @@ namespace OpieTooth {
146 if ( ( (QCheckListItem*)it.current() )->isOn() ) { 146 if ( ( (QCheckListItem*)it.current() )->isOn() ) {
147 RemoteDevice device( it.current()->text(1), it.current()->text(0) ); 147 RemoteDevice device( it.current()->text(1), it.current()->text(0) );
148 deviceList.append( device ); 148 deviceList.append( device );
149 } 149 }
150 } 150 }
151 emit selectedDevices( deviceList ); 151 emit selectedDevices( deviceList );
152 } 152 }
153 153
154/** 154/**
155 * Cleanup 155 * Cleanup
156 */ 156 */
157 ScanDialog::~ScanDialog() { 157 ScanDialog::~ScanDialog() {
158 qWarning("delete scan dialog"); 158 owarn << "delete scan dialog" << oendl;
159 delete localDevice; 159 delete localDevice;
160 } 160 }
161} 161}
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index da39113..bfdb20a 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -14,50 +14,46 @@
14**********************************************************************/ 14**********************************************************************/
15 15
16/* LOCAL */ 16/* LOCAL */
17#include "configwindow.h" 17#include "configwindow.h"
18#include "mainwindow.h" 18#include "mainwindow.h"
19 19
20/* OPIE */ 20/* OPIE */
21#include <opie2/onetwork.h> 21#include <opie2/onetwork.h>
22#ifdef QWS 22#ifdef QWS
23#include <opie2/oapplication.h> 23#include <opie2/oapplication.h>
24#include <opie2/oconfig.h> 24#include <opie2/oconfig.h>
25#include <opie2/odevice.h> 25#include <opie2/odevice.h>
26using namespace Opie; 26#include <opie2/odebug.h>
27using namespace Opie::Core;
28using namespace Opie::Net;
27#endif 29#endif
28 30
29/* QT */ 31/* QT */
30#include <qapplication.h> 32#include <qapplication.h>
31#include <qcheckbox.h> 33#include <qcheckbox.h>
32#include <qcombobox.h> 34#include <qcombobox.h>
33#include <qfile.h> 35#include <qfile.h>
34#include <qlineedit.h> 36#include <qlineedit.h>
35#include <qlayout.h> 37#include <qlayout.h>
36#include <qmap.h> 38#include <qmap.h>
37#include <qpushbutton.h> 39#include <qpushbutton.h>
38#include <qtabwidget.h> 40#include <qtabwidget.h>
39#include <qtoolbutton.h> 41#include <qtoolbutton.h>
40#include <qspinbox.h> 42#include <qspinbox.h>
41#include <qtextstream.h> 43#include <qtextstream.h>
42 44
43/* POSIX */ 45/* STD */
44#include <assert.h> 46#include <assert.h>
45 47
46using namespace Opie::Core;
47using namespace Opie::Net;
48using namespace Opie::Core;
49using namespace Opie::Net;
50using namespace Opie::Core;
51using namespace Opie::Net;
52WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; 48WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
53 49
54WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) 50WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
55 :WellenreiterConfigBase( parent, name, true, f ) 51 :WellenreiterConfigBase( parent, name, true, f )
56{ 52{
57 _devicetype[ "cisco" ] = DEVTYPE_CISCO; 53 _devicetype[ "cisco" ] = DEVTYPE_CISCO;
58 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; 54 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG;
59 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; 55 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP;
60 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; 56 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO;
61 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; 57 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL;
62 _devicetype[ "<file>" ] = DEVTYPE_FILE; 58 _devicetype[ "<file>" ] = DEVTYPE_FILE;
63 59
@@ -107,46 +103,46 @@ void WellenreiterConfigWindow::accept()
107 103
108WellenreiterConfigWindow::~WellenreiterConfigWindow() 104WellenreiterConfigWindow::~WellenreiterConfigWindow()
109{ 105{
110} 106}
111 107
112 108
113void WellenreiterConfigWindow::performAutodetection() 109void WellenreiterConfigWindow::performAutodetection()
114{ 110{
115 //TODO: insert modal splash screen here 111 //TODO: insert modal splash screen here
116 // and sleep a second, so that it looks 112 // and sleep a second, so that it looks
117 // like we're actually doing something fancy... ;-) 113 // like we're actually doing something fancy... ;-)
118 114
119 qDebug( "WellenreiterConfigWindow::performAutodetection()" ); 115 odebug << "WellenreiterConfigWindow::performAutodetection()" << oendl;
120 116
121 // try to guess device type 117 // try to guess device type
122 QFile m( "/proc/modules" ); 118 QFile m( "/proc/modules" );
123 if ( m.open( IO_ReadOnly ) ) 119 if ( m.open( IO_ReadOnly ) )
124 { 120 {
125 int devicetype(0); 121 int devicetype(0);
126 QString line; 122 QString line;
127 QTextStream modules( &m ); 123 QTextStream modules( &m );
128 while( !modules.atEnd() && !devicetype ) 124 while( !modules.atEnd() && !devicetype )
129 { 125 {
130 modules >> line; 126 modules >> line;
131 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; 127 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
132 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; 128 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
133 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; 129 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
134 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; 130 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
135 } 131 }
136 if ( devicetype ) 132 if ( devicetype )
137 { 133 {
138 deviceType->setCurrentItem( devicetype ); 134 deviceType->setCurrentItem( devicetype );
139 _guess = devicetype; 135 _guess = devicetype;
140 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); 136 odebug << "Wellenreiter: guessed device type to be #" << devicetype << "" << oendl;
141 } 137 }
142 } 138 }
143} 139}
144 140
145 141
146int WellenreiterConfigWindow::driverType() const 142int WellenreiterConfigWindow::driverType() const
147{ 143{
148 QString name = deviceType->currentText(); 144 QString name = deviceType->currentText();
149 if ( _devicetype.contains( name ) ) 145 if ( _devicetype.contains( name ) )
150 { 146 {
151 return _devicetype[name]; 147 return _devicetype[name];
152 } 148 }
@@ -232,25 +228,25 @@ void WellenreiterConfigWindow::changedClientAction(int t)
232} 228}
233 229
234 230
235void WellenreiterConfigWindow::changedStationAction(int t) 231void WellenreiterConfigWindow::changedStationAction(int t)
236{ 232{
237 synchronizeActionsAndScripts(); 233 synchronizeActionsAndScripts();
238} 234}
239 235
240 236
241void WellenreiterConfigWindow::getCaptureFileNameClicked() 237void WellenreiterConfigWindow::getCaptureFileNameClicked()
242{ 238{
243 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); 239 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
244 qDebug( "name = %s", (const char*) name ); 240 odebug << "name = " << (const char*) name << "" << oendl;
245 if ( !name.isEmpty() ) 241 if ( !name.isEmpty() )
246 { 242 {
247 captureFileName->setText( name ); 243 captureFileName->setText( name );
248 } 244 }
249} 245}
250 246
251 247
252void WellenreiterConfigWindow::channelAllClicked(int state) 248void WellenreiterConfigWindow::channelAllClicked(int state)
253{ 249{
254 bool b = state; 250 bool b = state;
255 channel1->setChecked( b ); 251 channel1->setChecked( b );
256 channel2->setChecked( b ); 252 channel2->setChecked( b );
@@ -307,70 +303,70 @@ void WellenreiterConfigWindow::performAction( const QString& type,
307 else if ( type == "managed" || type == "adhoc" ) 303 else if ( type == "managed" || type == "adhoc" )
308 { 304 {
309 action = newClientAction->currentItem(); 305 action = newClientAction->currentItem();
310 script = newClientScript->text(); 306 script = newClientScript->text();
311 } 307 }
312 else if ( type == "station" ) 308 else if ( type == "station" )
313 { 309 {
314 action = newStationAction->currentItem(); 310 action = newStationAction->currentItem();
315 script = newStationScript->text(); 311 script = newStationScript->text();
316 } 312 }
317 else 313 else
318 { 314 {
319 qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); 315 owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << (const char*) type << "'" << oendl;
320 return; 316 return;
321 } 317 }
322 318
323 qDebug( "for event '%s' I'm going to perform action %d (script='%s')", (const char*) type, action, (const char*) script ); 319 odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << (const char*) script << "')" << oendl;
324 320
325 switch( action ) 321 switch( action )
326 { 322 {
327 case 0: /* Ignore */ return; 323 case 0: /* Ignore */ return;
328 case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return; 324 case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return;
329 case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return; 325 case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return;
330 case 3: /* Blink LED */ break; //FIXME: Implement this 326 case 3: /* Blink LED */ break; //FIXME: Implement this
331 case 4: /* Run Script */ 327 case 4: /* Run Script */
332 { 328 {
333 /** 329 /**
334 * 330 *
335 * Script Substitution Information: 331 * Script Substitution Information:
336 * 332 *
337 * $SSID = SSID 333 * $SSID = SSID
338 * $MAC = MAC 334 * $MAC = MAC
339 * $WEP = Wep 335 * $WEP = Wep
340 * $CHAN = Channel 336 * $CHAN = Channel
341 * 337 *
342 **/ 338 **/
343 script = script.replace( QRegExp( "$SSID" ), essid ); 339 script = script.replace( QRegExp( "$SSID" ), essid );
344 script = script.replace( QRegExp( "$MAC" ), mac ); 340 script = script.replace( QRegExp( "$MAC" ), mac );
345 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); 341 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) );
346 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); 342 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) );
347 343
348 qDebug( "going to call script '%s'", (const char*) script ); 344 odebug << "going to call script '" << (const char*) script << "'" << oendl;
349 ::system( script ); 345 ::system( script );
350 qDebug( "script returned." ); 346 odebug << "script returned." << oendl;
351 return; 347 return;
352 } 348 }
353 default: assert( false ); 349 default: assert( false );
354 } 350 }
355} 351}
356 352
357 353
358void WellenreiterConfigWindow::load() 354void WellenreiterConfigWindow::load()
359{ 355{
360#ifdef Q_WS_X11 356#ifdef Q_WS_X11
361 #warning Persistent Configuration not yet implemented for standalone X11 build 357 #warning Persistent Configuration not yet implemented for standalone X11 build
362 performAutodetection(); 358 performAutodetection();
363#else 359#else
364 qDebug( "loading configuration settings..." ); 360 odebug << "loading configuration settings..." << oendl;
365 361
366 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 362 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
367 363
368 OConfig* c = oApp->config(); 364 OConfig* c = oApp->config();
369 365
370 c->setGroup( "Interface" ); 366 c->setGroup( "Interface" );
371 367
372 QString interface = c->readEntry( "name", "<none>" ); 368 QString interface = c->readEntry( "name", "<none>" );
373 if ( interface != "<none>" ) 369 if ( interface != "<none>" )
374 { 370 {
375#if QT_VERSION < 300 371#if QT_VERSION < 300
376 interfaceName->insertItem( interface, 0 ); 372 interfaceName->insertItem( interface, 0 );
@@ -430,25 +426,25 @@ void WellenreiterConfigWindow::load()
430 startGPS->setChecked( c->readBoolEntry( "start", false ) ); 426 startGPS->setChecked( c->readBoolEntry( "start", false ) );
431 commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); 427 commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) );
432 428
433#endif 429#endif
434} 430}
435 431
436 432
437void WellenreiterConfigWindow::save() 433void WellenreiterConfigWindow::save()
438{ 434{
439#ifdef Q_WS_X11 435#ifdef Q_WS_X11
440 #warning Persistent Configuration not yet implemented for standalone X11 build 436 #warning Persistent Configuration not yet implemented for standalone X11 build
441#else 437#else
442 qDebug( "saving configuration settings..." ); 438 odebug << "saving configuration settings..." << oendl;
443 439
444 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 440 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
445 441
446 OConfig* c = oApp->config(); 442 OConfig* c = oApp->config();
447 443
448 c->setGroup( "Interface" ); 444 c->setGroup( "Interface" );
449 c->writeEntry( "name", interfaceName->currentText() ); 445 c->writeEntry( "name", interfaceName->currentText() );
450 c->writeEntry( "type", deviceType->currentText() ); 446 c->writeEntry( "type", deviceType->currentText() );
451 c->writeEntry( "prism", prismHeader->isChecked() ); 447 c->writeEntry( "prism", prismHeader->isChecked() );
452 c->writeEntry( "hop", hopChannels->isChecked() ); 448 c->writeEntry( "hop", hopChannels->isChecked() );
453 c->writeEntry( "interval", hopInterval->value() ); 449 c->writeEntry( "interval", hopInterval->value() );
454 c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); 450 c->writeEntry( "adaptive", adaptiveHopping->isChecked() );
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp
index a47b4ec..bd91e35 100644
--- a/noncore/net/wellenreiter/gui/gps.cpp
+++ b/noncore/net/wellenreiter/gui/gps.cpp
@@ -6,71 +6,75 @@
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 "gps.h" 16#include "gps.h"
17 17
18/* OPIE */
19#include <opie2/odebug.h>
20using namespace Opie::Core;
21
18/* QT */ 22/* QT */
19#include <qtextstream.h> 23#include <qtextstream.h>
20 24
21/* STD */ 25/* STD */
22#include <stdlib.h> 26#include <stdlib.h>
23#include <unistd.h> 27#include <unistd.h>
24 28
25GPS::GPS( QObject* parent, const char * name ) 29GPS::GPS( QObject* parent, const char * name )
26 :QObject( parent, name ) 30 :QObject( parent, name )
27{ 31{
28 qDebug( "GPS::GPS()" ); 32 odebug << "GPS::GPS()" << oendl;
29 _socket = new QSocket( this, "gpsd commsock" ); 33 _socket = new QSocket( this, "gpsd commsock" );
30} 34}
31 35
32 36
33GPS::~GPS() 37GPS::~GPS()
34{ 38{
35 qDebug( "GPS::~GPS()" ); 39 odebug << "GPS::~GPS()" << oendl;
36} 40}
37 41
38 42
39bool GPS::open( const QString& host, int port ) 43bool GPS::open( const QString& host, int port )
40{ 44{
41 _socket->connectToHost( host, port ); 45 _socket->connectToHost( host, port );
42} 46}
43 47
44 48
45GpsLocation GPS::position() const 49GpsLocation GPS::position() const
46{ 50{
47 char buf[256]; 51 char buf[256];
48 double lat = -111.0; 52 double lat = -111.0;
49 double lon = -111.0; 53 double lon = -111.0;
50 54
51 int result = _socket->writeBlock( "p\r\n", 3 ); 55 int result = _socket->writeBlock( "p\r\n", 3 );
52 _socket->flush(); 56 _socket->flush();
53 if ( result ) 57 if ( result )
54 { 58 {
55 int numAvail = _socket->bytesAvailable(); 59 int numAvail = _socket->bytesAvailable();
56 qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); 60 odebug << "GPS write succeeded, " << numAvail << " bytes available for reading..." << oendl;
57 if ( numAvail ) 61 if ( numAvail )
58 { 62 {
59 int numRead = _socket->readBlock( &buf[0], sizeof buf ); 63 int numRead = _socket->readBlock( &buf[0], sizeof buf );
60 int numScan = ::sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon); 64 int numScan = ::sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon);
61 65
62 if ( numRead < 7 || numScan != 2 ) 66 if ( numRead < 7 || numScan != 2 )
63 { 67 {
64 qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] ); 68 odebug << "GPS read " << numRead << " bytes succeeded, invalid response: '" << &buf[0] << "'" << oendl;
65 return GpsLocation( -111, -111 ); 69 return GpsLocation( -111, -111 );
66 } 70 }
67 else 71 else
68 { 72 {
69 return GpsLocation( lat, lon ); 73 return GpsLocation( lat, lon );
70 } 74 }
71 } 75 }
72 } 76 }
73 return GpsLocation( -111, -111 ); 77 return GpsLocation( -111, -111 );
74} 78}
75 79
76 80
diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp
index 1c72cf4..714a9a9 100644
--- a/noncore/net/wellenreiter/gui/logwindow.cpp
+++ b/noncore/net/wellenreiter/gui/logwindow.cpp
@@ -5,49 +5,55 @@
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "logwindow.h" 16#include "logwindow.h"
17
18/* OPIE */
19#include <opie2/odebug.h>
20using namespace Opie::Core;
21
22/* QT */
17#include <qmultilineedit.h> 23#include <qmultilineedit.h>
18#include <qdatetime.h> 24#include <qdatetime.h>
19 25
20MLogWindow* MLogWindow::_instance; 26MLogWindow* MLogWindow::_instance;
21 27
22MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) 28MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f )
23 :QVBox( parent, name, f ) 29 :QVBox( parent, name, f )
24{ 30{
25 ledit = new QMultiLineEdit( this ); 31 ledit = new QMultiLineEdit( this );
26 ledit->setReadOnly( true ); 32 ledit->setReadOnly( true );
27 33
28 MLogWindow::_instance = this; 34 MLogWindow::_instance = this;
29} 35}
30 36
31 37
32void MLogWindow::log( QString text ) 38void MLogWindow::log( QString text )
33{ 39{
34 QTime time = QTime::currentTime(); 40 QTime time = QTime::currentTime();
35 QString line; 41 QString line;
36 line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text ); 42 line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text );
37 int col; 43 int col;
38 int row; 44 int row;
39 ledit->getCursorPosition( &col, &row ); 45 ledit->getCursorPosition( &col, &row );
40 ledit->insertAt( line, col, row ); 46 ledit->insertAt( line, col, row );
41 qDebug( line ); 47 odebug << line << oendl;
42} 48}
43 49
44 50
45void MLogWindow::clear() 51void MLogWindow::clear()
46{ 52{
47 ledit->clear(); 53 ledit->clear();
48} 54}
49 55
50 56
51const QString MLogWindow::getLog() const 57const QString MLogWindow::getLog() const
52{ 58{
53 return ledit->text(); 59 return ledit->text();
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp
index 6bbc39b..62db967 100644
--- a/noncore/net/wellenreiter/gui/main.cpp
+++ b/noncore/net/wellenreiter/gui/main.cpp
@@ -5,97 +5,100 @@
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "mainwindow.h" 16#include "mainwindow.h"
17
17#ifdef QWS 18#ifdef QWS
19#include <opie2/odebug.h>
18#include <opie2/oapplication.h> 20#include <opie2/oapplication.h>
19#include <opie2/oprocess.h> 21#include <opie2/oprocess.h>
20#else 22#else
21#include <qapplication.h> 23#include <qapplication.h>
22#endif 24#endif
23 25
26/* QT */
24#include <qmessagebox.h> 27#include <qmessagebox.h>
25#include <qstringlist.h> 28#include <qstringlist.h>
26 29
30/* STD */
27#include <errno.h> 31#include <errno.h>
28#include <signal.h> 32#include <signal.h>
29#include <string.h> 33#include <string.h>
30#include <unistd.h> 34#include <unistd.h>
31 35
32using namespace Opie::Core; 36using namespace Opie::Core;
33using namespace Opie::Core; 37
34using namespace Opie::Core;
35int main( int argc, char **argv ) 38int main( int argc, char **argv )
36{ 39{
37 #ifdef QWS 40 #ifdef QWS
38 OApplication a( argc, argv, "Wellenreiter II" ); 41 OApplication a( argc, argv, "Wellenreiter II" );
39 #else 42 #else
40 QApplication a( argc, argv ); 43 QApplication a( argc, argv );
41 #endif 44 #endif
42 WellenreiterMainWindow* w = new WellenreiterMainWindow(); 45 WellenreiterMainWindow* w = new WellenreiterMainWindow();
43 #ifdef QWS 46 #ifdef QWS
44 a.showMainWidget( w ); 47 a.showMainWidget( w );
45 #else 48 #else
46 a.setMainWidget( w ); 49 a.setMainWidget( w );
47 w->setCaption( "Wellenreiter II" ); 50 w->setCaption( "Wellenreiter II" );
48 w->show(); 51 w->show();
49 #endif 52 #endif
50 53
51 a.processEvents(); // show the window before doing the safety checks 54 a.processEvents(); // show the window before doing the safety checks
52 int result = -1; 55 int result = -1;
53 static int killed = false; 56 static int killed = false;
54 57
55 bool check = true; 58 bool check = true;
56 for ( int i = 1; i < argc; ++i ) 59 for ( int i = 1; i < argc; ++i )
57 { 60 {
58 qDebug( "Wellenreiter::main() parsing argument %d = '%s'", i, argv[i] ); 61 odebug << "Wellenreiter::main() parsing argument " << i << " = '" << argv[i] << "'" << oendl;
59 if ( !strcmp( "-nocheck", argv[i] ) ) 62 if ( !strcmp( "-nocheck", argv[i] ) )
60 { 63 {
61 qDebug( "-nocheck found" ); 64 odebug << "-nocheck found" << oendl;
62 check = false; 65 check = false;
63 break; 66 break;
64 } 67 }
65 } 68 }
66 69
67 if ( check ) 70 if ( check )
68 { 71 {
69 // root check 72 // root check
70 if ( getuid() ) 73 if ( getuid() )
71 { 74 {
72 qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); 75 owarn << QObject::tr( "Wellenreiter: trying to run as non-root!" ) << oendl;
73 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" 76 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n"
74 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), 77 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ),
75 QMessageBox::Yes, QMessageBox::No ); 78 QMessageBox::Yes, QMessageBox::No );
76 if ( result == QMessageBox::No ) return -1; 79 if ( result == QMessageBox::No ) return -1;
77 } 80 }
78 81
79 int dhcpid = OProcess::processPID( "dhcpc" ); 82 int dhcpid = OProcess::processPID( "dhcpc" );
80 83
81 if ( dhcpid ) 84 if ( dhcpid )
82 { 85 {
83 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" 86 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n"
84 "(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ), 87 "(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ),
85 QMessageBox::Yes, QMessageBox::No ); 88 QMessageBox::Yes, QMessageBox::No );
86 if ( result == QMessageBox::Yes ) 89 if ( result == QMessageBox::Yes )
87 { 90 {
88 if ( -1 == ::kill( dhcpid, SIGTERM ) ) 91 if ( -1 == ::kill( dhcpid, SIGTERM ) )
89 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); 92 owarn << "Wellenreiter: can't kill process #" << result << " (" << strerror( errno ) << ")" << oendl;
90 else 93 else
91 killed = true; 94 killed = true;
92 } 95 }
93 } 96 }
94 } 97 }
95 98
96 a.exec(); 99 a.exec();
97 100
98 if ( check ) 101 if ( check )
99 { 102 {
100 103
101 if ( killed ) 104 if ( killed )
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index 7add6cd..a4b8839 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -12,59 +12,60 @@
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 "configwindow.h" 16#include "configwindow.h"
17#include "gps.h" 17#include "gps.h"
18#include "logwindow.h" 18#include "logwindow.h"
19#include "packetview.h" 19#include "packetview.h"
20#include "mainwindow.h" 20#include "mainwindow.h"
21#include "wellenreiter.h" 21#include "wellenreiter.h"
22#include "scanlist.h" 22#include "scanlist.h"
23 23
24/* OPIE */
25#ifdef QWS
26#include <qpe/resource.h>
27#include <opie2/odebug.h>
28#include <opie2/ofiledialog.h>
29#else
30#include "resource.h"
31#include <qapplication.h>
32#include <qfiledialog.h>
33#endif
34using namespace Opie::Core;
35using namespace Opie::Net;
36using namespace Opie::Ui;
37
38/* QT */
24#include <qcombobox.h> 39#include <qcombobox.h>
25#include <qdatastream.h> 40#include <qdatastream.h>
26#include <qfile.h> 41#include <qfile.h>
27#include <qfileinfo.h> 42#include <qfileinfo.h>
28#include <qlabel.h> 43#include <qlabel.h>
29#include <qlayout.h> 44#include <qlayout.h>
30#include <qlineedit.h> 45#include <qlineedit.h>
31#include <qiconset.h> 46#include <qiconset.h>
32#include <qmenubar.h> 47#include <qmenubar.h>
33#include <qmessagebox.h> 48#include <qmessagebox.h>
34#include <qpopupmenu.h> 49#include <qpopupmenu.h>
35#include <qpushbutton.h> 50#include <qpushbutton.h>
36#include <qstatusbar.h> 51#include <qstatusbar.h>
37#include <qspinbox.h> 52#include <qspinbox.h>
38#include <qtextstream.h> 53#include <qtextstream.h>
39#include <qtoolbutton.h> 54#include <qtoolbutton.h>
40#include <qwhatsthis.h> 55#include <qwhatsthis.h>
41 56
42#ifdef QWS 57/* STD */
43#include <qpe/resource.h>
44#include <opie2/ofiledialog.h>
45using namespace Opie;
46#else
47#include "resource.h"
48#include <qapplication.h>
49#include <qfiledialog.h>
50#endif
51
52#include <unistd.h> 58#include <unistd.h>
53 59
54using namespace Opie::Ui;
55using namespace Opie::Net;
56using namespace Opie::Ui;
57using namespace Opie::Net;
58using namespace Opie::Net;
59WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) 60WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f )
60 :QMainWindow( parent, name, f ) 61 :QMainWindow( parent, name, f )
61{ 62{
62 cw = new WellenreiterConfigWindow( this ); 63 cw = new WellenreiterConfigWindow( this );
63 mw = new Wellenreiter( this ); 64 mw = new Wellenreiter( this );
64 mw->setConfigWindow( cw ); 65 mw->setConfigWindow( cw );
65 setCentralWidget( mw ); 66 setCentralWidget( mw );
66 67
67 // setup application icon 68 // setup application icon
68 69
69 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); 70 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) );
70 #ifndef QWS 71 #ifndef QWS
@@ -179,25 +180,25 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
179 #ifndef QWS 180 #ifndef QWS
180 statusBar()->message( tr( "Ready." ) ); 181 statusBar()->message( tr( "Ready." ) );
181 #endif 182 #endif
182 183
183 connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); 184 connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) );
184 connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); 185 connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) );
185}; 186};
186 187
187 188
188 189
189void WellenreiterMainWindow::showConfigure() 190void WellenreiterMainWindow::showConfigure()
190{ 191{
191 qDebug( "show configure..." ); 192 odebug << "show configure..." << oendl;
192 cw->setCaption( tr( "Configure" ) ); 193 cw->setCaption( tr( "Configure" ) );
193 int result = QPEApplication::execDialog( cw ); 194 int result = QPEApplication::execDialog( cw );
194 195
195 if ( result ) updateToolButtonState(); 196 if ( result ) updateToolButtonState();
196} 197}
197 198
198 199
199void WellenreiterMainWindow::updateToolButtonState() 200void WellenreiterMainWindow::updateToolButtonState()
200{ 201{
201 const QString& interface = cw->interfaceName->currentText(); 202 const QString& interface = cw->interfaceName->currentText();
202 const int cardtype = cw->driverType(); 203 const int cardtype = cw->driverType();
203 204
@@ -222,45 +223,45 @@ void WellenreiterMainWindow::changedSniffingState()
222 menuBar()->setItemEnabled( stopID, mw->sniffing ); 223 menuBar()->setItemEnabled( stopID, mw->sniffing );
223 224
224 if ( !mw->sniffing ) 225 if ( !mw->sniffing )
225 { 226 {
226 menuBar()->setItemEnabled( uploadID, true ); 227 menuBar()->setItemEnabled( uploadID, true );
227 uploadButton->setEnabled( true ); 228 uploadButton->setEnabled( true );
228 } 229 }
229} 230}
230 231
231 232
232WellenreiterMainWindow::~WellenreiterMainWindow() 233WellenreiterMainWindow::~WellenreiterMainWindow()
233{ 234{
234 qDebug( "Wellenreiter: bye." ); 235 odebug << "Wellenreiter: bye." << oendl;
235}; 236};
236 237
237 238
238void WellenreiterMainWindow::demoAddStations() 239void WellenreiterMainWindow::demoAddStations()
239{ 240{
240 //mw = 0; // test SIGSEGV handling 241 //mw = 0; // test SIGSEGV handling
241 242
242 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); 243 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) );
243 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); 244 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) );
244 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); 245 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) );
245 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); 246 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) );
246 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); 247 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) );
247} 248}
248 249
249 250
250void WellenreiterMainWindow::demoReadFromGps() 251void WellenreiterMainWindow::demoReadFromGps()
251{ 252{
252 WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); 253 WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance();
253 GPS* gps = new GPS( this ); 254 GPS* gps = new GPS( this );
254 qDebug( "Wellenreiter::demoReadFromGps(): url=gps://%s:%d/", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 255 odebug << "Wellenreiter::demoReadFromGps(): url=gps://" << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "/" << oendl;
255 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 256 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
256 GpsLocation loc = gps->position(); 257 GpsLocation loc = gps->position();
257 QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); 258 QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) );
258 delete gps; 259 delete gps;
259} 260}
260 261
261 262
262QString WellenreiterMainWindow::getFileName( bool save ) 263QString WellenreiterMainWindow::getFileName( bool save )
263{ 264{
264 QMap<QString, QStringList> map; 265 QMap<QString, QStringList> map;
265 map.insert( tr("All"), QStringList() ); 266 map.insert( tr("All"), QStringList() );
266 QStringList text; 267 QStringList text;
@@ -296,93 +297,93 @@ QString WellenreiterMainWindow::getFileName( bool save )
296 297
297void WellenreiterMainWindow::fileSaveLog() 298void WellenreiterMainWindow::fileSaveLog()
298{ 299{
299 QString fname = getFileName( true ); 300 QString fname = getFileName( true );
300 if ( !fname.isEmpty() ) 301 if ( !fname.isEmpty() )
301 { 302 {
302 QFile f( fname ); 303 QFile f( fname );
303 if ( f.open(IO_WriteOnly) ) 304 if ( f.open(IO_WriteOnly) )
304 { 305 {
305 QTextStream t( &f ); 306 QTextStream t( &f );
306 t << mw->logWindow()->getLog(); 307 t << mw->logWindow()->getLog();
307 f.close(); 308 f.close();
308 qDebug( "Saved log to file '%s'", (const char*) fname ); 309 odebug << "Saved log to file '" << (const char*) fname << "'" << oendl;
309 } 310 }
310 else 311 else
311 { 312 {
312 qDebug( "Problem saving log to file '%s'", (const char*) fname ); 313 odebug << "Problem saving log to file '" << (const char*) fname << "'" << oendl;
313 } 314 }
314 } 315 }
315} 316}
316 317
317void WellenreiterMainWindow::fileSaveSession() 318void WellenreiterMainWindow::fileSaveSession()
318{ 319{
319 QString fname = getFileName( true ); 320 QString fname = getFileName( true );
320 if ( !fname.isEmpty() ) 321 if ( !fname.isEmpty() )
321 { 322 {
322 323
323 QFile f( fname ); 324 QFile f( fname );
324 if ( f.open(IO_WriteOnly) ) 325 if ( f.open(IO_WriteOnly) )
325 { 326 {
326 QDataStream t( &f ); 327 QDataStream t( &f );
327 t << *mw->netView(); 328 t << *mw->netView();
328 f.close(); 329 f.close();
329 qDebug( "Saved session to file '%s'", (const char*) fname ); 330 odebug << "Saved session to file '" << (const char*) fname << "'" << oendl;
330 } 331 }
331 else 332 else
332 { 333 {
333 qDebug( "Problem saving session to file '%s'", (const char*) fname ); 334 odebug << "Problem saving session to file '" << (const char*) fname << "'" << oendl;
334 } 335 }
335 } 336 }
336} 337}
337 338
338void WellenreiterMainWindow::fileSaveHex() 339void WellenreiterMainWindow::fileSaveHex()
339{ 340{
340 #warning DOES NOT WORK AT THE MOMENT 341 #warning DOES NOT WORK AT THE MOMENT
341 /* 342 /*
342 QString fname = getFileName( true ); 343 QString fname = getFileName( true );
343 if ( !fname.isEmpty() ) 344 if ( !fname.isEmpty() )
344 { 345 {
345 QFile f( fname ); 346 QFile f( fname );
346 if ( f.open(IO_WriteOnly) ) 347 if ( f.open(IO_WriteOnly) )
347 { 348 {
348 QTextStream t( &f ); 349 QTextStream t( &f );
349 t << mw->hexWindow()->getLog(); 350 t << mw->hexWindow()->getLog();
350 f.close(); 351 f.close();
351 qDebug( "Saved hex log to file '%s'", (const char*) fname ); 352 odebug << "Saved hex log to file '" << (const char*) fname << "'" << oendl;
352 } 353 }
353 else 354 else
354 { 355 {
355 qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); 356 odebug << "Problem saving hex log to file '" << (const char*) fname << "'" << oendl;
356 } 357 }
357 } 358 }
358 */ 359 */
359} 360}
360 361
361void WellenreiterMainWindow::fileLoadSession() 362void WellenreiterMainWindow::fileLoadSession()
362{ 363{
363 QString fname = getFileName( false ); 364 QString fname = getFileName( false );
364 if ( !fname.isEmpty() ) 365 if ( !fname.isEmpty() )
365 { 366 {
366 QFile f( fname ); 367 QFile f( fname );
367 if ( f.open(IO_ReadOnly) ) 368 if ( f.open(IO_ReadOnly) )
368 { 369 {
369 QDataStream t( &f ); 370 QDataStream t( &f );
370 t >> *mw->netView(); 371 t >> *mw->netView();
371 f.close(); 372 f.close();
372 qDebug( "Loaded session from file '%s'", (const char*) fname ); 373 odebug << "Loaded session from file '" << (const char*) fname << "'" << oendl;
373 } 374 }
374 else 375 else
375 { 376 {
376 qDebug( "Problem loading session from file '%s'", (const char*) fname ); 377 odebug << "Problem loading session from file '" << (const char*) fname << "'" << oendl;
377 } 378 }
378 } 379 }
379} 380}
380 381
381 382
382void WellenreiterMainWindow::fileNew() 383void WellenreiterMainWindow::fileNew()
383{ 384{
384 mw->netView()->clear(); 385 mw->netView()->clear();
385 mw->logWindow()->clear(); 386 mw->logWindow()->clear();
386 mw->hexWindow()->clear(); 387 mw->hexWindow()->clear();
387} 388}
388 389
@@ -429,29 +430,29 @@ void WellenreiterMainWindow::uploadSession()
429 g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 ); 430 g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 );
430 accept->setDefault( true ); 431 accept->setDefault( true );
431 accept->setAutoDefault( true ); 432 accept->setAutoDefault( true );
432 from->setText( "WL II User" ); 433 from->setText( "WL II User" );
433 location->setText( "WL II Location" ); 434 location->setText( "WL II Location" );
434 comments->setText( "No Comments." ); 435 comments->setText( "No Comments." );
435 connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); 436 connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) );
436 connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); 437 connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) );
437 int result = d->exec(); 438 int result = d->exec();
438 439
439 if ( !result ) 440 if ( !result )
440 { 441 {
441 qDebug( "Session upload cancelled :(" ); 442 odebug << "Session upload cancelled :(" << oendl;
442 return; 443 return;
443 } 444 }
444 445
445 qDebug( "Starting upload..." ); 446 odebug << "Starting upload..." << oendl;
446 447
447 struct sockaddr_in raddr; 448 struct sockaddr_in raddr;
448 struct hostent *rhost_info; 449 struct hostent *rhost_info;
449 int sock = -1; 450 int sock = -1;
450 bool ok = false; 451 bool ok = false;
451 452
452 rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); 453 rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname );
453 if ( rhost_info ) 454 if ( rhost_info )
454 { 455 {
455 456
456 457
457 if ( !QFile::exists( mw->captureFileName() ) ) 458 if ( !QFile::exists( mw->captureFileName() ) )
diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp
index 3d3aa18..4df01da 100644
--- a/noncore/net/wellenreiter/gui/packetview.cpp
+++ b/noncore/net/wellenreiter/gui/packetview.cpp
@@ -75,25 +75,25 @@ void PacketView::showPacket( int number )
75{ 75{
76 _list->clear(); 76 _list->clear();
77 _hex->setText(""); 77 _hex->setText("");
78 const OPacket* p = _packets.at( number ); 78 const OPacket* p = _packets.at( number );
79 79
80 if ( p ) 80 if ( p )
81 { 81 {
82 _doSubPackets( const_cast<QObjectList*>( p->children() ), 0 ); 82 _doSubPackets( const_cast<QObjectList*>( p->children() ), 0 );
83 _doHexPacket( p ); 83 _doHexPacket( p );
84 } 84 }
85 else 85 else
86 { 86 {
87 qDebug( "D'oh! No packet!" ); 87 odebug << "D'oh! No packet!" << oendl;
88 } 88 }
89} 89}
90 90
91void PacketView::_doSubPackets( QObjectList* l, int counter ) 91void PacketView::_doSubPackets( QObjectList* l, int counter )
92{ 92{
93 if (!l) return; 93 if (!l) return;
94 QObject* o = l->first(); 94 QObject* o = l->first();
95 while ( o ) 95 while ( o )
96 { 96 {
97 new OListViewItem( _list, QString::number( counter++ ), o->name() ); 97 new OListViewItem( _list, QString::number( counter++ ), o->name() );
98 _doSubPackets( const_cast<QObjectList*>( o->children() ), counter ); 98 _doSubPackets( const_cast<QObjectList*>( o->children() ), counter );
99 o = l->next(); 99 o = l->next();
diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp
index d98ef0b..cb17f51 100644
--- a/noncore/net/wellenreiter/gui/resource.cpp
+++ b/noncore/net/wellenreiter/gui/resource.cpp
@@ -20,30 +20,30 @@
20#include <qiconset.h> 20#include <qiconset.h>
21 21
22namespace Resource 22namespace Resource
23{ 23{
24 24
25QPixmap loadPixmap( const QString& pix ) 25QPixmap loadPixmap( const QString& pix )
26{ 26{
27 QString filename; 27 QString filename;
28 filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); 28 filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix );
29 QPixmap pixmap( filename ); 29 QPixmap pixmap( filename );
30 if ( pixmap.isNull() ) 30 if ( pixmap.isNull() )
31 { 31 {
32 qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); 32 odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl;
33 } 33 }
34 return pixmap; 34 return pixmap;
35}; 35};
36 36
37QIconSet loadIconSet( const QString& pix ) 37QIconSet loadIconSet( const QString& pix )
38{ 38{
39 QString filename; 39 QString filename;
40 filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); 40 filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix );
41 QPixmap pixmap( filename ); 41 QPixmap pixmap( filename );
42 if ( pixmap.isNull() ) 42 if ( pixmap.isNull() )
43 { 43 {
44 qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); 44 odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl;
45 } 45 }
46 return QIconSet( pixmap ); 46 return QIconSet( pixmap );
47}; 47};
48 48
49}; 49};
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 3b7120a..a2be782 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -8,59 +8,58 @@
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 "scanlist.h" 16#include "scanlist.h"
17#include "configwindow.h" 17#include "configwindow.h"
18#include "logwindow.h" 18#include "logwindow.h"
19 19
20#include <assert.h> 20/* OPIE */
21#include <qcursor.h>
22#include <qdatetime.h>
23#include <qpopupmenu.h>
24#include <qcheckbox.h>
25
26#ifdef QWS 21#ifdef QWS
22#include <opie2/odebug.h>
27#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
28#endif
29
30#ifdef QWS
31#include <qpe/resource.h> 24#include <qpe/resource.h>
32#else 25#else
33#include "resource.h" 26#include "resource.h"
34#endif 27#endif
28using namespace Opie::Core;
29using namespace Opie::Ui;
30using namespace Opie::Net;
31
32/* QT */
33#include <qcursor.h>
34#include <qdatetime.h>
35#include <qpopupmenu.h>
36#include <qcheckbox.h>
37
38/* STD */
39#include <assert.h>
35 40
36const int col_type = 0; 41const int col_type = 0;
37const int col_essid = 0; 42const int col_essid = 0;
38const int col_sig = 1; 43const int col_sig = 1;
39const int col_ap = 2; 44const int col_ap = 2;
40const int col_channel = 3; 45const int col_channel = 3;
41const int col_wep = 4; 46const int col_wep = 4;
42const int col_traffic = 5; 47const int col_traffic = 5;
43const int col_ip = 6; 48const int col_ip = 6;
44const int col_manuf = 7; 49const int col_manuf = 7;
45const int col_firstseen = 8; 50const int col_firstseen = 8;
46const int col_lastseen = 9; 51const int col_lastseen = 9;
47const int col_location = 10; 52const int col_location = 10;
48 53
49using namespace Opie::Net;
50using namespace Opie::Ui;
51using namespace Opie::Net;
52using namespace Opie::Ui;
53using namespace Opie::Ui;
54using namespace Opie::Net;
55MScanListView::MScanListView( QWidget* parent, const char* name ) 54MScanListView::MScanListView( QWidget* parent, const char* name )
56 :OListView( parent, name ) 55 :OListView( parent, name )
57{ 56{
58 setFrameShape( QListView::StyledPanel ); 57 setFrameShape( QListView::StyledPanel );
59 setFrameShadow( QListView::Sunken ); 58 setFrameShadow( QListView::Sunken );
60 59
61 addColumn( tr( "Net/Station" ) ); 60 addColumn( tr( "Net/Station" ) );
62 setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); 61 setColumnAlignment( col_essid, AlignLeft || AlignVCenter );
63 addColumn( tr( "#" ) ); 62 addColumn( tr( "#" ) );
64 setColumnAlignment( col_sig, AlignCenter ); 63 setColumnAlignment( col_sig, AlignCenter );
65 addColumn( tr( "MAC" ) ); 64 addColumn( tr( "MAC" ) );
66 setColumnAlignment( col_ap, AlignCenter ); 65 setColumnAlignment( col_ap, AlignCenter );
@@ -97,32 +96,32 @@ MScanListView::~MScanListView()
97{ 96{
98}; 97};
99 98
100 99
101OListViewItem* MScanListView::childFactory() 100OListViewItem* MScanListView::childFactory()
102{ 101{
103 return new MScanListItem( this ); 102 return new MScanListItem( this );
104} 103}
105 104
106 105
107void MScanListView::serializeTo( QDataStream& s) const 106void MScanListView::serializeTo( QDataStream& s) const
108{ 107{
109 qDebug( "serializing MScanListView" ); 108 odebug << "serializing MScanListView" << oendl;
110 OListView::serializeTo( s ); 109 OListView::serializeTo( s );
111} 110}
112 111
113 112
114void MScanListView::serializeFrom( QDataStream& s) 113void MScanListView::serializeFrom( QDataStream& s)
115{ 114{
116 qDebug( "serializing MScanListView" ); 115 odebug << "serializing MScanListView" << oendl;
117 OListView::serializeFrom( s ); 116 OListView::serializeFrom( s );
118} 117}
119 118
120 119
121void MScanListView::addNewItem( const QString& type, 120void MScanListView::addNewItem( const QString& type,
122 const QString& essid, 121 const QString& essid,
123 const OMacAddress& mac, 122 const OMacAddress& mac,
124 bool wep, 123 bool wep,
125 int channel, 124 int channel,
126 int signal, 125 int signal,
127 const GpsLocation& loc, 126 const GpsLocation& loc,
128 bool probe ) 127 bool probe )
@@ -134,68 +133,68 @@ void MScanListView::addNewItem( const QString& type,
134 (const char*) essid, (const char*) macaddr, channel ); 133 (const char*) essid, (const char*) macaddr, channel );
135 #endif 134 #endif
136 135
137 // search, if we already have seen this net 136 // search, if we already have seen this net
138 137
139 QString s; 138 QString s;
140 MScanListItem* network; 139 MScanListItem* network;
141 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); 140 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
142 141
143 while ( item && ( item->text( col_essid ) != essid ) ) 142 while ( item && ( item->text( col_essid ) != essid ) )
144 { 143 {
145 #ifdef DEBUG 144 #ifdef DEBUG
146 qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); 145 odebug << "itemtext: " << (const char*) item->text( col_essid ) << "" << oendl;
147 #endif 146 #endif
148 item = static_cast<MScanListItem*> ( item->nextSibling() ); 147 item = static_cast<MScanListItem*> ( item->nextSibling() );
149 } 148 }
150 if ( item ) 149 if ( item )
151 { 150 {
152 // we have already seen this net, check all childs if MAC exists 151 // we have already seen this net, check all childs if MAC exists
153 152
154 network = item; 153 network = item;
155 154
156 item = static_cast<MScanListItem*> ( item->firstChild() ); 155 item = static_cast<MScanListItem*> ( item->firstChild() );
157 assert( item ); // this shouldn't fail 156 assert( item ); // this shouldn't fail
158 157
159 while ( item && ( item->text( col_ap ) != macaddr ) ) 158 while ( item && ( item->text( col_ap ) != macaddr ) )
160 { 159 {
161 #ifdef DEBUG 160 #ifdef DEBUG
162 qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); 161 odebug << "subitemtext: " << (const char*) item->text( col_ap ) << "" << oendl;
163 #endif 162 #endif
164 item = static_cast<MScanListItem*> ( item->nextSibling() ); 163 item = static_cast<MScanListItem*> ( item->nextSibling() );
165 } 164 }
166 165
167 if ( item ) 166 if ( item )
168 { 167 {
169 // we have already seen this item, it's a dupe 168 // we have already seen this item, it's a dupe
170 #ifdef DEBUG 169 #ifdef DEBUG
171 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); 170 odebug << "" << (const char*) macaddr << " is a dupe - ignoring..." << oendl;
172 #endif 171 #endif
173 item->receivedBeacon(); 172 item->receivedBeacon();
174 return; 173 return;
175 } 174 }
176 } 175 }
177 else 176 else
178 { 177 {
179 s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); 178 s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid );
180 MLogWindow::logwindow()->log( s ); 179 MLogWindow::logwindow()->log( s );
181 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); 180 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe );
182 } 181 }
183 182
184 183
185 // insert new station as child from network 184 // insert new station as child from network
186 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 185 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
187 186
188 #ifdef DEBUG 187 #ifdef DEBUG
189 qDebug( "inserting new station %s", (const char*) macaddr ); 188 odebug << "inserting new station " << (const char*) macaddr << "" << oendl;
190 #endif 189 #endif
191 190
192 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 191 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
193 station->setManufacturer( mac.manufacturer() ); 192 station->setManufacturer( mac.manufacturer() );
194 station->setLocation( loc.dmsPosition() ); 193 station->setLocation( loc.dmsPosition() );
195 194
196 if ( type == "managed" ) 195 if ( type == "managed" )
197 { 196 {
198 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); 197 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel );
199 } 198 }
200 else 199 else
201 { 200 {
@@ -203,196 +202,196 @@ void MScanListView::addNewItem( const QString& type,
203 } 202 }
204 MLogWindow::logwindow()->log( s ); 203 MLogWindow::logwindow()->log( s );
205} 204}
206 205
207 206
208void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) 207void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type )
209{ 208{
210 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); 209 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
211 210
212 while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) 211 while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) )
213 { 212 {
214 #ifdef DEBUG 213 #ifdef DEBUG
215 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); 214 odebug << "subitemtext: " << (const char*) subitem->text( col_ap ) << "" << oendl;
216 #endif 215 #endif
217 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 216 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
218 } 217 }
219 218
220 if ( subitem ) 219 if ( subitem )
221 { 220 {
222 // we have already seen this item, it's a dupe 221 // we have already seen this item, it's a dupe
223 #ifdef DEBUG 222 #ifdef DEBUG
224 qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); 223 odebug << "" << (const char*) addr.toString(true) << " is a dupe - ignoring..." << oendl;
225 #endif 224 #endif
226 subitem->receivedBeacon(); //FIXME: sent data bit 225 subitem->receivedBeacon(); //FIXME: sent data bit
227 return; 226 return;
228 } 227 }
229 228
230 // Hey, it seems to be a new item :-D 229 // Hey, it seems to be a new item :-D
231 MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); 230 MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 );
232 station->setManufacturer( addr.manufacturer() ); 231 station->setManufacturer( addr.manufacturer() );
233 232
234 QString s; 233 QString s;
235 if ( type == "station" ) 234 if ( type == "station" )
236 { 235 {
237 s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); 236 s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) );
238 } 237 }
239 else 238 else
240 { 239 {
241 s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); 240 s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) );
242 } 241 }
243 MLogWindow::logwindow()->log( s ); 242 MLogWindow::logwindow()->log( s );
244} 243}
245 244
246 245
247void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) 246void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo )
248{ 247{
249 qDebug( "WDSTraffic: %s and %s seem to form a WDS", (const char*) viaFrom.toString(), (const char*) viaTo.toString() ); 248 odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << (const char*) viaTo.toString() << " seem to form a WDS" << oendl;
250 QString s; 249 QString s;
251 MScanListItem* network; 250 MScanListItem* network;
252 251
253 QListViewItemIterator it( this ); 252 QListViewItemIterator it( this );
254 while ( it.current() && 253 while ( it.current() &&
255 it.current()->text( col_ap ) != viaFrom.toString(true) && 254 it.current()->text( col_ap ) != viaFrom.toString(true) &&
256 it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; 255 it.current()->text( col_ap ) != viaTo.toString(true) ) ++it;
257 256
258 MScanListItem* item = static_cast<MScanListItem*>( it.current() ); 257 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
259 258
260 if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations 259 if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations
261 { 260 {
262 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); 261 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from );
263 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); 262 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to );
264 } 263 }
265 else 264 else
266 { 265 {
267 qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); 266 odebug << "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" << oendl;
268 MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); 267 MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" );
269 } 268 }
270} 269}
271 270
272 271
273void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 272void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
274{ 273{
275 QString s; 274 QString s;
276 MScanListItem* network; 275 MScanListItem* network;
277 276
278 QListViewItemIterator it( this ); 277 QListViewItemIterator it( this );
279 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; 278 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it;
280 279
281 MScanListItem* item = static_cast<MScanListItem*>( it.current() ); 280 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
282 281
283 if ( item ) // AP has shown up yet, so just add our new "from" - station 282 if ( item ) // AP has shown up yet, so just add our new "from" - station
284 { 283 {
285 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); 284 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" );
286 } 285 }
287 else 286 else
288 { 287 {
289 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); 288 odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl;
290 MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); 289 MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" );
291 290
292 } 291 }
293} 292}
294 293
295 294
296void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 295void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
297{ 296{
298 QString s; 297 QString s;
299 MScanListItem* network; 298 MScanListItem* network;
300 299
301 QListViewItemIterator it( this ); 300 QListViewItemIterator it( this );
302 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; 301 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it;
303 302
304 MScanListItem* item = static_cast<MScanListItem*>( it.current() ); 303 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
305 304
306 if ( item ) // AP has shown up yet, so just add our new "from" - station 305 if ( item ) // AP has shown up yet, so just add our new "from" - station
307 { 306 {
308 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); 307 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" );
309 } 308 }
310 else 309 else
311 { 310 {
312 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); 311 odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl;
313 MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); 312 MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" );
314 } 313 }
315} 314}
316 315
317 316
318void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 317void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
319{ 318{
320 qWarning( "D'oh! Not yet implemented..." ); 319 owarn << "D'oh! Not yet implemented..." << oendl;
321 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); 320 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" );
322} 321}
323 322
324 323
325void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) 324void MScanListView::identify( const OMacAddress& macaddr, const QString& ip )
326{ 325{
327 qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); 326 odebug << "identify " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl;
328 327
329 QListViewItemIterator it( this ); 328 QListViewItemIterator it( this );
330 for ( ; it.current(); ++it ) 329 for ( ; it.current(); ++it )
331 { 330 {
332 if ( it.current()->text( col_ap ) == macaddr.toString(true) ) 331 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
333 { 332 {
334 it.current()->setText( col_ip, ip ); 333 it.current()->setText( col_ip, ip );
335 return; 334 return;
336 } 335 }
337 } 336 }
338 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); 337 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
339 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", 338 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!",
340 (const char*) macaddr.toString(), (const char*) ip ) ); 339 (const char*) macaddr.toString(), (const char*) ip ) );
341} 340}
342 341
343 342
344void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) 343void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip )
345{ 344{
346 qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); 345 odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl;
347 346
348 //TODO: Refactor that out, we need it all over the place. 347 //TODO: Refactor that out, we need it all over the place.
349 // Best to do it in a more comfortable abstraction in OListView 348 // Best to do it in a more comfortable abstraction in OListView
350 // (Hmm, didn't I already start something in this direction?) 349 // (Hmm, didn't I already start something in this direction?)
351 350
352 QListViewItemIterator it( this ); 351 QListViewItemIterator it( this );
353 for ( ; it.current(); ++it ) 352 for ( ; it.current(); ++it )
354 { 353 {
355 if ( it.current()->text( col_ap ) == macaddr.toString(true) ) 354 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
356 { 355 {
357 356
358 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); 357 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() );
359 358
360 while ( subitem && ( subitem->text( col_essid ) != name ) ) 359 while ( subitem && ( subitem->text( col_essid ) != name ) )
361 { 360 {
362 #ifdef DEBUG 361 #ifdef DEBUG
363 qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); 362 odebug << "subitemtext: " << (const char*) subitem->text( col_essid ) << "" << oendl;
364 #endif 363 #endif
365 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 364 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
366 } 365 }
367 366
368 if ( subitem ) 367 if ( subitem )
369 { 368 {
370 // we have already seen this item, it's a dupe 369 // we have already seen this item, it's a dupe
371 #ifdef DEBUG 370 #ifdef DEBUG
372 qDebug( "%s is a dupe - ignoring...", (const char*) name ); 371 odebug << "" << (const char*) name << " is a dupe - ignoring..." << oendl;
373 #endif 372 #endif
374 subitem->receivedBeacon(); //FIXME: sent data bit 373 subitem->receivedBeacon(); //FIXME: sent data bit
375 return; 374 return;
376 } 375 }
377 376
378 // never seen that - add new item 377 // never seen that - add new item
379 378
380 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); 379 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 );
381 item->setText( col_essid, name ); 380 item->setText( col_essid, name );
382 381
383 return; 382 return;
384 } 383 }
385 } 384 }
386 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); 385 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
387 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", 386 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!",
388 (const char*) macaddr.toString(), (const char*) ip ) ); 387 (const char*) macaddr.toString(), (const char*) ip ) );
389} 388}
390 389
391 390
392void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) 391void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col )
393{ 392{
394 if ( !item ) return; 393 if ( !item ) return;
395 394
396 MScanListItem* itm = static_cast<MScanListItem*>( item ); 395 MScanListItem* itm = static_cast<MScanListItem*>( item );
397 396
398 qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", 397 qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'",
@@ -412,74 +411,74 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in
412 411
413//============================================================ 412//============================================================
414// MScanListItem 413// MScanListItem
415//============================================================ 414//============================================================
416 415
417MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, 416MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr,
418 bool wep, int channel, int signal, bool probed ) 417 bool wep, int channel, int signal, bool probed )
419 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), 418 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
420 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), 419 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
421 _channel( channel ), _signal( signal ), _beacons( 1 ) 420 _channel( channel ), _signal( signal ), _beacons( 1 )
422{ 421{
423 #ifdef DEBUG 422 #ifdef DEBUG
424 qDebug( "creating scanlist item" ); 423 odebug << "creating scanlist item" << oendl;
425 #endif 424 #endif
426 425
427 if ( WellenreiterConfigWindow::instance() ) 426 if ( WellenreiterConfigWindow::instance() )
428 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here 427 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
429 428
430 decorateItem( type, essid, macaddr, wep, channel, signal, probed ); 429 decorateItem( type, essid, macaddr, wep, channel, signal, probed );
431} 430}
432 431
433MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, 432MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr,
434 bool wep, int channel, int signal ) 433 bool wep, int channel, int signal )
435 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 434 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
436{ 435{
437 #ifdef DEBUG 436 #ifdef DEBUG
438 qDebug( "creating scanlist item" ); 437 odebug << "creating scanlist item" << oendl;
439 #endif 438 #endif
440 if ( WellenreiterConfigWindow::instance() ) 439 if ( WellenreiterConfigWindow::instance() )
441 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here 440 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
442 441
443 decorateItem( type, essid, macaddr, wep, channel, signal, false ); 442 decorateItem( type, essid, macaddr, wep, channel, signal, false );
444} 443}
445 444
446const QString& MScanListItem::essid() const 445const QString& MScanListItem::essid() const
447{ 446{
448 if ( type == "network" ) 447 if ( type == "network" )
449 return _essid; 448 return _essid;
450 else 449 else
451 return ( (MScanListItem*) parent() )->essid(); 450 return ( (MScanListItem*) parent() )->essid();
452} 451}
453 452
454OListViewItem* MScanListItem::childFactory() 453OListViewItem* MScanListItem::childFactory()
455{ 454{
456 return new MScanListItem( this ); 455 return new MScanListItem( this );
457} 456}
458 457
459void MScanListItem::serializeTo( QDataStream& s ) const 458void MScanListItem::serializeTo( QDataStream& s ) const
460{ 459{
461 #ifdef DEBUG 460 #ifdef DEBUG
462 qDebug( "serializing MScanListItem" ); 461 odebug << "serializing MScanListItem" << oendl;
463 #endif 462 #endif
464 OListViewItem::serializeTo( s ); 463 OListViewItem::serializeTo( s );
465 464
466 s << _type; 465 s << _type;
467 s << (Q_UINT8) ( _wep ? 'y' : 'n' ); 466 s << (Q_UINT8) ( _wep ? 'y' : 'n' );
468} 467}
469 468
470void MScanListItem::serializeFrom( QDataStream& s ) 469void MScanListItem::serializeFrom( QDataStream& s )
471{ 470{
472 #ifdef DEBUG 471 #ifdef DEBUG
473 qDebug( "serializing MScanListItem" ); 472 odebug << "serializing MScanListItem" << oendl;
474 #endif 473 #endif
475 OListViewItem::serializeFrom( s ); 474 OListViewItem::serializeFrom( s );
476 475
477 char wep; 476 char wep;
478 s >> _type; 477 s >> _type;
479 s >> (Q_UINT8) wep; 478 s >> (Q_UINT8) wep;
480 _wep = (wep == 'y'); 479 _wep = (wep == 'y');
481 480
482 QString name; 481 QString name;
483 name.sprintf( "wellenreiter/%s", (const char*) _type ); 482 name.sprintf( "wellenreiter/%s", (const char*) _type );
484 setPixmap( col_type, Resource::loadPixmap( name ) ); 483 setPixmap( col_type, Resource::loadPixmap( name ) );
485 if ( _wep ) 484 if ( _wep )
@@ -547,22 +546,22 @@ void MScanListItem::setManufacturer( const QString& manufacturer )
547 546
548 547
549void MScanListItem::setLocation( const QString& location ) 548void MScanListItem::setLocation( const QString& location )
550{ 549{
551 setText( col_location, location ); 550 setText( col_location, location );
552} 551}
553 552
554 553
555void MScanListItem::receivedBeacon() 554void MScanListItem::receivedBeacon()
556{ 555{
557 _beacons++; 556 _beacons++;
558 #ifdef DEBUG 557 #ifdef DEBUG
559 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); 558 odebug << "MScanListItem " << (const char*) _macaddr << ": received beacon #" << _beacons << "" << oendl;
560 #endif 559 #endif
561 setText( col_sig, QString::number( _beacons ) ); 560 setText( col_sig, QString::number( _beacons ) );
562 setText( col_lastseen, QTime::currentTime().toString() ); 561 setText( col_lastseen, QTime::currentTime().toString() );
563 562
564 MScanListItem* p = (MScanListItem*) parent(); 563 MScanListItem* p = (MScanListItem*) parent();
565 if ( p ) p->receivedBeacon(); 564 if ( p ) p->receivedBeacon();
566 565
567} 566}
568 567
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index fff7c35..fad6efd 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -2,80 +2,72 @@
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
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// Local
15
16#include "gps.h" 14#include "gps.h"
17#include "wellenreiter.h" 15#include "wellenreiter.h"
18#include "scanlist.h" 16#include "scanlist.h"
19#include "logwindow.h" 17#include "logwindow.h"
20#include "packetview.h" 18#include "packetview.h"
21#include "configwindow.h" 19#include "configwindow.h"
22#include "statwindow.h" 20#include "statwindow.h"
23#include "graphwindow.h" 21#include "graphwindow.h"
24#include "protolistview.h" 22#include "protolistview.h"
25 23
26// Opie 24/* OPIE */
27
28#ifdef QWS 25#ifdef QWS
29#include <opie2/oapplication.h> 26#include <opie2/oapplication.h>
27#include <opie2/odebug.h>
30#include <opie2/odevice.h> 28#include <opie2/odevice.h>
31#else 29#else
32#include <qapplication.h> 30#include <qapplication.h>
33#endif 31#endif
34#include <opie2/omanufacturerdb.h> 32#include <opie2/omanufacturerdb.h>
35#include <opie2/onetwork.h> 33#include <opie2/onetwork.h>
36#include <opie2/opcap.h> 34#include <opie2/opcap.h>
37#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
38using namespace Opie; 36using namespace Opie::Core;
39 37using namespace Opie::Net;
40// Qt 38using namespace Opie::Ui;
41 39
40/* QT */
42#include <qcheckbox.h> 41#include <qcheckbox.h>
43#include <qcombobox.h> 42#include <qcombobox.h>
44#include <qdatetime.h> 43#include <qdatetime.h>
45#include <qpushbutton.h> 44#include <qpushbutton.h>
46#include <qlineedit.h> 45#include <qlineedit.h>
47#include <qmessagebox.h> 46#include <qmessagebox.h>
48#include <qobjectlist.h> 47#include <qobjectlist.h>
49#include <qregexp.h> 48#include <qregexp.h>
50#include <qspinbox.h> 49#include <qspinbox.h>
51#include <qtimer.h> 50#include <qtimer.h>
52#include <qtoolbutton.h> 51#include <qtoolbutton.h>
53#include <qmainwindow.h> 52#include <qmainwindow.h>
54 53
55// Standard 54/* STD */
56
57#include <assert.h> 55#include <assert.h>
58#include <errno.h> 56#include <errno.h>
59#include <unistd.h> 57#include <unistd.h>
60#include <string.h> 58#include <string.h>
61#include <sys/types.h> 59#include <sys/types.h>
62#include <stdlib.h> 60#include <stdlib.h>
63 61
64using namespace Opie::Core;
65using namespace Opie::Net;
66using namespace Opie::Net;
67using namespace Opie::Core;
68using namespace Opie::Net;
69using namespace Opie::Core;
70Wellenreiter::Wellenreiter( QWidget* parent ) 62Wellenreiter::Wellenreiter( QWidget* parent )
71 : WellenreiterBase( parent, 0, 0 ), 63 : WellenreiterBase( parent, 0, 0 ),
72 sniffing( false ), iface( 0 ), configwindow( 0 ) 64 sniffing( false ), iface( 0 ), configwindow( 0 )
73{ 65{
74 66
75 logwindow->log( "(i) Wellenreiter has been started." ); 67 logwindow->log( "(i) Wellenreiter has been started." );
76 68
77 // 69 //
78 // detect operating system 70 // detect operating system
79 // 71 //
80 72
81 #ifdef QWS 73 #ifdef QWS
@@ -97,25 +89,25 @@ Wellenreiter::Wellenreiter( QWidget* parent )
97 89
98} 90}
99 91
100 92
101Wellenreiter::~Wellenreiter() 93Wellenreiter::~Wellenreiter()
102{ 94{
103 delete pcap; 95 delete pcap;
104} 96}
105 97
106 98
107void Wellenreiter::initialTimer() 99void Wellenreiter::initialTimer()
108{ 100{
109 qDebug( "Wellenreiter::preloading manufacturer database..." ); 101 odebug << "Wellenreiter::preloading manufacturer database..." << oendl;
110 OManufacturerDB::instance(); 102 OManufacturerDB::instance();
111} 103}
112 104
113 105
114void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) 106void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
115{ 107{
116 configwindow = cw; 108 configwindow = cw;
117} 109}
118 110
119 111
120void Wellenreiter::channelHopped(int c) 112void Wellenreiter::channelHopped(int c)
121{ 113{
@@ -140,104 +132,104 @@ void Wellenreiter::channelHopped(int c)
140void Wellenreiter::handleNotification( OPacket* p ) 132void Wellenreiter::handleNotification( OPacket* p )
141{ 133{
142 QObjectList* l = p->queryList(); 134 QObjectList* l = p->queryList();
143 QObjectListIt it( *l ); 135 QObjectListIt it( *l );
144 QObject* o; 136 QObject* o;
145 137
146 while ( (o = it.current()) != 0 ) 138 while ( (o = it.current()) != 0 )
147 { 139 {
148 QString name = it.current()->name(); 140 QString name = it.current()->name();
149 if ( configwindow->parsePackets->isProtocolChecked( name ) ) 141 if ( configwindow->parsePackets->isProtocolChecked( name ) )
150 { 142 {
151 QString action = configwindow->parsePackets->protocolAction( name ); 143 QString action = configwindow->parsePackets->protocolAction( name );
152 qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); 144 odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl;
153 doAction( action, name, p ); 145 doAction( action, name, p );
154 } 146 }
155 else 147 else
156 { 148 {
157 qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); 149 odebug << "protocol '" << (const char*) name << "' not checked in parsePackets." << oendl;
158 } 150 }
159 ++it; 151 ++it;
160 } 152 }
161} 153}
162 154
163 155
164void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) 156void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage )
165{ 157{
166 if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); 158 if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage );
167 else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); 159 else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage );
168 else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); 160 else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage );
169 else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); 161 else owarn << "Wellenreiter::handleManagementFrame(): '" << (const char*) manage->managementType() << "' - please handle me!" << oendl;
170} 162}
171 163
172 164
173void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) 165void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request )
174{ 166{
175 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 167 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
176 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); 168 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>");
177 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 169 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
178 int channel = ds ? ds->channel() : -1; 170 int channel = ds ? ds->channel() : -1;
179 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 171 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
180 172
181 GpsLocation loc( -111, -111 ); 173 GpsLocation loc( -111, -111 );
182 if ( configwindow->enableGPS->isChecked() ) 174 if ( configwindow->enableGPS->isChecked() )
183 { 175 {
184 // TODO: add check if GPS is working!? 176 // TODO: add check if GPS is working!?
185 qDebug( "Wellenreiter::gathering GPS data..." ); 177 odebug << "Wellenreiter::gathering GPS data..." << oendl;
186 loc = gps->position(); 178 loc = gps->position();
187 qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); 179 odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl;
188 } 180 }
189 181
190 if ( essid.length() ) 182 if ( essid.length() )
191 netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); 183 netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ );
192 qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); 184 odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl;
193} 185}
194 186
195 187
196void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) 188void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response )
197{ 189{
198} 190}
199 191
200 192
201void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) 193void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
202{ 194{
203 QString type; 195 QString type;
204 if ( beacon->canIBSS() ) 196 if ( beacon->canIBSS() )
205 { 197 {
206 type = "adhoc"; 198 type = "adhoc";
207 } 199 }
208 else if ( beacon->canESS() ) 200 else if ( beacon->canESS() )
209 { 201 {
210 type = "managed"; 202 type = "managed";
211 } 203 }
212 else 204 else
213 { 205 {
214 qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); 206 owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl;
215 return; 207 return;
216 } 208 }
217 209
218 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 210 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
219 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); 211 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>");
220 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 212 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
221 int channel = ds ? ds->channel() : -1; 213 int channel = ds ? ds->channel() : -1;
222 214
223 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 215 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
224 216
225 GpsLocation loc( -111, -111 ); 217 GpsLocation loc( -111, -111 );
226 if ( configwindow->enableGPS->isChecked() ) 218 if ( configwindow->enableGPS->isChecked() )
227 { 219 {
228 // TODO: add check if GPS is working!? 220 // TODO: add check if GPS is working!?
229 qDebug( "Wellenreiter::gathering GPS data..." ); 221 odebug << "Wellenreiter::gathering GPS data..." << oendl;
230 loc = gps->position(); 222 loc = gps->position();
231 qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); 223 odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl;
232 } 224 }
233 225
234 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); 226 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc );
235 227
236 // update graph window 228 // update graph window
237 if ( ds ) 229 if ( ds )
238 { 230 {
239 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); 231 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) );
240 if ( prism ) 232 if ( prism )
241 graphwindow->traffic( ds->channel(), prism->signalStrength() ); 233 graphwindow->traffic( ds->channel(), prism->signalStrength() );
242 else 234 else
243 graphwindow->traffic( ds->channel(), 95 ); 235 graphwindow->traffic( ds->channel(), 95 );
@@ -246,25 +238,25 @@ void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPa
246 238
247 239
248void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) 240void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control )
249{ 241{
250 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 242 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
251 243
252 if ( control->controlType() == "Acknowledge" ) 244 if ( control->controlType() == "Acknowledge" )
253 { 245 {
254 netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); 246 netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) );
255 } 247 }
256 else 248 else
257 { 249 {
258 qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); 250 odebug << "Wellenreiter::handleControlFrame - please handle " << (const char*) control->controlType() << " in a future version! :D" << oendl;
259 } 251 }
260} 252}
261 253
262 254
263void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) 255void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to )
264{ 256{
265 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 257 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
266 if ( wlan->fromDS() && !wlan->toDS() ) 258 if ( wlan->fromDS() && !wlan->toDS() )
267 { 259 {
268 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); 260 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
269 from = wlan->macAddress3(); 261 from = wlan->macAddress3();
270 to = wlan->macAddress2(); 262 to = wlan->macAddress2();
@@ -295,55 +287,55 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd
295 from = data->sourceAddress(); 287 from = data->sourceAddress();
296 to = data->destinationAddress(); 288 to = data->destinationAddress();
297 289
298 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); 290 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) );
299} 291}
300 292
301 293
302void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) 294void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest )
303{ 295{
304 OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); 296 OARPPacket* arp = (OARPPacket*) p->child( "ARP" );
305 if ( arp ) 297 if ( arp )
306 { 298 {
307 qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); 299 odebug << "Received ARP traffic (type '" << (const char*) arp->type() << "'): " << oendl;
308 if ( arp->type() == "REQUEST" ) 300 if ( arp->type() == "REQUEST" )
309 { 301 {
310 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 302 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
311 } 303 }
312 else if ( arp->type() == "REPLY" ) 304 else if ( arp->type() == "REPLY" )
313 { 305 {
314 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 306 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
315 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); 307 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() );
316 } 308 }
317 } 309 }
318} 310}
319 311
320 312
321void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) 313void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest )
322{ 314{
323 //TODO: Implement more IP based protocols 315 //TODO: Implement more IP based protocols
324 316
325 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); 317 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" );
326 if ( dhcp ) 318 if ( dhcp )
327 { 319 {
328 qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); 320 odebug << "Received DHCP '" << (const char*) dhcp->type() << "' packet" << oendl;
329 if ( dhcp->type() == "OFFER" ) 321 if ( dhcp->type() == "OFFER" )
330 { 322 {
331 qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); 323 odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << (const char*) dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl;
332 netView()->identify( source, dhcp->serverAddress().toString() ); 324 netView()->identify( source, dhcp->serverAddress().toString() );
333 netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); 325 netView()->addService( "DHCP", source, dhcp->serverAddress().toString() );
334 } 326 }
335 else if ( dhcp->type() == "ACK" ) 327 else if ( dhcp->type() == "ACK" )
336 { 328 {
337 qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); 329 odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << (const char*) dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl;
338 netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); 330 netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() );
339 } 331 }
340 } 332 }
341} 333}
342 334
343 335
344QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) 336QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
345{ 337{
346 if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) 338 if ( configwindow->parsePackets->isProtocolChecked( protocol ) )
347 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) 339 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" )
348 return 0; 340 return 0;
349 341
@@ -359,34 +351,34 @@ bool Wellenreiter::checkDumpPacket( OPacket* p )
359 return true; // semantic change - we're logging anyway now to /tmp/wellenreiter 351 return true; // semantic change - we're logging anyway now to /tmp/wellenreiter
360 352
361 QObjectList* l = p->queryList(); 353 QObjectList* l = p->queryList();
362 QObjectListIt it( *l ); 354 QObjectListIt it( *l );
363 QObject* o; 355 QObject* o;
364 356
365 while ( (o = it.current()) != 0 ) 357 while ( (o = it.current()) != 0 )
366 { 358 {
367 QString name = it.current()->name(); 359 QString name = it.current()->name();
368 if ( configwindow->capturePackets->isProtocolChecked( name ) ) 360 if ( configwindow->capturePackets->isProtocolChecked( name ) )
369 { 361 {
370 QString action = configwindow->capturePackets->protocolAction( name ); 362 QString action = configwindow->capturePackets->protocolAction( name );
371 qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); 363 odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl;
372 if ( action == "Discard" ) 364 if ( action == "Discard" )
373 { 365 {
374 logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); 366 logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) );
375 return false; 367 return false;
376 } 368 }
377 } 369 }
378 else 370 else
379 { 371 {
380 qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name ); 372 odebug << "protocol '" << (const char*) name << "' not checked in capturePackets." << oendl;
381 } 373 }
382 ++it; 374 ++it;
383 } 375 }
384 return true; 376 return true;
385} 377}
386 378
387 379
388void Wellenreiter::receivePacket( OPacket* p ) 380void Wellenreiter::receivePacket( OPacket* p )
389{ 381{
390 hexWindow()->add( p ); 382 hexWindow()->add( p );
391 383
392 if ( checkDumpPacket( p ) ) 384 if ( checkDumpPacket( p ) )
@@ -542,70 +534,70 @@ void Wellenreiter::startClicked()
542 } 534 }
543 } 535 }
544 // set monitor mode 536 // set monitor mode
545 bool usePrism = configwindow->usePrismHeader(); 537 bool usePrism = configwindow->usePrismHeader();
546 538
547 switch ( cardtype ) 539 switch ( cardtype )
548 { 540 {
549 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; 541 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break;
550 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; 542 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break;
551 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; 543 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break;
552 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; 544 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break;
553 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; 545 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break;
554 case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; 546 case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << (const char*) interface << "'" << oendl; break;
555 default: assert( 0 ); // shouldn't reach this 547 default: assert( 0 ); // shouldn't reach this
556 } 548 }
557 549
558 // switch device into monitor mode 550 // switch device into monitor mode
559 if ( cardtype < DEVTYPE_FILE ) 551 if ( cardtype < DEVTYPE_FILE )
560 { 552 {
561 if ( cardtype != DEVTYPE_MANUAL ) 553 if ( cardtype != DEVTYPE_MANUAL )
562 iface->setMode( "monitor" ); 554 iface->setMode( "monitor" );
563 if ( iface->mode() != "monitor" ) 555 if ( iface->mode() != "monitor" )
564 { 556 {
565 if ( QMessageBox::warning( this, "Wellenreiter II", 557 if ( QMessageBox::warning( this, "Wellenreiter II",
566 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + 558 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) +
567 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 559 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
568 return; 560 return;
569 } 561 }
570 } 562 }
571 563
572 // open GPS device 564 // open GPS device
573 if ( configwindow->enableGPS->isChecked() ) 565 if ( configwindow->enableGPS->isChecked() )
574 { 566 {
575 qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 567 odebug << "Wellenreiter:GPS enabled @ " << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl;
576 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 568 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
577 } 569 }
578 570
579 // open pcap and start sniffing 571 // open pcap and start sniffing
580 572
581 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? 573 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file?
582 { 574 {
583 dumpname = configwindow->captureFileName->text(); 575 dumpname = configwindow->captureFileName->text();
584 if ( dumpname.isEmpty() ) dumpname = "captureFile"; 576 if ( dumpname.isEmpty() ) dumpname = "captureFile";
585 dumpname.append( '-' ); 577 dumpname.append( '-' );
586 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); 578 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
587 dumpname.append( ".wellenreiter" ); 579 dumpname.append( ".wellenreiter" );
588 } 580 }
589 else // write it anyway ;) 581 else // write it anyway ;)
590 { 582 {
591 dumpname = "/var/log/dump.wellenreiter"; 583 dumpname = "/var/log/dump.wellenreiter";
592 } 584 }
593 585
594 if ( cardtype != DEVTYPE_FILE ) 586 if ( cardtype != DEVTYPE_FILE )
595 pcap->open( interface ); 587 pcap->open( interface );
596 else 588 else
597 pcap->open( QFile( interface ) ); 589 pcap->open( QFile( interface ) );
598 590
599 qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); 591 odebug << "Wellenreiter:: dumping to " << (const char*) dumpname << "" << oendl;
600 pcap->openDumpFile( dumpname ); 592 pcap->openDumpFile( dumpname );
601 593
602 if ( !pcap->isOpen() ) 594 if ( !pcap->isOpen() )
603 { 595 {
604 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( 596 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(
605 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); 597 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) ));
606 return; 598 return;
607 } 599 }
608 600
609 // set capturer to non-blocking mode 601 // set capturer to non-blocking mode
610 pcap->setBlocking( false ); 602 pcap->setBlocking( false );
611 603
@@ -643,25 +635,25 @@ void Wellenreiter::startClicked()
643 emit( startedSniffing() ); 635 emit( startedSniffing() );
644 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title 636 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
645 else 637 else
646 { 638 {
647 assert( parent() ); 639 assert( parent() );
648 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); 640 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) );
649 } 641 }
650} 642}
651 643
652 644
653void Wellenreiter::timerEvent( QTimerEvent* ) 645void Wellenreiter::timerEvent( QTimerEvent* )
654{ 646{
655 qDebug( "Wellenreiter::timerEvent()" ); 647 odebug << "Wellenreiter::timerEvent()" << oendl;
656 OPacket* p = pcap->next(); 648 OPacket* p = pcap->next();
657 if ( !p ) // no more packets available 649 if ( !p ) // no more packets available
658 { 650 {
659 stopClicked(); 651 stopClicked();
660 } 652 }
661 else 653 else
662 { 654 {
663 receivePacket( p ); 655 receivePacket( p );
664 // We no longer delete packets here. Ownership of the packets is 656 // We no longer delete packets here. Ownership of the packets is
665 // transferred to the PacketView. 657 // transferred to the PacketView.
666 //delete p; 658 //delete p;
667 } 659 }
@@ -706,28 +698,28 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch
706 return; 698 return;
707 } 699 }
708 700
709 qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", 701 qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s",
710 (const char*) iface->name(), 702 (const char*) iface->name(),
711 (const char*) type, 703 (const char*) type,
712 (const char*) essid, 704 (const char*) essid,
713 channel, 705 channel,
714 (const char*) macaddr ); 706 (const char*) macaddr );
715 707
716 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); 708 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" );
717 int count = 3; 709 int count = 3;
718 qDebug("sending %d messages",count); 710 odebug << "sending " << count << " messages" << oendl;
719 msg << QString("count") << QString::number(count); 711 msg << QString("count") << QString::number(count);
720 qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); 712 odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl;
721 msg << QString(iface->name()) << QString("Mode") << type; 713 msg << QString(iface->name()) << QString("Mode") << type;
722 qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); 714 odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl;
723 msg << QString(iface->name()) << QString("ESSID") << essid; 715 msg << QString(iface->name()) << QString("ESSID") << essid;
724 qDebug("msg >%s< channel >%d<", iface->name(),channel); 716 odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl;
725 msg << QString(iface->name()) << QString("Channel") << channel; 717 msg << QString(iface->name()) << QString("Channel") << channel;
726// qDebug("msg >%s< mac >%s<", iface->name(),macaddr); 718// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl;
727// msg << QString(iface->name()) << QString("MacAddr") << macaddr; 719// msg << QString(iface->name()) << QString("MacAddr") << macaddr;
728 #else 720 #else
729 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); 721 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) );
730 #endif 722 #endif
731 723
732} 724}
733 725
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp
index 58e5c71..2eccdfe 100644
--- a/noncore/settings/backup/backuprestore.cpp
+++ b/noncore/settings/backup/backuprestore.cpp
@@ -1,19 +1,20 @@
1
2#include "backuprestore.h" 1#include "backuprestore.h"
3#include "errordialog.h" 2#include "errordialog.h"
4 3
5/* OPIE */ 4/* OPIE */
5#include <opie2/odebug.h>
6#include <opie2/ostorageinfo.h> 6#include <opie2/ostorageinfo.h>
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8using namespace Opie::Core;
8 9
9/* QT */ 10/* QT */
10#include <qapplication.h> 11#include <qapplication.h>
11#include <qmultilineedit.h> 12#include <qmultilineedit.h>
12#include <qdir.h> 13#include <qdir.h>
13#include <qfile.h> 14#include <qfile.h>
14#include <qfileinfo.h> 15#include <qfileinfo.h>
15#include <qlistview.h> 16#include <qlistview.h>
16#include <qpushbutton.h> 17#include <qpushbutton.h>
17#include <qheader.h> 18#include <qheader.h>
18#include <qpe/resource.h> 19#include <qpe/resource.h>
19#include <qpe/config.h> 20#include <qpe/config.h>
@@ -31,25 +32,24 @@
31#include <unistd.h> 32#include <unistd.h>
32#include <sys/stat.h> 33#include <sys/stat.h>
33#include <dirent.h> 34#include <dirent.h>
34 35
35#define HEADER_NAME 0 36#define HEADER_NAME 0
36#define HEADER_BACKUP 1 37#define HEADER_BACKUP 1
37#define BACKUP_LOCATION 2 38#define BACKUP_LOCATION 2
38 39
39#define EXTENSION ".bck" 40#define EXTENSION ".bck"
40 41
41const QString tempFileName = "/tmp/backup.err"; 42const QString tempFileName = "/tmp/backup.err";
42 43
43
44BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) 44BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl)
45 : BackupAndRestoreBase(parent, name, fl) 45 : BackupAndRestoreBase(parent, name, fl)
46{ 46{
47 backupList->header()->hide(); 47 backupList->header()->hide();
48 restoreList->header()->hide(); 48 restoreList->header()->hide();
49 connect(backupButton, SIGNAL(clicked()), 49 connect(backupButton, SIGNAL(clicked()),
50 this, SLOT(backup())); 50 this, SLOT(backup()));
51 connect(restoreButton, SIGNAL(clicked()), 51 connect(restoreButton, SIGNAL(clicked()),
52 this, SLOT(restore())); 52 this, SLOT(restore()));
53 connect(backupList, SIGNAL(clicked(QListViewItem*)), 53 connect(backupList, SIGNAL(clicked(QListViewItem*)),
54 this, SLOT(selectItem(QListViewItem*))); 54 this, SLOT(selectItem(QListViewItem*)));
55 connect(restoreSource, SIGNAL(activated(int)), 55 connect(restoreSource, SIGNAL(activated(int)),
@@ -64,35 +64,35 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f
64 selectItem(applicationSettings); 64 selectItem(applicationSettings);
65 documents= new QListViewItem(backupList, "Documents", "", "Documents/"); 65 documents= new QListViewItem(backupList, "Documents", "", "Documents/");
66 selectItem(documents); 66 selectItem(documents);
67 67
68 scanForApplicationSettings(); 68 scanForApplicationSettings();
69 69
70 Opie::Core::OStorageInfo storage; 70 Opie::Core::OStorageInfo storage;
71 71
72 backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); 72 backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" );
73 if ( storage.hasCf() ) 73 if ( storage.hasCf() )
74 { 74 {
75 backupLocations.insert( "CF", storage.cfPath() ); 75 backupLocations.insert( "CF", storage.cfPath() );
76 qDebug( "Cf Path: " + storage.cfPath() ); 76 odebug << "Cf Path: " + storage.cfPath() << oendl;
77 } 77 }
78 if ( storage.hasSd() ) 78 if ( storage.hasSd() )
79 { 79 {
80 backupLocations.insert( "SD", storage.sdPath() ); 80 backupLocations.insert( "SD", storage.sdPath() );
81 qDebug( " Sd Path: " + storage.sdPath() ); 81 odebug << " Sd Path: " + storage.sdPath() << oendl;
82 } 82 }
83 if ( storage.hasMmc() ) 83 if ( storage.hasMmc() )
84 { 84 {
85 backupLocations.insert( "MMC", storage.mmcPath() ); 85 backupLocations.insert( "MMC", storage.mmcPath() );
86 qDebug( "Mmc Path: " + storage.mmcPath() ); 86 odebug << "Mmc Path: " + storage.mmcPath() << oendl;
87 } 87 }
88 88
89 Config config("BackupAndRestore"); 89 Config config("BackupAndRestore");
90 //read last locations 90 //read last locations
91 config.setGroup("LastLocation"); 91 config.setGroup("LastLocation");
92 QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); 92 QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" );
93 QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); 93 QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" );
94 int locationIndex = 0; 94 int locationIndex = 0;
95 95
96 QMap<QString, QString>::Iterator it; 96 QMap<QString, QString>::Iterator it;
97 for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) 97 for( it = backupLocations.begin(); it != backupLocations.end(); ++it )
98 { 98 {
@@ -194,25 +194,25 @@ void BackupAndRestore::selectItem(QListViewItem *currentItem)
194 } 194 }
195} 195}
196 196
197void BackupAndRestore::scanForApplicationSettings() 197void BackupAndRestore::scanForApplicationSettings()
198{ 198{
199 QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); 199 QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) );
200 d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); 200 d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks );
201 const QFileInfoList *list = d.entryInfoList(); 201 const QFileInfoList *list = d.entryInfoList();
202 QFileInfoListIterator it( *list ); 202 QFileInfoListIterator it( *list );
203 QFileInfo *fi; 203 QFileInfo *fi;
204 while ( (fi=it.current()) ) 204 while ( (fi=it.current()) )
205 { 205 {
206 //qDebug((d.path()+"/"+fi->fileName()).latin1()); 206 //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl;
207 if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) 207 if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) )
208 { 208 {
209 QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); 209 QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName());
210 selectItem(newItem); 210 selectItem(newItem);
211 } 211 }
212 ++it; 212 ++it;
213 } 213 }
214} 214}
215 215
216/** 216/**
217 * The "Backup" button has been pressed. Get a list of all of the files that 217 * The "Backup" button has been pressed. Get a list of all of the files that
218 * should be backed up. If there are no files, emit and error and exit. 218 * should be backed up. If there are no files, emit and error and exit.
@@ -240,48 +240,48 @@ void BackupAndRestore::backup()
240 240
241 QString t = outputFile; 241 QString t = outputFile;
242 int c = 1; 242 int c = 1;
243 while(QFile::exists(outputFile + EXTENSION)) 243 while(QFile::exists(outputFile + EXTENSION))
244 { 244 {
245 outputFile = t + QString("%1").arg(c); 245 outputFile = t + QString("%1").arg(c);
246 c++; 246 c++;
247 } 247 }
248 248
249 // We execute tar and compressing its output with gzip.. 249 // We execute tar and compressing its output with gzip..
250 // The error output will be written into a temp-file which could be provided 250 // The error output will be written into a temp-file which could be provided
251 // for debugging.. 251 // for debugging..
252 qDebug( "Storing file: %s", outputFile.latin1() ); 252 odebug << "Storing file: " << outputFile.latin1() << "" << oendl;
253 outputFile += EXTENSION; 253 outputFile += EXTENSION;
254 254
255 QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) 255 QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() )
256 .arg( getExcludeFile() ) 256 .arg( getExcludeFile() )
257 .arg( backupFiles ) 257 .arg( backupFiles )
258 .arg( outputFile.latin1() ) 258 .arg( outputFile.latin1() )
259 .arg( tempFileName.latin1() ); 259 .arg( tempFileName.latin1() );
260 260
261 qDebug( commandLine ); 261 odebug << commandLine << oendl;
262 262
263 int r = system( commandLine ); 263 int r = system( commandLine );
264 264
265 if(r != 0) 265 if(r != 0)
266 { 266 {
267 perror("Error: "); 267 perror("Error: ");
268 QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); 268 QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno );
269 269
270 switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" 270 switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n"
271 + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) 271 + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) )
272 { 272 {
273 273
274 case 1: 274 case 1:
275 qWarning("Details pressed !"); 275 owarn << "Details pressed !" << oendl;
276 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); 276 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true );
277 QFile errorFile( tempFileName ); 277 QFile errorFile( tempFileName );
278 if ( errorFile.open(IO_ReadOnly) ) 278 if ( errorFile.open(IO_ReadOnly) )
279 { 279 {
280 QTextStream t( &errorFile ); 280 QTextStream t( &errorFile );
281 QString s; 281 QString s;
282 while ( !t.eof() ) 282 while ( !t.eof() )
283 { // until end of file... 283 { // until end of file...
284 s += t.readLine(); // line of text excluding '\n' 284 s += t.readLine(); // line of text excluding '\n'
285 } 285 }
286 errorFile.close(); 286 errorFile.close();
287 287
@@ -350,37 +350,37 @@ int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent
350 } 350 }
351 return count; 351 return count;
352} 352}
353 353
354void BackupAndRestore::sourceDirChanged(int selection) 354void BackupAndRestore::sourceDirChanged(int selection)
355{ 355{
356 restoreList->clear(); 356 restoreList->clear();
357 rescanFolder(backupLocations[restoreSource->text(selection)]); 357 rescanFolder(backupLocations[restoreSource->text(selection)]);
358} 358}
359 359
360void BackupAndRestore::fileListUpdate() 360void BackupAndRestore::fileListUpdate()
361{ 361{
362 qWarning("void BackupAndRestore::fileListUpdate()"); 362 owarn << "void BackupAndRestore::fileListUpdate()" << oendl;
363 restoreList->clear(); 363 restoreList->clear();
364 rescanFolder( backupLocations[restoreSource->currentText()] ); 364 rescanFolder( backupLocations[restoreSource->currentText()] );
365} 365}
366 366
367/** 367/**
368 * Scans directory for any backup files. Will recursivly go down, 368 * Scans directory for any backup files. Will recursivly go down,
369 * but will not follow symlinks. 369 * but will not follow symlinks.
370 * @param directory - the directory to look in. 370 * @param directory - the directory to look in.
371 */ 371 */
372void BackupAndRestore::rescanFolder(QString directory) 372void BackupAndRestore::rescanFolder(QString directory)
373{ 373{
374 //qDebug(QString("rescanFolder: ") + directory.latin1()); 374 //odebug << QString("rescanFolder: ") + directory.latin1() << oendl;
375 QDir d(directory); 375 QDir d(directory);
376 if(!d.exists()) 376 if(!d.exists())
377 return; 377 return;
378 378
379 d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); 379 d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
380 const QFileInfoList *list = d.entryInfoList(); 380 const QFileInfoList *list = d.entryInfoList();
381 QFileInfoListIterator it( *list ); 381 QFileInfoListIterator it( *list );
382 QFileInfo *file; 382 QFileInfo *file;
383 while ( (file=it.current()) ) 383 while ( (file=it.current()) )
384 { // for each file... 384 { // for each file...
385 // If it is a dir and not .. or . then add it as a tab and go down. 385 // If it is a dir and not .. or . then add it as a tab and go down.
386 if(file->isDir()) 386 if(file->isDir())
@@ -410,60 +410,60 @@ void BackupAndRestore::restore()
410 if(!restoreItem) 410 if(!restoreItem)
411 { 411 {
412 QMessageBox::critical(this, tr( "Message" ), 412 QMessageBox::critical(this, tr( "Message" ),
413 tr( "Please select something to restore." ),QString( tr( "Ok") ) ); 413 tr( "Please select something to restore." ),QString( tr( "Ok") ) );
414 return; 414 return;
415 } 415 }
416 setCaption(tr("Backup and Restore... working...")); 416 setCaption(tr("Backup and Restore... working..."));
417 417
418 QString restoreFile = backupLocations[restoreSource->currentText()]; 418 QString restoreFile = backupLocations[restoreSource->currentText()];
419 419
420 restoreFile += "/" + restoreItem->text(0); 420 restoreFile += "/" + restoreItem->text(0);
421 421
422 qDebug( restoreFile ); 422 odebug << restoreFile << oendl;
423 423
424 //check if backup file come from opie 1.0.x 424 //check if backup file come from opie 1.0.x
425 425
426 QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); 426 QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() );
427 427
428 int r = system( commandLine ); 428 int r = system( commandLine );
429 429
430 QString startDir; 430 QString startDir;
431 431
432 if( r != 0 ) //Applications/backup/exclude not found - old backup file 432 if( r != 0 ) //Applications/backup/exclude not found - old backup file
433 { 433 {
434 startDir = QString( "/" ); 434 startDir = QString( "/" );
435 } else 435 } else
436 { 436 {
437 startDir = QDir::homeDirPath(); 437 startDir = QDir::homeDirPath();
438 } 438 }
439 439
440 //unpack backup file 440 //unpack backup file
441 commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) 441 commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir )
442 .arg( restoreFile.latin1() ) 442 .arg( restoreFile.latin1() )
443 .arg( tempFileName.latin1() ); 443 .arg( tempFileName.latin1() );
444 444
445 qDebug( commandLine ); 445 odebug << commandLine << oendl;
446 446
447 r = system( commandLine ); 447 r = system( commandLine );
448 448
449 //error handling 449 //error handling
450 if(r != 0) 450 if(r != 0)
451 { 451 {
452 QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); 452 QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno );
453 switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" 453 switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n"
454 + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) 454 + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) )
455 { 455 {
456 case 1: 456 case 1:
457 qWarning("Details pressed !"); 457 owarn << "Details pressed !" << oendl;
458 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); 458 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true );
459 QFile errorFile( tempFileName ); 459 QFile errorFile( tempFileName );
460 if ( errorFile.open(IO_ReadOnly) ) 460 if ( errorFile.open(IO_ReadOnly) )
461 { 461 {
462 QTextStream t( &errorFile ); 462 QTextStream t( &errorFile );
463 QString s; 463 QString s;
464 while ( !t.eof() ) 464 while ( !t.eof() )
465 { // until end of file... 465 { // until end of file...
466 s += t.readLine(); // line of text excluding '\n' 466 s += t.readLine(); // line of text excluding '\n'
467 } 467 }
468 errorFile.close(); 468 errorFile.close();
469 469
diff --git a/noncore/settings/netsystemtime/settingstabwidget.cpp b/noncore/settings/netsystemtime/settingstabwidget.cpp
index ad80e05..1307082 100644
--- a/noncore/settings/netsystemtime/settingstabwidget.cpp
+++ b/noncore/settings/netsystemtime/settingstabwidget.cpp
@@ -130,25 +130,25 @@ void SettingsTabWidget::saveSettings()
130 if ( serversChanged ) 130 if ( serversChanged )
131 { 131 {
132 QString ntpSrvsFile = QPEApplication::qpeDir(); 132 QString ntpSrvsFile = QPEApplication::qpeDir();
133 ntpSrvsFile.append( "etc/ntpservers" ); 133 ntpSrvsFile.append( "etc/ntpservers" );
134 Config ntpSrvs( ntpSrvsFile, Config::File ); 134 Config ntpSrvs( ntpSrvsFile, Config::File );
135 ntpSrvs.setGroup( "servers" ); 135 ntpSrvs.setGroup( "servers" );
136 ntpSrvs.writeEntry( "count", ++srvCount ); 136 ntpSrvs.writeEntry( "count", ++srvCount );
137 ntpSrvs.setGroup( "0" ); 137 ntpSrvs.setGroup( "0" );
138 ntpSrvs.writeEntry( "name", edit ); 138 ntpSrvs.writeEntry( "name", edit );
139 curSrv = 0; 139 curSrv = 0;
140 for ( int i = 1; i < srvCount; i++ ) 140 for ( int i = 1; i < srvCount; i++ )
141 { 141 {
142 // qDebug( "ntpSrvs[%i/%i]=%s", i, srvCount, cbTimeServer->text( i ).latin1() ); 142 // odebug << "ntpSrvs[" << i << "/" << srvCount << "]=" << cbTimeServer->text( i ).latin1() << "" << oendl;
143 ntpSrvs.setGroup( QString::number( i ) ); 143 ntpSrvs.setGroup( QString::number( i ) );
144 ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) ); 144 ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) );
145 } 145 }
146 } 146 }
147 Config config( "ntp", Config::User ); 147 Config config( "ntp", Config::User );
148 config.setGroup( "settings" ); 148 config.setGroup( "settings" );
149 config.writeEntry( "ntpServer", curSrv ); 149 config.writeEntry( "ntpServer", curSrv );
150 config.writeEntry( "minLookupDiff", sbPredictDelay->value() ); 150 config.writeEntry( "minLookupDiff", sbPredictDelay->value() );
151 config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() ); 151 config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() );
152 config.writeEntry( "displayNtpTab", chNtpTab->isChecked() ); 152 config.writeEntry( "displayNtpTab", chNtpTab->isChecked() );
153 config.writeEntry( "displayPredictTab", chPredictTab->isChecked() ); 153 config.writeEntry( "displayPredictTab", chPredictTab->isChecked() );
154} 154}
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index b00b899..d2b106a 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -128,31 +128,31 @@ bool Interface::refresh(){
128 broadcast = ""; 128 broadcast = "";
129 dhcp = false; 129 dhcp = false;
130 dhcpServerIp = ""; 130 dhcpServerIp = "";
131 leaseObtained = ""; 131 leaseObtained = "";
132 leaseExpires = ""; 132 leaseExpires = "";
133 emit(updateInterface(this)); 133 emit(updateInterface(this));
134 return true; 134 return true;
135 } 135 }
136 136
137 QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name()); 137 QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
138 int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1()); 138 int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
139 if(ret != 0){ 139 if(ret != 0){
140 qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); 140 odebug << QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1() << oendl;
141 return false; 141 return false;
142 } 142 }
143 143
144 QFile file(fileName); 144 QFile file(fileName);
145 if (!file.open(IO_ReadOnly)){ 145 if (!file.open(IO_ReadOnly)){
146 qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); 146 odebug << QString("Interface: Can't open file: %1").arg(fileName).latin1() << oendl;
147 return false; 147 return false;
148 } 148 }
149 149
150 // Set to the defaults 150 // Set to the defaults
151 macAddress = ""; 151 macAddress = "";
152 ip = "0.0.0.0"; 152 ip = "0.0.0.0";
153 subnetMask = "0.0.0.0"; 153 subnetMask = "0.0.0.0";
154 broadcast = ""; 154 broadcast = "";
155 155
156 QTextStream stream( &file ); 156 QTextStream stream( &file );
157 QString line; 157 QString line;
158 while ( !stream.eof() ) { 158 while ( !stream.eof() ) {
@@ -192,73 +192,73 @@ bool Interface::refresh(){
192 dhcpDirectory = "/var/run"; 192 dhcpDirectory = "/var/run";
193 193
194 // See if we have 194 // See if we have
195 QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name())); 195 QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name()));
196 // If there is no DHCP information then exit now with no errors. 196 // If there is no DHCP information then exit now with no errors.
197 if(!QFile::exists(dhcpFile)){ 197 if(!QFile::exists(dhcpFile)){
198 emit(updateInterface(this)); 198 emit(updateInterface(this));
199 return true; 199 return true;
200 } 200 }
201 201
202 file.setName(dhcpFile); 202 file.setName(dhcpFile);
203 if (!file.open(IO_ReadOnly)){ 203 if (!file.open(IO_ReadOnly)){
204 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); 204 odebug << QString("Interface: Can't open file: %1").arg(dhcpFile).latin1() << oendl;
205 return false; 205 return false;
206 } 206 }
207 207
208 // leaseTime and renewalTime and used if pid and deamon exe can be accessed. 208 // leaseTime and renewalTime and used if pid and deamon exe can be accessed.
209 int leaseTime = 0; 209 int leaseTime = 0;
210 int renewalTime = 0; 210 int renewalTime = 0;
211 211
212 stream.setDevice( &file ); 212 stream.setDevice( &file );
213 while ( !stream.eof() ) { 213 while ( !stream.eof() ) {
214 line = stream.readLine(); 214 line = stream.readLine();
215 if(line.contains("DHCPSIADDR=")) 215 if(line.contains("DHCPSIADDR="))
216 dhcpServerIp = line.mid(11, line.length()); 216 dhcpServerIp = line.mid(11, line.length());
217 if(line.contains("LEASETIME=")) 217 if(line.contains("LEASETIME="))
218 leaseTime = line.mid(10, line.length()).toInt(); 218 leaseTime = line.mid(10, line.length()).toInt();
219 if(line.contains("RENEWALTIME=")) 219 if(line.contains("RENEWALTIME="))
220 renewalTime = line.mid(12, line.length()).toInt(); 220 renewalTime = line.mid(12, line.length()).toInt();
221 } 221 }
222 file.close(); 222 file.close();
223 //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1()); 223 //odebug << QString("Interface: leaseTime: %1").arg(leaseTime).latin1() << oendl;
224 //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); 224 //odebug << QString("Interface: renewalTime: %1").arg(renewalTime).latin1() << oendl;
225 225
226 // Get the pid of the deamond 226 // Get the pid of the deamond
227 dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name())); 227 dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name()));
228 file.setName(dhcpFile); 228 file.setName(dhcpFile);
229 if (!file.open(IO_ReadOnly)){ 229 if (!file.open(IO_ReadOnly)){
230 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); 230 odebug << QString("Interface: Can't open file: %1").arg(dhcpFile).latin1() << oendl;
231 return false; 231 return false;
232 } 232 }
233 233
234 int pid = -1; 234 int pid = -1;
235 stream.setDevice( &file ); 235 stream.setDevice( &file );
236 while ( !stream.eof() ) { 236 while ( !stream.eof() ) {
237 line = stream.readLine(); 237 line = stream.readLine();
238 pid = line.toInt(); 238 pid = line.toInt();
239 } 239 }
240 file.close(); 240 file.close();
241 241
242 if( pid == -1){ 242 if( pid == -1){
243 qDebug("Interface: Could not get pid of dhcpc deamon."); 243 odebug << "Interface: Could not get pid of dhcpc deamon." << oendl;
244 return false; 244 return false;
245 } 245 }
246 246
247 // Get the start running time of the deamon 247 // Get the start running time of the deamon
248 fileName = (QString("/proc/%1/stat").arg(pid)); 248 fileName = (QString("/proc/%1/stat").arg(pid));
249 file.setName(fileName); 249 file.setName(fileName);
250 stream.setDevice( &file ); 250 stream.setDevice( &file );
251 if (!file.open(IO_ReadOnly)){ 251 if (!file.open(IO_ReadOnly)){
252 qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); 252 odebug << QString("Interface: Can't open file: %1").arg(fileName).latin1() << oendl;
253 return false; 253 return false;
254 } 254 }
255 while ( !stream.eof() ) { 255 while ( !stream.eof() ) {
256 line = stream.readLine(); 256 line = stream.readLine();
257 } 257 }
258 file.close(); 258 file.close();
259 long time = 0; 259 long time = 0;
260 // Grab the start time 260 // Grab the start time
261 // pid com state ppid pgrp session tty_nr tpgid flags 261 // pid com state ppid pgrp session tty_nr tpgid flags
262 sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " 262 sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u "
263 // minflt cminflt majflt cmajflt utime stime cutime cstime priority 263 // minflt cminflt majflt cmajflt utime stime cutime cstime priority
264 "%*u %*u %*u %*u %*u %*u %*d %*d %*d " 264 "%*u %*u %*u %*u %*u %*u %*d %*d %*d "
@@ -269,30 +269,30 @@ bool Interface::refresh(){
269 QDateTime datetime(QDateTime::currentDateTime()); 269 QDateTime datetime(QDateTime::currentDateTime());
270 270
271 // Get the uptime of the computer. 271 // Get the uptime of the computer.
272 QFile f("/proc/uptime"); 272 QFile f("/proc/uptime");
273 if ( f.open(IO_ReadOnly) ) { // file opened successfully 273 if ( f.open(IO_ReadOnly) ) { // file opened successfully
274 QTextStream t( &f ); // use a text stream 274 QTextStream t( &f ); // use a text stream
275 int sec = 0; 275 int sec = 0;
276 t >> sec; 276 t >> sec;
277 datetime = datetime.addSecs((-1*sec)); 277 datetime = datetime.addSecs((-1*sec));
278 f.close(); 278 f.close();
279 } 279 }
280 else{ 280 else{
281 qDebug("Interface: Can't open /proc/uptime to retrive uptime."); 281 odebug << "Interface: Can't open /proc/uptime to retrive uptime." << oendl;
282 return false; 282 return false;
283 } 283 }
284 284
285 datetime = datetime.addSecs(time); 285 datetime = datetime.addSecs(time);
286 //qDebug(QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1()); 286 //odebug << QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1() << oendl;
287 287
288 // Calculate the start and renew times 288 // Calculate the start and renew times
289 leaseObtained= datetime.toString(); 289 leaseObtained= datetime.toString();
290 290
291 // Calculate the start and renew times 291 // Calculate the start and renew times
292 datetime = datetime.addSecs(leaseTime); 292 datetime = datetime.addSecs(leaseTime);
293 leaseExpires = datetime.toString(); 293 leaseExpires = datetime.toString();
294 294
295 dhcp = true; 295 dhcp = true;
296 296
297 emit(updateInterface(this)); 297 emit(updateInterface(this));
298 return true; 298 return true;
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index 6b161ae..e283926 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -15,25 +15,25 @@
15 * the \n for interfaces variable. 15 * the \n for interfaces variable.
16 * @param useInterfacesFile if an interface file other then the default is 16 * @param useInterfacesFile if an interface file other then the default is
17 * desired to be used it should be passed in. 17 * desired to be used it should be passed in.
18 */ 18 */
19Interfaces::Interfaces(QString useInterfacesFile){ 19Interfaces::Interfaces(QString useInterfacesFile){
20 acceptedFamily.append(INTERFACES_FAMILY_INET); 20 acceptedFamily.append(INTERFACES_FAMILY_INET);
21 acceptedFamily.append(INTERFACES_FAMILY_IPX); 21 acceptedFamily.append(INTERFACES_FAMILY_IPX);
22 acceptedFamily.append(INTERFACES_FAMILY_INET6); 22 acceptedFamily.append(INTERFACES_FAMILY_INET6);
23 23
24 interfacesFile = useInterfacesFile; 24 interfacesFile = useInterfacesFile;
25 QFile file(interfacesFile); 25 QFile file(interfacesFile);
26 if (!file.open(IO_ReadOnly)){ 26 if (!file.open(IO_ReadOnly)){
27 qDebug("Interfaces: Can't open file: %s for reading.", interfacesFile.latin1() ); 27 odebug << "Interfaces: Can't open file: " << interfacesFile.latin1() << " for reading." << oendl;
28 currentIface = interfaces.end(); 28 currentIface = interfaces.end();
29 currentMapping = interfaces.end(); 29 currentMapping = interfaces.end();
30 return; 30 return;
31 } 31 }
32 QTextStream stream( &file ); 32 QTextStream stream( &file );
33 QString line; 33 QString line;
34 while ( !stream.eof() ) { 34 while ( !stream.eof() ) {
35 line += stream.readLine(); 35 line += stream.readLine();
36 line += "\n"; 36 line += "\n";
37 } 37 }
38 file.close(); 38 file.close();
39 interfaces = QStringList::split("\n", line, true); 39 interfaces = QStringList::split("\n", line, true);
@@ -67,25 +67,25 @@ QStringList Interfaces::getInterfaceList(){
67} 67}
68 68
69/** 69/**
70 * Find out if interface is in an "auto" group or not. 70 * Find out if interface is in an "auto" group or not.
71 * Report any duplicates such as eth0 being in two differnt auto's 71 * Report any duplicates such as eth0 being in two differnt auto's
72 * @param interface interface to check to see if it is on or not. 72 * @param interface interface to check to see if it is on or not.
73 * @return true is interface is in auto 73 * @return true is interface is in auto
74 */ 74 */
75bool Interfaces::isAuto(const QString &interface) const { 75bool Interfaces::isAuto(const QString &interface) const {
76 QStringList autoLines = interfaces.grep(QRegExp(AUTO)); 76 QStringList autoLines = interfaces.grep(QRegExp(AUTO));
77 QStringList awi = autoLines.grep(QRegExp(interface)); 77 QStringList awi = autoLines.grep(QRegExp(interface));
78 if(awi.count() > 1) 78 if(awi.count() > 1)
79 qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1()); 79 odebug << QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1() << oendl;
80 return awi.count() > 0; 80 return awi.count() > 0;
81} 81}
82 82
83/** 83/**
84 * Attempt to set the auto option for interface to setAuto. 84 * Attempt to set the auto option for interface to setAuto.
85 * @param interface the interface to set 85 * @param interface the interface to set
86 * @param setAuto the value to set interface to. 86 * @param setAuto the value to set interface to.
87 * @return false if already set to setAuto. 87 * @return false if already set to setAuto.
88 * */ 88 * */
89bool Interfaces::setAuto(const QString &interface, bool setAuto){ 89bool Interfaces::setAuto(const QString &interface, bool setAuto){
90 // Don't need to set it if it is already set. 90 // Don't need to set it if it is already set.
91 if(isAuto(interface) == setAuto) 91 if(isAuto(interface) == setAuto)
@@ -143,41 +143,41 @@ bool Interfaces::isInterfaceSet() const {
143} 143}
144 144
145/** 145/**
146 * Add a new interface of with the settings - family and method 146 * Add a new interface of with the settings - family and method
147 * @param interface the name of the interface to set. All whitespace is 147 * @param interface the name of the interface to set. All whitespace is
148 * removed from the interface name. 148 * removed from the interface name.
149 * @param family the family of this interface inet or inet, ipx or inet6 149 * @param family the family of this interface inet or inet, ipx or inet6
150 * Must of one of the families defined in interfaces.h 150 * Must of one of the families defined in interfaces.h
151 * @param method for the family. see interfaces man page for family methods. 151 * @param method for the family. see interfaces man page for family methods.
152 * @return true if successful. 152 * @return true if successful.
153 */ 153 */
154bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){ 154bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
155 qDebug("Interfaces::addInterface(%s)",interface.latin1()); 155 odebug << "Interfaces::addInterface(" << interface.latin1() << ")" << oendl;
156 if(0 == acceptedFamily.contains(family)) 156 if(0 == acceptedFamily.contains(family))
157 return false; 157 return false;
158 QString newInterface = interface.simplifyWhiteSpace(); 158 QString newInterface = interface.simplifyWhiteSpace();
159 newInterface = newInterface.replace(QRegExp(" "), ""); 159 newInterface = newInterface.replace(QRegExp(" "), "");
160 interfaces.append(""); 160 interfaces.append("");
161 interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method)); 161 interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method));
162 return true; 162 return true;
163} 163}
164 164
165/** 165/**
166 * Copies interface with name interface to name newInterface 166 * Copies interface with name interface to name newInterface
167 * @param newInterface name of the new interface. 167 * @param newInterface name of the new interface.
168 * @return bool true if successful 168 * @return bool true if successful
169 */ 169 */
170bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){ 170bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
171 qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1()); 171 odebug << "copy interface " << interface.latin1() << " to " << newInterface.latin1() << "" << oendl;
172 if(!setInterface(interface)) 172 if(!setInterface(interface))
173 return false; 173 return false;
174 174
175 // Store the old interface and bump past the stanza line. 175 // Store the old interface and bump past the stanza line.
176 QStringList::Iterator it = currentIface; 176 QStringList::Iterator it = currentIface;
177 it++; 177 it++;
178 178
179 // Add the new interface 179 // Add the new interface
180 bool error; 180 bool error;
181 addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error)); 181 addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error));
182 if(!setInterface(newInterface)) 182 if(!setInterface(newInterface))
183 return false; 183 return false;
@@ -266,32 +266,32 @@ QString Interfaces::getInterfaceMethod(bool &error){
266 line = line.mid(family.length()+1, line.length()); 266 line = line.mid(family.length()+1, line.length());
267 line = line.simplifyWhiteSpace(); 267 line = line.simplifyWhiteSpace();
268 error = false; 268 error = false;
269 return line; 269 return line;
270} 270}
271 271
272/** 272/**
273 * Sets the interface name to newName. 273 * Sets the interface name to newName.
274 * @param newName the new name of the interface. All whitespace is removed. 274 * @param newName the new name of the interface. All whitespace is removed.
275 * @return bool true if successful. 275 * @return bool true if successful.
276 */ 276 */
277bool Interfaces::setInterfaceName(const QString &newName){ 277bool Interfaces::setInterfaceName(const QString &newName){
278 qDebug("setInterfaceName %s", newName.latin1()); 278 odebug << "setInterfaceName " << newName.latin1() << "" << oendl;
279 if(currentIface == interfaces.end()) 279 if(currentIface == interfaces.end())
280 return false; 280 return false;
281 QString name = newName.simplifyWhiteSpace(); 281 QString name = newName.simplifyWhiteSpace();
282 name = name.replace(QRegExp(" "), ""); 282 name = name.replace(QRegExp(" "), "");
283 bool returnValue = false; 283 bool returnValue = false;
284 QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); 284 QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
285 qDebug("setting %s",tmp.latin1()); 285 odebug << "setting " << tmp.latin1() << "" << oendl;
286 286
287 (*currentIface) = tmp; 287 (*currentIface) = tmp;
288 return !returnValue; 288 return !returnValue;
289} 289}
290 290
291/** 291/**
292 * Sets the interface family to newName. 292 * Sets the interface family to newName.
293 * @param newName the new name of the interface. Must be one of the families 293 * @param newName the new name of the interface. Must be one of the families
294 * defined in the interfaces.h file. 294 * defined in the interfaces.h file.
295 * @return bool true if successful. 295 * @return bool true if successful.
296 */ 296 */
297bool Interfaces::setInterfaceFamily(const QString &newName){ 297bool Interfaces::setInterfaceFamily(const QString &newName){
@@ -336,25 +336,25 @@ QString Interfaces::getInterfaceOption(const QString &option, bool &error){
336 * doesn't exist then it is added along with the value. 336 * doesn't exist then it is added along with the value.
337 * If value isEmpty() then we will remove the option 337 * If value isEmpty() then we will remove the option
338 * 338 *
339 * @param option the options to set the value. 339 * @param option the options to set the value.
340 * @param value the value that option should be set to. 340 * @param value the value that option should be set to.
341 * @param error set to true if any error occurs, false otherwise. 341 * @param error set to true if any error occurs, false otherwise.
342 * @return QString the options value. QString::null if error == true 342 * @return QString the options value. QString::null if error == true
343 */ 343 */
344bool Interfaces::setInterfaceOption(const QString &option, const QString &value){ 344bool Interfaces::setInterfaceOption(const QString &option, const QString &value){
345 if( value.stripWhiteSpace().isEmpty() ) 345 if( value.stripWhiteSpace().isEmpty() )
346 return removeInterfaceOption( option ); 346 return removeInterfaceOption( option );
347 347
348 qDebug("iface >%s< option >%s< value >%s<", (*currentIface).latin1(), option.latin1(),value.latin1()); 348 odebug << "iface >" << (*currentIface).latin1() << "< option >" << option.latin1() << "< value >" << value.latin1() << "<" << oendl;
349 return setOption(currentIface, option, value); 349 return setOption(currentIface, option, value);
350} 350}
351 351
352/** 352/**
353 * Removes a value for an option in the currently selected interface. 353 * Removes a value for an option in the currently selected interface.
354 * @param option the options to set the value. 354 * @param option the options to set the value.
355 * @param error set to true if any error occurs, false otherwise. 355 * @param error set to true if any error occurs, false otherwise.
356 * @return QString the options value. QString::null if error == true 356 * @return QString the options value. QString::null if error == true
357 */ 357 */
358bool Interfaces::removeInterfaceOption(const QString &option){ 358bool Interfaces::removeInterfaceOption(const QString &option){
359 return removeOption(currentIface, option); 359 return removeOption(currentIface, option);
360} 360}
@@ -477,84 +477,84 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString
477 // There are more chars in the line. check +1 477 // There are more chars in the line. check +1
478 if(line.at(point-1) != ' ') 478 if(line.at(point-1) != ' ')
479 valid = false; 479 valid = false;
480 } 480 }
481 point += option.length(); 481 point += option.length();
482 if(point < line.length()-1){ 482 if(point < line.length()-1){
483 // There are more chars in the line. check -1 483 // There are more chars in the line. check -1
484 if(line.at(point) != ' ') 484 if(line.at(point) != ' ')
485 valid = false; 485 valid = false;
486 } 486 }
487 if(valid){ 487 if(valid){
488 if(found == true){ 488 if(found == true){
489 qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1()); 489 odebug << QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1() << oendl;
490 } 490 }
491 found = true; 491 found = true;
492 iterator = it; 492 iterator = it;
493 } 493 }
494 } 494 }
495 } 495 }
496 return found; 496 return found;
497} 497}
498 498
499/** 499/**
500 * Sets a value of an option in a stanza 500 * Sets a value of an option in a stanza
501 * @param start the start of the stanza 501 * @param start the start of the stanza
502 * @param option the option to use when setting value. 502 * @param option the option to use when setting value.
503 * @return bool true if successful, false otherwise. 503 * @return bool true if successful, false otherwise.
504 */ 504 */
505bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){ 505bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){
506 if(start == interfaces.end()) 506 if(start == interfaces.end())
507 return false; 507 return false;
508 qDebug("setting option"); 508 odebug << "setting option" << oendl;
509 bool found = false; 509 bool found = false;
510 bool replaced = false; 510 bool replaced = false;
511 QStringList::Iterator insertAt = NULL; 511 QStringList::Iterator insertAt = NULL;
512 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 512 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
513 qDebug(" Interfaces::setOption got line >%s<",(*it).latin1()); 513 odebug << " Interfaces::setOption got line >" << (*it).latin1() << "<" << oendl;
514 // FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line 514 // FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line
515 // but since it works with an empty interfaces file I (tille) will not do anything more 515 // but since it works with an empty interfaces file I (tille) will not do anything more
516 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){ 516 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){
517 if (found) break; 517 if (found) break;
518// && it != start){ 518// && it != start){
519// if(!found && value != ""){ 519// if(!found && value != ""){
520// // Got to the end of the stanza without finding it, so append it. 520// // Got to the end of the stanza without finding it, so append it.
521// qDebug(" Got to the end of the stanza without finding it, so append it."); 521// odebug << " Got to the end of the stanza without finding it, so append it." << oendl;
522// interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value)); 522// interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
523// } 523// }
524 qDebug("found 1"); 524 odebug << "found 1" << oendl;
525// interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value)); 525// interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value));
526 found = true; 526 found = true;
527 insertAt = it; 527 insertAt = it;
528 528
529 } 529 }
530 if((*it).contains(option) && it != start && (*it).at(0) != '#'){ 530 if((*it).contains(option) && it != start && (*it).at(0) != '#'){
531 // Found it in stanza so replace it. 531 // Found it in stanza so replace it.
532 qDebug("found 2"); 532 odebug << "found 2" << oendl;
533 if(found) 533 if(found)
534 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 534 odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl;
535 found = true; 535 found = true;
536 replaced = true; 536 replaced = true;
537 (*it) = QString("\t%1 %2").arg(option).arg(value); 537 (*it) = QString("\t%1 %2").arg(option).arg(value);
538 } 538 }
539 } 539 }
540 if(!found){ 540 if(!found){
541 qDebug("! found insert anyway"); 541 odebug << "! found insert anyway" << oendl;
542 QStringList::Iterator p = start; 542 QStringList::Iterator p = start;
543 interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value)); 543 interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value));
544 found = true; 544 found = true;
545 } 545 }
546 546
547 if(found && !replaced){ 547 if(found && !replaced){
548 qDebug("found iface but not the option so insert it here..."); 548 odebug << "found iface but not the option so insert it here..." << oendl;
549 interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value)); 549 interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value));
550 } 550 }
551 return found; 551 return found;
552} 552}
553 553
554/** 554/**
555 * Removes a stanza and all of its options 555 * Removes a stanza and all of its options
556 * @param stanza the stanza to remove 556 * @param stanza the stanza to remove
557 * @return bool true if successful. 557 * @return bool true if successful.
558 */ 558 */
559bool Interfaces::removeStanza(QStringList::Iterator &stanza){ 559bool Interfaces::removeStanza(QStringList::Iterator &stanza){
560 if(stanza == interfaces.end()) 560 if(stanza == interfaces.end())
@@ -573,25 +573,25 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
573 if(start == interfaces.end()) 573 if(start == interfaces.end())
574 return false; 574 return false;
575 575
576 bool found = false; 576 bool found = false;
577 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 577 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
578 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 578 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
579 // got to the end without finding it 579 // got to the end without finding it
580 break; 580 break;
581 } 581 }
582 if((*it).contains(option) && it != start && (*it).at(0) != '#'){ 582 if((*it).contains(option) && it != start && (*it).at(0) != '#'){
583 // Found it in stanza so replace it. 583 // Found it in stanza so replace it.
584 if(found) 584 if(found)
585 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 585 odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl;
586 found = true; 586 found = true;
587 it = interfaces.remove( it ); // we really want to remove the line 587 it = interfaces.remove( it ); // we really want to remove the line
588 --it; // we do ++it later in the head of the for loop 588 --it; // we do ++it later in the head of the for loop
589 } 589 }
590 } 590 }
591 return found; 591 return found;
592} 592}
593 593
594/** 594/**
595 * Removes a option in a stanza 595 * Removes a option in a stanza
596 * @param start the start of the stanza 596 * @param start the start of the stanza
597 * @param option the option to use when setting value. 597 * @param option the option to use when setting value.
@@ -601,25 +601,25 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
601 if(start == interfaces.end()) 601 if(start == interfaces.end())
602 return false; 602 return false;
603 603
604 bool found = false; 604 bool found = false;
605 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 605 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
606 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 606 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
607 // got to the end without finding it 607 // got to the end without finding it
608 break; 608 break;
609 } 609 }
610 if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){ 610 if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){
611 // Found it in stanza so replace it. 611 // Found it in stanza so replace it.
612 if(found) 612 if(found)
613 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 613 odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl;
614 found = true; 614 found = true;
615 it = interfaces.remove( it ); // we really want to remove the line 615 it = interfaces.remove( it ); // we really want to remove the line
616 --it; // we do ++it later in the head of the for loop 616 --it; // we do ++it later in the head of the for loop
617 } 617 }
618 } 618 }
619 return found; 619 return found;
620} 620}
621 621
622/** 622/**
623 * Removes all options in a stanza 623 * Removes all options in a stanza
624 * @param start the start of the stanza 624 * @param start the start of the stanza
625 * @return bool true if successful, false otherwise. 625 * @return bool true if successful, false otherwise.
@@ -654,59 +654,59 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString
654 error = false; 654 error = false;
655 return QString(); 655 return QString();
656 } 656 }
657 657
658 QString value; 658 QString value;
659 bool found = false; 659 bool found = false;
660 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 660 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
661 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 661 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
662 break; 662 break;
663 } 663 }
664 if((*it).contains(option) && (*it).at(0) != '#'){ 664 if((*it).contains(option) && (*it).at(0) != '#'){
665 if(found) 665 if(found)
666 qDebug(QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1()); 666 odebug << QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1() << oendl;
667 found = true; 667 found = true;
668 QString line = (*it).simplifyWhiteSpace(); 668 QString line = (*it).simplifyWhiteSpace();
669 int space = line.find(" ", option.length()); 669 int space = line.find(" ", option.length());
670 if(space != -1){ 670 if(space != -1){
671 value = line.mid(space+1, line.length()); 671 value = line.mid(space+1, line.length());
672 break; 672 break;
673 } 673 }
674 } 674 }
675 } 675 }
676 error = !found; 676 error = !found;
677 return value; 677 return value;
678} 678}
679 679
680/** 680/**
681 * Write out the interfaces file to the file passed into the constructor. 681 * Write out the interfaces file to the file passed into the constructor.
682 * Removes any excess blank lines over 1 line long. 682 * Removes any excess blank lines over 1 line long.
683 * @return bool true if successful, false if not. 683 * @return bool true if successful, false if not.
684 */ 684 */
685bool Interfaces::write(){ 685bool Interfaces::write(){
686 QFile::remove(interfacesFile); 686 QFile::remove(interfacesFile);
687 QFile file(interfacesFile); 687 QFile file(interfacesFile);
688 688
689 if (!file.open(IO_ReadWrite)){ 689 if (!file.open(IO_ReadWrite)){
690 qDebug(QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1()); 690 odebug << QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1() << oendl;
691 return false; 691 return false;
692 } 692 }
693 QTextStream stream( &file ); 693 QTextStream stream( &file );
694 int whiteSpaceCount = 0; 694 int whiteSpaceCount = 0;
695 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { 695 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
696 QString line = (*it).simplifyWhiteSpace(); 696 QString line = (*it).simplifyWhiteSpace();
697 line = line.replace(QRegExp(" "),""); 697 line = line.replace(QRegExp(" "),"");
698 if(line.length() == 0) 698 if(line.length() == 0)
699 whiteSpaceCount++; 699 whiteSpaceCount++;
700 else 700 else
701 whiteSpaceCount = 0; 701 whiteSpaceCount = 0;
702 if(whiteSpaceCount < 2){ 702 if(whiteSpaceCount < 2){
703 qDebug((*it).latin1()); 703 odebug << (*it).latin1() << oendl;
704 stream << (*it) << '\n'; 704 stream << (*it) << '\n';
705 } 705 }
706 } 706 }
707 file.close(); 707 file.close();
708 return true; 708 return true;
709} 709}
710 710
711// interfaces.cpp 711// interfaces.cpp
712 712
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index 7c2f85c..ec3bad3 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -37,25 +37,25 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac
37InterfaceSetupImp::~InterfaceSetupImp(){ 37InterfaceSetupImp::~InterfaceSetupImp(){
38 if(delInterfaces) { 38 if(delInterfaces) {
39 delete interfaces; 39 delete interfaces;
40 } 40 }
41} 41}
42 42
43/** 43/**
44 * Save the current settings, then write out the interfaces file and close. 44 * Save the current settings, then write out the interfaces file and close.
45 */ 45 */
46bool InterfaceSetupImp::saveChanges(){ 46bool InterfaceSetupImp::saveChanges(){
47 bool error; 47 bool error;
48 QString iface = interfaces->getInterfaceName(error); 48 QString iface = interfaces->getInterfaceName(error);
49 qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() ); 49 odebug << "InterfaceSetupImp::saveChanges saves interface " << iface.latin1() << "" << oendl;
50 if(!saveSettings()) 50 if(!saveSettings())
51 return false; 51 return false;
52 52
53 interfaces->write(); 53 interfaces->write();
54 54
55 if (interface->getStatus()) { 55 if (interface->getStatus()) {
56 QString ifup; 56 QString ifup;
57 ifup += "ifdown "; 57 ifup += "ifdown ";
58 ifup += iface; 58 ifup += iface;
59 ifup += "; ifup "; 59 ifup += "; ifup ";
60 ifup += iface; 60 ifup += iface;
61 ifup += ";"; 61 ifup += ";";
@@ -63,25 +63,25 @@ bool InterfaceSetupImp::saveChanges(){
63 OProcess restart; 63 OProcess restart;
64 restart << "sh"; 64 restart << "sh";
65 restart << "-c"; 65 restart << "-c";
66 restart << ifup; 66 restart << ifup;
67 67
68 OWait *owait = new OWait(); 68 OWait *owait = new OWait();
69 Global::statusMessage( tr( "Restarting interface" ) ); 69 Global::statusMessage( tr( "Restarting interface" ) );
70 70
71 owait->show(); 71 owait->show();
72 qApp->processEvents(); 72 qApp->processEvents();
73 73
74 if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { 74 if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) {
75 qWarning("unstable to spawn ifdown/ifup"); 75 owarn << "unstable to spawn ifdown/ifup" << oendl;
76 } 76 }
77 77
78 owait->hide(); 78 owait->hide();
79 delete owait; 79 delete owait;
80 80
81 interface->refresh(); 81 interface->refresh();
82 } 82 }
83 return true; 83 return true;
84} 84}
85 85
86/** 86/**
87 * Save the settings for the current Interface. 87 * Save the settings for the current Interface.
@@ -148,61 +148,61 @@ void InterfaceSetupImp::setProfile(const QString &profile){
148 148
149 QString newInterfaceName = interface->getInterfaceName(); 149 QString newInterfaceName = interface->getInterfaceName();
150 if(profile.length() > 0) 150 if(profile.length() > 0)
151 newInterfaceName += "_" + profile; 151 newInterfaceName += "_" + profile;
152 // See if we have to make a interface. 152 // See if we have to make a interface.
153 if(!interfaces->setInterface(newInterfaceName)){ 153 if(!interfaces->setInterface(newInterfaceName)){
154 // Add making for this new interface if need too 154 // Add making for this new interface if need too
155 if(profile != ""){ 155 if(profile != ""){
156 interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); 156 interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName);
157 if(!interfaces->setMapping(interface->getInterfaceName())){ 157 if(!interfaces->setMapping(interface->getInterfaceName())){
158 interfaces->addMapping(interface->getInterfaceName()); 158 interfaces->addMapping(interface->getInterfaceName());
159 if(!interfaces->setMapping(interface->getInterfaceName())){ 159 if(!interfaces->setMapping(interface->getInterfaceName())){
160 qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); 160 odebug << "InterfaceSetupImp: Added Mapping, but still can't setInterface." << oendl;
161 return; 161 return;
162 } 162 }
163 } 163 }
164 interfaces->setMap("map", newInterfaceName); 164 interfaces->setMap("map", newInterfaceName);
165 interfaces->setScript("getprofile.sh"); 165 interfaces->setScript("getprofile.sh");
166 } 166 }
167 else{ 167 else{
168 interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); 168 interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
169 if(!interfaces->setInterface(newInterfaceName)){ 169 if(!interfaces->setInterface(newInterfaceName)){
170 qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); 170 odebug << "InterfaceSetupImp: Added interface, but still can't setInterface." << oendl;
171 return; 171 return;
172 } 172 }
173 } 173 }
174 } 174 }
175 175
176 // We must have a valid interface to get this far so read some settings. 176 // We must have a valid interface to get this far so read some settings.
177 177
178 // DHCP 178 // DHCP
179 bool error = false; 179 bool error = false;
180 if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) 180 if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP)
181 dhcpCheckBox->setChecked(true); 181 dhcpCheckBox->setChecked(true);
182 else 182 else
183 dhcpCheckBox->setChecked(false); 183 dhcpCheckBox->setChecked(false);
184 184
185 // IP Information 185 // IP Information
186 autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); 186 autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName()));
187 QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error); 187 QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error);
188 qDebug("dns >%s<",dns.latin1()); 188 odebug << "dns >" << dns.latin1() << "<" << oendl;
189 if(dns.contains(" ")){ 189 if(dns.contains(" ")){
190 firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); 190 firstDNSLineEdit->setText(dns.mid(0, dns.find(" ")));
191 secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); 191 secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length()));
192 }else firstDNSLineEdit->setText(dns); 192 }else firstDNSLineEdit->setText(dns);
193 193
194 ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); 194 ipAddressEdit->setText(interfaces->getInterfaceOption("address", error));
195 subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); 195 subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error));
196 if (subnetMaskEdit->text().isEmpty()) 196 if (subnetMaskEdit->text().isEmpty())
197 subnetMaskEdit->setText( "255.255.255.0" ); 197 subnetMaskEdit->setText( "255.255.255.0" );
198 gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); 198 gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error));
199 199
200 200
201 201
202 qWarning("InterfaceSetupImp::setProfile(%s)\n", profile.latin1()); 202 owarn << "InterfaceSetupImp::setProfile(" << profile.latin1() << ")\n" << oendl;
203 qWarning("InterfaceSetupImp::setProfile: iface is %s\n", interfaces->getInterfaceName(error).latin1()); 203 owarn << "InterfaceSetupImp::setProfile: iface is " << interfaces->getInterfaceName(error).latin1() << "\n" << oendl;
204 204
205} 205}
206 206
207// interfacesetup.cpp 207// interfacesetup.cpp
208 208
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 1e16b97..3e1a650 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -70,25 +70,25 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi
70 70
71 Interfaces i; 71 Interfaces i;
72 QStringList list = i.getInterfaceList(); 72 QStringList list = i.getInterfaceList();
73 QMap<QString, Interface*>::Iterator it; 73 QMap<QString, Interface*>::Iterator it;
74 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) 74 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni )
75 { 75 {
76 /* 76 /*
77 * we skipped it in getAllInterfaces now 77 * we skipped it in getAllInterfaces now
78 * we need to ignore it as well 78 * we need to ignore it as well
79 */ 79 */
80 if (m_handledIfaces.contains( *ni) ) 80 if (m_handledIfaces.contains( *ni) )
81 { 81 {
82 qDebug("Not up iface handled by module"); 82 odebug << "Not up iface handled by module" << oendl;
83 continue; 83 continue;
84 } 84 }
85 bool found = false; 85 bool found = false;
86 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) 86 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it )
87 { 87 {
88 if(it.key() == (*ni)) 88 if(it.key() == (*ni))
89 found = true; 89 found = true;
90 } 90 }
91 if(!found) 91 if(!found)
92 { 92 {
93 if(!(*ni).contains("_")) 93 if(!(*ni).contains("_"))
94 { 94 {
@@ -210,25 +210,25 @@ void MainWindowImp::getAllInterfaces()
210 if((loc = line.find(":")) != -1) 210 if((loc = line.find(":")) != -1)
211 { 211 {
212 ifaces += line.left(loc); 212 ifaces += line.left(loc);
213 } 213 }
214 } 214 }
215 } 215 }
216 216
217 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) 217 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it)
218 { 218 {
219 int flags = 0; 219 int flags = 0;
220 if ( m_handledIfaces.contains( (*it) ) ) 220 if ( m_handledIfaces.contains( (*it) ) )
221 { 221 {
222 qDebug(" %s is handled by a module", (*it).latin1() ); 222 odebug << " " << (*it).latin1() << " is handled by a module" << oendl;
223 continue; 223 continue;
224 } 224 }
225 // int family; 225 // int family;
226 i = NULL; 226 i = NULL;
227 227
228 strcpy(ifr.ifr_name, (*it).latin1()); 228 strcpy(ifr.ifr_name, (*it).latin1());
229 229
230 struct ifreq ifcopy; 230 struct ifreq ifcopy;
231 ifcopy = ifr; 231 ifcopy = ifr;
232 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy); 232 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy);
233 flags = ifcopy.ifr_flags; 233 flags = ifcopy.ifr_flags;
234 i = new Interface(this, ifr.ifr_name, false); 234 i = new Interface(this, ifr.ifr_name, false);
@@ -240,141 +240,141 @@ void MainWindowImp::getAllInterfaces()
240 240
241 if ((flags & IFF_BROADCAST) == IFF_BROADCAST) 241 if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
242 i->setHardwareName("Ethernet"); 242 i->setHardwareName("Ethernet");
243 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) 243 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
244 i->setHardwareName("Point to Point"); 244 i->setHardwareName("Point to Point");
245 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) 245 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
246 i->setHardwareName("Multicast"); 246 i->setHardwareName("Multicast");
247 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) 247 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
248 i->setHardwareName("Loopback"); 248 i->setHardwareName("Loopback");
249 else 249 else
250 i->setHardwareName("Unknown"); 250 i->setHardwareName("Unknown");
251 251
252 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name); 252 owarn << "Adding interface " << ifr.ifr_name << " to interfaceNames\n" << oendl;
253 interfaceNames.insert(i->getInterfaceName(), i); 253 interfaceNames.insert(i->getInterfaceName(), i);
254 updateInterface(i); 254 updateInterface(i);
255 connect(i, SIGNAL(updateInterface(Interface*)), 255 connect(i, SIGNAL(updateInterface(Interface*)),
256 this, SLOT(updateInterface(Interface*))); 256 this, SLOT(updateInterface(Interface*)));
257 } 257 }
258 // now lets ask the plugins too ;) 258 // now lets ask the plugins too ;)
259 QMap<Module*, QLibrary*>::Iterator it; 259 QMap<Module*, QLibrary*>::Iterator it;
260 QList<Interface> ilist; 260 QList<Interface> ilist;
261 for( it = libraries.begin(); it != libraries.end(); ++it ) 261 for( it = libraries.begin(); it != libraries.end(); ++it )
262 { 262 {
263 if(it.key()) 263 if(it.key())
264 { 264 {
265 ilist = it.key()->getInterfaces(); 265 ilist = it.key()->getInterfaces();
266 for( i = ilist.first(); i != 0; i = ilist.next() ) 266 for( i = ilist.first(); i != 0; i = ilist.next() )
267 { 267 {
268 qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() ); 268 owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl;
269 interfaceNames.insert(i->getInterfaceName(), i); 269 interfaceNames.insert(i->getInterfaceName(), i);
270 updateInterface(i); 270 updateInterface(i);
271 connect(i, SIGNAL(updateInterface(Interface*)), 271 connect(i, SIGNAL(updateInterface(Interface*)),
272 this, SLOT(updateInterface(Interface*))); 272 this, SLOT(updateInterface(Interface*)));
273 } 273 }
274 } 274 }
275 } 275 }
276} 276}
277 277
278/** 278/**
279 * Load all modules that are found in the path 279 * Load all modules that are found in the path
280 * @param path a directory that is scaned for any plugins that can be loaded 280 * @param path a directory that is scaned for any plugins that can be loaded
281 * and attempts to load them 281 * and attempts to load them
282 */ 282 */
283void MainWindowImp::loadModules(const QString &path) 283void MainWindowImp::loadModules(const QString &path)
284{ 284{
285#ifdef DEBUG 285#ifdef DEBUG
286 qDebug("MainWindowImp::loadModules: %s", path.latin1()); 286 odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl;
287#endif 287#endif
288 QDir d(path); 288 QDir d(path);
289 if(!d.exists()) 289 if(!d.exists())
290 return; 290 return;
291 291
292 // Don't want sym links 292 // Don't want sym links
293 d.setFilter( QDir::Files | QDir::NoSymLinks ); 293 d.setFilter( QDir::Files | QDir::NoSymLinks );
294 const QFileInfoList *list = d.entryInfoList(); 294 const QFileInfoList *list = d.entryInfoList();
295 QFileInfoListIterator it( *list ); 295 QFileInfoListIterator it( *list );
296 QFileInfo *fi; 296 QFileInfo *fi;
297 while ( (fi=it.current()) ) 297 while ( (fi=it.current()) )
298 { 298 {
299#ifdef QWS 299#ifdef QWS
300 if(fi->fileName().contains(".so")) 300 if(fi->fileName().contains(".so"))
301 { 301 {
302#else 302#else
303 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")) 303 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_"))
304 { 304 {
305#endif 305#endif
306 loadPlugin(path + "/" + fi->fileName()); 306 loadPlugin(path + "/" + fi->fileName());
307 qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1()); 307 odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl;
308 } 308 }
309 ++it; 309 ++it;
310 } 310 }
311} 311}
312 312
313/** 313/**
314 * Attempt to load a function and resolve a function. 314 * Attempt to load a function and resolve a function.
315 * @param pluginFileName - the name of the file in which to attempt to load 315 * @param pluginFileName - the name of the file in which to attempt to load
316 * @param resolveString - function pointer to resolve 316 * @param resolveString - function pointer to resolve
317 * @return pointer to the function with name resolveString or NULL 317 * @return pointer to the function with name resolveString or NULL
318 */ 318 */
319Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) 319Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString)
320{ 320{
321#ifdef DEBUG 321#ifdef DEBUG
322 qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1()); 322 odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl;
323#endif 323#endif
324#ifdef QWS 324#ifdef QWS
325 QLibrary *lib = new QLibrary(pluginFileName); 325 QLibrary *lib = new QLibrary(pluginFileName);
326 void *functionPointer = lib->resolve(resolveString); 326 void *functionPointer = lib->resolve(resolveString);
327 if( !functionPointer ) 327 if( !functionPointer )
328 { 328 {
329#ifdef DEBUG 329#ifdef DEBUG
330 qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1()); 330 odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl;
331#endif 331#endif
332 delete lib; 332 delete lib;
333 return NULL; 333 return NULL;
334 } 334 }
335 // Try to get an object. 335 // Try to get an object.
336 Module *object = ((Module* (*)()) functionPointer)(); 336 Module *object = ((Module* (*)()) functionPointer)();
337 if(object == NULL) 337 if(object == NULL)
338 { 338 {
339#ifdef DEBUG 339#ifdef DEBUG
340 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 340 odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl;
341#endif 341#endif
342 delete lib; 342 delete lib;
343 return NULL; 343 return NULL;
344 } 344 }
345 345
346 m_handledIfaces += object->handledInterfaceNames(); 346 m_handledIfaces += object->handledInterfaceNames();
347 // Store for deletion later 347 // Store for deletion later
348 libraries.insert(object, lib); 348 libraries.insert(object, lib);
349 return object; 349 return object;
350 350
351#else 351#else
352 QLibrary *lib = loader->library(pluginFileName); 352 QLibrary *lib = loader->library(pluginFileName);
353 if( !lib || !lib->hasSymbol(resolveString) ) 353 if( !lib || !lib->hasSymbol(resolveString) )
354 { 354 {
355 qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); 355 odebug << QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1() << oendl;
356 return NULL; 356 return NULL;
357 } 357 }
358 // Try to get an object. 358 // Try to get an object.
359 Module *object = ((Module* (*)()) lib->symbol(resolveString))(); 359 Module *object = ((Module* (*)()) lib->symbol(resolveString))();
360 if(object == NULL) 360 if(object == NULL)
361 { 361 {
362#ifdef DEBUG 362#ifdef DEBUG
363 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 363 odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl;
364#endif 364#endif
365 return NULL; 365 return NULL;
366 } 366 }
367#ifdef DEBUG 367#ifdef DEBUG
368 qDebug("MainWindowImp::loadPlugin:: Found object, storing."); 368 odebug << "MainWindowImp::loadPlugin:: Found object, storing." << oendl;
369#endif 369#endif
370 // Store for deletion later 370 // Store for deletion later
371 libraries.insert(object, lib); 371 libraries.insert(object, lib);
372 return object; 372 return object;
373#endif 373#endif
374} 374}
375 375
376/** 376/**
377 * The Add button was clicked. Bring up the add dialog and if OK is hit 377 * The Add button was clicked. Bring up the add dialog and if OK is hit
378 * load the plugin and append it to the list 378 * load the plugin and append it to the list
379 */ 379 */
380void MainWindowImp::addClicked() 380void MainWindowImp::addClicked()
@@ -402,25 +402,25 @@ void MainWindowImp::addClicked()
402 { 402 {
403 QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); 403 QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
404 if(!item) 404 if(!item)
405 return; 405 return;
406 406
407 for( it = libraries.begin(); it != libraries.end(); ++it ) 407 for( it = libraries.begin(); it != libraries.end(); ++it )
408 { 408 {
409 if(it.key()) 409 if(it.key())
410 { 410 {
411 Interface *i = (it.key())->addNewInterface(item->text(0)); 411 Interface *i = (it.key())->addNewInterface(item->text(0));
412 if(i) 412 if(i)
413 { 413 {
414 qDebug("iface name %s",i->getInterfaceName().latin1()); 414 odebug << "iface name " << i->getInterfaceName().latin1() << "" << oendl;
415 interfaceNames.insert(i->getInterfaceName(), i); 415 interfaceNames.insert(i->getInterfaceName(), i);
416 updateInterface(i); 416 updateInterface(i);
417 } 417 }
418 } 418 }
419 } 419 }
420 } 420 }
421} 421}
422 422
423/** 423/**
424 * Prompt the user to see if they really want to do this. 424 * Prompt the user to see if they really want to do this.
425 * If they do then remove from the list and unload. 425 * If they do then remove from the list and unload.
426 */ 426 */
@@ -504,25 +504,25 @@ void MainWindowImp::informationClicked()
504 // if(!i->isAttached()){ 504 // if(!i->isAttached()){
505 // QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); 505 // QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
506 // return; 506 // return;
507 // } 507 // }
508 508
509 if(i->getModuleOwner()) 509 if(i->getModuleOwner())
510 { 510 {
511 QWidget *moduleInformation = i->getModuleOwner()->information(i); 511 QWidget *moduleInformation = i->getModuleOwner()->information(i);
512 if(moduleInformation != NULL) 512 if(moduleInformation != NULL)
513 { 513 {
514 QPEApplication::showWidget( moduleInformation ); 514 QPEApplication::showWidget( moduleInformation );
515#ifdef DEBUG 515#ifdef DEBUG
516 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); 516 odebug << "MainWindowImp::informationClicked:: Module owner has created, we showed." << oendl;
517#endif 517#endif
518 return; 518 return;
519 } 519 }
520 } 520 }
521 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp); 521 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp);
522 QPEApplication::showWidget( information ); 522 QPEApplication::showWidget( information );
523} 523}
524 524
525/** 525/**
526 * Update this interface. If no QListViewItem exists create one. 526 * Update this interface. If no QListViewItem exists create one.
527 * @param Interface* pointer to the interface that needs to be updated. 527 * @param Interface* pointer to the interface that needs to be updated.
528 */ 528 */
@@ -641,25 +641,25 @@ void MainWindowImp::removeProfile()
641 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); 641 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
642 profilesList->clear(); 642 profilesList->clear();
643 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 643 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
644 profilesList->insertItem((*it)); 644 profilesList->insertItem((*it));
645 645
646 // Remove any interface settings and mappings. 646 // Remove any interface settings and mappings.
647 Interfaces interfaces; 647 Interfaces interfaces;
648 // Go through them one by one 648 // Go through them one by one
649 QMap<Interface*, QListViewItem*>::Iterator it; 649 QMap<Interface*, QListViewItem*>::Iterator it;
650 for( it = items.begin(); it != items.end(); ++it ) 650 for( it = items.begin(); it != items.end(); ++it )
651 { 651 {
652 QString interfaceName = it.key()->getInterfaceName(); 652 QString interfaceName = it.key()->getInterfaceName();
653 qDebug(interfaceName.latin1()); 653 odebug << interfaceName.latin1() << oendl;
654 if(interfaces.setInterface(interfaceName + "_" + profileToRemove)) 654 if(interfaces.setInterface(interfaceName + "_" + profileToRemove))
655 { 655 {
656 interfaces.removeInterface(); 656 interfaces.removeInterface();
657 if(interfaces.setMapping(interfaceName)) 657 if(interfaces.setMapping(interfaceName))
658 { 658 {
659 if(profilesList->count() == 1) 659 if(profilesList->count() == 1)
660 interfaces.removeMapping(); 660 interfaces.removeMapping();
661 else 661 else
662 { 662 {
663 interfaces.removeMap("map", interfaceName + "_" + profileToRemove); 663 interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
664 } 664 }
665 } 665 }
@@ -710,39 +710,39 @@ void MainWindowImp::changeProfile()
710 710
711 711
712void MainWindowImp::makeChannel() 712void MainWindowImp::makeChannel()
713{ 713{
714 channel = new QCopChannel( "QPE/Application/networksettings", this ); 714 channel = new QCopChannel( "QPE/Application/networksettings", this );
715 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 715 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
716 this, SLOT(receive(const QCString&,const QByteArray&)) ); 716 this, SLOT(receive(const QCString&,const QByteArray&)) );
717} 717}
718 718
719void MainWindowImp::receive(const QCString &msg, const QByteArray &arg) 719void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
720{ 720{
721 bool found = false; 721 bool found = false;
722 qDebug("MainWindowImp::receive QCop msg >"+msg+"<"); 722 odebug << "MainWindowImp::receive QCop msg >"+msg+"<" << oendl;
723 if (msg == "raise") 723 if (msg == "raise")
724 { 724 {
725 raise(); 725 raise();
726 return; 726 return;
727 } 727 }
728 728
729 QString dest = msg.left(msg.find("(")); 729 QString dest = msg.left(msg.find("("));
730 QCString param = msg.right(msg.length() - msg.find("(") - 1); 730 QCString param = msg.right(msg.length() - msg.find("(") - 1);
731 param = param.left( param.length() - 1 ); 731 param = param.left( param.length() - 1 );
732 qDebug("dest >%s< param >"+param+"<",dest.latin1()); 732 odebug << "dest >" << dest.latin1() << "< param >"+param+"<" << oendl;
733 733
734 QMap<Module*, QLibrary*>::Iterator it; 734 QMap<Module*, QLibrary*>::Iterator it;
735 for( it = libraries.begin(); it != libraries.end(); ++it ) 735 for( it = libraries.begin(); it != libraries.end(); ++it )
736 { 736 {
737 qDebug("plugin >%s<", it.key()->type().latin1() ); 737 odebug << "plugin >" << it.key()->type().latin1() << "<" << oendl;
738 if(it.key()->type() == dest) 738 if(it.key()->type() == dest)
739 { 739 {
740 it.key()->receive( param, arg ); 740 it.key()->receive( param, arg );
741 found = true; 741 found = true;
742 } 742 }
743 } 743 }
744 744
745 745
746 if (found) QPEApplication::setKeepRunning(); 746 if (found) QPEApplication::setKeepRunning();
747 else qDebug("Huh what do ya want"); 747 else odebug << "Huh what do ya want" << oendl;
748} 748}
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index b8a1925a..aedc0b9 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -109,25 +109,25 @@ void AccountWidget::edit()
109void AccountWidget::create() 109void AccountWidget::create()
110{ 110{
111 111
112 // if(listListbox->count() == MAX_ACCOUNTS) { 112 // if(listListbox->count() == MAX_ACCOUNTS) {
113 // QMessageBox::information(this, "sorry", 113 // QMessageBox::information(this, "sorry",
114 // tr("Maximum number of accounts reached.")); 114 // tr("Maximum number of accounts reached."));
115 // return; 115 // return;
116 // } 116 // }
117 117
118 int result; 118 int result;
119 if (_pppdata->newaccount() == -1) 119 if (_pppdata->newaccount() == -1)
120 { 120 {
121 qDebug("_pppdata->newaccount() == -1"); 121 odebug << "_pppdata->newaccount() == -1" << oendl;
122 return; 122 return;
123 } 123 }
124 result = doTab(); 124 result = doTab();
125 125
126 if(result == QDialog::Accepted) 126 if(result == QDialog::Accepted)
127 { 127 {
128 listListbox->insertItem(_pppdata->accname()); 128 listListbox->insertItem(_pppdata->accname());
129 listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true); 129 listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true);
130 130
131 _pppdata->save(); 131 _pppdata->save();
132 } 132 }
133 else 133 else
diff --git a/noncore/settings/networksettings/ppp/authwidget.cpp b/noncore/settings/networksettings/ppp/authwidget.cpp
index fa2b164..f3d842f 100644
--- a/noncore/settings/networksettings/ppp/authwidget.cpp
+++ b/noncore/settings/networksettings/ppp/authwidget.cpp
@@ -133,34 +133,34 @@ bool AuthWidget::check()
133void AuthWidget::save() 133void AuthWidget::save()
134{ 134{
135 _pppdata->setAuthMethod(auth->currentItem()); 135 _pppdata->setAuthMethod(auth->currentItem());
136 if (scriptWidget) scriptWidget->save(); 136 if (scriptWidget) scriptWidget->save();
137 _pppdata->setStoredUsername( userName->text() ); 137 _pppdata->setStoredUsername( userName->text() );
138 _pppdata->setStorePassword(store_password->isChecked()); 138 _pppdata->setStorePassword(store_password->isChecked());
139 if (store_password->isChecked()) 139 if (store_password->isChecked())
140 _pppdata->setStoredPassword( passWord->text() ); 140 _pppdata->setStoredPassword( passWord->text() );
141} 141}
142 142
143void AuthWidget::authChanged( const QString &authStr ) 143void AuthWidget::authChanged( const QString &authStr )
144{ 144{
145 qDebug("AuthWidget::authChanged( %s )", authStr.latin1() ); 145 odebug << "AuthWidget::authChanged( " << authStr.latin1() << " )" << oendl;
146 if ( authStr.contains( tr("Script-based") ) ){ 146 if ( authStr.contains( tr("Script-based") ) ){
147 showUsernamePassword( false ); 147 showUsernamePassword( false );
148 showScriptWindow( true ); 148 showScriptWindow( true );
149 } else if ( authStr.contains( tr("PAP") ) || 149 } else if ( authStr.contains( tr("PAP") ) ||
150 authStr.contains( tr("CHAP") ) ){ 150 authStr.contains( tr("CHAP") ) ){
151 showUsernamePassword( true ); 151 showUsernamePassword( true );
152 showScriptWindow( false ); 152 showScriptWindow( false );
153 } else { 153 } else {
154 qDebug("do not really know how to handle"); 154 odebug << "do not really know how to handle" << oendl;
155 showUsernamePassword( false ); 155 showUsernamePassword( false );
156 showScriptWindow( false ); 156 showScriptWindow( false );
157 } 157 }
158} 158}
159 159
160 160
161void AuthWidget::showUsernamePassword( bool show ) 161void AuthWidget::showUsernamePassword( bool show )
162{ 162{
163 if (show){ 163 if (show){
164 user_l->show(); 164 user_l->show();
165 userName->show(); 165 userName->show();
166 pw_l->show(); 166 pw_l->show();
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp
index e3fab24..b75410c 100644
--- a/noncore/settings/networksettings/ppp/connect.cpp
+++ b/noncore/settings/networksettings/ppp/connect.cpp
@@ -463,25 +463,25 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
463 463
464 // execute the script 464 // execute the script
465 if(vmain == 2) { 465 if(vmain == 2) {
466 if(!expecting && !pausing && !scanning) { 466 if(!expecting && !pausing && !scanning) {
467 467
468 timeout_timer->stop(); 468 timeout_timer->stop();
469 timeout_timer->start(scriptTimeout); 469 timeout_timer->start(scriptTimeout);
470 470
471 if((unsigned) scriptindex < comlist->count()) { 471 if((unsigned) scriptindex < comlist->count()) {
472 scriptCommand = *(comlist->at(scriptindex)); 472 scriptCommand = *(comlist->at(scriptindex));
473 scriptArgument = *(arglist->at(scriptindex)); 473 scriptArgument = *(arglist->at(scriptindex));
474 } else { 474 } else {
475 qDebug( "End of script" ); 475 odebug << "End of script" << oendl;
476 vmain = 10; 476 vmain = 10;
477 return; 477 return;
478 } 478 }
479 479
480 if (scriptCommand == "Scan") { 480 if (scriptCommand == "Scan") {
481 QString bm = QObject::tr("Scanning %1").arg(scriptArgument); 481 QString bm = QObject::tr("Scanning %1").arg(scriptArgument);
482 messg->setText(bm); 482 messg->setText(bm);
483 emit debugMessage(bm); 483 emit debugMessage(bm);
484 484
485 setScan(scriptArgument); 485 setScan(scriptArgument);
486 scriptindex++; 486 scriptindex++;
487 return; 487 return;
@@ -829,35 +829,35 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
829 829
830 // Close the tty. This prevents the QTimer::singleShot() in 830 // Close the tty. This prevents the QTimer::singleShot() in
831 // Modem::readtty() from re-enabling the socket notifier. 831 // Modem::readtty() from re-enabling the socket notifier.
832 // The port is still held open by the helper process. 832 // The port is still held open by the helper process.
833 833
834 /* Er, there _is_ not QTimer::singleShot() in Modem::readtty(), 834 /* Er, there _is_ not QTimer::singleShot() in Modem::readtty(),
835 and closing the thing prevents pppd from using it later. */ 835 and closing the thing prevents pppd from using it later. */
836 //_ifaceppp->modem()->closetty(); 836 //_ifaceppp->modem()->closetty();
837 837
838 killTimer( main_timer_ID ); 838 killTimer( main_timer_ID );
839 839
840 if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000); 840 if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000);
841 qDebug( "started if timeout timer with %i", _ifaceppp->data()->pppdTimeout()*1000); 841 odebug << "started if timeout timer with " << _ifaceppp->data()->pppdTimeout()*1000 << "" << oendl;
842 842
843 // find out PPP interface and notify the stats module 843 // find out PPP interface and notify the stats module
844// stats->setUnit(pppInterfaceNumber()); 844// stats->setUnit(pppInterfaceNumber());
845 845
846 qApp->flushX(); 846 qApp->flushX();
847 semaphore = true; 847 semaphore = true;
848 result = execppp(); 848 result = execppp();
849 849
850 emit debugMessage(QObject::tr("Starting pppd...")); 850 emit debugMessage(QObject::tr("Starting pppd..."));
851 qDebug("execppp() returned with return-code %i", result ); 851 odebug << "execppp() returned with return-code " << result << "" << oendl;
852 852
853 if(result) { 853 if(result) {
854 if(!_ifaceppp->data()->autoDNS()) 854 if(!_ifaceppp->data()->autoDNS())
855 adddns( _ifaceppp ); 855 adddns( _ifaceppp );
856 856
857 // O.K we are done here, let's change over to the if_waiting loop 857 // O.K we are done here, let's change over to the if_waiting loop
858 // where we wait for the ppp if (interface) to come up. 858 // where we wait for the ppp if (interface) to come up.
859 859
860 emit if_waiting_signal(); 860 emit if_waiting_signal();
861 } else { 861 } else {
862 862
863 // starting pppd wasn't successful. Error messages were 863 // starting pppd wasn't successful. Error messages were
@@ -1055,25 +1055,25 @@ void ConnectWidget::setExpect(const QString &n) {
1055 QString ts = QObject::tr("Expecting: %1").arg(n); 1055 QString ts = QObject::tr("Expecting: %1").arg(n);
1056 ts.replace(QRegExp("\n"), "<LF>"); 1056 ts.replace(QRegExp("\n"), "<LF>");
1057 emit debugMessage(ts); 1057 emit debugMessage(ts);
1058 1058
1059 // check if the expected string is in the read buffer already. 1059 // check if the expected string is in the read buffer already.
1060 checkBuffers(); 1060 checkBuffers();
1061} 1061}
1062 1062
1063 1063
1064void ConnectWidget::if_waiting_timed_out() { 1064void ConnectWidget::if_waiting_timed_out() {
1065 if_timer->stop(); 1065 if_timer->stop();
1066 if_timeout_timer->stop(); 1066 if_timeout_timer->stop();
1067 qDebug("if_waiting_timed_out()"); 1067 odebug << "if_waiting_timed_out()" << oendl;
1068 1068
1069 _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); 1069 _ifaceppp->data()->setpppdError(E_IF_TIMEOUT);
1070 1070
1071 // let's kill the stuck pppd 1071 // let's kill the stuck pppd
1072 _ifaceppp->modem()->killPPPDaemon(); 1072 _ifaceppp->modem()->killPPPDaemon();
1073 1073
1074 emit stopAccounting(); 1074 emit stopAccounting();
1075// p_kppp->con_win->stopClock(); 1075// p_kppp->con_win->stopClock();
1076 1076
1077 1077
1078 // killing ppp will generate a SIGCHLD which will be caught in pppdie() 1078 // killing ppp will generate a SIGCHLD which will be caught in pppdie()
1079 // in main.cpp what happens next will depend on the boolean 1079 // in main.cpp what happens next will depend on the boolean
@@ -1262,25 +1262,25 @@ bool ConnectWidget::execppp() {
1262 1262
1263 command += " call opie-kppp logfd 11"; 1263 command += " call opie-kppp logfd 11";
1264 1264
1265 if (command.length() > MAX_CMDLEN) { 1265 if (command.length() > MAX_CMDLEN) {
1266 QMessageBox::critical(this, "error", QObject::tr( 1266 QMessageBox::critical(this, "error", QObject::tr(
1267 "pppd command + command-line arguments exceed " 1267 "pppd command + command-line arguments exceed "
1268 "2024 characters in length." 1268 "2024 characters in length."
1269 )); 1269 ));
1270 1270
1271 return false; // nonsensically long command which would bust my buffer buf. 1271 return false; // nonsensically long command which would bust my buffer buf.
1272 } 1272 }
1273 1273
1274 qWarning("Command IS: %s",command.latin1() ); 1274 owarn << "Command IS: " << command.latin1() << "" << oendl;
1275 1275
1276 qApp->flushX(); 1276 qApp->flushX();
1277 1277
1278 return _ifaceppp->modem()->execPPPDaemon(command); 1278 return _ifaceppp->modem()->execPPPDaemon(command);
1279} 1279}
1280 1280
1281 1281
1282void ConnectWidget::closeEvent( QCloseEvent *e ) { 1282void ConnectWidget::closeEvent( QCloseEvent *e ) {
1283 e->ignore(); 1283 e->ignore();
1284 emit cancelbutton(); 1284 emit cancelbutton();
1285} 1285}
1286 1286
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp
index 9da090d..350ff32 100644
--- a/noncore/settings/networksettings/ppp/devices.cpp
+++ b/noncore/settings/networksettings/ppp/devices.cpp
@@ -63,29 +63,29 @@ DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *nam
63 tr("Makes a copy of the selected device. All\n" 63 tr("Makes a copy of the selected device. All\n"
64 "settings of the selected device are copied\n" 64 "settings of the selected device are copied\n"
65 "to a new device, that you can modify to fit your\n" 65 "to a new device, that you can modify to fit your\n"
66 "needs")); 66 "needs"));
67 QWhatsThis::add(delete_b, 67 QWhatsThis::add(delete_b,
68 tr("<p>Deletes the selected device\n\n" 68 tr("<p>Deletes the selected device\n\n"
69 "<font color=\"red\"><b>Use with care!</b></font>")); 69 "<font color=\"red\"><b>Use with care!</b></font>"));
70 70
71 copy_b->setEnabled( false ); //FIXME 71 copy_b->setEnabled( false ); //FIXME
72// delete_b->setEnabled( false ); //FIXME 72// delete_b->setEnabled( false ); //FIXME
73 73
74 QStringList tmp = _pppdata->getDevicesNamesList(); 74 QStringList tmp = _pppdata->getDevicesNamesList();
75 qDebug("DevicesWidget::DevicesWidget got devices %s",tmp.join("--").latin1()); 75 odebug << "DevicesWidget::DevicesWidget got devices " << tmp.join("--").latin1() << "" << oendl;
76 listListbox->insertStringList(tmp); 76 listListbox->insertStringList(tmp);
77 77
78 for (uint i = 0; i < listListbox->count(); i++){ 78 for (uint i = 0; i < listListbox->count(); i++){
79 qDebug("listListbox->text(i) %s == _pppdata->devname() %s",listListbox->text(i).latin1(), _pppdata->devname().latin1()); 79 odebug << "listListbox->text(i) " << listListbox->text(i).latin1() << " == _pppdata->devname() " << _pppdata->devname().latin1() << "" << oendl;
80 if ( listListbox->text(i) == _pppdata->devname() ) 80 if ( listListbox->text(i) == _pppdata->devname() )
81 listListbox->setCurrentItem( i ); 81 listListbox->setCurrentItem( i );
82 } 82 }
83} 83}
84 84
85 85
86 86
87void DevicesWidget::slotListBoxSelect(int idx) { 87void DevicesWidget::slotListBoxSelect(int idx) {
88 bool ok = _pppdata->setDevice( listListbox->text(idx) ); 88 bool ok = _pppdata->setDevice( listListbox->text(idx) );
89 delete_b->setEnabled((bool)(idx != -1)); 89 delete_b->setEnabled((bool)(idx != -1));
90 edit_b->setEnabled((bool)(idx != -1)); 90 edit_b->setEnabled((bool)(idx != -1));
91//FIXME copy_b->setEnabled((bool)(idx != -1)); 91//FIXME copy_b->setEnabled((bool)(idx != -1));
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index 81dab38..69bb682 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -326,25 +326,25 @@ ModemWidget::~ModemWidget()
326// _pppdata->setModemTimeout(n); 326// _pppdata->setModemTimeout(n);
327// } 327// }
328 328
329 329
330 330
331bool ModemWidget::save() 331bool ModemWidget::save()
332{ 332{
333 //first check to make sure that the device name is unique! 333 //first check to make sure that the device name is unique!
334 if(modemname->text().isEmpty() || 334 if(modemname->text().isEmpty() ||
335 !_pppdata->isUniqueDevname(modemname->text())) 335 !_pppdata->isUniqueDevname(modemname->text()))
336 return false; 336 return false;
337 337
338 qDebug("ModemWidget::save saving modem1 data"); 338 odebug << "ModemWidget::save saving modem1 data" << oendl;
339 _pppdata->setDevname( modemname->text() ); 339 _pppdata->setDevname( modemname->text() );
340 _pppdata->setModemDevice( modemdevice->currentText() ); 340 _pppdata->setModemDevice( modemdevice->currentText() );
341 _pppdata->setFlowcontrol(flowcontrol->currentText()); 341 _pppdata->setFlowcontrol(flowcontrol->currentText());
342 _pppdata->setFlowcontrol(flowcontrol->currentText()); 342 _pppdata->setFlowcontrol(flowcontrol->currentText());
343 _pppdata->setSpeed(baud_c->currentText()); 343 _pppdata->setSpeed(baud_c->currentText());
344 _pppdata->setModemLockFile( modemlockfile->isChecked()); 344 _pppdata->setModemLockFile( modemlockfile->isChecked());
345 _pppdata->setModemTimeout( modemtimeout->value() ); 345 _pppdata->setModemTimeout( modemtimeout->value() );
346 return true; 346 return true;
347 347
348} 348}
349 349
350ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, 350ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent,
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
index 6b158b9..5a76293 100644
--- a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
@@ -11,25 +11,25 @@
11#ifdef QWS 11#ifdef QWS
12#else 12#else
13 #define showMaximized show 13 #define showMaximized show
14#endif 14#endif
15 15
16/** 16/**
17 * Constructor for the InterfaceInformationImp class. This class pretty much 17 * Constructor for the InterfaceInformationImp class. This class pretty much
18 * just display's information about the interface that is passed to it. 18 * just display's information about the interface that is passed to it.
19 */ 19 */
20InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f) 20InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f)
21 :InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp) 21 :InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp)
22{ 22{
23 qDebug("InterfaceInformationPPP::InterfaceInformationPPP %s", name); 23 odebug << "InterfaceInformationPPP::InterfaceInformationPPP " << name << "" << oendl;
24 con = new ConnectWidget( (InterfacePPP*)i, this, "con" ); 24 con = new ConnectWidget( (InterfacePPP*)i, this, "con" );
25 con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, 25 con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding,
26 QSizePolicy::Fixed) ); 26 QSizePolicy::Fixed) );
27 27
28 macAddressLabel->hide(); 28 macAddressLabel->hide();
29 subnetMaskLabel->hide(); 29 subnetMaskLabel->hide();
30 broadcastLabel->hide(); 30 broadcastLabel->hide();
31 TextLabel23->hide(); 31 TextLabel23->hide();
32 TextLabel21->hide(); 32 TextLabel21->hide();
33 TextLabel24->hide(); 33 TextLabel24->hide();
34 34
35 InterfaceInformationLayout->addWidget( con, 1, 0 ); 35 InterfaceInformationLayout->addWidget( con, 1, 0 );
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp
index f443f3c..5cc6f70 100644
--- a/noncore/settings/networksettings/ppp/interfaceppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp
@@ -5,64 +5,64 @@
5#include <qlabel.h> 5#include <qlabel.h>
6 6
7#include "auth.h" 7#include "auth.h"
8#include "interfaceppp.h" 8#include "interfaceppp.h"
9#include "modem.h" 9#include "modem.h"
10#include "pppdata.h" 10#include "pppdata.h"
11 11
12InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) 12InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status)
13 : Interface(parent, name, status), 13 : Interface(parent, name, status),
14 _modemPtr(0), 14 _modemPtr(0),
15 _dataPtr(0) 15 _dataPtr(0)
16{ 16{
17 qDebug("InterfacePPP::InterfacePPP("); 17 odebug << "InterfacePPP::InterfacePPP(" << oendl;
18} 18}
19 19
20PPPData* InterfacePPP::data()const 20PPPData* InterfacePPP::data()const
21{ 21{
22 if (!_dataPtr){ 22 if (!_dataPtr){
23 qDebug("creating new Data obj"); 23 odebug << "creating new Data obj" << oendl;
24 _dataPtr = new PPPData(); 24 _dataPtr = new PPPData();
25 _dataPtr->setDevice( getInterfaceName() ); 25 _dataPtr->setDevice( getInterfaceName() );
26 _dataPtr->setAccount( getHardwareName() ); 26 _dataPtr->setAccount( getHardwareName() );
27 } 27 }
28 return _dataPtr; 28 return _dataPtr;
29} 29}
30 30
31Modem* InterfacePPP::modem()const 31Modem* InterfacePPP::modem()const
32{ 32{
33 if (!_modemPtr){ 33 if (!_modemPtr){
34 qDebug("creating new modem obj"); 34 odebug << "creating new modem obj" << oendl;
35 _modemPtr = new Modem( data() ); 35 _modemPtr = new Modem( data() );
36 } 36 }
37 return _modemPtr; 37 return _modemPtr;
38} 38}
39 39
40bool InterfacePPP::refresh() 40bool InterfacePPP::refresh()
41{ 41{
42 qDebug("InterfacePPP::refresh()"); 42 odebug << "InterfacePPP::refresh()" << oendl;
43 QString old = getInterfaceName(); 43 QString old = getInterfaceName();
44 setInterfaceName( modem()->pppDevice() ); 44 setInterfaceName( modem()->pppDevice() );
45 45
46 (void)Interface::refresh(); 46 (void)Interface::refresh();
47 47
48 setInterfaceName( old ); 48 setInterfaceName( old );
49 emit updateInterface(this); 49 emit updateInterface(this);
50 50
51 return true; 51 return true;
52} 52}
53 53
54void InterfacePPP::start() 54void InterfacePPP::start()
55{ 55{
56 qDebug("InterfacePPP::start"); 56 odebug << "InterfacePPP::start" << oendl;
57 57
58 if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) { 58 if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) {
59 59
60 QDialog mb( 0, "Dialog", true ); 60 QDialog mb( 0, "Dialog", true );
61 mb.setCaption( tr( "No password" ) ); 61 mb.setCaption( tr( "No password" ) );
62 QVBoxLayout layout( &mb ); 62 QVBoxLayout layout( &mb );
63 QLabel text ( &mb ); 63 QLabel text ( &mb );
64 text.setText( tr("Username defined but no password\n Please enter a password") ); 64 text.setText( tr("Username defined but no password\n Please enter a password") );
65 QLineEdit lineedit( &mb ); 65 QLineEdit lineedit( &mb );
66 lineedit.setEchoMode( QLineEdit::Password ); 66 lineedit.setEchoMode( QLineEdit::Password );
67 layout.addWidget( &text ); 67 layout.addWidget( &text );
68 layout.addWidget( &lineedit ); 68 layout.addWidget( &lineedit );
@@ -134,30 +134,30 @@ void InterfacePPP::start()
134 if (data()->phonenumber().isEmpty()) { 134 if (data()->phonenumber().isEmpty()) {
135 QString s = QObject::tr("You must specify a telephone number!"); 135 QString s = QObject::tr("You must specify a telephone number!");
136 QMessageBox::warning(0, tr("Error"), s); 136 QMessageBox::warning(0, tr("Error"), s);
137 return; 137 return;
138 } 138 }
139 139
140 // SEGFAULTS: 140 // SEGFAULTS:
141// setStatus( true ); 141// setStatus( true );
142// emit updateInterface((Interface*) this); 142// emit updateInterface((Interface*) this);
143 143
144 emit begin_connect(); 144 emit begin_connect();
145 145
146 qDebug("InterfacePPP::start END"); 146 odebug << "InterfacePPP::start END" << oendl;
147} 147}
148 148
149void InterfacePPP::stop() 149void InterfacePPP::stop()
150{ 150{
151 qDebug("InterfacePPP::stop"); 151 odebug << "InterfacePPP::stop" << oendl;
152 // emit hangup_now(); 152 // emit hangup_now();
153 status = false; // not connected 153 status = false; // not connected
154 setStatus( false ); 154 setStatus( false );
155 emit hangup_now(); 155 emit hangup_now();
156 refresh(); 156 refresh();
157 157
158} 158}
159 159
160void InterfacePPP::save() 160void InterfacePPP::save()
161{ 161{
162 data()->save(); 162 data()->save();
163 emit updateInterface((Interface*) this); 163 emit updateInterface((Interface*) this);
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index e21bbc7..fd09332 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -65,31 +65,31 @@
65#define execute_command system 65#define execute_command system
66 66
67KPPPWidget *p_kppp = 0; 67KPPPWidget *p_kppp = 0;
68 68
69KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) 69KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl )
70 : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd) 70 : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd)
71{ 71{
72// tabWindow = 0; 72// tabWindow = 0;
73 p_kppp = this; 73 p_kppp = this;
74 // before doing anything else, run a few tests 74 // before doing anything else, run a few tests
75 if (!_pppdata->setModemDevice( i->getInterfaceName() )) 75 if (!_pppdata->setModemDevice( i->getInterfaceName() ))
76 _pppdata->setModemDevice("/dev/modem"); 76 _pppdata->setModemDevice("/dev/modem");
77 qDebug("PPPConfigWidget::PPPConfigWidget"); 77 odebug << "PPPConfigWidget::PPPConfigWidget" << oendl;
78 qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1()); 78 odebug << " interface->getHardwareName >" << i->getHardwareName().latin1() << "<" << oendl;
79 if (!_pppdata->setAccount( i->getHardwareName() )) 79 if (!_pppdata->setAccount( i->getHardwareName() ))
80 _pppdata->setAccount( 0 ); 80 _pppdata->setAccount( 0 );
81 81
82 qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1()); 82 odebug << " _pppdata->accname >" << _pppdata->accname().latin1() << "<" << oendl;
83 qDebug(" _pppdata->currentAccountID() >%i<",_pppdata->currentAccountID()); 83 odebug << " _pppdata->currentAccountID() >" << _pppdata->currentAccountID() << "<" << oendl;
84 84
85 int result = runTests(); 85 int result = runTests();
86 if(result == TEST_CRITICAL) 86 if(result == TEST_CRITICAL)
87 exit(4); 87 exit(4);
88 88
89// installEventFilter(this); 89// installEventFilter(this);
90 90
91 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); 91 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
92 92
93 QGridLayout *l1 = new QGridLayout(3, 4); 93 QGridLayout *l1 = new QGridLayout(3, 4);
94 tl->addLayout(l1); 94 tl->addLayout(l1);
95 l1->addColSpacing(0, 10); 95 l1->addColSpacing(0, 10);
@@ -296,25 +296,25 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
296} 296}
297 297
298KPPPWidget::~KPPPWidget() 298KPPPWidget::~KPPPWidget()
299{ 299{
300 p_kppp = 0; 300 p_kppp = 0;
301// delete stats; 301// delete stats;
302} 302}
303 303
304// bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { 304// bool KPPPWidget::eventFilter(QObject *o, QEvent *e) {
305// if(e->type() == QEvent::User) { 305// if(e->type() == QEvent::User) {
306// switch(((SignalEvent*)e)->sigType()) { 306// switch(((SignalEvent*)e)->sigType()) {
307// case SIGINT: 307// case SIGINT:
308// qDebug( "Received a SIGINT" ); 308// odebug << "Received a SIGINT" << oendl;
309// interruptConnection(); 309// interruptConnection();
310// break; 310// break;
311// case SIGCHLD: 311// case SIGCHLD:
312// sigChld(); 312// sigChld();
313// break; 313// break;
314// case SIGUSR1: 314// case SIGUSR1:
315// sigPPPDDied(); 315// sigPPPDDied();
316// break; 316// break;
317// } 317// }
318// return true; 318// return true;
319// } 319// }
320 320
@@ -414,44 +414,44 @@ void KPPPWidget::interruptConnection() {
414// 414//
415 415
416 if (con->isVisible()) 416 if (con->isVisible())
417 emit con->cancelbutton(); 417 emit con->cancelbutton();
418 418
419 // disconnect if online 419 // disconnect if online
420 if (_pppdata->pppdRunning()) 420 if (_pppdata->pppdRunning())
421 emit disconnect(); 421 emit disconnect();
422} 422}
423 423
424 424
425void KPPPWidget::sigPPPDDied() { 425void KPPPWidget::sigPPPDDied() {
426 qDebug( "Received a SIGUSR1" ); 426 odebug << "Received a SIGUSR1" << oendl;
427 427
428 // if we are not connected pppdpid is -1 so have have to check for that 428 // if we are not connected pppdpid is -1 so have have to check for that
429 // in the followin line to make sure that we don't raise a false alarm 429 // in the followin line to make sure that we don't raise a false alarm
430 // such as would be the case when the log file viewer exits. 430 // such as would be the case when the log file viewer exits.
431 if(_pppdata->pppdRunning() || _pppdata->pppdError()) { 431 if(_pppdata->pppdRunning() || _pppdata->pppdError()) {
432 qDebug( "It was pppd that died" ); 432 odebug << "It was pppd that died" << oendl;
433 433
434 // when we killpppd() on Cancel in ConnectWidget 434 // when we killpppd() on Cancel in ConnectWidget
435 // we set pppid to -1 so we won't 435 // we set pppid to -1 so we won't
436 // enter this block 436 // enter this block
437 437
438 // just to be sure 438 // just to be sure
439 439
440 Modem::modem->removeSecret(AUTH_PAP); 440 Modem::modem->removeSecret(AUTH_PAP);
441 Modem::modem->removeSecret(AUTH_CHAP); 441 Modem::modem->removeSecret(AUTH_CHAP);
442 442
443 _pppdata->setpppdRunning(false); 443 _pppdata->setpppdRunning(false);
444 444
445 qDebug( "Executing command on disconnect since pppd has died." ); 445 odebug << "Executing command on disconnect since pppd has died." << oendl;
446 QApplication::flushX(); 446 QApplication::flushX();
447 execute_command(_pppdata->command_on_disconnect()); 447 execute_command(_pppdata->command_on_disconnect());
448 448
449// stopAccounting(); 449// stopAccounting();
450 450
451 con_win->stopClock(); 451 con_win->stopClock();
452// DockWidget::dock_widget->stop_stats(); 452// DockWidget::dock_widget->stop_stats();
453// DockWidget::dock_widget->hide(); 453// DockWidget::dock_widget->hide();
454 454
455 if(!_pppdata->pppdError()) 455 if(!_pppdata->pppdError())
456 _pppdata->setpppdError(E_PPPD_DIED); 456 _pppdata->setpppdError(E_PPPD_DIED);
457 removedns(); 457 removedns();
@@ -480,47 +480,47 @@ void KPPPWidget::sigPPPDDied() {
480 msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus); 480 msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus);
481 msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error " 481 msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error "
482 "codes or take a look at the kppp FAQ on " 482 "codes or take a look at the kppp FAQ on "
483 " <a href=http://devel-home.kde.org/~kppp/index.html>" 483 " <a href=http://devel-home.kde.org/~kppp/index.html>"
484 "http://devel-home.kde.org/~kppp/index.html</a></p>"); 484 "http://devel-home.kde.org/~kppp/index.html</a></p>");
485 } 485 }
486 } 486 }
487 487
488 // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No) 488 // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No)
489 // // PPPL_ShowLog(); 489 // // PPPL_ShowLog();
490// } else { /* reconnect on disconnect */ 490// } else { /* reconnect on disconnect */
491 if (false){ 491 if (false){
492 qDebug( "Trying to reconnect... " ); 492 odebug << "Trying to reconnect... " << oendl;
493 493
494 if(_pppdata->authMethod() == AUTH_PAP || 494 if(_pppdata->authMethod() == AUTH_PAP ||
495 _pppdata->authMethod() == AUTH_CHAP || 495 _pppdata->authMethod() == AUTH_CHAP ||
496 _pppdata->authMethod() == AUTH_PAPCHAP) 496 _pppdata->authMethod() == AUTH_PAPCHAP)
497 Modem::modem->setSecret(_pppdata->authMethod(), 497 Modem::modem->setSecret(_pppdata->authMethod(),
498 encodeWord(_pppdata->storedUsername()), 498 encodeWord(_pppdata->storedUsername()),
499 encodeWord(_pppdata->password())); 499 encodeWord(_pppdata->password()));
500 500
501 con_win->hide(); 501 con_win->hide();
502 con_win->stopClock(); 502 con_win->stopClock();
503 //stopAccounting(); 503 //stopAccounting();
504 _pppdata->setpppdRunning(false); 504 _pppdata->setpppdRunning(false);
505 // not in a signal handler !!!KNotifyClient::beep(); 505 // not in a signal handler !!!KNotifyClient::beep();
506 emit cmdl_start(); 506 emit cmdl_start();
507 } 507 }
508 } 508 }
509 _pppdata->setpppdError(0); 509 _pppdata->setpppdError(0);
510 } 510 }
511} 511}
512 512
513// void KPPPWidget::sigChld() { 513// void KPPPWidget::sigChld() {
514// qDebug( "sigchld()" ); 514// odebug << "sigchld()" << oendl;
515// // pid_t id = wait(0L); 515// // pid_t id = wait(0L);
516// // if(id == helperPid && helperPid != -1) { 516// // if(id == helperPid && helperPid != -1) {
517// // kdDebug(5002) << "It was the setuid child that died" << endl; 517// // kdDebug(5002) << "It was the setuid child that died" << endl;
518// // helperPid = -1; 518// // helperPid = -1;
519// QString msg = QObject::tr("kppp's helper process just died.\n" 519// QString msg = QObject::tr("kppp's helper process just died.\n"
520// "Since a further execution would be pointless, " 520// "Since a further execution would be pointless, "
521// "kppp will shut down now."); 521// "kppp will shut down now.");
522// QMessageBox::warning(0L,"error", msg); 522// QMessageBox::warning(0L,"error", msg);
523// //remove_pidfile(); 523// //remove_pidfile();
524// exit(1); 524// exit(1);
525// // } 525// // }
526// } 526// }
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp
index 3dbc8c3..f3f2639 100644
--- a/noncore/settings/networksettings/ppp/modem.cpp
+++ b/noncore/settings/networksettings/ppp/modem.cpp
@@ -46,25 +46,25 @@
46#ifndef _PATH_RESCONF 46#ifndef _PATH_RESCONF
47#define _PATH_RESCONF "/etc/resolv.conf" 47#define _PATH_RESCONF "/etc/resolv.conf"
48#endif 48#endif
49 49
50#define strlcpy strcpy 50#define strlcpy strcpy
51#include "auth.h" 51#include "auth.h"
52#include "modem.h" 52#include "modem.h"
53#include "pppdata.h" 53#include "pppdata.h"
54#define qError qDebug 54#define qError qDebug
55 55
56 56
57#define MY_ASSERT(x) if (!(x)) { \ 57#define MY_ASSERT(x) if (!(x)) { \
58 qFatal( "ASSERT: \"%s\" in %s (%d)\n",#x,__FILE__,__LINE__); \ 58 ofatal << "ASSERT: \"" << #x << "\" in " << __FILE__ << " (" << __LINE__ << ")\n" << oendl; \
59 exit(1); } 59 exit(1); }
60 60
61 61
62static sigjmp_buf jmp_buffer; 62static sigjmp_buf jmp_buffer;
63 63
64//Modem *Modem::modem = 0; 64//Modem *Modem::modem = 0;
65 65
66 66
67const char* pppdPath() { 67const char* pppdPath() {
68 // wasting a few bytes 68 // wasting a few bytes
69 static char buffer[sizeof(PPPDSEARCHPATH)+sizeof(PPPDNAME)]; 69 static char buffer[sizeof(PPPDSEARCHPATH)+sizeof(PPPDNAME)];
70 static char *pppdPath = 0L; 70 static char *pppdPath = 0L;
@@ -156,25 +156,25 @@ speed_t Modem::modemspeed() {
156 return B38400; 156 return B38400;
157 break; 157 break;
158 } 158 }
159} 159}
160 160
161bool Modem::opentty() { 161bool Modem::opentty() {
162 // int flags; 162 // int flags;
163 163
164//begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { 164//begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
165 close(modemfd); 165 close(modemfd);
166 device = _pppdata->modemDevice(); 166 device = _pppdata->modemDevice();
167 if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { 167 if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) {
168 qDebug("error opening modem device !"); 168 odebug << "error opening modem device !" << oendl;
169 errmsg = QObject::tr("Unable to open modem."); 169 errmsg = QObject::tr("Unable to open modem.");
170 return false; 170 return false;
171 } 171 }
172//bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { 172//bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
173//} 173//}
174 174
175#if 0 175#if 0
176 if(_pppdata->UseCDLine()) { 176 if(_pppdata->UseCDLine()) {
177 if(ioctl(modemfd, TIOCMGET, &flags) == -1) { 177 if(ioctl(modemfd, TIOCMGET, &flags) == -1) {
178 errmsg = QObject::tr("Unable to detect state of CD line."); 178 errmsg = QObject::tr("Unable to detect state of CD line.");
179 ::close(modemfd); 179 ::close(modemfd);
180 modemfd = -1; 180 modemfd = -1;
@@ -297,56 +297,56 @@ void Modem::notify(const QObject *receiver, const char *member) {
297 297
298void Modem::stop() { 298void Modem::stop() {
299 disconnect(SIGNAL(charWaiting(unsigned char))); 299 disconnect(SIGNAL(charWaiting(unsigned char)));
300 stopNotifier(); 300 stopNotifier();
301} 301}
302 302
303 303
304void Modem::startNotifier() { 304void Modem::startNotifier() {
305 if(modemfd >= 0) { 305 if(modemfd >= 0) {
306 if(sn == 0) { 306 if(sn == 0) {
307 sn = new QSocketNotifier(modemfd, QSocketNotifier::Read, this); 307 sn = new QSocketNotifier(modemfd, QSocketNotifier::Read, this);
308 connect(sn, SIGNAL(activated(int)), SLOT(readtty(int))); 308 connect(sn, SIGNAL(activated(int)), SLOT(readtty(int)));
309 qDebug("QSocketNotifier started!"); 309 odebug << "QSocketNotifier started!" << oendl;
310 } else { 310 } else {
311 qDebug("QSocketNotifier re-enabled!"); 311 odebug << "QSocketNotifier re-enabled!" << oendl;
312 sn->setEnabled(true); 312 sn->setEnabled(true);
313 } 313 }
314 } 314 }
315} 315}
316 316
317 317
318void Modem::stopNotifier() { 318void Modem::stopNotifier() {
319 if(sn != 0) { 319 if(sn != 0) {
320 sn->setEnabled(false); 320 sn->setEnabled(false);
321 disconnect(sn); 321 disconnect(sn);
322 delete sn; 322 delete sn;
323 sn = 0; 323 sn = 0;
324 qDebug( "QSocketNotifier stopped!" ); 324 odebug << "QSocketNotifier stopped!" << oendl;
325 } 325 }
326} 326}
327 327
328 328
329void Modem::flush() { 329void Modem::flush() {
330 char c; 330 char c;
331 while(read(modemfd, &c, 1) == 1); 331 while(read(modemfd, &c, 1) == 1);
332} 332}
333 333
334 334
335bool Modem::writeChar(unsigned char c) { 335bool Modem::writeChar(unsigned char c) {
336 int s; 336 int s;
337 do { 337 do {
338 s = write(modemfd, &c, 1); 338 s = write(modemfd, &c, 1);
339 if (s < 0) { 339 if (s < 0) {
340 qError( "write() in Modem::writeChar failed" ); 340 oerr << "write() in Modem::writeChar failed" << oendl;
341 return false; 341 return false;
342 } 342 }
343 } while(s == 0); 343 } while(s == 0);
344 344
345 return true; 345 return true;
346} 346}
347 347
348 348
349bool Modem::writeLine(const char *buf) { 349bool Modem::writeLine(const char *buf) {
350 int len = strlen(buf); 350 int len = strlen(buf);
351 char *b = new char[len+2]; 351 char *b = new char[len+2];
352 memcpy(b, buf, len); 352 memcpy(b, buf, len);
@@ -356,25 +356,25 @@ bool Modem::writeLine(const char *buf) {
356 b[len++]='\n'; 356 b[len++]='\n';
357 else if(term == "CR") 357 else if(term == "CR")
358 b[len++]='\r'; 358 b[len++]='\r';
359 else if(term == "CR/LF") { 359 else if(term == "CR/LF") {
360 b[len++]='\r'; 360 b[len++]='\r';
361 b[len++]='\n'; 361 b[len++]='\n';
362 } 362 }
363 int l = len; 363 int l = len;
364 while(l) { 364 while(l) {
365 int wr = write(modemfd, &b[len-l], l); 365 int wr = write(modemfd, &b[len-l], l);
366 if(wr < 0) { 366 if(wr < 0) {
367 // TODO do something meaningful with the error code (or ignore it 367 // TODO do something meaningful with the error code (or ignore it
368 qError( "write() in Modem::writeLine failed" ); 368 oerr << "write() in Modem::writeLine failed" << oendl;
369 delete[] b; 369 delete[] b;
370 return false; 370 return false;
371 } 371 }
372 l -= wr; 372 l -= wr;
373 } 373 }
374 delete[] b; 374 delete[] b;
375 return true; 375 return true;
376} 376}
377 377
378 378
379bool Modem::hangup() { 379bool Modem::hangup() {
380 // this should really get the modem to hang up and go into command mode 380 // this should really get the modem to hang up and go into command mode
@@ -465,25 +465,25 @@ void Modem::escape_to_command_mode() {
465const QString Modem::modemMessage() { 465const QString Modem::modemMessage() {
466 return errmsg; 466 return errmsg;
467} 467}
468 468
469 469
470QString Modem::parseModemSpeed(const QString &s) { 470QString Modem::parseModemSpeed(const QString &s) {
471 // this is a small (and bad) parser for modem speeds 471 // this is a small (and bad) parser for modem speeds
472 int rx = -1; 472 int rx = -1;
473 int tx = -1; 473 int tx = -1;
474 int i; 474 int i;
475 QString result; 475 QString result;
476 476
477 qDebug( "Modem reported result string: %s", s.latin1()); 477 odebug << "Modem reported result string: " << s.latin1() << "" << oendl;
478 478
479 const int RXMAX = 7; 479 const int RXMAX = 7;
480 const int TXMAX = 2; 480 const int TXMAX = 2;
481 QRegExp rrx[RXMAX] = { 481 QRegExp rrx[RXMAX] = {
482 QRegExp("[0-9]+[:/ ]RX", false), 482 QRegExp("[0-9]+[:/ ]RX", false),
483 QRegExp("[0-9]+RX", false), 483 QRegExp("[0-9]+RX", false),
484 QRegExp("[/: -][0-9]+[/: ]", false), 484 QRegExp("[/: -][0-9]+[/: ]", false),
485 QRegExp("[/: -][0-9]+$", false), 485 QRegExp("[/: -][0-9]+$", false),
486 QRegExp("CARRIER [^0-9]*[0-9]+", false), 486 QRegExp("CARRIER [^0-9]*[0-9]+", false),
487 QRegExp("CONNECT [^0-9]*[0-9]+", false), 487 QRegExp("CONNECT [^0-9]*[0-9]+", false),
488 QRegExp("[0-9]+") // panic mode 488 QRegExp("[0-9]+") // panic mode
489 }; 489 };
@@ -551,131 +551,131 @@ QString Modem::parseModemSpeed(const QString &s) {
551 } 551 }
552 } 552 }
553 553
554 if(rx == -1 && tx == -1) 554 if(rx == -1 && tx == -1)
555 result = QObject::tr("Unknown speed"); 555 result = QObject::tr("Unknown speed");
556 else if(tx == -1) 556 else if(tx == -1)
557 result.setNum(rx); 557 result.setNum(rx);
558 else if(rx == -1) // should not happen 558 else if(rx == -1) // should not happen
559 result.setNum(tx); 559 result.setNum(tx);
560 else 560 else
561 result.sprintf("%d/%d", rx, tx); 561 result.sprintf("%d/%d", rx, tx);
562 562
563 qDebug( "The parsed result is: %s", result.latin1()); 563 odebug << "The parsed result is: " << result.latin1() << "" << oendl;
564 564
565 return result; 565 return result;
566} 566}
567 567
568 568
569// Lock modem device. Returns 0 on success 1 if the modem is locked and -1 if 569// Lock modem device. Returns 0 on success 1 if the modem is locked and -1 if
570// a lock file can't be created ( permission problem ) 570// a lock file can't be created ( permission problem )
571int Modem::lockdevice() { 571int Modem::lockdevice() {
572 int fd; 572 int fd;
573 char newlock[80]=""; // safe 573 char newlock[80]=""; // safe
574 574
575 if(!_pppdata->modemLockFile()) { 575 if(!_pppdata->modemLockFile()) {
576 qDebug("The user doesn't want a lockfile."); 576 odebug << "The user doesn't want a lockfile." << oendl;
577 return 0; 577 return 0;
578 } 578 }
579 579
580 if (modem_is_locked) 580 if (modem_is_locked)
581 return 1; 581 return 1;
582 582
583 QString lockfile = LOCK_DIR"/LCK.."; 583 QString lockfile = LOCK_DIR"/LCK..";
584 lockfile += _pppdata->modemDevice().mid(5); // append everything after /dev/ 584 lockfile += _pppdata->modemDevice().mid(5); // append everything after /dev/
585 585
586 if(access(QFile::encodeName(lockfile), F_OK) == 0) { 586 if(access(QFile::encodeName(lockfile), F_OK) == 0) {
587// if ((fd = Requester::rq-> 587// if ((fd = Requester::rq->
588if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) { 588if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) {
589 // Mario: it's not necessary to read more than lets say 32 bytes. If 589 // Mario: it's not necessary to read more than lets say 32 bytes. If
590 // file has more than 32 bytes, skip the rest 590 // file has more than 32 bytes, skip the rest
591 char oldlock[33]; // safe 591 char oldlock[33]; // safe
592 int sz = read(fd, &oldlock, 32); 592 int sz = read(fd, &oldlock, 32);
593 close (fd); 593 close (fd);
594 if (sz <= 0) 594 if (sz <= 0)
595 return 1; 595 return 1;
596 oldlock[sz] = '\0'; 596 oldlock[sz] = '\0';
597 597
598 qDebug( "Device is locked by: %s", oldlock); 598 odebug << "Device is locked by: " << oldlock << "" << oendl;
599 599
600 int oldpid; 600 int oldpid;
601 int match = sscanf(oldlock, "%d", &oldpid); 601 int match = sscanf(oldlock, "%d", &oldpid);
602 602
603 // found a pid in lockfile ? 603 // found a pid in lockfile ?
604 if (match < 1 || oldpid <= 0) 604 if (match < 1 || oldpid <= 0)
605 return 1; 605 return 1;
606 606
607 // check if process exists 607 // check if process exists
608 if (kill((pid_t)oldpid, 0) == 0 || errno != ESRCH) 608 if (kill((pid_t)oldpid, 0) == 0 || errno != ESRCH)
609 return 1; 609 return 1;
610 610
611 qDebug( "lockfile is stale" ); 611 odebug << "lockfile is stale" << oendl;
612 } 612 }
613 } 613 }
614 614
615 fd = openLockfile(_pppdata->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); 615 fd = openLockfile(_pppdata->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT);
616 if(fd >= 0) { 616 if(fd >= 0) {
617 sprintf(newlock,"%010d\n", getpid()); 617 sprintf(newlock,"%010d\n", getpid());
618 qDebug("Locking Device: %s", newlock); 618 odebug << "Locking Device: " << newlock << "" << oendl;
619 619
620 write(fd, newlock, strlen(newlock)); 620 write(fd, newlock, strlen(newlock));
621 close(fd); 621 close(fd);
622 modem_is_locked=true; 622 modem_is_locked=true;
623 623
624 return 0; 624 return 0;
625 } 625 }
626 626
627 return -1; 627 return -1;
628 628
629} 629}
630 630
631 631
632// UnLock modem device 632// UnLock modem device
633void Modem::unlockdevice() { 633void Modem::unlockdevice() {
634 if (modem_is_locked) { 634 if (modem_is_locked) {
635 qDebug( "UnLocking Modem Device" ); 635 odebug << "UnLocking Modem Device" << oendl;
636 close(modemfd); 636 close(modemfd);
637 modemfd = -1; 637 modemfd = -1;
638 unlink(lockfile); 638 unlink(lockfile);
639 lockfile[0] = '\0'; 639 lockfile[0] = '\0';
640 modem_is_locked=false; 640 modem_is_locked=false;
641 } 641 }
642} 642}
643 643
644int Modem::openLockfile( QString lockfile, int flags) 644int Modem::openLockfile( QString lockfile, int flags)
645{ 645{
646 int fd; 646 int fd;
647 int mode; 647 int mode;
648 flags = O_RDONLY; 648 flags = O_RDONLY;
649 if(flags == O_WRONLY|O_TRUNC|O_CREAT) 649 if(flags == O_WRONLY|O_TRUNC|O_CREAT)
650 mode = 0644; 650 mode = 0644;
651 else 651 else
652 mode = 0; 652 mode = 0;
653 653
654 lockfile = LOCK_DIR; 654 lockfile = LOCK_DIR;
655 lockfile += "/LCK.."; 655 lockfile += "/LCK..";
656 lockfile += device.right( device.length() - device.findRev("/") -1 ); 656 lockfile += device.right( device.length() - device.findRev("/") -1 );
657 qDebug("lockfile >%s<",lockfile.latin1()); 657 odebug << "lockfile >" << lockfile.latin1() << "<" << oendl;
658 // TODO: 658 // TODO:
659 // struct stat st; 659 // struct stat st;
660 // if(stat(lockfile.data(), &st) == -1) { 660 // if(stat(lockfile.data(), &st) == -1) {
661 // if(errno == EBADF) 661 // if(errno == EBADF)
662 // return -1; 662 // return -1;
663 // } else { 663 // } else {
664 // // make sure that this is a regular file 664 // // make sure that this is a regular file
665 // if(!S_ISREG(st.st_mode)) 665 // if(!S_ISREG(st.st_mode))
666 // return -1; 666 // return -1;
667 // } 667 // }
668 if ((fd = open(lockfile, flags, mode)) == -1) { 668 if ((fd = open(lockfile, flags, mode)) == -1) {
669 qDebug("error opening lockfile!"); 669 odebug << "error opening lockfile!" << oendl;
670 lockfile = QString::null; 670 lockfile = QString::null;
671 fd = open(DEVNULL, O_RDONLY); 671 fd = open(DEVNULL, O_RDONLY);
672 } else 672 } else
673 fchown(fd, 0, 0); 673 fchown(fd, 0, 0);
674 return fd; 674 return fd;
675} 675}
676 676
677 677
678 678
679void alarm_handler(int) { 679void alarm_handler(int) {
680 // fprintf(stderr, "alarm_handler(): Received SIGALRM\n"); 680 // fprintf(stderr, "alarm_handler(): Received SIGALRM\n");
681 681
@@ -918,60 +918,60 @@ bool Modem::execpppd(const char *arguments) {
918 fprintf(stderr, "Kernel does not support ppp, oops.\n"); 918 fprintf(stderr, "Kernel does not support ppp, oops.\n");
919 break; 919 break;
920 case 0: 920 case 0:
921 fprintf(stderr, "Kernel supports ppp alright.\n"); 921 fprintf(stderr, "Kernel supports ppp alright.\n");
922 break; 922 break;
923 } 923 }
924 924
925 execve(pppdPath(), args, 0L); 925 execve(pppdPath(), args, 0L);
926 _exit(0); 926 _exit(0);
927 break; 927 break;
928 928
929 default: 929 default:
930 qDebug("In parent: pppd pid %d\n",pppdPid); 930 odebug << "In parent: pppd pid " << pppdPid << "\n" << oendl;
931 close(modemfd); 931 close(modemfd);
932 932
933 ::close( m_pppdLOG[1] ); 933 ::close( m_pppdLOG[1] );
934 // set it to nonblocking io 934 // set it to nonblocking io
935 int flag = ::fcntl( m_pppdLOG[0], F_GETFL ); 935 int flag = ::fcntl( m_pppdLOG[0], F_GETFL );
936 936
937 if ( !(flag & O_NONBLOCK) ) { 937 if ( !(flag & O_NONBLOCK) ) {
938 qDebug("Setting nonblocking io"); 938 odebug << "Setting nonblocking io" << oendl;
939 flag |= O_NONBLOCK; 939 flag |= O_NONBLOCK;
940 ::fcntl(m_pppdLOG[0], F_SETFL, flag ); 940 ::fcntl(m_pppdLOG[0], F_SETFL, flag );
941 } 941 }
942 942
943 delete m_modemDebug; 943 delete m_modemDebug;
944 m_modemDebug = new QSocketNotifier(m_pppdLOG[0], QSocketNotifier::Read, this ); 944 m_modemDebug = new QSocketNotifier(m_pppdLOG[0], QSocketNotifier::Read, this );
945 connect(m_modemDebug, SIGNAL(activated(int) ), 945 connect(m_modemDebug, SIGNAL(activated(int) ),
946 this, SLOT(slotModemDebug(int) ) ); 946 this, SLOT(slotModemDebug(int) ) );
947 947
948 modemfd = -1; 948 modemfd = -1;
949 m_pppdDev = QString::fromLatin1("ppp0"); 949 m_pppdDev = QString::fromLatin1("ppp0");
950 return true; 950 return true;
951 break; 951 break;
952 } 952 }
953} 953}
954 954
955 955
956bool Modem::killpppd() { 956bool Modem::killpppd() {
957 qDebug("In killpppd and pid is %d", pppdPid ); 957 odebug << "In killpppd and pid is " << pppdPid << "" << oendl;
958 if(pppdPid > 0) { 958 if(pppdPid > 0) {
959 delete m_modemDebug; 959 delete m_modemDebug;
960 m_modemDebug = 0; 960 m_modemDebug = 0;
961 qDebug("In killpppd(): Sending SIGTERM to %d\n", pppdPid); 961 odebug << "In killpppd(): Sending SIGTERM to " << pppdPid << "\n" << oendl;
962 if(kill(pppdPid, SIGTERM) < 0) { 962 if(kill(pppdPid, SIGTERM) < 0) {
963 qDebug("Error terminating %d. Sending SIGKILL\n", pppdPid); 963 odebug << "Error terminating " << pppdPid << ". Sending SIGKILL\n" << oendl;
964 if(kill(pppdPid, SIGKILL) < 0) { 964 if(kill(pppdPid, SIGKILL) < 0) {
965 qDebug("Error killing %d\n", pppdPid); 965 odebug << "Error killing " << pppdPid << "\n" << oendl;
966 return false; 966 return false;
967 } 967 }
968 } 968 }
969 } 969 }
970 return true; 970 return true;
971} 971}
972 972
973 973
974void Modem::parseargs(char* buf, char** args) { 974void Modem::parseargs(char* buf, char** args) {
975 int nargs = 0; 975 int nargs = 0;
976 int quotes; 976 int quotes;
977 977
@@ -1026,46 +1026,46 @@ void Modem::killPPPDaemon()
1026 killpppd(); 1026 killpppd();
1027} 1027}
1028 1028
1029int Modem::pppdExitStatus() 1029int Modem::pppdExitStatus()
1030{ 1030{
1031 return _pppdExitStatus; 1031 return _pppdExitStatus;
1032} 1032}
1033 1033
1034int Modem::openResolv(int flags) 1034int Modem::openResolv(int flags)
1035{ 1035{
1036 int fd; 1036 int fd;
1037 if ((fd = open(_PATH_RESCONF, flags)) == -1) { 1037 if ((fd = open(_PATH_RESCONF, flags)) == -1) {
1038 qDebug("error opening resolv.conf!"); 1038 odebug << "error opening resolv.conf!" << oendl;
1039 fd = open(DEVNULL, O_RDONLY); 1039 fd = open(DEVNULL, O_RDONLY);
1040 } 1040 }
1041 return fd; 1041 return fd;
1042} 1042}
1043 1043
1044bool Modem::setHostname(const QString & name) 1044bool Modem::setHostname(const QString & name)
1045{ 1045{
1046 return sethostname(name, name.length()) == 0; 1046 return sethostname(name, name.length()) == 0;
1047} 1047}
1048 1048
1049QString Modem::pppDevice()const { 1049QString Modem::pppDevice()const {
1050 return m_pppdDev; 1050 return m_pppdDev;
1051} 1051}
1052void Modem::setPPPDevice( const QString& dev ) { 1052void Modem::setPPPDevice( const QString& dev ) {
1053 m_pppdDev = dev; 1053 m_pppdDev = dev;
1054} 1054}
1055pid_t Modem::pppPID()const { 1055pid_t Modem::pppPID()const {
1056 return pppdPid; 1056 return pppdPid;
1057} 1057}
1058void Modem::setPPPDPid( pid_t pid ) { 1058void Modem::setPPPDPid( pid_t pid ) {
1059 qDebug("Modem setting pid"); 1059 odebug << "Modem setting pid" << oendl;
1060 _pppdExitStatus = -1; 1060 _pppdExitStatus = -1;
1061 pppdPid = pid; 1061 pppdPid = pid;
1062 modemfd = -1; 1062 modemfd = -1;
1063} 1063}
1064void Modem::slotModemDebug(int fd) { 1064void Modem::slotModemDebug(int fd) {
1065 char buf[2049]; 1065 char buf[2049];
1066 int len; 1066 int len;
1067 1067
1068 // read in pppd data look for Using interface 1068 // read in pppd data look for Using interface
1069 // then read the interface 1069 // then read the interface
1070 // we limit to 10 device now 0-9 1070 // we limit to 10 device now 0-9
1071 if((len = ::read(fd, buf, 2048)) > 0) { 1071 if((len = ::read(fd, buf, 2048)) > 0) {
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp
index 97baf31..a8c99fd 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.cpp
+++ b/noncore/settings/networksettings/ppp/pppconfig.cpp
@@ -16,28 +16,28 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent,
16 const char *name, 16 const char *name,
17 bool modal, WFlags fl ) 17 bool modal, WFlags fl )
18 : QDialog(parent, name, modal, fl) 18 : QDialog(parent, name, modal, fl)
19{ 19{
20 setCaption(tr("Configure Modem")); 20 setCaption(tr("Configure Modem"));
21 int result = runTests(); 21 int result = runTests();
22 if(result == TEST_CRITICAL){ 22 if(result == TEST_CRITICAL){
23 QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") ); 23 QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") );
24 return; 24 return;
25 } 25 }
26 26
27 interface = iface; 27 interface = iface;
28 qDebug("PPPConfigWidget::PPPConfigWidget"); 28 odebug << "PPPConfigWidget::PPPConfigWidget" << oendl;
29 qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1()); 29 odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl;
30 30
31 qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1()); 31 odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl;
32 32
33 33
34 QVBoxLayout *layout = new QVBoxLayout( this ); 34 QVBoxLayout *layout = new QVBoxLayout( this );
35 layout->setSpacing( 0 ); 35 layout->setSpacing( 0 );
36 layout->setMargin( 1 ); 36 layout->setMargin( 1 );
37 tabWindow = new QTabWidget( this, "tabWidget" ); 37 tabWindow = new QTabWidget( this, "tabWidget" );
38 layout->addWidget( tabWindow ); 38 layout->addWidget( tabWindow );
39 39
40 accounts = new AccountWidget( interface->data(), tabWindow, "accounts", Qt::WStyle_ContextHelp ); 40 accounts = new AccountWidget( interface->data(), tabWindow, "accounts", Qt::WStyle_ContextHelp );
41 tabWindow->addTab( accounts, tr("&Accounts") ); 41 tabWindow->addTab( accounts, tr("&Accounts") );
42 devices = new DevicesWidget( interface, tabWindow, "devices", Qt::WStyle_ContextHelp ); 42 devices = new DevicesWidget( interface, tabWindow, "devices", Qt::WStyle_ContextHelp );
43 tabWindow->addTab( devices, tr("&Devices") ); 43 tabWindow->addTab( devices, tr("&Devices") );
@@ -49,27 +49,27 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent,
49// tabWindow->addTab( modem2, tr("&Modem") ); 49// tabWindow->addTab( modem2, tr("&Modem") );
50 50
51} 51}
52 52
53 53
54PPPConfigWidget::~PPPConfigWidget() 54PPPConfigWidget::~PPPConfigWidget()
55{ 55{
56 56
57} 57}
58 58
59void PPPConfigWidget::accept() 59void PPPConfigWidget::accept()
60{ 60{
61 qDebug("PPPConfigWidget::accept"); 61 odebug << "PPPConfigWidget::accept" << oendl;
62 qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1()); 62 odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl;
63 qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1()); 63 odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl;
64 interface->setInterfaceName( interface->data()->devname() ); 64 interface->setInterfaceName( interface->data()->devname() );
65 interface->setHardwareName( interface->data()->accname() ); 65 interface->setHardwareName( interface->data()->accname() );
66 interface->save(); 66 interface->save();
67 QDialog::accept(); 67 QDialog::accept();
68} 68}
69 69
70 70
71void PPPConfigWidget::reject() 71void PPPConfigWidget::reject()
72{ 72{
73 interface->data()->cancel(); 73 interface->data()->cancel();
74 QDialog::reject(); 74 QDialog::reject();
75} 75}
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index f4727c1..567ccf8 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -47,26 +47,26 @@ PPPData::PPPData()
47 highcountdev(-1), // start out with no entries 47 highcountdev(-1), // start out with no entries
48// caccount(-1), // set the current account index also 48// caccount(-1), // set the current account index also
49 suidprocessid(-1), // process ID of setuid child 49 suidprocessid(-1), // process ID of setuid child
50 pppdisrunning(false), 50 pppdisrunning(false),
51 pppderror(0) 51 pppderror(0)
52{ 52{
53 highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; 53 highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1;
54 highcountdev = readNumConfig(GENERAL_GRP, NUMDEVICES_KEY, 0) - 1; 54 highcountdev = readNumConfig(GENERAL_GRP, NUMDEVICES_KEY, 0) - 1;
55 Config cfg = config(); 55 Config cfg = config();
56 cfg.setGroup(GENERAL_GRP); 56 cfg.setGroup(GENERAL_GRP);
57 accountList = cfg.readListEntry(ACCOUNT_LIST, ',' ); 57 accountList = cfg.readListEntry(ACCOUNT_LIST, ',' );
58 deviceList = cfg.readListEntry(DEVICESNAMES_LIST, ',' ); 58 deviceList = cfg.readListEntry(DEVICESNAMES_LIST, ',' );
59 qDebug("PPPData::PPPData has a accountList %s", accountList.join("---").latin1()); 59 odebug << "PPPData::PPPData has a accountList " << accountList.join("---").latin1() << "" << oendl;
60 qDebug("PPPData::PPPData has a deviceList %s", deviceList.join("---").latin1()); 60 odebug << "PPPData::PPPData has a deviceList " << deviceList.join("---").latin1() << "" << oendl;
61 61
62// if (highcount > MAX_ACCOUNTS) 62// if (highcount > MAX_ACCOUNTS)
63// highcount = MAX_ACCOUNTS; 63// highcount = MAX_ACCOUNTS;
64 64
65 // if(highcount >= 0 && defaultAccount().isEmpty()) { 65 // if(highcount >= 0 && defaultAccount().isEmpty()) {
66// setAccountbyIndex(0); 66// setAccountbyIndex(0);
67// setDefaultAccount(accname()); 67// setDefaultAccount(accname());
68// } else if(!setAccount(defaultAccount())) 68// } else if(!setAccount(defaultAccount()))
69 setDefaultAccount(accname()); 69 setDefaultAccount(accname());
70 70
71 // start out with internal debugging disabled 71 // start out with internal debugging disabled
72 // the user is still free to specify `debug' on his own 72 // the user is still free to specify `debug' on his own
@@ -77,81 +77,81 @@ PPPData::PPPData()
77} 77}
78 78
79Config PPPData::config() 79Config PPPData::config()
80{ 80{
81 return Config("NetworkSetupPPP"); 81 return Config("NetworkSetupPPP");
82} 82}
83 83
84// 84//
85// save configuration 85// save configuration
86// 86//
87void PPPData::save() 87void PPPData::save()
88{ 88{
89 qDebug("PPPData saving data"); 89 odebug << "PPPData saving data" << oendl;
90 writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); 90 writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count());
91 writeConfig(GENERAL_GRP, NUMDEVICES_KEY, highcountdev + 1); 91 writeConfig(GENERAL_GRP, NUMDEVICES_KEY, highcountdev + 1);
92 QString key; 92 QString key;
93 QStringList keys; 93 QStringList keys;
94 Config cfg = config(); 94 Config cfg = config();
95 cfg.setGroup(GENERAL_GRP); 95 cfg.setGroup(GENERAL_GRP);
96 cfg.writeEntry(ACCOUNT_LIST, accountList, ',' ); 96 cfg.writeEntry(ACCOUNT_LIST, accountList, ',' );
97 cfg.writeEntry(DEVICESNAMES_LIST, deviceList, ',' ); 97 cfg.writeEntry(DEVICESNAMES_LIST, deviceList, ',' );
98 98
99 for( QMap<QString,QString>::Iterator it = stringEntries.begin(); 99 for( QMap<QString,QString>::Iterator it = stringEntries.begin();
100 it != stringEntries.end(); ++it ){ 100 it != stringEntries.end(); ++it ){
101 QString val = it.data(); 101 QString val = it.data();
102 key = it.key(); 102 key = it.key();
103// qDebug("saving %s -> %s", key.latin1(), val.latin1() ); 103// odebug << "saving " << key.latin1() << " -> " << val.latin1() << "" << oendl;
104 keys = QStringList::split( "SEPARATOR", key ); 104 keys = QStringList::split( "SEPARATOR", key );
105 //qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); 105 //odebug << "group >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl;
106 cfg.setGroup(keys[0]); 106 cfg.setGroup(keys[0]);
107 cfg.writeEntry(keys[1], val); 107 cfg.writeEntry(keys[1], val);
108 } 108 }
109 for( QMap<QString,int>::Iterator it = intEntries.begin(); 109 for( QMap<QString,int>::Iterator it = intEntries.begin();
110 it != intEntries.end(); ++it ){ 110 it != intEntries.end(); ++it ){
111 int val = it.data(); 111 int val = it.data();
112 key = it.key(); 112 key = it.key();
113// qDebug("saving %s -> %i", key.latin1(), val ); 113// odebug << "saving " << key.latin1() << " -> " << val << "" << oendl;
114 keys = QStringList::split( "SEPARATOR", key ); 114 keys = QStringList::split( "SEPARATOR", key );
115 //qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val ); 115 //odebug << "group >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< val " << val << "" << oendl;
116 cfg.setGroup(keys[0]); 116 cfg.setGroup(keys[0]);
117 cfg.writeEntry(keys[1], val); 117 cfg.writeEntry(keys[1], val);
118 } 118 }
119 for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); 119 for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
120 it != listEntries.end(); ++it ){ 120 it != listEntries.end(); ++it ){
121 QStringList val = it.data(); 121 QStringList val = it.data();
122 key = it.key(); 122 key = it.key();
123 QChar sep = sepEntries[key]; 123 QChar sep = sepEntries[key];
124// qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() ); 124// odebug << "saving " << key.latin1() << " -> " << val.join(sep).latin1() << "" << oendl;
125 keys = QStringList::split( "SEPARATOR", key ); 125 keys = QStringList::split( "SEPARATOR", key );
126 cfg.setGroup(keys[0]); 126 cfg.setGroup(keys[0]);
127 cfg.writeEntry(keys[1], val, sep); 127 cfg.writeEntry(keys[1], val, sep);
128 } 128 }
129} 129}
130 130
131 131
132// 132//
133// cancel changes 133// cancel changes
134// 134//
135void PPPData::cancel() { 135void PPPData::cancel() {
136 stringEntries.clear(); 136 stringEntries.clear();
137 intEntries.clear(); 137 intEntries.clear();
138 listEntries.clear(); 138 listEntries.clear();
139} 139}
140 140
141// functions to read/write date to configuration file 141// functions to read/write date to configuration file
142QString PPPData::readConfig(const QString &group, const QString &key, 142QString PPPData::readConfig(const QString &group, const QString &key,
143 const QString &defvalue = "") 143 const QString &defvalue = "")
144{ 144{
145// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); 145// odebug << "PPPData::readConfig key >" << key.latin1() << "< group >" << group.latin1() << "<" << oendl;
146 QString idx = SEP.arg(group).arg(key); 146 QString idx = SEP.arg(group).arg(key);
147 if (stringEntries.find(idx) != stringEntries.end()) 147 if (stringEntries.find(idx) != stringEntries.end())
148 return stringEntries[idx]; 148 return stringEntries[idx];
149 Config cfg = config(); 149 Config cfg = config();
150 cfg.setGroup(group); 150 cfg.setGroup(group);
151 return cfg.readEntry(key, defvalue); 151 return cfg.readEntry(key, defvalue);
152} 152}
153 153
154 154
155int PPPData::readNumConfig(const QString &group, const QString &key, 155int PPPData::readNumConfig(const QString &group, const QString &key,
156 int defvalue) 156 int defvalue)
157{ 157{
@@ -356,39 +356,39 @@ void PPPData::setpppdTimeout(int n) {
356 356
357const QString PPPData::modemDevice() { 357const QString PPPData::modemDevice() {
358 return readConfig (modemGroup(), MODEMDEV_KEY, "/dev/modem" ); 358 return readConfig (modemGroup(), MODEMDEV_KEY, "/dev/modem" );
359} 359}
360 360
361 361
362// const QString PPPData::modemName() 362// const QString PPPData::modemName()
363// { 363// {
364// return readConfig(modemGroup(), MODEMNAME_KEY); 364// return readConfig(modemGroup(), MODEMNAME_KEY);
365// } 365// }
366 366
367// bool PPPData::setModemName(const QString &n) { 367// bool PPPData::setModemName(const QString &n) {
368// qDebug("Setting modem name to >%s<", n.latin1()); 368// odebug << "Setting modem name to >" << n.latin1() << "<" << oendl;
369// _modemName = n; 369// _modemName = n;
370// writeConfig(cgroup, MODEMNAME_KEY, n); 370// writeConfig(cgroup, MODEMNAME_KEY, n);
371// return true; //FIXME 371// return true; //FIXME
372// } 372// }
373 373
374// bool PPPData::changeModemName(const QString &n) { 374// bool PPPData::changeModemName(const QString &n) {
375// qDebug("Setting modem name to >%s<", n.latin1()); 375// odebug << "Setting modem name to >" << n.latin1() << "<" << oendl;
376// _modemName = n; 376// _modemName = n;
377// writeConfig(modemGroup(), MODEMNAME_KEY, n); 377// writeConfig(modemGroup(), MODEMNAME_KEY, n);
378// return true; //FIXME 378// return true; //FIXME
379// } 379// }
380 380
381bool PPPData::setModemDevice(const QString &n) { 381bool PPPData::setModemDevice(const QString &n) {
382 qDebug("Setting modem dev to >%s<", n.latin1()); 382 odebug << "Setting modem dev to >" << n.latin1() << "<" << oendl;
383 writeConfig(modemGroup(), MODEMDEV_KEY, n); 383 writeConfig(modemGroup(), MODEMDEV_KEY, n);
384 return true; //FIXME 384 return true; //FIXME
385} 385}
386 386
387 387
388const QString PPPData::flowcontrol() { 388const QString PPPData::flowcontrol() {
389 return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); 389 return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS");
390} 390}
391 391
392 392
393void PPPData::setFlowcontrol(const QString &n) { 393void PPPData::setFlowcontrol(const QString &n) {
394 writeConfig(modemGroup(), FLOWCONTROL_KEY, n); 394 writeConfig(modemGroup(), FLOWCONTROL_KEY, n);
@@ -730,80 +730,80 @@ void PPPData::setEnter(const QString &n) {
730 730
731// 731//
732// functions to set/return account information 732// functions to set/return account information
733// 733//
734 734
735//returns number of accounts 735//returns number of accounts
736int PPPData::count() const { 736int PPPData::count() const {
737 return highcount + 1; 737 return highcount + 1;
738} 738}
739 739
740 740
741bool PPPData::setAccount(const QString &aname) { 741bool PPPData::setAccount(const QString &aname) {
742 qDebug("setting account to >%s<", aname.latin1()); 742 odebug << "setting account to >" << aname.latin1() << "<" << oendl;
743 for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { 743 for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) {
744 cgroup = *it; 744 cgroup = *it;
745 qDebug("PPPData::setAccount %s", cgroup.latin1()); 745 odebug << "PPPData::setAccount " << cgroup.latin1() << "" << oendl;
746 qDebug( "iterator %s", (*it).latin1() ); 746 odebug << "iterator " << (*it).latin1() << "" << oendl;
747 if(accname() == aname) { 747 if(accname() == aname) {
748 qDebug("SUCCESS"); 748 odebug << "SUCCESS" << oendl;
749 return true; 749 return true;
750 } 750 }
751 751
752 } 752 }
753 qDebug("FAILURE"); 753 odebug << "FAILURE" << oendl;
754 return false; 754 return false;
755} 755}
756 756
757/* 757/*
758bool PPPData::setAccountbyIndex(int i) { 758bool PPPData::setAccountbyIndex(int i) {
759 if(i >= 0 && i <= highcount) { 759 if(i >= 0 && i <= highcount) {
760 QString tmp; 760 QString tmp;
761 tmp.sprintf("%s%i", ACCOUNT_GRP, i); 761 tmp.sprintf("%s%i", ACCOUNT_GRP, i);
762 if (_deleted.find(tmp)!=_deleted.end()) return false; 762 if (_deleted.find(tmp)!=_deleted.end()) return false;
763 caccount = i; 763 caccount = i;
764 cgroup = tmp; 764 cgroup = tmp;
765 return true; 765 return true;
766 } 766 }
767 return false; 767 return false;
768} 768}
769*/ 769*/
770 770
771bool PPPData::isUniqueAccname(const QString &n) { 771bool PPPData::isUniqueAccname(const QString &n) {
772 QString save_cgroup = cgroup; 772 QString save_cgroup = cgroup;
773 for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { 773 for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) {
774 cgroup = *it; 774 cgroup = *it;
775 qDebug("PPPData::setAccount %s", cgroup.latin1()); 775 odebug << "PPPData::setAccount " << cgroup.latin1() << "" << oendl;
776 qDebug( "%s \n", (*it).latin1() ); 776 odebug << "" << (*it).latin1() << " \n" << oendl;
777 if(accname() == n && cgroup != save_cgroup) { 777 if(accname() == n && cgroup != save_cgroup) {
778 cgroup = save_cgroup; 778 cgroup = save_cgroup;
779 qDebug("SUCCESS"); 779 odebug << "SUCCESS" << oendl;
780 return false; 780 return false;
781 } 781 }
782 782
783 } 783 }
784 cgroup = save_cgroup; 784 cgroup = save_cgroup;
785 return true; 785 return true;
786} 786}
787 787
788 788
789bool PPPData::isUniqueDevname(const QString &n) { 789bool PPPData::isUniqueDevname(const QString &n) {
790 QString save_mName = _modemName; 790 QString save_mName = _modemName;
791 qDebug("PPPData::isUniqueDevname checking if %s is unique", n.latin1()); 791 odebug << "PPPData::isUniqueDevname checking if " << n.latin1() << " is unique" << oendl;
792 for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { 792 for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) {
793 _modemName = *it; 793 _modemName = *it;
794 qDebug("PPPData::isUniqueDevname %s == %s", n.latin1() , devname().latin1()); 794 odebug << "PPPData::isUniqueDevname " << n.latin1() << " == " << devname().latin1() << "" << oendl;
795 if(devname() == n && _modemName != save_mName) { 795 if(devname() == n && _modemName != save_mName) {
796 _modemName = save_mName; 796 _modemName = save_mName;
797 qDebug("NOT UNIQUE"); 797 odebug << "NOT UNIQUE" << oendl;
798 return false; 798 return false;
799 } 799 }
800 800
801 } 801 }
802 _modemName = save_mName; 802 _modemName = save_mName;
803 return true; 803 return true;
804} 804}
805 805
806 806
807bool PPPData::deleteAccount() { 807bool PPPData::deleteAccount() {
808 // FIXME: check if this account exists in a config... 808 // FIXME: check if this account exists in a config...
809 Config cfg = PPPData::config(); 809 Config cfg = PPPData::config();
@@ -811,74 +811,74 @@ bool PPPData::deleteAccount() {
811 cfg.clearGroup(); 811 cfg.clearGroup();
812 accountList.remove(cgroup); 812 accountList.remove(cgroup);
813 813
814 QString key; 814 QString key;
815 QStringList keys; 815 QStringList keys;
816 for( QMap<QString,QString>::Iterator it = stringEntries.begin(); 816 for( QMap<QString,QString>::Iterator it = stringEntries.begin();
817 it != stringEntries.end(); ++it ){ 817 it != stringEntries.end(); ++it ){
818 QString val = it.data(); 818 QString val = it.data();
819 key = it.key(); 819 key = it.key();
820 keys = QStringList::split( "SEPARATOR", key ); 820 keys = QStringList::split( "SEPARATOR", key );
821 if(keys[0]==cgroup){ 821 if(keys[0]==cgroup){
822 stringEntries.remove( it ); 822 stringEntries.remove( it );
823 qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); 823 odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl;
824 } 824 }
825 } 825 }
826 for( QMap<QString,int>::Iterator it = intEntries.begin(); 826 for( QMap<QString,int>::Iterator it = intEntries.begin();
827 it != intEntries.end(); ++it ){ 827 it != intEntries.end(); ++it ){
828 int val = it.data(); 828 int val = it.data();
829 key = it.key(); 829 key = it.key();
830 keys = QStringList::split( "SEPARATOR", key ); 830 keys = QStringList::split( "SEPARATOR", key );
831 if(keys[0]==cgroup){ 831 if(keys[0]==cgroup){
832 intEntries.remove( it ); 832 intEntries.remove( it );
833 qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val ); 833 odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val << "<" << oendl;
834 } 834 }
835 } 835 }
836 for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); 836 for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
837 it != listEntries.end(); ++it ){ 837 it != listEntries.end(); ++it ){
838 QStringList val = it.data(); 838 QStringList val = it.data();
839 key = it.key(); 839 key = it.key();
840 if(keys[0]==cgroup){ 840 if(keys[0]==cgroup){
841 listEntries.remove( it ); 841 listEntries.remove( it );
842 sepEntries.remove( key ); 842 sepEntries.remove( key );
843 qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() ); 843 odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.join("").latin1() << "<" << oendl;
844 } 844 }
845 } 845 }
846 846
847 return true; 847 return true;
848} 848}
849 849
850 850
851bool PPPData::deleteAccount(const QString &aname) { 851bool PPPData::deleteAccount(const QString &aname) {
852 if(!setAccount(aname)) 852 if(!setAccount(aname))
853 return false; 853 return false;
854 854
855 deleteAccount(); 855 deleteAccount();
856 856
857 return true; 857 return true;
858} 858}
859 859
860 860
861int PPPData::newaccount() { 861int PPPData::newaccount() {
862 862
863 qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); 863 odebug << "PPPData::newaccount highcount " << highcount << "/" << MAX_ACCOUNTS << "" << oendl;
864// if(!config) open(); 864// if(!config) open();
865// if (highcount >= MAX_ACCOUNTS) return -1; 865// if (highcount >= MAX_ACCOUNTS) return -1;
866 866
867 867
868 QString tmp; 868 QString tmp;
869 tmp.sprintf("%s%i", ACCOUNT_GRP, ++highcount); 869 tmp.sprintf("%s%i", ACCOUNT_GRP, ++highcount);
870 cgroup = QString(tmp); 870 cgroup = QString(tmp);
871 accountList << tmp; 871 accountList << tmp;
872 qDebug("PPPData::newaccount() Group: >%s<",cgroup.latin1()); 872 odebug << "PPPData::newaccount() Group: >" << cgroup.latin1() << "<" << oendl;
873 setpppdArgumentDefaults(); 873 setpppdArgumentDefaults();
874 return highcount; 874 return highcount;
875} 875}
876 876
877int PPPData::copyaccount(const QString&) { 877int PPPData::copyaccount(const QString&) {
878// FIXME: PPPData::copyaccount 878// FIXME: PPPData::copyaccount
879// if(highcount >= MAX_ACCOUNTS) 879// if(highcount >= MAX_ACCOUNTS)
880 return -1; 880 return -1;
881 881
882// setAccountbyIndex(i); 882// setAccountbyIndex(i);
883 883
884// QMap <QString, QString> map = config->entryMap(cgroup); 884// QMap <QString, QString> map = config->entryMap(cgroup);
@@ -956,27 +956,27 @@ void PPPData::setAuthMethod(int value) {
956 956
957const QString PPPData::storedUsername() { 957const QString PPPData::storedUsername() {
958 return readConfig(cgroup, STORED_USERNAME_KEY, ""); 958 return readConfig(cgroup, STORED_USERNAME_KEY, "");
959} 959}
960 960
961 961
962void PPPData::setStoredUsername(const QString &b) { 962void PPPData::setStoredUsername(const QString &b) {
963 writeConfig(cgroup, STORED_USERNAME_KEY, b); 963 writeConfig(cgroup, STORED_USERNAME_KEY, b);
964} 964}
965 965
966 966
967const QString PPPData::storedPassword() { 967const QString PPPData::storedPassword() {
968 qDebug("getting stored pw"); 968 odebug << "getting stored pw" << oendl;
969 qDebug("g %s", cgroup.latin1() ); 969 odebug << "g " << cgroup.latin1() << "" << oendl;
970 qDebug("k %s", STORED_PASSWORD_KEY); 970 odebug << "k " << STORED_PASSWORD_KEY << "" << oendl;
971 return readConfig(cgroup, STORED_PASSWORD_KEY, ""); 971 return readConfig(cgroup, STORED_PASSWORD_KEY, "");
972} 972}
973 973
974 974
975void PPPData::setStoredPassword(const QString &b) { 975void PPPData::setStoredPassword(const QString &b) {
976 writeConfig(cgroup, STORED_PASSWORD_KEY, b); 976 writeConfig(cgroup, STORED_PASSWORD_KEY, b);
977} 977}
978 978
979 979
980bool PPPData::storePassword() { 980bool PPPData::storePassword() {
981 return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); 981 return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1);
982} 982}
@@ -1320,28 +1320,28 @@ QMap<QString,QString> PPPData::getConfiguredInterfaces()
1320 return ifaces; 1320 return ifaces;
1321} 1321}
1322 1322
1323void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) 1323void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
1324{ 1324{
1325 QMap<QString,QString>::Iterator it; 1325 QMap<QString,QString>::Iterator it;
1326 int i = 0; 1326 int i = 0;
1327 Config cfg = config(); 1327 Config cfg = config();
1328 for( it = ifaces.begin(); it != ifaces.end(); ++it ){ 1328 for( it = ifaces.begin(); it != ifaces.end(); ++it ){
1329 cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++)); 1329 cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++));
1330 cfg.writeEntry( ACOUNTS_DEV, it.key() ); 1330 cfg.writeEntry( ACOUNTS_DEV, it.key() );
1331 cfg.writeEntry( ACOUNTS_ACC, it.data() ); 1331 cfg.writeEntry( ACOUNTS_ACC, it.data() );
1332 qDebug("I %i",i); 1332 odebug << "I " << i << "" << oendl;
1333 } 1333 }
1334 cfg.setGroup( ACCLIST_GRP ); 1334 cfg.setGroup( ACCLIST_GRP );
1335 qDebug("saved %i account settings", i); 1335 odebug << "saved " << i << " account settings" << oendl;
1336 cfg.writeEntry( ACCOUNTS_COUNT, i ); 1336 cfg.writeEntry( ACCOUNTS_COUNT, i );
1337 1337
1338} 1338}
1339 1339
1340/** 1340/**
1341 * pppd's getword() function knows about escape characters. 1341 * pppd's getword() function knows about escape characters.
1342 * If we write the username and password to the secrets file 1342 * If we write the username and password to the secrets file
1343 * we'll therefore have to escape back slashes. 1343 * we'll therefore have to escape back slashes.
1344 */ 1344 */
1345QString PPPData::encodeWord(const QString &s) { 1345QString PPPData::encodeWord(const QString &s) {
1346 QString r = s; 1346 QString r = s;
1347 r.replace(QRegExp("\\"), "\\\\"); 1347 r.replace(QRegExp("\\"), "\\\\");
@@ -1363,133 +1363,133 @@ QStringList PPPData::getAccountList()
1363 for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { 1363 for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) {
1364 cgroup = *it; 1364 cgroup = *it;
1365 list << accname(); 1365 list << accname();
1366 } 1366 }
1367 cgroup = save_cgroup; 1367 cgroup = save_cgroup;
1368 return list; 1368 return list;
1369}; 1369};
1370 1370
1371 1371
1372const QString PPPData::devname() 1372const QString PPPData::devname()
1373{ 1373{
1374 QString tmp = readConfig(modemGroup(), MODEMNAME_KEY ); 1374 QString tmp = readConfig(modemGroup(), MODEMNAME_KEY );
1375 qDebug("PPPData::devname() of %s is %s", modemGroup().latin1(), tmp.latin1()); 1375 odebug << "PPPData::devname() of " << modemGroup().latin1() << " is " << tmp.latin1() << "" << oendl;
1376 return tmp; 1376 return tmp;
1377} 1377}
1378 1378
1379void PPPData::setDevname(const QString &n) { 1379void PPPData::setDevname(const QString &n) {
1380 // if(!cgroup.isNull()) { 1380 // if(!cgroup.isNull()) {
1381// // are we manipulating the default account's name ? then change it, too. 1381// // are we manipulating the default account's name ? then change it, too.
1382// bool def = accname() == defaultAccount(); 1382// bool def = accname() == defaultAccount();
1383// writeConfig(cgroup, NAME_KEY, n); 1383// writeConfig(cgroup, NAME_KEY, n);
1384// if (def) 1384// if (def)
1385// setDefaultAccount(n); 1385// setDefaultAccount(n);
1386// } 1386// }
1387 writeConfig(modemGroup(), MODEMNAME_KEY, n ); 1387 writeConfig(modemGroup(), MODEMNAME_KEY, n );
1388} 1388}
1389 1389
1390 1390
1391bool PPPData::setDevice(const QString &dev ) 1391bool PPPData::setDevice(const QString &dev )
1392{ 1392{
1393 qDebug("setting device to >%s<", dev.latin1()); 1393 odebug << "setting device to >" << dev.latin1() << "<" << oendl;
1394 QString save_mName = _modemName; 1394 QString save_mName = _modemName;
1395 for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { 1395 for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) {
1396 _modemName = *it; 1396 _modemName = *it;
1397 qDebug("PPPData::setDevice %s is named %s", _modemName.latin1(), devname().latin1() ); 1397 odebug << "PPPData::setDevice " << _modemName.latin1() << " is named " << devname().latin1() << "" << oendl;
1398 qDebug( "iterator %s", (*it).latin1() ); 1398 odebug << "iterator " << (*it).latin1() << "" << oendl;
1399 if(devname() == dev) { 1399 if(devname() == dev) {
1400 qDebug("SUCCESS"); 1400 odebug << "SUCCESS" << oendl;
1401 return true; 1401 return true;
1402 } 1402 }
1403 1403
1404 } 1404 }
1405 _modemName = save_mName; 1405 _modemName = save_mName;
1406 qDebug("FAILURE"); 1406 odebug << "FAILURE" << oendl;
1407 return false; 1407 return false;
1408} 1408}
1409 1409
1410bool PPPData::deleteDevice() 1410bool PPPData::deleteDevice()
1411{ 1411{
1412 // FIXME: check if this account exists in a config... 1412 // FIXME: check if this account exists in a config...
1413 Config cfg = PPPData::config(); 1413 Config cfg = PPPData::config();
1414 cfg.setGroup(modemGroup()); 1414 cfg.setGroup(modemGroup());
1415 cfg.clearGroup(); 1415 cfg.clearGroup();
1416 deviceList.remove(modemGroup()); 1416 deviceList.remove(modemGroup());
1417 1417
1418 QString key; 1418 QString key;
1419 QStringList keys; 1419 QStringList keys;
1420 for( QMap<QString,QString>::Iterator it = stringEntries.begin(); 1420 for( QMap<QString,QString>::Iterator it = stringEntries.begin();
1421 it != stringEntries.end(); ++it ){ 1421 it != stringEntries.end(); ++it ){
1422 QString val = it.data(); 1422 QString val = it.data();
1423 key = it.key(); 1423 key = it.key();
1424 keys = QStringList::split( "SEPARATOR", key ); 1424 keys = QStringList::split( "SEPARATOR", key );
1425 if(keys[0]==modemGroup()){ 1425 if(keys[0]==modemGroup()){
1426 stringEntries.remove( it ); 1426 stringEntries.remove( it );
1427 qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); 1427 odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl;
1428 } 1428 }
1429 } 1429 }
1430 for( QMap<QString,int>::Iterator it = intEntries.begin(); 1430 for( QMap<QString,int>::Iterator it = intEntries.begin();
1431 it != intEntries.end(); ++it ){ 1431 it != intEntries.end(); ++it ){
1432 int val = it.data(); 1432 int val = it.data();
1433 key = it.key(); 1433 key = it.key();
1434 keys = QStringList::split( "SEPARATOR", key ); 1434 keys = QStringList::split( "SEPARATOR", key );
1435 if(keys[0]==modemGroup()){ 1435 if(keys[0]==modemGroup()){
1436 intEntries.remove( it ); 1436 intEntries.remove( it );
1437 qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val ); 1437 odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val << "<" << oendl;
1438 } 1438 }
1439 } 1439 }
1440 for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); 1440 for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
1441 it != listEntries.end(); ++it ){ 1441 it != listEntries.end(); ++it ){
1442 QStringList val = it.data(); 1442 QStringList val = it.data();
1443 key = it.key(); 1443 key = it.key();
1444 if(keys[0]==modemGroup()){ 1444 if(keys[0]==modemGroup()){
1445 listEntries.remove( it ); 1445 listEntries.remove( it );
1446 sepEntries.remove( key ); 1446 sepEntries.remove( key );
1447 qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() ); 1447 odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.join("").latin1() << "<" << oendl;
1448 } 1448 }
1449 } 1449 }
1450 1450
1451 return true; 1451 return true;
1452 1452
1453} 1453}
1454 1454
1455bool PPPData::deleteDevice(const QString &dev) 1455bool PPPData::deleteDevice(const QString &dev)
1456{ 1456{
1457 if(!setDevice(dev)) 1457 if(!setDevice(dev))
1458 return false; 1458 return false;
1459 1459
1460 return deleteDevice(); 1460 return deleteDevice();
1461} 1461}
1462 1462
1463int PPPData::newdevice() 1463int PPPData::newdevice()
1464{ 1464{
1465 1465
1466 qDebug("PPPData::newdevice highcount %i",highcountdev); 1466 odebug << "PPPData::newdevice highcount " << highcountdev << "" << oendl;
1467 1467
1468 1468
1469 QString tmp; 1469 QString tmp;
1470 tmp.sprintf("%s%i", MODEM_GRP, ++highcountdev); 1470 tmp.sprintf("%s%i", MODEM_GRP, ++highcountdev);
1471 _modemName = QString(tmp); 1471 _modemName = QString(tmp);
1472 deviceList << tmp; 1472 deviceList << tmp;
1473 qDebug("PPPData::newdevice() Group: >%s<",cgroup.latin1()); 1473 odebug << "PPPData::newdevice() Group: >" << cgroup.latin1() << "<" << oendl;
1474 return highcountdev; 1474 return highcountdev;
1475} 1475}
1476 1476
1477int PPPData::copydevice(const QString&) 1477int PPPData::copydevice(const QString&)
1478{ 1478{
1479 return false; 1479 return false;
1480} 1480}
1481 1481
1482 1482
1483QStringList PPPData::getDevicesNamesList() 1483QStringList PPPData::getDevicesNamesList()
1484{ 1484{
1485 QStringList list; 1485 QStringList list;
1486 QString save_mName = _modemName; 1486 QString save_mName = _modemName;
1487 qDebug("PPPData::getDevicesNamesList has %s", deviceList.join("---").latin1()); 1487 odebug << "PPPData::getDevicesNamesList has " << deviceList.join("---").latin1() << "" << oendl;
1488 for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { 1488 for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) {
1489 _modemName = *it; 1489 _modemName = *it;
1490 qDebug("PPPData::getDevicesNamesList adding %s as %s",_modemName.latin1(), devname().latin1()); 1490 odebug << "PPPData::getDevicesNamesList adding " << _modemName.latin1() << " as " << devname().latin1() << "" << oendl;
1491 list << devname(); 1491 list << devname();
1492 } 1492 }
1493 _modemName = save_mName; 1493 _modemName = save_mName;
1494 return list; 1494 return list;
1495}; 1495};
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index a7caffe..2291e8a 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -51,62 +51,62 @@ namespace
51 * an interface was up while closing the application 51 * an interface was up while closing the application
52 * we need to be able to shut it down... 52 * we need to be able to shut it down...
53 */ 53 */
54PPPModule::PPPModule() : Module() 54PPPModule::PPPModule() : Module()
55{ 55{
56 InterfaceKeeper inFace; 56 InterfaceKeeper inFace;
57 QMap<QString,Connection> running = inFace.interfaces(); 57 QMap<QString,Connection> running = inFace.interfaces();
58 QStringList handledInterfaceNames; 58 QStringList handledInterfaceNames;
59 59
60 QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); 60 QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces();
61 QMap<QString,QString>::Iterator it; 61 QMap<QString,QString>::Iterator it;
62 InterfacePPP *iface; 62 InterfacePPP *iface;
63 qDebug("getting interfaces"); 63 odebug << "getting interfaces" << oendl;
64 for( it = ifaces.begin(); it != ifaces.end(); ++it ) 64 for( it = ifaces.begin(); it != ifaces.end(); ++it )
65 { 65 {
66 qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() ); 66 odebug << "ifaces " << it.key().latin1() << " " << it.data().latin1() << "" << oendl;
67 iface = new InterfacePPP( 0, it.key() ); 67 iface = new InterfacePPP( 0, it.key() );
68 iface->setHardwareName( it.data() ); 68 iface->setHardwareName( it.data() );
69 list.append( (Interface*)iface ); 69 list.append( (Interface*)iface );
70 70
71 // check if (*it) is one of the running ifaces 71 // check if (*it) is one of the running ifaces
72 if ( running.contains( it.data() ) ) 72 if ( running.contains( it.data() ) )
73 { 73 {
74 qDebug("iface is running %s", it.key().latin1() ); 74 odebug << "iface is running " << it.key().latin1() << "" << oendl;
75 handledInterfaceNames << running[it.data()].device; 75 handledInterfaceNames << running[it.data()].device;
76 iface->setStatus( true ); 76 iface->setStatus( true );
77 iface->setPPPDpid( running[it.data()].pid ); 77 iface->setPPPDpid( running[it.data()].pid );
78 iface->modem()->setPPPDevice( running[it.data()].device ); 78 iface->modem()->setPPPDevice( running[it.data()].device );
79 iface->refresh(); 79 iface->refresh();
80 } 80 }
81 } 81 }
82 82
83 setHandledInterfaceNames( handledInterfaceNames ); 83 setHandledInterfaceNames( handledInterfaceNames );
84} 84}
85 85
86/** 86/**
87 * Delete any interfaces that we own. 87 * Delete any interfaces that we own.
88 */ 88 */
89PPPModule::~PPPModule() 89PPPModule::~PPPModule()
90{ 90{
91 qDebug("PPPModule::~PPPModule() " ); 91 odebug << "PPPModule::~PPPModule() " << oendl;
92 QMap<QString,QString> ifaces; 92 QMap<QString,QString> ifaces;
93 InterfaceKeeper keeper; 93 InterfaceKeeper keeper;
94 Interface *i; 94 Interface *i;
95 for ( i=list.first(); i != 0; i=list.next() ) 95 for ( i=list.first(); i != 0; i=list.next() )
96 { 96 {
97 /* if online save the state */ 97 /* if online save the state */
98 if ( i->getStatus() ) 98 if ( i->getStatus() )
99 { 99 {
100 qDebug("Iface %s is still up", i->getHardwareName().latin1() ); 100 odebug << "Iface " << i->getHardwareName().latin1() << " is still up" << oendl;
101 InterfacePPP* ppp = static_cast<InterfacePPP*>(i); 101 InterfacePPP* ppp = static_cast<InterfacePPP*>(i);
102 keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); 102 keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() );
103 } 103 }
104 ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); 104 ifaces.insert( i->getInterfaceName(), i->getHardwareName() );
105 delete i; 105 delete i;
106 } 106 }
107 PPPData::setConfiguredInterfaces( ifaces ); 107 PPPData::setConfiguredInterfaces( ifaces );
108} 108}
109 109
110/** 110/**
111 * Change the current profile 111 * Change the current profile
112 */ 112 */
@@ -132,25 +132,25 @@ QString PPPModule::getPixmapName(Interface* )
132 */ 132 */
133bool PPPModule::isOwner(Interface *i) 133bool PPPModule::isOwner(Interface *i)
134{ 134{
135 return list.find( i ) != -1; 135 return list.find( i ) != -1;
136} 136}
137 137
138/** 138/**
139 * Create, and return the WLANConfigure Module 139 * Create, and return the WLANConfigure Module
140 * @return QWidget* pointer to this modules configure. 140 * @return QWidget* pointer to this modules configure.
141 */ 141 */
142QWidget *PPPModule::configure(Interface *i) 142QWidget *PPPModule::configure(Interface *i)
143{ 143{
144 qDebug("return ModemWidget"); 144 odebug << "return ModemWidget" << oendl;
145 PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, 145 PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i,
146 0, "PPPConfig", false, 146 0, "PPPConfig", false,
147 (Qt::WDestructiveClose | Qt::WStyle_ContextHelp)); 147 (Qt::WDestructiveClose | Qt::WStyle_ContextHelp));
148 return pppconfig; 148 return pppconfig;
149} 149}
150 150
151/** 151/**
152 * Create, and return the Information Module 152 * Create, and return the Information Module
153 * @return QWidget* pointer to this modules info. 153 * @return QWidget* pointer to this modules info.
154 */ 154 */
155QWidget *PPPModule::information(Interface *i) 155QWidget *PPPModule::information(Interface *i)
156{ 156{
@@ -159,25 +159,25 @@ QWidget *PPPModule::information(Interface *i)
159 159
160 return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); 160 return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i );
161} 161}
162 162
163/** 163/**
164 * Get all active (up or down) interfaces 164 * Get all active (up or down) interfaces
165 * @return QList<Interface> A list of interfaces that exsist that havn't 165 * @return QList<Interface> A list of interfaces that exsist that havn't
166 * been called by isOwner() 166 * been called by isOwner()
167 */ 167 */
168QList<Interface> PPPModule::getInterfaces() 168QList<Interface> PPPModule::getInterfaces()
169{ 169{
170 // List all of the files in the peer directory 170 // List all of the files in the peer directory
171 qDebug("PPPModule::getInterfaces"); 171 odebug << "PPPModule::getInterfaces" << oendl;
172 return list; 172 return list;
173} 173}
174 174
175/** 175/**
176 * Attempt to add a new interface as defined by name 176 * Attempt to add a new interface as defined by name
177 * @param name the name of the type of interface that should be created given 177 * @param name the name of the type of interface that should be created given
178 * by possibleNewInterfaces(); 178 * by possibleNewInterfaces();
179 * @return Interface* NULL if it was unable to be created. 179 * @return Interface* NULL if it was unable to be created.
180 */ 180 */
181Interface *PPPModule::addNewInterface(const QString &newInterface) 181Interface *PPPModule::addNewInterface(const QString &newInterface)
182{ 182{
183 183
@@ -252,32 +252,32 @@ namespace
252 QMap<QString, Connection> InterfaceKeeper::interfaces()const 252 QMap<QString, Connection> InterfaceKeeper::interfaces()const
253 { 253 {
254 Config cfg("ppp_plugin_keeper"); 254 Config cfg("ppp_plugin_keeper");
255 QMap<QString, Connection> ifaces; 255 QMap<QString, Connection> ifaces;
256 QStringList lst = cfg.groupList(); 256 QStringList lst = cfg.groupList();
257 for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) 257 for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it )
258 { 258 {
259 Connection con; 259 Connection con;
260 cfg.setGroup( (*it) ); 260 cfg.setGroup( (*it) );
261 con.name = (*it); 261 con.name = (*it);
262 con.pid = cfg.readNumEntry("pid"); 262 con.pid = cfg.readNumEntry("pid");
263 con.device = cfg.readEntry("device"); 263 con.device = cfg.readEntry("device");
264 qDebug(" %s %s %d", con.name.latin1(), con.device.latin1(), con.pid ); 264 odebug << " " << con.name.latin1() << " " << con.device.latin1() << " " << con.pid << "" << oendl;
265 265
266 if ( con.pid != -1 && isAvailable( con.pid ) ) 266 if ( con.pid != -1 && isAvailable( con.pid ) )
267 ifaces.insert( con.name, con ); 267 ifaces.insert( con.name, con );
268 } 268 }
269 return ifaces; 269 return ifaces;
270 } 270 }
271 bool InterfaceKeeper::isAvailable( pid_t p)const 271 bool InterfaceKeeper::isAvailable( pid_t p)const
272 { 272 {
273 if (::kill(p, 0 ) == 0 || errno != ESRCH ) 273 if (::kill(p, 0 ) == 0 || errno != ESRCH )
274 { 274 {
275 qDebug("isAvailable %d", p); 275 odebug << "isAvailable " << p << "" << oendl;
276 return true; 276 return true;
277 } 277 }
278 278
279 qDebug("notAvailable %d", p); 279 odebug << "notAvailable " << p << "" << oendl;
280 return false; 280 return false;
281 } 281 }
282 282
283} 283}
diff --git a/noncore/settings/networksettings/wlan/infoimp.cpp b/noncore/settings/networksettings/wlan/infoimp.cpp
index bd56678..c558f5e 100644
--- a/noncore/settings/networksettings/wlan/infoimp.cpp
+++ b/noncore/settings/networksettings/wlan/infoimp.cpp
@@ -4,40 +4,40 @@
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qprogressbar.h> 5#include <qprogressbar.h>
6#include <qlabel.h> 6#include <qlabel.h>
7 7
8/** 8/**
9 * Constructor. If wireless extensions are enabled on device name then 9 * Constructor. If wireless extensions are enabled on device name then
10 * start a timer that every second will update the information. 10 * start a timer that every second will update the information.
11 */ 11 */
12WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ 12WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){
13 WExtensions *wExtensions = new WExtensions(name); 13 WExtensions *wExtensions = new WExtensions(name);
14 if(!wExtensions->doesHaveWirelessExtensions()){ 14 if(!wExtensions->doesHaveWirelessExtensions()){
15 delete wExtensions; 15 delete wExtensions;
16 qDebug("WlanInfoImp::No wireless extension"); 16 odebug << "WlanInfoImp::No wireless extension" << oendl;
17 return; 17 return;
18 } 18 }
19 delete wExtensions; 19 delete wExtensions;
20 timer = new QTimer( this ); 20 timer = new QTimer( this );
21 connect( timer, SIGNAL(timeout()), this, SLOT(update())); 21 connect( timer, SIGNAL(timeout()), this, SLOT(update()));
22 timer->start( 1000, false ); 22 timer->start( 1000, false );
23} 23}
24 24
25/** 25/**
26 * Updates the information about the wireless device. 26 * Updates the information about the wireless device.
27 */ 27 */
28void WlanInfoImp::update(){ 28void WlanInfoImp::update(){
29 WExtensions *wExtensions = new WExtensions(this->name()); 29 WExtensions *wExtensions = new WExtensions(this->name());
30 if(!wExtensions->doesHaveWirelessExtensions()){ 30 if(!wExtensions->doesHaveWirelessExtensions()){
31 qDebug("No extension"); 31 odebug << "No extension" << oendl;
32 delete wExtensions; 32 delete wExtensions;
33 timer->stop(); 33 timer->stop();
34 return; 34 return;
35 } 35 }
36 essidLabel->setText(wExtensions->essid()); 36 essidLabel->setText(wExtensions->essid());
37 apLabel->setText(wExtensions->ap()); 37 apLabel->setText(wExtensions->ap());
38 stationLabel->setText(wExtensions->station()); 38 stationLabel->setText(wExtensions->station());
39 modeLabel->setText(wExtensions->mode()); 39 modeLabel->setText(wExtensions->mode());
40 channelLabel->setText(QString("%1").arg(wExtensions->channel())); 40 channelLabel->setText(QString("%1").arg(wExtensions->channel()));
41 int signal = 0; 41 int signal = 0;
42 int noise = 0; 42 int noise = 0;
43 int quality = 0; 43 int quality = 0;
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp
index d1fff88..9c64323 100644
--- a/noncore/settings/networksettings/wlan/wextensions.cpp
+++ b/noncore/settings/networksettings/wlan/wextensions.cpp
@@ -103,25 +103,25 @@ int WExtensions::channel(){
103 103
104 // http://www.elanix.com/pdf/an137e.pdf 104 // http://www.elanix.com/pdf/an137e.pdf
105 105
106 double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); 106 double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000);
107 double left = 2.401; 107 double left = 2.401;
108 double right = 2.416; 108 double right = 2.416;
109 for(int channel = 1; channel<= 15; channel++){ 109 for(int channel = 1; channel<= 15; channel++){
110 if( num >= left && num <= right ) 110 if( num >= left && num <= right )
111 return channel; 111 return channel;
112 left += 0.005; 112 left += 0.005;
113 right += 0.005; 113 right += 0.005;
114 } 114 }
115 qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); 115 odebug << QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1() << oendl;
116 return -1; 116 return -1;
117} 117}
118 118
119/*** 119/***
120 * Get the current rate that the card is transmiting at. 120 * Get the current rate that the card is transmiting at.
121 * @return double the rate, 0 if error. 121 * @return double the rate, 0 if error.
122 */ 122 */
123double WExtensions::rate(){ 123double WExtensions::rate(){
124 if(!hasWirelessExtensions) 124 if(!hasWirelessExtensions)
125 return 0; 125 return 0;
126 if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ 126 if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){
127 return ((double)iwr.u.bitrate.value)/1000000; 127 return ((double)iwr.u.bitrate.value)/1000000;
@@ -168,33 +168,33 @@ bool WExtensions::stats(int &signal, int &noise, int &quality){
168 168
169 QFile wfile( PROCNETWIRELESS ); 169 QFile wfile( PROCNETWIRELESS );
170 if(!wfile.open( IO_ReadOnly )) 170 if(!wfile.open( IO_ReadOnly ))
171 return false; 171 return false;
172 172
173 QTextStream wstream( &wfile ); 173 QTextStream wstream( &wfile );
174 wstream.readLine(); // skip the first two lines 174 wstream.readLine(); // skip the first two lines
175 wstream.readLine(); // because they only contain headers 175 wstream.readLine(); // because they only contain headers
176 while(!wstream.atEnd()){ 176 while(!wstream.atEnd()){
177 wstream >> name >> status >> quality >> c >> signal >> c >> noise; 177 wstream >> name >> status >> quality >> c >> signal >> c >> noise;
178 if(name == QString("%1:").arg(interface)){ 178 if(name == QString("%1:").arg(interface)){
179 if ( quality > 92 ) 179 if ( quality > 92 )
180 qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); 180 odebug << "WIFIAPPLET: D'oh! Quality " << quality << " > estimated max!\n" << oendl;
181 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) 181 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
182 qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); 182 odebug << "WIFIAPPLET: Doh! Strength " << signal << " > estimated max!\n" << oendl;
183 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) 183 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
184 qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); 184 odebug << "WIFIAPPLET: Doh! Noise " << noise << " > estimated max!\n" << oendl;
185 //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); 185 //odebug << QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1() << oendl;
186 signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; 186 signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER;
187 noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; 187 noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER;
188 quality = ( quality*100 ) / 92; 188 quality = ( quality*100 ) / 92;
189 return true; 189 return true;
190 } 190 }
191 } 191 }
192 192
193 qDebug("WExtensions::statsCard no longer present."); 193 odebug << "WExtensions::statsCard no longer present." << oendl;
194 quality = -1; 194 quality = -1;
195 signal = IW_LOWER; 195 signal = IW_LOWER;
196 noise = IW_LOWER; 196 noise = IW_LOWER;
197 return false; 197 return false;
198} 198}
199 199
200// wextensions.cpp 200// wextensions.cpp
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp
index 80a9927..fe7941d 100644
--- a/noncore/settings/networksettings/wlan/wlanimp.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp.cpp
@@ -36,25 +36,25 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W
36 if (file.open(IO_ReadOnly)){ 36 if (file.open(IO_ReadOnly)){
37 QTextStream stream( &file ); 37 QTextStream stream( &file );
38 QString line = ""; 38 QString line = "";
39 while ( !stream.eof() ) { 39 while ( !stream.eof() ) {
40 line += stream.readLine(); 40 line += stream.readLine();
41 line += "\n"; 41 line += "\n";
42 } 42 }
43 file.close(); 43 file.close();
44 settingsFileText = QStringList::split("\n", line, true); 44 settingsFileText = QStringList::split("\n", line, true);
45 parseSettingFile(); 45 parseSettingFile();
46 } 46 }
47 else 47 else
48 qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); 48 odebug << QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1() << oendl;
49 connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); 49 connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
50} 50}
51 51
52void WLANImp::typeChanged(int mod){ 52void WLANImp::typeChanged(int mod){
53 networkChannel->setEnabled(mod); 53 networkChannel->setEnabled(mod);
54 channelLabel->setEnabled(mod); 54 channelLabel->setEnabled(mod);
55} 55}
56 56
57/** 57/**
58 * Change the profile for both wireless settings and network settings. 58 * Change the profile for both wireless settings and network settings.
59 */ 59 */
60void WLANImp::setProfile(const QString &profile){ 60void WLANImp::setProfile(const QString &profile){
@@ -137,25 +137,25 @@ void WLANImp::parseSettingFile(){
137 } 137 }
138} 138}
139 139
140/** 140/**
141 * Saves settings to the wireless.opts file using the current profile 141 * Saves settings to the wireless.opts file using the current profile
142 */ 142 */
143void WLANImp::changeAndSaveSettingFile(){ 143void WLANImp::changeAndSaveSettingFile(){
144 QString wlanFile = WIRELESS_OPTS; 144 QString wlanFile = WIRELESS_OPTS;
145 QFile::remove(wlanFile); 145 QFile::remove(wlanFile);
146 QFile file(wlanFile); 146 QFile file(wlanFile);
147 147
148 if (!file.open(IO_ReadWrite)){ 148 if (!file.open(IO_ReadWrite)){
149 qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); 149 odebug << QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1() << oendl;
150 return; 150 return;
151 } 151 }
152 152
153 QTextStream stream( &file ); 153 QTextStream stream( &file );
154 bool foundCase = false; 154 bool foundCase = false;
155 bool found = false; 155 bool found = false;
156 bool output = true; 156 bool output = true;
157 for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { 157 for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) {
158 QString line = (*it).simplifyWhiteSpace(); 158 QString line = (*it).simplifyWhiteSpace();
159 if(line.contains("case")) 159 if(line.contains("case"))
160 foundCase = true; 160 foundCase = true;
161 // See if we found our scheme to write or the sceme couldn't be found 161 // See if we found our scheme to write or the sceme couldn't be found
@@ -227,19 +227,19 @@ void WLANImp::accept(){
227 changeAndSaveSettingFile(); 227 changeAndSaveSettingFile();
228 228
229 // Try to save the interfaces settings. 229 // Try to save the interfaces settings.
230 if(!interfaceSetup->saveChanges()) 230 if(!interfaceSetup->saveChanges())
231 return; 231 return;
232 232
233 OProcess insert; 233 OProcess insert;
234 insert << "sh"; 234 insert << "sh";
235 insert << "-c"; 235 insert << "-c";
236 insert << "cardctl eject && cardctl insert"; 236 insert << "cardctl eject && cardctl insert";
237 237
238 if (!insert.start(OProcess::DontCare, OProcess::NoCommunication) ) { 238 if (!insert.start(OProcess::DontCare, OProcess::NoCommunication) ) {
239 qWarning("could not start cardctl"); 239 owarn << "could not start cardctl" << oendl;
240 } 240 }
241 241
242 // Close out the dialog 242 // Close out the dialog
243 QDialog::accept(); 243 QDialog::accept();
244} 244}
245 245
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index eeebe7f..e483efe 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -43,25 +43,25 @@
43 * Constructor, read in the wireless.opts file for parsing later. 43 * Constructor, read in the wireless.opts file for parsing later.
44 */ 44 */
45using namespace Opie::Net; 45using namespace Opie::Net;
46using namespace Opie::Core; 46using namespace Opie::Core;
47WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { 47WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") {
48 interfaces = new Interfaces(); 48 interfaces = new Interfaces();
49 interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); 49 interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces);
50 tabWidget->insertTab(interfaceSetup, "TCP/IP"); 50 tabWidget->insertTab(interfaceSetup, "TCP/IP");
51 51
52 // Check sanity - the existance of the wireless-tools if-pre-up script 52 // Check sanity - the existance of the wireless-tools if-pre-up script
53 QFile file(QString(PREUP)); 53 QFile file(QString(PREUP));
54 if (file.exists()) { 54 if (file.exists()) {
55 qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); 55 owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl;
56 } 56 }
57 57
58 connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); 58 connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) );
59 connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) ); 59 connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) );
60 netView->setColumnAlignment( col_chn, AlignCenter ); 60 netView->setColumnAlignment( col_chn, AlignCenter );
61 netView->setItemMargin( 3 ); 61 netView->setItemMargin( 3 );
62 netView->setAllColumnsShowFocus( true ); 62 netView->setAllColumnsShowFocus( true );
63 63
64} 64}
65 65
66WLANImp::~WLANImp() { 66WLANImp::~WLANImp() {
67//FIXME: delete interfaces; 67//FIXME: delete interfaces;
@@ -224,25 +224,25 @@ void WLANImp::accept() {
224 // Close out the dialog 224 // Close out the dialog
225// FIXME: QDialog::accept(); 225// FIXME: QDialog::accept();
226} 226}
227 227
228void WLANImp::writeOpts() { 228void WLANImp::writeOpts() {
229 // eh can't really do anything about it other then return. :-D 229 // eh can't really do anything about it other then return. :-D
230 if(!interfaces->isInterfaceSet()){ 230 if(!interfaces->isInterfaceSet()){
231 QMessageBox::warning(0,"Inface not set","should not happen!!!"); 231 QMessageBox::warning(0,"Inface not set","should not happen!!!");
232 return; 232 return;
233 } 233 }
234 bool error = false; 234 bool error = false;
235 235
236 qDebug("setting wlan interface %s", interfaces->getInterfaceName( error ).latin1() ); 236 odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl;
237 237
238 if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!"); 238 if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!");
239 239
240 interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); 240 interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText());
241 interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); 241 interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText());
242 242
243 if (specifyAp->isChecked()) { 243 if (specifyAp->isChecked()) {
244 interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); 244 interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text());
245 } else { 245 } else {
246 interfaces->removeInterfaceOption(QString("wireless_ap")); 246 interfaces->removeInterfaceOption(QString("wireless_ap"));
247 } 247 }
248 248
@@ -298,83 +298,83 @@ void WLANImp::writeOpts() {
298 298
299 QDialog::accept(); 299 QDialog::accept();
300} 300}
301 301
302/* 302/*
303 * Scan for possible wireless networks around... 303 * Scan for possible wireless networks around...
304 * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org> 304 * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org>
305 */ 305 */
306 306
307void WLANImp::rescanNeighbourhood() 307void WLANImp::rescanNeighbourhood()
308{ 308{
309 QString name = interface->getInterfaceName(); 309 QString name = interface->getInterfaceName();
310 qDebug( "rescanNeighbourhood via '%s'", (const char*) name ); 310 odebug << "rescanNeighbourhood via '" << (const char*) name << "'" << oendl;
311 311
312 OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) ); 312 OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) );
313 assert( wiface ); 313 assert( wiface );
314 314
315 // try to guess device type 315 // try to guess device type
316 QString devicetype; 316 QString devicetype;
317 QFile m( "/proc/modules" ); 317 QFile m( "/proc/modules" );
318 if ( m.open( IO_ReadOnly ) ) 318 if ( m.open( IO_ReadOnly ) )
319 { 319 {
320 QString line; 320 QString line;
321 QTextStream modules( &m ); 321 QTextStream modules( &m );
322 while( !modules.atEnd() && !devicetype ) 322 while( !modules.atEnd() && !devicetype )
323 { 323 {
324 modules >> line; 324 modules >> line;
325 if ( line.contains( "cisco" ) ) devicetype = "cisco"; 325 if ( line.contains( "cisco" ) ) devicetype = "cisco";
326 else if ( line.contains( "hostap" ) ) devicetype = "hostap"; 326 else if ( line.contains( "hostap" ) ) devicetype = "hostap";
327 else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */ 327 else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */
328 else if ( line.contains( "orinoco" ) ) devicetype = "orinoco"; 328 else if ( line.contains( "orinoco" ) ) devicetype = "orinoco";
329 } 329 }
330 } 330 }
331 if ( devicetype.isEmpty() ) 331 if ( devicetype.isEmpty() )
332 { 332 {
333 qWarning( "rescanNeighbourhood(): couldn't guess device type :(" ); 333 owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl;
334 return; 334 return;
335 } 335 }
336 else 336 else
337 { 337 {
338 qDebug( "rescanNeighbourhood(): device type seems to be '%s'", (const char*) devicetype ); 338 odebug << "rescanNeighbourhood(): device type seems to be '" << (const char*) devicetype << "'" << oendl;
339 } 339 }
340 340
341 // configure interface to receive 802.11 management frames 341 // configure interface to receive 802.11 management frames
342 342
343 wiface->setUp( true ); 343 wiface->setUp( true );
344 wiface->setPromiscuousMode( true ); 344 wiface->setPromiscuousMode( true );
345 345
346 if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); 346 if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) );
347 else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); 347 else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) );
348 else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); 348 else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) );
349 else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); 349 else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) );
350 else 350 else
351 { 351 {
352 qDebug( "rescanNeighbourhood(): unsupported device type for monitoring :(" ); 352 odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl;
353 return; 353 return;
354 } 354 }
355 355
356 wiface->setMode( "monitor" ); 356 wiface->setMode( "monitor" );
357 if ( wiface->mode() != "monitor" ) 357 if ( wiface->mode() != "monitor" )
358 { 358 {
359 qWarning( "rescanNeighbourhood(): Unable to bring device into monitor mode (%s).", strerror( errno ) ); 359 owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl;
360 return; 360 return;
361 } 361 }
362 362
363 // open a packet capturer 363 // open a packet capturer
364 OPacketCapturer* cap = new OPacketCapturer(); 364 OPacketCapturer* cap = new OPacketCapturer();
365 cap->open( name ); 365 cap->open( name );
366 if ( !cap->isOpen() ) 366 if ( !cap->isOpen() )
367 { 367 {
368 qWarning( "rescanNeighbourhood(): Unable to open libpcap (%s).", strerror( errno ) ); 368 owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl;
369 return; 369 return;
370 } 370 }
371 371
372 // display splash screen 372 // display splash screen
373 QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); 373 QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize );
374 splash->setLineWidth( 2 ); 374 splash->setLineWidth( 2 );
375 splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); 375 splash->setFrameStyle( QFrame::Panel | QFrame::Raised );
376 QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); 376 QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 );
377 QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); 377 QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash );
378 QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); 378 QProgressBar* pb = new QProgressBar( wiface->channels(), splash );
379 vbox->addWidget( lab ); 379 vbox->addWidget( lab );
380 vbox->addWidget( pb ); 380 vbox->addWidget( pb );
@@ -389,33 +389,33 @@ void WLANImp::rescanNeighbourhood()
389 splash->show(); 389 splash->show();
390 splash->raise(); 390 splash->raise();
391 qApp->processEvents(); 391 qApp->processEvents();
392 392
393 // set capturer to non-blocking mode 393 // set capturer to non-blocking mode
394 cap->setBlocking( false ); 394 cap->setBlocking( false );
395 395
396 for ( int i = 1; i <= wiface->channels(); ++i ) 396 for ( int i = 1; i <= wiface->channels(); ++i )
397 { 397 {
398 wiface->setChannel( i ); 398 wiface->setChannel( i );
399 pb->setProgress( i ); 399 pb->setProgress( i );
400 qApp->processEvents(); 400 qApp->processEvents();
401 qDebug( "rescanNeighbourhood(): listening on channel %d...", i ); 401 odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl;
402 OPacket* p = cap->next( 1000 ); 402 OPacket* p = cap->next( 1000 );
403 if ( !p ) 403 if ( !p )
404 { 404 {
405 qDebug( "rescanNeighbourhood(): nothing received on channel %d", i ); 405 odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl;
406 } 406 }
407 else 407 else
408 { 408 {
409 qDebug( "rescanNeighbourhood(): TADAA - something came in on channel %d", i ); 409 odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl;
410 handlePacket( p ); 410 handlePacket( p );
411 } 411 }
412 } 412 }
413 413
414 cap->close(); 414 cap->close();
415 wiface->setMode( "managed" ); // TODO: use previous mode 415 wiface->setMode( "managed" ); // TODO: use previous mode
416 wiface->setPromiscuousMode( false ); 416 wiface->setPromiscuousMode( false );
417 417
418 splash->hide(); 418 splash->hide();
419 delete splash; 419 delete splash;
420 420
421} 421}
@@ -430,25 +430,25 @@ void WLANImp::handlePacket( OPacket* p )
430 430
431 QString type; 431 QString type;
432 if ( beacon->canIBSS() ) 432 if ( beacon->canIBSS() )
433 { 433 {
434 type = "adhoc"; 434 type = "adhoc";
435 } 435 }
436 else if ( beacon->canESS() ) 436 else if ( beacon->canESS() )
437 { 437 {
438 type = "managed"; 438 type = "managed";
439 } 439 }
440 else 440 else
441 { 441 {
442 qWarning( "handlePacket(): invalid frame [possibly noise] detected!" ); 442 owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl;
443 return; 443 return;
444 } 444 }
445 445
446 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 446 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
447 QString essid = ssid ? ssid->ID() : QString("<unknown>"); 447 QString essid = ssid ? ssid->ID() : QString("<unknown>");
448 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 448 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
449 int channel = ds ? ds->channel() : -1; 449 int channel = ds ? ds->channel() : -1;
450 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 450 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
451 displayFoundNetwork( type, channel, essid, header->macAddress2() ); 451 displayFoundNetwork( type, channel, essid, header->macAddress2() );
452 } 452 }
453} 453}
454 454
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index 74d7f8e..886af10 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -113,71 +113,71 @@ Interface *WLANModule::addNewInterface(const QString &){
113 113
114/** 114/**
115 * Attempts to remove the interface, doesn't delete i 115 * Attempts to remove the interface, doesn't delete i
116 * @return bool true if successful, false otherwise. 116 * @return bool true if successful, false otherwise.
117 */ 117 */
118bool WLANModule::remove(Interface*){ 118bool WLANModule::remove(Interface*){
119 // Can't remove a hardware device, you can stop it though. 119 // Can't remove a hardware device, you can stop it though.
120 return false; 120 return false;
121} 121}
122 122
123void WLANModule::receive(const QCString &param, const QByteArray &arg) 123void WLANModule::receive(const QCString &param, const QByteArray &arg)
124{ 124{
125 qDebug("WLANModule::receive "+param); 125 odebug << "WLANModule::receive "+param << oendl;
126 QStringList params = QStringList::split(",",param); 126 QStringList params = QStringList::split(",",param);
127 int count = params.count(); 127 int count = params.count();
128 qDebug("WLANModule got %i params", count ); 128 odebug << "WLANModule got " << count << " params" << oendl;
129 if (count < 2){ 129 if (count < 2){
130 qDebug("Erorr less than 2 parameter"); 130 odebug << "Erorr less than 2 parameter" << oendl;
131 qDebug("RETURNING"); 131 odebug << "RETURNING" << oendl;
132 return; 132 return;
133 } 133 }
134 134
135 QDataStream stream(arg,IO_ReadOnly); 135 QDataStream stream(arg,IO_ReadOnly);
136 QString interface; 136 QString interface;
137 QString action; 137 QString action;
138 int countMsgs = 0; 138 int countMsgs = 0;
139 stream >> interface; 139 stream >> interface;
140 qDebug("got count? >%s<",interface.latin1()); 140 odebug << "got count? >" << interface.latin1() << "<" << oendl;
141 if (interface == "count"){ 141 if (interface == "count"){
142 qDebug("got count"); 142 odebug << "got count" << oendl;
143 stream >> action; 143 stream >> action;
144 qDebug("Got count num >%s<", action.latin1()); 144 odebug << "Got count num >" << action.latin1() << "<" << oendl;
145 countMsgs = action.toInt(); 145 countMsgs = action.toInt();
146 } 146 }
147 147
148 QDialog *toShow; 148 QDialog *toShow;
149 //while (! stream.atEnd() ){ 149 //while (! stream.atEnd() ){
150 for (int i = 0; i < countMsgs; i++){ 150 for (int i = 0; i < countMsgs; i++){
151 qDebug("start stream %d/%d",i,countMsgs); 151 odebug << "start stream " << i << "/" << countMsgs << "" << oendl;
152 if (stream.atEnd()){ 152 if (stream.atEnd()){
153 qDebug("end of stream"); 153 odebug << "end of stream" << oendl;
154 return; 154 return;
155 } 155 }
156 stream >> interface; 156 stream >> interface;
157 qDebug("got iface"); 157 odebug << "got iface" << oendl;
158 stream >> action; 158 stream >> action;
159 qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1()); 159 odebug << "WLANModule got interface " << interface.latin1() << " and acion " << action.latin1() << "" << oendl;
160 // find interfaces 160 // find interfaces
161 Interface *ifa=0; 161 Interface *ifa=0;
162 for ( Interface *i=list.first(); i != 0; i=list.next() ){ 162 for ( Interface *i=list.first(); i != 0; i=list.next() ){
163 if (i->getInterfaceName() == interface){ 163 if (i->getInterfaceName() == interface){
164 qDebug("WLANModule found interface %s",interface.latin1()); 164 odebug << "WLANModule found interface " << interface.latin1() << "" << oendl;
165 ifa = i; 165 ifa = i;
166 } 166 }
167 } 167 }
168 168
169 if (ifa == 0){ 169 if (ifa == 0){
170 qDebug("WLANModule Did not find %s",interface.latin1()); 170 odebug << "WLANModule Did not find " << interface.latin1() << "" << oendl;
171 qDebug("skipping"); 171 odebug << "skipping" << oendl;
172 count = 0; 172 count = 0;
173 } 173 }
174 174
175 if (count == 2){ 175 if (count == 2){
176 // those should call the interface directly 176 // those should call the interface directly
177 QWidget *info = getInfo( ifa ); 177 QWidget *info = getInfo( ifa );
178 QPEApplication::showWidget( info ); 178 QPEApplication::showWidget( info );
179 179
180 if ( action.contains("start" ) ){ 180 if ( action.contains("start" ) ){
181 ifa->start(); 181 ifa->start();
182 } else if ( action.contains("restart" ) ){ 182 } else if ( action.contains("restart" ) ){
183 ifa->restart(); 183 ifa->restart();
@@ -186,70 +186,70 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
186 }else if ( action.contains("refresh" ) ){ 186 }else if ( action.contains("refresh" ) ){
187 ifa->refresh(); 187 ifa->refresh();
188 } 188 }
189 }else if (count == 3){ 189 }else if (count == 3){
190 QString value; 190 QString value;
191 if (!wlanconfigWiget){ 191 if (!wlanconfigWiget){
192 //FIXME: what if it got closed meanwhile? 192 //FIXME: what if it got closed meanwhile?
193 wlanconfigWiget = (WLANImp*) configure(ifa); 193 wlanconfigWiget = (WLANImp*) configure(ifa);
194 toShow = (QDialog*) wlanconfigWiget; 194 toShow = (QDialog*) wlanconfigWiget;
195 } 195 }
196 QPEApplication::showWidget( wlanconfigWiget ); 196 QPEApplication::showWidget( wlanconfigWiget );
197 stream >> value; 197 stream >> value;
198 qDebug("WLANModule (build 4) is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); 198 odebug << "WLANModule (build 4) is setting " << action.latin1() << " of " << interface.latin1() << " to " << value.latin1() << "" << oendl;
199 if (value.isEmpty()){ 199 if (value.isEmpty()){
200 qDebug("value is empty!!!\nreturning"); 200 odebug << "value is empty!!!\nreturning" << oendl;
201 return; 201 return;
202 } 202 }
203 if ( action.contains("ESSID") ){ 203 if ( action.contains("ESSID") ){
204 QComboBox *combo = wlanconfigWiget->essid; 204 QComboBox *combo = wlanconfigWiget->essid;
205 bool found = false; 205 bool found = false;
206 for ( int i = 0; i < combo->count(); i++) 206 for ( int i = 0; i < combo->count(); i++)
207 if ( combo->text( i ) == value ){ 207 if ( combo->text( i ) == value ){
208 combo->setCurrentItem( i ); 208 combo->setCurrentItem( i );
209 found = true; 209 found = true;
210 } 210 }
211 if (!found) combo->insertItem( value, 0 ); 211 if (!found) combo->insertItem( value, 0 );
212 }else if ( action.contains("Mode") ){ 212 }else if ( action.contains("Mode") ){
213 QComboBox *combo = wlanconfigWiget->mode; 213 QComboBox *combo = wlanconfigWiget->mode;
214 for ( int i = 0; i < combo->count(); i++) 214 for ( int i = 0; i < combo->count(); i++)
215 if ( combo->text( i ) == value ){ 215 if ( combo->text( i ) == value ){
216 combo->setCurrentItem( i ); 216 combo->setCurrentItem( i );
217 } 217 }
218 218
219 }else if (action.contains("Channel")){ 219 }else if (action.contains("Channel")){
220 bool ok; 220 bool ok;
221 qDebug("converting channel"); 221 odebug << "converting channel" << oendl;
222 int chan = value.toInt( &ok ); 222 int chan = value.toInt( &ok );
223 if (ok){ 223 if (ok){
224 qDebug("ok setting channel"); 224 odebug << "ok setting channel" << oendl;
225 wlanconfigWiget->specifyChan->setChecked( true ); 225 wlanconfigWiget->specifyChan->setChecked( true );
226 wlanconfigWiget->networkChannel->setValue( chan ); 226 wlanconfigWiget->networkChannel->setValue( chan );
227 } 227 }
228 }else if (action.contains("MacAddr")){ 228 }else if (action.contains("MacAddr")){
229 wlanconfigWiget->specifyAp->setChecked( true ); 229 wlanconfigWiget->specifyAp->setChecked( true );
230 wlanconfigWiget->macEdit->setText( value ); 230 wlanconfigWiget->macEdit->setText( value );
231 }else 231 }else
232 qDebug("wlan plugin has no clue"); 232 odebug << "wlan plugin has no clue" << oendl;
233 } 233 }
234 qDebug("next stream"); 234 odebug << "next stream" << oendl;
235 }// while stream 235 }// while stream
236 qDebug("end of stream"); 236 odebug << "end of stream" << oendl;
237 if (toShow) toShow->exec(); 237 if (toShow) toShow->exec();
238 qDebug("returning"); 238 odebug << "returning" << oendl;
239} 239}
240 240
241QWidget *WLANModule::getInfo( Interface *i) 241QWidget *WLANModule::getInfo( Interface *i)
242{ 242{
243 qDebug("WLANModule::getInfo start"); 243 odebug << "WLANModule::getInfo start" << oendl;
244 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); 244 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
245 InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); 245 InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i);
246 info->tabWidget->insertTab(information, "TCP/IP", 0); 246 info->tabWidget->insertTab(information, "TCP/IP", 0);
247 info->tabWidget->setCurrentPage( 0 ); 247 info->tabWidget->setCurrentPage( 0 );
248 info->tabWidget->showPage( information ); 248 info->tabWidget->showPage( information );
249 if (info->tabWidget->currentPage() == information ) qDebug("infotab OK"); 249 if (info->tabWidget->currentPage() == information ) odebug << "infotab OK" << oendl;
250 else qDebug("infotab NOT OK"); 250 else odebug << "infotab NOT OK" << oendl;
251 qDebug("current idx %d", info->tabWidget->currentPageIndex()); 251 odebug << "current idx " << info->tabWidget->currentPageIndex() << "" << oendl;
252 qDebug("WLANModule::getInfo return"); 252 odebug << "WLANModule::getInfo return" << oendl;
253 return info; 253 return info;
254} 254}
255 255
diff --git a/noncore/settings/sound/sound.pro b/noncore/settings/sound/sound.pro
index a3804c3..58e94f3 100644
--- a/noncore/settings/sound/sound.pro
+++ b/noncore/settings/sound/sound.pro
@@ -1,10 +1,9 @@
1CONFIG += qt warn_on quick-app 1CONFIG += qt warn_on quick-app
2HEADERS = soundsettings.h soundsettingsbase.h 2HEADERS = soundsettings.h soundsettingsbase.h
3SOURCES = soundsettings.cpp soundsettingsbase.cpp main.cpp 3SOURCES = soundsettings.cpp soundsettingsbase.cpp main.cpp
4#INTERFACES = soundsettingsbase.ui
5INCLUDEPATH += $(OPIEDIR)/include 4INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include 5DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lqpe -lopiecore2 6LIBS += -lqpe -lopiecore2
8TARGET = sound 7TARGET = sound
9 8
10include ( $(OPIEDIR)/include.pro ) 9include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp
index 8ad0a3f..d55a751 100644
--- a/noncore/settings/sound/soundsettings.cpp
+++ b/noncore/settings/sound/soundsettings.cpp
@@ -12,38 +12,42 @@
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// parts copyright 2002 L.J. Potter 20// parts copyright 2002 L.J. Potter
21 21
22#include "soundsettings.h" 22#include "soundsettings.h"
23 23
24/* OPIE */
25#include <opie2/odebug.h>
24#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
25#include <qpe/config.h> 27#include <qpe/config.h>
26#include <qpe/qcopenvelope_qws.h> 28#include <qpe/qcopenvelope_qws.h>
27#include <qpe/storage.h> 29#include <qpe/storage.h>
30using namespace Opie::Core;
28 31
32/* QT */
29#include <qcheckbox.h> 33#include <qcheckbox.h>
30#include <qcombobox.h> 34#include <qcombobox.h>
31#include <qlabel.h> 35#include <qlabel.h>
32 36
37/* STD */
33#include <sys/utsname.h> 38#include <sys/utsname.h>
34#include <sys/time.h> 39#include <sys/time.h>
35#include <sys/types.h> 40#include <sys/types.h>
36#include <unistd.h> 41#include <unistd.h>
37#include <stdio.h>
38#include <sys/stat.h> 42#include <sys/stat.h>
39 43
40 44
41SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) 45SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
42 : SoundSettingsBase( parent, objname, TRUE, fl ) 46 : SoundSettingsBase( parent, objname, TRUE, fl )
43{ 47{
44 keyReset=FALSE; 48 keyReset=FALSE;
45 noWarning=false; 49 noWarning=false;
46 Config config( "qpe"); 50 Config config( "qpe");
47 config.setGroup( "Volume" ); 51 config.setGroup( "Volume" );
48 Config cfg("Vmemo"); 52 Config cfg("Vmemo");
49 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 53 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
@@ -64,37 +68,37 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
64 68
65 stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); 69 stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0));
66//TODO hide if zaurus- mono only 70//TODO hide if zaurus- mono only
67 71
68#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) 72#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
69//since ipaq and zaurus have particular 73//since ipaq and zaurus have particular
70//devices 74//devices
71 bool systemZaurus=FALSE; 75 bool systemZaurus=FALSE;
72 struct utsname name; /* check for embedix kernel running on the zaurus*/ 76 struct utsname name; /* check for embedix kernel running on the zaurus*/
73 if (uname(&name) != -1) {// TODO change this here,... 77 if (uname(&name) != -1) {// TODO change this here,...
74 QString release=name.release; 78 QString release=name.release;
75 if( release.find("embedix",0,TRUE) != -1) { 79 if( release.find("embedix",0,TRUE) != -1) {
76 qDebug("IS System Zaurus"); 80 odebug << "IS System Zaurus" << oendl;
77 systemZaurus=TRUE; 81 systemZaurus=TRUE;
78 } 82 }
79 } 83 }
80 if(!systemZaurus) { 84 if(!systemZaurus) {
81 stereoCheckBox->setChecked(TRUE); 85 stereoCheckBox->setChecked(TRUE);
82 } 86 }
83 stereoCheckBox->setEnabled(FALSE); 87 stereoCheckBox->setEnabled(FALSE);
84 sixteenBitCheckBox->setEnabled(FALSE); 88 sixteenBitCheckBox->setEnabled(FALSE);
85#else 89#else
86#endif 90#endif
87 int sRate=cfg.readNumEntry("SizeLimit", 30); 91 int sRate=cfg.readNumEntry("SizeLimit", 30);
88 qDebug("%d",sRate); 92 odebug << "" << sRate << "" << oendl;
89 93
90 if(sRate ==30) 94 if(sRate ==30)
91 timeLimitComboBox->setCurrentItem(0); 95 timeLimitComboBox->setCurrentItem(0);
92 else if(sRate==20) 96 else if(sRate==20)
93 timeLimitComboBox->setCurrentItem(1); 97 timeLimitComboBox->setCurrentItem(1);
94 else if(sRate == 15) 98 else if(sRate == 15)
95 timeLimitComboBox->setCurrentItem(2); 99 timeLimitComboBox->setCurrentItem(2);
96 else if(sRate == 10) 100 else if(sRate == 10)
97 timeLimitComboBox->setCurrentItem(3); 101 timeLimitComboBox->setCurrentItem(3);
98 else if(sRate == 5) 102 else if(sRate == 5)
99 timeLimitComboBox->setCurrentItem(4); 103 timeLimitComboBox->setCurrentItem(4);
100 else 104 else
@@ -134,42 +138,42 @@ void SoundSettings::updateStorageCombo() {
134 int set=0; 138 int set=0;
135 StorageInfo storageInfo; 139 StorageInfo storageInfo;
136 QString sName, sPath; 140 QString sName, sPath;
137 QStringList list; 141 QStringList list;
138 list << "Documents : "+QPEApplication::documentDir(); 142 list << "Documents : "+QPEApplication::documentDir();
139 list << "tmp : /tmp"; 143 list << "tmp : /tmp";
140 144
141 const QList<FileSystem> &fs = storageInfo.fileSystems(); 145 const QList<FileSystem> &fs = storageInfo.fileSystems();
142 QListIterator<FileSystem> it ( fs ); 146 QListIterator<FileSystem> it ( fs );
143 for( ; it.current(); ++it ){ 147 for( ; it.current(); ++it ){
144 const QString name = (*it)->name(); 148 const QString name = (*it)->name();
145 const QString path = (*it)->path(); 149 const QString path = (*it)->path();
146 qDebug("storage name "+name +" storage path is "+path); 150 odebug << "storage name "+name +" storage path is "+path << oendl;
147 list << name + ": " +path; 151 list << name + ": " +path;
148 if( loc.find( path,0,TRUE) != -1) 152 if( loc.find( path,0,TRUE) != -1)
149 set = i; 153 set = i;
150// if(dit.current()->file().find(path) != -1 ) storage=name; 154// if(dit.current()->file().find(path) != -1 ) storage=name;
151 i++; 155 i++;
152 } 156 }
153 157
154 LocationComboBox->insertStringList(list); 158 LocationComboBox->insertStringList(list);
155 qDebug("set item %d", set); 159 odebug << "set item " << set << "" << oendl;
156 LocationComboBox->setCurrentItem(set); 160 LocationComboBox->setCurrentItem(set);
157} 161}
158 162
159void SoundSettings::setLocation(const QString & string) { 163void SoundSettings::setLocation(const QString & string) {
160 Config config( "Vmemo" ); 164 Config config( "Vmemo" );
161 config.setGroup( "System" ); 165 config.setGroup( "System" );
162 config.writeEntry("RecLocation",string); 166 config.writeEntry("RecLocation",string);
163 qDebug("set location "+string); 167 odebug << "set location "+string << oendl;
164 config.write(); 168 config.write();
165} 169}
166 170
167void SoundSettings::cleanUp() { 171void SoundSettings::cleanUp() {
168 Config cfg("Vmemo"); 172 Config cfg("Vmemo");
169 cfg.writeEntry("Alert",AlertCheckBox->isChecked()); 173 cfg.writeEntry("Alert",AlertCheckBox->isChecked());
170 174
171 cfg.setGroup("Record"); 175 cfg.setGroup("Record");
172 cfg.writeEntry("SampleRate",sampleRate->currentText()); 176 cfg.writeEntry("SampleRate",sampleRate->currentText());
173 cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); 177 cfg.writeEntry("Stereo",stereoCheckBox->isChecked());
174 cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); 178 cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked());
175 if(keyReset && noWarning) { 179 if(keyReset && noWarning) {
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp
index 96bcdfc..4163fb2 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.cpp
+++ b/noncore/settings/sysinfo/benchmarkinfo.cpp
@@ -10,31 +10,34 @@
10** GNU General Public License version 2 as published by the Free Software 10** GNU General Public License version 2 as published by the Free Software
11** Foundation and appearing in the file LICENSE.GPL included in the 11** Foundation and appearing in the file LICENSE.GPL included in the
12** packaging of this file. 12** packaging of this file.
13** 13**
14** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 14** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
15** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 15** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16** 16**
17**********************************************************************/ 17**********************************************************************/
18 18
19#include "benchmarkinfo.h" 19#include "benchmarkinfo.h"
20 20
21/* OPIE */ 21/* OPIE */
22#include <opie2/odebug.h>
22#include <opie2/ostorageinfo.h> 23#include <opie2/ostorageinfo.h>
23#include <opie2/olistview.h> 24#include <opie2/olistview.h>
24#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
25#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
26#include <qpe/qpedecoration_qws.h> 27#include <qpe/qpedecoration_qws.h>
27#include <qpe/resource.h> 28#include <qpe/resource.h>
28#include <qpe/config.h> 29#include <qpe/config.h>
30using namespace Opie::Core;
31using namespace Opie::Ui;
29 32
30/* QT */ 33/* QT */
31#include <qclipboard.h> 34#include <qclipboard.h>
32#include <qcolor.h> 35#include <qcolor.h>
33#include <qcombobox.h> 36#include <qcombobox.h>
34#include <qdirectpainter_qws.h> 37#include <qdirectpainter_qws.h>
35#include <qfile.h> 38#include <qfile.h>
36#include <qtextstream.h> 39#include <qtextstream.h>
37#include <qfiledialog.h> 40#include <qfiledialog.h>
38#include <qlabel.h> 41#include <qlabel.h>
39#include <qlayout.h> 42#include <qlayout.h>
40#include <qpainter.h> 43#include <qpainter.h>
@@ -42,28 +45,25 @@
42#include <qtimer.h> 45#include <qtimer.h>
43#include <qwhatsthis.h> 46#include <qwhatsthis.h>
44 47
45/* STD */ 48/* STD */
46#include <time.h> 49#include <time.h>
47#include <stdio.h> 50#include <stdio.h>
48#include <stdlib.h> 51#include <stdlib.h>
49#include <math.h> 52#include <math.h>
50#if defined (__GNUC__) && (__GNUC__ < 3) 53#if defined (__GNUC__) && (__GNUC__ < 3)
51#define round qRound 54#define round qRound
52#endif 55#endif
53 56
54using namespace Opie::Ui;
55using namespace Opie::Core;
56extern "C" 57extern "C"
57
58{ 58{
59 void BenchFFT( void ); 59 void BenchFFT( void );
60 double dhry_main( int ); 60 double dhry_main( int );
61} 61}
62 62
63#define DHRYSTONE_RUNS 20000000 63#define DHRYSTONE_RUNS 20000000
64#define TEST_DURATION 3 64#define TEST_DURATION 3
65 65
66#define BUFF_SIZE 8192 66#define BUFF_SIZE 8192
67#define FILE_SIZE 1024 * 1024 // 1Mb 67#define FILE_SIZE 1024 * 1024 // 1Mb
68 68
69//=========================================================================== 69//===========================================================================
@@ -139,50 +139,50 @@ BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags )
139 vb->addWidget( tests, 2 ); 139 vb->addWidget( tests, 2 );
140 140
141 QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" ); 141 QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" );
142 if ( f.open( IO_ReadOnly ) ) 142 if ( f.open( IO_ReadOnly ) )
143 { 143 {
144 machineCombo = new QComboBox( this ); 144 machineCombo = new QComboBox( this );
145 QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) ); 145 QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) );
146 146
147 QTextStream ts( &f ); 147 QTextStream ts( &f );
148 while( !ts.eof() ) 148 while( !ts.eof() )
149 { 149 {
150 QString machline = ts.readLine(); 150 QString machline = ts.readLine();
151 qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline ); 151 odebug << "sysinfo: parsing benchmark results for '" << (const char*) machline << "'" << oendl;
152 QString resline = ts.readLine(); 152 QString resline = ts.readLine();
153 machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); 153 machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) );
154 machineCombo->insertItem( machline ); 154 machineCombo->insertItem( machline );
155 } 155 }
156 156
157 QHBoxLayout* hb = new QHBoxLayout( vb ); 157 QHBoxLayout* hb = new QHBoxLayout( vb );
158 hb->addWidget( new QLabel( tr( "Compare To:" ), this ) ); 158 hb->addWidget( new QLabel( tr( "Compare To:" ), this ) );
159 hb->addWidget( machineCombo, 2 ); 159 hb->addWidget( machineCombo, 2 );
160 connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) ); 160 connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) );
161 } 161 }
162 162
163 vb->addWidget( startButton, 2 ); 163 vb->addWidget( startButton, 2 );
164} 164}
165 165
166 166
167BenchmarkInfo::~BenchmarkInfo() 167BenchmarkInfo::~BenchmarkInfo()
168{} 168{}
169 169
170 170
171void BenchmarkInfo::machineActivated( int index ) 171void BenchmarkInfo::machineActivated( int index )
172{ 172{
173 QStringList* results = machines[ machineCombo->text( index ) ]; 173 QStringList* results = machines[ machineCombo->text( index ) ];
174 if ( !results ) 174 if ( !results )
175 { 175 {
176 qDebug( "sysinfo: no results available." ); 176 odebug << "sysinfo: no results available." << oendl;
177 return; 177 return;
178 } 178 }
179 QStringList::Iterator it = results->begin(); 179 QStringList::Iterator it = results->begin();
180 test_alu->setText( 2, *(it++) ); 180 test_alu->setText( 2, *(it++) );
181 test_fpu->setText( 2, *(it++) ); 181 test_fpu->setText( 2, *(it++) );
182 test_txt->setText( 2, *(it++) ); 182 test_txt->setText( 2, *(it++) );
183 test_gfx->setText( 2, *(it++) ); 183 test_gfx->setText( 2, *(it++) );
184 test_ram->setText( 2, *(it++) ); 184 test_ram->setText( 2, *(it++) );
185 test_sd->setText( 2, *(it++) ); 185 test_sd->setText( 2, *(it++) );
186 test_cf->setText( 2, *(it++) ); 186 test_cf->setText( 2, *(it++) );
187} 187}
188 188
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp
index 15aeaf5..4274203 100644
--- a/noncore/settings/tabmanager/tabmanager.cpp
+++ b/noncore/settings/tabmanager/tabmanager.cpp
@@ -54,25 +54,25 @@ TabManager::~TabManager(){
54 e << link; 54 e << link;
55 } 55 }
56} 56}
57 57
58/** 58/**
59 * Scans root directory for any tabs or applications. Will recursivly go down, 59 * Scans root directory for any tabs or applications. Will recursivly go down,
60 * but will not follow symlinks. 60 * but will not follow symlinks.
61 * @param directory - the directory to look in. 61 * @param directory - the directory to look in.
62 * @param parent - the parent to place any new tabs or apps into. If parent is 62 * @param parent - the parent to place any new tabs or apps into. If parent is
63 * NULL then the item is a tab and should be placed as a child of the window. 63 * NULL then the item is a tab and should be placed as a child of the window.
64 */ 64 */
65void TabManager::rescanFolder(QString directory, QListViewItem* parent){ 65void TabManager::rescanFolder(QString directory, QListViewItem* parent){
66 //qDebug(QString("rescanFolder: ") + directory.latin1()); 66 //odebug << QString("rescanFolder: ") + directory.latin1() << oendl;
67 67
68 QDir d; 68 QDir d;
69 d.setPath(directory); 69 d.setPath(directory);
70 // Show hidden files for .directories 70 // Show hidden files for .directories
71 d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); 71 d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
72 72
73 const QFileInfoList *list = d.entryInfoList(); 73 const QFileInfoList *list = d.entryInfoList();
74 QFileInfoListIterator it( *list ); // create list iterator 74 QFileInfoListIterator it( *list ); // create list iterator
75 QFileInfo *fi; // pointer for traversing 75 QFileInfo *fi; // pointer for traversing
76 76
77 while ( (fi=it.current()) ) { // for each file... 77 while ( (fi=it.current()) ) { // for each file...
78 // If it is a dir and not .. or . then add it as a tab and go down. 78 // If it is a dir and not .. or . then add it as a tab and go down.
@@ -198,25 +198,25 @@ void TabManager::removeItem(){
198 if(item->parent() == NULL){ 198 if(item->parent() == NULL){
199 // Remove .directory file string 199 // Remove .directory file string
200 location = location.mid(0,location.length()-10); 200 location = location.mid(0,location.length()-10);
201 QDir dir; 201 QDir dir;
202 if(!dir.rmdir(location)) 202 if(!dir.rmdir(location))
203 removeSuccessful = false; 203 removeSuccessful = false;
204 else 204 else
205 removeSuccessful = true; 205 removeSuccessful = true;
206 } 206 }
207 207
208 // If removing failed. 208 // If removing failed.
209 if(!removeSuccessful){ 209 if(!removeSuccessful){
210 qDebug((QString("removeItem: ") + location).latin1()); 210 odebug << (QString("removeItem: ") + location).latin1() << oendl;
211 QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); 211 QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") );
212 return; 212 return;
213 } 213 }
214 214
215 // Remove from the installer so it wont fail. 215 // Remove from the installer so it wont fail.
216 // Don't need to do this sense the current install uses rm -f so no error 216 // Don't need to do this sense the current install uses rm -f so no error
217 217
218 // Remove from the gui list. 218 // Remove from the gui list.
219 itemList.remove(item); 219 itemList.remove(item);
220 if(item->parent()) 220 if(item->parent())
221 item->parent()->takeItem(item); 221 item->parent()->takeItem(item);
222 delete item; 222 delete item;
@@ -235,25 +235,25 @@ void TabManager::editCurrentItem(){
235 235
236/** 236/**
237 * Edit the item that is passed in. 237 * Edit the item that is passed in.
238 * Show application dialog and if anything changed 238 * Show application dialog and if anything changed
239 * @param item the item to edit. 239 * @param item the item to edit.
240 */ 240 */
241void TabManager::editItem( QListViewItem * item){ 241void TabManager::editItem( QListViewItem * item){
242 if(!item) 242 if(!item)
243 return; 243 return;
244 244
245 TabAppLnk app(itemList[item]); 245 TabAppLnk app(itemList[item]);
246 if(!app.isValid()){ 246 if(!app.isValid()){
247 qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1()); 247 odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl;
248 return; 248 return;
249 } 249 }
250 250
251 // Fill with all of the icons 251 // Fill with all of the icons
252 if(!application){ 252 if(!application){
253 Wait waitDialog(this, "Wait dialog"); 253 Wait waitDialog(this, "Wait dialog");
254 waitDialog.waitLabel->setText(tr("Gathering icons...")); 254 waitDialog.waitLabel->setText(tr("Gathering icons..."));
255 waitDialog.show(); 255 waitDialog.show();
256 qApp->processEvents(); 256 qApp->processEvents();
257 application = new AppEdit(this, "Application edit", true); 257 application = new AppEdit(this, "Application edit", true);
258 258
259 QDir d(QPEApplication::qpeDir() + "/pics/"); 259 QDir d(QPEApplication::qpeDir() + "/pics/");
@@ -264,25 +264,25 @@ void TabManager::editItem( QListViewItem * item){
264 QFileInfo *fi; // pointer for traversing 264 QFileInfo *fi; // pointer for traversing
265 265
266 while ( (fi=it.current()) ) { // for each file... 266 while ( (fi=it.current()) ) { // for each file...
267 QString fileName = fi->fileName(); 267 QString fileName = fi->fileName();
268 if(fileName.right(4) == ".png"){ 268 if(fileName.right(4) == ".png"){
269 fileName = fileName.mid(0,fileName.length()-4); 269 fileName = fileName.mid(0,fileName.length()-4);
270 QPixmap imageOfFile(Resource::loadPixmap(fileName)); 270 QPixmap imageOfFile(Resource::loadPixmap(fileName));
271 QImage foo = imageOfFile.convertToImage(); 271 QImage foo = imageOfFile.convertToImage();
272 foo = foo.smoothScale(16,16); 272 foo = foo.smoothScale(16,16);
273 imageOfFile.convertFromImage(foo); 273 imageOfFile.convertFromImage(foo);
274 application->iconLineEdit->insertItem(imageOfFile,fileName); 274 application->iconLineEdit->insertItem(imageOfFile,fileName);
275 } 275 }
276 //qDebug(fi->fileName().latin1()); 276 //odebug << fi->fileName().latin1() << oendl;
277 ++it; 277 ++it;
278 } 278 }
279 waitDialog.hide(); 279 waitDialog.hide();
280 } 280 }
281 int pixmap = -1; 281 int pixmap = -1;
282 QString pixmapText = app.pixmapString(); 282 QString pixmapText = app.pixmapString();
283 QComboBox *f = application->iconLineEdit; 283 QComboBox *f = application->iconLineEdit;
284 for(int i = 0; i < application->iconLineEdit->count(); i++){ 284 for(int i = 0; i < application->iconLineEdit->count(); i++){
285 if(f->text(i) == pixmapText){ 285 if(f->text(i) == pixmapText){
286 pixmap = i; 286 pixmap = i;
287 break; 287 break;
288 } 288 }
@@ -393,38 +393,38 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){
393 393
394 QString desktopFile = itemList[item]; 394 QString desktopFile = itemList[item];
395 slash = desktopFile.findRev('/', -1); 395 slash = desktopFile.findRev('/', -1);
396 desktopFile = desktopFile.mid(slash, desktopFile.length()); 396 desktopFile = desktopFile.mid(slash, desktopFile.length());
397 newFolder = newFolder + desktopFile; 397 newFolder = newFolder + desktopFile;
398 398
399 // Move file 399 // Move file
400 QDir r; 400 QDir r;
401 if(!r.rename(itemList[item], newFolder)){ 401 if(!r.rename(itemList[item], newFolder)){
402 QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") ); 402 QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") );
403 return; 403 return;
404 } 404 }
405 //qDebug((QString("moveApplication: ") + itemList[item]).latin1()); 405 //odebug << (QString("moveApplication: ") + itemList[item]).latin1() << oendl;
406 //qDebug((QString("moveApplication: ") + newFolder).latin1()); 406 //odebug << (QString("moveApplication: ") + newFolder).latin1() << oendl;
407 407
408 // Move in the gui 408 // Move in the gui
409 item->parent()->takeItem(item); 409 item->parent()->takeItem(item);
410 newGroup->insertItem(item); 410 newGroup->insertItem(item);
411 newGroup->setOpen(true); 411 newGroup->setOpen(true);
412 412
413 // Move file in the installer 413 // Move file in the installer
414 QString installedAppFile; 414 QString installedAppFile;
415 if(findInstalledApplication(desktopFile, installedAppFile)) 415 if(findInstalledApplication(desktopFile, installedAppFile))
416 swapInstalledLocation(installedAppFile, desktopFile, newFolder); 416 swapInstalledLocation(installedAppFile, desktopFile, newFolder);
417 else 417 else
418 qDebug("moveApplication: No installed app found for dekstop file"); 418 odebug << "moveApplication: No installed app found for dekstop file" << oendl;
419 419
420 // Move application type 420 // Move application type
421 AppLnk app(newFolder); 421 AppLnk app(newFolder);
422 app.setType(folderName); 422 app.setType(folderName);
423 app.writeLink(); 423 app.writeLink();
424 424
425 // Move in our internal list 425 // Move in our internal list
426 itemList.remove(item); 426 itemList.remove(item);
427 itemList.insert(item, newFolder); 427 itemList.insert(item, newFolder);
428 428
429 // We have changed something. 429 // We have changed something.
430 changed = true; 430 changed = true;
@@ -455,54 +455,54 @@ bool TabManager::findInstalledApplication(QString desktopFile, QString &installe
455 QString line; 455 QString line;
456 while ( !stream.eof() ) { // until end of file... 456 while ( !stream.eof() ) { // until end of file...
457 line = stream.readLine(); // line of text excluding '\n' 457 line = stream.readLine(); // line of text excluding '\n'
458 if(line.contains(desktopFile)){ 458 if(line.contains(desktopFile)){
459 installedAppFile = QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName(); 459 installedAppFile = QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName();
460 file.close(); 460 file.close();
461 return true; 461 return true;
462 } 462 }
463 } 463 }
464 file.close(); 464 file.close();
465 } 465 }
466 else 466 else
467 qDebug((QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1()); 467 odebug << (QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1() << oendl;
468 ++it; // goto next list element 468 ++it; // goto next list element
469 } 469 }
470 return false; 470 return false;
471} 471}
472 472
473/** 473/**
474 * Open a file and replace a file containing the old desktop file with the new. 474 * Open a file and replace a file containing the old desktop file with the new.
475 * @param installedAppFile application installed list 475 * @param installedAppFile application installed list
476 * @param desktopFile old .desktop file 476 * @param desktopFile old .desktop file
477 * @param newLocation new .desktop file 477 * @param newLocation new .desktop file
478 */ 478 */
479void TabManager::swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ){ 479void TabManager::swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ){
480 QFile file(installedAppFile); 480 QFile file(installedAppFile);
481 if ( !file.open(IO_ReadOnly) ){ 481 if ( !file.open(IO_ReadOnly) ){
482 qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1()); 482 odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl;
483 return; 483 return;
484 } 484 }
485 485
486 QTextStream stream( &file ); // use a text stream 486 QTextStream stream( &file ); // use a text stream
487 QString allLines; 487 QString allLines;
488 while ( !stream.eof() ) { // until end of file... 488 while ( !stream.eof() ) { // until end of file...
489 QString line = stream.readLine(); // line of text excluding '\n' 489 QString line = stream.readLine(); // line of text excluding '\n'
490 if(line.contains(desktopFile)) 490 if(line.contains(desktopFile))
491 allLines += newLocation; 491 allLines += newLocation;
492 else 492 else
493 allLines += line; 493 allLines += line;
494 allLines += '\n'; 494 allLines += '\n';
495 } 495 }
496 file.close(); 496 file.close();
497 497
498 if ( !file.open(IO_ReadWrite) ){ 498 if ( !file.open(IO_ReadWrite) ){
499 qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1()); 499 odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl;
500 return; 500 return;
501 } 501 }
502 QTextStream streamOut( &file ); 502 QTextStream streamOut( &file );
503 streamOut << allLines; 503 streamOut << allLines;
504 file.close(); 504 file.close();
505} 505}
506 506
507// tabmanager.cpp 507// tabmanager.cpp
508 508
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 5854fe0..3616507 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -2,48 +2,46 @@
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10#include "userdialog.h" 10#include "userdialog.h"
11#include "passwd.h" 11#include "passwd.h"
12 12
13/* OPIE */ 13/* OPIE */
14#include <opie2/odebug.h>
14#include <opie2/odevice.h> 15#include <opie2/odevice.h>
15#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17using namespace Opie::Core;
18using namespace Opie::Ui;
16 19
17/* QT */ 20/* QT */
18#include <qlayout.h> 21#include <qlayout.h>
19#include <qlabel.h> 22#include <qlabel.h>
20#include <qmessagebox.h> 23#include <qmessagebox.h>
21#include <qfile.h> 24#include <qfile.h>
22 25
23/* STD */ 26/* STD */
24#include <sys/types.h> 27#include <sys/types.h>
25#include <sys/wait.h> 28#include <sys/wait.h>
26#include <unistd.h> 29#include <unistd.h>
27#include <signal.h> 30#include <signal.h>
28 31
29
30using namespace Opie::Core;
31
32
33/** 32/**
34 * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups. 33 * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups.
35 * 34 *
36 */ 35 */
37using namespace Opie::Ui;
38UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) 36UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl)
39{ 37{
40 vm=viewmode; 38 vm=viewmode;
41 QVBoxLayout *layout = new QVBoxLayout(this); 39 QVBoxLayout *layout = new QVBoxLayout(this);
42 myTabWidget=new QTabWidget(this,"User Tab Widget"); 40 myTabWidget=new QTabWidget(this,"User Tab Widget");
43 layout->addWidget(myTabWidget); 41 layout->addWidget(myTabWidget);
44 setupTab1(); 42 setupTab1();
45 setupTab2(); 43 setupTab2();
46 44
47 accounts->groupStringList.sort(); 45 accounts->groupStringList.sort();
48 // And also fill the listview & the combobox with all available groups. 46 // And also fill the listview & the combobox with all available groups.
49 for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) 47 for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it)
@@ -236,25 +234,25 @@ bool UserDialog::addUser(int uid, int gid)
236 if (temp->text()=="power") temp->setOn(true); 234 if (temp->text()=="power") temp->setOn(true);
237 if (temp->text()=="input") temp->setOn(true); 235 if (temp->text()=="input") temp->setOn(true);
238 if (temp->text()=="sharp") temp->setOn(true); 236 if (temp->text()=="sharp") temp->setOn(true);
239 if (temp->text()=="tty") temp->setOn(true); 237 if (temp->text()=="tty") temp->setOn(true);
240 } 238 }
241 } 239 }
242 // Show the dialog! 240 // Show the dialog!
243 if(!(adduserDialog->exec())) return false; 241 if(!(adduserDialog->exec())) return false;
244 if((adduserDialog->groupComboBox->currentItem()!=0)) 242 if((adduserDialog->groupComboBox->currentItem()!=0))
245 { 243 {
246 accounts->findGroup(adduserDialog->groupComboBox->currentText()); 244 accounts->findGroup(adduserDialog->groupComboBox->currentText());
247 adduserDialog->groupID=accounts->gr_gid; 245 adduserDialog->groupID=accounts->gr_gid;
248 qWarning(QString::number(accounts->gr_gid)); 246 owarn << QString::number(accounts->gr_gid) << oendl;
249 } 247 }
250 if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(), 248 if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(),
251 adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(), 249 adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(),
252 QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) 250 QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText())))
253 { 251 {
254 QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user."); 252 QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user.");
255 return false; 253 return false;
256 } 254 }
257 255
258 // Add User to additional groups. 256 // Add User to additional groups.
259 QListViewItemIterator it( adduserDialog->groupsListView ); 257 QListViewItemIterator it( adduserDialog->groupsListView );
260 for ( ; it.current(); ++it ) 258 for ( ; it.current(); ++it )
@@ -365,40 +363,40 @@ bool UserDialog::editUser(const char *username)
365 { 363 {
366 edituserDialog->groupComboBox->insertItem("<Undefined group>",0); 364 edituserDialog->groupComboBox->insertItem("<Undefined group>",0);
367 edituserDialog->groupComboBox->setCurrentItem(0); 365 edituserDialog->groupComboBox->setCurrentItem(0);
368 } 366 }
369 367
370 // Select the groups in the listview, to which the user belongs. 368 // Select the groups in the listview, to which the user belongs.
371 QCheckListItem *temp; 369 QCheckListItem *temp;
372 // BAH!!! QRegExp in qt2 sucks... or maybe I do... can't figure out how to check for EITHER end of input ($) OR a comma, so here we do two different QRegExps instead. 370 // BAH!!! QRegExp in qt2 sucks... or maybe I do... can't figure out how to check for EITHER end of input ($) OR a comma, so here we do two different QRegExps instead.
373 QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant. 371 QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant.
374 QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. 372 QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of.
375 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) 373 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it)
376 { // Iterate over all of them. 374 { // Iterate over all of them.
377 qWarning(*it); 375 owarn << *it << oendl;
378 QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. 376 QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups.
379 for ( ; lvit.current(); ++lvit ) 377 for ( ; lvit.current(); ++lvit )
380 { 378 {
381 if(lvit.current()->text(0)==(*it).left((*it).find(":"))) 379 if(lvit.current()->text(0)==(*it).left((*it).find(":")))
382 { 380 {
383 temp=(QCheckListItem*)lvit.current(); 381 temp=(QCheckListItem*)lvit.current();
384 temp->setOn(true); // If we find a line with that groupname, select it.; 382 temp->setOn(true); // If we find a line with that groupname, select it.;
385 } 383 }
386 } 384 }
387 } 385 }
388 userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.) 386 userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.)
389 tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. 387 tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of.
390 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) 388 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it)
391 { // Iterate over all of them. 389 { // Iterate over all of them.
392 qWarning(*it); 390 owarn << *it << oendl;
393 QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. 391 QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups.
394 for ( ; lvit.current(); ++lvit ) 392 for ( ; lvit.current(); ++lvit )
395 { 393 {
396 if(lvit.current()->text(0)==(*it).left((*it).find(":"))) 394 if(lvit.current()->text(0)==(*it).left((*it).find(":")))
397 { 395 {
398 temp=(QCheckListItem*)lvit.current(); 396 temp=(QCheckListItem*)lvit.current();
399 temp->setOn(true); // If we find a line with that groupname, select it.; 397 temp->setOn(true); // If we find a line with that groupname, select it.;
400 } 398 }
401 } 399 }
402 } 400 }
403 401
404 if(!(edituserDialog->exec())) return false; // SHOW THE DIALOG! 402 if(!(edituserDialog->exec())) return false; // SHOW THE DIALOG!
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp
index a1130d4..1d345ee 100644
--- a/noncore/settings/usermanager/usermanager.cpp
+++ b/noncore/settings/usermanager/usermanager.cpp
@@ -1,29 +1,32 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10#include "usermanager.h" 10#include "usermanager.h"
11 11
12#include <qlayout.h> 12/* OPIE */
13#include <opie2/odebug.h>
14#include <qpe/resource.h>
15using namespace Opie::Core;
13 16
17/* QT */
18#include <qlayout.h>
14#include <qmessagebox.h> 19#include <qmessagebox.h>
15#include <qfile.h> 20#include <qfile.h>
16#include <qpe/resource.h>
17
18#include <qregexp.h> 21#include <qregexp.h>
19 22
20/** 23/**
21 * The mainwindow constructor. 24 * The mainwindow constructor.
22 * 25 *
23 * @param QWidget *parent 26 * @param QWidget *parent
24 * @param const char *name 27 * @param const char *name
25 * @ param WFlags fl 28 * @ param WFlags fl
26 * 29 *
27 */ 30 */
28UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { 31UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) {
29 setCaption(tr("Opie User Manager")); 32 setCaption(tr("Opie User Manager"));
@@ -244,14 +247,14 @@ void UserConfig::delGroup() {
244 groupname=groupsListView->currentItem()->text(1);// Get the groupname from the listview. 247 groupname=groupsListView->currentItem()->text(1);// Get the groupname from the listview.
245 if(QMessageBox::warning(this,"Delete group","Are you sure you want to\ndelete the group \""+QString(groupname)+"\" ?","&No","&Yes",0,0,1)) { 248 if(QMessageBox::warning(this,"Delete group","Are you sure you want to\ndelete the group \""+QString(groupname)+"\" ?","&No","&Yes",0,0,1)) {
246 // If confirmed, try to delete the group. 249 // If confirmed, try to delete the group.
247 if(GroupDialog::delGroup(groupname)) getGroups(); // And also update the view afterwards if the user was deleted. 250 if(GroupDialog::delGroup(groupname)) getGroups(); // And also update the view afterwards if the user was deleted.
248 } 251 }
249 } else { 252 } else {
250 QMessageBox::information(this,"No selection","No group has been selected."); 253 QMessageBox::information(this,"No selection","No group has been selected.");
251 } 254 }
252} 255}
253 256
254void UserConfig::showUserMenu(QListViewItem *item) { 257void UserConfig::showUserMenu(QListViewItem *item) {
255 //userPopupMenu.exec(item->mapToGlobal(QPoint(0,0))); 258 //userPopupMenu.exec(item->mapToGlobal(QPoint(0,0)));
256 qWarning("Pressed!"); 259 owarn << "Pressed!" << oendl;
257} 260}
diff --git a/noncore/settings/usermanager/usermanager.pro b/noncore/settings/usermanager/usermanager.pro
index d0647dd..31f52a6 100644
--- a/noncore/settings/usermanager/usermanager.pro
+++ b/noncore/settings/usermanager/usermanager.pro
@@ -1,10 +1,9 @@
1#CONFIG = qt warn_on 1CONFIG = qt warn_on quick-app
2CONFIG = qt warn_on quick-app
3HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h 2HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h
4SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.cpp main.cpp 3SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.cpp main.cpp
5INCLUDEPATH += $(OPIEDIR)/include 4INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include 5DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lqpe -lopiecore2 -lopieui2 -lcrypt 6LIBS += -lqpe -lopiecore2 -lopieui2 -lcrypt
8TARGET = usermanager 7TARGET = usermanager
9 8
10include ( $(OPIEDIR)/include.pro ) 9include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/styles/liquid/config.in b/noncore/styles/liquid/config.in
index 23f8637..cffdb39 100644
--- a/noncore/styles/liquid/config.in
+++ b/noncore/styles/liquid/config.in
@@ -1,4 +1,4 @@
1 config LIQUID 1 config LIQUID
2 boolean "opie-liquid (Mosfet's well known Liquid GUI style from KDE)" 2 boolean "opie-liquid (Mosfet's well known Liquid GUI style from KDE)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBQTAUX 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBQTAUX && LIBOPIE2CORE
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index bac882c..51814e7 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -2,55 +2,60 @@
2 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. 2 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
3 */ 3 */
4 4
5// 5//
6// (c) 2002 Robert 'sandman' Griebl 6// (c) 2002 Robert 'sandman' Griebl
7// 7//
8 8
9 9
10#ifndef INCLUDE_MENUITEM_DEF 10#ifndef INCLUDE_MENUITEM_DEF
11#define INCLUDE_MENUITEM_DEF 11#define INCLUDE_MENUITEM_DEF
12#endif 12#endif
13 13
14#include <qmenudata.h>
15#include "liquid.h" 14#include "liquid.h"
16//#include "liquiddeco.h" 15#include "effects.h"
17#include <qapplication.h> 16#include "htmlmasks.h"
17#include "embeddata.h"
18
19/* OPIE */
20#include <opie2/odebug.h>
18#include <qpe/config.h> 21#include <qpe/config.h>
19#include "effects.h" 22using namespace Opie::Core;
23
24/* QT */
25#include <qmenudata.h>
26#include <qapplication.h>
20#include <qpalette.h> 27#include <qpalette.h>
21#include <qbitmap.h> 28#include <qbitmap.h>
22#include <qtabbar.h> 29#include <qtabbar.h>
23#include <qpopupmenu.h> 30#include <qpopupmenu.h>
24#include <qobjectlist.h> 31#include <qobjectlist.h>
25#include <qimage.h> 32#include <qimage.h>
26#include <qtimer.h> 33#include <qtimer.h>
27#include <qpixmapcache.h> 34#include <qpixmapcache.h>
28#include <qradiobutton.h> 35#include <qradiobutton.h>
29#include <qcombobox.h> 36#include <qcombobox.h>
30#include <qdrawutil.h> 37#include <qdrawutil.h>
31#include <qwidgetlist.h> 38#include <qwidgetlist.h>
32#include <qtoolbutton.h> 39#include <qtoolbutton.h>
33#include <qheader.h> 40#include <qheader.h>
34#include <unistd.h>
35#include <qmenubar.h> 41#include <qmenubar.h>
36#include <qprogressbar.h> 42#include <qprogressbar.h>
37#include <qlineedit.h> 43#include <qlineedit.h>
38#include <qlistbox.h> 44#include <qlistbox.h>
39 45
46/* STD */
47#include <unistd.h>
40#include <stdio.h> 48#include <stdio.h>
41 49
42#include "htmlmasks.h"
43#include "embeddata.h"
44
45 50
46typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 51typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
47 QColorGroup &, bool, bool); 52 QColorGroup &, bool, bool);
48 53
49QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 54QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
50 55
51void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 56void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
52{ 57{
53 QImage img(pix.convertToImage()); 58 QImage img(pix.convertToImage());
54 QImageEffect::fade(img, 0.9, color); 59 QImageEffect::fade(img, 0.9, color);
55 int x, y; 60 int x, y;
56 int r, g, b; 61 int r, g, b;
@@ -140,25 +145,25 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
140 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 145 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
141 QWidget *wid = (QWidget *) it.current ( ); 146 QWidget *wid = (QWidget *) it.current ( );
142 147
143 wid-> setBackgroundPixmap(*pix); 148 wid-> setBackgroundPixmap(*pix);
144 wid-> setBackgroundOrigin(QWidget::ParentOrigin); 149 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
145 } 150 }
146 delete ol; 151 delete ol;
147 } 152 }
148 } 153 }
149 else if(ev->type() == QEvent::Hide){ 154 else if(ev->type() == QEvent::Hide){
150 if(type == TransStippleBg || type == TransStippleBtn || 155 if(type == TransStippleBg || type == TransStippleBtn ||
151 type == Custom){ 156 type == Custom){
152// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 157// owarn << "Deleting menu pixmap, width " << pixDict.find(p->winId())->width() << "" << oendl;
153 158
154 pixDict.remove(p->winId()); 159 pixDict.remove(p->winId());
155 if ( !p->inherits("QPopupMenu")) 160 if ( !p->inherits("QPopupMenu"))
156 p->setBackgroundMode(QWidget::PaletteBackground); 161 p->setBackgroundMode(QWidget::PaletteBackground);
157 162
158 QObjectList *ol = p-> queryList("QWidget"); 163 QObjectList *ol = p-> queryList("QWidget");
159 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 164 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
160 QWidget *wid = (QWidget *) it.current ( ); 165 QWidget *wid = (QWidget *) it.current ( );
161 166
162 wid-> setBackgroundMode( QWidget::PaletteBackground ); 167 wid-> setBackgroundMode( QWidget::PaletteBackground );
163 } 168 }
164 delete ol; 169 delete ol;
@@ -485,25 +490,25 @@ void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c,
485 490
486 491
487 492
488} 493}
489 494
490 495
491QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, 496QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v,
492 bool blend) 497 bool blend)
493{ 498{
494 QImage img(qembed_findImage(label)); 499 QImage img(qembed_findImage(label));
495 img.detach(); 500 img.detach();
496 if(img.isNull()){ // shouldn't happen, been tested 501 if(img.isNull()){ // shouldn't happen, been tested
497 qWarning("Invalid embedded label %s", label); 502 owarn << "Invalid embedded label " << label << "" << oendl;
498 return(NULL); 503 return(NULL);
499 } 504 }
500 if(img.depth() != 32) 505 if(img.depth() != 32)
501 img = img.convertDepth(32); 506 img = img.convertDepth(32);
502 unsigned int *data = (unsigned int *)img.bits(); 507 unsigned int *data = (unsigned int *)img.bits();
503 int total = img.width()*img.height(); 508 int total = img.width()*img.height();
504 int current; 509 int current;
505 QColor c; 510 QColor c;
506 int oldH, oldS, oldV; 511 int oldH, oldS, oldV;
507 int alpha; 512 int alpha;
508 if(v < 235) 513 if(v < 235)
509 v += 20; 514 v += 20;
@@ -851,25 +856,25 @@ void LiquidStyle::polish(QWidget *w)
851 } 856 }
852 w-> installEventFilter ( this ); 857 w-> installEventFilter ( this );
853 } 858 }
854 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { 859 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) {
855 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); 860 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame );
856 } 861 }
857 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 862 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
858 return; 863 return;
859 } 864 }
860 865
861 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 866 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
862 palette().active().brush(QColorGroup::Background).pixmap()){ 867 palette().active().brush(QColorGroup::Background).pixmap()){
863 qWarning("No parent pixmap for child widget %s", w->className()); 868 owarn << "No parent pixmap for child widget " << w->className() << "" << oendl;
864 return; 869 return;
865 } 870 }
866 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 871 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
867 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 872 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
868 if(w->backgroundMode() == QWidget::PaletteBackground || 873 if(w->backgroundMode() == QWidget::PaletteBackground ||
869 w->backgroundMode() == QWidget::PaletteButton){ 874 w->backgroundMode() == QWidget::PaletteButton){
870 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); 875 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/);
871 w->setBackgroundOrigin(QWidget::ParentOrigin); 876 w->setBackgroundOrigin(QWidget::ParentOrigin);
872 // w->setBackgroundMode(QWidget::NoBackground); 877 // w->setBackgroundMode(QWidget::NoBackground);
873 } 878 }
874 } 879 }
875 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 880 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
diff --git a/noncore/styles/liquid/liquid.pro b/noncore/styles/liquid/liquid.pro
index 7fe2829..767007f 100644
--- a/noncore/styles/liquid/liquid.pro
+++ b/noncore/styles/liquid/liquid.pro
@@ -1,19 +1,19 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = qt plugin embedded warn_on 2CONFIG = qt plugin embedded warn_on
3SOURCES = liquid.cpp \ 3SOURCES = liquid.cpp \
4 effects.cpp \ 4 effects.cpp \
5 liquidset.cpp \ 5 liquidset.cpp \
6 plugin.cpp 6 plugin.cpp
7 7
8HEADERS = liquid.h \ 8HEADERS = liquid.h \
9 effects.h \ 9 effects.h \
10 liquidset.h \ 10 liquidset.h \
11 plugin.h 11 plugin.h
12 12
13LIBS += -lqpe -lqtaux2 13LIBS += -lqpe -lqtaux2 -lopiecore2
14INCLUDEPATH += $(OPIEDIR)/include 14INCLUDEPATH += $(OPIEDIR)/include
15DESTDIR = $(OPIEDIR)/plugins/styles 15DESTDIR = $(OPIEDIR)/plugins/styles
16TARGET = liquid 16TARGET = liquid
17VERSION = 1.0.0 17VERSION = 1.0.1
18 18
19include ( $(OPIEDIR)/include.pro ) 19include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/styles/theme/othemebase.cpp b/noncore/styles/theme/othemebase.cpp
index 62b3a11..7ce4e5a 100644
--- a/noncore/styles/theme/othemebase.cpp
+++ b/noncore/styles/theme/othemebase.cpp
@@ -6,42 +6,44 @@
6 License version 2 as published by the Free Software Foundation. 6 License version 2 as published by the Free Software Foundation.
7 7
8 This library is distributed in the hope that it will be useful, 8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details. 11 Library General Public License for more details.
12 12
13 You should have received a copy of the GNU Library General Public License 13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to 14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 Boston, MA 02111-1307, USA. 16 Boston, MA 02111-1307, USA.
17*/ 17*/
18
18#include "othemebase.h" 19#include "othemebase.h"
19#include "ogfxeffect.h" 20#include "ogfxeffect.h"
21
22/* OPIE */
23#include <opie2/odebug.h>
20#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
21//#include <kdebug.h> 25#include <qpe/config.h>
22//#include <klocale.h> 26using namespace Opie::Core;
23#include <qpe/config.h> 27
24//#include <kglobal.h> 28/* QT */
25//#include <kglobalsettings.h>
26//#include <kstddirs.h>
27#include <qfile.h> 29#include <qfile.h>
28#include <qtextstream.h> 30#include <qtextstream.h>
29#include <qdir.h> 31#include <qdir.h>
30#include <qpainter.h> 32#include <qpainter.h>
31#include <qbitmap.h> 33#include <qbitmap.h>
32#include <stdlib.h>
33#include <qstringlist.h> 34#include <qstringlist.h>
34 35
35#include <stdio.h> 36/* STD */
37#include <stdlib.h>
36 38
37 39
38template class QIntCache<OThemePixmap> 40template class QIntCache<OThemePixmap>
39; 41;
40 42
41static const char *widgetEntries[] = 43static const char *widgetEntries[] =
42 { // unsunken widgets (see header) 44 { // unsunken widgets (see header)
43 "PushButton", "ComboBox", "HSBarSlider", "VSBarSlider", "Bevel", "ToolButton", 45 "PushButton", "ComboBox", "HSBarSlider", "VSBarSlider", "Bevel", "ToolButton",
44 "ScrollButton", "HScrollDeco", "VScrollDeco", "ComboDeco", "MenuItem", "Tab", 46 "ScrollButton", "HScrollDeco", "VScrollDeco", "ComboDeco", "MenuItem", "Tab",
45 "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", 47 "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight",
46 // sunken widgets 48 // sunken widgets
47 "PushButtonDown", "ComboBoxDown", "HSBarSliderDown", "VSBarSliderDown", 49 "PushButtonDown", "ComboBoxDown", "HSBarSliderDown", "VSBarSliderDown",
@@ -253,58 +255,51 @@ void OThemeBase::readConfig( Qt::GUIStyle /*style*/ )
253 QString pixnames[ WIDGETS ]; // used for duplicate check 255 QString pixnames[ WIDGETS ]; // used for duplicate check
254 QString brdnames[ WIDGETS ]; 256 QString brdnames[ WIDGETS ];
255 bool loaded[ WIDGETS ]; // used for preloading for CopyWidget 257 bool loaded[ WIDGETS ]; // used for preloading for CopyWidget
256 258
257 if ( configFileName.isEmpty() ) { 259 if ( configFileName.isEmpty() ) {
258 Config cfg ( "qpe" ); 260 Config cfg ( "qpe" );
259 cfg. setGroup ( "Appearance" ); 261 cfg. setGroup ( "Appearance" );
260 262
261 configFileName = cfg. readEntry ( "Theme", "default" ); 263 configFileName = cfg. readEntry ( "Theme", "default" );
262 } 264 }
263 Config config( configFilePath + "/themes/" + configFileName + ".themerc" , Config::File ); 265 Config config( configFilePath + "/themes/" + configFileName + ".themerc" , Config::File );
264 266
265 //printf ( "Opened config file: %s\n", ( configFilePath + "/themes/" + configFileName + ".themerc" ). ascii());
266
267 // Are we initalized? 267 // Are we initalized?
268 applyMiscResourceGroup( &config ); 268 applyMiscResourceGroup( &config );
269 for ( i = 0; i < INHERIT_ITEMS; ++i ) { 269 for ( i = 0; i < INHERIT_ITEMS; ++i ) {
270 applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); 270 applyResourceGroup( &config, i, copyfrom, pixnames, brdnames );
271 // printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() );
272 } 271 }
273 for ( ; i < INHERIT_ITEMS*2; ++i ) { 272 for ( ; i < INHERIT_ITEMS*2; ++i ) {
274 if ( config.hasGroup( QString( widgetEntries[ i ] ) ) ) { 273 if ( config.hasGroup( QString( widgetEntries[ i ] ) ) ) {
275 applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); 274 applyResourceGroup( &config, i, copyfrom, pixnames, brdnames );
276 // printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() );
277 } 275 }
278 else { 276 else {
279 copyfrom [ i ] = widgetEntries[ i - INHERIT_ITEMS ]; 277 copyfrom [ i ] = widgetEntries[ i - INHERIT_ITEMS ];
280 // printf ( "%d [%s]: copy=%s\n", i, widgetEntries [i], copyfrom [i].latin1());
281 } 278 }
282 } 279 }
283 for ( ; i < WIDGETS; ++i ) { 280 for ( ; i < WIDGETS; ++i ) {
284 applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); 281 applyResourceGroup( &config, i, copyfrom, pixnames, brdnames );
285 // printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() );
286 } 282 }
287 283
288 // initalize defaults that may not be read 284 // initalize defaults that may not be read
289 for ( i = 0; i < WIDGETS; ++i ) 285 for ( i = 0; i < WIDGETS; ++i )
290 loaded[ i ] = false; 286 loaded[ i ] = false;
291 btnXShift = btnYShift = focus3DOffset = 0; 287 btnXShift = btnYShift = focus3DOffset = 0;
292 aTabLine = iTabLine = true; 288 aTabLine = iTabLine = true;
293 roundedButton = roundedCombo = roundedSlider = focus3D = false; 289 roundedButton = roundedCombo = roundedSlider = focus3D = false;
294 splitterWidth = 10; 290 splitterWidth = 10;
295 291
296 for ( i = 0; i < WIDGETS; ++i ) { 292 for ( i = 0; i < WIDGETS; ++i ) {
297 readResourceGroup( i, copyfrom, pixnames, brdnames, loaded ); 293 readResourceGroup( i, copyfrom, pixnames, brdnames, loaded );
298 // printf ( "%d [%s]: copy=%s, pix=%s, brd=%s, colors=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1(), (colors[i]?colors[i]->background().name().latin1():"<none)" ));
299 } 294 }
300 295
301 // misc items 296 // misc items
302 readMiscResourceGroup(); 297 readMiscResourceGroup();
303 298
304 // Handle preblend items 299 // Handle preblend items
305 for ( i = 0; i < PREBLEND_ITEMS; ++i ) { 300 for ( i = 0; i < PREBLEND_ITEMS; ++i ) {
306 if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 ) 301 if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 )
307 blend( preBlend[ i ] ); 302 blend( preBlend[ i ] );
308 } 303 }
309} 304}
310 305
@@ -398,25 +393,25 @@ OThemePixmap* OThemeBase::loadPixmap( QString &name )
398OThemePixmap* OThemeBase::scale( int w, int h, WidgetType widget ) 393OThemePixmap* OThemeBase::scale( int w, int h, WidgetType widget )
399{ 394{
400 if ( scaleHints[ widget ] == FullScale ) { 395 if ( scaleHints[ widget ] == FullScale ) {
401 if ( !pixmaps[ widget ] || pixmaps[ widget ] ->width() != w || 396 if ( !pixmaps[ widget ] || pixmaps[ widget ] ->width() != w ||
402 pixmaps[ widget ] ->height() != h ) { 397 pixmaps[ widget ] ->height() != h ) {
403 OThemePixmap * cachePix = cache->pixmap( w, h, widget ); 398 OThemePixmap * cachePix = cache->pixmap( w, h, widget );
404 if ( cachePix ) { 399 if ( cachePix ) {
405 cachePix = new OThemePixmap( *cachePix ); 400 cachePix = new OThemePixmap( *cachePix );
406 if ( pixmaps[ widget ] ) 401 if ( pixmaps[ widget ] )
407 cache->insert( pixmaps[ widget ], OThemeCache::FullScale, 402 cache->insert( pixmaps[ widget ], OThemeCache::FullScale,
408 widget ); 403 widget );
409 else 404 else
410 qDebug( "We would have inserted a null pixmap!\n" ); 405 odebug << "We would have inserted a null pixmap!\n" << oendl;
411 pixmaps[ widget ] = cachePix; 406 pixmaps[ widget ] = cachePix;
412 } 407 }
413 else { 408 else {
414 cache->insert( pixmaps[ widget ], OThemeCache::FullScale, widget ); 409 cache->insert( pixmaps[ widget ], OThemeCache::FullScale, widget );
415 QImage tmpImg = images[ widget ] ->smoothScale( w, h ); 410 QImage tmpImg = images[ widget ] ->smoothScale( w, h );
416 pixmaps[ widget ] = new OThemePixmap; 411 pixmaps[ widget ] = new OThemePixmap;
417 pixmaps[ widget ] ->convertFromImage( tmpImg ); 412 pixmaps[ widget ] ->convertFromImage( tmpImg );
418 if ( blends[ widget ] != 0.0 ) 413 if ( blends[ widget ] != 0.0 )
419 blend( widget ); 414 blend( widget );
420 } 415 }
421 } 416 }
422 } 417 }
diff --git a/noncore/todayplugins/fortune/fortune.pro b/noncore/todayplugins/fortune/fortune.pro
index 2e4b4b3..74c60b1 100644
--- a/noncore/todayplugins/fortune/fortune.pro
+++ b/noncore/todayplugins/fortune/fortune.pro
@@ -1,14 +1,13 @@
1TEMPLATE = lib 1TEMPLATE = lib
2#CONFIG -= moc
3CONFIG += qt plugin 2CONFIG += qt plugin
4 3
5# Input 4# Input
6HEADERS = fortuneplugin.h fortunepluginimpl.h \ 5HEADERS = fortuneplugin.h fortunepluginimpl.h \
7 fortunepluginwidget.h 6 fortunepluginwidget.h
8SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \ 7SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \
9 fortunepluginwidget.cpp 8 fortunepluginwidget.cpp
10 9
11INCLUDEPATH += $(OPIEDIR)/include \ 10INCLUDEPATH += $(OPIEDIR)/include \
12 ../ ../library 11 ../ ../library
13DEPENDPATH += $(OPIEDIR)/include \ 12DEPENDPATH += $(OPIEDIR)/include \
14 ../ ../library 13 ../ ../library
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp
index c3ee546..c147567 100644
--- a/noncore/todayplugins/fortune/fortunepluginwidget.cpp
+++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp
@@ -7,36 +7,39 @@
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "fortunepluginwidget.h" 17#include "fortunepluginwidget.h"
18 18
19/* OPIE */
20#include <opie2/odebug.h>
19#include <qpe/config.h> 21#include <qpe/config.h>
20#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23using namespace Opie::Core;
24using namespace Opie::Ui;
21 25
26/* QT */
22#include <qvaluelist.h> 27#include <qvaluelist.h>
23#include <qtl.h> 28#include <qtl.h>
24#include <qstring.h> 29#include <qstring.h>
25#include <qscrollview.h> 30#include <qscrollview.h>
26#include <qobject.h> 31#include <qobject.h>
27#include <qlayout.h> 32#include <qlayout.h>
28 33
29using namespace Opie::Core;
30using namespace Opie::Ui;
31FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) 34FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name )
32 : QWidget( parent, name ) 35 : QWidget( parent, name )
33{ 36{
34 37
35 fortune = NULL; 38 fortune = NULL;
36 getFortune(); 39 getFortune();
37} 40}
38 41
39FortunePluginWidget::~FortunePluginWidget() { 42FortunePluginWidget::~FortunePluginWidget() {
40 if( fortuneProcess ){ 43 if( fortuneProcess ){
41 delete fortuneProcess; 44 delete fortuneProcess;
42 } 45 }
@@ -58,25 +61,25 @@ void FortunePluginWidget::getFortune() {
58 //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); 61 //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
59 62
60 fortune->setText( QString("Obtaining fortune...") ); 63 fortune->setText( QString("Obtaining fortune...") );
61 layoutFortune->addWidget( fortune ); 64 layoutFortune->addWidget( fortune );
62 65
63 fortuneProcess = new OProcess(); 66 fortuneProcess = new OProcess();
64 *fortuneProcess << "fortune"; 67 *fortuneProcess << "fortune";
65 68
66 connect(fortuneProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), 69 connect(fortuneProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ),
67 this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int) ) ); 70 this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int) ) );
68 71
69 if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 72 if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
70 qWarning("could not start :("); 73 owarn << "could not start :(" << oendl;
71 fortune->setText( QString("Failed to obtain fortune.") ); 74 fortune->setText( QString("Failed to obtain fortune.") );
72 delete fortuneProcess; 75 delete fortuneProcess;
73 fortuneProcess = 0; 76 fortuneProcess = 0;
74 } 77 }
75 78
76} 79}
77 80
78void FortunePluginWidget::slotStdOut( OProcess* /*proc*/, char* buf, int len ) 81void FortunePluginWidget::slotStdOut( OProcess* /*proc*/, char* buf, int len )
79{ 82{
80 QCString s( buf, len ); 83 QCString s( buf, len );
81 s.replace( QRegExp("\n"), "" ); 84 s.replace( QRegExp("\n"), "" );
82 fortune->setText( s ); 85 fortune->setText( s );
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
index ce35256..ae219d7 100644
--- a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
+++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
@@ -1,33 +1,35 @@
1#include "inputDialog.h" 1#include "inputDialog.h"
2#include "helpwindow.h"
3
4/* OPIE */
5#include <opie2/odebug.h>
6#include <qpe/config.h>
7using namespace Opie::Core;
2 8
9/* QT */
3#include <qapplication.h> 10#include <qapplication.h>
4#include <qlayout.h> 11#include <qlayout.h>
5#include <qcheckbox.h> 12#include <qcheckbox.h>
6#include <qlineedit.h> 13#include <qlineedit.h>
7#include <qvariant.h> 14#include <qvariant.h>
8#include <qpushbutton.h> 15#include <qpushbutton.h>
9#include <qwhatsthis.h> 16#include <qwhatsthis.h>
10#include <qlabel.h> 17#include <qlabel.h>
11#include <qlayout.h> 18#include <qlayout.h>
12#include <qpe/config.h>
13#include <qstringlist.h> 19#include <qstringlist.h>
14using namespace Opie::Core;
15using namespace Opie::Core;
16#include <qmainwindow.h> 20#include <qmainwindow.h>
17#include "helpwindow.h"
18 21
22/* STD */
19#include <stdlib.h> 23#include <stdlib.h>
20// #include <sys/stat.h>
21// #include <unistd.h>
22 24
23InputDialog::InputDialog( ) 25InputDialog::InputDialog( )
24 : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { 26 : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) {
25 setCaption( tr("Symbol Lookup")); 27 setCaption( tr("Symbol Lookup"));
26 28
27 QGridLayout *layout = new QGridLayout( this ); 29 QGridLayout *layout = new QGridLayout( this );
28 layout->setSpacing(6); 30 layout->setSpacing(6);
29 layout->setMargin( 2); 31 layout->setMargin( 2);
30 32
31 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 33 LineEdit1 = new QLineEdit( this, "LineEdit1" );
32 LineEdit1->setFocus(); 34 LineEdit1->setFocus();
33 35
@@ -45,44 +47,44 @@ InputDialog::InputDialog( )
45 47
46} 48}
47 49
48InputDialog::~InputDialog() { 50InputDialog::~InputDialog() {
49} 51}
50 52
51void InputDialog::doLookup() { 53void InputDialog::doLookup() {
52// http://finance.yahoo.com/l?m=&s=siemens&t= 54// http://finance.yahoo.com/l?m=&s=siemens&t=
53 55
54 QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; 56 QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\"";
55 QString tempHtml = "/tmp/stockticker.html"; 57 QString tempHtml = "/tmp/stockticker.html";
56 QString cmd = "wget -O "+tempHtml+" "+url; 58 QString cmd = "wget -O "+tempHtml+" "+url;
57 qDebug(cmd); 59 odebug << cmd << oendl;
58 60
59 61
60/* 62/*
61 OProcess proc; 63 OProcess proc;
62 proc << "/usr/bin/wget"; 64 proc << "/usr/bin/wget";
63 proc<<"-O"<< tempHtml<< url; 65 proc<<"-O"<< tempHtml<< url;
64 66
65 connect( &proc, SIGNAL( processExited(Opie::Core::OProcess*)),this, SLOT( showBrowser(Opie::Core::OProcess*))); 67 connect( &proc, SIGNAL( processExited(Opie::Core::OProcess*)),this, SLOT( showBrowser(Opie::Core::OProcess*)));
66 proc.start( OProcess::NotifyOnExit); 68 proc.start( OProcess::NotifyOnExit);
67*/ 69*/
68 system(cmd.latin1()); 70 system(cmd.latin1());
69 HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); 71 HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup");
70 StockLookup->setCaption("Symbol"); 72 StockLookup->setCaption("Symbol");
71 StockLookup->showMaximized(); 73 StockLookup->showMaximized();
72 StockLookup->show(); 74 StockLookup->show();
73 LineEdit1->text(); 75 LineEdit1->text();
74 76
75 77
76} 78}
77 79
78void InputDialog::showBrowser(OProcess*) { 80void InputDialog::showBrowser(OProcess*) {
79 qDebug("BLAH"); 81 odebug << "BLAH" << oendl;
80 QString tempHtml = "/tmp/stockticker.html"; 82 QString tempHtml = "/tmp/stockticker.html";
81 83
82 HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); 84 HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup");
83 StockLookup->setCaption("Symbol"); 85 StockLookup->setCaption("Symbol");
84 StockLookup->showMaximized(); 86 StockLookup->showMaximized();
85 StockLookup->show(); 87 StockLookup->show();
86 LineEdit1->text(); 88 LineEdit1->text();
87 89
88} 90}
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/config.in b/noncore/todayplugins/stockticker/stocktickerlib/config.in
index 4d589f9..7dbe03a 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/config.in
+++ b/noncore/todayplugins/stockticker/stocktickerlib/config.in
@@ -1,4 +1,4 @@
1config TODAY_STOCKTICKERLIB 1config TODAY_STOCKTICKERLIB
2 boolean 2 boolean
3 default "y" if TODAY_STOCKTICKER 3 default "y" if TODAY_STOCKTICKER
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && LIBOPIE2PIM && TODAY 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM && TODAY
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro
index e70d1c0..6dcf945 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro
@@ -1,29 +1,28 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG -= moc
3CONFIG += qt plugin 2CONFIG += qt plugin
4 3
5HEADERS = stocktickerplugin.h stocktickerpluginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \ 4HEADERS = stocktickerplugin.h stocktickerpluginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \
6 ../libstocks/csv.h \ 5 ../libstocks/csv.h \
7 ../libstocks/http.h \ 6 ../libstocks/http.h \
8 ../libstocks/lists.h \ 7 ../libstocks/lists.h \
9 ../libstocks/stocks.h 8 ../libstocks/stocks.h
10SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \ 9SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \
11 ../libstocks/csv.c \ 10 ../libstocks/csv.c \
12 ../libstocks/currency.c \ 11 ../libstocks/currency.c \
13 ../libstocks/history.c \ 12 ../libstocks/history.c \
14 ../libstocks/http.c \ 13 ../libstocks/http.c \
15 ../libstocks/lists.c \ 14 ../libstocks/lists.c \
16 ../libstocks/stocks.c 15 ../libstocks/stocks.c
17 16
18INCLUDEPATH += $(OPIEDIR)/include \ 17INCLUDEPATH += $(OPIEDIR)/include \
19 ../ ../library 18 ../ ../library
20DEPENDPATH += $(OPIEDIR)/include \ 19DEPENDPATH += $(OPIEDIR)/include \
21 ../ ../library 20 ../ ../library
22 21
23LIBS+= -lqpe -lopieui2 -lopiepim2 -lpthread 22LIBS += -lqpe -lopiecore2 -lopieui2 -lopiepim2 -lpthread
24TMAKE_CFLAGS += -D__UNIX__ 23DEFINES += __UNIX__
25 24
26DESTDIR = $(OPIEDIR)/plugins/today 25DESTDIR = $(OPIEDIR)/plugins/today
27TARGET = todaystocktickerplugin 26TARGET = todaystocktickerplugin
28 27
29include ( $(OPIEDIR)/include.pro ) 28include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
index aaeb5ee..4855ac6 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
@@ -36,25 +36,25 @@ extern "C" {
36 bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; 36 bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck;
37 bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; 37 bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck;
38 bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; 38 bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck;
39 39
40void getStocks(char *blah) { 40void getStocks(char *blah) {
41 41
42 // stocktickerTicker->setText( "Downloading stock data."); 42 // stocktickerTicker->setText( "Downloading stock data.");
43 stock *stocks_quotes=NULL; 43 stock *stocks_quotes=NULL;
44 stock *stocks_tmp; 44 stock *stocks_tmp;
45 stock_liste = blah; 45 stock_liste = blah;
46 ::free ( blah ); 46 ::free ( blah );
47 // char *stock_liste = (char *)blah->latin1(); 47 // char *stock_liste = (char *)blah->latin1();
48 // qDebug("%s", stock_liste.data() ); 48 // odebug << "" << stock_liste.data() << "" << oendl;
49 output = ""; 49 output = "";
50 QString tempString; 50 QString tempString;
51 libstocks_return_code error; 51 libstocks_return_code error;
52 52
53// Config cfg( "stockticker"); 53// Config cfg( "stockticker");
54// cfg.setGroup( "Fields" ); 54// cfg.setGroup( "Fields" );
55// bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; 55// bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck;
56// bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; 56// bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck;
57// bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; 57// bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck;
58 58
59 dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; 59 dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false;
60 60
@@ -269,51 +269,51 @@ void getStocks(char *blah) {
269 269
270 //::free((void*)thread1); 270 //::free((void*)thread1);
271 //getStocks(blah); 271 //getStocks(blah);
272 } 272 }
273 } 273 }
274 274
275 void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { 275 void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) {
276 killTimer(e->timerId()); 276 killTimer(e->timerId());
277 checkConnection(); 277 checkConnection();
278 } 278 }
279 279
280 void StockTickerPluginWidget::checkConnection() { 280 void StockTickerPluginWidget::checkConnection() {
281 // qDebug("checking connection"); 281 // odebug << "checking connection" << oendl;
282 // Sock = new QSocket( this ); 282 // Sock = new QSocket( this );
283 283
284 // if( wasError) 284 // if( wasError)
285 // stocktickerTicker->setText("Checking connection"); 285 // stocktickerTicker->setText("Checking connection");
286 286
287 // if(Sock->state() == QSocket::Idle) { 287 // if(Sock->state() == QSocket::Idle) {
288 // Sock->connectToHost("finance.yahoo.com", 80); 288 // Sock->connectToHost("finance.yahoo.com", 80);
289 // connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) ); 289 // connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) );
290 // connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) ); 290 // connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) );
291 // } else { 291 // } else {
292 // qDebug("State is not Idle"); 292 // odebug << "State is not Idle" << oendl;
293 isConnected(); 293 isConnected();
294 // } 294 // }
295 } 295 }
296 296
297 void StockTickerPluginWidget::isConnected() { 297 void StockTickerPluginWidget::isConnected() {
298 // qDebug("We connect, so ok to grab stocks"); 298 // odebug << "We connect, so ok to grab stocks" << oendl;
299 if(this->isVisible()) 299 if(this->isVisible())
300 doStocks(); 300 doStocks();
301 301
302 Config cfg( "stockticker"); 302 Config cfg( "stockticker");
303 cfg.setGroup("Timer"); 303 cfg.setGroup("Timer");
304 timerDelay= cfg.readNumEntry("Delay",0); 304 timerDelay= cfg.readNumEntry("Delay",0);
305 if(timerDelay > 0) 305 if(timerDelay > 0)
306 startTimer(timerDelay*60000); 306 startTimer(timerDelay*60000);
307 // qDebug("timer set for %d",(timerDelay*60000)/60000); 307 // odebug << "timer set for " << (timerDelay*60000)/60000 << "" << oendl;
308 wasError = false; 308 wasError = false;
309 309
310 // Sock->close(); 310 // Sock->close();
311 } 311 }
312 312
313 void StockTickerPluginWidget::socketError(int errcode) { 313 void StockTickerPluginWidget::socketError(int errcode) {
314 switch(errcode) { 314 switch(errcode) {
315 case QSocket::ErrConnectionRefused: 315 case QSocket::ErrConnectionRefused:
316 output = tr("Connection refused."); 316 output = tr("Connection refused.");
317 break; 317 break;
318 case QSocket::ErrHostNotFound: 318 case QSocket::ErrHostNotFound:
319 output = tr("Could not find server."); 319 output = tr("Could not find server.");
diff --git a/noncore/tools/calc2/engine.cpp b/noncore/tools/calc2/engine.cpp
index a9a47c4..e843e29 100644
--- a/noncore/tools/calc2/engine.cpp
+++ b/noncore/tools/calc2/engine.cpp
@@ -92,25 +92,25 @@ void Engine::pushValue (char v)
92 case rDouble: 92 case rDouble:
93 displayString.append(v); 93 displayString.append(v);
94 num.dbl=displayString.toDouble(&ok); 94 num.dbl=displayString.toDouble(&ok);
95 break; 95 break;
96 case rFraction: 96 case rFraction:
97 break; 97 break;
98 default: 98 default:
99 displayString.append(v); 99 displayString.append(v);
100 num.i=displayString.toInt(&ok, calcBase()); 100 num.i=displayString.toInt(&ok, calcBase());
101 }; 101 };
102 if (!ok) { 102 if (!ok) {
103 state = sError; 103 state = sError;
104 qDebug("pushValue() - num->string conversion"); 104 odebug << "pushValue() - num->string conversion" << oendl;
105 } else { 105 } else {
106 const QString constString = displayString; 106 const QString constString = displayString;
107 emit(display(constString)); 107 emit(display(constString));
108 }; 108 };
109 109
110 } else if (state == sStart) { 110 } else if (state == sStart) {
111 softReset(); 111 softReset();
112 displayString.truncate(0); 112 displayString.truncate(0);
113 state = sAppend; 113 state = sAppend;
114 pushValue (v); 114 pushValue (v);
115 } else if (state == sError) { 115 } else if (state == sError) {
116 qDebug ("in error state"); 116 qDebug ("in error state");
@@ -118,70 +118,70 @@ void Engine::pushValue (char v)
118 } 118 }
119} 119}
120 120
121void Engine::del () 121void Engine::del ()
122{ 122{
123 bool ok; 123 bool ok;
124 switch (currentRep) { 124 switch (currentRep) {
125 case rDouble: 125 case rDouble:
126 displayString.truncate(displayString.length()); 126 displayString.truncate(displayString.length());
127 num.dbl=displayString.toDouble(&ok); 127 num.dbl=displayString.toDouble(&ok);
128 break; 128 break;
129 case rFraction: 129 case rFraction:
130 qDebug("not available"); 130 odebug << "not available" << oendl;
131 break; 131 break;
132 default: 132 default:
133 displayString.truncate(displayString.length()); 133 displayString.truncate(displayString.length());
134 num.i = displayString.toInt(&ok, calcBase()); 134 num.i = displayString.toInt(&ok, calcBase());
135 }; 135 };
136 136
137 if (!ok) { 137 if (!ok) {
138 state = sError; 138 state = sError;
139 qDebug("del() - num->string conversion"); 139 odebug << "del() - num->string conversion" << oendl;
140 } else { 140 } else {
141 const QString constString = displayString; 141 const QString constString = displayString;
142 emit(display(constString)); 142 emit(display(constString));
143 }; 143 };
144} 144}
145 145
146void Engine::displayData(Data d) { 146void Engine::displayData(Data d) {
147 switch (currentRep) { 147 switch (currentRep) {
148 case rDouble: 148 case rDouble:
149 displayString.setNum(d.dbl); 149 displayString.setNum(d.dbl);
150 break; 150 break;
151 case rFraction: 151 case rFraction:
152 qDebug("fractional display not yet impl"); 152 odebug << "fractional display not yet impl" << oendl;
153 break; 153 break;
154 default: 154 default:
155 displayString.setNum(d.i, calcBase()); 155 displayString.setNum(d.i, calcBase());
156 break; 156 break;
157 }; 157 };
158 const QString constString= displayString; 158 const QString constString= displayString;
159 emit(display(constString)); 159 emit(display(constString));
160} 160}
161 161
162// Returns the base when Rep is an integer type 162// Returns the base when Rep is an integer type
163int Engine::calcBase () { 163int Engine::calcBase () {
164 switch (currentRep) { 164 switch (currentRep) {
165 case rBin: 165 case rBin:
166 return 2; 166 return 2;
167 case rOct: 167 case rOct:
168 return 8; 168 return 8;
169 case rDec: 169 case rDec:
170 return 10; 170 return 10;
171 case rHex: 171 case rHex:
172 return 16; 172 return 16;
173 default: 173 default:
174 state = sError; 174 state = sError;
175 qDebug("Error - attempt to calc base for non-integer"); 175 odebug << "Error - attempt to calc base for non-integer" << oendl;
176 return 10; 176 return 10;
177 }; 177 };
178} 178}
179 179
180// Special instruction for internal use only 180// Special instruction for internal use only
181class iOpenBrace:public Instruction { 181class iOpenBrace:public Instruction {
182 public: 182 public:
183 iOpenBrace (Engine *e):Instruction (100) {engine = e;}; 183 iOpenBrace (Engine *e):Instruction (100) {engine = e;};
184 ~iOpenBrace () {}; 184 ~iOpenBrace () {};
185 185
186 Data eval (Data num) { 186 Data eval (Data num) {
187 engine->decBraces(); 187 engine->decBraces();
diff --git a/noncore/tools/calculator/calculator.pro b/noncore/tools/calculator/calculator.pro
index ae6a666..78d4519 100644
--- a/noncore/tools/calculator/calculator.pro
+++ b/noncore/tools/calculator/calculator.pro
@@ -1,11 +1,11 @@
1 CONFIG = qt warn_on quick-app 1 CONFIG = qt warn_on quick-app
2 HEADERS = calculatorimpl.h 2 HEADERS = calculatorimpl.h
3 SOURCES = calculatorimpl.cpp \ 3 SOURCES = calculatorimpl.cpp \
4 main.cpp 4 main.cpp
5INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
6 DEPENDPATH+= $(OPIEDIR)/include 6 DEPENDPATH+= $(OPIEDIR)/include
7LIBS += -lqpe -lopiecore2 7LIBS += -lqpe -lopiecore2
8 INTERFACES= calculator.ui 8 INTERFACES= calculator.ui
9 TARGET = calculator 9 TARGET = calculator
10 10
11include ( $(OPIEDIR)/include.pro ) 11include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/tools/calculator/calculatorimpl.cpp b/noncore/tools/calculator/calculatorimpl.cpp
index dead03d..05cb9b5 100644
--- a/noncore/tools/calculator/calculatorimpl.cpp
+++ b/noncore/tools/calculator/calculatorimpl.cpp
@@ -17,38 +17,45 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21/* 21/*
22 * 01/14/2002 Charles-Edouard Ruault <ce@ruault.com> 22 * 01/14/2002 Charles-Edouard Ruault <ce@ruault.com>
23 * Added support for Temperature conversions. 23 * Added support for Temperature conversions.
24 */ 24 */
25// Sat 03-09-2002 L.J. Potter added the inlined pixmaps here 25// Sat 03-09-2002 L.J. Potter added the inlined pixmaps here
26 26
27#include "calculatorimpl.h" 27#include "calculatorimpl.h"
28 28
29/* OPIE */
30#include <opie2/odebug.h>
29#include <qpe/resource.h> 31#include <qpe/resource.h>
30#include <qpe/qmath.h> 32#include <qpe/qmath.h>
31#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34using namespace Opie::Core;
32 35
36/* QT */
33#include <qpushbutton.h> 37#include <qpushbutton.h>
34#include <qcombobox.h> 38#include <qcombobox.h>
35#include <qlabel.h> 39#include <qlabel.h>
36#include <qfont.h> 40#include <qfont.h>
37#include <qlayout.h> 41#include <qlayout.h>
38#include <qstringlist.h> 42#include <qstringlist.h>
39#include <qfile.h> 43#include <qfile.h>
40#include <qtextstream.h> 44#include <qtextstream.h>
41#include <qmessagebox.h> 45#include <qmessagebox.h>
46
47/* STD */
42#include <math.h> 48#include <math.h>
49
43/* XPM */ 50/* XPM */
44static char *oneoverx_xpm[] = { 51static char *oneoverx_xpm[] = {
45/* width height num_colors chars_per_pixel */ 52/* width height num_colors chars_per_pixel */
46" 13 11 2 1", 53" 13 11 2 1",
47/* colors */ 54/* colors */
48". c None", 55". c None",
49"# c #000000", 56"# c #000000",
50/* pixels */ 57/* pixels */
51"......#......", 58"......#......",
52".....##......", 59".....##......",
53"......#......" 60"......#......"
54".....###.....", 61".....###.....",
@@ -224,25 +231,25 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
224 231
225 connect(ComboBoxFunction, SIGNAL(activated(int) ), this, SLOT(function_button(int) ) ); 232 connect(ComboBoxFunction, SIGNAL(activated(int) ), this, SLOT(function_button(int) ) );
226 233
227 captions.append(tr("Standard")); 234 captions.append(tr("Standard"));
228 ComboBoxFunction->insertItem(captions.last()); 235 ComboBoxFunction->insertItem(captions.last());
229 236
230 // now add in the conversion modes 237 // now add in the conversion modes
231 // when the menu gets done, these should be in a submenu 238 // when the menu gets done, these should be in a submenu
232 QString tmp = QPEApplication::qpeDir(); 239 QString tmp = QPEApplication::qpeDir();
233 tmp += "etc/unit_conversion.dat"; 240 tmp += "etc/unit_conversion.dat";
234 QFile myfile(tmp); 241 QFile myfile(tmp);
235 if ( !myfile.open( IO_Translate | IO_ReadOnly ) ) { 242 if ( !myfile.open( IO_Translate | IO_ReadOnly ) ) {
236 qDebug("Data file unit_conversion.dat not found\nNo conversion features will be available\n"+tmp); 243 odebug << "Data file unit_conversion.dat not found\nNo conversion features will be available\n"+tmp << oendl;
237 // disable the f button if no conv file available 244 // disable the f button if no conv file available
238 ComboBoxFunction->setEnabled(FALSE); 245 ComboBoxFunction->setEnabled(FALSE);
239 } 246 }
240 else { 247 else {
241 QString line, line2; 248 QString line, line2;
242 QTextStream ts(&myfile); 249 QTextStream ts(&myfile);
243 250
244 // first pass, see how many conversion types there are in order to allocate for them 251 // first pass, see how many conversion types there are in order to allocate for them
245 while ( ! ts.eof() ) { 252 while ( ! ts.eof() ) {
246 line = ts.readLine(); 253 line = ts.readLine();
247 if ( line.contains ("STARTTYPE" ) ) 254 if ( line.contains ("STARTTYPE" ) )
248 conversion_mode_count++; 255 conversion_mode_count++;
@@ -498,25 +505,25 @@ void CalculatorImpl::execOp( Operation i )
498 case oOpenBrace: { 505 case oOpenBrace: {
499 Op op( 0, oOpenBrace ); 506 Op op( 0, oOpenBrace );
500 operationStack.push( op ); 507 operationStack.push( op );
501 numOpenBraces++; 508 numOpenBraces++;
502 state = sNewNumber; 509 state = sNewNumber;
503 return; 510 return;
504 } 511 }
505 case oCloseBrace: { 512 case oCloseBrace: {
506 if ( numOpenBraces == 0 ) 513 if ( numOpenBraces == 0 )
507 return; 514 return;
508 processStack( oAdd ); 515 processStack( oAdd );
509 if ( operationStack.top().operation != oOpenBrace ) 516 if ( operationStack.top().operation != oOpenBrace )
510 qDebug( "Calculator: internal Error" ); 517 odebug << "Calculator: internal Error" << oendl;
511 operationStack.pop(); 518 operationStack.pop();
512 state = sNewNumber; 519 state = sNewNumber;
513 numOpenBraces--; 520 numOpenBraces--;
514 break; 521 break;
515 } 522 }
516 523
517 case oPoint: 524 case oPoint:
518 flPoint = TRUE; 525 flPoint = TRUE;
519 return; 526 return;
520 527
521 case oPercent: 528 case oPercent:
522 processStack( oPercent ); 529 processStack( oPercent );
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp
index 4204d73..642196e 100644
--- a/noncore/tools/formatter/formatter.cpp
+++ b/noncore/tools/formatter/formatter.cpp
@@ -2,48 +2,50 @@
2 ** formatter.cpp 2 ** formatter.cpp
3 ** 3 **
4 ** Copyright: Thu Apr 11 11:01:13 2002 4 ** Copyright: Thu Apr 11 11:01:13 2002
5 ** by: L. J. Potter 5 ** by: L. J. Potter
6 ** 6 **
7 ****************************************************************************/ 7 ****************************************************************************/
8 8
9#include "formatter.h" 9#include "formatter.h"
10#include "inputDialog.h" 10#include "inputDialog.h"
11#include "output.h" 11#include "output.h"
12 12
13/* OPIE */ 13/* OPIE */
14#include <qtoolbar.h> 14#include <opie2/odebug.h>
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17#include <qpe/config.h> 17#include <qpe/config.h>
18#include <qpe/mimetype.h> 18#include <qpe/mimetype.h>
19#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
20#include <qpe/storage.h> 20#include <qpe/storage.h>
21using namespace Opie::Core;
21 22
22/* QT */ 23/* QT */
23#include <qmenubar.h> 24#include <qmenubar.h>
24#include <qmultilineedit.h> 25#include <qmultilineedit.h>
25#include <qstring.h> 26#include <qstring.h>
26#include <qlist.h> 27#include <qlist.h>
27#include <qstringlist.h> 28#include <qstringlist.h>
28#include <qdir.h> 29#include <qdir.h>
29#include <qfile.h> 30#include <qfile.h>
30#include <qtstream.h> 31#include <qtstream.h>
31#include <qcombobox.h> 32#include <qcombobox.h>
32#include <qpopupmenu.h> 33#include <qpopupmenu.h>
33#include <qmessagebox.h> 34#include <qmessagebox.h>
34#include <qregexp.h> 35#include <qregexp.h>
35#include <qlabel.h> 36#include <qlabel.h>
36#include <qlineedit.h> 37#include <qlineedit.h>
37#include <qpushbutton.h> 38#include <qpushbutton.h>
39#include <qtoolbar.h>
38#include <qtabwidget.h> 40#include <qtabwidget.h>
39#include <qwidget.h> 41#include <qwidget.h>
40#include <qlayout.h> 42#include <qlayout.h>
41#include <qvariant.h> 43#include <qvariant.h>
42 44
43/* STD */ 45/* STD */
44#include <unistd.h> 46#include <unistd.h>
45#include <stdio.h> 47#include <stdio.h>
46#include <stdlib.h> 48#include <stdlib.h>
47#include <sys/vfs.h> 49#include <sys/vfs.h>
48#include <mntent.h> 50#include <mntent.h>
49#include <string.h> 51#include <string.h>
@@ -229,92 +231,92 @@ void FormatterApp::doFormat()
229 // cmd = "ls -l"; 231 // cmd = "ls -l";
230 outDlg = new Output(this, tr("Formatter Output"),FALSE); 232 outDlg = new Output(this, tr("Formatter Output"),FALSE);
231 QPEApplication::showDialog( outDlg); 233 QPEApplication::showDialog( outDlg);
232 qApp->processEvents(); 234 qApp->processEvents();
233 FILE *fp; 235 FILE *fp;
234 char line[130]; 236 char line[130];
235 237
236 238
237 outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) ); 239 outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) );
238 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 240 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
239 241
240 sleep(1); 242 sleep(1);
241 qDebug("Command is "+umountS); 243 odebug << "Command is "+umountS << oendl;
242 fp = popen( (const char *) umountS, "r"); 244 fp = popen( (const char *) umountS, "r");
243 // qDebug("%d", fp); 245 // odebug << "" << fp << "" << oendl;
244 if ( !fp ) 246 if ( !fp )
245 { 247 {
246 qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); 248 odebug << "Could not execute '" + umountS + "'! err=" << err << "\n" +(QString)strerror(errno) << oendl;
247 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); 249 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") );
248 pclose(fp); 250 pclose(fp);
249 return; 251 return;
250 } 252 }
251 else 253 else
252 { 254 {
253 // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); 255 // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted."));
254 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 256 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
255 while ( fgets( line, sizeof line, fp)) 257 while ( fgets( line, sizeof line, fp))
256 { 258 {
257 if( ((QString)line).find("busy",0,TRUE) != -1) 259 if( ((QString)line).find("busy",0,TRUE) != -1)
258 { 260 {
259 qDebug("Could not find '" + umountS); 261 odebug << "Could not find '" + umountS << oendl;
260 QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); 262 QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") );
261 pclose(fp); 263 pclose(fp);
262 return; 264 return;
263 } 265 }
264 else 266 else
265 { 267 {
266 QString lineStr = line; 268 QString lineStr = line;
267 lineStr=lineStr.left(lineStr.length()-1); 269 lineStr=lineStr.left(lineStr.length()-1);
268 outDlg->OutputEdit->append(lineStr); 270 outDlg->OutputEdit->append(lineStr);
269 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 271 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
270 } 272 }
271 } 273 }
272 } 274 }
273 pclose(fp); 275 pclose(fp);
274 276
275 qDebug("Command would be: "+cmd); 277 odebug << "Command would be: "+cmd << oendl;
276 outDlg->OutputEdit->append( tr("Trying to format.") ); 278 outDlg->OutputEdit->append( tr("Trying to format.") );
277 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 279 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
278 280
279 fp = popen( (const char *) cmd, "r"); 281 fp = popen( (const char *) cmd, "r");
280 while ( fgets( line, sizeof line, fp)) 282 while ( fgets( line, sizeof line, fp))
281 { 283 {
282 if( ((QString)line).find("No such device",0,TRUE) != -1) 284 if( ((QString)line).find("No such device",0,TRUE) != -1)
283 { 285 {
284 qDebug("No such device '" + umountS); 286 odebug << "No such device '" + umountS << oendl;
285 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); 287 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") );
286 pclose(fp); 288 pclose(fp);
287 // outDlg->OutputEdit->append("No such device"); 289 // outDlg->OutputEdit->append("No such device");
288 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 290 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
289 return; 291 return;
290 } 292 }
291 else 293 else
292 { 294 {
293 QString lineStr = line; 295 QString lineStr = line;
294 lineStr=lineStr.left(lineStr.length()-1); 296 lineStr=lineStr.left(lineStr.length()-1);
295 outDlg->OutputEdit->append(lineStr); 297 outDlg->OutputEdit->append(lineStr);
296 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 298 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
297 } 299 }
298 } 300 }
299 outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); 301 outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted."));
300 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 302 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
301 pclose(fp); 303 pclose(fp);
302 304
303 outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) ); 305 outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) );
304 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 306 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
305 fp = popen( (const char *) remountS, "r"); 307 fp = popen( (const char *) remountS, "r");
306 if ( !fp) 308 if ( !fp)
307 { 309 {
308 qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); 310 odebug << "Could not execute '" + remountS + "'! err=" << err << "\n" +(QString)strerror(errno) << oendl;
309 QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); 311 QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") );
310 312
311 } 313 }
312 else 314 else
313 { 315 {
314 outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText )); 316 outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText ));
315 while ( fgets( line, sizeof line, fp)) 317 while ( fgets( line, sizeof line, fp))
316 { 318 {
317 QString lineStr = line; 319 QString lineStr = line;
318 lineStr=lineStr.left(lineStr.length()-1); 320 lineStr=lineStr.left(lineStr.length()-1);
319 outDlg->OutputEdit->append(lineStr); 321 outDlg->OutputEdit->append(lineStr);
320 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 322 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
@@ -371,25 +373,25 @@ void FormatterApp::fsComboSelected(int )
371{} 373{}
372 374
373void FormatterApp::storageComboSelected(int index ) 375void FormatterApp::storageComboSelected(int index )
374{ 376{
375 377
376 QString currentText = storageComboBox->text(index); 378 QString currentText = storageComboBox->text(index);
377 QString nameS = currentText.left( currentText.find("->",0,TRUE)); 379 QString nameS = currentText.left( currentText.find("->",0,TRUE));
378 380
379 TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) ); 381 TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) );
380 currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); 382 currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4);
381 383
382 QString fsType = getFileSystemType((const QString &) currentText); 384 QString fsType = getFileSystemType((const QString &) currentText);
383 // qDebug(fsType); 385 // odebug << fsType << oendl;
384 for(int i = 0; i < fileSystemsCombo->count(); i++) 386 for(int i = 0; i < fileSystemsCombo->count(); i++)
385 { 387 {
386 if( fsType == fileSystemsCombo->text(i)) 388 if( fsType == fileSystemsCombo->text(i))
387 fileSystemsCombo->setCurrentItem(i); 389 fileSystemsCombo->setCurrentItem(i);
388 } 390 }
389 // deviceComboSelected(index); 391 // deviceComboSelected(index);
390} 392}
391 393
392void FormatterApp::deviceComboSelected(int index) 394void FormatterApp::deviceComboSelected(int index)
393{ 395{
394 396
395 StorageInfo storageInfo; 397 StorageInfo storageInfo;
@@ -455,25 +457,25 @@ void FormatterApp::parsetab(const QString &fileName)
455 while ( (me = getmntent( mntfp )) != 0 ) 457 while ( (me = getmntent( mntfp )) != 0 )
456 { 458 {
457 QString deviceName = me->mnt_fsname; 459 QString deviceName = me->mnt_fsname;
458 QString filesystemType = me->mnt_type; 460 QString filesystemType = me->mnt_type;
459 if(deviceName != "none") 461 if(deviceName != "none")
460 { 462 {
461 if( fsList.contains(filesystemType) == 0 463 if( fsList.contains(filesystemType) == 0
462 & filesystemType.find("proc",0,TRUE) == -1 464 & filesystemType.find("proc",0,TRUE) == -1
463 & filesystemType.find("cramfs",0,TRUE) == -1 465 & filesystemType.find("cramfs",0,TRUE) == -1
464 & filesystemType.find("auto",0,TRUE) == -1) 466 & filesystemType.find("auto",0,TRUE) == -1)
465 fsList << filesystemType; 467 fsList << filesystemType;
466 deviceList << deviceName; 468 deviceList << deviceName;
467 qDebug(deviceName+"::"+filesystemType); 469 odebug << deviceName+"::"+filesystemType << oendl;
468 fileSystemTypeList << deviceName+"::"+filesystemType; 470 fileSystemTypeList << deviceName+"::"+filesystemType;
469 } 471 }
470 } 472 }
471 } 473 }
472 endmntent( mntfp ); 474 endmntent( mntfp );
473 // } else if(fileName == "/etc/fstab") { 475 // } else if(fileName == "/etc/fstab") {
474 // QFile f("/etc/fstab"); 476 // QFile f("/etc/fstab");
475 // if ( f.open(IO_ReadOnly) ) { 477 // if ( f.open(IO_ReadOnly) ) {
476 // QTextStream t (&f); 478 // QTextStream t (&f);
477 // QString s; 479 // QString s;
478 // while (! t.eof()) { 480 // while (! t.eof()) {
479 // s=t.readLine(); 481 // s=t.readLine();
@@ -497,25 +499,25 @@ void FormatterApp::parsetab(const QString &fileName)
497 499
498QString FormatterApp::getFileSystemType(const QString &currentText) 500QString FormatterApp::getFileSystemType(const QString &currentText)
499{ 501{
500 502
501 parsetab("/etc/mtab"); //why did TT forget filesystem type? 503 parsetab("/etc/mtab"); //why did TT forget filesystem type?
502 504
503 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) 505 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it )
504 { 506 {
505 QString temp = (*it); 507 QString temp = (*it);
506 if( temp.find( currentText,0,TRUE) != -1) 508 if( temp.find( currentText,0,TRUE) != -1)
507 { 509 {
508 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 510 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
509 // qDebug(fsType); 511 // odebug << fsType << oendl;
510 } 512 }
511 } 513 }
512 return ""; 514 return "";
513} 515}
514 516
515bool FormatterApp::doFsck() 517bool FormatterApp::doFsck()
516{ 518{
517 519
518 Output *outDlg; 520 Output *outDlg;
519 QString selectedDevice; 521 QString selectedDevice;
520 // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) 522 // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
521 selectedDevice = deviceComboBox->currentText(); 523 selectedDevice = deviceComboBox->currentText();
@@ -524,79 +526,79 @@ bool FormatterApp::doFsck()
524 QString remountS = "mount -v "+mountPoint+" 2>&1"; 526 QString remountS = "mount -v "+mountPoint+" 2>&1";
525 // #else 527 // #else
526 // // for testing 528 // // for testing
527 // // currentText = diskDevice = "/dev/fd0"; 529 // // currentText = diskDevice = "/dev/fd0";
528 // QString umountS = "umount -v /floppy 2>&1"; 530 // QString umountS = "umount -v /floppy 2>&1";
529 // QString remountS = "mount -v /floppy 2>&1"; 531 // QString remountS = "mount -v /floppy 2>&1";
530 // selectedDevice ="/dev/fd0"; 532 // selectedDevice ="/dev/fd0";
531 533
532 // #endif 534 // #endif
533 535
534 QString fsType = getFileSystemType((const QString &)selectedDevice); 536 QString fsType = getFileSystemType((const QString &)selectedDevice);
535 QString cmd; 537 QString cmd;
536 qDebug( selectedDevice +" "+ fsType); 538 odebug << selectedDevice +" "+ fsType << oendl;
537 if(fsType == "vfat") cmd = "dosfsck -vy "; 539 if(fsType == "vfat") cmd = "dosfsck -vy ";
538 if(fsType == "ext2") cmd = "e2fsck -cpvy "; 540 if(fsType == "ext2") cmd = "e2fsck -cpvy ";
539 cmd += selectedDevice + " 2>&1"; 541 cmd += selectedDevice + " 2>&1";
540 542
541 outDlg = new Output(this, tr("Formatter Output"),FALSE); 543 outDlg = new Output(this, tr("Formatter Output"),FALSE);
542 QPEApplication::showDialog( outDlg ); 544 QPEApplication::showDialog( outDlg );
543 qApp->processEvents(); 545 qApp->processEvents();
544 FILE *fp; 546 FILE *fp;
545 char line[130]; 547 char line[130];
546 outDlg->OutputEdit->append( tr("Trying to umount.")); 548 outDlg->OutputEdit->append( tr("Trying to umount."));
547 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 549 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
548 550
549 sleep(1); 551 sleep(1);
550 // qDebug("Command is "+umountS); 552 // odebug << "Command is "+umountS << oendl;
551 fp = popen( (const char *) umountS, "r"); 553 fp = popen( (const char *) umountS, "r");
552 // qDebug("%d", fp); 554 // odebug << "" << fp << "" << oendl;
553 if ( !fp ) 555 if ( !fp )
554 { 556 {
555 qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); 557 odebug << "Could not execute '" + umountS + "'!\n" +(QString)strerror(errno) << oendl;
556 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); 558 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") );
557 pclose(fp); 559 pclose(fp);
558 return false; 560 return false;
559 } 561 }
560 else 562 else
561 { 563 {
562 // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); 564 // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted."));
563 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 565 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
564 while ( fgets( line, sizeof line, fp)) 566 while ( fgets( line, sizeof line, fp))
565 { 567 {
566 if( ((QString)line).find("busy",0,TRUE) != -1) 568 if( ((QString)line).find("busy",0,TRUE) != -1)
567 { 569 {
568 qDebug("Could not find '" + umountS); 570 odebug << "Could not find '" + umountS << oendl;
569 QMessageBox::warning( this, tr("Formatter"), 571 QMessageBox::warning( this, tr("Formatter"),
570 tr("Could not umount.\nDevice is busy!"), tr("&OK") ); 572 tr("Could not umount.\nDevice is busy!"), tr("&OK") );
571 pclose(fp); 573 pclose(fp);
572 return false; 574 return false;
573 } 575 }
574 else 576 else
575 { 577 {
576 QString lineStr = line; 578 QString lineStr = line;
577 lineStr=lineStr.left(lineStr.length()-1); 579 lineStr=lineStr.left(lineStr.length()-1);
578 outDlg->OutputEdit->append(lineStr); 580 outDlg->OutputEdit->append(lineStr);
579 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 581 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
580 } 582 }
581 } 583 }
582 } 584 }
583 pclose(fp); 585 pclose(fp);
584 ///////////////////////////////////// 586 /////////////////////////////////////
585 fp = popen( (const char *) cmd, "r"); 587 fp = popen( (const char *) cmd, "r");
586 while ( fgets( line, sizeof line, fp)) 588 while ( fgets( line, sizeof line, fp))
587 { 589 {
588 if( ((QString)line).find("No such device",0,TRUE) != -1) 590 if( ((QString)line).find("No such device",0,TRUE) != -1)
589 { 591 {
590 qDebug("No such device '" + umountS); 592 odebug << "No such device '" + umountS << oendl;
591 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); 593 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") );
592 pclose(fp); 594 pclose(fp);
593 // outDlg->OutputEdit->append("No such device"); 595 // outDlg->OutputEdit->append("No such device");
594 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 596 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
595 return false; 597 return false;
596 } 598 }
597 else 599 else
598 { 600 {
599 QString lineStr = line; 601 QString lineStr = line;
600 lineStr=lineStr.left(lineStr.length()-1); 602 lineStr=lineStr.left(lineStr.length()-1);
601 outDlg->OutputEdit->append(lineStr); 603 outDlg->OutputEdit->append(lineStr);
602 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 604 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
diff --git a/noncore/tools/formatter/formatter.pro b/noncore/tools/formatter/formatter.pro
index 913cca8..f6d34c7 100644
--- a/noncore/tools/formatter/formatter.pro
+++ b/noncore/tools/formatter/formatter.pro
@@ -1,9 +1,9 @@
1CONFIG += qt warn_on quick-app 1CONFIG += qt warn_on quick-app
2HEADERS = formatter.h inputDialog.h output.h 2HEADERS = formatter.h inputDialog.h output.h
3SOURCES = formatter.cpp inputDialog.cpp output.cpp main.cpp 3SOURCES = formatter.cpp inputDialog.cpp output.cpp main.cpp
4TARGET = formatter 4TARGET = formatter
5INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lqpe -lopiecore2 7LIBS += -lqpe -lopiecore2
8 8
9include ( $(OPIEDIR)/include.pro ) 9include ( $(OPIEDIR)/include.pro )