Changeset 77868 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 25, 2019 9:27:48 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129553
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.cpp
r77286 r77868 90 90 } 91 91 92 QList< constUICustomFileSystemItem*> UICustomFileSystemItem::children() const93 { 94 QList< constUICustomFileSystemItem*> childList;92 QList<UICustomFileSystemItem*> UICustomFileSystemItem::children() const 93 { 94 QList<UICustomFileSystemItem*> childList; 95 95 foreach (UICustomFileSystemItem *child, m_childItems) 96 96 childList << child; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h
r77286 r77868 58 58 UICustomFileSystemItem *child(const QString &path) const; 59 59 int childCount() const; 60 QList< constUICustomFileSystemItem*> children() const;60 QList<UICustomFileSystemItem*> children() const; 61 61 /** Removes the item from the list of children and !!DELETES!! the item. */ 62 62 void removeChild(UICustomFileSystemItem *pItem); -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r77851 r77868 787 787 if (!currentIndex.isValid()) 788 788 return; 789 UICustomFileSystemItem *item = static_cast<UICustomFileSystemItem*>(currentIndex.internalPointer()); 790 if (!item) 791 return; 792 793 QString newDirectoryName = getNewDirectoryName(); 794 if (newDirectoryName.isEmpty()) 795 return; 796 797 if (createDirectory(item->path(), newDirectoryName)) 798 { 799 /** @todo instead of refreshing here (an overkill) just add the 800 rows and update the tabel view: */ 801 sltRefresh(); 802 } 789 UICustomFileSystemItem *parentFolderItem = static_cast<UICustomFileSystemItem*>(currentIndex.internalPointer()); 790 if (!parentFolderItem) 791 return; 792 793 QString newDirectoryName(UICustomFileSystemModel::tr("NewDirectory")); 794 795 if (!createDirectory(parentFolderItem->path(), newDirectoryName)) 796 return; 797 798 /* Refesh the current directory so that we correctly populate the child list of parentFolderItem: */ 799 /** @todo instead of refreshing here (an overkill) just add the 800 rows and update the tabel view: */ 801 sltRefresh(); 802 803 /* Now we try to edit the newly created item thereby enabling the user to rename the new item: */ 804 QList<UICustomFileSystemItem*> content = parentFolderItem->children(); 805 UICustomFileSystemItem* newItem = 0; 806 /* Search the new item: */ 807 foreach (UICustomFileSystemItem* childItem, content) 808 { 809 810 if (childItem && newDirectoryName == childItem->name()) 811 newItem = childItem; 812 } 813 814 if (!newItem) 815 return; 816 QModelIndex newItemIndex = m_pProxyModel->mapFromSource(m_pModel->index(newItem)); 817 if (!newItemIndex.isValid()) 818 return; 819 m_pView->edit(newItemIndex); 803 820 } 804 821 … … 1037 1054 } 1038 1055 1039 1040 QString UIFileManagerTable::getNewDirectoryName()1041 {1042 UIStringInputDialog *dialog = new UIStringInputDialog();1043 if (dialog->execute())1044 {1045 QString strDialog = dialog->getString();1046 delete dialog;1047 return strDialog;1048 }1049 delete dialog;1050 return QString();1051 }1052 1053 1056 QString UIFileManagerTable::currentDirectoryPath() const 1054 1057 { -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h
r77528 r77868 267 267 /** Returns the UICustomFileSystemItem for path / which is a direct (and single) child of m_pRootItem */ 268 268 UICustomFileSystemItem *getStartDirectoryItem(); 269 /** Shows a modal dialog with a line edit for user to enter a new directory name and return the entered string*/270 QString getNewDirectoryName();271 269 void deSelectUpDirectoryItem(); 272 270 void setSelectionForAll(QItemSelectionModel::SelectionFlags flags); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r77528 r77868 284 284 285 285 /* Check to see if we already have a directory named strNewDirectoryName: */ 286 const QList< constUICustomFileSystemItem*> children = pParentItem->children();286 const QList<UICustomFileSystemItem*> children = pParentItem->children(); 287 287 foreach (const UICustomFileSystemItem *item, children) 288 288 { … … 678 678 if (!pItem || !pItem->parentItem()) 679 679 return; 680 QList< constUICustomFileSystemItem*> children = pItem->parentItem()->children();680 QList<UICustomFileSystemItem*> children = pItem->parentItem()->children(); 681 681 bool bDuplicate = false; 682 682 foreach (const UICustomFileSystemItem *item, children)
Note:
See TracChangeset
for help on using the changeset viewer.