From ec3e504c6a303251ccb51ee62d9a69666daad1c6 Mon Sep 17 00:00:00 2001 From: peijiankang Date: Wed, 1 Feb 2023 12:53:44 +0800 Subject: [PATCH] fix uninstall failed issue --- 0001-fix-uninstall-failed-issue.patch | 373 ++++++++++++++++++++++++++ ukui-menu.spec | 13 +- 2 files changed, 382 insertions(+), 4 deletions(-) create mode 100644 0001-fix-uninstall-failed-issue.patch diff --git a/0001-fix-uninstall-failed-issue.patch b/0001-fix-uninstall-failed-issue.patch new file mode 100644 index 0000000..f5c2989 --- /dev/null +++ b/0001-fix-uninstall-failed-issue.patch @@ -0,0 +1,373 @@ +From b8df82788c21c4e768b55e9a09f6d61f44febd5f Mon Sep 17 00:00:00 2001 +From: peijiankang +Date: Wed, 1 Feb 2023 12:44:20 +0800 +Subject: [PATCH] fix uninstall failed issue + +--- + .../RightClickMenu/rightclickmenu.cpp | 50 +++++++++- + .../RightClickMenu/rightclickmenu.h | 6 ++ + .../RightClickMenu/tabletrightclickmenu.cpp | 2 + + translations/ukui-menu_zh_CN.ts | 94 ++++++++++--------- + 4 files changed, 105 insertions(+), 47 deletions(-) + +diff --git a/src/UserInterface/RightClickMenu/rightclickmenu.cpp b/src/UserInterface/RightClickMenu/rightclickmenu.cpp +index 45f7b46..40d58e0 100755 +--- a/src/UserInterface/RightClickMenu/rightclickmenu.cpp ++++ b/src/UserInterface/RightClickMenu/rightclickmenu.cpp +@@ -19,11 +19,15 @@ + #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"); + m_whiteList.append("ukui-clock.desktop"); +@@ -141,14 +145,50 @@ void RightClickMenu::addToDesktopActionTriggerSlot() + + void RightClickMenu::uninstallActionTriggerSlot() + { +- QString cmd = QString("kylin-uninstaller %1") +- .arg(m_desktopfp.toLocal8Bit().data()); +- bool ret = QProcess::startDetached(cmd); +- myDebug() << "卸载:" << cmd << ret; +- myDebug() << "kylin-uninstaller"; ++ QString cmd=QString("rpm -qf "+m_desktopfp); ++ m_cmdProc->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/UserInterface/RightClickMenu/rightclickmenu.h b/src/UserInterface/RightClickMenu/rightclickmenu.h +index a96c65d..bba9cf1 100755 +--- a/src/UserInterface/RightClickMenu/rightclickmenu.h ++++ b/src/UserInterface/RightClickMenu/rightclickmenu.h +@@ -117,6 +117,12 @@ private Q_SLOTS: + * @brief Uninstall + */ + void uninstallActionTriggerSlot(); ++ ++ /** ++ * @brief Read command output ++ */ ++ void onReadOutput(); ++ + /** + * @brief Attribute + */ +diff --git a/src/UserInterface/RightClickMenu/tabletrightclickmenu.cpp b/src/UserInterface/RightClickMenu/tabletrightclickmenu.cpp +index 3dfdc5d..00e1a92 100755 +--- a/src/UserInterface/RightClickMenu/tabletrightclickmenu.cpp ++++ b/src/UserInterface/RightClickMenu/tabletrightclickmenu.cpp +@@ -19,6 +19,7 @@ + #include "tabletrightclickmenu.h" + #include "src/UtilityFunction/utility.h" + #include ++#include + + TabletRightClickMenu::TabletRightClickMenu(QWidget *parent): + QWidget(parent) +@@ -185,6 +186,7 @@ void TabletRightClickMenu::addToDesktopActionTriggerSlot() + + void TabletRightClickMenu::uninstallActionTriggerSlot() + { ++ syslog(LOG_ERR,"uninstallActionTriggerSlot!!!!!!!!!!!!!!!!\n"); + // QString cmd = QString("dpkg -S " + m_desktopfp); + // myDebug() << "void TabletRightClickMenu::uninstallActionTriggerSlot()" << m_desktopfp; + // m_cmdProc->setReadChannel(QProcess::StandardOutput); +diff --git a/translations/ukui-menu_zh_CN.ts b/translations/ukui-menu_zh_CN.ts +index d4abdca..88b52d1 100755 +--- a/translations/ukui-menu_zh_CN.ts ++++ b/translations/ukui-menu_zh_CN.ts +@@ -4,22 +4,22 @@ + + FullMainWindow + +- ++ + Search + 搜索应用 + + +- ++ + All + 全部 + + +- ++ + Letter + 字母排序 + + +- ++ + Function + 功能分类 + +@@ -27,7 +27,7 @@ + + FunctionWidget + +- ++ + Search + 全局搜索 + +@@ -35,51 +35,46 @@ + + MainWindow + +- ++ + Search + 搜索应用 + + +- +- +- ++ ++ ++ + All + 全部 + + +- +- ... +- +- +- +- ++ + collection + 收藏 + + +- ++ + recent + 最近 + + +- ++ + Max + 放大 + + +- ++ + PowerOff + 关机 + + +- +- ++ ++ + Letter + 字母排序 + + +- +- ++ ++ + Function + 功能分类 + +@@ -156,82 +151,97 @@ + + RightClickMenu + +- ++ ++ infomation ++ 提示 ++ ++ ++ ++ Uninstall finished! ++ 卸载成功! ++ ++ ++ ++ error ++ 错误 ++ ++ ++ + Pin to all + 固定到“所有软件” + + +- ++ + Unpin from all + 从“所有软件”取消固定 + + +- ++ + Pin to taskbar + 固定到任务栏 + + +- ++ + Unpin from taskbar + 从任务栏取消固定 + + +- ++ + Add to desktop shortcuts + 添加到桌面快捷方式 + + +- ++ + Pin to collection + 固定到收藏 + + +- ++ + Remove from collection + 从收藏移除 + + +- ++ + Uninstall + 卸载 + + +- ++ + Switch user + 切换用户 + + +- ++ + Hibernate + 休眠 + + +- ++ + Sleep + 睡眠 + + +- ++ + Lock Screen + 锁屏 + + +- ++ + Log Out + 注销 + + +- ++ + Restart + 重启 + + +- ++ + Power Off + 关机 + + +- ++ + Personalize this list + + +@@ -239,22 +249,22 @@ + + TabletRightClickMenu + +- ++ + Pin to taskbar + 固定到任务栏 + + +- ++ + Unpin from taskbar + 从任务栏取消固定 + + +- ++ + Add to desktop shortcuts + 固定到桌面快捷方式 + + +- ++ + Uninstall + 卸载 + +-- +2.33.0 + diff --git a/ukui-menu.spec b/ukui-menu.spec index f8e6b60..6e5a1d4 100644 --- a/ukui-menu.spec +++ b/ukui-menu.spec @@ -1,10 +1,11 @@ Name: ukui-menu Version: 3.1.1 -Release: 2 +Release: 3 Summary: Advanced ukui menu License: GPL-3.0-or-later URL: http://www.ukui.org Source0: %{name}-%{version}.tar.gz +Patch01: 0001-fix-uninstall-failed-issue.patch BuildRequires: qt5-qtbase-devel BuildRequires: libqtxdg-devel @@ -35,6 +36,7 @@ Requires: accountsservice %prep %setup -q +%patch01 -p1 %build mkdir build && cd build @@ -55,19 +57,22 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/ukui-menu/translations/ %changelog +* Wed Feb 1 2023 peijiankang - 3.1.1-3 +- fix uninstall failed issue + * Tue Jan 17 2023 peijiankang - 3.1.1-2 - add build debuginfo and debugsource * Thu Dec 01 2022 tanyulong - 3.1.1-1 - update upstream version 3.1.1 -* Wed Aug 8 2022 huayadong - 3.0.2-9 +* Mon Aug 8 2022 huayadong - 3.0.2-11 - Fixed application icon dragging problem -* Wed Aug 8 2022 huayadong - 3.0.2-9 +* Mon Aug 8 2022 huayadong - 3.0.2-10 - Fixed right click exception popover problem -* Wed Aug 8 2022 huayadong - 3.0.2-9 +* Mon Aug 8 2022 huayadong - 3.0.2-9 - add optimize the interaction strategy with the taskbar * Wed Jun 29 2022 huayadong - 3.0.2-8