1 /* |
|
2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSETTINGSMANAGER_H |
|
20 #define CSETTINGSMANAGER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 |
|
25 #include "mprintsettings.h" |
|
26 |
|
27 class CImagePrint; |
|
28 class CRealFactory; |
|
29 class CRepository; |
|
30 |
|
31 /** |
|
32 * |
|
33 * Settings manager handles and modifies the capabilities |
|
34 * |
|
35 */ |
|
36 class CSettingsManager |
|
37 : public CBase, |
|
38 public MPrintSettings |
|
39 { |
|
40 public: // Construction and destruction |
|
41 |
|
42 /** |
|
43 * Two-phase constructor |
|
44 * |
|
45 * @param aFactory Pointer to factory |
|
46 * @return Initialized instance of the class |
|
47 */ |
|
48 static CSettingsManager* NewL( |
|
49 CRealFactory* aFactory ); |
|
50 static CSettingsManager* NewLC( |
|
51 CRealFactory* aFactory ); |
|
52 |
|
53 /** |
|
54 * Destructor |
|
55 */ |
|
56 ~CSettingsManager(); |
|
57 |
|
58 private: // Construction and destruction |
|
59 |
|
60 /** |
|
61 * Constructor |
|
62 * |
|
63 * @param aFactory Pointer to factory |
|
64 */ |
|
65 CSettingsManager( CRealFactory* aFactory ); |
|
66 |
|
67 /** |
|
68 * 2nd phase constructor |
|
69 */ |
|
70 void ConstructL(); |
|
71 |
|
72 public: // Methods derived from MPrintSettings |
|
73 |
|
74 CTemplateSettings* TemplateSettingsL(); |
|
75 void SetActiveTemplateL( TUint aUid ); |
|
76 TUint NumOfPagesL(); |
|
77 TInt NumberOfCopies( RArray<TInt>& aArray ); |
|
78 TInt NumberOfCopies( TInt& aNumberOfCopies, TInt aIndex ); |
|
79 TInt SetNumberOfCopiesL( const RArray<TInt>& aArray ); |
|
80 TInt UpdateNumberOfCopiesToServer(); |
|
81 TBool IsMMC(); |
|
82 void SetActivePageL( TUint aActivePage ); |
|
83 TUint CurActivePageL(); |
|
84 CPrintSettings* PrinterSettingsL(); |
|
85 void SetPrinterSettingsL( CPrintSettings& aSettings ); |
|
86 TInt SetPrinterSettingL( CBaseCapability& aCapab ); |
|
87 TInt TemplateUid(); |
|
88 TBool UpdatePageNumberL( TInt aCurrentImage ); |
|
89 TInt PrinterUid(); |
|
90 void SetUsbState( TBool aConnected ); |
|
91 TBool GetUsbState(); |
|
92 TInt GetDefaultPrinterProtocol(); |
|
93 TInt SetDefaultPrinterProtocol( TInt aProtocol ); |
|
94 TInt GetCurrentPrinterProtocol(); |
|
95 void SetCurrentPrinterProtocol( TInt aProtocol ); |
|
96 TUint GetCurrentPrinterVendor(); |
|
97 void SetCurrentPrinterVendor( TUint aVendor ); |
|
98 TInt GetDefaultPrintID(); |
|
99 TInt SetDefaultPrinterID( TInt aId ); |
|
100 HBufC* GetDefaultPrinterNameLC(); |
|
101 TInt SetDefaultPrinterNameL( const TDesC& aPrinterName ); |
|
102 HBufC* GetCurrentPrinterName(); |
|
103 TInt SetCurrentPrinterName( const TDesC& aPrinterName ); |
|
104 HBufC* GetCurrentPaperSizeTextL(); |
|
105 |
|
106 public: // New methods |
|
107 |
|
108 /** |
|
109 * Initializes settings after successfully creating a print job |
|
110 * |
|
111 * @param aPrinterUid Printer UID for the capability fetching |
|
112 * @param aMMCUid MMC printer UID if available |
|
113 */ |
|
114 void InitSettingsL( TInt aPrinterUid, TInt aMMCUid ); |
|
115 |
|
116 /** |
|
117 * Fetches the correct capability, leaves if cannot find the capapbility |
|
118 * |
|
119 * @param aUid Uid of the fetched capability |
|
120 * @return The capability |
|
121 */ |
|
122 CBaseCapability* FetchCapabilityL( TInt aUid ); |
|
123 |
|
124 private: // New methods |
|
125 |
|
126 /** |
|
127 * Initializes capabilities |
|
128 * |
|
129 * @param aPrinterUid Printer UID for the capability fetching |
|
130 */ |
|
131 void InitCapabilitiesL( TInt aPrinterUid ); |
|
132 |
|
133 /** |
|
134 * Initializes template settings |
|
135 */ |
|
136 void InitTemplateSettingsL(); |
|
137 |
|
138 private: // Data |
|
139 |
|
140 // Pointer to factory and Image Print Server |
|
141 CRealFactory* iFactory; |
|
142 |
|
143 // Printer and template settings |
|
144 CTemplateSettings* iTemplateSettings; |
|
145 CPrintSettings* iPrintSettings; |
|
146 |
|
147 // Active printer Uid from from Print Server |
|
148 TInt iPrinterUid; |
|
149 |
|
150 // Current active page |
|
151 TUint iActivePage; |
|
152 |
|
153 // MMC Uid |
|
154 TInt iMMCUid; |
|
155 |
|
156 // Images on page is dependent on the current template |
|
157 TInt iImagesOnPage; |
|
158 |
|
159 // USB connection state |
|
160 TBool iUsbConnected; |
|
161 |
|
162 // A Central Repository session |
|
163 CRepository* iCRSession; |
|
164 |
|
165 // printer brand |
|
166 TUint iVendor; |
|
167 |
|
168 // Current printer protocol |
|
169 TInt iCurrentPrinterProtocol; |
|
170 |
|
171 // Current printet name |
|
172 HBufC* iCurrentPrinterName; |
|
173 |
|
174 // Number of copies array |
|
175 RArray<TInt> iNumberOfCopiesArray; |
|
176 RArray<TInt> iNumberOfCopiesCumulativeArray; |
|
177 |
|
178 }; |
|
179 |
|
180 #endif // CSETTINGSMANAGER_H |
|
181 |
|
182 // End of File |
|