summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/zkbapplet/zkbapplet.control2
-rw-r--r--noncore/apps/confedit/opie-confeditor.control2
-rw-r--r--noncore/apps/dagger/opie-dagger.control2
-rw-r--r--noncore/apps/opie-bartender/opie-bartender.control2
-rw-r--r--noncore/apps/opie-console/opie-console-embedix.control2
-rw-r--r--noncore/apps/opie-console/opie-console.control2
-rw-r--r--noncore/apps/opie-gutenbrowser/opie-gutenbrowser.control2
-rw-r--r--noncore/games/bounce/opie-bounce.control2
-rw-r--r--noncore/games/buzzword/opie-buzzword.control2
-rw-r--r--noncore/games/kbill/opie-kbill.control2
-rw-r--r--noncore/games/kcheckers/opie-kcheckers.control2
-rw-r--r--noncore/games/kpacman/opie-kpacman.control2
-rw-r--r--noncore/games/tetrix/ohighscoredlg.cpp81
-rw-r--r--noncore/games/tetrix/ohighscoredlg.h13
-rw-r--r--noncore/games/tetrix/tetrix.pro2
-rw-r--r--noncore/multimedia/camera/opie-camera.control2
-rw-r--r--noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control2
-rw-r--r--noncore/multimedia/opieplayer2/opie-mediaplayer2.control2
-rw-r--r--noncore/multimedia/powerchord/opie-powerchord.control2
-rw-r--r--noncore/net/mail/libetpanstuff/libetpan.control2
-rw-r--r--noncore/net/mail/libmailwrapper/libmailwrapper.control2
-rw-r--r--noncore/net/mail/opie-mail.control2
-rw-r--r--noncore/net/mail/taskbarapplet/opie-mailapplet.control2
-rw-r--r--noncore/net/opieirc/opie-irc.control2
-rw-r--r--noncore/net/opierdesktop/opie-rdesktop.control2
-rw-r--r--noncore/net/opietooth/blue-pin/main.cc1
-rw-r--r--noncore/net/opietooth/blue-pin/opie-bluepin.control2
-rw-r--r--noncore/net/opietooth/blue-pin/pindlgbase.ui32
-rw-r--r--noncore/net/opietooth/lib/libopietooth1.control2
-rw-r--r--noncore/net/opietooth/manager/opie-bluetoothmanager.control2
-rw-r--r--noncore/net/wellenreiter/opie-wellenreiter.control4
-rw-r--r--noncore/securityplugins/blueping/bluepingplugin.control2
-rw-r--r--noncore/securityplugins/dummy/dummyplugin.control2
-rw-r--r--noncore/securityplugins/notice/notice.control2
-rw-r--r--noncore/securityplugins/pin/pin.control2
-rw-r--r--noncore/settings/networksettings2/activatevpn.cpp6
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth.pro14
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp2
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h7
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp354
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h35
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui256
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp31
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h24
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp144
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h14
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h33
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth_NN.h2
-rw-r--r--noncore/settings/networksettings2/bluetooth/config.in2
-rw-r--r--noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control4
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.h2
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.cpp14
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.h6
-rw-r--r--noncore/settings/networksettings2/cable/cabledata.h7
-rw-r--r--noncore/settings/networksettings2/cable/cableedit.cpp4
-rw-r--r--noncore/settings/networksettings2/cable/cableedit.h4
-rw-r--r--noncore/settings/networksettings2/cable/cablerun.cpp18
-rw-r--r--noncore/settings/networksettings2/cable/cablerun.h18
-rw-r--r--noncore/settings/networksettings2/cable/opie-networksettings2plugin-cable.control2
-rw-r--r--noncore/settings/networksettings2/config.in5
-rw-r--r--noncore/settings/networksettings2/editconnection.cpp188
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.h2
-rw-r--r--noncore/settings/networksettings2/irda/irdadata.h5
-rw-r--r--noncore/settings/networksettings2/irda/irdarun.h23
-rw-r--r--noncore/settings/networksettings2/irda/opie-networksettings2plugin-irda.control2
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.cpp12
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.h2
-rw-r--r--noncore/settings/networksettings2/lancard/lancarddata.h5
-rw-r--r--noncore/settings/networksettings2/lancard/lancardrun.cpp110
-rw-r--r--noncore/settings/networksettings2/lancard/lancardrun.h28
-rw-r--r--noncore/settings/networksettings2/lancard/opie-networksettings2plugin-lancard.control2
-rw-r--r--noncore/settings/networksettings2/main.cpp46
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.cpp11
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.h2
-rw-r--r--noncore/settings/networksettings2/modem/modemdata.h5
-rw-r--r--noncore/settings/networksettings2/modem/modemedit.cpp4
-rw-r--r--noncore/settings/networksettings2/modem/modemedit.h4
-rw-r--r--noncore/settings/networksettings2/modem/modemrun.h23
-rw-r--r--noncore/settings/networksettings2/modem/opie-networksettings2plugin-modem.control2
-rw-r--r--noncore/settings/networksettings2/network/network_NN.cpp40
-rw-r--r--noncore/settings/networksettings2/network/network_NN.h8
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.cpp50
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.h10
-rw-r--r--noncore/settings/networksettings2/network/networkdata.h5
-rw-r--r--noncore/settings/networksettings2/network/networkedit.cpp4
-rw-r--r--noncore/settings/networksettings2/network/networkedit.h4
-rw-r--r--noncore/settings/networksettings2/network/networkrun.cpp91
-rw-r--r--noncore/settings/networksettings2/network/networkrun.h19
-rw-r--r--noncore/settings/networksettings2/network/opie-networksettings2plugin-network.control2
-rw-r--r--noncore/settings/networksettings2/networksettings.cpp277
-rw-r--r--noncore/settings/networksettings2/networksettings.h26
-rw-r--r--noncore/settings/networksettings2/networksettings.pro6
-rw-r--r--noncore/settings/networksettings2/networksettings2/GUIUtils.h9
-rw-r--r--noncore/settings/networksettings2/networksettings2/Utils.h2
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.cpp224
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.h266
-rw-r--r--noncore/settings/networksettings2/networksettings2/networksettings2.pro6
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.cpp70
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.h6
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.cpp298
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.h63
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.cpp70
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.h11
-rw-r--r--noncore/settings/networksettings2/networksettingsGUI.ui118
-rw-r--r--noncore/settings/networksettings2/nsdata.cpp252
-rw-r--r--noncore/settings/networksettings2/nsdata.h13
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.cpp4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.h4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPDNSedit.cpp4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPDNSedit.h4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPGUI.ui20
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPGUI.ui255
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPedit.cpp37
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPedit.h4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPedit.cpp11
-rw-r--r--noncore/settings/networksettings2/ppp/PPPedit.h14
-rw-r--r--noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control2
-rw-r--r--noncore/settings/networksettings2/ppp/ppp.pro11
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp36
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.h6
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.cpp154
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.h12
-rw-r--r--noncore/settings/networksettings2/ppp/pppdata.h22
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.cpp56
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.h34
-rw-r--r--noncore/settings/networksettings2/profile/opie-networksettings2plugin-bluetooth.control4
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp13
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.h2
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.cpp13
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.h4
-rw-r--r--noncore/settings/networksettings2/profile/profiledata.h5
-rw-r--r--noncore/settings/networksettings2/profile/profileedit.cpp10
-rw-r--r--noncore/settings/networksettings2/profile/profileedit.h8
-rw-r--r--noncore/settings/networksettings2/profile/profilerun.cpp72
-rw-r--r--noncore/settings/networksettings2/profile/profilerun.h24
-rw-r--r--noncore/settings/networksettings2/usb/opie-networksettings2plugin-usb.control2
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp12
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.h2
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.cpp12
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.h4
-rw-r--r--noncore/settings/networksettings2/usb/usbdata.h5
-rw-r--r--noncore/settings/networksettings2/usb/usbedit.cpp4
-rw-r--r--noncore/settings/networksettings2/usb/usbedit.h4
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp102
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.h27
-rw-r--r--noncore/settings/networksettings2/vpn/opie-networksettings2plugin-vpn.control2
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.cpp8
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.h2
-rw-r--r--noncore/settings/networksettings2/vpn/vpndata.h5
-rw-r--r--noncore/settings/networksettings2/vpn/vpnedit.cpp4
-rw-r--r--noncore/settings/networksettings2/vpn/vpnedit.h4
-rw-r--r--noncore/settings/networksettings2/vpn/vpnrun.cpp5
-rw-r--r--noncore/settings/networksettings2/vpn/vpnrun.h25
-rw-r--r--noncore/settings/networksettings2/wlan/opie-networksettings2plugin-wlan.control2
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp12
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.h2
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.cpp22
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.h4
-rw-r--r--noncore/settings/networksettings2/wlan/wlandata.h5
-rw-r--r--noncore/settings/networksettings2/wlan/wlanedit.cpp6
-rw-r--r--noncore/settings/networksettings2/wlan/wlanedit.h8
-rw-r--r--noncore/settings/networksettings2/wlan/wlanrun.cpp91
-rw-r--r--noncore/settings/networksettings2/wlan/wlanrun.h27
-rw-r--r--noncore/settings/packagemanager/oconfitem.h7
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp7
-rw-r--r--noncore/settings/packagemanager/opie-packagemanager.control4
-rw-r--r--noncore/tools/opie-sh/opie-sh.control2
-rw-r--r--noncore/tools/opie-sh/scripts/opie-sh-wavelanchooser.control2
-rw-r--r--noncore/unsupported/filebrowser/opie-filebrowser.control2
-rw-r--r--noncore/unsupported/gsmtool/opie-gsmtool.control2
-rw-r--r--noncore/unsupported/oipkg/opie-oipkg.control2
-rw-r--r--noncore/unsupported/ubrowser/opie-ubrowser.control2
175 files changed, 2876 insertions, 2059 deletions
diff --git a/noncore/applets/zkbapplet/zkbapplet.control b/noncore/applets/zkbapplet/zkbapplet.control
index 4e03c26..08b540f 100644
--- a/noncore/applets/zkbapplet/zkbapplet.control
+++ b/noncore/applets/zkbapplet/zkbapplet.control
@@ -9,2 +9,2 @@ Description: ZKB Applet and configuration program
9Obsoletes: keyz-cfg 9Obsoletes: keyz-cfg
10Version: 0.6.0$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/apps/confedit/opie-confeditor.control b/noncore/apps/confedit/opie-confeditor.control
index 00a05da..b49aad3 100644
--- a/noncore/apps/confedit/opie-confeditor.control
+++ b/noncore/apps/confedit/opie-confeditor.control
@@ -6,3 +6,3 @@ Maintainer: Patrick S. Vogt <tille@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: $QPE_VERSION-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal, libopiecore2 8Depends: task-opie-minimal, libopiecore2
diff --git a/noncore/apps/dagger/opie-dagger.control b/noncore/apps/dagger/opie-dagger.control
index 4ded1f2..cfb45be 100644
--- a/noncore/apps/dagger/opie-dagger.control
+++ b/noncore/apps/dagger/opie-dagger.control
@@ -8,2 +8,2 @@ Maintainer: Dan Williams (drw@handhelds.org)
8Description: A Bible study program utilizing the Sword library. 8Description: A Bible study program utilizing the Sword library.
9Version: 0.9.1$EXTRAVERSION 9Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/apps/opie-bartender/opie-bartender.control b/noncore/apps/opie-bartender/opie-bartender.control
index 045c68e..29ad0ba 100644
--- a/noncore/apps/opie-bartender/opie-bartender.control
+++ b/noncore/apps/opie-bartender/opie-bartender.control
@@ -6,3 +6,3 @@ Maintainer: L.J. Potter <lpotter@trolltech.com>
6Architecture: arm 6Architecture: arm
7Version: $QPE_VERSION-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal 8Depends: task-opie-minimal
diff --git a/noncore/apps/opie-console/opie-console-embedix.control b/noncore/apps/opie-console/opie-console-embedix.control
index cf27554..e902d0e 100644
--- a/noncore/apps/opie-console/opie-console-embedix.control
+++ b/noncore/apps/opie-console/opie-console-embedix.control
@@ -6,3 +6,3 @@ Maintainer: Opie Team <opie@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: 0.6-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs 8Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs
diff --git a/noncore/apps/opie-console/opie-console.control b/noncore/apps/opie-console/opie-console.control
index e924b79..b64898b 100644
--- a/noncore/apps/opie-console/opie-console.control
+++ b/noncore/apps/opie-console/opie-console.control
@@ -6,3 +6,3 @@ Maintainer: Opie Team <opie@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: 0.6-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs 8Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs
diff --git a/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.control b/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.control
index 47fbcdf..bc0283e 100644
--- a/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.control
+++ b/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.control
@@ -7,3 +7,3 @@ Source: opie.handhelds.org
7Architecture: arm 7Architecture: arm
8Version: $QPE_VERSION-$SUB_VERSION 8Version: $QPE_VERSION$EXTRAVERSION
9Depends: ftplib, libopiecore2, libopieui2 9Depends: ftplib, libopiecore2, libopieui2
diff --git a/noncore/games/bounce/opie-bounce.control b/noncore/games/bounce/opie-bounce.control
index dfd1bf0..0513958 100644
--- a/noncore/games/bounce/opie-bounce.control
+++ b/noncore/games/bounce/opie-bounce.control
@@ -2,3 +2,3 @@ Package: opie-bounce
2Files: plugins/application/libbounce.so* bin/bounce apps/Games/bounce.desktop pics/bounce/*.png 2Files: plugins/application/libbounce.so* bin/bounce apps/Games/bounce.desktop pics/bounce/*.png
3Version: 0.6-$SUB_VERSION 3Version: $QPE_VERSION$EXTRAVERSION
4Depends: task-opie-minimal, libopiecore2 4Depends: task-opie-minimal, libopiecore2
diff --git a/noncore/games/buzzword/opie-buzzword.control b/noncore/games/buzzword/opie-buzzword.control
index 3316445..f76a2c2 100644
--- a/noncore/games/buzzword/opie-buzzword.control
+++ b/noncore/games/buzzword/opie-buzzword.control
@@ -2,3 +2,3 @@ Package: opie-buzzword
2Files: plugins/application/libbuzzword.so* bin/buzzword apps/Games/buzzword.desktop pics/buzzword/buzzword.png share/buzzword/buzzwords 2Files: plugins/application/libbuzzword.so* bin/buzzword apps/Games/buzzword.desktop pics/buzzword/buzzword.png share/buzzword/buzzwords
3Version: 1.1-$SUB_VERSION 3Version: $QPE_VERSION$EXTRAVERSION
4Depends: task-opie-minimal,libopiecore2 4Depends: task-opie-minimal,libopiecore2
diff --git a/noncore/games/kbill/opie-kbill.control b/noncore/games/kbill/opie-kbill.control
index 3299b93..cf12bca 100644
--- a/noncore/games/kbill/opie-kbill.control
+++ b/noncore/games/kbill/opie-kbill.control
@@ -6,3 +6,3 @@ Maintainer: Mark Westcott <mark@houseoffish.org>
6Architecture: arm 6Architecture: arm
7Version: 0.8-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal 8Depends: task-opie-minimal
diff --git a/noncore/games/kcheckers/opie-kcheckers.control b/noncore/games/kcheckers/opie-kcheckers.control
index 5bd03ae..e7c20d3 100644
--- a/noncore/games/kcheckers/opie-kcheckers.control
+++ b/noncore/games/kcheckers/opie-kcheckers.control
@@ -6,3 +6,3 @@ Maintainer: leseb <prudhomme@laposte.net>
6Architecture: arm 6Architecture: arm
7Version: 0.3-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal, libopiecore2 8Depends: task-opie-minimal, libopiecore2
diff --git a/noncore/games/kpacman/opie-kpacman.control b/noncore/games/kpacman/opie-kpacman.control
index 68487ec..97120aa 100644
--- a/noncore/games/kpacman/opie-kpacman.control
+++ b/noncore/games/kpacman/opie-kpacman.control
@@ -2,3 +2,3 @@ Package: opie-kpacman
2Files: plugins/applications/libkpacman.so* bin/kpacman apps/Games/kpacman.desktop pics/kpacman/kpacman.png share/kpacman 2Files: plugins/applications/libkpacman.so* bin/kpacman apps/Games/kpacman.desktop pics/kpacman/kpacman.png share/kpacman
3Version: 0.3.1-$SUB_VERSION 3Version: $QPE_VERSION$EXTRAVERSION
4Depends: task-opie-minimal 4Depends: task-opie-minimal
diff --git a/noncore/games/tetrix/ohighscoredlg.cpp b/noncore/games/tetrix/ohighscoredlg.cpp
index 8d8079e..66f4917 100644
--- a/noncore/games/tetrix/ohighscoredlg.cpp
+++ b/noncore/games/tetrix/ohighscoredlg.cpp
@@ -21,2 +21,3 @@
21#include <qstring.h> 21#include <qstring.h>
22#include <qlist.h>
22#include <qhbox.h> 23#include <qhbox.h>
@@ -29,3 +30,3 @@
29 30
30OHighscore::OHighscore( int score , int playerLevel ) 31OHighscore::OHighscore( int score , int playerLevel ) : playerData()
31{ 32{
@@ -34,2 +35,3 @@ OHighscore::OHighscore( int score , int playerLevel )
34 checkIfItIsANewhighscore( score ); 35 checkIfItIsANewhighscore( score );
36 playerData.setAutoDelete( TRUE );
35} 37}
@@ -38,7 +40,2 @@ OHighscore::~OHighscore()
38{ 40{
39 std::list<t_playerData*>::iterator deleteIterator = playerData.begin();
40 for ( ; deleteIterator != playerData.end() ; deleteIterator++ )
41 {
42 delete ( *deleteIterator );
43 }
44} 41}
@@ -66,3 +63,3 @@ void OHighscore::getList()
66 63
67 playerData.push_back( pPlayerData ); 64 playerData.append( pPlayerData );
68 65
@@ -85,3 +82,3 @@ void OHighscore::getList()
85 82
86 playerData.push_back( pPlayerData ); 83 playerData.append( pPlayerData );
87 } 84 }
@@ -102,7 +99,11 @@ void OHighscore::insertData( QString name , int punkte , int playerLevel )
102 Config cfg ( "tetrix" ); 99 Config cfg ( "tetrix" );
100 t_playerData * Run;
101 int index = 0;
103 int entryNumber = 1; 102 int entryNumber = 1;
104 std::list<t_playerData*>::iterator insertIterator = playerData.begin(); 103
105 while ( insertIterator != playerData.end() ) 104 for ( Run=playerData.first();
106 { 105 Run != 0;
107 if ( punkte > ( *insertIterator )->points ) 106 index ++, Run=playerData.next() ) {
107
108 if ( punkte > Run->points )
108 { 109 {
@@ -112,9 +113,7 @@ void OHighscore::insertData( QString name , int punkte , int playerLevel )
112 temp->level = playerLevel; 113 temp->level = playerLevel;
113 playerData.insert( insertIterator , temp ); 114
115 playerData.insert( index, temp );
114 116
115 //now we have to delete the last entry 117 //now we have to delete the last entry
116 insertIterator = playerData.end(); 118 playerData.remove( playerData.count() );
117 insertIterator--;
118 //X delete *insertIterator; //memleak?
119 playerData.erase( insertIterator );
120 119
@@ -122,11 +121,10 @@ void OHighscore::insertData( QString name , int punkte , int playerLevel )
122 //this block just rewrites the highscore 121 //this block just rewrites the highscore
123 insertIterator = playerData.begin(); 122 for ( t_playerData * Run2=playerData.first();
124 while ( insertIterator != playerData.end() ) 123 Run2 != 0;
125 { 124 Run2=playerData.next() ) {
126 cfg.setGroup( QString::number( entryNumber ) ); 125 cfg.setGroup( QString::number( entryNumber ) );
127 cfg.writeEntry( "Name" , ( *insertIterator )->sName ); 126 cfg.writeEntry( "Name" , Run2->sName );
128 cfg.writeEntry( "Points" , ( *insertIterator )->points ); 127 cfg.writeEntry( "Points" , Run2->points );
129 cfg.writeEntry( "Level" , ( *insertIterator )->level ); 128 cfg.writeEntry( "Level" , Run2->level );
130 entryNumber++; 129 entryNumber++;
131 insertIterator++;
132 } 130 }
@@ -136,3 +134,2 @@ void OHighscore::insertData( QString name , int punkte , int playerLevel )
136 } 134 }
137 insertIterator++;
138 } 135 }
@@ -179,16 +176,26 @@ void OHighscoreDialog::createHighscoreListView()
179 int level_ = 0; 176 int level_ = 0;
180 177 QListViewItem * Prev = 0;
181 std::list<t_playerData*>::reverse_iterator iListe = hs_->playerData.rbegin(); 178
182 179 for ( t_playerData * Run = hs_->playerData.first();
183 for ( ; iListe != hs_->playerData.rend() ; ++iListe ) 180 Run != 0;
184 { 181 Run=hs_->playerData.next() )
185 QListViewItem *item = new QListViewItem( list ); 182 {
183 QListViewItem *item;
184
185 if( Prev ) {
186 // after previous
187 item = new QListViewItem( list, Prev );
188 Prev = item;
189 } else {
190 item = new QListViewItem( list );
191
192 }
186 item->setText( 0 , QString::number( pos ) ); //number 193 item->setText( 0 , QString::number( pos ) ); //number
187 item->setText( 1 , ( *iListe )->sName ); //name 194 item->setText( 1 , Run->sName ); //name
188 if ( ( *iListe )->points == -1 ) 195 if ( Run->points == -1 )
189 points_ = 0; 196 points_ = 0;
190 else points_ = ( *iListe )->points; 197 else points_ = Run->points;
191 if ( ( *iListe )->level == -1 ) 198 if ( Run->level == -1 )
192 level_ = 0; 199 level_ = 0;
193 else level_ = ( *iListe )->level; 200 else level_ = Run->level;
194 item->setText( 2 , QString::number( points_ ) ); //points 201 item->setText( 2 , QString::number( points_ ) ); //points
diff --git a/noncore/games/tetrix/ohighscoredlg.h b/noncore/games/tetrix/ohighscoredlg.h
index fdbe623..845e639 100644
--- a/noncore/games/tetrix/ohighscoredlg.h
+++ b/noncore/games/tetrix/ohighscoredlg.h
@@ -14,8 +14,9 @@ class QListView;
14#include <qdialog.h> 14#include <qdialog.h>
15#include <list> 15#include <qlist.h>
16 16
17using namespace std; 17class t_playerData
18
19struct t_playerData
20{ 18{
19
20public :
21
21 QString sName; 22 QString sName;
@@ -47,3 +48,3 @@ class OHighscore : public QWidget
47 48
48 list<t_playerData*> playerData; 49 QList<t_playerData> playerData;
49 50
@@ -55,4 +56,2 @@ class OHighscore : public QWidget
55 56
56 list<t_playerData*>::iterator iPlayerData;
57
58 /* 57 /*
diff --git a/noncore/games/tetrix/tetrix.pro b/noncore/games/tetrix/tetrix.pro
index 580a542..96f452f 100644
--- a/noncore/games/tetrix/tetrix.pro
+++ b/noncore/games/tetrix/tetrix.pro
@@ -14,3 +14,3 @@ INCLUDEPATH += $(OPIEDIR)/include
14 DEPENDPATH+= $(OPIEDIR)/include 14 DEPENDPATH+= $(OPIEDIR)/include
15LIBS += -lqpe -lopiecore2 -lstdc++ 15LIBS += -lqpe -lopiecore2
16 INTERFACES= 16 INTERFACES=
diff --git a/noncore/multimedia/camera/opie-camera.control b/noncore/multimedia/camera/opie-camera.control
index d9eaab8..5171050 100644
--- a/noncore/multimedia/camera/opie-camera.control
+++ b/noncore/multimedia/camera/opie-camera.control
@@ -6,3 +6,3 @@ Maintainer: Michael 'Mickey' Lauer <mickeyl@Vanille.de>
6Architecture: arm 6Architecture: arm
7Version: 1.0.1 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: libqpe1, libopiecore2, libopieui2 8Depends: libqpe1, libopiecore2, libopieui2
diff --git a/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control b/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control
index 1d0fbfb..f4cbc41 100644
--- a/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control
+++ b/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control
@@ -5,3 +5,3 @@ Essential: no
5Priority: optional 5Priority: optional
6Version: 0.7-$SUB_VERSION.3 6Version: $QPE_VERSION$EXTRAVERSION
7Architecture: arm 7Architecture: arm
diff --git a/noncore/multimedia/opieplayer2/opie-mediaplayer2.control b/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
index af6bb01..78cfa8b 100644
--- a/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
+++ b/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
@@ -6,3 +6,3 @@ Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal, libopie1, zlib1g, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs 7Depends: task-opie-minimal, libopiecore2, libopieui2, libqtaux2, libz1, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs
8Description: The Opie media player 8Description: The Opie media player
diff --git a/noncore/multimedia/powerchord/opie-powerchord.control b/noncore/multimedia/powerchord/opie-powerchord.control
index 39d926b..4b5bc88 100644
--- a/noncore/multimedia/powerchord/opie-powerchord.control
+++ b/noncore/multimedia/powerchord/opie-powerchord.control
@@ -5,3 +5,3 @@ Maintainer: Camilo Mesias <camilo@mesias.co.uk>, ljp <lpotter@trolltech.com>
5Architecture: arm 5Architecture: arm
6Version: 0.0.8 6Version: $QPE_VERSION$EXTRAVERSION
7Depends: task-opie-minimal 7Depends: task-opie-minimal
diff --git a/noncore/net/mail/libetpanstuff/libetpan.control b/noncore/net/mail/libetpanstuff/libetpan.control
index 2b5b354..b664157 100644
--- a/noncore/net/mail/libetpanstuff/libetpan.control
+++ b/noncore/net/mail/libetpanstuff/libetpan.control
@@ -6,3 +6,3 @@ Maintainer: Rajko Albrecht <alwin@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: 0.33pre-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: libssl0.9.7 8Depends: libssl0.9.7
diff --git a/noncore/net/mail/libmailwrapper/libmailwrapper.control b/noncore/net/mail/libmailwrapper/libmailwrapper.control
index ec55bb3..3491d67 100644
--- a/noncore/net/mail/libmailwrapper/libmailwrapper.control
+++ b/noncore/net/mail/libmailwrapper/libmailwrapper.control
@@ -6,3 +6,3 @@ Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.or
6Architecture: arm 6Architecture: arm
7Version: 0.6-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal, libopiecore2, libopieui2, libetpan (>= 0.33pre) 8Depends: task-opie-minimal, libopiecore2, libopieui2, libetpan (>= 0.33pre)
diff --git a/noncore/net/mail/opie-mail.control b/noncore/net/mail/opie-mail.control
index 698aaa7..e3b18b3 100644
--- a/noncore/net/mail/opie-mail.control
+++ b/noncore/net/mail/opie-mail.control
@@ -6,3 +6,3 @@ Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.or
6Architecture: arm 6Architecture: arm
7Version: 0.6-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal, libopiecore2, libopieui2, libopiemm2, libopiedb2, libmailwrapper (>= 0.6), libssl 8Depends: task-opie-minimal, libopiecore2, libopieui2, libopiemm2, libopiedb2, libmailwrapper (>= 0.6), libssl
diff --git a/noncore/net/mail/taskbarapplet/opie-mailapplet.control b/noncore/net/mail/taskbarapplet/opie-mailapplet.control
index f9822a5..c838e0b 100644
--- a/noncore/net/mail/taskbarapplet/opie-mailapplet.control
+++ b/noncore/net/mail/taskbarapplet/opie-mailapplet.control
@@ -6,3 +6,3 @@ Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.or
6Architecture: arm 6Architecture: arm
7Version: 0.5-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal, libopiecore2, opie-mail 8Depends: task-opie-minimal, libopiecore2, opie-mail
diff --git a/noncore/net/opieirc/opie-irc.control b/noncore/net/opieirc/opie-irc.control
index b9f20f0..195b5ff 100644
--- a/noncore/net/opieirc/opie-irc.control
+++ b/noncore/net/opieirc/opie-irc.control
@@ -6,3 +6,3 @@ Maintainer: Wenzel Jakob <root@wazlaf.de>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal, libopie1 7Depends: task-opie-minimal, libopiecore2, libopieui2, libqtaux2
8Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer 8Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer
diff --git a/noncore/net/opierdesktop/opie-rdesktop.control b/noncore/net/opierdesktop/opie-rdesktop.control
index a8726e0..2a9d415 100644
--- a/noncore/net/opierdesktop/opie-rdesktop.control
+++ b/noncore/net/opierdesktop/opie-rdesktop.control
@@ -6,3 +6,3 @@ Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: 1.2.0-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal 8Depends: task-opie-minimal
diff --git a/noncore/net/opietooth/blue-pin/main.cc b/noncore/net/opietooth/blue-pin/main.cc
index 1ab1f2e..dbe5b41 100644
--- a/noncore/net/opietooth/blue-pin/main.cc
+++ b/noncore/net/opietooth/blue-pin/main.cc
@@ -11,2 +11 @@ using namespace Opie::Core;
11OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::PinDlg> ) OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::PinDlg> )
12
diff --git a/noncore/net/opietooth/blue-pin/opie-bluepin.control b/noncore/net/opietooth/blue-pin/opie-bluepin.control
index 7147975..e9aa683 100644
--- a/noncore/net/opietooth/blue-pin/opie-bluepin.control
+++ b/noncore/net/opietooth/blue-pin/opie-bluepin.control
@@ -6,3 +6,3 @@ Maintainer: Holger Freyther <zecke@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: 0.3.4-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal 8Depends: task-opie-minimal
diff --git a/noncore/net/opietooth/blue-pin/pindlgbase.ui b/noncore/net/opietooth/blue-pin/pindlgbase.ui
index 889a25e..6784de7 100644
--- a/noncore/net/opietooth/blue-pin/pindlgbase.ui
+++ b/noncore/net/opietooth/blue-pin/pindlgbase.ui
@@ -14,3 +14,3 @@
14 <y>0</y> 14 <y>0</y>
15 <width>258</width> 15 <width>254</width>
16 <height>245</height> 16 <height>245</height>
@@ -31,17 +31,2 @@
31 </property> 31 </property>
32 <widget>
33 <class>QLabel</class>
34 <property stdset="1">
35 <name>name</name>
36 <cstring>txtStatus</cstring>
37 </property>
38 <property stdset="1">
39 <name>text</name>
40 <string></string>
41 </property>
42 <property stdset="1">
43 <name>textFormat</name>
44 <enum>RichText</enum>
45 </property>
46 </widget>
47 <spacer> 32 <spacer>
@@ -68,2 +53,17 @@
68 <widget> 53 <widget>
54 <class>QLabel</class>
55 <property stdset="1">
56 <name>name</name>
57 <cstring>txtStatus</cstring>
58 </property>
59 <property stdset="1">
60 <name>text</name>
61 <string></string>
62 </property>
63 <property stdset="1">
64 <name>textFormat</name>
65 <enum>RichText</enum>
66 </property>
67 </widget>
68 <widget>
69 <class>QLayoutWidget</class> 69 <class>QLayoutWidget</class>
diff --git a/noncore/net/opietooth/lib/libopietooth1.control b/noncore/net/opietooth/lib/libopietooth1.control
index 20e4b76..9bc9572 100644
--- a/noncore/net/opietooth/lib/libopietooth1.control
+++ b/noncore/net/opietooth/lib/libopietooth1.control
@@ -7,3 +7,3 @@ Architecture: arm
7Replaces: libopietooth 7Replaces: libopietooth
8Depends: libqte2 (>=2.3.4), libopie1, task-bluez 8Depends: libqte2 (>=2.3.4), libopiecore2, task-bluez
9Description: Opie bluetooth library 9Description: Opie bluetooth library
diff --git a/noncore/net/opietooth/manager/opie-bluetoothmanager.control b/noncore/net/opietooth/manager/opie-bluetoothmanager.control
index 4fe1e06..89ab698 100644
--- a/noncore/net/opietooth/manager/opie-bluetoothmanager.control
+++ b/noncore/net/opietooth/manager/opie-bluetoothmanager.control
@@ -6,3 +6,3 @@ Maintainer: Maximilian Reiß <max.reiss@gmx.de>
6Architecture: arm 6Architecture: arm
7Version: 0.5.4-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal, libopietooth1, opie-bluepin 8Depends: task-opie-minimal, libopietooth1, opie-bluepin
diff --git a/noncore/net/wellenreiter/opie-wellenreiter.control b/noncore/net/wellenreiter/opie-wellenreiter.control
index e7bc25d..7dc9c22 100644
--- a/noncore/net/wellenreiter/opie-wellenreiter.control
+++ b/noncore/net/wellenreiter/opie-wellenreiter.control
@@ -6,4 +6,4 @@ Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: 1.0.3-cvs 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: libqpe1, libpcap0 (>=0.7.2), libopiecore2, libopienet2, libopieui2 8Depends: libqpe1, libpcap0.8 (>=0.7.2), libopiecore2, libopienet2, libopieui2
9Description: A WaveLAN Network Monitor 9Description: A WaveLAN Network Monitor
diff --git a/noncore/securityplugins/blueping/bluepingplugin.control b/noncore/securityplugins/blueping/bluepingplugin.control
index 0339996..62562f7 100644
--- a/noncore/securityplugins/blueping/bluepingplugin.control
+++ b/noncore/securityplugins/blueping/bluepingplugin.control
@@ -6,3 +6,3 @@ Maintainer: Clement Seveillac <clement@nist.gov>
6Architecture: arm 6Architecture: arm
7Version: 0.0.2.7 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: libopiecore2, opie-security, bluez-utils (<= 2.3rel-hh5) 8Depends: libopiecore2, opie-security, bluez-utils (<= 2.3rel-hh5)
diff --git a/noncore/securityplugins/dummy/dummyplugin.control b/noncore/securityplugins/dummy/dummyplugin.control
index 0ab2491..b4cc5e2 100644
--- a/noncore/securityplugins/dummy/dummyplugin.control
+++ b/noncore/securityplugins/dummy/dummyplugin.control
@@ -6,3 +6,3 @@ Maintainer: Clement Seveillac <clement@nist.gov>
6Architecture: arm 6Architecture: arm
7Version: 0.0.2.3 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: libopiecore2, opie-security 8Depends: libopiecore2, opie-security
diff --git a/noncore/securityplugins/notice/notice.control b/noncore/securityplugins/notice/notice.control
index 8b8c7cd..091ce74 100644
--- a/noncore/securityplugins/notice/notice.control
+++ b/noncore/securityplugins/notice/notice.control
@@ -6,3 +6,3 @@ Maintainer: Clement Seveillac <clement@nist.gov>
6Architecture: arm 6Architecture: arm
7Version: 0.0.1.6 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: libopiecore2, opie-security 8Depends: libopiecore2, opie-security
diff --git a/noncore/securityplugins/pin/pin.control b/noncore/securityplugins/pin/pin.control
index 3709d08..51c3f08 100644
--- a/noncore/securityplugins/pin/pin.control
+++ b/noncore/securityplugins/pin/pin.control
@@ -6,3 +6,3 @@ Maintainer: Clement Seveillac <clement@nist.gov>
6Architecture: arm 6Architecture: arm
7Version: 0.0.2.6 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: libopiecore2, opie-security 8Depends: libopiecore2, opie-security
diff --git a/noncore/settings/networksettings2/activatevpn.cpp b/noncore/settings/networksettings2/activatevpn.cpp
index 2bdef0a..b75e623 100644
--- a/noncore/settings/networksettings2/activatevpn.cpp
+++ b/noncore/settings/networksettings2/activatevpn.cpp
@@ -24,6 +24,4 @@ ActivateVPN::ActivateVPN( void ) :
24 QCheckListItem * CI; 24 QCheckListItem * CI;
25 printf( "%d\n", __LINE__ );
26 VPN_LV->clear(); 25 VPN_LV->clear();
27 VPN_LV->header()->hide(); 26 VPN_LV->header()->hide();
28 printf( "%d\n", __LINE__ );
29 27
@@ -32,9 +30,5 @@ ActivateVPN::ActivateVPN( void ) :
32 ++it ) { 30 ++it ) {
33 printf( "%d\n", __LINE__ );
34 if( it.current()->triggeredBy( "vpn" ) ) { 31 if( it.current()->triggeredBy( "vpn" ) ) {
35 printf( "%d\n", __LINE__ );
36 CI = new MyCheckListItem( it.current(), VPN_LV ); 32 CI = new MyCheckListItem( it.current(), VPN_LV );
37 printf( "%d\n", __LINE__ );
38 } 33 }
39 printf( "%d\n", __LINE__ );
40 } 34 }
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth.pro b/noncore/settings/networksettings2/bluetooth/bluetooth.pro
index 8170d46..2e3b5bb 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth.pro
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth.pro
@@ -3,9 +3,12 @@ CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = bluetooth_NN.h \ 4 HEADERS = bluetoothBNEP_NN.h \
5 bluetoothBNEP_NNI.h \ 5 bluetoothBNEP_NNI.h \
6 bluetoothRFCOMM_NN.h \
6 bluetoothRFCOMM_NNI.h \ 7 bluetoothRFCOMM_NNI.h \
7 bluetoothBNEPedit.h \ 8 bluetoothBNEPedit.h \
9 bluetoothRFCOMMrun.h \
8 bluetoothRFCOMMedit.h 10 bluetoothRFCOMMedit.h
9 SOURCES = bluetooth_NN.cpp \ 11 SOURCES = bluetoothBNEP_NN.cpp \
10 bluetoothBNEP_NNI.cpp \ 12 bluetoothBNEP_NNI.cpp \
13 bluetoothRFCOMM_NN.cpp \
11 bluetoothRFCOMM_NNI.cpp \ 14 bluetoothRFCOMM_NNI.cpp \
@@ -13,6 +16,7 @@ SOURCES = bluetooth_NN.cpp \
13 bluetoothBNEPrun.cpp \ 16 bluetoothBNEPrun.cpp \
17 bluetoothRFCOMMrun.cpp \
14 bluetoothRFCOMMedit.cpp 18 bluetoothRFCOMMedit.cpp
15 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 19 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2
16 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 20 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2
17LIBS += -lqpe 21LIBS += -lqpe -lopietooth2
18 INTERFACES= bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui 22 INTERFACES= bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp
index 398dcdc..42b2515 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp
@@ -2,3 +2,3 @@
2#include "bluetoothBNEP_NNI.h" 2#include "bluetoothBNEP_NNI.h"
3#include "bluetooth_NN.h" 3#include "bluetoothBNEP_NN.h"
4 4
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h
index 03c6903..f52a2c5 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h
@@ -5,6 +5,9 @@
5 5
6typedef struct BluetoothBNEPData { 6class BluetoothBNEPData {
7
8public :
9
7 bool AllowAll; 10 bool AllowAll;
8 QStringList BDAddress; 11 QStringList BDAddress;
9} BluetoothBNEPData_t; 12};
10 13
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp
index 24e4b7b..9d4ae97 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp
@@ -6,244 +6,156 @@
6 6
7QDict<QString> * BluetoothBNEPRun::PANConnections = 0; 7BluetoothBNEPRun::BluetoothBNEPRun( ANetNodeInstance * NNI,
8 BluetoothBNEPData & D ) :
9 RuntimeInfo( NNI ),
10 Data( D),
11 Pat( "bnep[0-6]" ) {
12 OT = 0;
13}
8 14
9void BluetoothBNEPRun::detectState( NodeCollection * NC ) { 15BluetoothBNEPRun::~BluetoothBNEPRun( void ) {
10 // unavailable : no card found 16 if( OT ) {
11 // available : card found and assigned to us or free 17 OTGateway::releaseOTGateway();
12 // up : card found and assigned to us and up 18 }
13 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); 19}
14 System & Sys = NSResources->system();
15 InterfaceInfo * Run;
16 QFile F( S );
17
18 Log(("Detecting for %s\n", NC->name().latin1() ));
19
20 if( F.open( IO_ReadOnly ) ) {
21 // could open file -> read interface and assign
22 QString X;
23 bool accepted = 0;
24 QTextStream TS(&F);
25 X = TS.readLine();
26 Log(("%s exists : %s\n", S.latin1(), X.latin1() ));
27 // find interface
28 if( handlesInterface( X ) ) {
29
30 Log(("Handles interface %s, PANC %p\n", X.latin1(), PANConnections ));
31 if( PANConnections == 0 ) {
32 // load connections that are active
33 // format : bnep0 00:60:57:02:71:A2 PANU
34 FILE * OutputOfCmd = popen( "pand --show", "r" ) ;
35
36 PANConnections = new QDict<QString>;
37
38 if( OutputOfCmd ) {
39 char ch;
40 // could fork
41 // read all data
42 QString Line = "";
43 while( 1 ) {
44 if( fread( &ch, 1, 1, OutputOfCmd ) < 1 ) {
45 // eof
46 break;
47 }
48 if( ch == '\n' || ch == '\r' ) {
49 if( ! Line.isEmpty() ) {
50 if( Line.startsWith( "bnep" ) ) {
51 QStringList SL = QStringList::split( " ", Line );
52 Log(("Detected PAN %s %s\n",
53 SL[0].latin1(), SL[1].latin1() ));
54 PANConnections->insert( SL[0], new QString(SL[1]));
55 }
56 Line="";
57 }
58 } else {
59 Line += ch;
60 }
61 }
62 }
63 20
64 pclose( OutputOfCmd ); 21State_t BluetoothBNEPRun::detectState( void ) {
65 }
66 22
67 // check if this runtime allows connection to node 23 /*
68 if( ! Data.AllowAll ) {
69 // has addresses
70 for ( QStringList::Iterator it = Data.BDAddress.begin();
71 ! accepted && it != Data.BDAddress.end();
72 ++ it ) {
73 for( QDictIterator<QString> it2( *(PANConnections) );
74 it2.current();
75 ++ it2 ) {
76 if( X == it2.currentKey() &&
77 (*it) == *(it2.current())
78 ) {
79 // found
80 Log(("%s accepts connections to %s\n",
81 NC->name().latin1(),
82 it2.current()->latin1() ));
83 accepted = 1;
84 break;
85 }
86 }
87 }
88 } else {
89 Log(("%s accepts any connection\n", NC->name().latin1() ));
90 // accept any
91 accepted = 1;
92 }
93 24
94 if( accepted ) { 25 need to detect
95 // matches and is allowed for this node 26
96 for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); 27 1. for any PAN connection that is found if that
97 It.current(); 28 PAN is connected.
98 ++It ) { 29
99 Run = It.current(); 30 if it is connected it is not available (since we do
100 if( X == Run->Name ) { 31 not manage IP settings and we are called to detect
101 Log(("%s Assigned %p\n", NC->name().latin1(), Run )); 32 the state we knwo that we do not have an UP connection)
102 Run->assignNode( netNode() ); 33
103 assignInterface( Run ); 34 2. if it not connected and we allow any connection we
104 NC->setCurrentState( IsUp ); 35 are available or if that PAN connection is to a device
105 return; 36 with a correct address
106 } 37
107 } 38 3. if it is not connected and the address do not match or
108 } 39 we do not accept any address, we are Unavailable but
109 } 40 not DOWN. I.e a new connection could perhaps be created
110 } 41
111 42 */
112 Log(("Assigned %p\n", assignedInterface() )); 43
113 if( ( Run = assignedInterface() ) ) { 44 if( ! OT ) {
114 // we already have an interface assigned -> still present ? 45 OT = OTGateway::getOTGateway();
115 if( ! Run->IsUp ) {
116 // usb is still free -> keep assignment
117 NC->setCurrentState( Available );
118 return;
119 } // else interface is up but NOT us -> some other profile
120 } 46 }
121 47
122 // nothing (valid) assigned to us 48 if( ! OT->isEnabled() ) {
123 assignInterface( 0 ); 49 return Unavailable;
124
125 // find possible interface
126 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
127 It.current();
128 ++It ) {
129 Run = It.current();
130
131 Log(("%s %d %d=%d %d\n",
132 Run->Name.latin1(),
133 handlesInterface( Run->Name ),
134 Run->CardType, ARPHRD_ETHER,
135 ! Run->IsUp ));
136
137 if( handlesInterface( Run->Name ) &&
138 Run->CardType == ARPHRD_ETHER &&
139 ! Run->IsUp
140 ) {
141 Log(("Released(OFF)\n" ));
142 // proper type, and Not UP -> free
143 NC->setCurrentState( Off );
144 return;
145 }
146 } 50 }
147 // no free found
148 Log(("None available\n" ));
149 51
150 NC->setCurrentState( Unavailable ); 52 // if there is a PAN connection that is UP but not
53 // yet configured (no ifup) the we are available
54 return ( hasFreePANConnection() ) ? Available : Unknown;
151} 55}
152 56
153bool BluetoothBNEPRun::setState( NodeCollection * NC, Action_t A, bool ) { 57QString BluetoothBNEPRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
154 58
155 // we only handle activate and deactivate 59 if( A == Activate ) {
156 switch( A ) { 60 if( hasFreePANConnection( 1 ) ) {
157 case Activate : 61 // we have now an assignedinterface
158 { 62 } else {
159 if( NC->currentState() != Off ) { 63 return QString("TODO : Start PAND");
160 return 0; 64 }
161 } 65
162 InterfaceInfo * N = getInterface(); 66 Log(( "Assigned interface" ));
163 if( ! N ) { 67 NC->setCurrentState( Available );
164 // no interface available 68
165 NC->setCurrentState( Unavailable ); 69 return QString();
166 return 0;
167 }
168 // because we were OFF the interface
169 // we get back is NOT assigned
170 N->assignNode( netNode() );
171 assignInterface( N );
172 Log(("Assing %p\n", N ));
173 NC->setCurrentState( Available );
174 return 1;
175 }
176 case Deactivate :
177 if( NC->currentState() == IsUp ) {
178 // bring down first
179 if( ! connection()->setState( Down ) )
180 // could not ...
181 return 0;
182 } else if( NC->currentState() != Available ) {
183 return 1;
184 }
185 assignedInterface()->assignNode( 0 ); // release
186 assignInterface( 0 );
187 NC->setCurrentState( Off );
188 return 1;
189 default :
190 // FT
191 break;
192 } 70 }
193 return 0; 71
72 if( A == Deactivate ) {
73 // nothing to do
74 NC->setCurrentState( Off );
75 return QString();
76 }
77 return QString();
194} 78}
195 79
196bool BluetoothBNEPRun::canSetState( State_t Curr , Action_t A ) { 80bool BluetoothBNEPRun::handlesInterface( const QString & S ) {
197 // we only handle up down activate and deactivate 81 return Pat.match( S ) >= 0;
198 switch( A ) { 82}
199 case Activate : 83
200 { // at least available 84bool BluetoothBNEPRun::handlesInterface( InterfaceInfo * I ) {
201 if( Curr == Available ) { 85 return handlesInterface( I->Name );
202 return 1; 86}
203 } 87
204 // or we can make one available 88bool BluetoothBNEPRun::hasFreePANConnection( bool Grab ) {
205 InterfaceInfo * N = getInterface(); 89
206 if( ! N || N->assignedNode() != 0 ) { 90 if( ! OT ) {
207 // non available or assigned 91 OT = OTGateway::getOTGateway();
208 return 0; 92 }
93
94 // load PAN connections
95 OTPANConnection * C;
96 InterfaceInfo * Run;
97 InterfaceInfo * Candidate = 0; // reuse this interface
98 PANConnectionVector Conns = OT->getPANConnections();
99 System & Sys = NSResources->system();
100 bool IsValid;
101
102 for( unsigned int i = 0;
103 i < Conns.count();
104 i ++ ) {
105 C = Conns[i];
106
107 if( Data.AllowAll ) {
108 // we allow all
109 IsValid = 1;
110 } else {
111 // is this PAN connection connecting to a Peer
112 // we allow ?
113 IsValid = 0;
114 for ( QStringList::Iterator it = Data.BDAddress.begin();
115 it != Data.BDAddress.end();
116 ++ it ) {
117 if( C->ConnectedTo == (*it) ) {
118 // this is a connection we could accept
119 IsValid = 1;
120 break;
209 } 121 }
210 return 1;
211 } 122 }
212 case Deactivate : 123 }
213 return ( Curr >= Available ); 124
214 default : 125 if( ! IsValid ) {
215 // FT 126 Log(("%s to %s not acceptable\n",
216 break; 127 C->Device.latin1(),
128 C->ConnectedTo.latin1() ));
129 // don't bother checking this address
130 // it is not acceptable
131 continue;
132 }
133
134 // is this PAN connection available to us ?
135 Run = Sys.findInterface( C->Device );
136
137 if( Run && Run->IsUp ) {
138 // this PAN connection is up
139 Log(("%s acceptable but unavailable\n",
140 C->Device.latin1() ));
141 // find others
142 continue;
143 }
144
145 // we at least have a possible interface
146 if( ! Candidate ) {
147 Candidate = Run;
148 }
217 } 149 }
218 return 0;
219}
220 150
221// get interface that is free or assigned to us 151 if( Candidate ) {
222InterfaceInfo * BluetoothBNEPRun::getInterface( void ) { 152 if ( Grab ) {
223 153 netNode()->connection()->assignInterface( Candidate );
224 System & S = NSResources->system();
225 InterfaceInfo * best = 0, * Run;
226
227 for( QDictIterator<InterfaceInfo> It(S.interfaces());
228 It.current();
229 ++It ) {
230 Run = It.current();
231 if( handlesInterface( Run->Name ) &&
232 Run->CardType == ARPHRD_ETHER
233 ) {
234 // this is a bluetooth card
235 if( Run->assignedNode() == netNode() ) {
236 // assigned to us
237 return Run;
238 } else if( Run->assignedNode() == 0 ) {
239 // free
240 best = Run;
241 }
242 } 154 }
155 return 1;
243 } 156 }
244 return best; // can be 0
245}
246 157
247bool BluetoothBNEPRun::handlesInterface( const QString & S ) { 158 // no free PAN
248 return Pat.match( S ) >= 0; 159 return 0;
249} 160}
161
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
index ce03cbb..a05a7a2 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
@@ -1,5 +1,8 @@
1#include <asdevice.h> 1#include <netnode.h>
2#include "bluetoothBNEPdata.h" 2#include "bluetoothBNEPdata.h"
3 3
4class BluetoothBNEPRun : public AsDevice { 4#include <OTGateway.h>
5using namespace Opietooth2;
6
7class BluetoothBNEPRun : public RuntimeInfo {
5 8
@@ -8,13 +11,13 @@ public :
8 BluetoothBNEPRun( ANetNodeInstance * NNI, 11 BluetoothBNEPRun( ANetNodeInstance * NNI,
9 BluetoothBNEPData & D ) : 12 BluetoothBNEPData & D );
10 AsDevice( NNI ), 13 virtual ~BluetoothBNEPRun( void );
11 Data( D), 14
12 Pat( "bnep[0-6]" ) 15 // i am a device
13 { } 16 virtual RuntimeInfo * device( void )
17 { return this; }
14 18
15 virtual AsDevice * asDevice( void ) 19 bool handlesInterface( const QString & );
16 { return (AsDevice *)this; } 20 bool handlesInterface( InterfaceInfo * );
17 21
18 virtual AsDevice * device( void ) 22 State_t detectState( void );
19 { return asDevice(); }
20 23
@@ -22,6 +25,3 @@ protected :
22 25
23 void detectState( NodeCollection * ); 26 QString setMyState( NodeCollection * , Action_t, bool );
24 bool setState( NodeCollection * , Action_t, bool );
25 bool canSetState( State_t , Action_t );
26 bool handlesInterface( const QString & );
27 27
@@ -29,5 +29,6 @@ private :
29 29
30 InterfaceInfo * getInterface( void ); 30 bool hasFreePANConnection( bool Grab = 0 );
31
31 BluetoothBNEPData & Data; 32 BluetoothBNEPData & Data;
32 static QDict<QString> * PANConnections; 33 OTGateway * OT;
33 QRegExp Pat; 34 QRegExp Pat;
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui
index 2754a70..7f6565a 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui
@@ -13,4 +13,4 @@
13 <y>0</y> 13 <y>0</y>
14 <width>283</width> 14 <width>488</width>
15 <height>199</height> 15 <height>604</height>
16 </rect> 16 </rect>
@@ -30,3 +30,3 @@
30 <name>margin</name> 30 <name>margin</name>
31 <number>2</number> 31 <number>0</number>
32 </property> 32 </property>
@@ -34,5 +34,23 @@
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>2</number> 35 <number>3</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QLabel</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>TextLabel5_2</cstring>
42 </property>
43 <property stdset="1">
44 <name>text</name>
45 <string>Selected devices with gprs capability</string>
46 </property>
47 <property stdset="1">
48 <name>alignment</name>
49 <set>WordBreak|AlignVCenter|AlignLeft</set>
50 </property>
51 <property>
52 <name>wordwrap</name>
53 </property>
54 </widget>
55 <widget>
38 <class>QLayoutWidget</class> 56 <class>QLayoutWidget</class>
@@ -40,3 +58,6 @@
40 <name>name</name> 58 <name>name</name>
41 <cstring>Layout4</cstring> 59 <cstring>Layout8</cstring>
60 </property>
61 <property>
62 <name>layoutSpacing</name>
42 </property> 63 </property>
@@ -49,3 +70,3 @@
49 <name>spacing</name> 70 <name>spacing</name>
50 <number>6</number> 71 <number>3</number>
51 </property> 72 </property>
@@ -55,3 +76,3 @@
55 <name>name</name> 76 <name>name</name>
56 <cstring>TextLabel4</cstring> 77 <cstring>TextLabel5</cstring>
57 </property> 78 </property>
@@ -59,3 +80,3 @@
59 <name>text</name> 80 <name>text</name>
60 <string>Name</string> 81 <string>Address</string>
61 </property> 82 </property>
@@ -66,3 +87,14 @@
66 <name>name</name> 87 <name>name</name>
67 <cstring>Name_LE</cstring> 88 <cstring>Address_LE</cstring>
89 </property>
90 </widget>
91 <widget>
92 <class>QToolButton</class>
93 <property stdset="1">
94 <name>name</name>
95 <cstring>FindDevice_TB</cstring>
96 </property>
97 <property stdset="1">
98 <name>text</name>
99 <string>...</string>
68 </property> 100 </property>
@@ -72,18 +104,82 @@
72 <widget> 104 <widget>
73 <class>QLabel</class> 105 <class>QLayoutWidget</class>
74 <property stdset="1"> 106 <property stdset="1">
75 <name>name</name> 107 <name>name</name>
76 <cstring>TextLabel3</cstring> 108 <cstring>Layout7</cstring>
77 </property> 109 </property>
78 <property stdset="1"> 110 <property>
79 <name>text</name> 111 <name>layoutSpacing</name>
80 <string>Description</string>
81 </property>
82 </widget>
83 <widget>
84 <class>QMultiLineEdit</class>
85 <property stdset="1">
86 <name>name</name>
87 <cstring>Description_LE</cstring>
88 </property> 112 </property>
113 <hbox>
114 <property stdset="1">
115 <name>margin</name>
116 <number>0</number>
117 </property>
118 <property stdset="1">
119 <name>spacing</name>
120 <number>3</number>
121 </property>
122 <widget>
123 <class>QLabel</class>
124 <property stdset="1">
125 <name>name</name>
126 <cstring>TextLabel2</cstring>
127 </property>
128 <property stdset="1">
129 <name>text</name>
130 <string>Channel</string>
131 </property>
132 </widget>
133 <widget>
134 <class>QSpinBox</class>
135 <property stdset="1">
136 <name>name</name>
137 <cstring>Channel_SB</cstring>
138 </property>
139 <property stdset="1">
140 <name>sizePolicy</name>
141 <sizepolicy>
142 <hsizetype>0</hsizetype>
143 <vsizetype>0</vsizetype>
144 </sizepolicy>
145 </property>
146 <property stdset="1">
147 <name>minValue</name>
148 <number>1</number>
149 </property>
150 </widget>
151 <widget>
152 <class>QLabel</class>
153 <property stdset="1">
154 <name>name</name>
155 <cstring>TextLabel2_2</cstring>
156 </property>
157 <property stdset="1">
158 <name>text</name>
159 <string>Name</string>
160 </property>
161 </widget>
162 <widget>
163 <class>QLabel</class>
164 <property stdset="1">
165 <name>name</name>
166 <cstring>Name_LBL</cstring>
167 </property>
168 <property stdset="1">
169 <name>sizePolicy</name>
170 <sizepolicy>
171 <hsizetype>7</hsizetype>
172 <vsizetype>1</vsizetype>
173 </sizepolicy>
174 </property>
175 <property stdset="1">
176 <name>frameShape</name>
177 <enum>Box</enum>
178 </property>
179 <property stdset="1">
180 <name>indent</name>
181 <number>0</number>
182 </property>
183 </widget>
184 </hbox>
89 </widget> 185 </widget>
@@ -95,2 +191,5 @@
95 </property> 191 </property>
192 <property>
193 <name>layoutSpacing</name>
194 </property>
96 <hbox> 195 <hbox>
@@ -102,9 +201,16 @@
102 <name>spacing</name> 201 <name>spacing</name>
103 <number>6</number> 202 <number>3</number>
104 </property> 203 </property>
105 <widget> 204 <widget>
106 <class>QCheckBox</class> 205 <class>QLabel</class>
107 <property stdset="1"> 206 <property stdset="1">
108 <name>name</name> 207 <name>name</name>
109 <cstring>Automatic_CB</cstring> 208 <cstring>TextLabel7</cstring>
209 </property>
210 <property stdset="1">
211 <name>sizePolicy</name>
212 <sizepolicy>
213 <hsizetype>7</hsizetype>
214 <vsizetype>1</vsizetype>
215 </sizepolicy>
110 </property> 216 </property>
@@ -112,3 +218,21 @@
112 <name>text</name> 218 <name>text</name>
113 <string>Start automatically</string> 219 <string>Addresses</string>
220 </property>
221 <property stdset="1">
222 <name>alignment</name>
223 <set>AlignVCenter|AlignLeft</set>
224 </property>
225 <property>
226 <name>vAlign</name>
227 </property>
228 </widget>
229 <widget>
230 <class>QToolButton</class>
231 <property stdset="1">
232 <name>name</name>
233 <cstring>Add_TB</cstring>
234 </property>
235 <property stdset="1">
236 <name>text</name>
237 <string>...</string>
114 </property> 238 </property>
@@ -116,6 +240,6 @@
116 <widget> 240 <widget>
117 <class>QCheckBox</class> 241 <class>QToolButton</class>
118 <property stdset="1"> 242 <property stdset="1">
119 <name>name</name> 243 <name>name</name>
120 <cstring>Confirm_CB</cstring> 244 <cstring>Remove_TB</cstring>
121 </property> 245 </property>
@@ -123,3 +247,3 @@
123 <name>text</name> 247 <name>text</name>
124 <string>Confirm before start</string> 248 <string>...</string>
125 </property> 249 </property>
@@ -128,4 +252,80 @@
128 </widget> 252 </widget>
253 <widget>
254 <class>QListView</class>
255 <column>
256 <property>
257 <name>text</name>
258 <string>Name</string>
259 </property>
260 <property>
261 <name>clickable</name>
262 <bool>true</bool>
263 </property>
264 <property>
265 <name>resizeable</name>
266 <bool>true</bool>
267 </property>
268 </column>
269 <column>
270 <property>
271 <name>text</name>
272 <string>Channel</string>
273 </property>
274 <property>
275 <name>clickable</name>
276 <bool>true</bool>
277 </property>
278 <property>
279 <name>resizeable</name>
280 <bool>true</bool>
281 </property>
282 </column>
283 <column>
284 <property>
285 <name>text</name>
286 <string>Address</string>
287 </property>
288 <property>
289 <name>clickable</name>
290 <bool>true</bool>
291 </property>
292 <property>
293 <name>resizeable</name>
294 <bool>true</bool>
295 </property>
296 </column>
297 <property stdset="1">
298 <name>name</name>
299 <cstring>Addresses_LV</cstring>
300 </property>
301 <property stdset="1">
302 <name>allColumnsShowFocus</name>
303 <bool>true</bool>
304 </property>
305 </widget>
129 </vbox> 306 </vbox>
130</widget> 307</widget>
308<connections>
309 <connection>
310 <sender>Add_TB</sender>
311 <signal>clicked()</signal>
312 <receiver>BluetoothRFCOMM_FRM</receiver>
313 <slot>SLOT_AddServer()</slot>
314 </connection>
315 <connection>
316 <sender>Remove_TB</sender>
317 <signal>clicked()</signal>
318 <receiver>BluetoothRFCOMM_FRM</receiver>
319 <slot>SLOT_RemoveServer()</slot>
320 </connection>
321 <connection>
322 <sender>FindDevice_TB</sender>
323 <signal>clicked()</signal>
324 <receiver>BluetoothRFCOMM_FRM</receiver>
325 <slot>SLOT_FindDevice()</slot>
326 </connection>
327 <slot access="public">SLOT_AddServer()</slot>
328 <slot access="public">SLOT_RemoveServer()</slot>
329 <slot access="public">SLOT_FindDevice()</slot>
330</connections>
131</UI> 331</UI>
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp
index 7ec8288..d19386e 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp
@@ -2,13 +2,32 @@
2#include "bluetoothRFCOMM_NNI.h" 2#include "bluetoothRFCOMM_NNI.h"
3#include "bluetooth_NN.h" 3#include "bluetoothRFCOMM_NN.h"
4 4
5ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) : ANetNodeInstance( PNN ) { 5ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) :
6 GUI = 0; 6 ANetNodeInstance( PNN ), Data() {
7 RT = 0; 7 Data.Devices.setAutoDelete( TRUE );
8 GUI = 0;
9 RT = 0;
8} 10}
9 11
10void ABluetoothRFCOMM::setSpecificAttribute( QString & , QString & ) { 12void ABluetoothRFCOMM::setSpecificAttribute( QString & A, QString & V) {
13
14 if( A == "bdaddress" ) {
15 Data.Devices.resize( Data.Devices.size() + 1 );
16 Data.Devices.insert( Data.Devices.size() - 1, new RFCOMMChannel);
17 Data.Devices[ Data.Devices.size() - 1 ]->BDAddress = V;
18 } else if ( A == "channel" ) {
19 Data.Devices[ Data.Devices.size() - 1 ]->Channel = V.toLong();
20 } else if ( A == "name" ) {
21 Data.Devices[ Data.Devices.size() - 1 ]->Name = V;
22 }
11} 23}
12 24
13void ABluetoothRFCOMM::saveSpecificAttribute( QTextStream & ) { 25void ABluetoothRFCOMM::saveSpecificAttribute( QTextStream & TS ) {
26 for( unsigned int i = 0 ;
27 i < Data.Devices.count();
28 i ++ ) {
29 TS << "bdaddress=" << Data.Devices[i]->BDAddress << endl;
30 TS << "name=" << quote( Data.Devices[i]->Name ) << endl;
31 TS << "channel=" << Data.Devices[i]->Channel << endl;
32 }
14} 33}
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h
index 18f0d38..14cfeb0 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h
@@ -4,14 +4,18 @@
4#include <qstring.h> 4#include <qstring.h>
5#include <qvector.h>
5 6
6typedef struct BluetoothRFCOMMData { 7class RFCOMMChannel {
7 QString Device;
8 QString LockFile;
9 long Speed;
10 short Parity;
11 short DataBits;
12 short StopBits;
13 bool HardwareControl;
14 bool SoftwareControl;
15 8
16} BluetoothRFCOMMData_t; 9public :
10 QString BDAddress;
11 QString Name;
12 int Channel;
13};
14
15class BluetoothRFCOMMData {
16
17public :
18
19 QVector<RFCOMMChannel> Devices;
20};
17 21
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp
index d3ddab4..7cac13f 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp
@@ -1 +1,12 @@
1#include <qlistview.h>
2#include <qdialog.h>
3#include <qlabel.h>
4#include <qlineedit.h>
5#include <qtoolbutton.h>
6#include <qcheckbox.h>
7#include <qspinbox.h>
8#include <OTPeer.h>
9#include <OTGateway.h>
10#include <Opietooth.h>
11#include <resources.h>
1#include <GUIUtils.h> 12#include <GUIUtils.h>
@@ -3,5 +14,45 @@
3 14
15using namespace Opietooth2;
16
17class PeerLBI : public QListViewItem {
18
19public :
20
21 PeerLBI( OTPeer * P, int Ch, QListView * LV ) : QListViewItem( LV ) {
22 Peer = P;
23 Channel = Ch;
24
25 setText( 0, (P->name().isEmpty()) ?
26 P->address().toString() :
27 P->name() );
28 QString S;
29 S.setNum( Ch );
30 setText( 1, S );
31 setText( 2, P->address().toString() );
32 }
33 ~PeerLBI( ) {
34 }
35
36 inline int channel( void ) const
37 { return Channel; }
38 inline OTPeer * peer( void ) const
39 { return Peer; }
40
41 int Channel;
42 OTPeer * Peer;
43};
44
4BluetoothRFCOMMEdit::BluetoothRFCOMMEdit( QWidget * Parent ) : 45BluetoothRFCOMMEdit::BluetoothRFCOMMEdit( QWidget * Parent ) :
5 BluetoothRFCOMMGUI( Parent ){ 46 BluetoothRFCOMMGUI( Parent ){
47 Modified = 0;
48 OT = OTGateway::getOTGateway();
49
50 Add_TB->setPixmap( NSResources->getPixmap( "add" ) );
51 Remove_TB->setPixmap( NSResources->getPixmap( "remove" ) );
52 FindDevice_TB->setPixmap( NSResources->getPixmap( "Devices/bluetooth" ) );
53 Addresses_LV->setColumnAlignment( 1, Qt::AlignRight );
54}
6 55
56BluetoothRFCOMMEdit::~BluetoothRFCOMMEdit( void ) {
57 OTGateway::releaseOTGateway();
7} 58}
@@ -9,3 +60,30 @@ BluetoothRFCOMMEdit::BluetoothRFCOMMEdit( QWidget * Parent ) :
9QString BluetoothRFCOMMEdit::acceptable( void ) { 60QString BluetoothRFCOMMEdit::acceptable( void ) {
10 return QString(); 61 return QString();
62}
63
64bool BluetoothRFCOMMEdit::commit( BluetoothRFCOMMData & Data ) {
65 int ct = 0;
66 PeerLBI * I;
67
68 if( Modified ) {
69 QListViewItem * it = Addresses_LV->firstChild();
70
71 Data.Devices.resize( 0 );
72 while( it ) {
73
74 ct ++;
75 Data.Devices.resize( ct );
76 I = (PeerLBI * )it;
77
78 Data.Devices.insert( ct-1, new RFCOMMChannel );
79
80 Data.Devices[ct-1]->BDAddress = I->peer()->address().toString();
81 Data.Devices[ct-1]->Name = I->peer()->name();
82 Data.Devices[ct-1]->Channel = I->channel();
83
84 it = it->nextSibling();
85 }
86 }
87
88 return Modified;
11} 89}
@@ -13,6 +91,66 @@ QString BluetoothRFCOMMEdit::acceptable( void ) {
13void BluetoothRFCOMMEdit::showData( BluetoothRFCOMMData & Data ) { 91void BluetoothRFCOMMEdit::showData( BluetoothRFCOMMData & Data ) {
92
93 OTPeer * P;
94
95 for( unsigned int i = 0;
96 i < Data.Devices.count();
97 i ++ ) {
98 P = new OTPeer( OT );
99 P->setAddress( OTDeviceAddress( Data.Devices[i]->BDAddress ) );
100 P->setName( Data.Devices[i]->Name );
101
102 new PeerLBI( P, Data.Devices[i]->Channel, Addresses_LV );
103 }
104 Modified = 0;
14} 105}
15 106
16bool BluetoothRFCOMMEdit::commit( BluetoothRFCOMMData & Data ) { 107void BluetoothRFCOMMEdit::SLOT_AddServer( void ) {
17 return 0; 108 QListViewItem * it = Addresses_LV->firstChild();
109
110 while( it ) {
111 // check address
112 if( it->text(2) == Address_LE->text() ) {
113 // already in table
114 return;
115 }
116 it = it->nextSibling();
117 }
118
119 // new server
120 Modified = 1;
121 OTPeer * P = new OTPeer( OT );
122 P->setAddress( OTDeviceAddress( Address_LE->text() ) );
123 P->setName( Name_LBL->text() );
124 new PeerLBI( P, Channel_SB->value(), Addresses_LV );
125
126 Address_LE->setText("");
127 Name_LBL->setText("");
128 Channel_SB->setValue(1);
129}
130
131void BluetoothRFCOMMEdit::SLOT_RemoveServer( void ) {
132
133 QListViewItem * it = Addresses_LV->firstChild();
134
135 while( it ) {
136 // check address
137 if( it->isSelected() ) {
138 delete it;
139 Modified = 1;
140 return;
141 }
142 it = it->nextSibling();
143 }
144}
145
146void BluetoothRFCOMMEdit::SLOT_FindDevice( void ) {
147 OTPeer * Peer;
148 int Channel;
149
150 // find device in Opietooth
151 if( OTScan::getDevice( Peer, Channel, OT ) == QDialog::Accepted ) {
152 Address_LE->setText( Peer->address().toString() );
153 Name_LBL->setText( Peer->name() );
154 Channel_SB->setValue( Channel );
155 }
18} 156}
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h
index 14a6d64..9ad8f2a 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h
@@ -3,2 +3,5 @@
3 3
4#include <Opietooth.h>
5using namespace Opietooth2;
6
4class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI { 7class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI {
@@ -8,2 +11,3 @@ public :
8 BluetoothRFCOMMEdit( QWidget * parent ); 11 BluetoothRFCOMMEdit( QWidget * parent );
12 virtual ~BluetoothRFCOMMEdit( void );
9 13
@@ -12,2 +16,12 @@ public :
12 bool commit( BluetoothRFCOMMData & Data ); 16 bool commit( BluetoothRFCOMMData & Data );
17
18 bool Modified;
19 OTGateway * OT;
20
21public slots :
22
23 void SLOT_AddServer( void );
24 void SLOT_RemoveServer( void );
25 void SLOT_FindDevice( void );
26
13}; 27};
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
index 65fd686..24e3dae 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
@@ -1,5 +1,8 @@
1#include <asline.h> 1#include <netnode.h>
2#include "bluetoothRFCOMMdata.h" 2#include "bluetoothRFCOMMdata.h"
3 3
4class BluetoothRFCOMMRun : public AsLine { 4#include <OTGateway.h>
5using namespace Opietooth2;
6
7class BluetoothRFCOMMRun : public RuntimeInfo {
5 8
@@ -8,10 +11,11 @@ public :
8 BluetoothRFCOMMRun( ANetNodeInstance * NNI, 11 BluetoothRFCOMMRun( ANetNodeInstance * NNI,
9 BluetoothRFCOMMData & Data ) : AsLine( NNI ) 12 BluetoothRFCOMMData & D ) : RuntimeInfo( NNI )
10 { } 13 { DeviceNr = -1; Data = &D; OT = 0; }
14 virtual ~BluetoothRFCOMMRun( void );
11 15
12 virtual AsLine * asLine( void ) 16 virtual RuntimeInfo * line( void )
13 { return (AsLine *)this; } 17 { return this; }
18 virtual QString deviceFile( void );
14 19
15 virtual QString deviceFile( void ) 20 State_t detectState( void );
16 { return QString( "/dev/rfcomm..." ); }
17 21
@@ -19,10 +23,11 @@ protected :
19 23
20 void detectState( NodeCollection * ) 24 QString setMyState( NodeCollection * , Action_t, bool );
21 { }
22 25
23 bool setState( NodeCollection * , Action_t, bool ) 26private :
24 { return 0; }
25 27
26 bool canSetState( State_t , Action_t ) 28 int deviceNrOfConnection( void );
27 { return 0; } 29 RFCOMMChannel * getChannel( void );
30 BluetoothRFCOMMData * Data;
31 Opietooth2::OTGateway * OT;
32 int DeviceNr; // cached from detection
28}; 33};
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
index 443a627..9be6b16 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
@@ -14,2 +14,7 @@ static const char * BluetoothBNEPNeeds[] =
14 14
15static const char * BluetoothBNEPProvides[] =
16 { "device",
17 0
18 };
19
15/** 20/**
@@ -44,4 +49,4 @@ const char ** BluetoothBNEPNetNode::needs( void ) {
44 49
45const char * BluetoothBNEPNetNode::provides( void ) { 50const char ** BluetoothBNEPNetNode::provides( void ) {
46 return "device"; 51 return BluetoothBNEPProvides;
47} 52}
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
index 4d6a3c1..b93342e 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
@@ -24,3 +24,3 @@ public:
24 virtual ANetNodeInstance * createInstance( void ); 24 virtual ANetNodeInstance * createInstance( void );
25 virtual const char * provides( void ); 25 virtual const char ** provides( void );
26 virtual const char ** needs( void ); 26 virtual const char ** needs( void );
diff --git a/noncore/settings/networksettings2/bluetooth/config.in b/noncore/settings/networksettings2/bluetooth/config.in
index 6968ac8..398cff1 100644
--- a/noncore/settings/networksettings2/bluetooth/config.in
+++ b/noncore/settings/networksettings2/bluetooth/config.in
@@ -3,2 +3,2 @@
3 default "n" if NS2 3 default "n" if NS2
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE && NS2OPIETOOTH
diff --git a/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control b/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control
index ea77bd7..c4d29f2 100644
--- a/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control
+++ b/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-bluetooth 1Package: opie-networksettings2plugin-bluetooth
2Files: plugins/networksettings2/libbluetooth.so* 2Files: plugins/networksettings2/libbluetooth.so*
@@ -6,3 +6,3 @@ Maintainer: Wim Delvaux <wimpie@handhelds.org>
6Architecture: arm 6Architecture: arm
7Depends: opie-networksettings2, libopiecore2, libopienet2 7Depends: opie-networksettings2, libopietooth2, libopiecore2, libopienet2
8Description: Network settings bluetooth plugin. 8Description: Network settings bluetooth plugin.
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp
index 38568df..dc4205c 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NN.cpp
@@ -7,2 +7,7 @@ static const char * CableNeeds[] =
7 7
8static const char * CableProvides[] =
9 { "line",
10 0
11 };
12
8/** 13/**
@@ -34,4 +39,4 @@ const char ** CableNetNode::needs( void ) {
34 39
35const char * CableNetNode::provides( void ) { 40const char ** CableNetNode::provides( void ) {
36 return "line"; 41 return CableProvides;
37} 42}
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h
index 5cc2b2d..8d649cc 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.h
+++ b/noncore/settings/networksettings2/cable/cable_NN.h
@@ -22,3 +22,3 @@ public:
22 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
23 virtual const char * provides( void ); 23 virtual const char ** provides( void );
24 24
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp
index 4bd9421..12a00a2 100644
--- a/noncore/settings/networksettings2/cable/cable_NNI.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp
@@ -51,5 +51,3 @@ void ACable::saveSpecificAttribute( QTextStream & TS ) {
51 51
52short ACable::generateFileEmbedded( const QString & ID, 52short ACable::generateFileEmbedded( SystemFile & SF,
53 const QString & Path,
54 QTextStream & TS,
55 long DevNr ) { 53 long DevNr ) {
@@ -58,8 +56,8 @@ short ACable::generateFileEmbedded( const QString & ID,
58 rvl = 1; 56 rvl = 1;
59 if( ID == "peers" ) { 57 if( SF.name() == "peers" ) {
60 TS << Data.Device 58 SF << Data.Device
61 << endl; 59 << endl;
62 TS << Data.Speed 60 SF << Data.Speed
63 << endl; 61 << endl;
64 TS << "lock " 62 SF << "lock "
65 << Data.LockFile 63 << Data.LockFile
@@ -69,3 +67,3 @@ short ACable::generateFileEmbedded( const QString & ID,
69 67
70 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr ); 68 rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr );
71 return (rvd == 2 || rvl == 2 ) ? 2 : 69 return (rvd == 2 || rvl == 2 ) ? 2 :
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.h b/noncore/settings/networksettings2/cable/cable_NNI.h
index d06cbbe..18a52de 100644
--- a/noncore/settings/networksettings2/cable/cable_NNI.h
+++ b/noncore/settings/networksettings2/cable/cable_NNI.h
@@ -28,5 +28,3 @@ public :
28 28
29 short generateFileEmbedded( const QString & ID, 29 short generateFileEmbedded( SystemFile & Sf,
30 const QString & Path,
31 QTextStream & TS,
32 long DevNr ); 30 long DevNr );
@@ -40,3 +38,3 @@ private :
40 CableEdit * GUI; 38 CableEdit * GUI;
41 CableData_t Data; 39 CableData Data;
42 CableRun * RT; 40 CableRun * RT;
diff --git a/noncore/settings/networksettings2/cable/cabledata.h b/noncore/settings/networksettings2/cable/cabledata.h
index c449d96..ea81f8d 100644
--- a/noncore/settings/networksettings2/cable/cabledata.h
+++ b/noncore/settings/networksettings2/cable/cabledata.h
@@ -5,3 +5,6 @@
5 5
6typedef struct CableData { 6class CableData {
7
8public :
9
7 QString Device; 10 QString Device;
@@ -15,3 +18,3 @@ typedef struct CableData {
15 18
16} CableData_t; 19};
17 20
diff --git a/noncore/settings/networksettings2/cable/cableedit.cpp b/noncore/settings/networksettings2/cable/cableedit.cpp
index 6e1a13b..4e57845 100644
--- a/noncore/settings/networksettings2/cable/cableedit.cpp
+++ b/noncore/settings/networksettings2/cable/cableedit.cpp
@@ -19,3 +19,3 @@ CableEdit::CableEdit( QWidget * Parent ) : CableGUI( Parent ) {
19 19
20void CableEdit::showData( CableData_t & D ) { 20void CableEdit::showData( CableData & D ) {
21 DeviceFile_LE->setText( D.Device ); 21 DeviceFile_LE->setText( D.Device );
@@ -42,3 +42,3 @@ QString CableEdit::acceptable( void ) {
42 42
43bool CableEdit::commit( CableData_t & D ) { 43bool CableEdit::commit( CableData & D ) {
44 bool SM = 0; 44 bool SM = 0;
diff --git a/noncore/settings/networksettings2/cable/cableedit.h b/noncore/settings/networksettings2/cable/cableedit.h
index ffacc61..ad1e832 100644
--- a/noncore/settings/networksettings2/cable/cableedit.h
+++ b/noncore/settings/networksettings2/cable/cableedit.h
@@ -9,4 +9,4 @@ public :
9 QString acceptable( void ); 9 QString acceptable( void );
10 bool commit( CableData_t & D ); 10 bool commit( CableData & D );
11 void showData( CableData_t & D ); 11 void showData( CableData & D );
12}; 12};
diff --git a/noncore/settings/networksettings2/cable/cablerun.cpp b/noncore/settings/networksettings2/cable/cablerun.cpp
index 85660f6..7a8deb9 100644
--- a/noncore/settings/networksettings2/cable/cablerun.cpp
+++ b/noncore/settings/networksettings2/cable/cablerun.cpp
@@ -4,3 +4,3 @@
4 4
5void CableRun::detectState( NodeCollection * NC ) { 5State_t CableRun::detectState( void ) {
6 6
@@ -9,18 +9,10 @@ void CableRun::detectState( NodeCollection * NC ) {
9 if( fd < 0 ) { 9 if( fd < 0 ) {
10 NC->setCurrentState( Unavailable ); 10 return Unavailable;
11 } 11 }
12 close( fd ); 12 close( fd );
13 NC->setCurrentState( Available ); 13 return Available;
14} 14}
15 15
16bool CableRun::setState( NodeCollection * NC, Action_t A, bool ) { 16QString CableRun::setMyState( NodeCollection *, Action_t , bool ) {
17 if( A == Activate ) { 17 return QString();
18 detectState(NC);
19 return (NC->currentState() == Available);
20 }
21 return 1;
22}
23
24bool CableRun::canSetState( State_t , Action_t ) {
25 return 1;
26} 18}
diff --git a/noncore/settings/networksettings2/cable/cablerun.h b/noncore/settings/networksettings2/cable/cablerun.h
index 20608f6..41aea01 100644
--- a/noncore/settings/networksettings2/cable/cablerun.h
+++ b/noncore/settings/networksettings2/cable/cablerun.h
@@ -1,5 +1,5 @@
1#include <asline.h> 1#include <netnode.h>
2#include "cabledata.h" 2#include "cabledata.h"
3 3
4class CableRun : public AsLine { 4class CableRun : public RuntimeInfo {
5 5
@@ -8,7 +8,7 @@ public :
8 CableRun( ANetNodeInstance * NNI, 8 CableRun( ANetNodeInstance * NNI,
9 CableData_t & D ) : AsLine( NNI ) 9 CableData & D ) : RuntimeInfo( NNI )
10 { Data = &D; } 10 { Data = &D; }
11 11
12 virtual AsLine * asLine( void ) 12 virtual RuntimeInfo * line( void )
13 { return (AsLine *)this; } 13 { return this; }
14 14
@@ -16,7 +16,7 @@ public :
16 16
17 State_t detectState( void );
18
17protected : 19protected :
18 20
19 void detectState( NodeCollection * NC ); 21 QString setMyState( NodeCollection * , Action_t, bool );
20 bool setState( NodeCollection * NC, Action_t A, bool Force );
21 bool canSetState( State_t Curr, Action_t A );
22 22
@@ -24,3 +24,3 @@ private :
24 24
25 CableData_t * Data; 25 CableData * Data;
26}; 26};
diff --git a/noncore/settings/networksettings2/cable/opie-networksettings2plugin-cable.control b/noncore/settings/networksettings2/cable/opie-networksettings2plugin-cable.control
index 79520e2..dd08279 100644
--- a/noncore/settings/networksettings2/cable/opie-networksettings2plugin-cable.control
+++ b/noncore/settings/networksettings2/cable/opie-networksettings2plugin-cable.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-bluetooth 1Package: opie-networksettings2plugin-cable
2Files: plugins/networksettings2/libcable.so* 2Files: plugins/networksettings2/libcable.so*
diff --git a/noncore/settings/networksettings2/config.in b/noncore/settings/networksettings2/config.in
index d0e5a32..d2b5f26 100644
--- a/noncore/settings/networksettings2/config.in
+++ b/noncore/settings/networksettings2/config.in
@@ -1,2 +1,4 @@
1 source noncore/settings/networksettings2/networksettings2/config.in 1 source noncore/settings/networksettings2/networksettings2/config.in
2 source noncore/settings/networksettings2/opietooth2/config.in
3 source noncore/settings/networksettings2/opietooth2_applet/config.in
2 4
@@ -5,3 +7,3 @@ config NS2
5 default "y" 7 default "y"
6 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE 8 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE && NS2OPIETOOTH
7 9
@@ -18 +20,2 @@ config NS2
18 source noncore/settings/networksettings2/modem/config.in 20 source noncore/settings/networksettings2/modem/config.in
21 source noncore/settings/networksettings2/gprs/config.in
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp
index 77826d1..3f8a53f 100644
--- a/noncore/settings/networksettings2/editconnection.cpp
+++ b/noncore/settings/networksettings2/editconnection.cpp
@@ -1 +1,2 @@
1#include <opie2/odebug.h>
1#include <qlistview.h> 2#include <qlistview.h>
@@ -33,2 +34,9 @@ public:
33 34
35 MyQCheckListItem( QListView *parent, const QString & S ) :
36 QCheckListItem( parent, S, QCheckListItem::Controller ) { }
37 MyQCheckListItem( QCheckListItem *parent, const QString & S ) :
38 QCheckListItem( parent, S, QCheckListItem::Controller ) { }
39 MyQCheckListItem( QListViewItem *parent, const QString & S ) :
40 QCheckListItem( parent, S, QCheckListItem::Controller ) { }
41
34 virtual void paintCell( QPainter *p, const QColorGroup &cg, 42 virtual void paintCell( QPainter *p, const QColorGroup &cg,
@@ -118,3 +126,10 @@ NodeCollection * EditConnection::getTmpCollection( void ) {
118 ANetNode * NN; 126 ANetNode * NN;
119 // start iter 127
128 // start iter (if there is a collection)
129 /*
130
131 a node collection is sorted from the toplevel
132 node to the deepest node
133
134 */
120 ANetNodeInstance * NNI = 135 ANetNodeInstance * NNI =
@@ -124,2 +139,4 @@ NodeCollection * EditConnection::getTmpCollection( void ) {
124 139
140 // the listview always starts with the toplevel
141 // hierarchy. This is always a controller item
125 while ( it ) { 142 while ( it ) {
@@ -127,4 +144,5 @@ NodeCollection * EditConnection::getTmpCollection( void ) {
127 if( NN == 0 ) { 144 if( NN == 0 ) {
128 // child is controller -> has sub radio 145 // this item is a controller ->
129 // check if one radio is selected 146 // has radio items as children ->
147 // find selected one
130 it = it->firstChild(); 148 it = it->firstChild();
@@ -133,21 +151,2 @@ NodeCollection * EditConnection::getTmpCollection( void ) {
133 // this radio is selected -> go deeper 151 // this radio is selected -> go deeper
134 if( SelectedNodes == 0 ||
135 NNI == 0 ||
136 it->text(0) != NNI->nodeClass()->name() ) {
137 // new item not in previous collection
138 ANetNodeInstance * NNI = (*Mapping)[it]->createInstance();
139 NNI->initialize();
140 // this node type not in collection
141 TmpCollection.append( NNI );
142 // master collection changed because new item in it
143 TmpCollection.setModified( 1 );
144 // no more valid items in old list
145 NNI = 0;
146 } else {
147 // already in list -> copy pointer
148 TmpCollection.append( NNI );
149 NNI = SelectedNodes->next();
150 }
151 it = it->firstChild();
152 // do not bother to check other items
153 break; 152 break;
@@ -156,6 +155,37 @@ NodeCollection * EditConnection::getTmpCollection( void ) {
156 } 155 }
156
157 if( ! it ) {
158 owarn << "Radio not selected" << oendl;
159 TmpIsValid = 0;
160 return 0;
161 }
162
163 // it now contains selected radio
164 NN = (*Mapping)[it];
165 }
166
167 // NN here contains the netnode of the
168 // current item -> this node needs to
169 // be stored in the collection
170 if( NNI == 0 ||
171 it->text(0) != NNI->nodeClass()->name() ) {
172 // new item not in previous collection
173 ANetNodeInstance * NNI = NN->createInstance();
174 NNI->initialize();
175 // this node type not in collection
176 TmpCollection.append( NNI );
177 // master collection changed because new item in it
178 TmpCollection.setModified( 1 );
179 // no more valid items in old list
180 NNI = 0;
157 } else { 181 } else {
158 // check children 182 // already in list -> copy pointer
159 it = it->firstChild(); 183 TmpCollection.append( NNI );
184 NNI = SelectedNodes->next();
160 } 185 }
186
187 // go deeper to next level
188 // this level is can be a new controller
189 // or an item
190 it = it->firstChild();
161 } 191 }
@@ -189,8 +219,7 @@ void EditConnection::setConnection( NodeCollection * NC ) {
189 while ( it ) { 219 while ( it ) {
190 // listitem corresponds to netnode
191 NN = (*Mapping)[it]; 220 NN = (*Mapping)[it];
192 if( NN == 0 ) { 221 if( NN == 0 ) {
193 // child is controller -> has sub radio 222 // this item is a controller ->
194 QString Ctr = it->text(0); 223 // has radio items as children ->
195 // check if one radio is selected 224 // find selected one
196 it = it->firstChild(); 225 it = it->firstChild();
@@ -211,2 +240,3 @@ void EditConnection::setConnection( NodeCollection * NC ) {
211 } 240 }
241
212 if( ! Found ) { 242 if( ! Found ) {
@@ -218,7 +248,27 @@ void EditConnection::setConnection( NodeCollection * NC ) {
218 tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). 248 tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ).
219 arg(Ctr) ); 249 arg(NNI->nodeClass()->name()) );
220 return; 250 return;
221 } 251 }
252
253 // it now contains selected radio
254 NN = (*Mapping)[it];
222 } else { 255 } else {
223 // automatic item -> check children 256 // automatic selection
257 if( NNI == 0 || it->text(0) != NNI->nodeClass()->name() ) {
258 // should exist and be the same
259 if( NNI ) {
260 QMessageBox::warning(
261 0,
262 tr( "Error presentig Connection" ),
263 tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ).
264 arg(NNI->nodeClass()->name()) );
265 } else {
266 QMessageBox::warning(
267 0,
268 tr( "Error presentig Connection" ),
269 tr( "<p>Missing connection\"<i>%1</i>\"</p>" ).
270 arg(it->text(0)) );
271 }
272 return;
273 }
224 it = it->firstChild(); 274 it = it->firstChild();
@@ -271,3 +321,3 @@ void EditConnection::buildFullTree( void ) {
271 321
272 // find all Nodes that care toplevel nodes -> ie provide 322 // find all Nodes that are toplevel nodes -> ie provide
273 // TCP/IP Connection 323 // TCP/IP Connection
@@ -286,3 +336,5 @@ void EditConnection::buildFullTree( void ) {
286 QCheckListItem::RadioButton ); 336 QCheckListItem::RadioButton );
287 it->setPixmap( 0, NSResources->getPixmap( "Devices/commprofile" ) ); 337 it->setPixmap( 0,
338 NSResources->getPixmap( NN->pixmapName() )
339 );
288 // remember that this node maps to this listitem 340 // remember that this node maps to this listitem
@@ -301,3 +353,3 @@ void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) {
301 it, 353 it,
302 NSResources->netNode2Name(NNL[0]->provides()), 354 NSResources->netNode2Name(NN->needs()[0]),
303 QCheckListItem::Controller ); 355 QCheckListItem::Controller );
@@ -389,6 +441,7 @@ void EditConnection::SLOT_SelectNode( QListViewItem * it ) {
389 // intermediate node 441 // intermediate node
390 NN = (*Mapping)[ it->firstChild() ]; 442 NN = (*Mapping)[ it->parent() ];
391 if( NN ) { 443 if( NN ) {
392 // figure out type of this node -> produce mesage 444 // figure out type of this node -> produce mesage
393 Description_LBL->setText( NSResources->netNode2Description(NN->provides()) ); 445 Description_LBL->setText( NSResources->netNode2Description(
446 NN->needs()[0]) );
394 } else { 447 } else {
@@ -541,37 +594,38 @@ void EditConnection::enablePath( QListViewItem * it, bool pha ) {
541bool EditConnection::haveCompleteConfig( QListViewItem * it ) { 594bool EditConnection::haveCompleteConfig( QListViewItem * it ) {
542 if( it == 0 || ((QCheckListItem *)it)->isOn() ) { 595
543 // check children 596 // check if all below this level is selected
544 it = (it) ? it->firstChild() : Nodes_LV->firstChild() ; 597 it = ( it ) ?it : Nodes_LV->firstChild();
545 while ( it ) { 598 ANetNode *NN;
546 if( ((QCheckListItem *)it)->type() == 599 bool Found;
547 QCheckListItem::Controller ) { 600
548 // child is controller -> has sub radio 601 while ( it ) {
549 // check if one radio is selected 602 NN = (*Mapping)[it];
550 it = it->firstChild(); 603 if( NN == 0 ) {
551 while( it ) { 604 // this item is a controller ->
552 if( ((QCheckListItem *)it)->isOn() ) { 605 // has radio items as children ->
553 // this radio is selected -> go deeper 606 // find selected one
554 it = it->firstChild(); 607 it = it->firstChild();
555 if( ! it ) { 608 Found = 0;
556 // was deepest level 609 while( it ) {
557 return 1; 610 if( ((QCheckListItem *)it)->isOn() ) {
558 } 611 Found = 1;
559 // do not bother to check other items 612 // go deeper
560 break; 613 it = it->firstChild();
561 } 614 break;
562 it = it->nextSibling();
563 }
564 if( ! it ) {
565 // no radio selected
566 return 0;
567 } 615 }
568 } else { 616 it = it->nextSibling();
569 // check children
570 it = it->firstChild();
571 } 617 }
618
619 if( ! Found ) {
620 return 0; // no not complete -> a radio should have been chkd
621 }
622
623 // it now contains selected radio
624 NN = (*Mapping)[it];
625 } else {
626 // automatic selection
627 it = it->firstChild();
572 } 628 }
573 // deepest level -> all is still OK 629 }
574 return 1; 630 return 1;
575 } // was not ON
576 return 0;
577} 631}
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp
index 9483e22..485cad3 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.cpp
+++ b/noncore/settings/networksettings2/irda/irda_NN.cpp
@@ -7,2 +7,7 @@ static const char * IRDANeeds[] =
7 7
8static const char * IRDAProvides[] =
9 { "line",
10 0
11 };
12
8/** 13/**
@@ -34,4 +39,4 @@ const char ** IRDANetNode::needs( void ) {
34 39
35const char * IRDANetNode::provides( void ) { 40const char ** IRDANetNode::provides( void ) {
36 return "line"; 41 return IRDAProvides;
37} 42}
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h
index 900bbc6..9e5c5e6 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.h
+++ b/noncore/settings/networksettings2/irda/irda_NN.h
@@ -22,3 +22,3 @@ public:
22 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
23 virtual const char * provides( void ); 23 virtual const char ** provides( void );
24 24
diff --git a/noncore/settings/networksettings2/irda/irdadata.h b/noncore/settings/networksettings2/irda/irdadata.h
index c3c683e..568f796 100644
--- a/noncore/settings/networksettings2/irda/irdadata.h
+++ b/noncore/settings/networksettings2/irda/irdadata.h
@@ -5,3 +5,4 @@
5 5
6typedef struct IRDAData { 6class IRDAData {
7public :
7 QString Device; 8 QString Device;
@@ -15,3 +16,3 @@ typedef struct IRDAData {
15 16
16} IRDAData_t; 17} ;
17 18
diff --git a/noncore/settings/networksettings2/irda/irdarun.h b/noncore/settings/networksettings2/irda/irdarun.h
index 4258aff..d3b714b 100644
--- a/noncore/settings/networksettings2/irda/irdarun.h
+++ b/noncore/settings/networksettings2/irda/irdarun.h
@@ -1,5 +1,5 @@
1#include <asline.h> 1#include <netnode.h>
2#include "irdadata.h" 2#include "irdadata.h"
3 3
4class IRDARun : public AsLine { 4class IRDARun : public RuntimeInfo {
5 5
@@ -8,7 +8,7 @@ public :
8 IRDARun( ANetNodeInstance * NNI, 8 IRDARun( ANetNodeInstance * NNI,
9 IRDAData & Data ) : AsLine( NNI ) 9 IRDAData & Data ) : RuntimeInfo( NNI )
10 { } 10 { }
11 11
12 virtual AsLine * asLine( void ) 12 virtual RuntimeInfo * line( void )
13 { return (AsLine *)this; } 13 { return this; }
14 14
@@ -17,12 +17,9 @@ public :
17 17
18protected : 18 State_t detectState( void )
19 19 { return Unknown; }
20 void detectState( NodeCollection * )
21 { }
22 20
23 bool setState( NodeCollection * , Action_t, bool ) 21protected :
24 { return 0; }
25 22
26 bool canSetState( State_t , Action_t ) 23 QString setMyState( NodeCollection * , Action_t, bool )
27 { return 0; } 24 { return QString(); }
28}; 25};
diff --git a/noncore/settings/networksettings2/irda/opie-networksettings2plugin-irda.control b/noncore/settings/networksettings2/irda/opie-networksettings2plugin-irda.control
index 938bee5..4afbbcf 100644
--- a/noncore/settings/networksettings2/irda/opie-networksettings2plugin-irda.control
+++ b/noncore/settings/networksettings2/irda/opie-networksettings2plugin-irda.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-irda 1Package: opie-networksettings2plugin-irda
2Files: plugins/networksettings2/libirda.so* 2Files: plugins/networksettings2/libirda.so*
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
index 20ae7f6..e36f757 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
@@ -4,3 +4,9 @@
4static const char * LanCardNeeds[] = 4static const char * LanCardNeeds[] =
5 { 0 }; 5 { 0
6 };
7
8static const char * LanCardProvides[] =
9 { "device",
10 0
11 };
6 12
@@ -36,4 +42,4 @@ const char ** LanCardNetNode::needs( void ) {
36 42
37const char * LanCardNetNode::provides( void ) { 43const char ** LanCardNetNode::provides( void ) {
38 return "device"; 44 return LanCardProvides;
39} 45}
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h
index 6882af7..dc7566a 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.h
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.h
@@ -27,3 +27,3 @@ public:
27 virtual const char ** needs( void ); 27 virtual const char ** needs( void );
28 virtual const char * provides( void ); 28 virtual const char ** provides( void );
29 29
diff --git a/noncore/settings/networksettings2/lancard/lancarddata.h b/noncore/settings/networksettings2/lancard/lancarddata.h
index c76767f..8f5e2b5 100644
--- a/noncore/settings/networksettings2/lancard/lancarddata.h
+++ b/noncore/settings/networksettings2/lancard/lancarddata.h
@@ -6,3 +6,4 @@
6 6
7typedef struct LanCardData { 7class LanCardData {
8public :
8 bool AnyLanCard; 9 bool AnyLanCard;
@@ -10,3 +11,3 @@ typedef struct LanCardData {
10 11
11} LanCardData_t; 12} ;
12 13
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp
index 1544ddc..470b797 100644
--- a/noncore/settings/networksettings2/lancard/lancardrun.cpp
+++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp
@@ -6,3 +6,3 @@
6 6
7void LanCardRun::detectState( NodeCollection * NC ) { 7State_t LanCardRun::detectState( void ) {
8 8
@@ -12,3 +12,5 @@ void LanCardRun::detectState( NodeCollection * NC ) {
12 12
13 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); 13 NodeCollection * NC = nodeCollection();
14 QString S = QString( "/tmp/profile-%1.up" ).
15 arg( NC->number());
14 System & Sys = NSResources->system(); 16 System & Sys = NSResources->system();
@@ -30,6 +32,4 @@ void LanCardRun::detectState( NodeCollection * NC ) {
30 if( X == Run->Name ) { 32 if( X == Run->Name ) {
31 Run->assignNode( netNode() ); 33 NC->assignInterface( Run );
32 assignInterface( Run ); 34 return IsUp;
33 NC->setCurrentState( IsUp );
34 return;
35 } 35 }
@@ -39,3 +39,3 @@ void LanCardRun::detectState( NodeCollection * NC ) {
39 39
40 if( ( Run = assignedInterface() ) ) { 40 if( ( Run = NC->assignedInterface() ) ) {
41 // we already have an interface assigned -> still present ? 41 // we already have an interface assigned -> still present ?
@@ -43,4 +43,3 @@ void LanCardRun::detectState( NodeCollection * NC ) {
43 // usb is still free -> keep assignment 43 // usb is still free -> keep assignment
44 NC->setCurrentState( Available ); 44 return Available;
45 return;
46 } // else interface is up but NOT us -> some other profile 45 } // else interface is up but NOT us -> some other profile
@@ -49,3 +48,3 @@ void LanCardRun::detectState( NodeCollection * NC ) {
49 // nothing (valid) assigned to us 48 // nothing (valid) assigned to us
50 assignInterface( 0 ); 49 NC->assignInterface( 0 );
51 50
@@ -65,4 +64,3 @@ void LanCardRun::detectState( NodeCollection * NC ) {
65 // proper type, and Not UP -> free 64 // proper type, and Not UP -> free
66 NC->setCurrentState( Off ); 65 return Off;
67 return;
68 } 66 }
@@ -71,71 +69,29 @@ void LanCardRun::detectState( NodeCollection * NC ) {
71 69
72 NC->setCurrentState( Unavailable ); 70 return Unavailable;
73
74} 71}
75 72
76bool LanCardRun::setState( NodeCollection * NC, Action_t A, bool ) { 73QString LanCardRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
77 74
78 // we only handle activate and deactivate 75 if( A == Activate ) {
79 switch( A ) { 76 InterfaceInfo * N = getInterface();
80 case Activate : 77
81 { 78 if( ! N ) {
82 if( NC->currentState() != Off ) { 79 // no interface available
83 return 0; 80 NC->setCurrentState( Unavailable );
84 } 81 return tr("No interface found");
85 InterfaceInfo * N = getInterface(); 82 }
86 if( ! N ) { 83
87 // no interface available 84 // because we were OFF the interface
88 NC->setCurrentState( Unavailable ); 85 // we get back is NOT assigned
89 return 0; 86 NC->assignInterface( N );
90 } 87 NC->setCurrentState( Available );
91 // because we were OFF the interface 88 return QString();
92 // we get back is NOT assigned
93 N->assignNode( netNode() );
94 assignInterface( N );
95 NC->setCurrentState( Available );
96 return 1;
97 }
98 case Deactivate :
99 if( NC->currentState() == IsUp ) {
100 // bring down first
101 if( ! connection()->setState( Down ) )
102 // could not ...
103 return 0;
104 } else if( NC->currentState() != Available ) {
105 return 1;
106 }
107 assignedInterface()->assignNode( 0 ); // release
108 assignInterface( 0 );
109 NC->setCurrentState( Off );
110 return 1;
111 default :
112 // FT
113 break;
114 } 89 }
115 return 0;
116}
117 90
118bool LanCardRun::canSetState( State_t Curr, Action_t A ) { 91 if( A == Deactivate ) {
119 // we only handle up down activate and deactivate 92 NC->assignInterface( 0 );
120 switch( A ) { 93 NC->setCurrentState( Off );
121 case Activate :
122 { // at least available
123 if( Curr == Available ) {
124 return 1;
125 }
126 // or we can make one available
127 InterfaceInfo * N = getInterface();
128 if( ! N || N->assignedNode() != 0 ) {
129 // non available or assigned
130 return 0;
131 }
132 return 1;
133 }
134 case Deactivate :
135 return ( Curr >= Available );
136 default :
137 // FT
138 break;
139 } 94 }
140 return 0; 95
96 return QString();
141} 97}
@@ -160,6 +116,6 @@ InterfaceInfo * LanCardRun::getInterface( void ) {
160 // this is a LAN card 116 // this is a LAN card
161 if( Run->assignedNode() == netNode() ) { 117 if( Run->assignedConnection() == netNode()->connection() ) {
162 // assigned to us 118 // assigned to us
163 return Run; 119 return Run;
164 } else if( Run->assignedNode() == 0 ) { 120 } else if( Run->assignedConnection() == 0 ) {
165 // free 121 // free
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.h b/noncore/settings/networksettings2/lancard/lancardrun.h
index b28dda7..57ef3fb 100644
--- a/noncore/settings/networksettings2/lancard/lancardrun.h
+++ b/noncore/settings/networksettings2/lancard/lancardrun.h
@@ -3,3 +3,3 @@
3 3
4#include <asdevice.h> 4#include <netnode.h>
5#include <qregexp.h> 5#include <qregexp.h>
@@ -7,3 +7,3 @@
7 7
8class LanCardRun : public AsDevice { 8class LanCardRun : public RuntimeInfo {
9 9
@@ -12,20 +12,18 @@ public :
12 LanCardRun( ANetNodeInstance * NNI, 12 LanCardRun( ANetNodeInstance * NNI,
13 LanCardData & D ) : AsDevice( NNI ), 13 LanCardData & D ) : RuntimeInfo( NNI ),
14 Pat( "eth[0-9]" ) 14 Pat( "eth[0-9]" ) {
15 { Data = &D; } 15 Data = &D;
16 }
16 17
17 virtual AsDevice * device( void ) 18 virtual RuntimeInfo * device( void )
18 { return (AsDevice *)this; } 19 { return this; }
19 20
20 virtual AsDevice * asDevice( void ) 21 bool handlesInterface( const QString & I );
21 { return (AsDevice *)this; } 22 bool handlesInterface( const InterfaceInfo & II );
22 23
23protected : 24 State_t detectState( void );
24 25
25 void detectState( NodeCollection * NC ); 26protected :
26 bool setState( NodeCollection * NC, Action_t A, bool Force );
27 bool canSetState( State_t Curr, Action_t A );
28 27
29 bool handlesInterface( const QString & I ); 28 QString setMyState( NodeCollection * , Action_t, bool );
30 bool handlesInterface( const InterfaceInfo & II );
31 29
diff --git a/noncore/settings/networksettings2/lancard/opie-networksettings2plugin-lancard.control b/noncore/settings/networksettings2/lancard/opie-networksettings2plugin-lancard.control
index d5aca66..4f87d04 100644
--- a/noncore/settings/networksettings2/lancard/opie-networksettings2plugin-lancard.control
+++ b/noncore/settings/networksettings2/lancard/opie-networksettings2plugin-lancard.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-lancard 1Package: opie-networksettings2plugin-lancard
2Files: plugins/networksettings2/liblancard.so* 2Files: plugins/networksettings2/liblancard.so*
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp
index 18bf652..8487e3e 100644
--- a/noncore/settings/networksettings2/main.cpp
+++ b/noncore/settings/networksettings2/main.cpp
@@ -5,2 +5,3 @@
5 5
6#include <opie2/odebug.h>
6#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
@@ -26,2 +27,13 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
26#define ACT_VPN 4 27#define ACT_VPN 4
28// activate opietooth
29#define ACT_OT 5
30
31// include Opietooth GUI
32#include <opietooth2/Opietooth.h>
33using namespace Opietooth2;
34
35#include <qpushbutton.h>
36#include <qlayout.h>
37#include <qframe.h>
38#include <qlabel.h>
27 39
@@ -52,2 +64,5 @@ int main( int argc, char * argv[] ) {
52 rmv = 1; 64 rmv = 1;
65 } else if( strcmp( argv[i], "--opietooth" ) == 0 ) {
66 Action = ACT_OT;
67 rmv = 1;
53 } 68 }
@@ -66,2 +81,4 @@ int main( int argc, char * argv[] ) {
66 Log(("Request : %s\n", argv[1] )); 81 Log(("Request : %s\n", argv[1] ));
82 } else if( strstr( argv[0], "-opietooth" ) ) {
83 Action = ACT_OT;
67 } 84 }
@@ -88,11 +105,8 @@ int main( int argc, char * argv[] ) {
88 if( NS.canStart( argv[1] ) ) { 105 if( NS.canStart( argv[1] ) ) {
89 QString S; 106 QStringList S;
90 S.sprintf( QPEApplication::qpeDir()+ 107 S << QPEApplication::qpeDir() + "/bin/networksettings2";
91 "bin/networksettings2" ); 108 S << "networksettings2";
92 char * MyArgv[4]; 109 S << "--prompt";
93 MyArgv[0] = "networksettings2"; 110 S << argv[1];
94 MyArgv[1] = "--prompt"; 111 NSResources->system().execAsUser( S );
95 MyArgv[2] = argv[1];
96 MyArgv[3] = NULL;
97 NSResources->system().execAsUser( S, MyArgv );
98 Log(("FAILED %s-cNN-allowed\n", argv[1] )); 112 Log(("FAILED %s-cNN-allowed\n", argv[1] ));
@@ -105,4 +119,5 @@ int main( int argc, char * argv[] ) {
105 { NetworkSettingsData NS; 119 { NetworkSettingsData NS;
120 QString S= NS.generateSettings();
106 // regen returns 0 if OK 121 // regen returns 0 if OK
107 rv = (NS.regenerate()) ? 1 : 0; 122 rv = ( S.isEmpty() ) ? 0 : 1;
108 } 123 }
@@ -127,4 +142,12 @@ int main( int argc, char * argv[] ) {
127 case ACT_GUI : 142 case ACT_GUI :
128 { QWidget * W = new NetworkSettings(0); 143 case ACT_OT :
144 { QWidget * W;
145
146 if( Action == ACT_OT ) {
147 W = new OTMain( 0 );
148 } else {
149 W = new NetworkSettings(0);
150 }
129 TheApp->setMainWidget( W ); 151 TheApp->setMainWidget( W );
152
130 W->show(); 153 W->show();
@@ -136,2 +159,3 @@ int main( int argc, char * argv[] ) {
136 rv = TheApp->exec(); 159 rv = TheApp->exec();
160
137 delete W; 161 delete W;
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp
index ee61b10..06f417c 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.cpp
+++ b/noncore/settings/networksettings2/modem/modem_NN.cpp
@@ -4,3 +4,8 @@
4static const char * ModemNeeds[] = 4static const char * ModemNeeds[] =
5 { "line" 5 { "line",
6 0
7 };
8static const char * ModemProvides[] =
9 { "modem",
10 0
6 }; 11 };
@@ -35,4 +40,4 @@ const char ** ModemNetNode::needs( void ) {
35 40
36const char * ModemNetNode::provides( void ) { 41const char ** ModemNetNode::provides( void ) {
37 return "line"; 42 return ModemProvides;
38} 43}
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h
index a76525f..5b3b573 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.h
+++ b/noncore/settings/networksettings2/modem/modem_NN.h
@@ -22,3 +22,3 @@ public:
22 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
23 virtual const char * provides( void ); 23 virtual const char ** provides( void );
24 24
diff --git a/noncore/settings/networksettings2/modem/modemdata.h b/noncore/settings/networksettings2/modem/modemdata.h
index 773cb77..89656ed 100644
--- a/noncore/settings/networksettings2/modem/modemdata.h
+++ b/noncore/settings/networksettings2/modem/modemdata.h
@@ -4,3 +4,4 @@
4#include <qstring.h> 4#include <qstring.h>
5typedef struct ModemData { 5class ModemData {
6public :
6 QString Device; 7 QString Device;
@@ -14,3 +15,3 @@ typedef struct ModemData {
14 15
15} ModemData_t; 16} ;
16 17
diff --git a/noncore/settings/networksettings2/modem/modemedit.cpp b/noncore/settings/networksettings2/modem/modemedit.cpp
index fd3d694..d97d895 100644
--- a/noncore/settings/networksettings2/modem/modemedit.cpp
+++ b/noncore/settings/networksettings2/modem/modemedit.cpp
@@ -11,3 +11,3 @@ QString ModemEdit::acceptable( void ) {
11 11
12bool ModemEdit::commit( ModemData_t & Data ) { 12bool ModemEdit::commit( ModemData & Data ) {
13 return 0; 13 return 0;
@@ -15,3 +15,3 @@ bool ModemEdit::commit( ModemData_t & Data ) {
15 15
16void ModemEdit::showData( ModemData_t & Data ) { 16void ModemEdit::showData( ModemData & Data ) {
17} 17}
diff --git a/noncore/settings/networksettings2/modem/modemedit.h b/noncore/settings/networksettings2/modem/modemedit.h
index 56e2a82..ed9cfc0 100644
--- a/noncore/settings/networksettings2/modem/modemedit.h
+++ b/noncore/settings/networksettings2/modem/modemedit.h
@@ -9,4 +9,4 @@ public :
9 QString acceptable( void ); 9 QString acceptable( void );
10 bool commit( ModemData_t & Data ); 10 bool commit( ModemData & Data );
11 void showData( ModemData_t & Data ); 11 void showData( ModemData & Data );
12}; 12};
diff --git a/noncore/settings/networksettings2/modem/modemrun.h b/noncore/settings/networksettings2/modem/modemrun.h
index 491a677..eb3a193 100644
--- a/noncore/settings/networksettings2/modem/modemrun.h
+++ b/noncore/settings/networksettings2/modem/modemrun.h
@@ -1,5 +1,5 @@
1#include <asline.h> 1#include <netnode.h>
2#include "modemdata.h" 2#include "modemdata.h"
3 3
4class ModemRun : public AsLine { 4class ModemRun : public RuntimeInfo {
5 5
@@ -8,7 +8,7 @@ public :
8 ModemRun( ANetNodeInstance * NNI, 8 ModemRun( ANetNodeInstance * NNI,
9 ModemData & Data ) : AsLine ( NNI ) 9 ModemData & Data ) : RuntimeInfo ( NNI )
10 { } 10 { }
11 11
12 virtual AsLine * asLine( void ) 12 virtual RuntimeInfo * line( void )
13 { return (AsLine *)this; } 13 { return this; }
14 14
@@ -17,12 +17,9 @@ public :
17 17
18protected : 18 State_t detectState( void )
19 19 { return Unknown;}
20 void detectState( NodeCollection * )
21 { }
22 20
23 bool setState( NodeCollection *, Action_t, bool ) 21protected :
24 { return 0; }
25 22
26 bool canSetState( State_t, Action_t ) 23 QString setMyState( NodeCollection * , Action_t, bool )
27 { return 0; } 24 { return QString(); }
28}; 25};
diff --git a/noncore/settings/networksettings2/modem/opie-networksettings2plugin-modem.control b/noncore/settings/networksettings2/modem/opie-networksettings2plugin-modem.control
index eaa6ab0..a73249a 100644
--- a/noncore/settings/networksettings2/modem/opie-networksettings2plugin-modem.control
+++ b/noncore/settings/networksettings2/modem/opie-networksettings2plugin-modem.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-modem 1Package: opie-networksettings2plugin-modem
2Files: plugins/networksettings2/libmodem.so* 2Files: plugins/networksettings2/libmodem.so*
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp
index b5c41bf..23b3d44 100644
--- a/noncore/settings/networksettings2/network/network_NN.cpp
+++ b/noncore/settings/networksettings2/network/network_NN.cpp
@@ -1,3 +1,4 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <asdevice.h> 2#include <resources.h>
3#include <netnode.h>
3#include "network_NN.h" 4#include "network_NN.h"
@@ -10,2 +11,7 @@ static const char * NetworkNeeds[] =
10 11
12static const char * NetworkProvides[] =
13 { "connection",
14 0
15 };
16
11/** 17/**
@@ -14,2 +20,5 @@ static const char * NetworkNeeds[] =
14NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { 20NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) {
21
22 NSResources->addSystemFile(
23 "interfaces", "/etc/network/interfaces", 1 );
15} 24}
@@ -34,9 +43,7 @@ ANetNodeInstance * NetworkNetNode::createInstance( void ) {
34 43
35bool NetworkNetNode::hasDataForFile( const QString & S ) { 44bool NetworkNetNode::hasDataForFile( SystemFile & S ) {
36 return S == "interfaces"; 45 return S.name() == "interfaces";
37} 46}
38 47
39short NetworkNetNode::generateFile( const QString & ID, 48short NetworkNetNode::generateFile( SystemFile & SF,
40 const QString & ,
41 QTextStream & TS,
42 ANetNodeInstance * NNI, 49 ANetNodeInstance * NNI,
@@ -44,8 +51,13 @@ short NetworkNetNode::generateFile( const QString & ID,
44 51
52 if( DevNr < 0 ) {
53 // generate device specific but common part
54 return 1;
55 }
56
45 QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); 57 QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
46 58
47 if( ID == "interfaces" ) { 59 if( SF.name() == "interfaces" ) {
48 Log(("Generate entry for %s in %s\n", NIC.latin1(), ID.latin1() )); 60 Log(("Generate entry for %s in %s\n", NIC.latin1(), SF.name().latin1() ));
49 // generate mapping stanza for this interface 61 // generate mapping stanza for this interface
50 TS << "# check if " 62 SF << "# check if "
51 << NIC 63 << NIC
@@ -53,8 +65,8 @@ short NetworkNetNode::generateFile( const QString & ID,
53 << endl; 65 << endl;
54 TS << "mapping " 66 SF << "mapping "
55 << NIC 67 << NIC
56 << endl; 68 << endl;
57 TS << " script " 69 SF << " script "
58 << QPEApplication::qpeDir() 70 << QPEApplication::qpeDir()
59 << "/bin/networksettings2-request" 71 << "bin/networksettings2-request"
60 << endl 72 << endl
@@ -70,4 +82,4 @@ const char ** NetworkNetNode::needs( void ) {
70 82
71const char * NetworkNetNode::provides( void ) { 83const char ** NetworkNetNode::provides( void ) {
72 return "connection"; 84 return NetworkProvides;
73} 85}
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h
index 745d1a7..b063d4c 100644
--- a/noncore/settings/networksettings2/network/network_NN.h
+++ b/noncore/settings/networksettings2/network/network_NN.h
@@ -16,7 +16,5 @@ public:
16 16
17 virtual bool hasDataForFile( const QString & S ); 17 virtual bool hasDataForFile( SystemFile & S );
18 18
19 virtual short generateFile( const QString & ID, 19 virtual short generateFile( SystemFile & TS,
20 const QString & Path,
21 QTextStream & TS,
22 ANetNodeInstance * NNI, 20 ANetNodeInstance * NNI,
@@ -29,3 +27,3 @@ public:
29 virtual const char ** needs( void ); 27 virtual const char ** needs( void );
30 virtual const char * provides( void ); 28 virtual const char ** provides( void );
31 29
diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp
index 324c6e2..78e6545 100644
--- a/noncore/settings/networksettings2/network/network_NNI.cpp
+++ b/noncore/settings/networksettings2/network/network_NNI.cpp
@@ -1,3 +1,3 @@
1#include <system.h> 1#include <system.h>
2#include <asdevice.h> 2#include <netnode.h>
3#include "networkedit.h" 3#include "networkedit.h"
@@ -101,11 +101,9 @@ void ANetwork::commit( void ) {
101 101
102bool ANetwork::hasDataForFile( const QString & S ) { 102bool ANetwork::hasDataForFile( SystemFile & S ) {
103 return S == "interfaces"; 103 return S.name() == "interfaces";
104} 104}
105 105
106short ANetwork::generateFile( const QString & ID, 106short ANetwork::generateFile( SystemFile &SF,
107 const QString & Path, 107 long DevNr
108 QTextStream &TS, 108 ) {
109 long DevNr
110 ) {
111 109
@@ -115,7 +113,7 @@ short ANetwork::generateFile( const QString & ID,
115 rvl = 1; 113 rvl = 1;
116 if( ID == "interfaces" ) { 114 if( SF.name() == "interfaces" ) {
117 Log(("Generate Network for %s\n", ID.latin1() )); 115 Log(("Generate Network for %s\n", SF.name().latin1() ));
118 // we can safely call from here since device item is deeper 116 // we can safely call from here since device item is deeper
119 if( Data.UseDHCP ) { 117 if( Data.UseDHCP ) {
120 TS << "iface " 118 SF << "iface "
121 << NIC 119 << NIC
@@ -125,3 +123,3 @@ short ANetwork::generateFile( const QString & ID,
125 << endl; 123 << endl;
126 TS << " up echo \"" 124 SF << " up echo \""
127 << NIC 125 << NIC
@@ -132,3 +130,3 @@ short ANetwork::generateFile( const QString & ID,
132 if( Data.SendHostname ) { 130 if( Data.SendHostname ) {
133 TS << " hostname " 131 SF << " hostname "
134 << Data.Hostname 132 << Data.Hostname
@@ -137,3 +135,3 @@ short ANetwork::generateFile( const QString & ID,
137 135
138 TS << " down rm -f /tmp/profile-" 136 SF << " down rm -f /tmp/profile-"
139 << connection()->number() 137 << connection()->number()
@@ -142,3 +140,3 @@ short ANetwork::generateFile( const QString & ID,
142 } else { 140 } else {
143 TS << "iface " 141 SF << "iface "
144 << NIC << "-c" 142 << NIC << "-c"
@@ -147,3 +145,3 @@ short ANetwork::generateFile( const QString & ID,
147 << endl; 145 << endl;
148 TS << " up echo \"" 146 SF << " up echo \""
149 << NIC 147 << NIC
@@ -153,3 +151,3 @@ short ANetwork::generateFile( const QString & ID,
153 << endl; 151 << endl;
154 TS << " down rm -f /tmp/profile-" 152 SF << " down rm -f /tmp/profile-"
155 << connection()->number() 153 << connection()->number()
@@ -157,9 +155,9 @@ short ANetwork::generateFile( const QString & ID,
157 << endl; 155 << endl;
158 TS << " address " 156 SF << " address "
159 << Data.IPAddress 157 << Data.IPAddress
160 << endl; 158 << endl;
161 TS << " broadcast " 159 SF << " broadcast "
162 << Data.Broadcast 160 << Data.Broadcast
163 << endl; 161 << endl;
164 TS << " netmask " 162 SF << " netmask "
165 << Data.NetMask 163 << Data.NetMask
@@ -177,3 +175,3 @@ short ANetwork::generateFile( const QString & ID,
177 arg( ipal[3].toShort() & nmal[3].toShort() ); 175 arg( ipal[3].toShort() & nmal[3].toShort() );
178 TS << " network " 176 SF << " network "
179 << NW 177 << NW
@@ -185,3 +183,3 @@ short ANetwork::generateFile( const QString & ID,
185 ++it ) { 183 ++it ) {
186 TS << " pre-up " 184 SF << " pre-up "
187 << (*it) 185 << (*it)
@@ -192,3 +190,3 @@ short ANetwork::generateFile( const QString & ID,
192 ++it ) { 190 ++it ) {
193 TS << " up " 191 SF << " up "
194 << (*it) 192 << (*it)
@@ -199,3 +197,3 @@ short ANetwork::generateFile( const QString & ID,
199 ++it ) { 197 ++it ) {
200 TS << " down " 198 SF << " down "
201 << (*it) 199 << (*it)
@@ -206,3 +204,3 @@ short ANetwork::generateFile( const QString & ID,
206 ++it ) { 204 ++it ) {
207 TS << " post-down " 205 SF << " post-down "
208 << (*it) 206 << (*it)
@@ -214,3 +212,3 @@ short ANetwork::generateFile( const QString & ID,
214 // embed other info in it 212 // embed other info in it
215 rvd = connection()->getToplevel()->generateFileEmbedded( ID, Path, TS, DevNr ); 213 rvd = connection()->getToplevel()->generateFileEmbedded( SF, DevNr );
216 214
diff --git a/noncore/settings/networksettings2/network/network_NNI.h b/noncore/settings/networksettings2/network/network_NNI.h
index 5e42503..71c276a 100644
--- a/noncore/settings/networksettings2/network/network_NNI.h
+++ b/noncore/settings/networksettings2/network/network_NNI.h
@@ -29,7 +29,5 @@ public :
29 29
30 virtual bool hasDataForFile( const QString & S ); 30 virtual bool hasDataForFile( SystemFile & SF );
31 virtual short generateFile( const QString & ID, 31 virtual short generateFile( SystemFile &TS,
32 const QString & Path, 32 long DevNr );
33 QTextStream &TS,
34 long DevNr );
35 33
@@ -43,3 +41,3 @@ private :
43 NetworkEdit * GUI; 41 NetworkEdit * GUI;
44 NetworkData_t Data; 42 NetworkData Data;
45 NetworkRun * RT; 43 NetworkRun * RT;
diff --git a/noncore/settings/networksettings2/network/networkdata.h b/noncore/settings/networksettings2/network/networkdata.h
index 2c5da37..1df9dc4 100644
--- a/noncore/settings/networksettings2/network/networkdata.h
+++ b/noncore/settings/networksettings2/network/networkdata.h
@@ -5,3 +5,4 @@
5#include <qstringlist.h> 5#include <qstringlist.h>
6typedef struct NetworkData { 6class NetworkData {
7public :
7 bool UseDHCP; 8 bool UseDHCP;
@@ -19,3 +20,3 @@ typedef struct NetworkData {
19 QStringList PostDown_SL; 20 QStringList PostDown_SL;
20} NetworkData_t; 21} ;
21 22
diff --git a/noncore/settings/networksettings2/network/networkedit.cpp b/noncore/settings/networksettings2/network/networkedit.cpp
index 05110d9..d13cb66 100644
--- a/noncore/settings/networksettings2/network/networkedit.cpp
+++ b/noncore/settings/networksettings2/network/networkedit.cpp
@@ -67,3 +67,3 @@ QString NetworkEdit::acceptable( void ) {
67 67
68bool NetworkEdit::commit( NetworkData_t & Data ) { 68bool NetworkEdit::commit( NetworkData & Data ) {
69 bool SM = 0; 69 bool SM = 0;
@@ -87,3 +87,3 @@ bool NetworkEdit::commit( NetworkData_t & Data ) {
87 87
88void NetworkEdit::showData( NetworkData_t & Data ) { 88void NetworkEdit::showData( NetworkData & Data ) {
89 DHCP_CB->setChecked( Data.UseDHCP ); 89 DHCP_CB->setChecked( Data.UseDHCP );
diff --git a/noncore/settings/networksettings2/network/networkedit.h b/noncore/settings/networksettings2/network/networkedit.h
index adc20e0..45635c8 100644
--- a/noncore/settings/networksettings2/network/networkedit.h
+++ b/noncore/settings/networksettings2/network/networkedit.h
@@ -11,4 +11,4 @@ public :
11 QString acceptable( void ); 11 QString acceptable( void );
12 bool commit( NetworkData_t & Data ); 12 bool commit( NetworkData & Data );
13 void showData( NetworkData_t & Data ); 13 void showData( NetworkData & Data );
14 14
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp
index 3e24c5f..c17aa7f 100644
--- a/noncore/settings/networksettings2/network/networkrun.cpp
+++ b/noncore/settings/networksettings2/network/networkrun.cpp
@@ -1,26 +1,24 @@
1#include <system.h> 1#include <system.h>
2#include <asdevice.h> 2#include <netnode.h>
3#include <resources.h>
3#include "networkrun.h" 4#include "networkrun.h"
4 5
5void NetworkRun::detectState( NodeCollection * NC ) { 6State_t NetworkRun::detectState( void ) {
6 RuntimeInfo * RI = netNode()->nextNode()->runtime(); 7 InterfaceInfo * II = nodeCollection()->assignedInterface();
7 AsDevice * Next = RI->asDevice();
8 InterfaceInfo * II = Next->assignedInterface();
9 8
10 if( II ) { 9 Log(( "Interface %p : %d\n", II, (II) ? II->IsUp : 0 ));
10 if( II && II->IsUp ) {
11 // device has assigned interface 11 // device has assigned interface
12 NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) ); 12 return IsUp;
13 return;
14 } 13 }
15 14
16 Log(( "%s not ! UP or ava\n", NC->name().latin1() )); 15 // had no interface or interface is no longer up -> release
17 // has no interface -> delegate 16 nodeCollection()->assignInterface( 0 );
18 RI->detectState( NC ); 17
18 return Unknown;
19} 19}
20 20
21bool NetworkRun::setState( NodeCollection * NC, Action_t A, bool Force ) { 21QString NetworkRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
22 // we handle UP and DOWN 22 // we handle UP and DOWN
23 RuntimeInfo * RI = netNode()->nextNode()->runtime(); 23 InterfaceInfo * II = NC->assignedInterface();
24 AsDevice * Next = RI->asDevice();
25 InterfaceInfo * II = Next->assignedInterface();
26 24
@@ -28,51 +26,26 @@ bool NetworkRun::setState( NodeCollection * NC, Action_t A, bool Force ) {
28 // we can bring UP if lower level is available 26 // we can bring UP if lower level is available
29 if( NC->currentState() == Available || Force ) { 27 QStringList SL;
30 QString S; 28 SL << "ifup"
31 S.sprintf( "ifup %s=%s-c%d-allowed", 29 << QString().sprintf( "%s=%s-c%d-allowed",
32 II->Name.latin1(), II->Name.latin1(), 30 II->Name.latin1(), II->Name.latin1(),
33 connection()->number() ); 31 nodeCollection()->number() );
34 NSResources->system().runAsRoot( S ); 32 if( ! NSResources->system().runAsRoot( SL ) ) {
33 return QString("Cannot call %1").arg(SL.join(" "));
35 } 34 }
36 return 1; 35 return QString();
37 } else if( A == Down ) { 36 }
38 QString S; 37
39 if( Force ) { 38 if( A == Down ) {
40 Log(("Force mode %d\n", Force )); 39 QStringList SL;
41 for( int i = 0; 40 if( II ) {
42 i < RI->netNode()->nodeClass()->instanceCount(); 41 SL << "ifdown"
43 i ++ ) { 42 << II->Name.latin1();
44 S.sprintf( "ifdown %s", 43 if( ! NSResources->system().runAsRoot( SL ) ) {
45 RI->netNode()->nodeClass()->genNic( i ).latin1() ); 44 return QString( "Cannot call %1" ).arg( SL.join( " " ));
46 NSResources->system().runAsRoot( S );
47 } 45 }
48 } else { 46 } else {
49 if( NC->currentState() == IsUp ) { 47 Log(( "no interface assigned." ));
50 S.sprintf( "ifdown %s=%s-c%d-allowed",
51 II->Name.latin1(), II->Name.latin1(),
52 connection()->number() );
53 NSResources->system().runAsRoot( S );
54 }
55 } 48 }
56 return 1;
57 }
58 // delegate
59 return RI->setState( NC, A, Force );
60}
61
62bool NetworkRun::canSetState( State_t Curr, Action_t A ) {
63 // we handle UP and DOWN
64 RuntimeInfo * RI = netNode()->nextNode()->runtime();
65
66 if( A == Up ) {
67 return ( Curr == Available );
68 } else if( A == Down ) {
69 return ( Curr == IsUp );
70 } 49 }
71 // delegate 50 return QString();
72 return RI->canSetState( Curr, A );
73}
74
75bool NetworkRun::handlesInterface( const QString & S ) {
76 // donno -> pass deeper
77 return netNode()->nextNode()->runtime()->handlesInterface(S);
78} 51}
diff --git a/noncore/settings/networksettings2/network/networkrun.h b/noncore/settings/networksettings2/network/networkrun.h
index 522a912..78a1694 100644
--- a/noncore/settings/networksettings2/network/networkrun.h
+++ b/noncore/settings/networksettings2/network/networkrun.h
@@ -1,5 +1,5 @@
1#include <asconnection.h> 1#include <netnode.h>
2#include "networkdata.h" 2#include "networkdata.h"
3 3
4class NetworkRun : public AsConnection { 4class NetworkRun : public RuntimeInfo {
5 5
@@ -8,16 +8,13 @@ public :
8 NetworkRun( ANetNodeInstance * NNI, 8 NetworkRun( ANetNodeInstance * NNI,
9 NetworkData & Data ) : AsConnection( NNI ) 9 NetworkData & Data ) : RuntimeInfo( NNI )
10 { } 10 { }
11 11
12 virtual AsConnection * asConnection( void ) 12 virtual RuntimeInfo * connection( void )
13 { return (AsConnection *)this; } 13 { return this; }
14 14
15protected : 15 State_t detectState( void );
16
17 void detectState( NodeCollection * );
18 bool setState( NodeCollection * ,Action_t A, bool );
19 bool canSetState( State_t , Action_t A );
20 16
21 bool handlesInterface( const QString & I ); 17protected :
22 18
19 QString setMyState( NodeCollection * , Action_t, bool );
23}; 20};
diff --git a/noncore/settings/networksettings2/network/opie-networksettings2plugin-network.control b/noncore/settings/networksettings2/network/opie-networksettings2plugin-network.control
index 3dbb808..7b1056b 100644
--- a/noncore/settings/networksettings2/network/opie-networksettings2plugin-network.control
+++ b/noncore/settings/networksettings2/network/opie-networksettings2plugin-network.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-network 1Package: opie-networksettings2plugin-network
2Files: plugins/networksettings2/libnetwork.so* 2Files: plugins/networksettings2/libnetwork.so*
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp
index ce0eabc..a0d4c7c 100644
--- a/noncore/settings/networksettings2/networksettings.cpp
+++ b/noncore/settings/networksettings2/networksettings.cpp
@@ -4,4 +4,8 @@
4 4
5#include <opie2/odebug.h>
6#include <opie2/oledbox.h>
7
5#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
6#include <qlistbox.h> 9#include <qlistbox.h>
10#include <qlayout.h>
7#include <qgroupbox.h> 11#include <qgroupbox.h>
@@ -17,3 +21,2 @@
17 21
18#include <asdevice.h>
19#include "networksettings.h" 22#include "networksettings.h"
@@ -33,9 +36,20 @@ NetworkSettings::NetworkSettings( QWidget *parent,
33 CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); 36 CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) );
34 Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) );
35 GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); 37 GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) );
36 38
37 Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); 39 Disable_TB->setPixmap( NSResources->getPixmap( "disabled" ) );
38 Disconnect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) ); 40 Up_TB->setPixmap( NSResources->getPixmap( "more" ) );
41 Down_TB->setPixmap( NSResources->getPixmap( "less" ) );
42
43 QVBoxLayout* V = new QVBoxLayout( LED_Frm );
44 QHBoxLayout * H = new QHBoxLayout( 0 );
45 V->addStretch(1);
46 V->addLayout( H );
47 Leds[0] = new OLedBox( red, LED_Frm );
48 H->addWidget( Leds[0], 0, Qt::AlignVCenter );
49 Leds[1] = new OLedBox( red, LED_Frm );
50 H->addWidget( Leds[1], 0, Qt::AlignVCenter );
51 Leds[2] = new OLedBox( red, LED_Frm );
52 H->addWidget( Leds[2], 0, Qt::AlignVCenter );
53 V->addStretch(1);
39 54
40 On_TB->setPixmap( NSResources->getPixmap( "off" ) );
41 55
@@ -74,3 +88,11 @@ NetworkSettings::NetworkSettings( QWidget *parent,
74 connect( &(NSResources->system()), 88 connect( &(NSResources->system()),
75 SIGNAL( lineFromCommand(const QString &) ), 89 SIGNAL( stdoutLine(const QString &) ),
90 this, SLOT( SLOT_CmdMessage(const QString &) ) );
91
92 connect( &(NSResources->system()),
93 SIGNAL( stderrLine(const QString &) ),
94 this, SLOT( SLOT_CmdMessage(const QString &) ) );
95
96 connect( &(NSResources->system()),
97 SIGNAL( processEvent(const QString &) ),
76 this, SLOT( SLOT_CmdMessage(const QString &) ) ); 98 this, SLOT( SLOT_CmdMessage(const QString &) ) );
@@ -89,5 +111,9 @@ NetworkSettings::~NetworkSettings() {
89 111
90 if( isModified() ) { 112 owarn << "Dispose NS" << oendl;
113 if( NSD.isModified() ) {
114 owarn << "Modified" << oendl;
91 S = NSD.saveSettings(); 115 S = NSD.saveSettings();
92 if( ! S.isEmpty() ) { 116 if( ! S.isEmpty() ) {
117 S.insert( 0, "<p>" );
118 S.append( "</p>" );
93 // problem saving 119 // problem saving
@@ -99,2 +125,3 @@ NetworkSettings::~NetworkSettings() {
99 SLOT_GenerateConfig(); 125 SLOT_GenerateConfig();
126 NSD.setModified( 0 );
100 } 127 }
@@ -169,3 +196,3 @@ void NetworkSettings::SLOT_DeleteNode( void ) {
169 delete LBI; 196 delete LBI;
170 setModified( 1 ); 197 NSD.setModified( 1 );
171 } 198 }
@@ -176,3 +203,2 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
176 203
177 printf( "------------------ Edit NOde\n" );
178 EditConnection EC( this ); 204 EditConnection EC( this );
@@ -198,3 +224,2 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
198 if( NC->isModified() ) { 224 if( NC->isModified() ) {
199 setModified( 1 );
200 if( LBI ) { 225 if( LBI ) {
@@ -251,35 +276,34 @@ void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) {
251 276
252 // is button possible 277 if( NC->description().isEmpty() ) {
253 bool EnabledPossible, OnPossible, ConnectPossible; 278 Description_LBL->setText( tr( "<<No description>>" ) );
254 // is button On or Off 279 } else {
255 bool DisabledOn, OnOn, ConnectOn; 280 Description_LBL->setText( NC->description() );
281 }
282
283 Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() );
256 284
257 EnabledPossible = OnPossible = ConnectPossible = 1; 285 bool FrmActive = 1;
258 DisabledOn = 1; 286 bool IsEnabled = 1;
259 OnOn = ConnectOn = 0; 287 int leds = 0;
260 288
289 owarn << "State " << NC->state() << oendl;
261 switch( NC->state() ) { 290 switch( NC->state() ) {
262 case Unknown : 291 case Disabled : // no further work
263 // cannot occur here 292 IsEnabled = 0;
293 FrmActive = 0;
294 owarn << "LEds " << leds << oendl;
264 break; 295 break;
296 case Unknown :
265 case Unchecked : 297 case Unchecked :
266 case Unavailable : 298 case Unavailable :
267 // cannot do anything but recheck 299 FrmActive = 0;
268 EnabledPossible = OnPossible = ConnectPossible = 0;
269 break;
270 case Disabled :
271 OnPossible = ConnectPossible = 0;
272 break; 300 break;
273 case Off : 301 case Off :
274 DisabledOn = 0; 302 leds = 1;
275 break; 303 break;
276 case Available : 304 case Available :
277 OnOn = 1; 305 leds = 2;
278 Connect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) );
279 DisabledOn = 0;
280 break; 306 break;
281 case IsUp : 307 case IsUp :
282 OnOn = ConnectOn = 1; 308 leds = 3;
283 Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) );
284 DisabledOn = 0;
285 break; 309 break;
@@ -287,22 +311,16 @@ void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) {
287 311
288 if( ! OnOn ) { 312 Disable_TB->setOn( ! IsEnabled );
289 Connect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) ); 313 LED_Frm->setEnabled( FrmActive );
290 }
291
292 // set button state
293 Enable_TB->setEnabled( EnabledPossible );
294 On_TB->setEnabled( OnPossible );
295 Connect_TB->setEnabled( ConnectPossible );
296
297 Enable_TB->setOn( DisabledOn );
298 On_TB->setOn( OnOn );
299 Connect_TB->setOn( ConnectOn );
300 314
301 if( NC->description().isEmpty() ) { 315 for( int i = 0 ; i < leds; i ++ ) {
302 Description_LBL->setText( tr( "<<No description>>" ) ); 316 Leds[i]->setColor( red );
303 } else { 317 Leds[i]->setOn( true );
304 Description_LBL->setText( NC->description() ); 318 }
319 for( int i = leds ; i < 3; i ++ ) {
320 Leds[i]->setColor( red );
321 Leds[i]->setOn( false );
305 } 322 }
306 323
307 Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() ); 324 Up_TB->setEnabled( leds < 3 && leds != 0 );
325 Down_TB->setEnabled( leds > 0 );
308} 326}
@@ -323,8 +341,17 @@ void NetworkSettings::updateProfileState( QListBoxItem * LBI ) {
323void NetworkSettings::SLOT_GenerateConfig( void ) { 341void NetworkSettings::SLOT_GenerateConfig( void ) {
324 NSD.regenerate(); 342 QString S = NSD.generateSettings();
343 if( ! S.isEmpty() ) {
344 S.insert( 0, "<p>" );
345 S.append( "</p>" );
346 QMessageBox::warning(
347 0,
348 tr( "Generate config" ),
349 S);
350 }
325} 351}
326 352
327void NetworkSettings::SLOT_Enable( void ) { 353void NetworkSettings::SLOT_Disable( bool T ) {
328 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); 354 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
329 QString Msg; 355 QString Msg;
356
330 if ( ! LBI ) 357 if ( ! LBI )
@@ -332,18 +359,9 @@ void NetworkSettings::SLOT_Enable( void ) {
332 359
333 NodeCollection * NC = 360 NodeCollection * NC = NSResources->findConnection( LBI->text() );
334 NSResources->findConnection( LBI->text() );
335
336 bool rv;
337 switch( NC->state() ) {
338 case Disabled :
339 Msg = tr( "Cannot enable profile" );
340 rv = NC->setState( Enable );
341 break;
342 default :
343 Msg = tr( "Cannot disable profile" );
344 rv = NC->setState( Disable );
345 break;
346 }
347 361
348 if( ! rv ) { 362 owarn << "Prepare to disable" << oendl;
363 Msg = NC->setState( (T) ? Disable : Enable );
364 if( ! Msg.isEmpty() ) {
365 Msg.insert( 0, "<p>" );
366 Msg.append( "</p>" );
349 QMessageBox::warning( 367 QMessageBox::warning(
@@ -354,2 +372,5 @@ void NetworkSettings::SLOT_Enable( void ) {
354 } 372 }
373
374 // reload new state
375 NC->state( true );
355 updateProfileState( LBI ); 376 updateProfileState( LBI );
@@ -357,4 +378,8 @@ void NetworkSettings::SLOT_Enable( void ) {
357 378
358void NetworkSettings::SLOT_On( void ) { 379void NetworkSettings::SLOT_Up( void ) {
380 // bring more up
381
359 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); 382 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
383 QString Msg;
384 int led = -1;
360 385
@@ -366,29 +391,51 @@ void NetworkSettings::SLOT_On( void ) {
366 391
367 bool rv;
368 switch( NC->state() ) { 392 switch( NC->state() ) {
369 case Off : 393 case Disabled : // cannot modify this state
370 // activate interface 394 case Unknown : // cannot modify this state
371 rv = NC->setState( Activate ); 395 case Unchecked : // cannot modify this state
396 case Unavailable : // cannot modify this state
397 case IsUp : // highest UP state
398 return;
399 case Off : // -> activate
400 led = 1;
401 Down_TB->setEnabled( true );
402 Log(( "Activate interface %s\n", NC->name().latin1() ));
403 Msg = NC->setState( Activate );
372 break; 404 break;
373 case Available : // deactivate 405 case Available : // -> up
374 case IsUp : // deactivate (will also bring down if needed) 406 led = 2;
375 rv = NC->setState( Deactivate ); 407 Log(( "Bring up interface %s\n", NC->name().latin1() ));
408 Msg = NC->setState( Up );
409 if( Msg.isEmpty() ) {
410 Up_TB->setEnabled( false );
411 }
376 break; 412 break;
377 default : 413 }
378 // others no change
379 return;
380 }
381 414
382 if( ! rv ) { 415 if( ! Msg.isEmpty() ) {
416 Msg.insert( 0, "<p>" );
417 Msg.append( "</p>" );
383 QMessageBox::warning( 418 QMessageBox::warning(
384 0, 419 0,
385 tr( "Activating profile" ), 420 tr( "Increase availability" ),
386 tr( "Cannot enable profile" ) ); 421 Msg );
387 return; 422 return;
388 } 423 }
424
389 updateProfileState( LBI ); 425 updateProfileState( LBI );
426
427 // set color of led we should change
428 if( led > 0 ) {
429 Leds[led]->setColor( blue );
430 Leds[led]->setOn( true );
431 }
432
390} 433}
391 434
392void NetworkSettings::SLOT_Connect( void ) { 435void NetworkSettings::SLOT_Down( void ) {
436 // bring more down
437
393 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); 438 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
439 int led = -1;
440 QString Msg;
394 441
@@ -400,47 +447,43 @@ void NetworkSettings::SLOT_Connect( void ) {
400 447
401 bool rv = 1 ;
402 switch( NC->state() ) { 448 switch( NC->state() ) {
403 case IsUp : 449 case Disabled : // cannot modify this state
404 // down interface 450 case Unknown : // cannot modify this state
405 rv = NC->setState( Down ); 451 case Unchecked : // cannot modify this state
406 break; 452 case Unavailable : // cannot modify this state
407 case Available : 453 case Off : // highest DOWN state
408 // up interface
409 rv = NC->setState( Up );
410 break; 454 break;
411 case Off : 455 case Available : // -> down
412 // activate and bring up 456 led = 0;
413 rv = ( NC->setState( Activate ) && 457 Log(( "Deactivate interface %s\n", NC->name().latin1() ));
414 NC->setState( Up ) ); 458 Msg = NC->setState( Deactivate );
459 Down_TB->setEnabled( false );
415 break; 460 break;
416 default : 461 case IsUp : // highest UP state
417 // others no change 462 led = 1;
463 Up_TB->setEnabled( true );
464 Log(( "Bring down interface %s\n", NC->name().latin1() ));
465 Msg = NC->setState( Down, 1 );
466 if( Msg.isEmpty() ) {
467 // remove 'up' file to make sure
468 unlink ( QString().sprintf( "/tmp/Profile-%d.up", NC->number() ).latin1() );;
469 }
418 break; 470 break;
419 } 471 }
420 472
421 if( ! rv ) { 473 if( ! Msg.isEmpty() ) {
474 Msg.insert( 0, "<p>" );
475 Msg.append( "</p>" );
422 QMessageBox::warning( 476 QMessageBox::warning(
423 0, 477 0,
424 tr( "Activating profile" ), 478 tr( "Decrease availability" ),
425 tr( "Cannot enable profile" ) ); 479 Msg );
426 }
427
428 // we do not update the GUI but wait for the REAL upping of the device
429}
430
431void NetworkSettings::SLOT_Disconnect( void ) {
432 QString S;
433 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
434
435 if ( ! LBI )
436 return; 480 return;
481 }
437 482
438 NodeCollection * NC = 483 updateProfileState( LBI );
439 NSResources->findConnection( LBI->text() );
440 484
441 Log(( "Force interface %s down\n", NC->name().latin1() )); 485 // set color of led we should change
442 NC->setState( Down, 1 ); 486 if( led >= 0 ) {
443 // remove 'up' file to make sure 487 Leds[led]->setColor( blue );
444 S.sprintf( "/tmp/Profile-%d.up", NC->number() ); 488 }
445 unlink( S.latin1() );
446} 489}
@@ -448,2 +491,3 @@ void NetworkSettings::SLOT_Disconnect( void ) {
448void NetworkSettings::SLOT_ToMessages( void ) { 491void NetworkSettings::SLOT_ToMessages( void ) {
492 Profiles_LB->hide();
449 Profile_GB->hide(); 493 Profile_GB->hide();
@@ -453,2 +497,3 @@ void NetworkSettings::SLOT_ToMessages( void ) {
453void NetworkSettings::SLOT_ToProfile( void ) { 497void NetworkSettings::SLOT_ToProfile( void ) {
498 Profiles_LB->show();
454 Profile_GB->show(); 499 Profile_GB->show();
diff --git a/noncore/settings/networksettings2/networksettings.h b/noncore/settings/networksettings2/networksettings.h
index 8ec5d08..987e311 100644
--- a/noncore/settings/networksettings2/networksettings.h
+++ b/noncore/settings/networksettings2/networksettings.h
@@ -9,2 +9,3 @@ class QListBoxItem;
9class QEvent; 9class QEvent;
10class OLedBox;
10 11
@@ -19,3 +20,3 @@ public :
19 WFlags fl = 0 ); 20 WFlags fl = 0 );
20 ~NetworkSettings( void ); 21 virtual ~NetworkSettings( void );
21 22
@@ -24,7 +25,2 @@ public :
24 25
25 bool isModified( void )
26 { return NSD.isModified(); }
27 void setModified( bool m )
28 { NSD.setModified( m ); }
29
30public slots : 26public slots :
@@ -36,6 +32,7 @@ public slots :
36 void SLOT_CheckState( void ); 32 void SLOT_CheckState( void );
37 void SLOT_Enable( void ); 33
38 void SLOT_On( void ); 34 void SLOT_Up( void );
39 void SLOT_Connect( void ); 35 void SLOT_Down( void );
40 void SLOT_Disconnect( void ); 36 void SLOT_Disable( bool );
37
41 void SLOT_GenerateConfig( void ); 38 void SLOT_GenerateConfig( void );
@@ -52,2 +49,11 @@ private :
52 NetworkSettingsData NSD; 49 NetworkSettingsData NSD;
50 /*
51
52 no leds : not present, unknown, unchecked or disabled
53 (1) down : hardware present but inactive
54 (2) available : hardware present and active
55 (3) up : present active and connected
56
57 */
58 OLedBox * Leds[3];
53}; 59};
diff --git a/noncore/settings/networksettings2/networksettings.pro b/noncore/settings/networksettings2/networksettings.pro
index 5d9efbb..d201db1 100644
--- a/noncore/settings/networksettings2/networksettings.pro
+++ b/noncore/settings/networksettings2/networksettings.pro
@@ -13,5 +13,5 @@ SOURCES = main.cpp \
13 editconnection.cpp 13 editconnection.cpp
14INCLUDEPATH += $(OPIEDIR)/include networksettings2/ 14INCLUDEPATH += $(OPIEDIR)/include networksettings2/ opietooth2/
15DEPENDPATH += $(OPIEDIR)/include networksettings2/ 15DEPENDPATH += $(OPIEDIR)/include networksettings2/ opietooth2/
16LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings2 -lnetworksettings2 -lopiecore2 16LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings2 -lnetworksettings2 -lopietooth2 -lopiecore2
17INTERFACES = networksettingsGUI.ui \ 17INTERFACES = networksettingsGUI.ui \
diff --git a/noncore/settings/networksettings2/networksettings2/GUIUtils.h b/noncore/settings/networksettings2/networksettings2/GUIUtils.h
index 23290a9..baf6f0c 100644
--- a/noncore/settings/networksettings2/networksettings2/GUIUtils.h
+++ b/noncore/settings/networksettings2/networksettings2/GUIUtils.h
@@ -33,2 +33,11 @@
33 33
34#define STXT(a, b) \
35 b->setText( a );
36
37#define SCB(a, b) \
38 b->setChecked( a );
39
40#define SSB( Data,Wdg) \
41 Wdg->setValue( Data )
42
34extern bool validIP( const QString & S ); 43extern bool validIP( const QString & S );
diff --git a/noncore/settings/networksettings2/networksettings2/Utils.h b/noncore/settings/networksettings2/networksettings2/Utils.h
index 739476e..301aac1 100644
--- a/noncore/settings/networksettings2/networksettings2/Utils.h
+++ b/noncore/settings/networksettings2/networksettings2/Utils.h
@@ -3,2 +3,4 @@
3 3
4#include <opie2/odebug.h>
5
4#define Log(x) VLog x 6#define Log(x) VLog x
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp
index 110786a..17653bd 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.cpp
+++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp
@@ -4,3 +4,2 @@
4 4
5
6#include <qpainter.h> 5#include <qpainter.h>
@@ -13,6 +12,20 @@
13 12
14#include "asdevice.h" 13static char * ActionName[] = {
15#include "asline.h" 14 "Disable",
16#include "asconnection.h" 15 "Enable",
17#include "asfullsetup.h" 16 "Activate",
17 "Deactivate",
18 "Up",
19 "Down"
20};
21
22static char * StateName[] = {
23 "Unchecked",
24 "Unknown",
25 "Unavailable",
26 "Disabled",
27 "Off",
28 "Available",
29 "IsUp"
30};
18 31
@@ -67,2 +80,17 @@ void ANetNode::setAttribute( QString & Attr, QString & Value ){
67 80
81bool ANetNode::isToplevel( void ) {
82 const char ** P = provides();
83 while( *P ) {
84 if( strcmp( *P, "fullsetup") == 0 )
85 return 1;
86 P ++;
87 }
88 return 0;
89}
90
91bool ANetNode::openFile( SystemFile & SF,
92 ANetNodeInstance * NNI ) {
93 return (NNI ) ? NNI->openFile( SF ) : 0 ;
94}
95
68// 96//
@@ -86,3 +114,3 @@ void ANetNodeInstance::initialize( void ) {
86void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ 114void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){
87 if( Attr == "name" ) { 115 if( Attr == "__name" ) {
88 setName( Value.latin1() ); 116 setName( Value.latin1() );
@@ -94,3 +122,3 @@ void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){
94void ANetNodeInstance::saveAttributes( QTextStream & TS ) { 122void ANetNodeInstance::saveAttributes( QTextStream & TS ) {
95 TS << "name=" << name() << endl; 123 TS << "__name=" << name() << endl;
96 saveSpecificAttribute( TS ); 124 saveSpecificAttribute( TS );
@@ -114,2 +142,3 @@ NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() {
114 CurrentState = Unchecked; 142 CurrentState = Unchecked;
143 AssignedInterface = 0;
115} 144}
@@ -125,2 +154,3 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
125 IsNew = 0; 154 IsNew = 0;
155 AssignedInterface = 0;
126 CurrentState = Unchecked; 156 CurrentState = Unchecked;
@@ -149,3 +179,2 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
149 } else if( A == "number" ) { 179 } else if( A == "number" ) {
150 Log(( "Profile number %s\n", N.latin1() ));
151 setNumber( N.toLong() ); 180 setNumber( N.toLong() );
@@ -161,2 +190,5 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
161 } while( 1 ); 190 } while( 1 );
191
192 Log(( "Profile number %s : %d nodes\n",
193 N.latin1(), count() ));
162} 194}
@@ -169,3 +201,3 @@ const QString & NodeCollection::description( void ) {
169 ANetNodeInstance * NNI = getToplevel(); 201 ANetNodeInstance * NNI = getToplevel();
170 return (NNI) ? NNI->runtime()->asFullSetup()->description() : Name; 202 return (NNI) ? NNI->runtime()->description() : Name;
171} 203}
@@ -256,3 +288,4 @@ QPixmap NodeCollection::devicePixmap( void ) {
256 288
257 QPixmap Mini = NSResources->getPixmap( device()->netNode()->pixmapName() ); 289 QPixmap Mini = NSResources->getPixmap(
290 device()->netNode()->pixmapName() );
258 291
@@ -282,3 +315,3 @@ QString NodeCollection::stateName( State_t S) {
282 case Off : 315 case Off :
283 return qApp->translate( "networksettings2", "Off"); 316 return qApp->translate( "networksettings2", "Inactive");
284 case Available : 317 case Available :
@@ -286,3 +319,3 @@ QString NodeCollection::stateName( State_t S) {
286 case IsUp : 319 case IsUp :
287 return qApp->translate( "networksettings2", "IsUp"); 320 return qApp->translate( "networksettings2", "Up");
288 case Unchecked : /* FT */ 321 case Unchecked : /* FT */
@@ -302,7 +335,7 @@ void NodeCollection::reassign( void ) {
302 335
303bool NodeCollection::triggersVPN() { 336const QStringList & NodeCollection::triggers() {
304 return getToplevel()->runtime()->asFullSetup()->triggersVPN(); 337 return getToplevel()->runtime()->triggers();
305} 338}
306 339
307bool NodeCollection::hasDataForFile( const QString & S ) { 340bool NodeCollection::hasDataForFile( SystemFile & S ) {
308 return ( firstWithDataForFile( S ) != 0 ); 341 return ( firstWithDataForFile( S ) != 0 );
@@ -310,3 +343,3 @@ bool NodeCollection::hasDataForFile( const QString & S ) {
310 343
311ANetNodeInstance * NodeCollection::firstWithDataForFile( const QString & S ) { 344ANetNodeInstance * NodeCollection::firstWithDataForFile( SystemFile & S ) {
312 for( QListIterator<ANetNodeInstance> it(*this); 345 for( QListIterator<ANetNodeInstance> it(*this);
@@ -315,5 +348,2 @@ ANetNodeInstance * NodeCollection::firstWithDataForFile( const QString & S ) {
315 if( it.current()->hasDataForFile( S ) ) { 348 if( it.current()->hasDataForFile( S ) ) {
316 Log(( "Node %s has data for %s\n",
317 it.current()->nodeClass()->name(),
318 S.latin1() ));
319 return it.current(); 349 return it.current();
@@ -324,5 +354,137 @@ ANetNodeInstance * NodeCollection::firstWithDataForFile( const QString & S ) {
324 354
355State_t NodeCollection::state( bool Update ) {
356 State_t NodeState;
357
358 if( CurrentState == Unchecked || Update ) {
359 // collect states of all nodes until with get the 'higest'
360 // state possible
361
362 Log(( "Connection %s state %s\n",
363 Name.latin1(), StateName[CurrentState] ));
364
365 CurrentState = Unknown;
366 for( QListIterator<ANetNodeInstance> it(*this);
367 it.current();
368 ++it ) {
369 Log(( "-> Detect %s\n", it.current()->name() ));
370 NodeState = it.current()->runtime()->detectState();
371 Log(( " state %s\n", StateName[NodeState] ));
372
373 if( NodeState == Disabled ||
374 NodeState == IsUp ) {
375 // max
376 CurrentState = NodeState;
377 break;
378 }
379
380 if( NodeState > CurrentState ) {
381 // higher
382 CurrentState = NodeState;
383 }
384 }
385 }
386
387 return CurrentState;
388}
389
390QString NodeCollection::setState( Action_t A, bool Force ) {
391
392 QString msg;
393 Action_t Actions[10];
394 int NoOfActions = 0;
395
396 // get current state
397 state( Force );
398
399 switch( A ) {
400 case Disable :
401 if( CurrentState < Disabled ) {
402 // disabled
403 CurrentState = Disabled;
404 return QString();
405 }
406
407 if( CurrentState == IsUp ) {
408 Actions[NoOfActions++] = Down;
409 Actions[NoOfActions++] = Deactivate;
410 } else if( CurrentState == Available ) {
411 Actions[NoOfActions++] = Deactivate;
412 }
413 Actions[NoOfActions++] = Disable;
414 break;
415 case Enable :
416 // always possible -> detected state is new state
417 Actions[NoOfActions++] = Enable;
418 break;
419 case Activate :
420 if( ! Force ) {
421 if( CurrentState >= Available ) {
422 // already available
423 return QString();
424 }
425
426 if( CurrentState != Off ) {
427 return qApp->translate( "System",
428 "State should be off" );
429 }
430 }
431
432 Actions[NoOfActions++] = Activate;
433 break;
434 case Deactivate :
435 if( ! Force ) {
436 if( CurrentState < Off ) {
437 // already inactive
438 return QString();
439 }
440 }
441
442 if( CurrentState == IsUp ) {
443 Actions[NoOfActions++] = Down;
444 }
445 Actions[NoOfActions++] = Deactivate;
446 break;
447 case Up :
448 if( ! Force ) {
449 if( CurrentState == IsUp ) {
450 return QString();
451 }
452 if( CurrentState < Off ) {
453 return qApp->translate( "System",
454 "State should at least be off" );
455 }
456 }
457 if( CurrentState == Off ) {
458 Actions[NoOfActions++] = Activate;
459 }
460 Actions[NoOfActions++] = Up;
461 break;
462 case Down :
463 if( ! Force ) {
464 if( CurrentState < Available ) {
465 // OK
466 return QString();
467 }
468 }
469 Actions[NoOfActions++] = Down;
470 break;
471 }
472
473 // send actions to all nodes
474 Log(( "Action %s requires %d steps\n",
475 ActionName[A], NoOfActions ));
476
477 for( int i = 0 ; i < NoOfActions; i ++ ) {
478 // setState recurses through the tree depth first
479 msg = getToplevel()->runtime()->setState( this, Actions[i], Force );
480 if( ! msg.isEmpty() ) {
481 return msg;
482 }
483 }
484 return QString();
485}
486
325// 487//
326// 488//
327// RUNTIMEINFO 489// RuntimeInfo
328// 490//
@@ -330,8 +492,20 @@ ANetNodeInstance * NodeCollection::firstWithDataForFile( const QString & S ) {
330 492
331InterfaceInfo * RuntimeInfo::assignedInterface( void ) { 493QString RuntimeInfo::setState( NodeCollection * NC,
332 return netNode()->nextNode()->runtime()->assignedInterface(); 494 Action_t A,
333} 495 bool Force ) {
496 QString M;
497 RuntimeInfo * Deeper = nextNode();
498
499 if( Deeper ) {
500 // first go deeper
501 M = Deeper->setState( NC, A, Force );
502 if( ! M.isEmpty() )
503 return M;
504 }
334 505
335AsDevice * RuntimeInfo::device( void ) { 506 // set my own state
336 return netNode()->nextNode()->runtime()->device(); 507 Log (( "-> Act upon %s\n", netNode()->name() ));
508 M = setMyState( NC, A, Force );
509 Log (( " result %s\n", M.latin1() ));
510 return M;
337} 511}
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h
index d3d7b34..4626381 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.h
+++ b/noncore/settings/networksettings2/networksettings2/netnode.h
@@ -12,2 +12,3 @@
12#include <Utils.h> 12#include <Utils.h>
13#include <system.h>
13 14
@@ -28,2 +29,3 @@ class RuntimeInfo;
28class InterfaceInfo; 29class InterfaceInfo;
30class NSResources;
29 31
@@ -57,13 +59,13 @@ typedef enum State {
57typedef enum Action { 59typedef enum Action {
58 // to make the device unavailable functionally 60 // to make the device unavailable functionally -> to disabled
59 Disable = 0, 61 Disable = 0,
60 // to make the device available functionally 62 // to make the device available functionally -> to off
61 Enable = 1, 63 Enable = 1,
62 // bring the hardware up 64 // bring the hardware up -> to Available
63 Activate = 2, 65 Activate = 2,
64 // bring the hardware down 66 // bring the hardware down -> to off
65 Deactivate = 3, 67 Deactivate = 3,
66 // bring the connection up 68 // bring the connection up -> to IsUp
67 Up = 4, 69 Up = 4,
68 // bring the connection down 70 // bring the connection down -> to Available
69 Down = 5 71 Down = 5
@@ -71,3 +73,3 @@ typedef enum Action {
71 73
72class ANetNode : public QObject{ 74class ANetNode : public QObject {
73 75
@@ -92,4 +94,3 @@ public:
92 // does this Node provide a Connection 94 // does this Node provide a Connection
93 inline bool isToplevel( void ) 95 bool isToplevel( void );
94 { return strcmp( provides(), "fullsetup") == 0 ; }
95 96
@@ -112,18 +113,30 @@ public:
112 // do instances of this noce class have data for this file 113 // do instances of this noce class have data for this file
113 virtual bool hasDataForFile( const QString & ) 114 virtual bool hasDataForFile( SystemFile & )
114 { return 0; } 115 { return 0; }
115 116
117 // open proper file SF identified by S
118 // this method is called by NS2.
119 //
120 // overrule this ONLY if this proper file is a common file
121 // for all NNI of this node class and the data generated
122 // by each of the NNI needs to be put in one file
123 //
124 // if this is the case the file should be (re)opened in append
125 // return 0 if file cannot be opened
126 virtual bool openFile( SystemFile &SF,
127 ANetNodeInstance * NNI );
128
116 // generate instance independent stuff 129 // generate instance independent stuff
117 // 0 : data output, 1 no data, 2 error 130 // 0 : data output, 1 no data, 2 error
118 virtual short generateFile( const QString & , 131 virtual short generatePreamble( SystemFile & )
119 const QString & , 132 { return 1; }
120 QTextStream & , 133
121 long ) 134 // generate instance independent stuff
135 // 0 : data output, 1 no data, 2 error
136 virtual short generatePostamble( SystemFile & )
122 { return 1; } 137 { return 1; }
123 138
124 // generate instance dependent but profile common stuff 139 // generate instance dependent but instance common stuff
125 // 0 : data output, 1 no data, 2 error 140 // 0 : data output, 1 no data, 2 error
126 virtual short generateFile( const QString & , 141 virtual short generateFile( SystemFile &,
127 const QString & ,
128 QTextStream & ,
129 ANetNodeInstance * , 142 ANetNodeInstance * ,
@@ -132,3 +145,2 @@ public:
132 145
133
134 // generate NIC name based on instance nr 146 // generate NIC name based on instance nr
@@ -143,5 +155,6 @@ public:
143 155
144 // return list of files that are specific for this node class 156 // return ID list for each file generated specially for
145 virtual QStringList * properFiles( void ) 157 // this node type
146 { return 0; } 158 virtual QStringList properFiles( void )
159 { return QStringList(); }
147 160
@@ -162,4 +175,6 @@ public:
162 175
163 // return feature this NetNode provides 176 // return features this NetNode provides
164 virtual const char * provides( void ) = 0; 177 virtual const char ** provides( void ) = 0;
178
179 // return features this NetNode needs
165 virtual const char ** needs( void ) = 0; 180 virtual const char ** needs( void ) = 0;
@@ -226,3 +241,3 @@ public:
226 241
227 inline const char * provides( void ) 242 inline const char ** provides( void )
228 { return NodeType->provides(); } 243 { return NodeType->provides(); }
@@ -246,3 +261,3 @@ public:
246 // open proper file identified by S 261 // open proper file identified by S
247 virtual QFile * openFile( const QString & ) 262 virtual bool openFile( SystemFile & )
248 { return 0; } 263 { return 0; }
@@ -250,3 +265,3 @@ public:
250 // check if this node (or sub nodes) have data for this file 265 // check if this node (or sub nodes) have data for this file
251 virtual bool hasDataForFile( const QString & S ) 266 virtual bool hasDataForFile( SystemFile & S )
252 { return nodeClass()->hasDataForFile( S ); } 267 { return nodeClass()->hasDataForFile( S ); }
@@ -256,8 +271,6 @@ public:
256 // this is called within the code of the parent 271 // this is called within the code of the parent
257 virtual short generateFileEmbedded( const QString & ID, 272 virtual short generateFileEmbedded( SystemFile & SF,
258 const QString & Path,
259 QTextStream & TS,
260 long DevNr ) 273 long DevNr )
261 { ANetNodeInstance * NNI = nextNode(); 274 { ANetNodeInstance * NNI = nextNode();
262 return (NNI) ? NNI->generateFileEmbedded( ID, Path, TS, DevNr ) : 1; 275 return (NNI) ? NNI->generateFileEmbedded( SF, DevNr ) : 1;
263 } 276 }
@@ -266,8 +279,6 @@ public:
266 // (or find the first node that does) 279 // (or find the first node that does)
267 virtual short generateFile( const QString & ID, 280 virtual short generateFile( SystemFile & SF,
268 const QString & Path,
269 QTextStream & TS,
270 long DevNr ) 281 long DevNr )
271 { ANetNodeInstance * NNI = nextNode(); 282 { ANetNodeInstance * NNI = nextNode();
272 return (NNI) ? NNI->generateFile( ID, Path, TS, DevNr ) : 1; 283 return (NNI) ? NNI->generateFile( SF, DevNr ) : 1;
273 } 284 }
@@ -325,11 +336,16 @@ public :
325 336
326 // downcast implemented by specify runtime classes 337 //
327 virtual AsDevice * asDevice( void ) 338 //
328 { return 0; } 339 // methods to be overloaded by connection capable
329 virtual AsConnection * asConnection( void ) 340 // runtimes
330 { return 0; } 341 //
331 virtual AsLine * asLine( void ) 342 //
332 { return 0; } 343
333 virtual AsFullSetup * asFullSetup( void ) 344
334 { return 0; } 345 //
346 //
347 // methods to be overloaded by device capable
348 // runtimes
349 //
350 //
335 351
@@ -337,17 +353,97 @@ public :
337 // recurse deeper if this node cannot answer that question 353 // recurse deeper if this node cannot answer that question
338 virtual bool handlesInterface( const QString & ) 354 virtual bool handlesInterface( const QString & S ) {
339 { return 0; } 355 RuntimeInfo * RI = device();
340 virtual bool handlesInterface( const InterfaceInfo & ) 356 if( RI ) {
341 { return 0; } 357 return RI->handlesInterface( S );
342 virtual InterfaceInfo * assignedInterface( void ); 358 }
343 virtual AsDevice * device( void ); 359 return 0;
344 360 }
345 ANetNodeInstance * netNode() 361 bool handlesInterface( const InterfaceInfo & I ) {
362 RuntimeInfo * RI = device();
363 if( RI ) {
364 return RI->handlesInterface( I );
365 }
366 return 0;
367 }
368
369 //
370 //
371 // methods to be overloaded by full setup capable
372 // runtimes
373 //
374 //
375
376 // return description for this full setup
377 virtual const QString & description( void ) {
378 return fullSetup()->description( );
379 }
380 // return triggers that should fire when this
381 // setup is brought up
382 virtual const QStringList & triggers( void ) {
383 return fullSetup()->triggers( );
384 }
385
386 //
387 //
388 // methods to be overloaded by line capable
389 // runtimes
390 //
391 //
392
393 // return the device file ('/dev/xxx') created
394 // by this line capable runtime
395 virtual QString deviceFile( void ) {
396 RuntimeInfo * RI = line();
397 if( RI ) {
398 return RI->deviceFile();
399 }
400 return QString();
401 }
402
403 //
404 //
405 // runtime interface
406 //
407 //
408
409 // return the node that offers device capability
410 virtual RuntimeInfo * device( void )
411 { RuntimeInfo * RI = nextNode();
412 return (RI) ? RI->device() : 0;
413 }
414
415 // return the node that offers connection capability
416 virtual RuntimeInfo * connection( void )
417 { RuntimeInfo * RI = nextNode();
418 return (RI) ? RI->connection() : 0;
419 }
420
421 // return the node that offers line capability
422 virtual RuntimeInfo * line( void )
423 { RuntimeInfo * RI = nextNode();
424 return (RI) ? RI->line() : 0;
425 }
426
427 // return the node that offers full setup capability
428 virtual RuntimeInfo * fullSetup( void )
429 { RuntimeInfo * RI = nextNode();
430 return (RI) ? RI->fullSetup() : 0;
431 }
432
433 inline ANetNodeInstance * netNode()
346 { return NNI; } 434 { return NNI; }
347 NodeCollection * connection() 435
436 inline NodeCollection * nodeCollection()
348 { return NNI->connection(); } 437 { return NNI->connection(); }
349 438
350 virtual void detectState( NodeCollection * NC ) = 0; 439 virtual State_t detectState( void ) = 0;
351 virtual bool setState( NodeCollection * NC, Action_t A, bool Force = 0 ) = 0; 440 // public API to set the state
352 virtual bool canSetState( State_t Curr, Action_t A ) = 0; 441 virtual QString setState( NodeCollection * NC,
442 Action_t A,
443 bool Force = 0 );
444
445 inline RuntimeInfo * nextNode( void ) {
446 ANetNodeInstance * NNI = netNode()->nextNode();
447 return (NNI) ? NNI->runtime() : 0;
448 }
353 449
@@ -360,2 +456,7 @@ protected :
360 456
457 // set state of this node (private API)
458 virtual QString setMyState( NodeCollection * NC,
459 Action_t A,
460 bool Force = 0 ) = 0;
461
361 // connection this runtime info belongs to 462 // connection this runtime info belongs to
@@ -394,7 +495,22 @@ public :
394 495
496 // return the interface in the OS that is assigned to
497 // this device
395 inline InterfaceInfo * assignedInterface( void ) { 498 inline InterfaceInfo * assignedInterface( void ) {
396 return getToplevel()->runtime()->assignedInterface(); 499 return AssignedInterface;
397 } 500 }
398 501
399 inline AsDevice * device() { 502 // assign the interface to this device
503 inline void assignInterface( InterfaceInfo * NI ) {
504 if( NI == 0 ) {
505 if( AssignedInterface ) {
506 AssignedInterface->assignConnection( 0 );
507 }
508 }
509 AssignedInterface = NI;
510 if( AssignedInterface ) {
511 AssignedInterface->assignConnection( this );
512 }
513 }
514
515 inline RuntimeInfo * device() {
400 return getToplevel()->runtime()->device(); 516 return getToplevel()->runtime()->device();
@@ -402,16 +518,5 @@ public :
402 518
403 bool triggersVPN(); 519 const QStringList & triggers();
404 520
405 inline State_t state( bool Update = 0 ) 521 State_t state( bool Update = 0 );
406 { Log(( "%s state %d(=%d?)\n", Name.latin1(), CurrentState,
407 Unchecked ));
408 if( CurrentState == Unchecked || Update ) {
409 Log(( "TL %p TLR %p\n",
410 getToplevel(),
411 getToplevel()->runtime() ));
412 // need to get current state
413 getToplevel()->runtime()->detectState( this );
414 }
415 return CurrentState;
416 }
417 522
@@ -426,6 +531,3 @@ public :
426 531
427 inline bool setState( Action_t A, bool Force =0 ) 532 QString setState( Action_t A, bool Force = 0 );
428 { return getToplevel()->runtime()->setState( this, A, Force ); }
429 inline bool canSetState( Action_t A )
430 { return getToplevel()->runtime()->canSetState( CurrentState, A ); }
431 533
@@ -458,12 +560,10 @@ public :
458 // file identified by S 560 // file identified by S
459 bool hasDataForFile( const QString & S ); 561 bool hasDataForFile( SystemFile & S );
460 ANetNodeInstance * firstWithDataForFile( const QString & S ); 562 ANetNodeInstance * firstWithDataForFile( SystemFile & );
461 563
462 // generate items for this file -> toplevel call 564 // generate items for this file -> toplevel call
463 short generateFile( const QString & FID, // identification of file 565 short generateFile( SystemFile & SF,
464 const QString & FName, // effective filename of file
465 QTextStream & TS, // stream to file
466 long DN // device number 566 long DN // device number
467 ) 567 )
468 { return getToplevel()->generateFile( FID, FName, TS, DN ); } 568 { return getToplevel()->generateFile( SF, DN ); }
469 569
@@ -491,2 +591,4 @@ private :
491 591
592 InterfaceInfo * AssignedInterface;
593
492}; 594};
diff --git a/noncore/settings/networksettings2/networksettings2/networksettings2.pro b/noncore/settings/networksettings2/networksettings2/networksettings2.pro
index d1e42b7..f2ba9df 100644
--- a/noncore/settings/networksettings2/networksettings2/networksettings2.pro
+++ b/noncore/settings/networksettings2/networksettings2/networksettings2.pro
@@ -7,9 +7,5 @@ HEADERS = netnode.h \
7 system.h \ 7 system.h \
8 asline.h \
9 GUIUtils.h \ 8 GUIUtils.h \
10 asconnection.h \
11 asfullsetup.h \
12 systemfile.h \ 9 systemfile.h \
13 wextensions.h \ 10 wextensions.h
14 asdevice.h
15 SOURCES = netnode.cpp \ 11 SOURCES = netnode.cpp \
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp
index 2f17693..8b3b4fe 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.cpp
+++ b/noncore/settings/networksettings2/networksettings2/resources.cpp
@@ -47,11 +47,16 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
47 47
48 const char * Provides = InnerIt.current()->NetNode->provides(); 48 const char ** Provides = InnerIt.current()->NetNode->provides();
49 NeedsRun = OuterIt.current()->NetNode->needs(); 49 NeedsRun = OuterIt.current()->NetNode->needs();
50
50 for( ; *NeedsRun; NeedsRun ++ ) { 51 for( ; *NeedsRun; NeedsRun ++ ) {
51 if( strcmp( Provides, *NeedsRun ) == 0 ) { 52 const char ** PRun;
52 // inner provides what outer needs 53 PRun = Provides;
53 NNL.resize( NNL.size() + 1 ); 54 for( ; *PRun; PRun ++ ) {
54 NNL[NNL.size()-1] = InnerIt.current()->NetNode; 55 if( strcmp( *PRun, *NeedsRun ) == 0 ) {
55 Done = 1; // break from 2 loops 56 // inner provides what outer needs
56 break; 57 NNL.resize( NNL.size() + 1 );
58 NNL[NNL.size()-1] = InnerIt.current()->NetNode;
59 Done = 1; // break from 2 loops
60 break;
61 }
57 } 62 }
@@ -63,19 +68,13 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
63 68
64 // define Node types to Description map 69 // define built in Node types to Description map
65 NodeTypeNameMap.insert( "device", tr( "Network Device" ) ); 70 addNodeType( "device", tr( "Network Device" ),
66 NodeTypeNameMap.insert( "line", tr( "Character device" ) ); 71 tr( "<p>Devices that can handle IP packets</p>" ) );
67 NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) ); 72 addNodeType( "line", tr( "Character device" ),
68 NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) ); 73 tr( "<p>Devices that can handle single bytes</p>" ) );
69 74 addNodeType( "connection", tr( "IP Connection" ),
70 NodeTypeDescriptionMap.insert( "device", 75 tr( "<p>Nodes that provide working IP connections</p>" ) );
71 tr( "<p>Devices that can handle IP packets</p>" ) ); 76 addNodeType( "fullsetup", tr( "Connection Profile" ),
72 NodeTypeDescriptionMap.insert( "line", 77 tr( "<p>Fully configured connection profile</p>" ) );
73 tr( "<p>Devices that can handle single bytes</p>" ) ); 78 addNodeType( "GPRS", tr( "Connection to GPRS device" ),
74 NodeTypeDescriptionMap.insert( "connection", 79 tr( "<p>Connection to a GPRS capable device</p>" ) );
75 tr( "<p>Nodes that provide working IP connections</p>" ) );
76 NodeTypeDescriptionMap.insert( "fullsetup",
77 tr( "<p>Fully configured connection profile</p>" ) );
78
79 // define system files
80 addSystemFile( "interfaces", "/tmp/interfaces", 1 );
81 80
@@ -90,2 +89,11 @@ TheNSResources::~TheNSResources( void ) {
90 89
90void TheNSResources::addNodeType( const QString & ID,
91 const QString & Name,
92 const QString & Descr ) {
93 if( NodeTypeNameMap[ID].isEmpty() ) {
94 NodeTypeNameMap.insert( ID, Name );
95 NodeTypeDescriptionMap.insert( ID, Descr );
96 }
97}
98
91void TheNSResources::addSystemFile( const QString & ID, 99void TheNSResources::addSystemFile( const QString & ID,
@@ -222,4 +230,6 @@ QPixmap TheNSResources::getPixmap( const QString & QS ) {
222 S += QS; 230 S += QS;
223 Log(("%s\n", S.latin1() ));
224 P = Resource::loadPixmap( S ); 231 P = Resource::loadPixmap( S );
232 if( P.isNull() ) {
233 Log(( "Cannot load %s\n", S.latin1() ));
234 }
225 return ( P.isNull() ) ? QPixmap() : P; 235 return ( P.isNull() ) ? QPixmap() : P;
@@ -271,2 +281,12 @@ NodeCollection * TheNSResources::findConnection( const QString & S ) {
271 281
282NodeCollection * TheNSResources::getConnection( int nr ) {
283 for( QDictIterator<NodeCollection> it(ConnectionsMap);
284 it.current();
285 ++it ) {
286 if( it.current()->number() == nr ) {
287 return it.current();
288 }
289 }
290 return 0;
291}
272/* 292/*
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h
index 23b120e..634cd39 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.h
+++ b/noncore/settings/networksettings2/networksettings2/resources.h
@@ -69,2 +69,7 @@ public :
69 69
70 // define new plugin (=node)
71 void addNodeType( const QString & ID,
72 const QString & LongName,
73 const QString & Description );
74
70 Name2SystemFile_t & systemFiles( void ) 75 Name2SystemFile_t & systemFiles( void )
@@ -101,2 +106,3 @@ public :
101 NodeCollection * findConnection( const QString & N ); 106 NodeCollection * findConnection( const QString & N );
107 NodeCollection * getConnection( int nr );
102 Name2Connection_t & connections( void ) 108 Name2Connection_t & connections( void )
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp
index 298bdc9..141484c 100644
--- a/noncore/settings/networksettings2/networksettings2/system.cpp
+++ b/noncore/settings/networksettings2/networksettings2/system.cpp
@@ -15,2 +15,4 @@
15 15
16#include <opie2/oprocess.h>
17
16#include <qdir.h> 18#include <qdir.h>
@@ -52,8 +54,6 @@ System::~System( void ) {
52 54
53int System::runAsRoot( const QString & S ) { 55int System::runAsRoot( QStringList & S ) {
54 QString MyS = S;
55 char * usr = getenv("USER"); 56 char * usr = getenv("USER");
56 char ch;
57 57
58 if( S.isEmpty() ) { 58 if( S.count() == 0 ) {
59 // loophole to start shell 59 // loophole to start shell
@@ -63,48 +63,105 @@ int System::runAsRoot( const QString & S ) {
63 // unknown or non-root user -> use SUDO 63 // unknown or non-root user -> use SUDO
64 MyS.prepend( "sudo " ); 64 S.prepend( "sudo" );
65 } 65 }
66 66
67 Log(("Executing %s\n", MyS.latin1() )); 67 if( getenv( "NS2TESTMODE" ) ) {
68 68 owarn << "TESTMODE !!! execute "
69 emit lineFromCommand( tr("Command : ") + MyS ); 69 << S.join( " ")
70 emit lineFromCommand( "---------------" ); 70 << oendl;
71 Log(( "Command : %s\n", MyS.latin1() ) ); 71 } else {
72 MyS += " 2>&1 "; 72 MyProcess * P = new MyProcess();
73 OutputOfCmd = popen( MyS.latin1(), "r" ) ; 73 emit processEvent( tr("Command : ") + S.join( " " ) );
74 if( ! OutputOfCmd ) { 74
75 // cannot fork 75 P->process() << S;
76 return 1; 76
77 connect( P,
78 SIGNAL( stdoutLine( const QString & ) ),
79 this,
80 SIGNAL( stdoutLine( const QString & ) ) );
81
82 connect( P,
83 SIGNAL( stderrLine( const QString & ) ),
84 this,
85 SIGNAL( stderrLine( const QString & ) ) );
86
87 connect( P,
88 SIGNAL(processExited(MyProcess*) ),
89 this, SLOT
90 (SLOT_ProcessExited(MyProcess*) ) );
91
92 Log(("Executing %s\n", S.join( " " ).latin1() ));
93
94 if( ! P->process().start( OProcess::DontCare,
95 OProcess::AllOutput ) ) {
96 owarn << "Error starting " << S << oendl;
97 delete P;
98 // error starting app
99 return 1;
100 }
101 owarn << "Started " << S << oendl;
77 } 102 }
78 103
79 // read all data 104 // all is fine
80 QString Line = ""; 105 return 0;
81 while( 1 ) { 106}
82 if( fread( &ch, 1, 1, OutputOfCmd ) < 1 ) 107
83 // eof 108int System::execAsUser( QStringList & SL ) {
84 break; 109 MyProcess * P = new MyProcess();
85 if( ch == '\n' || ch == '\r' ) { 110 CurrentQPEUser CU = NSResources->currentUser();
86 if( ! Line.isEmpty() ) { 111 char * usr = getenv("USER");
87 Log(( "read cmd output : **%s**\n", Line.latin1() ) ); 112
88 emit lineFromCommand( Line ); 113 if( strcmp( usr, "root" ) == 0 ) {
89 Line = ""; 114 // find user running qpe
90 qApp->processEvents(); 115 if( CU.UserName.isEmpty() ) {
116 // if we come here, the exec was not successfull
117 Log(("User not known \n" ));
118 return 0;
91 } 119 }
92 } else {
93 Line += ch;
94 } 120 }
95 }
96 121
97 if( ! Line.isEmpty() ) { 122 // now we are ready to exec the requested command
98 emit lineFromCommand( Line ); 123 setuid( CU.Uid );
99 Log(( "read cmd output : **%s**\n", Line.latin1() ) ); 124 setgid( CU.Gid );
100 }
101 Log(( "End of command\n", Line.latin1() ) );
102 125
103 if( pclose( OutputOfCmd ) < 0 ) { 126 for( unsigned int i = 0 ; i < CU.EnvList.count() ; i ++ ) {
104 // error in command 127 QString X;
105 return 3; 128 QStringList SL;
106 } 129 X = CU.EnvList[i];
130 SL = QStringList::split( "=", X );
131 P->process().setEnvironment( SL[0], SL[1] );
132 }
107 133
108 // all is fine 134 P->process() << SL;
109 return 0; 135
136 emit processEvent( tr("Command : ") + SL.join( " " ) );
137
138 Log(("Executing as user %s : %s\n",
139 CU.UserName.latin1(),
140 SL.join( " " ).latin1() ));
141
142 int rv = ( P->process().start( OProcess::DontCare,
143 OProcess::NoCommunication ) );
144 delete P;
145
146 if( rv ) {
147 // if we come here, the exec was not successfull
148 Log(("Could not exec : %d\n", errno ));
149 }
150
151 return rv;
152}
153
154void System::SLOT_ProcessExited( MyProcess * P ) {
155 QString R;
156
157 for( QValueListConstIterator<QCString> it = P->process().args().begin();
158 it != P->process().args().end();
159 ++it ) {
160 R += (*it);
161 R += " ";
162 }
163
164 R += "Returned with " + QString().setNum( P->process().exitStatus() );
165 emit processEvent( R );
166 delete P;
110} 167}
@@ -200,4 +257,10 @@ void System::probeInterfaces( void ) {
200 sockfd = socket(PF_INET, SOCK_DGRAM, 0); 257 sockfd = socket(PF_INET, SOCK_DGRAM, 0);
201 if(sockfd == -1) 258 if(sockfd == -1) {
259 owarn << "Cannot open INET socket "
260 << errno
261 << " "
262 << strerror( errno )
263 << oendl;
202 return; 264 return;
265 }
203 266
@@ -207,4 +270,12 @@ void System::probeInterfaces( void ) {
207 if( ! ProcDevNet->open(IO_ReadOnly) ) { 270 if( ! ProcDevNet->open(IO_ReadOnly) ) {
271 owarn << "Cannot open "
272 << PROCNETDEV
273 << " "
274 << errno
275 << " "
276 << strerror( errno )
277 << oendl;
208 delete ProcDevNet; 278 delete ProcDevNet;
209 ProcDevNet =0; 279 ProcDevNet =0;
280 ::close( sockfd );
210 return; 281 return;
@@ -231,6 +302,6 @@ void System::probeInterfaces( void ) {
231 // new nic 302 // new nic
232 Log(("NEWNIC %s\n", NicName.latin1())); 303 Log(("New NIC found : %s\n", NicName.latin1()));
233 IFI = new InterfaceInfo; 304 IFI = new InterfaceInfo;
234 IFI->Name = line.left(loc); 305 IFI->Name = line.left(loc);
235 IFI->NetNode = 0; 306 IFI->Collection = 0;
236 ProbedInterfaces.insert( IFI->Name, IFI ); 307 ProbedInterfaces.insert( IFI->Name, IFI );
@@ -258,3 +329,3 @@ void System::probeInterfaces( void ) {
258 if( ioctl(sockfd, SIOCGIFHWADDR, &ifrs) >= 0 ) { 329 if( ioctl(sockfd, SIOCGIFHWADDR, &ifrs) >= 0 ) {
259 Log(("%s = %d\n", IFI->Name.latin1(), 330 Log(("Family for NIC %s : %d\n", IFI->Name.latin1(),
260 ifrs.ifr_hwaddr.sa_family )); 331 ifrs.ifr_hwaddr.sa_family ));
@@ -326,3 +397,3 @@ void System::probeInterfaces( void ) {
326 } else // else already probed before -> just update 397 } else // else already probed before -> just update
327 Log(("OLDNIC %s\n", NicName.latin1())); 398 Log(("Redetected NIC %s\n", NicName.latin1()));
328 399
@@ -356,31 +427,21 @@ void System::probeInterfaces( void ) {
356 } 427 }
357 Log(("NIC %s UP %d\n", NicName.latin1(), IFI->IsUp )); 428 Log(("NIC %s UP ? %d\n", NicName.latin1(), IFI->IsUp ));
358 } 429 }
359}
360
361void System::execAsUser( QString & Cmd, char * argv[] ) {
362 CurrentQPEUser CU = NSResources->currentUser();
363
364 if( CU.UserName.isEmpty() ) {
365 // if we come here, the exec was not successfull
366 Log(("User not known \n" ));
367 return;
368 }
369 430
370 // now we are ready to exec the requested command 431 ::close( sockfd );
371 setuid( CU.Uid ); 432}
372 setgid( CU.Gid );
373
374 char ** envp = (char **)alloca( sizeof( char *) *
375 (CU.EnvList.count()+1) );
376 433
377 for( unsigned int i = 0 ; i < CU.EnvList.count() ; i ++ ) { 434InterfaceInfo * System::findInterface( const QString & N ) {
378 *(envp+i) = CU.EnvList[i]; 435 InterfaceInfo * Run;
436 // has PAN connection UP interface ?
437 for( QDictIterator<InterfaceInfo> It(ProbedInterfaces);
438 It.current();
439 ++It ) {
440 Run = It.current();
441 if( N == Run->Name ) {
442 // this PAN connection is up
443 return Run;
444 }
379 } 445 }
380 envp[CU.EnvList.count()]=NULL; 446 return 0;
381
382 execve( Cmd.latin1(), argv, envp );
383
384 // if we come here, the exec was not successfull
385 Log(("Could not exec : %d\n", errno ));
386} 447}
@@ -396,10 +457,14 @@ void VLog( char * Format, ... ) {
396 if( logf == (FILE *)0 ) { 457 if( logf == (FILE *)0 ) {
397 if( getenv("NS2STDERR") ) { 458 QString S = getenv("NS2LOG");
459 if( S == "stderr" ) {
398 logf = stderr; 460 logf = stderr;
399 } else { 461 } else if( S.isEmpty() ) {
400 logf = fopen( "/tmp/ns2log", "a" ); 462 logf = fopen( "/tmp/ns2log", "a" );
463 } else {
464 logf = fopen( S, "a" );
401 } 465 }
466
402 if( ! logf ) { 467 if( ! logf ) {
403 fprintf( stderr, "Cannot open logfile /tmp/ns2log %d\n", 468 fprintf( stderr, "Cannot open logfile %s : %d\n",
404 errno ); 469 S.latin1(), errno );
405 logf = (FILE *)1; 470 logf = (FILE *)1;
@@ -410,3 +475,3 @@ void VLog( char * Format, ... ) {
410 475
411 if( (long)logf > 1 ) { 476 if( (unsigned long)logf > 1 ) {
412 vfprintf( logf, Format, l ); 477 vfprintf( logf, Format, l );
@@ -414,2 +479,3 @@ void VLog( char * Format, ... ) {
414 va_end( l ); 479 va_end( l );
480 fflush( logf );
415 481
@@ -428,6 +494,80 @@ void LogClose( void ) {
428QString removeSpaces( const QString & X ) { 494QString removeSpaces( const QString & X ) {
429 QStringList SL; 495 QString Y;
496 Y = X.simplifyWhiteSpace();
497 Y.replace( QRegExp(" "), "_" );
498 owarn << X << " **" << Y << "**" << oendl;
499 return Y;
500}
501
502//
503//
504//
505//
506//
507
508MyProcess::MyProcess() : QObject(), StdoutBuffer(), StderrBuffer() {
509 P = new OProcess();
510 connect( P,
511 SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int ) ),
512 this,
513 SLOT( SLOT_Stdout(Opie::Core::OProcess*,char*,int) ) );
514
515 connect( P,
516 SIGNAL( receivedStderr(Opie::Core::OProcess*, char*, int ) ),
517 this,
518 SLOT( SLOT_Stderr(Opie::Core::OProcess*,char*,int) ) );
519 connect( P,
520 SIGNAL( processExited(Opie::Core::OProcess*) ),
521 this,
522 SLOT( SLOT_ProcessExited(Opie::Core::OProcess*) ) );
523}
524
525MyProcess::~MyProcess() {
526 delete P;
527}
528
529void MyProcess::SLOT_Stdout( Opie::Core::OProcess * , char * Buf, int len ) {
530 char * LB = (char *)alloca( len + 1 );
531 memcpy( LB, Buf, len );
532 LB[len] = '\0';
533
534 // now input is zero terminated
535 StdoutBuffer += LB;
536
537 owarn << "Received " << len << " bytes on stdout" << oendl;
538 // see if we have some lines (allow empty lines)
539 QStringList SL = QStringList::split( "\n", StdoutBuffer, TRUE );
540
541 for( unsigned int i = 0; i < SL.count()-1; i ++ ) {
542 Log(( "Stdout : \"%s\"\n", SL[i].latin1() ) );
543 emit stdoutLine( SL[i] );
544 }
545
546 // last line is rest
547 StdoutBuffer = SL[ SL.count()-1 ];
548}
549
550void MyProcess::SLOT_Stderr( Opie::Core::OProcess * , char * Buf, int len ) {
551 char * LB = (char *)alloca( len + 1 );
552 memcpy( LB, Buf, len );
553 LB[len] = '\0';
554
555 // now input is zero terminated
556 StderrBuffer += LB;
557
558 owarn << "Received " << len << " bytes on stderr" << oendl;
559 // see if we have some lines (allow empty lines)
560 QStringList SL = QStringList::split( "\n", StderrBuffer, TRUE );
561
562 for( unsigned int i = 0; i < SL.count()-1; i ++ ) {
563 Log(( "Stderr : \"%s\"\n", SL[i].latin1() ) );
564 emit stderrLine( SL[i] );
565 }
566
567 // last line is rest
568 StderrBuffer = SL[ SL.count()-1 ];
569}
430 570
431 SL = QStringList::split( " ", X ); 571void MyProcess::SLOT_ProcessExited( Opie::Core::OProcess * ) {
432 return SL.join( "_" ); 572 emit processExited( this );
433} 573}
diff --git a/noncore/settings/networksettings2/networksettings2/system.h b/noncore/settings/networksettings2/networksettings2/system.h
index 33af391..e67d695 100644
--- a/noncore/settings/networksettings2/networksettings2/system.h
+++ b/noncore/settings/networksettings2/networksettings2/system.h
@@ -3,2 +3,8 @@
3 3
4#include <qstring.h>
5
6#include <opie2/oprocess.h>
7
8using namespace Opie::Core;
9
4// for hardware types 10// for hardware types
@@ -9,2 +15,3 @@
9 15
16class NodeCollection;
10class ANetNodeInstance; 17class ANetNodeInstance;
@@ -12,2 +19,33 @@ class QFile;
12 19
20class MyProcess : public QObject {
21
22 Q_OBJECT
23
24public :
25
26 MyProcess();
27 ~MyProcess();
28
29 inline OProcess & process()
30 { return *P; }
31
32public slots :
33
34 void SLOT_Stdout( Opie::Core::OProcess * P, char *, int );
35 void SLOT_Stderr( Opie::Core::OProcess * P, char *, int );
36 void SLOT_ProcessExited( Opie::Core::OProcess * P);
37
38signals :
39
40 void stdoutLine( const QString & );
41 void stderrLine( const QString & );
42 void processExited( MyProcess * );
43
44private :
45
46 QString StdoutBuffer;
47 QString StderrBuffer;
48 OProcess * P;
49};
50
13class InterfaceInfo { 51class InterfaceInfo {
@@ -24,9 +62,9 @@ public :
24 62
25 ANetNodeInstance * assignedNode() 63 NodeCollection * assignedConnection()
26 { return NetNode; } 64 { return Collection; }
27 65
28 void assignNode( ANetNodeInstance * NNI ) 66 void assignConnection( NodeCollection * NNI )
29 { NetNode = NNI; } 67 { Collection = NNI; }
30 68
31 ANetNodeInstance * NetNode; // netnode taking care of me 69 NodeCollection * Collection; // connection taking care of me
32 QString Name; // name of interface 70 QString Name; // name of interface
@@ -66,6 +104,6 @@ public :
66 // exec command as root 104 // exec command as root
67 int runAsRoot( const QString & S ); 105 int runAsRoot( QStringList & S );
68 106
69 // exec command as user 107 // exec command as user
70 void execAsUser( QString & Cmd, char * argv[] ); 108 int execAsUser( QStringList & Cmd );
71 109
@@ -77,5 +115,13 @@ public :
77 115
116 InterfaceInfo * findInterface( const QString & DevName );
117
118private slots :
119
120 void SLOT_ProcessExited( MyProcess * );
121
78signals : 122signals :
79 123
80 void lineFromCommand( const QString & S ); 124 void stdoutLine( const QString & );
125 void stderrLine( const QString & );
126 void processEvent( const QString & );
81 127
@@ -86,3 +132,2 @@ private :
86 QFile * ProcDevNet; 132 QFile * ProcDevNet;
87
88}; 133};
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
index 2b40834..82fd43a 100644
--- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
@@ -18,2 +18,3 @@ SystemFile::SystemFile( const QString & N,
18 Path = P; 18 Path = P;
19 InAppend = 0;
19 F = 0; 20 F = 0;
@@ -65,5 +66,18 @@ SystemFile::SystemFile( const QString & N,
65 66
67SystemFile::SystemFile( const QString & N, bool KDI ){
68 Name = N;
69 Path = "";
70 InAppend = 0;
71 F =0;
72 KnowsDeviceInstances = KDI;
73 hasPreSection =
74 hasPostSection =
75 hasPreNodeSection =
76 hasPostNodeSection =
77 hasPreDeviceSection =
78 hasPostDeviceSection = 0;
79}
80
66SystemFile::~SystemFile( void ) { 81SystemFile::~SystemFile( void ) {
67 if( F ) 82 close();
68 delete F;
69} 83}
@@ -71,10 +85,32 @@ SystemFile::~SystemFile( void ) {
71bool SystemFile::open( void ) { 85bool SystemFile::open( void ) {
72 if( F ) { 86 QString Prefix = getenv( "NS2OUTPUTTO" );
73 F->close(); 87
74 delete F; 88 if( Prefix != "stderr" /* && Name != "interfaces" */ ) {
75 } 89 // generate files where the need to be
90 if( F ) {
91 F->close();
92 delete F;
93 }
76 94
77 F = new QFile( Path + "bup" ); 95 F = new QFile( Prefix + Path + ((InAppend)?"":"bup") );
78 if( ! F->open( IO_WriteOnly ) ) { 96 Log(( "Open systemfile %s\n", F->name().latin1() ));
79 return 0; 97 if( ! F->open( ((InAppend)?IO_Append : 0 ) | IO_WriteOnly ) ) {
98 return 0;
99 }
100 } else {
101 if( ! F ) {
102 owarn << "!!!!!!!!!!!!!!!!!! " << oendl;
103 owarn << "!!!! TESTMODE !!!!" << oendl;
104 owarn << "!!!!!!!!!!!!!!!!!! " << oendl;
105 owarn << "!!!!" << oendl;
106 owarn << "!!!! GENERATE " << Path << oendl;
107 if( InAppend ) {
108 owarn << "!!!! In APPEND mode" << oendl;
109 }
110 owarn << "!!!!" << oendl;
111 owarn << "!!!!!!!!!!!!!!!!!!" << oendl;
112
113 F = new QFile();
114 F->open( IO_WriteOnly, stderr );
115 }
80 } 116 }
@@ -85,3 +121,3 @@ bool SystemFile::open( void ) {
85bool SystemFile::close( void ) { 121bool SystemFile::close( void ) {
86 if( ! F ) { 122 if( ! F || ! F->isOpen() ) {
87 return 1 ; 123 return 1 ;
@@ -89,3 +125,9 @@ bool SystemFile::close( void ) {
89 125
90 QString OldP = Path + "bup"; 126 QString Prefix = getenv( "NS2OUTPUTTO" );
127
128 if( Prefix == "stderr" ) {
129 return 1;
130 }
131
132 QString OldP = Prefix + Path + "bup";
91 133
@@ -95,3 +137,7 @@ bool SystemFile::close( void ) {
95 137
96 return ( rename( OldP.latin1(), Path.latin1() ) >= 0 ); 138 if( ! InAppend ) {
139 owarn << "Rename " << OldP << " to " << Path << oendl;
140 return ( rename( OldP.latin1(), Path.latin1() ) >= 0 );
141 }
142 return 1;
97} 143}
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.h b/noncore/settings/networksettings2/networksettings2/systemfile.h
index ceed605..a950c4d 100644
--- a/noncore/settings/networksettings2/networksettings2/systemfile.h
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.h
@@ -16,8 +16,16 @@ public :
16 bool KnowsDevicesInstances ); 16 bool KnowsDevicesInstances );
17 SystemFile( const QString & Name,
18 bool KnowsDevicesInstances = 0 );
17 ~SystemFile( void ); 19 ~SystemFile( void );
18 20
21 void setName( const QString & S )
22 { Name = S; }
19 const QString & name( void ) const 23 const QString & name( void ) const
20 { return Name; } 24 { return Name; }
25
26 void setPath( const QString & S )
27 { Path = S; }
21 const QString & path( void ) const 28 const QString & path( void ) const
22 { return Path; } 29 { return Path; }
30
23 bool knowsDeviceInstances( void ) const 31 bool knowsDeviceInstances( void ) const
@@ -25,2 +33,4 @@ public :
25 33
34 void setAppendMode( bool A)
35 { InAppend = A; };
26 bool open( void ); 36 bool open( void );
@@ -47,2 +57,3 @@ private :
47 bool KnowsDeviceInstances; 57 bool KnowsDeviceInstances;
58 bool InAppend;
48 59
diff --git a/noncore/settings/networksettings2/networksettingsGUI.ui b/noncore/settings/networksettings2/networksettingsGUI.ui
index 6ed29f3..1085e08 100644
--- a/noncore/settings/networksettings2/networksettingsGUI.ui
+++ b/noncore/settings/networksettings2/networksettingsGUI.ui
@@ -13,4 +13,4 @@
13 <y>0</y> 13 <y>0</y>
14 <width>144</width> 14 <width>383</width>
15 <height>260</height> 15 <height>359</height>
16 </rect> 16 </rect>
@@ -70,3 +70,3 @@
70 <name>spacing</name> 70 <name>spacing</name>
71 <number>1</number> 71 <number>0</number>
72 </property> 72 </property>
@@ -169,10 +169,3 @@
169 <name>name</name> 169 <name>name</name>
170 <cstring>Enable_TB</cstring> 170 <cstring>Disable_TB</cstring>
171 </property>
172 <property stdset="1">
173 <name>sizePolicy</name>
174 <sizepolicy>
175 <hsizetype>0</hsizetype>
176 <vsizetype>0</vsizetype>
177 </sizepolicy>
178 </property> 171 </property>
@@ -195,10 +188,3 @@
195 <name>name</name> 188 <name>name</name>
196 <cstring>On_TB</cstring> 189 <cstring>Down_TB</cstring>
197 </property>
198 <property stdset="1">
199 <name>sizePolicy</name>
200 <sizepolicy>
201 <hsizetype>0</hsizetype>
202 <vsizetype>0</vsizetype>
203 </sizepolicy>
204 </property> 190 </property>
@@ -210,3 +196,3 @@
210 <name>toggleButton</name> 196 <name>toggleButton</name>
211 <bool>true</bool> 197 <bool>false</bool>
212 </property> 198 </property>
@@ -214,3 +200,3 @@
214 <name>toggleButton</name> 200 <name>toggleButton</name>
215 <bool>true</bool> 201 <bool>false</bool>
216 </property> 202 </property>
@@ -218,25 +204,14 @@
218 <widget> 204 <widget>
219 <class>QToolButton</class> 205 <class>QFrame</class>
220 <property stdset="1"> 206 <property stdset="1">
221 <name>name</name> 207 <name>name</name>
222 <cstring>Connect_TB</cstring> 208 <cstring>LED_Frm</cstring>
223 </property> 209 </property>
224 <property stdset="1"> 210 <property stdset="1">
225 <name>sizePolicy</name> 211 <name>frameShape</name>
226 <sizepolicy> 212 <enum>NoFrame</enum>
227 <hsizetype>0</hsizetype>
228 <vsizetype>0</vsizetype>
229 </sizepolicy>
230 </property>
231 <property stdset="1">
232 <name>text</name>
233 <string>...</string>
234 </property>
235 <property stdset="1">
236 <name>toggleButton</name>
237 <bool>true</bool>
238 </property> 213 </property>
239 <property stdset="1"> 214 <property stdset="1">
240 <name>toggleButton</name> 215 <name>frameShadow</name>
241 <bool>true</bool> 216 <enum>Raised</enum>
242 </property> 217 </property>
@@ -247,10 +222,3 @@
247 <name>name</name> 222 <name>name</name>
248 <cstring>Disconnect_TB</cstring> 223 <cstring>Up_TB</cstring>
249 </property>
250 <property stdset="1">
251 <name>sizePolicy</name>
252 <sizepolicy>
253 <hsizetype>0</hsizetype>
254 <vsizetype>0</vsizetype>
255 </sizepolicy>
256 </property> 224 </property>
@@ -262,3 +230,3 @@
262 <name>toggleButton</name> 230 <name>toggleButton</name>
263 <bool>true</bool> 231 <bool>false</bool>
264 </property> 232 </property>
@@ -266,3 +234,3 @@
266 <name>toggleButton</name> 234 <name>toggleButton</name>
267 <bool>true</bool> 235 <bool>false</bool>
268 </property> 236 </property>
@@ -481,8 +449,2 @@
481 <connection> 449 <connection>
482 <sender>Add_TB</sender>
483 <signal>clicked()</signal>
484 <receiver>NetworkSettingsGUI</receiver>
485 <slot>SLOT_AddNode()</slot>
486 </connection>
487 <connection>
488 <sender>Delete_TB</sender> 450 <sender>Delete_TB</sender>
@@ -499,20 +461,2 @@
499 <connection> 461 <connection>
500 <sender>Enable_TB</sender>
501 <signal>clicked()</signal>
502 <receiver>NetworkSettingsGUI</receiver>
503 <slot>SLOT_Enable()</slot>
504 </connection>
505 <connection>
506 <sender>Connect_TB</sender>
507 <signal>clicked()</signal>
508 <receiver>NetworkSettingsGUI</receiver>
509 <slot>SLOT_Connect()</slot>
510 </connection>
511 <connection>
512 <sender>On_TB</sender>
513 <signal>clicked()</signal>
514 <receiver>NetworkSettingsGUI</receiver>
515 <slot>SLOT_On()</slot>
516 </connection>
517 <connection>
518 <sender>GenConfig_TB</sender> 462 <sender>GenConfig_TB</sender>
@@ -553,6 +497,24 @@
553 <connection> 497 <connection>
554 <sender>Disconnect_TB</sender> 498 <sender>Add_TB</sender>
499 <signal>clicked()</signal>
500 <receiver>NetworkSettingsGUI</receiver>
501 <slot>SLOT_AddNode()</slot>
502 </connection>
503 <connection>
504 <sender>Disable_TB</sender>
505 <signal>toggled(bool)</signal>
506 <receiver>NetworkSettingsGUI</receiver>
507 <slot>SLOT_Disable(bool)</slot>
508 </connection>
509 <connection>
510 <sender>Down_TB</sender>
511 <signal>clicked()</signal>
512 <receiver>NetworkSettingsGUI</receiver>
513 <slot>SLOT_Down()</slot>
514 </connection>
515 <connection>
516 <sender>Up_TB</sender>
555 <signal>clicked()</signal> 517 <signal>clicked()</signal>
556 <receiver>NetworkSettingsGUI</receiver> 518 <receiver>NetworkSettingsGUI</receiver>
557 <slot>SLOT_Disconnect()</slot> 519 <slot>SLOT_Up()</slot>
558 </connection> 520 </connection>
@@ -560,8 +522,7 @@
560 <slot access="public">SLOT_CheckState()</slot> 522 <slot access="public">SLOT_CheckState()</slot>
561 <slot access="public">SLOT_Connect()</slot>
562 <slot access="public">SLOT_DeleteNode()</slot> 523 <slot access="public">SLOT_DeleteNode()</slot>
524 <slot access="public">SLOT_Disable(bool)</slot>
563 <slot access="public">SLOT_EditNode( QListBoxItem *)</slot> 525 <slot access="public">SLOT_EditNode( QListBoxItem *)</slot>
564 <slot access="public">SLOT_Enable()</slot>
565 <slot access="public">SLOT_GenerateConfig()</slot> 526 <slot access="public">SLOT_GenerateConfig()</slot>
566 <slot access="public">SLOT_On()</slot> 527 <slot access="public">SLOT_SetState(int)</slot>
567 <slot access="public">SLOT_ShowNode( QListBoxItem*)</slot> 528 <slot access="public">SLOT_ShowNode( QListBoxItem*)</slot>
@@ -569,3 +530,4 @@
569 <slot access="public">SLOT_ToProfile()</slot> 530 <slot access="public">SLOT_ToProfile()</slot>
570 <slot access="public">SLOT_Disconnect()</slot> 531 <slot access="public">SLOT_Up()</slot>
532 <slot access="public">SLOT_Down()</slot>
571</connections> 533</connections>
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp
index e2dd5b5..698a941 100644
--- a/noncore/settings/networksettings2/nsdata.cpp
+++ b/noncore/settings/networksettings2/nsdata.cpp
@@ -1,2 +1,3 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <opie2/odebug.h>
2#include <qpe/qpeapplication.h> 3#include <qpe/qpeapplication.h>
@@ -8,3 +9,3 @@
8#include "nsdata.h" 9#include "nsdata.h"
9#include <asdevice.h> 10#include <netnode.h>
10#include <resources.h> 11#include <resources.h>
@@ -29,4 +30,42 @@ NetworkSettingsData::NetworkSettingsData( void ) {
29 // load settings 30 // load settings
30 IsModified = 0;
31 loadSettings(); 31 loadSettings();
32
33 // assign interfaces by scanning /tmp/profile-%s.Up files
34 { QDir D( "/tmp" );
35 QFile * F = new QFile;
36 int profilenr;
37 QString interfacename;
38 QTextStream TS ( F );
39
40 QStringList SL = D.entryList( "profile-*.up");
41
42 Log(( "System reports %d interfaces. Found %d up\n",
43 NSResources->system().interfaces().count(),
44 SL.count() ));
45
46 for ( QStringList::Iterator it = SL.begin();
47 it != SL.end();
48 ++it ) {
49 profilenr = atol( (*it).mid( 8 ).latin1() );
50 // read the interface store int 'up'
51 F->setName( D.path() + "/" + (*it) );
52 if( F->open( IO_ReadOnly ) ) {
53 NodeCollection * NC;
54 interfacename = TS.readLine();
55 F->close();
56
57 Log(( "Assign interface %s to Profile nr %d\n",
58 interfacename.latin1(), profilenr ));
59
60 NC = NSResources->getConnection( profilenr );
61 if( NC ) {
62 NC->assignInterface(
63 NSResources->system().findInterface( interfacename ) );
64 } else {
65 Log(( "Profile nr %d no longer defined\n",
66 profilenr ));
67 }
68 }
69 }
70 }
32} 71}
@@ -46,2 +85,4 @@ void NetworkSettingsData::loadSettings( void ) {
46 85
86 ForceModified = 0;
87
47 do { 88 do {
@@ -87,3 +128,2 @@ void NetworkSettingsData::loadSettings( void ) {
87 NN = NSResources->findNetNode( S ); 128 NN = NSResources->findNetNode( S );
88 Log( ( "Node %s : %p\n", S.latin1(), NN ) );
89 } else { 129 } else {
@@ -91,3 +131,2 @@ void NetworkSettingsData::loadSettings( void ) {
91 NNI = NSResources->createNodeInstance( S ); 131 NNI = NSResources->createNodeInstance( S );
92 Log( ( "NodeInstance %s : %p\n", S.latin1(), NNI ));
93 } 132 }
@@ -140,2 +179,3 @@ void NetworkSettingsData::loadSettings( void ) {
140 // loading from file -> exists 179 // loading from file -> exists
180 Log( ( "NodeInstance %s : %p\n", NNI->name(), NNI ));
141 NNI->setNew( FALSE ); 181 NNI->setNew( FALSE );
@@ -143,2 +183,5 @@ void NetworkSettingsData::loadSettings( void ) {
143 } 183 }
184 if( NN ) {
185 Log( ( "Node %s : %p\n", NN->name(), NN ) );
186 }
144 } 187 }
@@ -222,3 +265,9 @@ QString NetworkSettingsData::saveSettings( void ) {
222 265
223 setModified( 0 ); 266
267 for( QDictIterator<NodeCollection> it(NSResources->connections());
268 it.current();
269 ++it ) {
270 it.current()->setModified( 0 );
271 }
272
224 return ErrS; 273 return ErrS;
@@ -233,4 +282,3 @@ QString NetworkSettingsData::generateSettings( void ) {
233 ANetNodeInstance * FirstWithData; 282 ANetNodeInstance * FirstWithData;
234 SystemFile * SF; 283 RuntimeInfo * CurDev;
235 AsDevice * CurDev;
236 ANetNode * NN, * CurDevNN = 0; 284 ANetNode * NN, * CurDevNN = 0;
@@ -243,32 +291,66 @@ QString NetworkSettingsData::generateSettings( void ) {
243 291
244 // 292 for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
245 // generate files proper to each netnodeinstance 293 nnit.current();
246 // 294 ++nnit ) {
247 { Name2Instance_t & NNIs = NSResources->netNodeInstances(); 295 { QStringList SL;
248 296 bool FirstItem = 1;
249 for( QDictIterator<ANetNodeInstance> NNIIt(NNIs); 297 bool Generated = 0;
250 NNIIt.current(); 298
251 ++NNIIt ) { 299 CurDevNN = nnit.current()->NetNode;
252 // for all nodes find those that are modified 300 SL = CurDevNN->properFiles();
253 NNI = NNIIt.current(); 301
254 302 for ( QStringList::Iterator it = SL.begin();
255 { // get list of proper files for this nodeclass (if any) 303 it != SL.end();
256 QStringList * PF = NNI->nodeClass()->properFiles(); 304 ++it ) {
257 305
258 if( PF ) { 306 Generated = 0;
259 for ( QStringList::Iterator it = PF->begin(); 307 FirstItem = 1;
260 it != PF->end(); 308 // iterate over NNI's of this class
261 ++it ) { 309 for( QDictIterator<ANetNodeInstance> nniit(
262 QFile * F = NNI->openFile( (*it) ); 310 NSResources->netNodeInstances() );
263 if( F ) { 311 nniit.current();
264 QTextStream TS( F ); 312 ++nniit ) {
265 if( NNI->generateFile( (*it), F->name(), TS, -1 ) == 2 ) { 313 if( nniit.current()->nodeClass() != CurDevNN )
266 // problem generating 314 // different class
315 continue;
316
317 // open proper file
318 { SystemFile SF( (*it) );
319
320 if( ! CurDevNN->openFile( SF, nniit.current()) ) {
321 // cannot open
322 S = qApp->translate( "NetworkSettings",
323 "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ).
324 arg( (*it) ).arg( CurDevNN->name() );
325 return S;
326 }
327
328 if( ! SF.open() ) {
329 S = qApp->translate( "NetworkSettings",
330 "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ).
331 arg( (*it) ).arg( CurDevNN->name() );
332 return S;
333 }
334
335 // preamble on first
336 if( FirstItem ) {
337 if( CurDevNN->generatePreamble( SF ) == 2 ) {
267 S = qApp->translate( "NetworkSettings", 338 S = qApp->translate( "NetworkSettings",
268 "<p>Cannot generate files proper to \"%1\"</p>" ). 339 "<p>Error in section \"preamble\" for proper file \"%1\" and node \"%2\"</p>" ).
269 arg(NNI->nodeClass()->name()) ; 340 arg( (*it) ).
270 delete F; 341 arg( CurDevNN->name() );
271 return S; 342 return S;
272 } 343 }
273 delete F; 344 }
345 FirstItem = 0;
346 Generated = 1;
347
348 // item specific
349 if( nniit.current()->generateFile( SF, -1 ) == 2 ) {
350 S = qApp->translate( "NetworkSettings",
351 "<p>Error in section for node \"%1\" for proper file \"%2\" and node class \"%3\"</p>" ).
352 arg( nniit.current()->name() ).
353 arg( (*it) ).
354 arg( CurDevNN->name() );
355 return S;
274 } 356 }
@@ -276,2 +358,26 @@ QString NetworkSettingsData::generateSettings( void ) {
276 } 358 }
359
360 if( Generated ) {
361 SystemFile SF( (*it) );
362
363 if( CurDevNN->openFile( SF, 0 ) &&
364 ! SF.path().isEmpty()
365 ) {
366
367 if( ! SF.open() ) {
368 S = qApp->translate( "NetworkSettings",
369 "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ).
370 arg( (*it) ).arg( CurDevNN->name() );
371 return S;
372 }
373
374 if( CurDevNN->generatePostamble( SF ) == 2 ) {
375 S = qApp->translate( "NetworkSettings",
376 "<p>Error in section \"postamble\" for proper file \"%1\" and node \"%2\"</p>" ).
377 arg( (*it) ).
378 arg( CurDevNN->name() );
379 return S;
380 }
381 } // no postamble
382 }
277 } 383 }
@@ -281,3 +387,3 @@ QString NetworkSettingsData::generateSettings( void ) {
281 // 387 //
282 // generate all system files 388 // generate all registered files
283 // 389 //
@@ -286,2 +392,4 @@ QString NetworkSettingsData::generateSettings( void ) {
286 ++sfit ) { 392 ++sfit ) {
393 SystemFile * SF;
394
287 SF = sfit.current(); 395 SF = sfit.current();
@@ -308,3 +416,3 @@ QString NetworkSettingsData::generateSettings( void ) {
308 416
309 Log( ( "Generating %s\n", SF->name().latin1() )); 417 Log( ( "Generating system file %s\n", SF->name().latin1() ));
310 418
@@ -320,3 +428,3 @@ QString NetworkSettingsData::generateSettings( void ) {
320 428
321 if( NN->hasDataForFile( SF->name() ) ) { 429 if( NN->hasDataForFile( *SF ) ) {
322 // netnode can have data 430 // netnode can have data
@@ -347,3 +455,8 @@ QString NetworkSettingsData::generateSettings( void ) {
347 // ok generate this system file 455 // ok generate this system file
348 SF->open(); 456 if( ! SF->open() ) {
457 S = qApp->translate( "NetworkSettings",
458 "<p>Cannot open system file \"%1\"</p>" ).
459 arg( SF->name() );
460 return S;
461 }
349 462
@@ -369,3 +482,3 @@ QString NetworkSettingsData::generateSettings( void ) {
369 482
370 if( ! NC->hasDataForFile( SF->name() ) ) { 483 if( ! NC->hasDataForFile( *SF ) ) {
371 // no data 484 // no data
@@ -377,3 +490,3 @@ QString NetworkSettingsData::generateSettings( void ) {
377 // find highest item that wants to write data to this file 490 // find highest item that wants to write data to this file
378 FirstWithData = NC->firstWithDataForFile( SF->name() ); 491 FirstWithData = NC->firstWithDataForFile( *SF );
379 492
@@ -384,6 +497,2 @@ QString NetworkSettingsData::generateSettings( void ) {
384 497
385 Log(( "%s is done %d\n",
386 FirstWithData->nodeClass()->name(),
387 FirstWithData->nodeClass()->done() ));
388
389 if( ! FirstWithData->nodeClass()->done() ) { 498 if( ! FirstWithData->nodeClass()->done() ) {
@@ -398,3 +507,5 @@ QString NetworkSettingsData::generateSettings( void ) {
398 if( FirstWithData->nodeClass()->generateFile( 507 if( FirstWithData->nodeClass()->generateFile(
399 SF->name(), SF->path(), *SF, -1 ) == 2 ) { 508 *SF,
509 FirstWithData,
510 -2 ) == 2 ) {
400 S = qApp->translate( "NetworkSettings", 511 S = qApp->translate( "NetworkSettings",
@@ -406,2 +517,5 @@ QString NetworkSettingsData::generateSettings( void ) {
406 FirstWithData->nodeClass()->setDone( 1 ); 517 FirstWithData->nodeClass()->setDone( 1 );
518 Log(( "Systemfile %s for node instance %s is done\n",
519 SF->name().latin1(),
520 FirstWithData->name() ));
407 } 521 }
@@ -416,6 +530,2 @@ QString NetworkSettingsData::generateSettings( void ) {
416 530
417 Log(( "Node %s is done %d\n",
418 CurDev->netNode()->nodeClass()->name(),
419 CurDev->netNode()->nodeClass()->done() ));
420
421 if( ! CurDev->netNode()->nodeClass()->done() ) { 531 if( ! CurDev->netNode()->nodeClass()->done() ) {
@@ -426,3 +536,3 @@ QString NetworkSettingsData::generateSettings( void ) {
426 if( FirstWithData->nodeClass()->generateFile( 536 if( FirstWithData->nodeClass()->generateFile(
427 SF->name(), SF->path(), *SF, CurDev->netNode(), i ) == 2 ) { 537 *SF, CurDev->netNode(), i ) == 2 ) {
428 S = qApp->translate( "NetworkSettings", 538 S = qApp->translate( "NetworkSettings",
@@ -435,2 +545,7 @@ QString NetworkSettingsData::generateSettings( void ) {
435 CurDev->netNode()->nodeClass()->setDone( 1 ); 545 CurDev->netNode()->nodeClass()->setDone( 1 );
546
547 Log(( "Systemfile %s for Nodeclass %s is done\n",
548 SF->name().latin1(),
549 CurDev->netNode()->nodeClass()->name()
550 ));
436 } 551 }
@@ -448,5 +563,7 @@ QString NetworkSettingsData::generateSettings( void ) {
448 563
449 Log(("Connection %s of same family\n", ncit2.current()->name().latin1() )); 564 Log(("Connection %s of family %s\n",
565 ncit2.current()->name().latin1(),
566 CurDev->name() ));
450 // generate 567 // generate
451 NNI = ncit2.current()->firstWithDataForFile( SF->name() ); 568 NNI = ncit2.current()->firstWithDataForFile( *SF );
452 for( int i = DevCtStart; i < NoOfDevs ; i ++ ) { 569 for( int i = DevCtStart; i < NoOfDevs ; i ++ ) {
@@ -460,4 +577,3 @@ QString NetworkSettingsData::generateSettings( void ) {
460 577
461 switch( NNI->generateFile( 578 switch( NNI->generateFile( *SF, i ) ) {
462 SF->name(), SF->path(), *SF, i ) ) {
463 case 0 : 579 case 0 :
@@ -571,5 +687,10 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
571 // try to UP the device 687 // try to UP the device
572 if( ! NC->setState( Activate ) ) { 688 { QString S= NC->setState( Activate );
573 // cannot bring device Online -> try other alters 689 if( ! S.isEmpty() ) {
574 break; 690 // could not bring device Online -> try other alters
691 Log(( "%s-c%d-disallowed : %s\n",
692 Interface, NC->number(), S.latin1() ));
693 break;
694 }
695 // interface assigned
575 } 696 }
@@ -591,11 +712,12 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
591 712
592/* 713bool NetworkSettingsData::isModified( void ) {
593 Called by the system to regenerate config files 714 if( ForceModified )
594*/
595
596bool NetworkSettingsData::regenerate( void ) {
597 QString S = generateSettings();
598 if( ! S.isEmpty() ) {
599 fprintf( stdout, "%s\n", S.latin1() );
600 return 1; 715 return 1;
716
717 for( QDictIterator<NodeCollection> it(NSResources->connections());
718 it.current();
719 ++it ) {
720 if( it.current()->isModified() ) {
721 return 1;
722 }
601 } 723 }
diff --git a/noncore/settings/networksettings2/nsdata.h b/noncore/settings/networksettings2/nsdata.h
index 507185e..a0ae7d1 100644
--- a/noncore/settings/networksettings2/nsdata.h
+++ b/noncore/settings/networksettings2/nsdata.h
@@ -3,3 +3,3 @@
3 3
4#include "netnode.h" 4#include <netnode.h>
5 5
@@ -17,6 +17,5 @@ public :
17 17
18 bool isModified( void ) 18 bool isModified( void );
19 { return IsModified; } 19 inline void setModified( bool M )
20 void setModified( bool m ) 20 { ForceModified = M; }
21 { IsModified = m; }
22 21
@@ -25,3 +24,2 @@ public :
25 bool canStart( const char * Interface ); 24 bool canStart( const char * Interface );
26 bool regenerate( void );
27 25
@@ -29,3 +27,3 @@ private :
29 27
30 bool IsModified; 28 bool ForceModified;
31 29
@@ -33,3 +31,2 @@ private :
33 QStringList LeftOvers; 31 QStringList LeftOvers;
34
35}; 32};
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
index 450d560..9403694 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
@@ -39,3 +39,3 @@ QString PPPAuthEdit::acceptable( void ) {
39 39
40bool PPPAuthEdit::commit( PPPData_t & D ) { 40bool PPPAuthEdit::commit( PPPData & D ) {
41 bool SM = 0; 41 bool SM = 0;
@@ -72,3 +72,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
72 72
73void PPPAuthEdit::showData( PPPData_t & D ) { 73void PPPAuthEdit::showData( PPPData & D ) {
74 74
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.h b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
index 2392569..7a06657 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
@@ -9,4 +9,4 @@ public :
9 QString acceptable( void ); 9 QString acceptable( void );
10 bool commit( PPPData_t & Data ); 10 bool commit( PPPData & Data );
11 void showData( PPPData_t & Data ); 11 void showData( PPPData & Data );
12 bool PAP_Checked( void ); 12 bool PAP_Checked( void );
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp b/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
index 22f8e59..270f695 100644
--- a/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
@@ -25,3 +25,3 @@ QString PPPDNSEdit::acceptable( void ) {
25 25
26bool PPPDNSEdit::commit( PPPData_t & D ) { 26bool PPPDNSEdit::commit( PPPData & D ) {
27 bool SM = 0; 27 bool SM = 0;
@@ -77,3 +77,3 @@ bool PPPDNSEdit::commit( PPPData_t & D ) {
77 77
78void PPPDNSEdit::showData( PPPData_t & D) { 78void PPPDNSEdit::showData( PPPData & D) {
79 79
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSedit.h b/noncore/settings/networksettings2/ppp/PPPDNSedit.h
index 43e0067..1ca8c21 100644
--- a/noncore/settings/networksettings2/ppp/PPPDNSedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPDNSedit.h
@@ -9,4 +9,4 @@ public :
9 QString acceptable( void ); 9 QString acceptable( void );
10 bool commit( PPPData_t & Data ); 10 bool commit( PPPData & Data );
11 void showData( PPPData_t & Data ); 11 void showData( PPPData & Data );
12 12
diff --git a/noncore/settings/networksettings2/ppp/PPPGUI.ui b/noncore/settings/networksettings2/ppp/PPPGUI.ui
index 777e4a9..4c79fe3 100644
--- a/noncore/settings/networksettings2/ppp/PPPGUI.ui
+++ b/noncore/settings/networksettings2/ppp/PPPGUI.ui
@@ -13,4 +13,4 @@
13 <y>0</y> 13 <y>0</y>
14 <width>124</width> 14 <width>528</width>
15 <height>29</height> 15 <height>345</height>
16 </rect> 16 </rect>
@@ -30,3 +30,3 @@
30 <name>margin</name> 30 <name>margin</name>
31 <number>2</number> 31 <number>0</number>
32 </property> 32 </property>
@@ -56,2 +56,14 @@
56 </item> 56 </item>
57 <item>
58 <property>
59 <name>text</name>
60 <string>Commands</string>
61 </property>
62 </item>
63 <item>
64 <property>
65 <name>text</name>
66 <string>Dialing</string>
67 </property>
68 </item>
57 <property stdset="1"> 69 <property stdset="1">
@@ -78,3 +90,3 @@
78 </sizehint> 90 </sizehint>
79 <container>0</container> 91 <container>1</container>
80 <sizepolicy> 92 <sizepolicy>
diff --git a/noncore/settings/networksettings2/ppp/PPPIPGUI.ui b/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
index f3d5019..21bd29e 100644
--- a/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
+++ b/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
@@ -13,4 +13,4 @@
13 <y>0</y> 13 <y>0</y>
14 <width>133</width> 14 <width>258</width>
15 <height>235</height> 15 <height>232</height>
16 </rect> 16 </rect>
@@ -30,3 +30,3 @@
30 <name>margin</name> 30 <name>margin</name>
31 <number>3</number> 31 <number>0</number>
32 </property> 32 </property>
@@ -34,13 +34,9 @@
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>2</number> 35 <number>1</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QButtonGroup</class> 38 <class>QGroupBox</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>ButtonGroup4</cstring> 41 <cstring>GroupBox1</cstring>
42 </property>
43 <property stdset="1">
44 <name>frameShape</name>
45 <enum>Box</enum>
46 </property> 42 </property>
@@ -56,6 +52,6 @@
56 </property> 52 </property>
57 <vbox> 53 <grid>
58 <property stdset="1"> 54 <property stdset="1">
59 <name>margin</name> 55 <name>margin</name>
60 <number>2</number> 56 <number>3</number>
61 </property> 57 </property>
@@ -65,7 +61,11 @@
65 </property> 61 </property>
66 <widget> 62 <widget row="0" column="0" >
67 <class>QRadioButton</class> 63 <class>QLabel</class>
68 <property stdset="1"> 64 <property stdset="1">
69 <name>name</name> 65 <name>name</name>
70 <cstring>IPServerAssigned_RB</cstring> 66 <cstring>TextLabel1</cstring>
67 </property>
68 <property stdset="1">
69 <name>enabled</name>
70 <bool>true</bool>
71 </property> 71 </property>
@@ -73,6 +73,13 @@
73 <name>text</name> 73 <name>text</name>
74 <string>Server assigned</string> 74 <string>Local</string>
75 </property> 75 </property>
76 </widget>
77 <widget row="0" column="1" >
78 <class>QLineEdit</class>
76 <property stdset="1"> 79 <property stdset="1">
77 <name>checked</name> 80 <name>name</name>
81 <cstring>LocalAddress_LE</cstring>
82 </property>
83 <property stdset="1">
84 <name>enabled</name>
78 <bool>true</bool> 85 <bool>true</bool>
@@ -80,7 +87,7 @@
80 </widget> 87 </widget>
81 <widget> 88 <widget row="0" column="2" >
82 <class>QRadioButton</class> 89 <class>QCheckBox</class>
83 <property stdset="1"> 90 <property stdset="1">
84 <name>name</name> 91 <name>name</name>
85 <cstring>IPFixed_RB</cstring> 92 <cstring>ServerOverrulesLocal_CB</cstring>
86 </property> 93 </property>
@@ -88,128 +95,43 @@
88 <name>text</name> 95 <name>text</name>
89 <string>Fixed</string> 96 <string>Server Overrules</string>
90 </property> 97 </property>
91 </widget> 98 </widget>
92 <widget> 99 <widget row="1" column="1" >
93 <class>QLayoutWidget</class> 100 <class>QLineEdit</class>
94 <property stdset="1"> 101 <property stdset="1">
95 <name>name</name> 102 <name>name</name>
96 <cstring>Layout11</cstring> 103 <cstring>RemoteAddress_LE</cstring>
104 </property>
105 <property stdset="1">
106 <name>enabled</name>
107 <bool>true</bool>
97 </property> 108 </property>
98 <hbox>
99 <property stdset="1">
100 <name>margin</name>
101 <number>0</number>
102 </property>
103 <property stdset="1">
104 <name>spacing</name>
105 <number>6</number>
106 </property>
107 <spacer>
108 <property>
109 <name>name</name>
110 <cstring>Spacer8</cstring>
111 </property>
112 <property stdset="1">
113 <name>orientation</name>
114 <enum>Horizontal</enum>
115 </property>
116 <property stdset="1">
117 <name>sizeType</name>
118 <enum>Fixed</enum>
119 </property>
120 <property>
121 <name>sizeHint</name>
122 <size>
123 <width>20</width>
124 <height>20</height>
125 </size>
126 </property>
127 <property>
128 <name>layoutMargin</name>
129 </property>
130 <property>
131 <name>layoutSpacing</name>
132 </property>
133 </spacer>
134 <widget>
135 <class>QFrame</class>
136 <property stdset="1">
137 <name>name</name>
138 <cstring>Frame8</cstring>
139 </property>
140 <property stdset="1">
141 <name>enabled</name>
142 <bool>false</bool>
143 </property>
144 <property stdset="1">
145 <name>sizePolicy</name>
146 <sizepolicy>
147 <hsizetype>7</hsizetype>
148 <vsizetype>5</vsizetype>
149 </sizepolicy>
150 </property>
151 <property stdset="1">
152 <name>frameShape</name>
153 <enum>NoFrame</enum>
154 </property>
155 <property stdset="1">
156 <name>frameShadow</name>
157 <enum>Raised</enum>
158 </property>
159 <property>
160 <name>layoutMargin</name>
161 </property>
162 <property>
163 <name>layoutSpacing</name>
164 </property>
165 <grid>
166 <property stdset="1">
167 <name>margin</name>
168 <number>2</number>
169 </property>
170 <property stdset="1">
171 <name>spacing</name>
172 <number>2</number>
173 </property>
174 <widget row="0" column="1" >
175 <class>QLineEdit</class>
176 <property stdset="1">
177 <name>name</name>
178 <cstring>IPAddress_LE</cstring>
179 </property>
180 </widget>
181 <widget row="1" column="0" >
182 <class>QLabel</class>
183 <property stdset="1">
184 <name>name</name>
185 <cstring>TextLabel3</cstring>
186 </property>
187 <property stdset="1">
188 <name>text</name>
189 <string>Subnetmask</string>
190 </property>
191 </widget>
192 <widget row="0" column="0" >
193 <class>QLabel</class>
194 <property stdset="1">
195 <name>name</name>
196 <cstring>TextLabel2</cstring>
197 </property>
198 <property stdset="1">
199 <name>text</name>
200 <string>Address</string>
201 </property>
202 </widget>
203 <widget row="1" column="1" >
204 <class>QLineEdit</class>
205 <property stdset="1">
206 <name>name</name>
207 <cstring>IPSubMask_LE</cstring>
208 </property>
209 </widget>
210 </grid>
211 </widget>
212 </hbox>
213 </widget> 109 </widget>
214 </vbox> 110 <widget row="1" column="2" >
111 <class>QCheckBox</class>
112 <property stdset="1">
113 <name>name</name>
114 <cstring>ServerOverrulesRemote_CB</cstring>
115 </property>
116 <property stdset="1">
117 <name>text</name>
118 <string>Server Overrules</string>
119 </property>
120 </widget>
121 <widget row="1" column="0" >
122 <class>QLabel</class>
123 <property stdset="1">
124 <name>name</name>
125 <cstring>TextLabel1_2</cstring>
126 </property>
127 <property stdset="1">
128 <name>enabled</name>
129 <bool>true</bool>
130 </property>
131 <property stdset="1">
132 <name>text</name>
133 <string>Remote</string>
134 </property>
135 </widget>
136 </grid>
215 </widget> 137 </widget>
@@ -222,2 +144,9 @@
222 <property stdset="1"> 144 <property stdset="1">
145 <name>sizePolicy</name>
146 <sizepolicy>
147 <hsizetype>5</hsizetype>
148 <vsizetype>1</vsizetype>
149 </sizepolicy>
150 </property>
151 <property stdset="1">
223 <name>title</name> 152 <name>title</name>
@@ -234,3 +163,3 @@
234 <name>margin</name> 163 <name>margin</name>
235 <number>2</number> 164 <number>3</number>
236 </property> 165 </property>
@@ -380,3 +309,3 @@
380 <name>name</name> 309 <name>name</name>
381 <cstring>Layout3</cstring> 310 <cstring>Layout4</cstring>
382 </property> 311 </property>
@@ -391,2 +320,13 @@
391 </property> 320 </property>
321 <widget>
322 <class>QCheckBox</class>
323 <property stdset="1">
324 <name>name</name>
325 <cstring>GWIsDefault_CB</cstring>
326 </property>
327 <property stdset="1">
328 <name>text</name>
329 <string>Set as default</string>
330 </property>
331 </widget>
392 <spacer> 332 <spacer>
@@ -416,3 +356,3 @@
416 <name>name</name> 356 <name>name</name>
417 <cstring>GWIsDefault_CB</cstring> 357 <cstring>GWIfNotSet_CB</cstring>
418 </property> 358 </property>
@@ -420,3 +360,3 @@
420 <name>text</name> 360 <name>text</name>
421 <string>Set as default</string> 361 <string>Only if not yet set</string>
422 </property> 362 </property>
@@ -427,2 +367,23 @@
427 </widget> 367 </widget>
368 <spacer>
369 <property>
370 <name>name</name>
371 <cstring>Spacer4</cstring>
372 </property>
373 <property stdset="1">
374 <name>orientation</name>
375 <enum>Vertical</enum>
376 </property>
377 <property stdset="1">
378 <name>sizeType</name>
379 <enum>Expanding</enum>
380 </property>
381 <property>
382 <name>sizeHint</name>
383 <size>
384 <width>20</width>
385 <height>20</height>
386 </size>
387 </property>
388 </spacer>
428 </vbox> 389 </vbox>
@@ -436,8 +397,2 @@
436 </connection> 397 </connection>
437 <connection>
438 <sender>IPFixed_RB</sender>
439 <signal>toggled(bool)</signal>
440 <receiver>Frame8</receiver>
441 <slot>setEnabled(bool)</slot>
442 </connection>
443</connections> 398</connections>
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.cpp b/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
index 6965e5a..ef1b7c0 100644
--- a/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
@@ -11,12 +11,3 @@ PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){
11QString PPPIPEdit::acceptable( void ) { 11QString PPPIPEdit::acceptable( void ) {
12 if( IPFixed_RB->isChecked() ) { 12 if( GWFixed_RB->isChecked() ) {
13 if( IPAddress_LE->text().isEmpty() )
14 return tr("IPAddress needed" );
15 if( ! validIP( IPAddress_LE->text() ) )
16 return tr("IPAddress not valid" );
17 if( IPSubMask_LE->text().isEmpty() )
18 return tr("Subnet mask needed" );
19 if( ! validIP( IPSubMask_LE->text() ) )
20 return tr("Subnet mask not valid" );
21 } else if( GWFixed_RB->isChecked() ) {
22 if( GWAddress_LE->text().isEmpty() ) 13 if( GWAddress_LE->text().isEmpty() )
@@ -30,3 +21,3 @@ QString PPPIPEdit::acceptable( void ) {
30 21
31bool PPPIPEdit::commit( PPPData_t & D ) { 22bool PPPIPEdit::commit( PPPData & D ) {
32 23
@@ -34,9 +25,10 @@ bool PPPIPEdit::commit( PPPData_t & D ) {
34 25
35 CBM( D.IP.IPAutomatic, IPServerAssigned_RB, SM ); 26 CBM( D.IP.LocalOverrule, ServerOverrulesLocal_CB, SM );
36 if( ! D.IP.IPAutomatic ) { 27 CBM( D.IP.RemoteOverrule, ServerOverrulesRemote_CB, SM );
37 TXTM( D.IP.IPAddress, IPAddress_LE, SM ); 28
38 TXTM( D.IP.IPSubMask, IPSubMask_LE, SM ); 29 TXTM( D.IP.LocalAddress, LocalAddress_LE, SM );
39 } 30 TXTM( D.IP.RemoteAddress, RemoteAddress_LE, SM );
40 31
41 CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM ); 32 CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM );
33
42 if( ! D.IP.GWAutomatic ) { 34 if( ! D.IP.GWAutomatic ) {
@@ -46,2 +38,4 @@ bool PPPIPEdit::commit( PPPData_t & D ) {
46 CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM ); 38 CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM );
39 CBM( D.IP.GWIfNotSet, GWIfNotSet_CB, SM );
40
47 return SM; 41 return SM;
@@ -49,6 +43,8 @@ bool PPPIPEdit::commit( PPPData_t & D ) {
49 43
50void PPPIPEdit::showData( PPPData_t & D ) { 44void PPPIPEdit::showData( PPPData & D ) {
51 IPServerAssigned_RB->setChecked( D.IP.IPAutomatic ); 45 ServerOverrulesLocal_CB->setChecked( D.IP.LocalOverrule );
52 IPAddress_LE->setText( D.IP.IPAddress ); 46 ServerOverrulesRemote_CB->setChecked( D.IP.RemoteOverrule );
53 IPSubMask_LE->setText( D.IP.IPSubMask ); 47 LocalAddress_LE->setText( D.IP.LocalAddress );
48 RemoteAddress_LE->setText( D.IP.RemoteAddress );
49
54 GWServerAssigned_RB->setChecked( D.IP.GWAutomatic ); 50 GWServerAssigned_RB->setChecked( D.IP.GWAutomatic );
@@ -56,2 +52,3 @@ void PPPIPEdit::showData( PPPData_t & D ) {
56 GWIsDefault_CB->setChecked( D.IP.GWIsDefault ); 52 GWIsDefault_CB->setChecked( D.IP.GWIsDefault );
53 GWIfNotSet_CB->setChecked( D.IP.GWIfNotSet );
57} 54}
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.h b/noncore/settings/networksettings2/ppp/PPPIPedit.h
index 153ee68..5ca4326 100644
--- a/noncore/settings/networksettings2/ppp/PPPIPedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPIPedit.h
@@ -9,4 +9,4 @@ public :
9 QString acceptable( void ); 9 QString acceptable( void );
10 bool commit( PPPData_t & Data ); 10 bool commit( PPPData & Data );
11 void showData( PPPData_t & Data ); 11 void showData( PPPData & Data );
12 12
diff --git a/noncore/settings/networksettings2/ppp/PPPedit.cpp b/noncore/settings/networksettings2/ppp/PPPedit.cpp
index eb4fdbf..17889aa 100644
--- a/noncore/settings/networksettings2/ppp/PPPedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPedit.cpp
@@ -5,2 +5,4 @@
5#include "PPPAuthedit.h" 5#include "PPPAuthedit.h"
6#include "PPPRunedit.h"
7#include "PPPDialingedit.h"
6#include "PPPedit.h" 8#include "PPPedit.h"
@@ -12,2 +14,5 @@ PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){
12 DNS = new PPPDNSEdit( Options_WS ); 14 DNS = new PPPDNSEdit( Options_WS );
15 Run = new PPPRunEdit( Options_WS );
16 Dialing = new PPPDialingEdit( Options_WS );
17
13 Options_WS->addWidget( Auth, 0 ); 18 Options_WS->addWidget( Auth, 0 );
@@ -15,2 +20,4 @@ PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){
15 Options_WS->addWidget( DNS, 2 ); 20 Options_WS->addWidget( DNS, 2 );
21 Options_WS->addWidget( Run, 3 );
22 Options_WS->addWidget( Dialing, 4 );
16 23
@@ -31,3 +38,3 @@ QString PPPEdit::acceptable( void ) {
31 38
32bool PPPEdit::commit( PPPData_t & Data ) { 39bool PPPEdit::commit( PPPData & Data ) {
33 bool SM ; 40 bool SM ;
@@ -39,3 +46,3 @@ bool PPPEdit::commit( PPPData_t & Data ) {
39 46
40void PPPEdit::showData( PPPData_t & Data ) { 47void PPPEdit::showData( PPPData & Data ) {
41 Auth->showData( Data ) ; 48 Auth->showData( Data ) ;
diff --git a/noncore/settings/networksettings2/ppp/PPPedit.h b/noncore/settings/networksettings2/ppp/PPPedit.h
index 57d38ee..f674b17 100644
--- a/noncore/settings/networksettings2/ppp/PPPedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPedit.h
@@ -6,2 +6,4 @@ class PPPIPEdit;
6class PPPDNSEdit; 6class PPPDNSEdit;
7class PPPRunEdit;
8class PPPDialingEdit;
7 9
@@ -13,4 +15,4 @@ public :
13 QString acceptable( void ); 15 QString acceptable( void );
14 bool commit( PPPData_t & Data ); 16 bool commit( PPPData & Data );
15 void showData( PPPData_t & Data ); 17 void showData( PPPData & Data );
16 18
@@ -22,5 +24,7 @@ private :
22 24
23 PPPAuthEdit * Auth; 25 PPPAuthEdit * Auth;
24 PPPDNSEdit * DNS; 26 PPPDNSEdit * DNS;
25 PPPIPEdit * IP; 27 PPPIPEdit * IP;
28 PPPRunEdit * Run;
29 PPPDialingEdit * Dialing;
26 30
diff --git a/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control b/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control
index 7dfde38..19d1c89 100644
--- a/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control
+++ b/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-ppp 1Package: opie-networksettings2plugin-ppp
2Files: plugins/networksettings2/libppp.so* 2Files: plugins/networksettings2/libppp.so*
diff --git a/noncore/settings/networksettings2/ppp/ppp.pro b/noncore/settings/networksettings2/ppp/ppp.pro
index f866bee..dd3408c 100644
--- a/noncore/settings/networksettings2/ppp/ppp.pro
+++ b/noncore/settings/networksettings2/ppp/ppp.pro
@@ -8,2 +8,4 @@ HEADERS = ppp_NN.h \
8 PPPDNSedit.h \ 8 PPPDNSedit.h \
9 PPPRunedit.h \
10 PPPDialingedit.h \
9 PPPIPedit.h 11 PPPIPedit.h
@@ -13,2 +15,4 @@ SOURCES = ppp_NN.cpp \
13 PPPDNSedit.cpp \ 15 PPPDNSedit.cpp \
16 PPPRunedit.cpp \
17 PPPDialingedit.cpp \
14 PPPAuthedit.cpp \ 18 PPPAuthedit.cpp \
@@ -19,3 +23,8 @@ DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
19LIBS += -lqpe 23LIBS += -lqpe
20 INTERFACES= PPPGUI.ui PPPAuthGUI.ui PPPIPGUI.ui PPPDNSGUI.ui 24 INTERFACES= PPPGUI.ui \
25 PPPAuthGUI.ui \
26 PPPIPGUI.ui \
27 PPPDNSGUI.ui \
28 PPPDialingGUI.ui \
29 PPPRunGUI.ui
21 TARGET = ppp 30 TARGET = ppp
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index ff4465c..51ba27d 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -1,2 +1,3 @@
1#include <qfile.h> 1#include <qfile.h>
2#include <resources.h>
2#include <qtextstream.h> 3#include <qtextstream.h>
@@ -8,4 +9,8 @@ QStringList * PPPNetNode::ProperFiles = 0;
8static const char * PPPNeeds[] = 9static const char * PPPNeeds[] =
9 { "line", 10 { "modem",
10 "modem", 11 0
12 };
13
14static const char * PPPProvides[] =
15 { "connection",
11 0 16 0
@@ -18,12 +23,6 @@ PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) {
18 23
19 // proper files : will leak
20 ProperFiles =new QStringList;
21 *ProperFiles << "peers";
22 *ProperFiles << "chatscript";
23
24 // system files
25 NSResources->addSystemFile( 24 NSResources->addSystemFile(
26 "pap-secrets", "/tmp/pap-secrets", 0 ); 25 "pap-secrets", "/etc/ppp/pap-secrets", 0 );
27 NSResources->addSystemFile( 26 NSResources->addSystemFile(
28 "chap-secrets", "/tmp/chap-secrets", 0 ); 27 "chap-secrets", "/etc/ppp/chap-secrets", 0 );
29} 28}
@@ -52,9 +51,10 @@ const char ** PPPNetNode::needs( void ) {
52 51
53const char * PPPNetNode::provides( void ) { 52const char ** PPPNetNode::provides( void ) {
54 return "connection"; 53 return PPPProvides;
55} 54}
56 55
57QStringList * PPPNetNode::properFiles( void ) { 56QStringList PPPNetNode::properFiles( void ) {
58 return ProperFiles; 57 QStringList SL;
59 58 SL << "peers" << "chatscripts";
59 return SL;
60} 60}
@@ -64,5 +64,5 @@ QStringList * PPPNetNode::properFiles( void ) {
64// /etc/ppp/pap-secrets 64// /etc/ppp/pap-secrets
65bool PPPNetNode::hasDataForFile( const QString & S ) { 65bool PPPNetNode::hasDataForFile( SystemFile & S ) {
66 return S == "pap-secrets" || 66 return S.name() == "pap-secrets" ||
67 S == "chap-secrets" ; 67 S.name() == "chap-secrets" ;
68} 68}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h
index 249be5a..3ead10e 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.h
@@ -19,3 +19,3 @@ public:
19 19
20 virtual bool hasDataForFile( const QString & S ); 20 virtual bool hasDataForFile( SystemFile & S );
21 21
@@ -24,6 +24,6 @@ public:
24 virtual const char ** needs( void ); 24 virtual const char ** needs( void );
25 virtual const char * provides( void ); 25 virtual const char ** provides( void );
26 26
27 virtual QString genNic( long NicNr ); 27 virtual QString genNic( long NicNr );
28 virtual QStringList * properFiles( void ); 28 virtual QStringList properFiles( void );
29 29
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
index ba639de..9e3bb64 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
@@ -18,5 +18,7 @@ APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) {
18 18
19 Data.IP.IPAutomatic = 1; 19 Data.IP.LocalAddress = "10.0.0.1";
20 Data.IP.IPAddress = ""; 20 Data.IP.RemoteAddress = "10.0.0.2";
21 Data.IP.IPSubMask = ""; 21 Data.IP.LocalOverrule = 1;
22 Data.IP.RemoteOverrule = 1;
23
22 Data.IP.GWAutomatic = 1; 24 Data.IP.GWAutomatic = 1;
@@ -24,2 +26,9 @@ APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) {
24 Data.IP.GWIsDefault = 1; 26 Data.IP.GWIsDefault = 1;
27 Data.IP.GWIfNotSet = 1;
28
29 Data.Run.PreConnect = "";
30 Data.Run.PostConnect = "";
31 Data.Run.PreDisconnect = "";
32 Data.Run.PostDisconnect = "";
33
25 GUI = 0; 34 GUI = 0;
@@ -61,15 +70,29 @@ void APPP::setSpecificAttribute( QString & A, QString & V ) {
61 } else if( A.startsWith( "ip" ) ) { 70 } else if( A.startsWith( "ip" ) ) {
62 if( A == "ipautomatic" ) { 71 if( A == "iplocaloverrule" ) {
63 Data.IP.IPAutomatic = (V == "yes"); 72 Data.IP.LocalOverrule = (V == "yes");
64 } else if( A == "gwautomatic" ) { 73 } else if( A == "ipremoteoverrule" ) {
74 Data.IP.RemoteOverrule = (V == "yes");
75 } else if( A == "ipgwautomatic" ) {
65 Data.IP.GWAutomatic = (V == "yes"); 76 Data.IP.GWAutomatic = (V == "yes");
66 } else if( A == "gwisdefault" ) { 77 } else if( A == "ipgwisdefault" ) {
67 Data.IP.GWIsDefault = (V == "yes"); 78 Data.IP.GWIsDefault = (V == "yes");
68 } else if( A == "ipaddress" ) { 79 } else if( A == "ipgwifnotset" ) {
69 Data.IP.IPAddress = V; 80 Data.IP.GWIfNotSet = (V == "yes");
70 } else if( A == "ipsubmask" ) { 81 } else if( A == "iplocaladdress" ) {
71 Data.IP.IPSubMask = V; 82 Data.IP.LocalAddress = V;
72 } else if( A == "gwaddress" ) { 83 } else if( A == "ipremoteaddress" ) {
84 Data.IP.RemoteAddress = V;
85 } else if( A == "ipgwaddress" ) {
73 Data.IP.GWAddress = V; 86 Data.IP.GWAddress = V;
74 } 87 }
88 } else if( A.startsWith( "run" ) ) {
89 if( A == "runpreconnect" ) {
90 Data.Run.PreConnect = V;
91 } else if( A == "runpostconnect" ) {
92 Data.Run.PostConnect = V;
93 } else if( A == "runpredisconnect" ) {
94 Data.Run.PreDisconnect = V;
95 } else if( A == "runpostdisconnect" ) {
96 Data.Run.PostDisconnect = V;
97 }
75 } 98 }
@@ -93,8 +116,16 @@ void APPP::saveSpecificAttribute( QTextStream & TS ) {
93 TS << "authsecret=" << quote( Data.Auth.Secret ) << endl; 116 TS << "authsecret=" << quote( Data.Auth.Secret ) << endl;
94 TS << "ipautomatic=" << ( ( Data.IP.IPAutomatic ) ? "yes" : "no" ) << endl; 117 TS << "ipgwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl;
95 TS << "gwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl; 118 TS << "ipgwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl;
96 TS << "gwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl; 119 TS << "ipgwifnotset=" << ( ( Data.IP.GWIfNotSet ) ? "yes" : "no" ) << endl;
97 TS << "ipaddress=" << Data.IP.IPAddress << endl; 120 TS << "iplocaloverrule=" << ( ( Data.IP.LocalOverrule ) ? "yes" : "no" ) << endl;
98 TS << "ipsubmask=" << Data.IP.IPSubMask << endl; 121 TS << "ipremoteoverrule=" << ( ( Data.IP.RemoteOverrule ) ? "yes" : "no" ) << endl;
99 TS << "gwaddress=" << Data.IP.GWAddress << endl; 122 TS << "iplocaladdress=" << Data.IP.LocalAddress << endl;
123 TS << "ipremoteaddress=" << Data.IP.RemoteAddress << endl;
124 TS << "ipgwaddress=" << Data.IP.GWAddress << endl;
125
126 TS << "runpreconnect=" << Data.Run.PreConnect << endl;
127 TS << "runpostconnect=" << Data.Run.PostConnect << endl;
128 TS << "runpredisconnect=" << Data.Run.PreDisconnect << endl;
129 TS << "runpostdisconnect=" << Data.Run.PostDisconnect << endl;
130
100} 131}
@@ -117,35 +148,16 @@ void APPP::commit( void ) {
117 148
118QFile * APPP::openFile( const QString & ID ) { 149bool APPP::openFile( SystemFile & SF ) {
119 QFile * F = 0; 150 if( SF.name() == "peers" ) {
120 QString S; 151 SF.setPath( removeSpaces(
121 152 QString( "/tmp/ppp/peers/" ) + connection()->name() ) );
122 if( ID == "peers" ) { 153 return 1;
123 S = removeSpaces( QString("/tmp/") + connection()->name() ); 154 } else if ( SF.name() == "chatscripts" ) {
124 155 SF.setPath( removeSpaces(
125 F = new QFile( S ); 156 QString( "/tmp/chatscripts/" ) + connection()->name() ) );
126 157 return 1;
127 if( ! F->open( IO_WriteOnly ) ) {
128 Log(("Cannot open file %s\n", S.latin1() ));
129 return 0;
130 }
131 } else if ( ID == "chatscripts" ) {
132 S = removeSpaces( QString("/tmp/") + connection()->name() + ".chat" );
133 F = new QFile( S );
134
135 if( ! F->open( IO_WriteOnly ) ) {
136 Log(("Cannot open file %s\n", S.latin1() ));
137 return 0;
138 }
139 } 158 }
140 if( F ) { 159 return 0;
141 Log(("Generate proper file %s = %s\n",
142 ID.latin1(), F->name().latin1()));
143 }
144 return F;
145} 160}
146 161
147short APPP::generateFile( const QString & ID, 162short APPP::generateFile( SystemFile & SF, long DevNr ) {
148 const QString & Path,
149 QTextStream & TS,
150 long DevNr ) {
151 short rvl, rvd; 163 short rvl, rvd;
@@ -155,9 +167,10 @@ short APPP::generateFile( const QString & ID,
155 167
156 if( ID == "pap-secrets" ) { 168 if( SF.name() == "pap-secrets" ) {
157 Log(("Generate PPP for %s\n", ID.latin1() )); 169 Log(("Generate PPP for %s\n", SF.name().latin1() ));
170
158 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) { 171 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) {
159 TS << "# secrets for " 172 SF << "# secrets for "
160 << connection()->name().latin1() 173 << connection()->name().latin1()
161 << endl; 174 << endl;
162 TS << Data.Auth.Client 175 SF << Data.Auth.Client
163 << " " 176 << " "
@@ -169,12 +182,12 @@ short APPP::generateFile( const QString & ID,
169 rvd = connection()->getToplevel()->generateFileEmbedded( 182 rvd = connection()->getToplevel()->generateFileEmbedded(
170 ID, Path, TS, DevNr ); 183 SF, DevNr );
171 } 184 }
172 } else if( ID == "chap-secrets" ) { 185 } else if( SF.name() == "chap-secrets" ) {
173 Log(("Generate PPP for %s\n", ID.latin1() )); 186 Log(("Generate PPP for %s\n", SF.name().latin1() ));
174 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) { 187 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) {
175 // used for both EAP and Chap 188 // used for both EAP and Chap
176 TS << "# secrets for " 189 SF << "# secrets for "
177 << connection()->name().latin1() 190 << connection()->name().latin1()
178 << endl; 191 << endl;
179 TS << Data.Auth.Client 192 SF << Data.Auth.Client
180 << " " 193 << " "
@@ -187,11 +200,12 @@ short APPP::generateFile( const QString & ID,
187 rvd = connection()->getToplevel()->generateFileEmbedded( 200 rvd = connection()->getToplevel()->generateFileEmbedded(
188 ID, Path, TS, DevNr ); 201 SF, DevNr );
189 } 202 }
190 } else if ( ID == "peers" ) { 203 } else if ( SF.name() == "peers" ) {
191 QFileInfo FI(Path); 204
192 Log(("Generate PPP for %s\n", ID.latin1() )); 205 QFileInfo FI(SF.path());
206 Log(("Generate PPP for %s\n", SF.name().latin1() ));
193 207
194 TS << "connect \"/usr/sbin/chat -v -f /etc/ppp/" 208 SF << "connect \"/usr/sbin/chat -v -f /etc/chatscripts/"
195 << FI.baseName() 209 << FI.baseName()
196 << ".chat\"" 210 << "\""
197 << endl; 211 << endl;
@@ -199,3 +213,3 @@ short APPP::generateFile( const QString & ID,
199 if( Data.IP.GWIsDefault ) { 213 if( Data.IP.GWIsDefault ) {
200 TS << "defaultroute" 214 SF << "defaultroute"
201 << endl; 215 << endl;
@@ -203,4 +217,4 @@ short APPP::generateFile( const QString & ID,
203 217
204 TS << "linkname " 218 SF << "linkname "
205 << removeSpaces( ID.latin1() ) 219 << removeSpaces( SF.name().latin1() )
206 << endl; 220 << endl;
@@ -210,8 +224,8 @@ short APPP::generateFile( const QString & ID,
210 rvd = connection()->getToplevel()->generateFileEmbedded( 224 rvd = connection()->getToplevel()->generateFileEmbedded(
211 ID, Path, TS, DevNr ); 225 SF, DevNr );
212 } else if ( ID == "chatscripts" ) { 226 } else if ( SF.name() == "chatscripts" ) {
213 Log(("Generate PPP for %s\n", ID.latin1() )); 227 Log(("Generate PPP for %s\n", SF.name().latin1() ));
214 rvl = 0; 228 rvl = 0;
215 rvd = connection()->getToplevel()->generateFileEmbedded( 229 rvd = connection()->getToplevel()->generateFileEmbedded(
216 ID, Path, TS, DevNr ); 230 SF, DevNr );
217 } 231 }
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h
index 0bf8fa9..76afb21 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h
@@ -18,7 +18,3 @@ public :
18 RuntimeInfo * runtime( void ) 18 RuntimeInfo * runtime( void )
19 { if( RT == 0 ) { 19 { return (RT) ? RT : (RT = new PPPRun( this, Data ) ); }
20 RT = new PPPRun( this, Data );
21 }
22 return RT->runtimeInfo();
23 }
24 20
@@ -31,6 +27,4 @@ public :
31 27
32 virtual QFile * openFile( const QString & ID ); 28 virtual bool openFile( SystemFile & Sf );
33 short generateFile( const QString & ID, 29 short generateFile( SystemFile & TS,
34 const QString & Path,
35 QTextStream & TS,
36 long DevNr ); 30 long DevNr );
diff --git a/noncore/settings/networksettings2/ppp/pppdata.h b/noncore/settings/networksettings2/ppp/pppdata.h
index 9e8543c..68666f8 100644
--- a/noncore/settings/networksettings2/ppp/pppdata.h
+++ b/noncore/settings/networksettings2/ppp/pppdata.h
@@ -6,7 +6,11 @@
6 6
7typedef struct PPPData { 7class PPPData {
8
9public :
10
8 struct { 11 struct {
9 bool IPAutomatic; 12 bool LocalOverrule;
10 QString IPAddress; 13 bool RemoteOverrule;
11 QString IPSubMask; 14 QString LocalAddress;
15 QString RemoteAddress;
12 bool GWAutomatic; 16 bool GWAutomatic;
@@ -14,3 +18,5 @@ typedef struct PPPData {
14 bool GWIsDefault; 18 bool GWIsDefault;
19 bool GWIfNotSet;
15 } IP; 20 } IP;
21
16 struct { 22 struct {
@@ -35,3 +41,9 @@ typedef struct PPPData {
35 } DNS; 41 } DNS;
36} PPPData_t; 42 struct {
43 QString PreConnect;
44 QString PostConnect;
45 QString PreDisconnect;
46 QString PostDisconnect;
47 } Run;
48};
37 49
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp
index a8abc50..8403e6d 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.cpp
+++ b/noncore/settings/networksettings2/ppp/ppprun.cpp
@@ -4,49 +4,15 @@
4PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : 4PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) :
5 AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) { 5 RuntimeInfo( NNI ), Pat( "eth[0-9]" ) {
6 D = &Data; 6 D = &Data;
7} 7}
8 8
9void PPPRun::detectState( NodeCollection * NC ) { 9State_t PPPRun::detectState( void ) {
10 if( isMyPPPDRunning( ) ) { 10 if( isMyPPPDRunning( ) ) {
11 if( isMyPPPUp() ) { 11 return ( isMyPPPUp() ) ? IsUp : Available;
12 NC->setCurrentState( IsUp ); 12 }
13 } else { 13 return Off;
14 NC->setCurrentState( Available );
15 }
16 } else {
17 NC->setCurrentState( Off ); // at least this
18 // but could also be unavailable
19 AsDevice::netNode()->nextNode()->runtime()->detectState( NC );
20 }
21} 14}
22 15
23bool PPPRun::setState( NodeCollection * NC, Action_t A, bool ) { 16QString PPPRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
24 switch( A ) { 17 return QString();
25 case Activate :
26 NC->setCurrentState( Available );
27 // no
28 break;
29 case Deactivate :
30 if( NC->currentState() == IsUp ) {
31 NC->state( Down );
32 }
33 // cannot really disable
34 NC->setCurrentState( Available );
35 break;
36 case Up :
37 if( NC->currentState() != IsUp ) {
38 // start my PPPD
39 NC->setCurrentState( IsUp );
40 }
41 break;
42 case Down :
43 if( NC->currentState() == IsUp ) {
44 // stop my PPPD
45 NC->setCurrentState( Available );
46 }
47 break;
48 default : // FT
49 break;
50 }
51 return 1;
52} 18}
@@ -70,3 +36,3 @@ bool PPPRun::isMyPPPUp( void ) {
70 // this is a LAN card 36 // this is a LAN card
71 if( Run->assignedNode() == AsDevice::netNode() ) { 37 if( Run->assignedConnection() == netNode()->connection() ) {
72 // assigned to us 38 // assigned to us
@@ -82 +48,5 @@ bool PPPRun::handlesInterface( const QString & S ) {
82} 48}
49
50bool PPPRun::handlesInterface( InterfaceInfo * I ) {
51 return handlesInterface( I->Name );
52}
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h
index 90a3f25..2990a96 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.h
+++ b/noncore/settings/networksettings2/ppp/ppprun.h
@@ -4,7 +4,6 @@
4#include <qregexp.h> 4#include <qregexp.h>
5#include <asconnection.h> 5#include <netnode.h>
6#include <asdevice.h>
7#include "pppdata.h" 6#include "pppdata.h"
8 7
9class PPPRun : public AsConnection, public AsDevice { 8class PPPRun : public RuntimeInfo {
10 9
@@ -15,22 +14,14 @@ public :
15 14
16 virtual AsDevice * asDevice( void ) 15 bool handlesInterface( const QString & I );
17 { return (AsDevice *)this; } 16 bool handlesInterface( InterfaceInfo * );
18 virtual AsConnection * asConnection( void )
19 { return (AsConnection *)this; }
20
21 virtual AsDevice * device( void )
22 { return (AsDevice *)this; }
23 17
24 virtual RuntimeInfo * runtimeInfo( void ) 18 State_t detectState( void );
25 { return ( AsConnection *)this; } 19 virtual RuntimeInfo * device( void )
20 { return this; }
21 virtual RuntimeInfo * connection( void )
22 { return this; }
26 23
27 protected : 24protected :
28 25
29 void detectState( NodeCollection * NC ); 26 QString setMyState( NodeCollection * , Action_t, bool );
30 bool setState( NodeCollection * NC, Action_t A, bool );
31 bool canSetState( State_t S, Action_t A )
32 { return AsDevice::connection()->findNext(
33 AsDevice::netNode() )->runtime()->canSetState( S,A ); }
34
35 bool handlesInterface( const QString & I );
36 27
@@ -41,5 +32,4 @@ private :
41 32
42 PPPData_t * D; 33 PPPData * D;
43 QRegExp Pat; 34 QRegExp Pat;
44
45}; 35};
diff --git a/noncore/settings/networksettings2/profile/opie-networksettings2plugin-bluetooth.control b/noncore/settings/networksettings2/profile/opie-networksettings2plugin-bluetooth.control
index c76f9b8..40c8b48 100644
--- a/noncore/settings/networksettings2/profile/opie-networksettings2plugin-bluetooth.control
+++ b/noncore/settings/networksettings2/profile/opie-networksettings2plugin-bluetooth.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-profile 1Package: opie-networksettings2plugin-profile
2Files: plugins/networksettings2/libprofile.so* 2Files: plugins/networksettings2/libprofile.so*
@@ -7,3 +7,3 @@ Architecture: arm
7Depends: opie-networksettings2, libopiecore2, libopienet2 7Depends: opie-networksettings2, libopiecore2, libopienet2
8Description: Network settings profile plugin. 8Description: Network settings usage profile plugin.
9Version: $QPE_VERSION$EXTRAVERSION 9Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp
index 945b48d..b7d8aa0 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NN.cpp
@@ -1 +1,2 @@
1#include <resources.h>
1#include "profile_NN.h" 2#include "profile_NN.h"
@@ -7,2 +8,6 @@ static const char * ProfileNeeds[] =
7 }; 8 };
9static const char * ProfileProvides[] =
10 { "fullsetup",
11 0
12 };
8 13
@@ -12,2 +17,6 @@ static const char * ProfileNeeds[] =
12ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) { 17ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) {
18
19 NSResources->addSystemFile(
20 "interfaces", "/etc/network/interfaces", 1 );
21
13} 22}
@@ -36,4 +45,4 @@ const char ** ProfileNetNode::needs( void ) {
36 45
37const char * ProfileNetNode::provides( void ) { 46const char ** ProfileNetNode::provides( void ) {
38 return "fullsetup"; 47 return ProfileProvides;
39} 48}
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h
index 1f1ee2c..f1648f9 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.h
+++ b/noncore/settings/networksettings2/profile/profile_NN.h
@@ -22,3 +22,3 @@ public:
22 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
23 virtual const char * provides( void ); 23 virtual const char ** provides( void );
24 24
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.cpp b/noncore/settings/networksettings2/profile/profile_NNI.cpp
index f0f0b97..a1e1254 100644
--- a/noncore/settings/networksettings2/profile/profile_NNI.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NNI.cpp
@@ -1 +1,2 @@
1#include <opie2/odebug.h>
1#include "profileedit.h" 2#include "profileedit.h"
@@ -52,5 +53,3 @@ void AProfile::commit( void ) {
52 53
53short AProfile::generateFileEmbedded( const QString & ID, 54short AProfile::generateFileEmbedded( SystemFile & SF,
54 const QString & Path,
55 QTextStream & TS,
56 long DevNr ) { 55 long DevNr ) {
@@ -61,7 +60,7 @@ short AProfile::generateFileEmbedded( const QString & ID,
61 60
62 if( ID == "interfaces" ) { 61 if( SF.name() == "interfaces" ) {
63 Log(("Generate Profile for %s\n", ID.latin1() )); 62 Log(("Generate Profile for %s\n", SF.name().latin1() ));
64 if( Data.TriggerVPN ) { 63 if( Data.TriggerVPN ) {
65 // this profile triggers VPN -> insert trigger 64 // this profile triggers VPN -> insert trigger
66 TS << " up networksettings2 --triggervpn" 65 SF << " up networksettings2 --triggervpn"
67 << endl; 66 << endl;
@@ -70,3 +69,3 @@ short AProfile::generateFileEmbedded( const QString & ID,
70 } 69 }
71 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr ); 70 rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr );
72 return (rvd == 2 || rvl == 2 ) ? 2 : 71 return (rvd == 2 || rvl == 2 ) ? 2 :
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.h b/noncore/settings/networksettings2/profile/profile_NNI.h
index 957f4af..ccd746c 100644
--- a/noncore/settings/networksettings2/profile/profile_NNI.h
+++ b/noncore/settings/networksettings2/profile/profile_NNI.h
@@ -28,5 +28,3 @@ public :
28 28
29 virtual short generateFileEmbedded( const QString & ID, 29 virtual short generateFileEmbedded( SystemFile & TS,
30 const QString & Path,
31 QTextStream & TS,
32 long DevNr ); 30 long DevNr );
diff --git a/noncore/settings/networksettings2/profile/profiledata.h b/noncore/settings/networksettings2/profile/profiledata.h
index 246d50c..c9577e5 100644
--- a/noncore/settings/networksettings2/profile/profiledata.h
+++ b/noncore/settings/networksettings2/profile/profiledata.h
@@ -4,3 +4,4 @@
4#include <qstring.h> 4#include <qstring.h>
5typedef struct ProfileData { 5class ProfileData {
6public :
6 QString Description; 7 QString Description;
@@ -13,3 +14,3 @@ typedef struct ProfileData {
13 bool TriggerVPN; 14 bool TriggerVPN;
14} ProfileData_t; 15} ;
15 16
diff --git a/noncore/settings/networksettings2/profile/profileedit.cpp b/noncore/settings/networksettings2/profile/profileedit.cpp
index 87e503e..88aab15 100644
--- a/noncore/settings/networksettings2/profile/profileedit.cpp
+++ b/noncore/settings/networksettings2/profile/profileedit.cpp
@@ -7,3 +7,3 @@
7#include <GUIUtils.h> 7#include <GUIUtils.h>
8#include <asdevice.h> 8#include <netnode.h>
9#include <resources.h> 9#include <resources.h>
@@ -18,3 +18,3 @@ ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
18 Dev = NNI->runtime()->device(); 18 Dev = NNI->runtime()->device();
19 if( ( II = Dev->assignedInterface() ) ) { 19 if( ( II = NNI->connection()->assignedInterface() ) ) {
20 20
@@ -57,3 +57,3 @@ QString ProfileEdit::acceptable( void ) {
57 57
58void ProfileEdit::showData( ProfileData_t & Data ) { 58void ProfileEdit::showData( ProfileData & Data ) {
59 Description_LE->setText( Data.Description ); 59 Description_LE->setText( Data.Description );
@@ -66,3 +66,3 @@ void ProfileEdit::showData( ProfileData_t & Data ) {
66 66
67bool ProfileEdit::commit( ProfileData_t & Data ) { 67bool ProfileEdit::commit( ProfileData & Data ) {
68 bool SM = 0; 68 bool SM = 0;
@@ -79,3 +79,3 @@ bool ProfileEdit::commit( ProfileData_t & Data ) {
79void ProfileEdit::SLOT_Refresh( void ) { 79void ProfileEdit::SLOT_Refresh( void ) {
80 InterfaceInfo * II = Dev->assignedInterface(); 80 InterfaceInfo * II = NNI->connection()->assignedInterface();
81 NSResources->system().refreshStatistics( *II ); 81 NSResources->system().refreshStatistics( *II );
diff --git a/noncore/settings/networksettings2/profile/profileedit.h b/noncore/settings/networksettings2/profile/profileedit.h
index b186b58..9cde845 100644
--- a/noncore/settings/networksettings2/profile/profileedit.h
+++ b/noncore/settings/networksettings2/profile/profileedit.h
@@ -5,3 +5,3 @@
5class ANetNodeInstance; 5class ANetNodeInstance;
6class AsDevice; 6class RuntimeInfo;
7 7
@@ -15,4 +15,4 @@ public :
15 QString acceptable( void ); 15 QString acceptable( void );
16 bool commit( ProfileData_t & Data ); 16 bool commit( ProfileData & Data );
17 void showData( ProfileData_t & Data ); 17 void showData( ProfileData & Data );
18 18
@@ -27,3 +27,3 @@ private :
27 ANetNodeInstance * NNI; 27 ANetNodeInstance * NNI;
28 AsDevice * Dev; 28 RuntimeInfo * Dev;
29}; 29};
diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp
index 1a5b15b..ab57a00 100644
--- a/noncore/settings/networksettings2/profile/profilerun.cpp
+++ b/noncore/settings/networksettings2/profile/profilerun.cpp
@@ -4,64 +4,24 @@
4 4
5void ProfileRun::detectState( NodeCollection * NC ) { 5State_t ProfileRun::detectState( void ) {
6 if( Data->Disabled ) { 6 if( Data->Disabled ) {
7 Log(( "%s disabled\n", NC->name().latin1() )); 7 return Disabled;
8 NC->setCurrentState( Disabled ); 8 }
9 } else { 9 return Unknown;
10 Log(( "%s not disabled\n", NC->name().latin1() ));
11 // find next item in connection
12 // convert to runtime and ask to detect the state
13 netNode()->nextNode()->runtime()->detectState( NC );
14 }
15} 10}
16 11
17bool ProfileRun::setState( NodeCollection * NC, Action_t A, bool F ) { 12QString ProfileRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
18 ANetNodeInstance * NNNI; 13 owarn << "Profile " << Data->Disabled << oendl;
19 14 if( A == Disable ) {
20 NNNI = netNode()->nextNode(); 15 if( ! Data->Disabled ) {
21 switch ( A ) {
22 case Enable :
23 if( NC->currentState() == Disabled ) {
24 Data->Disabled = 0;
25 NC->setCurrentState( Off ); // at least
26 // ... but request deeper
27 NNNI->runtime()->detectState(NC);
28 }
29 return 1;
30 case Disable :
31 switch( NC->currentState() ) {
32 case IsUp :
33 case Available :
34 // bring Deactivate (will bring down)
35 if( ! NNNI->runtime()->setState(NC, Deactivate) )
36 return 0;
37 default :
38 break;
39 }
40 Data->Disabled = 1; 16 Data->Disabled = 1;
41 NC->setCurrentState( Disabled ); 17 NC->setModified( 1 );
42 return 1; 18 }
43 default : 19 } else if( A == Enable ) {
44 break; 20 if( Data->Disabled ) {
45 } 21 Data->Disabled = 0;
46 return NNNI->runtime()->setState(NC, A, F ); 22 NC->setModified( 1 );
47} 23 }
48
49bool ProfileRun::canSetState( State_t Curr, Action_t A ) {
50 RuntimeInfo * RI;
51 switch ( A ) {
52 case Enable :
53 case Disable :
54 // always possible
55 return 1;
56 default :
57 break;
58 } 24 }
59 RI = netNode()->nextNode()->runtime();
60 return ( Curr != Disabled ) ?
61 RI->canSetState(Curr, A) : 0;
62}
63 25
64bool ProfileRun::handlesInterface( const QString & S ) { 26 return QString();
65 // donno -> pass deeper
66 return netNode()->nextNode()->runtime()->handlesInterface(S);
67} 27}
diff --git a/noncore/settings/networksettings2/profile/profilerun.h b/noncore/settings/networksettings2/profile/profilerun.h
index 400b56c..2d48b15 100644
--- a/noncore/settings/networksettings2/profile/profilerun.h
+++ b/noncore/settings/networksettings2/profile/profilerun.h
@@ -3,6 +3,6 @@
3 3
4#include <asfullsetup.h> 4#include <netnode.h>
5#include "profiledata.h" 5#include "profiledata.h"
6 6
7class ProfileRun : public AsFullSetup { 7class ProfileRun : public RuntimeInfo {
8 8
@@ -11,17 +11,9 @@ public :
11 ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) : 11 ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) :
12 AsFullSetup( NNI ) 12 RuntimeInfo( NNI )
13 { Data = &D; } 13 { Data = &D; }
14 14
15 void detectState( NodeCollection * NC ); 15 virtual RuntimeInfo * fullSetup( void )
16 bool setState( NodeCollection * NC, Action_t A, bool ); 16 { return this; }
17 bool canSetState( State_t Curr, Action_t A );
18
19 bool handlesInterface( const QString & I );
20
21 virtual const QString & description( void ) 17 virtual const QString & description( void )
22 { return Data->Description; } 18 { return Data->Description; }
23
24 virtual AsFullSetup * asFullSetup( void )
25 { return (AsFullSetup *)this; }
26
27 virtual bool triggersVPN( void ) 19 virtual bool triggersVPN( void )
@@ -29,2 +21,8 @@ public :
29 21
22 State_t detectState( void );
23
24protected :
25
26 QString setMyState( NodeCollection * , Action_t, bool );
27
30private : 28private :
diff --git a/noncore/settings/networksettings2/usb/opie-networksettings2plugin-usb.control b/noncore/settings/networksettings2/usb/opie-networksettings2plugin-usb.control
index 8b8508c..ffb3012 100644
--- a/noncore/settings/networksettings2/usb/opie-networksettings2plugin-usb.control
+++ b/noncore/settings/networksettings2/usb/opie-networksettings2plugin-usb.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-usb 1Package: opie-networksettings2plugin-usb
2Files: plugins/networksettings2/libusb.so* 2Files: plugins/networksettings2/libusb.so*
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp
index 14c479a..bd9ae2b 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NN.cpp
@@ -1 +1,2 @@
1#include <resources.h>
1#include "usb_NN.h" 2#include "usb_NN.h"
@@ -7,2 +8,7 @@ static const char * USBNeeds[] =
7 8
9static const char * USBProvides[] =
10 { "device",
11 0
12 };
13
8/** 14/**
@@ -11,2 +17,4 @@ static const char * USBNeeds[] =
11USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { 17USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) {
18 NSResources->addSystemFile(
19 "interfaces", "/etc/network/interfaces", 1 );
12} 20}
@@ -35,4 +43,4 @@ const char ** USBNetNode::needs( void ) {
35 43
36const char * USBNetNode::provides( void ) { 44const char ** USBNetNode::provides( void ) {
37 return "device"; 45 return USBProvides;
38} 46}
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h
index 73da15a..b825cec 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.h
+++ b/noncore/settings/networksettings2/usb/usb_NN.h
@@ -22,3 +22,3 @@ public:
22 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
23 virtual const char * provides( void ); 23 virtual const char ** provides( void );
24 24
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.cpp b/noncore/settings/networksettings2/usb/usb_NNI.cpp
index 50c6e8d..600b771 100644
--- a/noncore/settings/networksettings2/usb/usb_NNI.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NNI.cpp
@@ -34,5 +34,3 @@ void AUSB::commit( void ) {
34 34
35short AUSB::generateFileEmbedded( const QString & ID, 35short AUSB::generateFileEmbedded( SystemFile & SF,
36 const QString & Path,
37 QTextStream & TS,
38 long DevNr ) { 36 long DevNr ) {
@@ -44,6 +42,6 @@ short AUSB::generateFileEmbedded( const QString & ID,
44 42
45 if( ID == "interfaces" ) { 43 if( SF.name() == "interfaces" ) {
46 Log(("Generate USB for %s\n", ID.latin1() )); 44 Log(("Generate USB for %s\n", SF.name().latin1() ));
47 // generate mapping stanza for this interface 45 // generate mapping stanza for this interface
48 TS << " pre-up " 46 SF << " pre-up "
49 << QPEApplication::qpeDir() 47 << QPEApplication::qpeDir()
@@ -55,3 +53,3 @@ short AUSB::generateFileEmbedded( const QString & ID,
55 } 53 }
56 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr ); 54 rvd = ANetNodeInstance::generateFileEmbedded(SF, DevNr );
57 55
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.h b/noncore/settings/networksettings2/usb/usb_NNI.h
index fcdfd91..27e71ee 100644
--- a/noncore/settings/networksettings2/usb/usb_NNI.h
+++ b/noncore/settings/networksettings2/usb/usb_NNI.h
@@ -28,5 +28,3 @@ public :
28 28
29 virtual short generateFileEmbedded( const QString & ID, 29 virtual short generateFileEmbedded( SystemFile & TS,
30 const QString & Path,
31 QTextStream & TS,
32 long DevNr ); 30 long DevNr );
diff --git a/noncore/settings/networksettings2/usb/usbdata.h b/noncore/settings/networksettings2/usb/usbdata.h
index c59f508..fa357b5 100644
--- a/noncore/settings/networksettings2/usb/usbdata.h
+++ b/noncore/settings/networksettings2/usb/usbdata.h
@@ -3,5 +3,6 @@
3 3
4typedef struct USBData { 4class USBData {
5public :
5 bool Fake; 6 bool Fake;
6} USBData_t; 7} ;
7 8
diff --git a/noncore/settings/networksettings2/usb/usbedit.cpp b/noncore/settings/networksettings2/usb/usbedit.cpp
index 153c497..cc96b96 100644
--- a/noncore/settings/networksettings2/usb/usbedit.cpp
+++ b/noncore/settings/networksettings2/usb/usbedit.cpp
@@ -11,6 +11,6 @@ QString USBEdit::acceptable( void ) {
11 11
12void USBEdit::showData( USBData_t & Data ) { 12void USBEdit::showData( USBData & Data ) {
13} 13}
14 14
15bool USBEdit::commit( USBData_t & Data ) { 15bool USBEdit::commit( USBData & Data ) {
16 return 1; 16 return 1;
diff --git a/noncore/settings/networksettings2/usb/usbedit.h b/noncore/settings/networksettings2/usb/usbedit.h
index 441f2f0..4179898 100644
--- a/noncore/settings/networksettings2/usb/usbedit.h
+++ b/noncore/settings/networksettings2/usb/usbedit.h
@@ -9,4 +9,4 @@ public :
9 QString acceptable( void ); 9 QString acceptable( void );
10 bool commit( USBData_t & Data ); 10 bool commit( USBData & Data );
11 void showData( USBData_t & Data ); 11 void showData( USBData & Data );
12}; 12};
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp
index b8ac8a8..f8824e0 100644
--- a/noncore/settings/networksettings2/usb/usbrun.cpp
+++ b/noncore/settings/networksettings2/usb/usbrun.cpp
@@ -6,3 +6,3 @@
6 6
7void USBRun::detectState( NodeCollection * NC ) { 7State_t USBRun::detectState( void ) {
8 // unavailable : no card found 8 // unavailable : no card found
@@ -10,2 +10,3 @@ void USBRun::detectState( NodeCollection * NC ) {
10 // up : card found and assigned to us and up 10 // up : card found and assigned to us and up
11 NodeCollection * NC = nodeCollection();
11 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); 12 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
@@ -29,6 +30,4 @@ void USBRun::detectState( NodeCollection * NC ) {
29 if( X == Run->Name ) { 30 if( X == Run->Name ) {
30 Run->assignNode( netNode() ); 31 NC->assignInterface( Run );
31 assignInterface( Run ); 32 return IsUp;
32 NC->setCurrentState( IsUp );
33 return;
34 } 33 }
@@ -38,4 +37,4 @@ void USBRun::detectState( NodeCollection * NC ) {
38 37
39 Log(("Assigned %p\n", assignedInterface() )); 38 Log(("Assigned %p\n", NC->assignedInterface() ));
40 if( ( Run = assignedInterface() ) ) { 39 if( ( Run = NC->assignedInterface() ) ) {
41 // we already have an interface assigned -> still present ? 40 // we already have an interface assigned -> still present ?
@@ -43,4 +42,3 @@ void USBRun::detectState( NodeCollection * NC ) {
43 // usb is still free -> keep assignment 42 // usb is still free -> keep assignment
44 NC->setCurrentState( Available ); 43 return Available;
45 return;
46 } // else interface is up but NOT us -> some other profile 44 } // else interface is up but NOT us -> some other profile
@@ -49,3 +47,3 @@ void USBRun::detectState( NodeCollection * NC ) {
49 // nothing (valid) assigned to us 47 // nothing (valid) assigned to us
50 assignInterface( 0 ); 48 NC->assignInterface( 0 );
51 49
@@ -67,80 +65,12 @@ void USBRun::detectState( NodeCollection * NC ) {
67 ) { 65 ) {
68 Log(("Released(OFF)\n" ));
69 // proper type, and Not UP -> free 66 // proper type, and Not UP -> free
70 NC->setCurrentState( Off ); 67 return Off;
71 return;
72 } 68 }
73 } 69 }
74 // no free found
75 Log(("UNA\n" ));
76 70
77 NC->setCurrentState( Unavailable ); 71 return Unavailable;
78} 72}
79 73
80bool USBRun::setState( NodeCollection * NC, Action_t A, bool ) { 74QString USBRun::setMyState( NodeCollection *, Action_t , bool ) {
81 75 return QString();
82 // we only handle activate and deactivate
83 switch( A ) {
84 case Activate :
85 {
86 if( NC->currentState() != Off ) {
87 return 0;
88 }
89 InterfaceInfo * N = getInterface();
90 if( ! N ) {
91 // no interface available
92 NC->setCurrentState( Unavailable );
93 return 0;
94 }
95 // because we were OFF the interface
96 // we get back is NOT assigned
97 N->assignNode( netNode() );
98 assignInterface( N );
99 Log(("Assing %p\n", N ));
100 NC->setCurrentState( Available );
101 return 1;
102 }
103 case Deactivate :
104 if( NC->currentState() == IsUp ) {
105 // bring down first
106 if( ! connection()->setState( Down ) )
107 // could not ...
108 return 0;
109 } else if( NC->currentState() != Available ) {
110 return 1;
111 }
112 assignedInterface()->assignNode( 0 ); // release
113 assignInterface( 0 );
114 NC->setCurrentState( Off );
115 return 1;
116 default :
117 // FT
118 break;
119 }
120 return 0;
121}
122
123bool USBRun::canSetState( State_t Curr, Action_t A ) {
124 // we only handle up down activate and deactivate
125 switch( A ) {
126 case Activate :
127 { // at least available
128 if( Curr == Available ) {
129 return 1;
130 }
131 // or we can make one available
132 InterfaceInfo * N = getInterface();
133 if( ! N || N->assignedNode() != 0 ) {
134 // non available or assigned
135 return 0;
136 }
137 return 1;
138 }
139 case Deactivate :
140 return ( Curr >= Available );
141 default :
142 // FT
143 break;
144 }
145 return 0;
146} 76}
@@ -162,6 +92,6 @@ InterfaceInfo * USBRun::getInterface( void ) {
162 // this is a USB card 92 // this is a USB card
163 if( Run->assignedNode() == netNode() ) { 93 if( Run->assignedConnection() == netNode()->connection() ) {
164 // assigned to us 94 // assigned to us
165 return Run; 95 return Run;
166 } else if( Run->assignedNode() == 0 ) { 96 } else if( Run->assignedConnection() == 0 ) {
167 // free 97 // free
@@ -178 +108,5 @@ bool USBRun::handlesInterface( const QString & S ) {
178 108
109bool USBRun::handlesInterface( InterfaceInfo * I ) {
110 return handlesInterface( I->Name );
111}
112
diff --git a/noncore/settings/networksettings2/usb/usbrun.h b/noncore/settings/networksettings2/usb/usbrun.h
index 03e21ab..6ce4fa2 100644
--- a/noncore/settings/networksettings2/usb/usbrun.h
+++ b/noncore/settings/networksettings2/usb/usbrun.h
@@ -3,3 +3,3 @@
3 3
4#include <asdevice.h> 4#include <netnode.h>
5#include <qregexp.h> 5#include <qregexp.h>
@@ -7,3 +7,3 @@
7 7
8class USBRun : public AsDevice { 8class USBRun : public RuntimeInfo {
9 9
@@ -13,18 +13,17 @@ public :
13 USBData & Data ) : 13 USBData & Data ) :
14 AsDevice( NNI ), 14 RuntimeInfo( NNI ),
15 Pat( "usb[0-9abcdef]" ) 15 Pat( "usb[0-9abcdef]" ) {
16 { } 16 }
17 17
18 virtual AsDevice * device( void ) 18 virtual RuntimeInfo * device( void )
19 { return (AsDevice *)this; } 19 { return this; }
20 20
21 virtual AsDevice * asDevice( void ) 21 bool handlesInterface( const QString & I );
22 { return (AsDevice *)this; } 22 bool handlesInterface( InterfaceInfo * );
23protected :
24 23
25 void detectState( NodeCollection * ); 24 State_t detectState( void );
26 bool setState( NodeCollection * , Action_t A, bool );
27 bool canSetState( State_t , Action_t A );
28 25
29 bool handlesInterface( const QString & I ); 26protected :
27
28 QString setMyState( NodeCollection * , Action_t, bool );
30 29
diff --git a/noncore/settings/networksettings2/vpn/opie-networksettings2plugin-vpn.control b/noncore/settings/networksettings2/vpn/opie-networksettings2plugin-vpn.control
index b346c5d..08f131f 100644
--- a/noncore/settings/networksettings2/vpn/opie-networksettings2plugin-vpn.control
+++ b/noncore/settings/networksettings2/vpn/opie-networksettings2plugin-vpn.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-vpn 1Package: opie-networksettings2plugin-vpn
2Files: plugins/networksettings2/libvpn.so* 2Files: plugins/networksettings2/libvpn.so*
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
index 9d3b6e7..23ec04a 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
@@ -7,2 +7,6 @@ static const char * VPNNeeds[] =
7 7
8static const char * VPNProvides[] =
9 { "connection",
10 0
11 };
8/** 12/**
@@ -35,4 +39,4 @@ const char ** VPNNetNode::needs( void ) {
35 39
36const char * VPNNetNode::provides( void ) { 40const char ** VPNNetNode::provides( void ) {
37 return "connection"; 41 return VPNProvides;
38} 42}
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h
index 3c7b5e0..c2e43d4 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.h
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.h
@@ -22,3 +22,3 @@ public:
22 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
23 virtual const char * provides( void ); 23 virtual const char ** provides( void );
24 24
diff --git a/noncore/settings/networksettings2/vpn/vpndata.h b/noncore/settings/networksettings2/vpn/vpndata.h
index 5c986aa..ee88bc4 100644
--- a/noncore/settings/networksettings2/vpn/vpndata.h
+++ b/noncore/settings/networksettings2/vpn/vpndata.h
@@ -4,3 +4,4 @@
4#include <qstring.h> 4#include <qstring.h>
5typedef struct VPNData { 5class VPNData {
6public :
6 QString Device; 7 QString Device;
@@ -13,3 +14,3 @@ typedef struct VPNData {
13 bool SoftwareControl; 14 bool SoftwareControl;
14} VPNData_t; 15} ;
15 16
diff --git a/noncore/settings/networksettings2/vpn/vpnedit.cpp b/noncore/settings/networksettings2/vpn/vpnedit.cpp
index f336394..8445757 100644
--- a/noncore/settings/networksettings2/vpn/vpnedit.cpp
+++ b/noncore/settings/networksettings2/vpn/vpnedit.cpp
@@ -12,6 +12,6 @@ QString VPNEdit::acceptable( void ) {
12 12
13void VPNEdit::showData( VPNData_t & Data ) { 13void VPNEdit::showData( VPNData & Data ) {
14} 14}
15 15
16bool VPNEdit::commit( VPNData_t & Data ) { 16bool VPNEdit::commit( VPNData & Data ) {
17 return 0; 17 return 0;
diff --git a/noncore/settings/networksettings2/vpn/vpnedit.h b/noncore/settings/networksettings2/vpn/vpnedit.h
index 76480cd..156bcc5 100644
--- a/noncore/settings/networksettings2/vpn/vpnedit.h
+++ b/noncore/settings/networksettings2/vpn/vpnedit.h
@@ -9,4 +9,4 @@ public :
9 QString acceptable( void ); 9 QString acceptable( void );
10 bool commit( VPNData_t & Data ); 10 bool commit( VPNData & Data );
11 void showData( VPNData_t & Data ); 11 void showData( VPNData & Data );
12}; 12};
diff --git a/noncore/settings/networksettings2/vpn/vpnrun.cpp b/noncore/settings/networksettings2/vpn/vpnrun.cpp
index ab2966c..64728aa 100644
--- a/noncore/settings/networksettings2/vpn/vpnrun.cpp
+++ b/noncore/settings/networksettings2/vpn/vpnrun.cpp
@@ -1,6 +1 @@
1#include "vpnrun.h" #include "vpnrun.h"
2
3bool VPNRun::handlesInterface( const QString & ) {
4 // to be figured out
5 return 0;
6}
diff --git a/noncore/settings/networksettings2/vpn/vpnrun.h b/noncore/settings/networksettings2/vpn/vpnrun.h
index c19b609..9a55625 100644
--- a/noncore/settings/networksettings2/vpn/vpnrun.h
+++ b/noncore/settings/networksettings2/vpn/vpnrun.h
@@ -3,6 +3,6 @@
3 3
4#include <asconnection.h> 4#include <netnode.h>
5#include "vpndata.h" 5#include "vpndata.h"
6 6
7class VPNRun : public AsConnection { 7class VPNRun : public RuntimeInfo {
8 8
@@ -11,20 +11,15 @@ public :
11 VPNRun( ANetNodeInstance * NNI, VPNData & Data ) : 11 VPNRun( ANetNodeInstance * NNI, VPNData & Data ) :
12 AsConnection( NNI ) 12 RuntimeInfo( NNI )
13 { } 13 { }
14 14
15 virtual AsConnection * asConnection( void ) 15 virtual RuntimeInfo * connection( void )
16 { return (AsConnection *)this; } 16 { return this; }
17protected :
18
19 void detectState( NodeCollection * )
20 { }
21 17
22 bool setState( NodeCollection *, Action_t, bool ) 18 State_t detectState( void )
23 { return 0; } 19 { return Unknown; }
24 20
25 bool canSetState( State_t, Action_t ) 21protected :
26 { return 0; }
27
28 bool handlesInterface( const QString & I );
29 22
23 QString setMyState( NodeCollection * , Action_t, bool )
24 { return QString(); }
30}; 25};
diff --git a/noncore/settings/networksettings2/wlan/opie-networksettings2plugin-wlan.control b/noncore/settings/networksettings2/wlan/opie-networksettings2plugin-wlan.control
index 14afd21..90f195a 100644
--- a/noncore/settings/networksettings2/wlan/opie-networksettings2plugin-wlan.control
+++ b/noncore/settings/networksettings2/wlan/opie-networksettings2plugin-wlan.control
@@ -1,2 +1,2 @@
1Package: opie-networksettingsplugin2-wlan 1Package: opie-networksettings2plugin-wlan
2Files: plugins/networksettings2/libwlan.so* 2Files: plugins/networksettings2/libwlan.so*
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
index e4c3f60..36a5c33 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
@@ -1 +1,2 @@
1#include <resources.h>
1#include "wlan_NN.h" 2#include "wlan_NN.h"
@@ -7,2 +8,7 @@ static const char * WLanNeeds[] =
7 8
9static const char * WLanProvides[] =
10 { "device",
11 0
12 };
13
8/** 14/**
@@ -11,2 +17,4 @@ static const char * WLanNeeds[] =
11WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) { 17WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) {
18 NSResources->addSystemFile(
19 "interfaces", "/etc/network/interfaces", 1 );
12 InstanceCount = 2; 20 InstanceCount = 2;
@@ -36,4 +44,4 @@ const char ** WLanNetNode::needs( void ) {
36 44
37const char * WLanNetNode::provides( void ) { 45const char ** WLanNetNode::provides( void ) {
38 return "device"; 46 return WLanProvides;
39} 47}
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h
index c13c05c..4bffd3d 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.h
@@ -22,3 +22,3 @@ public:
22 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
23 virtual const char * provides( void ); 23 virtual const char ** provides( void );
24 24
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
index 0e4fc4c..d5b1014 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
@@ -81,5 +81,3 @@ void AWLan::commit( void ) {
81 81
82short AWLan::generateFileEmbedded( const QString & ID, 82short AWLan::generateFileEmbedded( SystemFile & SF,
83 const QString & Path,
84 QTextStream & TS,
85 long DevNr ) { 83 long DevNr ) {
@@ -90,5 +88,5 @@ short AWLan::generateFileEmbedded( const QString & ID,
90 88
91 if( ID == "interfaces" ) { 89 if( SF.name() == "interfaces" ) {
92 Log(("Generate WLanNNI for %s\n", ID.latin1() )); 90 Log(("Generate WLanNNI for %s\n", SF.name().latin1() ));
93 TS << " wireless_essid \"" 91 SF << " wireless_essid \""
94 << Data.ESSID 92 << Data.ESSID
@@ -102,3 +100,3 @@ short AWLan::generateFileEmbedded( const QString & ID,
102 Buf[99] = '\0'; // just to make sure 100 Buf[99] = '\0'; // just to make sure
103 TS << " wireless_nick " 101 SF << " wireless_nick "
104 << Buf 102 << Buf
@@ -107,3 +105,3 @@ short AWLan::generateFileEmbedded( const QString & ID,
107 } else { 105 } else {
108 TS << " wireless_nick \"" 106 SF << " wireless_nick \""
109 << Data.NodeName 107 << Data.NodeName
@@ -126,3 +124,3 @@ short AWLan::generateFileEmbedded( const QString & ID,
126 124
127 TS << " wireless_mode " 125 SF << " wireless_mode "
128 << M 126 << M
@@ -132,3 +130,3 @@ short AWLan::generateFileEmbedded( const QString & ID,
132 if( ! Data.Key[i].isEmpty() ) { 130 if( ! Data.Key[i].isEmpty() ) {
133 TS << " wireless_key" 131 SF << " wireless_key"
134 << i 132 << i
@@ -139,3 +137,3 @@ short AWLan::generateFileEmbedded( const QString & ID,
139 } 137 }
140 TS << " wireless_keymode " 138 SF << " wireless_keymode "
141 << ((Data.AcceptNonEncrypted) ? "open" : "restricted") 139 << ((Data.AcceptNonEncrypted) ? "open" : "restricted")
@@ -145,3 +143,3 @@ short AWLan::generateFileEmbedded( const QString & ID,
145 } 143 }
146 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr); 144 rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr);
147 145
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h
index a9be65f..e3251c7 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h
@@ -28,5 +28,3 @@ public :
28 28
29 virtual short generateFileEmbedded( const QString & ID, 29 virtual short generateFileEmbedded( SystemFile & Sf,
30 const QString & Path,
31 QTextStream & TS,
32 long DevNr ); 30 long DevNr );
diff --git a/noncore/settings/networksettings2/wlan/wlandata.h b/noncore/settings/networksettings2/wlan/wlandata.h
index 36990a9..f3cc1ab 100644
--- a/noncore/settings/networksettings2/wlan/wlandata.h
+++ b/noncore/settings/networksettings2/wlan/wlandata.h
@@ -4,3 +4,4 @@
4#include <qstring.h> 4#include <qstring.h>
5typedef struct WLanData { 5class WLanData {
6public :
6 QString ESSID; 7 QString ESSID;
@@ -13,3 +14,3 @@ typedef struct WLanData {
13 bool AcceptNonEncrypted; 14 bool AcceptNonEncrypted;
14} WLanData_t; 15} ;
15 16
diff --git a/noncore/settings/networksettings2/wlan/wlanedit.cpp b/noncore/settings/networksettings2/wlan/wlanedit.cpp
index 8d3979e..74174bf 100644
--- a/noncore/settings/networksettings2/wlan/wlanedit.cpp
+++ b/noncore/settings/networksettings2/wlan/wlanedit.cpp
@@ -22,3 +22,3 @@ WLanEdit::WLanEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
22 WE = 0; 22 WE = 0;
23 if( ( II = Dev->assignedInterface() ) ) { 23 if( ( II = NNI->connection()->assignedInterface() ) ) {
24 // show data 24 // show data
@@ -63,3 +63,3 @@ QString WLanEdit::acceptable( void ) {
63 63
64void WLanEdit::showData( WLanData_t & Data ) { 64void WLanEdit::showData( WLanData & Data ) {
65 Mode_CB->setCurrentItem( Data.Mode ); 65 Mode_CB->setCurrentItem( Data.Mode );
@@ -78,3 +78,3 @@ void WLanEdit::showData( WLanData_t & Data ) {
78 78
79bool WLanEdit::commit( WLanData_t & Data ) { 79bool WLanEdit::commit( WLanData & Data ) {
80 bool SM = 0; 80 bool SM = 0;
diff --git a/noncore/settings/networksettings2/wlan/wlanedit.h b/noncore/settings/networksettings2/wlan/wlanedit.h
index e550c14..8f219d9 100644
--- a/noncore/settings/networksettings2/wlan/wlanedit.h
+++ b/noncore/settings/networksettings2/wlan/wlanedit.h
@@ -6,3 +6,3 @@
6class ANetNodeInstance; 6class ANetNodeInstance;
7class AsDevice; 7class RuntimeInfo;
8class WExtensions; 8class WExtensions;
@@ -16,4 +16,4 @@ public :
16 QString acceptable( void ); 16 QString acceptable( void );
17 void showData( WLanData_t & Data ); 17 void showData( WLanData & Data );
18 bool commit( WLanData_t & Data ); 18 bool commit( WLanData & Data );
19 19
@@ -27,3 +27,3 @@ private :
27 ANetNodeInstance * NNI; 27 ANetNodeInstance * NNI;
28 AsDevice * Dev; 28 RuntimeInfo * Dev;
29 QTimer RefreshTimer; 29 QTimer RefreshTimer;
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.cpp b/noncore/settings/networksettings2/wlan/wlanrun.cpp
index 3f1d4a9..fe49c4e 100644
--- a/noncore/settings/networksettings2/wlan/wlanrun.cpp
+++ b/noncore/settings/networksettings2/wlan/wlanrun.cpp
@@ -7,3 +7,3 @@
7 7
8void WLanRun::detectState( NodeCollection * NC ) { 8State_t WLanRun::detectState( void ) {
9 9
@@ -13,2 +13,3 @@ void WLanRun::detectState( NodeCollection * NC ) {
13 13
14 NodeCollection * NC = nodeCollection();
14 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); 15 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
@@ -31,6 +32,4 @@ void WLanRun::detectState( NodeCollection * NC ) {
31 if( X == Run->Name ) { 32 if( X == Run->Name ) {
32 Run->assignNode( netNode() ); 33 NC->assignInterface( Run );
33 assignInterface( Run ); 34 return IsUp;
34 NC->setCurrentState( IsUp );
35 return;
36 } 35 }
@@ -40,3 +39,3 @@ void WLanRun::detectState( NodeCollection * NC ) {
40 39
41 if( ( Run = assignedInterface() ) ) { 40 if( ( Run = NC->assignedInterface() ) ) {
42 // we already have an interface assigned -> still present ? 41 // we already have an interface assigned -> still present ?
@@ -44,4 +43,3 @@ void WLanRun::detectState( NodeCollection * NC ) {
44 // usb is still free -> keep assignment 43 // usb is still free -> keep assignment
45 NC->setCurrentState( Available ); 44 return Available;
46 return;
47 } // else interface is up but NOT us -> some other profile 45 } // else interface is up but NOT us -> some other profile
@@ -50,3 +48,3 @@ void WLanRun::detectState( NodeCollection * NC ) {
50 // nothing (valid) assigned to us 48 // nothing (valid) assigned to us
51 assignInterface( 0 ); 49 NC->assignInterface( 0 );
52 50
@@ -66,9 +64,7 @@ void WLanRun::detectState( NodeCollection * NC ) {
66 // proper type, and Not UP -> free 64 // proper type, and Not UP -> free
67 NC->setCurrentState( Off ); 65 return Off;
68 return;
69 } 66 }
70 } 67 }
71 // no free found
72 68
73 NC->setCurrentState( Unavailable ); 69 return Unavailable;
74 70
@@ -76,67 +72,6 @@ void WLanRun::detectState( NodeCollection * NC ) {
76 72
77bool WLanRun::setState( NodeCollection * NC, Action_t A, bool ) { 73QString WLanRun::setMyState( NodeCollection * , Action_t , bool ) {
78 74
79 // we only handle activate and deactivate 75 // we only handle activate and deactivate
80 switch( A ) { 76 return QString();
81 case Activate :
82 {
83 if( NC->currentState() != Off ) {
84 return 0;
85 }
86 InterfaceInfo * N = getInterface();
87 if( ! N ) {
88 // no interface available
89 NC->setCurrentState( Unavailable );
90 return 0;
91 }
92 // because we were OFF the interface
93 // we get back is NOT assigned
94 N->assignNode( netNode() );
95 assignInterface( N );
96 NC->setCurrentState( Available );
97 return 1;
98 }
99 case Deactivate :
100 if( NC->currentState() == IsUp ) {
101 // bring down first
102 if( ! connection()->setState( Down ) )
103 // could not ...
104 return 0;
105 } else if( NC->currentState() != Available ) {
106 return 1;
107 }
108 assignedInterface()->assignNode( 0 ); // release
109 assignInterface( 0 );
110 NC->setCurrentState( Off );
111 return 1;
112 default :
113 // FT
114 break;
115 }
116 return 0;
117}
118
119bool WLanRun::canSetState( State_t Curr, Action_t A ) {
120 // we only handle up down activate and deactivate
121 switch( A ) {
122 case Activate :
123 { // at least available
124 if( Curr == Available ) {
125 return 1;
126 }
127 // or we can make one available
128 InterfaceInfo * N = getInterface();
129 if( ! N || N->assignedNode() != 0 ) {
130 // non available or assigned
131 return 0;
132 }
133 return 1;
134 }
135 case Deactivate :
136 return ( Curr >= Available );
137 default :
138 // FT
139 break;
140 }
141 return 0;
142} 77}
@@ -161,6 +96,6 @@ InterfaceInfo * WLanRun::getInterface( void ) {
161 // this is a LAN card 96 // this is a LAN card
162 if( Run->assignedNode() == netNode() ) { 97 if( Run->assignedConnection() == netNode()->connection() ) {
163 // assigned to us 98 // assigned to us
164 return Run; 99 return Run;
165 } else if( Run->assignedNode() == 0 ) { 100 } else if( Run->assignedConnection() == 0 ) {
166 // free 101 // free
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.h b/noncore/settings/networksettings2/wlan/wlanrun.h
index 25d5b96..fd325d4 100644
--- a/noncore/settings/networksettings2/wlan/wlanrun.h
+++ b/noncore/settings/networksettings2/wlan/wlanrun.h
@@ -4,6 +4,6 @@
4#include <qregexp.h> 4#include <qregexp.h>
5#include <asdevice.h> 5#include <netnode.h>
6#include "wlandata.h" 6#include "wlandata.h"
7 7
8class WLanRun : public AsDevice { 8class WLanRun : public RuntimeInfo {
9 9
@@ -12,16 +12,9 @@ public :
12 WLanRun( ANetNodeInstance * NNI, WLanData & Data ) : 12 WLanRun( ANetNodeInstance * NNI, WLanData & Data ) :
13 AsDevice( NNI ), 13 RuntimeInfo( NNI ),
14 Pat( "wlan[0-9]" ) 14 Pat( "wlan[0-9]" ) {
15 { } 15 }
16 16
17 virtual AsDevice * device( void ) 17 virtual RuntimeInfo * device( void )
18 { return (AsDevice *)this; } 18 { return this; }
19 virtual AsDevice * asDevice( void )
20 { return (AsDevice *)this; }
21 19
22protected :
23
24 void detectState( NodeCollection * );
25 bool setState( NodeCollection *, Action_t, bool );
26 bool canSetState( State_t, Action_t );
27 bool handlesInterface( const QString & I ); 20 bool handlesInterface( const QString & I );
@@ -29,2 +22,8 @@ protected :
29 22
23 State_t detectState( void );
24
25protected :
26
27 QString setMyState( NodeCollection * , Action_t, bool );
28
30private : 29private :
diff --git a/noncore/settings/packagemanager/oconfitem.h b/noncore/settings/packagemanager/oconfitem.h
index 9972c00..7b52ce4 100644
--- a/noncore/settings/packagemanager/oconfitem.h
+++ b/noncore/settings/packagemanager/oconfitem.h
@@ -40,3 +40,8 @@ class OConfItem
40public: 40public:
41 enum Type { Source, Destination, Option, Arch, NotDefined }; 41 enum Type { Source=0x01,
42 GzSource=0x02,
43 Destination=0x04,
44 Option=0x08,
45 Arch=0x10,
46 NotDefined=0x20 };
42 47
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index f2d7e39..a885ef8 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -116,3 +116,4 @@ OConfItemList *OIpkg::servers()
116 // Retrieve only servers 116 // Retrieve only servers
117 return filterConfItems( OConfItem::Source ); 117 return filterConfItems( (OConfItem::Type)((int)OConfItem::Source |
118 (int)OConfItem::GzSource) );
118} 119}
@@ -545,2 +546,3 @@ void OIpkg::loadConfiguration()
545 line.startsWith( "#src" ) || 546 line.startsWith( "#src" ) ||
547 line.startsWith( "#src/gz" ) ||
546 line.startsWith( "#dest" ) || 548 line.startsWith( "#dest" ) ||
@@ -620,3 +622,4 @@ OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter )
620 OConfItem *item = it.current(); 622 OConfItem *item = it.current();
621 if ( retrieveAll || item->type() == typefilter ) 623 if ( retrieveAll ||
624 ( item->type() & typefilter ) )
622 { 625 {
diff --git a/noncore/settings/packagemanager/opie-packagemanager.control b/noncore/settings/packagemanager/opie-packagemanager.control
index da3ddfe..0153d40 100644
--- a/noncore/settings/packagemanager/opie-packagemanager.control
+++ b/noncore/settings/packagemanager/opie-packagemanager.control
@@ -4,3 +4,3 @@ Priority: optional
4Section: opie/settings 4Section: opie/settings
5Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.120) 5Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg0 (>=0.99.120), ipkg-link
6Replaces: packagemanager 6Replaces: packagemanager
@@ -9,2 +9,2 @@ Maintainer: Dan Williams (drw@handhelds.org)
9Description: Opie package management client 9Description: Opie package management client
10Version: 0.6.1$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/tools/opie-sh/opie-sh.control b/noncore/tools/opie-sh/opie-sh.control
index 106a183..496a036 100644
--- a/noncore/tools/opie-sh/opie-sh.control
+++ b/noncore/tools/opie-sh/opie-sh.control
@@ -6,3 +6,3 @@ Maintainer: Thomas Stephens <spiralman@softhome.net>
6Architecture: arm 6Architecture: arm
7Version: 0.5-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal 8Depends: task-opie-minimal
diff --git a/noncore/tools/opie-sh/scripts/opie-sh-wavelanchooser.control b/noncore/tools/opie-sh/scripts/opie-sh-wavelanchooser.control
index 3c3463f..0d6b235 100644
--- a/noncore/tools/opie-sh/scripts/opie-sh-wavelanchooser.control
+++ b/noncore/tools/opie-sh/scripts/opie-sh-wavelanchooser.control
@@ -3,3 +3,3 @@ Files: bin/opie-sh-wavelanchooser.sh apps/Opie-SH/opie-sh-wavelanchooser.desktop
3Installed-Size: 0 3Installed-Size: 0
4Version: 0.1-20020527-1 4Version: $QPE_VERSION$EXTRAVERSION
5Depends: task-opie-minimal (1.5.0+), opie-sh 5Depends: task-opie-minimal (1.5.0+), opie-sh
diff --git a/noncore/unsupported/filebrowser/opie-filebrowser.control b/noncore/unsupported/filebrowser/opie-filebrowser.control
index d40bd8a..50080a1 100644
--- a/noncore/unsupported/filebrowser/opie-filebrowser.control
+++ b/noncore/unsupported/filebrowser/opie-filebrowser.control
@@ -6,3 +6,3 @@ Maintainer: Opie Team <opie@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: $QPE_VERSION-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal 8Depends: task-opie-minimal
diff --git a/noncore/unsupported/gsmtool/opie-gsmtool.control b/noncore/unsupported/gsmtool/opie-gsmtool.control
index 6bd3b46..d987b11 100644
--- a/noncore/unsupported/gsmtool/opie-gsmtool.control
+++ b/noncore/unsupported/gsmtool/opie-gsmtool.control
@@ -6,3 +6,3 @@ Maintainer: David Woodhouse <dwmw2@infradead.org>
6Architecture: arm 6Architecture: arm
7Version: 1.0.0-2 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal, gsmlib 8Depends: task-opie-minimal, gsmlib
diff --git a/noncore/unsupported/oipkg/opie-oipkg.control b/noncore/unsupported/oipkg/opie-oipkg.control
index 17e7049..da6c755 100644
--- a/noncore/unsupported/oipkg/opie-oipkg.control
+++ b/noncore/unsupported/oipkg/opie-oipkg.control
@@ -6,3 +6,3 @@ Maintainer: Patrick S. Vogt <tille@almana.ch>
6Architecture: arm 6Architecture: arm
7Version: $QPE_VERSION-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal, ipkg (>0.99.20), ar 8Depends: task-opie-minimal, ipkg (>0.99.20), ar
diff --git a/noncore/unsupported/ubrowser/opie-ubrowser.control b/noncore/unsupported/ubrowser/opie-ubrowser.control
index cf96888..bfa6c30 100644
--- a/noncore/unsupported/ubrowser/opie-ubrowser.control
+++ b/noncore/unsupported/ubrowser/opie-ubrowser.control
@@ -6,3 +6,3 @@ Maintainer: Thomas Stephens <spiralman@softhome.net>
6Architecture: arm 6Architecture: arm
7Version: 0.1-$SUB_VERSION 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: task-opie-minimal 8Depends: task-opie-minimal