Changeset 100455 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 10, 2023 1:00:06 PM (20 months ago)
- svn:sync-xref-src-repo-rev:
- 158201
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r100420 r100455 808 808 if (!parentFolderItem) 809 809 return; 810 811 QString newDirectoryName(UICustomFileSystemModel::tr("NewDirectory")); 810 QString strBase(UICustomFileSystemModel::tr("NewDirectory")); 811 QString newDirectoryName(strBase); 812 QStringList nameList = currentDirectoryListing(); 813 int iSuffix = 1; 814 while (nameList.contains(newDirectoryName)) 815 newDirectoryName = QString("%1_%2").arg(strBase).arg(QString::number(iSuffix++)); 812 816 813 817 if (!createDirectory(parentFolderItem->path(), newDirectoryName)) … … 1321 1325 } 1322 1326 } 1327 1328 QStringList UIFileManagerTable::currentDirectoryListing() const 1329 { 1330 UICustomFileSystemItem *pItem = static_cast<UICustomFileSystemItem*>(currentRootIndex().internalPointer()); 1331 if (!pItem) 1332 return QStringList(); 1333 QStringList list; 1334 foreach (const UICustomFileSystemItem *pChild, pItem->children()) 1335 { 1336 if (pChild) 1337 list << pChild->fileObjectName(); 1338 } 1339 return list; 1340 } 1341 1323 1342 #include "UIFileManagerTable.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h
r100410 r100455 310 310 * uses m_searchLineUnmarkColor and m_searchLineMarkColor. */ 311 311 void markUnmarkSearchLineEdit(bool fMark); 312 312 QStringList currentDirectoryListing() const; 313 313 UICustomFileSystemModel *m_pModel; 314 314 UIGuestControlFileView *m_pView; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r100440 r100455 464 464 if (!m_pTableView) 465 465 return; 466 QString strNewDirectoryName("NewDirectory"); 466 QString strBaseName("NewDirectory"); 467 QString strNewDirectoryName(strBaseName); 468 QStringList currentListing = currentDirectoryListing(); 469 int iSuffix = 1; 470 while (currentListing.contains(strNewDirectoryName)) 471 strNewDirectoryName = QString("%1_%2").arg(strBaseName).arg(QString::number(iSuffix++)); 467 472 468 473 QModelIndex parentIndex = m_pTableProxyModel->mapToSource(m_pTableView->rootIndex()); … … 1114 1119 } 1115 1120 } 1121 1122 const UICustomFileSystemItem* UIVisoContentBrowser::currentDirectoryItem() const 1123 { 1124 if (!m_pTableView || !m_pTableView->rootIndex().isValid()) 1125 return 0; 1126 QModelIndex currentRoot = m_pTableProxyModel->mapToSource(m_pTableView->rootIndex()); 1127 1128 return static_cast<UICustomFileSystemItem*>(currentRoot.internalPointer()); 1129 } 1130 1131 QStringList UIVisoContentBrowser::currentDirectoryListing() const 1132 { 1133 const UICustomFileSystemItem *pCurrentDirectoryItem = currentDirectoryItem(); 1134 if (!pCurrentDirectoryItem) 1135 return QStringList(); 1136 QStringList nameList; 1137 foreach (const UICustomFileSystemItem *pChild, pCurrentDirectoryItem->children()) 1138 { 1139 if (pChild) 1140 nameList << pChild->fileObjectName(); 1141 } 1142 return nameList; 1143 } 1144 1116 1145 #include "UIVisoContentBrowser.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h
r100438 r100455 135 135 * in the table view. */ 136 136 QList<UICustomFileSystemItem*> tableSelectedItems(); 137 /* Names of the file objects of the current directory. */ 138 QStringList currentDirectoryListing() const; 137 139 bool onStartItem(); 138 140 void goUp(); 139 141 void createLoadedFileEntries(const QMap<QString, QString> &fileEntries); 142 const UICustomFileSystemItem* currentDirectoryItem() const; 140 143 UIVisoContentTableView *m_pTableView; 141 144 UICustomFileSystemModel *m_pModel;
Note:
See TracChangeset
for help on using the changeset viewer.