Skip to content

A full-featured download manager.

feat: preference open at login

Dr_rOote690f153358c
diff --git a/src/main/core/ConfigManager.js b/src/main/core/ConfigManager.js
index bf955af6..3d4dec5e 100644
--- a/src/main/core/ConfigManager.js
+++ b/src/main/core/ConfigManager.js
@@ -115,6 +115,7 @@ export default class ConfigManager {
'locale': app.getLocale(),
'log-path': getLogPath(),
'new-task-show-downloading': true,
+ 'open-at-login': false,
'resume-all-when-app-launched': false,
'session-path': getSessionPath(),
'task-notification': true,
diff --git a/src/renderer/components/Preference/Basic.vue b/src/renderer/components/Preference/Basic.vue
index d49b4261..a513addc 100644
--- a/src/renderer/components/Preference/Basic.vue
+++ b/src/renderer/components/Preference/Basic.vue
@@ -12,6 +12,15 @@
:model="form"
:rules="rules">
<el-form-item :label="`${$t('preferences.startup')}: `" :label-width="formLabelWidth">
+ <el-col
+ class="form-item-sub"
+ :span="24"
+ v-if="!isLinux()"
+ >
+ <el-checkbox v-model="form.openAtLogin">
+ {{ $t('preferences.open-at-login') }}
+ </el-checkbox>
+ </el-col>
<el-col class="form-item-sub" :span="24">
<el-checkbox v-model="form.resumeAllWhenAppLaunched">
{{ $t('preferences.auto-resume-all') }}
@@ -93,27 +102,29 @@
const initialForm = (config) => {
const {
+ autoCheckUpdate,
dir,
- split,
- resumeAllWhenAppLaunched,
+ lastCheckUpdateTime,
maxConcurrentDownloads,
maxConnectionPerServer,
- taskNotification,
- autoCheckUpdate,
newTaskShowDownloading,
- lastCheckUpdateTime
+ openAtLogin,
+ resumeAllWhenAppLaunched,
+ split,
+ taskNotification
} = config
const result = {
- dir,
- split,
+ autoCheckUpdate,
continue: config.continue,
- resumeAllWhenAppLaunched,
+ dir,
+ lastCheckUpdateTime,
maxConcurrentDownloads,
maxConnectionPerServer,
- taskNotification,
- autoCheckUpdate,
newTaskShowDownloading,
- lastCheckUpdateTime
+ openAtLogin,
+ resumeAllWhenAppLaunched,
+ split,
+ taskNotification
}
return result
}
@@ -144,6 +155,7 @@
methods: {
isRenderer: is.renderer,
isMas: is.mas,
+ isLinux: is.linux,
onDirectorySelected (dir) {
this.form.dir = dir
},
@@ -154,8 +166,14 @@
return false
}
- this.$store.dispatch('preference/save', this.form)
+ const data = {
+ ...this.form
+ }
+ const { openAtLogin } = data
+
+ this.$store.dispatch('preference/save', data)
if (this.isRenderer()) {
+ this.$electron.ipcRenderer.send('command', 'application:open-at-login', openAtLogin)
this.$electron.ipcRenderer.send('command', 'application:relaunch')
}
})
diff --git a/src/shared/configKeys.js b/src/shared/configKeys.js
index af3d5b8b..88d780a2 100644
--- a/src/shared/configKeys.js
+++ b/src/shared/configKeys.js
@@ -1,25 +1,25 @@
const userKeys = [
- 'locale',
+ 'all-proxy-backup',
+ 'auto-check-update',
'cookie',
- 'resume-all-when-app-launched',
- 'task-notification',
+ 'enable-egg-features',
'hide-app-menu',
- 'new-task-show-downloading',
- 'use-proxy',
- 'all-proxy-backup',
+ 'last-check-update-time',
+ 'locale',
'log-path',
+ 'new-task-show-downloading',
+ 'open-at-login',
+ 'resume-all-when-app-launched',
'session-path',
- 'enable-egg-features',
+ 'task-notification',
'theme',
- 'auto-check-update',
- 'last-check-update-time'
+ 'use-proxy'
]
const systemKeys = [
- 'max-concurrent-downloads',
- 'all-proxy',
'all-proxy-passwd',
'all-proxy-user',
+ 'all-proxy',
'allow-overwrite',
'allow-piece-length-change',
'always-resume',
@@ -42,10 +42,10 @@ const systemKeys = [
'bt-save-metadata',
'bt-seed-unverified',
'bt-stop-timeout',
- 'bt-tracker',
'bt-tracker-connect-timeout',
'bt-tracker-interval',
'bt-tracker-timeout',
+ 'bt-tracker',
'check-integrity',
'checksum',
'conditional-get',
@@ -64,9 +64,9 @@ const systemKeys = [
'force-save',
'ftp-passwd',
'ftp-pasv',
- 'ftp-proxy',
'ftp-proxy-passwd',
'ftp-proxy-user',
+ 'ftp-proxy',
'ftp-reuse-connection',
'ftp-type',
'ftp-user',
@@ -77,15 +77,16 @@ const systemKeys = [
'http-auth-challenge',
'http-no-cache',
'http-passwd',
- 'http-proxy',
'http-proxy-passwd',
'http-proxy-user',
+ 'http-proxy',
'http-user',
- 'https-proxy',
'https-proxy-passwd',
'https-proxy-user',
+ 'https-proxy',
'index-out',
'lowest-speed-limit',
+ 'max-concurrent-downloads',
'max-connection-per-server',
'max-download-limit',
'max-file-not-found',
@@ -106,8 +107,8 @@ const systemKeys = [
'no-proxy',
'out',
'parameterized-uri',
- 'pause',
'pause-metadata',
+ 'pause',
'piece-length',
'proxy-method',
'realtime-chunk-checksum',