diff --git a/qml/AppControls2/AppItem.qml b/qml/AppControls2/AppItem.qml index 0058130..2e14b09 100644 --- a/qml/AppControls2/AppItem.qml +++ b/qml/AppControls2/AppItem.qml @@ -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() } } } diff --git a/qml/AppUI/AppList.qml b/qml/AppUI/AppList.qml index e6ca705..ccb5813 100644 --- a/qml/AppUI/AppList.qml +++ b/qml/AppUI/AppList.qml @@ -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 diff --git a/qml/AppUI/SearchInputBar.qml b/qml/AppUI/SearchInputBar.qml index b6a11c4..c16a8b2 100644 --- a/qml/AppUI/SearchInputBar.qml +++ b/qml/AppUI/SearchInputBar.qml @@ -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 diff --git a/src/extension/favorite/favorite-context-menu.cpp b/src/extension/favorite/favorite-context-menu.cpp index fa04d2b..ba95d57 100644 --- a/src/extension/favorite/favorite-context-menu.cpp +++ b/src/extension/favorite/favorite-context-menu.cpp @@ -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"); }); diff --git a/src/extension/menu/app-menu-plugin.cpp b/src/extension/menu/app-menu-plugin.cpp index 3401e53..1a66284 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; @@ -97,30 +103,30 @@ void AppContentMenu::addToTop(QObject *parent, const QString &appId, const int & void AppContentMenu::addToPanelAction(QObject *parent, const QString &appId, QList &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 isFixedOnTaskBar = iface.call("CheckIfExist", appId); + QDBusReply 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 &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/src/libappdata/app-database-interface.cpp b/src/libappdata/app-database-interface.cpp index 6526f59..11c0315 100644 --- a/src/libappdata/app-database-interface.cpp +++ b/src/libappdata/app-database-interface.cpp @@ -80,6 +80,7 @@ AppDatabaseWorkerPrivate::AppDatabaseWorkerPrivate(AppDatabaseInterface *parent) // 默认收藏应用 for (const auto &appid : GlobalSetting::instance()->defaultFavoriteApps()) { appDatabase->setAppToFavorites(appid); + appDatabase->setAppLaunchedState(appid, true); } } diff --git a/src/libappdata/recently-installed-model.cpp b/src/libappdata/recently-installed-model.cpp index 240c374..006fbb8 100644 --- a/src/libappdata/recently-installed-model.cpp +++ b/src/libappdata/recently-installed-model.cpp @@ -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); } diff --git a/src/windows/menu-main-window.cpp b/src/windows/menu-main-window.cpp index 53837ce..3f2fdcb 100644 --- a/src/windows/menu-main-window.cpp +++ b/src/windows/menu-main-window.cpp @@ -20,7 +20,6 @@ #include "settings.h" #include "context-menu-manager.h" -#include #include #include #include @@ -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); diff --git a/src/windows/menu-main-window.h b/src/windows/menu-main-window.h index 38fe984..5722687 100644 --- a/src/windows/menu-main-window.h +++ b/src/windows/menu-main-window.h @@ -25,6 +25,7 @@ #include #include #include +#include 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 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..6217a84 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 + 從清單中删除 @@ -335,27 +339,27 @@ UkuiMenu::PowerButton power - 權力 + 電源 Switch user - 切換使用者 + 切換用戶 Hibernate - 冬眠 + 休眠 Suspend - 暫停 + 睡眠 Lock Screen - 鎖屏介面 + 鎖定荧幕 Log Out - 登出 + 註銷 Reboot