Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e5ae1252 authored by C. Boemann's avatar C. Boemann

Remove ToolBardocker as fidcussed with Boudewijn

reasons are.
 1) the layout was never finsihed and looks bad
 2) it crashes as seen in bug:291625
 3) it not usedful in words now we have the new ui

Ok to backport to 2.4
parent 613fc900
/* This file is part of the KDE project
*
* Copyright (c) 2008,2010 Casper Boemann <cbo@boemann.dk>
* Copyright (c) 2008-2012 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
......@@ -32,9 +32,6 @@
#include "KoView.h"
#include "KoMainWindow.h"
#include "KoDockWidgetTitleBar.h"
#include <QGridLayout>
class ToolDockerFactory : public KoDockFactoryBase
{
......@@ -55,39 +52,17 @@ public:
}
};
class ToolBarsDockerFactory : public KoDockFactoryBase
{
public:
ToolBarsDockerFactory() : KoDockFactoryBase() { }
QString id() const {
return "ToolBarDocker";
}
QDockWidget* createDockWidget() {
return new QDockWidget(i18n("Tool Bars Docker"));
}
DockPosition defaultDockPosition() const {
return DockTop;
}
};
class KoDockerManager::Private
{
public:
Private(KoMainWindow *mw) :
dockedToolBarsLayout(0)
,mainWindow(mw)
mainWindow(mw)
,ignore(true)
,showOptionsDocker(true)
{
}
KoToolDocker *toolOptionsDocker;
QDockWidget *toolBarsDocker;
QGridLayout *dockedToolBarsLayout;
QList<KToolBar *> toolBarList;
KoMainWindow *mainWindow;
bool ignore;
bool showOptionsDocker;
......@@ -96,68 +71,21 @@ public:
{
if (ignore) {
ignore = false;
moveToolBars();
toolOptionsDocker->setVisible(showOptionsDocker);
}
}
void moveToolBarsBack()
{
foreach(KToolBar *toolBar, toolBarList) {
mainWindow->addToolBar(toolBar);
}
toolBarList.clear();
}
void moveToolBars()
{
if(ignore)
return;
// Move toolbars to docker or back depending on visibllity of docker
if (toolBarsDocker->isVisible()) {
QList<KToolBar *> tmpList = mainWindow->toolBars();
toolBarList.append(tmpList);
foreach(KToolBar *toolBar, tmpList) {
dockedToolBarsLayout->addWidget(toolBar);
}
} else {
moveToolBarsBack();
}
}
};
KoDockerManager::KoDockerManager(KoMainWindow *mainWindow)
: QObject(mainWindow), d( new Private(mainWindow) )
{
ToolDockerFactory toolDockerFactory;
ToolBarsDockerFactory toolBarsDockerFactory;
d->toolOptionsDocker =
qobject_cast<KoToolDocker*>(mainWindow->createDockWidget(&toolDockerFactory));
Q_ASSERT(d->toolOptionsDocker);
d->toolOptionsDocker->setVisible(false);
d->toolBarsDocker = mainWindow->createDockWidget(&toolBarsDockerFactory);
Q_ASSERT(d->toolBarsDocker);
QWidget *dockedToolBarsWidget = new QWidget();
d->dockedToolBarsLayout = new QGridLayout();
d->dockedToolBarsLayout->setHorizontalSpacing(2);
d->dockedToolBarsLayout->setVerticalSpacing(0);
d->dockedToolBarsLayout->setMargin(0);
dockedToolBarsWidget->setLayout(d->dockedToolBarsLayout);
d->toolBarsDocker->setAllowedAreas(Qt::TopDockWidgetArea);
d->toolBarsDocker->setFeatures(QDockWidget::DockWidgetClosable);
d->toolBarsDocker->setWidget(dockedToolBarsWidget);
d->toolBarsDocker->setVisible(false);
KoDockWidgetTitleBar *tb = new KoDockWidgetTitleBar(d->toolBarsDocker);
tb->setTextVisible(false);
d->toolBarsDocker->setTitleBarWidget(tb);
connect(mainWindow, SIGNAL(restoringDone()), this, SLOT(restoringDone()));
connect(d->toolBarsDocker, SIGNAL(visibilityChanged(bool)), this, SLOT(moveToolBars()));
connect(mainWindow, SIGNAL(beforeHandlingToolBars()), this, SLOT(moveToolBarsBack()));
connect(mainWindow, SIGNAL(afterHandlingToolBars()), this, SLOT(moveToolBars()));
}
KoDockerManager::~KoDockerManager()
......
......@@ -48,8 +48,6 @@ public slots:
private:
Q_PRIVATE_SLOT(d, void moveToolBarsBack())
Q_PRIVATE_SLOT(d, void moveToolBars())
Q_PRIVATE_SLOT(d, void restoringDone())
class Private;
Private * const d;
......
......@@ -1615,9 +1615,6 @@ void KoMainWindow::slotActivePartChanged(KParts::Part *newPart)
return;
}
// important so dockermanager can move toolbars back
emit beforeHandlingToolBars();
KXMLGUIFactory *factory = guiFactory();
......@@ -1683,8 +1680,6 @@ void KoMainWindow::slotActivePartChanged(KParts::Part *newPart)
d->activeView = 0;
d->activePart = 0;
}
// important so dockermanager can move toolbars where wanted
emit afterHandlingToolBars();
// ### setUpdatesEnabled( true );
}
......
......@@ -188,13 +188,6 @@ signals:
/// This signal is emitted right after the docker states have been succefully restored from config
void restoringDone();
/// This signal is emitted right before we handle loading or saving of toolbars
void beforeHandlingToolBars();
/// This signal is emitted right after we handled loading or saving of toolbars
void afterHandlingToolBars();
public slots:
/**
......
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