File indexing completed on 2023-11-26 08:16:45
0001 /* 0002 * Copyright (C) 2013 David Edmundson <kde@davidedmundson.co.uk> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0017 */ 0018 0019 #ifndef KTP_TEXT_CHANNEL_WATCHER_PROXY_MODEL_H 0020 #define KTP_TEXT_CHANNEL_WATCHER_PROXY_MODEL_H 0021 0022 #include <TelepathyQt/AbstractClientObserver> 0023 #include <TelepathyQt/TextChannel> 0024 0025 #include <QIdentityProxyModel> 0026 0027 #include <ktpmodels_export.h> 0028 0029 namespace KTp 0030 { 0031 0032 /** This class proxies the ContactsListModel, adding a role for ongoing chats*/ 0033 class KTPMODELS_EXPORT TextChannelWatcherProxyModel : public QIdentityProxyModel, public Tp::AbstractClientObserver 0034 { 0035 Q_OBJECT 0036 public: 0037 explicit TextChannelWatcherProxyModel(QObject *parent=nullptr); 0038 ~TextChannelWatcherProxyModel() override; 0039 0040 void observeChannels(const Tp::MethodInvocationContextPtr<> &context, 0041 const Tp::AccountPtr &account, 0042 const Tp::ConnectionPtr &connection, 0043 const QList<Tp::ChannelPtr> &channels, 0044 const Tp::ChannelDispatchOperationPtr &dispatchOperation, 0045 const QList<Tp::ChannelRequestPtr> &requestsSatisfied, 0046 const Tp::AbstractClientObserver::ObserverInfo &observerInfo) override; 0047 0048 QVariant data(const QModelIndex &proxyIndex, int role) const override; 0049 0050 private Q_SLOTS: 0051 void onChannelMessagesChanged(); 0052 void onChannelInvalidated(); 0053 0054 private: 0055 class Private; 0056 Private *d; 0057 }; 0058 0059 } 0060 0061 #endif // KTP_TEXT_CHANNEL_WATCHER_PROXY_MODEL_H