1 /* |
|
2 * Copyright (c) 2006-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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "irapplication.h" |
|
20 #include "irdebug.h" |
|
21 #include "irdocument.h" |
|
22 #include "irdebug.h" |
|
23 |
|
24 #include <eikenv.h> |
|
25 #include <apgwgnam.h> |
|
26 // UID for the application, this should correspond to the uid defined in the mmp file |
|
27 // voilate PC Lint 569 -Loss of information (initialization) |
|
28 // (32 bits to 31 bits) |
|
29 static const TUid KUidIR = {0x2000B499}; |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // Function: CreateDocumentL() |
|
33 // returns an instance of CIRDocument |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 CApaDocument* CIRApplication::CreateDocumentL() |
|
37 { |
|
38 IRLOG_INFO( "CIRApplication::CreateDocumentL" ); |
|
39 return CIRDocument::NewL(*this); |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // Function: AppDllUid() |
|
44 // Return the UID for the IR application |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 TUid CIRApplication::AppDllUid() const |
|
48 { |
|
49 IRLOG_INFO( "CIRApplication::AppDllUid" ); |
|
50 return KUidIR; |
|
51 } |
|
52 // --------------------------------------------------------------------------- |
|
53 // Function: PreDocConstructL() |
|
54 // Return the UID for the IR application |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 void CIRApplication::PreDocConstructL() |
|
58 { |
|
59 // Check that this app is started as stand-alone |
|
60 RWsSession& ws = static_cast<CEikonEnv*>(iCoeEnv)->WsSession(); |
|
61 const TInt myWgId = static_cast<CEikonEnv*>(iCoeEnv)->RootWin().Identifier(); |
|
62 TInt wgId = 0; |
|
63 TUid uid(AppDllUid()); |
|
64 // Look for another instance of this app |
|
65 while (wgId >= 0) |
|
66 { |
|
67 if (wgId && wgId != myWgId) |
|
68 { |
|
69 iSecondInstance =ETrue; |
|
70 } |
|
71 CApaWindowGroupName::FindByAppUid(uid, ws, wgId); |
|
72 } |
|
73 if(!iSecondInstance) |
|
74 CAknApplication::PreDocConstructL(); |
|
75 } |
|
76 // --------------------------------------------------------------------------- |
|
77 // Function: GetInstanceFlag() |
|
78 // Return the Boolean for second instance |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 TBool CIRApplication::GetInstanceFlag() |
|
82 { |
|
83 IRLOG_INFO( "CIRApplication::GetInstanceFlag" ); |
|
84 return iSecondInstance; |
|
85 } |
|