summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorCatalin Badea <catalin.badea392@gmail.com>2012-08-09 07:07:42 (GMT)
committerCatalin Badea <catalin.badea392@gmail.com>2012-08-09 07:07:42 (GMT)
commita3c71dd9b0597efbef18c23b797919863595d170 (patch)
tree61b408f7f73aa42312d5a837cf6ce4614f7f2f4c /Swift
parentb45019f8a762db0a15d249b22c85d55ad8f33e8b (diff)
downloadswift-contrib-a3c71dd9b0597efbef18c23b797919863595d170.zip
swift-contrib-a3c71dd9b0597efbef18c23b797919863595d170.tar.bz2
Highlight search term.
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtChatView.cpp6
-rw-r--r--Swift/QtUI/QtChatView.h4
-rw-r--r--Swift/QtUI/QtHistoryWindow.cpp6
-rw-r--r--Swift/QtUI/QtHistoryWindow.h1
4 files changed, 17 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp
index 74ffb8b..05e2191 100644
--- a/Swift/QtUI/QtChatView.cpp
+++ b/Swift/QtUI/QtChatView.cpp
@@ -294,6 +294,8 @@ void QtChatView::handleFrameSizeChanged() {
if (isAtBottom_) {
scrollToBottom();
}
+
+ emit contentSizeChanged();
}
void QtChatView::handleLinkClicked(const QUrl& url) {
@@ -466,4 +468,8 @@ void QtChatView::resetTopInsertPoint() {
firstElement_ = QWebElement();
}
+bool QtChatView::findText(const QString& text, QWebPage::FindFlags options) {
+ return webPage_->findText(text, options);
+}
+
}
diff --git a/Swift/QtUI/QtChatView.h b/Swift/QtUI/QtChatView.h
index 8c523d5..6b5d21f 100644
--- a/Swift/QtUI/QtChatView.h
+++ b/Swift/QtUI/QtChatView.h
@@ -11,6 +11,7 @@
#include <QWidget>
#include <QList>
#include <QWebElement>
+#include <QWebPage>
#include <boost/shared_ptr.hpp>
@@ -47,6 +48,8 @@ namespace Swift {
void setMUCInvitationJoined(QString id);
void showEmoticons(bool show);
int getSnippetPositionByDate(const QDate& date);
+ bool findText(const QString& text, QWebPage::FindFlags options);
+
signals:
void gotFocus();
void fontResized(int);
@@ -54,6 +57,7 @@ namespace Swift {
void scrollRequested(int pos);
void scrollReachedTop();
void scrollReachedBottom();
+ void contentSizeChanged();
public slots:
void copySelectionToClipboard();
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp
index b9f2e91..c2dcbcb 100644
--- a/Swift/QtUI/QtHistoryWindow.cpp
+++ b/Swift/QtUI/QtHistoryWindow.cpp
@@ -61,6 +61,7 @@ QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* even
connect(conversation_, SIGNAL(scrollReachedTop()), this, SLOT(handleScrollReachedTop()));
connect(conversation_, SIGNAL(scrollReachedBottom()), this, SLOT(handleScrollReachedBottom()));
connect(conversation_, SIGNAL(fontResized(int)), this, SLOT(handleFontResized(int)));
+ connect(conversation_, SIGNAL(contentSizeChanged()), this, SLOT(handleContentSizeChanged()));
connect(ui_.searchBox_->lineEdit(), SIGNAL(returnPressed()), this, SLOT(handleReturnPressed()));
connect(ui_.calendarWidget_, SIGNAL(clicked(const QDate&)), this, SLOT(handleCalendarClicked(const QDate&)));
connect(ui_.calendarWidget_, SIGNAL(activated(const QDate&)), this, SLOT(handleCalendarClicked(const QDate&)));
@@ -73,6 +74,7 @@ QtHistoryWindow::~QtHistoryWindow() {
disconnect(conversation_, SIGNAL(scrollReachedTop()), this, SLOT(handleScrollReachedTop()));
disconnect(conversation_, SIGNAL(scrollReachedBottom()), this, SLOT(handleScrollReachedBottom()));
disconnect(conversation_, SIGNAL(fontResized(int)), this, SLOT(handleFontResized(int)));
+ disconnect(conversation_, SIGNAL(contentSizeChanged()), this, SLOT(handleContentSizeChanged()));
disconnect(ui_.searchBox_->lineEdit(), SIGNAL(returnPressed()), this, SLOT(handleReturnPressed()));
disconnect(ui_.calendarWidget_, SIGNAL(clicked(const QDate&)), this, SLOT(handleCalendarClicked(const QDate&)));
disconnect(ui_.calendarWidget_, SIGNAL(activated(const QDate&)), this, SLOT(handleCalendarClicked(const QDate&)));
@@ -233,4 +235,8 @@ boost::gregorian::date QtHistoryWindow::getLastVisibleDate() {
return boost::gregorian::date(boost::gregorian::not_a_date_time);
}
+void QtHistoryWindow::handleContentSizeChanged() {
+ conversation_->findText(ui_.searchBox_->lineEdit()->text(), QWebPage::HighlightAllOccurrences);
+}
+
}
diff --git a/Swift/QtUI/QtHistoryWindow.h b/Swift/QtUI/QtHistoryWindow.h
index 49de098..79449bd 100644
--- a/Swift/QtUI/QtHistoryWindow.h
+++ b/Swift/QtUI/QtHistoryWindow.h
@@ -48,6 +48,7 @@ namespace Swift {
void handleCalendarClicked(const QDate& date);
void handlePreviousButtonClicked();
void handleNextButtonClicked();
+ void handleContentSizeChanged();
private:
void handleSomethingSelectedChanged(RosterItem* item);