|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Declarations for Notepad Viewer Application UI class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NOTEPADVIEWERAPPUI_H |
|
20 #define NOTEPADVIEWERAPPUI_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <aknappui.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CNotepadViewerDialog; |
|
27 class CNotepadApi; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 /** |
|
31 * Notepad Viewer application UI class. |
|
32 * |
|
33 */ |
|
34 class CNotepadViewerAppUi : public CAknAppUi |
|
35 { |
|
36 public: // Constructors and destructor |
|
37 |
|
38 /** |
|
39 * Second phase onstructor. |
|
40 */ |
|
41 void ConstructL(); |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 */ |
|
46 virtual ~CNotepadViewerAppUi(); |
|
47 |
|
48 private: // Functions from base classes |
|
49 |
|
50 /** |
|
51 * From CEikAppUi. |
|
52 * Takes care of command handling. |
|
53 * |
|
54 * @param aCommand command to be handled |
|
55 */ |
|
56 void HandleCommandL(TInt aCommand); |
|
57 |
|
58 /** |
|
59 * From CEikAppUi. |
|
60 * Command line processing. |
|
61 * |
|
62 * When DocumentHandler wants to launch NpdViewer as a standalone |
|
63 * application, it use RApaLsSession::StartDocument(filename, ...). |
|
64 * |
|
65 * CEikonEnv::ConstructAppFromCommandLineL(...), at first, pass |
|
66 * the filename information to ProcessCommandParametersL |
|
67 * correctly. But default CEikAppUi::ProcessCommandParametersL |
|
68 * overwrite it's reference parameter (TFileName& aDocumentName) to |
|
69 * application's defualt document name such as "NpdViewer.ini". |
|
70 * (In EikAppUi.cpp, |
|
71 * Application()->GetDefaultDocumentFileName(aDocumentName); |
|
72 * do this). |
|
73 * So, when CEikonEnv::ConstructAppFromCommandLineL(...) calls |
|
74 * CApaDocument::OpenFileL(...), the filename information from |
|
75 * Document Handler had been lost. |
|
76 * |
|
77 * On the other hand, when DocumentHandler wants to launch NpdViewer |
|
78 * as a embeded application, it use CApaDocument::OpenFileL() directly |
|
79 * and never call ProcessCommandParametersL. |
|
80 * |
|
81 * So, in order to pass a correct filename information to OpenFileL |
|
82 * in both case, we decide to override this function. |
|
83 * |
|
84 * @param aCommand command. (ignored) |
|
85 * @param aDocumentName Filename. |
|
86 * @param aTail optional command line parampeter. (ignored) |
|
87 * @return ETrue if aDocumentName file exists. |
|
88 */ |
|
89 TBool ProcessCommandParametersL( |
|
90 TApaCommand aCommand, |
|
91 TFileName& aDocumentName, |
|
92 const TDesC8& aTail); |
|
93 |
|
94 /** |
|
95 * From CEikAppUi. |
|
96 * Start fileviewer with specified filename. |
|
97 * Both standalone and embeded case, this function is really called |
|
98 * |
|
99 * @param aFilename Filename to view. |
|
100 */ |
|
101 void OpenFileL(const TDesC& aFilename); |
|
102 |
|
103 public: |
|
104 |
|
105 /** |
|
106 * Start fileviewer with specified file handle. |
|
107 * Both standalone and embeded case, this function is really called |
|
108 * |
|
109 * @param aFile File handle. |
|
110 */ |
|
111 void OpenFileL(RFile& aFile); |
|
112 |
|
113 private: // Data |
|
114 |
|
115 CNotepadApi* iApi; // own |
|
116 TBool iCurrentFileOpened; // To avoid reopening of same file. |
|
117 |
|
118 }; |
|
119 |
|
120 #endif // NOTEPADVIEWERAPPUI_H |
|
121 |
|
122 // End of File |