summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2015-08-25 21:21:52 +0200
committerMontel Laurent <[email protected]>2015-08-25 21:23:57 +0200
commitca3fc6b29df43b7d28571776ca64c9acc2b98fd0 (patch)
tree3f208c60278acc1473b5658cf1413732d783e537
parent4d4207a85bc9953ddc6e4ed2cb3c8869c4da9cfb (diff)
Add label to show how many emails found
-rw-r--r--libkdepim/addressline/blacklistbaloocompletion/autotests/blacklistbalooemailcompletionwidgettest.cpp3
-rw-r--r--libkdepim/addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.cpp10
-rw-r--r--libkdepim/addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/libkdepim/addressline/blacklistbaloocompletion/autotests/blacklistbalooemailcompletionwidgettest.cpp b/libkdepim/addressline/blacklistbaloocompletion/autotests/blacklistbalooemailcompletionwidgettest.cpp
index 0b549b9..ca5c609 100644
--- a/libkdepim/addressline/blacklistbaloocompletion/autotests/blacklistbalooemailcompletionwidgettest.cpp
+++ b/libkdepim/addressline/blacklistbaloocompletion/autotests/blacklistbalooemailcompletionwidgettest.cpp
@@ -61,6 +61,9 @@ void BlackListBalooEmailCompletionWidgetTest::shouldHaveDefaultValue()
QVERIFY(moreResult);
QVERIFY(!moreResult->isVisible());
+ QLabel *mNumberOfEmailsFound = widget.findChild<QLabel *>(QStringLiteral("numberofemailsfound"));
+ QVERIFY(mNumberOfEmailsFound);
+ QVERIFY(mNumberOfEmailsFound->text().isEmpty());
QPushButton *showAllBlackListedEmails = widget.findChild<QPushButton *>(QStringLiteral("show_blacklisted_email_button"));
QVERIFY(showAllBlackListedEmails);
diff --git a/libkdepim/addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.cpp b/libkdepim/addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.cpp
index 240b883..be49640 100644
--- a/libkdepim/addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.cpp
+++ b/libkdepim/addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.cpp
@@ -79,8 +79,13 @@ BlackListBalooEmailCompletionWidget::BlackListBalooEmailCompletionWidget(QWidget
mSearchInResultLineEdit->setObjectName(QStringLiteral("searchinresultlineedit"));
mSearchInResultLineEdit->setClearButtonEnabled(true);
mSearchInResultLineEdit->setPlaceholderText(i18n("Search in result..."));
+
+
searchLineLayout->addStretch(0);
+ mNumberOfEmailsFound = new QLabel;
+ mNumberOfEmailsFound->setObjectName(QStringLiteral("numberofemailsfound"));
+ searchLineLayout->addWidget(mNumberOfEmailsFound);
searchLineLayout->addWidget(mSearchInResultLineEdit);
QHBoxLayout *selectElementLayout = new QHBoxLayout;
@@ -197,6 +202,11 @@ void BlackListBalooEmailCompletionWidget::slotEmailFound(const QStringList &list
mEmailList->setEmailFound(list);
mMoreResult->setVisible(list.count() == mLimit);
mEmailList->scrollToBottom();
+ if (list.count() == 0) {
+ mNumberOfEmailsFound->setText(i18n("No email found."));
+ } else {
+ mNumberOfEmailsFound->setText(i18np("1 email found", "%1 emails found", list.count()));
+ }
}
void BlackListBalooEmailCompletionWidget::setEmailBlackList(const QStringList &list)
diff --git a/libkdepim/addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.h b/libkdepim/addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.h
index 718eecf..6b9c4d3 100644
--- a/libkdepim/addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.h
+++ b/libkdepim/addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.h
@@ -54,6 +54,7 @@ private Q_SLOTS:
private:
void hideMoreResultAndChangeLimit();
QStringList mOriginalExcludeDomain;
+ QLabel *mNumberOfEmailsFound;
KLineEdit *mSearchLineEdit;
KLineEdit *mExcludeDomainLineEdit;
BlackListBalooEmailList *mEmailList;