Commit 22903f06 authored by Alexander Reinholdt's avatar Alexander Reinholdt
Browse files

Adjust to changes made to Smb4KHardwareInterface class.

parent 223de052
Pipeline #43113 passed with stage
in 11 minutes and 45 seconds
......@@ -41,6 +41,7 @@
#include <QHostAddress>
#include <QTest>
#include <QApplication>
#include <QTimer>
using namespace Smb4KGlobal;
......@@ -70,7 +71,18 @@ Smb4KClient *Smb4KClient::self()
void Smb4KClient::start()
{
connect(Smb4KHardwareInterface::self(), SIGNAL(networkSessionInitialized()), this, SLOT(slotStartJobs()));
//
// Connect to the online state monitoring
//
connect(Smb4KHardwareInterface::self(), SIGNAL(onlineStateChanged(bool)), this, SLOT(slotOnlineStateChanged(bool)));
//
// Start the scanning
//
if (Smb4KHardwareInterface::self()->isOnline())
{
QTimer::singleShot(50, this, SLOT(slotStartJobs()));
}
}
......@@ -855,17 +867,22 @@ void Smb4KClient::processFiles(Smb4KClientJob *job)
void Smb4KClient::slotStartJobs()
{
//
// Disconnect from Smb4KHardwareInterface
//
disconnect(Smb4KHardwareInterface::self(), SIGNAL(networkSessionInitialized()), this, SLOT(slotStartJobs()));
//
// Lookup domains as the first step
//
if (Smb4KHardwareInterface::self()->isOnline())
lookupDomains();
}
void Smb4KClient::slotOnlineStateChanged(bool online)
{
if (online)
{
slotStartJobs();
}
else
{
lookupDomains();
abort();
}
}
......
......@@ -200,6 +200,11 @@ class Q_DECL_EXPORT Smb4KClient : public KCompositeJob
*/
void slotStartJobs();
/**
* React on changes of the online state
*/
void slotOnlineStateChanged(bool online);
/**
* Called when a job finished. Reimplemented from KCompositeJob.
*/
......
......@@ -97,10 +97,6 @@ Smb4KMounter::Smb4KMounter(QObject *parent)
//
// Connections
//
connect(Smb4KHardwareInterface::self(), SIGNAL(onlineStateChanged(bool)), this, SLOT(slotOnlineStateChanged(bool)));
connect(Smb4KHardwareInterface::self(), SIGNAL(networkShareAdded()), this, SLOT(slotTriggerImport()));
connect(Smb4KHardwareInterface::self(), SIGNAL(networkShareRemoved()), this, SLOT(slotTriggerImport()));
connect(Smb4KProfileManager::self(), SIGNAL(migratedProfile(QString,QString)), this, SLOT(slotProfileMigrated(QString,QString)));
connect(Smb4KProfileManager::self(), SIGNAL(aboutToChangeProfile()), this, SLOT(slotAboutToChangeProfile()));
connect(Smb4KProfileManager::self(), SIGNAL(activeProfileChanged(QString)), this, SLOT(slotActiveProfileChanged(QString)));
......@@ -1027,7 +1023,20 @@ void Smb4KMounter::openMountDialog()
void Smb4KMounter::start()
{
connect(Smb4KHardwareInterface::self(), SIGNAL(networkSessionInitialized()), this, SLOT(slotStartJobs()));
//
// Connect to the relevant signals provided by Smb4KHardwareInterface.
//
connect(Smb4KHardwareInterface::self(), SIGNAL(onlineStateChanged(bool)), this, SLOT(slotOnlineStateChanged(bool)));
connect(Smb4KHardwareInterface::self(), SIGNAL(networkShareAdded()), this, SLOT(slotTriggerImport()));
connect(Smb4KHardwareInterface::self(), SIGNAL(networkShareRemoved()), this, SLOT(slotTriggerImport()));
//
// Start with importing shares
//
if (Smb4KHardwareInterface::self()->isOnline())
{
QTimer::singleShot(50, this, SLOT(slotStartJobs()));
}
}
......@@ -2067,23 +2076,12 @@ void Smb4KMounter::check(const SharePtr &share)
void Smb4KMounter::slotStartJobs()
{
//
// Disconnect from Smb4KHardwareInterface.
//
disconnect(Smb4KHardwareInterface::self(), SIGNAL(networkSessionInitialized()), this, SLOT(slotStartJobs()));
//
// Start the import of shares
//
if (Smb4KHardwareInterface::self()->isOnline())
{
//
// Import the mounted shares
//
if (!d->firstImportDone)
{
import(true);
}
import(true);
}
//
......@@ -2171,14 +2169,9 @@ void Smb4KMounter::slotOnlineStateChanged(bool online)
if (online)
{
//
// Trigger the remounts, but only when the first import has been done
// already. Otherwise we would get errors. In this case the remounting
// is done by the code in timerEvent().
//
if (d->firstImportDone)
{
triggerRemounts(true);
}
// (Re-)start the job
//
slotStartJobs();
}
else
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment