diff -Nru content-hub-0.0+14.04.20140321/debian/changelog content-hub-0.0+14.04.20140402/debian/changelog --- content-hub-0.0+14.04.20140321/debian/changelog 2014-04-02 16:17:50.000000000 +0000 +++ content-hub-0.0+14.04.20140402/debian/changelog 2014-04-02 16:17:50.000000000 +0000 @@ -1,3 +1,38 @@ +content-hub (0.0+14.04.20140402-0ubuntu1) trusty; urgency=low + + [ Loïc Minier ] + * Downgrade content-hub Recommends to a Suggests as we don't want + content-hub pulled via ubuntu-sdk on developer desktops. + + [ Ken VanDine ] + * protect against queries for Type::unknown (LP: #1293463) + * Replace a couple missed qDebug lines for logging + * Don't unref the g_icon, the value belongs to app + * Ensure m_defaultSources is a StringList before attempting to use it + as a list + * ContentPeerPicker: Make headers translatable and use a + ResponsiveGridView for the devices grid to match the apps grid. + ContentPeerPicker: hide the devices section until we have a way to + populate it + + [ Javier Collado ] + * Added README file (LP: #1274899) + + [ Dimitri John Ledkov ] + * Exit quicker, if there is nothing to do. (LP: #1287674) (LP: + #1287674) + + [ Michael Sheldon ] + * Fixes updating of the ContentPeerModel when using Loader and + changing ContentType or ContentHandler dynamically and ensures that + ContentPeerModel Loader doesn't begin loading the model until the + peer picker becomes visible (avoiding delaying app start-up time). + * Make qdoc based documentation compatible with the Qt 5.2 version of + qdoc. + * Fixes version number of import statements in QML documentation. + + -- Ubuntu daily release Wed, 02 Apr 2014 14:46:54 +0000 + content-hub (0.0+14.04.20140321-0ubuntu1) trusty; urgency=low [ Ken VanDine ] diff -Nru content-hub-0.0+14.04.20140321/debian/control content-hub-0.0+14.04.20140402/debian/control --- content-hub-0.0+14.04.20140321/debian/control 2014-04-02 16:17:50.000000000 +0000 +++ content-hub-0.0+14.04.20140402/debian/control 2014-04-02 16:17:50.000000000 +0000 @@ -41,7 +41,7 @@ Pre-Depends: ${misc:Pre-Depends}, Depends: ${misc:Depends}, ${shlibs:Depends}, -Recommends: content-hub +Suggests: content-hub Breaks: gallery-app (<= 0.0.67+13.10.20130924.1-0ubuntu1) Description: content sharing/picking library Content sharing/picking infrastructure and service, designed to allow apps to diff -Nru content-hub-0.0+14.04.20140321/doc/qml/pages/mainpage.qdoc content-hub-0.0+14.04.20140402/doc/qml/pages/mainpage.qdoc --- content-hub-0.0+14.04.20140321/doc/qml/pages/mainpage.qdoc 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/doc/qml/pages/mainpage.qdoc 2014-04-02 14:46:42.000000000 +0000 @@ -115,7 +115,7 @@ target: root.activeTransfer onStateChanged: { if (root.activeTransfer.state === ContentTransfer.Charged) - importItmes = root.activeTransfer.items; + importItems = root.activeTransfer.items; } } } diff -Nru content-hub-0.0+14.04.20140321/doc/qml/pages/moduledef.qdoc content-hub-0.0+14.04.20140402/doc/qml/pages/moduledef.qdoc --- content-hub-0.0+14.04.20140321/doc/qml/pages/moduledef.qdoc 1970-01-01 00:00:00.000000000 +0000 +++ content-hub-0.0+14.04.20140402/doc/qml/pages/moduledef.qdoc 2014-04-02 14:46:42.000000000 +0000 @@ -0,0 +1,3 @@ +/*! + \qmlmodule Ubuntu.Content 0.1 +*/ diff -Nru content-hub-0.0+14.04.20140321/doc/qml/ubuntu-content-hub.qdocconf.in content-hub-0.0+14.04.20140402/doc/qml/ubuntu-content-hub.qdocconf.in --- content-hub-0.0+14.04.20140321/doc/qml/ubuntu-content-hub.qdocconf.in 2014-03-21 00:45:51.000000000 +0000 +++ content-hub-0.0+14.04.20140402/doc/qml/ubuntu-content-hub.qdocconf.in 2014-04-02 14:45:59.000000000 +0000 @@ -1,9 +1,8 @@ project = Ubuntu Content QML API description = Ubuntu Content API -sourcedirs = @CMAKE_CURRENT_SOURCE_DIR@/pages @CMAKE_SOURCE_DIR@/import -exampledirs = @CMAKE_SOURCE_DIR@/examples/ -imagedirs = @CMAKE_CURRENT_SOURCE_DIR@/../images +sourcedirs = ../../../doc/qml/pages ../../../import +exampledirs = ../../../examples/ sources.fileextensions = "*.qdoc *.qml *.cpp" headers.fileextensions = "*.h" @@ -16,7 +15,7 @@ outputprefixes = QML outputprefixes.QML = qml- -HTML.templatedir = @CMAKE_CURRENT_SOURCE_DIR@/ +HTML.templatedir = ../../../doc/ HTML.nobreadcrumbs = "true" HTML.stylesheets = \ diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contenthandler.cpp content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contenthandler.cpp --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contenthandler.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contenthandler.cpp 2014-04-02 14:46:42.000000000 +0000 @@ -20,7 +20,7 @@ /*! \qmltype ContentHandler \instantiates ContentHandler - \inqmlmodule Ubuntu.Content 0.1 + \inqmlmodule Ubuntu.Content \sa ContentHub diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contenthub.cpp content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contenthub.cpp --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contenthub.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contenthub.cpp 2014-04-02 14:46:42.000000000 +0000 @@ -31,7 +31,7 @@ /*! * \qmltype ContentHub * \instantiates ContentHub - * \inqmlmodule Ubuntu.Content 0.1 + * \inqmlmodule Ubuntu.Content * * Example usage for importing content: * \qml diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contentitem.cpp content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contentitem.cpp --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contentitem.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contentitem.cpp 2014-04-02 14:46:42.000000000 +0000 @@ -20,7 +20,7 @@ /*! * \qmltype ContentItem * \instantiates ContentItem - * \inqmlmodule Ubuntu.Content 0.1 + * \inqmlmodule Ubuntu.Content * \brief Content that can be imported or exported from a ContentPeer * * A ContentItem is an item that can be imported or exported from a ContentPeer diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contentpeer.cpp content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contentpeer.cpp --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contentpeer.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contentpeer.cpp 2014-04-02 14:46:42.000000000 +0000 @@ -27,7 +27,7 @@ /*! * \qmltype ContentPeer * \instantiates ContentPeer - * \inqmlmodule Ubuntu.Content 0.1 + * \inqmlmodule Ubuntu.Content * \brief An application that can export or import a ContentType * * A ContentPeer is an application that is registered in the ContentHub as diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contentpeermodel.cpp content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contentpeermodel.cpp --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contentpeermodel.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contentpeermodel.cpp 2014-04-02 14:46:42.000000000 +0000 @@ -23,7 +23,7 @@ /*! * \qmltype ContentPeerModel * \instantiates ContentPeerModel - * \inqmlmodule Ubuntu.Content 0.1 + * \inqmlmodule Ubuntu.Content * \brief A list of applications that can export or import a ContentType * * A ContentPeerModel provides a list of all applications that are registered @@ -58,7 +58,7 @@ void ContentPeerModel::componentComplete() { m_complete = true; - QTimer::singleShot(0, this, SLOT(findPeers())); + findPeers(); } /*! @@ -79,11 +79,13 @@ void ContentPeerModel::setContentType(ContentType::Type contentType) { TRACE() << Q_FUNC_INFO; - m_contentType = contentType; - if (m_complete) { - findPeers(); + if (m_contentType != contentType) { + m_contentType = contentType; + if (m_complete) { + findPeers(); + } + Q_EMIT contentTypeChanged(); } - Q_EMIT contentTypeChanged(); } /*! @@ -95,7 +97,6 @@ m_peers.clear(); QCoreApplication::processEvents(); if(m_contentType == ContentType::All) { - appendPeersForContentType(ContentType::Unknown); appendPeersForContentType(ContentType::Documents); appendPeersForContentType(ContentType::Pictures); appendPeersForContentType(ContentType::Music); @@ -139,7 +140,6 @@ } Q_EMIT peersChanged(); } - QCoreApplication::processEvents(); } } @@ -161,11 +161,13 @@ void ContentPeerModel::setHandler(ContentHandler::Handler handler) { TRACE() << Q_FUNC_INFO; - m_handler = handler; - if (m_complete) { - findPeers(); + if (m_handler != handler) { + m_handler = handler; + if (m_complete) { + findPeers(); + } + Q_EMIT handlerChanged(); } - Q_EMIT handlerChanged(); } /*! diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/ContentPeerPicker.qml content-hub-0.0+14.04.20140402/import/Ubuntu/Content/ContentPeerPicker.qml --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/ContentPeerPicker.qml 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/ContentPeerPicker.qml 2014-04-02 14:46:42.000000000 +0000 @@ -22,7 +22,7 @@ /*! \qmltype ContentPeerPicker - \inqmlmodule Ubuntu.Content 0.1 + \inqmlmodule Ubuntu.Content \brief Component that allows users to select a source/destination for content transfer This component displays a list of applications, devices and services which @@ -68,6 +68,8 @@ */ property var customPeerModelLoader + property var completed: false + /*! \qmlsignal peerSelected \brief Emitted when a user selects a peer. @@ -88,26 +90,53 @@ Header { id: header - title: (handler === ContentHandler.Source) ? i18n.tr("Choose from") : i18n.tr("Share to") + title: (handler === ContentHandler.Source) ? i18n.tr("Choose from") : (handler === ContentHandler.Destination ? i18n.tr("Open with") : i18n.tr("Share to")) } Loader { id: peerModelLoader active: false - sourceComponent: ContentPeerModel { - id: peerModel - } + sourceComponent: ContentPeerModel { } onLoaded: { - item.handler = root.handler - item.contentType = root.contentType + item.handler = root.handler; + item.contentType = root.contentType; } } Component.onCompleted: { - if(customPeerModelLoader) { - customPeerModelLoader.active = true; - } else { - peerModelLoader.active = true; + if (root.visible) { + if (customPeerModelLoader) { + customPeerModelLoader.active = true; + } else { + peerModelLoader.active = true; + } + } + completed = true; + } + + onVisibleChanged: { + if (completed) { + if (customPeerModelLoader) { + customPeerModelLoader.active = true; + } else { + peerModelLoader.active = true; + } + } + } + + onHandlerChanged: { + if (!customPeerModelLoader && peerModelLoader.item) { + appPeers.model = undefined; // Clear grid view + peerModelLoader.item.handler = root.handler; + appPeers.model = peerModelLoader.item.peers; + } + } + + onContentTypeChanged: { + if (!customPeerModelLoader && peerModelLoader.item) { + appPeers.model = undefined; // Clear grid view + peerModelLoader.item.contentType = root.contentType; + appPeers.model = peerModelLoader.item.peers; } } @@ -171,13 +200,13 @@ ListItem.Header { id: appTitle anchors.top: header.visible ? header.bottom : parent.top - text: "Apps" + text: i18n.tr("Apps") } Rectangle { id: apps color: "#FFFFFF" - height: (parent.height / 2.4) + height: devices.visible ? (parent.height / 2.4) : parent.height width: parent.width clip: true anchors { @@ -200,22 +229,25 @@ model: customPeerModelLoader ? customPeerModelLoader.item.peers : peerModelLoader.item.peers delegate: peerDelegate } - } } ListItem.Header { id: devTitle + // TODO: make this visible when we have a way to populate devices + visible: false anchors { left: parent.left right: parent.right top: apps.bottom } - text: "Devices" + text: i18n.tr("Devices") } Rectangle { id: devices + // TODO: make this visible when we have a way to populate devices + visible: false color: "#FFFFFF" width: parent.width radius: 0 @@ -230,14 +262,16 @@ Flickable { anchors.fill: parent - GridView { + ResponsiveGridView { id: devPeers - header: Item { height: units.gu(2) } - cellWidth: units.gu(13.5) - cellHeight: units.gu(16) + anchors.fill: parent + minimumHorizontalSpacing: units.gu(0.5) + maximumNumberOfColumns: 6 + delegateWidth: units.gu(11) + delegateHeight: units.gu(9.5) + verticalSpacing: units.gu(2) delegate: peerDelegate } - } } diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contentscope.cpp content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contentscope.cpp --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contentscope.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contentscope.cpp 2014-04-02 14:46:42.000000000 +0000 @@ -20,7 +20,7 @@ /*! \qmltype ContentScope \instantiates ContentScope - \inqmlmodule Ubuntu.Content 0.1 + \inqmlmodule Ubuntu.Content \sa ContentStore diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contentstore.cpp content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contentstore.cpp --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contentstore.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contentstore.cpp 2014-04-02 14:46:42.000000000 +0000 @@ -22,7 +22,7 @@ /*! * \qmltype ContentStore * \instantiates ContentStore - * \inqmlmodule Ubuntu.Content 0.1 + * \inqmlmodule Ubuntu.Content * * A ContentStore allows for the permanent storage of a transfered item. * diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contenttransfer.cpp content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contenttransfer.cpp --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contenttransfer.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contenttransfer.cpp 2014-04-02 14:46:42.000000000 +0000 @@ -23,7 +23,7 @@ /*! * \qmltype ContentTransfer * \instantiates ContentTransfer - * \inqmlmodule Ubuntu.Content 0.1 + * \inqmlmodule Ubuntu.Content * * See documentation for ContentHub */ diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/ContentTransferHint.qml content-hub-0.0+14.04.20140402/import/Ubuntu/Content/ContentTransferHint.qml --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/ContentTransferHint.qml 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/ContentTransferHint.qml 2014-04-02 14:46:42.000000000 +0000 @@ -21,7 +21,7 @@ /*! \qmltype ContentTransferHint - \inqmlmodule Ubuntu.Content 0.1 + \inqmlmodule Ubuntu.Content \brief Component that indicates that a transfer is active This component shows that the transfer is currently running, and the source diff -Nru content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contenttype.cpp content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contenttype.cpp --- content-hub-0.0+14.04.20140321/import/Ubuntu/Content/contenttype.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/import/Ubuntu/Content/contenttype.cpp 2014-04-02 14:46:42.000000000 +0000 @@ -20,7 +20,7 @@ /*! \qmltype ContentType \instantiates ContentType - \inqmlmodule Ubuntu.Content 0.1 + \inqmlmodule Ubuntu.Content \sa ContentHub diff -Nru content-hub-0.0+14.04.20140321/README content-hub-0.0+14.04.20140402/README --- content-hub-0.0+14.04.20140321/README 1970-01-01 00:00:00.000000000 +0000 +++ content-hub-0.0+14.04.20140402/README 2014-04-02 14:44:54.000000000 +0000 @@ -0,0 +1,52 @@ +What is content-hub? +-------------------- + +content-hub is a mediation service to let applications share content between +them even if they are not running at the same time. + +For a more detailed description, please have a look at: +doc/Mainpage.md + + +How do I get all building dependencies? +--------------------------------------- + +Build dependencies are already listed in the debian/control file. To get them +use the following command: +sudo apt-get build-dep content-hub + + +How do I compile the code? +-------------------------- + +To compile the code run the following command from the branch directory: +mkdir build +cd build +cmake .. +make + + +How do I run the test cases? +---------------------------- + +To run the test cases use the following command: +cd build/tests +dbus-test-runner -t make -p test + + +How do I build the packages? +---------------------------- + +To build the pacakges run the following command: +bzr builddeb + + +How do I install the code? +-------------------------- + +One way to do it one the code is compiled is: +make install + +However, the recommended way to do it is by installing the packages built +manually. + diff -Nru content-hub-0.0+14.04.20140321/src/com/ubuntu/content/detail/service.cpp content-hub-0.0+14.04.20140402/src/com/ubuntu/content/detail/service.cpp --- content-hub-0.0+14.04.20140321/src/com/ubuntu/content/detail/service.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/src/com/ubuntu/content/detail/service.cpp 2014-04-02 14:45:51.000000000 +0000 @@ -311,7 +311,7 @@ } if (t->destination() == transfer->destination()) { - qDebug() << Q_FUNC_INFO << "Destination has pending transfers:" << t->Id(); + TRACE() << Q_FUNC_INFO << "Destination has pending transfers:" << t->Id(); if (should_cancel(t->State())) shouldStop = false; } @@ -388,7 +388,7 @@ } if (t->destination() == transfer->destination()) { - qDebug() << Q_FUNC_INFO << "Destination has pending transfers:" << t->Id(); + TRACE() << Q_FUNC_INFO << "Destination has pending transfers:" << t->Id(); if (should_cancel(t->State())) shouldStop = false; } diff -Nru content-hub-0.0+14.04.20140321/src/com/ubuntu/content/peer.cpp content-hub-0.0+14.04.20140402/src/com/ubuntu/content/peer.cpp --- content-hub-0.0+14.04.20140321/src/com/ubuntu/content/peer.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/src/com/ubuntu/content/peer.cpp 2014-04-02 14:46:12.000000000 +0000 @@ -46,9 +46,7 @@ iconFile.close(); } } - g_object_unref(ic); } - g_object_unref(app); } } diff -Nru content-hub-0.0+14.04.20140321/src/com/ubuntu/content/service/helper.cpp content-hub-0.0+14.04.20140402/src/com/ubuntu/content/service/helper.cpp --- content-hub-0.0+14.04.20140321/src/com/ubuntu/content/service/helper.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/src/com/ubuntu/content/service/helper.cpp 2014-04-02 14:45:22.000000000 +0000 @@ -17,6 +17,8 @@ */ #include +#include +#include #include "hook.h" #include "debug.h" @@ -45,6 +47,15 @@ setLoggingLevel(value); } + QDir contentDir( + QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + + QString("/") + + QString("content-hub")); + + if (!contentDir.exists()) { + return 0; + } + new cuc::detail::Hook(); app.exec(); diff -Nru content-hub-0.0+14.04.20140321/src/com/ubuntu/content/service/main.cpp content-hub-0.0+14.04.20140402/src/com/ubuntu/content/service/main.cpp --- content-hub-0.0+14.04.20140321/src/com/ubuntu/content/service/main.cpp 2014-03-21 00:46:25.000000000 +0000 +++ content-hub-0.0+14.04.20140402/src/com/ubuntu/content/service/main.cpp 2014-04-02 14:46:23.000000000 +0000 @@ -33,22 +33,6 @@ namespace cuc = com::ubuntu::content; namespace { - void list(QSharedPointer registry) - { - /* list known peers for pictures */ - QStringList result; - registry->enumerate_known_sources_for_type( - cuc::Type::Known::pictures(), - [&result](const cuc::Peer& peer) - { - result.append(peer.id()); - }); - - foreach (QString r, result) { - TRACE() << "PEER: " << r; - } - } - void shutdown(int sig) { TRACE() << Q_FUNC_INFO << sig; @@ -100,12 +84,8 @@ if (ret == 1) app->exit(ret); - else - { - /* list known peers */ - list(registry); + else ret = app->exec(); - } TRACE() << "Server exiting, cleaning up"; delete server; diff -Nru content-hub-0.0+14.04.20140321/src/com/ubuntu/content/service/registry.cpp content-hub-0.0+14.04.20140402/src/com/ubuntu/content/service/registry.cpp --- content-hub-0.0+14.04.20140321/src/com/ubuntu/content/service/registry.cpp 2014-03-21 00:46:46.000000000 +0000 +++ content-hub-0.0+14.04.20140402/src/com/ubuntu/content/service/registry.cpp 2014-04-02 14:46:23.000000000 +0000 @@ -37,19 +37,35 @@ { if (m_defaultSources->keys().contains(type.id())) { - QString peer_id = m_defaultSources->get(type.id()).toString(); - QStringList as(m_defaultSources->get(type.id()).toStringList()); - if (!as.isEmpty()) + QVariant peer_v = m_defaultSources->get(type.id()); + // If default isn't a StringList, attempt to reset + if (peer_v.type() != QVariant::StringList) { - std::string pkg = as[0].toStdString(); - std::string app = as[1].toStdString(); - std::string ver = as[2].toStdString(); - cuc::Peer peer; - if (app.empty() || ver.empty()) - peer = QString::fromStdString(pkg); - else - peer = QString::fromLocal8Bit(upstart_app_launch_triplet_to_app_id(pkg.c_str(), app.c_str(), ver.c_str())); - install_source_for_type(type, cuc::Peer{peer.id(), true}); + TRACE() << Q_FUNC_INFO << "Default type for" << type.id() << "is incorrect, resetting"; + m_defaultSources->reset(type.id()); + // After reset, lets get a new QVariant + peer_v = m_defaultSources->get(type.id()); + } + + /* Only assume the default is correct if the type is a StringList + * The reset above should have ensured it was reset, lets double + * check anyway to prevent crashes + */ + if (peer_v.type() == QVariant::StringList) + { + QStringList as(peer_v.toStringList()); + if (!as.isEmpty()) + { + std::string pkg = as[0].toStdString(); + std::string app = as[1].toStdString(); + std::string ver = as[2].toStdString(); + cuc::Peer peer; + if (app.empty() || ver.empty()) + peer = QString::fromStdString(pkg); + else + peer = QString::fromLocal8Bit(upstart_app_launch_triplet_to_app_id(pkg.c_str(), app.c_str(), ver.c_str())); + install_source_for_type(type, cuc::Peer{peer.id(), true}); + } } } } @@ -62,13 +78,15 @@ TRACE() << Q_FUNC_INFO << type.id(); if (m_defaultSources->keys().contains(type.id())) { - QStringList as(m_defaultSources->get(type.id()).toStringList()); + QVariant peer_v = m_defaultSources->get(type.id()); + if (peer_v.type() != QVariant::StringList) + return cuc::Peer(peer_v.toString()); + QStringList as(peer_v.toStringList()); if (!as.isEmpty()) { std::string pkg = as[0].toStdString(); std::string app = as[1].toStdString(); std::string ver = as[2].toStdString(); - cuc::Peer peer; if (app.empty() || ver.empty()) return cuc::Peer(QString::fromStdString(pkg)); return cuc::Peer(QString::fromLocal8Bit(upstart_app_launch_triplet_to_app_id(pkg.c_str(), app.c_str(), ver.c_str())), true); @@ -122,16 +140,20 @@ { TRACE() << Q_FUNC_INFO << k; bool defaultPeer = false; - QStringList as(m_defaultSources->get(type.id()).toStringList()); - if (!as.isEmpty()) - { - std::string pkg = as[0].toStdString(); - std::string app = as[1].toStdString(); - std::string ver = as[2].toStdString(); - if (app.empty() || ver.empty()) - defaultPeer = QString::fromStdString(pkg) == k; - else - defaultPeer = QString::fromLocal8Bit(upstart_app_launch_triplet_to_app_id(pkg.c_str(), app.c_str(), ver.c_str())) == k; + QVariant peer_v = m_defaultSources->get(type.id()); + if (peer_v.type() == QVariant::StringList) + { + QStringList as(peer_v.toStringList()); + if (!as.isEmpty()) + { + std::string pkg = as[0].toStdString(); + std::string app = as[1].toStdString(); + std::string ver = as[2].toStdString(); + if (app.empty() || ver.empty()) + defaultPeer = QString::fromStdString(pkg) == k; + else + defaultPeer = QString::fromLocal8Bit(upstart_app_launch_triplet_to_app_id(pkg.c_str(), app.c_str(), ver.c_str())) == k; + } } for_each(cuc::Peer{k, defaultPeer}); } @@ -140,6 +162,10 @@ void Registry::enumerate_known_destinations_for_type(cuc::Type type, const std::function&for_each) { TRACE() << Q_FUNC_INFO << type.id(); + + if (type == cuc::Type::unknown()) + return; + Q_FOREACH (QString k, m_dests->get(type.id()).toStringList()) { TRACE() << Q_FUNC_INFO << k; @@ -151,6 +177,9 @@ { TRACE() << Q_FUNC_INFO << type.id(); + if (type == cuc::Type::unknown()) + return; + Q_FOREACH (QString k, m_shares->get(type.id()).toStringList()) { TRACE() << Q_FUNC_INFO << k;