|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: MC Photos settings model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include "glxsettingsmodel.h" |
|
23 |
|
24 #include <centralrepository.h> |
|
25 #include <featmgr.h> |
|
26 |
|
27 #include <glxgallery.hrh> |
|
28 #include <glxtracer.h> |
|
29 #include "glxsingletonstore.h" |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // InstanceL |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 EXPORT_C CGlxSettingsModel* CGlxSettingsModel::InstanceL() |
|
36 { |
|
37 return CGlxSingletonStore::InstanceL(&NewL); |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // Close |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 EXPORT_C void CGlxSettingsModel::Close() |
|
45 { |
|
46 CGlxSingletonStore::Close(this); |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // Destructor |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CGlxSettingsModel::~CGlxSettingsModel() |
|
54 { |
|
55 if ( iFeatureManagerInitialised ) |
|
56 { |
|
57 FeatureManager::UnInitializeLib(); |
|
58 } |
|
59 |
|
60 delete iRepository; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // NewL |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 CGlxSettingsModel* CGlxSettingsModel::NewL() |
|
68 { |
|
69 CGlxSettingsModel* self = new (ELeave) CGlxSettingsModel(); |
|
70 CleanupStack::PushL(self); |
|
71 self->ConstructL(); |
|
72 CleanupStack::Pop(self); |
|
73 return self; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // Default constructor |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 CGlxSettingsModel::CGlxSettingsModel() |
|
81 { |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // ConstructL |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void CGlxSettingsModel::ConstructL() |
|
89 { |
|
90 TRACER( "CGlxSettingsModel::ConstructL()" ); |
|
91 iRepository = CRepository::NewL( TUid::Uid(KGlxGalleryApplicationUid) ); |
|
92 |
|
93 FeatureManager::InitializeLibL(); |
|
94 iFeatureManagerInitialised = ETrue; |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // SupportedOrientations |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 EXPORT_C CGlxSettingsModel::TSupportedOrientations |
|
102 CGlxSettingsModel::SupportedOrientations() |
|
103 { |
|
104 TInt value = ELandscapeAndPortrait; |
|
105 iRepository->Get( KGlxDefaultOrientation, value ); |
|
106 |
|
107 return static_cast<TSupportedOrientations>( value ); |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // IsTextEntryPortrait |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C TBool CGlxSettingsModel::IsTextEntryPortrait() |
|
115 { |
|
116 // Orientation changes to portrait for text entry in monoblock products |
|
117 return FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // ShowRotateInToolbar |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C TBool CGlxSettingsModel::ShowRotateInToolbar() |
|
125 { |
|
126 // View in landscape/portrait toolbar option shown only in monoblock products |
|
127 return FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); |
|
128 } |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // ShowSlideshowInToolbar |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C TBool CGlxSettingsModel::ShowSlideshowInToolbar() |
|
135 { |
|
136 // Slideshow toolbar option shown only in slide products |
|
137 return !FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); |
|
138 } |