diff --git a/0001-fix-uninstall-failed-issue.patch b/0001-fix-uninstall-failed-issue.patch new file mode 100644 index 0000000..bf79743 --- /dev/null +++ b/0001-fix-uninstall-failed-issue.patch @@ -0,0 +1,353 @@ +From e523ae71ada3db531df88679d25fb64580fd6678 Mon Sep 17 00:00:00 2001 +From: pei-jiankang +Date: Tue, 29 Mar 2022 17:29:46 +0800 +Subject: [PATCH] fix uninstall failed issue + +--- + src/RightClickMenu/rightclickmenu.cpp | 66 ++++++++++++++-------- + src/RightClickMenu/rightclickmenu.h | 4 ++ + translations/ukui-menu_zh_CN.ts | 79 ++++++++++++++++----------- + 3 files changed, 94 insertions(+), 55 deletions(-) + +diff --git a/src/RightClickMenu/rightclickmenu.cpp b/src/RightClickMenu/rightclickmenu.cpp +index 2e86f6f..a3af856 100644 +--- a/src/RightClickMenu/rightclickmenu.cpp ++++ b/src/RightClickMenu/rightclickmenu.cpp +@@ -19,11 +19,14 @@ + #include "rightclickmenu.h" + #include "src/UtilityFunction/utility.h" + #include ++#include ++#include + + RightClickMenu::RightClickMenu(QWidget *parent): + QWidget(parent) + { + m_cmdProc=new QProcess; ++ connect(m_cmdProc , &QProcess::readyReadStandardOutput, this , &RightClickMenu::onReadOutput); + + m_whiteList.append("kylin-screenshot.desktop"); + m_whiteList.append("ukui-notebook.desktop"); +@@ -138,32 +141,49 @@ void RightClickMenu::addToDesktopActionTriggerSlot() + + void RightClickMenu::uninstallActionTriggerSlot() + { +-// if(!checkOsRelease()) +-// { +- QString cmd=QString("kylin-uninstaller %1") +- .arg(m_desktopfp.toLocal8Bit().data()); +- bool ret=QProcess::startDetached(cmd); +- qDebug()<<"卸载:"<start("sh",QStringList()<<"-c"<waitForFinished(); +-// QString output=m_cmdProc->readAllStandardOutput().trimmed(); +-// QString packageName=output.split(":").at(0); +-// cmd.clear(); +-// cmd=QString("kylin-installer -remove %1") +-// .arg(packageName.toLocal8Bit().data()); +-// bool ret=QProcess::startDetached(cmd); +-// qDebug()<<"卸载:"<setReadChannel(QProcess::StandardOutput); ++ m_cmdProc->start("sh",QStringList()<<"-c"<waitForFinished(); ++ m_cmdProc->waitForReadyRead(); ++ m_cmdProc->close(); + m_actionNumber=6; + } + ++void RightClickMenu::onReadOutput() ++{ ++ QString packagestr=QString::fromLocal8Bit(m_cmdProc->readAllStandardOutput().data()); ++ QString packageName=packagestr.split(":").at(0); ++ ++ packageName = packageName.trimmed(); ++ QProcess tempProcess; ++ QString cmd = QString("pkexec rpm -e %1").arg(packageName); ++ tempProcess.start(cmd); ++ tempProcess.waitForFinished(); ++ ++ QString errorInfo1 = tempProcess.readAllStandardError().data(); ++ QString result1 = tempProcess.readAllStandardOutput().data(); ++ //check uninstall ++ cmd = QString("rpm -qa"); ++ tempProcess.start(cmd); ++ tempProcess.waitForFinished(); ++ ++ QString errorInfo2 = tempProcess.readAllStandardError().data(); ++ QString result2 = tempProcess.readAllStandardOutput().data(); ++ bool bFail = false; ++ bFail= result2.contains(packageName); ++ ++ if(!bFail) ++ { ++ QMessageBox::information(this,tr("infomation"),tr("Uninstall finished!")); ++ } ++ else { ++ QMessageBox::information(this,tr("error"), errorInfo1); ++ } ++ QKeyEvent event(QEvent::KeyPress, Qt::Key_Menu,Qt::NoModifier); ++ QCoreApplication::sendEvent(this->parent(),&event); ++} ++ + void RightClickMenu::attributeActionTriggerSlot() + { + char command[100]; +diff --git a/src/RightClickMenu/rightclickmenu.h b/src/RightClickMenu/rightclickmenu.h +index 5760972..f2bed42 100644 +--- a/src/RightClickMenu/rightclickmenu.h ++++ b/src/RightClickMenu/rightclickmenu.h +@@ -144,6 +144,10 @@ private Q_SLOTS: + * @brief Personalize this list + */ + void otherListActionTriggerSlot(); ++ /** ++ * @brief Read command output ++ */ ++ void onReadOutput(); + + public: + Q_SIGNALS: +diff --git a/translations/ukui-menu_zh_CN.ts b/translations/ukui-menu_zh_CN.ts +index f4c522a..5737288 100644 +--- a/translations/ukui-menu_zh_CN.ts ++++ b/translations/ukui-menu_zh_CN.ts +@@ -62,57 +62,57 @@ + + FunctionWidget + +- ++ + Mobile + 移动 + + +- ++ + Internet + 网络 + + +- ++ + Social + 社交 + + +- ++ + Video + 影音 + + +- ++ + Development + 开发 + + +- ++ + Image + 图像 + + +- ++ + Game + 游戏 + + +- ++ + Office + 办公 + + +- ++ + Education + 教育 + + +- ++ + System + 系统 + + +- ++ + Others + 其它 + +@@ -120,7 +120,7 @@ + + MainViewWidget + +- ++ + Search + 搜索 + +@@ -175,32 +175,47 @@ + + RightClickMenu + +- ++ ++ infomation ++ 提示 ++ ++ ++ ++ Uninstall finished! ++ 卸载成功! ++ ++ ++ ++ error ++ 错误 ++ ++ ++ + Pin to all + 固定到“所有软件” + + +- ++ + Unpin from all + 从“所有软件”取消固定 + + +- ++ + Pin to taskbar + 固定到任务栏 + + +- ++ + Unpin from taskbar + 从任务栏取消固定 + + +- ++ + Add to desktop shortcuts + 添加到桌面快捷方式 + + +- ++ + Uninstall + 卸载 + +@@ -209,7 +224,7 @@ + 休眠 + + +- ++ + Sleep + 睡眠 + +@@ -222,22 +237,22 @@ + 切换用户 + + +- ++ + Log Out + 注销 + + +- ++ + Restart + 重启 + + +- ++ + Power Off + 关机 + + +- ++ + Personalize this list + 设置开始菜单显示列表 + +@@ -245,42 +260,42 @@ + + SideBarWidget + +- ++ + All + 所有软件 + + +- ++ + Letter + 字母排序 + + +- ++ + Function + 功能分类 + + +- ++ + Trash + 回收站 + + +- ++ + Computer + 计算机 + + +- ++ + Max + 放大 + + +- ++ + Personal + 个人 + + +- ++ + Settings + 设置 + +@@ -289,7 +304,7 @@ + 回收站 + + +- ++ + Power + 电源 + +-- +2.33.0 + diff --git a/ukui-menu.spec b/ukui-menu.spec index b517e53..1d51190 100644 --- a/ukui-menu.spec +++ b/ukui-menu.spec @@ -2,11 +2,12 @@ Name: ukui-menu Version: 3.0.3 -Release: 1 +Release: 2 Summary: Advanced ukui menu License: GPL-3.0 URL: http://www.ukui.org Source0: %{name}-%{version}.tar.gz +Patch1: 0001-fix-uninstall-failed-issue.patch BuildRequires: qt5-qtbase-devel BuildRequires: libqtxdg-devel @@ -37,6 +38,7 @@ Requires: accountsservice %prep %setup -q +%patch1 -p1 %build mkdir build && cd build @@ -58,6 +60,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/ukui-menu/translations/ %changelog +* Tue Mar 29 2022 pei-jiankang - 3.0.3-2 +- fix uninstalled failed issue + * Mon Oct 26 2020 huayadong - 3.0.3-1 - update to upstream version 3.0.3-1