bookmarksengine/browsercontentdll/inc/browsercontentdll.h
changeset 2 016bf4557e2f
parent 0 fa475d6462b2
child 3 9b96c4b50d96
equal deleted inserted replaced
0:fa475d6462b2 2:016bf4557e2f
     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 #ifndef BROWSERCONTENT_H
    21 #ifndef BROWSERCONTENT_H
    19 #define BROWSERCONTENT_H
    22 #define BROWSERCONTENT_H
    20 
    23 
    21 #include<QObject>
    24 #include<QObject>
    22 #include<QString>
    25 #include<QString>
    24 #include<QtGui>
    27 #include<QtGui>
    25 
    28 
    26 
    29 
    27 class BrowserContentPrivate;
    30 class BrowserContentPrivate;
    28 
    31 
    29 class BOOKMARKSCONTENTDLL_EXPORT BookmarkLeaf
    32 class BOOKMARKSCONTENTDLL_EXPORT BookmarkLeaf {
    30 {
       
    31 public:
    33 public:
    32     QString getUrl(){return url;}
    34     QString getUrl(){return url;}
    33     QString getTitle(){return title;}
    35     QString getTitle(){return title;}
    34     QDate getDate(){return date;}
    36     QDate getDate(){return date;}
    35     QTime getLastVisited(){return lastVisited;}
    37     QTime getLastVisited(){return lastVisited;}
    62     int m_index;
    64     int m_index;
    63     
    65     
    64 
    66 
    65 };
    67 };
    66 
    68 
    67 class BOOKMARKSCONTENTDLL_EXPORT HistoryLeaf
    69 class BOOKMARKSCONTENTDLL_EXPORT HistoryLeaf {
    68 {
       
    69 public:
    70 public:
    70     QString getUrl(){return url;}
    71     QString getUrl(){return url;}
    71     QString getTitle(){return title;}
    72     QString getTitle(){return title;}
    72     QDate getDate(){return date;}
    73     QDate getDate(){return date;}
    73     QTime getLastVisited(){return lastVisited;}
    74     QTime getLastVisited(){return lastVisited;}
    96     bool expanded;
    97     bool expanded;
    97     int m_index;
    98     int m_index;
    98    
    99    
    99 };
   100 };
   100 
   101 
   101 class BOOKMARKSCONTENTDLL_EXPORT BrowserContent:public QObject
   102 class BOOKMARKSCONTENTDLL_EXPORT SuggestData : public QObject
   102     {
   103 {
       
   104         Q_OBJECT
       
   105         
       
   106         public:
       
   107             SuggestData(QString pgTitle, QString pgUrl) : m_title(pgTitle), m_url(pgUrl){};
       
   108             Q_PROPERTY(QString title READ pageTitle)
       
   109             Q_PROPERTY(QString url READ pageUrl)
       
   110             
       
   111         private:
       
   112             QString m_title;
       
   113             QString m_url;
       
   114             QString pageTitle() {return m_title;}
       
   115             QString pageUrl() {return m_url;}
       
   116 };
       
   117 class BOOKMARKSCONTENTDLL_EXPORT BrowserContent:public QObject {
   103 Q_OBJECT
   118 Q_OBJECT
   104 BOOKMARKSCLIENT_PRIVATE(BrowserContent)
   119 BOOKMARKSCLIENT_PRIVATE(BrowserContent)
   105 public:
   120 public:
   106 
   121 
   107     BrowserContent(QString aClientName);
   122     BrowserContent(QString aClientName);
   108     ~BrowserContent();
   123     ~BrowserContent();
   109     int AddBookmark(BookmarkLeaf* BookmarkContent);
   124     int AddBookmark(BookmarkLeaf* BookmarkContent);
   110     int DeleteBookmark(QString title);
   125     int DeleteBookmark(QString title);
   111     QList<BookmarkLeaf*> FetchAllBookmarks();
   126     QList<BookmarkLeaf*> FetchAllBookmarks();
       
   127     QList<BookmarkLeaf*> suggestBookMarks(QString atitle);
   112     int reorderBokmarks(QString title,int new_index);
   128     int reorderBokmarks(QString title,int new_index);
       
   129 	int modifyBookmark(QString aOrgTitle, QString aNewTitle, QString aNewUrl);
       
   130 	QObjectList suggestContent(QString atitle);
   113 
   131 
   114 	int AddHistory(HistoryLeaf* HistoryContent);
   132     int AddHistory(HistoryLeaf* HistoryContent);
   115 	QList<HistoryLeaf*> FetchHistory();
   133     QList<HistoryLeaf*> FetchHistory();
   116 	int clearHistory();
   134     QList<HistoryLeaf*> suggestHistory(QString atitle);
       
   135     int clearHistory();
       
   136     int clearBookmarks();
       
   137     QString FetchSerializedBookmarks();
       
   138     void FetchSerializedHistory(QVector<QString> &folderVector,QMap<QString,QString> &mymap);
       
   139     void FetchAllBookmarkTitles(QVector<QString> &title);
   117 
   140 
   118 private:
   141 private:
   119 	int createDatabase();
   142   int createDatabase();
   120     };
   143   QString filterUrl(QString atitle);
       
   144   QString findFolderForDate( QDate& nodeDate);
       
   145   bool dateInThisMonth(QDate &date);
       
   146 
       
   147 private:
       
   148 	QObjectList suggestedList;
       
   149 };
   121 #endif //BROWSERCONTENT_H
   150 #endif //BROWSERCONTENT_H