VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h

Last change on this file was 104228, checked in by vboxsync, 6 weeks ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in file manager table class(es).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.7 KB
Line 
1/* $Id: UIFileManagerGuestTable.h 104228 2024-04-08 12:40:22Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIFileManagerGuestTable class declaration.
4 */
5
6/*
7 * Copyright (C) 2016-2023 Oracle and/or its affiliates.
8 *
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
26 */
27
28#ifndef FEQT_INCLUDED_SRC_guestctrl_UIFileManagerGuestTable_h
29#define FEQT_INCLUDED_SRC_guestctrl_UIFileManagerGuestTable_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35# include <QUuid>
36
37/* COM includes: */
38#include "CEventListener.h"
39#include "CEventSource.h"
40#include "CGuest.h"
41#include "CGuestSession.h"
42#include "CMachine.h"
43#include "CSession.h"
44#include "CConsole.h"
45
46
47/* GUI includes: */
48#include "UIFileManagerTable.h"
49#include "UIMainEventListener.h"
50
51/* Forward declarations: */
52class CGuestSessionStateChangedEvent;
53class UIActionPool;
54class UIFileSystemItem;
55class UIGuestSessionWidget;
56
57/** This class scans the guest file system by using the VBox Guest Control API
58 * and populates the UIGuestControlFileModel*/
59class UIFileManagerGuestTable : public UIFileManagerTable
60{
61 Q_OBJECT;
62
63signals:
64
65 void sigNewFileOperation(const CProgress &comProgress, const QString &strTableName);
66 void sigStateChanged(bool fSessionRunning);
67
68public:
69
70 UIFileManagerGuestTable(UIActionPool *pActionPool, const CMachine &comMachine, QWidget *pParent = 0);
71 ~UIFileManagerGuestTable();
72 void copyGuestToHost(const QString& hostDestinationPath);
73 void copyHostToGuest(const QStringList &hostSourcePathList,
74 const QString &strDestination = QString());
75 QUuid machineId();
76 bool isGuestSessionRunning() const;
77 void setIsCurrent(bool fIsCurrent);
78 virtual bool isWindowsFileSystem() const RT_OVERRIDE RT_FINAL;
79
80protected:
81
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;
93 /** @name Copy/Cut guest-to-guest stuff.
94 * @{ */
95 /** Disable/enable paste action depending on the m_eFileOperationType. */
96 virtual void setPasteActionEnabled(bool fEnabled) RT_OVERRIDE RT_FINAL;
97 virtual void pasteCutCopiedObjects() RT_OVERRIDE RT_FINAL;
98 /** @} */
99 virtual void toggleForwardBackwardActions() RT_OVERRIDE RT_FINAL;
100 virtual void setState();
101 virtual void setSessionDependentWidgetsEnabled();
102
103private slots:
104
105 void sltGuestSessionPanelToggled(bool fChecked);
106 void sltGuestSessionUnregistered(CGuestSession guestSession);
107 void sltGuestSessionRegistered(CGuestSession guestSession);
108 void sltGuestSessionStateChanged(const CGuestSessionStateChangedEvent &cEvent);
109 void sltOpenGuestSession(QString strUserName, QString strPassword);
110 void sltHandleCloseSessionRequest();
111 void sltMachineStateChange(const QUuid &uMachineId, const KMachineState state);
112 void sltCommitDataSignalReceived();
113 void sltAdditionsStateChange();
114 virtual void sltRetranslateUI() RT_OVERRIDE RT_FINAL;
115
116private:
117
118 enum State
119 {
120 State_InvalidMachineReference,
121 State_MachineNotRunning,
122 State_NoGuestAdditions,
123 State_GuestAdditionsTooOld,
124 State_SessionPossible,
125 State_SessionRunning,
126 State_MachinePaused,
127 State_SessionError,
128 State_Max
129 };
130
131 KFsObjType fileType(const CFsObjInfo &fsInfo);
132 KFsObjType fileType(const CGuestFsObjInfo &fsInfo);
133
134 void prepareActionConnections();
135 bool checkGuestSession();
136 QString permissionString(const CFsObjInfo &fsInfo);
137 bool isFileObjectHidden(const CFsObjInfo &fsInfo);
138
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);
146 void cleanupGuestListener();
147 void cleanupGuestSessionListener();
148 void cleanupConsoleListener();
149 void prepareGuestSessionPanel();
150 bool openGuestSession(const QString& strUserName, const QString& strPassword);
151 void closeGuestSession();
152 bool openMachineSession();
153 bool closeMachineSession();
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);
156 void setStateAndEnableWidgets();
157
158 void initFileTable();
159 void cleanAll();
160 void manageConnection(bool fConnect, QAction *pAction, void (UIFileManagerGuestTable::*fptr)(void));
161 CGuest m_comGuest;
162 CGuestSession m_comGuestSession;
163 CSession m_comSession;
164 CMachine m_comMachine;
165 CConsole m_comConsole;
166
167 ComObjPtr<UIMainEventListenerImpl> m_pQtGuestListener;
168 ComObjPtr<UIMainEventListenerImpl> m_pQtSessionListener;
169 ComObjPtr<UIMainEventListenerImpl> m_pQtConsoleListener;
170 CEventListener m_comSessionListener;
171 CEventListener m_comGuestListener;
172 CEventListener m_comConsoleListener;
173 UIGuestSessionWidget *m_pGuestSessionWidget;
174 /** True if this table is the current table in parents tab widget. */
175 bool m_fIsCurrent;
176 State m_enmState;
177 const char *pszMinimumGuestAdditionVersion;
178};
179
180#endif /* !FEQT_INCLUDED_SRC_guestctrl_UIFileManagerGuestTable_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use