Merge lp:~kai-mast/friends-app/lp1168926 into lp:friends-app

Proposed by Kai Mast
Status: Rejected
Rejected by: Robert Bruce Park
Proposed branch: lp:~kai-mast/friends-app/lp1168926
Merge into: lp:friends-app
Diff against target: 102 lines (+44/-3)
2 files modified
qml/Post.qml (+31/-3)
qml/SettingsProperty.qml (+13/-0)
To merge this branch: bzr merge lp:~kai-mast/friends-app/lp1168926
Reviewer Review Type Date Requested Status
Robert Bruce Park Needs Fixing
Review via email: mp+207019@code.launchpad.net

Commit message

Remember which services the user wants to post to.

Description of the change

OMG that was so much more complicat ed than I thought. Why do javascript arrays behave so weird?

But should work now :)

To post a comment you must log in.
Revision history for this message
Robert Bruce Park (robru) wrote :

I'm afraid this isn't working for me. if I disable facebook, then close and relaunch, it remembers to disable facebook. but I can never disable twitter. if I disable everything, then twitter is selected on next startup, and if I choose facebook but disable twitter, then theyre both enabled on next launch.

review: Needs Fixing
Revision history for this message
Kai Mast (kai-mast) wrote :

So strange. I just tested this again and it works completely fine for me.

Could you maybe remove your friends-app settings (.local/share/friends-app/friends-app-settings.u1db) and try again?

Revision history for this message
Robert Bruce Park (robru) wrote :

Hey Kai, sorry for the long delay in testing this. Release was totally hectic, but I've got some more time now ;-)

Unfortunately after deleting that file I still get the same issue. The only way I can get it to remember the state for my twitter account is to disable my facebook account entirely.

How many accounts do you have that you're testing with? When I have two accounts, it just does not remember the state for Twitter, which is second in the list.

Revision history for this message
Kai Mast (kai-mast) wrote :

Mh I also have two accounts. This is really strange.. maybe I should test in a virtual machine or something...

Unmerged revisions

144. By Kai Mast

FINALLY WORKS

143. By Kai Mast

First attempt

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qml/Post.qml'
--- qml/Post.qml 2014-02-17 17:42:00 +0000
+++ qml/Post.qml 2014-02-18 19:29:30 +0000
@@ -94,15 +94,21 @@
94 var serviceName = accountService.service.displayName;94 var serviceName = accountService.service.displayName;
95 var features = friends.featuresForProtocol(serviceName.toLowerCase().replace(".",""));95 var features = friends.featuresForProtocol(serviceName.toLowerCase().replace(".",""));
96 if (features.indexOf("send") > -1) {96 if (features.indexOf("send") > -1) {
97 var sendEnabled = true
98
99 // Take value from settings if exists
100 if(sendEnabledSetting.value[i] != null)
101 sendEnabled = sendEnabledSetting.value[i]
102
97 console.log (serviceName + " Supports send");103 console.log (serviceName + " Supports send");
98 /* FIXME: we should get the iconName and serviceName from the accountService104 /* FIXME: we should get the iconName and serviceName from the accountService
99 but I am not sure we can access that from JS */105 but I am not sure we can access that from JS */
100 accountsModel.append({106 accountsModel.append({
101 "displayName": displayName,107 "displayName": displayName,
102 "id": accountId,108 "accountId": accountId,
103 "provider": serviceName,109 "provider": serviceName,
104 "accountIcon": iconName,110 "accountIcon": iconName,
105 "sendEnabled": true111 "sendEnabled": sendEnabled
106 });112 });
107 }113 }
108 }114 }
@@ -153,8 +159,15 @@
153 control: CheckBox {159 control: CheckBox {
154 id: sw160 id: sw
155 checked: sendEnabled161 checked: sendEnabled
162
156 onCheckedChanged: {163 onCheckedChanged: {
157 accountsModel.setProperty(index, "sendEnabled", sw.checked);164 if(sendEnabledSetting.ready) {
165 var newval = sendEnabledSetting.value
166 newval[index] = sw.checked
167 sendEnabledSetting.value = newval
168 }
169
170 accountsModel.setProperty(index, "sendEnabled", sw.checked)
158 }171 }
159 }172 }
160173
@@ -163,6 +176,21 @@
163 }176 }
164 }177 }
165178
179 SettingsProperty {
180 id: sendEnabledSetting
181 database: settingsStorage
182
183 name: "accounts-send-enabled"
184
185 defaultValue: {
186 var result = []
187
188 for(var i = 0; i < accounts.count; ++i)
189 result[i] = true
190
191 return result
192 }
193 }
166 Component {194 Component {
167 id: errorPopover195 id: errorPopover
168 Popover {196 Popover {
169197
=== modified file 'qml/SettingsProperty.qml'
--- qml/SettingsProperty.qml 2014-01-06 15:19:11 +0000
+++ qml/SettingsProperty.qml 2014-02-18 19:29:30 +0000
@@ -11,8 +11,14 @@
11 //Must be variant so we can use any datatype11 //Must be variant so we can use any datatype
12 property variant value: false12 property variant value: false
1313
14 //Is the component ready to be used?
15 property bool ready: false
16
14 // A little hack so value can be used like a normal property17 // A little hack so value can be used like a normal property
15 Component.onCompleted : {18 Component.onCompleted : {
19 if(database == null)
20 console.error("Settings Property '" + name + "' doesn't have a valid database")
21
16 if(propertyStorage.contents !== undefined)22 if(propertyStorage.contents !== undefined)
17 value = propertyStorage.contents.value23 value = propertyStorage.contents.value
18 else {24 else {
@@ -20,9 +26,16 @@
20 // This will create the database (with onValueChanged26 // This will create the database (with onValueChanged
21 value = defaultValue27 value = defaultValue
22 }28 }
29
30 ready = true
31 propertyLoaded()
23 }32 }
2433
34 signal propertyLoaded
35
25 onValueChanged: {36 onValueChanged: {
37 console.log("Settings Property '" + name + "' changed")
38
26 // There is a "bug" that forces us to set it like this39 // There is a "bug" that forces us to set it like this
27 propertyStorage.contents = { "value": value }40 propertyStorage.contents = { "value": value }
28 }41 }

Subscribers

People subscribed via source and target branches

to all changes: