Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit d95c4efc authored by Laurent Montel's avatar Laurent Montel 😁

Make build with strict compile flags

parent e7451a3d
......@@ -51,7 +51,9 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Su
QUIET
)
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
find_package(LibKWorkspace ${PROJECT_VERSION} REQUIRED)
# Disables automatic conversions from QString (or char *) to QUrl.
......
......@@ -34,8 +34,8 @@ int main(int argc, char *argv[])
QCoreApplication app(argc, argv);
KLocalizedString::setApplicationDomain("kbroadcastnotification");
KAboutData aboutData("kbroadcastnotification", i18n("Broadcast Notifications"),
PROJECT_VERSION,
KAboutData aboutData(QStringLiteral("kbroadcastnotification"), i18n("Broadcast Notifications"),
QLatin1String(PROJECT_VERSION),
i18n("A tool that emits a notification for all users by sending it on the system DBus"),
KAboutLicense::GPL,
i18n("(c) 2016 Kai Uwe Broulik"));
......
......@@ -71,7 +71,7 @@ static void listModules()
m_modules.append(s);
}
qStableSort(m_modules.begin(), m_modules.end(), caseInsensitiveLessThan);
std::stable_sort(m_modules.begin(), m_modules.end(), caseInsensitiveLessThan);
}
static KService::Ptr locateModule(const QString& module)
......@@ -79,14 +79,14 @@ static KService::Ptr locateModule(const QString& module)
QString path = module;
if (!path.endsWith(QLatin1String(".desktop")))
path += ".desktop";
path += QStringLiteral(".desktop");
KService::Ptr service = KService::serviceByStorageId( path );
if (!service) {
return KService::Ptr();
}
if (!service->hasServiceType("KCModule")) {
if (!service->hasServiceType(QStringLiteral("KCModule"))) {
// Not a KCModule. E.g. "kcmshell5 akonadi" finds services/kresources/kabc/akonadi.desktop, unrelated.
return KService::Ptr();
}
......@@ -108,8 +108,8 @@ bool KCMShell::isRunning()
qDebug() << "kcmshell5 with modules '" << m_serviceName << "' is already running.";
QDBusInterface iface(m_serviceName, "/KCModule/dialog", "org.kde.KCMShellMultiDialog");
QDBusReply<void> reply = iface.call("activate", KStartupInfo::startupId());
QDBusInterface iface(m_serviceName, QStringLiteral("/KCModule/dialog"), QStringLiteral("org.kde.KCMShellMultiDialog"));
QDBusReply<void> reply = iface.call(QStringLiteral("activate"), KStartupInfo::startupId());
if (!reply.isValid())
{
qDebug() << "Calling D-Bus function dialog::activate() failed.";
......@@ -125,15 +125,15 @@ KCMShellMultiDialog::KCMShellMultiDialog(KPageDialog::FaceType dialogFace, QWidg
setFaceType(dialogFace);
setModal(false);
QDBusConnection::sessionBus().registerObject("/KCModule/dialog", this, QDBusConnection::ExportScriptableSlots);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/KCModule/dialog"), this, QDBusConnection::ExportScriptableSlots);
connect(this, &KCMShellMultiDialog::currentPageChanged,
this, [this](KPageWidgetItem *newPage,KPageWidgetItem *oldPage) {
Q_UNUSED(oldPage);
KCModuleProxy *activeModule = newPage->widget()->findChild<KCModuleProxy *>();
if (activeModule) {
KActivities::ResourceInstance::notifyAccessed(QUrl("kcm:" + activeModule->moduleInfo().service()->storageId()),
"org.kde.systemsettings");
KActivities::ResourceInstance::notifyAccessed(QUrl(QStringLiteral("kcm:") + activeModule->moduleInfo().service()->storageId()),
QStringLiteral("org.kde.systemsettings"));
}
});
}
......@@ -187,18 +187,18 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
KAboutData aboutData("kcmshell5", i18n("System Settings Module"),
PROJECT_VERSION,
KAboutData aboutData(QStringLiteral("kcmshell5"), i18n("System Settings Module"),
QLatin1String(PROJECT_VERSION),
i18n("A tool to start single system settings modules"),
KAboutLicense::GPL,
i18n("(c) 1999-2016, The KDE Developers"));
aboutData.addAuthor(i18n("Frans Englich"), i18n("Maintainer"), "frans.englich@kde.org");
aboutData.addAuthor(i18n("Daniel Molkentin"), QString(), "molkentin@kde.org");
aboutData.addAuthor(i18n("Matthias Hoelzer-Kluepfel"),QString(), "hoelzer@kde.org");
aboutData.addAuthor(i18n("Matthias Elter"),QString(), "elter@kde.org");
aboutData.addAuthor(i18n("Matthias Ettrich"),QString(), "ettrich@kde.org");
aboutData.addAuthor(i18n("Waldo Bastian"),QString(), "bastian@kde.org");
aboutData.addAuthor(i18n("Frans Englich"), i18n("Maintainer"), QStringLiteral("frans.englich@kde.org"));
aboutData.addAuthor(i18n("Daniel Molkentin"), QString(), QStringLiteral("molkentin@kde.org"));
aboutData.addAuthor(i18n("Matthias Hoelzer-Kluepfel"),QString(), QStringLiteral("hoelzer@kde.org"));
aboutData.addAuthor(i18n("Matthias Elter"),QString(), QStringLiteral("elter@kde.org"));
aboutData.addAuthor(i18n("Matthias Ettrich"),QString(), QStringLiteral("ettrich@kde.org"));
aboutData.addAuthor(i18n("Waldo Bastian"),QString(), QStringLiteral("bastian@kde.org"));
KAboutData::setApplicationData(aboutData);
QCommandLineParser parser;
......@@ -217,12 +217,12 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
parser.process(app);
const QString lang = parser.value("lang");
const QString lang = parser.value(QStringLiteral("lang"));
if (!lang.isEmpty()) {
cout << i18n("--lang is deprecated. Please set the LANGUAGE environment variable instead").toLocal8Bit().data() << endl;
}
if (parser.isSet("list")) {
if (parser.isSet(QStringLiteral("list"))) {
cout << i18n("The following modules are available:").toLocal8Bit().data() << endl;
listModules();
......@@ -236,9 +236,9 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
}
for (KService::List::ConstIterator it = m_modules.constBegin(); it != m_modules.constEnd(); ++it) {
QString entry("%1 - %2");
QString entry(QStringLiteral("%1 - %2"));
entry = entry.arg((*it)->desktopEntryName().leftJustified(maxLen, ' '))
entry = entry.arg((*it)->desktopEntryName().leftJustified(maxLen, QLatin1Char(' ')))
.arg(!(*it)->comment().isEmpty() ? (*it)->comment()
: i18n("No description available"));
......@@ -258,16 +258,16 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
const QString arg = parser.positionalArguments().at(i);
KService::Ptr service = locateModule(arg);
if (!service) {
service = locateModule("kcm_" + arg);
service = locateModule(QStringLiteral("kcm_") + arg);
}
if (!service) {
service = locateModule("kcm" + arg);
service = locateModule(QStringLiteral("kcm") + arg);
}
if (service) {
modules.append(service);
if (!serviceName.isEmpty()) {
serviceName += '_';
serviceName += QLatin1Char('_');
}
serviceName += arg;
} else {
......@@ -291,13 +291,13 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
}
QStringList moduleArgs;
const QString x = parser.value("args");
moduleArgs << x.split(QRegExp(" +"));
const QString x = parser.value(QStringLiteral("args"));
moduleArgs << x.split(QRegExp(QStringLiteral(" +")));
KCMShellMultiDialog *dlg = new KCMShellMultiDialog(ftype);
dlg->setAttribute(Qt::WA_DeleteOnClose);
if (parser.isSet("caption")) {
dlg->setWindowTitle(parser.value("caption"));
if (parser.isSet(QStringLiteral("caption"))) {
dlg->setWindowTitle(parser.value(QStringLiteral("caption")));
} else if (modules.count() == 1) {
dlg->setWindowTitle(modules.first()->name());
}
......@@ -306,9 +306,9 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
dlg->addModule(*it, nullptr, moduleArgs);
}
if (parser.isSet("icon")) {
dlg->setWindowIcon(QIcon::fromTheme(parser.value("icon")));
} else if (!parser.isSet("icon") && !modules.isEmpty()) {
if (parser.isSet(QStringLiteral("icon"))) {
dlg->setWindowIcon(QIcon::fromTheme(parser.value(QStringLiteral("icon"))));
} else if (!parser.isSet(QStringLiteral("icon")) && !modules.isEmpty()) {
const QString iconName = KCModuleInfo(modules.first()).icon();
dlg->setWindowIcon( QIcon::fromTheme(iconName) );
}
......
......@@ -99,15 +99,15 @@ int main(int argc, char *argv[])
KLocalizedString::setApplicationDomain("kdesu5");
KAboutData aboutData("kdesu", i18n("KDE su"),
Version, i18n("Runs a program with elevated privileges."),
KAboutData aboutData(QStringLiteral("kdesu"), i18n("KDE su"),
QLatin1String(Version), i18n("Runs a program with elevated privileges."),
KAboutLicense::Artistic,
i18n("Copyright (c) 1998-2000 Geert Jansen, Pietro Iglio"));
aboutData.addAuthor(i18n("Geert Jansen"), i18n("Maintainer"),
"jansen@kde.org", "http://www.stack.nl/~geertj/");
QStringLiteral("jansen@kde.org"), QStringLiteral("http://www.stack.nl/~geertj/"));
aboutData.addAuthor(i18n("Pietro Iglio"), i18n("Original author"),
"iglio@fub.it");
app.setWindowIcon(QIcon::fromTheme("dialog-password"));
QStringLiteral("iglio@fub.it"));
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("dialog-password")));
KAboutData::setApplicationData(aboutData);
......@@ -115,23 +115,23 @@ int main(int argc, char *argv[])
// at the beginning of main()
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.addPositionalArgument("command", i18n("Specifies the command to run as separate arguments"));
parser.addOption(QCommandLineOption("c", i18n("Specifies the command to run as one string"), "command"));
parser.addOption(QCommandLineOption("f", i18n("Run command under target uid if <file> is not writable"), "file"));
parser.addOption(QCommandLineOption("u", i18n("Specifies the target uid"), "user", duser));
parser.addOption(QCommandLineOption("n", i18n("Do not keep password")));
parser.addOption(QCommandLineOption("s", i18n("Stop the daemon (forgets all passwords)")));
parser.addOption(QCommandLineOption("t", i18n("Enable terminal output (no password keeping)")));
parser.addOption(QCommandLineOption("p", i18n("Set priority value: 0 <= prio <= 100, 0 is lowest"), "prio", "50"));
parser.addOption(QCommandLineOption("r", i18n("Use realtime scheduling")));
parser.addOption(QCommandLineOption("noignorebutton", i18n("Do not display ignore button")));
parser.addOption(QCommandLineOption("i", i18n("Specify icon to use in the password dialog"), "icon name"));
parser.addOption(QCommandLineOption("d", i18n("Do not show the command to be run in the dialog")));
parser.addPositionalArgument(QStringLiteral("command"), i18n("Specifies the command to run as separate arguments"));
parser.addOption(QCommandLineOption(QStringLiteral("c"), i18n("Specifies the command to run as one string"), QStringLiteral("command")));
parser.addOption(QCommandLineOption(QStringLiteral("f"), i18n("Run command under target uid if <file> is not writable"), QStringLiteral("file")));
parser.addOption(QCommandLineOption(QStringLiteral("u"), i18n("Specifies the target uid"), QStringLiteral("user"), QString::fromLatin1(duser)));
parser.addOption(QCommandLineOption(QStringLiteral("n"), i18n("Do not keep password")));
parser.addOption(QCommandLineOption(QStringLiteral("s"), i18n("Stop the daemon (forgets all passwords)")));
parser.addOption(QCommandLineOption(QStringLiteral("t"), i18n("Enable terminal output (no password keeping)")));
parser.addOption(QCommandLineOption(QStringLiteral("p"), i18n("Set priority value: 0 <= prio <= 100, 0 is lowest"), QStringLiteral("prio"), QStringLiteral("50")));
parser.addOption(QCommandLineOption(QStringLiteral("r"), i18n("Use realtime scheduling")));
parser.addOption(QCommandLineOption(QStringLiteral("noignorebutton"), i18n("Do not display ignore button")));
parser.addOption(QCommandLineOption(QStringLiteral("i"), i18n("Specify icon to use in the password dialog"), QStringLiteral("icon name")));
parser.addOption(QCommandLineOption(QStringLiteral("d"), i18n("Do not show the command to be run in the dialog")));
#ifdef HAVE_X11
/* KDialog originally used --embed for attaching the dialog box. However this is misleading and so we changed to --attach.
* For consistancy, we silently map --embed to --attach */
parser.addOption(QCommandLineOption("attach", i18nc("Transient means that the kdesu app will be attached to the app specified by the winid so that it is like a dialog box rather than some separate program", "Makes the dialog transient for an X app specified by winid"), "winid"));
parser.addOption(QCommandLineOption("embed", i18n("Embed into a window"), "winid"));
parser.addOption(QCommandLineOption(QStringLiteral("attach"), i18nc("Transient means that the kdesu app will be attached to the app specified by the winid so that it is like a dialog box rather than some separate program", "Makes the dialog transient for an X app specified by winid"), QStringLiteral("winid")));
parser.addOption(QCommandLineOption(QStringLiteral("embed"), i18n("Embed into a window"), QStringLiteral("winid")));
#endif
//KApplication::disableAutoDcopRegistration();
......@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
static int startApp(QCommandLineParser& p)
{
// Stop daemon and exit?
if (p.isSet("s"))
if (p.isSet(QStringLiteral("s")))
{
KDEsuClient client;
if (client.ping() == -1)
......@@ -188,15 +188,15 @@ static int startApp(QCommandLineParser& p)
}
QString icon;
if ( p.isSet("i"))
icon = p.value("i");
if ( p.isSet(QStringLiteral("i")))
icon = p.value(QStringLiteral("i"));
bool prompt = true;
if ( p.isSet("d"))
if ( p.isSet(QStringLiteral("d")))
prompt = false;
// Get target uid
QByteArray user = p.value("u").toLocal8Bit();
QByteArray user = p.value(QStringLiteral("u")).toLocal8Bit();
QByteArray auth_user = user;
struct passwd *pw = getpwnam(user);
if (pw == nullptr)
......@@ -214,10 +214,10 @@ static int startApp(QCommandLineParser& p)
}
// If file is writeable, do not change uid
QString file = p.value("f");
QString file = p.value(QStringLiteral("f"));
if (other_uid && !file.isEmpty())
{
if (file.startsWith('/'))
if (file.startsWith(QLatin1Char('/')))
{
file = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, file);
if (file.isEmpty())
......@@ -236,7 +236,7 @@ static int startApp(QCommandLineParser& p)
}
// Get priority/scheduler
QString tmp = p.value("p");
QString tmp = p.value(QStringLiteral("p"));
bool ok;
int priority = tmp.toInt(&ok);
if (!ok || (priority < 0) || (priority > 100))
......@@ -245,7 +245,7 @@ static int startApp(QCommandLineParser& p)
p.showHelp(1);
}
int scheduler = SuProcess::SchedNormal;
if (p.isSet("r"))
if (p.isSet(QStringLiteral("r")))
scheduler = SuProcess::SchedRealtime;
if ((priority > 50) || (scheduler != SuProcess::SchedNormal))
{
......@@ -254,9 +254,9 @@ static int startApp(QCommandLineParser& p)
}
// Get command
if (p.isSet("c"))
if (p.isSet(QStringLiteral("c")))
{
command = p.value("c").toLocal8Bit();
command = p.value(QStringLiteral("c")).toLocal8Bit();
// Accepting additional arguments here is somewhat weird,
// but one can conceive use cases: have a complex command with
// redirections and additional file names which need to be quoted
......@@ -304,20 +304,20 @@ static int startApp(QCommandLineParser& p)
}
// Try to exec the command with kdesud.
bool keep = !p.isSet("n") && have_daemon;
bool terminal = p.isSet("t");
bool withIgnoreButton = !p.isSet("noignorebutton");
bool keep = !p.isSet(QStringLiteral("n")) && have_daemon;
bool terminal = p.isSet(QStringLiteral("t"));
bool withIgnoreButton = !p.isSet(QStringLiteral("noignorebutton"));
int winid = -1;
bool attach = p.isSet("attach");
bool attach = p.isSet(QStringLiteral("attach"));
if(attach) {
winid = p.value("attach").toInt(&attach, 0); //C style parsing. If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
winid = p.value(QStringLiteral("attach")).toInt(&attach, 0); //C style parsing. If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
if(!attach)
qCWarning(category) << "Specified winid to attach to is not a valid number";
} else if(p.isSet("embed")) {
} else if(p.isSet(QStringLiteral("embed"))) {
/* KDialog originally used --embed for attaching the dialog box. However this is misleading and so we changed to --attach.
* For consistancy, we silently map --embed to --attach */
attach = true;
winid = p.value("embed").toInt(&attach, 0); //C style parsing. If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
winid = p.value(QStringLiteral("embed")).toInt(&attach, 0); //C style parsing. If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
if(!attach)
qCWarning(category) << "Specified winid to attach to is not a valid number";
}
......@@ -416,7 +416,7 @@ static int startApp(QCommandLineParser& p)
QString prio;
if (scheduler == SuProcess::SchedRealtime)
prio += i18n("realtime: ");
prio += QString("%1/100").arg(priority);
prio += QStringLiteral("%1/100").arg(priority);
if (prompt)
dlg.addCommentLine(i18n("Priority:"), prio);
}
......
......@@ -35,22 +35,22 @@ KDEsuDialog::KDEsuDialog(QByteArray user, QByteArray authUser, bool enableKeep,
} else {
if (authUser == "root") {
if(withIgnoreButton)
prompt = "<qt>" + i18n("The action you requested needs <b>root privileges</b>. "
prompt = QStringLiteral("<qt>") + i18n("The action you requested needs <b>root privileges</b>. "
"Please enter <b>root's</b> password below or click "
"Ignore to continue with your current privileges.") + "</qt>";
"Ignore to continue with your current privileges.") + QStringLiteral("</qt>");
else
prompt = "<qt>" + i18n("The action you requested needs <b>root privileges</b>. "
"Please enter <b>root's</b> password below.") + "</qt>";
prompt = QStringLiteral("<qt>") + i18n("The action you requested needs <b>root privileges</b>. "
"Please enter <b>root's</b> password below.") + QStringLiteral("</qt>");
} else {
if(withIgnoreButton)
prompt = "<qt>" + i18n("The action you requested needs additional privileges. "
prompt = QStringLiteral("<qt>") + i18n("The action you requested needs additional privileges. "
"Please enter the password for <b>%1</b> below or click "
"Ignore to continue with your current privileges.", QString::fromLatin1(authUser)) +
"</qt>";
QStringLiteral("</qt>");
else
prompt = "<qt>" + i18n("The action you requested needs additional privileges. "
prompt = QStringLiteral("<qt>") + i18n("The action you requested needs additional privileges. "
"Please enter the password for <b>%1</b> below.", QString::fromLatin1(authUser)) +
"</qt>";
QStringLiteral("</qt>");
}
}
......
......@@ -96,7 +96,7 @@ FileTypeDetails::FileTypeDetails( QWidget * parent )
hBox->addLayout(vbox);
addExtButton = new QPushButton(i18n("Add..."), gb);
addExtButton->setIcon(QIcon::fromTheme("list-add"));
addExtButton->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
addExtButton->setEnabled(false);
connect(addExtButton, SIGNAL(clicked()),
this, SLOT(addExtension()));
......@@ -104,7 +104,7 @@ FileTypeDetails::FileTypeDetails( QWidget * parent )
addExtButton->setWhatsThis( i18n("Add a new pattern for the selected file type.") );
removeExtButton = new QPushButton(i18n("Remove"), gb);
removeExtButton->setIcon(QIcon::fromTheme("list-remove"));
removeExtButton->setIcon(QIcon::fromTheme(QStringLiteral("list-remove")));
removeExtButton->setEnabled(false);
connect(removeExtButton, SIGNAL(clicked()),
this, SLOT(removeExtension()));
......@@ -145,7 +145,7 @@ FileTypeDetails::FileTypeDetails( QWidget * parent )
QRadioButton *embViewerRadio = new QRadioButton( i18n("Show file in embedded viewer") );
QRadioButton *sepViewerRadio = new QRadioButton( i18n("Show file in separate viewer") );
m_rbGroupSettings = new QRadioButton( QString("Use settings for '%1' group") );
m_rbGroupSettings = new QRadioButton( QStringLiteral("Use settings for '%1' group") );
m_chkAskSave = new QCheckBox( i18n("Ask whether to save to disk instead (only for Konqueror browser)") );
connect(m_chkAskSave, SIGNAL( toggled(bool) ), SLOT( slotAskSaveToggled(bool) ));
......@@ -214,7 +214,7 @@ void FileTypeDetails::addExtension()
bool ok;
QString ext = QInputDialog::getText(this,
i18n( "Add New Extension" ), i18n( "Extension:" ),
QLineEdit::Normal, "*.", &ok);
QLineEdit::Normal, QStringLiteral("*."), &ok);
if (ok) {
extensionLB->addItem(ext);
QStringList patt = m_mimeTypeData->patterns();
......@@ -267,11 +267,11 @@ void FileTypeDetails::updateAskSave()
QString dontAskAgainName;
if (autoEmbed == MimeTypeData::Yes) // Embedded
dontAskAgainName = "askEmbedOrSave"+mimeType;
dontAskAgainName = QStringLiteral("askEmbedOrSave")+mimeType;
else
dontAskAgainName = "askSave"+mimeType;
dontAskAgainName = QStringLiteral("askSave")+mimeType;
KSharedConfig::Ptr config = KSharedConfig::openConfig("filetypesrc", KConfig::NoGlobals);
KSharedConfig::Ptr config = KSharedConfig::openConfig(QStringLiteral("filetypesrc"), KConfig::NoGlobals);
// default value
bool ask = config->group("Notification Messages").readEntry(dontAskAgainName, QString()).isEmpty();
// per-mimetype override if there's one
......
......@@ -49,13 +49,12 @@
K_PLUGIN_FACTORY(FileTypesViewFactory, registerPlugin<FileTypesView>();)
K_EXPORT_PLUGIN(FileTypesViewFactory("filetypes"))
FileTypesView::FileTypesView(QWidget *parent, const QVariantList &)
: KCModule(/*FileTypesViewFactory::aboutData(),*/ parent)
: KCModule(parent)
{
m_fileTypesConfig = KSharedConfig::openConfig("filetypesrc", KConfig::NoGlobals);
m_fileTypesConfig = KSharedConfig::openConfig(QStringLiteral("filetypesrc"), KConfig::NoGlobals);
setQuickHelp( i18n("<p><h1>File Associations</h1>"
" This module allows you to choose which applications are associated"
......@@ -118,14 +117,14 @@ FileTypesView::FileTypesView(QWidget *parent, const QVariantList &)
leftLayout->addLayout(btnsLay);
btnsLay->addStretch(1);
QPushButton *addTypeB = new QPushButton(i18n("Add..."), this);
addTypeB->setIcon(QIcon::fromTheme("list-add"));
addTypeB->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
connect(addTypeB, SIGNAL(clicked()), SLOT(addType()));
btnsLay->addWidget(addTypeB);
addTypeB->setWhatsThis( i18n("Click here to add a new file type.") );
m_removeTypeB = new QPushButton(i18n("&Remove"), this);
m_removeTypeB->setIcon(QIcon::fromTheme("list-remove"));
m_removeTypeB->setIcon(QIcon::fromTheme(QStringLiteral("list-remove")));
connect(m_removeTypeB, SIGNAL(clicked()), SLOT(removeType()));
btnsLay->addWidget(m_removeTypeB);
m_removeTypeB->setEnabled(false);
......@@ -186,11 +185,11 @@ void FileTypesView::readFileTypes()
QMimeDatabase db;
QList<QMimeType> mimetypes = db.allMimeTypes();
qSort(mimetypes.begin(), mimetypes.end(), mimeTypeLessThan);
std::sort(mimetypes.begin(), mimetypes.end(), mimeTypeLessThan);
auto it2(mimetypes.constBegin());
for (; it2 != mimetypes.constEnd(); ++it2) {
const QString mimetype = (*it2).name();
const int index = mimetype.indexOf('/');
const int index = mimetype.indexOf(QLatin1Char('/'));
const QString maj = mimetype.left(index);
const QString min = mimetype.right(mimetype.length() - index+1);
......@@ -244,7 +243,7 @@ void FileTypesView::addType()
NewTypeDialog dialog(allGroups, this);
if (dialog.exec()) {
const QString newMimeType = dialog.group() + '/' + dialog.text();
const QString newMimeType = dialog.group() + QLatin1Char('/') + dialog.text();
QTreeWidgetItemIterator it(typesLV);
......@@ -367,7 +366,7 @@ void FileTypesView::updateRemoveButton(TypesListItem* tlitem)
canRemove = true;
// Is there a global definition for it?
const QStringList mimeFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/") + mimeType + ".xml" );
const QStringList mimeFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/") + mimeType + QStringLiteral(".xml") );
qDebug() << mimeFiles;
if (mimeFiles.count() >= 2 /*a local and a global*/) {
m_removeButtonSaysRevert = true;
......@@ -449,7 +448,7 @@ void FileTypesView::save()
// TODO: the same for dolphin. Or we should probably define a global signal for this.
// Or a KGlobalSettings thing.
QDBusMessage message =
QDBusMessage::createSignal("/KonqMain", "org.kde.Konqueror.Main", "reparseConfiguration");
QDBusMessage::createSignal(QStringLiteral("/KonqMain"), QStringLiteral("org.kde.Konqueror.Main"), QStringLiteral("reparseConfiguration"));
QDBusConnection::sessionBus().send(message);
}
......@@ -471,8 +470,8 @@ void FileTypesView::load()
void FileTypesView::slotDatabaseChanged(const QStringList& changedResources)
{
qDebug() << changedResources;
if ( changedResources.contains("xdgdata-mime") // changes in mimetype definitions
|| changedResources.contains("services") ) { // changes in .desktop files
if ( changedResources.contains(QStringLiteral("xdgdata-mime")) // changes in mimetype definitions
|| changedResources.contains(QStringLiteral("services")) ) { // changes in .desktop files
m_details->refresh();
......
......@@ -98,7 +98,7 @@ void FileTypeDialog::save()
KBuildSycocaProgressDialog::rebuildKSycoca(this);
// Trigger reparseConfiguration of filetypesrc in konqueror
QDBusMessage message =
QDBusMessage::createSignal("/KonqMain", "org.kde.Konqueror.Main", "reparseConfiguration");
QDBusMessage::createSignal(QStringLiteral("/KonqMain"), QStringLiteral("org.kde.Konqueror.Main"), QStringLiteral("reparseConfiguration"));
QDBusConnection::sessionBus().send(message);
}
}
......@@ -118,8 +118,8 @@ void FileTypeDialog::clientChanged(bool state)
void FileTypeDialog::slotDatabaseChanged(const QStringList& changedResources)
{
qDebug() << changedResources;
if ( changedResources.contains("xdgdata-mime") // changes in mimetype definitions
|| changedResources.contains("services") ) { // changes in .desktop files
if ( changedResources.contains(QStringLiteral("xdgdata-mime")) // changes in mimetype definitions
|| changedResources.contains(QStringLiteral("services")) ) { // changes in .desktop files
m_details->refresh();
}
}
......@@ -129,20 +129,20 @@ int main(int argc, char ** argv)
{
QApplication app(argc, argv);
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
QApplication::setWindowIcon(QIcon::fromTheme("preferences-desktop-filetype-association"));
QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-filetype-association")));
KAboutData aboutData( "keditfiletype", i18n("File Type Editor"), PROJECT_VERSION,
KAboutData aboutData( QStringLiteral("keditfiletype"), i18n("File Type Editor"), QLatin1String(PROJECT_VERSION),
i18n("KDE file type editor - simplified version for editing a single file type"),
KAboutLicense::GPL,
i18n("(c) 2000, KDE developers") );
aboutData.addAuthor(i18n("Preston Brown"), QString(), "pbrown@kde.org");
aboutData.addAuthor(i18n("David Faure"), QString(), "faure@kde.org");
aboutData.addAuthor(i18n("Preston Brown"), QString(), QStringLiteral("pbrown@kde.org"));
aboutData.addAuthor(i18n("David Faure"), QString(), QStringLiteral("faure@kde.org"));
KAboutData::setApplicationData(aboutData);
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.addOption(QCommandLineOption(QStringList() << "parent", i18n("Makes the dialog transient for the window specified by winid"), "winid"));
parser.addPositionalArgument("mimetype", i18n("File type to edit (e.g. text/html)"));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("parent"), i18n("Makes the dialog transient for the window specified by winid"), QStringLiteral("winid")));
parser.addPositionalArgument(QStringLiteral("mimetype"), i18n("File type to edit (e.g. text/html)"));
parser.process(app);
aboutData.processCommandLine(&parser);
......@@ -153,9 +153,9 @@ int main(int argc, char ** argv)
QMimeDatabase db;
QString arg = parser.positionalArguments().first();
MimeTypeData* mimeTypeData = nullptr;
const bool createType = arg.startsWith('*');
const bool createType = arg.startsWith(QLatin1Char('*'));
if ( createType ) {
QString mimeString = "application/x-kdeuser%1";
QString mimeString = QStringLiteral("application/x-kdeuser%1");
QString mimeTypeName;
int inc = 0;
bool ok = false;
......@@ -190,9 +190,9 @@ int main(int argc, char ** argv)
}
FileTypeDialog dlg( mimeTypeData );
if( parser.isSet( "parent" )) {
if( parser.isSet( QStringLiteral("parent") )) {
bool ok;
long id = parser.value("parent").toLong(&ok);
long id = parser.value(QStringLiteral("parent")).toLong(&ok);
if (ok)
KWindowSystem::setMainWindow( &dlg, (WId)id );
}
......
......@@ -89,7 +89,7 @@ KServiceListWidget::KServiceListWidget(int kind, QWidget *parent)
lay->addLayout(btnsLay);
servUpButton = new QPushButton(i18n("Move &Up"), this);
servUpButton->setIcon(QIcon::fromTheme("arrow-up"));
servUpButton->setIcon(QIcon::fromTheme(QStringLiteral("arrow-up")));
servUpButton->setEnabled(false);
connect(servUpButton, SIGNAL(clicked()), SLOT(promoteService()));
btnsLay->addWidget(servUpButton);
......@@ -103,7 +103,7 @@ KServiceListWidget::KServiceListWidget(int kind, QWidget *parent)
"service, moving it up in the list."));
servDownButton = new QPushButton(i18n("Move &Down"), this);
servDownButton->setIcon(QIcon::fromTheme("arrow-down"));
servDownButton->setIcon(QIcon::fromTheme(QStringLiteral("arrow-down")));
servDownButton->setEnabled(false);
connect(servDownButton, SIGNAL(clicked()), SLOT(demoteService()));
btnsLay->addWidget(servDownButton);
......@@ -116,7 +116,7 @@ KServiceListWidget::KServiceListWidget(int kind, QWidget *parent)
"service, moving it down in the list."));
servNewButton = new QPushButton(i18n("Add..."), this);
servNewButton->setIcon(QIcon::fromTheme("list-add"));
servNewButton->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
servNewButton->setEnabled(false);
connect(servNewButton, SIGNAL(clicked()), SLOT(addService()));
btnsLay->addWidget(servNewButton);
......@@ -124,7 +124,7 @@ KServiceListWidget::KServiceListWidget(int kind, QWidget *parent)
servEditButton = new QPushButton(i18n("Edit..."), this);
servEditButton->setIcon(QIcon::fromTheme("edit-rename"));
servEditButton->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
servEditButton->setEnabled(false);
connect(servEditButton, SIGNAL(clicked()), SLOT(editService()));
btnsLay->addWidget(servEditButton);
......@@ -132,7 +132,7 @@ KServiceListWidget::KServiceListWidget(int kind, QWidget *parent)
servRemoveButton = new QPushButton(i18n("Remove"), this);
servRemoveButton->setIcon(QIcon::fromTheme("list-remove"));
servRemoveButton->setIcon(QIcon::fromTheme(QStringLiteral("list-remove")));
servRemoveButton->setEnabled(false);
connect(servRemoveButton, SIGNAL(clicked()), SLOT(removeService()));
btnsLay->addWidget(servRemoveButton);
......@@ -310,7 +310,7 @@ void KServiceListWidget::editService()
}
}
KFileItem item(QUrl::fromLocalFile(path), "application/x-desktop", KFileItem::Unknown);
KFileItem item(QUrl::fromLocalFile(path), QStringLiteral("application/x-desktop"), KFileItem::Unknown);
KPropertiesDialog dlg(item, this);
if (dlg.exec() != QDialog::Accepted)
return;
......
......@@ -45,7 +45,7 @@ KServiceSelectDlg::KServiceSelectDlg( const QString& /*serviceType*/, const QStr
const KService::List allServices = KService::allServices();
KService::List::const_iterator it(allServices.constBegin());
for ( ; it != allServices.constEnd() ; ++it )
if ( (*it)->hasServiceType( "KParts/ReadOnlyPart" ) )
if ( (*it)->hasServiceType( QStringLiteral("KParts/ReadOnlyPart") ) )
{
m_listbox->addItem( new KServiceListItem( (*it), KServiceListWidget::SERVICELIST_SERVICES ) );
}
......
......@@ -54,7 +54,7 @@ MimeTypeData::MimeTypeData(const QMimeType& mime)