|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: AIW print preview command handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "glxcommandhandleraiwprintpreview.h" |
|
22 #include "glxaiwservicehandler.h" |
|
23 |
|
24 #include <glxattributecontext.h> |
|
25 #include <glxcommandhandlers.hrh> |
|
26 #include <glxmedia.h> |
|
27 #include <glxuiutilities.rsg> |
|
28 #include <mglxmedialist.h> |
|
29 #include <StringLoader.h> |
|
30 #include <glxnavigationalstate.h> |
|
31 #include <mpxcollectionpath.h> |
|
32 #include <glxcollectionpluginimageviewer.hrh> |
|
33 |
|
34 const TInt KGlxAiwPrintPreviewCommandSpace = 0x00000300; |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // NewL |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 EXPORT_C CGlxCommandHandlerAiwPrintPreview* |
|
41 CGlxCommandHandlerAiwPrintPreview::NewL( |
|
42 MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) |
|
43 { |
|
44 CGlxCommandHandlerAiwPrintPreview* self = new ( ELeave ) |
|
45 CGlxCommandHandlerAiwPrintPreview(aMediaListProvider, aMenuResource); |
|
46 CleanupStack::PushL( self ); |
|
47 self->ConstructL(); |
|
48 CleanupStack::Pop( self ); |
|
49 return self; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CGlxCommandHandlerAiwPrintPreview::DoGetRequiredAttributesL |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 void CGlxCommandHandlerAiwPrintPreview::DoGetRequiredAttributesL |
|
57 (RArray<TMPXAttribute>& aAttributes, TBool aFilterUsingSelection) const |
|
58 { |
|
59 if (!aFilterUsingSelection || SelectionLength() <= MaxSelectedItems()) |
|
60 { |
|
61 // Add MIME type and fileaname attributes |
|
62 aAttributes.AppendL(KMPXMediaGeneralMimeType); |
|
63 aAttributes.AppendL(KMPXMediaGeneralUri); |
|
64 } |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // Constructor |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CGlxCommandHandlerAiwPrintPreview::CGlxCommandHandlerAiwPrintPreview( |
|
72 MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) |
|
73 : CGlxCommandHandlerAiwBase(aMediaListProvider, aMenuResource) |
|
74 { |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CommandId |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 TInt CGlxCommandHandlerAiwPrintPreview::CommandId() const |
|
82 { |
|
83 return EGlxCmdAiwPrint; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // AiwCommandId |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 TInt CGlxCommandHandlerAiwPrintPreview::AiwCommandId() const |
|
91 { |
|
92 return KAiwCmdPrint; |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // AiwInterestResource |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 TInt CGlxCommandHandlerAiwPrintPreview::AiwInterestResource() const |
|
100 { |
|
101 return R_GLX_AIW_PRINT_INTEREST; |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // AppendAiwParameterL |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 TBool CGlxCommandHandlerAiwPrintPreview::AppendAiwParameterL(const TGlxMedia& aItem, |
|
109 CGlxAiwServiceHandler& aAiwServiceHandler) |
|
110 { |
|
111 return AppendDefaultAiwParameterL( aItem, |
|
112 aAiwServiceHandler, |
|
113 ETrue, // Add the Uri |
|
114 ETrue); // Add the MineType |
|
115 } |
|
116 |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CommandSpace |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 TInt CGlxCommandHandlerAiwPrintPreview::CommandSpace() const |
|
123 { |
|
124 return KGlxAiwPrintPreviewCommandSpace; |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // AiwDoDynInitMenuPaneL for PrintPreview |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void CGlxCommandHandlerAiwPrintPreview::PreDynInitMenuPaneL(TInt aResourceId) |
|
132 { |
|
133 CGlxCommandHandlerAiwBase::PreDynInitMenuPaneL(aResourceId); |
|
134 } |
|
135 // ----------------------------------------------------------------------------- |
|
136 // AiwDoDynInitMenuPaneL |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 void CGlxCommandHandlerAiwPrintPreview::AiwDoDynInitMenuPaneL(TInt aResourceId, |
|
140 CEikMenuPane* aMenuPane) |
|
141 { |
|
142 TBool fullscreenViewingMode = EFalse; |
|
143 CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL(); |
|
144 CMPXCollectionPath* naviState = aNavigationalState->StateLC(); |
|
145 |
|
146 if ( naviState->Levels() >= 1) |
|
147 { |
|
148 if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) |
|
149 { |
|
150 if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) |
|
151 { |
|
152 fullscreenViewingMode = ETrue; |
|
153 } |
|
154 else |
|
155 { |
|
156 fullscreenViewingMode = EFalse; |
|
157 } |
|
158 } |
|
159 else |
|
160 { |
|
161 fullscreenViewingMode = ETrue; |
|
162 } |
|
163 } |
|
164 CleanupStack::PopAndDestroy( naviState ); |
|
165 aNavigationalState->Close(); |
|
166 |
|
167 HBufC* currentTitle = StringLoader::LoadLC( R_QTN_LGAL_OPTIONS_PRINT_MENU ); |
|
168 TInt cmdId = AiwMenuCmdIdL( *currentTitle,aMenuPane ) ; |
|
169 CleanupStack::PopAndDestroy(currentTitle); |
|
170 if( KErrNotFound != cmdId ) |
|
171 { |
|
172 if ((MediaList().SelectionCount() == 0) && !fullscreenViewingMode) |
|
173 { |
|
174 aMenuPane->SetItemDimmed(cmdId,ETrue); |
|
175 } |
|
176 } |
|
177 } |
|
178 |
|
179 |