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_FIELDLINEEDIT_H 0021 #define KBIBTEX_GUI_FIELDLINEEDIT_H 0022 0023 #include "kbibtexgui_export.h" 0024 0025 #include <QIcon> 0026 0027 #include <KBibTeX> 0028 #include <Value> 0029 #include <widgets/MenuLineEdit> 0030 0031 class QMenu; 0032 0033 class Element; 0034 class File; 0035 0036 /** 0037 * @author Thomas Fischer <fischer@unix-ag.uni-kl.de> 0038 */ 0039 class KBIBTEXGUI_EXPORT FieldLineEdit : public MenuLineEdit 0040 { 0041 Q_OBJECT 0042 0043 public: 0044 FieldLineEdit(KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags typeFlags, bool isMultiLine = false, QWidget *parent = nullptr); 0045 ~FieldLineEdit() override; 0046 0047 bool reset(const Value &value); 0048 bool apply(Value &value) const; 0049 bool validate(QWidget **widgetWithIssue, QString &message) const; 0050 void clear() override; 0051 void setReadOnly(bool) override; 0052 0053 void setFile(const File *file); 0054 void setElement(const Element *element); 0055 void setFieldKey(const QString &fieldKey); 0056 0057 protected: 0058 void dragEnterEvent(QDragEnterEvent *event) override; 0059 void dropEvent(QDropEvent *event) override; 0060 0061 private: 0062 bool m_incompleteRepresentation; 0063 0064 KBibTeX::TypeFlag typeFlag(); 0065 KBibTeX::TypeFlag setTypeFlag(KBibTeX::TypeFlag typeFlag); 0066 0067 void setupMenu(); 0068 void updateGUI(); 0069 0070 class FieldLineEditPrivate; 0071 FieldLineEdit::FieldLineEditPrivate *d; 0072 }; 0073 0074 #endif // KBIBTEX_GUI_FIELDLINEEDIT_H