Merge tag 'upstream/4.10.2.0' into packaging/openkylin/nile

4.10.2.0-release
This commit is contained in:
hewenfei 2024-05-16 20:38:17 +08:00
commit 9ae8f2d001
19 changed files with 115 additions and 30 deletions

View File

@ -9,6 +9,7 @@ import org.ukui.quick.items 1.0 as UkuiItems
MouseArea {
id: control
property bool isSelect: false
property bool isRecentInstalled: false
hoverEnabled: true
states: State {
when: control.activeFocus
@ -51,17 +52,30 @@ MouseArea {
spacing: 12
}
Extension.EditModeFlag {
Item {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.fillWidth: true
Layout.fillHeight: true
Layout.maximumWidth: visible ? 28 : 0
Layout.maximumWidth: tagLabel.visible ? 28 : isRecentInstalled ? 8 : 0
Layout.maximumHeight: width
Layout.rightMargin: visible ? 4 : 0
Layout.rightMargin: tagLabel.visible ? 4 : 0
isFavorited: favorite
onClicked: {
appManager.changeFavoriteState(id, !isFavorited);
Extension.EditModeFlag {
id: tagLabel
anchors.fill: parent
isFavorited: favorite
onClicked: {
appManager.changeFavoriteState(id, !isFavorited);
}
}
Rectangle {
id: tagPoint
visible: tagLabel.sourceComponent != null ? false : isRecentInstalled
anchors.centerIn: parent
width: 8; height: width
radius: width / 2
color: Platform.Theme.highlight()
}
}
}

View File

@ -61,6 +61,7 @@ AppListView {
height: appListView.itemHeight
anchors.centerIn: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
isRecentInstalled: model.recentInstall
Drag.hotSpot.x: 48 / 2
Drag.hotSpot.y: 48 / 2

View File

@ -79,8 +79,8 @@ UkuiItems.StyleBackground {
TextInput {
id: textInput
clip: true
anchors.right: parent.right
width: parent.width - searchIcon.width
anchors.right: clearButton.left
width: parent.width - searchIcon.width - clearButton.width
height: parent.height
selectByMouse: true
verticalAlignment: TextInput.AlignVCenter
@ -113,6 +113,7 @@ UkuiItems.StyleBackground {
}
UkuiItems.Button {
id: clearButton
anchors.right: parent.right
anchors.rightMargin: (parent.height - height) / 2
anchors.verticalCenter: parent.verticalCenter

View File

@ -55,6 +55,7 @@ FavoriteContextMenu::actions(const DataEntity &data, QMenu *parent, const MenuIn
list << new QAction(QObject::tr("Fix to favorite"), parent);
QObject::connect(list.last(), &QAction::triggered, parent, [data] {
FavoritesModel::instance().addAppToFavorites(data.id());
BasicAppModel::instance()->databaseInterface()->updateApLaunchedState(data.id(), true);
//BasicAppModel::instance()->databaseInterface()->fixAppToFavorite(data.id(), 1);
EventTrack::instance()->sendDefaultEvent("fix_to_favorite", "Right-click Menu");
});

View File

@ -28,6 +28,7 @@
#include <QStandardPaths>
#include <QFileInfo>
#include <QProcess>
#include <QDateTime>
namespace UkuiMenu {
@ -43,6 +44,7 @@ private:
static void addToPanelAction(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 addRemoveFromList(QObject *parent, const QString &appId, const int &appLaunched, const QString &appInsertTime, QList<QAction *> &list);
};
int AppContentMenu::index() const
@ -60,6 +62,8 @@ QList<QAction *> AppContentMenu::actions(const DataEntity &data, QMenu *parent,
QList<QAction *> 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<QAction *> AppContentMenu::actions(const DataEntity &data, QMenu *parent,
addUninstall(parent, appId, list);
//添加到桌面快捷方式
addToDesktopAction(parent, appId, list);
//添加从当前列表移除
addRemoveFromList(parent, appId, appLaunched, appInsertTime, list);
break;
default:
break;
@ -97,30 +103,30 @@ void AppContentMenu::addToTop(QObject *parent, const QString &appId, const int &
void AppContentMenu::addToPanelAction(QObject *parent, const QString &appId, QList<QAction *> &list)
{
QDBusInterface iface("com.ukui.panel.desktop", "/", "com.ukui.panel.desktop", QDBusConnection::sessionBus());
QDBusInterface iface("org.ukui.taskManager", "/taskManager", "org.ukui.taskManager", QDBusConnection::sessionBus());
if (!iface.isValid()) {
qWarning() << "Panel desktop dbusinterface error";
qWarning() << "Ukui taskManager dbusinterface error";
return;
}
iface.setTimeout(1);
QDBusReply<bool> isFixedOnTaskBar = iface.call("CheckIfExist", appId);
QDBusReply<bool> isFixedOnTaskBar = iface.call("checkQuickLauncher", appId);
if (!isFixedOnTaskBar.isValid()) {
qWarning() << "Panel desktop dbusinterface call CheckIfExist timeout";
qWarning() << "Ukui taskManager dbusinterface call checkQuickLauncher timeout";
return;
}
QString actionName = isFixedOnTaskBar ? QObject::tr("Remove from taskbar") : QObject::tr("Add to taskbar");
QString functionName = isFixedOnTaskBar ? "RemoveFromTaskbar" : "AddToTaskbar";
QString functionName = isFixedOnTaskBar ? "removeQuickLauncher" : "addQuickLauncher";
list << new QAction(actionName, parent);
QObject::connect(list.last(), &QAction::triggered, parent, [appId, functionName] {
QDBusInterface iface("com.ukui.panel.desktop", "/", "com.ukui.panel.desktop", QDBusConnection::sessionBus());
QDBusInterface iface("org.ukui.taskManager", "/taskManager", "org.ukui.taskManager", QDBusConnection::sessionBus());
if (!iface.isValid()) {
qWarning() << "Panel desktop dbusinterface error";
qWarning() << "Ukui taskManager dbusinterface error";
return;
}
@ -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 ====== //
QString AppMenuPlugin::id()
{

View File

@ -80,6 +80,7 @@ AppDatabaseWorkerPrivate::AppDatabaseWorkerPrivate(AppDatabaseInterface *parent)
// 默认收藏应用
for (const auto &appid : GlobalSetting::instance()->defaultFavoriteApps()) {
appDatabase->setAppToFavorites(appid);
appDatabase->setAppLaunchedState(appid, true);
}
}

View File

@ -97,6 +97,10 @@ QVariant RecentlyInstalledModel::data(const QModelIndex &index, int role) const
return tr("Recently Installed");
}
if (role == DataEntity::RecentInstall) {
return true;
}
return QSortFilterProxyModel::data(index, role);
}

View File

@ -20,7 +20,6 @@
#include "settings.h"
#include "context-menu-manager.h"
#include <window-helper.h>
#include <QGuiApplication>
#include <QQuickItem>
#include <QX11Info>
@ -240,8 +239,8 @@ void MenuWindow::init()
//setWindowState(Qt::WindowMaximized);
setFlags(flags() | Qt::Window | Qt::FramelessWindowHint);
new UkuiQuick::WindowProxy(this, UkuiQuick::WindowProxy::SkipSwitcher | UkuiQuick::WindowProxy::SkipTaskBar);
KWindowSystem::setType(winId(), NET::SystemWindow);
m_windowProxy = new UkuiQuick::WindowProxy(this);
m_windowProxy->setWindowType(UkuiQuick::WindowType::SystemWindow);
// 访问窗口api
rootContext()->setContextProperty("mainWindow", this);
@ -296,9 +295,9 @@ void MenuWindow::initPanelSetting()
void MenuWindow::updateGeometry()
{
updateCurrentScreenGeometry();
UkuiQuick::WindowProxy::setWindowGeometry(this, m_fullScreenGeometry);
setMinimumSize(geometry().size());
setMaximumSize(geometry().size());
setMinimumSize(m_fullScreenGeometry.size());
setMaximumSize(m_fullScreenGeometry.size());
m_windowProxy->setGeometry(m_fullScreenGeometry);
updateGeometryOfMask();
WindowHelper::setRegion(this, m_maskGeometry.x(), m_maskGeometry.y(), m_maskGeometry.width(), m_maskGeometry.height(), 16);
@ -355,8 +354,6 @@ void MenuWindow::focusOutEvent(QFocusEvent *event)
bool MenuWindow::event(QEvent *event)
{
if (event->type() == QEvent::Show) {
KWindowSystem::setType(winId(), NET::SystemWindow);
updateGeometry();
if (QX11Info::isPlatformX11()) {
requestActivate();
}
@ -486,6 +483,7 @@ void MenuWindow::activeMenuWindow(bool active)
}
}
this->setScreen(currrentScreen ? currrentScreen : QGuiApplication::primaryScreen());
updateGeometry();
}
setVisible(active);

View File

@ -25,6 +25,7 @@
#include <QQuickView>
#include <QQuickWindow>
#include <QGSettings>
#include <window-helper.h>
namespace UkuiMenu {
@ -135,6 +136,7 @@ private:
QRect m_normalGeometry = QRect(0,0,0,0);
QRect m_fullScreenGeometry = QRect(0,0,0,0);
QGSettings *m_setting {nullptr};
UkuiQuick::WindowProxy *m_windowProxy {nullptr};
};
} // UkuiMenu

View File

@ -107,6 +107,10 @@
<source>Create a new folder</source>
<translation></translation>
</message>
<message>
<source>Remove from List</source>
<translation></translation>
</message>
</context>
<context>
<name>SearchInputBar</name>

View File

@ -107,6 +107,10 @@
<source>Create a new folder</source>
<translation>Erstellen einer Anwendungsgruppe</translation>
</message>
<message>
<source>Remove from List</source>
<translation>Aus Liste entfernen</translation>
</message>
</context>
<context>
<name>SearchInputBar</name>

View File

@ -107,6 +107,10 @@
<source>Create a new folder</source>
<translation>Creación de un grupo de aplicaciones</translation>
</message>
<message>
<source>Remove from List</source>
<translation>Quitar de la lista</translation>
</message>
</context>
<context>
<name>SearchInputBar</name>

View File

@ -107,6 +107,10 @@
<source>Create a new folder</source>
<translation>Créer un groupe dapplications</translation>
</message>
<message>
<source>Remove from List</source>
<translation>Retirer de la liste</translation>
</message>
</context>
<context>
<name>SearchInputBar</name>

View File

@ -107,6 +107,10 @@
<source>Create a new folder</source>
<translation>Бағдарлама тобын жасау</translation>
</message>
<message>
<source>Remove from List</source>
<translation>Тізімнен жою</translation>
</message>
</context>
<context>
<name>SearchInputBar</name>

View File

@ -107,6 +107,10 @@
<source>Create a new folder</source>
<translation>Тиркеме тобун түзүү</translation>
</message>
<message>
<source>Remove from List</source>
<translation>Тизмеден чыгаруу</translation>
</message>
</context>
<context>
<name>SearchInputBar</name>

View File

@ -107,6 +107,10 @@
<source>Create a new folder</source>
<translation> </translation>
</message>
<message>
<source>Remove from List</source>
<translation> </translation>
</message>
</context>
<context>
<name>SearchInputBar</name>

View File

@ -107,6 +107,10 @@
<source>Create a new folder</source>
<translation>يېڭىدىن قوللىنىش گۇرۇپپىسى قۇرما</translation>
</message>
<message>
<source>Remove from List</source>
<translation>تىزىملىكتىن چىقىرىۋەتمەك</translation>
</message>
</context>
<context>
<name>SearchInputBar</name>

View File

@ -107,6 +107,10 @@
<source>Create a new folder</source>
<translation></translation>
</message>
<message>
<source>Remove from List</source>
<translation></translation>
</message>
</context>
<context>
<name>SearchInputBar</name>

View File

@ -105,7 +105,11 @@
</message>
<message>
<source>Create a new folder</source>
<translation></translation>
<translation></translation>
</message>
<message>
<source>Remove from List</source>
<translation></translation>
</message>
</context>
<context>
@ -335,27 +339,27 @@
<name>UkuiMenu::PowerButton</name>
<message>
<source>power</source>
<translation></translation>
<translation></translation>
</message>
<message>
<source>Switch user</source>
<translation>使</translation>
<translation></translation>
</message>
<message>
<source>Hibernate</source>
<translation></translation>
<translation></translation>
</message>
<message>
<source>Suspend</source>
<translation></translation>
<translation></translation>
</message>
<message>
<source>Lock Screen</source>
<translation></translation>
<translation></translation>
</message>
<message>
<source>Log Out</source>
<translation></translation>
<translation></translation>
</message>
<message>
<source>Reboot</source>