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 /noncore/settings/networksettings/mainwindowimp.cpp | |
parent | c997983c6917885f6c487b942a9b294fa50ae618 (diff) | |
download | opie-2d0c6327dd40ab6847ce055c40ca59893bc8b9b2.zip opie-2d0c6327dd40ab6847ce055c40ca59893bc8b9b2.tar.gz opie-2d0c6327dd40ab6847ce055c40ca59893bc8b9b2.tar.bz2 |
Fixes
Diffstat (limited to 'noncore/settings/networksettings/mainwindowimp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
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 @@ -2,17 +2,17 @@ #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>
@@ -34,14 +34,15 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par 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();
@@ -56,12 +57,13 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par * 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();
@@ -369,23 +371,26 @@ void MainWindowImp::updateInterface(Interface *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);
@@ -411,12 +416,12 @@ void MainWindowImp::removeProfile(){ }
/**
* 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
|