File indexing completed on 2024-12-22 04:12:45

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2021 Anna Medonosova <anna.medonosova@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "KisCanvasOnlyAction.h"
0008 #include <KisPart.h>
0009 #include <kactioncollection.h>
0010 #include <KisMainWindow.h>
0011 #include <QAction>
0012 #include <kis_debug.h>
0013 
0014 KisCanvasOnlyAction::KisCanvasOnlyAction()
0015     : KisAbstractInputAction("Toggle Canvas Only")
0016 {
0017     setName(i18n("Toggle Canvas Only"));
0018     setDescription(i18n("The Toggle Canvas Only action switches between full interface and canvas only mode"));  
0019 }
0020 
0021 KisCanvasOnlyAction::~KisCanvasOnlyAction()
0022 {
0023 
0024 }
0025 
0026 int KisCanvasOnlyAction::priority() const
0027 {
0028     return 6;
0029 }
0030 
0031 void KisCanvasOnlyAction::begin(int, QEvent */*event*/)
0032 {
0033     KisKActionCollection *actionCollection = KisPart::instance()->currentMainwindow()->actionCollection();
0034     QAction *action = actionCollection->action("view_show_canvas_only");
0035     if (action)
0036     {
0037         action->trigger();
0038     }
0039 }