Messagelib

optionseteditor.cpp
1 /******************************************************************************
2  *
3  * SPDX-FileCopyrightText: 2008 Szymon Tomasz Stefanek <[email protected]>
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  *
7  *******************************************************************************/
8 
9 #include "utils/optionseteditor.h"
10 #include "core/optionset.h"
11 
12 #include <QGridLayout>
13 #include <QLabel>
14 
15 #include <KLocalizedString>
16 #include <KTextEdit>
17 #include <QLineEdit>
18 
19 using namespace MessageList::Utils;
20 using namespace MessageList::Core;
21 
22 OptionSetEditor::OptionSetEditor(QWidget *parent)
23  : QTabWidget(parent)
24 {
25  // General tab
26  auto tab = new QWidget(this);
27  addTab(tab, i18nc("@title:tab General options of a view mode", "General"));
28 
29  auto tabg = new QGridLayout(tab);
30 
31  auto l = new QLabel(i18nc("@label:textbox Name of the option", "Name:"), tab);
32  tabg->addWidget(l, 0, 0);
33 
34  mNameEdit = new QLineEdit(tab);
35 
36  tabg->addWidget(mNameEdit, 0, 1);
37 
38  connect(mNameEdit, &QLineEdit::textEdited, this, &OptionSetEditor::slotNameEditTextEdited);
39 
40  l = new QLabel(i18nc("@label:textbox Description of the option", "Description:"), tab);
41  tabg->addWidget(l, 1, 0);
42 
43  mDescriptionEdit = new KTextEdit(tab);
44  mDescriptionEdit->setAcceptRichText(false);
45  tabg->addWidget(mDescriptionEdit, 1, 1, 2, 1);
46 
47  tabg->setColumnStretch(1, 1);
48  tabg->setRowStretch(2, 1);
49 }
50 
51 OptionSetEditor::~OptionSetEditor() = default;
52 
53 void OptionSetEditor::setReadOnly(bool readOnly)
54 {
55  mDescriptionEdit->setReadOnly(readOnly);
56  mNameEdit->setReadOnly(readOnly);
57 }
58 
59 KTextEdit *OptionSetEditor::descriptionEdit() const
60 {
61  return mDescriptionEdit;
62 }
63 
64 QLineEdit *OptionSetEditor::nameEdit() const
65 {
66  return mNameEdit;
67 }
68 
69 #include "moc_optionseteditor.cpp"
void textEdited(const QString &text)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 22 2023 04:02:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.