修改清屏指令发送逻辑,修复文件管理点击面包屑导航刷新文件失败的BUG,添加移动文件功能

This commit is contained in:
fangxiang 2022-03-21 17:33:25 +08:00
parent 027e31f192
commit 792ff15885
4 changed files with 53 additions and 30 deletions

View File

@ -234,6 +234,13 @@
</q-tooltip> </q-tooltip>
</a> </a>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
<a href="#" @click="(evt) => cutFile(props.row)">
{{ $t("_cut2") }}
<q-tooltip>
{{ $t("click") }}{{ $t("_cut2") }}
</q-tooltip>
</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#" @click="(evt) => deleteFile(props.row)"> <a href="#" @click="(evt) => deleteFile(props.row)">
{{ $t("delete") }} {{ $t("delete") }}
<q-tooltip> <q-tooltip>
@ -294,14 +301,9 @@
<q-item-section avatar><q-icon name="file_copy" /></q-item-section> <q-item-section avatar><q-icon name="file_copy" /></q-item-section>
<q-item-section>{{ $t("_copy2") }}</q-item-section> <q-item-section>{{ $t("_copy2") }}</q-item-section>
</q-item> </q-item>
<q-item <q-item clickable v-close-popup @click="(evt) => cutFile(current_file)">
v-if="false"
clickable
v-close-popup
@click="(evt) => cutFile(current_file)"
>
<q-item-section avatar><q-icon name="content_cut" /></q-item-section> <q-item-section avatar><q-icon name="content_cut" /></q-item-section>
<q-item-section>{{ $t("cut") }}</q-item-section> <q-item-section>{{ $t("_cut2") }}</q-item-section>
</q-item> </q-item>
<q-item <q-item
v-if="false" v-if="false"
@ -617,21 +619,21 @@ export default defineComponent({
} }
paths.value = []; paths.value = [];
let parent_item = null; let parent_item = null;
const root_flag =
path.value.startsWith("/") || path.value.startsWith("\\");
for (let item of newValue.split("/")) { for (let item of newValue.split("/")) {
if (item.trim() == "") { if (item.trim() == "") {
parent_item = null;
continue; continue;
} }
let temp: _BreadcrumbItem = new _BreadcrumbItem( let temp: _BreadcrumbItem = new _BreadcrumbItem(
item, item,
(parent_item (parent_item ? parent_item.path + "/" : "") + item
? parent_item.path + "/"
: newValue.length > 0
? newValue[0] == "/" || "\\"
? "/"
: ""
: "") + item
); );
if (!parent_item && root_flag) {
temp.path = "/" + temp.path;
}
paths.value.push(temp); paths.value.push(temp);
parent_item = temp; parent_item = temp;
@ -999,6 +1001,21 @@ export default defineComponent({
clipboard.path = path.value; clipboard.path = path.value;
clipboard.type = _ClipboardType.kTypeCut; clipboard.type = _ClipboardType.kTypeCut;
clipboard.is_directory = file.is_directory; clipboard.is_directory = file.is_directory;
$q.notify({
color: "positive",
icon: "done",
html: true,
message:
$t.t("cut to colipboard success") +
"!" +
"<br />" +
$t.t(
"please use the paste command to paste to another directory"
) +
"!",
position: "top",
timeout: 1500,
});
} }
}, },
pasteFile() { pasteFile() {
@ -1016,7 +1033,7 @@ export default defineComponent({
message: message:
(clipboard.type == _ClipboardType.kTypeCopy (clipboard.type == _ClipboardType.kTypeCopy
? $t.t("_copy2") ? $t.t("_copy2")
: $t.t("cut")) + : $t.t("_cut2")) +
(clipboard.is_directory ? $t.t("directory") : $t.t("file")) + (clipboard.is_directory ? $t.t("directory") : $t.t("file")) +
$t.t("from") + $t.t("from") +
' "' + ' "' +
@ -1057,7 +1074,9 @@ export default defineComponent({
color: success ? "positive" : "negative", color: success ? "positive" : "negative",
icon: success ? "done" : "warning", icon: success ? "done" : "warning",
message: message:
$t.t("copy") + (clipboard.type == _ClipboardType.kTypeCopy
? $t.t("_copy2")
: $t.t("_cut2")) +
(clipboard.is_directory ? $t.t("directory") : $t.t("file")) + (clipboard.is_directory ? $t.t("directory") : $t.t("file")) +
(success ? $t.t("success") : $t.t("fail")) + (success ? $t.t("success") : $t.t("fail")) +
"!", "!",

View File

@ -432,4 +432,6 @@ export default {
"copy to colipboard success": "成功拷贝到剪切板", "copy to colipboard success": "成功拷贝到剪切板",
"please use the paste command to paste to another directory": "please use the paste command to paste to another directory":
"请使用粘贴命令粘贴到其它目录", "请使用粘贴命令粘贴到其它目录",
_cut2: "移动",
"cut to colipboard success": "成功剪切到剪切板",
}; };

View File

@ -498,13 +498,14 @@ export default defineComponent({
} }
}, },
closeAllWindows() { closeAllWindows() {
for (const window of $store.state.windows) { // for (const window of $store.state.windows) {
if (window) { // if (window) {
GlobalData.getInstance() // GlobalData.getInstance()
.getCurrentClient() // .getCurrentClient()
?.closeWindow(window.window_id); // ?.closeWindow(window.window_id);
} // }
} // }
GlobalData.getInstance().getCurrentClient()?.closeWindow(-1);
}, },
switchLanguage() { switchLanguage() {
let language = Cookies.get("language"); let language = Cookies.get("language");

View File

@ -834,13 +834,14 @@ export default defineComponent({
moveWindow, moveWindow,
resizeWindow, resizeWindow,
closeAllWindows() { closeAllWindows() {
for (const window of $store.state.windows) { // for (const window of $store.state.windows) {
if (window) { // if (window) {
GlobalData.getInstance() // GlobalData.getInstance()
.getCurrentClient() // .getCurrentClient()
?.closeWindow(window.window_id); // ?.closeWindow(window.window_id);
} // }
} // }
GlobalData.getInstance().getCurrentClient()?.closeWindow(-1);
}, },
topWindow(window_id: number) { topWindow(window_id: number) {
GlobalData.getInstance().getCurrentClient()?.focusIn(window_id); GlobalData.getInstance().getCurrentClient()?.focusIn(window_id);