File indexing completed on 2023-11-26 11:42:34
0001 /* 0002 The main window of Smb4K 0003 0004 SPDX-FileCopyrightText: 2008-2023 Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef SMB4KMAINWINDOW_H 0009 #define SMB4KMAINWINDOW_H 0010 0011 // application specific includes 0012 #include "core/smb4kglobal.h" 0013 0014 // Qt includes 0015 #include <QActionGroup> 0016 #include <QDockWidget> 0017 #include <QLabel> 0018 #include <QProgressBar> 0019 #include <QUrl> 0020 0021 // KDE includes 0022 #include <KXmlGuiWindow> 0023 0024 // forward declarations 0025 class Smb4KSystemTray; 0026 class Smb4KPrintInfo; 0027 class Smb4KSynchronizationInfo; 0028 0029 /** 0030 * This is the main window of Smb4K. It provides the network browser, the 0031 * shares view and all other dialogs as well as a menu, status and tool bar. 0032 * 0033 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0034 */ 0035 0036 class Smb4KMainWindow : public KXmlGuiWindow 0037 { 0038 Q_OBJECT 0039 0040 public: 0041 /** 0042 * The constructor 0043 */ 0044 Smb4KMainWindow(); 0045 0046 /** 0047 * The destructor 0048 */ 0049 ~Smb4KMainWindow(); 0050 0051 protected: 0052 /** 0053 * Reimplemented from KMainWindow. 0054 */ 0055 bool queryClose() override; 0056 0057 /** 0058 * Reimplemented from KMainWindow 0059 */ 0060 bool eventFilter(QObject *obj, QEvent *e) override; 0061 0062 protected Q_SLOTS: 0063 /** 0064 * Quits the application. 0065 */ 0066 void slotQuit(); 0067 0068 /** 0069 * Opens the configuration dialog. 0070 */ 0071 void slotConfigDialog(); 0072 0073 /** 0074 * Reloads settings, if necessary. This slot is connected to 0075 * the KConfigDialog::settingsChanged() signal. 0076 * 0077 * @param dialogName The name of the configuration dialog 0078 */ 0079 void slotSettingsChanged(const QString &dialogName); 0080 0081 /** 0082 * This slot is called when a bookmark should be added. 0083 * 0084 * @param checked TRUE if the action is checked 0085 */ 0086 void slotAddBookmarks(); 0087 0088 /** 0089 * This slot is connected to the Smb4KWalletManager::initialized() signal. 0090 * It checks the state of the wallet manager and sets the icon in the status 0091 * bar accordingly. 0092 */ 0093 void slotWalletManagerInitialized(); 0094 0095 /** 0096 * This slot shows a busy bar and a status message according to the action performed by 0097 * the client. It is connected to the Smb4KClient::aboutToStart() signal. 0098 * 0099 * @param item The network item 0100 * 0101 * @param process The process 0102 */ 0103 void slotClientAboutToStart(const NetworkItemPtr &item, int process); 0104 0105 /** 0106 * this slot shows a status message according to the action that was just finished by the 0107 * client and hides the status bar if appropriate. It is connected to the Smb4KClient::finished() 0108 * signal. 0109 * 0110 * @param item The network item 0111 * 0112 * @param process The process 0113 */ 0114 void slotClientFinished(const NetworkItemPtr &item, int process); 0115 0116 /** 0117 * This slot shows a status message according to the action performed by the 0118 * mounter as well as a busy bar. It is connected to the Smb4KMounter::aboutToStart() 0119 * signal. 0120 * @param process The process 0121 */ 0122 void slotMounterAboutToStart(int process); 0123 0124 /** 0125 * This shows a status message according to the action that was just finished by 0126 * the mounter and hides the busy bar if appropriate. It is connected to the 0127 * Smb4KMounter::finished() signal. 0128 * @param process The process 0129 */ 0130 void slotMounterFinished(int process); 0131 0132 /** 0133 * This slot gives the visual mount feedback in the status bar. It is 0134 * connected to the Smb4KMounter::mounted() signal. 0135 * 0136 * @param share The share object 0137 */ 0138 void slotVisualMountFeedback(const SharePtr &share); 0139 0140 /** 0141 * This slot gives the visual unmount feedback in the status bar. It is 0142 * connected to the Smb4KMounter::unmounted() signal. 0143 * 0144 * @param share The share object 0145 */ 0146 void slotVisualUnmountFeedback(const SharePtr &share); 0147 0148 /** 0149 * This slot shows a message according to the action performed by the synchronizer. 0150 * It is connected to the Smb4KSynchronizer::aboutToStart() signal. 0151 * 0152 * @param dest The path of the destination 0153 */ 0154 void slotSynchronizerAboutToStart(const QString &dest); 0155 0156 /** 0157 * This slot shows a message according to the finished action that were reported 0158 * by the synchronizer. It is connected to the Smb4KSynchronizer::finished() signal. 0159 * 0160 * @param dest The path of the destination 0161 */ 0162 void slotSynchronizerFinished(const QString &dest); 0163 0164 /** 0165 * This slot hides the feedback icon in the status bar. It is connected to 0166 * a QTimer::singleShot() signal. 0167 */ 0168 void slotEndVisualFeedback(); 0169 0170 /** 0171 * Enable/disable the "Add Bookmark" action 0172 */ 0173 void slotEnableBookmarkAction(); 0174 0175 /** 0176 * This slot is connected to the visibilityChanged() signals of the network browser 0177 * dock widget. It is used to get the tool bars right. 0178 * 0179 * @param visible If the dock widget is visible. 0180 */ 0181 void slotNetworkBrowserVisibilityChanged(bool visible); 0182 0183 /** 0184 * This slot is connected to the visibilityChanged() signals of the shares view 0185 * dock widget. It is used to get the tool bars right. 0186 * 0187 * @param visible If the dock widget is visible. 0188 */ 0189 void slotSharesViewVisibilityChanged(bool visible); 0190 0191 private: 0192 /** 0193 * Set up the main window actions 0194 */ 0195 void setupActions(); 0196 0197 /** 0198 * Set up the status bar 0199 */ 0200 void setupStatusBar(); 0201 0202 /** 0203 * Set up the main window's view 0204 */ 0205 void setupView(); 0206 0207 /** 0208 * Set up menu bar 0209 */ 0210 void setupMenuBar(); 0211 0212 /** 0213 * Set up the system tray widget 0214 */ 0215 void setupSystemTrayWidget(); 0216 0217 /** 0218 * Loads the settings 0219 */ 0220 void loadSettings(); 0221 0222 /** 0223 * Saves the settings 0224 */ 0225 void saveSettings(); 0226 0227 /** 0228 * Set up the mount indicator 0229 */ 0230 void setupMountIndicator(); 0231 0232 /** 0233 * Setup the dynamic action list 0234 */ 0235 void setupDynamicActionList(QDockWidget *dock); 0236 0237 /** 0238 * This is the progress bar in the status bar. 0239 */ 0240 QProgressBar *m_progressBar; 0241 0242 /** 0243 * This is the pixmap label that represents the state of 0244 * the password handler in the status bar. 0245 */ 0246 QLabel *m_passwordIcon; 0247 0248 /** 0249 * This icon gives feedback on actions that took place like 0250 * mounting a share, etc. 0251 */ 0252 QLabel *m_feedbackIcon; 0253 0254 /** 0255 * The system tray widget 0256 */ 0257 Smb4KSystemTray *m_systemTrayWidget; 0258 0259 /** 0260 * This is the widget (embedded into a dock widget) that has 0261 * the focus. 0262 */ 0263 QWidget *m_focusWidget; 0264 0265 /** 0266 * Dock widgets action group; 0267 */ 0268 QActionGroup *m_dockWidgets; 0269 }; 0270 0271 #endif