X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/2d4d2ce9a14902ee5a2b236f8510596fc2f86b99..64f38f89a63c7afe5fbd5181f9de65c4b3be48b7:/src/dolphinurlnavigator.h diff --git a/src/dolphinurlnavigator.h b/src/dolphinurlnavigator.h index a15428799..d6da51b47 100644 --- a/src/dolphinurlnavigator.h +++ b/src/dolphinurlnavigator.h @@ -1,6 +1,6 @@ /* This file is part of the KDE project - SPDX-FileCopyrightText: 2020 Felix Ernst + SPDX-FileCopyrightText: 2020 Felix Ernst SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ @@ -15,8 +15,9 @@ * * Makes sure that Dolphin preferences and settings are * applied to all constructed DolphinUrlNavigators. - * * @see KUrlNavigator + * + * To apply changes to all instances of this class @see DolphinUrlNavigatorsController. */ class DolphinUrlNavigator : public KUrlNavigator { @@ -35,7 +36,7 @@ public: */ DolphinUrlNavigator(const QUrl &url, QWidget *parent = nullptr); - virtual ~DolphinUrlNavigator(); + ~DolphinUrlNavigator() override; // TODO: Fix KUrlNavigator::sizeHint() instead. QSize sizeHint() const override; @@ -55,6 +56,9 @@ public: /** * Retrieve the visual state of this DolphinUrlNavigator. * If two DolphinUrlNavigators have the same visual state they should look identical. + * + * @return a copy of the visualState of this object. Ownership of this copy is transferred + * to the caller via std::unique_ptr. */ std::unique_ptr visualState() const; /** @@ -62,12 +66,44 @@ public: */ void setVisualState(const VisualState &visualState); -public slots: + /** + * Clears the text in the text field + */ + void clearText() const; + + /** + * Displays placeholder text in the URL navigator + */ + void setPlaceholderText(const QString &text); + + /** + * Sets the visibility of the read-only badge at the end of the breadcrumb. + */ + void setReadOnlyBadgeVisible(bool visible); + + /** + * Returns the visibility of the read-only badge at the end of the breadcrumb. + */ + bool readOnlyBadgeVisible() const; + +public Q_SLOTS: /** * Switches to "breadcrumb" mode if the editable mode is not set to be * preferred in the Dolphin settings. */ void slotReturnPressed(); + +Q_SIGNALS: + /** + * Escape was pressed, and the focus should return to the view. + */ + void requestToLoseFocus(); + +protected: + /** + * Return focus back to the view when pressing Escape and this would have no other effect (e.g. deselecting or changing edit mode). + */ + void keyPressEvent(QKeyEvent *keyEvent) override; }; #endif // DOLPHINURLNAVIGATOR_H