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
1=== modified file 'qml/Post.qml'
2--- qml/Post.qml 2014-02-17 17:42:00 +0000
3+++ qml/Post.qml 2014-02-18 19:29:30 +0000
4@@ -94,15 +94,21 @@
5 var serviceName = accountService.service.displayName;
6 var features = friends.featuresForProtocol(serviceName.toLowerCase().replace(".",""));
7 if (features.indexOf("send") > -1) {
8+ var sendEnabled = true
9+
10+ // Take value from settings if exists
11+ if(sendEnabledSetting.value[i] != null)
12+ sendEnabled = sendEnabledSetting.value[i]
13+
14 console.log (serviceName + " Supports send");
15 /* FIXME: we should get the iconName and serviceName from the accountService
16 but I am not sure we can access that from JS */
17 accountsModel.append({
18 "displayName": displayName,
19- "id": accountId,
20+ "accountId": accountId,
21 "provider": serviceName,
22 "accountIcon": iconName,
23- "sendEnabled": true
24+ "sendEnabled": sendEnabled
25 });
26 }
27 }
28@@ -153,8 +159,15 @@
29 control: CheckBox {
30 id: sw
31 checked: sendEnabled
32+
33 onCheckedChanged: {
34- accountsModel.setProperty(index, "sendEnabled", sw.checked);
35+ if(sendEnabledSetting.ready) {
36+ var newval = sendEnabledSetting.value
37+ newval[index] = sw.checked
38+ sendEnabledSetting.value = newval
39+ }
40+
41+ accountsModel.setProperty(index, "sendEnabled", sw.checked)
42 }
43 }
44
45@@ -163,6 +176,21 @@
46 }
47 }
48
49+ SettingsProperty {
50+ id: sendEnabledSetting
51+ database: settingsStorage
52+
53+ name: "accounts-send-enabled"
54+
55+ defaultValue: {
56+ var result = []
57+
58+ for(var i = 0; i < accounts.count; ++i)
59+ result[i] = true
60+
61+ return result
62+ }
63+ }
64 Component {
65 id: errorPopover
66 Popover {
67
68=== modified file 'qml/SettingsProperty.qml'
69--- qml/SettingsProperty.qml 2014-01-06 15:19:11 +0000
70+++ qml/SettingsProperty.qml 2014-02-18 19:29:30 +0000
71@@ -11,8 +11,14 @@
72 //Must be variant so we can use any datatype
73 property variant value: false
74
75+ //Is the component ready to be used?
76+ property bool ready: false
77+
78 // A little hack so value can be used like a normal property
79 Component.onCompleted : {
80+ if(database == null)
81+ console.error("Settings Property '" + name + "' doesn't have a valid database")
82+
83 if(propertyStorage.contents !== undefined)
84 value = propertyStorage.contents.value
85 else {
86@@ -20,9 +26,16 @@
87 // This will create the database (with onValueChanged
88 value = defaultValue
89 }
90+
91+ ready = true
92+ propertyLoaded()
93 }
94
95+ signal propertyLoaded
96+
97 onValueChanged: {
98+ console.log("Settings Property '" + name + "' changed")
99+
100 // There is a "bug" that forces us to set it like this
101 propertyStorage.contents = { "value": value }
102 }

Subscribers

People subscribed via source and target branches

to all changes: