From 106fe0496bc197d4b60d8b5a46a5e9d6b16cf6d4 Mon Sep 17 00:00:00 2001 From: Anthony Fieroni Date: Sun, 17 Jan 2021 21:06:47 +0200 Subject: [PATCH 32/54] Remove duplicated actions provided by parent view BUG: 426801 Signed-off-by: Anthony Fieroni --- karbon/ui/KarbonView.cpp | 73 ++++------------------------------------ karbon/ui/KarbonView.h | 4 --- 2 files changed, 6 insertions(+), 71 deletions(-) diff --git a/karbon/ui/KarbonView.cpp b/karbon/ui/KarbonView.cpp index c6946734755..8f30933ba53 100644 --- a/karbon/ui/KarbonView.cpp +++ b/karbon/ui/KarbonView.cpp @@ -152,12 +152,12 @@ public: Private(KarbonPart *part, KarbonDocument * doc) : karbonPart(part), part(doc) , colorBar(0), closePath(0), combinePath(0) - , separatePath(0), reversePath(0), intersectPath(0), subtractPath(0) - , unitePath(0), excludePath(0), pathSnapToGrid(0), configureAction(0) - , deleteSelectionAction(0), clipObjects(0), unclipObjects(0) - , flipVertical(0), flipHorizontal(0), viewAction(0) - , snapGridAction(0), showPageMargins(0), showGuidesAction(0) - , showPaletteAction(0) + , separatePath(0), reversePath(0), intersectPath(0) + , subtractPath(0), unitePath(0), excludePath(0) + , pathSnapToGrid(0), configureAction(0), clipObjects(0) + , unclipObjects(0), flipVertical(0), flipHorizontal(0) + , viewAction(0), snapGridAction(0), showPageMargins(0) + , showGuidesAction(0), showPaletteAction(0) , status(0), cursorCoords(0), smallPreview(0) {} @@ -176,7 +176,6 @@ public: QAction * excludePath; QAction * pathSnapToGrid; QAction * configureAction; - QAction * deleteSelectionAction; QAction * clipObjects; QAction * unclipObjects; QAction * flipVertical; @@ -472,41 +471,6 @@ void KarbonView::selectionDuplicate() kopaCanvas()->toolProxy()->paste(); } -void KarbonView::editSelectAll() -{ - KoSelection* selection = shapeManager()->selection(); - if (! selection) { - return; - } - QList shapes; - for (int i = 0; i < kopaDocument()->pages().count(); ++i) { - KoShapeLayer *l = dynamic_cast(kopaDocument()->pages().at(i)); - shapes += l->shapes(); - } - debugKarbonUi << "shapes.size() =" << shapes.size(); - - foreach(KoShape* shape, shapes) { - selection->select(shape); - shape->update(); - } - - selectionChanged(); -} - -void KarbonView::editDeselectAll() -{ - KoSelection* selection = shapeManager()->selection(); - if (selection) - selection->deselectAll(); - - selectionChanged(); -} - -void KarbonView::editDeleteSelection() -{ - kopaCanvas()->toolProxy()->deleteSelection(); -} - void KarbonView::selectionDistributeHorizontalCenter() { selectionDistribute(KoShapeDistributeCommand::HorizontalCenterDistribution); @@ -906,26 +870,10 @@ void KarbonView::initActions() if (!mainWindow()) return; - // edit -----> - QAction *action = actionCollection()->addAction(KStandardAction::Cut, "edit_cut", 0, 0); - new KoCutController(kopaCanvas(), action); - action = actionCollection()->addAction(KStandardAction::Copy, "edit_copy", 0, 0); - new KoCopyController(kopaCanvas(), action); - action = actionCollection()->addAction(KStandardAction::Paste, "edit_paste", 0, 0); - new KoPasteController(kopaCanvas(), action); - actionCollection()->addAction(KStandardAction::SelectAll, "edit_select_all", this, SLOT(editSelectAll())); - actionCollection()->addAction(KStandardAction::Deselect, "edit_deselect_all", this, SLOT(editDeselectAll())); - QAction *actionImportGraphic = new QAction(i18n("&Import Graphic..."), this); actionCollection()->addAction("file_import", actionImportGraphic); connect(actionImportGraphic, SIGNAL(triggered()), this, SLOT(fileImportGraphic())); - d->deleteSelectionAction = new QAction(koIcon("edit-delete"), i18n("D&elete"), this); - actionCollection()->addAction("edit_delete", d->deleteSelectionAction); - d->deleteSelectionAction->setShortcut(QKeySequence("Del")); - connect(d->deleteSelectionAction, SIGNAL(triggered()), this, SLOT(editDeleteSelection())); - connect(kopaCanvas()->toolProxy(), SIGNAL(selectionChanged(bool)), d->deleteSelectionAction, SLOT(setEnabled(bool))); - QAction *actionEditGuides = new QAction(koIcon("edit-guides"), i18n("Edit Guides"), this); actionCollection()->addAction("edit_guides", actionEditGuides); connect(actionEditGuides, SIGNAL(triggered()), this, SLOT(editGuides())); @@ -975,15 +923,6 @@ void KarbonView::initActions() d->showPaletteAction->setChecked(true); connect(d->showPaletteAction, SIGNAL(triggered()), this, SLOT(showPalette())); - action = actionCollection()->action("object_group"); - if (action) { - action->setShortcut(QKeySequence("Ctrl+G")); - } - action = actionCollection()->action("object_ungroup"); - if (action) { - action->setShortcut(QKeySequence("Ctrl+Shift+G")); - } - d->clipObjects = new QAction(i18n("&Clip Object"), this); actionCollection()->addAction("object_clip", d->clipObjects ); connect(d->clipObjects, SIGNAL(triggered()), this, SLOT(clipObjects())); diff --git a/karbon/ui/KarbonView.h b/karbon/ui/KarbonView.h index ffe4c2bbebd..017f59379f8 100644 --- a/karbon/ui/KarbonView.h +++ b/karbon/ui/KarbonView.h @@ -84,10 +84,6 @@ public: KarbonPaletteBarWidget *colorBar() const; public Q_SLOTS: - // editing: - void editSelectAll(); - void editDeselectAll(); - void editDeleteSelection(); void selectionDuplicate(); void selectionDistributeHorizontalCenter(); -- 2.31.1