File indexing completed on 2025-01-05 05:23:47
0001 /* 0002 This file is part of the Okteta Kasten Framework, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2009 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 SPDX-FileCopyrightText: 2009, 2012 Alex Richardson <alex.richardson@gmx.de> 0006 0007 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0008 */ 0009 0010 #include "structuresselectiondialog.hpp" 0011 0012 // controller 0013 #include "structureaddremovewidget.hpp" 0014 #include <structureslogging.hpp> 0015 // KF 0016 #include <KLocalizedString> 0017 // Qt 0018 #include <QDialogButtonBox> 0019 #include <QVBoxLayout> 0020 0021 StructuresSelectionDialog::StructuresSelectionDialog(const QMap<QString, Kasten::StructureDefinitionFile*>& structureDefs, 0022 const StructureEnabledList& enabledList, 0023 QWidget* parent) 0024 : QDialog(parent) 0025 { 0026 setAttribute(Qt::WA_DeleteOnClose, true); 0027 0028 setWindowTitle(i18nc("@title:window", "Advanced Structures Selection")); 0029 0030 auto* layout = new QVBoxLayout; 0031 0032 m_structureAddRemoveWidget = new StructureAddRemoveWidget(structureDefs, enabledList, this); 0033 0034 auto* dialogButtonBox = new QDialogButtonBox; 0035 dialogButtonBox->addButton(QDialogButtonBox::Ok); 0036 connect(dialogButtonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); 0037 dialogButtonBox->addButton(QDialogButtonBox::Cancel); 0038 connect(dialogButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); 0039 0040 layout->addWidget(m_structureAddRemoveWidget); 0041 layout->addWidget(dialogButtonBox); 0042 0043 setLayout(layout); 0044 0045 connect(this, &QDialog::finished, this, &StructuresSelectionDialog::onFinished); 0046 } 0047 0048 void StructuresSelectionDialog::onFinished(int result) 0049 { 0050 if (result != QDialog::Accepted) { 0051 return; 0052 } 0053 0054 const QStringList enabledStructures = m_structureAddRemoveWidget->values(); 0055 qCDebug(LOG_KASTEN_OKTETA_CONTROLLERS_STRUCTURES) << "selected " << enabledStructures; 0056 0057 Q_EMIT structuresAccepted(enabledStructures); 0058 } 0059 0060 #include "moc_structuresselectiondialog.cpp"