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

Modernize code

parent 1b005fda
Pipeline #60485 passed with stage
in 9 minutes and 12 seconds
......@@ -73,7 +73,7 @@ class KIDENTITYMANAGEMENT_EXPORT Identity
friend KIDENTITYMANAGEMENT_EXPORT QDataStream &operator>>(QDataStream &stream, KIdentityManagement::Identity &ident);
public:
typedef QVector<Identity> List;
using List = QVector<Identity>;
/** Constructor */
explicit Identity(const QString &id = QString(),
......
......@@ -45,18 +45,18 @@ public:
static IdentityManager *self();
public:
typedef QVector<Identity>::Iterator Iterator;
typedef QVector<Identity>::ConstIterator ConstIterator;
using Iterator = QVector<Identity>::Iterator;
using ConstIterator = QVector<Identity>::ConstIterator;
/**
* Typedef for STL style iterator
*/
typedef Iterator iterator;
using iterator = Iterator;
/**
* Typedef for STL style iterator
*/
typedef ConstIterator const_iterator;
using const_iterator = ConstIterator;
/** @return a unique name for a new identity based on @p name
* @param name the name of the base identity
......
......@@ -91,7 +91,7 @@ public:
QImage image;
QString name;
};
typedef QSharedPointer<EmbeddedImage> EmbeddedImagePtr;
using EmbeddedImagePtr = QSharedPointer<EmbeddedImage>;
/** Used for comparison */
bool operator==(const Signature &other) const;
......@@ -202,7 +202,7 @@ public:
};
/// Describes which additional parts should be added to the signature
typedef QFlags<AddedTextFlag> AddedText;
using AddedText = QFlags<AddedTextFlag>;
/** Inserts this signature into the given text edit.
* If the signature is inserted at the beginning, a couple of new
......
......@@ -97,7 +97,7 @@ QString SignatureConfigurator::Private::asCleanedHTML() const
void SignatureConfigurator::Private::init()
{
auto *vlay = new QVBoxLayout(q);
auto vlay = new QVBoxLayout(q);
vlay->setObjectName(QStringLiteral("main layout"));
// "enable signature" checkbox:
......@@ -108,7 +108,7 @@ void SignatureConfigurator::Private::init()
vlay->addWidget(mEnableCheck);
// "obtain signature text from" combo and label:
auto *hlay = new QHBoxLayout(); // inherits spacing
auto hlay = new QHBoxLayout(); // inherits spacing
vlay->addLayout(hlay);
mSourceCombo = new QComboBox(q);
mSourceCombo->setEditable(false);
......@@ -117,14 +117,14 @@ void SignatureConfigurator::Private::init()
mSourceCombo->addItems(QStringList() << i18nc("continuation of \"obtain signature text from\"", "Input Field Below")
<< i18nc("continuation of \"obtain signature text from\"", "File")
<< i18nc("continuation of \"obtain signature text from\"", "Output of Command"));
QLabel *label = new QLabel(i18n("Obtain signature &text from:"), q);
auto label = new QLabel(i18n("Obtain signature &text from:"), q);
label->setBuddy(mSourceCombo);
label->setEnabled(false); // since !mEnableCheck->isChecked()
hlay->addWidget(label);
hlay->addWidget(mSourceCombo, 1);
// widget stack that is controlled by the source combo:
auto *widgetStack = new QStackedWidget(q);
auto widgetStack = new QStackedWidget(q);
widgetStack->setEnabled(false); // since !mEnableCheck->isChecked()
vlay->addWidget(widgetStack, 1);
q->connect(mSourceCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), widgetStack, &QStackedWidget::setCurrentIndex);
......@@ -139,9 +139,9 @@ void SignatureConfigurator::Private::init()
int pageno = 0;
// page 0: input field for direct entering:
QWidget *page = new QWidget(widgetStack);
auto page = new QWidget(widgetStack);
widgetStack->insertWidget(pageno, page);
auto *page_vlay = new QVBoxLayout(page);
auto page_vlay = new QVBoxLayout(page);
page_vlay->setContentsMargins(0, 0, 0, 0);
#ifndef QT_NO_TOOLBAR
......@@ -156,12 +156,12 @@ void SignatureConfigurator::Private::init()
mTextEdit = new KPIMTextEdit::RichTextComposer(q);
auto *richTextEditorwidget = new KPIMTextEdit::RichTextEditorWidget(mTextEdit, q);
auto richTextEditorwidget = new KPIMTextEdit::RichTextEditorWidget(mTextEdit, q);
page_vlay->addWidget(richTextEditorwidget, 2);
mTextEdit->setWhatsThis(i18n("Use this field to enter an arbitrary static signature."));
// Fill the toolbars.
KActionCollection *actionCollection = new KActionCollection(q);
auto actionCollection = new KActionCollection(q);
mTextEdit->createActions(actionCollection);
#ifndef QT_NO_TOOLBAR
mEditToolBar->addAction(actionCollection->action(QStringLiteral("format_text_bold")));
......@@ -428,7 +428,7 @@ void SignatureConfigurator::slotEdit()
// slotEnableEditButton should prevent this assert from being hit:
assert(!url.isEmpty());
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(url), QStringLiteral("text/plain"));
auto job = new KIO::OpenUrlJob(QUrl::fromLocalFile(url), QStringLiteral("text/plain"));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->setDeleteTemporaryFile(true);
job->start();
......
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