aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2013-10-14 22:22:22 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2013-10-14 22:22:22 +0000
commit3adc7ee78033c4ad2be32a8bf38d0971c7eb30d5 (patch)
treea2ebfb740e0ef741bc076d74a6b6dc69c5deb136
parentupdated TODO (diff)
downloadgpg4usb-3adc7ee78033c4ad2be32a8bf38d0971c7eb30d5.tar.gz
gpg4usb-3adc7ee78033c4ad2be32a8bf38d0971c7eb30d5.zip
add keyinforow qml widget
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@1060 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--gpg4usb.pro3
-rw-r--r--gpg4usb.qrc1
-rw-r--r--qml/KeyInfoRow.qml24
-rw-r--r--qml/keydetails.qml49
-rw-r--r--qmlpage.cpp4
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;