use dbus interface to search keyword
This commit is contained in:
parent
8ab2857b1b
commit
c6626ec369
|
@ -113,6 +113,11 @@ void SeachBarWidget::reSearch()
|
|||
Q_EMIT this->m_searchLineEdit->requestSearchKeyword(m_searchLineEdit->text());
|
||||
}
|
||||
|
||||
void SeachBarWidget::setText(QString keyword)
|
||||
{
|
||||
m_searchLineEdit->setText(keyword);
|
||||
}
|
||||
|
||||
void SeachBarWidget::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
|
|
|
@ -69,6 +69,9 @@ protected:
|
|||
Q_SIGNALS:
|
||||
void requestSearchKeyword(QString text);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setText(QString keyword);
|
||||
|
||||
private:
|
||||
SearchLineEdit *m_searchLineEdit;
|
||||
QHBoxLayout *m_ly;
|
||||
|
|
|
@ -31,7 +31,7 @@ include(view/view.pri)
|
|||
SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
ukui-search-dubs-service.cpp
|
||||
ukui-search-dbus-service.cpp
|
||||
|
||||
|
||||
HEADERS += \
|
||||
|
|
|
@ -171,6 +171,7 @@ void MainWindow::initConnections()
|
|||
connect(m_searchBarWidget, &SeachBarWidget::requestSearchKeyword, this, &MainWindow::searchKeywordSlot);
|
||||
// connect(m_stackedWidget, &StackedWidget::effectiveSearch, m_searchLayout, &SearchBarHLayout::effectiveSearchRecord);
|
||||
//connect(m_searchResultPage, &SearchResultPage::resizeHeight, this, &MainWindow::resizeHeight);
|
||||
connect(this,&MainWindow::setText,m_searchBarWidget,&SeachBarWidget::setText);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,6 +87,7 @@ protected:
|
|||
Q_SIGNALS:
|
||||
void searchMethodChanged(FileUtils::SearchMethod);
|
||||
void webEngineChanged();
|
||||
void setText(QString keyword);
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
#include "ukui-search-dbus-service.h"
|
||||
|
||||
using namespace Zeeker;
|
||||
void UkuiSearchDbusServices::showWindow(){
|
||||
m_mainWindow->bootOptionsFilter("-s");
|
||||
}
|
||||
|
||||
void UkuiSearchDbusServices::searchKeyword(QString keyword)
|
||||
{
|
||||
showWindow();
|
||||
m_mainWindow->setText(keyword);
|
||||
}
|
||||
|
||||
UkuiSearchDbusServices::UkuiSearchDbusServices(MainWindow *m)
|
||||
{
|
||||
m_mainWindow = m;
|
||||
//注册服务
|
||||
QDBusConnection sessionBus = QDBusConnection::sessionBus();
|
||||
if(!sessionBus.registerService("org.ukui.search.service")){
|
||||
qCritical() << "QDbus register service failed reason:" << sessionBus.lastError();
|
||||
exit(1);
|
||||
qWarning() << "ukui-search dbus register service failed reason:" << sessionBus.lastError();
|
||||
}
|
||||
|
||||
if(!sessionBus.registerObject("/", this, QDBusConnection::ExportAllSlots)){
|
||||
qCritical() << "QDbus register object failed reason:" << sessionBus.lastError();
|
||||
exit(2);
|
||||
qWarning() << "ukui-search dbus register object failed reason:" << sessionBus.lastError();
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ public:
|
|||
|
||||
public Q_SLOTS:
|
||||
void showWindow();
|
||||
void searchKeyword(QString keyword);
|
||||
|
||||
private:
|
||||
MainWindow *m_mainWindow;
|
||||
|
|
Loading…
Reference in New Issue