Changeset View
Changeset View
Standalone View
Standalone View
plugins/cli7zplugin/cliplugin.cpp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 64 | if (p.isEmpty()) { | |||
---|---|---|---|---|---|
78 | p[PasswordHeaderSwitch] = QStringList { QStringLiteral("-p$Password"), QStringLiteral("-mhe=on") }; | 78 | p[PasswordHeaderSwitch] = QStringList { QStringLiteral("-p$Password"), QStringLiteral("-mhe=on") }; | ||
79 | p[WrongPasswordPatterns] = QStringList() << QStringLiteral("Wrong password"); | 79 | p[WrongPasswordPatterns] = QStringList() << QStringLiteral("Wrong password"); | ||
80 | p[CompressionLevelSwitch] = QStringLiteral("-mx=$CompressionLevel"); | 80 | p[CompressionLevelSwitch] = QStringLiteral("-mx=$CompressionLevel"); | ||
81 | p[AddArgs] = QStringList() << QStringLiteral("a") | 81 | p[AddArgs] = QStringList() << QStringLiteral("a") | ||
82 | << QStringLiteral("-l") | 82 | << QStringLiteral("-l") | ||
83 | << QStringLiteral("$Archive") | 83 | << QStringLiteral("$Archive") | ||
84 | << QStringLiteral("$PasswordSwitch") | 84 | << QStringLiteral("$PasswordSwitch") | ||
85 | << QStringLiteral("$CompressionLevelSwitch") | 85 | << QStringLiteral("$CompressionLevelSwitch") | ||
86 | << QStringLiteral("$CompressionMethodSwitch") | ||||
86 | << QStringLiteral("$MultiVolumeSwitch") | 87 | << QStringLiteral("$MultiVolumeSwitch") | ||
87 | << QStringLiteral("$Files"); | 88 | << QStringLiteral("$Files"); | ||
88 | p[MoveArgs] = QStringList() << QStringLiteral("rn") | 89 | p[MoveArgs] = QStringList() << QStringLiteral("rn") | ||
89 | << QStringLiteral("$PasswordSwitch") | 90 | << QStringLiteral("$PasswordSwitch") | ||
90 | << QStringLiteral("$Archive") | 91 | << QStringLiteral("$Archive") | ||
91 | << QStringLiteral("$PathPairs"); | 92 | << QStringLiteral("$PathPairs"); | ||
92 | p[DeleteArgs] = QStringList() << QStringLiteral("d") | 93 | p[DeleteArgs] = QStringList() << QStringLiteral("d") | ||
93 | << QStringLiteral("$PasswordSwitch") | 94 | << QStringLiteral("$PasswordSwitch") | ||
Show All 16 Lines | 107 | p[FileExistsInput] = QStringList() << QStringLiteral("Y") //overwrite | |||
110 | << QStringLiteral("Q"); //cancel | 111 | << QStringLiteral("Q"); //cancel | ||
111 | p[PasswordPromptPattern] = QStringLiteral("Enter password \\(will not be echoed\\)"); | 112 | p[PasswordPromptPattern] = QStringLiteral("Enter password \\(will not be echoed\\)"); | ||
112 | p[ExtractionFailedPatterns] = QStringList() << QStringLiteral("ERROR: E_FAIL") << QStringLiteral("Open ERROR: Can not open the file as \\[7z\\] archive"); | 113 | p[ExtractionFailedPatterns] = QStringList() << QStringLiteral("ERROR: E_FAIL") << QStringLiteral("Open ERROR: Can not open the file as \\[7z\\] archive"); | ||
113 | p[CorruptArchivePatterns] = QStringList() << QStringLiteral("Unexpected end of archive") | 114 | p[CorruptArchivePatterns] = QStringList() << QStringLiteral("Unexpected end of archive") | ||
114 | << QStringLiteral("Headers Error"); | 115 | << QStringLiteral("Headers Error"); | ||
115 | p[DiskFullPatterns] = QStringList() << QStringLiteral("No space left on device"); | 116 | p[DiskFullPatterns] = QStringList() << QStringLiteral("No space left on device"); | ||
116 | p[MultiVolumeSwitch] = QStringLiteral("-v$VolumeSizek"); | 117 | p[MultiVolumeSwitch] = QStringLiteral("-v$VolumeSizek"); | ||
117 | p[MultiVolumeSuffix] = QStringList() << QStringLiteral("$Suffix.001"); | 118 | p[MultiVolumeSuffix] = QStringList() << QStringLiteral("$Suffix.001"); | ||
119 | QMap<QString,QVariant> compMethodMap; | ||||
120 | compMethodMap[QStringLiteral("zip")] = QStringLiteral("-mm=$CompressionMethod"); | ||||
121 | compMethodMap[QStringLiteral("7z")] = QStringLiteral("-m0=$CompressionMethod"); | ||||
122 | p[CompressionMethodSwitch] = compMethodMap; | ||||
118 | } | 123 | } | ||
119 | 124 | | |||
120 | return p; | 125 | return p; | ||
121 | } | 126 | } | ||
122 | 127 | | |||
123 | bool CliPlugin::readListLine(const QString& line) | 128 | bool CliPlugin::readListLine(const QString& line) | ||
124 | { | 129 | { | ||
125 | static const QLatin1String archiveInfoDelimiter1("--"); // 7z 9.13+ | 130 | static const QLatin1String archiveInfoDelimiter1("--"); // 7z 9.13+ | ||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Line(s) | 299 | { | |||
301 | QStringList passwordHeaderSwitch = m_param.value(PasswordHeaderSwitch).toStringList(); | 306 | QStringList passwordHeaderSwitch = m_param.value(PasswordHeaderSwitch).toStringList(); | ||
302 | Q_ASSERT(!passwordHeaderSwitch.isEmpty() && passwordHeaderSwitch.size() == 2); | 307 | Q_ASSERT(!passwordHeaderSwitch.isEmpty() && passwordHeaderSwitch.size() == 2); | ||
303 | 308 | | |||
304 | passwordHeaderSwitch[0].replace(QLatin1String("$Password"), password); | 309 | passwordHeaderSwitch[0].replace(QLatin1String("$Password"), password); | ||
305 | 310 | | |||
306 | return passwordHeaderSwitch; | 311 | return passwordHeaderSwitch; | ||
307 | } | 312 | } | ||
308 | 313 | | |||
314 | QString CliPlugin::compressionMethodSwitch(const QString &method) const | ||||
315 | { | ||||
316 | if (method.isEmpty()) { | ||||
317 | return QString(); | ||||
318 | } | ||||
319 | | ||||
320 | Q_ASSERT(!filename().isEmpty()); | ||||
321 | Q_ASSERT(m_param.contains(CompressionMethodSwitch)); | ||||
322 | | ||||
323 | QMap<QString,QVariant> switches = m_param.value(CompressionMethodSwitch).toMap(); | ||||
324 | Q_ASSERT(!switches.isEmpty()); | ||||
325 | | ||||
326 | QString compMethodSwitch; | ||||
327 | | ||||
328 | compMethodSwitch = switches[QFileInfo(filename()).suffix().toLower()].toString(); | ||||
329 | compMethodSwitch.replace(QLatin1String("$CompressionMethod"), method); | ||||
330 | | ||||
331 | return compMethodSwitch; | ||||
332 | } | ||||
333 | | ||||
309 | #include "cliplugin.moc" | 334 | #include "cliplugin.moc" |