aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-09-22 19:11:12 +0000
committernils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-09-22 19:11:12 +0000
commitc6d59c2d4d1f3c605db74b0e16b3ae9a072a1282 (patch)
tree388647ac3b17ab2dc47344599bfd7110079b3bd3
parentadded button to tabbar of textedit to add tab (but has still has to be styled) (diff)
downloadgpg4usb-c6d59c2d4d1f3c605db74b0e16b3ae9a072a1282.tar.gz
gpg4usb-c6d59c2d4d1f3c605db74b0e16b3ae9a072a1282.zip
added close button and more beautifying in findwidget
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@966 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--TODO5
-rw-r--r--findwidget.cpp48
-rw-r--r--findwidget.h2
3 files changed, 48 insertions, 7 deletions
diff --git a/TODO b/TODO
index d2f314b..2ff7039 100644
--- a/TODO
+++ b/TODO
@@ -3,11 +3,13 @@ TODO:
Release 0.4
- MacOS build
- replace gpgme with kgpg (lots of work and trouble!!!)
+- Refresh key from keyserver [DONE]
+- add find action in textedit [DONE]
+ - BUG: hit strg+f and then esc -> textedit uneditable, same after hitting escape after entering a non found text
- Change private key password
- create revocation file
- on key generation
- later
-- Refresh key from keyserver [DONE]
- Upload key to keyserver
- show message if verify has no valid signature
- exclude translators list from about dialog [DONE]
@@ -16,7 +18,6 @@ Release 0.4
- add possibility for creation of RSA keys [DONE]
- add posibility to add keyserver in settings [DONE]
- add posibility to remove keyserver in settings [DONE]
-- add find action in textedit
- keysigning and owner trust
- catch bad passphrase message (in case of multiple private keys available for decryption)
- add keyless encryption (symmetric, password only)
diff --git a/findwidget.cpp b/findwidget.cpp
index 23deb33..7942d37 100644
--- a/findwidget.cpp
+++ b/findwidget.cpp
@@ -6,14 +6,18 @@ FindWidget::FindWidget(QWidget *parent, QTextEdit *edit) :
{
mTextpage = edit;
findEdit = new QLineEdit(this);
+ closeButton= new QPushButton(this->style()->standardIcon(QStyle::SP_TitleBarCloseButton),"",this);
QHBoxLayout *notificationWidgetLayout = new QHBoxLayout(this);
notificationWidgetLayout->setContentsMargins(10,0,0,0);
notificationWidgetLayout->addWidget(new QLabel(tr("Find:")));
notificationWidgetLayout->addWidget(findEdit,2);
+ notificationWidgetLayout->addWidget(closeButton);
+
this->setLayout(notificationWidgetLayout);
connect(findEdit,SIGNAL(textChanged(QString)),this,SLOT(find()));
connect(findEdit,SIGNAL(returnPressed()),this,SLOT(findNext()));
+ connect(closeButton,SIGNAL(clicked()),this,SLOT(closeSlot()));
// The timer is necessary for setting the focus
QTimer::singleShot(0, findEdit, SLOT(setFocus()));
@@ -27,6 +31,16 @@ void FindWidget::findNext()
cursor.setPosition(0);
cursor = mTextpage->document()->find(findEdit->text(), cursor, QTextDocument::FindCaseSensitively);
}
+
+ // if match is found set background of QLineEdit to white, otherwise to red
+ QPalette bgPalette( findEdit->palette() );
+ if ((cursor.position() == -1) && (!findEdit->text().isEmpty())) {
+ bgPalette.setColor( QPalette::Base, "#ececba");
+ } else {
+ bgPalette.setColor( QPalette::Base, Qt::white);
+ }
+ findEdit->setPalette(bgPalette);
+
mTextpage->setTextCursor(cursor);
}
@@ -37,6 +51,16 @@ void FindWidget::find()
} else {
cursor = mTextpage->document()->find(findEdit->text(), cursor.anchor(), QTextDocument::FindCaseSensitively);
}
+
+ // if match is found set background of QLineEdit to white, otherwise to red
+ QPalette bgPalette( findEdit->palette() );
+ if ((cursor.position() == -1) && (!findEdit->text().isEmpty())) {
+ bgPalette.setColor( QPalette::Base, "#ececba");
+ } else {
+ bgPalette.setColor( QPalette::Base, Qt::white);
+ }
+ findEdit->setPalette(bgPalette);
+
mTextpage->setTextCursor(cursor);
}
@@ -44,11 +68,25 @@ void FindWidget::keyPressEvent( QKeyEvent* e )
{
switch ( e->key() )
{
- case Qt::Key_Escape:
- mTextpage->setFocus();
- this->close();
- case Qt::Key_F3:
- this->findNext();
+ case Qt::Key_Escape:
+ this->closeSlot();
+ break;
+/* case Qt::Key_Enter:
+ this->findNext();
+ case Qt::Key_Return:
+ this->findNext();
+*/
+ case Qt::Key_F3:
+ this->findNext();
+ break;
+ }
+}
+void FindWidget::closeSlot() {
+ if ( cursor.position() == -1) {
+ cursor.setPosition(0);
+ mTextpage->setTextCursor(cursor);
}
+ mTextpage->setFocus();
+ close();
}
diff --git a/findwidget.h b/findwidget.h
index 3f778ec..b3dfa97 100644
--- a/findwidget.h
+++ b/findwidget.h
@@ -28,9 +28,11 @@ private:
QLineEdit *findEdit; /** Label holding the text shown in verifyNotification */
QTextCursor cursor;
QTextCharFormat cursorFormat;
+ QPushButton *closeButton;
private slots:
void findNext();
void find();
+ void closeSlot();
};
#endif // FINDWIDGET_H