VirtualBox

Changeset 2067 in vbox for trunk


Ignore:
Timestamp:
Apr 13, 2007 9:31:17 AM (18 years ago)
Author:
vboxsync
Message:

FE/Qt: Fixed: It was impossible to set GUI/LanguageID to null (i.e. delete this key to reset the language to the default).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VMGlobalSettings.cpp

    r2044 r2067  
    9191    const char *name;
    9292    const char *rx;
     93    bool canDelete;
    9394}
    9495gPropertyMap[] =
    9596{
    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 },
    99100    /* LanguageID regexp must correlate with gVBoxLangIDRegExp in
    100101     * 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 },
    102103};
    103104
     
    223224void VMGlobalSettings::setPropertyPrivate (int index, const QString &value)
    224225{
    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        }
    232245    }
    233246
     
    241254        Assert (ok);
    242255        if (ok)
     256        {
     257            last_err = QString::null;
    243258            emit propertyChanged (gPropertyMap [index].publicName,
    244259                                  gPropertyMap [index].name);
    245     }
    246 }
    247 
     260        }
     261    }
     262}
     263
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette