chore: transfer supports custom type

This commit is contained in:
hstyi
2025-06-26 09:34:11 +08:00
committed by hstyi
parent 00dfb4ce39
commit 17082c5fb8
6 changed files with 43 additions and 14 deletions

View File

@@ -1115,7 +1115,7 @@ class TransportPanel(
var text = when (column) {
TransportTableModel.COLUMN_NAME -> attributes.name
TransportTableModel.COLUMN_TYPE -> attributes.type
TransportTableModel.COLUMN_TYPE -> getType(row, attributes)
TransportTableModel.COLUMN_FILE_SIZE -> formatBytes(attributes.fileSize)
// @formatter:off
TransportTableModel.COLUMN_LAST_MODIFIED_TIME -> DateFormatUtils.format(Date(attributes.lastModifiedTime), I18n.getString("termora.date-format"))
@@ -1164,6 +1164,15 @@ class TransportPanel(
return c
}
private fun getType(row: Int, attributes: Attributes): String {
val path = model.getPath(sorter.convertRowIndexToModel(row))
if (path is WithPathAttributes) {
val type = path.getCustomType()
if (type != null) return type
}
return attributes.type
}
}
private inner class MyUndoManager : UndoManager() {

View File

@@ -0,0 +1,8 @@
package app.termora.transfer
interface WithPathAttributes {
/**
* 获取类型
*/
fun getCustomType(): String? = null
}