Changeset 78146 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 16, 2019 3:52:58 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPathOperations.cpp
r76606 r78146 130 130 /* static */ QStringList UIPathOperations::pathTrail(const QString &path) 131 131 { 132 QStringList pathList = path.split(UIPathOperations::delimiter, QString::SkipEmptyParts); 133 if (!pathList.isEmpty() && doesPathStartWithDriveLetter(pathList[0])) 134 { 135 pathList[0] = addTrailingDelimiters(pathList[0]); 136 } 137 return pathList; 132 return path.split(UIPathOperations::delimiter, QString::SkipEmptyParts); 138 133 } 139 134 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp
r78057 r78146 158 158 return; 159 159 m_comGuestSession = session; 160 /* To determine the path separator we need to have a valid guest session: */ 161 determinePathSeparator(); 160 162 initializeFileTree(); 161 163 } … … 604 606 m_driveLetterList.push_back(path); 605 607 } 608 } 609 610 void UIFileManagerGuestTable::determinePathSeparator() 611 { 612 if (m_comGuestSession.isNull()) 613 return; 614 KPathStyle pathStyle = m_comGuestSession.GetPathStyle(); 615 if (pathStyle == KPathStyle_DOS) 616 setPathSeparator(UIPathOperations::dosDelimiter); 606 617 } 607 618 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h
r77528 r78146 66 66 virtual void showProperties() /* override */; 67 67 virtual void determineDriveLetters() /* override */; 68 virtual void determinePathSeparator() /* override */; 68 69 virtual void prepareToolbar() /* override */; 69 70 virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) /* override */; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp
r77932 r78146 127 127 prepareToolbar(); 128 128 prepareActionConnections(); 129 determinePathSeparator(); 129 130 retranslateUi(); 130 131 } … … 448 449 if (UIPathOperations::doesPathStartWithDriveLetter(drive[i].filePath())) 449 450 m_driveLetterList.push_back(drive[i].filePath()); 450 451 } 451 } 452 } 453 454 void UIFileManagerHostTable::determinePathSeparator() 455 { 456 setPathSeparator(QDir::separator()); 452 457 } 453 458 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.h
r77528 r78146 56 56 virtual void showProperties() /* override */; 57 57 virtual void determineDriveLetters() /* override */; 58 virtual void determinePathSeparator() /* override */; 58 59 virtual void prepareToolbar() /* override */; 59 60 virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) /* override */; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r78058 r78146 84 84 UIFileManagerBreadCrumbs(QWidget *pParent = 0); 85 85 void setPath(const QString &strPath); 86 void setPathSeparator(const QChar &separator); 86 87 87 88 protected: … … 92 93 93 94 QString m_strPath; 95 QChar m_pathSeparator; 94 96 }; 95 97 … … 113 115 void setPath(const QString &strLocation); 114 116 void reset(); 117 void setPathSeparator(const QChar &separator); 115 118 116 119 private slots: … … 119 122 /* Makes sure that we switch to breadcrumbs widget as soon as the combo box popup is hidden. */ 120 123 void sltHandleHidePopup(); 124 void sltHandlePathChange(const QString &strPath); 121 125 122 126 private: … … 128 132 UIFileManagerHistoryComboBox *m_pHistoryComboBox; 129 133 QToolButton *m_pSwitchButton; 134 QChar m_pathSeparator; 130 135 }; 131 136 … … 250 255 , m_pHistoryComboBox(0) 251 256 , m_pSwitchButton(0) 257 , m_pathSeparator('/') 252 258 { 253 259 prepare(); … … 261 267 if (m_pHistoryComboBox) 262 268 { 263 int itemIndex = m_pHistoryComboBox->findText(strLocation, 269 QString strNativeLocation(strLocation); 270 strNativeLocation.replace('/', m_pathSeparator); 271 int itemIndex = m_pHistoryComboBox->findText(strNativeLocation, 264 272 Qt::MatchExactly | Qt::MatchCaseSensitive); 265 273 if (itemIndex == -1) 266 274 { 267 m_pHistoryComboBox->insertItem(m_pHistoryComboBox->count(), str Location);275 m_pHistoryComboBox->insertItem(m_pHistoryComboBox->count(), strNativeLocation); 268 276 itemIndex = m_pHistoryComboBox->count() - 1; 269 277 } … … 277 285 { 278 286 disconnect(m_pHistoryComboBox, static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), 279 this, &UIFileManagerNavigationWidget::s igPathChanged);287 this, &UIFileManagerNavigationWidget::sltHandlePathChange); 280 288 m_pHistoryComboBox->clear(); 281 289 connect(m_pHistoryComboBox, static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), 282 this, &UIFileManagerNavigationWidget::s igPathChanged);290 this, &UIFileManagerNavigationWidget::sltHandlePathChange); 283 291 } 284 292 285 293 if (m_pBreadCrumbs) 286 294 m_pBreadCrumbs->setPath(QString()); 295 } 296 297 void UIFileManagerNavigationWidget::setPathSeparator(const QChar &separator) 298 { 299 m_pathSeparator = separator; 300 if (m_pBreadCrumbs) 301 m_pBreadCrumbs->setPathSeparator(m_pathSeparator); 287 302 } 288 303 … … 305 320 m_pBreadCrumbs->setIndent(0.5 * qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin)); 306 321 connect(m_pBreadCrumbs, &UIFileManagerBreadCrumbs::linkActivated, 307 this, &UIFileManagerNavigationWidget::s igPathChanged);322 this, &UIFileManagerNavigationWidget::sltHandlePathChange); 308 323 connect(m_pHistoryComboBox, &UIFileManagerHistoryComboBox::sigHidePopup, 309 324 this, &UIFileManagerNavigationWidget::sltHandleHidePopup); 310 325 connect(m_pHistoryComboBox, static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), 311 this, &UIFileManagerNavigationWidget::s igPathChanged);326 this, &UIFileManagerNavigationWidget::sltHandlePathChange); 312 327 313 328 m_pContainer->addWidget(m_pBreadCrumbs); … … 340 355 } 341 356 357 void UIFileManagerNavigationWidget::sltHandlePathChange(const QString &strPath) 358 { 359 QString strNonNativePath(strPath); 360 strNonNativePath.replace(m_pathSeparator, '/'); 361 emit sigPathChanged(strNonNativePath); 362 } 363 342 364 void UIFileManagerNavigationWidget::sltHandleSwitch() 343 365 { … … 361 383 UIFileManagerBreadCrumbs::UIFileManagerBreadCrumbs(QWidget *pParent /* = 0 */) 362 384 :QLabel(pParent) 385 , m_pathSeparator('/') 363 386 { 364 387 float fFontMult = 1.2f; … … 407 430 for (int i = folderList.size() - 1; i >= 0; --i) 408 431 { 409 QString strFolder = UIPathOperations::removeTrailingDelimiters(folderList.at(i)) ;432 QString strFolder = UIPathOperations::removeTrailingDelimiters(folderList.at(i)).replace('/', m_pathSeparator); 410 433 QString strWord = QString("<a href=\"%1\" style=\"color:black;text-decoration:none;\">%2</a>").arg(strPathUpto[i]).arg(strFolder); 411 412 434 if (i < folderList.size() - 1) 413 435 { … … 422 444 } 423 445 setText(strLabelText); 446 } 447 448 void UIFileManagerBreadCrumbs::setPathSeparator(const QChar &separator) 449 { 450 m_pathSeparator = separator; 424 451 } 425 452 … … 669 696 , m_pView(0) 670 697 , m_pProxyModel(0) 698 , m_pNavigationWidget(0) 671 699 , m_pMainLayout(0) 672 700 , m_pWarningLabel(0) 673 , m_p NavigationWidget(0)701 , m_pathSeparator('/') 674 702 { 675 703 prepareObjects(); … … 849 877 for (int i = 0; i < m_driveLetterList.size(); ++i) 850 878 { 851 UICustomFileSystemItem* driveItem = new UICustomFileSystemItem(m_driveLetterList[i], startItem, KFsObjType_Directory); 879 UICustomFileSystemItem* driveItem = new UICustomFileSystemItem(UIPathOperations::removeTrailingDelimiters(m_driveLetterList[i]), 880 startItem, KFsObjType_Directory); 852 881 driveItem->setPath(m_driveLetterList[i]); 853 882 driveItem->setIsOpened(false); … … 1402 1431 } 1403 1432 1433 void UIFileManagerTable::setPathSeparator(const QChar &separator) 1434 { 1435 m_pathSeparator = separator; 1436 if (m_pNavigationWidget) 1437 m_pNavigationWidget->setPathSeparator(m_pathSeparator); 1438 } 1439 1404 1440 bool UIFileManagerTable::event(QEvent *pEvent) 1405 1441 { -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h
r78058 r78146 209 209 * drive letters */ 210 210 virtual void determineDriveLetters() = 0; 211 virtual void determinePathSeparator() = 0; 211 212 virtual void prepareToolbar() = 0; 212 213 virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) = 0; … … 234 235 void setSelectionDependentActionsEnabled(bool fIsEnabled); 235 236 UICustomFileSystemItem* rootItem(); 237 void setPathSeparator(const QChar &separator); 236 238 237 239 QILabel *m_pLocationLabel; … … 239 241 UIActionPool *m_pActionPool; 240 242 UIToolBar *m_pToolBar; 243 241 244 /** Stores the drive letters the file system has (for windows system). For non-windows 242 245 * systems this is empty and for windows system it should at least contain C:/ */ … … 287 290 void markUnmarkSearchLineEdit(bool fMark); 288 291 289 UICustomFileSystemModel *m_pModel; 290 UIGuestControlFileView *m_pView; 291 UICustomFileSystemProxyModel *m_pProxyModel; 292 UICustomFileSystemModel *m_pModel; 293 UIGuestControlFileView *m_pView; 294 UICustomFileSystemProxyModel *m_pProxyModel; 295 /** Contains m_pBreadCrumbsWidget and m_pLocationComboBox. */ 296 UIFileManagerNavigationWidget *m_pNavigationWidget; 292 297 293 298 QGridLayout *m_pMainLayout; … … 296 301 QColor m_searchLineMarkColor; 297 302 QILabel *m_pWarningLabel; 298 299 /** Contains m_pBreadCrumbsWidget and m_pLocationComboBox. */ 300 UIFileManagerNavigationWidget *m_pNavigationWidget; 301 //UIFileManagerBreadCrumbs *m_pBreadCrumbsWidget; 303 QChar m_pathSeparator; 302 304 303 305 friend class UICustomFileSystemModel;
Note:
See TracChangeset
for help on using the changeset viewer.