diff --git a/kded/plugins/sftp/sftpplugin.cpp b/kded/plugins/sftp/sftpplugin.cpp index 259877733..62bc09ee8 100644 --- a/kded/plugins/sftp/sftpplugin.cpp +++ b/kded/plugins/sftp/sftpplugin.cpp @@ -41,12 +41,13 @@ K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< SftpPlugin >(); ) K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_sftp", "kdeconnect_sftp") ) -static const char* passwd_c = "sftppassword"; static const char* timestamp_c = "timestamp"; static const QSet fields_c = QSet() << "ip" << "port" << "user" << "port" << "path"; inline bool isTimeout(QObject* o, const KConfigGroup& cfg) { + if (!o) return false; + int duration = o->property(timestamp_c).toDateTime().secsTo(QDateTime::currentDateTime()); return cfg.readEntry("idle", true) && duration > (cfg.readEntry("idletimeout", 60) * 60); } @@ -182,9 +183,6 @@ bool SftpPlugin::receivePackage(const NetworkPackage& np) connect(m_d->mountProc, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(onFinished(int,QProcess::ExitStatus))); connect(m_d->mountProc, SIGNAL(finished(int,QProcess::ExitStatus)), m_d->mountProc, SLOT(deleteLater())); - connect(m_d->mountProc, SIGNAL(readyReadStandardError()), this, SLOT(readProcessStderr())); - connect(m_d->mountProc, SIGNAL(readyReadStandardOutput()), this, SLOT(readProcessStdout())); - const QString mpoint = mountPoint(); QDir().mkpath(mpoint); @@ -239,6 +237,9 @@ void SftpPlugin::onStarted() , KIconLoader::global()->loadIcon("drive-removable-media", KIconLoader::Desktop) ); + connect(m_d->mountProc, SIGNAL(readyReadStandardError()), this, SLOT(readProcessStderr())); + connect(m_d->mountProc, SIGNAL(readyReadStandardOutput()), this, SLOT(readProcessStdout())); + if (m_d->waitForMount) { m_d->waitForMount = false; @@ -317,7 +318,8 @@ void SftpPlugin::mountTimeout() void SftpPlugin::readProcessStderr() { - kError(kdeconnect_kded()) << "sshfs:" << m_d->mountProc->readAllStandardError(); + m_d->mountProc->setProperty(timestamp_c, QDateTime::currentDateTime()); + m_d->mountProc->readAllStandardError(); } void SftpPlugin::readProcessStdout()