diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-07-25 20:14:12 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-07-25 20:14:12 +0200 |
commit | c8f94cdbcf4eb5dc7b7d6b17551c6211e116ca98 (patch) | |
tree | e90b4855c36bfd67f93f81ee8503e6389c2c0f15 /src | |
parent | Merge commit 'megabigbug/ContextsMenus' (diff) | |
parent | Fixing codestyle and changing a bit red color (diff) | |
download | rekonq-c8f94cdbcf4eb5dc7b7d6b17551c6211e116ca98.tar.xz |
Merge branch 'findbarNEW'
Diffstat (limited to 'src')
-rw-r--r-- | src/findbar.cpp | 26 | ||||
-rw-r--r-- | src/findbar.h | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 10 |
3 files changed, 30 insertions, 8 deletions
diff --git a/src/findbar.cpp b/src/findbar.cpp index 3efe470b..0656eef5 100644 --- a/src/findbar.cpp +++ b/src/findbar.cpp @@ -29,12 +29,14 @@ #include <KPushButton> #include <klocalizedstring.h> #include <KXmlGuiWindow> +#include <KApplication> // Qt Includes #include <QtGui/QWidget> #include <QtGui/QHBoxLayout> #include <QtGui/QToolButton> #include <QtGui/QLabel> +#include <QtGui/QColor> #include <QtGui/QKeyEvent> #include <QtCore/QString> @@ -139,6 +141,30 @@ void FindBar::keyPressEvent(QKeyEvent* event) emit searchString(m_lineEdit->text()); return; } + QWidget::keyPressEvent(event); } +void FindBar::notifyMatch(bool match) +{ + QPalette p = m_lineEdit->palette(); + + if (m_lineEdit->text().isEmpty()) + { + p.setColor(QPalette::Base, QColor(KApplication::palette().color(QPalette::Active, QPalette::Base))); + } + else + { + if (match) + { + p.setColor(QPalette::Base, QColor(186, 249, 206)); + } + else + { + p.setColor(QPalette::Base, QColor(247, 130, 130)); // previous were 247, 230, 230 + } + } + m_lineEdit->setPalette(p); +} + + diff --git a/src/findbar.h b/src/findbar.h index 6a6137ab..f297e6d2 100644 --- a/src/findbar.h +++ b/src/findbar.h @@ -51,6 +51,7 @@ public: public slots: void clear(); void show(); + void notifyMatch(bool match); protected Q_SLOTS: void keyPressEvent(QKeyEvent* event); @@ -61,6 +62,7 @@ signals: private: KLineEdit *m_lineEdit; QCheckBox *m_matchCase; + }; #endif diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b2e5106c..27b9a65b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -614,10 +614,7 @@ void MainWindow::slotFindNext() if (m_findBar->matchCase()) options |= QWebPage::FindCaseSensitively; - if (!currentTab()->findText(m_lastSearch, options)) - { - notifyMessage(QString(m_lastSearch) + i18n(" not found.")); - } + m_findBar->notifyMatch(currentTab()->findText(m_lastSearch, options)); } @@ -630,10 +627,7 @@ void MainWindow::slotFindPrevious() if (m_findBar->matchCase()) options |= QWebPage::FindCaseSensitively; - if (!currentTab()->findText(m_lastSearch, options)) - { - notifyMessage(QString(m_lastSearch) + i18n(" not found.")); - } + m_findBar->notifyMatch(currentTab()->findText(m_lastSearch, options)); } |