Warning, file /utilities/kdebugsettings/src/loadtoolbutton.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2020-2022 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 
0006 */
0007 
0008 #include "loadtoolbutton.h"
0009 #include "loadgroupmenu.h"
0010 #include <KLocalizedString>
0011 
0012 LoadToolButton::LoadToolButton(QWidget *parent)
0013     : QToolButton(parent)
0014     , mLoadMenu(new LoadGroupMenu(this))
0015 {
0016     setPopupMode(QToolButton::InstantPopup);
0017     setText(i18n("Load..."));
0018     auto mainMenu = new QMenu(this);
0019     setMenu(mainMenu);
0020 
0021     QAction *act = mainMenu->addAction(i18n("Load From File..."));
0022     connect(act, &QAction::triggered, this, &LoadToolButton::loadFromFile);
0023 
0024     mLoadMenu->setObjectName(QStringLiteral("loadMenu"));
0025     connect(mLoadMenu, &LoadGroupMenu::loadGroupRequested, this, &LoadToolButton::loadGroupRequested);
0026     connect(mLoadMenu, &LoadGroupMenu::manageGroupRequested, this, &LoadToolButton::manageGroupRequested);
0027     mainMenu->addMenu(mLoadMenu);
0028 }
0029 
0030 LoadToolButton::~LoadToolButton() = default;
0031 
0032 void LoadToolButton::updateLoadGroupMenu()
0033 {
0034     mLoadMenu->refreshMenu();
0035 }
0036 
0037 QStringList LoadToolButton::groupNames() const
0038 {
0039     return mLoadMenu->groupNames();
0040 }