1
/***************************************************************************
2
* Copyright (C) 2004-2006 by Thomas Fischer *
3
* fischer@unix-ag.uni-kl.de *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
20
#ifndef KBIBTEXENTRYWIDGET_H
21
#define KBIBTEXENTRYWIDGET_H
25
#include <qvaluelist.h>
28
#include <kdialogbase.h>
31
#include <entrywidgetsource.h>
49
class EntryWidget : public QWidget
53
friend class EntryWidgetDialog;
58
static QDialog::DialogCode execute( BibTeX::Entry *entry, BibTeX::File *bibtexfile, bool isReadOnly, bool isNew, QWidget *parent = 0, const char *name = 0 );
61
EntryWidget( BibTeX::File *bibtexfile, bool isReadOnly, bool isNew, QDialog *parent, const char *name = 0 );
62
void showEvent( QShowEvent * );
68
void apply( BibTeX::Entry *entry );
69
void reset( BibTeX::Entry *entry );
70
void slotEnableAllFields();
71
void slotForceDefaultIdSuggestion();
72
void slotEntryTypeChanged();
73
void slotCurrentPageChanged( QWidget* newPage );
74
void warningsExecute( QListViewItem* item );
75
void updateWarnings();
76
void insertIdSuggestion( int id );
77
void updateIdSuggestionsMenu();
78
void refreshFromURL();
79
void useExternalEntry( BibTeX::Entry*, bool );
80
void endExternalSearch( WebQuery::Status );
83
void updateTabs( BibTeX::Entry::EntryType entryType, bool enableAll, bool isReadOnly );
86
EntryWidget( BibTeX::Entry *entry, BibTeX::File *bibtexfile, bool isReadOnly, bool isNew, QDialog *parent, const char *name = 0 );
87
BibTeX::Entry *m_originalEntry;
88
BibTeX::File *m_bibtexfile;
91
bool m_defaultIdSuggestionAvailable;
93
QComboBox *m_comboBoxEntryType;
94
QLineEdit *m_lineEditID;
95
QPushButton *m_pushButtonForceDefaultIdSuggestion;
96
QPushButton *m_pushButtonIdSuggestions;
97
QPopupMenu *m_menuIdSuggestions;
98
QMap<int, QString> m_idToSuggestion;
99
QCheckBox *m_checkBoxEnableAll;
100
QPushButton *m_pushButtonRefetch;
101
QListView *m_listViewWarnings;
102
QTabWidget *m_tabWidget;
103
KBibTeX::EntryWidgetSource *m_sourcePage;
104
QValueList<KBibTeX::EntryWidgetTab*> m_internalEntryWidgets;
106
QTimer *m_updateWarningsTimer;
107
QDialog *m_dlgParent;
108
WebQueryArXiv *m_wqa;
111
void setupGUI( QWidget *parent, bool showWarnings = TRUE );
112
void addTabWidgets();
113
void addTabWidget( EntryWidgetTab *widget, const QString& title );
114
void setupEntryTypes();
116
void internalApply( BibTeX::Entry *entry );
117
void internalReset( BibTeX::Entry *entry );
118
void restoreWindowSize( KConfig *config );
119
void saveWindowSize( KConfig *config ) const;
122
class EntryWidgetDialog: public KDialogBase
126
EntryWidgetDialog( QWidget *parent = 0, const char *name = 0, bool modal = true, const QString &caption = QString::null, int buttonMask = Ok | Apply | Cancel ) : KDialogBase( parent, name, modal, caption, buttonMask ) {/* nothing */};
127
~EntryWidgetDialog() {/* nothing */};
128
void setMainWidget( EntryWidget *widget )
130
KDialogBase::setMainWidget( widget );
135
void closeEvent( QCloseEvent * e )
137
if ( m_widget->queryClose() ) e->accept();
144
if ( m_widget->queryClose() ) QDialog::done( Cancel );
149
if ( m_widget->queryClose() ) QDialog::done( Cancel );
153
EntryWidget *m_widget;