Warning, file /office/calligra/libs/main/KoDockerManager.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 * 0003 * Copyright (c) 2008-2012 C. Boemann <cbo@boemann.dk> 0004 * Copyright (c) 2009 Cyrille Berger <cberger@cberger.net> 0005 * 0006 * This library is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Library General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2 of the License, or (at your option) any later version. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Library General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Library General Public License 0017 * along with this library; see the file COPYING.LIB. If not, write to 0018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #include "KoDockerManager.h" 0023 #include "KoDockerManager_p.h" 0024 #include "KoDockFactoryBase.h" 0025 0026 #include <klocalizedstring.h> 0027 #include <kconfig.h> 0028 #include <kconfiggroup.h> 0029 #include <MainDebug.h> 0030 0031 #include "KoToolDocker.h" 0032 #include "KoDockRegistry.h" 0033 0034 #include "KoView.h" 0035 #include "KoMainWindow.h" 0036 0037 #include <QFontDatabase> 0038 0039 class ToolDockerFactory : public KoDockFactoryBase 0040 { 0041 public: 0042 ToolDockerFactory() : KoDockFactoryBase() { } 0043 0044 QString id() const override { 0045 return "sharedtooldocker"; 0046 } 0047 0048 QDockWidget* createDockWidget() override { 0049 KoToolDocker * dockWidget = new KoToolDocker(); 0050 return dockWidget; 0051 } 0052 0053 DockPosition defaultDockPosition() const override { 0054 return DockRight; 0055 } 0056 }; 0057 0058 KoDockerManager::KoDockerManager(KoMainWindow *mainWindow) 0059 : QObject(mainWindow), d( new Private(mainWindow) ) 0060 { 0061 ToolDockerFactory toolDockerFactory; 0062 d->toolOptionsDocker = 0063 qobject_cast<KoToolDocker*>(mainWindow->createDockWidget(&toolDockerFactory)); 0064 Q_ASSERT(d->toolOptionsDocker); 0065 d->toolOptionsDocker->setVisible(false); 0066 0067 connect(mainWindow, SIGNAL(restoringDone()), this, SLOT(restoringDone())); 0068 } 0069 0070 KoDockerManager::~KoDockerManager() 0071 { 0072 delete d; 0073 } 0074 0075 void KoDockerManager::newOptionWidgets(const QList<QPointer<QWidget> > &optionWidgetList) 0076 { 0077 d->toolOptionsDocker->setOptionWidgets(optionWidgetList); 0078 QFont dockWidgetFont = KoDockRegistry::dockFont(); 0079 0080 foreach(QWidget *w, optionWidgetList) { 0081 #ifdef Q_OS_MAC 0082 w->setAttribute(Qt::WA_MacSmallSize, true); 0083 #endif 0084 w->setFont(dockWidgetFont); 0085 } 0086 0087 0088 0089 } 0090 0091 void KoDockerManager::removeToolOptionsDocker() 0092 { 0093 d->toolOptionsDocker->setVisible(false); 0094 d->showOptionsDocker = false; 0095 } 0096 0097 void KoDockerManager::setIcons(bool enabled) 0098 { 0099 d->toolOptionsDocker->setTabEnabled(enabled); 0100 } 0101 0102 void KoDockerManager::resetToolDockerWidgets() 0103 { 0104 d->toolOptionsDocker->resetWidgets(); 0105 } 0106 0107 // have to include this because of Q_PRIVATE_SLOT 0108 #include <moc_KoDockerManager.cpp>