summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/mainwindowimp.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/mainwindowimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 843f630..9d81ab1 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -62,48 +62,55 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par
62 QFile file(scheme); 62 QFile file(scheme);
63 if ( file.open(IO_ReadOnly) ) { // file opened successfully 63 if ( file.open(IO_ReadOnly) ) { // file opened successfully
64 QTextStream stream( &file ); // use a text stream 64 QTextStream stream( &file ); // use a text stream
65 while ( !stream.eof() ) { // until end of file... 65 while ( !stream.eof() ) { // until end of file...
66 QString line = stream.readLine(); // line of text excluding '\n' 66 QString line = stream.readLine(); // line of text excluding '\n'
67 if(line.contains("SCHEME")){ 67 if(line.contains("SCHEME")){
68 line = line.mid(7, line.length()); 68 line = line.mid(7, line.length());
69 currentProfileLabel->setText(line); 69 currentProfileLabel->setText(line);
70 break; 70 break;
71 } 71 }
72 } 72 }
73 file.close(); 73 file.close();
74 } 74 }
75} 75}
76 76
77/** 77/**
78 * Deconstructor. Save profiles. Delete loaded libraries. 78 * Deconstructor. Save profiles. Delete loaded libraries.
79 */ 79 */
80MainWindowImp::~MainWindowImp(){ 80MainWindowImp::~MainWindowImp(){
81 // Save profiles. 81 // Save profiles.
82 Config cfg("NetworkSetup"); 82 Config cfg("NetworkSetup");
83 cfg.setGroup("General"); 83 cfg.setGroup("General");
84 cfg.writeEntry("Profiles", profiles.join(" ")); 84 cfg.writeEntry("Profiles", profiles.join(" "));
85 85
86 // Delete all interfaces that don't have owners.
87 QMap<Interface*, QListViewItem*>::Iterator iIt;
88 for( iIt = items.begin(); iIt != items.end(); ++iIt ){
89 if(iIt.key()->getModuleOwner() == NULL)
90 delete iIt.key();
91 }
92
86 // Delete Modules and Libraries 93 // Delete Modules and Libraries
87 QMap<Module*, QLibrary*>::Iterator it; 94 QMap<Module*, QLibrary*>::Iterator it;
88 for( it = libraries.begin(); it != libraries.end(); ++it ){ 95 for( it = libraries.begin(); it != libraries.end(); ++it ){
89 delete it.key(); 96 delete it.key();
90 delete it.data(); 97 delete it.data();
91 } 98 }
92} 99}
93 100
94/** 101/**
95 * Load all modules that are found in the path 102 * Load all modules that are found in the path
96 * @param path a directory that is scaned for any plugins that can be loaded 103 * @param path a directory that is scaned for any plugins that can be loaded
97 * and attempts to load them 104 * and attempts to load them
98 */ 105 */
99void MainWindowImp::loadModules(QString path){ 106void MainWindowImp::loadModules(QString path){
100 //qDebug(path.latin1()); 107 //qDebug(path.latin1());
101 QDir d(path); 108 QDir d(path);
102 if(!d.exists()) 109 if(!d.exists())
103 return; 110 return;
104 111
105 // Don't want sym links 112 // Don't want sym links
106 d.setFilter( QDir::Files | QDir::NoSymLinks ); 113 d.setFilter( QDir::Files | QDir::NoSymLinks );
107 const QFileInfoList *list = d.entryInfoList(); 114 const QFileInfoList *list = d.entryInfoList();
108 QFileInfoListIterator it( *list ); 115 QFileInfoListIterator it( *list );
109 QFileInfo *fi; 116 QFileInfo *fi;