remotecontentdialog.cpp 1.61 KB
Newer Older
1
2
3
4
5
6
7
/*
   SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>

   SPDX-License-Identifier: LGPL-2.0-or-later
*/

#include "remotecontentdialog.h"
8
#include "remotecontentwidget.h"
9
10
#include <KLocalizedString>
#include <QDialogButtonBox>
Laurent Montel's avatar
Laurent Montel committed
11
#include <QPushButton>
12
13
14
15
#include <QVBoxLayout>
using namespace MessageViewer;
RemoteContentDialog::RemoteContentDialog(QWidget *parent)
    : QDialog(parent)
16
    , mRemoveContentWidget(new RemoteContentWidget(this))
17
{
Laurent Montel's avatar
Laurent Montel committed
18
    setWindowTitle(i18nc("@title:window", "Edit Remote Content"));
19
20
    auto mainLayout = new QVBoxLayout(this);
    mainLayout->setObjectName(QStringLiteral("mainLayout"));
21
22
23
24

    mRemoveContentWidget->setObjectName(QStringLiteral("mRemoveContentWidget"));
    mainLayout->addWidget(mRemoveContentWidget);

25
26
27
28
29
    auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
    buttonBox->setObjectName(QStringLiteral("buttonBox"));
    connect(buttonBox, &QDialogButtonBox::accepted, this, &RemoteContentDialog::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &RemoteContentDialog::reject);
    mainLayout->addWidget(buttonBox);
Laurent Montel's avatar
Laurent Montel committed
30
31
32
33
34
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setEnabled(false);
    connect(mRemoveContentWidget, &RemoteContentWidget::updateOkButton, this, [okButton](bool enabled) {
        okButton->setEnabled(enabled);
    });
35
36
37
38
39
}

RemoteContentDialog::~RemoteContentDialog()
{
}
40
41
42
43
44

RemoteContentInfo RemoteContentDialog::info() const
{
    return mRemoveContentWidget->info();
}
Laurent Montel's avatar
Laurent Montel committed
45
46
47
48
49

void RemoteContentDialog::setInfo(const RemoteContentInfo &info)
{
    mRemoveContentWidget->setInfo(info);
}