]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinview.h
Better separation of classes
[dolphin.git] / src / views / dolphinview.h
index 75c9dd9856a382b9f9e2126b1ad2b66d4218424e..37af971379d429c4cd371882a61d1bb2e096e18c 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <KFileItem>
 #include <KIO/Job>
-#include <config-baloo.h>
+#include "config-dolphin.h"
 #include <kio/fileundomanager.h>
 #include <kparts/part.h>
 
@@ -23,6 +23,8 @@
 #include <QUrl>
 #include <QWidget>
 
+#include <memory>
+
 typedef KIO::FileUndoManager::CommandType CommandType;
 class QVBoxLayout;
 class DolphinItemListView;
@@ -35,6 +37,8 @@ class VersionControlObserver;
 class ViewProperties;
 class QLabel;
 class QGraphicsSceneDragDropEvent;
+class QHelpEvent;
+class QProxyStyle;
 class QRegularExpression;
 
 /**
@@ -105,8 +109,11 @@ public:
      * (GeneralSettings::globalViewProps() returns false), then the
      * changed view mode will be stored automatically.
      */
-    void setMode(Mode mode);
-    Mode mode() const;
+    void setViewMode(Mode mode);
+    Mode viewMode() const;
+
+    void setSelectionMode(bool enabled);
+    bool selectionMode() const;
 
     /**
      * Turns on the file preview for the all files of the current directory,
@@ -425,13 +432,13 @@ Q_SIGNALS:
     /**
      * Is emitted when clicking on an item with the left mouse button.
      */
-    void itemActivated(const KFileItemitem);
+    void itemActivated(const KFileItem &item);
 
     /**
      * Is emitted when multiple items have been activated by e. g.
      * context menu open with.
      */
-    void itemsActivated(const KFileItemListitems);
+    void itemsActivated(const KFileItemList &items);
 
     /**
      * Is emitted if items have been added or deleted.
@@ -443,6 +450,16 @@ Q_SIGNALS:
      */
     void tabRequested(const QUrl& url);
 
+    /**
+     * Is emitted if a new tab should be opened for the URL \a url and set as active.
+     */
+    void activeTabRequested(const QUrl &url);
+
+    /**
+     * Is emitted if a new window should be opened for the URL \a url.
+     */
+    void windowRequested(const QUrl &url);
+
     /**
      * Is emitted if the view mode (IconsView, DetailsView,
      * PreviewsView) has been changed.
@@ -458,7 +475,7 @@ Q_SIGNALS:
     /** Is emitted if the 'grouped sorting' property has been changed. */
     void groupedSortingChanged(bool groupedSorting);
 
-    /** Is emmited in reaction to a requestStatusBarText() call.
+    /** Is emitted in reaction to a requestStatusBarText() call.
      * @see requestStatusBarText() */
     void statusBarTextChanged(QString statusBarText);
 
@@ -500,13 +517,12 @@ Q_SIGNALS:
     /**
      * Is emitted if a context menu is requested for the item \a item,
      * which is part of \a url. If the item is null, the context menu
-     * for the URL should be shown and the custom actions \a customActions
-     * will be added.
+     * for the URL should be shown.
      */
     void requestContextMenu(const QPoint& pos,
                             const KFileItem& item,
-                            const QUrl& url,
-                            const QList<QAction*>& customActions);
+                            const KFileItemList &selectedItems,
+                            const QUrl& url);
 
     /**
      * Is emitted if an information message with the content \a msg
@@ -589,6 +605,13 @@ Q_SIGNALS:
      */
     void goForwardRequested();
 
+    /**
+     * Is emitted when the selection mode is requested for the current view.
+     * This typically happens on press and hold.
+     * @see KItemListController::longPress()
+     */
+    void selectionModeRequested();
+
     /**
      * Is emitted when the user wants to move the focus to another view.
      */
@@ -619,12 +642,13 @@ private Q_SLOTS:
     void activate();
 
     void slotItemActivated(int index);
-    void slotItemsActivated(const KItemSetindexes);
+    void slotItemsActivated(const KItemSet &indexes);
     void slotItemMiddleClicked(int index);
     void slotItemContextMenuRequested(int index, const QPointF& pos);
     void slotViewContextMenuRequested(const QPointF& pos);
     void slotHeaderContextMenuRequested(const QPointF& pos);
     void slotHeaderColumnWidthChangeFinished(const QByteArray& role, qreal current);
+    void slotSidePaddingWidthChanged(qreal width);
     void slotItemHovered(int index);
     void slotItemUnhovered(int index);
     void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
@@ -852,6 +876,8 @@ private:
 
     void updatePlaceholderLabel();
 
+    void tryShowNameToolTip(QHelpEvent* event);
+
 private:
     void updatePalette();
     void showLoadingPlaceholder();
@@ -862,7 +888,14 @@ private:
     bool m_isFolderWritable;
     bool m_dragging; // True if a dragging is done. Required to be able to decide whether a
                      // tooltip may be shown when hovering an item.
-    bool m_loading;
+
+    enum class LoadingState {
+        Idle,
+        Loading,
+        Canceled,
+        Completed
+    };
+    LoadingState m_loadingState = LoadingState::Idle;
 
     QUrl m_url;
     QString m_viewPropertiesContext;
@@ -896,9 +929,13 @@ private:
     QLabel* m_placeholderLabel;
     QTimer* m_showLoadingPlaceholderTimer;
 
+    /// Used for selection mode. @see setSelectionMode()
+    std::unique_ptr<QProxyStyle> m_proxyStyle;
+
     // For unit tests
     friend class TestBase;
     friend class DolphinDetailsViewTest;
+    friend class DolphinMainWindowTest;
     friend class DolphinPart;                   // Accesses m_model
 };