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