folderconfiguresettingspagebase.cpp 1.24 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
2
3
4
5
6
7
8
/*
   SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>

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

#include "folderconfiguresettingspagebase.h"

Laurent Montel's avatar
Laurent Montel committed
9
10
11
12
13
#include <KLocalizedString>

#include <QCheckBox>
#include <QVBoxLayout>

Laurent Montel's avatar
Laurent Montel committed
14
15
FolderConfigureSettingsPageBase::FolderConfigureSettingsPageBase(QWidget *parent)
    : QWidget(parent)
Laurent Montel's avatar
Laurent Montel committed
16
    , mMainLayout(new QVBoxLayout(this))
Laurent Montel's avatar
Laurent Montel committed
17
{
Laurent Montel's avatar
Laurent Montel committed
18
    mMainLayout->setObjectName(QStringLiteral("mMainLayout"));
Laurent Montel's avatar
Laurent Montel committed
19
    mModifyCheckBox = new QCheckBox(i18n("Modify"), this);
Laurent Montel's avatar
Laurent Montel committed
20
21
    mModifyCheckBox->setObjectName(QStringLiteral("mModifiedCheckBox"));
    mModifyCheckBox->setChecked(false);
22
    mMainLayout->addWidget(mModifyCheckBox);
Laurent Montel's avatar
Laurent Montel committed
23
    connect(mModifyCheckBox, &QCheckBox::clicked, this, &FolderConfigureSettingsPageBase::slotModifyClicked);
Laurent Montel's avatar
Laurent Montel committed
24
25
26
27
28
29
}

FolderConfigureSettingsPageBase::~FolderConfigureSettingsPageBase()
{

}
Laurent Montel's avatar
Laurent Montel committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

void FolderConfigureSettingsPageBase::slotModifyClicked(bool clicked)
{
    mMainWidget->setEnabled(clicked);
}

bool FolderConfigureSettingsPageBase::wasModified() const
{
    return mModifyCheckBox->isChecked();
}

void FolderConfigureSettingsPageBase::addMainWidget(QWidget *widget)
{
    mMainWidget = widget;
    mMainLayout->addWidget(mMainWidget);
    mMainWidget->setEnabled(false); //Disable it directly
}