diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index 0978a37..f4a95d3 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -172,6 +172,11 @@ void MainWindow::initService() KYLIN_CONNECTIVITY_MANAGER_INTERFACE, QDBusConnection::systemBus()); QObject::connect(m_dbusInterface, SIGNAL(sigMountError(bool, QString)), this, SLOT(slotMountError(bool, QString))); QObject::connect(m_dbusInterface, SIGNAL(sigInitDiscServer(bool)), this, SLOT(slotInitDiscServerResult(bool))); + + + m_discovery = new KMobileDiscovery::Discovery(); + connect(m_discovery, &KMobileDiscovery::Discovery::sigAllDeviceInfo, this, &MainWindow::slotAllDeviceInfo); + discInit(); } @@ -281,6 +286,8 @@ void MainWindow::deleterService() if (m_dbusInterface->isValid()) { m_dbusInterface->call("killServerPortProcess"); } + delete m_dbusInterface; + m_dbusInterface = nullptr; } } @@ -418,7 +425,7 @@ void MainWindow::connectUI() stopLoadUI(); - // m_discovery->stopDiscovery(); + m_discovery->stopDiscovery(); QString str1 = ""; if (m_connectInfo.deviceRole == ConnectionService::DeviceRole::INITIATOR) { @@ -827,7 +834,7 @@ void MainWindow::slotFtpConnected() m_isMountFtp = true; Q_EMIT sigConnected(m_connectInfo.deviceName); if (m_connectInfo.deviceType == ConnectionService::DeviceType::PC) { - // initPcSearchInfo(); + initPcSearchInfo(); updateResult(); slotCdMobileStorageDirectory("/"); } else if (m_connectInfo.deviceType == ConnectionService::DeviceType::ANDROID) { @@ -928,7 +935,7 @@ void MainWindow::slotDownTempFileFinish(QString filePath) stopLoadUI(); if (m_isPcSearchInfo) { m_isPcSearchInfo = false; - m_titlebar->onSearchInstalled(true, filePath); + // m_titlebar->onSearchInstalled(true, filePath); } else if (!filePath.isEmpty()) { FileInfo::fileOpen(filePath); } else { @@ -1569,8 +1576,6 @@ void MainWindow::slotInitDiscServerResult(bool flag) connect(m_discClient, &QProcess::started, this, [=]() { qInfo() << "softbus init success"; GenerateTools::delayMs(500); - m_discovery = new KMobileDiscovery::Discovery(); - connect(m_discovery, &KMobileDiscovery::Discovery::sigAllDeviceInfo, this, &MainWindow::slotAllDeviceInfo); m_discovery->startDiscovery(); }); connect(m_discClient, &QProcess::readyReadStandardError, this, [=]() {