Commit 3dd20d15 authored by Laurent Montel's avatar Laurent Montel 😁

improve followupreminder support

parent ffe6155f
......@@ -1447,9 +1447,10 @@ void KMComposeWin::setupActions( void )
configureAction->setText( i18n("Configure KMail..." ) );
}
action = new KAction( i18n("Follow Up Mail..."), this );
actionCollection()->addAction( QLatin1String("follow_up_mail"), action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotFollowUpMail()) );
KToggleAction *followUpToggelAction = new KToggleAction( i18n("Follow Up Mail..."), this );
actionCollection()->addAction( QLatin1String("follow_up_mail"), followUpToggelAction );
connect( followUpToggelAction, SIGNAL(triggered(bool)), this, SLOT(slotFollowUpMail(bool)) );
}
void KMComposeWin::changeCryptoAction()
......@@ -3614,13 +3615,17 @@ void KMComposeWin::slotTransportChanged()
mComposerBase->editor()->document()->setModified(true);
}
void KMComposeWin::slotFollowUpMail()
void KMComposeWin::slotFollowUpMail(bool toggled)
{
QPointer<FollowUpReminderSelectDateDialog> dlg = new FollowUpReminderSelectDateDialog(this);
if (dlg->exec()) {
//TODO
if (toggled) {
QPointer<FollowUpReminderSelectDateDialog> dlg = new FollowUpReminderSelectDateDialog(this);
if (dlg->exec()) {
mFollowUpDate = dlg->selectedDate();
}
delete dlg;
} else {
mFollowUpDate = QDate();
}
delete dlg;
}
void KMComposeWin::slotSnippetWidgetVisibilityChanged(bool b)
......
......@@ -455,7 +455,7 @@ private slots:
void slotShareLinkDone(const QString &fileName);
void slotTransportChanged();
void slotFollowUpMail();
void slotFollowUpMail(bool toggled);
void slotSendNowByShortcut();
void slotSnippetWidgetVisibilityChanged(bool b);
public: // kmcommand
......@@ -673,6 +673,7 @@ private:
QString mdbusObjectPath;
static int s_composerNumber;
QDate mFollowUpDate;
MessageComposer::ComposerViewBase* mComposerBase;
......
......@@ -38,6 +38,7 @@ FollowUpReminderSelectDateDialog::FollowUpReminderSelectDateDialog(QWidget *pare
mainLayout->setSpacing( KDialog::spacingHint() );
mainLayout->setMargin( KDialog::marginHint() );
mDatePicker = new KDatePicker;
mDatePicker->setObjectName(QLatin1String("datepicker"));
QDate currentDate = QDate::currentDate();
currentDate = currentDate.addDays(1);
mDatePicker->setDate(currentDate);
......
......@@ -22,3 +22,8 @@ set( kmail_identityaddvcarddialog_source identityaddvcarddialogtest.cpp ../ident
kde4_add_unit_test( identityaddvcarddialogtest ${kmail_identityaddvcarddialog_source})
target_link_libraries( identityaddvcarddialogtest ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS})
set( kmail_followupreminderselectdatedialog_source followupreminderselectdatedialogtest.cpp ../followupreminder/followupreminderselectdatedialog.cpp )
kde4_add_unit_test( followupreminderselectdatedialogtest ${kmail_followupreminderselectdatedialog_source})
target_link_libraries( followupreminderselectdatedialogtest ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBS} )
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "followupreminderselectdatedialogtest.h"
#include "../followupreminder/followupreminderselectdatedialog.h"
#include <KDatePicker>
#include <qtest_kde.h>
FollowupReminderSelectDateDialogTest::FollowupReminderSelectDateDialogTest(QObject *parent)
: QObject(parent)
{
}
FollowupReminderSelectDateDialogTest::~FollowupReminderSelectDateDialogTest()
{
}
void FollowupReminderSelectDateDialogTest::shouldHaveDefaultValue()
{
FollowUpReminderSelectDateDialog dlg;
KDatePicker *datepicker = qFindChild<KDatePicker *>(&dlg, QLatin1String("datepicker"));
QVERIFY(datepicker);
QDate currentDate = QDate::currentDate();
QCOMPARE(datepicker->date(), currentDate.addDays(1));
}
QTEST_KDEMAIN(FollowupReminderSelectDateDialogTest, GUI)
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FOLLOWUPREMINDERSELECTDATEDIALOGTEST_H
#define FOLLOWUPREMINDERSELECTDATEDIALOGTEST_H
#include <QObject>
class FollowupReminderSelectDateDialogTest : public QObject
{
Q_OBJECT
public:
explicit FollowupReminderSelectDateDialogTest(QObject *parent=0);
~FollowupReminderSelectDateDialogTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // FOLLOWUPREMINDERSELECTDATEDIALOGTEST_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