This commit is contained in:
love-code-yeyixiao 2024-08-26 20:39:13 +08:00
parent 0c07033f0d
commit 7734cea9fb
3 changed files with 11 additions and 4 deletions

View File

@ -329,13 +329,15 @@ void CSandBoxPlus::ImportBoxAsync(const CSbieProgressPtr& pProgress, const QStri
pProgress->Finish(Status);
}
SB_PROGRESS CSandBoxPlus::ImportBox(const QString& FileName, const QString& Password)
SB_PROGRESS CSandBoxPlus::ImportBox(const QString& FileName, const QString& RootFolder, const QString& Password)
{
if (!CArchive::IsInit())
return SB_ERR((ESbieMsgCodes)SBX_7zNotReady);
CSbieProgressPtr pProgress = CSbieProgressPtr(new CSbieProgress());
QtConcurrent::run(CSandBoxPlus::ImportBoxAsync, pProgress, FileName, m_FilePath, m_Name, Password);
QString filepath = RootFolder.isEmpty()?m_FilePath:RootFolder;
QtConcurrent::run(CSandBoxPlus::ImportBoxAsync, pProgress, FileName, filepath, m_Name, Password);
return SB_PROGRESS(OP_ASYNC, pProgress);
}

View File

@ -75,7 +75,7 @@ public:
virtual QString GetDisplayName() const;
SB_PROGRESS ExportBox(const QString& FileName, const QString& Password = "", int Level = 5, bool Solid = false);
SB_PROGRESS ImportBox(const QString& FileName, const QString& Password = "");
SB_PROGRESS ImportBox(const QString& FileName, const QString& RootFolder,const QString& Password);
virtual void UpdateDetails();

View File

@ -1086,6 +1086,11 @@ QString CSbieView::ImportSandbox()
if (!Status.IsError()) {
pBox = theAPI->GetBoxByName(Name);
if (pBox) {
QString rootname = "";
if (QMessageBox::question(this, tr("Importing Sandbox"), tr("Do you want to select custom root folder?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
rootname=QFileDialog::getExistingDirectory(this);
pBox->SetText("FileRootPath", rootname);
}
auto pBoxEx = pBox.objectCast<CSandBoxPlus>();
if (!Password.isEmpty()) {
@ -1095,7 +1100,7 @@ QString CSbieView::ImportSandbox()
}
if (!Status.IsError())
Status = pBoxEx->ImportBox(Path, Password);
Status = pBoxEx->ImportBox(Path,rootname,Password);
}
}
if (Status.GetStatus() == OP_ASYNC) {