Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/file/file.cpp
Show First 20 Lines • Show All 333 Lines • ▼ Show 20 Line(s) | 294 | { | |||
---|---|---|---|---|---|
334 | } | 334 | } | ||
335 | error(KIO::ERR_FILE_ALREADY_EXIST, path); | 335 | error(KIO::ERR_FILE_ALREADY_EXIST, path); | ||
336 | return; | 336 | return; | ||
337 | } | 337 | } | ||
338 | 338 | | |||
339 | void FileProtocol::redirect(const QUrl &url) | 339 | void FileProtocol::redirect(const QUrl &url) | ||
340 | { | 340 | { | ||
341 | QUrl redir(url); | 341 | QUrl redir(url); | ||
342 | redir.setScheme(config()->readEntry("DefaultRemoteProtocol", "smb")); | 342 | redir.setScheme(configValue(QStringLiteral("DefaultRemoteProtocol"), QStringLiteral("smb"))); | ||
343 | 343 | | |||
344 | // if we would redirect into the Windows world, let's also check for the | 344 | // if we would redirect into the Windows world, let's also check for the | ||
345 | // DavWWWRoot "token" which in the Windows world tells win explorer to access | 345 | // DavWWWRoot "token" which in the Windows world tells win explorer to access | ||
346 | // a webdav url | 346 | // a webdav url | ||
347 | // https://www.webdavsystem.com/server/access/windows | 347 | // https://www.webdavsystem.com/server/access/windows | ||
348 | if ((redir.scheme() == QLatin1String("smb")) && | 348 | if ((redir.scheme() == QLatin1String("smb")) && | ||
349 | redir.path().startsWith(QLatin1String("/DavWWWRoot/"))) { | 349 | redir.path().startsWith(QLatin1String("/DavWWWRoot/"))) { | ||
350 | redir.setPath(redir.path().mid(11)); // remove /DavWWWRoot | 350 | redir.setPath(redir.path().mid(11)); // remove /DavWWWRoot | ||
▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Line(s) | 583 | { | |||
590 | 590 | | |||
591 | // qDebug() << dest_orig << "mode=" << _mode; | 591 | // qDebug() << dest_orig << "mode=" << _mode; | ||
592 | 592 | | |||
593 | QString dest_part(dest_orig + QLatin1String(".part")); | 593 | QString dest_part(dest_orig + QLatin1String(".part")); | ||
594 | 594 | | |||
595 | QT_STATBUF buff_orig; | 595 | QT_STATBUF buff_orig; | ||
596 | const bool bOrigExists = (QT_LSTAT(QFile::encodeName(dest_orig).constData(), &buff_orig) != -1); | 596 | const bool bOrigExists = (QT_LSTAT(QFile::encodeName(dest_orig).constData(), &buff_orig) != -1); | ||
597 | bool bPartExists = false; | 597 | bool bPartExists = false; | ||
598 | const bool bMarkPartial = config()->readEntry("MarkPartial", true); | 598 | const bool bMarkPartial = configValue(QStringLiteral("MarkPartial"), true); | ||
599 | 599 | | |||
600 | if (bMarkPartial) { | 600 | if (bMarkPartial) { | ||
601 | QT_STATBUF buff_part; | 601 | QT_STATBUF buff_part; | ||
602 | bPartExists = (QT_LSTAT(QFile::encodeName(dest_part).constData(), &buff_part) != -1); | 602 | bPartExists = (QT_LSTAT(QFile::encodeName(dest_part).constData(), &buff_part) != -1); | ||
603 | 603 | | |||
604 | if (bPartExists && !(_flags & KIO::Resume) && !(_flags & KIO::Overwrite) && buff_part.st_size > 0 && ((buff_part.st_mode & QT_STAT_MASK) == QT_STAT_REG)) { | 604 | if (bPartExists && !(_flags & KIO::Resume) && !(_flags & KIO::Overwrite) && buff_part.st_size > 0 && ((buff_part.st_mode & QT_STAT_MASK) == QT_STAT_REG)) { | ||
605 | // qDebug() << "calling canResume with" << KIO::number(buff_part.st_size); | 605 | // qDebug() << "calling canResume with" << KIO::number(buff_part.st_size); | ||
606 | 606 | | |||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 699 | #endif | |||
721 | if (result < 0) { | 721 | if (result < 0) { | ||
722 | // qDebug() << "Error during 'put'. Aborting."; | 722 | // qDebug() << "Error during 'put'. Aborting."; | ||
723 | 723 | | |||
724 | if (f.isOpen()) { | 724 | if (f.isOpen()) { | ||
725 | f.close(); | 725 | f.close(); | ||
726 | 726 | | |||
727 | QT_STATBUF buff; | 727 | QT_STATBUF buff; | ||
728 | if (QT_STAT(QFile::encodeName(dest).constData(), &buff) == 0) { | 728 | if (QT_STAT(QFile::encodeName(dest).constData(), &buff) == 0) { | ||
729 | int size = config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE); | 729 | int size = configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE); | ||
730 | if (buff.st_size < size) { | 730 | if (buff.st_size < size) { | ||
731 | QFile::remove(dest); | 731 | QFile::remove(dest); | ||
732 | } | 732 | } | ||
733 | } | 733 | } | ||
734 | } | 734 | } | ||
735 | return; | 735 | return; | ||
736 | } | 736 | } | ||
737 | 737 | | |||
▲ Show 20 Lines • Show All 820 Lines • Show Last 20 Lines |