File indexing completed on 2025-03-09 04:54:37
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "remotecontentdialog.h" 0008 #include "remotecontentwidget.h" 0009 #include <QDialogButtonBox> 0010 #include <QPushButton> 0011 #include <QVBoxLayout> 0012 using namespace MessageViewer; 0013 RemoteContentDialog::RemoteContentDialog(QWidget *parent) 0014 : QDialog(parent) 0015 , mRemoveContentWidget(new RemoteContentWidget(this)) 0016 { 0017 auto mainLayout = new QVBoxLayout(this); 0018 mainLayout->setObjectName(QLatin1StringView("mainLayout")); 0019 0020 mRemoveContentWidget->setObjectName(QLatin1StringView("mRemoveContentWidget")); 0021 mainLayout->addWidget(mRemoveContentWidget); 0022 0023 auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); 0024 buttonBox->setObjectName(QLatin1StringView("buttonBox")); 0025 connect(buttonBox, &QDialogButtonBox::accepted, this, &RemoteContentDialog::accept); 0026 connect(buttonBox, &QDialogButtonBox::rejected, this, &RemoteContentDialog::reject); 0027 mainLayout->addWidget(buttonBox); 0028 QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); 0029 okButton->setEnabled(false); 0030 connect(mRemoveContentWidget, &RemoteContentWidget::updateOkButton, this, [okButton](bool enabled) { 0031 okButton->setEnabled(enabled); 0032 }); 0033 } 0034 0035 RemoteContentDialog::~RemoteContentDialog() = default; 0036 0037 RemoteContentInfo RemoteContentDialog::info() const 0038 { 0039 return mRemoveContentWidget->info(); 0040 } 0041 0042 void RemoteContentDialog::setInfo(const RemoteContentInfo &info) 0043 { 0044 mRemoveContentWidget->setInfo(info); 0045 } 0046 0047 #include "moc_remotecontentdialog.cpp"