22 #ifndef CONTACTSFILTERMODEL_H
23 #define CONTACTSFILTERMODEL_H
25 #include <QSortFilterProxyModel>
42 Q_ENUMS(PresenceFilterFlag
44 SubscriptionStateFilterFlag)
46 Q_FLAGS(PresenceTypeFilterFlags
48 SubscriptionStateFilterFlags)
50 Q_PROPERTY(PresenceTypeFilterFlags presenceTypeFilterFlags
51 READ presenceTypeFilterFlags
52 RESET clearPresenceTypeFilterFlags
53 WRITE setPresenceTypeFilterFlags
54 NOTIFY presenceTypeFilterFlagsChanged)
56 Q_PROPERTY(CapabilityFilterFlags capabilityFilterFlags
57 READ capabilityFilterFlags
58 RESET clearCapabilityFilterFlags
59 WRITE setCapabilityFilterFlags
60 NOTIFY capabilityFilterFlagsChanged)
63 Q_PROPERTY(SubscriptionStateFilterFlags subscriptionStateFilterFlags
64 READ subscriptionStateFilterFlags
65 RESET clearSubscriptionStateFilterFlags
66 WRITE setSubscriptionStateFilterFlags
67 NOTIFY subscriptionStateFilterFlagsChanged)
70 Q_PROPERTY(QString globalFilterString
71 READ globalFilterString
72 RESET clearGlobalFilterString
73 WRITE setGlobalFilterString
74 NOTIFY globalFilterStringChanged)
75 Q_PROPERTY(Qt::MatchFlags globalFilterMatchFlags
76 READ globalFilterMatchFlags
77 RESET resetGlobalFilterMatchFlags
78 WRITE setGlobalFilterMatchFlags
79 NOTIFY globalFilterMatchFlagsChanged)
81 Q_PROPERTY(QString displayNameFilterString
82 READ displayNameFilterString
83 RESET clearDisplayNameFilterString
84 WRITE setDisplayNameFilterString
85 NOTIFY displayNameFilterStringChanged)
86 Q_PROPERTY(QString nicknameFilterString
87 READ nicknameFilterString
88 RESET clearNicknameFilterString
89 WRITE setNicknameFilterString
90 NOTIFY nicknameFilterStringChanged)
91 Q_PROPERTY(QString aliasFilterString
92 READ aliasFilterString
93 RESET clearAliasFilterString
94 WRITE setAliasFilterString
95 NOTIFY aliasFilterStringChanged)
96 Q_PROPERTY(QString groupsFilterString
97 READ groupsFilterString
98 RESET clearGroupsFilterString
99 WRITE setGroupsFilterString
100 NOTIFY groupsFilterStringChanged)
101 Q_PROPERTY(QString idFilterString
103 RESET clearIdFilterString
104 WRITE setIdFilterString
105 NOTIFY idFilterStringChanged)
106 Q_PROPERTY(QStringList tubesFilterStrings
107 READ tubesFilterStrings
108 RESET clearTubesFilterStrings
109 WRITE setTubesFilterStrings
110 NOTIFY tubesFilterStringsChanged)
111 Q_PROPERTY(Qt::MatchFlags displayNameFilterMatchFlags
112 READ displayNameFilterMatchFlags
113 RESET resetDisplayNameFilterMatchFlags
114 WRITE setDisplayNameFilterMatchFlags
115 NOTIFY displayNameFilterMatchFlagsChanged)
116 Q_PROPERTY(Qt::MatchFlags nicknameFilterMatchFlags
117 READ nicknameFilterMatchFlags
118 RESET resetNicknameFilterMatchFlags
119 WRITE setNicknameFilterMatchFlags
120 NOTIFY nicknameFilterMatchFlagsChanged)
121 Q_PROPERTY(Qt::MatchFlags aliasFilterMatchFlags
122 READ aliasFilterMatchFlags
123 RESET resetAliasFilterMatchFlags
124 WRITE setAliasFilterMatchFlags
125 NOTIFY aliasFilterMatchFlagsChanged)
126 Q_PROPERTY(Qt::MatchFlags groupsFilterMatchFlags
127 READ groupsFilterMatchFlags
128 RESET resetGroupsFilterMatchFlags
129 WRITE setGroupsFilterMatchFlags
130 NOTIFY groupsFilterMatchFlagsChanged)
131 Q_PROPERTY(Qt::MatchFlags idFilterMatchFlags
132 READ idFilterMatchFlags
133 RESET resetIdFilterMatchFlags
134 WRITE setIdFilterMatchFlags
135 NOTIFY idFilterMatchFlagsChanged)
137 Q_PROPERTY(Tp::AccountPtr accountFilter
139 RESET clearAccountFilter
140 WRITE setAccountFilter
141 NOTIFY accountFilterChanged)
143 Q_PROPERTY(QString sortRoleString
145 WRITE setSortRoleString)
149 enum PresenceTypeFilterFlag {
150 DoNotFilterByPresence = 0x0000,
151 HidePresenceTypeUnset = 0x0001,
152 HidePresenceTypeOffline = 0x0002,
153 HidePresenceTypeAvailable = 0x0004,
154 HidePresenceTypeAway = 0x0008,
155 HidePresenceTypeExtendedAway = 0x0010,
156 HidePresenceTypeHidden = 0x0020,
157 HidePresenceTypeBusy = 0x0040,
158 HidePresenceTypeUnknown = 0x0080,
159 HidePresenceTypeError = 0x0100,
160 HideAllOffline = HidePresenceTypeUnset |
161 HidePresenceTypeOffline |
162 HidePresenceTypeUnknown |
163 HidePresenceTypeError,
164 HideAllOnline = HidePresenceTypeAvailable |
165 HidePresenceTypeAway |
166 HidePresenceTypeExtendedAway |
167 HidePresenceTypeHidden |
168 HidePresenceTypeBusy,
169 HideAllUnavailable = HideAllOffline |
170 HidePresenceTypeAway |
171 HidePresenceTypeExtendedAway |
172 HidePresenceTypeBusy,
173 ShowOnlyConnected = HideAllOffline,
174 ShowOnlyDisconnected = HideAllOnline,
175 ShowAll = DoNotFilterByPresence
177 Q_DECLARE_FLAGS(PresenceTypeFilterFlags, PresenceTypeFilterFlag)
179 enum CapabilityFilterFlag {
180 DoNotFilterByCapability = 0x0000,
181 FilterByTextChatCapability = 0x0001,
182 FilterByAudioCallCapability = 0x0002,
183 FilterByVideoCallCapability = 0x0004,
184 FilterByFileTransferCapability = 0x0008,
185 FilterByTubes = 0x0010,
187 CustomFilterCapability = 0x10000
189 Q_DECLARE_FLAGS(CapabilityFilterFlags, CapabilityFilterFlag)
191 enum SubscriptionStateFilterFlag {
192 DoNotFilterBySubscription = 0x0000,
193 HideSubscriptionStateNo = 0x0001,
194 HideSubscriptionStateAsk = 0x0002,
195 HideSubscriptionStateYes = 0x0004,
196 HidePublishStateNo = 0x0010,
197 HidePublishStateAsk = 0x0020,
198 HidePublishStateYes = 0x0040,
199 HideBlocked = 0x0100,
200 HideNonBlocked = 0x0200,
201 ShowOnlyBlocked = HideNonBlocked
203 Q_DECLARE_FLAGS(SubscriptionStateFilterFlags, SubscriptionStateFilterFlag)
208 virtual QVariant data(
const QModelIndex &index,
int role)
const;
209 virtual void setSourceModel(QAbstractItemModel *sourceModel);
210 void invalidateFilter();
212 PresenceTypeFilterFlags presenceTypeFilterFlags()
const;
213 Q_SLOT
void clearPresenceTypeFilterFlags();
214 Q_SLOT
void setPresenceTypeFilterFlags(PresenceTypeFilterFlags presenceTypeFilterFlags);
215 Q_SIGNAL
void presenceTypeFilterFlagsChanged(PresenceTypeFilterFlags presenceTypeFilterFlags);
217 CapabilityFilterFlags capabilityFilterFlags()
const;
218 Q_SLOT
void clearCapabilityFilterFlags();
219 Q_SLOT
void setCapabilityFilterFlags(CapabilityFilterFlags capabilityFilterFlags);
220 Q_SIGNAL
void capabilityFilterFlagsChanged(CapabilityFilterFlags capabilityFilterFlags);
222 SubscriptionStateFilterFlags subscriptionStateFilterFlags()
const;
223 Q_SLOT
void clearSubscriptionStateFilterFlags();
224 Q_SLOT
void setSubscriptionStateFilterFlags(SubscriptionStateFilterFlags subscriptionStateFilterFlags);
225 Q_SIGNAL
void subscriptionStateFilterFlagsChanged(SubscriptionStateFilterFlags subscriptionStateFilterFlags);
227 QString globalFilterString()
const;
228 Q_SLOT
void clearGlobalFilterString();
229 Q_SLOT
void setGlobalFilterString(
const QString &globalFilterString);
230 Q_SIGNAL
void globalFilterStringChanged(
const QString &globalFilterString);
231 Qt::MatchFlags globalFilterMatchFlags()
const;
232 Q_SLOT
void resetGlobalFilterMatchFlags();
233 Q_SLOT
void setGlobalFilterMatchFlags(Qt::MatchFlags globalStringMatchFlags);
234 Q_SIGNAL
void globalFilterMatchFlagsChanged(Qt::MatchFlags globalStringMatchFlags);
236 QString displayNameFilterString()
const;
237 Q_SLOT
void clearDisplayNameFilterString();
238 Q_SLOT
void setDisplayNameFilterString(
const QString &displayNameFilterString);
239 Q_SIGNAL
void displayNameFilterStringChanged(
const QString &displayNameFilterString);
240 Qt::MatchFlags displayNameFilterMatchFlags()
const;
241 Q_SLOT
void resetDisplayNameFilterMatchFlags();
242 Q_SLOT
void setDisplayNameFilterMatchFlags(Qt::MatchFlags displayNameFilterMatchFlags);
243 Q_SIGNAL
void displayNameFilterMatchFlagsChanged(Qt::MatchFlags displayNameFilterMatchFlags);
245 QString nicknameFilterString()
const;
246 Q_SLOT
void clearNicknameFilterString();
247 Q_SLOT
void setNicknameFilterString(
const QString &nicknameFilterString);
248 Q_SIGNAL
void nicknameFilterStringChanged(
const QString &nicknameFilterString);
249 Qt::MatchFlags nicknameFilterMatchFlags()
const;
250 Q_SLOT
void resetNicknameFilterMatchFlags();
251 Q_SLOT
void setNicknameFilterMatchFlags(Qt::MatchFlags nicknameFilterMatchFlags);
252 Q_SIGNAL
void nicknameFilterMatchFlagsChanged(Qt::MatchFlags nicknameFilterMatchFlags);
254 QString aliasFilterString()
const;
255 Q_SLOT
void clearAliasFilterString();
256 Q_SLOT
void setAliasFilterString(
const QString &aliasFilterString);
257 Q_SIGNAL
void aliasFilterStringChanged(
const QString &aliasFilterString);
258 Qt::MatchFlags aliasFilterMatchFlags()
const;
259 Q_SLOT
void resetAliasFilterMatchFlags();
260 Q_SLOT
void setAliasFilterMatchFlags(Qt::MatchFlags aliasFilterMatchFlags);
261 Q_SIGNAL
void aliasFilterMatchFlagsChanged(Qt::MatchFlags aliasFilterMatchFlags);
263 QString groupsFilterString()
const;
264 Q_SLOT
void clearGroupsFilterString();
265 Q_SLOT
void setGroupsFilterString(
const QString &groupsFilterString);
266 Q_SIGNAL
void groupsFilterStringChanged(
const QString &groupsFilterString);
267 Qt::MatchFlags groupsFilterMatchFlags()
const;
268 Q_SLOT
void resetGroupsFilterMatchFlags();
269 Q_SLOT
void setGroupsFilterMatchFlags(Qt::MatchFlags groupsFilterMatchFlags);
270 Q_SIGNAL
void groupsFilterMatchFlagsChanged(Qt::MatchFlags groupsFilterMatchFlags);
272 QString idFilterString()
const;
273 Q_SLOT
void clearIdFilterString();
274 Q_SLOT
void setIdFilterString(
const QString &idFilterString);
275 Q_SIGNAL
void idFilterStringChanged(
const QString &idFilterString);
276 Qt::MatchFlags idFilterMatchFlags()
const;
277 Q_SLOT
void resetIdFilterMatchFlags();
278 Q_SLOT
void setIdFilterMatchFlags(Qt::MatchFlags idFilterMatchFlags);
279 Q_SIGNAL
void idFilterMatchFlagsChanged(Qt::MatchFlags idFilterMatchFlags);
281 Tp::AccountPtr accountFilter()
const;
282 Q_SLOT
void clearAccountFilter();
283 Q_SLOT
void setAccountFilter(
const Tp::AccountPtr &accountFilter);
284 Q_SIGNAL
void accountFilterChanged(
const Tp::AccountPtr &accountFilter);
286 QStringList tubesFilterStrings()
const;
287 Q_SLOT
void clearTubesFilterStrings();
288 Q_SLOT
void setTubesFilterStrings(
const QStringList &tubesFilterStrings);
289 Q_SIGNAL
void tubesFilterStringsChanged(
const QStringList &tubesFilterStrings);
291 QString sortRoleString()
const;
292 Q_SLOT
void setSortRoleString(
const QString &role);
295 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const;
296 bool lessThan (
const QModelIndex &left,
const QModelIndex &right)
const;
297 QModelIndexList match(
const QModelIndex &start,
int role,
298 const QVariant &value,
int hits,
299 Qt::MatchFlags flags)
const;
305 Q_PRIVATE_SLOT(d,
void sourceModelChanged(
const QModelIndex &index))
306 Q_PRIVATE_SLOT(d,
void countContacts(
const QModelIndex &index))
311 #endif // ACCOUNTFILTERMODEL_H