~verzegnassi-stefano/ubuntu-docviewer-app/reboot-document-last-position

« back to all changes in this revision

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

  • Committer: Stefano Verzegnassi
  • Date: 2015-02-13 15:30:01 UTC
  • mto: This revision was merged to the branch mainline in revision 86.
  • Revision ID: stefano92.100@gmail.com-20150213153001-qryx268e54guvleu
Basically:
 - Refactored project structure (too much QML files in the same folder)
 - Added full content-hub support
 - Uri handler support
 - In-app browser
 - Document Viewer has now rw permissions in /home/stefano/Documents

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2014-2015 Canonical, Ltd.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify
5
 
 * it under the terms of the GNU General Public License as published by
6
 
 * the Free Software Foundation; version 3.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful,
9
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 * GNU General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License
14
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 */
16
 
 
17
 
import QtQuick 2.3
18
 
import Ubuntu.Components 1.1
19
 
import QtQuick.Layouts 1.1
20
 
import Ubuntu.Components.Popups 1.0
21
 
 
22
 
PageHeadState {
23
 
    id: rootItem
24
 
 
25
 
    property Page targetPage
26
 
    property alias activityRunning: activity.running
27
 
 
28
 
    head: targetPage.head
29
 
 
30
 
    contents: RowLayout {
31
 
        anchors.fill: parent
32
 
        spacing: units.gu(1)
33
 
 
34
 
        ActivityIndicator { id: activity }
35
 
 
36
 
        Column {
37
 
            id: layout
38
 
            Layout.fillWidth: true
39
 
 
40
 
            Label {
41
 
                width: parent.width
42
 
                //horizontalAlignment: Text.AlignHCenter
43
 
                elide: Text.ElideMiddle
44
 
 
45
 
                font.weight: Font.DemiBold
46
 
                text: targetPage.title
47
 
            }
48
 
            Label {
49
 
                width: parent.width
50
 
                //horizontalAlignment: Text.AlignHCenter
51
 
                elide: Text.ElideMiddle
52
 
 
53
 
                fontSize: "small"
54
 
                text: file.description
55
 
            }
56
 
        }
57
 
    }
58
 
 
59
 
    backAction: Action {
60
 
        iconName: "back"
61
 
        text: (pageStack.depth > 1) ? i18n.tr("Back") : i18n.tr("Close")
62
 
        onTriggered: {
63
 
            if (pageStack.depth > 1) {
64
 
                // Go back to Welcome page
65
 
                pageStack.pop();
66
 
            } else {
67
 
                // File has been imported through Content Hub (or was not chosen through WelcomePage)
68
 
                // Close the application and show our source app (e.g. ubuntu-filemanager-app, if used to open a document)
69
 
                Qt.quit()
70
 
            }
71
 
        }
72
 
    }
73
 
 
74
 
    actions: [
75
 
        Action {
76
 
            objectName: "detailsAction"
77
 
            text: i18n.tr("Details")
78
 
            iconName: "info"
79
 
            onTriggered: pageStack.push(Qt.resolvedUrl("DetailsPage.qml"))
80
 
        }
81
 
    ]
82
 
}