File indexing completed on 2023-12-03 05:04:28
0001 /* 0002 smb4ksystemtray - This is the system tray window class of Smb4K. 0003 0004 SPDX-FileCopyrightText: 2007-2023 Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef SMB4KSYSTEMTRAY_H 0009 #define SMB4KSYSTEMTRAY_H 0010 0011 // application specific includes 0012 #include "smb4kmountdialog.h" 0013 0014 // Qt includes 0015 #include <QPointer> 0016 #include <QString> 0017 #include <QWidget> 0018 0019 // KDE includes 0020 #include <KStatusNotifierItem> 0021 0022 class Smb4KSystemTray : public KStatusNotifierItem 0023 { 0024 Q_OBJECT 0025 0026 friend class Smb4KMainWindow; 0027 0028 public: 0029 /** 0030 * The constructor. 0031 * 0032 * @param parent The parent widget of the system tray window 0033 */ 0034 explicit Smb4KSystemTray(QWidget *parent = nullptr); 0035 0036 /** 0037 * The destructor. 0038 */ 0039 ~Smb4KSystemTray(); 0040 0041 /** 0042 * This function (re-)loads the settings for this widget. 0043 */ 0044 void loadSettings(); 0045 0046 Q_SIGNALS: 0047 /** 0048 * This signal is emitted when the config dialog has been closed and the 0049 * settings changed. 0050 * 0051 * This signal is forwarded from @see Smb4KConfigDialog. 0052 */ 0053 void settingsChanged(const QString &dialogName); 0054 0055 protected Q_SLOTS: 0056 /** 0057 * This slot opens the manual mount dialog. 0058 * 0059 * @param checked TRUE if the action can be and is checked and FALSE 0060 * otherwise. 0061 */ 0062 void slotMountDialog(); 0063 0064 /** 0065 * This slot opens the configurations dialog. 0066 */ 0067 void slotConfigDialog(); 0068 0069 /** 0070 * This slot is invoked when the config dialog is closed and the settings have 0071 * been changed. Emits the reloadSettings() signal and adjusts the system tray 0072 * widget to the new settings afterwards. 0073 * 0074 * @param dialogName The name of the dialog. 0075 */ 0076 void slotSettingsChanged(const QString &dialogName); 0077 0078 /** 0079 * Set the status of the system tray icon. This slot checks the global 0080 * list of mounted shares and the global list of workgroups. If neither of 0081 * them contains any item, the icon is set to passive state until one of 0082 * the lists is populated. 0083 */ 0084 void slotSetStatus(); 0085 0086 private: 0087 QPointer<Smb4KMountDialog> m_mountDialog; 0088 }; 0089 0090 #endif