summaryrefslogtreecommitdiff
path: root/noncore/net/networksetup/mainwindowimp.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/networksetup/mainwindowimp.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/networksetup/mainwindowimp.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp
index 9f07f0d..01063c2 100644
--- a/noncore/net/networksetup/mainwindowimp.cpp
+++ b/noncore/net/networksetup/mainwindowimp.cpp
@@ -33,5 +33,6 @@
#define TEMP_UP "/tmp/ifconfig"
-#define SCHEME "/var/lib/pcmcia/scheme"
+#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
+
MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
@@ -57,6 +58,7 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par
currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
+ scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
- QFile file(SCHEME);
+ QFile file(scheme);
if ( file.open(IO_ReadOnly) ) { // file opened successfully
QTextStream stream( &file ); // use a text stream
@@ -96,5 +98,5 @@ MainWindowImp::~MainWindowImp(){
*/
void MainWindowImp::loadModules(QString path){
- qDebug(path.latin1());
+ //qDebug(path.latin1());
QDir d(path);
if(!d.exists())
@@ -121,5 +123,5 @@ void MainWindowImp::loadModules(QString path){
*/
Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
- qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
+ //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
@@ -491,8 +493,26 @@ void MainWindowImp::removeProfile(){
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
- }
// Remove any interface settings and mappings.
- //TODO
+ Interfaces interfaces;
+ // Go through them one by one
+ QMap<Interface*, QListViewItem*>::Iterator it;
+ for( it = items.begin(); it != items.end(); ++it ){
+ QString interfaceName = it.key()->getInterfaceName();
+ qDebug(interfaceName.latin1());
+ if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){
+ interfaces.removeInterface();
+ if(interfaces.setMapping(interfaceName)){
+ if(profilesList->count() == 1)
+ interfaces.removeMapping();
+ else{
+ interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
+ }
+ }
+ interfaces.write();
+ break;
+ }
+ }
+ }
}
@@ -509,6 +529,6 @@ void MainWindowImp::changeProfile(){
if(newProfile != currentProfileLabel->text()){
currentProfileLabel->setText(newProfile);
- QFile::remove(SCHEME);
- QFile file(SCHEME);
+ QFile::remove(scheme);
+ QFile file(scheme);
if ( file.open(IO_ReadWrite) ) {
QTextStream stream( &file );