]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/places/placesitemmodel.h
Provide default view properties for system-places
[dolphin.git] / src / panels / places / placesitemmodel.h
index c0ff2e9c5a025f203d96047954f7d76abc6ea923..0f8f3025d8c1a12fe1b85f1616ec3cd6d8ec73de 100644 (file)
@@ -37,6 +37,16 @@ class PlacesItem;
 class QAction;
 class QTimer;
 
+#ifdef HAVE_NEPOMUK
+    namespace Nepomuk
+    {
+        namespace Query
+        {
+            class Term;
+        }
+    }
+#endif
+
 // #define PLACESITEMMODEL_DEBUG
 
 /**
@@ -95,6 +105,14 @@ public:
     void requestEject(int index);
     void requestTeardown(int index);
 
+    /**
+     * @return Converts the URL, which contains "virtual" URLs for system-items like
+     *         "search:/documents" into a Nepomuk-Query-URL that will be handled by
+     *         the corresponding IO-slave. Virtual URLs for bookmarks are used to
+     *         be independent from internal format changes.
+     */
+    static KUrl convertedUrl(const KUrl& url);
+
 signals:
     void errorMessage(const QString& message);
 
@@ -124,6 +142,8 @@ private slots:
     void saveBookmarks();
 
 private:
+    struct SystemBookmarkData;
+
     /**
      * Loads the bookmarks from the bookmark-manager and creates items for
      * the model or moves hidden items to m_bookmarkedItems.
@@ -137,6 +157,14 @@ private:
      */
     bool acceptBookmark(const KBookmark& bookmark) const;
 
+    /**
+     * Creates a PlacesItem for a system-bookmark:
+     * - PlacesItem::isSystemItem() will return true
+     * - Default view-properties will be created for "Search For" items
+     * The item is not inserted to the model yet.
+     */
+    PlacesItem* createSystemPlacesItem(const SystemBookmarkData& data);
+
     /**
      * Creates system bookmarks that are shown per default and can
      * only be hidden but not removed. The result will be stored
@@ -171,6 +199,34 @@ private:
      */
     static bool equalBookmarkIdentifiers(const KBookmark& b1, const KBookmark& b2);
 
+    /**
+     * @return URL using the timeline-protocol for searching (see convertedUrl()).
+     */
+    static KUrl createTimelineUrl(const KUrl& url);
+
+    /**
+     * Helper method for createTimelineUrl().
+     * @return String that represents a date-path in the format that
+     *         the timeline-protocol expects.
+     */
+    static QString timelineDateString(int year, int month, int day = 0);
+
+    /**
+     * @return URL that can be listed by KIO and results in searching
+     *         for a given term. The URL \a url represents a places-internal
+     *         URL like e.g. "search:/documents" (see convertedUrl()).
+     */
+    static KUrl createSearchUrl(const KUrl& url);
+
+#ifdef HAVE_NEPOMUK
+    /**
+     * Helper method for createSearchUrl().
+     * @return URL that can be listed by KIO and results in searching
+     *         for the given term.
+     */
+    static KUrl searchUrlForTerm(const Nepomuk::Query::Term& term);
+#endif
+
 #ifdef PLACESITEMMODEL_DEBUG
     void showModelState();
 #endif