1 /*************************************************************************** 2 * Copyright (C) 2004-2018 by Thomas Fischer <fischer@unix-ag.uni-kl.de> * 3 * * 4 * This program is free software; you can redistribute it and/or modify * 5 * it under the terms of the GNU General Public License as published by * 6 * the Free Software Foundation; either version 2 of the License, or * 7 * (at your option) any later version. * 8 * * 9 * This program is distributed in the hope that it will be useful, * 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 * GNU General Public License for more details. * 13 * * 14 * You should have received a copy of the GNU General Public License * 15 * along with this program; if not, see <https://www.gnu.org/licenses/>. * 16 ***************************************************************************/ 17 18 #ifndef KBIBTEX_GUI_FIELDINPUT_H 19 #define KBIBTEX_GUI_FIELDINPUT_H 20 21 #include "kbibtexgui_export.h" 22 23 #include <QWidget> 24 25 #include "value.h" 26 #include "kbibtex.h" 27 28 class Element; 29 30 /** 31 * @author Thomas Fischer <fischer@unix-ag.uni-kl.de> 32 */ 33 class KBIBTEXGUI_EXPORT FieldInput : public QWidget 34 { 35 Q_OBJECT 36 37 public: 38 FieldInput(KBibTeX::FieldInputType fieldInputType, KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags typeFlags, QWidget *parent = nullptr); 39 ~FieldInput() override; 40 41 bool reset(const Value &value); 42 bool apply(Value &value) const; 43 bool validate(QWidget **widgetWithIssue, QString &message) const; 44 45 void clear(); 46 void setReadOnly(bool isReadOnly); 47 48 void setFile(const File *file); 49 void setElement(const Element *element); 50 void setFieldKey(const QString &fieldKey); 51 void setCompletionItems(const QStringList &items); 52 53 QWidget *buddy(); 54 55 signals: 56 void modified(); 57 58 private slots: 59 void setMonth(int month); 60 void setEdition(int edition); 61 void selectCrossRef(); 62 63 private: 64 class FieldInputPrivate; 65 FieldInputPrivate *d; 66 }; 67 68 #endif // KBIBTEX_GUI_FIELDINPUT_H 69