Add collections pane context-menu option to remove archived libraries

This commit is contained in:
Dan Stillman 2017-02-24 02:29:11 -05:00
parent 9ac458e05c
commit 2fe756c1c9
3 changed files with 47 additions and 9 deletions

View File

@ -2425,7 +2425,29 @@ var ZoteroPane = new function()
{ {
id: "emptyTrash", id: "emptyTrash",
onclick: () => this.emptyTrash() onclick: () => this.emptyTrash()
} },
{
id: "removeLibrary",
label: Zotero.getString('pane.collections.menu.remove.library'),
onclick: () => {
let library = Zotero.Libraries.get(libraryID);
let ps = Services.prompt;
let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
let index = ps.confirmEx(
null,
Zotero.getString('pane.collections.removeLibrary'),
Zotero.getString('pane.collections.removeLibrary.text', library.name),
buttonFlags,
Zotero.getString('general.remove'),
null,
null, null, {}
);
if (index == 0) {
library.eraseTx();
}
}
},
]; ];
@ -2554,12 +2576,16 @@ var ZoteroPane = new function()
} }
// Library // Library
else { else {
show = [ let library = Zotero.Libraries.get(libraryID);
'sync', show = [];
'sep1', if (!library.archived) {
'newCollection', show.push(
'newSavedSearch', 'sync',
]; 'sep1',
'newCollection',
'newSavedSearch'
);
}
// Only show "Show Duplicates" and "Show Unfiled Items" if rows are hidden // Only show "Show Duplicates" and "Show Unfiled Items" if rows are hidden
let duplicates = Zotero.Utilities.Internal.getVirtualCollectionStateForLibrary( let duplicates = Zotero.Utilities.Internal.getVirtualCollectionStateForLibrary(
libraryID, 'duplicates' libraryID, 'duplicates'
@ -2568,7 +2594,9 @@ var ZoteroPane = new function()
libraryID, 'unfiled' libraryID, 'unfiled'
); );
if (!duplicates || !unfiled) { if (!duplicates || !unfiled) {
show.push('sep2'); if (!library.archived) {
show.push('sep2');
}
if (!duplicates) { if (!duplicates) {
show.push('showDuplicates'); show.push('showDuplicates');
} }
@ -2576,10 +2604,15 @@ var ZoteroPane = new function()
show.push('showUnfiled'); show.push('showUnfiled');
} }
} }
if (!library.archived) {
show.push('sep3');
}
show.push( show.push(
'sep3',
'exportFile' 'exportFile'
); );
if (library.archived) {
show.push('removeLibrary');
}
} }
// Disable some actions if user doesn't have write access // Disable some actions if user doesn't have write access

View File

@ -275,6 +275,7 @@
<menuitem class="zotero-menuitem-export" label="&zotero.toolbar.export.label;"/> <menuitem class="zotero-menuitem-export" label="&zotero.toolbar.export.label;"/>
<menuitem class="zotero-menuitem-create-report"/> <menuitem class="zotero-menuitem-create-report"/>
<menuitem class="zotero-menuitem-delete-from-lib" label="&zotero.toolbar.emptyTrash.label;"/> <menuitem class="zotero-menuitem-delete-from-lib" label="&zotero.toolbar.emptyTrash.label;"/>
<menuitem class="zotero-menuitem-removeLibrary"/>
</menupopup> </menupopup>
<menupopup id="zotero-itemmenu"> <menupopup id="zotero-itemmenu">
<!-- Keep order in sync with buildItemContextMenu --> <!-- Keep order in sync with buildItemContextMenu -->

View File

@ -40,6 +40,7 @@ general.character.singular = character
general.character.plural = characters general.character.plural = characters
general.create = Create general.create = Create
general.delete = Delete general.delete = Delete
general.remove = Remove
general.moreInformation = More Information general.moreInformation = More Information
general.seeForMoreInformation = See %S for more information. general.seeForMoreInformation = See %S for more information.
general.open = Open %S general.open = Open %S
@ -204,10 +205,13 @@ pane.collections.trash = Trash
pane.collections.untitled = Untitled pane.collections.untitled = Untitled
pane.collections.unfiled = Unfiled Items pane.collections.unfiled = Unfiled Items
pane.collections.duplicate = Duplicate Items pane.collections.duplicate = Duplicate Items
pane.collections.removeLibrary = Remove Library
pane.collections.removeLibrary.text = Are you sure you want to permanently remove “%S” from this computer?
pane.collections.menu.rename.collection = Rename Collection… pane.collections.menu.rename.collection = Rename Collection…
pane.collections.menu.edit.savedSearch = Edit Saved Search… pane.collections.menu.edit.savedSearch = Edit Saved Search…
pane.collections.menu.edit.feed = Edit Feed… pane.collections.menu.edit.feed = Edit Feed…
pane.collections.menu.remove.library = Remove Library…
pane.collections.menu.delete.collection = Delete Collection… pane.collections.menu.delete.collection = Delete Collection…
pane.collections.menu.delete.collectionAndItems = Delete Collection and Items… pane.collections.menu.delete.collectionAndItems = Delete Collection and Items…
pane.collections.menu.delete.savedSearch = Delete Saved Search… pane.collections.menu.delete.savedSearch = Delete Saved Search…