Merge pull request #3735 from love-code-yeyixiao/master

Add an optional option for automatic unmount
This commit is contained in:
DavidXanatos 2024-03-23 12:26:24 +01:00 committed by GitHub
commit 2cb4a9cab5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 151 additions and 145 deletions

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>518</width>
<height>268</height>
<height>307</height>
</rect>
</property>
<property name="sizePolicy">
@ -25,73 +25,7 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="3">
<widget class="QLabel" name="lblImageSizeKb">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>kilobytes</string>
</property>
</widget>
</item>
<item row="2" column="2" colspan="3">
<widget class="QLineEdit" name="txtNewPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="3" column="2" colspan="3">
<widget class="QLineEdit" name="txtRepeatPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="7" column="2" colspan="3">
<widget class="QCheckBox" name="chkProtect">
<property name="text">
<string>Protect Box Root from access by unsandboxed processes</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLineEdit" name="txtImageSize">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="8" column="0" colspan="5">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="6" column="2" colspan="2">
<widget class="QComboBox" name="cmbCipher"/>
</item>
<item row="1" column="2" colspan="3">
<widget class="QLineEdit" name="txtPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblIcon">
<property name="text">
@ -99,10 +33,13 @@
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QCheckBox" name="chkShow">
<item row="0" column="1" colspan="2">
<widget class="QLabel" name="lblInfo">
<property name="text">
<string>Show Password</string>
<string>TextLabel</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
@ -116,6 +53,13 @@
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QLineEdit" name="txtPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="lblNewPassword">
<property name="text">
@ -126,6 +70,13 @@
</property>
</widget>
</item>
<item row="2" column="2" colspan="2">
<widget class="QLineEdit" name="txtNewPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="lblRepeatPassword">
<property name="text">
@ -136,6 +87,20 @@
</property>
</widget>
</item>
<item row="3" column="2" colspan="2">
<widget class="QLineEdit" name="txtRepeatPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QCheckBox" name="chkShow">
<property name="text">
<string>Show Password</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="lblImageSize">
<property name="text">
@ -146,6 +111,29 @@
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLineEdit" name="txtImageSize">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="lblImageSizeKb">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>kilobytes</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="lblCipher">
<property name="text">
@ -156,17 +144,32 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QLabel" name="lblInfo">
<item row="6" column="2">
<widget class="QComboBox" name="cmbCipher"/>
</item>
<item row="7" column="2" colspan="3">
<widget class="QCheckBox" name="chkProtect">
<property name="text">
<string>TextLabel</string>
<string>Protect Box Root from access by unsandboxed processes</string>
</property>
<property name="wordWrap">
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
<item row="8" column="2" colspan="3">
<widget class="QCheckBox" name="chkAutoLock">
<property name="text">
<string>Lock the box when all processes stop.</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>

View File

@ -1718,7 +1718,7 @@ SB_STATUS CSandMan::ImBoxMount(const CSandBoxPtr& pBox, bool bAutoUnmount)
CBoxImageWindow window(CBoxImageWindow::eMount, this);
if (theGUI->SafeExec(&window) != 1)
return SB_ERR(SB_Canceled);
return pBox->ImBoxMount(window.GetPassword(), window.UseProtection(), bAutoUnmount);
return pBox->ImBoxMount(window.GetPassword(), window.UseProtection(), window.AutoUnMount());
}
void CSandMan::dropEvent(QDropEvent* e)

View File

@ -93,8 +93,10 @@ CBoxImageWindow::CBoxImageWindow(EAction Action, QWidget *parent)
ui.cmbCipher->addItem("Serpent-AES", 5);
ui.cmbCipher->addItem("AES-Twofish-Serpent", 6);
if (m_Action != eMount)
if (m_Action != eMount) {
ui.chkProtect->setVisible(false);
ui.chkAutoLock->setVisible(false);
}
//restoreGeometry(theConf->GetBlob("BoxImageWindow/Window_Geometry"));
}

View File

@ -25,6 +25,7 @@ public:
void SetImageSize(quint64 uSize) const { return ui.txtImageSize->setText(QString::number(uSize / 1024)); }
quint64 GetImageSize() const { return ui.txtImageSize->text().toULongLong() * 1024; }
bool UseProtection() const { return ui.chkProtect->isChecked(); }
bool AutoUnMount() const { return ui.chkAutoLock->isChecked(); }
private slots:
void OnShowPassword();