File indexing completed on 2024-05-12 15:56:52
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2006 Thomas Zander <zander@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "KoToolManager_p.h" 0008 0009 #include <KoShapeManager.h> 0010 #include <KoSelection.h> 0011 #include <KoToolBase.h> 0012 #include <KoToolFactoryBase.h> 0013 #include "kis_action_registry.h" 0014 0015 // ************ KoToolAction::Private ********** 0016 0017 class Q_DECL_HIDDEN KoToolAction::Private 0018 { 0019 public: 0020 KoToolFactoryBase *toolFactory; 0021 }; 0022 0023 KoToolAction::KoToolAction(KoToolFactoryBase* toolFactory) 0024 : d(new Private) 0025 { 0026 d->toolFactory = toolFactory; 0027 } 0028 0029 KoToolAction::~KoToolAction() 0030 { 0031 delete d; 0032 } 0033 0034 void KoToolAction::trigger() 0035 { 0036 KoToolManager::instance()->switchToolRequested(id()); 0037 } 0038 0039 0040 QString KoToolAction::iconText() const 0041 { 0042 // There is no specific iconText in KoToolFactoryBase 0043 return d->toolFactory->toolTip(); 0044 } 0045 0046 QString KoToolAction::toolTip() const 0047 { 0048 return d->toolFactory->toolTip(); 0049 } 0050 0051 QString KoToolAction::id() const 0052 { 0053 return d->toolFactory->id(); 0054 } 0055 0056 QString KoToolAction::iconName() const 0057 { 0058 return d->toolFactory->iconName(); 0059 } 0060 0061 QKeySequence KoToolAction::shortcut() const 0062 { 0063 return d->toolFactory->shortcut(); 0064 } 0065 0066 0067 QString KoToolAction::section() const 0068 { 0069 return d->toolFactory->section(); 0070 } 0071 0072 int KoToolAction::priority() const 0073 { 0074 return d->toolFactory->priority(); 0075 } 0076 0077 QString KoToolAction::visibilityCode() const 0078 { 0079 return d->toolFactory->activationShapeId(); 0080 } 0081 0082 KoToolFactoryBase *KoToolAction::toolFactory() const 0083 { 0084 return d->toolFactory; 0085 } 0086 0087 // ************ Connector ********** 0088 Connector::Connector(KoShapeManager *parent) 0089 : QObject(parent), 0090 m_shapeManager(parent) 0091 { 0092 connect(m_shapeManager, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); 0093 } 0094 0095 void Connector::selectionChanged() 0096 { 0097 emit selectionChanged(m_shapeManager->selection()->selectedShapes()); 0098 }