Changeset 86845 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 10, 2020 11:11:14 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r86817 r86845 1035 1035 } 1036 1036 1037 void UIMessageCenter::cannotOpenPublicKeyFile(const QString &strPath, QWidget *pParent /* = 0 */) const 1037 void UIMessageCenter::cannotCreateConsoleConnection(const CCloudMachine &comMachine, QWidget *pParent /* = 0 */) 1038 { 1039 error(pParent, MessageType_Error, 1040 tr("Failed to create console connection for cloud machine <b>%1</b>.") 1041 .arg(CCloudMachine(comMachine).GetName()), 1042 UIErrorString::formatErrorInfo(comMachine)); 1043 } 1044 1045 void UIMessageCenter::cannotCreateConsoleConnection(const CProgress &comProgress, const QString &strMachineName, QWidget *pParent /* = 0 */) 1046 { 1047 error(pParent, MessageType_Error, 1048 tr("Failed to create console connection for cloud machine <b>%1</b>.") 1049 .arg(strMachineName), 1050 UIErrorString::formatErrorInfo(comProgress)); 1051 } 1052 1053 void UIMessageCenter::cannotDeleteConsoleConnection(const CCloudMachine &comMachine, QWidget *pParent /* = 0 */) 1054 { 1055 error(pParent, MessageType_Error, 1056 tr("Failed to delete console connection for cloud machine <b>%1</b>.") 1057 .arg(CCloudMachine(comMachine).GetName()), 1058 UIErrorString::formatErrorInfo(comMachine)); 1059 } 1060 1061 void UIMessageCenter::cannotDeleteConsoleConnection(const CProgress &comProgress, const QString &strMachineName, QWidget *pParent /* = 0 */) 1062 { 1063 error(pParent, MessageType_Error, 1064 tr("Failed to delete console connection for cloud machine <b>%1</b>.") 1065 .arg(strMachineName), 1066 UIErrorString::formatErrorInfo(comProgress)); 1067 } 1068 1069 void UIMessageCenter::publicKeyFilePathIsEmpty(QWidget *pParent /* = 0 */) const 1070 { 1071 alert(pParent, MessageType_Error, 1072 tr("Public key file path is empty.")); 1073 } 1074 1075 void UIMessageCenter::publicKeyFileIsntReadable(const QString &strPath, QWidget *pParent /* = 0 */) const 1038 1076 { 1039 1077 alert(pParent, MessageType_Error, 1040 1078 tr("Failed to open the public key file <nobr><b>%1</b></nobr>. Check file permissions.") 1041 1079 .arg(strPath)); 1042 }1043 1044 void UIMessageCenter::cannotCreateConsoleConnection(const CCloudMachine &comMachine, QWidget *pParent /* = 0 */)1045 {1046 error(pParent, MessageType_Error,1047 tr("Failed to create console connection for cloud machine <b>%1</b>.")1048 .arg(CCloudMachine(comMachine).GetName()),1049 UIErrorString::formatErrorInfo(comMachine));1050 }1051 1052 void UIMessageCenter::cannotCreateConsoleConnection(const CProgress &comProgress, const QString &strMachineName, QWidget *pParent /* = 0 */)1053 {1054 error(pParent, MessageType_Error,1055 tr("Failed to create console connection for cloud machine <b>%1</b>.")1056 .arg(strMachineName),1057 UIErrorString::formatErrorInfo(comProgress));1058 }1059 1060 void UIMessageCenter::cannotDeleteConsoleConnection(const CCloudMachine &comMachine, QWidget *pParent /* = 0 */)1061 {1062 error(pParent, MessageType_Error,1063 tr("Failed to delete console connection for cloud machine <b>%1</b>.")1064 .arg(CCloudMachine(comMachine).GetName()),1065 UIErrorString::formatErrorInfo(comMachine));1066 }1067 1068 void UIMessageCenter::cannotDeleteConsoleConnection(const CProgress &comProgress, const QString &strMachineName, QWidget *pParent /* = 0 */)1069 {1070 error(pParent, MessageType_Error,1071 tr("Failed to delete console connection for cloud machine <b>%1</b>.")1072 .arg(strMachineName),1073 UIErrorString::formatErrorInfo(comProgress));1074 1080 } 1075 1081 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r86776 r86845 305 305 void cannotMoveMachine(const CMachine &machine, QWidget *pParent = 0) const; 306 306 void cannotMoveMachine(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0) const; 307 void cannotOpenPublicKeyFile(const QString &strPath, QWidget *pParent = 0) const;308 307 void cannotCreateConsoleConnection(const CCloudMachine &comMachine, QWidget *pParent = 0); 309 308 void cannotCreateConsoleConnection(const CProgress &comProgress, const QString &strMachineName, QWidget *pParent = 0); 310 309 void cannotDeleteConsoleConnection(const CCloudMachine &comMachine, QWidget *pParent = 0); 311 310 void cannotDeleteConsoleConnection(const CProgress &comProgress, const QString &strMachineName, QWidget *pParent = 0); 311 void publicKeyFilePathIsEmpty(QWidget *pParent = 0) const; 312 void publicKeyFileIsntReadable(const QString &strPath, QWidget *pParent = 0) const; 312 313 313 314 /* API: Snapshot warnings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r86734 r86845 136 136 void prepare(); 137 137 138 /** Loads file contents. */ 139 void loadFileContents(const QString &strPath, bool fIgnoreErrors = false); 138 /** Loads file contents. 139 * @returns Whether file was really loaded. */ 140 bool loadFileContents(const QString &strPath, bool fIgnoreErrors = false); 140 141 141 142 /** Holds the text-editor instance. */ … … 235 236 } 236 237 237 void UIAcquirePublicKeyDialog::loadFileContents(const QString &strPath, bool fIgnoreErrors /* = false */) 238 { 238 bool UIAcquirePublicKeyDialog::loadFileContents(const QString &strPath, bool fIgnoreErrors /* = false */) 239 { 240 /* Make sure file path isn't empty: */ 239 241 if (strPath.isEmpty()) 240 return; 242 { 243 if (!fIgnoreErrors) 244 msgCenter().publicKeyFilePathIsEmpty(); 245 return false; 246 } 247 248 /* Make sure file can be opened: */ 241 249 QFile file(strPath); 242 if (file.open(QIODevice::ReadOnly)) 243 m_pTextEditor->setPlainText(file.readAll()); 244 else if (!fIgnoreErrors) 245 msgCenter().cannotOpenPublicKeyFile(strPath); 250 if (!file.open(QIODevice::ReadOnly)) 251 { 252 if (!fIgnoreErrors) 253 msgCenter().publicKeyFileIsntReadable(strPath); 254 return false; 255 } 256 257 /* File opened and read, filling editor: */ 258 m_pTextEditor->setPlainText(file.readAll()); 259 return true; 246 260 } 247 261
Note:
See TracChangeset
for help on using the changeset viewer.