summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Orderud <fredrik.orderud@ge.com>2018-10-14 20:43:04 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2018-10-19 13:26:33 +0000
commitd36d6ca320125ea5dd0e3dd451616e97c568b907 (patch)
tree5e8deaf0d95f258053fe718823d0bdb15dab8da8
parentcf0e85184dbba6b9d5feb106277d323521d18b0c (diff)
Extend QAxSelect with a "sandboxing" combo-box
Enables UI selection between "None", "Process isolation" and "Low integrity process" when selecting an ActiveX control from the dialog. Task-number: QTBUG-70983 Change-Id: Ic136dec4e0981cd167bed217283f1761969da6b4 Reviewed-by: Andre de la Rocha <andre.rocha@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/activeqt/container/qaxselect.cpp38
-rw-r--r--src/activeqt/container/qaxselect.h8
-rw-r--r--src/activeqt/container/qaxselect.ui23
3 files changed, 67 insertions, 2 deletions
diff --git a/src/activeqt/container/qaxselect.cpp b/src/activeqt/container/qaxselect.cpp
index 1b860e7..2f0f2aa 100644
--- a/src/activeqt/container/qaxselect.cpp
+++ b/src/activeqt/container/qaxselect.cpp
@@ -67,6 +67,20 @@
QT_BEGIN_NAMESPACE
+/*!
+ \since 5.13
+
+ \enum QAxSelect::SandboxingLevel
+
+ The SandboxingLevel enumeration defines the desired level of ActiveX sandboxing.
+
+ \value SandboxingNone No specific sandboxing desired
+ \value SandboxingProcess Run ActiveX control in a separate process
+ \value SandboxingLowIntegrity Run ActiveX control in a separate low-integrity process
+
+ Sandboxing requires that the ActiveX is either built as an EXE, or as a DLL with AppID "DllSurrogate" enabled.
+*/
+
enum ControlType { InProcessControl, OutOfProcessControl };
struct Control
@@ -327,8 +341,9 @@ public:
\inmodule QAxContainer
QAxSelect dialog can be used to provide users with a way to browse the registered COM
- components of the system and select one. The CLSID of the selected component can
- then be used in the application to e.g. initialize a QAxWidget:
+ components of the system and select one. It also provides a combo box for selecting
+ desired sandboxing level. The CLSID of the selected component can then be used in the
+ application to e.g. initialize a QAxWidget:
\snippet src_activeqt_container_qaxselect.cpp 0
@@ -359,6 +374,9 @@ QAxSelect::QAxSelect(QWidget *parent, Qt::WindowFlags flags)
d->filterModel->setSourceModel(new ControlList(this));
d->selectUi.ActiveXList->setModel(d->filterModel);
+ QStringList sandboxingOptions = { QLatin1String("None"), QLatin1String("Process isolation"), QLatin1String("Low integrity process") };
+ d->selectUi.SandboxingCombo->addItems(sandboxingOptions);
+
connect(d->selectUi.ActiveXList->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QAxSelect::onActiveXListCurrentChanged);
connect(d->selectUi.ActiveXList, &QAbstractItemView::activated,
@@ -390,6 +408,22 @@ QString QAxSelect::clsid() const
return d->selectUi.ActiveX->text().trimmed();
}
+/*!
+ \since 5.13
+
+ Returns the desired level of sandboxing for the ActiveX control.
+*/
+QAxSelect::SandboxingLevel QAxSelect::sandboxingLevel() const
+{
+ int idx = d->selectUi.SandboxingCombo->currentIndex();
+ if (idx == 1)
+ return SandboxingProcess;
+ else if (idx == 2)
+ return SandboxingLowIntegrity;
+ else
+ return SandboxingNone;
+}
+
void QAxSelect::onActiveXListCurrentChanged(const QModelIndex &index)
{
const QString newClsid = d->clsidAt(index);
diff --git a/src/activeqt/container/qaxselect.h b/src/activeqt/container/qaxselect.h
index d17de95..960abd9 100644
--- a/src/activeqt/container/qaxselect.h
+++ b/src/activeqt/container/qaxselect.h
@@ -61,9 +61,17 @@ class QAxSelect : public QDialog
{
Q_OBJECT
public:
+ enum SandboxingLevel {
+ SandboxingNone = 0,
+ SandboxingProcess,
+ SandboxingLowIntegrity,
+ };
+
explicit QAxSelect(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
~QAxSelect() override;
+
QString clsid() const;
+ SandboxingLevel sandboxingLevel() const;
private Q_SLOTS:
void onActiveXListCurrentChanged(const QModelIndex &);
diff --git a/src/activeqt/container/qaxselect.ui b/src/activeqt/container/qaxselect.ui
index c6f3b0a..af5f973 100644
--- a/src/activeqt/container/qaxselect.ui
+++ b/src/activeqt/container/qaxselect.ui
@@ -96,6 +96,29 @@
</item>
</layout>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="unnamed2">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="TextLabel2">
+ <property name="text">
+ <string>Sandboxing:</string>
+ </property>
+ <property name="buddy">
+ <cstring>SandboxingCombo</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="SandboxingCombo"/>
+ </item>
+ </layout>
+ </item>
</layout>
</item>
<item>