Commit 461324a2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to implement settings

parent 69283e33
Pipeline #27496 failed with stage
in 60 minutes and 1 second
set(messageviewer_expireaccounttrashfolderonfigplugin_SRCS
expireaccounttrashfolderconfigplugin.cpp
expireaccounttrashfolderconfigdialog.cpp
expireaccounttrashfolderconfigwidget.cpp
)
kcoreaddons_add_plugin(messageviewer_expireaccounttrashfolderconfigplugin JSON messageviewer_expireaccounttrashfolderconfigplugin.json SOURCES
......
macro(add_messageviewer_expireaccounttrash_verify_unittest _source)
get_filename_component(_name ${_source} NAME_WE)
ecm_add_test(${_source}
TEST_NAME ${_name}
NAME_PREFIX "messageviewer-"
LINK_LIBRARIES KF5::MessageViewer Qt5::Test
)
endmacro ()
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "expireaccounttrashfolderconfigdialog.h"
#include "expireaccounttrashfolderconfigwidget.h"
#include <KLocalizedString>
#include <QVBoxLayout>
#include <QDialogButtonBox>
#include <QDialogButtonBox>
#include <KConfigGroup>
#include <KSharedConfig>
namespace {
static const char myConfigGroupName[] = "ExpireAccountTrashFolderConfigDialog";
}
ExpireAccountTrashFolderConfigDialog::ExpireAccountTrashFolderConfigDialog(QWidget *parent)
: QDialog(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
setWindowTitle(i18nc("@title:window", "Check and update Gravatar"));
mExpireAccountTrashFolderConfig = new ExpireAccountTrashFolderConfigWidget(this);
mExpireAccountTrashFolderConfig->setObjectName(QStringLiteral("mExpireAccountTrashFolderConfig"));
mainLayout->addWidget(mExpireAccountTrashFolderConfig);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok, this);
buttonBox->setObjectName(QStringLiteral("buttonbox"));
connect(buttonBox, &QDialogButtonBox::rejected, this, &ExpireAccountTrashFolderConfigDialog::reject);
mainLayout->addWidget(buttonBox);
readConfig();
}
ExpireAccountTrashFolderConfigDialog::~ExpireAccountTrashFolderConfigDialog()
{
writeConfig();
}
void ExpireAccountTrashFolderConfigDialog::readConfig()
{
KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
const QSize size = grp.readEntry("Size", QSize(300, 200));
if (size.isValid()) {
resize(size);
}
}
void ExpireAccountTrashFolderConfigDialog::writeConfig()
{
KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
grp.writeEntry("Size", size());
grp.sync();
}
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef EXPIREACCOUNTTRASHFOLDERCONFIGDIALOG_H
#define EXPIREACCOUNTTRASHFOLDERCONFIGDIALOG_H
#include <QDialog>
class ExpireAccountTrashFolderConfigWidget;
class ExpireAccountTrashFolderConfigDialog : public QDialog
{
Q_OBJECT
public:
explicit ExpireAccountTrashFolderConfigDialog(QWidget *parent = nullptr);
~ExpireAccountTrashFolderConfigDialog();
private:
void writeConfig();
void readConfig();
ExpireAccountTrashFolderConfigWidget *mExpireAccountTrashFolderConfig = nullptr;
};
#endif // EXPIREACCOUNTTRASHFOLDERCONFIGDIALOG_H
......@@ -18,7 +18,9 @@
*/
#include "expireaccounttrashfolderconfigplugin.h"
#include "expireaccounttrashfolderconfigdialog.h"
#include <KPluginFactory>
#include <QPointer>
K_PLUGIN_CLASS_WITH_JSON(ExpireAccountTrashFolderConfigPlugin, "messageviewer_expireaccounttrashfolderconfigplugin.json")
......@@ -33,9 +35,9 @@ ExpireAccountTrashFolderConfigPlugin::~ExpireAccountTrashFolderConfigPlugin()
void ExpireAccountTrashFolderConfigPlugin::showConfigureDialog(QWidget *parent)
{
// QPointer<ExpireAccountTrashFolderConfigPluginDialog> dlg = new ExpireAccountTrashFolderConfigPluginDialog(parent);
// dlg->exec();
// delete dlg;
QPointer<ExpireAccountTrashFolderConfigDialog> dlg = new ExpireAccountTrashFolderConfigDialog(parent);
dlg->exec();
delete dlg;
}
#include "expireaccounttrashfolderconfigplugin.moc"
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "expireaccounttrashfolderconfigwidget.h"
#include <QVBoxLayout>
ExpireAccountTrashFolderConfigWidget::ExpireAccountTrashFolderConfigWidget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins(0, 0, 0, 0);
//TODO
}
ExpireAccountTrashFolderConfigWidget::~ExpireAccountTrashFolderConfigWidget()
{
}
void ExpireAccountTrashFolderConfigWidget::save()
{
//TODO
}
void ExpireAccountTrashFolderConfigWidget::init()
{
//TODO
}
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef EXPIREACCOUNTTRASHFOLDERCONFIGWIDGET_H
#define EXPIREACCOUNTTRASHFOLDERCONFIGWIDGET_H
#include <QWidget>
class ExpireAccountTrashFolderConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit ExpireAccountTrashFolderConfigWidget(QWidget *parent = nullptr);
~ExpireAccountTrashFolderConfigWidget();
void save();
private:
void init();
};
#endif // EXPIREACCOUNTTRASHFOLDERCONFIGWIDGET_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment