author | mickeyl <mickeyl> | 2003-12-29 01:35:34 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-12-29 01:35:34 (UTC) |
commit | dae677b6e29e2a0efb7128bcc4b0d87bf2b535dd (patch) (side-by-side diff) | |
tree | 15fa32456809982685cdce110b54bf1658efd0e5 | |
parent | 29fa04fc898c53cfdc9b148d79fcff54d9173707 (diff) | |
download | opie-dae677b6e29e2a0efb7128bcc4b0d87bf2b535dd.zip opie-dae677b6e29e2a0efb7128bcc4b0d87bf2b535dd.tar.gz opie-dae677b6e29e2a0efb7128bcc4b0d87bf2b535dd.tar.bz2 |
waited too long for tille to do something - merged it on my own... :(
5 files changed, 9 insertions, 19 deletions
diff --git a/noncore/settings/networksettings/main.cpp b/noncore/settings/networksettings/main.cpp index 1b74d62..5d275ac 100644 --- a/noncore/settings/networksettings/main.cpp +++ b/noncore/settings/networksettings/main.cpp @@ -1,13 +1,6 @@ #include "mainwindowimp.h" -#include <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> -int main(int argc, char **argv) -{ - QPEApplication app(argc, argv); - MainWindowImp window; - app.showMainWidget(&window); - return app.exec(); -} +OPIE_EXPORT_APP( OApplicationFactory<MainWindowImp> ) -// main.cpp diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index f74cf87..d9752ce 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp @@ -1,149 +1,149 @@ #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 <qpe/qcopenvelope_qws.h> #include <qtabwidget.h> // in order to disable the profiles tab #include <qpe/qpeapplication.h> #include <qmessagebox.h> #ifdef QWS #include <qpe/config.h> #include <qpe/qlibrary.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> #else #include <klibloader.h> #define QLibrary KLibrary #include <kconfig.h> #define Config KConfig #include <kapplication.h> #include <kstandarddirs.h> #include <kiconloader.h> #define showMaximized show #endif #if QT_VERSION < 300 #include <qlist.h> #else #include <qptrlist.h> #endif #include <qdir.h> #include <qfile.h> #include <qtextstream.h> #include <qregexp.h> #include <net/if.h> #include <sys/ioctl.h> #include <sys/socket.h> #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" #define _PROCNETDEV "/proc/net/dev" -MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME){ +MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), 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&))); //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 ) { /* * we skipped it in getAllInterfaces now * we need to ignore it as well */ if (m_handledIfaces.contains( *ni) ) { qDebug("Not up iface handled by module"); continue; } 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(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(); } makeChannel(); } /** * 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(); } diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h index 451835b..f211d6e 100644 --- a/noncore/settings/networksettings/mainwindowimp.h +++ b/noncore/settings/networksettings/mainwindowimp.h @@ -1,74 +1,75 @@ #ifndef MAINWINOWIMP_H #define MAINWINOWIMP_H #include "mainwindow.h" #include <qmap.h> #include <qstringlist.h> class Module; class Interface; class QLibrary; class KProcess; class QCopChannel; #ifdef QWS class QLibrary; #else class KLibrary; class KLibLoader; #define QLibrary KLibrary #endif class MainWindowImp : public MainWindow { Q_OBJECT public: - MainWindowImp(QWidget *parent=0, const char *name=0); + static QString appName() { return QString::fromLatin1("networksettings"); } + MainWindowImp(QWidget *parent=0, const char *name=0, WFlags fl = 0); ~MainWindowImp(); QCopChannel *channel; private slots: void getAllInterfaces(); void addClicked(); void removeClicked(); void configureClicked(); void informationClicked(); void addProfile(); void removeProfile(); void changeProfile(); void updateInterface(Interface *i); void newProfileChanged(const QString& newText); void receive (const QCString &, const QByteArray &); private: void makeChannel(); void loadModules(const QString &path); Module* loadPlugin(const QString &pluginFileName, const QString &resolveString = "create_plugin"); // For our local list of names QMap<QString, Interface*> interfaceNames; QMap<Module*, QLibrary*> libraries; QMap<Interface*, QListViewItem*> items; QMap<QListViewItem*, Interface*> interfaceItems; QStringList m_handledIfaces; QMap<KProcess*, QString> threads; QStringList profiles; bool advancedUserMode; QString scheme; #ifndef QWS KLibLoader *loader; #endif }; #endif // MAINWINOWIMP_H diff --git a/noncore/settings/networksettings/networksettings.pro b/noncore/settings/networksettings/networksettings.pro index cdd133a..e8dbe5b 100644 --- a/noncore/settings/networksettings/networksettings.pro +++ b/noncore/settings/networksettings/networksettings.pro @@ -1,16 +1,12 @@ -DESTDIR = $(OPIEDIR)/bin -TEMPLATE = app -# -CONFIG = qt warn_on debug -#CONFIG = qt warn_on release +CONFIG = qt warn_on debug quick-app HEADERS = mainwindowimp.h addconnectionimp.h defaultmodule.h module.h SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp INCLUDEPATH += $(OPIEDIR)/include interfaces/ -DEPENDPATH += $(OPIEDIR)/include interfaces/ wlan/ -LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings -Linterfaces/ -linterfaces -lopie +DEPENDPATH += $(OPIEDIR)/include interfaces/ wlan/ ppp/ +LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings -Linterfaces/ -linterfaces -lopie -lopiecore2 -lopienet2 INTERFACES = mainwindow.ui addconnection.ui TARGET = networksettings include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/settings/networksettings/opie-networksettings.control b/noncore/settings/networksettings/opie-networksettings.control index 82aac2a..08a79c6 100644 --- a/noncore/settings/networksettings/opie-networksettings.control +++ b/noncore/settings/networksettings/opie-networksettings.control @@ -1,10 +1,10 @@ Package: opie-networksettings Files: plugins/application/libnetworksettings.so* bin/networksettings apps/Settings/networksettings.desktop pics/networksettings/* pics/Network/PPPConnect.png $OPIEDIR/lib/libinterfaces.so* root/usr/bin/changedns bin/getprofile Priority: optional Section: opie/settings Maintainer: Patrick S. Vogt <tille@handhelds.org> Architecture: arm -Depends: task-opie-minimal +Depends: task-opie-minimal, libopiecore2, libopienet2 Description: Network settings. Replaces: opie-networksetup Version: $QPE_VERSION$EXTRAVERSION |