fix on file type (after protobuf change), improve current row select,

still has bug for detecting file type under Windows
This commit is contained in:
rustdesk 2022-01-21 12:52:08 +08:00
parent a474f904b1
commit b0ddd3d543
3 changed files with 20 additions and 1 deletions

View File

@ -180,6 +180,8 @@ class JobTable: Reactor.Component {
if (!err) { if (!err) {
handler.remove_dir(job.id, job.path, job.is_remote); handler.remove_dir(job.id, job.path, job.is_remote);
refreshDir(job.is_remote); refreshDir(job.is_remote);
if (is_remote) file_transfer.remote_folder_view.table.resetCurrent();
else file_transfer.local_folder_view.table.resetCurrent();
} }
} else if (!job.no_confirm) { } else if (!job.no_confirm) {
handler.confirm_delete_files(id, job.file_num + 1); handler.confirm_delete_files(id, job.file_num + 1);
@ -337,6 +339,7 @@ class FolderView : Reactor.Component {
if (type > 3) return; if (type > 3) return;
var name = row[1].text; var name = row[1].text;
var path = name == ".." ? getParentPath(me.is_remote, me.fd.path) : me.joinPath(name); var path = name == ".." ? getParentPath(me.is_remote, me.fd.path) : me.joinPath(name);
me.table.resetCurrent();
me.goto(path, true); me.goto(path, true);
} }
this.get_updated(); this.get_updated();
@ -605,6 +608,8 @@ function confirmDelete(path, is_remote) {
</div>", function(res=null) { </div>", function(res=null) {
if (res) { if (res) {
handler.remove_file(jobIdCounter, path, 0, is_remote); handler.remove_file(jobIdCounter, path, 0, is_remote);
if (is_remote) file_transfer.remote_folder_view.table.resetCurrent();
else file_transfer.local_folder_view.table.resetCurrent();
deleting_single_file_jobs[jobIdCounter] = { is_remote: is_remote, path: path }; deleting_single_file_jobs[jobIdCounter] = { is_remote: is_remote, path: path };
jobIdCounter += 1; jobIdCounter += 1;
} }

View File

@ -43,6 +43,15 @@ class Grid: Behavior {
{ {
return this.$(thead>:current); // return current cell in header row return this.$(thead>:current); // return current cell in header row
} }
function resetCurrent() {
var prev = this.getCurrentRow();
if (prev)
{
prev.state.current = false; // drop state flag
prev.state.checked = false; // drop state flag
}
}
function setCurrentRow(row, reason = #by_code, doubleClick = false) function setCurrentRow(row, reason = #by_code, doubleClick = false)
{ {
@ -53,8 +62,10 @@ class Grid: Behavior {
{ {
if (prev === row && !doubleClick) return; // already here, nothing to do. if (prev === row && !doubleClick) return; // already here, nothing to do.
prev.state.current = false; // drop state flag prev.state.current = false; // drop state flag
prev.state.checked = false; // drop state flag
} }
row.state.current = true; row.state.current = true;
row.state.checked = true;
row.scrollToView(); row.scrollToView();
if (doubleClick) if (doubleClick)
@ -71,8 +82,10 @@ class Grid: Behavior {
{ {
if (prev === col) return; // already here, nothing to do. if (prev === col) return; // already here, nothing to do.
prev.state.current = false; // drop state flag prev.state.current = false; // drop state flag
prev.state.current = false; // drop state flag
} }
col.state.current = true; // set state flag col.state.current = true; // set state flag
row.state.checked = true;
col.scrollToView(); col.scrollToView();
this.onHeaderClick(col); this.onHeaderClick(col);
} }

View File

@ -1759,7 +1759,8 @@ fn make_fd(id: i32, entries: &Vec<FileEntry>, only_count: bool) -> Value {
} }
let mut e = Value::map(); let mut e = Value::map();
e.set_item("name", entry.name.to_owned()); e.set_item("name", entry.name.to_owned());
e.set_item("type", entry.entry_type.value()); let tmp = entry.entry_type.value();
e.set_item("type", if tmp == 0 { 1 } else { tmp });
e.set_item("time", entry.modified_time as f64); e.set_item("time", entry.modified_time as f64);
e.set_item("size", entry.size as f64); e.set_item("size", entry.size as f64);
a.push(e); a.push(e);