~mutse-young/ubuntu-docviewer-app/trunk

« back to all changes in this revision

Viewing changes to src/app/qml/PdfViewDefaultHeader.qml

  • Committer: Tarmac
  • Author(s): Stefano Verzegnassi
  • Date: 2014-11-28 23:08:00 UTC
  • mfrom: (36.3.8 content-hub-support)
  • Revision ID: tarmac-20141128230800-6t6nd9dhc0w157wo
Added a GoToPage dialog in pdfView. Fixes: https://bugs.launchpad.net/bugs/1390684.

Approved by Anthony Granger, Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.3
 
2
import Ubuntu.Components 1.1
 
3
import Ubuntu.Components.Popups 1.0
 
4
 
 
5
PageHeadState {
 
6
    id: rootItem
 
7
 
 
8
    property Page targetPage
 
9
 
 
10
    head: targetPage.head
 
11
 
 
12
    contents: Column {
 
13
        anchors.centerIn: parent
 
14
 
 
15
        Label {
 
16
            id: titleLabel
 
17
            text: targetPage.title
 
18
            font.weight: Font.DemiBold
 
19
            anchors.horizontalCenter: parent.horizontalCenter
 
20
        }
 
21
        Label {
 
22
            id: currentPageLabel
 
23
            text: targetPage.currentPage
 
24
            fontSize: "small"
 
25
            anchors.horizontalCenter: parent.horizontalCenter
 
26
        }
 
27
    }
 
28
 
 
29
    backAction: Action {
 
30
        iconName: "back"
 
31
        text: (pageStack.depth > 1) ? i18n.tr("Back") : i18n.tr("Close")
 
32
        onTriggered: {
 
33
            if (pageStack.depth > 1) {
 
34
                // Go back to Welcome page
 
35
                pageStack.pop();
 
36
            } else {
 
37
                // File has been imported through Content Hub (or was not chosen through WelcomePage)
 
38
                // Close the application and show our source app (e.g. ubuntu-filemanager-app, if used to open a document)
 
39
                Qt.quit()
 
40
            }
 
41
        }
 
42
    }
 
43
 
 
44
    actions: [
 
45
        Action {
 
46
            iconName: "search"
 
47
            // onTriggered: pageMain.state = "search"
 
48
            //Disable it until we provide search in Poppler plugin.
 
49
            enabled: false
 
50
        },
 
51
 
 
52
        Action {
 
53
            iconName: "browser-tabs"
 
54
            text: "Go to page..."
 
55
            onTriggered: PopupUtils.open(targetPage.goToPageDialog)
 
56
        },
 
57
 
 
58
        Action {
 
59
            objectName: "detailsAction"
 
60
            text: i18n.tr("Details")
 
61
            iconName: "info"
 
62
            onTriggered: pageStack.push(Qt.resolvedUrl("DetailsPage.qml"))
 
63
        }
 
64
    ]
 
65
}