diff --git a/kaddressbookimportexport/src/kaddressbookcontactselectionwidget.cpp b/kaddressbookimportexport/src/kaddressbookcontactselectionwidget.cpp index 9eb8fd1..0bcf261 100644 --- a/kaddressbookimportexport/src/kaddressbookcontactselectionwidget.cpp +++ b/kaddressbookimportexport/src/kaddressbookcontactselectionwidget.cpp @@ -1,345 +1,345 @@ /* Copyright (c) 2009 Tobias Koenig Copyright (C) 2016-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kaddressbookcontactselectionwidget.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace KAddressBookImportExport; KAddressBookContactSelectionWidget::KAddressBookContactSelectionWidget(QItemSelectionModel *selectionModel, QWidget *parent) : QWidget(parent) , mSelectionModel(selectionModel) , mAddContactGroup(false) { initGui(); mSelectedContactsButton->setEnabled(mSelectionModel->hasSelection()); mAddressBookSelection->setEnabled(false); mAddressBookSelectionRecursive->setEnabled(false); connect(mAddressBookContactsButton, &QRadioButton::toggled, mAddressBookSelection, &Akonadi::CollectionComboBox::setEnabled); connect(mAddressBookContactsButton, &QRadioButton::toggled, mAddressBookSelectionRecursive, &QCheckBox::setEnabled); // apply default configuration if (mSelectionModel->hasSelection()) { mSelectedContactsButton->setChecked(true); } else { mAllContactsButton->setChecked(true); } } void KAddressBookContactSelectionWidget::setMessageText(const QString &message) { if (!message.isEmpty()) { mMessageLabel->setText(message); mMessageLabel->show(); } } void KAddressBookContactSelectionWidget::setDefaultAddressBook(const Akonadi::Collection &addressBook) { mAddressBookSelection->setDefaultCollection(addressBook); } Akonadi::Item::List KAddressBookContactSelectionWidget::selectedItems() const { if (mAllContactsButton->isChecked()) { return collectAllItems(); } else if (mSelectedContactsButton->isChecked()) { return collectSelectedItems(); } else if (mAddressBookContactsButton->isChecked()) { return collectAddressBookItems(); } else { qWarning() << " It's a bug here."; } return Akonadi::Item::List(); } KAddressBookImportExport::KAddressBookImportExportContactList KAddressBookContactSelectionWidget::selectedContacts() const { if (mAllContactsButton->isChecked()) { return collectAllContacts(); } else if (mSelectedContactsButton->isChecked()) { return collectSelectedContacts(); } else if (mAddressBookContactsButton->isChecked()) { return collectAddressBookContacts(); } return KAddressBookImportExport::KAddressBookImportExportContactList(); } void KAddressBookContactSelectionWidget::setAddGroupContact(bool addGroupContact) { mAddContactGroup = addGroupContact; } void KAddressBookContactSelectionWidget::initGui() { QVBoxLayout *layout = new QVBoxLayout(this); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); mMessageLabel = new QLabel; layout->addWidget(mMessageLabel); mMessageLabel->hide(); QButtonGroup *group = new QButtonGroup(this); QGroupBox *groupBox = new QGroupBox; QGridLayout *boxLayout = new QGridLayout; groupBox->setLayout(boxLayout); mAllContactsButton = new QRadioButton(i18nc("@option:radio", "All contacts")); mAllContactsButton->setToolTip( i18nc("@info:tooltip", "All contacts from all your address books")); mAllContactsButton->setWhatsThis( i18nc("@info:whatsthis", "Choose this option you want to select all your contacts from " "all your address books.")); mSelectedContactsButton = new QRadioButton(i18nc("@option:radio", "Selected contacts")); mSelectedContactsButton->setToolTip( i18nc("@info:tooltip", "Only the contacts currently selected")); mSelectedContactsButton->setWhatsThis( i18nc("@info:whatsthis", "Choose this option if you want only the contacts you have already " "selected in the graphical interface.")); mAddressBookContactsButton = new QRadioButton(i18nc("@option:radio", "All contacts from:")); mAddressBookContactsButton->setToolTip( i18nc("@info:tooltip", "All contacts from a chosen address book")); mAddressBookContactsButton->setWhatsThis( i18nc("@info:whatsthis", "Choose this option if you want to select all the contacts from only one " "of your address books. Once this option is clicked you will be provided " "a drop down box listing all those address books and permitted to select " "the one you want.")); mAddressBookSelection = new Akonadi::CollectionComboBox; mAddressBookSelection->setMimeTypeFilter(QStringList() << KContacts::Addressee::mimeType()); mAddressBookSelection->setAccessRightsFilter(Akonadi::Collection::ReadOnly); mAddressBookSelection->setExcludeVirtualCollections(true); mAddressBookSelectionRecursive = new QCheckBox(i18nc("@option:check", "Include Subfolders")); mAddressBookSelectionRecursive->setToolTip( i18nc("@info:tooltip", "Select all subfolders including the top-level folder")); mAddressBookSelectionRecursive->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to select all contacts from this folder, " "including all subfolders. If you only want the contacts from the " "top-level folder then leave this box unchecked.")); group->addButton(mAllContactsButton); group->addButton(mSelectedContactsButton); group->addButton(mAddressBookContactsButton); boxLayout->addWidget(mAllContactsButton, 0, 0, 1, 2); boxLayout->addWidget(mSelectedContactsButton, 1, 0, 1, 2); boxLayout->addWidget(mAddressBookContactsButton, 2, 0, Qt::AlignTop); QVBoxLayout *addressBookLayout = new QVBoxLayout; - addressBookLayout->setMargin(0); + addressBookLayout->setContentsMargins(0, 0, 0, 0); addressBookLayout->addWidget(mAddressBookSelection); addressBookLayout->addWidget(mAddressBookSelectionRecursive); boxLayout->addLayout(addressBookLayout, 2, 1); layout->addWidget(groupBox); layout->addStretch(1); } Akonadi::Item::List KAddressBookContactSelectionWidget::collectAllItems() const { Akonadi::RecursiveItemFetchJob *job = new Akonadi::RecursiveItemFetchJob(Akonadi::Collection::root(), QStringList() << KContacts::Addressee::mimeType()); job->fetchScope().fetchFullPayload(); QProgressDialog progressDialog(nullptr); progressDialog.setWindowTitle(i18n("Collect Contacts")); progressDialog.setAutoClose(true); progressDialog.setMinimumDuration(1000); progressDialog.setLabelText(i18n("Fetch Contacts")); progressDialog.show(); qApp->processEvents(); if (!job->exec()) { return Akonadi::Item::List(); } return job->items(); } KAddressBookImportExport::KAddressBookImportExportContactList KAddressBookContactSelectionWidget::collectAllContacts() const { KAddressBookImportExport::KAddressBookImportExportContactList contacts; Akonadi::RecursiveItemFetchJob *job = new Akonadi::RecursiveItemFetchJob(Akonadi::Collection::root(), QStringList() << KContacts::Addressee::mimeType()); job->fetchScope().fetchFullPayload(); if (!job->exec()) { return contacts; } const Akonadi::Item::List lstItems = job->items(); for (const Akonadi::Item &item : lstItems) { if (item.isValid()) { if (item.hasPayload()) { contacts.append(item.payload()); } } } return contacts; } Akonadi::Item::List KAddressBookContactSelectionWidget::collectSelectedItems() const { Akonadi::Item::List items; const QModelIndexList indexes = mSelectionModel->selectedRows(0); for (int i = 0, total = indexes.count(); i < total; ++i) { const QModelIndex index = indexes.at(i); if (index.isValid()) { const Akonadi::Item item = index.data(Akonadi::EntityTreeModel::ItemRole).value(); if (item.isValid()) { items.append(item); } } } return items; } KAddressBookImportExport::KAddressBookImportExportContactList KAddressBookContactSelectionWidget::collectSelectedContacts() const { KAddressBookImportExport::KAddressBookImportExportContactList contacts; const QModelIndexList indexes = mSelectionModel->selectedRows(0); for (int i = 0, total = indexes.count(); i < total; ++i) { const QModelIndex index = indexes.at(i); if (index.isValid()) { const Akonadi::Item item = index.data(Akonadi::EntityTreeModel::ItemRole).value(); if (item.isValid()) { if (item.hasPayload()) { contacts.append(item.payload()); } } } } return contacts; } Akonadi::Item::List KAddressBookContactSelectionWidget::collectAddressBookItems() const { Akonadi::Item::List items; const Akonadi::Collection collection = mAddressBookSelection->currentCollection(); if (!collection.isValid()) { return items; } if (mAddressBookSelectionRecursive->isChecked()) { Akonadi::RecursiveItemFetchJob *job = new Akonadi::RecursiveItemFetchJob(collection, QStringList() << KContacts::Addressee::mimeType()); job->fetchScope().fetchFullPayload(); if (!job->exec()) { return items; } items = job->items(); } else { Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(collection); job->fetchScope().fetchFullPayload(); if (!job->exec()) { return items; } items = job->items(); } return items; } KAddressBookImportExport::KAddressBookImportExportContactList KAddressBookContactSelectionWidget::collectAddressBookContacts() const { KAddressBookImportExport::KAddressBookImportExportContactList contacts; const Akonadi::Collection collection = mAddressBookSelection->currentCollection(); if (!collection.isValid()) { return contacts; } if (mAddressBookSelectionRecursive->isChecked()) { Akonadi::RecursiveItemFetchJob *job = new Akonadi::RecursiveItemFetchJob(collection, QStringList() << KContacts::Addressee::mimeType()); job->fetchScope().fetchFullPayload(); if (!job->exec()) { return contacts; } const Akonadi::Item::List lstItems = job->items(); for (const Akonadi::Item &item : lstItems) { if (item.hasPayload()) { contacts.append(item.payload()); } } } else { Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(collection); job->fetchScope().fetchFullPayload(); if (!job->exec()) { return contacts; } const Akonadi::Item::List lstItems = job->items(); for (const Akonadi::Item &item : lstItems) { if (item.hasPayload()) { contacts.append(item.payload()); } } } return contacts; } diff --git a/kaddressbookimportexport/src/kaddressbookexportselectionwidget.cpp b/kaddressbookimportexport/src/kaddressbookexportselectionwidget.cpp index fc160f7..f6cee54 100644 --- a/kaddressbookimportexport/src/kaddressbookexportselectionwidget.cpp +++ b/kaddressbookimportexport/src/kaddressbookexportselectionwidget.cpp @@ -1,161 +1,161 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kaddressbookexportselectionwidget.h" #include #include #include #include #include #include using namespace KAddressBookImportExport; KAddressBookExportSelectionWidget::KAddressBookExportSelectionWidget(QWidget *parent) : QWidget(parent) { QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setMargin(0); + mainLayout->setContentsMargins(0, 0, 0, 0); QGroupBox *gbox = new QGroupBox( i18nc("@title:group", "Fields to be exported"), this); mainLayout->addWidget(gbox); QGridLayout *layout = new QGridLayout; gbox->setLayout(layout); gbox->setFlat(true); mPrivateBox = new QCheckBox(i18nc("@option:check", "Private fields"), this); mPrivateBox->setToolTip( i18nc("@info:tooltip", "Export private fields")); mPrivateBox->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's " "private fields to the vCard output file.")); layout->addWidget(mPrivateBox, 1, 0); mBusinessBox = new QCheckBox(i18nc("@option:check", "Business fields"), this); mBusinessBox->setToolTip( i18nc("@info:tooltip", "Export business fields")); mBusinessBox->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's " "business fields to the vCard output file.")); layout->addWidget(mBusinessBox, 2, 0); mOtherBox = new QCheckBox(i18nc("@option:check", "Other fields"), this); mOtherBox->setToolTip( i18nc("@info:tooltip", "Export other fields")); mOtherBox->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's " "other fields to the vCard output file.")); layout->addWidget(mOtherBox, 3, 0); mEncryptionKeys = new QCheckBox(i18nc("@option:check", "Encryption keys"), this); mEncryptionKeys->setToolTip( i18nc("@info:tooltip", "Export encryption keys")); mEncryptionKeys->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's " "encryption keys to the vCard output file.")); layout->addWidget(mEncryptionKeys, 1, 1); mPictureBox = new QCheckBox(i18nc("@option:check", "Pictures"), this); mPictureBox->setToolTip( i18nc("@info:tooltip", "Export pictures")); mPictureBox->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's " "picture to the vCard output file.")); layout->addWidget(mPictureBox, 2, 1); gbox = new QGroupBox( i18nc("@title:group", "Export options"), this); gbox->setFlat(true); mainLayout->addWidget(gbox); QHBoxLayout *gbLayout = new QHBoxLayout; gbox->setLayout(gbLayout); mDisplayNameBox = new QCheckBox(i18nc("@option:check", "Display name as full name"), this); mDisplayNameBox->setToolTip( i18nc("@info:tooltip", "Export display name as full name")); mDisplayNameBox->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's display name " "in the vCard's full name field. This may be required to get the " "name shown correctly in GMail or Android.")); gbLayout->addWidget(mDisplayNameBox); readSettings(); } KAddressBookExportSelectionWidget::~KAddressBookExportSelectionWidget() { writeSettings(); } void KAddressBookExportSelectionWidget::readSettings() { KConfig config(QStringLiteral("kaddressbookrc")); const KConfigGroup group(&config, "XXPortVCard"); mPrivateBox->setChecked(group.readEntry("ExportPrivateFields", true)); mBusinessBox->setChecked(group.readEntry("ExportBusinessFields", true)); mOtherBox->setChecked(group.readEntry("ExportOtherFields", true)); mEncryptionKeys->setChecked(group.readEntry("ExportEncryptionKeys", true)); mPictureBox->setChecked(group.readEntry("ExportPictureFields", true)); mDisplayNameBox->setChecked(group.readEntry("ExportDisplayName", false)); } void KAddressBookExportSelectionWidget::writeSettings() { KConfig config(QStringLiteral("kaddressbookrc")); KConfigGroup group(&config, "XXPortVCard"); group.writeEntry("ExportPrivateFields", mPrivateBox->isChecked()); group.writeEntry("ExportBusinessFields", mBusinessBox->isChecked()); group.writeEntry("ExportOtherFields", mOtherBox->isChecked()); group.writeEntry("ExportEncryptionKeys", mEncryptionKeys->isChecked()); group.writeEntry("ExportPictureFields", mPictureBox->isChecked()); group.writeEntry("ExportDisplayName", mDisplayNameBox->isChecked()); } KAddressBookExportSelectionWidget::ExportFields KAddressBookExportSelectionWidget::exportType() const { ExportFields type = None; if (mPrivateBox->isChecked()) { type |= Private; } if (mBusinessBox->isChecked()) { type |= Business; } if (mOtherBox->isChecked()) { type |= Other; } if (mEncryptionKeys->isChecked()) { type |= Encryption; } if (mPictureBox->isChecked()) { type |= Picture; } if (mDisplayNameBox->isChecked()) { type |= DiplayName; } return type; } diff --git a/libsendlater/src/sendlaterdialog.cpp b/libsendlater/src/sendlaterdialog.cpp index c90d40a..55d8cfe 100644 --- a/libsendlater/src/sendlaterdialog.cpp +++ b/libsendlater/src/sendlaterdialog.cpp @@ -1,159 +1,159 @@ /* Copyright (C) 2013-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sendlaterdialog.h" #include "sendlaterinfo.h" #include "sendlatertimedatewidget.h" #include "ui_sendlaterwidget.h" #include #include #include #include #include #include #include using namespace SendLater; SendLaterDialog::SendLaterDialog(SendLater::SendLaterInfo *info, QWidget *parent) : QDialog(parent) , mInfo(info) { setWindowTitle(i18nc("@title:window", "Send Later")); setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail"))); QVBoxLayout *mainLayout = new QVBoxLayout(this); QWidget *sendLaterWidget = new QWidget(this); mSendLaterWidget = new Ui::SendLaterWidget; mSendLaterWidget->setupUi(sendLaterWidget); QWidget *w = new QWidget(this); QVBoxLayout *lay = new QVBoxLayout; - lay->setMargin(0); + lay->setContentsMargins(0, 0, 0, 0); w->setLayout(lay); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); mOkButton = buttonBox->button(QDialogButtonBox::Ok); mOkButton->setObjectName(QStringLiteral("okbutton")); mOkButton->setDefault(true); mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::rejected, this, &SendLaterDialog::reject); if (!info) { mOkButton->setText(i18n("Send Later")); mDelay = new QCheckBox(i18n("Delay")); mDelay->setChecked(false); slotDelay(false); connect(mDelay, &QCheckBox::clicked, this, &SendLaterDialog::slotDelay); lay->addWidget(mDelay); } connect(mOkButton, &QPushButton::clicked, this, &SendLaterDialog::slotOkClicked); lay->addWidget(sendLaterWidget); QDateTime t = QDateTime::currentDateTime(); t = t.addSecs(60 * 60); mSendLaterWidget->mDateTime->setDateTime(t); connect(mSendLaterWidget->mRecurrence, &QCheckBox::clicked, this, &SendLaterDialog::slotRecurrenceClicked); const QStringList unitsList = {i18n("Days"), i18n("Weeks"), i18n("Months"), i18n("Years")}; mSendLaterWidget->mRecurrenceComboBox->addItems(unitsList); connect(mSendLaterWidget->mDateTime, &SendLaterTimeDateWidget::dateChanged, this, &SendLaterDialog::slotDateChanged); lay->addWidget(new KSeparator); mainLayout->addWidget(w); mainLayout->addWidget(buttonBox); slotRecurrenceClicked(false); if (info) { load(info); } resize(180, 120); } SendLaterDialog::~SendLaterDialog() { delete mSendLaterWidget; } void SendLaterDialog::slotDateChanged(const QString &date) { mOkButton->setEnabled(!date.isEmpty()); } void SendLaterDialog::slotRecurrenceClicked(bool clicked) { mSendLaterWidget->mRecurrenceValue->setEnabled(clicked); mSendLaterWidget->mRecurrenceComboBox->setEnabled(clicked); } void SendLaterDialog::load(SendLater::SendLaterInfo *info) { mSendLaterWidget->mDateTime->setDateTime(info->dateTime()); const bool recurrence = info->isRecurrence(); mSendLaterWidget->mRecurrence->setChecked(recurrence); slotRecurrenceClicked(recurrence); mSendLaterWidget->mRecurrenceValue->setValue(info->recurrenceEachValue()); mSendLaterWidget->mRecurrenceComboBox->setCurrentIndex(static_cast(info->recurrenceUnit())); } SendLater::SendLaterInfo *SendLaterDialog::info() { if (!mInfo) { mInfo = new SendLater::SendLaterInfo(); } mInfo->setRecurrence(mSendLaterWidget->mRecurrence->isChecked()); mInfo->setRecurrenceEachValue(mSendLaterWidget->mRecurrenceValue->value()); mInfo->setRecurrenceUnit(static_cast(mSendLaterWidget->mRecurrenceComboBox->currentIndex())); if (mSendDateTime.isValid()) { mInfo->setDateTime(mSendDateTime); } else { mInfo->setDateTime(mSendLaterWidget->mDateTime->dateTime()); } return mInfo; } SendLaterDialog::SendLaterAction SendLaterDialog::action() const { return mAction; } void SendLaterDialog::slotOkClicked() { if (!mDelay || mDelay->isChecked()) { mSendDateTime = mSendLaterWidget->mDateTime->dateTime(); mAction = SendDeliveryAtTime; } else { mAction = PutInOutbox; } accept(); } void SendLaterDialog::slotDelay(bool delayEnabled) { mSendLaterWidget->mLabel->setEnabled(delayEnabled); mSendLaterWidget->mDateTime->setEnabled(delayEnabled); mSendLaterWidget->mRecurrence->setEnabled(delayEnabled); mSendLaterWidget->mRecurrenceValue->setEnabled(delayEnabled && mSendLaterWidget->mRecurrence->isChecked()); mSendLaterWidget->mRecurrenceComboBox->setEnabled(delayEnabled && mSendLaterWidget->mRecurrence->isChecked()); } diff --git a/libsendlater/src/sendlatertimedatewidget.cpp b/libsendlater/src/sendlatertimedatewidget.cpp index 16e4fb4..81c6fa4 100644 --- a/libsendlater/src/sendlatertimedatewidget.cpp +++ b/libsendlater/src/sendlatertimedatewidget.cpp @@ -1,80 +1,80 @@ /* Copyright (C) 2013-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sendlatertimedatewidget.h" #include #include #include #include #include using namespace SendLater; SendLaterTimeDateWidget::SendLaterTimeDateWidget(QWidget *parent) : QWidget(parent) { QHBoxLayout *lay = new QHBoxLayout; - lay->setMargin(0); + lay->setContentsMargins(0, 0, 0, 0); QDateTime t = QDateTime::currentDateTime(); t = t.addSecs(60 * 60); mTimeComboBox = new KTimeComboBox; connect(mTimeComboBox, &KTimeComboBox::timeChanged, this, &SendLaterTimeDateWidget::slotDateTimeChanged); mTimeComboBox->setObjectName(QStringLiteral("time_sendlater")); mDateComboBox = new KDateComboBox; mDateComboBox->setOptions(KDateComboBox::EditDate | KDateComboBox::SelectDate | KDateComboBox::DatePicker | KDateComboBox::DateKeywords | KDateComboBox::WarnOnInvalid); mDateComboBox->setObjectName(QStringLiteral("date_sendlater")); connect(mDateComboBox->lineEdit(), &QLineEdit::textChanged, this, &SendLaterTimeDateWidget::dateChanged); mDateComboBox->setMinimumDate(t.date(), i18n("You cannot select a date prior to the current date.")); connect(mDateComboBox, &KDateComboBox::dateChanged, this, &SendLaterTimeDateWidget::slotDateTimeChanged); lay->addWidget(mDateComboBox); lay->addWidget(mTimeComboBox); setLayout(lay); } SendLaterTimeDateWidget::~SendLaterTimeDateWidget() { } void SendLaterTimeDateWidget::slotDateTimeChanged() { QDateTime dt; dt.setDate(mDateComboBox->date()); dt.setTime(mTimeComboBox->time()); Q_EMIT dateTimeChanged(dt); } QDateTime SendLaterTimeDateWidget::dateTime() const { QDateTime dt; dt.setDate(mDateComboBox->date()); dt.setTime(mTimeComboBox->time()); return dt; } void SendLaterTimeDateWidget::setDateTime(const QDateTime &datetime) { mTimeComboBox->setTime(datetime.time()); mDateComboBox->setDate(datetime.date()); }