fix(src): 【需求25776】【开始菜单】最新安装应用的右键菜单缺失“从列表中删除”
This commit is contained in:
parent
c296e07e21
commit
c9be7becd7
|
@ -28,6 +28,7 @@
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
namespace UkuiMenu {
|
namespace UkuiMenu {
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@ private:
|
||||||
static void addToPanelAction(QObject *parent, const QString &appId, QList<QAction *> &list);
|
static void addToPanelAction(QObject *parent, const QString &appId, QList<QAction *> &list);
|
||||||
static void addToDesktopAction(QObject *parent, const QString &appId, QList<QAction *> &list);
|
static void addToDesktopAction(QObject *parent, const QString &appId, QList<QAction *> &list);
|
||||||
static void addUninstall(QObject *parent, const QString &appId, QList<QAction *> &list);
|
static void addUninstall(QObject *parent, const QString &appId, QList<QAction *> &list);
|
||||||
|
static void addRemoveFromList(QObject *parent, const QString &appId, const int &appLaunched, const QString &appInsertTime, QList<QAction *> &list);
|
||||||
};
|
};
|
||||||
|
|
||||||
int AppContentMenu::index() const
|
int AppContentMenu::index() const
|
||||||
|
@ -60,6 +62,8 @@ QList<QAction *> AppContentMenu::actions(const DataEntity &data, QMenu *parent,
|
||||||
QList<QAction *> list;
|
QList<QAction *> list;
|
||||||
QString appId = data.id();
|
QString appId = data.id();
|
||||||
int appTop = data.top();
|
int appTop = data.top();
|
||||||
|
int appLaunched = data.launched();
|
||||||
|
QString appInsertTime = data.insertTime();
|
||||||
|
|
||||||
switch (location) {
|
switch (location) {
|
||||||
case MenuInfo::AppList: {
|
case MenuInfo::AppList: {
|
||||||
|
@ -78,6 +82,8 @@ QList<QAction *> AppContentMenu::actions(const DataEntity &data, QMenu *parent,
|
||||||
addUninstall(parent, appId, list);
|
addUninstall(parent, appId, list);
|
||||||
//添加到桌面快捷方式
|
//添加到桌面快捷方式
|
||||||
addToDesktopAction(parent, appId, list);
|
addToDesktopAction(parent, appId, list);
|
||||||
|
//添加从当前列表移除
|
||||||
|
addRemoveFromList(parent, appId, appLaunched, appInsertTime, list);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -173,6 +179,23 @@ void AppContentMenu::addUninstall(QObject *parent, const QString &appId, QList<Q
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppContentMenu::addRemoveFromList(QObject *parent, const QString &appId, const int &appLaunched, const QString &appInsertTime, QList<QAction *> &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 ====== //
|
// ====== AppMenuPlugin ====== //
|
||||||
QString AppMenuPlugin::id()
|
QString AppMenuPlugin::id()
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
<source>Create a new folder</source>
|
<source>Create a new folder</source>
|
||||||
<translation>ཉེར་སྤྱོད་ཚོ་ཆུང་གསར་འཛུགས་བྱ་དགོས།</translation>
|
<translation>ཉེར་སྤྱོད་ཚོ་ཆུང་གསར་འཛུགས་བྱ་དགོས།</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove from List</source>
|
||||||
|
<translation>རེའུ་མིག་ནང་ནས་བསུབ་དགོས།</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchInputBar</name>
|
<name>SearchInputBar</name>
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
<source>Create a new folder</source>
|
<source>Create a new folder</source>
|
||||||
<translation>Erstellen einer Anwendungsgruppe</translation>
|
<translation>Erstellen einer Anwendungsgruppe</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove from List</source>
|
||||||
|
<translation>Aus Liste entfernen</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchInputBar</name>
|
<name>SearchInputBar</name>
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
<source>Create a new folder</source>
|
<source>Create a new folder</source>
|
||||||
<translation>Creación de un grupo de aplicaciones</translation>
|
<translation>Creación de un grupo de aplicaciones</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove from List</source>
|
||||||
|
<translation>Quitar de la lista</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchInputBar</name>
|
<name>SearchInputBar</name>
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
<source>Create a new folder</source>
|
<source>Create a new folder</source>
|
||||||
<translation>Créer un groupe d’applications</translation>
|
<translation>Créer un groupe d’applications</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove from List</source>
|
||||||
|
<translation>Retirer de la liste</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchInputBar</name>
|
<name>SearchInputBar</name>
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
<source>Create a new folder</source>
|
<source>Create a new folder</source>
|
||||||
<translation>Бағдарлама тобын жасау</translation>
|
<translation>Бағдарлама тобын жасау</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove from List</source>
|
||||||
|
<translation>Тізімнен жою</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchInputBar</name>
|
<name>SearchInputBar</name>
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
<source>Create a new folder</source>
|
<source>Create a new folder</source>
|
||||||
<translation>Тиркеме тобун түзүү</translation>
|
<translation>Тиркеме тобун түзүү</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove from List</source>
|
||||||
|
<translation>Тизмеден чыгаруу</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchInputBar</name>
|
<name>SearchInputBar</name>
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
<source>Create a new folder</source>
|
<source>Create a new folder</source>
|
||||||
<translation>ᠬᠡᠷᠡᠭᠯᠡᠭᠡᠨ ᠦ ᠳᠤᠭᠤᠶᠢᠯᠠᠩ ᠢ ᠰᠢᠨᠡ ᠪᠡᠷ ᠪᠠᠶᠢᠭᠤᠯᠤᠨᠠ</translation>
|
<translation>ᠬᠡᠷᠡᠭᠯᠡᠭᠡᠨ ᠦ ᠳᠤᠭᠤᠶᠢᠯᠠᠩ ᠢ ᠰᠢᠨᠡ ᠪᠡᠷ ᠪᠠᠶᠢᠭᠤᠯᠤᠨᠠ</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove from List</source>
|
||||||
|
<translation>ᠵᠢᠭᠰᠠᠭᠠᠯᠲᠠ ᠶᠢᠨ ᠬᠦᠰᠦᠨᠦᠭᠲᠦ ᠡᠴᠡ ᠬᠠᠰᠤᠨᠠ ᠃</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchInputBar</name>
|
<name>SearchInputBar</name>
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
<source>Create a new folder</source>
|
<source>Create a new folder</source>
|
||||||
<translation>يېڭىدىن قوللىنىش گۇرۇپپىسى قۇرما</translation>
|
<translation>يېڭىدىن قوللىنىش گۇرۇپپىسى قۇرما</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove from List</source>
|
||||||
|
<translation>تىزىملىكتىن چىقىرىۋەتمەك</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchInputBar</name>
|
<name>SearchInputBar</name>
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
<source>Create a new folder</source>
|
<source>Create a new folder</source>
|
||||||
<translation>新建应用组</translation>
|
<translation>新建应用组</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove from List</source>
|
||||||
|
<translation>从列表中删除</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchInputBar</name>
|
<name>SearchInputBar</name>
|
||||||
|
|
|
@ -105,7 +105,11 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Create a new folder</source>
|
<source>Create a new folder</source>
|
||||||
<translation>创建新文件夹</translation>
|
<translation>創建新資料夾</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove from List</source>
|
||||||
|
<translation>從清單中删除</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
|
Loading…
Reference in New Issue