Commit 41887e8a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

const'ify + modernize code

parent 7b7cd675
Pipeline #33347 failed with stage
in 60 minutes and 44 seconds
......@@ -100,7 +100,7 @@ private:
KAddressBookImportExport::KAddressBookImportExportContactFields::Fields fields = KAddressBookImportExport::KAddressBookImportExportContactFields::allFields();
fields.remove(KAddressBookImportExport::KAddressBookImportExportContactFields::Undefined);
for (int i = 0; i < fields.count(); ++i) {
for (int i = 0, total = fields.count(); i < total; ++i) {
mFieldMap.insert(KAddressBookImportExport::KAddressBookImportExportContactFields::label(fields.at(i)), fields.at(i));
}
}
......@@ -165,7 +165,6 @@ public:
CSVImportDialog::CSVImportDialog(QWidget *parent)
: QDialog(parent)
, mDevice(nullptr)
{
setWindowTitle(i18nc("@title:window", "CSV Import Dialog"));
setModal(true);
......@@ -511,7 +510,7 @@ void CSVImportDialog::reloadCodecs()
mCodecCombo->addItem(i18nc("@item:inlistbox Codec setting", "Unicode"), Uni);
mCodecCombo->addItem(i18nc("@item:inlistbox Codec setting", "Microsoft Unicode"), MSBug);
for (int i = 0; i < mCodecs.count(); ++i) {
for (int i = 0, total = mCodecs.count(); i < total; ++i) {
mCodecCombo->addItem(QLatin1String(mCodecs.at(i)->name()), Codec + i);
}
}
......
......@@ -12,8 +12,8 @@
CsvParser::CsvParser(QObject *parent)
: QThread(parent)
, mReader(new QCsvReader(this))
{
mReader = new QCsvReader(this);
}
CsvParser::~CsvParser()
......
......@@ -43,7 +43,7 @@ protected:
void run() override;
private:
QCsvReader *mReader = nullptr;
QCsvReader *const mReader;
QIODevice *mDevice = nullptr;
int mRowCount = 0;
int mColumnCount = 0;
......
......@@ -29,7 +29,7 @@ public:
void emitEndLine(uint row);
void emitField(const QString &data, int row, int column);
QCsvBuilderInterface *mBuilder = nullptr;
QCsvBuilderInterface *const mBuilder;
QTextCodec *mCodec = nullptr;
QChar mTextQuote = QLatin1Char('"');
QChar mDelimiter = QLatin1Char(' ');
......
......@@ -26,7 +26,7 @@ void LDapImportExportPluginInterface::createAction(KActionCollection *ac)
QAction *action = ac->addAction(QStringLiteral("file_import_ldap"));
action->setText(i18n("Import From LDAP server..."));
action->setWhatsThis(i18n("Import contacts from an LDAP server."));
setImportActions(QList<QAction *>() << action);
setImportActions({action});
connect(action, &QAction::triggered, this, &LDapImportExportPluginInterface::slotImportLdap);
}
......
......@@ -180,7 +180,7 @@ void LDifImportExportPluginInterface::exportLdif()
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly)) {
QString txt = i18n("<qt>Unable to open file <b>%1</b>.</qt>", fileName);
const QString txt = i18n("<qt>Unable to open file <b>%1</b>.</qt>", fileName);
KMessageBox::error(parentWidget(), txt);
return;
}
......
......@@ -111,7 +111,7 @@ void VCardImportExportPluginInterface::importVCard()
{
KContacts::Addressee::List addrList;
const QString filter = i18n("vCard (*.vcf *.vcard *.vct *.gcrd);;All files (*)");
QList<QUrl> urls
const QList<QUrl> urls
= QFileDialog::getOpenFileUrls(parentWidget(), i18nc("@title:window", "Select vCard to Import"),
QUrl(),
filter);
......
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