1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 |
|
22 #ifndef PHONESERVICE_H |
|
23 #define PHONESERVICE_H |
|
24 |
|
25 #include <QWidget> |
|
26 #include <QModelIndex> |
|
27 #include <QMap> |
|
28 #include <QStringList> |
|
29 #include <xqserviceprovider.h> |
|
30 #include <xqsharablefile.h> |
|
31 #include <cntservicescontact.h> |
|
32 |
|
33 class QLineEdit; |
|
34 class QPushButton; |
|
35 class DialerService; |
|
36 class UriService; |
|
37 class QLabel; |
|
38 class FileService; |
|
39 class XQSharableFile; |
|
40 class NewDialerService; |
|
41 class NewUriService; |
|
42 class NewFileService; |
|
43 |
|
44 |
|
45 class ServiceApp : public QWidget |
|
46 { |
|
47 Q_OBJECT |
|
48 public: |
|
49 ServiceApp( QWidget *parent = 0, Qt::WFlags f = 0 ); |
|
50 ~ServiceApp(); |
|
51 |
|
52 void setLabelNumber(QString label,QString number); |
|
53 |
|
54 public slots: |
|
55 void endCall(); |
|
56 |
|
57 public slots: |
|
58 void quit(); |
|
59 void answerDial(); |
|
60 void answerUri(); |
|
61 void answerFile(); |
|
62 |
|
63 private: |
|
64 QLabel *mLabel; |
|
65 QLineEdit *mNumber; |
|
66 //QPushButton *mEndCallButton; |
|
67 DialerService* mDialService; |
|
68 UriService* mUriService; |
|
69 FileService* mFileService; |
|
70 NewDialerService* mNewDialService; |
|
71 NewUriService* mNewUriService; |
|
72 NewFileService* mNewFileService; |
|
73 }; |
|
74 |
|
75 class DialerService : public XQServiceProvider |
|
76 { |
|
77 Q_OBJECT |
|
78 public: |
|
79 DialerService( ServiceApp *parent = 0 ); |
|
80 ~DialerService(); |
|
81 |
|
82 void complete(QString number); |
|
83 bool asyncAnswer() {return mAsyncReqIds.count() > 0;} |
|
84 |
|
85 public slots: |
|
86 int dial(const QString& number, bool asyncAnswer); |
|
87 QVariant testVariant(QVariant variant); |
|
88 CntServicesContactList testContactList(CntServicesContactList list); |
|
89 |
|
90 protected slots: |
|
91 void handleClientDisconnect(); |
|
92 void handleAnswerDelivered(); |
|
93 |
|
94 protected: |
|
95 void showRecipients(QVariant &value); |
|
96 void showRecipients(CntServicesContactList &value); |
|
97 |
|
98 protected: |
|
99 ServiceApp* mServiceApp; |
|
100 QString mNumber; |
|
101 QMap<quint32,int> mAsyncReqIds; |
|
102 }; |
|
103 |
|
104 |
|
105 class NewDialerService : public XQServiceProvider |
|
106 { |
|
107 Q_OBJECT |
|
108 public: |
|
109 NewDialerService( ServiceApp *parent = 0 ); |
|
110 ~NewDialerService(); |
|
111 |
|
112 void complete(QString number); |
|
113 bool asyncAnswer() {return mAsyncReqIds.count() > 0;} |
|
114 |
|
115 public slots: |
|
116 int dial(const QString& number, bool asyncAnswer); |
|
117 QVariant testVariant(QVariant variant); |
|
118 CntServicesContactList testContactList(CntServicesContactList list); |
|
119 |
|
120 protected slots: |
|
121 void handleClientDisconnect(); |
|
122 void handleAnswerDelivered(); |
|
123 |
|
124 protected: |
|
125 void showRecipients(QVariant &value); |
|
126 void showRecipients(CntServicesContactList &value); |
|
127 |
|
128 protected: |
|
129 ServiceApp* mServiceApp; |
|
130 QString mNumber; |
|
131 QMap<quint32,int> mAsyncReqIds; |
|
132 }; |
|
133 |
|
134 |
|
135 |
|
136 class UriService : public XQServiceProvider |
|
137 { |
|
138 Q_OBJECT |
|
139 public: |
|
140 UriService( ServiceApp *parent = 0 ); |
|
141 ~UriService(); |
|
142 bool asyncAnswer() {return mAsyncReqIds.count() > 0;} |
|
143 void complete(bool ok); |
|
144 |
|
145 public slots: |
|
146 bool view(const QString& uri); |
|
147 bool view(const QString& uri, bool returnValue); |
|
148 |
|
149 private slots: |
|
150 void handleClientDisconnect(); |
|
151 void handleAnswerDelivered(); |
|
152 |
|
153 private: |
|
154 ServiceApp* mServiceApp; |
|
155 QMap<quint32,int> mAsyncReqIds; |
|
156 bool mRetValue; |
|
157 }; |
|
158 |
|
159 |
|
160 class NewUriService : public XQServiceProvider |
|
161 { |
|
162 Q_OBJECT |
|
163 public: |
|
164 NewUriService( ServiceApp *parent = 0 ); |
|
165 ~NewUriService(); |
|
166 bool asyncAnswer() {return mAsyncReqIds.count() > 0;} |
|
167 void complete(bool ok); |
|
168 |
|
169 public slots: |
|
170 bool view(const QString& uri); |
|
171 bool view(const QString& uri, bool returnValue); |
|
172 |
|
173 private slots: |
|
174 void handleClientDisconnect(); |
|
175 void handleAnswerDelivered(); |
|
176 |
|
177 private: |
|
178 ServiceApp* mServiceApp; |
|
179 QMap<quint32,int> mAsyncReqIds; |
|
180 bool mRetValue; |
|
181 }; |
|
182 |
|
183 |
|
184 class FileService : public XQServiceProvider |
|
185 { |
|
186 Q_OBJECT |
|
187 public: |
|
188 FileService( ServiceApp *parent = 0 ); |
|
189 ~FileService(); |
|
190 bool asyncAnswer() {return mAsyncReqIds.count() > 0;} |
|
191 void complete(bool ok); |
|
192 |
|
193 public slots: |
|
194 bool view(QString file); |
|
195 bool view(XQSharableFile file); |
|
196 |
|
197 private slots: |
|
198 void handleClientDisconnect(); |
|
199 void handleAnswerDelivered(); |
|
200 |
|
201 private: |
|
202 ServiceApp* mServiceApp; |
|
203 QMap<quint32,int> mAsyncReqIds; |
|
204 bool mRetValue; |
|
205 }; |
|
206 |
|
207 |
|
208 class NewFileService : public XQServiceProvider |
|
209 { |
|
210 Q_OBJECT |
|
211 public: |
|
212 NewFileService( ServiceApp *parent = 0 ); |
|
213 ~NewFileService(); |
|
214 bool asyncAnswer() {return mAsyncReqIds.count() > 0;} |
|
215 void complete(bool ok); |
|
216 |
|
217 public slots: |
|
218 bool view(QString file); |
|
219 bool view(XQSharableFile file); |
|
220 |
|
221 private slots: |
|
222 void handleClientDisconnect(); |
|
223 void handleAnswerDelivered(); |
|
224 |
|
225 private: |
|
226 ServiceApp* mServiceApp; |
|
227 QMap<quint32,int> mAsyncReqIds; |
|
228 bool mRetValue; |
|
229 }; |
|
230 |
|
231 |
|
232 #define TESTCASE_INFO_KEY QLatin1String("XQTestCase") |
|
233 |
|
234 |
|
235 #endif |
|