┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinurlnavigatorscontroller.h
blob: fec15f4811e4743214efdb95d33381bc90f34d4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
    This file is part of the KDE project
    SPDX-FileCopyrightText: 2020 Felix Ernst <[email protected]>

    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/

#ifndef DOLPHINURLNAVIGATORSCONTROLLER_H
#define DOLPHINURLNAVIGATORSCONTROLLER_H

#include <KCompletion>

#include <QObject>

#include <forward_list>

class DolphinUrlNavigator;

/**
 * @brief A controller managing all DolphinUrlNavigators.
 *
 * This class is used to apply settings changes to all constructed DolphinUrlNavigators.
 *
 * @see DolphinUrlNavigator
 */
class DolphinUrlNavigatorsController : public QObject
{
    Q_OBJECT

public:
    DolphinUrlNavigatorsController() = delete;

public Q_SLOTS:
    /**
     * Refreshes all DolphinUrlNavigators to get synchronized with the
     * Dolphin settings if they were changed.
     */
    static void slotReadSettings();

    static void slotPlacesPanelVisibilityChanged(bool visible);

private:
    /**
     * @return whether the places selector of DolphinUrlNavigators should be visible.
     */
    static bool placesSelectorVisible();

    /**
     * Adds \p dolphinUrlNavigator to the list of DolphinUrlNavigators
     * controlled by this class.
     */
    static void registerDolphinUrlNavigator(DolphinUrlNavigator *dolphinUrlNavigator);

    /**
     * Removes \p dolphinUrlNavigator from the list of DolphinUrlNavigators
     * controlled by this class.
     */
    static void unregisterDolphinUrlNavigator(DolphinUrlNavigator *dolphinUrlNavigator);

private Q_SLOTS:
    /**
     * Sets the completion mode for all DolphinUrlNavigators and saves it in settings.
     */
    static void setCompletionMode(const KCompletion::CompletionMode completionMode);

private:
    /** Contains all currently constructed DolphinUrlNavigators */
    static std::forward_list<DolphinUrlNavigator *> s_instances;

    /** Caches the (negated) places panel visibility */
    static bool s_placesSelectorVisible;

    friend class DolphinUrlNavigator;
};

#endif // DOLPHINURLNAVIGATORSCONTROLLER_H