2017-05-31 14:33:21 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2015 Albert Vaca <albertvaka@gmail.com>
|
2017-05-31 14:33:21 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2017-05-31 14:33:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sendreplydialog.h"
|
|
|
|
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QTextEdit>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QBoxLayout>
|
2020-11-11 11:58:37 +00:00
|
|
|
#include <QStandardPaths>
|
2017-05-31 14:33:21 +01:00
|
|
|
|
|
|
|
#include <KLocalizedString>
|
|
|
|
|
2017-08-03 16:23:12 +01:00
|
|
|
#include "ui_sendreplydialog.h"
|
|
|
|
|
2017-05-31 14:33:21 +01:00
|
|
|
SendReplyDialog::SendReplyDialog(const QString& originalMessage, const QString& replyId, const QString& topicName, QWidget* parent)
|
|
|
|
: QDialog(parent)
|
2017-09-03 20:39:44 +01:00
|
|
|
, m_replyId(replyId)
|
2017-08-03 16:23:12 +01:00
|
|
|
, m_ui(new Ui::SendReplyDialog)
|
2017-05-31 14:33:21 +01:00
|
|
|
{
|
2017-08-03 16:23:12 +01:00
|
|
|
m_ui->setupUi(this);
|
2019-06-10 15:40:28 +01:00
|
|
|
m_ui->textView->setText(topicName + QStringLiteral(": \n") + originalMessage);
|
2017-05-31 14:33:21 +01:00
|
|
|
|
2017-08-03 16:23:12 +01:00
|
|
|
auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok);
|
|
|
|
button->setText(i18n("Send"));
|
2017-05-31 14:33:21 +01:00
|
|
|
|
2017-08-03 16:23:12 +01:00
|
|
|
connect(this, &QDialog::accepted, this, &SendReplyDialog::sendButtonClicked);
|
2017-05-31 14:33:21 +01:00
|
|
|
setWindowTitle(topicName);
|
2021-05-23 06:12:29 +01:00
|
|
|
setWindowIcon(QIcon::fromTheme(QStringLiteral("kdeconnect")));
|
2017-05-31 14:33:21 +01:00
|
|
|
setAttribute(Qt::WA_DeleteOnClose);
|
2021-02-01 13:10:47 +00:00
|
|
|
m_ui->replyEdit->setFocus();
|
2017-05-31 14:33:21 +01:00
|
|
|
}
|
|
|
|
|
2017-08-03 16:23:12 +01:00
|
|
|
SendReplyDialog::~SendReplyDialog() = default;
|
2017-05-31 14:33:21 +01:00
|
|
|
|
|
|
|
void SendReplyDialog::sendButtonClicked()
|
|
|
|
{
|
2017-09-03 21:00:06 +01:00
|
|
|
Q_EMIT sendReply(m_replyId, m_ui->replyEdit->toPlainText());
|
2017-05-31 14:33:21 +01:00
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
QSize SendReplyDialog::sizeHint() const
|
|
|
|
{
|
|
|
|
return QSize(512, 64);
|
|
|
|
}
|