Changeset 100389 in vbox
- Timestamp:
- Jul 5, 2023 1:26:22 PM (19 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r100075 r100389 1427 1427 } 1428 1428 1429 bool UIMessageCenter::confirmVisoDiscard(QWidget *pParent /* = 0*/) const 1430 { 1431 return questionBinary(pParent, MessageType_Question, 1432 tr("<p>To open a Viso file you will have to discard the current content.</p>" 1433 "<p>Are you sure you want to proceed?</p>"), 1434 0 /* auto-confirm id */, 1435 tr("&Discard") /* ok button text */, 1436 QString() /* cancel button text */, 1437 false /* ok button by default? */); 1438 } 1439 1429 1440 bool UIMessageCenter::confirmCloudNetworkRemoval(const QString &strName, QWidget *pParent /* = 0*/) const 1430 1441 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r99946 r100389 363 363 bool confirmMediumRelease(const UIMedium &medium, bool fInduced, QWidget *pParent = 0) const; 364 364 bool confirmMediumRemoval(const UIMedium &medium, QWidget *pParent = 0) const; 365 int confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0) const;365 int confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0) const; 366 366 bool confirmInaccesibleMediaClear(const QStringList &mediaNameList, UIMediumDeviceType enmType, QWidget *pParent = 0); 367 bool confirmVisoDiscard(QWidget *pParent = 0) const; 367 368 /** @} */ 368 369 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r100348 r100389 35 35 #include <QMimeData> 36 36 #include <QTableView> 37 #include <QTextStream> 37 38 38 39 /* GUI includes: */ … … 51 52 #include <iprt/mem.h> 52 53 #include <iprt/err.h> 54 55 const ULONG uAllowedFileSize = _4K; 53 56 54 57 struct ISOFileObject … … 351 354 return; 352 355 356 /* Insert items to the current directory shown in the table view: */ 353 357 QModelIndex parentIndex = m_pTableProxyModel->mapToSource(m_pTableView->rootIndex()); 354 358 if (!parentIndex.isValid()) … … 358 362 if (!pParentItem) 359 363 return; 364 360 365 foreach (const QString &strPath, pathList) 361 366 { … … 777 782 void UIVisoContentBrowser::parseVisoFileContent(const QString &strFileName) 778 783 { 779 Q_UNUSED(strFileName); 784 sltResetAction(); 785 QFile file(strFileName); 786 if (!file.exists() || !file.open(QIODevice::ReadOnly | QIODevice::Text)) 787 return; 788 if (file.size() > uAllowedFileSize) 789 return; 790 QTextStream stream(&file); 791 QString strFileContent = stream.readAll(); 792 strFileContent.replace(' ', '\n'); 793 QStringList list = strFileContent.split("\n", Qt::SkipEmptyParts); 794 QMap<QString, QString> fileEntries; 795 foreach (const QString &strPart, list) 796 { 797 /* We currently do not support different on-ISO names for different namespaces. */ 798 if (strPart.startsWith("/") && strPart.count('=') <= 1) 799 { 800 QStringList fileEntry = strPart.split("=", Qt::SkipEmptyParts); 801 if (fileEntry.size() == 1) 802 { 803 QFileInfo fileInfo(fileEntry[0]); 804 if (fileInfo.exists()) 805 { 806 QString isoName = QString("/%1").arg(fileInfo.fileName()); 807 fileEntries[isoName] = fileEntry[0]; 808 } 809 } 810 else if (fileEntry.size() == 2) 811 { 812 if (QFileInfo(fileEntry[1]).exists()) 813 fileEntries[fileEntry[0]] = fileEntry[1]; 814 } 815 } 816 } 817 file.close(); 780 818 } 781 819 … … 925 963 if (m_pTableProxyModel) 926 964 m_pTableProxyModel->invalidate(); 965 m_strImportedISOPath.clear(); 927 966 } 928 967 … … 948 987 { 949 988 goUp(); 950 }951 952 void UIVisoContentBrowser::reset()953 {954 m_entryMap.clear();955 989 } 956 990 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h
r100348 r100389 128 128 * from the iso image. */ 129 129 void createVisoEntry(UICustomFileSystemItem *pItem, bool bRemove = false); 130 void reset();131 130 QString currentPath() const; 132 131 /** Returns a list of items which are currecntly selected -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r100348 r100389 44 44 #include "QILabel.h" 45 45 #include "QILineEdit.h" 46 #include "UIMessageCenter.h" 46 47 #include "QIToolBar.h" 47 48 #include "UIActionPool.h" … … 407 408 void UIVisoCreatorWidget::sltOpenAction() 408 409 { 410 if (!msgCenter().confirmVisoDiscard(this)) 411 return; 412 409 413 QString strFileName = QIFileDialog::getOpenFileName(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD), 410 414 "VISO files (*.viso)", this, UIVisoCreatorWidget::tr("Select a VISO file to load"));
Note:
See TracChangeset
for help on using the changeset viewer.