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 5d0f93a2 authored by Laurent Montel's avatar Laurent Montel 😁

Make more easy unitest

parent 0d64748a
......@@ -156,8 +156,8 @@ void EmailEditWidget::storeContact(KABC::Addressee &contact) const
void EmailEditWidget::edit()
{
AutoQPointer<EmailEditDialog> dlg = new EmailEditDialog(mEmailList, this);
AutoQPointer<EmailEditDialog> dlg = new EmailEditDialog(this);
dlg->setEmailList(mEmailList);
if (dlg->exec()) {
if (dlg->changed()) {
mEmailList = dlg->emails();
......@@ -179,7 +179,7 @@ void EmailEditWidget::textChanged(const QString &text)
mEmailList.prepend(text);
}
EmailEditDialog::EmailEditDialog(const QStringList &list, QWidget *parent)
EmailEditDialog::EmailEditDialog(QWidget *parent)
: KDialog(parent)
{
setCaption(i18n("Edit Email Addresses"));
......@@ -225,21 +225,6 @@ EmailEditDialog::EmailEditDialog(const QStringList &list, QWidget *parent)
topLayout->setRowStretch(4, 1);
QStringList items = list;
if (items.removeAll(QLatin1String("")) > 0) {
mChanged = true;
} else {
mChanged = false;
}
QStringList::ConstIterator it;
bool preferred = true;
QStringList::ConstIterator end(items.constEnd());
for (it = items.constBegin(); it != end; ++it) {
new EmailItem(*it, mEmailListBox, preferred);
preferred = false;
}
// set default state
KAcceleratorManager::manage(this);
......@@ -364,6 +349,25 @@ bool EmailEditDialog::changed() const
return mChanged;
}
void EmailEditDialog::setEmailList(const QStringList &list)
{
QStringList items = list;
if (items.removeAll(QLatin1String("")) > 0) {
mChanged = true;
} else {
mChanged = false;
}
QStringList::ConstIterator it;
bool preferred = true;
QStringList::ConstIterator end(items.constEnd());
for (it = items.constBegin(); it != end; ++it) {
new EmailItem(*it, mEmailListBox, preferred);
preferred = false;
}
}
void EmailEditDialog::standard()
{
for (int i = 0; i < mEmailListBox->count(); ++i) {
......
......@@ -67,12 +67,13 @@ class EmailEditDialog : public KDialog
Q_OBJECT
public:
explicit EmailEditDialog(const QStringList &list, QWidget *parent = 0);
explicit EmailEditDialog(QWidget *parent = 0);
~EmailEditDialog();
QStringList emails() const;
bool changed() const;
void setEmailList(const QStringList &list);
protected Q_SLOTS:
void add();
void edit();
......
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