Merge lp:~renatofilho/qtorganizer5-eds/fix-default-source into lp:~ubuntu-sdk-team/qtorganizer5-eds/trunk

Proposed by Renato Araujo Oliveira Filho
Status: Superseded
Proposed branch: lp:~renatofilho/qtorganizer5-eds/fix-default-source
Merge into: lp:~ubuntu-sdk-team/qtorganizer5-eds/trunk
Diff against target: 150 lines (+39/-17)
4 files modified
qorganizer/qorganizer-eds-collection-engineid.cpp (+16/-5)
qorganizer/qorganizer-eds-engine.cpp (+20/-10)
qorganizer/qorganizer-eds-fetchrequestdata.cpp (+1/-0)
tests/unittest/CMakeLists.txt (+2/-2)
To merge this branch: bzr merge lp:~renatofilho/qtorganizer5-eds/fix-default-source
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu SDK team Pending
Review via email: mp+187434@code.launchpad.net

This proposal has been superseded by a proposal from 2013-10-05.

Commit message

Fixed default source loading.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
14. By Renato Araujo Oliveira Filho

Fixed memory leak.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
15. By Renato Araujo Oliveira Filho

Use calendar as default collection/source.

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

Unmerged revisions

15. By Renato Araujo Oliveira Filho

Use calendar as default collection/source.

14. By Renato Araujo Oliveira Filho

Fixed memory leak.

13. By Renato Araujo Oliveira Filho

Fixed default source loading.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qorganizer/qorganizer-eds-collection-engineid.cpp'
2--- qorganizer/qorganizer-eds-collection-engineid.cpp 2013-09-03 03:57:58 +0000
3+++ qorganizer/qorganizer-eds-collection-engineid.cpp 2013-09-30 14:15:10 +0000
4@@ -22,7 +22,8 @@
5
6 QOrganizerEDSCollectionEngineId::QOrganizerEDSCollectionEngineId(ESource *source,
7 const QString &managerUri)
8- : m_managerUri(managerUri), m_esource(source)
9+ : m_managerUri(managerUri),
10+ m_esource(source)
11 {
12 g_object_ref(m_esource);
13 m_collectionId = QString::fromUtf8(e_source_get_uid(m_esource));
14@@ -39,17 +40,24 @@
15 }
16
17 QOrganizerEDSCollectionEngineId::QOrganizerEDSCollectionEngineId()
18- : QOrganizerCollectionEngineId()
19+ : QOrganizerCollectionEngineId(),
20+ m_esource(0)
21 {
22 }
23
24 QOrganizerEDSCollectionEngineId::QOrganizerEDSCollectionEngineId(const QOrganizerEDSCollectionEngineId& other)
25- : QOrganizerCollectionEngineId(), m_collectionId(other.m_collectionId)
26+ : QOrganizerCollectionEngineId(),
27+ m_collectionId(other.m_collectionId),
28+ m_esource(other.m_esource)
29 {
30+ if (m_esource) {
31+ g_object_ref(m_esource);
32+ }
33 }
34
35 QOrganizerEDSCollectionEngineId::QOrganizerEDSCollectionEngineId(const QString& idString)
36- : QOrganizerCollectionEngineId()
37+ : QOrganizerCollectionEngineId(),
38+ m_esource(0)
39 {
40 int colonIndex = idString.indexOf(QStringLiteral(":"));
41 m_managerUri = idString.mid(0, colonIndex).toUInt();
42@@ -58,7 +66,10 @@
43
44 QOrganizerEDSCollectionEngineId::~QOrganizerEDSCollectionEngineId()
45 {
46- g_object_unref(m_esource);
47+ if (m_esource) {
48+ g_object_unref(m_esource);
49+ m_esource = 0;
50+ }
51 }
52
53 bool QOrganizerEDSCollectionEngineId::isEqualTo(const QOrganizerCollectionEngineId* other) const
54
55=== modified file 'qorganizer/qorganizer-eds-engine.cpp'
56--- qorganizer/qorganizer-eds-engine.cpp 2013-09-07 23:37:27 +0000
57+++ qorganizer/qorganizer-eds-engine.cpp 2013-09-30 14:15:10 +0000
58@@ -279,6 +279,7 @@
59
60 Q_ASSERT(!collectionId.isNull());
61 collectionEngineId = m_collectionsMap[collectionId.toString()];
62+ qDebug() << "Save item on collection:" << collectionId.toString();
63
64 SaveRequestData *data = new SaveRequestData(this, req, collectionId);
65 e_cal_client_connect(collectionEngineId->m_esource,
66@@ -875,14 +876,19 @@
67 return;
68 }
69
70- ESource *defaultSource = e_source_registry_ref_default_address_book(registry);
71+ // We use calendar as default source, if you are trying to use other source type
72+ // you need to set the item source id manually
73+ ESource *defaultCalendarSource = e_source_registry_ref_default_calendar(registry);
74+
75 GList *sources = e_source_registry_list_sources(registry, 0);
76 for(int i=0, iMax=g_list_length(sources); i < iMax; i++) {
77 ESource *source = E_SOURCE(g_list_nth_data(sources, i));
78
79- if (e_source_has_extension(source, E_SOURCE_EXTENSION_CALENDAR) ||
80- e_source_has_extension(source, E_SOURCE_EXTENSION_TASK_LIST) ||
81- e_source_has_extension(source, E_SOURCE_EXTENSION_MEMO_LIST))
82+ bool isCalendar = e_source_has_extension(source, E_SOURCE_EXTENSION_CALENDAR);
83+ bool isTaskList = e_source_has_extension(source, E_SOURCE_EXTENSION_TASK_LIST);
84+ bool isMemoList = e_source_has_extension(source, E_SOURCE_EXTENSION_MEMO_LIST);
85+
86+ if (e_source_get_enabled(source) && (isCalendar || isTaskList || isMemoList))
87 {
88 //TODO get metadata (color, etc..)
89 QOrganizerEDSCollectionEngineId *edsId = 0;
90@@ -890,18 +896,23 @@
91
92 registerCollection(collection, edsId);
93
94- if (e_source_compare_by_display_name(source, defaultSource) == 0) {
95- qDebug() << "Default Source" << e_source_get_display_name(source);
96+ if (e_source_equal(defaultCalendarSource, source)) {
97 m_defaultCollection = collection;
98+ qDebug() << "Default Source"
99+ << e_source_get_display_name(source)
100+ << e_source_get_uid(source);
101 }
102 }
103 }
104
105 g_list_free_full (sources, g_object_unref);
106+
107+ if (defaultCalendarSource) {
108+ g_object_unref(defaultCalendarSource);
109+ }
110+
111 g_object_unref(registry);
112- if (defaultSource) {
113- g_object_unref(defaultSource);
114- }
115+
116 qDebug() << m_collections.count() << "Collection loaded";
117 }
118
119@@ -1380,7 +1391,6 @@
120 QOrganizerItem *item;
121 ECalComponent *comp = E_CAL_COMPONENT(g_slist_nth_data(events, i));
122
123-
124 //type
125 ECalComponentVType vType = e_cal_component_get_vtype(comp);
126 switch(vType) {
127
128=== modified file 'qorganizer/qorganizer-eds-fetchrequestdata.cpp'
129--- qorganizer/qorganizer-eds-fetchrequestdata.cpp 2013-09-07 23:37:27 +0000
130+++ qorganizer/qorganizer-eds-fetchrequestdata.cpp 2013-09-30 14:15:10 +0000
131@@ -36,6 +36,7 @@
132 QOrganizerEDSCollectionEngineId* FetchRequestData::nextCollection()
133 {
134 m_current = 0;
135+ setClient(0);
136 if (m_collections.size()) {
137 m_current = m_collections.takeFirst();
138 return m_current;
139
140=== modified file 'tests/unittest/CMakeLists.txt'
141--- tests/unittest/CMakeLists.txt 2013-09-09 20:58:02 +0000
142+++ tests/unittest/CMakeLists.txt 2013-09-30 14:15:10 +0000
143@@ -42,5 +42,5 @@
144 declare_test(parseecal-test)
145 # Jenkins will not be able to run these tests because they need EDS running
146 # FIXME: Mock EDS to run the tests bellow
147-#declare_test(collections-test)
148-#declare_test(event-test)
149+# declare_test(collections-test)
150+# declare_test(event-test)

Subscribers

People subscribed via source and target branches