[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Btelepathy-chat-handler=5D_lib=3A_I=27m_not_sure_wha?=
From:       Lasath Fernando <kde () lasath ! org>
Date:       2011-06-26 14:01:44
Message-ID: 20110626140144.54D4EA60B4 () git ! kde ! org
[Download RAW message or body]

Git commit 53066d7730ed49c6558bb881a932956ec0360b93 by Lasath Fernando.
Committed on 25/06/2011 at 12:45.
Pushed by fernando into branch 'master'.

I'm not sure what I did in the previous commit, but this is the one that actually \
adds the new signal to proxy PageUp/PageDown events from ChatTextEdit to \
AdiumThemeView

M  +4    -0    lib/adium-theme-view.cpp     
M  +1    -0    lib/adium-theme-view.h     
M  +21   -7    lib/chat-text-edit.cpp     
M  +1    -0    lib/chat-text-edit.h     
M  +3    -0    lib/chat-widget.cpp     

http://commits.kde.org/telepathy-chat-handler/53066d7730ed49c6558bb881a932956ec0360b93


diff --git a/lib/adium-theme-view.cpp b/lib/adium-theme-view.cpp
index 2a8b36e..aa80d44 100644
--- a/lib/adium-theme-view.cpp
+++ b/lib/adium-theme-view.cpp
@@ -425,6 +425,10 @@ QString AdiumThemeView::replaceMessageKeywords(QString \
&htmlTemplate, const Adiu  return htmlTemplate;
 }
 
+void AdiumThemeView::onScrollEvent(QKeyEvent* e)
+{
+	keyPressEvent(e);
+}
 
 void AdiumThemeView::appendNewMessage(QString &html)
 {
diff --git a/lib/adium-theme-view.h b/lib/adium-theme-view.h
index d7c6cb2..54ab95c 100644
--- a/lib/adium-theme-view.h
+++ b/lib/adium-theme-view.h
@@ -64,6 +64,7 @@ public slots:
     void addContentMessage(const AdiumThemeContentInfo&);
     void addStatusMessage(const AdiumThemeStatusInfo&);
     void onLinkClicked(const QUrl&);
+	void onScrollEvent(QKeyEvent*);
 
 private:
     ChatWindowStyle* m_chatStyle;
diff --git a/lib/chat-text-edit.cpp b/lib/chat-text-edit.cpp
index 4c3a4c0..21e9953 100644
--- a/lib/chat-text-edit.cpp
+++ b/lib/chat-text-edit.cpp
@@ -25,9 +25,9 @@
 #include <QtCore/QTimer>
 
 ChatTextEdit::ChatTextEdit(QWidget *parent) :
-    KTextEdit(parent)
+        KTextEdit(parent)
 {
-    setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); // no need for \
horizontal scrollbar with this +    \
setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);    // no need for \
horizontal scrollbar with this  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setCheckSpellingEnabled(true);
@@ -42,9 +42,12 @@ ChatTextEdit::ChatTextEdit(QWidget *parent) :
 
 void ChatTextEdit::setFontBold(bool isBold)
 {
-    if (isBold) {
+    if (isBold)
+    {
         setFontWeight(QFont::Bold);
-    } else {
+    }
+    else
+    {
         setFontWeight(QFont::Normal);
     }
 }
@@ -63,16 +66,27 @@ QSize ChatTextEdit::minimumSizeHint() const
 QSize ChatTextEdit::sizeHint() const
 {
     QSize sh = QTextEdit::sizeHint();
-    sh.setHeight(int(document()->size().height()));
+    sh.setHeight(int (document()->size().height()));
     sh += QSize(0, (QFrame::lineWidth() * 2) + 1);
     return sh;
 }
 
 void ChatTextEdit::keyPressEvent(QKeyEvent* e)
 {
-    if (e->matches(QKeySequence::Find)) {
-        emit findTextShortcutPressed();
+    switch (e->key())
+    {
+        case Qt::Key_PageUp :
+        case Qt::Key_PageDown :
+            emit scrollEventRecieved(e);
+            break;
+
+        default :
+            if (e->matches(QKeySequence::Find))
+            {
+                emit findTextShortcutPressed();
+            }
     }
+
     KTextEdit::keyPressEvent(e);
 }
 
diff --git a/lib/chat-text-edit.h b/lib/chat-text-edit.h
index 4f553da..4c548ec 100644
--- a/lib/chat-text-edit.h
+++ b/lib/chat-text-edit.h
@@ -45,6 +45,7 @@ private slots:
 
 signals:
     void findTextShortcutPressed();
+	void scrollEventRecieved(QKeyEvent*);
 
 public slots:
     /** wraps setFontWeight to a simple on/off bold) */
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index b12162d..997b011 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -232,6 +232,9 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const \
                Tp::AccountPtr
     connect(d->ui.searchBar, \
SIGNAL(flagsChangedSignal(QString,QWebPage::FindFlags)), this, \
SLOT(findTextInChat(QString,QWebPage::FindFlags)));  
     connect(this, SIGNAL(searchTextComplete(bool)), d->ui.searchBar, \
SLOT(onSearchTextComplete(bool))); +
+	// to make PgUp and PgDown keys work properly
+	connect(d->ui.sendMessageBox, SIGNAL(scrollEventRecieved(QKeyEvent*)), \
d->ui.chatArea, SLOT(onScrollEvent(QKeyEvent*)));  }
 
 ChatWidget::~ChatWidget()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic