File IvoRSS.hws changed (mode: 100755) (index 15f9feb..9ee3bec) |
... |
... |
Function p_MUIEvent(msg) |
77 |
77 |
Case "CloseRequest": |
Case "CloseRequest": |
78 |
78 |
Switch msg.ID |
Switch msg.ID |
79 |
79 |
Case "win": |
Case "win": |
80 |
|
p_SaveFeeds() |
|
|
80 |
|
p_SaveSettings() |
81 |
81 |
End |
End |
82 |
82 |
Case "metawin": |
Case "metawin": |
83 |
83 |
mui.Set("metawin", "open", False) |
mui.Set("metawin", "open", False) |
|
... |
... |
Function p_MUIEvent(msg) |
93 |
93 |
Case "menu_about_muiroyale": |
Case "menu_about_muiroyale": |
94 |
94 |
mui.DoMethod("app", "AboutMUIRoyale") |
mui.DoMethod("app", "AboutMUIRoyale") |
95 |
95 |
Case "menu_quit": |
Case "menu_quit": |
96 |
|
p_SaveFeeds() |
|
|
96 |
|
p_SaveSettings() |
97 |
97 |
End |
End |
98 |
98 |
Case "menu_muisettings": |
Case "menu_muisettings": |
99 |
99 |
mui.DoMethod("app", "OpenConfigWindow") |
mui.DoMethod("app", "OpenConfigWindow") |
|
... |
... |
Function p_MUIEvent(msg) |
111 |
111 |
Case "menu_save": |
Case "menu_save": |
112 |
112 |
FallThrough |
FallThrough |
113 |
113 |
Case "fdtm_save": |
Case "fdtm_save": |
114 |
|
p_SaveFeeds() |
|
|
114 |
|
p_SaveSettings() |
115 |
115 |
|
|
116 |
116 |
Case "menu_lurk": |
Case "menu_lurk": |
117 |
117 |
FallThrough |
FallThrough |
|
... |
... |
Function p_MUIEvent(msg) |
126 |
126 |
Case "menu_add": |
Case "menu_add": |
127 |
127 |
FallThrough |
FallThrough |
128 |
128 |
Case "fdtm_add": |
Case "fdtm_add": |
129 |
|
p_AddFeed() |
|
|
129 |
|
p_AddFeedRequest() |
130 |
130 |
|
|
131 |
131 |
Case "menu_hide": |
Case "menu_hide": |
132 |
132 |
FallThrough |
FallThrough |
|
... |
... |
Function p_MUIEvent(msg) |
171 |
171 |
mui.Set("item_title", "Contents", chosen_item.title) |
mui.Set("item_title", "Contents", chosen_item.title) |
172 |
172 |
mui.Set("textfield", "Text", chosen_item.description) |
mui.Set("textfield", "Text", chosen_item.description) |
173 |
173 |
EndIf |
EndIf |
174 |
|
|
|
|
174 |
|
Case "foundfeeds": |
|
175 |
|
lurk:AddFromlist("Active") |
175 |
176 |
EndSwitch |
EndSwitch |
176 |
177 |
|
|
177 |
178 |
|
|
|
... |
... |
Function p_MUIEvent(msg) |
179 |
180 |
Switch msg.ID |
Switch msg.ID |
180 |
181 |
Case "reqclosebtn": |
Case "reqclosebtn": |
181 |
182 |
mui.Set("metawin", "open", False) |
mui.Set("metawin", "open", False) |
|
183 |
|
Case "reqaddbtn": |
|
184 |
|
lurk:AddSelected() |
182 |
185 |
|
|
183 |
186 |
Case "lurkbtn": |
Case "lurkbtn": |
184 |
187 |
mui.Set("metawin", "open", True) |
mui.Set("metawin", "open", True) |
185 |
188 |
Case "addbtn": |
Case "addbtn": |
186 |
|
p_AddFeed() |
|
|
189 |
|
p_AddFeedRequest() |
187 |
190 |
Case "fetchbtn": |
Case "fetchbtn": |
188 |
191 |
p_FetchCurrent() |
p_FetchCurrent() |
189 |
192 |
Case "fetchallbtn": |
Case "fetchallbtn": |
|
... |
... |
Function p_StartUpLoading() |
299 |
302 |
EndFunction |
EndFunction |
300 |
303 |
|
|
301 |
304 |
|
|
302 |
|
Function p_SaveFeeds() |
|
303 |
|
Local err_code = ?StringToFile(SerializeTable( |
|
304 |
|
p_DumpFeedTree("feedtree")), "feeds.json") |
|
305 |
|
p_Replay(err_code, "Tree arrangement saved") |
|
|
305 |
|
Function p_SaveSettings() |
|
306 |
|
p_SaveFeeds() |
306 |
307 |
|
|
307 |
|
err_code = ?SavePrefs(feedsdata) |
|
|
308 |
|
Local err_code = ?SavePrefs(feedsdata) |
308 |
309 |
p_Replay(err_code, "Settings saved") |
p_Replay(err_code, "Settings saved") |
309 |
310 |
EndFunction |
EndFunction |
310 |
311 |
|
|
311 |
|
|
|
312 |
|
|
|
313 |
|
Function p_HideFeeds() |
|
314 |
|
mui.DoMethod("feedtree", "close", "root", "all") |
|
315 |
|
EndFunction |
|
316 |
|
|
|
317 |
|
Function p_ExpandFeeds() |
|
318 |
|
mui.DoMethod("feedtree", "open", "root", "all") |
|
319 |
|
EndFunction |
|
320 |
|
|
|
321 |
|
|
|
322 |
312 |
Function p_Lock() |
Function p_Lock() |
323 |
313 |
mui.Set("fetchbtn", "Disabled", True) |
mui.Set("fetchbtn", "Disabled", True) |
324 |
314 |
mui.Set("fetchallbtn", "Disabled", True) |
mui.Set("fetchallbtn", "Disabled", True) |
|
... |
... |
InstallEventHandler({MUIRoyale = p_MUIEvent}) |
354 |
344 |
|
|
355 |
345 |
p_StartUpLoading() |
p_StartUpLoading() |
356 |
346 |
|
|
|
347 |
|
|
357 |
348 |
Repeat |
Repeat |
358 |
349 |
WaitEvent |
WaitEvent |
359 |
350 |
Forever |
Forever |
File feedtree.hws changed (mode: 100755) (index c969195..cfd48d2) |
... |
... |
Function p_FillListTree(listtree$, treetable) |
17 |
17 |
EndFunction |
EndFunction |
18 |
18 |
|
|
19 |
19 |
|
|
20 |
|
Function p_DumpFeedTree(listtree$) |
|
|
20 |
|
Function p_DumpFeedTree() |
21 |
21 |
cFeeds = CreateList() ;currentFeeds |
cFeeds = CreateList() ;currentFeeds |
22 |
|
p_DumpListTree(listtree$, cFeeds, "Root", "Root") |
|
|
22 |
|
p_DumpListTree(#LIST_TREE, cFeeds, "Root", "Root") |
23 |
23 |
Return(cFeeds) |
Return(cFeeds) |
24 |
24 |
EndFunction |
EndFunction |
25 |
25 |
|
|
|
... |
... |
Function p_RemoveCurrent() |
120 |
120 |
feedsdata[t.id] = nil |
feedsdata[t.id] = nil |
121 |
121 |
;č Na soubory ve složce Feeds sereme? |
;č Na soubory ve složce Feeds sereme? |
122 |
122 |
EndIf |
EndIf |
|
123 |
|
p_SaveFeeds() |
123 |
124 |
EndFunction |
EndFunction |
124 |
125 |
|
|
125 |
126 |
|
|
|
... |
... |
Function p_CreateGroup() |
136 |
137 |
"List; Active") |
"List; Active") |
137 |
138 |
;p_Replay(err_code, "Group ".."\27b"..s$ .. " has been created") |
;p_Replay(err_code, "Group ".."\27b"..s$ .. " has been created") |
138 |
139 |
EndIf |
EndIf |
|
140 |
|
p_SaveFeeds() |
139 |
141 |
EndFunction |
EndFunction |
140 |
142 |
|
|
141 |
143 |
|
|
142 |
|
|
|
143 |
|
Function p_AddFeed() |
|
|
144 |
|
Function p_AddFeedRequest() |
144 |
145 |
Local type, data$ = GetClipboard() |
Local type, data$ = GetClipboard() |
145 |
146 |
Local s$, ok = StringRequest("Add RSS feed", "Enter feed adress", |
Local s$, ok = StringRequest("Add RSS feed", "Enter feed adress", |
146 |
147 |
IIf(type = #CLIPBOARD_TEXT And StartsWith(data$, "http"), |
IIf(type = #CLIPBOARD_TEXT And StartsWith(data$, "http"), |
147 |
148 |
{Text=data$}, {})) |
{Text=data$}, {})) |
148 |
|
If EmptyStr(s$) Then Return() |
|
149 |
|
s$ = StripStr(s$) |
|
150 |
|
;č zjednodušená kontrola, pokud řetězec obsahuje procenta, |
|
151 |
|
;č považujeme ho za "eskejpnutý". |
|
152 |
|
;č Na případ, kdy uživatel strčí do URLu osamělý znak procenta vysereme |
|
153 |
|
/* houby, takhle hurl eskejpne úplně všechno |
|
154 |
|
If True ;FindStr(s$, "%") = -1 |
|
155 |
|
easy = hurl.Easy() |
|
156 |
|
s$ = easy:Escape(s$) |
|
157 |
|
easy:Close() |
|
158 |
|
EndIf */ |
|
159 |
|
If p_HasItem(s$, "Root") |
|
160 |
|
mui.Set("status", "Contents", s$ .. " \27balready exists") |
|
|
149 |
|
p_AddFeed(s$) |
|
150 |
|
p_SaveFeeds() |
|
151 |
|
EndFunction |
|
152 |
|
|
|
153 |
|
|
|
154 |
|
Function p_AddFeed(feedid$) |
|
155 |
|
If EmptyStr(feedid$) Then Return() |
|
156 |
|
feedid$ = StripStr(feedid$) |
|
157 |
|
If p_HasItem(feedid$, "Root") |
|
158 |
|
mui.Set("status", "Contents", feedid$ .. " \27balready exists") |
161 |
159 |
Else |
Else |
162 |
|
mui.DoMethod(#LIST_TREE, "Insert", "\27".."5"..s$, s$, "Root", |
|
|
160 |
|
mui.DoMethod(#LIST_TREE, "Insert", "\27".."5"..feedid$, feedid$, "Root", |
163 |
161 |
IIf(mui.Get(#LIST_TREE, "Active")="Off", "Tail","Active"), |
IIf(mui.Get(#LIST_TREE, "Active")="Off", "Tail","Active"), |
164 |
162 |
"Active") |
"Active") |
165 |
163 |
EndIf |
EndIf |
|
... |
... |
Function p_HasItem(nodeid$, muiid) |
184 |
182 |
Return(False) |
Return(False) |
185 |
183 |
EndFunction |
EndFunction |
186 |
184 |
|
|
|
185 |
|
Function p_SaveFeeds() |
|
186 |
|
Local err_code = ?StringToFile(SerializeTable( |
|
187 |
|
p_DumpFeedTree()), "feeds.json") |
|
188 |
|
p_Replay(err_code, "Feeds saved") |
|
189 |
|
EndFunction |
187 |
190 |
|
|
188 |
191 |
|
|
189 |
|
;bool = IsOnline() |
|
190 |
|
;r$ = StripStr(s$) |
|
191 |
192 |
|
|
192 |
|
; hURL is required |
|
193 |
|
;e$ = easy:Escape(s$) |
|
194 |
193 |
|
|
195 |
194 |
|
|
196 |
|
;name, isNode, id, parent |
|
197 |
|
/* |
|
198 |
|
Function p_InsertNode(i, t, listtree$) |
|
199 |
|
Local flags$ = IIf(t.isNode, "List", "") |
|
200 |
|
DebugPrint(i, t.id) |
|
201 |
|
mui.DoMethod(listtree$, "Insert", t.name, t.id, t.parent, "Tail", flags$) |
|
202 |
|
EndFunction |
|
203 |
|
*/ |
|
|
195 |
|
Function p_HideFeeds() |
|
196 |
|
mui.DoMethod("feedtree", "close", "root", "all") |
|
197 |
|
EndFunction |
|
198 |
|
|
|
199 |
|
Function p_ExpandFeeds() |
|
200 |
|
mui.DoMethod("feedtree", "open", "root", "all") |
|
201 |
|
EndFunction |
|
202 |
|
|
File lurk.hws changed (mode: 100755) (index cecf786..c90b6de) |
1 |
1 |
|
|
2 |
|
|
|
|
2 |
|
Const #LURK_LISTVIEW = "foundfeeds" |
3 |
3 |
|
|
4 |
4 |
lurk = {PleaseStop=True} |
lurk = {PleaseStop=True} |
5 |
5 |
;č jako v celé té appce i zde se pevně zavážeme |
;č jako v celé té appce i zde se pevně zavážeme |
|
... |
... |
Function lurk:Explore(url$) |
49 |
49 |
;č O to je to jednodušší. |
;č O to je to jednodušší. |
50 |
50 |
If err_code = #ERR_NONE |
If err_code = #ERR_NONE |
51 |
51 |
|
|
52 |
|
|
|
53 |
|
Local headpos = FindStr(html$, "<head", False) |
|
|
52 |
|
Local ok, n = ValidateStr(html$) |
|
53 |
|
Local encoding = IIf(ok, #ENCODING_UTF8, #ENCODING_ISO8859_1) |
|
54 |
|
Local headpos = FindStr(html$, "<head", False, 0, encoding) |
54 |
55 |
If headpos < 0 |
If headpos < 0 |
55 |
56 |
self:set_status("\27bNothing found") ;č hlavně ta hlavička.. |
self:set_status("\27bNothing found") ;č hlavně ta hlavička.. |
56 |
57 |
Return() |
Return() |
|
... |
... |
Function lurk:Explore(url$) |
59 |
60 |
|
|
60 |
61 |
Local p = XMLParser.New({StartElement = lurkStartElement}) |
Local p = XMLParser.New({StartElement = lurkStartElement}) |
61 |
62 |
p:setbase(url$) |
p:setbase(url$) |
|
63 |
|
|
|
64 |
|
p:setencoding(IIf(ok, "UTF-8", "ISO-8859-1")) |
62 |
65 |
;č ten parser trefí šlak, uvidí-li CO má zpracovat |
;č ten parser trefí šlak, uvidí-li CO má zpracovat |
63 |
|
p:Parse(UnrightStr(html$, headpos)) |
|
|
66 |
|
p:Parse(UnrightStr(html$, headpos, encoding)) |
64 |
67 |
|
|
65 |
68 |
;č html-ko nemůže nezpůsobit chybu. |
;č html-ko nemůže nezpůsobit chybu. |
66 |
69 |
;č nemá cenu je hlídat |
;č nemá cenu je hlídat |
|
... |
... |
EndFunction |
77 |
80 |
|
|
78 |
81 |
|
|
79 |
82 |
Function lurk:Clear() |
Function lurk:Clear() |
80 |
|
mui.DoMethod("foundfeeds", "Clear") |
|
|
83 |
|
mui.DoMethod(#LURK_LISTVIEW, "Clear") |
81 |
84 |
EndFunction |
EndFunction |
82 |
85 |
|
|
83 |
86 |
;č zoufalý pokus rekonstituce adresy |
;č zoufalý pokus rekonstituce adresy |
|
... |
... |
Function p_reconstructURL(base$, href$) |
116 |
119 |
Return(LeftStr(base$, drawerpos + 1) .. href$) |
Return(LeftStr(base$, drawerpos + 1) .. href$) |
117 |
120 |
EndIf |
EndIf |
118 |
121 |
|
|
119 |
|
;č Je to jedno. Nechť to uživatel řeší sám! |
|
|
122 |
|
;č Je to jedno. Nechť si to uživatel řeší sám! |
120 |
123 |
Return(TrimStr(base$, "/", True) .. "/" .. href$) |
Return(TrimStr(base$, "/", True) .. "/" .. href$) |
121 |
124 |
EndFunction |
EndFunction |
122 |
125 |
|
|
|
... |
... |
Function lurkStartElement(p, name$, attrs) |
155 |
158 |
FallThrough |
FallThrough |
156 |
159 |
Case "application/rss+xml": |
Case "application/rss+xml": |
157 |
160 |
Local item = {href="", title="", rel=""} |
Local item = {href="", title="", rel=""} |
158 |
|
For i,v In Pairs(item) |
|
159 |
|
If HaveItem(attrs, i) Then item[i] = attrs[i] |
|
160 |
|
Next |
|
|
161 |
|
For i,v In Pairs(item) |
|
162 |
|
If HaveItem(attrs, i) Then item[i] = attrs[i] |
|
163 |
|
Next |
161 |
164 |
/* |
/* |
162 |
165 |
<column title="CanHas"/> |
<column title="CanHas"/> |
163 |
166 |
<column title="Address"/> |
<column title="Address"/> |
164 |
167 |
<column title="Title"/> |
<column title="Title"/> |
165 |
168 |
<column title="Relationship"/> |
<column title="Relationship"/> |
166 |
169 |
<column title="Type"/> |
<column title="Type"/> |
|
170 |
|
<column title="URL constructed"/> |
167 |
171 |
*/ |
*/ |
168 |
|
mui.DoMethod("foundfeeds", "Insert", "Bottom", |
|
169 |
|
"", |
|
|
172 |
|
Local url$ = p_reconstructURL(p:getbase(), item.href) |
|
173 |
|
mui.DoMethod(#LURK_LISTVIEW, "Insert", "Bottom", |
|
174 |
|
lurk:CanHas(url$), |
170 |
175 |
item.href, |
item.href, |
171 |
176 |
item.title, |
item.title, |
172 |
177 |
item.rel, |
item.rel, |
173 |
178 |
attrs.type, |
attrs.type, |
174 |
|
p_reconstructURL(p:getbase(), item.href)) |
|
|
179 |
|
url$) |
175 |
180 |
EndSwitch |
EndSwitch |
176 |
181 |
EndIf |
EndIf |
177 |
182 |
EndSwitch |
EndSwitch |
178 |
183 |
|
|
179 |
184 |
EndFunction |
EndFunction |
180 |
185 |
|
|
|
186 |
|
Function lurk:CanHas(url$) |
|
187 |
|
Return(IIf(p_HasItem(url$, "Root"), "added" , "")) |
|
188 |
|
EndFunction |
|
189 |
|
|
|
190 |
|
Function lurk:AddByDoubleClick() |
|
191 |
|
self:AddFromlist(pos) |
|
192 |
|
p_SaveFeeds() |
|
193 |
|
EndFunction |
|
194 |
|
|
|
195 |
|
|
|
196 |
|
|
|
197 |
|
Function lurk:AddSelected() |
|
198 |
|
Local t = mui.DoMethod(#LURK_LISTVIEW, "GetSelection") |
|
199 |
|
For i,v In IPairs(t) ;č tam jsou pouze číselné indexy. Možno. |
|
200 |
|
lurk:AddFromlist(v) |
|
201 |
|
Next |
|
202 |
|
p_SaveFeeds() |
|
203 |
|
EndFunction |
181 |
204 |
|
|
|
205 |
|
Function lurk:AddFromlist(pos) |
|
206 |
|
Local has$, href$, title$, rel$, type$, url$ = mui.DoMethod( |
|
207 |
|
#LURK_LISTVIEW, "GetEntry", pos) |
|
208 |
|
If Not has$ |
|
209 |
|
p_AddFeed(url$) |
|
210 |
|
EndIf |
|
211 |
|
mui.DoMethod(#LURK_LISTVIEW, "Rename", pos, |
|
212 |
|
self:CanHas(url$), href$, title$, rel$, type$, url$) |
|
213 |
|
EndFunction |