]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QTocDialog.C
get rid of broken_header.h and some unneeded tests
[lyx.git] / src / frontends / qt2 / QTocDialog.C
1 /**
2  * \file QTocDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "QTocDialog.h"
14 #include "QToc.h"
15 #include "qt_helpers.h"
16
17 #include <qlistview.h>
18 #include <qpushbutton.h>
19
20 namespace lyx {
21 namespace frontend {
22
23 QTocDialog::QTocDialog(QToc * form)
24         : QTocDialogBase(0, 0, false, 0),
25         form_(form)
26 {
27         // disable sorting
28         tocLV->setSorting(-1);
29
30         // hide the pointless QHeader
31         QWidget * w = static_cast<QWidget*>(tocLV->child("list view header"));
32         if (w)
33                 w->hide();
34
35         connect(closePB, SIGNAL(clicked()),
36                 form, SLOT(slotClose()));
37 }
38
39
40 QTocDialog::~QTocDialog()
41 {
42 }
43
44
45 void QTocDialog::activate_adaptor(int)
46 {
47         form_->updateToc(form_->depth_);
48 }
49
50
51 void QTocDialog::depth_adaptor(int depth)
52 {
53         form_->set_depth(depth);
54 }
55
56
57 void QTocDialog::select_adaptor(QListViewItem * item)
58 {
59         form_->select(fromqstr(item->text(0)));
60 }
61
62
63 void QTocDialog::update_adaptor()
64 {
65         form_->update();
66 }
67
68
69 void QTocDialog::closeEvent(QCloseEvent * e)
70 {
71         form_->slotWMHide();
72         e->accept();
73 }
74
75 } // namespace frontend
76 } // namespace lyx