Warning, file /libraries/baloo-widgets/src/keditcommentdialog.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: 2014 Felix Eisele 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #include "keditcommentdialog.h" 0008 0009 #include <QDialogButtonBox> 0010 #include <QLabel> 0011 #include <QLayout> 0012 #include <QPushButton> 0013 #include <QTextEdit> 0014 #include <QWidget> 0015 0016 #include <KLocalizedString> 0017 0018 KEditCommentDialog::KEditCommentDialog(QWidget *parent, const QString &commentText, const QString &captionText) 0019 : QDialog(parent) 0020 , m_editor(new QTextEdit(this)) 0021 { 0022 setWindowTitle(captionText); 0023 0024 auto layout = new QVBoxLayout(this); 0025 0026 m_editor->setText(commentText); 0027 0028 layout->addWidget(m_editor); 0029 0030 auto buttonBox = new QDialogButtonBox(this); 0031 layout->addWidget(buttonBox); 0032 0033 buttonBox->addButton(i18n("Save"), QDialogButtonBox::AcceptRole); 0034 buttonBox->addButton(QDialogButtonBox::Cancel); 0035 0036 connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); 0037 connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); 0038 0039 resize(sizeHint()); 0040 } 0041 0042 KEditCommentDialog::~KEditCommentDialog() = default; 0043 0044 QString KEditCommentDialog::getCommentText() const 0045 { 0046 return m_editor->toPlainText(); 0047 }