[sftp] Get device ID from URL
This commit is contained in:
parent
b40407775c
commit
efa644f0a4
2 changed files with 8 additions and 33 deletions
|
@ -128,13 +128,13 @@ void KioKdeconnect::listAllDevices()
|
||||||
finished();
|
finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KioKdeconnect::listDevice()
|
void KioKdeconnect::listDevice(const QString& device)
|
||||||
{
|
{
|
||||||
infoMessage(i18n("Accessing device..."));
|
infoMessage(i18n("Accessing device..."));
|
||||||
|
|
||||||
qCDebug(KDECONNECT_KIO) << "ListDevice" << m_currentDevice;
|
qCDebug(KDECONNECT_KIO) << "ListDevice" << device;
|
||||||
|
|
||||||
SftpDbusInterface interface(m_currentDevice);
|
SftpDbusInterface interface(device);
|
||||||
|
|
||||||
QDBusReply<bool> mountreply = interface.mountAndWait();
|
QDBusReply<bool> mountreply = interface.mountAndWait();
|
||||||
|
|
||||||
|
@ -191,20 +191,18 @@ void KioKdeconnect::listDir(const QUrl& url)
|
||||||
{
|
{
|
||||||
qCDebug(KDECONNECT_KIO) << "Listing..." << url;
|
qCDebug(KDECONNECT_KIO) << "Listing..." << url;
|
||||||
|
|
||||||
/// Url is not used here because all we could care about the url is the host, and that's already
|
|
||||||
/// handled in @p setHost
|
|
||||||
Q_UNUSED(url);
|
|
||||||
|
|
||||||
if (!m_dbusInterface->isValid()) {
|
if (!m_dbusInterface->isValid()) {
|
||||||
infoMessage(i18n("Could not contact background service."));
|
infoMessage(i18n("Could not contact background service."));
|
||||||
finished();
|
finished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_currentDevice.isEmpty()) {
|
QString currentDevice = url.host();
|
||||||
|
|
||||||
|
if (currentDevice.isEmpty()) {
|
||||||
listAllDevices();
|
listAllDevices();
|
||||||
} else {
|
} else {
|
||||||
listDevice();
|
listDevice(currentDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,21 +224,5 @@ void KioKdeconnect::get(const QUrl& url)
|
||||||
finished();
|
finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KioKdeconnect::setHost(const QString& hostName, quint16 port, const QString& user, const QString& pass)
|
|
||||||
{
|
|
||||||
|
|
||||||
//This is called before everything else to set the file we want to show
|
|
||||||
|
|
||||||
qCDebug(KDECONNECT_KIO) << "Setting host: " << hostName;
|
|
||||||
|
|
||||||
// In this kio only the hostname is used
|
|
||||||
Q_UNUSED(port)
|
|
||||||
Q_UNUSED(user)
|
|
||||||
Q_UNUSED(pass)
|
|
||||||
|
|
||||||
m_currentDevice = hostName;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//needed for JSON file embedding
|
//needed for JSON file embedding
|
||||||
#include "kiokdeconnect.moc"
|
#include "kiokdeconnect.moc"
|
||||||
|
|
|
@ -41,19 +41,12 @@ public:
|
||||||
void listDir(const QUrl& url) override;
|
void listDir(const QUrl& url) override;
|
||||||
void stat(const QUrl& url) override;
|
void stat(const QUrl& url) override;
|
||||||
|
|
||||||
void setHost(const QString& constHostname, quint16 port, const QString& user, const QString& pass) override;
|
|
||||||
|
|
||||||
void listAllDevices(); //List all devices exported by m_dbusInterface
|
void listAllDevices(); //List all devices exported by m_dbusInterface
|
||||||
void listDevice(); //List m_currentDevice
|
void listDevice(const QString& device); //List m_currentDevice
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains the ID of the current device or is empty when no device is set.
|
|
||||||
*/
|
|
||||||
QString m_currentDevice;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* KDED DBus interface, used to communicate to the daemon since we need some status (like connected)
|
* KDED DBus interface, used to communicate to the daemon since we need some status (like connected)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue