summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Martin <notmart@gmail.com>2015-09-18 16:22:28 (GMT)
committerMarco Martin <notmart@gmail.com>2015-09-18 16:22:28 (GMT)
commit8d8665582c278f99d2627032ff3004c9c0c22569 (patch)
tree1c35d680a47976e225fbdd3415a10d10dc207e12
parent933e72ec03ad9f3c1cd4b6baef576dc5be168219 (diff)
toolbar to open sidepanels
fix bookmarks management
-rw-r--r--mobile/app/package/contents/ui/Browser.qml19
-rw-r--r--mobile/app/package/contents/ui/Documents.qml2
-rw-r--r--mobile/app/package/contents/ui/FullScreenDelegate.qml1
-rw-r--r--mobile/app/package/contents/ui/main.qml50
-rw-r--r--mobile/components/documentitem.cpp10
-rw-r--r--mobile/components/documentitem.h4
6 files changed, 78 insertions, 8 deletions
diff --git a/mobile/app/package/contents/ui/Browser.qml b/mobile/app/package/contents/ui/Browser.qml
index fa88553..5022308 100644
--- a/mobile/app/package/contents/ui/Browser.qml
+++ b/mobile/app/package/contents/ui/Browser.qml
@@ -27,11 +27,20 @@ import org.kde.okular 2.0 as Okular
MobileComponents.SplitDrawer {
- id: mainDrawer
+ id: splitDrawer
anchors.fill: parent
visible: true
+
+ property alias splitDrawerOpen: splitDrawer.open
+ property alias overlayDrawerOpen: resourceBrowser.open
+ //An alias doesn't work
+ property bool bookmarked: pageArea.delegate.bookmarked
+ onBookmarkedChanged: {
+ pageArea.delegate.bookmarked = bookmarked
+ }
+
drawer: Documents {
- implicitWidth: mainDrawer.width/4 * 3
+ implicitWidth: splitDrawer.width/4 * 3
}
MobileComponents.OverlayDrawer {
@@ -47,6 +56,12 @@ MobileComponents.SplitDrawer {
property Item delegate: delegate1
property Item oldDelegate: delegate2
property bool incrementing: delegate.delta > 0
+
+ property bool bookmarked: delegate.bookmarked
+ onBookmarkedChanged: {
+ splitDrawer.bookmarked = delegate.bookmarked;
+ }
+
Connections {
target: pageArea.delegate
onDeltaChanged: {
diff --git a/mobile/app/package/contents/ui/Documents.qml b/mobile/app/package/contents/ui/Documents.qml
index c2318e8..a36aad8 100644
--- a/mobile/app/package/contents/ui/Documents.qml
+++ b/mobile/app/package/contents/ui/Documents.qml
@@ -96,7 +96,7 @@ PlasmaComponents.Page {
}
onClicked: {
documentItem.path = model.filePath;
- mainDrawer.open = false;
+ splitDrawer.open = false;
mainTabBar.currentTab = thumbnailsButton;
}
}
diff --git a/mobile/app/package/contents/ui/FullScreenDelegate.qml b/mobile/app/package/contents/ui/FullScreenDelegate.qml
index 832ca3b..6dbab69 100644
--- a/mobile/app/package/contents/ui/FullScreenDelegate.qml
+++ b/mobile/app/package/contents/ui/FullScreenDelegate.qml
@@ -39,6 +39,7 @@ MouseEventListener {
property alias document: mainPage.document
property alias pageNumber: mainPage.pageNumber
property Item pageItem: mainPage
+ property alias bookmarked: mainPage.bookmarked
onWheelMoved: {
if (wheel.modifiers == Qt.ControlModifier) {
diff --git a/mobile/app/package/contents/ui/main.qml b/mobile/app/package/contents/ui/main.qml
index 37ae5f5..ecd0bb0 100644
--- a/mobile/app/package/contents/ui/main.qml
+++ b/mobile/app/package/contents/ui/main.qml
@@ -37,6 +37,55 @@ ApplicationWindow {
uri: documentItem.path
}*/
+ statusBar: PlasmaComponents.ToolBar {
+ id: toolbar
+ tools: PlasmaComponents.ToolBarLayout {
+ //TODO: those buttons should support drag to open the menus as well
+ PlasmaComponents.ToolButton {
+ id: openButton
+ iconSource: "document-open"
+ checkable: true
+ onCheckedChanged: {
+ mainStack.currentPage.splitDrawerOpen = checked
+ if (checked) {
+ mainStack.currentPage.overlayDrawerOpen = false;
+ }
+ }
+ }
+ PlasmaComponents.ToolButton {
+ id: bookmarkButton
+ iconSource: "bookmarks-organize"
+ checkable: true
+ onCheckedChanged: {
+ mainStack.currentPage.bookmarked = checked
+ }
+ }
+ PlasmaComponents.ToolButton {
+ id: exploreButton
+ iconSource: "view-list-icons"
+ checkable: true
+ onCheckedChanged: {
+ mainStack.currentPage.overlayDrawerOpen = checked
+ if (checked) {
+ mainStack.currentPage.splitDrawerOpen = false;
+ }
+ }
+ }
+ }
+ Connections {
+ target: mainStack.currentPage
+ onSplitDrawerOpenChanged: {
+ openButton.checked = mainStack.currentPage.splitDrawerOpen;
+ }
+ onOverlayDrawerOpenChanged: {
+ exploreButton.checked = mainStack.currentPage.overlayDrawerOpen;
+ }
+ onBookmarkedChanged: {
+ bookmarkButton.checked = mainStack.currentPage.bookmarked
+ }
+ }
+ }
+
Okular.DocumentItem {
id: documentItem
onWindowTitleForDocumentChanged: {
@@ -47,7 +96,6 @@ ApplicationWindow {
PlasmaComponents.PageStack {
id: mainStack
clip: false
- anchors.fill: parent
}
//FIXME: this is due to global vars being binded after the parse is done, do the 2 steps parsing
diff --git a/mobile/components/documentitem.cpp b/mobile/components/documentitem.cpp
index 7472e74..973e055 100644
--- a/mobile/components/documentitem.cpp
+++ b/mobile/components/documentitem.cpp
@@ -73,6 +73,7 @@ void DocumentItem::setPath(const QString &path)
emit openedChanged();
emit supportsSearchingChanged();
emit windowTitleForDocumentChanged();
+ emit bookmarkedPagesChanged();
}
QString DocumentItem::windowTitleForDocument() const
@@ -130,7 +131,7 @@ TOCModel *DocumentItem::tableOfContents() const
return m_tocModel;
}
-QList<int> DocumentItem::bookmarkedPages() const
+QVariantList DocumentItem::bookmarkedPages() const
{
QList<int> list;
QSet<int> pages;
@@ -140,7 +141,12 @@ QList<int> DocumentItem::bookmarkedPages() const
}
list = pages.toList();
qSort(list);
- return list;
+
+ QVariantList variantList;
+ foreach (const int page, list) {
+ variantList << page;
+ }
+ return variantList;
}
QStringList DocumentItem::bookmarks() const
diff --git a/mobile/components/documentitem.h b/mobile/components/documentitem.h
index 000cbb5..e0f5345 100644
--- a/mobile/components/documentitem.h
+++ b/mobile/components/documentitem.h
@@ -86,7 +86,7 @@ class DocumentItem : public QObject
/**
* List of pages that contain a bookmark
*/
- Q_PROPERTY(QList<int> bookmarkedPages READ bookmarkedPages NOTIFY bookmarkedPagesChanged)
+ Q_PROPERTY(QVariantList bookmarkedPages READ bookmarkedPages NOTIFY bookmarkedPagesChanged)
/**
* list of bookmarks urls valid on this page
@@ -118,7 +118,7 @@ public:
TOCModel *tableOfContents() const;
- QList<int> bookmarkedPages() const;
+ QVariantList bookmarkedPages() const;
QStringList bookmarks() const;