Commit 15e38191 authored by Halla Rempt's avatar Halla Rempt
Browse files

Remember the lock state of the dockers

BUG:325928

Now we just need some pretty lock/unlock icons of the right size!
CCMAIL:kimageshop@kde.org
parent af814cc4
......@@ -1200,6 +1200,7 @@ void KoMainWindow::saveWindowSettings()
if (i.value()->widget()) {
KConfigGroup dockGroup = group.group(QString("DockWidget ") + i.key());
dockGroup.writeEntry("Collapsed", i.value()->widget()->isHidden());
dockGroup.writeEntry("Locked", i.value()->property("Locked").toBool());
dockGroup.writeEntry("DockArea", (int) dockWidgetArea(i.value()));
}
}
......@@ -1857,12 +1858,17 @@ QDockWidget* KoMainWindow::createDockWidget(KoDockFactoryBase* factory)
}
bool collapsed = factory->defaultCollapsed();
bool locked = false;
if (rootDocument()) {
KConfigGroup group = KGlobal::config()->group(d->rootPart->componentData().componentName()).group("DockWidget " + factory->id());
collapsed = group.readEntry("Collapsed", collapsed);
locked = group.readEntry("Locked", locked);
}
if (titleBar && collapsed)
titleBar->setCollapsed(true);
if (titleBar && locked)
titleBar->setLocked(true);
d->dockWidgetsMap.insert(factory->id(), dockWidget);
} else {
dockWidget = d->dockWidgetsMap[ factory->id()];
......
......@@ -234,6 +234,15 @@ void KoDockWidgetTitleBar::setCollapsed(bool collapsed)
d->toggleCollapsed();
}
void KoDockWidgetTitleBar::setLocked(bool locked)
{
QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());
if (q && q->widget() && d->locked != locked)
d->toggleLocked();
}
void KoDockWidgetTitleBar::setCollapsable(bool collapsable)
{
d->collapseButton->setVisible(collapsable);
......@@ -288,6 +297,7 @@ void KoDockWidgetTitleBar::Private::toggleLocked()
floatButton->setEnabled(true);
collapseButton->setEnabled(true);
}
q->setProperty("Locked", locked);
}
......
......@@ -40,7 +40,7 @@ public:
virtual QSize sizeHint() const; ///< reimplemented from QWidget
void setCollapsed(bool collapsed);
void setLocked(bool locked);
void setCollapsable(bool collapsable);
enum TextVisibilityMode {TextCanBeInvisible, FullTextAlwaysVisible};
......
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