File indexing completed on 2024-12-08 04:34:48
0001 /* 0002 The main window of Smb4K 0003 0004 SPDX-FileCopyrightText: 2008-2024 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 <QDockWidget> 0016 #include <QLabel> 0017 #include <QPointer> 0018 #include <QProgressBar> 0019 #include <QUrl> 0020 0021 // KDE includes 0022 #include <KXmlGuiWindow> 0023 0024 // forward declarations 0025 class Smb4KSystemTray; 0026 class Smb4KNetworkBrowserDockWidget; 0027 class Smb4KSharesViewDockWidget; 0028 class Smb4KBookmarkMenu; 0029 class Smb4KPasswordDialog; 0030 0031 /** 0032 * This is the main window of Smb4K. It provides the network browser, the 0033 * shares view and all other dialogs as well as a menu, status and tool bar. 0034 * 0035 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0036 */ 0037 0038 class Smb4KMainWindow : public KXmlGuiWindow 0039 { 0040 Q_OBJECT 0041 0042 public: 0043 /** 0044 * The constructor 0045 */ 0046 Smb4KMainWindow(); 0047 0048 /** 0049 * The destructor 0050 */ 0051 ~Smb4KMainWindow(); 0052 0053 protected: 0054 /** 0055 * Reimplemented from KMainWindow 0056 */ 0057 bool queryClose() override; 0058 0059 /** 0060 * Reimplemented from KMainWindow 0061 */ 0062 bool eventFilter(QObject *obj, QEvent *e) override; 0063 0064 /** 0065 * Reimplemented from QObject 0066 */ 0067 void timerEvent(QTimerEvent *event) override; 0068 0069 public Q_SLOTS: 0070 /** 0071 * Load relevant settings 0072 */ 0073 void loadSettings(); 0074 0075 /** 0076 * Save settings 0077 */ 0078 void saveSettings(); 0079 0080 protected Q_SLOTS: 0081 /** 0082 * Quits the application 0083 */ 0084 void slotQuit(); 0085 0086 /** 0087 * Open the configuration dialog 0088 */ 0089 void slotConfigDialog(); 0090 0091 /** 0092 * This slot is called when a bookmark should be added. 0093 * 0094 * @param checked TRUE if the action is checked 0095 */ 0096 void slotAddBookmarks(); 0097 0098 /** 0099 * This slot is connected to the Smb4KWalletManager::initialized() signal. 0100 * It checks the state of the wallet manager and sets the icon in the status 0101 * bar accordingly. 0102 */ 0103 void slotWalletManagerInitialized(); 0104 0105 /** 0106 * This slot shows a busy bar and a status message according to the action performed by 0107 * the client. It is connected to the Smb4KClient::aboutToStart() signal. 0108 * 0109 * @param item The network item 0110 * 0111 * @param process The process 0112 */ 0113 void slotClientAboutToStart(const NetworkItemPtr &item, int process); 0114 0115 /** 0116 * this slot shows a status message according to the action that was just finished by the 0117 * client and hides the status bar if appropriate. It is connected to the Smb4KClient::finished() 0118 * signal. 0119 * 0120 * @param item The network item 0121 * 0122 * @param process The process 0123 */ 0124 void slotClientFinished(const NetworkItemPtr &item, int process); 0125 0126 /** 0127 * This slot shows a status message according to the action performed by the 0128 * mounter as well as a busy bar. It is connected to the Smb4KMounter::aboutToStart() 0129 * signal. 0130 * @param process The process 0131 */ 0132 void slotMounterAboutToStart(int process); 0133 0134 /** 0135 * This shows a status message according to the action that was just finished by 0136 * the mounter and hides the busy bar if appropriate. It is connected to the 0137 * Smb4KMounter::finished() signal. 0138 * @param process The process 0139 */ 0140 void slotMounterFinished(int process); 0141 0142 /** 0143 * This slot gives the visual mount feedback in the status bar. It is 0144 * connected to the Smb4KMounter::mounted() signal. 0145 * 0146 * @param share The share object 0147 */ 0148 void slotVisualMountFeedback(const SharePtr &share); 0149 0150 /** 0151 * This slot gives the visual unmount feedback in the status bar. It is 0152 * connected to the Smb4KMounter::unmounted() signal. 0153 * 0154 * @param share The share object 0155 */ 0156 void slotVisualUnmountFeedback(const SharePtr &share); 0157 0158 /** 0159 * This slot shows a message according to the action performed by the synchronizer. 0160 * It is connected to the Smb4KSynchronizer::aboutToStart() signal. 0161 * 0162 * @param dest The path of the destination 0163 */ 0164 void slotSynchronizerAboutToStart(const QString &dest); 0165 0166 /** 0167 * This slot shows a message according to the finished action that were reported 0168 * by the synchronizer. It is connected to the Smb4KSynchronizer::finished() signal. 0169 * 0170 * @param dest The path of the destination 0171 */ 0172 void slotSynchronizerFinished(const QString &dest); 0173 0174 /** 0175 * This slot hides the feedback icon in the status bar. It is connected to 0176 * a QTimer::singleShot() signal. 0177 */ 0178 void slotEndVisualFeedback(); 0179 0180 /** 0181 * Enable/disable the "Add Bookmark" action 0182 */ 0183 void slotEnableBookmarkAction(); 0184 0185 /** 0186 * This slot is connected to the visibilityChanged() signals of the network browser 0187 * dock widget. It is used to get the tool bars right. 0188 * 0189 * @param visible If the dock widget is visible. 0190 */ 0191 void slotNetworkBrowserVisibilityChanged(bool visible); 0192 0193 /** 0194 * This slot is connected to the visibilityChanged() signals of the shares view 0195 * dock widget. It is used to get the tool bars right. 0196 * 0197 * @param visible If the dock widget is visible. 0198 */ 0199 void slotSharesViewVisibilityChanged(bool visible); 0200 0201 /** 0202 * This slot is called when credentials are requested. 0203 * 0204 * @param networkItem The network item 0205 */ 0206 void slotCredentialsRequested(const NetworkItemPtr &networkItem); 0207 0208 private: 0209 void setupActions(); 0210 void setupStatusBar(); 0211 void setupView(); 0212 void setupMenuBar(); 0213 void setupMountIndicator(); 0214 void setupDynamicActionList(QDockWidget *dock); 0215 0216 QProgressBar *m_progressBar; 0217 QLabel *m_passwordIcon; 0218 QLabel *m_feedbackIcon; 0219 Smb4KSystemTray *m_systemTrayWidget; 0220 QWidget *m_focusWidget; 0221 Smb4KNetworkBrowserDockWidget *m_networkBrowserDockWidget; 0222 Smb4KSharesViewDockWidget *m_sharesViewDockWidget; 0223 Smb4KBookmarkMenu *m_bookmarkMenu; 0224 QPointer<Smb4KPasswordDialog> m_passwordDialog; 0225 QList<NetworkItemPtr> m_requestQueue; 0226 int m_timerId; 0227 bool m_quitting; 0228 }; 0229 0230 #endif