summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-12 12:39:21 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-12 12:39:21 +0200
commit8864cc5aee3b134b0ffc5f53c1593645f4109f8c (patch)
treeae06a5d64bd72521b447d1abc984f6d2e171e0cb /src/app.c
parent7bc2f1b1dd089bfd362ad04dad47ab38c6d9ff37 (diff)
Added option to show URL paths as encoded or decoded
IssueID #73
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/app.c b/src/app.c
index 8a6b2a66..ae21d078 100644
--- a/src/app.c
+++ b/src/app.c
@@ -188,6 +188,7 @@ static iString *serializePrefs_App_(const iApp *d) {
188 appendFormat_String(str, "zoom.set arg:%d\n", d->prefs.zoomPercent); 188 appendFormat_String(str, "zoom.set arg:%d\n", d->prefs.zoomPercent);
189 appendFormat_String(str, "smoothscroll arg:%d\n", d->prefs.smoothScrolling); 189 appendFormat_String(str, "smoothscroll arg:%d\n", d->prefs.smoothScrolling);
190 appendFormat_String(str, "imageloadscroll arg:%d\n", d->prefs.loadImageInsteadOfScrolling); 190 appendFormat_String(str, "imageloadscroll arg:%d\n", d->prefs.loadImageInsteadOfScrolling);
191 appendFormat_String(str, "decodeurls arg:%d\n", d->prefs.decodeUserVisibleURLs);
191 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); 192 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth);
192 appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph); 193 appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph);
193 appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon); 194 appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon);
@@ -836,6 +837,8 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) {
836 isSelected_Widget(findChild_Widget(d, "prefs.imageloadscroll"))); 837 isSelected_Widget(findChild_Widget(d, "prefs.imageloadscroll")));
837 postCommandf_App("ostheme arg:%d", 838 postCommandf_App("ostheme arg:%d",
838 isSelected_Widget(findChild_Widget(d, "prefs.ostheme"))); 839 isSelected_Widget(findChild_Widget(d, "prefs.ostheme")));
840 postCommandf_App("decodeurls arg:%d",
841 isSelected_Widget(findChild_Widget(d, "prefs.decodeurls")));
839 postCommandf_App("proxy.gemini address:%s", 842 postCommandf_App("proxy.gemini address:%s",
840 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.gemini")))); 843 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.gemini"))));
841 postCommandf_App("proxy.gopher address:%s", 844 postCommandf_App("proxy.gopher address:%s",
@@ -1094,6 +1097,10 @@ iBool handleCommand_App(const char *cmd) {
1094 d->prefs.smoothScrolling = arg_Command(cmd); 1097 d->prefs.smoothScrolling = arg_Command(cmd);
1095 return iTrue; 1098 return iTrue;
1096 } 1099 }
1100 else if (equal_Command(cmd, "decodeurls")) {
1101 d->prefs.decodeUserVisibleURLs = arg_Command(cmd);
1102 return iTrue;
1103 }
1097 else if (equal_Command(cmd, "imageloadscroll")) { 1104 else if (equal_Command(cmd, "imageloadscroll")) {
1098 d->prefs.loadImageInsteadOfScrolling = arg_Command(cmd); 1105 d->prefs.loadImageInsteadOfScrolling = arg_Command(cmd);
1099 return iTrue; 1106 return iTrue;
@@ -1184,7 +1191,7 @@ iBool handleCommand_App(const char *cmd) {
1184 return iTrue; 1191 return iTrue;
1185 } 1192 }
1186 else if (equal_Command(cmd, "open")) { 1193 else if (equal_Command(cmd, "open")) {
1187 const iString *url = collectNewCStr_String(suffixPtr_Command(cmd, "url")); 1194 iString *url = collectNewCStr_String(suffixPtr_Command(cmd, "url"));
1188 const iBool noProxy = argLabel_Command(cmd, "noproxy"); 1195 const iBool noProxy = argLabel_Command(cmd, "noproxy");
1189 iUrl parts; 1196 iUrl parts;
1190 init_Url(&parts, url); 1197 init_Url(&parts, url);
@@ -1214,6 +1221,12 @@ iBool handleCommand_App(const char *cmd) {
1214 setInitialScroll_DocumentWidget(doc, argfLabel_Command(cmd, "scroll")); 1221 setInitialScroll_DocumentWidget(doc, argfLabel_Command(cmd, "scroll"));
1215 setRedirectCount_DocumentWidget(doc, redirectCount); 1222 setRedirectCount_DocumentWidget(doc, redirectCount);
1216 setFlags_Widget(findWidget_App("document.progress"), hidden_WidgetFlag, iTrue); 1223 setFlags_Widget(findWidget_App("document.progress"), hidden_WidgetFlag, iTrue);
1224 if (prefs_App()->decodeUserVisibleURLs) {
1225 urlDecodePath_String(url);
1226 }
1227 else {
1228 urlEncodePath_String(url);
1229 }
1217 setUrlFromCache_DocumentWidget(doc, url, isHistory); 1230 setUrlFromCache_DocumentWidget(doc, url, isHistory);
1218 /* Optionally, jump to a text in the document. This will only work if the document 1231 /* Optionally, jump to a text in the document. This will only work if the document
1219 is already available, e.g., it's from "about:" or restored from cache. */ 1232 is already available, e.g., it's from "about:" or restored from cache. */
@@ -1332,6 +1345,7 @@ iBool handleCommand_App(const char *cmd) {
1332 dlg, format_CStr("prefs.saturation.%d", (int) (d->prefs.saturation * 3.99f))), 1345 dlg, format_CStr("prefs.saturation.%d", (int) (d->prefs.saturation * 3.99f))),
1333 selected_WidgetFlag, 1346 selected_WidgetFlag,
1334 iTrue); 1347 iTrue);
1348 setToggle_Widget(findChild_Widget(dlg, "prefs.decodeurls"), d->prefs.decodeUserVisibleURLs);
1335 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gemini"), &d->prefs.geminiProxy); 1349 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gemini"), &d->prefs.geminiProxy);
1336 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"), &d->prefs.gopherProxy); 1350 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"), &d->prefs.gopherProxy);
1337 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.http"), &d->prefs.httpProxy); 1351 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.http"), &d->prefs.httpProxy);