Commit fda6d411 authored by Alexander Lohnau's avatar Alexander Lohnau 💬

Fix a bunch of clazy warnings

Should be uncontroversial and compile time checked.
parent 43dd5dad
......@@ -40,7 +40,7 @@ SystemMonitor::SystemMonitor(QObject *parent, const QVariantList &args)
//Don't set the preset right now as we can't write on the config here because we don't have a Corona yet
if (args.count() > 2 && args.mid(3).length() > 0) {
const QString preset = args.mid(3).first().toString();
const QString preset = args.mid(3).constFirst().toString();
if (preset.length() > 0) {
m_pendingStartupPreset = preset;
}
......
......@@ -275,7 +275,7 @@ void InteractiveConsole::loadScript(const QString &script)
void InteractiveConsole::showEvent(QShowEvent *)
{
if (m_editorPart) {
m_editorPart->views().first()->setFocus();
m_editorPart->views().constFirst()->setFocus();
} else {
m_editor->setFocus();
}
......@@ -336,7 +336,7 @@ void InteractiveConsole::openScriptUrlSelected(int result)
}
if (result == QDialog::Accepted) {
const QUrl url = m_fileDialog->selectedUrls().first();
const QUrl url = m_fileDialog->selectedUrls().constFirst();
if (!url.isEmpty()) {
loadScriptFromUrl(url);
}
......@@ -452,7 +452,7 @@ void InteractiveConsole::saveScriptUrlSelected(int result)
}
if (result == QDialog::Accepted) {
const QUrl url = m_fileDialog->selectedUrls().first();
const QUrl url = m_fileDialog->selectedUrls().constFirst();
if (!url.isEmpty()) {
saveScript(url);
}
......@@ -551,7 +551,7 @@ void InteractiveConsole::evaluateScript()
if (reply.type() == QDBusMessage::ErrorMessage) {
print(reply.errorMessage());
} else {
const int id = reply.arguments().first().toInt();
const int id = reply.arguments().constFirst().toInt();
QDBusConnection::sessionBus().connect(s_kwinService, "/" + QString::number(id), QString(), QStringLiteral("print"), this, SLOT(print(QString)));
QDBusConnection::sessionBus().connect(s_kwinService, "/" + QString::number(id), QString(), QStringLiteral("printError"), this, SLOT(print(QString)));
message = QDBusMessage::createMethodCall(s_kwinService, "/" + QString::number(id), QString(), QStringLiteral("run"));
......
......@@ -112,7 +112,7 @@ QString PlasmaAppletItem::author() const
return QString();
}
return m_info.authors().first().name();
return m_info.authors().constFirst().name();
}
QString PlasmaAppletItem::email() const
......@@ -121,7 +121,7 @@ QString PlasmaAppletItem::email() const
return QString();
}
return m_info.authors().first().emailAddress();
return m_info.authors().constFirst().emailAddress();
}
int PlasmaAppletItem::running() const
......
......@@ -209,7 +209,6 @@ void CursorThemeConfig::updateSizeComboBox()
if (selected.isValid()) {
const CursorTheme *theme = m_themeProxyModel->theme(selected);
const QList<int> sizes = theme->availableSizes();
QIcon m_icon;
// only refill the combobox if there is more that 1 size
if (sizes.size() > 1) {
int i;
......@@ -384,8 +383,6 @@ void CursorThemeConfig::load()
{
ManagedConfigModule::load();
setPreferredSize(cursorThemeSettings()->cursorSize());
// Get the name of the theme KDE is configured to use
QString currentTheme = cursorThemeSettings()->cursorTheme();
// Disable the listview and the buttons if we're in kiosk mode
if (cursorThemeSettings()->isImmutable( QStringLiteral( "cursorTheme" ))) {
......
......@@ -67,7 +67,6 @@ class FontAASettingsStore : public QObject
public:
FontAASettingsStore(FontsAASettings *parent = nullptr)
: QObject(parent)
, m_settings(parent)
{
load();
}
......@@ -243,7 +242,6 @@ public:
}
private:
FontsAASettings *m_settings;
bool m_isImmutable;
bool m_antiAliasing;
bool m_antiAliasingChanged;
......
......@@ -648,7 +648,6 @@ void KXftConfig::readContents()
while (en.isComment()) {
en = en.nextSibling();
}
QString family;
double from = -1.0,
to = -1.0,
pixelFrom = -1.0,
......
......@@ -387,7 +387,6 @@ QString getFcString(FcPattern *pat, const char *val, int index)
// ...so if possible, use that. Else, use the first non "xx" lang.
QString getFcLangString(FcPattern *pat, const char *val, const char *valLang)
{
QString rv;
int langIndex=-1;
for(int i=0; true; ++i)
......
......@@ -568,6 +568,9 @@ void cleanupXImage(void *data)
QImage CFcEngine::Xft::toImage(int w, int h) const
{
Q_UNUSED(w)
Q_UNUSED(h)
if (!XftDrawPicture(itsDraw)) {
return QImage();
}
......
......@@ -419,8 +419,7 @@ QMap<QString, QString> getFontFileMap(const QSet<QString> &files)
{
QVector<QString> orig(fIt.value().count()),
modified(fIt.value().count());
QSet<QString>::ConstIterator oIt(fIt.value().constBegin()),
oEnd(fIt.value().constEnd());
QSet<QString>::ConstIterator oIt(fIt.value().constBegin());
bool good=true;
int count=fIt.value().count();
......
......@@ -71,7 +71,7 @@ int main(int argc, char **argv)
}
if (parser.isSet(_list)) {
QList<KPluginMetaData> pkgs = KPackage::PackageLoader::self()->listPackages("Plasma/LookAndFeel");
const QList<KPluginMetaData> pkgs = KPackage::PackageLoader::self()->listPackages("Plasma/LookAndFeel");
for (const KPluginMetaData &data : pkgs) {
std::cout << data.pluginId().toStdString() << std::endl;
......
......@@ -590,7 +590,7 @@ extern "C" int _IceTransNoListen(const char * protocol);
#endif
KSMServer::KSMServer(InitFlags flags)
: sessionGroup( QStringLiteral( "" ) )
: sessionGroup(QLatin1String(""))
, m_kwinInterface(new OrgKdeKWinSessionInterface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Session"), QDBusConnection::sessionBus(), this))
, sockets{ -1, -1 }
{
......@@ -847,7 +847,7 @@ QString KSMServer::currentSession()
{
if ( sessionGroup.startsWith( QLatin1String( "Session: " ) ) )
return sessionGroup.mid( 9 );
return QStringLiteral( "" ); // empty, not null, since used for KConfig::setGroup // TODO does this comment make any sense?
return QLatin1String(""); // empty, not null, since used for KConfig::setGroup // TODO does this comment make any sense?
}
void KSMServer::discardSession()
......
......@@ -164,7 +164,6 @@ void KSMShutdownDlg::init()
rootContext()->setContextProperty(QStringLiteral("screenGeometry"), screen()->geometry());
QString fileName;
QString fileUrl;
KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"));
KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE");
const QString packageName = cg.readEntry("LookAndFeelPackage", QString());
......
......@@ -54,7 +54,7 @@ Chrome::Chrome( FindProfile* findProfile, QObject* parent )
m_profileBookmarks << new ProfileBookmarks(profile);
m_watcher->addFile(profile.path());
}
connect(m_watcher, &KDirWatch::created, [=] { m_dirty = true; });
connect(m_watcher, &KDirWatch::created, this, [this] { m_dirty = true; });
}
Chrome::~Chrome()
......
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