35
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2006 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: Client interface to ask for setting the default application
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef C_DEFAULTAPPCLIENT_H
|
|
21 |
#define C_DEFAULTAPPCLIENT_H
|
|
22 |
|
|
23 |
#include <e32def.h>
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <AknServerApp.h>
|
|
26 |
|
|
27 |
class RDefaultAppService;
|
|
28 |
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Client API for setting the default application.
|
|
32 |
*
|
|
33 |
* This class defines the API that applications should use to trigger the launch of the
|
|
34 |
* Default Application Server, that asks the user to select default applications for those
|
|
35 |
* Service & MIME pairs for which the client application is a candidate.
|
|
36 |
*
|
|
37 |
* A client application should first instantiate the service, using eithe NewL() or NewLC()
|
|
38 |
* The client application can check first if the sercive is available in the system (by using
|
|
39 |
* the ServiceAvailable() function. The client application may also check if there is
|
|
40 |
* anything to display (if there is any Service & MIME that the client application supports for
|
|
41 |
* which there is at least another application supporting the pair). If there is no such pair,
|
|
42 |
* then launching the server would display an empty list). This checking is performed using the
|
|
43 |
* PairsToDisplayL() function.
|
|
44 |
*
|
|
45 |
* After the above checkings are done, the client application can ask the server to change
|
|
46 |
* defaults by calling the ChangeDefaultsL() function.
|
|
47 |
*
|
|
48 |
*
|
|
49 |
* @lib defaultappclient.dll
|
|
50 |
* @since S60 v5.0
|
|
51 |
*/
|
|
52 |
class CDefaultAppClient : public CBase
|
|
53 |
{
|
|
54 |
|
|
55 |
public:
|
|
56 |
|
|
57 |
/** flags used to modify the service behaviour */
|
|
58 |
enum TFlags
|
|
59 |
{
|
|
60 |
EFlagNoObserver=1,
|
|
61 |
EFlagReserved1=2,
|
|
62 |
EFlagReserved2=4
|
|
63 |
};
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Symbian OS two-phased constructor
|
|
67 |
* @return
|
|
68 |
*/
|
|
69 |
IMPORT_C static CDefaultAppClient* NewL(MAknServerAppExitObserver* aObserver);
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Symbian OS two-phased constructor
|
|
73 |
* @return
|
|
74 |
*/
|
|
75 |
IMPORT_C static CDefaultAppClient* NewLC(MAknServerAppExitObserver* aObserver);
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Destructor.
|
|
79 |
*/
|
|
80 |
IMPORT_C virtual ~CDefaultAppClient();
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Function to check if a server is present in the system. If the
|
|
84 |
* server is present, the subsequent functions should not fail due
|
|
85 |
* to server unavailability.
|
|
86 |
*
|
|
87 |
* @since S60 v5.0
|
|
88 |
* @return ETrue or EFalse, depending service/server availability
|
|
89 |
*/
|
|
90 |
IMPORT_C static TBool ServiceAvailable( TInt& aErrorCode );
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Function to check the number of Service & MIME pairs the server would display if the
|
|
94 |
* ChangeDefaultsL() would be called. The purpose of this function
|
|
95 |
* is to allow the client application not to display an entry for starting the server, in the
|
|
96 |
* Options menu, in case the Server's list of Service & MIME pairs is empty.
|
|
97 |
*
|
|
98 |
* Please note that the function may return a higher number than the actual number
|
|
99 |
* of pairs, because it does not check for MIMEs with System priority (that would not be
|
|
100 |
* displayed).
|
|
101 |
*
|
|
102 |
* @since S60 v5.0
|
|
103 |
* @return the number of Service & MIME pairs the server would display
|
|
104 |
*/
|
|
105 |
IMPORT_C TInt PairsToDisplayL();
|
|
106 |
|
|
107 |
/**
|
|
108 |
* This function launches the server, as a chained application. The client application will not be
|
|
109 |
* available to the user until the server does not exit.
|
|
110 |
* When the server exits, the client application gains control again. The observer (if specified
|
|
111 |
* during instantiation (NewL) is notified that the server has exited.
|
|
112 |
*
|
|
113 |
* @since S60 v5.0
|
|
114 |
* @param aFlags service flags
|
|
115 |
*/
|
|
116 |
IMPORT_C void ChangeDefaultsL( TInt aFlags = 0 );
|
|
117 |
|
|
118 |
|
|
119 |
private:
|
|
120 |
|
|
121 |
/**
|
|
122 |
* C++ default constructor.
|
|
123 |
*/
|
|
124 |
CDefaultAppClient();
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Symbian constructor.
|
|
128 |
*/
|
|
129 |
void ConstructL( MAknServerAppExitObserver* aObserver );
|
|
130 |
|
|
131 |
/**
|
|
132 |
* This function finds out the uid of the Default Application Server
|
|
133 |
* (the application registered to handle the DefaultApp service)
|
|
134 |
*
|
|
135 |
* @since S60 v5.0
|
|
136 |
* @param aServerAppUid If parameter is non-NULL, it returns the Uid of the server there
|
|
137 |
*/
|
|
138 |
static void GetServiceParamsL( TUid* aServerAppUid);
|
|
139 |
|
|
140 |
private: // data
|
|
141 |
|
|
142 |
/**
|
|
143 |
* The UID of the server application (we discover the server)
|
|
144 |
*/
|
|
145 |
TUid iServerAppUid;
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Pointer to the service class.
|
|
149 |
* Own.
|
|
150 |
*/
|
|
151 |
RDefaultAppService *iService;
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Pointer to the Observer to call after the operation initiated by
|
|
155 |
* ChangeDefaultsAsyncL() has finished.
|
|
156 |
* Not Owned.
|
|
157 |
*/
|
|
158 |
MAknServerAppExitObserver* iObserver;
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Monitor object that calls the iObserver when the server has exited.
|
|
162 |
* Owned.
|
|
163 |
*/
|
|
164 |
CApaServerAppExitMonitor* iMonitor;
|
|
165 |
|
|
166 |
};
|
|
167 |
|
|
168 |
#endif // C_DEFAULTAPPCLIENT_H
|