browsercore/appfw/Api/Views/mostvisitedpagestore.h
changeset 16 3c88a81ff781
parent 12 afcd8e6d025b
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
    17 *
    17 *
    18 * Description:
    18 * Description:
    19 *
    19 *
    20 */
    20 */
    21 #include "BWFGlobal.h"
    21 #ifndef MOSTVISITEDPAGESTORE_H
       
    22 #define MOSTVISITEDPAGESTORE_H
       
    23 
       
    24 
       
    25 #include "BWFGlobal.h" 
       
    26 #include <QObject>
       
    27 #include "singleton.h"
       
    28 #include "wrtbrowsercontainer.h"
    22 
    29 
    23 class QDataStream;
    30 class QDataStream;
       
    31 
    24 
    32 
    25 //Most visited page item
    33 //Most visited page item
    26 class BWF_EXPORT MostVisitedPage : public QObject
    34 class BWF_EXPORT MostVisitedPage : public QObject
    27 {
    35 {
       
    36 	  Q_OBJECT
    28     Q_PROPERTY(QString pageUrl READ pageUrl)
    37     Q_PROPERTY(QString pageUrl READ pageUrl)
    29 public:
    38 public:
    30 
    39 
    31     //Construction and destruction
    40     //Construction and destruction
    32     MostVisitedPage();
    41     MostVisitedPage();
    56 typedef QList<MostVisitedPage*> MostVisitedPageList;
    65 typedef QList<MostVisitedPage*> MostVisitedPageList;
    57 
    66 
    58 //Store for managing MV pages
    67 //Store for managing MV pages
    59 class BWF_EXPORT MostVisitedPageStore : public QObject
    68 class BWF_EXPORT MostVisitedPageStore : public QObject
    60 {
    69 {
       
    70 	  Q_OBJECT
    61 public:
    71 public:
    62     //Construction and destruction
    72     //Construction and destruction
    63     MostVisitedPageStore();
    73     MostVisitedPageStore();
    64     ~MostVisitedPageStore();
    74     ~MostVisitedPageStore();
    65 
    75 
    72     
    82     
    73     MostVisitedPageList &pageList(){ return m_pageList;}
    83     MostVisitedPageList &pageList(){ return m_pageList;}
    74     MostVisitedPage *pageAt(int index);
    84     MostVisitedPage *pageAt(int index);
    75     
    85     
    76     void initializeDefaultPageThumbnails();
    86     void initializeDefaultPageThumbnails();
    77     void clearMostVisitedPageStore();
    87 private slots:
       
    88   	void update(WRT::WrtBrowserContainer *page);  	
       
    89     void clear();
       
    90     void onLoadFinished(const bool ok);
    78 protected:
    91 protected:
    79     bool compareUrls(QString& url1, QString &url2);
    92     bool compareUrls(QString& url1, QString &url2);
    80     void readStore();
    93     void readStore();
    81     void writeStore();
    94     void writeStore();
       
    95 
    82 
    96 
    83 private:
    97 private:
    84     MostVisitedPageList m_pageList;
    98     MostVisitedPageList m_pageList;
    85     QString m_mvpFile;
    99     QString m_mvpFile;
    86     bool m_needPersistWrite;
   100     bool m_needPersistWrite;
    87 #ifdef ENABLE_TESTS
   101 #ifdef ENABLE_TESTS
    88 		friend class MostVistedPageTest;
   102 		friend class MostVistedPageTest;
    89 #endif
   103 #endif
    90 };
   104 };
       
   105 typedef Singleton<MostVisitedPageStore> MostVisitedPageStoreSingleton;
       
   106 #endif