summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <kde@opensource.sf-tec.de>2011-08-31 20:14:19 (GMT)
committerRolf Eike Beer <eike-kernel@sf-tec.de>2011-08-31 20:14:19 (GMT)
commitc1c93a2853feb20e974f89ada7f16d26ee56e54c (patch)
tree43add11d6d3b664238a62e40edeb8d3b151cc9e2
parentc2237cef45df49feeb941869e10630f5239a8a08 (diff)
if a user calls "kgpg -s" don't probe the file contents but immediately decryptrefs/backups/branch-KDE/4.7-1314822375
Without this e.g. binary encrypted files could not be opened. If the user explicitely asks us to decrypt the file then do what he wants.
-rw-r--r--editor/kgpgtextedit.cpp7
-rw-r--r--editor/kgpgtextedit.h1
-rw-r--r--kgpgexternalactions.cpp5
3 files changed, 10 insertions, 3 deletions
diff --git a/editor/kgpgtextedit.cpp b/editor/kgpgtextedit.cpp
index abf76ac..bb4fd9a 100644
--- a/editor/kgpgtextedit.cpp
+++ b/editor/kgpgtextedit.cpp
@@ -75,6 +75,11 @@ void KgpgTextEdit::dropEvent(QDropEvent *e)
void KgpgTextEdit::slotDroppedFile(const KUrl &url)
{
+ openDroppedFile(url, true);
+}
+
+void KgpgTextEdit::openDroppedFile(const KUrl& url, const bool probe)
+{
KUrl tmpurl;
if (url.isLocalFile()) {
@@ -103,7 +108,7 @@ void KgpgTextEdit::slotDroppedFile(const KUrl &url)
if (result.isEmpty())
return;
- if (KGpgDecrypt::isEncryptedText(result, &m_posstart, &m_posend)) {
+ if (!probe || KGpgDecrypt::isEncryptedText(result, &m_posstart, &m_posend)) {
// if pgp data found, decode it
KGpgDecrypt *decr = new KGpgDecrypt(this, KUrl::List(tmpurl));
connect(decr, SIGNAL(done(int)), SLOT(slotDecryptDone(int)));
diff --git a/editor/kgpgtextedit.h b/editor/kgpgtextedit.h
index 159777c..ad00de8 100644
--- a/editor/kgpgtextedit.h
+++ b/editor/kgpgtextedit.h
@@ -35,6 +35,7 @@ public:
~KgpgTextEdit();
void signVerifyText(const QString &message);
+ void openDroppedFile(const KUrl &url, const bool probe);
signals:
void newText();
diff --git a/kgpgexternalactions.cpp b/kgpgexternalactions.cpp
index 6c0cddc..6ee2bde 100644
--- a/kgpgexternalactions.cpp
+++ b/kgpgexternalactions.cpp
@@ -379,10 +379,11 @@ void KGpgExternalActions::decryptNextFile(const KUrl &failed, KgpgLibrary *lib)
void KGpgExternalActions::showDroppedFile()
{
KgpgEditor *kgpgtxtedit = new KgpgEditor(m_keysmanager, m_model, 0);
- kgpgtxtedit->m_editor->slotDroppedFile(droppedUrls.first());
-
connect(kgpgtxtedit, SIGNAL(encryptFiles(KUrl::List)), SLOT(encryptFiles(KUrl::List)));
connect(m_keysmanager, SIGNAL(fontChanged(QFont)), kgpgtxtedit, SLOT(slotSetFont(QFont)));
+
+ kgpgtxtedit->m_editor->openDroppedFile(droppedUrls.first(), false);
+
kgpgtxtedit->show();
}