/*************************************************************************** * Copyright (C) 2006 by Michael Kaufmann * * michael@enlighter.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include "../config.h" #endif #ifndef TRAYWINDOW_H #define TRAYWINDOW_H #include #include #include #include #include #include #include #include "openvpnmanager.h" #include "infopopup.h" #include "kovpnconfig.h" /** @author Michael Kaufmann */ class TrayWindow : public KSystemTray { Q_OBJECT public: enum states { DISCONNECTED = 0, HALF_CONNECTED, CONNECTED, CONNECTING, CONNECTED__CONNECTING, DISCONNECTED__CONNECTING, HALF_CONNECTED__CONNECTING }; static TrayWindow * systemTray( QWidget *parent, const char *name ); ~TrayWindow(); void setAdvanced( bool advanced ); public slots: void slotStatusChanged( openVPNManager * ); void stateChanged( const QString & id, openVPNManager::tStatus status ); void reg( openVPNManager * manager ); void dereg( openVPNManager * manager ); void ovpnReady( const QString & ); void ovpnNotReady( const QString & ); void ovpnPreReady( const QString & ); protected slots: void setState( TrayWindow::states state ); void setToolTip(); void setStateMenu( const QString & id, openVPNManager::states status ); void setEnableMenu( const QString & id, openVPNManager::states status ); void setInfoPopup( const QString & id, openVPNManager::tStatus status ); states calcState(); protected: void debug( const QString & method, const QString & message = "I was called" ); bool eventFilter ( QObject * o, QEvent * e ); private: TrayWindow( QWidget *parent, const char *name ); static TrayWindow * trayWindowInstance; KPassivePopup * passivePopup; KIconLoader * trayIcons; QPtrList mOvpnManagers; QMap mOvpnStates; states mState; bool mAdvanced; QWidget * mParent; KPopupMenu * mContextMenu; // DisconnectMenuItem = new KAction( i18n( "&Disconnect" ), "disconnect", 0, manager, SLOT( slotOvpnDisconnect() ), actionCollection(), "disconnect" ); // DisconnectMenuItem->plug( m_contextMenu, 1 ); // DisconnectMenuItem->setIcon( "connect_no" ); // ConnectMenuItem = new KAction( i18n( "&Connect" ), "connect", 0, manager, SLOT( slotOvpnForceConnect() ), actionCollection(), "connect" ); // ConnectMenuItem->plug( m_contextMenu, 1 ); // ConnectMenuItem->setIcon( "connect_creating" ); KAction *mPreferencesMenuItem; KPopupMenu *mConnectMenu; KPopupMenu *mDisconnectMenu; KAction *mStatusMenuItem; KAction *mLogWidgetMenuItem; KAction *mAboutWindowMenuItem; QMap mManagerMenus; QMap mDisconnectMenuItems; QMap mConnectMenuItems; KAboutApplication *aboutWindow; }; #endif