File indexing completed on 2023-05-30 11:40:28
0001 /* 0002 Copyright (C) 2011 Martin Klapetek <martin.klapetek@gmail.com> 0003 Copyright (C) 2011 Dario Freddi <dario.freddi@collabora.com> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Lesser General Public 0007 License as published by the Free Software Foundation; either 0008 version 2.1 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Lesser General Public License for more details. 0014 0015 You should have received a copy of the GNU Lesser General Public 0016 License along with this library; if not, write to the Free Software 0017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 0018 */ 0019 0020 0021 #ifndef CONTACT_REQUEST_HANDLER_H 0022 #define CONTACT_REQUEST_HANDLER_H 0023 0024 #include <TelepathyQt/Constants> 0025 #include <TelepathyQt/Types> 0026 #include <TelepathyQt/PendingOperation> 0027 0028 class QMenu; 0029 class KStatusNotifierItem; 0030 class ContactRequestHandler : public QObject 0031 { 0032 Q_OBJECT 0033 public: 0034 explicit ContactRequestHandler(QObject *parent = 0); 0035 virtual ~ContactRequestHandler(); 0036 0037 private Q_SLOTS: 0038 void onNewAccountAdded(const Tp::AccountPtr &account); 0039 void onContactManagerStateChanged(Tp::ContactListState state); 0040 void onContactManagerStateChanged(const Tp::ContactManagerPtr &contactManager, Tp::ContactListState state); 0041 void onAccountsPresenceStatusFiltered(); 0042 void onPresencePublicationRequested(const Tp::Contacts &contacts); 0043 void onConnectionChanged(const Tp::ConnectionPtr &connection); 0044 0045 void onContactRequestApproved(); 0046 void onContactRequestDenied(); 0047 void onShowContactDetails(); 0048 void onAuthorizePresencePublicationFinished(Tp::PendingOperation *op); 0049 void onRemovePresencePublicationFinished(Tp::PendingOperation *op); 0050 void onFinalizeSubscriptionFinished(Tp::PendingOperation *op); 0051 void onContactInvalidated(); 0052 0053 void onNotifierActivated(bool active, const QPoint &pos); 0054 0055 private: 0056 void updateMenus(); 0057 void handleNewConnection(const Tp::ConnectionPtr &connection); 0058 0059 QPointer<KStatusNotifierItem> m_notifierItem; 0060 QHash<QString, Tp::ContactPtr> m_pendingContacts; 0061 QHash<QString, QMenu*> m_menuItems; 0062 }; 0063 0064 #endif // CONTACT_REQUEST_HANDLER_H