]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.h
Apply 1 suggestion(s) to 1 file(s)
[dolphin.git] / src / dolphinviewcontainer.h
index 9628def633972b3a20763ebff6043bdcb194f685..be28ecdebd71098ae7462740ee861dc688cb6846 100644 (file)
 
 #include <KFileItem>
 #include <KIO/Job>
+#include <KMessageWidget>
 #include <KUrlNavigator>
 
 #include <QElapsedTimer>
 #include <QPushButton>
 #include <QWidget>
 
+#include <initializer_list>
+
 namespace Admin
 {
 class Bar;
 }
 class FilterBar;
-class KMessageWidget;
 class QAction;
 class QGridLayout;
 class QUrl;
@@ -53,8 +55,6 @@ class DolphinViewContainer : public QWidget
     Q_OBJECT
 
 public:
-    enum MessageType { Information, Warning, Error };
-
     DolphinViewContainer(const QUrl &url, QWidget *parent);
     ~DolphinViewContainer() override;
 
@@ -151,10 +151,10 @@ 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<QAction *> buttonActions = {});
 
     /**
      * Refreshes the view container to get synchronized with the (updated) Dolphin settings.
@@ -331,11 +331,6 @@ private Q_SLOTS:
      */
     void showItemInfo(const KFileItem &item);
 
-    /**
-     * Sets the Admin::Bar visible or invisible based on whether \a url is an admin url.
-     */
-    void updateAdminBarVisibility(const QUrl &url);
-
     void closeFilterBar();
 
     /**
@@ -393,9 +388,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
@@ -454,6 +454,8 @@ private:
 
     /// 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;