Skip to content

Commit

Permalink
Disable Clippings Manager toolbar buttons when Synced Clippings folde…
Browse files Browse the repository at this point in the history
…r selected

(part of issue #450)
  • Loading branch information
aecreations committed May 20, 2024
1 parent 734b5ee commit 52edeb2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
20 changes: 0 additions & 20 deletions wx-src/pages/clippingsMgr.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,26 +343,6 @@ <h4 data-i18n="clipMgrIntroKeybHdg"></h4>
</div>
</div>

<div id="move-sync-fldr-msgbox" class="lightbox">
<div class="dlg-content browser-style">
<div class="msgbox-icon"></div>
<p class="msgbox-content" data-i18n="moveSyncFldr"></p>
</div>
<div class="dlg-btns">
<button class="dlg-accept default" data-i18n="btnOK"></button>
</div>
</div>

<div id="delete-sync-fldr-msgbox" class="lightbox">
<div class="dlg-content browser-style">
<div class="msgbox-icon"></div>
<p class="msgbox-content" data-i18n="deleteSyncFldr"></p>
</div>
<div class="dlg-btns">
<button class="dlg-accept default" data-i18n="btnOK"></button>
</div>
</div>

<div id="move-dlg" class="lightbox">
<div class="dlg-content browser-style">
<label id="move-to-label" for="move-to-fldr-tree"></label>
Expand Down
21 changes: 12 additions & 9 deletions wx-src/pages/clippingsMgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ let gCmd = {

let folderID = parseInt(selectedNode.key);
if (folderID == gPrefs.syncFolderID) {
window.setTimeout(() => {gDialogs.moveSyncFldr.showModal()});
console.warn("Cannot move the Synced Clippings folder.");
return;
}
}
Expand Down Expand Up @@ -1577,7 +1577,7 @@ let gCmd = {
}

if (id == gPrefs.syncFolderID) {
window.setTimeout(() => {gDialogs.deleteSyncFldr.showModal()}, 100);
console.warn("Cannot delete the Synced Clippings folder, because Sync Clippings is turned on.");
return;
}

Expand Down Expand Up @@ -4666,8 +4666,6 @@ function initDialogs()
}, 100);
};

gDialogs.moveSyncFldr = new aeDialog("#move-sync-fldr-msgbox");
gDialogs.deleteSyncFldr = new aeDialog("#delete-sync-fldr-msgbox");
gDialogs.miniHelp = new aeDialog("#mini-help-dlg");
gDialogs.genericMsgBox = new aeDialog("#generic-msg-box");
}
Expand Down Expand Up @@ -5500,6 +5498,8 @@ function updateDisplay(aEvent, aData)
let selectedItemID = parseInt(aData.node.key);

if (aData.node.isFolder()) {
$("#move, #delete, #clipping-name").prop("disabled", false);

gClippingsDB.folders.get(selectedItemID).then(aResult => {
$("#clipping-name").val(aResult.name);
$("#clipping-text").val("").hide();
Expand All @@ -5511,22 +5511,25 @@ function updateDisplay(aEvent, aData)

$("#item-properties").addClass("folder-only");

if (gPrefs.syncClippings && selectedItemID == gPrefs.syncFolderID) {
// Prevent renaming of the Synced Clippings folder.
$("#clipping-name").attr("disabled", "true");
if (gPrefs.syncClippings) {
if (selectedItemID == gPrefs.syncFolderID) {
// Prevent moving, deleting or renaming of the Synced Clippings folder.
$("#move, #delete, #clipping-name").prop("disabled", "true");
}
}
else {
$("#clipping-name").removeAttr("disabled");
$("#move, #delete, #clipping-name").prop("disabled", false);
}
});
}
else {
$("#item-properties").removeClass("folder-only");
$("#clipping-name").removeAttr("disabled");
$("#clipping-name").prop("disabled", false);

gClippingsDB.clippings.get(selectedItemID).then(aResult => {
$("#clipping-name").val(aResult.name);
$("#clipping-text").val(aResult.content).show();
$("#move, #delete").prop("disabled", false);

if (gPrefs.clippingsMgrDetailsPane) {
$("#source-url-bar, #options-bar").show();
Expand Down

0 comments on commit 52edeb2

Please sign in to comment.