|
1 /* |
|
2 * Copyright (c) 2009 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 // INCLUDE FILES |
|
19 |
|
20 // USER INCLUDES |
|
21 #include "unieditorsmsplugin.h" |
|
22 #include "unieditorsmsplugin_p.h" |
|
23 #include "s60qconversions.h" |
|
24 |
|
25 // DEBUG |
|
26 #include "debugtraces.h" |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 //--------------------------------------------------------------- |
|
31 // UniEditorSmsPlugin::UniEditorSmsPlugin() |
|
32 // @see header |
|
33 //--------------------------------------------------------------- |
|
34 UniEditorSmsPlugin::UniEditorSmsPlugin(QObject* parent) : |
|
35 QObject(parent), |
|
36 d_ptr(NULL) |
|
37 { |
|
38 TRAPD(error, d_ptr = UniEditorSmsPluginPrivate::NewL()); |
|
39 QDEBUG_WRITE_FORMAT("UniEditorSmsPlugin::UniEditorSmsPlugin error = ",error); |
|
40 } |
|
41 |
|
42 //--------------------------------------------------------------- |
|
43 // UniEditorSmsPlugin::~UniEditorSmsPlugin() |
|
44 // @see header |
|
45 //--------------------------------------------------------------- |
|
46 UniEditorSmsPlugin::~UniEditorSmsPlugin() |
|
47 { |
|
48 delete d_ptr; |
|
49 } |
|
50 |
|
51 //--------------------------------------------------------------- |
|
52 // UniEditorSmsPlugin::messageType() |
|
53 // @see header |
|
54 //--------------------------------------------------------------- |
|
55 ConvergedMessage::MessageType UniEditorSmsPlugin::messageType() |
|
56 { |
|
57 return ConvergedMessage::Sms; |
|
58 } |
|
59 |
|
60 //--------------------------------------------------------------- |
|
61 // UniEditorSmsPlugin::convertFrom |
|
62 // @see header |
|
63 //--------------------------------------------------------------- |
|
64 ConvergedMessage* UniEditorSmsPlugin::convertFrom( TMsvId aId, |
|
65 UniEditorPluginInterface::EditorOperation aOperation ) |
|
66 { |
|
67 ConvergedMessage* msg = NULL; |
|
68 TRAPD(error, msg = d_ptr->ConvertFromL( aId,aOperation )); |
|
69 QDEBUG_WRITE_FORMAT("UniEditorSmsPlugin::convertFrom error = ",error); |
|
70 return msg; |
|
71 } |
|
72 |
|
73 //--------------------------------------------------------------- |
|
74 // UniEditorSmsPlugin::deleteDraftsEntry |
|
75 // @see header |
|
76 //--------------------------------------------------------------- |
|
77 void UniEditorSmsPlugin::deleteDraftsEntry( TMsvId aId ) |
|
78 { |
|
79 TRAPD(error, d_ptr->DeleteDraftsEntryL( aId )); |
|
80 QDEBUG_WRITE_FORMAT("UniEditorSmsPlugin::DeleteDraftsEntry error = ",error); |
|
81 return; |
|
82 } |
|
83 |
|
84 //--------------------------------------------------------------- |
|
85 // UniEditorSmsPlugin::convertTo |
|
86 // @see header |
|
87 //--------------------------------------------------------------- |
|
88 TMsvId UniEditorSmsPlugin::convertTo( ConvergedMessage *aMessage ) |
|
89 { |
|
90 TMsvId id = -1; |
|
91 TRAPD(error, id = d_ptr->ConvertToL( aMessage )); |
|
92 QDEBUG_WRITE_FORMAT("UniEditorSmsPlugin::ConvertTo error = ",error); |
|
93 return id; |
|
94 } |
|
95 |
|
96 //--------------------------------------------------------------- |
|
97 // UniEditorSmsPlugin::send |
|
98 // @see header |
|
99 //--------------------------------------------------------------- |
|
100 bool UniEditorSmsPlugin::send(TMsvId aId) |
|
101 { |
|
102 bool ret = true; |
|
103 TRAPD(error, d_ptr->SendL( aId )); |
|
104 if(error != KErrNone) |
|
105 { |
|
106 ret = false; |
|
107 } |
|
108 QDEBUG_WRITE_FORMAT("UniEditorSmsPlugin::Send error = ",error); |
|
109 return ret; |
|
110 } |
|
111 |
|
112 //--------------------------------------------------------------- |
|
113 // UniEditorSmsPlugin::isServiceValidL |
|
114 // @see header |
|
115 //--------------------------------------------------------------- |
|
116 TBool UniEditorSmsPlugin::isServiceValid() |
|
117 { |
|
118 TBool ret = EFalse; |
|
119 TRAPD(error, ret = d_ptr->IsServiceValidL()); |
|
120 QDEBUG_WRITE_FORMAT("UniEditorSmsPlugin::isServiceValid error = ", error); |
|
121 return ret; |
|
122 } |
|
123 |
|
124 //--------------------------------------------------------------- |
|
125 // UniEditorSmsPlugin::validateServiceL |
|
126 // @see header |
|
127 //--------------------------------------------------------------- |
|
128 TBool UniEditorSmsPlugin::validateService( TBool aEmailOverSms/* = EFalse */) |
|
129 { |
|
130 TBool ret = EFalse; |
|
131 TRAPD(error, ret = d_ptr->ValidateServiceL( aEmailOverSms )); |
|
132 QDEBUG_WRITE_FORMAT("UniEditorSmsPlugin::ValidateService error = ",error); |
|
133 return ret; |
|
134 } |
|
135 |
|
136 //--------------------------------------------------------------- |
|
137 // UniEditorSmsPlugin::setEncodingSettings |
|
138 // @see header |
|
139 //--------------------------------------------------------------- |
|
140 void UniEditorSmsPlugin::setEncodingSettings(TBool aUnicodeMode, |
|
141 TSmsEncoding aAlternativeEncodingType, TInt charSupportType) |
|
142 { |
|
143 d_ptr->SetEncodingSettings(aUnicodeMode, aAlternativeEncodingType, |
|
144 charSupportType); |
|
145 } |
|
146 |
|
147 //--------------------------------------------------------------- |
|
148 // UniEditorSmsPlugin::getNumPDUs |
|
149 // @see header |
|
150 //--------------------------------------------------------------- |
|
151 bool UniEditorSmsPlugin::getNumPDUs(QString& aBuf, TInt& aNumOfRemainingChars, |
|
152 TInt& aNumOfPDUs, TBool& aUnicodeMode, |
|
153 TSmsEncoding& aAlternativeEncodingType) |
|
154 { |
|
155 TBool ret = ETrue; |
|
156 HBufC* buffer = S60QConversions::qStringToS60Desc(aBuf); |
|
157 TRAPD(error,d_ptr->GetNumPDUsL(*buffer,aNumOfRemainingChars, |
|
158 aNumOfPDUs,aUnicodeMode,aAlternativeEncodingType)); |
|
159 delete buffer; |
|
160 if (error != KErrNone) |
|
161 { |
|
162 ret = false; |
|
163 } |
|
164 return ret; |
|
165 } |
|
166 |
|
167 Q_EXPORT_PLUGIN2(unieditorsmsplugin, UniEditorSmsPlugin) |