From c06cd856bba3a8e4cb6d1b856dd6aae24740e083 Mon Sep 17 00:00:00 2001 From: "huheng@kylinos.cn" Date: Fri, 9 Jun 2023 11:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(=E6=96=87=E7=AE=A1=E6=8F=92?= =?UTF-8?q?=E4=BB=B6):=20=E4=BF=AE=E6=94=B9=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multiterminal-vfs-file.cpp | 38 ++++++++++--------- .../peony-vfs-multiterminal.h | 15 +++++--- .../peony-vfs-kylin-multiterminal_bo_CN.ts | 28 ++++++++------ .../peony-vfs-kylin-multiterminal_zh_CN.ts | 28 ++++++++------ 4 files changed, 61 insertions(+), 48 deletions(-) diff --git a/plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp b/plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp index 251080d..a67b433 100644 --- a/plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp +++ b/plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp @@ -71,7 +71,7 @@ static void init_dbus_module() MultVfsDbusInterface::getInstance()->initDbusData(); } -//类结构体初始化函数,只在第一次创建对象时调用 +// 类结构体初始化函数,只在第一次创建对象时调用 static void vfs_mult_file_class_init(MultVFSFileClass *kclass) { init_dbus_module(); @@ -80,7 +80,7 @@ static void vfs_mult_file_class_init(MultVFSFileClass *kclass) gobject_class->dispose = vfs_mult_file_dispose; } -//实例结构体初始化函数,每次创建对象时都会调用 +// 实例结构体初始化函数,每次创建对象时都会调用 static void vfs_mult_file_init(MultVFSFile *self) { MultVFSFilePrivate *priv = (MultVFSFilePrivate *)vfs_mult_file_get_instance_private(self); @@ -233,8 +233,8 @@ gboolean vfs_mult_file_copy(GFile *source, GFile *destination, GFileCopyFlags fl GFile *src_file = NULL; src_file = g_file_new_for_path(truePath.toUtf8().constData()); GError *err = NULL; - GFileCopyFlags m_default_copy_flag = GFileCopyFlags(G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA - | G_FILE_COPY_NO_FALLBACK_FOR_MOVE); + GFileCopyFlags m_default_copy_flag = GFileCopyFlags( + G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA | G_FILE_COPY_NO_FALLBACK_FOR_MOVE); g_file_copy(src_file, destination, GFileCopyFlags(m_default_copy_flag | G_FILE_COPY_BACKUP | G_FILE_COPY_OVERWRITE), NULL, NULL, NULL, &err); @@ -242,7 +242,8 @@ gboolean vfs_mult_file_copy(GFile *source, GFile *destination, GFileCopyFlags fl if (err) { errorStr = QObject::tr("Failed to copy. Reason: %1").arg(QString(err->message)); g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, errorStr.toUtf8().constData()); - if (err->code == G_IO_ERROR_EXISTS) {} + if (err->code == G_IO_ERROR_EXISTS) { + } g_error_free(err); return FALSE; } @@ -292,7 +293,8 @@ gboolean vfs_mult_file_copy(GFile *source, GFile *destination, GFileCopyFlags fl g_clear_object(&dest_file); if (err) { g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, errorStr.toUtf8().constData()); - if (err->code == G_IO_ERROR_EXISTS) {} + if (err->code == G_IO_ERROR_EXISTS) { + } g_error_free(err); return FALSE; } @@ -328,7 +330,7 @@ GFile *vfs_mult_file_resolve_relative_path(GFile *file, const char *relative_pat // 处理第一级目录 // mult:///,如果输入栏输入的是第一级目录的名字"mult:///" if (parentUri == ADDRESS_PREFIX) { - //当输入栏输入"mult:///"时,first_vfs_file->priv->path_uri的值为"mult:///",relative_path的值为picture、video、audio、document + // 当输入栏输入"mult:///"时,first_vfs_file->priv->path_uri的值为"mult:///",relative_path的值为picture、video、audio、document auto value = vfs_mult_file_new_for_uri(QString("mult:///%1").arg(relative_path).toUtf8()); return value; } @@ -338,7 +340,7 @@ GFile *vfs_mult_file_resolve_relative_path(GFile *file, const char *relative_pat return G_FILE(second_vfs_file); } -//返回每个文件的fileinfo +// 返回每个文件的fileinfo GFileInfo *vfs_mult_file_query_info(GFile *file, const char *attributes, GFileQueryInfoFlags flags, GCancellable *cancellable, GError **error) { @@ -349,11 +351,11 @@ GFileInfo *vfs_mult_file_query_info(GFile *file, const char *attributes, GFileQu QString trueUri = nullptr; g_autofree char *uri = g_file_get_uri(file); QString url(uri); - //第一级目录 - //当输入栏输入"mult:///"时,vfsfile->priv->path_uri的值为"mult:///" + // 第一级目录 + // 当输入栏输入"mult:///"时,vfsfile->priv->path_uri的值为"mult:///" if (url == ADDRESS_PREFIX) { info = g_file_info_new(); - QString name = QObject::tr("multiterminal"); + QString name = QObject::tr("Multiterminal"); g_file_info_set_display_name(info, name.toUtf8().constData()); GIcon *icon = NULL; QIcon icn = QIcon::fromTheme("folder-phone-symbolic"); @@ -392,12 +394,12 @@ GFileInfo *vfs_mult_file_query_info(GFile *file, const char *attributes, GFileQu g_file_info_set_display_name(info, fileName.toUtf8().constData()); g_file_info_set_size(info, fileInfo.size()); QDateTime dateTime = QDateTime::fromString(fileInfo.dateTime(), Qt::ISODate); - int year = dateTime.date().year(); // 年 - int month = dateTime.date().month(); // 月 - int day = dateTime.date().day(); // 日 - int hour = dateTime.time().hour(); // 时 - int sec = dateTime.time().second(); // 分 - int msec = dateTime.time().msec(); // 秒 + int year = dateTime.date().year(); // 年 + int month = dateTime.date().month(); // 月 + int day = dateTime.date().day(); // 日 + int hour = dateTime.time().hour(); // 时 + int sec = dateTime.time().second(); // 分 + int msec = dateTime.time().msec(); // 秒 GTimeZone *zone = g_time_zone_new_local(); GDateTime *time = g_date_time_new(zone, year, month, day, hour, sec, msec); g_file_info_set_modification_date_time(info, time); @@ -475,7 +477,7 @@ GFileMonitor *vfs_mult_file_monitor_directory(GFile *file, GFileMonitorFlags fla Q_UNUSED(error) Q_UNUSED(cancellable) - return fmonitor; // return nullptr; + return fmonitor; // return nullptr; } char *vfs_mult_file_get_schema(GFile *file) diff --git a/plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h b/plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h index 7f5c918..7c90e1d 100644 --- a/plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h +++ b/plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h @@ -31,7 +31,9 @@ #define DISTFILES "peony-vfs-kylin-multiterminal.json" -class PeonyVFSMult : public QObject, public Peony::VFSPluginIface +class PeonyVFSMult + : public QObject + , public Peony::VFSPluginIface { Q_OBJECT Q_PLUGIN_METADATA(IID VFSPluginInterface_iid FILE DISTFILES); @@ -62,11 +64,11 @@ public: virtual const QString name() { - return QObject::tr("multiterminal"); + return QObject::tr("Multiterminal"); } virtual const QString description() { - return QObject::tr("multiterminal"); + return QObject::tr("Multiterminal"); } virtual const QIcon icon() { @@ -76,12 +78,13 @@ public: } return icn; } - virtual void setEnable(bool enable) {} + virtual void setEnable(bool enable) + { + } virtual bool isEnable() { return true; } }; - -#endif // PEONYVFSMULT_H +#endif // PEONYVFSMULT_H diff --git a/translations/peony-vfs-kylin-multiterminal_bo_CN.ts b/translations/peony-vfs-kylin-multiterminal_bo_CN.ts index 8a57251..a65e848 100644 --- a/translations/peony-vfs-kylin-multiterminal_bo_CN.ts +++ b/translations/peony-vfs-kylin-multiterminal_bo_CN.ts @@ -4,7 +4,7 @@ QObject - + File does not exist ཡིག་ཆ་མི་གནས་པ་ @@ -14,36 +14,40 @@ འདྲ་བཟོ་ཕམ་པར་འགྱུར་བའི་རྒྱུ་མཚན། - + This is not a local file རང་སའི་རྩིས་འཁོར་མ་ཡིན་པའི་ཡིག་ཆ། - + This is not a file དེ་ནི་ཡིག་ཆ་། - - - + + + Operation not supported བཀོལ་སྤྱོད་ལ་རྒྱབ་སྐྱོར་མི་བྱེད་པ་ - + MULT may not have started མཐའ་སྣེ་མང་པོ་ཕལ་ཆེར་ད་དུང་སྒོ་འབྱེད་མེད། - - - - multiterminal + + + + Multiterminal མང་མཐའ་སྣེ། - + multiterminal + མང་མཐའ་སྣེ། + + + Incorrect path ནོར་འཁྲུལ་འགྲོ་ལམ། diff --git a/translations/peony-vfs-kylin-multiterminal_zh_CN.ts b/translations/peony-vfs-kylin-multiterminal_zh_CN.ts index 1fff137..efaaf85 100644 --- a/translations/peony-vfs-kylin-multiterminal_zh_CN.ts +++ b/translations/peony-vfs-kylin-multiterminal_zh_CN.ts @@ -4,7 +4,7 @@ QObject - + File does not exist 文件不存在 @@ -14,36 +14,40 @@ 复制失败.原因: - + This is not a local file 非本机文件 - + This is not a file 这不是文件 - - - + + + Operation not supported 操作不支持 - + MULT may not have started 多端协同可能尚未启动 - - - - multiterminal + + + + Multiterminal 多端协同 - + multiterminal + 多端协同 + + + Incorrect path 错误路径