Commit d5c78f58 authored by Laurent Montel's avatar Laurent Montel 😁

Save/load dialog size

parent 4fdbdd16
......@@ -20,6 +20,8 @@
#include "confirmaddressdialog.h"
#include "confirmaddresswidget.h"
#include <KLocalizedString>
#include <KConfigGroup>
#include <KSharedConfig>
#include <QDialogButtonBox>
#include <QVBoxLayout>
......@@ -39,11 +41,12 @@ ConfirmAddressDialog::ConfirmAddressDialog(QWidget *parent)
connect(buttonBox, &QDialogButtonBox::accepted, this, &ConfirmAddressDialog::slotAccepted);
connect(buttonBox, &QDialogButtonBox::rejected, this, &ConfirmAddressDialog::reject);
mainLayout->addWidget(buttonBox);
readConfig();
}
ConfirmAddressDialog::~ConfirmAddressDialog()
{
writeConfig();
}
void ConfirmAddressDialog::slotAccepted()
......@@ -51,3 +54,19 @@ void ConfirmAddressDialog::slotAccepted()
//TODO
accept();
}
void ConfirmAddressDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), "ConfirmAddressDialog");
group.writeEntry("Size", size());
}
void ConfirmAddressDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), "ConfirmAddressDialog");
const QSize sizeDialog = group.readEntry("Size", QSize(500, 300));
if (sizeDialog.isValid()) {
resize(sizeDialog);
}
}
......@@ -34,6 +34,8 @@ private Q_SLOTS:
void slotAccepted();
private:
void writeConfig();
void readConfig();
ConfirmAddressWidget *mConfirmWidget;
};
......
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