Documentation code example does nothing on desktop

Bug #1249267 reported by Stuart Langridge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
content-hub
Invalid
Undecided
Unassigned

Bug Description

The documentation example on http://developer.ubuntu.com/api/qml/sdk-1.0/Ubuntu.Content.ContentHub/ for importing content via the content hub (once fixed to be a working app as per Bug #1249264) does not actually import any content.

Code tweaked to look like this:

import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Content 0.1
Rectangle {
    id: root
    width: units.gu(60)
    height: units.gu(60)
    Column {
        Button {
            text: "Import from default"
            onClicked: {
            var peer = ContentHub.defaultSourceForType(ContentType.Pictures);
            activeTransfer = ContentHub.importContent(ContentType.Pictures, peer);
            }
        }
        Button {
            text: "Import from a selectable list"
            onClicked: {
                activeTransfer = ContentHub.importContent(ContentType.Pictures);
                activeTransfer.selectionType =ContentTransfer.Multiple;
                activeTransfer.start();
            }
        }
    }
    ContentImportHint {
        id: importHint
        anchors.fill: parent
        activeTransfer: root.activeTransfer
    }

    property list<ContentItem> importItems
    property var activeTransfer

    Connections {
        target: root.activeTransfer
        onStateChanged: {
            if (root.activeTransfer.state === ContentTransfer.Charged)
            importItems = root.activeTransfer.items;
        }
    }
}

On startup, this error is thrown in the console:
file:///home/aquarius/Scratch/contenthub.qml:35: Unable to assign [undefined] to QObject*
line 35 is " target: root.activeTransfer".

Pressing the "import from default" button does nothing, visually, and dumps this to the console:
QObject* qml_content_hub(QQmlEngine*, QJSEngine*)
QmlImportExportHandler::QmlImportExportHandler(QObject*)
virtual void com::ubuntu::content::Hub::register_import_export_handler(com::ubuntu::content::ImportExportHandler*)
APP_ID isn't set, the handler can not be registered
ContentPeer* ContentHub::defaultSourceForType(int)
static const com::ubuntu::content::Type& ContentType::contentType2HubType(int) 2
ContentPeer::ContentPeer(QObject*)
ContentTransfer* ContentHub::importContent(int, ContentPeer*) 2 ContentPeer(0x1927890)
static const com::ubuntu::content::Type& ContentType::contentType2HubType(int) 2
ContentTransfer::ContentTransfer(QObject*)
void ContentTransfer::setTransfer(com::ubuntu::content::Transfer*, ContentTransfer::Direction)
void ContentTransfer::updateSelectionType()
void ContentTransfer::updateStore()
void ContentTransfer::updateState()
ContentTransfer::State ContentTransfer::state() const
ContentTransfer::State ContentTransfer::state() const
void ContentTransfer::updateStore()

It is possible that "APP_ID isn't set, the handler can not be registered" is a relevant error message here, but nothing says anywhere what an "APP_ID" is, and the example does not include one.

Pressing the "Import from a selectable list" fills the window with a mostly-opaque black background and an orange spinner, and nothing else. The following is written to the console:

QObject* qml_content_hub(QQmlEngine*, QJSEngine*)
QmlImportExportHandler::QmlImportExportHandler(QObject*)
virtual void com::ubuntu::content::Hub::register_import_export_handler(com::ubuntu::content::ImportExportHandler*)
APP_ID isn't set, the handler can not be registered
ContentTransfer* ContentHub::importContent(int) 2
static const com::ubuntu::content::Type& ContentType::contentType2HubType(int) 2
ContentTransfer::ContentTransfer(QObject*)
void ContentTransfer::setTransfer(com::ubuntu::content::Transfer*, ContentTransfer::Direction)
void ContentTransfer::updateSelectionType()
void ContentTransfer::updateStore()
void ContentTransfer::updateState()
ContentTransfer::State ContentTransfer::state() const
ContentTransfer::State ContentTransfer::state() const
void ContentTransfer::setSelectionType(ContentTransfer::SelectionType) 1
bool ContentTransfer::start()
void ContentTransfer::updateStore()
void ContentTransfer::updateSelectionType()
void ContentTransfer::updateState()
ContentTransfer::State ContentTransfer::state() const
ContentTransfer::State ContentTransfer::state() const
ContentTransfer::State ContentTransfer::state() const
file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/Popups/Dialog.qml:175:9: QML Column: Binding loop detected for property "height"
file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/Popups/Dialog.qml:175:9: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function.
file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/Popups/Dialog.qml:175:9: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function.

Since I do not create any Dialogs, I assume this is a bug in the contenthub's creation of a Dialog?

Revision history for this message
Ken VanDine (ken-vandine) wrote :

This example requires the default photo application be installed, in this case installing gallery-app fixed this problem for Stuart.

Changed in content-hub:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.