1 /* 2 * %kadu copyright begin% 3 * Copyright 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com) 4 * %kadu copyright end% 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #pragma once 21 22 #include "configuration/configuration-aware-object.h" 23 24 #include <QtCore/QObject> 25 #include <QtCore/QPointer> 26 #include <injeqt/injeqt.h> 27 28 class QAction; 29 30 class ActionDescription; 31 class Actions; 32 class Action; 33 class Buddy; 34 class ChatConfigurationHolder; 35 class ChatWidgetManager; 36 class Configuration; 37 class EditTalkableAction; 38 class InjectedFactory; 39 class LeaveChatAction; 40 class MenuInventory; 41 class Myself; 42 class OpenChatWithService; 43 44 class ChatWidgetActions : public QObject, ConfigurationAwareObject 45 { 46 Q_OBJECT 47 48 QPointer<Actions> m_actions; 49 QPointer<ChatConfigurationHolder> m_chatConfigurationHolder; 50 QPointer<ChatWidgetManager> m_chatWidgetManager; 51 QPointer<Configuration> m_configuration; 52 QPointer<InjectedFactory> m_injectedFactory; 53 QPointer<MenuInventory> m_menuInventory; 54 QPointer<Myself> m_myself; 55 QPointer<OpenChatWithService> m_openChatWithService; 56 57 ActionDescription *MoreActions; 58 ActionDescription *AutoSend; 59 ActionDescription *ClearChat; 60 ActionDescription *InsertImage; 61 ActionDescription *Bold; 62 ActionDescription *Italic; 63 ActionDescription *Underline; 64 ActionDescription *Send; 65 ActionDescription *BlockUser; 66 ActionDescription *OpenChat; 67 ActionDescription *OpenWith; 68 // ActionDescription *ColorSelector; 69 70 EditTalkableAction *EditTalkable; 71 LeaveChatAction *LeaveChat; 72 73 void autoSendActionCheck(); 74 void updateBlockingActions(Buddy buddy); 75 76 private slots: 77 INJEQT_SET void setActions(Actions *actions); 78 INJEQT_SET void setChatConfigurationHolder(ChatConfigurationHolder *chatConfigurationHolder); 79 INJEQT_SET void setChatWidgetManager(ChatWidgetManager *chatWidgetManager); 80 INJEQT_SET void setConfiguration(Configuration *configuration); 81 INJEQT_SET void setInjectedFactory(InjectedFactory *injectedFactory); 82 INJEQT_SET void setMenuInventory(MenuInventory *menuInventory); 83 INJEQT_SET void setMyself(Myself *myself); 84 INJEQT_SET void setOpenChatWithService(OpenChatWithService *openChatWithService); 85 INJEQT_INIT void init(); 86 INJEQT_DONE void done(); 87 88 void autoSendActionCreated(Action *action); 89 void clearChatActionCreated(Action *action); 90 void sendActionCreated(Action *action); 91 92 void moreActionsActionActivated(QAction *sender, bool toggled); 93 void autoSendActionActivated(QAction *sender, bool toggled); 94 void clearActionActivated(QAction *sender, bool toggled); 95 void insertImageActionActivated(QAction *sender, bool toggled); 96 void boldActionActivated(QAction *sender, bool toggled); 97 void italicActionActivated(QAction *sender, bool toggled); 98 void underlineActionActivated(QAction *sender, bool toggled); 99 void sendActionActivated(QAction *sender, bool toggled); 100 void blockUserActionActivated(QAction *sender, bool toggled); 101 void openChatActionActivated(QAction *sender, bool toggled); 102 void openChatWithActionActivated(QAction *sender, bool toggled); 103 void colorSelectorActionActivated(QAction *sender, bool toogled); 104 105 protected: 106 virtual void configurationUpdated(); 107 108 public: 109 Q_INVOKABLE explicit ChatWidgetActions(QObject *parent = nullptr); 110 virtual ~ChatWidgetActions(); 111 bold()112 ActionDescription * bold() const { return Bold; } italic()113 ActionDescription * italic() const { return Italic; } underline()114 ActionDescription * underline() const { return Underline; } send()115 ActionDescription * send() const { return Send; } blockUser()116 ActionDescription * blockUser() const { return BlockUser; } openChatWith()117 ActionDescription * openChatWith() const { return OpenWith; } 118 // ActionDescription * colorSelector() { return ColorSelector; } 119 120 }; 121