Since I had some time I patched some of the minor krazy2 issues in
kdeplasma-addons. Mostly the QLatin1String and double-quote issues.
I attached the patch to this mail so feel free to look over it and if its
Ok, please commit it since I am not able to do so...
---
Regards
Philipp Klaffert
Index: applets/lancelot/app/src/parts/LancelotPart.cpp
===================================================================
--- applets/lancelot/app/src/parts/LancelotPart.cpp (Revision 911885)
+++ applets/lancelot/app/src/parts/LancelotPart.cpp (Arbeitskopie)
@@ -342,7 +342,7 @@
} else if (modelID == "FavoriteApplications") {
// We don't want to delete this one (singleton)
m_model->addModel(modelID, QIcon(), i18n("Favorite Applications"), model = Models::FavoriteApplications::instance());
- } else if (modelID.startsWith("Folder ")) {
+ } else if (modelID.startsWith(QLatin1String("Folder "))) {
modelID.remove(0, 7);
m_model->addModel(modelID,
QIcon(),
Index: applets/weatherstation/lcd.cpp
===================================================================
--- applets/weatherstation/lcd.cpp (Revision 911885)
+++ applets/weatherstation/lcd.cpp (Arbeitskopie)
@@ -192,7 +192,7 @@
QString id = element.attribute("id");
if ((pos = id.lastIndexOf(':')) > -1) {
groups[id.left(pos)] << id.mid(pos + 1);
- } else if (id.startsWith("label")) {
+ } else if (id.startsWith(QLatin1String("label"))) {
int i = id.mid(5).toInt();
QRegExp rx("fill:([#0-9]+)");
if (rx.indexIn(element.attribute("style")) > -1) {
Index: applets/twitter/twitter.cpp
===================================================================
--- applets/twitter/twitter.cpp (Revision 911885)
+++ applets/twitter/twitter.cpp (Arbeitskopie)
@@ -403,7 +403,7 @@
showTweets();
}
}
- } else if (source.startsWith("Error")) {
+ } else if (source.startsWith(QLatin1String("Error"))) {
QString desc = data["description"].toString();
if (desc == "Authentication required"){
Index: applets/luna/phases.cpp
===================================================================
--- applets/luna/phases.cpp (Revision 911885)
+++ applets/luna/phases.cpp (Arbeitskopie)
@@ -232,7 +232,7 @@
O = torad(O);
/* all those planetary arguments, too! */
- for (i=1; i<=14; i++)
+ for (i=1; i<=14; ++i)
A[i] = torad(A[i]);
/* ok, we have all the parameters, let's apply them to the JDE.
Index: libs/conversion/volume.cpp
===================================================================
--- libs/conversion/volume.cpp (Revision 911885)
+++ libs/conversion/volume.cpp (Arbeitskopie)
@@ -146,7 +146,7 @@
QString result = unit;
result.replace("/-3", "\xb3");
result.replace("^3", "\xb3");
- result.replace("3", "\xb3");
+ result.replace('3', "\xb3");
return result;
}
Index: libs/conversion/area.cpp
===================================================================
--- libs/conversion/area.cpp (Revision 911885)
+++ libs/conversion/area.cpp (Arbeitskopie)
@@ -104,7 +104,7 @@
QString result = unit;
result.replace("/-2", "\xb2");
result.replace("^2", "\xb2");
- result.replace("2", "\xb2");
+ result.replace('2', "\xb2");
return result;
}
Index: libs/conversion/value.cpp
===================================================================
--- libs/conversion/value.cpp (Revision 911885)
+++ libs/conversion/value.cpp (Arbeitskopie)
@@ -60,7 +60,7 @@
QString Value::toString() const
{
- return d->number.toString() + " " + d->unit;
+ return d->number.toString() + ' ' + d->unit;
}
QVariant Value::number() const
Index: libs/conversion/unit.cpp
===================================================================
--- libs/conversion/unit.cpp (Revision 911885)
+++ libs/conversion/unit.cpp (Arbeitskopie)
@@ -31,4 +31,5 @@
}
-#include "unit.moc"
\ No newline at end of file
+#include "unit.moc"
+
Index: runners/browserhistory/browserhistory.cpp
===================================================================
--- runners/browserhistory/browserhistory.cpp (Revision 911885)
+++ runners/browserhistory/browserhistory.cpp (Arbeitskopie)
@@ -68,7 +68,7 @@
foreach (const QString &historyitem, m_history) {
// Filter out error pages, and match ...
- if (!historyitem.startsWith("error:/") && historyitem.contains(term, Qt::CaseInsensitive)) {
+ if (!historyitem.startsWith(QLatin1String("error:/")) && historyitem.contains(term, Qt::CaseInsensitive)) {
Plasma::QueryMatch match(this);
match.setType(Plasma::QueryMatch::PossibleMatch);
match.setRelevance(0.5);
Index: runners/converter/converterrunner.cpp
===================================================================
--- runners/converter/converterrunner.cpp (Revision 911885)
+++ runners/converter/converterrunner.cpp (Arbeitskopie)
@@ -195,7 +195,7 @@
{
Q_UNUSED(context)
QString data = match.data().toString();
- if (data.startsWith("http://")) {
+ if (data.startsWith(QLatin1String("http://"))) {
KToolInvocation::invokeBrowser(data);
} else {
QApplication::clipboard()->setText(data);
Index: runners/katesessions/katesessions.h
===================================================================
--- runners/katesessions/katesessions.h (Revision 911885)
+++ runners/katesessions/katesessions.h (Arbeitskopie)
@@ -40,6 +40,7 @@
private:
KIcon m_icon;
QStringList m_sessions;
+ static const QString katePrefix;
};
K_EXPORT_PLASMA_RUNNER(katesessions, KateSessions)
Index: runners/katesessions/katesessions.cpp
===================================================================
--- runners/katesessions/katesessions.cpp (Revision 911885)
+++ runners/katesessions/katesessions.cpp (Arbeitskopie)
@@ -35,13 +35,15 @@
return KStringHandler::naturalCompare(s1,s2)==-1;
}
+const QString KateSessions::katePrefix("kate");
+
KateSessions::KateSessions(QObject *parent, const QVariantList& args)
: Plasma::AbstractRunner(parent, args)
{
Q_UNUSED(args);
KGlobal::locale()->insertCatalog("krunner_katesessions");
setObjectName("Kate Sessions");
- m_icon = KIcon("kate");
+ m_icon = KIcon(katePrefix);
loadSessions();
@@ -96,11 +98,11 @@
bool list_all = false;
- if (term.toLower().startsWith("kate")) {
- if (term.toLower().trimmed() == "kate") {
+ if (term.toLower().startsWith(katePrefix)) {
+ if (term.toLower().trimmed() == katePrefix) {
list_all = true;
}
- term.replace("kate", "", Qt::CaseInsensitive);
+ term.replace(katePrefix, "", Qt::CaseInsensitive);
term = term.trimmed();
}
@@ -143,7 +145,7 @@
if (!session.isEmpty()) {
QStringList args;
args << "--start" << session;
- KToolInvocation::kdeinitExec("kate", args);
+ KToolInvocation::kdeinitExec(katePrefix, args);
}
}
_______________________________________________
Plasma-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/plasma-devel