]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/places/placesitemsignalhandler.h
Merge branch 'Applications/18.04'
[dolphin.git] / src / panels / places / placesitemsignalhandler.h
1 /***************************************************************************
2 * Copyright (C) 2012 by Peter Penz <peter.penz19@gmail.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #ifndef PLACESITEMSIGNALHANDLER_H
21 #define PLACESITEMSIGNALHANDLER_H
22
23 #include <QObject>
24
25 class PlacesItem;
26
27 /**
28 * @brief Helper class for PlacesItem to be able to listen to signals
29 * and performing a corresponding action.
30 *
31 * PlacesItem is derived from KStandardItem, which is no QObject-class
32 * on purpose. To be able to internally listen to signals and performing a
33 * corresponding action, PlacesItemSignalHandler is used.
34 *
35 * E.g. if the PlacesItem wants to react on accessibility-changes of a storage-access,
36 * the signal-handler can be used like this:
37 * <code>
38 * QObject::connect(storageAccess, SIGNAL(accessibilityChanged(bool,QString)),
39 * signalHandler, SLOT(onAccessibilityChanged()));
40 * </code>
41 *
42 * The slot PlacesItemSignalHandler::onAccessibilityChanged() will call
43 * the method PlacesItem::onAccessibilityChanged().
44 */
45 class PlacesItemSignalHandler: public QObject
46 {
47 Q_OBJECT
48
49 public:
50 explicit PlacesItemSignalHandler(PlacesItem* item, QObject* parent = nullptr);
51 ~PlacesItemSignalHandler() override;
52
53 public slots:
54 /**
55 * Calls PlacesItem::onAccessibilityChanged()
56 */
57 void onAccessibilityChanged();
58
59 void onTearDownRequested(const QString& udi);
60
61 void onTrashEmptinessChanged(bool isTrashEmpty);
62
63 signals:
64 void tearDownExternallyRequested(const QString& udi);
65
66 private:
67 PlacesItem* m_item;
68 };
69
70 #endif