feat(frontend):添加托盘图标右键菜单
This commit is contained in:
parent
4a5e47187e
commit
9a138e16df
|
@ -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<bool> 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"});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg id="设置" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.cls-1{fill:#1f2022;opacity:0.75;}</style></defs><title>document-properties-symbolic</title><path class="cls-1" d="M8,5.5A2.42,2.42,0,0,1,10.5,8,2.48,2.48,0,0,1,8,10.5,2.42,2.42,0,0,1,5.5,8,2.36,2.36,0,0,1,8,5.5m0-.8A3.3,3.3,0,1,0,11.3,8,3.33,3.33,0,0,0,8,4.7Z"/><path class="cls-1" d="M14.6,6.7a6,6,0,0,0-1-2.5l1-1L12.9,1.5l-1.1,1a7.71,7.71,0,0,0-2.5-1V0H6.7V1.4A6.19,6.19,0,0,0,4.2,2.5l-1-1L1.5,3.2l1,1a4.59,4.59,0,0,0-1,2.5H0V9.2H1.4a6,6,0,0,0,1,2.5l-1,1,1.7,1.7,1.1-1a7.71,7.71,0,0,0,2.5,1V16H9.2V14.6a6,6,0,0,0,2.5-1l1,1,1.7-1.7-1-1.1a7.71,7.71,0,0,0,1-2.5H16V6.7ZM8,13A5.08,5.08,0,0,1,3,8,5.08,5.08,0,0,1,8,3a5.08,5.08,0,0,1,5,5A5.08,5.08,0,0,1,8,13Z"/></svg>
|
After Width: | Height: | Size: 750 B |
|
@ -7,5 +7,6 @@
|
|||
<file>res/icons/system-search.symbolic.png</file>
|
||||
<file>res/icons/ukui-up-symbolic.svg</file>
|
||||
<file>res/icons/ukui-down-symbolic.svg</file>
|
||||
<file>res/icons/document-page-setup-symbolic.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -56,6 +56,11 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Search Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="84"/>
|
||||
<source>Global Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -56,6 +56,11 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Search Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="84"/>
|
||||
<source>Global Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -49,6 +49,10 @@
|
|||
<source>Global Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Search Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>UkuiSearch::SearchLineEdit</name>
|
||||
|
|
|
@ -56,6 +56,11 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Search Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="84"/>
|
||||
<source>Global Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -67,6 +67,11 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Search Settings</source>
|
||||
<translation>འཚོལ་ཞིབ་ཀྱི་རྣམ་གྲངས་བཟོ་དགོས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="84"/>
|
||||
<source>Global Search</source>
|
||||
<translation>འཚོལ་བཤེར།</translation>
|
||||
</message>
|
||||
|
|
|
@ -67,6 +67,11 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Search Settings</source>
|
||||
<translation>ᠡᠷᠢᠬᠦ ᠵᠦᠢᠯ ᠲᠣᠬᠢᠷᠠᠭᠤᠯᠤᠨᠠ ᠃</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="84"/>
|
||||
<source>Global Search</source>
|
||||
<translation>ᠬᠠᠢᠯᠲᠠ</translation>
|
||||
</message>
|
||||
|
|
|
@ -363,6 +363,11 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Search Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="84"/>
|
||||
<source>Global Search</source>
|
||||
<translation type="unfinished">Genel Arama</translation>
|
||||
</message>
|
||||
|
|
|
@ -129,6 +129,11 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Search Settings</source>
|
||||
<translation>设置搜索项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="84"/>
|
||||
<source>Global Search</source>
|
||||
<translation>搜索</translation>
|
||||
</message>
|
||||
|
|
|
@ -60,6 +60,11 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Search Settings</source>
|
||||
<translation>設置搜索項</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="84"/>
|
||||
<source>Global Search</source>
|
||||
<translation>全域搜索</translation>
|
||||
</message>
|
||||
|
|
Loading…
Reference in New Issue