diff options
| author | Peter Penz <[email protected]> | 2012-05-13 21:44:58 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-05-13 21:45:59 +0200 |
| commit | 1426b8d3c785e47fab6312e9d01a21dc265aadb8 (patch) | |
| tree | 0841edf580583a7589a7874978a00d579ea793bb /src/panels/places/placesitem.h | |
| parent | 6039c246eacf69ac3a219d00ba1dd56e44fc6685 (diff) | |
Places Panel: Prepare code to save state of bookmarks
The saving is still disabled currently until 100 % backward
compatibility with KFilePlacesView has been reached.
Diffstat (limited to 'src/panels/places/placesitem.h')
| -rw-r--r-- | src/panels/places/placesitem.h | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/panels/places/placesitem.h b/src/panels/places/placesitem.h index 878d14a7d..c21a8ca9a 100644 --- a/src/panels/places/placesitem.h +++ b/src/panels/places/placesitem.h @@ -20,6 +20,7 @@ #ifndef PLACESITEM_H #define PLACESITEM_H +#include <KBookmark> #include <kitemviews/kstandarditem.h> #include <KUrl> #include <QPointer> @@ -28,7 +29,6 @@ #include <Solid/StorageAccess> #include <Solid/StorageVolume> -class KBookmark; class PlacesItemStorageAccessListener; /** @@ -38,10 +38,8 @@ class PlacesItem : public KStandardItem { public: - explicit PlacesItem(PlacesItem* parent = 0); explicit PlacesItem(const KBookmark& bookmark, PlacesItem* parent = 0); - explicit PlacesItem(const QString& udi, PlacesItem* parent = 0); - PlacesItem(const PlacesItem& item); + explicit PlacesItem(const PlacesItem& item); virtual ~PlacesItem(); void setUrl(const KUrl& url); @@ -53,8 +51,30 @@ public: void setHidden(bool hidden); bool isHidden() const; + void setSystemItem(bool isSystemItem); + bool isSystemItem() const; + Solid::Device device() const; + void setBookmark(const KBookmark& bookmark); + KBookmark bookmark() const; + + static KBookmark createBookmark(KBookmarkManager* manager, + const QString& text, + const KUrl& url, + const QString& iconName, + PlacesItem* after = 0); + static KBookmark createDeviceBookmark(KBookmarkManager* manager, + const QString& udi); + +protected: + virtual void onDataValueChanged(const QByteArray& role, + const QVariant& current, + const QVariant& previous); + + virtual void onDataChanged(const QHash<QByteArray, QVariant>& current, + const QHash<QByteArray, QVariant>& previous); + private: void initializeDevice(const QString& udi); @@ -64,12 +84,20 @@ private: */ void onAccessibilityChanged(); + /** + * Applies the data-value from the role to m_bookmark. + */ + void updateBookmarkForRole(const QByteArray& role); + + static QString generateNewId(); + private: Solid::Device m_device; QPointer<Solid::StorageAccess> m_access; QPointer<Solid::StorageVolume> m_volume; QPointer<Solid::OpticalDisc> m_disc; - PlacesItemStorageAccessListener* m_accessListener; + QPointer<PlacesItemStorageAccessListener> m_accessListener; + KBookmark m_bookmark; friend class PlacesItemStorageAccessListener; // Calls onAccessibilityChanged() }; |
