1 /*
2  * %kadu copyright begin%
3  * Copyright 2011 Piotr Galiszewski (piotr.galiszewski@kadu.im)
4  * Copyright 2012 Wojciech Treter (juzefwt@gmail.com)
5  * Copyright 2012 Piotr Dąbrowski (ultr@ultr.pl)
6  * Copyright 2011, 2014 Bartosz Brachaczek (b.brachaczek@gmail.com)
7  * Copyright 2011, 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
8  * %kadu copyright end%
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License as
12  * published by the Free Software Foundation; either version 2 of
13  * the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #pragma once
25 
26 #include "docking-exports.h"
27 
28 #include <QtCore/QObject>
29 #include <QtCore/QPointer>
30 #include <QtWidgets/QSystemTrayIcon>
31 #include <injeqt/injeqt.h>
32 
33 class AttentionService;
34 class ChatWidgetManager;
35 class Configuration;
36 class DockingConfigurationProvider;
37 class IconsManager;
38 class PluginInjectedFactory;
39 class KaduWindowService;
40 class SessionService;
41 class StatusContainerManager;
42 class StatusNotifierItem;
43 class UnreadMessageRepository;
44 
45 class DOCKINGAPI Docking final : public QObject
46 {
47 	Q_OBJECT
48 
49 public:
50 	Q_INVOKABLE Docking(QObject *parent = nullptr);
51 	virtual ~Docking();
52 
53 	void showMessage(QString title, QString message, QSystemTrayIcon::MessageIcon icon, int msecs);
54 
55 signals:
56 	void messageClicked();
57 
58 private:
59 	QPointer<ChatWidgetManager> m_chatWidgetManager;
60 	QPointer<Configuration> m_configuration;
61 	QPointer<DockingConfigurationProvider> m_dockingConfigurationProvider;
62 	QPointer<IconsManager> m_iconsManager;
63 	QPointer<PluginInjectedFactory> m_pluginInjectedFactory;
64 	QPointer<KaduWindowService> m_kaduWindowService;
65 	QPointer<SessionService> m_sessionService;
66 	QPointer<StatusContainerManager> m_statusContainerManager;
67 	QPointer<StatusNotifierItem> m_statusNotifierItem;
68 	QPointer<UnreadMessageRepository> m_unreadMessageRepository;
69 
70 	void openUnreadMessages();
71 
72 private slots:
73 	INJEQT_SET void setAttentionService(AttentionService *attentionService);
74 	INJEQT_SET void setChatWidgetManager(ChatWidgetManager *chatWidgetManager);
75 	INJEQT_SET void setConfiguration(Configuration *configuration);
76 	INJEQT_SET void setDockingConfigurationProvider(DockingConfigurationProvider *dockingConfigurationProvider);
77 	INJEQT_SET void setIconsManager(IconsManager *iconsManager);
78 	INJEQT_SET void setPluginInjectedFactory(PluginInjectedFactory *pluginInjectedFactory);
79 	INJEQT_SET void setKaduWindowService(KaduWindowService *kaduWindowService);
80 	INJEQT_SET void setSessionService(SessionService *sessionService);
81 	INJEQT_SET void setStatusContainerManager(StatusContainerManager *statusContainerManager);
82 	INJEQT_SET void setStatusNotifierItem(StatusNotifierItem *statusNotifierItem);
83 	INJEQT_SET void setUnreadMessageRepository(UnreadMessageRepository *unreadMessageRepository);
84 	INJEQT_INIT void init();
85 
86 	void configurationUpdated();
87 	void needAttentionChanged(bool needAttention);
88 	void activateRequested();
89 
90 };
91