summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2015-08-28 07:19:57 +0200
committerMontel Laurent <[email protected]>2015-08-28 07:19:57 +0200
commit5d3d4b4fa6fda7df6094671bff7e65e842cc692f (patch)
treecbb67f35b379bb480e28933135ab56f62cd3be13
parent425df8b595c423ef2804a300e224dd0df5af8b0e (diff)
Use private class here too
-rw-r--r--messagecomposer/followupreminder/followupreminderselectdatedialog.cpp69
-rw-r--r--messagecomposer/followupreminder/followupreminderselectdatedialog.h5
-rw-r--r--messagecomposer/job/attachmentvcardfromaddressbookjob.cpp27
-rw-r--r--messagecomposer/job/attachmentvcardfromaddressbookjob.h3
4 files changed, 66 insertions, 38 deletions
diff --git a/messagecomposer/followupreminder/followupreminderselectdatedialog.cpp b/messagecomposer/followupreminder/followupreminderselectdatedialog.cpp
index 6e411fd..558767e 100644
--- a/messagecomposer/followupreminder/followupreminderselectdatedialog.cpp
+++ b/messagecomposer/followupreminder/followupreminderselectdatedialog.cpp
@@ -36,20 +36,36 @@
#include <QLineEdit>
#include <kdatecombobox.h>
using namespace MessageComposer;
+class MessageComposer::FollowUpReminderSelectDateDialogPrivate
+{
+public:
+ FollowUpReminderSelectDateDialogPrivate()
+ : mDateComboBox(Q_NULLPTR),
+ mCollectionCombobox(Q_NULLPTR),
+ mOkButton(Q_NULLPTR)
+ {
+
+ }
+ KDateComboBox *mDateComboBox;
+ Akonadi::CollectionComboBox *mCollectionCombobox;
+ QPushButton *mOkButton;
+};
+
FollowUpReminderSelectDateDialog::FollowUpReminderSelectDateDialog(QWidget *parent, QAbstractItemModel *model)
- : QDialog(parent)
+ : QDialog(parent),
+ d(new MessageComposer::FollowUpReminderSelectDateDialogPrivate)
{
setWindowTitle(i18n("Select Date"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *topLayout = new QVBoxLayout;
setLayout(topLayout);
- mOkButton = buttonBox->button(QDialogButtonBox::Ok);
- mOkButton->setObjectName(QStringLiteral("ok_button"));
- mOkButton->setDefault(true);
- mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ d->mOkButton = buttonBox->button(QDialogButtonBox::Ok);
+ d->mOkButton->setObjectName(QStringLiteral("ok_button"));
+ d->mOkButton->setDefault(true);
+ d->mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &FollowUpReminderSelectDateDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &FollowUpReminderSelectDateDialog::reject);
- mOkButton->setDefault(true);
+ d->mOkButton->setDefault(true);
setModal(true);
QWidget *mainWidget = new QWidget(this);
@@ -59,39 +75,40 @@ FollowUpReminderSelectDateDialog::FollowUpReminderSelectDateDialog(QWidget *pare
QFormLayout *formLayout = new QFormLayout;
mainLayout->addLayout(formLayout);
- mDateComboBox = new KDateComboBox;
- mDateComboBox->setMinimumDate(QDate::currentDate());
- mDateComboBox->setObjectName(QStringLiteral("datecombobox"));
+ d->mDateComboBox = new KDateComboBox;
+ d->mDateComboBox->setMinimumDate(QDate::currentDate());
+ d->mDateComboBox->setObjectName(QStringLiteral("datecombobox"));
QDate currentDate = QDate::currentDate();
currentDate = currentDate.addDays(1);
- mDateComboBox->setDate(currentDate);
+ d->mDateComboBox->setDate(currentDate);
- formLayout->addRow(i18n("Date:"), mDateComboBox);
+ formLayout->addRow(i18n("Date:"), d->mDateComboBox);
- mCollectionCombobox = new Akonadi::CollectionComboBox(model);
- mCollectionCombobox->setMinimumWidth(250);
- mCollectionCombobox->setAccessRightsFilter(Akonadi::Collection::CanCreateItem);
- mCollectionCombobox->setMimeTypeFilter(QStringList() << KCalCore::Todo::todoMimeType());
- mCollectionCombobox->setObjectName(QStringLiteral("collectioncombobox"));
+ d->mCollectionCombobox = new Akonadi::CollectionComboBox(model);
+ d->mCollectionCombobox->setMinimumWidth(250);
+ d->mCollectionCombobox->setAccessRightsFilter(Akonadi::Collection::CanCreateItem);
+ d->mCollectionCombobox->setMimeTypeFilter(QStringList() << KCalCore::Todo::todoMimeType());
+ d->mCollectionCombobox->setObjectName(QStringLiteral("collectioncombobox"));
- formLayout->addRow(i18n("Store ToDo in:"), mCollectionCombobox);
+ formLayout->addRow(i18n("Store ToDo in:"), d->mCollectionCombobox);
- connect(mDateComboBox->lineEdit(), &QLineEdit::textChanged, this, &FollowUpReminderSelectDateDialog::slotDateChanged);
- connect(mCollectionCombobox, SIGNAL(currentIndexChanged(int)), SLOT(updateOkButton()));
+ connect(d->mDateComboBox->lineEdit(), &QLineEdit::textChanged, this, &FollowUpReminderSelectDateDialog::slotDateChanged);
+ connect(d->mCollectionCombobox, SIGNAL(currentIndexChanged(int)), SLOT(updateOkButton()));
updateOkButton();
}
FollowUpReminderSelectDateDialog::~FollowUpReminderSelectDateDialog()
{
+ delete d;
}
void FollowUpReminderSelectDateDialog::updateOkButton()
{
- mOkButton->setEnabled(!mDateComboBox->lineEdit()->text().isEmpty()
- && mDateComboBox->date().isValid()
- && (mCollectionCombobox->count() > 0)
- && mCollectionCombobox->currentCollection().isValid());
+ d->mOkButton->setEnabled(!d->mDateComboBox->lineEdit()->text().isEmpty()
+ && d->mDateComboBox->date().isValid()
+ && (d->mCollectionCombobox->count() > 0)
+ && d->mCollectionCombobox->currentCollection().isValid());
}
void FollowUpReminderSelectDateDialog::slotDateChanged()
@@ -101,12 +118,12 @@ void FollowUpReminderSelectDateDialog::slotDateChanged()
QDate FollowUpReminderSelectDateDialog::selectedDate() const
{
- return mDateComboBox->date();
+ return d->mDateComboBox->date();
}
Akonadi::Collection FollowUpReminderSelectDateDialog::collection() const
{
- return mCollectionCombobox->currentCollection();
+ return d->mCollectionCombobox->currentCollection();
}
void FollowUpReminderSelectDateDialog::accept()
@@ -116,7 +133,7 @@ void FollowUpReminderSelectDateDialog::accept()
KMessageBox::error(this, i18n("The selected date must be greater than the current date."), i18n("Invalid date"));
return;
}
- if (!mCollectionCombobox->currentCollection().isValid()) {
+ if (!d->mCollectionCombobox->currentCollection().isValid()) {
KMessageBox::error(this, i18n("The selected folder is not valid."), i18n("Invalid folder"));
return;
}
diff --git a/messagecomposer/followupreminder/followupreminderselectdatedialog.h b/messagecomposer/followupreminder/followupreminderselectdatedialog.h
index e9e9fb0..9b092b7 100644
--- a/messagecomposer/followupreminder/followupreminderselectdatedialog.h
+++ b/messagecomposer/followupreminder/followupreminderselectdatedialog.h
@@ -31,6 +31,7 @@ class QAbstractItemModel;
namespace MessageComposer
{
+class FollowUpReminderSelectDateDialogPrivate;
class MESSAGECOMPOSER_EXPORT FollowUpReminderSelectDateDialog : public QDialog
{
Q_OBJECT
@@ -47,9 +48,7 @@ private Q_SLOTS:
void slotDateChanged();
void updateOkButton();
private:
- KDateComboBox *mDateComboBox;
- Akonadi::CollectionComboBox *mCollectionCombobox;
- QPushButton *mOkButton;
+ FollowUpReminderSelectDateDialogPrivate *const d;
};
}
diff --git a/messagecomposer/job/attachmentvcardfromaddressbookjob.cpp b/messagecomposer/job/attachmentvcardfromaddressbookjob.cpp
index 21b5e6f..e50d906 100644
--- a/messagecomposer/job/attachmentvcardfromaddressbookjob.cpp
+++ b/messagecomposer/job/attachmentvcardfromaddressbookjob.cpp
@@ -25,16 +25,27 @@
using namespace MessageComposer;
+class MessageComposer::AttachmentVcardFromAddressBookJobPrivate
+{
+public:
+ AttachmentVcardFromAddressBookJobPrivate(Akonadi::Item item)
+ : mItem(item)
+ {
+
+ }
+ Akonadi::Item mItem;
+};
+
AttachmentVcardFromAddressBookJob::AttachmentVcardFromAddressBookJob(const Akonadi::Item &item, QObject *parent)
: MessageCore::AttachmentLoadJob(parent),
- mItem(item)
+ d(new MessageComposer::AttachmentVcardFromAddressBookJobPrivate(item))
{
}
AttachmentVcardFromAddressBookJob::~AttachmentVcardFromAddressBookJob()
{
-
+ delete d;
}
void AttachmentVcardFromAddressBookJob::addAttachment(const QByteArray &data, const QString &attachmentName)
@@ -53,23 +64,23 @@ void AttachmentVcardFromAddressBookJob::addAttachment(const QByteArray &data, co
void AttachmentVcardFromAddressBookJob::doStart()
{
- if (mItem.isValid()) {
- if (mItem.hasPayload<KContacts::Addressee>()) {
- const KContacts::Addressee contact = mItem.payload<KContacts::Addressee>();
+ if (d->mItem.isValid()) {
+ if (d->mItem.hasPayload<KContacts::Addressee>()) {
+ const KContacts::Addressee contact = d->mItem.payload<KContacts::Addressee>();
if (contact.isEmpty()) {
invalidContact();
} else {
const QString contactRealName(contact.realName());
const QString attachmentName = (contactRealName.isEmpty() ? QStringLiteral("vcard") : contactRealName) + QLatin1String(".vcf");
- QByteArray data = mItem.payloadData();
+ QByteArray data = d->mItem.payloadData();
//Workaround about broken kaddressbook fields.
PimCommon::VCardUtil vcardUtil;
vcardUtil.adaptVcard(data);
addAttachment(data, attachmentName);
}
- } else if (mItem.hasPayload<KContacts::ContactGroup>()) {
- const KContacts::ContactGroup group = mItem.payload<KContacts::ContactGroup>();
+ } else if (d->mItem.hasPayload<KContacts::ContactGroup>()) {
+ const KContacts::ContactGroup group = d->mItem.payload<KContacts::ContactGroup>();
const QString groupName(group.name());
const QString attachmentName = (groupName.isEmpty() ? QStringLiteral("vcard") : groupName) + QLatin1String(".vcf");
Akonadi::ContactGroupExpandJob *expandJob = new Akonadi::ContactGroupExpandJob(group, this);
diff --git a/messagecomposer/job/attachmentvcardfromaddressbookjob.h b/messagecomposer/job/attachmentvcardfromaddressbookjob.h
index c1a34cb..d44df4c 100644
--- a/messagecomposer/job/attachmentvcardfromaddressbookjob.h
+++ b/messagecomposer/job/attachmentvcardfromaddressbookjob.h
@@ -23,6 +23,7 @@
#include "messagecomposer_export.h"
namespace MessageComposer
{
+class AttachmentVcardFromAddressBookJobPrivate;
class MESSAGECOMPOSER_EXPORT AttachmentVcardFromAddressBookJob : public MessageCore::AttachmentLoadJob
{
Q_OBJECT
@@ -39,7 +40,7 @@ private Q_SLOTS:
private:
void invalidContact();
void addAttachment(const QByteArray &data, const QString &attachmentName);
- Akonadi::Item mItem;
+ AttachmentVcardFromAddressBookJobPrivate *const d;
};
}
#endif // ATTACHMENTVCARDFROMADDRESSBOOKJOB_H