1 /* 2 * %kadu copyright begin% 3 * Copyright 2011 Bartosz Brachaczek (b.brachaczek@gmail.com) 4 * Copyright 2011, 2012, 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com) 5 * %kadu copyright end% 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation; either version 2 of 10 * the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #pragma once 22 23 #include "url-handlers/url-handler.h" 24 25 #include <QtCore/QObject> 26 #include <QtCore/QPointer> 27 #include <QtCore/QRegExp> 28 #include <injeqt/injeqt.h> 29 30 class AccountManager; 31 class ChatManager; 32 class ChatStorage; 33 class ChatWidgetManager; 34 class ContactManager; 35 class IconsManager; 36 37 class QAction; 38 39 class JabberUrlHandler : public QObject, public UrlHandler 40 { 41 Q_OBJECT 42 43 public: 44 Q_INVOKABLE explicit JabberUrlHandler(QObject *parent = nullptr); 45 virtual ~JabberUrlHandler(); 46 47 virtual bool isUrlValid(const QByteArray &url); 48 virtual void openUrl(UrlOpener *urlOpener, const QByteArray &url, bool disableMenu = false); 49 50 private: 51 QPointer<AccountManager> m_accountManager; 52 QPointer<ChatManager> m_chatManager; 53 QPointer<ChatStorage> m_chatStorage; 54 QPointer<ChatWidgetManager> m_chatWidgetManager; 55 QPointer<ContactManager> m_contactManager; 56 QPointer<IconsManager> m_iconsManager; 57 58 QRegExp m_jabberRegExp; 59 60 private slots: 61 INJEQT_SET void setAccountManager(AccountManager *accountManager); 62 INJEQT_SET void setChatManager(ChatManager *chatManager); 63 INJEQT_SET void setChatStorage(ChatStorage *chatStorage); 64 INJEQT_SET void setChatWidgetManager(ChatWidgetManager *chatWidgetManager); 65 INJEQT_SET void setContactManager(ContactManager *contactManager); 66 INJEQT_SET void setIconsManager(IconsManager *iconsManager); 67 68 void accountSelected(QAction *action); 69 70 }; 71