summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/mainwindowimp.cpp
authorbenmeyer <benmeyer>2002-10-18 16:27:02 (UTC)
committer benmeyer <benmeyer>2002-10-18 16:27:02 (UTC)
commit12851a09a2761ca6e189f080e9ca69bf4974302f (patch) (side-by-side diff)
tree1b9a368fc5e424d4bf60f4c582b87b23a975c26a /noncore/settings/networksettings/mainwindowimp.cpp
parent47e60a8dc20f46dd00b9405f7fde122792018627 (diff)
downloadopie-12851a09a2761ca6e189f080e9ca69bf4974302f.zip
opie-12851a09a2761ca6e189f080e9ca69bf4974302f.tar.gz
opie-12851a09a2761ca6e189f080e9ca69bf4974302f.tar.bz2
Can now remove mapping and is done so automagicly when you delete a profile
Diffstat (limited to 'noncore/settings/networksettings/mainwindowimp.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 9f07f0d..01063c2 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -34,3 +34,4 @@
-#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){
@@ -58,4 +59,5 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par
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
@@ -97,3 +99,3 @@ MainWindowImp::~MainWindowImp(){
void MainWindowImp::loadModules(QString path){
- qDebug(path.latin1());
+ //qDebug(path.latin1());
QDir d(path);
@@ -122,3 +124,3 @@ 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);
@@ -492,6 +494,24 @@ void MainWindowImp::removeProfile(){
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;
+ }
+ }
+ }
}
@@ -510,4 +530,4 @@ void MainWindowImp::changeProfile(){
currentProfileLabel->setText(newProfile);
- QFile::remove(SCHEME);
- QFile file(SCHEME);
+ QFile::remove(scheme);
+ QFile file(scheme);
if ( file.open(IO_ReadWrite) ) {