diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2013-10-11 01:07:50 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2013-10-11 01:07:50 +0000 |
commit | 6c36bde43f174cc0c655a158d72de39fce861c09 (patch) | |
tree | d05cd806e5f565d9551ec6213166eeab70d44f5d | |
parent | include qml in resources (diff) | |
download | gpg4usb-6c36bde43f174cc0c655a158d72de39fce861c09.tar.gz gpg4usb-6c36bde43f174cc0c655a158d72de39fce861c09.zip |
show some keydata in qml
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@1045 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | mainwindow.cpp | 6 | ||||
-rw-r--r-- | qml/keydetails.qml | 36 | ||||
-rw-r--r-- | qmlpage.cpp | 6 | ||||
-rw-r--r-- | qmlpage.h | 3 | ||||
-rw-r--r-- | textedit.cpp | 4 | ||||
-rw-r--r-- | textedit.h | 3 |
6 files changed, 47 insertions, 11 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp index 674be9f..0c0fee5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1255,11 +1255,11 @@ void MainWindow::slotShowKeyDetails() return; } - // TODO: get qml working here ;-) - edit->slotNewQMLTab("KeyDetailsQML", "TODO"); - KgpgCore::KgpgKey key = mCtx->getKeyDetails(mKeyList->getSelected()->first()); if (key.id() != "") { + // TODO: get qml working here ;-) + edit->slotNewQMLTab("KeyDetailsQML", key); + new KeyDetailsDialog(mCtx, key, this); } diff --git a/qml/keydetails.qml b/qml/keydetails.qml index 5c5a35d..8ddf0c0 100644 --- a/qml/keydetails.qml +++ b/qml/keydetails.qml @@ -9,11 +9,43 @@ Rectangle { //color: "red" Text { // qsTr() for internationalisation, like tr() - text: qsTr("var:") + text: qsTr("id:") } Text { x: 54 y: 0 - text: var1 + text: id + } + + Text { + id: text1 + x: 0 + y: 21 + text: qsTr("email") + font.pixelSize: 12 + } + + Text { + id: text2 + x: 54 + y: 21 + text: email + font.pixelSize: 12 + } + + Text { + id: text3 + x: -4 + y: 38 + text: qsTr("name") + font.pixelSize: 12 + } + + Text { + id: text4 + x: 54 + y: 38 + text: name + font.pixelSize: 12 } } diff --git a/qmlpage.cpp b/qmlpage.cpp index 213315a..eb40fca 100644 --- a/qmlpage.cpp +++ b/qmlpage.cpp @@ -5,7 +5,7 @@ #include <QDeclarativeContext> -QMLPage::QMLPage(const QString qmlfile, QWidget *parent) : +QMLPage::QMLPage(KgpgCore::KgpgKey key, QWidget *parent) : QWidget(parent) { @@ -15,7 +15,9 @@ QMLPage::QMLPage(const QString qmlfile, QWidget *parent) : qmlView->setSource(QUrl("qrc:/qml/keydetails.qml")); QDeclarativeContext *context = qmlView->rootContext(); - context->setContextProperty("var1", "derText"); + context->setContextProperty("id", key.id()); + context->setContextProperty("email", key.email()); + context->setContextProperty("name", key.name()); qDebug() << "qml:::::" << QUrl::fromLocalFile("keydetails.qml"); @@ -2,6 +2,7 @@ #define QMLPAGE_H #include <QWidget> +#include "kgpg/core/kgpgkey.h" class QMLPage : public QWidget { @@ -9,7 +10,7 @@ class QMLPage : public QWidget Q_OBJECT public: - QMLPage(const QString qmlfile, QWidget *parent = 0); + QMLPage(KgpgCore::KgpgKey key, QWidget *parent = 0); }; diff --git a/textedit.cpp b/textedit.cpp index e40a4af..22473aa 100644 --- a/textedit.cpp +++ b/textedit.cpp @@ -66,8 +66,8 @@ void TextEdit::slotNewHelpTab(QString title, QString path) } -void TextEdit::slotNewQMLTab(QString title, QString qmlfile) { - QMLPage *page = new QMLPage(qmlfile); +void TextEdit::slotNewQMLTab(QString title, KgpgCore::KgpgKey key) { + QMLPage *page = new QMLPage(key); tabWidget->addTab(page, title); tabWidget->setCurrentIndex(tabWidget->count() - 1); } @@ -25,6 +25,7 @@ #include "editorpage.h" #include "helppage.h" #include "quitdialog.h" +#include "kgpg/core/kgpgkey.h" QT_BEGIN_NAMESPACE class QDebug; @@ -147,7 +148,7 @@ public slots: */ void slotNewHelpTab(QString title, QString path); - void slotNewQMLTab(QString title, QString qmlfile); + void slotNewQMLTab(QString title, KgpgCore::KgpgKey key); /** * @details put a * in front of current tabs title, if current textedit is modified |