[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [okular/mart/okularActive] active: book look for the table of contents
From: Marco Martin <notmart () gmail ! com>
Date: 2012-07-31 19:07:40
Message-ID: 20120731190740.90AD3A6094 () git ! kde ! org
[Download RAW message or body]
Git commit 2c87caaed3e125427f58e221efca0123955ed0e0 by Marco Martin.
Committed on 31/07/2012 at 21:07.
Pushed by mart into branch 'mart/okularActive'.
book look for the table of contents
M +0 -1 active/app/package/contents/ui/Browser.qml
M +3 -5 active/app/package/contents/ui/TableOfContents.qml
M +32 -14 active/app/package/contents/ui/TreeDelegate.qml
M +1 -0 active/components/documentitem.cpp
http://commits.kde.org/okular/2c87caaed3e125427f58e221efca0123955ed0e0
diff --git a/active/app/package/contents/ui/Browser.qml \
b/active/app/package/contents/ui/Browser.qml index eaeebaf..5a91575 100644
--- a/active/app/package/contents/ui/Browser.qml
+++ b/active/app/package/contents/ui/Browser.qml
@@ -146,7 +146,6 @@ MobileComponents.OverlayDrawer {
anchors.fill: parent
state: "Hidden"
-
Column {
id: toolbarContainer
z: 999
diff --git a/active/app/package/contents/ui/TableOfContents.qml \
b/active/app/package/contents/ui/TableOfContents.qml index 8e7c64b..0be1bc0 100644
--- a/active/app/package/contents/ui/TableOfContents.qml
+++ b/active/app/package/contents/ui/TableOfContents.qml
@@ -31,10 +31,7 @@ PlasmaComponents.Page {
busy: documentItem.searchInProgress
}
PlasmaExtras.ScrollArea {
- anchors {
- fill: parent
- leftMargin: handleGraphics.width
- }
+ anchors.fill: parent
Flickable {
id: flickable
@@ -43,13 +40,14 @@ PlasmaComponents.Page {
contentHeight: treeView.height
Column {
id: treeView
- //it's just a spacer
+ width: flickable.width
Repeater {
model: VisualDataModel {
id: tocModel
model: documentItem.tableOfContents
delegate: TreeDelegate {
sourceModel: tocModel
+ width: treeView.width
}
}
}
diff --git a/active/app/package/contents/ui/TreeDelegate.qml \
b/active/app/package/contents/ui/TreeDelegate.qml index d361bb2..1001266 100644
--- a/active/app/package/contents/ui/TreeDelegate.qml
+++ b/active/app/package/contents/ui/TreeDelegate.qml
@@ -20,37 +20,54 @@
import QtQuick 1.1
import org.kde.plasma.components 0.1 as PlasmaComponents
import org.kde.plasma.core 0.1 as PlasmaCore
-
+import org.kde.qtextracomponents 0.1
Column {
id: treeDelegate
property variant sourceModel
property int rowIndex: index
+ width: parent.width
+
MouseArea {
- width: childrenRect.width
+ width: parent.width
height: childrenRect.height
- Row {
- visible: \
display.toLowerCase().indexOf(searchField.searchQuery.toLowerCase()) \
!== -1
- spacing: 30
- PlasmaComponents.Label {
- id: label
- text: display
- }
- PlasmaComponents.Label {
- id: pageNumber
- text: page
- }
- }
+ visible: display.toLowerCase().indexOf(searchField.searchQuery.toLowerCase()) \
!== -1 +
onClicked: {
pageArea.delegate.pageNumber = page
documentItem.currentPage = page
resourceBrowser.open = false
}
+
+ PlasmaComponents.Label {
+ id: label
+ text: display
+ verticalAlignment: Text.AlignBottom
+ }
+ //there isn't a sane way to do a dotted line in QML1
+ Rectangle {
+ color: theme.textColor
+ opacity: 0.1
+ height: 1
+ anchors {
+ bottom: parent.bottom
+ left: label.right
+ right: pageNumber.left
+ }
+ }
+ PlasmaComponents.Label {
+ id: pageNumber
+ text: page
+ anchors.right: parent.right
+ verticalAlignment: Text.AlignBottom
+ anchors.rightMargin: 40
+ }
}
Column {
id: col
x: 20
+ width: parent.width - 20
property variant model: childrenModel
Repeater {
id: rep
@@ -64,6 +81,7 @@ Column {
if (treeDelegate.parent && treeDelegate.parent.model) {
sourceModel = treeDelegate.parent.model
}
+
childrenModel.rootIndex = sourceModel.modelIndex(index)
if (model.hasModelChildren) {
diff --git a/active/components/documentitem.cpp b/active/components/documentitem.cpp
index d37ff22..d5d49fb 100644
--- a/active/components/documentitem.cpp
+++ b/active/components/documentitem.cpp
@@ -49,6 +49,7 @@ void DocumentItem::setPath(const QString &path)
//TODO: remote urls
m_document->openDocument(path, KUrl(path), KMimeType::findByUrl(KUrl(path)));
+ m_tocModel->setCurrentViewport(m_document->viewport());
m_tocModel->fill(m_document->documentSynopsis());
m_matchingPages.clear();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic