feat(frontend):删除托盘功能

This commit is contained in:
iaom 2024-03-01 17:42:20 +08:00
parent 37d7040669
commit 28df1868cc
2 changed files with 0 additions and 43 deletions

View File

@ -75,14 +75,6 @@ MainWindow::MainWindow(QWidget *parent) :
initSettings(); initSettings();
initUi(); initUi();
initTimer(); 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); installEventFilter(this);
initConnections(); initConnections();
@ -147,7 +139,6 @@ void MainWindow::initUi()
void MainWindow::initConnections() void MainWindow::initConnections()
{ {
connect(m_sys_tray_icon, &QSystemTrayIcon::activated, this, &MainWindow::trayIconActivatedSlot);
connect(QApplication::primaryScreen(), &QScreen::geometryChanged, this, &MainWindow::ScreenGeometryChanged); connect(QApplication::primaryScreen(), &QScreen::geometryChanged, this, &MainWindow::ScreenGeometryChanged);
connect(m_askDialog, &CreateIndexAskDialog::closed, this, [ = ]() { connect(m_askDialog, &CreateIndexAskDialog::closed, this, [ = ]() {
m_isAskDialogVisible = false; m_isAskDialogVisible = false;
@ -476,33 +467,3 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event)
return QObject::eventFilter(watched, 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<void> 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"});
}
}

View File

@ -90,7 +90,6 @@ public Q_SLOTS:
void searchKeywordSlot(const QString&); void searchKeywordSlot(const QString&);
void resizeHeight(int height); void resizeHeight(int height);
void tryHide(); void tryHide();
void openSearchSettings();
Q_SIGNALS: Q_SIGNALS:
void setText(QString keyword); void setText(QString keyword);
@ -102,12 +101,9 @@ private:
bool tryHideMainwindow(); bool tryHideMainwindow();
void setSearchMethodConfig(const bool& createIndex, const bool& noLongerAsk); void setSearchMethodConfig(const bool& createIndex, const bool& noLongerAsk);
QMenu *m_menu = nullptr;
SearchBarWidget *m_searchBarWidget; SearchBarWidget *m_searchBarWidget;
SearchResultPage *m_searchResultPage; SearchResultPage *m_searchResultPage;
QSystemTrayIcon *m_sys_tray_icon = nullptr;
CreateIndexAskDialog *m_askDialog = nullptr; CreateIndexAskDialog *m_askDialog = nullptr;
bool m_isAskDialogVisible = false; bool m_isAskDialogVisible = false;