~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to kde/src/lib/historymodel.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
//SFLPhone
29
29
#include "call.h"
 
30
#include "commonbackendmanagerinterface.h"
30
31
 
31
32
//Typedef
32
33
typedef QMap<uint, Call*>  CallMap;
33
34
typedef QList<Call*>       CallList;
34
35
 
35
36
class HistoryItemNode;
 
37
class AbstractHistoryBackend;
36
38
 
37
39
///HistoryModel: History call manager
38
 
class LIB_EXPORT HistoryModel : public QAbstractItemModel {
 
40
class LIB_EXPORT HistoryModel : public QAbstractItemModel, public CommonBackendManagerInterface<AbstractHistoryBackend> {
39
41
   #pragma GCC diagnostic push
40
42
   #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
41
43
   Q_OBJECT
43
45
public:
44
46
   friend class HistoryItemNode;
45
47
 
 
48
   //Properties
 
49
   Q_PROPERTY(bool hasBackends   READ hasBackends  )
 
50
 
46
51
   //Singleton
47
52
   static HistoryModel* instance();
48
53
 
49
54
   //Getters
50
 
   int  acceptedPayloadTypes();
51
 
   bool isHistoryLimited() const;
52
 
   int  historyLimit() const;
 
55
   int  acceptedPayloadTypes       () const;
 
56
   bool isHistoryLimited           () const;
 
57
   int  historyLimit               () const;
 
58
   virtual bool hasBackends        () const;
 
59
   virtual bool hasEnabledBackends () const;
 
60
   const CallMap getHistoryCalls() const;
 
61
   virtual const QVector<AbstractHistoryBackend*> backends() const;
 
62
   virtual const QVector<AbstractHistoryBackend*> enabledBackends() const;
 
63
   virtual CommonItemBackendModel* backendModel() const;
53
64
 
54
65
   //Setters
55
66
   void setCategoryRole(Call::Role role);
57
68
   void setHistoryLimit(int numberOfDays);
58
69
 
59
70
   //Mutator
60
 
   void add(Call* call);
 
71
   void addBackend(AbstractHistoryBackend* backend, LoadOptions options = LoadOptions::NONE);
 
72
   void clearAllBackends() const;
 
73
   virtual bool enableBackend(AbstractHistoryBackend* backend, bool enabled);
61
74
 
62
75
   //Model implementation
63
76
   virtual bool          setData     ( const QModelIndex& index, const QVariant &value, int role   );
110
123
   ~HistoryModel();
111
124
 
112
125
   //Helpers
113
 
   bool initHistory();
114
126
   TopLevelItem* getCategory(const Call* call);
115
127
 
116
128
   //Static attributes
118
130
 
119
131
   //Attributes
120
132
   static CallMap m_sHistoryCalls;
121
 
   bool m_HistoryInit;
 
133
   QVector<AbstractHistoryBackend*> m_lBackends;
122
134
 
123
135
   //Model categories
124
136
   QList<TopLevelItem*>         m_lCategoryCounter ;
125
137
   QHash<int,TopLevelItem*>     m_hCategories      ;
126
138
   QHash<QString,TopLevelItem*> m_hCategoryByName  ;
127
 
   bool                         m_isContactDateInit;
128
139
   int                          m_Role             ;
129
 
   bool                         m_ShowAll          ;
130
 
   bool                         m_HaveContactModel ;
131
140
   QStringList                  m_lMimes           ;
132
141
 
 
142
public Q_SLOTS:
 
143
   void add(Call* call);
 
144
 
133
145
private Q_SLOTS:
134
146
   void reloadCategories();
135
147
   void slotChanged(const QModelIndex& idx);
139
151
   void historyChanged          (            );
140
152
   ///Emitted when a new item is added to prevent full reload
141
153
   void newHistoryCall          ( Call* call );
 
154
   void newBackendAdded(AbstractHistoryBackend* backend);
142
155
};
143
156
 
144
157