diff --git a/utilities/assistants/sendbymail/wizard/mailintropage.cpp b/utilities/assistants/sendbymail/wizard/mailintropage.cpp
index dc9039451e..ed4951b170 100644
--- a/utilities/assistants/sendbymail/wizard/mailintropage.cpp
+++ b/utilities/assistants/sendbymail/wizard/mailintropage.cpp
@@ -1,127 +1,127 @@
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2017-06-27
* Description : a tool to export items by email.
*
* Copyright (C) 2017 by Gilles Caulier
*
* 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, 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.
*
* ============================================================ */
#include "mailintropage.h"
// Qt includes
#include
#include
#include
#include
// KDE includes
#include
// Local includes
#include "digikam_debug.h"
#include "dlayoutbox.h"
#include "mailwizard.h"
#include "mailsettings.h"
namespace Digikam
{
class MailIntroPage::Private
{
public:
Private(QWizard* const dialog)
: imageGetOption(0),
hbox(0),
wizard(0),
iface(0)
{
wizard = dynamic_cast(dialog);
if (wizard)
{
iface = wizard->iface();
}
}
QComboBox* imageGetOption;
DHBox* hbox;
MailWizard* wizard;
DInfoInterface* iface;
};
MailIntroPage::MailIntroPage(QWizard* const dialog, const QString& title)
: DWizardPage(dialog, title),
d(new Private(dialog))
{
DVBox* const vbox = new DVBox(this);
QLabel* const desc = new QLabel(vbox);
desc->setWordWrap(true);
desc->setOpenExternalLinks(true);
desc->setText(i18n(""
"Welcome to Email Tool
"
"This assistant will guide you to send "
"your items with a mail client application.
"
- "Before to export contents, you will be able to adjust attachements "
+ "
Before to export contents, you will be able to adjust attachments "
"properties accordingly with your mail service capabilities.
"
""));
// ComboBox for image selection method
d->hbox = new DHBox(vbox);
QLabel* const getImageLabel = new QLabel(i18n("&Choose image selection method:"), d->hbox);
d->imageGetOption = new QComboBox(d->hbox);
d->imageGetOption->insertItem(MailSettings::ALBUMS, i18n("Albums"));
d->imageGetOption->insertItem(MailSettings::IMAGES, i18n("Images"));
getImageLabel->setBuddy(d->imageGetOption);
setPageWidget(vbox);
setLeftBottomPix(QIcon::fromTheme(QLatin1String("view-presentation")));
}
MailIntroPage::~MailIntroPage()
{
delete d;
}
void MailIntroPage::initializePage()
{
bool albumSupport = (d->iface && d->iface->supportAlbums());
if (!albumSupport)
{
d->imageGetOption->setCurrentIndex(MailSettings::IMAGES);
d->hbox->setEnabled(false);
}
else
{
d->imageGetOption->setCurrentIndex(d->wizard->settings()->selMode);
}
}
bool MailIntroPage::validatePage()
{
d->wizard->settings()->selMode = (MailSettings::Selection)d->imageGetOption->currentIndex();
return true;
}
} // namespace Digikam
diff --git a/utilities/assistants/sendbymail/wizard/mailsettingspage.cpp b/utilities/assistants/sendbymail/wizard/mailsettingspage.cpp
index 00777e7f7b..640c57f082 100644
--- a/utilities/assistants/sendbymail/wizard/mailsettingspage.cpp
+++ b/utilities/assistants/sendbymail/wizard/mailsettingspage.cpp
@@ -1,294 +1,294 @@
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2017-06-27
* Description : a tool to export items by email.
*
* Copyright (C) 2017 by Gilles Caulier
*
* 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, 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.
*
* ============================================================ */
#include "mailsettingspage.h"
// Qt includes
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// KDE includes
#include
// Local includes
#include "mailwizard.h"
#include "dfileselector.h"
#include "filesaveconflictbox.h"
namespace Digikam
{
class MailSettingsPage::Private
{
public:
Private(QWizard* const dialog)
: labelMailAgent(0),
labelImagesResize(0),
labelImagesFormat(0),
labelAttachmentLimit(0),
labelImageCompression(0),
mailAgentName(0),
imagesFormat(0),
changeImagesProp(0),
addComments(0),
imageCompression(0),
attachmentlimit(0),
imagesResize(0),
wizard(0),
settings(0)
{
wizard = dynamic_cast(dialog);
if (wizard)
{
settings = wizard->settings();
iface = wizard->iface();
}
}
QLabel* labelMailAgent;
QLabel* labelImagesResize;
QLabel* labelImagesFormat;
QLabel* labelAttachmentLimit;
QLabel* labelImageCompression;
QComboBox* mailAgentName;
QComboBox* imagesFormat;
QCheckBox* changeImagesProp;
QCheckBox* addComments;
QSpinBox* imageCompression;
QSpinBox* attachmentlimit;
QSpinBox* imagesResize;
MailWizard* wizard;
DInfoInterface* iface;
MailSettings* settings;
};
MailSettingsPage::MailSettingsPage(QWizard* const dialog, const QString& title)
: DWizardPage(dialog, title),
d(new Private(dialog))
{
QWidget* const main = new QWidget(this);
// --------------------
d->labelMailAgent = new QLabel(main);
d->labelMailAgent->setWordWrap(false);
d->labelMailAgent->setText(i18n("Mail program:"));
d->mailAgentName = new QComboBox(main);
d->mailAgentName->setEditable(false);
d->mailAgentName->setWhatsThis(i18n("Select your preferred external mail client program here."));
QMap map = MailSettings::mailClientNames();
QMap::const_iterator it = map.constBegin();
while (it != map.constEnd())
{
d->mailAgentName->addItem(it.value(), (int)it.key());
++it;
}
d->labelMailAgent->setBuddy(d->mailAgentName);
//---------------------------------------------
d->addComments = new QCheckBox(i18n("Attach a file with items properties"), main);
d->addComments->setWhatsThis(i18n("If you enable this option, all item properties "
"as Comments, Rating, or Tags, will be added as "
"an attached file."));
// --------------------------------------------
d->attachmentlimit = new QSpinBox(main);
d->attachmentlimit->setRange(1, 50);
d->attachmentlimit->setSingleStep(1);
d->attachmentlimit->setValue(17);
d->attachmentlimit->setSuffix(i18n(" MB"));
d->labelAttachmentLimit = new QLabel(i18n("Maximum email size limit:"), main);
d->labelAttachmentLimit->setBuddy(d->attachmentlimit);
//---------------------------------------------
d->changeImagesProp = new QCheckBox(i18n("Adjust image properties"), main);
d->changeImagesProp->setChecked(true);
d->changeImagesProp->setWhatsThis(i18n("If you enable this option, "
"all images to be sent can be "
"resized and recompressed."));
QGroupBox* const groupBox = new QGroupBox(i18n("Image Properties"), main);
QGridLayout* const grid2 = new QGridLayout(groupBox);
//---------------------------------------------
d->imagesResize = new QSpinBox(groupBox);
d->imagesResize->setRange(300, 4000);
d->imagesResize->setSingleStep(1);
d->imagesResize->setValue(1024);
d->imagesResize->setSuffix(i18n(" px"));
- d->imagesResize->setWhatsThis(i18n("Select the lenght of the images that are to be sent. "
+ d->imagesResize->setWhatsThis(i18n("Select the length of the images that are to be sent. "
"The aspect ratio is preserved."));
- d->labelImagesResize = new QLabel(i18n("Image Lenght:"), groupBox);
+ d->labelImagesResize = new QLabel(i18n("Image Length:"), groupBox);
d->labelImagesResize->setBuddy(d->imagesResize);
//---------------------------------------------
d->labelImagesFormat = new QLabel(groupBox);
d->labelImagesFormat->setWordWrap(false);
d->labelImagesFormat->setText(i18n("Image Format:"));
d->imagesFormat = new QComboBox(groupBox);
d->imagesFormat->setEditable(false);
d->imagesFormat->setWhatsThis(i18n("Select your preferred format to convert image."));
QMap map2 = MailSettings::imageFormatNames();
QMap::const_iterator it2 = map2.constBegin();
while (it2 != map2.constEnd())
{
d->imagesFormat->addItem(it2.value(), (int)it2.key());
++it2;
}
d->labelImagesFormat->setBuddy(d->imagesFormat);
// --------------------
d->imageCompression = new QSpinBox(groupBox);
d->imageCompression->setRange(1, 100);
d->imageCompression->setSingleStep(1);
d->imageCompression->setValue(75);
QString whatsThis = i18n("The new compression value of JPEG images to be sent:
");
whatsThis = whatsThis + i18n("1: very high compression
"
"25: high compression
"
"50: medium compression
"
"75: low compression (default value)
"
"100: no compression
");
d->imageCompression->setWhatsThis(whatsThis);
d->labelImageCompression = new QLabel(i18n("Image quality:"), this);
d->labelImageCompression->setBuddy(d->imageCompression);
// --------------------
grid2->addWidget(d->labelImagesResize, 0, 0, 1, 1);
grid2->addWidget(d->imagesResize, 0, 1, 1, 2);
grid2->addWidget(d->labelImagesFormat, 1, 0, 1, 1);
grid2->addWidget(d->imagesFormat, 1, 1, 1, 2);
grid2->addWidget(d->labelImageCompression, 2, 0, 1, 1);
grid2->addWidget(d->imageCompression, 2, 1, 1, 2);
grid2->setRowStretch(4, 10);
grid2->setColumnStretch(2, 10);
grid2->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
grid2->setAlignment(Qt::AlignTop);
// --------------------
QGridLayout* const grid = new QGridLayout(main);
grid->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
grid->addWidget(d->labelMailAgent, 0, 0, 1, 1);
grid->addWidget(d->mailAgentName, 0, 1, 1, 2);
grid->addWidget(d->labelAttachmentLimit,1, 0, 1, 1);
grid->addWidget(d->attachmentlimit, 1, 1, 1, 4);
grid->addWidget(d->addComments, 2, 0, 1, 4);
grid->addWidget(d->changeImagesProp, 3, 0, 1, 4);
grid->addWidget(groupBox, 4, 0, 1, 4);
grid->setRowStretch(5, 10);
grid->setColumnStretch(3, 10);
setPageWidget(main);
setLeftBottomPix(QIcon::fromTheme(QLatin1String("mail-attachment")));
//---------------------------------------------
connect(d->imagesFormat, SIGNAL(activated(int)),
this, SLOT(slotImagesFormatChanged(int)));
connect(d->changeImagesProp, SIGNAL(toggled(bool)),
groupBox, SLOT(setEnabled(bool)));
}
MailSettingsPage::~MailSettingsPage()
{
delete d;
}
void MailSettingsPage::slotImagesFormatChanged(int i)
{
if (i == MailSettings::JPEG)
d->imageCompression->setEnabled(true);
else
d->imageCompression->setEnabled(false);
}
void MailSettingsPage::initializePage()
{
d->mailAgentName->setCurrentIndex((int)d->settings->mailProgram);
d->imagesResize->setValue(d->settings->imageSize);
d->imagesFormat->setCurrentIndex((int)d->settings->imageFormat);
d->changeImagesProp->setChecked(d->settings->imagesChangeProp);
d->addComments->setChecked(d->iface ? d->settings->addCommentsAndTags : false);
d->addComments->setEnabled(d->iface);
d->imageCompression->setValue(d->settings->imageCompression);
d->attachmentlimit->setValue(d->settings->attLimitInMbytes);
slotImagesFormatChanged(d->imagesFormat->currentIndex());
}
bool MailSettingsPage::validatePage()
{
d->settings->mailProgram = MailSettings::MailClient(d->mailAgentName->currentIndex());
d->settings->imageSize = d->imagesResize->value();
d->settings->imageFormat = MailSettings::ImageFormat(d->imagesFormat->currentIndex());
d->settings->imagesChangeProp = d->changeImagesProp->isChecked();
d->settings->addCommentsAndTags = d->addComments->isChecked();
d->settings->imageCompression = d->imageCompression->value();
d->settings->attLimitInMbytes = d->attachmentlimit->value();
return true;
}
} // namespace Digikam