Commit 863e9866 authored by Dominik Haumann's avatar Dominik Haumann
Browse files

Avoid hidden view spaces on start

BUG: 358266
REVIEW: 128173
parent f5b90922
......@@ -1015,6 +1015,9 @@ void KateViewManager::restoreViewConfiguration(const KConfigGroup &config)
m_viewSpaceList.at(lastViewSpace)->currentView()->setFocus();
}
// remove hidden view spaces (users will likely never find them again, #358266)
removeHiddenViewSpaces();
// emergency
if (m_viewSpaceList.empty()) {
// kill bad children
......@@ -1039,6 +1042,30 @@ void KateViewManager::restoreViewConfiguration(const KConfigGroup &config)
updateViewSpaceActions();
}
void KateViewManager::removeHiddenViewSpaces()
{
// collect all empty view spaces
QSet<KateViewSpace *> hiddenViewSpaces;
foreach (KateViewSpace *vs, m_viewSpaceList) {
if (vs->size().isEmpty()) {
hiddenViewSpaces.insert(vs);
}
}
// get all child splitters
const QList<QSplitter *> splitters = findChildren<QSplitter *>();
foreach (QSplitter * splitter, splitters) {
if (splitter->size().isEmpty()) {
hiddenViewSpaces += findChildren<KateViewSpace *>().toSet();
}
}
// finally remove all empty view spaces
foreach (KateViewSpace * vs, hiddenViewSpaces) {
removeViewSpace(vs);
}
}
void KateViewManager::saveSplitterConfig(QSplitter *s, KConfigBase *configBase, const QString &viewConfGrp)
{
QString grp = QString(viewConfGrp + QStringLiteral("-Splitter %1")).arg(m_splitterIndex);
......
......@@ -136,6 +136,7 @@ private:
void restoreSplitter(const KConfigBase *config, const QString &group, QSplitter *parent, const QString &viewConfGrp);
void removeViewSpace(KateViewSpace *viewspace);
void removeHiddenViewSpaces();
public:
KTextEditor::View *activeView();
......
Supports Markdown
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