author | benmeyer <benmeyer> | 2002-10-02 19:23:45 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-10-02 19:23:45 (UTC) |
commit | 2d0c6327dd40ab6847ce055c40ca59893bc8b9b2 (patch) (side-by-side diff) | |
tree | 260222139bb322f24d058cba10db0f7d1c43858f | |
parent | c997983c6917885f6c487b942a9b294fa50ae618 (diff) | |
download | opie-2d0c6327dd40ab6847ce055c40ca59893bc8b9b2.zip opie-2d0c6327dd40ab6847ce055c40ca59893bc8b9b2.tar.gz opie-2d0c6327dd40ab6847ce055c40ca59893bc8b9b2.tar.bz2 |
Fixes
18 files changed, 314 insertions, 432 deletions
diff --git a/noncore/net/networksetup/interfaceinformation.ui b/noncore/net/networksetup/interfaceinformation.ui index 8b6280d..76af19c 100644 --- a/noncore/net/networksetup/interfaceinformation.ui +++ b/noncore/net/networksetup/interfaceinformation.ui @@ -1,110 +1,110 @@ <!DOCTYPE UI><UI> <class>InterfaceInformation</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>InterfaceInformation</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>203</width> + <width>199</width> <height>244</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Interface Information</string> </property> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="4" column="0" rowspan="1" colspan="2" > <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout1</cstring> </property> <grid> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>refreshButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Refresh</string> </property> </widget> <widget row="0" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>stopButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Stop</string> </property> </widget> <widget row="1" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>restartButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Restart</string> </property> </widget> <widget row="0" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>startButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Start</string> </property> </widget> </grid> </widget> <widget row="0" column="0" > <class>Line</class> <property stdset="1"> <name>name</name> <cstring>Line1</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel22</cstring> </property> <property stdset="1"> <name>text</name> @@ -240,99 +240,104 @@ <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget row="6" column="0" rowspan="1" colspan="2" > <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout2</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <spacer> <property> <name>name</name> <cstring>Spacer10</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>advancedButton</cstring> </property> <property stdset="1"> <name>text</name> <string>View Advanced Information</string> </property> </widget> </hbox> </widget> <widget row="5" column="0" rowspan="1" colspan="2" > <class>Line</class> <property stdset="1"> <name>name</name> <cstring>Line5</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> </widget> </grid> </widget> <customwidgets> <customwidget> <class>QWidget</class> <header location="local">qwidget.h</header> <sizehint> <width>100</width> <height>100</height> </sizehint> <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>7</verdata> </sizepolicy> <pixmap>image0</pixmap> </customwidget> </customwidgets> <images> <image> <name>image0</name> <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> </image> </images> -<connections> -</connections> +<tabstops> + <tabstop>startButton</tabstop> + <tabstop>stopButton</tabstop> + <tabstop>refreshButton</tabstop> + <tabstop>restartButton</tabstop> + <tabstop>advancedButton</tabstop> +</tabstops> </UI> diff --git a/noncore/net/networksetup/interfacesetup.ui b/noncore/net/networksetup/interfacesetup.ui index d367608..3db9a0b 100644 --- a/noncore/net/networksetup/interfacesetup.ui +++ b/noncore/net/networksetup/interfacesetup.ui @@ -1,110 +1,110 @@ <!DOCTYPE UI><UI> <class>InterfaceSetup</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>InterfaceSetup</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>271</width> + <width>267</width> <height>280</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Interface Configuration</string> </property> <vbox> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>autoStart</cstring> </property> <property stdset="1"> <name>text</name> <string>Automaticly bring up</string> </property> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout8</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel1</cstring> </property> <property stdset="1"> <name>text</name> <string>Profile</string> </property> </widget> <widget> <class>QComboBox</class> <item> <property> <name>text</name> <string>All</string> </property> </item> <property stdset="1"> <name>name</name> <cstring>profileCombo</cstring> </property> </widget> <spacer> <property> <name>name</name> <cstring>Spacer20</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> </hbox> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout9</cstring> </property> <hbox> @@ -240,97 +240,108 @@ <widget row="3" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel2</cstring> </property> <property stdset="1"> <name>text</name> <string>First DNS</string> </property> </widget> <widget row="4" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>secondDNSLineEdit</cstring> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel4</cstring> </property> <property stdset="1"> <name>text</name> <string>IP Address</string> </property> </widget> <widget row="2" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel1_2</cstring> </property> <property stdset="1"> <name>text</name> <string>Gateway</string> </property> </widget> <widget row="4" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel3</cstring> </property> <property stdset="1"> <name>text</name> <string>Second DNS</string> </property> </widget> </grid> </widget> <spacer> <property> <name>name</name> <cstring>Spacer9</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> </vbox> </widget> <connections> <connection> <sender>dhcpCheckBox</sender> <signal>toggled(bool)</signal> <receiver>leaseHoursLabel</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>dhcpCheckBox</sender> <signal>toggled(bool)</signal> <receiver>leaseTime</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>dhcpCheckBox</sender> <signal>toggled(bool)</signal> <receiver>staticGroupBox</receiver> <slot>setDisabled(bool)</slot> </connection> </connections> +<tabstops> + <tabstop>autoStart</tabstop> + <tabstop>profileCombo</tabstop> + <tabstop>dhcpCheckBox</tabstop> + <tabstop>leaseTime</tabstop> + <tabstop>ipAddressEdit</tabstop> + <tabstop>subnetMaskEdit</tabstop> + <tabstop>gatewayEdit</tabstop> + <tabstop>firstDNSLineEdit</tabstop> + <tabstop>secondDNSLineEdit</tabstop> +</tabstops> </UI> diff --git a/noncore/net/networksetup/mainwindow.ui b/noncore/net/networksetup/mainwindow.ui index 3538aeb..bea999b 100644 --- a/noncore/net/networksetup/mainwindow.ui +++ b/noncore/net/networksetup/mainwindow.ui @@ -1,110 +1,110 @@ <!DOCTYPE UI><UI> <class>MainWindow</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>MainWindow</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>217</width> + <width>230</width> <height>289</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Network Setup</string> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>tabWidget</cstring> </property> <property> <name>layoutMargin</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>Widget3</cstring> </property> <attribute> <name>title</name> <string>Connections</string> </attribute> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QListView</class> <column> <property> <name>text</name> <string>i</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <column> <property> <name>text</name> <string>t</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <column> <property> <name>text</name> <string>Name</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <column> <property> <name>text</name> <string>IP</string> </property> <property> <name>clickable</name> <bool>true</bool> @@ -115,258 +115,321 @@ </property> </column> <property stdset="1"> <name>name</name> <cstring>connectionList</cstring> </property> <property stdset="1"> <name>allColumnsShowFocus</name> <bool>true</bool> </property> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout2</cstring> </property> <property> <name>layoutMargin</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>5</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>addConnectionButton</cstring> </property> <property stdset="1"> <name>text</name> <string>&Add</string> </property> </widget> <widget row="0" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>informationConnectionButton</cstring> </property> <property stdset="1"> <name>text</name> <string>&Information</string> </property> </widget> <widget row="0" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>configureConnectionButton</cstring> </property> <property stdset="1"> <name>text</name> <string>&Configure</string> </property> </widget> <widget row="1" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>removeConnectionButton</cstring> </property> <property stdset="1"> <name>text</name> <string>&Remove</string> </property> </widget> </grid> </widget> </vbox> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Profiles</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> - <widget row="1" column="0" rowspan="1" colspan="3" > - <class>Line</class> - <property stdset="1"> + <spacer row="7" column="2" > + <property> <name>name</name> - <cstring>Line1</cstring> + <cstring>Spacer16</cstring> </property> <property stdset="1"> <name>orientation</name> - <enum>Horizontal</enum> + <enum>Vertical</enum> </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> + <name>sizeType</name> + <enum>Expanding</enum> </property> - <property stdset="1"> - <name>text</name> - <string>Current Profile</string> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> </property> - </widget> + </spacer> <widget row="0" column="1" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>currentProfileLabel</cstring> </property> <property stdset="1"> <name>frameShape</name> <enum>Panel</enum> </property> <property stdset="1"> <name>frameShadow</name> <enum>Sunken</enum> </property> <property stdset="1"> <name>text</name> <string>All</string> </property> </widget> - <spacer row="0" column="2" > - <property> + <widget row="3" column="2" > + <class>QPushButton</class> + <property stdset="1"> <name>name</name> - <cstring>Spacer2</cstring> + <cstring>setCurrentProfileButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>&Set Current</string> + </property> + </widget> + <widget row="5" column="0" rowspan="1" colspan="3" > + <class>Line</class> + <property stdset="1"> + <name>name</name> + <cstring>Line6</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> + </widget> + <widget row="1" column="0" rowspan="1" colspan="3" > + <class>Line</class> <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> + <name>name</name> + <cstring>Line1</cstring> </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> + <property stdset="1"> + <name>orientation</name> + <enum>Horizontal</enum> </property> - </spacer> - <spacer row="6" column="2" > + </widget> + <widget row="0" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Current Profile</string> + </property> + </widget> + <widget row="4" column="2" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>removeProfileButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>&Remove</string> + </property> + </widget> + <widget row="3" column="0" rowspan="2" colspan="2" > + <class>QListBox</class> + <property stdset="1"> + <name>name</name> + <cstring>profilesList</cstring> + </property> + </widget> + <spacer row="0" column="2" > <property> <name>name</name> - <cstring>Spacer16</cstring> + <cstring>Spacer2</cstring> </property> <property stdset="1"> <name>orientation</name> - <enum>Vertical</enum> + <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> - <widget row="5" column="2" > - <class>QPushButton</class> + <widget row="2" column="0" > + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>PushButton7</cstring> + <cstring>TextLabel1_2</cstring> </property> <property stdset="1"> <name>text</name> - <string>&Set Current</string> + <string>Profiles</string> </property> </widget> - <widget row="4" column="2" > - <class>QPushButton</class> + <widget row="6" column="0" rowspan="1" colspan="3" > + <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>removeProfileButton</cstring> + <cstring>Layout6</cstring> </property> + <hbox> <property stdset="1"> - <name>text</name> - <string>&Remove</string> + <name>margin</name> + <number>0</number> </property> - </widget> - <widget row="3" column="2" > - <class>QPushButton</class> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>newProfileButton</cstring> + <cstring>TextLabel1_3</cstring> </property> <property stdset="1"> <name>text</name> - <string>&New</string> + <string>New Profile</string> </property> </widget> - <widget row="2" column="0" > - <class>QLabel</class> + <widget> + <class>QLineEdit</class> <property stdset="1"> <name>name</name> - <cstring>TextLabel1_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Profiles</string> + <cstring>newProfile</cstring> </property> </widget> - <widget row="3" column="0" rowspan="3" colspan="2" > - <class>QListBox</class> + <widget> + <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>profilesList</cstring> + <cstring>newProfileButton</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>text</name> + <string>&Add</string> </property> </widget> + </hbox> + </widget> </grid> </widget> </widget> </vbox> </widget> <customwidgets> <customwidget> <class>QWidget</class> <header location="local">qwidget.h</header> <sizehint> <width>100</width> <height>100</height> </sizehint> <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>7</verdata> </sizepolicy> <pixmap>image0</pixmap> </customwidget> </customwidgets> <images> <image> <name>image0</name> <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> </image> </images> +<tabstops> + <tabstop>tabWidget</tabstop> + <tabstop>connectionList</tabstop> + <tabstop>informationConnectionButton</tabstop> + <tabstop>configureConnectionButton</tabstop> + <tabstop>addConnectionButton</tabstop> + <tabstop>removeConnectionButton</tabstop> + <tabstop>profilesList</tabstop> + <tabstop>setCurrentProfileButton</tabstop> + <tabstop>removeProfileButton</tabstop> + <tabstop>newProfile</tabstop> + <tabstop>newProfileButton</tabstop> +</tabstops> </UI> diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index e9429e3..e895971 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp @@ -1,157 +1,159 @@ #include "mainwindowimp.h"
#include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
#include "module.h"
#include "kprocess.h"
-#include "namedialog.h"
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qlistbox.h>
+#include <qlineedit.h>
#include <qlistview.h>
#include <qheader.h>
#include <qlabel.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/resource.h>
#include <qlist.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#define TEMP_ALL "/tmp/ifconfig-a"
#define TEMP_UP "/tmp/ifconfig"
MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
- connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&)));
+ connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
+ connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
// Load connections.
loadModules(QDir::homeDirPath() + "/.networksetup/plugins");
getInterfaceList();
connectionList->header()->hide();
Config cfg("NetworkSetup");
profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
}
/**
* Deconstructor. Save profiles. Delete loaded libraries.
*/
MainWindowImp::~MainWindowImp(){
// Save profiles.
if(profiles.count() > 1){
Config cfg("NetworkSetup");
+ cfg.setGroup("General");
cfg.writeEntry("Profiles", profiles.join(" "));
}
// Delete Modules and Libraries
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it ){
delete it.key();
delete it.data();
}
}
/**
* Load all modules that are found in the path
* @param path a directory that is scaned for any plugins that can be loaded
* and attempts to load them
*/
void MainWindowImp::loadModules(QString path){
qDebug(path.latin1());
QDir d(path);
if(!d.exists())
return;
// Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) ) {
if(fi->fileName().contains(".so")){
loadPlugin(path + "/" + fi->fileName());
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer ){
qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
delete lib;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == NULL){
qDebug("MainWindowImp: Couldn't create object, but did load library!");
delete lib;
return NULL;
}
// Store for deletion later
libraries.insert(object, lib);
return object;
}
/**
* The Add button was clicked. Bring up the add dialog and if OK is hit
* load the plugin and append it to the list
*/
void MainWindowImp::addClicked(){
QMap<Module*, QLibrary*>::Iterator it;
QMap<QString, QString> list;
QMap<QString, Module*> newInterfaceOwners;
list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()){
(it.key())->possibleNewInterfaces(list);
}
}
// See if the list has anything that we can add.
if(list.count() == 0){
QMessageBox::information(this, "Sorry", "Nothing to add.", "Ok");
return;
}
AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
addNewConnection.addConnections(list);
addNewConnection.showMaximized();
if(QDialog::Accepted == addNewConnection.exec()){
QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
if(!item)
return;
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()){
Interface *i = (it.key())->addNewInterface(item->text(0));
if(i){
interfaceNames.insert(i->getInterfaceName(), i);
@@ -279,144 +281,147 @@ void MainWindowImp::jobDone(KProcess *process){ threads.remove(process);
delete process;
QFile file(fileName);
if (!file.open(IO_ReadOnly)){
qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1());
return;
}
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
line = stream.readLine();
int space = line.find(" ");
if(space > 1){
// We have found an interface
QString interfaceName = line.mid(0, space);
if(!advancedUserMode){
if(interfaceName == "lo")
break;
}
Interface *i;
// See if we already have it
if(interfaceNames.find(interfaceName) == interfaceNames.end()){
if(fileName == TEMP_ALL)
i = new Interface(interfaceName, false);
else
i = new Interface(interfaceName, true);
}
else{
i = interfaceNames[interfaceName];
if(fileName != TEMP_ALL)
i->setStatus(true);
}
i->setAttached(true);
i->setInterfaceName(interfaceName);
QString hardName = "Ethernet";
int hardwareName = line.find("Link encap:");
int macAddress = line.find("HWaddr");
if(macAddress == -1)
macAddress = line.length();
if(hardwareName != -1)
i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName()));
// We have found an interface
//qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1());
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
}
}
file.close();
QFile::remove(fileName);
}
/**
* Update this interface. If no QListViewItem exists create one.
* @param Interface* pointer to the interface that needs to be updated.
*/
void MainWindowImp::updateInterface(Interface *i){
QListViewItem *item = NULL;
// Find the interface, making it if needed.
if(items.find(i) == items.end()){
item = new QListViewItem(connectionList, "", "", "");
// See if you can't find a module owner for this interface
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()->isOwner(i))
i->setModuleOwner(it.key());
}
items.insert(i, item);
interfaceItems.insert(item, i);
}
else
item = items[i];
// Update the icons and information
item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down")));
QString typeName = "lan";
if(i->getHardwareName().contains("Local Loopback"))
typeName = "lo";
if(i->getInterfaceName().contains("irda"))
typeName = "irda";
if(i->getInterfaceName().contains("wlan"))
typeName = "wlan";
// Actually try to use the Module
if(i->getModuleOwner() != NULL)
typeName = i->getModuleOwner()->getPixmapName(i);
item->setPixmap(1, (Resource::loadPixmap(typeName)));
item->setText(2, i->getHardwareName());
item->setText(3, (i->getStatus()) ? i->getIp() : QString(""));
}
+void MainWindowImp::newProfileChanged(const QString& newText){
+ if(newText.length() > 0)
+ newProfileButton->setEnabled(true);
+ else
+ newProfileButton->setEnabled(false);
+}
+
/**
* Adds a new profile to the list of profiles.
* Don't add profiles that already exists.
* Appends to the list and QStringList
*/
void MainWindowImp::addProfile(){
- NameDialog foo(this, "namedialog", true);
- QString newProfileName = foo.go();
- if(newProfileName.length() == 0)
- return;
-
+ QString newProfileName = newProfile->text();
if(profiles.grep(newProfileName).count() > 0){
QMessageBox::information(this, "Can't Add","Profile already exists.", "Ok");
return;
}
profiles.append(newProfileName);
profilesList->insertItem(newProfileName);
}
/**
* Removes the currently selected profile in the combo.
* Doesn't delete if there are less then 2 profiles.
*/
void MainWindowImp::removeProfile(){
if(profilesList->count() <= 1){
QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok");
return;
}
QString profileToRemove = profilesList->currentText();
if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){
profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
profilesList->clear();
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
}
}
/**
* A new profile has been selected, change.
* @param newProfile the new profile.
*/
-void MainWindowImp::changeProfile(const QString& newProfile){
- currentProfileLabel->setText(newProfile);
+void MainWindowImp::changeProfile(){
+ currentProfileLabel->setText(profilesList->text(profilesList->currentItem()));
}
// mainwindowimp.cpp
diff --git a/noncore/net/networksetup/mainwindowimp.h b/noncore/net/networksetup/mainwindowimp.h index 629b758..c67c161 100644 --- a/noncore/net/networksetup/mainwindowimp.h +++ b/noncore/net/networksetup/mainwindowimp.h @@ -1,57 +1,58 @@ #ifndef MAINWINOWIMP_H
#define MAINWINOWIMP_H
#include "mainwindow.h"
#include <qmap.h>
#include <qstringlist.h>
class Module;
class Interface;
class QLibrary;
class KProcess;
class MainWindowImp : public MainWindow {
Q_OBJECT
public:
MainWindowImp(QWidget *parent=0, const char *name=0);
~MainWindowImp();
private slots:
void addClicked();
void removeClicked();
void configureClicked();
void informationClicked();
void jobDone(KProcess *process);
void getInterfaceList();
void addProfile();
void removeProfile();
- void changeProfile(const QString&);
+ void changeProfile();
void updateInterface(Interface *i);
+ void newProfileChanged(const QString& newText);
private:
void loadModules(QString path);
Module* loadPlugin(QString pluginFileName,
QString resolveString = "create_plugin");
// For our local list of names
QMap<QString, Interface*> interfaceNames;
QMap<Module*, QLibrary*> libraries;
QMap<Interface*, QListViewItem*> items;
QMap<QListViewItem*, Interface*> interfaceItems;
QMap<KProcess*, QString> threads;
QStringList profiles;
bool advancedUserMode;
};
#endif
// mainwindowimp.h
diff --git a/noncore/net/networksetup/namedialog.cpp b/noncore/net/networksetup/namedialog.cpp deleted file mode 100644 index c5efa37..0000000 --- a/noncore/net/networksetup/namedialog.cpp +++ b/dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'namedialog.ui' -** -** Created: Sat Dec 15 04:36:20 2001 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#include "namedialog.h" - -#include <qlineedit.h> -#include <qpushbutton.h> -#include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> - -/* - * Constructs a NameDialog which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - * - * The dialog will by default be modeless, unless you set 'modal' to - * TRUE to construct a modal dialog. - */ -NameDialog::NameDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) - : QDialog( parent, name, modal, fl ) -{ - if ( !name ) - setName( "NameDialog" ); - resize( 176, 65 ); - setCaption( tr( "Enter A Name" ) ); - NameDialogLayout = new QGridLayout( this ); - NameDialogLayout->setSpacing( 6 ); - NameDialogLayout->setMargin( 5 ); - - Name = new QLineEdit( this, "Name" ); - - NameDialogLayout->addMultiCellWidget( Name, 0, 0, 0, 1 ); - - cancel = new QPushButton( this, "Cancel" ); - cancel->setText( tr( "&Cancel" ) ); - - NameDialogLayout->addWidget( cancel, 1, 1 ); - - ok = new QPushButton( this, "ok" ); - ok->setText( tr( "&Ok" ) ); - - NameDialogLayout->addWidget( ok, 1, 0 ); - - connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( Name, SIGNAL(returnPressed () ), this, SLOT(accept() ) ); -} - -QString NameDialog::go(){ - if( exec() ) //pressed OK - return (Name->text()); - else //pressed cancel - return QString(); -} - diff --git a/noncore/net/networksetup/namedialog.h b/noncore/net/networksetup/namedialog.h deleted file mode 100644 index 4c4e149..0000000 --- a/noncore/net/networksetup/namedialog.h +++ b/dev/null @@ -1,36 +0,0 @@ -/**************************************************************************** -** Form interface generated from reading ui file 'namedialog.ui' -** -** Created: Sat Dec 15 04:36:14 2001 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#ifndef NAMEDIALOG_H -#define NAMEDIALOG_H - -#include <qvariant.h> -#include <qdialog.h> -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QLineEdit; -class QPushButton; - -class NameDialog : public QDialog -{ - Q_OBJECT - -public: - NameDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - - QLineEdit* Name; - QPushButton* cancel; - QPushButton* ok; - QString go(); - -protected: - QGridLayout* NameDialogLayout; -}; - -#endif // NAMEDIALOG_H diff --git a/noncore/net/networksetup/networksetup.pro b/noncore/net/networksetup/networksetup.pro index e146eb4..ba70180 100644 --- a/noncore/net/networksetup/networksetup.pro +++ b/noncore/net/networksetup/networksetup.pro @@ -1,10 +1,10 @@ TEMPLATE = app #CONFIG = qt warn_on debug CONFIG = qt warn_on release -HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h namedialog.h -SOURCES = main.cpp namedialog.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp +HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h +SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp #INCLUDEPATH += $(QPEDIR)/include #DEPENDPATH += $(QPEDIR)/include LIBS += -lqpe INTERFACES = mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui TARGET = networksetup diff --git a/noncore/net/networksetup/systemadvanced.ui b/noncore/net/networksetup/systemadvanced.ui index 6ea192c..cd7ac61 100644 --- a/noncore/net/networksetup/systemadvanced.ui +++ b/noncore/net/networksetup/systemadvanced.ui @@ -1,110 +1,110 @@ <!DOCTYPE UI><UI> <class>SystemNetworking</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>SystemNetworking</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>222</width> + <width>218</width> <height>289</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>System Networking</string> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>tabWidget</cstring> </property> <property> <name>layoutMargin</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>DNS</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel6</cstring> </property> <property stdset="1"> <name>text</name> <string>Hostname</string> </property> </widget> <widget row="1" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel5</cstring> </property> <property stdset="1"> <name>text</name> <string>DNS</string> </property> <property stdset="1"> <name>alignment</name> <set>AlignTop|AlignLeft</set> </property> <property> <name>vAlign</name> </property> </widget> <widget row="1" column="1" > <class>QListBox</class> <property stdset="1"> <name>name</name> <cstring>ListBox5</cstring> </property> </widget> <widget row="0" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>LineEdit7</cstring> </property> </widget> <widget row="3" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel7</cstring> </property> <property stdset="1"> <name>text</name> <string>Hosts</string> @@ -300,144 +300,97 @@ </property> </column> <item> <property> <name>text</name> <string>192.168.1.0</string> </property> <property> <name>text</name> <string>*</string> </property> <property> <name>text</name> <string>255.255.255.0</string> </property> <property> <name>text</name> <string>U</string> </property> <property> <name>text</name> <string>0</string> </property> <property> <name>text</name> <string>0</string> </property> <property> <name>text</name> <string>0</string> </property> <property> <name>text</name> <string>eth0</string> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> </item> <property stdset="1"> <name>name</name> <cstring>ListView4</cstring> </property> </widget> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton17</cstring> </property> <property stdset="1"> <name>text</name> <string>&Add</string> </property> </widget> <widget row="1" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton18</cstring> </property> <property stdset="1"> <name>text</name> <string>Remove</string> </property> </widget> <spacer row="2" column="1" > - <property> - <name>name</name> - <cstring>Spacer15</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </grid> - </widget> - </widget> - </vbox> -</widget> -<customwidgets> - <customwidget> - <class>QWidget</class> - <header location="local">qwidget.h</header> - <sizehint> - <width>100</width> - <height>100</height> - </sizehint> - <container>0</container> - <sizepolicy> - <hordata>7</hordata> - <verdata>7</verdata> - </sizepolicy> - <pixmap>image0</pixmap> - </customwidget> -</customwidgets> -<images> - <image> - <name>image0</name> - <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> - </image> -</images> -</UI> +
\ No newline at end of file diff --git a/noncore/settings/networksettings/interfaceinformation.ui b/noncore/settings/networksettings/interfaceinformation.ui index 8b6280d..76af19c 100644 --- a/noncore/settings/networksettings/interfaceinformation.ui +++ b/noncore/settings/networksettings/interfaceinformation.ui @@ -1,110 +1,110 @@ <!DOCTYPE UI><UI> <class>InterfaceInformation</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>InterfaceInformation</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>203</width> + <width>199</width> <height>244</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Interface Information</string> </property> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="4" column="0" rowspan="1" colspan="2" > <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout1</cstring> </property> <grid> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>refreshButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Refresh</string> </property> </widget> <widget row="0" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>stopButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Stop</string> </property> </widget> <widget row="1" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>restartButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Restart</string> </property> </widget> <widget row="0" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>startButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Start</string> </property> </widget> </grid> </widget> <widget row="0" column="0" > <class>Line</class> <property stdset="1"> <name>name</name> <cstring>Line1</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel22</cstring> </property> <property stdset="1"> <name>text</name> @@ -240,99 +240,104 @@ <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget row="6" column="0" rowspan="1" colspan="2" > <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout2</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <spacer> <property> <name>name</name> <cstring>Spacer10</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>advancedButton</cstring> </property> <property stdset="1"> <name>text</name> <string>View Advanced Information</string> </property> </widget> </hbox> </widget> <widget row="5" column="0" rowspan="1" colspan="2" > <class>Line</class> <property stdset="1"> <name>name</name> <cstring>Line5</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> </widget> </grid> </widget> <customwidgets> <customwidget> <class>QWidget</class> <header location="local">qwidget.h</header> <sizehint> <width>100</width> <height>100</height> </sizehint> <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>7</verdata> </sizepolicy> <pixmap>image0</pixmap> </customwidget> </customwidgets> <images> <image> <name>image0</name> <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> </image> </images> -<connections> -</connections> +<tabstops> + <tabstop>startButton</tabstop> + <tabstop>stopButton</tabstop> + <tabstop>refreshButton</tabstop> + <tabstop>restartButton</tabstop> + <tabstop>advancedButton</tabstop> +</tabstops> </UI> diff --git a/noncore/settings/networksettings/interfacesetup.ui b/noncore/settings/networksettings/interfacesetup.ui index d367608..3db9a0b 100644 --- a/noncore/settings/networksettings/interfacesetup.ui +++ b/noncore/settings/networksettings/interfacesetup.ui @@ -1,110 +1,110 @@ <!DOCTYPE UI><UI> <class>InterfaceSetup</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>InterfaceSetup</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>271</width> + <width>267</width> <height>280</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Interface Configuration</string> </property> <vbox> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>autoStart</cstring> </property> <property stdset="1"> <name>text</name> <string>Automaticly bring up</string> </property> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout8</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel1</cstring> </property> <property stdset="1"> <name>text</name> <string>Profile</string> </property> </widget> <widget> <class>QComboBox</class> <item> <property> <name>text</name> <string>All</string> </property> </item> <property stdset="1"> <name>name</name> <cstring>profileCombo</cstring> </property> </widget> <spacer> <property> <name>name</name> <cstring>Spacer20</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> </hbox> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout9</cstring> </property> <hbox> @@ -240,97 +240,108 @@ <widget row="3" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel2</cstring> </property> <property stdset="1"> <name>text</name> <string>First DNS</string> </property> </widget> <widget row="4" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>secondDNSLineEdit</cstring> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel4</cstring> </property> <property stdset="1"> <name>text</name> <string>IP Address</string> </property> </widget> <widget row="2" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel1_2</cstring> </property> <property stdset="1"> <name>text</name> <string>Gateway</string> </property> </widget> <widget row="4" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel3</cstring> </property> <property stdset="1"> <name>text</name> <string>Second DNS</string> </property> </widget> </grid> </widget> <spacer> <property> <name>name</name> <cstring>Spacer9</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> </vbox> </widget> <connections> <connection> <sender>dhcpCheckBox</sender> <signal>toggled(bool)</signal> <receiver>leaseHoursLabel</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>dhcpCheckBox</sender> <signal>toggled(bool)</signal> <receiver>leaseTime</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>dhcpCheckBox</sender> <signal>toggled(bool)</signal> <receiver>staticGroupBox</receiver> <slot>setDisabled(bool)</slot> </connection> </connections> +<tabstops> + <tabstop>autoStart</tabstop> + <tabstop>profileCombo</tabstop> + <tabstop>dhcpCheckBox</tabstop> + <tabstop>leaseTime</tabstop> + <tabstop>ipAddressEdit</tabstop> + <tabstop>subnetMaskEdit</tabstop> + <tabstop>gatewayEdit</tabstop> + <tabstop>firstDNSLineEdit</tabstop> + <tabstop>secondDNSLineEdit</tabstop> +</tabstops> </UI> diff --git a/noncore/settings/networksettings/mainwindow.ui b/noncore/settings/networksettings/mainwindow.ui index 3538aeb..bea999b 100644 --- a/noncore/settings/networksettings/mainwindow.ui +++ b/noncore/settings/networksettings/mainwindow.ui @@ -1,110 +1,110 @@ <!DOCTYPE UI><UI> <class>MainWindow</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>MainWindow</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>217</width> + <width>230</width> <height>289</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Network Setup</string> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>tabWidget</cstring> </property> <property> <name>layoutMargin</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>Widget3</cstring> </property> <attribute> <name>title</name> <string>Connections</string> </attribute> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QListView</class> <column> <property> <name>text</name> <string>i</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <column> <property> <name>text</name> <string>t</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <column> <property> <name>text</name> <string>Name</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <column> <property> <name>text</name> <string>IP</string> </property> <property> <name>clickable</name> <bool>true</bool> @@ -115,258 +115,321 @@ </property> </column> <property stdset="1"> <name>name</name> <cstring>connectionList</cstring> </property> <property stdset="1"> <name>allColumnsShowFocus</name> <bool>true</bool> </property> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout2</cstring> </property> <property> <name>layoutMargin</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>5</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>addConnectionButton</cstring> </property> <property stdset="1"> <name>text</name> <string>&Add</string> </property> </widget> <widget row="0" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>informationConnectionButton</cstring> </property> <property stdset="1"> <name>text</name> <string>&Information</string> </property> </widget> <widget row="0" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>configureConnectionButton</cstring> </property> <property stdset="1"> <name>text</name> <string>&Configure</string> </property> </widget> <widget row="1" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>removeConnectionButton</cstring> </property> <property stdset="1"> <name>text</name> <string>&Remove</string> </property> </widget> </grid> </widget> </vbox> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Profiles</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> - <widget row="1" column="0" rowspan="1" colspan="3" > - <class>Line</class> - <property stdset="1"> + <spacer row="7" column="2" > + <property> <name>name</name> - <cstring>Line1</cstring> + <cstring>Spacer16</cstring> </property> <property stdset="1"> <name>orientation</name> - <enum>Horizontal</enum> + <enum>Vertical</enum> </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> + <name>sizeType</name> + <enum>Expanding</enum> </property> - <property stdset="1"> - <name>text</name> - <string>Current Profile</string> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> </property> - </widget> + </spacer> <widget row="0" column="1" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>currentProfileLabel</cstring> </property> <property stdset="1"> <name>frameShape</name> <enum>Panel</enum> </property> <property stdset="1"> <name>frameShadow</name> <enum>Sunken</enum> </property> <property stdset="1"> <name>text</name> <string>All</string> </property> </widget> - <spacer row="0" column="2" > - <property> + <widget row="3" column="2" > + <class>QPushButton</class> + <property stdset="1"> <name>name</name> - <cstring>Spacer2</cstring> + <cstring>setCurrentProfileButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>&Set Current</string> + </property> + </widget> + <widget row="5" column="0" rowspan="1" colspan="3" > + <class>Line</class> + <property stdset="1"> + <name>name</name> + <cstring>Line6</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> + </widget> + <widget row="1" column="0" rowspan="1" colspan="3" > + <class>Line</class> <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> + <name>name</name> + <cstring>Line1</cstring> </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> + <property stdset="1"> + <name>orientation</name> + <enum>Horizontal</enum> </property> - </spacer> - <spacer row="6" column="2" > + </widget> + <widget row="0" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Current Profile</string> + </property> + </widget> + <widget row="4" column="2" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>removeProfileButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>&Remove</string> + </property> + </widget> + <widget row="3" column="0" rowspan="2" colspan="2" > + <class>QListBox</class> + <property stdset="1"> + <name>name</name> + <cstring>profilesList</cstring> + </property> + </widget> + <spacer row="0" column="2" > <property> <name>name</name> - <cstring>Spacer16</cstring> + <cstring>Spacer2</cstring> </property> <property stdset="1"> <name>orientation</name> - <enum>Vertical</enum> + <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> - <widget row="5" column="2" > - <class>QPushButton</class> + <widget row="2" column="0" > + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>PushButton7</cstring> + <cstring>TextLabel1_2</cstring> </property> <property stdset="1"> <name>text</name> - <string>&Set Current</string> + <string>Profiles</string> </property> </widget> - <widget row="4" column="2" > - <class>QPushButton</class> + <widget row="6" column="0" rowspan="1" colspan="3" > + <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>removeProfileButton</cstring> + <cstring>Layout6</cstring> </property> + <hbox> <property stdset="1"> - <name>text</name> - <string>&Remove</string> + <name>margin</name> + <number>0</number> </property> - </widget> - <widget row="3" column="2" > - <class>QPushButton</class> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>newProfileButton</cstring> + <cstring>TextLabel1_3</cstring> </property> <property stdset="1"> <name>text</name> - <string>&New</string> + <string>New Profile</string> </property> </widget> - <widget row="2" column="0" > - <class>QLabel</class> + <widget> + <class>QLineEdit</class> <property stdset="1"> <name>name</name> - <cstring>TextLabel1_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Profiles</string> + <cstring>newProfile</cstring> </property> </widget> - <widget row="3" column="0" rowspan="3" colspan="2" > - <class>QListBox</class> + <widget> + <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>profilesList</cstring> + <cstring>newProfileButton</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>text</name> + <string>&Add</string> </property> </widget> + </hbox> + </widget> </grid> </widget> </widget> </vbox> </widget> <customwidgets> <customwidget> <class>QWidget</class> <header location="local">qwidget.h</header> <sizehint> <width>100</width> <height>100</height> </sizehint> <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>7</verdata> </sizepolicy> <pixmap>image0</pixmap> </customwidget> </customwidgets> <images> <image> <name>image0</name> <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> </image> </images> +<tabstops> + <tabstop>tabWidget</tabstop> + <tabstop>connectionList</tabstop> + <tabstop>informationConnectionButton</tabstop> + <tabstop>configureConnectionButton</tabstop> + <tabstop>addConnectionButton</tabstop> + <tabstop>removeConnectionButton</tabstop> + <tabstop>profilesList</tabstop> + <tabstop>setCurrentProfileButton</tabstop> + <tabstop>removeProfileButton</tabstop> + <tabstop>newProfile</tabstop> + <tabstop>newProfileButton</tabstop> +</tabstops> </UI> diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index e9429e3..e895971 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp @@ -1,157 +1,159 @@ #include "mainwindowimp.h"
#include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
#include "module.h"
#include "kprocess.h"
-#include "namedialog.h"
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qlistbox.h>
+#include <qlineedit.h>
#include <qlistview.h>
#include <qheader.h>
#include <qlabel.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/resource.h>
#include <qlist.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#define TEMP_ALL "/tmp/ifconfig-a"
#define TEMP_UP "/tmp/ifconfig"
MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
- connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&)));
+ connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
+ connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
// Load connections.
loadModules(QDir::homeDirPath() + "/.networksetup/plugins");
getInterfaceList();
connectionList->header()->hide();
Config cfg("NetworkSetup");
profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
}
/**
* Deconstructor. Save profiles. Delete loaded libraries.
*/
MainWindowImp::~MainWindowImp(){
// Save profiles.
if(profiles.count() > 1){
Config cfg("NetworkSetup");
+ cfg.setGroup("General");
cfg.writeEntry("Profiles", profiles.join(" "));
}
// Delete Modules and Libraries
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it ){
delete it.key();
delete it.data();
}
}
/**
* Load all modules that are found in the path
* @param path a directory that is scaned for any plugins that can be loaded
* and attempts to load them
*/
void MainWindowImp::loadModules(QString path){
qDebug(path.latin1());
QDir d(path);
if(!d.exists())
return;
// Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) ) {
if(fi->fileName().contains(".so")){
loadPlugin(path + "/" + fi->fileName());
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer ){
qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
delete lib;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == NULL){
qDebug("MainWindowImp: Couldn't create object, but did load library!");
delete lib;
return NULL;
}
// Store for deletion later
libraries.insert(object, lib);
return object;
}
/**
* The Add button was clicked. Bring up the add dialog and if OK is hit
* load the plugin and append it to the list
*/
void MainWindowImp::addClicked(){
QMap<Module*, QLibrary*>::Iterator it;
QMap<QString, QString> list;
QMap<QString, Module*> newInterfaceOwners;
list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()){
(it.key())->possibleNewInterfaces(list);
}
}
// See if the list has anything that we can add.
if(list.count() == 0){
QMessageBox::information(this, "Sorry", "Nothing to add.", "Ok");
return;
}
AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
addNewConnection.addConnections(list);
addNewConnection.showMaximized();
if(QDialog::Accepted == addNewConnection.exec()){
QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
if(!item)
return;
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()){
Interface *i = (it.key())->addNewInterface(item->text(0));
if(i){
interfaceNames.insert(i->getInterfaceName(), i);
@@ -279,144 +281,147 @@ void MainWindowImp::jobDone(KProcess *process){ threads.remove(process);
delete process;
QFile file(fileName);
if (!file.open(IO_ReadOnly)){
qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1());
return;
}
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
line = stream.readLine();
int space = line.find(" ");
if(space > 1){
// We have found an interface
QString interfaceName = line.mid(0, space);
if(!advancedUserMode){
if(interfaceName == "lo")
break;
}
Interface *i;
// See if we already have it
if(interfaceNames.find(interfaceName) == interfaceNames.end()){
if(fileName == TEMP_ALL)
i = new Interface(interfaceName, false);
else
i = new Interface(interfaceName, true);
}
else{
i = interfaceNames[interfaceName];
if(fileName != TEMP_ALL)
i->setStatus(true);
}
i->setAttached(true);
i->setInterfaceName(interfaceName);
QString hardName = "Ethernet";
int hardwareName = line.find("Link encap:");
int macAddress = line.find("HWaddr");
if(macAddress == -1)
macAddress = line.length();
if(hardwareName != -1)
i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName()));
// We have found an interface
//qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1());
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
}
}
file.close();
QFile::remove(fileName);
}
/**
* Update this interface. If no QListViewItem exists create one.
* @param Interface* pointer to the interface that needs to be updated.
*/
void MainWindowImp::updateInterface(Interface *i){
QListViewItem *item = NULL;
// Find the interface, making it if needed.
if(items.find(i) == items.end()){
item = new QListViewItem(connectionList, "", "", "");
// See if you can't find a module owner for this interface
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()->isOwner(i))
i->setModuleOwner(it.key());
}
items.insert(i, item);
interfaceItems.insert(item, i);
}
else
item = items[i];
// Update the icons and information
item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down")));
QString typeName = "lan";
if(i->getHardwareName().contains("Local Loopback"))
typeName = "lo";
if(i->getInterfaceName().contains("irda"))
typeName = "irda";
if(i->getInterfaceName().contains("wlan"))
typeName = "wlan";
// Actually try to use the Module
if(i->getModuleOwner() != NULL)
typeName = i->getModuleOwner()->getPixmapName(i);
item->setPixmap(1, (Resource::loadPixmap(typeName)));
item->setText(2, i->getHardwareName());
item->setText(3, (i->getStatus()) ? i->getIp() : QString(""));
}
+void MainWindowImp::newProfileChanged(const QString& newText){
+ if(newText.length() > 0)
+ newProfileButton->setEnabled(true);
+ else
+ newProfileButton->setEnabled(false);
+}
+
/**
* Adds a new profile to the list of profiles.
* Don't add profiles that already exists.
* Appends to the list and QStringList
*/
void MainWindowImp::addProfile(){
- NameDialog foo(this, "namedialog", true);
- QString newProfileName = foo.go();
- if(newProfileName.length() == 0)
- return;
-
+ QString newProfileName = newProfile->text();
if(profiles.grep(newProfileName).count() > 0){
QMessageBox::information(this, "Can't Add","Profile already exists.", "Ok");
return;
}
profiles.append(newProfileName);
profilesList->insertItem(newProfileName);
}
/**
* Removes the currently selected profile in the combo.
* Doesn't delete if there are less then 2 profiles.
*/
void MainWindowImp::removeProfile(){
if(profilesList->count() <= 1){
QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok");
return;
}
QString profileToRemove = profilesList->currentText();
if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){
profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
profilesList->clear();
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
}
}
/**
* A new profile has been selected, change.
* @param newProfile the new profile.
*/
-void MainWindowImp::changeProfile(const QString& newProfile){
- currentProfileLabel->setText(newProfile);
+void MainWindowImp::changeProfile(){
+ currentProfileLabel->setText(profilesList->text(profilesList->currentItem()));
}
// mainwindowimp.cpp
diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h index 629b758..c67c161 100644 --- a/noncore/settings/networksettings/mainwindowimp.h +++ b/noncore/settings/networksettings/mainwindowimp.h @@ -1,57 +1,58 @@ #ifndef MAINWINOWIMP_H
#define MAINWINOWIMP_H
#include "mainwindow.h"
#include <qmap.h>
#include <qstringlist.h>
class Module;
class Interface;
class QLibrary;
class KProcess;
class MainWindowImp : public MainWindow {
Q_OBJECT
public:
MainWindowImp(QWidget *parent=0, const char *name=0);
~MainWindowImp();
private slots:
void addClicked();
void removeClicked();
void configureClicked();
void informationClicked();
void jobDone(KProcess *process);
void getInterfaceList();
void addProfile();
void removeProfile();
- void changeProfile(const QString&);
+ void changeProfile();
void updateInterface(Interface *i);
+ void newProfileChanged(const QString& newText);
private:
void loadModules(QString path);
Module* loadPlugin(QString pluginFileName,
QString resolveString = "create_plugin");
// For our local list of names
QMap<QString, Interface*> interfaceNames;
QMap<Module*, QLibrary*> libraries;
QMap<Interface*, QListViewItem*> items;
QMap<QListViewItem*, Interface*> interfaceItems;
QMap<KProcess*, QString> threads;
QStringList profiles;
bool advancedUserMode;
};
#endif
// mainwindowimp.h
diff --git a/noncore/settings/networksettings/namedialog.cpp b/noncore/settings/networksettings/namedialog.cpp deleted file mode 100644 index c5efa37..0000000 --- a/noncore/settings/networksettings/namedialog.cpp +++ b/dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'namedialog.ui' -** -** Created: Sat Dec 15 04:36:20 2001 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#include "namedialog.h" - -#include <qlineedit.h> -#include <qpushbutton.h> -#include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> - -/* - * Constructs a NameDialog which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - * - * The dialog will by default be modeless, unless you set 'modal' to - * TRUE to construct a modal dialog. - */ -NameDialog::NameDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) - : QDialog( parent, name, modal, fl ) -{ - if ( !name ) - setName( "NameDialog" ); - resize( 176, 65 ); - setCaption( tr( "Enter A Name" ) ); - NameDialogLayout = new QGridLayout( this ); - NameDialogLayout->setSpacing( 6 ); - NameDialogLayout->setMargin( 5 ); - - Name = new QLineEdit( this, "Name" ); - - NameDialogLayout->addMultiCellWidget( Name, 0, 0, 0, 1 ); - - cancel = new QPushButton( this, "Cancel" ); - cancel->setText( tr( "&Cancel" ) ); - - NameDialogLayout->addWidget( cancel, 1, 1 ); - - ok = new QPushButton( this, "ok" ); - ok->setText( tr( "&Ok" ) ); - - NameDialogLayout->addWidget( ok, 1, 0 ); - - connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( Name, SIGNAL(returnPressed () ), this, SLOT(accept() ) ); -} - -QString NameDialog::go(){ - if( exec() ) //pressed OK - return (Name->text()); - else //pressed cancel - return QString(); -} - diff --git a/noncore/settings/networksettings/namedialog.h b/noncore/settings/networksettings/namedialog.h deleted file mode 100644 index 4c4e149..0000000 --- a/noncore/settings/networksettings/namedialog.h +++ b/dev/null @@ -1,36 +0,0 @@ -/**************************************************************************** -** Form interface generated from reading ui file 'namedialog.ui' -** -** Created: Sat Dec 15 04:36:14 2001 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#ifndef NAMEDIALOG_H -#define NAMEDIALOG_H - -#include <qvariant.h> -#include <qdialog.h> -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QLineEdit; -class QPushButton; - -class NameDialog : public QDialog -{ - Q_OBJECT - -public: - NameDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - - QLineEdit* Name; - QPushButton* cancel; - QPushButton* ok; - QString go(); - -protected: - QGridLayout* NameDialogLayout; -}; - -#endif // NAMEDIALOG_H diff --git a/noncore/settings/networksettings/networksetup.pro b/noncore/settings/networksettings/networksetup.pro index e146eb4..ba70180 100644 --- a/noncore/settings/networksettings/networksetup.pro +++ b/noncore/settings/networksettings/networksetup.pro @@ -1,10 +1,10 @@ TEMPLATE = app #CONFIG = qt warn_on debug CONFIG = qt warn_on release -HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h namedialog.h -SOURCES = main.cpp namedialog.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp +HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h +SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp #INCLUDEPATH += $(QPEDIR)/include #DEPENDPATH += $(QPEDIR)/include LIBS += -lqpe INTERFACES = mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui TARGET = networksetup diff --git a/noncore/settings/networksettings/systemadvanced.ui b/noncore/settings/networksettings/systemadvanced.ui index 6ea192c..cd7ac61 100644 --- a/noncore/settings/networksettings/systemadvanced.ui +++ b/noncore/settings/networksettings/systemadvanced.ui @@ -1,110 +1,110 @@ <!DOCTYPE UI><UI> <class>SystemNetworking</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>SystemNetworking</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>222</width> + <width>218</width> <height>289</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>System Networking</string> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>tabWidget</cstring> </property> <property> <name>layoutMargin</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>DNS</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel6</cstring> </property> <property stdset="1"> <name>text</name> <string>Hostname</string> </property> </widget> <widget row="1" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel5</cstring> </property> <property stdset="1"> <name>text</name> <string>DNS</string> </property> <property stdset="1"> <name>alignment</name> <set>AlignTop|AlignLeft</set> </property> <property> <name>vAlign</name> </property> </widget> <widget row="1" column="1" > <class>QListBox</class> <property stdset="1"> <name>name</name> <cstring>ListBox5</cstring> </property> </widget> <widget row="0" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>LineEdit7</cstring> </property> </widget> <widget row="3" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel7</cstring> </property> <property stdset="1"> <name>text</name> <string>Hosts</string> @@ -300,144 +300,97 @@ </property> </column> <item> <property> <name>text</name> <string>192.168.1.0</string> </property> <property> <name>text</name> <string>*</string> </property> <property> <name>text</name> <string>255.255.255.0</string> </property> <property> <name>text</name> <string>U</string> </property> <property> <name>text</name> <string>0</string> </property> <property> <name>text</name> <string>0</string> </property> <property> <name>text</name> <string>0</string> </property> <property> <name>text</name> <string>eth0</string> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> <property> <name>pixmap</name> <pixmap></pixmap> </property> </item> <property stdset="1"> <name>name</name> <cstring>ListView4</cstring> </property> </widget> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton17</cstring> </property> <property stdset="1"> <name>text</name> <string>&Add</string> </property> </widget> <widget row="1" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton18</cstring> </property> <property stdset="1"> <name>text</name> <string>Remove</string> </property> </widget> <spacer row="2" column="1" > - <property> - <name>name</name> - <cstring>Spacer15</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </grid> - </widget> - </widget> - </vbox> -</widget> -<customwidgets> - <customwidget> - <class>QWidget</class> - <header location="local">qwidget.h</header> - <sizehint> - <width>100</width> - <height>100</height> - </sizehint> - <container>0</container> - <sizepolicy> - <hordata>7</hordata> - <verdata>7</verdata> - </sizepolicy> - <pixmap>image0</pixmap> - </customwidget> -</customwidgets> -<images> - <image> - <name>image0</name> - <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> - </image> -</images> -</UI> +
\ No newline at end of file |