🐞 fix(文管插件): 修改侧边栏显示名

This commit is contained in:
huheng@kylinos.cn 2023-06-09 11:02:26 +08:00
parent da6dbb10c2
commit c06cd856bb
4 changed files with 61 additions and 48 deletions

View File

@ -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");

View File

@ -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

View File

@ -4,7 +4,7 @@
<context>
<name>QObject</name>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="271"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="272"/>
<source>File does not exist</source>
<translation></translation>
</message>
@ -14,36 +14,40 @@
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="264"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="265"/>
<source>This is not a local file</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="276"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="277"/>
<source>This is not a file</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="304"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="522"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="557"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="306"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="524"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="559"/>
<source>Operation not supported</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="309"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="311"/>
<source>MULT may not have started</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="356"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h" line="65"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h" line="69"/>
<source>multiterminal</source>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="358"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h" line="67"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h" line="71"/>
<source>Multiterminal</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="441"/>
<source>multiterminal</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="443"/>
<source>Incorrect path</source>
<translation></translation>
</message>

View File

@ -4,7 +4,7 @@
<context>
<name>QObject</name>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="271"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="272"/>
<source>File does not exist</source>
<translation></translation>
</message>
@ -14,36 +14,40 @@
<translation>.</translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="264"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="265"/>
<source>This is not a local file</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="276"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="277"/>
<source>This is not a file</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="304"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="522"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="557"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="306"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="524"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="559"/>
<source>Operation not supported</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="309"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="311"/>
<source>MULT may not have started</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="356"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h" line="65"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h" line="69"/>
<source>multiterminal</source>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="358"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h" line="67"/>
<location filename="../plugin/peony-vfs-kylin-multiterminal/peony-vfs-multiterminal.h" line="71"/>
<source>Multiterminal</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="441"/>
<source>multiterminal</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../plugin/peony-vfs-kylin-multiterminal/multiterminal-vfs-file.cpp" line="443"/>
<source>Incorrect path</source>
<translation></translation>
</message>