Commit 3eae2cbf authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use QStringLiteral

parent d93333b5
......@@ -74,14 +74,14 @@ void ExportAlarmJob::backupResources()
const Akonadi::AgentInstance::List list = manager->instances();
Q_FOREACH (const Akonadi::AgentInstance &agent, list) {
const QString identifier = agent.identifier();
if (identifier.contains(QLatin1String("akonadi_kalarm_resource_"))) {
if (identifier.contains(QStringLiteral("akonadi_kalarm_resource_"))) {
backupResourceFile(agent, Utils::alarmPath());
} else if (identifier.contains(QLatin1String("akonadi_kalarm_dir_resource_"))) {
} else if (identifier.contains(QStringLiteral("akonadi_kalarm_dir_resource_"))) {
const QString archivePath = Utils::alarmPath() + identifier + QDir::separator();
QUrl url = Utils::resourcePath(agent);
if (!url.isEmpty()) {
const bool fileAdded = backupFullDirectory(url, archivePath, QLatin1String("alarm.zip"));
const bool fileAdded = backupFullDirectory(url, archivePath, QStringLiteral("alarm.zip"));
if (fileAdded) {
const QString errorStr = Utils::storeResources(archive(), identifier, archivePath);
if (!errorStr.isEmpty()) {
......@@ -109,7 +109,7 @@ void ExportAlarmJob::backupConfig()
{
showInfo(i18n("Backing up config..."));
MessageViewer::KCursorSaver busy(MessageViewer::KBusyPtr::busy());
const QString kalarmStr(QLatin1String("kalarmrc"));
const QString kalarmStr(QStringLiteral("kalarmrc"));
const QString kalarmrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + kalarmStr;
if (QFile(kalarmrc).exists()) {
KSharedConfigPtr kalarm = KSharedConfig::openConfig(kalarmrc);
......@@ -119,10 +119,10 @@ void ExportAlarmJob::backupConfig()
KConfig *kalarmConfig = kalarm->copyTo(tmp.fileName());
const QString collectionsStr(QLatin1String("Collections"));
const QString collectionsStr(QStringLiteral("Collections"));
if (kalarmConfig->hasGroup(collectionsStr)) {
KConfigGroup group = kalarmConfig->group(collectionsStr);
const QString selectionKey(QLatin1String("FavoriteCollectionIds"));
const QString selectionKey(QStringLiteral("FavoriteCollectionIds"));
Utils::convertCollectionIdsToRealPath(group, selectionKey);
}
......
......@@ -31,25 +31,25 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Kdelibs4ConfigMigrator migrate(QLatin1String("pimsettingexporter"));
migrate.setConfigFiles(QStringList() << QLatin1String("pimsettingexporterrc"));
migrate.setUiFiles(QStringList() << QLatin1String("pimsettingexporter.rc"));
Kdelibs4ConfigMigrator migrate(QStringLiteral("pimsettingexporter"));
migrate.setConfigFiles(QStringList() << QStringLiteral("pimsettingexporterrc"));
migrate.setUiFiles(QStringList() << QStringLiteral("pimsettingexporter.rc"));
migrate.migrate();
KLocalizedString::setApplicationDomain("pimsettingexporter");
KAboutData aboutData(QLatin1String("pimsettingexporter"), i18n("PIM Setting Exporter"),
QLatin1String(KDEPIM_VERSION), i18n("PIM Setting Exporter"), KAboutLicense::GPL_V2,
KAboutData aboutData(QStringLiteral("pimsettingexporter"), i18n("PIM Setting Exporter"),
QStringLiteral(KDEPIM_VERSION), i18n("PIM Setting Exporter"), KAboutLicense::GPL_V2,
i18n("Copyright © 2012-2015 pimsettingexporter authors"));
aboutData.addAuthor(i18n("Laurent Montel"), i18n("Maintainer"), QStringLiteral("montel@kde.org"));
QApplication::setWindowIcon(QIcon::fromTheme(QLatin1String("kontact")));
QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kontact")));
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("template"), i18n("Template file uses to define what data, settings to import or export"), QLatin1String("file")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("import"), i18n("Import the given file")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("export"), i18n("Export the given file")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("+[url]"), i18n("File or url. The user will be asked whether to import or export.")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("template"), i18n("Template file uses to define what data, settings to import or export"), QStringLiteral("file")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("import"), i18n("Import the given file")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("export"), i18n("Export the given file")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("+[url]"), i18n("File or url. The user will be asked whether to import or export.")));
aboutData.setupCommandLine(&parser);
parser.process(app);
......
......@@ -271,7 +271,7 @@ void SelectionTypeTreeWidget::loadFileName(const QString &fileName)
void SelectionTypeTreeWidget::loadTemplate(const QString &fileName)
{
if (fileName.isEmpty()) {
QPointer<QFileDialog> dlg = new QFileDialog(this, QString(), QString(), QLatin1String("*.xml"));
QPointer<QFileDialog> dlg = new QFileDialog(this, QString(), QString(), QStringLiteral("*.xml"));
dlg->setFileMode(QFileDialog::ExistingFile);
if (dlg->exec()) {
const QStringList file = dlg->selectedFiles();
......@@ -288,7 +288,7 @@ void SelectionTypeTreeWidget::saveAsTemplate()
TemplateSelection templateSelection;
templateSelection.createTemplate(storedType());
const QString templateStr = templateSelection.document().toString(2);
const QString filter(QLatin1String("*.xml"));
const QString filter(QStringLiteral("*.xml"));
PimCommon::Util::saveTextAs(templateStr, filter, this);
}
......
......@@ -52,17 +52,17 @@ Utils::StoredTypes TemplateSelection::loadStoredTypes(const QDomElement &element
QDomElement e = n.toElement();
if (!e.isNull()) {
const QString tagName(e.tagName());
if (tagName == QLatin1String("mailtransport")) {
if (tagName == QStringLiteral("mailtransport")) {
types |= Utils::MailTransport;
} else if (tagName == QLatin1String("mail")) {
} else if (tagName == QStringLiteral("mail")) {
types |= Utils::Mails;
} else if (tagName == QLatin1String("resources")) {
} else if (tagName == QStringLiteral("resources")) {
types |= Utils::Resources;
} else if (tagName == QLatin1String("identity")) {
} else if (tagName == QStringLiteral("identity")) {
types |= Utils::Identity;
} else if (tagName == QLatin1String("config")) {
} else if (tagName == QStringLiteral("config")) {
types |= Utils::Config;
} else if (tagName == QLatin1String("akonadidb")) {
} else if (tagName == QStringLiteral("akonadidb")) {
types |= Utils::AkonadiDb;
}
}
......@@ -85,19 +85,19 @@ QHash<Utils::AppsType, Utils::StoredTypes> TemplateSelection::loadTemplate(const
const QString tagName(e.tagName());
qCDebug(PIMSETTINGEXPORTER_LOG) << "tag :" << tagName;
Utils::AppsType type = Utils::Unknown;
if (tagName == QLatin1String("kmail")) {
if (tagName == QStringLiteral("kmail")) {
type = Utils::KMail;
} else if (tagName == QLatin1String("kaddressbook")) {
} else if (tagName == QStringLiteral("kaddressbook")) {
type = Utils::KAddressBook;
} else if (tagName == QLatin1String("kalarm")) {
} else if (tagName == QStringLiteral("kalarm")) {
type = Utils::KAlarm;
} else if (tagName == QLatin1String("korganizer")) {
} else if (tagName == QStringLiteral("korganizer")) {
type = Utils::KOrganizer;
} else if (tagName == QLatin1String("knotes")) {
} else if (tagName == QStringLiteral("knotes")) {
type = Utils::KNotes;
} else if (tagName == QLatin1String("akregator")) {
} else if (tagName == QStringLiteral("akregator")) {
type = Utils::Akregator;
} else if (tagName == QLatin1String("blogilo")) {
} else if (tagName == QStringLiteral("blogilo")) {
type = Utils::Blogilo;
}
if (type != Utils::Unknown) {
......@@ -115,27 +115,27 @@ QHash<Utils::AppsType, Utils::StoredTypes> TemplateSelection::loadTemplate(const
void TemplateSelection::saveParameters(Utils::StoredTypes type, QDomElement &elem)
{
if (type & Utils::MailTransport) {
QDomElement tag = mDocument.createElement(QLatin1String("mailtransport"));
QDomElement tag = mDocument.createElement(QStringLiteral("mailtransport"));
elem.appendChild(tag);
}
if (type & Utils::Mails) {
QDomElement tag = mDocument.createElement(QLatin1String("mail"));
QDomElement tag = mDocument.createElement(QStringLiteral("mail"));
elem.appendChild(tag);
}
if (type & Utils::Resources) {
QDomElement tag = mDocument.createElement(QLatin1String("resources"));
QDomElement tag = mDocument.createElement(QStringLiteral("resources"));
elem.appendChild(tag);
}
if (type & Utils::Identity) {
QDomElement tag = mDocument.createElement(QLatin1String("identity"));
QDomElement tag = mDocument.createElement(QStringLiteral("identity"));
elem.appendChild(tag);
}
if (type & Utils::Config) {
QDomElement tag = mDocument.createElement(QLatin1String("config"));
QDomElement tag = mDocument.createElement(QStringLiteral("config"));
elem.appendChild(tag);
}
if (type & Utils::AkonadiDb) {
QDomElement tag = mDocument.createElement(QLatin1String("akonadidb"));
QDomElement tag = mDocument.createElement(QStringLiteral("akonadidb"));
elem.appendChild(tag);
}
......@@ -144,53 +144,53 @@ void TemplateSelection::saveParameters(Utils::StoredTypes type, QDomElement &ele
void TemplateSelection::createTemplate(const QHash<Utils::AppsType, Utils::importExportParameters> &stored)
{
mDocument = QDomDocument();
QDomProcessingInstruction xmlDeclaration = mDocument.createProcessingInstruction(QLatin1String("xml"), QLatin1String("version=\"1.0\""));
QDomProcessingInstruction xmlDeclaration = mDocument.createProcessingInstruction(QStringLiteral("xml"), QStringLiteral("version=\"1.0\""));
mDocument.appendChild(xmlDeclaration);
QDomElement root = mDocument.createElement(QLatin1String("pimsettingexporter"));
QDomElement root = mDocument.createElement(QStringLiteral("pimsettingexporter"));
mDocument.appendChild(root);
QHash<Utils::AppsType, Utils::importExportParameters>::const_iterator i = stored.constBegin();
while (i != stored.constEnd()) {
switch (i.key()) {
case Utils::KMail: {
QDomElement tag = mDocument.createElement(QLatin1String("kmail"));
QDomElement tag = mDocument.createElement(QStringLiteral("kmail"));
root.appendChild(tag);
saveParameters(i.value().types, tag);
break;
}
case Utils::KAddressBook: {
QDomElement tag = mDocument.createElement(QLatin1String("kaddressbook"));
QDomElement tag = mDocument.createElement(QStringLiteral("kaddressbook"));
root.appendChild(tag);
saveParameters(i.value().types, tag);
break;
}
case Utils::KAlarm: {
QDomElement tag = mDocument.createElement(QLatin1String("kalarm"));
QDomElement tag = mDocument.createElement(QStringLiteral("kalarm"));
root.appendChild(tag);
saveParameters(i.value().types, tag);
break;
}
case Utils::KOrganizer: {
QDomElement tag = mDocument.createElement(QLatin1String("korganizer"));
QDomElement tag = mDocument.createElement(QStringLiteral("korganizer"));
root.appendChild(tag);
saveParameters(i.value().types, tag);
break;
}
case Utils::KNotes: {
QDomElement tag = mDocument.createElement(QLatin1String("knotes"));
QDomElement tag = mDocument.createElement(QStringLiteral("knotes"));
root.appendChild(tag);
saveParameters(i.value().types, tag);
break;
}
case Utils::Akregator: {
QDomElement tag = mDocument.createElement(QLatin1String("akregator"));
QDomElement tag = mDocument.createElement(QStringLiteral("akregator"));
root.appendChild(tag);
saveParameters(i.value().types, tag);
break;
}
case Utils::Blogilo: {
QDomElement tag = mDocument.createElement(QLatin1String("blogilo"));
QDomElement tag = mDocument.createElement(QStringLiteral("blogilo"));
root.appendChild(tag);
saveParameters(i.value().types, tag);
break;
......
Supports Markdown
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