Changeset View
Changeset View
Standalone View
Standalone View
plugins/clizipplugin/cliplugin.cpp
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Line(s) | 110 | p[FileExistsInput] = QStringList() << QStringLiteral("y") //overwrite | |||
---|---|---|---|---|---|
111 | << QStringLiteral("n") //skip | 111 | << QStringLiteral("n") //skip | ||
112 | << QStringLiteral("A") //overwrite all | 112 | << QStringLiteral("A") //overwrite all | ||
113 | << QStringLiteral("N"); //autoskip | 113 | << QStringLiteral("N"); //autoskip | ||
114 | 114 | | |||
115 | p[AddArgs] = QStringList() << QStringLiteral("-r") | 115 | p[AddArgs] = QStringList() << QStringLiteral("-r") | ||
116 | << QStringLiteral("$Archive") | 116 | << QStringLiteral("$Archive") | ||
117 | << QStringLiteral("$PasswordSwitch") | 117 | << QStringLiteral("$PasswordSwitch") | ||
118 | << QStringLiteral("$CompressionLevelSwitch") | 118 | << QStringLiteral("$CompressionLevelSwitch") | ||
119 | << QStringLiteral("$CompressionMethodSwitch") | ||||
119 | << QStringLiteral("$Files"); | 120 | << QStringLiteral("$Files"); | ||
120 | 121 | | |||
121 | p[PasswordPromptPattern] = QStringLiteral(" password: "); | 122 | p[PasswordPromptPattern] = QStringLiteral(" password: "); | ||
122 | p[WrongPasswordPatterns] = QStringList() << QStringLiteral("incorrect password"); | 123 | p[WrongPasswordPatterns] = QStringList() << QStringLiteral("incorrect password"); | ||
123 | p[ExtractionFailedPatterns] = QStringList() << QStringLiteral("unsupported compression method"); | 124 | p[ExtractionFailedPatterns] = QStringList() << QStringLiteral("unsupported compression method"); | ||
124 | p[CorruptArchivePatterns] = QStringList() << QStringLiteral("End-of-central-directory signature not found"); | 125 | p[CorruptArchivePatterns] = QStringList() << QStringLiteral("End-of-central-directory signature not found"); | ||
125 | p[DiskFullPatterns] = QStringList() << QStringLiteral("write error \\(disk full\\?\\)") | 126 | p[DiskFullPatterns] = QStringList() << QStringLiteral("write error \\(disk full\\?\\)") | ||
126 | << QStringLiteral("No space left on device"); | 127 | << QStringLiteral("No space left on device"); | ||
127 | p[TestArgs] = QStringList() << QStringLiteral("-t") | 128 | p[TestArgs] = QStringList() << QStringLiteral("-t") | ||
128 | << QStringLiteral("$Archive") | 129 | << QStringLiteral("$Archive") | ||
129 | << QStringLiteral("$PasswordSwitch"); | 130 | << QStringLiteral("$PasswordSwitch"); | ||
130 | p[TestPassedPattern] = QStringLiteral("^No errors detected in compressed data of "); | 131 | p[TestPassedPattern] = QStringLiteral("^No errors detected in compressed data of "); | ||
132 | p[CompressionMethodSwitch] = QStringLiteral("-Z$CompressionMethod"); | ||||
131 | } | 133 | } | ||
132 | return p; | 134 | return p; | ||
133 | } | 135 | } | ||
134 | 136 | | |||
135 | bool CliPlugin::readListLine(const QString &line) | 137 | bool CliPlugin::readListLine(const QString &line) | ||
136 | { | 138 | { | ||
137 | static const QRegularExpression entryPattern(QStringLiteral( | 139 | static const QRegularExpression entryPattern(QStringLiteral( | ||
138 | "^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\d{8}).(\\d{6})\\s+(.+)$") ); | 140 | "^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\d{8}).(\\d{6})\\s+(.+)$") ); | ||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Line(s) | |||||
285 | void CliPlugin::finishMoving(bool result) | 287 | void CliPlugin::finishMoving(bool result) | ||
286 | { | 288 | { | ||
287 | disconnect(this, &CliPlugin::finished, this, &CliPlugin::continueMoving); | 289 | disconnect(this, &CliPlugin::finished, this, &CliPlugin::continueMoving); | ||
288 | emit progress(1.0); | 290 | emit progress(1.0); | ||
289 | emit finished(result); | 291 | emit finished(result); | ||
290 | cleanUp(); | 292 | cleanUp(); | ||
291 | } | 293 | } | ||
292 | 294 | | |||
295 | QString CliPlugin::compressionMethodSwitch(const QString &method) const | ||||
296 | { | ||||
297 | if (method.isEmpty()) { | ||||
298 | return QString(); | ||||
299 | } | ||||
300 | | ||||
301 | Q_ASSERT(m_param.contains(CompressionMethodSwitch)); | ||||
302 | QString compMethodSwitch = m_param.value(CompressionMethodSwitch).toString(); | ||||
303 | Q_ASSERT(!compMethodSwitch.isEmpty()); | ||||
304 | | ||||
305 | // We use capitalization of methods in UI, but CLI requires lowercase. | ||||
306 | compMethodSwitch.replace(QLatin1String("$CompressionMethod"), method.toLower()); | ||||
307 | | ||||
308 | return compMethodSwitch; | ||||
309 | } | ||||
310 | | ||||
293 | QString CliPlugin::convertCompressionMethod(const QString &method) | 311 | QString CliPlugin::convertCompressionMethod(const QString &method) | ||
294 | { | 312 | { | ||
295 | if (method == QLatin1String("stor")) { | 313 | if (method == QLatin1String("stor")) { | ||
296 | return QStringLiteral("Store"); | 314 | return QStringLiteral("Store"); | ||
297 | } else if (method.startsWith(QLatin1String("def"))) { | 315 | } else if (method.startsWith(QLatin1String("def"))) { | ||
298 | return QStringLiteral("Deflate"); | 316 | return QStringLiteral("Deflate"); | ||
299 | } else if (method == QLatin1String("bzp2")) { | 317 | } else if (method == QLatin1String("bzp2")) { | ||
300 | return QStringLiteral("BZip2"); | 318 | return QStringLiteral("BZip2"); | ||
301 | } | 319 | } | ||
302 | return method; | 320 | return method; | ||
303 | } | 321 | } | ||
304 | 322 | | |||
305 | #include "cliplugin.moc" | 323 | #include "cliplugin.moc" |