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 | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: zkbapplet | 1 | Package: zkbapplet |
2 | 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 | 2 | 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 |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applets | 4 | Section: opie/applets |
5 | Maintainer: Rajko Albrecht <alwin@handhelds.org> | 5 | Maintainer: Rajko Albrecht <alwin@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: ZKB Applet and configuration program | 8 | Description: ZKB Applet and configuration program |
9 | Obsoletes: keyz-cfg | 9 | Obsoletes: keyz-cfg |
10 | Version: 0.6.0$EXTRAVERSION | 10 | 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 @@ | |||
1 | Package: opie-confeditor | 1 | Package: opie-confeditor |
2 | Files: bin/confedit apps/Settings/confedit.desktop pics/confedit/confedit.png plugins/application/libconfedit.so* | 2 | Files: bin/confedit apps/Settings/confedit.desktop pics/confedit/confedit.png plugins/application/libconfedit.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Patrick S. Vogt <tille@handhelds.org> | 5 | Maintainer: Patrick S. Vogt <tille@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: $QPE_VERSION-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, libopiecore2 | 8 | Depends: task-opie-minimal, libopiecore2 |
9 | Description: An enditor for the ~/Settings/*.conf files | 9 | 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 @@ | |||
1 | Package: opie-dagger | 1 | Package: opie-dagger |
2 | Files: plugins/application/libdagger.so* bin/dagger pics/dagger apps/Applications/dagger.desktop | 2 | Files: plugins/application/libdagger.so* bin/dagger pics/dagger apps/Applications/dagger.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Depends: task-opie-minimal, libopiecore2, libopieui2 | 5 | Depends: task-opie-minimal, libopiecore2, libopieui2 |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Maintainer: Dan Williams (drw@handhelds.org) | 7 | Maintainer: Dan Williams (drw@handhelds.org) |
8 | Description: A Bible study program utilizing the Sword library. | 8 | Description: A Bible study program utilizing the Sword library. |
9 | Version: 0.9.1$EXTRAVERSION | 9 | 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 @@ | |||
1 | Files: plugins/applications/libbartender.so* bin/bartender apps/Applications/bartender.desktop etc/bartender/drinkdb.txt | 1 | Files: plugins/applications/libbartender.so* bin/bartender apps/Applications/bartender.desktop etc/bartender/drinkdb.txt |
2 | Priority: optional | 2 | Priority: optional |
3 | Package: opie-bartender | 3 | Package: opie-bartender |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: L.J. Potter <lpotter@trolltech.com> | 5 | Maintainer: L.J. Potter <lpotter@trolltech.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: $QPE_VERSION-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
9 | Description: Bartender drink receipe database lookup, and | 9 | Description: Bartender drink receipe database lookup, and |
10 | blood alcohol estimator. | 10 | 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 @@ | |||
1 | Package: opie-console | 1 | Package: opie-console |
2 | Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* share/opie-console/* | 2 | Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* share/opie-console/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.6-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs | 8 | Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs |
9 | License: GPL | 9 | License: GPL |
10 | Description: Opie terminal app | 10 | 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 @@ | |||
1 | Package: opie-console | 1 | Package: opie-console |
2 | Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* | 2 | Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.6-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs | 8 | Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs |
9 | License: GPL | 9 | License: GPL |
10 | Description: Opie terminal app | 10 | 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 @@ | |||
1 | Package: opie-gutenbrowser | 1 | Package: opie-gutenbrowser |
2 | Files: bin/gutenbrowser apps/Applications/gutenbrowser.desktop etc/gutenbrowser/* pics/gutenbrowser/* plugins/application/libgutenbrowser.so* | 2 | Files: bin/gutenbrowser apps/Applications/gutenbrowser.desktop etc/gutenbrowser/* pics/gutenbrowser/* plugins/application/libgutenbrowser.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie | 4 | Section: opie |
5 | Maintainer: ljp <lpotter@trolltech.com> | 5 | Maintainer: ljp <lpotter@trolltech.com> |
6 | Source: opie.handhelds.org | 6 | Source: opie.handhelds.org |
7 | Architecture: arm | 7 | Architecture: arm |
8 | Version: $QPE_VERSION-$SUB_VERSION | 8 | Version: $QPE_VERSION$EXTRAVERSION |
9 | Depends: ftplib, libopiecore2, libopieui2 | 9 | Depends: ftplib, libopiecore2, libopieui2 |
10 | Description: Etext read for the Project Gutenberg. | 10 | Description: Etext read for the Project Gutenberg. |
11 | 11 | ||
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 @@ | |||
1 | Package: opie-bounce | 1 | Package: opie-bounce |
2 | Files: plugins/application/libbounce.so* bin/bounce apps/Games/bounce.desktop pics/bounce/*.png | 2 | Files: plugins/application/libbounce.so* bin/bounce apps/Games/bounce.desktop pics/bounce/*.png |
3 | Version: 0.6-$SUB_VERSION | 3 | Version: $QPE_VERSION$EXTRAVERSION |
4 | Depends: task-opie-minimal, libopiecore2 | 4 | Depends: task-opie-minimal, libopiecore2 |
5 | Priority: optional | 5 | Priority: optional |
6 | Section: opie/games | 6 | Section: opie/games |
7 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 7 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
8 | Architecture: arm | 8 | Architecture: arm |
9 | License: GPL | 9 | License: GPL |
10 | Description: bounce | 10 | Description: bounce |
11 | A JezzGame like game for Qtopia. | 11 | 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 @@ | |||
1 | Package: opie-buzzword | 1 | Package: opie-buzzword |
2 | Files: plugins/application/libbuzzword.so* bin/buzzword apps/Games/buzzword.desktop pics/buzzword/buzzword.png share/buzzword/buzzwords | 2 | Files: plugins/application/libbuzzword.so* bin/buzzword apps/Games/buzzword.desktop pics/buzzword/buzzword.png share/buzzword/buzzwords |
3 | Version: 1.1-$SUB_VERSION | 3 | Version: $QPE_VERSION$EXTRAVERSION |
4 | Depends: task-opie-minimal,libopiecore2 | 4 | Depends: task-opie-minimal,libopiecore2 |
5 | Priority: optional | 5 | Priority: optional |
6 | Section: opie/games | 6 | Section: opie/games |
7 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 7 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
8 | Architecture: arm | 8 | Architecture: arm |
9 | License: GPL | 9 | License: GPL |
10 | Description: BuzzWord | 10 | Description: BuzzWord |
11 | A BuzzWord Bingo for the Opie environment. | 11 | 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 @@ | |||
1 | Package: opie-kbill | 1 | Package: opie-kbill |
2 | Files: bin/kbill apps/Games/kbill.desktop pics/kbill/* | 2 | Files: bin/kbill apps/Games/kbill.desktop pics/kbill/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Mark Westcott <mark@houseoffish.org> | 5 | Maintainer: Mark Westcott <mark@houseoffish.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.8-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
9 | License: GPL | 9 | License: GPL |
10 | Description: The famous hit Bill game | 10 | Description: The famous hit Bill game |
11 | Hit Bill as hard as you can before he | 11 | Hit Bill as hard as you can before he |
12 | infects your network with a wannabe | 12 | infects your network with a wannabe |
13 | OS. | 13 | 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 @@ | |||
1 | Package: opie-kcheckers | 1 | Package: opie-kcheckers |
2 | Files: plugins/application/libkcheckers.so* bin/kcheckers apps/Games/kcheckers.desktop pics/kcheckers | 2 | Files: plugins/application/libkcheckers.so* bin/kcheckers apps/Games/kcheckers.desktop pics/kcheckers |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: leseb <prudhomme@laposte.net> | 5 | Maintainer: leseb <prudhomme@laposte.net> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.3-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, libopiecore2 | 8 | Depends: task-opie-minimal, libopiecore2 |
9 | Description: The game of Checkers | 9 | Description: The game of Checkers |
10 | A game for the Opie environment. | 10 | 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 @@ | |||
1 | Package: opie-kpacman | 1 | Package: opie-kpacman |
2 | Files: plugins/applications/libkpacman.so* bin/kpacman apps/Games/kpacman.desktop pics/kpacman/kpacman.png share/kpacman | 2 | Files: plugins/applications/libkpacman.so* bin/kpacman apps/Games/kpacman.desktop pics/kpacman/kpacman.png share/kpacman |
3 | Version: 0.3.1-$SUB_VERSION | 3 | Version: $QPE_VERSION$EXTRAVERSION |
4 | Depends: task-opie-minimal | 4 | Depends: task-opie-minimal |
5 | Priority: optional | 5 | Priority: optional |
6 | Section: opie/games | 6 | Section: opie/games |
7 | Maintainer: Catalin Climov <catalin@climov.com> | 7 | Maintainer: Catalin Climov <catalin@climov.com> |
8 | Architecture: arm | 8 | Architecture: arm |
9 | License: GPL | 9 | License: GPL |
10 | Description: Kpacman | 10 | Description: Kpacman |
11 | A Pacman clone for Qtopia. | 11 | 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 | |||
@@ -1,199 +1,206 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | begin : January 2003 | 2 | begin : January 2003 |
3 | copyright : ( C ) 2003 by Carsten Niehaus | 3 | copyright : ( C ) 2003 by Carsten Niehaus |
4 | email : cniehaus@handhelds.org | 4 | email : cniehaus@handhelds.org |
5 | **************************************************************************/ | 5 | **************************************************************************/ |
6 | 6 | ||
7 | /*************************************************************************** | 7 | /*************************************************************************** |
8 | * * | 8 | * * |
9 | * This program is free software; you can redistribute it and/or modify * | 9 | * This program is free software; you can redistribute it and/or modify * |
10 | * it under the terms of the GNU General Public License as published by * | 10 | * it under the terms of the GNU General Public License as published by * |
11 | * the Free Software Foundation; either version 2 of the License, or * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
12 | * ( at your option ) any later version. * | 12 | * ( at your option ) any later version. * |
13 | * * | 13 | * * |
14 | **************************************************************************/ | 14 | **************************************************************************/ |
15 | 15 | ||
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qlayout.h> | 17 | #include <qlayout.h> |
18 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | 20 | ||
21 | #include <qstring.h> | 21 | #include <qstring.h> |
22 | #include <qlist.h> | ||
22 | #include <qhbox.h> | 23 | #include <qhbox.h> |
23 | #include <qvbox.h> | 24 | #include <qvbox.h> |
24 | #include <qlabel.h> | 25 | #include <qlabel.h> |
25 | #include <qlistview.h> | 26 | #include <qlistview.h> |
26 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
27 | 28 | ||
28 | #include "ohighscoredlg.h" | 29 | #include "ohighscoredlg.h" |
29 | 30 | ||
30 | OHighscore::OHighscore( int score , int playerLevel ) | 31 | OHighscore::OHighscore( int score , int playerLevel ) : playerData() |
31 | { | 32 | { |
32 | pLevel = playerLevel; | 33 | pLevel = playerLevel; |
33 | getList(); | 34 | getList(); |
34 | checkIfItIsANewhighscore( score ); | 35 | checkIfItIsANewhighscore( score ); |
36 | playerData.setAutoDelete( TRUE ); | ||
35 | } | 37 | } |
36 | 38 | ||
37 | OHighscore::~OHighscore() | 39 | OHighscore::~OHighscore() |
38 | { | 40 | { |
39 | std::list<t_playerData*>::iterator deleteIterator = playerData.begin(); | ||
40 | for ( ; deleteIterator != playerData.end() ; deleteIterator++ ) | ||
41 | { | ||
42 | delete ( *deleteIterator ); | ||
43 | } | ||
44 | } | 41 | } |
45 | 42 | ||
46 | void OHighscore::getList() | 43 | void OHighscore::getList() |
47 | { | 44 | { |
48 | Config cfg ( "tetrix" ); | 45 | Config cfg ( "tetrix" ); |
49 | cfg.setGroup( QString::number( 1 ) ); | 46 | cfg.setGroup( QString::number( 1 ) ); |
50 | lowest = cfg.readNumEntry( "Points" ); | 47 | lowest = cfg.readNumEntry( "Points" ); |
51 | playerData.clear(); | 48 | playerData.clear(); |
52 | 49 | ||
53 | int rest = 1;//for the filling up later | 50 | int rest = 1;//for the filling up later |
54 | 51 | ||
55 | for ( int i = 1 ; i < 11 ; i++ ) | 52 | for ( int i = 1 ; i < 11 ; i++ ) |
56 | { | 53 | { |
57 | if ( cfg.hasGroup( QString::number( i ) ) ) | 54 | if ( cfg.hasGroup( QString::number( i ) ) ) |
58 | { | 55 | { |
59 | cfg.setGroup( QString::number( i ) ); | 56 | cfg.setGroup( QString::number( i ) ); |
60 | int temp = cfg.readNumEntry( "Points" ); | 57 | int temp = cfg.readNumEntry( "Points" ); |
61 | 58 | ||
62 | t_playerData *pPlayerData = new t_playerData; | 59 | t_playerData *pPlayerData = new t_playerData; |
63 | pPlayerData->sName = cfg.readEntry( "Name" ); | 60 | pPlayerData->sName = cfg.readEntry( "Name" ); |
64 | pPlayerData->points = temp; | 61 | pPlayerData->points = temp; |
65 | pPlayerData->level = cfg.readNumEntry( "Level" ); | 62 | pPlayerData->level = cfg.readNumEntry( "Level" ); |
66 | 63 | ||
67 | playerData.push_back( pPlayerData ); | 64 | playerData.append( pPlayerData ); |
68 | 65 | ||
69 | if ( (temp < lowest) ) lowest = temp; | 66 | if ( (temp < lowest) ) lowest = temp; |
70 | rest++; | 67 | rest++; |
71 | } | 68 | } |
72 | } | 69 | } |
73 | 70 | ||
74 | //now I fill up the rest of the list | 71 | //now I fill up the rest of the list |
75 | if ( rest < 11 ) //only go in this loop if there are less than | 72 | if ( rest < 11 ) //only go in this loop if there are less than |
76 | //10 highscoreentries | 73 | //10 highscoreentries |
77 | { | 74 | { |
78 | lowest = 0; | 75 | lowest = 0; |
79 | for ( ; rest < 11 ; rest++ ) | 76 | for ( ; rest < 11 ; rest++ ) |
80 | { | 77 | { |
81 | t_playerData *pPlayerData = new t_playerData; | 78 | t_playerData *pPlayerData = new t_playerData; |
82 | pPlayerData->sName = tr( "empty"); | 79 | pPlayerData->sName = tr( "empty"); |
83 | pPlayerData->points = 0; | 80 | pPlayerData->points = 0; |
84 | pPlayerData->level = 0; | 81 | pPlayerData->level = 0; |
85 | 82 | ||
86 | playerData.push_back( pPlayerData ); | 83 | playerData.append( pPlayerData ); |
87 | } | 84 | } |
88 | } | 85 | } |
89 | 86 | ||
90 | } | 87 | } |
91 | 88 | ||
92 | void OHighscore::checkIfItIsANewhighscore( int points) | 89 | void OHighscore::checkIfItIsANewhighscore( int points) |
93 | { | 90 | { |
94 | if ( points > lowest ) | 91 | if ( points > lowest ) |
95 | isNewhighscore = true; | 92 | isNewhighscore = true; |
96 | else | 93 | else |
97 | isNewhighscore = false; | 94 | isNewhighscore = false; |
98 | } | 95 | } |
99 | 96 | ||
100 | void OHighscore::insertData( QString name , int punkte , int playerLevel ) | 97 | void OHighscore::insertData( QString name , int punkte , int playerLevel ) |
101 | { | 98 | { |
102 | Config cfg ( "tetrix" ); | 99 | Config cfg ( "tetrix" ); |
100 | t_playerData * Run; | ||
101 | int index = 0; | ||
103 | int entryNumber = 1; | 102 | int entryNumber = 1; |
104 | std::list<t_playerData*>::iterator insertIterator = playerData.begin(); | 103 | |
105 | while ( insertIterator != playerData.end() ) | 104 | for ( Run=playerData.first(); |
106 | { | 105 | Run != 0; |
107 | if ( punkte > ( *insertIterator )->points ) | 106 | index ++, Run=playerData.next() ) { |
107 | |||
108 | if ( punkte > Run->points ) | ||
108 | { | 109 | { |
109 | t_playerData* temp = new t_playerData; | 110 | t_playerData* temp = new t_playerData; |
110 | temp->sName = name; | 111 | temp->sName = name; |
111 | temp->points = punkte; | 112 | temp->points = punkte; |
112 | temp->level = playerLevel; | 113 | temp->level = playerLevel; |
113 | playerData.insert( insertIterator , temp ); | 114 | |
115 | playerData.insert( index, temp ); | ||
114 | 116 | ||
115 | //now we have to delete the last entry | 117 | //now we have to delete the last entry |
116 | insertIterator = playerData.end(); | 118 | playerData.remove( playerData.count() ); |
117 | insertIterator--; | ||
118 | //X delete *insertIterator; //memleak? | ||
119 | playerData.erase( insertIterator ); | ||
120 | 119 | ||
121 | ///////////////////////////////////////// | 120 | ///////////////////////////////////////// |
122 | //this block just rewrites the highscore | 121 | //this block just rewrites the highscore |
123 | insertIterator = playerData.begin(); | 122 | for ( t_playerData * Run2=playerData.first(); |
124 | while ( insertIterator != playerData.end() ) | 123 | Run2 != 0; |
125 | { | 124 | Run2=playerData.next() ) { |
126 | cfg.setGroup( QString::number( entryNumber ) ); | 125 | cfg.setGroup( QString::number( entryNumber ) ); |
127 | cfg.writeEntry( "Name" , ( *insertIterator )->sName ); | 126 | cfg.writeEntry( "Name" , Run2->sName ); |
128 | cfg.writeEntry( "Points" , ( *insertIterator )->points ); | 127 | cfg.writeEntry( "Points" , Run2->points ); |
129 | cfg.writeEntry( "Level" , ( *insertIterator )->level ); | 128 | cfg.writeEntry( "Level" , Run2->level ); |
130 | entryNumber++; | 129 | entryNumber++; |
131 | insertIterator++; | ||
132 | } | 130 | } |
133 | //////////////////////////////////////// | 131 | //////////////////////////////////////// |
134 | 132 | ||
135 | return; | 133 | return; |
136 | } | 134 | } |
137 | insertIterator++; | ||
138 | } | 135 | } |
139 | } | 136 | } |
140 | 137 | ||
141 | QString OHighscore::getName() | 138 | QString OHighscore::getName() |
142 | { | 139 | { |
143 | QString name; | 140 | QString name; |
144 | QDialog *d = new QDialog ( this, 0, true ); | 141 | QDialog *d = new QDialog ( this, 0, true ); |
145 | d->setCaption( tr( "Enter your name!" )); | 142 | d->setCaption( tr( "Enter your name!" )); |
146 | QLineEdit *ed = new QLineEdit ( d ); | 143 | QLineEdit *ed = new QLineEdit ( d ); |
147 | ( new QVBoxLayout ( d, 3, 3 ))->addWidget ( ed ); | 144 | ( new QVBoxLayout ( d, 3, 3 ))->addWidget ( ed ); |
148 | ed->setFocus ( ); | 145 | ed->setFocus ( ); |
149 | 146 | ||
150 | if ( d->exec() == QDialog::Accepted ) { | 147 | if ( d->exec() == QDialog::Accepted ) { |
151 | name = ed->text(); | 148 | name = ed->text(); |
152 | } | 149 | } |
153 | //delete d; | 150 | //delete d; |
154 | return name; | 151 | return name; |
155 | } | 152 | } |
156 | 153 | ||
157 | OHighscoreDialog::OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) | 154 | OHighscoreDialog::OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) |
158 | { | 155 | { |
159 | hs_ = highscore; | 156 | hs_ = highscore; |
160 | setCaption( tr( "Highscores" ) ); | 157 | setCaption( tr( "Highscores" ) ); |
161 | vbox_layout = new QVBoxLayout( this, 4 , 4 ); | 158 | vbox_layout = new QVBoxLayout( this, 4 , 4 ); |
162 | list = new QListView( this ); | 159 | list = new QListView( this ); |
163 | list->setSorting( -1 ); | 160 | list->setSorting( -1 ); |
164 | list->addColumn( tr( "#" )); | 161 | list->addColumn( tr( "#" )); |
165 | list->addColumn( tr( "Name" )); | 162 | list->addColumn( tr( "Name" )); |
166 | list->addColumn( tr( "Points" )); | 163 | list->addColumn( tr( "Points" )); |
167 | list->addColumn( tr( "Level" )); | 164 | list->addColumn( tr( "Level" )); |
168 | 165 | ||
169 | createHighscoreListView(); | 166 | createHighscoreListView(); |
170 | 167 | ||
171 | vbox_layout->addWidget( list ); | 168 | vbox_layout->addWidget( list ); |
172 | QPEApplication::showDialog( this ); | 169 | QPEApplication::showDialog( this ); |
173 | } | 170 | } |
174 | 171 | ||
175 | void OHighscoreDialog::createHighscoreListView() | 172 | void OHighscoreDialog::createHighscoreListView() |
176 | { | 173 | { |
177 | int pos = 10; | 174 | int pos = 10; |
178 | int points_ = 0; | 175 | int points_ = 0; |
179 | int level_ = 0; | 176 | int level_ = 0; |
180 | 177 | QListViewItem * Prev = 0; | |
181 | std::list<t_playerData*>::reverse_iterator iListe = hs_->playerData.rbegin(); | 178 | |
182 | 179 | for ( t_playerData * Run = hs_->playerData.first(); | |
183 | for ( ; iListe != hs_->playerData.rend() ; ++iListe ) | 180 | Run != 0; |
184 | { | 181 | Run=hs_->playerData.next() ) |
185 | QListViewItem *item = new QListViewItem( list ); | 182 | { |
183 | QListViewItem *item; | ||
184 | |||
185 | if( Prev ) { | ||
186 | // after previous | ||
187 | item = new QListViewItem( list, Prev ); | ||
188 | Prev = item; | ||
189 | } else { | ||
190 | item = new QListViewItem( list ); | ||
191 | |||
192 | } | ||
186 | item->setText( 0 , QString::number( pos ) ); //number | 193 | item->setText( 0 , QString::number( pos ) ); //number |
187 | item->setText( 1 , ( *iListe )->sName ); //name | 194 | item->setText( 1 , Run->sName ); //name |
188 | if ( ( *iListe )->points == -1 ) | 195 | if ( Run->points == -1 ) |
189 | points_ = 0; | 196 | points_ = 0; |
190 | else points_ = ( *iListe )->points; | 197 | else points_ = Run->points; |
191 | if ( ( *iListe )->level == -1 ) | 198 | if ( Run->level == -1 ) |
192 | level_ = 0; | 199 | level_ = 0; |
193 | else level_ = ( *iListe )->level; | 200 | else level_ = Run->level; |
194 | item->setText( 2 , QString::number( points_ ) ); //points | 201 | item->setText( 2 , QString::number( points_ ) ); //points |
195 | item->setText( 3 , QString::number( level_ ) ); //level | 202 | item->setText( 3 , QString::number( level_ ) ); //level |
196 | pos--; | 203 | pos--; |
197 | } | 204 | } |
198 | } | 205 | } |
199 | 206 | ||
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 | |||
@@ -1,97 +1,96 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 6 | * ( at your option ) any later version. * |
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | class QWidget; | 10 | class QWidget; |
11 | class QVBoxLayout; | 11 | class QVBoxLayout; |
12 | class QListView; | 12 | class QListView; |
13 | 13 | ||
14 | #include <qdialog.h> | 14 | #include <qdialog.h> |
15 | #include <list> | 15 | #include <qlist.h> |
16 | 16 | ||
17 | using namespace std; | 17 | class t_playerData |
18 | |||
19 | struct t_playerData | ||
20 | { | 18 | { |
19 | |||
20 | public : | ||
21 | |||
21 | QString sName; | 22 | QString sName; |
22 | int points; | 23 | int points; |
23 | int level; | 24 | int level; |
24 | }; | 25 | }; |
25 | 26 | ||
26 | class OHighscore : public QWidget | 27 | class OHighscore : public QWidget |
27 | { | 28 | { |
28 | Q_OBJECT | 29 | Q_OBJECT |
29 | 30 | ||
30 | public: | 31 | public: |
31 | /* | 32 | /* |
32 | *An OHighscore-Object contains all Points, level and playernames sorted in a stl::vector | 33 | *An OHighscore-Object contains all Points, level and playernames sorted in a stl::vector |
33 | */ | 34 | */ |
34 | OHighscore( int , int ); | 35 | OHighscore( int , int ); |
35 | 36 | ||
36 | ~OHighscore(); | 37 | ~OHighscore(); |
37 | 38 | ||
38 | /* | 39 | /* |
39 | * is true if the player did a new highscore | 40 | * is true if the player did a new highscore |
40 | */ | 41 | */ |
41 | bool isNewhighscore; | 42 | bool isNewhighscore; |
42 | 43 | ||
43 | /* | 44 | /* |
44 | * this inserts the new entry at the correct position | 45 | * this inserts the new entry at the correct position |
45 | */ | 46 | */ |
46 | void insertData( QString , int , int ); | 47 | void insertData( QString , int , int ); |
47 | 48 | ||
48 | list<t_playerData*> playerData; | 49 | QList<t_playerData> playerData; |
49 | 50 | ||
50 | /* | 51 | /* |
51 | * As Qt/e does not support QInputDialog I did that code myself | 52 | * As Qt/e does not support QInputDialog I did that code myself |
52 | */ | 53 | */ |
53 | QString getName(); | 54 | QString getName(); |
54 | private: | 55 | private: |
55 | 56 | ||
56 | list<t_playerData*>::iterator iPlayerData; | ||
57 | |||
58 | /* | 57 | /* |
59 | * the lowest score in the highscorelist | 58 | * the lowest score in the highscorelist |
60 | */ | 59 | */ |
61 | int lowest; | 60 | int lowest; |
62 | 61 | ||
63 | /* | 62 | /* |
64 | * the level of the highscore | 63 | * the level of the highscore |
65 | */ | 64 | */ |
66 | int pLevel; | 65 | int pLevel; |
67 | 66 | ||
68 | /* | 67 | /* |
69 | * get all scores in a vector and give "lowest" a value | 68 | * get all scores in a vector and give "lowest" a value |
70 | */ | 69 | */ |
71 | void getList(); | 70 | void getList(); |
72 | 71 | ||
73 | /* | 72 | /* |
74 | * sets the bool if the current score is in the top10 | 73 | * sets the bool if the current score is in the top10 |
75 | */ | 74 | */ |
76 | void checkIfItIsANewhighscore( int ); | 75 | void checkIfItIsANewhighscore( int ); |
77 | }; | 76 | }; |
78 | 77 | ||
79 | class OHighscoreDialog : public QDialog | 78 | class OHighscoreDialog : public QDialog |
80 | { | 79 | { |
81 | Q_OBJECT | 80 | Q_OBJECT |
82 | 81 | ||
83 | public: | 82 | public: |
84 | OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name = 0, bool modal = true ); | 83 | OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name = 0, bool modal = true ); |
85 | 84 | ||
86 | private: | 85 | private: |
87 | OHighscore *hs_; | 86 | OHighscore *hs_; |
88 | 87 | ||
89 | QVBoxLayout *vbox_layout; | 88 | QVBoxLayout *vbox_layout; |
90 | 89 | ||
91 | /* | 90 | /* |
92 | * this method creates the QListView with all data | 91 | * this method creates the QListView with all data |
93 | */ | 92 | */ |
94 | void createHighscoreListView(); | 93 | void createHighscoreListView(); |
95 | 94 | ||
96 | QListView *list; | 95 | QListView *list; |
97 | }; | 96 | }; |
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 | |||
@@ -1,22 +1,22 @@ | |||
1 | CONFIG = qt warn_on quick-app | 1 | CONFIG = qt warn_on quick-app |
2 | HEADERS = gtetrix.h \ | 2 | HEADERS = gtetrix.h \ |
3 | qtetrix.h \ | 3 | qtetrix.h \ |
4 | qtetrixb.h \ | 4 | qtetrixb.h \ |
5 | tpiece.h \ | 5 | tpiece.h \ |
6 | ohighscoredlg.h | 6 | ohighscoredlg.h |
7 | SOURCES = main.cpp \ | 7 | SOURCES = main.cpp \ |
8 | gtetrix.cpp \ | 8 | gtetrix.cpp \ |
9 | qtetrix.cpp \ | 9 | qtetrix.cpp \ |
10 | qtetrixb.cpp \ | 10 | qtetrixb.cpp \ |
11 | tpiece.cpp \ | 11 | tpiece.cpp \ |
12 | ohighscoredlg.cpp | 12 | ohighscoredlg.cpp |
13 | INCLUDEPATH += $(OPIEDIR)/include | 13 | INCLUDEPATH += $(OPIEDIR)/include |
14 | DEPENDPATH+= $(OPIEDIR)/include | 14 | DEPENDPATH+= $(OPIEDIR)/include |
15 | LIBS += -lqpe -lopiecore2 -lstdc++ | 15 | LIBS += -lqpe -lopiecore2 |
16 | INTERFACES= | 16 | INTERFACES= |
17 | TARGET = tetrix | 17 | TARGET = tetrix |
18 | 18 | ||
19 | 19 | ||
20 | 20 | ||
21 | 21 | ||
22 | include( $(OPIEDIR)/include.pro ) | 22 | 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 @@ | |||
1 | Package: opie-camera | 1 | Package: opie-camera |
2 | Files: lib/libcamera.* bin/camera bin/capture pics/camera apps/Applications/camera.desktop | 2 | Files: lib/libcamera.* bin/camera bin/capture pics/camera apps/Applications/camera.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/multimedia | 4 | Section: opie/multimedia |
5 | Maintainer: Michael 'Mickey' Lauer <mickeyl@Vanille.de> | 5 | Maintainer: Michael 'Mickey' Lauer <mickeyl@Vanille.de> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 1.0.1 | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: libqpe1, libopiecore2, libopieui2 | 8 | Depends: libqpe1, libopiecore2, libopieui2 |
9 | Description: A Camera Application | 9 | Description: A Camera Application |
10 | A Camera Application to use with the Sharp CE-AG06. | 10 | 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 @@ | |||
1 | Package: opie-mediaplayer2-codecs | 1 | Package: opie-mediaplayer2-codecs |
2 | Files: root/usr/lib/libao.so* root/usr/lib/libogg* root/usr/lib/libvorbisidec.so* root/usr/lib/libxine.so* root/usr/lib/xine/* | 2 | Files: root/usr/lib/libao.so* root/usr/lib/libogg* root/usr/lib/libvorbisidec.so* root/usr/lib/libxine.so* root/usr/lib/xine/* |
3 | Section: ;ibs | 3 | Section: ;ibs |
4 | Essential: no | 4 | Essential: no |
5 | Priority: optional | 5 | Priority: optional |
6 | Version: 0.7-$SUB_VERSION.3 | 6 | Version: $QPE_VERSION$EXTRAVERSION |
7 | Architecture: arm | 7 | Architecture: arm |
8 | Maintainer: Maximilian Reiss <harlekin@handhelds.org> | 8 | Maintainer: Maximilian Reiss <harlekin@handhelds.org> |
9 | Depends: libc6 (>= 2.1), opie-mediaplayer2 | 9 | Depends: libc6 (>= 2.1), opie-mediaplayer2 |
10 | Description: Codecs for opieplayer 2 | 10 | 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 @@ | |||
1 | Package: opie-mediaplayer2 | 1 | Package: opie-mediaplayer2 |
2 | 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 | 2 | 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 |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/multimedia | 4 | Section: opie/multimedia |
5 | Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org> | 5 | Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, libopie1, zlib1g, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2, libqtaux2, libz1, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs |
8 | Description: The Opie media player | 8 | Description: The Opie media player |
9 | The mediaplayer for Opie. It plays mp3, mpeg, wav, ogg, quicktime, divx and | 9 | The mediaplayer for Opie. It plays mp3, mpeg, wav, ogg, quicktime, divx and |
10 | more. Also it is streaming capable. | 10 | more. Also it is streaming capable. |
11 | Version: $QPE_VERSION$EXTRAVERSION | 11 | 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 @@ | |||
1 | Files: plugins/applications/libpowerchord.so* bin/powerchord apps/Applications/powerchord.desktop pics/powerchord share/powerchord | 1 | Files: plugins/applications/libpowerchord.so* bin/powerchord apps/Applications/powerchord.desktop pics/powerchord share/powerchord |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/multimedia | 3 | Section: opie/multimedia |
4 | Maintainer: Camilo Mesias <camilo@mesias.co.uk>, ljp <lpotter@trolltech.com> | 4 | Maintainer: Camilo Mesias <camilo@mesias.co.uk>, ljp <lpotter@trolltech.com> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: 0.0.8 | 6 | Version: $QPE_VERSION$EXTRAVERSION |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: Guitar Chord generator application | 8 | Description: Guitar Chord generator application |
9 | Allows naming of chords using base note and key. Fretboard diagrams are | 9 | Allows naming of chords using base note and key. Fretboard diagrams are |
10 | produced illustrating ways to play the chord. | 10 | 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 @@ | |||
1 | Package: libetpan | 1 | Package: libetpan |
2 | Files: usr/lib/libetpan* | 2 | Files: usr/lib/libetpan* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: system | 4 | Section: system |
5 | Maintainer: Rajko Albrecht <alwin@handhelds.org> | 5 | Maintainer: Rajko Albrecht <alwin@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.33pre-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: libssl0.9.7 | 8 | Depends: libssl0.9.7 |
9 | Description: libetpan mail/news library - A version of libetpan patched for Opies mailing app | 9 | Description: libetpan mail/news library - A version of libetpan patched for Opies mailing app |
10 | License: LGPL | 10 | 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 @@ | |||
1 | Package: libmailwrapper | 1 | Package: libmailwrapper |
2 | Files: lib/libmailwrapper.so* | 2 | Files: lib/libmailwrapper.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: libs | 4 | Section: libs |
5 | Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> | 5 | Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.6-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, libopiecore2, libopieui2, libetpan (>= 0.33pre) | 8 | Depends: task-opie-minimal, libopiecore2, libopieui2, libetpan (>= 0.33pre) |
9 | Description: wrapper lib needed by Opie's mailer | 9 | Description: wrapper lib needed by Opie's mailer |
10 | License: LGPL | 10 | 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 @@ | |||
1 | Package: opie-mail | 1 | Package: opie-mail |
2 | Files: plugins/application/libopiemail.so* bin/opiemail apps/1Pim/opiemail.desktop pics/mail/*.png | 2 | Files: plugins/application/libopiemail.so* bin/opiemail apps/1Pim/opiemail.desktop pics/mail/*.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/pim | 4 | Section: opie/pim |
5 | Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> | 5 | Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.6-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, libopiecore2, libopieui2, libopiemm2, libopiedb2, libmailwrapper (>= 0.6), libssl | 8 | Depends: task-opie-minimal, libopiecore2, libopieui2, libopiemm2, libopiedb2, libmailwrapper (>= 0.6), libssl |
9 | Description: Opie's mail and news client (POP3, IMAP and NNTP) | 9 | Description: Opie's mail and news client (POP3, IMAP and NNTP) |
10 | License: LGPL | 10 | 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 @@ | |||
1 | Package: opie-mailapplet | 1 | Package: opie-mailapplet |
2 | Files: plugins/applets/libmailapplet.so* | 2 | Files: plugins/applets/libmailapplet.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applets | 4 | Section: opie/applets |
5 | Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> | 5 | Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.5-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, libopiecore2, opie-mail | 8 | Depends: task-opie-minimal, libopiecore2, opie-mail |
9 | Description: A Biff-like mailchecker | 9 | Description: A Biff-like mailchecker |
10 | License: LGPL | 10 | 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 @@ | |||
1 | Package: opie-irc | 1 | Package: opie-irc |
2 | Files: plugins/application/libopieirc.so* bin/opieirc pics/opieirc apps/Applications/opieirc.desktop help/en/html/opieirc.html help/en/html/opieirc | 2 | Files: plugins/application/libopieirc.so* bin/opieirc pics/opieirc apps/Applications/opieirc.desktop help/en/html/opieirc.html help/en/html/opieirc |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Wenzel Jakob <root@wazlaf.de> | 5 | Maintainer: Wenzel Jakob <root@wazlaf.de> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, libopie1 | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2, libqtaux2 |
8 | Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer | 8 | Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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 @@ | |||
1 | Package: opie-rdesktop | 1 | Package: opie-rdesktop |
2 | Files: bin/ordesktop pics/opierdesktop apps/Applications/ordesktop.desktop | 2 | Files: bin/ordesktop pics/opierdesktop apps/Applications/ordesktop.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org> | 5 | Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 1.2.0-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
9 | Description: Remote Desktop Protocol (RDP) Client | 9 | 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 | |||
@@ -1,12 +1,11 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | 4 | ||
5 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
6 | #include <opie2/oapplicationfactory.h> | 6 | #include <opie2/oapplicationfactory.h> |
7 | 7 | ||
8 | #include "pindlg.h" | 8 | #include "pindlg.h" |
9 | 9 | ||
10 | using namespace Opie::Core; | 10 | using namespace Opie::Core; |
11 | OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::PinDlg> ) | 11 | OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::PinDlg> ) |
12 | |||
diff --git a/noncore/net/opietooth/blue-pin/opie-bluepin.control b/noncore/net/opietooth/blue-pin/opie-bluepin.control index 7147975..e9aa683 100644 --- a/noncore/net/opietooth/blue-pin/opie-bluepin.control +++ b/noncore/net/opietooth/blue-pin/opie-bluepin.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-bluepin | 1 | Package: opie-bluepin |
2 | Files: plugins/application/libbluepin.so* bin/bluepin | 2 | Files: plugins/application/libbluepin.so* bin/bluepin |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Holger Freyther <zecke@handhelds.org> | 5 | Maintainer: Holger Freyther <zecke@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.3.4-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
9 | License: GPL | 9 | License: GPL |
10 | Description: Bluetooth pin application | 10 | 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 | |||
@@ -1,274 +1,274 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>PinDlgBase</class> | 2 | <class>PinDlgBase</class> |
3 | <author>zecke</author> | 3 | <author>zecke</author> |
4 | <widget> | 4 | <widget> |
5 | <class>QDialog</class> | 5 | <class>QDialog</class> |
6 | <property stdset="1"> | 6 | <property stdset="1"> |
7 | <name>name</name> | 7 | <name>name</name> |
8 | <cstring>Form1</cstring> | 8 | <cstring>Form1</cstring> |
9 | </property> | 9 | </property> |
10 | <property stdset="1"> | 10 | <property stdset="1"> |
11 | <name>geometry</name> | 11 | <name>geometry</name> |
12 | <rect> | 12 | <rect> |
13 | <x>0</x> | 13 | <x>0</x> |
14 | <y>0</y> | 14 | <y>0</y> |
15 | <width>258</width> | 15 | <width>254</width> |
16 | <height>245</height> | 16 | <height>245</height> |
17 | </rect> | 17 | </rect> |
18 | </property> | 18 | </property> |
19 | <property stdset="1"> | 19 | <property stdset="1"> |
20 | <name>caption</name> | 20 | <name>caption</name> |
21 | <string>Please enter pin</string> | 21 | <string>Please enter pin</string> |
22 | </property> | 22 | </property> |
23 | <vbox> | 23 | <vbox> |
24 | <property stdset="1"> | 24 | <property stdset="1"> |
25 | <name>margin</name> | 25 | <name>margin</name> |
26 | <number>11</number> | 26 | <number>11</number> |
27 | </property> | 27 | </property> |
28 | <property stdset="1"> | 28 | <property stdset="1"> |
29 | <name>spacing</name> | 29 | <name>spacing</name> |
30 | <number>6</number> | 30 | <number>6</number> |
31 | </property> | 31 | </property> |
32 | <widget> | ||
33 | <class>QLabel</class> | ||
34 | <property stdset="1"> | ||
35 | <name>name</name> | ||
36 | <cstring>txtStatus</cstring> | ||
37 | </property> | ||
38 | <property stdset="1"> | ||
39 | <name>text</name> | ||
40 | <string></string> | ||
41 | </property> | ||
42 | <property stdset="1"> | ||
43 | <name>textFormat</name> | ||
44 | <enum>RichText</enum> | ||
45 | </property> | ||
46 | </widget> | ||
47 | <spacer> | 32 | <spacer> |
48 | <property> | 33 | <property> |
49 | <name>name</name> | 34 | <name>name</name> |
50 | <cstring>Spacer4_2</cstring> | 35 | <cstring>Spacer4_2</cstring> |
51 | </property> | 36 | </property> |
52 | <property stdset="1"> | 37 | <property stdset="1"> |
53 | <name>orientation</name> | 38 | <name>orientation</name> |
54 | <enum>Vertical</enum> | 39 | <enum>Vertical</enum> |
55 | </property> | 40 | </property> |
56 | <property stdset="1"> | 41 | <property stdset="1"> |
57 | <name>sizeType</name> | 42 | <name>sizeType</name> |
58 | <enum>Expanding</enum> | 43 | <enum>Expanding</enum> |
59 | </property> | 44 | </property> |
60 | <property> | 45 | <property> |
61 | <name>sizeHint</name> | 46 | <name>sizeHint</name> |
62 | <size> | 47 | <size> |
63 | <width>20</width> | 48 | <width>20</width> |
64 | <height>20</height> | 49 | <height>20</height> |
65 | </size> | 50 | </size> |
66 | </property> | 51 | </property> |
67 | </spacer> | 52 | </spacer> |
68 | <widget> | 53 | <widget> |
54 | <class>QLabel</class> | ||
55 | <property stdset="1"> | ||
56 | <name>name</name> | ||
57 | <cstring>txtStatus</cstring> | ||
58 | </property> | ||
59 | <property stdset="1"> | ||
60 | <name>text</name> | ||
61 | <string></string> | ||
62 | </property> | ||
63 | <property stdset="1"> | ||
64 | <name>textFormat</name> | ||
65 | <enum>RichText</enum> | ||
66 | </property> | ||
67 | </widget> | ||
68 | <widget> | ||
69 | <class>QLayoutWidget</class> | 69 | <class>QLayoutWidget</class> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>name</name> | 71 | <name>name</name> |
72 | <cstring>Layout6</cstring> | 72 | <cstring>Layout6</cstring> |
73 | </property> | 73 | </property> |
74 | <vbox> | 74 | <vbox> |
75 | <property stdset="1"> | 75 | <property stdset="1"> |
76 | <name>margin</name> | 76 | <name>margin</name> |
77 | <number>0</number> | 77 | <number>0</number> |
78 | </property> | 78 | </property> |
79 | <property stdset="1"> | 79 | <property stdset="1"> |
80 | <name>spacing</name> | 80 | <name>spacing</name> |
81 | <number>6</number> | 81 | <number>6</number> |
82 | </property> | 82 | </property> |
83 | <widget> | 83 | <widget> |
84 | <class>QLabel</class> | 84 | <class>QLabel</class> |
85 | <property stdset="1"> | 85 | <property stdset="1"> |
86 | <name>name</name> | 86 | <name>name</name> |
87 | <cstring>TextLabel3</cstring> | 87 | <cstring>TextLabel3</cstring> |
88 | </property> | 88 | </property> |
89 | <property stdset="1"> | 89 | <property stdset="1"> |
90 | <name>text</name> | 90 | <name>text</name> |
91 | <string>Please enter PIN:</string> | 91 | <string>Please enter PIN:</string> |
92 | </property> | 92 | </property> |
93 | </widget> | 93 | </widget> |
94 | <widget> | 94 | <widget> |
95 | <class>QLayoutWidget</class> | 95 | <class>QLayoutWidget</class> |
96 | <property stdset="1"> | 96 | <property stdset="1"> |
97 | <name>name</name> | 97 | <name>name</name> |
98 | <cstring>Layout5</cstring> | 98 | <cstring>Layout5</cstring> |
99 | </property> | 99 | </property> |
100 | <hbox> | 100 | <hbox> |
101 | <property stdset="1"> | 101 | <property stdset="1"> |
102 | <name>margin</name> | 102 | <name>margin</name> |
103 | <number>0</number> | 103 | <number>0</number> |
104 | </property> | 104 | </property> |
105 | <property stdset="1"> | 105 | <property stdset="1"> |
106 | <name>spacing</name> | 106 | <name>spacing</name> |
107 | <number>6</number> | 107 | <number>6</number> |
108 | </property> | 108 | </property> |
109 | <widget> | 109 | <widget> |
110 | <class>QLineEdit</class> | 110 | <class>QLineEdit</class> |
111 | <property stdset="1"> | 111 | <property stdset="1"> |
112 | <name>name</name> | 112 | <name>name</name> |
113 | <cstring>lnePin</cstring> | 113 | <cstring>lnePin</cstring> |
114 | </property> | 114 | </property> |
115 | <property stdset="1"> | 115 | <property stdset="1"> |
116 | <name>echoMode</name> | 116 | <name>echoMode</name> |
117 | <enum>Password</enum> | 117 | <enum>Password</enum> |
118 | </property> | 118 | </property> |
119 | </widget> | 119 | </widget> |
120 | <spacer> | 120 | <spacer> |
121 | <property> | 121 | <property> |
122 | <name>name</name> | 122 | <name>name</name> |
123 | <cstring>Spacer4</cstring> | 123 | <cstring>Spacer4</cstring> |
124 | </property> | 124 | </property> |
125 | <property stdset="1"> | 125 | <property stdset="1"> |
126 | <name>orientation</name> | 126 | <name>orientation</name> |
127 | <enum>Horizontal</enum> | 127 | <enum>Horizontal</enum> |
128 | </property> | 128 | </property> |
129 | <property stdset="1"> | 129 | <property stdset="1"> |
130 | <name>sizeType</name> | 130 | <name>sizeType</name> |
131 | <enum>Fixed</enum> | 131 | <enum>Fixed</enum> |
132 | </property> | 132 | </property> |
133 | <property> | 133 | <property> |
134 | <name>sizeHint</name> | 134 | <name>sizeHint</name> |
135 | <size> | 135 | <size> |
136 | <width>21</width> | 136 | <width>21</width> |
137 | <height>20</height> | 137 | <height>20</height> |
138 | </size> | 138 | </size> |
139 | </property> | 139 | </property> |
140 | </spacer> | 140 | </spacer> |
141 | </hbox> | 141 | </hbox> |
142 | </widget> | 142 | </widget> |
143 | <widget> | 143 | <widget> |
144 | <class>QCheckBox</class> | 144 | <class>QCheckBox</class> |
145 | <property stdset="1"> | 145 | <property stdset="1"> |
146 | <name>name</name> | 146 | <name>name</name> |
147 | <cstring>ckbPin</cstring> | 147 | <cstring>ckbPin</cstring> |
148 | </property> | 148 | </property> |
149 | <property stdset="1"> | 149 | <property stdset="1"> |
150 | <name>text</name> | 150 | <name>text</name> |
151 | <string>Save pin</string> | 151 | <string>Save pin</string> |
152 | </property> | 152 | </property> |
153 | </widget> | 153 | </widget> |
154 | </vbox> | 154 | </vbox> |
155 | </widget> | 155 | </widget> |
156 | <spacer> | 156 | <spacer> |
157 | <property> | 157 | <property> |
158 | <name>name</name> | 158 | <name>name</name> |
159 | <cstring>Spacer5</cstring> | 159 | <cstring>Spacer5</cstring> |
160 | </property> | 160 | </property> |
161 | <property stdset="1"> | 161 | <property stdset="1"> |
162 | <name>orientation</name> | 162 | <name>orientation</name> |
163 | <enum>Vertical</enum> | 163 | <enum>Vertical</enum> |
164 | </property> | 164 | </property> |
165 | <property stdset="1"> | 165 | <property stdset="1"> |
166 | <name>sizeType</name> | 166 | <name>sizeType</name> |
167 | <enum>Expanding</enum> | 167 | <enum>Expanding</enum> |
168 | </property> | 168 | </property> |
169 | <property> | 169 | <property> |
170 | <name>sizeHint</name> | 170 | <name>sizeHint</name> |
171 | <size> | 171 | <size> |
172 | <width>20</width> | 172 | <width>20</width> |
173 | <height>20</height> | 173 | <height>20</height> |
174 | </size> | 174 | </size> |
175 | </property> | 175 | </property> |
176 | </spacer> | 176 | </spacer> |
177 | <widget> | 177 | <widget> |
178 | <class>QLayoutWidget</class> | 178 | <class>QLayoutWidget</class> |
179 | <property stdset="1"> | 179 | <property stdset="1"> |
180 | <name>name</name> | 180 | <name>name</name> |
181 | <cstring>Layout7</cstring> | 181 | <cstring>Layout7</cstring> |
182 | </property> | 182 | </property> |
183 | <hbox> | 183 | <hbox> |
184 | <property stdset="1"> | 184 | <property stdset="1"> |
185 | <name>margin</name> | 185 | <name>margin</name> |
186 | <number>0</number> | 186 | <number>0</number> |
187 | </property> | 187 | </property> |
188 | <property stdset="1"> | 188 | <property stdset="1"> |
189 | <name>spacing</name> | 189 | <name>spacing</name> |
190 | <number>6</number> | 190 | <number>6</number> |
191 | </property> | 191 | </property> |
192 | <spacer> | 192 | <spacer> |
193 | <property> | 193 | <property> |
194 | <name>name</name> | 194 | <name>name</name> |
195 | <cstring>Spacer1</cstring> | 195 | <cstring>Spacer1</cstring> |
196 | </property> | 196 | </property> |
197 | <property stdset="1"> | 197 | <property stdset="1"> |
198 | <name>orientation</name> | 198 | <name>orientation</name> |
199 | <enum>Horizontal</enum> | 199 | <enum>Horizontal</enum> |
200 | </property> | 200 | </property> |
201 | <property stdset="1"> | 201 | <property stdset="1"> |
202 | <name>sizeType</name> | 202 | <name>sizeType</name> |
203 | <enum>Fixed</enum> | 203 | <enum>Fixed</enum> |
204 | </property> | 204 | </property> |
205 | <property> | 205 | <property> |
206 | <name>sizeHint</name> | 206 | <name>sizeHint</name> |
207 | <size> | 207 | <size> |
208 | <width>30</width> | 208 | <width>30</width> |
209 | <height>20</height> | 209 | <height>20</height> |
210 | </size> | 210 | </size> |
211 | </property> | 211 | </property> |
212 | </spacer> | 212 | </spacer> |
213 | <widget> | 213 | <widget> |
214 | <class>QPushButton</class> | 214 | <class>QPushButton</class> |
215 | <property stdset="1"> | 215 | <property stdset="1"> |
216 | <name>name</name> | 216 | <name>name</name> |
217 | <cstring>PushButton1</cstring> | 217 | <cstring>PushButton1</cstring> |
218 | </property> | 218 | </property> |
219 | <property stdset="1"> | 219 | <property stdset="1"> |
220 | <name>text</name> | 220 | <name>text</name> |
221 | <string>&Ok</string> | 221 | <string>&Ok</string> |
222 | </property> | 222 | </property> |
223 | </widget> | 223 | </widget> |
224 | <widget> | 224 | <widget> |
225 | <class>QPushButton</class> | 225 | <class>QPushButton</class> |
226 | <property stdset="1"> | 226 | <property stdset="1"> |
227 | <name>name</name> | 227 | <name>name</name> |
228 | <cstring>PushButton2</cstring> | 228 | <cstring>PushButton2</cstring> |
229 | </property> | 229 | </property> |
230 | <property stdset="1"> | 230 | <property stdset="1"> |
231 | <name>text</name> | 231 | <name>text</name> |
232 | <string>&Cancel</string> | 232 | <string>&Cancel</string> |
233 | </property> | 233 | </property> |
234 | </widget> | 234 | </widget> |
235 | <spacer> | 235 | <spacer> |
236 | <property> | 236 | <property> |
237 | <name>name</name> | 237 | <name>name</name> |
238 | <cstring>Spacer2</cstring> | 238 | <cstring>Spacer2</cstring> |
239 | </property> | 239 | </property> |
240 | <property stdset="1"> | 240 | <property stdset="1"> |
241 | <name>orientation</name> | 241 | <name>orientation</name> |
242 | <enum>Horizontal</enum> | 242 | <enum>Horizontal</enum> |
243 | </property> | 243 | </property> |
244 | <property stdset="1"> | 244 | <property stdset="1"> |
245 | <name>sizeType</name> | 245 | <name>sizeType</name> |
246 | <enum>Fixed</enum> | 246 | <enum>Fixed</enum> |
247 | </property> | 247 | </property> |
248 | <property> | 248 | <property> |
249 | <name>sizeHint</name> | 249 | <name>sizeHint</name> |
250 | <size> | 250 | <size> |
251 | <width>16</width> | 251 | <width>16</width> |
252 | <height>20</height> | 252 | <height>20</height> |
253 | </size> | 253 | </size> |
254 | </property> | 254 | </property> |
255 | </spacer> | 255 | </spacer> |
256 | </hbox> | 256 | </hbox> |
257 | </widget> | 257 | </widget> |
258 | </vbox> | 258 | </vbox> |
259 | </widget> | 259 | </widget> |
260 | <connections> | 260 | <connections> |
261 | <connection> | 261 | <connection> |
262 | <sender>PushButton1</sender> | 262 | <sender>PushButton1</sender> |
263 | <signal>clicked()</signal> | 263 | <signal>clicked()</signal> |
264 | <receiver>Form1</receiver> | 264 | <receiver>Form1</receiver> |
265 | <slot>accept()</slot> | 265 | <slot>accept()</slot> |
266 | </connection> | 266 | </connection> |
267 | <connection> | 267 | <connection> |
268 | <sender>PushButton2</sender> | 268 | <sender>PushButton2</sender> |
269 | <signal>clicked()</signal> | 269 | <signal>clicked()</signal> |
270 | <receiver>Form1</receiver> | 270 | <receiver>Form1</receiver> |
271 | <slot>reject()</slot> | 271 | <slot>reject()</slot> |
272 | </connection> | 272 | </connection> |
273 | </connections> | 273 | </connections> |
274 | </UI> | 274 | </UI> |
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 @@ | |||
1 | Package: libopietooth1 | 1 | Package: libopietooth1 |
2 | Files: lib/libopietooth1.so* | 2 | Files: lib/libopietooth1.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: libs | 4 | Section: libs |
5 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> | 5 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Replaces: libopietooth | 7 | Replaces: libopietooth |
8 | Depends: libqte2 (>=2.3.4), libopie1, task-bluez | 8 | Depends: libqte2 (>=2.3.4), libopiecore2, task-bluez |
9 | Description: Opie bluetooth library | 9 | Description: Opie bluetooth library |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | 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 @@ | |||
1 | Package: opie-bluetoothmanager | 1 | Package: opie-bluetoothmanager |
2 | Files: plugins/application/libbluetooth-manager.so* bin/bluetooth-manager apps/Settings/bluetooth-manager.desktop pics/opietooth/* | 2 | Files: plugins/application/libbluetooth-manager.so* bin/bluetooth-manager apps/Settings/bluetooth-manager.desktop pics/opietooth/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> | 5 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.5.4-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, libopietooth1, opie-bluepin | 8 | Depends: task-opie-minimal, libopietooth1, opie-bluepin |
9 | License: GPL | 9 | License: GPL |
10 | Description: Bluetooth Manager application | 10 | 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 @@ | |||
1 | Package: opie-wellenreiter | 1 | Package: opie-wellenreiter |
2 | Files: bin/wellenreiter pics/wellenreiter apps/Applications/wellenreiter.desktop | 2 | Files: bin/wellenreiter pics/wellenreiter apps/Applications/wellenreiter.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org> | 5 | Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 1.0.3-cvs | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: libqpe1, libpcap0 (>=0.7.2), libopiecore2, libopienet2, libopieui2 | 8 | Depends: libqpe1, libpcap0.8 (>=0.7.2), libopiecore2, libopienet2, libopieui2 |
9 | Description: A WaveLAN Network Monitor | 9 | Description: A WaveLAN Network Monitor |
10 | A WaveLAN Network Monitor/Sniffer for the Opie Environment. | 10 | 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 @@ | |||
1 | Package: opie-multiauth-bluepingplugin | 1 | Package: opie-multiauth-bluepingplugin |
2 | Files: plugins/security/libmultiauthbluepingplugin.so* pics/security/bluepingplugin.png root/etc/suspend-scripts/S50bluetooth | 2 | Files: plugins/security/libmultiauthbluepingplugin.so* pics/security/bluepingplugin.png root/etc/suspend-scripts/S50bluetooth |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Clement Seveillac <clement@nist.gov> | 5 | Maintainer: Clement Seveillac <clement@nist.gov> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.0.2.7 | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: libopiecore2, opie-security, bluez-utils (<= 2.3rel-hh5) | 8 | Depends: libopiecore2, opie-security, bluez-utils (<= 2.3rel-hh5) |
9 | Description: Blueping plugin for opie-security authentication. | 9 | Description: Blueping plugin for opie-security authentication. |
10 | This is a bluetooth-based authentication plugin (you need | 10 | This is a bluetooth-based authentication plugin (you need |
11 | to have another Bluetooth device around to use it). | 11 | 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 @@ | |||
1 | Package: opie-multiauth-dummyplugin | 1 | Package: opie-multiauth-dummyplugin |
2 | Files: plugins/security/libmultiauthdummyplugin.so* pics/security/dummyplugin.png | 2 | Files: plugins/security/libmultiauthdummyplugin.so* pics/security/dummyplugin.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Clement Seveillac <clement@nist.gov> | 5 | Maintainer: Clement Seveillac <clement@nist.gov> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.0.2.3 | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: libopiecore2, opie-security | 8 | Depends: libopiecore2, opie-security |
9 | Description: Dummy plugin for opie-security authentication. | 9 | Description: Dummy plugin for opie-security authentication. |
10 | This is a very simple authentication plugin (you just have | 10 | This is a very simple authentication plugin (you just have |
11 | to press a button basically), for demonstration purpose. | 11 | 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 @@ | |||
1 | Package: opie-multiauth-noticeplugin | 1 | Package: opie-multiauth-noticeplugin |
2 | Files: plugins/security/libmultiauthnoticeplugin.so* pics/security/noticeplugin.png pics/security/noticeplugin_small.png | 2 | Files: plugins/security/libmultiauthnoticeplugin.so* pics/security/noticeplugin.png pics/security/noticeplugin_small.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Clement Seveillac <clement@nist.gov> | 5 | Maintainer: Clement Seveillac <clement@nist.gov> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.0.1.6 | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: libopiecore2, opie-security | 8 | Depends: libopiecore2, opie-security |
9 | Description: Notice plugin for opie-security authentication. | 9 | Description: Notice plugin for opie-security authentication. |
10 | It allows you to display e.g. a notice from your legal departement. | 10 | It allows you to display e.g. a notice from your legal departement. |
11 | 11 | ||
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 @@ | |||
1 | Package: opie-multiauth-pinplugin | 1 | Package: opie-multiauth-pinplugin |
2 | Files: plugins/security/libmultiauthpinplugin.so* pics/security/pinplugin.png | 2 | Files: plugins/security/libmultiauthpinplugin.so* pics/security/pinplugin.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Clement Seveillac <clement@nist.gov> | 5 | Maintainer: Clement Seveillac <clement@nist.gov> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.0.2.6 | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: libopiecore2, opie-security | 8 | Depends: libopiecore2, opie-security |
9 | Description: PIN plugin for opie-security authentication. | 9 | Description: PIN plugin for opie-security authentication. |
10 | Simple PIN-based authentication plugin (replicate the functionality | 10 | Simple PIN-based authentication plugin (replicate the functionality |
11 | Qtopia has, or Opie used to have, without plugins). | 11 | 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 | |||
@@ -1,53 +1,47 @@ | |||
1 | #include <qlistview.h> | 1 | #include <qlistview.h> |
2 | #include <qheader.h> | 2 | #include <qheader.h> |
3 | #include <resources.h> | 3 | #include <resources.h> |
4 | #include "activatevpn.h" | 4 | #include "activatevpn.h" |
5 | 5 | ||
6 | class MyCheckListItem : public QCheckListItem { | 6 | class MyCheckListItem : public QCheckListItem { |
7 | 7 | ||
8 | public : | 8 | public : |
9 | 9 | ||
10 | MyCheckListItem( NodeCollection * N, QListView * V ); | 10 | MyCheckListItem( NodeCollection * N, QListView * V ); |
11 | 11 | ||
12 | NodeCollection * NC; | 12 | NodeCollection * NC; |
13 | 13 | ||
14 | }; | 14 | }; |
15 | 15 | ||
16 | MyCheckListItem::MyCheckListItem( NodeCollection * N, QListView * V ): | 16 | MyCheckListItem::MyCheckListItem( NodeCollection * N, QListView * V ): |
17 | QCheckListItem( V, N->name() ) { | 17 | QCheckListItem( V, N->name() ) { |
18 | NC = N; | 18 | NC = N; |
19 | } | 19 | } |
20 | 20 | ||
21 | ActivateVPN::ActivateVPN( void ) : | 21 | ActivateVPN::ActivateVPN( void ) : |
22 | ActivateVPNGUI( 0, 0, TRUE ), NSD() { | 22 | ActivateVPNGUI( 0, 0, TRUE ), NSD() { |
23 | 23 | ||
24 | QCheckListItem * CI; | 24 | QCheckListItem * CI; |
25 | printf( "%d\n", __LINE__ ); | ||
26 | VPN_LV->clear(); | 25 | VPN_LV->clear(); |
27 | VPN_LV->header()->hide(); | 26 | VPN_LV->header()->hide(); |
28 | printf( "%d\n", __LINE__ ); | ||
29 | 27 | ||
30 | for( QDictIterator<NodeCollection> it(NSResources->connections()); | 28 | for( QDictIterator<NodeCollection> it(NSResources->connections()); |
31 | it.current(); | 29 | it.current(); |
32 | ++it ) { | 30 | ++it ) { |
33 | printf( "%d\n", __LINE__ ); | ||
34 | if( it.current()->triggeredBy( "vpn" ) ) { | 31 | if( it.current()->triggeredBy( "vpn" ) ) { |
35 | printf( "%d\n", __LINE__ ); | ||
36 | CI = new MyCheckListItem( it.current(), VPN_LV ); | 32 | CI = new MyCheckListItem( it.current(), VPN_LV ); |
37 | printf( "%d\n", __LINE__ ); | ||
38 | } | 33 | } |
39 | printf( "%d\n", __LINE__ ); | ||
40 | } | 34 | } |
41 | } | 35 | } |
42 | 36 | ||
43 | ActivateVPN::~ActivateVPN( void ) { | 37 | ActivateVPN::~ActivateVPN( void ) { |
44 | } | 38 | } |
45 | 39 | ||
46 | void ActivateVPN::SLOT_ChangedVPNSetting( QListViewItem * I ) { | 40 | void ActivateVPN::SLOT_ChangedVPNSetting( QListViewItem * I ) { |
47 | 41 | ||
48 | MyCheckListItem * MI = (MyCheckListItem *)I; | 42 | MyCheckListItem * MI = (MyCheckListItem *)I; |
49 | 43 | ||
50 | printf( "%s : %d\n", | 44 | printf( "%s : %d\n", |
51 | MI->text(0).latin1(), | 45 | MI->text(0).latin1(), |
52 | MI->isOn() ); | 46 | MI->isOn() ); |
53 | } | 47 | } |
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 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 | 3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 |
4 | HEADERS = bluetooth_NN.h \ | 4 | HEADERS = bluetoothBNEP_NN.h \ |
5 | bluetoothBNEP_NNI.h \ | 5 | bluetoothBNEP_NNI.h \ |
6 | bluetoothRFCOMM_NN.h \ | ||
6 | bluetoothRFCOMM_NNI.h \ | 7 | bluetoothRFCOMM_NNI.h \ |
7 | bluetoothBNEPedit.h \ | 8 | bluetoothBNEPedit.h \ |
9 | bluetoothRFCOMMrun.h \ | ||
8 | bluetoothRFCOMMedit.h | 10 | bluetoothRFCOMMedit.h |
9 | SOURCES = bluetooth_NN.cpp \ | 11 | SOURCES = bluetoothBNEP_NN.cpp \ |
10 | bluetoothBNEP_NNI.cpp \ | 12 | bluetoothBNEP_NNI.cpp \ |
13 | bluetoothRFCOMM_NN.cpp \ | ||
11 | bluetoothRFCOMM_NNI.cpp \ | 14 | bluetoothRFCOMM_NNI.cpp \ |
12 | bluetoothBNEPedit.cpp \ | 15 | bluetoothBNEPedit.cpp \ |
13 | bluetoothBNEPrun.cpp \ | 16 | bluetoothBNEPrun.cpp \ |
17 | bluetoothRFCOMMrun.cpp \ | ||
14 | bluetoothRFCOMMedit.cpp | 18 | bluetoothRFCOMMedit.cpp |
15 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 | 19 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2 |
16 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 | 20 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2 |
17 | LIBS += -lqpe | 21 | LIBS += -lqpe -lopietooth2 |
18 | INTERFACES= bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui | 22 | INTERFACES= bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui |
19 | TARGET = bluetooth | 23 | TARGET = bluetooth |
20 | VERSION = 1.0.0 | 24 | VERSION = 1.0.0 |
21 | 25 | ||
22 | include( $(OPIEDIR)/include.pro ) | 26 | 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,42 +1,42 @@ | |||
1 | #include "bluetoothBNEPedit.h" | 1 | #include "bluetoothBNEPedit.h" |
2 | #include "bluetoothBNEP_NNI.h" | 2 | #include "bluetoothBNEP_NNI.h" |
3 | #include "bluetooth_NN.h" | 3 | #include "bluetoothBNEP_NN.h" |
4 | 4 | ||
5 | ABluetoothBNEP::ABluetoothBNEP( BluetoothBNEPNetNode * PNN ) : | 5 | ABluetoothBNEP::ABluetoothBNEP( BluetoothBNEPNetNode * PNN ) : |
6 | ANetNodeInstance( PNN ), Data() { | 6 | ANetNodeInstance( PNN ), Data() { |
7 | GUI = 0; | 7 | GUI = 0; |
8 | RT = 0; | 8 | RT = 0; |
9 | Data.AllowAll = 1; | 9 | Data.AllowAll = 1; |
10 | } | 10 | } |
11 | 11 | ||
12 | void ABluetoothBNEP::setSpecificAttribute( QString & S, QString & A ) { | 12 | void ABluetoothBNEP::setSpecificAttribute( QString & S, QString & A ) { |
13 | if( S == "bdaddress" ) { | 13 | if( S == "bdaddress" ) { |
14 | Data.BDAddress << A; | 14 | Data.BDAddress << A; |
15 | } else if ( S == "allowall" ) { | 15 | } else if ( S == "allowall" ) { |
16 | Data.AllowAll = 1; | 16 | Data.AllowAll = 1; |
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
20 | void ABluetoothBNEP::saveSpecificAttribute( QTextStream & TS ) { | 20 | void ABluetoothBNEP::saveSpecificAttribute( QTextStream & TS ) { |
21 | TS << "allowall=" << Data.AllowAll << endl; | 21 | TS << "allowall=" << Data.AllowAll << endl; |
22 | for ( QStringList::Iterator it = Data.BDAddress.begin(); | 22 | for ( QStringList::Iterator it = Data.BDAddress.begin(); |
23 | it != Data.BDAddress.end(); | 23 | it != Data.BDAddress.end(); |
24 | ++it ) { | 24 | ++it ) { |
25 | TS << "bdaddress=" << (*it) << endl; | 25 | TS << "bdaddress=" << (*it) << endl; |
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | QWidget * ABluetoothBNEP::edit( QWidget * parent ) { | 29 | QWidget * ABluetoothBNEP::edit( QWidget * parent ) { |
30 | GUI = new BluetoothBNEPEdit( parent ); | 30 | GUI = new BluetoothBNEPEdit( parent ); |
31 | GUI->showData( Data ); | 31 | GUI->showData( Data ); |
32 | return GUI; | 32 | return GUI; |
33 | } | 33 | } |
34 | 34 | ||
35 | QString ABluetoothBNEP::acceptable( void ) { | 35 | QString ABluetoothBNEP::acceptable( void ) { |
36 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 36 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
37 | } | 37 | } |
38 | 38 | ||
39 | void ABluetoothBNEP::commit( void ) { | 39 | void ABluetoothBNEP::commit( void ) { |
40 | if( GUI && GUI->commit( Data ) ) | 40 | if( GUI && GUI->commit( Data ) ) |
41 | setModified( 1 ); | 41 | setModified( 1 ); |
42 | } | 42 | } |
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 @@ | |||
1 | #ifndef BLUETOOTHBNEP_DATA_H | 1 | #ifndef BLUETOOTHBNEP_DATA_H |
2 | #define BLUETOOTHBNEP_DATA_H | 2 | #define BLUETOOTHBNEP_DATA_H |
3 | 3 | ||
4 | #include <qstringlist.h> | 4 | #include <qstringlist.h> |
5 | 5 | ||
6 | typedef struct BluetoothBNEPData { | 6 | class BluetoothBNEPData { |
7 | |||
8 | public : | ||
9 | |||
7 | bool AllowAll; | 10 | bool AllowAll; |
8 | QStringList BDAddress; | 11 | QStringList BDAddress; |
9 | } BluetoothBNEPData_t; | 12 | }; |
10 | 13 | ||
11 | #endif | 14 | #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 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qfileinfo.h> | 2 | #include <qfileinfo.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <resources.h> | 4 | #include <resources.h> |
5 | #include "bluetoothBNEPrun.h" | 5 | #include "bluetoothBNEPrun.h" |
6 | 6 | ||
7 | QDict<QString> * BluetoothBNEPRun::PANConnections = 0; | 7 | BluetoothBNEPRun::BluetoothBNEPRun( ANetNodeInstance * NNI, |
8 | BluetoothBNEPData & D ) : | ||
9 | RuntimeInfo( NNI ), | ||
10 | Data( D), | ||
11 | Pat( "bnep[0-6]" ) { | ||
12 | OT = 0; | ||
13 | } | ||
8 | 14 | ||
9 | void BluetoothBNEPRun::detectState( NodeCollection * NC ) { | 15 | BluetoothBNEPRun::~BluetoothBNEPRun( void ) { |
10 | // unavailable : no card found | 16 | if( OT ) { |
11 | // available : card found and assigned to us or free | 17 | OTGateway::releaseOTGateway(); |
12 | // up : card found and assigned to us and up | 18 | } |
13 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 19 | } |
14 | System & Sys = NSResources->system(); | ||
15 | InterfaceInfo * Run; | ||
16 | QFile F( S ); | ||
17 | |||
18 | Log(("Detecting for %s\n", NC->name().latin1() )); | ||
19 | |||
20 | if( F.open( IO_ReadOnly ) ) { | ||
21 | // could open file -> read interface and assign | ||
22 | QString X; | ||
23 | bool accepted = 0; | ||
24 | QTextStream TS(&F); | ||
25 | X = TS.readLine(); | ||
26 | Log(("%s exists : %s\n", S.latin1(), X.latin1() )); | ||
27 | // find interface | ||
28 | if( handlesInterface( X ) ) { | ||
29 | |||
30 | Log(("Handles interface %s, PANC %p\n", X.latin1(), PANConnections )); | ||
31 | if( PANConnections == 0 ) { | ||
32 | // load connections that are active | ||
33 | // format : bnep0 00:60:57:02:71:A2 PANU | ||
34 | FILE * OutputOfCmd = popen( "pand --show", "r" ) ; | ||
35 | |||
36 | PANConnections = new QDict<QString>; | ||
37 | |||
38 | if( OutputOfCmd ) { | ||
39 | char ch; | ||
40 | // could fork | ||
41 | // read all data | ||
42 | QString Line = ""; | ||
43 | while( 1 ) { | ||
44 | if( fread( &ch, 1, 1, OutputOfCmd ) < 1 ) { | ||
45 | // eof | ||
46 | break; | ||
47 | } | ||
48 | if( ch == '\n' || ch == '\r' ) { | ||
49 | if( ! Line.isEmpty() ) { | ||
50 | if( Line.startsWith( "bnep" ) ) { | ||
51 | QStringList SL = QStringList::split( " ", Line ); | ||
52 | Log(("Detected PAN %s %s\n", | ||
53 | SL[0].latin1(), SL[1].latin1() )); | ||
54 | PANConnections->insert( SL[0], new QString(SL[1])); | ||
55 | } | ||
56 | Line=""; | ||
57 | } | ||
58 | } else { | ||
59 | Line += ch; | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | 20 | ||
64 | pclose( OutputOfCmd ); | 21 | State_t BluetoothBNEPRun::detectState( void ) { |
65 | } | ||
66 | 22 | ||
67 | // check if this runtime allows connection to node | 23 | /* |
68 | if( ! Data.AllowAll ) { | ||
69 | // has addresses | ||
70 | for ( QStringList::Iterator it = Data.BDAddress.begin(); | ||
71 | ! accepted && it != Data.BDAddress.end(); | ||
72 | ++ it ) { | ||
73 | for( QDictIterator<QString> it2( *(PANConnections) ); | ||
74 | it2.current(); | ||
75 | ++ it2 ) { | ||
76 | if( X == it2.currentKey() && | ||
77 | (*it) == *(it2.current()) | ||
78 | ) { | ||
79 | // found | ||
80 | Log(("%s accepts connections to %s\n", | ||
81 | NC->name().latin1(), | ||
82 | it2.current()->latin1() )); | ||
83 | accepted = 1; | ||
84 | break; | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | } else { | ||
89 | Log(("%s accepts any connection\n", NC->name().latin1() )); | ||
90 | // accept any | ||
91 | accepted = 1; | ||
92 | } | ||
93 | 24 | ||
94 | if( accepted ) { | 25 | need to detect |
95 | // matches and is allowed for this node | 26 | |
96 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 27 | 1. for any PAN connection that is found if that |
97 | It.current(); | 28 | PAN is connected. |
98 | ++It ) { | 29 | |
99 | Run = It.current(); | 30 | if it is connected it is not available (since we do |
100 | if( X == Run->Name ) { | 31 | not manage IP settings and we are called to detect |
101 | Log(("%s Assigned %p\n", NC->name().latin1(), Run )); | 32 | the state we knwo that we do not have an UP connection) |
102 | Run->assignNode( netNode() ); | 33 | |
103 | assignInterface( Run ); | 34 | 2. if it not connected and we allow any connection we |
104 | NC->setCurrentState( IsUp ); | 35 | are available or if that PAN connection is to a device |
105 | return; | 36 | with a correct address |
106 | } | 37 | |
107 | } | 38 | 3. if it is not connected and the address do not match or |
108 | } | 39 | we do not accept any address, we are Unavailable but |
109 | } | 40 | not DOWN. I.e a new connection could perhaps be created |
110 | } | 41 | |
111 | 42 | */ | |
112 | Log(("Assigned %p\n", assignedInterface() )); | 43 | |
113 | if( ( Run = assignedInterface() ) ) { | 44 | if( ! OT ) { |
114 | // we already have an interface assigned -> still present ? | 45 | OT = OTGateway::getOTGateway(); |
115 | if( ! Run->IsUp ) { | ||
116 | // usb is still free -> keep assignment | ||
117 | NC->setCurrentState( Available ); | ||
118 | return; | ||
119 | } // else interface is up but NOT us -> some other profile | ||
120 | } | 46 | } |
121 | 47 | ||
122 | // nothing (valid) assigned to us | 48 | if( ! OT->isEnabled() ) { |
123 | assignInterface( 0 ); | 49 | return Unavailable; |
124 | |||
125 | // find possible interface | ||
126 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | ||
127 | It.current(); | ||
128 | ++It ) { | ||
129 | Run = It.current(); | ||
130 | |||
131 | Log(("%s %d %d=%d %d\n", | ||
132 | Run->Name.latin1(), | ||
133 | handlesInterface( Run->Name ), | ||
134 | Run->CardType, ARPHRD_ETHER, | ||
135 | ! Run->IsUp )); | ||
136 | |||
137 | if( handlesInterface( Run->Name ) && | ||
138 | Run->CardType == ARPHRD_ETHER && | ||
139 | ! Run->IsUp | ||
140 | ) { | ||
141 | Log(("Released(OFF)\n" )); | ||
142 | // proper type, and Not UP -> free | ||
143 | NC->setCurrentState( Off ); | ||
144 | return; | ||
145 | } | ||
146 | } | 50 | } |
147 | // no free found | ||
148 | Log(("None available\n" )); | ||
149 | 51 | ||
150 | NC->setCurrentState( Unavailable ); | 52 | // if there is a PAN connection that is UP but not |
53 | // yet configured (no ifup) the we are available | ||
54 | return ( hasFreePANConnection() ) ? Available : Unknown; | ||
151 | } | 55 | } |
152 | 56 | ||
153 | bool BluetoothBNEPRun::setState( NodeCollection * NC, Action_t A, bool ) { | 57 | QString BluetoothBNEPRun::setMyState( NodeCollection * NC, Action_t A, bool ) { |
154 | 58 | ||
155 | // we only handle activate and deactivate | 59 | if( A == Activate ) { |
156 | switch( A ) { | 60 | if( hasFreePANConnection( 1 ) ) { |
157 | case Activate : | 61 | // we have now an assignedinterface |
158 | { | 62 | } else { |
159 | if( NC->currentState() != Off ) { | 63 | return QString("TODO : Start PAND"); |
160 | return 0; | 64 | } |
161 | } | 65 | |
162 | InterfaceInfo * N = getInterface(); | 66 | Log(( "Assigned interface" )); |
163 | if( ! N ) { | 67 | NC->setCurrentState( Available ); |
164 | // no interface available | 68 | |
165 | NC->setCurrentState( Unavailable ); | 69 | return QString(); |
166 | return 0; | ||
167 | } | ||
168 | // because we were OFF the interface | ||
169 | // we get back is NOT assigned | ||
170 | N->assignNode( netNode() ); | ||
171 | assignInterface( N ); | ||
172 | Log(("Assing %p\n", N )); | ||
173 | NC->setCurrentState( Available ); | ||
174 | return 1; | ||
175 | } | ||
176 | case Deactivate : | ||
177 | if( NC->currentState() == IsUp ) { | ||
178 | // bring down first | ||
179 | if( ! connection()->setState( Down ) ) | ||
180 | // could not ... | ||
181 | return 0; | ||
182 | } else if( NC->currentState() != Available ) { | ||
183 | return 1; | ||
184 | } | ||
185 | assignedInterface()->assignNode( 0 ); // release | ||
186 | assignInterface( 0 ); | ||
187 | NC->setCurrentState( Off ); | ||
188 | return 1; | ||
189 | default : | ||
190 | // FT | ||
191 | break; | ||
192 | } | 70 | } |
193 | return 0; | 71 | |
72 | if( A == Deactivate ) { | ||
73 | // nothing to do | ||
74 | NC->setCurrentState( Off ); | ||
75 | return QString(); | ||
76 | } | ||
77 | return QString(); | ||
194 | } | 78 | } |
195 | 79 | ||
196 | bool BluetoothBNEPRun::canSetState( State_t Curr , Action_t A ) { | 80 | bool BluetoothBNEPRun::handlesInterface( const QString & S ) { |
197 | // we only handle up down activate and deactivate | 81 | return Pat.match( S ) >= 0; |
198 | switch( A ) { | 82 | } |
199 | case Activate : | 83 | |
200 | { // at least available | 84 | bool BluetoothBNEPRun::handlesInterface( InterfaceInfo * I ) { |
201 | if( Curr == Available ) { | 85 | return handlesInterface( I->Name ); |
202 | return 1; | 86 | } |
203 | } | 87 | |
204 | // or we can make one available | 88 | bool BluetoothBNEPRun::hasFreePANConnection( bool Grab ) { |
205 | InterfaceInfo * N = getInterface(); | 89 | |
206 | if( ! N || N->assignedNode() != 0 ) { | 90 | if( ! OT ) { |
207 | // non available or assigned | 91 | OT = OTGateway::getOTGateway(); |
208 | return 0; | 92 | } |
93 | |||
94 | // load PAN connections | ||
95 | OTPANConnection * C; | ||
96 | InterfaceInfo * Run; | ||
97 | InterfaceInfo * Candidate = 0; // reuse this interface | ||
98 | PANConnectionVector Conns = OT->getPANConnections(); | ||
99 | System & Sys = NSResources->system(); | ||
100 | bool IsValid; | ||
101 | |||
102 | for( unsigned int i = 0; | ||
103 | i < Conns.count(); | ||
104 | i ++ ) { | ||
105 | C = Conns[i]; | ||
106 | |||
107 | if( Data.AllowAll ) { | ||
108 | // we allow all | ||
109 | IsValid = 1; | ||
110 | } else { | ||
111 | // is this PAN connection connecting to a Peer | ||
112 | // we allow ? | ||
113 | IsValid = 0; | ||
114 | for ( QStringList::Iterator it = Data.BDAddress.begin(); | ||
115 | it != Data.BDAddress.end(); | ||
116 | ++ it ) { | ||
117 | if( C->ConnectedTo == (*it) ) { | ||
118 | // this is a connection we could accept | ||
119 | IsValid = 1; | ||
120 | break; | ||
209 | } | 121 | } |
210 | return 1; | ||
211 | } | 122 | } |
212 | case Deactivate : | 123 | } |
213 | return ( Curr >= Available ); | 124 | |
214 | default : | 125 | if( ! IsValid ) { |
215 | // FT | 126 | Log(("%s to %s not acceptable\n", |
216 | break; | 127 | C->Device.latin1(), |
128 | C->ConnectedTo.latin1() )); | ||
129 | // don't bother checking this address | ||
130 | // it is not acceptable | ||
131 | continue; | ||
132 | } | ||
133 | |||
134 | // is this PAN connection available to us ? | ||
135 | Run = Sys.findInterface( C->Device ); | ||
136 | |||
137 | if( Run && Run->IsUp ) { | ||
138 | // this PAN connection is up | ||
139 | Log(("%s acceptable but unavailable\n", | ||
140 | C->Device.latin1() )); | ||
141 | // find others | ||
142 | continue; | ||
143 | } | ||
144 | |||
145 | // we at least have a possible interface | ||
146 | if( ! Candidate ) { | ||
147 | Candidate = Run; | ||
148 | } | ||
217 | } | 149 | } |
218 | return 0; | ||
219 | } | ||
220 | 150 | ||
221 | // get interface that is free or assigned to us | 151 | if( Candidate ) { |
222 | InterfaceInfo * BluetoothBNEPRun::getInterface( void ) { | 152 | if ( Grab ) { |
223 | 153 | netNode()->connection()->assignInterface( Candidate ); | |
224 | System & S = NSResources->system(); | ||
225 | InterfaceInfo * best = 0, * Run; | ||
226 | |||
227 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
228 | It.current(); | ||
229 | ++It ) { | ||
230 | Run = It.current(); | ||
231 | if( handlesInterface( Run->Name ) && | ||
232 | Run->CardType == ARPHRD_ETHER | ||
233 | ) { | ||
234 | // this is a bluetooth card | ||
235 | if( Run->assignedNode() == netNode() ) { | ||
236 | // assigned to us | ||
237 | return Run; | ||
238 | } else if( Run->assignedNode() == 0 ) { | ||
239 | // free | ||
240 | best = Run; | ||
241 | } | ||
242 | } | 154 | } |
155 | return 1; | ||
243 | } | 156 | } |
244 | return best; // can be 0 | ||
245 | } | ||
246 | 157 | ||
247 | bool BluetoothBNEPRun::handlesInterface( const QString & S ) { | 158 | // no free PAN |
248 | return Pat.match( S ) >= 0; | 159 | return 0; |
249 | } | 160 | } |
161 | |||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h index ce03cbb..a05a7a2 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h | |||
@@ -1,34 +1,35 @@ | |||
1 | #include <asdevice.h> | 1 | #include <netnode.h> |
2 | #include "bluetoothBNEPdata.h" | 2 | #include "bluetoothBNEPdata.h" |
3 | 3 | ||
4 | class BluetoothBNEPRun : public AsDevice { | 4 | #include <OTGateway.h> |
5 | using namespace Opietooth2; | ||
6 | |||
7 | class BluetoothBNEPRun : public RuntimeInfo { | ||
5 | 8 | ||
6 | public : | 9 | public : |
7 | 10 | ||
8 | BluetoothBNEPRun( ANetNodeInstance * NNI, | 11 | BluetoothBNEPRun( ANetNodeInstance * NNI, |
9 | BluetoothBNEPData & D ) : | 12 | BluetoothBNEPData & D ); |
10 | AsDevice( NNI ), | 13 | virtual ~BluetoothBNEPRun( void ); |
11 | Data( D), | 14 | |
12 | Pat( "bnep[0-6]" ) | 15 | // i am a device |
13 | { } | 16 | virtual RuntimeInfo * device( void ) |
17 | { return this; } | ||
14 | 18 | ||
15 | virtual AsDevice * asDevice( void ) | 19 | bool handlesInterface( const QString & ); |
16 | { return (AsDevice *)this; } | 20 | bool handlesInterface( InterfaceInfo * ); |
17 | 21 | ||
18 | virtual AsDevice * device( void ) | 22 | State_t detectState( void ); |
19 | { return asDevice(); } | ||
20 | 23 | ||
21 | protected : | 24 | protected : |
22 | 25 | ||
23 | void detectState( NodeCollection * ); | 26 | QString setMyState( NodeCollection * , Action_t, bool ); |
24 | bool setState( NodeCollection * , Action_t, bool ); | ||
25 | bool canSetState( State_t , Action_t ); | ||
26 | bool handlesInterface( const QString & ); | ||
27 | 27 | ||
28 | private : | 28 | private : |
29 | 29 | ||
30 | InterfaceInfo * getInterface( void ); | 30 | bool hasFreePANConnection( bool Grab = 0 ); |
31 | |||
31 | BluetoothBNEPData & Data; | 32 | BluetoothBNEPData & Data; |
32 | static QDict<QString> * PANConnections; | 33 | OTGateway * OT; |
33 | QRegExp Pat; | 34 | QRegExp Pat; |
34 | }; | 35 | }; |
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 | |||
@@ -1,131 +1,331 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>BluetoothRFCOMMGUI</class> | 2 | <class>BluetoothRFCOMMGUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>BluetoothRFCOMM_FRM</cstring> | 7 | <cstring>BluetoothRFCOMM_FRM</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>283</width> | 14 | <width>488</width> |
15 | <height>199</height> | 15 | <height>604</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Bluetooth-rfcomm</string> | 20 | <string>Bluetooth-rfcomm</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>0</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>3</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QLabel</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>TextLabel5_2</cstring> | ||
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>text</name> | ||
45 | <string>Selected devices with gprs capability</string> | ||
46 | </property> | ||
47 | <property stdset="1"> | ||
48 | <name>alignment</name> | ||
49 | <set>WordBreak|AlignVCenter|AlignLeft</set> | ||
50 | </property> | ||
51 | <property> | ||
52 | <name>wordwrap</name> | ||
53 | </property> | ||
54 | </widget> | ||
55 | <widget> | ||
38 | <class>QLayoutWidget</class> | 56 | <class>QLayoutWidget</class> |
39 | <property stdset="1"> | 57 | <property stdset="1"> |
40 | <name>name</name> | 58 | <name>name</name> |
41 | <cstring>Layout4</cstring> | 59 | <cstring>Layout8</cstring> |
60 | </property> | ||
61 | <property> | ||
62 | <name>layoutSpacing</name> | ||
42 | </property> | 63 | </property> |
43 | <hbox> | 64 | <hbox> |
44 | <property stdset="1"> | 65 | <property stdset="1"> |
45 | <name>margin</name> | 66 | <name>margin</name> |
46 | <number>0</number> | 67 | <number>0</number> |
47 | </property> | 68 | </property> |
48 | <property stdset="1"> | 69 | <property stdset="1"> |
49 | <name>spacing</name> | 70 | <name>spacing</name> |
50 | <number>6</number> | 71 | <number>3</number> |
51 | </property> | 72 | </property> |
52 | <widget> | 73 | <widget> |
53 | <class>QLabel</class> | 74 | <class>QLabel</class> |
54 | <property stdset="1"> | 75 | <property stdset="1"> |
55 | <name>name</name> | 76 | <name>name</name> |
56 | <cstring>TextLabel4</cstring> | 77 | <cstring>TextLabel5</cstring> |
57 | </property> | 78 | </property> |
58 | <property stdset="1"> | 79 | <property stdset="1"> |
59 | <name>text</name> | 80 | <name>text</name> |
60 | <string>Name</string> | 81 | <string>Address</string> |
61 | </property> | 82 | </property> |
62 | </widget> | 83 | </widget> |
63 | <widget> | 84 | <widget> |
64 | <class>QLineEdit</class> | 85 | <class>QLineEdit</class> |
65 | <property stdset="1"> | 86 | <property stdset="1"> |
66 | <name>name</name> | 87 | <name>name</name> |
67 | <cstring>Name_LE</cstring> | 88 | <cstring>Address_LE</cstring> |
89 | </property> | ||
90 | </widget> | ||
91 | <widget> | ||
92 | <class>QToolButton</class> | ||
93 | <property stdset="1"> | ||
94 | <name>name</name> | ||
95 | <cstring>FindDevice_TB</cstring> | ||
96 | </property> | ||
97 | <property stdset="1"> | ||
98 | <name>text</name> | ||
99 | <string>...</string> | ||
68 | </property> | 100 | </property> |
69 | </widget> | 101 | </widget> |
70 | </hbox> | 102 | </hbox> |
71 | </widget> | 103 | </widget> |
72 | <widget> | 104 | <widget> |
73 | <class>QLabel</class> | 105 | <class>QLayoutWidget</class> |
74 | <property stdset="1"> | 106 | <property stdset="1"> |
75 | <name>name</name> | 107 | <name>name</name> |
76 | <cstring>TextLabel3</cstring> | 108 | <cstring>Layout7</cstring> |
77 | </property> | 109 | </property> |
78 | <property stdset="1"> | 110 | <property> |
79 | <name>text</name> | 111 | <name>layoutSpacing</name> |
80 | <string>Description</string> | ||
81 | </property> | ||
82 | </widget> | ||
83 | <widget> | ||
84 | <class>QMultiLineEdit</class> | ||
85 | <property stdset="1"> | ||
86 | <name>name</name> | ||
87 | <cstring>Description_LE</cstring> | ||
88 | </property> | 112 | </property> |
113 | <hbox> | ||
114 | <property stdset="1"> | ||
115 | <name>margin</name> | ||
116 | <number>0</number> | ||
117 | </property> | ||
118 | <property stdset="1"> | ||
119 | <name>spacing</name> | ||
120 | <number>3</number> | ||
121 | </property> | ||
122 | <widget> | ||
123 | <class>QLabel</class> | ||
124 | <property stdset="1"> | ||
125 | <name>name</name> | ||
126 | <cstring>TextLabel2</cstring> | ||
127 | </property> | ||
128 | <property stdset="1"> | ||
129 | <name>text</name> | ||
130 | <string>Channel</string> | ||
131 | </property> | ||
132 | </widget> | ||
133 | <widget> | ||
134 | <class>QSpinBox</class> | ||
135 | <property stdset="1"> | ||
136 | <name>name</name> | ||
137 | <cstring>Channel_SB</cstring> | ||
138 | </property> | ||
139 | <property stdset="1"> | ||
140 | <name>sizePolicy</name> | ||
141 | <sizepolicy> | ||
142 | <hsizetype>0</hsizetype> | ||
143 | <vsizetype>0</vsizetype> | ||
144 | </sizepolicy> | ||
145 | </property> | ||
146 | <property stdset="1"> | ||
147 | <name>minValue</name> | ||
148 | <number>1</number> | ||
149 | </property> | ||
150 | </widget> | ||
151 | <widget> | ||
152 | <class>QLabel</class> | ||
153 | <property stdset="1"> | ||
154 | <name>name</name> | ||
155 | <cstring>TextLabel2_2</cstring> | ||
156 | </property> | ||
157 | <property stdset="1"> | ||
158 | <name>text</name> | ||
159 | <string>Name</string> | ||
160 | </property> | ||
161 | </widget> | ||
162 | <widget> | ||
163 | <class>QLabel</class> | ||
164 | <property stdset="1"> | ||
165 | <name>name</name> | ||
166 | <cstring>Name_LBL</cstring> | ||
167 | </property> | ||
168 | <property stdset="1"> | ||
169 | <name>sizePolicy</name> | ||
170 | <sizepolicy> | ||
171 | <hsizetype>7</hsizetype> | ||
172 | <vsizetype>1</vsizetype> | ||
173 | </sizepolicy> | ||
174 | </property> | ||
175 | <property stdset="1"> | ||
176 | <name>frameShape</name> | ||
177 | <enum>Box</enum> | ||
178 | </property> | ||
179 | <property stdset="1"> | ||
180 | <name>indent</name> | ||
181 | <number>0</number> | ||
182 | </property> | ||
183 | </widget> | ||
184 | </hbox> | ||
89 | </widget> | 185 | </widget> |
90 | <widget> | 186 | <widget> |
91 | <class>QLayoutWidget</class> | 187 | <class>QLayoutWidget</class> |
92 | <property stdset="1"> | 188 | <property stdset="1"> |
93 | <name>name</name> | 189 | <name>name</name> |
94 | <cstring>Layout5</cstring> | 190 | <cstring>Layout5</cstring> |
95 | </property> | 191 | </property> |
192 | <property> | ||
193 | <name>layoutSpacing</name> | ||
194 | </property> | ||
96 | <hbox> | 195 | <hbox> |
97 | <property stdset="1"> | 196 | <property stdset="1"> |
98 | <name>margin</name> | 197 | <name>margin</name> |
99 | <number>0</number> | 198 | <number>0</number> |
100 | </property> | 199 | </property> |
101 | <property stdset="1"> | 200 | <property stdset="1"> |
102 | <name>spacing</name> | 201 | <name>spacing</name> |
103 | <number>6</number> | 202 | <number>3</number> |
104 | </property> | 203 | </property> |
105 | <widget> | 204 | <widget> |
106 | <class>QCheckBox</class> | 205 | <class>QLabel</class> |
107 | <property stdset="1"> | 206 | <property stdset="1"> |
108 | <name>name</name> | 207 | <name>name</name> |
109 | <cstring>Automatic_CB</cstring> | 208 | <cstring>TextLabel7</cstring> |
209 | </property> | ||
210 | <property stdset="1"> | ||
211 | <name>sizePolicy</name> | ||
212 | <sizepolicy> | ||
213 | <hsizetype>7</hsizetype> | ||
214 | <vsizetype>1</vsizetype> | ||
215 | </sizepolicy> | ||
110 | </property> | 216 | </property> |
111 | <property stdset="1"> | 217 | <property stdset="1"> |
112 | <name>text</name> | 218 | <name>text</name> |
113 | <string>Start automatically</string> | 219 | <string>Addresses</string> |
220 | </property> | ||
221 | <property stdset="1"> | ||
222 | <name>alignment</name> | ||
223 | <set>AlignVCenter|AlignLeft</set> | ||
224 | </property> | ||
225 | <property> | ||
226 | <name>vAlign</name> | ||
227 | </property> | ||
228 | </widget> | ||
229 | <widget> | ||
230 | <class>QToolButton</class> | ||
231 | <property stdset="1"> | ||
232 | <name>name</name> | ||
233 | <cstring>Add_TB</cstring> | ||
234 | </property> | ||
235 | <property stdset="1"> | ||
236 | <name>text</name> | ||
237 | <string>...</string> | ||
114 | </property> | 238 | </property> |
115 | </widget> | 239 | </widget> |
116 | <widget> | 240 | <widget> |
117 | <class>QCheckBox</class> | 241 | <class>QToolButton</class> |
118 | <property stdset="1"> | 242 | <property stdset="1"> |
119 | <name>name</name> | 243 | <name>name</name> |
120 | <cstring>Confirm_CB</cstring> | 244 | <cstring>Remove_TB</cstring> |
121 | </property> | 245 | </property> |
122 | <property stdset="1"> | 246 | <property stdset="1"> |
123 | <name>text</name> | 247 | <name>text</name> |
124 | <string>Confirm before start</string> | 248 | <string>...</string> |
125 | </property> | 249 | </property> |
126 | </widget> | 250 | </widget> |
127 | </hbox> | 251 | </hbox> |
128 | </widget> | 252 | </widget> |
253 | <widget> | ||
254 | <class>QListView</class> | ||
255 | <column> | ||
256 | <property> | ||
257 | <name>text</name> | ||
258 | <string>Name</string> | ||
259 | </property> | ||
260 | <property> | ||
261 | <name>clickable</name> | ||
262 | <bool>true</bool> | ||
263 | </property> | ||
264 | <property> | ||
265 | <name>resizeable</name> | ||
266 | <bool>true</bool> | ||
267 | </property> | ||
268 | </column> | ||
269 | <column> | ||
270 | <property> | ||
271 | <name>text</name> | ||
272 | <string>Channel</string> | ||
273 | </property> | ||
274 | <property> | ||
275 | <name>clickable</name> | ||
276 | <bool>true</bool> | ||
277 | </property> | ||
278 | <property> | ||
279 | <name>resizeable</name> | ||
280 | <bool>true</bool> | ||
281 | </property> | ||
282 | </column> | ||
283 | <column> | ||
284 | <property> | ||
285 | <name>text</name> | ||
286 | <string>Address</string> | ||
287 | </property> | ||
288 | <property> | ||
289 | <name>clickable</name> | ||
290 | <bool>true</bool> | ||
291 | </property> | ||
292 | <property> | ||
293 | <name>resizeable</name> | ||
294 | <bool>true</bool> | ||
295 | </property> | ||
296 | </column> | ||
297 | <property stdset="1"> | ||
298 | <name>name</name> | ||
299 | <cstring>Addresses_LV</cstring> | ||
300 | </property> | ||
301 | <property stdset="1"> | ||
302 | <name>allColumnsShowFocus</name> | ||
303 | <bool>true</bool> | ||
304 | </property> | ||
305 | </widget> | ||
129 | </vbox> | 306 | </vbox> |
130 | </widget> | 307 | </widget> |
308 | <connections> | ||
309 | <connection> | ||
310 | <sender>Add_TB</sender> | ||
311 | <signal>clicked()</signal> | ||
312 | <receiver>BluetoothRFCOMM_FRM</receiver> | ||
313 | <slot>SLOT_AddServer()</slot> | ||
314 | </connection> | ||
315 | <connection> | ||
316 | <sender>Remove_TB</sender> | ||
317 | <signal>clicked()</signal> | ||
318 | <receiver>BluetoothRFCOMM_FRM</receiver> | ||
319 | <slot>SLOT_RemoveServer()</slot> | ||
320 | </connection> | ||
321 | <connection> | ||
322 | <sender>FindDevice_TB</sender> | ||
323 | <signal>clicked()</signal> | ||
324 | <receiver>BluetoothRFCOMM_FRM</receiver> | ||
325 | <slot>SLOT_FindDevice()</slot> | ||
326 | </connection> | ||
327 | <slot access="public">SLOT_AddServer()</slot> | ||
328 | <slot access="public">SLOT_RemoveServer()</slot> | ||
329 | <slot access="public">SLOT_FindDevice()</slot> | ||
330 | </connections> | ||
131 | </UI> | 331 | </UI> |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp index 7ec8288..d19386e 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp | |||
@@ -1,30 +1,49 @@ | |||
1 | #include "bluetoothRFCOMMedit.h" | 1 | #include "bluetoothRFCOMMedit.h" |
2 | #include "bluetoothRFCOMM_NNI.h" | 2 | #include "bluetoothRFCOMM_NNI.h" |
3 | #include "bluetooth_NN.h" | 3 | #include "bluetoothRFCOMM_NN.h" |
4 | 4 | ||
5 | ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) : ANetNodeInstance( PNN ) { | 5 | ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) : |
6 | GUI = 0; | 6 | ANetNodeInstance( PNN ), Data() { |
7 | RT = 0; | 7 | Data.Devices.setAutoDelete( TRUE ); |
8 | GUI = 0; | ||
9 | RT = 0; | ||
8 | } | 10 | } |
9 | 11 | ||
10 | void ABluetoothRFCOMM::setSpecificAttribute( QString & , QString & ) { | 12 | void ABluetoothRFCOMM::setSpecificAttribute( QString & A, QString & V) { |
13 | |||
14 | if( A == "bdaddress" ) { | ||
15 | Data.Devices.resize( Data.Devices.size() + 1 ); | ||
16 | Data.Devices.insert( Data.Devices.size() - 1, new RFCOMMChannel); | ||
17 | Data.Devices[ Data.Devices.size() - 1 ]->BDAddress = V; | ||
18 | } else if ( A == "channel" ) { | ||
19 | Data.Devices[ Data.Devices.size() - 1 ]->Channel = V.toLong(); | ||
20 | } else if ( A == "name" ) { | ||
21 | Data.Devices[ Data.Devices.size() - 1 ]->Name = V; | ||
22 | } | ||
11 | } | 23 | } |
12 | 24 | ||
13 | void ABluetoothRFCOMM::saveSpecificAttribute( QTextStream & ) { | 25 | void ABluetoothRFCOMM::saveSpecificAttribute( QTextStream & TS ) { |
26 | for( unsigned int i = 0 ; | ||
27 | i < Data.Devices.count(); | ||
28 | i ++ ) { | ||
29 | TS << "bdaddress=" << Data.Devices[i]->BDAddress << endl; | ||
30 | TS << "name=" << quote( Data.Devices[i]->Name ) << endl; | ||
31 | TS << "channel=" << Data.Devices[i]->Channel << endl; | ||
32 | } | ||
14 | } | 33 | } |
15 | 34 | ||
16 | 35 | ||
17 | QWidget * ABluetoothRFCOMM::edit( QWidget * parent ) { | 36 | QWidget * ABluetoothRFCOMM::edit( QWidget * parent ) { |
18 | GUI = new BluetoothRFCOMMEdit( parent ); | 37 | GUI = new BluetoothRFCOMMEdit( parent ); |
19 | GUI->showData( Data ); | 38 | GUI->showData( Data ); |
20 | return GUI; | 39 | return GUI; |
21 | } | 40 | } |
22 | 41 | ||
23 | QString ABluetoothRFCOMM::acceptable( void ) { | 42 | QString ABluetoothRFCOMM::acceptable( void ) { |
24 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 43 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
25 | } | 44 | } |
26 | 45 | ||
27 | void ABluetoothRFCOMM::commit( void ) { | 46 | void ABluetoothRFCOMM::commit( void ) { |
28 | if( GUI->commit( Data ) ) | 47 | if( GUI->commit( Data ) ) |
29 | setModified( 1 ); | 48 | setModified( 1 ); |
30 | } | 49 | } |
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 @@ | |||
1 | #ifndef BLUETOOTHRFCOMM_DATA_H | 1 | #ifndef BLUETOOTHRFCOMM_DATA_H |
2 | #define BLUETOOTHRFCOMM_DATA_H | 2 | #define BLUETOOTHRFCOMM_DATA_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qvector.h> | ||
5 | 6 | ||
6 | typedef struct BluetoothRFCOMMData { | 7 | class RFCOMMChannel { |
7 | QString Device; | ||
8 | QString LockFile; | ||
9 | long Speed; | ||
10 | short Parity; | ||
11 | short DataBits; | ||
12 | short StopBits; | ||
13 | bool HardwareControl; | ||
14 | bool SoftwareControl; | ||
15 | 8 | ||
16 | } BluetoothRFCOMMData_t; | 9 | public : |
10 | QString BDAddress; | ||
11 | QString Name; | ||
12 | int Channel; | ||
13 | }; | ||
14 | |||
15 | class BluetoothRFCOMMData { | ||
16 | |||
17 | public : | ||
18 | |||
19 | QVector<RFCOMMChannel> Devices; | ||
20 | }; | ||
17 | 21 | ||
18 | #endif | 22 | #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 @@ | |||
1 | #include <qlistview.h> | ||
2 | #include <qdialog.h> | ||
3 | #include <qlabel.h> | ||
4 | #include <qlineedit.h> | ||
5 | #include <qtoolbutton.h> | ||
6 | #include <qcheckbox.h> | ||
7 | #include <qspinbox.h> | ||
8 | #include <OTPeer.h> | ||
9 | #include <OTGateway.h> | ||
10 | #include <Opietooth.h> | ||
11 | #include <resources.h> | ||
1 | #include <GUIUtils.h> | 12 | #include <GUIUtils.h> |
2 | #include "bluetoothRFCOMMedit.h" | 13 | #include "bluetoothRFCOMMedit.h" |
3 | 14 | ||
15 | using namespace Opietooth2; | ||
16 | |||
17 | class PeerLBI : public QListViewItem { | ||
18 | |||
19 | public : | ||
20 | |||
21 | PeerLBI( OTPeer * P, int Ch, QListView * LV ) : QListViewItem( LV ) { | ||
22 | Peer = P; | ||
23 | Channel = Ch; | ||
24 | |||
25 | setText( 0, (P->name().isEmpty()) ? | ||
26 | P->address().toString() : | ||
27 | P->name() ); | ||
28 | QString S; | ||
29 | S.setNum( Ch ); | ||
30 | setText( 1, S ); | ||
31 | setText( 2, P->address().toString() ); | ||
32 | } | ||
33 | ~PeerLBI( ) { | ||
34 | } | ||
35 | |||
36 | inline int channel( void ) const | ||
37 | { return Channel; } | ||
38 | inline OTPeer * peer( void ) const | ||
39 | { return Peer; } | ||
40 | |||
41 | int Channel; | ||
42 | OTPeer * Peer; | ||
43 | }; | ||
44 | |||
4 | BluetoothRFCOMMEdit::BluetoothRFCOMMEdit( QWidget * Parent ) : | 45 | BluetoothRFCOMMEdit::BluetoothRFCOMMEdit( QWidget * Parent ) : |
5 | BluetoothRFCOMMGUI( Parent ){ | 46 | BluetoothRFCOMMGUI( Parent ){ |
47 | Modified = 0; | ||
48 | OT = OTGateway::getOTGateway(); | ||
49 | |||
50 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); | ||
51 | Remove_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | ||
52 | FindDevice_TB->setPixmap( NSResources->getPixmap( "Devices/bluetooth" ) ); | ||
53 | Addresses_LV->setColumnAlignment( 1, Qt::AlignRight ); | ||
54 | } | ||
6 | 55 | ||
56 | BluetoothRFCOMMEdit::~BluetoothRFCOMMEdit( void ) { | ||
57 | OTGateway::releaseOTGateway(); | ||
7 | } | 58 | } |
8 | 59 | ||
9 | QString BluetoothRFCOMMEdit::acceptable( void ) { | 60 | QString BluetoothRFCOMMEdit::acceptable( void ) { |
10 | return QString(); | 61 | return QString(); |
62 | } | ||
63 | |||
64 | bool BluetoothRFCOMMEdit::commit( BluetoothRFCOMMData & Data ) { | ||
65 | int ct = 0; | ||
66 | PeerLBI * I; | ||
67 | |||
68 | if( Modified ) { | ||
69 | QListViewItem * it = Addresses_LV->firstChild(); | ||
70 | |||
71 | Data.Devices.resize( 0 ); | ||
72 | while( it ) { | ||
73 | |||
74 | ct ++; | ||
75 | Data.Devices.resize( ct ); | ||
76 | I = (PeerLBI * )it; | ||
77 | |||
78 | Data.Devices.insert( ct-1, new RFCOMMChannel ); | ||
79 | |||
80 | Data.Devices[ct-1]->BDAddress = I->peer()->address().toString(); | ||
81 | Data.Devices[ct-1]->Name = I->peer()->name(); | ||
82 | Data.Devices[ct-1]->Channel = I->channel(); | ||
83 | |||
84 | it = it->nextSibling(); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | return Modified; | ||
11 | } | 89 | } |
12 | 90 | ||
13 | void BluetoothRFCOMMEdit::showData( BluetoothRFCOMMData & Data ) { | 91 | void BluetoothRFCOMMEdit::showData( BluetoothRFCOMMData & Data ) { |
92 | |||
93 | OTPeer * P; | ||
94 | |||
95 | for( unsigned int i = 0; | ||
96 | i < Data.Devices.count(); | ||
97 | i ++ ) { | ||
98 | P = new OTPeer( OT ); | ||
99 | P->setAddress( OTDeviceAddress( Data.Devices[i]->BDAddress ) ); | ||
100 | P->setName( Data.Devices[i]->Name ); | ||
101 | |||
102 | new PeerLBI( P, Data.Devices[i]->Channel, Addresses_LV ); | ||
103 | } | ||
104 | Modified = 0; | ||
14 | } | 105 | } |
15 | 106 | ||
16 | bool BluetoothRFCOMMEdit::commit( BluetoothRFCOMMData & Data ) { | 107 | void BluetoothRFCOMMEdit::SLOT_AddServer( void ) { |
17 | return 0; | 108 | QListViewItem * it = Addresses_LV->firstChild(); |
109 | |||
110 | while( it ) { | ||
111 | // check address | ||
112 | if( it->text(2) == Address_LE->text() ) { | ||
113 | // already in table | ||
114 | return; | ||
115 | } | ||
116 | it = it->nextSibling(); | ||
117 | } | ||
118 | |||
119 | // new server | ||
120 | Modified = 1; | ||
121 | OTPeer * P = new OTPeer( OT ); | ||
122 | P->setAddress( OTDeviceAddress( Address_LE->text() ) ); | ||
123 | P->setName( Name_LBL->text() ); | ||
124 | new PeerLBI( P, Channel_SB->value(), Addresses_LV ); | ||
125 | |||
126 | Address_LE->setText(""); | ||
127 | Name_LBL->setText(""); | ||
128 | Channel_SB->setValue(1); | ||
129 | } | ||
130 | |||
131 | void BluetoothRFCOMMEdit::SLOT_RemoveServer( void ) { | ||
132 | |||
133 | QListViewItem * it = Addresses_LV->firstChild(); | ||
134 | |||
135 | while( it ) { | ||
136 | // check address | ||
137 | if( it->isSelected() ) { | ||
138 | delete it; | ||
139 | Modified = 1; | ||
140 | return; | ||
141 | } | ||
142 | it = it->nextSibling(); | ||
143 | } | ||
144 | } | ||
145 | |||
146 | void BluetoothRFCOMMEdit::SLOT_FindDevice( void ) { | ||
147 | OTPeer * Peer; | ||
148 | int Channel; | ||
149 | |||
150 | // find device in Opietooth | ||
151 | if( OTScan::getDevice( Peer, Channel, OT ) == QDialog::Accepted ) { | ||
152 | Address_LE->setText( Peer->address().toString() ); | ||
153 | Name_LBL->setText( Peer->name() ); | ||
154 | Channel_SB->setValue( Channel ); | ||
155 | } | ||
18 | } | 156 | } |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h index 14a6d64..9ad8f2a 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h | |||
@@ -1,13 +1,27 @@ | |||
1 | #include "bluetoothRFCOMMdata.h" | 1 | #include "bluetoothRFCOMMdata.h" |
2 | #include "bluetoothRFCOMMGUI.h" | 2 | #include "bluetoothRFCOMMGUI.h" |
3 | 3 | ||
4 | #include <Opietooth.h> | ||
5 | using namespace Opietooth2; | ||
6 | |||
4 | class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI { | 7 | class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI { |
5 | 8 | ||
6 | public : | 9 | public : |
7 | 10 | ||
8 | BluetoothRFCOMMEdit( QWidget * parent ); | 11 | BluetoothRFCOMMEdit( QWidget * parent ); |
12 | virtual ~BluetoothRFCOMMEdit( void ); | ||
9 | 13 | ||
10 | QString acceptable( void ); | 14 | QString acceptable( void ); |
11 | void showData( BluetoothRFCOMMData & Data ); | 15 | void showData( BluetoothRFCOMMData & Data ); |
12 | bool commit( BluetoothRFCOMMData & Data ); | 16 | bool commit( BluetoothRFCOMMData & Data ); |
17 | |||
18 | bool Modified; | ||
19 | OTGateway * OT; | ||
20 | |||
21 | public slots : | ||
22 | |||
23 | void SLOT_AddServer( void ); | ||
24 | void SLOT_RemoveServer( void ); | ||
25 | void SLOT_FindDevice( void ); | ||
26 | |||
13 | }; | 27 | }; |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h index 65fd686..24e3dae 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h | |||
@@ -1,28 +1,33 @@ | |||
1 | #include <asline.h> | 1 | #include <netnode.h> |
2 | #include "bluetoothRFCOMMdata.h" | 2 | #include "bluetoothRFCOMMdata.h" |
3 | 3 | ||
4 | class BluetoothRFCOMMRun : public AsLine { | 4 | #include <OTGateway.h> |
5 | using namespace Opietooth2; | ||
6 | |||
7 | class BluetoothRFCOMMRun : public RuntimeInfo { | ||
5 | 8 | ||
6 | public : | 9 | public : |
7 | 10 | ||
8 | BluetoothRFCOMMRun( ANetNodeInstance * NNI, | 11 | BluetoothRFCOMMRun( ANetNodeInstance * NNI, |
9 | BluetoothRFCOMMData & Data ) : AsLine( NNI ) | 12 | BluetoothRFCOMMData & D ) : RuntimeInfo( NNI ) |
10 | { } | 13 | { DeviceNr = -1; Data = &D; OT = 0; } |
14 | virtual ~BluetoothRFCOMMRun( void ); | ||
11 | 15 | ||
12 | virtual AsLine * asLine( void ) | 16 | virtual RuntimeInfo * line( void ) |
13 | { return (AsLine *)this; } | 17 | { return this; } |
18 | virtual QString deviceFile( void ); | ||
14 | 19 | ||
15 | virtual QString deviceFile( void ) | 20 | State_t detectState( void ); |
16 | { return QString( "/dev/rfcomm..." ); } | ||
17 | 21 | ||
18 | protected : | 22 | protected : |
19 | 23 | ||
20 | void detectState( NodeCollection * ) | 24 | QString setMyState( NodeCollection * , Action_t, bool ); |
21 | { } | ||
22 | 25 | ||
23 | bool setState( NodeCollection * , Action_t, bool ) | 26 | private : |
24 | { return 0; } | ||
25 | 27 | ||
26 | bool canSetState( State_t , Action_t ) | 28 | int deviceNrOfConnection( void ); |
27 | { return 0; } | 29 | RFCOMMChannel * getChannel( void ); |
30 | BluetoothRFCOMMData * Data; | ||
31 | Opietooth2::OTGateway * OT; | ||
32 | int DeviceNr; // cached from detection | ||
28 | }; | 33 | }; |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp index 443a627..9be6b16 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp | |||
@@ -1,115 +1,120 @@ | |||
1 | #include "bluetooth_NN.h" | 1 | #include "bluetooth_NN.h" |
2 | #include "bluetoothBNEP_NNI.h" | 2 | #include "bluetoothBNEP_NNI.h" |
3 | #include "bluetoothRFCOMM_NNI.h" | 3 | #include "bluetoothRFCOMM_NNI.h" |
4 | 4 | ||
5 | // | 5 | // |
6 | // | 6 | // |
7 | // BLUETOOTH PAN/NAP node | 7 | // BLUETOOTH PAN/NAP node |
8 | // | 8 | // |
9 | // | 9 | // |
10 | 10 | ||
11 | static const char * BluetoothBNEPNeeds[] = | 11 | static const char * BluetoothBNEPNeeds[] = |
12 | { 0 | 12 | { 0 |
13 | }; | 13 | }; |
14 | 14 | ||
15 | static const char * BluetoothBNEPProvides[] = | ||
16 | { "device", | ||
17 | 0 | ||
18 | }; | ||
19 | |||
15 | /** | 20 | /** |
16 | * Constructor, find all of the possible interfaces | 21 | * Constructor, find all of the possible interfaces |
17 | */ | 22 | */ |
18 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : | 23 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : |
19 | ANetNode(tr("Bluetooth PAN/NAP")) { | 24 | ANetNode(tr("Bluetooth PAN/NAP")) { |
20 | InstanceCount = 7; // default | 25 | InstanceCount = 7; // default |
21 | } | 26 | } |
22 | 27 | ||
23 | /** | 28 | /** |
24 | * Delete any interfaces that we own. | 29 | * Delete any interfaces that we own. |
25 | */ | 30 | */ |
26 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ | 31 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ |
27 | } | 32 | } |
28 | 33 | ||
29 | const QString BluetoothBNEPNetNode::nodeDescription(){ | 34 | const QString BluetoothBNEPNetNode::nodeDescription(){ |
30 | return tr("\ | 35 | return tr("\ |
31 | <p>Sets up a bluetooth link using the bluetooth Network profile.</p>\ | 36 | <p>Sets up a bluetooth link using the bluetooth Network profile.</p>\ |
32 | <p>Use this to connect two computing devices.</p>\ | 37 | <p>Use this to connect two computing devices.</p>\ |
33 | " | 38 | " |
34 | ); | 39 | ); |
35 | } | 40 | } |
36 | 41 | ||
37 | ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) { | 42 | ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) { |
38 | return new ABluetoothBNEP( this ); | 43 | return new ABluetoothBNEP( this ); |
39 | } | 44 | } |
40 | 45 | ||
41 | const char ** BluetoothBNEPNetNode::needs( void ) { | 46 | const char ** BluetoothBNEPNetNode::needs( void ) { |
42 | return BluetoothBNEPNeeds; | 47 | return BluetoothBNEPNeeds; |
43 | } | 48 | } |
44 | 49 | ||
45 | const char * BluetoothBNEPNetNode::provides( void ) { | 50 | const char ** BluetoothBNEPNetNode::provides( void ) { |
46 | return "device"; | 51 | return BluetoothBNEPProvides; |
47 | } | 52 | } |
48 | 53 | ||
49 | QString BluetoothBNEPNetNode::genNic( long nr ) { | 54 | QString BluetoothBNEPNetNode::genNic( long nr ) { |
50 | QString S; | 55 | QString S; |
51 | return S.sprintf( "bnep%ld", nr ); | 56 | return S.sprintf( "bnep%ld", nr ); |
52 | } | 57 | } |
53 | 58 | ||
54 | 59 | ||
55 | void BluetoothBNEPNetNode::setSpecificAttribute( QString & A, QString & V ) { | 60 | void BluetoothBNEPNetNode::setSpecificAttribute( QString & A, QString & V ) { |
56 | if( A == "interfacecount" ) { | 61 | if( A == "interfacecount" ) { |
57 | InstanceCount = V.toLong(); | 62 | InstanceCount = V.toLong(); |
58 | } | 63 | } |
59 | } | 64 | } |
60 | 65 | ||
61 | void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) { | 66 | void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) { |
62 | TS << "interfacecount=" | 67 | TS << "interfacecount=" |
63 | << InstanceCount | 68 | << InstanceCount |
64 | << endl; | 69 | << endl; |
65 | } | 70 | } |
66 | 71 | ||
67 | // | 72 | // |
68 | // | 73 | // |
69 | // BLUETOOTH RFCOMM | 74 | // BLUETOOTH RFCOMM |
70 | // | 75 | // |
71 | // | 76 | // |
72 | 77 | ||
73 | static const char * BluetoothRFCOMMNeeds[] = | 78 | static const char * BluetoothRFCOMMNeeds[] = |
74 | { 0 | 79 | { 0 |
75 | }; | 80 | }; |
76 | 81 | ||
77 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : | 82 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : |
78 | ANetNode( tr("Bluetooth serial link") ) { | 83 | ANetNode( tr("Bluetooth serial link") ) { |
79 | } | 84 | } |
80 | 85 | ||
81 | BluetoothRFCOMMNetNode::~BluetoothRFCOMMNetNode(){ | 86 | BluetoothRFCOMMNetNode::~BluetoothRFCOMMNetNode(){ |
82 | } | 87 | } |
83 | 88 | ||
84 | const QString BluetoothRFCOMMNetNode::nodeDescription(){ | 89 | const QString BluetoothRFCOMMNetNode::nodeDescription(){ |
85 | return tr("\ | 90 | return tr("\ |
86 | <p>Sets up a bluetooth link using the bluetooth serial profile.</p>\ | 91 | <p>Sets up a bluetooth link using the bluetooth serial profile.</p>\ |
87 | <p>Use this to connect to a GSM.</p>\ | 92 | <p>Use this to connect to a GSM.</p>\ |
88 | " | 93 | " |
89 | ); | 94 | ); |
90 | } | 95 | } |
91 | 96 | ||
92 | ANetNodeInstance * BluetoothRFCOMMNetNode::createInstance( void ) { | 97 | ANetNodeInstance * BluetoothRFCOMMNetNode::createInstance( void ) { |
93 | return new ABluetoothRFCOMM( this ); | 98 | return new ABluetoothRFCOMM( this ); |
94 | } | 99 | } |
95 | 100 | ||
96 | const char ** BluetoothRFCOMMNetNode::needs( void ) { | 101 | const char ** BluetoothRFCOMMNetNode::needs( void ) { |
97 | return BluetoothRFCOMMNeeds; | 102 | return BluetoothRFCOMMNeeds; |
98 | } | 103 | } |
99 | 104 | ||
100 | const char * BluetoothRFCOMMNetNode::provides( void ) { | 105 | const char * BluetoothRFCOMMNetNode::provides( void ) { |
101 | return "line"; | 106 | return "line"; |
102 | } | 107 | } |
103 | 108 | ||
104 | void BluetoothRFCOMMNetNode::setSpecificAttribute( QString &, QString & ) { | 109 | void BluetoothRFCOMMNetNode::setSpecificAttribute( QString &, QString & ) { |
105 | } | 110 | } |
106 | 111 | ||
107 | void BluetoothRFCOMMNetNode::saveSpecificAttribute( QTextStream & ) { | 112 | void BluetoothRFCOMMNetNode::saveSpecificAttribute( QTextStream & ) { |
108 | } | 113 | } |
109 | 114 | ||
110 | extern "C" { | 115 | extern "C" { |
111 | void create_plugin( QList<ANetNode> & PNN ) { | 116 | void create_plugin( QList<ANetNode> & PNN ) { |
112 | PNN.append( new BluetoothBNEPNetNode() ); | 117 | PNN.append( new BluetoothBNEPNetNode() ); |
113 | PNN.append( new BluetoothRFCOMMNetNode() ); | 118 | PNN.append( new BluetoothRFCOMMNetNode() ); |
114 | } | 119 | } |
115 | } | 120 | } |
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 | |||
@@ -1,66 +1,66 @@ | |||
1 | #ifndef BLUETOOTH_NETNODE_H | 1 | #ifndef BLUETOOTH_NETNODE_H |
2 | #define BLUETOOTH_NETNODE_H | 2 | #define BLUETOOTH_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ABluetoothBNEP; | 6 | class ABluetoothBNEP; |
7 | 7 | ||
8 | class BluetoothBNEPNetNode : public ANetNode { | 8 | class BluetoothBNEPNetNode : public ANetNode { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | BluetoothBNEPNetNode(); | 14 | BluetoothBNEPNetNode(); |
15 | virtual ~BluetoothBNEPNetNode(); | 15 | virtual ~BluetoothBNEPNetNode(); |
16 | 16 | ||
17 | virtual QString genNic( long ); | 17 | virtual QString genNic( long ); |
18 | virtual long instanceCount( void ) | 18 | virtual long instanceCount( void ) |
19 | { return InstanceCount; } | 19 | { return InstanceCount; } |
20 | virtual const QString pixmapName() | 20 | virtual const QString pixmapName() |
21 | { return "Devices/bluetooth"; } | 21 | { return "Devices/bluetooth"; } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | virtual ANetNodeInstance * createInstance( void ); | 24 | virtual ANetNodeInstance * createInstance( void ); |
25 | virtual const char * provides( void ); | 25 | virtual const char ** provides( void ); |
26 | virtual const char ** needs( void ); | 26 | virtual const char ** needs( void ); |
27 | 27 | ||
28 | private: | 28 | private: |
29 | 29 | ||
30 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 30 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
31 | virtual void saveSpecificAttribute( QTextStream & TS ); | 31 | virtual void saveSpecificAttribute( QTextStream & TS ); |
32 | 32 | ||
33 | // number of interfaces for this device | 33 | // number of interfaces for this device |
34 | long InstanceCount; | 34 | long InstanceCount; |
35 | 35 | ||
36 | }; | 36 | }; |
37 | 37 | ||
38 | class BluetoothRFCOMMNetNode : public ANetNode { | 38 | class BluetoothRFCOMMNetNode : public ANetNode { |
39 | 39 | ||
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | 41 | ||
42 | public: | 42 | public: |
43 | 43 | ||
44 | BluetoothRFCOMMNetNode(); | 44 | BluetoothRFCOMMNetNode(); |
45 | virtual ~BluetoothRFCOMMNetNode(); | 45 | virtual ~BluetoothRFCOMMNetNode(); |
46 | 46 | ||
47 | virtual const QString pixmapName() | 47 | virtual const QString pixmapName() |
48 | { return "Devices/bluetooth"; } | 48 | { return "Devices/bluetooth"; } |
49 | 49 | ||
50 | virtual const QString nodeDescription() ; | 50 | virtual const QString nodeDescription() ; |
51 | virtual ANetNodeInstance * createInstance( void ); | 51 | virtual ANetNodeInstance * createInstance( void ); |
52 | virtual const char ** needs( void ); | 52 | virtual const char ** needs( void ); |
53 | virtual const char * provides( void ); | 53 | virtual const char * provides( void ); |
54 | 54 | ||
55 | private: | 55 | private: |
56 | 56 | ||
57 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 57 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
58 | virtual void saveSpecificAttribute( QTextStream & TS ); | 58 | virtual void saveSpecificAttribute( QTextStream & TS ); |
59 | }; | 59 | }; |
60 | 60 | ||
61 | extern "C" | 61 | extern "C" |
62 | { | 62 | { |
63 | void create_plugin( QList<ANetNode> & PNN ); | 63 | void create_plugin( QList<ANetNode> & PNN ); |
64 | }; | 64 | }; |
65 | 65 | ||
66 | #endif | 66 | #endif |
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 @@ | |||
1 | config NS2BT | 1 | config NS2BT |
2 | boolean "opie-networksettings2plugin-bluetooth (set up BLUETOOTH)" | 2 | boolean "opie-networksettings2plugin-bluetooth (set up BLUETOOTH)" |
3 | default "n" if NS2 | 3 | default "n" if NS2 |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE && NS2OPIETOOTH |
diff --git a/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control b/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control index ea77bd7..c4d29f2 100644 --- a/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control +++ b/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-networksettingsplugin2-bluetooth | 1 | Package: opie-networksettings2plugin-bluetooth |
2 | Files: plugins/networksettings2/libbluetooth.so* | 2 | Files: plugins/networksettings2/libbluetooth.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopietooth2, libopiecore2, libopienet2 |
8 | Description: Network settings bluetooth plugin. | 8 | Description: Network settings bluetooth plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,49 +1,54 @@ | |||
1 | #include "cable_NN.h" | 1 | #include "cable_NN.h" |
2 | #include "cable_NNI.h" | 2 | #include "cable_NNI.h" |
3 | 3 | ||
4 | static const char * CableNeeds[] = | 4 | static const char * CableNeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | static const char * CableProvides[] = | ||
9 | { "line", | ||
10 | 0 | ||
11 | }; | ||
12 | |||
8 | /** | 13 | /** |
9 | * Constructor, find all of the possible interfaces | 14 | * Constructor, find all of the possible interfaces |
10 | */ | 15 | */ |
11 | CableNetNode::CableNetNode() : ANetNode(tr("Cable Connection")) { | 16 | CableNetNode::CableNetNode() : ANetNode(tr("Cable Connection")) { |
12 | } | 17 | } |
13 | 18 | ||
14 | /** | 19 | /** |
15 | * Delete any interfaces that we own. | 20 | * Delete any interfaces that we own. |
16 | */ | 21 | */ |
17 | CableNetNode::~CableNetNode(){ | 22 | CableNetNode::~CableNetNode(){ |
18 | } | 23 | } |
19 | 24 | ||
20 | const QString CableNetNode::nodeDescription(){ | 25 | const QString CableNetNode::nodeDescription(){ |
21 | return tr("\ | 26 | return tr("\ |
22 | <p>Sets up a wired serial or parallel.</p>\ | 27 | <p>Sets up a wired serial or parallel.</p>\ |
23 | " | 28 | " |
24 | ); | 29 | ); |
25 | } | 30 | } |
26 | 31 | ||
27 | ANetNodeInstance * CableNetNode::createInstance( void ) { | 32 | ANetNodeInstance * CableNetNode::createInstance( void ) { |
28 | return new ACable( this ); | 33 | return new ACable( this ); |
29 | } | 34 | } |
30 | 35 | ||
31 | const char ** CableNetNode::needs( void ) { | 36 | const char ** CableNetNode::needs( void ) { |
32 | return CableNeeds; | 37 | return CableNeeds; |
33 | } | 38 | } |
34 | 39 | ||
35 | const char * CableNetNode::provides( void ) { | 40 | const char ** CableNetNode::provides( void ) { |
36 | return "line"; | 41 | return CableProvides; |
37 | } | 42 | } |
38 | 43 | ||
39 | void CableNetNode::setSpecificAttribute( QString & , QString & ) { | 44 | void CableNetNode::setSpecificAttribute( QString & , QString & ) { |
40 | } | 45 | } |
41 | 46 | ||
42 | void CableNetNode::saveSpecificAttribute( QTextStream & ) { | 47 | void CableNetNode::saveSpecificAttribute( QTextStream & ) { |
43 | } | 48 | } |
44 | 49 | ||
45 | extern "C" { | 50 | extern "C" { |
46 | void create_plugin( QList<ANetNode> & PNN ) { | 51 | void create_plugin( QList<ANetNode> & PNN ) { |
47 | PNN.append( new CableNetNode() ); | 52 | PNN.append( new CableNetNode() ); |
48 | } | 53 | } |
49 | } | 54 | } |
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 | |||
@@ -1,36 +1,36 @@ | |||
1 | #ifndef CABLE_NETNODE_H | 1 | #ifndef CABLE_NETNODE_H |
2 | #define CABLE_NETNODE_H | 2 | #define CABLE_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ACable; | 6 | class ACable; |
7 | 7 | ||
8 | class CableNetNode : public ANetNode { | 8 | class CableNetNode : public ANetNode { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | CableNetNode(); | 14 | CableNetNode(); |
15 | virtual ~CableNetNode(); | 15 | virtual ~CableNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/cable"; } | 18 | { return "Devices/cable"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
21 | virtual ANetNodeInstance * createInstance( void ); | 21 | virtual ANetNodeInstance * createInstance( void ); |
22 | virtual const char ** needs( void ); | 22 | virtual const char ** needs( void ); |
23 | virtual const char * provides( void ); | 23 | virtual const char ** provides( void ); |
24 | 24 | ||
25 | private: | 25 | private: |
26 | 26 | ||
27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
28 | virtual void saveSpecificAttribute( QTextStream & TS ); | 28 | virtual void saveSpecificAttribute( QTextStream & TS ); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | extern "C" | 31 | extern "C" |
32 | { | 32 | { |
33 | void create_plugin( QList<ANetNode> & PNN ); | 33 | void create_plugin( QList<ANetNode> & PNN ); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #endif | 36 | #endif |
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 | |||
@@ -1,89 +1,87 @@ | |||
1 | #include "cableedit.h" | 1 | #include "cableedit.h" |
2 | #include "cable_NNI.h" | 2 | #include "cable_NNI.h" |
3 | #include "cable_NN.h" | 3 | #include "cable_NN.h" |
4 | 4 | ||
5 | ACable::ACable( CableNetNode * PNN ) : ANetNodeInstance( PNN ) { | 5 | ACable::ACable( CableNetNode * PNN ) : ANetNodeInstance( PNN ) { |
6 | // default values | 6 | // default values |
7 | Data.Device = "/dev/ttyS0"; | 7 | Data.Device = "/dev/ttyS0"; |
8 | Data.LockFile = "/var/Lock"; | 8 | Data.LockFile = "/var/Lock"; |
9 | Data.Speed = 115200; | 9 | Data.Speed = 115200; |
10 | Data.DataBits = 8; | 10 | Data.DataBits = 8; |
11 | Data.Parity = 0; | 11 | Data.Parity = 0; |
12 | Data.StopBits = 1; | 12 | Data.StopBits = 1; |
13 | Data.HardwareControl = 0; | 13 | Data.HardwareControl = 0; |
14 | Data.SoftwareControl = 0; | 14 | Data.SoftwareControl = 0; |
15 | GUI = 0; | 15 | GUI = 0; |
16 | RT = 0; | 16 | RT = 0; |
17 | } | 17 | } |
18 | 18 | ||
19 | void ACable::setSpecificAttribute( QString & A, QString & V) { | 19 | void ACable::setSpecificAttribute( QString & A, QString & V) { |
20 | if( A == "device" ) { | 20 | if( A == "device" ) { |
21 | Data.Device = V; | 21 | Data.Device = V; |
22 | } else if ( A == "lockfile" ) { | 22 | } else if ( A == "lockfile" ) { |
23 | Data.LockFile = V; | 23 | Data.LockFile = V; |
24 | } else if ( A == "speed" ) { | 24 | } else if ( A == "speed" ) { |
25 | Data.Speed = V.toLong(); | 25 | Data.Speed = V.toLong(); |
26 | } else if ( A == "parity" ) { | 26 | } else if ( A == "parity" ) { |
27 | Data.Parity = V.toShort(); | 27 | Data.Parity = V.toShort(); |
28 | } else if ( A == "databits" ) { | 28 | } else if ( A == "databits" ) { |
29 | Data.DataBits = V.toShort(); | 29 | Data.DataBits = V.toShort(); |
30 | } else if ( A == "stopbits" ) { | 30 | } else if ( A == "stopbits" ) { |
31 | Data.StopBits = V.toShort(); | 31 | Data.StopBits = V.toShort(); |
32 | } else if ( A == "hardwarecontrol" ) { | 32 | } else if ( A == "hardwarecontrol" ) { |
33 | Data.HardwareControl = ( V == "yes" ); | 33 | Data.HardwareControl = ( V == "yes" ); |
34 | } else if ( A == "softwarecontrol" ) { | 34 | } else if ( A == "softwarecontrol" ) { |
35 | Data.SoftwareControl = ( V == "yes" ); | 35 | Data.SoftwareControl = ( V == "yes" ); |
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
39 | void ACable::saveSpecificAttribute( QTextStream & TS ) { | 39 | void ACable::saveSpecificAttribute( QTextStream & TS ) { |
40 | TS << "device=" << quote( Data.Device ) << endl; | 40 | TS << "device=" << quote( Data.Device ) << endl; |
41 | TS << "lockfile=" << quote( Data.LockFile ) << endl; | 41 | TS << "lockfile=" << quote( Data.LockFile ) << endl; |
42 | TS << "speed=" << Data.Speed << endl; | 42 | TS << "speed=" << Data.Speed << endl; |
43 | TS << "parity=" << Data.Parity << endl; | 43 | TS << "parity=" << Data.Parity << endl; |
44 | TS << "databits=" << Data.DataBits << endl; | 44 | TS << "databits=" << Data.DataBits << endl; |
45 | TS << "stopbits=" << Data.StopBits << endl; | 45 | TS << "stopbits=" << Data.StopBits << endl; |
46 | TS << "hardwarecontrol=" << | 46 | TS << "hardwarecontrol=" << |
47 | ((Data.HardwareControl) ? "yes" : "no") << endl; | 47 | ((Data.HardwareControl) ? "yes" : "no") << endl; |
48 | TS << "softwarecontrol=" << | 48 | TS << "softwarecontrol=" << |
49 | ((Data.SoftwareControl) ? "yes" : "no") << endl; | 49 | ((Data.SoftwareControl) ? "yes" : "no") << endl; |
50 | } | 50 | } |
51 | 51 | ||
52 | short ACable::generateFileEmbedded( const QString & ID, | 52 | short ACable::generateFileEmbedded( SystemFile & SF, |
53 | const QString & Path, | ||
54 | QTextStream & TS, | ||
55 | long DevNr ) { | 53 | long DevNr ) { |
56 | short rvl, rvd; | 54 | short rvl, rvd; |
57 | 55 | ||
58 | rvl = 1; | 56 | rvl = 1; |
59 | if( ID == "peers" ) { | 57 | if( SF.name() == "peers" ) { |
60 | TS << Data.Device | 58 | SF << Data.Device |
61 | << endl; | 59 | << endl; |
62 | TS << Data.Speed | 60 | SF << Data.Speed |
63 | << endl; | 61 | << endl; |
64 | TS << "lock " | 62 | SF << "lock " |
65 | << Data.LockFile | 63 | << Data.LockFile |
66 | << endl; | 64 | << endl; |
67 | rvl = 0; | 65 | rvl = 0; |
68 | } | 66 | } |
69 | 67 | ||
70 | rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr ); | 68 | rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr ); |
71 | return (rvd == 2 || rvl == 2 ) ? 2 : | 69 | return (rvd == 2 || rvl == 2 ) ? 2 : |
72 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | 70 | (rvd == 0 || rvl == 0 ) ? 0 : 1; |
73 | } | 71 | } |
74 | 72 | ||
75 | QWidget * ACable::edit( QWidget * parent ) { | 73 | QWidget * ACable::edit( QWidget * parent ) { |
76 | GUI = new CableEdit( parent ); | 74 | GUI = new CableEdit( parent ); |
77 | GUI->showData( Data ); | 75 | GUI->showData( Data ); |
78 | return GUI; | 76 | return GUI; |
79 | } | 77 | } |
80 | 78 | ||
81 | QString ACable::acceptable( void ) { | 79 | QString ACable::acceptable( void ) { |
82 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 80 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
83 | } | 81 | } |
84 | 82 | ||
85 | void ACable::commit( void ) { | 83 | void ACable::commit( void ) { |
86 | if( GUI && GUI->commit( Data ) ) { | 84 | if( GUI && GUI->commit( Data ) ) { |
87 | setModified( 1 ); | 85 | setModified( 1 ); |
88 | } | 86 | } |
89 | } | 87 | } |
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 | |||
@@ -1,46 +1,44 @@ | |||
1 | #ifndef CABLE_H | 1 | #ifndef CABLE_H |
2 | #define CABLE_H | 2 | #define CABLE_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "cabledata.h" | 5 | #include "cabledata.h" |
6 | #include "cablerun.h" | 6 | #include "cablerun.h" |
7 | 7 | ||
8 | class CableNetNode; | 8 | class CableNetNode; |
9 | class CableEdit; | 9 | class CableEdit; |
10 | 10 | ||
11 | class ACable : public ANetNodeInstance { | 11 | class ACable : public ANetNodeInstance { |
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | ACable( CableNetNode * PNN ); | 15 | ACable( CableNetNode * PNN ); |
16 | 16 | ||
17 | RuntimeInfo * runtime( void ) | 17 | RuntimeInfo * runtime( void ) |
18 | { return | 18 | { return |
19 | ( RT ) ? RT : ( RT = new CableRun( this, Data ) ); | 19 | ( RT ) ? RT : ( RT = new CableRun( this, Data ) ); |
20 | } | 20 | } |
21 | 21 | ||
22 | QWidget * edit( QWidget * parent ); | 22 | QWidget * edit( QWidget * parent ); |
23 | QString acceptable( void ); | 23 | QString acceptable( void ); |
24 | void commit( void ); | 24 | void commit( void ); |
25 | 25 | ||
26 | virtual void * data( void ) | 26 | virtual void * data( void ) |
27 | { return (void *)&Data; } | 27 | { return (void *)&Data; } |
28 | 28 | ||
29 | short generateFileEmbedded( const QString & ID, | 29 | short generateFileEmbedded( SystemFile & Sf, |
30 | const QString & Path, | ||
31 | QTextStream & TS, | ||
32 | long DevNr ); | 30 | long DevNr ); |
33 | protected : | 31 | protected : |
34 | 32 | ||
35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 33 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
36 | virtual void saveSpecificAttribute( QTextStream & TS ); | 34 | virtual void saveSpecificAttribute( QTextStream & TS ); |
37 | 35 | ||
38 | private : | 36 | private : |
39 | 37 | ||
40 | CableEdit * GUI; | 38 | CableEdit * GUI; |
41 | CableData_t Data; | 39 | CableData Data; |
42 | CableRun * RT; | 40 | CableRun * RT; |
43 | 41 | ||
44 | }; | 42 | }; |
45 | 43 | ||
46 | #endif | 44 | #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 @@ | |||
1 | #ifndef CABLE_DATA_H | 1 | #ifndef CABLE_DATA_H |
2 | #define CABLE_DATA_H | 2 | #define CABLE_DATA_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | typedef struct CableData { | 6 | class CableData { |
7 | |||
8 | public : | ||
9 | |||
7 | QString Device; | 10 | QString Device; |
8 | QString LockFile; | 11 | QString LockFile; |
9 | long Speed; | 12 | long Speed; |
10 | short Parity; | 13 | short Parity; |
11 | short DataBits; | 14 | short DataBits; |
12 | short StopBits; | 15 | short StopBits; |
13 | bool HardwareControl; | 16 | bool HardwareControl; |
14 | bool SoftwareControl; | 17 | bool SoftwareControl; |
15 | 18 | ||
16 | } CableData_t; | 19 | }; |
17 | 20 | ||
18 | #endif | 21 | #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 | |||
@@ -1,68 +1,68 @@ | |||
1 | #include <GUIUtils.h> | 1 | #include <GUIUtils.h> |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <qlineedit.h> | 3 | #include <qlineedit.h> |
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qspinbox.h> | 5 | #include <qspinbox.h> |
6 | #include <qcheckbox.h> | 6 | #include <qcheckbox.h> |
7 | #include "cabledata.h" | 7 | #include "cabledata.h" |
8 | #include "cableedit.h" | 8 | #include "cableedit.h" |
9 | 9 | ||
10 | static long SpeedTable[] = { | 10 | static long SpeedTable[] = { |
11 | 2400, 9600, 19200, 38400, 57600, 115200, | 11 | 2400, 9600, 19200, 38400, 57600, 115200, |
12 | 230400, 460800, 500000, 921600, 1000000, | 12 | 230400, 460800, 500000, 921600, 1000000, |
13 | 1152000, 1500000, 2000000, 2500000, 3000000, | 13 | 1152000, 1500000, 2000000, 2500000, 3000000, |
14 | 3500000, 4000000, -1 | 14 | 3500000, 4000000, -1 |
15 | }; | 15 | }; |
16 | 16 | ||
17 | CableEdit::CableEdit( QWidget * Parent ) : CableGUI( Parent ) { | 17 | CableEdit::CableEdit( QWidget * Parent ) : CableGUI( Parent ) { |
18 | } | 18 | } |
19 | 19 | ||
20 | void CableEdit::showData( CableData_t & D ) { | 20 | void CableEdit::showData( CableData & D ) { |
21 | DeviceFile_LE->setText( D.Device ); | 21 | DeviceFile_LE->setText( D.Device ); |
22 | LockFile_LE->setText( D.LockFile ); | 22 | LockFile_LE->setText( D.LockFile ); |
23 | for( long * Run = SpeedTable; *Run != -1; *Run ++ ) { | 23 | for( long * Run = SpeedTable; *Run != -1; *Run ++ ) { |
24 | if( *Run == D.Speed ) { | 24 | if( *Run == D.Speed ) { |
25 | Speed_CB->setCurrentItem( | 25 | Speed_CB->setCurrentItem( |
26 | ((long)(Run)-(long)(SpeedTable))/sizeof(long) ); | 26 | ((long)(Run)-(long)(SpeedTable))/sizeof(long) ); |
27 | break; | 27 | break; |
28 | } | 28 | } |
29 | } | 29 | } |
30 | Parity_CB->setCurrentItem( D.Parity ); | 30 | Parity_CB->setCurrentItem( D.Parity ); |
31 | DataBits_SB->setValue( D.DataBits ); | 31 | DataBits_SB->setValue( D.DataBits ); |
32 | StopBits_CB->setCurrentItem( D.StopBits ); | 32 | StopBits_CB->setCurrentItem( D.StopBits ); |
33 | HardwareFC_CB->setChecked( D.HardwareControl ); | 33 | HardwareFC_CB->setChecked( D.HardwareControl ); |
34 | SoftwareFC_CB->setChecked( D.SoftwareControl ); | 34 | SoftwareFC_CB->setChecked( D.SoftwareControl ); |
35 | } | 35 | } |
36 | 36 | ||
37 | QString CableEdit::acceptable( void ) { | 37 | QString CableEdit::acceptable( void ) { |
38 | if( DeviceFile_LE->text().isEmpty() ) | 38 | if( DeviceFile_LE->text().isEmpty() ) |
39 | return tr("Device filename needed"); | 39 | return tr("Device filename needed"); |
40 | return QString(); | 40 | return QString(); |
41 | } | 41 | } |
42 | 42 | ||
43 | bool CableEdit::commit( CableData_t & D ) { | 43 | bool CableEdit::commit( CableData & D ) { |
44 | bool SM = 0; | 44 | bool SM = 0; |
45 | 45 | ||
46 | TXTM( D.Device, DeviceFile_LE, SM ); | 46 | TXTM( D.Device, DeviceFile_LE, SM ); |
47 | TXTM( D.LockFile, LockFile_LE, SM ); | 47 | TXTM( D.LockFile, LockFile_LE, SM ); |
48 | 48 | ||
49 | for( long * Run = SpeedTable; *Run != -1; *Run ++ ) { | 49 | for( long * Run = SpeedTable; *Run != -1; *Run ++ ) { |
50 | if( *Run == D.Speed ) { | 50 | if( *Run == D.Speed ) { |
51 | if( D.Speed != Speed_CB->currentText().toLong() ) { | 51 | if( D.Speed != Speed_CB->currentText().toLong() ) { |
52 | SM = 1; | 52 | SM = 1; |
53 | D.Speed = Speed_CB->currentText().toLong(); | 53 | D.Speed = Speed_CB->currentText().toLong(); |
54 | } | 54 | } |
55 | break; | 55 | break; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | CIM(D.Parity, Parity_CB, SM ); | 59 | CIM(D.Parity, Parity_CB, SM ); |
60 | 60 | ||
61 | SBM(D.DataBits, DataBits_SB, SM ); | 61 | SBM(D.DataBits, DataBits_SB, SM ); |
62 | CIM(D.StopBits, StopBits_CB, SM ); | 62 | CIM(D.StopBits, StopBits_CB, SM ); |
63 | 63 | ||
64 | CBM( D.HardwareControl, HardwareFC_CB, SM ); | 64 | CBM( D.HardwareControl, HardwareFC_CB, SM ); |
65 | CBM( D.SoftwareControl, SoftwareFC_CB, SM ); | 65 | CBM( D.SoftwareControl, SoftwareFC_CB, SM ); |
66 | 66 | ||
67 | return SM; | 67 | return SM; |
68 | } | 68 | } |
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 | |||
@@ -1,12 +1,12 @@ | |||
1 | #include "cabledata.h" | 1 | #include "cabledata.h" |
2 | #include "cableGUI.h" | 2 | #include "cableGUI.h" |
3 | 3 | ||
4 | class CableEdit : public CableGUI { | 4 | class CableEdit : public CableGUI { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | CableEdit( QWidget * parent ); | 8 | CableEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 9 | QString acceptable( void ); |
10 | bool commit( CableData_t & D ); | 10 | bool commit( CableData & D ); |
11 | void showData( CableData_t & D ); | 11 | void showData( CableData & D ); |
12 | }; | 12 | }; |
diff --git a/noncore/settings/networksettings2/cable/cablerun.cpp b/noncore/settings/networksettings2/cable/cablerun.cpp index 85660f6..7a8deb9 100644 --- a/noncore/settings/networksettings2/cable/cablerun.cpp +++ b/noncore/settings/networksettings2/cable/cablerun.cpp | |||
@@ -1,30 +1,22 @@ | |||
1 | #include <fcntl.h> | 1 | #include <fcntl.h> |
2 | #include <unistd.h> | 2 | #include <unistd.h> |
3 | #include "cablerun.h" | 3 | #include "cablerun.h" |
4 | 4 | ||
5 | void CableRun::detectState( NodeCollection * NC ) { | 5 | State_t CableRun::detectState( void ) { |
6 | 6 | ||
7 | int fd = open( Data->Device.latin1(), O_RDWR ); | 7 | int fd = open( Data->Device.latin1(), O_RDWR ); |
8 | 8 | ||
9 | if( fd < 0 ) { | 9 | if( fd < 0 ) { |
10 | NC->setCurrentState( Unavailable ); | 10 | return Unavailable; |
11 | } | 11 | } |
12 | close( fd ); | 12 | close( fd ); |
13 | NC->setCurrentState( Available ); | 13 | return Available; |
14 | } | 14 | } |
15 | 15 | ||
16 | bool CableRun::setState( NodeCollection * NC, Action_t A, bool ) { | 16 | QString CableRun::setMyState( NodeCollection *, Action_t , bool ) { |
17 | if( A == Activate ) { | 17 | return QString(); |
18 | detectState(NC); | ||
19 | return (NC->currentState() == Available); | ||
20 | } | ||
21 | return 1; | ||
22 | } | ||
23 | |||
24 | bool CableRun::canSetState( State_t , Action_t ) { | ||
25 | return 1; | ||
26 | } | 18 | } |
27 | 19 | ||
28 | QString CableRun::deviceFile( void ) { | 20 | QString CableRun::deviceFile( void ) { |
29 | return Data->Device; | 21 | return Data->Device; |
30 | } | 22 | } |
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 @@ | |||
1 | #include <asline.h> | 1 | #include <netnode.h> |
2 | #include "cabledata.h" | 2 | #include "cabledata.h" |
3 | 3 | ||
4 | class CableRun : public AsLine { | 4 | class CableRun : public RuntimeInfo { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | CableRun( ANetNodeInstance * NNI, | 8 | CableRun( ANetNodeInstance * NNI, |
9 | CableData_t & D ) : AsLine( NNI ) | 9 | CableData & D ) : RuntimeInfo( NNI ) |
10 | { Data = &D; } | 10 | { Data = &D; } |
11 | 11 | ||
12 | virtual AsLine * asLine( void ) | 12 | virtual RuntimeInfo * line( void ) |
13 | { return (AsLine *)this; } | 13 | { return this; } |
14 | 14 | ||
15 | virtual QString deviceFile( void ); | 15 | virtual QString deviceFile( void ); |
16 | 16 | ||
17 | State_t detectState( void ); | ||
18 | |||
17 | protected : | 19 | protected : |
18 | 20 | ||
19 | void detectState( NodeCollection * NC ); | 21 | QString setMyState( NodeCollection * , Action_t, bool ); |
20 | bool setState( NodeCollection * NC, Action_t A, bool Force ); | ||
21 | bool canSetState( State_t Curr, Action_t A ); | ||
22 | 22 | ||
23 | private : | 23 | private : |
24 | 24 | ||
25 | CableData_t * Data; | 25 | CableData * Data; |
26 | }; | 26 | }; |
diff --git a/noncore/settings/networksettings2/cable/opie-networksettings2plugin-cable.control b/noncore/settings/networksettings2/cable/opie-networksettings2plugin-cable.control index 79520e2..dd08279 100644 --- a/noncore/settings/networksettings2/cable/opie-networksettings2plugin-cable.control +++ b/noncore/settings/networksettings2/cable/opie-networksettings2plugin-cable.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-networksettingsplugin2-bluetooth | 1 | Package: opie-networksettings2plugin-cable |
2 | Files: plugins/networksettings2/libcable.so* | 2 | Files: plugins/networksettings2/libcable.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Network settings cable plugin. | 8 | Description: Network settings cable plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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 @@ | |||
1 | source noncore/settings/networksettings2/networksettings2/config.in | 1 | source noncore/settings/networksettings2/networksettings2/config.in |
2 | source noncore/settings/networksettings2/opietooth2/config.in | ||
3 | source noncore/settings/networksettings2/opietooth2_applet/config.in | ||
2 | 4 | ||
3 | config NS2 | 5 | config NS2 |
4 | boolean | 6 | boolean |
5 | default "y" | 7 | default "y" |
6 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE | 8 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE && NS2OPIETOOTH |
7 | 9 | ||
8 | source noncore/settings/networksettings2/profile/config.in | 10 | source noncore/settings/networksettings2/profile/config.in |
9 | source noncore/settings/networksettings2/network/config.in | 11 | source noncore/settings/networksettings2/network/config.in |
10 | source noncore/settings/networksettings2/lancard/config.in | 12 | source noncore/settings/networksettings2/lancard/config.in |
11 | source noncore/settings/networksettings2/ppp/config.in | 13 | source noncore/settings/networksettings2/ppp/config.in |
12 | source noncore/settings/networksettings2/wlan/config.in | 14 | source noncore/settings/networksettings2/wlan/config.in |
13 | source noncore/settings/networksettings2/usb/config.in | 15 | source noncore/settings/networksettings2/usb/config.in |
14 | source noncore/settings/networksettings2/irda/config.in | 16 | source noncore/settings/networksettings2/irda/config.in |
15 | source noncore/settings/networksettings2/vpn/config.in | 17 | source noncore/settings/networksettings2/vpn/config.in |
16 | source noncore/settings/networksettings2/bluetooth/config.in | 18 | source noncore/settings/networksettings2/bluetooth/config.in |
17 | source noncore/settings/networksettings2/cable/config.in | 19 | source noncore/settings/networksettings2/cable/config.in |
18 | source noncore/settings/networksettings2/modem/config.in | 20 | source noncore/settings/networksettings2/modem/config.in |
21 | source noncore/settings/networksettings2/gprs/config.in | ||
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index 77826d1..3f8a53f 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp | |||
@@ -1,577 +1,631 @@ | |||
1 | #include <opie2/odebug.h> | ||
1 | #include <qlistview.h> | 2 | #include <qlistview.h> |
2 | #include <qwidgetstack.h> | 3 | #include <qwidgetstack.h> |
3 | #include <qframe.h> | 4 | #include <qframe.h> |
4 | #include <qcombobox.h> | 5 | #include <qcombobox.h> |
5 | #include <qtabwidget.h> | 6 | #include <qtabwidget.h> |
6 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
7 | #include <qpushbutton.h> | 8 | #include <qpushbutton.h> |
8 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
9 | #include <qheader.h> | 10 | #include <qheader.h> |
10 | #include <qpainter.h> | 11 | #include <qpainter.h> |
11 | #include <qcheckbox.h> | 12 | #include <qcheckbox.h> |
12 | #include <qlabel.h> | 13 | #include <qlabel.h> |
13 | 14 | ||
14 | #include "editconnection.h" | 15 | #include "editconnection.h" |
15 | #include "resources.h" | 16 | #include "resources.h" |
16 | #include "netnode.h" | 17 | #include "netnode.h" |
17 | 18 | ||
18 | // | 19 | // |
19 | // | 20 | // |
20 | // THESE TO GIVE BETTER FEEDBACK ABOUT DISABLED ITEMS | 21 | // THESE TO GIVE BETTER FEEDBACK ABOUT DISABLED ITEMS |
21 | // | 22 | // |
22 | // | 23 | // |
23 | 24 | ||
24 | class MyQCheckListItem : public QCheckListItem | 25 | class MyQCheckListItem : public QCheckListItem |
25 | { | 26 | { |
26 | public: | 27 | public: |
27 | MyQCheckListItem( QListView *parent, const QString & S, Type T ) : | 28 | MyQCheckListItem( QListView *parent, const QString & S, Type T ) : |
28 | QCheckListItem( parent, S, T ) { } | 29 | QCheckListItem( parent, S, T ) { } |
29 | MyQCheckListItem( QCheckListItem *parent, const QString & S, Type T ) : | 30 | MyQCheckListItem( QCheckListItem *parent, const QString & S, Type T ) : |
30 | QCheckListItem( parent, S, T ) { } | 31 | QCheckListItem( parent, S, T ) { } |
31 | MyQCheckListItem( QListViewItem *parent, const QString & S, Type T ) : | 32 | MyQCheckListItem( QListViewItem *parent, const QString & S, Type T ) : |
32 | QCheckListItem( parent, S, T ) { } | 33 | QCheckListItem( parent, S, T ) { } |
33 | 34 | ||
35 | MyQCheckListItem( QListView *parent, const QString & S ) : | ||
36 | QCheckListItem( parent, S, QCheckListItem::Controller ) { } | ||
37 | MyQCheckListItem( QCheckListItem *parent, const QString & S ) : | ||
38 | QCheckListItem( parent, S, QCheckListItem::Controller ) { } | ||
39 | MyQCheckListItem( QListViewItem *parent, const QString & S ) : | ||
40 | QCheckListItem( parent, S, QCheckListItem::Controller ) { } | ||
41 | |||
34 | virtual void paintCell( QPainter *p, const QColorGroup &cg, | 42 | virtual void paintCell( QPainter *p, const QColorGroup &cg, |
35 | int column, int width, int alignment ); | 43 | int column, int width, int alignment ); |
36 | 44 | ||
37 | }; | 45 | }; |
38 | 46 | ||
39 | void MyQCheckListItem::paintCell( QPainter *p, const QColorGroup &cg, | 47 | void MyQCheckListItem::paintCell( QPainter *p, const QColorGroup &cg, |
40 | int column, int width, int alignment ) | 48 | int column, int width, int alignment ) |
41 | { | 49 | { |
42 | QColorGroup _cg( cg ); | 50 | QColorGroup _cg( cg ); |
43 | QColor c = _cg.text(); | 51 | QColor c = _cg.text(); |
44 | if ( ! isSelectable() ) | 52 | if ( ! isSelectable() ) |
45 | _cg.setColor( QColorGroup::Text, Qt::lightGray ); | 53 | _cg.setColor( QColorGroup::Text, Qt::lightGray ); |
46 | QCheckListItem::paintCell( p, _cg, column, width, alignment ); | 54 | QCheckListItem::paintCell( p, _cg, column, width, alignment ); |
47 | _cg.setColor( QColorGroup::Text, c ); | 55 | _cg.setColor( QColorGroup::Text, c ); |
48 | } | 56 | } |
49 | 57 | ||
50 | class MyQListViewItem : public QListViewItem | 58 | class MyQListViewItem : public QListViewItem |
51 | { | 59 | { |
52 | public: | 60 | public: |
53 | MyQListViewItem( QListView *parent, const QString & S ) : | 61 | MyQListViewItem( QListView *parent, const QString & S ) : |
54 | QListViewItem( parent, S ) { } | 62 | QListViewItem( parent, S ) { } |
55 | MyQListViewItem( QListViewItem *parent, const QString & S ) : | 63 | MyQListViewItem( QListViewItem *parent, const QString & S ) : |
56 | QListViewItem( parent, S ) { } | 64 | QListViewItem( parent, S ) { } |
57 | 65 | ||
58 | virtual void paintCell( QPainter *p, const QColorGroup &cg, | 66 | virtual void paintCell( QPainter *p, const QColorGroup &cg, |
59 | int column, int width, int alignment ); | 67 | int column, int width, int alignment ); |
60 | 68 | ||
61 | }; | 69 | }; |
62 | 70 | ||
63 | void MyQListViewItem::paintCell( QPainter *p, const QColorGroup &cg, | 71 | void MyQListViewItem::paintCell( QPainter *p, const QColorGroup &cg, |
64 | int column, int width, int alignment ) | 72 | int column, int width, int alignment ) |
65 | { | 73 | { |
66 | QColorGroup _cg( cg ); | 74 | QColorGroup _cg( cg ); |
67 | QColor c = _cg.text(); | 75 | QColor c = _cg.text(); |
68 | if ( ! isSelectable() ) | 76 | if ( ! isSelectable() ) |
69 | _cg.setColor( QColorGroup::Text, Qt::lightGray ); | 77 | _cg.setColor( QColorGroup::Text, Qt::lightGray ); |
70 | QListViewItem::paintCell( p, _cg, column, width, alignment ); | 78 | QListViewItem::paintCell( p, _cg, column, width, alignment ); |
71 | _cg.setColor( QColorGroup::Text, c ); | 79 | _cg.setColor( QColorGroup::Text, c ); |
72 | } | 80 | } |
73 | 81 | ||
74 | // | 82 | // |
75 | // | 83 | // |
76 | // REAL GUI | 84 | // REAL GUI |
77 | // | 85 | // |
78 | // | 86 | // |
79 | 87 | ||
80 | bool EditConnection::AutoCollapse = 1; | 88 | bool EditConnection::AutoCollapse = 1; |
81 | 89 | ||
82 | EditConnection::EditConnection( QWidget* parent ) : | 90 | EditConnection::EditConnection( QWidget* parent ) : |
83 | EditConnectionGUI( parent, 0, TRUE ), TmpCollection() { | 91 | EditConnectionGUI( parent, 0, TRUE ), TmpCollection() { |
84 | 92 | ||
85 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); | 93 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); |
86 | Setup_FRM->setEnabled( FALSE ); | 94 | Setup_FRM->setEnabled( FALSE ); |
87 | 95 | ||
88 | TmpIsValid = 0; | 96 | TmpIsValid = 0; |
89 | SelectedNodes = 0; | 97 | SelectedNodes = 0; |
90 | 98 | ||
91 | AutoCollapse_CB->setChecked( AutoCollapse ); | 99 | AutoCollapse_CB->setChecked( AutoCollapse ); |
92 | 100 | ||
93 | Mapping = new QPtrDict<ANetNode>; | 101 | Mapping = new QPtrDict<ANetNode>; |
94 | Mapping->setAutoDelete( FALSE ); | 102 | Mapping->setAutoDelete( FALSE ); |
95 | Nodes_LV->header()->hide(); | 103 | Nodes_LV->header()->hide(); |
96 | // popluate tree with all NetNodes | 104 | // popluate tree with all NetNodes |
97 | buildFullTree(); | 105 | buildFullTree(); |
98 | } | 106 | } |
99 | 107 | ||
100 | NodeCollection * EditConnection::getTmpCollection( void ) { | 108 | NodeCollection * EditConnection::getTmpCollection( void ) { |
101 | 109 | ||
102 | if( TmpIsValid ) | 110 | if( TmpIsValid ) |
103 | // content is stil OK | 111 | // content is stil OK |
104 | return &(TmpCollection); | 112 | return &(TmpCollection); |
105 | 113 | ||
106 | // reset collection -> delete all NEW NetNodes | 114 | // reset collection -> delete all NEW NetNodes |
107 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 115 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
108 | it.current(); | 116 | it.current(); |
109 | ++it ) { | 117 | ++it ) { |
110 | if( it.current()->isNew() ) { | 118 | if( it.current()->isNew() ) { |
111 | delete it.current(); | 119 | delete it.current(); |
112 | } | 120 | } |
113 | } | 121 | } |
114 | TmpCollection.clear(); | 122 | TmpCollection.clear(); |
115 | 123 | ||
116 | // update content | 124 | // update content |
117 | QListViewItem * it = Nodes_LV->firstChild(); | 125 | QListViewItem * it = Nodes_LV->firstChild(); |
118 | ANetNode * NN; | 126 | ANetNode * NN; |
119 | // start iter | 127 | |
128 | // start iter (if there is a collection) | ||
129 | /* | ||
130 | |||
131 | a node collection is sorted from the toplevel | ||
132 | node to the deepest node | ||
133 | |||
134 | */ | ||
120 | ANetNodeInstance * NNI = | 135 | ANetNodeInstance * NNI = |
121 | (SelectedNodes) ? SelectedNodes->first() : 0 ; | 136 | (SelectedNodes) ? SelectedNodes->first() : 0 ; |
122 | 137 | ||
123 | TmpCollection.setModified( 0 ); | 138 | TmpCollection.setModified( 0 ); |
124 | 139 | ||
140 | // the listview always starts with the toplevel | ||
141 | // hierarchy. This is always a controller item | ||
125 | while ( it ) { | 142 | while ( it ) { |
126 | NN = (*Mapping)[it]; | 143 | NN = (*Mapping)[it]; |
127 | if( NN == 0 ) { | 144 | if( NN == 0 ) { |
128 | // child is controller -> has sub radio | 145 | // this item is a controller -> |
129 | // check if one radio is selected | 146 | // has radio items as children -> |
147 | // find selected one | ||
130 | it = it->firstChild(); | 148 | it = it->firstChild(); |
131 | while( it ) { | 149 | while( it ) { |
132 | if( ((QCheckListItem *)it)->isOn() ) { | 150 | if( ((QCheckListItem *)it)->isOn() ) { |
133 | // this radio is selected -> go deeper | 151 | // this radio is selected -> go deeper |
134 | if( SelectedNodes == 0 || | ||
135 | NNI == 0 || | ||
136 | it->text(0) != NNI->nodeClass()->name() ) { | ||
137 | // new item not in previous collection | ||
138 | ANetNodeInstance * NNI = (*Mapping)[it]->createInstance(); | ||
139 | NNI->initialize(); | ||
140 | // this node type not in collection | ||
141 | TmpCollection.append( NNI ); | ||
142 | // master collection changed because new item in it | ||
143 | TmpCollection.setModified( 1 ); | ||
144 | // no more valid items in old list | ||
145 | NNI = 0; | ||
146 | } else { | ||
147 | // already in list -> copy pointer | ||
148 | TmpCollection.append( NNI ); | ||
149 | NNI = SelectedNodes->next(); | ||
150 | } | ||
151 | it = it->firstChild(); | ||
152 | // do not bother to check other items | ||
153 | break; | 152 | break; |
154 | } | 153 | } |
155 | it = it->nextSibling(); | 154 | it = it->nextSibling(); |
156 | } | 155 | } |
156 | |||
157 | if( ! it ) { | ||
158 | owarn << "Radio not selected" << oendl; | ||
159 | TmpIsValid = 0; | ||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | // it now contains selected radio | ||
164 | NN = (*Mapping)[it]; | ||
165 | } | ||
166 | |||
167 | // NN here contains the netnode of the | ||
168 | // current item -> this node needs to | ||
169 | // be stored in the collection | ||
170 | if( NNI == 0 || | ||
171 | it->text(0) != NNI->nodeClass()->name() ) { | ||
172 | // new item not in previous collection | ||
173 | ANetNodeInstance * NNI = NN->createInstance(); | ||
174 | NNI->initialize(); | ||
175 | // this node type not in collection | ||
176 | TmpCollection.append( NNI ); | ||
177 | // master collection changed because new item in it | ||
178 | TmpCollection.setModified( 1 ); | ||
179 | // no more valid items in old list | ||
180 | NNI = 0; | ||
157 | } else { | 181 | } else { |
158 | // check children | 182 | // already in list -> copy pointer |
159 | it = it->firstChild(); | 183 | TmpCollection.append( NNI ); |
184 | NNI = SelectedNodes->next(); | ||
160 | } | 185 | } |
186 | |||
187 | // go deeper to next level | ||
188 | // this level is can be a new controller | ||
189 | // or an item | ||
190 | it = it->firstChild(); | ||
161 | } | 191 | } |
162 | 192 | ||
163 | TmpIsValid = 1; | 193 | TmpIsValid = 1; |
164 | return &(TmpCollection); | 194 | return &(TmpCollection); |
165 | } | 195 | } |
166 | 196 | ||
167 | // pass a connection NodeCollection to be edited | 197 | // pass a connection NodeCollection to be edited |
168 | void EditConnection::setConnection( NodeCollection * NC ) { | 198 | void EditConnection::setConnection( NodeCollection * NC ) { |
169 | ANetNodeInstance * NNI; | 199 | ANetNodeInstance * NNI; |
170 | ANetNode * NN; | 200 | ANetNode * NN; |
171 | 201 | ||
172 | SelectedNodes = NC; | 202 | SelectedNodes = NC; |
173 | Name_LE->setText( NC->name() ); | 203 | Name_LE->setText( NC->name() ); |
174 | NNI = NC->first(); | 204 | NNI = NC->first(); |
175 | 205 | ||
176 | // show configure tabl | 206 | // show configure tabl |
177 | Tab_TB->setCurrentPage( 1 ); | 207 | Tab_TB->setCurrentPage( 1 ); |
178 | 208 | ||
179 | // valid colledction | 209 | // valid colledction |
180 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); | 210 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); |
181 | Setup_FRM->setEnabled( FALSE ); | 211 | Setup_FRM->setEnabled( FALSE ); |
182 | 212 | ||
183 | // select items in collection | 213 | // select items in collection |
184 | QListViewItem * it = Nodes_LV->firstChild(); | 214 | QListViewItem * it = Nodes_LV->firstChild(); |
185 | bool Found; | 215 | bool Found; |
186 | 216 | ||
187 | TmpIsValid = 0; | 217 | TmpIsValid = 0; |
188 | 218 | ||
189 | while ( it ) { | 219 | while ( it ) { |
190 | // listitem corresponds to netnode | ||
191 | NN = (*Mapping)[it]; | 220 | NN = (*Mapping)[it]; |
192 | if( NN == 0 ) { | 221 | if( NN == 0 ) { |
193 | // child is controller -> has sub radio | 222 | // this item is a controller -> |
194 | QString Ctr = it->text(0); | 223 | // has radio items as children -> |
195 | // check if one radio is selected | 224 | // find selected one |
196 | it = it->firstChild(); | 225 | it = it->firstChild(); |
197 | Found = 0; | 226 | Found = 0; |
198 | while( it ) { | 227 | while( it ) { |
199 | if( NNI && it->text(0) == NNI->nodeClass()->name() ) { | 228 | if( NNI && it->text(0) == NNI->nodeClass()->name() ) { |
200 | // this radio is part of the collection | 229 | // this radio is part of the collection |
201 | ((QCheckListItem *)it)->setOn( 1 ); | 230 | ((QCheckListItem *)it)->setOn( 1 ); |
202 | updateGUI( it, NNI->nodeClass() ); | 231 | updateGUI( it, NNI->nodeClass() ); |
203 | // check its children | 232 | // check its children |
204 | Found = 1; | 233 | Found = 1; |
205 | it = it->firstChild(); | 234 | it = it->firstChild(); |
206 | NNI = SelectedNodes->next(); | 235 | NNI = SelectedNodes->next(); |
207 | // do not bother to check other items | 236 | // do not bother to check other items |
208 | break; | 237 | break; |
209 | } | 238 | } |
210 | it = it->nextSibling(); | 239 | it = it->nextSibling(); |
211 | } | 240 | } |
241 | |||
212 | if( ! Found ) { | 242 | if( ! Found ) { |
213 | // this means that this level is NOT present in collection | 243 | // this means that this level is NOT present in collection |
214 | // probably INCOMPATIBEL collection OR Missing plugin | 244 | // probably INCOMPATIBEL collection OR Missing plugin |
215 | QMessageBox::warning( | 245 | QMessageBox::warning( |
216 | 0, | 246 | 0, |
217 | tr( "Error presentig Connection" ), | 247 | tr( "Error presentig Connection" ), |
218 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). | 248 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). |
219 | arg(Ctr) ); | 249 | arg(NNI->nodeClass()->name()) ); |
220 | return; | 250 | return; |
221 | } | 251 | } |
252 | |||
253 | // it now contains selected radio | ||
254 | NN = (*Mapping)[it]; | ||
222 | } else { | 255 | } else { |
223 | // automatic item -> check children | 256 | // automatic selection |
257 | if( NNI == 0 || it->text(0) != NNI->nodeClass()->name() ) { | ||
258 | // should exist and be the same | ||
259 | if( NNI ) { | ||
260 | QMessageBox::warning( | ||
261 | 0, | ||
262 | tr( "Error presentig Connection" ), | ||
263 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). | ||
264 | arg(NNI->nodeClass()->name()) ); | ||
265 | } else { | ||
266 | QMessageBox::warning( | ||
267 | 0, | ||
268 | tr( "Error presentig Connection" ), | ||
269 | tr( "<p>Missing connection\"<i>%1</i>\"</p>" ). | ||
270 | arg(it->text(0)) ); | ||
271 | } | ||
272 | return; | ||
273 | } | ||
224 | it = it->firstChild(); | 274 | it = it->firstChild(); |
225 | } | 275 | } |
226 | } | 276 | } |
227 | } | 277 | } |
228 | 278 | ||
229 | // get result of editing (either new OR updated collection | 279 | // get result of editing (either new OR updated collection |
230 | NodeCollection * EditConnection::connection( void ) { | 280 | NodeCollection * EditConnection::connection( void ) { |
231 | 281 | ||
232 | if( SelectedNodes == 0 ) { | 282 | if( SelectedNodes == 0 ) { |
233 | // new collection | 283 | // new collection |
234 | SelectedNodes = new NodeCollection; | 284 | SelectedNodes = new NodeCollection; |
235 | } | 285 | } |
236 | 286 | ||
237 | // clean out old entries | 287 | // clean out old entries |
238 | SelectedNodes->clear(); | 288 | SelectedNodes->clear(); |
239 | 289 | ||
240 | // transfer | 290 | // transfer |
241 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 291 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
242 | it.current(); | 292 | it.current(); |
243 | ++it ) { | 293 | ++it ) { |
244 | SelectedNodes->append( it.current() ); | 294 | SelectedNodes->append( it.current() ); |
245 | } | 295 | } |
246 | 296 | ||
247 | if( TmpCollection.isModified() ) | 297 | if( TmpCollection.isModified() ) |
248 | SelectedNodes->setModified( 1 ); | 298 | SelectedNodes->setModified( 1 ); |
249 | 299 | ||
250 | if( SelectedNodes->name() != Name_LE->text() ) { | 300 | if( SelectedNodes->name() != Name_LE->text() ) { |
251 | SelectedNodes->setName( Name_LE->text() ); | 301 | SelectedNodes->setName( Name_LE->text() ); |
252 | SelectedNodes->setModified( 1 ); | 302 | SelectedNodes->setModified( 1 ); |
253 | } | 303 | } |
254 | 304 | ||
255 | return SelectedNodes; | 305 | return SelectedNodes; |
256 | } | 306 | } |
257 | 307 | ||
258 | // Build device tree -> start | 308 | // Build device tree -> start |
259 | void EditConnection::buildFullTree( void ) { | 309 | void EditConnection::buildFullTree( void ) { |
260 | ANetNode * NN; | 310 | ANetNode * NN; |
261 | 311 | ||
262 | // toplevel item | 312 | // toplevel item |
263 | MyQCheckListItem * TheTop = new MyQCheckListItem( | 313 | MyQCheckListItem * TheTop = new MyQCheckListItem( |
264 | Nodes_LV, | 314 | Nodes_LV, |
265 | NSResources->netNode2Name("fullsetup"), | 315 | NSResources->netNode2Name("fullsetup"), |
266 | QCheckListItem::Controller ); | 316 | QCheckListItem::Controller ); |
267 | TheTop->setOpen( TRUE ); | 317 | TheTop->setOpen( TRUE ); |
268 | Description_LBL->setText( | 318 | Description_LBL->setText( |
269 | NSResources->netNode2Description( "fullsetup" ) ); | 319 | NSResources->netNode2Description( "fullsetup" ) ); |
270 | Nodes_LV->setSelected( TheTop, TRUE ); | 320 | Nodes_LV->setSelected( TheTop, TRUE ); |
271 | 321 | ||
272 | // find all Nodes that care toplevel nodes -> ie provide | 322 | // find all Nodes that are toplevel nodes -> ie provide |
273 | // TCP/IP Connection | 323 | // TCP/IP Connection |
274 | for( QDictIterator<NetNode_t> Iter(NSResources->netNodes()); | 324 | for( QDictIterator<NetNode_t> Iter(NSResources->netNodes()); |
275 | Iter.current(); | 325 | Iter.current(); |
276 | ++Iter ) { | 326 | ++Iter ) { |
277 | 327 | ||
278 | NN = Iter.current()->NetNode; | 328 | NN = Iter.current()->NetNode; |
279 | 329 | ||
280 | if( ! NN->isToplevel() ) { | 330 | if( ! NN->isToplevel() ) { |
281 | continue; | 331 | continue; |
282 | } | 332 | } |
283 | 333 | ||
284 | MyQCheckListItem * it = new MyQCheckListItem( TheTop, | 334 | MyQCheckListItem * it = new MyQCheckListItem( TheTop, |
285 | NN->name(), | 335 | NN->name(), |
286 | QCheckListItem::RadioButton ); | 336 | QCheckListItem::RadioButton ); |
287 | it->setPixmap( 0, NSResources->getPixmap( "Devices/commprofile" ) ); | 337 | it->setPixmap( 0, |
338 | NSResources->getPixmap( NN->pixmapName() ) | ||
339 | ); | ||
288 | // remember that this node maps to this listitem | 340 | // remember that this node maps to this listitem |
289 | Mapping->insert( it, NN ); | 341 | Mapping->insert( it, NN ); |
290 | buildSubTree( it, NN ); | 342 | buildSubTree( it, NN ); |
291 | } | 343 | } |
292 | } | 344 | } |
293 | 345 | ||
294 | // Build device tree -> help function | 346 | // Build device tree -> help function |
295 | void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { | 347 | void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { |
296 | ANetNode::NetNodeList & NNL = NN->alternatives(); | 348 | ANetNode::NetNodeList & NNL = NN->alternatives(); |
297 | 349 | ||
298 | if( NNL.size() > 1 ) { | 350 | if( NNL.size() > 1 ) { |
299 | // this node has alternatives -> needs radio buttons | 351 | // this node has alternatives -> needs radio buttons |
300 | it = new MyQCheckListItem( | 352 | it = new MyQCheckListItem( |
301 | it, | 353 | it, |
302 | NSResources->netNode2Name(NNL[0]->provides()), | 354 | NSResources->netNode2Name(NN->needs()[0]), |
303 | QCheckListItem::Controller ); | 355 | QCheckListItem::Controller ); |
304 | it->setSelectable( FALSE ); | 356 | it->setSelectable( FALSE ); |
305 | } | 357 | } |
306 | 358 | ||
307 | for ( unsigned int i=0; i < NNL.size(); i++ ) { | 359 | for ( unsigned int i=0; i < NNL.size(); i++ ) { |
308 | QListViewItem * CI; | 360 | QListViewItem * CI; |
309 | if( NNL.size() > 1 ) { | 361 | if( NNL.size() > 1 ) { |
310 | // generate radio buttons | 362 | // generate radio buttons |
311 | CI = new MyQCheckListItem( | 363 | CI = new MyQCheckListItem( |
312 | (QCheckListItem *)it, | 364 | (QCheckListItem *)it, |
313 | NNL[i]->name(), QCheckListItem::RadioButton ); | 365 | NNL[i]->name(), QCheckListItem::RadioButton ); |
314 | // remember that this node maps to this listitem | 366 | // remember that this node maps to this listitem |
315 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); | 367 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); |
316 | Mapping->insert( CI, NNL[i] ); | 368 | Mapping->insert( CI, NNL[i] ); |
317 | CI->setSelectable( FALSE ); | 369 | CI->setSelectable( FALSE ); |
318 | } else { | 370 | } else { |
319 | // Single item | 371 | // Single item |
320 | CI = new MyQListViewItem( it, NNL[i]->name() ); | 372 | CI = new MyQListViewItem( it, NNL[i]->name() ); |
321 | // remember that this node maps to this listitem | 373 | // remember that this node maps to this listitem |
322 | Mapping->insert( CI, NNL[i] ); | 374 | Mapping->insert( CI, NNL[i] ); |
323 | CI->setSelectable( FALSE ); | 375 | CI->setSelectable( FALSE ); |
324 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); | 376 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); |
325 | } | 377 | } |
326 | buildSubTree( CI, NNL[i] ); | 378 | buildSubTree( CI, NNL[i] ); |
327 | } | 379 | } |
328 | } | 380 | } |
329 | 381 | ||
330 | // Clicked ok OK button | 382 | // Clicked ok OK button |
331 | void EditConnection::accept( void ) { | 383 | void EditConnection::accept( void ) { |
332 | if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) { | 384 | if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) { |
333 | QMessageBox::warning( | 385 | QMessageBox::warning( |
334 | 0, | 386 | 0, |
335 | tr( "Closing Connection Setup" ), | 387 | tr( "Closing Connection Setup" ), |
336 | tr( "Definition not complete or no name" ) ); | 388 | tr( "Definition not complete or no name" ) ); |
337 | return; | 389 | return; |
338 | } | 390 | } |
339 | 391 | ||
340 | // check if all devices have acceptable input | 392 | // check if all devices have acceptable input |
341 | getTmpCollection(); | 393 | getTmpCollection(); |
342 | { ANetNodeInstance * NNI; | 394 | { ANetNodeInstance * NNI; |
343 | QString S; | 395 | QString S; |
344 | 396 | ||
345 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 397 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
346 | it.current(); | 398 | it.current(); |
347 | ++it ) { | 399 | ++it ) { |
348 | NNI = it.current(); | 400 | NNI = it.current(); |
349 | // widget must show its own problems | 401 | // widget must show its own problems |
350 | S = NNI->acceptable(); | 402 | S = NNI->acceptable(); |
351 | if( ! S.isEmpty() ) { | 403 | if( ! S.isEmpty() ) { |
352 | QMessageBox::warning( | 404 | QMessageBox::warning( |
353 | 0, | 405 | 0, |
354 | tr( "Cannot save" ), | 406 | tr( "Cannot save" ), |
355 | S ); | 407 | S ); |
356 | return; | 408 | return; |
357 | } | 409 | } |
358 | NNI->commit(); | 410 | NNI->commit(); |
359 | 411 | ||
360 | if( NNI->isModified() ) { | 412 | if( NNI->isModified() ) { |
361 | TmpCollection.setModified( 1 ); | 413 | TmpCollection.setModified( 1 ); |
362 | // commit the data | 414 | // commit the data |
363 | } | 415 | } |
364 | } | 416 | } |
365 | } | 417 | } |
366 | 418 | ||
367 | QDialog::accept(); | 419 | QDialog::accept(); |
368 | } | 420 | } |
369 | 421 | ||
370 | // triggered by CB | 422 | // triggered by CB |
371 | void EditConnection::SLOT_AutoCollapse( bool b ) { | 423 | void EditConnection::SLOT_AutoCollapse( bool b ) { |
372 | AutoCollapse = b; | 424 | AutoCollapse = b; |
373 | } | 425 | } |
374 | 426 | ||
375 | // clicked on node in tree -> update GUI | 427 | // clicked on node in tree -> update GUI |
376 | void EditConnection::SLOT_SelectNode( QListViewItem * it ) { | 428 | void EditConnection::SLOT_SelectNode( QListViewItem * it ) { |
377 | ANetNode * NN; | 429 | ANetNode * NN; |
378 | if( it == 0 || it->depth() == 0 ) { | 430 | if( it == 0 || it->depth() == 0 ) { |
379 | Description_LBL->setText( | 431 | Description_LBL->setText( |
380 | NSResources->netNode2Description( "fullsetup" ) ); | 432 | NSResources->netNode2Description( "fullsetup" ) ); |
381 | // topevel or no selection | 433 | // topevel or no selection |
382 | return; | 434 | return; |
383 | } | 435 | } |
384 | 436 | ||
385 | // store conversion from lvitem to node | 437 | // store conversion from lvitem to node |
386 | NN = (*Mapping)[ it ]; | 438 | NN = (*Mapping)[ it ]; |
387 | 439 | ||
388 | if( ! NN ) { | 440 | if( ! NN ) { |
389 | // intermediate node | 441 | // intermediate node |
390 | NN = (*Mapping)[ it->firstChild() ]; | 442 | NN = (*Mapping)[ it->parent() ]; |
391 | if( NN ) { | 443 | if( NN ) { |
392 | // figure out type of this node -> produce mesage | 444 | // figure out type of this node -> produce mesage |
393 | Description_LBL->setText( NSResources->netNode2Description(NN->provides()) ); | 445 | Description_LBL->setText( NSResources->netNode2Description( |
446 | NN->needs()[0]) ); | ||
394 | } else { | 447 | } else { |
395 | Description_LBL->setText( "" ); | 448 | Description_LBL->setText( "" ); |
396 | } | 449 | } |
397 | return; | 450 | return; |
398 | } | 451 | } |
399 | 452 | ||
400 | Description_LBL->setText( NN->nodeDescription() ); | 453 | Description_LBL->setText( NN->nodeDescription() ); |
401 | 454 | ||
402 | if( ! it->isSelectable() ) { | 455 | if( ! it->isSelectable() ) { |
403 | return; | 456 | return; |
404 | } | 457 | } |
405 | 458 | ||
406 | if( ! ((QCheckListItem *)it)->isOn() ) { | 459 | if( ! ((QCheckListItem *)it)->isOn() ) { |
407 | // clicked on line but NOT on Check or Radio item | 460 | // clicked on line but NOT on Check or Radio item |
408 | return; | 461 | return; |
409 | } | 462 | } |
410 | 463 | ||
411 | // item has really changed -> update | 464 | // item has really changed -> update |
412 | TmpIsValid = 0; | 465 | TmpIsValid = 0; |
413 | updateGUI( it, NN ); | 466 | updateGUI( it, NN ); |
414 | } | 467 | } |
415 | 468 | ||
416 | // cliecked on TAB to go to setup | 469 | // cliecked on TAB to go to setup |
417 | void EditConnection::SLOT_AlterTab( const QString & S ) { | 470 | void EditConnection::SLOT_AlterTab( const QString & S ) { |
418 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { | 471 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { |
419 | // switched to setup -> update CB and populate ws with | 472 | // switched to setup -> update CB and populate ws with |
420 | // forms for devices | 473 | // forms for devices |
421 | 474 | ||
422 | if( ! TmpIsValid ) { | 475 | if( ! TmpIsValid ) { |
423 | getTmpCollection(); | 476 | getTmpCollection(); |
424 | 477 | ||
425 | // clear CB and Ws | 478 | // clear CB and Ws |
426 | { QWidget * W; | 479 | { QWidget * W; |
427 | int i = 0; | 480 | int i = 0; |
428 | 481 | ||
429 | Devices_CB->clear(); | 482 | Devices_CB->clear(); |
430 | while( ( W = Setup_WS->widget( i ) ) ) { | 483 | while( ( W = Setup_WS->widget( i ) ) ) { |
431 | Setup_WS->removeWidget( W ); | 484 | Setup_WS->removeWidget( W ); |
432 | i ++; | 485 | i ++; |
433 | } | 486 | } |
434 | } | 487 | } |
435 | 488 | ||
436 | // update CB | 489 | // update CB |
437 | // and populate WidgetStack | 490 | // and populate WidgetStack |
438 | { ANetNodeInstance * NNI; | 491 | { ANetNodeInstance * NNI; |
439 | QListIterator<ANetNodeInstance> it(TmpCollection); | 492 | QListIterator<ANetNodeInstance> it(TmpCollection); |
440 | int i = 0; | 493 | int i = 0; |
441 | QWidget * W; | 494 | QWidget * W; |
442 | 495 | ||
443 | for ( ; it.current(); ++it ) { | 496 | for ( ; it.current(); ++it ) { |
444 | NNI = it.current(); | 497 | NNI = it.current(); |
445 | Devices_CB->insertItem( | 498 | Devices_CB->insertItem( |
446 | NSResources->getPixmap( NNI->nodeClass()->pixmapName() ), | 499 | NSResources->getPixmap( NNI->nodeClass()->pixmapName() ), |
447 | NNI->nodeClass()->name() | 500 | NNI->nodeClass()->name() |
448 | ); | 501 | ); |
449 | 502 | ||
450 | // add edit widget | 503 | // add edit widget |
451 | W = NNI->edit( Setup_WS ); | 504 | W = NNI->edit( Setup_WS ); |
452 | if( ! W) { | 505 | if( ! W) { |
453 | W = new QLabel( Setup_WS, | 506 | W = new QLabel( Setup_WS, |
454 | tr("No configuration required")); | 507 | tr("No configuration required")); |
455 | } | 508 | } |
456 | Setup_WS->addWidget( W , i ); | 509 | Setup_WS->addWidget( W , i ); |
457 | i ++; | 510 | i ++; |
458 | } | 511 | } |
459 | } | 512 | } |
460 | Setup_WS->raiseWidget( 0 ); | 513 | Setup_WS->raiseWidget( 0 ); |
461 | } // still valid | 514 | } // still valid |
462 | } | 515 | } |
463 | } | 516 | } |
464 | 517 | ||
465 | // update visual feedback of selection state | 518 | // update visual feedback of selection state |
466 | void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { | 519 | void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { |
467 | 520 | ||
468 | bool HCC = haveCompleteConfig( it ); | 521 | bool HCC = haveCompleteConfig( it ); |
469 | Tab_TB->setTabEnabled( Setup_FRM, HCC ); | 522 | Tab_TB->setTabEnabled( Setup_FRM, HCC ); |
470 | Setup_FRM->setEnabled( HCC ); | 523 | Setup_FRM->setEnabled( HCC ); |
471 | 524 | ||
472 | // disable children of all siblings at same level | 525 | // disable children of all siblings at same level |
473 | QListViewItem * Sbl = it->parent()->firstChild(); | 526 | QListViewItem * Sbl = it->parent()->firstChild(); |
474 | while( Sbl ) { | 527 | while( Sbl ) { |
475 | if ( Sbl != it ) { | 528 | if ( Sbl != it ) { |
476 | disableTree( Sbl->firstChild(), FALSE ); | 529 | disableTree( Sbl->firstChild(), FALSE ); |
477 | Sbl->setSelectable( TRUE ); | 530 | Sbl->setSelectable( TRUE ); |
478 | if( AutoCollapse ) | 531 | if( AutoCollapse ) |
479 | Sbl->setOpen( FALSE ); | 532 | Sbl->setOpen( FALSE ); |
480 | } | 533 | } |
481 | Sbl = Sbl->nextSibling(); | 534 | Sbl = Sbl->nextSibling(); |
482 | } | 535 | } |
483 | 536 | ||
484 | // enable selected path (as deep as it goes | 537 | // enable selected path (as deep as it goes |
485 | it->setOpen( TRUE ); | 538 | it->setOpen( TRUE ); |
486 | enablePath( it->firstChild(), | 539 | enablePath( it->firstChild(), |
487 | (it->depth()==1) ? | 540 | (it->depth()==1) ? |
488 | 1 : // toplevel always alternatives | 541 | 1 : // toplevel always alternatives |
489 | (NN->alternatives().size() > 1) ); | 542 | (NN->alternatives().size() > 1) ); |
490 | } | 543 | } |
491 | 544 | ||
492 | void EditConnection::disableTree( QListViewItem * it, bool Mode ) { | 545 | void EditConnection::disableTree( QListViewItem * it, bool Mode ) { |
493 | while( it ) { | 546 | while( it ) { |
494 | // disable sbl's chidren | 547 | // disable sbl's chidren |
495 | it->setSelectable( Mode ); | 548 | it->setSelectable( Mode ); |
496 | if( AutoCollapse ) | 549 | if( AutoCollapse ) |
497 | it->setOpen( Mode ); | 550 | it->setOpen( Mode ); |
498 | disableTree( it->firstChild(), Mode ); | 551 | disableTree( it->firstChild(), Mode ); |
499 | it = it->nextSibling(); | 552 | it = it->nextSibling(); |
500 | } | 553 | } |
501 | } | 554 | } |
502 | 555 | ||
503 | // pah : ParentHasAlternatives | 556 | // pah : ParentHasAlternatives |
504 | void EditConnection::enablePath( QListViewItem * it, bool pha ) { | 557 | void EditConnection::enablePath( QListViewItem * it, bool pha ) { |
505 | while( it ) { | 558 | while( it ) { |
506 | ANetNode * NN; | 559 | ANetNode * NN; |
507 | NN = (*Mapping)[it]; | 560 | NN = (*Mapping)[it]; |
508 | if( NN ) { | 561 | if( NN ) { |
509 | if( pha ) { | 562 | if( pha ) { |
510 | bool doOn = ((QCheckListItem *)it)->isOn(); | 563 | bool doOn = ((QCheckListItem *)it)->isOn(); |
511 | // we are a checklistitem for sure | 564 | // we are a checklistitem for sure |
512 | it->setSelectable( TRUE ); | 565 | it->setSelectable( TRUE ); |
513 | if( AutoCollapse && ! doOn ) | 566 | if( AutoCollapse && ! doOn ) |
514 | it->setOpen( doOn ); | 567 | it->setOpen( doOn ); |
515 | if( doOn ) { | 568 | if( doOn ) { |
516 | // selected alternative | 569 | // selected alternative |
517 | enablePath( it->firstChild(), | 570 | enablePath( it->firstChild(), |
518 | NN->alternatives().size() > 1); | 571 | NN->alternatives().size() > 1); |
519 | } else { | 572 | } else { |
520 | // non-selected alternative | 573 | // non-selected alternative |
521 | disableTree( it->firstChild(), FALSE); | 574 | disableTree( it->firstChild(), FALSE); |
522 | } | 575 | } |
523 | } else { | 576 | } else { |
524 | // we are single subitem | 577 | // we are single subitem |
525 | it->setSelectable( TRUE ); | 578 | it->setSelectable( TRUE ); |
526 | it->setOpen( TRUE ); | 579 | it->setOpen( TRUE ); |
527 | enablePath( it->firstChild(), | 580 | enablePath( it->firstChild(), |
528 | NN->alternatives().size() > 1); | 581 | NN->alternatives().size() > 1); |
529 | } | 582 | } |
530 | } else { | 583 | } else { |
531 | // controller node | 584 | // controller node |
532 | it->setSelectable( TRUE ); | 585 | it->setSelectable( TRUE ); |
533 | it->setOpen( TRUE ); | 586 | it->setOpen( TRUE ); |
534 | enablePath( it->firstChild(), pha ); | 587 | enablePath( it->firstChild(), pha ); |
535 | } | 588 | } |
536 | it = it->nextSibling(); | 589 | it = it->nextSibling(); |
537 | } | 590 | } |
538 | } | 591 | } |
539 | 592 | ||
540 | // do we have a complete configuration (all needs are provided for ?) | 593 | // do we have a complete configuration (all needs are provided for ?) |
541 | bool EditConnection::haveCompleteConfig( QListViewItem * it ) { | 594 | bool EditConnection::haveCompleteConfig( QListViewItem * it ) { |
542 | if( it == 0 || ((QCheckListItem *)it)->isOn() ) { | 595 | |
543 | // check children | 596 | // check if all below this level is selected |
544 | it = (it) ? it->firstChild() : Nodes_LV->firstChild() ; | 597 | it = ( it ) ?it : Nodes_LV->firstChild(); |
545 | while ( it ) { | 598 | ANetNode *NN; |
546 | if( ((QCheckListItem *)it)->type() == | 599 | bool Found; |
547 | QCheckListItem::Controller ) { | 600 | |
548 | // child is controller -> has sub radio | 601 | while ( it ) { |
549 | // check if one radio is selected | 602 | NN = (*Mapping)[it]; |
550 | it = it->firstChild(); | 603 | if( NN == 0 ) { |
551 | while( it ) { | 604 | // this item is a controller -> |
552 | if( ((QCheckListItem *)it)->isOn() ) { | 605 | // has radio items as children -> |
553 | // this radio is selected -> go deeper | 606 | // find selected one |
554 | it = it->firstChild(); | 607 | it = it->firstChild(); |
555 | if( ! it ) { | 608 | Found = 0; |
556 | // was deepest level | 609 | while( it ) { |
557 | return 1; | 610 | if( ((QCheckListItem *)it)->isOn() ) { |
558 | } | 611 | Found = 1; |
559 | // do not bother to check other items | 612 | // go deeper |
560 | break; | 613 | it = it->firstChild(); |
561 | } | 614 | break; |
562 | it = it->nextSibling(); | ||
563 | } | ||
564 | if( ! it ) { | ||
565 | // no radio selected | ||
566 | return 0; | ||
567 | } | 615 | } |
568 | } else { | 616 | it = it->nextSibling(); |
569 | // check children | ||
570 | it = it->firstChild(); | ||
571 | } | 617 | } |
618 | |||
619 | if( ! Found ) { | ||
620 | return 0; // no not complete -> a radio should have been chkd | ||
621 | } | ||
622 | |||
623 | // it now contains selected radio | ||
624 | NN = (*Mapping)[it]; | ||
625 | } else { | ||
626 | // automatic selection | ||
627 | it = it->firstChild(); | ||
572 | } | 628 | } |
573 | // deepest level -> all is still OK | 629 | } |
574 | return 1; | 630 | return 1; |
575 | } // was not ON | ||
576 | return 0; | ||
577 | } | 631 | } |
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp index 9483e22..485cad3 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.cpp +++ b/noncore/settings/networksettings2/irda/irda_NN.cpp | |||
@@ -1,49 +1,54 @@ | |||
1 | #include "irda_NN.h" | 1 | #include "irda_NN.h" |
2 | #include "irda_NNI.h" | 2 | #include "irda_NNI.h" |
3 | 3 | ||
4 | static const char * IRDANeeds[] = | 4 | static const char * IRDANeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | static const char * IRDAProvides[] = | ||
9 | { "line", | ||
10 | 0 | ||
11 | }; | ||
12 | |||
8 | /** | 13 | /** |
9 | * Constructor, find all of the possible interfaces | 14 | * Constructor, find all of the possible interfaces |
10 | */ | 15 | */ |
11 | IRDANetNode::IRDANetNode() : ANetNode(tr("Infrared link")) { | 16 | IRDANetNode::IRDANetNode() : ANetNode(tr("Infrared link")) { |
12 | } | 17 | } |
13 | 18 | ||
14 | /** | 19 | /** |
15 | * Delete any interfaces that we own. | 20 | * Delete any interfaces that we own. |
16 | */ | 21 | */ |
17 | IRDANetNode::~IRDANetNode(){ | 22 | IRDANetNode::~IRDANetNode(){ |
18 | } | 23 | } |
19 | 24 | ||
20 | const QString IRDANetNode::nodeDescription(){ | 25 | const QString IRDANetNode::nodeDescription(){ |
21 | return tr("\ | 26 | return tr("\ |
22 | <p>Sets up a infra red serial link.</p>\ | 27 | <p>Sets up a infra red serial link.</p>\ |
23 | " | 28 | " |
24 | ); | 29 | ); |
25 | } | 30 | } |
26 | 31 | ||
27 | ANetNodeInstance * IRDANetNode::createInstance( void ) { | 32 | ANetNodeInstance * IRDANetNode::createInstance( void ) { |
28 | return new AIRDA( this ); | 33 | return new AIRDA( this ); |
29 | } | 34 | } |
30 | 35 | ||
31 | const char ** IRDANetNode::needs( void ) { | 36 | const char ** IRDANetNode::needs( void ) { |
32 | return IRDANeeds; | 37 | return IRDANeeds; |
33 | } | 38 | } |
34 | 39 | ||
35 | const char * IRDANetNode::provides( void ) { | 40 | const char ** IRDANetNode::provides( void ) { |
36 | return "line"; | 41 | return IRDAProvides; |
37 | } | 42 | } |
38 | 43 | ||
39 | void IRDANetNode::setSpecificAttribute( QString & , QString & ) { | 44 | void IRDANetNode::setSpecificAttribute( QString & , QString & ) { |
40 | } | 45 | } |
41 | 46 | ||
42 | void IRDANetNode::saveSpecificAttribute( QTextStream & ) { | 47 | void IRDANetNode::saveSpecificAttribute( QTextStream & ) { |
43 | } | 48 | } |
44 | 49 | ||
45 | extern "C" { | 50 | extern "C" { |
46 | void create_plugin( QList<ANetNode> & PNN ) { | 51 | void create_plugin( QList<ANetNode> & PNN ) { |
47 | PNN.append( new IRDANetNode() ); | 52 | PNN.append( new IRDANetNode() ); |
48 | } | 53 | } |
49 | } | 54 | } |
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 | |||
@@ -1,36 +1,36 @@ | |||
1 | #ifndef IRDA_NETNODE_H | 1 | #ifndef IRDA_NETNODE_H |
2 | #define IRDA_NETNODE_H | 2 | #define IRDA_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AIRDA; | 6 | class AIRDA; |
7 | 7 | ||
8 | class IRDANetNode : public ANetNode { | 8 | class IRDANetNode : public ANetNode { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | IRDANetNode(); | 14 | IRDANetNode(); |
15 | virtual ~IRDANetNode(); | 15 | virtual ~IRDANetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/irda"; } | 18 | { return "Devices/irda"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
21 | virtual ANetNodeInstance * createInstance( void ); | 21 | virtual ANetNodeInstance * createInstance( void ); |
22 | virtual const char ** needs( void ); | 22 | virtual const char ** needs( void ); |
23 | virtual const char * provides( void ); | 23 | virtual const char ** provides( void ); |
24 | 24 | ||
25 | private: | 25 | private: |
26 | 26 | ||
27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
28 | virtual void saveSpecificAttribute( QTextStream & TS ); | 28 | virtual void saveSpecificAttribute( QTextStream & TS ); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | extern "C" | 31 | extern "C" |
32 | { | 32 | { |
33 | void create_plugin( QList<ANetNode> & PNN ); | 33 | void create_plugin( QList<ANetNode> & PNN ); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #endif | 36 | #endif |
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 @@ | |||
1 | #ifndef IRDA_DATA_H | 1 | #ifndef IRDA_DATA_H |
2 | #define IRDA_DATA_H | 2 | #define IRDA_DATA_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | typedef struct IRDAData { | 6 | class IRDAData { |
7 | public : | ||
7 | QString Device; | 8 | QString Device; |
8 | QString LockFile; | 9 | QString LockFile; |
9 | long Speed; | 10 | long Speed; |
10 | short Parity; | 11 | short Parity; |
11 | short DataBits; | 12 | short DataBits; |
12 | short StopBits; | 13 | short StopBits; |
13 | bool HardwareControl; | 14 | bool HardwareControl; |
14 | bool SoftwareControl; | 15 | bool SoftwareControl; |
15 | 16 | ||
16 | } IRDAData_t; | 17 | } ; |
17 | 18 | ||
18 | #endif | 19 | #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 @@ | |||
1 | #include <asline.h> | 1 | #include <netnode.h> |
2 | #include "irdadata.h" | 2 | #include "irdadata.h" |
3 | 3 | ||
4 | class IRDARun : public AsLine { | 4 | class IRDARun : public RuntimeInfo { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | IRDARun( ANetNodeInstance * NNI, | 8 | IRDARun( ANetNodeInstance * NNI, |
9 | IRDAData & Data ) : AsLine( NNI ) | 9 | IRDAData & Data ) : RuntimeInfo( NNI ) |
10 | { } | 10 | { } |
11 | 11 | ||
12 | virtual AsLine * asLine( void ) | 12 | virtual RuntimeInfo * line( void ) |
13 | { return (AsLine *)this; } | 13 | { return this; } |
14 | 14 | ||
15 | virtual QString deviceFile( void ) | 15 | virtual QString deviceFile( void ) |
16 | { return QString( "/dev/irda" ); } | 16 | { return QString( "/dev/irda" ); } |
17 | 17 | ||
18 | protected : | 18 | State_t detectState( void ) |
19 | 19 | { return Unknown; } | |
20 | void detectState( NodeCollection * ) | ||
21 | { } | ||
22 | 20 | ||
23 | bool setState( NodeCollection * , Action_t, bool ) | 21 | protected : |
24 | { return 0; } | ||
25 | 22 | ||
26 | bool canSetState( State_t , Action_t ) | 23 | QString setMyState( NodeCollection * , Action_t, bool ) |
27 | { return 0; } | 24 | { return QString(); } |
28 | }; | 25 | }; |
diff --git a/noncore/settings/networksettings2/irda/opie-networksettings2plugin-irda.control b/noncore/settings/networksettings2/irda/opie-networksettings2plugin-irda.control index 938bee5..4afbbcf 100644 --- a/noncore/settings/networksettings2/irda/opie-networksettings2plugin-irda.control +++ b/noncore/settings/networksettings2/irda/opie-networksettings2plugin-irda.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-networksettingsplugin2-irda | 1 | Package: opie-networksettings2plugin-irda |
2 | Files: plugins/networksettings2/libirda.so* | 2 | Files: plugins/networksettings2/libirda.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Network settings irda plugin. | 8 | Description: Network settings irda plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,71 +1,77 @@ | |||
1 | #include "lancard_NN.h" | 1 | #include "lancard_NN.h" |
2 | #include "lancard_NNI.h" | 2 | #include "lancard_NNI.h" |
3 | 3 | ||
4 | static const char * LanCardNeeds[] = | 4 | static const char * LanCardNeeds[] = |
5 | { 0 }; | 5 | { 0 |
6 | }; | ||
7 | |||
8 | static const char * LanCardProvides[] = | ||
9 | { "device", | ||
10 | 0 | ||
11 | }; | ||
6 | 12 | ||
7 | /** | 13 | /** |
8 | * Constructor, find all of the possible interfaces | 14 | * Constructor, find all of the possible interfaces |
9 | */ | 15 | */ |
10 | LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() { | 16 | LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() { |
11 | InstanceCount = 2; | 17 | InstanceCount = 2; |
12 | } | 18 | } |
13 | 19 | ||
14 | /** | 20 | /** |
15 | * Delete any interfaces that we own. | 21 | * Delete any interfaces that we own. |
16 | */ | 22 | */ |
17 | LanCardNetNode::~LanCardNetNode(){ | 23 | LanCardNetNode::~LanCardNetNode(){ |
18 | } | 24 | } |
19 | 25 | ||
20 | const QString LanCardNetNode::nodeDescription(){ | 26 | const QString LanCardNetNode::nodeDescription(){ |
21 | return tr("\ | 27 | return tr("\ |
22 | <p>Sets up a wired regular LAN card.</p>\ | 28 | <p>Sets up a wired regular LAN card.</p>\ |
23 | <p>Use this to set up 10/100/1000 MBit LAN cards.</p>\ | 29 | <p>Use this to set up 10/100/1000 MBit LAN cards.</p>\ |
24 | " | 30 | " |
25 | ); | 31 | ); |
26 | } | 32 | } |
27 | 33 | ||
28 | ANetNodeInstance * LanCardNetNode::createInstance( void ) { | 34 | ANetNodeInstance * LanCardNetNode::createInstance( void ) { |
29 | return new ALanCard( this ); | 35 | return new ALanCard( this ); |
30 | } | 36 | } |
31 | 37 | ||
32 | 38 | ||
33 | const char ** LanCardNetNode::needs( void ) { | 39 | const char ** LanCardNetNode::needs( void ) { |
34 | return LanCardNeeds; | 40 | return LanCardNeeds; |
35 | } | 41 | } |
36 | 42 | ||
37 | const char * LanCardNetNode::provides( void ) { | 43 | const char ** LanCardNetNode::provides( void ) { |
38 | return "device"; | 44 | return LanCardProvides; |
39 | } | 45 | } |
40 | 46 | ||
41 | QString LanCardNetNode::genNic( long nr ) { | 47 | QString LanCardNetNode::genNic( long nr ) { |
42 | QString S; | 48 | QString S; |
43 | return S.sprintf( "eth%ld", nr ); | 49 | return S.sprintf( "eth%ld", nr ); |
44 | } | 50 | } |
45 | 51 | ||
46 | void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) { | 52 | void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) { |
47 | if( A == "interfacecount" ) { | 53 | if( A == "interfacecount" ) { |
48 | InstanceCount = V.toLong(); | 54 | InstanceCount = V.toLong(); |
49 | } else if ( A == "macaddress" ) { | 55 | } else if ( A == "macaddress" ) { |
50 | NICMACAddresses.append( V ); | 56 | NICMACAddresses.append( V ); |
51 | } | 57 | } |
52 | } | 58 | } |
53 | 59 | ||
54 | void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { | 60 | void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { |
55 | TS << "interfacecount=" | 61 | TS << "interfacecount=" |
56 | << InstanceCount | 62 | << InstanceCount |
57 | << endl; | 63 | << endl; |
58 | for( QStringList::Iterator it = NICMACAddresses.begin(); | 64 | for( QStringList::Iterator it = NICMACAddresses.begin(); |
59 | it != NICMACAddresses.end(); | 65 | it != NICMACAddresses.end(); |
60 | ++it ) { | 66 | ++it ) { |
61 | TS << "macaddress=" | 67 | TS << "macaddress=" |
62 | << (*it) | 68 | << (*it) |
63 | << endl; | 69 | << endl; |
64 | } | 70 | } |
65 | } | 71 | } |
66 | 72 | ||
67 | extern "C" { | 73 | extern "C" { |
68 | void create_plugin( QList<ANetNode> & PNN ) { | 74 | void create_plugin( QList<ANetNode> & PNN ) { |
69 | PNN.append( new LanCardNetNode() ); | 75 | PNN.append( new LanCardNetNode() ); |
70 | } | 76 | } |
71 | } | 77 | } |
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 | |||
@@ -1,50 +1,50 @@ | |||
1 | #ifndef LANCARD_NETNODE_H | 1 | #ifndef LANCARD_NETNODE_H |
2 | #define LANCARD_NETNODE_H | 2 | #define LANCARD_NETNODE_H |
3 | 3 | ||
4 | #include <qstringlist.h> | 4 | #include <qstringlist.h> |
5 | #include "netnode.h" | 5 | #include "netnode.h" |
6 | 6 | ||
7 | class ALanCard; | 7 | class ALanCard; |
8 | 8 | ||
9 | class LanCardNetNode : public ANetNode{ | 9 | class LanCardNetNode : public ANetNode{ |
10 | 10 | ||
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | 14 | ||
15 | LanCardNetNode(); | 15 | LanCardNetNode(); |
16 | virtual ~LanCardNetNode(); | 16 | virtual ~LanCardNetNode(); |
17 | 17 | ||
18 | virtual const QString pixmapName() | 18 | virtual const QString pixmapName() |
19 | { return "Devices/card"; } | 19 | { return "Devices/card"; } |
20 | 20 | ||
21 | virtual QString genNic( long ); | 21 | virtual QString genNic( long ); |
22 | virtual long instanceCount( void ) | 22 | virtual long instanceCount( void ) |
23 | { return InstanceCount; } | 23 | { return InstanceCount; } |
24 | 24 | ||
25 | virtual const QString nodeDescription() ; | 25 | virtual const QString nodeDescription() ; |
26 | virtual ANetNodeInstance * createInstance( void ); | 26 | virtual ANetNodeInstance * createInstance( void ); |
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char ** provides( void ); |
29 | 29 | ||
30 | QStringList & addressesOfNIC( void ) | 30 | QStringList & addressesOfNIC( void ) |
31 | { return NICMACAddresses; } | 31 | { return NICMACAddresses; } |
32 | 32 | ||
33 | private: | 33 | private: |
34 | 34 | ||
35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
36 | virtual void saveSpecificAttribute( QTextStream & TS ); | 36 | virtual void saveSpecificAttribute( QTextStream & TS ); |
37 | 37 | ||
38 | // number of interfaces for this device | 38 | // number of interfaces for this device |
39 | long InstanceCount; | 39 | long InstanceCount; |
40 | 40 | ||
41 | QStringList NICMACAddresses; | 41 | QStringList NICMACAddresses; |
42 | 42 | ||
43 | }; | 43 | }; |
44 | 44 | ||
45 | extern "C" | 45 | extern "C" |
46 | { | 46 | { |
47 | void create_plugin( QList<ANetNode> & PNN ); | 47 | void create_plugin( QList<ANetNode> & PNN ); |
48 | }; | 48 | }; |
49 | 49 | ||
50 | #endif | 50 | #endif |
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 @@ | |||
1 | #ifndef LANCARD_DATA_H | 1 | #ifndef LANCARD_DATA_H |
2 | #define LANCARD_DATA_H | 2 | #define LANCARD_DATA_H |
3 | 3 | ||
4 | #include <qstringlist.h> | 4 | #include <qstringlist.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | 6 | ||
7 | typedef struct LanCardData { | 7 | class LanCardData { |
8 | public : | ||
8 | bool AnyLanCard; | 9 | bool AnyLanCard; |
9 | QStringList HWAddresses; | 10 | QStringList HWAddresses; |
10 | 11 | ||
11 | } LanCardData_t; | 12 | } ; |
12 | 13 | ||
13 | #endif | 14 | #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,192 +1,148 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qtextstream.h> | 2 | #include <qtextstream.h> |
3 | #include <qstringlist.h> | 3 | #include <qstringlist.h> |
4 | #include <resources.h> | 4 | #include <resources.h> |
5 | #include "lancardrun.h" | 5 | #include "lancardrun.h" |
6 | 6 | ||
7 | void LanCardRun::detectState( NodeCollection * NC ) { | 7 | State_t LanCardRun::detectState( void ) { |
8 | 8 | ||
9 | // unavailable : no card found | 9 | // unavailable : no card found |
10 | // available : card found and assigned to us or free | 10 | // available : card found and assigned to us or free |
11 | // up : card found and assigned to us and up | 11 | // up : card found and assigned to us and up |
12 | 12 | ||
13 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 13 | NodeCollection * NC = nodeCollection(); |
14 | QString S = QString( "/tmp/profile-%1.up" ). | ||
15 | arg( NC->number()); | ||
14 | System & Sys = NSResources->system(); | 16 | System & Sys = NSResources->system(); |
15 | InterfaceInfo * Run; | 17 | InterfaceInfo * Run; |
16 | 18 | ||
17 | QFile F( S ); | 19 | QFile F( S ); |
18 | 20 | ||
19 | if( F.open( IO_ReadOnly ) ) { | 21 | if( F.open( IO_ReadOnly ) ) { |
20 | // could open file -> read interface and assign | 22 | // could open file -> read interface and assign |
21 | QString X; | 23 | QString X; |
22 | QTextStream TS(&F); | 24 | QTextStream TS(&F); |
23 | X = TS.readLine(); | 25 | X = TS.readLine(); |
24 | // find interface | 26 | // find interface |
25 | if( handlesInterface( X ) ) { | 27 | if( handlesInterface( X ) ) { |
26 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 28 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
27 | It.current(); | 29 | It.current(); |
28 | ++It ) { | 30 | ++It ) { |
29 | Run = It.current(); | 31 | Run = It.current(); |
30 | if( X == Run->Name ) { | 32 | if( X == Run->Name ) { |
31 | Run->assignNode( netNode() ); | 33 | NC->assignInterface( Run ); |
32 | assignInterface( Run ); | 34 | return IsUp; |
33 | NC->setCurrentState( IsUp ); | ||
34 | return; | ||
35 | } | 35 | } |
36 | } | 36 | } |
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | if( ( Run = assignedInterface() ) ) { | 40 | if( ( Run = NC->assignedInterface() ) ) { |
41 | // we already have an interface assigned -> still present ? | 41 | // we already have an interface assigned -> still present ? |
42 | if( ! Run->IsUp ) { | 42 | if( ! Run->IsUp ) { |
43 | // usb is still free -> keep assignment | 43 | // usb is still free -> keep assignment |
44 | NC->setCurrentState( Available ); | 44 | return Available; |
45 | return; | ||
46 | } // else interface is up but NOT us -> some other profile | 45 | } // else interface is up but NOT us -> some other profile |
47 | } | 46 | } |
48 | 47 | ||
49 | // nothing (valid) assigned to us | 48 | // nothing (valid) assigned to us |
50 | assignInterface( 0 ); | 49 | NC->assignInterface( 0 ); |
51 | 50 | ||
52 | // find possible interface | 51 | // find possible interface |
53 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 52 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
54 | It.current(); | 53 | It.current(); |
55 | ++It ) { | 54 | ++It ) { |
56 | Run = It.current(); | 55 | Run = It.current(); |
57 | if( handlesInterface( *Run ) && | 56 | if( handlesInterface( *Run ) && |
58 | ( Run->CardType == ARPHRD_ETHER | 57 | ( Run->CardType == ARPHRD_ETHER |
59 | #ifdef ARPHRD_IEEE1394 | 58 | #ifdef ARPHRD_IEEE1394 |
60 | || Run->CardType == ARPHRD_IEEE1394 | 59 | || Run->CardType == ARPHRD_IEEE1394 |
61 | #endif | 60 | #endif |
62 | ) && | 61 | ) && |
63 | ! Run->IsUp | 62 | ! Run->IsUp |
64 | ) { | 63 | ) { |
65 | // proper type, and Not UP -> free | 64 | // proper type, and Not UP -> free |
66 | NC->setCurrentState( Off ); | 65 | return Off; |
67 | return; | ||
68 | } | 66 | } |
69 | } | 67 | } |
70 | // no free found | 68 | // no free found |
71 | 69 | ||
72 | NC->setCurrentState( Unavailable ); | 70 | return Unavailable; |
73 | |||
74 | } | 71 | } |
75 | 72 | ||
76 | bool LanCardRun::setState( NodeCollection * NC, Action_t A, bool ) { | 73 | QString LanCardRun::setMyState( NodeCollection * NC, Action_t A, bool ) { |
77 | 74 | ||
78 | // we only handle activate and deactivate | 75 | if( A == Activate ) { |
79 | switch( A ) { | 76 | InterfaceInfo * N = getInterface(); |
80 | case Activate : | 77 | |
81 | { | 78 | if( ! N ) { |
82 | if( NC->currentState() != Off ) { | 79 | // no interface available |
83 | return 0; | 80 | NC->setCurrentState( Unavailable ); |
84 | } | 81 | return tr("No interface found"); |
85 | InterfaceInfo * N = getInterface(); | 82 | } |
86 | if( ! N ) { | 83 | |
87 | // no interface available | 84 | // because we were OFF the interface |
88 | NC->setCurrentState( Unavailable ); | 85 | // we get back is NOT assigned |
89 | return 0; | 86 | NC->assignInterface( N ); |
90 | } | 87 | NC->setCurrentState( Available ); |
91 | // because we were OFF the interface | 88 | return QString(); |
92 | // we get back is NOT assigned | ||
93 | N->assignNode( netNode() ); | ||
94 | assignInterface( N ); | ||
95 | NC->setCurrentState( Available ); | ||
96 | return 1; | ||
97 | } | ||
98 | case Deactivate : | ||
99 | if( NC->currentState() == IsUp ) { | ||
100 | // bring down first | ||
101 | if( ! connection()->setState( Down ) ) | ||
102 | // could not ... | ||
103 | return 0; | ||
104 | } else if( NC->currentState() != Available ) { | ||
105 | return 1; | ||
106 | } | ||
107 | assignedInterface()->assignNode( 0 ); // release | ||
108 | assignInterface( 0 ); | ||
109 | NC->setCurrentState( Off ); | ||
110 | return 1; | ||
111 | default : | ||
112 | // FT | ||
113 | break; | ||
114 | } | 89 | } |
115 | return 0; | ||
116 | } | ||
117 | 90 | ||
118 | bool LanCardRun::canSetState( State_t Curr, Action_t A ) { | 91 | if( A == Deactivate ) { |
119 | // we only handle up down activate and deactivate | 92 | NC->assignInterface( 0 ); |
120 | switch( A ) { | 93 | NC->setCurrentState( Off ); |
121 | case Activate : | ||
122 | { // at least available | ||
123 | if( Curr == Available ) { | ||
124 | return 1; | ||
125 | } | ||
126 | // or we can make one available | ||
127 | InterfaceInfo * N = getInterface(); | ||
128 | if( ! N || N->assignedNode() != 0 ) { | ||
129 | // non available or assigned | ||
130 | return 0; | ||
131 | } | ||
132 | return 1; | ||
133 | } | ||
134 | case Deactivate : | ||
135 | return ( Curr >= Available ); | ||
136 | default : | ||
137 | // FT | ||
138 | break; | ||
139 | } | 94 | } |
140 | return 0; | 95 | |
96 | return QString(); | ||
141 | } | 97 | } |
142 | 98 | ||
143 | // get interface that is free or assigned to us | 99 | // get interface that is free or assigned to us |
144 | InterfaceInfo * LanCardRun::getInterface( void ) { | 100 | InterfaceInfo * LanCardRun::getInterface( void ) { |
145 | 101 | ||
146 | System & S = NSResources->system(); | 102 | System & S = NSResources->system(); |
147 | InterfaceInfo * best = 0, * Run; | 103 | InterfaceInfo * best = 0, * Run; |
148 | 104 | ||
149 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 105 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
150 | It.current(); | 106 | It.current(); |
151 | ++It ) { | 107 | ++It ) { |
152 | Run = It.current(); | 108 | Run = It.current(); |
153 | if( handlesInterface( *Run ) && | 109 | if( handlesInterface( *Run ) && |
154 | ( Run->CardType == ARPHRD_ETHER | 110 | ( Run->CardType == ARPHRD_ETHER |
155 | #ifdef ARPHRD_IEEE1394 | 111 | #ifdef ARPHRD_IEEE1394 |
156 | || Run->CardType == ARPHRD_IEEE1394 | 112 | || Run->CardType == ARPHRD_IEEE1394 |
157 | #endif | 113 | #endif |
158 | ) | 114 | ) |
159 | ) { | 115 | ) { |
160 | // this is a LAN card | 116 | // this is a LAN card |
161 | if( Run->assignedNode() == netNode() ) { | 117 | if( Run->assignedConnection() == netNode()->connection() ) { |
162 | // assigned to us | 118 | // assigned to us |
163 | return Run; | 119 | return Run; |
164 | } else if( Run->assignedNode() == 0 ) { | 120 | } else if( Run->assignedConnection() == 0 ) { |
165 | // free | 121 | // free |
166 | best = Run; | 122 | best = Run; |
167 | } | 123 | } |
168 | } | 124 | } |
169 | } | 125 | } |
170 | return best; // can be 0 | 126 | return best; // can be 0 |
171 | } | 127 | } |
172 | 128 | ||
173 | bool LanCardRun::handlesInterface( const QString & S ) { | 129 | bool LanCardRun::handlesInterface( const QString & S ) { |
174 | InterfaceInfo * II; | 130 | InterfaceInfo * II; |
175 | II = NSResources->system().interface( S ); | 131 | II = NSResources->system().interface( S ); |
176 | if( ( II = NSResources->system().interface( S ) ) ) { | 132 | if( ( II = NSResources->system().interface( S ) ) ) { |
177 | return handlesInterface( *II ); | 133 | return handlesInterface( *II ); |
178 | } | 134 | } |
179 | return Pat.match( S ) >= 0; | 135 | return Pat.match( S ) >= 0; |
180 | } | 136 | } |
181 | 137 | ||
182 | bool LanCardRun::handlesInterface( const InterfaceInfo & II ) { | 138 | bool LanCardRun::handlesInterface( const InterfaceInfo & II ) { |
183 | if( Pat.match( II.Name ) < 0 ) | 139 | if( Pat.match( II.Name ) < 0 ) |
184 | return 0; | 140 | return 0; |
185 | 141 | ||
186 | if( Data->AnyLanCard ) { | 142 | if( Data->AnyLanCard ) { |
187 | return 1; | 143 | return 1; |
188 | } | 144 | } |
189 | 145 | ||
190 | // must also match hardware address | 146 | // must also match hardware address |
191 | return ( Data->HWAddresses.findIndex( II.MACAddress ) >= 0 ); | 147 | return ( Data->HWAddresses.findIndex( II.MACAddress ) >= 0 ); |
192 | } | 148 | } |
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,39 +1,37 @@ | |||
1 | #ifndef LANCARDRUN_H | 1 | #ifndef LANCARDRUN_H |
2 | #define LANCARDRUN_H | 2 | #define LANCARDRUN_H |
3 | 3 | ||
4 | #include <asdevice.h> | 4 | #include <netnode.h> |
5 | #include <qregexp.h> | 5 | #include <qregexp.h> |
6 | #include "lancarddata.h" | 6 | #include "lancarddata.h" |
7 | 7 | ||
8 | class LanCardRun : public AsDevice { | 8 | class LanCardRun : public RuntimeInfo { |
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | LanCardRun( ANetNodeInstance * NNI, | 12 | LanCardRun( ANetNodeInstance * NNI, |
13 | LanCardData & D ) : AsDevice( NNI ), | 13 | LanCardData & D ) : RuntimeInfo( NNI ), |
14 | Pat( "eth[0-9]" ) | 14 | Pat( "eth[0-9]" ) { |
15 | { Data = &D; } | 15 | Data = &D; |
16 | } | ||
16 | 17 | ||
17 | virtual AsDevice * device( void ) | 18 | virtual RuntimeInfo * device( void ) |
18 | { return (AsDevice *)this; } | 19 | { return this; } |
19 | 20 | ||
20 | virtual AsDevice * asDevice( void ) | 21 | bool handlesInterface( const QString & I ); |
21 | { return (AsDevice *)this; } | 22 | bool handlesInterface( const InterfaceInfo & II ); |
22 | 23 | ||
23 | protected : | 24 | State_t detectState( void ); |
24 | 25 | ||
25 | void detectState( NodeCollection * NC ); | 26 | protected : |
26 | bool setState( NodeCollection * NC, Action_t A, bool Force ); | ||
27 | bool canSetState( State_t Curr, Action_t A ); | ||
28 | 27 | ||
29 | bool handlesInterface( const QString & I ); | 28 | QString setMyState( NodeCollection * , Action_t, bool ); |
30 | bool handlesInterface( const InterfaceInfo & II ); | ||
31 | 29 | ||
32 | private : | 30 | private : |
33 | 31 | ||
34 | InterfaceInfo * getInterface( void ); | 32 | InterfaceInfo * getInterface( void ); |
35 | QRegExp Pat; | 33 | QRegExp Pat; |
36 | LanCardData * Data; | 34 | LanCardData * Data; |
37 | 35 | ||
38 | }; | 36 | }; |
39 | #endif | 37 | #endif |
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 @@ | |||
1 | Package: opie-networksettingsplugin2-lancard | 1 | Package: opie-networksettings2plugin-lancard |
2 | Files: plugins/networksettings2/liblancard.so* | 2 | Files: plugins/networksettings2/liblancard.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Network settings lancard plugin. | 8 | Description: Network settings lancard plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,151 +1,175 @@ | |||
1 | #include "nsdata.h" | 1 | #include "nsdata.h" |
2 | #include "activateprofile.h" | 2 | #include "activateprofile.h" |
3 | #include "activatevpn.h" | 3 | #include "activatevpn.h" |
4 | #include "networksettings.h" | 4 | #include "networksettings.h" |
5 | 5 | ||
6 | #include <opie2/odebug.h> | ||
6 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
7 | 8 | ||
8 | #include <opie2/oapplicationfactory.h> | 9 | #include <opie2/oapplicationfactory.h> |
9 | using namespace Opie::Core; | 10 | using namespace Opie::Core; |
10 | 11 | ||
11 | #ifdef GONE | 12 | #ifdef GONE |
12 | 13 | ||
13 | OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) | 14 | OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) |
14 | 15 | ||
15 | #else | 16 | #else |
16 | 17 | ||
17 | // just standard GUI | 18 | // just standard GUI |
18 | #define ACT_GUI 0 | 19 | #define ACT_GUI 0 |
19 | // used by interfaces to request for allow of up/down | 20 | // used by interfaces to request for allow of up/down |
20 | #define ACT_REQUEST 1 | 21 | #define ACT_REQUEST 1 |
21 | // regenerate config files | 22 | // regenerate config files |
22 | #define ACT_REGEN 2 | 23 | #define ACT_REGEN 2 |
23 | // used by interfaces to request user prompt | 24 | // used by interfaces to request user prompt |
24 | #define ACT_PROMPT 3 | 25 | #define ACT_PROMPT 3 |
25 | // used by interfaces to trigger VPN | 26 | // used by interfaces to trigger VPN |
26 | #define ACT_VPN 4 | 27 | #define ACT_VPN 4 |
28 | // activate opietooth | ||
29 | #define ACT_OT 5 | ||
30 | |||
31 | // include Opietooth GUI | ||
32 | #include <opietooth2/Opietooth.h> | ||
33 | using namespace Opietooth2; | ||
34 | |||
35 | #include <qpushbutton.h> | ||
36 | #include <qlayout.h> | ||
37 | #include <qframe.h> | ||
38 | #include <qlabel.h> | ||
27 | 39 | ||
28 | int main( int argc, char * argv[] ) { | 40 | int main( int argc, char * argv[] ) { |
29 | int rv = 0; | 41 | int rv = 0; |
30 | int Action = ACT_GUI; | 42 | int Action = ACT_GUI; |
31 | // could be overruled by -qws | 43 | // could be overruled by -qws |
32 | QApplication::Type GuiType = QApplication::GuiClient; | 44 | QApplication::Type GuiType = QApplication::GuiClient; |
33 | 45 | ||
34 | #ifdef _WS_QWS_ | 46 | #ifdef _WS_QWS_ |
35 | QPEApplication * TheApp; | 47 | QPEApplication * TheApp; |
36 | #else | 48 | #else |
37 | QApplication * TheApp; | 49 | QApplication * TheApp; |
38 | #endif | 50 | #endif |
39 | 51 | ||
40 | for ( int i = 1; i < argc; i ++ ) { | 52 | for ( int i = 1; i < argc; i ++ ) { |
41 | int rmv; | 53 | int rmv; |
42 | rmv = 0; | 54 | rmv = 0; |
43 | if( strcmp( argv[i], "--regen" ) == 0 ) { | 55 | if( strcmp( argv[i], "--regen" ) == 0 ) { |
44 | Action = ACT_REGEN; | 56 | Action = ACT_REGEN; |
45 | GuiType = QApplication::Tty; | 57 | GuiType = QApplication::Tty; |
46 | rmv = 1; | 58 | rmv = 1; |
47 | } else if( strcmp( argv[i], "--prompt" ) == 0 ) { | 59 | } else if( strcmp( argv[i], "--prompt" ) == 0 ) { |
48 | Action = ACT_PROMPT; | 60 | Action = ACT_PROMPT; |
49 | rmv = 1; | 61 | rmv = 1; |
50 | } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) { | 62 | } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) { |
51 | Action = ACT_VPN; | 63 | Action = ACT_VPN; |
52 | rmv = 1; | 64 | rmv = 1; |
65 | } else if( strcmp( argv[i], "--opietooth" ) == 0 ) { | ||
66 | Action = ACT_OT; | ||
67 | rmv = 1; | ||
53 | } | 68 | } |
54 | if( rmv ) { | 69 | if( rmv ) { |
55 | memmove( argv+i, argv+i+rmv, | 70 | memmove( argv+i, argv+i+rmv, |
56 | sizeof( char * ) * (argc-i-rmv) ); | 71 | sizeof( char * ) * (argc-i-rmv) ); |
57 | i --; | 72 | i --; |
58 | argc -= rmv; | 73 | argc -= rmv; |
59 | } | 74 | } |
60 | } | 75 | } |
61 | 76 | ||
62 | if( strstr( argv[0], "-request" ) ) { | 77 | if( strstr( argv[0], "-request" ) ) { |
63 | // called from system to request something | 78 | // called from system to request something |
64 | GuiType = QApplication::Tty; | 79 | GuiType = QApplication::Tty; |
65 | Action = ACT_REQUEST; | 80 | Action = ACT_REQUEST; |
66 | Log(("Request : %s\n", argv[1] )); | 81 | Log(("Request : %s\n", argv[1] )); |
82 | } else if( strstr( argv[0], "-opietooth" ) ) { | ||
83 | Action = ACT_OT; | ||
67 | } | 84 | } |
68 | 85 | ||
69 | // Start Qt | 86 | // Start Qt |
70 | #ifdef _WS_QWS_ | 87 | #ifdef _WS_QWS_ |
71 | // because QPEApplication does not handle GuiType well | 88 | // because QPEApplication does not handle GuiType well |
72 | if( GuiType == QApplication::Tty ) { | 89 | if( GuiType == QApplication::Tty ) { |
73 | // this cast is NOT correct but we do not use | 90 | // this cast is NOT correct but we do not use |
74 | // TheApp anymore ... | 91 | // TheApp anymore ... |
75 | TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); | 92 | TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); |
76 | } else { | 93 | } else { |
77 | TheApp = new QPEApplication( argc, argv, GuiType ); | 94 | TheApp = new QPEApplication( argc, argv, GuiType ); |
78 | } | 95 | } |
79 | #else | 96 | #else |
80 | TheApp = new QApplication( argc, argv, GuiType ); | 97 | TheApp = new QApplication( argc, argv, GuiType ); |
81 | #endif | 98 | #endif |
82 | 99 | ||
83 | // init qt with app widget | 100 | // init qt with app widget |
84 | 101 | ||
85 | switch( Action ) { | 102 | switch( Action ) { |
86 | case ACT_REQUEST : | 103 | case ACT_REQUEST : |
87 | { NetworkSettingsData NS; | 104 | { NetworkSettingsData NS; |
88 | if( NS.canStart( argv[1] ) ) { | 105 | if( NS.canStart( argv[1] ) ) { |
89 | QString S; | 106 | QStringList S; |
90 | S.sprintf( QPEApplication::qpeDir()+ | 107 | S << QPEApplication::qpeDir() + "/bin/networksettings2"; |
91 | "bin/networksettings2" ); | 108 | S << "networksettings2"; |
92 | char * MyArgv[4]; | 109 | S << "--prompt"; |
93 | MyArgv[0] = "networksettings2"; | 110 | S << argv[1]; |
94 | MyArgv[1] = "--prompt"; | 111 | NSResources->system().execAsUser( S ); |
95 | MyArgv[2] = argv[1]; | ||
96 | MyArgv[3] = NULL; | ||
97 | NSResources->system().execAsUser( S, MyArgv ); | ||
98 | Log(("FAILED %s-cNN-allowed\n", argv[1] )); | 112 | Log(("FAILED %s-cNN-allowed\n", argv[1] )); |
99 | // if we come here , failed | 113 | // if we come here , failed |
100 | printf( "%s-cNN-disallowed", argv[1] ); | 114 | printf( "%s-cNN-disallowed", argv[1] ); |
101 | } | 115 | } |
102 | } | 116 | } |
103 | break; | 117 | break; |
104 | case ACT_REGEN : | 118 | case ACT_REGEN : |
105 | { NetworkSettingsData NS; | 119 | { NetworkSettingsData NS; |
120 | QString S= NS.generateSettings(); | ||
106 | // regen returns 0 if OK | 121 | // regen returns 0 if OK |
107 | rv = (NS.regenerate()) ? 1 : 0; | 122 | rv = ( S.isEmpty() ) ? 0 : 1; |
108 | } | 123 | } |
109 | break; | 124 | break; |
110 | case ACT_PROMPT : | 125 | case ACT_PROMPT : |
111 | { ActivateProfile AP(argv[1]); | 126 | { ActivateProfile AP(argv[1]); |
112 | if( AP.exec() == QDialog::Accepted ) { | 127 | if( AP.exec() == QDialog::Accepted ) { |
113 | Log(("%s-c%ld-allowed\n", | 128 | Log(("%s-c%ld-allowed\n", |
114 | argv[1], AP.selectedProfile() )); | 129 | argv[1], AP.selectedProfile() )); |
115 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); | 130 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); |
116 | } else { | 131 | } else { |
117 | Log(("%s-c%NN-disallowed\n", argv[1] )); | 132 | Log(("%s-c%NN-disallowed\n", argv[1] )); |
118 | printf( "%s-cNN-disallowed", argv[1] ); | 133 | printf( "%s-cNN-disallowed", argv[1] ); |
119 | } | 134 | } |
120 | } | 135 | } |
121 | break; | 136 | break; |
122 | case ACT_VPN : | 137 | case ACT_VPN : |
123 | { ActivateVPN AVPN; | 138 | { ActivateVPN AVPN; |
124 | AVPN.exec(); | 139 | AVPN.exec(); |
125 | } | 140 | } |
126 | break; | 141 | break; |
127 | case ACT_GUI : | 142 | case ACT_GUI : |
128 | { QWidget * W = new NetworkSettings(0); | 143 | case ACT_OT : |
144 | { QWidget * W; | ||
145 | |||
146 | if( Action == ACT_OT ) { | ||
147 | W = new OTMain( 0 ); | ||
148 | } else { | ||
149 | W = new NetworkSettings(0); | ||
150 | } | ||
129 | TheApp->setMainWidget( W ); | 151 | TheApp->setMainWidget( W ); |
152 | |||
130 | W->show(); | 153 | W->show(); |
131 | #ifdef _WS_QWS_ | 154 | #ifdef _WS_QWS_ |
132 | W->showMaximized(); | 155 | W->showMaximized(); |
133 | #else | 156 | #else |
134 | W->resize( W->sizeHint() ); | 157 | W->resize( W->sizeHint() ); |
135 | #endif | 158 | #endif |
136 | rv = TheApp->exec(); | 159 | rv = TheApp->exec(); |
160 | |||
137 | delete W; | 161 | delete W; |
138 | } | 162 | } |
139 | break; | 163 | break; |
140 | } | 164 | } |
141 | 165 | ||
142 | LogClose(); | 166 | LogClose(); |
143 | 167 | ||
144 | return rv; | 168 | return rv; |
145 | } | 169 | } |
146 | 170 | ||
147 | #endif | 171 | #endif |
148 | 172 | ||
149 | 173 | ||
150 | // main.cpp | 174 | // main.cpp |
151 | 175 | ||
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,50 +1,55 @@ | |||
1 | #include "modem_NN.h" | 1 | #include "modem_NN.h" |
2 | #include "modem_NNI.h" | 2 | #include "modem_NNI.h" |
3 | 3 | ||
4 | static const char * ModemNeeds[] = | 4 | static const char * ModemNeeds[] = |
5 | { "line" | 5 | { "line", |
6 | 0 | ||
7 | }; | ||
8 | static const char * ModemProvides[] = | ||
9 | { "modem", | ||
10 | 0 | ||
6 | }; | 11 | }; |
7 | 12 | ||
8 | /** | 13 | /** |
9 | * Constructor, find all of the possible interfaces | 14 | * Constructor, find all of the possible interfaces |
10 | */ | 15 | */ |
11 | ModemNetNode::ModemNetNode() : ANetNode(tr("Dialup modem")) { | 16 | ModemNetNode::ModemNetNode() : ANetNode(tr("Dialup modem")) { |
12 | } | 17 | } |
13 | 18 | ||
14 | /** | 19 | /** |
15 | * Delete any interfaces that we own. | 20 | * Delete any interfaces that we own. |
16 | */ | 21 | */ |
17 | ModemNetNode::~ModemNetNode(){ | 22 | ModemNetNode::~ModemNetNode(){ |
18 | } | 23 | } |
19 | 24 | ||
20 | const QString ModemNetNode::nodeDescription(){ | 25 | const QString ModemNetNode::nodeDescription(){ |
21 | return tr("\ | 26 | return tr("\ |
22 | <p>Sets up a dialing procedures.</p>\ | 27 | <p>Sets up a dialing procedures.</p>\ |
23 | <p>Use this to dial up over modems, ISDN, GSM, ...</p>\ | 28 | <p>Use this to dial up over modems, ISDN, GSM, ...</p>\ |
24 | " | 29 | " |
25 | ); | 30 | ); |
26 | } | 31 | } |
27 | 32 | ||
28 | ANetNodeInstance * ModemNetNode::createInstance( void ) { | 33 | ANetNodeInstance * ModemNetNode::createInstance( void ) { |
29 | return new AModem( this ); | 34 | return new AModem( this ); |
30 | } | 35 | } |
31 | 36 | ||
32 | const char ** ModemNetNode::needs( void ) { | 37 | const char ** ModemNetNode::needs( void ) { |
33 | return ModemNeeds; | 38 | return ModemNeeds; |
34 | } | 39 | } |
35 | 40 | ||
36 | const char * ModemNetNode::provides( void ) { | 41 | const char ** ModemNetNode::provides( void ) { |
37 | return "line"; | 42 | return ModemProvides; |
38 | } | 43 | } |
39 | 44 | ||
40 | void ModemNetNode::setSpecificAttribute( QString & , QString & ) { | 45 | void ModemNetNode::setSpecificAttribute( QString & , QString & ) { |
41 | } | 46 | } |
42 | 47 | ||
43 | void ModemNetNode::saveSpecificAttribute( QTextStream & ) { | 48 | void ModemNetNode::saveSpecificAttribute( QTextStream & ) { |
44 | } | 49 | } |
45 | 50 | ||
46 | extern "C" { | 51 | extern "C" { |
47 | void create_plugin( QList<ANetNode> & PNN ) { | 52 | void create_plugin( QList<ANetNode> & PNN ) { |
48 | PNN.append( new ModemNetNode() ); | 53 | PNN.append( new ModemNetNode() ); |
49 | } | 54 | } |
50 | } | 55 | } |
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 | |||
@@ -1,36 +1,36 @@ | |||
1 | #ifndef MODEM_NETNODE_H | 1 | #ifndef MODEM_NETNODE_H |
2 | #define MODEM_NETNODE_H | 2 | #define MODEM_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AModem; | 6 | class AModem; |
7 | 7 | ||
8 | class ModemNetNode : public ANetNode{ | 8 | class ModemNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | ModemNetNode(); | 14 | ModemNetNode(); |
15 | virtual ~ModemNetNode(); | 15 | virtual ~ModemNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/modem"; } | 18 | { return "Devices/modem"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
21 | virtual ANetNodeInstance * createInstance( void ); | 21 | virtual ANetNodeInstance * createInstance( void ); |
22 | virtual const char ** needs( void ); | 22 | virtual const char ** needs( void ); |
23 | virtual const char * provides( void ); | 23 | virtual const char ** provides( void ); |
24 | 24 | ||
25 | private: | 25 | private: |
26 | 26 | ||
27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
28 | virtual void saveSpecificAttribute( QTextStream & TS ); | 28 | virtual void saveSpecificAttribute( QTextStream & TS ); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | extern "C" | 31 | extern "C" |
32 | { | 32 | { |
33 | void create_plugin( QList<ANetNode> & PNN ); | 33 | void create_plugin( QList<ANetNode> & PNN ); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #endif | 36 | #endif |
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 @@ | |||
1 | #ifndef MODEM_DATA_H | 1 | #ifndef MODEM_DATA_H |
2 | #define MODEM_DATA_H | 2 | #define MODEM_DATA_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | typedef struct ModemData { | 5 | class ModemData { |
6 | public : | ||
6 | QString Device; | 7 | QString Device; |
7 | QString LockFile; | 8 | QString LockFile; |
8 | long Speed; | 9 | long Speed; |
9 | short Parity; | 10 | short Parity; |
10 | short DataBits; | 11 | short DataBits; |
11 | short StopBits; | 12 | short StopBits; |
12 | bool HardwareControl; | 13 | bool HardwareControl; |
13 | bool SoftwareControl; | 14 | bool SoftwareControl; |
14 | 15 | ||
15 | } ModemData_t; | 16 | } ; |
16 | 17 | ||
17 | #endif | 18 | #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 | |||
@@ -1,18 +1,18 @@ | |||
1 | #include <GUIUtils.h> | 1 | #include <GUIUtils.h> |
2 | #include "modemedit.h" | 2 | #include "modemedit.h" |
3 | 3 | ||
4 | ModemEdit::ModemEdit( QWidget * Parent ) : ModemGUI( Parent ){ | 4 | ModemEdit::ModemEdit( QWidget * Parent ) : ModemGUI( Parent ){ |
5 | 5 | ||
6 | } | 6 | } |
7 | 7 | ||
8 | QString ModemEdit::acceptable( void ) { | 8 | QString ModemEdit::acceptable( void ) { |
9 | return QString(); | 9 | return QString(); |
10 | } | 10 | } |
11 | 11 | ||
12 | bool ModemEdit::commit( ModemData_t & Data ) { | 12 | bool ModemEdit::commit( ModemData & Data ) { |
13 | return 0; | 13 | return 0; |
14 | } | 14 | } |
15 | 15 | ||
16 | void ModemEdit::showData( ModemData_t & Data ) { | 16 | void ModemEdit::showData( ModemData & Data ) { |
17 | } | 17 | } |
18 | 18 | ||
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 | |||
@@ -1,12 +1,12 @@ | |||
1 | #include "modemdata.h" | 1 | #include "modemdata.h" |
2 | #include "modemGUI.h" | 2 | #include "modemGUI.h" |
3 | 3 | ||
4 | class ModemEdit : public ModemGUI { | 4 | class ModemEdit : public ModemGUI { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | ModemEdit( QWidget * parent ); | 8 | ModemEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 9 | QString acceptable( void ); |
10 | bool commit( ModemData_t & Data ); | 10 | bool commit( ModemData & Data ); |
11 | void showData( ModemData_t & Data ); | 11 | void showData( ModemData & Data ); |
12 | }; | 12 | }; |
diff --git a/noncore/settings/networksettings2/modem/modemrun.h b/noncore/settings/networksettings2/modem/modemrun.h index 491a677..eb3a193 100644 --- a/noncore/settings/networksettings2/modem/modemrun.h +++ b/noncore/settings/networksettings2/modem/modemrun.h | |||
@@ -1,28 +1,25 @@ | |||
1 | #include <asline.h> | 1 | #include <netnode.h> |
2 | #include "modemdata.h" | 2 | #include "modemdata.h" |
3 | 3 | ||
4 | class ModemRun : public AsLine { | 4 | class ModemRun : public RuntimeInfo { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | ModemRun( ANetNodeInstance * NNI, | 8 | ModemRun( ANetNodeInstance * NNI, |
9 | ModemData & Data ) : AsLine ( NNI ) | 9 | ModemData & Data ) : RuntimeInfo ( NNI ) |
10 | { } | 10 | { } |
11 | 11 | ||
12 | virtual AsLine * asLine( void ) | 12 | virtual RuntimeInfo * line( void ) |
13 | { return (AsLine *)this; } | 13 | { return this; } |
14 | 14 | ||
15 | virtual QString deviceFile( void ) | 15 | virtual QString deviceFile( void ) |
16 | { return QString("/dev/modem"); } | 16 | { return QString("/dev/modem"); } |
17 | 17 | ||
18 | protected : | 18 | State_t detectState( void ) |
19 | 19 | { return Unknown;} | |
20 | void detectState( NodeCollection * ) | ||
21 | { } | ||
22 | 20 | ||
23 | bool setState( NodeCollection *, Action_t, bool ) | 21 | protected : |
24 | { return 0; } | ||
25 | 22 | ||
26 | bool canSetState( State_t, Action_t ) | 23 | QString setMyState( NodeCollection * , Action_t, bool ) |
27 | { return 0; } | 24 | { return QString(); } |
28 | }; | 25 | }; |
diff --git a/noncore/settings/networksettings2/modem/opie-networksettings2plugin-modem.control b/noncore/settings/networksettings2/modem/opie-networksettings2plugin-modem.control index eaa6ab0..a73249a 100644 --- a/noncore/settings/networksettings2/modem/opie-networksettings2plugin-modem.control +++ b/noncore/settings/networksettings2/modem/opie-networksettings2plugin-modem.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-networksettingsplugin2-modem | 1 | Package: opie-networksettings2plugin-modem |
2 | Files: plugins/networksettings2/libmodem.so* | 2 | Files: plugins/networksettings2/libmodem.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Network settings modem plugin. | 8 | Description: Network settings modem plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,85 +1,97 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <asdevice.h> | 2 | #include <resources.h> |
3 | #include <netnode.h> | ||
3 | #include "network_NN.h" | 4 | #include "network_NN.h" |
4 | #include "network_NNI.h" | 5 | #include "network_NNI.h" |
5 | 6 | ||
6 | static const char * NetworkNeeds[] = | 7 | static const char * NetworkNeeds[] = |
7 | { "device", | 8 | { "device", |
8 | 0 | 9 | 0 |
9 | }; | 10 | }; |
10 | 11 | ||
12 | static const char * NetworkProvides[] = | ||
13 | { "connection", | ||
14 | 0 | ||
15 | }; | ||
16 | |||
11 | /** | 17 | /** |
12 | * Constructor, find all of the possible interfaces | 18 | * Constructor, find all of the possible interfaces |
13 | */ | 19 | */ |
14 | NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { | 20 | NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { |
21 | |||
22 | NSResources->addSystemFile( | ||
23 | "interfaces", "/etc/network/interfaces", 1 ); | ||
15 | } | 24 | } |
16 | 25 | ||
17 | /** | 26 | /** |
18 | * Delete any interfaces that we own. | 27 | * Delete any interfaces that we own. |
19 | */ | 28 | */ |
20 | NetworkNetNode::~NetworkNetNode(){ | 29 | NetworkNetNode::~NetworkNetNode(){ |
21 | } | 30 | } |
22 | 31 | ||
23 | const QString NetworkNetNode::nodeDescription(){ | 32 | const QString NetworkNetNode::nodeDescription(){ |
24 | return tr("\ | 33 | return tr("\ |
25 | <p>Sets up TCP/IP options.</p>\ | 34 | <p>Sets up TCP/IP options.</p>\ |
26 | <p>Use this to configure the TCP/IP protocol</p>\ | 35 | <p>Use this to configure the TCP/IP protocol</p>\ |
27 | " | 36 | " |
28 | ); | 37 | ); |
29 | } | 38 | } |
30 | 39 | ||
31 | ANetNodeInstance * NetworkNetNode::createInstance( void ) { | 40 | ANetNodeInstance * NetworkNetNode::createInstance( void ) { |
32 | return new ANetwork( this ); | 41 | return new ANetwork( this ); |
33 | } | 42 | } |
34 | 43 | ||
35 | bool NetworkNetNode::hasDataForFile( const QString & S ) { | 44 | bool NetworkNetNode::hasDataForFile( SystemFile & S ) { |
36 | return S == "interfaces"; | 45 | return S.name() == "interfaces"; |
37 | } | 46 | } |
38 | 47 | ||
39 | short NetworkNetNode::generateFile( const QString & ID, | 48 | short NetworkNetNode::generateFile( SystemFile & SF, |
40 | const QString & , | ||
41 | QTextStream & TS, | ||
42 | ANetNodeInstance * NNI, | 49 | ANetNodeInstance * NNI, |
43 | long DevNr ) { | 50 | long DevNr ) { |
44 | 51 | ||
52 | if( DevNr < 0 ) { | ||
53 | // generate device specific but common part | ||
54 | return 1; | ||
55 | } | ||
56 | |||
45 | QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); | 57 | QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); |
46 | 58 | ||
47 | if( ID == "interfaces" ) { | 59 | if( SF.name() == "interfaces" ) { |
48 | Log(("Generate entry for %s in %s\n", NIC.latin1(), ID.latin1() )); | 60 | Log(("Generate entry for %s in %s\n", NIC.latin1(), SF.name().latin1() )); |
49 | // generate mapping stanza for this interface | 61 | // generate mapping stanza for this interface |
50 | TS << "# check if " | 62 | SF << "# check if " |
51 | << NIC | 63 | << NIC |
52 | << " can be brought UP" | 64 | << " can be brought UP" |
53 | << endl; | 65 | << endl; |
54 | TS << "mapping " | 66 | SF << "mapping " |
55 | << NIC | 67 | << NIC |
56 | << endl; | 68 | << endl; |
57 | TS << " script " | 69 | SF << " script " |
58 | << QPEApplication::qpeDir() | 70 | << QPEApplication::qpeDir() |
59 | << "/bin/networksettings2-request" | 71 | << "bin/networksettings2-request" |
60 | << endl | 72 | << endl |
61 | << endl; | 73 | << endl; |
62 | return 0; | 74 | return 0; |
63 | } | 75 | } |
64 | return 1; | 76 | return 1; |
65 | } | 77 | } |
66 | 78 | ||
67 | const char ** NetworkNetNode::needs( void ) { | 79 | const char ** NetworkNetNode::needs( void ) { |
68 | return NetworkNeeds; | 80 | return NetworkNeeds; |
69 | } | 81 | } |
70 | 82 | ||
71 | const char * NetworkNetNode::provides( void ) { | 83 | const char ** NetworkNetNode::provides( void ) { |
72 | return "connection"; | 84 | return NetworkProvides; |
73 | } | 85 | } |
74 | 86 | ||
75 | void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { | 87 | void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { |
76 | } | 88 | } |
77 | 89 | ||
78 | void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { | 90 | void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { |
79 | } | 91 | } |
80 | 92 | ||
81 | extern "C" { | 93 | extern "C" { |
82 | void create_plugin( QList<ANetNode> & PNN ) { | 94 | void create_plugin( QList<ANetNode> & PNN ) { |
83 | PNN.append( new NetworkNetNode() ); | 95 | PNN.append( new NetworkNetNode() ); |
84 | } | 96 | } |
85 | } | 97 | } |
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 | |||
@@ -1,43 +1,41 @@ | |||
1 | #ifndef NETWORK_NETNODE_H | 1 | #ifndef NETWORK_NETNODE_H |
2 | #define NETWORK_NETNODE_H | 2 | #define NETWORK_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ANetwork; | 6 | class ANetwork; |
7 | 7 | ||
8 | class NetworkNetNode : public ANetNode{ | 8 | class NetworkNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | NetworkNetNode(); | 14 | NetworkNetNode(); |
15 | virtual ~NetworkNetNode(); | 15 | virtual ~NetworkNetNode(); |
16 | 16 | ||
17 | virtual bool hasDataForFile( const QString & S ); | 17 | virtual bool hasDataForFile( SystemFile & S ); |
18 | 18 | ||
19 | virtual short generateFile( const QString & ID, | 19 | virtual short generateFile( SystemFile & TS, |
20 | const QString & Path, | ||
21 | QTextStream & TS, | ||
22 | ANetNodeInstance * NNI, | 20 | ANetNodeInstance * NNI, |
23 | long DevNr ); | 21 | long DevNr ); |
24 | virtual const QString pixmapName() | 22 | virtual const QString pixmapName() |
25 | { return "Devices/tcpip"; } | 23 | { return "Devices/tcpip"; } |
26 | 24 | ||
27 | virtual const QString nodeDescription() ; | 25 | virtual const QString nodeDescription() ; |
28 | virtual ANetNodeInstance * createInstance( void ); | 26 | virtual ANetNodeInstance * createInstance( void ); |
29 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
30 | virtual const char * provides( void ); | 28 | virtual const char ** provides( void ); |
31 | 29 | ||
32 | private: | 30 | private: |
33 | 31 | ||
34 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
35 | virtual void saveSpecificAttribute( QTextStream & TS ); | 33 | virtual void saveSpecificAttribute( QTextStream & TS ); |
36 | }; | 34 | }; |
37 | 35 | ||
38 | extern "C" | 36 | extern "C" |
39 | { | 37 | { |
40 | void create_plugin( QList<ANetNode> & PNN ); | 38 | void create_plugin( QList<ANetNode> & PNN ); |
41 | }; | 39 | }; |
42 | 40 | ||
43 | #endif | 41 | #endif |
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,219 +1,217 @@ | |||
1 | #include <system.h> | 1 | #include <system.h> |
2 | #include <asdevice.h> | 2 | #include <netnode.h> |
3 | #include "networkedit.h" | 3 | #include "networkedit.h" |
4 | #include "network_NNI.h" | 4 | #include "network_NNI.h" |
5 | #include "network_NN.h" | 5 | #include "network_NN.h" |
6 | 6 | ||
7 | ANetwork::ANetwork( NetworkNetNode * PNN ) : ANetNodeInstance( PNN ) { | 7 | ANetwork::ANetwork( NetworkNetNode * PNN ) : ANetNodeInstance( PNN ) { |
8 | Data.UseDHCP = 1; | 8 | Data.UseDHCP = 1; |
9 | Data.IPAddress = ""; | 9 | Data.IPAddress = ""; |
10 | Data.NetMask = ""; | 10 | Data.NetMask = ""; |
11 | Data.Broadcast = ""; | 11 | Data.Broadcast = ""; |
12 | Data.Gateway = ""; | 12 | Data.Gateway = ""; |
13 | Data.DNS1 = ""; | 13 | Data.DNS1 = ""; |
14 | Data.DNS2 = ""; | 14 | Data.DNS2 = ""; |
15 | Data.SendHostname = 0; | 15 | Data.SendHostname = 0; |
16 | Data.Hostname = ""; | 16 | Data.Hostname = ""; |
17 | Data.PreUp_SL.clear(); | 17 | Data.PreUp_SL.clear(); |
18 | Data.PreDown_SL.clear(); | 18 | Data.PreDown_SL.clear(); |
19 | Data.PostUp_SL.clear(); | 19 | Data.PostUp_SL.clear(); |
20 | Data.PostDown_SL.clear(); | 20 | Data.PostDown_SL.clear(); |
21 | GUI = 0; | 21 | GUI = 0; |
22 | RT = 0; | 22 | RT = 0; |
23 | } | 23 | } |
24 | 24 | ||
25 | void ANetwork::setSpecificAttribute( QString & A, QString & V ) { | 25 | void ANetwork::setSpecificAttribute( QString & A, QString & V ) { |
26 | if( A == "usedhcp" ) { | 26 | if( A == "usedhcp" ) { |
27 | Data.UseDHCP = (V == "yes"); | 27 | Data.UseDHCP = (V == "yes"); |
28 | } else if( A == "sendhostname" ) { | 28 | } else if( A == "sendhostname" ) { |
29 | Data.SendHostname = (V=="yes"); | 29 | Data.SendHostname = (V=="yes"); |
30 | } else if( A == "hostname" ) { | 30 | } else if( A == "hostname" ) { |
31 | Data.Hostname = V; | 31 | Data.Hostname = V; |
32 | } else if( A == "ipaddress" ) { | 32 | } else if( A == "ipaddress" ) { |
33 | Data.IPAddress = V; | 33 | Data.IPAddress = V; |
34 | } else if( A == "netmask" ) { | 34 | } else if( A == "netmask" ) { |
35 | Data.NetMask = V; | 35 | Data.NetMask = V; |
36 | } else if( A == "broadcast" ) { | 36 | } else if( A == "broadcast" ) { |
37 | Data.Broadcast = V; | 37 | Data.Broadcast = V; |
38 | } else if( A == "gateway" ) { | 38 | } else if( A == "gateway" ) { |
39 | Data.Gateway = V; | 39 | Data.Gateway = V; |
40 | } else if( A == "dns1" ) { | 40 | } else if( A == "dns1" ) { |
41 | Data.DNS1 = V; | 41 | Data.DNS1 = V; |
42 | } else if( A == "dns2" ) { | 42 | } else if( A == "dns2" ) { |
43 | Data.DNS2 = V; | 43 | Data.DNS2 = V; |
44 | } else if( A == "preup" ) { | 44 | } else if( A == "preup" ) { |
45 | Data.PreUp_SL.append( V ); | 45 | Data.PreUp_SL.append( V ); |
46 | } else if( A == "predown" ) { | 46 | } else if( A == "predown" ) { |
47 | Data.PreDown_SL.append( V ); | 47 | Data.PreDown_SL.append( V ); |
48 | } else if( A == "postup" ) { | 48 | } else if( A == "postup" ) { |
49 | Data.PostUp_SL.append( V ); | 49 | Data.PostUp_SL.append( V ); |
50 | } else if( A == "postdown" ) { | 50 | } else if( A == "postdown" ) { |
51 | Data.PostDown_SL.append( V ); | 51 | Data.PostDown_SL.append( V ); |
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | void ANetwork::saveSpecificAttribute( QTextStream & TS ) { | 55 | void ANetwork::saveSpecificAttribute( QTextStream & TS ) { |
56 | TS << "usedhcp=" << ((Data.UseDHCP) ? "yes" : "no") << endl; | 56 | TS << "usedhcp=" << ((Data.UseDHCP) ? "yes" : "no") << endl; |
57 | TS << "sendhostname=" << ((Data.SendHostname) ? "yes" : "no") << endl; | 57 | TS << "sendhostname=" << ((Data.SendHostname) ? "yes" : "no") << endl; |
58 | TS << "hostname=" << Data.Hostname << endl; | 58 | TS << "hostname=" << Data.Hostname << endl; |
59 | TS << "ipaddress=" << Data.IPAddress << endl; | 59 | TS << "ipaddress=" << Data.IPAddress << endl; |
60 | TS << "netmask=" << Data.NetMask << endl; | 60 | TS << "netmask=" << Data.NetMask << endl; |
61 | TS << "broadcast=" << Data.Broadcast << endl; | 61 | TS << "broadcast=" << Data.Broadcast << endl; |
62 | TS << "gateway=" << Data.Gateway << endl; | 62 | TS << "gateway=" << Data.Gateway << endl; |
63 | TS << "dns1=" << Data.DNS1 << endl; | 63 | TS << "dns1=" << Data.DNS1 << endl; |
64 | TS << "dns2=" << Data.DNS2 << endl; | 64 | TS << "dns2=" << Data.DNS2 << endl; |
65 | for ( QStringList::Iterator it = Data.PreUp_SL.begin(); | 65 | for ( QStringList::Iterator it = Data.PreUp_SL.begin(); |
66 | it != Data.PreUp_SL.end(); | 66 | it != Data.PreUp_SL.end(); |
67 | ++it ) { | 67 | ++it ) { |
68 | TS << "preup=" << quote(*it) << endl; | 68 | TS << "preup=" << quote(*it) << endl; |
69 | } | 69 | } |
70 | for ( QStringList::Iterator it = Data.PreDown_SL.begin(); | 70 | for ( QStringList::Iterator it = Data.PreDown_SL.begin(); |
71 | it != Data.PreDown_SL.end(); | 71 | it != Data.PreDown_SL.end(); |
72 | ++it ) { | 72 | ++it ) { |
73 | TS << "predown=" << quote(*it) << endl; | 73 | TS << "predown=" << quote(*it) << endl; |
74 | } | 74 | } |
75 | for ( QStringList::Iterator it = Data.PostUp_SL.begin(); | 75 | for ( QStringList::Iterator it = Data.PostUp_SL.begin(); |
76 | it != Data.PostUp_SL.end(); | 76 | it != Data.PostUp_SL.end(); |
77 | ++it ) { | 77 | ++it ) { |
78 | TS << "postup=" << quote(*it) << endl; | 78 | TS << "postup=" << quote(*it) << endl; |
79 | } | 79 | } |
80 | for ( QStringList::Iterator it = Data.PostDown_SL.begin(); | 80 | for ( QStringList::Iterator it = Data.PostDown_SL.begin(); |
81 | it != Data.PostDown_SL.end(); | 81 | it != Data.PostDown_SL.end(); |
82 | ++it ) { | 82 | ++it ) { |
83 | TS << "postdown=" << quote(*it) << endl; | 83 | TS << "postdown=" << quote(*it) << endl; |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | QWidget * ANetwork::edit( QWidget * parent ) { | 87 | QWidget * ANetwork::edit( QWidget * parent ) { |
88 | GUI = new NetworkEdit( parent ); | 88 | GUI = new NetworkEdit( parent ); |
89 | GUI->showData( Data ); | 89 | GUI->showData( Data ); |
90 | return GUI; | 90 | return GUI; |
91 | } | 91 | } |
92 | 92 | ||
93 | QString ANetwork::acceptable( void ) { | 93 | QString ANetwork::acceptable( void ) { |
94 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 94 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
95 | } | 95 | } |
96 | 96 | ||
97 | void ANetwork::commit( void ) { | 97 | void ANetwork::commit( void ) { |
98 | if( GUI && GUI->commit( Data ) ) | 98 | if( GUI && GUI->commit( Data ) ) |
99 | setModified( 1 ); | 99 | setModified( 1 ); |
100 | } | 100 | } |
101 | 101 | ||
102 | bool ANetwork::hasDataForFile( const QString & S ) { | 102 | bool ANetwork::hasDataForFile( SystemFile & S ) { |
103 | return S == "interfaces"; | 103 | return S.name() == "interfaces"; |
104 | } | 104 | } |
105 | 105 | ||
106 | short ANetwork::generateFile( const QString & ID, | 106 | short ANetwork::generateFile( SystemFile &SF, |
107 | const QString & Path, | 107 | long DevNr |
108 | QTextStream &TS, | 108 | ) { |
109 | long DevNr | ||
110 | ) { | ||
111 | 109 | ||
112 | short rvl, rvd ; | 110 | short rvl, rvd ; |
113 | QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); | 111 | QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); |
114 | 112 | ||
115 | rvl = 1; | 113 | rvl = 1; |
116 | if( ID == "interfaces" ) { | 114 | if( SF.name() == "interfaces" ) { |
117 | Log(("Generate Network for %s\n", ID.latin1() )); | 115 | Log(("Generate Network for %s\n", SF.name().latin1() )); |
118 | // we can safely call from here since device item is deeper | 116 | // we can safely call from here since device item is deeper |
119 | if( Data.UseDHCP ) { | 117 | if( Data.UseDHCP ) { |
120 | TS << "iface " | 118 | SF << "iface " |
121 | << NIC | 119 | << NIC |
122 | << "-c" | 120 | << "-c" |
123 | << connection()->number() | 121 | << connection()->number() |
124 | << "-allowed inet dhcp" | 122 | << "-allowed inet dhcp" |
125 | << endl; | 123 | << endl; |
126 | TS << " up echo \"" | 124 | SF << " up echo \"" |
127 | << NIC | 125 | << NIC |
128 | << "\" > /tmp/profile-" | 126 | << "\" > /tmp/profile-" |
129 | << connection()->number() | 127 | << connection()->number() |
130 | << ".up" | 128 | << ".up" |
131 | << endl; | 129 | << endl; |
132 | if( Data.SendHostname ) { | 130 | if( Data.SendHostname ) { |
133 | TS << " hostname " | 131 | SF << " hostname " |
134 | << Data.Hostname | 132 | << Data.Hostname |
135 | << endl; | 133 | << endl; |
136 | } | 134 | } |
137 | 135 | ||
138 | TS << " down rm -f /tmp/profile-" | 136 | SF << " down rm -f /tmp/profile-" |
139 | << connection()->number() | 137 | << connection()->number() |
140 | << ".up" | 138 | << ".up" |
141 | << endl; | 139 | << endl; |
142 | } else { | 140 | } else { |
143 | TS << "iface " | 141 | SF << "iface " |
144 | << NIC << "-c" | 142 | << NIC << "-c" |
145 | << connection()->number() | 143 | << connection()->number() |
146 | << "-allowed inet static" | 144 | << "-allowed inet static" |
147 | << endl; | 145 | << endl; |
148 | TS << " up echo \"" | 146 | SF << " up echo \"" |
149 | << NIC | 147 | << NIC |
150 | << "\" > /tmp/profile-" | 148 | << "\" > /tmp/profile-" |
151 | << connection()->number() | 149 | << connection()->number() |
152 | << ".up" | 150 | << ".up" |
153 | << endl; | 151 | << endl; |
154 | TS << " down rm -f /tmp/profile-" | 152 | SF << " down rm -f /tmp/profile-" |
155 | << connection()->number() | 153 | << connection()->number() |
156 | << ".up" | 154 | << ".up" |
157 | << endl; | 155 | << endl; |
158 | TS << " address " | 156 | SF << " address " |
159 | << Data.IPAddress | 157 | << Data.IPAddress |
160 | << endl; | 158 | << endl; |
161 | TS << " broadcast " | 159 | SF << " broadcast " |
162 | << Data.Broadcast | 160 | << Data.Broadcast |
163 | << endl; | 161 | << endl; |
164 | TS << " netmask " | 162 | SF << " netmask " |
165 | << Data.NetMask | 163 | << Data.NetMask |
166 | << endl; | 164 | << endl; |
167 | 165 | ||
168 | // derive network address = IPAddress & netmask | 166 | // derive network address = IPAddress & netmask |
169 | { QString NW; | 167 | { QString NW; |
170 | QStringList ipal = QStringList::split( '.', Data.IPAddress ); | 168 | QStringList ipal = QStringList::split( '.', Data.IPAddress ); |
171 | QStringList nmal = QStringList::split( '.', Data.NetMask ); | 169 | QStringList nmal = QStringList::split( '.', Data.NetMask ); |
172 | 170 | ||
173 | NW = QString( "%1.%2.%3.%4" ). | 171 | NW = QString( "%1.%2.%3.%4" ). |
174 | arg( ipal[0].toShort() & nmal[0].toShort() ). | 172 | arg( ipal[0].toShort() & nmal[0].toShort() ). |
175 | arg( ipal[1].toShort() & nmal[1].toShort() ). | 173 | arg( ipal[1].toShort() & nmal[1].toShort() ). |
176 | arg( ipal[2].toShort() & nmal[2].toShort() ). | 174 | arg( ipal[2].toShort() & nmal[2].toShort() ). |
177 | arg( ipal[3].toShort() & nmal[3].toShort() ); | 175 | arg( ipal[3].toShort() & nmal[3].toShort() ); |
178 | TS << " network " | 176 | SF << " network " |
179 | << NW | 177 | << NW |
180 | << endl; | 178 | << endl; |
181 | } | 179 | } |
182 | } | 180 | } |
183 | for ( QStringList::Iterator it = Data.PreUp_SL.begin(); | 181 | for ( QStringList::Iterator it = Data.PreUp_SL.begin(); |
184 | it != Data.PreUp_SL.end(); | 182 | it != Data.PreUp_SL.end(); |
185 | ++it ) { | 183 | ++it ) { |
186 | TS << " pre-up " | 184 | SF << " pre-up " |
187 | << (*it) | 185 | << (*it) |
188 | << endl; | 186 | << endl; |
189 | } | 187 | } |
190 | for ( QStringList::Iterator it = Data.PostUp_SL.begin(); | 188 | for ( QStringList::Iterator it = Data.PostUp_SL.begin(); |
191 | it != Data.PostUp_SL.end(); | 189 | it != Data.PostUp_SL.end(); |
192 | ++it ) { | 190 | ++it ) { |
193 | TS << " up " | 191 | SF << " up " |
194 | << (*it) | 192 | << (*it) |
195 | << endl; | 193 | << endl; |
196 | } | 194 | } |
197 | for ( QStringList::Iterator it = Data.PreDown_SL.begin(); | 195 | for ( QStringList::Iterator it = Data.PreDown_SL.begin(); |
198 | it != Data.PreDown_SL.end(); | 196 | it != Data.PreDown_SL.end(); |
199 | ++it ) { | 197 | ++it ) { |
200 | TS << " down " | 198 | SF << " down " |
201 | << (*it) | 199 | << (*it) |
202 | << endl; | 200 | << endl; |
203 | } | 201 | } |
204 | for ( QStringList::Iterator it = Data.PostDown_SL.begin(); | 202 | for ( QStringList::Iterator it = Data.PostDown_SL.begin(); |
205 | it != Data.PostDown_SL.end(); | 203 | it != Data.PostDown_SL.end(); |
206 | ++it ) { | 204 | ++it ) { |
207 | TS << " post-down " | 205 | SF << " post-down " |
208 | << (*it) | 206 | << (*it) |
209 | << endl; | 207 | << endl; |
210 | } | 208 | } |
211 | rvl = 0; | 209 | rvl = 0; |
212 | } | 210 | } |
213 | 211 | ||
214 | // embed other info in it | 212 | // embed other info in it |
215 | rvd = connection()->getToplevel()->generateFileEmbedded( ID, Path, TS, DevNr ); | 213 | rvd = connection()->getToplevel()->generateFileEmbedded( SF, DevNr ); |
216 | 214 | ||
217 | return (rvd == 2 || rvl == 2 ) ? 2 : | 215 | return (rvd == 2 || rvl == 2 ) ? 2 : |
218 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | 216 | (rvd == 0 || rvl == 0 ) ? 0 : 1; |
219 | } | 217 | } |
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 | |||
@@ -1,48 +1,46 @@ | |||
1 | #ifndef NETWORK_H | 1 | #ifndef NETWORK_H |
2 | #define NETWORK_H | 2 | #define NETWORK_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "networkdata.h" | 5 | #include "networkdata.h" |
6 | #include "networkrun.h" | 6 | #include "networkrun.h" |
7 | 7 | ||
8 | class NetworkNetNode; | 8 | class NetworkNetNode; |
9 | class NetworkEdit; | 9 | class NetworkEdit; |
10 | class SystemFile; | 10 | class SystemFile; |
11 | 11 | ||
12 | class ANetwork : public ANetNodeInstance{ | 12 | class ANetwork : public ANetNodeInstance{ |
13 | 13 | ||
14 | public : | 14 | public : |
15 | 15 | ||
16 | ANetwork( NetworkNetNode * PNN ); | 16 | ANetwork( NetworkNetNode * PNN ); |
17 | 17 | ||
18 | RuntimeInfo * runtime( void ) | 18 | RuntimeInfo * runtime( void ) |
19 | { return | 19 | { return |
20 | ( RT ) ? RT : ( RT = new NetworkRun( this, Data ) ); | 20 | ( RT ) ? RT : ( RT = new NetworkRun( this, Data ) ); |
21 | } | 21 | } |
22 | 22 | ||
23 | QWidget * edit( QWidget * parent ); | 23 | QWidget * edit( QWidget * parent ); |
24 | QString acceptable( void ); | 24 | QString acceptable( void ); |
25 | void commit( void ); | 25 | void commit( void ); |
26 | 26 | ||
27 | virtual void * data( void ) | 27 | virtual void * data( void ) |
28 | { return (void *)&Data; } | 28 | { return (void *)&Data; } |
29 | 29 | ||
30 | virtual bool hasDataForFile( const QString & S ); | 30 | virtual bool hasDataForFile( SystemFile & SF ); |
31 | virtual short generateFile( const QString & ID, | 31 | virtual short generateFile( SystemFile &TS, |
32 | const QString & Path, | 32 | long DevNr ); |
33 | QTextStream &TS, | ||
34 | long DevNr ); | ||
35 | 33 | ||
36 | protected : | 34 | protected : |
37 | 35 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | 37 | virtual void saveSpecificAttribute( QTextStream & TS ); |
40 | 38 | ||
41 | private : | 39 | private : |
42 | 40 | ||
43 | NetworkEdit * GUI; | 41 | NetworkEdit * GUI; |
44 | NetworkData_t Data; | 42 | NetworkData Data; |
45 | NetworkRun * RT; | 43 | NetworkRun * RT; |
46 | }; | 44 | }; |
47 | 45 | ||
48 | #endif | 46 | #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 @@ | |||
1 | #ifndef NETWORK_DATA_H | 1 | #ifndef NETWORK_DATA_H |
2 | #define NETWORK_DATA_H | 2 | #define NETWORK_DATA_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | typedef struct NetworkData { | 6 | class NetworkData { |
7 | public : | ||
7 | bool UseDHCP; | 8 | bool UseDHCP; |
8 | QString Hostname; | 9 | QString Hostname; |
9 | bool SendHostname; | 10 | bool SendHostname; |
10 | QString IPAddress; | 11 | QString IPAddress; |
11 | QString NetMask; | 12 | QString NetMask; |
12 | QString Gateway; | 13 | QString Gateway; |
13 | QString Broadcast; | 14 | QString Broadcast; |
14 | QString DNS1; | 15 | QString DNS1; |
15 | QString DNS2; | 16 | QString DNS2; |
16 | QStringList PreUp_SL; | 17 | QStringList PreUp_SL; |
17 | QStringList PostUp_SL; | 18 | QStringList PostUp_SL; |
18 | QStringList PreDown_SL; | 19 | QStringList PreDown_SL; |
19 | QStringList PostDown_SL; | 20 | QStringList PostDown_SL; |
20 | } NetworkData_t; | 21 | } ; |
21 | 22 | ||
22 | #endif | 23 | #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 | |||
@@ -1,224 +1,224 @@ | |||
1 | #include <qtoolbutton.h> | 1 | #include <qtoolbutton.h> |
2 | #include <qcheckbox.h> | 2 | #include <qcheckbox.h> |
3 | #include <qtabwidget.h> | 3 | #include <qtabwidget.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qlistbox.h> | 5 | #include <qlistbox.h> |
6 | #include <GUIUtils.h> | 6 | #include <GUIUtils.h> |
7 | #include <resources.h> | 7 | #include <resources.h> |
8 | #include "networkedit.h" | 8 | #include "networkedit.h" |
9 | 9 | ||
10 | NetworkEdit::NetworkEdit( QWidget * Parent ) : NetworkGUI( Parent ){ | 10 | NetworkEdit::NetworkEdit( QWidget * Parent ) : NetworkGUI( Parent ){ |
11 | 11 | ||
12 | AddPreDown_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 12 | AddPreDown_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
13 | AddPreUp_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 13 | AddPreUp_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
14 | AddPostDown_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 14 | AddPostDown_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
15 | AddPostUp_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 15 | AddPostUp_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
16 | 16 | ||
17 | DeletePreDown_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 17 | DeletePreDown_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
18 | DeletePreUp_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 18 | DeletePreUp_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
19 | DeletePostDown_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 19 | DeletePostDown_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
20 | DeletePostUp_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 20 | DeletePostUp_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
21 | 21 | ||
22 | UpPreDown_TB->setPixmap( NSResources->getPixmap( "up" ) ); | 22 | UpPreDown_TB->setPixmap( NSResources->getPixmap( "up" ) ); |
23 | UpPreUp_TB->setPixmap( NSResources->getPixmap( "up" ) ); | 23 | UpPreUp_TB->setPixmap( NSResources->getPixmap( "up" ) ); |
24 | UpPostDown_TB->setPixmap( NSResources->getPixmap( "up" ) ); | 24 | UpPostDown_TB->setPixmap( NSResources->getPixmap( "up" ) ); |
25 | UpPostUp_TB->setPixmap( NSResources->getPixmap( "up" ) ); | 25 | UpPostUp_TB->setPixmap( NSResources->getPixmap( "up" ) ); |
26 | 26 | ||
27 | DownPreDown_TB->setPixmap( NSResources->getPixmap( "down" ) ); | 27 | DownPreDown_TB->setPixmap( NSResources->getPixmap( "down" ) ); |
28 | DownPreUp_TB->setPixmap( NSResources->getPixmap( "down" ) ); | 28 | DownPreUp_TB->setPixmap( NSResources->getPixmap( "down" ) ); |
29 | DownPostDown_TB->setPixmap( NSResources->getPixmap( "down" ) ); | 29 | DownPostDown_TB->setPixmap( NSResources->getPixmap( "down" ) ); |
30 | DownPostUp_TB->setPixmap( NSResources->getPixmap( "down" ) ); | 30 | DownPostUp_TB->setPixmap( NSResources->getPixmap( "down" ) ); |
31 | 31 | ||
32 | } | 32 | } |
33 | 33 | ||
34 | QString NetworkEdit::acceptable( void ) { | 34 | QString NetworkEdit::acceptable( void ) { |
35 | if( DHCP_CB->isChecked() ) { | 35 | if( DHCP_CB->isChecked() ) { |
36 | if( SendHostname_CB->isChecked() ) | 36 | if( SendHostname_CB->isChecked() ) |
37 | if( Hostname_LE->text().isEmpty() ) | 37 | if( Hostname_LE->text().isEmpty() ) |
38 | return tr("Hostname needed"); | 38 | return tr("Hostname needed"); |
39 | return QString(); | 39 | return QString(); |
40 | } | 40 | } |
41 | 41 | ||
42 | if( IPAddress_LE->text().isEmpty() ) | 42 | if( IPAddress_LE->text().isEmpty() ) |
43 | return tr("IPAddress needed"); | 43 | return tr("IPAddress needed"); |
44 | if( Broadcast_LE->text().isEmpty() ) | 44 | if( Broadcast_LE->text().isEmpty() ) |
45 | return tr("Broadcast needed"); | 45 | return tr("Broadcast needed"); |
46 | if( SubnetMask_LE->text().isEmpty() ) | 46 | if( SubnetMask_LE->text().isEmpty() ) |
47 | return tr("Subnet mask needed"); | 47 | return tr("Subnet mask needed"); |
48 | 48 | ||
49 | // valid IP ? | 49 | // valid IP ? |
50 | if( ! validIP( IPAddress_LE->text() ) ) | 50 | if( ! validIP( IPAddress_LE->text() ) ) |
51 | return tr("IPAddress not valid"); | 51 | return tr("IPAddress not valid"); |
52 | if( ! validIP( SubnetMask_LE->text() ) ) | 52 | if( ! validIP( SubnetMask_LE->text() ) ) |
53 | return tr("Subnet mask not valid"); | 53 | return tr("Subnet mask not valid"); |
54 | if( ! validIP( Broadcast_LE->text() ) ) | 54 | if( ! validIP( Broadcast_LE->text() ) ) |
55 | return tr("Broadcast address not valid"); | 55 | return tr("Broadcast address not valid"); |
56 | if( Gateway_LE->text().isEmpty() || | 56 | if( Gateway_LE->text().isEmpty() || |
57 | ! validIP( Gateway_LE->text() ) ) | 57 | ! validIP( Gateway_LE->text() ) ) |
58 | return tr("Gateway address not valid"); | 58 | return tr("Gateway address not valid"); |
59 | if( ! DNS1_LE->text().isEmpty() && | 59 | if( ! DNS1_LE->text().isEmpty() && |
60 | ! validIP( DNS1_LE->text() ) ) | 60 | ! validIP( DNS1_LE->text() ) ) |
61 | return tr("DNS1 address not valid"); | 61 | return tr("DNS1 address not valid"); |
62 | if( ! DNS2_LE->text().isEmpty() && | 62 | if( ! DNS2_LE->text().isEmpty() && |
63 | ! validIP( DNS2_LE->text() ) ) | 63 | ! validIP( DNS2_LE->text() ) ) |
64 | return tr("DNS2 address not valid"); | 64 | return tr("DNS2 address not valid"); |
65 | return QString(); | 65 | return QString(); |
66 | } | 66 | } |
67 | 67 | ||
68 | bool NetworkEdit::commit( NetworkData_t & Data ) { | 68 | bool NetworkEdit::commit( NetworkData & Data ) { |
69 | bool SM = 0; | 69 | bool SM = 0; |
70 | CBM( Data.UseDHCP, DHCP_CB, SM ); | 70 | CBM( Data.UseDHCP, DHCP_CB, SM ); |
71 | TXTM( Data.IPAddress, IPAddress_LE, SM ); | 71 | TXTM( Data.IPAddress, IPAddress_LE, SM ); |
72 | CBM( Data.SendHostname, SendHostname_CB, SM ); | 72 | CBM( Data.SendHostname, SendHostname_CB, SM ); |
73 | TXTM( Data.Hostname, Hostname_LE, SM ); | 73 | TXTM( Data.Hostname, Hostname_LE, SM ); |
74 | TXTM( Data.Gateway, Gateway_LE, SM ); | 74 | TXTM( Data.Gateway, Gateway_LE, SM ); |
75 | TXTM( Data.Broadcast, Broadcast_LE, SM ); | 75 | TXTM( Data.Broadcast, Broadcast_LE, SM ); |
76 | TXTM( Data.NetMask, SubnetMask_LE, SM ); | 76 | TXTM( Data.NetMask, SubnetMask_LE, SM ); |
77 | TXTM( Data.DNS1, DNS1_LE, SM ); | 77 | TXTM( Data.DNS1, DNS1_LE, SM ); |
78 | TXTM( Data.DNS2, DNS2_LE, SM ); | 78 | TXTM( Data.DNS2, DNS2_LE, SM ); |
79 | 79 | ||
80 | SM |= updateList( Data.PreUp_SL, PreUp_LB ); | 80 | SM |= updateList( Data.PreUp_SL, PreUp_LB ); |
81 | SM |= updateList( Data.PostUp_SL, PostUp_LB ); | 81 | SM |= updateList( Data.PostUp_SL, PostUp_LB ); |
82 | SM |= updateList( Data.PreDown_SL, PreDown_LB ); | 82 | SM |= updateList( Data.PreDown_SL, PreDown_LB ); |
83 | SM |= updateList( Data.PostDown_SL, PostDown_LB ); | 83 | SM |= updateList( Data.PostDown_SL, PostDown_LB ); |
84 | 84 | ||
85 | return SM; | 85 | return SM; |
86 | } | 86 | } |
87 | 87 | ||
88 | void NetworkEdit::showData( NetworkData_t & Data ) { | 88 | void NetworkEdit::showData( NetworkData & Data ) { |
89 | DHCP_CB->setChecked( Data.UseDHCP ); | 89 | DHCP_CB->setChecked( Data.UseDHCP ); |
90 | SendHostname_CB->setChecked( Data.SendHostname ); | 90 | SendHostname_CB->setChecked( Data.SendHostname ); |
91 | Hostname_LE->setText( Data.Hostname ); | 91 | Hostname_LE->setText( Data.Hostname ); |
92 | IPAddress_LE->setText( Data.IPAddress ); | 92 | IPAddress_LE->setText( Data.IPAddress ); |
93 | Gateway_LE->setText( Data.Gateway ); | 93 | Gateway_LE->setText( Data.Gateway ); |
94 | SubnetMask_LE->setText( Data.NetMask ); | 94 | SubnetMask_LE->setText( Data.NetMask ); |
95 | Broadcast_LE->setText( Data.Broadcast ); | 95 | Broadcast_LE->setText( Data.Broadcast ); |
96 | DNS1_LE->setText( Data.DNS1 ); | 96 | DNS1_LE->setText( Data.DNS1 ); |
97 | DNS2_LE->setText( Data.DNS2 ); | 97 | DNS2_LE->setText( Data.DNS2 ); |
98 | 98 | ||
99 | populateList( Data.PreUp_SL, PreUp_LB ); | 99 | populateList( Data.PreUp_SL, PreUp_LB ); |
100 | populateList( Data.PostUp_SL, PostUp_LB ); | 100 | populateList( Data.PostUp_SL, PostUp_LB ); |
101 | populateList( Data.PreDown_SL, PreDown_LB ); | 101 | populateList( Data.PreDown_SL, PreDown_LB ); |
102 | populateList( Data.PostDown_SL, PostDown_LB ); | 102 | populateList( Data.PostDown_SL, PostDown_LB ); |
103 | } | 103 | } |
104 | 104 | ||
105 | bool NetworkEdit::updateList( QStringList & SL, QListBox * LB ) { | 105 | bool NetworkEdit::updateList( QStringList & SL, QListBox * LB ) { |
106 | bool Changed; | 106 | bool Changed; |
107 | QStringList NewSL; | 107 | QStringList NewSL; |
108 | 108 | ||
109 | // collect new list | 109 | // collect new list |
110 | for( unsigned int i = 0; i < LB->count() ; i ++ ) { | 110 | for( unsigned int i = 0; i < LB->count() ; i ++ ) { |
111 | NewSL.append( LB->text(i) ); | 111 | NewSL.append( LB->text(i) ); |
112 | } | 112 | } |
113 | 113 | ||
114 | if( NewSL.count() != SL.count() ) { | 114 | if( NewSL.count() != SL.count() ) { |
115 | // less or more items | 115 | // less or more items |
116 | SL= NewSL; | 116 | SL= NewSL; |
117 | return 1; | 117 | return 1; |
118 | } | 118 | } |
119 | 119 | ||
120 | // Same size -> same content ? | 120 | // Same size -> same content ? |
121 | Changed = 0; | 121 | Changed = 0; |
122 | for ( QStringList::Iterator it = NewSL.begin(); | 122 | for ( QStringList::Iterator it = NewSL.begin(); |
123 | it != NewSL.end(); | 123 | it != NewSL.end(); |
124 | ++it ) { | 124 | ++it ) { |
125 | if( SL.findIndex( (*it) ) < 0 ) { | 125 | if( SL.findIndex( (*it) ) < 0 ) { |
126 | // new or modified item | 126 | // new or modified item |
127 | Changed = 1; | 127 | Changed = 1; |
128 | SL = NewSL; | 128 | SL = NewSL; |
129 | break; | 129 | break; |
130 | } | 130 | } |
131 | } | 131 | } |
132 | return Changed; | 132 | return Changed; |
133 | } | 133 | } |
134 | 134 | ||
135 | void NetworkEdit::populateList( QStringList & SL, QListBox * LB ) { | 135 | void NetworkEdit::populateList( QStringList & SL, QListBox * LB ) { |
136 | LB->clear(); | 136 | LB->clear(); |
137 | for ( QStringList::Iterator it = SL.begin(); | 137 | for ( QStringList::Iterator it = SL.begin(); |
138 | it != SL.end(); | 138 | it != SL.end(); |
139 | ++it ) { | 139 | ++it ) { |
140 | LB->insertItem( (*it) ); | 140 | LB->insertItem( (*it) ); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | void NetworkEdit::SLOT_NetmaskModified( const QString & ) { | 144 | void NetworkEdit::SLOT_NetmaskModified( const QString & ) { |
145 | QString IP, SN; | 145 | QString IP, SN; |
146 | IP = IPAddress_LE->text(); | 146 | IP = IPAddress_LE->text(); |
147 | SN = SubnetMask_LE->text(); | 147 | SN = SubnetMask_LE->text(); |
148 | if( IP.isEmpty() || SN.isEmpty() ) | 148 | if( IP.isEmpty() || SN.isEmpty() ) |
149 | return; | 149 | return; |
150 | 150 | ||
151 | if( ! validIP(IP) || ! validIP( SN ) ) | 151 | if( ! validIP(IP) || ! validIP( SN ) ) |
152 | return; | 152 | return; |
153 | 153 | ||
154 | // if all ones | 154 | // if all ones |
155 | // broadcast = (IPAddress | ~netmask ) | 155 | // broadcast = (IPAddress | ~netmask ) |
156 | { QString NW; | 156 | { QString NW; |
157 | QStringList ipal = QStringList::split( '.', IP ); | 157 | QStringList ipal = QStringList::split( '.', IP ); |
158 | QStringList nmal = QStringList::split( '.', SN ); | 158 | QStringList nmal = QStringList::split( '.', SN ); |
159 | 159 | ||
160 | NW = QString( "%1.%2.%3.%4" ). | 160 | NW = QString( "%1.%2.%3.%4" ). |
161 | arg( ipal[0].toShort() | ( ~ nmal[0].toShort() & 0x00ff) ). | 161 | arg( ipal[0].toShort() | ( ~ nmal[0].toShort() & 0x00ff) ). |
162 | arg( ipal[1].toShort() | ( ~ nmal[1].toShort() & 0x00ff) ). | 162 | arg( ipal[1].toShort() | ( ~ nmal[1].toShort() & 0x00ff) ). |
163 | arg( ipal[2].toShort() | ( ~ nmal[2].toShort() & 0x00ff) ). | 163 | arg( ipal[2].toShort() | ( ~ nmal[2].toShort() & 0x00ff) ). |
164 | arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) ); | 164 | arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) ); |
165 | Broadcast_LE->setText( NW ); | 165 | Broadcast_LE->setText( NW ); |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | QListBox * NetworkEdit::getActiveLB( void ) { | 169 | QListBox * NetworkEdit::getActiveLB( void ) { |
170 | switch( Tab_TAB->currentPageIndex() ) { | 170 | switch( Tab_TAB->currentPageIndex() ) { |
171 | case 0 : | 171 | case 0 : |
172 | return PreUp_LB; | 172 | return PreUp_LB; |
173 | case 1 : | 173 | case 1 : |
174 | return PostUp_LB; | 174 | return PostUp_LB; |
175 | case 2 : | 175 | case 2 : |
176 | return PreDown_LB; | 176 | return PreDown_LB; |
177 | } | 177 | } |
178 | return PostDown_LB; | 178 | return PostDown_LB; |
179 | } | 179 | } |
180 | 180 | ||
181 | void NetworkEdit::SLOT_Add( void ) { | 181 | void NetworkEdit::SLOT_Add( void ) { |
182 | if( Command_LE->text().isEmpty() ) | 182 | if( Command_LE->text().isEmpty() ) |
183 | return; | 183 | return; |
184 | QListBox * LB = getActiveLB(); | 184 | QListBox * LB = getActiveLB(); |
185 | 185 | ||
186 | LB->insertItem( Command_LE->text() ); | 186 | LB->insertItem( Command_LE->text() ); |
187 | } | 187 | } |
188 | 188 | ||
189 | void NetworkEdit::SLOT_Remove( void ) { | 189 | void NetworkEdit::SLOT_Remove( void ) { |
190 | QListBox * LB = getActiveLB(); | 190 | QListBox * LB = getActiveLB(); |
191 | int i; | 191 | int i; |
192 | 192 | ||
193 | if( ( i = LB->currentItem() ) >= 0 ) { | 193 | if( ( i = LB->currentItem() ) >= 0 ) { |
194 | LB->removeItem( i ); | 194 | LB->removeItem( i ); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | void NetworkEdit::SLOT_Up( void ) { | 198 | void NetworkEdit::SLOT_Up( void ) { |
199 | QListBox * LB = getActiveLB(); | 199 | QListBox * LB = getActiveLB(); |
200 | int i; | 200 | int i; |
201 | 201 | ||
202 | if( ( i = LB->currentItem() ) > 0 ) { | 202 | if( ( i = LB->currentItem() ) > 0 ) { |
203 | QListBoxItem * LBI = LB->item(i); | 203 | QListBoxItem * LBI = LB->item(i); |
204 | LB->takeItem( LBI ); | 204 | LB->takeItem( LBI ); |
205 | LB->insertItem( LBI, --i ); | 205 | LB->insertItem( LBI, --i ); |
206 | LB->setCurrentItem( i ); | 206 | LB->setCurrentItem( i ); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | void NetworkEdit::SLOT_Down( void ) { | 210 | void NetworkEdit::SLOT_Down( void ) { |
211 | QListBox * LB = getActiveLB(); | 211 | QListBox * LB = getActiveLB(); |
212 | int i; | 212 | int i; |
213 | 213 | ||
214 | if( ( i = LB->currentItem() ) >= 0 && (unsigned)(i+1) != LB->count() ) { | 214 | if( ( i = LB->currentItem() ) >= 0 && (unsigned)(i+1) != LB->count() ) { |
215 | QListBoxItem * LBI = LB->item(i); | 215 | QListBoxItem * LBI = LB->item(i); |
216 | LB->takeItem( LBI ); | 216 | LB->takeItem( LBI ); |
217 | LB->insertItem( LBI, ++i ); | 217 | LB->insertItem( LBI, ++i ); |
218 | LB->setCurrentItem( i ); | 218 | LB->setCurrentItem( i ); |
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | void NetworkEdit::SLOT_ShowCommand( QListBoxItem * It ) { | 222 | void NetworkEdit::SLOT_ShowCommand( QListBoxItem * It ) { |
223 | Command_LE->setText( It->text() ); | 223 | Command_LE->setText( It->text() ); |
224 | } | 224 | } |
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 | |||
@@ -1,29 +1,29 @@ | |||
1 | #include "networkdata.h" | 1 | #include "networkdata.h" |
2 | #include "networkGUI.h" | 2 | #include "networkGUI.h" |
3 | 3 | ||
4 | class QListBox; | 4 | class QListBox; |
5 | 5 | ||
6 | class NetworkEdit : public NetworkGUI { | 6 | class NetworkEdit : public NetworkGUI { |
7 | 7 | ||
8 | public : | 8 | public : |
9 | 9 | ||
10 | NetworkEdit( QWidget * parent ); | 10 | NetworkEdit( QWidget * parent ); |
11 | QString acceptable( void ); | 11 | QString acceptable( void ); |
12 | bool commit( NetworkData_t & Data ); | 12 | bool commit( NetworkData & Data ); |
13 | void showData( NetworkData_t & Data ); | 13 | void showData( NetworkData & Data ); |
14 | 14 | ||
15 | public slots : | 15 | public slots : |
16 | 16 | ||
17 | void SLOT_NetmaskModified( const QString & S ); | 17 | void SLOT_NetmaskModified( const QString & S ); |
18 | void SLOT_ShowCommand( QListBoxItem * LBI ); | 18 | void SLOT_ShowCommand( QListBoxItem * LBI ); |
19 | void SLOT_Add( void ); | 19 | void SLOT_Add( void ); |
20 | void SLOT_Remove( void ); | 20 | void SLOT_Remove( void ); |
21 | void SLOT_Up( void ); | 21 | void SLOT_Up( void ); |
22 | void SLOT_Down( void ); | 22 | void SLOT_Down( void ); |
23 | 23 | ||
24 | private : | 24 | private : |
25 | 25 | ||
26 | QListBox * getActiveLB( void ); | 26 | QListBox * getActiveLB( void ); |
27 | bool updateList( QStringList &SL, QListBox * LB ); | 27 | bool updateList( QStringList &SL, QListBox * LB ); |
28 | void populateList( QStringList &SL, QListBox * LB ); | 28 | void populateList( QStringList &SL, QListBox * LB ); |
29 | }; | 29 | }; |
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 @@ | |||
1 | #include <system.h> | 1 | #include <system.h> |
2 | #include <asdevice.h> | 2 | #include <netnode.h> |
3 | #include <resources.h> | ||
3 | #include "networkrun.h" | 4 | #include "networkrun.h" |
4 | 5 | ||
5 | void NetworkRun::detectState( NodeCollection * NC ) { | 6 | State_t NetworkRun::detectState( void ) { |
6 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | 7 | InterfaceInfo * II = nodeCollection()->assignedInterface(); |
7 | AsDevice * Next = RI->asDevice(); | ||
8 | InterfaceInfo * II = Next->assignedInterface(); | ||
9 | 8 | ||
10 | if( II ) { | 9 | Log(( "Interface %p : %d\n", II, (II) ? II->IsUp : 0 )); |
10 | if( II && II->IsUp ) { | ||
11 | // device has assigned interface | 11 | // device has assigned interface |
12 | NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) ); | 12 | return IsUp; |
13 | return; | ||
14 | } | 13 | } |
15 | 14 | ||
16 | Log(( "%s not ! UP or ava\n", NC->name().latin1() )); | 15 | // had no interface or interface is no longer up -> release |
17 | // has no interface -> delegate | 16 | nodeCollection()->assignInterface( 0 ); |
18 | RI->detectState( NC ); | 17 | |
18 | return Unknown; | ||
19 | } | 19 | } |
20 | 20 | ||
21 | bool NetworkRun::setState( NodeCollection * NC, Action_t A, bool Force ) { | 21 | QString NetworkRun::setMyState( NodeCollection * NC, Action_t A, bool ) { |
22 | // we handle UP and DOWN | 22 | // we handle UP and DOWN |
23 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | 23 | InterfaceInfo * II = NC->assignedInterface(); |
24 | AsDevice * Next = RI->asDevice(); | ||
25 | InterfaceInfo * II = Next->assignedInterface(); | ||
26 | 24 | ||
27 | if( A == Up ) { | 25 | if( A == Up ) { |
28 | // we can bring UP if lower level is available | 26 | // we can bring UP if lower level is available |
29 | if( NC->currentState() == Available || Force ) { | 27 | QStringList SL; |
30 | QString S; | 28 | SL << "ifup" |
31 | S.sprintf( "ifup %s=%s-c%d-allowed", | 29 | << QString().sprintf( "%s=%s-c%d-allowed", |
32 | II->Name.latin1(), II->Name.latin1(), | 30 | II->Name.latin1(), II->Name.latin1(), |
33 | connection()->number() ); | 31 | nodeCollection()->number() ); |
34 | NSResources->system().runAsRoot( S ); | 32 | if( ! NSResources->system().runAsRoot( SL ) ) { |
33 | return QString("Cannot call %1").arg(SL.join(" ")); | ||
35 | } | 34 | } |
36 | return 1; | 35 | return QString(); |
37 | } else if( A == Down ) { | 36 | } |
38 | QString S; | 37 | |
39 | if( Force ) { | 38 | if( A == Down ) { |
40 | Log(("Force mode %d\n", Force )); | 39 | QStringList SL; |
41 | for( int i = 0; | 40 | if( II ) { |
42 | i < RI->netNode()->nodeClass()->instanceCount(); | 41 | SL << "ifdown" |
43 | i ++ ) { | 42 | << II->Name.latin1(); |
44 | S.sprintf( "ifdown %s", | 43 | if( ! NSResources->system().runAsRoot( SL ) ) { |
45 | RI->netNode()->nodeClass()->genNic( i ).latin1() ); | 44 | return QString( "Cannot call %1" ).arg( SL.join( " " )); |
46 | NSResources->system().runAsRoot( S ); | ||
47 | } | 45 | } |
48 | } else { | 46 | } else { |
49 | if( NC->currentState() == IsUp ) { | 47 | Log(( "no interface assigned." )); |
50 | S.sprintf( "ifdown %s=%s-c%d-allowed", | ||
51 | II->Name.latin1(), II->Name.latin1(), | ||
52 | connection()->number() ); | ||
53 | NSResources->system().runAsRoot( S ); | ||
54 | } | ||
55 | } | 48 | } |
56 | return 1; | ||
57 | } | ||
58 | // delegate | ||
59 | return RI->setState( NC, A, Force ); | ||
60 | } | ||
61 | |||
62 | bool NetworkRun::canSetState( State_t Curr, Action_t A ) { | ||
63 | // we handle UP and DOWN | ||
64 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | ||
65 | |||
66 | if( A == Up ) { | ||
67 | return ( Curr == Available ); | ||
68 | } else if( A == Down ) { | ||
69 | return ( Curr == IsUp ); | ||
70 | } | 49 | } |
71 | // delegate | 50 | return QString(); |
72 | return RI->canSetState( Curr, A ); | ||
73 | } | ||
74 | |||
75 | bool NetworkRun::handlesInterface( const QString & S ) { | ||
76 | // donno -> pass deeper | ||
77 | return netNode()->nextNode()->runtime()->handlesInterface(S); | ||
78 | } | 51 | } |
diff --git a/noncore/settings/networksettings2/network/networkrun.h b/noncore/settings/networksettings2/network/networkrun.h index 522a912..78a1694 100644 --- a/noncore/settings/networksettings2/network/networkrun.h +++ b/noncore/settings/networksettings2/network/networkrun.h | |||
@@ -1,23 +1,20 @@ | |||
1 | #include <asconnection.h> | 1 | #include <netnode.h> |
2 | #include "networkdata.h" | 2 | #include "networkdata.h" |
3 | 3 | ||
4 | class NetworkRun : public AsConnection { | 4 | class NetworkRun : public RuntimeInfo { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | NetworkRun( ANetNodeInstance * NNI, | 8 | NetworkRun( ANetNodeInstance * NNI, |
9 | NetworkData & Data ) : AsConnection( NNI ) | 9 | NetworkData & Data ) : RuntimeInfo( NNI ) |
10 | { } | 10 | { } |
11 | 11 | ||
12 | virtual AsConnection * asConnection( void ) | 12 | virtual RuntimeInfo * connection( void ) |
13 | { return (AsConnection *)this; } | 13 | { return this; } |
14 | 14 | ||
15 | protected : | 15 | State_t detectState( void ); |
16 | |||
17 | void detectState( NodeCollection * ); | ||
18 | bool setState( NodeCollection * ,Action_t A, bool ); | ||
19 | bool canSetState( State_t , Action_t A ); | ||
20 | 16 | ||
21 | bool handlesInterface( const QString & I ); | 17 | protected : |
22 | 18 | ||
19 | QString setMyState( NodeCollection * , Action_t, bool ); | ||
23 | }; | 20 | }; |
diff --git a/noncore/settings/networksettings2/network/opie-networksettings2plugin-network.control b/noncore/settings/networksettings2/network/opie-networksettings2plugin-network.control index 3dbb808..7b1056b 100644 --- a/noncore/settings/networksettings2/network/opie-networksettings2plugin-network.control +++ b/noncore/settings/networksettings2/network/opie-networksettings2plugin-network.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-networksettingsplugin2-network | 1 | Package: opie-networksettings2plugin-network |
2 | Files: plugins/networksettings2/libnetwork.so* | 2 | Files: plugins/networksettings2/libnetwork.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Generate TCPIP Network settings plugin | 8 | Description: Generate TCPIP Network settings plugin |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,469 +1,514 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <unistd.h> | 2 | #include <unistd.h> |
3 | #include <errno.h> | 3 | #include <errno.h> |
4 | 4 | ||
5 | #include <opie2/odebug.h> | ||
6 | #include <opie2/oledbox.h> | ||
7 | |||
5 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
6 | #include <qlistbox.h> | 9 | #include <qlistbox.h> |
10 | #include <qlayout.h> | ||
7 | #include <qgroupbox.h> | 11 | #include <qgroupbox.h> |
8 | #include <qtimer.h> | 12 | #include <qtimer.h> |
9 | #include <qlistbox.h> | 13 | #include <qlistbox.h> |
10 | #include <qmessagebox.h> | 14 | #include <qmessagebox.h> |
11 | #include <qlabel.h> | 15 | #include <qlabel.h> |
12 | #include <qiconview.h> | 16 | #include <qiconview.h> |
13 | #include <qtimer.h> | 17 | #include <qtimer.h> |
14 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
15 | #include <qtoolbutton.h> | 19 | #include <qtoolbutton.h> |
16 | #include <qevent.h> | 20 | #include <qevent.h> |
17 | 21 | ||
18 | #include <asdevice.h> | ||
19 | #include "networksettings.h" | 22 | #include "networksettings.h" |
20 | #include "netnode.h" | 23 | #include "netnode.h" |
21 | #include "editconnection.h" | 24 | #include "editconnection.h" |
22 | 25 | ||
23 | NetworkSettings::NetworkSettings( QWidget *parent, | 26 | NetworkSettings::NetworkSettings( QWidget *parent, |
24 | const char *name, | 27 | const char *name, |
25 | WFlags fl ) : NetworkSettingsGUI(parent,name,fl), | 28 | WFlags fl ) : NetworkSettingsGUI(parent,name,fl), |
26 | NSD() { | 29 | NSD() { |
27 | 30 | ||
28 | UpdateTimer = new QTimer( this ); | 31 | UpdateTimer = new QTimer( this ); |
29 | 32 | ||
30 | // set pixmaps | 33 | // set pixmaps |
31 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 34 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
32 | Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 35 | Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
33 | CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); | 36 | CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); |
34 | Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); | ||
35 | GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); | 37 | GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); |
36 | 38 | ||
37 | Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); | 39 | Disable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); |
38 | Disconnect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) ); | 40 | Up_TB->setPixmap( NSResources->getPixmap( "more" ) ); |
41 | Down_TB->setPixmap( NSResources->getPixmap( "less" ) ); | ||
42 | |||
43 | QVBoxLayout* V = new QVBoxLayout( LED_Frm ); | ||
44 | QHBoxLayout * H = new QHBoxLayout( 0 ); | ||
45 | V->addStretch(1); | ||
46 | V->addLayout( H ); | ||
47 | Leds[0] = new OLedBox( red, LED_Frm ); | ||
48 | H->addWidget( Leds[0], 0, Qt::AlignVCenter ); | ||
49 | Leds[1] = new OLedBox( red, LED_Frm ); | ||
50 | H->addWidget( Leds[1], 0, Qt::AlignVCenter ); | ||
51 | Leds[2] = new OLedBox( red, LED_Frm ); | ||
52 | H->addWidget( Leds[2], 0, Qt::AlignVCenter ); | ||
53 | V->addStretch(1); | ||
39 | 54 | ||
40 | On_TB->setPixmap( NSResources->getPixmap( "off" ) ); | ||
41 | 55 | ||
42 | SLOT_ToProfile(); | 56 | SLOT_ToProfile(); |
43 | 57 | ||
44 | // populate main Listbox | 58 | // populate main Listbox |
45 | Profiles_LB->clear(); | 59 | Profiles_LB->clear(); |
46 | QPEApplication::setStylusOperation( | 60 | QPEApplication::setStylusOperation( |
47 | Profiles_LB->viewport(), QPEApplication::RightOnHold ); | 61 | Profiles_LB->viewport(), QPEApplication::RightOnHold ); |
48 | 62 | ||
49 | connect( Profiles_LB, | 63 | connect( Profiles_LB, |
50 | SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)), | 64 | SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)), |
51 | this, SLOT(SLOT_EditNode(QListBoxItem*)) ); | 65 | this, SLOT(SLOT_EditNode(QListBoxItem*)) ); |
52 | 66 | ||
53 | { Name2Connection_t & M = NSResources->connections(); | 67 | { Name2Connection_t & M = NSResources->connections(); |
54 | NodeCollection * NC; | 68 | NodeCollection * NC; |
55 | // for all connections | 69 | // for all connections |
56 | for( QDictIterator<NodeCollection> it(M); | 70 | for( QDictIterator<NodeCollection> it(M); |
57 | it.current(); | 71 | it.current(); |
58 | ++it ) { | 72 | ++it ) { |
59 | NC = it.current(); | 73 | NC = it.current(); |
60 | Profiles_LB->insertItem( NC->devicePixmap(), | 74 | Profiles_LB->insertItem( NC->devicePixmap(), |
61 | NC->name() ); | 75 | NC->name() ); |
62 | } | 76 | } |
63 | } | 77 | } |
64 | 78 | ||
65 | if( Profiles_LB->count() ) { | 79 | if( Profiles_LB->count() ) { |
66 | Profiles_LB->setSelected( 0, TRUE ); | 80 | Profiles_LB->setSelected( 0, TRUE ); |
67 | } | 81 | } |
68 | 82 | ||
69 | // if no profiles -> auto popup editing | 83 | // if no profiles -> auto popup editing |
70 | if( NSResources->connections().count() == 0 ) { | 84 | if( NSResources->connections().count() == 0 ) { |
71 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); | 85 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); |
72 | } | 86 | } |
73 | 87 | ||
74 | connect( &(NSResources->system()), | 88 | connect( &(NSResources->system()), |
75 | SIGNAL( lineFromCommand(const QString &) ), | 89 | SIGNAL( stdoutLine(const QString &) ), |
90 | this, SLOT( SLOT_CmdMessage(const QString &) ) ); | ||
91 | |||
92 | connect( &(NSResources->system()), | ||
93 | SIGNAL( stderrLine(const QString &) ), | ||
94 | this, SLOT( SLOT_CmdMessage(const QString &) ) ); | ||
95 | |||
96 | connect( &(NSResources->system()), | ||
97 | SIGNAL( processEvent(const QString &) ), | ||
76 | this, SLOT( SLOT_CmdMessage(const QString &) ) ); | 98 | this, SLOT( SLOT_CmdMessage(const QString &) ) ); |
77 | 99 | ||
78 | UpdateTimer->start( 5000 ); | 100 | UpdateTimer->start( 5000 ); |
79 | connect( UpdateTimer, SIGNAL( timeout() ), | 101 | connect( UpdateTimer, SIGNAL( timeout() ), |
80 | this, SLOT( SLOT_RefreshStates() ) ); | 102 | this, SLOT( SLOT_RefreshStates() ) ); |
81 | 103 | ||
82 | /* Add QCopChannel */ | 104 | /* Add QCopChannel */ |
83 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 105 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
84 | this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); | 106 | this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); |
85 | } | 107 | } |
86 | 108 | ||
87 | NetworkSettings::~NetworkSettings() { | 109 | NetworkSettings::~NetworkSettings() { |
88 | QString S; | 110 | QString S; |
89 | 111 | ||
90 | if( isModified() ) { | 112 | owarn << "Dispose NS" << oendl; |
113 | if( NSD.isModified() ) { | ||
114 | owarn << "Modified" << oendl; | ||
91 | S = NSD.saveSettings(); | 115 | S = NSD.saveSettings(); |
92 | if( ! S.isEmpty() ) { | 116 | if( ! S.isEmpty() ) { |
117 | S.insert( 0, "<p>" ); | ||
118 | S.append( "</p>" ); | ||
93 | // problem saving | 119 | // problem saving |
94 | QMessageBox::warning( | 120 | QMessageBox::warning( |
95 | 0, | 121 | 0, |
96 | tr( "Saving setup" ), S ); | 122 | tr( "Saving setup" ), S ); |
97 | } | 123 | } |
98 | 124 | ||
99 | SLOT_GenerateConfig(); | 125 | SLOT_GenerateConfig(); |
126 | NSD.setModified( 0 ); | ||
100 | } | 127 | } |
101 | 128 | ||
102 | } | 129 | } |
103 | 130 | ||
104 | void NetworkSettings::SLOT_CmdMessage( const QString & S ) { | 131 | void NetworkSettings::SLOT_CmdMessage( const QString & S ) { |
105 | Messages_LB->insertItem( S ); | 132 | Messages_LB->insertItem( S ); |
106 | Messages_LB->setCurrentItem( Messages_LB->count()-1 ); | 133 | Messages_LB->setCurrentItem( Messages_LB->count()-1 ); |
107 | Messages_LB->ensureCurrentVisible(); | 134 | Messages_LB->ensureCurrentVisible(); |
108 | } | 135 | } |
109 | 136 | ||
110 | void NetworkSettings::SLOT_RefreshStates( void ) { | 137 | void NetworkSettings::SLOT_RefreshStates( void ) { |
111 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember | 138 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember |
112 | 139 | ||
113 | if( LBI ) { | 140 | if( LBI ) { |
114 | NodeCollection * NC; | 141 | NodeCollection * NC; |
115 | NSResources->system().probeInterfaces(); | 142 | NSResources->system().probeInterfaces(); |
116 | // update current selection only | 143 | // update current selection only |
117 | NC = NSResources->findConnection( LBI->text() ); | 144 | NC = NSResources->findConnection( LBI->text() ); |
118 | if( NC ) { | 145 | if( NC ) { |
119 | State_t OldS = NC->state(); | 146 | State_t OldS = NC->state(); |
120 | State_t NewS = NC->state(1); | 147 | State_t NewS = NC->state(1); |
121 | if( OldS != NewS ) { | 148 | if( OldS != NewS ) { |
122 | updateProfileState( LBI ); | 149 | updateProfileState( LBI ); |
123 | } | 150 | } |
124 | } | 151 | } |
125 | } | 152 | } |
126 | 153 | ||
127 | 154 | ||
128 | /* -> LATER !! | 155 | /* -> LATER !! |
129 | bool is; | 156 | bool is; |
130 | NodeCollection * NC; | 157 | NodeCollection * NC; |
131 | 158 | ||
132 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { | 159 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { |
133 | NC = NSResources->findConnection( Profiles_LB->text(i) ); | 160 | NC = NSResources->findConnection( Profiles_LB->text(i) ); |
134 | if( NC ) { | 161 | if( NC ) { |
135 | State_t OldS = NC->state(); | 162 | State_t OldS = NC->state(); |
136 | State_t NewS = NC->state(1); | 163 | State_t NewS = NC->state(1); |
137 | if( OldS != NewS ) { | 164 | if( OldS != NewS ) { |
138 | is = Profiles_LB->isSelected(i); | 165 | is = Profiles_LB->isSelected(i); |
139 | Profiles_LB->changeItem( NC->statePixmap(NewS), | 166 | Profiles_LB->changeItem( NC->statePixmap(NewS), |
140 | NC->name(), | 167 | NC->name(), |
141 | i ); | 168 | i ); |
142 | if( is ) { | 169 | if( is ) { |
143 | Profiles_LB->setSelected( i, TRUE ); | 170 | Profiles_LB->setSelected( i, TRUE ); |
144 | } | 171 | } |
145 | } | 172 | } |
146 | } | 173 | } |
147 | } | 174 | } |
148 | if( ci >= 0 ) | 175 | if( ci >= 0 ) |
149 | Profiles_LB->setCurrentItem( ci ); | 176 | Profiles_LB->setCurrentItem( ci ); |
150 | */ | 177 | */ |
151 | } | 178 | } |
152 | 179 | ||
153 | void NetworkSettings::SLOT_AddNode( void ) { | 180 | void NetworkSettings::SLOT_AddNode( void ) { |
154 | SLOT_EditNode( 0 ); | 181 | SLOT_EditNode( 0 ); |
155 | } | 182 | } |
156 | 183 | ||
157 | void NetworkSettings::SLOT_DeleteNode( void ) { | 184 | void NetworkSettings::SLOT_DeleteNode( void ) { |
158 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 185 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
159 | 186 | ||
160 | if ( ! LBI ) | 187 | if ( ! LBI ) |
161 | return; | 188 | return; |
162 | 189 | ||
163 | if( QMessageBox::warning( | 190 | if( QMessageBox::warning( |
164 | 0, | 191 | 0, |
165 | tr( "Removing profile" ), | 192 | tr( "Removing profile" ), |
166 | tr( "Remove selected profile ?" ), | 193 | tr( "Remove selected profile ?" ), |
167 | 1, 0 ) == 1 ) { | 194 | 1, 0 ) == 1 ) { |
168 | NSResources->removeConnection( LBI->text() ); | 195 | NSResources->removeConnection( LBI->text() ); |
169 | delete LBI; | 196 | delete LBI; |
170 | setModified( 1 ); | 197 | NSD.setModified( 1 ); |
171 | } | 198 | } |
172 | } | 199 | } |
173 | 200 | ||
174 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | 201 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { |
175 | QString OldName = ""; | 202 | QString OldName = ""; |
176 | 203 | ||
177 | printf( "------------------ Edit NOde\n" ); | ||
178 | EditConnection EC( this ); | 204 | EditConnection EC( this ); |
179 | 205 | ||
180 | if( LBI ) { | 206 | if( LBI ) { |
181 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 207 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
182 | if( ! NC ) { | 208 | if( ! NC ) { |
183 | return; | 209 | return; |
184 | } | 210 | } |
185 | OldName = NC->name(); | 211 | OldName = NC->name(); |
186 | EC.setConnection( NC ); | 212 | EC.setConnection( NC ); |
187 | } | 213 | } |
188 | 214 | ||
189 | EC.showMaximized(); | 215 | EC.showMaximized(); |
190 | // disable refresh timer | 216 | // disable refresh timer |
191 | UpdateTimer->stop(); | 217 | UpdateTimer->stop(); |
192 | 218 | ||
193 | // we need to retry | 219 | // we need to retry |
194 | while( 1 ) { | 220 | while( 1 ) { |
195 | if( EC.exec() == QDialog::Accepted ) { | 221 | if( EC.exec() == QDialog::Accepted ) { |
196 | // toplevel item -> store | 222 | // toplevel item -> store |
197 | NodeCollection * NC = EC.connection(); | 223 | NodeCollection * NC = EC.connection(); |
198 | if( NC->isModified() ) { | 224 | if( NC->isModified() ) { |
199 | setModified( 1 ); | ||
200 | if( LBI ) { | 225 | if( LBI ) { |
201 | if( NC->name() != OldName ) { | 226 | if( NC->name() != OldName ) { |
202 | // find if new name is free | 227 | // find if new name is free |
203 | NodeCollection * LCN = NSResources->findConnection( | 228 | NodeCollection * LCN = NSResources->findConnection( |
204 | NC->name() ); | 229 | NC->name() ); |
205 | if( LCN ) { | 230 | if( LCN ) { |
206 | QMessageBox::warning( | 231 | QMessageBox::warning( |
207 | 0, | 232 | 0, |
208 | tr( "In System Config" ), | 233 | tr( "In System Config" ), |
209 | tr( "Name %1 already exists" ).arg(NC->name()) | 234 | tr( "Name %1 already exists" ).arg(NC->name()) |
210 | ); | 235 | ); |
211 | continue; // restart exec | 236 | continue; // restart exec |
212 | } // else new name | 237 | } // else new name |
213 | // new name -> remove item | 238 | // new name -> remove item |
214 | NSResources->removeConnection( OldName ); | 239 | NSResources->removeConnection( OldName ); |
215 | NSResources->addConnection( NC ); | 240 | NSResources->addConnection( NC ); |
216 | } // else not changed | 241 | } // else not changed |
217 | 242 | ||
218 | // must add it here since change will trigger event | 243 | // must add it here since change will trigger event |
219 | Profiles_LB->changeItem( NC->devicePixmap(), | 244 | Profiles_LB->changeItem( NC->devicePixmap(), |
220 | NC->name(), | 245 | NC->name(), |
221 | Profiles_LB->index( LBI ) | 246 | Profiles_LB->index( LBI ) |
222 | ); | 247 | ); |
223 | } else { | 248 | } else { |
224 | // new item | 249 | // new item |
225 | int ci = Profiles_LB->count(); | 250 | int ci = Profiles_LB->count(); |
226 | NSResources->addConnection( NC ); | 251 | NSResources->addConnection( NC ); |
227 | NC->setNumber( NSResources->assignConnectionNumber() ); | 252 | NC->setNumber( NSResources->assignConnectionNumber() ); |
228 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); | 253 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); |
229 | Profiles_LB->setSelected( ci, TRUE ); | 254 | Profiles_LB->setSelected( ci, TRUE ); |
230 | } | 255 | } |
231 | updateProfileState( LBI ); | 256 | updateProfileState( LBI ); |
232 | } | 257 | } |
233 | } else { | 258 | } else { |
234 | // cancelled : reset connection | 259 | // cancelled : reset connection |
235 | if( LBI ) { | 260 | if( LBI ) { |
236 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 261 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
237 | NC->reassign(); | 262 | NC->reassign(); |
238 | } | 263 | } |
239 | } | 264 | } |
240 | break; | 265 | break; |
241 | } | 266 | } |
242 | // reenable | 267 | // reenable |
243 | UpdateTimer->start( 5000 ); | 268 | UpdateTimer->start( 5000 ); |
244 | } | 269 | } |
245 | 270 | ||
246 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { | 271 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { |
247 | if( LBI == 0 ) | 272 | if( LBI == 0 ) |
248 | return; | 273 | return; |
249 | 274 | ||
250 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 275 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
251 | 276 | ||
252 | // is button possible | 277 | if( NC->description().isEmpty() ) { |
253 | bool EnabledPossible, OnPossible, ConnectPossible; | 278 | Description_LBL->setText( tr( "<<No description>>" ) ); |
254 | // is button On or Off | 279 | } else { |
255 | bool DisabledOn, OnOn, ConnectOn; | 280 | Description_LBL->setText( NC->description() ); |
281 | } | ||
282 | |||
283 | Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() ); | ||
256 | 284 | ||
257 | EnabledPossible = OnPossible = ConnectPossible = 1; | 285 | bool FrmActive = 1; |
258 | DisabledOn = 1; | 286 | bool IsEnabled = 1; |
259 | OnOn = ConnectOn = 0; | 287 | int leds = 0; |
260 | 288 | ||
289 | owarn << "State " << NC->state() << oendl; | ||
261 | switch( NC->state() ) { | 290 | switch( NC->state() ) { |
262 | case Unknown : | 291 | case Disabled : // no further work |
263 | // cannot occur here | 292 | IsEnabled = 0; |
293 | FrmActive = 0; | ||
294 | owarn << "LEds " << leds << oendl; | ||
264 | break; | 295 | break; |
296 | case Unknown : | ||
265 | case Unchecked : | 297 | case Unchecked : |
266 | case Unavailable : | 298 | case Unavailable : |
267 | // cannot do anything but recheck | 299 | FrmActive = 0; |
268 | EnabledPossible = OnPossible = ConnectPossible = 0; | ||
269 | break; | ||
270 | case Disabled : | ||
271 | OnPossible = ConnectPossible = 0; | ||
272 | break; | 300 | break; |
273 | case Off : | 301 | case Off : |
274 | DisabledOn = 0; | 302 | leds = 1; |
275 | break; | 303 | break; |
276 | case Available : | 304 | case Available : |
277 | OnOn = 1; | 305 | leds = 2; |
278 | Connect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) ); | ||
279 | DisabledOn = 0; | ||
280 | break; | 306 | break; |
281 | case IsUp : | 307 | case IsUp : |
282 | OnOn = ConnectOn = 1; | 308 | leds = 3; |
283 | Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); | ||
284 | DisabledOn = 0; | ||
285 | break; | 309 | break; |
286 | } | 310 | } |
287 | 311 | ||
288 | if( ! OnOn ) { | 312 | Disable_TB->setOn( ! IsEnabled ); |
289 | Connect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) ); | 313 | LED_Frm->setEnabled( FrmActive ); |
290 | } | ||
291 | |||
292 | // set button state | ||
293 | Enable_TB->setEnabled( EnabledPossible ); | ||
294 | On_TB->setEnabled( OnPossible ); | ||
295 | Connect_TB->setEnabled( ConnectPossible ); | ||
296 | |||
297 | Enable_TB->setOn( DisabledOn ); | ||
298 | On_TB->setOn( OnOn ); | ||
299 | Connect_TB->setOn( ConnectOn ); | ||
300 | 314 | ||
301 | if( NC->description().isEmpty() ) { | 315 | for( int i = 0 ; i < leds; i ++ ) { |
302 | Description_LBL->setText( tr( "<<No description>>" ) ); | 316 | Leds[i]->setColor( red ); |
303 | } else { | 317 | Leds[i]->setOn( true ); |
304 | Description_LBL->setText( NC->description() ); | 318 | } |
319 | for( int i = leds ; i < 3; i ++ ) { | ||
320 | Leds[i]->setColor( red ); | ||
321 | Leds[i]->setOn( false ); | ||
305 | } | 322 | } |
306 | 323 | ||
307 | Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() ); | 324 | Up_TB->setEnabled( leds < 3 && leds != 0 ); |
325 | Down_TB->setEnabled( leds > 0 ); | ||
308 | } | 326 | } |
309 | 327 | ||
310 | void NetworkSettings::SLOT_CheckState( void ) { | 328 | void NetworkSettings::SLOT_CheckState( void ) { |
311 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 329 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
312 | if ( ! LBI ) | 330 | if ( ! LBI ) |
313 | return; | 331 | return; |
314 | updateProfileState( LBI ); | 332 | updateProfileState( LBI ); |
315 | } | 333 | } |
316 | 334 | ||
317 | void NetworkSettings::updateProfileState( QListBoxItem * LBI ) { | 335 | void NetworkSettings::updateProfileState( QListBoxItem * LBI ) { |
318 | if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) { | 336 | if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) { |
319 | SLOT_ShowNode( LBI ); | 337 | SLOT_ShowNode( LBI ); |
320 | } | 338 | } |
321 | } | 339 | } |
322 | 340 | ||
323 | void NetworkSettings::SLOT_GenerateConfig( void ) { | 341 | void NetworkSettings::SLOT_GenerateConfig( void ) { |
324 | NSD.regenerate(); | 342 | QString S = NSD.generateSettings(); |
343 | if( ! S.isEmpty() ) { | ||
344 | S.insert( 0, "<p>" ); | ||
345 | S.append( "</p>" ); | ||
346 | QMessageBox::warning( | ||
347 | 0, | ||
348 | tr( "Generate config" ), | ||
349 | S); | ||
350 | } | ||
325 | } | 351 | } |
326 | 352 | ||
327 | void NetworkSettings::SLOT_Enable( void ) { | 353 | void NetworkSettings::SLOT_Disable( bool T ) { |
328 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 354 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
329 | QString Msg; | 355 | QString Msg; |
356 | |||
330 | if ( ! LBI ) | 357 | if ( ! LBI ) |
331 | return; | 358 | return; |
332 | 359 | ||
333 | NodeCollection * NC = | 360 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
334 | NSResources->findConnection( LBI->text() ); | ||
335 | |||
336 | bool rv; | ||
337 | switch( NC->state() ) { | ||
338 | case Disabled : | ||
339 | Msg = tr( "Cannot enable profile" ); | ||
340 | rv = NC->setState( Enable ); | ||
341 | break; | ||
342 | default : | ||
343 | Msg = tr( "Cannot disable profile" ); | ||
344 | rv = NC->setState( Disable ); | ||
345 | break; | ||
346 | } | ||
347 | 361 | ||
348 | if( ! rv ) { | 362 | owarn << "Prepare to disable" << oendl; |
363 | Msg = NC->setState( (T) ? Disable : Enable ); | ||
364 | if( ! Msg.isEmpty() ) { | ||
365 | Msg.insert( 0, "<p>" ); | ||
366 | Msg.append( "</p>" ); | ||
349 | QMessageBox::warning( | 367 | QMessageBox::warning( |
350 | 0, | 368 | 0, |
351 | tr( "Activating profile" ), | 369 | tr( "Activating profile" ), |
352 | Msg ); | 370 | Msg ); |
353 | return; | 371 | return; |
354 | } | 372 | } |
373 | |||
374 | // reload new state | ||
375 | NC->state( true ); | ||
355 | updateProfileState( LBI ); | 376 | updateProfileState( LBI ); |
356 | } | 377 | } |
357 | 378 | ||
358 | void NetworkSettings::SLOT_On( void ) { | 379 | void NetworkSettings::SLOT_Up( void ) { |
380 | // bring more up | ||
381 | |||
359 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 382 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
383 | QString Msg; | ||
384 | int led = -1; | ||
360 | 385 | ||
361 | if ( ! LBI ) | 386 | if ( ! LBI ) |
362 | return; | 387 | return; |
363 | 388 | ||
364 | NodeCollection * NC = | 389 | NodeCollection * NC = |
365 | NSResources->findConnection( LBI->text() ); | 390 | NSResources->findConnection( LBI->text() ); |
366 | 391 | ||
367 | bool rv; | ||
368 | switch( NC->state() ) { | 392 | switch( NC->state() ) { |
369 | case Off : | 393 | case Disabled : // cannot modify this state |
370 | // activate interface | 394 | case Unknown : // cannot modify this state |
371 | rv = NC->setState( Activate ); | 395 | case Unchecked : // cannot modify this state |
396 | case Unavailable : // cannot modify this state | ||
397 | case IsUp : // highest UP state | ||
398 | return; | ||
399 | case Off : // -> activate | ||
400 | led = 1; | ||
401 | Down_TB->setEnabled( true ); | ||
402 | Log(( "Activate interface %s\n", NC->name().latin1() )); | ||
403 | Msg = NC->setState( Activate ); | ||
372 | break; | 404 | break; |
373 | case Available : // deactivate | 405 | case Available : // -> up |
374 | case IsUp : // deactivate (will also bring down if needed) | 406 | led = 2; |
375 | rv = NC->setState( Deactivate ); | 407 | Log(( "Bring up interface %s\n", NC->name().latin1() )); |
408 | Msg = NC->setState( Up ); | ||
409 | if( Msg.isEmpty() ) { | ||
410 | Up_TB->setEnabled( false ); | ||
411 | } | ||
376 | break; | 412 | break; |
377 | default : | 413 | } |
378 | // others no change | ||
379 | return; | ||
380 | } | ||
381 | 414 | ||
382 | if( ! rv ) { | 415 | if( ! Msg.isEmpty() ) { |
416 | Msg.insert( 0, "<p>" ); | ||
417 | Msg.append( "</p>" ); | ||
383 | QMessageBox::warning( | 418 | QMessageBox::warning( |
384 | 0, | 419 | 0, |
385 | tr( "Activating profile" ), | 420 | tr( "Increase availability" ), |
386 | tr( "Cannot enable profile" ) ); | 421 | Msg ); |
387 | return; | 422 | return; |
388 | } | 423 | } |
424 | |||
389 | updateProfileState( LBI ); | 425 | updateProfileState( LBI ); |
426 | |||
427 | // set color of led we should change | ||
428 | if( led > 0 ) { | ||
429 | Leds[led]->setColor( blue ); | ||
430 | Leds[led]->setOn( true ); | ||
431 | } | ||
432 | |||
390 | } | 433 | } |
391 | 434 | ||
392 | void NetworkSettings::SLOT_Connect( void ) { | 435 | void NetworkSettings::SLOT_Down( void ) { |
436 | // bring more down | ||
437 | |||
393 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 438 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
439 | int led = -1; | ||
440 | QString Msg; | ||
394 | 441 | ||
395 | if ( ! LBI ) | 442 | if ( ! LBI ) |
396 | return; | 443 | return; |
397 | 444 | ||
398 | NodeCollection * NC = | 445 | NodeCollection * NC = |
399 | NSResources->findConnection( LBI->text() ); | 446 | NSResources->findConnection( LBI->text() ); |
400 | 447 | ||
401 | bool rv = 1 ; | ||
402 | switch( NC->state() ) { | 448 | switch( NC->state() ) { |
403 | case IsUp : | 449 | case Disabled : // cannot modify this state |
404 | // down interface | 450 | case Unknown : // cannot modify this state |
405 | rv = NC->setState( Down ); | 451 | case Unchecked : // cannot modify this state |
406 | break; | 452 | case Unavailable : // cannot modify this state |
407 | case Available : | 453 | case Off : // highest DOWN state |
408 | // up interface | ||
409 | rv = NC->setState( Up ); | ||
410 | break; | 454 | break; |
411 | case Off : | 455 | case Available : // -> down |
412 | // activate and bring up | 456 | led = 0; |
413 | rv = ( NC->setState( Activate ) && | 457 | Log(( "Deactivate interface %s\n", NC->name().latin1() )); |
414 | NC->setState( Up ) ); | 458 | Msg = NC->setState( Deactivate ); |
459 | Down_TB->setEnabled( false ); | ||
415 | break; | 460 | break; |
416 | default : | 461 | case IsUp : // highest UP state |
417 | // others no change | 462 | led = 1; |
463 | Up_TB->setEnabled( true ); | ||
464 | Log(( "Bring down interface %s\n", NC->name().latin1() )); | ||
465 | Msg = NC->setState( Down, 1 ); | ||
466 | if( Msg.isEmpty() ) { | ||
467 | // remove 'up' file to make sure | ||
468 | unlink ( QString().sprintf( "/tmp/Profile-%d.up", NC->number() ).latin1() );; | ||
469 | } | ||
418 | break; | 470 | break; |
419 | } | 471 | } |
420 | 472 | ||
421 | if( ! rv ) { | 473 | if( ! Msg.isEmpty() ) { |
474 | Msg.insert( 0, "<p>" ); | ||
475 | Msg.append( "</p>" ); | ||
422 | QMessageBox::warning( | 476 | QMessageBox::warning( |
423 | 0, | 477 | 0, |
424 | tr( "Activating profile" ), | 478 | tr( "Decrease availability" ), |
425 | tr( "Cannot enable profile" ) ); | 479 | Msg ); |
426 | } | ||
427 | |||
428 | // we do not update the GUI but wait for the REAL upping of the device | ||
429 | } | ||
430 | |||
431 | void NetworkSettings::SLOT_Disconnect( void ) { | ||
432 | QString S; | ||
433 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | ||
434 | |||
435 | if ( ! LBI ) | ||
436 | return; | 480 | return; |
481 | } | ||
437 | 482 | ||
438 | NodeCollection * NC = | 483 | updateProfileState( LBI ); |
439 | NSResources->findConnection( LBI->text() ); | ||
440 | 484 | ||
441 | Log(( "Force interface %s down\n", NC->name().latin1() )); | 485 | // set color of led we should change |
442 | NC->setState( Down, 1 ); | 486 | if( led >= 0 ) { |
443 | // remove 'up' file to make sure | 487 | Leds[led]->setColor( blue ); |
444 | S.sprintf( "/tmp/Profile-%d.up", NC->number() ); | 488 | } |
445 | unlink( S.latin1() ); | ||
446 | } | 489 | } |
447 | 490 | ||
448 | void NetworkSettings::SLOT_ToMessages( void ) { | 491 | void NetworkSettings::SLOT_ToMessages( void ) { |
492 | Profiles_LB->hide(); | ||
449 | Profile_GB->hide(); | 493 | Profile_GB->hide(); |
450 | Messages_GB->show(); | 494 | Messages_GB->show(); |
451 | } | 495 | } |
452 | 496 | ||
453 | void NetworkSettings::SLOT_ToProfile( void ) { | 497 | void NetworkSettings::SLOT_ToProfile( void ) { |
498 | Profiles_LB->show(); | ||
454 | Profile_GB->show(); | 499 | Profile_GB->show(); |
455 | Messages_GB->hide(); | 500 | Messages_GB->hide(); |
456 | } | 501 | } |
457 | 502 | ||
458 | void NetworkSettings::SLOT_QCopMessage(const QCString &msg, const QByteArray &data) { | 503 | void NetworkSettings::SLOT_QCopMessage(const QCString &msg, const QByteArray &data) { |
459 | QDataStream stream( data, IO_ReadOnly ); | 504 | QDataStream stream( data, IO_ReadOnly ); |
460 | 505 | ||
461 | if( msg == "raise" ) { | 506 | if( msg == "raise" ) { |
462 | raise(); | 507 | raise(); |
463 | return; | 508 | return; |
464 | } /* if ( msg == "someMessage(int,int,int)" ) { | 509 | } /* if ( msg == "someMessage(int,int,int)" ) { |
465 | int a,b,c; | 510 | int a,b,c; |
466 | stream >> a >> b >> c; | 511 | stream >> a >> b >> c; |
467 | ... | 512 | ... |
468 | } */ | 513 | } */ |
469 | } | 514 | } |
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 | |||
@@ -1,53 +1,59 @@ | |||
1 | #include "nsdata.h" | 1 | #include "nsdata.h" |
2 | #include "networksettingsGUI.h" | 2 | #include "networksettingsGUI.h" |
3 | #include "resources.h" | 3 | #include "resources.h" |
4 | 4 | ||
5 | class ANetNode; | 5 | class ANetNode; |
6 | class ANetNodeInstance; | 6 | class ANetNodeInstance; |
7 | class QTimer; | 7 | class QTimer; |
8 | class QListBoxItem; | 8 | class QListBoxItem; |
9 | class QEvent; | 9 | class QEvent; |
10 | class OLedBox; | ||
10 | 11 | ||
11 | class NetworkSettings : public NetworkSettingsGUI { | 12 | class NetworkSettings : public NetworkSettingsGUI { |
12 | 13 | ||
13 | Q_OBJECT | 14 | Q_OBJECT |
14 | 15 | ||
15 | public : | 16 | public : |
16 | 17 | ||
17 | NetworkSettings( QWidget *parent=0, | 18 | NetworkSettings( QWidget *parent=0, |
18 | const char *name=0, | 19 | const char *name=0, |
19 | WFlags fl = 0 ); | 20 | WFlags fl = 0 ); |
20 | ~NetworkSettings( void ); | 21 | virtual ~NetworkSettings( void ); |
21 | 22 | ||
22 | static QString appName( void ) | 23 | static QString appName( void ) |
23 | { return QString::fromLatin1("networksettings"); } | 24 | { return QString::fromLatin1("networksettings"); } |
24 | 25 | ||
25 | bool isModified( void ) | ||
26 | { return NSD.isModified(); } | ||
27 | void setModified( bool m ) | ||
28 | { NSD.setModified( m ); } | ||
29 | |||
30 | public slots : | 26 | public slots : |
31 | 27 | ||
32 | void SLOT_AddNode( void ); | 28 | void SLOT_AddNode( void ); |
33 | void SLOT_DeleteNode( void ); | 29 | void SLOT_DeleteNode( void ); |
34 | void SLOT_ShowNode( QListBoxItem * ); | 30 | void SLOT_ShowNode( QListBoxItem * ); |
35 | void SLOT_EditNode( QListBoxItem * ); | 31 | void SLOT_EditNode( QListBoxItem * ); |
36 | void SLOT_CheckState( void ); | 32 | void SLOT_CheckState( void ); |
37 | void SLOT_Enable( void ); | 33 | |
38 | void SLOT_On( void ); | 34 | void SLOT_Up( void ); |
39 | void SLOT_Connect( void ); | 35 | void SLOT_Down( void ); |
40 | void SLOT_Disconnect( void ); | 36 | void SLOT_Disable( bool ); |
37 | |||
41 | void SLOT_GenerateConfig( void ); | 38 | void SLOT_GenerateConfig( void ); |
42 | void SLOT_RefreshStates( void ); | 39 | void SLOT_RefreshStates( void ); |
43 | void SLOT_QCopMessage( const QCString&,const QByteArray& ); | 40 | void SLOT_QCopMessage( const QCString&,const QByteArray& ); |
44 | void SLOT_ToProfile( void ); | 41 | void SLOT_ToProfile( void ); |
45 | void SLOT_ToMessages( void ); | 42 | void SLOT_ToMessages( void ); |
46 | void SLOT_CmdMessage( const QString & S ); | 43 | void SLOT_CmdMessage( const QString & S ); |
47 | 44 | ||
48 | private : | 45 | private : |
49 | 46 | ||
50 | void updateProfileState( QListBoxItem * it ); | 47 | void updateProfileState( QListBoxItem * it ); |
51 | QTimer * UpdateTimer; | 48 | QTimer * UpdateTimer; |
52 | NetworkSettingsData NSD; | 49 | NetworkSettingsData NSD; |
50 | /* | ||
51 | |||
52 | no leds : not present, unknown, unchecked or disabled | ||
53 | (1) down : hardware present but inactive | ||
54 | (2) available : hardware present and active | ||
55 | (3) up : present active and connected | ||
56 | |||
57 | */ | ||
58 | OLedBox * Leds[3]; | ||
53 | }; | 59 | }; |
diff --git a/noncore/settings/networksettings2/networksettings.pro b/noncore/settings/networksettings2/networksettings.pro index 5d9efbb..d201db1 100644 --- a/noncore/settings/networksettings2/networksettings.pro +++ b/noncore/settings/networksettings2/networksettings.pro | |||
@@ -1,24 +1,24 @@ | |||
1 | # | 1 | # |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | #CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | HEADERS = networksettings.h \ | 4 | HEADERS = networksettings.h \ |
5 | activateprofile.h \ | 5 | activateprofile.h \ |
6 | activatevpn.h \ | 6 | activatevpn.h \ |
7 | editconnection.h | 7 | editconnection.h |
8 | SOURCES = main.cpp \ | 8 | SOURCES = main.cpp \ |
9 | networksettings.cpp \ | 9 | networksettings.cpp \ |
10 | nsdata.cpp \ | 10 | nsdata.cpp \ |
11 | activateprofile.cpp \ | 11 | activateprofile.cpp \ |
12 | activatevpn.cpp \ | 12 | activatevpn.cpp \ |
13 | editconnection.cpp | 13 | editconnection.cpp |
14 | INCLUDEPATH += $(OPIEDIR)/include networksettings2/ | 14 | INCLUDEPATH += $(OPIEDIR)/include networksettings2/ opietooth2/ |
15 | DEPENDPATH += $(OPIEDIR)/include networksettings2/ | 15 | DEPENDPATH += $(OPIEDIR)/include networksettings2/ opietooth2/ |
16 | LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings2 -lnetworksettings2 -lopiecore2 | 16 | LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings2 -lnetworksettings2 -lopietooth2 -lopiecore2 |
17 | INTERFACES = networksettingsGUI.ui \ | 17 | INTERFACES = networksettingsGUI.ui \ |
18 | editconnectionGUI.ui \ | 18 | editconnectionGUI.ui \ |
19 | activatevpnGUI.ui \ | 19 | activatevpnGUI.ui \ |
20 | activateprofileGUI.ui | 20 | activateprofileGUI.ui |
21 | TARGET = $(OPIEDIR)/bin/networksettings2 | 21 | TARGET = $(OPIEDIR)/bin/networksettings2 |
22 | 22 | ||
23 | 23 | ||
24 | include( $(OPIEDIR)/include.pro ) | 24 | 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 | |||
@@ -1,36 +1,45 @@ | |||
1 | #ifndef __GUIUTILS_H | 1 | #ifndef __GUIUTILS_H |
2 | #define __GUIUTILS_H | 2 | #define __GUIUTILS_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | // if TEXT capable widget has changed | 6 | // if TEXT capable widget has changed |
7 | #define TXTM( Data, Wdg, FL ) \ | 7 | #define TXTM( Data, Wdg, FL ) \ |
8 | if( Wdg->text() != Data ) { \ | 8 | if( Wdg->text() != Data ) { \ |
9 | FL = 1; \ | 9 | FL = 1; \ |
10 | Data = Wdg->text(); \ | 10 | Data = Wdg->text(); \ |
11 | } | 11 | } |
12 | 12 | ||
13 | // if IsChecked capable widget has changed | 13 | // if IsChecked capable widget has changed |
14 | #define CBM(Data,Wdg,FL) \ | 14 | #define CBM(Data,Wdg,FL) \ |
15 | if( Wdg->isChecked() != Data) { \ | 15 | if( Wdg->isChecked() != Data) { \ |
16 | FL = 1; \ | 16 | FL = 1; \ |
17 | Data = Wdg->isChecked(); \ | 17 | Data = Wdg->isChecked(); \ |
18 | } | 18 | } |
19 | 19 | ||
20 | // if Value capable widget has changed | 20 | // if Value capable widget has changed |
21 | #define SBM(Data,Wdg,FL) \ | 21 | #define SBM(Data,Wdg,FL) \ |
22 | if( Wdg->value() != Data) { \ | 22 | if( Wdg->value() != Data) { \ |
23 | FL = 1; \ | 23 | FL = 1; \ |
24 | Data = Wdg->value(); \ | 24 | Data = Wdg->value(); \ |
25 | } | 25 | } |
26 | 26 | ||
27 | // if currentItem capable widget has changed | 27 | // if currentItem capable widget has changed |
28 | #define CIM(Data,Wdg,FL) \ | 28 | #define CIM(Data,Wdg,FL) \ |
29 | if( Wdg->currentItem() != Data) { \ | 29 | if( Wdg->currentItem() != Data) { \ |
30 | FL = 1; \ | 30 | FL = 1; \ |
31 | Data = Wdg->currentItem(); \ | 31 | Data = Wdg->currentItem(); \ |
32 | } | 32 | } |
33 | 33 | ||
34 | #define STXT(a, b) \ | ||
35 | b->setText( a ); | ||
36 | |||
37 | #define SCB(a, b) \ | ||
38 | b->setChecked( a ); | ||
39 | |||
40 | #define SSB( Data,Wdg) \ | ||
41 | Wdg->setValue( Data ) | ||
42 | |||
34 | extern bool validIP( const QString & S ); | 43 | extern bool validIP( const QString & S ); |
35 | 44 | ||
36 | #endif | 45 | #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 @@ | |||
1 | #ifndef __UTILS_H | 1 | #ifndef __UTILS_H |
2 | #define __UTILS_H | 2 | #define __UTILS_H |
3 | 3 | ||
4 | #include <opie2/odebug.h> | ||
5 | |||
4 | #define Log(x) VLog x | 6 | #define Log(x) VLog x |
5 | extern void VLog( char * Format, ... ); | 7 | extern void VLog( char * Format, ... ); |
6 | extern void LogClose( void ); | 8 | extern void LogClose( void ); |
7 | extern QString removeSpaces( const QString & X ); | 9 | extern QString removeSpaces( const QString & X ); |
8 | 10 | ||
9 | #endif | 11 | #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,337 +1,511 @@ | |||
1 | #include <time.h> | 1 | #include <time.h> |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | 4 | ||
5 | |||
6 | #include <qpainter.h> | 5 | #include <qpainter.h> |
7 | #include <qbitmap.h> | 6 | #include <qbitmap.h> |
8 | #include <qtextstream.h> | 7 | #include <qtextstream.h> |
9 | #include <qpixmap.h> | 8 | #include <qpixmap.h> |
10 | 9 | ||
11 | #include "resources.h" | 10 | #include "resources.h" |
12 | #include "netnode.h" | 11 | #include "netnode.h" |
13 | 12 | ||
14 | #include "asdevice.h" | 13 | static char * ActionName[] = { |
15 | #include "asline.h" | 14 | "Disable", |
16 | #include "asconnection.h" | 15 | "Enable", |
17 | #include "asfullsetup.h" | 16 | "Activate", |
17 | "Deactivate", | ||
18 | "Up", | ||
19 | "Down" | ||
20 | }; | ||
21 | |||
22 | static char * StateName[] = { | ||
23 | "Unchecked", | ||
24 | "Unknown", | ||
25 | "Unavailable", | ||
26 | "Disabled", | ||
27 | "Off", | ||
28 | "Available", | ||
29 | "IsUp" | ||
30 | }; | ||
18 | 31 | ||
19 | QString & deQuote( QString & X ) { | 32 | QString & deQuote( QString & X ) { |
20 | if( X[0] == '"' ) { | 33 | if( X[0] == '"' ) { |
21 | // remove end and trailing "" and \x -> x | 34 | // remove end and trailing "" and \x -> x |
22 | QChar R; | 35 | QChar R; |
23 | long idx; | 36 | long idx; |
24 | idx = X.length()-1; | 37 | idx = X.length()-1; |
25 | X = X.mid( 1, idx ); | 38 | X = X.mid( 1, idx ); |
26 | 39 | ||
27 | idx = 0; | 40 | idx = 0; |
28 | while( ( idx = X.find( '\\', idx ) ) >= 0 ) { | 41 | while( ( idx = X.find( '\\', idx ) ) >= 0 ) { |
29 | R = X.at( idx + 1 ); | 42 | R = X.at( idx + 1 ); |
30 | X.replace( idx, 2, &R, 1 ); | 43 | X.replace( idx, 2, &R, 1 ); |
31 | } | 44 | } |
32 | X = X.left( X.length()-1 ); | 45 | X = X.left( X.length()-1 ); |
33 | } | 46 | } |
34 | return X; | 47 | return X; |
35 | } | 48 | } |
36 | 49 | ||
37 | QString quote( QString X ) { | 50 | QString quote( QString X ) { |
38 | if( X.find( QRegExp( "[ \n\"\\\t]" ) ) >= 0 ) { | 51 | if( X.find( QRegExp( "[ \n\"\\\t]" ) ) >= 0 ) { |
39 | // need to quote this | 52 | // need to quote this |
40 | QString OutString = "\""; | 53 | QString OutString = "\""; |
41 | 54 | ||
42 | X.replace( QRegExp("\""), "\\\"" ); | 55 | X.replace( QRegExp("\""), "\\\"" ); |
43 | X.replace( QRegExp("\\"), "\\\\" ); | 56 | X.replace( QRegExp("\\"), "\\\\" ); |
44 | X.replace( QRegExp(" "), "\\ " ); | 57 | X.replace( QRegExp(" "), "\\ " ); |
45 | 58 | ||
46 | OutString += X; | 59 | OutString += X; |
47 | OutString += "\""; | 60 | OutString += "\""; |
48 | X = OutString; | 61 | X = OutString; |
49 | } | 62 | } |
50 | return X; | 63 | return X; |
51 | } | 64 | } |
52 | 65 | ||
53 | 66 | ||
54 | // | 67 | // |
55 | // | 68 | // |
56 | // ANETNODE | 69 | // ANETNODE |
57 | // | 70 | // |
58 | // | 71 | // |
59 | 72 | ||
60 | void ANetNode::saveAttributes( QTextStream & TS ) { | 73 | void ANetNode::saveAttributes( QTextStream & TS ) { |
61 | saveSpecificAttribute( TS ); | 74 | saveSpecificAttribute( TS ); |
62 | } | 75 | } |
63 | 76 | ||
64 | void ANetNode::setAttribute( QString & Attr, QString & Value ){ | 77 | void ANetNode::setAttribute( QString & Attr, QString & Value ){ |
65 | setSpecificAttribute( Attr, Value ); | 78 | setSpecificAttribute( Attr, Value ); |
66 | } | 79 | } |
67 | 80 | ||
81 | bool ANetNode::isToplevel( void ) { | ||
82 | const char ** P = provides(); | ||
83 | while( *P ) { | ||
84 | if( strcmp( *P, "fullsetup") == 0 ) | ||
85 | return 1; | ||
86 | P ++; | ||
87 | } | ||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | bool ANetNode::openFile( SystemFile & SF, | ||
92 | ANetNodeInstance * NNI ) { | ||
93 | return (NNI ) ? NNI->openFile( SF ) : 0 ; | ||
94 | } | ||
95 | |||
68 | // | 96 | // |
69 | // | 97 | // |
70 | // ANETNODEINSTANCE | 98 | // ANETNODEINSTANCE |
71 | // | 99 | // |
72 | // | 100 | // |
73 | 101 | ||
74 | long ANetNodeInstance::InstanceCounter = -1; | 102 | long ANetNodeInstance::InstanceCounter = -1; |
75 | 103 | ||
76 | void ANetNodeInstance::initialize( void ) { | 104 | void ANetNodeInstance::initialize( void ) { |
77 | if( InstanceCounter == -1 ) | 105 | if( InstanceCounter == -1 ) |
78 | InstanceCounter = time(0); | 106 | InstanceCounter = time(0); |
79 | // set name | 107 | // set name |
80 | QString N; | 108 | QString N; |
81 | N.sprintf( "-%ld", InstanceCounter++ ); | 109 | N.sprintf( "-%ld", InstanceCounter++ ); |
82 | N.prepend( NodeType->name() ); | 110 | N.prepend( NodeType->name() ); |
83 | setName( N.latin1() ); | 111 | setName( N.latin1() ); |
84 | } | 112 | } |
85 | 113 | ||
86 | void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ | 114 | void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ |
87 | if( Attr == "name" ) { | 115 | if( Attr == "__name" ) { |
88 | setName( Value.latin1() ); | 116 | setName( Value.latin1() ); |
89 | } else { | 117 | } else { |
90 | setSpecificAttribute( Attr, Value ); | 118 | setSpecificAttribute( Attr, Value ); |
91 | } | 119 | } |
92 | } | 120 | } |
93 | 121 | ||
94 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { | 122 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { |
95 | TS << "name=" << name() << endl; | 123 | TS << "__name=" << name() << endl; |
96 | saveSpecificAttribute( TS ); | 124 | saveSpecificAttribute( TS ); |
97 | } | 125 | } |
98 | 126 | ||
99 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { | 127 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { |
100 | return connection()->findNext( this ); | 128 | return connection()->findNext( this ); |
101 | } | 129 | } |
102 | 130 | ||
103 | // | 131 | // |
104 | // | 132 | // |
105 | // NODECOLLECTION | 133 | // NODECOLLECTION |
106 | // | 134 | // |
107 | // | 135 | // |
108 | 136 | ||
109 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { | 137 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { |
110 | IsModified = 0; | 138 | IsModified = 0; |
111 | Index = -1; | 139 | Index = -1; |
112 | Name=""; | 140 | Name=""; |
113 | IsNew = 1; | 141 | IsNew = 1; |
114 | CurrentState = Unchecked; | 142 | CurrentState = Unchecked; |
143 | AssignedInterface = 0; | ||
115 | } | 144 | } |
116 | 145 | ||
117 | NodeCollection::NodeCollection( QTextStream & TS ) : | 146 | NodeCollection::NodeCollection( QTextStream & TS ) : |
118 | QList<ANetNodeInstance>() { | 147 | QList<ANetNodeInstance>() { |
119 | long idx; | 148 | long idx; |
120 | bool InError = 0; | 149 | bool InError = 0; |
121 | QString S, A, N; | 150 | QString S, A, N; |
122 | IsModified = 0; | 151 | IsModified = 0; |
123 | Index = -1; | 152 | Index = -1; |
124 | Name=""; | 153 | Name=""; |
125 | IsNew = 0; | 154 | IsNew = 0; |
155 | AssignedInterface = 0; | ||
126 | CurrentState = Unchecked; | 156 | CurrentState = Unchecked; |
127 | 157 | ||
128 | do { | 158 | do { |
129 | S = TS.readLine(); | 159 | S = TS.readLine(); |
130 | if( S.isEmpty() ) { | 160 | if( S.isEmpty() ) { |
131 | if( InError ) { | 161 | if( InError ) { |
132 | // remove all nodes | 162 | // remove all nodes |
133 | clear(); | 163 | clear(); |
134 | } | 164 | } |
135 | // empty line | 165 | // empty line |
136 | break; | 166 | break; |
137 | } | 167 | } |
138 | 168 | ||
139 | idx = S.find('='); | 169 | idx = S.find('='); |
140 | S.stripWhiteSpace(); | 170 | S.stripWhiteSpace(); |
141 | A = S.left( idx ); | 171 | A = S.left( idx ); |
142 | A.lower(); | 172 | A.lower(); |
143 | N = S.mid( idx+1, S.length() ); | 173 | N = S.mid( idx+1, S.length() ); |
144 | N.stripWhiteSpace(); | 174 | N.stripWhiteSpace(); |
145 | N = deQuote( N ); | 175 | N = deQuote( N ); |
146 | 176 | ||
147 | if( A == "name" ) { | 177 | if( A == "name" ) { |
148 | Name = N; | 178 | Name = N; |
149 | } else if( A == "number" ) { | 179 | } else if( A == "number" ) { |
150 | Log(( "Profile number %s\n", N.latin1() )); | ||
151 | setNumber( N.toLong() ); | 180 | setNumber( N.toLong() ); |
152 | } else if( A == "node" ) { | 181 | } else if( A == "node" ) { |
153 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); | 182 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); |
154 | if( NNI && ! InError ) { | 183 | if( NNI && ! InError ) { |
155 | append( NSResources->findNodeInstance( N ) ); | 184 | append( NSResources->findNodeInstance( N ) ); |
156 | } else { | 185 | } else { |
157 | // could not find a node type -> collection invalid | 186 | // could not find a node type -> collection invalid |
158 | InError = 1; | 187 | InError = 1; |
159 | } | 188 | } |
160 | } | 189 | } |
161 | } while( 1 ); | 190 | } while( 1 ); |
191 | |||
192 | Log(( "Profile number %s : %d nodes\n", | ||
193 | N.latin1(), count() )); | ||
162 | } | 194 | } |
163 | 195 | ||
164 | 196 | ||
165 | NodeCollection::~NodeCollection( void ) { | 197 | NodeCollection::~NodeCollection( void ) { |
166 | } | 198 | } |
167 | 199 | ||
168 | const QString & NodeCollection::description( void ) { | 200 | const QString & NodeCollection::description( void ) { |
169 | ANetNodeInstance * NNI = getToplevel(); | 201 | ANetNodeInstance * NNI = getToplevel(); |
170 | return (NNI) ? NNI->runtime()->asFullSetup()->description() : Name; | 202 | return (NNI) ? NNI->runtime()->description() : Name; |
171 | } | 203 | } |
172 | 204 | ||
173 | void NodeCollection::append( ANetNodeInstance * NNI ) { | 205 | void NodeCollection::append( ANetNodeInstance * NNI ) { |
174 | NNI->setConnection( this ); | 206 | NNI->setConnection( this ); |
175 | QList<ANetNodeInstance>::append( NNI ); | 207 | QList<ANetNodeInstance>::append( NNI ); |
176 | } | 208 | } |
177 | 209 | ||
178 | void NodeCollection::save( QTextStream & TS ) { | 210 | void NodeCollection::save( QTextStream & TS ) { |
179 | 211 | ||
180 | TS << "name=" << quote( Name ) << endl; | 212 | TS << "name=" << quote( Name ) << endl; |
181 | TS << "number=" << number() << endl; | 213 | TS << "number=" << number() << endl; |
182 | ANetNodeInstance * NNI; | 214 | ANetNodeInstance * NNI; |
183 | for( QListIterator<ANetNodeInstance> it(*this); | 215 | for( QListIterator<ANetNodeInstance> it(*this); |
184 | it.current(); | 216 | it.current(); |
185 | ++it ) { | 217 | ++it ) { |
186 | NNI = it.current(); | 218 | NNI = it.current(); |
187 | TS << "node=" << NNI->name() << endl; | 219 | TS << "node=" << NNI->name() << endl; |
188 | } | 220 | } |
189 | TS << endl; | 221 | TS << endl; |
190 | IsNew = 0; | 222 | IsNew = 0; |
191 | } | 223 | } |
192 | 224 | ||
193 | ANetNodeInstance * NodeCollection::getToplevel( void ) { | 225 | ANetNodeInstance * NodeCollection::getToplevel( void ) { |
194 | ANetNodeInstance * NNI = 0; | 226 | ANetNodeInstance * NNI = 0; |
195 | for( QListIterator<ANetNodeInstance> it(*this); | 227 | for( QListIterator<ANetNodeInstance> it(*this); |
196 | it.current(); | 228 | it.current(); |
197 | ++it ) { | 229 | ++it ) { |
198 | NNI = it.current(); | 230 | NNI = it.current(); |
199 | if( NNI->nodeClass()->isToplevel() ) | 231 | if( NNI->nodeClass()->isToplevel() ) |
200 | break; | 232 | break; |
201 | } | 233 | } |
202 | return NNI; | 234 | return NNI; |
203 | } | 235 | } |
204 | 236 | ||
205 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { | 237 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { |
206 | ANetNodeInstance * NNI = 0; | 238 | ANetNodeInstance * NNI = 0; |
207 | for( QListIterator<ANetNodeInstance> it(*this); | 239 | for( QListIterator<ANetNodeInstance> it(*this); |
208 | it.current(); | 240 | it.current(); |
209 | ++it ) { | 241 | ++it ) { |
210 | NNI = it.current(); | 242 | NNI = it.current(); |
211 | if( NNI->name() == S ) | 243 | if( NNI->name() == S ) |
212 | break; | 244 | break; |
213 | } | 245 | } |
214 | return NNI; | 246 | return NNI; |
215 | } | 247 | } |
216 | 248 | ||
217 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { | 249 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { |
218 | ANetNodeInstance * NNNI; | 250 | ANetNodeInstance * NNNI; |
219 | 251 | ||
220 | if( ! NNI ) | 252 | if( ! NNI ) |
221 | getToplevel(); | 253 | getToplevel(); |
222 | 254 | ||
223 | for( QListIterator<ANetNodeInstance> it(*this); | 255 | for( QListIterator<ANetNodeInstance> it(*this); |
224 | it.current(); | 256 | it.current(); |
225 | ++it ) { | 257 | ++it ) { |
226 | NNNI = it.current(); | 258 | NNNI = it.current(); |
227 | if( NNNI == NNI ) { | 259 | if( NNNI == NNI ) { |
228 | ++it; | 260 | ++it; |
229 | return it.current(); | 261 | return it.current(); |
230 | } | 262 | } |
231 | } | 263 | } |
232 | return 0; // no more next | 264 | return 0; // no more next |
233 | } | 265 | } |
234 | 266 | ||
235 | int NodeCollection::compareItems( QCollection::Item I1, | 267 | int NodeCollection::compareItems( QCollection::Item I1, |
236 | QCollection::Item I2 ) { | 268 | QCollection::Item I2 ) { |
237 | ANetNodeInstance * NNI1, * NNI2; | 269 | ANetNodeInstance * NNI1, * NNI2; |
238 | NNI1 = (ANetNodeInstance *)I1; | 270 | NNI1 = (ANetNodeInstance *)I1; |
239 | NNI2 = (ANetNodeInstance *)I2; | 271 | NNI2 = (ANetNodeInstance *)I2; |
240 | return strcmp( NNI1->name(), NNI2->name() ); | 272 | return strcmp( NNI1->name(), NNI2->name() ); |
241 | } | 273 | } |
242 | 274 | ||
243 | static char * State2PixmapTbl[] = { | 275 | static char * State2PixmapTbl[] = { |
244 | "NULL", // Unchecked : no pixmap | 276 | "NULL", // Unchecked : no pixmap |
245 | "check", // Unknown | 277 | "check", // Unknown |
246 | "delete", // unavailable | 278 | "delete", // unavailable |
247 | "disabled", // disabled | 279 | "disabled", // disabled |
248 | "off", // off | 280 | "off", // off |
249 | "disconnected", // available | 281 | "disconnected", // available |
250 | "connected" // up | 282 | "connected" // up |
251 | }; | 283 | }; |
252 | 284 | ||
253 | QPixmap NodeCollection::devicePixmap( void ) { | 285 | QPixmap NodeCollection::devicePixmap( void ) { |
254 | QPixmap pm = NSResources->getPixmap( | 286 | QPixmap pm = NSResources->getPixmap( |
255 | getToplevel()->nextNode()->pixmapName()+"-large"); | 287 | getToplevel()->nextNode()->pixmapName()+"-large"); |
256 | 288 | ||
257 | QPixmap Mini = NSResources->getPixmap( device()->netNode()->pixmapName() ); | 289 | QPixmap Mini = NSResources->getPixmap( |
290 | device()->netNode()->pixmapName() ); | ||
258 | 291 | ||
259 | if( pm.isNull() || Mini.isNull() ) | 292 | if( pm.isNull() || Mini.isNull() ) |
260 | return Resource::loadPixmap("Unknown"); | 293 | return Resource::loadPixmap("Unknown"); |
261 | 294 | ||
262 | QPainter painter( &pm ); | 295 | QPainter painter( &pm ); |
263 | painter.drawPixmap( pm.width()-Mini.width(), | 296 | painter.drawPixmap( pm.width()-Mini.width(), |
264 | pm.height()-Mini.height(), | 297 | pm.height()-Mini.height(), |
265 | Mini ); | 298 | Mini ); |
266 | pm.setMask( pm.createHeuristicMask( TRUE ) ); | 299 | pm.setMask( pm.createHeuristicMask( TRUE ) ); |
267 | return pm; | 300 | return pm; |
268 | } | 301 | } |
269 | 302 | ||
270 | QPixmap NodeCollection::statePixmap( State_t S) { | 303 | QPixmap NodeCollection::statePixmap( State_t S) { |
271 | return NSResources->getPixmap( State2PixmapTbl[S] ); | 304 | return NSResources->getPixmap( State2PixmapTbl[S] ); |
272 | } | 305 | } |
273 | 306 | ||
274 | QString NodeCollection::stateName( State_t S) { | 307 | QString NodeCollection::stateName( State_t S) { |
275 | switch( S ) { | 308 | switch( S ) { |
276 | case Unknown : | 309 | case Unknown : |
277 | return qApp->translate( "networksettings2", "Unknown"); | 310 | return qApp->translate( "networksettings2", "Unknown"); |
278 | case Unavailable : | 311 | case Unavailable : |
279 | return qApp->translate( "networksettings2", "Unavailable"); | 312 | return qApp->translate( "networksettings2", "Unavailable"); |
280 | case Disabled : | 313 | case Disabled : |
281 | return qApp->translate( "networksettings2", "Disabled"); | 314 | return qApp->translate( "networksettings2", "Disabled"); |
282 | case Off : | 315 | case Off : |
283 | return qApp->translate( "networksettings2", "Off"); | 316 | return qApp->translate( "networksettings2", "Inactive"); |
284 | case Available : | 317 | case Available : |
285 | return qApp->translate( "networksettings2", "Available"); | 318 | return qApp->translate( "networksettings2", "Available"); |
286 | case IsUp : | 319 | case IsUp : |
287 | return qApp->translate( "networksettings2", "IsUp"); | 320 | return qApp->translate( "networksettings2", "Up"); |
288 | case Unchecked : /* FT */ | 321 | case Unchecked : /* FT */ |
289 | default : | 322 | default : |
290 | break; | 323 | break; |
291 | } | 324 | } |
292 | return QString(""); | 325 | return QString(""); |
293 | } | 326 | } |
294 | 327 | ||
295 | void NodeCollection::reassign( void ) { | 328 | void NodeCollection::reassign( void ) { |
296 | for( QListIterator<ANetNodeInstance> it(*this); | 329 | for( QListIterator<ANetNodeInstance> it(*this); |
297 | it.current(); | 330 | it.current(); |
298 | ++it ) { | 331 | ++it ) { |
299 | it.current()->setConnection( this ); | 332 | it.current()->setConnection( this ); |
300 | } | 333 | } |
301 | } | 334 | } |
302 | 335 | ||
303 | bool NodeCollection::triggersVPN() { | 336 | const QStringList & NodeCollection::triggers() { |
304 | return getToplevel()->runtime()->asFullSetup()->triggersVPN(); | 337 | return getToplevel()->runtime()->triggers(); |
305 | } | 338 | } |
306 | 339 | ||
307 | bool NodeCollection::hasDataForFile( const QString & S ) { | 340 | bool NodeCollection::hasDataForFile( SystemFile & S ) { |
308 | return ( firstWithDataForFile( S ) != 0 ); | 341 | return ( firstWithDataForFile( S ) != 0 ); |
309 | } | 342 | } |
310 | 343 | ||
311 | ANetNodeInstance * NodeCollection::firstWithDataForFile( const QString & S ) { | 344 | ANetNodeInstance * NodeCollection::firstWithDataForFile( SystemFile & S ) { |
312 | for( QListIterator<ANetNodeInstance> it(*this); | 345 | for( QListIterator<ANetNodeInstance> it(*this); |
313 | it.current(); | 346 | it.current(); |
314 | ++it ) { | 347 | ++it ) { |
315 | if( it.current()->hasDataForFile( S ) ) { | 348 | if( it.current()->hasDataForFile( S ) ) { |
316 | Log(( "Node %s has data for %s\n", | ||
317 | it.current()->nodeClass()->name(), | ||
318 | S.latin1() )); | ||
319 | return it.current(); | 349 | return it.current(); |
320 | } | 350 | } |
321 | } | 351 | } |
322 | return 0; | 352 | return 0; |
323 | } | 353 | } |
324 | 354 | ||
355 | State_t NodeCollection::state( bool Update ) { | ||
356 | State_t NodeState; | ||
357 | |||
358 | if( CurrentState == Unchecked || Update ) { | ||
359 | // collect states of all nodes until with get the 'higest' | ||
360 | // state possible | ||
361 | |||
362 | Log(( "Connection %s state %s\n", | ||
363 | Name.latin1(), StateName[CurrentState] )); | ||
364 | |||
365 | CurrentState = Unknown; | ||
366 | for( QListIterator<ANetNodeInstance> it(*this); | ||
367 | it.current(); | ||
368 | ++it ) { | ||
369 | Log(( "-> Detect %s\n", it.current()->name() )); | ||
370 | NodeState = it.current()->runtime()->detectState(); | ||
371 | Log(( " state %s\n", StateName[NodeState] )); | ||
372 | |||
373 | if( NodeState == Disabled || | ||
374 | NodeState == IsUp ) { | ||
375 | // max | ||
376 | CurrentState = NodeState; | ||
377 | break; | ||
378 | } | ||
379 | |||
380 | if( NodeState > CurrentState ) { | ||
381 | // higher | ||
382 | CurrentState = NodeState; | ||
383 | } | ||
384 | } | ||
385 | } | ||
386 | |||
387 | return CurrentState; | ||
388 | } | ||
389 | |||
390 | QString NodeCollection::setState( Action_t A, bool Force ) { | ||
391 | |||
392 | QString msg; | ||
393 | Action_t Actions[10]; | ||
394 | int NoOfActions = 0; | ||
395 | |||
396 | // get current state | ||
397 | state( Force ); | ||
398 | |||
399 | switch( A ) { | ||
400 | case Disable : | ||
401 | if( CurrentState < Disabled ) { | ||
402 | // disabled | ||
403 | CurrentState = Disabled; | ||
404 | return QString(); | ||
405 | } | ||
406 | |||
407 | if( CurrentState == IsUp ) { | ||
408 | Actions[NoOfActions++] = Down; | ||
409 | Actions[NoOfActions++] = Deactivate; | ||
410 | } else if( CurrentState == Available ) { | ||
411 | Actions[NoOfActions++] = Deactivate; | ||
412 | } | ||
413 | Actions[NoOfActions++] = Disable; | ||
414 | break; | ||
415 | case Enable : | ||
416 | // always possible -> detected state is new state | ||
417 | Actions[NoOfActions++] = Enable; | ||
418 | break; | ||
419 | case Activate : | ||
420 | if( ! Force ) { | ||
421 | if( CurrentState >= Available ) { | ||
422 | // already available | ||
423 | return QString(); | ||
424 | } | ||
425 | |||
426 | if( CurrentState != Off ) { | ||
427 | return qApp->translate( "System", | ||
428 | "State should be off" ); | ||
429 | } | ||
430 | } | ||
431 | |||
432 | Actions[NoOfActions++] = Activate; | ||
433 | break; | ||
434 | case Deactivate : | ||
435 | if( ! Force ) { | ||
436 | if( CurrentState < Off ) { | ||
437 | // already inactive | ||
438 | return QString(); | ||
439 | } | ||
440 | } | ||
441 | |||
442 | if( CurrentState == IsUp ) { | ||
443 | Actions[NoOfActions++] = Down; | ||
444 | } | ||
445 | Actions[NoOfActions++] = Deactivate; | ||
446 | break; | ||
447 | case Up : | ||
448 | if( ! Force ) { | ||
449 | if( CurrentState == IsUp ) { | ||
450 | return QString(); | ||
451 | } | ||
452 | if( CurrentState < Off ) { | ||
453 | return qApp->translate( "System", | ||
454 | "State should at least be off" ); | ||
455 | } | ||
456 | } | ||
457 | if( CurrentState == Off ) { | ||
458 | Actions[NoOfActions++] = Activate; | ||
459 | } | ||
460 | Actions[NoOfActions++] = Up; | ||
461 | break; | ||
462 | case Down : | ||
463 | if( ! Force ) { | ||
464 | if( CurrentState < Available ) { | ||
465 | // OK | ||
466 | return QString(); | ||
467 | } | ||
468 | } | ||
469 | Actions[NoOfActions++] = Down; | ||
470 | break; | ||
471 | } | ||
472 | |||
473 | // send actions to all nodes | ||
474 | Log(( "Action %s requires %d steps\n", | ||
475 | ActionName[A], NoOfActions )); | ||
476 | |||
477 | for( int i = 0 ; i < NoOfActions; i ++ ) { | ||
478 | // setState recurses through the tree depth first | ||
479 | msg = getToplevel()->runtime()->setState( this, Actions[i], Force ); | ||
480 | if( ! msg.isEmpty() ) { | ||
481 | return msg; | ||
482 | } | ||
483 | } | ||
484 | return QString(); | ||
485 | } | ||
486 | |||
325 | // | 487 | // |
326 | // | 488 | // |
327 | // RUNTIMEINFO | 489 | // RuntimeInfo |
328 | // | 490 | // |
329 | // | 491 | // |
330 | 492 | ||
331 | InterfaceInfo * RuntimeInfo::assignedInterface( void ) { | 493 | QString RuntimeInfo::setState( NodeCollection * NC, |
332 | return netNode()->nextNode()->runtime()->assignedInterface(); | 494 | Action_t A, |
333 | } | 495 | bool Force ) { |
496 | QString M; | ||
497 | RuntimeInfo * Deeper = nextNode(); | ||
498 | |||
499 | if( Deeper ) { | ||
500 | // first go deeper | ||
501 | M = Deeper->setState( NC, A, Force ); | ||
502 | if( ! M.isEmpty() ) | ||
503 | return M; | ||
504 | } | ||
334 | 505 | ||
335 | AsDevice * RuntimeInfo::device( void ) { | 506 | // set my own state |
336 | return netNode()->nextNode()->runtime()->device(); | 507 | Log (( "-> Act upon %s\n", netNode()->name() )); |
508 | M = setMyState( NC, A, Force ); | ||
509 | Log (( " result %s\n", M.latin1() )); | ||
510 | return M; | ||
337 | } | 511 | } |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h index d3d7b34..4626381 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.h +++ b/noncore/settings/networksettings2/networksettings2/netnode.h | |||
@@ -1,494 +1,596 @@ | |||
1 | #ifndef NETNODE_H | 1 | #ifndef NETNODE_H |
2 | #define NETNODE_H | 2 | #define NETNODE_H |
3 | 3 | ||
4 | #include <qtextstream.h> | 4 | #include <qtextstream.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
8 | #include <qstringlist.h> | 8 | #include <qstringlist.h> |
9 | #include <qobject.h> | 9 | #include <qobject.h> |
10 | #include <time.h> | 10 | #include <time.h> |
11 | 11 | ||
12 | #include <Utils.h> | 12 | #include <Utils.h> |
13 | #include <system.h> | ||
13 | 14 | ||
14 | // difference feature interfaces | 15 | // difference feature interfaces |
15 | class AsDevice; | 16 | class AsDevice; |
16 | class AsLine; | 17 | class AsLine; |
17 | class AsConnection; | 18 | class AsConnection; |
18 | class AsFullSetup; | 19 | class AsFullSetup; |
19 | 20 | ||
20 | // needed for plugin creation function | 21 | // needed for plugin creation function |
21 | #include <qlist.h> | 22 | #include <qlist.h> |
22 | 23 | ||
23 | class ANetNode; | 24 | class ANetNode; |
24 | class ANetNodeInstance; | 25 | class ANetNodeInstance; |
25 | class NodeCollection; | 26 | class NodeCollection; |
26 | class QTextStream; | 27 | class QTextStream; |
27 | class RuntimeInfo; | 28 | class RuntimeInfo; |
28 | class InterfaceInfo; | 29 | class InterfaceInfo; |
30 | class NSResources; | ||
29 | 31 | ||
30 | extern QString & deQuote( QString & X ); | 32 | extern QString & deQuote( QString & X ); |
31 | extern QString quote( QString X ); | 33 | extern QString quote( QString X ); |
32 | 34 | ||
33 | #include "systemfile.h" | 35 | #include "systemfile.h" |
34 | 36 | ||
35 | typedef enum State { | 37 | typedef enum State { |
36 | // if we have not yet detected the state of the device | 38 | // if we have not yet detected the state of the device |
37 | Unchecked = 0, | 39 | Unchecked = 0, |
38 | // if we cannot determine the state | 40 | // if we cannot determine the state |
39 | Unknown = 1, | 41 | Unknown = 1, |
40 | // if connection cannot be established e.g. because | 42 | // if connection cannot be established e.g. because |
41 | // the hardware is not available | 43 | // the hardware is not available |
42 | Unavailable = 2, | 44 | Unavailable = 2, |
43 | // if the connection cannot be establishec but NOT | 45 | // if the connection cannot be establishec but NOT |
44 | // because it is physically impossible but because | 46 | // because it is physically impossible but because |
45 | // it has been disabled for FUNCTIONAL reasons | 47 | // it has been disabled for FUNCTIONAL reasons |
46 | Disabled = 3, | 48 | Disabled = 3, |
47 | // if connection is available to is currently down | 49 | // if connection is available to is currently down |
48 | // i.e. the corresponding hardware is not activated | 50 | // i.e. the corresponding hardware is not activated |
49 | Off = 4, | 51 | Off = 4, |
50 | // if connection is available to be used (i.e. the | 52 | // if connection is available to be used (i.e. the |
51 | // devices if fully ready to be used | 53 | // devices if fully ready to be used |
52 | Available = 5, | 54 | Available = 5, |
53 | // if connection is being used | 55 | // if connection is being used |
54 | IsUp = 6 | 56 | IsUp = 6 |
55 | } State_t; | 57 | } State_t; |
56 | 58 | ||
57 | typedef enum Action { | 59 | typedef enum Action { |
58 | // to make the device unavailable functionally | 60 | // to make the device unavailable functionally -> to disabled |
59 | Disable = 0, | 61 | Disable = 0, |
60 | // to make the device available functionally | 62 | // to make the device available functionally -> to off |
61 | Enable = 1, | 63 | Enable = 1, |
62 | // bring the hardware up | 64 | // bring the hardware up -> to Available |
63 | Activate = 2, | 65 | Activate = 2, |
64 | // bring the hardware down | 66 | // bring the hardware down -> to off |
65 | Deactivate = 3, | 67 | Deactivate = 3, |
66 | // bring the connection up | 68 | // bring the connection up -> to IsUp |
67 | Up = 4, | 69 | Up = 4, |
68 | // bring the connection down | 70 | // bring the connection down -> to Available |
69 | Down = 5 | 71 | Down = 5 |
70 | } Action_t; | 72 | } Action_t; |
71 | 73 | ||
72 | class ANetNode : public QObject{ | 74 | class ANetNode : public QObject { |
73 | 75 | ||
74 | public: | 76 | public: |
75 | 77 | ||
76 | typedef QArray<ANetNode *> NetNodeList; | 78 | typedef QArray<ANetNode *> NetNodeList; |
77 | 79 | ||
78 | ANetNode( const char * Name ) : QObject( 0, Name ) {} | 80 | ANetNode( const char * Name ) : QObject( 0, Name ) {} |
79 | virtual ~ANetNode(){}; | 81 | virtual ~ANetNode(){}; |
80 | 82 | ||
81 | // | 83 | // |
82 | // | 84 | // |
83 | // standard methods with sensible default | 85 | // standard methods with sensible default |
84 | // | 86 | // |
85 | // | 87 | // |
86 | 88 | ||
87 | inline int done( void ) | 89 | inline int done( void ) |
88 | { return Done; } | 90 | { return Done; } |
89 | inline void setDone( int D ) | 91 | inline void setDone( int D ) |
90 | { Done = D; } | 92 | { Done = D; } |
91 | 93 | ||
92 | // does this Node provide a Connection | 94 | // does this Node provide a Connection |
93 | inline bool isToplevel( void ) | 95 | bool isToplevel( void ); |
94 | { return strcmp( provides(), "fullsetup") == 0 ; } | ||
95 | 96 | ||
96 | // set the value of an attribute | 97 | // set the value of an attribute |
97 | void setAttribute( QString & Attr, QString & Value ) ; | 98 | void setAttribute( QString & Attr, QString & Value ) ; |
98 | void saveAttributes( QTextStream & TS ) ; | 99 | void saveAttributes( QTextStream & TS ) ; |
99 | 100 | ||
100 | // compiled references to 'needed' NetNodes -> needs list | 101 | // compiled references to 'needed' NetNodes -> needs list |
101 | inline void setAlternatives( NetNodeList * Alt ) | 102 | inline void setAlternatives( NetNodeList * Alt ) |
102 | { Alternatives = Alt; } | 103 | { Alternatives = Alt; } |
103 | inline NetNodeList & alternatives( void ) | 104 | inline NetNodeList & alternatives( void ) |
104 | { return *Alternatives; } | 105 | { return *Alternatives; } |
105 | 106 | ||
106 | // | 107 | // |
107 | // | 108 | // |
108 | // Virtual methods with sensible default | 109 | // Virtual methods with sensible default |
109 | // | 110 | // |
110 | // | 111 | // |
111 | 112 | ||
112 | // do instances of this noce class have data for this file | 113 | // do instances of this noce class have data for this file |
113 | virtual bool hasDataForFile( const QString & ) | 114 | virtual bool hasDataForFile( SystemFile & ) |
114 | { return 0; } | 115 | { return 0; } |
115 | 116 | ||
117 | // open proper file SF identified by S | ||
118 | // this method is called by NS2. | ||
119 | // | ||
120 | // overrule this ONLY if this proper file is a common file | ||
121 | // for all NNI of this node class and the data generated | ||
122 | // by each of the NNI needs to be put in one file | ||
123 | // | ||
124 | // if this is the case the file should be (re)opened in append | ||
125 | // return 0 if file cannot be opened | ||
126 | virtual bool openFile( SystemFile &SF, | ||
127 | ANetNodeInstance * NNI ); | ||
128 | |||
116 | // generate instance independent stuff | 129 | // generate instance independent stuff |
117 | // 0 : data output, 1 no data, 2 error | 130 | // 0 : data output, 1 no data, 2 error |
118 | virtual short generateFile( const QString & , | 131 | virtual short generatePreamble( SystemFile & ) |
119 | const QString & , | 132 | { return 1; } |
120 | QTextStream & , | 133 | |
121 | long ) | 134 | // generate instance independent stuff |
135 | // 0 : data output, 1 no data, 2 error | ||
136 | virtual short generatePostamble( SystemFile & ) | ||
122 | { return 1; } | 137 | { return 1; } |
123 | 138 | ||
124 | // generate instance dependent but profile common stuff | 139 | // generate instance dependent but instance common stuff |
125 | // 0 : data output, 1 no data, 2 error | 140 | // 0 : data output, 1 no data, 2 error |
126 | virtual short generateFile( const QString & , | 141 | virtual short generateFile( SystemFile &, |
127 | const QString & , | ||
128 | QTextStream & , | ||
129 | ANetNodeInstance * , | 142 | ANetNodeInstance * , |
130 | long ) | 143 | long ) |
131 | { return 1; } | 144 | { return 1; } |
132 | 145 | ||
133 | |||
134 | // generate NIC name based on instance nr | 146 | // generate NIC name based on instance nr |
135 | // only relevant if node instances are devices | 147 | // only relevant if node instances are devices |
136 | virtual QString genNic( long ) | 148 | virtual QString genNic( long ) |
137 | { return QString(""); } | 149 | { return QString(""); } |
138 | 150 | ||
139 | // max number of instances for this node type | 151 | // max number of instances for this node type |
140 | // only relevant if node instances are devices | 152 | // only relevant if node instances are devices |
141 | virtual long instanceCount( void ) | 153 | virtual long instanceCount( void ) |
142 | { return 1; } | 154 | { return 1; } |
143 | 155 | ||
144 | // return list of files that are specific for this node class | 156 | // return ID list for each file generated specially for |
145 | virtual QStringList * properFiles( void ) | 157 | // this node type |
146 | { return 0; } | 158 | virtual QStringList properFiles( void ) |
159 | { return QStringList(); } | ||
147 | 160 | ||
148 | // | 161 | // |
149 | // | 162 | // |
150 | // pure virtual methods with sensible default | 163 | // pure virtual methods with sensible default |
151 | // | 164 | // |
152 | // | 165 | // |
153 | 166 | ||
154 | // pixmap needed for this NetNode | 167 | // pixmap needed for this NetNode |
155 | virtual const QString pixmapName() = 0; | 168 | virtual const QString pixmapName() = 0; |
156 | 169 | ||
157 | // description for this NetNode | 170 | // description for this NetNode |
158 | virtual const QString nodeDescription() = 0; | 171 | virtual const QString nodeDescription() = 0; |
159 | 172 | ||
160 | // create a blank instance of a net node | 173 | // create a blank instance of a net node |
161 | virtual ANetNodeInstance * createInstance( void ) = 0; | 174 | virtual ANetNodeInstance * createInstance( void ) = 0; |
162 | 175 | ||
163 | // return feature this NetNode provides | 176 | // return features this NetNode provides |
164 | virtual const char * provides( void ) = 0; | 177 | virtual const char ** provides( void ) = 0; |
178 | |||
179 | // return features this NetNode needs | ||
165 | virtual const char ** needs( void ) = 0; | 180 | virtual const char ** needs( void ) = 0; |
166 | 181 | ||
167 | protected : | 182 | protected : |
168 | 183 | ||
169 | NetNodeList * Alternatives; | 184 | NetNodeList * Alternatives; |
170 | 185 | ||
171 | private : | 186 | private : |
172 | 187 | ||
173 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | 188 | virtual void setSpecificAttribute( QString & , QString & ) = 0; |
174 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | 189 | virtual void saveSpecificAttribute( QTextStream & ) = 0; |
175 | int Done; | 190 | int Done; |
176 | 191 | ||
177 | }; | 192 | }; |
178 | 193 | ||
179 | class ANetNodeInstance : public QObject { | 194 | class ANetNodeInstance : public QObject { |
180 | 195 | ||
181 | public: | 196 | public: |
182 | 197 | ||
183 | ANetNodeInstance( ANetNode * NN ) : QObject() | 198 | ANetNodeInstance( ANetNode * NN ) : QObject() |
184 | { IsModified=0; NodeType = NN; IsNew = TRUE; } | 199 | { IsModified=0; NodeType = NN; IsNew = TRUE; } |
185 | virtual ~ANetNodeInstance( void ) { } | 200 | virtual ~ANetNodeInstance( void ) { } |
186 | 201 | ||
187 | inline int done( void ) | 202 | inline int done( void ) |
188 | { return Done; } | 203 | { return Done; } |
189 | inline void setDone( int D ) | 204 | inline void setDone( int D ) |
190 | { Done = D; } | 205 | { Done = D; } |
191 | 206 | ||
192 | // return data was modified | 207 | // return data was modified |
193 | inline void setModified( bool M ) | 208 | inline void setModified( bool M ) |
194 | { IsModified = M; } | 209 | { IsModified = M; } |
195 | inline bool isModified( void ) | 210 | inline bool isModified( void ) |
196 | { return IsModified; } | 211 | { return IsModified; } |
197 | 212 | ||
198 | // get next node | 213 | // get next node |
199 | ANetNodeInstance * nextNode(); | 214 | ANetNodeInstance * nextNode(); |
200 | // return NetNode this is an instance of | 215 | // return NetNode this is an instance of |
201 | ANetNode * nodeClass( void ) | 216 | ANetNode * nodeClass( void ) |
202 | { return NodeType; } | 217 | { return NodeType; } |
203 | 218 | ||
204 | // intialize am instance of a net node | 219 | // intialize am instance of a net node |
205 | void initialize( void ); | 220 | void initialize( void ); |
206 | 221 | ||
207 | // set the value of an attribute | 222 | // set the value of an attribute |
208 | void setAttribute( QString & Attr, QString & Value ) ; | 223 | void setAttribute( QString & Attr, QString & Value ) ; |
209 | void saveAttributes( QTextStream & TS ) ; | 224 | void saveAttributes( QTextStream & TS ) ; |
210 | 225 | ||
211 | // return true if node isntance is NEW and not loaded | 226 | // return true if node isntance is NEW and not loaded |
212 | inline void setNew( bool IsN ) | 227 | inline void setNew( bool IsN ) |
213 | { IsNew = IsN; } | 228 | { IsNew = IsN; } |
214 | inline bool isNew( void ) | 229 | inline bool isNew( void ) |
215 | { return IsNew; } | 230 | { return IsNew; } |
216 | 231 | ||
217 | // return description for this instance | 232 | // return description for this instance |
218 | inline QString & description( void ) | 233 | inline QString & description( void ) |
219 | { return Description; } | 234 | { return Description; } |
220 | inline void setDescription( const QString & S ) | 235 | inline void setDescription( const QString & S ) |
221 | { Description = S; } | 236 | { Description = S; } |
222 | 237 | ||
223 | // pixmap for this instance -> from NetNode | 238 | // pixmap for this instance -> from NetNode |
224 | inline const QString pixmapName( void ) | 239 | inline const QString pixmapName( void ) |
225 | { return NodeType->pixmapName(); } | 240 | { return NodeType->pixmapName(); } |
226 | 241 | ||
227 | inline const char * provides( void ) | 242 | inline const char ** provides( void ) |
228 | { return NodeType->provides(); } | 243 | { return NodeType->provides(); } |
229 | 244 | ||
230 | inline const char ** needs( void ) | 245 | inline const char ** needs( void ) |
231 | { return NodeType->needs(); } | 246 | { return NodeType->needs(); } |
232 | 247 | ||
233 | inline void setConnection( NodeCollection * NC ) | 248 | inline void setConnection( NodeCollection * NC ) |
234 | { Connection = NC; } | 249 | { Connection = NC; } |
235 | inline NodeCollection * connection( void ) | 250 | inline NodeCollection * connection( void ) |
236 | { return Connection; } | 251 | { return Connection; } |
237 | 252 | ||
238 | // | 253 | // |
239 | // | 254 | // |
240 | // Virtual methods with sensible defaults | 255 | // Virtual methods with sensible defaults |
241 | // | 256 | // |
242 | // | 257 | // |
243 | 258 | ||
244 | 259 | ||
245 | 260 | ||
246 | // open proper file identified by S | 261 | // open proper file identified by S |
247 | virtual QFile * openFile( const QString & ) | 262 | virtual bool openFile( SystemFile & ) |
248 | { return 0; } | 263 | { return 0; } |
249 | 264 | ||
250 | // check if this node (or sub nodes) have data for this file | 265 | // check if this node (or sub nodes) have data for this file |
251 | virtual bool hasDataForFile( const QString & S ) | 266 | virtual bool hasDataForFile( SystemFile & S ) |
252 | { return nodeClass()->hasDataForFile( S ); } | 267 | { return nodeClass()->hasDataForFile( S ); } |
253 | 268 | ||
254 | // generate code specific for this node but embedded | 269 | // generate code specific for this node but embedded |
255 | // in the section of the parent | 270 | // in the section of the parent |
256 | // this is called within the code of the parent | 271 | // this is called within the code of the parent |
257 | virtual short generateFileEmbedded( const QString & ID, | 272 | virtual short generateFileEmbedded( SystemFile & SF, |
258 | const QString & Path, | ||
259 | QTextStream & TS, | ||
260 | long DevNr ) | 273 | long DevNr ) |
261 | { ANetNodeInstance * NNI = nextNode(); | 274 | { ANetNodeInstance * NNI = nextNode(); |
262 | return (NNI) ? NNI->generateFileEmbedded( ID, Path, TS, DevNr ) : 1; | 275 | return (NNI) ? NNI->generateFileEmbedded( SF, DevNr ) : 1; |
263 | } | 276 | } |
264 | 277 | ||
265 | // generate code specific for this node | 278 | // generate code specific for this node |
266 | // (or find the first node that does) | 279 | // (or find the first node that does) |
267 | virtual short generateFile( const QString & ID, | 280 | virtual short generateFile( SystemFile & SF, |
268 | const QString & Path, | ||
269 | QTextStream & TS, | ||
270 | long DevNr ) | 281 | long DevNr ) |
271 | { ANetNodeInstance * NNI = nextNode(); | 282 | { ANetNodeInstance * NNI = nextNode(); |
272 | return (NNI) ? NNI->generateFile( ID, Path, TS, DevNr ) : 1; | 283 | return (NNI) ? NNI->generateFile( SF, DevNr ) : 1; |
273 | } | 284 | } |
274 | 285 | ||
275 | // return true if this node instance is triggered by this trigger | 286 | // return true if this node instance is triggered by this trigger |
276 | // could be delegated to deeper instances | 287 | // could be delegated to deeper instances |
277 | virtual bool triggeredBy( const QString & ) | 288 | virtual bool triggeredBy( const QString & ) |
278 | { return 0; } | 289 | { return 0; } |
279 | 290 | ||
280 | // | 291 | // |
281 | // | 292 | // |
282 | // Pure virtual functions | 293 | // Pure virtual functions |
283 | // | 294 | // |
284 | // | 295 | // |
285 | 296 | ||
286 | // return runtime information for this node | 297 | // return runtime information for this node |
287 | virtual RuntimeInfo * runtime( void ) = 0; | 298 | virtual RuntimeInfo * runtime( void ) = 0; |
288 | 299 | ||
289 | // create edit widget under parent | 300 | // create edit widget under parent |
290 | virtual QWidget * edit( QWidget * parent ) = 0; | 301 | virtual QWidget * edit( QWidget * parent ) = 0; |
291 | 302 | ||
292 | // is given data acceptable | 303 | // is given data acceptable |
293 | virtual QString acceptable( void ) = 0; | 304 | virtual QString acceptable( void ) = 0; |
294 | 305 | ||
295 | // get data from GUI and store in node | 306 | // get data from GUI and store in node |
296 | virtual void commit( void ) = 0; | 307 | virtual void commit( void ) = 0; |
297 | 308 | ||
298 | // returns node specific data -> only useful for 'buddy' | 309 | // returns node specific data -> only useful for 'buddy' |
299 | virtual void * data( void ) = 0; | 310 | virtual void * data( void ) = 0; |
300 | 311 | ||
301 | protected : | 312 | protected : |
302 | 313 | ||
303 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | 314 | virtual void setSpecificAttribute( QString & , QString & ) = 0; |
304 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | 315 | virtual void saveSpecificAttribute( QTextStream & ) = 0; |
305 | 316 | ||
306 | ANetNode * NodeType; | 317 | ANetNode * NodeType; |
307 | // connection to which this node belongs to | 318 | // connection to which this node belongs to |
308 | NodeCollection * Connection; | 319 | NodeCollection * Connection; |
309 | QString Description; | 320 | QString Description; |
310 | bool IsModified; | 321 | bool IsModified; |
311 | bool IsNew; | 322 | bool IsNew; |
312 | int Done; | 323 | int Done; |
313 | 324 | ||
314 | static long InstanceCounter; | 325 | static long InstanceCounter; |
315 | }; | 326 | }; |
316 | 327 | ||
317 | class RuntimeInfo : public QObject { | 328 | class RuntimeInfo : public QObject { |
318 | 329 | ||
319 | Q_OBJECT | 330 | Q_OBJECT |
320 | 331 | ||
321 | public : | 332 | public : |
322 | 333 | ||
323 | RuntimeInfo( ANetNodeInstance * TheNNI ) | 334 | RuntimeInfo( ANetNodeInstance * TheNNI ) |
324 | { NNI = TheNNI; } | 335 | { NNI = TheNNI; } |
325 | 336 | ||
326 | // downcast implemented by specify runtime classes | 337 | // |
327 | virtual AsDevice * asDevice( void ) | 338 | // |
328 | { return 0; } | 339 | // methods to be overloaded by connection capable |
329 | virtual AsConnection * asConnection( void ) | 340 | // runtimes |
330 | { return 0; } | 341 | // |
331 | virtual AsLine * asLine( void ) | 342 | // |
332 | { return 0; } | 343 | |
333 | virtual AsFullSetup * asFullSetup( void ) | 344 | |
334 | { return 0; } | 345 | // |
346 | // | ||
347 | // methods to be overloaded by device capable | ||
348 | // runtimes | ||
349 | // | ||
350 | // | ||
335 | 351 | ||
336 | // does this node handles this interface e.g.eth0 | 352 | // does this node handles this interface e.g.eth0 |
337 | // recurse deeper if this node cannot answer that question | 353 | // recurse deeper if this node cannot answer that question |
338 | virtual bool handlesInterface( const QString & ) | 354 | virtual bool handlesInterface( const QString & S ) { |
339 | { return 0; } | 355 | RuntimeInfo * RI = device(); |
340 | virtual bool handlesInterface( const InterfaceInfo & ) | 356 | if( RI ) { |
341 | { return 0; } | 357 | return RI->handlesInterface( S ); |
342 | virtual InterfaceInfo * assignedInterface( void ); | 358 | } |
343 | virtual AsDevice * device( void ); | 359 | return 0; |
344 | 360 | } | |
345 | ANetNodeInstance * netNode() | 361 | bool handlesInterface( const InterfaceInfo & I ) { |
362 | RuntimeInfo * RI = device(); | ||
363 | if( RI ) { | ||
364 | return RI->handlesInterface( I ); | ||
365 | } | ||
366 | return 0; | ||
367 | } | ||
368 | |||
369 | // | ||
370 | // | ||
371 | // methods to be overloaded by full setup capable | ||
372 | // runtimes | ||
373 | // | ||
374 | // | ||
375 | |||
376 | // return description for this full setup | ||
377 | virtual const QString & description( void ) { | ||
378 | return fullSetup()->description( ); | ||
379 | } | ||
380 | // return triggers that should fire when this | ||
381 | // setup is brought up | ||
382 | virtual const QStringList & triggers( void ) { | ||
383 | return fullSetup()->triggers( ); | ||
384 | } | ||
385 | |||
386 | // | ||
387 | // | ||
388 | // methods to be overloaded by line capable | ||
389 | // runtimes | ||
390 | // | ||
391 | // | ||
392 | |||
393 | // return the device file ('/dev/xxx') created | ||
394 | // by this line capable runtime | ||
395 | virtual QString deviceFile( void ) { | ||
396 | RuntimeInfo * RI = line(); | ||
397 | if( RI ) { | ||
398 | return RI->deviceFile(); | ||
399 | } | ||
400 | return QString(); | ||
401 | } | ||
402 | |||
403 | // | ||
404 | // | ||
405 | // runtime interface | ||
406 | // | ||
407 | // | ||
408 | |||
409 | // return the node that offers device capability | ||
410 | virtual RuntimeInfo * device( void ) | ||
411 | { RuntimeInfo * RI = nextNode(); | ||
412 | return (RI) ? RI->device() : 0; | ||
413 | } | ||
414 | |||
415 | // return the node that offers connection capability | ||
416 | virtual RuntimeInfo * connection( void ) | ||
417 | { RuntimeInfo * RI = nextNode(); | ||
418 | return (RI) ? RI->connection() : 0; | ||
419 | } | ||
420 | |||
421 | // return the node that offers line capability | ||
422 | virtual RuntimeInfo * line( void ) | ||
423 | { RuntimeInfo * RI = nextNode(); | ||
424 | return (RI) ? RI->line() : 0; | ||
425 | } | ||
426 | |||
427 | // return the node that offers full setup capability | ||
428 | virtual RuntimeInfo * fullSetup( void ) | ||
429 | { RuntimeInfo * RI = nextNode(); | ||
430 | return (RI) ? RI->fullSetup() : 0; | ||
431 | } | ||
432 | |||
433 | inline ANetNodeInstance * netNode() | ||
346 | { return NNI; } | 434 | { return NNI; } |
347 | NodeCollection * connection() | 435 | |
436 | inline NodeCollection * nodeCollection() | ||
348 | { return NNI->connection(); } | 437 | { return NNI->connection(); } |
349 | 438 | ||
350 | virtual void detectState( NodeCollection * NC ) = 0; | 439 | virtual State_t detectState( void ) = 0; |
351 | virtual bool setState( NodeCollection * NC, Action_t A, bool Force = 0 ) = 0; | 440 | // public API to set the state |
352 | virtual bool canSetState( State_t Curr, Action_t A ) = 0; | 441 | virtual QString setState( NodeCollection * NC, |
442 | Action_t A, | ||
443 | bool Force = 0 ); | ||
444 | |||
445 | inline RuntimeInfo * nextNode( void ) { | ||
446 | ANetNodeInstance * NNI = netNode()->nextNode(); | ||
447 | return (NNI) ? NNI->runtime() : 0; | ||
448 | } | ||
353 | 449 | ||
354 | signals : | 450 | signals : |
355 | 451 | ||
356 | // sent by device if state changes | 452 | // sent by device if state changes |
357 | void stateChanged( State_t S, ANetNodeInstance * NNI ); | 453 | void stateChanged( State_t S, ANetNodeInstance * NNI ); |
358 | 454 | ||
359 | protected : | 455 | protected : |
360 | 456 | ||
457 | // set state of this node (private API) | ||
458 | virtual QString setMyState( NodeCollection * NC, | ||
459 | Action_t A, | ||
460 | bool Force = 0 ) = 0; | ||
461 | |||
361 | // connection this runtime info belongs to | 462 | // connection this runtime info belongs to |
362 | ANetNodeInstance * NNI; | 463 | ANetNodeInstance * NNI; |
363 | }; | 464 | }; |
364 | 465 | ||
365 | class NodeCollection : public QList<ANetNodeInstance> { | 466 | class NodeCollection : public QList<ANetNodeInstance> { |
366 | 467 | ||
367 | public : | 468 | public : |
368 | 469 | ||
369 | NodeCollection( void ); | 470 | NodeCollection( void ); |
370 | NodeCollection( QTextStream & TS ); | 471 | NodeCollection( QTextStream & TS ); |
371 | ~NodeCollection( void ); | 472 | ~NodeCollection( void ); |
372 | 473 | ||
373 | inline int done( void ) | 474 | inline int done( void ) |
374 | { return Done; } | 475 | { return Done; } |
375 | inline void setDone( int D ) | 476 | inline void setDone( int D ) |
376 | { Done = D; } | 477 | { Done = D; } |
377 | 478 | ||
378 | inline int number( void ) | 479 | inline int number( void ) |
379 | { return Number; } | 480 | { return Number; } |
380 | inline void setNumber( int i ) | 481 | inline void setNumber( int i ) |
381 | { Number = i; } | 482 | { Number = i; } |
382 | inline bool isNew( void ) | 483 | inline bool isNew( void ) |
383 | { return IsNew; } | 484 | { return IsNew; } |
384 | inline void setNew( bool N ) | 485 | inline void setNew( bool N ) |
385 | { IsNew = N ; } | 486 | { IsNew = N ; } |
386 | inline bool isModified( void ) | 487 | inline bool isModified( void ) |
387 | { return IsModified; } | 488 | { return IsModified; } |
388 | inline void setModified( bool N ) | 489 | inline void setModified( bool N ) |
389 | { IsModified = N ; } | 490 | { IsModified = N ; } |
390 | 491 | ||
391 | inline bool handlesInterface( const QString & S ) { | 492 | inline bool handlesInterface( const QString & S ) { |
392 | return getToplevel()->runtime()->handlesInterface( S ); | 493 | return getToplevel()->runtime()->handlesInterface( S ); |
393 | } | 494 | } |
394 | 495 | ||
496 | // return the interface in the OS that is assigned to | ||
497 | // this device | ||
395 | inline InterfaceInfo * assignedInterface( void ) { | 498 | inline InterfaceInfo * assignedInterface( void ) { |
396 | return getToplevel()->runtime()->assignedInterface(); | 499 | return AssignedInterface; |
397 | } | 500 | } |
398 | 501 | ||
399 | inline AsDevice * device() { | 502 | // assign the interface to this device |
503 | inline void assignInterface( InterfaceInfo * NI ) { | ||
504 | if( NI == 0 ) { | ||
505 | if( AssignedInterface ) { | ||
506 | AssignedInterface->assignConnection( 0 ); | ||
507 | } | ||
508 | } | ||
509 | AssignedInterface = NI; | ||
510 | if( AssignedInterface ) { | ||
511 | AssignedInterface->assignConnection( this ); | ||
512 | } | ||
513 | } | ||
514 | |||
515 | inline RuntimeInfo * device() { | ||
400 | return getToplevel()->runtime()->device(); | 516 | return getToplevel()->runtime()->device(); |
401 | } | 517 | } |
402 | 518 | ||
403 | bool triggersVPN(); | 519 | const QStringList & triggers(); |
404 | 520 | ||
405 | inline State_t state( bool Update = 0 ) | 521 | State_t state( bool Update = 0 ); |
406 | { Log(( "%s state %d(=%d?)\n", Name.latin1(), CurrentState, | ||
407 | Unchecked )); | ||
408 | if( CurrentState == Unchecked || Update ) { | ||
409 | Log(( "TL %p TLR %p\n", | ||
410 | getToplevel(), | ||
411 | getToplevel()->runtime() )); | ||
412 | // need to get current state | ||
413 | getToplevel()->runtime()->detectState( this ); | ||
414 | } | ||
415 | return CurrentState; | ||
416 | } | ||
417 | 522 | ||
418 | // get the ixmap for this device | 523 | // get the ixmap for this device |
419 | QPixmap devicePixmap( void ); | 524 | QPixmap devicePixmap( void ); |
420 | QPixmap statePixmap( State_t S ); | 525 | QPixmap statePixmap( State_t S ); |
421 | inline QPixmap statePixmap( bool Update = 0 ) | 526 | inline QPixmap statePixmap( bool Update = 0 ) |
422 | { return statePixmap( state(Update) ); } | 527 | { return statePixmap( state(Update) ); } |
423 | QString stateName( State_t ); | 528 | QString stateName( State_t ); |
424 | inline QString stateName( bool Update = 0 ) | 529 | inline QString stateName( bool Update = 0 ) |
425 | { return stateName( state(Update) ); } | 530 | { return stateName( state(Update) ); } |
426 | 531 | ||
427 | inline bool setState( Action_t A, bool Force =0 ) | 532 | QString setState( Action_t A, bool Force = 0 ); |
428 | { return getToplevel()->runtime()->setState( this, A, Force ); } | ||
429 | inline bool canSetState( Action_t A ) | ||
430 | { return getToplevel()->runtime()->canSetState( CurrentState, A ); } | ||
431 | 533 | ||
432 | void save( QTextStream & TS ); | 534 | void save( QTextStream & TS ); |
433 | 535 | ||
434 | void append( ANetNodeInstance * NNI ); | 536 | void append( ANetNodeInstance * NNI ); |
435 | 537 | ||
436 | // makes sure that all items in the connection point to | 538 | // makes sure that all items in the connection point to |
437 | // that connectoin | 539 | // that connectoin |
438 | void reassign( void ); | 540 | void reassign( void ); |
439 | 541 | ||
440 | ANetNodeInstance * getToplevel( void ); | 542 | ANetNodeInstance * getToplevel( void ); |
441 | ANetNodeInstance * findNext( ANetNodeInstance * NNI ); | 543 | ANetNodeInstance * findNext( ANetNodeInstance * NNI ); |
442 | ANetNodeInstance * findByName( const QString & S ); | 544 | ANetNodeInstance * findByName( const QString & S ); |
443 | 545 | ||
444 | inline const QString & name() | 546 | inline const QString & name() |
445 | { return Name; } | 547 | { return Name; } |
446 | 548 | ||
447 | const QString & description( void ); | 549 | const QString & description( void ); |
448 | 550 | ||
449 | inline void setName( const QString & N) | 551 | inline void setName( const QString & N) |
450 | { Name = N; } | 552 | { Name = N; } |
451 | 553 | ||
452 | inline State_t currentState( void ) | 554 | inline State_t currentState( void ) |
453 | { return CurrentState; } | 555 | { return CurrentState; } |
454 | inline void setCurrentState( State_t S ) | 556 | inline void setCurrentState( State_t S ) |
455 | { CurrentState = S; } | 557 | { CurrentState = S; } |
456 | 558 | ||
457 | // return TRUE if this node can have data to be inserted in | 559 | // return TRUE if this node can have data to be inserted in |
458 | // file identified by S | 560 | // file identified by S |
459 | bool hasDataForFile( const QString & S ); | 561 | bool hasDataForFile( SystemFile & S ); |
460 | ANetNodeInstance * firstWithDataForFile( const QString & S ); | 562 | ANetNodeInstance * firstWithDataForFile( SystemFile & ); |
461 | 563 | ||
462 | // generate items for this file -> toplevel call | 564 | // generate items for this file -> toplevel call |
463 | short generateFile( const QString & FID, // identification of file | 565 | short generateFile( SystemFile & SF, |
464 | const QString & FName, // effective filename of file | ||
465 | QTextStream & TS, // stream to file | ||
466 | long DN // device number | 566 | long DN // device number |
467 | ) | 567 | ) |
468 | { return getToplevel()->generateFile( FID, FName, TS, DN ); } | 568 | { return getToplevel()->generateFile( SF, DN ); } |
469 | 569 | ||
470 | bool triggeredBy( const QString & Trigger ) | 570 | bool triggeredBy( const QString & Trigger ) |
471 | { return getToplevel()->triggeredBy( Trigger ); } | 571 | { return getToplevel()->triggeredBy( Trigger ); } |
472 | 572 | ||
473 | private : | 573 | private : |
474 | 574 | ||
475 | int compareItems ( QCollection::Item item1, | 575 | int compareItems ( QCollection::Item item1, |
476 | QCollection::Item item2 ); | 576 | QCollection::Item item2 ); |
477 | 577 | ||
478 | long Number; | 578 | long Number; |
479 | 579 | ||
480 | // state of this connection | 580 | // state of this connection |
481 | State_t CurrentState; | 581 | State_t CurrentState; |
482 | 582 | ||
483 | QString Name; | 583 | QString Name; |
484 | // true if this collection was just created (and not | 584 | // true if this collection was just created (and not |
485 | // loaded from file | 585 | // loaded from file |
486 | bool IsNew; | 586 | bool IsNew; |
487 | // index in listbox | 587 | // index in listbox |
488 | int Index; | 588 | int Index; |
489 | bool IsModified; | 589 | bool IsModified; |
490 | int Done; | 590 | int Done; |
491 | 591 | ||
592 | InterfaceInfo * AssignedInterface; | ||
593 | |||
492 | }; | 594 | }; |
493 | 595 | ||
494 | #endif | 596 | #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,28 +1,24 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #CONFIG += qt warn_on debug | 3 | #CONFIG += qt warn_on debug |
4 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 4 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
5 | HEADERS = netnode.h \ | 5 | HEADERS = netnode.h \ |
6 | resources.h \ | 6 | resources.h \ |
7 | system.h \ | 7 | system.h \ |
8 | asline.h \ | ||
9 | GUIUtils.h \ | 8 | GUIUtils.h \ |
10 | asconnection.h \ | ||
11 | asfullsetup.h \ | ||
12 | systemfile.h \ | 9 | systemfile.h \ |
13 | wextensions.h \ | 10 | wextensions.h |
14 | asdevice.h | ||
15 | SOURCES = netnode.cpp \ | 11 | SOURCES = netnode.cpp \ |
16 | GUIUtils.cpp \ | 12 | GUIUtils.cpp \ |
17 | system.cpp \ | 13 | system.cpp \ |
18 | systemfile.cpp \ | 14 | systemfile.cpp \ |
19 | wextensions.cpp \ | 15 | wextensions.cpp \ |
20 | resources.cpp | 16 | resources.cpp |
21 | INCLUDEPATH+= $(OPIEDIR)/include ../networksettings2 | 17 | INCLUDEPATH+= $(OPIEDIR)/include ../networksettings2 |
22 | DEPENDPATH+= $(OPIEDIR)/include | 18 | DEPENDPATH+= $(OPIEDIR)/include |
23 | LIBS += -lqpe -lopiecore2 -lopieui2 | 19 | LIBS += -lqpe -lopiecore2 -lopieui2 |
24 | INTERFACES= | 20 | INTERFACES= |
25 | TARGET = networksettings2 | 21 | TARGET = networksettings2 |
26 | VERSION = 1.0.0 | 22 | VERSION = 1.0.0 |
27 | 23 | ||
28 | include( $(OPIEDIR)/include.pro ) | 24 | include( $(OPIEDIR)/include.pro ) |
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 | |||
@@ -1,450 +1,470 @@ | |||
1 | #include <unistd.h> | 1 | #include <unistd.h> |
2 | #include <errno.h> | 2 | #include <errno.h> |
3 | #include <fcntl.h> | 3 | #include <fcntl.h> |
4 | #include <pwd.h> | 4 | #include <pwd.h> |
5 | #include <qpixmap.h> | 5 | #include <qpixmap.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include <qpe/qlibrary.h> | 7 | #include <qpe/qlibrary.h> |
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <opie2/odebug.h> | 9 | #include <opie2/odebug.h> |
10 | #include <qtopia/resource.h> | 10 | #include <qtopia/resource.h> |
11 | 11 | ||
12 | #include "netnode.h" | 12 | #include "netnode.h" |
13 | #include "resources.h" | 13 | #include "resources.h" |
14 | 14 | ||
15 | #define PLUGINDIR "plugins/networksettings2" | 15 | #define PLUGINDIR "plugins/networksettings2" |
16 | #define ICONDIR "/pics/networksettings2/" | 16 | #define ICONDIR "/pics/networksettings2/" |
17 | 17 | ||
18 | // single resources instance | 18 | // single resources instance |
19 | TheNSResources * _NSResources = 0; | 19 | TheNSResources * _NSResources = 0; |
20 | 20 | ||
21 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | 21 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), |
22 | ConnectionsMap() { | 22 | ConnectionsMap() { |
23 | 23 | ||
24 | _NSResources = this; | 24 | _NSResources = this; |
25 | 25 | ||
26 | detectCurrentUser(); | 26 | detectCurrentUser(); |
27 | 27 | ||
28 | // load available netnodes | 28 | // load available netnodes |
29 | findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); | 29 | findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); |
30 | 30 | ||
31 | // compile provides and needs lists | 31 | // compile provides and needs lists |
32 | { const char ** NeedsRun; | 32 | { const char ** NeedsRun; |
33 | QDictIterator<NetNode_t> OuterIt( AllNodeTypes ); | 33 | QDictIterator<NetNode_t> OuterIt( AllNodeTypes ); |
34 | bool Done; | 34 | bool Done; |
35 | 35 | ||
36 | for ( ; OuterIt.current(); ++OuterIt ) { | 36 | for ( ; OuterIt.current(); ++OuterIt ) { |
37 | // find needs list | 37 | // find needs list |
38 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; | 38 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; |
39 | ANetNode::NetNodeList & NNL = *(NNLP); | 39 | ANetNode::NetNodeList & NNL = *(NNLP); |
40 | 40 | ||
41 | // must iterate this way to avoid duplication pointers | 41 | // must iterate this way to avoid duplication pointers |
42 | for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes ); | 42 | for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes ); |
43 | InnerIt.current(); ++InnerIt ) { | 43 | InnerIt.current(); ++InnerIt ) { |
44 | if( InnerIt.current() == OuterIt.current() ) | 44 | if( InnerIt.current() == OuterIt.current() ) |
45 | // avoid recursive | 45 | // avoid recursive |
46 | continue; | 46 | continue; |
47 | 47 | ||
48 | const char * Provides = InnerIt.current()->NetNode->provides(); | 48 | const char ** Provides = InnerIt.current()->NetNode->provides(); |
49 | NeedsRun = OuterIt.current()->NetNode->needs(); | 49 | NeedsRun = OuterIt.current()->NetNode->needs(); |
50 | |||
50 | for( ; *NeedsRun; NeedsRun ++ ) { | 51 | for( ; *NeedsRun; NeedsRun ++ ) { |
51 | if( strcmp( Provides, *NeedsRun ) == 0 ) { | 52 | const char ** PRun; |
52 | // inner provides what outer needs | 53 | PRun = Provides; |
53 | NNL.resize( NNL.size() + 1 ); | 54 | for( ; *PRun; PRun ++ ) { |
54 | NNL[NNL.size()-1] = InnerIt.current()->NetNode; | 55 | if( strcmp( *PRun, *NeedsRun ) == 0 ) { |
55 | Done = 1; // break from 2 loops | 56 | // inner provides what outer needs |
56 | break; | 57 | NNL.resize( NNL.size() + 1 ); |
58 | NNL[NNL.size()-1] = InnerIt.current()->NetNode; | ||
59 | Done = 1; // break from 2 loops | ||
60 | break; | ||
61 | } | ||
57 | } | 62 | } |
58 | } | 63 | } |
59 | } | 64 | } |
60 | OuterIt.current()->NetNode->setAlternatives( NNLP ); | 65 | OuterIt.current()->NetNode->setAlternatives( NNLP ); |
61 | } | 66 | } |
62 | } | 67 | } |
63 | 68 | ||
64 | // define Node types to Description map | 69 | // define built in Node types to Description map |
65 | NodeTypeNameMap.insert( "device", tr( "Network Device" ) ); | 70 | addNodeType( "device", tr( "Network Device" ), |
66 | NodeTypeNameMap.insert( "line", tr( "Character device" ) ); | 71 | tr( "<p>Devices that can handle IP packets</p>" ) ); |
67 | NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) ); | 72 | addNodeType( "line", tr( "Character device" ), |
68 | NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) ); | 73 | tr( "<p>Devices that can handle single bytes</p>" ) ); |
69 | 74 | addNodeType( "connection", tr( "IP Connection" ), | |
70 | NodeTypeDescriptionMap.insert( "device", | 75 | tr( "<p>Nodes that provide working IP connections</p>" ) ); |
71 | tr( "<p>Devices that can handle IP packets</p>" ) ); | 76 | addNodeType( "fullsetup", tr( "Connection Profile" ), |
72 | NodeTypeDescriptionMap.insert( "line", | 77 | tr( "<p>Fully configured connection profile</p>" ) ); |
73 | tr( "<p>Devices that can handle single bytes</p>" ) ); | 78 | addNodeType( "GPRS", tr( "Connection to GPRS device" ), |
74 | NodeTypeDescriptionMap.insert( "connection", | 79 | tr( "<p>Connection to a GPRS capable device</p>" ) ); |
75 | tr( "<p>Nodes that provide working IP connections</p>" ) ); | ||
76 | NodeTypeDescriptionMap.insert( "fullsetup", | ||
77 | tr( "<p>Fully configured connection profile</p>" ) ); | ||
78 | |||
79 | // define system files | ||
80 | addSystemFile( "interfaces", "/tmp/interfaces", 1 ); | ||
81 | 80 | ||
82 | // get access to the system | 81 | // get access to the system |
83 | TheSystem = new System(); | 82 | TheSystem = new System(); |
84 | 83 | ||
85 | } | 84 | } |
86 | 85 | ||
87 | TheNSResources::~TheNSResources( void ) { | 86 | TheNSResources::~TheNSResources( void ) { |
88 | delete TheSystem; | 87 | delete TheSystem; |
89 | } | 88 | } |
90 | 89 | ||
90 | void TheNSResources::addNodeType( const QString & ID, | ||
91 | const QString & Name, | ||
92 | const QString & Descr ) { | ||
93 | if( NodeTypeNameMap[ID].isEmpty() ) { | ||
94 | NodeTypeNameMap.insert( ID, Name ); | ||
95 | NodeTypeDescriptionMap.insert( ID, Descr ); | ||
96 | } | ||
97 | } | ||
98 | |||
91 | void TheNSResources::addSystemFile( const QString & ID, | 99 | void TheNSResources::addSystemFile( const QString & ID, |
92 | const QString & P, | 100 | const QString & P, |
93 | bool KDI ) { | 101 | bool KDI ) { |
94 | if( ! SystemFiles.find( ID ) ) { | 102 | if( ! SystemFiles.find( ID ) ) { |
95 | // new system file | 103 | // new system file |
96 | SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) ); | 104 | SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) ); |
97 | } // else existed | 105 | } // else existed |
98 | } | 106 | } |
99 | 107 | ||
100 | void TheNSResources::busy( bool ) { | 108 | void TheNSResources::busy( bool ) { |
101 | /* | 109 | /* |
102 | if( B ) { | 110 | if( B ) { |
103 | ShowWait->show(); | 111 | ShowWait->show(); |
104 | qApp->process | 112 | qApp->process |
105 | } else { | 113 | } else { |
106 | ShowWait->hide(); | 114 | ShowWait->hide(); |
107 | } | 115 | } |
108 | */ | 116 | */ |
109 | } | 117 | } |
110 | 118 | ||
111 | /** | 119 | /** |
112 | * Load all modules that are found in the path | 120 | * Load all modules that are found in the path |
113 | * @param path a directory that is scaned for any plugins that can be loaded | 121 | * @param path a directory that is scaned for any plugins that can be loaded |
114 | * and attempts to load them | 122 | * and attempts to load them |
115 | */ | 123 | */ |
116 | void TheNSResources::findAvailableNetNodes(const QString &path){ | 124 | void TheNSResources::findAvailableNetNodes(const QString &path){ |
117 | 125 | ||
118 | Log(("Locate plugins in %s\n", path.latin1() )); | 126 | Log(("Locate plugins in %s\n", path.latin1() )); |
119 | QDir d(path); | 127 | QDir d(path); |
120 | if(!d.exists()) | 128 | if(!d.exists()) |
121 | return; | 129 | return; |
122 | 130 | ||
123 | QString lang = ::getenv("LANG"); | 131 | QString lang = ::getenv("LANG"); |
124 | 132 | ||
125 | // Don't want sym links | 133 | // Don't want sym links |
126 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 134 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
127 | const QFileInfoList *list = d.entryInfoList(); | 135 | const QFileInfoList *list = d.entryInfoList(); |
128 | QFileInfoListIterator it( *list ); | 136 | QFileInfoListIterator it( *list ); |
129 | QFileInfo *fi; | 137 | QFileInfo *fi; |
130 | 138 | ||
131 | while ( (fi=it.current()) ) { | 139 | while ( (fi=it.current()) ) { |
132 | 140 | ||
133 | if( fi->fileName().contains(".so")){ | 141 | if( fi->fileName().contains(".so")){ |
134 | /* if loaded install translation */ | 142 | /* if loaded install translation */ |
135 | if( loadNetNode(path + "/" + fi->fileName()) ) { | 143 | if( loadNetNode(path + "/" + fi->fileName()) ) { |
136 | QTranslator *trans = new QTranslator(qApp); | 144 | QTranslator *trans = new QTranslator(qApp); |
137 | QString fn = QPEApplication::qpeDir()+ | 145 | QString fn = QPEApplication::qpeDir()+ |
138 | "/i18n/"+lang+"/"+ | 146 | "/i18n/"+lang+"/"+ |
139 | fi->fileName().left( fi->fileName().find(".") )+ | 147 | fi->fileName().left( fi->fileName().find(".") )+ |
140 | ".qm"; | 148 | ".qm"; |
141 | 149 | ||
142 | if( trans->load( fn ) ) | 150 | if( trans->load( fn ) ) |
143 | qApp->installTranslator( trans ); | 151 | qApp->installTranslator( trans ); |
144 | else | 152 | else |
145 | delete trans; | 153 | delete trans; |
146 | } | 154 | } |
147 | } | 155 | } |
148 | ++it; | 156 | ++it; |
149 | } | 157 | } |
150 | } | 158 | } |
151 | 159 | ||
152 | // used to find unique connection number | 160 | // used to find unique connection number |
153 | int TheNSResources::assignConnectionNumber( void ) { | 161 | int TheNSResources::assignConnectionNumber( void ) { |
154 | bool found = 1; | 162 | bool found = 1; |
155 | for( int trial = 0; ; trial ++ ) { | 163 | for( int trial = 0; ; trial ++ ) { |
156 | found = 1; | 164 | found = 1; |
157 | for( QDictIterator<NodeCollection> it(ConnectionsMap); | 165 | for( QDictIterator<NodeCollection> it(ConnectionsMap); |
158 | it.current(); | 166 | it.current(); |
159 | ++it ) { | 167 | ++it ) { |
160 | if( it.current()->number() == trial ) { | 168 | if( it.current()->number() == trial ) { |
161 | found = 0; | 169 | found = 0; |
162 | break; | 170 | break; |
163 | } | 171 | } |
164 | } | 172 | } |
165 | 173 | ||
166 | if( found ) { | 174 | if( found ) { |
167 | Log(("Assign profile number %d\n", trial )); | 175 | Log(("Assign profile number %d\n", trial )); |
168 | return trial; | 176 | return trial; |
169 | } | 177 | } |
170 | } | 178 | } |
171 | } | 179 | } |
172 | 180 | ||
173 | /** | 181 | /** |
174 | * Attempt to load a function and resolve a function. | 182 | * Attempt to load a function and resolve a function. |
175 | * @param pluginFileName - the name of the file in which to attempt to load | 183 | * @param pluginFileName - the name of the file in which to attempt to load |
176 | * @param resolveString - function pointer to resolve | 184 | * @param resolveString - function pointer to resolve |
177 | * @return true of loading is successful | 185 | * @return true of loading is successful |
178 | */ | 186 | */ |
179 | bool TheNSResources::loadNetNode( | 187 | bool TheNSResources::loadNetNode( |
180 | const QString &pluginFileName, const QString &resolveString){ | 188 | const QString &pluginFileName, const QString &resolveString){ |
181 | 189 | ||
182 | QLibrary *lib = new QLibrary(pluginFileName); | 190 | QLibrary *lib = new QLibrary(pluginFileName); |
183 | void * res = lib->resolve(resolveString); | 191 | void * res = lib->resolve(resolveString); |
184 | if( ! res ){ | 192 | if( ! res ){ |
185 | delete lib; | 193 | delete lib; |
186 | return 0; | 194 | return 0; |
187 | } | 195 | } |
188 | 196 | ||
189 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; | 197 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; |
190 | 198 | ||
191 | // Try to get an object. | 199 | // Try to get an object. |
192 | QList<ANetNode> PNN; | 200 | QList<ANetNode> PNN; |
193 | 201 | ||
194 | getNetNodeList( PNN ); | 202 | getNetNodeList( PNN ); |
195 | if( PNN.isEmpty() ) { | 203 | if( PNN.isEmpty() ) { |
196 | delete lib; | 204 | delete lib; |
197 | return 0; | 205 | return 0; |
198 | } | 206 | } |
199 | 207 | ||
200 | ANetNode * NNP; | 208 | ANetNode * NNP; |
201 | for( QListIterator<ANetNode> it(PNN); | 209 | for( QListIterator<ANetNode> it(PNN); |
202 | it.current(); | 210 | it.current(); |
203 | ++it ) { | 211 | ++it ) { |
204 | NetNode_t * NN; | 212 | NetNode_t * NN; |
205 | 213 | ||
206 | NNP = it.current(); | 214 | NNP = it.current(); |
207 | NN = new NetNode_t; | 215 | NN = new NetNode_t; |
208 | NN->NetNode = NNP; | 216 | NN->NetNode = NNP; |
209 | NN->TheLibrary = lib; | 217 | NN->TheLibrary = lib; |
210 | NN->NodeCountInLib = PNN.count(); | 218 | NN->NodeCountInLib = PNN.count(); |
211 | 219 | ||
212 | // store mapping | 220 | // store mapping |
213 | AllNodeTypes.insert( NN->NetNode->name(), NN ); | 221 | AllNodeTypes.insert( NN->NetNode->name(), NN ); |
214 | } | 222 | } |
215 | 223 | ||
216 | return 1; | 224 | return 1; |
217 | } | 225 | } |
218 | 226 | ||
219 | QPixmap TheNSResources::getPixmap( const QString & QS ) { | 227 | QPixmap TheNSResources::getPixmap( const QString & QS ) { |
220 | QPixmap P; | 228 | QPixmap P; |
221 | QString S("networksettings2/"); | 229 | QString S("networksettings2/"); |
222 | S += QS; | 230 | S += QS; |
223 | Log(("%s\n", S.latin1() )); | ||
224 | P = Resource::loadPixmap( S ); | 231 | P = Resource::loadPixmap( S ); |
232 | if( P.isNull() ) { | ||
233 | Log(( "Cannot load %s\n", S.latin1() )); | ||
234 | } | ||
225 | return ( P.isNull() ) ? QPixmap() : P; | 235 | return ( P.isNull() ) ? QPixmap() : P; |
226 | } | 236 | } |
227 | 237 | ||
228 | QString TheNSResources::tr( const char * s ) { | 238 | QString TheNSResources::tr( const char * s ) { |
229 | return qApp->translate( "resource", s ); | 239 | return qApp->translate( "resource", s ); |
230 | } | 240 | } |
231 | 241 | ||
232 | const QString & TheNSResources::netNode2Name( const char * s ) { | 242 | const QString & TheNSResources::netNode2Name( const char * s ) { |
233 | return NodeTypeNameMap[s]; | 243 | return NodeTypeNameMap[s]; |
234 | } | 244 | } |
235 | 245 | ||
236 | const QString & TheNSResources::netNode2Description( const char * s ) { | 246 | const QString & TheNSResources::netNode2Description( const char * s ) { |
237 | return NodeTypeDescriptionMap[s]; | 247 | return NodeTypeDescriptionMap[s]; |
238 | } | 248 | } |
239 | 249 | ||
240 | void TheNSResources::addConnection( NodeCollection * NC ) { | 250 | void TheNSResources::addConnection( NodeCollection * NC ) { |
241 | ANetNodeInstance * NNI; | 251 | ANetNodeInstance * NNI; |
242 | ConnectionsMap.insert( NC->name(), NC ); | 252 | ConnectionsMap.insert( NC->name(), NC ); |
243 | // add (new) nodes to NodeList | 253 | // add (new) nodes to NodeList |
244 | for( QListIterator<ANetNodeInstance> it(*NC); | 254 | for( QListIterator<ANetNodeInstance> it(*NC); |
245 | it.current(); | 255 | it.current(); |
246 | ++it ) { | 256 | ++it ) { |
247 | NNI = it.current(); | 257 | NNI = it.current(); |
248 | if( findNodeInstance( NNI->name() ) == 0 ) { | 258 | if( findNodeInstance( NNI->name() ) == 0 ) { |
249 | // new item | 259 | // new item |
250 | addNodeInstance( NNI ); | 260 | addNodeInstance( NNI ); |
251 | } | 261 | } |
252 | } | 262 | } |
253 | } | 263 | } |
254 | 264 | ||
255 | void TheNSResources::removeConnection( const QString & N ) { | 265 | void TheNSResources::removeConnection( const QString & N ) { |
256 | NodeCollection * NC = findConnection( N ); | 266 | NodeCollection * NC = findConnection( N ); |
257 | if( ! NC ) | 267 | if( ! NC ) |
258 | return; | 268 | return; |
259 | 269 | ||
260 | // delete netnodes in this connection | 270 | // delete netnodes in this connection |
261 | ANetNodeInstance * NNI; | 271 | ANetNodeInstance * NNI; |
262 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { | 272 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { |
263 | removeNodeInstance( NNI->name() ); | 273 | removeNodeInstance( NNI->name() ); |
264 | } | 274 | } |
265 | ConnectionsMap.remove( N ); | 275 | ConnectionsMap.remove( N ); |
266 | } | 276 | } |
267 | 277 | ||
268 | NodeCollection * TheNSResources::findConnection( const QString & S ) { | 278 | NodeCollection * TheNSResources::findConnection( const QString & S ) { |
269 | return ConnectionsMap[ S ]; | 279 | return ConnectionsMap[ S ]; |
270 | } | 280 | } |
271 | 281 | ||
282 | NodeCollection * TheNSResources::getConnection( int nr ) { | ||
283 | for( QDictIterator<NodeCollection> it(ConnectionsMap); | ||
284 | it.current(); | ||
285 | ++it ) { | ||
286 | if( it.current()->number() == nr ) { | ||
287 | return it.current(); | ||
288 | } | ||
289 | } | ||
290 | return 0; | ||
291 | } | ||
272 | /* | 292 | /* |
273 | void TheNSResources::renumberConnections( void ) { | 293 | void TheNSResources::renumberConnections( void ) { |
274 | Name2Connection_t & M = NSResources->connections(); | 294 | Name2Connection_t & M = NSResources->connections(); |
275 | NodeCollection * NC; | 295 | NodeCollection * NC; |
276 | 296 | ||
277 | // for all connections | 297 | // for all connections |
278 | NodeCollection::resetMaxNr(); | 298 | NodeCollection::resetMaxNr(); |
279 | for( QDictIterator<NodeCollection> it(M); | 299 | for( QDictIterator<NodeCollection> it(M); |
280 | it.current(); | 300 | it.current(); |
281 | ++it ) { | 301 | ++it ) { |
282 | NC = it.current(); | 302 | NC = it.current(); |
283 | NC->setNumber( NC->maxConnectionNumber()+1 ); | 303 | NC->setNumber( NC->maxConnectionNumber()+1 ); |
284 | NC->setModified( 1 ); | 304 | NC->setModified( 1 ); |
285 | } | 305 | } |
286 | } | 306 | } |
287 | */ | 307 | */ |
288 | 308 | ||
289 | typedef struct EnvVars { | 309 | typedef struct EnvVars { |
290 | char * Name; | 310 | char * Name; |
291 | int Len; | 311 | int Len; |
292 | } EnvVar_t; | 312 | } EnvVar_t; |
293 | 313 | ||
294 | #define AnEV(x) x, sizeof(x)-1 | 314 | #define AnEV(x) x, sizeof(x)-1 |
295 | 315 | ||
296 | static EnvVar_t EV[] = { | 316 | static EnvVar_t EV[] = { |
297 | AnEV( "HOME" ), | 317 | AnEV( "HOME" ), |
298 | AnEV( "LOGNAME" ), | 318 | AnEV( "LOGNAME" ), |
299 | AnEV( "USER" ), | 319 | AnEV( "USER" ), |
300 | AnEV( "LD_LIBRARY_PATH" ), | 320 | AnEV( "LD_LIBRARY_PATH" ), |
301 | AnEV( "PATH" ), | 321 | AnEV( "PATH" ), |
302 | AnEV( "QTDIR" ), | 322 | AnEV( "QTDIR" ), |
303 | AnEV( "OPIEDIR" ), | 323 | AnEV( "OPIEDIR" ), |
304 | AnEV( "SHELL" ), | 324 | AnEV( "SHELL" ), |
305 | { NULL, 0 } | 325 | { NULL, 0 } |
306 | }; | 326 | }; |
307 | 327 | ||
308 | void TheNSResources::detectCurrentUser( void ) { | 328 | void TheNSResources::detectCurrentUser( void ) { |
309 | // find current running qpe | 329 | // find current running qpe |
310 | QString QPEEnvFile = ""; | 330 | QString QPEEnvFile = ""; |
311 | 331 | ||
312 | CurrentUser.UserName = ""; | 332 | CurrentUser.UserName = ""; |
313 | CurrentUser.HomeDir = ""; | 333 | CurrentUser.HomeDir = ""; |
314 | 334 | ||
315 | if( getenv( "OPIEDIR" ) == 0 ) { | 335 | if( getenv( "OPIEDIR" ) == 0 ) { |
316 | // nothing known | 336 | // nothing known |
317 | { // open proc dir and find all dirs in it | 337 | { // open proc dir and find all dirs in it |
318 | QRegExp R("[0-9]+"); | 338 | QRegExp R("[0-9]+"); |
319 | QDir ProcDir( "/proc" ); | 339 | QDir ProcDir( "/proc" ); |
320 | QFileInfo FI; | 340 | QFileInfo FI; |
321 | QStringList EL = ProcDir.entryList( QDir::Dirs ); | 341 | QStringList EL = ProcDir.entryList( QDir::Dirs ); |
322 | 342 | ||
323 | // print it out | 343 | // print it out |
324 | for ( QStringList::Iterator it = EL.begin(); | 344 | for ( QStringList::Iterator it = EL.begin(); |
325 | it != EL.end(); | 345 | it != EL.end(); |
326 | ++it ) { | 346 | ++it ) { |
327 | if( R.match( (*it) ) >= 0 ) { | 347 | if( R.match( (*it) ) >= 0 ) { |
328 | QString S = ProcDir.path()+"/"+ (*it); | 348 | QString S = ProcDir.path()+"/"+ (*it); |
329 | S.append( "/exe" ); | 349 | S.append( "/exe" ); |
330 | FI.setFile( S ); | 350 | FI.setFile( S ); |
331 | // get the link | 351 | // get the link |
332 | S = FI.readLink(); | 352 | S = FI.readLink(); |
333 | if( S.right( 8 ) == "/bin/qpe" ) { | 353 | if( S.right( 8 ) == "/bin/qpe" ) { |
334 | // found running qpe | 354 | // found running qpe |
335 | QPEEnvFile.sprintf( ProcDir.path()+ "/" + (*it) + "/environ" ); | 355 | QPEEnvFile.sprintf( ProcDir.path()+ "/" + (*it) + "/environ" ); |
336 | break; | 356 | break; |
337 | } | 357 | } |
338 | } | 358 | } |
339 | } | 359 | } |
340 | } | 360 | } |
341 | 361 | ||
342 | if( QPEEnvFile.isEmpty() ) { | 362 | if( QPEEnvFile.isEmpty() ) { |
343 | // could not find qpe | 363 | // could not find qpe |
344 | Log(("Could not find qpe\n" )); | 364 | Log(("Could not find qpe\n" )); |
345 | return; | 365 | return; |
346 | } | 366 | } |
347 | 367 | ||
348 | // FI now contains path ProcDir to the cmd dir | 368 | // FI now contains path ProcDir to the cmd dir |
349 | { char * Buf = 0; | 369 | { char * Buf = 0; |
350 | char TB[1024]; | 370 | char TB[1024]; |
351 | long BufSize = 0; | 371 | long BufSize = 0; |
352 | int fd; | 372 | int fd; |
353 | int rd; | 373 | int rd; |
354 | 374 | ||
355 | fd = open( QPEEnvFile.latin1(), O_RDONLY ); | 375 | fd = open( QPEEnvFile.latin1(), O_RDONLY ); |
356 | if( fd < 0 ) { | 376 | if( fd < 0 ) { |
357 | Log(("Could not open %s : %d\n", | 377 | Log(("Could not open %s : %d\n", |
358 | QPEEnvFile.latin1(), errno )); | 378 | QPEEnvFile.latin1(), errno )); |
359 | return; | 379 | return; |
360 | } | 380 | } |
361 | 381 | ||
362 | while( (rd = read( fd, TB, sizeof(TB) ) ) > 0 ) { | 382 | while( (rd = read( fd, TB, sizeof(TB) ) ) > 0 ) { |
363 | Buf = (char *)realloc( Buf, BufSize+rd ); | 383 | Buf = (char *)realloc( Buf, BufSize+rd ); |
364 | memcpy( Buf+BufSize, TB, rd ); | 384 | memcpy( Buf+BufSize, TB, rd ); |
365 | BufSize += rd; | 385 | BufSize += rd; |
366 | } | 386 | } |
367 | 387 | ||
368 | char * Data = Buf; | 388 | char * Data = Buf; |
369 | char * DataEnd = Data+BufSize-1; | 389 | char * DataEnd = Data+BufSize-1; |
370 | 390 | ||
371 | // get env items out of list | 391 | // get env items out of list |
372 | while( Data < DataEnd ) { | 392 | while( Data < DataEnd ) { |
373 | 393 | ||
374 | EnvVar_t * Run = EV; | 394 | EnvVar_t * Run = EV; |
375 | while( Run->Name ) { | 395 | while( Run->Name ) { |
376 | if( strncmp( Data, Run->Name, Run->Len ) == 0 && | 396 | if( strncmp( Data, Run->Name, Run->Len ) == 0 && |
377 | Data[Run->Len] == '=' | 397 | Data[Run->Len] == '=' |
378 | ) { | 398 | ) { |
379 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); | 399 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); |
380 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = | 400 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = |
381 | strdup( Data ); | 401 | strdup( Data ); |
382 | 402 | ||
383 | if( strcmp( Run->Name, "OPIEDIR" ) == 0 ) { | 403 | if( strcmp( Run->Name, "OPIEDIR" ) == 0 ) { |
384 | // put OPIEDIR in env | 404 | // put OPIEDIR in env |
385 | putenv( CurrentUser.EnvList[CurrentUser.EnvList.size()-1] ); | 405 | putenv( CurrentUser.EnvList[CurrentUser.EnvList.size()-1] ); |
386 | } else if( strcmp( Run->Name, "HOME" ) == 0 ) { | 406 | } else if( strcmp( Run->Name, "HOME" ) == 0 ) { |
387 | CurrentUser.HomeDir = Data+5; | 407 | CurrentUser.HomeDir = Data+5; |
388 | } else if( strcmp( Run->Name, "LOGNAME" ) == 0 ) { | 408 | } else if( strcmp( Run->Name, "LOGNAME" ) == 0 ) { |
389 | CurrentUser.UserName = Data+8; | 409 | CurrentUser.UserName = Data+8; |
390 | } | 410 | } |
391 | break; | 411 | break; |
392 | } | 412 | } |
393 | Run ++; | 413 | Run ++; |
394 | } | 414 | } |
395 | 415 | ||
396 | Data += strlen( Data )+1; | 416 | Data += strlen( Data )+1; |
397 | } | 417 | } |
398 | 418 | ||
399 | free( Buf ); | 419 | free( Buf ); |
400 | 420 | ||
401 | if( ! CurrentUser.UserName.isEmpty() ) { | 421 | if( ! CurrentUser.UserName.isEmpty() ) { |
402 | // find user info | 422 | // find user info |
403 | struct passwd pwd; | 423 | struct passwd pwd; |
404 | struct passwd * pwdres; | 424 | struct passwd * pwdres; |
405 | 425 | ||
406 | if( getpwnam_r( CurrentUser.UserName.latin1(), | 426 | if( getpwnam_r( CurrentUser.UserName.latin1(), |
407 | &pwd, TB, sizeof(TB), &pwdres ) || | 427 | &pwd, TB, sizeof(TB), &pwdres ) || |
408 | pwdres == 0 ) { | 428 | pwdres == 0 ) { |
409 | Log(("Could not determine user %s : %d\n", | 429 | Log(("Could not determine user %s : %d\n", |
410 | CurrentUser.UserName.latin1(), errno )); | 430 | CurrentUser.UserName.latin1(), errno )); |
411 | return; | 431 | return; |
412 | } | 432 | } |
413 | CurrentUser.Uid = pwd.pw_uid; | 433 | CurrentUser.Uid = pwd.pw_uid; |
414 | CurrentUser.Gid = pwd.pw_gid; | 434 | CurrentUser.Gid = pwd.pw_gid; |
415 | } else{ | 435 | } else{ |
416 | CurrentUser.Uid = | 436 | CurrentUser.Uid = |
417 | CurrentUser.Gid = -1; | 437 | CurrentUser.Gid = -1; |
418 | } | 438 | } |
419 | } | 439 | } |
420 | 440 | ||
421 | } else { | 441 | } else { |
422 | char * X; | 442 | char * X; |
423 | QString S; | 443 | QString S; |
424 | 444 | ||
425 | EnvVar_t * Run = EV; | 445 | EnvVar_t * Run = EV; |
426 | while( Run->Name ) { | 446 | while( Run->Name ) { |
427 | 447 | ||
428 | if( ( X = getenv( Run->Name ) ) ) { | 448 | if( ( X = getenv( Run->Name ) ) ) { |
429 | Log(( "Env : %s = %s\n", Run->Name, X )); | 449 | Log(( "Env : %s = %s\n", Run->Name, X )); |
430 | 450 | ||
431 | S.sprintf( "%s=%s", Run->Name, X ); | 451 | S.sprintf( "%s=%s", Run->Name, X ); |
432 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); | 452 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); |
433 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = | 453 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = |
434 | strdup( S.latin1() ); | 454 | strdup( S.latin1() ); |
435 | 455 | ||
436 | if( strcmp( Run->Name, "LOGNAME" ) == 0 ) { | 456 | if( strcmp( Run->Name, "LOGNAME" ) == 0 ) { |
437 | CurrentUser.UserName = X; | 457 | CurrentUser.UserName = X; |
438 | } else if( strcmp( Run->Name, "HOME" ) == 0 ) { | 458 | } else if( strcmp( Run->Name, "HOME" ) == 0 ) { |
439 | CurrentUser.HomeDir = X; | 459 | CurrentUser.HomeDir = X; |
440 | } // regulare env var | 460 | } // regulare env var |
441 | } else { | 461 | } else { |
442 | Log(("Could not determine %s\n", Run->Name )); | 462 | Log(("Could not determine %s\n", Run->Name )); |
443 | } | 463 | } |
444 | Run ++; | 464 | Run ++; |
445 | } | 465 | } |
446 | 466 | ||
447 | CurrentUser.Uid = getuid(); | 467 | CurrentUser.Uid = getuid(); |
448 | CurrentUser.Gid = getgid(); | 468 | CurrentUser.Gid = getgid(); |
449 | } | 469 | } |
450 | } | 470 | } |
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 | |||
@@ -1,137 +1,143 @@ | |||
1 | #ifndef __RESOURCES__H | 1 | #ifndef __RESOURCES__H |
2 | #define __RESOURCES__H | 2 | #define __RESOURCES__H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qdict.h> | 5 | #include <qdict.h> |
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include <qlist.h> | 7 | #include <qlist.h> |
8 | #include "netnode.h" | 8 | #include "netnode.h" |
9 | #include "systemfile.h" | 9 | #include "systemfile.h" |
10 | #include "system.h" | 10 | #include "system.h" |
11 | 11 | ||
12 | class QLibrary; | 12 | class QLibrary; |
13 | class QPixmap; | 13 | class QPixmap; |
14 | class ANetNode; | 14 | class ANetNode; |
15 | class ANetNodeInstance; | 15 | class ANetNodeInstance; |
16 | 16 | ||
17 | typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN ); | 17 | typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN ); |
18 | 18 | ||
19 | typedef struct NetNode_S { | 19 | typedef struct NetNode_S { |
20 | ANetNode * NetNode; | 20 | ANetNode * NetNode; |
21 | QLibrary * TheLibrary; | 21 | QLibrary * TheLibrary; |
22 | long NodeCountInLib; | 22 | long NodeCountInLib; |
23 | } NetNode_t; | 23 | } NetNode_t; |
24 | 24 | ||
25 | class CurrentQPEUser { | 25 | class CurrentQPEUser { |
26 | 26 | ||
27 | public : | 27 | public : |
28 | CurrentQPEUser() : UserName(), HomeDir(), EnvList() {} | 28 | CurrentQPEUser() : UserName(), HomeDir(), EnvList() {} |
29 | 29 | ||
30 | inline bool known( void ) | 30 | inline bool known( void ) |
31 | { return ! HomeDir.isEmpty() && ! UserName.isEmpty(); } | 31 | { return ! HomeDir.isEmpty() && ! UserName.isEmpty(); } |
32 | 32 | ||
33 | QString UserName; | 33 | QString UserName; |
34 | QString HomeDir; | 34 | QString HomeDir; |
35 | int Uid; | 35 | int Uid; |
36 | int Gid; | 36 | int Gid; |
37 | QArray<char *> EnvList; | 37 | QArray<char *> EnvList; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | typedef QDict<NetNode_t> Name2NetNode_t; | 40 | typedef QDict<NetNode_t> Name2NetNode_t; |
41 | typedef QDict<ANetNodeInstance > Name2Instance_t; | 41 | typedef QDict<ANetNodeInstance > Name2Instance_t; |
42 | typedef QDict<NodeCollection> Name2Connection_t; | 42 | typedef QDict<NodeCollection> Name2Connection_t; |
43 | typedef QDict<SystemFile> Name2SystemFile_t; | 43 | typedef QDict<SystemFile> Name2SystemFile_t; |
44 | 44 | ||
45 | class TheNSResources { | 45 | class TheNSResources { |
46 | 46 | ||
47 | public : | 47 | public : |
48 | 48 | ||
49 | TheNSResources( void ); | 49 | TheNSResources( void ); |
50 | ~TheNSResources( ); | 50 | ~TheNSResources( ); |
51 | 51 | ||
52 | // give busy feedback | 52 | // give busy feedback |
53 | void busy( bool B ); | 53 | void busy( bool B ); |
54 | 54 | ||
55 | System & system() | 55 | System & system() |
56 | { return *TheSystem; } | 56 | { return *TheSystem; } |
57 | 57 | ||
58 | int assignConnectionNumber(void); | 58 | int assignConnectionNumber(void); |
59 | QPixmap getPixmap( const QString & Name ); | 59 | QPixmap getPixmap( const QString & Name ); |
60 | 60 | ||
61 | Name2NetNode_t & netNodes( void ) | 61 | Name2NetNode_t & netNodes( void ) |
62 | { return AllNodeTypes; } | 62 | { return AllNodeTypes; } |
63 | bool netNodeExists( const QString & X ) | 63 | bool netNodeExists( const QString & X ) |
64 | { return AllNodeTypes.find(X)!=0; } | 64 | { return AllNodeTypes.find(X)!=0; } |
65 | ANetNode * findNetNode( const QString & N ) | 65 | ANetNode * findNetNode( const QString & N ) |
66 | { NetNode_t * NNT = AllNodeTypes.find(N); | 66 | { NetNode_t * NNT = AllNodeTypes.find(N); |
67 | return (NNT) ? NNT->NetNode : 0; | 67 | return (NNT) ? NNT->NetNode : 0; |
68 | } | 68 | } |
69 | 69 | ||
70 | // define new plugin (=node) | ||
71 | void addNodeType( const QString & ID, | ||
72 | const QString & LongName, | ||
73 | const QString & Description ); | ||
74 | |||
70 | Name2SystemFile_t & systemFiles( void ) | 75 | Name2SystemFile_t & systemFiles( void ) |
71 | { return SystemFiles; } | 76 | { return SystemFiles; } |
72 | void addSystemFile( const QString & ID, | 77 | void addSystemFile( const QString & ID, |
73 | const QString & P, | 78 | const QString & P, |
74 | bool KDI ); | 79 | bool KDI ); |
75 | 80 | ||
76 | ANetNodeInstance * createNodeInstance( const QString & S ) | 81 | ANetNodeInstance * createNodeInstance( const QString & S ) |
77 | { ANetNodeInstance * NNI = 0; | 82 | { ANetNodeInstance * NNI = 0; |
78 | NetNode_t * NNT = AllNodeTypes[S]; | 83 | NetNode_t * NNT = AllNodeTypes[S]; |
79 | if( ! NNT ) { | 84 | if( ! NNT ) { |
80 | return 0; | 85 | return 0; |
81 | } | 86 | } |
82 | NNI = NNT->NetNode->createInstance(); | 87 | NNI = NNT->NetNode->createInstance(); |
83 | NNI->initialize(); | 88 | NNI->initialize(); |
84 | return NNI; | 89 | return NNI; |
85 | } | 90 | } |
86 | 91 | ||
87 | Name2Instance_t & netNodeInstances( void ) | 92 | Name2Instance_t & netNodeInstances( void ) |
88 | { return AllNodes; } | 93 | { return AllNodes; } |
89 | void addNodeInstance( ANetNodeInstance * I ) | 94 | void addNodeInstance( ANetNodeInstance * I ) |
90 | { AllNodes.insert( I->name(), I ); } | 95 | { AllNodes.insert( I->name(), I ); } |
91 | void removeNodeInstance( const QString & N ) | 96 | void removeNodeInstance( const QString & N ) |
92 | { AllNodes.remove( N );} | 97 | { AllNodes.remove( N );} |
93 | ANetNodeInstance * findNodeInstance( const QString & S ) | 98 | ANetNodeInstance * findNodeInstance( const QString & S ) |
94 | { return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; } | 99 | { return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; } |
95 | 100 | ||
96 | const QString & netNode2Name( const char * Type ); | 101 | const QString & netNode2Name( const char * Type ); |
97 | const QString & netNode2Description( const char * Type ); | 102 | const QString & netNode2Description( const char * Type ); |
98 | 103 | ||
99 | void addConnection( NodeCollection * NC ); | 104 | void addConnection( NodeCollection * NC ); |
100 | void removeConnection( const QString & N ); | 105 | void removeConnection( const QString & N ); |
101 | NodeCollection * findConnection( const QString & N ); | 106 | NodeCollection * findConnection( const QString & N ); |
107 | NodeCollection * getConnection( int nr ); | ||
102 | Name2Connection_t & connections( void ) | 108 | Name2Connection_t & connections( void ) |
103 | { return ConnectionsMap; } | 109 | { return ConnectionsMap; } |
104 | 110 | ||
105 | inline bool userKnown( void ) | 111 | inline bool userKnown( void ) |
106 | { return CurrentUser.known(); } | 112 | { return CurrentUser.known(); } |
107 | CurrentQPEUser & currentUser( void ) | 113 | CurrentQPEUser & currentUser( void ) |
108 | { return CurrentUser; } | 114 | { return CurrentUser; } |
109 | 115 | ||
110 | private : | 116 | private : |
111 | 117 | ||
112 | void detectCurrentUser( void ); | 118 | void detectCurrentUser( void ); |
113 | QString tr( const char * path ); | 119 | QString tr( const char * path ); |
114 | void findAvailableNetNodes( const QString &path ); | 120 | void findAvailableNetNodes( const QString &path ); |
115 | bool loadNetNode( | 121 | bool loadNetNode( |
116 | const QString &pluginFileName, | 122 | const QString &pluginFileName, |
117 | const QString &resolveString = "create_plugin"); | 123 | const QString &resolveString = "create_plugin"); |
118 | 124 | ||
119 | QMap< QString, QString> NodeTypeNameMap; | 125 | QMap< QString, QString> NodeTypeNameMap; |
120 | QMap< QString, QString> NodeTypeDescriptionMap; | 126 | QMap< QString, QString> NodeTypeDescriptionMap; |
121 | Name2Connection_t ConnectionsMap; | 127 | Name2Connection_t ConnectionsMap; |
122 | System * TheSystem; | 128 | System * TheSystem; |
123 | Name2SystemFile_t SystemFiles; | 129 | Name2SystemFile_t SystemFiles; |
124 | 130 | ||
125 | // all node type classes | 131 | // all node type classes |
126 | Name2NetNode_t AllNodeTypes; | 132 | Name2NetNode_t AllNodeTypes; |
127 | 133 | ||
128 | // all nodes | 134 | // all nodes |
129 | Name2Instance_t AllNodes; | 135 | Name2Instance_t AllNodes; |
130 | 136 | ||
131 | CurrentQPEUser CurrentUser; | 137 | CurrentQPEUser CurrentUser; |
132 | }; | 138 | }; |
133 | 139 | ||
134 | extern TheNSResources * _NSResources; | 140 | extern TheNSResources * _NSResources; |
135 | #define NSResources _NSResources | 141 | #define NSResources _NSResources |
136 | 142 | ||
137 | #endif | 143 | #endif |
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 | |||
@@ -1,433 +1,573 @@ | |||
1 | #include <sys/types.h> | 1 | #include <sys/types.h> |
2 | #include <sys/wait.h> | 2 | #include <sys/wait.h> |
3 | 3 | ||
4 | #include <net/if.h> | 4 | #include <net/if.h> |
5 | #include <net/if_arp.h> | 5 | #include <net/if_arp.h> |
6 | #include <netinet/in.h> | 6 | #include <netinet/in.h> |
7 | #include <arpa/inet.h> | 7 | #include <arpa/inet.h> |
8 | #include <sys/ioctl.h> | 8 | #include <sys/ioctl.h> |
9 | #include <sys/socket.h> | 9 | #include <sys/socket.h> |
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | #include <stdio.h> | 11 | #include <stdio.h> |
12 | #include <fcntl.h> | 12 | #include <fcntl.h> |
13 | #include <errno.h> | 13 | #include <errno.h> |
14 | #include <unistd.h> | 14 | #include <unistd.h> |
15 | 15 | ||
16 | #include <opie2/oprocess.h> | ||
17 | |||
16 | #include <qdir.h> | 18 | #include <qdir.h> |
17 | #include <qregexp.h> | 19 | #include <qregexp.h> |
18 | #include <qstringlist.h> | 20 | #include <qstringlist.h> |
19 | #include <qfile.h> | 21 | #include <qfile.h> |
20 | #include <qtextstream.h> | 22 | #include <qtextstream.h> |
21 | #include <qapplication.h> | 23 | #include <qapplication.h> |
22 | 24 | ||
23 | #include "resources.h" | 25 | #include "resources.h" |
24 | #include "system.h" | 26 | #include "system.h" |
25 | 27 | ||
26 | #define PROCNETDEV "/proc/net/dev" | 28 | #define PROCNETDEV "/proc/net/dev" |
27 | 29 | ||
28 | #ifndef ARPHRD_IEEE80211 | 30 | #ifndef ARPHRD_IEEE80211 |
29 | #define ARPHRD_IEEE80211 801 | 31 | #define ARPHRD_IEEE80211 801 |
30 | #endif | 32 | #endif |
31 | 33 | ||
32 | static char Dig2Hex[] = { | 34 | static char Dig2Hex[] = { |
33 | '0', '1', '2', '3', | 35 | '0', '1', '2', '3', |
34 | '4', '5', '6', '7', | 36 | '4', '5', '6', '7', |
35 | '8', '9', 'A', 'B', | 37 | '8', '9', 'A', 'B', |
36 | 'C', 'D', 'E', 'F' | 38 | 'C', 'D', 'E', 'F' |
37 | }; | 39 | }; |
38 | 40 | ||
39 | // get HIGH nibble of byte | 41 | // get HIGH nibble of byte |
40 | #define HN(x) Dig2Hex[(((x)&0xf0)>>4)] | 42 | #define HN(x) Dig2Hex[(((x)&0xf0)>>4)] |
41 | // get LOW nibble of byte | 43 | // get LOW nibble of byte |
42 | #define LN(x) Dig2Hex[((x)&0x0f)] | 44 | #define LN(x) Dig2Hex[((x)&0x0f)] |
43 | 45 | ||
44 | System::System( void ) : QObject(), ProbedInterfaces() { | 46 | System::System( void ) : QObject(), ProbedInterfaces() { |
45 | probeInterfaces(); | 47 | probeInterfaces(); |
46 | } | 48 | } |
47 | 49 | ||
48 | System::~System( void ) { | 50 | System::~System( void ) { |
49 | if( ProcDevNet ) | 51 | if( ProcDevNet ) |
50 | delete ProcDevNet; | 52 | delete ProcDevNet; |
51 | } | 53 | } |
52 | 54 | ||
53 | int System::runAsRoot( const QString & S ) { | 55 | int System::runAsRoot( QStringList & S ) { |
54 | QString MyS = S; | ||
55 | char * usr = getenv("USER"); | 56 | char * usr = getenv("USER"); |
56 | char ch; | ||
57 | 57 | ||
58 | if( S.isEmpty() ) { | 58 | if( S.count() == 0 ) { |
59 | // loophole to start shell | 59 | // loophole to start shell |
60 | return 8888; | 60 | return 8888; |
61 | } | 61 | } |
62 | if( usr == 0 || strcmp( usr, "root" ) ) { | 62 | if( usr == 0 || strcmp( usr, "root" ) ) { |
63 | // unknown or non-root user -> use SUDO | 63 | // unknown or non-root user -> use SUDO |
64 | MyS.prepend( "sudo " ); | 64 | S.prepend( "sudo" ); |
65 | } | 65 | } |
66 | 66 | ||
67 | Log(("Executing %s\n", MyS.latin1() )); | 67 | if( getenv( "NS2TESTMODE" ) ) { |
68 | 68 | owarn << "TESTMODE !!! execute " | |
69 | emit lineFromCommand( tr("Command : ") + MyS ); | 69 | << S.join( " ") |
70 | emit lineFromCommand( "---------------" ); | 70 | << oendl; |
71 | Log(( "Command : %s\n", MyS.latin1() ) ); | 71 | } else { |
72 | MyS += " 2>&1 "; | 72 | MyProcess * P = new MyProcess(); |
73 | OutputOfCmd = popen( MyS.latin1(), "r" ) ; | 73 | emit processEvent( tr("Command : ") + S.join( " " ) ); |
74 | if( ! OutputOfCmd ) { | 74 | |
75 | // cannot fork | 75 | P->process() << S; |
76 | return 1; | 76 | |
77 | connect( P, | ||
78 | SIGNAL( stdoutLine( const QString & ) ), | ||
79 | this, | ||
80 | SIGNAL( stdoutLine( const QString & ) ) ); | ||
81 | |||
82 | connect( P, | ||
83 | SIGNAL( stderrLine( const QString & ) ), | ||
84 | this, | ||
85 | SIGNAL( stderrLine( const QString & ) ) ); | ||
86 | |||
87 | connect( P, | ||
88 | SIGNAL(processExited(MyProcess*) ), | ||
89 | this, SLOT | ||
90 | (SLOT_ProcessExited(MyProcess*) ) ); | ||
91 | |||
92 | Log(("Executing %s\n", S.join( " " ).latin1() )); | ||
93 | |||
94 | if( ! P->process().start( OProcess::DontCare, | ||
95 | OProcess::AllOutput ) ) { | ||
96 | owarn << "Error starting " << S << oendl; | ||
97 | delete P; | ||
98 | // error starting app | ||
99 | return 1; | ||
100 | } | ||
101 | owarn << "Started " << S << oendl; | ||
77 | } | 102 | } |
78 | 103 | ||
79 | // read all data | 104 | // all is fine |
80 | QString Line = ""; | 105 | return 0; |
81 | while( 1 ) { | 106 | } |
82 | if( fread( &ch, 1, 1, OutputOfCmd ) < 1 ) | 107 | |
83 | // eof | 108 | int System::execAsUser( QStringList & SL ) { |
84 | break; | 109 | MyProcess * P = new MyProcess(); |
85 | if( ch == '\n' || ch == '\r' ) { | 110 | CurrentQPEUser CU = NSResources->currentUser(); |
86 | if( ! Line.isEmpty() ) { | 111 | char * usr = getenv("USER"); |
87 | Log(( "read cmd output : **%s**\n", Line.latin1() ) ); | 112 | |
88 | emit lineFromCommand( Line ); | 113 | if( strcmp( usr, "root" ) == 0 ) { |
89 | Line = ""; | 114 | // find user running qpe |
90 | qApp->processEvents(); | 115 | if( CU.UserName.isEmpty() ) { |
116 | // if we come here, the exec was not successfull | ||
117 | Log(("User not known \n" )); | ||
118 | return 0; | ||
91 | } | 119 | } |
92 | } else { | ||
93 | Line += ch; | ||
94 | } | 120 | } |
95 | } | ||
96 | 121 | ||
97 | if( ! Line.isEmpty() ) { | 122 | // now we are ready to exec the requested command |
98 | emit lineFromCommand( Line ); | 123 | setuid( CU.Uid ); |
99 | Log(( "read cmd output : **%s**\n", Line.latin1() ) ); | 124 | setgid( CU.Gid ); |
100 | } | ||
101 | Log(( "End of command\n", Line.latin1() ) ); | ||
102 | 125 | ||
103 | if( pclose( OutputOfCmd ) < 0 ) { | 126 | for( unsigned int i = 0 ; i < CU.EnvList.count() ; i ++ ) { |
104 | // error in command | 127 | QString X; |
105 | return 3; | 128 | QStringList SL; |
106 | } | 129 | X = CU.EnvList[i]; |
130 | SL = QStringList::split( "=", X ); | ||
131 | P->process().setEnvironment( SL[0], SL[1] ); | ||
132 | } | ||
107 | 133 | ||
108 | // all is fine | 134 | P->process() << SL; |
109 | return 0; | 135 | |
136 | emit processEvent( tr("Command : ") + SL.join( " " ) ); | ||
137 | |||
138 | Log(("Executing as user %s : %s\n", | ||
139 | CU.UserName.latin1(), | ||
140 | SL.join( " " ).latin1() )); | ||
141 | |||
142 | int rv = ( P->process().start( OProcess::DontCare, | ||
143 | OProcess::NoCommunication ) ); | ||
144 | delete P; | ||
145 | |||
146 | if( rv ) { | ||
147 | // if we come here, the exec was not successfull | ||
148 | Log(("Could not exec : %d\n", errno )); | ||
149 | } | ||
150 | |||
151 | return rv; | ||
152 | } | ||
153 | |||
154 | void System::SLOT_ProcessExited( MyProcess * P ) { | ||
155 | QString R; | ||
156 | |||
157 | for( QValueListConstIterator<QCString> it = P->process().args().begin(); | ||
158 | it != P->process().args().end(); | ||
159 | ++it ) { | ||
160 | R += (*it); | ||
161 | R += " "; | ||
162 | } | ||
163 | |||
164 | R += "Returned with " + QString().setNum( P->process().exitStatus() ); | ||
165 | emit processEvent( R ); | ||
166 | delete P; | ||
110 | } | 167 | } |
111 | 168 | ||
112 | void System::refreshStatistics( InterfaceInfo & I ) { | 169 | void System::refreshStatistics( InterfaceInfo & I ) { |
113 | if( ! ProcDevNet ) { | 170 | if( ! ProcDevNet ) { |
114 | return; | 171 | return; |
115 | } | 172 | } |
116 | // cannot seek on dev | 173 | // cannot seek on dev |
117 | ProcDevNet->close(); | 174 | ProcDevNet->close(); |
118 | ProcDevNet->open( IO_ReadOnly ); | 175 | ProcDevNet->open( IO_ReadOnly ); |
119 | 176 | ||
120 | QString line; | 177 | QString line; |
121 | QTextStream procTs(ProcDevNet); | 178 | QTextStream procTs(ProcDevNet); |
122 | QStringList SL; | 179 | QStringList SL; |
123 | int loc = -1; | 180 | int loc = -1; |
124 | int version; | 181 | int version; |
125 | 182 | ||
126 | procTs.readLine(); | 183 | procTs.readLine(); |
127 | line = procTs.readLine(); | 184 | line = procTs.readLine(); |
128 | // get version | 185 | // get version |
129 | if( line.find("compressed") ) | 186 | if( line.find("compressed") ) |
130 | version = 3; | 187 | version = 3; |
131 | else if( line.find( "bytes" ) ) | 188 | else if( line.find( "bytes" ) ) |
132 | version = 2; | 189 | version = 2; |
133 | else | 190 | else |
134 | version = 1; | 191 | version = 1; |
135 | while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { | 192 | while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { |
136 | if( (loc = line.find(":") ) == -1) { | 193 | if( (loc = line.find(":") ) == -1) { |
137 | continue; | 194 | continue; |
138 | } | 195 | } |
139 | 196 | ||
140 | if( I.Name != line.left(loc) ) | 197 | if( I.Name != line.left(loc) ) |
141 | continue; | 198 | continue; |
142 | 199 | ||
143 | // tokenize | 200 | // tokenize |
144 | SL = QStringList::split( ' ', line, FALSE ); | 201 | SL = QStringList::split( ' ', line, FALSE ); |
145 | 202 | ||
146 | // update data | 203 | // update data |
147 | switch( version ) { | 204 | switch( version ) { |
148 | case 1 : | 205 | case 1 : |
149 | I.RcvBytes = SL[1]; | 206 | I.RcvBytes = SL[1]; |
150 | I.RcvErrors = SL[3]; | 207 | I.RcvErrors = SL[3]; |
151 | I.RcvDropped = SL[4]; | 208 | I.RcvDropped = SL[4]; |
152 | I.SndBytes = SL[6]; | 209 | I.SndBytes = SL[6]; |
153 | I.SndErrors = SL[8]; | 210 | I.SndErrors = SL[8]; |
154 | I.SndDropped = SL[9]; | 211 | I.SndDropped = SL[9]; |
155 | I.Collisions = SL[11]; | 212 | I.Collisions = SL[11]; |
156 | break; | 213 | break; |
157 | case 2 : | 214 | case 2 : |
158 | I.RcvBytes = SL[1]; | 215 | I.RcvBytes = SL[1]; |
159 | I.RcvErrors = SL[3]; | 216 | I.RcvErrors = SL[3]; |
160 | I.RcvDropped = SL[4]; | 217 | I.RcvDropped = SL[4]; |
161 | I.SndBytes = SL[7]; | 218 | I.SndBytes = SL[7]; |
162 | I.SndErrors = SL[9]; | 219 | I.SndErrors = SL[9]; |
163 | I.SndDropped = SL[10]; | 220 | I.SndDropped = SL[10]; |
164 | I.Collisions = SL[12]; | 221 | I.Collisions = SL[12]; |
165 | break; | 222 | break; |
166 | case 3 : | 223 | case 3 : |
167 | I.RcvBytes = SL[1]; | 224 | I.RcvBytes = SL[1]; |
168 | I.RcvErrors = SL[3]; | 225 | I.RcvErrors = SL[3]; |
169 | I.RcvDropped = SL[4]; | 226 | I.RcvDropped = SL[4]; |
170 | I.SndBytes = SL[9]; | 227 | I.SndBytes = SL[9]; |
171 | I.SndErrors = SL[11]; | 228 | I.SndErrors = SL[11]; |
172 | I.SndDropped = SL[12]; | 229 | I.SndDropped = SL[12]; |
173 | I.Collisions = SL[14]; | 230 | I.Collisions = SL[14]; |
174 | break; | 231 | break; |
175 | } | 232 | } |
176 | break; | 233 | break; |
177 | } | 234 | } |
178 | } | 235 | } |
179 | 236 | ||
180 | // | 237 | // |
181 | // THIS UPDATES THE LIST -> INTERFACES ARE NOT DELETED BUT | 238 | // THIS UPDATES THE LIST -> INTERFACES ARE NOT DELETED BUT |
182 | // FLAGGED AS ! 'IsUp' IF NO LONGER PRESENT | 239 | // FLAGGED AS ! 'IsUp' IF NO LONGER PRESENT |
183 | // | 240 | // |
184 | 241 | ||
185 | void System::probeInterfaces( void ) { | 242 | void System::probeInterfaces( void ) { |
186 | 243 | ||
187 | // probe interfaces | 244 | // probe interfaces |
188 | int sockfd; | 245 | int sockfd; |
189 | // get list of all interfaces | 246 | // get list of all interfaces |
190 | struct ifreq ifrs; | 247 | struct ifreq ifrs; |
191 | InterfaceInfo * IFI; | 248 | InterfaceInfo * IFI; |
192 | 249 | ||
193 | // flag all as 'down' | 250 | // flag all as 'down' |
194 | for( QDictIterator<InterfaceInfo> it( ProbedInterfaces ); | 251 | for( QDictIterator<InterfaceInfo> it( ProbedInterfaces ); |
195 | it.current(); | 252 | it.current(); |
196 | ++it ) { | 253 | ++it ) { |
197 | it.current()->IsUp = 0; | 254 | it.current()->IsUp = 0; |
198 | } | 255 | } |
199 | 256 | ||
200 | sockfd = socket(PF_INET, SOCK_DGRAM, 0); | 257 | sockfd = socket(PF_INET, SOCK_DGRAM, 0); |
201 | if(sockfd == -1) | 258 | if(sockfd == -1) { |
259 | owarn << "Cannot open INET socket " | ||
260 | << errno | ||
261 | << " " | ||
262 | << strerror( errno ) | ||
263 | << oendl; | ||
202 | return; | 264 | return; |
265 | } | ||
203 | 266 | ||
204 | // read interfaces from /proc/dev/net | 267 | // read interfaces from /proc/dev/net |
205 | // SIOCGIFCONF does not return ALL interfaces ???!? | 268 | // SIOCGIFCONF does not return ALL interfaces ???!? |
206 | ProcDevNet = new QFile(PROCNETDEV); | 269 | ProcDevNet = new QFile(PROCNETDEV); |
207 | if( ! ProcDevNet->open(IO_ReadOnly) ) { | 270 | if( ! ProcDevNet->open(IO_ReadOnly) ) { |
271 | owarn << "Cannot open " | ||
272 | << PROCNETDEV | ||
273 | << " " | ||
274 | << errno | ||
275 | << " " | ||
276 | << strerror( errno ) | ||
277 | << oendl; | ||
208 | delete ProcDevNet; | 278 | delete ProcDevNet; |
209 | ProcDevNet =0; | 279 | ProcDevNet =0; |
280 | ::close( sockfd ); | ||
210 | return; | 281 | return; |
211 | } | 282 | } |
212 | 283 | ||
213 | QString line; | 284 | QString line; |
214 | QString NicName; | 285 | QString NicName; |
215 | QTextStream procTs(ProcDevNet); | 286 | QTextStream procTs(ProcDevNet); |
216 | int loc = -1; | 287 | int loc = -1; |
217 | 288 | ||
218 | procTs.readLine(); // eat a line | 289 | procTs.readLine(); // eat a line |
219 | procTs.readLine(); // eat a line | 290 | procTs.readLine(); // eat a line |
220 | while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { | 291 | while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { |
221 | if((loc = line.find(":")) == -1) { | 292 | if((loc = line.find(":")) == -1) { |
222 | continue; | 293 | continue; |
223 | } | 294 | } |
224 | 295 | ||
225 | NicName = line.left(loc); | 296 | NicName = line.left(loc); |
226 | 297 | ||
227 | // set name for ioctl | 298 | // set name for ioctl |
228 | strcpy( ifrs.ifr_name, NicName.latin1() ); | 299 | strcpy( ifrs.ifr_name, NicName.latin1() ); |
229 | 300 | ||
230 | if ( ! ( IFI = ProbedInterfaces.find( NicName ) ) ) { | 301 | if ( ! ( IFI = ProbedInterfaces.find( NicName ) ) ) { |
231 | // new nic | 302 | // new nic |
232 | Log(("NEWNIC %s\n", NicName.latin1())); | 303 | Log(("New NIC found : %s\n", NicName.latin1())); |
233 | IFI = new InterfaceInfo; | 304 | IFI = new InterfaceInfo; |
234 | IFI->Name = line.left(loc); | 305 | IFI->Name = line.left(loc); |
235 | IFI->NetNode = 0; | 306 | IFI->Collection = 0; |
236 | ProbedInterfaces.insert( IFI->Name, IFI ); | 307 | ProbedInterfaces.insert( IFI->Name, IFI ); |
237 | 308 | ||
238 | // get dynamic info | 309 | // get dynamic info |
239 | if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) { | 310 | if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) { |
240 | IFI->IsPointToPoint = ((ifrs.ifr_flags & IFF_POINTOPOINT) == IFF_POINTOPOINT); | 311 | IFI->IsPointToPoint = ((ifrs.ifr_flags & IFF_POINTOPOINT) == IFF_POINTOPOINT); |
241 | } else { | 312 | } else { |
242 | IFI->IsPointToPoint = 0; | 313 | IFI->IsPointToPoint = 0; |
243 | } | 314 | } |
244 | 315 | ||
245 | // settings that never change | 316 | // settings that never change |
246 | IFI->DstAddress = ""; | 317 | IFI->DstAddress = ""; |
247 | 318 | ||
248 | if( IFI->IsPointToPoint ) { | 319 | if( IFI->IsPointToPoint ) { |
249 | if( ioctl(sockfd, SIOCGIFDSTADDR, &ifrs) >= 0 ) { | 320 | if( ioctl(sockfd, SIOCGIFDSTADDR, &ifrs) >= 0 ) { |
250 | IFI->DstAddress = | 321 | IFI->DstAddress = |
251 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_dstaddr)->sin_addr); | 322 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_dstaddr)->sin_addr); |
252 | } | 323 | } |
253 | } | 324 | } |
254 | 325 | ||
255 | IFI->CardType = 999999; | 326 | IFI->CardType = 999999; |
256 | IFI->MACAddress = ""; | 327 | IFI->MACAddress = ""; |
257 | 328 | ||
258 | if( ioctl(sockfd, SIOCGIFHWADDR, &ifrs) >= 0 ) { | 329 | if( ioctl(sockfd, SIOCGIFHWADDR, &ifrs) >= 0 ) { |
259 | Log(("%s = %d\n", IFI->Name.latin1(), | 330 | Log(("Family for NIC %s : %d\n", IFI->Name.latin1(), |
260 | ifrs.ifr_hwaddr.sa_family )); | 331 | ifrs.ifr_hwaddr.sa_family )); |
261 | 332 | ||
262 | IFI->CardType = ifrs.ifr_hwaddr.sa_family; | 333 | IFI->CardType = ifrs.ifr_hwaddr.sa_family; |
263 | switch( ifrs.ifr_hwaddr.sa_family ) { | 334 | switch( ifrs.ifr_hwaddr.sa_family ) { |
264 | case ARPHRD_ETHER : // regular MAC address | 335 | case ARPHRD_ETHER : // regular MAC address |
265 | // valid address -> convert to regular ::: format | 336 | // valid address -> convert to regular ::: format |
266 | // length = 6 bytes = 12 DIGITS -> 6 : | 337 | // length = 6 bytes = 12 DIGITS -> 6 : |
267 | IFI->MACAddress.sprintf( | 338 | IFI->MACAddress.sprintf( |
268 | "%c%c:%c%c:%c%c:%c%c:%c%c:%c%c", | 339 | "%c%c:%c%c:%c%c:%c%c:%c%c:%c%c", |
269 | HN( ifrs.ifr_hwaddr.sa_data[0] ), | 340 | HN( ifrs.ifr_hwaddr.sa_data[0] ), |
270 | LN( ifrs.ifr_hwaddr.sa_data[0] ), | 341 | LN( ifrs.ifr_hwaddr.sa_data[0] ), |
271 | HN( ifrs.ifr_hwaddr.sa_data[1] ), | 342 | HN( ifrs.ifr_hwaddr.sa_data[1] ), |
272 | LN( ifrs.ifr_hwaddr.sa_data[1] ), | 343 | LN( ifrs.ifr_hwaddr.sa_data[1] ), |
273 | HN( ifrs.ifr_hwaddr.sa_data[2] ), | 344 | HN( ifrs.ifr_hwaddr.sa_data[2] ), |
274 | LN( ifrs.ifr_hwaddr.sa_data[2] ), | 345 | LN( ifrs.ifr_hwaddr.sa_data[2] ), |
275 | HN( ifrs.ifr_hwaddr.sa_data[3] ), | 346 | HN( ifrs.ifr_hwaddr.sa_data[3] ), |
276 | LN( ifrs.ifr_hwaddr.sa_data[3] ), | 347 | LN( ifrs.ifr_hwaddr.sa_data[3] ), |
277 | HN( ifrs.ifr_hwaddr.sa_data[4] ), | 348 | HN( ifrs.ifr_hwaddr.sa_data[4] ), |
278 | LN( ifrs.ifr_hwaddr.sa_data[4] ), | 349 | LN( ifrs.ifr_hwaddr.sa_data[4] ), |
279 | HN( ifrs.ifr_hwaddr.sa_data[5] ), | 350 | HN( ifrs.ifr_hwaddr.sa_data[5] ), |
280 | LN( ifrs.ifr_hwaddr.sa_data[5] ) | 351 | LN( ifrs.ifr_hwaddr.sa_data[5] ) |
281 | ); | 352 | ); |
282 | break; | 353 | break; |
283 | #ifdef ARPHRD_IEEE1394 | 354 | #ifdef ARPHRD_IEEE1394 |
284 | case ARPHRD_IEEE1394 : // Firewire Eth address | 355 | case ARPHRD_IEEE1394 : // Firewire Eth address |
285 | IFI->MACAddress.sprintf( | 356 | IFI->MACAddress.sprintf( |
286 | "%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-00-00", | 357 | "%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-00-00", |
287 | HN( ifrs.ifr_hwaddr.sa_data[0] ), | 358 | HN( ifrs.ifr_hwaddr.sa_data[0] ), |
288 | LN( ifrs.ifr_hwaddr.sa_data[0] ), | 359 | LN( ifrs.ifr_hwaddr.sa_data[0] ), |
289 | HN( ifrs.ifr_hwaddr.sa_data[1] ), | 360 | HN( ifrs.ifr_hwaddr.sa_data[1] ), |
290 | LN( ifrs.ifr_hwaddr.sa_data[1] ), | 361 | LN( ifrs.ifr_hwaddr.sa_data[1] ), |
291 | HN( ifrs.ifr_hwaddr.sa_data[2] ), | 362 | HN( ifrs.ifr_hwaddr.sa_data[2] ), |
292 | LN( ifrs.ifr_hwaddr.sa_data[2] ), | 363 | LN( ifrs.ifr_hwaddr.sa_data[2] ), |
293 | HN( ifrs.ifr_hwaddr.sa_data[3] ), | 364 | HN( ifrs.ifr_hwaddr.sa_data[3] ), |
294 | LN( ifrs.ifr_hwaddr.sa_data[3] ), | 365 | LN( ifrs.ifr_hwaddr.sa_data[3] ), |
295 | HN( ifrs.ifr_hwaddr.sa_data[4] ), | 366 | HN( ifrs.ifr_hwaddr.sa_data[4] ), |
296 | LN( ifrs.ifr_hwaddr.sa_data[4] ), | 367 | LN( ifrs.ifr_hwaddr.sa_data[4] ), |
297 | HN( ifrs.ifr_hwaddr.sa_data[5] ), | 368 | HN( ifrs.ifr_hwaddr.sa_data[5] ), |
298 | LN( ifrs.ifr_hwaddr.sa_data[5] ), | 369 | LN( ifrs.ifr_hwaddr.sa_data[5] ), |
299 | HN( ifrs.ifr_hwaddr.sa_data[6] ), | 370 | HN( ifrs.ifr_hwaddr.sa_data[6] ), |
300 | LN( ifrs.ifr_hwaddr.sa_data[6] ), | 371 | LN( ifrs.ifr_hwaddr.sa_data[6] ), |
301 | HN( ifrs.ifr_hwaddr.sa_data[7] ), | 372 | HN( ifrs.ifr_hwaddr.sa_data[7] ), |
302 | LN( ifrs.ifr_hwaddr.sa_data[7] ), | 373 | LN( ifrs.ifr_hwaddr.sa_data[7] ), |
303 | HN( ifrs.ifr_hwaddr.sa_data[8] ), | 374 | HN( ifrs.ifr_hwaddr.sa_data[8] ), |
304 | LN( ifrs.ifr_hwaddr.sa_data[8] ), | 375 | LN( ifrs.ifr_hwaddr.sa_data[8] ), |
305 | HN( ifrs.ifr_hwaddr.sa_data[9] ), | 376 | HN( ifrs.ifr_hwaddr.sa_data[9] ), |
306 | LN( ifrs.ifr_hwaddr.sa_data[9] ), | 377 | LN( ifrs.ifr_hwaddr.sa_data[9] ), |
307 | HN( ifrs.ifr_hwaddr.sa_data[10] ), | 378 | HN( ifrs.ifr_hwaddr.sa_data[10] ), |
308 | LN( ifrs.ifr_hwaddr.sa_data[10] ), | 379 | LN( ifrs.ifr_hwaddr.sa_data[10] ), |
309 | HN( ifrs.ifr_hwaddr.sa_data[11] ), | 380 | HN( ifrs.ifr_hwaddr.sa_data[11] ), |
310 | LN( ifrs.ifr_hwaddr.sa_data[11] ), | 381 | LN( ifrs.ifr_hwaddr.sa_data[11] ), |
311 | HN( ifrs.ifr_hwaddr.sa_data[12] ), | 382 | HN( ifrs.ifr_hwaddr.sa_data[12] ), |
312 | LN( ifrs.ifr_hwaddr.sa_data[12] ), | 383 | LN( ifrs.ifr_hwaddr.sa_data[12] ), |
313 | HN( ifrs.ifr_hwaddr.sa_data[13] ), | 384 | HN( ifrs.ifr_hwaddr.sa_data[13] ), |
314 | LN( ifrs.ifr_hwaddr.sa_data[13] ) | 385 | LN( ifrs.ifr_hwaddr.sa_data[13] ) |
315 | ); | 386 | ); |
316 | break; | 387 | break; |
317 | #endif | 388 | #endif |
318 | case ARPHRD_PPP : // PPP | 389 | case ARPHRD_PPP : // PPP |
319 | break; | 390 | break; |
320 | case ARPHRD_IEEE80211 : // WLAN | 391 | case ARPHRD_IEEE80211 : // WLAN |
321 | break; | 392 | break; |
322 | case ARPHRD_IRDA : // IRDA | 393 | case ARPHRD_IRDA : // IRDA |
323 | break; | 394 | break; |
324 | } | 395 | } |
325 | } | 396 | } |
326 | } else // else already probed before -> just update | 397 | } else // else already probed before -> just update |
327 | Log(("OLDNIC %s\n", NicName.latin1())); | 398 | Log(("Redetected NIC %s\n", NicName.latin1())); |
328 | 399 | ||
329 | // get dynamic info | 400 | // get dynamic info |
330 | if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) { | 401 | if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) { |
331 | IFI->IsUp = ((ifrs.ifr_flags & IFF_UP) == IFF_UP); | 402 | IFI->IsUp = ((ifrs.ifr_flags & IFF_UP) == IFF_UP); |
332 | IFI->HasMulticast = ((ifrs.ifr_flags & IFF_MULTICAST) == IFF_MULTICAST); | 403 | IFI->HasMulticast = ((ifrs.ifr_flags & IFF_MULTICAST) == IFF_MULTICAST); |
333 | } else { | 404 | } else { |
334 | IFI->IsUp = 0; | 405 | IFI->IsUp = 0; |
335 | IFI->HasMulticast = 0; | 406 | IFI->HasMulticast = 0; |
336 | } | 407 | } |
337 | 408 | ||
338 | if( ioctl(sockfd, SIOCGIFADDR, &ifrs) >= 0 ) { | 409 | if( ioctl(sockfd, SIOCGIFADDR, &ifrs) >= 0 ) { |
339 | IFI->Address = | 410 | IFI->Address = |
340 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_addr)->sin_addr); | 411 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_addr)->sin_addr); |
341 | } else { | 412 | } else { |
342 | IFI->Address = ""; | 413 | IFI->Address = ""; |
343 | IFI->IsUp = 0; | 414 | IFI->IsUp = 0; |
344 | } | 415 | } |
345 | if( ioctl(sockfd, SIOCGIFBRDADDR, &ifrs) >= 0 ) { | 416 | if( ioctl(sockfd, SIOCGIFBRDADDR, &ifrs) >= 0 ) { |
346 | IFI->BCastAddress = | 417 | IFI->BCastAddress = |
347 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_broadaddr)->sin_addr); | 418 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_broadaddr)->sin_addr); |
348 | } else { | 419 | } else { |
349 | IFI->BCastAddress = ""; | 420 | IFI->BCastAddress = ""; |
350 | } | 421 | } |
351 | if( ioctl(sockfd, SIOCGIFNETMASK, &ifrs) >= 0 ) { | 422 | if( ioctl(sockfd, SIOCGIFNETMASK, &ifrs) >= 0 ) { |
352 | IFI->Netmask = | 423 | IFI->Netmask = |
353 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_netmask)->sin_addr); | 424 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_netmask)->sin_addr); |
354 | } else { | 425 | } else { |
355 | IFI->Netmask = ""; | 426 | IFI->Netmask = ""; |
356 | } | 427 | } |
357 | Log(("NIC %s UP %d\n", NicName.latin1(), IFI->IsUp )); | 428 | Log(("NIC %s UP ? %d\n", NicName.latin1(), IFI->IsUp )); |
358 | } | 429 | } |
359 | } | ||
360 | |||
361 | void System::execAsUser( QString & Cmd, char * argv[] ) { | ||
362 | CurrentQPEUser CU = NSResources->currentUser(); | ||
363 | |||
364 | if( CU.UserName.isEmpty() ) { | ||
365 | // if we come here, the exec was not successfull | ||
366 | Log(("User not known \n" )); | ||
367 | return; | ||
368 | } | ||
369 | 430 | ||
370 | // now we are ready to exec the requested command | 431 | ::close( sockfd ); |
371 | setuid( CU.Uid ); | 432 | } |
372 | setgid( CU.Gid ); | ||
373 | |||
374 | char ** envp = (char **)alloca( sizeof( char *) * | ||
375 | (CU.EnvList.count()+1) ); | ||
376 | 433 | ||
377 | for( unsigned int i = 0 ; i < CU.EnvList.count() ; i ++ ) { | 434 | InterfaceInfo * System::findInterface( const QString & N ) { |
378 | *(envp+i) = CU.EnvList[i]; | 435 | InterfaceInfo * Run; |
436 | // has PAN connection UP interface ? | ||
437 | for( QDictIterator<InterfaceInfo> It(ProbedInterfaces); | ||
438 | It.current(); | ||
439 | ++It ) { | ||
440 | Run = It.current(); | ||
441 | if( N == Run->Name ) { | ||
442 | // this PAN connection is up | ||
443 | return Run; | ||
444 | } | ||
379 | } | 445 | } |
380 | envp[CU.EnvList.count()]=NULL; | 446 | return 0; |
381 | |||
382 | execve( Cmd.latin1(), argv, envp ); | ||
383 | |||
384 | // if we come here, the exec was not successfull | ||
385 | Log(("Could not exec : %d\n", errno )); | ||
386 | } | 447 | } |
387 | 448 | ||
388 | #include <stdarg.h> | 449 | #include <stdarg.h> |
389 | static FILE * logf = 0; | 450 | static FILE * logf = 0; |
390 | 451 | ||
391 | void VLog( char * Format, ... ) { | 452 | void VLog( char * Format, ... ) { |
392 | va_list l; | 453 | va_list l; |
393 | 454 | ||
394 | va_start(l, Format ); | 455 | va_start(l, Format ); |
395 | 456 | ||
396 | if( logf == (FILE *)0 ) { | 457 | if( logf == (FILE *)0 ) { |
397 | if( getenv("NS2STDERR") ) { | 458 | QString S = getenv("NS2LOG"); |
459 | if( S == "stderr" ) { | ||
398 | logf = stderr; | 460 | logf = stderr; |
399 | } else { | 461 | } else if( S.isEmpty() ) { |
400 | logf = fopen( "/tmp/ns2log", "a" ); | 462 | logf = fopen( "/tmp/ns2log", "a" ); |
463 | } else { | ||
464 | logf = fopen( S, "a" ); | ||
401 | } | 465 | } |
466 | |||
402 | if( ! logf ) { | 467 | if( ! logf ) { |
403 | fprintf( stderr, "Cannot open logfile /tmp/ns2log %d\n", | 468 | fprintf( stderr, "Cannot open logfile %s : %d\n", |
404 | errno ); | 469 | S.latin1(), errno ); |
405 | logf = (FILE *)1; | 470 | logf = (FILE *)1; |
406 | } else { | 471 | } else { |
407 | fprintf( logf, "____ OPEN LOGFILE ____\n"); | 472 | fprintf( logf, "____ OPEN LOGFILE ____\n"); |
408 | } | 473 | } |
409 | } | 474 | } |
410 | 475 | ||
411 | if( (long)logf > 1 ) { | 476 | if( (unsigned long)logf > 1 ) { |
412 | vfprintf( logf, Format, l ); | 477 | vfprintf( logf, Format, l ); |
413 | } | 478 | } |
414 | va_end( l ); | 479 | va_end( l ); |
480 | fflush( logf ); | ||
415 | 481 | ||
416 | } | 482 | } |
417 | 483 | ||
418 | void LogClose( void ) { | 484 | void LogClose( void ) { |
419 | if( (long)logf > 1 ) { | 485 | if( (long)logf > 1 ) { |
420 | fprintf( logf, "____ CLOSE LOGFILE ____\n"); | 486 | fprintf( logf, "____ CLOSE LOGFILE ____\n"); |
421 | if( logf != stderr ) { | 487 | if( logf != stderr ) { |
422 | fclose( logf ); | 488 | fclose( logf ); |
423 | } | 489 | } |
424 | logf = 0; | 490 | logf = 0; |
425 | } | 491 | } |
426 | } | 492 | } |
427 | 493 | ||
428 | QString removeSpaces( const QString & X ) { | 494 | QString removeSpaces( const QString & X ) { |
429 | QStringList SL; | 495 | QString Y; |
496 | Y = X.simplifyWhiteSpace(); | ||
497 | Y.replace( QRegExp(" "), "_" ); | ||
498 | owarn << X << " **" << Y << "**" << oendl; | ||
499 | return Y; | ||
500 | } | ||
501 | |||
502 | // | ||
503 | // | ||
504 | // | ||
505 | // | ||
506 | // | ||
507 | |||
508 | MyProcess::MyProcess() : QObject(), StdoutBuffer(), StderrBuffer() { | ||
509 | P = new OProcess(); | ||
510 | connect( P, | ||
511 | SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int ) ), | ||
512 | this, | ||
513 | SLOT( SLOT_Stdout(Opie::Core::OProcess*,char*,int) ) ); | ||
514 | |||
515 | connect( P, | ||
516 | SIGNAL( receivedStderr(Opie::Core::OProcess*, char*, int ) ), | ||
517 | this, | ||
518 | SLOT( SLOT_Stderr(Opie::Core::OProcess*,char*,int) ) ); | ||
519 | connect( P, | ||
520 | SIGNAL( processExited(Opie::Core::OProcess*) ), | ||
521 | this, | ||
522 | SLOT( SLOT_ProcessExited(Opie::Core::OProcess*) ) ); | ||
523 | } | ||
524 | |||
525 | MyProcess::~MyProcess() { | ||
526 | delete P; | ||
527 | } | ||
528 | |||
529 | void MyProcess::SLOT_Stdout( Opie::Core::OProcess * , char * Buf, int len ) { | ||
530 | char * LB = (char *)alloca( len + 1 ); | ||
531 | memcpy( LB, Buf, len ); | ||
532 | LB[len] = '\0'; | ||
533 | |||
534 | // now input is zero terminated | ||
535 | StdoutBuffer += LB; | ||
536 | |||
537 | owarn << "Received " << len << " bytes on stdout" << oendl; | ||
538 | // see if we have some lines (allow empty lines) | ||
539 | QStringList SL = QStringList::split( "\n", StdoutBuffer, TRUE ); | ||
540 | |||
541 | for( unsigned int i = 0; i < SL.count()-1; i ++ ) { | ||
542 | Log(( "Stdout : \"%s\"\n", SL[i].latin1() ) ); | ||
543 | emit stdoutLine( SL[i] ); | ||
544 | } | ||
545 | |||
546 | // last line is rest | ||
547 | StdoutBuffer = SL[ SL.count()-1 ]; | ||
548 | } | ||
549 | |||
550 | void MyProcess::SLOT_Stderr( Opie::Core::OProcess * , char * Buf, int len ) { | ||
551 | char * LB = (char *)alloca( len + 1 ); | ||
552 | memcpy( LB, Buf, len ); | ||
553 | LB[len] = '\0'; | ||
554 | |||
555 | // now input is zero terminated | ||
556 | StderrBuffer += LB; | ||
557 | |||
558 | owarn << "Received " << len << " bytes on stderr" << oendl; | ||
559 | // see if we have some lines (allow empty lines) | ||
560 | QStringList SL = QStringList::split( "\n", StderrBuffer, TRUE ); | ||
561 | |||
562 | for( unsigned int i = 0; i < SL.count()-1; i ++ ) { | ||
563 | Log(( "Stderr : \"%s\"\n", SL[i].latin1() ) ); | ||
564 | emit stderrLine( SL[i] ); | ||
565 | } | ||
566 | |||
567 | // last line is rest | ||
568 | StderrBuffer = SL[ SL.count()-1 ]; | ||
569 | } | ||
430 | 570 | ||
431 | SL = QStringList::split( " ", X ); | 571 | void MyProcess::SLOT_ProcessExited( Opie::Core::OProcess * ) { |
432 | return SL.join( "_" ); | 572 | emit processExited( this ); |
433 | } | 573 | } |
diff --git a/noncore/settings/networksettings2/networksettings2/system.h b/noncore/settings/networksettings2/networksettings2/system.h index 33af391..e67d695 100644 --- a/noncore/settings/networksettings2/networksettings2/system.h +++ b/noncore/settings/networksettings2/networksettings2/system.h | |||
@@ -1,90 +1,135 @@ | |||
1 | #ifndef __SYSTEM__H | 1 | #ifndef __SYSTEM__H |
2 | #define __SYSTEM__H | 2 | #define __SYSTEM__H |
3 | 3 | ||
4 | #include <qstring.h> | ||
5 | |||
6 | #include <opie2/oprocess.h> | ||
7 | |||
8 | using namespace Opie::Core; | ||
9 | |||
4 | // for hardware types | 10 | // for hardware types |
5 | #include <net/if_arp.h> | 11 | #include <net/if_arp.h> |
6 | #include <qdict.h> | 12 | #include <qdict.h> |
7 | #include <qobject.h> | 13 | #include <qobject.h> |
8 | #include <stdio.h> | 14 | #include <stdio.h> |
9 | 15 | ||
16 | class NodeCollection; | ||
10 | class ANetNodeInstance; | 17 | class ANetNodeInstance; |
11 | class QFile; | 18 | class QFile; |
12 | 19 | ||
20 | class MyProcess : public QObject { | ||
21 | |||
22 | Q_OBJECT | ||
23 | |||
24 | public : | ||
25 | |||
26 | MyProcess(); | ||
27 | ~MyProcess(); | ||
28 | |||
29 | inline OProcess & process() | ||
30 | { return *P; } | ||
31 | |||
32 | public slots : | ||
33 | |||
34 | void SLOT_Stdout( Opie::Core::OProcess * P, char *, int ); | ||
35 | void SLOT_Stderr( Opie::Core::OProcess * P, char *, int ); | ||
36 | void SLOT_ProcessExited( Opie::Core::OProcess * P); | ||
37 | |||
38 | signals : | ||
39 | |||
40 | void stdoutLine( const QString & ); | ||
41 | void stderrLine( const QString & ); | ||
42 | void processExited( MyProcess * ); | ||
43 | |||
44 | private : | ||
45 | |||
46 | QString StdoutBuffer; | ||
47 | QString StderrBuffer; | ||
48 | OProcess * P; | ||
49 | }; | ||
50 | |||
13 | class InterfaceInfo { | 51 | class InterfaceInfo { |
14 | 52 | ||
15 | public : | 53 | public : |
16 | 54 | ||
17 | InterfaceInfo() : | 55 | InterfaceInfo() : |
18 | Name(), | 56 | Name(), |
19 | MACAddress(), | 57 | MACAddress(), |
20 | BCastAddress(), | 58 | BCastAddress(), |
21 | Netmask(), | 59 | Netmask(), |
22 | DstAddress() { | 60 | DstAddress() { |
23 | } | 61 | } |
24 | 62 | ||
25 | ANetNodeInstance * assignedNode() | 63 | NodeCollection * assignedConnection() |
26 | { return NetNode; } | 64 | { return Collection; } |
27 | 65 | ||
28 | void assignNode( ANetNodeInstance * NNI ) | 66 | void assignConnection( NodeCollection * NNI ) |
29 | { NetNode = NNI; } | 67 | { Collection = NNI; } |
30 | 68 | ||
31 | ANetNodeInstance * NetNode; // netnode taking care of me | 69 | NodeCollection * Collection; // connection taking care of me |
32 | QString Name; // name of interface | 70 | QString Name; // name of interface |
33 | int CardType; // type of card | 71 | int CardType; // type of card |
34 | QString MACAddress; // MAC address | 72 | QString MACAddress; // MAC address |
35 | QString Address; // IP Address | 73 | QString Address; // IP Address |
36 | QString BCastAddress; // Broadcast Address | 74 | QString BCastAddress; // Broadcast Address |
37 | QString Netmask; // Netmask | 75 | QString Netmask; // Netmask |
38 | QString DstAddress; // Peer address (if P-t-P) | 76 | QString DstAddress; // Peer address (if P-t-P) |
39 | bool IsUp; // interface is UP | 77 | bool IsUp; // interface is UP |
40 | bool HasMulticast; // Supports Multicast | 78 | bool HasMulticast; // Supports Multicast |
41 | bool IsPointToPoint; // IsPointToPoint card | 79 | bool IsPointToPoint; // IsPointToPoint card |
42 | 80 | ||
43 | QString RcvBytes; | 81 | QString RcvBytes; |
44 | QString SndBytes; | 82 | QString SndBytes; |
45 | QString RcvErrors; | 83 | QString RcvErrors; |
46 | QString SndErrors; | 84 | QString SndErrors; |
47 | QString RcvDropped; | 85 | QString RcvDropped; |
48 | QString SndDropped; | 86 | QString SndDropped; |
49 | QString Collisions; | 87 | QString Collisions; |
50 | }; | 88 | }; |
51 | 89 | ||
52 | class System : public QObject { | 90 | class System : public QObject { |
53 | 91 | ||
54 | Q_OBJECT | 92 | Q_OBJECT |
55 | 93 | ||
56 | public : | 94 | public : |
57 | 95 | ||
58 | System( void ); | 96 | System( void ); |
59 | ~System( void ); | 97 | ~System( void ); |
60 | 98 | ||
61 | QDict<InterfaceInfo> & interfaces( void ) | 99 | QDict<InterfaceInfo> & interfaces( void ) |
62 | { return ProbedInterfaces; } | 100 | { return ProbedInterfaces; } |
63 | InterfaceInfo * interface( const QString& N ) | 101 | InterfaceInfo * interface( const QString& N ) |
64 | { return ProbedInterfaces[N]; } | 102 | { return ProbedInterfaces[N]; } |
65 | 103 | ||
66 | // exec command as root | 104 | // exec command as root |
67 | int runAsRoot( const QString & S ); | 105 | int runAsRoot( QStringList & S ); |
68 | 106 | ||
69 | // exec command as user | 107 | // exec command as user |
70 | void execAsUser( QString & Cmd, char * argv[] ); | 108 | int execAsUser( QStringList & Cmd ); |
71 | 109 | ||
72 | // refresh stats for this interface | 110 | // refresh stats for this interface |
73 | void refreshStatistics( InterfaceInfo & ); | 111 | void refreshStatistics( InterfaceInfo & ); |
74 | 112 | ||
75 | // reloads interfaces | 113 | // reloads interfaces |
76 | void probeInterfaces( void ); | 114 | void probeInterfaces( void ); |
77 | 115 | ||
116 | InterfaceInfo * findInterface( const QString & DevName ); | ||
117 | |||
118 | private slots : | ||
119 | |||
120 | void SLOT_ProcessExited( MyProcess * ); | ||
121 | |||
78 | signals : | 122 | signals : |
79 | 123 | ||
80 | void lineFromCommand( const QString & S ); | 124 | void stdoutLine( const QString & ); |
125 | void stderrLine( const QString & ); | ||
126 | void processEvent( const QString & ); | ||
81 | 127 | ||
82 | private : | 128 | private : |
83 | 129 | ||
84 | QDict<InterfaceInfo> ProbedInterfaces; | 130 | QDict<InterfaceInfo> ProbedInterfaces; |
85 | FILE * OutputOfCmd; | 131 | FILE * OutputOfCmd; |
86 | QFile * ProcDevNet; | 132 | QFile * ProcDevNet; |
87 | |||
88 | }; | 133 | }; |
89 | 134 | ||
90 | #endif | 135 | #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 | |||
@@ -1,189 +1,235 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qfileinfo.h> | 3 | #include <qfileinfo.h> |
4 | #include <qmessagebox.h> | 4 | #include <qmessagebox.h> |
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | 7 | ||
8 | #include "resources.h" | 8 | #include "resources.h" |
9 | #include "systemfile.h" | 9 | #include "systemfile.h" |
10 | 10 | ||
11 | #define TEMPLATEDIR "networktemplates/" | 11 | #define TEMPLATEDIR "networktemplates/" |
12 | QString TemplDir; | 12 | QString TemplDir; |
13 | 13 | ||
14 | SystemFile::SystemFile( const QString & N, | 14 | SystemFile::SystemFile( const QString & N, |
15 | const QString & P, | 15 | const QString & P, |
16 | bool KDI ){ | 16 | bool KDI ){ |
17 | Name = N; | 17 | Name = N; |
18 | Path = P; | 18 | Path = P; |
19 | InAppend = 0; | ||
19 | F = 0; | 20 | F = 0; |
20 | // get template info | 21 | // get template info |
21 | { QString S; | 22 | { QString S; |
22 | QFileInfo FI; | 23 | QFileInfo FI; |
23 | 24 | ||
24 | // find location of templates | 25 | // find location of templates |
25 | TemplDir = QPEApplication::qpeDir() + "etc/" + TEMPLATEDIR; | 26 | TemplDir = QPEApplication::qpeDir() + "etc/" + TEMPLATEDIR; |
26 | FI.setFile( TemplDir ); | 27 | FI.setFile( TemplDir ); |
27 | if( ! FI.isDir() ) { | 28 | if( ! FI.isDir() ) { |
28 | // try current dir | 29 | // try current dir |
29 | TemplDir = "./" TEMPLATEDIR; | 30 | TemplDir = "./" TEMPLATEDIR; |
30 | FI.setFile( TemplDir ); | 31 | FI.setFile( TemplDir ); |
31 | if( ! FI.isDir() ) { | 32 | if( ! FI.isDir() ) { |
32 | hasPreSection = | 33 | hasPreSection = |
33 | hasPostSection = | 34 | hasPostSection = |
34 | hasPreNodeSection = | 35 | hasPreNodeSection = |
35 | hasPostNodeSection = | 36 | hasPostNodeSection = |
36 | hasPreDeviceSection = | 37 | hasPreDeviceSection = |
37 | hasPostDeviceSection = 0; | 38 | hasPostDeviceSection = 0; |
38 | return; | 39 | return; |
39 | } | 40 | } |
40 | } | 41 | } |
41 | 42 | ||
42 | // have found location | 43 | // have found location |
43 | S = TemplDir + Name + "/presection"; | 44 | S = TemplDir + Name + "/presection"; |
44 | FI.setFile( S ); | 45 | FI.setFile( S ); |
45 | hasPreSection = ( FI.exists() && FI.isReadable() ); | 46 | hasPreSection = ( FI.exists() && FI.isReadable() ); |
46 | S = TemplDir + Name + "/postsection"; | 47 | S = TemplDir + Name + "/postsection"; |
47 | FI.setFile( S ); | 48 | FI.setFile( S ); |
48 | hasPostSection = ( FI.exists() && FI.isReadable() ); | 49 | hasPostSection = ( FI.exists() && FI.isReadable() ); |
49 | S = TemplDir + Name + "/prenodesection"; | 50 | S = TemplDir + Name + "/prenodesection"; |
50 | FI.setFile( S ); | 51 | FI.setFile( S ); |
51 | hasPreNodeSection = ( FI.exists() && FI.isReadable() ); | 52 | hasPreNodeSection = ( FI.exists() && FI.isReadable() ); |
52 | S = TemplDir + Name + "/postnodesection"; | 53 | S = TemplDir + Name + "/postnodesection"; |
53 | FI.setFile( S ); | 54 | FI.setFile( S ); |
54 | hasPostNodeSection = ( FI.exists() && FI.isReadable() ); | 55 | hasPostNodeSection = ( FI.exists() && FI.isReadable() ); |
55 | S = TemplDir + Name + "/predevicesection"; | 56 | S = TemplDir + Name + "/predevicesection"; |
56 | FI.setFile( S ); | 57 | FI.setFile( S ); |
57 | hasPreDeviceSection = ( FI.exists() && FI.isReadable() ); | 58 | hasPreDeviceSection = ( FI.exists() && FI.isReadable() ); |
58 | S = TemplDir + Name + "/postdevicesection"; | 59 | S = TemplDir + Name + "/postdevicesection"; |
59 | FI.setFile( S ); | 60 | FI.setFile( S ); |
60 | hasPostDeviceSection = ( FI.exists() && FI.isReadable() ); | 61 | hasPostDeviceSection = ( FI.exists() && FI.isReadable() ); |
61 | } | 62 | } |
62 | 63 | ||
63 | KnowsDeviceInstances = KDI; | 64 | KnowsDeviceInstances = KDI; |
64 | } | 65 | } |
65 | 66 | ||
67 | SystemFile::SystemFile( const QString & N, bool KDI ){ | ||
68 | Name = N; | ||
69 | Path = ""; | ||
70 | InAppend = 0; | ||
71 | F =0; | ||
72 | KnowsDeviceInstances = KDI; | ||
73 | hasPreSection = | ||
74 | hasPostSection = | ||
75 | hasPreNodeSection = | ||
76 | hasPostNodeSection = | ||
77 | hasPreDeviceSection = | ||
78 | hasPostDeviceSection = 0; | ||
79 | } | ||
80 | |||
66 | SystemFile::~SystemFile( void ) { | 81 | SystemFile::~SystemFile( void ) { |
67 | if( F ) | 82 | close(); |
68 | delete F; | ||
69 | } | 83 | } |
70 | 84 | ||
71 | bool SystemFile::open( void ) { | 85 | bool SystemFile::open( void ) { |
72 | if( F ) { | 86 | QString Prefix = getenv( "NS2OUTPUTTO" ); |
73 | F->close(); | 87 | |
74 | delete F; | 88 | if( Prefix != "stderr" /* && Name != "interfaces" */ ) { |
75 | } | 89 | // generate files where the need to be |
90 | if( F ) { | ||
91 | F->close(); | ||
92 | delete F; | ||
93 | } | ||
76 | 94 | ||
77 | F = new QFile( Path + "bup" ); | 95 | F = new QFile( Prefix + Path + ((InAppend)?"":"bup") ); |
78 | if( ! F->open( IO_WriteOnly ) ) { | 96 | Log(( "Open systemfile %s\n", F->name().latin1() )); |
79 | return 0; | 97 | if( ! F->open( ((InAppend)?IO_Append : 0 ) | IO_WriteOnly ) ) { |
98 | return 0; | ||
99 | } | ||
100 | } else { | ||
101 | if( ! F ) { | ||
102 | owarn << "!!!!!!!!!!!!!!!!!! " << oendl; | ||
103 | owarn << "!!!! TESTMODE !!!!" << oendl; | ||
104 | owarn << "!!!!!!!!!!!!!!!!!! " << oendl; | ||
105 | owarn << "!!!!" << oendl; | ||
106 | owarn << "!!!! GENERATE " << Path << oendl; | ||
107 | if( InAppend ) { | ||
108 | owarn << "!!!! In APPEND mode" << oendl; | ||
109 | } | ||
110 | owarn << "!!!!" << oendl; | ||
111 | owarn << "!!!!!!!!!!!!!!!!!!" << oendl; | ||
112 | |||
113 | F = new QFile(); | ||
114 | F->open( IO_WriteOnly, stderr ); | ||
115 | } | ||
80 | } | 116 | } |
81 | setDevice( F ); | 117 | setDevice( F ); |
82 | return 1; | 118 | return 1; |
83 | } | 119 | } |
84 | 120 | ||
85 | bool SystemFile::close( void ) { | 121 | bool SystemFile::close( void ) { |
86 | if( ! F ) { | 122 | if( ! F || ! F->isOpen() ) { |
87 | return 1 ; | 123 | return 1 ; |
88 | } | 124 | } |
89 | 125 | ||
90 | QString OldP = Path + "bup"; | 126 | QString Prefix = getenv( "NS2OUTPUTTO" ); |
127 | |||
128 | if( Prefix == "stderr" ) { | ||
129 | return 1; | ||
130 | } | ||
131 | |||
132 | QString OldP = Prefix + Path + "bup"; | ||
91 | 133 | ||
92 | F->close(); | 134 | F->close(); |
93 | delete F; | 135 | delete F; |
94 | F = 0; | 136 | F = 0; |
95 | 137 | ||
96 | return ( rename( OldP.latin1(), Path.latin1() ) >= 0 ); | 138 | if( ! InAppend ) { |
139 | owarn << "Rename " << OldP << " to " << Path << oendl; | ||
140 | return ( rename( OldP.latin1(), Path.latin1() ) >= 0 ); | ||
141 | } | ||
142 | return 1; | ||
97 | } | 143 | } |
98 | 144 | ||
99 | bool SystemFile::preSection( void ) { | 145 | bool SystemFile::preSection( void ) { |
100 | if( hasPreSection ) { | 146 | if( hasPreSection ) { |
101 | QFile Fl( TemplDir + Name + "/presection" ); | 147 | QFile Fl( TemplDir + Name + "/presection" ); |
102 | if( ! Fl.open( IO_ReadOnly ) ) | 148 | if( ! Fl.open( IO_ReadOnly ) ) |
103 | return 0; // error | 149 | return 0; // error |
104 | // copy file to this file | 150 | // copy file to this file |
105 | F->writeBlock( Fl.readAll() ); | 151 | F->writeBlock( Fl.readAll() ); |
106 | } | 152 | } |
107 | return 1; | 153 | return 1; |
108 | } | 154 | } |
109 | 155 | ||
110 | bool SystemFile::postSection( void ) { | 156 | bool SystemFile::postSection( void ) { |
111 | if( hasPostSection ) { | 157 | if( hasPostSection ) { |
112 | QFile Fl( TemplDir + Name + "/postsection" ); | 158 | QFile Fl( TemplDir + Name + "/postsection" ); |
113 | if( ! Fl.open( IO_ReadOnly ) ) | 159 | if( ! Fl.open( IO_ReadOnly ) ) |
114 | return 0; // error | 160 | return 0; // error |
115 | // copy file to this file | 161 | // copy file to this file |
116 | F->writeBlock( Fl.readAll() ); | 162 | F->writeBlock( Fl.readAll() ); |
117 | } | 163 | } |
118 | return 1; | 164 | return 1; |
119 | } | 165 | } |
120 | 166 | ||
121 | bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { | 167 | bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { |
122 | if( hasPreNodeSection ) { | 168 | if( hasPreNodeSection ) { |
123 | QFile Fl( TemplDir + Name + "/prenodesection" ); | 169 | QFile Fl( TemplDir + Name + "/prenodesection" ); |
124 | if( ! Fl.open( IO_ReadOnly ) ) | 170 | if( ! Fl.open( IO_ReadOnly ) ) |
125 | return 0; // error | 171 | return 0; // error |
126 | QTextStream TX( &Fl ); | 172 | QTextStream TX( &Fl ); |
127 | QString Out; | 173 | QString Out; |
128 | QString S = TX.readLine(); | 174 | QString S = TX.readLine(); |
129 | while( ! TX.eof() ) { | 175 | while( ! TX.eof() ) { |
130 | Out = S. | 176 | Out = S. |
131 | arg(NNI->nodeClass()->name()); | 177 | arg(NNI->nodeClass()->name()); |
132 | (*this) << Out << endl; | 178 | (*this) << Out << endl; |
133 | S = TX.readLine(); | 179 | S = TX.readLine(); |
134 | } | 180 | } |
135 | } | 181 | } |
136 | return 1; | 182 | return 1; |
137 | } | 183 | } |
138 | 184 | ||
139 | bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) { | 185 | bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) { |
140 | if( hasPostNodeSection ) { | 186 | if( hasPostNodeSection ) { |
141 | QFile Fl( TemplDir + Name + "/postnodesection" ); | 187 | QFile Fl( TemplDir + Name + "/postnodesection" ); |
142 | if( ! Fl.open( IO_ReadOnly ) ) | 188 | if( ! Fl.open( IO_ReadOnly ) ) |
143 | return 0; // error | 189 | return 0; // error |
144 | QTextStream TX( &Fl ); | 190 | QTextStream TX( &Fl ); |
145 | QString Out; | 191 | QString Out; |
146 | QString S = TX.readLine(); | 192 | QString S = TX.readLine(); |
147 | while( ! TX.eof() ) { | 193 | while( ! TX.eof() ) { |
148 | Out = S. | 194 | Out = S. |
149 | arg(NNI->name()); | 195 | arg(NNI->name()); |
150 | (*this) << Out << endl; | 196 | (*this) << Out << endl; |
151 | S = TX.readLine(); | 197 | S = TX.readLine(); |
152 | } | 198 | } |
153 | } | 199 | } |
154 | return 1; | 200 | return 1; |
155 | } | 201 | } |
156 | 202 | ||
157 | bool SystemFile::preDeviceSection( ANetNode * NN ) { | 203 | bool SystemFile::preDeviceSection( ANetNode * NN ) { |
158 | if( hasPreDeviceSection ) { | 204 | if( hasPreDeviceSection ) { |
159 | QFile Fl( TemplDir + Name + "/predevicesection" ); | 205 | QFile Fl( TemplDir + Name + "/predevicesection" ); |
160 | if( ! Fl.open( IO_ReadOnly ) ) | 206 | if( ! Fl.open( IO_ReadOnly ) ) |
161 | return 0; // error | 207 | return 0; // error |
162 | QTextStream TX( &Fl ); | 208 | QTextStream TX( &Fl ); |
163 | QString Out; | 209 | QString Out; |
164 | QString S = TX.readLine(); | 210 | QString S = TX.readLine(); |
165 | while( ! TX.eof() ) { | 211 | while( ! TX.eof() ) { |
166 | Out = S.arg(NN->name()); | 212 | Out = S.arg(NN->name()); |
167 | (*this) << Out << endl; | 213 | (*this) << Out << endl; |
168 | S = TX.readLine(); | 214 | S = TX.readLine(); |
169 | } | 215 | } |
170 | } | 216 | } |
171 | return 1; | 217 | return 1; |
172 | } | 218 | } |
173 | 219 | ||
174 | bool SystemFile::postDeviceSection( ANetNode * NN ) { | 220 | bool SystemFile::postDeviceSection( ANetNode * NN ) { |
175 | if( hasPostDeviceSection ) { | 221 | if( hasPostDeviceSection ) { |
176 | QFile Fl( TemplDir + Name + "/postdevicesection" ); | 222 | QFile Fl( TemplDir + Name + "/postdevicesection" ); |
177 | if( ! Fl.open( IO_ReadOnly ) ) | 223 | if( ! Fl.open( IO_ReadOnly ) ) |
178 | return 0; // error | 224 | return 0; // error |
179 | QTextStream TX( &Fl ); | 225 | QTextStream TX( &Fl ); |
180 | QString Out; | 226 | QString Out; |
181 | QString S = TX.readLine(); | 227 | QString S = TX.readLine(); |
182 | while( ! TX.eof() ) { | 228 | while( ! TX.eof() ) { |
183 | Out = S.arg(NN->name()); | 229 | Out = S.arg(NN->name()); |
184 | (*this) << Out << endl; | 230 | (*this) << Out << endl; |
185 | S = TX.readLine(); | 231 | S = TX.readLine(); |
186 | } | 232 | } |
187 | } | 233 | } |
188 | return 1; | 234 | return 1; |
189 | } | 235 | } |
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 | |||
@@ -1,50 +1,61 @@ | |||
1 | #ifndef __SYSTEMFILE__H | 1 | #ifndef __SYSTEMFILE__H |
2 | #define __SYSTEMFILE__H | 2 | #define __SYSTEMFILE__H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qtextstream.h> | 5 | #include <qtextstream.h> |
6 | 6 | ||
7 | class QFile; | 7 | class QFile; |
8 | class ANetNodeInstance; | 8 | class ANetNodeInstance; |
9 | 9 | ||
10 | class SystemFile : public QTextStream { | 10 | class SystemFile : public QTextStream { |
11 | 11 | ||
12 | public : | 12 | public : |
13 | 13 | ||
14 | SystemFile( const QString & Name, | 14 | SystemFile( const QString & Name, |
15 | const QString & Path, | 15 | const QString & Path, |
16 | bool KnowsDevicesInstances ); | 16 | bool KnowsDevicesInstances ); |
17 | SystemFile( const QString & Name, | ||
18 | bool KnowsDevicesInstances = 0 ); | ||
17 | ~SystemFile( void ); | 19 | ~SystemFile( void ); |
18 | 20 | ||
21 | void setName( const QString & S ) | ||
22 | { Name = S; } | ||
19 | const QString & name( void ) const | 23 | const QString & name( void ) const |
20 | { return Name; } | 24 | { return Name; } |
25 | |||
26 | void setPath( const QString & S ) | ||
27 | { Path = S; } | ||
21 | const QString & path( void ) const | 28 | const QString & path( void ) const |
22 | { return Path; } | 29 | { return Path; } |
30 | |||
23 | bool knowsDeviceInstances( void ) const | 31 | bool knowsDeviceInstances( void ) const |
24 | { return KnowsDeviceInstances; } | 32 | { return KnowsDeviceInstances; } |
25 | 33 | ||
34 | void setAppendMode( bool A) | ||
35 | { InAppend = A; }; | ||
26 | bool open( void ); | 36 | bool open( void ); |
27 | bool close( void ); | 37 | bool close( void ); |
28 | 38 | ||
29 | bool preSection( void ); | 39 | bool preSection( void ); |
30 | bool postSection( void ); | 40 | bool postSection( void ); |
31 | bool preNodeSection( ANetNodeInstance * NNI, long DevNr ); | 41 | bool preNodeSection( ANetNodeInstance * NNI, long DevNr ); |
32 | bool postNodeSection( ANetNodeInstance * NNI, long DevNr ); | 42 | bool postNodeSection( ANetNodeInstance * NNI, long DevNr ); |
33 | bool preDeviceSection( ANetNode * NN ); | 43 | bool preDeviceSection( ANetNode * NN ); |
34 | bool postDeviceSection( ANetNode * NN ); | 44 | bool postDeviceSection( ANetNode * NN ); |
35 | 45 | ||
36 | private : | 46 | private : |
37 | 47 | ||
38 | QString Name; | 48 | QString Name; |
39 | QString Path; | 49 | QString Path; |
40 | QFile * F; | 50 | QFile * F; |
41 | bool hasPreSection; | 51 | bool hasPreSection; |
42 | bool hasPostSection; | 52 | bool hasPostSection; |
43 | bool hasPreNodeSection; | 53 | bool hasPreNodeSection; |
44 | bool hasPostNodeSection; | 54 | bool hasPostNodeSection; |
45 | bool hasPreDeviceSection; | 55 | bool hasPreDeviceSection; |
46 | bool hasPostDeviceSection; | 56 | bool hasPostDeviceSection; |
47 | bool KnowsDeviceInstances; | 57 | bool KnowsDeviceInstances; |
58 | bool InAppend; | ||
48 | 59 | ||
49 | }; | 60 | }; |
50 | #endif | 61 | #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 | |||
@@ -1,572 +1,534 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NetworkSettingsGUI</class> | 2 | <class>NetworkSettingsGUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NetworkSettingsGUI</cstring> | 7 | <cstring>NetworkSettingsGUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>144</width> | 14 | <width>383</width> |
15 | <height>260</height> | 15 | <height>359</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Network Settings</string> | 20 | <string>Network Settings</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>2</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>2</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QFrame</class> | 38 | <class>QFrame</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>Frame4</cstring> | 41 | <cstring>Frame4</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>sizePolicy</name> | 44 | <name>sizePolicy</name> |
45 | <sizepolicy> | 45 | <sizepolicy> |
46 | <hsizetype>7</hsizetype> | 46 | <hsizetype>7</hsizetype> |
47 | <vsizetype>0</vsizetype> | 47 | <vsizetype>0</vsizetype> |
48 | </sizepolicy> | 48 | </sizepolicy> |
49 | </property> | 49 | </property> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>frameShape</name> | 51 | <name>frameShape</name> |
52 | <enum>NoFrame</enum> | 52 | <enum>NoFrame</enum> |
53 | </property> | 53 | </property> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>frameShadow</name> | 55 | <name>frameShadow</name> |
56 | <enum>Raised</enum> | 56 | <enum>Raised</enum> |
57 | </property> | 57 | </property> |
58 | <property> | 58 | <property> |
59 | <name>layoutMargin</name> | 59 | <name>layoutMargin</name> |
60 | </property> | 60 | </property> |
61 | <property> | 61 | <property> |
62 | <name>layoutSpacing</name> | 62 | <name>layoutSpacing</name> |
63 | </property> | 63 | </property> |
64 | <hbox> | 64 | <hbox> |
65 | <property stdset="1"> | 65 | <property stdset="1"> |
66 | <name>margin</name> | 66 | <name>margin</name> |
67 | <number>0</number> | 67 | <number>0</number> |
68 | </property> | 68 | </property> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>spacing</name> | 70 | <name>spacing</name> |
71 | <number>1</number> | 71 | <number>0</number> |
72 | </property> | 72 | </property> |
73 | <widget> | 73 | <widget> |
74 | <class>QToolButton</class> | 74 | <class>QToolButton</class> |
75 | <property stdset="1"> | 75 | <property stdset="1"> |
76 | <name>name</name> | 76 | <name>name</name> |
77 | <cstring>Add_TB</cstring> | 77 | <cstring>Add_TB</cstring> |
78 | </property> | 78 | </property> |
79 | <property stdset="1"> | 79 | <property stdset="1"> |
80 | <name>sizePolicy</name> | 80 | <name>sizePolicy</name> |
81 | <sizepolicy> | 81 | <sizepolicy> |
82 | <hsizetype>0</hsizetype> | 82 | <hsizetype>0</hsizetype> |
83 | <vsizetype>0</vsizetype> | 83 | <vsizetype>0</vsizetype> |
84 | </sizepolicy> | 84 | </sizepolicy> |
85 | </property> | 85 | </property> |
86 | <property stdset="1"> | 86 | <property stdset="1"> |
87 | <name>text</name> | 87 | <name>text</name> |
88 | <string>...</string> | 88 | <string>...</string> |
89 | </property> | 89 | </property> |
90 | </widget> | 90 | </widget> |
91 | <widget> | 91 | <widget> |
92 | <class>QToolButton</class> | 92 | <class>QToolButton</class> |
93 | <property stdset="1"> | 93 | <property stdset="1"> |
94 | <name>name</name> | 94 | <name>name</name> |
95 | <cstring>Delete_TB</cstring> | 95 | <cstring>Delete_TB</cstring> |
96 | </property> | 96 | </property> |
97 | <property stdset="1"> | 97 | <property stdset="1"> |
98 | <name>sizePolicy</name> | 98 | <name>sizePolicy</name> |
99 | <sizepolicy> | 99 | <sizepolicy> |
100 | <hsizetype>0</hsizetype> | 100 | <hsizetype>0</hsizetype> |
101 | <vsizetype>0</vsizetype> | 101 | <vsizetype>0</vsizetype> |
102 | </sizepolicy> | 102 | </sizepolicy> |
103 | </property> | 103 | </property> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>text</name> | 105 | <name>text</name> |
106 | <string>...</string> | 106 | <string>...</string> |
107 | </property> | 107 | </property> |
108 | </widget> | 108 | </widget> |
109 | <widget> | 109 | <widget> |
110 | <class>QToolButton</class> | 110 | <class>QToolButton</class> |
111 | <property stdset="1"> | 111 | <property stdset="1"> |
112 | <name>name</name> | 112 | <name>name</name> |
113 | <cstring>CheckState_TB</cstring> | 113 | <cstring>CheckState_TB</cstring> |
114 | </property> | 114 | </property> |
115 | <property stdset="1"> | 115 | <property stdset="1"> |
116 | <name>sizePolicy</name> | 116 | <name>sizePolicy</name> |
117 | <sizepolicy> | 117 | <sizepolicy> |
118 | <hsizetype>0</hsizetype> | 118 | <hsizetype>0</hsizetype> |
119 | <vsizetype>0</vsizetype> | 119 | <vsizetype>0</vsizetype> |
120 | </sizepolicy> | 120 | </sizepolicy> |
121 | </property> | 121 | </property> |
122 | <property stdset="1"> | 122 | <property stdset="1"> |
123 | <name>text</name> | 123 | <name>text</name> |
124 | <string>...</string> | 124 | <string>...</string> |
125 | </property> | 125 | </property> |
126 | </widget> | 126 | </widget> |
127 | <widget> | 127 | <widget> |
128 | <class>QToolButton</class> | 128 | <class>QToolButton</class> |
129 | <property stdset="1"> | 129 | <property stdset="1"> |
130 | <name>name</name> | 130 | <name>name</name> |
131 | <cstring>GenConfig_TB</cstring> | 131 | <cstring>GenConfig_TB</cstring> |
132 | </property> | 132 | </property> |
133 | <property stdset="1"> | 133 | <property stdset="1"> |
134 | <name>sizePolicy</name> | 134 | <name>sizePolicy</name> |
135 | <sizepolicy> | 135 | <sizepolicy> |
136 | <hsizetype>0</hsizetype> | 136 | <hsizetype>0</hsizetype> |
137 | <vsizetype>0</vsizetype> | 137 | <vsizetype>0</vsizetype> |
138 | </sizepolicy> | 138 | </sizepolicy> |
139 | </property> | 139 | </property> |
140 | <property stdset="1"> | 140 | <property stdset="1"> |
141 | <name>text</name> | 141 | <name>text</name> |
142 | <string>...</string> | 142 | <string>...</string> |
143 | </property> | 143 | </property> |
144 | </widget> | 144 | </widget> |
145 | <spacer> | 145 | <spacer> |
146 | <property> | 146 | <property> |
147 | <name>name</name> | 147 | <name>name</name> |
148 | <cstring>Spacer1</cstring> | 148 | <cstring>Spacer1</cstring> |
149 | </property> | 149 | </property> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>orientation</name> | 151 | <name>orientation</name> |
152 | <enum>Horizontal</enum> | 152 | <enum>Horizontal</enum> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>sizeType</name> | 155 | <name>sizeType</name> |
156 | <enum>Expanding</enum> | 156 | <enum>Expanding</enum> |
157 | </property> | 157 | </property> |
158 | <property> | 158 | <property> |
159 | <name>sizeHint</name> | 159 | <name>sizeHint</name> |
160 | <size> | 160 | <size> |
161 | <width>20</width> | 161 | <width>20</width> |
162 | <height>20</height> | 162 | <height>20</height> |
163 | </size> | 163 | </size> |
164 | </property> | 164 | </property> |
165 | </spacer> | 165 | </spacer> |
166 | <widget> | 166 | <widget> |
167 | <class>QToolButton</class> | 167 | <class>QToolButton</class> |
168 | <property stdset="1"> | 168 | <property stdset="1"> |
169 | <name>name</name> | 169 | <name>name</name> |
170 | <cstring>Enable_TB</cstring> | 170 | <cstring>Disable_TB</cstring> |
171 | </property> | ||
172 | <property stdset="1"> | ||
173 | <name>sizePolicy</name> | ||
174 | <sizepolicy> | ||
175 | <hsizetype>0</hsizetype> | ||
176 | <vsizetype>0</vsizetype> | ||
177 | </sizepolicy> | ||
178 | </property> | 171 | </property> |
179 | <property stdset="1"> | 172 | <property stdset="1"> |
180 | <name>text</name> | 173 | <name>text</name> |
181 | <string>...</string> | 174 | <string>...</string> |
182 | </property> | 175 | </property> |
183 | <property stdset="1"> | 176 | <property stdset="1"> |
184 | <name>toggleButton</name> | 177 | <name>toggleButton</name> |
185 | <bool>true</bool> | 178 | <bool>true</bool> |
186 | </property> | 179 | </property> |
187 | <property stdset="1"> | 180 | <property stdset="1"> |
188 | <name>toggleButton</name> | 181 | <name>toggleButton</name> |
189 | <bool>true</bool> | 182 | <bool>true</bool> |
190 | </property> | 183 | </property> |
191 | </widget> | 184 | </widget> |
192 | <widget> | 185 | <widget> |
193 | <class>QToolButton</class> | 186 | <class>QToolButton</class> |
194 | <property stdset="1"> | 187 | <property stdset="1"> |
195 | <name>name</name> | 188 | <name>name</name> |
196 | <cstring>On_TB</cstring> | 189 | <cstring>Down_TB</cstring> |
197 | </property> | ||
198 | <property stdset="1"> | ||
199 | <name>sizePolicy</name> | ||
200 | <sizepolicy> | ||
201 | <hsizetype>0</hsizetype> | ||
202 | <vsizetype>0</vsizetype> | ||
203 | </sizepolicy> | ||
204 | </property> | 190 | </property> |
205 | <property stdset="1"> | 191 | <property stdset="1"> |
206 | <name>text</name> | 192 | <name>text</name> |
207 | <string>...</string> | 193 | <string>...</string> |
208 | </property> | 194 | </property> |
209 | <property stdset="1"> | 195 | <property stdset="1"> |
210 | <name>toggleButton</name> | 196 | <name>toggleButton</name> |
211 | <bool>true</bool> | 197 | <bool>false</bool> |
212 | </property> | 198 | </property> |
213 | <property stdset="1"> | 199 | <property stdset="1"> |
214 | <name>toggleButton</name> | 200 | <name>toggleButton</name> |
215 | <bool>true</bool> | 201 | <bool>false</bool> |
216 | </property> | 202 | </property> |
217 | </widget> | 203 | </widget> |
218 | <widget> | 204 | <widget> |
219 | <class>QToolButton</class> | 205 | <class>QFrame</class> |
220 | <property stdset="1"> | 206 | <property stdset="1"> |
221 | <name>name</name> | 207 | <name>name</name> |
222 | <cstring>Connect_TB</cstring> | 208 | <cstring>LED_Frm</cstring> |
223 | </property> | 209 | </property> |
224 | <property stdset="1"> | 210 | <property stdset="1"> |
225 | <name>sizePolicy</name> | 211 | <name>frameShape</name> |
226 | <sizepolicy> | 212 | <enum>NoFrame</enum> |
227 | <hsizetype>0</hsizetype> | ||
228 | <vsizetype>0</vsizetype> | ||
229 | </sizepolicy> | ||
230 | </property> | ||
231 | <property stdset="1"> | ||
232 | <name>text</name> | ||
233 | <string>...</string> | ||
234 | </property> | ||
235 | <property stdset="1"> | ||
236 | <name>toggleButton</name> | ||
237 | <bool>true</bool> | ||
238 | </property> | 213 | </property> |
239 | <property stdset="1"> | 214 | <property stdset="1"> |
240 | <name>toggleButton</name> | 215 | <name>frameShadow</name> |
241 | <bool>true</bool> | 216 | <enum>Raised</enum> |
242 | </property> | 217 | </property> |
243 | </widget> | 218 | </widget> |
244 | <widget> | 219 | <widget> |
245 | <class>QToolButton</class> | 220 | <class>QToolButton</class> |
246 | <property stdset="1"> | 221 | <property stdset="1"> |
247 | <name>name</name> | 222 | <name>name</name> |
248 | <cstring>Disconnect_TB</cstring> | 223 | <cstring>Up_TB</cstring> |
249 | </property> | ||
250 | <property stdset="1"> | ||
251 | <name>sizePolicy</name> | ||
252 | <sizepolicy> | ||
253 | <hsizetype>0</hsizetype> | ||
254 | <vsizetype>0</vsizetype> | ||
255 | </sizepolicy> | ||
256 | </property> | 224 | </property> |
257 | <property stdset="1"> | 225 | <property stdset="1"> |
258 | <name>text</name> | 226 | <name>text</name> |
259 | <string>...</string> | 227 | <string>...</string> |
260 | </property> | 228 | </property> |
261 | <property stdset="1"> | 229 | <property stdset="1"> |
262 | <name>toggleButton</name> | 230 | <name>toggleButton</name> |
263 | <bool>true</bool> | 231 | <bool>false</bool> |
264 | </property> | 232 | </property> |
265 | <property stdset="1"> | 233 | <property stdset="1"> |
266 | <name>toggleButton</name> | 234 | <name>toggleButton</name> |
267 | <bool>true</bool> | 235 | <bool>false</bool> |
268 | </property> | 236 | </property> |
269 | </widget> | 237 | </widget> |
270 | </hbox> | 238 | </hbox> |
271 | </widget> | 239 | </widget> |
272 | <widget> | 240 | <widget> |
273 | <class>QListBox</class> | 241 | <class>QListBox</class> |
274 | <property stdset="1"> | 242 | <property stdset="1"> |
275 | <name>name</name> | 243 | <name>name</name> |
276 | <cstring>Profiles_LB</cstring> | 244 | <cstring>Profiles_LB</cstring> |
277 | </property> | 245 | </property> |
278 | </widget> | 246 | </widget> |
279 | <widget> | 247 | <widget> |
280 | <class>QGroupBox</class> | 248 | <class>QGroupBox</class> |
281 | <property stdset="1"> | 249 | <property stdset="1"> |
282 | <name>name</name> | 250 | <name>name</name> |
283 | <cstring>Profile_GB</cstring> | 251 | <cstring>Profile_GB</cstring> |
284 | </property> | 252 | </property> |
285 | <property stdset="1"> | 253 | <property stdset="1"> |
286 | <name>title</name> | 254 | <name>title</name> |
287 | <string>Profile</string> | 255 | <string>Profile</string> |
288 | </property> | 256 | </property> |
289 | <property> | 257 | <property> |
290 | <name>layoutMargin</name> | 258 | <name>layoutMargin</name> |
291 | </property> | 259 | </property> |
292 | <property> | 260 | <property> |
293 | <name>layoutSpacing</name> | 261 | <name>layoutSpacing</name> |
294 | </property> | 262 | </property> |
295 | <vbox> | 263 | <vbox> |
296 | <property stdset="1"> | 264 | <property stdset="1"> |
297 | <name>margin</name> | 265 | <name>margin</name> |
298 | <number>4</number> | 266 | <number>4</number> |
299 | </property> | 267 | </property> |
300 | <property stdset="1"> | 268 | <property stdset="1"> |
301 | <name>spacing</name> | 269 | <name>spacing</name> |
302 | <number>2</number> | 270 | <number>2</number> |
303 | </property> | 271 | </property> |
304 | <widget> | 272 | <widget> |
305 | <class>QLabel</class> | 273 | <class>QLabel</class> |
306 | <property stdset="1"> | 274 | <property stdset="1"> |
307 | <name>name</name> | 275 | <name>name</name> |
308 | <cstring>Description_LBL</cstring> | 276 | <cstring>Description_LBL</cstring> |
309 | </property> | 277 | </property> |
310 | <property stdset="1"> | 278 | <property stdset="1"> |
311 | <name>sizePolicy</name> | 279 | <name>sizePolicy</name> |
312 | <sizepolicy> | 280 | <sizepolicy> |
313 | <hsizetype>5</hsizetype> | 281 | <hsizetype>5</hsizetype> |
314 | <vsizetype>7</vsizetype> | 282 | <vsizetype>7</vsizetype> |
315 | </sizepolicy> | 283 | </sizepolicy> |
316 | </property> | 284 | </property> |
317 | <property stdset="1"> | 285 | <property stdset="1"> |
318 | <name>frameShape</name> | 286 | <name>frameShape</name> |
319 | <enum>NoFrame</enum> | 287 | <enum>NoFrame</enum> |
320 | </property> | 288 | </property> |
321 | <property stdset="1"> | 289 | <property stdset="1"> |
322 | <name>frameShadow</name> | 290 | <name>frameShadow</name> |
323 | <enum>Raised</enum> | 291 | <enum>Raised</enum> |
324 | </property> | 292 | </property> |
325 | <property stdset="1"> | 293 | <property stdset="1"> |
326 | <name>text</name> | 294 | <name>text</name> |
327 | <string></string> | 295 | <string></string> |
328 | </property> | 296 | </property> |
329 | <property stdset="1"> | 297 | <property stdset="1"> |
330 | <name>alignment</name> | 298 | <name>alignment</name> |
331 | <set>AlignTop|AlignLeft</set> | 299 | <set>AlignTop|AlignLeft</set> |
332 | </property> | 300 | </property> |
333 | <property> | 301 | <property> |
334 | <name>vAlign</name> | 302 | <name>vAlign</name> |
335 | </property> | 303 | </property> |
336 | </widget> | 304 | </widget> |
337 | <widget> | 305 | <widget> |
338 | <class>QLayoutWidget</class> | 306 | <class>QLayoutWidget</class> |
339 | <property stdset="1"> | 307 | <property stdset="1"> |
340 | <name>name</name> | 308 | <name>name</name> |
341 | <cstring>Layout4</cstring> | 309 | <cstring>Layout4</cstring> |
342 | </property> | 310 | </property> |
343 | <hbox> | 311 | <hbox> |
344 | <property stdset="1"> | 312 | <property stdset="1"> |
345 | <name>margin</name> | 313 | <name>margin</name> |
346 | <number>0</number> | 314 | <number>0</number> |
347 | </property> | 315 | </property> |
348 | <property stdset="1"> | 316 | <property stdset="1"> |
349 | <name>spacing</name> | 317 | <name>spacing</name> |
350 | <number>6</number> | 318 | <number>6</number> |
351 | </property> | 319 | </property> |
352 | <spacer> | 320 | <spacer> |
353 | <property> | 321 | <property> |
354 | <name>name</name> | 322 | <name>name</name> |
355 | <cstring>Spacer4</cstring> | 323 | <cstring>Spacer4</cstring> |
356 | </property> | 324 | </property> |
357 | <property stdset="1"> | 325 | <property stdset="1"> |
358 | <name>orientation</name> | 326 | <name>orientation</name> |
359 | <enum>Horizontal</enum> | 327 | <enum>Horizontal</enum> |
360 | </property> | 328 | </property> |
361 | <property stdset="1"> | 329 | <property stdset="1"> |
362 | <name>sizeType</name> | 330 | <name>sizeType</name> |
363 | <enum>Expanding</enum> | 331 | <enum>Expanding</enum> |
364 | </property> | 332 | </property> |
365 | <property> | 333 | <property> |
366 | <name>sizeHint</name> | 334 | <name>sizeHint</name> |
367 | <size> | 335 | <size> |
368 | <width>20</width> | 336 | <width>20</width> |
369 | <height>20</height> | 337 | <height>20</height> |
370 | </size> | 338 | </size> |
371 | </property> | 339 | </property> |
372 | </spacer> | 340 | </spacer> |
373 | <widget> | 341 | <widget> |
374 | <class>QPushButton</class> | 342 | <class>QPushButton</class> |
375 | <property stdset="1"> | 343 | <property stdset="1"> |
376 | <name>name</name> | 344 | <name>name</name> |
377 | <cstring>ToMessages_BUT</cstring> | 345 | <cstring>ToMessages_BUT</cstring> |
378 | </property> | 346 | </property> |
379 | <property stdset="1"> | 347 | <property stdset="1"> |
380 | <name>sizePolicy</name> | 348 | <name>sizePolicy</name> |
381 | <sizepolicy> | 349 | <sizepolicy> |
382 | <hsizetype>1</hsizetype> | 350 | <hsizetype>1</hsizetype> |
383 | <vsizetype>0</vsizetype> | 351 | <vsizetype>0</vsizetype> |
384 | </sizepolicy> | 352 | </sizepolicy> |
385 | </property> | 353 | </property> |
386 | <property stdset="1"> | 354 | <property stdset="1"> |
387 | <name>text</name> | 355 | <name>text</name> |
388 | <string>Messages ...</string> | 356 | <string>Messages ...</string> |
389 | </property> | 357 | </property> |
390 | </widget> | 358 | </widget> |
391 | </hbox> | 359 | </hbox> |
392 | </widget> | 360 | </widget> |
393 | </vbox> | 361 | </vbox> |
394 | </widget> | 362 | </widget> |
395 | <widget> | 363 | <widget> |
396 | <class>QGroupBox</class> | 364 | <class>QGroupBox</class> |
397 | <property stdset="1"> | 365 | <property stdset="1"> |
398 | <name>name</name> | 366 | <name>name</name> |
399 | <cstring>Messages_GB</cstring> | 367 | <cstring>Messages_GB</cstring> |
400 | </property> | 368 | </property> |
401 | <property stdset="1"> | 369 | <property stdset="1"> |
402 | <name>title</name> | 370 | <name>title</name> |
403 | <string>Messages</string> | 371 | <string>Messages</string> |
404 | </property> | 372 | </property> |
405 | <property> | 373 | <property> |
406 | <name>layoutMargin</name> | 374 | <name>layoutMargin</name> |
407 | </property> | 375 | </property> |
408 | <property> | 376 | <property> |
409 | <name>layoutSpacing</name> | 377 | <name>layoutSpacing</name> |
410 | </property> | 378 | </property> |
411 | <vbox> | 379 | <vbox> |
412 | <property stdset="1"> | 380 | <property stdset="1"> |
413 | <name>margin</name> | 381 | <name>margin</name> |
414 | <number>4</number> | 382 | <number>4</number> |
415 | </property> | 383 | </property> |
416 | <property stdset="1"> | 384 | <property stdset="1"> |
417 | <name>spacing</name> | 385 | <name>spacing</name> |
418 | <number>2</number> | 386 | <number>2</number> |
419 | </property> | 387 | </property> |
420 | <widget> | 388 | <widget> |
421 | <class>QListBox</class> | 389 | <class>QListBox</class> |
422 | <property stdset="1"> | 390 | <property stdset="1"> |
423 | <name>name</name> | 391 | <name>name</name> |
424 | <cstring>Messages_LB</cstring> | 392 | <cstring>Messages_LB</cstring> |
425 | </property> | 393 | </property> |
426 | </widget> | 394 | </widget> |
427 | <widget> | 395 | <widget> |
428 | <class>QLayoutWidget</class> | 396 | <class>QLayoutWidget</class> |
429 | <property stdset="1"> | 397 | <property stdset="1"> |
430 | <name>name</name> | 398 | <name>name</name> |
431 | <cstring>Layout2</cstring> | 399 | <cstring>Layout2</cstring> |
432 | </property> | 400 | </property> |
433 | <hbox> | 401 | <hbox> |
434 | <property stdset="1"> | 402 | <property stdset="1"> |
435 | <name>margin</name> | 403 | <name>margin</name> |
436 | <number>0</number> | 404 | <number>0</number> |
437 | </property> | 405 | </property> |
438 | <property stdset="1"> | 406 | <property stdset="1"> |
439 | <name>spacing</name> | 407 | <name>spacing</name> |
440 | <number>6</number> | 408 | <number>6</number> |
441 | </property> | 409 | </property> |
442 | <spacer> | 410 | <spacer> |
443 | <property> | 411 | <property> |
444 | <name>name</name> | 412 | <name>name</name> |
445 | <cstring>Spacer3</cstring> | 413 | <cstring>Spacer3</cstring> |
446 | </property> | 414 | </property> |
447 | <property stdset="1"> | 415 | <property stdset="1"> |
448 | <name>orientation</name> | 416 | <name>orientation</name> |
449 | <enum>Horizontal</enum> | 417 | <enum>Horizontal</enum> |
450 | </property> | 418 | </property> |
451 | <property stdset="1"> | 419 | <property stdset="1"> |
452 | <name>sizeType</name> | 420 | <name>sizeType</name> |
453 | <enum>Expanding</enum> | 421 | <enum>Expanding</enum> |
454 | </property> | 422 | </property> |
455 | <property> | 423 | <property> |
456 | <name>sizeHint</name> | 424 | <name>sizeHint</name> |
457 | <size> | 425 | <size> |
458 | <width>20</width> | 426 | <width>20</width> |
459 | <height>20</height> | 427 | <height>20</height> |
460 | </size> | 428 | </size> |
461 | </property> | 429 | </property> |
462 | </spacer> | 430 | </spacer> |
463 | <widget> | 431 | <widget> |
464 | <class>QPushButton</class> | 432 | <class>QPushButton</class> |
465 | <property stdset="1"> | 433 | <property stdset="1"> |
466 | <name>name</name> | 434 | <name>name</name> |
467 | <cstring>ToProfile_BUT</cstring> | 435 | <cstring>ToProfile_BUT</cstring> |
468 | </property> | 436 | </property> |
469 | <property stdset="1"> | 437 | <property stdset="1"> |
470 | <name>text</name> | 438 | <name>text</name> |
471 | <string>Profile ...</string> | 439 | <string>Profile ...</string> |
472 | </property> | 440 | </property> |
473 | </widget> | 441 | </widget> |
474 | </hbox> | 442 | </hbox> |
475 | </widget> | 443 | </widget> |
476 | </vbox> | 444 | </vbox> |
477 | </widget> | 445 | </widget> |
478 | </vbox> | 446 | </vbox> |
479 | </widget> | 447 | </widget> |
480 | <connections> | 448 | <connections> |
481 | <connection> | 449 | <connection> |
482 | <sender>Add_TB</sender> | ||
483 | <signal>clicked()</signal> | ||
484 | <receiver>NetworkSettingsGUI</receiver> | ||
485 | <slot>SLOT_AddNode()</slot> | ||
486 | </connection> | ||
487 | <connection> | ||
488 | <sender>Delete_TB</sender> | 450 | <sender>Delete_TB</sender> |
489 | <signal>clicked()</signal> | 451 | <signal>clicked()</signal> |
490 | <receiver>NetworkSettingsGUI</receiver> | 452 | <receiver>NetworkSettingsGUI</receiver> |
491 | <slot>SLOT_DeleteNode()</slot> | 453 | <slot>SLOT_DeleteNode()</slot> |
492 | </connection> | 454 | </connection> |
493 | <connection> | 455 | <connection> |
494 | <sender>CheckState_TB</sender> | 456 | <sender>CheckState_TB</sender> |
495 | <signal>clicked()</signal> | 457 | <signal>clicked()</signal> |
496 | <receiver>NetworkSettingsGUI</receiver> | 458 | <receiver>NetworkSettingsGUI</receiver> |
497 | <slot>SLOT_CheckState()</slot> | 459 | <slot>SLOT_CheckState()</slot> |
498 | </connection> | 460 | </connection> |
499 | <connection> | 461 | <connection> |
500 | <sender>Enable_TB</sender> | ||
501 | <signal>clicked()</signal> | ||
502 | <receiver>NetworkSettingsGUI</receiver> | ||
503 | <slot>SLOT_Enable()</slot> | ||
504 | </connection> | ||
505 | <connection> | ||
506 | <sender>Connect_TB</sender> | ||
507 | <signal>clicked()</signal> | ||
508 | <receiver>NetworkSettingsGUI</receiver> | ||
509 | <slot>SLOT_Connect()</slot> | ||
510 | </connection> | ||
511 | <connection> | ||
512 | <sender>On_TB</sender> | ||
513 | <signal>clicked()</signal> | ||
514 | <receiver>NetworkSettingsGUI</receiver> | ||
515 | <slot>SLOT_On()</slot> | ||
516 | </connection> | ||
517 | <connection> | ||
518 | <sender>GenConfig_TB</sender> | 462 | <sender>GenConfig_TB</sender> |
519 | <signal>clicked()</signal> | 463 | <signal>clicked()</signal> |
520 | <receiver>NetworkSettingsGUI</receiver> | 464 | <receiver>NetworkSettingsGUI</receiver> |
521 | <slot>SLOT_GenerateConfig()</slot> | 465 | <slot>SLOT_GenerateConfig()</slot> |
522 | </connection> | 466 | </connection> |
523 | <connection> | 467 | <connection> |
524 | <sender>Profiles_LB</sender> | 468 | <sender>Profiles_LB</sender> |
525 | <signal>clicked(QListBoxItem*)</signal> | 469 | <signal>clicked(QListBoxItem*)</signal> |
526 | <receiver>NetworkSettingsGUI</receiver> | 470 | <receiver>NetworkSettingsGUI</receiver> |
527 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> | 471 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> |
528 | </connection> | 472 | </connection> |
529 | <connection> | 473 | <connection> |
530 | <sender>Profiles_LB</sender> | 474 | <sender>Profiles_LB</sender> |
531 | <signal>currentChanged(QListBoxItem*)</signal> | 475 | <signal>currentChanged(QListBoxItem*)</signal> |
532 | <receiver>NetworkSettingsGUI</receiver> | 476 | <receiver>NetworkSettingsGUI</receiver> |
533 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> | 477 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> |
534 | </connection> | 478 | </connection> |
535 | <connection> | 479 | <connection> |
536 | <sender>Profiles_LB</sender> | 480 | <sender>Profiles_LB</sender> |
537 | <signal>doubleClicked(QListBoxItem*)</signal> | 481 | <signal>doubleClicked(QListBoxItem*)</signal> |
538 | <receiver>NetworkSettingsGUI</receiver> | 482 | <receiver>NetworkSettingsGUI</receiver> |
539 | <slot>SLOT_EditNode( QListBoxItem *)</slot> | 483 | <slot>SLOT_EditNode( QListBoxItem *)</slot> |
540 | </connection> | 484 | </connection> |
541 | <connection> | 485 | <connection> |
542 | <sender>ToProfile_BUT</sender> | 486 | <sender>ToProfile_BUT</sender> |
543 | <signal>clicked()</signal> | 487 | <signal>clicked()</signal> |
544 | <receiver>NetworkSettingsGUI</receiver> | 488 | <receiver>NetworkSettingsGUI</receiver> |
545 | <slot>SLOT_ToProfile()</slot> | 489 | <slot>SLOT_ToProfile()</slot> |
546 | </connection> | 490 | </connection> |
547 | <connection> | 491 | <connection> |
548 | <sender>ToMessages_BUT</sender> | 492 | <sender>ToMessages_BUT</sender> |
549 | <signal>clicked()</signal> | 493 | <signal>clicked()</signal> |
550 | <receiver>NetworkSettingsGUI</receiver> | 494 | <receiver>NetworkSettingsGUI</receiver> |
551 | <slot>SLOT_ToMessages()</slot> | 495 | <slot>SLOT_ToMessages()</slot> |
552 | </connection> | 496 | </connection> |
553 | <connection> | 497 | <connection> |
554 | <sender>Disconnect_TB</sender> | 498 | <sender>Add_TB</sender> |
499 | <signal>clicked()</signal> | ||
500 | <receiver>NetworkSettingsGUI</receiver> | ||
501 | <slot>SLOT_AddNode()</slot> | ||
502 | </connection> | ||
503 | <connection> | ||
504 | <sender>Disable_TB</sender> | ||
505 | <signal>toggled(bool)</signal> | ||
506 | <receiver>NetworkSettingsGUI</receiver> | ||
507 | <slot>SLOT_Disable(bool)</slot> | ||
508 | </connection> | ||
509 | <connection> | ||
510 | <sender>Down_TB</sender> | ||
511 | <signal>clicked()</signal> | ||
512 | <receiver>NetworkSettingsGUI</receiver> | ||
513 | <slot>SLOT_Down()</slot> | ||
514 | </connection> | ||
515 | <connection> | ||
516 | <sender>Up_TB</sender> | ||
555 | <signal>clicked()</signal> | 517 | <signal>clicked()</signal> |
556 | <receiver>NetworkSettingsGUI</receiver> | 518 | <receiver>NetworkSettingsGUI</receiver> |
557 | <slot>SLOT_Disconnect()</slot> | 519 | <slot>SLOT_Up()</slot> |
558 | </connection> | 520 | </connection> |
559 | <slot access="public">SLOT_AddNode()</slot> | 521 | <slot access="public">SLOT_AddNode()</slot> |
560 | <slot access="public">SLOT_CheckState()</slot> | 522 | <slot access="public">SLOT_CheckState()</slot> |
561 | <slot access="public">SLOT_Connect()</slot> | ||
562 | <slot access="public">SLOT_DeleteNode()</slot> | 523 | <slot access="public">SLOT_DeleteNode()</slot> |
524 | <slot access="public">SLOT_Disable(bool)</slot> | ||
563 | <slot access="public">SLOT_EditNode( QListBoxItem *)</slot> | 525 | <slot access="public">SLOT_EditNode( QListBoxItem *)</slot> |
564 | <slot access="public">SLOT_Enable()</slot> | ||
565 | <slot access="public">SLOT_GenerateConfig()</slot> | 526 | <slot access="public">SLOT_GenerateConfig()</slot> |
566 | <slot access="public">SLOT_On()</slot> | 527 | <slot access="public">SLOT_SetState(int)</slot> |
567 | <slot access="public">SLOT_ShowNode( QListBoxItem*)</slot> | 528 | <slot access="public">SLOT_ShowNode( QListBoxItem*)</slot> |
568 | <slot access="public">SLOT_ToMessages()</slot> | 529 | <slot access="public">SLOT_ToMessages()</slot> |
569 | <slot access="public">SLOT_ToProfile()</slot> | 530 | <slot access="public">SLOT_ToProfile()</slot> |
570 | <slot access="public">SLOT_Disconnect()</slot> | 531 | <slot access="public">SLOT_Up()</slot> |
532 | <slot access="public">SLOT_Down()</slot> | ||
571 | </connections> | 533 | </connections> |
572 | </UI> | 534 | </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,603 +1,725 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <opie2/odebug.h> | ||
2 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
3 | #include <qtextstream.h> | 4 | #include <qtextstream.h> |
4 | #include <qdir.h> | 5 | #include <qdir.h> |
5 | #include <qfile.h> | 6 | #include <qfile.h> |
6 | #include <qfileinfo.h> | 7 | #include <qfileinfo.h> |
7 | 8 | ||
8 | #include "nsdata.h" | 9 | #include "nsdata.h" |
9 | #include <asdevice.h> | 10 | #include <netnode.h> |
10 | #include <resources.h> | 11 | #include <resources.h> |
11 | 12 | ||
12 | static QString CfgFile; | 13 | static QString CfgFile; |
13 | 14 | ||
14 | NetworkSettingsData::NetworkSettingsData( void ) { | 15 | NetworkSettingsData::NetworkSettingsData( void ) { |
15 | // init global resources structure | 16 | // init global resources structure |
16 | new TheNSResources(); | 17 | new TheNSResources(); |
17 | 18 | ||
18 | if( ! NSResources->userKnown() ) { | 19 | if( ! NSResources->userKnown() ) { |
19 | Log(( "Cannot detect qpe user HOME=\"%s\" USER=\"%s\"\n", | 20 | Log(( "Cannot detect qpe user HOME=\"%s\" USER=\"%s\"\n", |
20 | NSResources->currentUser().HomeDir.latin1(), | 21 | NSResources->currentUser().HomeDir.latin1(), |
21 | NSResources->currentUser().UserName.latin1() )); | 22 | NSResources->currentUser().UserName.latin1() )); |
22 | return; | 23 | return; |
23 | } | 24 | } |
24 | 25 | ||
25 | CfgFile.sprintf( "%s/Settings/NS2.conf", | 26 | CfgFile.sprintf( "%s/Settings/NS2.conf", |
26 | NSResources->currentUser().HomeDir.latin1() ); | 27 | NSResources->currentUser().HomeDir.latin1() ); |
27 | Log(( "Cfg from %s\n", CfgFile.latin1() )); | 28 | Log(( "Cfg from %s\n", CfgFile.latin1() )); |
28 | 29 | ||
29 | // load settings | 30 | // load settings |
30 | IsModified = 0; | ||
31 | loadSettings(); | 31 | loadSettings(); |
32 | |||
33 | // assign interfaces by scanning /tmp/profile-%s.Up files | ||
34 | { QDir D( "/tmp" ); | ||
35 | QFile * F = new QFile; | ||
36 | int profilenr; | ||
37 | QString interfacename; | ||
38 | QTextStream TS ( F ); | ||
39 | |||
40 | QStringList SL = D.entryList( "profile-*.up"); | ||
41 | |||
42 | Log(( "System reports %d interfaces. Found %d up\n", | ||
43 | NSResources->system().interfaces().count(), | ||
44 | SL.count() )); | ||
45 | |||
46 | for ( QStringList::Iterator it = SL.begin(); | ||
47 | it != SL.end(); | ||
48 | ++it ) { | ||
49 | profilenr = atol( (*it).mid( 8 ).latin1() ); | ||
50 | // read the interface store int 'up' | ||
51 | F->setName( D.path() + "/" + (*it) ); | ||
52 | if( F->open( IO_ReadOnly ) ) { | ||
53 | NodeCollection * NC; | ||
54 | interfacename = TS.readLine(); | ||
55 | F->close(); | ||
56 | |||
57 | Log(( "Assign interface %s to Profile nr %d\n", | ||
58 | interfacename.latin1(), profilenr )); | ||
59 | |||
60 | NC = NSResources->getConnection( profilenr ); | ||
61 | if( NC ) { | ||
62 | NC->assignInterface( | ||
63 | NSResources->system().findInterface( interfacename ) ); | ||
64 | } else { | ||
65 | Log(( "Profile nr %d no longer defined\n", | ||
66 | profilenr )); | ||
67 | } | ||
68 | } | ||
69 | } | ||
70 | } | ||
32 | } | 71 | } |
33 | 72 | ||
34 | // saving is done by caller | 73 | // saving is done by caller |
35 | NetworkSettingsData::~NetworkSettingsData( void ) { | 74 | NetworkSettingsData::~NetworkSettingsData( void ) { |
36 | delete NSResources; | 75 | delete NSResources; |
37 | } | 76 | } |
38 | 77 | ||
39 | void NetworkSettingsData::loadSettings( void ) { | 78 | void NetworkSettingsData::loadSettings( void ) { |
40 | QString Line, S; | 79 | QString Line, S; |
41 | QString Attr, Value; | 80 | QString Attr, Value; |
42 | long idx; | 81 | long idx; |
43 | 82 | ||
44 | QFile F( CfgFile ); | 83 | QFile F( CfgFile ); |
45 | QTextStream TS( &F ); | 84 | QTextStream TS( &F ); |
46 | 85 | ||
86 | ForceModified = 0; | ||
87 | |||
47 | do { | 88 | do { |
48 | 89 | ||
49 | if( ! F.open(IO_ReadOnly) ) | 90 | if( ! F.open(IO_ReadOnly) ) |
50 | break; | 91 | break; |
51 | 92 | ||
52 | /* load the file -> | 93 | /* load the file -> |
53 | 94 | ||
54 | FORMAT : | 95 | FORMAT : |
55 | 96 | ||
56 | [NETNODETYPE] | 97 | [NETNODETYPE] |
57 | Entries ... | 98 | Entries ... |
58 | <EMPTYLINE> | 99 | <EMPTYLINE> |
59 | [connection] | 100 | [connection] |
60 | Name=Name | 101 | Name=Name |
61 | Node=Name | 102 | Node=Name |
62 | <EMPTYLINE> | 103 | <EMPTYLINE> |
63 | */ | 104 | */ |
64 | while( ! TS.atEnd() ) { | 105 | while( ! TS.atEnd() ) { |
65 | S = Line = TS.readLine(); | 106 | S = Line = TS.readLine(); |
66 | 107 | ||
67 | if ( S.isEmpty() || S[0] != '[' ) | 108 | if ( S.isEmpty() || S[0] != '[' ) |
68 | continue; | 109 | continue; |
69 | 110 | ||
70 | S = S.mid( 1, S.length()-2 ); | 111 | S = S.mid( 1, S.length()-2 ); |
71 | 112 | ||
72 | if( ! NSResources ) { | 113 | if( ! NSResources ) { |
73 | continue; | 114 | continue; |
74 | } | 115 | } |
75 | 116 | ||
76 | if( S == "connection" ) { | 117 | if( S == "connection" ) { |
77 | // load connections -> collections of nodes | 118 | // load connections -> collections of nodes |
78 | NodeCollection * NC = new NodeCollection( TS ); | 119 | NodeCollection * NC = new NodeCollection( TS ); |
79 | NSResources->addConnection( NC ); | 120 | NSResources->addConnection( NC ); |
80 | } else { | 121 | } else { |
81 | ANetNode * NN = 0; | 122 | ANetNode * NN = 0; |
82 | ANetNodeInstance* NNI = 0; | 123 | ANetNodeInstance* NNI = 0; |
83 | if( S.startsWith( "nodetype " ) ) { | 124 | if( S.startsWith( "nodetype " ) ) { |
84 | S = S.mid( 9, S.length()-9 ); | 125 | S = S.mid( 9, S.length()-9 ); |
85 | S = deQuote(S); | 126 | S = deQuote(S); |
86 | // try to find netnode | 127 | // try to find netnode |
87 | NN = NSResources->findNetNode( S ); | 128 | NN = NSResources->findNetNode( S ); |
88 | Log( ( "Node %s : %p\n", S.latin1(), NN ) ); | ||
89 | } else { | 129 | } else { |
90 | // try to find instance | 130 | // try to find instance |
91 | NNI = NSResources->createNodeInstance( S ); | 131 | NNI = NSResources->createNodeInstance( S ); |
92 | Log( ( "NodeInstance %s : %p\n", S.latin1(), NNI )); | ||
93 | } | 132 | } |
94 | 133 | ||
95 | if( NN == 0 && NNI == 0 ) { | 134 | if( NN == 0 && NNI == 0 ) { |
96 | LeftOvers.append( Line ); | 135 | LeftOvers.append( Line ); |
97 | } | 136 | } |
98 | 137 | ||
99 | do { | 138 | do { |
100 | S = Line = TS.readLine(); | 139 | S = Line = TS.readLine(); |
101 | 140 | ||
102 | if( NN || NNI ) { | 141 | if( NN || NNI ) { |
103 | if( S.isEmpty() ) { | 142 | if( S.isEmpty() ) { |
104 | // empty line | 143 | // empty line |
105 | break; | 144 | break; |
106 | } | 145 | } |
107 | idx = S.find( '=' ); | 146 | idx = S.find( '=' ); |
108 | if( idx > 0 ) { | 147 | if( idx > 0 ) { |
109 | Attr = S.left( idx ); | 148 | Attr = S.left( idx ); |
110 | Value = S.mid( idx+1, S.length() ); | 149 | Value = S.mid( idx+1, S.length() ); |
111 | } else { | 150 | } else { |
112 | Value=""; | 151 | Value=""; |
113 | Attr = S; | 152 | Attr = S; |
114 | } | 153 | } |
115 | 154 | ||
116 | Value.stripWhiteSpace(); | 155 | Value.stripWhiteSpace(); |
117 | Attr.stripWhiteSpace(); | 156 | Attr.stripWhiteSpace(); |
118 | Attr.lower(); | 157 | Attr.lower(); |
119 | // dequote Attr | 158 | // dequote Attr |
120 | Value = deQuote(Value); | 159 | Value = deQuote(Value); |
121 | 160 | ||
122 | if( NN ) { | 161 | if( NN ) { |
123 | // set the attribute | 162 | // set the attribute |
124 | NN->setAttribute( Attr, Value ); | 163 | NN->setAttribute( Attr, Value ); |
125 | } else { | 164 | } else { |
126 | // set the attribute | 165 | // set the attribute |
127 | NNI->setAttribute( Attr, Value ); | 166 | NNI->setAttribute( Attr, Value ); |
128 | } | 167 | } |
129 | } else { | 168 | } else { |
130 | LeftOvers.append( Line ); | 169 | LeftOvers.append( Line ); |
131 | // add empty line too as delimiter | 170 | // add empty line too as delimiter |
132 | if( S.isEmpty() ) { | 171 | if( S.isEmpty() ) { |
133 | // empty line | 172 | // empty line |
134 | break; | 173 | break; |
135 | } | 174 | } |
136 | } | 175 | } |
137 | } while( 1 ); | 176 | } while( 1 ); |
138 | 177 | ||
139 | if( NNI ) { | 178 | if( NNI ) { |
140 | // loading from file -> exists | 179 | // loading from file -> exists |
180 | Log( ( "NodeInstance %s : %p\n", NNI->name(), NNI )); | ||
141 | NNI->setNew( FALSE ); | 181 | NNI->setNew( FALSE ); |
142 | NSResources->addNodeInstance( NNI ); | 182 | NSResources->addNodeInstance( NNI ); |
143 | } | 183 | } |
184 | if( NN ) { | ||
185 | Log( ( "Node %s : %p\n", NN->name(), NN ) ); | ||
186 | } | ||
144 | } | 187 | } |
145 | } | 188 | } |
146 | 189 | ||
147 | } while( 0 ); | 190 | } while( 0 ); |
148 | 191 | ||
149 | } | 192 | } |
150 | 193 | ||
151 | QString NetworkSettingsData::saveSettings( void ) { | 194 | QString NetworkSettingsData::saveSettings( void ) { |
152 | QString ErrS = ""; | 195 | QString ErrS = ""; |
153 | 196 | ||
154 | if( ! isModified() ) | 197 | if( ! isModified() ) |
155 | return ErrS; | 198 | return ErrS; |
156 | 199 | ||
157 | QString S; | 200 | QString S; |
158 | QFile F( CfgFile + ".bup" ); | 201 | QFile F( CfgFile + ".bup" ); |
159 | 202 | ||
160 | Log( ( "Saving settings to %s\n", CfgFile.latin1() )); | 203 | Log( ( "Saving settings to %s\n", CfgFile.latin1() )); |
161 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { | 204 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { |
162 | ErrS = qApp->translate( "NetworkSettings", | 205 | ErrS = qApp->translate( "NetworkSettings", |
163 | "<p>Could not save setup to \"%1\" !</p>" ). | 206 | "<p>Could not save setup to \"%1\" !</p>" ). |
164 | arg(CfgFile); | 207 | arg(CfgFile); |
165 | // problem | 208 | // problem |
166 | return ErrS; | 209 | return ErrS; |
167 | } | 210 | } |
168 | 211 | ||
169 | QTextStream TS( &F ); | 212 | QTextStream TS( &F ); |
170 | 213 | ||
171 | // save leftovers | 214 | // save leftovers |
172 | for ( QStringList::Iterator it = LeftOvers.begin(); | 215 | for ( QStringList::Iterator it = LeftOvers.begin(); |
173 | it != LeftOvers.end(); ++it ) { | 216 | it != LeftOvers.end(); ++it ) { |
174 | TS << (*it) << endl; | 217 | TS << (*it) << endl; |
175 | } | 218 | } |
176 | 219 | ||
177 | // save global configs | 220 | // save global configs |
178 | for( QDictIterator<NetNode_t> it( NSResources->netNodes() ); | 221 | for( QDictIterator<NetNode_t> it( NSResources->netNodes() ); |
179 | it.current(); | 222 | it.current(); |
180 | ++it ) { | 223 | ++it ) { |
181 | TS << "[nodetype " | 224 | TS << "[nodetype " |
182 | << quote( QString( it.current()->NetNode->name() ) ) | 225 | << quote( QString( it.current()->NetNode->name() ) ) |
183 | << "]" | 226 | << "]" |
184 | << endl; | 227 | << endl; |
185 | 228 | ||
186 | it.current()->NetNode->saveAttributes( TS ); | 229 | it.current()->NetNode->saveAttributes( TS ); |
187 | TS << endl; | 230 | TS << endl; |
188 | } | 231 | } |
189 | 232 | ||
190 | { Name2Connection_t & M = NSResources->connections(); | 233 | { Name2Connection_t & M = NSResources->connections(); |
191 | ANetNodeInstance * NNI; | 234 | ANetNodeInstance * NNI; |
192 | 235 | ||
193 | // for all connections | 236 | // for all connections |
194 | for( QDictIterator<NodeCollection> it(M); | 237 | for( QDictIterator<NodeCollection> it(M); |
195 | it.current(); | 238 | it.current(); |
196 | ++it ) { | 239 | ++it ) { |
197 | // all nodes in those connections | 240 | // all nodes in those connections |
198 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); | 241 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); |
199 | nit.current(); | 242 | nit.current(); |
200 | ++nit ) { | 243 | ++nit ) { |
201 | // header | 244 | // header |
202 | NNI = nit.current(); | 245 | NNI = nit.current(); |
203 | TS << '[' | 246 | TS << '[' |
204 | << QString(NNI->nodeClass()->name()) | 247 | << QString(NNI->nodeClass()->name()) |
205 | << ']' | 248 | << ']' |
206 | << endl; | 249 | << endl; |
207 | NNI->saveAttributes( TS ); | 250 | NNI->saveAttributes( TS ); |
208 | TS << endl; | 251 | TS << endl; |
209 | } | 252 | } |
210 | 253 | ||
211 | TS << "[connection]" << endl; | 254 | TS << "[connection]" << endl; |
212 | it.current()->save(TS); | 255 | it.current()->save(TS); |
213 | } | 256 | } |
214 | } | 257 | } |
215 | 258 | ||
216 | QDir D("."); | 259 | QDir D("."); |
217 | D.rename( CfgFile + ".bup", CfgFile ); | 260 | D.rename( CfgFile + ".bup", CfgFile ); |
218 | 261 | ||
219 | // | 262 | // |
220 | // proper files AND system files regenerated | 263 | // proper files AND system files regenerated |
221 | // | 264 | // |
222 | 265 | ||
223 | setModified( 0 ); | 266 | |
267 | for( QDictIterator<NodeCollection> it(NSResources->connections()); | ||
268 | it.current(); | ||
269 | ++it ) { | ||
270 | it.current()->setModified( 0 ); | ||
271 | } | ||
272 | |||
224 | return ErrS; | 273 | return ErrS; |
225 | } | 274 | } |
226 | 275 | ||
227 | QString NetworkSettingsData::generateSettings( void ) { | 276 | QString NetworkSettingsData::generateSettings( void ) { |
228 | QString S = ""; | 277 | QString S = ""; |
229 | Name2SystemFile_t & SFM = NSResources->systemFiles(); | 278 | Name2SystemFile_t & SFM = NSResources->systemFiles(); |
230 | Name2Connection_t & M = NSResources->connections(); | 279 | Name2Connection_t & M = NSResources->connections(); |
231 | NodeCollection * NC; | 280 | NodeCollection * NC; |
232 | ANetNodeInstance * NNI; | 281 | ANetNodeInstance * NNI; |
233 | ANetNodeInstance * FirstWithData; | 282 | ANetNodeInstance * FirstWithData; |
234 | SystemFile * SF; | 283 | RuntimeInfo * CurDev; |
235 | AsDevice * CurDev; | ||
236 | ANetNode * NN, * CurDevNN = 0; | 284 | ANetNode * NN, * CurDevNN = 0; |
237 | long NoOfDevs; | 285 | long NoOfDevs; |
238 | long DevCtStart; | 286 | long DevCtStart; |
239 | bool needToGenerate; | 287 | bool needToGenerate; |
240 | 288 | ||
241 | // regenerate system files | 289 | // regenerate system files |
242 | Log( ( "Generating settings from %s\n", CfgFile.latin1() )); | 290 | Log( ( "Generating settings from %s\n", CfgFile.latin1() )); |
243 | 291 | ||
244 | // | 292 | for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); |
245 | // generate files proper to each netnodeinstance | 293 | nnit.current(); |
246 | // | 294 | ++nnit ) { |
247 | { Name2Instance_t & NNIs = NSResources->netNodeInstances(); | 295 | { QStringList SL; |
248 | 296 | bool FirstItem = 1; | |
249 | for( QDictIterator<ANetNodeInstance> NNIIt(NNIs); | 297 | bool Generated = 0; |
250 | NNIIt.current(); | 298 | |
251 | ++NNIIt ) { | 299 | CurDevNN = nnit.current()->NetNode; |
252 | // for all nodes find those that are modified | 300 | SL = CurDevNN->properFiles(); |
253 | NNI = NNIIt.current(); | 301 | |
254 | 302 | for ( QStringList::Iterator it = SL.begin(); | |
255 | { // get list of proper files for this nodeclass (if any) | 303 | it != SL.end(); |
256 | QStringList * PF = NNI->nodeClass()->properFiles(); | 304 | ++it ) { |
257 | 305 | ||
258 | if( PF ) { | 306 | Generated = 0; |
259 | for ( QStringList::Iterator it = PF->begin(); | 307 | FirstItem = 1; |
260 | it != PF->end(); | 308 | // iterate over NNI's of this class |
261 | ++it ) { | 309 | for( QDictIterator<ANetNodeInstance> nniit( |
262 | QFile * F = NNI->openFile( (*it) ); | 310 | NSResources->netNodeInstances() ); |
263 | if( F ) { | 311 | nniit.current(); |
264 | QTextStream TS( F ); | 312 | ++nniit ) { |
265 | if( NNI->generateFile( (*it), F->name(), TS, -1 ) == 2 ) { | 313 | if( nniit.current()->nodeClass() != CurDevNN ) |
266 | // problem generating | 314 | // different class |
315 | continue; | ||
316 | |||
317 | // open proper file | ||
318 | { SystemFile SF( (*it) ); | ||
319 | |||
320 | if( ! CurDevNN->openFile( SF, nniit.current()) ) { | ||
321 | // cannot open | ||
322 | S = qApp->translate( "NetworkSettings", | ||
323 | "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ). | ||
324 | arg( (*it) ).arg( CurDevNN->name() ); | ||
325 | return S; | ||
326 | } | ||
327 | |||
328 | if( ! SF.open() ) { | ||
329 | S = qApp->translate( "NetworkSettings", | ||
330 | "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ). | ||
331 | arg( (*it) ).arg( CurDevNN->name() ); | ||
332 | return S; | ||
333 | } | ||
334 | |||
335 | // preamble on first | ||
336 | if( FirstItem ) { | ||
337 | if( CurDevNN->generatePreamble( SF ) == 2 ) { | ||
267 | S = qApp->translate( "NetworkSettings", | 338 | S = qApp->translate( "NetworkSettings", |
268 | "<p>Cannot generate files proper to \"%1\"</p>" ). | 339 | "<p>Error in section \"preamble\" for proper file \"%1\" and node \"%2\"</p>" ). |
269 | arg(NNI->nodeClass()->name()) ; | 340 | arg( (*it) ). |
270 | delete F; | 341 | arg( CurDevNN->name() ); |
271 | return S; | 342 | return S; |
272 | } | 343 | } |
273 | delete F; | 344 | } |
345 | FirstItem = 0; | ||
346 | Generated = 1; | ||
347 | |||
348 | // item specific | ||
349 | if( nniit.current()->generateFile( SF, -1 ) == 2 ) { | ||
350 | S = qApp->translate( "NetworkSettings", | ||
351 | "<p>Error in section for node \"%1\" for proper file \"%2\" and node class \"%3\"</p>" ). | ||
352 | arg( nniit.current()->name() ). | ||
353 | arg( (*it) ). | ||
354 | arg( CurDevNN->name() ); | ||
355 | return S; | ||
274 | } | 356 | } |
275 | } | 357 | } |
276 | } | 358 | } |
359 | |||
360 | if( Generated ) { | ||
361 | SystemFile SF( (*it) ); | ||
362 | |||
363 | if( CurDevNN->openFile( SF, 0 ) && | ||
364 | ! SF.path().isEmpty() | ||
365 | ) { | ||
366 | |||
367 | if( ! SF.open() ) { | ||
368 | S = qApp->translate( "NetworkSettings", | ||
369 | "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ). | ||
370 | arg( (*it) ).arg( CurDevNN->name() ); | ||
371 | return S; | ||
372 | } | ||
373 | |||
374 | if( CurDevNN->generatePostamble( SF ) == 2 ) { | ||
375 | S = qApp->translate( "NetworkSettings", | ||
376 | "<p>Error in section \"postamble\" for proper file \"%1\" and node \"%2\"</p>" ). | ||
377 | arg( (*it) ). | ||
378 | arg( CurDevNN->name() ); | ||
379 | return S; | ||
380 | } | ||
381 | } // no postamble | ||
382 | } | ||
277 | } | 383 | } |
278 | } | 384 | } |
279 | } | 385 | } |
280 | 386 | ||
281 | // | 387 | // |
282 | // generate all system files | 388 | // generate all registered files |
283 | // | 389 | // |
284 | for( QDictIterator<SystemFile> sfit(SFM); | 390 | for( QDictIterator<SystemFile> sfit(SFM); |
285 | sfit.current(); | 391 | sfit.current(); |
286 | ++sfit ) { | 392 | ++sfit ) { |
393 | SystemFile * SF; | ||
394 | |||
287 | SF = sfit.current(); | 395 | SF = sfit.current(); |
288 | 396 | ||
289 | // reset all | 397 | // reset all |
290 | for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); | 398 | for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); |
291 | nnit.current(); | 399 | nnit.current(); |
292 | ++nnit ) { | 400 | ++nnit ) { |
293 | nnit.current()->NetNode->setDone(0); | 401 | nnit.current()->NetNode->setDone(0); |
294 | } | 402 | } |
295 | 403 | ||
296 | for( QDictIterator<ANetNodeInstance> nniit( | 404 | for( QDictIterator<ANetNodeInstance> nniit( |
297 | NSResources->netNodeInstances() ); | 405 | NSResources->netNodeInstances() ); |
298 | nniit.current(); | 406 | nniit.current(); |
299 | ++nniit ) { | 407 | ++nniit ) { |
300 | nniit.current()->setDone(0); | 408 | nniit.current()->setDone(0); |
301 | } | 409 | } |
302 | 410 | ||
303 | for( QDictIterator<NodeCollection> ncit(M); | 411 | for( QDictIterator<NodeCollection> ncit(M); |
304 | ncit.current(); | 412 | ncit.current(); |
305 | ++ncit ) { | 413 | ++ncit ) { |
306 | ncit.current()->setDone(0); | 414 | ncit.current()->setDone(0); |
307 | } | 415 | } |
308 | 416 | ||
309 | Log( ( "Generating %s\n", SF->name().latin1() )); | 417 | Log( ( "Generating system file %s\n", SF->name().latin1() )); |
310 | 418 | ||
311 | needToGenerate = 0; | 419 | needToGenerate = 0; |
312 | 420 | ||
313 | // are there netnodes that have instances and need | 421 | // are there netnodes that have instances and need |
314 | // to write data in this system file ? | 422 | // to write data in this system file ? |
315 | for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); | 423 | for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); |
316 | ! needToGenerate && nnit.current(); | 424 | ! needToGenerate && nnit.current(); |
317 | ++nnit ) { | 425 | ++nnit ) { |
318 | 426 | ||
319 | NN = nnit.current()->NetNode; | 427 | NN = nnit.current()->NetNode; |
320 | 428 | ||
321 | if( NN->hasDataForFile( SF->name() ) ) { | 429 | if( NN->hasDataForFile( *SF ) ) { |
322 | // netnode can have data | 430 | // netnode can have data |
323 | 431 | ||
324 | // are there instances of this node ? | 432 | // are there instances of this node ? |
325 | for( QDictIterator<ANetNodeInstance> nniit( | 433 | for( QDictIterator<ANetNodeInstance> nniit( |
326 | NSResources->netNodeInstances() ); | 434 | NSResources->netNodeInstances() ); |
327 | ! needToGenerate && nniit.current(); | 435 | ! needToGenerate && nniit.current(); |
328 | ++nniit ) { | 436 | ++nniit ) { |
329 | if( nniit.current()->nodeClass() == NN ) { | 437 | if( nniit.current()->nodeClass() == NN ) { |
330 | // yes | 438 | // yes |
331 | Log(("Node %s has data\n", | 439 | Log(("Node %s has data\n", |
332 | nniit.current()->name() )); | 440 | nniit.current()->name() )); |
333 | needToGenerate = 1; | 441 | needToGenerate = 1; |
334 | break; | 442 | break; |
335 | } | 443 | } |
336 | } | 444 | } |
337 | } | 445 | } |
338 | } | 446 | } |
339 | 447 | ||
340 | if( ! needToGenerate ) { | 448 | if( ! needToGenerate ) { |
341 | // no instances found that might need to write data | 449 | // no instances found that might need to write data |
342 | // in this systemfile | 450 | // in this systemfile |
343 | Log(("No nodes for systemfile %s\n", SF->name().latin1() )); | 451 | Log(("No nodes for systemfile %s\n", SF->name().latin1() )); |
344 | continue; | 452 | continue; |
345 | } | 453 | } |
346 | 454 | ||
347 | // ok generate this system file | 455 | // ok generate this system file |
348 | SF->open(); | 456 | if( ! SF->open() ) { |
457 | S = qApp->translate( "NetworkSettings", | ||
458 | "<p>Cannot open system file \"%1\"</p>" ). | ||
459 | arg( SF->name() ); | ||
460 | return S; | ||
461 | } | ||
349 | 462 | ||
350 | // global presection for this system file | 463 | // global presection for this system file |
351 | if( ! SF->preSection() ) { | 464 | if( ! SF->preSection() ) { |
352 | S = qApp->translate( "NetworkSettings", | 465 | S = qApp->translate( "NetworkSettings", |
353 | "<p>Error in section \"Preamble\" for file \"%1\"</p>" ). | 466 | "<p>Error in section \"Preamble\" for file \"%1\"</p>" ). |
354 | arg( SF->name() ); | 467 | arg( SF->name() ); |
355 | return S; | 468 | return S; |
356 | } | 469 | } |
357 | 470 | ||
358 | // find connections that want to write to this file | 471 | // find connections that want to write to this file |
359 | for( QDictIterator<NodeCollection> ncit(M); | 472 | for( QDictIterator<NodeCollection> ncit(M); |
360 | ncit.current(); | 473 | ncit.current(); |
361 | ++ncit ) { | 474 | ++ncit ) { |
362 | 475 | ||
363 | NC = ncit.current(); | 476 | NC = ncit.current(); |
364 | 477 | ||
365 | if( NC->done() ) { | 478 | if( NC->done() ) { |
366 | // already done | 479 | // already done |
367 | continue; | 480 | continue; |
368 | } | 481 | } |
369 | 482 | ||
370 | if( ! NC->hasDataForFile( SF->name() ) ) { | 483 | if( ! NC->hasDataForFile( *SF ) ) { |
371 | // no data | 484 | // no data |
372 | continue; | 485 | continue; |
373 | } | 486 | } |
374 | 487 | ||
375 | Log(("Generating %s for connection %s\n", | 488 | Log(("Generating %s for connection %s\n", |
376 | SF->name().latin1(), NC->name().latin1() )); | 489 | SF->name().latin1(), NC->name().latin1() )); |
377 | // find highest item that wants to write data to this file | 490 | // find highest item that wants to write data to this file |
378 | FirstWithData = NC->firstWithDataForFile( SF->name() ); | 491 | FirstWithData = NC->firstWithDataForFile( *SF ); |
379 | 492 | ||
380 | // find device on which this connection works | 493 | // find device on which this connection works |
381 | CurDev = NC->device(); | 494 | CurDev = NC->device(); |
382 | // class of that node | 495 | // class of that node |
383 | CurDevNN = CurDev->netNode()->nodeClass(); | 496 | CurDevNN = CurDev->netNode()->nodeClass(); |
384 | 497 | ||
385 | Log(( "%s is done %d\n", | ||
386 | FirstWithData->nodeClass()->name(), | ||
387 | FirstWithData->nodeClass()->done() )); | ||
388 | |||
389 | if( ! FirstWithData->nodeClass()->done() ) { | 498 | if( ! FirstWithData->nodeClass()->done() ) { |
390 | // generate fixed part | 499 | // generate fixed part |
391 | if( ! SF->preDeviceSection( CurDevNN ) ) { | 500 | if( ! SF->preDeviceSection( CurDevNN ) ) { |
392 | S = qApp->translate( "NetworkSettings", | 501 | S = qApp->translate( "NetworkSettings", |
393 | "<p>Error in section \"Pre-Device\" for file \"%1\"</p>" ). | 502 | "<p>Error in section \"Pre-Device\" for file \"%1\"</p>" ). |
394 | arg( SF->name() ); | 503 | arg( SF->name() ); |
395 | return S; | 504 | return S; |
396 | } | 505 | } |
397 | 506 | ||
398 | if( FirstWithData->nodeClass()->generateFile( | 507 | if( FirstWithData->nodeClass()->generateFile( |
399 | SF->name(), SF->path(), *SF, -1 ) == 2 ) { | 508 | *SF, |
509 | FirstWithData, | ||
510 | -2 ) == 2 ) { | ||
400 | S = qApp->translate( "NetworkSettings", | 511 | S = qApp->translate( "NetworkSettings", |
401 | "<p>Error in section \"Common\" for file \"%1\" and node \"%2\"</p>" ). | 512 | "<p>Error in section \"Common\" for file \"%1\" and node \"%2\"</p>" ). |
402 | arg( SF->name() ). | 513 | arg( SF->name() ). |
403 | arg( CurDevNN->name() ); | 514 | arg( CurDevNN->name() ); |
404 | return S; | 515 | return S; |
405 | } | 516 | } |
406 | FirstWithData->nodeClass()->setDone( 1 ); | 517 | FirstWithData->nodeClass()->setDone( 1 ); |
518 | Log(( "Systemfile %s for node instance %s is done\n", | ||
519 | SF->name().latin1(), | ||
520 | FirstWithData->name() )); | ||
407 | } | 521 | } |
408 | 522 | ||
409 | NoOfDevs = 0; | 523 | NoOfDevs = 0; |
410 | DevCtStart = -1; | 524 | DevCtStart = -1; |
411 | 525 | ||
412 | if( SF->knowsDeviceInstances() ) { | 526 | if( SF->knowsDeviceInstances() ) { |
413 | DevCtStart = 0; | 527 | DevCtStart = 0; |
414 | NoOfDevs = CurDevNN->instanceCount(); | 528 | NoOfDevs = CurDevNN->instanceCount(); |
415 | } | 529 | } |
416 | 530 | ||
417 | Log(( "Node %s is done %d\n", | ||
418 | CurDev->netNode()->nodeClass()->name(), | ||
419 | CurDev->netNode()->nodeClass()->done() )); | ||
420 | |||
421 | if( ! CurDev->netNode()->nodeClass()->done() ) { | 531 | if( ! CurDev->netNode()->nodeClass()->done() ) { |
422 | // first time this device is handled | 532 | // first time this device is handled |
423 | // generate common device specific part | 533 | // generate common device specific part |
424 | for( int i = DevCtStart; i < NoOfDevs ; i ++ ) { | 534 | for( int i = DevCtStart; i < NoOfDevs ; i ++ ) { |
425 | 535 | ||
426 | if( FirstWithData->nodeClass()->generateFile( | 536 | if( FirstWithData->nodeClass()->generateFile( |
427 | SF->name(), SF->path(), *SF, CurDev->netNode(), i ) == 2 ) { | 537 | *SF, CurDev->netNode(), i ) == 2 ) { |
428 | S = qApp->translate( "NetworkSettings", | 538 | S = qApp->translate( "NetworkSettings", |
429 | "<p>Error in section \"Device\" for file \"%1\" and node \"%2\"</p>" ). | 539 | "<p>Error in section \"Device\" for file \"%1\" and node \"%2\"</p>" ). |
430 | arg( SF->name() ). | 540 | arg( SF->name() ). |
431 | arg( CurDevNN->name() ); | 541 | arg( CurDevNN->name() ); |
432 | return S; | 542 | return S; |
433 | } | 543 | } |
434 | } | 544 | } |
435 | CurDev->netNode()->nodeClass()->setDone( 1 ); | 545 | CurDev->netNode()->nodeClass()->setDone( 1 ); |
546 | |||
547 | Log(( "Systemfile %s for Nodeclass %s is done\n", | ||
548 | SF->name().latin1(), | ||
549 | CurDev->netNode()->nodeClass()->name() | ||
550 | )); | ||
436 | } | 551 | } |
437 | 552 | ||
438 | // generate profile specific info | 553 | // generate profile specific info |
439 | // for all nodeconnections that work on the same device | 554 | // for all nodeconnections that work on the same device |
440 | for( QDictIterator<NodeCollection> ncit2(M); | 555 | for( QDictIterator<NodeCollection> ncit2(M); |
441 | ncit2.current(); | 556 | ncit2.current(); |
442 | ++ncit2 ) { | 557 | ++ncit2 ) { |
443 | 558 | ||
444 | if( ncit2.current()->device() != CurDev ) { | 559 | if( ncit2.current()->device() != CurDev ) { |
445 | // different device | 560 | // different device |
446 | continue; | 561 | continue; |
447 | } | 562 | } |
448 | 563 | ||
449 | Log(("Connection %s of same family\n", ncit2.current()->name().latin1() )); | 564 | Log(("Connection %s of family %s\n", |
565 | ncit2.current()->name().latin1(), | ||
566 | CurDev->name() )); | ||
450 | // generate | 567 | // generate |
451 | NNI = ncit2.current()->firstWithDataForFile( SF->name() ); | 568 | NNI = ncit2.current()->firstWithDataForFile( *SF ); |
452 | for( int i = DevCtStart; i < NoOfDevs ; i ++ ) { | 569 | for( int i = DevCtStart; i < NoOfDevs ; i ++ ) { |
453 | if( ! SF->preNodeSection( NNI, i ) ) { | 570 | if( ! SF->preNodeSection( NNI, i ) ) { |
454 | S = qApp->translate( "NetworkSettings", | 571 | S = qApp->translate( "NetworkSettings", |
455 | "<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ). | 572 | "<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ). |
456 | arg( SF->name() ). | 573 | arg( SF->name() ). |
457 | arg( CurDevNN->name() ); | 574 | arg( CurDevNN->name() ); |
458 | return S; | 575 | return S; |
459 | } | 576 | } |
460 | 577 | ||
461 | switch( NNI->generateFile( | 578 | switch( NNI->generateFile( *SF, i ) ) { |
462 | SF->name(), SF->path(), *SF, i ) ) { | ||
463 | case 0 : | 579 | case 0 : |
464 | (*SF) << endl; | 580 | (*SF) << endl; |
465 | break; | 581 | break; |
466 | case 1 : | 582 | case 1 : |
467 | break; | 583 | break; |
468 | case 2 : | 584 | case 2 : |
469 | S = qApp->translate( "NetworkSettings", | 585 | S = qApp->translate( "NetworkSettings", |
470 | "<p>Error in section \"Node\" for file \"%1\" and node \"%2\"</p>" ). | 586 | "<p>Error in section \"Node\" for file \"%1\" and node \"%2\"</p>" ). |
471 | arg( SF->name() ). | 587 | arg( SF->name() ). |
472 | arg( CurDevNN->name() ); | 588 | arg( CurDevNN->name() ); |
473 | return S; | 589 | return S; |
474 | } | 590 | } |
475 | 591 | ||
476 | if( ! SF->postNodeSection( NNI, i ) ) { | 592 | if( ! SF->postNodeSection( NNI, i ) ) { |
477 | S = qApp->translate( "NetworkSettings", | 593 | S = qApp->translate( "NetworkSettings", |
478 | "<p>Error in \"Post-Node Part\" for file \"%1\" and node \"%2\"</p>" ). | 594 | "<p>Error in \"Post-Node Part\" for file \"%1\" and node \"%2\"</p>" ). |
479 | arg( SF->name() ). | 595 | arg( SF->name() ). |
480 | arg( CurDevNN->name() ); | 596 | arg( CurDevNN->name() ); |
481 | return S; | 597 | return S; |
482 | } | 598 | } |
483 | } | 599 | } |
484 | 600 | ||
485 | ncit2.current()->setDone( 1 ); | 601 | ncit2.current()->setDone( 1 ); |
486 | 602 | ||
487 | } | 603 | } |
488 | } | 604 | } |
489 | 605 | ||
490 | if( ! SF->postDeviceSection( CurDevNN ) ) { | 606 | if( ! SF->postDeviceSection( CurDevNN ) ) { |
491 | S = qApp->translate( "NetworkSettings", | 607 | S = qApp->translate( "NetworkSettings", |
492 | "<p>Error in section \"Post-Device\" for file \"%1\" and node \"%2\"</p>" ). | 608 | "<p>Error in section \"Post-Device\" for file \"%1\" and node \"%2\"</p>" ). |
493 | arg( SF->name() ). | 609 | arg( SF->name() ). |
494 | arg( CurDevNN->name() ); | 610 | arg( CurDevNN->name() ); |
495 | return S; | 611 | return S; |
496 | } | 612 | } |
497 | 613 | ||
498 | 614 | ||
499 | if( ! SF->postSection() ) { | 615 | if( ! SF->postSection() ) { |
500 | S = qApp->translate( "NetworkSettings", | 616 | S = qApp->translate( "NetworkSettings", |
501 | "<p>Error in section \"Closure\" for file \"%1\"</p>" ). | 617 | "<p>Error in section \"Closure\" for file \"%1\"</p>" ). |
502 | arg( SF->name() ); | 618 | arg( SF->name() ); |
503 | return S; | 619 | return S; |
504 | } | 620 | } |
505 | 621 | ||
506 | // end of file | 622 | // end of file |
507 | SF->close(); | 623 | SF->close(); |
508 | } | 624 | } |
509 | return S; | 625 | return S; |
510 | } | 626 | } |
511 | 627 | ||
512 | QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { | 628 | QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { |
513 | // collect connections that can work on top of this interface | 629 | // collect connections that can work on top of this interface |
514 | NodeCollection * NC; | 630 | NodeCollection * NC; |
515 | QList<NodeCollection> PossibleConnections; | 631 | QList<NodeCollection> PossibleConnections; |
516 | Name2Connection_t & M = NSResources->connections(); | 632 | Name2Connection_t & M = NSResources->connections(); |
517 | 633 | ||
518 | // for all connections | 634 | // for all connections |
519 | for( QDictIterator<NodeCollection> it(M); | 635 | for( QDictIterator<NodeCollection> it(M); |
520 | it.current(); | 636 | it.current(); |
521 | ++it ) { | 637 | ++it ) { |
522 | NC = it.current(); | 638 | NC = it.current(); |
523 | // check if this profile handles the requested interface | 639 | // check if this profile handles the requested interface |
524 | if( NC->handlesInterface( Interface ) && // if different Intf. | 640 | if( NC->handlesInterface( Interface ) && // if different Intf. |
525 | NC->state() != Disabled && // if not enabled | 641 | NC->state() != Disabled && // if not enabled |
526 | NC->state() != IsUp // if already used | 642 | NC->state() != IsUp // if already used |
527 | ) { | 643 | ) { |
528 | Log( ( "Append %s for %s\n", NC->name().latin1(), Interface)); | 644 | Log( ( "Append %s for %s\n", NC->name().latin1(), Interface)); |
529 | PossibleConnections.append( NC ); | 645 | PossibleConnections.append( NC ); |
530 | } | 646 | } |
531 | } | 647 | } |
532 | return PossibleConnections; | 648 | return PossibleConnections; |
533 | } | 649 | } |
534 | 650 | ||
535 | 651 | ||
536 | /* | 652 | /* |
537 | Called by the system to see if interface can be brought UP | 653 | Called by the system to see if interface can be brought UP |
538 | 654 | ||
539 | if allowed, echo Interface-allowed else Interface-disallowed | 655 | if allowed, echo Interface-allowed else Interface-disallowed |
540 | */ | 656 | */ |
541 | 657 | ||
542 | bool NetworkSettingsData::canStart( const char * Interface ) { | 658 | bool NetworkSettingsData::canStart( const char * Interface ) { |
543 | // load situation | 659 | // load situation |
544 | NodeCollection * NC = 0; | 660 | NodeCollection * NC = 0; |
545 | QList<NodeCollection> PossibleConnections; | 661 | QList<NodeCollection> PossibleConnections; |
546 | 662 | ||
547 | PossibleConnections = collectPossible( Interface ); | 663 | PossibleConnections = collectPossible( Interface ); |
548 | 664 | ||
549 | Log( ( "for %s : Possiblilies %d\n", | 665 | Log( ( "for %s : Possiblilies %d\n", |
550 | Interface, PossibleConnections.count() )); | 666 | Interface, PossibleConnections.count() )); |
551 | switch( PossibleConnections.count() ) { | 667 | switch( PossibleConnections.count() ) { |
552 | case 0 : // no connections | 668 | case 0 : // no connections |
553 | break; | 669 | break; |
554 | case 1 : // one connection | 670 | case 1 : // one connection |
555 | NC = PossibleConnections.first(); | 671 | NC = PossibleConnections.first(); |
556 | break; | 672 | break; |
557 | default : // need to ask user ? | 673 | default : // need to ask user ? |
558 | return 1; | 674 | return 1; |
559 | } | 675 | } |
560 | 676 | ||
561 | if( NC ) { | 677 | if( NC ) { |
562 | switch( NC->state() ) { | 678 | switch( NC->state() ) { |
563 | case Unchecked : | 679 | case Unchecked : |
564 | case Unknown : | 680 | case Unknown : |
565 | case Unavailable : | 681 | case Unavailable : |
566 | case Disabled : | 682 | case Disabled : |
567 | // this profile does not allow interface to be UP | 683 | // this profile does not allow interface to be UP |
568 | // -> try others | 684 | // -> try others |
569 | break; | 685 | break; |
570 | case Off : | 686 | case Off : |
571 | // try to UP the device | 687 | // try to UP the device |
572 | if( ! NC->setState( Activate ) ) { | 688 | { QString S= NC->setState( Activate ); |
573 | // cannot bring device Online -> try other alters | 689 | if( ! S.isEmpty() ) { |
574 | break; | 690 | // could not bring device Online -> try other alters |
691 | Log(( "%s-c%d-disallowed : %s\n", | ||
692 | Interface, NC->number(), S.latin1() )); | ||
693 | break; | ||
694 | } | ||
695 | // interface assigned | ||
575 | } | 696 | } |
576 | // FT | 697 | // FT |
577 | case Available : | 698 | case Available : |
578 | case IsUp : // also called for 'ifdown' | 699 | case IsUp : // also called for 'ifdown' |
579 | // device is ready -> done | 700 | // device is ready -> done |
580 | Log(( "%s-c%d-allowed\n", Interface, NC->number() )); | 701 | Log(( "%s-c%d-allowed\n", Interface, NC->number() )); |
581 | printf( "%s-c%d-allowed\n", Interface, NC->number() ); | 702 | printf( "%s-c%d-allowed\n", Interface, NC->number() ); |
582 | return 0; | 703 | return 0; |
583 | } | 704 | } |
584 | } | 705 | } |
585 | 706 | ||
586 | // if we come here no alternatives are possible | 707 | // if we come here no alternatives are possible |
587 | Log(( "%s-cnn-disallowed\n", Interface )); | 708 | Log(( "%s-cnn-disallowed\n", Interface )); |
588 | printf( "%s-cnn-disallowed\n", Interface ); | 709 | printf( "%s-cnn-disallowed\n", Interface ); |
589 | return 0; | 710 | return 0; |
590 | } | 711 | } |
591 | 712 | ||
592 | /* | 713 | bool NetworkSettingsData::isModified( void ) { |
593 | Called by the system to regenerate config files | 714 | if( ForceModified ) |
594 | */ | ||
595 | |||
596 | bool NetworkSettingsData::regenerate( void ) { | ||
597 | QString S = generateSettings(); | ||
598 | if( ! S.isEmpty() ) { | ||
599 | fprintf( stdout, "%s\n", S.latin1() ); | ||
600 | return 1; | 715 | return 1; |
716 | |||
717 | for( QDictIterator<NodeCollection> it(NSResources->connections()); | ||
718 | it.current(); | ||
719 | ++it ) { | ||
720 | if( it.current()->isModified() ) { | ||
721 | return 1; | ||
722 | } | ||
601 | } | 723 | } |
602 | return 0; | 724 | return 0; |
603 | } | 725 | } |
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 @@ | |||
1 | #ifndef __NSDATA_H | 1 | #ifndef __NSDATA_H |
2 | #define __NSDATA_H | 2 | #define __NSDATA_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include <netnode.h> |
5 | 5 | ||
6 | class NetworkSettingsData { | 6 | class NetworkSettingsData { |
7 | 7 | ||
8 | public : | 8 | public : |
9 | 9 | ||
10 | NetworkSettingsData( void ); | 10 | NetworkSettingsData( void ); |
11 | ~NetworkSettingsData( void ); | 11 | ~NetworkSettingsData( void ); |
12 | 12 | ||
13 | void loadSettings( void ); | 13 | void loadSettings( void ); |
14 | QString saveSettings( void ); | 14 | QString saveSettings( void ); |
15 | 15 | ||
16 | QString generateSettings( void ); | 16 | QString generateSettings( void ); |
17 | 17 | ||
18 | bool isModified( void ) | 18 | bool isModified( void ); |
19 | { return IsModified; } | 19 | inline void setModified( bool M ) |
20 | void setModified( bool m ) | 20 | { ForceModified = M; } |
21 | { IsModified = m; } | ||
22 | 21 | ||
23 | QList<NodeCollection> collectPossible( const char * Interface ); | 22 | QList<NodeCollection> collectPossible( const char * Interface ); |
24 | // return TRUE if we need gui to decide | 23 | // return TRUE if we need gui to decide |
25 | bool canStart( const char * Interface ); | 24 | bool canStart( const char * Interface ); |
26 | bool regenerate( void ); | ||
27 | 25 | ||
28 | private : | 26 | private : |
29 | 27 | ||
30 | bool IsModified; | 28 | bool ForceModified; |
31 | 29 | ||
32 | // collect strings in config file nobody wants | 30 | // collect strings in config file nobody wants |
33 | QStringList LeftOvers; | 31 | QStringList LeftOvers; |
34 | |||
35 | }; | 32 | }; |
36 | 33 | ||
37 | #endif | 34 | #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 | |||
@@ -1,105 +1,105 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <qcombobox.h> | 2 | #include <qcombobox.h> |
3 | #include <qmessagebox.h> | 3 | #include <qmessagebox.h> |
4 | #include <qradiobutton.h> | 4 | #include <qradiobutton.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <GUIUtils.h> | 6 | #include <GUIUtils.h> |
7 | #include "PPPAuthedit.h" | 7 | #include "PPPAuthedit.h" |
8 | 8 | ||
9 | PPPAuthEdit::PPPAuthEdit( QWidget * Parent ) : PPPAuthGUI( Parent ){ | 9 | PPPAuthEdit::PPPAuthEdit( QWidget * Parent ) : PPPAuthGUI( Parent ){ |
10 | } | 10 | } |
11 | 11 | ||
12 | bool PPPAuthEdit::PAP_Checked( void ) { | 12 | bool PPPAuthEdit::PAP_Checked( void ) { |
13 | return ( Pap_RB->isChecked() || | 13 | return ( Pap_RB->isChecked() || |
14 | Chap_RB->isChecked() || | 14 | Chap_RB->isChecked() || |
15 | EAP_RB->isChecked() | 15 | EAP_RB->isChecked() |
16 | ); | 16 | ); |
17 | } | 17 | } |
18 | 18 | ||
19 | QString PPPAuthEdit::acceptable( void ) { | 19 | QString PPPAuthEdit::acceptable( void ) { |
20 | if( Login_RB->isChecked() ) { | 20 | if( Login_RB->isChecked() ) { |
21 | if( LoginSend_LE->text().isEmpty() ) | 21 | if( LoginSend_LE->text().isEmpty() ) |
22 | return tr("Login send missing"); | 22 | return tr("Login send missing"); |
23 | if( LoginExpect_LE->text().isEmpty() ) | 23 | if( LoginExpect_LE->text().isEmpty() ) |
24 | return tr("Login expect missing"); | 24 | return tr("Login expect missing"); |
25 | if( PasswordSend_LE->text().isEmpty() ) | 25 | if( PasswordSend_LE->text().isEmpty() ) |
26 | return tr("Password send missing"); | 26 | return tr("Password send missing"); |
27 | if( PasswordExpect_LE->text().isEmpty() ) | 27 | if( PasswordExpect_LE->text().isEmpty() ) |
28 | return tr("Password expect missing"); | 28 | return tr("Password expect missing"); |
29 | } else if( PAP_Checked() ) { | 29 | } else if( PAP_Checked() ) { |
30 | if( Client_LE->text().isEmpty() ) | 30 | if( Client_LE->text().isEmpty() ) |
31 | return tr("Pap/Chap/EAP client id missing"); | 31 | return tr("Pap/Chap/EAP client id missing"); |
32 | if( Server_LE->text().isEmpty() ) | 32 | if( Server_LE->text().isEmpty() ) |
33 | return tr("Pap/Chap/EAP server id missing"); | 33 | return tr("Pap/Chap/EAP server id missing"); |
34 | if( Secret_LE->text().isEmpty() ) | 34 | if( Secret_LE->text().isEmpty() ) |
35 | return tr("Pap/Chap/EAP secret id missing"); | 35 | return tr("Pap/Chap/EAP secret id missing"); |
36 | } | 36 | } |
37 | return QString(); | 37 | return QString(); |
38 | } | 38 | } |
39 | 39 | ||
40 | bool PPPAuthEdit::commit( PPPData_t & D ) { | 40 | bool PPPAuthEdit::commit( PPPData & D ) { |
41 | bool SM = 0; | 41 | bool SM = 0; |
42 | 42 | ||
43 | if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) || | 43 | if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) || |
44 | ( D.Auth.Mode == 1 && ! PAP_Checked() ) || | 44 | ( D.Auth.Mode == 1 && ! PAP_Checked() ) || |
45 | ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) { | 45 | ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) { |
46 | // mode modifed | 46 | // mode modifed |
47 | SM = 1; | 47 | SM = 1; |
48 | D.Auth.Mode = ( Login_RB->isChecked() ) ? | 48 | D.Auth.Mode = ( Login_RB->isChecked() ) ? |
49 | 0 : | 49 | 0 : |
50 | ( PAP_Checked() ) ? 1 : 2; | 50 | ( PAP_Checked() ) ? 1 : 2; |
51 | } | 51 | } |
52 | 52 | ||
53 | if( Login_RB->isChecked() ) { | 53 | if( Login_RB->isChecked() ) { |
54 | TXTM( D.Auth.Login.Expect, LoginExpect_LE, SM ); | 54 | TXTM( D.Auth.Login.Expect, LoginExpect_LE, SM ); |
55 | TXTM( D.Auth.Login.Send, LoginSend_LE, SM ); | 55 | TXTM( D.Auth.Login.Send, LoginSend_LE, SM ); |
56 | TXTM( D.Auth.Password.Expect, PasswordExpect_LE, SM ); | 56 | TXTM( D.Auth.Password.Expect, PasswordExpect_LE, SM ); |
57 | TXTM( D.Auth.Password.Send, PasswordSend_LE, SM ); | 57 | TXTM( D.Auth.Password.Send, PasswordSend_LE, SM ); |
58 | } else if( PAP_Checked() ) { | 58 | } else if( PAP_Checked() ) { |
59 | TXTM( D.Auth.Client, Client_LE, SM ); | 59 | TXTM( D.Auth.Client, Client_LE, SM ); |
60 | TXTM( D.Auth.Server, Server_LE, SM ); | 60 | TXTM( D.Auth.Server, Server_LE, SM ); |
61 | TXTM( D.Auth.Secret, Secret_LE, SM ); | 61 | TXTM( D.Auth.Secret, Secret_LE, SM ); |
62 | if( Pap_RB->isChecked() ) { | 62 | if( Pap_RB->isChecked() ) { |
63 | D.Auth.PCEMode = 0; | 63 | D.Auth.PCEMode = 0; |
64 | } else if( Chap_RB->isChecked() ) { | 64 | } else if( Chap_RB->isChecked() ) { |
65 | D.Auth.PCEMode = 1; | 65 | D.Auth.PCEMode = 1; |
66 | } else if( EAP_RB->isChecked() ) { | 66 | } else if( EAP_RB->isChecked() ) { |
67 | D.Auth.PCEMode = 2; | 67 | D.Auth.PCEMode = 2; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | return SM; | 70 | return SM; |
71 | } | 71 | } |
72 | 72 | ||
73 | void PPPAuthEdit::showData( PPPData_t & D ) { | 73 | void PPPAuthEdit::showData( PPPData & D ) { |
74 | 74 | ||
75 | switch( D.Auth.Mode ) { | 75 | switch( D.Auth.Mode ) { |
76 | case 0 : | 76 | case 0 : |
77 | Login_RB->setChecked( TRUE ); | 77 | Login_RB->setChecked( TRUE ); |
78 | break; | 78 | break; |
79 | case 1 : | 79 | case 1 : |
80 | switch( D.Auth.PCEMode ) { | 80 | switch( D.Auth.PCEMode ) { |
81 | case 0 : | 81 | case 0 : |
82 | Pap_RB->setChecked( TRUE ); | 82 | Pap_RB->setChecked( TRUE ); |
83 | break; | 83 | break; |
84 | case 1 : | 84 | case 1 : |
85 | Chap_RB->setChecked( TRUE ); | 85 | Chap_RB->setChecked( TRUE ); |
86 | break; | 86 | break; |
87 | case 2 : | 87 | case 2 : |
88 | EAP_RB->setChecked( TRUE ); | 88 | EAP_RB->setChecked( TRUE ); |
89 | break; | 89 | break; |
90 | } | 90 | } |
91 | break; | 91 | break; |
92 | case 2 : | 92 | case 2 : |
93 | Terminal_RB->setChecked( TRUE ); | 93 | Terminal_RB->setChecked( TRUE ); |
94 | break; | 94 | break; |
95 | } | 95 | } |
96 | 96 | ||
97 | LoginExpect_LE->setText( D.Auth.Login.Expect ); | 97 | LoginExpect_LE->setText( D.Auth.Login.Expect ); |
98 | PasswordExpect_LE->setText( D.Auth.Password.Expect ); | 98 | PasswordExpect_LE->setText( D.Auth.Password.Expect ); |
99 | LoginSend_LE->setText( D.Auth.Login.Send ); | 99 | LoginSend_LE->setText( D.Auth.Login.Send ); |
100 | PasswordSend_LE->setText( D.Auth.Password.Send ); | 100 | PasswordSend_LE->setText( D.Auth.Password.Send ); |
101 | 101 | ||
102 | Client_LE->setText( D.Auth.Client ); | 102 | Client_LE->setText( D.Auth.Client ); |
103 | Server_LE->setText( D.Auth.Server ); | 103 | Server_LE->setText( D.Auth.Server ); |
104 | Secret_LE->setText( D.Auth.Secret ); | 104 | Secret_LE->setText( D.Auth.Secret ); |
105 | } | 105 | } |
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 | |||
@@ -1,17 +1,17 @@ | |||
1 | #include "pppdata.h" | 1 | #include "pppdata.h" |
2 | #include "PPPAuthGUI.h" | 2 | #include "PPPAuthGUI.h" |
3 | 3 | ||
4 | class PPPAuthEdit : public PPPAuthGUI { | 4 | class PPPAuthEdit : public PPPAuthGUI { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | PPPAuthEdit( QWidget * parent ); | 8 | PPPAuthEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 9 | QString acceptable( void ); |
10 | bool commit( PPPData_t & Data ); | 10 | bool commit( PPPData & Data ); |
11 | void showData( PPPData_t & Data ); | 11 | void showData( PPPData & Data ); |
12 | bool PAP_Checked( void ); | 12 | bool PAP_Checked( void ); |
13 | 13 | ||
14 | 14 | ||
15 | private : | 15 | private : |
16 | 16 | ||
17 | }; | 17 | }; |
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 | |||
@@ -1,108 +1,108 @@ | |||
1 | #include <qtoolbutton.h> | 1 | #include <qtoolbutton.h> |
2 | #include <qmessagebox.h> | 2 | #include <qmessagebox.h> |
3 | #include <qlistbox.h> | 3 | #include <qlistbox.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qradiobutton.h> | 5 | #include <qradiobutton.h> |
6 | #include <resources.h> | 6 | #include <resources.h> |
7 | #include <GUIUtils.h> | 7 | #include <GUIUtils.h> |
8 | #include "PPPDNSedit.h" | 8 | #include "PPPDNSedit.h" |
9 | 9 | ||
10 | PPPDNSEdit::PPPDNSEdit( QWidget * Parent ) : PPPDNSGUI( Parent ){ | 10 | PPPDNSEdit::PPPDNSEdit( QWidget * Parent ) : PPPDNSGUI( Parent ){ |
11 | 11 | ||
12 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 12 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
13 | Remove_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 13 | Remove_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
14 | } | 14 | } |
15 | 15 | ||
16 | QString PPPDNSEdit::acceptable( void ) { | 16 | QString PPPDNSEdit::acceptable( void ) { |
17 | if( DNSFixed_RB->isChecked() ) { | 17 | if( DNSFixed_RB->isChecked() ) { |
18 | if( DomainName_LE->text().isEmpty() ) | 18 | if( DomainName_LE->text().isEmpty() ) |
19 | tr("Domainname needed"); | 19 | tr("Domainname needed"); |
20 | if( Servers_LB->count() == 0 ) | 20 | if( Servers_LB->count() == 0 ) |
21 | tr("DNS Servers needed"); | 21 | tr("DNS Servers needed"); |
22 | } | 22 | } |
23 | return QString(); | 23 | return QString(); |
24 | } | 24 | } |
25 | 25 | ||
26 | bool PPPDNSEdit::commit( PPPData_t & D ) { | 26 | bool PPPDNSEdit::commit( PPPData & D ) { |
27 | bool SM = 0; | 27 | bool SM = 0; |
28 | 28 | ||
29 | CBM( D.DNS.ServerAssigned, DNSServerAssigned_RB, SM ); | 29 | CBM( D.DNS.ServerAssigned, DNSServerAssigned_RB, SM ); |
30 | TXTM( D.DNS.DomainName, DomainName_LE, SM ); | 30 | TXTM( D.DNS.DomainName, DomainName_LE, SM ); |
31 | 31 | ||
32 | // new items in old ? | 32 | // new items in old ? |
33 | for ( unsigned i = 0; i < Servers_LB->count(); i++ ) { | 33 | for ( unsigned i = 0; i < Servers_LB->count(); i++ ) { |
34 | QString S; | 34 | QString S; |
35 | bool Found; | 35 | bool Found; |
36 | Found = 0; | 36 | Found = 0; |
37 | S = Servers_LB->text(i); | 37 | S = Servers_LB->text(i); |
38 | for ( unsigned j = 0; j < D.DNS.Servers.size(); j++ ) { | 38 | for ( unsigned j = 0; j < D.DNS.Servers.size(); j++ ) { |
39 | if( *(D.DNS.Servers[i]) == S ) { | 39 | if( *(D.DNS.Servers[i]) == S ) { |
40 | // still in list | 40 | // still in list |
41 | Found = 1; | 41 | Found = 1; |
42 | break; | 42 | break; |
43 | } | 43 | } |
44 | } | 44 | } |
45 | if( ! Found ) { | 45 | if( ! Found ) { |
46 | SM = 1; | 46 | SM = 1; |
47 | D.DNS.Servers.resize( D.DNS.Servers.size()+1 ); | 47 | D.DNS.Servers.resize( D.DNS.Servers.size()+1 ); |
48 | D.DNS.Servers[D.DNS.Servers.size()] = new QString( S ); | 48 | D.DNS.Servers[D.DNS.Servers.size()] = new QString( S ); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | // old in new ? | 52 | // old in new ? |
53 | for ( unsigned j = 0; j < D.DNS.Servers.size(); j++ ) { | 53 | for ( unsigned j = 0; j < D.DNS.Servers.size(); j++ ) { |
54 | bool Found; | 54 | bool Found; |
55 | Found = 0; | 55 | Found = 0; |
56 | for ( unsigned i = 0; i < Servers_LB->count(); i++ ) { | 56 | for ( unsigned i = 0; i < Servers_LB->count(); i++ ) { |
57 | if( *(D.DNS.Servers[j]) == Servers_LB->text(i) ) { | 57 | if( *(D.DNS.Servers[j]) == Servers_LB->text(i) ) { |
58 | // still in list | 58 | // still in list |
59 | Found = 1; | 59 | Found = 1; |
60 | break; | 60 | break; |
61 | } | 61 | } |
62 | } | 62 | } |
63 | if( ! Found ) { | 63 | if( ! Found ) { |
64 | // old obsolete | 64 | // old obsolete |
65 | SM = 1; | 65 | SM = 1; |
66 | delete D.DNS.Servers[j]; | 66 | delete D.DNS.Servers[j]; |
67 | for( unsigned i = j+1; i < D.DNS.Servers.size(); i ++ ) { | 67 | for( unsigned i = j+1; i < D.DNS.Servers.size(); i ++ ) { |
68 | // compress array | 68 | // compress array |
69 | D.DNS.Servers[i-1] = D.DNS.Servers[i]; | 69 | D.DNS.Servers[i-1] = D.DNS.Servers[i]; |
70 | } | 70 | } |
71 | // shrink | 71 | // shrink |
72 | D.DNS.Servers.resize( D.DNS.Servers.size()-1 ); | 72 | D.DNS.Servers.resize( D.DNS.Servers.size()-1 ); |
73 | } | 73 | } |
74 | } | 74 | } |
75 | return SM; | 75 | return SM; |
76 | } | 76 | } |
77 | 77 | ||
78 | void PPPDNSEdit::showData( PPPData_t & D) { | 78 | void PPPDNSEdit::showData( PPPData & D) { |
79 | 79 | ||
80 | DNSServerAssigned_RB->setChecked( D.DNS.ServerAssigned ); | 80 | DNSServerAssigned_RB->setChecked( D.DNS.ServerAssigned ); |
81 | 81 | ||
82 | DomainName_LE->setText( D.DNS.DomainName ); | 82 | DomainName_LE->setText( D.DNS.DomainName ); |
83 | for( unsigned i = 0; i < D.DNS.Servers.size(); i ++ ) { | 83 | for( unsigned i = 0; i < D.DNS.Servers.size(); i ++ ) { |
84 | Servers_LB->insertItem( *(D.DNS.Servers[i]) ); | 84 | Servers_LB->insertItem( *(D.DNS.Servers[i]) ); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | void PPPDNSEdit::SLOT_AddServer( void ) { | 88 | void PPPDNSEdit::SLOT_AddServer( void ) { |
89 | if( ServerAddress_LE->text().isEmpty() ) | 89 | if( ServerAddress_LE->text().isEmpty() ) |
90 | return; | 90 | return; |
91 | 91 | ||
92 | Servers_LB->insertItem( ServerAddress_LE->text() ); | 92 | Servers_LB->insertItem( ServerAddress_LE->text() ); |
93 | ServerAddress_LE->setText( "" ); | 93 | ServerAddress_LE->setText( "" ); |
94 | } | 94 | } |
95 | 95 | ||
96 | void PPPDNSEdit::SLOT_RemoveServer( void ) { | 96 | void PPPDNSEdit::SLOT_RemoveServer( void ) { |
97 | long i = Servers_LB->currentItem(); | 97 | long i = Servers_LB->currentItem(); |
98 | if( i < 0 ) | 98 | if( i < 0 ) |
99 | return; | 99 | return; |
100 | Servers_LB->removeItem( i ); | 100 | Servers_LB->removeItem( i ); |
101 | if( (unsigned) i >= Servers_LB->count() ) { | 101 | if( (unsigned) i >= Servers_LB->count() ) { |
102 | i --; | 102 | i --; |
103 | } | 103 | } |
104 | if( i >= 0 ) { | 104 | if( i >= 0 ) { |
105 | Servers_LB->setCurrentItem( i ); | 105 | Servers_LB->setCurrentItem( i ); |
106 | } | 106 | } |
107 | 107 | ||
108 | } | 108 | } |
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 | |||
@@ -1,20 +1,20 @@ | |||
1 | #include "pppdata.h" | 1 | #include "pppdata.h" |
2 | #include "PPPDNSGUI.h" | 2 | #include "PPPDNSGUI.h" |
3 | 3 | ||
4 | class PPPDNSEdit : public PPPDNSGUI { | 4 | class PPPDNSEdit : public PPPDNSGUI { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | PPPDNSEdit( QWidget * parent ); | 8 | PPPDNSEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 9 | QString acceptable( void ); |
10 | bool commit( PPPData_t & Data ); | 10 | bool commit( PPPData & Data ); |
11 | void showData( PPPData_t & Data ); | 11 | void showData( PPPData & Data ); |
12 | 12 | ||
13 | public slots : | 13 | public slots : |
14 | 14 | ||
15 | void SLOT_AddServer( void ); | 15 | void SLOT_AddServer( void ); |
16 | void SLOT_RemoveServer( void ); | 16 | void SLOT_RemoveServer( void ); |
17 | 17 | ||
18 | private : | 18 | private : |
19 | 19 | ||
20 | }; | 20 | }; |
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 | |||
@@ -1,103 +1,115 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>PPPGUI</class> | 2 | <class>PPPGUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>PPPGUI</cstring> | 7 | <cstring>PPPGUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>124</width> | 14 | <width>528</width> |
15 | <height>29</height> | 15 | <height>345</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>PPP</string> | 20 | <string>PPP</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>0</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>2</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QComboBox</class> | 38 | <class>QComboBox</class> |
39 | <item> | 39 | <item> |
40 | <property> | 40 | <property> |
41 | <name>text</name> | 41 | <name>text</name> |
42 | <string>Authentication</string> | 42 | <string>Authentication</string> |
43 | </property> | 43 | </property> |
44 | </item> | 44 | </item> |
45 | <item> | 45 | <item> |
46 | <property> | 46 | <property> |
47 | <name>text</name> | 47 | <name>text</name> |
48 | <string>IP settings</string> | 48 | <string>IP settings</string> |
49 | </property> | 49 | </property> |
50 | </item> | 50 | </item> |
51 | <item> | 51 | <item> |
52 | <property> | 52 | <property> |
53 | <name>text</name> | 53 | <name>text</name> |
54 | <string>DNS Settings</string> | 54 | <string>DNS Settings</string> |
55 | </property> | 55 | </property> |
56 | </item> | 56 | </item> |
57 | <item> | ||
58 | <property> | ||
59 | <name>text</name> | ||
60 | <string>Commands</string> | ||
61 | </property> | ||
62 | </item> | ||
63 | <item> | ||
64 | <property> | ||
65 | <name>text</name> | ||
66 | <string>Dialing</string> | ||
67 | </property> | ||
68 | </item> | ||
57 | <property stdset="1"> | 69 | <property stdset="1"> |
58 | <name>name</name> | 70 | <name>name</name> |
59 | <cstring>PPPOptions_CB</cstring> | 71 | <cstring>PPPOptions_CB</cstring> |
60 | </property> | 72 | </property> |
61 | </widget> | 73 | </widget> |
62 | <widget> | 74 | <widget> |
63 | <class>QWidgetStack</class> | 75 | <class>QWidgetStack</class> |
64 | <property stdset="1"> | 76 | <property stdset="1"> |
65 | <name>name</name> | 77 | <name>name</name> |
66 | <cstring>Options_WS</cstring> | 78 | <cstring>Options_WS</cstring> |
67 | </property> | 79 | </property> |
68 | </widget> | 80 | </widget> |
69 | </vbox> | 81 | </vbox> |
70 | </widget> | 82 | </widget> |
71 | <customwidgets> | 83 | <customwidgets> |
72 | <customwidget> | 84 | <customwidget> |
73 | <class>QWidgetStack</class> | 85 | <class>QWidgetStack</class> |
74 | <header location="global">qwidgetstack.h</header> | 86 | <header location="global">qwidgetstack.h</header> |
75 | <sizehint> | 87 | <sizehint> |
76 | <width>-1</width> | 88 | <width>-1</width> |
77 | <height>-1</height> | 89 | <height>-1</height> |
78 | </sizehint> | 90 | </sizehint> |
79 | <container>0</container> | 91 | <container>1</container> |
80 | <sizepolicy> | 92 | <sizepolicy> |
81 | <hordata>7</hordata> | 93 | <hordata>7</hordata> |
82 | <verdata>7</verdata> | 94 | <verdata>7</verdata> |
83 | </sizepolicy> | 95 | </sizepolicy> |
84 | <pixmap>image0</pixmap> | 96 | <pixmap>image0</pixmap> |
85 | <slot access="public">raiseWidget( int )</slot> | 97 | <slot access="public">raiseWidget( int )</slot> |
86 | </customwidget> | 98 | </customwidget> |
87 | </customwidgets> | 99 | </customwidgets> |
88 | <images> | 100 | <images> |
89 | <image> | 101 | <image> |
90 | <name>image0</name> | 102 | <name>image0</name> |
91 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> | 103 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> |
92 | </image> | 104 | </image> |
93 | </images> | 105 | </images> |
94 | <connections> | 106 | <connections> |
95 | <connection> | 107 | <connection> |
96 | <sender>PPPOptions_CB</sender> | 108 | <sender>PPPOptions_CB</sender> |
97 | <signal>activated(int)</signal> | 109 | <signal>activated(int)</signal> |
98 | <receiver>PPPGUI</receiver> | 110 | <receiver>PPPGUI</receiver> |
99 | <slot>SLOT_SelectTopic( int )</slot> | 111 | <slot>SLOT_SelectTopic( int )</slot> |
100 | </connection> | 112 | </connection> |
101 | <slot access="public">SLOT_SelectTopic( int )</slot> | 113 | <slot access="public">SLOT_SelectTopic( int )</slot> |
102 | </connections> | 114 | </connections> |
103 | </UI> | 115 | </UI> |
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 | |||
@@ -1,444 +1,399 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>PPPIPGUI</class> | 2 | <class>PPPIPGUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>PPPIPGUI</cstring> | 7 | <cstring>PPPIPGUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>133</width> | 14 | <width>258</width> |
15 | <height>235</height> | 15 | <height>232</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>PPPIP</string> | 20 | <string>PPPIP</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>3</number> | 31 | <number>0</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>1</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QButtonGroup</class> | 38 | <class>QGroupBox</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>ButtonGroup4</cstring> | 41 | <cstring>GroupBox1</cstring> |
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>frameShape</name> | ||
45 | <enum>Box</enum> | ||
46 | </property> | 42 | </property> |
47 | <property stdset="1"> | 43 | <property stdset="1"> |
48 | <name>title</name> | 44 | <name>title</name> |
49 | <string>IP</string> | 45 | <string>IP</string> |
50 | </property> | 46 | </property> |
51 | <property> | 47 | <property> |
52 | <name>layoutMargin</name> | 48 | <name>layoutMargin</name> |
53 | </property> | 49 | </property> |
54 | <property> | 50 | <property> |
55 | <name>layoutSpacing</name> | 51 | <name>layoutSpacing</name> |
56 | </property> | 52 | </property> |
57 | <vbox> | 53 | <grid> |
58 | <property stdset="1"> | 54 | <property stdset="1"> |
59 | <name>margin</name> | 55 | <name>margin</name> |
60 | <number>2</number> | 56 | <number>3</number> |
61 | </property> | 57 | </property> |
62 | <property stdset="1"> | 58 | <property stdset="1"> |
63 | <name>spacing</name> | 59 | <name>spacing</name> |
64 | <number>2</number> | 60 | <number>2</number> |
65 | </property> | 61 | </property> |
66 | <widget> | 62 | <widget row="0" column="0" > |
67 | <class>QRadioButton</class> | 63 | <class>QLabel</class> |
68 | <property stdset="1"> | 64 | <property stdset="1"> |
69 | <name>name</name> | 65 | <name>name</name> |
70 | <cstring>IPServerAssigned_RB</cstring> | 66 | <cstring>TextLabel1</cstring> |
67 | </property> | ||
68 | <property stdset="1"> | ||
69 | <name>enabled</name> | ||
70 | <bool>true</bool> | ||
71 | </property> | 71 | </property> |
72 | <property stdset="1"> | 72 | <property stdset="1"> |
73 | <name>text</name> | 73 | <name>text</name> |
74 | <string>Server assigned</string> | 74 | <string>Local</string> |
75 | </property> | 75 | </property> |
76 | </widget> | ||
77 | <widget row="0" column="1" > | ||
78 | <class>QLineEdit</class> | ||
76 | <property stdset="1"> | 79 | <property stdset="1"> |
77 | <name>checked</name> | 80 | <name>name</name> |
81 | <cstring>LocalAddress_LE</cstring> | ||
82 | </property> | ||
83 | <property stdset="1"> | ||
84 | <name>enabled</name> | ||
78 | <bool>true</bool> | 85 | <bool>true</bool> |
79 | </property> | 86 | </property> |
80 | </widget> | 87 | </widget> |
81 | <widget> | 88 | <widget row="0" column="2" > |
82 | <class>QRadioButton</class> | 89 | <class>QCheckBox</class> |
83 | <property stdset="1"> | 90 | <property stdset="1"> |
84 | <name>name</name> | 91 | <name>name</name> |
85 | <cstring>IPFixed_RB</cstring> | 92 | <cstring>ServerOverrulesLocal_CB</cstring> |
86 | </property> | 93 | </property> |
87 | <property stdset="1"> | 94 | <property stdset="1"> |
88 | <name>text</name> | 95 | <name>text</name> |
89 | <string>Fixed</string> | 96 | <string>Server Overrules</string> |
90 | </property> | 97 | </property> |
91 | </widget> | 98 | </widget> |
92 | <widget> | 99 | <widget row="1" column="1" > |
93 | <class>QLayoutWidget</class> | 100 | <class>QLineEdit</class> |
94 | <property stdset="1"> | 101 | <property stdset="1"> |
95 | <name>name</name> | 102 | <name>name</name> |
96 | <cstring>Layout11</cstring> | 103 | <cstring>RemoteAddress_LE</cstring> |
104 | </property> | ||
105 | <property stdset="1"> | ||
106 | <name>enabled</name> | ||
107 | <bool>true</bool> | ||
97 | </property> | 108 | </property> |
98 | <hbox> | ||
99 | <property stdset="1"> | ||
100 | <name>margin</name> | ||
101 | <number>0</number> | ||
102 | </property> | ||
103 | <property stdset="1"> | ||
104 | <name>spacing</name> | ||
105 | <number>6</number> | ||
106 | </property> | ||
107 | <spacer> | ||
108 | <property> | ||
109 | <name>name</name> | ||
110 | <cstring>Spacer8</cstring> | ||
111 | </property> | ||
112 | <property stdset="1"> | ||
113 | <name>orientation</name> | ||
114 | <enum>Horizontal</enum> | ||
115 | </property> | ||
116 | <property stdset="1"> | ||
117 | <name>sizeType</name> | ||
118 | <enum>Fixed</enum> | ||
119 | </property> | ||
120 | <property> | ||
121 | <name>sizeHint</name> | ||
122 | <size> | ||
123 | <width>20</width> | ||
124 | <height>20</height> | ||
125 | </size> | ||
126 | </property> | ||
127 | <property> | ||
128 | <name>layoutMargin</name> | ||
129 | </property> | ||
130 | <property> | ||
131 | <name>layoutSpacing</name> | ||
132 | </property> | ||
133 | </spacer> | ||
134 | <widget> | ||
135 | <class>QFrame</class> | ||
136 | <property stdset="1"> | ||
137 | <name>name</name> | ||
138 | <cstring>Frame8</cstring> | ||
139 | </property> | ||
140 | <property stdset="1"> | ||
141 | <name>enabled</name> | ||
142 | <bool>false</bool> | ||
143 | </property> | ||
144 | <property stdset="1"> | ||
145 | <name>sizePolicy</name> | ||
146 | <sizepolicy> | ||
147 | <hsizetype>7</hsizetype> | ||
148 | <vsizetype>5</vsizetype> | ||
149 | </sizepolicy> | ||
150 | </property> | ||
151 | <property stdset="1"> | ||
152 | <name>frameShape</name> | ||
153 | <enum>NoFrame</enum> | ||
154 | </property> | ||
155 | <property stdset="1"> | ||
156 | <name>frameShadow</name> | ||
157 | <enum>Raised</enum> | ||
158 | </property> | ||
159 | <property> | ||
160 | <name>layoutMargin</name> | ||
161 | </property> | ||
162 | <property> | ||
163 | <name>layoutSpacing</name> | ||
164 | </property> | ||
165 | <grid> | ||
166 | <property stdset="1"> | ||
167 | <name>margin</name> | ||
168 | <number>2</number> | ||
169 | </property> | ||
170 | <property stdset="1"> | ||
171 | <name>spacing</name> | ||
172 | <number>2</number> | ||
173 | </property> | ||
174 | <widget row="0" column="1" > | ||
175 | <class>QLineEdit</class> | ||
176 | <property stdset="1"> | ||
177 | <name>name</name> | ||
178 | <cstring>IPAddress_LE</cstring> | ||
179 | </property> | ||
180 | </widget> | ||
181 | <widget row="1" column="0" > | ||
182 | <class>QLabel</class> | ||
183 | <property stdset="1"> | ||
184 | <name>name</name> | ||
185 | <cstring>TextLabel3</cstring> | ||
186 | </property> | ||
187 | <property stdset="1"> | ||
188 | <name>text</name> | ||
189 | <string>Subnetmask</string> | ||
190 | </property> | ||
191 | </widget> | ||
192 | <widget row="0" column="0" > | ||
193 | <class>QLabel</class> | ||
194 | <property stdset="1"> | ||
195 | <name>name</name> | ||
196 | <cstring>TextLabel2</cstring> | ||
197 | </property> | ||
198 | <property stdset="1"> | ||
199 | <name>text</name> | ||
200 | <string>Address</string> | ||
201 | </property> | ||
202 | </widget> | ||
203 | <widget row="1" column="1" > | ||
204 | <class>QLineEdit</class> | ||
205 | <property stdset="1"> | ||
206 | <name>name</name> | ||
207 | <cstring>IPSubMask_LE</cstring> | ||
208 | </property> | ||
209 | </widget> | ||
210 | </grid> | ||
211 | </widget> | ||
212 | </hbox> | ||
213 | </widget> | 109 | </widget> |
214 | </vbox> | 110 | <widget row="1" column="2" > |
111 | <class>QCheckBox</class> | ||
112 | <property stdset="1"> | ||
113 | <name>name</name> | ||
114 | <cstring>ServerOverrulesRemote_CB</cstring> | ||
115 | </property> | ||
116 | <property stdset="1"> | ||
117 | <name>text</name> | ||
118 | <string>Server Overrules</string> | ||
119 | </property> | ||
120 | </widget> | ||
121 | <widget row="1" column="0" > | ||
122 | <class>QLabel</class> | ||
123 | <property stdset="1"> | ||
124 | <name>name</name> | ||
125 | <cstring>TextLabel1_2</cstring> | ||
126 | </property> | ||
127 | <property stdset="1"> | ||
128 | <name>enabled</name> | ||
129 | <bool>true</bool> | ||
130 | </property> | ||
131 | <property stdset="1"> | ||
132 | <name>text</name> | ||
133 | <string>Remote</string> | ||
134 | </property> | ||
135 | </widget> | ||
136 | </grid> | ||
215 | </widget> | 137 | </widget> |
216 | <widget> | 138 | <widget> |
217 | <class>QButtonGroup</class> | 139 | <class>QButtonGroup</class> |
218 | <property stdset="1"> | 140 | <property stdset="1"> |
219 | <name>name</name> | 141 | <name>name</name> |
220 | <cstring>ButtonGroup5</cstring> | 142 | <cstring>ButtonGroup5</cstring> |
221 | </property> | 143 | </property> |
222 | <property stdset="1"> | 144 | <property stdset="1"> |
145 | <name>sizePolicy</name> | ||
146 | <sizepolicy> | ||
147 | <hsizetype>5</hsizetype> | ||
148 | <vsizetype>1</vsizetype> | ||
149 | </sizepolicy> | ||
150 | </property> | ||
151 | <property stdset="1"> | ||
223 | <name>title</name> | 152 | <name>title</name> |
224 | <string>Gateway</string> | 153 | <string>Gateway</string> |
225 | </property> | 154 | </property> |
226 | <property> | 155 | <property> |
227 | <name>layoutMargin</name> | 156 | <name>layoutMargin</name> |
228 | </property> | 157 | </property> |
229 | <property> | 158 | <property> |
230 | <name>layoutSpacing</name> | 159 | <name>layoutSpacing</name> |
231 | </property> | 160 | </property> |
232 | <vbox> | 161 | <vbox> |
233 | <property stdset="1"> | 162 | <property stdset="1"> |
234 | <name>margin</name> | 163 | <name>margin</name> |
235 | <number>2</number> | 164 | <number>3</number> |
236 | </property> | 165 | </property> |
237 | <property stdset="1"> | 166 | <property stdset="1"> |
238 | <name>spacing</name> | 167 | <name>spacing</name> |
239 | <number>2</number> | 168 | <number>2</number> |
240 | </property> | 169 | </property> |
241 | <widget> | 170 | <widget> |
242 | <class>QRadioButton</class> | 171 | <class>QRadioButton</class> |
243 | <property stdset="1"> | 172 | <property stdset="1"> |
244 | <name>name</name> | 173 | <name>name</name> |
245 | <cstring>GWServerAssigned_RB</cstring> | 174 | <cstring>GWServerAssigned_RB</cstring> |
246 | </property> | 175 | </property> |
247 | <property stdset="1"> | 176 | <property stdset="1"> |
248 | <name>text</name> | 177 | <name>text</name> |
249 | <string>Server assigned</string> | 178 | <string>Server assigned</string> |
250 | </property> | 179 | </property> |
251 | <property stdset="1"> | 180 | <property stdset="1"> |
252 | <name>checked</name> | 181 | <name>checked</name> |
253 | <bool>true</bool> | 182 | <bool>true</bool> |
254 | </property> | 183 | </property> |
255 | <property> | 184 | <property> |
256 | <name>layoutMargin</name> | 185 | <name>layoutMargin</name> |
257 | </property> | 186 | </property> |
258 | <property> | 187 | <property> |
259 | <name>layoutSpacing</name> | 188 | <name>layoutSpacing</name> |
260 | </property> | 189 | </property> |
261 | </widget> | 190 | </widget> |
262 | <widget> | 191 | <widget> |
263 | <class>QRadioButton</class> | 192 | <class>QRadioButton</class> |
264 | <property stdset="1"> | 193 | <property stdset="1"> |
265 | <name>name</name> | 194 | <name>name</name> |
266 | <cstring>GWFixed_RB</cstring> | 195 | <cstring>GWFixed_RB</cstring> |
267 | </property> | 196 | </property> |
268 | <property stdset="1"> | 197 | <property stdset="1"> |
269 | <name>text</name> | 198 | <name>text</name> |
270 | <string>Fixed</string> | 199 | <string>Fixed</string> |
271 | </property> | 200 | </property> |
272 | </widget> | 201 | </widget> |
273 | <widget> | 202 | <widget> |
274 | <class>QLayoutWidget</class> | 203 | <class>QLayoutWidget</class> |
275 | <property stdset="1"> | 204 | <property stdset="1"> |
276 | <name>name</name> | 205 | <name>name</name> |
277 | <cstring>Layout12</cstring> | 206 | <cstring>Layout12</cstring> |
278 | </property> | 207 | </property> |
279 | <property> | 208 | <property> |
280 | <name>layoutMargin</name> | 209 | <name>layoutMargin</name> |
281 | </property> | 210 | </property> |
282 | <property> | 211 | <property> |
283 | <name>layoutSpacing</name> | 212 | <name>layoutSpacing</name> |
284 | </property> | 213 | </property> |
285 | <hbox> | 214 | <hbox> |
286 | <property stdset="1"> | 215 | <property stdset="1"> |
287 | <name>margin</name> | 216 | <name>margin</name> |
288 | <number>0</number> | 217 | <number>0</number> |
289 | </property> | 218 | </property> |
290 | <property stdset="1"> | 219 | <property stdset="1"> |
291 | <name>spacing</name> | 220 | <name>spacing</name> |
292 | <number>6</number> | 221 | <number>6</number> |
293 | </property> | 222 | </property> |
294 | <spacer> | 223 | <spacer> |
295 | <property> | 224 | <property> |
296 | <name>name</name> | 225 | <name>name</name> |
297 | <cstring>Spacer9</cstring> | 226 | <cstring>Spacer9</cstring> |
298 | </property> | 227 | </property> |
299 | <property stdset="1"> | 228 | <property stdset="1"> |
300 | <name>orientation</name> | 229 | <name>orientation</name> |
301 | <enum>Horizontal</enum> | 230 | <enum>Horizontal</enum> |
302 | </property> | 231 | </property> |
303 | <property stdset="1"> | 232 | <property stdset="1"> |
304 | <name>sizeType</name> | 233 | <name>sizeType</name> |
305 | <enum>Fixed</enum> | 234 | <enum>Fixed</enum> |
306 | </property> | 235 | </property> |
307 | <property> | 236 | <property> |
308 | <name>sizeHint</name> | 237 | <name>sizeHint</name> |
309 | <size> | 238 | <size> |
310 | <width>20</width> | 239 | <width>20</width> |
311 | <height>20</height> | 240 | <height>20</height> |
312 | </size> | 241 | </size> |
313 | </property> | 242 | </property> |
314 | </spacer> | 243 | </spacer> |
315 | <widget> | 244 | <widget> |
316 | <class>QFrame</class> | 245 | <class>QFrame</class> |
317 | <property stdset="1"> | 246 | <property stdset="1"> |
318 | <name>name</name> | 247 | <name>name</name> |
319 | <cstring>Frame9</cstring> | 248 | <cstring>Frame9</cstring> |
320 | </property> | 249 | </property> |
321 | <property stdset="1"> | 250 | <property stdset="1"> |
322 | <name>enabled</name> | 251 | <name>enabled</name> |
323 | <bool>false</bool> | 252 | <bool>false</bool> |
324 | </property> | 253 | </property> |
325 | <property stdset="1"> | 254 | <property stdset="1"> |
326 | <name>sizePolicy</name> | 255 | <name>sizePolicy</name> |
327 | <sizepolicy> | 256 | <sizepolicy> |
328 | <hsizetype>7</hsizetype> | 257 | <hsizetype>7</hsizetype> |
329 | <vsizetype>5</vsizetype> | 258 | <vsizetype>5</vsizetype> |
330 | </sizepolicy> | 259 | </sizepolicy> |
331 | </property> | 260 | </property> |
332 | <property stdset="1"> | 261 | <property stdset="1"> |
333 | <name>frameShape</name> | 262 | <name>frameShape</name> |
334 | <enum>NoFrame</enum> | 263 | <enum>NoFrame</enum> |
335 | </property> | 264 | </property> |
336 | <property stdset="1"> | 265 | <property stdset="1"> |
337 | <name>frameShadow</name> | 266 | <name>frameShadow</name> |
338 | <enum>Raised</enum> | 267 | <enum>Raised</enum> |
339 | </property> | 268 | </property> |
340 | <property> | 269 | <property> |
341 | <name>layoutMargin</name> | 270 | <name>layoutMargin</name> |
342 | </property> | 271 | </property> |
343 | <property> | 272 | <property> |
344 | <name>layoutSpacing</name> | 273 | <name>layoutSpacing</name> |
345 | </property> | 274 | </property> |
346 | <grid> | 275 | <grid> |
347 | <property stdset="1"> | 276 | <property stdset="1"> |
348 | <name>margin</name> | 277 | <name>margin</name> |
349 | <number>2</number> | 278 | <number>2</number> |
350 | </property> | 279 | </property> |
351 | <property stdset="1"> | 280 | <property stdset="1"> |
352 | <name>spacing</name> | 281 | <name>spacing</name> |
353 | <number>2</number> | 282 | <number>2</number> |
354 | </property> | 283 | </property> |
355 | <widget row="0" column="0" > | 284 | <widget row="0" column="0" > |
356 | <class>QLabel</class> | 285 | <class>QLabel</class> |
357 | <property stdset="1"> | 286 | <property stdset="1"> |
358 | <name>name</name> | 287 | <name>name</name> |
359 | <cstring>TextLabel4</cstring> | 288 | <cstring>TextLabel4</cstring> |
360 | </property> | 289 | </property> |
361 | <property stdset="1"> | 290 | <property stdset="1"> |
362 | <name>text</name> | 291 | <name>text</name> |
363 | <string>Address</string> | 292 | <string>Address</string> |
364 | </property> | 293 | </property> |
365 | </widget> | 294 | </widget> |
366 | <widget row="0" column="1" > | 295 | <widget row="0" column="1" > |
367 | <class>QLineEdit</class> | 296 | <class>QLineEdit</class> |
368 | <property stdset="1"> | 297 | <property stdset="1"> |
369 | <name>name</name> | 298 | <name>name</name> |
370 | <cstring>GWAddress_LE</cstring> | 299 | <cstring>GWAddress_LE</cstring> |
371 | </property> | 300 | </property> |
372 | </widget> | 301 | </widget> |
373 | </grid> | 302 | </grid> |
374 | </widget> | 303 | </widget> |
375 | </hbox> | 304 | </hbox> |
376 | </widget> | 305 | </widget> |
377 | <widget> | 306 | <widget> |
378 | <class>QLayoutWidget</class> | 307 | <class>QLayoutWidget</class> |
379 | <property stdset="1"> | 308 | <property stdset="1"> |
380 | <name>name</name> | 309 | <name>name</name> |
381 | <cstring>Layout3</cstring> | 310 | <cstring>Layout4</cstring> |
382 | </property> | 311 | </property> |
383 | <hbox> | 312 | <hbox> |
384 | <property stdset="1"> | 313 | <property stdset="1"> |
385 | <name>margin</name> | 314 | <name>margin</name> |
386 | <number>0</number> | 315 | <number>0</number> |
387 | </property> | 316 | </property> |
388 | <property stdset="1"> | 317 | <property stdset="1"> |
389 | <name>spacing</name> | 318 | <name>spacing</name> |
390 | <number>6</number> | 319 | <number>6</number> |
391 | </property> | 320 | </property> |
321 | <widget> | ||
322 | <class>QCheckBox</class> | ||
323 | <property stdset="1"> | ||
324 | <name>name</name> | ||
325 | <cstring>GWIsDefault_CB</cstring> | ||
326 | </property> | ||
327 | <property stdset="1"> | ||
328 | <name>text</name> | ||
329 | <string>Set as default</string> | ||
330 | </property> | ||
331 | </widget> | ||
392 | <spacer> | 332 | <spacer> |
393 | <property> | 333 | <property> |
394 | <name>name</name> | 334 | <name>name</name> |
395 | <cstring>Spacer3</cstring> | 335 | <cstring>Spacer3</cstring> |
396 | </property> | 336 | </property> |
397 | <property stdset="1"> | 337 | <property stdset="1"> |
398 | <name>orientation</name> | 338 | <name>orientation</name> |
399 | <enum>Horizontal</enum> | 339 | <enum>Horizontal</enum> |
400 | </property> | 340 | </property> |
401 | <property stdset="1"> | 341 | <property stdset="1"> |
402 | <name>sizeType</name> | 342 | <name>sizeType</name> |
403 | <enum>Expanding</enum> | 343 | <enum>Expanding</enum> |
404 | </property> | 344 | </property> |
405 | <property> | 345 | <property> |
406 | <name>sizeHint</name> | 346 | <name>sizeHint</name> |
407 | <size> | 347 | <size> |
408 | <width>20</width> | 348 | <width>20</width> |
409 | <height>20</height> | 349 | <height>20</height> |
410 | </size> | 350 | </size> |
411 | </property> | 351 | </property> |
412 | </spacer> | 352 | </spacer> |
413 | <widget> | 353 | <widget> |
414 | <class>QCheckBox</class> | 354 | <class>QCheckBox</class> |
415 | <property stdset="1"> | 355 | <property stdset="1"> |
416 | <name>name</name> | 356 | <name>name</name> |
417 | <cstring>GWIsDefault_CB</cstring> | 357 | <cstring>GWIfNotSet_CB</cstring> |
418 | </property> | 358 | </property> |
419 | <property stdset="1"> | 359 | <property stdset="1"> |
420 | <name>text</name> | 360 | <name>text</name> |
421 | <string>Set as default</string> | 361 | <string>Only if not yet set</string> |
422 | </property> | 362 | </property> |
423 | </widget> | 363 | </widget> |
424 | </hbox> | 364 | </hbox> |
425 | </widget> | 365 | </widget> |
426 | </vbox> | 366 | </vbox> |
427 | </widget> | 367 | </widget> |
368 | <spacer> | ||
369 | <property> | ||
370 | <name>name</name> | ||
371 | <cstring>Spacer4</cstring> | ||
372 | </property> | ||
373 | <property stdset="1"> | ||
374 | <name>orientation</name> | ||
375 | <enum>Vertical</enum> | ||
376 | </property> | ||
377 | <property stdset="1"> | ||
378 | <name>sizeType</name> | ||
379 | <enum>Expanding</enum> | ||
380 | </property> | ||
381 | <property> | ||
382 | <name>sizeHint</name> | ||
383 | <size> | ||
384 | <width>20</width> | ||
385 | <height>20</height> | ||
386 | </size> | ||
387 | </property> | ||
388 | </spacer> | ||
428 | </vbox> | 389 | </vbox> |
429 | </widget> | 390 | </widget> |
430 | <connections> | 391 | <connections> |
431 | <connection> | 392 | <connection> |
432 | <sender>GWFixed_RB</sender> | 393 | <sender>GWFixed_RB</sender> |
433 | <signal>toggled(bool)</signal> | 394 | <signal>toggled(bool)</signal> |
434 | <receiver>Frame9</receiver> | 395 | <receiver>Frame9</receiver> |
435 | <slot>setEnabled(bool)</slot> | 396 | <slot>setEnabled(bool)</slot> |
436 | </connection> | 397 | </connection> |
437 | <connection> | ||
438 | <sender>IPFixed_RB</sender> | ||
439 | <signal>toggled(bool)</signal> | ||
440 | <receiver>Frame8</receiver> | ||
441 | <slot>setEnabled(bool)</slot> | ||
442 | </connection> | ||
443 | </connections> | 398 | </connections> |
444 | </UI> | 399 | </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 | |||
@@ -1,57 +1,54 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | #include <qcheckbox.h> | 2 | #include <qcheckbox.h> |
3 | #include <qradiobutton.h> | 3 | #include <qradiobutton.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <GUIUtils.h> | 5 | #include <GUIUtils.h> |
6 | #include "PPPIPedit.h" | 6 | #include "PPPIPedit.h" |
7 | 7 | ||
8 | PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){ | 8 | PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){ |
9 | } | 9 | } |
10 | 10 | ||
11 | QString PPPIPEdit::acceptable( void ) { | 11 | QString PPPIPEdit::acceptable( void ) { |
12 | if( IPFixed_RB->isChecked() ) { | 12 | if( GWFixed_RB->isChecked() ) { |
13 | if( IPAddress_LE->text().isEmpty() ) | ||
14 | return tr("IPAddress needed" ); | ||
15 | if( ! validIP( IPAddress_LE->text() ) ) | ||
16 | return tr("IPAddress not valid" ); | ||
17 | if( IPSubMask_LE->text().isEmpty() ) | ||
18 | return tr("Subnet mask needed" ); | ||
19 | if( ! validIP( IPSubMask_LE->text() ) ) | ||
20 | return tr("Subnet mask not valid" ); | ||
21 | } else if( GWFixed_RB->isChecked() ) { | ||
22 | if( GWAddress_LE->text().isEmpty() ) | 13 | if( GWAddress_LE->text().isEmpty() ) |
23 | return tr("Gateway address needed" ); | 14 | return tr("Gateway address needed" ); |
24 | if( ! validIP( GWAddress_LE->text() ) ) | 15 | if( ! validIP( GWAddress_LE->text() ) ) |
25 | return tr("Gateway address not valid" ); | 16 | return tr("Gateway address not valid" ); |
26 | }; | 17 | }; |
27 | 18 | ||
28 | return QString(); | 19 | return QString(); |
29 | } | 20 | } |
30 | 21 | ||
31 | bool PPPIPEdit::commit( PPPData_t & D ) { | 22 | bool PPPIPEdit::commit( PPPData & D ) { |
32 | 23 | ||
33 | bool SM = 0; | 24 | bool SM = 0; |
34 | 25 | ||
35 | CBM( D.IP.IPAutomatic, IPServerAssigned_RB, SM ); | 26 | CBM( D.IP.LocalOverrule, ServerOverrulesLocal_CB, SM ); |
36 | if( ! D.IP.IPAutomatic ) { | 27 | CBM( D.IP.RemoteOverrule, ServerOverrulesRemote_CB, SM ); |
37 | TXTM( D.IP.IPAddress, IPAddress_LE, SM ); | 28 | |
38 | TXTM( D.IP.IPSubMask, IPSubMask_LE, SM ); | 29 | TXTM( D.IP.LocalAddress, LocalAddress_LE, SM ); |
39 | } | 30 | TXTM( D.IP.RemoteAddress, RemoteAddress_LE, SM ); |
40 | 31 | ||
41 | CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM ); | 32 | CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM ); |
33 | |||
42 | if( ! D.IP.GWAutomatic ) { | 34 | if( ! D.IP.GWAutomatic ) { |
43 | TXTM( D.IP.GWAddress, GWAddress_LE, SM ); | 35 | TXTM( D.IP.GWAddress, GWAddress_LE, SM ); |
44 | } | 36 | } |
45 | 37 | ||
46 | CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM ); | 38 | CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM ); |
39 | CBM( D.IP.GWIfNotSet, GWIfNotSet_CB, SM ); | ||
40 | |||
47 | return SM; | 41 | return SM; |
48 | } | 42 | } |
49 | 43 | ||
50 | void PPPIPEdit::showData( PPPData_t & D ) { | 44 | void PPPIPEdit::showData( PPPData & D ) { |
51 | IPServerAssigned_RB->setChecked( D.IP.IPAutomatic ); | 45 | ServerOverrulesLocal_CB->setChecked( D.IP.LocalOverrule ); |
52 | IPAddress_LE->setText( D.IP.IPAddress ); | 46 | ServerOverrulesRemote_CB->setChecked( D.IP.RemoteOverrule ); |
53 | IPSubMask_LE->setText( D.IP.IPSubMask ); | 47 | LocalAddress_LE->setText( D.IP.LocalAddress ); |
48 | RemoteAddress_LE->setText( D.IP.RemoteAddress ); | ||
49 | |||
54 | GWServerAssigned_RB->setChecked( D.IP.GWAutomatic ); | 50 | GWServerAssigned_RB->setChecked( D.IP.GWAutomatic ); |
55 | GWAddress_LE->setText( D.IP.GWAddress ); | 51 | GWAddress_LE->setText( D.IP.GWAddress ); |
56 | GWIsDefault_CB->setChecked( D.IP.GWIsDefault ); | 52 | GWIsDefault_CB->setChecked( D.IP.GWIsDefault ); |
53 | GWIfNotSet_CB->setChecked( D.IP.GWIfNotSet ); | ||
57 | } | 54 | } |
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.h b/noncore/settings/networksettings2/ppp/PPPIPedit.h index 153ee68..5ca4326 100644 --- a/noncore/settings/networksettings2/ppp/PPPIPedit.h +++ b/noncore/settings/networksettings2/ppp/PPPIPedit.h | |||
@@ -1,15 +1,15 @@ | |||
1 | #include "pppdata.h" | 1 | #include "pppdata.h" |
2 | #include "PPPIPGUI.h" | 2 | #include "PPPIPGUI.h" |
3 | 3 | ||
4 | class PPPIPEdit : public PPPIPGUI { | 4 | class PPPIPEdit : public PPPIPGUI { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | PPPIPEdit( QWidget * parent ); | 8 | PPPIPEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 9 | QString acceptable( void ); |
10 | bool commit( PPPData_t & Data ); | 10 | bool commit( PPPData & Data ); |
11 | void showData( PPPData_t & Data ); | 11 | void showData( PPPData & Data ); |
12 | 12 | ||
13 | private : | 13 | private : |
14 | 14 | ||
15 | }; | 15 | }; |
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 @@ | |||
1 | #include <qwidgetstack.h> | 1 | #include <qwidgetstack.h> |
2 | 2 | ||
3 | #include "PPPIPedit.h" | 3 | #include "PPPIPedit.h" |
4 | #include "PPPDNSedit.h" | 4 | #include "PPPDNSedit.h" |
5 | #include "PPPAuthedit.h" | 5 | #include "PPPAuthedit.h" |
6 | #include "PPPRunedit.h" | ||
7 | #include "PPPDialingedit.h" | ||
6 | #include "PPPedit.h" | 8 | #include "PPPedit.h" |
7 | 9 | ||
8 | PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){ | 10 | PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){ |
9 | 11 | ||
10 | Auth = new PPPAuthEdit( Options_WS ); | 12 | Auth = new PPPAuthEdit( Options_WS ); |
11 | IP = new PPPIPEdit( Options_WS ); | 13 | IP = new PPPIPEdit( Options_WS ); |
12 | DNS = new PPPDNSEdit( Options_WS ); | 14 | DNS = new PPPDNSEdit( Options_WS ); |
15 | Run = new PPPRunEdit( Options_WS ); | ||
16 | Dialing = new PPPDialingEdit( Options_WS ); | ||
17 | |||
13 | Options_WS->addWidget( Auth, 0 ); | 18 | Options_WS->addWidget( Auth, 0 ); |
14 | Options_WS->addWidget( IP, 1 ); | 19 | Options_WS->addWidget( IP, 1 ); |
15 | Options_WS->addWidget( DNS, 2 ); | 20 | Options_WS->addWidget( DNS, 2 ); |
21 | Options_WS->addWidget( Run, 3 ); | ||
22 | Options_WS->addWidget( Dialing, 4 ); | ||
16 | 23 | ||
17 | Options_WS->raiseWidget( 0 ); | 24 | Options_WS->raiseWidget( 0 ); |
18 | } | 25 | } |
19 | 26 | ||
20 | QString PPPEdit::acceptable( void ) { | 27 | QString PPPEdit::acceptable( void ) { |
21 | QString S; | 28 | QString S; |
22 | S = Auth->acceptable(); | 29 | S = Auth->acceptable(); |
23 | if( S.isEmpty() ) { | 30 | if( S.isEmpty() ) { |
24 | S = IP->acceptable(); | 31 | S = IP->acceptable(); |
25 | if( S.isEmpty() ) { | 32 | if( S.isEmpty() ) { |
26 | S = DNS->acceptable(); | 33 | S = DNS->acceptable(); |
27 | } | 34 | } |
28 | } | 35 | } |
29 | return S; | 36 | return S; |
30 | } | 37 | } |
31 | 38 | ||
32 | bool PPPEdit::commit( PPPData_t & Data ) { | 39 | bool PPPEdit::commit( PPPData & Data ) { |
33 | bool SM ; | 40 | bool SM ; |
34 | SM = Auth->commit( Data ); | 41 | SM = Auth->commit( Data ); |
35 | SM |= IP->commit( Data ); | 42 | SM |= IP->commit( Data ); |
36 | SM |= DNS->commit( Data ); | 43 | SM |= DNS->commit( Data ); |
37 | return SM; | 44 | return SM; |
38 | } | 45 | } |
39 | 46 | ||
40 | void PPPEdit::showData( PPPData_t & Data ) { | 47 | void PPPEdit::showData( PPPData & Data ) { |
41 | Auth->showData( Data ) ; | 48 | Auth->showData( Data ) ; |
42 | IP->showData( Data ); | 49 | IP->showData( Data ); |
43 | DNS->showData( Data ); | 50 | DNS->showData( Data ); |
44 | } | 51 | } |
45 | 52 | ||
46 | void PPPEdit::SLOT_SelectTopic( int v ) { | 53 | void PPPEdit::SLOT_SelectTopic( int v ) { |
47 | Options_WS->raiseWidget( v ); | 54 | Options_WS->raiseWidget( v ); |
48 | } | 55 | } |
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 @@ | |||
1 | #include "pppdata.h" | 1 | #include "pppdata.h" |
2 | #include "PPPGUI.h" | 2 | #include "PPPGUI.h" |
3 | 3 | ||
4 | class PPPAuthEdit; | 4 | class PPPAuthEdit; |
5 | class PPPIPEdit; | 5 | class PPPIPEdit; |
6 | class PPPDNSEdit; | 6 | class PPPDNSEdit; |
7 | class PPPRunEdit; | ||
8 | class PPPDialingEdit; | ||
7 | 9 | ||
8 | class PPPEdit : public PPPGUI { | 10 | class PPPEdit : public PPPGUI { |
9 | 11 | ||
10 | public : | 12 | public : |
11 | 13 | ||
12 | PPPEdit( QWidget * parent ); | 14 | PPPEdit( QWidget * parent ); |
13 | QString acceptable( void ); | 15 | QString acceptable( void ); |
14 | bool commit( PPPData_t & Data ); | 16 | bool commit( PPPData & Data ); |
15 | void showData( PPPData_t & Data ); | 17 | void showData( PPPData & Data ); |
16 | 18 | ||
17 | public slots : | 19 | public slots : |
18 | 20 | ||
19 | void SLOT_SelectTopic( int ); | 21 | void SLOT_SelectTopic( int ); |
20 | 22 | ||
21 | private : | 23 | private : |
22 | 24 | ||
23 | PPPAuthEdit * Auth; | 25 | PPPAuthEdit * Auth; |
24 | PPPDNSEdit * DNS; | 26 | PPPDNSEdit * DNS; |
25 | PPPIPEdit * IP; | 27 | PPPIPEdit * IP; |
28 | PPPRunEdit * Run; | ||
29 | PPPDialingEdit * Dialing; | ||
26 | 30 | ||
27 | }; | 31 | }; |
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 @@ | |||
1 | Package: opie-networksettingsplugin2-ppp | 1 | Package: opie-networksettings2plugin-ppp |
2 | Files: plugins/networksettings2/libppp.so* | 2 | Files: plugins/networksettings2/libppp.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Network settings ppp plugin. | 8 | Description: Network settings ppp plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 | 3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 |
4 | HEADERS = ppp_NN.h \ | 4 | HEADERS = ppp_NN.h \ |
5 | ppp_NNI.h \ | 5 | ppp_NNI.h \ |
6 | PPPedit.h \ | 6 | PPPedit.h \ |
7 | PPPAuthedit.h \ | 7 | PPPAuthedit.h \ |
8 | PPPDNSedit.h \ | 8 | PPPDNSedit.h \ |
9 | PPPRunedit.h \ | ||
10 | PPPDialingedit.h \ | ||
9 | PPPIPedit.h | 11 | PPPIPedit.h |
10 | SOURCES = ppp_NN.cpp \ | 12 | SOURCES = ppp_NN.cpp \ |
11 | ppp_NNI.cpp \ | 13 | ppp_NNI.cpp \ |
12 | PPPedit.cpp \ | 14 | PPPedit.cpp \ |
13 | PPPDNSedit.cpp \ | 15 | PPPDNSedit.cpp \ |
16 | PPPRunedit.cpp \ | ||
17 | PPPDialingedit.cpp \ | ||
14 | PPPAuthedit.cpp \ | 18 | PPPAuthedit.cpp \ |
15 | ppprun.cpp \ | 19 | ppprun.cpp \ |
16 | PPPIPedit.cpp | 20 | PPPIPedit.cpp |
17 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 | 21 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 |
18 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 | 22 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 |
19 | LIBS += -lqpe | 23 | LIBS += -lqpe |
20 | INTERFACES= PPPGUI.ui PPPAuthGUI.ui PPPIPGUI.ui PPPDNSGUI.ui | 24 | INTERFACES= PPPGUI.ui \ |
25 | PPPAuthGUI.ui \ | ||
26 | PPPIPGUI.ui \ | ||
27 | PPPDNSGUI.ui \ | ||
28 | PPPDialingGUI.ui \ | ||
29 | PPPRunGUI.ui | ||
21 | TARGET = ppp | 30 | TARGET = ppp |
22 | VERSION = 1.0.0 | 31 | VERSION = 1.0.0 |
23 | 32 | ||
24 | include( $(OPIEDIR)/include.pro ) | 33 | 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,85 +1,85 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <resources.h> | ||
2 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
3 | #include "ppp_NN.h" | 4 | #include "ppp_NN.h" |
4 | #include "ppp_NNI.h" | 5 | #include "ppp_NNI.h" |
5 | 6 | ||
6 | QStringList * PPPNetNode::ProperFiles = 0; | 7 | QStringList * PPPNetNode::ProperFiles = 0; |
7 | 8 | ||
8 | static const char * PPPNeeds[] = | 9 | static const char * PPPNeeds[] = |
9 | { "line", | 10 | { "modem", |
10 | "modem", | 11 | 0 |
12 | }; | ||
13 | |||
14 | static const char * PPPProvides[] = | ||
15 | { "connection", | ||
11 | 0 | 16 | 0 |
12 | }; | 17 | }; |
13 | 18 | ||
14 | /** | 19 | /** |
15 | * Constructor, find all of the possible interfaces | 20 | * Constructor, find all of the possible interfaces |
16 | */ | 21 | */ |
17 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { | 22 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { |
18 | 23 | ||
19 | // proper files : will leak | ||
20 | ProperFiles =new QStringList; | ||
21 | *ProperFiles << "peers"; | ||
22 | *ProperFiles << "chatscript"; | ||
23 | |||
24 | // system files | ||
25 | NSResources->addSystemFile( | 24 | NSResources->addSystemFile( |
26 | "pap-secrets", "/tmp/pap-secrets", 0 ); | 25 | "pap-secrets", "/etc/ppp/pap-secrets", 0 ); |
27 | NSResources->addSystemFile( | 26 | NSResources->addSystemFile( |
28 | "chap-secrets", "/tmp/chap-secrets", 0 ); | 27 | "chap-secrets", "/etc/ppp/chap-secrets", 0 ); |
29 | } | 28 | } |
30 | 29 | ||
31 | /** | 30 | /** |
32 | * Delete any interfaces that we own. | 31 | * Delete any interfaces that we own. |
33 | */ | 32 | */ |
34 | PPPNetNode::~PPPNetNode(){ | 33 | PPPNetNode::~PPPNetNode(){ |
35 | } | 34 | } |
36 | 35 | ||
37 | const QString PPPNetNode::nodeDescription(){ | 36 | const QString PPPNetNode::nodeDescription(){ |
38 | return tr("\ | 37 | return tr("\ |
39 | <p>Sets up IP using PPP.</p>\ | 38 | <p>Sets up IP using PPP.</p>\ |
40 | <p>Use this for dialup devices or serial setups</p>\ | 39 | <p>Use this for dialup devices or serial setups</p>\ |
41 | " | 40 | " |
42 | ); | 41 | ); |
43 | } | 42 | } |
44 | 43 | ||
45 | ANetNodeInstance * PPPNetNode::createInstance( void ) { | 44 | ANetNodeInstance * PPPNetNode::createInstance( void ) { |
46 | return new APPP( this ); | 45 | return new APPP( this ); |
47 | } | 46 | } |
48 | 47 | ||
49 | const char ** PPPNetNode::needs( void ) { | 48 | const char ** PPPNetNode::needs( void ) { |
50 | return PPPNeeds; | 49 | return PPPNeeds; |
51 | } | 50 | } |
52 | 51 | ||
53 | const char * PPPNetNode::provides( void ) { | 52 | const char ** PPPNetNode::provides( void ) { |
54 | return "connection"; | 53 | return PPPProvides; |
55 | } | 54 | } |
56 | 55 | ||
57 | QStringList * PPPNetNode::properFiles( void ) { | 56 | QStringList PPPNetNode::properFiles( void ) { |
58 | return ProperFiles; | 57 | QStringList SL; |
59 | 58 | SL << "peers" << "chatscripts"; | |
59 | return SL; | ||
60 | } | 60 | } |
61 | 61 | ||
62 | // need to generate : | 62 | // need to generate : |
63 | // /etc/ppp/pap-secrets | 63 | // /etc/ppp/pap-secrets |
64 | // /etc/ppp/pap-secrets | 64 | // /etc/ppp/pap-secrets |
65 | bool PPPNetNode::hasDataForFile( const QString & S ) { | 65 | bool PPPNetNode::hasDataForFile( SystemFile & S ) { |
66 | return S == "pap-secrets" || | 66 | return S.name() == "pap-secrets" || |
67 | S == "chap-secrets" ; | 67 | S.name() == "chap-secrets" ; |
68 | } | 68 | } |
69 | 69 | ||
70 | QString PPPNetNode::genNic( long NicNr ) { | 70 | QString PPPNetNode::genNic( long NicNr ) { |
71 | QString S; | 71 | QString S; |
72 | return S.sprintf( "ppp%ld", NicNr ); | 72 | return S.sprintf( "ppp%ld", NicNr ); |
73 | } | 73 | } |
74 | 74 | ||
75 | void PPPNetNode::setSpecificAttribute( QString & , QString & ) { | 75 | void PPPNetNode::setSpecificAttribute( QString & , QString & ) { |
76 | } | 76 | } |
77 | 77 | ||
78 | void PPPNetNode::saveSpecificAttribute( QTextStream & ) { | 78 | void PPPNetNode::saveSpecificAttribute( QTextStream & ) { |
79 | } | 79 | } |
80 | 80 | ||
81 | extern "C" { | 81 | extern "C" { |
82 | void create_plugin( QList<ANetNode> & PNN ) { | 82 | void create_plugin( QList<ANetNode> & PNN ) { |
83 | PNN.append( new PPPNetNode() ); | 83 | PNN.append( new PPPNetNode() ); |
84 | } | 84 | } |
85 | } | 85 | } |
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 | |||
@@ -1,43 +1,43 @@ | |||
1 | #ifndef PPP_NETNODE_H | 1 | #ifndef PPP_NETNODE_H |
2 | #define PPP_NETNODE_H | 2 | #define PPP_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class APPP; | 6 | class APPP; |
7 | 7 | ||
8 | class PPPNetNode : public ANetNode{ | 8 | class PPPNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | PPPNetNode(); | 14 | PPPNetNode(); |
15 | virtual ~PPPNetNode(); | 15 | virtual ~PPPNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/ppp"; } | 18 | { return "Devices/ppp"; } |
19 | 19 | ||
20 | virtual bool hasDataForFile( const QString & S ); | 20 | virtual bool hasDataForFile( SystemFile & S ); |
21 | 21 | ||
22 | virtual const QString nodeDescription() ; | 22 | virtual const QString nodeDescription() ; |
23 | virtual ANetNodeInstance * createInstance( void ); | 23 | virtual ANetNodeInstance * createInstance( void ); |
24 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
25 | virtual const char * provides( void ); | 25 | virtual const char ** provides( void ); |
26 | 26 | ||
27 | virtual QString genNic( long NicNr ); | 27 | virtual QString genNic( long NicNr ); |
28 | virtual QStringList * properFiles( void ); | 28 | virtual QStringList properFiles( void ); |
29 | 29 | ||
30 | private: | 30 | private: |
31 | 31 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 33 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 34 | ||
35 | static QStringList * ProperFiles; | 35 | static QStringList * ProperFiles; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | extern "C" | 38 | extern "C" |
39 | { | 39 | { |
40 | void create_plugin( QList<ANetNode> & PNN ); | 40 | void create_plugin( QList<ANetNode> & PNN ); |
41 | }; | 41 | }; |
42 | 42 | ||
43 | #endif | 43 | #endif |
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 | |||
@@ -1,221 +1,235 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qfileinfo.h> | 2 | #include <qfileinfo.h> |
3 | #include "PPPedit.h" | 3 | #include "PPPedit.h" |
4 | #include "ppp_NNI.h" | 4 | #include "ppp_NNI.h" |
5 | #include "ppp_NN.h" | 5 | #include "ppp_NN.h" |
6 | 6 | ||
7 | APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) { | 7 | APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) { |
8 | Data.DNS.ServerAssigned = 1; | 8 | Data.DNS.ServerAssigned = 1; |
9 | Data.DNS.DomainName = ""; | 9 | Data.DNS.DomainName = ""; |
10 | 10 | ||
11 | Data.Auth.Mode = 0; | 11 | Data.Auth.Mode = 0; |
12 | Data.Auth.Login.Expect = "ogin:"; | 12 | Data.Auth.Login.Expect = "ogin:"; |
13 | Data.Auth.Password.Expect = "assword:"; | 13 | Data.Auth.Password.Expect = "assword:"; |
14 | Data.Auth.PCEMode = 0; | 14 | Data.Auth.PCEMode = 0; |
15 | Data.Auth.Client = "*"; | 15 | Data.Auth.Client = "*"; |
16 | Data.Auth.Server = "*"; | 16 | Data.Auth.Server = "*"; |
17 | Data.Auth.Secret = ""; | 17 | Data.Auth.Secret = ""; |
18 | 18 | ||
19 | Data.IP.IPAutomatic = 1; | 19 | Data.IP.LocalAddress = "10.0.0.1"; |
20 | Data.IP.IPAddress = ""; | 20 | Data.IP.RemoteAddress = "10.0.0.2"; |
21 | Data.IP.IPSubMask = ""; | 21 | Data.IP.LocalOverrule = 1; |
22 | Data.IP.RemoteOverrule = 1; | ||
23 | |||
22 | Data.IP.GWAutomatic = 1; | 24 | Data.IP.GWAutomatic = 1; |
23 | Data.IP.GWAddress = ""; | 25 | Data.IP.GWAddress = ""; |
24 | Data.IP.GWIsDefault = 1; | 26 | Data.IP.GWIsDefault = 1; |
27 | Data.IP.GWIfNotSet = 1; | ||
28 | |||
29 | Data.Run.PreConnect = ""; | ||
30 | Data.Run.PostConnect = ""; | ||
31 | Data.Run.PreDisconnect = ""; | ||
32 | Data.Run.PostDisconnect = ""; | ||
33 | |||
25 | GUI = 0; | 34 | GUI = 0; |
26 | RT = 0; | 35 | RT = 0; |
27 | 36 | ||
28 | } | 37 | } |
29 | 38 | ||
30 | void APPP::setSpecificAttribute( QString & A, QString & V ) { | 39 | void APPP::setSpecificAttribute( QString & A, QString & V ) { |
31 | if( A.startsWith( "dns" ) ) { | 40 | if( A.startsWith( "dns" ) ) { |
32 | if( A == "dnsserverassigned" ) { | 41 | if( A == "dnsserverassigned" ) { |
33 | Data.DNS.ServerAssigned = (V == "yes"); | 42 | Data.DNS.ServerAssigned = (V == "yes"); |
34 | } else if( A == "dnsdomainname" ) { | 43 | } else if( A == "dnsdomainname" ) { |
35 | Data.DNS.DomainName = V; | 44 | Data.DNS.DomainName = V; |
36 | } else if( A == "dnsserver" ) { | 45 | } else if( A == "dnsserver" ) { |
37 | Data.DNS.Servers.resize( Data.DNS.Servers.size()+1 ); | 46 | Data.DNS.Servers.resize( Data.DNS.Servers.size()+1 ); |
38 | Data.DNS.Servers[Data.DNS.Servers.size()-1] = | 47 | Data.DNS.Servers[Data.DNS.Servers.size()-1] = |
39 | new QString( V ); | 48 | new QString( V ); |
40 | } | 49 | } |
41 | } else if( A.startsWith( "auth" ) ) { | 50 | } else if( A.startsWith( "auth" ) ) { |
42 | if( A == "authmode" ) { | 51 | if( A == "authmode" ) { |
43 | Data.Auth.Mode = V.toShort(); | 52 | Data.Auth.Mode = V.toShort(); |
44 | } else if( A == "authloginexpect" ) { | 53 | } else if( A == "authloginexpect" ) { |
45 | Data.Auth.Login.Expect = V; | 54 | Data.Auth.Login.Expect = V; |
46 | } else if( A == "authloginsend" ) { | 55 | } else if( A == "authloginsend" ) { |
47 | Data.Auth.Login.Send = V; | 56 | Data.Auth.Login.Send = V; |
48 | } else if( A == "authpasswordexpect" ) { | 57 | } else if( A == "authpasswordexpect" ) { |
49 | Data.Auth.Password.Expect = V; | 58 | Data.Auth.Password.Expect = V; |
50 | } else if( A == "authpasswordsend" ) { | 59 | } else if( A == "authpasswordsend" ) { |
51 | Data.Auth.Password.Send = V; | 60 | Data.Auth.Password.Send = V; |
52 | } else if( A == "authpcemode" ) { | 61 | } else if( A == "authpcemode" ) { |
53 | Data.Auth.PCEMode = V.toShort(); | 62 | Data.Auth.PCEMode = V.toShort(); |
54 | } else if( A == "authclient" ) { | 63 | } else if( A == "authclient" ) { |
55 | Data.Auth.Client = V; | 64 | Data.Auth.Client = V; |
56 | } else if( A == "authserver" ) { | 65 | } else if( A == "authserver" ) { |
57 | Data.Auth.Server = V; | 66 | Data.Auth.Server = V; |
58 | } else if( A == "authsecret" ) { | 67 | } else if( A == "authsecret" ) { |
59 | Data.Auth.Secret = V; | 68 | Data.Auth.Secret = V; |
60 | } | 69 | } |
61 | } else if( A.startsWith( "ip" ) ) { | 70 | } else if( A.startsWith( "ip" ) ) { |
62 | if( A == "ipautomatic" ) { | 71 | if( A == "iplocaloverrule" ) { |
63 | Data.IP.IPAutomatic = (V == "yes"); | 72 | Data.IP.LocalOverrule = (V == "yes"); |
64 | } else if( A == "gwautomatic" ) { | 73 | } else if( A == "ipremoteoverrule" ) { |
74 | Data.IP.RemoteOverrule = (V == "yes"); | ||
75 | } else if( A == "ipgwautomatic" ) { | ||
65 | Data.IP.GWAutomatic = (V == "yes"); | 76 | Data.IP.GWAutomatic = (V == "yes"); |
66 | } else if( A == "gwisdefault" ) { | 77 | } else if( A == "ipgwisdefault" ) { |
67 | Data.IP.GWIsDefault = (V == "yes"); | 78 | Data.IP.GWIsDefault = (V == "yes"); |
68 | } else if( A == "ipaddress" ) { | 79 | } else if( A == "ipgwifnotset" ) { |
69 | Data.IP.IPAddress = V; | 80 | Data.IP.GWIfNotSet = (V == "yes"); |
70 | } else if( A == "ipsubmask" ) { | 81 | } else if( A == "iplocaladdress" ) { |
71 | Data.IP.IPSubMask = V; | 82 | Data.IP.LocalAddress = V; |
72 | } else if( A == "gwaddress" ) { | 83 | } else if( A == "ipremoteaddress" ) { |
84 | Data.IP.RemoteAddress = V; | ||
85 | } else if( A == "ipgwaddress" ) { | ||
73 | Data.IP.GWAddress = V; | 86 | Data.IP.GWAddress = V; |
74 | } | 87 | } |
88 | } else if( A.startsWith( "run" ) ) { | ||
89 | if( A == "runpreconnect" ) { | ||
90 | Data.Run.PreConnect = V; | ||
91 | } else if( A == "runpostconnect" ) { | ||
92 | Data.Run.PostConnect = V; | ||
93 | } else if( A == "runpredisconnect" ) { | ||
94 | Data.Run.PreDisconnect = V; | ||
95 | } else if( A == "runpostdisconnect" ) { | ||
96 | Data.Run.PostDisconnect = V; | ||
97 | } | ||
75 | } | 98 | } |
76 | } | 99 | } |
77 | 100 | ||
78 | void APPP::saveSpecificAttribute( QTextStream & TS ) { | 101 | void APPP::saveSpecificAttribute( QTextStream & TS ) { |
79 | TS << "dnsserverassigned=" << | 102 | TS << "dnsserverassigned=" << |
80 | ( ( Data.DNS.ServerAssigned ) ? "yes" : "no" ) << endl; | 103 | ( ( Data.DNS.ServerAssigned ) ? "yes" : "no" ) << endl; |
81 | TS << "dnsdomainname=" << Data.DNS.DomainName << endl; | 104 | TS << "dnsdomainname=" << Data.DNS.DomainName << endl; |
82 | for( unsigned int i = 0; i < Data.DNS.Servers.size(); i ++ ) { | 105 | for( unsigned int i = 0; i < Data.DNS.Servers.size(); i ++ ) { |
83 | TS << "dnsserver=" << *(Data.DNS.Servers[i]) << endl; | 106 | TS << "dnsserver=" << *(Data.DNS.Servers[i]) << endl; |
84 | } | 107 | } |
85 | TS << "authmode=" << Data.Auth.Mode << endl; | 108 | TS << "authmode=" << Data.Auth.Mode << endl; |
86 | TS << "authloginexpect=" << quote( Data.Auth.Login.Expect ) << endl; | 109 | TS << "authloginexpect=" << quote( Data.Auth.Login.Expect ) << endl; |
87 | TS << "authloginsend=" << quote( Data.Auth.Login.Send ) << endl; | 110 | TS << "authloginsend=" << quote( Data.Auth.Login.Send ) << endl; |
88 | TS << "authpasswordexpect=" << quote( Data.Auth.Password.Expect ) << endl; | 111 | TS << "authpasswordexpect=" << quote( Data.Auth.Password.Expect ) << endl; |
89 | TS << "authpasswordsend=" << quote( Data.Auth.Password.Send ) << endl; | 112 | TS << "authpasswordsend=" << quote( Data.Auth.Password.Send ) << endl; |
90 | TS << "authpcemode=" << Data.Auth.PCEMode << endl; | 113 | TS << "authpcemode=" << Data.Auth.PCEMode << endl; |
91 | TS << "authclient=" << Data.Auth.Client << endl; | 114 | TS << "authclient=" << Data.Auth.Client << endl; |
92 | TS << "authserver=" << Data.Auth.Server << endl; | 115 | TS << "authserver=" << Data.Auth.Server << endl; |
93 | TS << "authsecret=" << quote( Data.Auth.Secret ) << endl; | 116 | TS << "authsecret=" << quote( Data.Auth.Secret ) << endl; |
94 | TS << "ipautomatic=" << ( ( Data.IP.IPAutomatic ) ? "yes" : "no" ) << endl; | 117 | TS << "ipgwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl; |
95 | TS << "gwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl; | 118 | TS << "ipgwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl; |
96 | TS << "gwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl; | 119 | TS << "ipgwifnotset=" << ( ( Data.IP.GWIfNotSet ) ? "yes" : "no" ) << endl; |
97 | TS << "ipaddress=" << Data.IP.IPAddress << endl; | 120 | TS << "iplocaloverrule=" << ( ( Data.IP.LocalOverrule ) ? "yes" : "no" ) << endl; |
98 | TS << "ipsubmask=" << Data.IP.IPSubMask << endl; | 121 | TS << "ipremoteoverrule=" << ( ( Data.IP.RemoteOverrule ) ? "yes" : "no" ) << endl; |
99 | TS << "gwaddress=" << Data.IP.GWAddress << endl; | 122 | TS << "iplocaladdress=" << Data.IP.LocalAddress << endl; |
123 | TS << "ipremoteaddress=" << Data.IP.RemoteAddress << endl; | ||
124 | TS << "ipgwaddress=" << Data.IP.GWAddress << endl; | ||
125 | |||
126 | TS << "runpreconnect=" << Data.Run.PreConnect << endl; | ||
127 | TS << "runpostconnect=" << Data.Run.PostConnect << endl; | ||
128 | TS << "runpredisconnect=" << Data.Run.PreDisconnect << endl; | ||
129 | TS << "runpostdisconnect=" << Data.Run.PostDisconnect << endl; | ||
130 | |||
100 | } | 131 | } |
101 | 132 | ||
102 | QWidget * APPP::edit( QWidget * parent ) { | 133 | QWidget * APPP::edit( QWidget * parent ) { |
103 | GUI = new PPPEdit( parent ); | 134 | GUI = new PPPEdit( parent ); |
104 | GUI->showData( Data ); | 135 | GUI->showData( Data ); |
105 | return GUI; | 136 | return GUI; |
106 | } | 137 | } |
107 | 138 | ||
108 | QString APPP::acceptable( void ) { | 139 | QString APPP::acceptable( void ) { |
109 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 140 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
110 | } | 141 | } |
111 | 142 | ||
112 | void APPP::commit( void ) { | 143 | void APPP::commit( void ) { |
113 | if( GUI && GUI->commit( Data ) ) { | 144 | if( GUI && GUI->commit( Data ) ) { |
114 | setModified( 1 ); | 145 | setModified( 1 ); |
115 | } | 146 | } |
116 | } | 147 | } |
117 | 148 | ||
118 | QFile * APPP::openFile( const QString & ID ) { | 149 | bool APPP::openFile( SystemFile & SF ) { |
119 | QFile * F = 0; | 150 | if( SF.name() == "peers" ) { |
120 | QString S; | 151 | SF.setPath( removeSpaces( |
121 | 152 | QString( "/tmp/ppp/peers/" ) + connection()->name() ) ); | |
122 | if( ID == "peers" ) { | 153 | return 1; |
123 | S = removeSpaces( QString("/tmp/") + connection()->name() ); | 154 | } else if ( SF.name() == "chatscripts" ) { |
124 | 155 | SF.setPath( removeSpaces( | |
125 | F = new QFile( S ); | 156 | QString( "/tmp/chatscripts/" ) + connection()->name() ) ); |
126 | 157 | return 1; | |
127 | if( ! F->open( IO_WriteOnly ) ) { | ||
128 | Log(("Cannot open file %s\n", S.latin1() )); | ||
129 | return 0; | ||
130 | } | ||
131 | } else if ( ID == "chatscripts" ) { | ||
132 | S = removeSpaces( QString("/tmp/") + connection()->name() + ".chat" ); | ||
133 | F = new QFile( S ); | ||
134 | |||
135 | if( ! F->open( IO_WriteOnly ) ) { | ||
136 | Log(("Cannot open file %s\n", S.latin1() )); | ||
137 | return 0; | ||
138 | } | ||
139 | } | 158 | } |
140 | if( F ) { | 159 | return 0; |
141 | Log(("Generate proper file %s = %s\n", | ||
142 | ID.latin1(), F->name().latin1())); | ||
143 | } | ||
144 | return F; | ||
145 | } | 160 | } |
146 | 161 | ||
147 | short APPP::generateFile( const QString & ID, | 162 | short APPP::generateFile( SystemFile & SF, long DevNr ) { |
148 | const QString & Path, | ||
149 | QTextStream & TS, | ||
150 | long DevNr ) { | ||
151 | short rvl, rvd; | 163 | short rvl, rvd; |
152 | 164 | ||
153 | rvl = 1; | 165 | rvl = 1; |
154 | rvd = 1; | 166 | rvd = 1; |
155 | 167 | ||
156 | if( ID == "pap-secrets" ) { | 168 | if( SF.name() == "pap-secrets" ) { |
157 | Log(("Generate PPP for %s\n", ID.latin1() )); | 169 | Log(("Generate PPP for %s\n", SF.name().latin1() )); |
170 | |||
158 | if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) { | 171 | if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) { |
159 | TS << "# secrets for " | 172 | SF << "# secrets for " |
160 | << connection()->name().latin1() | 173 | << connection()->name().latin1() |
161 | << endl; | 174 | << endl; |
162 | TS << Data.Auth.Client | 175 | SF << Data.Auth.Client |
163 | << " " | 176 | << " " |
164 | << Data.Auth.Server | 177 | << Data.Auth.Server |
165 | << " " | 178 | << " " |
166 | << Data.Auth.Secret | 179 | << Data.Auth.Secret |
167 | << endl; | 180 | << endl; |
168 | rvl = 0; | 181 | rvl = 0; |
169 | rvd = connection()->getToplevel()->generateFileEmbedded( | 182 | rvd = connection()->getToplevel()->generateFileEmbedded( |
170 | ID, Path, TS, DevNr ); | 183 | SF, DevNr ); |
171 | } | 184 | } |
172 | } else if( ID == "chap-secrets" ) { | 185 | } else if( SF.name() == "chap-secrets" ) { |
173 | Log(("Generate PPP for %s\n", ID.latin1() )); | 186 | Log(("Generate PPP for %s\n", SF.name().latin1() )); |
174 | if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) { | 187 | if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) { |
175 | // used for both EAP and Chap | 188 | // used for both EAP and Chap |
176 | TS << "# secrets for " | 189 | SF << "# secrets for " |
177 | << connection()->name().latin1() | 190 | << connection()->name().latin1() |
178 | << endl; | 191 | << endl; |
179 | TS << Data.Auth.Client | 192 | SF << Data.Auth.Client |
180 | << " " | 193 | << " " |
181 | << Data.Auth.Server | 194 | << Data.Auth.Server |
182 | << " " | 195 | << " " |
183 | << Data.Auth.Secret | 196 | << Data.Auth.Secret |
184 | << endl; | 197 | << endl; |
185 | 198 | ||
186 | rvl = 0; | 199 | rvl = 0; |
187 | rvd = connection()->getToplevel()->generateFileEmbedded( | 200 | rvd = connection()->getToplevel()->generateFileEmbedded( |
188 | ID, Path, TS, DevNr ); | 201 | SF, DevNr ); |
189 | } | 202 | } |
190 | } else if ( ID == "peers" ) { | 203 | } else if ( SF.name() == "peers" ) { |
191 | QFileInfo FI(Path); | 204 | |
192 | Log(("Generate PPP for %s\n", ID.latin1() )); | 205 | QFileInfo FI(SF.path()); |
206 | Log(("Generate PPP for %s\n", SF.name().latin1() )); | ||
193 | 207 | ||
194 | TS << "connect \"/usr/sbin/chat -v -f /etc/ppp/" | 208 | SF << "connect \"/usr/sbin/chat -v -f /etc/chatscripts/" |
195 | << FI.baseName() | 209 | << FI.baseName() |
196 | << ".chat\"" | 210 | << "\"" |
197 | << endl; | 211 | << endl; |
198 | 212 | ||
199 | if( Data.IP.GWIsDefault ) { | 213 | if( Data.IP.GWIsDefault ) { |
200 | TS << "defaultroute" | 214 | SF << "defaultroute" |
201 | << endl; | 215 | << endl; |
202 | } | 216 | } |
203 | 217 | ||
204 | TS << "linkname " | 218 | SF << "linkname " |
205 | << removeSpaces( ID.latin1() ) | 219 | << removeSpaces( SF.name().latin1() ) |
206 | << endl; | 220 | << endl; |
207 | 221 | ||
208 | // insert other data here | 222 | // insert other data here |
209 | rvl = 0; | 223 | rvl = 0; |
210 | rvd = connection()->getToplevel()->generateFileEmbedded( | 224 | rvd = connection()->getToplevel()->generateFileEmbedded( |
211 | ID, Path, TS, DevNr ); | 225 | SF, DevNr ); |
212 | } else if ( ID == "chatscripts" ) { | 226 | } else if ( SF.name() == "chatscripts" ) { |
213 | Log(("Generate PPP for %s\n", ID.latin1() )); | 227 | Log(("Generate PPP for %s\n", SF.name().latin1() )); |
214 | rvl = 0; | 228 | rvl = 0; |
215 | rvd = connection()->getToplevel()->generateFileEmbedded( | 229 | rvd = connection()->getToplevel()->generateFileEmbedded( |
216 | ID, Path, TS, DevNr ); | 230 | SF, DevNr ); |
217 | } | 231 | } |
218 | 232 | ||
219 | return (rvd == 2 || rvl == 2 ) ? 2 : | 233 | return (rvd == 2 || rvl == 2 ) ? 2 : |
220 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | 234 | (rvd == 0 || rvl == 0 ) ? 0 : 1; |
221 | } | 235 | } |
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 | |||
@@ -1,51 +1,45 @@ | |||
1 | #ifndef PPP_H | 1 | #ifndef PPP_H |
2 | #define PPP_H | 2 | #define PPP_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "pppdata.h" | 5 | #include "pppdata.h" |
6 | #include "ppprun.h" | 6 | #include "ppprun.h" |
7 | 7 | ||
8 | class PPPNetNode; | 8 | class PPPNetNode; |
9 | class PPPEdit; | 9 | class PPPEdit; |
10 | class QTextStream; | 10 | class QTextStream; |
11 | 11 | ||
12 | class APPP : public ANetNodeInstance { | 12 | class APPP : public ANetNodeInstance { |
13 | 13 | ||
14 | public : | 14 | public : |
15 | 15 | ||
16 | APPP( PPPNetNode * PNN ); | 16 | APPP( PPPNetNode * PNN ); |
17 | 17 | ||
18 | RuntimeInfo * runtime( void ) | 18 | RuntimeInfo * runtime( void ) |
19 | { if( RT == 0 ) { | 19 | { return (RT) ? RT : (RT = new PPPRun( this, Data ) ); } |
20 | RT = new PPPRun( this, Data ); | ||
21 | } | ||
22 | return RT->runtimeInfo(); | ||
23 | } | ||
24 | 20 | ||
25 | QWidget * edit( QWidget * parent ); | 21 | QWidget * edit( QWidget * parent ); |
26 | QString acceptable( void ); | 22 | QString acceptable( void ); |
27 | void commit( void ); | 23 | void commit( void ); |
28 | 24 | ||
29 | virtual void * data( void ) | 25 | virtual void * data( void ) |
30 | { return (void *)&Data; } | 26 | { return (void *)&Data; } |
31 | 27 | ||
32 | virtual QFile * openFile( const QString & ID ); | 28 | virtual bool openFile( SystemFile & Sf ); |
33 | short generateFile( const QString & ID, | 29 | short generateFile( SystemFile & TS, |
34 | const QString & Path, | ||
35 | QTextStream & TS, | ||
36 | long DevNr ); | 30 | long DevNr ); |
37 | 31 | ||
38 | protected : | 32 | protected : |
39 | 33 | ||
40 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 34 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
41 | virtual void saveSpecificAttribute( QTextStream & TS ); | 35 | virtual void saveSpecificAttribute( QTextStream & TS ); |
42 | 36 | ||
43 | private : | 37 | private : |
44 | 38 | ||
45 | PPPEdit * GUI; | 39 | PPPEdit * GUI; |
46 | PPPData Data; | 40 | PPPData Data; |
47 | PPPRun * RT; | 41 | PPPRun * RT; |
48 | 42 | ||
49 | }; | 43 | }; |
50 | 44 | ||
51 | #endif | 45 | #endif |
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,38 +1,50 @@ | |||
1 | #ifndef PPP_DATA_H | 1 | #ifndef PPP_DATA_H |
2 | #define PPP_DATA_H | 2 | #define PPP_DATA_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qarray.h> | 5 | #include <qarray.h> |
6 | 6 | ||
7 | typedef struct PPPData { | 7 | class PPPData { |
8 | |||
9 | public : | ||
10 | |||
8 | struct { | 11 | struct { |
9 | bool IPAutomatic; | 12 | bool LocalOverrule; |
10 | QString IPAddress; | 13 | bool RemoteOverrule; |
11 | QString IPSubMask; | 14 | QString LocalAddress; |
15 | QString RemoteAddress; | ||
12 | bool GWAutomatic; | 16 | bool GWAutomatic; |
13 | QString GWAddress; | 17 | QString GWAddress; |
14 | bool GWIsDefault; | 18 | bool GWIsDefault; |
19 | bool GWIfNotSet; | ||
15 | } IP; | 20 | } IP; |
21 | |||
16 | struct { | 22 | struct { |
17 | short Mode; // 0 login, 1 chap/pap, 2 Terminal | 23 | short Mode; // 0 login, 1 chap/pap, 2 Terminal |
18 | struct { | 24 | struct { |
19 | QString Expect; | 25 | QString Expect; |
20 | QString Send; | 26 | QString Send; |
21 | } Login; | 27 | } Login; |
22 | struct { | 28 | struct { |
23 | QString Expect; | 29 | QString Expect; |
24 | QString Send; | 30 | QString Send; |
25 | } Password; | 31 | } Password; |
26 | short PCEMode; // 0 pap, 1, chap 2, EAP | 32 | short PCEMode; // 0 pap, 1, chap 2, EAP |
27 | QString Server; | 33 | QString Server; |
28 | QString Client; | 34 | QString Client; |
29 | QString Secret; | 35 | QString Secret; |
30 | } Auth; | 36 | } Auth; |
31 | struct { | 37 | struct { |
32 | bool ServerAssigned; | 38 | bool ServerAssigned; |
33 | QString DomainName; | 39 | QString DomainName; |
34 | QArray<QString *> Servers; | 40 | QArray<QString *> Servers; |
35 | } DNS; | 41 | } DNS; |
36 | } PPPData_t; | 42 | struct { |
43 | QString PreConnect; | ||
44 | QString PostConnect; | ||
45 | QString PreDisconnect; | ||
46 | QString PostDisconnect; | ||
47 | } Run; | ||
48 | }; | ||
37 | 49 | ||
38 | #endif | 50 | #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,82 +1,52 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | #include "ppprun.h" | 2 | #include "ppprun.h" |
3 | 3 | ||
4 | PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : | 4 | PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : |
5 | AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) { | 5 | RuntimeInfo( NNI ), Pat( "eth[0-9]" ) { |
6 | D = &Data; | 6 | D = &Data; |
7 | } | 7 | } |
8 | 8 | ||
9 | void PPPRun::detectState( NodeCollection * NC ) { | 9 | State_t PPPRun::detectState( void ) { |
10 | if( isMyPPPDRunning( ) ) { | 10 | if( isMyPPPDRunning( ) ) { |
11 | if( isMyPPPUp() ) { | 11 | return ( isMyPPPUp() ) ? IsUp : Available; |
12 | NC->setCurrentState( IsUp ); | 12 | } |
13 | } else { | 13 | return Off; |
14 | NC->setCurrentState( Available ); | ||
15 | } | ||
16 | } else { | ||
17 | NC->setCurrentState( Off ); // at least this | ||
18 | // but could also be unavailable | ||
19 | AsDevice::netNode()->nextNode()->runtime()->detectState( NC ); | ||
20 | } | ||
21 | } | 14 | } |
22 | 15 | ||
23 | bool PPPRun::setState( NodeCollection * NC, Action_t A, bool ) { | 16 | QString PPPRun::setMyState( NodeCollection * NC, Action_t A, bool ) { |
24 | switch( A ) { | 17 | return QString(); |
25 | case Activate : | ||
26 | NC->setCurrentState( Available ); | ||
27 | // no | ||
28 | break; | ||
29 | case Deactivate : | ||
30 | if( NC->currentState() == IsUp ) { | ||
31 | NC->state( Down ); | ||
32 | } | ||
33 | // cannot really disable | ||
34 | NC->setCurrentState( Available ); | ||
35 | break; | ||
36 | case Up : | ||
37 | if( NC->currentState() != IsUp ) { | ||
38 | // start my PPPD | ||
39 | NC->setCurrentState( IsUp ); | ||
40 | } | ||
41 | break; | ||
42 | case Down : | ||
43 | if( NC->currentState() == IsUp ) { | ||
44 | // stop my PPPD | ||
45 | NC->setCurrentState( Available ); | ||
46 | } | ||
47 | break; | ||
48 | default : // FT | ||
49 | break; | ||
50 | } | ||
51 | return 1; | ||
52 | } | 18 | } |
53 | 19 | ||
54 | bool PPPRun::isMyPPPDRunning( void ) { | 20 | bool PPPRun::isMyPPPDRunning( void ) { |
55 | return 0; | 21 | return 0; |
56 | } | 22 | } |
57 | 23 | ||
58 | bool PPPRun::isMyPPPUp( void ) { | 24 | bool PPPRun::isMyPPPUp( void ) { |
59 | System & S = NSResources->system(); | 25 | System & S = NSResources->system(); |
60 | InterfaceInfo * Run; | 26 | InterfaceInfo * Run; |
61 | QRegExp R( "ppp[0-9]" ); | 27 | QRegExp R( "ppp[0-9]" ); |
62 | 28 | ||
63 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 29 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
64 | It.current(); | 30 | It.current(); |
65 | ++It ) { | 31 | ++It ) { |
66 | Run = It.current(); | 32 | Run = It.current(); |
67 | if( R.match( Run->Name ) >= 0 && | 33 | if( R.match( Run->Name ) >= 0 && |
68 | Run->IsPointToPoint | 34 | Run->IsPointToPoint |
69 | ) { | 35 | ) { |
70 | // this is a LAN card | 36 | // this is a LAN card |
71 | if( Run->assignedNode() == AsDevice::netNode() ) { | 37 | if( Run->assignedConnection() == netNode()->connection() ) { |
72 | // assigned to us | 38 | // assigned to us |
73 | return 1; | 39 | return 1; |
74 | } | 40 | } |
75 | } | 41 | } |
76 | } | 42 | } |
77 | return 0; | 43 | return 0; |
78 | } | 44 | } |
79 | 45 | ||
80 | bool PPPRun::handlesInterface( const QString & S ) { | 46 | bool PPPRun::handlesInterface( const QString & S ) { |
81 | return Pat.match( S ) >= 0; | 47 | return Pat.match( S ) >= 0; |
82 | } | 48 | } |
49 | |||
50 | bool PPPRun::handlesInterface( InterfaceInfo * I ) { | ||
51 | return handlesInterface( I->Name ); | ||
52 | } | ||
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h index 90a3f25..2990a96 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.h +++ b/noncore/settings/networksettings2/ppp/ppprun.h | |||
@@ -1,47 +1,37 @@ | |||
1 | #ifndef PPPRUN_H | 1 | #ifndef PPPRUN_H |
2 | #define PPPRUN_H | 2 | #define PPPRUN_H |
3 | 3 | ||
4 | #include <qregexp.h> | 4 | #include <qregexp.h> |
5 | #include <asconnection.h> | 5 | #include <netnode.h> |
6 | #include <asdevice.h> | ||
7 | #include "pppdata.h" | 6 | #include "pppdata.h" |
8 | 7 | ||
9 | class PPPRun : public AsConnection, public AsDevice { | 8 | class PPPRun : public RuntimeInfo { |
10 | 9 | ||
11 | public : | 10 | public : |
12 | 11 | ||
13 | PPPRun( ANetNodeInstance * NNI, | 12 | PPPRun( ANetNodeInstance * NNI, |
14 | PPPData & Data ); | 13 | PPPData & Data ); |
15 | 14 | ||
16 | virtual AsDevice * asDevice( void ) | 15 | bool handlesInterface( const QString & I ); |
17 | { return (AsDevice *)this; } | 16 | bool handlesInterface( InterfaceInfo * ); |
18 | virtual AsConnection * asConnection( void ) | ||
19 | { return (AsConnection *)this; } | ||
20 | |||
21 | virtual AsDevice * device( void ) | ||
22 | { return (AsDevice *)this; } | ||
23 | 17 | ||
24 | virtual RuntimeInfo * runtimeInfo( void ) | 18 | State_t detectState( void ); |
25 | { return ( AsConnection *)this; } | 19 | virtual RuntimeInfo * device( void ) |
20 | { return this; } | ||
21 | virtual RuntimeInfo * connection( void ) | ||
22 | { return this; } | ||
26 | 23 | ||
27 | protected : | 24 | protected : |
28 | 25 | ||
29 | void detectState( NodeCollection * NC ); | 26 | QString setMyState( NodeCollection * , Action_t, bool ); |
30 | bool setState( NodeCollection * NC, Action_t A, bool ); | ||
31 | bool canSetState( State_t S, Action_t A ) | ||
32 | { return AsDevice::connection()->findNext( | ||
33 | AsDevice::netNode() )->runtime()->canSetState( S,A ); } | ||
34 | |||
35 | bool handlesInterface( const QString & I ); | ||
36 | 27 | ||
37 | private : | 28 | private : |
38 | 29 | ||
39 | bool isMyPPPDRunning( void ); | 30 | bool isMyPPPDRunning( void ); |
40 | bool isMyPPPUp( void ); | 31 | bool isMyPPPUp( void ); |
41 | 32 | ||
42 | PPPData_t * D; | 33 | PPPData * D; |
43 | QRegExp Pat; | 34 | QRegExp Pat; |
44 | |||
45 | }; | 35 | }; |
46 | 36 | ||
47 | #endif | 37 | #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 @@ | |||
1 | Package: opie-networksettingsplugin2-profile | 1 | Package: opie-networksettings2plugin-profile |
2 | Files: plugins/networksettings2/libprofile.so* | 2 | Files: plugins/networksettings2/libprofile.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Network settings profile plugin. | 8 | Description: Network settings usage profile plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,51 +1,60 @@ | |||
1 | #include <resources.h> | ||
1 | #include "profile_NN.h" | 2 | #include "profile_NN.h" |
2 | #include "profile_NNI.h" | 3 | #include "profile_NNI.h" |
3 | 4 | ||
4 | static const char * ProfileNeeds[] = | 5 | static const char * ProfileNeeds[] = |
5 | { "connection", | 6 | { "connection", |
6 | 0 | 7 | 0 |
7 | }; | 8 | }; |
9 | static const char * ProfileProvides[] = | ||
10 | { "fullsetup", | ||
11 | 0 | ||
12 | }; | ||
8 | 13 | ||
9 | /** | 14 | /** |
10 | * Constructor, find all of the possible interfaces | 15 | * Constructor, find all of the possible interfaces |
11 | */ | 16 | */ |
12 | ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) { | 17 | ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) { |
18 | |||
19 | NSResources->addSystemFile( | ||
20 | "interfaces", "/etc/network/interfaces", 1 ); | ||
21 | |||
13 | } | 22 | } |
14 | 23 | ||
15 | /** | 24 | /** |
16 | * Delete any interfaces that we own. | 25 | * Delete any interfaces that we own. |
17 | */ | 26 | */ |
18 | ProfileNetNode::~ProfileNetNode(){ | 27 | ProfileNetNode::~ProfileNetNode(){ |
19 | } | 28 | } |
20 | 29 | ||
21 | const QString ProfileNetNode::nodeDescription(){ | 30 | const QString ProfileNetNode::nodeDescription(){ |
22 | return tr("\ | 31 | return tr("\ |
23 | <p>Define use of an IP connection.</p>\ | 32 | <p>Define use of an IP connection.</p>\ |
24 | <p>Configure if and when this connection needs to be established</p>\ | 33 | <p>Configure if and when this connection needs to be established</p>\ |
25 | " | 34 | " |
26 | ); | 35 | ); |
27 | } | 36 | } |
28 | 37 | ||
29 | ANetNodeInstance * ProfileNetNode::createInstance( void ) { | 38 | ANetNodeInstance * ProfileNetNode::createInstance( void ) { |
30 | return new AProfile( this ); | 39 | return new AProfile( this ); |
31 | } | 40 | } |
32 | 41 | ||
33 | const char ** ProfileNetNode::needs( void ) { | 42 | const char ** ProfileNetNode::needs( void ) { |
34 | return ProfileNeeds; | 43 | return ProfileNeeds; |
35 | } | 44 | } |
36 | 45 | ||
37 | const char * ProfileNetNode::provides( void ) { | 46 | const char ** ProfileNetNode::provides( void ) { |
38 | return "fullsetup"; | 47 | return ProfileProvides; |
39 | } | 48 | } |
40 | 49 | ||
41 | void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { | 50 | void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { |
42 | } | 51 | } |
43 | 52 | ||
44 | void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { | 53 | void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { |
45 | } | 54 | } |
46 | 55 | ||
47 | extern "C" { | 56 | extern "C" { |
48 | void create_plugin( QList<ANetNode> & PNN ) { | 57 | void create_plugin( QList<ANetNode> & PNN ) { |
49 | PNN.append( new ProfileNetNode() ); | 58 | PNN.append( new ProfileNetNode() ); |
50 | } | 59 | } |
51 | } | 60 | } |
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 | |||
@@ -1,36 +1,36 @@ | |||
1 | #ifndef PROFILE_NETNODE_H | 1 | #ifndef PROFILE_NETNODE_H |
2 | #define PROFILE_NETNODE_H | 2 | #define PROFILE_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AProfile; | 6 | class AProfile; |
7 | 7 | ||
8 | class ProfileNetNode : public ANetNode{ | 8 | class ProfileNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | ProfileNetNode(); | 14 | ProfileNetNode(); |
15 | virtual ~ProfileNetNode(); | 15 | virtual ~ProfileNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/commprofile"; } | 18 | { return "Devices/commprofile"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
21 | virtual ANetNodeInstance * createInstance( void ); | 21 | virtual ANetNodeInstance * createInstance( void ); |
22 | virtual const char ** needs( void ); | 22 | virtual const char ** needs( void ); |
23 | virtual const char * provides( void ); | 23 | virtual const char ** provides( void ); |
24 | 24 | ||
25 | private: | 25 | private: |
26 | 26 | ||
27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
28 | virtual void saveSpecificAttribute( QTextStream & TS ); | 28 | virtual void saveSpecificAttribute( QTextStream & TS ); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | extern "C" | 31 | extern "C" |
32 | { | 32 | { |
33 | void create_plugin( QList<ANetNode> & PNN ); | 33 | void create_plugin( QList<ANetNode> & PNN ); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #endif | 36 | #endif |
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,77 +1,76 @@ | |||
1 | #include <opie2/odebug.h> | ||
1 | #include "profileedit.h" | 2 | #include "profileedit.h" |
2 | #include "profile_NNI.h" | 3 | #include "profile_NNI.h" |
3 | #include "profile_NN.h" | 4 | #include "profile_NN.h" |
4 | 5 | ||
5 | AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) { | 6 | AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) { |
6 | Data.Automatic = 1; | 7 | Data.Automatic = 1; |
7 | Data.Confirm = 0; | 8 | Data.Confirm = 0; |
8 | Data.Description = ""; | 9 | Data.Description = ""; |
9 | Data.Disabled = 0; | 10 | Data.Disabled = 0; |
10 | Data.TriggerVPN = 0; | 11 | Data.TriggerVPN = 0; |
11 | GUI = 0; | 12 | GUI = 0; |
12 | RT = 0; | 13 | RT = 0; |
13 | } | 14 | } |
14 | 15 | ||
15 | void AProfile::setSpecificAttribute( QString & Attr, QString & Value ) { | 16 | void AProfile::setSpecificAttribute( QString & Attr, QString & Value ) { |
16 | 17 | ||
17 | if ( Attr == "automatic" ) { | 18 | if ( Attr == "automatic" ) { |
18 | Data.Automatic = (Value=="yes"); | 19 | Data.Automatic = (Value=="yes"); |
19 | } else if ( Attr == "preconfirm" ) { | 20 | } else if ( Attr == "preconfirm" ) { |
20 | Data.Confirm = (Value=="yes"); | 21 | Data.Confirm = (Value=="yes"); |
21 | } else if ( Attr == "disabled" ) { | 22 | } else if ( Attr == "disabled" ) { |
22 | Data.Disabled = (Value=="yes"); | 23 | Data.Disabled = (Value=="yes"); |
23 | } else if ( Attr == "triggervpn" ) { | 24 | } else if ( Attr == "triggervpn" ) { |
24 | Data.TriggerVPN = (Value=="yes"); | 25 | Data.TriggerVPN = (Value=="yes"); |
25 | } else if ( Attr == "description" ) { | 26 | } else if ( Attr == "description" ) { |
26 | Data.Description = Value; | 27 | Data.Description = Value; |
27 | } | 28 | } |
28 | } | 29 | } |
29 | 30 | ||
30 | void AProfile::saveSpecificAttribute( QTextStream & TS ) { | 31 | void AProfile::saveSpecificAttribute( QTextStream & TS ) { |
31 | TS << "automatic=" << ((Data.Automatic) ? "yes" : "no") << endl; | 32 | TS << "automatic=" << ((Data.Automatic) ? "yes" : "no") << endl; |
32 | TS << "preconfirm=" << ((Data.Confirm) ? "yes" : "no") << endl; | 33 | TS << "preconfirm=" << ((Data.Confirm) ? "yes" : "no") << endl; |
33 | TS << "disabled=" << ((Data.Disabled) ? "yes" : "no") << endl; | 34 | TS << "disabled=" << ((Data.Disabled) ? "yes" : "no") << endl; |
34 | TS << "triggervpn=" << ((Data.TriggerVPN) ? "yes" : "no") << endl; | 35 | TS << "triggervpn=" << ((Data.TriggerVPN) ? "yes" : "no") << endl; |
35 | TS << "description=" << Data.Description << endl; | 36 | TS << "description=" << Data.Description << endl; |
36 | } | 37 | } |
37 | 38 | ||
38 | QWidget * AProfile::edit( QWidget * parent ) { | 39 | QWidget * AProfile::edit( QWidget * parent ) { |
39 | GUI = new ProfileEdit( parent, this ); | 40 | GUI = new ProfileEdit( parent, this ); |
40 | GUI->showData( Data ); | 41 | GUI->showData( Data ); |
41 | return GUI; | 42 | return GUI; |
42 | } | 43 | } |
43 | 44 | ||
44 | QString AProfile::acceptable( void ) { | 45 | QString AProfile::acceptable( void ) { |
45 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 46 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
46 | } | 47 | } |
47 | 48 | ||
48 | void AProfile::commit( void ) { | 49 | void AProfile::commit( void ) { |
49 | if( GUI && GUI->commit( Data ) ) | 50 | if( GUI && GUI->commit( Data ) ) |
50 | setModified( 1 ); | 51 | setModified( 1 ); |
51 | } | 52 | } |
52 | 53 | ||
53 | short AProfile::generateFileEmbedded( const QString & ID, | 54 | short AProfile::generateFileEmbedded( SystemFile & SF, |
54 | const QString & Path, | ||
55 | QTextStream & TS, | ||
56 | long DevNr ) { | 55 | long DevNr ) { |
57 | 56 | ||
58 | short rvl, rvd; | 57 | short rvl, rvd; |
59 | 58 | ||
60 | rvl = 1; | 59 | rvl = 1; |
61 | 60 | ||
62 | if( ID == "interfaces" ) { | 61 | if( SF.name() == "interfaces" ) { |
63 | Log(("Generate Profile for %s\n", ID.latin1() )); | 62 | Log(("Generate Profile for %s\n", SF.name().latin1() )); |
64 | if( Data.TriggerVPN ) { | 63 | if( Data.TriggerVPN ) { |
65 | // this profile triggers VPN -> insert trigger | 64 | // this profile triggers VPN -> insert trigger |
66 | TS << " up networksettings2 --triggervpn" | 65 | SF << " up networksettings2 --triggervpn" |
67 | << endl; | 66 | << endl; |
68 | rvl = 0; | 67 | rvl = 0; |
69 | } | 68 | } |
70 | } | 69 | } |
71 | rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr ); | 70 | rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr ); |
72 | return (rvd == 2 || rvl == 2 ) ? 2 : | 71 | return (rvd == 2 || rvl == 2 ) ? 2 : |
73 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | 72 | (rvd == 0 || rvl == 0 ) ? 0 : 1; |
74 | } | 73 | } |
75 | 74 | ||
76 | 75 | ||
77 | 76 | ||
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 | |||
@@ -1,50 +1,48 @@ | |||
1 | #ifndef PROFILE_H | 1 | #ifndef PROFILE_H |
2 | #define PROFILE_H | 2 | #define PROFILE_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "profiledata.h" | 5 | #include "profiledata.h" |
6 | #include "profilerun.h" | 6 | #include "profilerun.h" |
7 | 7 | ||
8 | class ProfileNetNode; | 8 | class ProfileNetNode; |
9 | class ProfileEdit; | 9 | class ProfileEdit; |
10 | 10 | ||
11 | class AProfile : public ANetNodeInstance { | 11 | class AProfile : public ANetNodeInstance { |
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | AProfile( ProfileNetNode * PNN ); | 15 | AProfile( ProfileNetNode * PNN ); |
16 | 16 | ||
17 | RuntimeInfo * runtime( void ) | 17 | RuntimeInfo * runtime( void ) |
18 | { return | 18 | { return |
19 | ( RT ) ? RT : ( RT = new ProfileRun( this, Data ) ); | 19 | ( RT ) ? RT : ( RT = new ProfileRun( this, Data ) ); |
20 | } | 20 | } |
21 | 21 | ||
22 | QWidget * edit( QWidget * parent ); | 22 | QWidget * edit( QWidget * parent ); |
23 | QString acceptable( void ); | 23 | QString acceptable( void ); |
24 | void commit( void ); | 24 | void commit( void ); |
25 | 25 | ||
26 | virtual void * data( void ) | 26 | virtual void * data( void ) |
27 | { return (void *)&Data; } | 27 | { return (void *)&Data; } |
28 | 28 | ||
29 | virtual short generateFileEmbedded( const QString & ID, | 29 | virtual short generateFileEmbedded( SystemFile & TS, |
30 | const QString & Path, | ||
31 | QTextStream & TS, | ||
32 | long DevNr ); | 30 | long DevNr ); |
33 | 31 | ||
34 | const QString & description( void ) | 32 | const QString & description( void ) |
35 | { return Data.Description; } | 33 | { return Data.Description; } |
36 | 34 | ||
37 | protected : | 35 | protected : |
38 | 36 | ||
39 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
40 | virtual void saveSpecificAttribute( QTextStream & TS ); | 38 | virtual void saveSpecificAttribute( QTextStream & TS ); |
41 | 39 | ||
42 | private : | 40 | private : |
43 | 41 | ||
44 | ProfileEdit * GUI; | 42 | ProfileEdit * GUI; |
45 | ProfileData Data; | 43 | ProfileData Data; |
46 | ProfileRun * RT; | 44 | ProfileRun * RT; |
47 | 45 | ||
48 | }; | 46 | }; |
49 | 47 | ||
50 | #endif | 48 | #endif |
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 @@ | |||
1 | #ifndef PROFILE_DATA_H | 1 | #ifndef PROFILE_DATA_H |
2 | #define PROFILE_DATA_H | 2 | #define PROFILE_DATA_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | typedef struct ProfileData { | 5 | class ProfileData { |
6 | public : | ||
6 | QString Description; | 7 | QString Description; |
7 | // start up automatically | 8 | // start up automatically |
8 | bool Automatic; | 9 | bool Automatic; |
9 | // if started up automatically, ask user for confirmation | 10 | // if started up automatically, ask user for confirmation |
10 | bool Confirm; | 11 | bool Confirm; |
11 | // Do not bring this connection up | 12 | // Do not bring this connection up |
12 | bool Disabled; | 13 | bool Disabled; |
13 | bool TriggerVPN; | 14 | bool TriggerVPN; |
14 | } ProfileData_t; | 15 | } ; |
15 | 16 | ||
16 | #endif | 17 | #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,98 +1,98 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qframe.h> | 2 | #include <qframe.h> |
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qmultilineedit.h> | 4 | #include <qmultilineedit.h> |
5 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
6 | 6 | ||
7 | #include <GUIUtils.h> | 7 | #include <GUIUtils.h> |
8 | #include <asdevice.h> | 8 | #include <netnode.h> |
9 | #include <resources.h> | 9 | #include <resources.h> |
10 | 10 | ||
11 | #include "profileedit.h" | 11 | #include "profileedit.h" |
12 | 12 | ||
13 | ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : | 13 | ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : |
14 | ProfileGUI( Parent ), RefreshTimer(this) { | 14 | ProfileGUI( Parent ), RefreshTimer(this) { |
15 | InterfaceInfo * II; | 15 | InterfaceInfo * II; |
16 | 16 | ||
17 | NNI = TNNI; | 17 | NNI = TNNI; |
18 | Dev = NNI->runtime()->device(); | 18 | Dev = NNI->runtime()->device(); |
19 | if( ( II = Dev->assignedInterface() ) ) { | 19 | if( ( II = NNI->connection()->assignedInterface() ) ) { |
20 | 20 | ||
21 | Refresh_CB->setEnabled( TRUE ); | 21 | Refresh_CB->setEnabled( TRUE ); |
22 | Snd_GB->setEnabled( TRUE ); | 22 | Snd_GB->setEnabled( TRUE ); |
23 | Rcv_GB->setEnabled( TRUE ); | 23 | Rcv_GB->setEnabled( TRUE ); |
24 | Collisions_FRM->setEnabled( TRUE ); | 24 | Collisions_FRM->setEnabled( TRUE ); |
25 | 25 | ||
26 | // show current content | 26 | // show current content |
27 | SLOT_Refresh(); | 27 | SLOT_Refresh(); |
28 | 28 | ||
29 | // fill in static data | 29 | // fill in static data |
30 | InterfaceName_LBL->setText( II->Name ); | 30 | InterfaceName_LBL->setText( II->Name ); |
31 | IPAddress_LBL->setText( II->Address ); | 31 | IPAddress_LBL->setText( II->Address ); |
32 | SubnetMask_LBL->setText( II->Netmask ); | 32 | SubnetMask_LBL->setText( II->Netmask ); |
33 | Broadcast_LBL->setText( II->BCastAddress ); | 33 | Broadcast_LBL->setText( II->BCastAddress ); |
34 | MACAddress_LBL->setText( II->MACAddress ); | 34 | MACAddress_LBL->setText( II->MACAddress ); |
35 | if( II->IsPointToPoint ) { | 35 | if( II->IsPointToPoint ) { |
36 | PointToPoint_LBL->setText( II->DstAddress ); | 36 | PointToPoint_LBL->setText( II->DstAddress ); |
37 | } | 37 | } |
38 | QString S; | 38 | QString S; |
39 | InterfaceName_LBL->setText( II->Name ); | 39 | InterfaceName_LBL->setText( II->Name ); |
40 | if( II->HasMulticast ) { | 40 | if( II->HasMulticast ) { |
41 | S += "Multicast"; | 41 | S += "Multicast"; |
42 | } | 42 | } |
43 | if( ! S.isEmpty() ) { | 43 | if( ! S.isEmpty() ) { |
44 | S.prepend( " : " ); | 44 | S.prepend( " : " ); |
45 | } | 45 | } |
46 | InterfaceOptions_LBL->setText( S ); | 46 | InterfaceOptions_LBL->setText( S ); |
47 | 47 | ||
48 | connect( &RefreshTimer, SIGNAL( timeout() ), | 48 | connect( &RefreshTimer, SIGNAL( timeout() ), |
49 | this, SLOT( SLOT_Refresh() ) ); | 49 | this, SLOT( SLOT_Refresh() ) ); |
50 | } | 50 | } |
51 | 51 | ||
52 | } | 52 | } |
53 | 53 | ||
54 | QString ProfileEdit::acceptable( void ) { | 54 | QString ProfileEdit::acceptable( void ) { |
55 | return QString(); | 55 | return QString(); |
56 | } | 56 | } |
57 | 57 | ||
58 | void ProfileEdit::showData( ProfileData_t & Data ) { | 58 | void ProfileEdit::showData( ProfileData & Data ) { |
59 | Description_LE->setText( Data.Description ); | 59 | Description_LE->setText( Data.Description ); |
60 | Automatic_CB->setChecked( Data.Automatic ); | 60 | Automatic_CB->setChecked( Data.Automatic ); |
61 | TriggersVPN_CB->setChecked( Data.TriggerVPN ); | 61 | TriggersVPN_CB->setChecked( Data.TriggerVPN ); |
62 | Confirm_CB->setChecked( Data.Confirm ); | 62 | Confirm_CB->setChecked( Data.Confirm ); |
63 | Disabled_CB->setChecked( Data.Disabled ); | 63 | Disabled_CB->setChecked( Data.Disabled ); |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | bool ProfileEdit::commit( ProfileData_t & Data ) { | 67 | bool ProfileEdit::commit( ProfileData & Data ) { |
68 | bool SM = 0; | 68 | bool SM = 0; |
69 | TXTM( Data.Description, Description_LE, SM ); | 69 | TXTM( Data.Description, Description_LE, SM ); |
70 | 70 | ||
71 | CBM( Data.Automatic, Automatic_CB, SM ); | 71 | CBM( Data.Automatic, Automatic_CB, SM ); |
72 | CBM( Data.TriggerVPN, TriggersVPN_CB, SM ); | 72 | CBM( Data.TriggerVPN, TriggersVPN_CB, SM ); |
73 | CBM( Data.Disabled, Disabled_CB, SM ); | 73 | CBM( Data.Disabled, Disabled_CB, SM ); |
74 | CBM( Data.Confirm, Confirm_CB, SM ); | 74 | CBM( Data.Confirm, Confirm_CB, SM ); |
75 | 75 | ||
76 | return SM; | 76 | return SM; |
77 | } | 77 | } |
78 | 78 | ||
79 | void ProfileEdit::SLOT_Refresh( void ) { | 79 | void ProfileEdit::SLOT_Refresh( void ) { |
80 | InterfaceInfo * II = Dev->assignedInterface(); | 80 | InterfaceInfo * II = NNI->connection()->assignedInterface(); |
81 | NSResources->system().refreshStatistics( *II ); | 81 | NSResources->system().refreshStatistics( *II ); |
82 | RcvBytes_LBL->setText( II->RcvBytes ); | 82 | RcvBytes_LBL->setText( II->RcvBytes ); |
83 | SndBytes_LBL->setText( II->SndBytes ); | 83 | SndBytes_LBL->setText( II->SndBytes ); |
84 | RcvErrors_LBL->setText( II->RcvErrors ); | 84 | RcvErrors_LBL->setText( II->RcvErrors ); |
85 | SndErrors_LBL->setText( II->SndErrors ); | 85 | SndErrors_LBL->setText( II->SndErrors ); |
86 | RcvDropped_LBL->setText( II->RcvDropped ); | 86 | RcvDropped_LBL->setText( II->RcvDropped ); |
87 | SndDropped_LBL->setText( II->SndDropped ); | 87 | SndDropped_LBL->setText( II->SndDropped ); |
88 | Collisions_LBL->setText( II->Collisions ); | 88 | Collisions_LBL->setText( II->Collisions ); |
89 | } | 89 | } |
90 | 90 | ||
91 | void ProfileEdit::SLOT_AutoRefresh( bool ar ) { | 91 | void ProfileEdit::SLOT_AutoRefresh( bool ar ) { |
92 | if( ar ) { | 92 | if( ar ) { |
93 | RefreshTimer.start( 1000 ); | 93 | RefreshTimer.start( 1000 ); |
94 | SLOT_Refresh(); | 94 | SLOT_Refresh(); |
95 | } else { | 95 | } else { |
96 | RefreshTimer.stop(); | 96 | RefreshTimer.stop(); |
97 | } | 97 | } |
98 | } | 98 | } |
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 @@ | |||
1 | #include "profiledata.h" | 1 | #include "profiledata.h" |
2 | #include "profileGUI.h" | 2 | #include "profileGUI.h" |
3 | 3 | ||
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | class ANetNodeInstance; | 5 | class ANetNodeInstance; |
6 | class AsDevice; | 6 | class RuntimeInfo; |
7 | 7 | ||
8 | class ProfileEdit : public ProfileGUI { | 8 | class ProfileEdit : public ProfileGUI { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public : | 12 | public : |
13 | 13 | ||
14 | ProfileEdit( QWidget * parent, ANetNodeInstance * NNI ); | 14 | ProfileEdit( QWidget * parent, ANetNodeInstance * NNI ); |
15 | QString acceptable( void ); | 15 | QString acceptable( void ); |
16 | bool commit( ProfileData_t & Data ); | 16 | bool commit( ProfileData & Data ); |
17 | void showData( ProfileData_t & Data ); | 17 | void showData( ProfileData & Data ); |
18 | 18 | ||
19 | public slots : | 19 | public slots : |
20 | 20 | ||
21 | void SLOT_AutoRefresh( bool ); | 21 | void SLOT_AutoRefresh( bool ); |
22 | void SLOT_Refresh( void ); | 22 | void SLOT_Refresh( void ); |
23 | 23 | ||
24 | private : | 24 | private : |
25 | 25 | ||
26 | QTimer RefreshTimer; | 26 | QTimer RefreshTimer; |
27 | ANetNodeInstance * NNI; | 27 | ANetNodeInstance * NNI; |
28 | AsDevice * Dev; | 28 | RuntimeInfo * Dev; |
29 | }; | 29 | }; |
diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp index 1a5b15b..ab57a00 100644 --- a/noncore/settings/networksettings2/profile/profilerun.cpp +++ b/noncore/settings/networksettings2/profile/profilerun.cpp | |||
@@ -1,67 +1,27 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | 2 | ||
3 | #include "profilerun.h" | 3 | #include "profilerun.h" |
4 | 4 | ||
5 | void ProfileRun::detectState( NodeCollection * NC ) { | 5 | State_t ProfileRun::detectState( void ) { |
6 | if( Data->Disabled ) { | 6 | if( Data->Disabled ) { |
7 | Log(( "%s disabled\n", NC->name().latin1() )); | 7 | return Disabled; |
8 | NC->setCurrentState( Disabled ); | 8 | } |
9 | } else { | 9 | return Unknown; |
10 | Log(( "%s not disabled\n", NC->name().latin1() )); | ||
11 | // find next item in connection | ||
12 | // convert to runtime and ask to detect the state | ||
13 | netNode()->nextNode()->runtime()->detectState( NC ); | ||
14 | } | ||
15 | } | 10 | } |
16 | 11 | ||
17 | bool ProfileRun::setState( NodeCollection * NC, Action_t A, bool F ) { | 12 | QString ProfileRun::setMyState( NodeCollection * NC, Action_t A, bool ) { |
18 | ANetNodeInstance * NNNI; | 13 | owarn << "Profile " << Data->Disabled << oendl; |
19 | 14 | if( A == Disable ) { | |
20 | NNNI = netNode()->nextNode(); | 15 | if( ! Data->Disabled ) { |
21 | switch ( A ) { | ||
22 | case Enable : | ||
23 | if( NC->currentState() == Disabled ) { | ||
24 | Data->Disabled = 0; | ||
25 | NC->setCurrentState( Off ); // at least | ||
26 | // ... but request deeper | ||
27 | NNNI->runtime()->detectState(NC); | ||
28 | } | ||
29 | return 1; | ||
30 | case Disable : | ||
31 | switch( NC->currentState() ) { | ||
32 | case IsUp : | ||
33 | case Available : | ||
34 | // bring Deactivate (will bring down) | ||
35 | if( ! NNNI->runtime()->setState(NC, Deactivate) ) | ||
36 | return 0; | ||
37 | default : | ||
38 | break; | ||
39 | } | ||
40 | Data->Disabled = 1; | 16 | Data->Disabled = 1; |
41 | NC->setCurrentState( Disabled ); | 17 | NC->setModified( 1 ); |
42 | return 1; | 18 | } |
43 | default : | 19 | } else if( A == Enable ) { |
44 | break; | 20 | if( Data->Disabled ) { |
45 | } | 21 | Data->Disabled = 0; |
46 | return NNNI->runtime()->setState(NC, A, F ); | 22 | NC->setModified( 1 ); |
47 | } | 23 | } |
48 | |||
49 | bool ProfileRun::canSetState( State_t Curr, Action_t A ) { | ||
50 | RuntimeInfo * RI; | ||
51 | switch ( A ) { | ||
52 | case Enable : | ||
53 | case Disable : | ||
54 | // always possible | ||
55 | return 1; | ||
56 | default : | ||
57 | break; | ||
58 | } | 24 | } |
59 | RI = netNode()->nextNode()->runtime(); | ||
60 | return ( Curr != Disabled ) ? | ||
61 | RI->canSetState(Curr, A) : 0; | ||
62 | } | ||
63 | 25 | ||
64 | bool ProfileRun::handlesInterface( const QString & S ) { | 26 | return QString(); |
65 | // donno -> pass deeper | ||
66 | return netNode()->nextNode()->runtime()->handlesInterface(S); | ||
67 | } | 27 | } |
diff --git a/noncore/settings/networksettings2/profile/profilerun.h b/noncore/settings/networksettings2/profile/profilerun.h index 400b56c..2d48b15 100644 --- a/noncore/settings/networksettings2/profile/profilerun.h +++ b/noncore/settings/networksettings2/profile/profilerun.h | |||
@@ -1,35 +1,33 @@ | |||
1 | #ifndef PROFILERUN_H | 1 | #ifndef PROFILERUN_H |
2 | #define PROFILERUN_H | 2 | #define PROFILERUN_H |
3 | 3 | ||
4 | #include <asfullsetup.h> | 4 | #include <netnode.h> |
5 | #include "profiledata.h" | 5 | #include "profiledata.h" |
6 | 6 | ||
7 | class ProfileRun : public AsFullSetup { | 7 | class ProfileRun : public RuntimeInfo { |
8 | 8 | ||
9 | public : | 9 | public : |
10 | 10 | ||
11 | ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) : | 11 | ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) : |
12 | AsFullSetup( NNI ) | 12 | RuntimeInfo( NNI ) |
13 | { Data = &D; } | 13 | { Data = &D; } |
14 | 14 | ||
15 | void detectState( NodeCollection * NC ); | 15 | virtual RuntimeInfo * fullSetup( void ) |
16 | bool setState( NodeCollection * NC, Action_t A, bool ); | 16 | { return this; } |
17 | bool canSetState( State_t Curr, Action_t A ); | ||
18 | |||
19 | bool handlesInterface( const QString & I ); | ||
20 | |||
21 | virtual const QString & description( void ) | 17 | virtual const QString & description( void ) |
22 | { return Data->Description; } | 18 | { return Data->Description; } |
23 | |||
24 | virtual AsFullSetup * asFullSetup( void ) | ||
25 | { return (AsFullSetup *)this; } | ||
26 | |||
27 | virtual bool triggersVPN( void ) | 19 | virtual bool triggersVPN( void ) |
28 | { return Data->TriggerVPN; } | 20 | { return Data->TriggerVPN; } |
29 | 21 | ||
22 | State_t detectState( void ); | ||
23 | |||
24 | protected : | ||
25 | |||
26 | QString setMyState( NodeCollection * , Action_t, bool ); | ||
27 | |||
30 | private : | 28 | private : |
31 | 29 | ||
32 | ProfileData * Data; | 30 | ProfileData * Data; |
33 | 31 | ||
34 | }; | 32 | }; |
35 | #endif | 33 | #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 @@ | |||
1 | Package: opie-networksettingsplugin2-usb | 1 | Package: opie-networksettings2plugin-usb |
2 | Files: plugins/networksettings2/libusb.so* | 2 | Files: plugins/networksettings2/libusb.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Network settings usb plugin. | 8 | Description: Network settings usb plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,54 +1,62 @@ | |||
1 | #include <resources.h> | ||
1 | #include "usb_NN.h" | 2 | #include "usb_NN.h" |
2 | #include "usb_NNI.h" | 3 | #include "usb_NNI.h" |
3 | 4 | ||
4 | static const char * USBNeeds[] = | 5 | static const char * USBNeeds[] = |
5 | { 0 | 6 | { 0 |
6 | }; | 7 | }; |
7 | 8 | ||
9 | static const char * USBProvides[] = | ||
10 | { "device", | ||
11 | 0 | ||
12 | }; | ||
13 | |||
8 | /** | 14 | /** |
9 | * Constructor, find all of the possible interfaces | 15 | * Constructor, find all of the possible interfaces |
10 | */ | 16 | */ |
11 | USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { | 17 | USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { |
18 | NSResources->addSystemFile( | ||
19 | "interfaces", "/etc/network/interfaces", 1 ); | ||
12 | } | 20 | } |
13 | 21 | ||
14 | /** | 22 | /** |
15 | * Delete any interfaces that we own. | 23 | * Delete any interfaces that we own. |
16 | */ | 24 | */ |
17 | USBNetNode::~USBNetNode(){ | 25 | USBNetNode::~USBNetNode(){ |
18 | } | 26 | } |
19 | 27 | ||
20 | const QString USBNetNode::nodeDescription(){ | 28 | const QString USBNetNode::nodeDescription(){ |
21 | return tr("\ | 29 | return tr("\ |
22 | <p>Configure Ethernet over USB.</p>\ | 30 | <p>Configure Ethernet over USB.</p>\ |
23 | <p>Use this for a computer to computer USB cable connection</p>\ | 31 | <p>Use this for a computer to computer USB cable connection</p>\ |
24 | " | 32 | " |
25 | ); | 33 | ); |
26 | } | 34 | } |
27 | 35 | ||
28 | ANetNodeInstance * USBNetNode::createInstance( void ) { | 36 | ANetNodeInstance * USBNetNode::createInstance( void ) { |
29 | return new AUSB( this ); | 37 | return new AUSB( this ); |
30 | } | 38 | } |
31 | 39 | ||
32 | const char ** USBNetNode::needs( void ) { | 40 | const char ** USBNetNode::needs( void ) { |
33 | return USBNeeds; | 41 | return USBNeeds; |
34 | } | 42 | } |
35 | 43 | ||
36 | const char * USBNetNode::provides( void ) { | 44 | const char ** USBNetNode::provides( void ) { |
37 | return "device"; | 45 | return USBProvides; |
38 | } | 46 | } |
39 | 47 | ||
40 | QString USBNetNode::genNic( long ) { | 48 | QString USBNetNode::genNic( long ) { |
41 | return QString( "usbf" ); | 49 | return QString( "usbf" ); |
42 | } | 50 | } |
43 | 51 | ||
44 | void USBNetNode::setSpecificAttribute( QString & , QString & ) { | 52 | void USBNetNode::setSpecificAttribute( QString & , QString & ) { |
45 | } | 53 | } |
46 | 54 | ||
47 | void USBNetNode::saveSpecificAttribute( QTextStream & ) { | 55 | void USBNetNode::saveSpecificAttribute( QTextStream & ) { |
48 | } | 56 | } |
49 | 57 | ||
50 | extern "C" { | 58 | extern "C" { |
51 | void create_plugin( QList<ANetNode> & PNN ) { | 59 | void create_plugin( QList<ANetNode> & PNN ) { |
52 | PNN.append( new USBNetNode() ); | 60 | PNN.append( new USBNetNode() ); |
53 | } | 61 | } |
54 | } | 62 | } |
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 | |||
@@ -1,38 +1,38 @@ | |||
1 | #ifndef USB_NETNODE_H | 1 | #ifndef USB_NETNODE_H |
2 | #define USB_NETNODE_H | 2 | #define USB_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AUSB; | 6 | class AUSB; |
7 | 7 | ||
8 | class USBNetNode : public ANetNode{ | 8 | class USBNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | USBNetNode(); | 14 | USBNetNode(); |
15 | virtual ~USBNetNode(); | 15 | virtual ~USBNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/usb"; } | 18 | { return "Devices/usb"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
21 | virtual ANetNodeInstance * createInstance( void ); | 21 | virtual ANetNodeInstance * createInstance( void ); |
22 | virtual const char ** needs( void ); | 22 | virtual const char ** needs( void ); |
23 | virtual const char * provides( void ); | 23 | virtual const char ** provides( void ); |
24 | 24 | ||
25 | virtual QString genNic( long nr ); | 25 | virtual QString genNic( long nr ); |
26 | 26 | ||
27 | private: | 27 | private: |
28 | 28 | ||
29 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 29 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
30 | virtual void saveSpecificAttribute( QTextStream & TS ); | 30 | virtual void saveSpecificAttribute( QTextStream & TS ); |
31 | }; | 31 | }; |
32 | 32 | ||
33 | extern "C" | 33 | extern "C" |
34 | { | 34 | { |
35 | void create_plugin( QList<ANetNode> & PNN ); | 35 | void create_plugin( QList<ANetNode> & PNN ); |
36 | }; | 36 | }; |
37 | 37 | ||
38 | #endif | 38 | #endif |
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 | |||
@@ -1,61 +1,59 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include "usbedit.h" | 2 | #include "usbedit.h" |
3 | #include "usb_NNI.h" | 3 | #include "usb_NNI.h" |
4 | #include "usb_NN.h" | 4 | #include "usb_NN.h" |
5 | 5 | ||
6 | AUSB::AUSB( USBNetNode * PNN ) : ANetNodeInstance( PNN ) { | 6 | AUSB::AUSB( USBNetNode * PNN ) : ANetNodeInstance( PNN ) { |
7 | 7 | ||
8 | GUI = 0; | 8 | GUI = 0; |
9 | RT = 0; | 9 | RT = 0; |
10 | } | 10 | } |
11 | 11 | ||
12 | void AUSB::setSpecificAttribute( QString & , QString & ) { | 12 | void AUSB::setSpecificAttribute( QString & , QString & ) { |
13 | } | 13 | } |
14 | 14 | ||
15 | void AUSB::saveSpecificAttribute( QTextStream & ) { | 15 | void AUSB::saveSpecificAttribute( QTextStream & ) { |
16 | } | 16 | } |
17 | 17 | ||
18 | 18 | ||
19 | QWidget * AUSB::edit( QWidget * parent ) { | 19 | QWidget * AUSB::edit( QWidget * parent ) { |
20 | GUI = new USBEdit( parent ); | 20 | GUI = new USBEdit( parent ); |
21 | GUI->showData( Data ); | 21 | GUI->showData( Data ); |
22 | return GUI; | 22 | return GUI; |
23 | } | 23 | } |
24 | 24 | ||
25 | QString AUSB::acceptable( void ) { | 25 | QString AUSB::acceptable( void ) { |
26 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 26 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
27 | } | 27 | } |
28 | 28 | ||
29 | void AUSB::commit( void ) { | 29 | void AUSB::commit( void ) { |
30 | if( GUI && GUI->commit( Data ) ) { | 30 | if( GUI && GUI->commit( Data ) ) { |
31 | setModified( 1 ); | 31 | setModified( 1 ); |
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | short AUSB::generateFileEmbedded( const QString & ID, | 35 | short AUSB::generateFileEmbedded( SystemFile & SF, |
36 | const QString & Path, | ||
37 | QTextStream & TS, | ||
38 | long DevNr ) { | 36 | long DevNr ) { |
39 | 37 | ||
40 | QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); | 38 | QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); |
41 | short rvl, rvd; | 39 | short rvl, rvd; |
42 | 40 | ||
43 | rvl = 1; | 41 | rvl = 1; |
44 | 42 | ||
45 | if( ID == "interfaces" ) { | 43 | if( SF.name() == "interfaces" ) { |
46 | Log(("Generate USB for %s\n", ID.latin1() )); | 44 | Log(("Generate USB for %s\n", SF.name().latin1() )); |
47 | // generate mapping stanza for this interface | 45 | // generate mapping stanza for this interface |
48 | TS << " pre-up " | 46 | SF << " pre-up " |
49 | << QPEApplication::qpeDir() | 47 | << QPEApplication::qpeDir() |
50 | << "bin/setmacaddress.sh " | 48 | << "bin/setmacaddress.sh " |
51 | << NIC | 49 | << NIC |
52 | << " || true" | 50 | << " || true" |
53 | << endl; | 51 | << endl; |
54 | rvl = 0; | 52 | rvl = 0; |
55 | } | 53 | } |
56 | rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr ); | 54 | rvd = ANetNodeInstance::generateFileEmbedded(SF, DevNr ); |
57 | 55 | ||
58 | return (rvd == 2 || rvl == 2 ) ? 2 : | 56 | return (rvd == 2 || rvl == 2 ) ? 2 : |
59 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | 57 | (rvd == 0 || rvl == 0 ) ? 0 : 1; |
60 | 58 | ||
61 | } | 59 | } |
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 | |||
@@ -1,46 +1,44 @@ | |||
1 | #ifndef USB_H | 1 | #ifndef USB_H |
2 | #define USB_H | 2 | #define USB_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "usbdata.h" | 5 | #include "usbdata.h" |
6 | #include "usbrun.h" | 6 | #include "usbrun.h" |
7 | 7 | ||
8 | class USBNetNode; | 8 | class USBNetNode; |
9 | class USBEdit; | 9 | class USBEdit; |
10 | 10 | ||
11 | class AUSB : public ANetNodeInstance { | 11 | class AUSB : public ANetNodeInstance { |
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | AUSB( USBNetNode * PNN ); | 15 | AUSB( USBNetNode * PNN ); |
16 | 16 | ||
17 | RuntimeInfo * runtime( void ) | 17 | RuntimeInfo * runtime( void ) |
18 | { return | 18 | { return |
19 | ( RT ) ? RT : ( RT = new USBRun( this, Data ) ); | 19 | ( RT ) ? RT : ( RT = new USBRun( this, Data ) ); |
20 | } | 20 | } |
21 | 21 | ||
22 | QWidget * edit( QWidget * parent ); | 22 | QWidget * edit( QWidget * parent ); |
23 | QString acceptable( void ); | 23 | QString acceptable( void ); |
24 | void commit( void ); | 24 | void commit( void ); |
25 | 25 | ||
26 | virtual void * data( void ) | 26 | virtual void * data( void ) |
27 | { return (void *)&Data; } | 27 | { return (void *)&Data; } |
28 | 28 | ||
29 | virtual short generateFileEmbedded( const QString & ID, | 29 | virtual short generateFileEmbedded( SystemFile & TS, |
30 | const QString & Path, | ||
31 | QTextStream & TS, | ||
32 | long DevNr ); | 30 | long DevNr ); |
33 | 31 | ||
34 | protected : | 32 | protected : |
35 | 33 | ||
36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 34 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
37 | virtual void saveSpecificAttribute( QTextStream & TS ); | 35 | virtual void saveSpecificAttribute( QTextStream & TS ); |
38 | 36 | ||
39 | private : | 37 | private : |
40 | 38 | ||
41 | USBEdit * GUI; | 39 | USBEdit * GUI; |
42 | USBData Data; | 40 | USBData Data; |
43 | USBRun * RT; | 41 | USBRun * RT; |
44 | }; | 42 | }; |
45 | 43 | ||
46 | #endif | 44 | #endif |
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 @@ | |||
1 | #ifndef USB_DATA_H | 1 | #ifndef USB_DATA_H |
2 | #define USB_DATA_H | 2 | #define USB_DATA_H |
3 | 3 | ||
4 | typedef struct USBData { | 4 | class USBData { |
5 | public : | ||
5 | bool Fake; | 6 | bool Fake; |
6 | } USBData_t; | 7 | } ; |
7 | 8 | ||
8 | #endif | 9 | #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 | |||
@@ -1,17 +1,17 @@ | |||
1 | #include <GUIUtils.h> | 1 | #include <GUIUtils.h> |
2 | #include "usbedit.h" | 2 | #include "usbedit.h" |
3 | 3 | ||
4 | USBEdit::USBEdit( QWidget * Parent ) : USBGUI( Parent ){ | 4 | USBEdit::USBEdit( QWidget * Parent ) : USBGUI( Parent ){ |
5 | 5 | ||
6 | } | 6 | } |
7 | 7 | ||
8 | QString USBEdit::acceptable( void ) { | 8 | QString USBEdit::acceptable( void ) { |
9 | return QString(); | 9 | return QString(); |
10 | } | 10 | } |
11 | 11 | ||
12 | void USBEdit::showData( USBData_t & Data ) { | 12 | void USBEdit::showData( USBData & Data ) { |
13 | } | 13 | } |
14 | 14 | ||
15 | bool USBEdit::commit( USBData_t & Data ) { | 15 | bool USBEdit::commit( USBData & Data ) { |
16 | return 1; | 16 | return 1; |
17 | } | 17 | } |
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 | |||
@@ -1,12 +1,12 @@ | |||
1 | #include "usbdata.h" | 1 | #include "usbdata.h" |
2 | #include "usbGUI.h" | 2 | #include "usbGUI.h" |
3 | 3 | ||
4 | class USBEdit : public USBGUI { | 4 | class USBEdit : public USBGUI { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | USBEdit( QWidget * parent ); | 8 | USBEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 9 | QString acceptable( void ); |
10 | bool commit( USBData_t & Data ); | 10 | bool commit( USBData & Data ); |
11 | void showData( USBData_t & Data ); | 11 | void showData( USBData & Data ); |
12 | }; | 12 | }; |
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index b8ac8a8..f8824e0 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp | |||
@@ -1,178 +1,112 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qfileinfo.h> | 2 | #include <qfileinfo.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <resources.h> | 4 | #include <resources.h> |
5 | #include "usbrun.h" | 5 | #include "usbrun.h" |
6 | 6 | ||
7 | void USBRun::detectState( NodeCollection * NC ) { | 7 | State_t USBRun::detectState( void ) { |
8 | // unavailable : no card found | 8 | // unavailable : no card found |
9 | // available : card found and assigned to us or free | 9 | // available : card found and assigned to us or free |
10 | // up : card found and assigned to us and up | 10 | // up : card found and assigned to us and up |
11 | NodeCollection * NC = nodeCollection(); | ||
11 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 12 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
12 | System & Sys = NSResources->system(); | 13 | System & Sys = NSResources->system(); |
13 | InterfaceInfo * Run; | 14 | InterfaceInfo * Run; |
14 | QFile F( S ); | 15 | QFile F( S ); |
15 | Log(("Detecting for %s\n", NC->name().latin1() )); | 16 | Log(("Detecting for %s\n", NC->name().latin1() )); |
16 | 17 | ||
17 | if( F.open( IO_ReadOnly ) ) { | 18 | if( F.open( IO_ReadOnly ) ) { |
18 | // could open file -> read interface and assign | 19 | // could open file -> read interface and assign |
19 | QString X; | 20 | QString X; |
20 | QTextStream TS(&F); | 21 | QTextStream TS(&F); |
21 | X = TS.readLine(); | 22 | X = TS.readLine(); |
22 | Log(("%s exists\n", S.latin1() )); | 23 | Log(("%s exists\n", S.latin1() )); |
23 | // find interface | 24 | // find interface |
24 | if( handlesInterface( X ) ) { | 25 | if( handlesInterface( X ) ) { |
25 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 26 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
26 | It.current(); | 27 | It.current(); |
27 | ++It ) { | 28 | ++It ) { |
28 | Run = It.current(); | 29 | Run = It.current(); |
29 | if( X == Run->Name ) { | 30 | if( X == Run->Name ) { |
30 | Run->assignNode( netNode() ); | 31 | NC->assignInterface( Run ); |
31 | assignInterface( Run ); | 32 | return IsUp; |
32 | NC->setCurrentState( IsUp ); | ||
33 | return; | ||
34 | } | 33 | } |
35 | } | 34 | } |
36 | } | 35 | } |
37 | } | 36 | } |
38 | 37 | ||
39 | Log(("Assigned %p\n", assignedInterface() )); | 38 | Log(("Assigned %p\n", NC->assignedInterface() )); |
40 | if( ( Run = assignedInterface() ) ) { | 39 | if( ( Run = NC->assignedInterface() ) ) { |
41 | // we already have an interface assigned -> still present ? | 40 | // we already have an interface assigned -> still present ? |
42 | if( ! Run->IsUp ) { | 41 | if( ! Run->IsUp ) { |
43 | // usb is still free -> keep assignment | 42 | // usb is still free -> keep assignment |
44 | NC->setCurrentState( Available ); | 43 | return Available; |
45 | return; | ||
46 | } // else interface is up but NOT us -> some other profile | 44 | } // else interface is up but NOT us -> some other profile |
47 | } | 45 | } |
48 | 46 | ||
49 | // nothing (valid) assigned to us | 47 | // nothing (valid) assigned to us |
50 | assignInterface( 0 ); | 48 | NC->assignInterface( 0 ); |
51 | 49 | ||
52 | // find possible interface | 50 | // find possible interface |
53 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 51 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
54 | It.current(); | 52 | It.current(); |
55 | ++It ) { | 53 | ++It ) { |
56 | Run = It.current(); | 54 | Run = It.current(); |
57 | 55 | ||
58 | Log(("%s %d %d=%d %d\n", | 56 | Log(("%s %d %d=%d %d\n", |
59 | Run->Name.latin1(), | 57 | Run->Name.latin1(), |
60 | handlesInterface( Run->Name ), | 58 | handlesInterface( Run->Name ), |
61 | Run->CardType, ARPHRD_ETHER, | 59 | Run->CardType, ARPHRD_ETHER, |
62 | ! Run->IsUp )); | 60 | ! Run->IsUp )); |
63 | 61 | ||
64 | if( handlesInterface( Run->Name ) && | 62 | if( handlesInterface( Run->Name ) && |
65 | Run->CardType == ARPHRD_ETHER && | 63 | Run->CardType == ARPHRD_ETHER && |
66 | ! Run->IsUp | 64 | ! Run->IsUp |
67 | ) { | 65 | ) { |
68 | Log(("Released(OFF)\n" )); | ||
69 | // proper type, and Not UP -> free | 66 | // proper type, and Not UP -> free |
70 | NC->setCurrentState( Off ); | 67 | return Off; |
71 | return; | ||
72 | } | 68 | } |
73 | } | 69 | } |
74 | // no free found | ||
75 | Log(("UNA\n" )); | ||
76 | 70 | ||
77 | NC->setCurrentState( Unavailable ); | 71 | return Unavailable; |
78 | } | 72 | } |
79 | 73 | ||
80 | bool USBRun::setState( NodeCollection * NC, Action_t A, bool ) { | 74 | QString USBRun::setMyState( NodeCollection *, Action_t , bool ) { |
81 | 75 | return QString(); | |
82 | // we only handle activate and deactivate | ||
83 | switch( A ) { | ||
84 | case Activate : | ||
85 | { | ||
86 | if( NC->currentState() != Off ) { | ||
87 | return 0; | ||
88 | } | ||
89 | InterfaceInfo * N = getInterface(); | ||
90 | if( ! N ) { | ||
91 | // no interface available | ||
92 | NC->setCurrentState( Unavailable ); | ||
93 | return 0; | ||
94 | } | ||
95 | // because we were OFF the interface | ||
96 | // we get back is NOT assigned | ||
97 | N->assignNode( netNode() ); | ||
98 | assignInterface( N ); | ||
99 | Log(("Assing %p\n", N )); | ||
100 | NC->setCurrentState( Available ); | ||
101 | return 1; | ||
102 | } | ||
103 | case Deactivate : | ||
104 | if( NC->currentState() == IsUp ) { | ||
105 | // bring down first | ||
106 | if( ! connection()->setState( Down ) ) | ||
107 | // could not ... | ||
108 | return 0; | ||
109 | } else if( NC->currentState() != Available ) { | ||
110 | return 1; | ||
111 | } | ||
112 | assignedInterface()->assignNode( 0 ); // release | ||
113 | assignInterface( 0 ); | ||
114 | NC->setCurrentState( Off ); | ||
115 | return 1; | ||
116 | default : | ||
117 | // FT | ||
118 | break; | ||
119 | } | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | bool USBRun::canSetState( State_t Curr, Action_t A ) { | ||
124 | // we only handle up down activate and deactivate | ||
125 | switch( A ) { | ||
126 | case Activate : | ||
127 | { // at least available | ||
128 | if( Curr == Available ) { | ||
129 | return 1; | ||
130 | } | ||
131 | // or we can make one available | ||
132 | InterfaceInfo * N = getInterface(); | ||
133 | if( ! N || N->assignedNode() != 0 ) { | ||
134 | // non available or assigned | ||
135 | return 0; | ||
136 | } | ||
137 | return 1; | ||
138 | } | ||
139 | case Deactivate : | ||
140 | return ( Curr >= Available ); | ||
141 | default : | ||
142 | // FT | ||
143 | break; | ||
144 | } | ||
145 | return 0; | ||
146 | } | 76 | } |
147 | 77 | ||
148 | // get interface that is free or assigned to us | 78 | // get interface that is free or assigned to us |
149 | InterfaceInfo * USBRun::getInterface( void ) { | 79 | InterfaceInfo * USBRun::getInterface( void ) { |
150 | 80 | ||
151 | System & S = NSResources->system(); | 81 | System & S = NSResources->system(); |
152 | InterfaceInfo * best = 0, * Run; | 82 | InterfaceInfo * best = 0, * Run; |
153 | QRegExp R( "usb[0-9abcdef]" ); | 83 | QRegExp R( "usb[0-9abcdef]" ); |
154 | 84 | ||
155 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 85 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
156 | It.current(); | 86 | It.current(); |
157 | ++It ) { | 87 | ++It ) { |
158 | Run = It.current(); | 88 | Run = It.current(); |
159 | if( handlesInterface( Run->Name ) && | 89 | if( handlesInterface( Run->Name ) && |
160 | Run->CardType == ARPHRD_ETHER | 90 | Run->CardType == ARPHRD_ETHER |
161 | ) { | 91 | ) { |
162 | // this is a USB card | 92 | // this is a USB card |
163 | if( Run->assignedNode() == netNode() ) { | 93 | if( Run->assignedConnection() == netNode()->connection() ) { |
164 | // assigned to us | 94 | // assigned to us |
165 | return Run; | 95 | return Run; |
166 | } else if( Run->assignedNode() == 0 ) { | 96 | } else if( Run->assignedConnection() == 0 ) { |
167 | // free | 97 | // free |
168 | best = Run; | 98 | best = Run; |
169 | } | 99 | } |
170 | } | 100 | } |
171 | } | 101 | } |
172 | return best; // can be 0 | 102 | return best; // can be 0 |
173 | } | 103 | } |
174 | 104 | ||
175 | bool USBRun::handlesInterface( const QString & S ) { | 105 | bool USBRun::handlesInterface( const QString & S ) { |
176 | return Pat.match( S ) >= 0; | 106 | return Pat.match( S ) >= 0; |
177 | } | 107 | } |
178 | 108 | ||
109 | bool USBRun::handlesInterface( InterfaceInfo * I ) { | ||
110 | return handlesInterface( I->Name ); | ||
111 | } | ||
112 | |||
diff --git a/noncore/settings/networksettings2/usb/usbrun.h b/noncore/settings/networksettings2/usb/usbrun.h index 03e21ab..6ce4fa2 100644 --- a/noncore/settings/networksettings2/usb/usbrun.h +++ b/noncore/settings/networksettings2/usb/usbrun.h | |||
@@ -1,37 +1,36 @@ | |||
1 | #ifndef USBRUN_H | 1 | #ifndef USBRUN_H |
2 | #define USBRUN_H | 2 | #define USBRUN_H |
3 | 3 | ||
4 | #include <asdevice.h> | 4 | #include <netnode.h> |
5 | #include <qregexp.h> | 5 | #include <qregexp.h> |
6 | #include "usbdata.h" | 6 | #include "usbdata.h" |
7 | 7 | ||
8 | class USBRun : public AsDevice { | 8 | class USBRun : public RuntimeInfo { |
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | USBRun( ANetNodeInstance * NNI, | 12 | USBRun( ANetNodeInstance * NNI, |
13 | USBData & Data ) : | 13 | USBData & Data ) : |
14 | AsDevice( NNI ), | 14 | RuntimeInfo( NNI ), |
15 | Pat( "usb[0-9abcdef]" ) | 15 | Pat( "usb[0-9abcdef]" ) { |
16 | { } | 16 | } |
17 | 17 | ||
18 | virtual AsDevice * device( void ) | 18 | virtual RuntimeInfo * device( void ) |
19 | { return (AsDevice *)this; } | 19 | { return this; } |
20 | 20 | ||
21 | virtual AsDevice * asDevice( void ) | 21 | bool handlesInterface( const QString & I ); |
22 | { return (AsDevice *)this; } | 22 | bool handlesInterface( InterfaceInfo * ); |
23 | protected : | ||
24 | 23 | ||
25 | void detectState( NodeCollection * ); | 24 | State_t detectState( void ); |
26 | bool setState( NodeCollection * , Action_t A, bool ); | ||
27 | bool canSetState( State_t , Action_t A ); | ||
28 | 25 | ||
29 | bool handlesInterface( const QString & I ); | 26 | protected : |
27 | |||
28 | QString setMyState( NodeCollection * , Action_t, bool ); | ||
30 | 29 | ||
31 | private : | 30 | private : |
32 | 31 | ||
33 | InterfaceInfo * getInterface( void ); | 32 | InterfaceInfo * getInterface( void ); |
34 | QRegExp Pat; | 33 | QRegExp Pat; |
35 | 34 | ||
36 | }; | 35 | }; |
37 | #endif | 36 | #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 @@ | |||
1 | Package: opie-networksettingsplugin2-vpn | 1 | Package: opie-networksettings2plugin-vpn |
2 | Files: plugins/networksettings2/libvpn.so* | 2 | Files: plugins/networksettings2/libvpn.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Network settings vpn plugin. | 8 | Description: Network settings vpn plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,50 +1,54 @@ | |||
1 | #include "vpn_NN.h" | 1 | #include "vpn_NN.h" |
2 | #include "vpn_NNI.h" | 2 | #include "vpn_NNI.h" |
3 | 3 | ||
4 | static const char * VPNNeeds[] = | 4 | static const char * VPNNeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | static const char * VPNProvides[] = | ||
9 | { "connection", | ||
10 | 0 | ||
11 | }; | ||
8 | /** | 12 | /** |
9 | * Constructor, find all of the possible interfaces | 13 | * Constructor, find all of the possible interfaces |
10 | */ | 14 | */ |
11 | VPNNetNode::VPNNetNode() : ANetNode(tr("VPN Connection")) { | 15 | VPNNetNode::VPNNetNode() : ANetNode(tr("VPN Connection")) { |
12 | } | 16 | } |
13 | 17 | ||
14 | /** | 18 | /** |
15 | * Delete any interfaces that we own. | 19 | * Delete any interfaces that we own. |
16 | */ | 20 | */ |
17 | VPNNetNode::~VPNNetNode(){ | 21 | VPNNetNode::~VPNNetNode(){ |
18 | } | 22 | } |
19 | 23 | ||
20 | const QString VPNNetNode::nodeDescription(){ | 24 | const QString VPNNetNode::nodeDescription(){ |
21 | return tr("\ | 25 | return tr("\ |
22 | <p>Configure private IP connection.</p>\ | 26 | <p>Configure private IP connection.</p>\ |
23 | <p>Defines Secure tunnels over non secure IP sessions</p>\ | 27 | <p>Defines Secure tunnels over non secure IP sessions</p>\ |
24 | " | 28 | " |
25 | ); | 29 | ); |
26 | } | 30 | } |
27 | 31 | ||
28 | ANetNodeInstance * VPNNetNode::createInstance( void ) { | 32 | ANetNodeInstance * VPNNetNode::createInstance( void ) { |
29 | return new AVPN( this ); | 33 | return new AVPN( this ); |
30 | } | 34 | } |
31 | 35 | ||
32 | const char ** VPNNetNode::needs( void ) { | 36 | const char ** VPNNetNode::needs( void ) { |
33 | return VPNNeeds; | 37 | return VPNNeeds; |
34 | } | 38 | } |
35 | 39 | ||
36 | const char * VPNNetNode::provides( void ) { | 40 | const char ** VPNNetNode::provides( void ) { |
37 | return "connection"; | 41 | return VPNProvides; |
38 | } | 42 | } |
39 | 43 | ||
40 | void VPNNetNode::setSpecificAttribute( QString & , QString & ) { | 44 | void VPNNetNode::setSpecificAttribute( QString & , QString & ) { |
41 | } | 45 | } |
42 | 46 | ||
43 | void VPNNetNode::saveSpecificAttribute( QTextStream & ) { | 47 | void VPNNetNode::saveSpecificAttribute( QTextStream & ) { |
44 | } | 48 | } |
45 | 49 | ||
46 | extern "C" { | 50 | extern "C" { |
47 | void create_plugin( QList<ANetNode> & PNN ) { | 51 | void create_plugin( QList<ANetNode> & PNN ) { |
48 | PNN.append( new VPNNetNode() ); | 52 | PNN.append( new VPNNetNode() ); |
49 | } | 53 | } |
50 | } | 54 | } |
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 | |||
@@ -1,36 +1,36 @@ | |||
1 | #ifndef VPN_NETNODE_H | 1 | #ifndef VPN_NETNODE_H |
2 | #define VPN_NETNODE_H | 2 | #define VPN_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AVPN; | 6 | class AVPN; |
7 | 7 | ||
8 | class VPNNetNode : public ANetNode{ | 8 | class VPNNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | VPNNetNode(); | 14 | VPNNetNode(); |
15 | virtual ~VPNNetNode(); | 15 | virtual ~VPNNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/vpn"; } | 18 | { return "Devices/vpn"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
21 | virtual ANetNodeInstance * createInstance( void ); | 21 | virtual ANetNodeInstance * createInstance( void ); |
22 | virtual const char ** needs( void ); | 22 | virtual const char ** needs( void ); |
23 | virtual const char * provides( void ); | 23 | virtual const char ** provides( void ); |
24 | 24 | ||
25 | private: | 25 | private: |
26 | 26 | ||
27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
28 | virtual void saveSpecificAttribute( QTextStream & TS ); | 28 | virtual void saveSpecificAttribute( QTextStream & TS ); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | extern "C" | 31 | extern "C" |
32 | { | 32 | { |
33 | void create_plugin( QList<ANetNode> & PNN ); | 33 | void create_plugin( QList<ANetNode> & PNN ); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #endif | 36 | #endif |
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 @@ | |||
1 | #ifndef VPN_DATA_H | 1 | #ifndef VPN_DATA_H |
2 | #define VPN_DATA_H | 2 | #define VPN_DATA_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | typedef struct VPNData { | 5 | class VPNData { |
6 | public : | ||
6 | QString Device; | 7 | QString Device; |
7 | QString LockFile; | 8 | QString LockFile; |
8 | long Speed; | 9 | long Speed; |
9 | short Parity; | 10 | short Parity; |
10 | short DataBits; | 11 | short DataBits; |
11 | short StopBits; | 12 | short StopBits; |
12 | bool HardwareControl; | 13 | bool HardwareControl; |
13 | bool SoftwareControl; | 14 | bool SoftwareControl; |
14 | } VPNData_t; | 15 | } ; |
15 | 16 | ||
16 | #endif | 17 | #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 | |||
@@ -1,18 +1,18 @@ | |||
1 | #include <GUIUtils.h> | 1 | #include <GUIUtils.h> |
2 | #include "vpnedit.h" | 2 | #include "vpnedit.h" |
3 | 3 | ||
4 | 4 | ||
5 | VPNEdit::VPNEdit( QWidget * Parent ) : VPNGUI( Parent ){ | 5 | VPNEdit::VPNEdit( QWidget * Parent ) : VPNGUI( Parent ){ |
6 | 6 | ||
7 | } | 7 | } |
8 | 8 | ||
9 | QString VPNEdit::acceptable( void ) { | 9 | QString VPNEdit::acceptable( void ) { |
10 | return QString(); | 10 | return QString(); |
11 | } | 11 | } |
12 | 12 | ||
13 | void VPNEdit::showData( VPNData_t & Data ) { | 13 | void VPNEdit::showData( VPNData & Data ) { |
14 | } | 14 | } |
15 | 15 | ||
16 | bool VPNEdit::commit( VPNData_t & Data ) { | 16 | bool VPNEdit::commit( VPNData & Data ) { |
17 | return 0; | 17 | return 0; |
18 | } | 18 | } |
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 | |||
@@ -1,12 +1,12 @@ | |||
1 | #include "vpndata.h" | 1 | #include "vpndata.h" |
2 | #include "vpnGUI.h" | 2 | #include "vpnGUI.h" |
3 | 3 | ||
4 | class VPNEdit : public VPNGUI { | 4 | class VPNEdit : public VPNGUI { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | VPNEdit( QWidget * parent ); | 8 | VPNEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 9 | QString acceptable( void ); |
10 | bool commit( VPNData_t & Data ); | 10 | bool commit( VPNData & Data ); |
11 | void showData( VPNData_t & Data ); | 11 | void showData( VPNData & Data ); |
12 | }; | 12 | }; |
diff --git a/noncore/settings/networksettings2/vpn/vpnrun.cpp b/noncore/settings/networksettings2/vpn/vpnrun.cpp index ab2966c..64728aa 100644 --- a/noncore/settings/networksettings2/vpn/vpnrun.cpp +++ b/noncore/settings/networksettings2/vpn/vpnrun.cpp | |||
@@ -1,6 +1 @@ | |||
1 | #include "vpnrun.h" | #include "vpnrun.h" | |
2 | |||
3 | bool VPNRun::handlesInterface( const QString & ) { | ||
4 | // to be figured out | ||
5 | return 0; | ||
6 | } | ||
diff --git a/noncore/settings/networksettings2/vpn/vpnrun.h b/noncore/settings/networksettings2/vpn/vpnrun.h index c19b609..9a55625 100644 --- a/noncore/settings/networksettings2/vpn/vpnrun.h +++ b/noncore/settings/networksettings2/vpn/vpnrun.h | |||
@@ -1,32 +1,27 @@ | |||
1 | #ifndef VPNRUN_H | 1 | #ifndef VPNRUN_H |
2 | #define VPNRUN_H | 2 | #define VPNRUN_H |
3 | 3 | ||
4 | #include <asconnection.h> | 4 | #include <netnode.h> |
5 | #include "vpndata.h" | 5 | #include "vpndata.h" |
6 | 6 | ||
7 | class VPNRun : public AsConnection { | 7 | class VPNRun : public RuntimeInfo { |
8 | 8 | ||
9 | public : | 9 | public : |
10 | 10 | ||
11 | VPNRun( ANetNodeInstance * NNI, VPNData & Data ) : | 11 | VPNRun( ANetNodeInstance * NNI, VPNData & Data ) : |
12 | AsConnection( NNI ) | 12 | RuntimeInfo( NNI ) |
13 | { } | 13 | { } |
14 | 14 | ||
15 | virtual AsConnection * asConnection( void ) | 15 | virtual RuntimeInfo * connection( void ) |
16 | { return (AsConnection *)this; } | 16 | { return this; } |
17 | protected : | ||
18 | |||
19 | void detectState( NodeCollection * ) | ||
20 | { } | ||
21 | 17 | ||
22 | bool setState( NodeCollection *, Action_t, bool ) | 18 | State_t detectState( void ) |
23 | { return 0; } | 19 | { return Unknown; } |
24 | 20 | ||
25 | bool canSetState( State_t, Action_t ) | 21 | protected : |
26 | { return 0; } | ||
27 | |||
28 | bool handlesInterface( const QString & I ); | ||
29 | 22 | ||
23 | QString setMyState( NodeCollection * , Action_t, bool ) | ||
24 | { return QString(); } | ||
30 | }; | 25 | }; |
31 | 26 | ||
32 | #endif | 27 | #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 @@ | |||
1 | Package: opie-networksettingsplugin2-wlan | 1 | Package: opie-networksettings2plugin-wlan |
2 | Files: plugins/networksettings2/libwlan.so* | 2 | Files: plugins/networksettings2/libwlan.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Network settings wlan plugin. | 8 | Description: Network settings wlan plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,62 +1,70 @@ | |||
1 | #include <resources.h> | ||
1 | #include "wlan_NN.h" | 2 | #include "wlan_NN.h" |
2 | #include "wlan_NNI.h" | 3 | #include "wlan_NNI.h" |
3 | 4 | ||
4 | static const char * WLanNeeds[] = | 5 | static const char * WLanNeeds[] = |
5 | { 0 | 6 | { 0 |
6 | }; | 7 | }; |
7 | 8 | ||
9 | static const char * WLanProvides[] = | ||
10 | { "device", | ||
11 | 0 | ||
12 | }; | ||
13 | |||
8 | /** | 14 | /** |
9 | * Constructor, find all of the possible interfaces | 15 | * Constructor, find all of the possible interfaces |
10 | */ | 16 | */ |
11 | WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) { | 17 | WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) { |
18 | NSResources->addSystemFile( | ||
19 | "interfaces", "/etc/network/interfaces", 1 ); | ||
12 | InstanceCount = 2; | 20 | InstanceCount = 2; |
13 | } | 21 | } |
14 | 22 | ||
15 | /** | 23 | /** |
16 | * Delete any interfaces that we own. | 24 | * Delete any interfaces that we own. |
17 | */ | 25 | */ |
18 | WLanNetNode::~WLanNetNode(){ | 26 | WLanNetNode::~WLanNetNode(){ |
19 | } | 27 | } |
20 | 28 | ||
21 | const QString WLanNetNode::nodeDescription(){ | 29 | const QString WLanNetNode::nodeDescription(){ |
22 | return tr("\ | 30 | return tr("\ |
23 | <p>Configure Wi/Fi or WLan network cards.</p>\ | 31 | <p>Configure Wi/Fi or WLan network cards.</p>\ |
24 | <p>Defines Wireless options for those cards</p>\ | 32 | <p>Defines Wireless options for those cards</p>\ |
25 | " | 33 | " |
26 | ); | 34 | ); |
27 | } | 35 | } |
28 | 36 | ||
29 | ANetNodeInstance * WLanNetNode::createInstance( void ) { | 37 | ANetNodeInstance * WLanNetNode::createInstance( void ) { |
30 | return new AWLan( this ); | 38 | return new AWLan( this ); |
31 | } | 39 | } |
32 | 40 | ||
33 | const char ** WLanNetNode::needs( void ) { | 41 | const char ** WLanNetNode::needs( void ) { |
34 | return WLanNeeds; | 42 | return WLanNeeds; |
35 | } | 43 | } |
36 | 44 | ||
37 | const char * WLanNetNode::provides( void ) { | 45 | const char ** WLanNetNode::provides( void ) { |
38 | return "device"; | 46 | return WLanProvides; |
39 | } | 47 | } |
40 | 48 | ||
41 | QString WLanNetNode::genNic( long nr ) { | 49 | QString WLanNetNode::genNic( long nr ) { |
42 | QString S; | 50 | QString S; |
43 | return S.sprintf( "wlan%ld", nr ); | 51 | return S.sprintf( "wlan%ld", nr ); |
44 | } | 52 | } |
45 | 53 | ||
46 | void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) { | 54 | void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) { |
47 | if( A == "interfacecount" ) { | 55 | if( A == "interfacecount" ) { |
48 | InstanceCount = V.toLong(); | 56 | InstanceCount = V.toLong(); |
49 | } | 57 | } |
50 | } | 58 | } |
51 | 59 | ||
52 | void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) { | 60 | void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) { |
53 | TS << "interfacecount=" | 61 | TS << "interfacecount=" |
54 | << InstanceCount | 62 | << InstanceCount |
55 | << endl; | 63 | << endl; |
56 | } | 64 | } |
57 | 65 | ||
58 | extern "C" { | 66 | extern "C" { |
59 | void create_plugin( QList<ANetNode> & PNN ) { | 67 | void create_plugin( QList<ANetNode> & PNN ) { |
60 | PNN.append( new WLanNetNode() ); | 68 | PNN.append( new WLanNetNode() ); |
61 | } | 69 | } |
62 | } | 70 | } |
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 | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef WLAN_NETNODE_H | 1 | #ifndef WLAN_NETNODE_H |
2 | #define WLAN_NETNODE_H | 2 | #define WLAN_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AWLan; | 6 | class AWLan; |
7 | 7 | ||
8 | class WLanNetNode : public ANetNode{ | 8 | class WLanNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | WLanNetNode(); | 14 | WLanNetNode(); |
15 | virtual ~WLanNetNode(); | 15 | virtual ~WLanNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/wlan"; } | 18 | { return "Devices/wlan"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
21 | virtual ANetNodeInstance * createInstance( void ); | 21 | virtual ANetNodeInstance * createInstance( void ); |
22 | virtual const char ** needs( void ); | 22 | virtual const char ** needs( void ); |
23 | virtual const char * provides( void ); | 23 | virtual const char ** provides( void ); |
24 | 24 | ||
25 | virtual long instanceCount( void ) | 25 | virtual long instanceCount( void ) |
26 | { return InstanceCount; } | 26 | { return InstanceCount; } |
27 | virtual QString genNic( long ); | 27 | virtual QString genNic( long ); |
28 | 28 | ||
29 | private: | 29 | private: |
30 | 30 | ||
31 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 31 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
32 | virtual void saveSpecificAttribute( QTextStream & TS ); | 32 | virtual void saveSpecificAttribute( QTextStream & TS ); |
33 | 33 | ||
34 | // number of interfaces for this device | 34 | // number of interfaces for this device |
35 | long InstanceCount; | 35 | long InstanceCount; |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
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 | |||
@@ -1,151 +1,149 @@ | |||
1 | #include <unistd.h> | 1 | #include <unistd.h> |
2 | #include "wlanedit.h" | 2 | #include "wlanedit.h" |
3 | #include "wlan_NNI.h" | 3 | #include "wlan_NNI.h" |
4 | #include "wlan_NN.h" | 4 | #include "wlan_NN.h" |
5 | 5 | ||
6 | AWLan::AWLan( WLanNetNode * PNN ) : ANetNodeInstance( PNN ) { | 6 | AWLan::AWLan( WLanNetNode * PNN ) : ANetNodeInstance( PNN ) { |
7 | GUI = 0; | 7 | GUI = 0; |
8 | RT = 0; | 8 | RT = 0; |
9 | Data.ESSID = ""; | 9 | Data.ESSID = ""; |
10 | Data.NodeName = tr("<UseHostName>"); | 10 | Data.NodeName = tr("<UseHostName>"); |
11 | Data.Mode = 0; | 11 | Data.Mode = 0; |
12 | Data.SpecificAP = 0; | 12 | Data.SpecificAP = 0; |
13 | Data.APMac = ""; | 13 | Data.APMac = ""; |
14 | Data.Encrypted = 0; | 14 | Data.Encrypted = 0; |
15 | Data.AcceptNonEncrypted = 0; | 15 | Data.AcceptNonEncrypted = 0; |
16 | Data.Key[0] = ""; | 16 | Data.Key[0] = ""; |
17 | Data.Key[1] = ""; | 17 | Data.Key[1] = ""; |
18 | Data.Key[2] = ""; | 18 | Data.Key[2] = ""; |
19 | Data.Key[3] = ""; | 19 | Data.Key[3] = ""; |
20 | } | 20 | } |
21 | 21 | ||
22 | void AWLan::setSpecificAttribute( QString & A, QString & V ) { | 22 | void AWLan::setSpecificAttribute( QString & A, QString & V ) { |
23 | if( A == "essid" ) { | 23 | if( A == "essid" ) { |
24 | Data.ESSID = V; | 24 | Data.ESSID = V; |
25 | } else if( A == "nodename" ) { | 25 | } else if( A == "nodename" ) { |
26 | Data.NodeName = V; | 26 | Data.NodeName = V; |
27 | } else if( A == "mode" ) { | 27 | } else if( A == "mode" ) { |
28 | Data.Mode = V.toShort(); | 28 | Data.Mode = V.toShort(); |
29 | } else if( A == "specificap" ) { | 29 | } else if( A == "specificap" ) { |
30 | Data.SpecificAP = (V=="yes"); | 30 | Data.SpecificAP = (V=="yes"); |
31 | } else if( A == "apmac" ) { | 31 | } else if( A == "apmac" ) { |
32 | Data.APMac = V; | 32 | Data.APMac = V; |
33 | } else if( A == "encrypted" ) { | 33 | } else if( A == "encrypted" ) { |
34 | Data.Encrypted = (V=="yes"); | 34 | Data.Encrypted = (V=="yes"); |
35 | } else if( A == "acceptnonencrypted" ) { | 35 | } else if( A == "acceptnonencrypted" ) { |
36 | Data.AcceptNonEncrypted = (V=="yes"); | 36 | Data.AcceptNonEncrypted = (V=="yes"); |
37 | } else if( A == "key0" ) { | 37 | } else if( A == "key0" ) { |
38 | Data.Key[0] = V; | 38 | Data.Key[0] = V; |
39 | } else if( A == "key1" ) { | 39 | } else if( A == "key1" ) { |
40 | Data.Key[1] = V; | 40 | Data.Key[1] = V; |
41 | } else if( A == "key2" ) { | 41 | } else if( A == "key2" ) { |
42 | Data.Key[2] = V; | 42 | Data.Key[2] = V; |
43 | } else if( A == "key3" ) { | 43 | } else if( A == "key3" ) { |
44 | Data.Key[3] = V; | 44 | Data.Key[3] = V; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | void AWLan::saveSpecificAttribute( QTextStream & S ) { | 48 | void AWLan::saveSpecificAttribute( QTextStream & S ) { |
49 | S << "essid=" << quote( Data.ESSID ) << endl; | 49 | S << "essid=" << quote( Data.ESSID ) << endl; |
50 | S << "nodename=" << quote( Data.NodeName ) << endl; | 50 | S << "nodename=" << quote( Data.NodeName ) << endl; |
51 | S << "mode=" << Data.Mode << endl; | 51 | S << "mode=" << Data.Mode << endl; |
52 | S << "specificap=" | 52 | S << "specificap=" |
53 | << ((Data.SpecificAP) ? "yes" : "no") | 53 | << ((Data.SpecificAP) ? "yes" : "no") |
54 | << endl; | 54 | << endl; |
55 | S << "apmac=" << Data.APMac << endl; | 55 | S << "apmac=" << Data.APMac << endl; |
56 | S << "encrypted=" | 56 | S << "encrypted=" |
57 | << ((Data.Encrypted) ? "yes" : "no") | 57 | << ((Data.Encrypted) ? "yes" : "no") |
58 | << endl; | 58 | << endl; |
59 | S << "acceptnonencrypted=" | 59 | S << "acceptnonencrypted=" |
60 | << ((Data.AcceptNonEncrypted) ? "yes" : "no") | 60 | << ((Data.AcceptNonEncrypted) ? "yes" : "no") |
61 | << endl; | 61 | << endl; |
62 | for( int i = 0 ;i < 4 ; i ++ ) { | 62 | for( int i = 0 ;i < 4 ; i ++ ) { |
63 | S << "key" << i << "=" << Data.Key[i] << endl; | 63 | S << "key" << i << "=" << Data.Key[i] << endl; |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | QWidget * AWLan::edit( QWidget * parent ) { | 67 | QWidget * AWLan::edit( QWidget * parent ) { |
68 | GUI = new WLanEdit( parent, this ); | 68 | GUI = new WLanEdit( parent, this ); |
69 | GUI->showData( Data ); | 69 | GUI->showData( Data ); |
70 | return GUI; | 70 | return GUI; |
71 | } | 71 | } |
72 | 72 | ||
73 | QString AWLan::acceptable( void ) { | 73 | QString AWLan::acceptable( void ) { |
74 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 74 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
75 | } | 75 | } |
76 | 76 | ||
77 | void AWLan::commit( void ) { | 77 | void AWLan::commit( void ) { |
78 | if( GUI && GUI->commit( Data ) ) | 78 | if( GUI && GUI->commit( Data ) ) |
79 | setModified( 1 ); | 79 | setModified( 1 ); |
80 | } | 80 | } |
81 | 81 | ||
82 | short AWLan::generateFileEmbedded( const QString & ID, | 82 | short AWLan::generateFileEmbedded( SystemFile & SF, |
83 | const QString & Path, | ||
84 | QTextStream & TS, | ||
85 | long DevNr ) { | 83 | long DevNr ) { |
86 | 84 | ||
87 | short rvl, rvd; | 85 | short rvl, rvd; |
88 | 86 | ||
89 | rvl = 1; | 87 | rvl = 1; |
90 | 88 | ||
91 | if( ID == "interfaces" ) { | 89 | if( SF.name() == "interfaces" ) { |
92 | Log(("Generate WLanNNI for %s\n", ID.latin1() )); | 90 | Log(("Generate WLanNNI for %s\n", SF.name().latin1() )); |
93 | TS << " wireless_essid \"" | 91 | SF << " wireless_essid \"" |
94 | << Data.ESSID | 92 | << Data.ESSID |
95 | << "\"" | 93 | << "\"" |
96 | << endl; | 94 | << endl; |
97 | 95 | ||
98 | if( ! Data.NodeName.isEmpty() ) { | 96 | if( ! Data.NodeName.isEmpty() ) { |
99 | if( Data.NodeName == tr("<UseHostName>") ) { | 97 | if( Data.NodeName == tr("<UseHostName>") ) { |
100 | char Buf[100]; | 98 | char Buf[100]; |
101 | if( gethostname(Buf, sizeof(Buf) ) == 0 ) { | 99 | if( gethostname(Buf, sizeof(Buf) ) == 0 ) { |
102 | Buf[99] = '\0'; // just to make sure | 100 | Buf[99] = '\0'; // just to make sure |
103 | TS << " wireless_nick " | 101 | SF << " wireless_nick " |
104 | << Buf | 102 | << Buf |
105 | << endl; | 103 | << endl; |
106 | } | 104 | } |
107 | } else { | 105 | } else { |
108 | TS << " wireless_nick \"" | 106 | SF << " wireless_nick \"" |
109 | << Data.NodeName | 107 | << Data.NodeName |
110 | << "\"" | 108 | << "\"" |
111 | << endl; | 109 | << endl; |
112 | } | 110 | } |
113 | } | 111 | } |
114 | 112 | ||
115 | char * M = "Auto"; | 113 | char * M = "Auto"; |
116 | switch ( Data.Mode ) { | 114 | switch ( Data.Mode ) { |
117 | case 0 : | 115 | case 0 : |
118 | break; | 116 | break; |
119 | case 1 : | 117 | case 1 : |
120 | M = "Managed"; | 118 | M = "Managed"; |
121 | break; | 119 | break; |
122 | case 2 : | 120 | case 2 : |
123 | M = "Ad-Hoc"; | 121 | M = "Ad-Hoc"; |
124 | break; | 122 | break; |
125 | } | 123 | } |
126 | 124 | ||
127 | TS << " wireless_mode " | 125 | SF << " wireless_mode " |
128 | << M | 126 | << M |
129 | << endl; | 127 | << endl; |
130 | if( Data.Encrypted ) { | 128 | if( Data.Encrypted ) { |
131 | for( int i = 0; i < 4; i ++ ) { | 129 | for( int i = 0; i < 4; i ++ ) { |
132 | if( ! Data.Key[i].isEmpty() ) { | 130 | if( ! Data.Key[i].isEmpty() ) { |
133 | TS << " wireless_key" | 131 | SF << " wireless_key" |
134 | << i | 132 | << i |
135 | << " " | 133 | << " " |
136 | << Data.Key[i] | 134 | << Data.Key[i] |
137 | << endl; | 135 | << endl; |
138 | } | 136 | } |
139 | } | 137 | } |
140 | TS << " wireless_keymode " | 138 | SF << " wireless_keymode " |
141 | << ((Data.AcceptNonEncrypted) ? "open" : "restricted") | 139 | << ((Data.AcceptNonEncrypted) ? "open" : "restricted") |
142 | << endl; | 140 | << endl; |
143 | } | 141 | } |
144 | rvl = 0; | 142 | rvl = 0; |
145 | } | 143 | } |
146 | rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr); | 144 | rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr); |
147 | 145 | ||
148 | return (rvd == 2 || rvl == 2 ) ? 2 : | 146 | return (rvd == 2 || rvl == 2 ) ? 2 : |
149 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | 147 | (rvd == 0 || rvl == 0 ) ? 0 : 1; |
150 | } | 148 | } |
151 | 149 | ||
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 | |||
@@ -1,47 +1,45 @@ | |||
1 | #ifndef WLAN_H | 1 | #ifndef WLAN_H |
2 | #define WLAN_H | 2 | #define WLAN_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "wlandata.h" | 5 | #include "wlandata.h" |
6 | #include "wlanrun.h" | 6 | #include "wlanrun.h" |
7 | 7 | ||
8 | class WLanNetNode; | 8 | class WLanNetNode; |
9 | class WLanEdit; | 9 | class WLanEdit; |
10 | 10 | ||
11 | class AWLan : public ANetNodeInstance { | 11 | class AWLan : public ANetNodeInstance { |
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | AWLan( WLanNetNode * PNN ); | 15 | AWLan( WLanNetNode * PNN ); |
16 | 16 | ||
17 | RuntimeInfo * runtime( void ) | 17 | RuntimeInfo * runtime( void ) |
18 | { return | 18 | { return |
19 | ( RT ) ? RT : ( RT = new WLanRun( this, Data ) ); | 19 | ( RT ) ? RT : ( RT = new WLanRun( this, Data ) ); |
20 | } | 20 | } |
21 | 21 | ||
22 | QWidget * edit( QWidget * parent ); | 22 | QWidget * edit( QWidget * parent ); |
23 | QString acceptable( void ); | 23 | QString acceptable( void ); |
24 | void commit( void ); | 24 | void commit( void ); |
25 | 25 | ||
26 | virtual void * data( void ) | 26 | virtual void * data( void ) |
27 | { return (void *)&Data; } | 27 | { return (void *)&Data; } |
28 | 28 | ||
29 | virtual short generateFileEmbedded( const QString & ID, | 29 | virtual short generateFileEmbedded( SystemFile & Sf, |
30 | const QString & Path, | ||
31 | QTextStream & TS, | ||
32 | long DevNr ); | 30 | long DevNr ); |
33 | 31 | ||
34 | protected : | 32 | protected : |
35 | 33 | ||
36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 34 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
37 | virtual void saveSpecificAttribute( QTextStream & TS ); | 35 | virtual void saveSpecificAttribute( QTextStream & TS ); |
38 | 36 | ||
39 | private : | 37 | private : |
40 | 38 | ||
41 | WLanEdit * GUI; | 39 | WLanEdit * GUI; |
42 | WLanData Data; | 40 | WLanData Data; |
43 | WLanRun * RT; | 41 | WLanRun * RT; |
44 | 42 | ||
45 | }; | 43 | }; |
46 | 44 | ||
47 | #endif | 45 | #endif |
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 @@ | |||
1 | #ifndef WLAN_DATA_H | 1 | #ifndef WLAN_DATA_H |
2 | #define WLAN_DATA_H | 2 | #define WLAN_DATA_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | typedef struct WLanData { | 5 | class WLanData { |
6 | public : | ||
6 | QString ESSID; | 7 | QString ESSID; |
7 | QString NodeName; | 8 | QString NodeName; |
8 | short Mode; | 9 | short Mode; |
9 | bool SpecificAP; | 10 | bool SpecificAP; |
10 | QString APMac; | 11 | QString APMac; |
11 | bool Encrypted; | 12 | bool Encrypted; |
12 | QString Key[4]; | 13 | QString Key[4]; |
13 | bool AcceptNonEncrypted; | 14 | bool AcceptNonEncrypted; |
14 | } WLanData_t; | 15 | } ; |
15 | 16 | ||
16 | #endif | 17 | #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 | |||
@@ -1,115 +1,115 @@ | |||
1 | #include <qlineedit.h> | 1 | #include <qlineedit.h> |
2 | #include <qprogressbar.h> | 2 | #include <qprogressbar.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qregexp.h> | 5 | #include <qregexp.h> |
6 | #include <qcheckbox.h> | 6 | #include <qcheckbox.h> |
7 | #include <GUIUtils.h> | 7 | #include <GUIUtils.h> |
8 | #include <resources.h> | 8 | #include <resources.h> |
9 | #include <wextensions.h> | 9 | #include <wextensions.h> |
10 | 10 | ||
11 | #include "wlanedit.h" | 11 | #include "wlanedit.h" |
12 | #include "wlan_NN.h" | 12 | #include "wlan_NN.h" |
13 | #include "wlan_NNI.h" | 13 | #include "wlan_NNI.h" |
14 | 14 | ||
15 | WLanEdit::WLanEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : | 15 | WLanEdit::WLanEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : |
16 | WLanGUI( Parent ), RefreshTimer(this){ | 16 | WLanGUI( Parent ), RefreshTimer(this){ |
17 | 17 | ||
18 | InterfaceInfo * II; | 18 | InterfaceInfo * II; |
19 | 19 | ||
20 | NNI = TNNI; | 20 | NNI = TNNI; |
21 | Dev = NNI->runtime()->device(); | 21 | Dev = NNI->runtime()->device(); |
22 | WE = 0; | 22 | WE = 0; |
23 | if( ( II = Dev->assignedInterface() ) ) { | 23 | if( ( II = NNI->connection()->assignedInterface() ) ) { |
24 | // show data | 24 | // show data |
25 | WE = new WExtensions( II->Name ); | 25 | WE = new WExtensions( II->Name ); |
26 | 26 | ||
27 | if( WE->doesHaveWirelessExtensions() ) { | 27 | if( WE->doesHaveWirelessExtensions() ) { |
28 | QString S; | 28 | QString S; |
29 | Station_LBL->setText( WE->station() ); | 29 | Station_LBL->setText( WE->station() ); |
30 | ESSID_LBL->setText( WE->essid() ); | 30 | ESSID_LBL->setText( WE->essid() ); |
31 | Mode_LBL->setText( WE->mode() ); | 31 | Mode_LBL->setText( WE->mode() ); |
32 | S.setNum( WE->frequency() ); | 32 | S.setNum( WE->frequency() ); |
33 | Frequency_LBL->setText( S ); | 33 | Frequency_LBL->setText( S ); |
34 | S.setNum( WE->channel() ); | 34 | S.setNum( WE->channel() ); |
35 | Channel_LBL->setText( S ); | 35 | Channel_LBL->setText( S ); |
36 | S.setNum( WE->rate() ); | 36 | S.setNum( WE->rate() ); |
37 | Rate_LBL->setText( S ); | 37 | Rate_LBL->setText( S ); |
38 | AP_LBL->setText( WE->ap() ); | 38 | AP_LBL->setText( WE->ap() ); |
39 | 39 | ||
40 | SLOT_Refresh(); | 40 | SLOT_Refresh(); |
41 | 41 | ||
42 | connect( &RefreshTimer, SIGNAL( timeout() ), | 42 | connect( &RefreshTimer, SIGNAL( timeout() ), |
43 | this, SLOT( SLOT_Refresh() ) ); | 43 | this, SLOT( SLOT_Refresh() ) ); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | WLanEdit::~WLanEdit( void ) { | 48 | WLanEdit::~WLanEdit( void ) { |
49 | if( WE ) | 49 | if( WE ) |
50 | delete WE; | 50 | delete WE; |
51 | } | 51 | } |
52 | 52 | ||
53 | QString WLanEdit::acceptable( void ) { | 53 | QString WLanEdit::acceptable( void ) { |
54 | if( ESSID_LE->text().isEmpty() ) { | 54 | if( ESSID_LE->text().isEmpty() ) { |
55 | return QString("ESSID is mandatory"); | 55 | return QString("ESSID is mandatory"); |
56 | } | 56 | } |
57 | if( SpecifyAP_CB->isChecked() && | 57 | if( SpecifyAP_CB->isChecked() && |
58 | APMac_LE->text().isEmpty() ) { | 58 | APMac_LE->text().isEmpty() ) { |
59 | return QString("APMac must have value"); | 59 | return QString("APMac must have value"); |
60 | } | 60 | } |
61 | return QString(); | 61 | return QString(); |
62 | } | 62 | } |
63 | 63 | ||
64 | void WLanEdit::showData( WLanData_t & Data ) { | 64 | void WLanEdit::showData( WLanData & Data ) { |
65 | Mode_CB->setCurrentItem( Data.Mode ); | 65 | Mode_CB->setCurrentItem( Data.Mode ); |
66 | ESSID_LE->setText( Data.ESSID ); | 66 | ESSID_LE->setText( Data.ESSID ); |
67 | NodeName_LE->setText( Data.NodeName ); | 67 | NodeName_LE->setText( Data.NodeName ); |
68 | SpecifyAP_CB->setChecked( Data.SpecificAP ); | 68 | SpecifyAP_CB->setChecked( Data.SpecificAP ); |
69 | APMac_LE->setText( Data.APMac ); | 69 | APMac_LE->setText( Data.APMac ); |
70 | 70 | ||
71 | EnableWEP_CB->setChecked( Data.Encrypted ); | 71 | EnableWEP_CB->setChecked( Data.Encrypted ); |
72 | AcceptNonEncrypted_CB->setChecked( Data.AcceptNonEncrypted ); | 72 | AcceptNonEncrypted_CB->setChecked( Data.AcceptNonEncrypted ); |
73 | Key1_LE->setText( Data.Key[0] ); | 73 | Key1_LE->setText( Data.Key[0] ); |
74 | Key2_LE->setText( Data.Key[1] ); | 74 | Key2_LE->setText( Data.Key[1] ); |
75 | Key3_LE->setText( Data.Key[2] ); | 75 | Key3_LE->setText( Data.Key[2] ); |
76 | Key4_LE->setText( Data.Key[3] ); | 76 | Key4_LE->setText( Data.Key[3] ); |
77 | } | 77 | } |
78 | 78 | ||
79 | bool WLanEdit::commit( WLanData_t & Data ) { | 79 | bool WLanEdit::commit( WLanData & Data ) { |
80 | bool SM = 0; | 80 | bool SM = 0; |
81 | 81 | ||
82 | TXTM( Data.ESSID, ESSID_LE, SM ); | 82 | TXTM( Data.ESSID, ESSID_LE, SM ); |
83 | TXTM( Data.NodeName, NodeName_LE, SM ); | 83 | TXTM( Data.NodeName, NodeName_LE, SM ); |
84 | TXTM( Data.APMac, APMac_LE, SM ); | 84 | TXTM( Data.APMac, APMac_LE, SM ); |
85 | TXTM( Data.Key[0], Key1_LE, SM ); | 85 | TXTM( Data.Key[0], Key1_LE, SM ); |
86 | TXTM( Data.Key[1], Key2_LE, SM ); | 86 | TXTM( Data.Key[1], Key2_LE, SM ); |
87 | TXTM( Data.Key[2], Key3_LE, SM ); | 87 | TXTM( Data.Key[2], Key3_LE, SM ); |
88 | TXTM( Data.Key[3], Key4_LE, SM ); | 88 | TXTM( Data.Key[3], Key4_LE, SM ); |
89 | CBM( Data.SpecificAP, SpecifyAP_CB, SM ); | 89 | CBM( Data.SpecificAP, SpecifyAP_CB, SM ); |
90 | CBM( Data.Encrypted, EnableWEP_CB, SM ); | 90 | CBM( Data.Encrypted, EnableWEP_CB, SM ); |
91 | CBM( Data.AcceptNonEncrypted, AcceptNonEncrypted_CB, SM ); | 91 | CBM( Data.AcceptNonEncrypted, AcceptNonEncrypted_CB, SM ); |
92 | CIM( Data.Mode, Mode_CB, SM ); | 92 | CIM( Data.Mode, Mode_CB, SM ); |
93 | return 0; | 93 | return 0; |
94 | } | 94 | } |
95 | 95 | ||
96 | void WLanEdit::SLOT_Refresh( void ) { | 96 | void WLanEdit::SLOT_Refresh( void ) { |
97 | if( WE ) { | 97 | if( WE ) { |
98 | int signal, noise, quality; | 98 | int signal, noise, quality; |
99 | WE->stats( signal, noise, quality); | 99 | WE->stats( signal, noise, quality); |
100 | 100 | ||
101 | Signal_PB->setProgress( signal ); | 101 | Signal_PB->setProgress( signal ); |
102 | Noise_PB->setProgress( noise ); | 102 | Noise_PB->setProgress( noise ); |
103 | Quality_PB->setProgress( quality ); | 103 | Quality_PB->setProgress( quality ); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | void WLanEdit::SLOT_AutoRefresh( bool ar ) { | 107 | void WLanEdit::SLOT_AutoRefresh( bool ar ) { |
108 | if( ar ) { | 108 | if( ar ) { |
109 | RefreshTimer.start( 1000 ); | 109 | RefreshTimer.start( 1000 ); |
110 | SLOT_Refresh(); | 110 | SLOT_Refresh(); |
111 | } else { | 111 | } else { |
112 | RefreshTimer.stop(); | 112 | RefreshTimer.stop(); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
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 @@ | |||
1 | #include <qtimer.h> | 1 | #include <qtimer.h> |
2 | #include <wextensions.h> | 2 | #include <wextensions.h> |
3 | #include "wlandata.h" | 3 | #include "wlandata.h" |
4 | #include "wlanGUI.h" | 4 | #include "wlanGUI.h" |
5 | 5 | ||
6 | class ANetNodeInstance; | 6 | class ANetNodeInstance; |
7 | class AsDevice; | 7 | class RuntimeInfo; |
8 | class WExtensions; | 8 | class WExtensions; |
9 | 9 | ||
10 | class WLanEdit : public WLanGUI { | 10 | class WLanEdit : public WLanGUI { |
11 | 11 | ||
12 | public : | 12 | public : |
13 | 13 | ||
14 | WLanEdit( QWidget * parent, ANetNodeInstance * NNI ); | 14 | WLanEdit( QWidget * parent, ANetNodeInstance * NNI ); |
15 | ~WLanEdit( void ); | 15 | ~WLanEdit( void ); |
16 | QString acceptable( void ); | 16 | QString acceptable( void ); |
17 | void showData( WLanData_t & Data ); | 17 | void showData( WLanData & Data ); |
18 | bool commit( WLanData_t & Data ); | 18 | bool commit( WLanData & Data ); |
19 | 19 | ||
20 | public slots : | 20 | public slots : |
21 | 21 | ||
22 | void SLOT_AutoRefresh( bool ); | 22 | void SLOT_AutoRefresh( bool ); |
23 | void SLOT_Refresh( void ); | 23 | void SLOT_Refresh( void ); |
24 | 24 | ||
25 | private : | 25 | private : |
26 | 26 | ||
27 | ANetNodeInstance * NNI; | 27 | ANetNodeInstance * NNI; |
28 | AsDevice * Dev; | 28 | RuntimeInfo * Dev; |
29 | QTimer RefreshTimer; | 29 | QTimer RefreshTimer; |
30 | WExtensions * WE; | 30 | WExtensions * WE; |
31 | 31 | ||
32 | }; | 32 | }; |
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,185 +1,120 @@ | |||
1 | 1 | ||
2 | #include <qfile.h> | 2 | #include <qfile.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <qstringlist.h> | 4 | #include <qstringlist.h> |
5 | #include <resources.h> | 5 | #include <resources.h> |
6 | #include "wlanrun.h" | 6 | #include "wlanrun.h" |
7 | 7 | ||
8 | void WLanRun::detectState( NodeCollection * NC ) { | 8 | State_t WLanRun::detectState( void ) { |
9 | 9 | ||
10 | // unavailable : no card found | 10 | // unavailable : no card found |
11 | // available : card found and assigned to us or free | 11 | // available : card found and assigned to us or free |
12 | // up : card found and assigned to us and up | 12 | // up : card found and assigned to us and up |
13 | 13 | ||
14 | NodeCollection * NC = nodeCollection(); | ||
14 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 15 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
15 | System & Sys = NSResources->system(); | 16 | System & Sys = NSResources->system(); |
16 | InterfaceInfo * Run; | 17 | InterfaceInfo * Run; |
17 | 18 | ||
18 | QFile F( S ); | 19 | QFile F( S ); |
19 | 20 | ||
20 | if( F.open( IO_ReadOnly ) ) { | 21 | if( F.open( IO_ReadOnly ) ) { |
21 | // could open file -> read interface and assign | 22 | // could open file -> read interface and assign |
22 | QString X; | 23 | QString X; |
23 | QTextStream TS(&F); | 24 | QTextStream TS(&F); |
24 | X = TS.readLine(); | 25 | X = TS.readLine(); |
25 | // find interface | 26 | // find interface |
26 | if( handlesInterface( X ) ) { | 27 | if( handlesInterface( X ) ) { |
27 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 28 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
28 | It.current(); | 29 | It.current(); |
29 | ++It ) { | 30 | ++It ) { |
30 | Run = It.current(); | 31 | Run = It.current(); |
31 | if( X == Run->Name ) { | 32 | if( X == Run->Name ) { |
32 | Run->assignNode( netNode() ); | 33 | NC->assignInterface( Run ); |
33 | assignInterface( Run ); | 34 | return IsUp; |
34 | NC->setCurrentState( IsUp ); | ||
35 | return; | ||
36 | } | 35 | } |
37 | } | 36 | } |
38 | } | 37 | } |
39 | } | 38 | } |
40 | 39 | ||
41 | if( ( Run = assignedInterface() ) ) { | 40 | if( ( Run = NC->assignedInterface() ) ) { |
42 | // we already have an interface assigned -> still present ? | 41 | // we already have an interface assigned -> still present ? |
43 | if( ! Run->IsUp ) { | 42 | if( ! Run->IsUp ) { |
44 | // usb is still free -> keep assignment | 43 | // usb is still free -> keep assignment |
45 | NC->setCurrentState( Available ); | 44 | return Available; |
46 | return; | ||
47 | } // else interface is up but NOT us -> some other profile | 45 | } // else interface is up but NOT us -> some other profile |
48 | } | 46 | } |
49 | 47 | ||
50 | // nothing (valid) assigned to us | 48 | // nothing (valid) assigned to us |
51 | assignInterface( 0 ); | 49 | NC->assignInterface( 0 ); |
52 | 50 | ||
53 | // find possible interface | 51 | // find possible interface |
54 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 52 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
55 | It.current(); | 53 | It.current(); |
56 | ++It ) { | 54 | ++It ) { |
57 | Run = It.current(); | 55 | Run = It.current(); |
58 | if( handlesInterface( *Run ) && | 56 | if( handlesInterface( *Run ) && |
59 | ( Run->CardType == ARPHRD_ETHER | 57 | ( Run->CardType == ARPHRD_ETHER |
60 | #ifdef ARPHRD_IEEE1394 | 58 | #ifdef ARPHRD_IEEE1394 |
61 | || Run->CardType == ARPHRD_IEEE1394 | 59 | || Run->CardType == ARPHRD_IEEE1394 |
62 | #endif | 60 | #endif |
63 | ) && | 61 | ) && |
64 | ! Run->IsUp | 62 | ! Run->IsUp |
65 | ) { | 63 | ) { |
66 | // proper type, and Not UP -> free | 64 | // proper type, and Not UP -> free |
67 | NC->setCurrentState( Off ); | 65 | return Off; |
68 | return; | ||
69 | } | 66 | } |
70 | } | 67 | } |
71 | // no free found | ||
72 | 68 | ||
73 | NC->setCurrentState( Unavailable ); | 69 | return Unavailable; |
74 | 70 | ||
75 | } | 71 | } |
76 | 72 | ||
77 | bool WLanRun::setState( NodeCollection * NC, Action_t A, bool ) { | 73 | QString WLanRun::setMyState( NodeCollection * , Action_t , bool ) { |
78 | 74 | ||
79 | // we only handle activate and deactivate | 75 | // we only handle activate and deactivate |
80 | switch( A ) { | 76 | return QString(); |
81 | case Activate : | ||
82 | { | ||
83 | if( NC->currentState() != Off ) { | ||
84 | return 0; | ||
85 | } | ||
86 | InterfaceInfo * N = getInterface(); | ||
87 | if( ! N ) { | ||
88 | // no interface available | ||
89 | NC->setCurrentState( Unavailable ); | ||
90 | return 0; | ||
91 | } | ||
92 | // because we were OFF the interface | ||
93 | // we get back is NOT assigned | ||
94 | N->assignNode( netNode() ); | ||
95 | assignInterface( N ); | ||
96 | NC->setCurrentState( Available ); | ||
97 | return 1; | ||
98 | } | ||
99 | case Deactivate : | ||
100 | if( NC->currentState() == IsUp ) { | ||
101 | // bring down first | ||
102 | if( ! connection()->setState( Down ) ) | ||
103 | // could not ... | ||
104 | return 0; | ||
105 | } else if( NC->currentState() != Available ) { | ||
106 | return 1; | ||
107 | } | ||
108 | assignedInterface()->assignNode( 0 ); // release | ||
109 | assignInterface( 0 ); | ||
110 | NC->setCurrentState( Off ); | ||
111 | return 1; | ||
112 | default : | ||
113 | // FT | ||
114 | break; | ||
115 | } | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | bool WLanRun::canSetState( State_t Curr, Action_t A ) { | ||
120 | // we only handle up down activate and deactivate | ||
121 | switch( A ) { | ||
122 | case Activate : | ||
123 | { // at least available | ||
124 | if( Curr == Available ) { | ||
125 | return 1; | ||
126 | } | ||
127 | // or we can make one available | ||
128 | InterfaceInfo * N = getInterface(); | ||
129 | if( ! N || N->assignedNode() != 0 ) { | ||
130 | // non available or assigned | ||
131 | return 0; | ||
132 | } | ||
133 | return 1; | ||
134 | } | ||
135 | case Deactivate : | ||
136 | return ( Curr >= Available ); | ||
137 | default : | ||
138 | // FT | ||
139 | break; | ||
140 | } | ||
141 | return 0; | ||
142 | } | 77 | } |
143 | 78 | ||
144 | // get interface that is free or assigned to us | 79 | // get interface that is free or assigned to us |
145 | InterfaceInfo * WLanRun::getInterface( void ) { | 80 | InterfaceInfo * WLanRun::getInterface( void ) { |
146 | 81 | ||
147 | System & S = NSResources->system(); | 82 | System & S = NSResources->system(); |
148 | InterfaceInfo * best = 0, * Run; | 83 | InterfaceInfo * best = 0, * Run; |
149 | 84 | ||
150 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 85 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
151 | It.current(); | 86 | It.current(); |
152 | ++It ) { | 87 | ++It ) { |
153 | Run = It.current(); | 88 | Run = It.current(); |
154 | if( handlesInterface( *Run ) && | 89 | if( handlesInterface( *Run ) && |
155 | ( Run->CardType == ARPHRD_ETHER | 90 | ( Run->CardType == ARPHRD_ETHER |
156 | #ifdef ARPHRD_IEEE1394 | 91 | #ifdef ARPHRD_IEEE1394 |
157 | || Run->CardType == ARPHRD_IEEE1394 | 92 | || Run->CardType == ARPHRD_IEEE1394 |
158 | #endif | 93 | #endif |
159 | ) | 94 | ) |
160 | ) { | 95 | ) { |
161 | // this is a LAN card | 96 | // this is a LAN card |
162 | if( Run->assignedNode() == netNode() ) { | 97 | if( Run->assignedConnection() == netNode()->connection() ) { |
163 | // assigned to us | 98 | // assigned to us |
164 | return Run; | 99 | return Run; |
165 | } else if( Run->assignedNode() == 0 ) { | 100 | } else if( Run->assignedConnection() == 0 ) { |
166 | // free | 101 | // free |
167 | best = Run; | 102 | best = Run; |
168 | } | 103 | } |
169 | } | 104 | } |
170 | } | 105 | } |
171 | return best; // can be 0 | 106 | return best; // can be 0 |
172 | } | 107 | } |
173 | 108 | ||
174 | bool WLanRun::handlesInterface( const QString & S ) { | 109 | bool WLanRun::handlesInterface( const QString & S ) { |
175 | InterfaceInfo * II; | 110 | InterfaceInfo * II; |
176 | II = NSResources->system().interface( S ); | 111 | II = NSResources->system().interface( S ); |
177 | if( ( II = NSResources->system().interface( S ) ) ) { | 112 | if( ( II = NSResources->system().interface( S ) ) ) { |
178 | return handlesInterface( *II ); | 113 | return handlesInterface( *II ); |
179 | } | 114 | } |
180 | return Pat.match( S ) >= 0; | 115 | return Pat.match( S ) >= 0; |
181 | } | 116 | } |
182 | 117 | ||
183 | bool WLanRun::handlesInterface( const InterfaceInfo & II ) { | 118 | bool WLanRun::handlesInterface( const InterfaceInfo & II ) { |
184 | return ( Pat.match( II.Name ) < 0 ); | 119 | return ( Pat.match( II.Name ) < 0 ); |
185 | } | 120 | } |
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 @@ | |||
1 | #ifndef WLANRUN_H | 1 | #ifndef WLANRUN_H |
2 | #define WLANRUN_H | 2 | #define WLANRUN_H |
3 | 3 | ||
4 | #include <qregexp.h> | 4 | #include <qregexp.h> |
5 | #include <asdevice.h> | 5 | #include <netnode.h> |
6 | #include "wlandata.h" | 6 | #include "wlandata.h" |
7 | 7 | ||
8 | class WLanRun : public AsDevice { | 8 | class WLanRun : public RuntimeInfo { |
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | WLanRun( ANetNodeInstance * NNI, WLanData & Data ) : | 12 | WLanRun( ANetNodeInstance * NNI, WLanData & Data ) : |
13 | AsDevice( NNI ), | 13 | RuntimeInfo( NNI ), |
14 | Pat( "wlan[0-9]" ) | 14 | Pat( "wlan[0-9]" ) { |
15 | { } | 15 | } |
16 | 16 | ||
17 | virtual AsDevice * device( void ) | 17 | virtual RuntimeInfo * device( void ) |
18 | { return (AsDevice *)this; } | 18 | { return this; } |
19 | virtual AsDevice * asDevice( void ) | ||
20 | { return (AsDevice *)this; } | ||
21 | 19 | ||
22 | protected : | ||
23 | |||
24 | void detectState( NodeCollection * ); | ||
25 | bool setState( NodeCollection *, Action_t, bool ); | ||
26 | bool canSetState( State_t, Action_t ); | ||
27 | bool handlesInterface( const QString & I ); | 20 | bool handlesInterface( const QString & I ); |
28 | bool handlesInterface( const InterfaceInfo & II ); | 21 | bool handlesInterface( const InterfaceInfo & II ); |
29 | 22 | ||
23 | State_t detectState( void ); | ||
24 | |||
25 | protected : | ||
26 | |||
27 | QString setMyState( NodeCollection * , Action_t, bool ); | ||
28 | |||
30 | private : | 29 | private : |
31 | 30 | ||
32 | InterfaceInfo * getInterface( void ); | 31 | InterfaceInfo * getInterface( void ); |
33 | QRegExp Pat; | 32 | QRegExp Pat; |
34 | WLanData * Data; | 33 | WLanData * Data; |
35 | }; | 34 | }; |
36 | 35 | ||
37 | #endif | 36 | #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 | |||
@@ -1,96 +1,101 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OCONFITEM_H | 32 | #ifndef OCONFITEM_H |
33 | #define OCONFITEM_H | 33 | #define OCONFITEM_H |
34 | 34 | ||
35 | #include <qlist.h> | 35 | #include <qlist.h> |
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | 37 | ||
38 | class OConfItem | 38 | class OConfItem |
39 | { | 39 | { |
40 | public: | 40 | public: |
41 | enum Type { Source, Destination, Option, Arch, NotDefined }; | 41 | enum Type { Source=0x01, |
42 | GzSource=0x02, | ||
43 | Destination=0x04, | ||
44 | Option=0x08, | ||
45 | Arch=0x10, | ||
46 | NotDefined=0x20 }; | ||
42 | 47 | ||
43 | OConfItem( Type type = NotDefined, const QString &name = QString::null, | 48 | OConfItem( Type type = NotDefined, const QString &name = QString::null, |
44 | const QString &value = QString::null, const QString &features = QString::null, | 49 | const QString &value = QString::null, const QString &features = QString::null, |
45 | bool active = true ); | 50 | bool active = true ); |
46 | 51 | ||
47 | Type type() { return m_type; } | 52 | Type type() { return m_type; } |
48 | const QString &name() { return m_name; } | 53 | const QString &name() { return m_name; } |
49 | const QString &value() { return m_value; } | 54 | const QString &value() { return m_value; } |
50 | const QString &features() { return m_features; } | 55 | const QString &features() { return m_features; } |
51 | bool active() { return m_active; } | 56 | bool active() { return m_active; } |
52 | 57 | ||
53 | void setType( Type type ) { m_type = type; } | 58 | void setType( Type type ) { m_type = type; } |
54 | void setName( const QString &name ) { m_name = name; } | 59 | void setName( const QString &name ) { m_name = name; } |
55 | void setValue( const QString &value ) { m_value = value; } | 60 | void setValue( const QString &value ) { m_value = value; } |
56 | void setFeatures( const QString &features ) { m_features = features; } | 61 | void setFeatures( const QString &features ) { m_features = features; } |
57 | void setActive( bool active ) { m_active = active; } | 62 | void setActive( bool active ) { m_active = active; } |
58 | 63 | ||
59 | private: | 64 | private: |
60 | Type m_type; // Type of configuration item | 65 | Type m_type; // Type of configuration item |
61 | QString m_name; // Name of item | 66 | QString m_name; // Name of item |
62 | QString m_value; // Value of item | 67 | QString m_value; // Value of item |
63 | QString m_features; // Comma-deliminated list of features this item supports | 68 | QString m_features; // Comma-deliminated list of features this item supports |
64 | bool m_active; // Indicates whether item is currently active | 69 | bool m_active; // Indicates whether item is currently active |
65 | }; | 70 | }; |
66 | 71 | ||
67 | class OConfItemList : public QList<OConfItem> | 72 | class OConfItemList : public QList<OConfItem> |
68 | { | 73 | { |
69 | private: | 74 | private: |
70 | 75 | ||
71 | int compareItems( QCollection::Item item1, QCollection::Item item2 ) | 76 | int compareItems( QCollection::Item item1, QCollection::Item item2 ) |
72 | { | 77 | { |
73 | // Sort by OConfItem location then by type | 78 | // Sort by OConfItem location then by type |
74 | OConfItem::Type type1 = reinterpret_cast<OConfItem*>(item1)->type(); | 79 | OConfItem::Type type1 = reinterpret_cast<OConfItem*>(item1)->type(); |
75 | OConfItem::Type type2 = reinterpret_cast<OConfItem*>(item2)->type(); | 80 | OConfItem::Type type2 = reinterpret_cast<OConfItem*>(item2)->type(); |
76 | if ( type1 < type2 ) | 81 | if ( type1 < type2 ) |
77 | return -1; | 82 | return -1; |
78 | else if ( type1 == type2 ) | 83 | else if ( type1 == type2 ) |
79 | { | 84 | { |
80 | QString name1 = reinterpret_cast<OConfItem*>(item1)->name(); | 85 | QString name1 = reinterpret_cast<OConfItem*>(item1)->name(); |
81 | QString name2 = reinterpret_cast<OConfItem*>(item2)->name(); | 86 | QString name2 = reinterpret_cast<OConfItem*>(item2)->name(); |
82 | if ( name1 < name2 ) | 87 | if ( name1 < name2 ) |
83 | return -1; | 88 | return -1; |
84 | else if ( name1 == name2 ) | 89 | else if ( name1 == name2 ) |
85 | return 0; | 90 | return 0; |
86 | else /*if ( name1 > name2 )*/ | 91 | else /*if ( name1 > name2 )*/ |
87 | return 1; | 92 | return 1; |
88 | } | 93 | } |
89 | else /*if ( type1 > type2 )*/ | 94 | else /*if ( type1 > type2 )*/ |
90 | return 1; | 95 | return 1; |
91 | } | 96 | } |
92 | }; | 97 | }; |
93 | 98 | ||
94 | typedef QListIterator<OConfItem> OConfItemListIterator; | 99 | typedef QListIterator<OConfItem> OConfItemListIterator; |
95 | 100 | ||
96 | #endif | 101 | #endif |
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 | |||
@@ -1,765 +1,768 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "oipkg.h" | 32 | #include "oipkg.h" |
33 | 33 | ||
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qtextstream.h> | 36 | #include <qtextstream.h> |
37 | 37 | ||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <unistd.h> | 39 | #include <unistd.h> |
40 | 40 | ||
41 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file | 41 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file |
42 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files | 42 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files |
43 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists | 43 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists |
44 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location | 44 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location |
45 | const QString IPKG_INFO_PATH = "usr/lib/ipkg/info"; // Package file lists location | 45 | const QString IPKG_INFO_PATH = "usr/lib/ipkg/info"; // Package file lists location |
46 | 46 | ||
47 | OIpkg *oipkg; | 47 | OIpkg *oipkg; |
48 | 48 | ||
49 | // Ipkg callback functions | 49 | // Ipkg callback functions |
50 | 50 | ||
51 | int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) | 51 | int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) |
52 | { | 52 | { |
53 | // Display message only if it is below the message level threshold | 53 | // Display message only if it is below the message level threshold |
54 | if ( conf && ( conf->verbosity < level ) ) | 54 | if ( conf && ( conf->verbosity < level ) ) |
55 | return 0; | 55 | return 0; |
56 | else | 56 | else |
57 | oipkg->ipkgMessage( msg ); | 57 | oipkg->ipkgMessage( msg ); |
58 | 58 | ||
59 | return 0; | 59 | return 0; |
60 | } | 60 | } |
61 | 61 | ||
62 | char *fIpkgResponse( char */*question*/ ) | 62 | char *fIpkgResponse( char */*question*/ ) |
63 | { | 63 | { |
64 | return 0l; | 64 | return 0l; |
65 | } | 65 | } |
66 | 66 | ||
67 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) | 67 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) |
68 | { | 68 | { |
69 | oipkg->ipkgStatus( desc ); | 69 | oipkg->ipkgStatus( desc ); |
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, | 73 | int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, |
74 | void */*userdata*/ ) | 74 | void */*userdata*/ ) |
75 | { | 75 | { |
76 | oipkg->ipkgList( desc ); | 76 | oipkg->ipkgList( desc ); |
77 | return 0; | 77 | return 0; |
78 | } | 78 | } |
79 | 79 | ||
80 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) | 80 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) |
81 | : QObject( parent, name ) | 81 | : QObject( parent, name ) |
82 | , m_config( config ) | 82 | , m_config( config ) |
83 | , m_confInfo( NULL ) | 83 | , m_confInfo( NULL ) |
84 | , m_ipkgExecOptions( 0 ) | 84 | , m_ipkgExecOptions( 0 ) |
85 | , m_ipkgExecVerbosity( 1 ) | 85 | , m_ipkgExecVerbosity( 1 ) |
86 | { | 86 | { |
87 | // Keep pointer to self for the Ipkg callback functions | 87 | // Keep pointer to self for the Ipkg callback functions |
88 | oipkg = this; | 88 | oipkg = this; |
89 | 89 | ||
90 | // Initialize libipkg | 90 | // Initialize libipkg |
91 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); | 91 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); |
92 | 92 | ||
93 | // Default ipkg run-time arguments | 93 | // Default ipkg run-time arguments |
94 | m_ipkgArgs.noaction = false; | 94 | m_ipkgArgs.noaction = false; |
95 | m_ipkgArgs.force_defaults = true; | 95 | m_ipkgArgs.force_defaults = true; |
96 | } | 96 | } |
97 | 97 | ||
98 | OIpkg::~OIpkg() | 98 | OIpkg::~OIpkg() |
99 | { | 99 | { |
100 | // Upon destruction, ensure that items in config list are deleted with list | 100 | // Upon destruction, ensure that items in config list are deleted with list |
101 | if ( m_confInfo ) | 101 | if ( m_confInfo ) |
102 | m_confInfo->setAutoDelete( true ); | 102 | m_confInfo->setAutoDelete( true ); |
103 | 103 | ||
104 | // Free up libipkg resources | 104 | // Free up libipkg resources |
105 | ipkg_deinit( &m_ipkgArgs ); | 105 | ipkg_deinit( &m_ipkgArgs ); |
106 | } | 106 | } |
107 | 107 | ||
108 | OConfItemList *OIpkg::configItems() | 108 | OConfItemList *OIpkg::configItems() |
109 | { | 109 | { |
110 | // Retrieve all configuration items | 110 | // Retrieve all configuration items |
111 | return filterConfItems(); | 111 | return filterConfItems(); |
112 | } | 112 | } |
113 | 113 | ||
114 | OConfItemList *OIpkg::servers() | 114 | OConfItemList *OIpkg::servers() |
115 | { | 115 | { |
116 | // Retrieve only servers | 116 | // Retrieve only servers |
117 | return filterConfItems( OConfItem::Source ); | 117 | return filterConfItems( (OConfItem::Type)((int)OConfItem::Source | |
118 | (int)OConfItem::GzSource) ); | ||
118 | } | 119 | } |
119 | 120 | ||
120 | OConfItemList *OIpkg::destinations() | 121 | OConfItemList *OIpkg::destinations() |
121 | { | 122 | { |
122 | // Retrieve only destinations | 123 | // Retrieve only destinations |
123 | return filterConfItems( OConfItem::Destination ); | 124 | return filterConfItems( OConfItem::Destination ); |
124 | } | 125 | } |
125 | 126 | ||
126 | OConfItemList *OIpkg::options() | 127 | OConfItemList *OIpkg::options() |
127 | { | 128 | { |
128 | // Retrieve only destinations | 129 | // Retrieve only destinations |
129 | return filterConfItems( OConfItem::Option ); | 130 | return filterConfItems( OConfItem::Option ); |
130 | } | 131 | } |
131 | 132 | ||
132 | void OIpkg::setConfigItems( OConfItemList *configList ) | 133 | void OIpkg::setConfigItems( OConfItemList *configList ) |
133 | { | 134 | { |
134 | if ( m_confInfo ) | 135 | if ( m_confInfo ) |
135 | delete m_confInfo; | 136 | delete m_confInfo; |
136 | 137 | ||
137 | m_confInfo = configList; | 138 | m_confInfo = configList; |
138 | 139 | ||
139 | // Write out new /etc/ipkg.conf | 140 | // Write out new /etc/ipkg.conf |
140 | QFile confFile( IPKG_CONF ); | 141 | QFile confFile( IPKG_CONF ); |
141 | if ( confFile.open( IO_WriteOnly ) ) | 142 | if ( confFile.open( IO_WriteOnly ) ) |
142 | { | 143 | { |
143 | QTextStream confStream( &confFile ); | 144 | QTextStream confStream( &confFile ); |
144 | confStream << "# Generated by Opie Package Manager\n\n"; | 145 | confStream << "# Generated by Opie Package Manager\n\n"; |
145 | 146 | ||
146 | OConfItemListIterator it( *m_confInfo ); | 147 | OConfItemListIterator it( *m_confInfo ); |
147 | for ( ; it.current(); ++it ) | 148 | for ( ; it.current(); ++it ) |
148 | { | 149 | { |
149 | OConfItem *item = it.current(); | 150 | OConfItem *item = it.current(); |
150 | 151 | ||
151 | // Only write out valid conf items | 152 | // Only write out valid conf items |
152 | if ( item->type() != OConfItem::NotDefined ) | 153 | if ( item->type() != OConfItem::NotDefined ) |
153 | { | 154 | { |
154 | QString confLine; | 155 | QString confLine; |
155 | if ( !item->active() ) | 156 | if ( !item->active() ) |
156 | confLine = "#"; | 157 | confLine = "#"; |
157 | 158 | ||
158 | switch ( item->type() ) | 159 | switch ( item->type() ) |
159 | { | 160 | { |
160 | case OConfItem::Source : | 161 | case OConfItem::Source : |
161 | { | 162 | { |
162 | if ( item->features().contains( "Compressed" ) ) | 163 | if ( item->features().contains( "Compressed" ) ) |
163 | confLine.append( "src/gz " ); | 164 | confLine.append( "src/gz " ); |
164 | else | 165 | else |
165 | confLine.append( "src " ); | 166 | confLine.append( "src " ); |
166 | } | 167 | } |
167 | break; | 168 | break; |
168 | case OConfItem::Destination : confLine.append( "dest " ); break; | 169 | case OConfItem::Destination : confLine.append( "dest " ); break; |
169 | case OConfItem::Option : confLine.append( "option " ); break; | 170 | case OConfItem::Option : confLine.append( "option " ); break; |
170 | case OConfItem::Arch : confLine.append( "arch " ); break; | 171 | case OConfItem::Arch : confLine.append( "arch " ); break; |
171 | default : break; | 172 | default : break; |
172 | }; | 173 | }; |
173 | 174 | ||
174 | confStream << confLine << " " << item->name() << " " << item->value() << "\n"; | 175 | confStream << confLine << " " << item->name() << " " << item->value() << "\n"; |
175 | } | 176 | } |
176 | } | 177 | } |
177 | 178 | ||
178 | confFile.close(); | 179 | confFile.close(); |
179 | } | 180 | } |
180 | else | 181 | else |
181 | { | 182 | { |
182 | // Problem writing to /etc/ipkg.conf, exit before removing other conf files | 183 | // Problem writing to /etc/ipkg.conf, exit before removing other conf files |
183 | return; | 184 | return; |
184 | } | 185 | } |
185 | 186 | ||
186 | // Delete /etc/ipkg/*.conf files (/etc/ipkg.conf should now have all settings | 187 | // Delete /etc/ipkg/*.conf files (/etc/ipkg.conf should now have all settings |
187 | QStringList confFiles; | 188 | QStringList confFiles; |
188 | QDir confDir( IPKG_CONF_DIR ); | 189 | QDir confDir( IPKG_CONF_DIR ); |
189 | if ( confDir.exists() ) | 190 | if ( confDir.exists() ) |
190 | { | 191 | { |
191 | confDir.setNameFilter( "*.conf" ); | 192 | confDir.setNameFilter( "*.conf" ); |
192 | confDir.setFilter( QDir::Files ); | 193 | confDir.setFilter( QDir::Files ); |
193 | confFiles = confDir.entryList( "*.conf", QDir::Files ); | 194 | confFiles = confDir.entryList( "*.conf", QDir::Files ); |
194 | 195 | ||
195 | QStringList::Iterator lastFile = confFiles.end(); | 196 | QStringList::Iterator lastFile = confFiles.end(); |
196 | for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) | 197 | for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) |
197 | { | 198 | { |
198 | // Create absolute file path if necessary | 199 | // Create absolute file path if necessary |
199 | QString absFile = (*it); | 200 | QString absFile = (*it); |
200 | if ( !absFile.startsWith( "/" ) ) | 201 | if ( !absFile.startsWith( "/" ) ) |
201 | absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); | 202 | absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); |
202 | 203 | ||
203 | // Delete file | 204 | // Delete file |
204 | QFile::remove( absFile ); | 205 | QFile::remove( absFile ); |
205 | } | 206 | } |
206 | } | 207 | } |
207 | 208 | ||
208 | // Reinitialize libipkg to pick up new configuration | 209 | // Reinitialize libipkg to pick up new configuration |
209 | ipkg_deinit( &m_ipkgArgs ); | 210 | ipkg_deinit( &m_ipkgArgs ); |
210 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); | 211 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); |
211 | m_ipkgArgs.noaction = false; | 212 | m_ipkgArgs.noaction = false; |
212 | m_ipkgArgs.force_defaults = true; | 213 | m_ipkgArgs.force_defaults = true; |
213 | } | 214 | } |
214 | 215 | ||
215 | void OIpkg::saveSettings() | 216 | void OIpkg::saveSettings() |
216 | { | 217 | { |
217 | // Save Ipkg execution options to application configuration file | 218 | // Save Ipkg execution options to application configuration file |
218 | if ( m_config ) | 219 | if ( m_config ) |
219 | { | 220 | { |
220 | m_config->setGroup( "Ipkg" ); | 221 | m_config->setGroup( "Ipkg" ); |
221 | m_config->writeEntry( "ExecOptions", m_ipkgExecOptions ); | 222 | m_config->writeEntry( "ExecOptions", m_ipkgExecOptions ); |
222 | m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity ); | 223 | m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity ); |
223 | } | 224 | } |
224 | } | 225 | } |
225 | 226 | ||
226 | OPackageList *OIpkg::availablePackages( const QString &server ) | 227 | OPackageList *OIpkg::availablePackages( const QString &server ) |
227 | { | 228 | { |
228 | // Load Ipkg configuration info if not already cached | 229 | // Load Ipkg configuration info if not already cached |
229 | if ( !m_confInfo ) | 230 | if ( !m_confInfo ) |
230 | loadConfiguration(); | 231 | loadConfiguration(); |
231 | 232 | ||
232 | // Build new server list (caller is responsible for deleting) | 233 | // Build new server list (caller is responsible for deleting) |
233 | OPackageList *pl = new OPackageList; | 234 | OPackageList *pl = new OPackageList; |
234 | 235 | ||
235 | // Open package list file | 236 | // Open package list file |
236 | QFile f( IPKG_PKG_PATH + "/" + server ); | 237 | QFile f( IPKG_PKG_PATH + "/" + server ); |
237 | if ( !f.open( IO_ReadOnly ) ) | 238 | if ( !f.open( IO_ReadOnly ) ) |
238 | return NULL; | 239 | return NULL; |
239 | QTextStream t( &f ); | 240 | QTextStream t( &f ); |
240 | 241 | ||
241 | // Process all information in package list file | 242 | // Process all information in package list file |
242 | OPackage *package = NULL; | 243 | OPackage *package = NULL; |
243 | QString line = t.readLine(); | 244 | QString line = t.readLine(); |
244 | while ( !t.eof() ) | 245 | while ( !t.eof() ) |
245 | { | 246 | { |
246 | // Determine key/value pair | 247 | // Determine key/value pair |
247 | int pos = line.find( ':', 0 ); | 248 | int pos = line.find( ':', 0 ); |
248 | QString key; | 249 | QString key; |
249 | if ( pos > -1 ) | 250 | if ( pos > -1 ) |
250 | key = line.mid( 0, pos ); | 251 | key = line.mid( 0, pos ); |
251 | else | 252 | else |
252 | key = QString::null; | 253 | key = QString::null; |
253 | QString value = line.mid( pos+2, line.length()-pos ); | 254 | QString value = line.mid( pos+2, line.length()-pos ); |
254 | 255 | ||
255 | // Allocate new package and insert into list | 256 | // Allocate new package and insert into list |
256 | if ( package == NULL && !key.isEmpty() ) | 257 | if ( package == NULL && !key.isEmpty() ) |
257 | { | 258 | { |
258 | package = new OPackage( value ); | 259 | package = new OPackage( value ); |
259 | package->setSource( server ); | 260 | package->setSource( server ); |
260 | pl->append( package ); | 261 | pl->append( package ); |
261 | } | 262 | } |
262 | 263 | ||
263 | // Update package data | 264 | // Update package data |
264 | if ( key == "Package" ) | 265 | if ( key == "Package" ) |
265 | package->setName( value ); | 266 | package->setName( value ); |
266 | else if ( key == "Version" ) | 267 | else if ( key == "Version" ) |
267 | package->setVersion( value ); | 268 | package->setVersion( value ); |
268 | else if ( key == "Section" ) | 269 | else if ( key == "Section" ) |
269 | package->setCategory( value ); | 270 | package->setCategory( value ); |
270 | //DataManager::setAvailableCategories( value ); | 271 | //DataManager::setAvailableCategories( value ); |
271 | else if ( key.isEmpty() && value.isEmpty() ) | 272 | else if ( key.isEmpty() && value.isEmpty() ) |
272 | package = NULL; | 273 | package = NULL; |
273 | 274 | ||
274 | // Skip past all description lines | 275 | // Skip past all description lines |
275 | if ( key == "Description" ) | 276 | if ( key == "Description" ) |
276 | { | 277 | { |
277 | line = t.readLine(); | 278 | line = t.readLine(); |
278 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) | 279 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) |
279 | line = t.readLine(); | 280 | line = t.readLine(); |
280 | } | 281 | } |
281 | else | 282 | else |
282 | line = t.readLine(); | 283 | line = t.readLine(); |
283 | } | 284 | } |
284 | 285 | ||
285 | f.close(); | 286 | f.close(); |
286 | 287 | ||
287 | return pl; | 288 | return pl; |
288 | } | 289 | } |
289 | 290 | ||
290 | OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath ) | 291 | OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath ) |
291 | { | 292 | { |
292 | // Load Ipkg configuration info if not already cached | 293 | // Load Ipkg configuration info if not already cached |
293 | if ( !m_confInfo ) | 294 | if ( !m_confInfo ) |
294 | loadConfiguration(); | 295 | loadConfiguration(); |
295 | 296 | ||
296 | // Build new server list (caller is responsible for deleting) | 297 | // Build new server list (caller is responsible for deleting) |
297 | OPackageList *pl = new OPackageList; | 298 | OPackageList *pl = new OPackageList; |
298 | 299 | ||
299 | // Open status file | 300 | // Open status file |
300 | QString path = destPath; | 301 | QString path = destPath; |
301 | if ( path.right( 1 ) != "/" ) | 302 | if ( path.right( 1 ) != "/" ) |
302 | path.append( "/" ); | 303 | path.append( "/" ); |
303 | path.append( IPKG_STATUS_PATH ); | 304 | path.append( IPKG_STATUS_PATH ); |
304 | 305 | ||
305 | QFile f( path ); | 306 | QFile f( path ); |
306 | if ( !f.open( IO_ReadOnly ) ) | 307 | if ( !f.open( IO_ReadOnly ) ) |
307 | return NULL; | 308 | return NULL; |
308 | QTextStream t( &f ); | 309 | QTextStream t( &f ); |
309 | 310 | ||
310 | // Process all information in status file | 311 | // Process all information in status file |
311 | bool newPackage = false; | 312 | bool newPackage = false; |
312 | QString line = t.readLine(); | 313 | QString line = t.readLine(); |
313 | QString name; | 314 | QString name; |
314 | QString version; | 315 | QString version; |
315 | QString status; | 316 | QString status; |
316 | 317 | ||
317 | while ( !t.eof() ) | 318 | while ( !t.eof() ) |
318 | { | 319 | { |
319 | // Determine key/value pair | 320 | // Determine key/value pair |
320 | int pos = line.find( ':', 0 ); | 321 | int pos = line.find( ':', 0 ); |
321 | QString key; | 322 | QString key; |
322 | if ( pos > -1 ) | 323 | if ( pos > -1 ) |
323 | key = line.mid( 0, pos ); | 324 | key = line.mid( 0, pos ); |
324 | else | 325 | else |
325 | key = QString::null; | 326 | key = QString::null; |
326 | QString value = line.mid( pos+2, line.length()-pos ); | 327 | QString value = line.mid( pos+2, line.length()-pos ); |
327 | 328 | ||
328 | // Allocate new package and insert into list | 329 | // Allocate new package and insert into list |
329 | if ( newPackage && !key.isEmpty() ) | 330 | if ( newPackage && !key.isEmpty() ) |
330 | { | 331 | { |
331 | // Add to list only if it has a valid name and is installed | 332 | // Add to list only if it has a valid name and is installed |
332 | if ( !name.isNull() && status.contains( " installed" ) ) | 333 | if ( !name.isNull() && status.contains( " installed" ) ) |
333 | { | 334 | { |
334 | pl->append( new OPackage( name, QString::null, version, QString::null, destName ) ); | 335 | pl->append( new OPackage( name, QString::null, version, QString::null, destName ) ); |
335 | name = QString::null; | 336 | name = QString::null; |
336 | version = QString::null; | 337 | version = QString::null; |
337 | status = QString::null; | 338 | status = QString::null; |
338 | 339 | ||
339 | newPackage = false; | 340 | newPackage = false; |
340 | } | 341 | } |
341 | } | 342 | } |
342 | 343 | ||
343 | // Update package data | 344 | // Update package data |
344 | if ( key == "Package" ) | 345 | if ( key == "Package" ) |
345 | name = value; | 346 | name = value; |
346 | else if ( key == "Version" ) | 347 | else if ( key == "Version" ) |
347 | version = value; | 348 | version = value; |
348 | else if ( key == "Status" ) | 349 | else if ( key == "Status" ) |
349 | status = value; | 350 | status = value; |
350 | else if ( key.isEmpty() && value.isEmpty() ) | 351 | else if ( key.isEmpty() && value.isEmpty() ) |
351 | newPackage = true; | 352 | newPackage = true; |
352 | 353 | ||
353 | // Skip past all description lines | 354 | // Skip past all description lines |
354 | if ( key == "Description" ) | 355 | if ( key == "Description" ) |
355 | { | 356 | { |
356 | line = t.readLine(); | 357 | line = t.readLine(); |
357 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) | 358 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) |
358 | line = t.readLine(); | 359 | line = t.readLine(); |
359 | } | 360 | } |
360 | else | 361 | else |
361 | line = t.readLine(); | 362 | line = t.readLine(); |
362 | } | 363 | } |
363 | 364 | ||
364 | f.close(); | 365 | f.close(); |
365 | 366 | ||
366 | return pl; | 367 | return pl; |
367 | } | 368 | } |
368 | 369 | ||
369 | OConfItem *OIpkg::findConfItem( OConfItem::Type type, const QString &name ) | 370 | OConfItem *OIpkg::findConfItem( OConfItem::Type type, const QString &name ) |
370 | { | 371 | { |
371 | // Find configuration item in list | 372 | // Find configuration item in list |
372 | OConfItemListIterator configIt( *m_confInfo ); | 373 | OConfItemListIterator configIt( *m_confInfo ); |
373 | OConfItem *config = 0l; | 374 | OConfItem *config = 0l; |
374 | for ( ; configIt.current(); ++configIt ) | 375 | for ( ; configIt.current(); ++configIt ) |
375 | { | 376 | { |
376 | config = configIt.current(); | 377 | config = configIt.current(); |
377 | if ( config->type() == type && config->name() == name ) | 378 | if ( config->type() == type && config->name() == name ) |
378 | break; | 379 | break; |
379 | } | 380 | } |
380 | 381 | ||
381 | if ( config && config->type() == type && config->name() == name ) | 382 | if ( config && config->type() == type && config->name() == name ) |
382 | return config; | 383 | return config; |
383 | 384 | ||
384 | return 0l; | 385 | return 0l; |
385 | } | 386 | } |
386 | 387 | ||
387 | bool OIpkg::executeCommand( OPackage::Command command, const QStringList ¶meters, const QString &destination, | 388 | bool OIpkg::executeCommand( OPackage::Command command, const QStringList ¶meters, const QString &destination, |
388 | const QObject *receiver, const char *slotOutput, bool rawOutput ) | 389 | const QObject *receiver, const char *slotOutput, bool rawOutput ) |
389 | { | 390 | { |
390 | if ( command == OPackage::NotDefined ) | 391 | if ( command == OPackage::NotDefined ) |
391 | return false; | 392 | return false; |
392 | 393 | ||
393 | // Set ipkg run-time options/arguments | 394 | // Set ipkg run-time options/arguments |
394 | m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); | 395 | m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); |
395 | m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); | 396 | m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); |
396 | // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); | 397 | // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); |
397 | m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); | 398 | m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); |
398 | m_ipkgArgs.verbosity = m_ipkgExecVerbosity; | 399 | m_ipkgArgs.verbosity = m_ipkgExecVerbosity; |
399 | if ( m_ipkgArgs.dest ) | 400 | if ( m_ipkgArgs.dest ) |
400 | free( m_ipkgArgs.dest ); | 401 | free( m_ipkgArgs.dest ); |
401 | if ( !destination.isNull() ) | 402 | if ( !destination.isNull() ) |
402 | { | 403 | { |
403 | int len = destination.length() + 1; | 404 | int len = destination.length() + 1; |
404 | m_ipkgArgs.dest = (char *)malloc( len ); | 405 | m_ipkgArgs.dest = (char *)malloc( len ); |
405 | strncpy( m_ipkgArgs.dest, destination, destination.length() ); | 406 | strncpy( m_ipkgArgs.dest, destination, destination.length() ); |
406 | m_ipkgArgs.dest[ len - 1 ] = '\0'; | 407 | m_ipkgArgs.dest[ len - 1 ] = '\0'; |
407 | } | 408 | } |
408 | else | 409 | else |
409 | m_ipkgArgs.dest = 0l; | 410 | m_ipkgArgs.dest = 0l; |
410 | 411 | ||
411 | // Connect output signal to widget | 412 | // Connect output signal to widget |
412 | 413 | ||
413 | if ( !rawOutput ) | 414 | if ( !rawOutput ) |
414 | { | 415 | { |
415 | // TODO - connect to local slot and parse output before emitting signalIpkgMessage | 416 | // TODO - connect to local slot and parse output before emitting signalIpkgMessage |
416 | } | 417 | } |
417 | 418 | ||
418 | switch( command ) | 419 | switch( command ) |
419 | { | 420 | { |
420 | case OPackage::Update : { | 421 | case OPackage::Update : { |
421 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); | 422 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); |
422 | ipkg_lists_update( &m_ipkgArgs ); | 423 | ipkg_lists_update( &m_ipkgArgs ); |
423 | }; | 424 | }; |
424 | break; | 425 | break; |
425 | case OPackage::Upgrade : { | 426 | case OPackage::Upgrade : { |
426 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); | 427 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); |
427 | ipkg_packages_upgrade( &m_ipkgArgs ); | 428 | ipkg_packages_upgrade( &m_ipkgArgs ); |
428 | 429 | ||
429 | // Re-link non-root destinations to make sure everything is in sync | 430 | // Re-link non-root destinations to make sure everything is in sync |
430 | OConfItemList *destList = destinations(); | 431 | OConfItemList *destList = destinations(); |
431 | OConfItemListIterator it( *destList ); | 432 | OConfItemListIterator it( *destList ); |
432 | for ( ; it.current(); ++it ) | 433 | for ( ; it.current(); ++it ) |
433 | { | 434 | { |
434 | OConfItem *dest = it.current(); | 435 | OConfItem *dest = it.current(); |
435 | if ( dest->name() != "root" ) | 436 | if ( dest->name() != "root" ) |
436 | linkPackageDir( dest->name() ); | 437 | linkPackageDir( dest->name() ); |
437 | } | 438 | } |
438 | delete destList; | 439 | delete destList; |
439 | }; | 440 | }; |
440 | break; | 441 | break; |
441 | case OPackage::Install : { | 442 | case OPackage::Install : { |
442 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); | 443 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); |
443 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) | 444 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) |
444 | { | 445 | { |
445 | ipkg_packages_install( &m_ipkgArgs, (*it) ); | 446 | ipkg_packages_install( &m_ipkgArgs, (*it) ); |
446 | } | 447 | } |
447 | if ( destination != "root" ) | 448 | if ( destination != "root" ) |
448 | linkPackageDir( destination ); | 449 | linkPackageDir( destination ); |
449 | }; | 450 | }; |
450 | break; | 451 | break; |
451 | case OPackage::Remove : { | 452 | case OPackage::Remove : { |
452 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); | 453 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); |
453 | 454 | ||
454 | // Get list of destinations for unlinking of packages not installed to root | 455 | // Get list of destinations for unlinking of packages not installed to root |
455 | OConfItemList *destList = destinations(); | 456 | OConfItemList *destList = destinations(); |
456 | 457 | ||
457 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) | 458 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) |
458 | { | 459 | { |
459 | unlinkPackage( (*it), destList ); | 460 | unlinkPackage( (*it), destList ); |
460 | ipkg_packages_remove( &m_ipkgArgs, (*it), true ); | 461 | ipkg_packages_remove( &m_ipkgArgs, (*it), true ); |
461 | } | 462 | } |
462 | 463 | ||
463 | delete destList; | 464 | delete destList; |
464 | }; | 465 | }; |
465 | break; | 466 | break; |
466 | case OPackage::Download : { | 467 | case OPackage::Download : { |
467 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); | 468 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); |
468 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) | 469 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) |
469 | { | 470 | { |
470 | ipkg_packages_download( &m_ipkgArgs, (*it) ); | 471 | ipkg_packages_download( &m_ipkgArgs, (*it) ); |
471 | } | 472 | } |
472 | }; | 473 | }; |
473 | break; | 474 | break; |
474 | case OPackage::Info : { | 475 | case OPackage::Info : { |
475 | connect( this, SIGNAL(signalIpkgStatus(const QString &)), receiver, slotOutput ); | 476 | connect( this, SIGNAL(signalIpkgStatus(const QString &)), receiver, slotOutput ); |
476 | ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0l ); | 477 | ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0l ); |
477 | }; | 478 | }; |
478 | break; | 479 | break; |
479 | case OPackage::Files : { | 480 | case OPackage::Files : { |
480 | connect( this, SIGNAL(signalIpkgList(const QString &)), receiver, slotOutput ); | 481 | connect( this, SIGNAL(signalIpkgList(const QString &)), receiver, slotOutput ); |
481 | ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0l ); | 482 | ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0l ); |
482 | }; | 483 | }; |
483 | break; | 484 | break; |
484 | default : break; | 485 | default : break; |
485 | }; | 486 | }; |
486 | 487 | ||
487 | return true; | 488 | return true; |
488 | } | 489 | } |
489 | 490 | ||
490 | void OIpkg::ipkgMessage( char *msg ) | 491 | void OIpkg::ipkgMessage( char *msg ) |
491 | { | 492 | { |
492 | emit signalIpkgMessage( msg ); | 493 | emit signalIpkgMessage( msg ); |
493 | } | 494 | } |
494 | 495 | ||
495 | void OIpkg::ipkgStatus( char *status ) | 496 | void OIpkg::ipkgStatus( char *status ) |
496 | { | 497 | { |
497 | emit signalIpkgStatus( status ); | 498 | emit signalIpkgStatus( status ); |
498 | } | 499 | } |
499 | 500 | ||
500 | void OIpkg::ipkgList( char *filelist ) | 501 | void OIpkg::ipkgList( char *filelist ) |
501 | { | 502 | { |
502 | emit signalIpkgList( filelist ); | 503 | emit signalIpkgList( filelist ); |
503 | } | 504 | } |
504 | 505 | ||
505 | void OIpkg::loadConfiguration() | 506 | void OIpkg::loadConfiguration() |
506 | { | 507 | { |
507 | if ( m_confInfo ) | 508 | if ( m_confInfo ) |
508 | delete m_confInfo; | 509 | delete m_confInfo; |
509 | 510 | ||
510 | // Load configuration item list | 511 | // Load configuration item list |
511 | m_confInfo = new OConfItemList(); | 512 | m_confInfo = new OConfItemList(); |
512 | 513 | ||
513 | QStringList confFiles; | 514 | QStringList confFiles; |
514 | QDir confDir( IPKG_CONF_DIR ); | 515 | QDir confDir( IPKG_CONF_DIR ); |
515 | if ( confDir.exists() ) | 516 | if ( confDir.exists() ) |
516 | { | 517 | { |
517 | confDir.setNameFilter( "*.conf" ); | 518 | confDir.setNameFilter( "*.conf" ); |
518 | confDir.setFilter( QDir::Files ); | 519 | confDir.setFilter( QDir::Files ); |
519 | confFiles = confDir.entryList( "*.conf", QDir::Files ); | 520 | confFiles = confDir.entryList( "*.conf", QDir::Files ); |
520 | } | 521 | } |
521 | confFiles << IPKG_CONF; | 522 | confFiles << IPKG_CONF; |
522 | 523 | ||
523 | QStringList::Iterator lastFile = confFiles.end(); | 524 | QStringList::Iterator lastFile = confFiles.end(); |
524 | for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) | 525 | for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) |
525 | { | 526 | { |
526 | // Create absolute file path if necessary | 527 | // Create absolute file path if necessary |
527 | QString absFile = (*it); | 528 | QString absFile = (*it); |
528 | if ( !absFile.startsWith( "/" ) ) | 529 | if ( !absFile.startsWith( "/" ) ) |
529 | absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); | 530 | absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); |
530 | 531 | ||
531 | // Read in file | 532 | // Read in file |
532 | QFile f( absFile ); | 533 | QFile f( absFile ); |
533 | if ( f.open( IO_ReadOnly ) ) | 534 | if ( f.open( IO_ReadOnly ) ) |
534 | { | 535 | { |
535 | QTextStream s( &f ); | 536 | QTextStream s( &f ); |
536 | while ( !s.eof() ) | 537 | while ( !s.eof() ) |
537 | { | 538 | { |
538 | 539 | ||
539 | QString line = s.readLine().simplifyWhiteSpace(); | 540 | QString line = s.readLine().simplifyWhiteSpace(); |
540 | 541 | ||
541 | // Parse line and save info to the conf options list | 542 | // Parse line and save info to the conf options list |
542 | if ( !line.isEmpty() ) | 543 | if ( !line.isEmpty() ) |
543 | { | 544 | { |
544 | if ( !line.startsWith( "#" ) || | 545 | if ( !line.startsWith( "#" ) || |
545 | line.startsWith( "#src" ) || | 546 | line.startsWith( "#src" ) || |
547 | line.startsWith( "#src/gz" ) || | ||
546 | line.startsWith( "#dest" ) || | 548 | line.startsWith( "#dest" ) || |
547 | line.startsWith( "#arch" ) || | 549 | line.startsWith( "#arch" ) || |
548 | line.startsWith( "#option" ) ) | 550 | line.startsWith( "#option" ) ) |
549 | { | 551 | { |
550 | int pos = line.find( ' ', 1 ); | 552 | int pos = line.find( ' ', 1 ); |
551 | 553 | ||
552 | // Type | 554 | // Type |
553 | QString typeStr = line.left( pos ); | 555 | QString typeStr = line.left( pos ); |
554 | OConfItem::Type type; | 556 | OConfItem::Type type; |
555 | QString features; | 557 | QString features; |
556 | if ( typeStr == "src" || typeStr == "#src" ) | 558 | if ( typeStr == "src" || typeStr == "#src" ) |
557 | type = OConfItem::Source; | 559 | type = OConfItem::Source; |
558 | else if ( typeStr == "src/gz" || typeStr == "#src/gz" ) | 560 | else if ( typeStr == "src/gz" || typeStr == "#src/gz" ) |
559 | { | 561 | { |
560 | type = OConfItem::Source; | 562 | type = OConfItem::Source; |
561 | features = "Compressed"; | 563 | features = "Compressed"; |
562 | } | 564 | } |
563 | else if ( typeStr == "dest" || typeStr == "#dest" ) | 565 | else if ( typeStr == "dest" || typeStr == "#dest" ) |
564 | type = OConfItem::Destination; | 566 | type = OConfItem::Destination; |
565 | else if ( typeStr == "option" || typeStr == "#option" ) | 567 | else if ( typeStr == "option" || typeStr == "#option" ) |
566 | type = OConfItem::Option; | 568 | type = OConfItem::Option; |
567 | else if ( typeStr == "arch" || typeStr == "#arch" ) | 569 | else if ( typeStr == "arch" || typeStr == "#arch" ) |
568 | type = OConfItem::Arch; | 570 | type = OConfItem::Arch; |
569 | else | 571 | else |
570 | type = OConfItem::NotDefined; | 572 | type = OConfItem::NotDefined; |
571 | ++pos; | 573 | ++pos; |
572 | int endpos = line.find( ' ', pos ); | 574 | int endpos = line.find( ' ', pos ); |
573 | 575 | ||
574 | // Name | 576 | // Name |
575 | QString name = line.mid( pos, endpos - pos ); | 577 | QString name = line.mid( pos, endpos - pos ); |
576 | 578 | ||
577 | // Value | 579 | // Value |
578 | QString value = ""; | 580 | QString value = ""; |
579 | if ( endpos > -1 ) | 581 | if ( endpos > -1 ) |
580 | value = line.right( line.length() - endpos - 1 ); | 582 | value = line.right( line.length() - endpos - 1 ); |
581 | 583 | ||
582 | // Active | 584 | // Active |
583 | bool active = !line.startsWith( "#" ); | 585 | bool active = !line.startsWith( "#" ); |
584 | 586 | ||
585 | // Add to list | 587 | // Add to list |
586 | m_confInfo->append( new OConfItem( type, name, value, features, active ) ); | 588 | m_confInfo->append( new OConfItem( type, name, value, features, active ) ); |
587 | } | 589 | } |
588 | } | 590 | } |
589 | } | 591 | } |
590 | 592 | ||
591 | f.close(); | 593 | f.close(); |
592 | } | 594 | } |
593 | } | 595 | } |
594 | 596 | ||
595 | // Load Ipkg execution options from application configuration file | 597 | // Load Ipkg execution options from application configuration file |
596 | if ( m_config ) | 598 | if ( m_config ) |
597 | { | 599 | { |
598 | m_config->setGroup( "Ipkg" ); | 600 | m_config->setGroup( "Ipkg" ); |
599 | m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions ); | 601 | m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions ); |
600 | m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity ); | 602 | m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity ); |
601 | } | 603 | } |
602 | } | 604 | } |
603 | 605 | ||
604 | OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter ) | 606 | OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter ) |
605 | { | 607 | { |
606 | // Load Ipkg configuration info if not already cached | 608 | // Load Ipkg configuration info if not already cached |
607 | if ( !m_confInfo ) | 609 | if ( !m_confInfo ) |
608 | loadConfiguration(); | 610 | loadConfiguration(); |
609 | 611 | ||
610 | // Build new server list (caller is responsible for deleting) | 612 | // Build new server list (caller is responsible for deleting) |
611 | OConfItemList *sl = new OConfItemList; | 613 | OConfItemList *sl = new OConfItemList; |
612 | 614 | ||
613 | // If typefilter is empty, retrieve all items | 615 | // If typefilter is empty, retrieve all items |
614 | bool retrieveAll = ( typefilter == OConfItem::NotDefined ); | 616 | bool retrieveAll = ( typefilter == OConfItem::NotDefined ); |
615 | 617 | ||
616 | // Parse configuration info for servers | 618 | // Parse configuration info for servers |
617 | OConfItemListIterator it( *m_confInfo ); | 619 | OConfItemListIterator it( *m_confInfo ); |
618 | for ( ; it.current(); ++it ) | 620 | for ( ; it.current(); ++it ) |
619 | { | 621 | { |
620 | OConfItem *item = it.current(); | 622 | OConfItem *item = it.current(); |
621 | if ( retrieveAll || item->type() == typefilter ) | 623 | if ( retrieveAll || |
624 | ( item->type() & typefilter ) ) | ||
622 | { | 625 | { |
623 | sl->append( item ); | 626 | sl->append( item ); |
624 | } | 627 | } |
625 | } | 628 | } |
626 | 629 | ||
627 | return sl; | 630 | return sl; |
628 | } | 631 | } |
629 | 632 | ||
630 | const QString &OIpkg::rootPath() | 633 | const QString &OIpkg::rootPath() |
631 | { | 634 | { |
632 | if ( m_rootPath.isEmpty() ) | 635 | if ( m_rootPath.isEmpty() ) |
633 | { | 636 | { |
634 | OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" ); | 637 | OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" ); |
635 | rootDest ? m_rootPath = rootDest->value() | 638 | rootDest ? m_rootPath = rootDest->value() |
636 | : m_rootPath = '/'; | 639 | : m_rootPath = '/'; |
637 | if ( m_rootPath.right( 1 ) == '/' ) | 640 | if ( m_rootPath.right( 1 ) == '/' ) |
638 | m_rootPath.truncate( m_rootPath.length() - 1 ); | 641 | m_rootPath.truncate( m_rootPath.length() - 1 ); |
639 | } | 642 | } |
640 | return m_rootPath; | 643 | return m_rootPath; |
641 | } | 644 | } |
642 | 645 | ||
643 | void OIpkg::linkPackageDir( const QString &dest ) | 646 | void OIpkg::linkPackageDir( const QString &dest ) |
644 | { | 647 | { |
645 | if ( !dest.isNull() ) | 648 | if ( !dest.isNull() ) |
646 | { | 649 | { |
647 | OConfItem *destConfItem = findConfItem( OConfItem::Destination, dest ); | 650 | OConfItem *destConfItem = findConfItem( OConfItem::Destination, dest ); |
648 | 651 | ||
649 | emit signalIpkgMessage( tr( "Linking packages installed in: %1" ).arg( dest ) ); | 652 | emit signalIpkgMessage( tr( "Linking packages installed in: %1" ).arg( dest ) ); |
650 | 653 | ||
651 | // Set package destination directory | 654 | // Set package destination directory |
652 | QString destDir = destConfItem->value(); | 655 | QString destDir = destConfItem->value(); |
653 | QString destInfoDir = destDir; | 656 | QString destInfoDir = destDir; |
654 | if ( destInfoDir.right( 1 ) != '/' ) | 657 | if ( destInfoDir.right( 1 ) != '/' ) |
655 | destInfoDir.append( '/' ); | 658 | destInfoDir.append( '/' ); |
656 | destInfoDir.append( IPKG_INFO_PATH ); | 659 | destInfoDir.append( IPKG_INFO_PATH ); |
657 | 660 | ||
658 | // Get list of installed packages in destination | 661 | // Get list of installed packages in destination |
659 | QDir packageDir( destInfoDir ); | 662 | QDir packageDir( destInfoDir ); |
660 | QStringList packageFiles; | 663 | QStringList packageFiles; |
661 | if ( packageDir.exists() ) | 664 | if ( packageDir.exists() ) |
662 | { | 665 | { |
663 | packageDir.setNameFilter( "*.list" ); | 666 | packageDir.setNameFilter( "*.list" ); |
664 | packageDir.setFilter( QDir::Files ); | 667 | packageDir.setFilter( QDir::Files ); |
665 | packageFiles = packageDir.entryList( "*.list", QDir::Files ); | 668 | packageFiles = packageDir.entryList( "*.list", QDir::Files ); |
666 | } | 669 | } |
667 | 670 | ||
668 | // Link all files for every package installed in desination | 671 | // Link all files for every package installed in desination |
669 | QStringList::Iterator lastFile = packageFiles.end(); | 672 | QStringList::Iterator lastFile = packageFiles.end(); |
670 | for ( QStringList::Iterator it = packageFiles.begin(); it != lastFile; ++it ) | 673 | for ( QStringList::Iterator it = packageFiles.begin(); it != lastFile; ++it ) |
671 | { | 674 | { |
672 | //emit signalIpkgMessage( QString( "Processing: %1/%2" ).arg( destInfoDir ).arg (*it) ); | 675 | //emit signalIpkgMessage( QString( "Processing: %1/%2" ).arg( destInfoDir ).arg (*it) ); |
673 | QString packageFileName = destInfoDir; | 676 | QString packageFileName = destInfoDir; |
674 | packageFileName.append( '/' ); | 677 | packageFileName.append( '/' ); |
675 | packageFileName.append( (*it) ); | 678 | packageFileName.append( (*it) ); |
676 | QFile packageFile( packageFileName ); | 679 | QFile packageFile( packageFileName ); |
677 | if ( packageFile.open( IO_ReadOnly ) ) | 680 | if ( packageFile.open( IO_ReadOnly ) ) |
678 | { | 681 | { |
679 | QTextStream t( &packageFile ); | 682 | QTextStream t( &packageFile ); |
680 | QString linkFile; | 683 | QString linkFile; |
681 | while ( !t.eof() ) | 684 | while ( !t.eof() ) |
682 | { | 685 | { |
683 | // Get the name of the file to link and build the sym link filename | 686 | // Get the name of the file to link and build the sym link filename |
684 | linkFile = t.readLine(); | 687 | linkFile = t.readLine(); |
685 | QString linkDest( linkFile.right( linkFile.length() - destDir.length() ) ); | 688 | QString linkDest( linkFile.right( linkFile.length() - destDir.length() ) ); |
686 | linkDest.prepend( rootPath() ); | 689 | linkDest.prepend( rootPath() ); |
687 | 690 | ||
688 | // If file installed file is actually symbolic link, use actual file for linking | 691 | // If file installed file is actually symbolic link, use actual file for linking |
689 | QFileInfo fileInfo( linkFile ); | 692 | QFileInfo fileInfo( linkFile ); |
690 | if ( fileInfo.isSymLink() && !fileInfo.readLink().isEmpty() ) | 693 | if ( fileInfo.isSymLink() && !fileInfo.readLink().isEmpty() ) |
691 | linkFile = fileInfo.readLink(); | 694 | linkFile = fileInfo.readLink(); |
692 | 695 | ||
693 | // See if directory exists in 'root', if not, create | 696 | // See if directory exists in 'root', if not, create |
694 | fileInfo.setFile( linkDest ); | 697 | fileInfo.setFile( linkDest ); |
695 | QString linkDestDirName = fileInfo.dirPath( true ); | 698 | QString linkDestDirName = fileInfo.dirPath( true ); |
696 | QDir linkDestDir( linkDestDirName ); | 699 | QDir linkDestDir( linkDestDirName ); |
697 | if ( !linkDestDir.exists() ) | 700 | if ( !linkDestDir.exists() ) |
698 | { | 701 | { |
699 | linkDestDir.mkdir( linkDestDirName ); | 702 | linkDestDir.mkdir( linkDestDirName ); |
700 | } | 703 | } |
701 | else | 704 | else |
702 | { | 705 | { |
703 | // Remove any previous link to make sure we will be pointing to the current version | 706 | // Remove any previous link to make sure we will be pointing to the current version |
704 | if ( QFile::exists( linkDest ) ) | 707 | if ( QFile::exists( linkDest ) ) |
705 | QFile::remove( linkDest ); | 708 | QFile::remove( linkDest ); |
706 | } | 709 | } |
707 | 710 | ||
708 | // Link the file | 711 | // Link the file |
709 | //emit signalIpkgMessage( QString( "Linking '%1' to '%2'" ).arg( linkFile ).arg( linkDest ) ); | 712 | //emit signalIpkgMessage( QString( "Linking '%1' to '%2'" ).arg( linkFile ).arg( linkDest ) ); |
710 | if ( symlink( linkFile, linkDest ) == -1 ) | 713 | if ( symlink( linkFile, linkDest ) == -1 ) |
711 | emit signalIpkgMessage( tr( "Error linkling '%1' to '%2'" ) | 714 | emit signalIpkgMessage( tr( "Error linkling '%1' to '%2'" ) |
712 | .arg( linkFile ) | 715 | .arg( linkFile ) |
713 | .arg( linkDest ) ); | 716 | .arg( linkDest ) ); |
714 | } | 717 | } |
715 | packageFile.close(); | 718 | packageFile.close(); |
716 | } | 719 | } |
717 | } | 720 | } |
718 | } | 721 | } |
719 | } | 722 | } |
720 | 723 | ||
721 | void OIpkg::unlinkPackage( const QString &package, OConfItemList *destList ) | 724 | void OIpkg::unlinkPackage( const QString &package, OConfItemList *destList ) |
722 | { | 725 | { |
723 | if ( !package.isNull() ) | 726 | if ( !package.isNull() ) |
724 | { | 727 | { |
725 | // Find destination package is installed in | 728 | // Find destination package is installed in |
726 | if ( destList ) | 729 | if ( destList ) |
727 | { | 730 | { |
728 | OConfItemListIterator it( *destList ); | 731 | OConfItemListIterator it( *destList ); |
729 | for ( ; it.current(); ++it ) | 732 | for ( ; it.current(); ++it ) |
730 | { | 733 | { |
731 | OConfItem *dest = it.current(); | 734 | OConfItem *dest = it.current(); |
732 | QString destInfoFileName = QString( "%1/%2/%3.list" ).arg( dest->value() ) | 735 | QString destInfoFileName = QString( "%1/%2/%3.list" ).arg( dest->value() ) |
733 | .arg( IPKG_INFO_PATH ) | 736 | .arg( IPKG_INFO_PATH ) |
734 | .arg( package ); | 737 | .arg( package ); |
735 | //emit signalIpkgMessage( QString( "Looking for '%1'" ).arg ( destInfoFileName ) ); | 738 | //emit signalIpkgMessage( QString( "Looking for '%1'" ).arg ( destInfoFileName ) ); |
736 | 739 | ||
737 | // If found and destination is not 'root', remove symbolic links | 740 | // If found and destination is not 'root', remove symbolic links |
738 | if ( QFile::exists( destInfoFileName ) && dest->name() != "root" ) | 741 | if ( QFile::exists( destInfoFileName ) && dest->name() != "root" ) |
739 | { | 742 | { |
740 | QFile destInfoFile( destInfoFileName ); | 743 | QFile destInfoFile( destInfoFileName ); |
741 | if ( destInfoFile.open( IO_ReadOnly ) ) | 744 | if ( destInfoFile.open( IO_ReadOnly ) ) |
742 | { | 745 | { |
743 | QTextStream t( &destInfoFile ); | 746 | QTextStream t( &destInfoFile ); |
744 | QString linkFile; | 747 | QString linkFile; |
745 | while ( !t.eof() ) | 748 | while ( !t.eof() ) |
746 | { | 749 | { |
747 | // Get the name of the file to link and build the sym link filename | 750 | // Get the name of the file to link and build the sym link filename |
748 | linkFile = t.readLine(); | 751 | linkFile = t.readLine(); |
749 | QString linkDest( linkFile.right( linkFile.length() - | 752 | QString linkDest( linkFile.right( linkFile.length() - |
750 | dest->value().length() ) ); | 753 | dest->value().length() ) ); |
751 | linkDest.prepend( rootPath() ); | 754 | linkDest.prepend( rootPath() ); |
752 | 755 | ||
753 | //emit signalIpkgMessage( QString( "Deleting: '%1'" ).arg( linkDest ) ); | 756 | //emit signalIpkgMessage( QString( "Deleting: '%1'" ).arg( linkDest ) ); |
754 | QFile::remove( linkDest ); | 757 | QFile::remove( linkDest ); |
755 | } | 758 | } |
756 | destInfoFile.close(); | 759 | destInfoFile.close(); |
757 | } | 760 | } |
758 | 761 | ||
759 | emit signalIpkgMessage( tr( "Links removed for: %1" ).arg( package ) ); | 762 | emit signalIpkgMessage( tr( "Links removed for: %1" ).arg( package ) ); |
760 | return; | 763 | return; |
761 | } | 764 | } |
762 | } | 765 | } |
763 | } | 766 | } |
764 | } | 767 | } |
765 | } | 768 | } |
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 @@ | |||
1 | Package: opie-packagemanager | 1 | Package: opie-packagemanager |
2 | Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop | 2 | Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.120) | 5 | Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg0 (>=0.99.120), ipkg-link |
6 | Replaces: packagemanager | 6 | Replaces: packagemanager |
7 | Architecture: arm | 7 | Architecture: arm |
8 | Maintainer: Dan Williams (drw@handhelds.org) | 8 | Maintainer: Dan Williams (drw@handhelds.org) |
9 | Description: Opie package management client | 9 | Description: Opie package management client |
10 | Version: 0.6.1$EXTRAVERSION | 10 | 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 @@ | |||
1 | Package: opie-sh | 1 | Package: opie-sh |
2 | Files: bin/opie-sh apps/Opie-SH/opie-sh.desktop pics/opie-sh/*.png help/opie-sh/*.html | 2 | Files: bin/opie-sh apps/Opie-SH/opie-sh.desktop pics/opie-sh/*.png help/opie-sh/*.html |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/sh | 4 | Section: opie/sh |
5 | Maintainer: Thomas Stephens <spiralman@softhome.net> | 5 | Maintainer: Thomas Stephens <spiralman@softhome.net> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.5-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
9 | License: GPL | 9 | License: GPL |
10 | Description: A QDialog shell frontend | 10 | Description: A QDialog shell frontend |
11 | A program to let you use various dialogs from the console (or a shell script) | 11 | 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 @@ | |||
1 | Package: opie-sh-wavelanchooser | 1 | Package: opie-sh-wavelanchooser |
2 | Files: bin/opie-sh-wavelanchooser.sh apps/Opie-SH/opie-sh-wavelanchooser.desktop pics/opie-sh-scripts/qtwavelan.png | 2 | Files: bin/opie-sh-wavelanchooser.sh apps/Opie-SH/opie-sh-wavelanchooser.desktop pics/opie-sh-scripts/qtwavelan.png |
3 | Installed-Size: 0 | 3 | Installed-Size: 0 |
4 | Version: 0.1-20020527-1 | 4 | Version: $QPE_VERSION$EXTRAVERSION |
5 | Depends: task-opie-minimal (1.5.0+), opie-sh | 5 | Depends: task-opie-minimal (1.5.0+), opie-sh |
6 | Priority: optional | 6 | Priority: optional |
7 | Section: opie/sh | 7 | Section: opie/sh |
8 | Maintainer: gonz <gonz@directbox.com> | 8 | Maintainer: gonz <gonz@directbox.com> |
9 | Architecture: all | 9 | Architecture: all |
10 | License: GPL | 10 | License: GPL |
11 | Description: Frontend to choose wavelan config | 11 | 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 @@ | |||
1 | Package: opie-filebrowser | 1 | Package: opie-filebrowser |
2 | Files: bin/filebrowser apps/Applications/filebrowser.desktop pics/filebrowser/ | 2 | Files: bin/filebrowser apps/Applications/filebrowser.desktop pics/filebrowser/ |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: $QPE_VERSION-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
9 | Description: Browse the file system | 9 | Description: Browse the file system |
10 | The filebrowser for the Opie environment. | 10 | 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 @@ | |||
1 | Package: opie-gsmtool | 1 | Package: opie-gsmtool |
2 | Files: plugins/application/libgsmtool.so* bin/gsmtool apps/Applications/gsmtool.desktop pics/gsmtool | 2 | Files: plugins/application/libgsmtool.so* bin/gsmtool apps/Applications/gsmtool.desktop pics/gsmtool |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: David Woodhouse <dwmw2@infradead.org> | 5 | Maintainer: David Woodhouse <dwmw2@infradead.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 1.0.0-2 | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, gsmlib | 8 | Depends: task-opie-minimal, gsmlib |
9 | License: Public Domain | 9 | License: Public Domain |
10 | Description: GSMTool program | 10 | Description: GSMTool program |
11 | An GSM phone utility program for the Opie environment. | 11 | 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 @@ | |||
1 | Package: opie-oipkg | 1 | Package: opie-oipkg |
2 | Files: bin/oipkg apps/Settings/oipkg.desktop pics/oipkg/* | 2 | Files: bin/oipkg apps/Settings/oipkg.desktop pics/oipkg/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Patrick S. Vogt <tille@almana.ch> | 5 | Maintainer: Patrick S. Vogt <tille@almana.ch> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: $QPE_VERSION-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, ipkg (>0.99.20), ar | 8 | Depends: task-opie-minimal, ipkg (>0.99.20), ar |
9 | Description: Opie Projects advanced gui ipkg installer | 9 | Description: Opie Projects advanced gui ipkg installer |
10 | A GUI front-end to ipkg for the Opie environment. | 10 | 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 @@ | |||
1 | Package: opie-ubrowser | 1 | Package: opie-ubrowser |
2 | Files: bin/ubrowser apps/Applications/ubrowser.desktop pics/ubrowser/*.png plugins/application/libubrowser.so* | 2 | Files: bin/ubrowser apps/Applications/ubrowser.desktop pics/ubrowser/*.png plugins/application/libubrowser.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Thomas Stephens <spiralman@softhome.net> | 5 | Maintainer: Thomas Stephens <spiralman@softhome.net> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.1-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
9 | License: GPL | 9 | License: GPL |
10 | Description: A very small web browser | 10 | Description: A very small web browser |