TagSpaces is an offline, open source, document manager with tagging support
Keybindings for renaming file (F2)
kristiyandd68f7625145bd
diff --git a/data/index.html b/data/index.htmlindex 2c49b4374..a8827b6d4 100644--- a/data/index.html+++ b/data/index.html@@ -55,7 +55,7 @@<div class="row1"><nav class="navbar navbar-default" role="navigation"><div class="btn-toolbar">- <span id="startNewInstanceBack" data-i18n="[title]ns.common:openNewInstanceTooltip">+ <span id="startNewInstanceBack" data-i18n="[title]ns.common:openNewInstanceTooltip" class="pull-left"><span id="logo">TagSpaces</span><sup id="appVersion"></sup></span>diff --git a/data/js/core.api.js b/data/js/core.api.jsindex c8503ff53..8b5e0d213 100644--- a/data/js/core.api.js+++ b/data/js/core.api.js@@ -211,6 +211,9 @@ define(function(require, exports, module) {Mousetrap.bind(tsSettings.getSearchKeyBinding(), function() {tsSearchUI.showSearchArea();});+ Mousetrap.bind(tsSettings.getRenamingFileKeyBinding(), function() {+ tsCoreUI.showRenameFileDialog();+ });}function checkForNewVersion() {@@ -253,10 +256,10 @@ define(function(require, exports, module) {currentBuild = 1; */if (availableVersion > currentVersion || availableVersion == currentVersion && availableBuild > currentBuild) {$('#newVersionAvailable').css('display', 'block');- $('#whatsNewModal iframe').attr('src', 'http://tagspaces.org/whatsnew/');+ /*$('#whatsNewModal iframe').attr('src', 'http://tagspaces.org/whatsnew/');$('#whatsNewModal').on('show.bs.modal', function(e) {$('#whatsNewModal iframe').attr('src', 'http://tagspaces.org/whatsnew/');- });+ });*/}}@@ -528,6 +531,7 @@ define(function(require, exports, module) {exports.createHTMLFile = tsCoreUI.createHTMLFile;exports.createMDFile = tsCoreUI.createMDFile;exports.createTXTFile = tsCoreUI.createTXTFile;+ exports.showRenameFileDialog = tsCoreUI.showRenameFileDialog;// Proxying functions from tsSearchUIexports.clearSearchFilter = tsSearchUI.clearSearchFilter;diff --git a/data/js/core.ui.js b/data/js/core.ui.jsindex 692a89a85..935d1a6bd 100644--- a/data/js/core.ui.js+++ b/data/js/core.ui.js@@ -14,7 +14,7 @@ define(function(require, exports, module) {var fileContent;var fileType;var waitingDialogTimeoutID;- var addFileInputName;+ var addFileInputName;var fileDropTemplate = Handlebars.compile('<div id="fileDropArea">' +@@ -70,7 +70,11 @@ define(function(require, exports, module) {addFileInputName = decodeURIComponent(file.name);var reader = new FileReader();reader.onload = onFileReadComplete;- reader.readAsArrayBuffer(file);+ if (isCordova) {+ reader.readAsDataURL(file);+ } else {+ reader.readAsArrayBuffer(file);+ }});$('#openLeftPanel').click(function() {@@ -256,6 +260,11 @@ define(function(require, exports, module) {$('#locationContent').hide();$('#perspectiveSwitcherButton').prop('disabled', true);++ $('#newVersionAvailable').on("click", function() {+ $('#openWhatsnew').click();+ });+var $contactUsContent = $('#contactUsContent');$contactUsContent.on('click', '#openHints', showWelcomeDialog);$contactUsContent.on('click', '#openUservoice', function(e) {@@ -355,7 +364,10 @@ define(function(require, exports, module) {addFileInputName = undefined;}+ var openWaitingDialog;+function showWaitingDialog(message, title) {+ openWaitingDialog = true;if (!title) {title = $.i18n.t('ns.dialogs:titleWaiting');}@@ -367,10 +379,13 @@ define(function(require, exports, module) {waitingModal.find('#waitingMessage').text(message);waitingDialogTimeoutID = window.setTimeout(function() {- waitingModal.modal({- backdrop: 'static',- show: true- });+ if (openWaitingDialog) {+ waitingModal.modal({+ backdrop: 'static',+ show: true+ });+ openWaitingDialog = false;+ }}, 500);waitingModal.draggable({@@ -379,6 +394,7 @@ define(function(require, exports, module) {}function hideWaitingDialog(message, title) {+ openWaitingDialog = false;window.clearTimeout(waitingDialogTimeoutID);$('#waitingDialog').modal('hide');}@@ -593,6 +609,9 @@ define(function(require, exports, module) {$.i18n.t('ns.dialogs:fileDeleteTitleConfirm'),$.i18n.t(dlgConfirmMsgId, {selectedFiles: selFiles}),function() {+ if (TSCORE.IO.stopWatchingDirectories) {+ TSCORE.IO.stopWatchingDirectories();+ }TSCORE.IOUtils.deleteFiles(TSCORE.Utils.getUniqueSelectedFiles());});@@ -625,6 +644,37 @@ define(function(require, exports, module) {});}+ function showRenameFileDialog(){+ if(TSCORE.selectedFiles[0]){+ $('#renamedFileName').val(TSCORE.selectedFiles[0]);+ $('#formFileRename').validator();+ $('#formFileRename').submit(function(e) {+ e.preventDefault();+ if ($('#renameFileButton').prop('disabled') === false) {+ $('#renameFileButton').click();+ }+ });+ $('#formFileRename').on('invalid.bs.validator', function() {+ $('#renameFileButton').prop('disabled', true);+ });+ $('#formFileRename').on('valid.bs.validator', function() {+ $('#renameFileButton').prop('disabled', false);+ });+ $('#dialogFileRename').on('shown.bs.modal', function() {+ $('#renamedFileName').focus();+ });+ $('#dialogFileRename').modal({+ backdrop: 'static',+ show: true+ });+ $('#dialogFileRename').draggable({+ handle: ".modal-header"+ });+ } else {+ TSCORE.showAlertDialog("Renaming file failed. Please select a file.");+ }+ }+function showDirectoryBrowserDialog(path) {require(['text!templates/DirectoryBrowserDialog.html',@@ -681,6 +731,9 @@ define(function(require, exports, module) {filePath = TSCORE.selectedFiles[i];fileOperations.push(TSCORE.IO.renameFilePromise(filePath, newFilePath));}+ if (TSCORE.IO.stopWatchingDirectories) {+ TSCORE.IO.stopWatchingDirectories();+ }Promise.all(fileOperations).then(function(success) {// TODO handle moving sidecar filesTSCORE.hideWaitingDialog();@@ -702,6 +755,9 @@ define(function(require, exports, module) {var filePath = TSCORE.selectedFiles[i];fileOperations.push(TSCORE.IO.copyFilePromise(filePath, newFilePath));}+ if (TSCORE.IO.stopWatchingDirectories) {+ TSCORE.IO.stopWatchingDirectories();+ }Promise.all(fileOperations).then(function(success) {// TODO handle copying sidecar filesTSCORE.hideWaitingDialog();@@ -918,6 +974,7 @@ define(function(require, exports, module) {exports.showSuccessDialog = showSuccessDialog;exports.showConfirmDialog = showConfirmDialog;exports.showFileRenameDialog = showFileRenameDialog;+ exports.showRenameFileDialog = showRenameFileDialog;exports.showFileCreateDialog = showFileCreateDialog;exports.showFileDeleteDialog = showFileDeleteDialog;exports.showDeleteFilesDialog = showDeleteFilesDialog;diff --git a/data/js/options.ui.js b/data/js/options.ui.jsindex 8ab46069c..b33a43591 100644--- a/data/js/options.ui.js+++ b/data/js/options.ui.js@@ -166,6 +166,7 @@ define(function(require, exports, module) {$('#writeMetaToSidecarFile').attr('checked', TSCORE.Config.getWriteMetaToSidecarFile());$('#useDefaultLocationCheckbox').attr('checked', TSCORE.Config.getUseDefaultLocation());$('#selectAllKeyBinding').val(TSCORE.Config.getSelectAllKeyBinding());+ $('#renamingFileKeyBinding').val(TSCORE.Config.getRenamingFileKeyBinding());if (TSCORE.PRO) {$('#enableMetaData').attr('checked', TSCORE.Config.getEnableMetaData());$('#useTrashCan').attr('checked', TSCORE.Config.getUseTrashCan());@@ -241,6 +242,7 @@ define(function(require, exports, module) {TSCORE.Config.setPropertiesDocumentKeyBinding(parseKeyBinding($('#documentPropertiesKeyBinding').val()));TSCORE.Config.setSearchKeyBinding(parseKeyBinding($('#showSearchKeyBinding').val()));TSCORE.Config.setSelectAllKeyBinding(parseKeyBinding($('#selectAllKeyBinding').val()));+ TSCORE.Config.setRenamingFileKeyBinding(parseKeyBinding($('#renamingFileKeyBinding').val()));if (TSCORE.PRO) {TSCORE.Config.setEnableMetaData($('#enableMetaData').is(':checked'));TSCORE.Config.setUseTrashCan($('#useTrashCan').is(':checked'));diff --git a/data/js/settings.api.js b/data/js/settings.api.jsindex 3f5fa2362..cf4bee89c 100644--- a/data/js/settings.api.js+++ b/data/js/settings.api.js@@ -483,6 +483,18 @@ define(function(require, exports, module) {return exports.Settings.keyBindings.selectAll;}+ function getRenamingFileKeyBinding() {+ updateKeyBindingsSetting;+ if(exports.Settings.keyBindings.renameFile === undefined){+ exports.Settings.keyBindings.renameFile = exports.DefaultSettings.keyBindings.renameFile;+ saveSettings();+ }+ return exports.Settings.keyBindings.renameFile;+ }+ function setRenamingFileKeyBinding(value) {+ exports.Settings.keyBindings.renameFile = value;+ }+function getDeleteDocumentKeyBinding() {updateKeyBindingsSetting();if (exports.Settings.keyBindings.deleteDocument === undefined) {@@ -1266,6 +1278,8 @@ define(function(require, exports, module) {exports.setReloadDocumentKeyBinding = setReloadDocumentKeyBinding;exports.getSelectAllKeyBinding = getSelectAllKeyBinding;exports.setSelectAllKeyBinding = setSelectAllKeyBinding;+ exports.getRenamingFileKeyBinding = getRenamingFileKeyBinding;+ exports.setRenamingFileKeyBinding = setRenamingFileKeyBinding;exports.getDeleteDocumentKeyBinding = getDeleteDocumentKeyBinding;exports.setDeleteDocumentKeyBinding = setDeleteDocumentKeyBinding;exports.getPropertiesDocumentKeyBinding = getPropertiesDocumentKeyBinding;diff --git a/data/js/settings.default.js b/data/js/settings.default.jsindex bf47f82b6..a286940d5 100644--- a/data/js/settings.default.js+++ b/data/js/settings.default.js@@ -6,12 +6,12 @@ define(function (require, exports, module) {exports.defaultSettings = {"appName": "TagSpaces",- "appVersion": "2.2",- "appBuild": "5",- "appBuildID": "20160413235852",+ "appVersion": "2.3",+ "appBuild": "0",+ "appBuildID": "20160429112036","settingsVersion": 2,"newTextFileContent": "",- "newHTMLFileContent": "<!DOCTYPE html><html><head><!-- Created with TagSpaces 2.2.5 --><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><style type='text/css'>body{overflow:auto;width:100%;height:100%;font:13.34px Ubuntu,arial,clean,sans-serif;color:#000;line-height:1.4em;background-color:#fff;padding:15px}p{margin:1em 0;line-height:1.5em}table{font:100%;margin:1em}table th{border-bottom:1px solid #bbb;padding:.2em 1em}table td{border-bottom:1px solid #ddd;padding:.2em 1em}input[type=image],input[type=password],input[type=text],textarea{font:99% helvetica,arial,freesans,sans-serif}option,select{padding:0 .25em}optgroup{margin-top:.5em}code,pre{font:12px Monaco,'Courier New','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace}pre{margin:1em 0;font-size:12px;background-color:#eee;border:1px solid #ddd;padding:5px;line-height:1.5em;color:#444;overflow:auto;-webkit-box-shadow:rgba(0,0,0,.07) 0 1px 2px inset;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}pre code{padding:0;font-size:12px;background-color:#eee;border:none}code{font-size:12px;background-color:#f8f8ff;color:#444;padding:0 .2em;border:1px solid #dedede}img{border:0;max-width:100%}abbr{border-bottom:none}a{color:#4183c4;text-decoration:none}a:hover{text-decoration:underline}a code,a:link code,a:visited code{color:#4183c4}h2,h3{margin:1em 0}h1,h2,h3,h4,h5,h6{border:0}h1{font-size:170%;border-top:4px solid #aaa;padding-top:.5em;margin-top:1.5em}h1:first-child{margin-top:0;padding-top:.25em;border-top:none}h2{font-size:150%;margin-top:1.5em;border-top:4px solid #e0e0e0;padding-top:.5em}h3{font-size:130%;margin-top:1em}h4{font-size:120%;margin-top:1em}h5{font-size:115%;margin-top:1em}h6{font-size:110%;margin-top:1em}hr{border:1px solid #ddd}ol,ul{margin:1em 0 1em 2em}ol li,ul li{margin-top:.5em;margin-bottom:.5em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}blockquote{margin:1em 0;border-left:5px solid #ddd;padding-left:.6em;color:#555}dt{font-weight:700;margin-left:1em}dd{margin-left:2em;margin-bottom:1em}</style></head><body></body></html>",+ "newHTMLFileContent": "<!DOCTYPE html><html><head><!-- Created with TagSpaces 2.3.0 --><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><style type='text/css'>body{overflow:auto;width:100%;height:100%;font:13.34px Ubuntu,arial,clean,sans-serif;color:#000;line-height:1.4em;background-color:#fff;padding:15px}p{margin:1em 0;line-height:1.5em}table{font:100%;margin:1em}table th{border-bottom:1px solid #bbb;padding:.2em 1em}table td{border-bottom:1px solid #ddd;padding:.2em 1em}input[type=image],input[type=password],input[type=text],textarea{font:99% helvetica,arial,freesans,sans-serif}option,select{padding:0 .25em}optgroup{margin-top:.5em}code,pre{font:12px Monaco,'Courier New','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace}pre{margin:1em 0;font-size:12px;background-color:#eee;border:1px solid #ddd;padding:5px;line-height:1.5em;color:#444;overflow:auto;-webkit-box-shadow:rgba(0,0,0,.07) 0 1px 2px inset;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}pre code{padding:0;font-size:12px;background-color:#eee;border:none}code{font-size:12px;background-color:#f8f8ff;color:#444;padding:0 .2em;border:1px solid #dedede}img{border:0;max-width:100%}abbr{border-bottom:none}a{color:#4183c4;text-decoration:none}a:hover{text-decoration:underline}a code,a:link code,a:visited code{color:#4183c4}h2,h3{margin:1em 0}h1,h2,h3,h4,h5,h6{border:0}h1{font-size:170%;border-top:4px solid #aaa;padding-top:.5em;margin-top:1.5em}h1:first-child{margin-top:0;padding-top:.25em;border-top:none}h2{font-size:150%;margin-top:1.5em;border-top:4px solid #e0e0e0;padding-top:.5em}h3{font-size:130%;margin-top:1em}h4{font-size:120%;margin-top:1em}h5{font-size:115%;margin-top:1em}h6{font-size:110%;margin-top:1em}hr{border:1px solid #ddd}ol,ul{margin:1em 0 1em 2em}ol li,ul li{margin-top:.5em;margin-bottom:.5em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}blockquote{margin:1em 0;border-left:5px solid #ddd;padding-left:.6em;color:#555}dt{font-weight:700;margin-left:1em}dd{margin-left:2em;margin-bottom:1em}</style></head><body></body></html>","newMDFileContent": '',"showUnixHiddenEntries": false,"checkForUpdates": true,@@ -86,6 +86,7 @@ define(function (require, exports, module) {"nextDocument": ['right', 'down'],"prevDocument": ['left', 'up'],"showHelp": "f1",+ "renameFile": "f2","reloadApplication": "r a","toggleFullScreen": "f11","openDevTools": "f12",diff --git a/data/locales/bg/ns.common.json b/data/locales/bg/ns.common.jsonindex d7a168ef0..81376f70c 100644--- a/data/locales/bg/ns.common.json+++ b/data/locales/bg/ns.common.json@@ -121,7 +121,10 @@"switchToContactUsTooltip": "Как да се свържете с нас?","openNewInstanceTooltip": "Отвори нова инстанция на TagSpaces","openSettingTooltip": "Отвори настройките",+ "cancelSearchTooltip": "Cancel Search","searchOptions": "Настройки на търсенето",+ "searchAdvanced": "Advanced Search",+ "showAdvancedSearch": "Open Advanced Search","searchPlaceholder": "Търси","clearFilterTooltip": "Изчисти филтъра ","includeSubfoldersInSearch": "Добави файлове от поддиректориите (добавяне на въпросителна \"?\" пред запитването)",@@ -160,6 +163,13 @@"showDevTools": "Покажи опциите за разработчици","toggleFullScreen": "Превключи на цял екран","reloadApplication": "Презареди приложението",+ "edit": "Редактирай",+ "undo": "Отмени",+ "redo": "Повтори",+ "cut": "Изрежи",+ "copy": "Копирай",+ "paste": "Постави",+ "selectAll": "Маркирай всичко","view": "Изглед","help": "Помощ","settings": "Настройки",@@ -186,7 +196,7 @@"connectingLocationTitle": "Свързано местонахождение","createNewLocationContent": "Ако все още нямате свързани местонахождения, можете да създадете едно с този бутон. Например, можете да свържете папки, съдържащи документи или снимки. Помнете, TagSpaces е <b>изцяло офлайн</b> приложение, така че <b>вашата информация няма да напусне устройството ви</b>.","folderNavigatorTitle": "Вашият навигатор за директории",- "showLocationsContent": "В тава пространсво, след като отворите дадено местонахождение, ще намирите всички поддиректории на текущата директория. Кликването върху дадена директория я прави текуща и показва поддиректориите и. ",+ "showLocationsContent": "В това пространство, след като отворите дадено местонахождение, ще намирите всички поддиректории на текущата директория. Кликването върху дадена директория я прави текуща и показва поддиректориите й. ","taglibraryTitle": "Вашата библиотека с етикети","tagGroupsContent": "Кликайки на този бутон, ще се отвори вашата библиотека с етикети. За ваше удобство, тя е разделена в групи от етикети, съдържащи единични етикети.","aboutTitle": "За проекта",@@ -200,10 +210,34 @@"perspectiveswitchTitle": "Смяна на перспективата","supportedperspectivesContent": "Това е мястото, където можеш да избиращ между инсталираните перспективи.","searchTitle": "Търси",+ "resetBtn": "Reset","searchareaContent": "Тук, можеш да активираш търсенето на програмата. Избирайки полето за търсене, ще ти обясним синтаксиса за търсене. Моля, забележете че за сега, търсачката <b>игнорира съдържанието на файловете</b>.","openingleftpanelTitle": "Отвори левия панел","openingleftpanelagainContent": "Тук можете да отворите левия панел отново.","enjoyTitle": "Надяваме се работата с TagSpaces да Ви доставя удоволствие!","thankyouContent": "... и благодарим за вашето внимание.",+ "services": "Услуги",+ "hideTagSpaces": "Скрий TagSpaces",+ "hideOthers": "Скрий останалите",+ "showAll": "Покажи всички",+ "quit": "Изключи",+ "closeTooltip": "Затвори",+ "next": "Следващ",+ "prev": "Назад",+ "done": "Готово",+ "searchWords": "Search Words",+ "searchWordsWithInterval": "Search words separated by space",+ "tagsWithInterval": "Tags separated by spaces",+ "searchTags": "Етикети",+ "searchFileTypes": "File Type (e.g. documents, pictures, ...)",+ "searchHistory": "Search History",+ "searchFileType": "Specify file type",+ "searchPictures": "Pictures (JPG,PNG,GIF,...)",+ "searchDocuments": "Documents (PDF,ODF,DOCX,EXL,...)",+ "searchNotes": "Notes (MD,TXT,HTML,...)",+ "searchAudio": "Audio (OGG,MP3,WAV,...)",+ "searchVideoFiles": "Video files (WEBM,OGV,MP4,...)",+ "searchArchives": "Archives (ZIP,RAR,TGZ,7Z,...)",+ "searchSubFolder": "Search in subfolders","-": "-"}\ No newline at end of filediff --git a/data/locales/en_US/ns.common.json b/data/locales/en_US/ns.common.jsonindex 3006d5c39..7c0aed8f3 100644--- a/data/locales/en_US/ns.common.json+++ b/data/locales/en_US/ns.common.json@@ -127,12 +127,10 @@"showAdvancedSearch": "Open Advanced Search","searchPlaceholder": "Search","clearFilterTooltip": "Clear Filter",- "includeSubfoldersInSearch": "Include files from the subfolders (by adding questionmark \" ? \" in front of the query)","excludeTermFromSearch": "Including \" ! \" in front of a term (e.g. !term) will exclude all files with this term in their filenames.","includeTagInSearch": "Including \" + \" in front of a term (e.g. +tag) will include all files tagged with this tag.","excludeTagInSearch": "Including \" - \" in front of a term (e.g. -tag) will exclude all files tagged with this tag.","andedSearch": "All terms should be true in order the file to appear in the search results.",- "searchInFilenameOnly": "The searched term should be part of the filename. Currently the content of the file is ignored.","perspectivesDropDown": "Perspectives","suggestedTags": "Suggested Tags","tagsFromCurrentFolder": "Tags From Current Folder",diff --git a/data/locales/en_US/ns.dialogs.json b/data/locales/en_US/ns.dialogs.jsonindex 90d9d341c..bae72c5fa 100644--- a/data/locales/en_US/ns.dialogs.json+++ b/data/locales/en_US/ns.dialogs.json@@ -166,5 +166,6 @@"useSearchInSubfolders": "Search in sub-folders by default","maxSearchResultCount": "Limit files found to","watchCurrentDirectory": "Watch current directory for changes",+ "renamingFileKeyBinding": "Rename File","-": "-"}diff --git a/data/templates/OptionsDialog.html b/data/templates/OptionsDialog.htmlindex bd1da8677..ab862d6e4 100644--- a/data/templates/OptionsDialog.html+++ b/data/templates/OptionsDialog.html@@ -293,6 +293,13 @@<input type='text' class='form-control' id='showSearchKeyBinding' placeholder='ctrl+f | command+f'/></div></div>+ <div class='form-group'>+ <label class="col-sm-4 control-label" data-i18n="ns.dialogs:renamingFileKeyBinding"></label>++ <div class="col-sm-7">+ <input type='text' class='form-control' id='renamingFileKeyBinding' placeholder='f2 | f2'/>+ </div>+ </div></form></div></div>