-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index abf5663..a0b3113 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp @@ -57,65 +57,65 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); //FIXME: disable profiles for the moment: tabWidget->setTabEnabled( tab, false ); // Load connections. // /usr/local/kde/lib/libinterfaces.la #ifdef QWS loadModules(QPEApplication::qpeDir() + "/plugins/networksettings"); #else loader = KLibLoader::self(); loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); #endif getAllInterfaces(); Interfaces i; QStringList list = i.getInterfaceList(); QMap<QString, Interface*>::Iterator it; for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { bool found = false; for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ if(it.key() == (*ni)) found = true; } if(!found){ if(!(*ni).contains("_")){ Interface *i = new Interface(this, *ni, false); i->setAttached(false); - i->setHardwareName("Disconnected"); + i->setHardwareName(tr("Disconnected")); interfaceNames.insert(i->getInterfaceName(), i); updateInterface(i); connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); } } } //getInterfaceList(); connectionList->header()->hide(); Config cfg("NetworkSetup"); profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) profilesList->insertItem((*it)); currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); QFile file(scheme); if ( file.open(IO_ReadOnly) ) { // file opened successfully QTextStream stream( &file ); // use a text stream while ( !stream.eof() ) { // until end of file... QString line = stream.readLine(); // line of text excluding '\n' if(line.contains("SCHEME")){ line = line.mid(7, line.length()); currentProfileLabel->setText(line); break; } } file.close(); } @@ -359,82 +359,81 @@ void MainWindowImp::addClicked(){ return; for( it = libraries.begin(); it != libraries.end(); ++it ){ if(it.key()){ Interface *i = (it.key())->addNewInterface(item->text(0)); if(i){ qDebug("iface name %s",i->getInterfaceName().latin1()); interfaceNames.insert(i->getInterfaceName(), i); updateInterface(i); } } } } } /** * Prompt the user to see if they really want to do this. * If they do then remove from the list and unload. */ void MainWindowImp::removeClicked(){ QListViewItem *item = connectionList->currentItem(); if(!item) { QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); return; } Interface *i = interfaceItems[item]; if(i->getModuleOwner() == NULL){ QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); } else{ if(!i->getModuleOwner()->remove(i)) - QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok); + QMessageBox::information(this, tr("Error"), tr("Unable to remove."), QMessageBox::Ok); else{ - QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); - // TODO memory managment.... - // who deletes the interface? + delete item; +// QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); } } } /** * Pull up the configure about the currently selected interface. * Report an error if no interface is selected. * If the interface has a module owner then request its configure. */ void MainWindowImp::configureClicked(){ QListViewItem *item = connectionList->currentItem(); if(!item){ - QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); + QMessageBox::information(this, tr("Sorry"),tr("Please select an interface first."), QMessageBox::Ok); return; } QString currentProfileText = currentProfileLabel->text(); if(currentProfileText.upper() == "ALL"); currentProfileText = ""; Interface *i = interfaceItems[item]; if(i->getModuleOwner()){ QWidget *moduleConfigure = i->getModuleOwner()->configure(i); if(moduleConfigure != NULL){ i->getModuleOwner()->setProfile(currentProfileText); moduleConfigure->showMaximized(); return; } } InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose ); configure->setProfile(currentProfileText); configure->showMaximized(); } /** * Pull up the information about the currently selected interface. * Report an error if no interface is selected. * If the interface has a module owner then request its configure. */ void MainWindowImp::informationClicked(){ QListViewItem *item = connectionList->currentItem(); if(!item){ QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |