wpa_gui-qt4: Fix build with Session Manager disabled in Qt4

When trying to build wpa_gui (Qt4 version) from openembedded it fails
because Qt4 is compiled without session manager and thus wpa_gui fails
to compile.

I attached a patch, that enables compiling without Session Manager (via
preprocessor) if it is not compiled into Qt4; otherwise, it behaves as
it does right now.

I checked to build on my host (Debian unstable, Session Manager
enabled) and openembedded (Session Manager disabled).
This commit is contained in:
Christian Rüb 2009-11-16 13:20:53 +02:00 committed by Jouni Malinen
parent 33417cd75c
commit 1545457e04
3 changed files with 10 additions and 0 deletions

View file

@ -24,7 +24,9 @@ class WpaGuiApp : public QApplication
public:
WpaGuiApp(int &argc, char **argv);
#ifndef QT_NO_SESSIONMANAGER
virtual void saveState(QSessionManager &manager);
#endif
WpaGui *w;
};
@ -33,11 +35,13 @@ WpaGuiApp::WpaGuiApp(int &argc, char **argv) : QApplication(argc, argv)
{
}
#ifndef QT_NO_SESSIONMANAGER
void WpaGuiApp::saveState(QSessionManager &manager)
{
QApplication::saveState(manager);
w->saveState();
}
#endif
int main(int argc, char *argv[])

View file

@ -147,6 +147,7 @@ WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags)
parse_argv();
#ifndef QT_NO_SESSIONMANAGER
if (app->isSessionRestored()) {
QSettings settings("wpa_supplicant", "wpa_gui");
settings.beginGroup("state");
@ -155,6 +156,7 @@ WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags)
startInTray = settings.value("in_tray").toBool();
settings.endGroup();
}
#endif
if (QSystemTrayIcon::isSystemTrayAvailable())
createTrayIcon(startInTray);
@ -1721,6 +1723,7 @@ void WpaGui::addInterface()
}
#ifndef QT_NO_SESSIONMANAGER
void WpaGui::saveState()
{
QSettings settings("wpa_supplicant", "wpa_gui");
@ -1729,3 +1732,4 @@ void WpaGui::saveState()
settings.setValue("in_tray", inTray);
settings.endGroup();
}
#endif

View file

@ -40,7 +40,9 @@ public:
virtual void disableNetwork(const QString &sel);
virtual int getNetworkDisabled(const QString &sel);
void setBssFromScan(const QString &bssid);
#ifndef QT_NO_SESSIONMANAGER
void saveState();
#endif
public slots:
virtual void parse_argv();