]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/places/placesitem.h
Merge remote-tracking branch 'origin/Applications/17.12'
[dolphin.git] / src / panels / places / placesitem.h
index fc6a5f0786a353ac544a932d80275175970d66cd..b7cd8e79f514e5e7643087b22c1755a6ceb73582 100644 (file)
 
 #include <KBookmark>
 #include <kitemviews/kstandarditem.h>
-#include <KUrl>
+#include <QUrl>
 #include <QPointer>
 #include <Solid/Device>
 #include <Solid/OpticalDisc>
 #include <Solid/StorageAccess>
 #include <Solid/StorageVolume>
+#include <Solid/PortableMediaPlayer>
 
-class PlacesItemStorageAccessListener;
+class KDirLister;
+class PlacesItemSignalHandler;
 
 /**
  * @brief Extends KStandardItem by places-specific properties.
@@ -38,12 +40,19 @@ class PlacesItem : public KStandardItem
 {
 
 public:
-    explicit PlacesItem(const KBookmark& bookmark, PlacesItem* parent = 0);
-    explicit PlacesItem(const PlacesItem& item);
-    virtual ~PlacesItem();
+    enum GroupType
+    {
+        PlacesType,
+        SearchForType,
+        RecentlySavedType,
+        DevicesType
+    };
 
-    void setUrl(const KUrl& url);
-    KUrl url() const;
+    explicit PlacesItem(const KBookmark& bookmark, PlacesItem* parent = nullptr);
+    ~PlacesItem() override;
+
+    void setUrl(const QUrl& url);
+    QUrl url() const;
 
     void setUdi(const QString& udi);
     QString udi() const;
@@ -59,30 +68,44 @@ public:
     void setBookmark(const KBookmark& bookmark);
     KBookmark bookmark() const;
 
+    GroupType groupType() const;
+
+    bool storageSetupNeeded() const;
+
     static KBookmark createBookmark(KBookmarkManager* manager,
                                     const QString& text,
-                                    const KUrl& url,
+                                    const QUrl& url,
                                     const QString& iconName);
     static KBookmark createDeviceBookmark(KBookmarkManager* manager,
                                           const QString& udi);
 
+    PlacesItemSignalHandler* signalHandler() const;
+
 protected:
-    virtual void onDataValueChanged(const QByteArray& role,
+    void onDataValueChanged(const QByteArray& role,
                                     const QVariant& current,
-                                    const QVariant& previous);
+                                    const QVariant& previous) override;
 
-    virtual void onDataChanged(const QHash<QByteArray, QVariant>& current,
-                               const QHash<QByteArray, QVariant>& previous);
+    void onDataChanged(const QHash<QByteArray, QVariant>& current,
+                               const QHash<QByteArray, QVariant>& previous) override;
 
 private:
+    PlacesItem(const PlacesItem& item);
+
     void initializeDevice(const QString& udi);
 
     /**
-     * Is invoked by m_accessListener if the accessibility
-     * of the storage access m_access has been changed.
+     * Is invoked if the accessibility of the storage access
+     * m_access has been changed and updates the emblem.
      */
     void onAccessibilityChanged();
 
+    /**
+     * Is invoked if the listing of the trash has been completed.
+     * Updates the state of the trash-icon to be empty or full.
+     */
+    void onTrashDirListerCompleted();
+
     /**
      * Applies the data-value from the role to m_bookmark.
      */
@@ -95,10 +118,12 @@ private:
     QPointer<Solid::StorageAccess> m_access;
     QPointer<Solid::StorageVolume> m_volume;
     QPointer<Solid::OpticalDisc> m_disc;
-    QPointer<PlacesItemStorageAccessListener> m_accessListener;
+    QPointer<Solid::PortableMediaPlayer> m_mtp;
+    QPointer<PlacesItemSignalHandler> m_signalHandler;
+    QPointer<KDirLister> m_trashDirLister;
     KBookmark m_bookmark;
 
-    friend class PlacesItemStorageAccessListener; // Calls onAccessibilityChanged()
+    friend class PlacesItemSignalHandler; // Calls onAccessibilityChanged()
 };
 
 #endif