peony-extensions/0002-add-share-information-of-peony-share.patch

131 lines
5.0 KiB
Diff
Raw Normal View History

2023-06-06 16:49:22 +08:00
From 5b815653a800a278e8733d1d4edbfb89cb6e03b9 Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Thu, 8 Jun 2023 09:34:56 +0800
Subject: [PATCH] add share information of peony-share
---
peony-share/SwitchButton/switchbutton.cpp | 17 +++++++++++++++++
peony-share/peony-share.pro | 2 ++
.../translations/peony-share-extension_cs.ts | 13 +++++++++++++
.../translations/peony-share-extension_tr.ts | 13 +++++++++++++
.../translations/peony-share-extension_zh_CN.ts | 13 +++++++++++++
5 files changed, 58 insertions(+)
diff --git a/peony-share/SwitchButton/switchbutton.cpp b/peony-share/SwitchButton/switchbutton.cpp
index d21970d..38bb00a 100644
--- a/peony-share/SwitchButton/switchbutton.cpp
+++ b/peony-share/SwitchButton/switchbutton.cpp
@@ -20,6 +20,8 @@
#include "switchbutton.h"
#include <QDebug>
+#include <QMessageBox>
+#include <QProcess>
#define THEME_QT_SCHEMA "org.ukui.style"
#define THEME_GTK_SCHEMA "org.mate.interface"
#define TIMER_INTERVAL 5 //每隔5ms动画移动一次
@@ -204,6 +206,21 @@ void SwitchButton::mousePressEvent(QMouseEvent *){
mEndX = 0;
return ;
}else{
+ QProcess tempProcess;
+ QString cmd = QString("groups");
+ tempProcess.start(cmd);
+ tempProcess.waitForFinished();
+
+ QString result = tempProcess.readAllStandardOutput().data();
+ tempProcess.close();
+ bool bFail = false;
+ bFail= result.contains("usershares");
+
+ if(!bFail)
+ {
+ QMessageBox::information(this,tr("infomation"),tr("user no group usershares, please log off and try agagin"));
+ return;
+ }
checked = !checked;
Q_EMIT checkedChanged(checked);
diff --git a/peony-share/peony-share.pro b/peony-share/peony-share.pro
index 9474deb..55f35a5 100644
--- a/peony-share/peony-share.pro
+++ b/peony-share/peony-share.pro
@@ -27,6 +27,8 @@ TRANSLATIONS += translations/peony-share-extension_cs.ts \
translations/peony-share-extension_tr.ts \
translations/peony-share-extension_zh_CN.ts
+system("lrelease-qt5 translations/*.ts")
+
RESOURCES += resources.qrc
target.path = $$[QT_INSTALL_LIBS]/peony-extensions
diff --git a/peony-share/translations/peony-share-extension_cs.ts b/peony-share/translations/peony-share-extension_cs.ts
index a2c1812..f4c69c1 100644
--- a/peony-share/translations/peony-share-extension_cs.ts
+++ b/peony-share/translations/peony-share-extension_cs.ts
@@ -74,4 +74,17 @@
<translation>Komentář:</translation>
</message>
</context>
+<context>
+ <name>SwitchButton</name>
+ <message>
+ <location filename="../SwitchButton/switchbutton.cpp" line="221"/>
+ <source>infomation</source>
+ <translation>Informace o připomenutí</translation>
+ </message>
+ <message>
+ <location filename="../SwitchButton/switchbutton.cpp" line="221"/>
+ <source>user no group usershares, please log off and try agagin</source>
+ <translation>Tento uživatel není ve skupině usershares a musí se odhlásit a zkusit sdílet znovu</translation>
+ </message>
+</context>
</TS>
diff --git a/peony-share/translations/peony-share-extension_tr.ts b/peony-share/translations/peony-share-extension_tr.ts
index 0c9c652..de95916 100644
--- a/peony-share/translations/peony-share-extension_tr.ts
+++ b/peony-share/translations/peony-share-extension_tr.ts
@@ -74,4 +74,17 @@
<translation>Yorum yap:</translation>
</message>
</context>
+<context>
+ <name>SwitchButton</name>
+ <message>
+ <location filename="../SwitchButton/switchbutton.cpp" line="221"/>
+ <source>infomation</source>
+ <translation>Hatırlatma Bilgisi</translation>
+ </message>
+ <message>
+ <location filename="../SwitchButton/switchbutton.cpp" line="221"/>
+ <source>user no group usershares, please log off and try agagin</source>
+ <translation>Bu kullanıcı usershares kullanıcı grubunda değil ve çıkıp tekrar paylaşmaya çalışmalı</translation>
+ </message>
+</context>
</TS>
diff --git a/peony-share/translations/peony-share-extension_zh_CN.ts b/peony-share/translations/peony-share-extension_zh_CN.ts
index 2b52463..0f64c7c 100644
--- a/peony-share/translations/peony-share-extension_zh_CN.ts
+++ b/peony-share/translations/peony-share-extension_zh_CN.ts
@@ -74,4 +74,17 @@
<translation>注释:</translation>
</message>
</context>
+<context>
+ <name>SwitchButton</name>
+ <message>
+ <location filename="../SwitchButton/switchbutton.cpp" line="221"/>
+ <source>infomation</source>
+ <translation>提示信息</translation>
+ </message>
+ <message>
+ <location filename="../SwitchButton/switchbutton.cpp" line="221"/>
+ <source>user no group usershares, please log off and try agagin</source>
+ <translation>此用户不在usershares用户组中需要注销后重新尝试共享功能</translation>
+ </message>
+</context>
</TS>
--
2.33.0