Changeset 35273 in vbox
- Timestamp:
- Dec 21, 2010 12:52:38 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
-
Frontends/VBoxManage/VBoxManageMisc.cpp (modified) (2 diffs)
-
Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp (modified) (1 diff)
-
Frontends/VirtualBox/src/globals/VBoxProblemReporter.h (modified) (1 diff)
-
Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp (modified) (2 diffs)
-
Main/ExtPackManagerImpl.cpp (modified) (12 diffs)
-
Main/VBoxExtPackHelperApp.cpp (modified) (6 diffs)
-
Main/idl/VirtualBox.xidl (modified) (4 diffs)
-
Main/include/ExtPackManagerImpl.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r35100 r35273 859 859 CHECK_ERROR2_RET(ptrExtPackMgr, OpenExtPackFile(bstrTarball.raw(), ptrExtPackFile.asOutParam()), RTEXITCODE_FAILURE); 860 860 CHECK_ERROR2_RET(ptrExtPackFile, COMGETTER(Name)(bstrName.asOutParam()), RTEXITCODE_FAILURE); 861 CHECK_ERROR2_RET(ptrExtPackFile, Install(fReplace), RTEXITCODE_FAILURE); 861 ComPtr<IProgress> ptrProgress; 862 CHECK_ERROR2_RET(ptrExtPackFile, Install(fReplace, NULL, ptrProgress.asOutParam()), RTEXITCODE_FAILURE); 863 if (!ptrProgress.isNull()) 864 CHECK_ERROR2_RET(ptrProgress, WaitForCompletion(-1), RTEXITCODE_FAILURE); 862 865 RTPrintf("Successfully installed \"%lS\".\n", bstrName.raw()); 863 866 } … … 895 898 896 899 Bstr bstrName(pszName); 897 CHECK_ERROR2_RET(ptrExtPackMgr, Uninstall(bstrName.raw(), fForced), RTEXITCODE_FAILURE); 900 ComPtr<IProgress> ptrProgress; 901 CHECK_ERROR2_RET(ptrExtPackMgr, Uninstall(bstrName.raw(), fForced, NULL, ptrProgress.asOutParam()), RTEXITCODE_FAILURE); 902 if (!ptrProgress.isNull()) 903 CHECK_ERROR2_RET(ptrProgress, WaitForCompletion(-1), RTEXITCODE_FAILURE); 898 904 RTPrintf("Successfully uninstalled \"%s\".\n", pszName); 899 905 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp
r35140 r35273 2142 2142 } 2143 2143 2144 void VBoxProblemReporter::cannotInstallExtPack(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent) 2145 { 2146 message (pParent ? pParent : mainWindowShown(), 2144 void VBoxProblemReporter::cannotInstallExtPack(const QString &strFilename, const CExtPackFile &extPackFile, const CProgress &progress, QWidget *pParent) 2145 { 2146 if (!pParent) 2147 pParent = mainWindowShown(); 2148 QString strErrInfo = !extPackFile.isOk() ? formatErrorInfo(extPackFile) : formatErrorInfo(progress.GetErrorInfo()); 2149 message (pParent, 2147 2150 Error, 2148 2151 tr("Failed to install the Extension Pack <b>%1</b>.").arg(strFilename), 2149 formatErrorInfo(extPackFile)); 2150 } 2151 2152 void VBoxProblemReporter::cannotUninstallExtPack(const QString &strPackName, const CExtPackManager &extPackManager, QWidget *pParent) 2153 { 2154 message (pParent ? pParent : mainWindowShown(), 2152 strErrInfo); 2153 } 2154 2155 void VBoxProblemReporter::cannotUninstallExtPack(const QString &strPackName, const CExtPackManager &extPackManager, 2156 const CProgress &progress, QWidget *pParent) 2157 { 2158 if (!pParent) 2159 pParent = mainWindowShown(); 2160 QString strErrInfo = !extPackManager.isOk() ? formatErrorInfo(extPackManager) : formatErrorInfo(progress.GetErrorInfo()); 2161 message (pParent, 2155 2162 Error, 2156 2163 tr("Failed to uninstall the Extension Pack <b>%1</b>.").arg(strPackName), 2157 formatErrorInfo(extPackManager));2164 strErrInfo); 2158 2165 } 2159 2166 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h
r35094 r35273 342 342 void cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent); 343 343 void badExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent); 344 void cannotInstallExtPack(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent);345 void cannotUninstallExtPack(const QString &strPackName, const CExtPackManager &extPackManager, QWidget *pParent);344 void cannotInstallExtPack(const QString &strFilename, const CExtPackFile &extPackFile, const CProgress &progress, QWidget *pParent); 345 void cannotUninstallExtPack(const QString &strPackName, const CExtPackManager &extPackManager, const CProgress &progress, QWidget *pParent); 346 346 bool confirmInstallingPackage(const QString &strPackName, const QString &strPackVersion, const QString &strPackDescription, QWidget *pParent); 347 347 bool confirmReplacePackage(const QString &strPackName, const QString &strPackVersionNew, const QString &strPackVersionOld, -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
r35103 r35273 177 177 * do a refresh even on failure. 178 178 */ 179 extPackFile.Install(fReplaceIt); 179 QString displayInfo; 180 CProgress progress = extPackFile.Install(fReplaceIt, displayInfo); 180 181 if (extPackFile.isOk()) 181 vboxProblem().notifyAboutExtPackInstalled(strPackName, pParent); 182 { 183 if (progress.isNull()) 184 vboxProblem().notifyAboutExtPackInstalled(strPackName, pParent); 185 else 186 { 187 vboxProblem().showModalProgressDialog(progress, tr("Extensions")); 188 if (!progress.GetCanceled()) 189 { 190 if (progress.isOk() && progress.GetResultCode() == 0) 191 vboxProblem().notifyAboutExtPackInstalled(strPackName, pParent); 192 else 193 vboxProblem().cannotInstallExtPack(strFilePath, extPackFile, progress, pParent); 194 } 195 } 196 } 182 197 else 183 vboxProblem().cannotInstallExtPack(strFilePath, extPackFile, p Parent);198 vboxProblem().cannotInstallExtPack(strFilePath, extPackFile, progress, pParent); 184 199 185 200 if (pstrExtPackName) … … 374 389 if (vboxProblem().confirmRemovingPackage(strSelectedPackageName, this)) 375 390 { 376 /* Get package manager: */ 391 /* 392 * Uninstall the package. 393 */ 377 394 CExtPackManager manager = vboxGlobal().virtualBox().GetExtensionPackManager(); 378 /* Uninstall package: */379 395 /** @todo Refuse this if any VMs are running. */ 380 manager.Uninstall(strSelectedPackageName, false /* forced removal? */); 396 QString displayInfo; 397 CProgress progress = manager.Uninstall(strSelectedPackageName, false /* forced removal? */, displayInfo); 381 398 if (manager.isOk()) 382 399 { 383 /* Remove selected package from cache: */384 for (int i = 0; i < m_cache.m_items.size(); ++i)400 bool fOk = true; 401 if (!progress.isNull()) 385 402 { 386 if (!strSelectedPackageName.compare(m_cache.m_items[i].m_strName, Qt::CaseInsensitive)) 403 vboxProblem().showModalProgressDialog(progress, tr("Extensions")); 404 fOk = progress.isOk() && progress.GetResultCode() == 0; 405 } 406 if (fOk) 407 { 408 /* Remove selected package from cache: */ 409 for (int i = 0; i < m_cache.m_items.size(); ++i) 387 410 { 388 m_cache.m_items.removeAt(i); 389 break; 411 if (!strSelectedPackageName.compare(m_cache.m_items[i].m_strName, Qt::CaseInsensitive)) 412 { 413 m_cache.m_items.removeAt(i); 414 break; 415 } 390 416 } 417 418 /* Remove selected package from tree: */ 419 delete pItem; 391 420 } 392 /* Remove selected package from tree: */393 delete pItem;421 else 422 vboxProblem().cannotUninstallExtPack(strSelectedPackageName, manager, progress, this); 394 423 } 395 else vboxProblem().cannotUninstallExtPack(strSelectedPackageName, manager, this); 424 else 425 vboxProblem().cannotUninstallExtPack(strSelectedPackageName, manager, progress, this); 396 426 } 397 427 } -
trunk/src/VBox/Main/ExtPackManagerImpl.cpp
r35237 r35273 585 585 } 586 586 587 STDMETHODIMP ExtPackFile::Install(BOOL a_fReplace) 588 { 587 STDMETHODIMP ExtPackFile::Install(BOOL a_fReplace, IN_BSTR a_bstrDisplayInfo, IProgress **a_ppProgress) 588 { 589 if (a_ppProgress) 590 *a_ppProgress = NULL; 591 Utf8Str strDisplayInfo(a_bstrDisplayInfo); 592 589 593 AutoCaller autoCaller(this); 590 594 HRESULT hrc = autoCaller.rc(); … … 592 596 { 593 597 if (m->fUsable) 594 hrc = m->ptrExtPackMgr->doInstall(this, RT_BOOL(a_fReplace) );598 hrc = m->ptrExtPackMgr->doInstall(this, RT_BOOL(a_fReplace), &strDisplayInfo, a_ppProgress); 595 599 else 596 600 hrc = setError(E_FAIL, "%s", m->strWhyUnusable.c_str()); … … 1924 1928 } 1925 1929 1926 STDMETHODIMP ExtPackManager::Uninstall(IN_BSTR a_bstrName, BOOL a_fForcedRemoval) 1930 STDMETHODIMP ExtPackManager::Uninstall(IN_BSTR a_bstrName, BOOL a_fForcedRemoval, IN_BSTR a_bstrDisplayInfo, 1931 IProgress **a_ppProgress) 1927 1932 { 1928 1933 CheckComArgNotNull(a_bstrName); 1929 1934 Utf8Str strName(a_bstrName); 1935 Utf8Str strDisplayInfo(a_bstrDisplayInfo); 1936 if (a_ppProgress) 1937 *a_ppProgress = NULL; 1930 1938 Assert(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON); 1931 1939 … … 1965 1973 */ 1966 1974 const char *pszForcedOpt = a_fForcedRemoval ? "--forced" : NULL; 1967 hrc = runSetUidToRootHelper("uninstall", 1975 hrc = runSetUidToRootHelper(&strDisplayInfo, 1976 "uninstall", 1968 1977 "--base-dir", m->strBaseDir.c_str(), 1969 1978 "--name", strName.c_str(), … … 2021 2030 */ 2022 2031 AutoWriteLock autoLock(this COMMA_LOCKVAL_SRC_POS); 2023 hrc = runSetUidToRootHelper("cleanup", 2032 hrc = runSetUidToRootHelper(NULL, 2033 "cleanup", 2024 2034 "--base-dir", m->strBaseDir.c_str(), 2025 2035 (const char *)NULL); … … 2078 2088 * 2079 2089 * @returns S_OK or a failure status with error information set. 2090 * @param a_pstrDisplayInfo Platform specific display info hacks. 2080 2091 * @param a_pszCommand The command to execute. 2081 2092 * @param ... The argument strings that goes along with the … … 2083 2094 * NULL. 2084 2095 */ 2085 HRESULT ExtPackManager::runSetUidToRootHelper( const char *a_pszCommand, ...)2096 HRESULT ExtPackManager::runSetUidToRootHelper(Utf8Str const *a_pstrDisplayInfo, const char *a_pszCommand, ...) 2086 2097 { 2087 2098 /* … … 2100 2111 const char *apszArgs[20]; 2101 2112 unsigned cArgs = 0; 2113 2114 LogRel(("ExtPack: Executing '%s'", szExecName)); 2102 2115 apszArgs[cArgs++] = &szExecName[0]; 2116 2117 if ( a_pstrDisplayInfo 2118 && a_pstrDisplayInfo->isNotEmpty()) 2119 { 2120 LogRel((" '--display-info-hack' '%s'", a_pstrDisplayInfo->c_str())); 2121 apszArgs[cArgs++] = "--display-info-hack"; 2122 apszArgs[cArgs++] = a_pstrDisplayInfo->c_str(); 2123 } 2124 2125 LogRel(("'%s'", a_pszCommand)); 2103 2126 apszArgs[cArgs++] = a_pszCommand; 2104 2127 … … 2106 2129 va_start(va, a_pszCommand); 2107 2130 const char *pszLastArg; 2108 LogRel(("ExtPack: Executing '%s'", szExecName)); 2109 do 2110 { 2111 LogRel((" '%s'", apszArgs[cArgs - 1])); 2131 for (;;) 2132 { 2112 2133 AssertReturn(cArgs < RT_ELEMENTS(apszArgs) - 1, E_UNEXPECTED); 2113 2134 pszLastArg = va_arg(va, const char *); 2135 if (!pszLastArg) 2136 break; 2137 LogRel((" '%s'", pszLastArg)); 2114 2138 apszArgs[cArgs++] = pszLastArg; 2115 } while (pszLastArg != NULL); 2139 }; 2140 va_end(va); 2141 2116 2142 LogRel(("\n")); 2117 va_end(va);2118 2143 apszArgs[cArgs] = NULL; 2119 2144 … … 2450 2475 * 2451 2476 * @returns COM status code. 2452 * @param a_pExtPackFile The extension pack file, caller checks that it's 2453 * usable. 2454 * @param a_fReplace Whether to replace any existing extpack or just 2455 * fail. 2456 */ 2457 HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace) 2477 * @param a_pExtPackFile The extension pack file, caller checks that 2478 * it's usable. 2479 * @param a_fReplace Whether to replace any existing extpack or just 2480 * fail. 2481 * @param a_pstrDisplayInfo Host specific display information hacks. 2482 * @param a_ppProgress Where to return a progress object some day. Can 2483 * be NULL. 2484 */ 2485 HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo, 2486 IProgress **a_ppProgress) 2458 2487 { 2459 2488 AssertReturn(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON, E_UNEXPECTED); 2460 2489 iprt::MiniString const * const pStrName = &a_pExtPackFile->m->Desc.strName; 2461 2490 iprt::MiniString const * const pStrTarball = &a_pExtPackFile->m->strExtPackFile; 2491 NOREF(a_ppProgress); /** @todo implement progress object */ 2462 2492 2463 2493 AutoCaller autoCaller(this); … … 2491 2521 */ 2492 2522 /** @todo add a hash (SHA-256) of the tarball or maybe just the manifest. */ 2493 hrc = runSetUidToRootHelper("install", 2523 hrc = runSetUidToRootHelper(a_pstrDisplayInfo, 2524 "install", 2494 2525 "--base-dir", m->strBaseDir.c_str(), 2495 2526 "--cert-dir", m->strCertificatDirPath.c_str(), … … 2517 2548 */ 2518 2549 if (ErrInfo.Core.rc == VERR_EXTPACK_UNSUPPORTED_HOST_UNINSTALL) 2519 runSetUidToRootHelper("uninstall", 2550 runSetUidToRootHelper(a_pstrDisplayInfo, 2551 "uninstall", 2520 2552 "--base-dir", m->strBaseDir.c_str(), 2521 2553 "--name", pStrName->c_str(), -
trunk/src/VBox/Main/VBoxExtPackHelperApp.cpp
r35256 r35273 89 89 # define OPT_STDERR 1092 90 90 #endif 91 #define OPT_DISP_INFO_HACK 1093 91 92 /** @} */ 92 93 … … 1463 1464 * @param argv The arguments. 1464 1465 * @param iCmd The command that is being executed. 1465 */ 1466 static RTEXITCODE RelaunchElevated(int argc, char **argv, int iCmd) 1466 * @param pszDisplayInfoHack Display information hack. Platform specific++. 1467 */ 1468 static RTEXITCODE RelaunchElevated(int argc, char **argv, int iCmd, const char *pszDisplayInfoHack) 1467 1469 { 1468 1470 /* … … 1694 1696 * Elevation check. 1695 1697 */ 1696 RTEXITCODE rcExit; 1698 const char *pszDisplayInfoHack = NULL; 1699 RTEXITCODE rcExit; 1697 1700 #ifdef WITH_ELEVATION 1698 bool fElevated;1701 bool fElevated; 1699 1702 rcExit = ElevationCheck(&fElevated); 1700 1703 if (rcExit != RTEXITCODE_SUCCESS) … … 1707 1710 static const RTGETOPTDEF s_aOptions[] = 1708 1711 { 1709 { "install", CMD_INSTALL,RTGETOPT_REQ_NOTHING },1710 { "uninstall", CMD_UNINSTALL,RTGETOPT_REQ_NOTHING },1711 { "cleanup", CMD_CLEANUP,RTGETOPT_REQ_NOTHING },1712 { "install", CMD_INSTALL, RTGETOPT_REQ_NOTHING }, 1713 { "uninstall", CMD_UNINSTALL, RTGETOPT_REQ_NOTHING }, 1714 { "cleanup", CMD_CLEANUP, RTGETOPT_REQ_NOTHING }, 1712 1715 #ifdef WITH_ELEVATION 1713 { "--elevated", OPT_ELEVATED,RTGETOPT_REQ_NOTHING },1714 { "--stdout", OPT_STDOUT,RTGETOPT_REQ_STRING },1715 { "--stderr", OPT_STDERR,RTGETOPT_REQ_STRING },1716 { "--elevated", OPT_ELEVATED, RTGETOPT_REQ_NOTHING }, 1717 { "--stdout", OPT_STDOUT, RTGETOPT_REQ_STRING }, 1718 { "--stderr", OPT_STDERR, RTGETOPT_REQ_STRING }, 1716 1719 #endif 1720 { "--display-info-hack", OPT_DISP_INFO_HACK, RTGETOPT_REQ_STRING }, 1717 1721 }; 1718 1722 RTGETOPTSTATE GetState; … … 1735 1739 #ifdef WITH_ELEVATION 1736 1740 if (!fElevated) 1737 return RelaunchElevated(argc, argv, ch );1741 return RelaunchElevated(argc, argv, ch, pszDisplayInfoHack); 1738 1742 #endif 1739 1743 int cCmdargs = argc - GetState.iNext; … … 1793 1797 #endif 1794 1798 1799 case OPT_DISP_INFO_HACK: 1800 if (pszDisplayInfoHack) 1801 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "--display-info-hack shall only occur once"); 1802 pszDisplayInfoHack = ValueUnion.psz; 1803 break; 1804 1795 1805 case 'h': 1796 1806 case 'V': -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r35251 r35273 14779 14779 <interface 14780 14780 name="IExtPackFile" extends="IExtPackBase" 14781 uuid=" 64b65bda-eedf-442c-9fd2-d179a021031a"14781 uuid="b6b49f55-efcc-4f08-b486-56e8d8afb10b" 14782 14782 wsmap="suppress" 14783 14783 > … … 14804 14804 </desc> 14805 14805 </param> 14806 <param name="displayInfo" type="wstring" dir="in"> 14807 <desc> 14808 Platform specific display information. Reserved for future hacks. 14809 </desc> 14810 </param> 14811 <param name="progess" type="IProgress" dir="return"> 14812 <desc> 14813 Progress object for the operation if it was decided that it should 14814 be executed asynchronously - i.e. never in 4.0.0, but maybe in 4.0.x. 14815 </desc> 14816 </param> 14806 14817 </method> 14807 14818 </interface> … … 14809 14820 <interface 14810 14821 name="IExtPackManager" extends="$unknown" 14811 uuid=" 70d808a9-176f-4d45-adad-7c509b8309b3"14822 uuid="2451b1ba-ab1c-42fb-b453-c58433bea8c7" 14812 14823 wsmap="suppress" 14813 14824 > … … 14863 14874 Forced removal of the extension pack. This means that the uninstall 14864 14875 hook will not be called. 14876 </desc> 14877 </param> 14878 <param name="displayInfo" type="wstring" dir="in"> 14879 <desc> 14880 Platform specific display information. Reserved for future hacks. 14881 </desc> 14882 </param> 14883 <param name="progess" type="IProgress" dir="return"> 14884 <desc> 14885 Progress object for the operation if it was decided that it should 14886 be executed asynchronously - i.e. never in 4.0.0, but maybe in 4.0.x. 14865 14887 </desc> 14866 14888 </param> -
trunk/src/VBox/Main/include/ExtPackManagerImpl.h
r35184 r35273 70 70 * @{ */ 71 71 STDMETHOD(COMGETTER(FilePath))(BSTR *a_pbstrPath); 72 STDMETHOD(Install)(BOOL a_fReplace );72 STDMETHOD(Install)(BOOL a_fReplace, IN_BSTR a_bstrDisplayInfo, IProgress **a_ppProgress); 73 73 /** @} */ 74 74 … … 211 211 STDMETHOD(Find)(IN_BSTR a_bstrName, IExtPack **a_pExtPack); 212 212 STDMETHOD(OpenExtPackFile)(IN_BSTR a_bstrTarball, IExtPackFile **a_ppExtPackFile); 213 STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval );213 STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval, IN_BSTR a_bstrDisplayInfo, IProgress **a_ppProgress); 214 214 STDMETHOD(Cleanup)(void); 215 215 STDMETHOD(QueryAllPlugInsForFrontend)(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules)); … … 219 219 /** @name Internal interfaces used by other Main classes. 220 220 * @{ */ 221 HRESULT doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace); 221 HRESULT doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo, 222 IProgress **a_ppProgress); 222 223 void callAllVirtualBoxReadyHooks(void); 223 224 void callAllConsoleReadyHooks(IConsole *a_pConsole); … … 233 234 234 235 private: 235 HRESULT runSetUidToRootHelper( const char *a_pszCommand, ...);236 HRESULT runSetUidToRootHelper(Utf8Str const *a_pstrDisplayInfo, const char *a_pszCommand, ...); 236 237 ExtPack *findExtPack(const char *a_pszName); 237 238 void removeExtPack(const char *a_pszName);
Note:
See TracChangeset
for help on using the changeset viewer.

