- Timestamp:
- Nov 7, 2018 12:55:58 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/extradata
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r75224 r75305 222 222 223 223 224 /* Obsolete keys: */ 225 QMap<QString, QString> UIExtraDataDefs::prepareObsoleteKeysMap() 226 { 227 QMap<QString, QString> map; 228 // Define substitutes here.. 229 return map; 230 } 231 QMap<QString, QString> UIExtraDataDefs::g_mapOfObsoleteKeys = UIExtraDataDefs::prepareObsoleteKeysMap(); 232 233 224 234 bool UIToolStuff::isTypeOfClass(UIToolType enmType, UIToolClass enmClass) 225 235 { -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r75291 r75305 20 20 21 21 /* Qt includes: */ 22 #include <QMap> 22 23 #include <QMetaType> 23 24 #include <QObject> … … 394 395 /** @} */ 395 396 397 398 /** @name Old key support stuff. 399 * @{ */ 400 /** Prepares obsolete keys map. */ 401 SHARED_LIBRARY_STUFF QMap<QString, QString> prepareObsoleteKeysMap(); 402 403 /** Holds the obsolete keys map. */ 404 SHARED_LIBRARY_STUFF extern QMap<QString, QString> g_mapOfObsoleteKeys; 405 /** @} */ 396 406 } 397 407 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r75304 r75305 2117 2117 QString UIExtraDataManager::extraDataString(const QString &strKey, const QUuid &uID /* = GlobalID */) 2118 2118 { 2119 /* Get the value. Return 'QString()' if not found: */ 2120 const QString strValue = extraDataStringUnion(strKey, uID); 2119 /* Get the actual value: */ 2120 QString strValue = extraDataStringUnion(strKey, uID); 2121 /* If actual value is null we might be able to find old one: */ 2121 2122 if (strValue.isNull()) 2123 { 2124 foreach (const QString &strOldKey, g_mapOfObsoleteKeys.values(strKey)) 2125 { 2126 strValue = extraDataStringUnion(strOldKey, uID); 2127 if (!strValue.isNull()) 2128 break; 2129 } 2130 } 2131 /* Return null string if result is empty: */ 2132 if (strValue.isEmpty()) 2122 2133 return QString(); 2123 2134 … … 2151 2162 if (!comVBox.isOk()) 2152 2163 msgCenter().cannotSetExtraData(comVBox, strKey, strValue); 2164 /* Wipe out old keys: */ 2165 foreach (const QString &strOldKey, g_mapOfObsoleteKeys.values(strKey)) 2166 { 2167 comVBox.SetExtraData(strOldKey, QString()); 2168 if (!comVBox.isOk()) 2169 { 2170 msgCenter().cannotSetExtraData(comVBox, strOldKey, strValue); 2171 break; 2172 } 2173 } 2153 2174 } 2154 2175 /* Machine extra-data: */ … … 2176 2197 if (!comSessionMachine.isOk()) 2177 2198 msgCenter().cannotSetExtraData(comSessionMachine, strKey, strValue); 2199 /* Wipe out old keys: */ 2200 foreach (const QString &strOldKey, g_mapOfObsoleteKeys.values(strKey)) 2201 { 2202 comSessionMachine.SetExtraData(strOldKey, QString()); 2203 if (!comSessionMachine.isOk()) 2204 { 2205 msgCenter().cannotSetExtraData(comSessionMachine, strOldKey, strValue); 2206 break; 2207 } 2208 } 2178 2209 comSession.UnlockMachine(); 2179 2210 } … … 2182 2213 QStringList UIExtraDataManager::extraDataStringList(const QString &strKey, const QUuid &uID /* = GlobalID */) 2183 2214 { 2184 /* Get the value. Return 'QStringList()' if not found: */ 2185 const QString strValue = extraDataStringUnion(strKey, uID); 2215 /* Get the actual value: */ 2216 QString strValue = extraDataStringUnion(strKey, uID); 2217 /* If actual value is null we might be able to find old one: */ 2186 2218 if (strValue.isNull()) 2219 { 2220 foreach (const QString &strOldKey, g_mapOfObsoleteKeys.values(strKey)) 2221 { 2222 strValue = extraDataStringUnion(strOldKey, uID); 2223 if (!strValue.isNull()) 2224 break; 2225 } 2226 } 2227 /* Return empty string list if result is empty: */ 2228 if (strValue.isEmpty()) 2187 2229 return QStringList(); 2188 2230 … … 2217 2259 if (!comVBox.isOk()) 2218 2260 msgCenter().cannotSetExtraData(comVBox, strKey, value.join(",")); 2261 /* Wipe out old keys: */ 2262 foreach (const QString &strOldKey, g_mapOfObsoleteKeys.values(strKey)) 2263 { 2264 comVBox.SetExtraData(strOldKey, QString()); 2265 if (!comVBox.isOk()) 2266 { 2267 msgCenter().cannotSetExtraData(comVBox, strOldKey, value.join(",")); 2268 break; 2269 } 2270 } 2219 2271 } 2220 2272 /* Machine extra-data: */ … … 2242 2294 if (!comSessionMachine.isOk()) 2243 2295 msgCenter().cannotSetExtraData(comSessionMachine, strKey, value.join(",")); 2296 /* Wipe out old keys: */ 2297 foreach (const QString &strOldKey, g_mapOfObsoleteKeys.values(strKey)) 2298 { 2299 comSessionMachine.SetExtraData(strOldKey, QString()); 2300 if (!comSessionMachine.isOk()) 2301 { 2302 msgCenter().cannotSetExtraData(comSessionMachine, strOldKey, value.join(",")); 2303 break; 2304 } 2305 } 2244 2306 comSession.UnlockMachine(); 2245 2307 }
Note:
See TracChangeset
for help on using the changeset viewer.