File indexing completed on 2024-04-21 15:42:58

0001 /***************************************************************************
0002     smb4ksystemtray  -  This is the system tray window class of Smb4K.
0003                              -------------------
0004     begin                : Mi Jun 13 2007
0005     copyright            : (C) 2007-2019 by Alexander Reinholdt
0006     email                : alexander.reinholdt@kdemail.net
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *   This program is free software; you can redistribute it and/or modify  *
0011  *   it under the terms of the GNU General Public License as published by  *
0012  *   the Free Software Foundation; either version 2 of the License, or     *
0013  *   (at your option) any later version.                                   *
0014  *                                                                         *
0015  *   This program is distributed in the hope that it will be useful, but   *
0016  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
0017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
0018  *   General Public License for more details.                              *
0019  *                                                                         *
0020  *   You should have received a copy of the GNU General Public License     *
0021  *   along with this program; if not, write to the                         *
0022  *   Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,*
0023  *   MA 02110-1335, USA                                                    *
0024  ***************************************************************************/
0025 
0026 #ifndef SMB4KSYSTEMTRAY_H
0027 #define SMB4KSYSTEMTRAY_H
0028 
0029 // Qt includes
0030 #include <QString>
0031 #include <QWidget>
0032 
0033 // KDE includes
0034 #include <KNotifications/KStatusNotifierItem>
0035 
0036 
0037 class Smb4KSystemTray : public KStatusNotifierItem
0038 {
0039   Q_OBJECT
0040 
0041   friend class Smb4KMainWindow;
0042 
0043   public:
0044     /**
0045      * The constructor.
0046      *
0047      * @param parent        The parent widget of the system tray window
0048      */
0049     explicit Smb4KSystemTray(QWidget *parent = 0);
0050 
0051     /**
0052      * The destructor.
0053      */
0054     ~Smb4KSystemTray();
0055 
0056     /**
0057      * This function (re-)loads the settings for this widget.
0058      */
0059     void loadSettings();
0060 
0061   signals:
0062     /**
0063      * This signal is emitted when the config dialog has been closed and the
0064      * settings changed.
0065      *
0066      * This signal is forwarded from @see Smb4KConfigDialog.
0067      */
0068     void settingsChanged(const QString &dialogName);
0069 
0070   protected slots:
0071     /**
0072      * This slot opens the manual mount dialog.
0073      *
0074      * @param checked         TRUE if the action can be and is checked and FALSE
0075      *                        otherwise.
0076      */
0077     void slotMountDialog();
0078 
0079     /**
0080      * This slot opens the configurations dialog.
0081      */
0082     void slotConfigDialog();
0083 
0084     /**
0085      * This slot is invoked when the config dialog is closed and the settings have
0086      * been changed. Emits the reloadSettings() signal and adjusts the system tray
0087      * widget to the new settings afterwards.
0088      *
0089      * @param dialogName      The name of the dialog.
0090      */
0091     void slotSettingsChanged(const QString &dialogName);
0092 
0093     /**
0094      * Set the status of the system tray icon. This slot checks the global
0095      * list of mounted shares and the global list of workgroups. If neither of
0096      * them contains any item, the icon is set to passive state until one of 
0097      * the lists is populated.
0098      */
0099     void slotSetStatus();
0100 };
0101 
0102 #endif