|
1 /* |
|
2 * Copyright (c) 2010 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 #include <e32property.h> |
|
20 #include "syncmlnotifierprivate.h" |
|
21 #include <SyncMLClientDM.h> |
|
22 #include <SyncMLClient.h> |
|
23 #include <centralrepository.h> |
|
24 #include <DevManInternalCRKeys.h> |
|
25 #include "nsmlconstantdefs.h" |
|
26 #include "syncmlnotifierparams.h" |
|
27 #include <centralrepository.h> |
|
28 |
|
29 |
|
30 |
|
31 syncmlnotifierprivate::syncmlnotifierprivate() |
|
32 { |
|
33 } |
|
34 |
|
35 void syncmlnotifierprivate::setstatus(TInt value) |
|
36 { |
|
37 |
|
38 qDebug("setstatus"); |
|
39 |
|
40 |
|
41 |
|
42 enum TSyncmlHbNotifierKeys |
|
43 { |
|
44 |
|
45 EHbSOSNotifierKeyStatus = 11, // status set will complete the client subscribe |
|
46 EHbSOSNotifierKeyStatusReturn = 12, // Return the content of actual status value accepted from UI |
|
47 |
|
48 EHbDMSyncNotifierKeyStatus = 13, |
|
49 EHbDMSyncNotifierKeyStatusReturn = 14 |
|
50 }; |
|
51 |
|
52 TInt err; |
|
53 RProperty intProperty; |
|
54 |
|
55 if(iNotifierorigin== EHbSOSNotifierKeyStatus) |
|
56 { |
|
57 TUid uid = {0x101F99FB}; |
|
58 err = intProperty.Attach(uid , EHbSOSNotifierKeyStatus, EOwnerThread); |
|
59 if(err == KErrNone) |
|
60 { |
|
61 qDebug("EHbSOSNotifierKeyStatus entered no error"); |
|
62 intProperty.Set(value); |
|
63 RProperty::Set(uid, EHbSOSNotifierKeyStatusReturn, value); |
|
64 qDebug("Set status of return value"); |
|
65 qDebug()<<err; |
|
66 qDebug("Value user selected"); |
|
67 qDebug()<<value; |
|
68 } |
|
69 |
|
70 intProperty.Close(); |
|
71 } |
|
72 else |
|
73 { |
|
74 TUid uid = {0x101F6DE5}; |
|
75 err = intProperty.Attach(uid , EHbDMSyncNotifierKeyStatus, EOwnerThread); |
|
76 if(err == KErrNone) |
|
77 { |
|
78 qDebug("EHbDMSyncNotifierKeyStatus entered no error"); |
|
79 intProperty.Set(value); |
|
80 err = RProperty::Set(uid, EHbDMSyncNotifierKeyStatusReturn, value); |
|
81 qDebug("Set status of return value"); |
|
82 qDebug()<<err; |
|
83 qDebug("Value user selected"); |
|
84 qDebug()<<value; |
|
85 } |
|
86 |
|
87 intProperty.Close(); |
|
88 } |
|
89 } |
|
90 |
|
91 void syncmlnotifierprivate::getdmprofileparameters(QString& servername, TInt profileid) |
|
92 { |
|
93 |
|
94 TBuf<256> serverdisplayname; |
|
95 |
|
96 RSyncMLSession syncSession; |
|
97 |
|
98 syncSession.OpenL(); |
|
99 CleanupClosePushL( syncSession ); |
|
100 |
|
101 RSyncMLDevManProfile syncProfile; |
|
102 syncProfile.OpenL( syncSession, profileid, ESmlOpenRead ); |
|
103 CleanupClosePushL( syncProfile ); |
|
104 |
|
105 serverdisplayname= syncProfile.DisplayName(); |
|
106 |
|
107 |
|
108 //convert TBuf serverName to QString |
|
109 QString qString((QChar*)serverdisplayname.Ptr(),serverdisplayname.Length()); |
|
110 servername = qString; |
|
111 |
|
112 |
|
113 |
|
114 syncProfile.Close(); |
|
115 CleanupStack::Pop( &syncProfile ); |
|
116 |
|
117 syncSession.Close(); |
|
118 CleanupStack::Pop( &syncSession ); |
|
119 } |
|
120 |
|
121 |
|
122 TInt syncmlnotifierprivate::serverinittype(TInt uimode) |
|
123 { |
|
124 |
|
125 |
|
126 TInt SanSupport = 0; |
|
127 |
|
128 CRepository* centrep = NULL; |
|
129 TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys) ); |
|
130 User::LeaveIfError( err ); |
|
131 centrep->Get( KDevManSANUIBitVariation, SanSupport ); |
|
132 delete centrep; |
|
133 |
|
134 //if SAN is specified then silent operation |
|
135 |
|
136 if(( SanSupport == 1 )) |
|
137 { |
|
138 if( uimode > ESANUserInteractive && uimode < ESANNotSpecified ) |
|
139 { |
|
140 uimode = ESANNotSpecified; |
|
141 } |
|
142 |
|
143 if( uimode == ESANNotSpecified || uimode == ESANUserInteractive) |
|
144 { |
|
145 return ESANUserInteractive; |
|
146 } |
|
147 if( uimode == ESANUserInformative) |
|
148 { |
|
149 return ESANUserInformative; |
|
150 } |
|
151 } |
|
152 |
|
153 return ESANSilent; |
|
154 |
|
155 |
|
156 } |
|
157 |
|
158 void syncmlnotifierprivate::setnotifierorigin(TInt notifierorig) |
|
159 { |
|
160 iNotifierorigin = notifierorig; |
|
161 } |
|
162 |