Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/file/file.cpp
Show First 20 Lines • Show All 332 Lines • ▼ Show 20 Line(s) | 293 | { | |||
---|---|---|---|---|---|
333 | } | 333 | } | ||
334 | error(KIO::ERR_FILE_ALREADY_EXIST, path); | 334 | error(KIO::ERR_FILE_ALREADY_EXIST, path); | ||
335 | return; | 335 | return; | ||
336 | } | 336 | } | ||
337 | 337 | | |||
338 | void FileProtocol::redirect(const QUrl &url) | 338 | void FileProtocol::redirect(const QUrl &url) | ||
339 | { | 339 | { | ||
340 | QUrl redir(url); | 340 | QUrl redir(url); | ||
341 | redir.setScheme(config()->readEntry("DefaultRemoteProtocol", "smb")); | 341 | redir.setScheme(mapConfig().value(QStringLiteral("DefaultRemoteProtocol"), QStringLiteral("smb")).toString()); | ||
342 | 342 | | |||
343 | // if we would redirect into the Windows world, let's also check for the | 343 | // if we would redirect into the Windows world, let's also check for the | ||
344 | // DavWWWRoot "token" which in the Windows world tells win explorer to access | 344 | // DavWWWRoot "token" which in the Windows world tells win explorer to access | ||
345 | // a webdav url | 345 | // a webdav url | ||
346 | // https://www.webdavsystem.com/server/access/windows | 346 | // https://www.webdavsystem.com/server/access/windows | ||
347 | if ((redir.scheme() == QLatin1String("smb")) && | 347 | if ((redir.scheme() == QLatin1String("smb")) && | ||
348 | redir.path().startsWith(QLatin1String("/DavWWWRoot/"))) { | 348 | redir.path().startsWith(QLatin1String("/DavWWWRoot/"))) { | ||
349 | redir.setPath(redir.path().mid(11)); // remove /DavWWWRoot | 349 | redir.setPath(redir.path().mid(11)); // remove /DavWWWRoot | ||
▲ Show 20 Lines • Show All 240 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 = mapConfig().value(QStringLiteral("MarkPartial"), true).toBool(); | ||
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 111 Lines • ▼ Show 20 Line(s) | 699 | #endif | |||
718 | if (result < 0) { | 718 | if (result < 0) { | ||
719 | // qDebug() << "Error during 'put'. Aborting."; | 719 | // qDebug() << "Error during 'put'. Aborting."; | ||
720 | 720 | | |||
721 | if (f.isOpen()) { | 721 | if (f.isOpen()) { | ||
722 | f.close(); | 722 | f.close(); | ||
723 | 723 | | |||
724 | QT_STATBUF buff; | 724 | QT_STATBUF buff; | ||
725 | if (QT_STAT(QFile::encodeName(dest).constData(), &buff) == 0) { | 725 | if (QT_STAT(QFile::encodeName(dest).constData(), &buff) == 0) { | ||
726 | int size = config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE); | 726 | int size = mapConfig().value(QStringLiteral("MinimumKeepSize"), QVariant(DEFAULT_MINIMUM_KEEP_SIZE)).toInt(); | ||
727 | if (buff.st_size < size) { | 727 | if (buff.st_size < size) { | ||
728 | QFile::remove(dest); | 728 | QFile::remove(dest); | ||
729 | } | 729 | } | ||
730 | } | 730 | } | ||
731 | } | 731 | } | ||
732 | 732 | | |||
733 | ::exit(255); | 733 | ::exit(255); | ||
734 | } | 734 | } | ||
▲ Show 20 Lines • Show All 821 Lines • Show Last 20 Lines |