Commit 93185474 authored by Laurent Montel's avatar Laurent Montel 😁

Add support for subject

parent bda3c2b9
......@@ -48,6 +48,15 @@ void FollowUpReminderInfo::readConfig(const KConfigGroup &config)
mMessageId = config.readEntry("messageId", QString());
mTo = config.readEntry("to", QString());
}
QString FollowUpReminderInfo::subject() const
{
return mSubject;
}
void FollowUpReminderInfo::setSubject(const QString &subject)
{
mSubject = subject;
}
void FollowUpReminderInfo::writeConfig(KConfigGroup &config )
{
......@@ -60,7 +69,6 @@ void FollowUpReminderInfo::writeConfig(KConfigGroup &config )
config.sync();
}
Akonadi::Item::Id FollowUpReminderInfo::id() const
{
return mId;
......
......@@ -47,12 +47,16 @@ public:
void writeConfig(KConfigGroup &config);
QString subject() const;
void setSubject(const QString &subject);
private:
void readConfig(const KConfigGroup &config);
Akonadi::Item::Id mId;
QString mMessageId;
QDateTime mFollowUpReminderDate;
QString mTo;
QString mSubject;
};
}
#endif // FOLLOWUPREMINDERINFO_H
......@@ -22,6 +22,8 @@
#include <QHeaderView>
#include <kicon.h>
#include <KGlobal>
#include <KLocale>
#include <kmenu.h>
#include <KLocalizedString>
......@@ -81,8 +83,9 @@ void FollowUpReminderInfoWidget::setInfo(const QList<FollowUpReminder::FollowUpR
FollowUpReminderInfoItem *item = new FollowUpReminderInfoItem(mTreeWidget);
item->setText(To, info->to());
item->setText(MessageId, info->messageId());
//TODO customize it.
item->setText(DeadLine, info->followUpReminderDate().toString());
item->setText(Subject, info->subject());
const QString date = KGlobal::locale()->formatDateTime( info->followUpReminderDate(), KLocale::LongDate );
item->setText(DeadLine, date);
}
}
......
......@@ -117,7 +117,13 @@ QString FollowUpReminderManager::printDebugInfo()
QString FollowUpReminderManager::infoToStr(FollowUpReminder::FollowUpReminderInfo *info)
{
QString infoStr;
//TODO
infoStr = QLatin1String("****************************************");
infoStr += QString::fromLatin1("Akonadi Item id :%1\n").arg(info->id());
infoStr += QString::fromLatin1("MessageId :%1\n").arg(info->messageId());
infoStr += QString::fromLatin1("Subject :%1\n").arg(info->subject());
infoStr += QString::fromLatin1("To :%1\n").arg(info->to());
infoStr += QString::fromLatin1("Dead Line :%1\n").arg(info->followUpReminderDate().toString());
infoStr += QLatin1String("****************************************\n");
return infoStr;
}
......@@ -30,6 +30,7 @@ void FollowUpReminderInfoTest::shouldHaveDefaultValue()
QCOMPARE(info.messageId(), QString());
QCOMPARE(info.isValid(), false);
QCOMPARE(info.to(), QString());
QCOMPARE(info.subject(), QString());
}
void FollowUpReminderInfoTest::shoudBeNotValid()
......@@ -51,4 +52,19 @@ void FollowUpReminderInfoTest::shoudBeNotValid()
QCOMPARE(info.isValid(), true);
}
void FollowUpReminderInfoTest::shoudBeValidEvenIfSubjectIsEmpty()
{
FollowUpReminder::FollowUpReminderInfo info;
//We need a Akonadi::Id valid and a messageId not empty and a valid date and a "To" not empty
info.setMessageId(QLatin1String("foo"));
const QDate date(2014,1,1);
info.setFollowUpReminderDate(QDateTime(date));
const QString to = QLatin1String("kde.org");
info.setTo(to);
info.setId(Akonadi::Item::Id(42));
QCOMPARE(info.isValid(), true);
}
QTEST_KDEMAIN(FollowUpReminderInfoTest, NoGUI)
......@@ -29,6 +29,8 @@ public:
private Q_SLOTS:
void shouldHaveDefaultValue();
void shoudBeNotValid();
void shoudBeValidEvenIfSubjectIsEmpty();
};
#endif // FOLLOWUPREMINDERINFOTEST_H
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