From c9be7becd7aafa50c83e52e5e14bbdb7c57e37d9 Mon Sep 17 00:00:00 2001 From: youdiansaodongxi Date: Tue, 30 Apr 2024 15:18:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(src):=20=E3=80=90=E9=9C=80=E6=B1=8225776?= =?UTF-8?q?=E3=80=91=E3=80=90=E5=BC=80=E5=A7=8B=E8=8F=9C=E5=8D=95=E3=80=91?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E5=AE=89=E8=A3=85=E5=BA=94=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95=E7=BC=BA=E5=A4=B1=E2=80=9C?= =?UTF-8?q?=E4=BB=8E=E5=88=97=E8=A1=A8=E4=B8=AD=E5=88=A0=E9=99=A4=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/extension/menu/app-menu-plugin.cpp | 23 +++++++++++++++++++++++ translations/ukui-menu_bo_CN.ts | 4 ++++ translations/ukui-menu_de.ts | 4 ++++ translations/ukui-menu_es.ts | 4 ++++ translations/ukui-menu_fr.ts | 4 ++++ translations/ukui-menu_kk_KZ.ts | 4 ++++ translations/ukui-menu_ky_KG.ts | 4 ++++ translations/ukui-menu_mn.ts | 4 ++++ translations/ukui-menu_ug_CN.ts | 4 ++++ translations/ukui-menu_zh_CN.ts | 4 ++++ translations/ukui-menu_zh_HK.ts | 6 +++++- 11 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/extension/menu/app-menu-plugin.cpp b/src/extension/menu/app-menu-plugin.cpp index 3401e53..3312c57 100644 --- a/src/extension/menu/app-menu-plugin.cpp +++ b/src/extension/menu/app-menu-plugin.cpp @@ -28,6 +28,7 @@ #include #include #include +#include namespace UkuiMenu { @@ -43,6 +44,7 @@ private: static void addToPanelAction(QObject *parent, const QString &appId, QList &list); static void addToDesktopAction(QObject *parent, const QString &appId, QList &list); static void addUninstall(QObject *parent, const QString &appId, QList &list); + static void addRemoveFromList(QObject *parent, const QString &appId, const int &appLaunched, const QString &appInsertTime, QList &list); }; int AppContentMenu::index() const @@ -60,6 +62,8 @@ QList AppContentMenu::actions(const DataEntity &data, QMenu *parent, QList list; QString appId = data.id(); int appTop = data.top(); + int appLaunched = data.launched(); + QString appInsertTime = data.insertTime(); switch (location) { case MenuInfo::AppList: { @@ -78,6 +82,8 @@ QList AppContentMenu::actions(const DataEntity &data, QMenu *parent, addUninstall(parent, appId, list); //添加到桌面快捷方式 addToDesktopAction(parent, appId, list); + //添加从当前列表移除 + addRemoveFromList(parent, appId, appLaunched, appInsertTime, list); break; default: break; @@ -173,6 +179,23 @@ void AppContentMenu::addUninstall(QObject *parent, const QString &appId, QList &list) +{ + if (appLaunched == 1) return; + + QDateTime installDate = QDateTime::fromString(appInsertTime, "yyyy-MM-dd hh:mm:ss"); + if (!installDate.isValid()) return; + QDateTime currentDateTime = QDateTime::currentDateTime(); + qint64 xt = currentDateTime.toSecsSinceEpoch() - installDate.toSecsSinceEpoch(); + + if ((xt >= 0) && (xt <= 30 * 24 * 3600)) { + list << new QAction(QObject::tr("Remove from List"), parent); + QObject::connect(list.last(), &QAction::triggered, parent, [appId] { + BasicAppModel::instance()->databaseInterface()->updateApLaunchedState(appId, true); + }); + } +} + // ====== AppMenuPlugin ====== // QString AppMenuPlugin::id() { diff --git a/translations/ukui-menu_bo_CN.ts b/translations/ukui-menu_bo_CN.ts index 3f55f4c..88693f7 100644 --- a/translations/ukui-menu_bo_CN.ts +++ b/translations/ukui-menu_bo_CN.ts @@ -107,6 +107,10 @@ Create a new folder ཉེར་སྤྱོད་ཚོ་ཆུང་གསར་འཛུགས་བྱ་དགོས། + + Remove from List + རེའུ་མིག་ནང་ནས་བསུབ་དགོས། + SearchInputBar diff --git a/translations/ukui-menu_de.ts b/translations/ukui-menu_de.ts index ccdf1fa..132f507 100644 --- a/translations/ukui-menu_de.ts +++ b/translations/ukui-menu_de.ts @@ -107,6 +107,10 @@ Create a new folder Erstellen einer Anwendungsgruppe + + Remove from List + Aus Liste entfernen + SearchInputBar diff --git a/translations/ukui-menu_es.ts b/translations/ukui-menu_es.ts index 98d9be6..caa65c7 100644 --- a/translations/ukui-menu_es.ts +++ b/translations/ukui-menu_es.ts @@ -107,6 +107,10 @@ Create a new folder Creación de un grupo de aplicaciones + + Remove from List + Quitar de la lista + SearchInputBar diff --git a/translations/ukui-menu_fr.ts b/translations/ukui-menu_fr.ts index 6f096f6..ded4dd9 100644 --- a/translations/ukui-menu_fr.ts +++ b/translations/ukui-menu_fr.ts @@ -107,6 +107,10 @@ Create a new folder Créer un groupe d’applications + + Remove from List + Retirer de la liste + SearchInputBar diff --git a/translations/ukui-menu_kk_KZ.ts b/translations/ukui-menu_kk_KZ.ts index 918aaad..82628d8 100644 --- a/translations/ukui-menu_kk_KZ.ts +++ b/translations/ukui-menu_kk_KZ.ts @@ -107,6 +107,10 @@ Create a new folder Бағдарлама тобын жасау + + Remove from List + Тізімнен жою + SearchInputBar diff --git a/translations/ukui-menu_ky_KG.ts b/translations/ukui-menu_ky_KG.ts index 2347b32..3b3903b 100644 --- a/translations/ukui-menu_ky_KG.ts +++ b/translations/ukui-menu_ky_KG.ts @@ -107,6 +107,10 @@ Create a new folder Тиркеме тобун түзүү + + Remove from List + Тизмеден чыгаруу + SearchInputBar diff --git a/translations/ukui-menu_mn.ts b/translations/ukui-menu_mn.ts index 6f45507..824aa0d 100644 --- a/translations/ukui-menu_mn.ts +++ b/translations/ukui-menu_mn.ts @@ -107,6 +107,10 @@ Create a new folder ᠬᠡᠷᠡᠭᠯᠡᠭᠡᠨ ᠦ ᠳᠤᠭᠤᠶᠢᠯᠠᠩ ᠢ ᠰᠢᠨ᠎ᠡ ᠪᠡᠷ ᠪᠠᠶᠢᠭᠤᠯᠤᠨ᠎ᠠ + + Remove from List + ᠵᠢᠭᠰᠠᠭᠠᠯᠲᠠ ᠶᠢᠨ ᠬᠦᠰᠦᠨᠦᠭᠲᠦ ᠡᠴᠡ ᠬᠠᠰᠤᠨ᠎ᠠ ᠃ + SearchInputBar diff --git a/translations/ukui-menu_ug_CN.ts b/translations/ukui-menu_ug_CN.ts index c8263dd..bb7d2e5 100644 --- a/translations/ukui-menu_ug_CN.ts +++ b/translations/ukui-menu_ug_CN.ts @@ -107,6 +107,10 @@ Create a new folder يېڭىدىن قوللىنىش گۇرۇپپىسى قۇرما + + Remove from List + تىزىملىكتىن چىقىرىۋەتمەك + SearchInputBar diff --git a/translations/ukui-menu_zh_CN.ts b/translations/ukui-menu_zh_CN.ts index eb838de..4185a76 100644 --- a/translations/ukui-menu_zh_CN.ts +++ b/translations/ukui-menu_zh_CN.ts @@ -107,6 +107,10 @@ Create a new folder 新建应用组 + + Remove from List + 从列表中删除 + SearchInputBar diff --git a/translations/ukui-menu_zh_HK.ts b/translations/ukui-menu_zh_HK.ts index 7e371ce..32d3d78 100644 --- a/translations/ukui-menu_zh_HK.ts +++ b/translations/ukui-menu_zh_HK.ts @@ -105,7 +105,11 @@ Create a new folder - 创建新文件夹 + 創建新資料夾 + + + Remove from List + 從清單中删除