Commit 33bc854e authored by Karel Slaný's avatar Karel Slaný

Merge branch 'ios-cert-import' into 'develop'

Use ios file picker contoller for certificate import

Closes #144

See merge request !149
parents 9559fcea 1018fb64
...@@ -26,6 +26,7 @@ import QtQuick.Layouts 1.3 ...@@ -26,6 +26,7 @@ import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import cz.nic.mobileDatovka 1.0 import cz.nic.mobileDatovka 1.0
import cz.nic.mobileDatovka.iOsHelper 1.0
Item { Item {
id: pageSettingsAccount id: pageSettingsAccount
...@@ -41,7 +42,10 @@ Item { ...@@ -41,7 +42,10 @@ Item {
property string sLoginMethod: "pwd" property string sLoginMethod: "pwd"
property string oldUserName property string oldUserName
property bool iOS: false
Component.onCompleted: { Component.onCompleted: {
iOS = iOSHelper.isIos()
if (!isNewAccount) { if (!isNewAccount) {
accounts.getAccountData(userName) accounts.getAccountData(userName)
} }
...@@ -213,6 +217,16 @@ Item { ...@@ -213,6 +217,16 @@ Item {
width: parent.width width: parent.width
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
text: "" text: ""
Connections {
target: iOSHelper
onCertFilesSelectedSig: {
if (certFilePaths.length > 0) {
certPathLabelId.visible = true
certPathLabelId.text = certFilePaths[0]
fileDialogue.close()
}
}
}
} }
AccessibleButton { AccessibleButton {
id: certPathButtonId id: certPathButtonId
...@@ -221,7 +235,12 @@ Item { ...@@ -221,7 +235,12 @@ Item {
height: inputItemHeight height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize font.pointSize: defaultTextFont.font.pointSize
onClicked: { onClicked: {
fileDialogue.raise("Select certificate file", ["*.pem","*.p12","*.pfx"], true, "") if (iOS) {
iOSHelper.openDocumentPickerControllerForImport(IosImportAction.IMPORT_CERT, [])
fileDialogue.raise("Select certificate file", ["*.pem","*.p12","*.pfx"], true, iOSHelper.getCertFileLocation())
} else {
fileDialogue.raise("Select certificate file", ["*.pem","*.p12","*.pfx"], true, "")
}
} }
} }
AccessibleText { AccessibleText {
......
...@@ -270,3 +270,8 @@ QString IosHelper::moveFileToTargetPath(const QUrl &sourceFileUrl, ...@@ -270,3 +270,8 @@ QString IosHelper::moveFileToTargetPath(const QUrl &sourceFileUrl,
return QString(); return QString();
} }
QString IosHelper::getCertFileLocation(void)
{
return appCertDirPath();
}
...@@ -117,6 +117,14 @@ public: ...@@ -117,6 +117,14 @@ public:
Q_INVOKABLE static Q_INVOKABLE static
bool isIos(void); bool isIos(void);
/*!
* @brief Get certificate file location.
*
* @return Full path to certificate directory.
*/
Q_INVOKABLE static
QString getCertFileLocation(void);
signals: signals:
/*! /*!
* @brief Is activated when a file has been chosen with document picker. * @brief Is activated when a file has been chosen with document picker.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment