author | qifeima <> |
Thu, 03 Jun 2010 18:57:10 +0800 | |
changeset 8 | 18b321db4884 |
parent 1 | edfc90759b9f |
permissions | -rw-r--r-- |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1 |
/* |
8 | 2 |
* Copyright (c) 2010 Ixonos Plc. |
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the "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 |
* Ixonos Plc |
|
14 |
* |
|
15 |
* Description: |
|
16 |
* Image Editor AppUI class. |
|
17 |
* |
|
18 |
*/ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
19 |
// INCLUDE FILES |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
20 |
#include <fbs.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
21 |
#include <f32file.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
22 |
#include <badesca.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
23 |
#include <bautils.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
24 |
#include <e32math.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
25 |
#include <aknnotifystd.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
26 |
#include <aknwaitdialog.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
27 |
#include <AknGlobalNote.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
28 |
#include <eikprogi.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
29 |
#include <sendui.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
30 |
#include <hlplch.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
31 |
#include <aknnotewrappers.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
32 |
#include <CMessageData.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
33 |
#include <e32property.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
34 |
#include <AknDlgShut.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
35 |
#include <CAknFileNamePromptDialog.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
36 |
#include <CAknMemorySelectionDialog.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
37 |
#include <PathInfo.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
38 |
#include <csxhelp/sie.hlp.hrh> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
39 |
#ifdef VERBOSE |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
40 |
#include <eikenv.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
41 |
#endif |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
42 |
#include <AknCommonDialogsDynMem.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
43 |
#include <CAknMemorySelectionDialogMultiDrive.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
44 |
#include <ImageEditor.rsg> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
45 |
#include "ImageEditorUI.hrh" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
46 |
#include "ImageEditorPanics.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
47 |
#include "imageeditoruids.hrh" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
48 |
#include "commondefs.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
49 |
#include "ImageEditorApp.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
50 |
#include "ImageEditorAppUi.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
51 |
#include "ImageEditorUIView.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
52 |
#include "ImageEditorUI.hrh" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
53 |
#include "ImageEditorError.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
54 |
#include "PluginInfo.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
55 |
#include "ImageEditorPluginLocator.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
56 |
#include "ImageEditorPluginManager.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
57 |
#include "ImageEditorImageController.h" |
8 | 58 |
#include "ImageEditorUIContainer.h" |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
59 |
#include "ImageEditorUtils.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
60 |
#include "ResolutionUtil.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
61 |
#include "Callback.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
62 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
63 |
// CONSTANTS |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
64 |
// Panic category |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
65 |
_LIT(KComponentName, "ImageEditorAppUi"); |
8 | 66 |
_LIT(KDrawPlugin,"draw.pgn"); |
67 |
_LIT(KNull,""); |
|
68 |
||
69 |
const TInt KObConstructCallBackID = 1; |
|
70 |
const TInt KObInitPluginID = 1000; |
|
71 |
const TInt KObReturnFromPluginID = 1001; |
|
72 |
const TInt KObCancelCallbackID = 1002; |
|
73 |
const TInt KObUndoDCallbackID = 1003; |
|
74 |
const TInt KObSendCallbackID = 1004; |
|
75 |
const TInt KObPrintCallbackID = 1005; |
|
76 |
const TInt KObSaveCallbackID = 1006; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
77 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
78 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
79 |
CImageEditorAppUi::CImageEditorAppUi() : |
8 | 80 |
// Initialize application flags and variables |
81 |
iDocumentName(), iSourceFileName(), iImageSaved(EFalse), |
|
82 |
iForeground(ETrue), iExitFromApp(EFalse), iSaveOnExit(ETrue), |
|
83 |
iSysExit(EFalse), iBusy(ETrue), iOrientationChanged(EFalse), |
|
84 |
iSaving(EFalse), iSending(EFalse), iPrinting(EFalse), iCancelling( |
|
85 |
EFalse), iFullScreen(EFalse), iPluginsScanned(EFalse), |
|
86 |
iImageLoaded(EFalse), iEditorReady(EFalse), iCancelTextInputActive( |
|
87 |
EFalse), iProcessPriorityAltered(EFalse) |
|
88 |
{ |
|
89 |
||
90 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
91 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
92 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
93 |
void CImageEditorAppUi::ConstructL() |
8 | 94 |
{ |
95 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::ConstructL"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
96 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
97 |
// Initialize UI with standard values, read application resource file, |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
98 |
// read default document |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
99 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
100 |
#ifdef LANDSCAPE_ONLY |
8 | 101 |
BaseConstructL( EAppOrientationLandscape | EAknEnableSkin | EAknEnableMSK ); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
102 |
#else |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
103 |
#ifdef LANDSCAPE_SUPPORT |
8 | 104 |
BaseConstructL(EAppOrientationAutomatic | EAknEnableSkin | EAknEnableMSK); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
105 |
#else |
8 | 106 |
BaseConstructL( EAknEnableSkin | EAknEnableMSK ); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
107 |
#endif |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
108 |
#endif // LANDSCAPE_SUPPORT |
8 | 109 |
// Set busy |
110 |
SetBusy(); |
|
111 |
||
112 |
// Create main view |
|
113 |
CImageEditorUIView * view = new (ELeave) CImageEditorUIView; |
|
114 |
CleanupStack::PushL(view); |
|
115 |
view->ConstructL(); |
|
116 |
view->ConstructMenuAndCbaEarlyL(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
117 |
iEditorView = view; |
8 | 118 |
AddViewL(view); // transfers ownership |
119 |
CleanupStack::Pop(); // view |
|
120 |
LOG (KImageEditorLogFile, "CImageEditorAppUi: Main view created"); |
|
121 |
||
122 |
// Activate view |
|
123 |
ActivateLocalViewL(iEditorView->Id()); |
|
124 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: View activated"); |
|
125 |
||
126 |
// Set default navi pane text |
|
127 |
ClearTitlePaneTextL(); |
|
128 |
ClearNaviPaneTextL(); |
|
129 |
||
130 |
// Create CObCallback instance |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
131 |
iConstructionState = EConstructionStateAlloc; |
8 | 132 |
iCallback = CObCallback::NewL((MObCallbackMethod *) this); |
133 |
iCallback->DoCallback(KObConstructCallBackID); |
|
134 |
||
135 |
// Volume key observer instance |
|
136 |
iVolumeKeyObserver = CImageEditorRemConObserver::NewL(*this); |
|
137 |
||
138 |
iStandby = EFalse; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
139 |
#ifdef S60_31_VOLUME_KEYS |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
140 |
iMGXRemConTarget = CMGXRemConTarget::NewL( this ); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
141 |
#endif |
8 | 142 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
143 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
144 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
145 |
CImageEditorAppUi::~CImageEditorAppUi() |
8 | 146 |
{ |
147 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::~CImageEditorAppUi() starting..."); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
148 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
149 |
//KillWaitNote(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
150 |
if (iWaitNote != NULL) |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
151 |
{ |
8 | 152 |
delete iWaitNote; |
153 |
iWaitNote = NULL; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
154 |
} |
8 | 155 |
|
156 |
delete iLocator; |
|
157 |
delete iImageController; |
|
158 |
delete iEditorManager; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
159 |
delete iSendAppUi; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
160 |
delete iCallback; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
161 |
iSourceImageMgAlbumIdList.Close(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
162 |
|
8 | 163 |
iEditorView = NULL; |
164 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
165 |
iFile.Close(); |
8 | 166 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
167 |
#ifdef S60_31_VOLUME_KEYS |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
168 |
delete iMGXRemConTarget; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
169 |
#endif |
8 | 170 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
171 |
// deleted by CCoeEnv |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
172 |
iResolutionUtil = NULL; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
173 |
delete iVolumeKeyObserver; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
174 |
|
8 | 175 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: AppUi deleted"); |
176 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
177 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
178 |
//============================================================================= |
8 | 179 |
void CImageEditorAppUi::OperationReadyL(TOperationCode aOpId, TInt aError) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
180 |
{ |
8 | 181 |
LOGFMT2(KImageEditorLogFile, "CImageEditorAppUi:OperationReadyL (aOpId:%d, aError:%d)", (TInt)aOpId, aError); |
182 |
||
183 |
// Kill wait note |
|
184 |
KillWaitNote(); |
|
185 |
||
186 |
// Handle error |
|
187 |
if (aError != KErrNone) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
188 |
{ |
8 | 189 |
switch (aOpId) |
190 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
191 |
case EOperationCodeLoad: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
192 |
case EOperationCodeBlockLoad: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
193 |
case EOperationCodeSearch: |
8 | 194 |
{ |
195 |
||
196 |
if (KErrCancel == aError) |
|
197 |
{ |
|
198 |
// Loading image was cancelled. |
|
199 |
User::Leave(KSIEEErrorOkToExit); |
|
200 |
} |
|
201 |
else |
|
202 |
{ |
|
203 |
User::Leave(KSIEEOpenFile); |
|
204 |
} |
|
205 |
break; |
|
206 |
} |
|
207 |
case EOperationCodeSave: |
|
208 |
case EOperationCodeBlockSave: |
|
209 |
{ |
|
210 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Save cancelled"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
211 |
#ifdef VERBOSE |
8 | 212 |
LOGFMT3(KImageEditorLogFile, "\tiSourceFileName: %S, iDocumentName: %S, iTempSaveFileName: %S", &iSourceFileName, &iDocumentName, &iTempSaveFileName); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
213 |
#endif |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
214 |
|
8 | 215 |
iSaving = EFalse; |
216 |
||
217 |
// delete the temporary files |
|
218 |
DeleteTempFiles(); |
|
219 |
||
220 |
// Reset bitmap sink and screen size |
|
221 |
UpdateScreenRectL(); |
|
222 |
iOrientationChanged = EFalse; |
|
223 |
||
224 |
if (!iExitFromApp) |
|
225 |
{ |
|
226 |
||
227 |
if (iSending) |
|
228 |
{ |
|
229 |
// Restore document name |
|
230 |
iEditorManager->SetImageName(iDocumentName); |
|
231 |
iSending = EFalse; |
|
232 |
} |
|
233 |
if (KErrCancel == aError) |
|
234 |
{ |
|
235 |
// KErrCancel means user cancel, not an error. |
|
236 |
ResetBusy(); |
|
237 |
} |
|
238 |
else |
|
239 |
{ |
|
240 |
// Leave in case of error. |
|
241 |
User::Leave(KSIEESaveFile); |
|
242 |
} |
|
243 |
} |
|
244 |
else |
|
245 |
{ |
|
246 |
TInt exit = 0; |
|
247 |
if (iSaveOnExit) |
|
248 |
{ |
|
249 |
exit |
|
250 |
= ((CImageEditorUIView *) iEditorView)->LaunchExitWithoutSavingQueryL(); |
|
251 |
} |
|
252 |
||
253 |
if (exit == EImageEditorSoftkeyCmdYes || !iSaveOnExit) |
|
254 |
{ |
|
255 |
// If the image has not been saved before, the reserved target |
|
256 |
// file has zero size and can be deleted. |
|
257 |
TEntry entry; |
|
258 |
TInt err = iEikonEnv->FsSession().Entry(iDocumentName, |
|
259 |
entry); |
|
260 |
if (err == KErrNone && entry.iSize == 0) |
|
261 |
{ |
|
262 |
BaflUtils::DeleteFile(iEikonEnv->FsSession(), |
|
263 |
iDocumentName); |
|
264 |
} |
|
265 |
||
266 |
// Exit the application |
|
267 |
User::Leave(KSIEEErrorOkToExit); |
|
268 |
} |
|
269 |
else |
|
270 |
{ |
|
271 |
iExitFromApp = EFalse; |
|
272 |
ResetBusy(); |
|
273 |
} |
|
274 |
} |
|
275 |
SetOrientationL(EAppUiOrientationUnspecified); |
|
276 |
break; |
|
277 |
} |
|
278 |
default: |
|
279 |
{ |
|
280 |
User::Leave(aError); |
|
281 |
break; |
|
282 |
} |
|
283 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
284 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
285 |
else |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
286 |
{ |
8 | 287 |
switch (aOpId) |
288 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
289 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
290 |
case EOperationCodeLoad: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
291 |
case EOperationCodeBlockLoad: |
8 | 292 |
{ |
293 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Image loaded"); |
|
294 |
||
295 |
// Find out whether the source file belongs to any albums |
|
296 |
ImageEditorUtils::FindAlbumsForImageFileL( |
|
297 |
iSourceImageMgAlbumIdList, iSourceFileName); |
|
298 |
||
299 |
// Generate the name for the saved file |
|
300 |
TInt err = ImageEditorUtils::GenerateNewDocumentNameL( |
|
301 |
iEikonEnv->FsSession(), iSourceFileName, iDocumentName, |
|
302 |
&iSourceImageMgAlbumIdList); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
303 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
304 |
// Delete old temp files, which could exist if the exit was not clean |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
305 |
DeleteTempFiles(); |
8 | 306 |
|
307 |
// If there is not enough disk space to save the edited image, show |
|
308 |
// error note but continue anyway (user can free up memory before saving) |
|
309 |
if (KSIEENotEnoughDiskSpace == err) |
|
310 |
{ |
|
311 |
ShowErrorNoteL(err); |
|
312 |
} |
|
313 |
else if (KErrNone != err) |
|
314 |
{ |
|
315 |
// Fatal error |
|
316 |
User::Leave(err); |
|
317 |
} |
|
318 |
iEditorManager->SetImageName(iDocumentName); |
|
319 |
iImageLoaded = ETrue; |
|
320 |
InitializeUiItemsL(); |
|
321 |
||
322 |
if (!iOrientationChanged) |
|
323 |
{ |
|
324 |
// Immediately display the loaded image |
|
325 |
((CImageEditorUIView *) iEditorView)-> SetImageL( |
|
326 |
iEditorManager->GetPreviewImage()); |
|
327 |
} |
|
328 |
||
329 |
ApplicationReadyL(); |
|
330 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
331 |
// Do not have to keep file open anymore. |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
332 |
// Fixes problem with Online Printing |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
333 |
iFile.Close(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
334 |
|
8 | 335 |
break; |
336 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
337 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
338 |
case EOperationCodeSave: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
339 |
case EOperationCodeBlockSave: |
8 | 340 |
{ |
341 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Image saved"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
342 |
#ifdef VERBOSE |
8 | 343 |
LOGFMT3(KImageEditorLogFile, "\tiSourceFileName: %S, iDocumentName: %S, iTempSaveFileName: %S", &iSourceFileName, &iDocumentName, &iTempSaveFileName); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
344 |
#endif |
8 | 345 |
ResetBusy(); |
346 |
iSaving = EFalse; |
|
347 |
||
348 |
RFs & fs = iEikonEnv->FsSession(); |
|
349 |
if (BaflUtils::FileExists(fs, iTempSaveFileName)) |
|
350 |
{ |
|
351 |
// Image has been successfully saved |
|
352 |
iImageSaved = ETrue; |
|
353 |
||
354 |
CFileMan* fileMan = CFileMan::NewL(fs); |
|
355 |
CleanupStack::PushL(fileMan); |
|
356 |
||
357 |
// the temporary image file and the target file are located in the same drive |
|
358 |
if (iTempSaveFileName.Left(1) == iDocumentName.Left(1)) |
|
359 |
{ |
|
360 |
User::LeaveIfError(fileMan->Rename(iTempSaveFileName, |
|
361 |
iDocumentName)); |
|
362 |
} |
|
363 |
// the temporary image file and the target file are not in the same drive |
|
364 |
else |
|
365 |
{ |
|
366 |
User::LeaveIfError(fileMan->Move(iTempSaveFileName, |
|
367 |
iDocumentName)); |
|
368 |
} |
|
369 |
CleanupStack::PopAndDestroy(); //fileMan |
|
370 |
||
371 |
// Source file changes (at least if saved with a new name) |
|
372 |
iSourceFileName = iDocumentName; |
|
373 |
||
374 |
// Update title |
|
375 |
SetFileNameTitlePaneL(iDocumentName); |
|
376 |
iEditorManager->SetImageName(iDocumentName); |
|
377 |
||
378 |
LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: Temp file renamed to %S", &iDocumentName); |
|
379 |
||
380 |
// Purge undo stack if on the way to exit. |
|
381 |
// Don't purge if printing or sending the image. |
|
382 |
if (iExitFromApp) |
|
383 |
{ |
|
384 |
iEditorManager->PurgeUndoRedoHistory(); |
|
385 |
} |
|
386 |
||
387 |
FinalizeSaveL(); |
|
388 |
} |
|
389 |
||
390 |
if (iExitFromApp) |
|
391 |
{ |
|
392 |
DeleteTempFiles(); |
|
393 |
User::Leave(KSIEEErrorOkToExit); |
|
394 |
} |
|
395 |
else |
|
396 |
{ |
|
397 |
if (iSending) |
|
398 |
{ |
|
399 |
// Restore document name |
|
400 |
SetBusy(); |
|
401 |
iEditorManager->SetImageName(iDocumentName); |
|
402 |
iCallback->DoCallback(KObSendCallbackID); |
|
403 |
} |
|
404 |
||
405 |
if (iPrinting) |
|
406 |
{ |
|
407 |
// Restore document name |
|
408 |
SetBusy(); |
|
409 |
iEditorManager->SetImageName(iDocumentName); |
|
410 |
iCallback->DoCallback(KObPrintCallbackID); |
|
411 |
} |
|
412 |
||
413 |
// Reset bitmap sink and screen size |
|
414 |
UpdateScreenRectL(); |
|
415 |
||
416 |
// Set saved image name for printing |
|
417 |
((CImageEditorUIView *) iEditorView)->SetImageFileName( |
|
418 |
iDocumentName); |
|
419 |
||
420 |
} |
|
421 |
||
422 |
// Update menu |
|
423 |
SetUndoFlag(); |
|
424 |
SetOrientationL(EAppUiOrientationUnspecified); |
|
425 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Saving procedure completed"); |
|
426 |
break; |
|
427 |
} |
|
428 |
||
429 |
default: |
|
430 |
{ |
|
431 |
break; |
|
432 |
} |
|
433 |
} |
|
434 |
} |
|
435 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
436 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
437 |
//============================================================================= |
8 | 438 |
void CImageEditorAppUi::RenderL() |
439 |
{ |
|
440 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Rendering..."); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
441 |
SetBusy(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
442 |
iEditorManager->ProcessImageL(); |
8 | 443 |
((CImageEditorUIView *) iEditorView)->GetContainer()->DrawNow(); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
444 |
ResetBusy(); |
8 | 445 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
446 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
447 |
//============================================================================= |
8 | 448 |
TKeyResponse CImageEditorAppUi::HandleKeyEventL(const TKeyEvent & aKeyEvent, |
449 |
TEventCode aType) |
|
450 |
{ |
|
451 |
LOGFMT2(KImageEditorLogFile, "CImageEditorAppUi:HandleKeyEventL (aKeyEvent: %d, aType:\t %d)", aKeyEvent,aType); |
|
452 |
||
453 |
TKeyResponse response = EKeyWasNotConsumed; |
|
454 |
||
455 |
// if we are busy doing something |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
456 |
// then we consume the key |
8 | 457 |
if (iBusy || (iConstructionState != EConstructionStateReady)) |
458 |
{ |
|
459 |
response = EKeyWasConsumed; |
|
460 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
461 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
462 |
// we are only interested in real key events |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
463 |
// rather than ups or downs |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
464 |
else if (aType != EEventKey) |
8 | 465 |
{ |
466 |
// These are handled separately here because pressing shift key doesn't |
|
467 |
// give EEventKey event at all |
|
468 |
if (aType == EEventKeyDown) |
|
469 |
{ |
|
470 |
switch (aKeyEvent.iScanCode) |
|
471 |
{ |
|
472 |
case EStdKeyLeftShift: |
|
473 |
{ |
|
474 |
iEditorView->HandleCommandL(EImageEditorPreGlobalZoomChange); |
|
475 |
ZoomL(EZoomIn); |
|
476 |
iEditorView->HandleCommandL(EImageEditorGlobalZoomChanged); |
|
477 |
response = EKeyWasConsumed; |
|
478 |
break; |
|
479 |
} |
|
480 |
case EStdKeyRightShift: |
|
481 |
{ |
|
482 |
iEditorView->HandleCommandL(EImageEditorPreGlobalZoomChange); |
|
483 |
ZoomL(EZoomOut); |
|
484 |
iEditorView->HandleCommandL(EImageEditorGlobalZoomChanged); |
|
485 |
response = EKeyWasConsumed; |
|
486 |
break; |
|
487 |
} |
|
488 |
} |
|
489 |
} |
|
490 |
||
491 |
response = EKeyWasNotConsumed; |
|
492 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
493 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
494 |
// scan codes for numbers are their ASCII codes |
8 | 495 |
else |
496 |
{ |
|
497 |
TBool rotated = LandscapeScreenOrientation(); |
|
498 |
||
499 |
switch (aKeyEvent.iScanCode) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
500 |
{ |
8 | 501 |
|
502 |
case 0x30: // 0 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
503 |
{ |
8 | 504 |
#ifdef FULLSCREEN_AVAILABLE |
505 |
if (iFullScreen) |
|
506 |
{ |
|
507 |
ResetFullScreenL(); |
|
508 |
} |
|
509 |
else |
|
510 |
{ |
|
511 |
SetFullScreenL(); |
|
512 |
} |
|
513 |
response = EKeyWasConsumed; |
|
514 |
#endif // FULLSCREEN_AVAILABLE |
|
515 |
break; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
516 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
517 |
#ifndef LANDSCAPE_ROTATE_HOTKEYS |
8 | 518 |
case 0x31: // 1 |
519 |
#else |
|
520 |
case 0x33: // 3 |
|
521 |
#endif |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
522 |
{ |
8 | 523 |
RotateL(ERotationCounterClockwise); |
524 |
response = EKeyWasConsumed; |
|
525 |
break; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
526 |
} |
8 | 527 |
|
528 |
case 0x32: // 2 |
|
529 |
{ |
|
530 |
if (!rotated) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
531 |
{ |
8 | 532 |
PanL(EDirectionUp); |
533 |
response = EKeyWasConsumed; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
534 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
535 |
else |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
536 |
{ |
8 | 537 |
PanL(EDirectionLeft); |
538 |
response = EKeyWasConsumed; |
|
539 |
} |
|
540 |
break; |
|
541 |
} |
|
542 |
||
543 |
#ifndef LANDSCAPE_ROTATE_HOTKEYS |
|
544 |
case 0x33: // 3 |
|
545 |
#else |
|
546 |
case 0x39: // 9 |
|
547 |
#endif |
|
548 |
{ |
|
549 |
RotateL(ERotationClockwise); |
|
550 |
response = EKeyWasConsumed; |
|
551 |
break; |
|
552 |
} |
|
553 |
||
554 |
case 0x34: // 4 |
|
555 |
{ |
|
556 |
if (!rotated) |
|
557 |
{ |
|
558 |
PanL(EDirectionLeft); |
|
559 |
response = EKeyWasConsumed; |
|
560 |
} |
|
561 |
else |
|
562 |
{ |
|
563 |
PanL(EDirectionDown); |
|
564 |
response = EKeyWasConsumed; |
|
565 |
} |
|
566 |
break; |
|
567 |
} |
|
568 |
case 0x35: // 5 |
|
569 |
{ |
|
570 |
// No function |
|
571 |
break; |
|
572 |
} |
|
573 |
||
574 |
case 0x36: // 6 |
|
575 |
{ |
|
576 |
if (!rotated) |
|
577 |
{ |
|
578 |
PanL(EDirectionRight); |
|
579 |
response = EKeyWasConsumed; |
|
580 |
} |
|
581 |
else |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
582 |
{ |
8 | 583 |
PanL(EDirectionUp); |
584 |
response = EKeyWasConsumed; |
|
585 |
} |
|
586 |
break; |
|
587 |
} |
|
588 |
||
589 |
case 0x38: // 8 |
|
590 |
{ |
|
591 |
if (!rotated) |
|
592 |
{ |
|
593 |
PanL(EDirectionDown); |
|
594 |
response = EKeyWasConsumed; |
|
595 |
} |
|
596 |
else |
|
597 |
{ |
|
598 |
PanL(EDirectionRight); |
|
599 |
response = EKeyWasConsumed; |
|
600 |
} |
|
601 |
break; |
|
602 |
} |
|
603 |
||
604 |
// following cases handle four directions and select key |
|
605 |
case EStdKeyRightArrow: |
|
606 |
{ |
|
607 |
PanL(EDirectionRight); |
|
608 |
response = EKeyWasConsumed; |
|
609 |
break; |
|
610 |
} |
|
611 |
case EStdKeyLeftArrow: |
|
612 |
{ |
|
613 |
PanL(EDirectionLeft); |
|
614 |
response = EKeyWasConsumed; |
|
615 |
break; |
|
616 |
} |
|
617 |
case EStdKeyUpArrow: |
|
618 |
{ |
|
619 |
PanL(EDirectionUp); |
|
620 |
response = EKeyWasConsumed; |
|
621 |
break; |
|
622 |
} |
|
623 |
case EStdKeyDownArrow: |
|
624 |
{ |
|
625 |
PanL(EDirectionDown); |
|
626 |
response = EKeyWasConsumed; |
|
627 |
break; |
|
628 |
} |
|
629 |
case EStdKeyEnter: |
|
630 |
{ |
|
631 |
TBool zoomedIn = |
|
632 |
((CImageEditorUIView *) iEditorView)->InZoomingState(); |
|
633 |
if (zoomedIn) |
|
634 |
{ |
|
635 |
iEditorView->HandleCommandL(EImageEditorPreGlobalZoomChange); |
|
636 |
ZoomL(EZoomIn); |
|
637 |
iEditorView->HandleCommandL(EImageEditorGlobalZoomChanged); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
638 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
639 |
else |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
640 |
{ |
8 | 641 |
// display the plugin selection grid if not in zoomed state |
642 |
HandleCommandL(EImageEditorMenuCmdApplyEffect); |
|
643 |
} |
|
644 |
response = EKeyWasConsumed; |
|
645 |
break; |
|
646 |
} |
|
647 |
case 0x2a: // * |
|
648 |
case EStdKeyNkpAsterisk: // * |
|
649 |
case EStdKeyIncVolume: |
|
650 |
{ |
|
651 |
if (iEditorManager->IsPluginLoaded()) |
|
652 |
{ |
|
653 |
if (iEditorManager->GetZoomMode() == EZoomIn3) |
|
654 |
{ |
|
655 |
response = EKeyWasConsumed; |
|
656 |
break; |
|
657 |
} |
|
658 |
} |
|
659 |
iEditorView->HandleCommandL(EImageEditorPreGlobalZoomChange); |
|
660 |
ZoomL(EZoomIn); |
|
661 |
iEditorView->HandleCommandL(EImageEditorGlobalZoomChanged); |
|
662 |
response = EKeyWasConsumed; |
|
663 |
break; |
|
664 |
} |
|
665 |
case 0x23: // # |
|
666 |
case EStdKeyHash: // # |
|
667 |
case EStdKeyDecVolume: |
|
668 |
{ |
|
669 |
if (iEditorManager->IsPluginLoaded()) |
|
670 |
{ |
|
671 |
if (iEditorManager->GetZoomMode() == EZoomNormal) |
|
672 |
{ |
|
673 |
response = EKeyWasConsumed; |
|
674 |
break; |
|
675 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
676 |
} |
8 | 677 |
iEditorView->HandleCommandL(EImageEditorPreGlobalZoomChange); |
678 |
ZoomL(EZoomOut); |
|
679 |
iEditorView->HandleCommandL(EImageEditorGlobalZoomChanged); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
680 |
response = EKeyWasConsumed; |
8 | 681 |
break; |
682 |
} |
|
683 |
case EStdKeyYes: // green answer call key |
|
684 |
{ |
|
685 |
if (!iEditorManager->IsPluginLoaded()) |
|
686 |
{ |
|
687 |
// when touch is enabled, dialer application is launched |
|
688 |
// by the framework and application should not consume |
|
689 |
// this key. Otherwise image is saved and send menu opened. |
|
690 |
if (!AknLayoutUtils::PenEnabled()) |
|
691 |
{ |
|
692 |
if (!iSending) |
|
693 |
{ |
|
694 |
SaveChangesAndSendL(); |
|
695 |
} |
|
696 |
response = EKeyWasConsumed; |
|
697 |
} |
|
698 |
else |
|
699 |
{ |
|
700 |
response = EKeyWasNotConsumed; |
|
701 |
} |
|
702 |
} |
|
703 |
break; |
|
704 |
} |
|
705 |
case EStdKeyDevice3: // Select key (OK key) |
|
706 |
{ |
|
707 |
// display the plugin selection grid |
|
708 |
HandleCommandL(EImageEditorMenuCmdApplyEffect); |
|
709 |
response = EKeyWasConsumed; |
|
710 |
break; |
|
711 |
} |
|
712 |
case EStdKeyNo: // end key |
|
713 |
{ |
|
714 |
iBusy = ETrue; |
|
715 |
response = EKeyWasNotConsumed; |
|
716 |
break; |
|
717 |
} |
|
718 |
||
719 |
default: |
|
720 |
{ |
|
721 |
response = EKeyWasNotConsumed; |
|
722 |
break; |
|
723 |
} |
|
724 |
} |
|
725 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
726 |
return response; |
8 | 727 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
728 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
729 |
//============================================================================= |
8 | 730 |
void CImageEditorAppUi::HandleCommandL(TInt aCommand) |
731 |
{ |
|
732 |
LOGFMT(KImageEditorLogFile, "CImageEditorAppUi:HandleCommandL (%d)", aCommand); |
|
733 |
||
734 |
switch (aCommand) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
735 |
{ |
8 | 736 |
|
737 |
/** |
|
738 |
* |
|
739 |
* MENU COMMANDS |
|
740 |
* |
|
741 |
*/ |
|
742 |
||
743 |
// Launch plug-in selection grid |
|
744 |
case EImageEditorMenuCmdApplyEffect: |
|
745 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
746 |
SetBusy(); |
8 | 747 |
iCallback->DoCallback(KObInitPluginID); |
748 |
break; |
|
749 |
} |
|
750 |
||
751 |
// Undo effect |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
752 |
case EImageEditorMenuCmdUndo: |
8 | 753 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
754 |
SetBusy(); |
8 | 755 |
iCallback->DoCallback(KObUndoDCallbackID); |
756 |
break; |
|
757 |
} |
|
758 |
||
759 |
// Switch to full screen |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
760 |
case EImageEditorMenuCmdFullScreen: |
8 | 761 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
762 |
#ifdef FULLSCREEN_AVAILABLE |
8 | 763 |
SetFullScreenL(); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
764 |
#endif // FULLSCREEN_AVAILABLE |
8 | 765 |
break; |
766 |
} |
|
767 |
||
768 |
// Switch to normal screen |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
769 |
case EImageEditorMenuCmdNormalScreen: |
8 | 770 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
771 |
#ifdef FULLSCREEN_AVAILABLE |
8 | 772 |
ResetFullScreenL(); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
773 |
#endif // FULLSCREEN_AVAILABLE |
8 | 774 |
break; |
775 |
} |
|
776 |
||
777 |
// Increase Zoom |
|
778 |
case EImageEditorMenuCmdZoomIn: |
|
779 |
{ |
|
780 |
ZoomL(EZoomIn); |
|
781 |
break; |
|
782 |
} |
|
783 |
||
784 |
// Decrease Zoom |
|
785 |
case EImageEditorMenuCmdZoomOut: |
|
786 |
{ |
|
787 |
ZoomL(EZoomOut); |
|
788 |
break; |
|
789 |
} |
|
790 |
||
791 |
// Set zoom to minimum (=normal image) |
|
792 |
case EImageEditorMenuCmdFitToScreen: |
|
793 |
{ |
|
794 |
ZoomL(EZoomMin); |
|
795 |
break; |
|
796 |
} |
|
797 |
||
798 |
// Launch CSHelp |
|
799 |
case EAknCmdHelp: |
|
800 |
case EImageEditorMenuCmdHelp: |
|
801 |
{ |
|
802 |
CArrayFix<TCoeHelpContext>* context = CCoeAppUi::AppHelpContextL(); |
|
803 |
if (context) |
|
804 |
{ |
|
805 |
HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), |
|
806 |
context); |
|
807 |
} |
|
808 |
break; |
|
809 |
} |
|
810 |
case EImageEditorMenuCmdSave: |
|
811 |
{ |
|
812 |
if (!((CImageEditorUIView*) iEditorView)->IsMemoryInCriticalLevel()) |
|
813 |
{ |
|
814 |
QueryAndSaveL(); |
|
815 |
} |
|
816 |
break; |
|
817 |
} |
|
818 |
||
819 |
// Close editor |
|
820 |
case EImageEditorMenuCmdExit: |
|
821 |
{ |
|
822 |
TBool exitNow = ETrue; |
|
823 |
if (iEditorManager->IsImageChanged()) |
|
824 |
{ |
|
825 |
if (!((CImageEditorUIView*) iEditorView)->IsMemoryInCriticalLevel()) |
|
826 |
{ |
|
827 |
// launch "Save changes?" query |
|
828 |
TInt |
|
829 |
result = |
|
830 |
((CImageEditorUIView *) iEditorView)->LaunchSaveChangesQueryL(); |
|
831 |
if (result == EImageEditorSoftkeyCmdYes) |
|
832 |
{ |
|
833 |
if (QueryAndSaveL()) |
|
834 |
{ |
|
835 |
SetBusy(); |
|
836 |
iExitFromApp = ETrue; |
|
837 |
exitNow = EFalse; |
|
838 |
LOG(KImageEditorLogFile, "CImageEditorAppUi:HandleCommandL: Hide application from Fast-swap window."); |
|
839 |
CAknAppUi::HideApplicationFromFSW(ETrue); |
|
840 |
} |
|
841 |
else |
|
842 |
{ |
|
843 |
iExitFromApp = EFalse; |
|
844 |
exitNow = EFalse; |
|
845 |
} |
|
846 |
||
847 |
} |
|
848 |
else if (result == EImageEditorSoftkeyCmdNo) |
|
849 |
{ |
|
850 |
// do nothing, exitNow == ETrue |
|
851 |
} |
|
852 |
else |
|
853 |
{ |
|
854 |
// Automatic cancel may have occurred, don't exit |
|
855 |
iExitFromApp = EFalse; |
|
856 |
exitNow = EFalse; |
|
857 |
} |
|
858 |
} |
|
859 |
} |
|
860 |
||
861 |
if (exitNow) |
|
862 |
{ |
|
863 |
DeleteTempFiles(); |
|
864 |
RunAppShutter(); |
|
865 |
||
866 |
//Exit(); |
|
867 |
} |
|
868 |
break; |
|
869 |
} |
|
870 |
||
871 |
/** |
|
872 |
* |
|
873 |
* SOFTKEY COMMANDS |
|
874 |
* |
|
875 |
*/ |
|
876 |
||
877 |
// Back softkey pressed => Close editor |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
878 |
case EImageEditorSoftkeyCmdBack: |
8 | 879 |
{ |
880 |
TBool exitNow = ETrue; |
|
881 |
if (iSaving || iCancelling) |
|
882 |
{ |
|
883 |
// ignore |
|
884 |
} |
|
885 |
if (!((CImageEditorUIView*) iEditorView)->IsMemoryInCriticalLevel()) |
|
886 |
{ |
|
887 |
if (iEditorManager->IsImageChanged()) |
|
888 |
{ |
|
889 |
// launch "Save changes?" query |
|
890 |
TInt |
|
891 |
result = |
|
892 |
((CImageEditorUIView *) iEditorView)->LaunchSaveChangesQueryL(); |
|
893 |
if (result == EImageEditorSoftkeyCmdYes) |
|
894 |
{ |
|
895 |
if (QueryAndSaveL()) |
|
896 |
{ |
|
897 |
SetBusy(); |
|
898 |
iExitFromApp = ETrue; |
|
899 |
exitNow = EFalse; |
|
900 |
LOG(KImageEditorLogFile, "CImageEditorAppUi:HandleCommandL: Hide application from Fast-swap window."); |
|
901 |
CAknAppUi::HideApplicationFromFSW(ETrue); |
|
902 |
} |
|
903 |
else |
|
904 |
{ |
|
905 |
iExitFromApp = EFalse; |
|
906 |
exitNow = EFalse; |
|
907 |
} |
|
908 |
||
909 |
} |
|
910 |
else if (result == EImageEditorSoftkeyCmdNo) |
|
911 |
{ |
|
912 |
// do nothing, exitNow == ETrue |
|
913 |
} |
|
914 |
else |
|
915 |
{ |
|
916 |
// Automatic cancel may have occurred, don't exit |
|
917 |
iExitFromApp = EFalse; |
|
918 |
exitNow = EFalse; |
|
919 |
} |
|
920 |
} |
|
921 |
} |
|
922 |
||
923 |
if (exitNow) |
|
924 |
{ |
|
925 |
DeleteTempFiles(); |
|
926 |
RunAppShutter(); |
|
927 |
//ProcessCommandL(EAknCmdExit); |
|
928 |
} |
|
929 |
break; |
|
930 |
} |
|
931 |
||
932 |
/** |
|
933 |
* |
|
934 |
* SYSTEM COMMANDS |
|
935 |
* |
|
936 |
*/ |
|
937 |
||
938 |
case EEikCmdExit: |
|
939 |
{ |
|
940 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: EEikCmdExit caught"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
941 |
DeleteTempFiles(); |
8 | 942 |
Exit(); |
943 |
break; |
|
944 |
} |
|
945 |
||
946 |
/** |
|
947 |
* |
|
948 |
* MISC COMMANDS |
|
949 |
* |
|
950 |
*/ |
|
951 |
||
952 |
// Render image |
|
953 |
case EImageEditorCmdRender: |
|
954 |
{ |
|
955 |
RenderL(); |
|
956 |
break; |
|
957 |
} |
|
958 |
case EImageEditorResetFullScreen: |
|
959 |
{ |
|
960 |
ResetFullScreenL(); |
|
961 |
} |
|
962 |
case EImageEditorCmdViewReady: |
|
963 |
{ |
|
964 |
||
965 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: View ready"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
966 |
iEditorReady = ETrue; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
967 |
|
8 | 968 |
// Initialize UI items |
969 |
InitializeUiItemsL(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
970 |
ApplicationReadyL(); |
8 | 971 |
break; |
972 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
973 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
974 |
case EImageEditorApplyPlugin: |
8 | 975 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
976 |
// Return from plug-in |
8 | 977 |
SetBusy(); |
978 |
iCallback->DoCallback(KObReturnFromPluginID); |
|
979 |
break; |
|
980 |
} |
|
981 |
||
982 |
case EImageEditorCancelPlugin: |
|
983 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
984 |
SetBusy(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
985 |
iCancelling = ETrue; |
8 | 986 |
// ResetFullScreenL(); |
987 |
iPluginName.Copy(KNull); |
|
988 |
iCallback->DoCallback(KObCancelCallbackID); |
|
989 |
break; |
|
990 |
} |
|
991 |
||
992 |
case EImageEditorAddFilterToEngine: |
|
993 |
{ |
|
994 |
// Add the current plugin parameters to engine |
|
995 |
// and continue with the same plugin |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
996 |
iEditorManager->AddFilterToEngineL(); |
8 | 997 |
break; |
998 |
} |
|
999 |
||
1000 |
case EImageEditorStoreParameters: |
|
1001 |
{ |
|
1002 |
break; |
|
1003 |
} |
|
1004 |
||
1005 |
case EImageEditorUndoFilter: |
|
1006 |
{ |
|
1007 |
// Undo one filter (can be called if one plugin |
|
1008 |
// has put more than one filter to the engine) |
|
1009 |
SetBusy(); |
|
1010 |
iEditorManager->UndoL(); |
|
1011 |
SetUndoFlag(); |
|
1012 |
((CImageEditorUIView *) iEditorView)->GetContainer()->DrawNow(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1013 |
ResetBusy(); |
8 | 1014 |
break; |
1015 |
} |
|
1016 |
||
1017 |
case EImageEditorSaveAndPrint: |
|
1018 |
{ |
|
1019 |
if (iEditorManager->IsImageChanged()) |
|
1020 |
{ |
|
1021 |
iPrinting = ETrue; |
|
1022 |
SaveImageL(); |
|
1023 |
} |
|
1024 |
else |
|
1025 |
{ |
|
1026 |
SetBusy(); |
|
1027 |
iCallback->DoCallback(KObPrintCallbackID); |
|
1028 |
} |
|
1029 |
break; |
|
1030 |
} |
|
1031 |
case EImageEditorResetZoom: |
|
1032 |
{ |
|
1033 |
// If this is called rendering must be done separately |
|
1034 |
iEditorManager->ZoomL(EZoomMin); |
|
1035 |
((CImageEditorUIView *) iEditorView)->SetZoomModeL( |
|
1036 |
iEditorManager->GetZoomMode()); |
|
1037 |
break; |
|
1038 |
} |
|
1039 |
case EImageEditorCmdTouchPan: |
|
1040 |
{ |
|
1041 |
TouchPanL(); |
|
1042 |
break; |
|
1043 |
} |
|
1044 |
case EImageEditorOpenContextMenu: |
|
1045 |
{ |
|
1046 |
CAknViewAppUi::ProcessCommandL(EAknSoftkeyContextOptions); |
|
1047 |
break; |
|
1048 |
} |
|
1049 |
default: |
|
1050 |
{ |
|
1051 |
// CSendUi commands |
|
1052 |
if (aCommand >= EImageEditorMenuCmdSend && aCommand |
|
1053 |
< EImageEditorMenuCmdSendLast) |
|
1054 |
{ |
|
1055 |
SetBusy(); |
|
1056 |
SaveChangesAndSendL(); |
|
1057 |
break; |
|
1058 |
} |
|
1059 |
||
1060 |
/** |
|
1061 |
* |
|
1062 |
* BEVERLY HILLS |
|
1063 |
* |
|
1064 |
*/ |
|
1065 |
else |
|
1066 |
{ |
|
1067 |
// Do not handle unknown commands |
|
1068 |
ResetBusy(); |
|
1069 |
break; |
|
1070 |
} |
|
1071 |
} |
|
1072 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1073 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1074 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1075 |
//============================================================================= |
8 | 1076 |
void CImageEditorAppUi::HandleWsEventL(const TWsEvent & aEvent, |
1077 |
CCoeControl * aDestination) |
|
1078 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1079 |
#ifdef VERBOSE |
8 | 1080 |
LOGFMT3 (KImageEditorLogFile, "CImageEditorAppUi::HandleWsEventL: aEvent.Type() == %d, aEvent.Key().iCode == %d, aEvent.Key().iScanCode == %d", aEvent.Type(), (TInt)aEvent.Key()->iCode, (TInt)aEvent.Key()->iScanCode); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1081 |
#endif |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1082 |
|
8 | 1083 |
switch (aEvent.Type()) |
1084 |
{ |
|
1085 |
||
1086 |
case EEventFocusLost: |
|
1087 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1088 |
iForeground = EFalse; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1089 |
break; |
8 | 1090 |
} |
1091 |
||
1092 |
case EEventFocusGained: |
|
1093 |
{ |
|
1094 |
||
1095 |
// Update the screen rect when we gain focus. |
|
1096 |
// This isn't really needed every time, it should only do this if something has changed |
|
1097 |
if (iImageController) |
|
1098 |
{ |
|
1099 |
UpdateScreenRectL(); |
|
1100 |
} |
|
1101 |
||
1102 |
if (iFullScreen) |
|
1103 |
{ |
|
1104 |
StatusPane()->MakeVisible(EFalse); |
|
1105 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1106 |
iForeground = ETrue; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1107 |
break; |
8 | 1108 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1109 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1110 |
default: |
8 | 1111 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1112 |
break; |
8 | 1113 |
} |
1114 |
||
1115 |
} |
|
1116 |
||
1117 |
if ((aEvent.Type() == KAknUidValueEndKeyCloseEvent) |
|
1118 |
&& iEditorManager->IsImageChanged()) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1119 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1120 |
if (iCancelling) |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1121 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1122 |
return; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1123 |
} |
8 | 1124 |
iExitFromApp = ETrue; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1125 |
if (iSaving) |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1126 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1127 |
iImageController->CancelOperation(ETrue); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1128 |
iSaveOnExit = EFalse; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1129 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1130 |
return; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1131 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1132 |
|
8 | 1133 |
TInt err = ImageEditorUtils::GenerateNewDocumentNameL( |
1134 |
iEikonEnv->FsSession(), iSourceFileName, iDocumentName, |
|
1135 |
&iSourceImageMgAlbumIdList); |
|
1136 |
SaveImageOverWriteL(EFalse); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1137 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1138 |
else |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1139 |
{ |
8 | 1140 |
TInt err(0); |
1141 |
TRAP( err, CAknViewAppUi::HandleWsEventL( aEvent, aDestination ) ); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1142 |
} |
8 | 1143 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1144 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1145 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1146 |
void CImageEditorAppUi::HandleScreenDeviceChangedL() |
8 | 1147 |
{ |
1148 |
||
1149 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleScreenDeviceChangedL()"); |
|
1150 |
// Work-a-round to avoid softkeys to drawn incorrectly |
|
1151 |
// when a dialog is open when changing to view mode |
|
1152 |
if (iConstructionState == EConstructionStateReady && iSaving == EFalse |
|
1153 |
&& iSending == EFalse) |
|
1154 |
{ |
|
1155 |
StopDisplayingMenuBar(); |
|
1156 |
} |
|
1157 |
||
1158 |
CAknViewAppUi::HandleScreenDeviceChangedL(); |
|
1159 |
||
1160 |
//called while screen mode change |
|
1161 |
if (!iStandby) |
|
1162 |
{ |
|
1163 |
if (iPluginName == KDrawPlugin) |
|
1164 |
{ |
|
1165 |
InitialHorizontalDrawPlugin(); |
|
1166 |
} |
|
1167 |
} |
|
1168 |
iStandby = EFalse; |
|
1169 |
||
1170 |
TBool visibleFlag = EFalse; |
|
1171 |
if (((CImageEditorUIView *) iEditorView)->GetContainer()) |
|
1172 |
{ |
|
1173 |
visibleFlag |
|
1174 |
= ((CImageEditorUIView *) iEditorView)->GetContainer()->IsVisible(); |
|
1175 |
} |
|
1176 |
||
1177 |
// If orientation changes during loading - screen bitmap need to be recreated |
|
1178 |
// In the start-up there can be event from system without screen device change |
|
1179 |
if (!iImageLoaded && iConstructionState != EConstructionStateAlloc) |
|
1180 |
{ |
|
1181 |
iOrientationChanged = ETrue; |
|
1182 |
// Set landscape parameter |
|
1183 |
if (LandscapeScreenOrientation()) |
|
1184 |
{ |
|
1185 |
iResolutionUtil->SetLandscape(ETrue); |
|
1186 |
} |
|
1187 |
else |
|
1188 |
{ |
|
1189 |
iResolutionUtil->SetLandscape(EFalse); |
|
1190 |
} |
|
1191 |
||
1192 |
iResolutionUtil->UpdateScreenMode(); |
|
1193 |
TRect rect; |
|
1194 |
iResolutionUtil->GetClientRect(rect); |
|
1195 |
CCoeControl * control = |
|
1196 |
((CImageEditorUIView *) iEditorView)->GetContainer(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1197 |
control->SetRect(rect); |
8 | 1198 |
} |
1199 |
||
1200 |
// Update screen rects if we are currently in the foreground. |
|
1201 |
else if ((iForeground && iImageController) || visibleFlag) |
|
1202 |
{ |
|
1203 |
UpdateScreenRectL(); |
|
1204 |
} |
|
1205 |
||
1206 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1207 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1208 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1209 |
TBool CImageEditorAppUi::LandscapeScreenOrientation() |
8 | 1210 |
{ |
1211 |
||
1212 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::LandscapeScreenOrientation()"); |
|
1213 |
||
1214 |
TBool orientation = EFalse; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1215 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1216 |
#ifdef LANDSCAPE_SUPPORT |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1217 |
|
8 | 1218 |
TRect rect; |
1219 |
||
1220 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, rect); |
|
1221 |
||
1222 |
if (rect.iBr.iX > rect.iBr.iY) |
|
1223 |
{ |
|
1224 |
orientation = ETrue; |
|
1225 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1226 |
else |
8 | 1227 |
{ |
1228 |
orientation = EFalse; |
|
1229 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1230 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1231 |
#endif |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1232 |
|
8 | 1233 |
LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: Orientation (%d)", (TInt)orientation); |
1234 |
||
1235 |
return orientation; |
|
1236 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1237 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1238 |
//============================================================================= |
8 | 1239 |
void CImageEditorAppUi::HandleForegroundEventL(TBool aForeground) |
1240 |
{ |
|
1241 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleForegroundEventL()"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1242 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1243 |
if (aForeground) |
8 | 1244 |
{ |
1245 |
if (!BaflUtils::FileExists(iEikonEnv->Static()->FsSession(), |
|
1246 |
iSourceFileName)) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1247 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1248 |
DeleteTempFiles(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1249 |
RunAppShutter(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1250 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1251 |
|
8 | 1252 |
if (iProcessPriorityAltered) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1253 |
{ |
8 | 1254 |
// Return to normal priority. |
1255 |
RProcess myProcess; |
|
1256 |
TProcessPriority priority = myProcess.Priority(); |
|
1257 |
if (priority < iOriginalProcessPriority) |
|
1258 |
{ |
|
1259 |
myProcess.SetPriority(iOriginalProcessPriority); |
|
1260 |
} |
|
1261 |
iProcessPriorityAltered = EFalse; |
|
1262 |
iStandby = ETrue; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1263 |
} |
8 | 1264 |
|
1265 |
// Check that application is in sync with the system |
|
1266 |
if (!iImageLoaded && iConstructionState != EConstructionStateAlloc) |
|
1267 |
{ |
|
1268 |
iOrientationChanged = ETrue; |
|
1269 |
} |
|
1270 |
else if (iResolutionUtil && LandscapeScreenOrientation() |
|
1271 |
!= iResolutionUtil->GetLandscape()) |
|
1272 |
{ |
|
1273 |
UpdateScreenRectL(); |
|
1274 |
} |
|
1275 |
||
1276 |
iEditorView->HandleCommandL(EImageEditorFocusGained); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1277 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1278 |
else |
8 | 1279 |
{ |
1280 |
iEditorView->HandleCommandL(EImageEditorFocusLost); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1281 |
// Set the priority to low. This is needed to handle the situations |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1282 |
// where the engine is performing heavy processing while the application |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1283 |
// is in background. |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1284 |
RProcess myProcess; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1285 |
iOriginalProcessPriority = myProcess.Priority(); |
8 | 1286 |
myProcess.SetPriority(EPriorityLow); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1287 |
iProcessPriorityAltered = ETrue; |
8 | 1288 |
iStandby = ETrue; |
1289 |
||
1290 |
} |
|
1291 |
CAknViewAppUi::HandleForegroundEventL(aForeground); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1292 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1293 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1294 |
//============================================================================= |
8 | 1295 |
TBool CImageEditorAppUi::ProcessCommandParametersL(TApaCommand aCommand, |
1296 |
TFileName & aDocumentName, const TDesC8 & aTail) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1297 |
{ |
8 | 1298 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::ProcessCommandParametersL"); |
1299 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1300 |
// Store command parameter document name |
8 | 1301 |
iDocumentName.Copy(aDocumentName); |
1302 |
||
1303 |
// Save original document name |
|
1304 |
iSourceFileName.Copy(aDocumentName); |
|
1305 |
||
1306 |
// Set document name for printing |
|
1307 |
((CImageEditorUIView *) iEditorView)->SetImageFileName(iDocumentName); |
|
1308 |
||
1309 |
// Return default action |
|
1310 |
return CAknViewAppUi::ProcessCommandParametersL(aCommand, aDocumentName, |
|
1311 |
aTail); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1312 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1313 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1314 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1315 |
void CImageEditorAppUi::OpenFileL(RFile &aFile) |
8 | 1316 |
{ |
1317 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::OpenFileL"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1318 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1319 |
// This function should be called only when editor is started |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1320 |
// as an embedded application. |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1321 |
|
8 | 1322 |
// Store command parameter document name |
1323 |
aFile.FullName(iDocumentName); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1324 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1325 |
// Open file for editor |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1326 |
// File must be opened until editor is closed, otherwise |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1327 |
// shared session is lost -> Error code -14. |
8 | 1328 |
RFs& fs = iEikonEnv->FsSession(); |
1329 |
fs.ShareProtected(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1330 |
TInt err = iFile.Open(fs, iDocumentName, EFileRead | EFileShareReadersOnly); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1331 |
if (KErrNone != err) |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1332 |
{ |
8 | 1333 |
User::LeaveIfError(iFile.Open(fs, iDocumentName, EFileRead |
1334 |
| EFileShareAny)); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1335 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1336 |
|
8 | 1337 |
// Save original document name |
1338 |
aFile.FullName(iSourceFileName); |
|
1339 |
||
1340 |
// Set document name for printing |
|
1341 |
((CImageEditorUIView *) iEditorView)->SetImageFileName(iDocumentName); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1342 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1343 |
// If OpenFileL was not called when the startup sequence reached |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1344 |
// the point where it needs the document name, the construction was |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1345 |
// suspended to wait for this. |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1346 |
if (EConstructionStateWaitForStartupParameters == iConstructionState) |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1347 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1348 |
// Resume construction |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1349 |
iConstructionState = EConstructionStateLoadImage; |
8 | 1350 |
iCallback->DoCallback(KObConstructCallBackID); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1351 |
} |
8 | 1352 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1353 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1354 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1355 |
CArrayFix<TCoeHelpContext>* CImageEditorAppUi::HelpContextL() const |
8 | 1356 |
{ |
1357 |
CArrayFixFlat<TCoeHelpContext>* array = new (ELeave) CArrayFixFlat< |
|
1358 |
TCoeHelpContext> (1); |
|
1359 |
CleanupStack::PushL(array); |
|
1360 |
||
1361 |
TBool zoomedIn = ((CImageEditorUIView *) iEditorView)->InZoomingState(); |
|
1362 |
if (zoomedIn) |
|
1363 |
{ |
|
1364 |
array->AppendL(TCoeHelpContext(TUid::Uid(UID_IMAGE_EDITOR), |
|
1365 |
KSIE_HLP_ZOOMING)); |
|
1366 |
} |
|
1367 |
else |
|
1368 |
{ |
|
1369 |
array->AppendL(TCoeHelpContext(TUid::Uid(UID_IMAGE_EDITOR), |
|
1370 |
KSIE_HLP_MAIN)); |
|
1371 |
} |
|
1372 |
||
1373 |
CleanupStack::Pop(array); |
|
1374 |
return array; |
|
1375 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1376 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1377 |
//============================================================================= |
8 | 1378 |
void CImageEditorAppUi::InitializePluginL() |
1379 |
{ |
|
1380 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Initialising plugin"); |
|
1381 |
||
1382 |
// Get pointer to the view |
|
1383 |
CImageEditorUIView * view = (CImageEditorUIView *) iEditorView; |
|
1384 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1385 |
// Close the previous plug-in |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1386 |
iEditorManager->ClosePlugin(); |
8 | 1387 |
|
1388 |
// Open a new plug-in |
|
1389 |
CPluginInfo * pgn_info = view->GetSelectedPluginInfoL(); |
|
1390 |
||
1391 |
if (pgn_info) |
|
1392 |
{ |
|
1393 |
iEditorManager->OpenPluginL(pgn_info->PluginDll()->Des()); |
|
1394 |
iPluginName.Copy(pgn_info->PluginDll()->Des()); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1395 |
|
8 | 1396 |
//judge if it is draw plug-in |
1397 |
if (iPluginName != KNull && iPluginName == KDrawPlugin) |
|
1398 |
{ |
|
1399 |
((CImageEditorUIContainer *) ((CImageEditorUIView *) iEditorView)->GetContainer())->IsDrawPlugin(ETrue); |
|
1400 |
SetFullScreenL(); |
|
1401 |
} |
|
1402 |
else |
|
1403 |
{ |
|
1404 |
((CImageEditorUIContainer *) ((CImageEditorUIView *) iEditorView)->GetContainer())->IsDrawPlugin(EFalse); |
|
1405 |
} |
|
1406 |
||
1407 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin opened"); |
|
1408 |
||
1409 |
// current rect |
|
1410 |
TRect rect; |
|
1411 |
iResolutionUtil->GetClientRect(rect); |
|
1412 |
||
1413 |
// Create a plug-in control |
|
1414 |
// Ownership is moved to the plug-in |
|
1415 |
CCoeControl * control = NULL; |
|
1416 |
TInt err = iEditorManager->CreatePluginControlL(rect,view->GetContainer(), control); |
|
1417 |
||
1418 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin control created"); |
|
1419 |
||
1420 |
// The plug-in activation was cancelled |
|
1421 |
if (err != KErrNone) |
|
1422 |
{ |
|
1423 |
// Cancel plug-in |
|
1424 |
iCancelling = ETrue; |
|
1425 |
iCallback->DoCallback(KObCancelCallbackID); |
|
1426 |
} |
|
1427 |
// Activate plug-in |
|
1428 |
else |
|
1429 |
{ |
|
1430 |
// Register control to UI |
|
1431 |
view->ActivatePluginL(control); |
|
1432 |
||
1433 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin activated"); |
|
1434 |
||
1435 |
// If the filter did not have a control, close plug-in |
|
1436 |
if (!control) |
|
1437 |
{ |
|
1438 |
iEditorManager->ClosePlugin(); |
|
1439 |
} |
|
1440 |
||
1441 |
// Set the last opened image to editor view |
|
1442 |
((CImageEditorUIView *) iEditorView)->SetImageL(iEditorManager->GetPreviewImage()); |
|
1443 |
||
1444 |
ResetBusy(); |
|
1445 |
} |
|
1446 |
} |
|
1447 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1448 |
else |
8 | 1449 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1450 |
ResetBusy(); |
8 | 1451 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1452 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1453 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1454 |
//============================================================================= |
8 | 1455 |
void CImageEditorAppUi::CreatePluginLocatorL() |
1456 |
{ |
|
1457 |
iLocator = CPluginLocator::NewL(); |
|
1458 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1459 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1460 |
//============================================================================= |
8 | 1461 |
void CImageEditorAppUi::CreateEditorManagerL() |
1462 |
{ |
|
1463 |
iEditorManager = CImageEditorPluginManager::NewL(); |
|
1464 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1465 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1466 |
//============================================================================= |
8 | 1467 |
void CImageEditorAppUi::CreateImageControllerL() |
1468 |
{ |
|
1469 |
iImageController = CImageController::NewL(this, iEditorManager); |
|
1470 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1471 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1472 |
//============================================================================= |
8 | 1473 |
void CImageEditorAppUi::LoadPluginsL() |
1474 |
{ |
|
1475 |
// Scan plug-ins |
|
1476 |
iLocator->ScanPluginsL(); |
|
1477 |
} |
|
1478 |
||
1479 |
//============================================================================= |
|
1480 |
void CImageEditorAppUi::InitializeUiItemsL() |
|
1481 |
{ |
|
1482 |
||
1483 |
LOG (KImageEditorLogFile, "CImageEditorAppUi: InitializeUiItemsL"); |
|
1484 |
||
1485 |
// Set UI items |
|
1486 |
if (iEditorReady && iPluginsScanned && iImageLoaded) |
|
1487 |
{ |
|
1488 |
for (TInt i = 0, c = iLocator->CountPlugins(); i < c; ++i) |
|
1489 |
{ |
|
1490 |
((CImageEditorUIView *) iEditorView)->AddPluginUiItemL(iLocator->GetPluginInfo(i)); |
|
1491 |
} |
|
1492 |
||
1493 |
SetFileNameTitlePaneL(iSourceFileName); |
|
1494 |
||
1495 |
((CImageEditorUIView *) iEditorView)->SetZoomModeL(iEditorManager->GetZoomMode()); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1496 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1497 |
LOG (KImageEditorLogFile, "CImageEditorAppUi: Plugins initialized"); |
8 | 1498 |
} |
1499 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1500 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1501 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1502 |
void CImageEditorAppUi::ApplicationReadyL() |
8 | 1503 |
{ |
1504 |
LOG (KImageEditorLogFile, "CImageEditorAppUi: ApplicationReadyLL"); |
|
1505 |
||
1506 |
// Set UI items |
|
1507 |
if (iEditorReady && iPluginsScanned && iImageLoaded) |
|
1508 |
{ |
|
1509 |
if (iOrientationChanged) |
|
1510 |
{ |
|
1511 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Orientation changed, updating screen rect"); |
|
1512 |
// Check that application is in sync with the system |
|
1513 |
// This should fix the problem with screen update after image is loading when |
|
1514 |
// screen is folded during loading |
|
1515 |
UpdateScreenRectL(); |
|
1516 |
iOrientationChanged = EFalse; |
|
1517 |
} |
|
1518 |
else if ((LandscapeScreenOrientation() |
|
1519 |
&& (StatusPane()->CurrentLayoutResId() |
|
1520 |
!= R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT))) |
|
1521 |
{ |
|
1522 |
LOG(KImageEditorLogFile,"CImageEditorAppUi: Status pane needs to be changed->updating screen rect"); |
|
1523 |
// Updating screen rect updates also status pane to correct "flat version" |
|
1524 |
UpdateScreenRectL(); |
|
1525 |
} |
|
1526 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1527 |
TRect screenRect; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1528 |
CResolutionUtil::Self()->GetClientRect(screenRect); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1529 |
iOldScreenRect = screenRect; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1530 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1531 |
ResetBusy(); |
8 | 1532 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1533 |
// Open Plugin selection grid right away when application start is finished |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1534 |
//HandleCommandL(EImageEditorMenuCmdApplyEffect); |
8 | 1535 |
|
1536 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1537 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1538 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1539 |
//============================================================================= |
8 | 1540 |
void CImageEditorAppUi::LoadImageL() |
1541 |
{ |
|
1542 |
||
1543 |
LOGFMT (KImageEditorLogFile, "CImageEditorAppUi: Loading image (%S)", &iSourceFileName); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1544 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1545 |
// Load the image to be edited |
8 | 1546 |
iImageController->LoadImageL(iSourceFileName); |
1547 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1548 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1549 |
//============================================================================= |
8 | 1550 |
void CImageEditorAppUi::SaveImageL() |
1551 |
{ |
|
1552 |
||
1553 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Saving image"); |
|
1554 |
||
1555 |
// Check if source image still exists |
|
1556 |
if (!BaflUtils::FileExists(iEikonEnv->FsSession(), iSourceFileName)) |
|
1557 |
{ |
|
1558 |
if (iExitFromApp) |
|
1559 |
{ |
|
1560 |
TInt exit = ((CImageEditorUIView *) iEditorView)->LaunchExitWithoutSavingQueryL(); |
|
1561 |
if (exit) |
|
1562 |
{ |
|
1563 |
// Exit |
|
1564 |
User::Leave(KSIEEErrorOkToExit); |
|
1565 |
} |
|
1566 |
else |
|
1567 |
{ |
|
1568 |
iExitFromApp = EFalse; |
|
1569 |
User::Leave(KSIEEInternal); |
|
1570 |
} |
|
1571 |
} |
|
1572 |
else |
|
1573 |
{ |
|
1574 |
User::Leave(KSIEEInternal); |
|
1575 |
} |
|
1576 |
} |
|
1577 |
||
1578 |
// Check document name if not saved yet or memory card removed |
|
1579 |
if (!iImageSaved || !BaflUtils::PathExists(iEikonEnv->FsSession(), |
|
1580 |
iTempSaveFileName.Left(3))) |
|
1581 |
{ |
|
1582 |
// If not saved yet, check that document name is valid |
|
1583 |
SetImageNameL(); |
|
1584 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1585 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1586 |
// Set temp save image name to engine |
8 | 1587 |
iEditorManager->SetImageName(iTempSaveFileName); |
1588 |
||
1589 |
SetLayoutAwareApp(EFalse); |
|
1590 |
// Launch save wait note |
|
1591 |
LaunchSaveWaitNoteL(); |
|
1592 |
||
1593 |
iCallback->DoCallback(KObSaveCallbackID); |
|
1594 |
||
1595 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1596 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1597 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1598 |
void CImageEditorAppUi::SetImageNameL() |
8 | 1599 |
{ |
1600 |
||
1601 |
// Create new document name |
|
1602 |
// (note that this also selects the drive where the image is saved) |
|
1603 |
TInt err = ImageEditorUtils::GenerateNewDocumentNameL( |
|
1604 |
iEikonEnv->FsSession(), iSourceFileName, iDocumentName, |
|
1605 |
&iSourceImageMgAlbumIdList); |
|
1606 |
User::LeaveIfError(err); // cannot save the image |
|
1607 |
iEditorManager->SetImageName(iDocumentName); |
|
1608 |
||
1609 |
// Change title pane text |
|
1610 |
SetFileNameTitlePaneL(iSourceFileName); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1611 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1612 |
// Check that everything is in order with the file |
8 | 1613 |
CheckFileL(iDocumentName); |
1614 |
||
1615 |
// Generate temporary save file name |
|
1616 |
TParse tempFileParser; |
|
1617 |
tempFileParser.Set(KTempSaveFile, &KTempPath, &iDocumentName); |
|
1618 |
iTempSaveFileName.Copy(tempFileParser.FullName()); |
|
1619 |
BaflUtils::EnsurePathExistsL(iEikonEnv->FsSession(), iTempSaveFileName); |
|
1620 |
||
1621 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1622 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1623 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1624 |
void CImageEditorAppUi::SaveChangesAndSendL() |
8 | 1625 |
{ |
1626 |
||
1627 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::SaveChangesAndSendL()"); |
|
1628 |
||
1629 |
iSending = ETrue; |
|
1630 |
||
1631 |
// Delete old temp files if exists |
|
1632 |
DeleteTempFiles(); |
|
1633 |
||
1634 |
if (iEditorManager->IsImageChanged()) |
|
1635 |
{ |
|
1636 |
// Save image |
|
1637 |
SaveImageL(); |
|
1638 |
} |
|
1639 |
// Otherwise send last saved image |
|
1640 |
else |
|
1641 |
{ |
|
1642 |
SendImageL(); |
|
1643 |
} |
|
1644 |
||
1645 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1646 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1647 |
//============================================================================= |
8 | 1648 |
void CImageEditorAppUi::SendImageL() |
1649 |
{ |
|
1650 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::SendImageL()"); |
|
1651 |
||
1652 |
ResetBusy(); |
|
1653 |
||
1654 |
RFs& fs = iEikonEnv->FsSession(); |
|
1655 |
TFileName fileToSend; |
|
1656 |
||
1657 |
// Check if image has been modified and saved |
|
1658 |
if (BaflUtils::FileExists(fs, iDocumentName)) |
|
1659 |
{ |
|
1660 |
fileToSend.Append(iDocumentName); |
|
1661 |
} |
|
1662 |
// Use source file if no changes done |
|
1663 |
else |
|
1664 |
{ |
|
1665 |
fileToSend.Append(iSourceFileName); |
|
1666 |
} |
|
1667 |
||
1668 |
LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: Sending image: %S", &fileToSend); |
|
1669 |
||
1670 |
iEikonEnv->SetBusy(ETrue); |
|
1671 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1672 |
// Launch send query dialog |
8 | 1673 |
TSendingCapabilities cap(0, 0, TSendingCapabilities::ESupportsAttachments); |
1674 |
((CImageEditorUIView *) iEditorView)->LaunchSendQueryL(cap, fileToSend); |
|
1675 |
||
1676 |
iSending = EFalse; |
|
1677 |
iEikonEnv->SetBusy(EFalse); |
|
1678 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1679 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1680 |
//============================================================================= |
8 | 1681 |
void CImageEditorAppUi::CheckFileL(const TDesC & aFileName) const |
1682 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1683 |
RFs & fs = iEikonEnv->FsSession(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1684 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1685 |
// Is file name valid |
8 | 1686 |
if (!fs.IsValidName(aFileName)) |
1687 |
{ |
|
1688 |
User::Leave(KSIEESaveFile); |
|
1689 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1690 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1691 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1692 |
//============================================================================= |
8 | 1693 |
TBool CImageEditorAppUi::CallbackMethodL(TInt aParam) |
1694 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1695 |
LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::CallbackMethodL (%d)", aParam); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1696 |
|
8 | 1697 |
TBool ret = EFalse; |
1698 |
||
1699 |
switch (aParam) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1700 |
{ |
8 | 1701 |
case KObConstructCallBackID: |
1702 |
{ |
|
1703 |
switch (iConstructionState) |
|
1704 |
{ |
|
1705 |
case EConstructionStateAlloc: |
|
1706 |
{ |
|
1707 |
// Launch wait note |
|
1708 |
LaunchLoadWaitNoteL(); |
|
1709 |
||
1710 |
// Initialize resolution utility. CResolutionUtil::InitializeL() |
|
1711 |
// Returns the singleton instance of the class, creating it if |
|
1712 |
// it does not yet exist. |
|
1713 |
iResolutionUtil = CResolutionUtil::InitializeL(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1714 |
iResolutionUtil->SetFullScreen(EFalse); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1715 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1716 |
#ifdef LANDSCAPE_SUPPORT |
8 | 1717 |
// Set landscape parameter |
1718 |
if (LandscapeScreenOrientation()) |
|
1719 |
{ |
|
1720 |
iResolutionUtil->SetLandscape(ETrue); |
|
1721 |
} |
|
1722 |
else |
|
1723 |
{ |
|
1724 |
iResolutionUtil->SetLandscape(EFalse); |
|
1725 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1726 |
#else |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1727 |
#ifdef LANDSCAPE_ONLY |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1728 |
iResolutionUtil->SetLandscape(ETrue); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1729 |
#else |
8 | 1730 |
iResolutionUtil->SetLandscape(EFalse); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1731 |
#endif |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1732 |
#endif // LANDSCAPE_SUPPORT |
8 | 1733 |
iResolutionUtil->UpdateScreenMode(); |
1734 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Resolution set"); |
|
1735 |
||
1736 |
// Create the Send UI instance |
|
1737 |
iSendAppUi = CSendUi::NewL(); |
|
1738 |
((CImageEditorUIView *) iEditorView)->SetSendAppUi(iSendAppUi); |
|
1739 |
||
1740 |
// Create plug-in locator |
|
1741 |
CreatePluginLocatorL(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1742 |
LOG(KImageEditorLogFile, "Locator created"); |
8 | 1743 |
|
1744 |
// Create plug-in manager |
|
1745 |
CreateEditorManagerL(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1746 |
LOG(KImageEditorLogFile, "Manager created"); |
8 | 1747 |
|
1748 |
// Create image controller |
|
1749 |
CreateImageControllerL(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1750 |
LOG(KImageEditorLogFile, "Image Controller created"); |
8 | 1751 |
iConstructionState = EConstructionStateLoadImage; |
1752 |
ret = ETrue; |
|
1753 |
break; |
|
1754 |
} |
|
1755 |
||
1756 |
case EConstructionStateLoadImage: |
|
1757 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1758 |
LOG(KImageEditorLogFile, "Loading image"); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1759 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1760 |
// iSourceFileName is available (in embedded mode) only after |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1761 |
// CImageEditorDocument::OpenFileL has been called by the system. |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1762 |
// If that has not been done |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1763 |
if (!iSourceFileName.Length()) |
8 | 1764 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1765 |
iConstructionState = EConstructionStateWaitForStartupParameters; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1766 |
ret = EFalse; |
8 | 1767 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1768 |
else |
8 | 1769 |
{ |
1770 |
// Kill wait note before loading image. |
|
1771 |
// Some corrupted images loading stacks if wait note is displayd |
|
1772 |
//KillWaitNote(); |
|
1773 |
||
1774 |
// Relaunch wait note |
|
1775 |
//LaunchLoadWaitNoteL(); |
|
1776 |
||
1777 |
// Load image |
|
1778 |
LoadImageL(); |
|
1779 |
||
1780 |
SetFileNameTitlePaneL(iSourceFileName); |
|
1781 |
iConstructionState = EConstructionStateScanPlugins; |
|
1782 |
ret = ETrue; |
|
1783 |
} |
|
1784 |
break; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1785 |
} |
8 | 1786 |
|
1787 |
case EConstructionStateScanPlugins: |
|
1788 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1789 |
LOG(KImageEditorLogFile, "Scanning plugins"); |
8 | 1790 |
LoadPluginsL(); |
1791 |
iConstructionState = EConstructionStateInitUi; |
|
1792 |
ret = ETrue; |
|
1793 |
break; |
|
1794 |
} |
|
1795 |
||
1796 |
case EConstructionStateInitUi: |
|
1797 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1798 |
LOG(KImageEditorLogFile, "Init UI"); |
8 | 1799 |
// Initialize UI items |
1800 |
iPluginsScanned = ETrue; |
|
1801 |
InitializeUiItemsL(); |
|
1802 |
iConstructionState = EConstructionStateReady; |
|
1803 |
ret = ETrue; |
|
1804 |
break; |
|
1805 |
} |
|
1806 |
||
1807 |
default: |
|
1808 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1809 |
LOG(KImageEditorLogFile, "Ready"); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1810 |
KillWaitNote(); |
8 | 1811 |
ApplicationReadyL(); |
1812 |
break; |
|
1813 |
} |
|
1814 |
} |
|
1815 |
break; |
|
1816 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1817 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1818 |
case KObReturnFromPluginID: |
8 | 1819 |
{ |
1820 |
SetUndoFlag(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1821 |
iEditorManager->ShowPluginPopup(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1822 |
iEditorManager->ClosePlugin(); |
8 | 1823 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
1824 |
((CImageEditorUIView *) iEditorView)->ActivateMainViewL(); |
|
1825 |
||
1826 |
//Only for draw plug-in |
|
1827 |
if (iPluginName != KNull && iPluginName == KDrawPlugin) |
|
1828 |
{ |
|
1829 |
iPluginName.Copy(KNull); |
|
1830 |
ResetFullScreenL(); |
|
1831 |
} |
|
1832 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1833 |
ResetBusy(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1834 |
break; |
8 | 1835 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1836 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1837 |
case KObInitPluginID: |
8 | 1838 |
{ |
1839 |
InitializePluginL(); |
|
1840 |
SetUndoFlag(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1841 |
break; |
8 | 1842 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1843 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1844 |
case KObCancelCallbackID: |
8 | 1845 |
{ |
1846 |
TRect rect; |
|
1847 |
CResolutionUtil::Self()->GetClientRect(rect); |
|
1848 |
CCoeControl* control = ((CImageEditorUIView *) iEditorView)->GetContainer(); |
|
1849 |
control->SetRect(rect); |
|
1850 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1851 |
iEditorManager->ClosePlugin(); |
8 | 1852 |
iEditorManager->UndoL(); |
1853 |
||
1854 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
|
1855 |
((CImageEditorUIView *) iEditorView)->ActivateMainViewL(); |
|
1856 |
||
1857 |
((CImageEditorUIView *) iEditorView)->SetImageL(iEditorManager->GetPreviewImage()); |
|
1858 |
||
1859 |
SetUndoFlag(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1860 |
ResetBusy(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1861 |
iCancelling = EFalse; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1862 |
break; |
8 | 1863 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1864 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1865 |
case KObUndoDCallbackID: |
8 | 1866 |
{ |
1867 |
iEditorManager->UndoL(); |
|
1868 |
SetUndoFlag(); |
|
1869 |
((CImageEditorUIView *) iEditorView)->GetContainer()->DrawNow(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1870 |
ResetBusy(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1871 |
break; |
8 | 1872 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1873 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1874 |
case KObSendCallbackID: |
8 | 1875 |
{ |
1876 |
SendImageL(); |
|
1877 |
ResetBusy(); |
|
1878 |
break; |
|
1879 |
} |
|
1880 |
||
1881 |
case KObPrintCallbackID: |
|
1882 |
{ |
|
1883 |
// Reset first otherwise canceling print application |
|
1884 |
// leaves busy state active |
|
1885 |
iPrinting = EFalse; |
|
1886 |
ResetBusy(); |
|
1887 |
((CImageEditorUIView *) iEditorView)-> HandleCommandL(EImageEditorDoPrint); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1888 |
break; |
8 | 1889 |
} |
1890 |
||
1891 |
case KObSaveCallbackID: |
|
1892 |
{ |
|
1893 |
// Start saving |
|
1894 |
iImageController->SaveImageL(iTempSaveFileName); |
|
1895 |
iSaving = ETrue; |
|
1896 |
break; |
|
1897 |
} |
|
1898 |
||
1899 |
default: |
|
1900 |
{ |
|
1901 |
break; |
|
1902 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1903 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1904 |
|
8 | 1905 |
return ret; |
1906 |
} |
|
1907 |
||
1908 |
//============================================================================= |
|
1909 |
void CImageEditorAppUi::SetBusy() |
|
1910 |
{ |
|
1911 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: SetBusy()"); |
|
1912 |
if (iEditorView) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1913 |
{ |
8 | 1914 |
((CImageEditorUIView *) iEditorView)->SetBusy(); |
1915 |
} |
|
1916 |
iBusy = ETrue; |
|
1917 |
} |
|
1918 |
||
1919 |
//============================================================================= |
|
1920 |
void CImageEditorAppUi::ResetBusy() |
|
1921 |
{ |
|
1922 |
||
1923 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: ResetBusy()"); |
|
1924 |
// Keep busy until application is fully constructed |
|
1925 |
if (iConstructionState == EConstructionStateReady) |
|
1926 |
{ |
|
1927 |
if (iEditorView) |
|
1928 |
{ |
|
1929 |
((CImageEditorUIView *) iEditorView)->ResetBusy(); |
|
1930 |
} |
|
1931 |
iBusy = EFalse; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1932 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1933 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1934 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1935 |
//============================================================================= |
8 | 1936 |
void CImageEditorAppUi::SetFullScreenL() |
1937 |
{ |
|
1938 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
|
1939 |
||
1940 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Setting full screen"); |
|
1941 |
||
1942 |
iFullScreen = ETrue; |
|
1943 |
||
1944 |
// Set to full screen mode |
|
1945 |
((CImageEditorUIView *) iEditorView)->SetFullScreen(); |
|
1946 |
||
1947 |
// In the startup image controller might not be created yet |
|
1948 |
if (iImageController) |
|
1949 |
{ |
|
1950 |
// Update new screen resolution |
|
1951 |
UpdateScreenRectL(); |
|
1952 |
} |
|
1953 |
||
1954 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1955 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1956 |
//============================================================================= |
8 | 1957 |
void CImageEditorAppUi::ResetFullScreenL() |
1958 |
{ |
|
1959 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
|
1960 |
||
1961 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Resetting full screen"); |
|
1962 |
||
1963 |
iFullScreen = EFalse; |
|
1964 |
||
1965 |
// Set to full screen mode |
|
1966 |
((CImageEditorUIView *) iEditorView)->ResetFullScreen(); |
|
1967 |
||
1968 |
// In the startup image controller might not be created yet |
|
1969 |
if (iImageController) |
|
1970 |
{ |
|
1971 |
UpdateScreenRectL(); |
|
1972 |
} |
|
1973 |
||
1974 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1975 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1976 |
//============================================================================= |
8 | 1977 |
void CImageEditorAppUi::SetUndoFlag() |
1978 |
{ |
|
1979 |
if (iEditorView) |
|
1980 |
{ |
|
1981 |
((CImageEditorUIView *) iEditorView)->SetUndoFlag(iEditorManager->CanUndo()); |
|
1982 |
((CImageEditorUIView *) iEditorView)->SetSaveFlag(iEditorManager->IsImageChanged()); |
|
1983 |
} |
|
1984 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1985 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1986 |
//============================================================================= |
8 | 1987 |
void CImageEditorAppUi::SetTitlePaneTextL(const TDesC & aText) |
1988 |
{ |
|
1989 |
const TInt KMaximumTitleTextLength = 13; |
|
1990 |
||
1991 |
if (iEditorView) |
|
1992 |
{ |
|
1993 |
HBufC * title_text = HBufC::NewLC(aText.Length()); |
|
1994 |
TPtr title_text_ptr = title_text->Des(); |
|
1995 |
||
1996 |
// No truncation |
|
1997 |
if (aText.Length() - 4 < KMaximumTitleTextLength) |
|
1998 |
{ |
|
1999 |
// Copy whole file name |
|
2000 |
title_text_ptr.Copy(aText); |
|
2001 |
} |
|
2002 |
// With truncation |
|
2003 |
else |
|
2004 |
{ |
|
2005 |
// Copy maximum amount of the file |
|
2006 |
title_text_ptr.Copy(aText.Left(KMaximumTitleTextLength)); |
|
2007 |
||
2008 |
// Append horizontal ellipsis |
|
2009 |
title_text_ptr.Append(KBaflCharTruncation); |
|
2010 |
// Append sequence number |
|
2011 |
_LIT(KSearchWildcard, "*-???"); |
|
2012 |
TInt offset = aText.Match(KSearchWildcard); |
|
2013 |
if (offset != KErrNotFound) |
|
2014 |
{ |
|
2015 |
title_text_ptr.Append(aText.Mid(offset, 4)); |
|
2016 |
} |
|
2017 |
} |
|
2018 |
// Set title pane text |
|
2019 |
((CImageEditorUIView *) iEditorView)->SetTitlePaneTextL(title_text_ptr); |
|
2020 |
||
2021 |
CleanupStack::PopAndDestroy(); // title_text |
|
2022 |
} |
|
2023 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2024 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2025 |
//============================================================================= |
8 | 2026 |
void CImageEditorAppUi::ClearTitlePaneTextL() |
2027 |
{ |
|
2028 |
if (iEditorView) |
|
2029 |
{ |
|
2030 |
((CImageEditorUIView *) iEditorView)->ClearTitlePaneTextL(); |
|
2031 |
} |
|
2032 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2033 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2034 |
//============================================================================= |
8 | 2035 |
void CImageEditorAppUi::SetFileNameTitlePaneL(const TDesC& aFullFileName) |
2036 |
{ |
|
2037 |
TParsePtrC parser(aFullFileName); |
|
2038 |
SetTitlePaneTextL(parser.Name()); |
|
2039 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2040 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2041 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2042 |
void CImageEditorAppUi::ClearNaviPaneTextL() |
8 | 2043 |
{ |
2044 |
if (iEditorView) |
|
2045 |
{ |
|
2046 |
((CImageEditorUIView *) iEditorView)->ClearNaviPaneTextL(); |
|
2047 |
} |
|
2048 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2049 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2050 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2051 |
void CImageEditorAppUi::UpdateScreenRectL() |
8 | 2052 |
{ |
2053 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::UpdateScreenRectL()"); |
|
2054 |
||
2055 |
if (iEditorView == NULL || iEditorManager == NULL || iImageController == NULL) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2056 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2057 |
return; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2058 |
} |
8 | 2059 |
|
2060 |
iEditorView->HandleCommandL(EImageEditorPreScreenModeChange); |
|
2061 |
||
2062 |
// Set Full screen parameter |
|
2063 |
iResolutionUtil->SetFullScreen(iFullScreen); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2064 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2065 |
#ifdef LANDSCAPE_SUPPORT |
8 | 2066 |
// Set landscape parameter |
2067 |
if (LandscapeScreenOrientation()) |
|
2068 |
{ |
|
2069 |
iResolutionUtil->SetLandscape(ETrue); |
|
2070 |
} |
|
2071 |
else |
|
2072 |
{ |
|
2073 |
iResolutionUtil->SetLandscape(EFalse); |
|
2074 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2075 |
#else |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2076 |
#ifdef LANDSCAPE_ONLY |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2077 |
iResolutionUtil->SetLandscape(ETrue); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2078 |
#else |
8 | 2079 |
iResolutionUtil->SetLandscape(EFalse); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2080 |
#endif |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2081 |
#endif |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2082 |
|
8 | 2083 |
// Update view layout |
2084 |
((CImageEditorUIView *) iEditorView)->UpdateLayoutL(iEikonEnv->ScreenDevice()->CurrentScreenMode()); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2085 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2086 |
LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: CurrentScreenMode() = %d", iEikonEnv->ScreenDevice()->CurrentScreenMode() ); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2087 |
|
8 | 2088 |
// Set current screen size to resolution util |
2089 |
iResolutionUtil->UpdateScreenMode(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2090 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2091 |
// Check if screen size has changed |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2092 |
TRect newScreenRect; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2093 |
CResolutionUtil::Self()->GetClientRect(newScreenRect); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2094 |
if (iOldScreenRect == newScreenRect && !iOrientationChanged) |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2095 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2096 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Not setting new preview image"); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2097 |
return; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2098 |
} |
8 | 2099 |
|
2100 |
iOldScreenRect = newScreenRect; |
|
2101 |
||
2102 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Setting new preview image"); |
|
2103 |
||
2104 |
// Create screen bitmap for new screen size |
|
2105 |
iImageController->CreatePreviewBitmapL(); |
|
2106 |
if ((iConstructionState == EConstructionStateReady || iConstructionState |
|
2107 |
== EConstructionStateInitUi) && !iSaving && iImageLoaded) |
|
2108 |
{ |
|
2109 |
iEditorManager->SetScreenSizeL(); |
|
2110 |
} |
|
2111 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2112 |
// Set the new image pointer to editor view |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2113 |
if (!iSaving) |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2114 |
{ |
8 | 2115 |
((CImageEditorUIView *) iEditorView)->SetImageL( |
2116 |
iEditorManager->GetPreviewImage()); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2117 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2118 |
else // if saving cannot update new image until saving is completed. |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2119 |
{ |
8 | 2120 |
iOrientationChanged = ETrue; |
2121 |
((CImageEditorUIView *) iEditorView)->SetImageL(NULL); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2122 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2123 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2124 |
// Set container extent to whole screen |
8 | 2125 |
CCoeControl * control = |
2126 |
((CImageEditorUIView *) iEditorView)->GetContainer(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2127 |
if (control) |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2128 |
{ |
8 | 2129 |
//if it is draw plug-in |
2130 |
if (iFullScreen || iPluginName == KDrawPlugin) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2131 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2132 |
control->SetExtentToWholeScreen(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2133 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2134 |
else |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2135 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2136 |
TRect rect; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2137 |
iResolutionUtil->GetClientRect(rect); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2138 |
control->SetRect(rect); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2139 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2140 |
|
8 | 2141 |
if (control->IsFocused()) |
2142 |
{ |
|
2143 |
control->DrawNow(); |
|
2144 |
} |
|
2145 |
} |
|
2146 |
||
2147 |
iEditorView->HandleCommandL(EImageEditorPostScreenModeChange); |
|
2148 |
||
2149 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2150 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2151 |
//============================================================================= |
8 | 2152 |
void CImageEditorAppUi::ZoomL(const TZoom aZoom) |
2153 |
{ |
|
2154 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
|
2155 |
__ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); |
|
2156 |
SetBusy(); |
|
2157 |
||
2158 |
// Zoom |
|
2159 |
iEditorManager->ZoomL(aZoom); |
|
2160 |
||
2161 |
RenderL(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2162 |
iEditorManager->GetSystemParameters(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2163 |
|
8 | 2164 |
// Inform the view about current zoom mode |
2165 |
((CImageEditorUIView *) iEditorView)-> SetZoomModeL(iEditorManager->GetZoomMode()); |
|
2166 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2167 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2168 |
//============================================================================= |
8 | 2169 |
void CImageEditorAppUi::PanL(TDirection aDirection) |
2170 |
{ |
|
2171 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
|
2172 |
__ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); |
|
2173 |
||
2174 |
iEditorView->HandleCommandL(EImageEditorPreGlobalPanChange); |
|
2175 |
||
2176 |
SetBusy(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2177 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2178 |
// Pan |
8 | 2179 |
iEditorManager->PanL(aDirection); |
2180 |
||
2181 |
RenderL(); |
|
2182 |
iEditorManager->GetSystemParameters(); |
|
2183 |
||
2184 |
ResetBusy(); |
|
2185 |
||
2186 |
iEditorView->HandleCommandL(EImageEditorGlobalPanChanged); |
|
2187 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2188 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2189 |
//============================================================================= |
8 | 2190 |
void CImageEditorAppUi::TouchPanL() |
2191 |
{ |
|
2192 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
|
2193 |
__ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); |
|
2194 |
||
2195 |
iEditorView->HandleCommandL(EImageEditorPreGlobalPanChange); |
|
2196 |
||
2197 |
SetBusy(); |
|
2198 |
||
2199 |
// Fetch directions |
|
2200 |
TInt xMovement(0); |
|
2201 |
TInt yMovement(0); |
|
2202 |
||
2203 |
((CImageEditorUIView *) iEditorView)->GetTouchPanDirections(xMovement,yMovement); |
|
2204 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2205 |
// Pan |
8 | 2206 |
iEditorManager->PanL(xMovement, yMovement); |
2207 |
||
2208 |
RenderL(); |
|
2209 |
iEditorManager->GetSystemParameters(); |
|
2210 |
||
2211 |
ResetBusy(); |
|
2212 |
||
2213 |
iEditorView->HandleCommandL(EImageEditorGlobalPanChanged); |
|
2214 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2215 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2216 |
//============================================================================= |
8 | 2217 |
void CImageEditorAppUi::RotateL(const TRotation aRot) |
2218 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2219 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2220 |
__ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2221 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2222 |
if (!iEditorManager->IsPluginLoaded()) |
8 | 2223 |
{ |
2224 |
iEditorManager->RotateL(aRot); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2225 |
RenderL(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2226 |
SetUndoFlag(); |
8 | 2227 |
iEditorView->HandleCommandL(EImageEditorGlobalRotationChanged); |
2228 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2229 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2230 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2231 |
//============================================================================= |
8 | 2232 |
void CImageEditorAppUi::LaunchLoadWaitNoteL() |
2233 |
{ |
|
2234 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
|
2235 |
||
2236 |
SetBusy(); |
|
2237 |
((CImageEditorUIView *) iEditorView)->LaunchWaitDialog(); |
|
2238 |
||
2239 |
// if (!iWaitNote) |
|
2240 |
// { |
|
2241 |
// ((CImageEditorUIView *)iEditorView)->LaunchLoadWaitDialogL( &iWaitNote, this ); |
|
2242 |
// } |
|
2243 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2244 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2245 |
//============================================================================= |
8 | 2246 |
void CImageEditorAppUi::LaunchSaveWaitNoteL() |
2247 |
{ |
|
2248 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
|
2249 |
TAppUiOrientation orientation(EAppUiOrientationPortrait); |
|
2250 |
if (LandscapeScreenOrientation()) |
|
2251 |
{ |
|
2252 |
orientation = EAppUiOrientationLandscape; |
|
2253 |
} |
|
2254 |
||
2255 |
SetOrientationL(orientation); |
|
2256 |
if (!iProgressNote) |
|
2257 |
{ |
|
2258 |
((CImageEditorUIView *) iEditorView)->LaunchSaveWaitDialogL(&iProgressNote, 100, this); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2259 |
iSaving = ETrue; |
8 | 2260 |
} |
2261 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2262 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2263 |
//============================================================================= |
8 | 2264 |
void CImageEditorAppUi::KillWaitNote() |
2265 |
{ |
|
2266 |
||
2267 |
/* if (iWaitNote) |
|
2268 |
{ |
|
2269 |
// If the application is exiting, iWaitNote->ProcessFinishedL() |
|
2270 |
// apparently does not finish in time and does something after the |
|
2271 |
// application has been deleted, causing USER 0 panic on debug builds. |
|
2272 |
delete iWaitNote; |
|
2273 |
iWaitNote = NULL; |
|
2274 |
} */ |
|
2275 |
||
2276 |
if (iProgressNote) |
|
2277 |
{ |
|
2278 |
delete iProgressNote; |
|
2279 |
iProgressNote = NULL; |
|
2280 |
} |
|
2281 |
else |
|
2282 |
{ |
|
2283 |
// This can be hidden in all cases. If dialog is not active, nothing |
|
2284 |
// special happens |
|
2285 |
((CImageEditorUIView *) iEditorView)->HideWaitDialog(); |
|
2286 |
// Commented due to multiple ResetBusy() call during initialization: |
|
2287 |
//ResetBusy(); |
|
2288 |
} |
|
2289 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2290 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2291 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2292 |
void CImageEditorAppUi::IncrementProgressBarL(const TInt aIncrement) |
8 | 2293 |
{ |
2294 |
__ASSERT_ALWAYS( iProgressNote, User::Panic(KComponentName, EImageEditorPanicNoProgressDialog) ); |
|
2295 |
||
2296 |
CEikProgressInfo * progi = iProgressNote->GetProgressInfoL(); |
|
2297 |
if (progi) |
|
2298 |
{ |
|
2299 |
progi->IncrementAndDraw(aIncrement); |
|
2300 |
} |
|
2301 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2302 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2303 |
//============================================================================= |
8 | 2304 |
void CImageEditorAppUi::DialogDismissedL(TInt aButtonId) |
2305 |
{ |
|
2306 |
LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::DialogDismissedL( %d )", aButtonId); |
|
2307 |
||
2308 |
if (aButtonId == EAknSoftkeyCancel) |
|
2309 |
{ |
|
2310 |
if (!iSaving) |
|
2311 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2312 |
iCallback->Cancel(); |
8 | 2313 |
iImageController->CancelOperation(ETrue); |
2314 |
} |
|
2315 |
else |
|
2316 |
{ |
|
2317 |
iImageController->CancelOperation(); |
|
2318 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2319 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2320 |
iWaitNote = NULL; |
8 | 2321 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2322 |
ResetBusy(); |
8 | 2323 |
} |
2324 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2325 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2326 |
//============================================================================= |
8 | 2327 |
TErrorHandlerResponse CImageEditorAppUi::HandleError(TInt aError,const SExtendedError & aExtErr, TDes & aErrorText, TDes & aContextText) |
2328 |
{ |
|
2329 |
LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::HandleError: %d", aError); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2330 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2331 |
// Reset busy flag |
8 | 2332 |
KillWaitNote(); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2333 |
ResetBusy(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2334 |
iCancelling = EFalse; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2335 |
iSaving = EFalse; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2336 |
|
8 | 2337 |
TErrorHandlerResponse ret = ENoDisplay; |
2338 |
||
2339 |
// Handle Image Editor errors |
|
2340 |
if ((aError < KSIEEErrorBase) && (aError > KSIEEErrorMax)) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2341 |
{ |
8 | 2342 |
TRAPD ( err, HandleErrorL (aError) ); |
2343 |
if (err == KErrNoMemory) |
|
2344 |
{ |
|
2345 |
Exit(); |
|
2346 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2347 |
} |
8 | 2348 |
|
2349 |
// Let the framework handle system errors |
|
2350 |
else if (aError == KErrNoMemory) |
|
2351 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2352 |
iImageController->Cancel(); |
8 | 2353 |
ret = CAknViewAppUi::HandleError(aError, aExtErr, aErrorText,aContextText); |
2354 |
Exit(); |
|
2355 |
} |
|
2356 |
// KErrCancel is returned when Bluetooth send is cancelled |
|
2357 |
// No need to show error dialog |
|
2358 |
else if (aError == KErrCancel) |
|
2359 |
{ |
|
2360 |
// Nothing to do |
|
2361 |
} |
|
2362 |
else if ((aError == KErrArgument) || (aError == KErrInUse)) |
|
2363 |
{ |
|
2364 |
// Show error note |
|
2365 |
HandleErrorL(aError); |
|
2366 |
} |
|
2367 |
//end |
|
2368 |
else if ((aError <= KErrExtended) && (aError >= KLeaveExit)) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2369 |
{ |
8 | 2370 |
ret = CAknViewAppUi::HandleError(aError, aExtErr, aErrorText,aContextText); |
2371 |
// Close plugin if error occurs, otherwise plugin may crash |
|
2372 |
iEditorManager->ClosePlugin(); |
|
2373 |
||
2374 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
|
2375 |
TRAP_IGNORE( ((CImageEditorUIView *)iEditorView)->ActivateMainViewL() ); |
|
2376 |
||
2377 |
TRAP_IGNORE( ((CImageEditorUIView *)iEditorView)->SetImageL (iEditorManager->GetPreviewImage()) ); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2378 |
} |
8 | 2379 |
else |
2380 |
{ |
|
2381 |
ret = CAknViewAppUi::HandleError(aError, aExtErr, aErrorText, |
|
2382 |
aContextText); |
|
2383 |
// Close plugin if error occurs, otherwise plugin may crash |
|
2384 |
iEditorManager->ClosePlugin(); |
|
2385 |
||
2386 |
__ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); |
|
2387 |
TRAPD( err, ((CImageEditorUIView *)iEditorView)->ActivateMainViewL() ); |
|
2388 |
||
2389 |
TRAP_IGNORE( ((CImageEditorUIView *)iEditorView)->SetImageL ( |
|
2390 |
iEditorManager->GetPreviewImage()) ); |
|
2391 |
if (err == KErrNoMemory) |
|
2392 |
{ |
|
2393 |
Exit(); |
|
2394 |
} |
|
2395 |
} |
|
2396 |
return ret; |
|
2397 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2398 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2399 |
//============================================================================= |
8 | 2400 |
void CImageEditorAppUi::HandleErrorL(const TInt aError) |
2401 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2402 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2403 |
// Show error note |
8 | 2404 |
ShowErrorNoteL(aError); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2405 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2406 |
// Handle error |
8 | 2407 |
switch (aError) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2408 |
{ |
8 | 2409 |
case KSIEEErrorOkToExit: |
2410 |
case KSIEEOpenFile: |
|
2411 |
case KSIEEExifRead: |
|
2412 |
case KSIEEInternalNonRecoverable: |
|
2413 |
case KSIEEIncompatibleImage: |
|
2414 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2415 |
// For some weird reason, in some cases when trying to |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2416 |
// exit from CImageEditorAppUi::OperationReadyL, calling |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2417 |
// Exit() here won't exit the application. |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2418 |
RunAppShutter(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2419 |
break; |
8 | 2420 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2421 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2422 |
default: |
8 | 2423 |
{ |
2424 |
// Close plugin if error occurs, otherwise plugin may crash |
|
2425 |
if (iEditorManager) |
|
2426 |
{ |
|
2427 |
iEditorManager->ClosePlugin(); |
|
2428 |
||
2429 |
} |
|
2430 |
if (iEditorView) |
|
2431 |
{ |
|
2432 |
((CImageEditorUIView *) iEditorView)->ActivateMainViewL(); |
|
2433 |
((CImageEditorUIView *) iEditorView)->SetImageL(iEditorManager->GetPreviewImage()); |
|
2434 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2435 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2436 |
break; |
8 | 2437 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2438 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2439 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2440 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2441 |
//============================================================================= |
8 | 2442 |
void CImageEditorAppUi::ShowErrorNoteL(const TInt aError) const |
2443 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2444 |
TInt res_id = -1; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2445 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2446 |
switch (aError) |
8 | 2447 |
{ |
2448 |
case KErrNotFound: |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2449 |
case KSIEEOpenFile: |
8 | 2450 |
case KSIEEExifRead: |
2451 |
case KSIEEIncompatibleImage: |
|
2452 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2453 |
res_id = R_ERROR_LOADING; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2454 |
break; |
8 | 2455 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2456 |
case KSIEESaveFile: |
8 | 2457 |
case KSIEEExifUpdate: |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2458 |
case KErrArgument: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2459 |
case KErrInUse: |
8 | 2460 |
|
2461 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2462 |
res_id = R_ERROR_SAVING; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2463 |
break; |
8 | 2464 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2465 |
case KSIEENotEnoughDiskSpace: |
8 | 2466 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2467 |
res_id = R_ERROR_NOT_ENOUGH_DISK_SPACE; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2468 |
break; |
8 | 2469 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2470 |
case KSIEEProcessFile: |
8 | 2471 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2472 |
res_id = R_ERROR_PROCESSING; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2473 |
break; |
8 | 2474 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2475 |
case KSIEEEngine: |
8 | 2476 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2477 |
res_id = R_ERROR_ENGINE; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2478 |
break; |
8 | 2479 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2480 |
case KSIEEInternal: |
8 | 2481 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2482 |
res_id = R_ERROR_INTERNAL; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2483 |
break; |
8 | 2484 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2485 |
case KSIEEInternalNonRecoverable: |
8 | 2486 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2487 |
res_id = R_ERROR_INTERNAL_NON_RECOVERABLE; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2488 |
break; |
8 | 2489 |
} |
2490 |
case KSIEEProtectedFile: |
|
2491 |
{ |
|
2492 |
res_id = R_ERROR_PROTECTED_FILE; |
|
2493 |
break; |
|
2494 |
} |
|
2495 |
default: |
|
2496 |
break; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2497 |
} |
8 | 2498 |
|
2499 |
if (res_id != -1) |
|
2500 |
{ |
|
2501 |
HBufC * textdata = iEikonEnv->AllocReadResourceLC(res_id); |
|
2502 |
TPtrC ptr = textdata->Des(); |
|
2503 |
||
2504 |
LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::ShowErrorNoteL: \"%S\"", &ptr); |
|
2505 |
||
2506 |
CAknGlobalNote* globalNote = CAknGlobalNote::NewLC(); |
|
2507 |
TInt noteId = globalNote->ShowNoteL(EAknGlobalErrorNote, ptr); |
|
2508 |
||
2509 |
User::After(1500042); // waiting for 1 second |
|
2510 |
||
2511 |
// discard note |
|
2512 |
globalNote->CancelNoteL(noteId); |
|
2513 |
||
2514 |
CleanupStack::PopAndDestroy(); //textdata |
|
2515 |
CleanupStack::PopAndDestroy(); // GlobalNote |
|
2516 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2517 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2518 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2519 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2520 |
void CImageEditorAppUi::DeleteTempFiles() const |
8 | 2521 |
{ |
2522 |
// Get the used temp directory path. |
|
2523 |
// Take drive letter from iDocumentName |
|
2524 |
TParse parse; |
|
2525 |
parse.Set(KTempPath, &iDocumentName, NULL); |
|
2526 |
TPtrC tempDir = parse.DriveAndPath(); |
|
2527 |
||
2528 |
LOGFMT (KImageEditorLogFile, "CImageEditorAppUi::DeleteTempFiles(): %S", &tempDir); |
|
2529 |
// Delete all files in the temp directory |
|
2530 |
_LIT(KAllFiles, "*.*"); |
|
2531 |
TFindFile file_finder(iEikonEnv->FsSession()); |
|
2532 |
CDir* file_list; |
|
2533 |
TInt err = file_finder.FindWildByDir(KAllFiles, tempDir, file_list); |
|
2534 |
while (err == KErrNone) |
|
2535 |
{ |
|
2536 |
TInt i; |
|
2537 |
for (i = 0; i < file_list->Count(); i++) |
|
2538 |
{ |
|
2539 |
const TDesC& name = (*file_list)[i].iName; |
|
2540 |
const TDesC& related = file_finder.File(); |
|
2541 |
TParse fullentry; |
|
2542 |
fullentry.Set(name, &related, NULL); |
|
2543 |
BaflUtils::DeleteFile(iEikonEnv->FsSession(), fullentry.FullName()); |
|
2544 |
} |
|
2545 |
delete file_list; |
|
2546 |
err = file_finder.FindWild(file_list); |
|
2547 |
} |
|
2548 |
||
2549 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2550 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2551 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2552 |
void CImageEditorAppUi::FinalizeSaveL() |
8 | 2553 |
{ |
2554 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::FinalizeSaveL"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2555 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2556 |
#ifdef FILE_TIME_STAMP_UPDATE |
8 | 2557 |
// Set the timestamp of the saved file to original file's timestamp + 2 seconds. |
2558 |
// The idea is to make the original and edited images appear next to each other. |
|
2559 |
TEntry original; |
|
2560 |
TInt err = iEikonEnv->FsSession().Entry( iSourceFileName, original ); |
|
2561 |
if (KErrNone == err) |
|
2562 |
{ |
|
2563 |
TTime newTime = original.iModified + TTimeIntervalSeconds (2); |
|
2564 |
||
2565 |
CFileMan* fileMan = CFileMan::NewL( iEikonEnv->FsSession() ); |
|
2566 |
CleanupStack::PushL (fileMan); |
|
2567 |
fileMan->Attribs(iDocumentName, 0, 0, newTime); // do not set or clear anything, mofify time |
|
2568 |
CleanupStack::PopAndDestroy (fileMan); |
|
2569 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2570 |
#endif |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2571 |
|
8 | 2572 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Check if source image belongs to an album"); |
2573 |
||
2574 |
iSourceImageMgAlbumIdList.Reset(); |
|
2575 |
||
2576 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: publish the filename for provider"); |
|
2577 |
||
2578 |
// Publish & Subscribe API used for delivering document name to AIW provider |
|
2579 |
TInt err2 = RProperty::Define(KImageEditorProperties, EPropertyFilename, |
|
2580 |
RProperty::EText); |
|
2581 |
||
2582 |
if (err2 != KErrAlreadyExists) |
|
2583 |
{ |
|
2584 |
User::LeaveIfError(err2); |
|
2585 |
} |
|
2586 |
||
2587 |
User::LeaveIfError(RProperty::Set(KImageEditorProperties, |
|
2588 |
EPropertyFilename, iDocumentName)); |
|
2589 |
||
2590 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::FinalizeSaveL out"); |
|
2591 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2592 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2593 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2594 |
void CImageEditorAppUi::HandleVolumeUpL() |
8 | 2595 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2596 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleVolumeUpL: in"); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2597 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2598 |
TKeyEvent key; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2599 |
key.iScanCode = EStdKeyIncVolume; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2600 |
key.iCode = EKeyIncVolume; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2601 |
|
8 | 2602 |
if (LandscapeScreenOrientation()) |
2603 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2604 |
key.iScanCode = EStdKeyDecVolume; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2605 |
key.iCode = EKeyDecVolume; |
8 | 2606 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2607 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2608 |
key.iRepeats = 0; |
8 | 2609 |
iEikonEnv->SimulateKeyEventL(key, EEventKey); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2610 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2611 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleVolumeUpL: out"); |
8 | 2612 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2613 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2614 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2615 |
void CImageEditorAppUi::HandleVolumeDownL() |
8 | 2616 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2617 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleVolumeDownL: in"); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2618 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2619 |
TKeyEvent key; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2620 |
key.iScanCode = EStdKeyDecVolume; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2621 |
key.iCode = EKeyDecVolume; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2622 |
|
8 | 2623 |
if (LandscapeScreenOrientation()) |
2624 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2625 |
key.iScanCode = EStdKeyIncVolume; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2626 |
key.iCode = EKeyIncVolume; |
8 | 2627 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2628 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2629 |
key.iRepeats = 0; |
8 | 2630 |
iEikonEnv->SimulateKeyEventL(key, EEventKey); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2631 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2632 |
LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleVolumeDownL: out"); |
8 | 2633 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2634 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2635 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2636 |
void CImageEditorAppUi::SaveImageOverWriteL(TBool aOverWrite) |
8 | 2637 |
{ |
2638 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: SaveImageOverWriteL: in"); |
|
2639 |
||
2640 |
// Generate temporary save file name |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2641 |
TParse tempFileParser; |
8 | 2642 |
tempFileParser.Set(KTempSaveFile, &KTempPath, &iDocumentName); |
2643 |
iTempSaveFileName.Copy(tempFileParser.FullName()); |
|
2644 |
BaflUtils::EnsurePathExistsL(iEikonEnv->FsSession(), iTempSaveFileName); |
|
2645 |
||
2646 |
if (iExitFromApp) |
|
2647 |
{ |
|
2648 |
TInt |
|
2649 |
exit = ((CImageEditorUIView *) iEditorView)->LaunchExitWithoutSavingQueryL(); |
|
2650 |
if (exit) |
|
2651 |
{ |
|
2652 |
// Exit |
|
2653 |
User::Leave(KSIEEErrorOkToExit); |
|
2654 |
} |
|
2655 |
else |
|
2656 |
{ |
|
2657 |
iExitFromApp = EFalse; |
|
2658 |
User::Leave(KSIEEInternal); |
|
2659 |
} |
|
2660 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2661 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2662 |
// overwrite the existing file |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2663 |
if (aOverWrite) |
8 | 2664 |
{ |
2665 |
iDocumentName = iSourceFileName; |
|
2666 |
} |
|
2667 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2668 |
// save with a new file name |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2669 |
else |
8 | 2670 |
{ |
2671 |
// Check document name if not saved yet or memory card removed |
|
2672 |
if (!iImageSaved || !BaflUtils::PathExists(iEikonEnv->FsSession(), |
|
2673 |
iTempSaveFileName.Left(3))) |
|
2674 |
{ |
|
2675 |
// If not saved yet, check that document name is valid |
|
2676 |
CheckFileL(iDocumentName); |
|
2677 |
} |
|
2678 |
} |
|
2679 |
||
2680 |
// Set temp save image name to engine |
|
2681 |
iEditorManager->SetImageName(iTempSaveFileName); |
|
2682 |
||
2683 |
// Launch save wait note |
|
2684 |
LaunchSaveWaitNoteL(); |
|
2685 |
||
2686 |
iCallback->DoCallback(KObSaveCallbackID); |
|
2687 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: SaveImageOverWriteL: out"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2688 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2689 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2690 |
//============================================================================= |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2691 |
TInt CImageEditorAppUi::QueryAndSaveL() |
8 | 2692 |
{ |
2693 |
||
2694 |
TInt isSaved = 0; |
|
2695 |
TInt userSelection = 0; |
|
2696 |
TBool isFileOpen = EFalse; |
|
2697 |
RFs& fs = iEikonEnv->FsSession(); |
|
2698 |
TInt err = fs.IsFileOpen(iSourceFileName, isFileOpen); |
|
2699 |
||
2700 |
// Check if .jpg or .jpeg file |
|
2701 |
TBool isJpgExtension = EFalse; |
|
2702 |
TParsePtrC fileParse(iSourceFileName); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2703 |
_LIT( KJpgExtension, ".jpg" ); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2704 |
_LIT( KJpegExtension, ".jpeg" ); |
8 | 2705 |
TPtrC extension(fileParse.Ext()); |
2706 |
if ((extension.MatchF(KJpgExtension) == KErrNone) || (extension.MatchF( |
|
2707 |
KJpegExtension) == KErrNone)) |
|
2708 |
{ |
|
2709 |
isJpgExtension = ETrue; |
|
2710 |
} |
|
2711 |
||
2712 |
// If source file is open (e.g. in ImageViewer application) don't give |
|
2713 |
// user an option to replace original but launch directly "Save with a |
|
2714 |
// new name query. Don't give other that jpg originals. |
|
2715 |
if (!isFileOpen && isJpgExtension) |
|
2716 |
{ |
|
2717 |
// the user selects to save with a new file name |
|
2718 |
// launch query with choices "Replace original" and |
|
2719 |
// "Save with a new file name" |
|
2720 |
userSelection = ((CImageEditorUIView *) iEditorView)->LaunchSaveImageQueryL(); |
|
2721 |
} |
|
2722 |
SetOrientationL(Orientation()); |
|
2723 |
SetLayoutAwareApp(EFalse); |
|
2724 |
// If user has selected "Save with a new file name" |
|
2725 |
if (userSelection == 0) |
|
2726 |
{ |
|
2727 |
||
2728 |
// Multiple drive support enabled |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2729 |
#ifdef RD_MULTIPLE_DRIVE |
8 | 2730 |
|
2731 |
TDriveNumber driveNumber; |
|
2732 |
TFileName driveAndPath; |
|
2733 |
// new multi drive dialog |
|
2734 |
CAknMemorySelectionDialogMultiDrive* multiDriveDlg = CAknMemorySelectionDialogMultiDrive::NewL(ECFDDialogTypeSave, |
|
2735 |
EFalse); |
|
2736 |
CleanupStack::PushL(multiDriveDlg); |
|
2737 |
||
2738 |
// launch "Select memory" query (mds) |
|
2739 |
if (multiDriveDlg->ExecuteL(driveNumber, &driveAndPath, NULL )) |
|
2740 |
{ |
|
2741 |
// Generate a default name for the new file |
|
2742 |
TInt err = ImageEditorUtils::GenerateNewFileNameL( |
|
2743 |
iEikonEnv->FsSession(), iSourceFileName, iDocumentName, |
|
2744 |
driveAndPath, NULL ); |
|
2745 |
||
2746 |
driveAndPath.Append(PathInfo::ImagesPath()); |
|
2747 |
||
2748 |
//Save as the original file format. |
|
2749 |
iDocumentName.Delete(iDocumentName.Length() - 5, 4); |
|
2750 |
iDocumentName.Append(fileParse.Ext()); |
|
2751 |
||
2752 |
// launch file name prompt dialog |
|
2753 |
// the generated name is shown as a default name in dialog |
|
2754 |
||
2755 |
TBuf<160> tmp(iDocumentName.Left(160)); |
|
2756 |
iSavingQuery = ETrue; |
|
2757 |
if (CAknFileNamePromptDialog::RunDlgLD(tmp, /* iDocumentName, */ |
|
2758 |
driveAndPath, KNullDesC)) |
|
2759 |
{ |
|
2760 |
iDocumentName.Copy(tmp); |
|
2761 |
iSavingQuery = EFalse; |
|
2762 |
// add just queried filename to the path |
|
2763 |
driveAndPath.Append(iDocumentName); |
|
2764 |
||
2765 |
iDocumentName = driveAndPath; |
|
2766 |
||
2767 |
SaveImageOverWriteL(EFalse); |
|
2768 |
isSaved = 1; |
|
2769 |
} |
|
2770 |
iSavingQuery = EFalse; |
|
2771 |
} |
|
2772 |
CleanupStack::PopAndDestroy(multiDriveDlg); |
|
2773 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2774 |
#else // No multiple drive support |
8 | 2775 |
CAknMemorySelectionDialog::TMemory selectedMemory( |
2776 |
CAknMemorySelectionDialog::EPhoneMemory ); |
|
2777 |
||
2778 |
// launch "Select memory" query |
|
2779 |
if ( CAknMemorySelectionDialog::RunDlgLD( selectedMemory ) ) |
|
2780 |
{ |
|
2781 |
// create path for the image |
|
2782 |
TFileName driveAndPath; |
|
2783 |
ImageEditorUtils::TMemorySelection memorySelection = |
|
2784 |
ImageEditorUtils::ESelectPhone; |
|
2785 |
if( selectedMemory == CAknMemorySelectionDialog::EPhoneMemory ) |
|
2786 |
{ |
|
2787 |
memorySelection = ImageEditorUtils::ESelectPhone; |
|
2788 |
driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() ); |
|
2789 |
driveAndPath.Append( PathInfo::ImagesPath() ); |
|
2790 |
} |
|
2791 |
else if ( selectedMemory == |
|
2792 |
CAknMemorySelectionDialog::EMemoryCard ) |
|
2793 |
{ |
|
2794 |
memorySelection = ImageEditorUtils::ESelectMmc; |
|
2795 |
driveAndPath.Copy( PathInfo::MemoryCardRootPath() ); |
|
2796 |
driveAndPath.Append( PathInfo::ImagesPath() ); |
|
2797 |
} |
|
2798 |
||
2799 |
TInt err = ImageEditorUtils::GenerateNewDocumentNameL( |
|
2800 |
iEikonEnv->FsSession(), |
|
2801 |
iSourceFileName, |
|
2802 |
iDocumentName, |
|
2803 |
&iSourceImageMgAlbumIdList, |
|
2804 |
NULL, |
|
2805 |
memorySelection ); |
|
2806 |
||
2807 |
// launch file name prompt dialog |
|
2808 |
// the generated name is shown as a default name |
|
2809 |
iSavingQuery = ETrue; |
|
2810 |
if ( CAknFileNamePromptDialog::RunDlgLD( iDocumentName, |
|
2811 |
driveAndPath, |
|
2812 |
KNullDesC ) ) |
|
2813 |
{ |
|
2814 |
iSavingQuery = EFalse; |
|
2815 |
TInt err = ImageEditorUtils::GenerateFilePathL( |
|
2816 |
iEikonEnv->FsSession(), |
|
2817 |
iSourceFileName, |
|
2818 |
iDocumentName, |
|
2819 |
memorySelection |
|
2820 |
); |
|
2821 |
||
2822 |
SaveImageOverWriteL( EFalse ); |
|
2823 |
isSaved = 1; |
|
2824 |
} |
|
2825 |
iSavingQuery = EFalse; |
|
2826 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2827 |
#endif |
8 | 2828 |
} |
2829 |
// the user selects to overwrite the original image |
|
2830 |
else if (userSelection == 1) |
|
2831 |
{ |
|
2832 |
SaveImageOverWriteL(ETrue); |
|
2833 |
isSaved = 1; |
|
2834 |
} |
|
2835 |
return isSaved; |
|
2836 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2837 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2838 |
// ---------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2839 |
// CImageEditorAppUi::HandleVolumeKeyEvent |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2840 |
// ---------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2841 |
// |
8 | 2842 |
void CImageEditorAppUi::HandleVolumeKeyEvent( |
2843 |
TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction /* aButtonAct */) |
|
2844 |
{ |
|
2845 |
if (((CImageEditorUIView *) iEditorView)->GetContainer()) |
|
2846 |
{ |
|
2847 |
if (!((CImageEditorUIView *) iEditorView)->GetContainer()->IsFocused()) |
|
2848 |
{ |
|
2849 |
return; |
|
2850 |
} |
|
2851 |
} |
|
2852 |
||
2853 |
if (iForeground) |
|
2854 |
{ |
|
2855 |
TKeyEvent keyEvent; |
|
2856 |
if (aOperationId == ERemConCoreApiVolumeUp) |
|
2857 |
{ |
|
2858 |
keyEvent.iScanCode = EStdKeyIncVolume; |
|
2859 |
TRAP_IGNORE( HandleKeyEventL( keyEvent, EEventKey ) ); |
|
2860 |
} |
|
2861 |
else if (aOperationId == ERemConCoreApiVolumeDown) |
|
2862 |
{ |
|
2863 |
keyEvent.iScanCode = EStdKeyDecVolume; |
|
2864 |
TRAP_IGNORE( HandleKeyEventL( keyEvent, EEventKey ) ); |
|
2865 |
} |
|
2866 |
} |
|
2867 |
} |
|
2868 |
||
2869 |
void CImageEditorAppUi::InitialHorizontalDrawPlugin() |
|
2870 |
{ |
|
2871 |
// // Get pointer to the view |
|
2872 |
CImageEditorUIView * view = (CImageEditorUIView *) iEditorView; |
|
2873 |
||
2874 |
TRect rect; |
|
2875 |
iResolutionUtil->GetClientRect(rect); |
|
2876 |
SetFullScreenL(); |
|
2877 |
// Create a plug-in control |
|
2878 |
// Ownership is moved to the plug-in |
|
2879 |
CCoeControl * control = NULL; |
|
2880 |
TInt err = iEditorManager->CreatePluginControlL(rect, view->GetContainer(), |
|
2881 |
control); |
|
2882 |
||
2883 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin control created"); |
|
2884 |
||
2885 |
// The plug-in activation was cancelled |
|
2886 |
if (err != KErrNone) |
|
2887 |
{ |
|
2888 |
// Cancel plug-in |
|
2889 |
iCancelling = ETrue; |
|
2890 |
iCallback->DoCallback(KObCancelCallbackID); |
|
2891 |
} |
|
2892 |
||
2893 |
// Activate plug-in |
|
2894 |
else |
|
2895 |
{ |
|
2896 |
// Register control to UI |
|
2897 |
view->ActivatePluginL(control); |
|
2898 |
||
2899 |
LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin activated"); |
|
2900 |
||
2901 |
// If the filter did not have a control, close plug-in |
|
2902 |
if (!control) |
|
2903 |
{ |
|
2904 |
iEditorManager->ClosePlugin(); |
|
2905 |
||
2906 |
} |
|
2907 |
||
2908 |
// Set the last opened image to editor view |
|
2909 |
((CImageEditorUIView *) iEditorView)->SetImageL(iEditorManager->GetPreviewImage()); |
|
2910 |
||
2911 |
ResetBusy(); |
|
2912 |
} |
|
2913 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2914 |
// End of File |