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 + 從清單中删除