diff -rupN original/toc.cpp modified/toc.cpp --- original/toc.cpp 2012-05-10 22:05:44.000000000 +0200 +++ modified/toc.cpp 2012-07-11 04:43:33.239245840 +0200 @@ -28,14 +28,16 @@ static void fillToc(const QDomNode &pare QTreeWidgetItem *newitem = 0; for (QDomNode node = parent.firstChild(); !node.isNull(); node = node.nextSibling()) { QDomElement e = node.toElement(); - + QStringList sa_LinkDestination_Values=e.attribute(QString::fromLatin1("Destination")).split(";"); + // LinkDestination.toString(): 0=kind;1=PageNr as int;2=left;3=bottom;4=right;5=top;6=zoom;7=changeLeft;8=changeTop;9=changeZoom + const double pageNumber = sa_LinkDestination_Values[1].toDouble()+sa_LinkDestination_Values[5].toDouble(); if (!parentItem) { newitem = new QTreeWidgetItem(tree, newitem); } else { newitem = new QTreeWidgetItem(parentItem, newitem); } newitem->setText(0, e.tagName()); - + newitem->setData(0, Qt::UserRole, pageNumber); bool isOpen = false; if (e.hasAttribute(QString::fromLatin1("Open"))) { isOpen = QVariant(e.attribute(QString::fromLatin1("Open"))).toBool(); @@ -59,6 +61,7 @@ TocDock::TocDock(QWidget *parent) m_tree->setAlternatingRowColors(true); m_tree->header()->hide(); setWindowTitle(tr("TOC")); + connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(goToPage(QTreeWidgetItem*,int))); m_tree->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); } @@ -78,7 +81,12 @@ void TocDock::fillInfo() m_tree->addTopLevelItem(item); } } - +void TocDock::goToPage(QTreeWidgetItem *item, int column) +{ + Q_UNUSED(column); + const double pageNumber = item->data(0, Qt::UserRole).toDouble() - 1; + setPage(pageNumber); +} void TocDock::documentClosed() { m_tree->clear(); diff -rupN original/toc.h modified/toc.h --- original/toc.h 2012-05-10 22:05:44.000000000 +0200 +++ modified/toc.h 2012-07-11 04:39:55.155237547 +0200 @@ -22,6 +22,7 @@ #include "abstractinfodock.h" class QTreeWidget; +class QTreeWidgetItem; class TocDock : public AbstractInfoDock { @@ -35,6 +36,8 @@ public: protected: /*virtual*/ void fillInfo(); +private Q_SLOTS: + void goToPage(QTreeWidgetItem *item, int column); private: QTreeWidget *m_tree;