diff options
-rw-r--r-- | gpg4usb.pro | 3 | ||||
-rw-r--r-- | gpg4usb.qrc | 1 | ||||
-rw-r--r-- | qml/KeyInfoRow.qml | 24 | ||||
-rw-r--r-- | qml/keydetails.qml | 49 | ||||
-rw-r--r-- | qmlpage.cpp | 4 |
5 files changed, 51 insertions, 30 deletions
diff --git a/gpg4usb.pro b/gpg4usb.pro index cd51c59..a210fb2 100644 --- a/gpg4usb.pro +++ b/gpg4usb.pro @@ -103,6 +103,7 @@ contains(DEFINES, GPG4USB_NON_PORTABLE) { OTHER_FILES += \ qml/keydetails.qml \ qml/Button.qml \ - qml/TextField.qml + qml/TextField.qml \ + qml/KeyInfoRow.qml diff --git a/gpg4usb.qrc b/gpg4usb.qrc index 54bdb4d..d1a4bbd 100644 --- a/gpg4usb.qrc +++ b/gpg4usb.qrc @@ -53,5 +53,6 @@ <file alias="button_previous.png">release/icons/button_previous.png</file> <file>qml/Button.qml</file> <file>qml/TextField.qml</file> + <file>qml/KeyInfoRow.qml</file> </qresource> </RCC> diff --git a/qml/KeyInfoRow.qml b/qml/KeyInfoRow.qml new file mode 100644 index 0000000..a1108dd --- /dev/null +++ b/qml/KeyInfoRow.qml @@ -0,0 +1,24 @@ +import QtQuick 1.1 + +Rectangle { + + id: keyinforow + + width: 200 + height: 23 + + property variant key + property variant value + + Text { + id: keyText + text: key + } + + Text { + id: valueText + x: 50 + y: 0 + text: value + } +} diff --git a/qml/keydetails.qml b/qml/keydetails.qml index e8a354c..141904f 100644 --- a/qml/keydetails.qml +++ b/qml/keydetails.qml @@ -15,6 +15,10 @@ Rectangle { property alias tf1Text: tf1.text property alias tf2Text: tf2.text +// property keyid : "" +// property email : "" +// property name : "" + //color: "red" Rectangle { id: rectangle2 @@ -34,44 +38,33 @@ Rectangle { color: "#978c79" } - Text { - // qsTr() for internationalisation, like tr() - x: 118 - y: 54 - text: qsTr("id:") - } - Text { - x: 172 + KeyInfoRow { + x: 119 y: 54 - text: id - } - - Text { - id: text1 - x: 118 - y: 75 - text: qsTr("email:") + // qsTr() for internationalisation, like tr() + key: qsTr("id:") + value: id } - Text { - id: text2 - x: 172 + KeyInfoRow { + x: 119 y: 75 - text: email + key: qsTr("email:") + value: email } - Text { - id: text3 + KeyInfoRow { x: 119 y: 96 - text: qsTr("name:") + key: qsTr("name:") + value: name } - Text { - id: text4 - x: 172 - y: 96 - text: name + KeyInfoRow { + x: 119 + y: 117 + key: qsTr("keysize") + value: key.size() / key.encyptionSize() } diff --git a/qmlpage.cpp b/qmlpage.cpp index 5d49f5d..64a8640 100644 --- a/qmlpage.cpp +++ b/qmlpage.cpp @@ -18,13 +18,15 @@ QMLPage::QMLPage(KgpgCore::KgpgKey key, QWidget *parent) : QDeclarativeView *qmlView = new QDeclarativeView; qmlView->setResizeMode(QDeclarativeView::SizeRootObjectToView); - qmlView->setSource(QUrl("qrc:/qml/keydetails.qml")); + context = qmlView->rootContext(); context->setContextProperty("id", key.id()); context->setContextProperty("email", key.email()); context->setContextProperty("name", key.name()); + qmlView->setSource(QUrl("qrc:/qml/keydetails.qml")); + /* or: http://xizhizhu.blogspot.de/2010/10/hybrid-application-using-qml-and-qt-c.html DeclarativePropertyMap map; |