File indexing completed on 2025-03-09 04:56:50
0001 /* 0002 * SPDX-FileCopyrightText: 2014 Kevin Ottens <ervin@kde.org> 0003 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 0007 0008 #ifndef WIDGETS_NAMEANDDATASOURCEDIALOG_H 0009 #define WIDGETS_NAMEANDDATASOURCEDIALOG_H 0010 0011 #include <QDialog> 0012 0013 #include "widgets/nameanddatasourcedialoginterface.h" 0014 0015 class QModelIndex; 0016 class KDescendantsProxyModel; 0017 0018 namespace Ui { 0019 class NameAndDataSourceDialog; 0020 } 0021 0022 namespace Widgets { 0023 0024 class NameAndDataSourceDialog : public QDialog, public NameAndDataSourceDialogInterface 0025 { 0026 Q_OBJECT 0027 public: 0028 explicit NameAndDataSourceDialog(QWidget *parent = nullptr); 0029 ~NameAndDataSourceDialog(); 0030 0031 int exec() override; 0032 0033 void accept() override; 0034 0035 void setWindowTitle(const QString &title) override; 0036 void setDataSourcesModel(QAbstractItemModel *model) override; 0037 0038 QString name() const override; 0039 Domain::DataSource::Ptr dataSource() const override; 0040 0041 private slots: 0042 void onUserInputChanged(); 0043 0044 private: 0045 void applyDefaultSource(const QModelIndex &root); 0046 0047 Ui::NameAndDataSourceDialog *ui; 0048 KDescendantsProxyModel *m_flattenProxy; 0049 QString m_name; 0050 Domain::DataSource::Ptr m_source; 0051 }; 0052 0053 } 0054 0055 #endif // WIDGETS_NAMEANDDATASOURCEDIALOG_H