File indexing completed on 2024-12-22 04:45:57
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "exportdataselectaccountpage.h" 0008 #include "exportdataselectaccountlistwidget.h" 0009 #include <KLocalizedString> 0010 #include <QLabel> 0011 #include <QVBoxLayout> 0012 0013 ExportDataSelectAccountPage::ExportDataSelectAccountPage(QWidget *parent) 0014 : QWizardPage(parent) 0015 , mExportDataSelectAccountListWidget(new ExportDataSelectAccountListWidget(this)) 0016 { 0017 auto mainLayout = new QVBoxLayout(this); 0018 mainLayout->setObjectName(QStringLiteral("mainLayout")); 0019 0020 auto label = new QLabel(i18n("Select Accounts:"), this); 0021 label->setObjectName(QStringLiteral("label")); 0022 mainLayout->addWidget(label); 0023 0024 mExportDataSelectAccountListWidget->setObjectName(QStringLiteral("mExportDataSelectAccountListWidget")); 0025 mainLayout->addWidget(mExportDataSelectAccountListWidget); 0026 connect(mExportDataSelectAccountListWidget, &ExportDataSelectAccountListWidget::selectedItemChanged, this, [this]() { 0027 Q_EMIT completeChanged(); 0028 }); 0029 } 0030 0031 ExportDataSelectAccountPage::~ExportDataSelectAccountPage() = default; 0032 0033 void ExportDataSelectAccountPage::setAccountList(const QVector<ImportExportUtils::AccountImportExportInfo> &lst) 0034 { 0035 mExportDataSelectAccountListWidget->setAccountList(lst); 0036 } 0037 0038 QVector<ImportExportUtils::AccountImportExportInfo> ExportDataSelectAccountPage::selectedAccounts() const 0039 { 0040 return mExportDataSelectAccountListWidget->selectedAccounts(); 0041 } 0042 0043 bool ExportDataSelectAccountPage::validatePage() 0044 { 0045 return !mExportDataSelectAccountListWidget->selectedAccounts().isEmpty(); 0046 } 0047 0048 bool ExportDataSelectAccountPage::isComplete() const 0049 { 0050 return !mExportDataSelectAccountListWidget->selectedAccounts().isEmpty(); 0051 } 0052 0053 #include "moc_exportdataselectaccountpage.cpp"