]>
cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinurlnavigator.h
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2020 Felix Ernst <felixernst@kde.org>
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8 #ifndef DOLPHINURLNAVIGATOR_H
9 #define DOLPHINURLNAVIGATOR_H
11 #include <KUrlNavigator>
14 * @brief Extends KUrlNavigator in a Dolphin-specific way.
16 * Makes sure that Dolphin preferences and settings are
17 * applied to all constructed DolphinUrlNavigators.
20 * To apply changes to all instances of this class @see DolphinUrlNavigatorsController.
22 class DolphinUrlNavigator
: public KUrlNavigator
28 * Applies all Dolphin-specific settings to a KUrlNavigator
29 * @see KUrlNavigator::KurlNavigator()
31 DolphinUrlNavigator(QWidget
*parent
= nullptr);
34 * Applies all Dolphin-specific settings to a KUrlNavigator
35 * @see KUrlNavigator::KurlNavigator()
37 DolphinUrlNavigator(const QUrl
&url
, QWidget
*parent
= nullptr);
39 ~DolphinUrlNavigator() override
;
41 // TODO: Fix KUrlNavigator::sizeHint() instead.
42 QSize
sizeHint() const override
;
45 * Wraps the visual state of a DolphinUrlNavigator so it can be passed around.
46 * This notably doesn't involve the locationUrl or history.
57 * Retrieve the visual state of this DolphinUrlNavigator.
58 * If two DolphinUrlNavigators have the same visual state they should look identical.
60 * @return a copy of the visualState of this object. Ownership of this copy is transferred
61 * to the caller via std::unique_ptr.
63 std::unique_ptr
<VisualState
> visualState() const;
65 * @param visualState A struct describing the new visual state of this object.
67 void setVisualState(const VisualState
&visualState
);
70 * Clears the text in the text field
72 void clearText() const;
75 * Displays placeholder text in the URL navigator
77 void setPlaceholderText(const QString
&text
);
80 * Sets the visibility of the read-only badge at the end of the breadcrumb.
82 void setReadOnlyBadgeVisible(bool visible
);
85 * Returns the visibility of the read-only badge at the end of the breadcrumb.
87 bool readOnlyBadgeVisible() const;
91 * Switches to "breadcrumb" mode if the editable mode is not set to be
92 * preferred in the Dolphin settings.
94 void slotReturnPressed();
98 * Escape was pressed, and the focus should return to the view.
100 void requestToLoseFocus();
104 * Return focus back to the view when pressing Escape and this would have no other effect (e.g. deselecting or changing edit mode).
106 void keyPressEvent(QKeyEvent
*keyEvent
) override
;
109 #endif // DOLPHINURLNAVIGATOR_H