1.14.9
This commit is contained in:
parent
0750445028
commit
28fea2e0bc
|
@ -141,6 +141,12 @@ void CSandBox::SetBoxPaths(const QString& FilePath, const QString& RegPath, cons
|
|||
m_IpcPath = IpcPath;
|
||||
}
|
||||
|
||||
void CSandBox::SetFileRoot(const QString& FilePath)
|
||||
{
|
||||
SetText("FileRootPath", FilePath);
|
||||
m_pAPI->UpdateBoxPaths(this);
|
||||
}
|
||||
|
||||
SB_STATUS CSandBox::RunStart(const QString& Command, bool Elevated)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
virtual void UpdateDetails();
|
||||
|
||||
virtual void SetBoxPaths(const QString& FilePath, const QString& RegPath, const QString& IpcPath);
|
||||
virtual void SetFileRoot(const QString& FilePath);
|
||||
virtual QString GetFileRoot() const { return m_FilePath; }
|
||||
virtual QString GetRegRoot() const { return m_RegPath; }
|
||||
virtual QString GetIpcRoot() const { return m_IpcPath; }
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cmbCompression"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -32,14 +29,10 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Compression</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="cmbCompression"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="4" column="2">
|
||||
<widget class="QCheckBox" name="chkEncrypt">
|
||||
<property name="toolTip">
|
||||
<string>When selected you will be prompted for a password after clicking OK</string>
|
||||
|
@ -49,7 +42,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="chkSolid">
|
||||
<property name="toolTip">
|
||||
<string>Solid archiving improves compression ratios by treating multiple files as a single continuous data block. Ideal for a large number of small files, it makes the archive more compact but may increase the time required for extracting individual files.</string>
|
||||
|
@ -59,10 +52,27 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Compression</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cmbFormat">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Export Sandbox to a 7z or Zip archive, Choose Your Compression Rate and Customize Additional Compression Settings.</string>
|
||||
<string>Export Sandbox to a archive, Choose Your Compression Rate and Customize Additional Compression Settings.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExtractDialog</class>
|
||||
<widget class="QDialog" name="ExtractDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>207</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Extract Files</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="txtName"/>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Export Sandbox from an archive</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Import Sandbox Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Box Root Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="btnRoot">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cmbRoot">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -38,6 +38,7 @@ HEADERS += ./stdafx.h \
|
|||
./Wizards/BoxAssistant.h \
|
||||
./Windows/BoxImageWindow.h \
|
||||
./Windows/CompressDialog.h \
|
||||
./Windows/ExtractDialog.h \
|
||||
./Engine/BoxEngine.h \
|
||||
./Engine/ScriptManager.h \
|
||||
./Engine/BoxObject.h \
|
||||
|
@ -88,6 +89,7 @@ SOURCES += ./main.cpp \
|
|||
./Wizards/BoxAssistant.cpp \
|
||||
./Windows/BoxImageWindow.cpp \
|
||||
./Windows/CompressDialog.cpp \
|
||||
./Windows/ExtractDialog.cpp \
|
||||
./Engine/BoxEngine.cpp \
|
||||
./Engine/ScriptManager.cpp \
|
||||
./Engine/BoxObject.cpp \
|
||||
|
@ -105,6 +107,7 @@ FORMS += ./Forms/SelectBoxWindow.ui \
|
|||
./Forms/SnapshotsWindow.ui \
|
||||
./Forms/BoxImageWindow.ui \
|
||||
./Forms/CompressDialog.ui \
|
||||
./Forms/ExtractDialog.ui \
|
||||
./Forms/TestProxyDialog.ui
|
||||
|
||||
TRANSLATIONS += sandman_de.ts \
|
||||
|
|
|
@ -348,6 +348,7 @@
|
|||
<ClCompile Include="Views\StackView.cpp" />
|
||||
<ClCompile Include="Views\TraceView.cpp" />
|
||||
<ClCompile Include="Windows\CompressDialog.cpp" />
|
||||
<ClCompile Include="Windows\ExtractDialog.cpp" />
|
||||
<ClCompile Include="Windows\OptionsAccess.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -443,6 +444,7 @@
|
|||
<ClCompile Include="Windows\TestProxyDialog.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="Windows\ExtractDialog.h" />
|
||||
<QtMoc Include="Windows\TestProxyDialog.h" />
|
||||
<QtMoc Include="Windows\CompressDialog.h" />
|
||||
<QtMoc Include="Wizards\BoxAssistant.h" />
|
||||
|
@ -504,6 +506,7 @@
|
|||
<ItemGroup>
|
||||
<QtUic Include="Forms\BoxImageWindow.ui" />
|
||||
<QtUic Include="Forms\CompressDialog.ui" />
|
||||
<QtUic Include="Forms\ExtractDialog.ui" />
|
||||
<QtUic Include="Forms\OptionsWindow.ui" />
|
||||
<QtUic Include="Forms\PopUpWindow.ui" />
|
||||
<QtUic Include="Forms\RecoveryWindow.ui" />
|
||||
|
|
|
@ -234,6 +234,9 @@
|
|||
<ClCompile Include="Windows\TestProxyDialog.cpp">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Windows\ExtractDialog.cpp">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
|
@ -385,6 +388,9 @@
|
|||
<QtMoc Include="Windows\TestProxyDialog.h">
|
||||
<Filter>Windows</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="Windows\ExtractDialog.h">
|
||||
<Filter>Windows</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="Resources\SandMan.qrc">
|
||||
|
@ -428,7 +434,10 @@
|
|||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="Forms\TestProxyDialog.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="Forms\ExtractDialog.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -332,15 +332,13 @@ void CSandBoxPlus::ImportBoxAsync(const CSbieProgressPtr& pProgress, const QStri
|
|||
pProgress->Finish(Status);
|
||||
}
|
||||
|
||||
SB_PROGRESS CSandBoxPlus::ImportBox(const QString& FileName, const QString& RootFolder, const QString& Password)
|
||||
SB_PROGRESS CSandBoxPlus::ImportBox(const QString& FileName, const QString& Password)
|
||||
{
|
||||
if (!CArchive::IsInit())
|
||||
return SB_ERR((ESbieMsgCodes)SBX_7zNotReady);
|
||||
|
||||
CSbieProgressPtr pProgress = CSbieProgressPtr(new CSbieProgress());
|
||||
QString filepath = RootFolder.isEmpty()?m_FilePath:RootFolder;
|
||||
|
||||
QtConcurrent::run(CSandBoxPlus::ImportBoxAsync, pProgress, FileName, filepath, m_Name, Password);
|
||||
QtConcurrent::run(CSandBoxPlus::ImportBoxAsync, pProgress, FileName, m_FilePath, m_Name, Password);
|
||||
return SB_PROGRESS(OP_ASYNC, pProgress);
|
||||
}
|
||||
|
||||
|
|
|
@ -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& RootFolder,const QString& Password);
|
||||
SB_PROGRESS ImportBox(const QString& FileName, const QString& Password);
|
||||
|
||||
virtual void UpdateDetails();
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "../MiscHelpers/Archive/Archive.h"
|
||||
#include "../Windows/SettingsWindow.h"
|
||||
#include "../Windows/CompressDialog.h"
|
||||
#include "../Windows/ExtractDialog.h"
|
||||
|
||||
#include "qt_windows.h"
|
||||
#include "qwindowdefs_win.h"
|
||||
|
@ -1071,27 +1072,24 @@ QString CSbieView::ImportSandbox()
|
|||
StrPair PathName = Split2(Path, "/", true);
|
||||
StrPair NameEx = Split2(PathName.second, ".", true);
|
||||
QString Name = NameEx.first;
|
||||
|
||||
CExtractDialog optWnd(Name, this);
|
||||
if (!theGUI->SafeExec(&optWnd) == 1)
|
||||
return "";
|
||||
Name = optWnd.GetName();
|
||||
QString BoxRoot = optWnd.GetRoot();
|
||||
|
||||
CSandBoxPtr pBox;
|
||||
for (;;) {
|
||||
pBox = theAPI->GetBoxByName(Name);
|
||||
if (pBox.isNull())
|
||||
break;
|
||||
Name = QInputDialog::getText(this, "Sandboxie-Plus", tr("This name is already in use, please select an alternative box name"), QLineEdit::Normal, Name);
|
||||
if (Name.isEmpty())
|
||||
return "";
|
||||
}
|
||||
|
||||
SB_PROGRESS Status = theAPI->CreateBox(Name);
|
||||
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 (!BoxRoot.isEmpty())
|
||||
pBox->SetFileRoot(BoxRoot);
|
||||
|
||||
if (!Password.isEmpty()) {
|
||||
Status = pBoxEx->ImBoxCreate(ImageSize / 1024, Password);
|
||||
if (!Status.IsError())
|
||||
|
@ -1099,11 +1097,13 @@ QString CSbieView::ImportSandbox()
|
|||
}
|
||||
|
||||
if (!Status.IsError())
|
||||
Status = pBoxEx->ImportBox(Path,rootname,Password);
|
||||
if(!rootname.isEmpty())
|
||||
pBox->SetText("FileRootPath", rootname);
|
||||
Status = pBoxEx->ImportBox(Path, Password);
|
||||
|
||||
// always overwirte restored FileRootPath
|
||||
pBox->SetText("FileRootPath", BoxRoot);
|
||||
}
|
||||
}
|
||||
|
||||
if (Status.GetStatus() == OP_ASYNC) {
|
||||
Status = theGUI->AddAsyncOp(Status.GetValue(), true, tr("Importing: %1").arg(Path));
|
||||
if (Status.IsError()) {
|
||||
|
@ -1405,7 +1405,7 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList<CSandBoxPtr>& SandB
|
|||
Password = pwWnd.GetPassword();
|
||||
}
|
||||
|
||||
QString Path = QFileDialog::getSaveFileName(this, tr("Select file name"), SandBoxes.first()->GetName() + ".7z", tr("7-zip Archive (*.7z);;Zip Archive (*.zip)"));
|
||||
QString Path = QFileDialog::getSaveFileName(this, tr("Select file name"), SandBoxes.first()->GetName() + optWnd.GetFormat(), tr("7-Zip Archive (*.7z);;Zip Archive (*.zip)"));
|
||||
if (Path.isEmpty())
|
||||
return;
|
||||
|
||||
|
|
|
@ -22,6 +22,11 @@ CCompressDialog::CCompressDialog(QWidget *parent)
|
|||
ui.setupUi(this);
|
||||
this->setWindowTitle(tr("Sandboxie-Plus - Sandbox Export"));
|
||||
|
||||
connect(ui.cmbFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(OnFormatChanged(int)));
|
||||
|
||||
ui.cmbFormat->addItem(tr("7-Zip"), ".7z");
|
||||
ui.cmbFormat->addItem(tr("Zip"), ".zip");
|
||||
|
||||
ui.cmbCompression->addItem(tr("Store"), 0);
|
||||
ui.cmbCompression->addItem(tr("Fastest"), 1);
|
||||
ui.cmbCompression->addItem(tr("Fast"), 3);
|
||||
|
@ -41,6 +46,17 @@ CCompressDialog::~CCompressDialog()
|
|||
//theConf->SetBlob("CompressDialog/Window_Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
void CCompressDialog::OnFormatChanged(int index)
|
||||
{
|
||||
ui.chkSolid->setEnabled(index == 0);
|
||||
ui.chkEncrypt->setEnabled(index == 0);
|
||||
}
|
||||
|
||||
QString CCompressDialog::GetFormat()
|
||||
{
|
||||
return ui.cmbFormat->currentData().toString();
|
||||
}
|
||||
|
||||
int CCompressDialog::GetLevel()
|
||||
{
|
||||
return ui.cmbCompression->currentData().toInt();
|
||||
|
|
|
@ -12,12 +12,16 @@ public:
|
|||
CCompressDialog(QWidget *parent = Q_NULLPTR);
|
||||
~CCompressDialog();
|
||||
|
||||
QString GetFormat();
|
||||
int GetLevel();
|
||||
bool MakeSolid();
|
||||
|
||||
void SetMustEncrypt();
|
||||
bool UseEncryption();
|
||||
|
||||
private slots:
|
||||
void OnFormatChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::CompressDialog ui;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
#include "stdafx.h"
|
||||
#include "ExtractDialog.h"
|
||||
#include "SandMan.h"
|
||||
#include "../MiscHelpers/Common/Settings.h"
|
||||
#include "../MiscHelpers/Common/Common.h"
|
||||
|
||||
|
||||
CExtractDialog::CExtractDialog(const QString& Name, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
Qt::WindowFlags flags = windowFlags();
|
||||
flags |= Qt::CustomizeWindowHint;
|
||||
//flags &= ~Qt::WindowContextHelpButtonHint;
|
||||
//flags &= ~Qt::WindowSystemMenuHint;
|
||||
//flags &= ~Qt::WindowMinMaxButtonsHint;
|
||||
//flags |= Qt::WindowMinimizeButtonHint;
|
||||
//flags &= ~Qt::WindowCloseButtonHint;
|
||||
flags &= ~Qt::WindowContextHelpButtonHint;
|
||||
//flags &= ~Qt::WindowSystemMenuHint;
|
||||
setWindowFlags(flags);
|
||||
|
||||
ui.setupUi(this);
|
||||
this->setWindowTitle(tr("Sandboxie-Plus - Sandbox Import"));
|
||||
|
||||
ui.txtName->setText(Name);
|
||||
|
||||
QString Location = theAPI->GetGlobalSettings()->GetText("FileRootPath", "\\??\\%SystemDrive%\\Sandbox\\%USER%\\%SANDBOX%");
|
||||
ui.cmbRoot->addItem(Location/*.replace("%SANDBOX%", field("boxName").toString())*/);
|
||||
QStringList StdLocations = QStringList()
|
||||
<< "\\??\\%SystemDrive%\\Sandbox\\%USER%\\%SANDBOX%"
|
||||
<< "\\??\\%SystemDrive%\\Sandbox\\%SANDBOX%"
|
||||
<< "\\??\\%SystemDrive%\\Users\\%USER%\\Sandbox\\%SANDBOX%";
|
||||
foreach(auto StdLocation, StdLocations) {
|
||||
if (StdLocation != Location)
|
||||
ui.cmbRoot->addItem(StdLocation);
|
||||
}
|
||||
|
||||
connect(ui.btnRoot, &QPushButton::clicked, [&]() {
|
||||
QString FilePath = QFileDialog::getExistingDirectory(this, tr("Select Directory"));
|
||||
if (!FilePath.isEmpty())
|
||||
ui.cmbRoot->setCurrentText(FilePath.replace("/", "\\"));
|
||||
});
|
||||
|
||||
connect(ui.buttonBox, SIGNAL(accepted()), SLOT(OnAccept()));
|
||||
connect(ui.buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||
|
||||
//restoreGeometry(theConf->GetBlob("ExtractDialog/Window_Geometry"));
|
||||
}
|
||||
|
||||
CExtractDialog::~CExtractDialog()
|
||||
{
|
||||
//theConf->SetBlob("ExtractDialog/Window_Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
void CExtractDialog::OnAccept()
|
||||
{
|
||||
CSandBoxPtr pBox = theAPI->GetBoxByName(ui.txtName->text());
|
||||
if (!pBox.isNull()) {
|
||||
QMessageBox::warning(this, "Sandboxie-Plus", tr("This name is already in use, please select an alternative box name"));
|
||||
return;
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
QString CExtractDialog::GetRoot() const
|
||||
{
|
||||
QString Location = theAPI->GetGlobalSettings()->GetText("FileRootPath", "\\??\\%SystemDrive%\\Sandbox\\%USER%\\%SANDBOX%");
|
||||
if (Location == ui.cmbRoot->currentText())
|
||||
return "";
|
||||
return ui.cmbRoot->currentText();
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include "ui_ExtractDialog.h"
|
||||
#include "SbiePlusAPI.h"
|
||||
|
||||
class CExtractDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CExtractDialog(const QString& Name, QWidget *parent = Q_NULLPTR);
|
||||
~CExtractDialog();
|
||||
|
||||
QString GetName() const { return ui.txtName->text(); }
|
||||
QString GetRoot() const;
|
||||
|
||||
private slots:
|
||||
void OnAccept();
|
||||
|
||||
private:
|
||||
Ui::ExtractDialog ui;
|
||||
};
|
Loading…
Reference in New Issue