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 BOOKMARKS_MANAGER_H |
|
23 #define BOOKMARKS_MANAGER_H |
|
24 |
|
25 #include <QtGui/QIcon> |
|
26 #include <QObject> |
|
27 #include <QAction> |
|
28 #include "BWFGlobal.h" |
|
29 #include "bedrockprovisioning.h" |
|
30 |
|
31 int MainImport(); |
|
32 |
|
33 namespace WRT { |
|
34 int startNativeBookmarksParsing(); |
|
35 |
|
36 class BookmarksManagerPrivate; |
|
37 class BookmarkNode; |
|
38 class HistoryModel; |
|
39 |
|
40 class BWF_EXPORT BookmarksManager : public QObject { |
|
41 |
|
42 Q_OBJECT |
|
43 |
|
44 enum EBookmarkManagerErrorTypes |
|
45 { |
|
46 ErrNone, |
|
47 //Add bookmark failure |
|
48 ErrGeneral = -1, |
|
49 ErrBookmarkAllReadyPresent =-2, |
|
50 ErrBookmarkUrlEmpty = -3, |
|
51 |
|
52 }; |
|
53 |
|
54 public: |
|
55 BookmarksManager(QWidget *parent = 0); |
|
56 ~BookmarksManager(); |
|
57 |
|
58 void setSettings(BEDROCK_PROVISIONING::BedrockProvisioning *settings); |
|
59 //Gets ref count of the page from history |
|
60 int getPageRank(const QString &url); |
|
61 static BookmarksManager* getSingleton(); |
|
62 |
|
63 signals: |
|
64 void bookmarkEntryAdded(QString,QString); |
|
65 void launchBookmarkEditDailog(QString,QString); |
|
66 void bookmarkEntryModified(QString, QString); |
|
67 void historyCleared(); |
|
68 void confirmHistoryClear(); |
|
69 void bookmarksCleared(); |
|
70 |
|
71 public slots: |
|
72 |
|
73 #ifdef Q_WS_MAEMO_5 |
|
74 void importNativeBookmarks(); |
|
75 #endif |
|
76 |
|
77 //javascript APIS |
|
78 QString getBookmarksJSON(); |
|
79 int addBookmark(const QString &title,const QString &url,int index=0); |
|
80 void deleteBookmark(QString title); |
|
81 int reorderBokmarks(QString title,int new_index); |
|
82 int modifyBookmark(QString orgTitle, QString newTitle, QString newUrl); |
|
83 void clearBookmarks(); |
|
84 void launchEditBookmark(QString title,QString url); |
|
85 |
|
86 QString getHistoryFoldersJSON(QString folder=""); |
|
87 void addHistory(const QString &url, const QString &title); |
|
88 void addHistory(const QUrl &url, const QString &title); |
|
89 void clearHistory(); |
|
90 |
|
91 QAction * getActionClearHistory(); |
|
92 |
|
93 private: |
|
94 //For loading the history from data base |
|
95 QString normalizeUrl(const QString &url); |
|
96 |
|
97 private: |
|
98 BookmarksManagerPrivate * const d; |
|
99 bool m_isBookmarkDbreadRequired; |
|
100 QString m_bookmakrData; |
|
101 QVector<QString> m_folderVector; |
|
102 QMap<QString, QString> m_historyMap; |
|
103 |
|
104 }; |
|
105 } |
|
106 #endif //BOOKMARKS_MANAGER |
|