summaryrefslogtreecommitdiff
authorbenmeyer <benmeyer>2002-10-18 18:31:02 (UTC)
committer benmeyer <benmeyer>2002-10-18 18:31:02 (UTC)
commit081001a515f23626b6299e39af4511f36db46d07 (patch) (side-by-side diff)
treeb27ce76464c60452c54c10dca9bcd95b34bd56a9
parent83a8418d4d4eb94a2cf0d8c89742aef2dfc3ed40 (diff)
downloadopie-081001a515f23626b6299e39af4511f36db46d07.zip
opie-081001a515f23626b6299e39af4511f36db46d07.tar.gz
opie-081001a515f23626b6299e39af4511f36db46d07.tar.bz2
Updated TODO
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/TODO13
-rw-r--r--noncore/net/networksetup/mainwindowimp.cpp8
-rw-r--r--noncore/settings/networksettings/TODO13
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp8
4 files changed, 26 insertions, 16 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO
index c587f58..7a71142 100644
--- a/noncore/net/networksetup/TODO
+++ b/noncore/net/networksetup/TODO
@@ -1,6 +1,11 @@
-Write a class that parses /proc and not ifconfig
WLAN needs to be re-written to not use Config
-remove WLAN Config item
+-remove WLAN Config item
+-sub class out the wlan info
+-check if an interface supports wireless extensions before config.
+
+PPP module needs to be written
+
+Write a class that parses /proc and not ifconfig
+
+Possible other modules: ipsec, bluetooth
-[ ] Wlanmodule needs to check if an interface supports wireless
- extensions.
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp
index 8e4e898..843f630 100644
--- a/noncore/net/networksetup/mainwindowimp.cpp
+++ b/noncore/net/networksetup/mainwindowimp.cpp
@@ -98,269 +98,269 @@ MainWindowImp::~MainWindowImp(){
*/
void MainWindowImp::loadModules(QString path){
//qDebug(path.latin1());
QDir d(path);
if(!d.exists())
return;
// Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) ) {
if(fi->fileName().contains(".so")){
loadPlugin(path + "/" + fi->fileName());
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
//qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer ){
qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
delete lib;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == NULL){
qDebug("MainWindowImp: Couldn't create object, but did load library!");
delete lib;
return NULL;
}
// Store for deletion later
libraries.insert(object, lib);
return object;
}
/**
* 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;
list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
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.", "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){
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, "Error","Please select an interface.", "Ok");
+ QMessageBox::information(this, "Sorry","Please select an interface First.", "Ok");
return;
}
Interface *i = interfaceItems[item];
if(i->getModuleOwner() == NULL){
QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok");
}
else{
if(!i->getModuleOwner()->remove(i))
QMessageBox::information(this, "Error", "Unable to remove.", "Ok");
else{
QMessageBox::information(this, "Success", "Interface was removed.", "Ok");
// TODO memory managment....
// who deletes the interface?
}
}
}
/**
* 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 with a empty
* tab. If tab is !NULL then append the interfaces setup widget to it.
*/
void MainWindowImp::configureClicked(){
QListViewItem *item = connectionList->currentItem();
if(!item){
- QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
+ QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok);
return;
}
QString currentProfile = currentProfileLabel->text();
if(profilesList->count() <= 1 || currentProfile == "All"){
currentProfile = "";
}
Interface *i = interfaceItems[item];
if(i->getModuleOwner()){
i->getModuleOwner()->setProfile(currentProfile);
QTabWidget *tabWidget = NULL;
QWidget *moduleConfigure = i->getModuleOwner()->configure(i, &tabWidget);
if(moduleConfigure != NULL){
if(tabWidget != NULL){
InterfaceSetupImp *configure = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, true);
configure->setProfile(currentProfile);
tabWidget->insertTab(configure, "TCP/IP");
}
moduleConfigure->showMaximized();
moduleConfigure->show();
return;
}
}
InterfaceSetupImp *configure = new InterfaceSetupImp(0, "InterfaceSetupImp", i, true);
configure->setProfile(currentProfile);
configure->showMaximized();
configure->show();
}
/**
* 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 with a empty
* tab. If tab is !NULL then append the interfaces setup widget to it.
*/
void MainWindowImp::informationClicked(){
QListViewItem *item = connectionList->currentItem();
if(!item){
- QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
+ QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
return;
}
Interface *i = interfaceItems[item];
if(!i->isAttached()){
- QMessageBox::information(this, "Error","No information about\na disconnected interface.", QMessageBox::Ok);
+ QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
return;
}
QStringList list;
for(uint i = 0; i < profilesList->count(); i++){
list.append(profilesList->text(i));
}
if(i->getModuleOwner()){
QTabWidget *tabWidget = NULL;
QWidget *moduleInformation = i->getModuleOwner()->information(i, &tabWidget);
if(moduleInformation != NULL){
if(tabWidget != NULL){
InterfaceInformationImp *information = new InterfaceInformationImp(tabWidget, "InterfaceSetupImp", i, true);
tabWidget->insertTab(information, "TCP/IP");
}
moduleInformation->showMaximized();
moduleInformation->show();
return;
}
}
InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true);
information->showMaximized();
information->show();
}
/**
* Aquire the list of active interfaces from ifconfig
* Call ifconfig and ifconfig -a
*/
void MainWindowImp::getInterfaceList(){
KShellProcess *processAll = new KShellProcess();
*processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL;
connect(processAll, SIGNAL(processExited(KProcess *)),
this, SLOT(jobDone(KProcess *)));
threads.insert(processAll, TEMP_ALL);
KShellProcess *process = new KShellProcess();
*process << "/sbin/ifconfig" << " > " TEMP_UP;
connect(process, SIGNAL(processExited(KProcess *)),
this, SLOT(jobDone(KProcess *)));
threads.insert(process, TEMP_UP);
processAll->start(KShellProcess::NotifyOnExit);
process->start(KShellProcess::NotifyOnExit);
}
void MainWindowImp::jobDone(KProcess *process){
QString fileName = threads[process];
threads.remove(process);
delete process;
QFile file(fileName);
if (!file.open(IO_ReadOnly)){
qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1());
return;
}
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
line = stream.readLine();
int space = line.find(" ");
if(space > 1){
// We have found an interface
QString interfaceName = line.mid(0, space);
Interface *i;
// We have found an interface
//qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1());
// See if we already have it
if(interfaceNames.find(interfaceName) == interfaceNames.end()){
if(fileName == TEMP_ALL)
i = new Interface(this, interfaceName, false);
else
i = new Interface(this, interfaceName, true);
i->setAttached(true);
QString hardName = "Ethernet";
int hardwareName = line.find("Link encap:");
int macAddress = line.find("HWaddr");
if(macAddress == -1)
macAddress = line.length();
if(hardwareName != -1)
i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) );
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
}
// It was an interface we already had.
else{
if(fileName != TEMP_ALL)
(interfaceNames[interfaceName])->setStatus(true);
}
}
diff --git a/noncore/settings/networksettings/TODO b/noncore/settings/networksettings/TODO
index c587f58..7a71142 100644
--- a/noncore/settings/networksettings/TODO
+++ b/noncore/settings/networksettings/TODO
@@ -1,6 +1,11 @@
-Write a class that parses /proc and not ifconfig
WLAN needs to be re-written to not use Config
-remove WLAN Config item
+-remove WLAN Config item
+-sub class out the wlan info
+-check if an interface supports wireless extensions before config.
+
+PPP module needs to be written
+
+Write a class that parses /proc and not ifconfig
+
+Possible other modules: ipsec, bluetooth
-[ ] Wlanmodule needs to check if an interface supports wireless
- extensions.
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 8e4e898..843f630 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -98,269 +98,269 @@ MainWindowImp::~MainWindowImp(){
*/
void MainWindowImp::loadModules(QString path){
//qDebug(path.latin1());
QDir d(path);
if(!d.exists())
return;
// Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) ) {
if(fi->fileName().contains(".so")){
loadPlugin(path + "/" + fi->fileName());
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
//qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer ){
qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
delete lib;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == NULL){
qDebug("MainWindowImp: Couldn't create object, but did load library!");
delete lib;
return NULL;
}
// Store for deletion later
libraries.insert(object, lib);
return object;
}
/**
* 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;
list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
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.", "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){
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, "Error","Please select an interface.", "Ok");
+ QMessageBox::information(this, "Sorry","Please select an interface First.", "Ok");
return;
}
Interface *i = interfaceItems[item];
if(i->getModuleOwner() == NULL){
QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok");
}
else{
if(!i->getModuleOwner()->remove(i))
QMessageBox::information(this, "Error", "Unable to remove.", "Ok");
else{
QMessageBox::information(this, "Success", "Interface was removed.", "Ok");
// TODO memory managment....
// who deletes the interface?
}
}
}
/**
* 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 with a empty
* tab. If tab is !NULL then append the interfaces setup widget to it.
*/
void MainWindowImp::configureClicked(){
QListViewItem *item = connectionList->currentItem();
if(!item){
- QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
+ QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok);
return;
}
QString currentProfile = currentProfileLabel->text();
if(profilesList->count() <= 1 || currentProfile == "All"){
currentProfile = "";
}
Interface *i = interfaceItems[item];
if(i->getModuleOwner()){
i->getModuleOwner()->setProfile(currentProfile);
QTabWidget *tabWidget = NULL;
QWidget *moduleConfigure = i->getModuleOwner()->configure(i, &tabWidget);
if(moduleConfigure != NULL){
if(tabWidget != NULL){
InterfaceSetupImp *configure = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, true);
configure->setProfile(currentProfile);
tabWidget->insertTab(configure, "TCP/IP");
}
moduleConfigure->showMaximized();
moduleConfigure->show();
return;
}
}
InterfaceSetupImp *configure = new InterfaceSetupImp(0, "InterfaceSetupImp", i, true);
configure->setProfile(currentProfile);
configure->showMaximized();
configure->show();
}
/**
* 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 with a empty
* tab. If tab is !NULL then append the interfaces setup widget to it.
*/
void MainWindowImp::informationClicked(){
QListViewItem *item = connectionList->currentItem();
if(!item){
- QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
+ QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
return;
}
Interface *i = interfaceItems[item];
if(!i->isAttached()){
- QMessageBox::information(this, "Error","No information about\na disconnected interface.", QMessageBox::Ok);
+ QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
return;
}
QStringList list;
for(uint i = 0; i < profilesList->count(); i++){
list.append(profilesList->text(i));
}
if(i->getModuleOwner()){
QTabWidget *tabWidget = NULL;
QWidget *moduleInformation = i->getModuleOwner()->information(i, &tabWidget);
if(moduleInformation != NULL){
if(tabWidget != NULL){
InterfaceInformationImp *information = new InterfaceInformationImp(tabWidget, "InterfaceSetupImp", i, true);
tabWidget->insertTab(information, "TCP/IP");
}
moduleInformation->showMaximized();
moduleInformation->show();
return;
}
}
InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true);
information->showMaximized();
information->show();
}
/**
* Aquire the list of active interfaces from ifconfig
* Call ifconfig and ifconfig -a
*/
void MainWindowImp::getInterfaceList(){
KShellProcess *processAll = new KShellProcess();
*processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL;
connect(processAll, SIGNAL(processExited(KProcess *)),
this, SLOT(jobDone(KProcess *)));
threads.insert(processAll, TEMP_ALL);
KShellProcess *process = new KShellProcess();
*process << "/sbin/ifconfig" << " > " TEMP_UP;
connect(process, SIGNAL(processExited(KProcess *)),
this, SLOT(jobDone(KProcess *)));
threads.insert(process, TEMP_UP);
processAll->start(KShellProcess::NotifyOnExit);
process->start(KShellProcess::NotifyOnExit);
}
void MainWindowImp::jobDone(KProcess *process){
QString fileName = threads[process];
threads.remove(process);
delete process;
QFile file(fileName);
if (!file.open(IO_ReadOnly)){
qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1());
return;
}
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
line = stream.readLine();
int space = line.find(" ");
if(space > 1){
// We have found an interface
QString interfaceName = line.mid(0, space);
Interface *i;
// We have found an interface
//qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1());
// See if we already have it
if(interfaceNames.find(interfaceName) == interfaceNames.end()){
if(fileName == TEMP_ALL)
i = new Interface(this, interfaceName, false);
else
i = new Interface(this, interfaceName, true);
i->setAttached(true);
QString hardName = "Ethernet";
int hardwareName = line.find("Link encap:");
int macAddress = line.find("HWaddr");
if(macAddress == -1)
macAddress = line.length();
if(hardwareName != -1)
i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) );
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
}
// It was an interface we already had.
else{
if(fileName != TEMP_ALL)
(interfaceNames[interfaceName])->setStatus(true);
}
}