2001-08-19 13:25:15 +00:00
|
|
|
/**
|
|
|
|
* \file QIndex.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-08-19 13:25:15 +00:00
|
|
|
*
|
2002-10-20 01:48:28 +00:00
|
|
|
* \author John Levon
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-08-19 13:25:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2003-09-29 10:50:51 +00:00
|
|
|
#include "debug.h"
|
2003-03-07 14:08:10 +00:00
|
|
|
#include "ControlCommand.h"
|
2002-12-17 20:37:13 +00:00
|
|
|
#include "qt_helpers.h"
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "QIndexDialog.h"
|
|
|
|
#include "QIndex.h"
|
|
|
|
#include "Qt2BC.h"
|
2003-03-10 03:13:28 +00:00
|
|
|
#include "ButtonController.h"
|
2003-03-05 10:47:11 +00:00
|
|
|
#include <qlabel.h>
|
2001-08-19 13:25:15 +00:00
|
|
|
#include <qlineedit.h>
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2003-03-05 10:47:11 +00:00
|
|
|
typedef QController<ControlCommand, QView<QIndexDialog> > base_class;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2003-05-22 18:14:36 +00:00
|
|
|
QIndex::QIndex(Dialog & parent, string const & title, QString const & label)
|
2003-03-05 10:47:11 +00:00
|
|
|
: base_class(parent, title), label_(label)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-26 00:29:39 +00:00
|
|
|
void QIndex::build_dialog()
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2001-08-21 01:14:54 +00:00
|
|
|
dialog_.reset(new QIndexDialog(this));
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2003-03-05 10:47:11 +00:00
|
|
|
dialog_->keywordLA->setText(label_);
|
|
|
|
|
2003-03-10 03:13:28 +00:00
|
|
|
bcview().setOK(dialog_->okPB);
|
|
|
|
bcview().setCancel(dialog_->closePB);
|
|
|
|
bcview().addReadOnly(dialog_->keywordED);
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-25 20:04:15 +00:00
|
|
|
void QIndex::update_contents()
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2003-01-15 22:05:20 +00:00
|
|
|
string const contents = controller().params().getContents();
|
|
|
|
dialog_->keywordED->setText(toqstr(contents));
|
|
|
|
|
|
|
|
bc().valid(!contents.empty());
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QIndex::apply()
|
|
|
|
{
|
2002-12-17 20:37:13 +00:00
|
|
|
controller().params().setContents(fromqstr(dialog_->keywordED->text()));
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
2001-08-25 20:04:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
bool QIndex::isValid()
|
|
|
|
{
|
2002-11-30 02:09:16 +00:00
|
|
|
return !dialog_->keywordED->text().isEmpty();
|
2001-08-25 20:04:15 +00:00
|
|
|
}
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|