|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Part of the MVS Application for TechView |
|
15 // |
|
16 |
|
17 #include "MVSEditMetaInfoDialog.h" |
|
18 #include "MVSApp.hrh" |
|
19 #include <techview/eiklabel.h> |
|
20 #include "MVSConstants.h" |
|
21 |
|
22 void CMVSEditMetaInfoDialog::SetupDialogLD(RPointerArray<CMMFMetaDataEntry> aMetaArray, |
|
23 CMVSAppUi* aAppUi) |
|
24 { |
|
25 CMVSEditMetaInfoDialog* dialog = new (ELeave) CMVSEditMetaInfoDialog(aAppUi); |
|
26 CleanupStack::PushL(dialog); |
|
27 dialog->ConstructL(aMetaArray); |
|
28 CleanupStack::Pop(dialog); |
|
29 dialog->ExecuteLD(R_MVS_DIALOG_SETMETAINFO); |
|
30 } |
|
31 |
|
32 |
|
33 void CMVSEditMetaInfoDialog::ConstructL(RPointerArray<CMMFMetaDataEntry> aMetaArray) |
|
34 { |
|
35 iMetaArray.Reset(); |
|
36 TInt noElements = aMetaArray.Count(); |
|
37 for(TInt counter = 0; counter < noElements; counter++) |
|
38 { |
|
39 iMetaArray.Append(aMetaArray[counter]); |
|
40 } |
|
41 } |
|
42 |
|
43 |
|
44 CMVSEditMetaInfoDialog::CMVSEditMetaInfoDialog(CMVSAppUi* aAppUi) |
|
45 : iTitlePos(-1), iAuthorPos(-1), iCopyrightPos(-1), iRevisionPos(-1),\ |
|
46 iCategoryPos(-1), iCommentsPos(-1), iAppUi(aAppUi) |
|
47 { |
|
48 |
|
49 } |
|
50 |
|
51 |
|
52 TBool CMVSEditMetaInfoDialog::OkToExitL(TInt aButtonId) |
|
53 { |
|
54 if(aButtonId == EMVSButtonCancel) |
|
55 { |
|
56 iMetaArray.Close(); |
|
57 return ETrue; |
|
58 } |
|
59 //title |
|
60 CEikEdwin* myEdwin1 = static_cast<CEikEdwin*>(Control(EMVSMeta1)); |
|
61 |
|
62 //author |
|
63 CEikEdwin* myEdwin2 = static_cast<CEikEdwin*>(Control(EMVSMeta2)); |
|
64 |
|
65 //copyright |
|
66 CEikEdwin* myEdwin3 = static_cast<CEikEdwin*>(Control(EMVSMeta3)); |
|
67 |
|
68 //revision |
|
69 CEikEdwin* myEdwin4 = static_cast<CEikEdwin*>(Control(EMVSMeta4)); |
|
70 |
|
71 //category |
|
72 CEikEdwin* myEdwin5 = static_cast<CEikEdwin*>(Control(EMVSMeta5)); |
|
73 |
|
74 //comments |
|
75 CEikEdwin* myEdwin6 = static_cast<CEikEdwin*>(Control(EMVSMeta6)); |
|
76 |
|
77 TBuf<256> myBuf; |
|
78 CMMFMetaDataEntry* newMetaEntry = CMMFMetaDataEntry::NewL(); |
|
79 if(iTitlePos != -1) |
|
80 { |
|
81 myEdwin1->GetText(myBuf); |
|
82 iMetaArray[iTitlePos]->SetValueL(myBuf); |
|
83 } |
|
84 else |
|
85 { |
|
86 newMetaEntry->SetNameL(KTitle); |
|
87 myEdwin1->GetText(myBuf); |
|
88 newMetaEntry->SetValueL(myBuf); |
|
89 iMetaArray.Append(newMetaEntry); |
|
90 } |
|
91 if(iAuthorPos != -1) |
|
92 { |
|
93 myEdwin2->GetText(myBuf); |
|
94 iMetaArray[iAuthorPos]->SetValueL(myBuf); |
|
95 } |
|
96 else |
|
97 { |
|
98 newMetaEntry->SetNameL(KAuthor); |
|
99 myEdwin1->GetText(myBuf); |
|
100 newMetaEntry->SetValueL(myBuf); |
|
101 iMetaArray.Append(newMetaEntry); |
|
102 } |
|
103 if(iCopyrightPos != -1) |
|
104 { |
|
105 myEdwin3->GetText(myBuf); |
|
106 iMetaArray[iCopyrightPos]->SetValueL(myBuf); |
|
107 } |
|
108 else |
|
109 { |
|
110 newMetaEntry->SetNameL(KCopyrt); |
|
111 myEdwin3->GetText(myBuf); |
|
112 newMetaEntry->SetValueL(myBuf); |
|
113 iMetaArray.Append(newMetaEntry); |
|
114 } |
|
115 if(iRevisionPos != -1) |
|
116 { |
|
117 myEdwin4->GetText(myBuf); |
|
118 iMetaArray[iRevisionPos]->SetValueL(myBuf); |
|
119 } |
|
120 else |
|
121 { |
|
122 newMetaEntry->SetNameL(KRevision); |
|
123 myEdwin4->GetText(myBuf); |
|
124 newMetaEntry->SetValueL(myBuf); |
|
125 iMetaArray.Append(newMetaEntry); |
|
126 } |
|
127 if(iCategoryPos != -1) |
|
128 { |
|
129 myEdwin5->GetText(myBuf); |
|
130 iMetaArray[iCategoryPos]->SetValueL(myBuf); |
|
131 } |
|
132 else |
|
133 { |
|
134 newMetaEntry->SetNameL(KCategory); |
|
135 myEdwin5->GetText(myBuf); |
|
136 newMetaEntry->SetValueL(myBuf); |
|
137 iMetaArray.Append(newMetaEntry); |
|
138 } |
|
139 if(iCommentsPos != -1) |
|
140 { |
|
141 myEdwin6->GetText(myBuf); |
|
142 iMetaArray[iCommentsPos]->SetValueL(myBuf); |
|
143 } |
|
144 else |
|
145 { |
|
146 newMetaEntry->SetNameL(KComments); |
|
147 myEdwin6->GetText(myBuf); |
|
148 newMetaEntry->SetValueL(myBuf); |
|
149 iMetaArray.Append(newMetaEntry); |
|
150 } |
|
151 TInt err; |
|
152 TInt count=iMetaArray.Count(); |
|
153 TRAP(err,iAppUi->SetMetaDataL(iMetaArray)); |
|
154 if(err==KErrNotSupported) |
|
155 { |
|
156 User::InfoPrint(KNotSupported); |
|
157 } |
|
158 delete newMetaEntry; |
|
159 return ETrue; |
|
160 } |
|
161 |
|
162 CMVSEditMetaInfoDialog::~CMVSEditMetaInfoDialog() |
|
163 { |
|
164 iMetaArray.Close(); |
|
165 } |