Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 6354a534 authored by Laurent Montel's avatar Laurent Montel 😁

Improve unittest

parent 237c90b7
......@@ -55,6 +55,13 @@ void BlackListBalooEmailCompletionDialogTest::shouldHaveDefaultValue()
KPIM::BlackListBalooEmailList *emailList = qFindChild<KPIM::BlackListBalooEmailList *>(&dlg, QLatin1String("email_list"));
QVERIFY(emailList);
KPushButton *selectButton = qFindChild<KPushButton *>(&dlg, QLatin1String("select_email"));
QVERIFY(selectButton);
KPushButton *unselectButton = qFindChild<KPushButton *>(&dlg, QLatin1String("unselect_email"));
QVERIFY(unselectButton);
}
void BlackListBalooEmailCompletionDialogTest::shouldEnablePushButtonWhenTestSizeSupperiorToTwo()
......
......@@ -55,6 +55,7 @@ BlackListBalooEmailCompletionDialog::BlackListBalooEmailCompletionDialog(QWidget
searchLayout->addWidget(lab);
mSearchLineEdit = new KLineEdit;
mSearchLineEdit->setFocus();
mSearchLineEdit->setClearButtonShown(true);
mSearchLineEdit->setTrapReturnKey(true);
mSearchLineEdit->setObjectName(QLatin1String("search_lineedit"));
......@@ -72,6 +73,23 @@ BlackListBalooEmailCompletionDialog::BlackListBalooEmailCompletionDialog(QWidget
mEmailList->setObjectName(QLatin1String("email_list"));
mainLayout->addWidget(mEmailList);
QHBoxLayout *selectElementLayout = new QHBoxLayout;
mainLayout->addLayout(selectElementLayout);
//Add i18n in kf5
KPushButton *button = new KPushButton(QLatin1String("&Select"), this);
button->setObjectName(QLatin1String("select_email"));
connect(button, SIGNAL(clicked(bool)), this, SLOT(slotSelectEmails()));
selectElementLayout->addWidget(button);
//Add i18n in kf5
button = new KPushButton(QLatin1String("&Unselect"), this);
button->setObjectName(QLatin1String("unselect_email"));
connect(button, SIGNAL(clicked(bool)), this, SLOT(slotUnselectEmails()));
selectElementLayout->addWidget(button);
selectElementLayout->addStretch(1);
connect(mSearchLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSearchLineEditChanged(QString)));
connect(this, SIGNAL(okClicked()), this, SLOT(slotSave()));
readConfig();
......@@ -82,6 +100,20 @@ BlackListBalooEmailCompletionDialog::~BlackListBalooEmailCompletionDialog()
writeConfig();
}
void BlackListBalooEmailCompletionDialog::slotUnselectEmails()
{
Q_FOREACH(QListWidgetItem *item, mEmailList->selectedItems()) {
item->setCheckState(Qt::Unchecked);
}
}
void BlackListBalooEmailCompletionDialog::slotSelectEmails()
{
Q_FOREACH(QListWidgetItem *item, mEmailList->selectedItems()) {
item->setCheckState(Qt::Checked);
}
}
void BlackListBalooEmailCompletionDialog::setEmailBlackList(const QStringList &list)
{
mEmailList->setEmailBlackList(list);
......@@ -117,7 +149,7 @@ void BlackListBalooEmailCompletionDialog::slotSave()
util.initialBlackList(blackList);
util.newBlackList(result);
blackList = util.createNewBlackList();
group.writeEntry( "Baloo Back List", blackList );
group.writeEntry( "BalooBackList", blackList );
group.sync();
}
accept();
......
......@@ -41,6 +41,8 @@ private slots:
void slotSearch();
void slotSearchLineEditChanged(const QString &text);
void slotUnselectEmails();
void slotSelectEmails();
private:
void writeConfig();
void readConfig();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment