~mrqtros/ubuntu-docviewer-app/ubuntu-docviewer-app-pdf-renderengine

« back to all changes in this revision

Viewing changes to src/app/qml/loView/LOViewDefaultHeader.qml

  • Committer: Tarmac
  • Author(s): Stefano Verzegnassi
  • Date: 2015-11-30 20:54:47 UTC
  • mfrom: (215.2.3 ubuntu-docviewer-app)
  • Revision ID: tarmac-20151130205447-xkmlk33g8lfn03m0
* Added splashscreen for loViewer
* Moved the async logic that loads loViewer in another component
* Removed 'PanelButton' component - no longer used
* Changed the behaviour of the header in the loViewer: if (textDocument) hideableHeader = true
* Don't use a global 'graphics' folder. Assets are now placed in the module which uses them. Fixes: https://bugs.launchpad.net/bugs/1495079.

Approved by Roman Shchekin, Alan Pope , Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
            Layout.fillWidth: true
38
38
 
39
39
            Label {
40
 
            anchors { left: parent.left; right: parent.right }
41
 
            elide: Text.ElideMiddle
42
 
            font.weight: Font.DemiBold
43
 
            text: targetPage.title
44
 
        }
45
 
        Label {
46
 
            anchors { left: parent.left; right: parent.right }
47
 
            elide: Text.ElideMiddle
48
 
            textSize: Label.Small
49
 
            text: {
50
 
                if (!loPageContentLoader.item)
51
 
                    return i18n.tr("Loading...")
 
40
                anchors { left: parent.left; right: parent.right }
 
41
                elide: Text.ElideMiddle
 
42
                font.weight: Font.DemiBold
 
43
                text: targetPage.title
 
44
            }
 
45
            Label {
 
46
                anchors { left: parent.left; right: parent.right }
 
47
                elide: Text.ElideMiddle
 
48
                textSize: Label.Small
 
49
                text: {
 
50
                    if (!targetPage.contentItem)
 
51
                        return i18n.tr("Loading...")
52
52
 
53
 
                switch(loPageContentLoader.item.loDocument.documentType) {
54
 
                case 0:
55
 
                    return i18n.tr("LibreOffice text document")
56
 
                case 1:
57
 
                    return i18n.tr("LibreOffice spread sheet")
58
 
                case 2:
59
 
                    return i18n.tr("LibreOffice presentation")
60
 
                case 3:
61
 
                    return i18n.tr("LibreOffice Draw document")
62
 
                case 4:
63
 
                    return i18n.tr("Unknown LibreOffice document")
64
 
                default:
65
 
                    return i18n.tr("Unknown type document")
 
53
                    switch(targetPage.contentItem.loDocument.documentType) {
 
54
                    case 0:
 
55
                        return i18n.tr("LibreOffice text document")
 
56
                    case 1:
 
57
                        return i18n.tr("LibreOffice spread sheet")
 
58
                    case 2:
 
59
                        return i18n.tr("LibreOffice presentation")
 
60
                    case 3:
 
61
                        return i18n.tr("LibreOffice Draw document")
 
62
                    case 4:
 
63
                        return i18n.tr("Unknown LibreOffice document")
 
64
                    default:
 
65
                        return i18n.tr("Unknown type document")
66
66
                    }
67
67
                }
68
68
            }
72
72
            Layout.preferredWidth: units.gu(12)
73
73
            Layout.preferredHeight: units.gu(4)
74
74
 
75
 
            visible: {
76
 
                if (!loPageContentLoader.item)
77
 
                    return false
78
 
 
79
 
                return DocumentViewer.desktopMode || targetPage.width > units.gu(80)
80
 
            }
 
75
            view: targetPage.contentItem.loView
 
76
            visible: targetPage.contentItem && (DocumentViewer.desktopMode || mainView.wideWindow)
81
77
        }
82
78
    }
83
79
 
84
80
    actions: [
85
 
       /* Action {
86
 
            iconName: "Search"
87
 
            text: i18n.tr("Search")
88
 
            enabled: false
89
 
        },*/
90
 
 
91
81
        Action {
92
82
            // FIXME: Autopilot test broken... seems not to detect we're now using an ActionBar since the switch to UITK 1.3
93
83
            objectName: "gotopage"
94
84
            iconName: "browser-tabs"
95
85
            text: i18n.tr("Go to position...")
96
 
            onTriggered: PopupUtils.open(Qt.resolvedUrl("LOViewGotoDialog.qml"), targetPage)
97
 
            visible: loPageContentLoader.item.loDocument.documentType == LibreOffice.Document.TextDocument
 
86
            visible: targetPage.contentItem.loDocument.documentType == LibreOffice.Document.TextDocument
 
87
 
 
88
            onTriggered: {
 
89
                PopupUtils.open(
 
90
                            Qt.resolvedUrl("LOViewGotoDialog.qml"),
 
91
                            targetPage,
 
92
                            {
 
93
                                view: targetPage.contentItem.loView
 
94
                            })
 
95
            }
98
96
        },
99
97
 
100
98
        Action {
101
99
            iconName: "night-mode"
102
100
            text: mainView.nightModeEnabled ? i18n.tr("Disable night mode") : i18n.tr("Enable night mode")
 
101
 
103
102
            onTriggered: mainView.nightModeEnabled = !mainView.nightModeEnabled
104
103
        },
105
104
 
107
106
            objectName: "detailsAction"
108
107
            text: i18n.tr("Details")
109
108
            iconName: "info"
 
109
 
110
110
            onTriggered: pageStack.push(Qt.resolvedUrl("../common/DetailsPage.qml"))
111
111
        }
112
112
    ]