Simplify slots of some KCMs

Remove Q_SLOTS where not needed, use lambda if we only connect/call it in one place
This commit is contained in:
Alexander Lohnau 2023-07-21 14:04:05 +03:00 committed by Albert Vaca Cintora
parent f483c1449c
commit b7cf34c11f
5 changed files with 8 additions and 23 deletions

View file

@ -28,10 +28,14 @@ SendReplyDialog::SendReplyDialog(const QString &originalMessage, const QString &
auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok);
button->setText(i18n("Send"));
const auto sendButtonClicked = [this]() {
Q_EMIT sendReply(m_replyId, m_ui->replyEdit->toPlainText());
close();
};
auto textEdit = m_ui->replyEdit;
connect(textEdit, &SendReplyTextEdit::send, this, &SendReplyDialog::sendButtonClicked);
connect(textEdit, &SendReplyTextEdit::send, this, sendButtonClicked);
connect(this, &QDialog::accepted, this, &SendReplyDialog::sendButtonClicked);
connect(this, &QDialog::accepted, this, sendButtonClicked);
setWindowTitle(topicName);
setWindowIcon(QIcon::fromTheme(QStringLiteral("kdeconnect")));
setAttribute(Qt::WA_DeleteOnClose);
@ -40,12 +44,6 @@ SendReplyDialog::SendReplyDialog(const QString &originalMessage, const QString &
SendReplyDialog::~SendReplyDialog() = default;
void SendReplyDialog::sendButtonClicked()
{
Q_EMIT sendReply(m_replyId, m_ui->replyEdit->toPlainText());
close();
}
QSize SendReplyDialog::sizeHint() const
{
return QSize(512, 64);

View file

@ -26,9 +26,6 @@ public:
QSize sizeHint() const override;
private Q_SLOTS:
void sendButtonClicked();
Q_SIGNALS:
void sendReply(const QString &replyId, const QString &messageBody);

View file

@ -34,7 +34,7 @@ K_PLUGIN_CLASS_WITH_JSON(RunCommandPlugin, "kdeconnect_runcommand.json")
RunCommandPlugin::RunCommandPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
connect(config(), &KdeConnectPluginConfig::configChanged, this, &RunCommandPlugin::configChanged);
connect(config(), &KdeConnectPluginConfig::configChanged, this, &RunCommandPlugin::sendConfig);
}
bool RunCommandPlugin::receivePacket(const NetworkPacket &np)
@ -82,9 +82,4 @@ void RunCommandPlugin::sendConfig()
sendPacket(np);
}
void RunCommandPlugin::configChanged()
{
sendConfig();
}
#include "runcommandplugin.moc"

View file

@ -26,9 +26,6 @@ public:
bool receivePacket(const NetworkPacket &np) override;
void connected() override;
private Q_SLOTS:
void configChanged();
private:
void sendConfig();
};

View file

@ -27,10 +27,8 @@ public:
void load() override;
void defaults() override;
private Q_SLOTS:
void loadApplications();
private:
void loadApplications();
Ui::SendNotificationsConfigUi *m_ui;
NotifyingApplicationModel *appModel;
};