]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.h
Ported to KBookmarkManager::closestBookmark - which even solves another TODO about...
[dolphin.git] / src / dolphinview.h
index cffa52880d5722095c716f6fac543bca5a0c9d78..14c8372d3e64de9ad7cb343718a3128c1f464229 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <kparts/part.h>
 #include <kfileitem.h>
+#include <kfileitemdelegate.h>
 #include <kfileiconview.h>
 #include <kio/job.h>
 
@@ -38,6 +39,7 @@
 
 class DolphinController;
 class FilterBar;
+class KFileItemDelegate;
 class KUrl;
 class KDirModel;
 class UrlNavigator;
@@ -209,19 +211,11 @@ public:
      */
     void setUrlEditable(bool editable);
 
-    /**
-     * Returns the complete URL history. The index 0 indicates the oldest
-     * history element.
-     * @param index     Output parameter which indicates the current
-     *                  index of the location.
-     */
-    const QLinkedList<UrlNavigator::HistoryElem> urlHistory(int& index) const;
-
-    /**
-     * Returns true, if at least one item is selected.
-     */
+    /** Returns true, if at least one item is selected. */
     bool hasSelection() const;
 
+    void clearSelection();
+
     /**
      * Returns the selected items. The list is empty if no item has been
      * selected.
@@ -248,7 +242,6 @@ public:
      */
     void rename(const KUrl& source, const QString& newName);
 
-    /** Returns the status bar of the view. */
     DolphinStatusBar* statusBar() const;
 
     /**
@@ -301,6 +294,12 @@ public:
     /** Returns the current used sort order (Qt::Ascending or Qt::Descending). */
     Qt::SortOrder sortOrder() const;
 
+    /** Sets the additional information which should be shown for the items. */
+    void setAdditionalInfo(KFileItemDelegate::AdditionalInformation info);
+
+    /** Returns the additional information which should be shown for the items. */
+    KFileItemDelegate::AdditionalInformation additionalInfo() const;
+
     /** Refreshs the view settings by reading out the stored settings. */
     void refreshSettings();
 
@@ -346,6 +345,14 @@ public slots:
      */
     void requestActivation();
 
+    /**
+     * Request of a selection change. The view will do its best to accomodate
+     * the request, but it is not guaranteed that all items in \a selection
+     * will actually get selected. The view will e.g. not select items which
+     * are not in the currently displayed folder.
+     */
+    void changeSelection(const KFileItemList& selection);
+
 signals:
     /** Is emitted if URL of the view has been changed to \a url. */
     void urlChanged(const KUrl& url);
@@ -368,6 +375,9 @@ signals:
     /** Is emitted if the sort order (ascending or descending) has been changed. */
     void sortOrderChanged(Qt::SortOrder order);
 
+    /** Is emitted if the addtional information for an item has been changed. */
+    void additionalInfoChanged(KFileItemDelegate::AdditionalInformation info);
+
     /**
      * Is emitted if information of an item is requested to be shown e. g. in the sidebar.
      * It the URL is empty, no item information request is pending.
@@ -378,11 +388,9 @@ signals:
     void contentsMoved(int x, int y);
 
     /**
-     * Is emitted whenever the selection has been changed. The current selection can
-     * be retrieved by mainWindow()->activeView()->selectedItems() or by
-     * mainWindow()->activeView()->selectedUrls().
+     * Is emitted whenever the selection has been changed.
      */
-    void selectionChanged();
+    void selectionChanged(const KFileItemList& selection);
 
     /**
      * Is emitted whenever the filter bar has been turned show or hidden.
@@ -404,6 +412,19 @@ private slots:
      */
     void updateItemCount();
 
+    /**
+     * Generates a preview image for each file item in \a items.
+     * The current preview settings (maximum size, 'Show Preview' menu)
+     * are respected.
+     */
+    void generatePreviews(const KFileItemList& items);
+
+    /**
+     * Replaces the icon of the item \a item by the preview pixmap
+     * \a pixmap.
+     */
+    void showPreview(const KFileItem* item, const QPixmap& pixmap);
+
     /**
      * Restores the x- and y-position of the contents if the
      * current view is part of the history.
@@ -433,12 +454,12 @@ private slots:
     void openContextMenu(const QPoint& pos);
 
     /**
-     * Drops the URLs \a urls at the position \a pos.
-     * The position is used to check whether the dropping
-     * is done above an item or above the viewport.
+     * Drops the URLs \a urls to the index \a index. \a source
+     * indicates the widget where the dragging has been started from.
      */
     void dropUrls(const KUrl::List& urls,
-                  const QPoint& pos);
+                  const QModelIndex& index,
+                  QWidget* source);
 
     /**
      * Drops the URLs \a urls at the
@@ -470,6 +491,9 @@ private slots:
      */
     void updateActivationState();
 
+    /** Applies an item effect to all cut items of the clipboard. */
+    void updateCutItems();
+
 private:
     void startDirLister(const KUrl& url, bool reload = false);
 
@@ -486,7 +510,7 @@ private:
     QString selectionStatusBarText() const;
 
     /**
-     * Creates a new view representing the given view mode (DolphinView::viewMode()).
+     * Creates a new view representing the given view mode (DolphinView::mode()).
      * The current view will get deleted.
      */
     void createView();
@@ -503,8 +527,33 @@ private:
      */
     QAbstractItemView* itemView() const;
 
+    /**
+     * Returns true if the index is valid and represents
+     * the column KDirModel::Name.
+     */
+    bool isValidNameIndex(const QModelIndex& index) const;
+
+    /**
+     * Returns true, if the item \a item has been cut into
+     * the clipboard.
+     */
+    bool isCutItem(const KFileItem& item) const;
+
+    /** Applies an item effect to all cut items. */
+    void applyCutItemEffect();
+
 private:
+    /**
+     * Remembers the original pixmap for an item before
+     * the cut effect is applied.
+     */
+    struct CutItem {
+        KUrl url;
+        QPixmap pixmap;
+    };
+
     bool m_showProgress;
+    bool m_blockContentsMovedSignal;
     Mode m_mode;
 
     int m_iconSize;
@@ -518,6 +567,7 @@ private:
     DolphinController* m_controller;
     DolphinIconsView* m_iconsView;
     DolphinDetailsView* m_detailsView;
+    KFileItemDelegate* m_fileItemDelegate;
 
     FilterBar* m_filterBar;
     DolphinStatusBar* m_statusBar;
@@ -525,6 +575,8 @@ private:
     KDirModel* m_dirModel;
     DolphinDirLister* m_dirLister;
     DolphinSortFilterProxyModel* m_proxyModel;
+
+    QList<CutItem> m_cutItemsCache;
 };
 
 #endif // _DOLPHINVIEW_H_