Commit c845aa5b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Reactivate code

parent 6dc764fb
set(kmail_mailmergeplugin_SRCS
mailmergedialog.cpp
widgets/addressbookwidget.cpp
widgets/attachmentlistwidget.cpp
widgets/csvwidget.cpp
widgets/mailmergewidget.cpp
widgets/selectattachmentdialog.cpp
)
add_library(mailmerge ${kmail_mailmergeplugin_SRCS})
generate_export_header(mailmerge BASE_NAME mailmerge)
if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
set_target_properties(mailmerge PROPERTIES UNITY_BUILD ON)
endif()
target_link_libraries(mailmerge
KF5::I18n
KF5::MessageComposer
KF5::KIOWidgets
)
set_target_properties(mailmerge
PROPERTIES OUTPUT_NAME mailmerge VERSION ${KDEPIMADDONS_LIB_VERSION} SOVERSION ${KDEPIMADDONS_LIB_SOVERSION}
)
#kcoreaddons_add_plugin(kmail_logactivitiesplugin JSON kmail_logactivitiesplugin.json SOURCES
# ${kmail_logactivitiesplugin_SRCS} INSTALL_NAMESPACE kmail/mainview)
#target_link_libraries(kmail_logactivitiesplugin
# KF5::PimCommon KF5::PimCommonAkonadi KF5::XmlGui KF5::Libkdepim KF5::I18n
#)
#if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
# set_target_properties(kmail_logactivitiesplugin PROPERTIES UNITY_BUILD ON)
#endif()
if(BUILD_TESTING)
#add_subdirectory(autotests)
#add_subdirectory(tests)
endif()
......@@ -11,8 +11,8 @@ using namespace MailMerge;
AddressBookWidget::AddressBookWidget(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *hbox = new QHBoxLayout;
setLayout(hbox);
QHBoxLayout *mainLayout = new QHBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
}
AddressBookWidget::~AddressBookWidget()
......
......@@ -9,6 +9,7 @@
#include <QPointer>
#include <QPushButton>
#include <QUrl>
using namespace MailMerge;
AttachmentListWidget::AttachmentListWidget(QWidget *parent, ButtonCode buttons, const QString &addLabel, const QString &removeLabel, const QString &modifyLabel)
......@@ -33,7 +34,7 @@ QString AttachmentListWidget::modifyEntry(const QString &text)
{
QString attachmentPath;
QPointer<SelectAttachmentDialog> dlg = new SelectAttachmentDialog(this);
dlg->setAttachmentPath(text);
dlg->setAttachmentPath(QUrl::fromLocalFile(text));
if (dlg->exec()) {
attachmentPath = dlg->attachmentPath();
}
......
......@@ -23,7 +23,7 @@ public:
~AttachmentListWidget() override;
void addNewEntry() override;
QString modifyEntry(const QString &text) override;
Q_REQUIRED_RESULT QString modifyEntry(const QString &text) override;
};
}
#endif // ATTACHMENTLISTWIDGET_H
......@@ -16,14 +16,14 @@ using namespace MailMerge;
CsvWidget::CsvWidget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *csvWidgetLayout = new QVBoxLayout;
csvWidgetLayout->setContentsMargins(0, 0, 0, 0);
setLayout(csvWidgetLayout);
QVBoxLayout *csvWidgetLayout = new QVBoxLayout(this);
csvWidgetLayout->setObjectName(QStringLiteral("csvWidgetLayout"));
csvWidgetLayout->setContentsMargins({});
QLabel *lab = new QLabel(i18n("Path:"));
QLabel *lab = new QLabel(i18n("Path:"), this);
lab->setObjectName(QStringLiteral("label"));
csvWidgetLayout->addWidget(lab);
mCvsUrlRequester = new KUrlRequester;
mCvsUrlRequester = new KUrlRequester(this);
mCvsUrlRequester->setObjectName(QStringLiteral("cvsurlrequester"));
csvWidgetLayout->addWidget(mCvsUrlRequester);
}
......
......@@ -23,16 +23,15 @@ using namespace MailMerge;
MailMergeWidget::MailMergeWidget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *vbox = new QVBoxLayout;
setLayout(vbox);
QVBoxLayout *vbox = new QVBoxLayout(this);
QHBoxLayout *hbox = new QHBoxLayout;
vbox->addLayout(hbox);
QLabel *lab = new QLabel(i18n("Source:"));
QLabel *lab = new QLabel(i18n("Source:"), this);
hbox->addWidget(lab);
mSource = new QComboBox;
mSource = new QComboBox(this);
mSource->setObjectName(QStringLiteral("source"));
mSource->addItem(i18n("Address Book"), AddressBook);
mSource->addItem(i18n("CSV"), CSV);
......@@ -41,20 +40,20 @@ MailMergeWidget::MailMergeWidget(QWidget *parent)
hbox->addWidget(mSource);
mStackedWidget = new QStackedWidget;
mStackedWidget = new QStackedWidget(this);
mStackedWidget->setObjectName(QStringLiteral("stackedwidget"));
vbox->addWidget(mStackedWidget);
mAddressbookWidget = new MailMerge::AddressBookWidget;
mAddressbookWidget = new MailMerge::AddressBookWidget(this);
mAddressbookWidget->setObjectName(QStringLiteral("addressbookwidget"));
mStackedWidget->addWidget(mAddressbookWidget);
mCsvWidget = new MailMerge::CsvWidget;
mCsvWidget = new MailMerge::CsvWidget(this);
mCsvWidget->setObjectName(QStringLiteral("csvwidget"));
mStackedWidget->addWidget(mCsvWidget);
lab = new QLabel(i18n("Attachment:"));
lab = new QLabel(i18n("Attachment:"), this);
vbox->addWidget(lab);
PimCommon::SimpleStringListEditor::ButtonCode buttonCode = static_cast<PimCommon::SimpleStringListEditor::ButtonCode>(
......
......@@ -8,6 +8,7 @@
#include <KLocalizedString>
#include <QDialogButtonBox>
#include <QLabel>
#include <QVBoxLayout>
#include <kurlrequester.h>
using namespace MailMerge;
......@@ -15,9 +16,8 @@ SelectAttachmentDialog::SelectAttachmentDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Attachment"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......@@ -30,7 +30,7 @@ SelectAttachmentDialog::SelectAttachmentDialog(QWidget *parent)
QLabel *lab = new QLabel(i18n("Select attachment:"));
lab->setObjectName(QStringLiteral("selectattachment_label"));
vbox->addWidget(lab);
mUrlRequester = new KUrlRequester;
mUrlRequester = new KUrlRequester(this);
mUrlRequester->setMode(KFile::LocalOnly | KFile::ExistingOnly);
mUrlRequester->setObjectName(QStringLiteral("urlrequester"));
vbox->addWidget(mUrlRequester);
......@@ -42,7 +42,7 @@ SelectAttachmentDialog::~SelectAttachmentDialog()
{
}
void SelectAttachmentDialog::setAttachmentPath(const QString &path)
void SelectAttachmentDialog::setAttachmentPath(const QUrl &path)
{
mUrlRequester->setUrl(path);
}
......
......@@ -19,8 +19,8 @@ public:
explicit SelectAttachmentDialog(QWidget *parent = nullptr);
~SelectAttachmentDialog() override;
void setAttachmentPath(const QString &path);
QString attachmentPath() const;
void setAttachmentPath(const QUrl &path);
Q_REQUIRED_RESULT QString attachmentPath() const;
private:
KUrlRequester *mUrlRequester = nullptr;
......
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