- Timestamp:
- Apr 13, 2007 9:31:17 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VMGlobalSettings.cpp
r2044 r2067 91 91 const char *name; 92 92 const char *rx; 93 bool canDelete; 93 94 } 94 95 gPropertyMap[] = 95 96 { 96 { "GUI/Input/HostKey", "hostKey", "\\d*[1-9]\\d*" },97 { "GUI/Input/AutoCapture", "autoCapture", "true|false" },98 { "GUI/Customizations", "guiFeatures", "\\S+" },97 { "GUI/Input/HostKey", "hostKey", "\\d*[1-9]\\d*", true }, 98 { "GUI/Input/AutoCapture", "autoCapture", "true|false", true }, 99 { "GUI/Customizations", "guiFeatures", "\\S+", true }, 99 100 /* LanguageID regexp must correlate with gVBoxLangIDRegExp in 100 101 * VBoxGlobal.cpp */ 101 { "GUI/LanguageID", "languageId", "(([a-z]{2})(_([A-Z]{2}))?)|(built_in)" },102 { "GUI/LanguageID", "languageId", "(([a-z]{2})(_([A-Z]{2}))?)|(built_in)", true }, 102 103 }; 103 104 … … 223 224 void VMGlobalSettings::setPropertyPrivate (int index, const QString &value) 224 225 { 225 if (!QRegExp (gPropertyMap [index].rx).exactMatch (value)) 226 { 227 last_err = tr ("The value '%1' of the key '%2' doesn't match the " 228 "regexp constraint '%3'.") 229 .arg (value, gPropertyMap [index].publicName, 230 gPropertyMap [index].rx); 231 return; 226 if (value.isNull()) 227 { 228 if (!gPropertyMap [index].canDelete) 229 { 230 last_err = tr ("Cannot delete the key '%1'.") 231 .arg (gPropertyMap [index].publicName); 232 return; 233 } 234 } 235 else 236 { 237 if (!QRegExp (gPropertyMap [index].rx).exactMatch (value)) 238 { 239 last_err = tr ("The value '%1' of the key '%2' doesn't match the " 240 "regexp constraint '%3'.") 241 .arg (value, gPropertyMap [index].publicName, 242 gPropertyMap [index].rx); 243 return; 244 } 232 245 } 233 246 … … 241 254 Assert (ok); 242 255 if (ok) 256 { 257 last_err = QString::null; 243 258 emit propertyChanged (gPropertyMap [index].publicName, 244 259 gPropertyMap [index].name); 245 } 246 } 247 260 } 261 } 262 } 263
Note:
See TracChangeset
for help on using the changeset viewer.