Pimcommon

kactionmenuchangecase.cpp
1/*
2 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "kactionmenuchangecase.h"
8#include <KActionCollection>
9#include <KLocalizedString>
10#include <QAction>
11using namespace PimCommon;
12class PimCommon::KActionMenuChangeCasePrivate
13{
14public:
15 KActionMenuChangeCasePrivate() = default;
16
17 QAction *mUpperCase = nullptr;
18 QAction *mSentenceCase = nullptr;
19 QAction *mLowerCase = nullptr;
20 QAction *mReverseCase = nullptr;
21};
22
23KActionMenuChangeCase::KActionMenuChangeCase(QObject *parent)
24 : KActionMenu(parent)
25 , d(new PimCommon::KActionMenuChangeCasePrivate)
26{
27 setText(i18n("Change Case"));
28 d->mUpperCase = new QAction(i18nc("@action", "Uppercase"), this);
29 connect(d->mUpperCase, &QAction::triggered, this, &KActionMenuChangeCase::upperCase);
30
31 d->mSentenceCase = new QAction(i18nc("@action", "Sentence case"), this);
32 connect(d->mSentenceCase, &QAction::triggered, this, &KActionMenuChangeCase::sentenceCase);
33
34 d->mLowerCase = new QAction(i18nc("@action", "Lowercase"), this);
35 connect(d->mLowerCase, &QAction::triggered, this, &KActionMenuChangeCase::lowerCase);
36
37 d->mReverseCase = new QAction(i18nc("@action", "Reverse Case"), this);
38 connect(d->mReverseCase, &QAction::triggered, this, &KActionMenuChangeCase::reverseCase);
39
40 addAction(d->mUpperCase);
41 addAction(d->mLowerCase);
42 addAction(d->mSentenceCase);
43 addAction(d->mReverseCase);
44}
45
46KActionMenuChangeCase::~KActionMenuChangeCase() = default;
47
48QAction *KActionMenuChangeCase::upperCaseAction() const
49{
50 return d->mUpperCase;
51}
52
53QAction *KActionMenuChangeCase::sentenceCaseAction() const
54{
55 return d->mSentenceCase;
56}
57
58QAction *KActionMenuChangeCase::lowerCaseAction() const
59{
60 return d->mLowerCase;
61}
62
63QAction *KActionMenuChangeCase::reverseCaseAction() const
64{
65 return d->mReverseCase;
66}
67
68void KActionMenuChangeCase::appendInActionCollection(KActionCollection *ac)
69{
70 if (ac) {
71 ac->addAction(QStringLiteral("change_to_uppercase"), d->mUpperCase);
72 ac->addAction(QStringLiteral("change_to_sentencecase"), d->mSentenceCase);
73 ac->addAction(QStringLiteral("change_to_lowercase"), d->mLowerCase);
74 ac->addAction(QStringLiteral("change_to_reversecase"), d->mReverseCase);
75 }
76}
77
78#include "moc_kactionmenuchangecase.cpp"
QAction * addAction(const QString &name, const QObject *receiver=nullptr, const char *member=nullptr)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
folderdialogacltab.h
void triggered(bool checked)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.