Commit 45ba1cdd authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix save/load header

parent a16ffcb2
......@@ -56,6 +56,7 @@ DKIMManagerKeyDialog::~DKIMManagerKeyDialog()
void DKIMManagerKeyDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), myConfigGroupName);
mManagerWidget->restoreHeaders(group.readEntry("Header", QByteArray()));
const QSize size = group.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
......@@ -65,6 +66,7 @@ void DKIMManagerKeyDialog::readConfig()
void DKIMManagerKeyDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), myConfigGroupName);
group.writeEntry("Header", mManagerWidget->saveHeaders());
group.writeEntry("Size", size());
group.sync();
}
......
......@@ -21,6 +21,7 @@
#include "dkimmanagerkey.h"
#include <QTreeWidget>
#include <QHeaderView>
#include <QVBoxLayout>
#include <KLocalizedString>
#include <QMenu>
......@@ -57,6 +58,16 @@ DKIMManagerKeyWidget::~DKIMManagerKeyWidget()
{
}
QByteArray DKIMManagerKeyWidget::saveHeaders() const
{
return mTreeWidget->header()->saveState();
}
void DKIMManagerKeyWidget::restoreHeaders(const QByteArray &header)
{
mTreeWidget->header()->restoreState(header);
}
void DKIMManagerKeyWidget::customContextMenuRequested(const QPoint &)
{
QTreeWidgetItem *item = mTreeWidget->currentItem();
......
......@@ -37,6 +37,8 @@ public:
void loadKeys();
void saveKeys();
void resetKeys();
Q_REQUIRED_RESULT QByteArray saveHeaders() const;
void restoreHeaders(const QByteArray &header);
private:
void customContextMenuRequested(const QPoint &);
QTreeWidget *mTreeWidget = nullptr;
......
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