Commit 1018fb64 authored by Martin Straka's avatar Martin Straka

Use iOS file picker controller for certificate import

parent 9559fcea
......@@ -26,6 +26,7 @@ import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
import QtQuick.Dialogs 1.2
import cz.nic.mobileDatovka 1.0
import cz.nic.mobileDatovka.iOsHelper 1.0
Item {
id: pageSettingsAccount
......@@ -41,7 +42,10 @@ Item {
property string sLoginMethod: "pwd"
property string oldUserName
property bool iOS: false
Component.onCompleted: {
iOS = iOSHelper.isIos()
if (!isNewAccount) {
accounts.getAccountData(userName)
}
......@@ -213,6 +217,16 @@ Item {
width: parent.width
wrapMode: Text.WrapAnywhere
text: ""
Connections {
target: iOSHelper
onCertFilesSelectedSig: {
if (certFilePaths.length > 0) {
certPathLabelId.visible = true
certPathLabelId.text = certFilePaths[0]
fileDialogue.close()
}
}
}
}
AccessibleButton {
id: certPathButtonId
......@@ -221,7 +235,12 @@ Item {
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
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 {
......
......@@ -270,3 +270,8 @@ QString IosHelper::moveFileToTargetPath(const QUrl &sourceFileUrl,
return QString();
}
QString IosHelper::getCertFileLocation(void)
{
return appCertDirPath();
}
......@@ -117,6 +117,14 @@ public:
Q_INVOKABLE static
bool isIos(void);
/*!
* @brief Get certificate file location.
*
* @return Full path to certificate directory.
*/
Q_INVOKABLE static
QString getCertFileLocation(void);
signals:
/*!
* @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