File indexing completed on 2025-02-23 04:42:21

0001 /***************************************************************************
0002  *   SPDX-License-Identifier: GPL-2.0-or-later
0003  *                                                                         *
0004  *   SPDX-FileCopyrightText: 2004-2022 Thomas Fischer <fischer@unix-ag.uni-kl.de>
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  *   This program is distributed in the hope that it will be useful,       *
0012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0014  *   GNU General Public License for more details.                          *
0015  *                                                                         *
0016  *   You should have received a copy of the GNU General Public License     *
0017  *   along with this program; if not, see <https://www.gnu.org/licenses/>. *
0018  ***************************************************************************/
0019 
0020 #ifndef KBIBTEX_GUI_FIELDINPUT_H
0021 #define KBIBTEX_GUI_FIELDINPUT_H
0022 
0023 #include <QWidget>
0024 
0025 #include <KBibTeX>
0026 #include <Value>
0027 
0028 #include "kbibtexgui_export.h"
0029 
0030 class Element;
0031 class File;
0032 
0033 /**
0034  * @author Thomas Fischer <fischer@unix-ag.uni-kl.de>
0035  */
0036 class KBIBTEXGUI_EXPORT FieldInput : public QWidget
0037 {
0038     Q_OBJECT
0039 
0040 public:
0041     FieldInput(KBibTeX::FieldInputType fieldInputType, KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags typeFlags, QWidget *parent = nullptr);
0042     ~FieldInput() override;
0043 
0044     bool reset(const Value &value);
0045     bool apply(Value &value) const;
0046     bool validate(QWidget **widgetWithIssue, QString &message) const;
0047 
0048     void clear();
0049     void setReadOnly(bool isReadOnly);
0050 
0051     void setFile(const File *file);
0052     void setElement(const Element *element);
0053     void setFieldKey(const QString &fieldKey);
0054     void setCompletionItems(const QStringList &items);
0055 
0056     QWidget *buddy();
0057 
0058 Q_SIGNALS:
0059     void modified();
0060 
0061 private Q_SLOTS:
0062     void selectCrossRef();
0063 
0064 private:
0065     class FieldInputPrivate;
0066     FieldInputPrivate *d;
0067 };
0068 
0069 #endif // KBIBTEX_GUI_FIELDINPUT_H