Merge lp:~ken-vandine/content-hub/quiet_logging into lp:content-hub

Proposed by Ken VanDine
Status: Merged
Approved by: Ken VanDine
Approved revision: 139
Merged at revision: 77
Proposed branch: lp:~ken-vandine/content-hub/quiet_logging
Merge into: lp:content-hub
Prerequisite: lp:~michael-sheldon/content-hub/peer_picker_ui
Diff against target: 2281 lines (+378/-245)
32 files modified
CMakeLists.txt (+2/-0)
debian/changelog (+10/-0)
import/Ubuntu/Content/CMakeLists.txt (+1/-0)
import/Ubuntu/Content/contenthandler.cpp (+2/-3)
import/Ubuntu/Content/contenthub.cpp (+18/-12)
import/Ubuntu/Content/contenthubplugin.cpp (+4/-3)
import/Ubuntu/Content/contenticonprovider.cpp (+4/-5)
import/Ubuntu/Content/contentitem.cpp (+8/-9)
import/Ubuntu/Content/contentpeer.cpp (+16/-16)
import/Ubuntu/Content/contentpeermodel.cpp (+9/-10)
import/Ubuntu/Content/contentscope.cpp (+3/-4)
import/Ubuntu/Content/contentstore.cpp (+8/-9)
import/Ubuntu/Content/contenttransfer.cpp (+21/-22)
import/Ubuntu/Content/contenttype.cpp (+3/-4)
import/Ubuntu/Content/qmlimportexporthandler.cpp (+5/-6)
src/com/ubuntu/content/CMakeLists.txt (+1/-0)
src/com/ubuntu/content/debug.cpp (+26/-0)
src/com/ubuntu/content/debug.h (+53/-0)
src/com/ubuntu/content/detail/app_manager.cpp (+3/-3)
src/com/ubuntu/content/detail/handler.cpp (+9/-9)
src/com/ubuntu/content/detail/service.cpp (+63/-55)
src/com/ubuntu/content/detail/transfer.cpp (+21/-22)
src/com/ubuntu/content/hub.cpp (+17/-6)
src/com/ubuntu/content/peer.cpp (+4/-4)
src/com/ubuntu/content/service/CMakeLists.txt (+1/-0)
src/com/ubuntu/content/service/helper.cpp (+12/-1)
src/com/ubuntu/content/service/hook.cpp (+7/-7)
src/com/ubuntu/content/service/main.cpp (+15/-4)
src/com/ubuntu/content/service/registry.cpp (+21/-20)
src/com/ubuntu/content/service/registry.h (+0/-1)
src/com/ubuntu/content/transfer.cpp (+1/-1)
src/com/ubuntu/content/utils.cpp (+10/-9)
To merge this branch: bzr merge lp:~ken-vandine/content-hub/quiet_logging
Reviewer Review Type Date Requested Status
Michael Sheldon (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+211556@code.launchpad.net

Commit message

Make debugging output optional based on CONTENT_HUB_LOGGING_LEVEL env variable.

Description of the change

Make debugging output optional based on CONTENT_HUB_LOGGING_LEVEL env variable.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Are there any related MPs required for this MP to build/function as expected?
 * No (besides the prerequisite branch included)
Is your branch in sync with latest trunk
 * Yes
Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
 * Yes
Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/content-hub) on device or emulator?
 * Yes
If you changed the UI, was the change specified/approved by design?
 * No UI changes
If you changed the packaging (debian), did you subscribe a core-dev to this MP?
 * No packaging changes

139. By Ken VanDine

merged trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?

 * Yes, based on https://wiki.ubuntu.com/Process/Merges/TestPlan/content-hub (with updated gallery-app, address-book-app and ubuntu-system-settings branches for new API compatibility)

Did CI run pass? If not, please explain why.

 * Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?

 * Yes

review: Approve
140. By Ken VanDine

merged peer_picker_ui

141. By Ken VanDine

merged fix_pending_check

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-03-21 00:29:33 +0000
+++ CMakeLists.txt 2014-03-21 00:29:34 +0000
@@ -67,6 +67,8 @@
67pkg_check_modules(NIH_DBUS REQUIRED libnih-dbus)67pkg_check_modules(NIH_DBUS REQUIRED libnih-dbus)
68pkg_check_modules(DBUS REQUIRED dbus-1)68pkg_check_modules(DBUS REQUIRED dbus-1)
6969
70add_definitions( -DDEBUG_ENABLED )
71
70set(CONTENT_HUB_VERSION_MAJOR 0)72set(CONTENT_HUB_VERSION_MAJOR 0)
71set(CONTENT_HUB_VERSION_MINOR 0)73set(CONTENT_HUB_VERSION_MINOR 0)
72set(CONTENT_HUB_VERSION_PATCH 1)74set(CONTENT_HUB_VERSION_PATCH 1)
7375
=== modified file 'debian/changelog'
--- debian/changelog 2014-03-07 06:59:44 +0000
+++ debian/changelog 2014-03-21 00:29:34 +0000
@@ -16,6 +16,16 @@
1616
17 -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 06 Mar 2014 16:50:24 +000017 -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 06 Mar 2014 16:50:24 +0000
1818
19content-hub (0.0+14.04.20140304-0preview1) trusty; urgency=medium
20
21 * Support for more handler types, including sharing
22 * Marshal peer details like name and icon from the service, so confined apps
23 can show them.
24 * Improved QML bindings
25 * New ContentPeerPicker QML component
26
27 -- Ken VanDine <ken.vandine@canonical.com> Mon, 27 Jan 2014 14:09:38 -0500
28
19content-hub (0.0+14.04.20131209.1-0ubuntu1) trusty; urgency=low29content-hub (0.0+14.04.20131209.1-0ubuntu1) trusty; urgency=low
2030
21 [ Ken VanDine ]31 [ Ken VanDine ]
2232
=== modified file 'import/Ubuntu/Content/CMakeLists.txt'
--- import/Ubuntu/Content/CMakeLists.txt 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/CMakeLists.txt 2014-03-21 00:29:34 +0000
@@ -63,6 +63,7 @@
63 contenttransfer.cpp63 contenttransfer.cpp
64 contenttype.cpp64 contenttype.cpp
65 qmlimportexporthandler.cpp65 qmlimportexporthandler.cpp
66 ../../../src/com/ubuntu/content/debug.cpp
66 )67 )
6768
68add_library(${PLUGIN} MODULE ${PLUGIN_SRC} ${PLUGIN_HDRS})69add_library(${PLUGIN} MODULE ${PLUGIN_SRC} ${PLUGIN_HDRS})
6970
=== modified file 'import/Ubuntu/Content/contenthandler.cpp'
--- import/Ubuntu/Content/contenthandler.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/contenthandler.cpp 2014-03-21 00:29:34 +0000
@@ -14,10 +14,9 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include "../../../src/com/ubuntu/content/debug.h"
17#include "contenthandler.h"18#include "contenthandler.h"
1819
19#include <QDebug>
20
21/*!20/*!
22 \qmltype ContentHandler21 \qmltype ContentHandler
23 \instantiates ContentHandler22 \instantiates ContentHandler
@@ -41,5 +40,5 @@
41ContentHandler::ContentHandler(QObject *parent)40ContentHandler::ContentHandler(QObject *parent)
42 : QObject(parent)41 : QObject(parent)
43{42{
44 qDebug() << Q_FUNC_INFO;43 TRACE() << Q_FUNC_INFO;
45}44}
4645
=== modified file 'import/Ubuntu/Content/contenthub.cpp'
--- import/Ubuntu/Content/contenthub.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/contenthub.cpp 2014-03-21 00:29:34 +0000
@@ -14,6 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include "../../../src/com/ubuntu/content/debug.h"
17#include "contenthub.h"18#include "contenthub.h"
18#include "contentpeer.h"19#include "contentpeer.h"
19#include "contentstore.h"20#include "contentstore.h"
@@ -26,7 +27,6 @@
26#include <com/ubuntu/content/type.h>27#include <com/ubuntu/content/type.h>
2728
28#include <QStringList>29#include <QStringList>
29#include <QDebug>
3030
31/*!31/*!
32 * \qmltype ContentHub32 * \qmltype ContentHub
@@ -117,7 +117,7 @@
117 : QObject(parent),117 : QObject(parent),
118 m_hub(0)118 m_hub(0)
119{119{
120 qDebug() << Q_FUNC_INFO;120 TRACE() << Q_FUNC_INFO;
121 m_hub = cuc::Hub::Client::instance();121 m_hub = cuc::Hub::Client::instance();
122 m_handler = new QmlImportExportHandler(this);122 m_handler = new QmlImportExportHandler(this);
123 m_hub->register_import_export_handler(m_handler);123 m_hub->register_import_export_handler(m_handler);
@@ -132,7 +132,7 @@
132132
133ContentHub *ContentHub::instance()133ContentHub *ContentHub::instance()
134{134{
135 qDebug() << Q_FUNC_INFO;135 TRACE() << Q_FUNC_INFO;
136 static ContentHub *contentHub = new ContentHub(nullptr);136 static ContentHub *contentHub = new ContentHub(nullptr);
137 return contentHub;137 return contentHub;
138}138}
@@ -145,7 +145,7 @@
145 */145 */
146ContentTransfer* ContentHub::importContent(cuc::Peer peer)146ContentTransfer* ContentHub::importContent(cuc::Peer peer)
147{147{
148 qDebug() << Q_FUNC_INFO;148 TRACE() << Q_FUNC_INFO;
149149
150 cuc::Transfer *hubTransfer = m_hub->create_import_from_peer(peer);150 cuc::Transfer *hubTransfer = m_hub->create_import_from_peer(peer);
151 ContentTransfer *qmlTransfer = new ContentTransfer(this);151 ContentTransfer *qmlTransfer = new ContentTransfer(this);
@@ -162,7 +162,7 @@
162 */162 */
163ContentTransfer* ContentHub::exportContent(cuc::Peer peer)163ContentTransfer* ContentHub::exportContent(cuc::Peer peer)
164{164{
165 qDebug() << Q_FUNC_INFO;165 TRACE() << Q_FUNC_INFO;
166166
167 cuc::Transfer *hubTransfer = m_hub->create_export_to_peer(peer);167 cuc::Transfer *hubTransfer = m_hub->create_export_to_peer(peer);
168 ContentTransfer *qmlTransfer = new ContentTransfer(this);168 ContentTransfer *qmlTransfer = new ContentTransfer(this);
@@ -179,7 +179,7 @@
179 */179 */
180ContentTransfer* ContentHub::shareContent(cuc::Peer peer)180ContentTransfer* ContentHub::shareContent(cuc::Peer peer)
181{181{
182 qDebug() << Q_FUNC_INFO;182 TRACE() << Q_FUNC_INFO;
183183
184 cuc::Transfer *hubTransfer = m_hub->create_share_to_peer(peer);184 cuc::Transfer *hubTransfer = m_hub->create_share_to_peer(peer);
185 ContentTransfer *qmlTransfer = new ContentTransfer(this);185 ContentTransfer *qmlTransfer = new ContentTransfer(this);
@@ -194,7 +194,7 @@
194 */194 */
195void ContentHub::restoreImports()195void ContentHub::restoreImports()
196{196{
197 qDebug() << Q_FUNC_INFO;197 TRACE() << Q_FUNC_INFO;
198}198}
199199
200/*!200/*!
@@ -203,7 +203,7 @@
203 */203 */
204QQmlListProperty<ContentTransfer> ContentHub::finishedImports()204QQmlListProperty<ContentTransfer> ContentHub::finishedImports()
205{205{
206 qDebug() << Q_FUNC_INFO;206 TRACE() << Q_FUNC_INFO;
207 return QQmlListProperty<ContentTransfer>(this, m_finishedImports);207 return QQmlListProperty<ContentTransfer>(this, m_finishedImports);
208}208}
209209
@@ -213,7 +213,7 @@
213 */213 */
214void ContentHub::handleImport(com::ubuntu::content::Transfer *transfer)214void ContentHub::handleImport(com::ubuntu::content::Transfer *transfer)
215{215{
216 qDebug() << Q_FUNC_INFO;216 TRACE() << Q_FUNC_INFO;
217 ContentTransfer *qmlTransfer = nullptr;217 ContentTransfer *qmlTransfer = nullptr;
218 if (m_activeImports.contains(transfer)) {218 if (m_activeImports.contains(transfer)) {
219 qmlTransfer = m_activeImports.take(transfer);219 qmlTransfer = m_activeImports.take(transfer);
@@ -229,6 +229,12 @@
229 Q_EMIT importRequested(qmlTransfer);229 Q_EMIT importRequested(qmlTransfer);
230 }230 }
231231
232
233
234 // FIXME: maybe we need to emit something else here
235// if (qmlTransfer->state() == ContentTransfer::Charged)
236// Q_EMIT importRequested(qmlTransfer);
237
232 m_finishedImports.append(qmlTransfer);238 m_finishedImports.append(qmlTransfer);
233 Q_EMIT finishedImportsChanged();239 Q_EMIT finishedImportsChanged();
234}240}
@@ -239,7 +245,7 @@
239 */245 */
240void ContentHub::handleExport(com::ubuntu::content::Transfer *transfer)246void ContentHub::handleExport(com::ubuntu::content::Transfer *transfer)
241{247{
242 qDebug() << Q_FUNC_INFO;248 TRACE() << Q_FUNC_INFO;
243 ContentTransfer *qmlTransfer = nullptr;249 ContentTransfer *qmlTransfer = nullptr;
244 if (m_activeImports.contains(transfer))250 if (m_activeImports.contains(transfer))
245 qmlTransfer = m_activeImports.take(transfer);251 qmlTransfer = m_activeImports.take(transfer);
@@ -264,7 +270,7 @@
264 */270 */
265void ContentHub::handleShare(com::ubuntu::content::Transfer *transfer)271void ContentHub::handleShare(com::ubuntu::content::Transfer *transfer)
266{272{
267 qDebug() << Q_FUNC_INFO;273 TRACE() << Q_FUNC_INFO;
268 ContentTransfer *qmlTransfer = nullptr;274 ContentTransfer *qmlTransfer = nullptr;
269 if (m_activeImports.contains(transfer))275 if (m_activeImports.contains(transfer))
270 {276 {
@@ -287,7 +293,7 @@
287293
288void ContentHub::updateState()294void ContentHub::updateState()
289{295{
290 qDebug() << Q_FUNC_INFO;296 TRACE() << Q_FUNC_INFO;
291}297}
292298
293/*!299/*!
294300
=== modified file 'import/Ubuntu/Content/contenthubplugin.cpp'
--- import/Ubuntu/Content/contenthubplugin.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/contenthubplugin.cpp 2014-03-21 00:29:34 +0000
@@ -15,6 +15,7 @@
15 */15 */
1616
17#include "contenthubplugin.h"17#include "contenthubplugin.h"
18#include "../../../src/com/ubuntu/content/debug.h"
1819
19#include "contenthandler.h"20#include "contenthandler.h"
20#include "contenthub.h"21#include "contenthub.h"
@@ -40,7 +41,7 @@
40{41{
41 Q_UNUSED(engine)42 Q_UNUSED(engine)
42 Q_UNUSED(scriptEngine)43 Q_UNUSED(scriptEngine)
43 qDebug() << Q_FUNC_INFO;44 TRACE() << Q_FUNC_INFO;
44 return ContentHub::instance();45 return ContentHub::instance();
45}46}
4647
@@ -50,7 +51,7 @@
50void ContentHubPlugin::initializeEngine(QQmlEngine * engine, const char * uri)51void ContentHubPlugin::initializeEngine(QQmlEngine * engine, const char * uri)
51{52{
52 Q_UNUSED(uri)53 Q_UNUSED(uri)
53 qDebug() << Q_FUNC_INFO;54 TRACE() << Q_FUNC_INFO;
54 QIcon::setThemeName("ubuntu-mobile");55 QIcon::setThemeName("ubuntu-mobile");
55 QIcon::setThemeSearchPaths(QStringList() << ("/usr/share/icons/"));56 QIcon::setThemeSearchPaths(QStringList() << ("/usr/share/icons/"));
56 ContentIconProvider *iconProvider = ContentIconProvider::instance();57 ContentIconProvider *iconProvider = ContentIconProvider::instance();
@@ -62,7 +63,7 @@
62 */63 */
63void ContentHubPlugin::registerTypes(const char *uri)64void ContentHubPlugin::registerTypes(const char *uri)
64{65{
65 qDebug() << Q_FUNC_INFO;66 TRACE() << Q_FUNC_INFO;
66 Q_ASSERT(uri == QLatin1String("Ubuntu.Content"));67 Q_ASSERT(uri == QLatin1String("Ubuntu.Content"));
6768
68 const int versionMajor = 0;69 const int versionMajor = 0;
6970
=== modified file 'import/Ubuntu/Content/contenticonprovider.cpp'
--- import/Ubuntu/Content/contenticonprovider.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/contenticonprovider.cpp 2014-03-21 00:29:34 +0000
@@ -14,14 +14,13 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include "../../../src/com/ubuntu/content/debug.h"
17#include "contenticonprovider.h"18#include "contenticonprovider.h"
1819
19#include <QDebug>
20
21ContentIconProvider::ContentIconProvider()20ContentIconProvider::ContentIconProvider()
22 : QQuickImageProvider(QQuickImageProvider::Image)21 : QQuickImageProvider(QQuickImageProvider::Image)
23{22{
24 qDebug() << Q_FUNC_INFO;23 TRACE() << Q_FUNC_INFO;
2524
26 appIdImageMap = new QMap<QString, QImage>();25 appIdImageMap = new QMap<QString, QImage>();
27}26}
@@ -39,7 +38,7 @@
39 */38 */
40void ContentIconProvider::addImage(QString appId, QImage image)39void ContentIconProvider::addImage(QString appId, QImage image)
41{40{
42 qDebug() << Q_FUNC_INFO;41 TRACE() << Q_FUNC_INFO;
43 appIdImageMap->insert(appId, image);42 appIdImageMap->insert(appId, image);
44}43}
4544
@@ -51,7 +50,7 @@
51QImage ContentIconProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)50QImage ContentIconProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
52{51{
53 Q_UNUSED(requestedSize)52 Q_UNUSED(requestedSize)
54 qDebug() << Q_FUNC_INFO;53 TRACE() << Q_FUNC_INFO;
5554
56 QImage image = appIdImageMap->value(id);55 QImage image = appIdImageMap->value(id);
57 if(size) {56 if(size) {
5857
=== modified file 'import/Ubuntu/Content/contentitem.cpp'
--- import/Ubuntu/Content/contentitem.cpp 2013-11-07 20:12:56 +0000
+++ import/Ubuntu/Content/contentitem.cpp 2014-03-21 00:29:34 +0000
@@ -15,8 +15,7 @@
15 */15 */
1616
17#include "contentitem.h"17#include "contentitem.h"
1818#include "../../../src/com/ubuntu/content/debug.h"
19#include <QDebug>
2019
21/*!20/*!
22 * \qmltype ContentItem21 * \qmltype ContentItem
@@ -34,7 +33,7 @@
34ContentItem::ContentItem(QObject *parent)33ContentItem::ContentItem(QObject *parent)
35 : QObject(parent)34 : QObject(parent)
36{35{
37 qDebug() << Q_FUNC_INFO;36 TRACE() << Q_FUNC_INFO;
38}37}
3938
40/*!39/*!
@@ -43,13 +42,13 @@
43 */42 */
44const QString &ContentItem::name() const43const QString &ContentItem::name() const
45{44{
46 qDebug() << Q_FUNC_INFO;45 TRACE() << Q_FUNC_INFO;
47 return m_name;46 return m_name;
48}47}
4948
50void ContentItem::setName(const QString &name)49void ContentItem::setName(const QString &name)
51{50{
52 qDebug() << Q_FUNC_INFO;51 TRACE() << Q_FUNC_INFO;
53 if (name == m_name)52 if (name == m_name)
54 return;53 return;
5554
@@ -64,13 +63,13 @@
64 */63 */
65const QUrl &ContentItem::url() const64const QUrl &ContentItem::url() const
66{65{
67 qDebug() << Q_FUNC_INFO;66 TRACE() << Q_FUNC_INFO;
68 return m_item.url();67 return m_item.url();
69}68}
7069
71void ContentItem::setUrl(const QUrl &url)70void ContentItem::setUrl(const QUrl &url)
72{71{
73 qDebug() << Q_FUNC_INFO;72 TRACE() << Q_FUNC_INFO;
74 if (url == this->url())73 if (url == this->url())
75 return;74 return;
7675
@@ -84,7 +83,7 @@
84 */83 */
85const com::ubuntu::content::Item &ContentItem::item() const84const com::ubuntu::content::Item &ContentItem::item() const
86{85{
87 qDebug() << Q_FUNC_INFO;86 TRACE() << Q_FUNC_INFO;
88 return m_item;87 return m_item;
89}88}
9089
@@ -94,7 +93,7 @@
94 */93 */
95void ContentItem::setItem(const com::ubuntu::content::Item &item)94void ContentItem::setItem(const com::ubuntu::content::Item &item)
96{95{
97 qDebug() << Q_FUNC_INFO;96 TRACE() << Q_FUNC_INFO;
98 if (item == m_item)97 if (item == m_item)
99 return;98 return;
10099
101100
=== modified file 'import/Ubuntu/Content/contentpeer.cpp'
--- import/Ubuntu/Content/contentpeer.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/contentpeer.cpp 2014-03-21 00:29:34 +0000
@@ -14,6 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include "../../../src/com/ubuntu/content/debug.h"
17#include "contenthandler.h"18#include "contenthandler.h"
18#include "contenthub.h"19#include "contenthub.h"
19#include "contenticonprovider.h"20#include "contenticonprovider.h"
@@ -21,7 +22,6 @@
21#include "contenttype.h"22#include "contenttype.h"
2223
23#include <com/ubuntu/content/peer.h>24#include <com/ubuntu/content/peer.h>
24#include <QDebug>
25#include <QIcon>25#include <QIcon>
2626
27/*!27/*!
@@ -46,7 +46,7 @@
46 m_selectionType(ContentTransfer::Single),46 m_selectionType(ContentTransfer::Single),
47 m_explicit_peer(false)47 m_explicit_peer(false)
48{48{
49 qDebug() << Q_FUNC_INFO;49 TRACE() << Q_FUNC_INFO;
5050
51 m_hub = cuc::Hub::Client::instance();51 m_hub = cuc::Hub::Client::instance();
52}52}
@@ -58,7 +58,7 @@
58 */58 */
59QString ContentPeer::name()59QString ContentPeer::name()
60{60{
61 qDebug() << Q_FUNC_INFO;61 TRACE() << Q_FUNC_INFO;
62 return m_peer.name();62 return m_peer.name();
63}63}
6464
@@ -68,7 +68,7 @@
68 */68 */
69const QString &ContentPeer::appId() const69const QString &ContentPeer::appId() const
70{70{
71 qDebug() << Q_FUNC_INFO;71 TRACE() << Q_FUNC_INFO;
72 return m_peer.id();72 return m_peer.id();
73}73}
7474
@@ -79,13 +79,13 @@
79 */79 */
80void ContentPeer::setAppId(const QString& appId)80void ContentPeer::setAppId(const QString& appId)
81{81{
82 qDebug() << Q_FUNC_INFO << appId;82 TRACE() << Q_FUNC_INFO << appId;
83 this->setPeer(cuc::Peer{appId});83 this->setPeer(cuc::Peer{appId});
84}84}
8585
86QImage &ContentPeer::icon()86QImage &ContentPeer::icon()
87{87{
88 qDebug() << Q_FUNC_INFO;88 TRACE() << Q_FUNC_INFO;
89 return m_icon;89 return m_icon;
90}90}
9191
@@ -104,7 +104,7 @@
104 */104 */
105void ContentPeer::setPeer(const cuc::Peer &peer, bool explicitPeer)105void ContentPeer::setPeer(const cuc::Peer &peer, bool explicitPeer)
106{106{
107 qDebug() << Q_FUNC_INFO;107 TRACE() << Q_FUNC_INFO;
108 m_peer = peer;108 m_peer = peer;
109 m_explicit_peer = explicitPeer;109 m_explicit_peer = explicitPeer;
110 if (peer.iconData().isEmpty())110 if (peer.iconData().isEmpty())
@@ -126,7 +126,7 @@
126 */126 */
127ContentHandler::Handler ContentPeer::handler()127ContentHandler::Handler ContentPeer::handler()
128{128{
129 qDebug() << Q_FUNC_INFO;129 TRACE() << Q_FUNC_INFO;
130 return m_handler;130 return m_handler;
131}131}
132132
@@ -136,7 +136,7 @@
136 */136 */
137void ContentPeer::setHandler(ContentHandler::Handler handler)137void ContentPeer::setHandler(ContentHandler::Handler handler)
138{ 138{
139 qDebug() << Q_FUNC_INFO;139 TRACE() << Q_FUNC_INFO;
140 m_handler = handler;140 m_handler = handler;
141141
142 Q_EMIT handlerChanged();142 Q_EMIT handlerChanged();
@@ -148,7 +148,7 @@
148 */148 */
149ContentType::Type ContentPeer::contentType() 149ContentType::Type ContentPeer::contentType()
150{150{
151 qDebug() << Q_FUNC_INFO;151 TRACE() << Q_FUNC_INFO;
152 return m_contentType;152 return m_contentType;
153}153}
154154
@@ -158,7 +158,7 @@
158 */158 */
159void ContentPeer::setContentType(ContentType::Type contentType)159void ContentPeer::setContentType(ContentType::Type contentType)
160{ 160{
161 qDebug() << Q_FUNC_INFO;161 TRACE() << Q_FUNC_INFO;
162 m_contentType = contentType;162 m_contentType = contentType;
163163
164 if(!m_explicit_peer) {164 if(!m_explicit_peer) {
@@ -175,7 +175,7 @@
175 */175 */
176ContentTransfer::SelectionType ContentPeer::selectionType()176ContentTransfer::SelectionType ContentPeer::selectionType()
177{177{
178 qDebug() << Q_FUNC_INFO;178 TRACE() << Q_FUNC_INFO;
179 return m_selectionType;179 return m_selectionType;
180}180}
181181
@@ -185,7 +185,7 @@
185 */185 */
186void ContentPeer::setSelectionType(ContentTransfer::SelectionType selectionType)186void ContentPeer::setSelectionType(ContentTransfer::SelectionType selectionType)
187{187{
188 qDebug() << Q_FUNC_INFO;188 TRACE() << Q_FUNC_INFO;
189 m_selectionType = selectionType;189 m_selectionType = selectionType;
190190
191 Q_EMIT selectionTypeChanged();191 Q_EMIT selectionTypeChanged();
@@ -197,7 +197,7 @@
197 */197 */
198bool ContentPeer::isDefaultPeer()198bool ContentPeer::isDefaultPeer()
199{199{
200 qDebug() << Q_FUNC_INFO;200 TRACE() << Q_FUNC_INFO;
201 return m_peer.isDefaultPeer();201 return m_peer.isDefaultPeer();
202}202}
203203
@@ -208,7 +208,7 @@
208 */208 */
209ContentTransfer *ContentPeer::request()209ContentTransfer *ContentPeer::request()
210{ 210{
211 qDebug() << Q_FUNC_INFO;211 TRACE() << Q_FUNC_INFO;
212 return request(nullptr);212 return request(nullptr);
213}213}
214214
@@ -220,7 +220,7 @@
220 */220 */
221ContentTransfer *ContentPeer::request(ContentStore *store)221ContentTransfer *ContentPeer::request(ContentStore *store)
222{222{
223 qDebug() << Q_FUNC_INFO;223 TRACE() << Q_FUNC_INFO;
224224
225 ContentHub *contentHub = ContentHub::instance();225 ContentHub *contentHub = ContentHub::instance();
226 ContentTransfer *qmlTransfer = NULL;226 ContentTransfer *qmlTransfer = NULL;
227227
=== modified file 'import/Ubuntu/Content/contentpeermodel.cpp'
--- import/Ubuntu/Content/contentpeermodel.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/contentpeermodel.cpp 2014-03-21 00:29:34 +0000
@@ -14,11 +14,10 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include "../../../src/com/ubuntu/content/debug.h"
17#include "contentpeermodel.h"18#include "contentpeermodel.h"
18#include <stdio.h>19#include <stdio.h>
1920
20#include <QDebug>
21
22namespace cuc = com::ubuntu::content;21namespace cuc = com::ubuntu::content;
2322
24/*!23/*!
@@ -39,7 +38,7 @@
39 m_handler(ContentHandler::Source),38 m_handler(ContentHandler::Source),
40 m_complete(false)39 m_complete(false)
41{40{
42 qDebug() << Q_FUNC_INFO;41 TRACE() << Q_FUNC_INFO;
43 m_hub = cuc::Hub::Client::instance();42 m_hub = cuc::Hub::Client::instance();
44}43}
4544
@@ -69,7 +68,7 @@
69 */68 */
70ContentType::Type ContentPeerModel::contentType()69ContentType::Type ContentPeerModel::contentType()
71{70{
72 qDebug() << Q_FUNC_INFO;71 TRACE() << Q_FUNC_INFO;
73 return m_contentType;72 return m_contentType;
74}73}
7574
@@ -79,7 +78,7 @@
79 */78 */
80void ContentPeerModel::setContentType(ContentType::Type contentType)79void ContentPeerModel::setContentType(ContentType::Type contentType)
81{80{
82 qDebug() << Q_FUNC_INFO;81 TRACE() << Q_FUNC_INFO;
83 m_contentType = contentType;82 m_contentType = contentType;
84 if (m_complete) {83 if (m_complete) {
85 findPeers();84 findPeers();
@@ -92,7 +91,7 @@
92 * \internal91 * \internal
93 */92 */
94void ContentPeerModel::findPeers() {93void ContentPeerModel::findPeers() {
95 qDebug() << Q_FUNC_INFO;94 TRACE() << Q_FUNC_INFO;
96 m_peers.clear();95 m_peers.clear();
97 QCoreApplication::processEvents();96 QCoreApplication::processEvents();
98 if(m_contentType == ContentType::All) {97 if(m_contentType == ContentType::All) {
@@ -113,7 +112,7 @@
113 */112 */
114void ContentPeerModel::appendPeersForContentType(ContentType::Type contentType)113void ContentPeerModel::appendPeersForContentType(ContentType::Type contentType)
115{114{
116 qDebug() << Q_FUNC_INFO;115 TRACE() << Q_FUNC_INFO;
117 const cuc::Type &hubType = ContentType::contentType2HubType(contentType);116 const cuc::Type &hubType = ContentType::contentType2HubType(contentType);
118 QVector<cuc::Peer> hubPeers;117 QVector<cuc::Peer> hubPeers;
119 if (m_handler == ContentHandler::Destination) {118 if (m_handler == ContentHandler::Destination) {
@@ -151,7 +150,7 @@
151 */150 */
152ContentHandler::Handler ContentPeerModel::handler() 151ContentHandler::Handler ContentPeerModel::handler()
153{152{
154 qDebug() << Q_FUNC_INFO;153 TRACE() << Q_FUNC_INFO;
155 return m_handler;154 return m_handler;
156}155}
157156
@@ -161,7 +160,7 @@
161 */160 */
162void ContentPeerModel::setHandler(ContentHandler::Handler handler)161void ContentPeerModel::setHandler(ContentHandler::Handler handler)
163{162{
164 qDebug() << Q_FUNC_INFO;163 TRACE() << Q_FUNC_INFO;
165 m_handler = handler;164 m_handler = handler;
166 if (m_complete) {165 if (m_complete) {
167 findPeers();166 findPeers();
@@ -176,7 +175,7 @@
176 */175 */
177QQmlListProperty<ContentPeer> ContentPeerModel::peers()176QQmlListProperty<ContentPeer> ContentPeerModel::peers()
178{177{
179 qDebug() << Q_FUNC_INFO;178 TRACE() << Q_FUNC_INFO;
180 return QQmlListProperty<ContentPeer>(this, m_peers);179 return QQmlListProperty<ContentPeer>(this, m_peers);
181}180}
182181
183182
=== modified file 'import/Ubuntu/Content/contentscope.cpp'
--- import/Ubuntu/Content/contentscope.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/contentscope.cpp 2014-03-21 00:29:34 +0000
@@ -14,10 +14,9 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include "../../../src/com/ubuntu/content/debug.h"
17#include "contentscope.h"18#include "contentscope.h"
1819
19#include <QDebug>
20
21/*!20/*!
22 \qmltype ContentScope21 \qmltype ContentScope
23 \instantiates ContentScope22 \instantiates ContentScope
@@ -41,7 +40,7 @@
41ContentScope::ContentScope(QObject *parent)40ContentScope::ContentScope(QObject *parent)
42 : QObject(parent)41 : QObject(parent)
43{42{
44 qDebug() << Q_FUNC_INFO;43 TRACE() << Q_FUNC_INFO;
45}44}
4645
47/*!46/*!
@@ -52,7 +51,7 @@
52com::ubuntu::content::Scope ContentScope::contentScope2HubScope(int scope)51com::ubuntu::content::Scope ContentScope::contentScope2HubScope(int scope)
53{52{
54 Scope cscope = static_cast<Scope>(scope);53 Scope cscope = static_cast<Scope>(scope);
55 qDebug() << Q_FUNC_INFO << cscope;54 TRACE() << Q_FUNC_INFO << cscope;
56 return contentScope2HubScope(cscope);55 return contentScope2HubScope(cscope);
57}56}
5857
5958
=== modified file 'import/Ubuntu/Content/contentstore.cpp'
--- import/Ubuntu/Content/contentstore.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/contentstore.cpp 2014-03-21 00:29:34 +0000
@@ -14,12 +14,11 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include "../../../src/com/ubuntu/content/debug.h"
17#include "contentpeer.h"18#include "contentpeer.h"
18#include "contentstore.h"19#include "contentstore.h"
19#include "contenttype.h"20#include "contenttype.h"
2021
21#include <QDebug>
22
23/*!22/*!
24 * \qmltype ContentStore23 * \qmltype ContentStore
25 * \instantiates ContentStore24 * \instantiates ContentStore
@@ -37,7 +36,7 @@
37 m_store(0),36 m_store(0),
38 m_scope(ContentScope::System)37 m_scope(ContentScope::System)
39{38{
40 qDebug() << Q_FUNC_INFO;39 TRACE() << Q_FUNC_INFO;
41 m_hub = cuc::Hub::Client::instance();40 m_hub = cuc::Hub::Client::instance();
42}41}
4342
@@ -50,7 +49,7 @@
50{49{
51 static const QString __empty;50 static const QString __empty;
5251
53 qDebug() << Q_FUNC_INFO;52 TRACE() << Q_FUNC_INFO;
5453
55 if ( ! m_store) {54 if ( ! m_store) {
56 qWarning() << "Accessing ContentStore uri with NULL internal store";55 qWarning() << "Accessing ContentStore uri with NULL internal store";
@@ -65,7 +64,7 @@
65 */64 */
66const com::ubuntu::content::Store *ContentStore::store() const65const com::ubuntu::content::Store *ContentStore::store() const
67{66{
68 qDebug() << Q_FUNC_INFO;67 TRACE() << Q_FUNC_INFO;
69 return m_store;68 return m_store;
70}69}
7170
@@ -75,7 +74,7 @@
75 */74 */
76void ContentStore::setStore(const com::ubuntu::content::Store *store)75void ContentStore::setStore(const com::ubuntu::content::Store *store)
77{76{
78 qDebug() << Q_FUNC_INFO;77 TRACE() << Q_FUNC_INFO;
79 m_store = store;78 m_store = store;
80 Q_EMIT uriChanged();79 Q_EMIT uriChanged();
81}80}
@@ -87,7 +86,7 @@
87 */86 */
88ContentScope::Scope ContentStore::scope()87ContentScope::Scope ContentStore::scope()
89{ 88{
90 qDebug() << Q_FUNC_INFO;89 TRACE() << Q_FUNC_INFO;
91 return m_scope;90 return m_scope;
92}91}
9392
@@ -97,7 +96,7 @@
97 */96 */
98void ContentStore::setScope(ContentScope::Scope scope)97void ContentStore::setScope(ContentScope::Scope scope)
99{ 98{
100 qDebug() << Q_FUNC_INFO;99 TRACE() << Q_FUNC_INFO;
101 m_scope = scope;100 m_scope = scope;
102101
103 Q_EMIT scopeChanged();102 Q_EMIT scopeChanged();
@@ -109,7 +108,7 @@
109 */108 */
110void ContentStore::updateStore(ContentType::Type contentType)109void ContentStore::updateStore(ContentType::Type contentType)
111{110{
112 qDebug() << Q_FUNC_INFO;111 TRACE() << Q_FUNC_INFO;
113112
114 com::ubuntu::content::Scope hubScope = ContentScope::contentScope2HubScope(m_scope);113 com::ubuntu::content::Scope hubScope = ContentScope::contentScope2HubScope(m_scope);
115 const com::ubuntu::content::Type &hubType = ContentType::contentType2HubType(contentType);114 const com::ubuntu::content::Type &hubType = ContentType::contentType2HubType(contentType);
116115
=== modified file 'import/Ubuntu/Content/contenttransfer.cpp'
--- import/Ubuntu/Content/contenttransfer.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/contenttransfer.cpp 2014-03-21 00:29:34 +0000
@@ -16,11 +16,10 @@
1616
17#include "contenttransfer.h"17#include "contenttransfer.h"
18#include "contentitem.h"18#include "contentitem.h"
19#include "../../../src/com/ubuntu/content/debug.h"
1920
20#include <com/ubuntu/content/item.h>21#include <com/ubuntu/content/item.h>
2122
22#include <QDebug>
23
24/*!23/*!
25 * \qmltype ContentTransfer24 * \qmltype ContentTransfer
26 * \instantiates ContentTransfer25 * \instantiates ContentTransfer
@@ -39,7 +38,7 @@
39 m_selectionType(Single),38 m_selectionType(Single),
40 m_store(0)39 m_store(0)
41{40{
42 qDebug() << Q_FUNC_INFO;41 TRACE() << Q_FUNC_INFO;
43}42}
4443
45/*!44/*!
@@ -76,18 +75,18 @@
76 */75 */
77ContentTransfer::State ContentTransfer::state() const76ContentTransfer::State ContentTransfer::state() const
78{77{
79 qDebug() << Q_FUNC_INFO;78 TRACE() << Q_FUNC_INFO;
80 return m_state;79 return m_state;
81}80}
8281
83void ContentTransfer::setState(ContentTransfer::State state)82void ContentTransfer::setState(ContentTransfer::State state)
84{83{
85 qDebug() << Q_FUNC_INFO << state;84 TRACE() << Q_FUNC_INFO << state;
86 if (!m_transfer)85 if (!m_transfer)
87 return;86 return;
8887
89 if (state == Charged && m_state == InProgress) {88 if (state == Charged && m_state == InProgress) {
90 qDebug() << Q_FUNC_INFO << "Charged";89 TRACE() << Q_FUNC_INFO << "Charged";
91 QVector<cuc::Item> hubItems;90 QVector<cuc::Item> hubItems;
92 hubItems.reserve(m_items.size());91 hubItems.reserve(m_items.size());
93 Q_FOREACH (const ContentItem *citem, m_items) {92 Q_FOREACH (const ContentItem *citem, m_items) {
@@ -96,7 +95,7 @@
96 m_transfer->charge(hubItems);95 m_transfer->charge(hubItems);
97 return;96 return;
98 } else if (state == Aborted) {97 } else if (state == Aborted) {
99 qDebug() << Q_FUNC_INFO << "Aborted";98 TRACE() << Q_FUNC_INFO << "Aborted";
100 m_transfer->abort();99 m_transfer->abort();
101 } else100 } else
102 updateState();101 updateState();
@@ -153,7 +152,7 @@
153152
154void ContentTransfer::setSelectionType(ContentTransfer::SelectionType type)153void ContentTransfer::setSelectionType(ContentTransfer::SelectionType type)
155{154{
156 qDebug() << Q_FUNC_INFO << type;155 TRACE() << Q_FUNC_INFO << type;
157 if (!m_transfer)156 if (!m_transfer)
158 return;157 return;
159158
@@ -169,7 +168,7 @@
169 */168 */
170QQmlListProperty<ContentItem> ContentTransfer::items()169QQmlListProperty<ContentItem> ContentTransfer::items()
171{170{
172 qDebug() << Q_FUNC_INFO;171 TRACE() << Q_FUNC_INFO;
173 if (m_state == Charged) {172 if (m_state == Charged) {
174 collectItems();173 collectItems();
175 }174 }
@@ -183,7 +182,7 @@
183 */182 */
184bool ContentTransfer::start()183bool ContentTransfer::start()
185{184{
186 qDebug() << Q_FUNC_INFO << m_transfer->id() << ":" << m_state;185 TRACE() << Q_FUNC_INFO << m_transfer->id() << ":" << m_state;
187 if (m_state == Created) {186 if (m_state == Created) {
188 return m_transfer->start();187 return m_transfer->start();
189 } else {188 } else {
@@ -199,7 +198,7 @@
199 */198 */
200bool ContentTransfer::finalize()199bool ContentTransfer::finalize()
201{200{
202 qDebug() << Q_FUNC_INFO;201 TRACE() << Q_FUNC_INFO;
203 return m_transfer->finalize();202 return m_transfer->finalize();
204}203}
205204
@@ -209,13 +208,13 @@
209 */208 */
210const QString ContentTransfer::store() const209const QString ContentTransfer::store() const
211{210{
212 qDebug() << Q_FUNC_INFO;211 TRACE() << Q_FUNC_INFO;
213 return m_transfer->store().uri();212 return m_transfer->store().uri();
214}213}
215214
216void ContentTransfer::setStore(ContentStore* contentStore)215void ContentTransfer::setStore(ContentStore* contentStore)
217{216{
218 qDebug() << Q_FUNC_INFO;217 TRACE() << Q_FUNC_INFO;
219218
220 if (!m_transfer)219 if (!m_transfer)
221 {220 {
@@ -234,7 +233,7 @@
234 */233 */
235com::ubuntu::content::Transfer *ContentTransfer::transfer() const234com::ubuntu::content::Transfer *ContentTransfer::transfer() const
236{235{
237 qDebug() << Q_FUNC_INFO;236 TRACE() << Q_FUNC_INFO;
238 return m_transfer;237 return m_transfer;
239}238}
240239
@@ -256,7 +255,7 @@
256255
257 m_transfer = transfer;256 m_transfer = transfer;
258 m_direction = static_cast<ContentTransfer::Direction>(transfer->direction());257 m_direction = static_cast<ContentTransfer::Direction>(transfer->direction());
259 qDebug() << Q_FUNC_INFO << "Direction:" << m_direction;258 TRACE() << Q_FUNC_INFO << "Direction:" << m_direction;
260259
261 connect(m_transfer, SIGNAL(selectionTypeChanged()), this, SLOT(updateSelectionType()));260 connect(m_transfer, SIGNAL(selectionTypeChanged()), this, SLOT(updateSelectionType()));
262 connect(m_transfer, SIGNAL(storeChanged()), this, SLOT(updateStore()));261 connect(m_transfer, SIGNAL(storeChanged()), this, SLOT(updateStore()));
@@ -273,7 +272,7 @@
273 */272 */
274void ContentTransfer::collectItems()273void ContentTransfer::collectItems()
275{274{
276 qDebug() << Q_FUNC_INFO;275 TRACE() << Q_FUNC_INFO;
277 if (m_state != Charged)276 if (m_state != Charged)
278 return;277 return;
279278
@@ -295,11 +294,11 @@
295 */294 */
296void ContentTransfer::updateState()295void ContentTransfer::updateState()
297{296{
298 qDebug() << Q_FUNC_INFO << m_transfer->state();297 TRACE() << Q_FUNC_INFO << m_transfer->state();
299298
300 if (!m_transfer)299 if (!m_transfer)
301 {300 {
302 qWarning() << Q_FUNC_INFO << "Invalid transfer";301 TRACE() << Q_FUNC_INFO << "Invalid transfer";
303 return;302 return;
304 }303 }
305304
@@ -313,10 +312,10 @@
313 */312 */
314void ContentTransfer::updateSelectionType()313void ContentTransfer::updateSelectionType()
315{314{
316 qDebug() << Q_FUNC_INFO;315 TRACE() << Q_FUNC_INFO;
317 if (!m_transfer)316 if (!m_transfer)
318 {317 {
319 qWarning() << Q_FUNC_INFO << "Invalid transfer";318 TRACE() << Q_FUNC_INFO << "Invalid transfer";
320 return;319 return;
321 }320 }
322321
@@ -331,10 +330,10 @@
331 */330 */
332void ContentTransfer::updateStore()331void ContentTransfer::updateStore()
333{332{
334 qDebug() << Q_FUNC_INFO;333 TRACE() << Q_FUNC_INFO;
335 if (!m_transfer)334 if (!m_transfer)
336 {335 {
337 qWarning() << Q_FUNC_INFO << "Invalid transfer";336 TRACE() << Q_FUNC_INFO << "Invalid transfer";
338 return;337 return;
339 }338 }
340339
341340
=== modified file 'import/Ubuntu/Content/contenttype.cpp'
--- import/Ubuntu/Content/contenttype.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/contenttype.cpp 2014-03-21 00:29:34 +0000
@@ -15,8 +15,7 @@
15 */15 */
1616
17#include "contenttype.h"17#include "contenttype.h"
1818#include "../../../src/com/ubuntu/content/debug.h"
19#include <QDebug>
2019
21/*!20/*!
22 \qmltype ContentType21 \qmltype ContentType
@@ -57,7 +56,7 @@
57ContentType::ContentType(QObject *parent)56ContentType::ContentType(QObject *parent)
58 : QObject(parent)57 : QObject(parent)
59{58{
60 qDebug() << Q_FUNC_INFO;59 TRACE() << Q_FUNC_INFO;
61}60}
6261
6362
@@ -69,7 +68,7 @@
69const com::ubuntu::content::Type &ContentType::contentType2HubType(int type)68const com::ubuntu::content::Type &ContentType::contentType2HubType(int type)
70{69{
71 Type ctype = static_cast<Type>(type);70 Type ctype = static_cast<Type>(type);
72 qDebug() << Q_FUNC_INFO << ctype;71 TRACE() << Q_FUNC_INFO << ctype;
73 return contentType2HubType(ctype);72 return contentType2HubType(ctype);
74}73}
7574
7675
=== modified file 'import/Ubuntu/Content/qmlimportexporthandler.cpp'
--- import/Ubuntu/Content/qmlimportexporthandler.cpp 2014-03-21 00:29:33 +0000
+++ import/Ubuntu/Content/qmlimportexporthandler.cpp 2014-03-21 00:29:34 +0000
@@ -15,11 +15,10 @@
15 */15 */
1616
17#include "qmlimportexporthandler.h"17#include "qmlimportexporthandler.h"
18#include "../../../src/com/ubuntu/content/debug.h"
1819
19#include <com/ubuntu/content/transfer.h>20#include <com/ubuntu/content/transfer.h>
2021
21#include <QDebug>
22
23namespace cuc = com::ubuntu::content;22namespace cuc = com::ubuntu::content;
2423
25/*!24/*!
@@ -29,7 +28,7 @@
29QmlImportExportHandler::QmlImportExportHandler(QObject *parent)28QmlImportExportHandler::QmlImportExportHandler(QObject *parent)
30 : cuc::ImportExportHandler(parent)29 : cuc::ImportExportHandler(parent)
31{30{
32 qDebug() << Q_FUNC_INFO;31 TRACE() << Q_FUNC_INFO;
33}32}
3433
35/*!34/*!
@@ -37,7 +36,7 @@
37 */36 */
38void QmlImportExportHandler::handle_import(com::ubuntu::content::Transfer *transfer)37void QmlImportExportHandler::handle_import(com::ubuntu::content::Transfer *transfer)
39{38{
40 qDebug() << Q_FUNC_INFO;39 TRACE() << Q_FUNC_INFO;
41 Q_EMIT importRequested(transfer);40 Q_EMIT importRequested(transfer);
42}41}
4342
@@ -46,7 +45,7 @@
46 */45 */
47void QmlImportExportHandler::handle_export(com::ubuntu::content::Transfer *transfer)46void QmlImportExportHandler::handle_export(com::ubuntu::content::Transfer *transfer)
48{47{
49 qDebug() << Q_FUNC_INFO;48 TRACE() << Q_FUNC_INFO;
50 Q_EMIT exportRequested(transfer);49 Q_EMIT exportRequested(transfer);
51}50}
5251
@@ -55,6 +54,6 @@
55 */54 */
56void QmlImportExportHandler::handle_share(com::ubuntu::content::Transfer *transfer)55void QmlImportExportHandler::handle_share(com::ubuntu::content::Transfer *transfer)
57{56{
58 qDebug() << Q_FUNC_INFO;57 TRACE() << Q_FUNC_INFO;
59 Q_EMIT shareRequested(transfer);58 Q_EMIT shareRequested(transfer);
60}59}
6160
=== modified file 'src/com/ubuntu/content/CMakeLists.txt'
--- src/com/ubuntu/content/CMakeLists.txt 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/CMakeLists.txt 2014-03-21 00:29:34 +0000
@@ -68,6 +68,7 @@
68 transfer.cpp68 transfer.cpp
69 type.cpp69 type.cpp
70 utils.cpp70 utils.cpp
71 debug.cpp
7172
72 detail/app_manager.cpp73 detail/app_manager.cpp
73 detail/service.cpp74 detail/service.cpp
7475
=== added file 'src/com/ubuntu/content/debug.cpp'
--- src/com/ubuntu/content/debug.cpp 1970-01-01 00:00:00 +0000
+++ src/com/ubuntu/content/debug.cpp 2014-03-21 00:29:34 +0000
@@ -0,0 +1,26 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 3 as
6 * published by the Free Software Foundation.
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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17
18#include "debug.h"
19
20int appLoggingLevel = 1; // criticals
21
22void setLoggingLevel(int level)
23{
24 appLoggingLevel = level;
25}
26
027
=== added file 'src/com/ubuntu/content/debug.h'
--- src/com/ubuntu/content/debug.h 1970-01-01 00:00:00 +0000
+++ src/com/ubuntu/content/debug.h 2014-03-21 00:29:34 +0000
@@ -0,0 +1,53 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 3 as
6 * published by the Free Software Foundation.
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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef DEBUG_H
18#define DEBUG_H
19
20#include <QDebug>
21
22/* 0 - fatal, 1 - critical(default), 2 - info/debug */
23extern int appLoggingLevel;
24
25static inline bool debugEnabled()
26{
27 return appLoggingLevel >= 2;
28}
29
30static inline bool criticalsEnabled()
31{
32 return appLoggingLevel >= 1;
33}
34
35static inline int loggingLevel()
36{
37 return appLoggingLevel;
38}
39
40void setLoggingLevel(int level);
41
42#ifdef DEBUG_ENABLED
43 #define TRACE() \
44 if (debugEnabled()) qDebug() << __FILE__ << __LINE__ << __func__
45 #define BLAME() \
46 if (criticalsEnabled()) qCritical() << __FILE__ << __LINE__ << __func__
47#else
48 #define TRACE() while (0) qDebug()
49 #define BLAME() while (0) qDebug()
50#endif
51
52#endif // DEBUG_H
53
054
=== modified file 'src/com/ubuntu/content/detail/app_manager.cpp'
--- src/com/ubuntu/content/detail/app_manager.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/detail/app_manager.cpp 2014-03-21 00:29:34 +0000
@@ -15,9 +15,9 @@
15 */15 */
1616
17#include "app_manager.h"17#include "app_manager.h"
18#include "debug.h"
1819
19#include <upstart-app-launch.h>20#include <upstart-app-launch.h>
20#include <QDebug>
2121
22namespace cucd = com::ubuntu::content::detail;22namespace cucd = com::ubuntu::content::detail;
2323
@@ -27,7 +27,7 @@
2727
28bool cucd::AppManager::invoke_application(const std::string &app_id)28bool cucd::AppManager::invoke_application(const std::string &app_id)
29{29{
30 qDebug() << Q_FUNC_INFO << "APP_ID:" << app_id.c_str();30 TRACE() << Q_FUNC_INFO << "APP_ID:" << app_id.c_str();
31 gchar ** uris = NULL;31 gchar ** uris = NULL;
32 gboolean ok = upstart_app_launch_start_application(app_id.c_str(), (const gchar * const *)uris);32 gboolean ok = upstart_app_launch_start_application(app_id.c_str(), (const gchar * const *)uris);
33 return static_cast<bool>(ok);33 return static_cast<bool>(ok);
@@ -38,7 +38,7 @@
38 */38 */
39bool cucd::AppManager::stop_application(const std::string &app_id)39bool cucd::AppManager::stop_application(const std::string &app_id)
40{40{
41 qDebug() << Q_FUNC_INFO << "APP_ID:" << app_id.c_str();41 TRACE() << Q_FUNC_INFO << "APP_ID:" << app_id.c_str();
4242
43 gboolean ok = upstart_app_launch_stop_application(app_id.c_str());43 gboolean ok = upstart_app_launch_stop_application(app_id.c_str());
44 return static_cast<bool>(ok);44 return static_cast<bool>(ok);
4545
=== modified file 'src/com/ubuntu/content/detail/handler.cpp'
--- src/com/ubuntu/content/detail/handler.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/detail/handler.cpp 2014-03-21 00:29:34 +0000
@@ -19,9 +19,9 @@
19#include "transfer_p.h"19#include "transfer_p.h"
20#include "handler.h"20#include "handler.h"
21#include "utils.cpp"21#include "utils.cpp"
22#include "debug.h"
2223
23#include <QObject>24#include <QObject>
24#include <QDebug>
2525
26namespace cucd = com::ubuntu::content::detail;26namespace cucd = com::ubuntu::content::detail;
27namespace cuc = com::ubuntu::content;27namespace cuc = com::ubuntu::content;
@@ -35,7 +35,7 @@
35 connection(connection),35 connection(connection),
36 peer_id(peer_id)36 peer_id(peer_id)
37 {37 {
38 qDebug() << Q_FUNC_INFO;38 TRACE() << Q_FUNC_INFO;
39 }39 }
4040
41 QDBusConnection connection;41 QDBusConnection connection;
@@ -45,7 +45,7 @@
45cucd::Handler::Handler(QDBusConnection connection, const QString& peer_id, cuc::ImportExportHandler* handler)45cucd::Handler::Handler(QDBusConnection connection, const QString& peer_id, cuc::ImportExportHandler* handler)
46 : d(new Private{connection, peer_id, this})46 : d(new Private{connection, peer_id, this})
47{47{
48 qDebug() << Q_FUNC_INFO;48 TRACE() << Q_FUNC_INFO;
49 m_handler = handler;49 m_handler = handler;
50}50}
5151
@@ -55,20 +55,20 @@
5555
56void cucd::Handler::HandleImport(const QDBusObjectPath& transfer)56void cucd::Handler::HandleImport(const QDBusObjectPath& transfer)
57{57{
58 qDebug() << Q_FUNC_INFO << transfer.path();58 TRACE() << Q_FUNC_INFO << transfer.path();
59 cuc::Transfer* t = cuc::Transfer::Private::make_transfer(transfer, this);59 cuc::Transfer* t = cuc::Transfer::Private::make_transfer(transfer, this);
6060
61 qDebug() << Q_FUNC_INFO << "State:" << t->state();61 TRACE() << Q_FUNC_INFO << "State:" << t->state();
62 if (t->state() == cuc::Transfer::charged)62 if (t->state() == cuc::Transfer::charged)
63 m_handler->handle_import(t);63 m_handler->handle_import(t);
64}64}
6565
66void cucd::Handler::HandleExport(const QDBusObjectPath& transfer)66void cucd::Handler::HandleExport(const QDBusObjectPath& transfer)
67{67{
68 qDebug() << Q_FUNC_INFO << transfer.path();68 TRACE() << Q_FUNC_INFO << transfer.path();
69 cuc::Transfer* t = cuc::Transfer::Private::make_transfer(transfer, this);69 cuc::Transfer* t = cuc::Transfer::Private::make_transfer(transfer, this);
7070
71 qDebug() << Q_FUNC_INFO << "State:" << t->state();71 TRACE() << Q_FUNC_INFO << "State:" << t->state();
72 if (t->state() == cuc::Transfer::initiated)72 if (t->state() == cuc::Transfer::initiated)
73 {73 {
74 t->d->handled();74 t->d->handled();
@@ -78,10 +78,10 @@
7878
79void cucd::Handler::HandleShare(const QDBusObjectPath& transfer)79void cucd::Handler::HandleShare(const QDBusObjectPath& transfer)
80{80{
81 qDebug() << Q_FUNC_INFO;81 TRACE() << Q_FUNC_INFO;
82 cuc::Transfer* t = cuc::Transfer::Private::make_transfer(transfer, this);82 cuc::Transfer* t = cuc::Transfer::Private::make_transfer(transfer, this);
8383
84 qDebug() << Q_FUNC_INFO << "State:" << t->state();84 TRACE() << Q_FUNC_INFO << "State:" << t->state();
85 if (t->state() == cuc::Transfer::charged)85 if (t->state() == cuc::Transfer::charged)
86 {86 {
87 m_handler->handle_share(t);87 m_handler->handle_share(t);
8888
=== modified file 'src/com/ubuntu/content/detail/service.cpp'
--- src/com/ubuntu/content/detail/service.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/detail/service.cpp 2014-03-21 00:29:34 +0000
@@ -16,8 +16,8 @@
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */17 */
1818
19#include "debug.h"
19#include "service.h"20#include "service.h"
20
21#include "peer_registry.h"21#include "peer_registry.h"
22#include "transfer.h"22#include "transfer.h"
23#include "transferadaptor.h"23#include "transferadaptor.h"
@@ -94,10 +94,10 @@
9494
95cucd::Service::~Service()95cucd::Service::~Service()
96{96{
97 qDebug() << Q_FUNC_INFO;97 TRACE() << Q_FUNC_INFO;
98 Q_FOREACH (cucd::Transfer *t, d->active_transfers)98 Q_FOREACH (cucd::Transfer *t, d->active_transfers)
99 {99 {
100 qDebug() << Q_FUNC_INFO << "Destroying transfer:" << t->Id();100 TRACE() << Q_FUNC_INFO << "Destroying transfer:" << t->Id();
101 delete t;101 delete t;
102 }102 }
103}103}
@@ -158,11 +158,11 @@
158158
159QDBusObjectPath cucd::Service::CreateImportFromPeer(const QString& peer_id, const QString& app_id)159QDBusObjectPath cucd::Service::CreateImportFromPeer(const QString& peer_id, const QString& app_id)
160{160{
161 qDebug() << Q_FUNC_INFO;161 TRACE() << Q_FUNC_INFO;
162 QString dest_id = app_id;162 QString dest_id = app_id;
163 if (dest_id.isEmpty())163 if (dest_id.isEmpty())
164 {164 {
165 qDebug() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor";165 TRACE() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor";
166 dest_id = aa_profile(this->message().service());166 dest_id = aa_profile(this->message().service());
167 }167 }
168 return CreateTransfer(dest_id, peer_id, cuc::Transfer::Import);168 return CreateTransfer(dest_id, peer_id, cuc::Transfer::Import);
@@ -170,7 +170,7 @@
170170
171bool cucd::Service::should_cancel (int st)171bool cucd::Service::should_cancel (int st)
172{172{
173 qDebug() << Q_FUNC_INFO << "State:" << st;173 TRACE() << Q_FUNC_INFO << "State:" << st;
174174
175 return (st != cuc::Transfer::finalized175 return (st != cuc::Transfer::finalized
176 && st != cuc::Transfer::collected176 && st != cuc::Transfer::collected
@@ -179,11 +179,11 @@
179179
180QDBusObjectPath cucd::Service::CreateExportToPeer(const QString& peer_id, const QString& app_id)180QDBusObjectPath cucd::Service::CreateExportToPeer(const QString& peer_id, const QString& app_id)
181{181{
182 qDebug() << Q_FUNC_INFO;182 TRACE() << Q_FUNC_INFO;
183 QString src_id = app_id;183 QString src_id = app_id;
184 if (src_id.isEmpty())184 if (src_id.isEmpty())
185 {185 {
186 qDebug() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor";186 TRACE() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor";
187 src_id = aa_profile(this->message().service());187 src_id = aa_profile(this->message().service());
188 }188 }
189 return CreateTransfer(peer_id, src_id, cuc::Transfer::Export);189 return CreateTransfer(peer_id, src_id, cuc::Transfer::Export);
@@ -191,11 +191,11 @@
191191
192QDBusObjectPath cucd::Service::CreateShareToPeer(const QString& peer_id, const QString& app_id)192QDBusObjectPath cucd::Service::CreateShareToPeer(const QString& peer_id, const QString& app_id)
193{193{
194 qDebug() << Q_FUNC_INFO;194 TRACE() << Q_FUNC_INFO;
195 QString src_id = app_id;195 QString src_id = app_id;
196 if (src_id.isEmpty())196 if (src_id.isEmpty())
197 {197 {
198 qDebug() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor";198 TRACE() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor";
199 src_id = aa_profile(this->message().service());199 src_id = aa_profile(this->message().service());
200 }200 }
201 return CreateTransfer(peer_id, src_id, cuc::Transfer::Share);201 return CreateTransfer(peer_id, src_id, cuc::Transfer::Share);
@@ -203,7 +203,7 @@
203203
204QDBusObjectPath cucd::Service::CreateTransfer(const QString& dest_id, const QString& src_id, int dir)204QDBusObjectPath cucd::Service::CreateTransfer(const QString& dest_id, const QString& src_id, int dir)
205{205{
206 qDebug() << Q_FUNC_INFO << "DEST:" << dest_id << "SRC:" << src_id << "DIRECTION:" << dir;206 TRACE() << Q_FUNC_INFO << "DEST:" << dest_id << "SRC:" << src_id << "DIRECTION:" << dir;
207207
208 static size_t import_counter{0}; import_counter++;208 static size_t import_counter{0}; import_counter++;
209209
@@ -213,10 +213,10 @@
213 {213 {
214 if (t->destination() == dest_id || t->source() == src_id)214 if (t->destination() == dest_id || t->source() == src_id)
215 {215 {
216 qDebug() << Q_FUNC_INFO << "Found transfer for peer_id:" << src_id;216 TRACE() << Q_FUNC_INFO << "Found transfer for peer_id:" << src_id;
217 if (should_cancel(t->State()))217 if (should_cancel(t->State()))
218 {218 {
219 qDebug() << Q_FUNC_INFO << "Aborting active transfer:" << t->Id();219 TRACE() << Q_FUNC_INFO << "Aborting active transfer:" << t->Id();
220 t->Abort();220 t->Abort();
221 }221 }
222 }222 }
@@ -229,10 +229,10 @@
229 auto destination = transfer->import_path();229 auto destination = transfer->import_path();
230 auto source = transfer->export_path();230 auto source = transfer->export_path();
231 if (not d->connection.registerObject(source, transfer))231 if (not d->connection.registerObject(source, transfer))
232 qDebug() << "Problem registering object for path: " << source;232 TRACE() << "Problem registering object for path: " << source;
233 d->connection.registerObject(destination, transfer);233 d->connection.registerObject(destination, transfer);
234234
235 qDebug() << "Created transfer " << source << " -> " << destination;235 TRACE() << "Created transfer " << source << " -> " << destination;
236236
237 // Content flow is different for import237 // Content flow is different for import
238 if (dir == cuc::Transfer::Import)238 if (dir == cuc::Transfer::Import)
@@ -247,13 +247,13 @@
247247
248void cucd::Service::handle_imports(int state)248void cucd::Service::handle_imports(int state)
249{249{
250 qDebug() << Q_FUNC_INFO << state;250 TRACE() << Q_FUNC_INFO << state;
251 cucd::Transfer *transfer = static_cast<cucd::Transfer*>(sender());251 cucd::Transfer *transfer = static_cast<cucd::Transfer*>(sender());
252 qDebug() << Q_FUNC_INFO << "State: " << transfer->State() << "Id:" << transfer->Id();252 TRACE() << Q_FUNC_INFO << "State: " << transfer->State() << "Id:" << transfer->Id();
253253
254 if (state == cuc::Transfer::initiated)254 if (state == cuc::Transfer::initiated)
255 {255 {
256 qDebug() << Q_FUNC_INFO << "initiated";256 TRACE() << Q_FUNC_INFO << "initiated";
257 if (d->app_manager->is_application_started(transfer->source().toStdString()))257 if (d->app_manager->is_application_started(transfer->source().toStdString()))
258 transfer->SetSourceStartedByContentHub(false);258 transfer->SetSourceStartedByContentHub(false);
259 else259 else
@@ -261,14 +261,14 @@
261261
262 Q_FOREACH (RegHandler *r, d->handlers)262 Q_FOREACH (RegHandler *r, d->handlers)
263 {263 {
264 qDebug() << Q_FUNC_INFO << "ID:" << r->id << "Handler: " << r->service << "Transfer: " << transfer->source();264 TRACE() << Q_FUNC_INFO << "ID:" << r->id << "Handler: " << r->service << "Transfer: " << transfer->source();
265 if (r->id == transfer->source())265 if (r->id == transfer->source())
266 {266 {
267 qDebug() << Q_FUNC_INFO << "Found handler for initiated transfer" << r->id;267 TRACE() << Q_FUNC_INFO << "Found handler for initiated transfer" << r->id;
268 if (r->handler->isValid())268 if (r->handler->isValid())
269 r->handler->HandleExport(QDBusObjectPath{transfer->export_path()});269 r->handler->HandleExport(QDBusObjectPath{transfer->export_path()});
270 else270 else
271 qDebug() << Q_FUNC_INFO << "Handler invalid";271 TRACE() << Q_FUNC_INFO << "Handler invalid";
272 }272 }
273 }273 }
274274
@@ -277,7 +277,7 @@
277277
278 if (state == cuc::Transfer::charged)278 if (state == cuc::Transfer::charged)
279 {279 {
280 qDebug() << Q_FUNC_INFO << "Charged";280 TRACE() << Q_FUNC_INFO << "Charged";
281 if (transfer->WasSourceStartedByContentHub())281 if (transfer->WasSourceStartedByContentHub())
282 d->app_manager->stop_application(transfer->source().toStdString());282 d->app_manager->stop_application(transfer->source().toStdString());
283 283
@@ -285,10 +285,10 @@
285285
286 Q_FOREACH (RegHandler *r, d->handlers)286 Q_FOREACH (RegHandler *r, d->handlers)
287 {287 {
288 qDebug() << Q_FUNC_INFO << "ID:" << r->id << "Handler: " << r->service << "Transfer: " << transfer->destination();288 TRACE() << Q_FUNC_INFO << "ID:" << r->id << "Handler: " << r->service << "Transfer: " << transfer->destination();
289 if (r->id == transfer->destination())289 if (r->id == transfer->destination())
290 {290 {
291 qDebug() << Q_FUNC_INFO << "Found handler for charged transfer" << r->id;291 TRACE() << Q_FUNC_INFO << "Found handler for charged transfer" << r->id;
292 if (r->handler->isValid())292 if (r->handler->isValid())
293 r->handler->HandleImport(QDBusObjectPath{transfer->import_path()});293 r->handler->HandleImport(QDBusObjectPath{transfer->import_path()});
294 }294 }
@@ -304,39 +304,43 @@
304 {304 {
305 if (t->Id() != transfer->Id())305 if (t->Id() != transfer->Id())
306 {306 {
307 if ((t->source() == transfer->source()) || (t->destination() == transfer->destination()))307 if ((t->source() == transfer->source()) && (t->State() == cuc::Transfer::in_progress))
308 {308 {
309 qDebug() << Q_FUNC_INFO << "Peer has pending transfers:" << t->Id();309 TRACE() << Q_FUNC_INFO << "Source has pending transfers:" << t->Id();
310 shouldStop = false;310 shouldStop = false;
311 }311 }
312 if (t->destination() == transfer->destination())
313 {
314 qDebug() << Q_FUNC_INFO << "Destination has pending transfers:" << t->Id();
315 if (should_cancel(t->State()))
316 shouldStop = false;
317 }
312 }318 }
313 }319 }
314 if (shouldStop)320 if (shouldStop)
315 {321 d->app_manager->stop_application(transfer->source().toStdString());
316 d->app_manager->stop_application(transfer->source().toStdString());
317 d->app_manager->invoke_application(transfer->destination().toStdString());
318 }
319 }322 }
323 d->app_manager->invoke_application(transfer->destination().toStdString());
320 }324 }
321}325}
322326
323void cucd::Service::handle_exports(int state)327void cucd::Service::handle_exports(int state)
324{328{
325 qDebug() << Q_FUNC_INFO;329 TRACE() << Q_FUNC_INFO;
326 cucd::Transfer *transfer = static_cast<cucd::Transfer*>(sender());330 cucd::Transfer *transfer = static_cast<cucd::Transfer*>(sender());
327331
328 qDebug() << Q_FUNC_INFO << "STATE:" << transfer->State();332 TRACE() << Q_FUNC_INFO << "STATE:" << transfer->State();
329333
330334
331 if (state == cuc::Transfer::initiated)335 if (state == cuc::Transfer::initiated)
332 {336 {
333 qDebug() << Q_FUNC_INFO << "Initiated";337 TRACE() << Q_FUNC_INFO << "Initiated";
334 transfer->Handled();338 transfer->Handled();
335 }339 }
336340
337 if (state == cuc::Transfer::charged)341 if (state == cuc::Transfer::charged)
338 {342 {
339 qDebug() << Q_FUNC_INFO << "Charged";343 TRACE() << Q_FUNC_INFO << "Charged";
340 if (d->app_manager->is_application_started(transfer->destination().toStdString()))344 if (d->app_manager->is_application_started(transfer->destination().toStdString()))
341 transfer->SetSourceStartedByContentHub(false);345 transfer->SetSourceStartedByContentHub(false);
342 else346 else
@@ -346,10 +350,10 @@
346350
347 Q_FOREACH (RegHandler *r, d->handlers)351 Q_FOREACH (RegHandler *r, d->handlers)
348 {352 {
349 qDebug() << "Handler: " << r->service << "Transfer: " << transfer->destination();353 TRACE() << "Handler: " << r->service << "Transfer: " << transfer->destination();
350 if (r->id == transfer->destination())354 if (r->id == transfer->destination())
351 {355 {
352 qDebug() << "Found handler for charged transfer" << r->id;356 TRACE() << "Found handler for charged transfer" << r->id;
353 if (transfer->Direction() == cuc::Transfer::Share && r->handler->isValid())357 if (transfer->Direction() == cuc::Transfer::Share && r->handler->isValid())
354 r->handler->HandleShare(QDBusObjectPath{transfer->import_path()});358 r->handler->HandleShare(QDBusObjectPath{transfer->import_path()});
355 else if (r->handler->isValid())359 else if (r->handler->isValid())
@@ -360,7 +364,7 @@
360364
361 if (state == cuc::Transfer::finalized)365 if (state == cuc::Transfer::finalized)
362 {366 {
363 qDebug() << Q_FUNC_INFO << "Finalized";367 TRACE() << Q_FUNC_INFO << "Finalized";
364 if (transfer->WasSourceStartedByContentHub())368 if (transfer->WasSourceStartedByContentHub())
365 d->app_manager->stop_application(transfer->destination().toStdString());369 d->app_manager->stop_application(transfer->destination().toStdString());
366370
@@ -369,7 +373,7 @@
369373
370 if (state == cuc::Transfer::aborted)374 if (state == cuc::Transfer::aborted)
371 {375 {
372 qDebug() << Q_FUNC_INFO << "Aborted";376 TRACE() << Q_FUNC_INFO << "Aborted";
373 if (transfer->WasSourceStartedByContentHub())377 if (transfer->WasSourceStartedByContentHub())
374 {378 {
375 bool shouldStop = true;379 bool shouldStop = true;
@@ -377,35 +381,39 @@
377 {381 {
378 if (t->Id() != transfer->Id())382 if (t->Id() != transfer->Id())
379 {383 {
380 if ((t->source() == transfer->source()) || (t->destination() == transfer->destination()))384 if ((t->source() == transfer->source()) && (t->State() == cuc::Transfer::in_progress))
381 {385 {
382 qDebug() << Q_FUNC_INFO << "Peer has pending transfers:" << t->Id();386 TRACE() << Q_FUNC_INFO << "Source has pending transfers:" << t->Id();
383 shouldStop = false;387 shouldStop = false;
384 }388 }
389 if (t->destination() == transfer->destination())
390 {
391 qDebug() << Q_FUNC_INFO << "Destination has pending transfers:" << t->Id();
392 if (should_cancel(t->State()))
393 shouldStop = false;
394 }
385 }395 }
386 }396 }
387 if (shouldStop)397 if (shouldStop)
388 {
389 d->app_manager->stop_application(transfer->destination().toStdString());398 d->app_manager->stop_application(transfer->destination().toStdString());
390 d->app_manager->invoke_application(transfer->source().toStdString());
391 }
392 }399 }
400 d->app_manager->invoke_application(transfer->source().toStdString());
393 }401 }
394}402}
395403
396void cucd::Service::handler_unregistered(const QString& s)404void cucd::Service::handler_unregistered(const QString& s)
397{405{
398 qDebug() << Q_FUNC_INFO << s;406 TRACE() << Q_FUNC_INFO << s;
399407
400 if (d->handlers.isEmpty())408 if (d->handlers.isEmpty())
401 return;409 return;
402410
403 Q_FOREACH (RegHandler *r, d->handlers)411 Q_FOREACH (RegHandler *r, d->handlers)
404 {412 {
405 qDebug() << "Handler: " << r->id;413 TRACE() << "Handler: " << r->id;
406 if (r->service == s)414 if (r->service == s)
407 {415 {
408 qDebug() << "Found match for " << r->id;416 TRACE() << "Found match for " << r->id;
409 d->handlers.remove(r);417 d->handlers.remove(r);
410 m_watcher->removeWatchedService(s);418 m_watcher->removeWatchedService(s);
411 delete r;419 delete r;
@@ -415,15 +423,15 @@
415423
416void cucd::Service::RegisterImportExportHandler(const QString& peer_id, const QDBusObjectPath& handler)424void cucd::Service::RegisterImportExportHandler(const QString& peer_id, const QDBusObjectPath& handler)
417{425{
418 qDebug() << Q_FUNC_INFO << peer_id;426 TRACE() << Q_FUNC_INFO << peer_id;
419 bool exists = false;427 bool exists = false;
420 RegHandler* r;428 RegHandler* r;
421 Q_FOREACH (RegHandler *rh, d->handlers)429 Q_FOREACH (RegHandler *rh, d->handlers)
422 {430 {
423 qDebug() << "Handler: " << rh->id;431 TRACE() << "Handler: " << rh->id;
424 if (rh->id == peer_id)432 if (rh->id == peer_id)
425 {433 {
426 qDebug() << "Found existing handler for " << rh->id;434 TRACE() << "Found existing handler for " << rh->id;
427 exists = true;435 exists = true;
428 r = rh;436 r = rh;
429 }437 }
@@ -442,14 +450,14 @@
442 m_watcher->addWatchedService(r->service);450 m_watcher->addWatchedService(r->service);
443 }451 }
444452
445 qDebug() << Q_FUNC_INFO << r->id;453 TRACE() << Q_FUNC_INFO << r->id;
446454
447 Q_FOREACH (cucd::Transfer *t, d->active_transfers)455 Q_FOREACH (cucd::Transfer *t, d->active_transfers)
448 {456 {
449 qDebug() << Q_FUNC_INFO << "SOURCE: " << t->source() << "DEST:" << t->destination() << "STATE:" << t->State();457 TRACE() << Q_FUNC_INFO << "SOURCE: " << t->source() << "DEST:" << t->destination() << "STATE:" << t->State();
450 if ((t->source() == peer_id) && (t->State() == cuc::Transfer::initiated))458 if ((t->source() == peer_id) && (t->State() == cuc::Transfer::initiated))
451 {459 {
452 qDebug() << Q_FUNC_INFO << "Found source:" << peer_id << "Direction:" << t->Direction();460 TRACE() << Q_FUNC_INFO << "Found source:" << peer_id << "Direction:" << t->Direction();
453 if (t->Direction() == cuc::Transfer::Import)461 if (t->Direction() == cuc::Transfer::Import)
454 {462 {
455 if (r->handler->isValid())463 if (r->handler->isValid())
@@ -458,15 +466,15 @@
458 }466 }
459 else if ((t->destination() == peer_id) && (t->State() == cuc::Transfer::charged))467 else if ((t->destination() == peer_id) && (t->State() == cuc::Transfer::charged))
460 {468 {
461 qDebug() << Q_FUNC_INFO << "Found destination:" << peer_id << "Direction:" << t->Direction();469 TRACE() << Q_FUNC_INFO << "Found destination:" << peer_id << "Direction:" << t->Direction();
462 if (t->Direction() == cuc::Transfer::Export)470 if (t->Direction() == cuc::Transfer::Export)
463 {471 {
464 qDebug() << Q_FUNC_INFO << "Found import, calling HandleImport";472 TRACE() << Q_FUNC_INFO << "Found import, calling HandleImport";
465 if (r->handler->isValid())473 if (r->handler->isValid())
466 r->handler->HandleImport(QDBusObjectPath{t->import_path()});474 r->handler->HandleImport(QDBusObjectPath{t->import_path()});
467 } else if (t->Direction() == cuc::Transfer::Share)475 } else if (t->Direction() == cuc::Transfer::Share)
468 {476 {
469 qDebug() << Q_FUNC_INFO << "Found share, calling HandleShare";477 TRACE() << Q_FUNC_INFO << "Found share, calling HandleShare";
470 if (r->handler->isValid())478 if (r->handler->isValid())
471 r->handler->HandleShare(QDBusObjectPath{t->import_path()});479 r->handler->HandleShare(QDBusObjectPath{t->import_path()});
472 }480 }
473481
=== modified file 'src/com/ubuntu/content/detail/transfer.cpp'
--- src/com/ubuntu/content/detail/transfer.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/detail/transfer.cpp 2014-03-21 00:29:34 +0000
@@ -16,6 +16,7 @@
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */17 */
1818
19#include "debug.h"
19#include "transfer.h"20#include "transfer.h"
20#include "utils.cpp"21#include "utils.cpp"
2122
@@ -23,8 +24,6 @@
23#include <com/ubuntu/content/store.h>24#include <com/ubuntu/content/store.h>
24#include <com/ubuntu/content/transfer.h>25#include <com/ubuntu/content/transfer.h>
2526
26#include <QDebug>
27
28namespace cuc = com::ubuntu::content;27namespace cuc = com::ubuntu::content;
29namespace cucd = com::ubuntu::content::detail;28namespace cucd = com::ubuntu::content::detail;
3029
@@ -62,51 +61,51 @@
62 QObject* parent) :61 QObject* parent) :
63 QObject(parent), d(new Private(id, source, destination, direction))62 QObject(parent), d(new Private(id, source, destination, direction))
64{63{
65 qDebug() << __PRETTY_FUNCTION__;64 TRACE() << __PRETTY_FUNCTION__;
66}65}
6766
68cucd::Transfer::~Transfer()67cucd::Transfer::~Transfer()
69{68{
70 qDebug() << __PRETTY_FUNCTION__;69 TRACE() << __PRETTY_FUNCTION__;
71 purge_store_cache(d->store);70 purge_store_cache(d->store);
72}71}
7372
74/* unique id of the transfer */73/* unique id of the transfer */
75int cucd::Transfer::Id()74int cucd::Transfer::Id()
76{75{
77 qDebug() << __PRETTY_FUNCTION__;76 TRACE() << __PRETTY_FUNCTION__;
78 return d->id;77 return d->id;
79}78}
8079
81/* returns the peer_id of the requested export handler */80/* returns the peer_id of the requested export handler */
82QString cucd::Transfer::source()81QString cucd::Transfer::source()
83{82{
84 qDebug() << __PRETTY_FUNCTION__;83 TRACE() << __PRETTY_FUNCTION__;
85 return d->source;84 return d->source;
86}85}
8786
88/* returns the peer_id of the application requesting the import */87/* returns the peer_id of the application requesting the import */
89QString cucd::Transfer::destination()88QString cucd::Transfer::destination()
90{89{
91 qDebug() << __PRETTY_FUNCTION__;90 TRACE() << __PRETTY_FUNCTION__;
92 return d->destination;91 return d->destination;
93}92}
9493
95int cucd::Transfer::Direction()94int cucd::Transfer::Direction()
96{95{
97 qDebug() << __PRETTY_FUNCTION__;96 TRACE() << __PRETTY_FUNCTION__;
98 return d->direction;97 return d->direction;
99}98}
10099
101int cucd::Transfer::State()100int cucd::Transfer::State()
102{101{
103 qDebug() << __PRETTY_FUNCTION__;102 TRACE() << __PRETTY_FUNCTION__;
104 return d->state;103 return d->state;
105}104}
106105
107void cucd::Transfer::Abort()106void cucd::Transfer::Abort()
108{107{
109 qDebug() << __PRETTY_FUNCTION__;108 TRACE() << __PRETTY_FUNCTION__;
110109
111 if (d->state == cuc::Transfer::aborted)110 if (d->state == cuc::Transfer::aborted)
112 return;111 return;
@@ -119,7 +118,7 @@
119118
120void cucd::Transfer::Start()119void cucd::Transfer::Start()
121{120{
122 qDebug() << __PRETTY_FUNCTION__;121 TRACE() << __PRETTY_FUNCTION__;
123122
124 if (d->state == cuc::Transfer::initiated)123 if (d->state == cuc::Transfer::initiated)
125 return;124 return;
@@ -130,7 +129,7 @@
130129
131void cucd::Transfer::Handled()130void cucd::Transfer::Handled()
132{131{
133 qDebug() << __PRETTY_FUNCTION__;132 TRACE() << __PRETTY_FUNCTION__;
134133
135 if (d->state == cuc::Transfer::in_progress)134 if (d->state == cuc::Transfer::in_progress)
136 return;135 return;
@@ -141,7 +140,7 @@
141140
142void cucd::Transfer::Charge(const QStringList& items)141void cucd::Transfer::Charge(const QStringList& items)
143{142{
144 qDebug() << __PRETTY_FUNCTION__;143 TRACE() << __PRETTY_FUNCTION__;
145144
146 if (d->state == cuc::Transfer::charged)145 if (d->state == cuc::Transfer::charged)
147 return;146 return;
@@ -151,7 +150,7 @@
151 ret.append(copy_to_store(i, d->store));150 ret.append(copy_to_store(i, d->store));
152151
153 Q_FOREACH(QString f, ret)152 Q_FOREACH(QString f, ret)
154 qDebug() << Q_FUNC_INFO << "Item:" << f;153 TRACE() << Q_FUNC_INFO << "Item:" << f;
155154
156 if (ret.count() <= 0)155 if (ret.count() <= 0)
157 {156 {
@@ -168,7 +167,7 @@
168167
169QStringList cucd::Transfer::Collect()168QStringList cucd::Transfer::Collect()
170{169{
171 qDebug() << __PRETTY_FUNCTION__;170 TRACE() << __PRETTY_FUNCTION__;
172171
173 if (d->state != cuc::Transfer::collected)172 if (d->state != cuc::Transfer::collected)
174 {173 {
@@ -181,7 +180,7 @@
181180
182void cucd::Transfer::Finalize()181void cucd::Transfer::Finalize()
183{182{
184 qDebug() << __PRETTY_FUNCTION__;183 TRACE() << __PRETTY_FUNCTION__;
185184
186 if (d->state == cuc::Transfer::finalized)185 if (d->state == cuc::Transfer::finalized)
187 return;186 return;
@@ -194,13 +193,13 @@
194193
195QString cucd::Transfer::Store()194QString cucd::Transfer::Store()
196{195{
197 qDebug() << __PRETTY_FUNCTION__;196 TRACE() << __PRETTY_FUNCTION__;
198 return d->store;197 return d->store;
199}198}
200199
201void cucd::Transfer::SetStore(QString uri)200void cucd::Transfer::SetStore(QString uri)
202{201{
203 qDebug() << Q_FUNC_INFO;202 TRACE() << Q_FUNC_INFO;
204203
205 if (d->store == uri)204 if (d->store == uri)
206 return;205 return;
@@ -211,13 +210,13 @@
211210
212int cucd::Transfer::SelectionType()211int cucd::Transfer::SelectionType()
213{212{
214 qDebug() << __PRETTY_FUNCTION__;213 TRACE() << __PRETTY_FUNCTION__;
215 return d->selection_type;214 return d->selection_type;
216}215}
217216
218void cucd::Transfer::SetSelectionType(int type)217void cucd::Transfer::SetSelectionType(int type)
219{218{
220 qDebug() << Q_FUNC_INFO;219 TRACE() << Q_FUNC_INFO;
221 if (d->state != cuc::Transfer::created)220 if (d->state != cuc::Transfer::created)
222 return;221 return;
223 if (d->selection_type == type)222 if (d->selection_type == type)
@@ -230,7 +229,7 @@
230/* returns the object path for the export */229/* returns the object path for the export */
231QString cucd::Transfer::export_path()230QString cucd::Transfer::export_path()
232{231{
233 qDebug() << Q_FUNC_INFO << "source:" << d->source;232 TRACE() << Q_FUNC_INFO << "source:" << d->source;
234 static const QString exporter_path_pattern{"/transfers/%1/export/%2"};233 static const QString exporter_path_pattern{"/transfers/%1/export/%2"};
235 QString source = exporter_path_pattern234 QString source = exporter_path_pattern
236 .arg(sanitize_id(d->source))235 .arg(sanitize_id(d->source))
@@ -241,7 +240,7 @@
241/* returns the object path for the import */240/* returns the object path for the import */
242QString cucd::Transfer::import_path()241QString cucd::Transfer::import_path()
243{242{
244 qDebug() << Q_FUNC_INFO << "destination:" << d->destination;243 TRACE() << Q_FUNC_INFO << "destination:" << d->destination;
245 static const QString importer_path_pattern{"/transfers/%1/import/%2"};244 static const QString importer_path_pattern{"/transfers/%1/import/%2"};
246 QString destination = importer_path_pattern245 QString destination = importer_path_pattern
247 .arg(sanitize_id(d->destination))246 .arg(sanitize_id(d->destination))
248247
=== modified file 'src/com/ubuntu/content/hub.cpp'
--- src/com/ubuntu/content/hub.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/hub.cpp 2014-03-21 00:29:34 +0000
@@ -17,6 +17,7 @@
17 */17 */
1818
19#include "common.h"19#include "common.h"
20#include "debug.h"
20#include "ContentServiceInterface.h"21#include "ContentServiceInterface.h"
21#include "ContentHandlerInterface.h"22#include "ContentHandlerInterface.h"
22#include "handleradaptor.h"23#include "handleradaptor.h"
@@ -31,6 +32,7 @@
31#include <com/ubuntu/content/type.h>32#include <com/ubuntu/content/type.h>
3233
33#include <QStandardPaths>34#include <QStandardPaths>
35#include <QProcessEnvironment>
34#include <map>36#include <map>
3537
36namespace cuc = com::ubuntu::content;38namespace cuc = com::ubuntu::content;
@@ -51,6 +53,15 @@
5153
52cuc::Hub::Hub(QObject* parent) : QObject(parent), d{new cuc::Hub::Private{this}}54cuc::Hub::Hub(QObject* parent) : QObject(parent), d{new cuc::Hub::Private{this}}
53{55{
56 /* read environment variables */
57 QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
58 if (environment.contains(QLatin1String("CONTENT_HUB_LOGGING_LEVEL"))) {
59 bool isOk;
60 int value = environment.value(
61 QLatin1String("CONTENT_HUB_LOGGING_LEVEL")).toInt(&isOk);
62 if (isOk)
63 setLoggingLevel(value);
64 }
54}65}
5566
56cuc::Hub::~Hub()67cuc::Hub::~Hub()
@@ -65,7 +76,7 @@
6576
66void cuc::Hub::register_import_export_handler(cuc::ImportExportHandler* handler)77void cuc::Hub::register_import_export_handler(cuc::ImportExportHandler* handler)
67{78{
68 qDebug() << Q_FUNC_INFO;79 TRACE() << Q_FUNC_INFO;
69 QString id = app_id();80 QString id = app_id();
7081
71 if (id.isEmpty())82 if (id.isEmpty())
@@ -116,7 +127,7 @@
116127
117cuc::Peer cuc::Hub::default_source_for_type(cuc::Type t)128cuc::Peer cuc::Hub::default_source_for_type(cuc::Type t)
118{129{
119 qDebug() << Q_FUNC_INFO;130 TRACE() << Q_FUNC_INFO;
120 auto reply = d->service->DefaultSourceForType(t.id());131 auto reply = d->service->DefaultSourceForType(t.id());
121 reply.waitForFinished();132 reply.waitForFinished();
122133
@@ -215,9 +226,9 @@
215 cuc::Transfer *transfer = cuc::Transfer::Private::make_transfer(reply.value(), this);226 cuc::Transfer *transfer = cuc::Transfer::Private::make_transfer(reply.value(), this);
216227
217 QString peerName = peer.id().split("_")[0];228 QString peerName = peer.id().split("_")[0];
218 qDebug() << Q_FUNC_INFO << "peerName: " << peerName;229 TRACE() << Q_FUNC_INFO << "peerName: " << peerName;
219 const cuc::Store *store = new cuc::Store{QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/" + peerName + "/HubIncoming/" + QString::number(transfer->id()), this};230 const cuc::Store *store = new cuc::Store{QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/" + peerName + "/HubIncoming/" + QString::number(transfer->id()), this};
220 qDebug() << Q_FUNC_INFO << "STORE:" << store->uri();231 TRACE() << Q_FUNC_INFO << "STORE:" << store->uri();
221 transfer->setStore(store);232 transfer->setStore(store);
222 transfer->start();233 transfer->start();
223 return transfer;234 return transfer;
@@ -236,9 +247,9 @@
236247
237 cuc::Transfer *transfer = cuc::Transfer::Private::make_transfer(reply.value(), this);248 cuc::Transfer *transfer = cuc::Transfer::Private::make_transfer(reply.value(), this);
238 QString peerName = peer.id().split("_")[0];249 QString peerName = peer.id().split("_")[0];
239 qDebug() << Q_FUNC_INFO << "peerName: " << peerName;250 TRACE() << Q_FUNC_INFO << "peerName: " << peerName;
240 const cuc::Store *store = new cuc::Store{QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/" + peerName + "/HubIncoming/" + QString::number(transfer->id()), this};251 const cuc::Store *store = new cuc::Store{QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/" + peerName + "/HubIncoming/" + QString::number(transfer->id()), this};
241 qDebug() << Q_FUNC_INFO << "STORE:" << store->uri();252 TRACE() << Q_FUNC_INFO << "STORE:" << store->uri();
242 transfer->setStore(store);253 transfer->setStore(store);
243 transfer->start();254 transfer->start();
244 return transfer;255 return transfer;
245256
=== modified file 'src/com/ubuntu/content/peer.cpp'
--- src/com/ubuntu/content/peer.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/peer.cpp 2014-03-21 00:29:34 +0000
@@ -16,10 +16,10 @@
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */17 */
1818
19
20#include <gio/gdesktopappinfo.h>19#include <gio/gdesktopappinfo.h>
21#include <com/ubuntu/content/peer.h>20#include <com/ubuntu/content/peer.h>
22#include <QMetaType>21#include <QMetaType>
22#include "debug.h"
2323
24namespace cuc = com::ubuntu::content;24namespace cuc = com::ubuntu::content;
2525
@@ -27,7 +27,7 @@
27{27{
28 Private (QString id, bool isDefaultPeer) : id(id), isDefaultPeer(isDefaultPeer)28 Private (QString id, bool isDefaultPeer) : id(id), isDefaultPeer(isDefaultPeer)
29 {29 {
30 qDebug() << Q_FUNC_INFO << id;30 TRACE() << Q_FUNC_INFO << id;
31 if (name.isEmpty())31 if (name.isEmpty())
32 {32 {
33 QString desktop_id(id + ".desktop");33 QString desktop_id(id + ".desktop");
@@ -69,7 +69,7 @@
6969
70cuc::Peer::Peer(const QString& id, bool isDefaultPeer, QObject* parent) : QObject(parent), d(new cuc::Peer::Private{id, isDefaultPeer})70cuc::Peer::Peer(const QString& id, bool isDefaultPeer, QObject* parent) : QObject(parent), d(new cuc::Peer::Private{id, isDefaultPeer})
71{71{
72 qDebug() << Q_FUNC_INFO;72 TRACE() << Q_FUNC_INFO;
73}73}
7474
75cuc::Peer::Peer(const cuc::Peer& rhs) : QObject(rhs.parent()), d(rhs.d)75cuc::Peer::Peer(const cuc::Peer& rhs) : QObject(rhs.parent()), d(rhs.d)
@@ -147,7 +147,7 @@
147147
148const QDBusArgument &operator>>(const QDBusArgument &argument, cuc::Peer &peer)148const QDBusArgument &operator>>(const QDBusArgument &argument, cuc::Peer &peer)
149{149{
150 qDebug() << Q_FUNC_INFO;150 TRACE() << Q_FUNC_INFO;
151 QString id;151 QString id;
152 QString name;152 QString name;
153 QByteArray ic;153 QByteArray ic;
154154
=== modified file 'src/com/ubuntu/content/service/CMakeLists.txt'
--- src/com/ubuntu/content/service/CMakeLists.txt 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/service/CMakeLists.txt 2014-03-21 00:29:34 +0000
@@ -32,6 +32,7 @@
3232
33 main.cpp33 main.cpp
34 registry.cpp34 registry.cpp
35 ../debug.cpp
35 ${CONTENT_SERVICE_SKELETON}36 ${CONTENT_SERVICE_SKELETON}
36)37)
3738
3839
=== modified file 'src/com/ubuntu/content/service/helper.cpp'
--- src/com/ubuntu/content/service/helper.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/service/helper.cpp 2014-03-21 00:29:34 +0000
@@ -19,6 +19,7 @@
19#include <QCoreApplication>19#include <QCoreApplication>
2020
21#include "hook.h"21#include "hook.h"
22#include "debug.h"
2223
23namespace cuc = com::ubuntu::content;24namespace cuc = com::ubuntu::content;
2425
@@ -26,7 +27,7 @@
26{27{
27 QCoreApplication app(argc, argv);28 QCoreApplication app(argc, argv);
2829
29 qDebug() << Q_FUNC_INFO;30 TRACE() << Q_FUNC_INFO;
3031
31 if (app.arguments().count() > 1)32 if (app.arguments().count() > 1)
32 {33 {
@@ -34,6 +35,16 @@
34 return 1;35 return 1;
35 }36 }
3637
38 /* read environment variables */
39 QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
40 if (environment.contains(QLatin1String("CONTENT_HUB_LOGGING_LEVEL"))) {
41 bool isOk;
42 int value = environment.value(
43 QLatin1String("CONTENT_HUB_LOGGING_LEVEL")).toInt(&isOk);
44 if (isOk)
45 setLoggingLevel(value);
46 }
47
37 new cuc::detail::Hook();48 new cuc::detail::Hook();
3849
39 app.exec();50 app.exec();
4051
=== modified file 'src/com/ubuntu/content/service/hook.cpp'
--- src/com/ubuntu/content/service/hook.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/service/hook.cpp 2014-03-21 00:29:34 +0000
@@ -22,10 +22,10 @@
22#include <QFile>22#include <QFile>
23#include <QDir>23#include <QDir>
24#include <QStandardPaths>24#include <QStandardPaths>
25#include <QDebug>
26#include <QTimer>25#include <QTimer>
27#include <com/ubuntu/content/peer.h>26#include <com/ubuntu/content/peer.h>
2827
28#include "debug.h"
29#include "hook.h"29#include "hook.h"
3030
31namespace cucd = com::ubuntu::content::detail;31namespace cucd = com::ubuntu::content::detail;
@@ -45,7 +45,7 @@
4545
46void cucd::Hook::run()46void cucd::Hook::run()
47{47{
48 qDebug() << Q_FUNC_INFO;48 TRACE() << Q_FUNC_INFO;
49 /* Looks for files in ${HOME}/.local/share/content-hub/${id} installed49 /* Looks for files in ${HOME}/.local/share/content-hub/${id} installed
50 * by click packages. These files are JSON, for example:50 * by click packages. These files are JSON, for example:
51 *51 *
@@ -76,7 +76,7 @@
7676
77 Q_FOREACH(QString p, all_peers)77 Q_FOREACH(QString p, all_peers)
78 {78 {
79 qDebug() << Q_FUNC_INFO << "Looking for" << p;79 TRACE() << Q_FUNC_INFO << "Looking for" << p;
80 QStringList pp = contentDir.entryList(QStringList("*"+ p));80 QStringList pp = contentDir.entryList(QStringList("*"+ p));
81 if (pp.isEmpty())81 if (pp.isEmpty())
82 registry->remove_peer(com::ubuntu::content::Peer{p});82 registry->remove_peer(com::ubuntu::content::Peer{p});
@@ -90,7 +90,7 @@
9090
91bool cucd::Hook::add_peer(QFileInfo result)91bool cucd::Hook::add_peer(QFileInfo result)
92{92{
93 qDebug() << Q_FUNC_INFO << "Hook:" << result.filePath();93 TRACE() << Q_FUNC_INFO << "Hook:" << result.filePath();
9494
95 QStringList knownTypes;95 QStringList knownTypes;
96 knownTypes << "pictures" << "music" << "contacts" << "documents";96 knownTypes << "pictures" << "music" << "contacts" << "documents";
@@ -117,7 +117,7 @@
117 if (knownTypes.contains(k))117 if (knownTypes.contains(k))
118 {118 {
119 if (registry->install_source_for_type(cuc::Type{k}, peer))119 if (registry->install_source_for_type(cuc::Type{k}, peer))
120 qDebug() << "Installed source:" << peer.id() << "for type:" << k;120 TRACE() << "Installed source:" << peer.id() << "for type:" << k;
121 }121 }
122 else122 else
123 qWarning() << "Failed to install" << peer.id() << "unknown type:" << k;123 qWarning() << "Failed to install" << peer.id() << "unknown type:" << k;
@@ -129,7 +129,7 @@
129 if (knownTypes.contains(k))129 if (knownTypes.contains(k))
130 {130 {
131 if (registry->install_destination_for_type(cuc::Type{k}, peer))131 if (registry->install_destination_for_type(cuc::Type{k}, peer))
132 qDebug() << "Installed destination:" << peer.id() << "for type:" << k;132 TRACE() << "Installed destination:" << peer.id() << "for type:" << k;
133 }133 }
134 else134 else
135 qWarning() << "Failed to install" << peer.id() << "unknown type:" << k;135 qWarning() << "Failed to install" << peer.id() << "unknown type:" << k;
@@ -141,7 +141,7 @@
141 if (knownTypes.contains(k))141 if (knownTypes.contains(k))
142 {142 {
143 if (registry->install_share_for_type(cuc::Type{k}, peer))143 if (registry->install_share_for_type(cuc::Type{k}, peer))
144 qDebug() << "Installed share:" << peer.id() << "for type:" << k;144 TRACE() << "Installed share:" << peer.id() << "for type:" << k;
145 }145 }
146 else146 else
147 qWarning() << "Failed to install" << peer.id() << "unknown type:" << k;147 qWarning() << "Failed to install" << peer.id() << "unknown type:" << k;
148148
=== modified file 'src/com/ubuntu/content/service/main.cpp'
--- src/com/ubuntu/content/service/main.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/service/main.cpp 2014-03-21 00:29:34 +0000
@@ -17,10 +17,11 @@
17 */17 */
1818
19#include <QCoreApplication>19#include <QCoreApplication>
20#include <QDebug>20#include <QProcessEnvironment>
21#include <csignal>21#include <csignal>
2222
23#include "detail/app_manager.h"23#include "detail/app_manager.h"
24#include "debug.h"
24#include "common.h"25#include "common.h"
25#include "registry.h"26#include "registry.h"
26#include "detail/service.h"27#include "detail/service.h"
@@ -44,13 +45,13 @@
44 });45 });
4546
46 foreach (QString r, result) {47 foreach (QString r, result) {
47 qDebug() << "PEER: " << r;48 TRACE() << "PEER: " << r;
48 }49 }
49 }50 }
5051
51 void shutdown(int sig)52 void shutdown(int sig)
52 {53 {
53 qDebug() << Q_FUNC_INFO << sig;54 TRACE() << Q_FUNC_INFO << sig;
54 QCoreApplication::instance()->quit();55 QCoreApplication::instance()->quit();
55 }56 }
56}57}
@@ -60,6 +61,16 @@
60 int ret = 0;61 int ret = 0;
61 QCoreApplication *app = new QCoreApplication(argc, argv);62 QCoreApplication *app = new QCoreApplication(argc, argv);
6263
64 /* read environment variables */
65 QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
66 if (environment.contains(QLatin1String("CONTENT_HUB_LOGGING_LEVEL"))) {
67 bool isOk;
68 int value = environment.value(
69 QLatin1String("CONTENT_HUB_LOGGING_LEVEL")).toInt(&isOk);
70 if (isOk)
71 setLoggingLevel(value);
72 }
73
63 auto connection = QDBusConnection::sessionBus();74 auto connection = QDBusConnection::sessionBus();
6475
65 auto registry = QSharedPointer<cucd::PeerRegistry>(new Registry());76 auto registry = QSharedPointer<cucd::PeerRegistry>(new Registry());
@@ -96,7 +107,7 @@
96 ret = app->exec();107 ret = app->exec();
97 }108 }
98109
99 qDebug() << "Server exiting, cleaning up";110 TRACE() << "Server exiting, cleaning up";
100 delete server;111 delete server;
101 return ret;112 return ret;
102}113}
103114
=== modified file 'src/com/ubuntu/content/service/registry.cpp'
--- src/com/ubuntu/content/service/registry.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/service/registry.cpp 2014-03-21 00:29:34 +0000
@@ -16,6 +16,7 @@
16 * Authored by: Ken VanDine <ken.vandine@canonical.com>16 * Authored by: Ken VanDine <ken.vandine@canonical.com>
17 */17 */
1818
19#include "debug.h"
19#include "registry.h"20#include "registry.h"
20#include "utils.cpp"21#include "utils.cpp"
21#include <upstart-app-launch.h>22#include <upstart-app-launch.h>
@@ -54,7 +55,7 @@
5455
55cuc::Peer Registry::default_source_for_type(cuc::Type type)56cuc::Peer Registry::default_source_for_type(cuc::Type type)
56{57{
57 qDebug() << Q_FUNC_INFO << type.id();58 TRACE() << Q_FUNC_INFO << type.id();
58 if (m_defaultSources->keys().contains(type.id()))59 if (m_defaultSources->keys().contains(type.id()))
59 {60 {
60 QStringList as(m_defaultSources->get(type.id()).toStringList());61 QStringList as(m_defaultSources->get(type.id()).toStringList());
@@ -72,32 +73,32 @@
7273
73void Registry::enumerate_known_peers(const std::function<void(const cuc::Peer&)>&for_each)74void Registry::enumerate_known_peers(const std::function<void(const cuc::Peer&)>&for_each)
74{75{
75 qDebug() << Q_FUNC_INFO;76 TRACE() << Q_FUNC_INFO;
7677
77 Q_FOREACH (QString type_id, m_sources->keys())78 Q_FOREACH (QString type_id, m_sources->keys())
78 {79 {
79 qDebug() << Q_FUNC_INFO << type_id;80 TRACE() << Q_FUNC_INFO << type_id;
80 Q_FOREACH (QString k, m_sources->get(type_id).toStringList())81 Q_FOREACH (QString k, m_sources->get(type_id).toStringList())
81 {82 {
82 qDebug() << Q_FUNC_INFO << k;83 TRACE() << Q_FUNC_INFO << k;
83 for_each(cuc::Peer{k});84 for_each(cuc::Peer{k});
84 }85 }
85 }86 }
86 Q_FOREACH (QString type_id, m_dests->keys())87 Q_FOREACH (QString type_id, m_dests->keys())
87 {88 {
88 qDebug() << Q_FUNC_INFO << type_id;89 TRACE() << Q_FUNC_INFO << type_id;
89 Q_FOREACH (QString k, m_dests->get(type_id).toStringList())90 Q_FOREACH (QString k, m_dests->get(type_id).toStringList())
90 {91 {
91 qDebug() << Q_FUNC_INFO << k;92 TRACE() << Q_FUNC_INFO << k;
92 for_each(cuc::Peer{k});93 for_each(cuc::Peer{k});
93 }94 }
94 }95 }
95 Q_FOREACH (QString type_id, m_shares->keys())96 Q_FOREACH (QString type_id, m_shares->keys())
96 {97 {
97 qDebug() << Q_FUNC_INFO << type_id;98 TRACE() << Q_FUNC_INFO << type_id;
98 Q_FOREACH (QString k, m_shares->get(type_id).toStringList())99 Q_FOREACH (QString k, m_shares->get(type_id).toStringList())
99 {100 {
100 qDebug() << Q_FUNC_INFO << k;101 TRACE() << Q_FUNC_INFO << k;
101 for_each(cuc::Peer{k});102 for_each(cuc::Peer{k});
102 }103 }
103 }104 }
@@ -105,14 +106,14 @@
105106
106void Registry::enumerate_known_sources_for_type(cuc::Type type, const std::function<void(const cuc::Peer&)>&for_each)107void Registry::enumerate_known_sources_for_type(cuc::Type type, const std::function<void(const cuc::Peer&)>&for_each)
107{108{
108 qDebug() << Q_FUNC_INFO << type.id();109 TRACE() << Q_FUNC_INFO << type.id();
109110
110 if (type == cuc::Type::unknown())111 if (type == cuc::Type::unknown())
111 return;112 return;
112113
113 Q_FOREACH (QString k, m_sources->get(type.id()).toStringList())114 Q_FOREACH (QString k, m_sources->get(type.id()).toStringList())
114 {115 {
115 qDebug() << Q_FUNC_INFO << k;116 TRACE() << Q_FUNC_INFO << k;
116 bool defaultPeer = false;117 bool defaultPeer = false;
117 QStringList as(m_defaultSources->get(type.id()).toStringList());118 QStringList as(m_defaultSources->get(type.id()).toStringList());
118 if (!as.isEmpty())119 if (!as.isEmpty())
@@ -128,31 +129,31 @@
128129
129void Registry::enumerate_known_destinations_for_type(cuc::Type type, const std::function<void(const cuc::Peer&)>&for_each)130void Registry::enumerate_known_destinations_for_type(cuc::Type type, const std::function<void(const cuc::Peer&)>&for_each)
130{131{
131 qDebug() << Q_FUNC_INFO << type.id();132 TRACE() << Q_FUNC_INFO << type.id();
132 Q_FOREACH (QString k, m_dests->get(type.id()).toStringList())133 Q_FOREACH (QString k, m_dests->get(type.id()).toStringList())
133 {134 {
134 qDebug() << Q_FUNC_INFO << k;135 TRACE() << Q_FUNC_INFO << k;
135 for_each(cuc::Peer{k});136 for_each(cuc::Peer{k});
136 }137 }
137}138}
138139
139void Registry::enumerate_known_shares_for_type(cuc::Type type, const std::function<void(const cuc::Peer&)>&for_each)140void Registry::enumerate_known_shares_for_type(cuc::Type type, const std::function<void(const cuc::Peer&)>&for_each)
140{141{
141 qDebug() << Q_FUNC_INFO << type.id();142 TRACE() << Q_FUNC_INFO << type.id();
142143
143 Q_FOREACH (QString k, m_shares->get(type.id()).toStringList())144 Q_FOREACH (QString k, m_shares->get(type.id()).toStringList())
144 {145 {
145 qDebug() << Q_FUNC_INFO << k;146 TRACE() << Q_FUNC_INFO << k;
146 for_each(cuc::Peer{k});147 for_each(cuc::Peer{k});
147 }148 }
148}149}
149150
150bool Registry::install_default_source_for_type(cuc::Type type, cuc::Peer peer)151bool Registry::install_default_source_for_type(cuc::Type type, cuc::Peer peer)
151{152{
152 qDebug() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id();153 TRACE() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id();
153 if (m_defaultSources->keys().contains(type.id()))154 if (m_defaultSources->keys().contains(type.id()))
154 {155 {
155 qDebug() << Q_FUNC_INFO << "Default peer for" << type.id() << "already installed.";156 TRACE() << Q_FUNC_INFO << "Default peer for" << type.id() << "already installed.";
156 return false;157 return false;
157 }158 }
158159
@@ -162,7 +163,7 @@
162163
163bool Registry::install_source_for_type(cuc::Type type, cuc::Peer peer)164bool Registry::install_source_for_type(cuc::Type type, cuc::Peer peer)
164{165{
165 qDebug() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id();166 TRACE() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id();
166 QStringList l = m_sources->get(type.id()).toStringList();167 QStringList l = m_sources->get(type.id()).toStringList();
167 if (not l.contains(peer.id()))168 if (not l.contains(peer.id()))
168 {169 {
@@ -174,7 +175,7 @@
174175
175bool Registry::install_destination_for_type(cuc::Type type, cuc::Peer peer)176bool Registry::install_destination_for_type(cuc::Type type, cuc::Peer peer)
176{177{
177 qDebug() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id();178 TRACE() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id();
178 QStringList l = m_dests->get(type.id()).toStringList();179 QStringList l = m_dests->get(type.id()).toStringList();
179 if (not l.contains(peer.id()))180 if (not l.contains(peer.id()))
180 {181 {
@@ -186,7 +187,7 @@
186187
187bool Registry::install_share_for_type(cuc::Type type, cuc::Peer peer)188bool Registry::install_share_for_type(cuc::Type type, cuc::Peer peer)
188{189{
189 qDebug() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id();190 TRACE() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id();
190 QStringList l = m_shares->get(type.id()).toStringList();191 QStringList l = m_shares->get(type.id()).toStringList();
191 if (not l.contains(peer.id()))192 if (not l.contains(peer.id()))
192 {193 {
@@ -198,7 +199,7 @@
198199
199bool Registry::remove_peer(cuc::Peer peer)200bool Registry::remove_peer(cuc::Peer peer)
200{201{
201 qDebug() << Q_FUNC_INFO << "peer:" << peer.id();202 TRACE() << Q_FUNC_INFO << "peer:" << peer.id();
202 bool ret = false;203 bool ret = false;
203 Q_FOREACH (QString type_id, m_sources->keys())204 Q_FOREACH (QString type_id, m_sources->keys())
204 {205 {
205206
=== modified file 'src/com/ubuntu/content/service/registry.h'
--- src/com/ubuntu/content/service/registry.h 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/service/registry.h 2014-03-21 00:29:34 +0000
@@ -20,7 +20,6 @@
20#define REGISTRY_H20#define REGISTRY_H
2121
22#include <QGSettings/QGSettings>22#include <QGSettings/QGSettings>
23#include <QDebug>
24#include <com/ubuntu/content/peer.h>23#include <com/ubuntu/content/peer.h>
25#include <com/ubuntu/content/type.h>24#include <com/ubuntu/content/type.h>
26#include "detail/peer_registry.h"25#include "detail/peer_registry.h"
2726
=== modified file 'src/com/ubuntu/content/transfer.cpp'
--- src/com/ubuntu/content/transfer.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/transfer.cpp 2014-03-21 00:29:34 +0000
@@ -43,7 +43,7 @@
4343
44cuc::Transfer::~Transfer()44cuc::Transfer::~Transfer()
45{45{
46 qDebug() << Q_FUNC_INFO;46 TRACE() << Q_FUNC_INFO;
47 purge_store_cache(d->store().uri());47 purge_store_cache(d->store().uri());
48}48}
4949
5050
=== modified file 'src/com/ubuntu/content/utils.cpp'
--- src/com/ubuntu/content/utils.cpp 2014-03-21 00:29:33 +0000
+++ src/com/ubuntu/content/utils.cpp 2014-03-21 00:29:34 +0000
@@ -27,6 +27,7 @@
27#include <nih-dbus/dbus_util.h>27#include <nih-dbus/dbus_util.h>
2828
29#include "common.h"29#include "common.h"
30#include "debug.h"
30#include "com/ubuntu/content/type.h"31#include "com/ubuntu/content/type.h"
3132
32namespace cuc = com::ubuntu::content;33namespace cuc = com::ubuntu::content;
@@ -46,7 +47,7 @@
46/* sanitize the dbus names */47/* sanitize the dbus names */
47QString sanitize_id(const QString& appId)48QString sanitize_id(const QString& appId)
48{49{
49 qDebug() << Q_FUNC_INFO;50 TRACE() << Q_FUNC_INFO;
50 return QString(nih_dbus_path(NULL,51 return QString(nih_dbus_path(NULL,
51 "",52 "",
52 appId.toLocal8Bit().data(),53 appId.toLocal8Bit().data(),
@@ -80,7 +81,7 @@
8081
81QString aa_profile(QString uniqueConnectionId)82QString aa_profile(QString uniqueConnectionId)
82{83{
83 qDebug() << Q_FUNC_INFO << uniqueConnectionId;84 TRACE() << Q_FUNC_INFO << uniqueConnectionId;
84 QDBusMessage msg =85 QDBusMessage msg =
85 QDBusMessage::createMethodCall("org.freedesktop.DBus",86 QDBusMessage::createMethodCall("org.freedesktop.DBus",
86 "/org/freedesktop/DBus",87 "/org/freedesktop/DBus",
@@ -94,7 +95,7 @@
94 QDBusConnection::sessionBus().call(msg, QDBus::Block);95 QDBusConnection::sessionBus().call(msg, QDBus::Block);
95 if (reply.type() == QDBusMessage::ReplyMessage) {96 if (reply.type() == QDBusMessage::ReplyMessage) {
96 aaProfile = reply.arguments().value(0, QString()).toString();97 aaProfile = reply.arguments().value(0, QString()).toString();
97 qDebug() << "AppArmor Profile:" << aaProfile;98 TRACE() << "AppArmor Profile:" << aaProfile;
98 } else {99 } else {
99 qWarning() << "Error getting app ID:" << reply.errorName() <<100 qWarning() << "Error getting app ID:" << reply.errorName() <<
100 reply.errorMessage();101 reply.errorMessage();
@@ -109,7 +110,7 @@
109110
110QString copy_to_store(const QString& src, const QString& store)111QString copy_to_store(const QString& src, const QString& store)
111{112{
112 qDebug() << Q_FUNC_INFO;113 TRACE() << Q_FUNC_INFO;
113 QUrl srcUrl(src);114 QUrl srcUrl(src);
114 if (not srcUrl.isLocalFile())115 if (not srcUrl.isLocalFile())
115 return srcUrl.url();116 return srcUrl.url();
@@ -120,7 +121,7 @@
120 if (not st.exists())121 if (not st.exists())
121 st.mkpath(st.absolutePath());122 st.mkpath(st.absolutePath());
122 QString destFilePath = store + QDir::separator() + fi.fileName();123 QString destFilePath = store + QDir::separator() + fi.fileName();
123 qDebug() << Q_FUNC_INFO << destFilePath;124 TRACE() << Q_FUNC_INFO << destFilePath;
124 bool result = QFile::copy(fi.filePath(), destFilePath);125 bool result = QFile::copy(fi.filePath(), destFilePath);
125 if (not result)126 if (not result)
126 {127 {
@@ -132,7 +133,7 @@
132133
133bool is_persistent(QString store)134bool is_persistent(QString store)
134{135{
135 qDebug() << Q_FUNC_INFO << store;136 TRACE() << Q_FUNC_INFO << store;
136 QRegExp rx("*.cache/*/HubIncoming/*");137 QRegExp rx("*.cache/*/HubIncoming/*");
137 rx.setPatternSyntax(QRegExp::Wildcard);138 rx.setPatternSyntax(QRegExp::Wildcard);
138 rx.setCaseSensitivity(Qt::CaseSensitive);139 rx.setCaseSensitivity(Qt::CaseSensitive);
@@ -141,18 +142,18 @@
141142
142bool purge_store_cache(QString store)143bool purge_store_cache(QString store)
143{144{
144 qDebug() << Q_FUNC_INFO << "Store:" << store;145 TRACE() << Q_FUNC_INFO << "Store:" << store;
145146
146 if (is_persistent(store))147 if (is_persistent(store))
147 {148 {
148 qDebug() << Q_FUNC_INFO << store << "is persistent";149 TRACE() << Q_FUNC_INFO << store << "is persistent";
149 return false;150 return false;
150 }151 }
151152
152 QDir st(store);153 QDir st(store);
153 if (st.exists())154 if (st.exists())
154 {155 {
155 qDebug() << Q_FUNC_INFO << store << "isn't persistent, purging";156 TRACE() << Q_FUNC_INFO << store << "isn't persistent, purging";
156 return st.removeRecursively();157 return st.removeRecursively();
157 }158 }
158159

Subscribers

People subscribed via source and target branches