From 51c24e1b53245a1fb05b9a6f47eab3e07386a710 Mon Sep 17 00:00:00 2001 From: nils Date: Wed, 19 Sep 2012 21:53:25 +0000 Subject: added find action (but has to be improved) git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@960 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- mainwindow.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'mainwindow.cpp') diff --git a/mainwindow.cpp b/mainwindow.cpp index dd5b306..b556dda 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -248,6 +248,11 @@ void MainWindow::createActions() selectallAct->setToolTip(tr("Select the whole text")); connect(selectallAct, SIGNAL(triggered()), edit, SLOT(selectAll())); + findAct = new QAction(tr("&Find"), this); + findAct->setShortcut(QKeySequence::Find); + findAct->setToolTip(tr("Find a word")); + connect(findAct, SIGNAL(triggered()), this, SLOT(find())); + cleanDoubleLinebreaksAct = new QAction(tr("Remove &spacing"), this); cleanDoubleLinebreaksAct->setIcon(QIcon(":format-line-spacing-triple.png")); //cleanDoubleLineBreaksAct->setShortcut(QKeySequence::SelectAll); @@ -292,7 +297,6 @@ void MainWindow::createActions() fileVerifyAct->setToolTip(tr("Verify File")); connect(fileVerifyAct, SIGNAL(triggered()), this, SLOT(fileVerify())); - signAct = new QAction(tr("&Sign"), this); signAct->setIcon(QIcon(":signature.png")); signAct->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I)); @@ -401,6 +405,7 @@ void MainWindow::disableTabActions(int number) pasteAct->setDisabled(disable); closeTabAct->setDisabled(disable); selectallAct->setDisabled(disable); + findAct->setDisabled(disable); verifyAct->setDisabled(disable); signAct->setDisabled(disable); encryptAct->setDisabled(disable); @@ -444,6 +449,8 @@ void MainWindow::createMenus() editMenu->addAction(cutAct); editMenu->addAction(pasteAct); editMenu->addAction(selectallAct); + editMenu->addAction(findAct); + editMenu->addSeparator(); editMenu->addAction(quoteAct); editMenu->addAction(cleanDoubleLinebreaksAct); editMenu->addSeparator(); @@ -976,6 +983,19 @@ void MainWindow::slotDecryptDone(int result) decr->deleteLater(); } +void MainWindow::find() +{ + if (edit->tabCount()==0 || edit->curPage() == 0) { + return; + } + + // At first close verifynotification, if existing + edit->curPage()->closeNoteByClass("findWidget"); + + FindWidget *fw = new FindWidget(this,edit->curTextPage()); + edit->curPage()->showNotificationWidget(fw, "findWidget"); + +} void MainWindow::verify() { -- cgit v1.2.3