diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2013-10-16 23:49:06 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2013-10-16 23:49:06 +0000 |
commit | 4a2fdb5c969208927201b9778037ecc92483ea30 (patch) | |
tree | 562047e2028df52aa3e8c5161895769f17bf84e9 /widgets/fileencryptionwidget.cpp | |
parent | rename qmlpage to widgets/keydetailswidget and add licence (diff) | |
download | gpg4usb-4a2fdb5c969208927201b9778037ecc92483ea30.tar.gz gpg4usb-4a2fdb5c969208927201b9778037ecc92483ea30.zip |
begin of fileencryptionwidget
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@1071 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'widgets/fileencryptionwidget.cpp')
-rw-r--r-- | widgets/fileencryptionwidget.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/widgets/fileencryptionwidget.cpp b/widgets/fileencryptionwidget.cpp new file mode 100644 index 0000000..b225a33 --- /dev/null +++ b/widgets/fileencryptionwidget.cpp @@ -0,0 +1,46 @@ +#include "fileencryptionwidget.h" + +FileEncryptionWidget::FileEncryptionWidget(GpgME::GpgContext *ctx, KeyList *keyList, QWidget *parent) + : QWidget(parent), mCtx(ctx), mKeyList(keyList) +{ + QDeclarativeView *qmlView = new QDeclarativeView; + qmlView->setResizeMode(QDeclarativeView::SizeRootObjectToView); + qmlView->setSource(QUrl("qrc:/qml/fileencryption.qml")); + + qmlRoot = qmlView->rootObject(); + connect( qmlRoot, SIGNAL(okClicked()), this, SLOT(slotEncryptFile())); + connect( qmlRoot, SIGNAL(fileChooserClicked()), this, SLOT(slotChooseFile())); + + QHBoxLayout *mainLayout = new QHBoxLayout(this); + mainLayout->setSpacing(0); + mainLayout->setContentsMargins(0,0,0,0); + mainLayout->addWidget(qmlView); + + connect(mKeyList, SIGNAL(keySelectionChanged()), this, SLOT(slotKeySelectionChanged())); +} + +void FileEncryptionWidget::slotKeySelectionChanged() { + qDebug() << "keySelChanges Signal received in fileencwidget"; + qmlRoot->setProperty("showNoKeySelected", (mKeyList->getSelected()->size() < 1)); +} + +void FileEncryptionWidget::slotEncryptFile() { + + if(mKeyList->getSelected()->size() < 1) { + qmlRoot->setProperty("showNoKeySelected", true); + } else { + qDebug() << "fine, fine"; + } + +} + +void FileEncryptionWidget::slotChooseFile() { + QString path = ""; + if (qmlRoot->property("inputFilePath").toString().size() > 0) { + path = QFileInfo(qmlRoot->property("inputFilePath").toString()).absolutePath(); + } + + //QString infileName = QFileDialog::getOpenFileName(this, tr("Open File"), path, tr("Files") + tr("All Files (*)")); + QString infileName = QFileDialog::getOpenFileName(this, tr("Open File"), path); + qmlRoot->setProperty("inputFilePath", infileName); +} |