]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/places/placesitemsignalhandler.h
Build with QT_NO_KEYWORDS
[dolphin.git] / src / panels / places / placesitemsignalhandler.h
1 /*
2 * SPDX-FileCopyrightText: 2012 Peter Penz <peter.penz19@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef PLACESITEMSIGNALHANDLER_H
8 #define PLACESITEMSIGNALHANDLER_H
9
10 #include <QObject>
11
12 class PlacesItem;
13
14 /**
15 * @brief Helper class for PlacesItem to be able to listen to signals
16 * and performing a corresponding action.
17 *
18 * PlacesItem is derived from KStandardItem, which is no QObject-class
19 * on purpose. To be able to internally listen to signals and performing a
20 * corresponding action, PlacesItemSignalHandler is used.
21 *
22 * E.g. if the PlacesItem wants to react on accessibility-changes of a storage-access,
23 * the signal-handler can be used like this:
24 * <code>
25 * QObject::connect(storageAccess, SIGNAL(accessibilityChanged(bool,QString)),
26 * signalHandler, SLOT(onAccessibilityChanged()));
27 * </code>
28 *
29 * The slot PlacesItemSignalHandler::onAccessibilityChanged() will call
30 * the method PlacesItem::onAccessibilityChanged().
31 */
32 class PlacesItemSignalHandler: public QObject
33 {
34 Q_OBJECT
35
36 public:
37 explicit PlacesItemSignalHandler(PlacesItem* item, QObject* parent = nullptr);
38 ~PlacesItemSignalHandler() override;
39
40 public Q_SLOTS:
41 /**
42 * Calls PlacesItem::onAccessibilityChanged()
43 */
44 void onAccessibilityChanged();
45
46 void onTearDownRequested(const QString& udi);
47
48 void onTrashEmptinessChanged(bool isTrashEmpty);
49
50 Q_SIGNALS:
51 void tearDownExternallyRequested(const QString& udi);
52
53 private:
54 PlacesItem* m_item;
55 };
56
57 #endif