Diffstat (limited to 'noncore/settings/networksettings/mainwindowimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 9d81ab1..c86acdc 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -57,66 +57,68 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par | |||
57 | profilesList->insertItem((*it)); | 57 | profilesList->insertItem((*it)); |
58 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); | 58 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); |
59 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); | 59 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); |
60 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); | 60 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); |
61 | 61 | ||
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 | */ |
80 | MainWindowImp::~MainWindowImp(){ | 80 | MainWindowImp::~MainWindowImp(){ |
81 | qDebug("start Saving mainwindow"); | ||
81 | // Save profiles. | 82 | // Save profiles. |
82 | Config cfg("NetworkSetup"); | 83 | Config cfg("NetworkSetup"); |
83 | cfg.setGroup("General"); | 84 | cfg.setGroup("General"); |
84 | cfg.writeEntry("Profiles", profiles.join(" ")); | 85 | cfg.writeEntry("Profiles", profiles.join(" ")); |
85 | 86 | ||
86 | // Delete all interfaces that don't have owners. | 87 | // Delete all interfaces that don't have owners. |
87 | QMap<Interface*, QListViewItem*>::Iterator iIt; | 88 | QMap<Interface*, QListViewItem*>::Iterator iIt; |
88 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ | 89 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ |
89 | if(iIt.key()->getModuleOwner() == NULL) | 90 | if(iIt.key()->getModuleOwner() == NULL) |
90 | delete iIt.key(); | 91 | delete iIt.key(); |
91 | } | 92 | } |
92 | 93 | ||
93 | // Delete Modules and Libraries | 94 | // Delete Modules and Libraries |
94 | QMap<Module*, QLibrary*>::Iterator it; | 95 | QMap<Module*, QLibrary*>::Iterator it; |
95 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 96 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
96 | delete it.key(); | 97 | delete it.key(); |
97 | delete it.data(); | 98 | delete it.data(); |
98 | } | 99 | } |
100 | qDebug("done Saving mainwindow"); | ||
99 | } | 101 | } |
100 | 102 | ||
101 | /** | 103 | /** |
102 | * Load all modules that are found in the path | 104 | * Load all modules that are found in the path |
103 | * @param path a directory that is scaned for any plugins that can be loaded | 105 | * @param path a directory that is scaned for any plugins that can be loaded |
104 | * and attempts to load them | 106 | * and attempts to load them |
105 | */ | 107 | */ |
106 | void MainWindowImp::loadModules(QString path){ | 108 | void MainWindowImp::loadModules(QString path){ |
107 | //qDebug(path.latin1()); | 109 | //qDebug(path.latin1()); |
108 | QDir d(path); | 110 | QDir d(path); |
109 | if(!d.exists()) | 111 | if(!d.exists()) |
110 | return; | 112 | return; |
111 | 113 | ||
112 | // Don't want sym links | 114 | // Don't want sym links |
113 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 115 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
114 | const QFileInfoList *list = d.entryInfoList(); | 116 | const QFileInfoList *list = d.entryInfoList(); |
115 | QFileInfoListIterator it( *list ); | 117 | QFileInfoListIterator it( *list ); |
116 | QFileInfo *fi; | 118 | QFileInfo *fi; |
117 | while ( (fi=it.current()) ) { | 119 | while ( (fi=it.current()) ) { |
118 | if(fi->fileName().contains(".so")){ | 120 | if(fi->fileName().contains(".so")){ |
119 | loadPlugin(path + "/" + fi->fileName()); | 121 | loadPlugin(path + "/" + fi->fileName()); |
120 | } | 122 | } |
121 | ++it; | 123 | ++it; |
122 | } | 124 | } |