From 28df1868cc1d0281585b879b821a47eaa03edc3f Mon Sep 17 00:00:00 2001 From: iaom Date: Fri, 1 Mar 2024 17:42:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=E5=88=A0=E9=99=A4=E6=89=98?= =?UTF-8?q?=E7=9B=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/mainwindow.cpp | 39 --------------------------------------- frontend/mainwindow.h | 4 ---- 2 files changed, 43 deletions(-) diff --git a/frontend/mainwindow.cpp b/frontend/mainwindow.cpp index 9dd2096..75487af 100644 --- a/frontend/mainwindow.cpp +++ b/frontend/mainwindow.cpp @@ -75,14 +75,6 @@ MainWindow::MainWindow(QWidget *parent) : initSettings(); initUi(); initTimer(); - - m_sys_tray_icon = new QSystemTrayIcon(this); - m_menu = new QMenu(this); - m_menu->addAction(IconLoader::loadIconQt("document-page-setup-symbolic", QIcon(":/res/icons/document-page-setup-symbolic.svg")), tr("Search Settings"), this, SLOT(openSearchSettings())); - m_sys_tray_icon->setContextMenu(m_menu); - m_sys_tray_icon->setIcon(IconLoader::loadIconQt("system-search-symbolic", QIcon(":/res/icons/edit-find-symbolic.svg"))); - m_sys_tray_icon->setToolTip(tr("Global Search")); - m_sys_tray_icon->show(); installEventFilter(this); initConnections(); @@ -147,7 +139,6 @@ void MainWindow::initUi() void MainWindow::initConnections() { - connect(m_sys_tray_icon, &QSystemTrayIcon::activated, this, &MainWindow::trayIconActivatedSlot); connect(QApplication::primaryScreen(), &QScreen::geometryChanged, this, &MainWindow::ScreenGeometryChanged); connect(m_askDialog, &CreateIndexAskDialog::closed, this, [ = ]() { m_isAskDialogVisible = false; @@ -476,33 +467,3 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event) return QObject::eventFilter(watched, event); } - -void MainWindow::openSearchSettings() { - bool res(false); - QDBusInterface* appLaunchInterface = new QDBusInterface(QStringLiteral("com.kylin.ProcessManager"), - QStringLiteral("/com/kylin/ProcessManager/AppLauncher"), - QStringLiteral("com.kylin.ProcessManager.AppLauncher"), - QDBusConnection::sessionBus()); - if(!appLaunchInterface->isValid()) { - qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message()); - res = false; - } else { - appLaunchInterface->setTimeout(10000); - QDBusReply reply = appLaunchInterface->call("LaunchAppWithArguments", "/usr/share/applications/ukui-control-center.desktop", QStringList{"-m", "search"}); - if(reply.isValid()) { - res = true; - } else { - qWarning() << "ProcessManager dbus called failed!" << reply.error(); - res = false; - } - } - if (appLaunchInterface) { - delete appLaunchInterface; - appLaunchInterface = nullptr; - } - - if (!res) { - //打开控制面板对应页面 - QProcess::startDetached("ukui-control-center", {"-m", "search"}); - } -} diff --git a/frontend/mainwindow.h b/frontend/mainwindow.h index 6fa541f..3a5a4d4 100644 --- a/frontend/mainwindow.h +++ b/frontend/mainwindow.h @@ -90,7 +90,6 @@ public Q_SLOTS: void searchKeywordSlot(const QString&); void resizeHeight(int height); void tryHide(); - void openSearchSettings(); Q_SIGNALS: void setText(QString keyword); @@ -102,12 +101,9 @@ private: bool tryHideMainwindow(); void setSearchMethodConfig(const bool& createIndex, const bool& noLongerAsk); - QMenu *m_menu = nullptr; - SearchBarWidget *m_searchBarWidget; SearchResultPage *m_searchResultPage; - QSystemTrayIcon *m_sys_tray_icon = nullptr; CreateIndexAskDialog *m_askDialog = nullptr; bool m_isAskDialogVisible = false;