| 373 | } |
| 374 | |
| 375 | KeyMap::Layout KeyMap::locale(){ |
| 376 | setlocale(LC_ALL, ""); |
| 377 | QString loc = setlocale(LC_CTYPE, 0); |
| 378 | loc = loc.toLower().replace('_', '-'); |
| 379 | if(loc.startsWith("dk-")) |
| 380 | return KeyMap::DK; |
| 381 | else if(loc.startsWith("fr-")) |
| 382 | return KeyMap::FR; |
| 383 | else if(loc.startsWith("de-")) |
| 384 | return KeyMap::DE; |
| 385 | else if(loc.startsWith("it-")) |
| 386 | return KeyMap::IT; |
| 387 | else if(loc.startsWith("pl-")) |
| 388 | return KeyMap::PL; |
| 389 | else if(loc.startsWith("no-")) |
| 390 | return KeyMap::NO; |
| 391 | else if(loc.startsWith("es-es")) |
| 392 | // Spain uses the ES layout |
| 393 | return KeyMap::ES; |
| 394 | else if(loc.startsWith("es-")) |
| 395 | // Other Spanish locales use MX |
| 396 | return KeyMap::MX; |
| 397 | else if(loc.startsWith("se-")) |
| 398 | return KeyMap::SE; |
| 399 | else if(loc.startsWith("en-us") || loc.startsWith("en-au") || loc.startsWith("en-ca") || loc.startsWith("en-hk") || loc.startsWith("en-in") || loc.startsWith("en-nz") || loc.startsWith("en-ph") || loc.startsWith("en-sg") || loc.startsWith("en-za")) |
| 400 | // Most English locales use US |
| 401 | return KeyMap::US; |
| 402 | else |
| 403 | // Default to GB |
| 404 | return KeyMap::GB; |
| 405 | } |
| 406 | |
| 407 | KeyMap::Layout KeyMap::getLayout(const QString& name){ |
| 408 | QString lower = name.toLower(); |
nothing calls this directly
no outgoing calls
no test coverage detected