Merge branch '0811-dev' into 'dev-unity'

Update dbus interface.

See merge request kylin-desktop/ukui-search!89
This commit is contained in:
纪笑旭 2021-08-13 08:35:49 +00:00
commit 7e942b1f43
3 changed files with 10 additions and 9 deletions

View File

@ -235,9 +235,9 @@ SearchLineEdit::SearchLineEdit(QWidget *parent) : QLineEdit(parent) {
// this->addAction(searchAction,QLineEdit::LeadingPosition); // this->addAction(searchAction,QLineEdit::LeadingPosition);
/*发送输入框文字改变的dbus*/ /*发送输入框文字改变的dbus*/
QDBusConnection::sessionBus().unregisterService("org.ukui.search.service"); // QDBusConnection::sessionBus().unregisterService("org.ukui.search.service");
QDBusConnection::sessionBus().registerService("org.ukui.search.service"); // QDBusConnection::sessionBus().registerService("org.ukui.search.service");
QDBusConnection::sessionBus().registerObject("/lineEdit/textChanged", this, QDBusConnection :: ExportAllSlots | QDBusConnection :: ExportAllSignals); // QDBusConnection::sessionBus().registerObject("/lineEdit/textChanged", this, QDBusConnection :: ExportAllSlots | QDBusConnection :: ExportAllSignals);
connect(this, &QLineEdit::textChanged, this, &SearchLineEdit::lineEditTextChanged); connect(this, &QLineEdit::textChanged, this, &SearchLineEdit::lineEditTextChanged);
connect(this, &QLineEdit::textChanged, this, [ = ]() { connect(this, &QLineEdit::textChanged, this, [ = ]() {

View File

@ -94,11 +94,11 @@ private:
class SearchLineEdit : public QLineEdit { class SearchLineEdit : public QLineEdit {
Q_OBJECT Q_OBJECT
/* // /*
* ukui桌面环境应用通信的dbus // * 负责与ukui桌面环境应用通信的dbus
* // * 搜索框文本改变的时候发送信号
   */ //    */
Q_CLASSINFO("D-Bus Interface", "org.ukui.search.inputbox") // Q_CLASSINFO("D-Bus Interface", "org.ukui.search.inputbox")
public: public:
SearchLineEdit(QWidget *parent = nullptr); SearchLineEdit(QWidget *parent = nullptr);
void record(); void record();

View File

@ -10,7 +10,8 @@ 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")){ QDBusConnection::sessionBus().unregisterService("com.ukui.search.service");
if(!sessionBus.registerService("com.ukui.search.service")){
qWarning() << "ukui-search dbus register service failed reason:" << sessionBus.lastError(); qWarning() << "ukui-search dbus register service failed reason:" << sessionBus.lastError();
} }