File indexing completed on 2024-12-15 04:51:47

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #include "noteactionconfig.h"
0007 #include "notesharedglobalconfig.h"
0008 
0009 #include <KLocalizedString>
0010 #include <QLineEdit>
0011 
0012 #include <QGridLayout>
0013 #include <QLabel>
0014 #include <QWhatsThis>
0015 using namespace NoteShared;
0016 NoteActionConfig::NoteActionConfig(QObject *parent, const KPluginMetaData &data)
0017     : KCModule(parent, data)
0018 {
0019     auto layout = new QGridLayout(widget());
0020     // layout->setContentsMargins(0, 0, 0, 0);
0021 
0022     auto label_MailAction = new QLabel(i18n("&Mail action:"), widget());
0023     layout->addWidget(label_MailAction, 0, 0);
0024 
0025     auto kcfg_MailAction = new QLineEdit(widget());
0026     kcfg_MailAction->setObjectName(QLatin1StringView("kcfg_MailAction"));
0027     label_MailAction->setBuddy(kcfg_MailAction);
0028     layout->addWidget(kcfg_MailAction, 0, 1);
0029 
0030     auto howItWorks = new QLabel(i18n("<a href=\"whatsthis\">How does this work?</a>"));
0031     connect(howItWorks, &QLabel::linkActivated, this, &NoteActionConfig::slotHelpLinkClicked);
0032     layout->addWidget(howItWorks, 1, 0);
0033     howItWorks->setContextMenuPolicy(Qt::NoContextMenu);
0034     addConfig(NoteShared::NoteSharedGlobalConfig::self(), widget());
0035     layout->setRowStretch(2, 1);
0036     load();
0037 }
0038 
0039 void NoteActionConfig::slotHelpLinkClicked(const QString &)
0040 {
0041     const QString help = i18n(
0042         "<qt>"
0043         "<p>You can customize command line. "
0044         "You can use:</p>"
0045         "<ul>"
0046         "<li>%t returns current note title</li>"
0047         "<li>%f returns current note text</li>"
0048         "</ul>"
0049         "</qt>");
0050 
0051     QWhatsThis::showText(QCursor::pos(), help);
0052 }
0053 
0054 void NoteActionConfig::save()
0055 {
0056     KCModule::save();
0057 }
0058 
0059 void NoteActionConfig::load()
0060 {
0061     KCModule::load();
0062 }
0063 
0064 #include "moc_noteactionconfig.cpp"