mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
b199b7e654
Add system tray icon support to wpa_gui-qt4. The tray icon remains quiet when the main dialog is visible, so it should not cause too much pain for more conservative users of wpa_gui. The addition involves the following changes: * when closing wpa_gui via window manager close box, wpa_gui close event is ignored and it is minimised to system tray. A status message is displayed (or popup dialog box if tray messages are not supported) to provide a visual hint that the program is still running in the background. * add File->Exit slot handler to facilitate application quit from main dialog * provide a context menu with a short list of useful actions * show/hide main dialog when icon is triggered (single click) * ensure main dialog is visible when event handler or scan results is chosen from tray icon context menu * show tray messages on connected and disconnected events, display a status message a few seconds after connected events Signed-off-by: Kel Modderman <kel@otaku42.de>
111 lines
2.9 KiB
C++
111 lines
2.9 KiB
C++
/*
|
|
* wpa_gui - WpaGui class
|
|
* Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* Alternatively, this software may be distributed under the terms of BSD
|
|
* license.
|
|
*
|
|
* See README and COPYING for more details.
|
|
*/
|
|
|
|
#ifndef WPAGUI_H
|
|
#define WPAGUI_H
|
|
|
|
#include <QSystemTrayIcon>
|
|
#include <QObject>
|
|
#include "ui_wpagui.h"
|
|
|
|
class UserDataRequest;
|
|
|
|
|
|
class WpaGui : public QMainWindow, public Ui::WpaGui
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
WpaGui(QWidget *parent = 0, const char *name = 0,
|
|
Qt::WFlags fl = 0);
|
|
~WpaGui();
|
|
|
|
virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen);
|
|
virtual void triggerUpdate();
|
|
virtual void editNetwork(const QString &sel);
|
|
virtual void removeNetwork(const QString &sel);
|
|
virtual void enableNetwork(const QString &sel);
|
|
virtual void disableNetwork(const QString &sel);
|
|
virtual int getNetworkDisabled(const QString &sel);
|
|
|
|
public slots:
|
|
virtual void parse_argv();
|
|
virtual void updateStatus();
|
|
virtual void updateNetworks();
|
|
virtual void fileExit();
|
|
virtual void helpIndex();
|
|
virtual void helpContents();
|
|
virtual void helpAbout();
|
|
virtual void disconnect();
|
|
virtual void scan();
|
|
virtual void eventHistory();
|
|
virtual void ping();
|
|
virtual void processMsg(char *msg);
|
|
virtual void processCtrlReq(const char *req);
|
|
virtual void receiveMsgs();
|
|
virtual void connectB();
|
|
virtual void selectNetwork(const QString &sel);
|
|
virtual void editSelectedNetwork();
|
|
virtual void editListedNetwork();
|
|
virtual void removeSelectedNetwork();
|
|
virtual void removeListedNetwork();
|
|
virtual void addNetwork();
|
|
virtual void enableAllNetworks();
|
|
virtual void disableAllNetworks();
|
|
virtual void removeAllNetworks();
|
|
virtual void saveConfig();
|
|
virtual void selectAdapter(const QString &sel);
|
|
virtual void updateNetworkDisabledStatus();
|
|
virtual void enableListedNetwork(bool);
|
|
virtual void disableListedNetwork(bool);
|
|
virtual void showTrayMessage(QSystemTrayIcon::MessageIcon type,
|
|
int sec, const QString &msg);
|
|
virtual void showTrayStatus();
|
|
|
|
protected slots:
|
|
virtual void languageChange();
|
|
virtual void trayActivated(QSystemTrayIcon::ActivationReason how);
|
|
virtual void closeEvent(QCloseEvent *event);
|
|
|
|
private:
|
|
ScanResults *scanres;
|
|
bool networkMayHaveChanged;
|
|
char *ctrl_iface;
|
|
EventHistory *eh;
|
|
struct wpa_ctrl *ctrl_conn;
|
|
QSocketNotifier *msgNotifier;
|
|
QTimer *timer;
|
|
int pingsToStatusUpdate;
|
|
WpaMsgList msgs;
|
|
char *ctrl_iface_dir;
|
|
struct wpa_ctrl *monitor_conn;
|
|
UserDataRequest *udr;
|
|
QAction *disconnectAction;
|
|
QAction *reconnectAction;
|
|
QAction *eventAction;
|
|
QAction *scanAction;
|
|
QAction *statAction;
|
|
QAction *showAction;
|
|
QAction *hideAction;
|
|
QAction *quitAction;
|
|
QMenu *tray_menu;
|
|
QSystemTrayIcon *tray_icon;
|
|
void createTrayIcon();
|
|
bool ackTrayIcon;
|
|
|
|
int openCtrlConnection(const char *ifname);
|
|
};
|
|
|
|
#endif /* WPAGUI_H */
|