Changeset 85151 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 9, 2020 2:41:38 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp
r85111 r85151 3460 3460 pMenu->clear(); 3461 3461 3462 /* Populate 'Group' / 'Console' menu: */ 3463 pMenu->addAction(action(UIActionIndexST_M_Group_M_Console_S_CreateConnection)); 3464 pMenu->addAction(action(UIActionIndexST_M_Group_M_Console_S_DeleteConnection)); 3465 3466 /* Mark menu as valid: */ 3467 m_invalidations.remove(UIActionIndexST_M_Group_M_Console); 3462 /* This menu always remains invalid.. */ 3468 3463 } 3469 3464 … … 3476 3471 pMenu->clear(); 3477 3472 3478 /* Populate 'Machine' / 'Console' menu: */ 3479 pMenu->addAction(action(UIActionIndexST_M_Machine_M_Console_S_CreateConnection)); 3480 pMenu->addAction(action(UIActionIndexST_M_Machine_M_Console_S_DeleteConnection)); 3481 3482 /* Mark menu as valid: */ 3483 m_invalidations.remove(UIActionIndexST_M_Machine_M_Console); 3473 /* This menu always remains invalid.. */ 3484 3474 } 3485 3475 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r85111 r85151 17 17 18 18 /* Qt includes: */ 19 #include <QClipboard> 19 20 #include <QFile> 21 #include <QGuiApplication> 20 22 #include <QMenuBar> 21 23 #include <QPushButton> … … 34 36 #include "UIExtraDataManager.h" 35 37 #include "UIHostNetworkManager.h" 38 #include "UIIconPool.h" 36 39 #include "UIMedium.h" 37 40 #include "UIMediumManager.h" … … 1072 1075 } 1073 1076 1077 void UIVirtualBoxManager::sltCopyConsoleConnectionFingerprint() 1078 { 1079 QAction *pAction = qobject_cast<QAction*>(sender()); 1080 AssertPtrReturnVoid(pAction); 1081 QClipboard *pClipboard = QGuiApplication::clipboard(); 1082 AssertPtrReturnVoid(pClipboard); 1083 pClipboard->setText(pAction->property("fingerprint").toString()); 1084 } 1085 1074 1086 void UIVirtualBoxManager::sltPerformDiscardMachineState() 1075 1087 { … … 1717 1729 m_menuUpdateHandlers[UIActionIndexST_M_Machine] = &UIVirtualBoxManager::updateMenuMachine; 1718 1730 m_menuUpdateHandlers[UIActionIndexST_M_Group_M_MoveToGroup] = &UIVirtualBoxManager::updateMenuGroupMoveToGroup; 1731 m_menuUpdateHandlers[UIActionIndexST_M_Group_M_Console] = &UIVirtualBoxManager::updateMenuGroupConsole; 1719 1732 m_menuUpdateHandlers[UIActionIndexST_M_Group_M_Close] = &UIVirtualBoxManager::updateMenuGroupClose; 1720 1733 m_menuUpdateHandlers[UIActionIndexST_M_Machine_M_MoveToGroup] = &UIVirtualBoxManager::updateMenuMachineMoveToGroup; 1734 m_menuUpdateHandlers[UIActionIndexST_M_Machine_M_Console] = &UIVirtualBoxManager::updateMenuMachineConsole; 1721 1735 m_menuUpdateHandlers[UIActionIndexST_M_Machine_M_Close] = &UIVirtualBoxManager::updateMenuMachineClose; 1722 1736 … … 2319 2333 } 2320 2334 2335 void UIVirtualBoxManager::updateMenuGroupConsole(QMenu *pMenu) 2336 { 2337 /* Get current item: */ 2338 UIVirtualMachineItem *pItem = currentItem(); 2339 AssertMsgReturnVoid(pItem, ("Current item should be selected!\n")); 2340 UIVirtualMachineItemCloud *pCloudItem = pItem->toCloud(); 2341 AssertPtrReturnVoid(pCloudItem); 2342 2343 /* Acquire current cloud machine: */ 2344 CCloudMachine comMachine = pCloudItem->machine(); 2345 const QString strFingerprint = comMachine.GetConsoleConnectionFingerprint(); 2346 2347 /* Populate 'Group' / 'Console' menu: */ 2348 if (strFingerprint.isEmpty()) 2349 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_Console_S_CreateConnection)); 2350 else 2351 { 2352 QAction *pAction = pMenu->addAction(UIIconPool::iconSet(":/file_manager_copy_16px.png"), 2353 QApplication::translate("UIActionPool", "Copy Key Fingerprint (%1)").arg(strFingerprint), 2354 this, &UIVirtualBoxManager::sltCopyConsoleConnectionFingerprint); 2355 pAction->setProperty("fingerprint", strFingerprint); 2356 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_Console_S_DeleteConnection)); 2357 } 2358 } 2359 2321 2360 void UIVirtualBoxManager::updateMenuGroupClose(QMenu *) 2322 2361 { … … 2346 2385 QAction *pAction = pMenu->addAction(strVisibleGroupName, this, &UIVirtualBoxManager::sltPerformMachineMoveToSpecificGroup); 2347 2386 pAction->setProperty("actual_group_name", strGroupName); 2387 } 2388 } 2389 2390 void UIVirtualBoxManager::updateMenuMachineConsole(QMenu *pMenu) 2391 { 2392 /* Get current item: */ 2393 UIVirtualMachineItem *pItem = currentItem(); 2394 AssertMsgReturnVoid(pItem, ("Current item should be selected!\n")); 2395 UIVirtualMachineItemCloud *pCloudItem = pItem->toCloud(); 2396 AssertPtrReturnVoid(pCloudItem); 2397 2398 /* Acquire current cloud machine: */ 2399 CCloudMachine comMachine = pCloudItem->machine(); 2400 const QString strFingerprint = comMachine.GetConsoleConnectionFingerprint(); 2401 2402 /* Populate 'Group' / 'Console' menu: */ 2403 if (strFingerprint.isEmpty()) 2404 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_CreateConnection)); 2405 else 2406 { 2407 QAction *pAction = pMenu->addAction(UIIconPool::iconSet(":/file_manager_copy_16px.png"), 2408 QApplication::translate("UIActionPool", "Copy Key Fingerprint (%1)").arg(strFingerprint), 2409 this, &UIVirtualBoxManager::sltCopyConsoleConnectionFingerprint); 2410 pAction->setProperty("fingerprint", strFingerprint); 2411 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_DeleteConnection)); 2348 2412 } 2349 2413 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r85111 r85151 242 242 /** Handles call to delete console connection. */ 243 243 void sltPerformDeleteConsoleConnection(); 244 /** Handles call to copy console connection key fingerprint. */ 245 void sltCopyConsoleConnectionFingerprint(); 244 246 245 247 /** Handles call to discard machine state. */ … … 359 361 /** Updates 'Group' : 'Move to Group' menu. */ 360 362 void updateMenuGroupMoveToGroup(QMenu *pMenu); 363 /** Updates 'Group' : 'Console' menu. */ 364 void updateMenuGroupConsole(QMenu *pMenu); 361 365 /** Updates 'Group' : 'Close' menu. */ 362 366 void updateMenuGroupClose(QMenu *pMenu); 363 367 /** Updates 'Machine' : 'Move to Group' menu. */ 364 368 void updateMenuMachineMoveToGroup(QMenu *pMenu); 369 /** Updates 'Machine' : 'Console' menu. */ 370 void updateMenuMachineConsole(QMenu *pMenu); 365 371 /** Updates 'Machine' : 'Close' menu. */ 366 372 void updateMenuMachineClose(QMenu *pMenu);
Note:
See TracChangeset
for help on using the changeset viewer.