File indexing completed on 2024-05-05 05:53:55
0001 /* 0002 SPDX-FileCopyrightText: 2019 Mariusz Glebocki <mglb@arccos-1.net> 0003 0004 Based on KConfigDialog and KConfigDialogManager from KConfigWidgets 0005 0006 SPDX-FileCopyrightText: 2003 Benjamin C Meyer (ben+kdelibs at meyerhome dot net) 0007 SPDX-FileCopyrightText: 2003 Waldo Bastian <bastian@kde.org> 0008 0009 SPDX-License-Identifier: GPL-2.0-or-later 0010 */ 0011 0012 #ifndef CONFIGURATIONDIALOG_H 0013 #define CONFIGURATIONDIALOG_H 0014 0015 // Qt 0016 0017 // KDE 0018 #include <KCoreConfigSkeleton> 0019 #include <KPageDialog> 0020 0021 // Konsole 0022 #include "konsoleapp_export.h" 0023 0024 class QWidget; 0025 class KConfigDialogManager; 0026 0027 namespace Konsole 0028 { 0029 class ConfigDialogButtonGroupManager; 0030 0031 // KConfigDialog-like class, as the original KConfigDialog wraps 0032 // all pages in QScrollArea. KConfigDialog, when fixed, should 0033 // be source compatible with this class, so simple class replace 0034 // should suffice. 0035 class KONSOLEAPP_EXPORT ConfigurationDialog : public KPageDialog 0036 { 0037 Q_OBJECT 0038 0039 Q_SIGNALS: 0040 void widgetModified(); 0041 void settingsChanged(); 0042 0043 public: 0044 explicit ConfigurationDialog(QWidget *parent, KCoreConfigSkeleton *config); 0045 ~ConfigurationDialog() override = default; 0046 0047 void addPage(KPageWidgetItem *item, bool manage); 0048 0049 protected Q_SLOTS: 0050 void updateButtons(); 0051 void settingsChangedSlot(); 0052 0053 protected: 0054 void setApplyButtonEnabled(bool enabled); 0055 void setRestoreDefaultsButtonEnabled(bool enabled); 0056 void showEvent(QShowEvent *event) override; 0057 0058 private: 0059 Q_DISABLE_COPY(ConfigurationDialog) 0060 0061 KConfigDialogManager *_manager = nullptr; 0062 ConfigDialogButtonGroupManager *_groupManager = nullptr; 0063 bool _shown = false; 0064 }; 0065 0066 } 0067 0068 #endif // CONFIGURATIONDIALOG_H