[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:24:02 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=452b06f
The following commit has been merged in the master branch:
commit 452b06f4896222bca38987280359b7a4cad02969
Author: Dan Vrátil <dvratil at redhat.com>
Date: Tue Jun 18 18:27:51 2013 +0200
Show a message when no logs are available for given contact or day
Shows a label saying "There are no logs for this day" or "There are no
logs for this contact" when user selects a date without logs or starts
logviewer with ID of a contact for which we have no logs.
REVIEW: 111088
BUG: 316487
FIXED-IN: 0.7.0
---
logviewer/entity-view.cpp | 4 ++++
logviewer/entity-view.h | 5 ++++-
logviewer/log-viewer.cpp | 6 ++++++
logviewer/log-viewer.h | 2 ++
logviewer/message-view.cpp | 39 +++++++++++++++++++++++++++++++++++----
logviewer/message-view.h | 8 ++++++++
6 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/logviewer/entity-view.cpp b/logviewer/entity-view.cpp
index 69c408f..97e7087 100644
--- a/logviewer/entity-view.cpp
+++ b/logviewer/entity-view.cpp
@@ -57,8 +57,12 @@ void EntityView::rowsInserted(const QModelIndex &parent, int start, int end)
if (selectAccountId == account->uniqueIdentifier() && selectContactId == contact->identifier()) {
setCurrentIndex(index);
loadedCurrentContact = true;
+ break;
}
+ }
+ if (!loadedCurrentContact) {
+ Q_EMIT noSuchContact();
}
}
diff --git a/logviewer/entity-view.h b/logviewer/entity-view.h
index d55f194..18bf9d5 100644
--- a/logviewer/entity-view.h
+++ b/logviewer/entity-view.h
@@ -30,7 +30,10 @@ class EntityView : public QTreeView
Q_OBJECT
public:
explicit EntityView(QWidget *parent = 0);
-
+
+Q_SIGNALS:
+ void noSuchContact();
+
protected Q_SLOTS:
void rowsInserted(const QModelIndex &parent, int start, int end);
};
diff --git a/logviewer/log-viewer.cpp b/logviewer/log-viewer.cpp
index 743cda4..6fca33d 100644
--- a/logviewer/log-viewer.cpp
+++ b/logviewer/log-viewer.cpp
@@ -90,6 +90,7 @@ LogViewer::LogViewer(const Tp::AccountFactoryPtr &accountFactory, const Tp::Conn
connect(ui->globalSearch, SIGNAL(returnPressed(QString)), SLOT(slotStartGlobalSearch(QString)));
connect(ui->globalSearch, SIGNAL(clearButtonClicked()), SLOT(slotClearGlobalSearch()));
connect(ui->entityList, SIGNAL(customContextMenuRequested(QPoint)), SLOT(slotShowEntityListContextMenu(QPoint)));
+ connect(ui->entityList, SIGNAL(noSuchContact()), SLOT(slotNoLogsForContact()));
}
LogViewer::~LogViewer()
@@ -396,3 +397,8 @@ void LogViewer::slotJumpToPrevConversation()
ui->datePicker->setDate(m_prevConversationDate);
}
+
+void LogViewer::slotNoLogsForContact()
+{
+ ui->messageView->showInfoMessage(i18n("There are no logs for this contact"));
+}
diff --git a/logviewer/log-viewer.h b/logviewer/log-viewer.h
index 9341064..f5f512f 100644
--- a/logviewer/log-viewer.h
+++ b/logviewer/log-viewer.h
@@ -67,6 +67,8 @@ private Q_SLOTS:
void slotJumpToPrevConversation();
void slotJumpToNextConversation();
+ void slotNoLogsForContact();
+
private:
void setupActions();
diff --git a/logviewer/message-view.cpp b/logviewer/message-view.cpp
index 96ad846..13a67d9 100644
--- a/logviewer/message-view.cpp
+++ b/logviewer/message-view.cpp
@@ -25,28 +25,37 @@
#include <KDebug>
+#include <QLabel>
+#include <QResizeEvent>
+
#include <TelepathyLoggerQt4/LogManager>
#include <TelepathyLoggerQt4/PendingEvents>
#include <TelepathyLoggerQt4/TextEvent>
#include <TelepathyQt/Account>
MessageView::MessageView(QWidget *parent) :
- AdiumThemeView(parent)
+ AdiumThemeView(parent),
+ m_infoLabel(new QLabel(this))
{
+ QFont font = m_infoLabel->font();
+ font.setBold(true);
+ m_infoLabel->setFont(font);
+ m_infoLabel->setAlignment(Qt::AlignCenter);
+
connect(this, SIGNAL(loadFinished(bool)), SLOT(processStoredEvents()));
}
-
void MessageView::loadLog(const Tp::AccountPtr &account, const Tpl::EntityPtr &entity,
const Tp::ContactPtr &contact, const QDate &date,
const QPair< QDate, QDate > &nearestDates)
{
if (account.isNull() || entity.isNull()) {
//note contact can be null
- kWarning() << "invalid account/contact. Not loading log";
+ showInfoMessage(i18n("Unknown or invalid contact"));
return;
}
+ m_infoLabel->hide();
m_account = account;
m_entity = entity;
m_contact = contact;
@@ -72,6 +81,21 @@ void MessageView::loadLog(const Tp::AccountPtr &account, const Tpl::EntityPtr &e
connect(pendingEvents, SIGNAL(finished(Tpl::PendingOperation*)), SLOT(onEventsLoaded(Tpl::PendingOperation*)));
}
+void MessageView::showInfoMessage(const QString& message)
+{
+ m_infoLabel->setText(message);
+ m_infoLabel->show();
+ m_infoLabel->raise();
+ m_infoLabel->setGeometry(0, 0, width(), height());
+}
+
+void MessageView::resizeEvent(QResizeEvent* e)
+{
+ m_infoLabel->setGeometry(0, 0, e->size().width(), e->size().height());
+
+ QWebView::resizeEvent(e);
+}
+
void MessageView::setHighlightText(const QString &text)
{
m_highlightedText = text;
@@ -118,6 +142,10 @@ void MessageView::processStoredEvents()
addAdiumStatusMessage(message);
}
+ if (m_events.isEmpty()) {
+ showInfoMessage(i18n("There are no logs for this day"));
+ }
+
// See https://bugs.kde.org/show_bug.cgi?id=317866
// Uses the operator< overload above
qSort(m_events);
@@ -169,5 +197,8 @@ void MessageView::onLinkClicked(const QUrl &link)
void MessageView::doHighlightText()
{
findText(QString());
- findText(m_highlightedText, QWebPage::HighlightAllOccurrences | QWebPage::FindWrapsAroundDocument);
+ if (!m_highlightedText.isEmpty()) {
+ findText(m_highlightedText, QWebPage::HighlightAllOccurrences |
+ QWebPage::FindWrapsAroundDocument);
+ }
}
diff --git a/logviewer/message-view.h b/logviewer/message-view.h
index c9ae322..4dcf49c 100644
--- a/logviewer/message-view.h
+++ b/logviewer/message-view.h
@@ -28,6 +28,7 @@
#include <TelepathyLoggerQt4/Entity>
#include <TelepathyLoggerQt4/PendingOperation>
+class QLabel;
class MessageView : public AdiumThemeView
{
@@ -42,6 +43,8 @@ public:
void setHighlightText(const QString &text);
void clearHighlightText();
+ void showInfoMessage(const QString &message);
+
public Q_SLOTS:
void onLinkClicked(const QUrl &link);
@@ -53,6 +56,9 @@ private Q_SLOTS:
Q_SIGNALS:
void conversationSwitchRequested(const QDate &date);
+protected:
+ virtual void resizeEvent(QResizeEvent *e);
+
private:
Tpl::EntityPtr m_entity;
Tp::AccountPtr m_account;
@@ -66,6 +72,8 @@ private:
Tpl::EventPtrList m_events;
QString m_accountAvatar;
+
+ QLabel *m_infoLabel;
};
#endif // MESSAGEVIEW_H
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list