summaryrefslogtreecommitdiff
authorbenmeyer <benmeyer>2003-01-02 19:49:08 (UTC)
committer benmeyer <benmeyer>2003-01-02 19:49:08 (UTC)
commitcbe90bbbb4a22130af317d7ddac51b3048ae34a0 (patch) (side-by-side diff)
tree02c8fd85e168b58376d8d967eaae6eee7033705c
parentef25fa96377d3ed1b7355a4e13609d0713f6f51e (diff)
downloadopie-cbe90bbbb4a22130af317d7ddac51b3048ae34a0.zip
opie-cbe90bbbb4a22130af317d7ddac51b3048ae34a0.tar.gz
opie-cbe90bbbb4a22130af317d7ddac51b3048ae34a0.tar.bz2
Name changes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp2
-rw-r--r--noncore/settings/networksettings/opie-networksettings.control2
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 9a17743..9efc8c2 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -1,173 +1,173 @@
#include "mainwindowimp.h"
#include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
#include "interfaces.h"
#include "module.h"
#include <qpushbutton.h>
#include <qlistbox.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <qheader.h>
#include <qlabel.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qlist.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#include <net/if.h>
#include <sys/ioctl.h>
#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false), scheme(DEFAULT_SCHEME){
connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
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(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
// Load connections.
- loadModules(QPEApplication::qpeDir() + "/plugins/networksetup");
+ loadModules(QPEApplication::qpeDir() + "/plugins/networksettings");
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");
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();
}
}
/**
* Deconstructor. Save profiles. Delete loaded libraries.
*/
MainWindowImp::~MainWindowImp(){
// Save profiles.
Config cfg("NetworkSetup");
cfg.setGroup("General");
cfg.writeEntry("Profiles", profiles.join(" "));
// Delete all interfaces that don't have owners.
QMap<Interface*, QListViewItem*>::Iterator iIt;
for( iIt = items.begin(); iIt != items.end(); ++iIt ){
if(iIt.key()->getModuleOwner() == NULL)
delete iIt.key();
}
// Delete Modules and Libraries
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it ){
delete it.key();
// I wonder why I can't delete the libraries
// What fucking shit this is.
//delete it.data();
}
}
/**
* Query the kernel for all of the interfaces.
*/
void MainWindowImp::getAllInterfaces(){
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if(sockfd == -1)
return;
char buf[8*1024];
struct ifconf ifc;
ifc.ifc_len = sizeof(buf);
ifc.ifc_req = (struct ifreq *) buf;
int result=ioctl(sockfd, SIOCGIFCONF, &ifc);
for (char* ptr = buf; ptr < buf + ifc.ifc_len; ){
struct ifreq *ifr =(struct ifreq *) ptr;
int len = sizeof(struct sockaddr);
#ifdef HAVE_SOCKADDR_SA_LEN
if (ifr->ifr_addr.sa_len > len)
len = ifr->ifr_addr.sa_len; /* length > 16 */
#endif
ptr += sizeof(ifr->ifr_name) + len; /* for next one in buffer */
int flags;
struct sockaddr_in *sinptr;
Interface *i = NULL;
switch (ifr->ifr_addr.sa_family){
case AF_INET:
sinptr = (struct sockaddr_in *) &ifr->ifr_addr;
flags=0;
struct ifreq ifcopy;
ifcopy=*ifr;
result=ioctl(sockfd,SIOCGIFFLAGS,&ifcopy);
flags=ifcopy.ifr_flags;
i = new Interface(this, ifr->ifr_name, false);
i->setAttached(true);
if ((flags & IFF_UP) == IFF_UP)
i->setStatus(true);
else
i->setStatus(false);
if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
i->setHardwareName("Ethernet");
else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
i->setHardwareName("Point to Point");
else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
i->setHardwareName("Multicast");
else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
i->setHardwareName("Loopback");
else
i->setHardwareName("Unknown");
diff --git a/noncore/settings/networksettings/opie-networksettings.control b/noncore/settings/networksettings/opie-networksettings.control
index 585e50e..8fa40c7 100644
--- a/noncore/settings/networksettings/opie-networksettings.control
+++ b/noncore/settings/networksettings/opie-networksettings.control
@@ -1,8 +1,8 @@
-Files: bin/networksetup apps/Settings/networksetup.desktop plugins/networksetup/* pics/networksetup/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile
+Files: bin/networksettings apps/Settings/networksettings.desktop plugins/networksettings/* pics/networksettings/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile
Priority: optional
Section: opie/settings
Maintainer: Ben Meyer <meyerb@sharpsec.com>
Architecture: arm
Version: $QPE_VERSION-$SUB_VERSION
Depends: opie-base ($QPE_VERSION)
Description: Network settings