- Timestamp:
- Oct 31, 2018 9:30:01 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
r75196 r75202 1703 1703 virtual void retranslateUi() /* override */ 1704 1704 { 1705 setName(QApplication::translate("UIActionPool", "Go Home"));1705 setName(QApplication::translate("UIActionPool", "Go Home")); 1706 1706 setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager")); 1707 1707 setStatusTip(QApplication::translate("UIActionPool", "Go to home folder")); … … 1847 1847 virtual void retranslateUi() /* override */ 1848 1848 { 1849 setName(QApplication::translate("UIActionPool", "Create NewDirectory"));1849 setName(QApplication::translate("UIActionPool", "Create New Directory")); 1850 1850 setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager")); 1851 1851 setStatusTip(QApplication::translate("UIActionPool", "Create New Directory")); … … 1988 1988 virtual void retranslateUi() /* override */ 1989 1989 { 1990 setName(QApplication::translate("UIActionPool", "Select All"));1990 setName(QApplication::translate("UIActionPool", "Select All")); 1991 1991 setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager")); 1992 1992 setStatusTip(QApplication::translate("UIActionPool", "Select all files objects")); … … 2024 2024 virtual void retranslateUi() /* override */ 2025 2025 { 2026 setName(QApplication::translate("UIActionPool", "Invert Selection"));2026 setName(QApplication::translate("UIActionPool", "Invert Selection")); 2027 2027 setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager")); 2028 2028 setStatusTip(QApplication::translate("UIActionPool", "Invert the current selection")); … … 2060 2060 virtual void retranslateUi() /* override */ 2061 2061 { 2062 setName(QApplication::translate("UIActionPool", "Show Properties"));2062 setName(QApplication::translate("UIActionPool", "Show Properties")); 2063 2063 setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager")); 2064 2064 setStatusTip(QApplication::translate("UIActionPool", "Show the properties of currently selected file object(s)")); -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManager.h
r75196 r75202 128 128 QTextEdit *m_pLogOutput; 129 129 UIToolBar *m_pToolBar; 130 // QAction *m_pCopyGuestToHost;131 // QAction *m_pCopyHostToGuest;132 130 QWidget *m_pFileTableContainerWidget; 133 131 QHBoxLayout *m_pFileTableContainerLayout; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.cpp
r75184 r75202 71 71 signals: 72 72 73 void sigGoUp();74 void sigGoHome();75 void sigRefresh();76 void sigRename();77 void sigCreateNewDirectory();78 void sigDelete();79 void sigCut();80 void sigCopy();81 void sigPaste();82 void sigShowProperties();83 73 void sigSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected); 84 74 … … 91 81 92 82 virtual void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected) /*override */; 93 void contextMenuEvent(QContextMenuEvent *pEvent);94 83 95 84 private: … … 312 301 void UIGuestControlFileView::configure() 313 302 { 303 setContextMenuPolicy(Qt::CustomContextMenu); 314 304 setShowGrid(false); 315 305 setSelectionBehavior(QAbstractItemView::SelectRows); … … 322 312 } 323 313 324 void UIGuestControlFileView::contextMenuEvent(QContextMenuEvent *pEvent)325 {326 bool selectionAvaible = hasSelection();327 328 QMenu *menu = new QMenu(this);329 if (!menu)330 return;331 332 QAction *pActionGoUp = menu->addAction(QApplication::translate("UIGuestControlFileManager","Go up"));333 if (pActionGoUp)334 {335 pActionGoUp->setIcon(UIIconPool::iconSet(QString(":/arrow_up_10px_x2.png")));336 connect(pActionGoUp, &QAction::triggered, this, &UIGuestControlFileView::sigGoUp);337 }338 QAction *pActionGoHome = menu->addAction(QApplication::translate("UIGuestControlFileManager", "Go home"));339 if (pActionGoHome)340 {341 pActionGoHome->setIcon(UIIconPool::iconSet(QString(":/nw_24px.png")));342 connect(pActionGoHome, &QAction::triggered, this, &UIGuestControlFileView::sigGoHome);343 }344 345 QAction *pActionRefresh = menu->addAction(QApplication::translate("UIGuestControlFileManager", "Refresh"));346 if (pActionRefresh)347 {348 pActionRefresh->setIcon(UIIconPool::iconSet(QString(":/refresh_24px.png")));349 connect(pActionRefresh, &QAction::triggered, this, &UIGuestControlFileView::sigRefresh);350 }351 352 menu->addSeparator();353 QAction *pActionDelete = menu->addAction(QApplication::translate("UIGuestControlFileManager", "Delete"));354 if (pActionDelete)355 {356 pActionDelete->setIcon(UIIconPool::iconSet(QString(":/vm_delete_32px.png")));357 pActionDelete->setEnabled(selectionAvaible);358 connect(pActionDelete, &QAction::triggered, this, &UIGuestControlFileView::sigDelete);359 }360 361 QAction *pActionRename = menu->addAction(QApplication::translate("UIGuestControlFileManager", "Rename"));362 if (pActionRename)363 {364 pActionRename->setIcon(UIIconPool::iconSet(QString(":/name_16px_x2.png")));365 pActionRename->setEnabled(selectionAvaible);366 pActionRename->setEnabled(selectionAvaible);367 connect(pActionRename, &QAction::triggered, this, &UIGuestControlFileView::sigRename);368 }369 370 QAction *pActionCreateNewDirectory = menu->addAction(QApplication::translate("UIGuestControlFileManager", "Create New Directory"));371 if (pActionCreateNewDirectory)372 {373 pActionCreateNewDirectory->setIcon(UIIconPool::iconSet(QString(":/sf_add_16px.png")));374 connect(pActionCreateNewDirectory, &QAction::triggered, this, &UIGuestControlFileView::sigCreateNewDirectory);375 }376 377 QAction *pActionCopy = 0;378 QAction *pActionCut = 0;379 QAction *pActionPaste = 0;380 381 bool isGuestFileTable = qobject_cast<UIGuestFileTable*>(parent());382 383 if (isGuestFileTable)384 {385 pActionCopy = menu->addAction(QApplication::translate("UIGuestControlFileManager", "Copy"));386 if (pActionCopy)387 {388 pActionCopy->setIcon(UIIconPool::iconSet(QString(":/fd_copy_32px.png")));389 pActionCopy->setEnabled(selectionAvaible);390 connect(pActionCopy, &QAction::triggered, this, &UIGuestControlFileView::sigCopy);391 }392 393 pActionCut = menu->addAction(QApplication::translate("UIGuestControlFileManager", "Cut"));394 if (pActionCut)395 {396 pActionCut->setIcon(UIIconPool::iconSet(QString(":/fd_move_32px.png")));397 pActionCut->setEnabled(selectionAvaible);398 connect(pActionCut, &QAction::triggered, this, &UIGuestControlFileView::sigCut);399 }400 401 pActionPaste = menu->addAction(QApplication::translate("UIGuestControlFileManager", "Paste"));402 if (pActionPaste)403 {404 pActionPaste->setIcon(UIIconPool::iconSet(QString(":/shared_clipboard_16px.png")));405 connect(pActionPaste, &QAction::triggered, this, &UIGuestControlFileView::sigPaste);406 }407 }408 409 menu->addSeparator();410 QAction *pActionShowProperties = menu->addAction(QApplication::translate("UIGuestControlFileManager", "Properties"));411 if (pActionShowProperties)412 {413 pActionShowProperties->setIcon(UIIconPool::iconSet(QString(":/session_info_32px.png")));414 pActionShowProperties->setEnabled(selectionAvaible);415 connect(pActionShowProperties, &QAction::triggered, this, &UIGuestControlFileView::sigShowProperties);416 }417 418 menu->exec(pEvent->globalPos());419 420 if (pActionGoUp)421 disconnect(pActionGoUp, &QAction::triggered, this, &UIGuestControlFileView::sigGoUp);422 if (pActionGoHome)423 disconnect(pActionGoHome, &QAction::triggered, this, &UIGuestControlFileView::sigGoHome);424 if (pActionRefresh)425 disconnect(pActionRefresh, &QAction::triggered, this, &UIGuestControlFileView::sigRefresh);426 if (pActionDelete)427 disconnect(pActionDelete, &QAction::triggered, this, &UIGuestControlFileView::sigDelete);428 if (pActionRename)429 disconnect(pActionRename, &QAction::triggered, this, &UIGuestControlFileView::sigRename);430 if (pActionCreateNewDirectory)431 disconnect(pActionCreateNewDirectory, &QAction::triggered, this, &UIGuestControlFileView::sigCreateNewDirectory);432 if (isGuestFileTable)433 {434 if (pActionCopy)435 disconnect(pActionCopy, &QAction::triggered, this, &UIGuestControlFileView::sigCopy);436 if (pActionCut)437 disconnect(pActionCut, &QAction::triggered, this, &UIGuestControlFileView::sigCut);438 if (pActionPaste)439 disconnect(pActionPaste, &QAction::triggered, this, &UIGuestControlFileView::sigPaste);440 }441 if (pActionShowProperties)442 disconnect(pActionShowProperties, &QAction::triggered, this, &UIGuestControlFileView::sigShowProperties);443 444 delete menu;445 }446 447 314 bool UIGuestControlFileView::hasSelection() const 448 315 { … … 458 325 QTableView::selectionChanged(selected, deselected); 459 326 } 460 461 327 462 328 /********************************************************************************************************************************* … … 559 425 { 560 426 } 561 562 427 563 428 /********************************************************************************************************************************* … … 835 700 connect(m_pView, &UIGuestControlFileView::clicked, 836 701 this, &UIGuestControlFileTable::sltItemClicked); 837 connect(m_pView, &UIGuestControlFileView::sigGoUp,838 this, &UIGuestControlFileTable::sltGoUp);839 connect(m_pView, &UIGuestControlFileView::sigGoHome,840 this, &UIGuestControlFileTable::sltGoHome);841 connect(m_pView, &UIGuestControlFileView::sigRefresh,842 this, &UIGuestControlFileTable::sltRefresh);843 connect(m_pView, &UIGuestControlFileView::sigDelete,844 this, &UIGuestControlFileTable::sltDelete);845 connect(m_pView, &UIGuestControlFileView::sigRename,846 this, &UIGuestControlFileTable::sltRename);847 connect(m_pView, &UIGuestControlFileView::sigCreateNewDirectory,848 this, &UIGuestControlFileTable::sltCreateNewDirectory);849 connect(m_pView, &UIGuestControlFileView::sigCopy,850 this, &UIGuestControlFileTable::sltCopy);851 connect(m_pView, &UIGuestControlFileView::sigCut,852 this, &UIGuestControlFileTable::sltCut);853 connect(m_pView, &UIGuestControlFileView::sigPaste,854 this, &UIGuestControlFileTable::sltPaste);855 connect(m_pView, &UIGuestControlFileView::sigShowProperties,856 this, &UIGuestControlFileTable::sltShowProperties);857 702 connect(m_pView, &UIGuestControlFileView::sigSelectionChanged, 858 703 this, &UIGuestControlFileTable::sltSelectionChanged); 704 connect(m_pView, &UIGuestControlFileView::customContextMenuRequested, 705 this, &UIGuestControlFileTable::sltCreateFileViewContextMenu); 859 706 860 707 } … … 1236 1083 { 1237 1084 performSelectionSearch(strText); 1085 } 1086 1087 void UIGuestControlFileTable::sltCreateFileViewContextMenu(const QPoint &point) 1088 { 1089 QWidget *pSender = qobject_cast<QWidget*>(sender()); 1090 if (!pSender) 1091 return; 1092 createFileViewContextMenu(pSender, point); 1238 1093 } 1239 1094 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.h
r75184 r75202 283 283 virtual void determineDriveLetters() = 0; 284 284 virtual void prepareToolbar() = 0; 285 virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) = 0; 285 286 QString fileTypeString(FileObjectType type); 286 287 /* @p item index is item location in model not in 'proxy' model */ … … 323 324 void sltPaste(); 324 325 void sltShowProperties(); 326 void sltSelectAll(); 327 void sltInvertSelection(); 328 329 private slots: 330 331 void sltCreateFileViewContextMenu(const QPoint &point); 325 332 void sltSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected); 326 333 void sltLocationComboCurrentChange(const QString &strLocation); 327 void sltSelectAll();328 void sltInvertSelection();329 334 void sltSearchTextChanged(const QString &strText); 330 335 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.cpp
r75193 r75202 561 561 } 562 562 setSelectionDependentActionsEnabled(false); 563 } 564 565 void UIGuestFileTable::createFileViewContextMenu(const QWidget *pWidget, const QPoint &/*point*/) 566 { 567 if (!pWidget) 568 return; 569 570 // QMenu menu; 571 // menu.exec(mapToGlobal(position)); 563 572 } 564 573 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.h
r75184 r75202 54 54 virtual void determineDriveLetters() /* override */; 55 55 virtual void prepareToolbar() /* override */; 56 virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) /* override */; 56 57 57 58 private: -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIHostFileTable.cpp
r75184 r75202 152 152 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Rename)); 153 153 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_CreateNewDirectory)); 154 m_pToolBar->addSeparator(); 155 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Copy)); 156 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Cut)); 157 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Paste)); 154 /* Hide cut, copy, and paste for now. We will implement those 155 when we have an API for host file operations: */ 156 // m_pToolBar->addSeparator(); 157 // m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Copy)); 158 // m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Cut)); 159 // m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Paste)); 158 160 m_pToolBar->addSeparator(); 159 161 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_SelectAll)); … … 164 166 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Delete)); 165 167 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Rename)); 166 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Copy));167 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Cut));168 168 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_ShowProperties)); 169 169 } 170 170 171 setSelectionDependentActionsEnabled(false); 172 } 173 174 void UIHostFileTable::createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) 175 { 176 if (!pWidget) 177 return; 178 179 QMenu menu; 180 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_GoUp)); 181 182 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_GoHome)); 183 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Refresh)); 184 menu.addSeparator(); 185 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Delete)); 186 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Rename)); 187 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_CreateNewDirectory)); 171 188 /* Hide cut, copy, and paste for now. We will implement those 172 189 when we have an API for host file operations: */ 173 // if (m_pCopy) 174 // m_pCopy->setVisible(false); 175 // if (m_pCut) 176 // m_pCut->setVisible(false); 177 // if (m_pPaste) 178 // m_pPaste->setVisible(false); 179 setSelectionDependentActionsEnabled(false); 190 // menu.addSeparator(); 191 // menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Copy)); 192 // menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Cut)); 193 // menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Paste)); 194 menu.addSeparator(); 195 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_SelectAll)); 196 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_InvertSelection)); 197 menu.addSeparator(); 198 menu.addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_ShowProperties)); 199 200 201 202 menu.exec(pWidget->mapToGlobal(point)); 180 203 } 181 204 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIHostFileTable.h
r75184 r75202 48 48 virtual void determineDriveLetters() /* override */; 49 49 virtual void prepareToolbar() /* override */; 50 virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) /* override */; 50 51 51 52 private:
Note:
See TracChangeset
for help on using the changeset viewer.