Changeset View
Changeset View
Standalone View
Standalone View
krArc/krarc.cpp
Show First 20 Lines • Show All 754 Lines • ▼ Show 20 Line(s) | 754 | if (encrypted) | |||
---|---|---|---|---|---|
755 | KRDEBUG("ERROR: " << url.path() << " is encrypted."); | 755 | KRDEBUG("ERROR: " << url.path() << " is encrypted."); | ||
756 | if (!dest.isLocalFile()) | 756 | if (!dest.isLocalFile()) | ||
757 | KRDEBUG("ERROR: " << url.path() << " is not a local file."); | 757 | KRDEBUG("ERROR: " << url.path() << " is not a local file."); | ||
758 | 758 | | |||
759 | // CMD_COPY is no more in KF5 - replaced with 74 value (as stated in kio/src/core/commands_p.h, which could be found in cgit.kde.org/kio.git/tree) | 759 | // CMD_COPY is no more in KF5 - replaced with 74 value (as stated in kio/src/core/commands_p.h, which could be found in cgit.kde.org/kio.git/tree) | ||
760 | error(ERR_UNSUPPORTED_ACTION, unsupportedActionErrorString(mProtocol, 74)); | 760 | error(ERR_UNSUPPORTED_ACTION, unsupportedActionErrorString(mProtocol, 74)); | ||
761 | } | 761 | } | ||
762 | 762 | | |||
763 | void kio_krarcProtocol::rename(const QUrl& src, const QUrl& dest, KIO::JobFlags flags) | ||||
764 | { | ||||
765 | KRDEBUG("renaming from: " << src.path() << " to: " << dest.path()); | ||||
766 | KRDEBUG("command: " << arcPath); | ||||
767 | | ||||
768 | if (!checkWriteSupport()) { | ||||
769 | return; | ||||
770 | } | ||||
771 | | ||||
772 | if (renCmd.isEmpty()) { | ||||
773 | error(KIO::ERR_CANNOT_RENAME, src.fileName()); | ||||
774 | return; | ||||
775 | } | ||||
776 | | ||||
777 | if (src.fileName() == dest.fileName()) { | ||||
778 | return; | ||||
779 | } | ||||
780 | | ||||
781 | KrLinecountingProcess proc; | ||||
782 | proc << renCmd << arcPath << src.path().replace(arcPath + "/", "") << dest.path().replace(arcPath + "/", ""); | ||||
783 | proc.start(); | ||||
784 | proc.waitForFinished(); | ||||
785 | | ||||
786 | if (proc.exitStatus() != QProcess::NormalExit || !checkStatus(proc.exitCode())) { | ||||
787 | error(KIO::ERR_CANNOT_RENAME, src.fileName()); | ||||
788 | return; | ||||
789 | } | ||||
790 | | ||||
791 | finished(); | ||||
792 | } | ||||
793 | | ||||
763 | void kio_krarcProtocol::listDir(const QUrl &url) | 794 | void kio_krarcProtocol::listDir(const QUrl &url) | ||
764 | { | 795 | { | ||
765 | KRFUNC; | 796 | KRFUNC; | ||
766 | KRDEBUG(getPath(url)); | 797 | KRDEBUG(getPath(url)); | ||
767 | if (!setArcFile(url)) { | 798 | if (!setArcFile(url)) { | ||
768 | error(ERR_CANNOT_ENTER_DIRECTORY, getPath(url)); | 799 | error(ERR_CANNOT_ENTER_DIRECTORY, getPath(url)); | ||
769 | return; | 800 | return; | ||
770 | } | 801 | } | ||
▲ Show 20 Lines • Show All 703 Lines • ▼ Show 20 Line(s) | 1501 | { | |||
1474 | noencoding = false; | 1505 | noencoding = false; | ||
1475 | 1506 | | |||
1476 | cmd.clear(); | 1507 | cmd.clear(); | ||
1477 | listCmd = QStringList(); | 1508 | listCmd = QStringList(); | ||
1478 | getCmd = QStringList(); | 1509 | getCmd = QStringList(); | ||
1479 | copyCmd = QStringList(); | 1510 | copyCmd = QStringList(); | ||
1480 | delCmd = QStringList(); | 1511 | delCmd = QStringList(); | ||
1481 | putCmd = QStringList(); | 1512 | putCmd = QStringList(); | ||
1513 | renCmd = QStringList(); | ||||
1482 | 1514 | | |||
1483 | if (arcType == "zip") { | 1515 | if (arcType == "zip") { | ||
1484 | noencoding = true; | 1516 | noencoding = true; | ||
1485 | cmd = fullPathName("unzip"); | 1517 | cmd = fullPathName("unzip"); | ||
1486 | listCmd << fullPathName("unzip") << "-ZTs-z-t-h"; | 1518 | listCmd << fullPathName("unzip") << "-ZTs-z-t-h"; | ||
1487 | getCmd << fullPathName("unzip") << "-p"; | 1519 | getCmd << fullPathName("unzip") << "-p"; | ||
1488 | copyCmd << fullPathName("unzip") << "-jo"; | 1520 | copyCmd << fullPathName("unzip") << "-jo"; | ||
1489 | 1521 | | |||
1490 | if (QStandardPaths::findExecutable(QStringLiteral("zip")).isEmpty()) { | 1522 | if (QStandardPaths::findExecutable(QStringLiteral("zip")).isEmpty()) { | ||
1491 | delCmd = QStringList(); | 1523 | delCmd = QStringList(); | ||
1492 | putCmd = QStringList(); | 1524 | putCmd = QStringList(); | ||
1493 | } else { | 1525 | } else { | ||
1494 | delCmd << fullPathName("zip") << "-d"; | 1526 | delCmd << fullPathName("zip") << "-d"; | ||
1495 | putCmd << fullPathName("zip") << "-ry"; | 1527 | putCmd << fullPathName("zip") << "-ry"; | ||
1496 | } | 1528 | } | ||
1497 | 1529 | | |||
1530 | if (!QStandardPaths::findExecutable(QStringLiteral("7za")).isEmpty()) { | ||||
1531 | renCmd << fullPathName("7za") << "rn"; | ||||
1532 | } | ||||
1533 | | ||||
1498 | if (!getPassword().isEmpty()) { | 1534 | if (!getPassword().isEmpty()) { | ||
1499 | getCmd << "-P" << password; | 1535 | getCmd << "-P" << password; | ||
1500 | copyCmd << "-P" << password; | 1536 | copyCmd << "-P" << password; | ||
1501 | putCmd << "-P" << password; | 1537 | putCmd << "-P" << password; | ||
1502 | } | 1538 | } | ||
1503 | } else if (arcType == "rar") { | 1539 | } else if (arcType == "rar") { | ||
1504 | noencoding = true; | 1540 | noencoding = true; | ||
1505 | if (QStandardPaths::findExecutable(QStringLiteral("rar")).isEmpty()) { | 1541 | if (QStandardPaths::findExecutable(QStringLiteral("rar")).isEmpty()) { | ||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 1637 | } else if (arcType == "7z") { | |||
1604 | if (QStandardPaths::findExecutable(cmd).isEmpty()) | 1640 | if (QStandardPaths::findExecutable(cmd).isEmpty()) | ||
1605 | cmd = fullPathName("7za"); | 1641 | cmd = fullPathName("7za"); | ||
1606 | 1642 | | |||
1607 | listCmd << cmd << "l" << "-y"; | 1643 | listCmd << cmd << "l" << "-y"; | ||
1608 | getCmd << cmd << "e" << "-y"; | 1644 | getCmd << cmd << "e" << "-y"; | ||
1609 | copyCmd << cmd << "e" << "-y"; | 1645 | copyCmd << cmd << "e" << "-y"; | ||
1610 | delCmd << cmd << "d" << "-y"; | 1646 | delCmd << cmd << "d" << "-y"; | ||
1611 | putCmd << cmd << "a" << "-y"; | 1647 | putCmd << cmd << "a" << "-y"; | ||
1648 | renCmd << cmd << "rn"; | ||||
1612 | if (!getPassword().isEmpty()) { | 1649 | if (!getPassword().isEmpty()) { | ||
1613 | getCmd << QString("-p%1").arg(password); | 1650 | getCmd << QString("-p%1").arg(password); | ||
1614 | listCmd << QString("-p%1").arg(password); | 1651 | listCmd << QString("-p%1").arg(password); | ||
1615 | copyCmd << QString("-p%1").arg(password); | 1652 | copyCmd << QString("-p%1").arg(password); | ||
1616 | if (!putCmd.isEmpty()) { | 1653 | if (!putCmd.isEmpty()) { | ||
1617 | putCmd << QString("-p%1").arg(password); | 1654 | putCmd << QString("-p%1").arg(password); | ||
1618 | delCmd << QString("-p%1").arg(password); | 1655 | delCmd << QString("-p%1").arg(password); | ||
1619 | } | 1656 | } | ||
▲ Show 20 Lines • Show All 236 Lines • Show Last 20 Lines |