54
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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:
|
|
15 |
* CFLDSoftKeyChanger changes softkeys into video preview layout and
|
|
16 |
* video preview select layout. Allows also to restore old layout.
|
|
17 |
*
|
|
18 |
*
|
|
19 |
*/
|
|
20 |
|
|
21 |
// CLASS HEADER
|
|
22 |
#include "CFLDSoftKeyChanger.h"
|
|
23 |
|
|
24 |
// EXTERNAL INCLUDES
|
|
25 |
#include <f32file.h> // For TParsePtrC
|
|
26 |
#include <StringLoader.h>
|
|
27 |
#include <eikbtgpc.h> // For CEikButtonGroupContainer
|
|
28 |
#include <filelist.rsg> // For R_FLD_SOFTKEYS_PREVIEW_CANCEL
|
|
29 |
#include <avkon.rsg> // For R_AVKON_SOFTKEYS_SELECT_CANCEL
|
|
30 |
#include <avkon.hrh> // For EAknSoftkeySelect
|
|
31 |
|
|
32 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
33 |
|
|
34 |
// -----------------------------------------------------------------------------
|
|
35 |
// CFLDSoftKeyChanger::NewL
|
|
36 |
// Two-phased constructor.
|
|
37 |
// -----------------------------------------------------------------------------
|
|
38 |
//
|
|
39 |
CFLDSoftKeyChanger* CFLDSoftKeyChanger::NewL()
|
|
40 |
{
|
|
41 |
CFLDSoftKeyChanger* self = CFLDSoftKeyChanger::NewLC();
|
|
42 |
CleanupStack::Pop( self ); // self
|
|
43 |
|
|
44 |
return self;
|
|
45 |
}
|
|
46 |
|
|
47 |
// -----------------------------------------------------------------------------
|
|
48 |
// CFLDSoftKeyChanger::NewLC
|
|
49 |
// Two-phased constructor.
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
//
|
|
52 |
CFLDSoftKeyChanger* CFLDSoftKeyChanger::NewLC()
|
|
53 |
{
|
|
54 |
CFLDSoftKeyChanger* self = new( ELeave ) CFLDSoftKeyChanger();
|
|
55 |
CleanupStack::PushL( self );
|
|
56 |
|
|
57 |
self->ConstructL( );
|
|
58 |
return self;
|
|
59 |
}
|
|
60 |
|
|
61 |
// Destructor
|
|
62 |
CFLDSoftKeyChanger::~CFLDSoftKeyChanger()
|
|
63 |
{
|
|
64 |
delete iSoftKeySelect;
|
|
65 |
delete iSoftKeyPreview;
|
|
66 |
delete iSoftKeyCancel;
|
|
67 |
delete iSoftKeyBack;
|
|
68 |
}
|
|
69 |
|
|
70 |
|
|
71 |
// -----------------------------------------------------------------------------
|
|
72 |
// CFLDSoftKeyChanger::CFLDSoftKeyChanger
|
|
73 |
// C++ default constructor can NOT contain any code, that
|
|
74 |
// might leave.
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
CFLDSoftKeyChanger::CFLDSoftKeyChanger()
|
|
78 |
: iSoftKeyState( MFLDFileListBoxObserver::EToneSelectionSoftKeyState )
|
|
79 |
{
|
|
80 |
}
|
|
81 |
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
// CFLDSoftKeyChanger::ConstructL
|
|
84 |
// Symbian 2nd phase constructor can leave.
|
|
85 |
// -----------------------------------------------------------------------------
|
|
86 |
//
|
|
87 |
void CFLDSoftKeyChanger::ConstructL()
|
|
88 |
{
|
|
89 |
iSoftKeySelect = StringLoader::LoadL( R_FLD_QTN_TEXT_SOFTKEY_PREVIEW_SELECT );
|
|
90 |
iSoftKeyPreview = StringLoader::LoadL( R_FLD_QTN_TEXT_SOFTKEY_PREVIEW );
|
|
91 |
iSoftKeyCancel = StringLoader::LoadL( R_FLD_QTN_TEXT_SOFTKEY_CANCEL );
|
|
92 |
iSoftKeyBack = StringLoader::LoadL( R_FLD_QTN_TEXT_SOFTKEY_BACK );
|
|
93 |
}
|
|
94 |
|
|
95 |
// -----------------------------------------------------------------------------
|
|
96 |
// CFLDSoftKeyChanger::ChangeLeftSoftKeyL
|
|
97 |
// (other items were commented in a header).
|
|
98 |
// -----------------------------------------------------------------------------
|
|
99 |
//
|
|
100 |
void CFLDSoftKeyChanger::ChangeLeftSoftKeyL( const TDesC& aSoftKeyLabel ) const
|
|
101 |
{
|
|
102 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
103 |
CleanupStack::PushL( cba );
|
|
104 |
cba->SetCommandL( EAknSoftkeySelect, aSoftKeyLabel );
|
|
105 |
CleanupStack::Pop( cba );
|
|
106 |
cba->DrawDeferred();
|
|
107 |
}
|
|
108 |
|
|
109 |
// -----------------------------------------------------------------------------
|
|
110 |
// CFLDSoftKeyChanger::ChangeRightSoftKeyL
|
|
111 |
// (other items were commented in a header).
|
|
112 |
// -----------------------------------------------------------------------------
|
|
113 |
//
|
|
114 |
void CFLDSoftKeyChanger::ChangeRightSoftKeyL( const TDesC& aSoftKeyLabel ) const
|
|
115 |
{
|
|
116 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
117 |
CleanupStack::PushL( cba );
|
|
118 |
cba->SetCommandL( EAknSoftkeyCancel, aSoftKeyLabel );
|
|
119 |
CleanupStack::Pop( cba );
|
|
120 |
cba->DrawDeferred();
|
|
121 |
}
|
|
122 |
|
|
123 |
|
|
124 |
// -----------------------------------------------------------------------------
|
|
125 |
// CFLDSoftKeyChanger::ChangeNewSoftKeysPreviewL
|
|
126 |
// (other items were commented in a header).
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
void CFLDSoftKeyChanger::ChangeNewSoftKeysPreviewL()
|
|
130 |
{
|
|
131 |
if (iSoftKeyState == MFLDFileListBoxObserver::EPreviewSoftKeyState )
|
|
132 |
{
|
|
133 |
return;
|
|
134 |
}
|
|
135 |
|
|
136 |
CFLDSoftKeyChanger::ChangeLeftSoftKeyL( iSoftKeyPreview->Des() );
|
|
137 |
CFLDSoftKeyChanger::ChangeRightSoftKeyL( iSoftKeyCancel->Des() );
|
|
138 |
|
|
139 |
iSoftKeyState = MFLDFileListBoxObserver::EPreviewSoftKeyState;
|
|
140 |
}
|
|
141 |
|
|
142 |
// -----------------------------------------------------------------------------
|
|
143 |
// CFLDSoftKeyChanger::ChangeNewSoftKeysPreviewSelectL
|
|
144 |
// (other items were commented in a header).
|
|
145 |
// -----------------------------------------------------------------------------
|
|
146 |
//
|
|
147 |
void CFLDSoftKeyChanger::ChangeNewSoftKeysPreviewSelectL()
|
|
148 |
{
|
|
149 |
if (iSoftKeyState == MFLDFileListBoxObserver::EPreviewSelectSoftKeyState )
|
|
150 |
{
|
|
151 |
return;
|
|
152 |
}
|
|
153 |
|
|
154 |
CFLDSoftKeyChanger::ChangeLeftSoftKeyL( iSoftKeySelect->Des() );
|
|
155 |
CFLDSoftKeyChanger::ChangeRightSoftKeyL( iSoftKeyBack->Des() );
|
|
156 |
|
|
157 |
iSoftKeyState = MFLDFileListBoxObserver::EPreviewSelectSoftKeyState;
|
|
158 |
}
|
|
159 |
|
|
160 |
// -----------------------------------------------------------------------------
|
|
161 |
// CFLDSoftKeyChanger::RestoreOldSoftKeysL
|
|
162 |
// (other items were commented in a header).
|
|
163 |
// -----------------------------------------------------------------------------
|
|
164 |
//
|
|
165 |
void CFLDSoftKeyChanger::RestoreOldToneSelectionSoftKeysL()
|
|
166 |
{
|
|
167 |
if (iSoftKeyState == MFLDFileListBoxObserver::EToneSelectionSoftKeyState )
|
|
168 |
{
|
|
169 |
return;
|
|
170 |
}
|
|
171 |
|
|
172 |
CFLDSoftKeyChanger::ChangeLeftSoftKeyL( iSoftKeySelect->Des() );
|
|
173 |
CFLDSoftKeyChanger::ChangeRightSoftKeyL( iSoftKeyCancel->Des() );
|
|
174 |
|
|
175 |
iSoftKeyState = MFLDFileListBoxObserver::EToneSelectionSoftKeyState;
|
|
176 |
}
|
|
177 |
|
|
178 |
// -----------------------------------------------------------------------------
|
|
179 |
// CFLDSoftKeyChanger::SoftKeyState
|
|
180 |
// (other items were commented in a header).
|
|
181 |
// -----------------------------------------------------------------------------
|
|
182 |
//
|
|
183 |
MFLDFileListBoxObserver::TFileListSoftKeyState
|
|
184 |
CFLDSoftKeyChanger::SoftKeyState() const
|
|
185 |
{
|
|
186 |
return iSoftKeyState;
|
|
187 |
}
|
|
188 |
|
|
189 |
// End of File
|