[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:22:05 UTC 2016


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

The following commit has been merged in the master branch:
commit f23d63c9cbc84d5a256eda8b4b9bac3a57b73489
Author: Dan Vrátil <dan at progdan.cz>
Date:   Sun Jul 15 17:24:54 2012 +0200

    Add links to navigate between previous and next conversations
    
    REVIEW: 105578
---
 lib/adium-theme-view.h                 |  2 +-
 logviewer/conversation-date-picker.cpp | 20 +++++++++++++++++
 logviewer/conversation-date-picker.h   |  3 +++
 logviewer/log-viewer.cpp               | 10 ++++++++-
 logviewer/log-viewer.h                 |  1 +
 logviewer/message-view.cpp             | 40 +++++++++++++++++++++++++++++++++-
 logviewer/message-view.h               | 11 +++++++++-
 7 files changed, 83 insertions(+), 4 deletions(-)

diff --git a/lib/adium-theme-view.h b/lib/adium-theme-view.h
index 8892fed..c3ba089 100644
--- a/lib/adium-theme-view.h
+++ b/lib/adium-theme-view.h
@@ -91,8 +91,8 @@ public:
 public Q_SLOTS:
     void addContentMessage(const AdiumThemeContentInfo&);
     void addStatusMessage(const AdiumThemeStatusInfo&);
-    void onLinkClicked(const QUrl &);
     void onOpenLinkActionTriggered();
+    virtual void onLinkClicked(const QUrl &);
 
 protected:
     virtual void contextMenuEvent(QContextMenuEvent *event);
diff --git a/logviewer/conversation-date-picker.cpp b/logviewer/conversation-date-picker.cpp
index 9c76333..3817083 100644
--- a/logviewer/conversation-date-picker.cpp
+++ b/logviewer/conversation-date-picker.cpp
@@ -51,6 +51,26 @@ void ConversationDatePicker::clear()
     m_setDates.clear();
 }
 
+QDate ConversationDatePicker::nextDate() const
+{
+    int i = m_setDates.indexOf(date());
+    if ((i < m_setDates.count() - 1) && (i > -1)) {
+        return m_setDates.at(i + 1);
+    }
+
+    return QDate();
+}
+
+QDate ConversationDatePicker::previousDate() const
+{
+    int i = m_setDates.indexOf(date());
+    if (i > 0) {
+        return m_setDates.at(i - 1);
+    }
+
+    return QDate();
+}
+
 void ConversationDatePicker::onDatesFinished(Tpl::PendingOperation *op)
 {
     Tpl::PendingDates *pendingDates = qobject_cast<Tpl::PendingDates*>(op);
diff --git a/logviewer/conversation-date-picker.h b/logviewer/conversation-date-picker.h
index dd177cc..868eb43 100644
--- a/logviewer/conversation-date-picker.h
+++ b/logviewer/conversation-date-picker.h
@@ -38,6 +38,9 @@ public:
     void setEntity(const Tp::AccountPtr &accout, const Tpl::EntityPtr &entity);
     void clear();
 
+    QDate previousDate() const;
+    QDate nextDate() const;
+
 Q_SIGNALS:
 
 private Q_SLOTS:
diff --git a/logviewer/log-viewer.cpp b/logviewer/log-viewer.cpp
index a6ae6d0..04fba29 100644
--- a/logviewer/log-viewer.cpp
+++ b/logviewer/log-viewer.cpp
@@ -78,6 +78,7 @@ LogViewer::LogViewer(QWidget *parent) :
     connect(m_accountManager->becomeReady(), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onAccountManagerReady()));
     connect(ui->entityList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(onEntitySelected(QModelIndex,QModelIndex)));
     connect(ui->datePicker, SIGNAL(dateChanged(QDate)), SLOT(onDateSelected()));
+    connect(ui->messageView, SIGNAL(conversationSwitchRequested(QDate)), SLOT(switchConversation(QDate)));
 }
 
 LogViewer::~LogViewer()
@@ -122,7 +123,14 @@ void LogViewer::updateMainView()
         return;
     }
 
+    QPair< QDate, QDate > nearestDates(ui->datePicker->previousDate(), ui->datePicker->nextDate());
+
     Tpl::EntityPtr entity = currentIndex.data(EntityModel::EntityRole).value<Tpl::EntityPtr>();
     Tp::AccountPtr account = currentIndex.data(EntityModel::AccountRole).value<Tp::AccountPtr>();
-    ui->messageView->loadLog(account, entity, ui->datePicker->date());
+    ui->messageView->loadLog(account, entity, ui->datePicker->date(), nearestDates);
+}
+
+void LogViewer::switchConversation(const QDate &date)
+{
+    ui->datePicker->setDate(date);
 }
diff --git a/logviewer/log-viewer.h b/logviewer/log-viewer.h
index f9f16c5..2b13bc1 100644
--- a/logviewer/log-viewer.h
+++ b/logviewer/log-viewer.h
@@ -44,6 +44,7 @@ private Q_SLOTS:
     void onDateSelected();
 
     void updateMainView();
+    void switchConversation(const QDate &date);
 
 private:
     Ui::LogViewer *ui;
diff --git a/logviewer/message-view.cpp b/logviewer/message-view.cpp
index 72b58cc..1f51a83 100644
--- a/logviewer/message-view.cpp
+++ b/logviewer/message-view.cpp
@@ -20,6 +20,7 @@
 #include "message-view.h"
 
 #include "adium-theme-view.h"
+#include "adium-theme-status-info.h"
 
 #include <KDebug>
 
@@ -35,11 +36,15 @@ MessageView::MessageView(QWidget *parent) :
     connect(this, SIGNAL(loadFinished(bool)), SLOT(onLoadFinished()));
 }
 
-void MessageView::loadLog(const Tp::AccountPtr &account, const Tpl::EntityPtr &entity, const QDate &date)
+
+void MessageView::loadLog(const Tp::AccountPtr &account, const Tpl::EntityPtr &entity,
+                          const QDate &date, const QPair< QDate, QDate > &nearestDates)
 {
     m_account = account;
     m_entity = entity;
     m_date = date;
+    m_prev = nearestDates.first;
+    m_next = nearestDates.second;
 
     //FIXME check entity type, set as appropriately.
     load(AdiumThemeView::SingleUserChat);
@@ -66,6 +71,15 @@ void MessageView::onEventsLoaded(Tpl::PendingOperation *po)
 
     QList<AdiumThemeContentInfo> messages;
 
+    if (m_prev.isValid()) {
+        AdiumThemeStatusInfo message(AdiumThemeMessageInfo::HistoryStatus);
+        message.setMessage(QString(QLatin1String("<a href=\"#x-prevConversation\"><<< %1</a>")).arg(i18n("Previous conversation")));
+        message.setService(m_account->serviceName());
+        message.setTime(QDateTime(m_prev));
+
+        addStatusMessage(message);
+    }
+
     Q_FOREACH(const Tpl::EventPtr &event, pe->events()) {
         const Tpl::TextEventPtr textEvent(event.staticCast<Tpl::TextEvent>());
 
@@ -95,4 +109,28 @@ void MessageView::onEventsLoaded(Tpl::PendingOperation *po)
 
         addContentMessage(message);
     }
+
+    if (m_next.isValid()) {
+        AdiumThemeStatusInfo message(AdiumThemeMessageInfo::HistoryStatus);
+        message.setMessage(QString(QLatin1String("<a href=\"#x-nextConversation\">%1 >>></a>")).arg(i18n("Next conversation")));
+        message.setService(m_account->serviceName());
+        message.setTime(QDateTime(m_next));
+
+        addStatusMessage(message);
+    }
+}
+
+void MessageView::onLinkClicked(const QUrl &link)
+{
+    if (link.fragment() == QLatin1String("x-nextConversation")) {
+        Q_EMIT conversationSwitchRequested(m_next);
+        return;
+    }
+
+    if (link.fragment() == QLatin1String("x-prevConversation")) {
+        Q_EMIT conversationSwitchRequested(m_prev);
+        return;
+    }
+
+    AdiumThemeView::onLinkClicked(link);
 }
diff --git a/logviewer/message-view.h b/logviewer/message-view.h
index e4b9b88..9e01260 100644
--- a/logviewer/message-view.h
+++ b/logviewer/message-view.h
@@ -34,16 +34,25 @@ class MessageView : public AdiumThemeView
 public:
     explicit MessageView(QWidget *parent = 0);
 
-    void loadLog(const Tp::AccountPtr &account, const Tpl::EntityPtr &entity, const QDate &date);
+    void loadLog(const Tp::AccountPtr &account, const Tpl::EntityPtr &entity,
+                 const QDate &date, const QPair< QDate, QDate > &nearestDates);
+
+public Q_SLOTS:
+    void onLinkClicked(const QUrl &link);
 
 private Q_SLOTS:
    void onLoadFinished();
    void onEventsLoaded(Tpl::PendingOperation* po);
 
+Q_SIGNALS:
+    void conversationSwitchRequested(const QDate &date);
+
 private:
     Tpl::EntityPtr m_entity;
     Tp::AccountPtr m_account;
     QDate m_date;
+    QDate m_prev;
+    QDate m_next;
 
 };
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list