Commit 547833c0 authored by Laurent Montel's avatar Laurent Montel 😁

Improve plugins

parent d0ed099c
Pipeline #27855 failed with stage
in 67 minutes and 17 seconds
......@@ -44,6 +44,7 @@ ExpireAccountTrashFolderConfigDialog::ExpireAccountTrashFolderConfigDialog(QWidg
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok, this);
buttonBox->setObjectName(QStringLiteral("buttonbox"));
connect(buttonBox, &QDialogButtonBox::rejected, this, &ExpireAccountTrashFolderConfigDialog::reject);
connect(buttonBox, &QDialogButtonBox::accepted, this, &ExpireAccountTrashFolderConfigDialog::accept);
mainLayout->addWidget(buttonBox);
readConfig();
}
......
set(messageviewer_folderconfiguresettingsplugin_SRCS
folderconfiguresettingsplugin.cpp
folderconfiguresettingsdialog.cpp
folderconfiguresettingswidget.cpp
)
kcoreaddons_add_plugin(messageviewer_folderconfiguresettingsplugin JSON messageviewer_folderconfiguresettingsplugin.json SOURCES
......
/*
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 "folderconfiguresettingsdialog.h"
#include <KConfigGroup>
#include <KSharedConfig>
#include <KLocalizedString>
#include <QDialogButtonBox>
#include <QVBoxLayout>
namespace {
static const char myConfigGroupName[] = "FolderConfigureSettingsDialog";
}
FolderConfigureSettingsDialog::FolderConfigureSettingsDialog(QWidget *parent)
: QDialog(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
setWindowTitle(i18nc("@title:window", "Configure Expiry Account Trash Folder"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok, this);
buttonBox->setObjectName(QStringLiteral("buttonbox"));
connect(buttonBox, &QDialogButtonBox::rejected, this, &FolderConfigureSettingsDialog::reject);
connect(buttonBox, &QDialogButtonBox::accepted, this, &FolderConfigureSettingsDialog::accept);
mainLayout->addWidget(buttonBox);
readConfig();
}
FolderConfigureSettingsDialog::~FolderConfigureSettingsDialog()
{
writeConfig();
}
void FolderConfigureSettingsDialog::readConfig()
{
KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
const QSize size = grp.readEntry("Size", QSize(300, 200));
if (size.isValid()) {
resize(size);
}
}
void FolderConfigureSettingsDialog::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 FOLDERCONFIGURESETTINGSDIALOG_H
#define FOLDERCONFIGURESETTINGSDIALOG_H
#include <QDialog>
class FolderConfigureSettingsDialog : public QDialog
{
Q_OBJECT
public:
explicit FolderConfigureSettingsDialog(QWidget *parent = nullptr);
~FolderConfigureSettingsDialog();
private:
void readConfig();
void writeConfig();
};
#endif // FOLDERCONFIGURESETTINGSDIALOG_H
......@@ -34,7 +34,7 @@ FolderConfigureSettingsPlugin::~FolderConfigureSettingsPlugin()
void FolderConfigureSettingsPlugin::showConfigureDialog(QWidget *parent)
{
// QPointer<ExpireAccountTrashFolderConfigDialog> dlg = new ExpireAccountTrashFolderConfigDialog(parent);
// QPointer<FolderConfigureSettingsDialog> dlg = new FolderConfigureSettingsDialog(parent);
// dlg->exec();
// delete dlg;
}
......
/*
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 "folderconfiguresettingswidget.h"
#include <QHBoxLayout>
FolderConfigureSettingsWidget::FolderConfigureSettingsWidget(QWidget *parent)
: QWidget(parent)
{
}
FolderConfigureSettingsWidget::~FolderConfigureSettingsWidget()
{
}
/*
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 FOLDERCONFIGURESETTINGSWIDGET_H
#define FOLDERCONFIGURESETTINGSWIDGET_H
#include <QWidget>
class FolderConfigureSettingsWidget : public QWidget
{
Q_OBJECT
public:
explicit FolderConfigureSettingsWidget(QWidget *parent = nullptr);
~FolderConfigureSettingsWidget();
};
#endif // FOLDERCONFIGURESETTINGSWIDGET_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