X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/f65b0899c3666561cafac14f67ab0bb8a5bfa00a..40cc5f665d:/src/views/dolphinview.h diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index be8263917..2ecd75957 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -14,7 +14,7 @@ #include #include -#include +#include "config-dolphin.h" #include #include @@ -23,6 +23,8 @@ #include #include +#include + 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,14 @@ 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; + + /** + * Enables or disables a mode for quick and easy selection of items. + */ + void setSelectionModeEnabled(bool enabled); + bool selectionMode() const; /** * Turns on the file preview for the all files of the current directory, @@ -206,6 +216,10 @@ public: void setSortFoldersFirst(bool foldersFirst); bool sortFoldersFirst() const; + /** Sets a separate sorting with hidden files and folders last (true) or not (false). */ + void setSortHiddenLast(bool hiddenLast); + bool sortHiddenLast() const; + /** Sets the additional information which should be shown for the items. */ void setVisibleRoles(const QList& roles); @@ -421,13 +435,13 @@ Q_SIGNALS: /** * Is emitted when clicking on an item with the left mouse button. */ - void itemActivated(const KFileItem& item); + void itemActivated(const KFileItem &item); /** * Is emitted when multiple items have been activated by e. g. * context menu open with. */ - void itemsActivated(const KFileItemList& items); + void itemsActivated(const KFileItemList &items); /** * Is emitted if items have been added or deleted. @@ -439,6 +453,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. @@ -454,7 +478,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); @@ -470,6 +494,11 @@ Q_SIGNALS: */ void sortFoldersFirstChanged(bool foldersFirst); + /** + * Is emitted if the sorting of hidden files has been changed. + */ + void sortHiddenLastChanged(bool hiddenLast); + /** Is emitted if the additional information shown for this view has been changed. */ void visibleRolesChanged(const QList& current, const QList& previous); @@ -491,13 +520,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& customActions); + const KFileItemList &selectedItems, + const QUrl& url); /** * Is emitted if an information message with the content \a msg @@ -580,6 +608,13 @@ Q_SIGNALS: */ void goForwardRequested(); + /** + * Used to request either entering or leaving of selection mode + * Entering is typically requested on press and hold. + * Leaving by pressing Escape when no item is selected. + */ + void selectionModeChangeRequested(bool enabled); + /** * Is emitted when the user wants to move the focus to another view. */ @@ -593,6 +628,8 @@ Q_SIGNALS: void goUpRequested(); + void fileItemsChanged(const KFileItemList &changedFileItems); + protected: /** Changes the zoom level if Control is pressed during a wheel event. */ void wheelEvent(QWheelEvent* event) override; @@ -608,12 +645,13 @@ private Q_SLOTS: void activate(); void slotItemActivated(int index); - void slotItemsActivated(const KItemSet& indexes); + 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); @@ -677,6 +715,12 @@ private Q_SLOTS: */ void updateSortFoldersFirst(bool foldersFirst); + /** + * Updates the view properties of the current URL to the + * sorting of hidden files given by \a hiddenLast. + */ + void updateSortHiddenLast(bool hiddenLast); + /** * Indicates in the status bar that the delete operation * of the job \a job has been finished. @@ -835,8 +879,11 @@ private: void updatePlaceholderLabel(); + void tryShowNameToolTip(QHelpEvent* event); + private: void updatePalette(); + void showLoadingPlaceholder(); bool m_active; bool m_tabsForFiles; @@ -844,7 +891,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; @@ -876,10 +930,15 @@ private: QTimer* m_twoClicksRenamingTimer; QUrl m_twoClicksRenamingItemUrl; QLabel* m_placeholderLabel; + QTimer* m_showLoadingPlaceholderTimer; + + /// Used for selection mode. @see setSelectionMode() + std::unique_ptr m_proxyStyle; // For unit tests friend class TestBase; friend class DolphinDetailsViewTest; + friend class DolphinMainWindowTest; friend class DolphinPart; // Accesses m_model };