TagSpaces is an offline, open source, document manager with tagging support
Added switch for default location in general settings tab
Borislav Sapundzhievcd66f705dcc8
diff --git a/data/js/options.ui.js b/data/js/options.ui.jsindex 75a2bda46..fef983ea9 100644--- a/data/js/options.ui.js+++ b/data/js/options.ui.js@@ -121,6 +121,7 @@ define(function(require, exports, module) {$('#showSearchKeyBinding').val(TSCORE.Config.getSearchKeyBinding());$('#perspectiveList').empty();$('#writeTagsToFiles').attr('checked', TSCORE.Config.getWriteTagsToFile());+ $('#useDefaultLocationCheckbox').attr('checked', TSCORE.Config.getUseDefaultLocation());TSCORE.Config.getPerspectives().forEach(function(value) {addPerspective($('#perspectiveList'), value.id);});@@ -186,6 +187,7 @@ define(function(require, exports, module) {TSCORE.Config.setPerspectives(collectPerspectivesData());TSCORE.Config.setSupportedFileTypes(collectSupportedFileTypesData());TSCORE.Config.setWriteTagsToFile($('#writeTagsToFiles').is(':checked'));+ TSCORE.Config.setUseDefaultLocation($('#useDefaultLocationCheckbox').is(':checked'));TSCORE.Config.saveSettings();}diff --git a/data/js/perspective.manager.js b/data/js/perspective.manager.jsindex 90666a6e9..2cb75661f 100644--- a/data/js/perspective.manager.js+++ b/data/js/perspective.manager.js@@ -107,7 +107,10 @@ define(function(require, exports, module) {return Promise.all(promises).then(function() {initPerspectiveSwitcher();// Opening last saved location by the start of the application (not in firefox)- var lastLocation = TSCORE.Config.getLastOpenedLocation();+ var lastLocation = TSCORE.Config.getLastOpenedLocation();+ if (TSCORE.Config.getUseDefaultLocation()) {+ lastLocation = TSCORE.Config.getDefaultLocation();+ }if (lastLocation !== undefined && lastLocation.length >= 1 && !isFirefox) {TSCORE.openLocation(lastLocation);TSCORE.IO.checkAccessFileURLAllowed();diff --git a/data/js/settings.api.js b/data/js/settings.api.jsindex 99442e548..bda2bd1cd 100644--- a/data/js/settings.api.js+++ b/data/js/settings.api.js@@ -978,6 +978,18 @@ define(function(require, exports, module) {var setWriteTagsToFile = function(value) {exports.Settings.writeTagsToFile = value;};++ var getUseDefaultLocation = function() {+ if (exports.Settings.useDefaultLocation === undefined) {+ exports.Settings.useDefaultLocation = exports.DefaultSettings.useDefaultLocation;+ saveSettings();+ }+ return exports.Settings.useDefaultLocation;+ };++ var setUseDefaultLocation = function(value) {+ exports.Settings.useDefaultLocation = value;+ };// Public API definitionexports.upgradeSettings = upgradeSettings;exports.getPerspectives = getPerspectives;@@ -1082,4 +1094,6 @@ define(function(require, exports, module) {exports.addTagGroup = addTagGroup;exports.setWriteTagsToFile = setWriteTagsToFile;exports.getWriteTagsToFile = getWriteTagsToFile;+ exports.getUseDefaultLocation = getUseDefaultLocation;+ exports.setUseDefaultLocation = setUseDefaultLocation;});diff --git a/data/js/settings.default.js b/data/js/settings.default.jsindex 4d3be1c1d..e9cfd406c 100644--- a/data/js/settings.default.js+++ b/data/js/settings.default.js@@ -27,6 +27,7 @@ define(function (require, exports, module) {"warnIncludeSubdirs": true,"isWindowMaximized": false,"showMainMenu": false,+ "useDefaultLocation": false,"lastOpenedLocation": "","webDavPath" : "oc/remote.php/webdav","ootbPerspectives": ['perspectiveList', 'perspectiveGrid', 'perspectiveGraph', 'perspectiveImageSwiper'],diff --git a/data/locales/en_US/ns.dialogs.json b/data/locales/en_US/ns.dialogs.jsonindex 2f0b8ee1c..7a4e32259 100644--- a/data/locales/en_US/ns.dialogs.json+++ b/data/locales/en_US/ns.dialogs.json@@ -146,6 +146,7 @@"operationNotPermittedInEditModeAlert": "This operation is not permitted because the document has been already changed.","exportTagGroupsButton": "Export Tag Groups as JSON","showMainMenu": "Show main menu (restart needed)",+ "useDefaultLocation": "Use default location","writeTagsToFiles": "Write tags to files","invalidImportFile": "The imported file has invalid format","importGroupTagsTitle": "Import tags from file",diff --git a/data/templates/OptionsDialog.html b/data/templates/OptionsDialog.htmlindex 1fd9556be..106370690 100644--- a/data/templates/OptionsDialog.html+++ b/data/templates/OptionsDialog.html@@ -67,6 +67,18 @@</div><div class="col-sm-9" style="margin-top: 0;" data-i18n="ns.dialogs:showMainMenu"></div></div>+ <div class='form-group row' style="margin: 15px 0 0 0;">+ <div class="col-sm-2">+ <div class="onoffswitch">+ <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="useDefaultLocationCheckbox" checked>+ <label class="onoffswitch-label" for="useDefaultLocationCheckbox">+ <span class="onoffswitch-inner"></span>+ <span class="onoffswitch-switch"></span>+ </label>+ </div>+ </div>+ <div class="col-sm-9" style="margin-top: 0;" data-i18n="ns.dialogs:useDefaultLocation"></div>+ </div></div>{{#if isProVersion}}<div class="tab-pane active" id="pro" style="height: 100%;">diff --git a/default.settings.tmpl.js b/default.settings.tmpl.jsindex 0579884f9..d4ca17d23 100644--- a/default.settings.tmpl.js+++ b/default.settings.tmpl.js@@ -28,6 +28,7 @@ define(function (require, exports, module) {"isWindowMaximized": false,"showMainMenu": false,"lastOpenedLocation": "",+ "useDefaultLocation": false,"webDavPath" : "oc/remote.php/webdav","ootbPerspectives": [@@DEFAULTPERSPECTIVES],"ootbViewers": [ "viewerBrowser", "viewerMD", "viewerImage", "viewerPDF", "editorText", "viewerText", "editorODF", "viewerURL", "viewerHTML", "viewerMHTML", "editorJSON", "viewerZIP", "viewerEPUB", "viewerAudioVideo" ],