Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions 3rdparty/clirarplugin/clirarplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,11 @@ bool CliRarPlugin::handleLine(const QString &line, WorkType workStatus)
}

if (isWrongPasswordMsg(line)) { // 提示密码错误
// RAR4密码错误直接结束
if (line.startsWith(QLatin1String("Checksum error in the encrypted file"))) {
m_eErrorType = ET_WrongPassword;
m_finishType = PFT_Error;
return false;
} else { // RAR5密码错误反复输入新密码
m_eErrorType = ET_WrongPassword;
return true;
}
// Strategy: treat wrong password as fatal and let UI show failure page with retry,
// consistent with zip/7z behavior.
m_eErrorType = ET_WrongPassword;
m_finishType = PFT_Error;
return false;
}

if (workStatus == WT_List) {
Expand Down
7 changes: 5 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,14 @@ int main(int argc, char *argv[])
qDebug() << "Registering standard DBus service";
if (dbus.registerService("com.deepin.Compressor")) {
dbus.registerObject("/com/deepin/Compressor", &w);
qDebug() << "DBus service registered successfully, moving window to center";
Dtk::Widget::moveToCenter(&w);
qDebug() << "DBus service registered successfully";
} else {
qWarning() << "Failed to register standard DBus service:" << dbus.lastError().message();
}
// Keep window placement independent from DBus registration result.
// Otherwise, in the "second launch" path (service already taken), the window may still
// be at a default geometry when password queries trigger, causing mis-centered dialogs.
Dtk::Widget::moveToCenter(&w);
} else {
qDebug() << "Registering WPS-specific DBus service";
QString serviceName = "com.deepin.Compressor"+QString::number(QGuiApplication::applicationPid());
Expand Down
16 changes: 14 additions & 2 deletions src/source/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,7 @@ void MainWindow::handleJobErrorFinished(ArchiveJob::JobType eJobType, ErrorType
switch (eErrorType) {
// 密码错误
case ET_WrongPassword: {
showErrorMessage(FI_Uncompress, EI_WrongPassword);
showErrorMessage(FI_Uncompress, EI_WrongPassword, true);
break;
}
// 文件名过长
Expand All @@ -1931,7 +1931,7 @@ void MainWindow::handleJobErrorFinished(ArchiveJob::JobType eJobType, ErrorType
break;
// 密码错误
case ET_WrongPassword:
showErrorMessage(FI_Load, EI_WrongPassword);
showErrorMessage(FI_Load, EI_WrongPassword, true);
break;
// ftp目录不支持seek操作
case ET_FileSeekError:
Expand Down Expand Up @@ -3497,6 +3497,18 @@ void MainWindow::slotFailureRetry()
m_ePageID = PI_CompressSetting; // 返回到列表设置界面
}
break;
case FI_Load: {
// Retry opening the same archive (e.g. wrong password).
const QString archivePath = m_stUnCompressParameter.strFullPath;
if (!archivePath.isEmpty()) {
loadArchive(archivePath);
} else {
m_ePageID = PI_Home;
refreshPage();
}
return;
}
break;
case FI_Uncompress: {
if (StartupType::ST_ExtractHere == m_eStartupType || StartupType::ST_Extractto == m_eStartupType) {
// 右键解压到当前文件夹
Expand Down
Loading