Changeset 91878 in vbox
- Timestamp:
- Oct 20, 2021 11:29:07 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r91757 r91878 1932 1932 1933 1933 /********************************************************************************************************************************* 1934 * Class UINotificationProgressVFSExplorerUpdate implementation. * 1935 *********************************************************************************************************************************/ 1936 1937 UINotificationProgressVFSExplorerUpdate::UINotificationProgressVFSExplorerUpdate(const CVFSExplorer &comExplorer) 1938 : m_comExplorer(comExplorer) 1939 { 1940 } 1941 1942 QString UINotificationProgressVFSExplorerUpdate::name() const 1943 { 1944 return UINotificationProgress::tr("Updating VFS explorer ..."); 1945 } 1946 1947 QString UINotificationProgressVFSExplorerUpdate::details() const 1948 { 1949 return UINotificationProgress::tr("<b>Path:</b> %1").arg(m_strPath); 1950 } 1951 1952 CProgress UINotificationProgressVFSExplorerUpdate::createProgress(COMResult &comResult) 1953 { 1954 /* Acquire path: */ 1955 m_strPath = m_comExplorer.GetPath(); 1956 if (!m_comExplorer.isOk()) 1957 { 1958 /* Store COM result: */ 1959 comResult = m_comExplorer; 1960 /* Return progress-wrapper: */ 1961 return CProgress(); 1962 } 1963 1964 /* Initialize progress-wrapper: */ 1965 CProgress comProgress = m_comExplorer.Update(); 1966 /* Store COM result: */ 1967 comResult = m_comExplorer; 1968 /* Return progress-wrapper: */ 1969 return comProgress; 1970 } 1971 1972 1973 /********************************************************************************************************************************* 1974 * Class UINotificationProgressVFSExplorerFilesRemove implementation. * 1975 *********************************************************************************************************************************/ 1976 1977 UINotificationProgressVFSExplorerFilesRemove::UINotificationProgressVFSExplorerFilesRemove(const CVFSExplorer &comExplorer, 1978 const QVector<QString> &files) 1979 : m_comExplorer(comExplorer) 1980 , m_files(files) 1981 { 1982 } 1983 1984 QString UINotificationProgressVFSExplorerFilesRemove::name() const 1985 { 1986 return UINotificationProgress::tr("Removing VFS explorer files ..."); 1987 } 1988 1989 QString UINotificationProgressVFSExplorerFilesRemove::details() const 1990 { 1991 return UINotificationProgress::tr("<b>Path:</b> %1<br><b>Files:</b> %2") 1992 .arg(m_strPath) 1993 .arg(QStringList(m_files.toList()).join(", ")); 1994 } 1995 1996 CProgress UINotificationProgressVFSExplorerFilesRemove::createProgress(COMResult &comResult) 1997 { 1998 /* Acquire path: */ 1999 m_strPath = m_comExplorer.GetPath(); 2000 if (!m_comExplorer.isOk()) 2001 { 2002 /* Store COM result: */ 2003 comResult = m_comExplorer; 2004 /* Return progress-wrapper: */ 2005 return CProgress(); 2006 } 2007 2008 /* Initialize progress-wrapper: */ 2009 CProgress comProgress = m_comExplorer.Remove(m_files); 2010 /* Store COM result: */ 2011 comResult = m_comExplorer; 2012 /* Return progress-wrapper: */ 2013 return comProgress; 2014 } 2015 2016 2017 /********************************************************************************************************************************* 1934 2018 * Class UINotificationProgressLaunchVSDFormCreate implementation. * 1935 2019 *********************************************************************************************************************************/ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r91757 r91878 44 44 #include "CSession.h" 45 45 #include "CSnapshot.h" 46 #include "CVFSExplorer.h" 46 47 #include "CVirtualSystemDescription.h" 47 48 #include "CVirtualSystemDescriptionForm.h" … … 961 962 }; 962 963 964 /** UINotificationProgress extension for VFS explorer update functionality. */ 965 class SHARED_LIBRARY_STUFF UINotificationProgressVFSExplorerUpdate : public UINotificationProgress 966 { 967 Q_OBJECT; 968 969 public: 970 971 /** Constructs VFS explorer update notification-progress. 972 * @param comExplorer Brings the VFS explorer being updated. */ 973 UINotificationProgressVFSExplorerUpdate(const CVFSExplorer &comExplorer); 974 975 protected: 976 977 /** Returns object name. */ 978 virtual QString name() const /* override final */; 979 /** Returns object details. */ 980 virtual QString details() const /* override final */; 981 /** Creates and returns started progress-wrapper. */ 982 virtual CProgress createProgress(COMResult &comResult) /* override final */; 983 984 private: 985 986 /** Holds the VFS explorer being updated. */ 987 CVFSExplorer m_comExplorer; 988 /** Holds the VFS explorer path. */ 989 QString m_strPath; 990 }; 991 992 /** UINotificationProgress extension for VFS explorer files remove functionality. */ 993 class SHARED_LIBRARY_STUFF UINotificationProgressVFSExplorerFilesRemove : public UINotificationProgress 994 { 995 Q_OBJECT; 996 997 public: 998 999 /** Constructs VFS explorer files remove notification-progress. 1000 * @param comExplorer Brings the VFS explorer removing the files. 1001 * @param files Brings a vector of files to be removed. */ 1002 UINotificationProgressVFSExplorerFilesRemove(const CVFSExplorer &comExplorer, 1003 const QVector<QString> &files); 1004 1005 protected: 1006 1007 /** Returns object name. */ 1008 virtual QString name() const /* override final */; 1009 /** Returns object details. */ 1010 virtual QString details() const /* override final */; 1011 /** Creates and returns started progress-wrapper. */ 1012 virtual CProgress createProgress(COMResult &comResult) /* override final */; 1013 1014 private: 1015 1016 /** Holds the VFS explorer removing the files. */ 1017 CVFSExplorer m_comExplorer; 1018 /** Holds a vector of files to be removed. */ 1019 QVector<QString> m_files; 1020 /** Holds the VFS explorer path. */ 1021 QString m_strPath; 1022 }; 1023 963 1024 /** UINotificationProgress extension for launch VSD form create functionality. */ 964 1025 class SHARED_LIBRARY_STUFF UINotificationProgressLaunchVSDFormCreate : public UINotificationProgress -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp
r91707 r91878 304 304 /* Initialize VFS explorer: */ 305 305 CVFSExplorer comExplorer = comAppliance.CreateVFSExplorer(uri(false /* fWithFile */)); 306 if (comExplorer.isNotNull()) 307 { 308 CProgress comProgress = comExplorer.Update(); 309 if (comExplorer.isOk() && comProgress.isNotNull()) 310 { 311 msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIWizardExportApp", "Checking files ..."), 312 ":/progress_refresh_90px.png", this); 313 if (comProgress.GetCanceled()) 314 return false; 315 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 316 return msgCenter().cannotCheckFiles(comProgress, this); 317 } 318 else 319 return msgCenter().cannotCheckFiles(comExplorer, this); 320 } 321 else 306 if (!comAppliance.isOk()) 322 307 return msgCenter().cannotCheckFiles(comAppliance, this); 308 309 /* Update VFS explorer: */ 310 UINotificationProgressVFSExplorerUpdate *pNotification = 311 new UINotificationProgressVFSExplorerUpdate(comExplorer); 312 if (!handleNotificationProgressNow(pNotification)) 313 return false; 323 314 324 315 /* Confirm overwriting for existing files: */ … … 330 321 if (!exists.isEmpty()) 331 322 { 332 CProgress comProgress = comExplorer.Remove(exists); 333 if (comExplorer.isOk() && comProgress.isNotNull()) 334 { 335 msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIWizardExportApp", "Removing files ..."), 336 ":/progress_delete_90px.png", this); 337 if (comProgress.GetCanceled()) 338 return false; 339 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 340 return msgCenter().cannotRemoveFiles(comProgress, this); 341 } 342 else 343 return msgCenter().cannotCheckFiles(comExplorer, this); 323 /* Remove files with VFS explorer: */ 324 UINotificationProgressVFSExplorerFilesRemove *pNotification = 325 new UINotificationProgressVFSExplorerFilesRemove(comExplorer, exists); 326 if (!handleNotificationProgressNow(pNotification)) 327 return false; 344 328 } 345 329
Note:
See TracChangeset
for help on using the changeset viewer.