aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mainwindow.cpp49
-rw-r--r--mainwindow.h6
2 files changed, 55 insertions, 0 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 21a82f0..e6242c0 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -400,11 +400,22 @@ void MainWindow::createMenus()
viewMenu = menuBar()->addMenu(tr("&View"));
+ if(settings.value("general/steganography").toBool()) {
+ steganoMenu = menuBar()->addMenu(tr("&Steganography"));
+ QAction* cutPgpHeaderAct = new QAction(tr("Remove PGP Header"), this);
+ connect(cutPgpHeaderAct, SIGNAL(triggered()), this, SLOT(cutPgpHeader()));
+ QAction* addPgpHeaderAct = new QAction(tr("Add PGP Header"), this);
+ connect(addPgpHeaderAct, SIGNAL(triggered()), this, SLOT(addPgpHeader()));
+ steganoMenu->addAction(cutPgpHeaderAct);
+ steganoMenu->addAction(addPgpHeaderAct);
+ }
+
helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(openTutorialAct);
helpMenu->addAction(openTranslateAct);
helpMenu->addAction(startWizardAct);
helpMenu->addAction(aboutAct);
+
}
void MainWindow::createToolBars()
@@ -858,3 +869,41 @@ void MainWindow::cleanDoubleLinebreaks()
content.replace("\n\n", "\n");
edit->fillTextEditWithText(content);
}
+
+void MainWindow::addPgpHeader() {
+ if (edit->tabCount()==0 || edit->curPage() == 0) {
+ return;
+ }
+
+ QString content = edit->curTextPage()->toPlainText().trimmed();
+
+ content.prepend("\n\n").prepend(GpgConstants::PGP_CRYPT_BEGIN);
+ content.append("\n").append(GpgConstants::PGP_CRYPT_END);
+
+ edit->fillTextEditWithText(content);
+}
+
+void MainWindow::cutPgpHeader() {
+
+ if (edit->tabCount()==0 || edit->curPage() == 0) {
+ return;
+ }
+
+ QString content = edit->curTextPage()->toPlainText();
+ int start = content.indexOf(GpgConstants::PGP_CRYPT_BEGIN);
+ int end = content.indexOf(GpgConstants::PGP_CRYPT_END);
+
+ if(start < 0 || end < 0) {
+ return;
+ }
+
+ // remove head
+ int headEnd = content.indexOf("\n\n", start) + 2 ;
+ content.remove(start, headEnd-start);
+
+ // remove tail
+ end = content.indexOf(GpgConstants::PGP_CRYPT_END);
+ content.remove(end, QString(GpgConstants::PGP_CRYPT_END).size());
+
+ edit->fillTextEditWithText(content.trimmed());
+}
diff --git a/mainwindow.h b/mainwindow.h
index d690788..16ee618 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -22,6 +22,7 @@
#ifndef __GPGWIN_H__
#define __GPGWIN_H__
+#include "gpgconstants.h"
#include "attachments.h"
#include "keymgmt.h"
#include "textedit.h"
@@ -171,6 +172,10 @@ private slots:
* @details Replace double linebreaks by single linebreaks in currently active tab.
*/
void cleanDoubleLinebreaks();
+
+ void cutPgpHeader();
+ void addPgpHeader();
+
// void dropEvent(QDropEvent *event);
private:
@@ -234,6 +239,7 @@ private:
QMenu *keyMenu; /** Submenu for key-operations */
QMenu *viewMenu; /** View submenu */
QMenu *importKeyMenu; /** Sumenu for import operations */
+ QMenu *steganoMenu; /** Submenu for steganographic operations*/
QToolBar *cryptToolBar; /** Toolbar holding crypt actions */
QToolBar *fileToolBar; /** Toolbar holding file actions */
QToolBar *editToolBar; /** Toolbar holding edit actions */