Changeset 75760 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 27, 2018 7:22:31 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/guestctrl
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.cpp
r75685 r75760 681 681 UIGuestControlFileTable::UIGuestControlFileTable(UIActionPool *pActionPool, QWidget *pParent /* = 0 */) 682 682 :QIWithRetranslateUI<QWidget>(pParent) 683 , m_eFileOperationType(FileOperationType_None) 683 684 , m_pRootItem(0) 684 685 , m_pLocationLabel(0) … … 1129 1130 void UIGuestControlFileTable::sltCopy() 1130 1131 { 1131 1132 1132 m_copyCutBuffer = selectedItemPathList(); 1133 // if (!m_copyCutBuffer.isEmpty()) 1134 // m_pPaste->setEnabled(true); 1135 // else 1136 // m_pPaste->setEnabled(false); 1133 m_eFileOperationType = FileOperationType_Copy; 1134 setPasteActionEnabled(true); 1137 1135 } 1138 1136 … … 1140 1138 { 1141 1139 m_copyCutBuffer = selectedItemPathList(); 1142 // if (!m_copyCutBuffer.isEmpty()) 1143 // m_pPaste->setEnabled(true); 1144 // else 1145 // m_pPaste->setEnabled(false); 1140 m_eFileOperationType = FileOperationType_Cut; 1141 setPasteActionEnabled(true); 1146 1142 } 1147 1143 1148 1144 void UIGuestControlFileTable::sltPaste() 1149 1145 { 1150 // paste them1151 1146 m_copyCutBuffer.clear(); 1152 //m_pPaste->setEnabled(false); 1147 1148 m_eFileOperationType = FileOperationType_None; 1149 setPasteActionEnabled(false); 1153 1150 } 1154 1151 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.h
r75673 r75760 286 286 287 287 protected: 288 /** This enum is used when performing a gueest-to-guest or host-to-host 289 * file operations. Paths of source file objects are kept in a single buffer 290 * and a flag to determine if it is a cut or copy operation is needed */ 291 enum FileOperationType 292 { 293 FileOperationType_Copy, 294 FileOperationType_Cut, 295 FileOperationType_None, 296 FileOperationType_Max 297 }; 288 298 289 299 void retranslateUi(); … … 308 318 virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) = 0; 309 319 virtual bool event(QEvent *pEvent) /* override */; 320 /** @name Copy/Cut guest-to-guest (host-to-host) stuff. 321 * @{ */ 322 /** Disable/enable paste action depending on the m_eFileOperationType. */ 323 virtual void setPasteActionEnabled(bool fEnabled) = 0; 324 virtual void pasteCutCopiedObjects() = 0; 325 /** stores the type of the pending guest-to-guest (host-to-host) file operation. */ 326 FileOperationType m_eFileOperationType; 327 /** @} */ 328 310 329 QString fileTypeString(FileObjectType type); 311 330 /* @p item index is item location in model not in 'proxy' model */ … … 331 350 /** Stores the drive letters the file system has (for windows system). For non-windows 332 351 * systems this is empty and for windows system it should at least contain C:/ */ 333 QStringList m_driveLetterList;352 QStringList m_driveLetterList; 334 353 /** The set of actions which need some selection to work on. Like cut, copy etc. */ 335 QSet<QAction*> m_selectionDependentActions;354 QSet<QAction*> m_selectionDependentActions; 336 355 /** Paths of the source file objects are stored in this map to delete those 337 356 * after the copy progress completed notification is receieved */ 338 QMap<QUuid, QStringList> m_deleteAfterCopyCache; 357 QMap<QUuid, QStringList> m_deleteAfterCopyCache; 358 /** The absolue path list of the file objects which user has chosen to cut/copy. this 359 * list will be cleaned after a paste operation or overwritten by a subsequent cut/copy. 360 * Currently only used by the guest side. */ 361 QStringList m_copyCutBuffer; 339 362 340 363 private slots: … … 360 383 * drive letter are direct children of the start directory. On other systems start directory is '/' */ 361 384 void populateStartDirectory(UIFileTableItem *startItem); 385 /** Root index of the m_pModel */ 362 386 QModelIndex currentRootIndex() const; 363 387 /* Searches the content of m_pSearchLineEdit within the current items' names and selects the item if found. */ … … 375 399 QGridLayout *m_pMainLayout; 376 400 QComboBox *m_pLocationComboBox; 377 /** The absolue path list of the file objects which user has chosen to cut/copy. this378 * list will be cleaned after a paste operation or overwritten by a subsequent cut/copy */379 QStringList m_copyCutBuffer;380 401 QILineEdit *m_pSearchLineEdit; 381 402 QILabel *m_pWarningLabel; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.cpp
r75732 r75760 591 591 } 592 592 setSelectionDependentActionsEnabled(false); 593 setPasteActionEnabled(false); 593 594 } 594 595 … … 607 608 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Rename)); 608 609 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_CreateNewDirectory)); 609 /* Hide cut, copy, and paste for now. We will implement those610 when we have an API for host file operations: */611 610 menu.addSeparator(); 612 611 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Copy)); … … 620 619 menu.exec(pWidget->mapToGlobal(point)); 621 620 } 621 622 void UIGuestFileTable::setPasteActionEnabled(bool fEnabled) 623 { 624 m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Paste)->setEnabled(fEnabled); 625 } 626 627 void UIGuestFileTable::pasteCutCopiedObjects() 628 { 629 /** Wait until we have a API function that would take multiple source objects 630 * and return a single IProgress instance: */ 631 // QVector<KFileCopyFlag> fileCopyFlags; 632 // QVector<KDirectoryCopyFlag> directoryCopyFlags; 633 634 // foreach (const QString &strPath, m_copyCutBuffer) 635 // { 636 637 // } 638 } 639 622 640 623 641 void UIGuestFileTable::prepareActionConnections() -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.h
r75732 r75760 64 64 virtual void prepareToolbar() /* override */; 65 65 virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) /* override */; 66 /** @name Copy/Cut guest-to-guest stuff. 67 * @{ */ 68 /** Disable/enable paste action depending on the m_eFileOperationType. */ 69 virtual void setPasteActionEnabled(bool fEnabled) /* override */; 70 virtual void pasteCutCopiedObjects() /* override */; 71 /** @} */ 66 72 67 73 private: -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIHostFileTable.h
r75619 r75760 51 51 virtual void prepareToolbar() /* override */; 52 52 virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) /* override */; 53 /** @name Copy/Cut host-to-host stuff. Currently not implemented. 54 * @{ */ 55 /** Disable/enable paste action depending on the m_eFileOperationType. */ 56 virtual void setPasteActionEnabled(bool) /* override */{} 57 virtual void pasteCutCopiedObjects() /* override */{} 58 /** @} */ 53 59 54 60 private:
Note:
See TracChangeset
for help on using the changeset viewer.