diff --git a/frontend/mainwindow.cpp b/frontend/mainwindow.cpp index c9c847e..4cab030 100644 --- a/frontend/mainwindow.cpp +++ b/frontend/mainwindow.cpp @@ -77,6 +77,9 @@ MainWindow::MainWindow(QWidget *parent) : 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(); @@ -462,3 +465,33 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event) return QObject::eventFilter(watched, event); } + +void MainWindow::openSearchSettings() { + bool res(false); + QDBusInterface* appLaunchInterface = new QDBusInterface("com.kylin.AppManager", + "/com/kylin/AppManager", + "com.kylin.AppManager", + QDBusConnection::sessionBus()); + if(!appLaunchInterface->isValid()) { + qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message()); + res = false; + } else { + appLaunchInterface->setTimeout(10000); + QDBusReply reply = appLaunchInterface->call("LaunchAppWithArguments", "ukui-control-center.desktop", QStringList() << "-m" << "search"); + if(reply.isValid()) { + res = reply; + } else { + qWarning() << "SoftWareCenter dbus called failed!"; + 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 7ced129..fe2a1ce 100644 --- a/frontend/mainwindow.h +++ b/frontend/mainwindow.h @@ -90,6 +90,7 @@ public Q_SLOTS: void searchKeywordSlot(const QString&); void resizeHeight(int height); void tryHide(); + void openSearchSettings(); Q_SIGNALS: void setText(QString keyword); @@ -101,6 +102,8 @@ private: bool tryHideMainwindow(); void setSearchMethodConfig(const bool& createIndex, const bool& noLongerAsk); + QMenu *m_menu = nullptr; + SeachBarWidget *m_searchBarWidget; SearchResultPage *m_searchResultPage; diff --git a/frontend/res/icons/document-page-setup-symbolic.svg b/frontend/res/icons/document-page-setup-symbolic.svg new file mode 100644 index 0000000..15c7f45 --- /dev/null +++ b/frontend/res/icons/document-page-setup-symbolic.svg @@ -0,0 +1 @@ +document-properties-symbolic \ No newline at end of file diff --git a/frontend/resource.qrc b/frontend/resource.qrc index 5187069..efe4bc2 100644 --- a/frontend/resource.qrc +++ b/frontend/resource.qrc @@ -7,5 +7,6 @@ res/icons/system-search.symbolic.png res/icons/ukui-up-symbolic.svg res/icons/ukui-down-symbolic.svg + res/icons/document-page-setup-symbolic.svg diff --git a/translations/ukui-search/appwidget/search_bo_CN.ts b/translations/ukui-search/appwidget/search_bo_CN.ts index 193124e..fd0bdeb 100644 --- a/translations/ukui-search/appwidget/search_bo_CN.ts +++ b/translations/ukui-search/appwidget/search_bo_CN.ts @@ -56,6 +56,11 @@ + Search Settings + + + + Global Search diff --git a/translations/ukui-search/appwidget/search_mn.ts b/translations/ukui-search/appwidget/search_mn.ts index eba127d..f842906 100644 --- a/translations/ukui-search/appwidget/search_mn.ts +++ b/translations/ukui-search/appwidget/search_mn.ts @@ -56,6 +56,11 @@ + Search Settings + + + + Global Search diff --git a/translations/ukui-search/appwidget/search_zh_CN.ts b/translations/ukui-search/appwidget/search_zh_CN.ts index 2dd96d8..f807fe9 100644 --- a/translations/ukui-search/appwidget/search_zh_CN.ts +++ b/translations/ukui-search/appwidget/search_zh_CN.ts @@ -49,6 +49,10 @@ Global Search + + Search Settings + + UkuiSearch::SearchLineEdit diff --git a/translations/ukui-search/appwidget/search_zh_HK.ts b/translations/ukui-search/appwidget/search_zh_HK.ts index 6d3dd58..88de1b4 100644 --- a/translations/ukui-search/appwidget/search_zh_HK.ts +++ b/translations/ukui-search/appwidget/search_zh_HK.ts @@ -56,6 +56,11 @@ + Search Settings + + + + Global Search diff --git a/translations/ukui-search/bo_CN.ts b/translations/ukui-search/bo_CN.ts index 2871db6..7b28e6e 100644 --- a/translations/ukui-search/bo_CN.ts +++ b/translations/ukui-search/bo_CN.ts @@ -67,6 +67,11 @@ + Search Settings + འཚོལ་ཞིབ་ཀྱི་རྣམ་གྲངས་བཟོ་དགོས། + + + Global Search འཚོལ་བཤེར། diff --git a/translations/ukui-search/mn.ts b/translations/ukui-search/mn.ts index 09cbeb1..bf07d45 100644 --- a/translations/ukui-search/mn.ts +++ b/translations/ukui-search/mn.ts @@ -67,6 +67,11 @@ + Search Settings + ᠡᠷᠢᠬᠦ ᠵᠦᠢᠯ ᠲᠣᠬᠢᠷᠠᠭᠤᠯᠤᠨ᠎ᠠ ᠃ + + + Global Search ᠬᠠᠢᠯᠲᠠ diff --git a/translations/ukui-search/tr.ts b/translations/ukui-search/tr.ts index 5961d79..87307a6 100644 --- a/translations/ukui-search/tr.ts +++ b/translations/ukui-search/tr.ts @@ -363,6 +363,11 @@ + Search Settings + + + + Global Search Genel Arama diff --git a/translations/ukui-search/zh_CN.ts b/translations/ukui-search/zh_CN.ts index c44f1ac..2502d18 100644 --- a/translations/ukui-search/zh_CN.ts +++ b/translations/ukui-search/zh_CN.ts @@ -129,6 +129,11 @@ + Search Settings + 设置搜索项 + + + Global Search 搜索 diff --git a/translations/ukui-search/zh_HK.ts b/translations/ukui-search/zh_HK.ts index 40eda47..e4d7bb7 100644 --- a/translations/ukui-search/zh_HK.ts +++ b/translations/ukui-search/zh_HK.ts @@ -60,6 +60,11 @@ + Search Settings + 設置搜索項 + + + Global Search 全域搜索