summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -2,9 +2,9 @@ Package: zkbapplet
Files: plugins/applets/libzkbapplet.so* pics/zkb-disabled.png share/zkb/*.xml bin/keyz-cfg apps/Settings/keyz-cfg.desktop pics/keyz-cfg.png share/zkb/zkb.xml.sample
Priority: optional
Section: opie/applets
Maintainer: Rajko Albrecht <alwin@handhelds.org>
Architecture: arm
Depends: task-opie-minimal
Description: ZKB Applet and configuration program
Obsoletes: keyz-cfg
-Version: 0.6.0$EXTRAVERSION
+Version: $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
@@ -1,9 +1,9 @@
Package: opie-confeditor
Files: bin/confedit apps/Settings/confedit.desktop pics/confedit/confedit.png plugins/application/libconfedit.so*
Priority: optional
Section: opie/settings
Maintainer: Patrick S. Vogt <tille@handhelds.org>
Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal, libopiecore2
Description: An enditor for the ~/Settings/*.conf files
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
@@ -1,9 +1,9 @@
Package: opie-dagger
Files: plugins/application/libdagger.so* bin/dagger pics/dagger apps/Applications/dagger.desktop
Priority: optional
Section: opie/applications
Depends: task-opie-minimal, libopiecore2, libopieui2
Architecture: arm
Maintainer: Dan Williams (drw@handhelds.org)
Description: A Bible study program utilizing the Sword library.
-Version: 0.9.1$EXTRAVERSION
+Version: $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
@@ -1,10 +1,10 @@
Files: plugins/applications/libbartender.so* bin/bartender apps/Applications/bartender.desktop etc/bartender/drinkdb.txt
Priority: optional
Package: opie-bartender
Section: opie/applications
Maintainer: L.J. Potter <lpotter@trolltech.com>
Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal
Description: Bartender drink receipe database lookup, and
blood alcohol estimator.
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
@@ -1,10 +1,10 @@
Package: opie-console
Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* share/opie-console/*
Priority: optional
Section: opie/applications
Maintainer: Opie Team <opie@handhelds.org>
Architecture: arm
-Version: 0.6-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs
License: GPL
Description: Opie terminal app
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
@@ -1,10 +1,10 @@
Package: opie-console
Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/*
Priority: optional
Section: opie/applications
Maintainer: Opie Team <opie@handhelds.org>
Architecture: arm
-Version: 0.6-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs
License: GPL
Description: Opie terminal app
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
@@ -1,11 +1,11 @@
Package: opie-gutenbrowser
Files: bin/gutenbrowser apps/Applications/gutenbrowser.desktop etc/gutenbrowser/* pics/gutenbrowser/* plugins/application/libgutenbrowser.so*
Priority: optional
Section: opie
Maintainer: ljp <lpotter@trolltech.com>
Source: opie.handhelds.org
Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: ftplib, libopiecore2, libopieui2
Description: Etext read for the Project Gutenberg.
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
@@ -1,11 +1,11 @@
Package: opie-bounce
Files: plugins/application/libbounce.so* bin/bounce apps/Games/bounce.desktop pics/bounce/*.png
-Version: 0.6-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal, libopiecore2
Priority: optional
Section: opie/games
Maintainer: Martin Imobersteg <imm@gmx.ch>
Architecture: arm
License: GPL
Description: bounce
A JezzGame like game for Qtopia.
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
@@ -1,11 +1,11 @@
Package: opie-buzzword
Files: plugins/application/libbuzzword.so* bin/buzzword apps/Games/buzzword.desktop pics/buzzword/buzzword.png share/buzzword/buzzwords
-Version: 1.1-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal,libopiecore2
Priority: optional
Section: opie/games
Maintainer: Martin Imobersteg <imm@gmx.ch>
Architecture: arm
License: GPL
Description: BuzzWord
A BuzzWord Bingo for the Opie environment.
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
@@ -1,13 +1,13 @@
Package: opie-kbill
Files: bin/kbill apps/Games/kbill.desktop pics/kbill/*
Priority: optional
Section: opie/games
Maintainer: Mark Westcott <mark@houseoffish.org>
Architecture: arm
-Version: 0.8-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal
License: GPL
Description: The famous hit Bill game
Hit Bill as hard as you can before he
infects your network with a wannabe
OS.
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
@@ -1,10 +1,10 @@
Package: opie-kcheckers
Files: plugins/application/libkcheckers.so* bin/kcheckers apps/Games/kcheckers.desktop pics/kcheckers
Priority: optional
Section: opie/games
Maintainer: leseb <prudhomme@laposte.net>
Architecture: arm
-Version: 0.3-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal, libopiecore2
Description: The game of Checkers
A game for the Opie environment.
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
@@ -1,11 +1,11 @@
Package: opie-kpacman
Files: plugins/applications/libkpacman.so* bin/kpacman apps/Games/kpacman.desktop pics/kpacman/kpacman.png share/kpacman
-Version: 0.3.1-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal
Priority: optional
Section: opie/games
Maintainer: Catalin Climov <catalin@climov.com>
Architecture: arm
License: GPL
Description: Kpacman
A Pacman clone for Qtopia.
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
@@ -14,38 +14,35 @@
**************************************************************************/
#include <qdialog.h>
#include <qlayout.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qstring.h>
+#include <qlist.h>
#include <qhbox.h>
#include <qvbox.h>
#include <qlabel.h>
#include <qlistview.h>
#include <qlineedit.h>
#include "ohighscoredlg.h"
-OHighscore::OHighscore( int score , int playerLevel )
+OHighscore::OHighscore( int score , int playerLevel ) : playerData()
{
pLevel = playerLevel;
getList();
checkIfItIsANewhighscore( score );
+ playerData.setAutoDelete( TRUE );
}
OHighscore::~OHighscore()
{
- std::list<t_playerData*>::iterator deleteIterator = playerData.begin();
- for ( ; deleteIterator != playerData.end() ; deleteIterator++ )
- {
- delete ( *deleteIterator );
- }
}
void OHighscore::getList()
{
Config cfg ( "tetrix" );
cfg.setGroup( QString::number( 1 ) );
lowest = cfg.readNumEntry( "Points" );
playerData.clear();
@@ -59,17 +56,17 @@ void OHighscore::getList()
cfg.setGroup( QString::number( i ) );
int temp = cfg.readNumEntry( "Points" );
t_playerData *pPlayerData = new t_playerData;
pPlayerData->sName = cfg.readEntry( "Name" );
pPlayerData->points = temp;
pPlayerData->level = cfg.readNumEntry( "Level" );
- playerData.push_back( pPlayerData );
+ playerData.append( pPlayerData );
if ( (temp < lowest) ) lowest = temp;
rest++;
}
}
//now I fill up the rest of the list
if ( rest < 11 ) //only go in this loop if there are less than
@@ -78,68 +75,68 @@ void OHighscore::getList()
lowest = 0;
for ( ; rest < 11 ; rest++ )
{
t_playerData *pPlayerData = new t_playerData;
pPlayerData->sName = tr( "empty");
pPlayerData->points = 0;
pPlayerData->level = 0;
- playerData.push_back( pPlayerData );
+ playerData.append( pPlayerData );
}
}
}
void OHighscore::checkIfItIsANewhighscore( int points)
{
if ( points > lowest )
isNewhighscore = true;
else
isNewhighscore = false;
}
void OHighscore::insertData( QString name , int punkte , int playerLevel )
{
Config cfg ( "tetrix" );
+ t_playerData * Run;
+ int index = 0;
int entryNumber = 1;
- std::list<t_playerData*>::iterator insertIterator = playerData.begin();
- while ( insertIterator != playerData.end() )
- {
- if ( punkte > ( *insertIterator )->points )
+
+ for ( Run=playerData.first();
+ Run != 0;
+ index ++, Run=playerData.next() ) {
+
+ if ( punkte > Run->points )
{
t_playerData* temp = new t_playerData;
temp->sName = name;
temp->points = punkte;
temp->level = playerLevel;
- playerData.insert( insertIterator , temp );
+
+ playerData.insert( index, temp );
//now we have to delete the last entry
- insertIterator = playerData.end();
- insertIterator--;
-//X delete *insertIterator; //memleak?
- playerData.erase( insertIterator );
+ playerData.remove( playerData.count() );
/////////////////////////////////////////
//this block just rewrites the highscore
- insertIterator = playerData.begin();
- while ( insertIterator != playerData.end() )
- {
+ for ( t_playerData * Run2=playerData.first();
+ Run2 != 0;
+ Run2=playerData.next() ) {
cfg.setGroup( QString::number( entryNumber ) );
- cfg.writeEntry( "Name" , ( *insertIterator )->sName );
- cfg.writeEntry( "Points" , ( *insertIterator )->points );
- cfg.writeEntry( "Level" , ( *insertIterator )->level );
+ cfg.writeEntry( "Name" , Run2->sName );
+ cfg.writeEntry( "Points" , Run2->points );
+ cfg.writeEntry( "Level" , Run2->level );
entryNumber++;
- insertIterator++;
}
////////////////////////////////////////
return;
}
- insertIterator++;
}
}
QString OHighscore::getName()
{
QString name;
QDialog *d = new QDialog ( this, 0, true );
d->setCaption( tr( "Enter your name!" ));
@@ -172,28 +169,38 @@ OHighscoreDialog::OHighscoreDialog(OHighscore *highscore, QWidget *parent, const
QPEApplication::showDialog( this );
}
void OHighscoreDialog::createHighscoreListView()
{
int pos = 10;
int points_ = 0;
int level_ = 0;
-
- std::list<t_playerData*>::reverse_iterator iListe = hs_->playerData.rbegin();
-
- for ( ; iListe != hs_->playerData.rend() ; ++iListe )
- {
- QListViewItem *item = new QListViewItem( list );
+ QListViewItem * Prev = 0;
+
+ for ( t_playerData * Run = hs_->playerData.first();
+ Run != 0;
+ Run=hs_->playerData.next() )
+ {
+ QListViewItem *item;
+
+ if( Prev ) {
+ // after previous
+ item = new QListViewItem( list, Prev );
+ Prev = item;
+ } else {
+ item = new QListViewItem( list );
+
+ }
item->setText( 0 , QString::number( pos ) ); //number
- item->setText( 1 , ( *iListe )->sName ); //name
- if ( ( *iListe )->points == -1 )
+ item->setText( 1 , Run->sName ); //name
+ if ( Run->points == -1 )
points_ = 0;
- else points_ = ( *iListe )->points;
- if ( ( *iListe )->level == -1 )
- level_ = 0;
- else level_ = ( *iListe )->level;
+ else points_ = Run->points;
+ if ( Run->level == -1 )
+ level_ = 0;
+ else level_ = Run->level;
item->setText( 2 , QString::number( points_ ) ); //points
item->setText( 3 , QString::number( level_ ) ); //level
pos--;
}
}
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
@@ -7,22 +7,23 @@
* *
**************************************************************************/
class QWidget;
class QVBoxLayout;
class QListView;
#include <qdialog.h>
-#include <list>
+#include <qlist.h>
-using namespace std;
-
-struct t_playerData
+class t_playerData
{
+
+public :
+
QString sName;
int points;
int level;
};
class OHighscore : public QWidget
{
Q_OBJECT
@@ -40,26 +41,24 @@ class OHighscore : public QWidget
*/
bool isNewhighscore;
/*
* this inserts the new entry at the correct position
*/
void insertData( QString , int , int );
- list<t_playerData*> playerData;
+ QList<t_playerData> playerData;
/*
* As Qt/e does not support QInputDialog I did that code myself
*/
QString getName();
private:
- list<t_playerData*>::iterator iPlayerData;
-
/*
* the lowest score in the highscorelist
*/
int lowest;
/*
* the level of the highscore
*/
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
@@ -7,16 +7,16 @@ HEADERS = gtetrix.h \
SOURCES = main.cpp \
gtetrix.cpp \
qtetrix.cpp \
qtetrixb.cpp \
tpiece.cpp \
ohighscoredlg.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopiecore2 -lstdc++
+LIBS += -lqpe -lopiecore2
INTERFACES =
TARGET = tetrix
include( $(OPIEDIR)/include.pro )
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
@@ -1,10 +1,10 @@
Package: opie-camera
Files: lib/libcamera.* bin/camera bin/capture pics/camera apps/Applications/camera.desktop
Priority: optional
Section: opie/multimedia
Maintainer: Michael 'Mickey' Lauer <mickeyl@Vanille.de>
Architecture: arm
-Version: 1.0.1
+Version: $QPE_VERSION$EXTRAVERSION
Depends: libqpe1, libopiecore2, libopieui2
Description: A Camera Application
A Camera Application to use with the Sharp CE-AG06.
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
@@ -1,10 +1,10 @@
Package: opie-mediaplayer2-codecs
Files: root/usr/lib/libao.so* root/usr/lib/libogg* root/usr/lib/libvorbisidec.so* root/usr/lib/libxine.so* root/usr/lib/xine/*
Section: ;ibs
Essential: no
Priority: optional
-Version: 0.7-$SUB_VERSION.3
+Version: $QPE_VERSION$EXTRAVERSION
Architecture: arm
Maintainer: Maximilian Reiss <harlekin@handhelds.org>
Depends: libc6 (>= 2.1), opie-mediaplayer2
Description: Codecs for opieplayer 2
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
@@ -1,11 +1,11 @@
Package: opie-mediaplayer2
Files: plugins/application/libopieplayer2.so* bin/opieplayer2 apps/Applications/opieplayer2.desktop pics/opieplayer2/add_to_playlist.png pics/opieplayer2/cut.png pics/opieplayer2/delete.png pics/opieplayer2/down.png pics/opieplayer2/loop.png pics/opieplayer2/MPEGPlayer.png pics/opieplayer2/musicfile.png pics/opieplayer2/playlist2.png pics/opieplayer2/play.png pics/opieplayer2/remove_from_playlist.png pics/opieplayer2/shuffle.png pics/opieplayer2/up.png pics/opieplayer2/videofile.png
Priority: optional
Section: opie/multimedia
Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org>
Architecture: arm
-Depends: task-opie-minimal, libopie1, zlib1g, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs
+Depends: task-opie-minimal, libopiecore2, libopieui2, libqtaux2, libz1, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs
Description: The Opie media player
The mediaplayer for Opie. It plays mp3, mpeg, wav, ogg, quicktime, divx and
more. Also it is streaming capable.
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -1,10 +1,10 @@
Files: plugins/applications/libpowerchord.so* bin/powerchord apps/Applications/powerchord.desktop pics/powerchord share/powerchord
Priority: optional
Section: opie/multimedia
Maintainer: Camilo Mesias <camilo@mesias.co.uk>, ljp <lpotter@trolltech.com>
Architecture: arm
-Version: 0.0.8
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal
Description: Guitar Chord generator application
Allows naming of chords using base note and key. Fretboard diagrams are
produced illustrating ways to play the chord.
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
@@ -1,10 +1,10 @@
Package: libetpan
Files: usr/lib/libetpan*
Priority: optional
Section: system
Maintainer: Rajko Albrecht <alwin@handhelds.org>
Architecture: arm
-Version: 0.33pre-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: libssl0.9.7
Description: libetpan mail/news library - A version of libetpan patched for Opies mailing app
License: LGPL
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
@@ -1,10 +1,10 @@
Package: libmailwrapper
Files: lib/libmailwrapper.so*
Priority: optional
Section: libs
Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org>
Architecture: arm
-Version: 0.6-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal, libopiecore2, libopieui2, libetpan (>= 0.33pre)
Description: wrapper lib needed by Opie's mailer
License: LGPL
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
@@ -1,10 +1,10 @@
Package: opie-mail
Files: plugins/application/libopiemail.so* bin/opiemail apps/1Pim/opiemail.desktop pics/mail/*.png
Priority: optional
Section: opie/pim
Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org>
Architecture: arm
-Version: 0.6-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal, libopiecore2, libopieui2, libopiemm2, libopiedb2, libmailwrapper (>= 0.6), libssl
Description: Opie's mail and news client (POP3, IMAP and NNTP)
License: LGPL
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
@@ -1,10 +1,10 @@
Package: opie-mailapplet
Files: plugins/applets/libmailapplet.so*
Priority: optional
Section: opie/applets
Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org>
Architecture: arm
-Version: 0.5-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal, libopiecore2, opie-mail
Description: A Biff-like mailchecker
License: LGPL
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
@@ -1,9 +1,9 @@
Package: opie-irc
Files: plugins/application/libopieirc.so* bin/opieirc pics/opieirc apps/Applications/opieirc.desktop help/en/html/opieirc.html help/en/html/opieirc
Priority: optional
Section: opie/applications
Maintainer: Wenzel Jakob <root@wazlaf.de>
Architecture: arm
-Depends: task-opie-minimal, libopie1
+Depends: task-opie-minimal, libopiecore2, libopieui2, libqtaux2
Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -1,9 +1,9 @@
Package: opie-rdesktop
Files: bin/ordesktop pics/opierdesktop apps/Applications/ordesktop.desktop
Priority: optional
Section: opie/applications
Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org>
Architecture: arm
-Version: 1.2.0-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal
Description: Remote Desktop Protocol (RDP) Client
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
@@ -4,9 +4,8 @@
#include <qpe/qpeapplication.h>
#include <opie2/oapplicationfactory.h>
#include "pindlg.h"
using namespace Opie::Core;
OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::PinDlg> )
-
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
@@ -1,10 +1,10 @@
Package: opie-bluepin
Files: plugins/application/libbluepin.so* bin/bluepin
Priority: optional
Section: opie/applications
Maintainer: Holger Freyther <zecke@handhelds.org>
Architecture: arm
-Version: 0.3.4-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal
License: GPL
Description: Bluetooth pin application
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
@@ -7,48 +7,33 @@
<name>name</name>
<cstring>Form1</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>258</width>
+ <width>254</width>
<height>245</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Please enter pin</string>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget>
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>txtStatus</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string></string>
- </property>
- <property stdset="1">
- <name>textFormat</name>
- <enum>RichText</enum>
- </property>
- </widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer4_2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
@@ -61,16 +46,31 @@
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>txtStatus</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>textFormat</name>
+ <enum>RichText</enum>
+ </property>
+ </widget>
+ <widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout6</cstring>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
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
@@ -1,10 +1,10 @@
Package: libopietooth1
Files: lib/libopietooth1.so*
Priority: optional
Section: libs
Maintainer: Maximilian Reiß <max.reiss@gmx.de>
Architecture: arm
Replaces: libopietooth
-Depends: libqte2 (>=2.3.4), libopie1, task-bluez
+Depends: libqte2 (>=2.3.4), libopiecore2, task-bluez
Description: Opie bluetooth library
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -1,10 +1,10 @@
Package: opie-bluetoothmanager
Files: plugins/application/libbluetooth-manager.so* bin/bluetooth-manager apps/Settings/bluetooth-manager.desktop pics/opietooth/*
Priority: optional
Section: opie/settings
Maintainer: Maximilian Reiß <max.reiss@gmx.de>
Architecture: arm
-Version: 0.5.4-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal, libopietooth1, opie-bluepin
License: GPL
Description: Bluetooth Manager application
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
@@ -1,10 +1,10 @@
Package: opie-wellenreiter
Files: bin/wellenreiter pics/wellenreiter apps/Applications/wellenreiter.desktop
Priority: optional
Section: opie/applications
Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org>
Architecture: arm
-Version: 1.0.3-cvs
-Depends: libqpe1, libpcap0 (>=0.7.2), libopiecore2, libopienet2, libopieui2
+Version: $QPE_VERSION$EXTRAVERSION
+Depends: libqpe1, libpcap0.8 (>=0.7.2), libopiecore2, libopienet2, libopieui2
Description: A WaveLAN Network Monitor
A WaveLAN Network Monitor/Sniffer for the Opie Environment.
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
@@ -1,11 +1,11 @@
Package: opie-multiauth-bluepingplugin
Files: plugins/security/libmultiauthbluepingplugin.so* pics/security/bluepingplugin.png root/etc/suspend-scripts/S50bluetooth
Priority: optional
Section: opie/settings
Maintainer: Clement Seveillac <clement@nist.gov>
Architecture: arm
-Version: 0.0.2.7
+Version: $QPE_VERSION$EXTRAVERSION
Depends: libopiecore2, opie-security, bluez-utils (<= 2.3rel-hh5)
Description: Blueping plugin for opie-security authentication.
This is a bluetooth-based authentication plugin (you need
to have another Bluetooth device around to use it).
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
@@ -1,11 +1,11 @@
Package: opie-multiauth-dummyplugin
Files: plugins/security/libmultiauthdummyplugin.so* pics/security/dummyplugin.png
Priority: optional
Section: opie/settings
Maintainer: Clement Seveillac <clement@nist.gov>
Architecture: arm
-Version: 0.0.2.3
+Version: $QPE_VERSION$EXTRAVERSION
Depends: libopiecore2, opie-security
Description: Dummy plugin for opie-security authentication.
This is a very simple authentication plugin (you just have
to press a button basically), for demonstration purpose.
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
@@ -1,11 +1,11 @@
Package: opie-multiauth-noticeplugin
Files: plugins/security/libmultiauthnoticeplugin.so* pics/security/noticeplugin.png pics/security/noticeplugin_small.png
Priority: optional
Section: opie/settings
Maintainer: Clement Seveillac <clement@nist.gov>
Architecture: arm
-Version: 0.0.1.6
+Version: $QPE_VERSION$EXTRAVERSION
Depends: libopiecore2, opie-security
Description: Notice plugin for opie-security authentication.
It allows you to display e.g. a notice from your legal departement.
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
@@ -1,11 +1,11 @@
Package: opie-multiauth-pinplugin
Files: plugins/security/libmultiauthpinplugin.so* pics/security/pinplugin.png
Priority: optional
Section: opie/settings
Maintainer: Clement Seveillac <clement@nist.gov>
Architecture: arm
-Version: 0.0.2.6
+Version: $QPE_VERSION$EXTRAVERSION
Depends: libopiecore2, opie-security
Description: PIN plugin for opie-security authentication.
Simple PIN-based authentication plugin (replicate the functionality
Qtopia has, or Opie used to have, without plugins).
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
@@ -17,31 +17,25 @@ MyCheckListItem::MyCheckListItem( NodeCollection * N, QListView * V ):
QCheckListItem( V, N->name() ) {
NC = N;
}
ActivateVPN::ActivateVPN( void ) :
ActivateVPNGUI( 0, 0, TRUE ), NSD() {
QCheckListItem * CI;
- printf( "%d\n", __LINE__ );
VPN_LV->clear();
VPN_LV->header()->hide();
- printf( "%d\n", __LINE__ );
for( QDictIterator<NodeCollection> it(NSResources->connections());
it.current();
++it ) {
- printf( "%d\n", __LINE__ );
if( it.current()->triggeredBy( "vpn" ) ) {
- printf( "%d\n", __LINE__ );
CI = new MyCheckListItem( it.current(), VPN_LV );
- printf( "%d\n", __LINE__ );
}
- printf( "%d\n", __LINE__ );
}
}
ActivateVPN::~ActivateVPN( void ) {
}
void ActivateVPN::SLOT_ChangedVPNSetting( QListViewItem * I ) {
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
@@ -1,22 +1,26 @@
TEMPLATE = lib
CONFIG += qt warn_on release
DESTDIR = $(OPIEDIR)/plugins/networksettings2
-HEADERS = bluetooth_NN.h \
+HEADERS = bluetoothBNEP_NN.h \
bluetoothBNEP_NNI.h \
+ bluetoothRFCOMM_NN.h \
bluetoothRFCOMM_NNI.h \
bluetoothBNEPedit.h \
+ bluetoothRFCOMMrun.h \
bluetoothRFCOMMedit.h
-SOURCES = bluetooth_NN.cpp \
+SOURCES = bluetoothBNEP_NN.cpp \
bluetoothBNEP_NNI.cpp \
+ bluetoothRFCOMM_NN.cpp \
bluetoothRFCOMM_NNI.cpp \
bluetoothBNEPedit.cpp \
bluetoothBNEPrun.cpp \
+ bluetoothRFCOMMrun.cpp \
bluetoothRFCOMMedit.cpp
-INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
-DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
-LIBS += -lqpe
+INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2
+DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2
+LIBS += -lqpe -lopietooth2
INTERFACES = bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui
TARGET = bluetooth
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
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
@@ -1,11 +1,11 @@
#include "bluetoothBNEPedit.h"
#include "bluetoothBNEP_NNI.h"
-#include "bluetooth_NN.h"
+#include "bluetoothBNEP_NN.h"
ABluetoothBNEP::ABluetoothBNEP( BluetoothBNEPNetNode * PNN ) :
ANetNodeInstance( PNN ), Data() {
GUI = 0;
RT = 0;
Data.AllowAll = 1;
}
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
@@ -1,11 +1,14 @@
#ifndef BLUETOOTHBNEP_DATA_H
#define BLUETOOTHBNEP_DATA_H
#include <qstringlist.h>
-typedef struct BluetoothBNEPData {
+class BluetoothBNEPData {
+
+public :
+
bool AllowAll;
QStringList BDAddress;
-} BluetoothBNEPData_t;
+};
#endif
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
@@ -1,249 +1,161 @@
#include <qfile.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include <resources.h>
#include "bluetoothBNEPrun.h"
-QDict<QString> * BluetoothBNEPRun::PANConnections = 0;
+BluetoothBNEPRun::BluetoothBNEPRun( ANetNodeInstance * NNI,
+ BluetoothBNEPData & D ) :
+ RuntimeInfo( NNI ),
+ Data( D),
+ Pat( "bnep[0-6]" ) {
+ OT = 0;
+}
-void BluetoothBNEPRun::detectState( NodeCollection * NC ) {
- // unavailable : no card found
- // available : card found and assigned to us or free
- // up : card found and assigned to us and up
- QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
- System & Sys = NSResources->system();
- InterfaceInfo * Run;
- QFile F( S );
-
- Log(("Detecting for %s\n", NC->name().latin1() ));
-
- if( F.open( IO_ReadOnly ) ) {
- // could open file -> read interface and assign
- QString X;
- bool accepted = 0;
- QTextStream TS(&F);
- X = TS.readLine();
- Log(("%s exists : %s\n", S.latin1(), X.latin1() ));
- // find interface
- if( handlesInterface( X ) ) {
-
- Log(("Handles interface %s, PANC %p\n", X.latin1(), PANConnections ));
- if( PANConnections == 0 ) {
- // load connections that are active
- // format : bnep0 00:60:57:02:71:A2 PANU
- FILE * OutputOfCmd = popen( "pand --show", "r" ) ;
-
- PANConnections = new QDict<QString>;
-
- if( OutputOfCmd ) {
- char ch;
- // could fork
- // read all data
- QString Line = "";
- while( 1 ) {
- if( fread( &ch, 1, 1, OutputOfCmd ) < 1 ) {
- // eof
- break;
- }
- if( ch == '\n' || ch == '\r' ) {
- if( ! Line.isEmpty() ) {
- if( Line.startsWith( "bnep" ) ) {
- QStringList SL = QStringList::split( " ", Line );
- Log(("Detected PAN %s %s\n",
- SL[0].latin1(), SL[1].latin1() ));
- PANConnections->insert( SL[0], new QString(SL[1]));
- }
- Line="";
- }
- } else {
- Line += ch;
- }
- }
- }
+BluetoothBNEPRun::~BluetoothBNEPRun( void ) {
+ if( OT ) {
+ OTGateway::releaseOTGateway();
+ }
+}
- pclose( OutputOfCmd );
- }
+State_t BluetoothBNEPRun::detectState( void ) {
- // check if this runtime allows connection to node
- if( ! Data.AllowAll ) {
- // has addresses
- for ( QStringList::Iterator it = Data.BDAddress.begin();
- ! accepted && it != Data.BDAddress.end();
- ++ it ) {
- for( QDictIterator<QString> it2( *(PANConnections) );
- it2.current();
- ++ it2 ) {
- if( X == it2.currentKey() &&
- (*it) == *(it2.current())
- ) {
- // found
- Log(("%s accepts connections to %s\n",
- NC->name().latin1(),
- it2.current()->latin1() ));
- accepted = 1;
- break;
- }
- }
- }
- } else {
- Log(("%s accepts any connection\n", NC->name().latin1() ));
- // accept any
- accepted = 1;
- }
+ /*
- if( accepted ) {
- // matches and is allowed for this node
- for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
- It.current();
- ++It ) {
- Run = It.current();
- if( X == Run->Name ) {
- Log(("%s Assigned %p\n", NC->name().latin1(), Run ));
- Run->assignNode( netNode() );
- assignInterface( Run );
- NC->setCurrentState( IsUp );
- return;
- }
- }
- }
- }
- }
-
- Log(("Assigned %p\n", assignedInterface() ));
- if( ( Run = assignedInterface() ) ) {
- // we already have an interface assigned -> still present ?
- if( ! Run->IsUp ) {
- // usb is still free -> keep assignment
- NC->setCurrentState( Available );
- return;
- } // else interface is up but NOT us -> some other profile
+ need to detect
+
+ 1. for any PAN connection that is found if that
+ PAN is connected.
+
+ if it is connected it is not available (since we do
+ not manage IP settings and we are called to detect
+ the state we knwo that we do not have an UP connection)
+
+ 2. if it not connected and we allow any connection we
+ are available or if that PAN connection is to a device
+ with a correct address
+
+ 3. if it is not connected and the address do not match or
+ we do not accept any address, we are Unavailable but
+ not DOWN. I.e a new connection could perhaps be created
+
+ */
+
+ if( ! OT ) {
+ OT = OTGateway::getOTGateway();
}
- // nothing (valid) assigned to us
- assignInterface( 0 );
-
- // find possible interface
- for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
- It.current();
- ++It ) {
- Run = It.current();
-
- Log(("%s %d %d=%d %d\n",
- Run->Name.latin1(),
- handlesInterface( Run->Name ),
- Run->CardType, ARPHRD_ETHER,
- ! Run->IsUp ));
-
- if( handlesInterface( Run->Name ) &&
- Run->CardType == ARPHRD_ETHER &&
- ! Run->IsUp
- ) {
- Log(("Released(OFF)\n" ));
- // proper type, and Not UP -> free
- NC->setCurrentState( Off );
- return;
- }
+ if( ! OT->isEnabled() ) {
+ return Unavailable;
}
- // no free found
- Log(("None available\n" ));
- NC->setCurrentState( Unavailable );
+ // if there is a PAN connection that is UP but not
+ // yet configured (no ifup) the we are available
+ return ( hasFreePANConnection() ) ? Available : Unknown;
}
-bool BluetoothBNEPRun::setState( NodeCollection * NC, Action_t A, bool ) {
+QString BluetoothBNEPRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
- // we only handle activate and deactivate
- switch( A ) {
- case Activate :
- {
- if( NC->currentState() != Off ) {
- return 0;
- }
- InterfaceInfo * N = getInterface();
- if( ! N ) {
- // no interface available
- NC->setCurrentState( Unavailable );
- return 0;
- }
- // because we were OFF the interface
- // we get back is NOT assigned
- N->assignNode( netNode() );
- assignInterface( N );
- Log(("Assing %p\n", N ));
- NC->setCurrentState( Available );
- return 1;
- }
- case Deactivate :
- if( NC->currentState() == IsUp ) {
- // bring down first
- if( ! connection()->setState( Down ) )
- // could not ...
- return 0;
- } else if( NC->currentState() != Available ) {
- return 1;
- }
- assignedInterface()->assignNode( 0 ); // release
- assignInterface( 0 );
- NC->setCurrentState( Off );
- return 1;
- default :
- // FT
- break;
+ if( A == Activate ) {
+ if( hasFreePANConnection( 1 ) ) {
+ // we have now an assignedinterface
+ } else {
+ return QString("TODO : Start PAND");
+ }
+
+ Log(( "Assigned interface" ));
+ NC->setCurrentState( Available );
+
+ return QString();
}
- return 0;
+
+ if( A == Deactivate ) {
+ // nothing to do
+ NC->setCurrentState( Off );
+ return QString();
+ }
+ return QString();
}
-bool BluetoothBNEPRun::canSetState( State_t Curr , Action_t A ) {
- // we only handle up down activate and deactivate
- switch( A ) {
- case Activate :
- { // at least available
- if( Curr == Available ) {
- return 1;
- }
- // or we can make one available
- InterfaceInfo * N = getInterface();
- if( ! N || N->assignedNode() != 0 ) {
- // non available or assigned
- return 0;
+bool BluetoothBNEPRun::handlesInterface( const QString & S ) {
+ return Pat.match( S ) >= 0;
+}
+
+bool BluetoothBNEPRun::handlesInterface( InterfaceInfo * I ) {
+ return handlesInterface( I->Name );
+}
+
+bool BluetoothBNEPRun::hasFreePANConnection( bool Grab ) {
+
+ if( ! OT ) {
+ OT = OTGateway::getOTGateway();
+ }
+
+ // load PAN connections
+ OTPANConnection * C;
+ InterfaceInfo * Run;
+ InterfaceInfo * Candidate = 0; // reuse this interface
+ PANConnectionVector Conns = OT->getPANConnections();
+ System & Sys = NSResources->system();
+ bool IsValid;
+
+ for( unsigned int i = 0;
+ i < Conns.count();
+ i ++ ) {
+ C = Conns[i];
+
+ if( Data.AllowAll ) {
+ // we allow all
+ IsValid = 1;
+ } else {
+ // is this PAN connection connecting to a Peer
+ // we allow ?
+ IsValid = 0;
+ for ( QStringList::Iterator it = Data.BDAddress.begin();
+ it != Data.BDAddress.end();
+ ++ it ) {
+ if( C->ConnectedTo == (*it) ) {
+ // this is a connection we could accept
+ IsValid = 1;
+ break;
}
- return 1;
}
- case Deactivate :
- return ( Curr >= Available );
- default :
- // FT
- break;
+ }
+
+ if( ! IsValid ) {
+ Log(("%s to %s not acceptable\n",
+ C->Device.latin1(),
+ C->ConnectedTo.latin1() ));
+ // don't bother checking this address
+ // it is not acceptable
+ continue;
+ }
+
+ // is this PAN connection available to us ?
+ Run = Sys.findInterface( C->Device );
+
+ if( Run && Run->IsUp ) {
+ // this PAN connection is up
+ Log(("%s acceptable but unavailable\n",
+ C->Device.latin1() ));
+ // find others
+ continue;
+ }
+
+ // we at least have a possible interface
+ if( ! Candidate ) {
+ Candidate = Run;
+ }
}
- return 0;
-}
-// get interface that is free or assigned to us
-InterfaceInfo * BluetoothBNEPRun::getInterface( void ) {
-
- System & S = NSResources->system();
- InterfaceInfo * best = 0, * Run;
-
- for( QDictIterator<InterfaceInfo> It(S.interfaces());
- It.current();
- ++It ) {
- Run = It.current();
- if( handlesInterface( Run->Name ) &&
- Run->CardType == ARPHRD_ETHER
- ) {
- // this is a bluetooth card
- if( Run->assignedNode() == netNode() ) {
- // assigned to us
- return Run;
- } else if( Run->assignedNode() == 0 ) {
- // free
- best = Run;
- }
+ if( Candidate ) {
+ if ( Grab ) {
+ netNode()->connection()->assignInterface( Candidate );
}
+ return 1;
}
- return best; // can be 0
-}
-bool BluetoothBNEPRun::handlesInterface( const QString & S ) {
- return Pat.match( S ) >= 0;
+ // no free PAN
+ return 0;
}
+
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,34 +1,35 @@
-#include <asdevice.h>
+#include <netnode.h>
#include "bluetoothBNEPdata.h"
-class BluetoothBNEPRun : public AsDevice {
+#include <OTGateway.h>
+using namespace Opietooth2;
+
+class BluetoothBNEPRun : public RuntimeInfo {
public :
BluetoothBNEPRun( ANetNodeInstance * NNI,
- BluetoothBNEPData & D ) :
- AsDevice( NNI ),
- Data( D),
- Pat( "bnep[0-6]" )
- { }
+ BluetoothBNEPData & D );
+ virtual ~BluetoothBNEPRun( void );
+
+ // i am a device
+ virtual RuntimeInfo * device( void )
+ { return this; }
- virtual AsDevice * asDevice( void )
- { return (AsDevice *)this; }
+ bool handlesInterface( const QString & );
+ bool handlesInterface( InterfaceInfo * );
- virtual AsDevice * device( void )
- { return asDevice(); }
+ State_t detectState( void );
protected :
- void detectState( NodeCollection * );
- bool setState( NodeCollection * , Action_t, bool );
- bool canSetState( State_t , Action_t );
- bool handlesInterface( const QString & );
+ QString setMyState( NodeCollection * , Action_t, bool );
private :
- InterfaceInfo * getInterface( void );
+ bool hasFreePANConnection( bool Grab = 0 );
+
BluetoothBNEPData & Data;
- static QDict<QString> * PANConnections;
+ OTGateway * OT;
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
@@ -6,126 +6,326 @@
<name>name</name>
<cstring>BluetoothRFCOMM_FRM</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>283</width>
- <height>199</height>
+ <width>488</width>
+ <height>604</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Bluetooth-rfcomm</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>2</number>
+ <number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>2</number>
+ <number>3</number>
</property>
<widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel5_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Selected devices with gprs capability</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>WordBreak|AlignVCenter|AlignLeft</set>
+ </property>
+ <property>
+ <name>wordwrap</name>
+ </property>
+ </widget>
+ <widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout4</cstring>
+ <cstring>Layout8</cstring>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>3</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel4</cstring>
+ <cstring>TextLabel5</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Name</string>
+ <string>Address</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>Name_LE</cstring>
+ <cstring>Address_LE</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>FindDevice_TB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>...</string>
</property>
</widget>
</hbox>
</widget>
<widget>
- <class>QLabel</class>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel3</cstring>
+ <cstring>Layout7</cstring>
</property>
- <property stdset="1">
- <name>text</name>
- <string>Description</string>
- </property>
- </widget>
- <widget>
- <class>QMultiLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Description_LE</cstring>
+ <property>
+ <name>layoutSpacing</name>
</property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>3</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Channel</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Channel_SB</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Name</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Name_LBL</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>Box</enum>
+ </property>
+ <property stdset="1">
+ <name>indent</name>
+ <number>0</number>
+ </property>
+ </widget>
+ </hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout5</cstring>
</property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>3</number>
</property>
<widget>
- <class>QCheckBox</class>
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>Automatic_CB</cstring>
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
</property>
<property stdset="1">
<name>text</name>
- <string>Start automatically</string>
+ <string>Addresses</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ <property>
+ <name>vAlign</name>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Add_TB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>...</string>
</property>
</widget>
<widget>
- <class>QCheckBox</class>
+ <class>QToolButton</class>
<property stdset="1">
<name>name</name>
- <cstring>Confirm_CB</cstring>
+ <cstring>Remove_TB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Confirm before start</string>
+ <string>...</string>
</property>
</widget>
</hbox>
</widget>
+ <widget>
+ <class>QListView</class>
+ <column>
+ <property>
+ <name>text</name>
+ <string>Name</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property>
+ <name>text</name>
+ <string>Channel</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property>
+ <name>text</name>
+ <string>Address</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Addresses_LV</cstring>
+ </property>
+ <property stdset="1">
+ <name>allColumnsShowFocus</name>
+ <bool>true</bool>
+ </property>
+ </widget>
</vbox>
</widget>
+<connections>
+ <connection>
+ <sender>Add_TB</sender>
+ <signal>clicked()</signal>
+ <receiver>BluetoothRFCOMM_FRM</receiver>
+ <slot>SLOT_AddServer()</slot>
+ </connection>
+ <connection>
+ <sender>Remove_TB</sender>
+ <signal>clicked()</signal>
+ <receiver>BluetoothRFCOMM_FRM</receiver>
+ <slot>SLOT_RemoveServer()</slot>
+ </connection>
+ <connection>
+ <sender>FindDevice_TB</sender>
+ <signal>clicked()</signal>
+ <receiver>BluetoothRFCOMM_FRM</receiver>
+ <slot>SLOT_FindDevice()</slot>
+ </connection>
+ <slot access="public">SLOT_AddServer()</slot>
+ <slot access="public">SLOT_RemoveServer()</slot>
+ <slot access="public">SLOT_FindDevice()</slot>
+</connections>
</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
@@ -1,21 +1,40 @@
#include "bluetoothRFCOMMedit.h"
#include "bluetoothRFCOMM_NNI.h"
-#include "bluetooth_NN.h"
+#include "bluetoothRFCOMM_NN.h"
-ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) : ANetNodeInstance( PNN ) {
- GUI = 0;
- RT = 0;
+ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) :
+ ANetNodeInstance( PNN ), Data() {
+ Data.Devices.setAutoDelete( TRUE );
+ GUI = 0;
+ RT = 0;
}
-void ABluetoothRFCOMM::setSpecificAttribute( QString & , QString & ) {
+void ABluetoothRFCOMM::setSpecificAttribute( QString & A, QString & V) {
+
+ if( A == "bdaddress" ) {
+ Data.Devices.resize( Data.Devices.size() + 1 );
+ Data.Devices.insert( Data.Devices.size() - 1, new RFCOMMChannel);
+ Data.Devices[ Data.Devices.size() - 1 ]->BDAddress = V;
+ } else if ( A == "channel" ) {
+ Data.Devices[ Data.Devices.size() - 1 ]->Channel = V.toLong();
+ } else if ( A == "name" ) {
+ Data.Devices[ Data.Devices.size() - 1 ]->Name = V;
+ }
}
-void ABluetoothRFCOMM::saveSpecificAttribute( QTextStream & ) {
+void ABluetoothRFCOMM::saveSpecificAttribute( QTextStream & TS ) {
+ for( unsigned int i = 0 ;
+ i < Data.Devices.count();
+ i ++ ) {
+ TS << "bdaddress=" << Data.Devices[i]->BDAddress << endl;
+ TS << "name=" << quote( Data.Devices[i]->Name ) << endl;
+ TS << "channel=" << Data.Devices[i]->Channel << endl;
+ }
}
QWidget * ABluetoothRFCOMM::edit( QWidget * parent ) {
GUI = new BluetoothRFCOMMEdit( parent );
GUI->showData( Data );
return GUI;
}
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
@@ -1,18 +1,22 @@
#ifndef BLUETOOTHRFCOMM_DATA_H
#define BLUETOOTHRFCOMM_DATA_H
#include <qstring.h>
+#include <qvector.h>
-typedef struct BluetoothRFCOMMData {
- QString Device;
- QString LockFile;
- long Speed;
- short Parity;
- short DataBits;
- short StopBits;
- bool HardwareControl;
- bool SoftwareControl;
+class RFCOMMChannel {
-} BluetoothRFCOMMData_t;
+public :
+ QString BDAddress;
+ QString Name;
+ int Channel;
+};
+
+class BluetoothRFCOMMData {
+
+public :
+
+ QVector<RFCOMMChannel> Devices;
+};
#endif
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,18 +1,156 @@
+#include <qlistview.h>
+#include <qdialog.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qtoolbutton.h>
+#include <qcheckbox.h>
+#include <qspinbox.h>
+#include <OTPeer.h>
+#include <OTGateway.h>
+#include <Opietooth.h>
+#include <resources.h>
#include <GUIUtils.h>
#include "bluetoothRFCOMMedit.h"
+using namespace Opietooth2;
+
+class PeerLBI : public QListViewItem {
+
+public :
+
+ PeerLBI( OTPeer * P, int Ch, QListView * LV ) : QListViewItem( LV ) {
+ Peer = P;
+ Channel = Ch;
+
+ setText( 0, (P->name().isEmpty()) ?
+ P->address().toString() :
+ P->name() );
+ QString S;
+ S.setNum( Ch );
+ setText( 1, S );
+ setText( 2, P->address().toString() );
+ }
+ ~PeerLBI( ) {
+ }
+
+ inline int channel( void ) const
+ { return Channel; }
+ inline OTPeer * peer( void ) const
+ { return Peer; }
+
+ int Channel;
+ OTPeer * Peer;
+};
+
BluetoothRFCOMMEdit::BluetoothRFCOMMEdit( QWidget * Parent ) :
BluetoothRFCOMMGUI( Parent ){
+ Modified = 0;
+ OT = OTGateway::getOTGateway();
+
+ Add_TB->setPixmap( NSResources->getPixmap( "add" ) );
+ Remove_TB->setPixmap( NSResources->getPixmap( "remove" ) );
+ FindDevice_TB->setPixmap( NSResources->getPixmap( "Devices/bluetooth" ) );
+ Addresses_LV->setColumnAlignment( 1, Qt::AlignRight );
+}
+BluetoothRFCOMMEdit::~BluetoothRFCOMMEdit( void ) {
+ OTGateway::releaseOTGateway();
}
QString BluetoothRFCOMMEdit::acceptable( void ) {
- return QString();
+ return QString();
+}
+
+bool BluetoothRFCOMMEdit::commit( BluetoothRFCOMMData & Data ) {
+ int ct = 0;
+ PeerLBI * I;
+
+ if( Modified ) {
+ QListViewItem * it = Addresses_LV->firstChild();
+
+ Data.Devices.resize( 0 );
+ while( it ) {
+
+ ct ++;
+ Data.Devices.resize( ct );
+ I = (PeerLBI * )it;
+
+ Data.Devices.insert( ct-1, new RFCOMMChannel );
+
+ Data.Devices[ct-1]->BDAddress = I->peer()->address().toString();
+ Data.Devices[ct-1]->Name = I->peer()->name();
+ Data.Devices[ct-1]->Channel = I->channel();
+
+ it = it->nextSibling();
+ }
+ }
+
+ return Modified;
}
void BluetoothRFCOMMEdit::showData( BluetoothRFCOMMData & Data ) {
+
+ OTPeer * P;
+
+ for( unsigned int i = 0;
+ i < Data.Devices.count();
+ i ++ ) {
+ P = new OTPeer( OT );
+ P->setAddress( OTDeviceAddress( Data.Devices[i]->BDAddress ) );
+ P->setName( Data.Devices[i]->Name );
+
+ new PeerLBI( P, Data.Devices[i]->Channel, Addresses_LV );
+ }
+ Modified = 0;
}
-bool BluetoothRFCOMMEdit::commit( BluetoothRFCOMMData & Data ) {
- return 0;
+void BluetoothRFCOMMEdit::SLOT_AddServer( void ) {
+ QListViewItem * it = Addresses_LV->firstChild();
+
+ while( it ) {
+ // check address
+ if( it->text(2) == Address_LE->text() ) {
+ // already in table
+ return;
+ }
+ it = it->nextSibling();
+ }
+
+ // new server
+ Modified = 1;
+ OTPeer * P = new OTPeer( OT );
+ P->setAddress( OTDeviceAddress( Address_LE->text() ) );
+ P->setName( Name_LBL->text() );
+ new PeerLBI( P, Channel_SB->value(), Addresses_LV );
+
+ Address_LE->setText("");
+ Name_LBL->setText("");
+ Channel_SB->setValue(1);
+}
+
+void BluetoothRFCOMMEdit::SLOT_RemoveServer( void ) {
+
+ QListViewItem * it = Addresses_LV->firstChild();
+
+ while( it ) {
+ // check address
+ if( it->isSelected() ) {
+ delete it;
+ Modified = 1;
+ return;
+ }
+ it = it->nextSibling();
+ }
+}
+
+void BluetoothRFCOMMEdit::SLOT_FindDevice( void ) {
+ OTPeer * Peer;
+ int Channel;
+
+ // find device in Opietooth
+ if( OTScan::getDevice( Peer, Channel, OT ) == QDialog::Accepted ) {
+ Address_LE->setText( Peer->address().toString() );
+ Name_LBL->setText( Peer->name() );
+ Channel_SB->setValue( Channel );
+ }
}
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
@@ -1,13 +1,27 @@
#include "bluetoothRFCOMMdata.h"
#include "bluetoothRFCOMMGUI.h"
+#include <Opietooth.h>
+using namespace Opietooth2;
+
class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI {
public :
BluetoothRFCOMMEdit( QWidget * parent );
+ virtual ~BluetoothRFCOMMEdit( void );
QString acceptable( void );
void showData( BluetoothRFCOMMData & Data );
bool commit( BluetoothRFCOMMData & Data );
+
+ bool Modified;
+ OTGateway * OT;
+
+public slots :
+
+ void SLOT_AddServer( void );
+ void SLOT_RemoveServer( void );
+ void SLOT_FindDevice( void );
+
};
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,28 +1,33 @@
-#include <asline.h>
+#include <netnode.h>
#include "bluetoothRFCOMMdata.h"
-class BluetoothRFCOMMRun : public AsLine {
+#include <OTGateway.h>
+using namespace Opietooth2;
+
+class BluetoothRFCOMMRun : public RuntimeInfo {
public :
BluetoothRFCOMMRun( ANetNodeInstance * NNI,
- BluetoothRFCOMMData & Data ) : AsLine( NNI )
- { }
+ BluetoothRFCOMMData & D ) : RuntimeInfo( NNI )
+ { DeviceNr = -1; Data = &D; OT = 0; }
+ virtual ~BluetoothRFCOMMRun( void );
- virtual AsLine * asLine( void )
- { return (AsLine *)this; }
+ virtual RuntimeInfo * line( void )
+ { return this; }
+ virtual QString deviceFile( void );
- virtual QString deviceFile( void )
- { return QString( "/dev/rfcomm..." ); }
+ State_t detectState( void );
protected :
- void detectState( NodeCollection * )
- { }
+ QString setMyState( NodeCollection * , Action_t, bool );
- bool setState( NodeCollection * , Action_t, bool )
- { return 0; }
+private :
- bool canSetState( State_t , Action_t )
- { return 0; }
+ int deviceNrOfConnection( void );
+ RFCOMMChannel * getChannel( void );
+ BluetoothRFCOMMData * Data;
+ Opietooth2::OTGateway * OT;
+ int DeviceNr; // cached from detection
};
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
@@ -7,16 +7,21 @@
// BLUETOOTH PAN/NAP node
//
//
static const char * BluetoothBNEPNeeds[] =
{ 0
};
+static const char * BluetoothBNEPProvides[] =
+ { "device",
+ 0
+ };
+
/**
* Constructor, find all of the possible interfaces
*/
BluetoothBNEPNetNode::BluetoothBNEPNetNode() :
ANetNode(tr("Bluetooth PAN/NAP")) {
InstanceCount = 7; // default
}
@@ -37,18 +42,18 @@ const QString BluetoothBNEPNetNode::nodeDescription(){
ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) {
return new ABluetoothBNEP( this );
}
const char ** BluetoothBNEPNetNode::needs( void ) {
return BluetoothBNEPNeeds;
}
-const char * BluetoothBNEPNetNode::provides( void ) {
- return "device";
+const char ** BluetoothBNEPNetNode::provides( void ) {
+ return BluetoothBNEPProvides;
}
QString BluetoothBNEPNetNode::genNic( long nr ) {
QString S;
return S.sprintf( "bnep%ld", nr );
}
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
@@ -17,17 +17,17 @@ public:
virtual QString genNic( long );
virtual long instanceCount( void )
{ return InstanceCount; }
virtual const QString pixmapName()
{ return "Devices/bluetooth"; }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
virtual const char ** needs( void );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
// number of interfaces for this device
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
@@ -1,4 +1,4 @@
config NS2BT
boolean "opie-networksettings2plugin-bluetooth (set up BLUETOOTH)"
default "n" if NS2
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE
+ 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,9 +1,9 @@
-Package: opie-networksettingsplugin2-bluetooth
+Package: opie-networksettings2plugin-bluetooth
Files: plugins/networksettings2/libbluetooth.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
-Depends: opie-networksettings2, libopiecore2, libopienet2
+Depends: opie-networksettings2, libopietooth2, libopiecore2, libopienet2
Description: Network settings bluetooth plugin.
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -1,15 +1,20 @@
#include "cable_NN.h"
#include "cable_NNI.h"
static const char * CableNeeds[] =
{ 0
};
+static const char * CableProvides[] =
+ { "line",
+ 0
+ };
+
/**
* Constructor, find all of the possible interfaces
*/
CableNetNode::CableNetNode() : ANetNode(tr("Cable Connection")) {
}
/**
* Delete any interfaces that we own.
@@ -27,18 +32,18 @@ const QString CableNetNode::nodeDescription(){
ANetNodeInstance * CableNetNode::createInstance( void ) {
return new ACable( this );
}
const char ** CableNetNode::needs( void ) {
return CableNeeds;
}
-const char * CableNetNode::provides( void ) {
- return "line";
+const char ** CableNetNode::provides( void ) {
+ return CableProvides;
}
void CableNetNode::setSpecificAttribute( QString & , QString & ) {
}
void CableNetNode::saveSpecificAttribute( QTextStream & ) {
}
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
@@ -15,17 +15,17 @@ public:
virtual ~CableNetNode();
virtual const QString pixmapName()
{ return "Devices/cable"; }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
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
@@ -44,35 +44,33 @@ void ACable::saveSpecificAttribute( QTextStream & TS ) {
TS << "databits=" << Data.DataBits << endl;
TS << "stopbits=" << Data.StopBits << endl;
TS << "hardwarecontrol=" <<
((Data.HardwareControl) ? "yes" : "no") << endl;
TS << "softwarecontrol=" <<
((Data.SoftwareControl) ? "yes" : "no") << endl;
}
-short ACable::generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+short ACable::generateFileEmbedded( SystemFile & SF,
long DevNr ) {
short rvl, rvd;
rvl = 1;
- if( ID == "peers" ) {
- TS << Data.Device
+ if( SF.name() == "peers" ) {
+ SF << Data.Device
<< endl;
- TS << Data.Speed
+ SF << Data.Speed
<< endl;
- TS << "lock "
+ SF << "lock "
<< Data.LockFile
<< endl;
rvl = 0;
}
- rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
+ rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr );
return (rvd == 2 || rvl == 2 ) ? 2 :
(rvd == 0 || rvl == 0 ) ? 0 : 1;
}
QWidget * ACable::edit( QWidget * parent ) {
GUI = new CableEdit( parent );
GUI->showData( Data );
return GUI;
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
@@ -21,26 +21,24 @@ public :
QWidget * edit( QWidget * parent );
QString acceptable( void );
void commit( void );
virtual void * data( void )
{ return (void *)&Data; }
- short generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ short generateFileEmbedded( SystemFile & Sf,
long DevNr );
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
private :
CableEdit * GUI;
- CableData_t Data;
+ CableData Data;
CableRun * RT;
};
#endif
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
@@ -1,18 +1,21 @@
#ifndef CABLE_DATA_H
#define CABLE_DATA_H
#include <qstring.h>
-typedef struct CableData {
+class CableData {
+
+public :
+
QString Device;
QString LockFile;
long Speed;
short Parity;
short DataBits;
short StopBits;
bool HardwareControl;
bool SoftwareControl;
-} CableData_t;
+};
#endif
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
@@ -12,17 +12,17 @@ static long SpeedTable[] = {
230400, 460800, 500000, 921600, 1000000,
1152000, 1500000, 2000000, 2500000, 3000000,
3500000, 4000000, -1
};
CableEdit::CableEdit( QWidget * Parent ) : CableGUI( Parent ) {
}
-void CableEdit::showData( CableData_t & D ) {
+void CableEdit::showData( CableData & D ) {
DeviceFile_LE->setText( D.Device );
LockFile_LE->setText( D.LockFile );
for( long * Run = SpeedTable; *Run != -1; *Run ++ ) {
if( *Run == D.Speed ) {
Speed_CB->setCurrentItem(
((long)(Run)-(long)(SpeedTable))/sizeof(long) );
break;
}
@@ -35,17 +35,17 @@ void CableEdit::showData( CableData_t & D ) {
}
QString CableEdit::acceptable( void ) {
if( DeviceFile_LE->text().isEmpty() )
return tr("Device filename needed");
return QString();
}
-bool CableEdit::commit( CableData_t & D ) {
+bool CableEdit::commit( CableData & D ) {
bool SM = 0;
TXTM( D.Device, DeviceFile_LE, SM );
TXTM( D.LockFile, LockFile_LE, SM );
for( long * Run = SpeedTable; *Run != -1; *Run ++ ) {
if( *Run == D.Speed ) {
if( D.Speed != Speed_CB->currentText().toLong() ) {
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
@@ -2,11 +2,11 @@
#include "cableGUI.h"
class CableEdit : public CableGUI {
public :
CableEdit( QWidget * parent );
QString acceptable( void );
- bool commit( CableData_t & D );
- void showData( CableData_t & D );
+ bool commit( CableData & D );
+ void showData( CableData & D );
};
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
@@ -1,30 +1,22 @@
#include <fcntl.h>
#include <unistd.h>
#include "cablerun.h"
-void CableRun::detectState( NodeCollection * NC ) {
+State_t CableRun::detectState( void ) {
int fd = open( Data->Device.latin1(), O_RDWR );
if( fd < 0 ) {
- NC->setCurrentState( Unavailable );
+ return Unavailable;
}
close( fd );
- NC->setCurrentState( Available );
+ return Available;
}
-bool CableRun::setState( NodeCollection * NC, Action_t A, bool ) {
- if( A == Activate ) {
- detectState(NC);
- return (NC->currentState() == Available);
- }
- return 1;
-}
-
-bool CableRun::canSetState( State_t , Action_t ) {
- return 1;
+QString CableRun::setMyState( NodeCollection *, Action_t , bool ) {
+ return QString();
}
QString CableRun::deviceFile( void ) {
return Data->Device;
}
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,26 +1,26 @@
-#include <asline.h>
+#include <netnode.h>
#include "cabledata.h"
-class CableRun : public AsLine {
+class CableRun : public RuntimeInfo {
public :
CableRun( ANetNodeInstance * NNI,
- CableData_t & D ) : AsLine( NNI )
+ CableData & D ) : RuntimeInfo( NNI )
{ Data = &D; }
- virtual AsLine * asLine( void )
- { return (AsLine *)this; }
+ virtual RuntimeInfo * line( void )
+ { return this; }
virtual QString deviceFile( void );
+ State_t detectState( void );
+
protected :
- void detectState( NodeCollection * NC );
- bool setState( NodeCollection * NC, Action_t A, bool Force );
- bool canSetState( State_t Curr, Action_t A );
+ QString setMyState( NodeCollection * , Action_t, bool );
private :
- CableData_t * Data;
+ CableData * Data;
};
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,9 +1,9 @@
-Package: opie-networksettingsplugin2-bluetooth
+Package: opie-networksettings2plugin-cable
Files: plugins/networksettings2/libcable.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
Description: Network settings cable plugin.
Version: $QPE_VERSION$EXTRAVERSION
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,18 +1,21 @@
source noncore/settings/networksettings2/networksettings2/config.in
+ source noncore/settings/networksettings2/opietooth2/config.in
+ source noncore/settings/networksettings2/opietooth2_applet/config.in
config NS2
boolean
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE && NS2OPIETOOTH
source noncore/settings/networksettings2/profile/config.in
source noncore/settings/networksettings2/network/config.in
source noncore/settings/networksettings2/lancard/config.in
source noncore/settings/networksettings2/ppp/config.in
source noncore/settings/networksettings2/wlan/config.in
source noncore/settings/networksettings2/usb/config.in
source noncore/settings/networksettings2/irda/config.in
source noncore/settings/networksettings2/vpn/config.in
source noncore/settings/networksettings2/bluetooth/config.in
source noncore/settings/networksettings2/cable/config.in
source noncore/settings/networksettings2/modem/config.in
+ 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,8 +1,9 @@
+#include <opie2/odebug.h>
#include <qlistview.h>
#include <qwidgetstack.h>
#include <qframe.h>
#include <qcombobox.h>
#include <qtabwidget.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qlineedit.h>
@@ -26,16 +27,23 @@ class MyQCheckListItem : public QCheckListItem
public:
MyQCheckListItem( QListView *parent, const QString & S, Type T ) :
QCheckListItem( parent, S, T ) { }
MyQCheckListItem( QCheckListItem *parent, const QString & S, Type T ) :
QCheckListItem( parent, S, T ) { }
MyQCheckListItem( QListViewItem *parent, const QString & S, Type T ) :
QCheckListItem( parent, S, T ) { }
+ MyQCheckListItem( QListView *parent, const QString & S ) :
+ QCheckListItem( parent, S, QCheckListItem::Controller ) { }
+ MyQCheckListItem( QCheckListItem *parent, const QString & S ) :
+ QCheckListItem( parent, S, QCheckListItem::Controller ) { }
+ MyQCheckListItem( QListViewItem *parent, const QString & S ) :
+ QCheckListItem( parent, S, QCheckListItem::Controller ) { }
+
virtual void paintCell( QPainter *p, const QColorGroup &cg,
int column, int width, int alignment );
};
void MyQCheckListItem::paintCell( QPainter *p, const QColorGroup &cg,
int column, int width, int alignment )
{
@@ -111,58 +119,80 @@ NodeCollection * EditConnection::getTmpCollection( void ) {
delete it.current();
}
}
TmpCollection.clear();
// update content
QListViewItem * it = Nodes_LV->firstChild();
ANetNode * NN;
- // start iter
+
+ // start iter (if there is a collection)
+ /*
+
+ a node collection is sorted from the toplevel
+ node to the deepest node
+
+ */
ANetNodeInstance * NNI =
(SelectedNodes) ? SelectedNodes->first() : 0 ;
TmpCollection.setModified( 0 );
+ // the listview always starts with the toplevel
+ // hierarchy. This is always a controller item
while ( it ) {
NN = (*Mapping)[it];
if( NN == 0 ) {
- // child is controller -> has sub radio
- // check if one radio is selected
+ // this item is a controller ->
+ // has radio items as children ->
+ // find selected one
it = it->firstChild();
while( it ) {
if( ((QCheckListItem *)it)->isOn() ) {
// this radio is selected -> go deeper
- if( SelectedNodes == 0 ||
- NNI == 0 ||
- it->text(0) != NNI->nodeClass()->name() ) {
- // new item not in previous collection
- ANetNodeInstance * NNI = (*Mapping)[it]->createInstance();
- NNI->initialize();
- // this node type not in collection
- TmpCollection.append( NNI );
- // master collection changed because new item in it
- TmpCollection.setModified( 1 );
- // no more valid items in old list
- NNI = 0;
- } else {
- // already in list -> copy pointer
- TmpCollection.append( NNI );
- NNI = SelectedNodes->next();
- }
- it = it->firstChild();
- // do not bother to check other items
break;
}
it = it->nextSibling();
}
+
+ if( ! it ) {
+ owarn << "Radio not selected" << oendl;
+ TmpIsValid = 0;
+ return 0;
+ }
+
+ // it now contains selected radio
+ NN = (*Mapping)[it];
+ }
+
+ // NN here contains the netnode of the
+ // current item -> this node needs to
+ // be stored in the collection
+ if( NNI == 0 ||
+ it->text(0) != NNI->nodeClass()->name() ) {
+ // new item not in previous collection
+ ANetNodeInstance * NNI = NN->createInstance();
+ NNI->initialize();
+ // this node type not in collection
+ TmpCollection.append( NNI );
+ // master collection changed because new item in it
+ TmpCollection.setModified( 1 );
+ // no more valid items in old list
+ NNI = 0;
} else {
- // check children
- it = it->firstChild();
+ // already in list -> copy pointer
+ TmpCollection.append( NNI );
+ NNI = SelectedNodes->next();
}
+
+ // go deeper to next level
+ // this level is can be a new controller
+ // or an item
+ it = it->firstChild();
}
TmpIsValid = 1;
return &(TmpCollection);
}
// pass a connection NodeCollection to be edited
void EditConnection::setConnection( NodeCollection * NC ) {
@@ -182,50 +212,70 @@ void EditConnection::setConnection( NodeCollection * NC ) {
// select items in collection
QListViewItem * it = Nodes_LV->firstChild();
bool Found;
TmpIsValid = 0;
while ( it ) {
- // listitem corresponds to netnode
NN = (*Mapping)[it];
if( NN == 0 ) {
- // child is controller -> has sub radio
- QString Ctr = it->text(0);
- // check if one radio is selected
+ // this item is a controller ->
+ // has radio items as children ->
+ // find selected one
it = it->firstChild();
Found = 0;
while( it ) {
if( NNI && it->text(0) == NNI->nodeClass()->name() ) {
// this radio is part of the collection
((QCheckListItem *)it)->setOn( 1 );
updateGUI( it, NNI->nodeClass() );
// check its children
Found = 1;
it = it->firstChild();
NNI = SelectedNodes->next();
// do not bother to check other items
break;
}
it = it->nextSibling();
}
+
if( ! Found ) {
// this means that this level is NOT present in collection
// probably INCOMPATIBEL collection OR Missing plugin
QMessageBox::warning(
0,
tr( "Error presentig Connection" ),
tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ).
- arg(Ctr) );
+ arg(NNI->nodeClass()->name()) );
return;
}
+
+ // it now contains selected radio
+ NN = (*Mapping)[it];
} else {
- // automatic item -> check children
+ // automatic selection
+ if( NNI == 0 || it->text(0) != NNI->nodeClass()->name() ) {
+ // should exist and be the same
+ if( NNI ) {
+ QMessageBox::warning(
+ 0,
+ tr( "Error presentig Connection" ),
+ tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ).
+ arg(NNI->nodeClass()->name()) );
+ } else {
+ QMessageBox::warning(
+ 0,
+ tr( "Error presentig Connection" ),
+ tr( "<p>Missing connection\"<i>%1</i>\"</p>" ).
+ arg(it->text(0)) );
+ }
+ return;
+ }
it = it->firstChild();
}
}
}
// get result of editing (either new OR updated collection
NodeCollection * EditConnection::connection( void ) {
@@ -264,47 +314,49 @@ void EditConnection::buildFullTree( void ) {
Nodes_LV,
NSResources->netNode2Name("fullsetup"),
QCheckListItem::Controller );
TheTop->setOpen( TRUE );
Description_LBL->setText(
NSResources->netNode2Description( "fullsetup" ) );
Nodes_LV->setSelected( TheTop, TRUE );
- // find all Nodes that care toplevel nodes -> ie provide
+ // find all Nodes that are toplevel nodes -> ie provide
// TCP/IP Connection
for( QDictIterator<NetNode_t> Iter(NSResources->netNodes());
Iter.current();
++Iter ) {
NN = Iter.current()->NetNode;
if( ! NN->isToplevel() ) {
continue;
}
MyQCheckListItem * it = new MyQCheckListItem( TheTop,
NN->name(),
QCheckListItem::RadioButton );
- it->setPixmap( 0, NSResources->getPixmap( "Devices/commprofile" ) );
+ it->setPixmap( 0,
+ NSResources->getPixmap( NN->pixmapName() )
+ );
// remember that this node maps to this listitem
Mapping->insert( it, NN );
buildSubTree( it, NN );
}
}
// Build device tree -> help function
void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) {
ANetNode::NetNodeList & NNL = NN->alternatives();
if( NNL.size() > 1 ) {
// this node has alternatives -> needs radio buttons
it = new MyQCheckListItem(
it,
- NSResources->netNode2Name(NNL[0]->provides()),
+ NSResources->netNode2Name(NN->needs()[0]),
QCheckListItem::Controller );
it->setSelectable( FALSE );
}
for ( unsigned int i=0; i < NNL.size(); i++ ) {
QListViewItem * CI;
if( NNL.size() > 1 ) {
// generate radio buttons
@@ -382,20 +434,21 @@ void EditConnection::SLOT_SelectNode( QListViewItem * it ) {
return;
}
// store conversion from lvitem to node
NN = (*Mapping)[ it ];
if( ! NN ) {
// intermediate node
- NN = (*Mapping)[ it->firstChild() ];
+ NN = (*Mapping)[ it->parent() ];
if( NN ) {
// figure out type of this node -> produce mesage
- Description_LBL->setText( NSResources->netNode2Description(NN->provides()) );
+ Description_LBL->setText( NSResources->netNode2Description(
+ NN->needs()[0]) );
} else {
Description_LBL->setText( "" );
}
return;
}
Description_LBL->setText( NN->nodeDescription() );
@@ -534,44 +587,45 @@ void EditConnection::enablePath( QListViewItem * it, bool pha ) {
enablePath( it->firstChild(), pha );
}
it = it->nextSibling();
}
}
// do we have a complete configuration (all needs are provided for ?)
bool EditConnection::haveCompleteConfig( QListViewItem * it ) {
- if( it == 0 || ((QCheckListItem *)it)->isOn() ) {
- // check children
- it = (it) ? it->firstChild() : Nodes_LV->firstChild() ;
- while ( it ) {
- if( ((QCheckListItem *)it)->type() ==
- QCheckListItem::Controller ) {
- // child is controller -> has sub radio
- // check if one radio is selected
- it = it->firstChild();
- while( it ) {
- if( ((QCheckListItem *)it)->isOn() ) {
- // this radio is selected -> go deeper
- it = it->firstChild();
- if( ! it ) {
- // was deepest level
- return 1;
- }
- // do not bother to check other items
- break;
- }
- it = it->nextSibling();
- }
- if( ! it ) {
- // no radio selected
- return 0;
+
+ // check if all below this level is selected
+ it = ( it ) ?it : Nodes_LV->firstChild();
+ ANetNode *NN;
+ bool Found;
+
+ while ( it ) {
+ NN = (*Mapping)[it];
+ if( NN == 0 ) {
+ // this item is a controller ->
+ // has radio items as children ->
+ // find selected one
+ it = it->firstChild();
+ Found = 0;
+ while( it ) {
+ if( ((QCheckListItem *)it)->isOn() ) {
+ Found = 1;
+ // go deeper
+ it = it->firstChild();
+ break;
}
- } else {
- // check children
- it = it->firstChild();
+ it = it->nextSibling();
}
+
+ if( ! Found ) {
+ return 0; // no not complete -> a radio should have been chkd
+ }
+
+ // it now contains selected radio
+ NN = (*Mapping)[it];
+ } else {
+ // automatic selection
+ it = it->firstChild();
}
- // deepest level -> all is still OK
- return 1;
- } // was not ON
- return 0;
+ }
+ return 1;
}
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
@@ -1,15 +1,20 @@
#include "irda_NN.h"
#include "irda_NNI.h"
static const char * IRDANeeds[] =
{ 0
};
+static const char * IRDAProvides[] =
+ { "line",
+ 0
+ };
+
/**
* Constructor, find all of the possible interfaces
*/
IRDANetNode::IRDANetNode() : ANetNode(tr("Infrared link")) {
}
/**
* Delete any interfaces that we own.
@@ -27,18 +32,18 @@ const QString IRDANetNode::nodeDescription(){
ANetNodeInstance * IRDANetNode::createInstance( void ) {
return new AIRDA( this );
}
const char ** IRDANetNode::needs( void ) {
return IRDANeeds;
}
-const char * IRDANetNode::provides( void ) {
- return "line";
+const char ** IRDANetNode::provides( void ) {
+ return IRDAProvides;
}
void IRDANetNode::setSpecificAttribute( QString & , QString & ) {
}
void IRDANetNode::saveSpecificAttribute( QTextStream & ) {
}
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
@@ -15,17 +15,17 @@ public:
virtual ~IRDANetNode();
virtual const QString pixmapName()
{ return "Devices/irda"; }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
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
@@ -1,18 +1,19 @@
#ifndef IRDA_DATA_H
#define IRDA_DATA_H
#include <qstring.h>
-typedef struct IRDAData {
+class IRDAData {
+public :
QString Device;
QString LockFile;
long Speed;
short Parity;
short DataBits;
short StopBits;
bool HardwareControl;
bool SoftwareControl;
-} IRDAData_t;
+} ;
#endif
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,28 +1,25 @@
-#include <asline.h>
+#include <netnode.h>
#include "irdadata.h"
-class IRDARun : public AsLine {
+class IRDARun : public RuntimeInfo {
public :
IRDARun( ANetNodeInstance * NNI,
- IRDAData & Data ) : AsLine( NNI )
+ IRDAData & Data ) : RuntimeInfo( NNI )
{ }
- virtual AsLine * asLine( void )
- { return (AsLine *)this; }
+ virtual RuntimeInfo * line( void )
+ { return this; }
virtual QString deviceFile( void )
{ return QString( "/dev/irda" ); }
-protected :
-
- void detectState( NodeCollection * )
- { }
+ State_t detectState( void )
+ { return Unknown; }
- bool setState( NodeCollection * , Action_t, bool )
- { return 0; }
+protected :
- bool canSetState( State_t , Action_t )
- { return 0; }
+ QString setMyState( NodeCollection * , Action_t, bool )
+ { return QString(); }
};
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,9 +1,9 @@
-Package: opie-networksettingsplugin2-irda
+Package: opie-networksettings2plugin-irda
Files: plugins/networksettings2/libirda.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
Description: Network settings irda plugin.
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -1,13 +1,19 @@
#include "lancard_NN.h"
#include "lancard_NNI.h"
static const char * LanCardNeeds[] =
- { 0 };
+ { 0
+ };
+
+static const char * LanCardProvides[] =
+ { "device",
+ 0
+ };
/**
* Constructor, find all of the possible interfaces
*/
LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() {
InstanceCount = 2;
}
@@ -29,18 +35,18 @@ ANetNodeInstance * LanCardNetNode::createInstance( void ) {
return new ALanCard( this );
}
const char ** LanCardNetNode::needs( void ) {
return LanCardNeeds;
}
-const char * LanCardNetNode::provides( void ) {
- return "device";
+const char ** LanCardNetNode::provides( void ) {
+ return LanCardProvides;
}
QString LanCardNetNode::genNic( long nr ) {
QString S;
return S.sprintf( "eth%ld", nr );
}
void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) {
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
@@ -20,17 +20,17 @@ public:
virtual QString genNic( long );
virtual long instanceCount( void )
{ return InstanceCount; }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
QStringList & addressesOfNIC( void )
{ return NICMACAddresses; }
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
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
@@ -1,13 +1,14 @@
#ifndef LANCARD_DATA_H
#define LANCARD_DATA_H
#include <qstringlist.h>
#include <qstring.h>
-typedef struct LanCardData {
+class LanCardData {
+public :
bool AnyLanCard;
QStringList HWAddresses;
-} LanCardData_t;
+} ;
#endif
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
@@ -1,21 +1,23 @@
#include <qfile.h>
#include <qtextstream.h>
#include <qstringlist.h>
#include <resources.h>
#include "lancardrun.h"
-void LanCardRun::detectState( NodeCollection * NC ) {
+State_t LanCardRun::detectState( void ) {
// unavailable : no card found
// available : card found and assigned to us or free
// up : card found and assigned to us and up
- QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
+ NodeCollection * NC = nodeCollection();
+ QString S = QString( "/tmp/profile-%1.up" ).
+ arg( NC->number());
System & Sys = NSResources->system();
InterfaceInfo * Run;
QFile F( S );
if( F.open( IO_ReadOnly ) ) {
// could open file -> read interface and assign
QString X;
@@ -23,126 +25,80 @@ void LanCardRun::detectState( NodeCollection * NC ) {
X = TS.readLine();
// find interface
if( handlesInterface( X ) ) {
for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
It.current();
++It ) {
Run = It.current();
if( X == Run->Name ) {
- Run->assignNode( netNode() );
- assignInterface( Run );
- NC->setCurrentState( IsUp );
- return;
+ NC->assignInterface( Run );
+ return IsUp;
}
}
}
}
- if( ( Run = assignedInterface() ) ) {
+ if( ( Run = NC->assignedInterface() ) ) {
// we already have an interface assigned -> still present ?
if( ! Run->IsUp ) {
// usb is still free -> keep assignment
- NC->setCurrentState( Available );
- return;
+ return Available;
} // else interface is up but NOT us -> some other profile
}
// nothing (valid) assigned to us
- assignInterface( 0 );
+ NC->assignInterface( 0 );
// find possible interface
for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
It.current();
++It ) {
Run = It.current();
if( handlesInterface( *Run ) &&
( Run->CardType == ARPHRD_ETHER
#ifdef ARPHRD_IEEE1394
|| Run->CardType == ARPHRD_IEEE1394
#endif
) &&
! Run->IsUp
) {
// proper type, and Not UP -> free
- NC->setCurrentState( Off );
- return;
+ return Off;
}
}
// no free found
- NC->setCurrentState( Unavailable );
-
+ return Unavailable;
}
-bool LanCardRun::setState( NodeCollection * NC, Action_t A, bool ) {
+QString LanCardRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
- // we only handle activate and deactivate
- switch( A ) {
- case Activate :
- {
- if( NC->currentState() != Off ) {
- return 0;
- }
- InterfaceInfo * N = getInterface();
- if( ! N ) {
- // no interface available
- NC->setCurrentState( Unavailable );
- return 0;
- }
- // because we were OFF the interface
- // we get back is NOT assigned
- N->assignNode( netNode() );
- assignInterface( N );
- NC->setCurrentState( Available );
- return 1;
- }
- case Deactivate :
- if( NC->currentState() == IsUp ) {
- // bring down first
- if( ! connection()->setState( Down ) )
- // could not ...
- return 0;
- } else if( NC->currentState() != Available ) {
- return 1;
- }
- assignedInterface()->assignNode( 0 ); // release
- assignInterface( 0 );
- NC->setCurrentState( Off );
- return 1;
- default :
- // FT
- break;
+ if( A == Activate ) {
+ InterfaceInfo * N = getInterface();
+
+ if( ! N ) {
+ // no interface available
+ NC->setCurrentState( Unavailable );
+ return tr("No interface found");
+ }
+
+ // because we were OFF the interface
+ // we get back is NOT assigned
+ NC->assignInterface( N );
+ NC->setCurrentState( Available );
+ return QString();
}
- return 0;
-}
-bool LanCardRun::canSetState( State_t Curr, Action_t A ) {
- // we only handle up down activate and deactivate
- switch( A ) {
- case Activate :
- { // at least available
- if( Curr == Available ) {
- return 1;
- }
- // or we can make one available
- InterfaceInfo * N = getInterface();
- if( ! N || N->assignedNode() != 0 ) {
- // non available or assigned
- return 0;
- }
- return 1;
- }
- case Deactivate :
- return ( Curr >= Available );
- default :
- // FT
- break;
+ if( A == Deactivate ) {
+ NC->assignInterface( 0 );
+ NC->setCurrentState( Off );
}
- return 0;
+
+ return QString();
}
// get interface that is free or assigned to us
InterfaceInfo * LanCardRun::getInterface( void ) {
System & S = NSResources->system();
InterfaceInfo * best = 0, * Run;
@@ -153,20 +109,20 @@ InterfaceInfo * LanCardRun::getInterface( void ) {
if( handlesInterface( *Run ) &&
( Run->CardType == ARPHRD_ETHER
#ifdef ARPHRD_IEEE1394
|| Run->CardType == ARPHRD_IEEE1394
#endif
)
) {
// this is a LAN card
- if( Run->assignedNode() == netNode() ) {
+ if( Run->assignedConnection() == netNode()->connection() ) {
// assigned to us
return Run;
- } else if( Run->assignedNode() == 0 ) {
+ } else if( Run->assignedConnection() == 0 ) {
// free
best = Run;
}
}
}
return best; // can be 0
}
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
@@ -1,38 +1,36 @@
#ifndef LANCARDRUN_H
#define LANCARDRUN_H
-#include <asdevice.h>
+#include <netnode.h>
#include <qregexp.h>
#include "lancarddata.h"
-class LanCardRun : public AsDevice {
+class LanCardRun : public RuntimeInfo {
public :
LanCardRun( ANetNodeInstance * NNI,
- LanCardData & D ) : AsDevice( NNI ),
- Pat( "eth[0-9]" )
- { Data = &D; }
+ LanCardData & D ) : RuntimeInfo( NNI ),
+ Pat( "eth[0-9]" ) {
+ Data = &D;
+ }
- virtual AsDevice * device( void )
- { return (AsDevice *)this; }
+ virtual RuntimeInfo * device( void )
+ { return this; }
- virtual AsDevice * asDevice( void )
- { return (AsDevice *)this; }
+ bool handlesInterface( const QString & I );
+ bool handlesInterface( const InterfaceInfo & II );
-protected :
+ State_t detectState( void );
- void detectState( NodeCollection * NC );
- bool setState( NodeCollection * NC, Action_t A, bool Force );
- bool canSetState( State_t Curr, Action_t A );
+protected :
- bool handlesInterface( const QString & I );
- bool handlesInterface( const InterfaceInfo & II );
+ QString setMyState( NodeCollection * , Action_t, bool );
private :
InterfaceInfo * getInterface( void );
QRegExp Pat;
LanCardData * Data;
};
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,9 +1,9 @@
-Package: opie-networksettingsplugin2-lancard
+Package: opie-networksettings2plugin-lancard
Files: plugins/networksettings2/liblancard.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
Description: Network settings lancard plugin.
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -1,13 +1,14 @@
#include "nsdata.h"
#include "activateprofile.h"
#include "activatevpn.h"
#include "networksettings.h"
+#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#include <opie2/oapplicationfactory.h>
using namespace Opie::Core;
#ifdef GONE
OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
@@ -19,16 +20,27 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
// used by interfaces to request for allow of up/down
#define ACT_REQUEST 1
// regenerate config files
#define ACT_REGEN 2
// used by interfaces to request user prompt
#define ACT_PROMPT 3
// used by interfaces to trigger VPN
#define ACT_VPN 4
+// activate opietooth
+#define ACT_OT 5
+
+// include Opietooth GUI
+#include <opietooth2/Opietooth.h>
+using namespace Opietooth2;
+
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qframe.h>
+#include <qlabel.h>
int main( int argc, char * argv[] ) {
int rv = 0;
int Action = ACT_GUI;
// could be overruled by -qws
QApplication::Type GuiType = QApplication::GuiClient;
#ifdef _WS_QWS_
@@ -45,30 +57,35 @@ int main( int argc, char * argv[] ) {
GuiType = QApplication::Tty;
rmv = 1;
} else if( strcmp( argv[i], "--prompt" ) == 0 ) {
Action = ACT_PROMPT;
rmv = 1;
} else if( strcmp( argv[i], "--triggervpn" ) == 0 ) {
Action = ACT_VPN;
rmv = 1;
+ } else if( strcmp( argv[i], "--opietooth" ) == 0 ) {
+ Action = ACT_OT;
+ rmv = 1;
}
if( rmv ) {
memmove( argv+i, argv+i+rmv,
sizeof( char * ) * (argc-i-rmv) );
i --;
argc -= rmv;
}
}
if( strstr( argv[0], "-request" ) ) {
// called from system to request something
GuiType = QApplication::Tty;
Action = ACT_REQUEST;
Log(("Request : %s\n", argv[1] ));
+ } else if( strstr( argv[0], "-opietooth" ) ) {
+ Action = ACT_OT;
}
// Start Qt
#ifdef _WS_QWS_
// because QPEApplication does not handle GuiType well
if( GuiType == QApplication::Tty ) {
// this cast is NOT correct but we do not use
// TheApp anymore ...
@@ -81,35 +98,33 @@ int main( int argc, char * argv[] ) {
#endif
// init qt with app widget
switch( Action ) {
case ACT_REQUEST :
{ NetworkSettingsData NS;
if( NS.canStart( argv[1] ) ) {
- QString S;
- S.sprintf( QPEApplication::qpeDir()+
- "bin/networksettings2" );
- char * MyArgv[4];
- MyArgv[0] = "networksettings2";
- MyArgv[1] = "--prompt";
- MyArgv[2] = argv[1];
- MyArgv[3] = NULL;
- NSResources->system().execAsUser( S, MyArgv );
+ QStringList S;
+ S << QPEApplication::qpeDir() + "/bin/networksettings2";
+ S << "networksettings2";
+ S << "--prompt";
+ S << argv[1];
+ NSResources->system().execAsUser( S );
Log(("FAILED %s-cNN-allowed\n", argv[1] ));
// if we come here , failed
printf( "%s-cNN-disallowed", argv[1] );
}
}
break;
case ACT_REGEN :
{ NetworkSettingsData NS;
+ QString S= NS.generateSettings();
// regen returns 0 if OK
- rv = (NS.regenerate()) ? 1 : 0;
+ rv = ( S.isEmpty() ) ? 0 : 1;
}
break;
case ACT_PROMPT :
{ ActivateProfile AP(argv[1]);
if( AP.exec() == QDialog::Accepted ) {
Log(("%s-c%ld-allowed\n",
argv[1], AP.selectedProfile() ));
printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() );
@@ -120,25 +135,34 @@ int main( int argc, char * argv[] ) {
}
break;
case ACT_VPN :
{ ActivateVPN AVPN;
AVPN.exec();
}
break;
case ACT_GUI :
- { QWidget * W = new NetworkSettings(0);
+ case ACT_OT :
+ { QWidget * W;
+
+ if( Action == ACT_OT ) {
+ W = new OTMain( 0 );
+ } else {
+ W = new NetworkSettings(0);
+ }
TheApp->setMainWidget( W );
+
W->show();
#ifdef _WS_QWS_
W->showMaximized();
#else
W->resize( W->sizeHint() );
#endif
rv = TheApp->exec();
+
delete W;
}
break;
}
LogClose();
return rv;
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
@@ -1,13 +1,18 @@
#include "modem_NN.h"
#include "modem_NNI.h"
static const char * ModemNeeds[] =
- { "line"
+ { "line",
+ 0
+ };
+static const char * ModemProvides[] =
+ { "modem",
+ 0
};
/**
* Constructor, find all of the possible interfaces
*/
ModemNetNode::ModemNetNode() : ANetNode(tr("Dialup modem")) {
}
@@ -28,18 +33,18 @@ const QString ModemNetNode::nodeDescription(){
ANetNodeInstance * ModemNetNode::createInstance( void ) {
return new AModem( this );
}
const char ** ModemNetNode::needs( void ) {
return ModemNeeds;
}
-const char * ModemNetNode::provides( void ) {
- return "line";
+const char ** ModemNetNode::provides( void ) {
+ return ModemProvides;
}
void ModemNetNode::setSpecificAttribute( QString & , QString & ) {
}
void ModemNetNode::saveSpecificAttribute( QTextStream & ) {
}
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
@@ -15,17 +15,17 @@ public:
virtual ~ModemNetNode();
virtual const QString pixmapName()
{ return "Devices/modem"; }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
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
@@ -1,17 +1,18 @@
#ifndef MODEM_DATA_H
#define MODEM_DATA_H
#include <qstring.h>
-typedef struct ModemData {
+class ModemData {
+public :
QString Device;
QString LockFile;
long Speed;
short Parity;
short DataBits;
short StopBits;
bool HardwareControl;
bool SoftwareControl;
-} ModemData_t;
+} ;
#endif
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
@@ -4,15 +4,15 @@
ModemEdit::ModemEdit( QWidget * Parent ) : ModemGUI( Parent ){
}
QString ModemEdit::acceptable( void ) {
return QString();
}
-bool ModemEdit::commit( ModemData_t & Data ) {
+bool ModemEdit::commit( ModemData & Data ) {
return 0;
}
-void ModemEdit::showData( ModemData_t & Data ) {
+void ModemEdit::showData( ModemData & Data ) {
}
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
@@ -2,11 +2,11 @@
#include "modemGUI.h"
class ModemEdit : public ModemGUI {
public :
ModemEdit( QWidget * parent );
QString acceptable( void );
- bool commit( ModemData_t & Data );
- void showData( ModemData_t & Data );
+ bool commit( ModemData & Data );
+ void showData( ModemData & Data );
};
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,28 +1,25 @@
-#include <asline.h>
+#include <netnode.h>
#include "modemdata.h"
-class ModemRun : public AsLine {
+class ModemRun : public RuntimeInfo {
public :
ModemRun( ANetNodeInstance * NNI,
- ModemData & Data ) : AsLine ( NNI )
+ ModemData & Data ) : RuntimeInfo ( NNI )
{ }
- virtual AsLine * asLine( void )
- { return (AsLine *)this; }
+ virtual RuntimeInfo * line( void )
+ { return this; }
virtual QString deviceFile( void )
{ return QString("/dev/modem"); }
-protected :
-
- void detectState( NodeCollection * )
- { }
+ State_t detectState( void )
+ { return Unknown;}
- bool setState( NodeCollection *, Action_t, bool )
- { return 0; }
+protected :
- bool canSetState( State_t, Action_t )
- { return 0; }
+ QString setMyState( NodeCollection * , Action_t, bool )
+ { return QString(); }
};
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,9 +1,9 @@
-Package: opie-networksettingsplugin2-modem
+Package: opie-networksettings2plugin-modem
Files: plugins/networksettings2/libmodem.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
Description: Network settings modem plugin.
Version: $QPE_VERSION$EXTRAVERSION
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,22 +1,31 @@
#include <qpe/qpeapplication.h>
-#include <asdevice.h>
+#include <resources.h>
+#include <netnode.h>
#include "network_NN.h"
#include "network_NNI.h"
static const char * NetworkNeeds[] =
{ "device",
0
};
+static const char * NetworkProvides[] =
+ { "connection",
+ 0
+ };
+
/**
* Constructor, find all of the possible interfaces
*/
NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) {
+
+ NSResources->addSystemFile(
+ "interfaces", "/etc/network/interfaces", 1 );
}
/**
* Delete any interfaces that we own.
*/
NetworkNetNode::~NetworkNetNode(){
}
@@ -27,54 +36,57 @@ const QString NetworkNetNode::nodeDescription(){
"
);
}
ANetNodeInstance * NetworkNetNode::createInstance( void ) {
return new ANetwork( this );
}
-bool NetworkNetNode::hasDataForFile( const QString & S ) {
- return S == "interfaces";
+bool NetworkNetNode::hasDataForFile( SystemFile & S ) {
+ return S.name() == "interfaces";
}
-short NetworkNetNode::generateFile( const QString & ID,
- const QString & ,
- QTextStream & TS,
+short NetworkNetNode::generateFile( SystemFile & SF,
ANetNodeInstance * NNI,
long DevNr ) {
+ if( DevNr < 0 ) {
+ // generate device specific but common part
+ return 1;
+ }
+
QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
- if( ID == "interfaces" ) {
- Log(("Generate entry for %s in %s\n", NIC.latin1(), ID.latin1() ));
+ if( SF.name() == "interfaces" ) {
+ Log(("Generate entry for %s in %s\n", NIC.latin1(), SF.name().latin1() ));
// generate mapping stanza for this interface
- TS << "# check if "
+ SF << "# check if "
<< NIC
<< " can be brought UP"
<< endl;
- TS << "mapping "
+ SF << "mapping "
<< NIC
<< endl;
- TS << " script "
+ SF << " script "
<< QPEApplication::qpeDir()
- << "/bin/networksettings2-request"
+ << "bin/networksettings2-request"
<< endl
<< endl;
return 0;
}
return 1;
}
const char ** NetworkNetNode::needs( void ) {
return NetworkNeeds;
}
-const char * NetworkNetNode::provides( void ) {
- return "connection";
+const char ** NetworkNetNode::provides( void ) {
+ return NetworkProvides;
}
void NetworkNetNode::setSpecificAttribute( QString & , QString & ) {
}
void NetworkNetNode::saveSpecificAttribute( QTextStream & ) {
}
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
@@ -9,30 +9,28 @@ class NetworkNetNode : public ANetNode{
Q_OBJECT
public:
NetworkNetNode();
virtual ~NetworkNetNode();
- virtual bool hasDataForFile( const QString & S );
+ virtual bool hasDataForFile( SystemFile & S );
- virtual short generateFile( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ virtual short generateFile( SystemFile & TS,
ANetNodeInstance * NNI,
long DevNr );
virtual const QString pixmapName()
{ return "Devices/tcpip"; }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
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,10 +1,10 @@
#include <system.h>
-#include <asdevice.h>
+#include <netnode.h>
#include "networkedit.h"
#include "network_NNI.h"
#include "network_NN.h"
ANetwork::ANetwork( NetworkNetNode * PNN ) : ANetNodeInstance( PNN ) {
Data.UseDHCP = 1;
Data.IPAddress = "";
Data.NetMask = "";
@@ -94,126 +94,124 @@ QString ANetwork::acceptable( void ) {
return ( GUI ) ? GUI->acceptable( ) : QString();
}
void ANetwork::commit( void ) {
if( GUI && GUI->commit( Data ) )
setModified( 1 );
}
-bool ANetwork::hasDataForFile( const QString & S ) {
- return S == "interfaces";
+bool ANetwork::hasDataForFile( SystemFile & S ) {
+ return S.name() == "interfaces";
}
-short ANetwork::generateFile( const QString & ID,
- const QString & Path,
- QTextStream &TS,
- long DevNr
- ) {
+short ANetwork::generateFile( SystemFile &SF,
+ long DevNr
+ ) {
short rvl, rvd ;
QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
rvl = 1;
- if( ID == "interfaces" ) {
- Log(("Generate Network for %s\n", ID.latin1() ));
+ if( SF.name() == "interfaces" ) {
+ Log(("Generate Network for %s\n", SF.name().latin1() ));
// we can safely call from here since device item is deeper
if( Data.UseDHCP ) {
- TS << "iface "
+ SF << "iface "
<< NIC
<< "-c"
<< connection()->number()
<< "-allowed inet dhcp"
<< endl;
- TS << " up echo \""
+ SF << " up echo \""
<< NIC
<< "\" > /tmp/profile-"
<< connection()->number()
<< ".up"
<< endl;
if( Data.SendHostname ) {
- TS << " hostname "
+ SF << " hostname "
<< Data.Hostname
<< endl;
}
- TS << " down rm -f /tmp/profile-"
+ SF << " down rm -f /tmp/profile-"
<< connection()->number()
<< ".up"
<< endl;
} else {
- TS << "iface "
+ SF << "iface "
<< NIC << "-c"
<< connection()->number()
<< "-allowed inet static"
<< endl;
- TS << " up echo \""
+ SF << " up echo \""
<< NIC
<< "\" > /tmp/profile-"
<< connection()->number()
<< ".up"
<< endl;
- TS << " down rm -f /tmp/profile-"
+ SF << " down rm -f /tmp/profile-"
<< connection()->number()
<< ".up"
<< endl;
- TS << " address "
+ SF << " address "
<< Data.IPAddress
<< endl;
- TS << " broadcast "
+ SF << " broadcast "
<< Data.Broadcast
<< endl;
- TS << " netmask "
+ SF << " netmask "
<< Data.NetMask
<< endl;
// derive network address = IPAddress & netmask
{ QString NW;
QStringList ipal = QStringList::split( '.', Data.IPAddress );
QStringList nmal = QStringList::split( '.', Data.NetMask );
NW = QString( "%1.%2.%3.%4" ).
arg( ipal[0].toShort() & nmal[0].toShort() ).
arg( ipal[1].toShort() & nmal[1].toShort() ).
arg( ipal[2].toShort() & nmal[2].toShort() ).
arg( ipal[3].toShort() & nmal[3].toShort() );
- TS << " network "
+ SF << " network "
<< NW
<< endl;
}
}
for ( QStringList::Iterator it = Data.PreUp_SL.begin();
it != Data.PreUp_SL.end();
++it ) {
- TS << " pre-up "
+ SF << " pre-up "
<< (*it)
<< endl;
}
for ( QStringList::Iterator it = Data.PostUp_SL.begin();
it != Data.PostUp_SL.end();
++it ) {
- TS << " up "
+ SF << " up "
<< (*it)
<< endl;
}
for ( QStringList::Iterator it = Data.PreDown_SL.begin();
it != Data.PreDown_SL.end();
++it ) {
- TS << " down "
+ SF << " down "
<< (*it)
<< endl;
}
for ( QStringList::Iterator it = Data.PostDown_SL.begin();
it != Data.PostDown_SL.end();
++it ) {
- TS << " post-down "
+ SF << " post-down "
<< (*it)
<< endl;
}
rvl = 0;
}
// embed other info in it
- rvd = connection()->getToplevel()->generateFileEmbedded( ID, Path, TS, DevNr );
+ rvd = connection()->getToplevel()->generateFileEmbedded( SF, DevNr );
return (rvd == 2 || rvl == 2 ) ? 2 :
(rvd == 0 || rvl == 0 ) ? 0 : 1;
}
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
@@ -22,27 +22,25 @@ public :
QWidget * edit( QWidget * parent );
QString acceptable( void );
void commit( void );
virtual void * data( void )
{ return (void *)&Data; }
- virtual bool hasDataForFile( const QString & S );
- virtual short generateFile( const QString & ID,
- const QString & Path,
- QTextStream &TS,
- long DevNr );
+ virtual bool hasDataForFile( SystemFile & SF );
+ virtual short generateFile( SystemFile &TS,
+ long DevNr );
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
private :
NetworkEdit * GUI;
- NetworkData_t Data;
+ NetworkData Data;
NetworkRun * RT;
};
#endif
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
@@ -1,22 +1,23 @@
#ifndef NETWORK_DATA_H
#define NETWORK_DATA_H
#include <qstring.h>
#include <qstringlist.h>
-typedef struct NetworkData {
+class NetworkData {
+public :
bool UseDHCP;
QString Hostname;
bool SendHostname;
QString IPAddress;
QString NetMask;
QString Gateway;
QString Broadcast;
QString DNS1;
QString DNS2;
QStringList PreUp_SL;
QStringList PostUp_SL;
QStringList PreDown_SL;
QStringList PostDown_SL;
-} NetworkData_t;
+} ;
#endif
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
@@ -60,17 +60,17 @@ QString NetworkEdit::acceptable( void ) {
! validIP( DNS1_LE->text() ) )
return tr("DNS1 address not valid");
if( ! DNS2_LE->text().isEmpty() &&
! validIP( DNS2_LE->text() ) )
return tr("DNS2 address not valid");
return QString();
}
-bool NetworkEdit::commit( NetworkData_t & Data ) {
+bool NetworkEdit::commit( NetworkData & Data ) {
bool SM = 0;
CBM( Data.UseDHCP, DHCP_CB, SM );
TXTM( Data.IPAddress, IPAddress_LE, SM );
CBM( Data.SendHostname, SendHostname_CB, SM );
TXTM( Data.Hostname, Hostname_LE, SM );
TXTM( Data.Gateway, Gateway_LE, SM );
TXTM( Data.Broadcast, Broadcast_LE, SM );
TXTM( Data.NetMask, SubnetMask_LE, SM );
@@ -80,17 +80,17 @@ bool NetworkEdit::commit( NetworkData_t & Data ) {
SM |= updateList( Data.PreUp_SL, PreUp_LB );
SM |= updateList( Data.PostUp_SL, PostUp_LB );
SM |= updateList( Data.PreDown_SL, PreDown_LB );
SM |= updateList( Data.PostDown_SL, PostDown_LB );
return SM;
}
-void NetworkEdit::showData( NetworkData_t & Data ) {
+void NetworkEdit::showData( NetworkData & Data ) {
DHCP_CB->setChecked( Data.UseDHCP );
SendHostname_CB->setChecked( Data.SendHostname );
Hostname_LE->setText( Data.Hostname );
IPAddress_LE->setText( Data.IPAddress );
Gateway_LE->setText( Data.Gateway );
SubnetMask_LE->setText( Data.NetMask );
Broadcast_LE->setText( Data.Broadcast );
DNS1_LE->setText( Data.DNS1 );
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
@@ -4,18 +4,18 @@
class QListBox;
class NetworkEdit : public NetworkGUI {
public :
NetworkEdit( QWidget * parent );
QString acceptable( void );
- bool commit( NetworkData_t & Data );
- void showData( NetworkData_t & Data );
+ bool commit( NetworkData & Data );
+ void showData( NetworkData & Data );
public slots :
void SLOT_NetmaskModified( const QString & S );
void SLOT_ShowCommand( QListBoxItem * LBI );
void SLOT_Add( void );
void SLOT_Remove( void );
void SLOT_Up( void );
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,78 +1,51 @@
#include <system.h>
-#include <asdevice.h>
+#include <netnode.h>
+#include <resources.h>
#include "networkrun.h"
-void NetworkRun::detectState( NodeCollection * NC ) {
- RuntimeInfo * RI = netNode()->nextNode()->runtime();
- AsDevice * Next = RI->asDevice();
- InterfaceInfo * II = Next->assignedInterface();
+State_t NetworkRun::detectState( void ) {
+ InterfaceInfo * II = nodeCollection()->assignedInterface();
- if( II ) {
+ Log(( "Interface %p : %d\n", II, (II) ? II->IsUp : 0 ));
+ if( II && II->IsUp ) {
// device has assigned interface
- NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) );
- return;
+ return IsUp;
}
- Log(( "%s not ! UP or ava\n", NC->name().latin1() ));
- // has no interface -> delegate
- RI->detectState( NC );
+ // had no interface or interface is no longer up -> release
+ nodeCollection()->assignInterface( 0 );
+
+ return Unknown;
}
-bool NetworkRun::setState( NodeCollection * NC, Action_t A, bool Force ) {
+QString NetworkRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
// we handle UP and DOWN
- RuntimeInfo * RI = netNode()->nextNode()->runtime();
- AsDevice * Next = RI->asDevice();
- InterfaceInfo * II = Next->assignedInterface();
+ InterfaceInfo * II = NC->assignedInterface();
if( A == Up ) {
// we can bring UP if lower level is available
- if( NC->currentState() == Available || Force ) {
- QString S;
- S.sprintf( "ifup %s=%s-c%d-allowed",
- II->Name.latin1(), II->Name.latin1(),
- connection()->number() );
- NSResources->system().runAsRoot( S );
+ QStringList SL;
+ SL << "ifup"
+ << QString().sprintf( "%s=%s-c%d-allowed",
+ II->Name.latin1(), II->Name.latin1(),
+ nodeCollection()->number() );
+ if( ! NSResources->system().runAsRoot( SL ) ) {
+ return QString("Cannot call %1").arg(SL.join(" "));
}
- return 1;
- } else if( A == Down ) {
- QString S;
- if( Force ) {
- Log(("Force mode %d\n", Force ));
- for( int i = 0;
- i < RI->netNode()->nodeClass()->instanceCount();
- i ++ ) {
- S.sprintf( "ifdown %s",
- RI->netNode()->nodeClass()->genNic( i ).latin1() );
- NSResources->system().runAsRoot( S );
+ return QString();
+ }
+
+ if( A == Down ) {
+ QStringList SL;
+ if( II ) {
+ SL << "ifdown"
+ << II->Name.latin1();
+ if( ! NSResources->system().runAsRoot( SL ) ) {
+ return QString( "Cannot call %1" ).arg( SL.join( " " ));
}
} else {
- if( NC->currentState() == IsUp ) {
- S.sprintf( "ifdown %s=%s-c%d-allowed",
- II->Name.latin1(), II->Name.latin1(),
- connection()->number() );
- NSResources->system().runAsRoot( S );
- }
+ Log(( "no interface assigned." ));
}
- return 1;
- }
- // delegate
- return RI->setState( NC, A, Force );
-}
-
-bool NetworkRun::canSetState( State_t Curr, Action_t A ) {
- // we handle UP and DOWN
- RuntimeInfo * RI = netNode()->nextNode()->runtime();
-
- if( A == Up ) {
- return ( Curr == Available );
- } else if( A == Down ) {
- return ( Curr == IsUp );
}
- // delegate
- return RI->canSetState( Curr, A );
-}
-
-bool NetworkRun::handlesInterface( const QString & S ) {
- // donno -> pass deeper
- return netNode()->nextNode()->runtime()->handlesInterface(S);
+ return QString();
}
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,23 +1,20 @@
-#include <asconnection.h>
+#include <netnode.h>
#include "networkdata.h"
-class NetworkRun : public AsConnection {
+class NetworkRun : public RuntimeInfo {
public :
NetworkRun( ANetNodeInstance * NNI,
- NetworkData & Data ) : AsConnection( NNI )
+ NetworkData & Data ) : RuntimeInfo( NNI )
{ }
- virtual AsConnection * asConnection( void )
- { return (AsConnection *)this; }
+ virtual RuntimeInfo * connection( void )
+ { return this; }
-protected :
-
- void detectState( NodeCollection * );
- bool setState( NodeCollection * ,Action_t A, bool );
- bool canSetState( State_t , Action_t A );
+ State_t detectState( void );
- bool handlesInterface( const QString & I );
+protected :
+ QString setMyState( NodeCollection * , Action_t, bool );
};
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,9 +1,9 @@
-Package: opie-networksettingsplugin2-network
+Package: opie-networksettings2plugin-network
Files: plugins/networksettings2/libnetwork.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
Description: Generate TCPIP Network settings plugin
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -1,48 +1,62 @@
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
+#include <opie2/odebug.h>
+#include <opie2/oledbox.h>
+
#include <qpe/qpeapplication.h>
#include <qlistbox.h>
+#include <qlayout.h>
#include <qgroupbox.h>
#include <qtimer.h>
#include <qlistbox.h>
#include <qmessagebox.h>
#include <qlabel.h>
#include <qiconview.h>
#include <qtimer.h>
#include <qpe/qpeapplication.h>
#include <qtoolbutton.h>
#include <qevent.h>
-#include <asdevice.h>
#include "networksettings.h"
#include "netnode.h"
#include "editconnection.h"
NetworkSettings::NetworkSettings( QWidget *parent,
const char *name,
WFlags fl ) : NetworkSettingsGUI(parent,name,fl),
NSD() {
UpdateTimer = new QTimer( this );
// set pixmaps
Add_TB->setPixmap( NSResources->getPixmap( "add" ) );
Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) );
CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) );
- Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) );
GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) );
- Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) );
- Disconnect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) );
+ Disable_TB->setPixmap( NSResources->getPixmap( "disabled" ) );
+ Up_TB->setPixmap( NSResources->getPixmap( "more" ) );
+ Down_TB->setPixmap( NSResources->getPixmap( "less" ) );
+
+ QVBoxLayout* V = new QVBoxLayout( LED_Frm );
+ QHBoxLayout * H = new QHBoxLayout( 0 );
+ V->addStretch(1);
+ V->addLayout( H );
+ Leds[0] = new OLedBox( red, LED_Frm );
+ H->addWidget( Leds[0], 0, Qt::AlignVCenter );
+ Leds[1] = new OLedBox( red, LED_Frm );
+ H->addWidget( Leds[1], 0, Qt::AlignVCenter );
+ Leds[2] = new OLedBox( red, LED_Frm );
+ H->addWidget( Leds[2], 0, Qt::AlignVCenter );
+ V->addStretch(1);
- On_TB->setPixmap( NSResources->getPixmap( "off" ) );
SLOT_ToProfile();
// populate main Listbox
Profiles_LB->clear();
QPEApplication::setStylusOperation(
Profiles_LB->viewport(), QPEApplication::RightOnHold );
@@ -67,41 +81,54 @@ NetworkSettings::NetworkSettings( QWidget *parent,
}
// if no profiles -> auto popup editing
if( NSResources->connections().count() == 0 ) {
QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) );
}
connect( &(NSResources->system()),
- SIGNAL( lineFromCommand(const QString &) ),
+ SIGNAL( stdoutLine(const QString &) ),
+ this, SLOT( SLOT_CmdMessage(const QString &) ) );
+
+ connect( &(NSResources->system()),
+ SIGNAL( stderrLine(const QString &) ),
+ this, SLOT( SLOT_CmdMessage(const QString &) ) );
+
+ connect( &(NSResources->system()),
+ SIGNAL( processEvent(const QString &) ),
this, SLOT( SLOT_CmdMessage(const QString &) ) );
UpdateTimer->start( 5000 );
connect( UpdateTimer, SIGNAL( timeout() ),
this, SLOT( SLOT_RefreshStates() ) );
/* Add QCopChannel */
connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) );
}
NetworkSettings::~NetworkSettings() {
QString S;
- if( isModified() ) {
+ owarn << "Dispose NS" << oendl;
+ if( NSD.isModified() ) {
+ owarn << "Modified" << oendl;
S = NSD.saveSettings();
if( ! S.isEmpty() ) {
+ S.insert( 0, "<p>" );
+ S.append( "</p>" );
// problem saving
QMessageBox::warning(
0,
tr( "Saving setup" ), S );
}
SLOT_GenerateConfig();
+ NSD.setModified( 0 );
}
}
void NetworkSettings::SLOT_CmdMessage( const QString & S ) {
Messages_LB->insertItem( S );
Messages_LB->setCurrentItem( Messages_LB->count()-1 );
Messages_LB->ensureCurrentVisible();
@@ -162,24 +189,23 @@ void NetworkSettings::SLOT_DeleteNode( void ) {
if( QMessageBox::warning(
0,
tr( "Removing profile" ),
tr( "Remove selected profile ?" ),
1, 0 ) == 1 ) {
NSResources->removeConnection( LBI->text() );
delete LBI;
- setModified( 1 );
+ NSD.setModified( 1 );
}
}
void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
QString OldName = "";
- printf( "------------------ Edit NOde\n" );
EditConnection EC( this );
if( LBI ) {
NodeCollection * NC = NSResources->findConnection( LBI->text() );
if( ! NC ) {
return;
}
OldName = NC->name();
@@ -191,17 +217,16 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
UpdateTimer->stop();
// we need to retry
while( 1 ) {
if( EC.exec() == QDialog::Accepted ) {
// toplevel item -> store
NodeCollection * NC = EC.connection();
if( NC->isModified() ) {
- setModified( 1 );
if( LBI ) {
if( NC->name() != OldName ) {
// find if new name is free
NodeCollection * LCN = NSResources->findConnection(
NC->name() );
if( LCN ) {
QMessageBox::warning(
0,
@@ -244,218 +269,238 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
}
void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) {
if( LBI == 0 )
return;
NodeCollection * NC = NSResources->findConnection( LBI->text() );
- // is button possible
- bool EnabledPossible, OnPossible, ConnectPossible;
- // is button On or Off
- bool DisabledOn, OnOn, ConnectOn;
+ if( NC->description().isEmpty() ) {
+ Description_LBL->setText( tr( "<<No description>>" ) );
+ } else {
+ Description_LBL->setText( NC->description() );
+ }
+
+ Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() );
- EnabledPossible = OnPossible = ConnectPossible = 1;
- DisabledOn = 1;
- OnOn = ConnectOn = 0;
+ bool FrmActive = 1;
+ bool IsEnabled = 1;
+ int leds = 0;
+ owarn << "State " << NC->state() << oendl;
switch( NC->state() ) {
- case Unknown :
- // cannot occur here
+ case Disabled : // no further work
+ IsEnabled = 0;
+ FrmActive = 0;
+ owarn << "LEds " << leds << oendl;
break;
+ case Unknown :
case Unchecked :
case Unavailable :
- // cannot do anything but recheck
- EnabledPossible = OnPossible = ConnectPossible = 0;
- break;
- case Disabled :
- OnPossible = ConnectPossible = 0;
+ FrmActive = 0;
break;
case Off :
- DisabledOn = 0;
+ leds = 1;
break;
case Available :
- OnOn = 1;
- Connect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) );
- DisabledOn = 0;
+ leds = 2;
break;
case IsUp :
- OnOn = ConnectOn = 1;
- Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) );
- DisabledOn = 0;
+ leds = 3;
break;
}
- if( ! OnOn ) {
- Connect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) );
- }
-
- // set button state
- Enable_TB->setEnabled( EnabledPossible );
- On_TB->setEnabled( OnPossible );
- Connect_TB->setEnabled( ConnectPossible );
-
- Enable_TB->setOn( DisabledOn );
- On_TB->setOn( OnOn );
- Connect_TB->setOn( ConnectOn );
+ Disable_TB->setOn( ! IsEnabled );
+ LED_Frm->setEnabled( FrmActive );
- if( NC->description().isEmpty() ) {
- Description_LBL->setText( tr( "<<No description>>" ) );
- } else {
- Description_LBL->setText( NC->description() );
+ for( int i = 0 ; i < leds; i ++ ) {
+ Leds[i]->setColor( red );
+ Leds[i]->setOn( true );
+ }
+ for( int i = leds ; i < 3; i ++ ) {
+ Leds[i]->setColor( red );
+ Leds[i]->setOn( false );
}
- Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() );
+ Up_TB->setEnabled( leds < 3 && leds != 0 );
+ Down_TB->setEnabled( leds > 0 );
}
void NetworkSettings::SLOT_CheckState( void ) {
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
if ( ! LBI )
return;
updateProfileState( LBI );
}
void NetworkSettings::updateProfileState( QListBoxItem * LBI ) {
if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) {
SLOT_ShowNode( LBI );
}
}
void NetworkSettings::SLOT_GenerateConfig( void ) {
- NSD.regenerate();
+ QString S = NSD.generateSettings();
+ if( ! S.isEmpty() ) {
+ S.insert( 0, "<p>" );
+ S.append( "</p>" );
+ QMessageBox::warning(
+ 0,
+ tr( "Generate config" ),
+ S);
+ }
}
-void NetworkSettings::SLOT_Enable( void ) {
+void NetworkSettings::SLOT_Disable( bool T ) {
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
QString Msg;
+
if ( ! LBI )
return;
- NodeCollection * NC =
- NSResources->findConnection( LBI->text() );
-
- bool rv;
- switch( NC->state() ) {
- case Disabled :
- Msg = tr( "Cannot enable profile" );
- rv = NC->setState( Enable );
- break;
- default :
- Msg = tr( "Cannot disable profile" );
- rv = NC->setState( Disable );
- break;
- }
+ NodeCollection * NC = NSResources->findConnection( LBI->text() );
- if( ! rv ) {
+ owarn << "Prepare to disable" << oendl;
+ Msg = NC->setState( (T) ? Disable : Enable );
+ if( ! Msg.isEmpty() ) {
+ Msg.insert( 0, "<p>" );
+ Msg.append( "</p>" );
QMessageBox::warning(
0,
tr( "Activating profile" ),
Msg );
return;
}
+
+ // reload new state
+ NC->state( true );
updateProfileState( LBI );
}
-void NetworkSettings::SLOT_On( void ) {
+void NetworkSettings::SLOT_Up( void ) {
+ // bring more up
+
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
+ QString Msg;
+ int led = -1;
if ( ! LBI )
return;
NodeCollection * NC =
NSResources->findConnection( LBI->text() );
- bool rv;
switch( NC->state() ) {
- case Off :
- // activate interface
- rv = NC->setState( Activate );
+ case Disabled : // cannot modify this state
+ case Unknown : // cannot modify this state
+ case Unchecked : // cannot modify this state
+ case Unavailable : // cannot modify this state
+ case IsUp : // highest UP state
+ return;
+ case Off : // -> activate
+ led = 1;
+ Down_TB->setEnabled( true );
+ Log(( "Activate interface %s\n", NC->name().latin1() ));
+ Msg = NC->setState( Activate );
break;
- case Available : // deactivate
- case IsUp : // deactivate (will also bring down if needed)
- rv = NC->setState( Deactivate );
+ case Available : // -> up
+ led = 2;
+ Log(( "Bring up interface %s\n", NC->name().latin1() ));
+ Msg = NC->setState( Up );
+ if( Msg.isEmpty() ) {
+ Up_TB->setEnabled( false );
+ }
break;
- default :
- // others no change
- return;
- }
+ }
- if( ! rv ) {
+ if( ! Msg.isEmpty() ) {
+ Msg.insert( 0, "<p>" );
+ Msg.append( "</p>" );
QMessageBox::warning(
0,
- tr( "Activating profile" ),
- tr( "Cannot enable profile" ) );
+ tr( "Increase availability" ),
+ Msg );
return;
}
+
updateProfileState( LBI );
+
+ // set color of led we should change
+ if( led > 0 ) {
+ Leds[led]->setColor( blue );
+ Leds[led]->setOn( true );
+ }
+
}
-void NetworkSettings::SLOT_Connect( void ) {
+void NetworkSettings::SLOT_Down( void ) {
+ // bring more down
+
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
+ int led = -1;
+ QString Msg;
if ( ! LBI )
return;
NodeCollection * NC =
NSResources->findConnection( LBI->text() );
- bool rv = 1 ;
switch( NC->state() ) {
- case IsUp :
- // down interface
- rv = NC->setState( Down );
- break;
- case Available :
- // up interface
- rv = NC->setState( Up );
+ case Disabled : // cannot modify this state
+ case Unknown : // cannot modify this state
+ case Unchecked : // cannot modify this state
+ case Unavailable : // cannot modify this state
+ case Off : // highest DOWN state
break;
- case Off :
- // activate and bring up
- rv = ( NC->setState( Activate ) &&
- NC->setState( Up ) );
+ case Available : // -> down
+ led = 0;
+ Log(( "Deactivate interface %s\n", NC->name().latin1() ));
+ Msg = NC->setState( Deactivate );
+ Down_TB->setEnabled( false );
break;
- default :
- // others no change
+ case IsUp : // highest UP state
+ led = 1;
+ Up_TB->setEnabled( true );
+ Log(( "Bring down interface %s\n", NC->name().latin1() ));
+ Msg = NC->setState( Down, 1 );
+ if( Msg.isEmpty() ) {
+ // remove 'up' file to make sure
+ unlink ( QString().sprintf( "/tmp/Profile-%d.up", NC->number() ).latin1() );;
+ }
break;
- }
+ }
- if( ! rv ) {
+ if( ! Msg.isEmpty() ) {
+ Msg.insert( 0, "<p>" );
+ Msg.append( "</p>" );
QMessageBox::warning(
0,
- tr( "Activating profile" ),
- tr( "Cannot enable profile" ) );
- }
-
- // we do not update the GUI but wait for the REAL upping of the device
-}
-
-void NetworkSettings::SLOT_Disconnect( void ) {
- QString S;
- QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
-
- if ( ! LBI )
+ tr( "Decrease availability" ),
+ Msg );
return;
+ }
- NodeCollection * NC =
- NSResources->findConnection( LBI->text() );
+ updateProfileState( LBI );
- Log(( "Force interface %s down\n", NC->name().latin1() ));
- NC->setState( Down, 1 );
- // remove 'up' file to make sure
- S.sprintf( "/tmp/Profile-%d.up", NC->number() );
- unlink( S.latin1() );
+ // set color of led we should change
+ if( led >= 0 ) {
+ Leds[led]->setColor( blue );
+ }
}
void NetworkSettings::SLOT_ToMessages( void ) {
+ Profiles_LB->hide();
Profile_GB->hide();
Messages_GB->show();
}
void NetworkSettings::SLOT_ToProfile( void ) {
+ Profiles_LB->show();
Profile_GB->show();
Messages_GB->hide();
}
void NetworkSettings::SLOT_QCopMessage(const QCString &msg, const QByteArray &data) {
QDataStream stream( data, IO_ReadOnly );
if( msg == "raise" ) {
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
@@ -2,52 +2,58 @@
#include "networksettingsGUI.h"
#include "resources.h"
class ANetNode;
class ANetNodeInstance;
class QTimer;
class QListBoxItem;
class QEvent;
+class OLedBox;
class NetworkSettings : public NetworkSettingsGUI {
Q_OBJECT
public :
NetworkSettings( QWidget *parent=0,
const char *name=0,
WFlags fl = 0 );
- ~NetworkSettings( void );
+ virtual ~NetworkSettings( void );
static QString appName( void )
{ return QString::fromLatin1("networksettings"); }
- bool isModified( void )
- { return NSD.isModified(); }
- void setModified( bool m )
- { NSD.setModified( m ); }
-
public slots :
void SLOT_AddNode( void );
void SLOT_DeleteNode( void );
void SLOT_ShowNode( QListBoxItem * );
void SLOT_EditNode( QListBoxItem * );
void SLOT_CheckState( void );
- void SLOT_Enable( void );
- void SLOT_On( void );
- void SLOT_Connect( void );
- void SLOT_Disconnect( void );
+
+ void SLOT_Up( void );
+ void SLOT_Down( void );
+ void SLOT_Disable( bool );
+
void SLOT_GenerateConfig( void );
void SLOT_RefreshStates( void );
void SLOT_QCopMessage( const QCString&,const QByteArray& );
void SLOT_ToProfile( void );
void SLOT_ToMessages( void );
void SLOT_CmdMessage( const QString & S );
private :
void updateProfileState( QListBoxItem * it );
QTimer * UpdateTimer;
NetworkSettingsData NSD;
+ /*
+
+ no leds : not present, unknown, unchecked or disabled
+ (1) down : hardware present but inactive
+ (2) available : hardware present and active
+ (3) up : present active and connected
+
+ */
+ OLedBox * Leds[3];
};
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
@@ -6,19 +6,19 @@ HEADERS = networksettings.h \
activatevpn.h \
editconnection.h
SOURCES = main.cpp \
networksettings.cpp \
nsdata.cpp \
activateprofile.cpp \
activatevpn.cpp \
editconnection.cpp
-INCLUDEPATH += $(OPIEDIR)/include networksettings2/
-DEPENDPATH += $(OPIEDIR)/include networksettings2/
-LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings2 -lnetworksettings2 -lopiecore2
+INCLUDEPATH += $(OPIEDIR)/include networksettings2/ opietooth2/
+DEPENDPATH += $(OPIEDIR)/include networksettings2/ opietooth2/
+LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings2 -lnetworksettings2 -lopietooth2 -lopiecore2
INTERFACES = networksettingsGUI.ui \
editconnectionGUI.ui \
activatevpnGUI.ui \
activateprofileGUI.ui
TARGET = $(OPIEDIR)/bin/networksettings2
include( $(OPIEDIR)/include.pro )
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
@@ -26,11 +26,20 @@
// if currentItem capable widget has changed
#define CIM(Data,Wdg,FL) \
if( Wdg->currentItem() != Data) { \
FL = 1; \
Data = Wdg->currentItem(); \
}
+#define STXT(a, b) \
+ b->setText( a );
+
+#define SCB(a, b) \
+ b->setChecked( a );
+
+#define SSB( Data,Wdg) \
+ Wdg->setValue( Data )
+
extern bool validIP( const QString & S );
#endif
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
@@ -1,9 +1,11 @@
#ifndef __UTILS_H
#define __UTILS_H
+#include <opie2/odebug.h>
+
#define Log(x) VLog x
extern void VLog( char * Format, ... );
extern void LogClose( void );
extern QString removeSpaces( const QString & X );
#endif
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
@@ -1,25 +1,38 @@
#include <time.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
-
#include <qpainter.h>
#include <qbitmap.h>
#include <qtextstream.h>
#include <qpixmap.h>
#include "resources.h"
#include "netnode.h"
-#include "asdevice.h"
-#include "asline.h"
-#include "asconnection.h"
-#include "asfullsetup.h"
+static char * ActionName[] = {
+ "Disable",
+ "Enable",
+ "Activate",
+ "Deactivate",
+ "Up",
+ "Down"
+};
+
+static char * StateName[] = {
+ "Unchecked",
+ "Unknown",
+ "Unavailable",
+ "Disabled",
+ "Off",
+ "Available",
+ "IsUp"
+};
QString & deQuote( QString & X ) {
if( X[0] == '"' ) {
// remove end and trailing "" and \x -> x
QChar R;
long idx;
idx = X.length()-1;
X = X.mid( 1, idx );
@@ -60,16 +73,31 @@ QString quote( QString X ) {
void ANetNode::saveAttributes( QTextStream & TS ) {
saveSpecificAttribute( TS );
}
void ANetNode::setAttribute( QString & Attr, QString & Value ){
setSpecificAttribute( Attr, Value );
}
+bool ANetNode::isToplevel( void ) {
+ const char ** P = provides();
+ while( *P ) {
+ if( strcmp( *P, "fullsetup") == 0 )
+ return 1;
+ P ++;
+ }
+ return 0;
+}
+
+bool ANetNode::openFile( SystemFile & SF,
+ ANetNodeInstance * NNI ) {
+ return (NNI ) ? NNI->openFile( SF ) : 0 ;
+}
+
//
//
// ANETNODEINSTANCE
//
//
long ANetNodeInstance::InstanceCounter = -1;
@@ -79,25 +107,25 @@ void ANetNodeInstance::initialize( void ) {
// set name
QString N;
N.sprintf( "-%ld", InstanceCounter++ );
N.prepend( NodeType->name() );
setName( N.latin1() );
}
void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){
- if( Attr == "name" ) {
+ if( Attr == "__name" ) {
setName( Value.latin1() );
} else {
setSpecificAttribute( Attr, Value );
}
}
void ANetNodeInstance::saveAttributes( QTextStream & TS ) {
- TS << "name=" << name() << endl;
+ TS << "__name=" << name() << endl;
saveSpecificAttribute( TS );
}
ANetNodeInstance * ANetNodeInstance::nextNode( void ) {
return connection()->findNext( this );
}
//
@@ -107,27 +135,29 @@ ANetNodeInstance * ANetNodeInstance::nextNode( void ) {
//
NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() {
IsModified = 0;
Index = -1;
Name="";
IsNew = 1;
CurrentState = Unchecked;
+ AssignedInterface = 0;
}
NodeCollection::NodeCollection( QTextStream & TS ) :
QList<ANetNodeInstance>() {
long idx;
bool InError = 0;
QString S, A, N;
IsModified = 0;
Index = -1;
Name="";
IsNew = 0;
+ AssignedInterface = 0;
CurrentState = Unchecked;
do {
S = TS.readLine();
if( S.isEmpty() ) {
if( InError ) {
// remove all nodes
clear();
@@ -142,37 +172,39 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
A.lower();
N = S.mid( idx+1, S.length() );
N.stripWhiteSpace();
N = deQuote( N );
if( A == "name" ) {
Name = N;
} else if( A == "number" ) {
- Log(( "Profile number %s\n", N.latin1() ));
setNumber( N.toLong() );
} else if( A == "node" ) {
ANetNodeInstance * NNI = NSResources->findNodeInstance( N );
if( NNI && ! InError ) {
append( NSResources->findNodeInstance( N ) );
} else {
// could not find a node type -> collection invalid
InError = 1;
}
}
} while( 1 );
+
+ Log(( "Profile number %s : %d nodes\n",
+ N.latin1(), count() ));
}
NodeCollection::~NodeCollection( void ) {
}
const QString & NodeCollection::description( void ) {
ANetNodeInstance * NNI = getToplevel();
- return (NNI) ? NNI->runtime()->asFullSetup()->description() : Name;
+ return (NNI) ? NNI->runtime()->description() : Name;
}
void NodeCollection::append( ANetNodeInstance * NNI ) {
NNI->setConnection( this );
QList<ANetNodeInstance>::append( NNI );
}
void NodeCollection::save( QTextStream & TS ) {
@@ -249,17 +281,18 @@ static char * State2PixmapTbl[] = {
"disconnected", // available
"connected" // up
};
QPixmap NodeCollection::devicePixmap( void ) {
QPixmap pm = NSResources->getPixmap(
getToplevel()->nextNode()->pixmapName()+"-large");
- QPixmap Mini = NSResources->getPixmap( device()->netNode()->pixmapName() );
+ QPixmap Mini = NSResources->getPixmap(
+ device()->netNode()->pixmapName() );
if( pm.isNull() || Mini.isNull() )
return Resource::loadPixmap("Unknown");
QPainter painter( &pm );
painter.drawPixmap( pm.width()-Mini.width(),
pm.height()-Mini.height(),
Mini );
@@ -275,63 +308,204 @@ QString NodeCollection::stateName( State_t S) {
switch( S ) {
case Unknown :
return qApp->translate( "networksettings2", "Unknown");
case Unavailable :
return qApp->translate( "networksettings2", "Unavailable");
case Disabled :
return qApp->translate( "networksettings2", "Disabled");
case Off :
- return qApp->translate( "networksettings2", "Off");
+ return qApp->translate( "networksettings2", "Inactive");
case Available :
return qApp->translate( "networksettings2", "Available");
case IsUp :
- return qApp->translate( "networksettings2", "IsUp");
+ return qApp->translate( "networksettings2", "Up");
case Unchecked : /* FT */
default :
break;
}
return QString("");
}
void NodeCollection::reassign( void ) {
for( QListIterator<ANetNodeInstance> it(*this);
it.current();
++it ) {
it.current()->setConnection( this );
}
}
-bool NodeCollection::triggersVPN() {
- return getToplevel()->runtime()->asFullSetup()->triggersVPN();
+const QStringList & NodeCollection::triggers() {
+ return getToplevel()->runtime()->triggers();
}
-bool NodeCollection::hasDataForFile( const QString & S ) {
+bool NodeCollection::hasDataForFile( SystemFile & S ) {
return ( firstWithDataForFile( S ) != 0 );
}
-ANetNodeInstance * NodeCollection::firstWithDataForFile( const QString & S ) {
+ANetNodeInstance * NodeCollection::firstWithDataForFile( SystemFile & S ) {
for( QListIterator<ANetNodeInstance> it(*this);
it.current();
++it ) {
if( it.current()->hasDataForFile( S ) ) {
- Log(( "Node %s has data for %s\n",
- it.current()->nodeClass()->name(),
- S.latin1() ));
return it.current();
}
}
return 0;
}
+State_t NodeCollection::state( bool Update ) {
+ State_t NodeState;
+
+ if( CurrentState == Unchecked || Update ) {
+ // collect states of all nodes until with get the 'higest'
+ // state possible
+
+ Log(( "Connection %s state %s\n",
+ Name.latin1(), StateName[CurrentState] ));
+
+ CurrentState = Unknown;
+ for( QListIterator<ANetNodeInstance> it(*this);
+ it.current();
+ ++it ) {
+ Log(( "-> Detect %s\n", it.current()->name() ));
+ NodeState = it.current()->runtime()->detectState();
+ Log(( " state %s\n", StateName[NodeState] ));
+
+ if( NodeState == Disabled ||
+ NodeState == IsUp ) {
+ // max
+ CurrentState = NodeState;
+ break;
+ }
+
+ if( NodeState > CurrentState ) {
+ // higher
+ CurrentState = NodeState;
+ }
+ }
+ }
+
+ return CurrentState;
+}
+
+QString NodeCollection::setState( Action_t A, bool Force ) {
+
+ QString msg;
+ Action_t Actions[10];
+ int NoOfActions = 0;
+
+ // get current state
+ state( Force );
+
+ switch( A ) {
+ case Disable :
+ if( CurrentState < Disabled ) {
+ // disabled
+ CurrentState = Disabled;
+ return QString();
+ }
+
+ if( CurrentState == IsUp ) {
+ Actions[NoOfActions++] = Down;
+ Actions[NoOfActions++] = Deactivate;
+ } else if( CurrentState == Available ) {
+ Actions[NoOfActions++] = Deactivate;
+ }
+ Actions[NoOfActions++] = Disable;
+ break;
+ case Enable :
+ // always possible -> detected state is new state
+ Actions[NoOfActions++] = Enable;
+ break;
+ case Activate :
+ if( ! Force ) {
+ if( CurrentState >= Available ) {
+ // already available
+ return QString();
+ }
+
+ if( CurrentState != Off ) {
+ return qApp->translate( "System",
+ "State should be off" );
+ }
+ }
+
+ Actions[NoOfActions++] = Activate;
+ break;
+ case Deactivate :
+ if( ! Force ) {
+ if( CurrentState < Off ) {
+ // already inactive
+ return QString();
+ }
+ }
+
+ if( CurrentState == IsUp ) {
+ Actions[NoOfActions++] = Down;
+ }
+ Actions[NoOfActions++] = Deactivate;
+ break;
+ case Up :
+ if( ! Force ) {
+ if( CurrentState == IsUp ) {
+ return QString();
+ }
+ if( CurrentState < Off ) {
+ return qApp->translate( "System",
+ "State should at least be off" );
+ }
+ }
+ if( CurrentState == Off ) {
+ Actions[NoOfActions++] = Activate;
+ }
+ Actions[NoOfActions++] = Up;
+ break;
+ case Down :
+ if( ! Force ) {
+ if( CurrentState < Available ) {
+ // OK
+ return QString();
+ }
+ }
+ Actions[NoOfActions++] = Down;
+ break;
+ }
+
+ // send actions to all nodes
+ Log(( "Action %s requires %d steps\n",
+ ActionName[A], NoOfActions ));
+
+ for( int i = 0 ; i < NoOfActions; i ++ ) {
+ // setState recurses through the tree depth first
+ msg = getToplevel()->runtime()->setState( this, Actions[i], Force );
+ if( ! msg.isEmpty() ) {
+ return msg;
+ }
+ }
+ return QString();
+}
+
//
//
-// RUNTIMEINFO
+// RuntimeInfo
//
//
-InterfaceInfo * RuntimeInfo::assignedInterface( void ) {
- return netNode()->nextNode()->runtime()->assignedInterface();
-}
+QString RuntimeInfo::setState( NodeCollection * NC,
+ Action_t A,
+ bool Force ) {
+ QString M;
+ RuntimeInfo * Deeper = nextNode();
+
+ if( Deeper ) {
+ // first go deeper
+ M = Deeper->setState( NC, A, Force );
+ if( ! M.isEmpty() )
+ return M;
+ }
-AsDevice * RuntimeInfo::device( void ) {
- return netNode()->nextNode()->runtime()->device();
+ // set my own state
+ Log (( "-> Act upon %s\n", netNode()->name() ));
+ M = setMyState( NC, A, Force );
+ Log (( " result %s\n", M.latin1() ));
+ return M;
}
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
@@ -5,32 +5,34 @@
#include <qlist.h>
#include <qdict.h>
#include <qpixmap.h>
#include <qstringlist.h>
#include <qobject.h>
#include <time.h>
#include <Utils.h>
+#include <system.h>
// difference feature interfaces
class AsDevice;
class AsLine;
class AsConnection;
class AsFullSetup;
// needed for plugin creation function
#include <qlist.h>
class ANetNode;
class ANetNodeInstance;
class NodeCollection;
class QTextStream;
class RuntimeInfo;
class InterfaceInfo;
+class NSResources;
extern QString & deQuote( QString & X );
extern QString quote( QString X );
#include "systemfile.h"
typedef enum State {
// if we have not yet detected the state of the device
@@ -50,31 +52,31 @@ typedef enum State {
// if connection is available to be used (i.e. the
// devices if fully ready to be used
Available = 5,
// if connection is being used
IsUp = 6
} State_t;
typedef enum Action {
- // to make the device unavailable functionally
+ // to make the device unavailable functionally -> to disabled
Disable = 0,
- // to make the device available functionally
+ // to make the device available functionally -> to off
Enable = 1,
- // bring the hardware up
+ // bring the hardware up -> to Available
Activate = 2,
- // bring the hardware down
+ // bring the hardware down -> to off
Deactivate = 3,
- // bring the connection up
+ // bring the connection up -> to IsUp
Up = 4,
- // bring the connection down
+ // bring the connection down -> to Available
Down = 5
} Action_t;
-class ANetNode : public QObject{
+class ANetNode : public QObject {
public:
typedef QArray<ANetNode *> NetNodeList;
ANetNode( const char * Name ) : QObject( 0, Name ) {}
virtual ~ANetNode(){};
@@ -85,18 +87,17 @@ public:
//
inline int done( void )
{ return Done; }
inline void setDone( int D )
{ Done = D; }
// does this Node provide a Connection
- inline bool isToplevel( void )
- { return strcmp( provides(), "fullsetup") == 0 ; }
+ bool isToplevel( void );
// set the value of an attribute
void setAttribute( QString & Attr, QString & Value ) ;
void saveAttributes( QTextStream & TS ) ;
// compiled references to 'needed' NetNodes -> needs list
inline void setAlternatives( NetNodeList * Alt )
{ Alternatives = Alt; }
@@ -105,68 +106,82 @@ public:
//
//
// Virtual methods with sensible default
//
//
// do instances of this noce class have data for this file
- virtual bool hasDataForFile( const QString & )
+ virtual bool hasDataForFile( SystemFile & )
{ return 0; }
+ // open proper file SF identified by S
+ // this method is called by NS2.
+ //
+ // overrule this ONLY if this proper file is a common file
+ // for all NNI of this node class and the data generated
+ // by each of the NNI needs to be put in one file
+ //
+ // if this is the case the file should be (re)opened in append
+ // return 0 if file cannot be opened
+ virtual bool openFile( SystemFile &SF,
+ ANetNodeInstance * NNI );
+
// generate instance independent stuff
// 0 : data output, 1 no data, 2 error
- virtual short generateFile( const QString & ,
- const QString & ,
- QTextStream & ,
- long )
+ virtual short generatePreamble( SystemFile & )
+ { return 1; }
+
+ // generate instance independent stuff
+ // 0 : data output, 1 no data, 2 error
+ virtual short generatePostamble( SystemFile & )
{ return 1; }
- // generate instance dependent but profile common stuff
+ // generate instance dependent but instance common stuff
// 0 : data output, 1 no data, 2 error
- virtual short generateFile( const QString & ,
- const QString & ,
- QTextStream & ,
+ virtual short generateFile( SystemFile &,
ANetNodeInstance * ,
long )
{ return 1; }
-
// generate NIC name based on instance nr
// only relevant if node instances are devices
virtual QString genNic( long )
{ return QString(""); }
// max number of instances for this node type
// only relevant if node instances are devices
virtual long instanceCount( void )
{ return 1; }
- // return list of files that are specific for this node class
- virtual QStringList * properFiles( void )
- { return 0; }
+ // return ID list for each file generated specially for
+ // this node type
+ virtual QStringList properFiles( void )
+ { return QStringList(); }
//
//
// pure virtual methods with sensible default
//
//
// pixmap needed for this NetNode
virtual const QString pixmapName() = 0;
// description for this NetNode
virtual const QString nodeDescription() = 0;
// create a blank instance of a net node
virtual ANetNodeInstance * createInstance( void ) = 0;
- // return feature this NetNode provides
- virtual const char * provides( void ) = 0;
+ // return features this NetNode provides
+ virtual const char ** provides( void ) = 0;
+
+ // return features this NetNode needs
virtual const char ** needs( void ) = 0;
protected :
NetNodeList * Alternatives;
private :
@@ -219,17 +234,17 @@ public:
{ return Description; }
inline void setDescription( const QString & S )
{ Description = S; }
// pixmap for this instance -> from NetNode
inline const QString pixmapName( void )
{ return NodeType->pixmapName(); }
- inline const char * provides( void )
+ inline const char ** provides( void )
{ return NodeType->provides(); }
inline const char ** needs( void )
{ return NodeType->needs(); }
inline void setConnection( NodeCollection * NC )
{ Connection = NC; }
inline NodeCollection * connection( void )
@@ -239,42 +254,38 @@ public:
//
// Virtual methods with sensible defaults
//
//
// open proper file identified by S
- virtual QFile * openFile( const QString & )
+ virtual bool openFile( SystemFile & )
{ return 0; }
// check if this node (or sub nodes) have data for this file
- virtual bool hasDataForFile( const QString & S )
+ virtual bool hasDataForFile( SystemFile & S )
{ return nodeClass()->hasDataForFile( S ); }
// generate code specific for this node but embedded
// in the section of the parent
// this is called within the code of the parent
- virtual short generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ virtual short generateFileEmbedded( SystemFile & SF,
long DevNr )
{ ANetNodeInstance * NNI = nextNode();
- return (NNI) ? NNI->generateFileEmbedded( ID, Path, TS, DevNr ) : 1;
+ return (NNI) ? NNI->generateFileEmbedded( SF, DevNr ) : 1;
}
// generate code specific for this node
// (or find the first node that does)
- virtual short generateFile( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ virtual short generateFile( SystemFile & SF,
long DevNr )
{ ANetNodeInstance * NNI = nextNode();
- return (NNI) ? NNI->generateFile( ID, Path, TS, DevNr ) : 1;
+ return (NNI) ? NNI->generateFile( SF, DevNr ) : 1;
}
// return true if this node instance is triggered by this trigger
// could be delegated to deeper instances
virtual bool triggeredBy( const QString & )
{ return 0; }
//
@@ -318,51 +329,141 @@ class RuntimeInfo : public QObject {
Q_OBJECT
public :
RuntimeInfo( ANetNodeInstance * TheNNI )
{ NNI = TheNNI; }
- // downcast implemented by specify runtime classes
- virtual AsDevice * asDevice( void )
- { return 0; }
- virtual AsConnection * asConnection( void )
- { return 0; }
- virtual AsLine * asLine( void )
- { return 0; }
- virtual AsFullSetup * asFullSetup( void )
- { return 0; }
+ //
+ //
+ // methods to be overloaded by connection capable
+ // runtimes
+ //
+ //
+
+
+ //
+ //
+ // methods to be overloaded by device capable
+ // runtimes
+ //
+ //
// does this node handles this interface e.g.eth0
// recurse deeper if this node cannot answer that question
- virtual bool handlesInterface( const QString & )
- { return 0; }
- virtual bool handlesInterface( const InterfaceInfo & )
- { return 0; }
- virtual InterfaceInfo * assignedInterface( void );
- virtual AsDevice * device( void );
-
- ANetNodeInstance * netNode()
+ virtual bool handlesInterface( const QString & S ) {
+ RuntimeInfo * RI = device();
+ if( RI ) {
+ return RI->handlesInterface( S );
+ }
+ return 0;
+ }
+ bool handlesInterface( const InterfaceInfo & I ) {
+ RuntimeInfo * RI = device();
+ if( RI ) {
+ return RI->handlesInterface( I );
+ }
+ return 0;
+ }
+
+ //
+ //
+ // methods to be overloaded by full setup capable
+ // runtimes
+ //
+ //
+
+ // return description for this full setup
+ virtual const QString & description( void ) {
+ return fullSetup()->description( );
+ }
+ // return triggers that should fire when this
+ // setup is brought up
+ virtual const QStringList & triggers( void ) {
+ return fullSetup()->triggers( );
+ }
+
+ //
+ //
+ // methods to be overloaded by line capable
+ // runtimes
+ //
+ //
+
+ // return the device file ('/dev/xxx') created
+ // by this line capable runtime
+ virtual QString deviceFile( void ) {
+ RuntimeInfo * RI = line();
+ if( RI ) {
+ return RI->deviceFile();
+ }
+ return QString();
+ }
+
+ //
+ //
+ // runtime interface
+ //
+ //
+
+ // return the node that offers device capability
+ virtual RuntimeInfo * device( void )
+ { RuntimeInfo * RI = nextNode();
+ return (RI) ? RI->device() : 0;
+ }
+
+ // return the node that offers connection capability
+ virtual RuntimeInfo * connection( void )
+ { RuntimeInfo * RI = nextNode();
+ return (RI) ? RI->connection() : 0;
+ }
+
+ // return the node that offers line capability
+ virtual RuntimeInfo * line( void )
+ { RuntimeInfo * RI = nextNode();
+ return (RI) ? RI->line() : 0;
+ }
+
+ // return the node that offers full setup capability
+ virtual RuntimeInfo * fullSetup( void )
+ { RuntimeInfo * RI = nextNode();
+ return (RI) ? RI->fullSetup() : 0;
+ }
+
+ inline ANetNodeInstance * netNode()
{ return NNI; }
- NodeCollection * connection()
+
+ inline NodeCollection * nodeCollection()
{ return NNI->connection(); }
- virtual void detectState( NodeCollection * NC ) = 0;
- virtual bool setState( NodeCollection * NC, Action_t A, bool Force = 0 ) = 0;
- virtual bool canSetState( State_t Curr, Action_t A ) = 0;
+ virtual State_t detectState( void ) = 0;
+ // public API to set the state
+ virtual QString setState( NodeCollection * NC,
+ Action_t A,
+ bool Force = 0 );
+
+ inline RuntimeInfo * nextNode( void ) {
+ ANetNodeInstance * NNI = netNode()->nextNode();
+ return (NNI) ? NNI->runtime() : 0;
+ }
signals :
// sent by device if state changes
void stateChanged( State_t S, ANetNodeInstance * NNI );
protected :
+ // set state of this node (private API)
+ virtual QString setMyState( NodeCollection * NC,
+ Action_t A,
+ bool Force = 0 ) = 0;
+
// connection this runtime info belongs to
ANetNodeInstance * NNI;
};
class NodeCollection : public QList<ANetNodeInstance> {
public :
@@ -387,52 +488,53 @@ public :
{ return IsModified; }
inline void setModified( bool N )
{ IsModified = N ; }
inline bool handlesInterface( const QString & S ) {
return getToplevel()->runtime()->handlesInterface( S );
}
+ // return the interface in the OS that is assigned to
+ // this device
inline InterfaceInfo * assignedInterface( void ) {
- return getToplevel()->runtime()->assignedInterface();
+ return AssignedInterface;
}
- inline AsDevice * device() {
+ // assign the interface to this device
+ inline void assignInterface( InterfaceInfo * NI ) {
+ if( NI == 0 ) {
+ if( AssignedInterface ) {
+ AssignedInterface->assignConnection( 0 );
+ }
+ }
+ AssignedInterface = NI;
+ if( AssignedInterface ) {
+ AssignedInterface->assignConnection( this );
+ }
+ }
+
+ inline RuntimeInfo * device() {
return getToplevel()->runtime()->device();
}
- bool triggersVPN();
-
- inline State_t state( bool Update = 0 )
- { Log(( "%s state %d(=%d?)\n", Name.latin1(), CurrentState,
- Unchecked ));
- if( CurrentState == Unchecked || Update ) {
- Log(( "TL %p TLR %p\n",
- getToplevel(),
- getToplevel()->runtime() ));
- // need to get current state
- getToplevel()->runtime()->detectState( this );
- }
- return CurrentState;
- }
+ const QStringList & triggers();
+
+ State_t state( bool Update = 0 );
// get the ixmap for this device
QPixmap devicePixmap( void );
QPixmap statePixmap( State_t S );
inline QPixmap statePixmap( bool Update = 0 )
{ return statePixmap( state(Update) ); }
QString stateName( State_t );
inline QString stateName( bool Update = 0 )
{ return stateName( state(Update) ); }
- inline bool setState( Action_t A, bool Force =0 )
- { return getToplevel()->runtime()->setState( this, A, Force ); }
- inline bool canSetState( Action_t A )
- { return getToplevel()->runtime()->canSetState( CurrentState, A ); }
+ QString setState( Action_t A, bool Force = 0 );
void save( QTextStream & TS );
void append( ANetNodeInstance * NNI );
// makes sure that all items in the connection point to
// that connectoin
void reassign( void );
@@ -451,26 +553,24 @@ public :
inline State_t currentState( void )
{ return CurrentState; }
inline void setCurrentState( State_t S )
{ CurrentState = S; }
// return TRUE if this node can have data to be inserted in
// file identified by S
- bool hasDataForFile( const QString & S );
- ANetNodeInstance * firstWithDataForFile( const QString & S );
+ bool hasDataForFile( SystemFile & S );
+ ANetNodeInstance * firstWithDataForFile( SystemFile & );
// generate items for this file -> toplevel call
- short generateFile( const QString & FID, // identification of file
- const QString & FName, // effective filename of file
- QTextStream & TS, // stream to file
+ short generateFile( SystemFile & SF,
long DN // device number
)
- { return getToplevel()->generateFile( FID, FName, TS, DN ); }
+ { return getToplevel()->generateFile( SF, DN ); }
bool triggeredBy( const QString & Trigger )
{ return getToplevel()->triggeredBy( Trigger ); }
private :
int compareItems ( QCollection::Item item1,
QCollection::Item item2 );
@@ -484,11 +584,13 @@ private :
// true if this collection was just created (and not
// loaded from file
bool IsNew;
// index in listbox
int Index;
bool IsModified;
int Done;
+ InterfaceInfo * AssignedInterface;
+
};
#endif
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
@@ -1,22 +1,18 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#CONFIG += qt warn_on debug
DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
HEADERS = netnode.h \
resources.h \
system.h \
- asline.h \
GUIUtils.h \
- asconnection.h \
- asfullsetup.h \
systemfile.h \
- wextensions.h \
- asdevice.h
+ wextensions.h
SOURCES = netnode.cpp \
GUIUtils.cpp \
system.cpp \
systemfile.cpp \
wextensions.cpp \
resources.cpp
INCLUDEPATH += $(OPIEDIR)/include ../networksettings2
DEPENDPATH += $(OPIEDIR)/include
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
@@ -40,59 +40,67 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
// must iterate this way to avoid duplication pointers
for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes );
InnerIt.current(); ++InnerIt ) {
if( InnerIt.current() == OuterIt.current() )
// avoid recursive
continue;
- const char * Provides = InnerIt.current()->NetNode->provides();
+ const char ** Provides = InnerIt.current()->NetNode->provides();
NeedsRun = OuterIt.current()->NetNode->needs();
+
for( ; *NeedsRun; NeedsRun ++ ) {
- if( strcmp( Provides, *NeedsRun ) == 0 ) {
- // inner provides what outer needs
- NNL.resize( NNL.size() + 1 );
- NNL[NNL.size()-1] = InnerIt.current()->NetNode;
- Done = 1; // break from 2 loops
- break;
+ const char ** PRun;
+ PRun = Provides;
+ for( ; *PRun; PRun ++ ) {
+ if( strcmp( *PRun, *NeedsRun ) == 0 ) {
+ // inner provides what outer needs
+ NNL.resize( NNL.size() + 1 );
+ NNL[NNL.size()-1] = InnerIt.current()->NetNode;
+ Done = 1; // break from 2 loops
+ break;
+ }
}
}
}
OuterIt.current()->NetNode->setAlternatives( NNLP );
}
}
- // define Node types to Description map
- NodeTypeNameMap.insert( "device", tr( "Network Device" ) );
- NodeTypeNameMap.insert( "line", tr( "Character device" ) );
- NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) );
- NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) );
-
- NodeTypeDescriptionMap.insert( "device",
- tr( "<p>Devices that can handle IP packets</p>" ) );
- NodeTypeDescriptionMap.insert( "line",
- tr( "<p>Devices that can handle single bytes</p>" ) );
- NodeTypeDescriptionMap.insert( "connection",
- tr( "<p>Nodes that provide working IP connections</p>" ) );
- NodeTypeDescriptionMap.insert( "fullsetup",
- tr( "<p>Fully configured connection profile</p>" ) );
-
- // define system files
- addSystemFile( "interfaces", "/tmp/interfaces", 1 );
+ // define built in Node types to Description map
+ addNodeType( "device", tr( "Network Device" ),
+ tr( "<p>Devices that can handle IP packets</p>" ) );
+ addNodeType( "line", tr( "Character device" ),
+ tr( "<p>Devices that can handle single bytes</p>" ) );
+ addNodeType( "connection", tr( "IP Connection" ),
+ tr( "<p>Nodes that provide working IP connections</p>" ) );
+ addNodeType( "fullsetup", tr( "Connection Profile" ),
+ tr( "<p>Fully configured connection profile</p>" ) );
+ addNodeType( "GPRS", tr( "Connection to GPRS device" ),
+ tr( "<p>Connection to a GPRS capable device</p>" ) );
// get access to the system
TheSystem = new System();
}
TheNSResources::~TheNSResources( void ) {
delete TheSystem;
}
+void TheNSResources::addNodeType( const QString & ID,
+ const QString & Name,
+ const QString & Descr ) {
+ if( NodeTypeNameMap[ID].isEmpty() ) {
+ NodeTypeNameMap.insert( ID, Name );
+ NodeTypeDescriptionMap.insert( ID, Descr );
+ }
+}
+
void TheNSResources::addSystemFile( const QString & ID,
const QString & P,
bool KDI ) {
if( ! SystemFiles.find( ID ) ) {
// new system file
SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) );
} // else existed
}
@@ -215,18 +223,20 @@ bool TheNSResources::loadNetNode(
return 1;
}
QPixmap TheNSResources::getPixmap( const QString & QS ) {
QPixmap P;
QString S("networksettings2/");
S += QS;
- Log(("%s\n", S.latin1() ));
P = Resource::loadPixmap( S );
+ if( P.isNull() ) {
+ Log(( "Cannot load %s\n", S.latin1() ));
+ }
return ( P.isNull() ) ? QPixmap() : P;
}
QString TheNSResources::tr( const char * s ) {
return qApp->translate( "resource", s );
}
const QString & TheNSResources::netNode2Name( const char * s ) {
@@ -264,16 +274,26 @@ void TheNSResources::removeConnection( const QString & N ) {
}
ConnectionsMap.remove( N );
}
NodeCollection * TheNSResources::findConnection( const QString & S ) {
return ConnectionsMap[ S ];
}
+NodeCollection * TheNSResources::getConnection( int nr ) {
+ for( QDictIterator<NodeCollection> it(ConnectionsMap);
+ it.current();
+ ++it ) {
+ if( it.current()->number() == nr ) {
+ return it.current();
+ }
+ }
+ return 0;
+}
/*
void TheNSResources::renumberConnections( void ) {
Name2Connection_t & M = NSResources->connections();
NodeCollection * NC;
// for all connections
NodeCollection::resetMaxNr();
for( QDictIterator<NodeCollection> it(M);
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
@@ -62,16 +62,21 @@ public :
{ return AllNodeTypes; }
bool netNodeExists( const QString & X )
{ return AllNodeTypes.find(X)!=0; }
ANetNode * findNetNode( const QString & N )
{ NetNode_t * NNT = AllNodeTypes.find(N);
return (NNT) ? NNT->NetNode : 0;
}
+ // define new plugin (=node)
+ void addNodeType( const QString & ID,
+ const QString & LongName,
+ const QString & Description );
+
Name2SystemFile_t & systemFiles( void )
{ return SystemFiles; }
void addSystemFile( const QString & ID,
const QString & P,
bool KDI );
ANetNodeInstance * createNodeInstance( const QString & S )
{ ANetNodeInstance * NNI = 0;
@@ -94,16 +99,17 @@ public :
{ return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; }
const QString & netNode2Name( const char * Type );
const QString & netNode2Description( const char * Type );
void addConnection( NodeCollection * NC );
void removeConnection( const QString & N );
NodeCollection * findConnection( const QString & N );
+ NodeCollection * getConnection( int nr );
Name2Connection_t & connections( void )
{ return ConnectionsMap; }
inline bool userKnown( void )
{ return CurrentUser.known(); }
CurrentQPEUser & currentUser( void )
{ return CurrentUser; }
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
@@ -8,16 +8,18 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
+#include <opie2/oprocess.h>
+
#include <qdir.h>
#include <qregexp.h>
#include <qstringlist.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qapplication.h>
#include "resources.h"
@@ -45,73 +47,128 @@ System::System( void ) : QObject(), ProbedInterfaces() {
probeInterfaces();
}
System::~System( void ) {
if( ProcDevNet )
delete ProcDevNet;
}
-int System::runAsRoot( const QString & S ) {
- QString MyS = S;
+int System::runAsRoot( QStringList & S ) {
char * usr = getenv("USER");
- char ch;
- if( S.isEmpty() ) {
+ if( S.count() == 0 ) {
// loophole to start shell
return 8888;
}
if( usr == 0 || strcmp( usr, "root" ) ) {
// unknown or non-root user -> use SUDO
- MyS.prepend( "sudo " );
+ S.prepend( "sudo" );
}
- Log(("Executing %s\n", MyS.latin1() ));
-
- emit lineFromCommand( tr("Command : ") + MyS );
- emit lineFromCommand( "---------------" );
- Log(( "Command : %s\n", MyS.latin1() ) );
- MyS += " 2>&1 ";
- OutputOfCmd = popen( MyS.latin1(), "r" ) ;
- if( ! OutputOfCmd ) {
- // cannot fork
- return 1;
+ if( getenv( "NS2TESTMODE" ) ) {
+ owarn << "TESTMODE !!! execute "
+ << S.join( " ")
+ << oendl;
+ } else {
+ MyProcess * P = new MyProcess();
+ emit processEvent( tr("Command : ") + S.join( " " ) );
+
+ P->process() << S;
+
+ connect( P,
+ SIGNAL( stdoutLine( const QString & ) ),
+ this,
+ SIGNAL( stdoutLine( const QString & ) ) );
+
+ connect( P,
+ SIGNAL( stderrLine( const QString & ) ),
+ this,
+ SIGNAL( stderrLine( const QString & ) ) );
+
+ connect( P,
+ SIGNAL(processExited(MyProcess*) ),
+ this, SLOT
+ (SLOT_ProcessExited(MyProcess*) ) );
+
+ Log(("Executing %s\n", S.join( " " ).latin1() ));
+
+ if( ! P->process().start( OProcess::DontCare,
+ OProcess::AllOutput ) ) {
+ owarn << "Error starting " << S << oendl;
+ delete P;
+ // error starting app
+ return 1;
+ }
+ owarn << "Started " << S << oendl;
}
- // read all data
- QString Line = "";
- while( 1 ) {
- if( fread( &ch, 1, 1, OutputOfCmd ) < 1 )
- // eof
- break;
- if( ch == '\n' || ch == '\r' ) {
- if( ! Line.isEmpty() ) {
- Log(( "read cmd output : **%s**\n", Line.latin1() ) );
- emit lineFromCommand( Line );
- Line = "";
- qApp->processEvents();
+ // all is fine
+ return 0;
+}
+
+int System::execAsUser( QStringList & SL ) {
+ MyProcess * P = new MyProcess();
+ CurrentQPEUser CU = NSResources->currentUser();
+ char * usr = getenv("USER");
+
+ if( strcmp( usr, "root" ) == 0 ) {
+ // find user running qpe
+ if( CU.UserName.isEmpty() ) {
+ // if we come here, the exec was not successfull
+ Log(("User not known \n" ));
+ return 0;
}
- } else {
- Line += ch;
}
- }
- if( ! Line.isEmpty() ) {
- emit lineFromCommand( Line );
- Log(( "read cmd output : **%s**\n", Line.latin1() ) );
- }
- Log(( "End of command\n", Line.latin1() ) );
+ // now we are ready to exec the requested command
+ setuid( CU.Uid );
+ setgid( CU.Gid );
- if( pclose( OutputOfCmd ) < 0 ) {
- // error in command
- return 3;
- }
+ for( unsigned int i = 0 ; i < CU.EnvList.count() ; i ++ ) {
+ QString X;
+ QStringList SL;
+ X = CU.EnvList[i];
+ SL = QStringList::split( "=", X );
+ P->process().setEnvironment( SL[0], SL[1] );
+ }
- // all is fine
- return 0;
+ P->process() << SL;
+
+ emit processEvent( tr("Command : ") + SL.join( " " ) );
+
+ Log(("Executing as user %s : %s\n",
+ CU.UserName.latin1(),
+ SL.join( " " ).latin1() ));
+
+ int rv = ( P->process().start( OProcess::DontCare,
+ OProcess::NoCommunication ) );
+ delete P;
+
+ if( rv ) {
+ // if we come here, the exec was not successfull
+ Log(("Could not exec : %d\n", errno ));
+ }
+
+ return rv;
+}
+
+void System::SLOT_ProcessExited( MyProcess * P ) {
+ QString R;
+
+ for( QValueListConstIterator<QCString> it = P->process().args().begin();
+ it != P->process().args().end();
+ ++it ) {
+ R += (*it);
+ R += " ";
+ }
+
+ R += "Returned with " + QString().setNum( P->process().exitStatus() );
+ emit processEvent( R );
+ delete P;
}
void System::refreshStatistics( InterfaceInfo & I ) {
if( ! ProcDevNet ) {
return;
}
// cannot seek on dev
ProcDevNet->close();
@@ -193,25 +250,39 @@ void System::probeInterfaces( void ) {
// flag all as 'down'
for( QDictIterator<InterfaceInfo> it( ProbedInterfaces );
it.current();
++it ) {
it.current()->IsUp = 0;
}
sockfd = socket(PF_INET, SOCK_DGRAM, 0);
- if(sockfd == -1)
+ if(sockfd == -1) {
+ owarn << "Cannot open INET socket "
+ << errno
+ << " "
+ << strerror( errno )
+ << oendl;
return;
+ }
// read interfaces from /proc/dev/net
// SIOCGIFCONF does not return ALL interfaces ???!?
ProcDevNet = new QFile(PROCNETDEV);
if( ! ProcDevNet->open(IO_ReadOnly) ) {
+ owarn << "Cannot open "
+ << PROCNETDEV
+ << " "
+ << errno
+ << " "
+ << strerror( errno )
+ << oendl;
delete ProcDevNet;
ProcDevNet =0;
+ ::close( sockfd );
return;
}
QString line;
QString NicName;
QTextStream procTs(ProcDevNet);
int loc = -1;
@@ -224,20 +295,20 @@ void System::probeInterfaces( void ) {
NicName = line.left(loc);
// set name for ioctl
strcpy( ifrs.ifr_name, NicName.latin1() );
if ( ! ( IFI = ProbedInterfaces.find( NicName ) ) ) {
// new nic
- Log(("NEWNIC %s\n", NicName.latin1()));
+ Log(("New NIC found : %s\n", NicName.latin1()));
IFI = new InterfaceInfo;
IFI->Name = line.left(loc);
- IFI->NetNode = 0;
+ IFI->Collection = 0;
ProbedInterfaces.insert( IFI->Name, IFI );
// get dynamic info
if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) {
IFI->IsPointToPoint = ((ifrs.ifr_flags & IFF_POINTOPOINT) == IFF_POINTOPOINT);
} else {
IFI->IsPointToPoint = 0;
}
@@ -251,17 +322,17 @@ void System::probeInterfaces( void ) {
inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_dstaddr)->sin_addr);
}
}
IFI->CardType = 999999;
IFI->MACAddress = "";
if( ioctl(sockfd, SIOCGIFHWADDR, &ifrs) >= 0 ) {
- Log(("%s = %d\n", IFI->Name.latin1(),
+ Log(("Family for NIC %s : %d\n", IFI->Name.latin1(),
ifrs.ifr_hwaddr.sa_family ));
IFI->CardType = ifrs.ifr_hwaddr.sa_family;
switch( ifrs.ifr_hwaddr.sa_family ) {
case ARPHRD_ETHER : // regular MAC address
// valid address -> convert to regular ::: format
// length = 6 bytes = 12 DIGITS -> 6 :
IFI->MACAddress.sprintf(
@@ -319,17 +390,17 @@ void System::probeInterfaces( void ) {
break;
case ARPHRD_IEEE80211 : // WLAN
break;
case ARPHRD_IRDA : // IRDA
break;
}
}
} else // else already probed before -> just update
- Log(("OLDNIC %s\n", NicName.latin1()));
+ Log(("Redetected NIC %s\n", NicName.latin1()));
// get dynamic info
if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) {
IFI->IsUp = ((ifrs.ifr_flags & IFF_UP) == IFF_UP);
IFI->HasMulticast = ((ifrs.ifr_flags & IFF_MULTICAST) == IFF_MULTICAST);
} else {
IFI->IsUp = 0;
IFI->HasMulticast = 0;
@@ -349,85 +420,154 @@ void System::probeInterfaces( void ) {
IFI->BCastAddress = "";
}
if( ioctl(sockfd, SIOCGIFNETMASK, &ifrs) >= 0 ) {
IFI->Netmask =
inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_netmask)->sin_addr);
} else {
IFI->Netmask = "";
}
- Log(("NIC %s UP %d\n", NicName.latin1(), IFI->IsUp ));
+ Log(("NIC %s UP ? %d\n", NicName.latin1(), IFI->IsUp ));
}
-}
-
-void System::execAsUser( QString & Cmd, char * argv[] ) {
- CurrentQPEUser CU = NSResources->currentUser();
-
- if( CU.UserName.isEmpty() ) {
- // if we come here, the exec was not successfull
- Log(("User not known \n" ));
- return;
- }
- // now we are ready to exec the requested command
- setuid( CU.Uid );
- setgid( CU.Gid );
-
- char ** envp = (char **)alloca( sizeof( char *) *
- (CU.EnvList.count()+1) );
+ ::close( sockfd );
+}
- for( unsigned int i = 0 ; i < CU.EnvList.count() ; i ++ ) {
- *(envp+i) = CU.EnvList[i];
+InterfaceInfo * System::findInterface( const QString & N ) {
+ InterfaceInfo * Run;
+ // has PAN connection UP interface ?
+ for( QDictIterator<InterfaceInfo> It(ProbedInterfaces);
+ It.current();
+ ++It ) {
+ Run = It.current();
+ if( N == Run->Name ) {
+ // this PAN connection is up
+ return Run;
+ }
}
- envp[CU.EnvList.count()]=NULL;
-
- execve( Cmd.latin1(), argv, envp );
-
- // if we come here, the exec was not successfull
- Log(("Could not exec : %d\n", errno ));
+ return 0;
}
#include <stdarg.h>
static FILE * logf = 0;
void VLog( char * Format, ... ) {
va_list l;
va_start(l, Format );
if( logf == (FILE *)0 ) {
- if( getenv("NS2STDERR") ) {
+ QString S = getenv("NS2LOG");
+ if( S == "stderr" ) {
logf = stderr;
- } else {
+ } else if( S.isEmpty() ) {
logf = fopen( "/tmp/ns2log", "a" );
+ } else {
+ logf = fopen( S, "a" );
}
+
if( ! logf ) {
- fprintf( stderr, "Cannot open logfile /tmp/ns2log %d\n",
- errno );
+ fprintf( stderr, "Cannot open logfile %s : %d\n",
+ S.latin1(), errno );
logf = (FILE *)1;
} else {
fprintf( logf, "____ OPEN LOGFILE ____\n");
}
}
- if( (long)logf > 1 ) {
+ if( (unsigned long)logf > 1 ) {
vfprintf( logf, Format, l );
}
va_end( l );
+ fflush( logf );
}
void LogClose( void ) {
if( (long)logf > 1 ) {
fprintf( logf, "____ CLOSE LOGFILE ____\n");
if( logf != stderr ) {
fclose( logf );
}
logf = 0;
}
}
QString removeSpaces( const QString & X ) {
- QStringList SL;
+ QString Y;
+ Y = X.simplifyWhiteSpace();
+ Y.replace( QRegExp(" "), "_" );
+ owarn << X << " **" << Y << "**" << oendl;
+ return Y;
+}
+
+//
+//
+//
+//
+//
+
+MyProcess::MyProcess() : QObject(), StdoutBuffer(), StderrBuffer() {
+ P = new OProcess();
+ connect( P,
+ SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int ) ),
+ this,
+ SLOT( SLOT_Stdout(Opie::Core::OProcess*,char*,int) ) );
+
+ connect( P,
+ SIGNAL( receivedStderr(Opie::Core::OProcess*, char*, int ) ),
+ this,
+ SLOT( SLOT_Stderr(Opie::Core::OProcess*,char*,int) ) );
+ connect( P,
+ SIGNAL( processExited(Opie::Core::OProcess*) ),
+ this,
+ SLOT( SLOT_ProcessExited(Opie::Core::OProcess*) ) );
+}
+
+MyProcess::~MyProcess() {
+ delete P;
+}
+
+void MyProcess::SLOT_Stdout( Opie::Core::OProcess * , char * Buf, int len ) {
+ char * LB = (char *)alloca( len + 1 );
+ memcpy( LB, Buf, len );
+ LB[len] = '\0';
+
+ // now input is zero terminated
+ StdoutBuffer += LB;
+
+ owarn << "Received " << len << " bytes on stdout" << oendl;
+ // see if we have some lines (allow empty lines)
+ QStringList SL = QStringList::split( "\n", StdoutBuffer, TRUE );
+
+ for( unsigned int i = 0; i < SL.count()-1; i ++ ) {
+ Log(( "Stdout : \"%s\"\n", SL[i].latin1() ) );
+ emit stdoutLine( SL[i] );
+ }
+
+ // last line is rest
+ StdoutBuffer = SL[ SL.count()-1 ];
+}
+
+void MyProcess::SLOT_Stderr( Opie::Core::OProcess * , char * Buf, int len ) {
+ char * LB = (char *)alloca( len + 1 );
+ memcpy( LB, Buf, len );
+ LB[len] = '\0';
+
+ // now input is zero terminated
+ StderrBuffer += LB;
+
+ owarn << "Received " << len << " bytes on stderr" << oendl;
+ // see if we have some lines (allow empty lines)
+ QStringList SL = QStringList::split( "\n", StderrBuffer, TRUE );
+
+ for( unsigned int i = 0; i < SL.count()-1; i ++ ) {
+ Log(( "Stderr : \"%s\"\n", SL[i].latin1() ) );
+ emit stderrLine( SL[i] );
+ }
+
+ // last line is rest
+ StderrBuffer = SL[ SL.count()-1 ];
+}
- SL = QStringList::split( " ", X );
- return SL.join( "_" );
+void MyProcess::SLOT_ProcessExited( Opie::Core::OProcess * ) {
+ emit processExited( this );
}
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
@@ -1,39 +1,77 @@
#ifndef __SYSTEM__H
#define __SYSTEM__H
+#include <qstring.h>
+
+#include <opie2/oprocess.h>
+
+using namespace Opie::Core;
+
// for hardware types
#include <net/if_arp.h>
#include <qdict.h>
#include <qobject.h>
#include <stdio.h>
+class NodeCollection;
class ANetNodeInstance;
class QFile;
+class MyProcess : public QObject {
+
+ Q_OBJECT
+
+public :
+
+ MyProcess();
+ ~MyProcess();
+
+ inline OProcess & process()
+ { return *P; }
+
+public slots :
+
+ void SLOT_Stdout( Opie::Core::OProcess * P, char *, int );
+ void SLOT_Stderr( Opie::Core::OProcess * P, char *, int );
+ void SLOT_ProcessExited( Opie::Core::OProcess * P);
+
+signals :
+
+ void stdoutLine( const QString & );
+ void stderrLine( const QString & );
+ void processExited( MyProcess * );
+
+private :
+
+ QString StdoutBuffer;
+ QString StderrBuffer;
+ OProcess * P;
+};
+
class InterfaceInfo {
public :
InterfaceInfo() :
Name(),
MACAddress(),
BCastAddress(),
Netmask(),
DstAddress() {
}
- ANetNodeInstance * assignedNode()
- { return NetNode; }
+ NodeCollection * assignedConnection()
+ { return Collection; }
- void assignNode( ANetNodeInstance * NNI )
- { NetNode = NNI; }
+ void assignConnection( NodeCollection * NNI )
+ { Collection = NNI; }
- ANetNodeInstance * NetNode; // netnode taking care of me
+ NodeCollection * Collection; // connection taking care of me
QString Name; // name of interface
int CardType; // type of card
QString MACAddress; // MAC address
QString Address; // IP Address
QString BCastAddress; // Broadcast Address
QString Netmask; // Netmask
QString DstAddress; // Peer address (if P-t-P)
bool IsUp; // interface is UP
@@ -59,32 +97,39 @@ public :
~System( void );
QDict<InterfaceInfo> & interfaces( void )
{ return ProbedInterfaces; }
InterfaceInfo * interface( const QString& N )
{ return ProbedInterfaces[N]; }
// exec command as root
- int runAsRoot( const QString & S );
+ int runAsRoot( QStringList & S );
// exec command as user
- void execAsUser( QString & Cmd, char * argv[] );
+ int execAsUser( QStringList & Cmd );
// refresh stats for this interface
void refreshStatistics( InterfaceInfo & );
// reloads interfaces
void probeInterfaces( void );
+ InterfaceInfo * findInterface( const QString & DevName );
+
+private slots :
+
+ void SLOT_ProcessExited( MyProcess * );
+
signals :
- void lineFromCommand( const QString & S );
+ void stdoutLine( const QString & );
+ void stderrLine( const QString & );
+ void processEvent( const QString & );
private :
QDict<InterfaceInfo> ProbedInterfaces;
FILE * OutputOfCmd;
QFile * ProcDevNet;
-
};
#endif
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
@@ -11,16 +11,17 @@
#define TEMPLATEDIR "networktemplates/"
QString TemplDir;
SystemFile::SystemFile( const QString & N,
const QString & P,
bool KDI ){
Name = N;
Path = P;
+ InAppend = 0;
F = 0;
// get template info
{ QString S;
QFileInfo FI;
// find location of templates
TemplDir = QPEApplication::qpeDir() + "etc/" + TEMPLATEDIR;
FI.setFile( TemplDir );
@@ -58,47 +59,92 @@ SystemFile::SystemFile( const QString & N,
S = TemplDir + Name + "/postdevicesection";
FI.setFile( S );
hasPostDeviceSection = ( FI.exists() && FI.isReadable() );
}
KnowsDeviceInstances = KDI;
}
+SystemFile::SystemFile( const QString & N, bool KDI ){
+ Name = N;
+ Path = "";
+ InAppend = 0;
+ F =0;
+ KnowsDeviceInstances = KDI;
+ hasPreSection =
+ hasPostSection =
+ hasPreNodeSection =
+ hasPostNodeSection =
+ hasPreDeviceSection =
+ hasPostDeviceSection = 0;
+}
+
SystemFile::~SystemFile( void ) {
- if( F )
- delete F;
+ close();
}
bool SystemFile::open( void ) {
- if( F ) {
- F->close();
- delete F;
- }
+ QString Prefix = getenv( "NS2OUTPUTTO" );
+
+ if( Prefix != "stderr" /* && Name != "interfaces" */ ) {
+ // generate files where the need to be
+ if( F ) {
+ F->close();
+ delete F;
+ }
- F = new QFile( Path + "bup" );
- if( ! F->open( IO_WriteOnly ) ) {
- return 0;
+ F = new QFile( Prefix + Path + ((InAppend)?"":"bup") );
+ Log(( "Open systemfile %s\n", F->name().latin1() ));
+ if( ! F->open( ((InAppend)?IO_Append : 0 ) | IO_WriteOnly ) ) {
+ return 0;
+ }
+ } else {
+ if( ! F ) {
+ owarn << "!!!!!!!!!!!!!!!!!! " << oendl;
+ owarn << "!!!! TESTMODE !!!!" << oendl;
+ owarn << "!!!!!!!!!!!!!!!!!! " << oendl;
+ owarn << "!!!!" << oendl;
+ owarn << "!!!! GENERATE " << Path << oendl;
+ if( InAppend ) {
+ owarn << "!!!! In APPEND mode" << oendl;
+ }
+ owarn << "!!!!" << oendl;
+ owarn << "!!!!!!!!!!!!!!!!!!" << oendl;
+
+ F = new QFile();
+ F->open( IO_WriteOnly, stderr );
+ }
}
setDevice( F );
return 1;
}
bool SystemFile::close( void ) {
- if( ! F ) {
+ if( ! F || ! F->isOpen() ) {
return 1 ;
}
- QString OldP = Path + "bup";
+ QString Prefix = getenv( "NS2OUTPUTTO" );
+
+ if( Prefix == "stderr" ) {
+ return 1;
+ }
+
+ QString OldP = Prefix + Path + "bup";
F->close();
delete F;
F = 0;
- return ( rename( OldP.latin1(), Path.latin1() ) >= 0 );
+ if( ! InAppend ) {
+ owarn << "Rename " << OldP << " to " << Path << oendl;
+ return ( rename( OldP.latin1(), Path.latin1() ) >= 0 );
+ }
+ return 1;
}
bool SystemFile::preSection( void ) {
if( hasPreSection ) {
QFile Fl( TemplDir + Name + "/presection" );
if( ! Fl.open( IO_ReadOnly ) )
return 0; // error
// copy file to this file
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
@@ -9,25 +9,35 @@ class ANetNodeInstance;
class SystemFile : public QTextStream {
public :
SystemFile( const QString & Name,
const QString & Path,
bool KnowsDevicesInstances );
+ SystemFile( const QString & Name,
+ bool KnowsDevicesInstances = 0 );
~SystemFile( void );
+ void setName( const QString & S )
+ { Name = S; }
const QString & name( void ) const
{ return Name; }
+
+ void setPath( const QString & S )
+ { Path = S; }
const QString & path( void ) const
{ return Path; }
+
bool knowsDeviceInstances( void ) const
{ return KnowsDeviceInstances; }
+ void setAppendMode( bool A)
+ { InAppend = A; };
bool open( void );
bool close( void );
bool preSection( void );
bool postSection( void );
bool preNodeSection( ANetNodeInstance * NNI, long DevNr );
bool postNodeSection( ANetNodeInstance * NNI, long DevNr );
bool preDeviceSection( ANetNode * NN );
@@ -40,11 +50,12 @@ private :
QFile * F;
bool hasPreSection;
bool hasPostSection;
bool hasPreNodeSection;
bool hasPostNodeSection;
bool hasPreDeviceSection;
bool hasPostDeviceSection;
bool KnowsDeviceInstances;
+ bool InAppend;
};
#endif
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
@@ -6,18 +6,18 @@
<name>name</name>
<cstring>NetworkSettingsGUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>144</width>
- <height>260</height>
+ <width>383</width>
+ <height>359</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Network Settings</string>
</property>
<property>
<name>layoutMargin</name>
@@ -63,17 +63,17 @@
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>1</number>
+ <number>0</number>
</property>
<widget>
<class>QToolButton</class>
<property stdset="1">
<name>name</name>
<cstring>Add_TB</cstring>
</property>
<property stdset="1">
@@ -162,24 +162,17 @@
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QToolButton</class>
<property stdset="1">
<name>name</name>
- <cstring>Enable_TB</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
+ <cstring>Disable_TB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>...</string>
</property>
<property stdset="1">
<name>toggleButton</name>
<bool>true</bool>
@@ -188,88 +181,63 @@
<name>toggleButton</name>
<bool>true</bool>
</property>
</widget>
<widget>
<class>QToolButton</class>
<property stdset="1">
<name>name</name>
- <cstring>On_TB</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
+ <cstring>Down_TB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>...</string>
</property>
<property stdset="1">
<name>toggleButton</name>
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property stdset="1">
<name>toggleButton</name>
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
<widget>
- <class>QToolButton</class>
+ <class>QFrame</class>
<property stdset="1">
<name>name</name>
- <cstring>Connect_TB</cstring>
+ <cstring>LED_Frm</cstring>
</property>
<property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>...</string>
- </property>
- <property stdset="1">
- <name>toggleButton</name>
- <bool>true</bool>
+ <name>frameShape</name>
+ <enum>NoFrame</enum>
</property>
<property stdset="1">
- <name>toggleButton</name>
- <bool>true</bool>
+ <name>frameShadow</name>
+ <enum>Raised</enum>
</property>
</widget>
<widget>
<class>QToolButton</class>
<property stdset="1">
<name>name</name>
- <cstring>Disconnect_TB</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
+ <cstring>Up_TB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>...</string>
</property>
<property stdset="1">
<name>toggleButton</name>
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property stdset="1">
<name>toggleButton</name>
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QListBox</class>
<property stdset="1">
<name>name</name>
@@ -474,52 +442,28 @@
</hbox>
</widget>
</vbox>
</widget>
</vbox>
</widget>
<connections>
<connection>
- <sender>Add_TB</sender>
- <signal>clicked()</signal>
- <receiver>NetworkSettingsGUI</receiver>
- <slot>SLOT_AddNode()</slot>
- </connection>
- <connection>
<sender>Delete_TB</sender>
<signal>clicked()</signal>
<receiver>NetworkSettingsGUI</receiver>
<slot>SLOT_DeleteNode()</slot>
</connection>
<connection>
<sender>CheckState_TB</sender>
<signal>clicked()</signal>
<receiver>NetworkSettingsGUI</receiver>
<slot>SLOT_CheckState()</slot>
</connection>
<connection>
- <sender>Enable_TB</sender>
- <signal>clicked()</signal>
- <receiver>NetworkSettingsGUI</receiver>
- <slot>SLOT_Enable()</slot>
- </connection>
- <connection>
- <sender>Connect_TB</sender>
- <signal>clicked()</signal>
- <receiver>NetworkSettingsGUI</receiver>
- <slot>SLOT_Connect()</slot>
- </connection>
- <connection>
- <sender>On_TB</sender>
- <signal>clicked()</signal>
- <receiver>NetworkSettingsGUI</receiver>
- <slot>SLOT_On()</slot>
- </connection>
- <connection>
<sender>GenConfig_TB</sender>
<signal>clicked()</signal>
<receiver>NetworkSettingsGUI</receiver>
<slot>SLOT_GenerateConfig()</slot>
</connection>
<connection>
<sender>Profiles_LB</sender>
<signal>clicked(QListBoxItem*)</signal>
@@ -546,27 +490,45 @@
</connection>
<connection>
<sender>ToMessages_BUT</sender>
<signal>clicked()</signal>
<receiver>NetworkSettingsGUI</receiver>
<slot>SLOT_ToMessages()</slot>
</connection>
<connection>
- <sender>Disconnect_TB</sender>
+ <sender>Add_TB</sender>
+ <signal>clicked()</signal>
+ <receiver>NetworkSettingsGUI</receiver>
+ <slot>SLOT_AddNode()</slot>
+ </connection>
+ <connection>
+ <sender>Disable_TB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>NetworkSettingsGUI</receiver>
+ <slot>SLOT_Disable(bool)</slot>
+ </connection>
+ <connection>
+ <sender>Down_TB</sender>
+ <signal>clicked()</signal>
+ <receiver>NetworkSettingsGUI</receiver>
+ <slot>SLOT_Down()</slot>
+ </connection>
+ <connection>
+ <sender>Up_TB</sender>
<signal>clicked()</signal>
<receiver>NetworkSettingsGUI</receiver>
- <slot>SLOT_Disconnect()</slot>
+ <slot>SLOT_Up()</slot>
</connection>
<slot access="public">SLOT_AddNode()</slot>
<slot access="public">SLOT_CheckState()</slot>
- <slot access="public">SLOT_Connect()</slot>
<slot access="public">SLOT_DeleteNode()</slot>
+ <slot access="public">SLOT_Disable(bool)</slot>
<slot access="public">SLOT_EditNode( QListBoxItem *)</slot>
- <slot access="public">SLOT_Enable()</slot>
<slot access="public">SLOT_GenerateConfig()</slot>
- <slot access="public">SLOT_On()</slot>
+ <slot access="public">SLOT_SetState(int)</slot>
<slot access="public">SLOT_ShowNode( QListBoxItem*)</slot>
<slot access="public">SLOT_ToMessages()</slot>
<slot access="public">SLOT_ToProfile()</slot>
- <slot access="public">SLOT_Disconnect()</slot>
+ <slot access="public">SLOT_Up()</slot>
+ <slot access="public">SLOT_Down()</slot>
</connections>
</UI>
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,17 +1,18 @@
#include <stdlib.h>
+#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#include <qtextstream.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include "nsdata.h"
-#include <asdevice.h>
+#include <netnode.h>
#include <resources.h>
static QString CfgFile;
NetworkSettingsData::NetworkSettingsData( void ) {
// init global resources structure
new TheNSResources();
@@ -22,33 +23,73 @@ NetworkSettingsData::NetworkSettingsData( void ) {
return;
}
CfgFile.sprintf( "%s/Settings/NS2.conf",
NSResources->currentUser().HomeDir.latin1() );
Log(( "Cfg from %s\n", CfgFile.latin1() ));
// load settings
- IsModified = 0;
loadSettings();
+
+ // assign interfaces by scanning /tmp/profile-%s.Up files
+ { QDir D( "/tmp" );
+ QFile * F = new QFile;
+ int profilenr;
+ QString interfacename;
+ QTextStream TS ( F );
+
+ QStringList SL = D.entryList( "profile-*.up");
+
+ Log(( "System reports %d interfaces. Found %d up\n",
+ NSResources->system().interfaces().count(),
+ SL.count() ));
+
+ for ( QStringList::Iterator it = SL.begin();
+ it != SL.end();
+ ++it ) {
+ profilenr = atol( (*it).mid( 8 ).latin1() );
+ // read the interface store int 'up'
+ F->setName( D.path() + "/" + (*it) );
+ if( F->open( IO_ReadOnly ) ) {
+ NodeCollection * NC;
+ interfacename = TS.readLine();
+ F->close();
+
+ Log(( "Assign interface %s to Profile nr %d\n",
+ interfacename.latin1(), profilenr ));
+
+ NC = NSResources->getConnection( profilenr );
+ if( NC ) {
+ NC->assignInterface(
+ NSResources->system().findInterface( interfacename ) );
+ } else {
+ Log(( "Profile nr %d no longer defined\n",
+ profilenr ));
+ }
+ }
+ }
+ }
}
// saving is done by caller
NetworkSettingsData::~NetworkSettingsData( void ) {
delete NSResources;
}
void NetworkSettingsData::loadSettings( void ) {
QString Line, S;
QString Attr, Value;
long idx;
QFile F( CfgFile );
QTextStream TS( &F );
+ ForceModified = 0;
+
do {
if( ! F.open(IO_ReadOnly) )
break;
/* load the file ->
FORMAT :
@@ -80,21 +121,19 @@ void NetworkSettingsData::loadSettings( void ) {
} else {
ANetNode * NN = 0;
ANetNodeInstance* NNI = 0;
if( S.startsWith( "nodetype " ) ) {
S = S.mid( 9, S.length()-9 );
S = deQuote(S);
// try to find netnode
NN = NSResources->findNetNode( S );
- Log( ( "Node %s : %p\n", S.latin1(), NN ) );
} else {
// try to find instance
NNI = NSResources->createNodeInstance( S );
- Log( ( "NodeInstance %s : %p\n", S.latin1(), NNI ));
}
if( NN == 0 && NNI == 0 ) {
LeftOvers.append( Line );
}
do {
S = Line = TS.readLine();
@@ -133,19 +172,23 @@ void NetworkSettingsData::loadSettings( void ) {
// empty line
break;
}
}
} while( 1 );
if( NNI ) {
// loading from file -> exists
+ Log( ( "NodeInstance %s : %p\n", NNI->name(), NNI ));
NNI->setNew( FALSE );
NSResources->addNodeInstance( NNI );
}
+ if( NN ) {
+ Log( ( "Node %s : %p\n", NN->name(), NN ) );
+ }
}
}
} while( 0 );
}
QString NetworkSettingsData::saveSettings( void ) {
@@ -215,80 +258,145 @@ QString NetworkSettingsData::saveSettings( void ) {
QDir D(".");
D.rename( CfgFile + ".bup", CfgFile );
//
// proper files AND system files regenerated
//
- setModified( 0 );
+
+ for( QDictIterator<NodeCollection> it(NSResources->connections());
+ it.current();
+ ++it ) {
+ it.current()->setModified( 0 );
+ }
+
return ErrS;
}
QString NetworkSettingsData::generateSettings( void ) {
QString S = "";
Name2SystemFile_t & SFM = NSResources->systemFiles();
Name2Connection_t & M = NSResources->connections();
NodeCollection * NC;
ANetNodeInstance * NNI;
ANetNodeInstance * FirstWithData;
- SystemFile * SF;
- AsDevice * CurDev;
+ RuntimeInfo * CurDev;
ANetNode * NN, * CurDevNN = 0;
long NoOfDevs;
long DevCtStart;
bool needToGenerate;
// regenerate system files
Log( ( "Generating settings from %s\n", CfgFile.latin1() ));
- //
- // generate files proper to each netnodeinstance
- //
- { Name2Instance_t & NNIs = NSResources->netNodeInstances();
-
- for( QDictIterator<ANetNodeInstance> NNIIt(NNIs);
- NNIIt.current();
- ++NNIIt ) {
- // for all nodes find those that are modified
- NNI = NNIIt.current();
-
- { // get list of proper files for this nodeclass (if any)
- QStringList * PF = NNI->nodeClass()->properFiles();
-
- if( PF ) {
- for ( QStringList::Iterator it = PF->begin();
- it != PF->end();
- ++it ) {
- QFile * F = NNI->openFile( (*it) );
- if( F ) {
- QTextStream TS( F );
- if( NNI->generateFile( (*it), F->name(), TS, -1 ) == 2 ) {
- // problem generating
+ for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
+ nnit.current();
+ ++nnit ) {
+ { QStringList SL;
+ bool FirstItem = 1;
+ bool Generated = 0;
+
+ CurDevNN = nnit.current()->NetNode;
+ SL = CurDevNN->properFiles();
+
+ for ( QStringList::Iterator it = SL.begin();
+ it != SL.end();
+ ++it ) {
+
+ Generated = 0;
+ FirstItem = 1;
+ // iterate over NNI's of this class
+ for( QDictIterator<ANetNodeInstance> nniit(
+ NSResources->netNodeInstances() );
+ nniit.current();
+ ++nniit ) {
+ if( nniit.current()->nodeClass() != CurDevNN )
+ // different class
+ continue;
+
+ // open proper file
+ { SystemFile SF( (*it) );
+
+ if( ! CurDevNN->openFile( SF, nniit.current()) ) {
+ // cannot open
+ S = qApp->translate( "NetworkSettings",
+ "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ).
+ arg( (*it) ).arg( CurDevNN->name() );
+ return S;
+ }
+
+ if( ! SF.open() ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ).
+ arg( (*it) ).arg( CurDevNN->name() );
+ return S;
+ }
+
+ // preamble on first
+ if( FirstItem ) {
+ if( CurDevNN->generatePreamble( SF ) == 2 ) {
S = qApp->translate( "NetworkSettings",
- "<p>Cannot generate files proper to \"%1\"</p>" ).
- arg(NNI->nodeClass()->name()) ;
- delete F;
+ "<p>Error in section \"preamble\" for proper file \"%1\" and node \"%2\"</p>" ).
+ arg( (*it) ).
+ arg( CurDevNN->name() );
return S;
}
- delete F;
+ }
+ FirstItem = 0;
+ Generated = 1;
+
+ // item specific
+ if( nniit.current()->generateFile( SF, -1 ) == 2 ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in section for node \"%1\" for proper file \"%2\" and node class \"%3\"</p>" ).
+ arg( nniit.current()->name() ).
+ arg( (*it) ).
+ arg( CurDevNN->name() );
+ return S;
}
}
}
+
+ if( Generated ) {
+ SystemFile SF( (*it) );
+
+ if( CurDevNN->openFile( SF, 0 ) &&
+ ! SF.path().isEmpty()
+ ) {
+
+ if( ! SF.open() ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ).
+ arg( (*it) ).arg( CurDevNN->name() );
+ return S;
+ }
+
+ if( CurDevNN->generatePostamble( SF ) == 2 ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in section \"postamble\" for proper file \"%1\" and node \"%2\"</p>" ).
+ arg( (*it) ).
+ arg( CurDevNN->name() );
+ return S;
+ }
+ } // no postamble
+ }
}
}
}
//
- // generate all system files
+ // generate all registered files
//
for( QDictIterator<SystemFile> sfit(SFM);
sfit.current();
++sfit ) {
+ SystemFile * SF;
+
SF = sfit.current();
// reset all
for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
nnit.current();
++nnit ) {
nnit.current()->NetNode->setDone(0);
}
@@ -301,29 +409,29 @@ QString NetworkSettingsData::generateSettings( void ) {
}
for( QDictIterator<NodeCollection> ncit(M);
ncit.current();
++ncit ) {
ncit.current()->setDone(0);
}
- Log( ( "Generating %s\n", SF->name().latin1() ));
+ Log( ( "Generating system file %s\n", SF->name().latin1() ));
needToGenerate = 0;
// are there netnodes that have instances and need
// to write data in this system file ?
for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
! needToGenerate && nnit.current();
++nnit ) {
NN = nnit.current()->NetNode;
- if( NN->hasDataForFile( SF->name() ) ) {
+ if( NN->hasDataForFile( *SF ) ) {
// netnode can have data
// are there instances of this node ?
for( QDictIterator<ANetNodeInstance> nniit(
NSResources->netNodeInstances() );
! needToGenerate && nniit.current();
++nniit ) {
if( nniit.current()->nodeClass() == NN ) {
@@ -340,17 +448,22 @@ QString NetworkSettingsData::generateSettings( void ) {
if( ! needToGenerate ) {
// no instances found that might need to write data
// in this systemfile
Log(("No nodes for systemfile %s\n", SF->name().latin1() ));
continue;
}
// ok generate this system file
- SF->open();
+ if( ! SF->open() ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Cannot open system file \"%1\"</p>" ).
+ arg( SF->name() );
+ return S;
+ }
// global presection for this system file
if( ! SF->preSection() ) {
S = qApp->translate( "NetworkSettings",
"<p>Error in section \"Preamble\" for file \"%1\"</p>" ).
arg( SF->name() );
return S;
}
@@ -362,109 +475,112 @@ QString NetworkSettingsData::generateSettings( void ) {
NC = ncit.current();
if( NC->done() ) {
// already done
continue;
}
- if( ! NC->hasDataForFile( SF->name() ) ) {
+ if( ! NC->hasDataForFile( *SF ) ) {
// no data
continue;
}
Log(("Generating %s for connection %s\n",
SF->name().latin1(), NC->name().latin1() ));
// find highest item that wants to write data to this file
- FirstWithData = NC->firstWithDataForFile( SF->name() );
+ FirstWithData = NC->firstWithDataForFile( *SF );
// find device on which this connection works
CurDev = NC->device();
// class of that node
CurDevNN = CurDev->netNode()->nodeClass();
- Log(( "%s is done %d\n",
- FirstWithData->nodeClass()->name(),
- FirstWithData->nodeClass()->done() ));
-
if( ! FirstWithData->nodeClass()->done() ) {
// generate fixed part
if( ! SF->preDeviceSection( CurDevNN ) ) {
S = qApp->translate( "NetworkSettings",
"<p>Error in section \"Pre-Device\" for file \"%1\"</p>" ).
arg( SF->name() );
return S;
}
if( FirstWithData->nodeClass()->generateFile(
- SF->name(), SF->path(), *SF, -1 ) == 2 ) {
+ *SF,
+ FirstWithData,
+ -2 ) == 2 ) {
S = qApp->translate( "NetworkSettings",
"<p>Error in section \"Common\" for file \"%1\" and node \"%2\"</p>" ).
arg( SF->name() ).
arg( CurDevNN->name() );
return S;
}
FirstWithData->nodeClass()->setDone( 1 );
+ Log(( "Systemfile %s for node instance %s is done\n",
+ SF->name().latin1(),
+ FirstWithData->name() ));
}
NoOfDevs = 0;
DevCtStart = -1;
if( SF->knowsDeviceInstances() ) {
DevCtStart = 0;
NoOfDevs = CurDevNN->instanceCount();
}
- Log(( "Node %s is done %d\n",
- CurDev->netNode()->nodeClass()->name(),
- CurDev->netNode()->nodeClass()->done() ));
-
if( ! CurDev->netNode()->nodeClass()->done() ) {
// first time this device is handled
// generate common device specific part
for( int i = DevCtStart; i < NoOfDevs ; i ++ ) {
if( FirstWithData->nodeClass()->generateFile(
- SF->name(), SF->path(), *SF, CurDev->netNode(), i ) == 2 ) {
+ *SF, CurDev->netNode(), i ) == 2 ) {
S = qApp->translate( "NetworkSettings",
"<p>Error in section \"Device\" for file \"%1\" and node \"%2\"</p>" ).
arg( SF->name() ).
arg( CurDevNN->name() );
return S;
}
}
CurDev->netNode()->nodeClass()->setDone( 1 );
+
+ Log(( "Systemfile %s for Nodeclass %s is done\n",
+ SF->name().latin1(),
+ CurDev->netNode()->nodeClass()->name()
+ ));
}
// generate profile specific info
// for all nodeconnections that work on the same device
for( QDictIterator<NodeCollection> ncit2(M);
ncit2.current();
++ncit2 ) {
if( ncit2.current()->device() != CurDev ) {
// different device
continue;
}
- Log(("Connection %s of same family\n", ncit2.current()->name().latin1() ));
+ Log(("Connection %s of family %s\n",
+ ncit2.current()->name().latin1(),
+ CurDev->name() ));
// generate
- NNI = ncit2.current()->firstWithDataForFile( SF->name() );
+ NNI = ncit2.current()->firstWithDataForFile( *SF );
for( int i = DevCtStart; i < NoOfDevs ; i ++ ) {
if( ! SF->preNodeSection( NNI, i ) ) {
S = qApp->translate( "NetworkSettings",
"<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ).
arg( SF->name() ).
arg( CurDevNN->name() );
return S;
}
- switch( NNI->generateFile(
- SF->name(), SF->path(), *SF, i ) ) {
+ switch( NNI->generateFile( *SF, i ) ) {
case 0 :
(*SF) << endl;
break;
case 1 :
break;
case 2 :
S = qApp->translate( "NetworkSettings",
"<p>Error in section \"Node\" for file \"%1\" and node \"%2\"</p>" ).
@@ -564,19 +680,24 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
case Unknown :
case Unavailable :
case Disabled :
// this profile does not allow interface to be UP
// -> try others
break;
case Off :
// try to UP the device
- if( ! NC->setState( Activate ) ) {
- // cannot bring device Online -> try other alters
- break;
+ { QString S= NC->setState( Activate );
+ if( ! S.isEmpty() ) {
+ // could not bring device Online -> try other alters
+ Log(( "%s-c%d-disallowed : %s\n",
+ Interface, NC->number(), S.latin1() ));
+ break;
+ }
+ // interface assigned
}
// FT
case Available :
case IsUp : // also called for 'ifdown'
// device is ready -> done
Log(( "%s-c%d-allowed\n", Interface, NC->number() ));
printf( "%s-c%d-allowed\n", Interface, NC->number() );
return 0;
@@ -584,20 +705,21 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
}
// if we come here no alternatives are possible
Log(( "%s-cnn-disallowed\n", Interface ));
printf( "%s-cnn-disallowed\n", Interface );
return 0;
}
-/*
- Called by the system to regenerate config files
-*/
-
-bool NetworkSettingsData::regenerate( void ) {
- QString S = generateSettings();
- if( ! S.isEmpty() ) {
- fprintf( stdout, "%s\n", S.latin1() );
+bool NetworkSettingsData::isModified( void ) {
+ if( ForceModified )
return 1;
+
+ for( QDictIterator<NodeCollection> it(NSResources->connections());
+ it.current();
+ ++it ) {
+ if( it.current()->isModified() ) {
+ return 1;
+ }
}
return 0;
}
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
@@ -1,37 +1,34 @@
#ifndef __NSDATA_H
#define __NSDATA_H
-#include "netnode.h"
+#include <netnode.h>
class NetworkSettingsData {
public :
NetworkSettingsData( void );
~NetworkSettingsData( void );
void loadSettings( void );
QString saveSettings( void );
QString generateSettings( void );
- bool isModified( void )
- { return IsModified; }
- void setModified( bool m )
- { IsModified = m; }
+ bool isModified( void );
+ inline void setModified( bool M )
+ { ForceModified = M; }
QList<NodeCollection> collectPossible( const char * Interface );
// return TRUE if we need gui to decide
bool canStart( const char * Interface );
- bool regenerate( void );
private :
- bool IsModified;
+ bool ForceModified;
// collect strings in config file nobody wants
QStringList LeftOvers;
-
};
#endif
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
@@ -32,17 +32,17 @@ QString PPPAuthEdit::acceptable( void ) {
if( Server_LE->text().isEmpty() )
return tr("Pap/Chap/EAP server id missing");
if( Secret_LE->text().isEmpty() )
return tr("Pap/Chap/EAP secret id missing");
}
return QString();
}
-bool PPPAuthEdit::commit( PPPData_t & D ) {
+bool PPPAuthEdit::commit( PPPData & D ) {
bool SM = 0;
if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) ||
( D.Auth.Mode == 1 && ! PAP_Checked() ) ||
( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) {
// mode modifed
SM = 1;
D.Auth.Mode = ( Login_RB->isChecked() ) ?
@@ -65,17 +65,17 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
D.Auth.PCEMode = 1;
} else if( EAP_RB->isChecked() ) {
D.Auth.PCEMode = 2;
}
}
return SM;
}
-void PPPAuthEdit::showData( PPPData_t & D ) {
+void PPPAuthEdit::showData( PPPData & D ) {
switch( D.Auth.Mode ) {
case 0 :
Login_RB->setChecked( TRUE );
break;
case 1 :
switch( D.Auth.PCEMode ) {
case 0 :
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
@@ -2,16 +2,16 @@
#include "PPPAuthGUI.h"
class PPPAuthEdit : public PPPAuthGUI {
public :
PPPAuthEdit( QWidget * parent );
QString acceptable( void );
- bool commit( PPPData_t & Data );
- void showData( PPPData_t & Data );
+ bool commit( PPPData & Data );
+ void showData( PPPData & Data );
bool PAP_Checked( void );
private :
};
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
@@ -18,17 +18,17 @@ QString PPPDNSEdit::acceptable( void ) {
if( DomainName_LE->text().isEmpty() )
tr("Domainname needed");
if( Servers_LB->count() == 0 )
tr("DNS Servers needed");
}
return QString();
}
-bool PPPDNSEdit::commit( PPPData_t & D ) {
+bool PPPDNSEdit::commit( PPPData & D ) {
bool SM = 0;
CBM( D.DNS.ServerAssigned, DNSServerAssigned_RB, SM );
TXTM( D.DNS.DomainName, DomainName_LE, SM );
// new items in old ?
for ( unsigned i = 0; i < Servers_LB->count(); i++ ) {
QString S;
@@ -70,17 +70,17 @@ bool PPPDNSEdit::commit( PPPData_t & D ) {
}
// shrink
D.DNS.Servers.resize( D.DNS.Servers.size()-1 );
}
}
return SM;
}
-void PPPDNSEdit::showData( PPPData_t & D) {
+void PPPDNSEdit::showData( PPPData & D) {
DNSServerAssigned_RB->setChecked( D.DNS.ServerAssigned );
DomainName_LE->setText( D.DNS.DomainName );
for( unsigned i = 0; i < D.DNS.Servers.size(); i ++ ) {
Servers_LB->insertItem( *(D.DNS.Servers[i]) );
}
}
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
@@ -2,18 +2,18 @@
#include "PPPDNSGUI.h"
class PPPDNSEdit : public PPPDNSGUI {
public :
PPPDNSEdit( QWidget * parent );
QString acceptable( void );
- bool commit( PPPData_t & Data );
- void showData( PPPData_t & Data );
+ bool commit( PPPData & Data );
+ void showData( PPPData & Data );
public slots :
void SLOT_AddServer( void );
void SLOT_RemoveServer( void );
private :
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
@@ -6,34 +6,34 @@
<name>name</name>
<cstring>PPPGUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>124</width>
- <height>29</height>
+ <width>528</width>
+ <height>345</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>PPP</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>2</number>
+ <number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget>
<class>QComboBox</class>
<item>
@@ -49,16 +49,28 @@
</property>
</item>
<item>
<property>
<name>text</name>
<string>DNS Settings</string>
</property>
</item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Commands</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Dialing</string>
+ </property>
+ </item>
<property stdset="1">
<name>name</name>
<cstring>PPPOptions_CB</cstring>
</property>
</widget>
<widget>
<class>QWidgetStack</class>
<property stdset="1">
@@ -71,17 +83,17 @@
<customwidgets>
<customwidget>
<class>QWidgetStack</class>
<header location="global">qwidgetstack.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
</sizehint>
- <container>0</container>
+ <container>1</container>
<sizepolicy>
<hordata>7</hordata>
<verdata>7</verdata>
</sizepolicy>
<pixmap>image0</pixmap>
<slot access="public">raiseWidget( int )</slot>
</customwidget>
</customwidgets>
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
@@ -6,238 +6,167 @@
<name>name</name>
<cstring>PPPIPGUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>133</width>
- <height>235</height>
+ <width>258</width>
+ <height>232</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>PPPIP</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>3</number>
+ <number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>2</number>
+ <number>1</number>
</property>
<widget>
- <class>QButtonGroup</class>
+ <class>QGroupBox</class>
<property stdset="1">
<name>name</name>
- <cstring>ButtonGroup4</cstring>
- </property>
- <property stdset="1">
- <name>frameShape</name>
- <enum>Box</enum>
+ <cstring>GroupBox1</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>IP</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
- <vbox>
+ <grid>
<property stdset="1">
<name>margin</name>
- <number>2</number>
+ <number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
- <widget>
- <class>QRadioButton</class>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>IPServerAssigned_RB</cstring>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
- <string>Server assigned</string>
+ <string>Local</string>
</property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
<property stdset="1">
- <name>checked</name>
+ <name>name</name>
+ <cstring>LocalAddress_LE</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
<bool>true</bool>
</property>
</widget>
- <widget>
- <class>QRadioButton</class>
+ <widget row="0" column="2" >
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>IPFixed_RB</cstring>
+ <cstring>ServerOverrulesLocal_CB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Fixed</string>
+ <string>Server Overrules</string>
</property>
</widget>
- <widget>
- <class>QLayoutWidget</class>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout11</cstring>
+ <cstring>RemoteAddress_LE</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
</property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer8</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Fixed</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property>
- <name>layoutMargin</name>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- </spacer>
- <widget>
- <class>QFrame</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Frame8</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>5</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>frameShape</name>
- <enum>NoFrame</enum>
- </property>
- <property stdset="1">
- <name>frameShadow</name>
- <enum>Raised</enum>
- </property>
- <property>
- <name>layoutMargin</name>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>2</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>2</number>
- </property>
- <widget row="0" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>IPAddress_LE</cstring>
- </property>
- </widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel3</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Subnetmask</string>
- </property>
- </widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel2</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Address</string>
- </property>
- </widget>
- <widget row="1" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>IPSubMask_LE</cstring>
- </property>
- </widget>
- </grid>
- </widget>
- </hbox>
</widget>
- </vbox>
+ <widget row="1" column="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ServerOverrulesRemote_CB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Server Overrules</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Remote</string>
+ </property>
+ </widget>
+ </grid>
</widget>
<widget>
<class>QButtonGroup</class>
<property stdset="1">
<name>name</name>
<cstring>ButtonGroup5</cstring>
</property>
<property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
<name>title</name>
<string>Gateway</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>2</number>
+ <number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget>
<class>QRadioButton</class>
<property stdset="1">
@@ -373,27 +302,38 @@
</grid>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout3</cstring>
+ <cstring>Layout4</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GWIsDefault_CB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Set as default</string>
+ </property>
+ </widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer3</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
@@ -409,36 +349,51 @@
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>GWIsDefault_CB</cstring>
+ <cstring>GWIfNotSet_CB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Set as default</string>
+ <string>Only if not yet set</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer4</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
</vbox>
</widget>
<connections>
<connection>
<sender>GWFixed_RB</sender>
<signal>toggled(bool)</signal>
<receiver>Frame9</receiver>
<slot>setEnabled(bool)</slot>
</connection>
- <connection>
- <sender>IPFixed_RB</sender>
- <signal>toggled(bool)</signal>
- <receiver>Frame8</receiver>
- <slot>setEnabled(bool)</slot>
- </connection>
</connections>
</UI>
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
@@ -4,54 +4,51 @@
#include <qlineedit.h>
#include <GUIUtils.h>
#include "PPPIPedit.h"
PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){
}
QString PPPIPEdit::acceptable( void ) {
- if( IPFixed_RB->isChecked() ) {
- if( IPAddress_LE->text().isEmpty() )
- return tr("IPAddress needed" );
- if( ! validIP( IPAddress_LE->text() ) )
- return tr("IPAddress not valid" );
- if( IPSubMask_LE->text().isEmpty() )
- return tr("Subnet mask needed" );
- if( ! validIP( IPSubMask_LE->text() ) )
- return tr("Subnet mask not valid" );
- } else if( GWFixed_RB->isChecked() ) {
+ if( GWFixed_RB->isChecked() ) {
if( GWAddress_LE->text().isEmpty() )
return tr("Gateway address needed" );
if( ! validIP( GWAddress_LE->text() ) )
return tr("Gateway address not valid" );
};
return QString();
}
-bool PPPIPEdit::commit( PPPData_t & D ) {
+bool PPPIPEdit::commit( PPPData & D ) {
bool SM = 0;
- CBM( D.IP.IPAutomatic, IPServerAssigned_RB, SM );
- if( ! D.IP.IPAutomatic ) {
- TXTM( D.IP.IPAddress, IPAddress_LE, SM );
- TXTM( D.IP.IPSubMask, IPSubMask_LE, SM );
- }
+ CBM( D.IP.LocalOverrule, ServerOverrulesLocal_CB, SM );
+ CBM( D.IP.RemoteOverrule, ServerOverrulesRemote_CB, SM );
+
+ TXTM( D.IP.LocalAddress, LocalAddress_LE, SM );
+ TXTM( D.IP.RemoteAddress, RemoteAddress_LE, SM );
CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM );
+
if( ! D.IP.GWAutomatic ) {
TXTM( D.IP.GWAddress, GWAddress_LE, SM );
}
CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM );
+ CBM( D.IP.GWIfNotSet, GWIfNotSet_CB, SM );
+
return SM;
}
-void PPPIPEdit::showData( PPPData_t & D ) {
- IPServerAssigned_RB->setChecked( D.IP.IPAutomatic );
- IPAddress_LE->setText( D.IP.IPAddress );
- IPSubMask_LE->setText( D.IP.IPSubMask );
+void PPPIPEdit::showData( PPPData & D ) {
+ ServerOverrulesLocal_CB->setChecked( D.IP.LocalOverrule );
+ ServerOverrulesRemote_CB->setChecked( D.IP.RemoteOverrule );
+ LocalAddress_LE->setText( D.IP.LocalAddress );
+ RemoteAddress_LE->setText( D.IP.RemoteAddress );
+
GWServerAssigned_RB->setChecked( D.IP.GWAutomatic );
GWAddress_LE->setText( D.IP.GWAddress );
GWIsDefault_CB->setChecked( D.IP.GWIsDefault );
+ GWIfNotSet_CB->setChecked( D.IP.GWIfNotSet );
}
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
@@ -2,14 +2,14 @@
#include "PPPIPGUI.h"
class PPPIPEdit : public PPPIPGUI {
public :
PPPIPEdit( QWidget * parent );
QString acceptable( void );
- bool commit( PPPData_t & Data );
- void showData( PPPData_t & Data );
+ bool commit( PPPData & Data );
+ void showData( PPPData & Data );
private :
};
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
@@ -1,48 +1,55 @@
#include <qwidgetstack.h>
#include "PPPIPedit.h"
#include "PPPDNSedit.h"
#include "PPPAuthedit.h"
+#include "PPPRunedit.h"
+#include "PPPDialingedit.h"
#include "PPPedit.h"
PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){
Auth = new PPPAuthEdit( Options_WS );
IP = new PPPIPEdit( Options_WS );
DNS = new PPPDNSEdit( Options_WS );
+ Run = new PPPRunEdit( Options_WS );
+ Dialing = new PPPDialingEdit( Options_WS );
+
Options_WS->addWidget( Auth, 0 );
Options_WS->addWidget( IP, 1 );
Options_WS->addWidget( DNS, 2 );
+ Options_WS->addWidget( Run, 3 );
+ Options_WS->addWidget( Dialing, 4 );
Options_WS->raiseWidget( 0 );
}
QString PPPEdit::acceptable( void ) {
QString S;
S = Auth->acceptable();
if( S.isEmpty() ) {
S = IP->acceptable();
if( S.isEmpty() ) {
S = DNS->acceptable();
}
}
return S;
}
-bool PPPEdit::commit( PPPData_t & Data ) {
+bool PPPEdit::commit( PPPData & Data ) {
bool SM ;
SM = Auth->commit( Data );
SM |= IP->commit( Data );
SM |= DNS->commit( Data );
return SM;
}
-void PPPEdit::showData( PPPData_t & Data ) {
+void PPPEdit::showData( PPPData & Data ) {
Auth->showData( Data ) ;
IP->showData( Data );
DNS->showData( Data );
}
void PPPEdit::SLOT_SelectTopic( int v ) {
Options_WS->raiseWidget( v );
}
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
@@ -1,27 +1,31 @@
#include "pppdata.h"
#include "PPPGUI.h"
class PPPAuthEdit;
class PPPIPEdit;
class PPPDNSEdit;
+class PPPRunEdit;
+class PPPDialingEdit;
class PPPEdit : public PPPGUI {
public :
PPPEdit( QWidget * parent );
QString acceptable( void );
- bool commit( PPPData_t & Data );
- void showData( PPPData_t & Data );
+ bool commit( PPPData & Data );
+ void showData( PPPData & Data );
public slots :
void SLOT_SelectTopic( int );
private :
- PPPAuthEdit * Auth;
- PPPDNSEdit * DNS;
- PPPIPEdit * IP;
+ PPPAuthEdit * Auth;
+ PPPDNSEdit * DNS;
+ PPPIPEdit * IP;
+ PPPRunEdit * Run;
+ PPPDialingEdit * Dialing;
};
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,9 +1,9 @@
-Package: opie-networksettingsplugin2-ppp
+Package: opie-networksettings2plugin-ppp
Files: plugins/networksettings2/libppp.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
Description: Network settings ppp plugin.
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -1,24 +1,33 @@
TEMPLATE = lib
CONFIG += qt warn_on release
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = ppp_NN.h \
ppp_NNI.h \
PPPedit.h \
PPPAuthedit.h \
PPPDNSedit.h \
+ PPPRunedit.h \
+ PPPDialingedit.h \
PPPIPedit.h
SOURCES = ppp_NN.cpp \
ppp_NNI.cpp \
PPPedit.cpp \
PPPDNSedit.cpp \
+ PPPRunedit.cpp \
+ PPPDialingedit.cpp \
PPPAuthedit.cpp \
ppprun.cpp \
PPPIPedit.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
-INTERFACES = PPPGUI.ui PPPAuthGUI.ui PPPIPGUI.ui PPPDNSGUI.ui
+INTERFACES = PPPGUI.ui \
+ PPPAuthGUI.ui \
+ PPPIPGUI.ui \
+ PPPDNSGUI.ui \
+ PPPDialingGUI.ui \
+ PPPRunGUI.ui
TARGET = ppp
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
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,36 +1,35 @@
#include <qfile.h>
+#include <resources.h>
#include <qtextstream.h>
#include "ppp_NN.h"
#include "ppp_NNI.h"
QStringList * PPPNetNode::ProperFiles = 0;
static const char * PPPNeeds[] =
- { "line",
- "modem",
+ { "modem",
+ 0
+ };
+
+static const char * PPPProvides[] =
+ { "connection",
0
};
/**
* Constructor, find all of the possible interfaces
*/
PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) {
- // proper files : will leak
- ProperFiles =new QStringList;
- *ProperFiles << "peers";
- *ProperFiles << "chatscript";
-
- // system files
NSResources->addSystemFile(
- "pap-secrets", "/tmp/pap-secrets", 0 );
+ "pap-secrets", "/etc/ppp/pap-secrets", 0 );
NSResources->addSystemFile(
- "chap-secrets", "/tmp/chap-secrets", 0 );
+ "chap-secrets", "/etc/ppp/chap-secrets", 0 );
}
/**
* Delete any interfaces that we own.
*/
PPPNetNode::~PPPNetNode(){
}
@@ -45,31 +44,32 @@ const QString PPPNetNode::nodeDescription(){
ANetNodeInstance * PPPNetNode::createInstance( void ) {
return new APPP( this );
}
const char ** PPPNetNode::needs( void ) {
return PPPNeeds;
}
-const char * PPPNetNode::provides( void ) {
- return "connection";
+const char ** PPPNetNode::provides( void ) {
+ return PPPProvides;
}
-QStringList * PPPNetNode::properFiles( void ) {
- return ProperFiles;
-
+QStringList PPPNetNode::properFiles( void ) {
+ QStringList SL;
+ SL << "peers" << "chatscripts";
+ return SL;
}
// need to generate :
// /etc/ppp/pap-secrets
// /etc/ppp/pap-secrets
-bool PPPNetNode::hasDataForFile( const QString & S ) {
- return S == "pap-secrets" ||
- S == "chap-secrets" ;
+bool PPPNetNode::hasDataForFile( SystemFile & S ) {
+ return S.name() == "pap-secrets" ||
+ S.name() == "chap-secrets" ;
}
QString PPPNetNode::genNic( long NicNr ) {
QString S;
return S.sprintf( "ppp%ld", NicNr );
}
void PPPNetNode::setSpecificAttribute( QString & , QString & ) {
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
@@ -12,25 +12,25 @@ class PPPNetNode : public ANetNode{
public:
PPPNetNode();
virtual ~PPPNetNode();
virtual const QString pixmapName()
{ return "Devices/ppp"; }
- virtual bool hasDataForFile( const QString & S );
+ virtual bool hasDataForFile( SystemFile & S );
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
virtual QString genNic( long NicNr );
- virtual QStringList * properFiles( void );
+ virtual QStringList properFiles( void );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
static QStringList * ProperFiles;
};
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
@@ -11,22 +11,31 @@ APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) {
Data.Auth.Mode = 0;
Data.Auth.Login.Expect = "ogin:";
Data.Auth.Password.Expect = "assword:";
Data.Auth.PCEMode = 0;
Data.Auth.Client = "*";
Data.Auth.Server = "*";
Data.Auth.Secret = "";
- Data.IP.IPAutomatic = 1;
- Data.IP.IPAddress = "";
- Data.IP.IPSubMask = "";
+ Data.IP.LocalAddress = "10.0.0.1";
+ Data.IP.RemoteAddress = "10.0.0.2";
+ Data.IP.LocalOverrule = 1;
+ Data.IP.RemoteOverrule = 1;
+
Data.IP.GWAutomatic = 1;
Data.IP.GWAddress = "";
Data.IP.GWIsDefault = 1;
+ Data.IP.GWIfNotSet = 1;
+
+ Data.Run.PreConnect = "";
+ Data.Run.PostConnect = "";
+ Data.Run.PreDisconnect = "";
+ Data.Run.PostDisconnect = "";
+
GUI = 0;
RT = 0;
}
void APPP::setSpecificAttribute( QString & A, QString & V ) {
if( A.startsWith( "dns" ) ) {
if( A == "dnsserverassigned" ) {
@@ -54,29 +63,43 @@ void APPP::setSpecificAttribute( QString & A, QString & V ) {
} else if( A == "authclient" ) {
Data.Auth.Client = V;
} else if( A == "authserver" ) {
Data.Auth.Server = V;
} else if( A == "authsecret" ) {
Data.Auth.Secret = V;
}
} else if( A.startsWith( "ip" ) ) {
- if( A == "ipautomatic" ) {
- Data.IP.IPAutomatic = (V == "yes");
- } else if( A == "gwautomatic" ) {
+ if( A == "iplocaloverrule" ) {
+ Data.IP.LocalOverrule = (V == "yes");
+ } else if( A == "ipremoteoverrule" ) {
+ Data.IP.RemoteOverrule = (V == "yes");
+ } else if( A == "ipgwautomatic" ) {
Data.IP.GWAutomatic = (V == "yes");
- } else if( A == "gwisdefault" ) {
+ } else if( A == "ipgwisdefault" ) {
Data.IP.GWIsDefault = (V == "yes");
- } else if( A == "ipaddress" ) {
- Data.IP.IPAddress = V;
- } else if( A == "ipsubmask" ) {
- Data.IP.IPSubMask = V;
- } else if( A == "gwaddress" ) {
+ } else if( A == "ipgwifnotset" ) {
+ Data.IP.GWIfNotSet = (V == "yes");
+ } else if( A == "iplocaladdress" ) {
+ Data.IP.LocalAddress = V;
+ } else if( A == "ipremoteaddress" ) {
+ Data.IP.RemoteAddress = V;
+ } else if( A == "ipgwaddress" ) {
Data.IP.GWAddress = V;
}
+ } else if( A.startsWith( "run" ) ) {
+ if( A == "runpreconnect" ) {
+ Data.Run.PreConnect = V;
+ } else if( A == "runpostconnect" ) {
+ Data.Run.PostConnect = V;
+ } else if( A == "runpredisconnect" ) {
+ Data.Run.PreDisconnect = V;
+ } else if( A == "runpostdisconnect" ) {
+ Data.Run.PostDisconnect = V;
+ }
}
}
void APPP::saveSpecificAttribute( QTextStream & TS ) {
TS << "dnsserverassigned=" <<
( ( Data.DNS.ServerAssigned ) ? "yes" : "no" ) << endl;
TS << "dnsdomainname=" << Data.DNS.DomainName << endl;
for( unsigned int i = 0; i < Data.DNS.Servers.size(); i ++ ) {
@@ -86,22 +109,30 @@ void APPP::saveSpecificAttribute( QTextStream & TS ) {
TS << "authloginexpect=" << quote( Data.Auth.Login.Expect ) << endl;
TS << "authloginsend=" << quote( Data.Auth.Login.Send ) << endl;
TS << "authpasswordexpect=" << quote( Data.Auth.Password.Expect ) << endl;
TS << "authpasswordsend=" << quote( Data.Auth.Password.Send ) << endl;
TS << "authpcemode=" << Data.Auth.PCEMode << endl;
TS << "authclient=" << Data.Auth.Client << endl;
TS << "authserver=" << Data.Auth.Server << endl;
TS << "authsecret=" << quote( Data.Auth.Secret ) << endl;
- TS << "ipautomatic=" << ( ( Data.IP.IPAutomatic ) ? "yes" : "no" ) << endl;
- TS << "gwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl;
- TS << "gwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl;
- TS << "ipaddress=" << Data.IP.IPAddress << endl;
- TS << "ipsubmask=" << Data.IP.IPSubMask << endl;
- TS << "gwaddress=" << Data.IP.GWAddress << endl;
+ TS << "ipgwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl;
+ TS << "ipgwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl;
+ TS << "ipgwifnotset=" << ( ( Data.IP.GWIfNotSet ) ? "yes" : "no" ) << endl;
+ TS << "iplocaloverrule=" << ( ( Data.IP.LocalOverrule ) ? "yes" : "no" ) << endl;
+ TS << "ipremoteoverrule=" << ( ( Data.IP.RemoteOverrule ) ? "yes" : "no" ) << endl;
+ TS << "iplocaladdress=" << Data.IP.LocalAddress << endl;
+ TS << "ipremoteaddress=" << Data.IP.RemoteAddress << endl;
+ TS << "ipgwaddress=" << Data.IP.GWAddress << endl;
+
+ TS << "runpreconnect=" << Data.Run.PreConnect << endl;
+ TS << "runpostconnect=" << Data.Run.PostConnect << endl;
+ TS << "runpredisconnect=" << Data.Run.PreDisconnect << endl;
+ TS << "runpostdisconnect=" << Data.Run.PostDisconnect << endl;
+
}
QWidget * APPP::edit( QWidget * parent ) {
GUI = new PPPEdit( parent );
GUI->showData( Data );
return GUI;
}
@@ -110,112 +141,95 @@ QString APPP::acceptable( void ) {
}
void APPP::commit( void ) {
if( GUI && GUI->commit( Data ) ) {
setModified( 1 );
}
}
-QFile * APPP::openFile( const QString & ID ) {
- QFile * F = 0;
- QString S;
-
- if( ID == "peers" ) {
- S = removeSpaces( QString("/tmp/") + connection()->name() );
-
- F = new QFile( S );
-
- if( ! F->open( IO_WriteOnly ) ) {
- Log(("Cannot open file %s\n", S.latin1() ));
- return 0;
- }
- } else if ( ID == "chatscripts" ) {
- S = removeSpaces( QString("/tmp/") + connection()->name() + ".chat" );
- F = new QFile( S );
-
- if( ! F->open( IO_WriteOnly ) ) {
- Log(("Cannot open file %s\n", S.latin1() ));
- return 0;
- }
+bool APPP::openFile( SystemFile & SF ) {
+ if( SF.name() == "peers" ) {
+ SF.setPath( removeSpaces(
+ QString( "/tmp/ppp/peers/" ) + connection()->name() ) );
+ return 1;
+ } else if ( SF.name() == "chatscripts" ) {
+ SF.setPath( removeSpaces(
+ QString( "/tmp/chatscripts/" ) + connection()->name() ) );
+ return 1;
}
- if( F ) {
- Log(("Generate proper file %s = %s\n",
- ID.latin1(), F->name().latin1()));
- }
- return F;
+ return 0;
}
-short APPP::generateFile( const QString & ID,
- const QString & Path,
- QTextStream & TS,
- long DevNr ) {
+short APPP::generateFile( SystemFile & SF, long DevNr ) {
short rvl, rvd;
rvl = 1;
rvd = 1;
- if( ID == "pap-secrets" ) {
- Log(("Generate PPP for %s\n", ID.latin1() ));
+ if( SF.name() == "pap-secrets" ) {
+ Log(("Generate PPP for %s\n", SF.name().latin1() ));
+
if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) {
- TS << "# secrets for "
+ SF << "# secrets for "
<< connection()->name().latin1()
<< endl;
- TS << Data.Auth.Client
+ SF << Data.Auth.Client
<< " "
<< Data.Auth.Server
<< " "
<< Data.Auth.Secret
<< endl;
rvl = 0;
rvd = connection()->getToplevel()->generateFileEmbedded(
- ID, Path, TS, DevNr );
+ SF, DevNr );
}
- } else if( ID == "chap-secrets" ) {
- Log(("Generate PPP for %s\n", ID.latin1() ));
+ } else if( SF.name() == "chap-secrets" ) {
+ Log(("Generate PPP for %s\n", SF.name().latin1() ));
if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) {
// used for both EAP and Chap
- TS << "# secrets for "
+ SF << "# secrets for "
<< connection()->name().latin1()
<< endl;
- TS << Data.Auth.Client
+ SF << Data.Auth.Client
<< " "
<< Data.Auth.Server
<< " "
<< Data.Auth.Secret
<< endl;
rvl = 0;
rvd = connection()->getToplevel()->generateFileEmbedded(
- ID, Path, TS, DevNr );
+ SF, DevNr );
}
- } else if ( ID == "peers" ) {
- QFileInfo FI(Path);
- Log(("Generate PPP for %s\n", ID.latin1() ));
+ } else if ( SF.name() == "peers" ) {
+
+ QFileInfo FI(SF.path());
+ Log(("Generate PPP for %s\n", SF.name().latin1() ));
- TS << "connect \"/usr/sbin/chat -v -f /etc/ppp/"
+ SF << "connect \"/usr/sbin/chat -v -f /etc/chatscripts/"
<< FI.baseName()
- << ".chat\""
+ << "\""
<< endl;
if( Data.IP.GWIsDefault ) {
- TS << "defaultroute"
+ SF << "defaultroute"
<< endl;
}
- TS << "linkname "
- << removeSpaces( ID.latin1() )
+ SF << "linkname "
+ << removeSpaces( SF.name().latin1() )
<< endl;
// insert other data here
rvl = 0;
rvd = connection()->getToplevel()->generateFileEmbedded(
- ID, Path, TS, DevNr );
- } else if ( ID == "chatscripts" ) {
- Log(("Generate PPP for %s\n", ID.latin1() ));
+ SF, DevNr );
+ } else if ( SF.name() == "chatscripts" ) {
+ Log(("Generate PPP for %s\n", SF.name().latin1() ));
rvl = 0;
rvd = connection()->getToplevel()->generateFileEmbedded(
- ID, Path, TS, DevNr );
+ SF, DevNr );
}
return (rvd == 2 || rvl == 2 ) ? 2 :
(rvd == 0 || rvl == 0 ) ? 0 : 1;
}
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
@@ -11,33 +11,27 @@ class QTextStream;
class APPP : public ANetNodeInstance {
public :
APPP( PPPNetNode * PNN );
RuntimeInfo * runtime( void )
- { if( RT == 0 ) {
- RT = new PPPRun( this, Data );
- }
- return RT->runtimeInfo();
- }
+ { return (RT) ? RT : (RT = new PPPRun( this, Data ) ); }
QWidget * edit( QWidget * parent );
QString acceptable( void );
void commit( void );
virtual void * data( void )
{ return (void *)&Data; }
- virtual QFile * openFile( const QString & ID );
- short generateFile( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ virtual bool openFile( SystemFile & Sf );
+ short generateFile( SystemFile & TS,
long DevNr );
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
private :
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
@@ -1,23 +1,29 @@
#ifndef PPP_DATA_H
#define PPP_DATA_H
#include <qstring.h>
#include <qarray.h>
-typedef struct PPPData {
+class PPPData {
+
+public :
+
struct {
- bool IPAutomatic;
- QString IPAddress;
- QString IPSubMask;
+ bool LocalOverrule;
+ bool RemoteOverrule;
+ QString LocalAddress;
+ QString RemoteAddress;
bool GWAutomatic;
QString GWAddress;
bool GWIsDefault;
+ bool GWIfNotSet;
} IP;
+
struct {
short Mode; // 0 login, 1 chap/pap, 2 Terminal
struct {
QString Expect;
QString Send;
} Login;
struct {
QString Expect;
@@ -28,11 +34,17 @@ typedef struct PPPData {
QString Client;
QString Secret;
} Auth;
struct {
bool ServerAssigned;
QString DomainName;
QArray<QString *> Servers;
} DNS;
-} PPPData_t;
+ struct {
+ QString PreConnect;
+ QString PostConnect;
+ QString PreDisconnect;
+ QString PostDisconnect;
+ } Run;
+};
#endif
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
@@ -1,59 +1,25 @@
#include <resources.h>
#include "ppprun.h"
PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) :
- AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) {
- D = &Data;
+ RuntimeInfo( NNI ), Pat( "eth[0-9]" ) {
+ D = &Data;
}
-void PPPRun::detectState( NodeCollection * NC ) {
+State_t PPPRun::detectState( void ) {
if( isMyPPPDRunning( ) ) {
- if( isMyPPPUp() ) {
- NC->setCurrentState( IsUp );
- } else {
- NC->setCurrentState( Available );
- }
- } else {
- NC->setCurrentState( Off ); // at least this
- // but could also be unavailable
- AsDevice::netNode()->nextNode()->runtime()->detectState( NC );
- }
+ return ( isMyPPPUp() ) ? IsUp : Available;
+ }
+ return Off;
}
-bool PPPRun::setState( NodeCollection * NC, Action_t A, bool ) {
- switch( A ) {
- case Activate :
- NC->setCurrentState( Available );
- // no
- break;
- case Deactivate :
- if( NC->currentState() == IsUp ) {
- NC->state( Down );
- }
- // cannot really disable
- NC->setCurrentState( Available );
- break;
- case Up :
- if( NC->currentState() != IsUp ) {
- // start my PPPD
- NC->setCurrentState( IsUp );
- }
- break;
- case Down :
- if( NC->currentState() == IsUp ) {
- // stop my PPPD
- NC->setCurrentState( Available );
- }
- break;
- default : // FT
- break;
- }
- return 1;
+QString PPPRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
+ return QString();
}
bool PPPRun::isMyPPPDRunning( void ) {
return 0;
}
bool PPPRun::isMyPPPUp( void ) {
System & S = NSResources->system();
@@ -63,20 +29,24 @@ bool PPPRun::isMyPPPUp( void ) {
for( QDictIterator<InterfaceInfo> It(S.interfaces());
It.current();
++It ) {
Run = It.current();
if( R.match( Run->Name ) >= 0 &&
Run->IsPointToPoint
) {
// this is a LAN card
- if( Run->assignedNode() == AsDevice::netNode() ) {
+ if( Run->assignedConnection() == netNode()->connection() ) {
// assigned to us
return 1;
}
}
}
return 0;
}
bool PPPRun::handlesInterface( const QString & S ) {
return Pat.match( S ) >= 0;
}
+
+bool PPPRun::handlesInterface( InterfaceInfo * I ) {
+ return handlesInterface( I->Name );
+}
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
@@ -1,47 +1,37 @@
#ifndef PPPRUN_H
#define PPPRUN_H
#include <qregexp.h>
-#include <asconnection.h>
-#include <asdevice.h>
+#include <netnode.h>
#include "pppdata.h"
-class PPPRun : public AsConnection, public AsDevice {
+class PPPRun : public RuntimeInfo {
public :
PPPRun( ANetNodeInstance * NNI,
PPPData & Data );
- virtual AsDevice * asDevice( void )
- { return (AsDevice *)this; }
- virtual AsConnection * asConnection( void )
- { return (AsConnection *)this; }
-
- virtual AsDevice * device( void )
- { return (AsDevice *)this; }
+ bool handlesInterface( const QString & I );
+ bool handlesInterface( InterfaceInfo * );
- virtual RuntimeInfo * runtimeInfo( void )
- { return ( AsConnection *)this; }
+ State_t detectState( void );
+ virtual RuntimeInfo * device( void )
+ { return this; }
+ virtual RuntimeInfo * connection( void )
+ { return this; }
- protected :
+protected :
- void detectState( NodeCollection * NC );
- bool setState( NodeCollection * NC, Action_t A, bool );
- bool canSetState( State_t S, Action_t A )
- { return AsDevice::connection()->findNext(
- AsDevice::netNode() )->runtime()->canSetState( S,A ); }
-
- bool handlesInterface( const QString & I );
+ QString setMyState( NodeCollection * , Action_t, bool );
private :
bool isMyPPPDRunning( void );
bool isMyPPPUp( void );
- PPPData_t * D;
+ PPPData * D;
QRegExp Pat;
-
};
#endif
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,9 +1,9 @@
-Package: opie-networksettingsplugin2-profile
+Package: opie-networksettings2plugin-profile
Files: plugins/networksettings2/libprofile.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
-Description: Network settings profile plugin.
+Description: Network settings usage profile plugin.
Version: $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,20 +1,29 @@
+#include <resources.h>
#include "profile_NN.h"
#include "profile_NNI.h"
static const char * ProfileNeeds[] =
{ "connection",
0
};
+static const char * ProfileProvides[] =
+ { "fullsetup",
+ 0
+ };
/**
* Constructor, find all of the possible interfaces
*/
ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) {
+
+ NSResources->addSystemFile(
+ "interfaces", "/etc/network/interfaces", 1 );
+
}
/**
* Delete any interfaces that we own.
*/
ProfileNetNode::~ProfileNetNode(){
}
@@ -29,18 +38,18 @@ const QString ProfileNetNode::nodeDescription(){
ANetNodeInstance * ProfileNetNode::createInstance( void ) {
return new AProfile( this );
}
const char ** ProfileNetNode::needs( void ) {
return ProfileNeeds;
}
-const char * ProfileNetNode::provides( void ) {
- return "fullsetup";
+const char ** ProfileNetNode::provides( void ) {
+ return ProfileProvides;
}
void ProfileNetNode::setSpecificAttribute( QString & , QString & ) {
}
void ProfileNetNode::saveSpecificAttribute( QTextStream & ) {
}
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
@@ -15,17 +15,17 @@ public:
virtual ~ProfileNetNode();
virtual const QString pixmapName()
{ return "Devices/commprofile"; }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
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,8 +1,9 @@
+#include <opie2/odebug.h>
#include "profileedit.h"
#include "profile_NNI.h"
#include "profile_NN.h"
AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) {
Data.Automatic = 1;
Data.Confirm = 0;
Data.Description = "";
@@ -45,33 +46,31 @@ QString AProfile::acceptable( void ) {
return ( GUI ) ? GUI->acceptable( ) : QString();
}
void AProfile::commit( void ) {
if( GUI && GUI->commit( Data ) )
setModified( 1 );
}
-short AProfile::generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+short AProfile::generateFileEmbedded( SystemFile & SF,
long DevNr ) {
short rvl, rvd;
rvl = 1;
- if( ID == "interfaces" ) {
- Log(("Generate Profile for %s\n", ID.latin1() ));
+ if( SF.name() == "interfaces" ) {
+ Log(("Generate Profile for %s\n", SF.name().latin1() ));
if( Data.TriggerVPN ) {
// this profile triggers VPN -> insert trigger
- TS << " up networksettings2 --triggervpn"
+ SF << " up networksettings2 --triggervpn"
<< endl;
rvl = 0;
}
}
- rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
+ rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr );
return (rvd == 2 || rvl == 2 ) ? 2 :
(rvd == 0 || rvl == 0 ) ? 0 : 1;
}
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
@@ -21,19 +21,17 @@ public :
QWidget * edit( QWidget * parent );
QString acceptable( void );
void commit( void );
virtual void * data( void )
{ return (void *)&Data; }
- virtual short generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ virtual short generateFileEmbedded( SystemFile & TS,
long DevNr );
const QString & description( void )
{ return Data.Description; }
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
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
@@ -1,16 +1,17 @@
#ifndef PROFILE_DATA_H
#define PROFILE_DATA_H
#include <qstring.h>
-typedef struct ProfileData {
+class ProfileData {
+public :
QString Description;
// start up automatically
bool Automatic;
// if started up automatically, ask user for confirmation
bool Confirm;
// Do not bring this connection up
bool Disabled;
bool TriggerVPN;
-} ProfileData_t;
+} ;
#endif
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
@@ -1,27 +1,27 @@
#include <qlabel.h>
#include <qframe.h>
#include <qcheckbox.h>
#include <qmultilineedit.h>
#include <qcheckbox.h>
#include <GUIUtils.h>
-#include <asdevice.h>
+#include <netnode.h>
#include <resources.h>
#include "profileedit.h"
ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
ProfileGUI( Parent ), RefreshTimer(this) {
InterfaceInfo * II;
NNI = TNNI;
Dev = NNI->runtime()->device();
- if( ( II = Dev->assignedInterface() ) ) {
+ if( ( II = NNI->connection()->assignedInterface() ) ) {
Refresh_CB->setEnabled( TRUE );
Snd_GB->setEnabled( TRUE );
Rcv_GB->setEnabled( TRUE );
Collisions_FRM->setEnabled( TRUE );
// show current content
SLOT_Refresh();
@@ -50,39 +50,39 @@ ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
}
}
QString ProfileEdit::acceptable( void ) {
return QString();
}
-void ProfileEdit::showData( ProfileData_t & Data ) {
+void ProfileEdit::showData( ProfileData & Data ) {
Description_LE->setText( Data.Description );
Automatic_CB->setChecked( Data.Automatic );
TriggersVPN_CB->setChecked( Data.TriggerVPN );
Confirm_CB->setChecked( Data.Confirm );
Disabled_CB->setChecked( Data.Disabled );
}
-bool ProfileEdit::commit( ProfileData_t & Data ) {
+bool ProfileEdit::commit( ProfileData & Data ) {
bool SM = 0;
TXTM( Data.Description, Description_LE, SM );
CBM( Data.Automatic, Automatic_CB, SM );
CBM( Data.TriggerVPN, TriggersVPN_CB, SM );
CBM( Data.Disabled, Disabled_CB, SM );
CBM( Data.Confirm, Confirm_CB, SM );
return SM;
}
void ProfileEdit::SLOT_Refresh( void ) {
- InterfaceInfo * II = Dev->assignedInterface();
+ InterfaceInfo * II = NNI->connection()->assignedInterface();
NSResources->system().refreshStatistics( *II );
RcvBytes_LBL->setText( II->RcvBytes );
SndBytes_LBL->setText( II->SndBytes );
RcvErrors_LBL->setText( II->RcvErrors );
SndErrors_LBL->setText( II->SndErrors );
RcvDropped_LBL->setText( II->RcvDropped );
SndDropped_LBL->setText( II->SndDropped );
Collisions_LBL->setText( II->Collisions );
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
@@ -1,29 +1,29 @@
#include "profiledata.h"
#include "profileGUI.h"
#include <qtimer.h>
class ANetNodeInstance;
-class AsDevice;
+class RuntimeInfo;
class ProfileEdit : public ProfileGUI {
Q_OBJECT
public :
ProfileEdit( QWidget * parent, ANetNodeInstance * NNI );
QString acceptable( void );
- bool commit( ProfileData_t & Data );
- void showData( ProfileData_t & Data );
+ bool commit( ProfileData & Data );
+ void showData( ProfileData & Data );
public slots :
void SLOT_AutoRefresh( bool );
void SLOT_Refresh( void );
private :
QTimer RefreshTimer;
ANetNodeInstance * NNI;
- AsDevice * Dev;
+ RuntimeInfo * Dev;
};
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
@@ -1,67 +1,27 @@
#include <resources.h>
#include "profilerun.h"
-void ProfileRun::detectState( NodeCollection * NC ) {
+State_t ProfileRun::detectState( void ) {
if( Data->Disabled ) {
- Log(( "%s disabled\n", NC->name().latin1() ));
- NC->setCurrentState( Disabled );
- } else {
- Log(( "%s not disabled\n", NC->name().latin1() ));
- // find next item in connection
- // convert to runtime and ask to detect the state
- netNode()->nextNode()->runtime()->detectState( NC );
- }
+ return Disabled;
+ }
+ return Unknown;
}
-bool ProfileRun::setState( NodeCollection * NC, Action_t A, bool F ) {
- ANetNodeInstance * NNNI;
-
- NNNI = netNode()->nextNode();
- switch ( A ) {
- case Enable :
- if( NC->currentState() == Disabled ) {
- Data->Disabled = 0;
- NC->setCurrentState( Off ); // at least
- // ... but request deeper
- NNNI->runtime()->detectState(NC);
- }
- return 1;
- case Disable :
- switch( NC->currentState() ) {
- case IsUp :
- case Available :
- // bring Deactivate (will bring down)
- if( ! NNNI->runtime()->setState(NC, Deactivate) )
- return 0;
- default :
- break;
- }
+QString ProfileRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
+ owarn << "Profile " << Data->Disabled << oendl;
+ if( A == Disable ) {
+ if( ! Data->Disabled ) {
Data->Disabled = 1;
- NC->setCurrentState( Disabled );
- return 1;
- default :
- break;
- }
- return NNNI->runtime()->setState(NC, A, F );
-}
-
-bool ProfileRun::canSetState( State_t Curr, Action_t A ) {
- RuntimeInfo * RI;
- switch ( A ) {
- case Enable :
- case Disable :
- // always possible
- return 1;
- default :
- break;
+ NC->setModified( 1 );
+ }
+ } else if( A == Enable ) {
+ if( Data->Disabled ) {
+ Data->Disabled = 0;
+ NC->setModified( 1 );
+ }
}
- RI = netNode()->nextNode()->runtime();
- return ( Curr != Disabled ) ?
- RI->canSetState(Curr, A) : 0;
-}
-bool ProfileRun::handlesInterface( const QString & S ) {
- // donno -> pass deeper
- return netNode()->nextNode()->runtime()->handlesInterface(S);
+ return QString();
}
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
@@ -1,35 +1,33 @@
#ifndef PROFILERUN_H
#define PROFILERUN_H
-#include <asfullsetup.h>
+#include <netnode.h>
#include "profiledata.h"
-class ProfileRun : public AsFullSetup {
+class ProfileRun : public RuntimeInfo {
public :
ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) :
- AsFullSetup( NNI )
+ RuntimeInfo( NNI )
{ Data = &D; }
- void detectState( NodeCollection * NC );
- bool setState( NodeCollection * NC, Action_t A, bool );
- bool canSetState( State_t Curr, Action_t A );
-
- bool handlesInterface( const QString & I );
-
+ virtual RuntimeInfo * fullSetup( void )
+ { return this; }
virtual const QString & description( void )
{ return Data->Description; }
-
- virtual AsFullSetup * asFullSetup( void )
- { return (AsFullSetup *)this; }
-
virtual bool triggersVPN( void )
{ return Data->TriggerVPN; }
+ State_t detectState( void );
+
+protected :
+
+ QString setMyState( NodeCollection * , Action_t, bool );
+
private :
ProfileData * Data;
};
#endif
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,9 +1,9 @@
-Package: opie-networksettingsplugin2-usb
+Package: opie-networksettings2plugin-usb
Files: plugins/networksettings2/libusb.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
Description: Network settings usb plugin.
Version: $QPE_VERSION$EXTRAVERSION
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,19 +1,27 @@
+#include <resources.h>
#include "usb_NN.h"
#include "usb_NNI.h"
static const char * USBNeeds[] =
{ 0
};
+static const char * USBProvides[] =
+ { "device",
+ 0
+ };
+
/**
* Constructor, find all of the possible interfaces
*/
USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) {
+ NSResources->addSystemFile(
+ "interfaces", "/etc/network/interfaces", 1 );
}
/**
* Delete any interfaces that we own.
*/
USBNetNode::~USBNetNode(){
}
@@ -28,18 +36,18 @@ const QString USBNetNode::nodeDescription(){
ANetNodeInstance * USBNetNode::createInstance( void ) {
return new AUSB( this );
}
const char ** USBNetNode::needs( void ) {
return USBNeeds;
}
-const char * USBNetNode::provides( void ) {
- return "device";
+const char ** USBNetNode::provides( void ) {
+ return USBProvides;
}
QString USBNetNode::genNic( long ) {
return QString( "usbf" );
}
void USBNetNode::setSpecificAttribute( QString & , QString & ) {
}
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
@@ -15,17 +15,17 @@ public:
virtual ~USBNetNode();
virtual const QString pixmapName()
{ return "Devices/usb"; }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
virtual QString genNic( long nr );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
};
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
@@ -27,35 +27,33 @@ QString AUSB::acceptable( void ) {
}
void AUSB::commit( void ) {
if( GUI && GUI->commit( Data ) ) {
setModified( 1 );
}
}
-short AUSB::generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+short AUSB::generateFileEmbedded( SystemFile & SF,
long DevNr ) {
QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
short rvl, rvd;
rvl = 1;
- if( ID == "interfaces" ) {
- Log(("Generate USB for %s\n", ID.latin1() ));
+ if( SF.name() == "interfaces" ) {
+ Log(("Generate USB for %s\n", SF.name().latin1() ));
// generate mapping stanza for this interface
- TS << " pre-up "
+ SF << " pre-up "
<< QPEApplication::qpeDir()
<< "bin/setmacaddress.sh "
<< NIC
<< " || true"
<< endl;
rvl = 0;
}
- rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
+ rvd = ANetNodeInstance::generateFileEmbedded(SF, DevNr );
return (rvd == 2 || rvl == 2 ) ? 2 :
(rvd == 0 || rvl == 0 ) ? 0 : 1;
}
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
@@ -21,19 +21,17 @@ public :
QWidget * edit( QWidget * parent );
QString acceptable( void );
void commit( void );
virtual void * data( void )
{ return (void *)&Data; }
- virtual short generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ virtual short generateFileEmbedded( SystemFile & TS,
long DevNr );
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
private :
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
@@ -1,8 +1,9 @@
#ifndef USB_DATA_H
#define USB_DATA_H
-typedef struct USBData {
+class USBData {
+public :
bool Fake;
-} USBData_t;
+} ;
#endif
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
@@ -4,14 +4,14 @@
USBEdit::USBEdit( QWidget * Parent ) : USBGUI( Parent ){
}
QString USBEdit::acceptable( void ) {
return QString();
}
-void USBEdit::showData( USBData_t & Data ) {
+void USBEdit::showData( USBData & Data ) {
}
-bool USBEdit::commit( USBData_t & Data ) {
+bool USBEdit::commit( USBData & Data ) {
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
@@ -2,11 +2,11 @@
#include "usbGUI.h"
class USBEdit : public USBGUI {
public :
USBEdit( QWidget * parent );
QString acceptable( void );
- bool commit( USBData_t & Data );
- void showData( USBData_t & Data );
+ bool commit( USBData & Data );
+ void showData( USBData & Data );
};
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
@@ -1,18 +1,19 @@
#include <qfile.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include <resources.h>
#include "usbrun.h"
-void USBRun::detectState( NodeCollection * NC ) {
+State_t USBRun::detectState( void ) {
// unavailable : no card found
// available : card found and assigned to us or free
// up : card found and assigned to us and up
+ NodeCollection * NC = nodeCollection();
QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
System & Sys = NSResources->system();
InterfaceInfo * Run;
QFile F( S );
Log(("Detecting for %s\n", NC->name().latin1() ));
if( F.open( IO_ReadOnly ) ) {
// could open file -> read interface and assign
@@ -22,37 +23,34 @@ void USBRun::detectState( NodeCollection * NC ) {
Log(("%s exists\n", S.latin1() ));
// find interface
if( handlesInterface( X ) ) {
for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
It.current();
++It ) {
Run = It.current();
if( X == Run->Name ) {
- Run->assignNode( netNode() );
- assignInterface( Run );
- NC->setCurrentState( IsUp );
- return;
+ NC->assignInterface( Run );
+ return IsUp;
}
}
}
}
- Log(("Assigned %p\n", assignedInterface() ));
- if( ( Run = assignedInterface() ) ) {
+ Log(("Assigned %p\n", NC->assignedInterface() ));
+ if( ( Run = NC->assignedInterface() ) ) {
// we already have an interface assigned -> still present ?
if( ! Run->IsUp ) {
// usb is still free -> keep assignment
- NC->setCurrentState( Available );
- return;
+ return Available;
} // else interface is up but NOT us -> some other profile
}
// nothing (valid) assigned to us
- assignInterface( 0 );
+ NC->assignInterface( 0 );
// find possible interface
for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
It.current();
++It ) {
Run = It.current();
Log(("%s %d %d=%d %d\n",
@@ -60,94 +58,26 @@ void USBRun::detectState( NodeCollection * NC ) {
handlesInterface( Run->Name ),
Run->CardType, ARPHRD_ETHER,
! Run->IsUp ));
if( handlesInterface( Run->Name ) &&
Run->CardType == ARPHRD_ETHER &&
! Run->IsUp
) {
- Log(("Released(OFF)\n" ));
// proper type, and Not UP -> free
- NC->setCurrentState( Off );
- return;
+ return Off;
}
}
- // no free found
- Log(("UNA\n" ));
- NC->setCurrentState( Unavailable );
+ return Unavailable;
}
-bool USBRun::setState( NodeCollection * NC, Action_t A, bool ) {
-
- // we only handle activate and deactivate
- switch( A ) {
- case Activate :
- {
- if( NC->currentState() != Off ) {
- return 0;
- }
- InterfaceInfo * N = getInterface();
- if( ! N ) {
- // no interface available
- NC->setCurrentState( Unavailable );
- return 0;
- }
- // because we were OFF the interface
- // we get back is NOT assigned
- N->assignNode( netNode() );
- assignInterface( N );
- Log(("Assing %p\n", N ));
- NC->setCurrentState( Available );
- return 1;
- }
- case Deactivate :
- if( NC->currentState() == IsUp ) {
- // bring down first
- if( ! connection()->setState( Down ) )
- // could not ...
- return 0;
- } else if( NC->currentState() != Available ) {
- return 1;
- }
- assignedInterface()->assignNode( 0 ); // release
- assignInterface( 0 );
- NC->setCurrentState( Off );
- return 1;
- default :
- // FT
- break;
- }
- return 0;
-}
-
-bool USBRun::canSetState( State_t Curr, Action_t A ) {
- // we only handle up down activate and deactivate
- switch( A ) {
- case Activate :
- { // at least available
- if( Curr == Available ) {
- return 1;
- }
- // or we can make one available
- InterfaceInfo * N = getInterface();
- if( ! N || N->assignedNode() != 0 ) {
- // non available or assigned
- return 0;
- }
- return 1;
- }
- case Deactivate :
- return ( Curr >= Available );
- default :
- // FT
- break;
- }
- return 0;
+QString USBRun::setMyState( NodeCollection *, Action_t , bool ) {
+ return QString();
}
// get interface that is free or assigned to us
InterfaceInfo * USBRun::getInterface( void ) {
System & S = NSResources->system();
InterfaceInfo * best = 0, * Run;
QRegExp R( "usb[0-9abcdef]" );
@@ -155,24 +85,28 @@ InterfaceInfo * USBRun::getInterface( void ) {
for( QDictIterator<InterfaceInfo> It(S.interfaces());
It.current();
++It ) {
Run = It.current();
if( handlesInterface( Run->Name ) &&
Run->CardType == ARPHRD_ETHER
) {
// this is a USB card
- if( Run->assignedNode() == netNode() ) {
+ if( Run->assignedConnection() == netNode()->connection() ) {
// assigned to us
return Run;
- } else if( Run->assignedNode() == 0 ) {
+ } else if( Run->assignedConnection() == 0 ) {
// free
best = Run;
}
}
}
return best; // can be 0
}
bool USBRun::handlesInterface( const QString & S ) {
return Pat.match( S ) >= 0;
}
+bool USBRun::handlesInterface( InterfaceInfo * I ) {
+ return handlesInterface( I->Name );
+}
+
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
@@ -1,37 +1,36 @@
#ifndef USBRUN_H
#define USBRUN_H
-#include <asdevice.h>
+#include <netnode.h>
#include <qregexp.h>
#include "usbdata.h"
-class USBRun : public AsDevice {
+class USBRun : public RuntimeInfo {
public :
USBRun( ANetNodeInstance * NNI,
USBData & Data ) :
- AsDevice( NNI ),
- Pat( "usb[0-9abcdef]" )
- { }
+ RuntimeInfo( NNI ),
+ Pat( "usb[0-9abcdef]" ) {
+ }
- virtual AsDevice * device( void )
- { return (AsDevice *)this; }
+ virtual RuntimeInfo * device( void )
+ { return this; }
- virtual AsDevice * asDevice( void )
- { return (AsDevice *)this; }
-protected :
+ bool handlesInterface( const QString & I );
+ bool handlesInterface( InterfaceInfo * );
- void detectState( NodeCollection * );
- bool setState( NodeCollection * , Action_t A, bool );
- bool canSetState( State_t , Action_t A );
+ State_t detectState( void );
- bool handlesInterface( const QString & I );
+protected :
+
+ QString setMyState( NodeCollection * , Action_t, bool );
private :
InterfaceInfo * getInterface( void );
QRegExp Pat;
};
#endif
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,9 +1,9 @@
-Package: opie-networksettingsplugin2-vpn
+Package: opie-networksettings2plugin-vpn
Files: plugins/networksettings2/libvpn.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
Description: Network settings vpn plugin.
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -1,15 +1,19 @@
#include "vpn_NN.h"
#include "vpn_NNI.h"
static const char * VPNNeeds[] =
{ 0
};
+static const char * VPNProvides[] =
+ { "connection",
+ 0
+ };
/**
* Constructor, find all of the possible interfaces
*/
VPNNetNode::VPNNetNode() : ANetNode(tr("VPN Connection")) {
}
/**
* Delete any interfaces that we own.
@@ -28,18 +32,18 @@ const QString VPNNetNode::nodeDescription(){
ANetNodeInstance * VPNNetNode::createInstance( void ) {
return new AVPN( this );
}
const char ** VPNNetNode::needs( void ) {
return VPNNeeds;
}
-const char * VPNNetNode::provides( void ) {
- return "connection";
+const char ** VPNNetNode::provides( void ) {
+ return VPNProvides;
}
void VPNNetNode::setSpecificAttribute( QString & , QString & ) {
}
void VPNNetNode::saveSpecificAttribute( QTextStream & ) {
}
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
@@ -15,17 +15,17 @@ public:
virtual ~VPNNetNode();
virtual const QString pixmapName()
{ return "Devices/vpn"; }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
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
@@ -1,16 +1,17 @@
#ifndef VPN_DATA_H
#define VPN_DATA_H
#include <qstring.h>
-typedef struct VPNData {
+class VPNData {
+public :
QString Device;
QString LockFile;
long Speed;
short Parity;
short DataBits;
short StopBits;
bool HardwareControl;
bool SoftwareControl;
-} VPNData_t;
+} ;
#endif
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
@@ -5,14 +5,14 @@
VPNEdit::VPNEdit( QWidget * Parent ) : VPNGUI( Parent ){
}
QString VPNEdit::acceptable( void ) {
return QString();
}
-void VPNEdit::showData( VPNData_t & Data ) {
+void VPNEdit::showData( VPNData & Data ) {
}
-bool VPNEdit::commit( VPNData_t & Data ) {
+bool VPNEdit::commit( VPNData & Data ) {
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
@@ -2,11 +2,11 @@
#include "vpnGUI.h"
class VPNEdit : public VPNGUI {
public :
VPNEdit( QWidget * parent );
QString acceptable( void );
- bool commit( VPNData_t & Data );
- void showData( VPNData_t & Data );
+ bool commit( VPNData & Data );
+ void showData( VPNData & Data );
};
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 @@
#include "vpnrun.h"
-
-bool VPNRun::handlesInterface( const QString & ) {
- // to be figured out
- return 0;
-}
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
@@ -1,32 +1,27 @@
#ifndef VPNRUN_H
#define VPNRUN_H
-#include <asconnection.h>
+#include <netnode.h>
#include "vpndata.h"
-class VPNRun : public AsConnection {
+class VPNRun : public RuntimeInfo {
public :
VPNRun( ANetNodeInstance * NNI, VPNData & Data ) :
- AsConnection( NNI )
+ RuntimeInfo( NNI )
{ }
- virtual AsConnection * asConnection( void )
- { return (AsConnection *)this; }
-protected :
-
- void detectState( NodeCollection * )
- { }
+ virtual RuntimeInfo * connection( void )
+ { return this; }
- bool setState( NodeCollection *, Action_t, bool )
- { return 0; }
+ State_t detectState( void )
+ { return Unknown; }
- bool canSetState( State_t, Action_t )
- { return 0; }
-
- bool handlesInterface( const QString & I );
+protected :
+ QString setMyState( NodeCollection * , Action_t, bool )
+ { return QString(); }
};
#endif
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,9 +1,9 @@
-Package: opie-networksettingsplugin2-wlan
+Package: opie-networksettings2plugin-wlan
Files: plugins/networksettings2/libwlan.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
Description: Network settings wlan plugin.
Version: $QPE_VERSION$EXTRAVERSION
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,19 +1,27 @@
+#include <resources.h>
#include "wlan_NN.h"
#include "wlan_NNI.h"
static const char * WLanNeeds[] =
{ 0
};
+static const char * WLanProvides[] =
+ { "device",
+ 0
+ };
+
/**
* Constructor, find all of the possible interfaces
*/
WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) {
+ NSResources->addSystemFile(
+ "interfaces", "/etc/network/interfaces", 1 );
InstanceCount = 2;
}
/**
* Delete any interfaces that we own.
*/
WLanNetNode::~WLanNetNode(){
}
@@ -29,18 +37,18 @@ const QString WLanNetNode::nodeDescription(){
ANetNodeInstance * WLanNetNode::createInstance( void ) {
return new AWLan( this );
}
const char ** WLanNetNode::needs( void ) {
return WLanNeeds;
}
-const char * WLanNetNode::provides( void ) {
- return "device";
+const char ** WLanNetNode::provides( void ) {
+ return WLanProvides;
}
QString WLanNetNode::genNic( long nr ) {
QString S;
return S.sprintf( "wlan%ld", nr );
}
void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) {
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
@@ -15,17 +15,17 @@ public:
virtual ~WLanNetNode();
virtual const QString pixmapName()
{ return "Devices/wlan"; }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
virtual long instanceCount( void )
{ return InstanceCount; }
virtual QString genNic( long );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
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
@@ -74,43 +74,41 @@ QString AWLan::acceptable( void ) {
return ( GUI ) ? GUI->acceptable( ) : QString();
}
void AWLan::commit( void ) {
if( GUI && GUI->commit( Data ) )
setModified( 1 );
}
-short AWLan::generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+short AWLan::generateFileEmbedded( SystemFile & SF,
long DevNr ) {
short rvl, rvd;
rvl = 1;
- if( ID == "interfaces" ) {
- Log(("Generate WLanNNI for %s\n", ID.latin1() ));
- TS << " wireless_essid \""
+ if( SF.name() == "interfaces" ) {
+ Log(("Generate WLanNNI for %s\n", SF.name().latin1() ));
+ SF << " wireless_essid \""
<< Data.ESSID
<< "\""
<< endl;
if( ! Data.NodeName.isEmpty() ) {
if( Data.NodeName == tr("<UseHostName>") ) {
char Buf[100];
if( gethostname(Buf, sizeof(Buf) ) == 0 ) {
Buf[99] = '\0'; // just to make sure
- TS << " wireless_nick "
+ SF << " wireless_nick "
<< Buf
<< endl;
}
} else {
- TS << " wireless_nick \""
+ SF << " wireless_nick \""
<< Data.NodeName
<< "\""
<< endl;
}
}
char * M = "Auto";
switch ( Data.Mode ) {
@@ -119,33 +117,33 @@ short AWLan::generateFileEmbedded( const QString & ID,
case 1 :
M = "Managed";
break;
case 2 :
M = "Ad-Hoc";
break;
}
- TS << " wireless_mode "
+ SF << " wireless_mode "
<< M
<< endl;
if( Data.Encrypted ) {
for( int i = 0; i < 4; i ++ ) {
if( ! Data.Key[i].isEmpty() ) {
- TS << " wireless_key"
+ SF << " wireless_key"
<< i
<< " "
<< Data.Key[i]
<< endl;
}
}
- TS << " wireless_keymode "
+ SF << " wireless_keymode "
<< ((Data.AcceptNonEncrypted) ? "open" : "restricted")
<< endl;
}
rvl = 0;
}
- rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr);
+ rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr);
return (rvd == 2 || rvl == 2 ) ? 2 :
(rvd == 0 || rvl == 0 ) ? 0 : 1;
}
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
@@ -21,19 +21,17 @@ public :
QWidget * edit( QWidget * parent );
QString acceptable( void );
void commit( void );
virtual void * data( void )
{ return (void *)&Data; }
- virtual short generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ virtual short generateFileEmbedded( SystemFile & Sf,
long DevNr );
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
private :
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
@@ -1,16 +1,17 @@
#ifndef WLAN_DATA_H
#define WLAN_DATA_H
#include <qstring.h>
-typedef struct WLanData {
+class WLanData {
+public :
QString ESSID;
QString NodeName;
short Mode;
bool SpecificAP;
QString APMac;
bool Encrypted;
QString Key[4];
bool AcceptNonEncrypted;
-} WLanData_t;
+} ;
#endif
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
@@ -15,17 +15,17 @@
WLanEdit::WLanEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
WLanGUI( Parent ), RefreshTimer(this){
InterfaceInfo * II;
NNI = TNNI;
Dev = NNI->runtime()->device();
WE = 0;
- if( ( II = Dev->assignedInterface() ) ) {
+ if( ( II = NNI->connection()->assignedInterface() ) ) {
// show data
WE = new WExtensions( II->Name );
if( WE->doesHaveWirelessExtensions() ) {
QString S;
Station_LBL->setText( WE->station() );
ESSID_LBL->setText( WE->essid() );
Mode_LBL->setText( WE->mode() );
@@ -56,32 +56,32 @@ QString WLanEdit::acceptable( void ) {
}
if( SpecifyAP_CB->isChecked() &&
APMac_LE->text().isEmpty() ) {
return QString("APMac must have value");
}
return QString();
}
-void WLanEdit::showData( WLanData_t & Data ) {
+void WLanEdit::showData( WLanData & Data ) {
Mode_CB->setCurrentItem( Data.Mode );
ESSID_LE->setText( Data.ESSID );
NodeName_LE->setText( Data.NodeName );
SpecifyAP_CB->setChecked( Data.SpecificAP );
APMac_LE->setText( Data.APMac );
EnableWEP_CB->setChecked( Data.Encrypted );
AcceptNonEncrypted_CB->setChecked( Data.AcceptNonEncrypted );
Key1_LE->setText( Data.Key[0] );
Key2_LE->setText( Data.Key[1] );
Key3_LE->setText( Data.Key[2] );
Key4_LE->setText( Data.Key[3] );
}
-bool WLanEdit::commit( WLanData_t & Data ) {
+bool WLanEdit::commit( WLanData & Data ) {
bool SM = 0;
TXTM( Data.ESSID, ESSID_LE, SM );
TXTM( Data.NodeName, NodeName_LE, SM );
TXTM( Data.APMac, APMac_LE, SM );
TXTM( Data.Key[0], Key1_LE, SM );
TXTM( Data.Key[1], Key2_LE, SM );
TXTM( Data.Key[2], Key3_LE, SM );
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
@@ -1,32 +1,32 @@
#include <qtimer.h>
#include <wextensions.h>
#include "wlandata.h"
#include "wlanGUI.h"
class ANetNodeInstance;
-class AsDevice;
+class RuntimeInfo;
class WExtensions;
class WLanEdit : public WLanGUI {
public :
WLanEdit( QWidget * parent, ANetNodeInstance * NNI );
~WLanEdit( void );
QString acceptable( void );
- void showData( WLanData_t & Data );
- bool commit( WLanData_t & Data );
+ void showData( WLanData & Data );
+ bool commit( WLanData & Data );
public slots :
void SLOT_AutoRefresh( bool );
void SLOT_Refresh( void );
private :
ANetNodeInstance * NNI;
- AsDevice * Dev;
+ RuntimeInfo * Dev;
QTimer RefreshTimer;
WExtensions * WE;
};
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
@@ -1,21 +1,22 @@
#include <qfile.h>
#include <qtextstream.h>
#include <qstringlist.h>
#include <resources.h>
#include "wlanrun.h"
-void WLanRun::detectState( NodeCollection * NC ) {
+State_t WLanRun::detectState( void ) {
// unavailable : no card found
// available : card found and assigned to us or free
// up : card found and assigned to us and up
+ NodeCollection * NC = nodeCollection();
QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
System & Sys = NSResources->system();
InterfaceInfo * Run;
QFile F( S );
if( F.open( IO_ReadOnly ) ) {
// could open file -> read interface and assign
@@ -24,126 +25,60 @@ void WLanRun::detectState( NodeCollection * NC ) {
X = TS.readLine();
// find interface
if( handlesInterface( X ) ) {
for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
It.current();
++It ) {
Run = It.current();
if( X == Run->Name ) {
- Run->assignNode( netNode() );
- assignInterface( Run );
- NC->setCurrentState( IsUp );
- return;
+ NC->assignInterface( Run );
+ return IsUp;
}
}
}
}
- if( ( Run = assignedInterface() ) ) {
+ if( ( Run = NC->assignedInterface() ) ) {
// we already have an interface assigned -> still present ?
if( ! Run->IsUp ) {
// usb is still free -> keep assignment
- NC->setCurrentState( Available );
- return;
+ return Available;
} // else interface is up but NOT us -> some other profile
}
// nothing (valid) assigned to us
- assignInterface( 0 );
+ NC->assignInterface( 0 );
// find possible interface
for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
It.current();
++It ) {
Run = It.current();
if( handlesInterface( *Run ) &&
( Run->CardType == ARPHRD_ETHER
#ifdef ARPHRD_IEEE1394
|| Run->CardType == ARPHRD_IEEE1394
#endif
) &&
! Run->IsUp
) {
// proper type, and Not UP -> free
- NC->setCurrentState( Off );
- return;
+ return Off;
}
}
- // no free found
- NC->setCurrentState( Unavailable );
+ return Unavailable;
}
-bool WLanRun::setState( NodeCollection * NC, Action_t A, bool ) {
+QString WLanRun::setMyState( NodeCollection * , Action_t , bool ) {
// we only handle activate and deactivate
- switch( A ) {
- case Activate :
- {
- if( NC->currentState() != Off ) {
- return 0;
- }
- InterfaceInfo * N = getInterface();
- if( ! N ) {
- // no interface available
- NC->setCurrentState( Unavailable );
- return 0;
- }
- // because we were OFF the interface
- // we get back is NOT assigned
- N->assignNode( netNode() );
- assignInterface( N );
- NC->setCurrentState( Available );
- return 1;
- }
- case Deactivate :
- if( NC->currentState() == IsUp ) {
- // bring down first
- if( ! connection()->setState( Down ) )
- // could not ...
- return 0;
- } else if( NC->currentState() != Available ) {
- return 1;
- }
- assignedInterface()->assignNode( 0 ); // release
- assignInterface( 0 );
- NC->setCurrentState( Off );
- return 1;
- default :
- // FT
- break;
- }
- return 0;
-}
-
-bool WLanRun::canSetState( State_t Curr, Action_t A ) {
- // we only handle up down activate and deactivate
- switch( A ) {
- case Activate :
- { // at least available
- if( Curr == Available ) {
- return 1;
- }
- // or we can make one available
- InterfaceInfo * N = getInterface();
- if( ! N || N->assignedNode() != 0 ) {
- // non available or assigned
- return 0;
- }
- return 1;
- }
- case Deactivate :
- return ( Curr >= Available );
- default :
- // FT
- break;
- }
- return 0;
+ return QString();
}
// get interface that is free or assigned to us
InterfaceInfo * WLanRun::getInterface( void ) {
System & S = NSResources->system();
InterfaceInfo * best = 0, * Run;
@@ -154,20 +89,20 @@ InterfaceInfo * WLanRun::getInterface( void ) {
if( handlesInterface( *Run ) &&
( Run->CardType == ARPHRD_ETHER
#ifdef ARPHRD_IEEE1394
|| Run->CardType == ARPHRD_IEEE1394
#endif
)
) {
// this is a LAN card
- if( Run->assignedNode() == netNode() ) {
+ if( Run->assignedConnection() == netNode()->connection() ) {
// assigned to us
return Run;
- } else if( Run->assignedNode() == 0 ) {
+ } else if( Run->assignedConnection() == 0 ) {
// free
best = Run;
}
}
}
return best; // can be 0
}
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
@@ -1,37 +1,36 @@
#ifndef WLANRUN_H
#define WLANRUN_H
#include <qregexp.h>
-#include <asdevice.h>
+#include <netnode.h>
#include "wlandata.h"
-class WLanRun : public AsDevice {
+class WLanRun : public RuntimeInfo {
public :
WLanRun( ANetNodeInstance * NNI, WLanData & Data ) :
- AsDevice( NNI ),
- Pat( "wlan[0-9]" )
- { }
+ RuntimeInfo( NNI ),
+ Pat( "wlan[0-9]" ) {
+ }
- virtual AsDevice * device( void )
- { return (AsDevice *)this; }
- virtual AsDevice * asDevice( void )
- { return (AsDevice *)this; }
+ virtual RuntimeInfo * device( void )
+ { return this; }
-protected :
-
- void detectState( NodeCollection * );
- bool setState( NodeCollection *, Action_t, bool );
- bool canSetState( State_t, Action_t );
bool handlesInterface( const QString & I );
bool handlesInterface( const InterfaceInfo & II );
+ State_t detectState( void );
+
+protected :
+
+ QString setMyState( NodeCollection * , Action_t, bool );
+
private :
InterfaceInfo * getInterface( void );
QRegExp Pat;
WLanData * Data;
};
#endif
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
@@ -33,17 +33,22 @@ _;:, .> :=|. This program is free software; you can
#define OCONFITEM_H
#include <qlist.h>
#include <qstring.h>
class OConfItem
{
public:
- enum Type { Source, Destination, Option, Arch, NotDefined };
+ enum Type { Source=0x01,
+ GzSource=0x02,
+ Destination=0x04,
+ Option=0x08,
+ Arch=0x10,
+ NotDefined=0x20 };
OConfItem( Type type = NotDefined, const QString &name = QString::null,
const QString &value = QString::null, const QString &features = QString::null,
bool active = true );
Type type() { return m_type; }
const QString &name() { return m_name; }
const QString &value() { return m_value; }
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
@@ -109,17 +109,18 @@ OConfItemList *OIpkg::configItems()
{
// Retrieve all configuration items
return filterConfItems();
}
OConfItemList *OIpkg::servers()
{
// Retrieve only servers
- return filterConfItems( OConfItem::Source );
+ return filterConfItems( (OConfItem::Type)((int)OConfItem::Source |
+ (int)OConfItem::GzSource) );
}
OConfItemList *OIpkg::destinations()
{
// Retrieve only destinations
return filterConfItems( OConfItem::Destination );
}
@@ -538,16 +539,17 @@ void OIpkg::loadConfiguration()
QString line = s.readLine().simplifyWhiteSpace();
// Parse line and save info to the conf options list
if ( !line.isEmpty() )
{
if ( !line.startsWith( "#" ) ||
line.startsWith( "#src" ) ||
+ line.startsWith( "#src/gz" ) ||
line.startsWith( "#dest" ) ||
line.startsWith( "#arch" ) ||
line.startsWith( "#option" ) )
{
int pos = line.find( ' ', 1 );
// Type
QString typeStr = line.left( pos );
@@ -613,17 +615,18 @@ OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter )
// If typefilter is empty, retrieve all items
bool retrieveAll = ( typefilter == OConfItem::NotDefined );
// Parse configuration info for servers
OConfItemListIterator it( *m_confInfo );
for ( ; it.current(); ++it )
{
OConfItem *item = it.current();
- if ( retrieveAll || item->type() == typefilter )
+ if ( retrieveAll ||
+ ( item->type() & typefilter ) )
{
sl->append( item );
}
}
return sl;
}
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
@@ -1,10 +1,10 @@
Package: opie-packagemanager
Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop
Priority: optional
Section: opie/settings
-Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.120)
+Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg0 (>=0.99.120), ipkg-link
Replaces: packagemanager
Architecture: arm
Maintainer: Dan Williams (drw@handhelds.org)
Description: Opie package management client
-Version: 0.6.1$EXTRAVERSION
+Version: $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
@@ -1,11 +1,11 @@
Package: opie-sh
Files: bin/opie-sh apps/Opie-SH/opie-sh.desktop pics/opie-sh/*.png help/opie-sh/*.html
Priority: optional
Section: opie/sh
Maintainer: Thomas Stephens <spiralman@softhome.net>
Architecture: arm
-Version: 0.5-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal
License: GPL
Description: A QDialog shell frontend
A program to let you use various dialogs from the console (or a shell script)
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
@@ -1,11 +1,11 @@
Package: opie-sh-wavelanchooser
Files: bin/opie-sh-wavelanchooser.sh apps/Opie-SH/opie-sh-wavelanchooser.desktop pics/opie-sh-scripts/qtwavelan.png
Installed-Size: 0
-Version: 0.1-20020527-1
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal (1.5.0+), opie-sh
Priority: optional
Section: opie/sh
Maintainer: gonz <gonz@directbox.com>
Architecture: all
License: GPL
Description: Frontend to choose wavelan config
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
@@ -1,10 +1,10 @@
Package: opie-filebrowser
Files: bin/filebrowser apps/Applications/filebrowser.desktop pics/filebrowser/
Priority: optional
Section: opie/applications
Maintainer: Opie Team <opie@handhelds.org>
Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal
Description: Browse the file system
The filebrowser for the Opie environment.
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
@@ -1,11 +1,11 @@
Package: opie-gsmtool
Files: plugins/application/libgsmtool.so* bin/gsmtool apps/Applications/gsmtool.desktop pics/gsmtool
Priority: optional
Section: opie/applications
Maintainer: David Woodhouse <dwmw2@infradead.org>
Architecture: arm
-Version: 1.0.0-2
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal, gsmlib
License: Public Domain
Description: GSMTool program
An GSM phone utility program for the Opie environment.
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
@@ -1,10 +1,10 @@
Package: opie-oipkg
Files: bin/oipkg apps/Settings/oipkg.desktop pics/oipkg/*
Priority: optional
Section: opie/settings
Maintainer: Patrick S. Vogt <tille@almana.ch>
Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal, ipkg (>0.99.20), ar
Description: Opie Projects advanced gui ipkg installer
A GUI front-end to ipkg for the Opie environment.
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
@@ -1,10 +1,10 @@
Package: opie-ubrowser
Files: bin/ubrowser apps/Applications/ubrowser.desktop pics/ubrowser/*.png plugins/application/libubrowser.so*
Priority: optional
Section: opie/applications
Maintainer: Thomas Stephens <spiralman@softhome.net>
Architecture: arm
-Version: 0.1-$SUB_VERSION
+Version: $QPE_VERSION$EXTRAVERSION
Depends: task-opie-minimal
License: GPL
Description: A very small web browser