summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindow.ui24
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp10
2 files changed, 32 insertions, 2 deletions
diff --git a/noncore/settings/networksettings/mainwindow.ui b/noncore/settings/networksettings/mainwindow.ui
index f61a1ae..a730dd5 100644
--- a/noncore/settings/networksettings/mainwindow.ui
+++ b/noncore/settings/networksettings/mainwindow.ui
@@ -1,84 +1,88 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>MainWindow</class> 2<class>MainWindow</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>MainWindow</cstring> 7 <cstring>MainWindow</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>240</width> 14 <width>240</width>
15 <height>289</height> 15 <height>289</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 <vbox> 22 <vbox>
23 <property stdset="1"> 23 <property stdset="1">
24 <name>margin</name> 24 <name>margin</name>
25 <number>0</number> 25 <number>0</number>
26 </property> 26 </property>
27 <property stdset="1"> 27 <property stdset="1">
28 <name>spacing</name> 28 <name>spacing</name>
29 <number>6</number> 29 <number>6</number>
30 </property> 30 </property>
31 <widget> 31 <widget>
32 <class>QTabWidget</class> 32 <class>QTabWidget</class>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>name</name> 34 <name>name</name>
35 <cstring>tabWidget</cstring> 35 <cstring>tabWidget</cstring>
36 </property> 36 </property>
37 <property stdset="1">
38 <name>enabled</name>
39 <bool>true</bool>
40 </property>
37 <property> 41 <property>
38 <name>layoutMargin</name> 42 <name>layoutMargin</name>
39 </property> 43 </property>
40 <widget> 44 <widget>
41 <class>QWidget</class> 45 <class>QWidget</class>
42 <property stdset="1"> 46 <property stdset="1">
43 <name>name</name> 47 <name>name</name>
44 <cstring>Widget3</cstring> 48 <cstring>Widget3</cstring>
45 </property> 49 </property>
46 <attribute> 50 <attribute>
47 <name>title</name> 51 <name>title</name>
48 <string>Connections</string> 52 <string>Connections</string>
49 </attribute> 53 </attribute>
50 <vbox> 54 <vbox>
51 <property stdset="1"> 55 <property stdset="1">
52 <name>margin</name> 56 <name>margin</name>
53 <number>0</number> 57 <number>0</number>
54 </property> 58 </property>
55 <property stdset="1"> 59 <property stdset="1">
56 <name>spacing</name> 60 <name>spacing</name>
57 <number>6</number> 61 <number>6</number>
58 </property> 62 </property>
59 <widget> 63 <widget>
60 <class>QListView</class> 64 <class>QListView</class>
61 <column> 65 <column>
62 <property> 66 <property>
63 <name>text</name> 67 <name>text</name>
64 <string>s</string> 68 <string>s</string>
65 </property> 69 </property>
66 <property> 70 <property>
67 <name>clickable</name> 71 <name>clickable</name>
68 <bool>true</bool> 72 <bool>true</bool>
69 </property> 73 </property>
70 <property> 74 <property>
71 <name>resizeable</name> 75 <name>resizeable</name>
72 <bool>true</bool> 76 <bool>true</bool>
73 </property> 77 </property>
74 </column> 78 </column>
75 <column> 79 <column>
76 <property> 80 <property>
77 <name>text</name> 81 <name>text</name>
78 <string>t</string> 82 <string>t</string>
79 </property> 83 </property>
80 <property> 84 <property>
81 <name>clickable</name> 85 <name>clickable</name>
82 <bool>true</bool> 86 <bool>true</bool>
83 </property> 87 </property>
84 <property> 88 <property>
@@ -91,158 +95,178 @@
91 <name>text</name> 95 <name>text</name>
92 <string>Name</string> 96 <string>Name</string>
93 </property> 97 </property>
94 <property> 98 <property>
95 <name>clickable</name> 99 <name>clickable</name>
96 <bool>true</bool> 100 <bool>true</bool>
97 </property> 101 </property>
98 <property> 102 <property>
99 <name>resizeable</name> 103 <name>resizeable</name>
100 <bool>true</bool> 104 <bool>true</bool>
101 </property> 105 </property>
102 </column> 106 </column>
103 <column> 107 <column>
104 <property> 108 <property>
105 <name>text</name> 109 <name>text</name>
106 <string>in</string> 110 <string>in</string>
107 </property> 111 </property>
108 <property> 112 <property>
109 <name>clickable</name> 113 <name>clickable</name>
110 <bool>true</bool> 114 <bool>true</bool>
111 </property> 115 </property>
112 <property> 116 <property>
113 <name>resizeable</name> 117 <name>resizeable</name>
114 <bool>true</bool> 118 <bool>true</bool>
115 </property> 119 </property>
116 </column> 120 </column>
117 <column> 121 <column>
118 <property> 122 <property>
119 <name>text</name> 123 <name>text</name>
120 <string>IP</string> 124 <string>IP</string>
121 </property> 125 </property>
122 <property> 126 <property>
123 <name>clickable</name> 127 <name>clickable</name>
124 <bool>true</bool> 128 <bool>true</bool>
125 </property> 129 </property>
126 <property> 130 <property>
127 <name>resizeable</name> 131 <name>resizeable</name>
128 <bool>true</bool> 132 <bool>true</bool>
129 </property> 133 </property>
130 </column> 134 </column>
131 <property stdset="1"> 135 <property stdset="1">
132 <name>name</name> 136 <name>name</name>
133 <cstring>connectionList</cstring> 137 <cstring>connectionList</cstring>
134 </property> 138 </property>
135 <property stdset="1"> 139 <property stdset="1">
136 <name>allColumnsShowFocus</name> 140 <name>allColumnsShowFocus</name>
137 <bool>true</bool> 141 <bool>true</bool>
138 </property> 142 </property>
143 <property>
144 <name>whatsThis</name>
145 <string>A list of network settings to be choosen from</string>
146 </property>
139 </widget> 147 </widget>
140 <widget> 148 <widget>
141 <class>QLayoutWidget</class> 149 <class>QLayoutWidget</class>
142 <property stdset="1"> 150 <property stdset="1">
143 <name>name</name> 151 <name>name</name>
144 <cstring>Layout2</cstring> 152 <cstring>Layout2</cstring>
145 </property> 153 </property>
146 <property> 154 <property>
147 <name>layoutMargin</name> 155 <name>layoutMargin</name>
148 </property> 156 </property>
149 <grid> 157 <grid>
150 <property stdset="1"> 158 <property stdset="1">
151 <name>margin</name> 159 <name>margin</name>
152 <number>5</number> 160 <number>5</number>
153 </property> 161 </property>
154 <property stdset="1"> 162 <property stdset="1">
155 <name>spacing</name> 163 <name>spacing</name>
156 <number>6</number> 164 <number>6</number>
157 </property> 165 </property>
158 <widget row="1" column="0" > 166 <widget row="1" column="0" >
159 <class>QPushButton</class> 167 <class>QPushButton</class>
160 <property stdset="1"> 168 <property stdset="1">
161 <name>name</name> 169 <name>name</name>
162 <cstring>addConnectionButton</cstring> 170 <cstring>addConnectionButton</cstring>
163 </property> 171 </property>
164 <property stdset="1"> 172 <property stdset="1">
165 <name>text</name> 173 <name>text</name>
166 <string>&amp;Add</string> 174 <string>&amp;Add</string>
167 </property> 175 </property>
176 <property>
177 <name>whatsThis</name>
178 <string>Add a new interface to the list.</string>
179 </property>
168 </widget> 180 </widget>
169 <widget row="0" column="0" > 181 <widget row="0" column="0" >
170 <class>QPushButton</class> 182 <class>QPushButton</class>
171 <property stdset="1"> 183 <property stdset="1">
172 <name>name</name> 184 <name>name</name>
173 <cstring>informationConnectionButton</cstring> 185 <cstring>informationConnectionButton</cstring>
174 </property> 186 </property>
175 <property stdset="1"> 187 <property stdset="1">
176 <name>text</name> 188 <name>text</name>
177 <string>&amp;Start/Stop</string> 189 <string>&amp;Start/Stop</string>
178 </property> 190 </property>
191 <property>
192 <name>whatsThis</name>
193 <string>Start and Stop the current interface, gives additional information about the interface.</string>
194 </property>
179 </widget> 195 </widget>
180 <widget row="0" column="1" > 196 <widget row="0" column="1" >
181 <class>QPushButton</class> 197 <class>QPushButton</class>
182 <property stdset="1"> 198 <property stdset="1">
183 <name>name</name> 199 <name>name</name>
184 <cstring>configureConnectionButton</cstring> 200 <cstring>configureConnectionButton</cstring>
185 </property> 201 </property>
186 <property stdset="1"> 202 <property stdset="1">
187 <name>text</name> 203 <name>text</name>
188 <string>&amp;Configure</string> 204 <string>&amp;Configure</string>
189 </property> 205 </property>
206 <property>
207 <name>whatsThis</name>
208 <string>Configure the current interface</string>
209 </property>
190 </widget> 210 </widget>
191 <widget row="1" column="1" > 211 <widget row="1" column="1" >
192 <class>QPushButton</class> 212 <class>QPushButton</class>
193 <property stdset="1"> 213 <property stdset="1">
194 <name>name</name> 214 <name>name</name>
195 <cstring>removeConnectionButton</cstring> 215 <cstring>removeConnectionButton</cstring>
196 </property> 216 </property>
197 <property stdset="1"> 217 <property stdset="1">
198 <name>text</name> 218 <name>text</name>
199 <string>&amp;Remove</string> 219 <string>&amp;Remove</string>
200 </property> 220 </property>
221 <property>
222 <name>whatsThis</name>
223 <string>Remove the current interface from the list.</string>
224 </property>
201 </widget> 225 </widget>
202 </grid> 226 </grid>
203 </widget> 227 </widget>
204 </vbox> 228 </vbox>
205 </widget> 229 </widget>
206 <widget> 230 <widget>
207 <class>QWidget</class> 231 <class>QWidget</class>
208 <property stdset="1"> 232 <property stdset="1">
209 <name>name</name> 233 <name>name</name>
210 <cstring>tab</cstring> 234 <cstring>tab</cstring>
211 </property> 235 </property>
212 <attribute> 236 <attribute>
213 <name>title</name> 237 <name>title</name>
214 <string>Profiles</string> 238 <string>Profiles</string>
215 </attribute> 239 </attribute>
216 <grid> 240 <grid>
217 <property stdset="1"> 241 <property stdset="1">
218 <name>margin</name> 242 <name>margin</name>
219 <number>11</number> 243 <number>11</number>
220 </property> 244 </property>
221 <property stdset="1"> 245 <property stdset="1">
222 <name>spacing</name> 246 <name>spacing</name>
223 <number>6</number> 247 <number>6</number>
224 </property> 248 </property>
225 <spacer row="7" column="2" > 249 <spacer row="7" column="2" >
226 <property> 250 <property>
227 <name>name</name> 251 <name>name</name>
228 <cstring>Spacer16</cstring> 252 <cstring>Spacer16</cstring>
229 </property> 253 </property>
230 <property stdset="1"> 254 <property stdset="1">
231 <name>orientation</name> 255 <name>orientation</name>
232 <enum>Vertical</enum> 256 <enum>Vertical</enum>
233 </property> 257 </property>
234 <property stdset="1"> 258 <property stdset="1">
235 <name>sizeType</name> 259 <name>sizeType</name>
236 <enum>Expanding</enum> 260 <enum>Expanding</enum>
237 </property> 261 </property>
238 <property> 262 <property>
239 <name>sizeHint</name> 263 <name>sizeHint</name>
240 <size> 264 <size>
241 <width>20</width> 265 <width>20</width>
242 <height>20</height> 266 <height>20</height>
243 </size> 267 </size>
244 </property> 268 </property>
245 </spacer> 269 </spacer>
246 <widget row="0" column="1" > 270 <widget row="0" column="1" >
247 <class>QLabel</class> 271 <class>QLabel</class>
248 <property stdset="1"> 272 <property stdset="1">
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 63b9603..abf5663 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -1,146 +1,152 @@
1#include "mainwindowimp.h" 1#include "mainwindowimp.h"
2#include "addconnectionimp.h" 2#include "addconnectionimp.h"
3#include "interfaceinformationimp.h" 3#include "interfaceinformationimp.h"
4#include "interfacesetupimp.h" 4#include "interfacesetupimp.h"
5#include "interfaces.h" 5#include "interfaces.h"
6#include "module.h" 6#include "module.h"
7 7
8#include <qpushbutton.h> 8#include <qpushbutton.h>
9#include <qlistbox.h> 9#include <qlistbox.h>
10#include <qlineedit.h> 10#include <qlineedit.h>
11#include <qlistview.h> 11#include <qlistview.h>
12#include <qheader.h> 12#include <qheader.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qtabwidget.h> // in order to disable the profiles tab
14 15
15#include <qmessagebox.h> 16#include <qmessagebox.h>
16 17
17#ifdef QWS 18#ifdef QWS
18 #include <qpe/config.h> 19 #include <qpe/config.h>
19 #include <qpe/qlibrary.h> 20 #include <qpe/qlibrary.h>
20 #include <qpe/resource.h> 21 #include <qpe/resource.h>
21 #include <qpe/qpeapplication.h> 22 #include <qpe/qpeapplication.h>
22#else 23#else
23 #include <klibloader.h> 24 #include <klibloader.h>
24 #define QLibrary KLibrary 25 #define QLibrary KLibrary
25 #include <kconfig.h> 26 #include <kconfig.h>
26 #define Config KConfig 27 #define Config KConfig
27 #include <kapplication.h> 28 #include <kapplication.h>
28 #include <kstandarddirs.h> 29 #include <kstandarddirs.h>
29 #include <kiconloader.h> 30 #include <kiconloader.h>
30 #define showMaximized show 31 #define showMaximized show
31#endif 32#endif
32 33
33#if QT_VERSION < 300 34#if QT_VERSION < 300
34#include <qlist.h> 35#include <qlist.h>
35#else 36#else
36#include <qptrlist.h> 37#include <qptrlist.h>
37#endif 38#endif
38#include <qdir.h> 39#include <qdir.h>
39#include <qfile.h> 40#include <qfile.h>
40#include <qtextstream.h> 41#include <qtextstream.h>
41#include <qregexp.h> 42#include <qregexp.h>
42 43
43#include <net/if.h> 44#include <net/if.h>
44#include <sys/ioctl.h> 45#include <sys/ioctl.h>
45#include <sys/socket.h> 46#include <sys/socket.h>
46 47
47#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" 48#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
48#define _PROCNETDEV "/proc/net/dev" 49#define _PROCNETDEV "/proc/net/dev"
49 50
50MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name), advancedUserMode(true), scheme(DEFAULT_SCHEME){ 51MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name), advancedUserMode(true), scheme(DEFAULT_SCHEME){
51 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 52 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
52 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 53 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
53 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 54 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
54 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 55 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
55 56
56 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 57 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
57 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 58 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
58 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); 59 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
59 60
60 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); 61 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
62
63 //FIXME: disable profiles for the moment:
64 tabWidget->setTabEnabled( tab, false );
65
61 // Load connections. 66 // Load connections.
62 // /usr/local/kde/lib/libinterfaces.la 67 // /usr/local/kde/lib/libinterfaces.la
63#ifdef QWS 68#ifdef QWS
64 loadModules(QPEApplication::qpeDir() + "/plugins/networksettings"); 69 loadModules(QPEApplication::qpeDir() + "/plugins/networksettings");
65#else 70#else
66 loader = KLibLoader::self(); 71 loader = KLibLoader::self();
67 loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); 72 loadModules(QString("/usr/")+KStandardDirs::kde_default("lib"));
68#endif 73#endif
69 getAllInterfaces(); 74 getAllInterfaces();
70 75
71 Interfaces i; 76 Interfaces i;
72 QStringList list = i.getInterfaceList(); 77 QStringList list = i.getInterfaceList();
73 QMap<QString, Interface*>::Iterator it; 78 QMap<QString, Interface*>::Iterator it;
74 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { 79 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) {
75 bool found = false; 80 bool found = false;
76 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ 81 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){
77 if(it.key() == (*ni)) 82 if(it.key() == (*ni))
78 found = true; 83 found = true;
79 } 84 }
80 if(!found){ 85 if(!found){
81 if(!(*ni).contains("_")){ 86 if(!(*ni).contains("_")){
82 Interface *i = new Interface(this, *ni, false); 87 Interface *i = new Interface(this, *ni, false);
83 i->setAttached(false); 88 i->setAttached(false);
84 i->setHardwareName("Disconnected"); 89 i->setHardwareName("Disconnected");
85 interfaceNames.insert(i->getInterfaceName(), i); 90 interfaceNames.insert(i->getInterfaceName(), i);
86 updateInterface(i); 91 updateInterface(i);
87 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 92 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
88 } 93 }
89 } 94 }
90 } 95 }
91 96
92 //getInterfaceList(); 97 //getInterfaceList();
93 connectionList->header()->hide(); 98 connectionList->header()->hide();
94 99
95 Config cfg("NetworkSetup"); 100 Config cfg("NetworkSetup");
96 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 101 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
97 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 102 for ( QStringList::Iterator it = profiles.begin();
98 profilesList->insertItem((*it)); 103 it != profiles.end(); ++it)
104 profilesList->insertItem((*it));
99 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); 105 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
100 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); 106 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
101 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); 107 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
102 108
103 QFile file(scheme); 109 QFile file(scheme);
104 if ( file.open(IO_ReadOnly) ) { // file opened successfully 110 if ( file.open(IO_ReadOnly) ) { // file opened successfully
105 QTextStream stream( &file ); // use a text stream 111 QTextStream stream( &file ); // use a text stream
106 while ( !stream.eof() ) { // until end of file... 112 while ( !stream.eof() ) { // until end of file...
107 QString line = stream.readLine(); // line of text excluding '\n' 113 QString line = stream.readLine(); // line of text excluding '\n'
108 if(line.contains("SCHEME")){ 114 if(line.contains("SCHEME")){
109 line = line.mid(7, line.length()); 115 line = line.mid(7, line.length());
110 currentProfileLabel->setText(line); 116 currentProfileLabel->setText(line);
111 break; 117 break;
112 } 118 }
113 } 119 }
114 file.close(); 120 file.close();
115 } 121 }
116} 122}
117 123
118/** 124/**
119 * Deconstructor. Save profiles. Delete loaded libraries. 125 * Deconstructor. Save profiles. Delete loaded libraries.
120 */ 126 */
121MainWindowImp::~MainWindowImp(){ 127MainWindowImp::~MainWindowImp(){
122 // Save profiles. 128 // Save profiles.
123 Config cfg("NetworkSetup"); 129 Config cfg("NetworkSetup");
124 cfg.setGroup("General"); 130 cfg.setGroup("General");
125 cfg.writeEntry("Profiles", profiles.join(" ")); 131 cfg.writeEntry("Profiles", profiles.join(" "));
126 132
127 // Delete all interfaces that don't have owners. 133 // Delete all interfaces that don't have owners.
128 QMap<Interface*, QListViewItem*>::Iterator iIt; 134 QMap<Interface*, QListViewItem*>::Iterator iIt;
129 for( iIt = items.begin(); iIt != items.end(); ++iIt ){ 135 for( iIt = items.begin(); iIt != items.end(); ++iIt ){
130 if(iIt.key()->getModuleOwner() == NULL) 136 if(iIt.key()->getModuleOwner() == NULL)
131 delete iIt.key(); 137 delete iIt.key();
132 } 138 }
133 139
134#ifdef QWS 140#ifdef QWS
135 // Delete Modules and Libraries 141 // Delete Modules and Libraries
136 QMap<Module*, QLibrary*>::Iterator it; 142 QMap<Module*, QLibrary*>::Iterator it;
137 for( it = libraries.begin(); it != libraries.end(); ++it ){ 143 for( it = libraries.begin(); it != libraries.end(); ++it ){
138 delete it.key(); 144 delete it.key();
139 // I wonder why I can't delete the libraries 145 // I wonder why I can't delete the libraries
140 // What fucking shit this is. 146 // What fucking shit this is.
141 //delete it.data(); 147 //delete it.data();
142 } 148 }
143#else 149#else
144 // klibloader automaticly deletes the libraries for us... 150 // klibloader automaticly deletes the libraries for us...
145#endif 151#endif
146} 152}