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