diff options
| author | Peter Penz <[email protected]> | 2012-04-24 23:16:35 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-04-24 23:18:34 +0200 |
| commit | d9de39172033c28b8f9a7c1573130cf2124b4f7a (patch) | |
| tree | 8292181d95b92f9a5cb9544bd62d83ca8189c1a1 /src/panels/places/placespanel.h | |
| parent | ba2593247b7f11c68419bf1fc24cc5ddcaf8e69f (diff) | |
Provide additional default groups for the Places Panel
If Nepomuk is enabled, it is now possible to easily search for
some most common queries by having additional groups.
Diffstat (limited to 'src/panels/places/placespanel.h')
| -rw-r--r-- | src/panels/places/placespanel.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h index 80cb732f0..ea05601e0 100644 --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -21,13 +21,28 @@ #ifndef PLACESPANEL_H #define PLACESPANEL_H +#include <config-nepomuk.h> + +#include <KUrl> #include <panels/panel.h> +#include <QHash> +#include <QList> #include <QSet> class KBookmarkManager; class KItemListController; class KStandardItemModel; +#ifdef HAVE_NEPOMUK +namespace Nepomuk +{ + namespace Query + { + class Term; + } +} +#endif + /** * @brief Combines bookmarks and mounted devices as list. */ @@ -50,16 +65,67 @@ protected: private slots: void slotItemActivated(int index); void slotItemMiddleClicked(int index); + void slotItemContextMenuRequested(int index, const QPointF& pos); + void slotViewContextMenuRequested(const QPointF& pos); void slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent); private: + void createDefaultBookmarks(); void loadBookmarks(); + KUrl urlForIndex(int index) const; + + /** + * @return URL using the timeline-protocol for searching. + */ + 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" + */ + 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 private: + bool m_nepomukRunning; + KItemListController* m_controller; KStandardItemModel* m_model; + QSet<QString> m_availableDevices; KBookmarkManager* m_bookmarkManager; + + struct DefaultBookmarkData + { + DefaultBookmarkData(const KUrl& url, + const QString& icon, + const QString& text, + const QString& group) : + url(url), icon(icon), text(text), group(group) {} + KUrl url; + QString icon; + QString text; + QString group; + }; + + QList<DefaultBookmarkData> m_defaultBookmarks; + QHash<KUrl, int> m_defaultBookmarksIndexes; }; #endif // PLACESPANEL_H |
