File indexing completed on 2024-12-08 04:34:22
0001 /* 0002 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "messagemaximumsizewidget.h" 0008 #include <KLineEditEventHandler> 0009 #include <KLocalizedString> 0010 #include <QFormLayout> 0011 #include <QLineEdit> 0012 0013 MessageMaximumSizeWidget::MessageMaximumSizeWidget(QWidget *parent) 0014 : QWidget{parent} 0015 , mFileName(new QLineEdit(this)) 0016 , mDescription(new QLineEdit(this)) 0017 { 0018 auto mainLayout = new QFormLayout(this); 0019 mainLayout->setObjectName(QStringLiteral("mainLayout")); 0020 mainLayout->setContentsMargins({}); 0021 0022 mFileName->setObjectName(QStringLiteral("mFileName")); 0023 mainLayout->addRow(i18n("Filename:"), mFileName); 0024 KLineEditEventHandler::catchReturnKey(mFileName); 0025 0026 mDescription->setObjectName(QStringLiteral("mDescription")); 0027 mainLayout->addRow(i18n("Description:"), mDescription); 0028 KLineEditEventHandler::catchReturnKey(mDescription); 0029 0030 connect(mFileName, &QLineEdit::textChanged, this, &MessageMaximumSizeWidget::slotTextChanged); 0031 connect(mDescription, &QLineEdit::textChanged, this, &MessageMaximumSizeWidget::slotTextChanged); 0032 } 0033 0034 MessageMaximumSizeWidget::~MessageMaximumSizeWidget() = default; 0035 0036 void MessageMaximumSizeWidget::slotTextChanged() 0037 { 0038 Q_EMIT updateOkButton(!mFileName->text().trimmed().isEmpty() && !mDescription->text().trimmed().isEmpty()); 0039 } 0040 0041 QString MessageMaximumSizeWidget::description() const 0042 { 0043 return mDescription->text(); 0044 } 0045 0046 QString MessageMaximumSizeWidget::fileName() const 0047 { 0048 return mFileName->text(); 0049 } 0050 0051 #include "moc_messagemaximumsizewidget.cpp"