Skip to content

Commit e92841c

Browse files
committed
Harden custom-settings UI gating; show controls only when enabled; fix resize controls enable/disable behavior
1 parent 52fb1c9 commit e92841c

6 files changed

Lines changed: 425 additions & 76 deletions

File tree

piwigoPublish.lrplugin/PluginInfoDialogSections.lua

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ function PluginInfoDialogSections.startDialog(propertyTable)
6464
if prefs.debugToFile == nil then
6565
prefs.debugToFile = false
6666
end
67-
67+
if prefs.debugFailedUpload == nil then
68+
prefs.debugFailedUpload = false
69+
end
6870
-- Initialize update check preference
6971
if prefs.checkUpdatesOnStartup == nil then
7072
prefs.checkUpdatesOnStartup = true
@@ -84,6 +86,8 @@ function PluginInfoDialogSections.startDialog(propertyTable)
8486
propertyTable.debugEnabled = prefs.debugEnabled
8587
propertyTable.debugToFile = prefs.debugToFile
8688
propertyTable.checkUpdatesOnStartup = prefs.checkUpdatesOnStartup
89+
propertyTable.debugFailedUpload = prefs.debugFailedUpload
90+
8791
end
8892

8993
-- *************************************************
@@ -125,7 +129,7 @@ function PluginInfoDialogSections.sectionsForTopOfDialog(f, propertyTable)
125129
title = "Piwigo Publisher",
126130
font = "<system/bold>",
127131
alignment = 'left',
128-
width = 250,
132+
width = 250,
129133
},
130134

131135
-- Version @ UpdateStatus on one line, red if not up to date
@@ -166,7 +170,7 @@ function PluginInfoDialogSections.sectionsForTopOfDialog(f, propertyTable)
166170
f:row {
167171
f:static_text {
168172
title = "Made in England with cider and cheddar cheese in Somerset,\n" ..
169-
"the Land of the Summer People.",
173+
"the Land of the Summer People.",
170174
font = "<system/small>",
171175
text_color = LrColor(0.5, 0.5, 0.5),
172176
alignment = 'center',
@@ -289,7 +293,7 @@ function PluginInfoDialogSections.sectionsForTopOfDialog(f, propertyTable)
289293
fill_horizontal = 1,
290294
f:static_text {
291295
title = "If you experience a problem, enable logging below and reproduce the issue.\n" ..
292-
"You can then share the log with support.",
296+
"You can then share the log with support.",
293297
fill_horizontal = 1,
294298
height_in_lines = 2,
295299
alignment = 'left',
@@ -334,6 +338,21 @@ function PluginInfoDialogSections.sectionsForTopOfDialog(f, propertyTable)
334338
width_in_chars = 40,
335339
},
336340
},
341+
342+
f:row {
343+
f:checkbox {
344+
value = bind 'debugFailedUpload',
345+
enabled = bind 'debugEnabled',
346+
},
347+
f:static_text {
348+
title = "Log extra information for failed uploads (creates PiwigoPublishDebug folder on your desktop)",
349+
alignment = 'left',
350+
fill_horizontal = 1,
351+
width_in_chars = 40,
352+
},
353+
},
354+
355+
337356
},
338357

339358
-- Unsafe / developer group box

piwigoPublish.lrplugin/PublishDialogSections.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ local function prefsDialog(f, propertyTable)
801801

802802
f:spacer { height = 2 },
803803
-- other settings (album descriptions and comments handling)
804-
UIHelpers.createOtherSettingsGroupBox(f, bind),
804+
UIHelpers.createOtherSettingsGroupBox(f, bind, propertyTable),
805805

806806
}
807807
end

piwigoPublish.lrplugin/PublishTask.lua

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,24 @@ function PublishTask.viewForCollectionSettings(f, publishSettings, info)
257257
local pwAlbumUI, sortOrderUI, kwFilterUI = buildCommonCollectionUI(f, bind, share, collectionSettings,
258258
publishSettings)
259259

260-
local customSettingsUI = UIHelpers.createExportSettingsGroupBox(f, bind, collectionSettings, publishSettings)
261-
local UI = f:column {
262-
spacing = f:control_spacing(),
263-
pwAlbumUI,
264-
-- sortOrderUI, --todo
265-
kwFilterUI,
266-
customSettingsUI,
267-
268-
}
260+
local allowCustomAlbumSettings = publishSettings and publishSettings.PWP_customAlbumSettings == true
261+
local UI
262+
if allowCustomAlbumSettings then
263+
local customSettingsUI = UIHelpers.createExportSettingsGroupBox(f, bind, collectionSettings, publishSettings)
264+
UI = f:column {
265+
spacing = f:control_spacing(),
266+
pwAlbumUI,
267+
-- sortOrderUI, --todo
268+
kwFilterUI,
269+
customSettingsUI,
270+
}
271+
else
272+
UI = f:column {
273+
spacing = f:control_spacing(),
274+
pwAlbumUI,
275+
-- sortOrderUI, --todo
276+
}
277+
end
269278
return UI
270279
end
271280

@@ -375,14 +384,24 @@ function PublishTask.viewForCollectionSetSettings(f, publishSettings, info)
375384
local pwAlbumUI, sortOrderUI, kwFilterUI = buildCommonCollectionUI(f, bind, share, collectionSettings,
376385
publishSettings)
377386

378-
local customSettingsUI = UIHelpers.createExportSettingsGroupBox(f, bind, collectionSettings, publishSettings)
379-
local UI = f:column {
380-
spacing = f:control_spacing(),
381-
pwAlbumUI,
382-
-- sortOrderUI, --todo
383-
kwFilterUI,
384-
customSettingsUI,
385-
}
387+
local allowCustomAlbumSettings = publishSettings and publishSettings.PWP_customAlbumSettings == true
388+
local UI
389+
if allowCustomAlbumSettings then
390+
local customSettingsUI = UIHelpers.createExportSettingsGroupBox(f, bind, collectionSettings, publishSettings)
391+
UI = f:column {
392+
spacing = f:control_spacing(),
393+
pwAlbumUI,
394+
-- sortOrderUI, --todo
395+
kwFilterUI,
396+
customSettingsUI,
397+
}
398+
else
399+
UI = f:column {
400+
spacing = f:control_spacing(),
401+
pwAlbumUI,
402+
-- sortOrderUI, --todo
403+
}
404+
end
386405

387406
return UI
388407
end

0 commit comments

Comments
 (0)