File indexing completed on 2024-04-21 05:45:43
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2020 Felix Ernst <felixernst@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #ifndef DOLPHINURLNAVIGATORSCONTROLLER_H 0009 #define DOLPHINURLNAVIGATORSCONTROLLER_H 0010 0011 #include <KCompletion> 0012 0013 #include <QObject> 0014 0015 #include <forward_list> 0016 0017 class DolphinUrlNavigator; 0018 0019 /** 0020 * @brief A controller managing all DolphinUrlNavigators. 0021 * 0022 * This class is used to apply settings changes to all constructed DolphinUrlNavigators. 0023 * 0024 * @see DolphinUrlNavigator 0025 */ 0026 class DolphinUrlNavigatorsController : public QObject 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 DolphinUrlNavigatorsController() = delete; 0032 0033 public Q_SLOTS: 0034 /** 0035 * Refreshes all DolphinUrlNavigators to get synchronized with the 0036 * Dolphin settings if they were changed. 0037 */ 0038 static void slotReadSettings(); 0039 0040 static void slotPlacesPanelVisibilityChanged(bool visible); 0041 0042 private: 0043 /** 0044 * @return whether the places selector of DolphinUrlNavigators should be visible. 0045 */ 0046 static bool placesSelectorVisible(); 0047 0048 /** 0049 * Adds \p dolphinUrlNavigator to the list of DolphinUrlNavigators 0050 * controlled by this class. 0051 */ 0052 static void registerDolphinUrlNavigator(DolphinUrlNavigator *dolphinUrlNavigator); 0053 0054 /** 0055 * Removes \p dolphinUrlNavigator from the list of DolphinUrlNavigators 0056 * controlled by this class. 0057 */ 0058 static void unregisterDolphinUrlNavigator(DolphinUrlNavigator *dolphinUrlNavigator); 0059 0060 private Q_SLOTS: 0061 /** 0062 * Sets the completion mode for all DolphinUrlNavigators and saves it in settings. 0063 */ 0064 static void setCompletionMode(const KCompletion::CompletionMode completionMode); 0065 0066 private: 0067 /** Contains all currently constructed DolphinUrlNavigators */ 0068 static std::forward_list<DolphinUrlNavigator *> s_instances; 0069 0070 /** Caches the (negated) places panel visibility */ 0071 static bool s_placesSelectorVisible; 0072 0073 friend class DolphinUrlNavigator; 0074 }; 0075 0076 #endif // DOLPHINURLNAVIGATORSCONTROLLER_H