X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/38c34eeca315c7be58e65d4d3fb72aaf7b866719..dd07a327:/src/dolphinviewcontainer.h diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index 7d5e87c32..a509bab3d 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -14,26 +14,26 @@ #include #include +#include #include #include #include #include -#if HAVE_KACTIVITIES -namespace KActivities +#include + +namespace Admin { -class ResourceInstance; +class Bar; } -#endif - class FilterBar; -class KMessageWidget; class QAction; class QGridLayout; class QUrl; class DolphinSearchBox; class DolphinStatusBar; +class KFileItemList; namespace SelectionMode { class TopBar; @@ -56,8 +56,6 @@ class DolphinViewContainer : public QWidget Q_OBJECT public: - enum MessageType { Information, Warning, Error }; - DolphinViewContainer(const QUrl &url, QWidget *parent); ~DolphinViewContainer() override; @@ -66,6 +64,7 @@ public: * The URL navigator is synchronized with this URL. */ QUrl url() const; + KFileItem rootItem() const; /** * If \a active is true, the view container will marked as active. The active @@ -153,17 +152,18 @@ public: bool isSelectionModeEnabled() const; /** - * Shows the message \msg with the given type non-modal above - * the view-content. + * Shows the message \message with the given type \messageType non-modal above the view-content. + * \buttonActions defines actions which the user can trigger as a response to this message. They are presented as buttons below the \message. */ - void showMessage(const QString &msg, MessageType type); + void showMessage(const QString &message, KMessageWidget::MessageType messageType, std::initializer_list buttonActions = {}); /** * Refreshes the view container to get synchronized with the (updated) Dolphin settings. */ void readSettings(); - /** Returns true, if the filter bar is visible. */ + /** @returns true, if the filter bar is visible. + * false, if it is hidden or currently animating towards a hidden state. */ bool isFilterBarVisible() const; /** Returns true if the search mode is enabled. */ @@ -284,10 +284,6 @@ private Q_SLOTS: */ void updateStatusBar(); - void updateDirectoryLoadingProgress(int percent); - - void updateDirectorySortingProgress(int percent); - /** * Updates the statusbar to show an undetermined progress with the correct * context information whether a searching or a directory loading is done. @@ -325,6 +321,11 @@ private Q_SLOTS: */ void slotItemsActivated(const KFileItemList &items); + /** + * Handles middle click of file. It opens the file passed using the second application associated with the file's mimetype. + */ + void slotfileMiddleClickActivated(const KFileItem &item); + /** * Shows the information for the item \a item inside the statusbar. If the * item is null, the default statusbar information is shown. @@ -376,6 +377,7 @@ private Q_SLOTS: * Gets the search URL from the searchbox and starts searching. */ void startSearching(); + void openSearchBox(); void closeSearchBox(); /** @@ -387,9 +389,14 @@ private Q_SLOTS: void slotStatusBarZoomLevelChanged(int zoomLevel); /** - * Slot that calls showMessage(msg, Error). + * Creates and shows an error message based on \p message and \p kioErrorCode. + */ + void slotErrorMessageFromView(const QString &message, const int kioErrorCode); + + /** + * Slot that calls showMessage(message, KMessageWidget::Error). */ - void showErrorMessage(const QString &msg); + void showErrorMessage(const QString &message); /** * Is invoked when a KFilePlacesModel has been changed @@ -426,6 +433,19 @@ private: */ QString getNearestExistingAncestorOfPath(const QString &path) const; + /** + * Update the geometry of statusbar depending on what mode it is using. + */ + void updateStatusBarGeometry(); + + /** + * @return Preferred geometry of the small statusbar. + */ + QRect preferredSmallStatusBarGeometry(); + +protected: + bool eventFilter(QObject *object, QEvent *event) override; + private: QGridLayout *m_topLayout; @@ -446,6 +466,11 @@ private: DolphinSearchBox *m_searchBox; bool m_searchModeEnabled; + /// A bar shown at the top of the view to signify that the view is currently viewed and acted on with elevated privileges. + Admin::Bar *m_adminBar; + /// An action to switch to the admin protocol. This variable will always be nullptr unless kio-admin was installed. @see Admin::WorkerIntegration. + QAction *m_authorizeToEnterFolderAction; + KMessageWidget *m_messageWidget; /// A bar shown at the top of the view to signify that selection mode is currently active. @@ -467,11 +492,6 @@ private: * connected to this ViewContainer. */ std::unique_ptr m_urlNavigatorVisualState; - -#if HAVE_KACTIVITIES -private: - KActivities::ResourceInstance *m_activityResourceInstance; -#endif }; #endif // DOLPHINVIEWCONTAINER_H