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-06-19 03:38:44 +00:00
|
|
|
#include "QTocDialog.h"
|
2004-05-20 09:36:28 +00:00
|
|
|
#include "QToc.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
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-01-20 18:38:52 +00:00
|
|
|
QTocDialog::QTocDialog(QToc * form)
|
2004-06-02 20:13:18 +00:00
|
|
|
: 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();
|
|
|
|
|
2006-03-29 05:08:42 +00:00
|
|
|
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
|
|
|
|
connect(moveupPB, SIGNAL(clicked()), this, SLOT(moveup_adaptor()));
|
|
|
|
connect(movednPB, SIGNAL(clicked()), this, SLOT(movedn_adaptor()));
|
|
|
|
connect(moveinPB, SIGNAL(clicked()), this, SLOT(movein_adaptor()));
|
|
|
|
connect(moveoutPB, SIGNAL(clicked()), this, SLOT(moveout_adaptor()));
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-04-21 22:51:39 +00:00
|
|
|
void QTocDialog::enableButtons(bool enable)
|
|
|
|
{
|
|
|
|
updatePB->setEnabled(enable);
|
|
|
|
|
|
|
|
if (!form_->canOutline())
|
|
|
|
enable = false;
|
|
|
|
|
|
|
|
moveupPB->setEnabled(enable);
|
|
|
|
movednPB->setEnabled(enable);
|
|
|
|
moveinPB->setEnabled(enable);
|
|
|
|
moveoutPB->setEnabled(enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QTocDialog::update_adaptor()
|
|
|
|
{
|
|
|
|
form_->update();
|
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2006-03-29 05:08:42 +00:00
|
|
|
void QTocDialog::moveup_adaptor()
|
|
|
|
{
|
|
|
|
form_->moveup();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTocDialog::movedn_adaptor()
|
|
|
|
{
|
|
|
|
form_->movedn();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTocDialog::movein_adaptor()
|
|
|
|
{
|
|
|
|
form_->movein();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTocDialog::moveout_adaptor()
|
|
|
|
{
|
|
|
|
form_->moveout();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|