2001-08-19 13:25:15 +00:00
|
|
|
/**
|
|
|
|
* \file QTocDialog.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>
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-09-24 13:57:09 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
#include "QToc.h"
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "QTocDialog.h"
|
2002-12-17 20:37:13 +00:00
|
|
|
#include "qt_helpers.h"
|
2001-08-19 13:25:15 +00:00
|
|
|
|
|
|
|
#include <qlistview.h>
|
2002-01-20 18:38:52 +00:00
|
|
|
#include <qpushbutton.h>
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-01-20 18:38:52 +00:00
|
|
|
QTocDialog::QTocDialog(QToc * form)
|
|
|
|
: QTocDialogBase(0, 0, false, 0),
|
2001-08-19 13:25:15 +00:00
|
|
|
form_(form)
|
|
|
|
{
|
2003-02-02 20:56:28 +00:00
|
|
|
// disable sorting
|
|
|
|
tocLV->setSorting(-1);
|
|
|
|
|
2003-04-12 04:49:05 +00:00
|
|
|
// hide the pointless QHeader
|
|
|
|
QWidget * w = static_cast<QWidget*>(tocLV->child("list view header"));
|
|
|
|
if (w)
|
|
|
|
w->hide();
|
|
|
|
|
2002-01-20 18:38:52 +00:00
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotClose()));
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
|
|
|
|
QTocDialog::~QTocDialog()
|
|
|
|
{
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-01-20 18:38:52 +00:00
|
|
|
void QTocDialog::activate_adaptor(int)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-01-20 18:38:52 +00:00
|
|
|
form_->updateToc(form_->depth_);
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
|
|
|
2002-01-20 18:38:52 +00:00
|
|
|
void QTocDialog::depth_adaptor(int depth)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-01-20 18:38:52 +00:00
|
|
|
form_->set_depth(depth);
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-20 18:38:52 +00:00
|
|
|
void QTocDialog::select_adaptor(QListViewItem * item)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-12-17 20:37:13 +00:00
|
|
|
form_->select(fromqstr(item->text(0)));
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTocDialog::update_adaptor()
|
|
|
|
{
|
|
|
|
form_->update();
|
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QTocDialog::closeEvent(QCloseEvent * e)
|
|
|
|
{
|
2002-01-20 18:38:52 +00:00
|
|
|
form_->slotWMHide();
|
2001-08-19 13:25:15 +00:00
|
|
|
e->accept();
|
|
|
|
}
|