- Timestamp:
- Mar 5, 2018 1:20:48 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileManager.cpp
r71195 r71201 77 77 78 78 void retranslateUi(); 79 void keyPressEvent(QKeyEvent * pEvent); 79 80 80 81 private slots: … … 190 191 m_pCloseButton->setText(UIVMInformationDialog::tr("Close Session")); 191 192 193 } 194 195 void UIGuestSessionCreateWidget::keyPressEvent(QKeyEvent * pEvent) 196 { 197 /* Emit sigCreateSession upon enter press: */ 198 if (pEvent->key() == Qt::Key_Enter || pEvent->key() == Qt::Key_Return) 199 { 200 if ((m_pUserNameEdit && m_pUserNameEdit->hasFocus()) || 201 (m_pPasswordEdit && m_pPasswordEdit->hasFocus())) 202 sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text()); 203 } 204 QWidget::keyPressEvent(pEvent); 192 205 } 193 206 … … 458 471 if (m_pSessionCreateWidget) 459 472 m_pSessionCreateWidget->switchSessionCloseMode(); 460 if (m_pGuestFileTable)473 if (m_pGuestFileTable) 461 474 m_pGuestFileTable->setEnabled(true); 462 if (m_pToolBar)475 if (m_pToolBar) 463 476 m_pToolBar->setEnabled(true); 464 477 } … … 468 481 if (m_pSessionCreateWidget) 469 482 m_pSessionCreateWidget->switchSessionCreateMode(); 470 if (m_pGuestFileTable)483 if (m_pGuestFileTable) 471 484 m_pGuestFileTable->setEnabled(false); 472 if (m_pToolBar)485 if (m_pToolBar) 473 486 m_pToolBar->setEnabled(false); 474 487 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTable.cpp
r71191 r71201 81 81 /** True if this is directory and name is ".." */ 82 82 bool isUpDirectory() const; 83 void clearChildren(); 83 84 84 85 private: … … 104 105 { 105 106 qDeleteAll(m_childItems); 107 m_childItems.clear(); 106 108 } 107 109 … … 147 149 { 148 150 return m_bIsDirectory; 151 } 152 153 void UIFileTableItem::clearChildren() 154 { 155 qDeleteAll(m_childItems); 156 m_childItems.clear(); 149 157 } 150 158 … … 452 460 453 461 m_pGoUp = new QAction(this); 454 m_pGoUp->setIcon(UIIconPool::iconSet(QString(":/arrow_up_10px_x2.png"))); 455 m_pToolBar->addAction(m_pGoUp); 456 462 if (m_pGoUp) 463 { 464 connect(m_pGoUp, &QAction::triggered, this, &UIGuestControlFileTable::sltGoUp); 465 m_pGoUp->setIcon(UIIconPool::iconSet(QString(":/arrow_up_10px_x2.png"))); 466 m_pToolBar->addAction(m_pGoUp); 467 } 457 468 458 469 m_pRefresh = new QAction(this); 459 m_pRefresh->setIcon(UIIconPool::iconSet(QString(":/refresh_22px.png"))); 460 m_pToolBar->addAction(m_pRefresh); 470 if (m_pRefresh) 471 { 472 connect(m_pRefresh, &QAction::triggered, this, &UIGuestControlFileTable::sltRefresh); 473 m_pRefresh->setIcon(UIIconPool::iconSet(QString(":/refresh_22px.png"))); 474 m_pToolBar->addAction(m_pRefresh); 475 } 476 461 477 462 478 m_pDelete = new QAction(this); … … 582 598 changeLocation(index); 583 599 } 600 601 void UIGuestControlFileTable::sltGoUp() 602 { 603 if (!m_pView || !m_pModel) 604 return; 605 QModelIndex currentRoot = m_pView->rootIndex(); 606 if (!currentRoot.isValid()) 607 return; 608 if (currentRoot != m_pModel->rootIndex()) 609 m_pView->setRootIndex(currentRoot.parent()); 610 } 611 612 void UIGuestControlFileTable::sltRefresh() 613 { 614 if (!m_pView || !m_pModel) 615 return; 616 QModelIndex currentIndex = m_pView->rootIndex(); 617 if (!currentIndex.isValid()) 618 return; 619 UIFileTableItem *treeItem = 620 static_cast<UIFileTableItem*>(currentIndex.internalPointer()); 621 if (!treeItem) 622 return; 623 m_pModel->beginReset(); 624 /* For now we clear the whole subtree (that isrecursively) which is an overkill: */ 625 treeItem->clearChildren(); 626 readDirectory(treeItem->path(), treeItem, false); 627 m_pModel->endReset(); 628 m_pView->setRootIndex(currentIndex); 629 } 630 584 631 585 632 void UIGuestControlFileTable::retranslateUi() … … 714 761 } 715 762 763 void UIGuestFileTable::refresh() 764 { 765 } 766 716 767 717 768 /********************************************************************************************************************************* … … 774 825 } 775 826 827 void UIHostFileTable::refresh() 828 { 829 } 830 776 831 #include "UIGuestControlFileTable.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTable.h
r71191 r71201 100 100 bool isDirectoryMap, bool isStartDir); 101 101 virtual void readDirectory(const QString& strPath, UIFileTableItem *parent, bool isStartDir = false) = 0; 102 102 virtual void refresh() = 0; 103 103 UIFileTableItem *m_pRootItem; 104 104 … … 114 114 115 115 void sltItemDoubleClicked(const QModelIndex &index); 116 void sltGoUp(); 117 void sltRefresh(); 116 118 117 119 private: … … 148 150 void retranslateUi() /* override */; 149 151 virtual void readDirectory(const QString& strPath, UIFileTableItem *parent, bool isStartDir = false) /* override */; 152 virtual void refresh() /* override */; 150 153 151 154 private: … … 168 171 void retranslateUi() /* override */; 169 172 virtual void readDirectory(const QString& strPath, UIFileTableItem *parent, bool isStartDir = false) /* override */; 173 virtual void refresh() /* override */; 170 174 171 175 };
Note:
See TracChangeset
for help on using the changeset viewer.