Skip to content
代码片段 群组 项目
提交 294ae0a2 编辑于 作者: Timotej Ecimovic's avatar Timotej Ecimovic
浏览文件

Add the storage token stuff to preference page.

上级 e22ff631
No related branches found
No related tags found
无相关合并请求
......@@ -103,12 +103,12 @@ async function setTheme(browserWindow, theme) {
)
}
async function getFileLocation(browserWindow, fileCategory) {
return getStorageItem(browserWindow, 'lastFileLocation_' + fileCategory)
async function getFileLocation(browserWindow, storageKey) {
return getStorageItem(browserWindow, storageKey)
}
async function saveFileLocation(browserWindow, fileCategory, path) {
setStorageItem(browserWindow, 'lastFileLocation_' + fileCategory, path)
async function saveFileLocation(browserWindow, storageKey, path) {
setStorageItem(browserWindow, storageKey, path)
}
async function setStorageItem(browserWindow, key, value) {
......
......@@ -21,7 +21,7 @@ const preference = require('../main-process/preference.js')
const about = require('../main-process/about.js')
const commonUrl = require('../../src-shared/common-url.js')
const browserApi = require('./browser-api.js')
const restApi = require('../../src-shared/rest-api.js')
const rendApi = require('../../src-shared/rend-api.js')
const newConfiguration = 'New Configuration'
......@@ -212,7 +212,7 @@ async function getUserSessionInfoMessage(browserWindow) {
*/
function doOpen(browserWindow, httpPort) {
browserApi
.getFileLocation(browserWindow, restApi.fileLocationCategory.save)
.getFileLocation(browserWindow, rendApi.storageKey.fileSave)
.then((filePath) => {
let opts = {
title: 'Select ZAP or ISC file to load.',
......@@ -228,7 +228,7 @@ function doOpen(browserWindow, httpPort) {
fileOpen(result.filePaths, httpPort)
browserApi.saveFileLocation(
browserWindow,
restApi.fileLocationCategory.save,
rendApi.storageKey.fileSave,
result.filePaths[0]
)
}
......@@ -258,7 +258,7 @@ function doSave(browserWindow) {
*/
function doSaveAs(browserWindow) {
browserApi
.getFileLocation(browserWindow, restApi.fileLocationCategory.save)
.getFileLocation(browserWindow, rendApi.storageKey.fileSave)
.then((filePath) => {
let opts = {
filters: [
......@@ -284,7 +284,7 @@ function doSaveAs(browserWindow) {
browserWindow.setTitle(filePath)
browserApi.saveFileLocation(
browserWindow,
restApi.fileLocationCategory.save,
rendApi.storageKey.fileSave,
filePath
)
}
......
......@@ -40,3 +40,7 @@ exports.observable = {
debugNavBar: 'debugNavBar',
themeData: 'data-theme',
}
exports.storageKey = {
fileSave: 'lastFileLocation_openFileSave',
}
......@@ -107,10 +107,6 @@ exports.param = {
path: 'path',
}
exports.fileLocationCategory = {
save: 'openFileSave',
}
exports.uri = uri
exports.httpCode = httpCode
exports.uiMode = uiMode
......
......@@ -17,10 +17,20 @@ limitations under the License.
<div>
<div class="text-h4 q-mb-md">User settings</div>
<p>User preferences.</p>
<q-input v-model="localPath" label="Last file location" />
</div>
</template>
<script>
import * as storage from '../util/storage.js'
import rendApi from '../../src-shared/rend-api.js'
export default {
name: 'PreferenceUser',
computed: {
localPath: {
get() {
return storage.getItem(rendApi.storageKey.fileSave)
},
},
},
}
</script>
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册