VirtualBox

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


Ignore:
Timestamp:
Oct 29, 2018 1:56:53 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Continue working on the file manager actions

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.cpp

    r75136 r75148  
    871871}
    872872
    873 void UIGuestControlFileTable::prepareActions()
    874 {
    875     if (!m_pToolBar)
    876         return;
    877 
    878     // m_pGoUp = new QAction(this);
    879     // if (m_pGoUp)
    880     // {
    881     //     connect(m_pGoUp, &QAction::triggered, this, &UIGuestControlFileTable::sltGoUp);
    882     //     m_pGoUp->setIcon(UIIconPool::iconSet(QString(":/arrow_up_10px_x2.png")));
    883     //     m_pToolBar->addAction(m_pGoUp);
    884     // }
    885 
    886     // m_pGoHome = new QAction(this);
    887     // if (m_pGoHome)
    888     // {
    889     //     connect(m_pGoHome, &QAction::triggered, this, &UIGuestControlFileTable::sltGoHome);
    890     //     m_pGoHome->setIcon(UIIconPool::iconSet(QString(":/nw_24px.png")));
    891     //     m_pToolBar->addAction(m_pGoHome);
    892     // }
    893 
    894     // m_pRefresh = new QAction(this);
    895     // if (m_pRefresh)
    896     // {
    897     //     connect(m_pRefresh, &QAction::triggered, this, &UIGuestControlFileTable::sltRefresh);
    898     //     m_pRefresh->setIcon(UIIconPool::iconSet(QString(":/refresh_24px.png")));
    899     //     m_pToolBar->addAction(m_pRefresh);
    900     // }
    901 
    902     //m_pToolBar->addSeparator();
    903 
    904     // m_pDelete = new QAction(this);
    905     // if (m_pDelete)
    906     // {
    907     //     connect(m_pDelete, &QAction::triggered, this, &UIGuestControlFileTable::sltDelete);
    908     //     m_pDelete->setIcon(UIIconPool::iconSet(QString(":/vm_delete_32px.png")));
    909     //     m_pToolBar->addAction(m_pDelete);
    910     //     m_selectionDependentActions.push_back(m_pDelete);
    911     // }
    912 
    913     // m_pRename = new QAction(this);
    914     // if (m_pRename)
    915     // {
    916     //     connect(m_pRename, &QAction::triggered, this, &UIGuestControlFileTable::sltRename);
    917     //     m_pRename->setIcon(UIIconPool::iconSet(QString(":/name_16px_x2.png")));
    918     //     m_pToolBar->addAction(m_pRename);
    919     //     m_selectionDependentActions.push_back(m_pRename);
    920     // }
    921 
    922     // m_pCreateNewDirectory = new QAction(this);
    923     // if (m_pCreateNewDirectory)
    924     // {
    925     //     connect(m_pCreateNewDirectory, &QAction::triggered, this, &UIGuestControlFileTable::sltCreateNewDirectory);
    926     //     m_pCreateNewDirectory->setIcon(UIIconPool::iconSet(QString(":/sf_add_16px.png")));
    927     //     m_pToolBar->addAction(m_pCreateNewDirectory);
    928     // }
    929 
    930     // m_pCopy = new QAction(this);
    931     // if (m_pCopy)
    932     // {
    933     //     m_pCopy->setIcon(UIIconPool::iconSet(QString(":/fd_copy_32px.png")));
    934     //     m_pToolBar->addAction(m_pCopy);
    935     //     connect(m_pCopy, &QAction::triggered, this, &UIGuestControlFileTable::sltCopy);
    936     //     m_selectionDependentActions.push_back(m_pCopy);
    937     // }
    938 
    939     // m_pCut = new QAction(this);
    940     // if (m_pCut)
    941     // {
    942     //     m_pCut->setIcon(UIIconPool::iconSet(QString(":/fd_move_32px.png")));
    943     //     m_pToolBar->addAction(m_pCut);
    944     //     connect(m_pCut, &QAction::triggered, this, &UIGuestControlFileTable::sltCut);
    945     //     m_selectionDependentActions.push_back(m_pCut);
    946     // }
    947 
    948     // m_pPaste = new QAction(this);
    949     // if (m_pPaste)
    950     // {
    951     //     m_pPaste->setIcon(UIIconPool::iconSet(QString(":/shared_clipboard_16px.png")));
    952     //     m_pToolBar->addAction(m_pPaste);
    953     //     connect(m_pPaste, &QAction::triggered, this, &UIGuestControlFileTable::sltPaste);
    954     //     m_pPaste->setEnabled(false);
    955     // }
    956 
    957     // m_pToolBar->addSeparator();
    958 
    959     // m_pShowProperties = new QAction(this);
    960     // {
    961     //     m_pShowProperties->setIcon(UIIconPool::iconSet(QString(":/session_info_32px.png")));
    962     //     m_pToolBar->addAction(m_pShowProperties);
    963     //     connect(m_pShowProperties, &QAction::triggered, this, &UIGuestControlFileTable::sltShowProperties);
    964     //     m_selectionDependentActions.push_back(m_pShowProperties);
    965     // }
    966 
    967     // m_pSelectAll = new QAction(this);
    968     // {
    969     //     m_pSelectAll->setIcon(UIIconPool::iconSet(QString(":/session_info_32px.png")));
    970     //     m_pToolBar->addAction(m_pSelectAll);
    971     //     connect(m_pSelectAll, &QAction::triggered, this, &UIGuestControlFileTable::sltSelectAll);
    972     // }
    973 
    974     // m_pInvertSelection = new QAction(this);
    975     // {
    976     //     m_pInvertSelection->setIcon(UIIconPool::iconSet(QString(":/session_info_32px.png")));
    977     //     m_pToolBar->addAction(m_pInvertSelection);
    978     //     connect(m_pInvertSelection, &QAction::triggered, this, &UIGuestControlFileTable::sltInvertSelection);
    979     // }
    980 
    981     disableSelectionDependentActions();
    982 }
    983 
    984873void UIGuestControlFileTable::updateCurrentLocationEdit(const QString& strLocation)
    985874{
     
    13251214}
    13261215
     1216
     1217void UIGuestControlFileTable::prepareActionConnections()
     1218{
     1219    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_GoUp), &QAction::triggered,
     1220            this, &UIGuestControlFileTable::sltGoUp);
     1221    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_GoUp), &QAction::triggered,
     1222            this, &UIGuestControlFileTable::sltGoUp);
     1223    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_GoHome), &QAction::triggered,
     1224            this, &UIGuestControlFileTable::sltGoHome);
     1225    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_GoHome), &QAction::triggered,
     1226            this, &UIGuestControlFileTable::sltGoHome);
     1227    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Refresh), &QAction::triggered,
     1228            this, &UIGuestControlFileTable::sltRefresh);
     1229    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Refresh), &QAction::triggered,
     1230            this, &UIGuestControlFileTable::sltRefresh);
     1231    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Delete), &QAction::triggered,
     1232            this, &UIGuestControlFileTable::sltDelete);
     1233    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Delete), &QAction::triggered,
     1234            this, &UIGuestControlFileTable::sltDelete);
     1235    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Rename), &QAction::triggered,
     1236            this, &UIGuestControlFileTable::sltRename);
     1237    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Rename), &QAction::triggered,
     1238            this, &UIGuestControlFileTable::sltRename);
     1239    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Copy), &QAction::triggered,
     1240            this, &UIGuestControlFileTable::sltCopy);
     1241    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Copy), &QAction::triggered,
     1242            this, &UIGuestControlFileTable::sltCopy);
     1243    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Cut), &QAction::triggered,
     1244            this, &UIGuestControlFileTable::sltCut);
     1245    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Cut), &QAction::triggered,
     1246            this, &UIGuestControlFileTable::sltCut);
     1247    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Paste), &QAction::triggered,
     1248            this, &UIGuestControlFileTable::sltPaste);
     1249    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Paste), &QAction::triggered,
     1250            this, &UIGuestControlFileTable::sltPaste);
     1251    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_SelectAll), &QAction::triggered,
     1252            this, &UIGuestControlFileTable::sltSelectAll);
     1253    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_SelectAll), &QAction::triggered,
     1254            this, &UIGuestControlFileTable::sltSelectAll);
     1255    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_InvertSelection), &QAction::triggered,
     1256            this, &UIGuestControlFileTable::sltInvertSelection);
     1257    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_InvertSelection), &QAction::triggered,
     1258            this, &UIGuestControlFileTable::sltInvertSelection);
     1259    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_ShowProperties), &QAction::triggered,
     1260            this, &UIGuestControlFileTable::sltShowProperties);
     1261    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_ShowProperties), &QAction::triggered,
     1262            this, &UIGuestControlFileTable::sltShowProperties);
     1263    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_CreateNewDirectory), &QAction::triggered,
     1264            this, &UIGuestControlFileTable::sltCreateNewDirectory);
     1265    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_CreateNewDirectory), &QAction::triggered,
     1266            this, &UIGuestControlFileTable::sltCreateNewDirectory);
     1267}
     1268
    13271269void UIGuestControlFileTable::sltLocationComboCurrentChange(const QString &strLocation)
    13281270{
     
    14211363void UIGuestControlFileTable::retranslateUi()
    14221364{
    1423     // if (m_pGoUp)
    1424     // {
    1425     //     m_pGoUp->setText(QApplication::translate("UIGuestControlFileManager", "Move one level up"));
    1426     //     m_pGoUp->setToolTip(QApplication::translate("UIGuestControlFileManager", "Move one level up"));
    1427     //     m_pGoUp->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Move one level up"));
    1428     // }
    1429 
    1430     // if (m_pGoHome)
    1431     // {
    1432     //     m_pGoHome->setText(QApplication::translate("UIGuestControlFileManager", "Go to home directory"));
    1433     //     m_pGoHome->setToolTip(QApplication::translate("UIGuestControlFileManager", "Go to home directory"));
    1434     //     m_pGoHome->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Go to home directory"));
    1435     // }
    1436 
    1437     // if (m_pRename)
    1438     // {
    1439     //     m_pRename->setText(QApplication::translate("UIGuestControlFileManager", "Rename the selected item"));
    1440     //     m_pRename->setToolTip(QApplication::translate("UIGuestControlFileManager", "Rename the selected item"));
    1441     //     m_pRename->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Rename the selected item"));
    1442     // }
    1443 
    1444     // if (m_pRefresh)
    1445     // {
    1446     //     m_pRefresh->setText(QApplication::translate("UIGuestControlFileManager", "Refresh"));
    1447     //     m_pRefresh->setToolTip(QApplication::translate("UIGuestControlFileManager", "Refresh the current directory"));
    1448     //     m_pRefresh->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Refresh the current directory"));
    1449     // }
    1450     // if (m_pDelete)
    1451     // {
    1452     //     m_pDelete->setText(QApplication::translate("UIGuestControlFileManager", "Delete"));
    1453     //     m_pDelete->setToolTip(QApplication::translate("UIGuestControlFileManager", "Delete the selected item(s)"));
    1454     //     m_pDelete->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Delete the selected item(s)"));
    1455     // }
    1456 
    1457     // if (m_pCreateNewDirectory)
    1458     // {
    1459     //     m_pCreateNewDirectory->setText(QApplication::translate("UIGuestControlFileManager", "Create new directory"));
    1460     //     m_pCreateNewDirectory->setToolTip(QApplication::translate("UIGuestControlFileManager", "Create new directory"));
    1461     //     m_pCreateNewDirectory->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Create new directory"));
    1462     // }
    1463 
    1464     // if (m_pCopy)
    1465     // {
    1466     //     m_pCopy->setText(QApplication::translate("UIGuestControlFileManager", "Copy the selected item"));
    1467     //     m_pCopy->setToolTip(QApplication::translate("UIGuestControlFileManager", "Copy the selected item(s)"));
    1468     //     m_pCopy->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Copy the selected item(s)"));
    1469 
    1470     // }
    1471 
    1472     // if (m_pCut)
    1473     // {
    1474     //     m_pCut->setText(QApplication::translate("UIGuestControlFileManager", "Cut the selected item(s)"));
    1475     //     m_pCut->setToolTip(QApplication::translate("UIGuestControlFileManager", "Cut the selected item(s)"));
    1476     //     m_pCut->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Cut the selected item(s)"));
    1477 
    1478     // }
    1479 
    1480     // if ( m_pPaste)
    1481     // {
    1482     //     m_pPaste->setText(QApplication::translate("UIGuestControlFileManager", "Paste the copied item(s)"));
    1483     //     m_pPaste->setToolTip(QApplication::translate("UIGuestControlFileManager", "Paste the copied item(s)"));
    1484     //     m_pPaste->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Paste the copied item(s)"));
    1485     // }
    1486 
    1487     // if (m_pShowProperties)
    1488     // {
    1489     //     m_pShowProperties->setText(QApplication::translate("UIGuestControlFileManager", "Show the properties of the selected item(s)"));
    1490     //     m_pShowProperties->setToolTip(QApplication::translate("UIGuestControlFileManager", "Show the properties of the selected item(s)"));
    1491     //     m_pShowProperties->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Show the properties of the selected item(s)"));
    1492     // }
    1493 
    1494     // if (m_pSelectAll)
    1495     // {
    1496     //     m_pSelectAll->setText(QApplication::translate("UIGuestControlFileManager", "Select All"));
    1497     //     m_pSelectAll->setToolTip(QApplication::translate("UIGuestControlFileManager", "Select All"));
    1498     //     m_pSelectAll->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Select All"));
    1499     // }
    1500 
    1501     // if (m_pInvertSelection)
    1502     // {
    1503     //     m_pInvertSelection->setText(QApplication::translate("UIGuestControlFileManager", "Invert Selection"));
    1504     //     m_pInvertSelection->setToolTip(QApplication::translate("UIGuestControlFileManager", "Invert Selection"));
    1505     //     m_pInvertSelection->setStatusTip(QApplication::translate("UIGuestControlFileManager", "Invert Selection"));
    1506     // }
    15071365}
    15081366
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.h

    r75136 r75148  
    282282     *  drive letters */
    283283    virtual void     determineDriveLetters() = 0;
     284    virtual void     prepareToolbar() = 0;
    284285    QString          fileTypeString(FileObjectType type);
    285286    /* @p item index is item location in model not in 'proxy' model */
     
    292293    bool             eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
    293294    CGuestFsObjInfo  guestFsObjectInfo(const QString& path, CGuestSession &comGuestSession) const;
    294     virtual void     prepareActions();
     295    void             enableSelectionDependentActions();
     296    void             disableSelectionDependentActions();
     297    void             prepareActionConnections();
     298
    295299
    296300    UIFileTableItem         *m_pRootItem;
    297301    QILabel                 *m_pLocationLabel;
    298     // QAction                 *m_pCopy;
    299     // QAction                 *m_pCut;
    300     // QAction                 *m_pPaste;
    301302    UIPropertiesDialog      *m_pPropertiesDialog;
    302303    UIActionPool            *m_pActionPool;
     
    307308    QStringList m_driveLetterList;
    308309
     310
    309311protected slots:
    310312
    311313    void sltReceiveDirectoryStatistics(UIDirectoryStatistics statictics);
     314    void sltCreateNewDirectory();
    312315
    313316private slots:
     
    325328    void sltPaste();
    326329    void sltShowProperties();
    327     void sltCreateNewDirectory();
     330
    328331    void sltSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
    329332    void sltLocationComboCurrentChange(const QString &strLocation);
     
    341344    /** Shows a modal dialog with a line edit for user to enter a new directory name and return the entered string*/
    342345    QString         getNewDirectoryName();
    343     void            enableSelectionDependentActions();
    344     void            disableSelectionDependentActions();
    345346    void            deSelectUpDirectoryItem();
    346347    void            setSelectionForAll(QItemSelectionModel::SelectionFlags flags);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.cpp

    r75136 r75148  
    148148    :UIGuestControlFileTable(pActionPool, pParent)
    149149{
    150     prepareActions();
     150    prepareToolbar();
     151    prepareActionConnections();
    151152    retranslateUi();
    152153}
     
    589590}
    590591
    591 void UIGuestFileTable::prepareActions()
     592void UIGuestFileTable::prepareToolbar()
    592593{
    593594    if (m_pToolBar && m_pActionPool)
     
    596597        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_GoHome));
    597598        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Refresh));
    598 
    599599        m_pToolBar->addSeparator();
    600600        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Delete));
     
    612612    }
    613613
    614     UIGuestControlFileTable::prepareActions();
     614    disableSelectionDependentActions();
    615615}
    616616
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.h

    r75136 r75148  
    5353    virtual void    showProperties() /* override */;
    5454    virtual void    determineDriveLetters() /* override */;
    55     virtual void    prepareActions() /* override */;
     55    virtual void    prepareToolbar() /* override */;
     56
    5657
    5758private:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIHostFileTable.cpp

    r75136 r75148  
    129129{
    130130    initializeFileTree();
     131    prepareToolbar();
     132    prepareActionConnections();
    131133    retranslateUi();
    132     prepareActions();
    133134}
    134135
     
    140141}
    141142
    142 void UIHostFileTable::prepareActions()
     143void UIHostFileTable::prepareToolbar()
    143144{
    144145    if (m_pToolBar && m_pActionPool)
     
    172173    //     m_pPaste->setVisible(false);
    173174
    174     UIGuestControlFileTable::prepareActions();
     175    disableSelectionDependentActions();
    175176}
    176177
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIHostFileTable.h

    r75136 r75148  
    4747    virtual void    showProperties() /* override */;
    4848    virtual void    determineDriveLetters() /* override */;
     49    virtual void    prepareToolbar() /* override */;
    4950
    5051private:
    5152
    52     void prepareActions();
    5353    QString permissionString(QFileDevice::Permissions permissions);
    5454};
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