1 /* |
1 /* |
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
357 { |
357 { |
358 InstallerException.internalError("Getting user visible " + |
358 InstallerException.internalError("Getting user visible " + |
359 " drives failed with code " + ret); |
359 " drives failed with code " + ret); |
360 } |
360 } |
361 // Save the drives so that next time they are not fetched again. |
361 // Save the drives so that next time they are not fetched again. |
362 iUserVisibleDrives = new Vector(); |
362 Vector drivesVector = new Vector(); |
363 for (int i = 0; i < aVisibleDrives.size(); i++) |
363 for (int i = 0; i < aVisibleDrives.size(); i++) |
364 { |
364 { |
365 iUserVisibleDrives.addElement(aVisibleDrives.elementAt(i)); |
365 drivesVector.addElement(aVisibleDrives.elementAt(i)); |
366 } |
366 } |
|
367 iUserVisibleDrives = drivesVector; |
367 } |
368 } |
368 |
369 |
369 /** |
370 /** |
370 * Checks if disk space is below critical level. |
371 * Checks if disk space is below critical level. |
371 * |
372 * |
439 "Getting screen height failed with code " + ret); |
440 "Getting screen height failed with code " + ret); |
440 } |
441 } |
441 return ret; |
442 return ret; |
442 } |
443 } |
443 |
444 |
|
445 /** |
|
446 * Maps given ISO language/country code to Symbian TLanguage. |
|
447 * |
|
448 * @param aLocale ISO language/country code |
|
449 * @return Symbian TLanguage value, or -1 if no matching language is found. |
|
450 */ |
|
451 public static int isoToLang(String aLocale) |
|
452 { |
|
453 // Replace possible dash with underscore. |
|
454 aLocale = aLocale.replace('-', '_'); |
|
455 // Get language and country parts. |
|
456 String lang = aLocale.toLowerCase(); |
|
457 String country = null; |
|
458 int sepIndex = aLocale.indexOf("_"); |
|
459 if (sepIndex >= 0) |
|
460 { |
|
461 lang = aLocale.substring(0, sepIndex).toLowerCase(); |
|
462 country = aLocale.substring(sepIndex + 1).toUpperCase(); |
|
463 } |
|
464 // Map locale to Symbian TLanguage using native service. |
|
465 int result = -1; |
|
466 if (country == null) |
|
467 { |
|
468 result = _isoToLang(lang); |
|
469 } |
|
470 else |
|
471 { |
|
472 result = _isoToLang(lang + "_" + country); |
|
473 if (result == -1) |
|
474 { |
|
475 // No result for language and country, try using language only. |
|
476 result = _isoToLang(lang); |
|
477 } |
|
478 } |
|
479 //Log.log("SysUtil.isoToLang: " + aLocale + " ==> " + result); |
|
480 return result; |
|
481 } |
|
482 |
444 /*** ---------------------------- PROTECTED --------------------------- */ |
483 /*** ---------------------------- PROTECTED --------------------------- */ |
445 /*** ----------------------------- PACKAGE ---------------------------- */ |
484 /*** ----------------------------- PACKAGE ---------------------------- */ |
446 /*** ----------------------------- PRIVATE ---------------------------- */ |
485 /*** ----------------------------- PRIVATE ---------------------------- */ |
447 |
486 |
448 /** User visible drives. Contains DriveInfo objects. */ |
487 /** User visible drives. Contains DriveInfo objects. */ |
646 * (negative number) in case of an error |
685 * (negative number) in case of an error |
647 */ |
686 */ |
648 private static native int _getScreenHeight(); |
687 private static native int _getScreenHeight(); |
649 |
688 |
650 /** |
689 /** |
|
690 * Maps given ISO language/country code to Symbian TLanguage. |
|
691 * |
|
692 * @param aLocale ISO language/country code |
|
693 * @return Symbian TLanguage value, or -1 if no matching language is found. |
|
694 */ |
|
695 private static native int _isoToLang(String aLocale); |
|
696 |
|
697 /** |
651 * Class for holding return value from native side. |
698 * Class for holding return value from native side. |
652 */ |
699 */ |
653 private static class IntValue |
700 private static class IntValue |
654 { |
701 { |
655 private int iValue = 0; |
702 private int iValue = 0; |