author | tille <tille> | 2003-06-03 14:13:19 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-03 14:13:19 (UTC) |
commit | f80c2829f8660402df7a6d5667d6022f366cd44b (patch) (side-by-side diff) | |
tree | f211e10a847f454e2607700337b8d5d64a867afc | |
parent | 60d9f66d2b31c659ac652c15423ecaca89a5f312 (diff) | |
download | opie-f80c2829f8660402df7a6d5667d6022f366cd44b.zip opie-f80c2829f8660402df7a6d5667d6022f366cd44b.tar.gz opie-f80c2829f8660402df7a6d5667d6022f366cd44b.tar.bz2 |
changed maintainer to tille
3 files changed, 7 insertions, 3 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfacesetup.ui b/noncore/settings/networksettings/interfaces/interfacesetup.ui index efcab8b..fa2db40 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetup.ui +++ b/noncore/settings/networksettings/interfaces/interfacesetup.ui @@ -1,220 +1,224 @@ <!DOCTYPE UI><UI> <class>InterfaceSetup</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>InterfaceSetup</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>286</width> + <width>282</width> <height>280</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Interface Configuration</string> </property> <vbox> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>autoStart</cstring> </property> <property stdset="1"> <name>text</name> <string>Automatically bring up</string> </property> </widget> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>dhcpCheckBox</cstring> </property> <property stdset="1"> <name>text</name> <string>DHCP</string> </property> <property stdset="1"> <name>checked</name> <bool>true</bool> </property> </widget> <widget> <class>QGroupBox</class> <property stdset="1"> <name>name</name> <cstring>staticGroupBox</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>false</bool> </property> <property stdset="1"> <name>frameShape</name> <enum>Box</enum> </property> <property stdset="1"> <name>frameShadow</name> <enum>Sunken</enum> </property> <property stdset="1"> <name>title</name> <string>Static Ip Configuration</string> </property> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel5</cstring> </property> <property stdset="1"> <name>text</name> <string>Subnet Mask</string> </property> </widget> <widget row="2" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>gatewayEdit</cstring> </property> </widget> <widget row="1" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>subnetMaskEdit</cstring> </property> + <property stdset="1"> + <name>text</name> + <string>255.255.255.0</string> + </property> </widget> <widget row="0" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>ipAddressEdit</cstring> </property> </widget> <widget row="3" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel2</cstring> </property> <property stdset="1"> <name>text</name> <string>First DNS</string> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel4</cstring> </property> <property stdset="1"> <name>text</name> <string>IP Address</string> </property> </widget> <widget row="2" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel1_2</cstring> </property> <property stdset="1"> <name>text</name> <string>Gateway</string> </property> </widget> <widget row="4" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel3</cstring> </property> <property stdset="1"> <name>text</name> <string>Second DNS</string> </property> </widget> <widget row="3" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>firstDNSLineEdit</cstring> </property> </widget> <widget row="4" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>secondDNSLineEdit</cstring> </property> </widget> </grid> </widget> <spacer> <property> <name>name</name> <cstring>Spacer9</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> </vbox> </widget> <connections> <connection> <sender>dhcpCheckBox</sender> <signal>toggled(bool)</signal> <receiver>staticGroupBox</receiver> <slot>setDisabled(bool)</slot> </connection> </connections> <tabstops> <tabstop>autoStart</tabstop> <tabstop>dhcpCheckBox</tabstop> <tabstop>ipAddressEdit</tabstop> <tabstop>subnetMaskEdit</tabstop> <tabstop>gatewayEdit</tabstop> <tabstop>firstDNSLineEdit</tabstop> <tabstop>secondDNSLineEdit</tabstop> </tabstops> </UI> diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index a0b3113..4119490 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp @@ -306,321 +306,321 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & // Store for deletion later libraries.insert(object, lib); return object; #else QLibrary *lib = loader->library(pluginFileName); if( !lib || !lib->hasSymbol(resolveString) ){ qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); return NULL; } // Try to get an object. Module *object = ((Module* (*)()) lib->symbol(resolveString))(); if(object == NULL){ #ifdef DEBUG qDebug("MainWindowImp: Couldn't create object, but did load library!"); #endif return NULL; } #ifdef DEBUG qDebug("MainWindowImp::loadPlugin:: Found object, storing."); #endif // Store for deletion later libraries.insert(object, lib); return object; #endif } /** * The Add button was clicked. Bring up the add dialog and if OK is hit * load the plugin and append it to the list */ void MainWindowImp::addClicked(){ QMap<Module*, QLibrary*>::Iterator it; QMap<QString, QString> list; QMap<QString, Module*> newInterfaceOwners; for( it = libraries.begin(); it != libraries.end(); ++it ){ if(it.key()){ (it.key())->possibleNewInterfaces(list); } } // See if the list has anything that we can add. if(list.count() == 0){ QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok); return; } AddConnectionImp addNewConnection(this, "AddConnectionImp", true); addNewConnection.addConnections(list); addNewConnection.showMaximized(); if(QDialog::Accepted == addNewConnection.exec()){ QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); if(!item) 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, tr("Error"), tr("Unable to remove."), QMessageBox::Ok); else{ 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, 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); return; } Interface *i = interfaceItems[item]; // if(!i->isAttached()){ // QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); // return; // } if(i->getModuleOwner()){ QWidget *moduleInformation = i->getModuleOwner()->information(i); if(moduleInformation != NULL){ moduleInformation->showMaximized(); #ifdef DEBUG qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); #endif return; } } InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); information->showMaximized(); } /** * Update this interface. If no QListViewItem exists create one. * @param Interface* pointer to the interface that needs to be updated. */ void MainWindowImp::updateInterface(Interface *i){ if(!advancedUserMode){ if(i->getInterfaceName() == "lo") return; } QListViewItem *item = NULL; // Find the interface, making it if needed. if(items.find(i) == items.end()){ item = new QListViewItem(connectionList, "", "", ""); // See if you can't find a module owner for this interface QMap<Module*, QLibrary*>::Iterator it; for( it = libraries.begin(); it != libraries.end(); ++it ){ if(it.key()->isOwner(i)) i->setModuleOwner(it.key()); } items.insert(i, item); interfaceItems.insert(item, i); } else item = items[i]; // Update the icons and information #ifdef QWS item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); #else item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down"))); #endif QString typeName = "lan"; - if(i->getHardwareName().contains("Local Loopback")) + if(i->getInterfaceName() == "lo") typeName = "lo"; if(i->getInterfaceName().contains("irda")) typeName = "irda"; if(i->getInterfaceName().contains("wlan")) typeName = "wlan"; if(i->getInterfaceName().contains("usb")) typeName = "usb"; if(!i->isAttached()) typeName = "connect_no"; // Actually try to use the Module if(i->getModuleOwner() != NULL) typeName = i->getModuleOwner()->getPixmapName(i); #ifdef QWS item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); #else item->setPixmap(1, (SmallIcon(typeName))); #endif item->setText(2, i->getHardwareName()); item->setText(3, QString("(%1)").arg(i->getInterfaceName())); item->setText(4, (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(){ QString newProfileName = newProfile->text(); if(profiles.grep(newProfileName).count() > 0){ QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); return; } profiles.append(newProfileName); profilesList->insertItem(newProfileName); } /** * Removes the currently selected profile in the combo. * Doesn't delete if there are less then 2 profiles. */ void MainWindowImp::removeProfile(){ if(profilesList->count() <= 1){ QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok); return; } QString profileToRemove = profilesList->currentText(); if(profileToRemove == "All"){ QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok); return; } // Can't remove the curent profile if(profileToRemove == currentProfileLabel->text()){ QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok); return; } if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); profilesList->clear(); for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) profilesList->insertItem((*it)); // Remove any interface settings and mappings. 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; } } } } /** * A new profile has been selected, change. * @param newProfile the new profile. */ void MainWindowImp::changeProfile(){ if(profilesList->currentItem() == -1){ QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); return; } QString newProfile = profilesList->text(profilesList->currentItem()); if(newProfile != currentProfileLabel->text()){ currentProfileLabel->setText(newProfile); QFile::remove(scheme); QFile file(scheme); if ( file.open(IO_ReadWrite) ) { QTextStream stream( &file ); stream << QString("SCHEME=%1").arg(newProfile); file.close(); } // restart all up devices? if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ // Go through them one by one QMap<Interface*, QListViewItem*>::Iterator it; for( it = items.begin(); it != items.end(); ++it ){ if(it.key()->getStatus() == true) it.key()->restart(); } } } // TODO change the profile in the modules } diff --git a/noncore/settings/networksettings/opie-networksettings.control b/noncore/settings/networksettings/opie-networksettings.control index e2db92f..182615f 100644 --- a/noncore/settings/networksettings/opie-networksettings.control +++ b/noncore/settings/networksettings/opie-networksettings.control @@ -1,10 +1,10 @@ Package: opie-networksettings Files: bin/networksettings apps/Settings/networksettings.desktop plugins/networksettings/* pics/networksettings/* pics/Network/PPPConnect.png $OPIEDIR/lib/libinterfaces.so.1.0.0 $OPIEDIR/lib/libinterfaces.so.1.0 $OPIEDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile Priority: optional Section: opie/settings -Maintainer: Ben Meyer <meyerb@sharpsec.com> +Maintainer: Patrick S. Vogt <tille@handhelds.org> Architecture: arm Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal Description: Network settings. Replaces: opie-networksetup |