Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/file/file.cpp
Show First 20 Lines • Show All 323 Lines • ▼ Show 20 Line(s) | 323 | if ((buff.st_mode & QT_STAT_MASK) == QT_STAT_DIR) { | |||
---|---|---|---|---|---|
324 | // qDebug() << "ERR_DIR_ALREADY_EXIST"; | 324 | // qDebug() << "ERR_DIR_ALREADY_EXIST"; | ||
325 | error(KIO::ERR_DIR_ALREADY_EXIST, path); | 325 | error(KIO::ERR_DIR_ALREADY_EXIST, path); | ||
326 | return; | 326 | return; | ||
327 | } | 327 | } | ||
328 | error(KIO::ERR_FILE_ALREADY_EXIST, path); | 328 | error(KIO::ERR_FILE_ALREADY_EXIST, path); | ||
329 | return; | 329 | return; | ||
330 | } | 330 | } | ||
331 | 331 | | |||
332 | void FileProtocol::get(const QUrl &url) | 332 | void FileProtocol::redirect(const QUrl &url) | ||
333 | { | 333 | { | ||
334 | if (!url.isLocalFile()) { | | |||
335 | QUrl redir(url); | 334 | QUrl redir(url); | ||
336 | redir.setScheme(config()->readEntry("DefaultRemoteProtocol", "smb")); | 335 | redir.setScheme(config()->readEntry("DefaultRemoteProtocol", "smb")); | ||
336 | | ||||
337 | // if we would redirect into the Windows world, let's also check for the | ||||
338 | // DavWWWRoot "token" which in the Windows world tells win explorer to access | ||||
339 | // a webdav url | ||||
340 | // https://www.webdavsystem.com/server/access/windows | ||||
341 | if ((redir.scheme() == QLatin1String("smb")) && | ||||
342 | redir.path().startsWith(QLatin1String("/DavWWWRoot/"))) { | ||||
343 | redir.setPath(redir.path().mid(11)); // remove /DavWWWRoot | ||||
344 | redir.setScheme(QLatin1String("webdav")); | ||||
345 | } | ||||
346 | | ||||
337 | redirection(redir); | 347 | redirection(redir); | ||
338 | finished(); | 348 | finished(); | ||
349 | } | ||||
350 | | ||||
351 | void FileProtocol::get(const QUrl &url) | ||||
352 | { | ||||
353 | if (!url.isLocalFile()) { | ||||
354 | redirect(url); | ||||
339 | return; | 355 | return; | ||
340 | } | 356 | } | ||
341 | 357 | | |||
342 | const QString path(url.toLocalFile()); | 358 | const QString path(url.toLocalFile()); | ||
343 | QT_STATBUF buff; | 359 | QT_STATBUF buff; | ||
344 | if (QT_STAT(QFile::encodeName(path).constData(), &buff) == -1) { | 360 | if (QT_STAT(QFile::encodeName(path).constData(), &buff) == -1) { | ||
345 | if (errno == EACCES) { | 361 | if (errno == EACCES) { | ||
346 | error(KIO::ERR_ACCESS_DENIED, path); | 362 | error(KIO::ERR_ACCESS_DENIED, path); | ||
▲ Show 20 Lines • Show All 1116 Lines • Show Last 20 Lines |