[71025] | 1 | /* $Id: UIFileManagerGuestTable.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
[76177] | 3 | * VBox Qt GUI - UIFileManagerGuestTable class declaration.
|
---|
[71025] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[106061] | 7 | * Copyright (C) 2016-2024 Oracle and/or its affiliates.
|
---|
[71025] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
| 25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
[71025] | 26 | */
|
---|
| 27 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_guestctrl_UIFileManagerGuestTable_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_guestctrl_UIFileManagerGuestTable_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[71025] | 33 |
|
---|
[75610] | 34 | /* Qt includes: */
|
---|
| 35 | # include <QUuid>
|
---|
| 36 |
|
---|
[71025] | 37 | /* COM includes: */
|
---|
[92688] | 38 | #include "CEventListener.h"
|
---|
| 39 | #include "CEventSource.h"
|
---|
| 40 | #include "CGuest.h"
|
---|
[71133] | 41 | #include "CGuestSession.h"
|
---|
[92688] | 42 | #include "CMachine.h"
|
---|
| 43 | #include "CSession.h"
|
---|
[92790] | 44 | #include "CConsole.h"
|
---|
[71025] | 45 |
|
---|
[92688] | 46 |
|
---|
[71133] | 47 | /* GUI includes: */
|
---|
[76177] | 48 | #include "UIFileManagerTable.h"
|
---|
[92688] | 49 | #include "UIMainEventListener.h"
|
---|
[71133] | 50 |
|
---|
[75136] | 51 | /* Forward declarations: */
|
---|
[92847] | 52 | class CGuestSessionStateChangedEvent;
|
---|
[75136] | 53 | class UIActionPool;
|
---|
[102485] | 54 | class UIFileSystemItem;
|
---|
[93697] | 55 | class UIGuestSessionWidget;
|
---|
[75136] | 56 |
|
---|
[71645] | 57 | /** This class scans the guest file system by using the VBox Guest Control API
|
---|
| 58 | * and populates the UIGuestControlFileModel*/
|
---|
[76177] | 59 | class UIFileManagerGuestTable : public UIFileManagerTable
|
---|
[71169] | 60 | {
|
---|
| 61 | Q_OBJECT;
|
---|
| 62 |
|
---|
[77528] | 63 | signals:
|
---|
| 64 |
|
---|
[92917] | 65 | void sigNewFileOperation(const CProgress &comProgress, const QString &strTableName);
|
---|
[93180] | 66 | void sigStateChanged(bool fSessionRunning);
|
---|
[77528] | 67 |
|
---|
[71169] | 68 | public:
|
---|
| 69 |
|
---|
[92688] | 70 | UIFileManagerGuestTable(UIActionPool *pActionPool, const CMachine &comMachine, QWidget *pParent = 0);
|
---|
[92814] | 71 | ~UIFileManagerGuestTable();
|
---|
[75903] | 72 | void copyGuestToHost(const QString& hostDestinationPath);
|
---|
| 73 | void copyHostToGuest(const QStringList &hostSourcePathList,
|
---|
[75897] | 74 | const QString &strDestination = QString());
|
---|
[92688] | 75 | QUuid machineId();
|
---|
[92847] | 76 | bool isGuestSessionRunning() const;
|
---|
[92979] | 77 | void setIsCurrent(bool fIsCurrent);
|
---|
[103982] | 78 | virtual bool isWindowsFileSystem() const RT_OVERRIDE RT_FINAL;
|
---|
[71169] | 79 |
|
---|
[71185] | 80 | protected:
|
---|
[71181] | 81 |
|
---|
[103982] | 82 | virtual bool readDirectory(const QString& strPath, UIFileSystemItem *parent, bool isStartDir = false) RT_OVERRIDE RT_FINAL;
|
---|
| 83 | virtual void deleteByItem(UIFileSystemItem *item) RT_OVERRIDE RT_FINAL;
|
---|
| 84 | virtual void goToHomeDirectory() RT_OVERRIDE RT_FINAL;
|
---|
| 85 | virtual bool renameItem(UIFileSystemItem *item, const QString &strOldPath) RT_OVERRIDE RT_FINAL;
|
---|
| 86 | virtual bool createDirectory(const QString &path, const QString &directoryName) RT_OVERRIDE RT_FINAL;
|
---|
| 87 | virtual QString fsObjectPropertyString() RT_OVERRIDE RT_FINAL;
|
---|
| 88 | virtual void showProperties() RT_OVERRIDE RT_FINAL;
|
---|
| 89 | virtual void determineDriveLetters() RT_OVERRIDE RT_FINAL;
|
---|
| 90 | virtual void determinePathSeparator() RT_OVERRIDE RT_FINAL;
|
---|
| 91 | virtual void prepareToolbar() RT_OVERRIDE RT_FINAL;
|
---|
| 92 | virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) RT_OVERRIDE RT_FINAL;
|
---|
[75760] | 93 | /** @name Copy/Cut guest-to-guest stuff.
|
---|
| 94 | * @{ */
|
---|
| 95 | /** Disable/enable paste action depending on the m_eFileOperationType. */
|
---|
[103982] | 96 | virtual void setPasteActionEnabled(bool fEnabled) RT_OVERRIDE RT_FINAL;
|
---|
| 97 | virtual void pasteCutCopiedObjects() RT_OVERRIDE RT_FINAL;
|
---|
[75760] | 98 | /** @} */
|
---|
[103982] | 99 | virtual void toggleForwardBackwardActions() RT_OVERRIDE RT_FINAL;
|
---|
[92860] | 100 | virtual void setState();
|
---|
| 101 | virtual void setSessionDependentWidgetsEnabled();
|
---|
[71563] | 102 |
|
---|
[92711] | 103 | private slots:
|
---|
| 104 |
|
---|
| 105 | void sltGuestSessionPanelToggled(bool fChecked);
|
---|
[92733] | 106 | void sltGuestSessionUnregistered(CGuestSession guestSession);
|
---|
| 107 | void sltGuestSessionRegistered(CGuestSession guestSession);
|
---|
| 108 | void sltGuestSessionStateChanged(const CGuestSessionStateChangedEvent &cEvent);
|
---|
[93697] | 109 | void sltOpenGuestSession(QString strUserName, QString strPassword);
|
---|
[92753] | 110 | void sltHandleCloseSessionRequest();
|
---|
[92765] | 111 | void sltMachineStateChange(const QUuid &uMachineId, const KMachineState state);
|
---|
[92787] | 112 | void sltCommitDataSignalReceived();
|
---|
[92790] | 113 | void sltAdditionsStateChange();
|
---|
[104228] | 114 | virtual void sltRetranslateUI() RT_OVERRIDE RT_FINAL;
|
---|
[92733] | 115 |
|
---|
[71169] | 116 | private:
|
---|
[71185] | 117 |
|
---|
[92860] | 118 | enum State
|
---|
[92765] | 119 | {
|
---|
[92860] | 120 | State_InvalidMachineReference,
|
---|
| 121 | State_MachineNotRunning,
|
---|
| 122 | State_NoGuestAdditions,
|
---|
[100174] | 123 | State_GuestAdditionsTooOld,
|
---|
[92860] | 124 | State_SessionPossible,
|
---|
| 125 | State_SessionRunning,
|
---|
[93726] | 126 | State_MachinePaused,
|
---|
[95711] | 127 | State_SessionError,
|
---|
[92860] | 128 | State_Max
|
---|
[92765] | 129 | };
|
---|
| 130 |
|
---|
[76300] | 131 | KFsObjType fileType(const CFsObjInfo &fsInfo);
|
---|
| 132 | KFsObjType fileType(const CGuestFsObjInfo &fsInfo);
|
---|
[71385] | 133 |
|
---|
[75184] | 134 | void prepareActionConnections();
|
---|
[75732] | 135 | bool checkGuestSession();
|
---|
[75941] | 136 | QString permissionString(const CFsObjInfo &fsInfo);
|
---|
[76626] | 137 | bool isFileObjectHidden(const CFsObjInfo &fsInfo);
|
---|
| 138 |
|
---|
[92688] | 139 | void prepareListener(ComObjPtr<UIMainEventListenerImpl> &Qtistener,
|
---|
| 140 | CEventListener &comEventListener,
|
---|
| 141 | CEventSource comEventSource, QVector<KVBoxEventType>& eventTypes);
|
---|
| 142 |
|
---|
| 143 | void cleanupListener(ComObjPtr<UIMainEventListenerImpl> &QtListener,
|
---|
| 144 | CEventListener &comEventListener,
|
---|
| 145 | CEventSource comEventSource);
|
---|
[92733] | 146 | void cleanupGuestListener();
|
---|
[92790] | 147 | void cleanupGuestSessionListener();
|
---|
| 148 | void cleanupConsoleListener();
|
---|
[92710] | 149 | void prepareGuestSessionPanel();
|
---|
[92790] | 150 | bool openGuestSession(const QString& strUserName, const QString& strPassword);
|
---|
| 151 | void closeGuestSession();
|
---|
| 152 | bool openMachineSession();
|
---|
| 153 | bool closeMachineSession();
|
---|
[100174] | 154 | /* Return 0 if GA is not detected, -1 if it is there but older than @p pszMinimumGuestAdditionVersion, and 1 otherwise. */
|
---|
| 155 | int isGuestAdditionsAvailable(const char* pszMinimumVersion);
|
---|
[92860] | 156 | void setStateAndEnableWidgets();
|
---|
[92688] | 157 |
|
---|
[92733] | 158 | void initFileTable();
|
---|
[92790] | 159 | void cleanAll();
|
---|
[92979] | 160 | void manageConnection(bool fConnect, QAction *pAction, void (UIFileManagerGuestTable::*fptr)(void));
|
---|
[92790] | 161 | CGuest m_comGuest;
|
---|
| 162 | CGuestSession m_comGuestSession;
|
---|
| 163 | CSession m_comSession;
|
---|
| 164 | CMachine m_comMachine;
|
---|
| 165 | CConsole m_comConsole;
|
---|
[92765] | 166 |
|
---|
[92688] | 167 | ComObjPtr<UIMainEventListenerImpl> m_pQtGuestListener;
|
---|
| 168 | ComObjPtr<UIMainEventListenerImpl> m_pQtSessionListener;
|
---|
[92790] | 169 | ComObjPtr<UIMainEventListenerImpl> m_pQtConsoleListener;
|
---|
[92688] | 170 | CEventListener m_comSessionListener;
|
---|
| 171 | CEventListener m_comGuestListener;
|
---|
[92790] | 172 | CEventListener m_comConsoleListener;
|
---|
[93697] | 173 | UIGuestSessionWidget *m_pGuestSessionWidget;
|
---|
[92979] | 174 | /** True if this table is the current table in parents tab widget. */
|
---|
| 175 | bool m_fIsCurrent;
|
---|
[92860] | 176 | State m_enmState;
|
---|
[100174] | 177 | const char *pszMinimumGuestAdditionVersion;
|
---|
[71169] | 178 | };
|
---|
| 179 |
|
---|
[76581] | 180 | #endif /* !FEQT_INCLUDED_SRC_guestctrl_UIFileManagerGuestTable_h */
|
---|