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


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

The following commit has been merged in the master branch:
commit 19341fc958b491e726389757e0ae01db16b59d43
Author: Dan Vrátil <dan at progdan.cz>
Date:   Tue Aug 7 11:01:35 2012 +0200

    Add links to previous and next conversations to empty logs too
    
    Add "Previous conversation" and "Next conversation" links to logview
    even when the chat log for selected date is empty, so that it's easy
    to jump to nearest date with some non-empty chat log.
    
    REVIEW: 105762
    BUG: 304137
    FIXED-IN: 0.5
---
 logviewer/conversation-date-picker.cpp | 17 ++++++++++-------
 logviewer/log-viewer.cpp               |  6 +++---
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/logviewer/conversation-date-picker.cpp b/logviewer/conversation-date-picker.cpp
index c6bbf2e..e167853 100644
--- a/logviewer/conversation-date-picker.cpp
+++ b/logviewer/conversation-date-picker.cpp
@@ -79,19 +79,19 @@ void ConversationDatePicker::clearSearchHits()
 
 QDate ConversationDatePicker::nextDate() const
 {
-    int i = m_setDates.indexOf(date());
-    if ((i < m_setDates.count() - 1) && (i > -1)) {
-        return m_setDates.at(i + 1);
+    QList<QDate>::ConstIterator iter = qUpperBound(m_setDates, date());
+    if (iter != m_setDates.constEnd()) {
+        return *iter;
     }
 
-    return QDate();
+     return QDate();
 }
 
 QDate ConversationDatePicker::previousDate() const
 {
-    int i = m_setDates.indexOf(date());
-    if (i > 0) {
-        return m_setDates.at(i - 1);
+    QList<QDate>::ConstIterator iter = qLowerBound(m_setDates, date());
+    if (iter != m_setDates.constBegin()) {
+        return *(iter - 1);
     }
 
     return QDate();
@@ -107,6 +107,7 @@ void ConversationDatePicker::onDatesFinished(Tpl::PendingOperation *op)
     Tpl::PendingDates *pendingDates = qobject_cast<Tpl::PendingDates*>(op);
     m_setDates = pendingDates->dates();
 
+    qSort(m_setDates);
     updatePaintedDates();
 }
 
@@ -133,4 +134,6 @@ void ConversationDatePicker::setDatesFromSearchHits()
                 m_setDates << searchHit.date();
         }
     }
+
+    qSort(m_setDates);
 }
diff --git a/logviewer/log-viewer.cpp b/logviewer/log-viewer.cpp
index 5866cdb..2494368 100644
--- a/logviewer/log-viewer.cpp
+++ b/logviewer/log-viewer.cpp
@@ -138,11 +138,11 @@ void LogViewer::updateMainView()
     QDate date = ui->datePicker->date();
     if (!ui->datePicker->validDates().contains(date)) {
         date = QDate();
-    } else {
-        nearestDates.first = ui->datePicker->previousDate();
-        nearestDates.second = ui->datePicker->nextDate();
     }
 
+    nearestDates.first = ui->datePicker->previousDate();
+    nearestDates.second = 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, date, nearestDates);

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list