~verzegnassi-stefano/+junk/docviewer-tmp-001

« back to all changes in this revision

Viewing changes to src/app/qml/ubuntu-docviewer-app.qml

  • Committer: Tarmac
  • Author(s): Stefano Verzegnassi
  • Date: 2015-01-21 18:37:55 UTC
  • mfrom: (48.2.1 ubuntu-docviewer-app)
  • Revision ID: tarmac-20150121183755-carz93q9aruvb2x8
Added Empty State in Welcome screen. Fixes: https://bugs.launchpad.net/bugs/1395065.

Approved by Andrew Hayzen, Nekhelesh Ramananthan, Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
    width: units.gu(50)
16
16
    height: units.gu(75)
17
17
 
18
 
    Arguments {
19
 
        id: args
20
 
 
21
 
        // It returns "expected argument" message when not specified a path.
22
 
        // It works anyway, but it may be worth to use Argument{} in future
23
 
        defaultArgument.help: "Path of the document"
24
 
        defaultArgument.valueNames: ["path"]
25
 
    }
26
 
 
27
18
    File {
28
19
        objectName: "fileObject"
29
20
        id: file
33
24
    }
34
25
 
35
26
    Component.onCompleted: {
36
 
        // Check if a value has been specified for "path" argument
37
 
        if (args.defaultArgument.at(0)) {
38
 
            // If so, send the path to the File plugin
39
 
            console.log("Path argument is:", args.defaultArgument.at(0))      
40
 
            file.path = args.defaultArgument.at(0)
 
27
        // Check if a value has been specified for "documentPath" argument.
 
28
        // The value for the argument is parsed in main.cpp.
 
29
 
 
30
        if (documentPath) {
 
31
            // If so, send the path to the File plugin and load the document.
 
32
            console.log("Path argument is:", documentPath);
 
33
            file.path = documentPath;
41
34
        } else {
42
 
            // Otherwise, push a welcome screen in the stack
43
 
            pageStack.push(Qt.resolvedUrl("WelcomePage.qml"))
 
35
            // Otherwise, push a welcome screen in the stack.
 
36
            pageStack.push(Qt.resolvedUrl("WelcomePage.qml"));
44
37
        }
45
38
    }
46
39
 
47
40
    // Content Importer
 
41
    // Used when user asks to open a document from ContentHub.
48
42
    Loader {
49
43
        id: contentHubLoader
50
44