]>
cloud.milkyroute.net Git - dolphin.git/blob - src/panels/places/placesitem.h
1 /***************************************************************************
2 * Copyright (C) 2012 by Peter Penz <peter.penz19@gmail.com> *
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. *
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. *
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 ***************************************************************************/
23 #include "kitemviews/kstandarditem.h"
26 #include <Solid/Device>
27 #include <Solid/OpticalDisc>
28 #include <Solid/PortableMediaPlayer>
29 #include <Solid/StorageAccess>
30 #include <Solid/StorageVolume>
37 class PlacesItemSignalHandler
;
40 * @brief Extends KStandardItem by places-specific properties.
42 class PlacesItem
: public KStandardItem
46 explicit PlacesItem(const KBookmark
& bookmark
, PlacesItem
* parent
= nullptr);
47 ~PlacesItem() override
;
49 void setUrl(const QUrl
& url
);
52 void setUdi(const QString
& udi
);
55 void setHidden(bool hidden
);
56 bool isHidden() const;
58 void setGroupHidden(bool hidden
);
59 bool isGroupHidden() const;
61 void setSystemItem(bool isSystemItem
);
62 bool isSystemItem() const;
64 Solid::Device
device() const;
66 void setBookmark(const KBookmark
& bookmark
);
67 KBookmark
bookmark() const;
69 bool storageSetupNeeded() const;
71 bool isSearchOrTimelineUrl() const;
73 PlacesItemSignalHandler
* signalHandler() const;
76 void onDataValueChanged(const QByteArray
& role
,
77 const QVariant
& current
,
78 const QVariant
& previous
) override
;
80 void onDataChanged(const QHash
<QByteArray
, QVariant
>& current
,
81 const QHash
<QByteArray
, QVariant
>& previous
) override
;
84 PlacesItem(const PlacesItem
& item
);
86 void initializeDevice(const QString
& udi
);
89 * Is invoked if the accessibility of the storage access
90 * m_access has been changed and updates the emblem.
92 void onAccessibilityChanged();
95 * Applies the data-value from the role to m_bookmark.
97 void updateBookmarkForRole(const QByteArray
& role
);
99 static QString
generateNewId();
102 Solid::Device m_device
;
103 QPointer
<Solid::StorageAccess
> m_access
;
104 QPointer
<Solid::StorageVolume
> m_volume
;
105 QPointer
<Solid::OpticalDisc
> m_disc
;
106 QPointer
<Solid::PortableMediaPlayer
> m_mtp
;
107 QPointer
<PlacesItemSignalHandler
> m_signalHandler
;
108 QPointer
<KDirLister
> m_trashDirLister
;
109 KBookmark m_bookmark
;
111 friend class PlacesItemSignalHandler
; // Calls onAccessibilityChanged()