Merge pull request #4176 from love-code-yeyixiao/ImportBoxLocation

#4169
This commit is contained in:
DavidXanatos 2024-08-27 08:46:01 +02:00 committed by GitHub
commit eef32c1a1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 5 deletions

View File

@ -9,7 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- added "HideDiskSerialNumber"(bool) return random value when applications tries to get disk serial number
- added option to get free 10 days evaluation certificates from the support settings page.
- The evaluation certificates are node lcoked to the HwID and for each HwID up to 3 certs can be requested.
- added a question box to ask for Sandbox Import Location for [#4169](https://github.com/sandboxie-plus/Sandboxie/issues/4169)
## [1.14.6 / 5.69.6] - 2024-07-30

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,10 @@ 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);
}
auto pBoxEx = pBox.objectCast<CSandBoxPlus>();
if (!Password.isEmpty()) {
@ -1095,7 +1099,9 @@ QString CSbieView::ImportSandbox()
}
if (!Status.IsError())
Status = pBoxEx->ImportBox(Path, Password);
Status = pBoxEx->ImportBox(Path,rootname,Password);
if(!rootname.isEmpty())
pBox->SetText("FileRootPath", rootname);
}
}
if (Status.GetStatus() == OP_ASYNC) {