From 4ae3f10a7b0f991a6006ce799fe12e3a9e818379 Mon Sep 17 00:00:00 2001 From: zhaominyong Date: Tue, 25 Jan 2022 14:38:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E8=BF=87=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E6=8B=94=E6=8E=89U=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup-daemon/mybackupmanager.cpp | 2 ++ backup-daemon/udisksystemrestoreproxy.cpp | 1 + kybackup/module/systembackup.cpp | 30 ++++++++++++++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/backup-daemon/mybackupmanager.cpp b/backup-daemon/mybackupmanager.cpp index 20d9535..e044d6c 100755 --- a/backup-daemon/mybackupmanager.cpp +++ b/backup-daemon/mybackupmanager.cpp @@ -407,6 +407,8 @@ int MyBackupManager::cancel() { if (workerThread.isRunning()) emit workerThread.cancelWork(); + else + return 1; return 0; } diff --git a/backup-daemon/udisksystemrestoreproxy.cpp b/backup-daemon/udisksystemrestoreproxy.cpp index 84da687..b5aba0c 100755 --- a/backup-daemon/udisksystemrestoreproxy.cpp +++ b/backup-daemon/udisksystemrestoreproxy.cpp @@ -136,6 +136,7 @@ void UDiskSystemRestoreProxy::repairEfi() QString newPath = m_backupPath + "/boot"; args << newPath; QProcess::execute("mv", args); + QProcess::execute("sync"); } } diff --git a/kybackup/module/systembackup.cpp b/kybackup/module/systembackup.cpp index 26be318..bda7321 100755 --- a/kybackup/module/systembackup.cpp +++ b/kybackup/module/systembackup.cpp @@ -124,7 +124,11 @@ void SystemBackup::initFirstWidget() beginBackup->setAutoRepeat(true); font.setPixelSize(24); beginBackup->setFont(font); - connect(beginBackup, &MyPushButton::clicked, this, &SystemBackup::on_next_clicked); + connect(beginBackup, &MyPushButton::clicked, this, [=](bool clicked) { + this->m_prefixDestPath = ""; + this->m_backupName = ""; + this->on_next_clicked(clicked); + }); // 底部控件布局 QHBoxLayout *bottomHBoxLayout = new QHBoxLayout; @@ -211,7 +215,6 @@ void SystemBackup::initSecondWidget() if (GlobelBackupInfo::inst().hasBackupPartition()) { QString qsLocalDefaultPath = Utils::getSysRootPath() + BACKUP_SNAPSHOTS_PATH; qsLocalDefaultPath.replace("//", "/"); - this->m_prefixDestPath = ""; this->m_udiskPaths << ""; comboSelect->addItem(iconFolder, tr("local default path : ") + qsLocalDefaultPath); } @@ -975,6 +978,18 @@ void SystemBackup::on_checkBackup_end(int result) // 检查是否有备份分区 errTip = tr("Check whether there is a backup partition"); break; + case int(BackupResult::UDISK_FILESYSTEM_TYPE_IS_VFAT): + // 移动设备的文件系统是vfat格式 + errMsg = tr("The filesystem of device is vfat format"); + // 请换成ext4、ntfs等格式 + errTip = tr("Please change filesystem format to ext3、ext4 or ntfs"); + break; + case int(BackupResult::UDISK_FILESYSTEM_IS_READONLY): + // 移动设备是只读的 + errMsg = tr("The device is read only"); + // 请修改为可读写权限的 + errTip = tr("Please chmod to rw"); + break; case int(BackupResult::BACKUP_CAPACITY_IS_NOT_ENOUGH): // 备份空间不足 errMsg = tr("The storage for backup is not enough"); @@ -1000,7 +1015,10 @@ void SystemBackup::on_checkBackup_end(int result) errTip = tr("The system is being compressed to the local disk, please wait patiently..."); emit this->backupWarnning(errTip); return; - case int(BackupResult::BACKUP_START_SUCCESS): + case int(BackupResult::MKSQUASHFS_DO_FAIL): + break; + case int(BackupResult::BACKUP_START_SUCCESS): // 非移动设备备份不需要此信号 + case int(BackupResult::MKSQUASHFS_DO_SUCCESS): // 正在传输image文件到移动设备,即将完成... errTip = tr("Transferring image file to mobile device, about to be completed..."); emit this->backupWarnning(errTip); @@ -1020,6 +1038,12 @@ void SystemBackup::on_checkBackup_end(int result) GlobelBackupInfo::inst().setIsBusy(false); m_systemBackupState = SystemBackupState::IDEL; this->on_next_clicked(true); + if (errMsg.isEmpty()) { + // 备份过程中出现错误 + errMsg = tr("An error occurred during backup"); + // 错误信息参考日志文件:/var/log/backup.log + errTip = tr("Error messages refer to log file : /var/log/backup.log"); + } emit this->checkBackupResult(bRst, errMsg, errTip); disconnect(m_pInterface, &ComKylinBackupManagerInterface::sendEnvCheckResult, this, &SystemBackup::on_checkEnv_end); disconnect(m_pInterface, &ComKylinBackupManagerInterface::progress, this, &SystemBackup::progress);