Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Move dfmplugin-disk-encrypt from dde-filemanager-extensions #2466

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Copyright: None
License: CC0-1.0

# ignore files
Files: src/*.json src/*.xml src/*.policy src/*/pinyin.dict src/*.js src/*.ini src/*.qss src/*.theme src/*/templates/* src/*.psd src/*/com.deepin.filemanager.daemon.conf src/dfm-base/qrc/configure/*.cpp examples/* src/services/*.conf
Files: src/*.json src/*.xml src/*.policy src/*/pinyin.dict src/*.js src/*.ini src/*.qss src/*.theme src/*/templates/* src/*.psd src/*/com.deepin.filemanager.daemon.conf src/dfm-base/qrc/configure/*.cpp examples/* src/services/*.conf src/services/*.pkla
Copyright: None
License: CC0-1.0

Expand Down
40 changes: 40 additions & 0 deletions assets/configs/org.deepin.dde.file-manager.diskencrypt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"magic":"dsg.config.meta",
"version":"1.0",
"contents":{
"allowExportEncKey":{
"value": true,
"serial":0,
"flags":["global"],
"name":"Allow export the encrypt key",
"name[zh_CN]":"允许导出加密密钥",
"description[zh_CN]":"用于控制是否显示加密密钥导出窗口",
"description":"It's used to control whether or not the encryption key export window is displayed",
"permissions":"readwrite",
"visibility":"public"
},
"encryptAlgorithm" : {
"value": "sm4",
"serial":0,
"flags":["global"],
"name":"Encrypt algorithm",
"name[zh_CN]":"加密算法",
"description[zh_CN]":"分区加密所使用的默认加密算法",
"description":"It's the default algorithm for encrypting partitions",
"permissions":"readwrite",
"visibility":"public"
},
"enableEncrypt": {
"value": false,
"serial":0,
"flags":["global"],
"name":"Enable partition encrypt",
"name[zh_CN]":"启用分区加密",
"description[zh_CN]":"用于控制分区加密功能是否在文管启用",
"description":"It's used to control whether to enable partition encryption feature in dde-file-manager.",
"permissions":"readwrite",
"visibility":"public"
}
}
}

84 changes: 84 additions & 0 deletions assets/dbus/org.deepin.Filemanager.DiskEncrypt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.deepin.Filemanager.DiskEncrypt">
<signal name="PrepareEncryptDiskResult">
<arg name="device" type="s" direction="out"/>
<arg name="devName" type="s" direction="out"/>
<arg name="jobID" type="s" direction="out"/>
<arg name="errCode" type="i" direction="out"/>
</signal>
<signal name="EncryptDiskResult">
<arg name="device" type="s" direction="out"/>
<arg name="devName" type="s" direction="out"/>
<arg name="errCode" type="i" direction="out"/>
<arg name="msg" type="s" direction="out"/>
</signal>
<signal name="DecryptDiskResult">
<arg name="device" type="s" direction="out"/>
<arg name="devName" type="s" direction="out"/>
<arg name="jobID" type="s" direction="out"/>
<arg name="errCode" type="i" direction="out"/>
</signal>
<signal name="ChangePassphressResult">
<arg name="device" type="s" direction="out"/>
<arg name="devName" type="s" direction="out"/>
<arg name="jobID" type="s" direction="out"/>
<arg name="errCode" type="i" direction="out"/>
</signal>
<signal name="EncryptProgress">
<arg name="device" type="s" direction="out"/>
<arg name="devName" type="s" direction="out"/>
<arg name="progress" type="d" direction="out"/>
</signal>
<signal name="DecryptProgress">
<arg name="device" type="s" direction="out"/>
<arg name="devName" type="s" direction="out"/>
<arg name="progress" type="d" direction="out"/>
</signal>
<signal name="RequestEncryptParams">
<arg name="encConfig" type="a{sv}" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
</signal>
<method name="PrepareEncryptDisk">
<arg type="s" direction="out"/>
<arg name="params" type="a{sv}" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
</method>
<method name="DecryptDisk">
<arg type="s" direction="out"/>
<arg name="params" type="a{sv}" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
</method>
<method name="ChangeEncryptPassphress">
<arg type="s" direction="out"/>
<arg name="params" type="a{sv}" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
</method>
<method name="IgnoreParamRequest">
</method>
<method name="ResumeEncryption">
<arg name="device" type="s" direction="in"/>
</method>
<method name="SetEncryptParams">
<arg name="params" type="a{sv}" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
</method>
<method name="QueryTPMToken">
<arg type="s" direction="out"/>
<arg name="device" type="s" direction="in"/>
</method>
<method name="EncryptStatus">
<arg type="i" direction="out"/>
<arg name="device" type="s" direction="in"/>
</method>
<method name="HasPendingTask">
<arg type="b" direction="out"/>
</method>
<method name="IsWorkerRunning">
<arg type="b" direction="out"/>
</method>
<method name="UnfinishedDecryptJob">
<arg type="s" direction="out"/>
</method>
</interface>
</node>
18 changes: 13 additions & 5 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ Build-Depends:
libdfm6-io-dev,
libdfm6-mount-dev,
libdfm6-burn-dev,
libxcb-xfixes0-dev (>= 1.10~)
libxcb-xfixes0-dev (>= 1.10~),
libdeepin-service-framework-dev
Standards-Version: 3.9.8
Homepage: http://www.deepin.org

Expand All @@ -74,7 +75,7 @@ Depends:
libdde-file-manager (=${binary:Version}),
libqt6sql6-sqlite,
qt6-translations-l10n,
libimageeditor6
libimageeditor6 | hello
Conflicts: dde-workspace (<< 2.90.5), dde-file-manager-oem, dde-desktop-plugins
Replaces: dde-file-manager-oem, dde-file-manager (<< 6.0.1), dde-desktop-plugins
Recommends: qt5dxcb-plugin, deepin-screensaver, dcc-wallpapersetting-plugin
Expand All @@ -97,18 +98,24 @@ Depends:
dde-file-manager-services-plugins (=${binary:Version}),
qml6-module-qtquick-controls,
qml6-module-qtquick-layouts,
qml6-module-qtquick-window
qml6-module-qtquick-window,
tpm2-abrmd,
libtss2-tcti-pcap0,
libtss2-tcti-tabrmd0,
libusec-recoverykey | hello
Replaces: dde-file-manager-oem, dde-desktop (<< 6.0.1),
dde-file-manager-preview,
dde-file-manager-preview-plugins,
dde-file-manager-plugins,
dde-file-manager-daemon-plugins,
dde-file-manager-common-plugins
dde-file-manager-common-plugins,
dfmplugin-disk-encrypt
Conflicts: dde-file-manager-preview,
dde-file-manager-preview-plugins,
dde-file-manager-plugins,
dde-file-manager-daemon-plugins,
dde-file-manager-common-plugins
dde-file-manager-common-plugins,
dfmplugin-disk-encrypt
Recommends: dde-qt5integration, avfs, samba, deepin-anything-server
Description: File manager front end
File manager front-end of Deepin OS
Expand Down Expand Up @@ -143,6 +150,7 @@ Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: deepin desktop-environment - deepin-service-manager plugins module
Deepin Desktop Environment (DDE) - deepin-service-manager plugins module.
Replaces: dfmplugin-disk-encrypt

Package: libdfm-extension-dev
Architecture: any
Expand Down
5 changes: 4 additions & 1 deletion debian/dde-file-manager-services-plugins.install
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
usr/lib/*/deepin-service-manager/*.so
usr/share/deepin-service-manager/system/*.json
usr/share/deepin-service-manager/user/*.json
usr/share/deepin-service-manager/other/*.json
usr/share/dbus-1/system.d/*.conf
usr/share/dbus-1/system-services/*.service
etc/systemd/system/[email protected]/*
usr/share/dbus-1/system.d/org.deepin.filemanager.diskencrypt.conf
etc/systemd/system/[email protected]/*
etc/polkit-1/localauthority/10-vendor.d/99-dde-file-manager-encrypt.pkla
1 change: 1 addition & 0 deletions debian/dde-file-manager.install
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ usr/bin/dde-property-dialog
usr/bin/dde-file-dialog
usr/bin/dde-select-dialog-x11
usr/bin/dde-select-dialog-wayland
usr/bin/deepin-diskencrypt-service
usr/lib/*/dde-file-manager/plugins/filemanager-core/*.so
usr/lib/*/dde-file-manager/plugins/previews/*.so
usr/share/applications/dde-file-manager.desktop
Expand Down
20 changes: 20 additions & 0 deletions examples/dfmplugin-encrypt-manager-demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.0)

project(encryptManagerDemo)

find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
find_package(dfm-framework REQUIRED)
find_package(Dtk COMPONENTS Widget REQUIRED)

file(GLOB_RECURSE SRC
${CMAKE_CURRENT_SOURCE_DIR}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

add_executable(${PROJECT_NAME} ${SRC})

target_link_libraries(${PROJECT_NAME}
Qt5::Core
Qt5::Widgets
${dfm-framework_LIBRARIES}
${DtkWidget_LIBRARIES}
)
49 changes: 49 additions & 0 deletions examples/dfmplugin-encrypt-manager-demo/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "mainwindow.h"

#include <QApplication>
#include <QDebug>

#include <dfm-framework/dpf.h>

inline constexpr char kPluginIID[] { "org.deepin.plugin.filemanager" };

static bool pluginsLoad()
{
#ifdef QT_DEBUG
QStringList pluginsDirs;
pluginsDirs.push_back(PLUGIN_DIR);
QStringList blackNames {};
DPF_NAMESPACE::LifeCycle::initialize({ kPluginIID }, pluginsDirs, blackNames);

if (!DPF_NAMESPACE::LifeCycle::readPlugins())
return false;

if (!DPF_NAMESPACE::LifeCycle::loadPlugins())
return false;

return true;
#else
return false;
#endif
}

int main(int argc, char *argv[])
{
qputenv("QT_LOGGING_RULES", "*.info=true");

QApplication a(argc, argv);

if (!pluginsLoad()) {
qCritical() << "Load plugin failed!";
abort();
}

MainWindow window;
window.show();

return a.exec();
}
Loading
Loading