Commit 378c0e45 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Save/load header

parent e18fd117
......@@ -66,6 +66,7 @@ void DKIMManageRulesDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), myConfigGroupName);
const QSize size = group.readEntry("Size", QSize(600, 400));
mRulesWidget->restoreHeaders(group.readEntry("Header", QByteArray()));
if (size.isValid()) {
resize(size);
}
......@@ -74,6 +75,7 @@ void DKIMManageRulesDialog::readConfig()
void DKIMManageRulesDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), myConfigGroupName);
group.writeEntry("Header", mRulesWidget->saveHeaders());
group.writeEntry("Size", size());
group.sync();
}
......@@ -22,6 +22,7 @@
#include "dkimruledialog.h"
#include <MessageViewer/DKIMManagerRules>
#include <QVBoxLayout>
#include <QHeaderView>
#include <KLocalizedString>
#include <QTreeWidget>
#include <KTreeWidgetSearchLine>
......@@ -109,6 +110,16 @@ void DKIMManageRulesWidget::saveSettings()
MessageViewer::DKIMManagerRules::self()->saveRules(rules);
}
QByteArray DKIMManageRulesWidget::saveHeaders() const
{
return mTreeWidget->header()->saveState();
}
void DKIMManageRulesWidget::restoreHeaders(const QByteArray &header)
{
mTreeWidget->header()->restoreState(header);
}
void DKIMManageRulesWidget::customContextMenuRequested(const QPoint &pos)
{
Q_UNUSED(pos);
......
......@@ -58,6 +58,8 @@ public:
~DKIMManageRulesWidget();
void loadSettings();
void saveSettings();
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