File indexing completed on 2022-09-27 16:31:47

0001 /*
0002     SPDX-FileCopyrightText: 2020-2022 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 
0006 */
0007 #include "savetoolbutton.h"
0008 #include <KLocalizedString>
0009 #include <QAction>
0010 #include <QMenu>
0011 
0012 SaveToolButton::SaveToolButton(QWidget *parent)
0013     : QToolButton(parent)
0014 {
0015     setText(i18n("Save As..."));
0016     setPopupMode(QToolButton::InstantPopup);
0017     auto mainMenu = new QMenu(this);
0018     setMenu(mainMenu);
0019 
0020     QAction *act = mainMenu->addAction(i18n("Save As File..."));
0021     connect(act, &QAction::triggered, this, &SaveToolButton::saveAsFile);
0022 
0023     QAction *actGroup = mainMenu->addAction(i18n("Save As Group..."));
0024     connect(actGroup, &QAction::triggered, this, &SaveToolButton::saveAsGroup);
0025 }
0026 
0027 SaveToolButton::~SaveToolButton() = default;