[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:19:11 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=d4e207c

The following commit has been merged in the master branch:
commit d4e207c3fa10419a534e69ad11605f9e3a9478fc
Author: Francesco Nwokeka <francesco.nwokeka at gmail.com>
Date:   Mon Mar 28 17:08:04 2011 +0200

    Added keyboard shortcuts for search in Chat-UI
    
    Added the default "find-next" and "find-previous" keyboard shortcuts to iterate over the find function in the
    chat-ui.
    Changed "next" and "previous" search bar button icons to match the standard ones
---
 app/chat-window.cpp     | 37 +++++++++++++++++++++++++++----------
 app/chat-window.h       |  4 +++-
 lib/chat-search-bar.cpp | 14 ++++++++++----
 lib/chat-search-bar.h   |  4 +++-
 lib/chat-widget.cpp     | 41 +++++++++++++++++++++++------------------
 lib/chat-widget.h       | 14 ++++++++------
 6 files changed, 74 insertions(+), 40 deletions(-)

diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 3b79498..b0a517e 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -19,6 +19,7 @@
 
 #include "chat-window.h"
 
+#include "chat-search-bar.h"
 #include "chat-tab.h"
 
 #include <KStandardAction>
@@ -45,16 +46,10 @@ ChatWindow::ChatWindow()
     KStandardAction::configureNotifications(this, SLOT(showNotificationsDialog()), actionCollection());
     KStandardAction::showMenubar(this->menuBar(), SLOT(setVisible(bool)), actionCollection());
 
-
-    // keyboard shortcut to toggle search bar
-    KAction *toggleSearchBarAction = new KAction(this);
-    toggleSearchBarAction->setIcon(KIcon("edit-find"));
-    toggleSearchBarAction->setShortcut(QKeySequence(QKeySequence::Find));
-
-    connect(toggleSearchBarAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(onSearchActionToggled()));
-
-    // add to collection so user can modify shortcut
-    actionCollection()->addAction(i18n("Find text"), toggleSearchBarAction);
+    // keyboard shortcuts for the search bar
+    KStandardAction::find(this, SLOT(onSearchActionToggled()), actionCollection());
+    KStandardAction::findNext(this, SLOT(onFindNextText()), actionCollection());
+    KStandardAction::findPrev(this, SLOT(onFindPreviousText()), actionCollection());
 
     // set up m_tabWidget
     m_tabWidget = new KTabWidget(this);
@@ -162,6 +157,28 @@ void ChatWindow::onCurrentIndexChanged(int index)
     setWindowIcon(currentChatTab->icon());
 }
 
+void ChatWindow::onFindNextText()
+{
+    ChatTab *currChat = qobject_cast<ChatTab*>(m_tabWidget->currentWidget());
+
+    // This should never happen
+    if(!currChat) {
+        return;
+    }
+    currChat->chatSearchBar()->onNextButtonClicked();
+}
+
+void ChatWindow::onFindPreviousText()
+{
+    ChatTab *currChat = qobject_cast<ChatTab*>(m_tabWidget->currentWidget());
+
+    // This should never happen
+    if(!currChat) {
+        return;
+    }
+    currChat->chatSearchBar()->onPreviousButtonClicked();
+}
+
 void ChatWindow::onSearchActionToggled()
 {
     ChatTab *currChat = qobject_cast<ChatTab*>(m_tabWidget->currentWidget());
diff --git a/app/chat-window.h b/app/chat-window.h
index aacfcef..45ba617 100644
--- a/app/chat-window.h
+++ b/app/chat-window.h
@@ -52,7 +52,9 @@ public slots:
 
 private slots:
     void onCurrentIndexChanged(int index);
-    void onSearchActionToggled();
+    void onFindNextText();              /** go to next text the user is searching for */
+    void onFindPreviousText();          /** go to previous text the user is searching for */
+    void onSearchActionToggled();       /** toggle search bar visibility */
     void onTabStateChanged();
     void onTabTextChanged(const QString &newTitle);
     void onTabIconChanged(const KIcon &newIcon);
diff --git a/lib/chat-search-bar.cpp b/lib/chat-search-bar.cpp
index 8fff36e..6b137b3 100644
--- a/lib/chat-search-bar.cpp
+++ b/lib/chat-search-bar.cpp
@@ -33,8 +33,8 @@ ChatSearchBar::ChatSearchBar(QWidget* parent)
     : QWidget(parent)
     , m_searchInput(new KLineEdit(this))
     , m_closeButton(new KPushButton(this))
-    , m_nextButton(new KPushButton(KIcon("arrow-down"), i18n("&Next"), this))
-    , m_previousButton(new KPushButton(KIcon("arrow-up"), i18n("&Previous"), this))
+    , m_nextButton(new KPushButton(KIcon("go-down-search"), i18n("&Next"), this))
+    , m_previousButton(new KPushButton(KIcon("go-up-search"), i18n("&Previous"), this))
     , m_caseSensitive(false)
 {
     // close button setup
@@ -92,12 +92,18 @@ KLineEdit* ChatSearchBar::searchBar() const
 
 void ChatSearchBar::onNextButtonClicked()
 {
-    emit(findNextSignal(m_searchInput->text(), findFlags()));
+    // no need to call this if search bar is hidden
+    if(isVisible()) {
+        emit(findNextSignal(m_searchInput->text(), findFlags()));
+    }
 }
 
 void ChatSearchBar::onPreviousButtonClicked()
 {
-    emit(findPreviousSignal(m_searchInput->text(), findFlags()));
+    // no need to call this if search bar is hidden
+    if(isVisible()) {
+        emit(findPreviousSignal(m_searchInput->text(), findFlags()));
+    }
 }
 
 void ChatSearchBar::onSearchTextComplete(bool found)
diff --git a/lib/chat-search-bar.h b/lib/chat-search-bar.h
index 6bed1b3..796280f 100644
--- a/lib/chat-search-bar.h
+++ b/lib/chat-search-bar.h
@@ -20,6 +20,8 @@
 #ifndef CHATSEARCHBAR_H
 #define CHATSEARCHBAR_H
 
+#include "kdetelepathychat_export.h"
+
 #include <QWebPage>
 #include <QWidget>
 
@@ -31,7 +33,7 @@ class KPushButton;
  * @author Francesco Nwokeka <francesco.nwokeka at gmail.com>
  */
 
-class ChatSearchBar : public QWidget
+class KDE_TELEPATHY_CHAT_EXPORT ChatSearchBar : public QWidget
 {
     Q_OBJECT
 public:
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 9083c3d..e9db9b7 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -272,6 +272,27 @@ void ChatWidget::resizeEvent(QResizeEvent *e)
     QWidget::resizeEvent(e);
 }
 
+KIcon ChatWidget::icon() const
+{
+    //normal chat - self and one other person.
+    if (!d->isGroupChat) {
+        //find the other contact which isn't self.
+        foreach(const Tp::ContactPtr & contact, d->channel->groupContacts()) {
+            if (contact != d->channel->groupSelfContact()) {
+                return iconForPresence(contact->presence().type());
+            }
+        }
+    }
+
+    //group chat
+    return iconForPresence(Tp::ConnectionPresenceTypeAvailable);
+}
+
+ChatSearchBar* ChatWidget::chatSearchBar() const
+{
+    return d->ui.searchBar;
+}
+
 Tp::TextChannelPtr ChatWidget::textChannel() const
 {
     return d->channel;
@@ -292,22 +313,6 @@ QString ChatWidget::title() const
     return d->title;
 }
 
-KIcon ChatWidget::icon() const
-{
-    //normal chat - self and one other person.
-    if (!d->isGroupChat) {
-        //find the other contact which isn't self.
-        foreach(const Tp::ContactPtr & contact, d->channel->groupContacts()) {
-            if (contact != d->channel->groupSelfContact()) {
-                return iconForPresence(contact->presence().type());
-            }
-        }
-    }
-
-    //group chat
-    return iconForPresence(Tp::ConnectionPresenceTypeAvailable);
-}
-
 QColor ChatWidget::titleColor() const
 {
     /*return a color to set the tab text as in order of importance
@@ -353,7 +358,7 @@ int ChatWidget::unreadMessageCount() const
     return d->unreadMessages;
 }
 
-void ChatWidget::toggleSearchBar()
+void ChatWidget::toggleSearchBar() const
 {
     if(d->ui.searchBar->isVisible()) {
         d->ui.searchBar->toggleView(false);
@@ -681,7 +686,7 @@ void ChatWidget::onInputBoxChanged()
 
 void ChatWidget::findTextInChat(const QString& text, QWebPage::FindFlags flags)
 {
-    // reset find
+    // reset highlights
     d->ui.chatArea->findText(QString(), flags);
 
     if(d->ui.chatArea->findText(text, flags)) {
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 02140f7..9e74888 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -30,8 +30,7 @@
 
 #include <TelepathyQt4/ReceivedMessage>
 
-
-
+class ChatSearchBar;
 class ChatWidgetPrivate;
 class QShowEvent;
 
@@ -43,15 +42,18 @@ public:
     explicit ChatWidget(const Tp::TextChannelPtr & channel, QWidget *parent = 0);
     virtual ~ChatWidget();
 
+    /** Returns the icon of this chat window */
+    KIcon icon() const;
+
+    /** Returns a pointer to the Chatwidget's search bar */
+    ChatSearchBar *chatSearchBar() const;
+
     /** Returns the text channel pointer of the chatWidget */
     Tp::TextChannelPtr textChannel() const;
 
     /** Returns the name of this chat window*/
     QString title() const;
 
-    /** Returns the icon of this chat window */
-    KIcon icon() const;
-
     /** Returns the suggested color for the title of the window*/
     QColor titleColor() const;
 
@@ -59,7 +61,7 @@ public:
 
 public slots:
     /** toggle the search bar visibility */
-    void toggleSearchBar();
+    void toggleSearchBar() const;
 
 protected:
     void changeEvent(QEvent *e);

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list