VirtualBox

Changeset 75760 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 27, 2018 7:22:31 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Implementing what's needed for guest-to-guest copy/cut operations. Not fully working. I will wait until we have an API function.

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  
    681681UIGuestControlFileTable::UIGuestControlFileTable(UIActionPool *pActionPool, QWidget *pParent /* = 0 */)
    682682    :QIWithRetranslateUI<QWidget>(pParent)
     683    , m_eFileOperationType(FileOperationType_None)
    683684    , m_pRootItem(0)
    684685    , m_pLocationLabel(0)
     
    11291130void UIGuestControlFileTable::sltCopy()
    11301131{
    1131 
    11321132    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);
    11371135}
    11381136
     
    11401138{
    11411139    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);
    11461142}
    11471143
    11481144void UIGuestControlFileTable::sltPaste()
    11491145{
    1150     // paste them
    11511146    m_copyCutBuffer.clear();
    1152     //m_pPaste->setEnabled(false);
     1147
     1148    m_eFileOperationType = FileOperationType_None;
     1149    setPasteActionEnabled(false);
    11531150}
    11541151
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.h

    r75673 r75760  
    286286
    287287protected:
     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    };
    288298
    289299    void retranslateUi();
     
    308318    virtual void     createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) = 0;
    309319    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
    310329    QString          fileTypeString(FileObjectType type);
    311330    /* @p item index is item location in model not in 'proxy' model */
     
    331350    /** Stores the drive letters the file system has (for windows system). For non-windows
    332351     *  systems this is empty and for windows system it should at least contain C:/ */
    333     QStringList m_driveLetterList;
     352    QStringList              m_driveLetterList;
    334353    /** 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;
    336355    /** Paths of the source file objects are stored in this map to delete those
    337356     * 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;
    339362
    340363private slots:
     
    360383     *  drive letter are direct children of the start directory. On other systems start directory is '/' */
    361384    void            populateStartDirectory(UIFileTableItem *startItem);
     385    /** Root index of the m_pModel */
    362386    QModelIndex     currentRootIndex() const;
    363387    /* Searches the content of m_pSearchLineEdit within the current items' names and selects the item if found. */
     
    375399    QGridLayout     *m_pMainLayout;
    376400    QComboBox       *m_pLocationComboBox;
    377     /** The absolue path list of the file objects which user has chosen to cut/copy. this
    378      *  list will be cleaned after a paste operation or overwritten by a subsequent cut/copy */
    379     QStringList      m_copyCutBuffer;
    380401    QILineEdit      *m_pSearchLineEdit;
    381402    QILabel         *m_pWarningLabel;
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.cpp

    r75732 r75760  
    591591    }
    592592    setSelectionDependentActionsEnabled(false);
     593    setPasteActionEnabled(false);
    593594}
    594595
     
    607608    menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Rename));
    608609    menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_CreateNewDirectory));
    609     /* Hide cut, copy, and paste for now. We will implement those
    610        when we have an API for host file operations: */
    611610    menu.addSeparator();
    612611    menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Copy));
     
    620619    menu.exec(pWidget->mapToGlobal(point));
    621620}
     621
     622void UIGuestFileTable::setPasteActionEnabled(bool fEnabled)
     623{
     624    m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Paste)->setEnabled(fEnabled);
     625}
     626
     627void 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
    622640
    623641void UIGuestFileTable::prepareActionConnections()
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.h

    r75732 r75760  
    6464    virtual void    prepareToolbar() /* override */;
    6565    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    /** @} */
    6672
    6773private:
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIHostFileTable.h

    r75619 r75760  
    5151    virtual void    prepareToolbar() /* override */;
    5252    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    /** @} */
    5359
    5460private:
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette