1 /*
2  * %kadu copyright begin%
3  * Copyright 2012 Bartosz Brachaczek (b.brachaczek@gmail.com)
4  * Copyright 2011, 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 "status/status-changer.h"
24 
25 #include <QtCore/QPointer>
26 #include <injeqt/injeqt.h>
27 
28 class Autoaway;
29 class StatusTypeManager;
30 
31 class AutoawayStatusChanger : public StatusChanger
32 {
33 	Q_OBJECT
34 
35 	friend class Autoaway;
36 
37 public:
38 	enum ChangeStatusTo {
39 		NoChangeStatus,
40 		ChangeStatusToAway,
41 		ChangeStatusToExtendedAway,
42 		ChangeStatusToInvisible,
43 		ChangeStatusToOffline
44 	};
45 
46 	enum ChangeDescriptionTo {
47 		NoChangeDescription,
48 		ChangeDescriptionReplace,
49 		ChangeDescriptionPrepend,
50 		ChangeDescriptionAppend
51 	};
52 
53 	Q_INVOKABLE explicit AutoawayStatusChanger(QObject *parent = nullptr);
54 	virtual ~AutoawayStatusChanger();
55 
56 	virtual void changeStatus(StatusContainer *container, Status &status);
57 
58 	void update();
59 
60 private:
61 	QPointer<Autoaway> m_autoaway;
62 	QPointer<StatusTypeManager> m_statusTypeManager;
63 
64 private slots:
65 	INJEQT_SET void setAutoaway(Autoaway *autoaway);
66 	INJEQT_SET void setStatusTypeManager(StatusTypeManager *statusTypeManager);
67 
68 };
69