Commit 49da8a54 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix save/load settings

parent aaa66405
Pipeline #62554 passed with stage
in 22 minutes and 43 seconds
......@@ -8,8 +8,10 @@
#include "kmail-version.h"
#include "mailmergeconfigurewidget.h"
#include <KAboutData>
#include <KConfigGroup>
#include <KHelpMenu>
#include <KLocalizedString>
#include <KSharedConfig>
#include <QApplication>
#include <QDialogButtonBox>
#include <QIcon>
......@@ -17,6 +19,11 @@
#include <QPushButton>
#include <QVBoxLayout>
namespace
{
static const char myConfigureMailMergeConfigureDialogGroupName[] = "MailMergeConfigureDialog";
}
MailMergeConfigureDialog::MailMergeConfigureDialog(QWidget *parent)
: QDialog(parent)
, mWidget(new MailMergeConfigureWidget(this))
......@@ -34,7 +41,7 @@ MailMergeConfigureDialog::MailMergeConfigureDialog(QWidget *parent)
// connect(mWidget, &SendLaterWidget::sendNow, this, &SendLaterConfigureDialog::sendNow);
mainLayout->addWidget(mWidget);
mainLayout->addWidget(buttonBox);
// connect(okButton, &QPushButton::clicked, this, &SendLaterConfigureDialog::slotSave);
connect(okButton, &QPushButton::clicked, this, &MailMergeConfigureDialog::slotSave);
// readConfig();
......@@ -60,3 +67,23 @@ MailMergeConfigureDialog::MailMergeConfigureDialog(QWidget *parent)
MailMergeConfigureDialog::~MailMergeConfigureDialog()
{
}
void MailMergeConfigureDialog::slotSave()
{
// TODO
}
void MailMergeConfigureDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), myConfigureMailMergeConfigureDialogGroupName);
const QSize sizeDialog = group.readEntry("Size", QSize(800, 600));
if (sizeDialog.isValid()) {
resize(sizeDialog);
}
}
void MailMergeConfigureDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), myConfigureMailMergeConfigureDialogGroupName);
group.writeEntry("Size", size());
}
......@@ -15,5 +15,8 @@ public:
explicit MailMergeConfigureDialog(QWidget *parent = nullptr);
~MailMergeConfigureDialog() override;
private:
void slotSave();
void writeConfig();
void readConfig();
MailMergeConfigureWidget *const mWidget;
};
......@@ -17,6 +17,10 @@
#include <QDialogButtonBox>
#include <QIcon>
#include <QMenu>
namespace
{
static const char myConfigureSendLaterConfigureDialogGroupName[] = "SendLaterConfigureDialog";
}
SendLaterConfigureDialog::SendLaterConfigureDialog(QWidget *parent)
: QDialog(parent)
......@@ -81,7 +85,7 @@ void SendLaterConfigureDialog::slotNeedToReloadConfig()
void SendLaterConfigureDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "SendLaterConfigureDialog");
KConfigGroup group(KSharedConfig::openStateConfig(), myConfigureSendLaterConfigureDialogGroupName);
const QSize sizeDialog = group.readEntry("Size", QSize(800, 600));
if (sizeDialog.isValid()) {
resize(sizeDialog);
......@@ -91,7 +95,7 @@ void SendLaterConfigureDialog::readConfig()
void SendLaterConfigureDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "SendLaterConfigureDialog");
KConfigGroup group(KSharedConfig::openStateConfig(), myConfigureSendLaterConfigureDialogGroupName);
group.writeEntry("Size", size());
mWidget->saveTreeWidgetHeader(group);
}
......@@ -35,6 +35,11 @@
#include <QTreeWidget>
#include <QVBoxLayout>
namespace
{
static const char myAttachPropertyDialogGroupName[] = "AttachPropertyDialog";
}
AttachPropertyDialog::AttachPropertyDialog(QWidget *parent)
: QDialog(parent)
{
......@@ -66,7 +71,7 @@ AttachPropertyDialog::~AttachPropertyDialog()
void AttachPropertyDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "AttachPropertyDialog");
KConfigGroup group(KSharedConfig::openStateConfig(), myAttachPropertyDialogGroupName);
const QSize size = group.readEntry("Size", QSize(500, 400));
if (size.isValid()) {
resize(size);
......@@ -75,7 +80,7 @@ void AttachPropertyDialog::readConfig()
void AttachPropertyDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "AttachPropertyDialog");
KConfigGroup group(KSharedConfig::openStateConfig(), myAttachPropertyDialogGroupName);
group.writeEntry("Size", size());
group.sync();
}
......
......@@ -26,6 +26,10 @@
#include <QHeaderView>
#include <QPushButton>
#include <QTreeWidget>
namespace
{
static const char myMessagePropertyDialogGroupName[] = "MessagePropertyDialog";
}
MessagePropertyDialog::MessagePropertyDialog(QWidget *parent, KTNEFMessage *msg)
: QDialog(parent)
......@@ -71,7 +75,7 @@ void MessagePropertyDialog::slotSaveProperty()
void MessagePropertyDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "MessagePropertyDialog");
KConfigGroup group(KSharedConfig::openStateConfig(), myMessagePropertyDialogGroupName);
const QSize size = group.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
......@@ -84,7 +88,7 @@ void MessagePropertyDialog::readConfig()
void MessagePropertyDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "MessagePropertyDialog");
KConfigGroup group(KSharedConfig::openStateConfig(), myMessagePropertyDialogGroupName);
group.writeEntry("Size", size());
group.writeEntry("HeaderState", mListView->header()->saveState());
group.sync();
......
......@@ -23,7 +23,10 @@
#include <QPushButton>
#include <QTreeView>
#include <QVBoxLayout>
namespace
{
static const char myAddEmailToExistingContactDialogGroupName[] = "AddEmailToExistingContactDialog";
}
AddEmailToExistingContactDialog::AddEmailToExistingContactDialog(QWidget *parent)
: QDialog(parent)
{
......@@ -86,7 +89,7 @@ void AddEmailToExistingContactDialog::slotSelectionChanged()
void AddEmailToExistingContactDialog::readConfig()
{
KConfigGroup group(KMKernel::self()->config(), "AddEmailToExistingContactDialog");
KConfigGroup group(KMKernel::self()->config(), myAddEmailToExistingContactDialogGroupName);
const QSize size = group.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
......@@ -95,7 +98,7 @@ void AddEmailToExistingContactDialog::readConfig()
void AddEmailToExistingContactDialog::writeConfig()
{
KConfigGroup group(KMKernel::self()->config(), "AddEmailToExistingContactDialog");
KConfigGroup group(KMKernel::self()->config(), myAddEmailToExistingContactDialogGroupName);
group.writeEntry("Size", size());
group.sync();
}
......
......@@ -14,6 +14,10 @@
#include <QPushButton>
#include <QVBoxLayout>
namespace
{
static const char myPotentialPhishingDetailDialogGroupName[] = "PotentialPhishingDetailDialog";
}
PotentialPhishingDetailDialog::PotentialPhishingDetailDialog(QWidget *parent)
: QDialog(parent)
, mPotentialPhishingDetailWidget(new PotentialPhishingDetailWidget(this))
......@@ -49,7 +53,7 @@ void PotentialPhishingDetailDialog::fillList(const QStringList &lst)
void PotentialPhishingDetailDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "PotentialPhishingDetailDialog");
KConfigGroup group(KSharedConfig::openStateConfig(), myPotentialPhishingDetailDialogGroupName);
const QSize sizeDialog = group.readEntry("Size", QSize(800, 600));
if (sizeDialog.isValid()) {
resize(sizeDialog);
......@@ -58,7 +62,7 @@ void PotentialPhishingDetailDialog::readConfig()
void PotentialPhishingDetailDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "PotentialPhishingDetailDialog");
KConfigGroup group(KSharedConfig::openStateConfig(), myPotentialPhishingDetailDialogGroupName);
group.writeEntry("Size", size());
}
......
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