Changeset View
Changeset View
Standalone View
Standalone View
plugins/clirarplugin/cliplugin.cpp
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 98 | p[FileExistsInput] = QStringList() << QStringLiteral( "Y" ) //overwrite | |||
---|---|---|---|---|---|
99 | << QStringLiteral( "N" ) //skip | 99 | << QStringLiteral( "N" ) //skip | ||
100 | << QStringLiteral( "A" ) //overwrite all | 100 | << QStringLiteral( "A" ) //overwrite all | ||
101 | << QStringLiteral( "E" ) //autoskip | 101 | << QStringLiteral( "E" ) //autoskip | ||
102 | << QStringLiteral( "Q" ); //cancel | 102 | << QStringLiteral( "Q" ); //cancel | ||
103 | p[AddArgs] = QStringList() << QStringLiteral( "a" ) | 103 | p[AddArgs] = QStringList() << QStringLiteral( "a" ) | ||
104 | << QStringLiteral( "$Archive" ) | 104 | << QStringLiteral( "$Archive" ) | ||
105 | << QStringLiteral("$PasswordSwitch") | 105 | << QStringLiteral("$PasswordSwitch") | ||
106 | << QStringLiteral("$CompressionLevelSwitch") | 106 | << QStringLiteral("$CompressionLevelSwitch") | ||
107 | << QStringLiteral("$CompressionMethodSwitch") | ||||
107 | << QStringLiteral("$MultiVolumeSwitch") | 108 | << QStringLiteral("$MultiVolumeSwitch") | ||
108 | << QStringLiteral( "$Files" ); | 109 | << QStringLiteral( "$Files" ); | ||
109 | p[MoveArgs] = QStringList() << QStringLiteral( "rn" ) | 110 | p[MoveArgs] = QStringList() << QStringLiteral( "rn" ) | ||
110 | << QStringLiteral( "$PasswordSwitch" ) | 111 | << QStringLiteral( "$PasswordSwitch" ) | ||
111 | << QStringLiteral( "$Archive" ) | 112 | << QStringLiteral( "$Archive" ) | ||
112 | << QStringLiteral( "$PathPairs" ); | 113 | << QStringLiteral( "$PathPairs" ); | ||
113 | p[PasswordPromptPattern] = QLatin1String("Enter password \\(will not be echoed\\) for"); | 114 | p[PasswordPromptPattern] = QLatin1String("Enter password \\(will not be echoed\\) for"); | ||
114 | p[WrongPasswordPatterns] = QStringList() << QStringLiteral("password incorrect") << QStringLiteral("wrong password"); | 115 | p[WrongPasswordPatterns] = QStringList() << QStringLiteral("password incorrect") << QStringLiteral("wrong password"); | ||
Show All 9 Lines | |||||
124 | p[TestArgs] = QStringList() << QStringLiteral("t") | 125 | p[TestArgs] = QStringList() << QStringLiteral("t") | ||
125 | << QStringLiteral("$Archive") | 126 | << QStringLiteral("$Archive") | ||
126 | << QStringLiteral("$PasswordSwitch"); | 127 | << QStringLiteral("$PasswordSwitch"); | ||
127 | p[TestPassedPattern] = QStringLiteral("^All OK$"); | 128 | p[TestPassedPattern] = QStringLiteral("^All OK$"); | ||
128 | // rar will sometimes create multi-volume archives where first volume is | 129 | // rar will sometimes create multi-volume archives where first volume is | ||
129 | // called name.part1.rar and other times name.part01.rar. | 130 | // called name.part1.rar and other times name.part01.rar. | ||
130 | p[MultiVolumeSuffix] = QStringList() << QStringLiteral("part01.$Suffix") | 131 | p[MultiVolumeSuffix] = QStringList() << QStringLiteral("part01.$Suffix") | ||
131 | << QStringLiteral("part1.$Suffix"); | 132 | << QStringLiteral("part1.$Suffix"); | ||
133 | p[CompressionMethodSwitch] = QStringLiteral("-ma$CompressionMethod"); | ||||
132 | } | 134 | } | ||
133 | 135 | | |||
134 | return p; | 136 | return p; | ||
135 | } | 137 | } | ||
136 | 138 | | |||
137 | bool CliPlugin::readListLine(const QString &line) | 139 | bool CliPlugin::readListLine(const QString &line) | ||
138 | { | 140 | { | ||
139 | // Ignore number of lines corresponding to m_remainingIgnoreLines. | 141 | // Ignore number of lines corresponding to m_remainingIgnoreLines. | ||
▲ Show 20 Lines • Show All 401 Lines • ▼ Show 20 Line(s) | |||||
541 | } | 543 | } | ||
542 | 544 | | |||
543 | void CliPlugin::ignoreLines(int lines, ParseState nextState) | 545 | void CliPlugin::ignoreLines(int lines, ParseState nextState) | ||
544 | { | 546 | { | ||
545 | m_remainingIgnoreLines = lines; | 547 | m_remainingIgnoreLines = lines; | ||
546 | m_parseState = nextState; | 548 | m_parseState = nextState; | ||
547 | } | 549 | } | ||
548 | 550 | | |||
551 | QString CliPlugin::compressionMethodSwitch(const QString &method) const | ||||
552 | { | ||||
553 | if (method.isEmpty()) { | ||||
554 | return QString(); | ||||
555 | } | ||||
556 | | ||||
557 | Q_ASSERT(m_param.contains(CompressionMethodSwitch)); | ||||
558 | QString compMethodSwitch = m_param.value(CompressionMethodSwitch).toString(); | ||||
559 | Q_ASSERT(!compMethodSwitch.isEmpty()); | ||||
560 | compMethodSwitch.replace(QLatin1String("$CompressionMethod"), method); | ||||
561 | | ||||
562 | // This is needed for because the user-visible strings are different from the | ||||
563 | // ones needed by the switch (e.g. RAR4 vs 4). | ||||
564 | compMethodSwitch.remove(QLatin1String("RAR")); | ||||
565 | | ||||
566 | return compMethodSwitch; | ||||
567 | } | ||||
568 | | ||||
549 | #include "cliplugin.moc" | 569 | #include "cliplugin.moc" |