1
/***************************************************************************
2
* Copyright (C) 2004-2009 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
***************************************************************************/
23
#include <kdialogbase.h>
26
#include "preamblewidget.h"
31
QDialog::DialogCode PreambleWidget::execute( BibTeX::Preamble *preamble, bool isReadOnly, QWidget *parent, const char *name )
33
KDialogBase * dlg = new KDialogBase( parent, name, TRUE, i18n( "Edit BibTeX Preamble" ), KDialogBase::Ok | KDialogBase::Cancel );
34
PreambleWidget* preambleWidget = new PreambleWidget( preamble, isReadOnly, dlg, "PreambleWidget" );
36
dlg->setMainWidget( preambleWidget );
37
connect( dlg, SIGNAL( okClicked() ), preambleWidget, SLOT( apply() ) );
39
QDialog::DialogCode result = ( QDialog::DialogCode ) dlg->exec();
41
delete( preambleWidget );
47
PreambleWidget::PreambleWidget( BibTeX::Preamble *bibtexpreamble, bool isReadOnly, QWidget *parent, const char *name ) : QWidget( parent, name ), m_isReadOnly( isReadOnly ), m_bibtexpreamble( bibtexpreamble )
54
PreambleWidget::~PreambleWidget()
59
void PreambleWidget::apply()
61
BibTeX::Value *value = m_fieldLineEditPreambleValue->value();
62
m_bibtexpreamble->setValue( value );
65
void PreambleWidget::reset()
67
m_fieldLineEditPreambleValue->setValue( m_bibtexpreamble->value() );
70
void PreambleWidget::setupGUI()
72
setMinimumWidth( 384 );
74
QVBoxLayout * layout = new QVBoxLayout( this, 0, KDialog::spacingHint() );
76
QLabel *label = new QLabel( i18n( "&Preamble:" ), this );
77
layout->addWidget( label );
78
m_fieldLineEditPreambleValue = new KBibTeX::FieldLineEdit( i18n( "Preamble" ), KBibTeX::FieldLineEdit::itMultiLine, m_isReadOnly, this, "m_fieldLineEditPreambleValue" );
79
layout->addWidget( m_fieldLineEditPreambleValue );
80
label->setBuddy( m_fieldLineEditPreambleValue );