1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
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 * |
4 * |
9 * Initial Contributors: |
5 * This program is free software: you can redistribute it and/or modify |
10 * Nokia Corporation - initial contribution. |
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. |
11 * |
13 * |
12 * Contributors: |
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/". |
13 * |
17 * |
14 * Description: |
18 * Description: |
15 * |
19 * |
16 */ |
20 */ |
17 |
|
18 |
21 |
19 #ifndef BOOKMARKS_MANAGER_H |
22 #ifndef BOOKMARKS_MANAGER_H |
20 #define BOOKMARKS_MANAGER_H |
23 #define BOOKMARKS_MANAGER_H |
21 |
24 |
22 #include <QtGui/QIcon> |
25 #include <QtGui/QIcon> |
23 #include <QObject> |
26 #include <QObject> |
|
27 #include <QAction> |
24 #include "BWFGlobal.h" |
28 #include "BWFGlobal.h" |
25 #include "bedrockprovisioning.h" |
29 #include "bedrockprovisioning.h" |
26 |
30 |
27 int MainImport(); |
31 int MainImport(); |
28 |
32 |
29 namespace WRT { |
33 namespace WRT { |
30 int startNativeBookmarksParsing(); |
34 int startNativeBookmarksParsing(); |
|
35 |
|
36 class BookmarksManagerPrivate; |
|
37 class BookmarkNode; |
|
38 class HistoryModel; |
|
39 |
|
40 class BWF_EXPORT BookmarksManager : public QObject { |
31 |
41 |
32 class BookmarksManagerPrivate; |
42 Q_OBJECT |
33 class BookmarkNode; |
43 |
34 class HistoryModel; |
44 enum EBookmarkManagerErrorTypes |
35 |
|
36 class BWF_EXPORT BookmarksManager : public QObject |
|
37 { |
|
38 enum EBookmarkManagerErrorTypes |
|
39 { |
45 { |
40 ErrNone, |
46 ErrNone, |
41 //Add bookmark failure |
47 //Add bookmark failure |
42 ErrGeneral = -1, |
48 ErrGeneral = -1, |
43 ErrBookmarkAllReadyPresent =-2, |
49 ErrBookmarkAllReadyPresent =-2, |
44 ErrBookmarkUrlEmpty = -3, |
50 ErrBookmarkUrlEmpty = -3, |
45 |
51 |
46 }; |
52 }; |
47 |
53 |
48 Q_OBJECT |
54 public: |
49 public: |
55 BookmarksManager(QWidget *parent = 0); |
50 BookmarksManager(QWidget *parent = 0); |
56 ~BookmarksManager(); |
51 ~BookmarksManager(); |
|
52 |
57 |
53 void setSettings(BEDROCK_PROVISIONING::BedrockProvisioning *settings); |
58 void setSettings(BEDROCK_PROVISIONING::BedrockProvisioning *settings); |
54 //Gets ref count of the page from history |
59 //Gets ref count of the page from history |
55 int getPageRank(const QString &url); |
60 int getPageRank(const QString &url); |
56 |
61 static BookmarksManager* getSingleton(); |
57 static BookmarksManager* getSingleton(); |
62 |
58 |
63 signals: |
59 |
64 void bookmarkEntryAdded(QString,QString); |
60 signals: |
65 void launchBookmarkEditDailog(QString,QString); |
61 |
66 void bookmarkEntryModified(QString, QString); |
|
67 void historyCleared(); |
|
68 void confirmHistoryClear(); |
|
69 |
62 public slots: |
70 public slots: |
63 |
|
64 void importNativeBookmarks(); |
|
65 //javascript APIS |
|
66 QString getBookmarksJSON(); |
|
67 int addBookmark(const QString &url, const QString &title,int index=0); |
|
68 void deleteBookmark(QString title); |
|
69 int reorderBokmarks(QString title,int new_index); |
|
70 |
|
71 QString getHistoryFoldersJSON(); |
|
72 QString getHistoryFolderJSON(QString folder); |
|
73 void addHistory(const QString &url, const QString &title); |
|
74 void addHistory(const QUrl &url, const QString &title); |
|
75 void clearHistory(); |
|
76 |
|
77 private: |
|
78 //For loading the history from data base |
|
79 void loadHistory(); |
|
80 void loadHistoryProxy(); |
|
81 //Finds the folder to which the date belongs |
|
82 QString findFolderForDate( QDate& date) const; |
|
83 //add the node to history proxy |
|
84 void addToHistoryProxy(QString &strFoldername, BookmarkNode*node); |
|
85 //add the history item to root node specified |
|
86 bool dateInThisMonth(QDate &date)const; |
|
87 |
71 |
88 private: |
72 void importNativeBookmarks(); |
89 BookmarksManagerPrivate * const d; |
73 //javascript APIS |
90 }; |
74 QString getBookmarksJSON(); |
|
75 int addBookmark(const QString &title,const QString &url,int index=0); |
|
76 void deleteBookmark(QString title); |
|
77 int reorderBokmarks(QString title,int new_index); |
|
78 int modifyBookmark(QString orgTitle, QString newTitle, QString newUrl); |
|
79 void clearBookmarks(); |
|
80 void launchEditBookmark(QString title,QString url); |
|
81 |
|
82 QString getHistoryFoldersJSON(QString folder=""); |
|
83 void addHistory(const QString &url, const QString &title); |
|
84 void addHistory(const QUrl &url, const QString &title); |
|
85 void clearHistory(); |
|
86 |
|
87 QAction * getActionClearHistory(); |
|
88 |
|
89 private: |
|
90 //For loading the history from data base |
|
91 void loadHistory(); |
|
92 void loadHistoryProxy(); |
|
93 //Finds the folder to which the date belongs |
|
94 QString findFolderForDate( QDate& date) const; |
|
95 //add the node to history proxy |
|
96 void addToHistoryProxy(QString &strFoldername, BookmarkNode*node); |
|
97 //add the history item to root node specified |
|
98 bool dateInThisMonth(QDate &date)const; |
|
99 |
|
100 private: |
|
101 BookmarksManagerPrivate * const d; |
|
102 bool m_isBookmarkDbreadRequired; |
|
103 QString m_bookmakrData; |
|
104 |
|
105 }; |
91 } |
106 } |
92 #endif //BOOKMARKS_MANAGER |
107 #endif //BOOKMARKS_MANAGER |