Unverified Commit ca5b58a9 authored by Andrey Legayev's avatar Andrey Legayev
Browse files

Main window: Fix sorting and tabs preset in config file

Fixes T12999

Differential Revision: https://phabricator.kde.org/D28994
parent 15ce4671
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "tabwidget.h" #include "tabwidget.h"
#include "keytreeview.h" #include "keytreeview.h"
#include "kleopatra_debug.h"
#include <utils/action_data.h> #include <utils/action_data.h>
...@@ -667,7 +667,9 @@ TabWidget::TabWidget(QWidget *p, Qt::WindowFlags f) ...@@ -667,7 +667,9 @@ TabWidget::TabWidget(QWidget *p, Qt::WindowFlags f)
} }
TabWidget::~TabWidget() {} TabWidget::~TabWidget() {
saveViews(KSharedConfig::openConfig().data());
}
void TabWidget::setFlatModel(AbstractKeyListModel *model) void TabWidget::setFlatModel(AbstractKeyListModel *model)
{ {
...@@ -722,6 +724,11 @@ void TabWidget::setStringFilter(const QString &filter) ...@@ -722,6 +724,11 @@ void TabWidget::setStringFilter(const QString &filter)
void TabWidget::setKeyFilter(const std::shared_ptr<KeyFilter> &filter) void TabWidget::setKeyFilter(const std::shared_ptr<KeyFilter> &filter)
{ {
if (!filter) {
qCDebug(KLEOPATRA_LOG) << "TabWidget::setKeyFilter() trial to set filter=NULL";
return;
}
if (Page *const page = d->currentPage()) { if (Page *const page = d->currentPage()) {
page->setKeyFilter(filter); page->setKeyFilter(filter);
} }
...@@ -843,7 +850,9 @@ void TabWidget::createActions(KActionCollection *coll) ...@@ -843,7 +850,9 @@ void TabWidget::createActions(KActionCollection *coll)
QAbstractItemView *TabWidget::addView(const QString &title, const QString &id, const QString &text) QAbstractItemView *TabWidget::addView(const QString &title, const QString &id, const QString &text)
{ {
return d->addView(new Page(title, id, text), d->currentPage()); const KConfigGroup group = KSharedConfig::openConfig()->group(QString::asprintf("View #%u", d->tabWidget.count()));
Page *page = new Page(title, id, text, nullptr, QString(), nullptr, group);
return d->addView(page, d->currentPage());
} }
QAbstractItemView *TabWidget::addView(const KConfigGroup &group) QAbstractItemView *TabWidget::addView(const KConfigGroup &group)
......
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