|
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 #ifndef BOOKMARKSERVER_H |
|
19 #define BOOKMARKSERVER_H |
|
20 |
|
21 #include <QHash> |
|
22 #include <serviceipcobserver.h> |
|
23 #include <serviceipcserver.h> |
|
24 #define BOOKMARKDATAMODELSERVER "BookMarkServer" |
|
25 |
|
26 const QString dbLocation="BookMarkDatabase.db"; |
|
27 |
|
28 |
|
29 |
|
30 //using namespace WRT; |
|
31 class BookMarkServer: public QObject, public WRT::MServiceIPCObserver |
|
32 { |
|
33 Q_OBJECT |
|
34 public: |
|
35 BookMarkServer(); |
|
36 virtual ~BookMarkServer(); |
|
37 enum BookmarkRequestTypes |
|
38 { |
|
39 EDeleteBookMark, |
|
40 EAddBookMark, |
|
41 EFetchBookmark, |
|
42 EFetchAllBookmarks, |
|
43 EUnknownrequest |
|
44 }; |
|
45 enum BookmarkResponseTypes |
|
46 { |
|
47 EDeleteBookMarkDone, |
|
48 EAddBookMarkDone, |
|
49 EFetchBookmarkDone, |
|
50 EFetchAllBookmarksDone, |
|
51 EUnknownresponse |
|
52 }; |
|
53 |
|
54 |
|
55 private: |
|
56 bool handleRequest(WRT::ServiceIPCRequest *aRequest); |
|
57 void handleCancelRequest(WRT::ServiceIPCRequest *aRequest); |
|
58 void handleClientConnect(WRT::ClientInfo *aNewClient); |
|
59 void handleClientDisconnect(WRT::ClientInfo *aClient); |
|
60 private: |
|
61 void fetchBookMarkData(WRT::ServiceIPCRequest *request); |
|
62 int createDatabase(); |
|
63 void addBookMark(WRT::ServiceIPCRequest *request); |
|
64 void deleteBookMark(WRT::ServiceIPCRequest *request); |
|
65 private slots: |
|
66 void closeServer(); |
|
67 private: |
|
68 WRT::ServiceFwIPCServer* m_server; |
|
69 QString m_connectionName; |
|
70 QHash<int,QString>m_clients; |
|
71 int m_sessionCount; |
|
72 }; |
|
73 #endif //BOOKMARKSERVER_H |