This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[Kourse 3] Fixing krazy2 issues

Tags: None
(comma "," separated)
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: [Kourse 3] Fixing krazy2 issues

Wed Jan 14, 2009 10:54 am
pklaffert wrote:some license and copyright issues left and these issues with explicit constructor.


You just have to write explicit before the constructor.

pklaffert wrote:i am not able to compile and test the changes since my workstation has not enough memory left to install the whole trunk version of kde

hope the changes are right anyway
Code: Select all
-            wildcards.replace( "*", "" );
+            wildcards.replace( '*', '' );



This gives an compile error because an empty char constant is not valid. You have to change it to
Code: Select all
wildcards.replace( '*', "" );


You could send this patch to the mailing list.[hr]
Pconfig wrote:Issues that still need fixing
  • Icons, don't know what to do with them. Krazy says something about reporting them to team oxygen


You should ignore this, because I saw there is for example KIcon("phrase") where phrase is an icon installed by the application. krazy cannot know that. You can suppress it with krazy comments

Pconfig wrote:Issues that need a review
  • The desktop files: Is it ok to make links of them?
  • the this->open()
[/i]


I do not know what you mean by making links of the desktop files.

this->open() should be fine. Does krazy complain about it?[hr]
fengshaun wrote:oh wow, I didn't know the svn diff trick. My krazy2 is still finding mistakes after hours =S How much is it supposed to take?


You are using krazy2 locally, aren't you? Perhaps you should start it in a subdirectory and not over all directories.[hr]
fengshaun wrote:solid/backends/fakehw/fakestorageaccess.h doesn't have any problems, which is weird. I see a proper include guard there, but EBN reports otherwise. So here is my patch for solid proper include problems (total = 8 problems)

Code: Select all
Index: solid/backends/hal/haldevice.cpp
===================================================================
--- solid/backends/hal/haldevice.cpp   (revision 910320)
+++ solid/backends/hal/haldevice.cpp   (working copy)
@@ -17,6 +17,8 @@
 
 */
 
+#include "haldevice.h"
+
 #include
 #include
 #include
@@ -26,7 +28,6 @@
 
 #include
 
-#include "haldevice.h"
 #include "haldeviceinterface.h"
 #include "halgenericinterface.h"
 #include "halprocessor.h"
Index: solid/backends/wmi/wmidevice.cpp
===================================================================
--- solid/backends/wmi/wmidevice.cpp   (revision 910320)
+++ solid/backends/wmi/wmidevice.cpp   (working copy)
@@ -17,11 +17,12 @@
 
 */
 
+#include "wmidevice.h"
+
 #include
 
 #include
 
-#include "wmidevice.h"
 #include "wmideviceinterface.h"
 #include "wmigenericinterface.h"
 #include "wmiprocessor.h"
Index: solid/backends/wmi/wmimanager.cpp
===================================================================
--- solid/backends/wmi/wmimanager.cpp   (revision 910320)
+++ solid/backends/wmi/wmimanager.cpp   (working copy)
@@ -17,9 +17,10 @@
 
 */
 
+#include "wmimanager.h"
+
 #include
 
-#include "wmimanager.h"
 #include "wmidevice.h"
 #include "wmideviceinterface.h"
 #include "wmiquery.h"
Index: examples/tutorial1/tutorial1.h
===================================================================
--- examples/tutorial1/tutorial1.h   (revision 910320)
+++ examples/tutorial1/tutorial1.h   (working copy)
@@ -16,3 +16,8 @@
     Boston, MA 02110-1301, USA.
 
 */
+
+#ifndef TUTORIAL1_H
+#define TUTORIAL1_H
+
+#endif
Index: examples/tutorial2/tutorial2.h
===================================================================
--- examples/tutorial2/tutorial2.h   (revision 910320)
+++ examples/tutorial2/tutorial2.h   (working copy)
@@ -17,3 +17,7 @@
 
 */
 
+#ifndef TUTORIAL2_H
+#define TUTORIAL2_H
+
+#endif // TUTORIAL2_H
Index: examples/tutorial3/tutorial3.h
===================================================================
--- examples/tutorial3/tutorial3.h   (revision 910320)
+++ examples/tutorial3/tutorial3.h   (working copy)
@@ -17,3 +17,7 @@
 
 */
 
+#ifndef TUTORIAL3_H
+#define TUTORIAL3_H
+
+#endif // TUTORIAL3_H
Index: examples/tutorial4/tutorial4.h
===================================================================
--- examples/tutorial4/tutorial4.h   (revision 910320)
+++ examples/tutorial4/tutorial4.h   (working copy)
@@ -17,3 +17,7 @@
 
 */
 
+#ifndef TUTORIAL4_H
+#define TUTORIAL4_H
+
+#endif // TUTORIAL4_h
Index: examples/tutorial5/tutorial5.h
===================================================================
--- examples/tutorial5/tutorial5.h   (revision 910320)
+++ examples/tutorial5/tutorial5.h   (working copy)
@@ -17,3 +17,7 @@
 
 */
 
+#ifndef TUTORIAL5_H
+#define TUTORIAL5_H
+
+#endif // TUTORIAL5_H
[hr]
And here is the patch for i18n problem (passing QString for startsWith() and endsWith())

Code: Select all
Index: solid/backends/hal/haldvbinterface.cpp
===================================================================
--- solid/backends/hal/haldvbinterface.cpp   (revision 910320)
+++ solid/backends/hal/haldvbinterface.cpp   (working copy)
@@ -52,7 +52,7 @@
         return -1;
     string = string.mid(pos + 1);
 
-    if (!string.startsWith("adapter"))
+    if (!string.startsWith(QString("adapter")))
         return -1;
     string = string.mid(7);
 
@@ -94,31 +94,31 @@
         return false;
     string = string.mid(pos + 1);
 
-    if (string.startsWith("audio")) {
+    if (string.startsWith(QString("audio"))) {
         *type = Solid::DvbInterface::DvbAudio;
         string = string.mid(5);
-    } else if (string.startsWith("ca")) {
+    } else if (string.startsWith(QString("ca"))) {
         *type = Solid::DvbInterface::DvbCa;
         string = string.mid(2);
-    } else if (string.startsWith("demux")) {
+    } else if (string.startsWith(QString("demux"))) {
         *type = Solid::DvbInterface::DvbDemux;
         string = string.mid(5);
-    } else if (string.startsWith("dvr")) {
+    } else if (string.startsWith(QString("dvr"))) {
         *type = Solid::DvbInterface::DvbDvr;
         string = string.mid(3);
-    } else if (string.startsWith("frontend")) {
+    } else if (string.startsWith(QString("frontend"))) {
         *type = Solid::DvbInterface::DvbFrontend;
         string = string.mid(8);
-    } else if (string.startsWith("net")) {
+    } else if (string.startsWith(QString("net"))) {
         *type = Solid::DvbInterface::DvbNet;
         string = string.mid(3);
-    } else if (string.startsWith("osd")) {
+    } else if (string.startsWith(QString("osd"))) {
         *type = Solid::DvbInterface::DvbOsd;
         string = string.mid(3);
-    } else if (string.startsWith("sec")) {
+    } else if (string.startsWith(QString("sec"))) {
         *type = Solid::DvbInterface::DvbSec;
         string = string.mid(3);
-    } else if (string.startsWith("video")) {
+    } else if (string.startsWith(QString("video"))) {
         *type = Solid::DvbInterface::DvbVideo;
         string = string.mid(5);
     } else
Index: solid/backends/hal/halvolume.cpp
===================================================================
--- solid/backends/hal/halvolume.cpp   (revision 910320)
+++ solid/backends/hal/halvolume.cpp   (working copy)
@@ -51,8 +51,8 @@
     bool hotpluggable = drive.property("storage.hotpluggable").toBool();
 
     return !removable && !hotpluggable
-        && mounted && !mount_point.startsWith("/media/")
-        && !mount_point.startsWith("/mnt/");
+        && mounted && !mount_point.startsWith(QString("/media/"))
+        && !mount_point.startsWith(QString("/mnt/"));
 }
 
 Solid::StorageVolume::UsageType Volume::usage() const
Index: solid/backends/wmi/wmidvbinterface.cpp
===================================================================
--- solid/backends/wmi/wmidvbinterface.cpp   (revision 910320)
+++ solid/backends/wmi/wmidvbinterface.cpp   (working copy)
@@ -52,7 +52,7 @@
         return -1;
     string = string.mid(pos + 1);
 
-    if (!string.startsWith("adapter"))
+    if (!string.startsWith(QString("adapter")))
         return -1;
     string = string.mid(7);
 
@@ -94,31 +94,31 @@
         return false;
     string = string.mid(pos + 1);
 
-    if (string.startsWith("audio")) {
+    if (string.startsWith(QString("audio"))) {
         *type = Solid::DvbInterface::DvbAudio;
         string = string.mid(5);
-    } else if (string.startsWith("ca")) {
+    } else if (string.startsWith(QString("ca"))) {
         *type = Solid::DvbInterface::DvbCa;
         string = string.mid(2);
-    } else if (string.startsWith("demux")) {
+    } else if (string.startsWith(QString("demux"))) {
         *type = Solid::DvbInterface::DvbDemux;
         string = string.mid(5);
-    } else if (string.startsWith("dvr")) {
+    } else if (string.startsWith(QString("dvr"))) {
         *type = Solid::DvbInterface::DvbDvr;
         string = string.mid(3);
-    } else if (string.startsWith("frontend")) {
+    } else if (string.startsWith(QString("frontend"))) {
         *type = Solid::DvbInterface::DvbFrontend;
         string = string.mid(8);
-    } else if (string.startsWith("net")) {
+    } else if (string.startsWith(QString("net"))) {
         *type = Solid::DvbInterface::DvbNet;
         string = string.mid(3);
-    } else if (string.startsWith("osd")) {
+    } else if (string.startsWith(QString("osd"))) {
         *type = Solid::DvbInterface::DvbOsd;
         string = string.mid(3);
-    } else if (string.startsWith("sec")) {
+    } else if (string.startsWith(QString("sec"))) {
         *type = Solid::DvbInterface::DvbSec;
         string = string.mid(3);
-    } else if (string.startsWith("video")) {
+    } else if (string.startsWith(QString("video"))) {
         *type = Solid::DvbInterface::DvbVideo;
         string = string.mid(5);
     } else
Index: solid/backends/wmi/wmivolume.cpp
===================================================================
--- solid/backends/wmi/wmivolume.cpp   (revision 910320)
+++ solid/backends/wmi/wmivolume.cpp   (working copy)
@@ -51,8 +51,8 @@
 
 
     return !removable && !hotpluggable
-        && mounted && !mount_point.startsWith("/media/")
-        && !mount_point.startsWith("/mnt/");
+        && mounted && !mount_point.startsWith(QString("/media/"))
+        && !mount_point.startsWith(QString("/mnt/"));
 }
 
 Solid::StorageVolume::UsageType Volume::usage() const



Please try if the code still compiles with the changes and if it works and if it is ok, you can send it to the mailing list.

fengshaun wrote:And a question, what should I do with http://lxr.kde.org/source/KDE/kdelibs/s ... nterface.h at line 94? Should I simply make in not-inline and move the implementation to the .cpp file?


You shouldn't change anything there because it is public API, but you can inform the developers about the issue on the mailing list and ask whether and how to handle it.

Last edited by msoeken on Wed Jan 14, 2009 11:41 am, edited 1 time in total.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
Pconfig
Alumni
Posts
74
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Wed Jan 14, 2009 5:41 pm
Thanks for taking a look

msoeken wrote:You should ignore this, because I saw there is for example KIcon("phrase") where phrase is an icon installed by the application. krazy cannot know that. You can suppress it with krazy comments

Will fix it with commenting issues.


msoeken wrote:I do not know what you mean by making links of the desktop files.
this->open() should be fine. Does krazy complain about it?

Well these .desktop files represent some kind of books. They're not application, nor directories. But krazy2 tells us that "Type" is required and there are only three valid types available


Krazy doesn't complain anymore but i changed open() to this->open(). This might cause another function to be invoked. Krazy thought that open() started the system call open but i think that wasn't the case here.

Last edited by Pconfig on Wed Jan 14, 2009 5:42 pm, edited 1 time in total.
bruno
KDE Developer
Posts
40
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Wed Jan 14, 2009 9:44 pm
I know how to change the foreach of the SizeHint object here below, but for the QPair, krazy2 don't accept it. What I'm doing wrong?

Code: Select all
Index: lancelot/libs/lancelot/layouts/NodeLayout.cpp
===================================================================
--- lancelot/libs/lancelot/layouts/NodeLayout.cpp       (révision 911112)
+++ lancelot/libs/lancelot/layouts/NodeLayout.cpp       (copie de travail)
@@ -159,7 +159,7 @@

             QSizeF size;

-            foreach (Qt::SizeHint which, sizeHintCache.keys()) {
+            foreach (const Qt::SizeHint &which, sizeHintCache.keys()) {
                 size = item->effectiveSizeHint(which);
                 size.scale(
                     1 / qMin(scaled.width(), qreal(1.0)),

http://lxr.kde.org/source/KDE/kdeplasma ... ut.cpp#162

Code: Select all
Index: lancelot/libs/lancelot/widgets/ActionListView.cpp
===================================================================
--- lancelot/libs/lancelot/widgets/ActionListView.cpp   (révision 911112)
+++ lancelot/libs/lancelot/widgets/ActionListView.cpp   (copie de travail)
@@ -144,8 +144,7 @@
 {
     int buttonIndex = m_topButtonIndex;

-    QPair  pair;
-    foreach (pair, m_buttons) {
+    foreach (const QPair &pair, m_buttons) {
         if (pair.first == button) {
             itemContextRequested(buttonIndex);
             return;

http://lxr.kde.org/source/KDE/kdeplasma ... ew.cpp#148


bruno, proud to be a member of KDE forums since 2008-Oct.
fengshaun
Alumni
Posts
32
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Thu Jan 15, 2009 12:33 am
msoeken: Yup, got your message. I will work on it after preparing for my debate tomorrow (god, school is so annoying!)


A proud KDE user and Linux enthusiast.
bruno
KDE Developer
Posts
40
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Thu Jan 15, 2009 2:33 am
For the qclasses one, it was weird than just "pastebin/pastebinConfig.ui" required me to add KComboBox, and if not added, the comboxes were present (when tested with plasmoidviewer) but they where empty (instead of having 2 item each).

qclasses
[code=diff]Index: comic/config.ui
===================================================================
--- comic/config.ui (révision 911112)
+++ comic/config.ui (copie de travail)
@@ -49,7 +49,7 @@



-
+


0
Index: fileWatcher/filtersConfig.ui
===================================================================
--- fileWatcher/filtersConfig.ui (révision 911112)
+++ fileWatcher/filtersConfig.ui (copie de travail)
@@ -50,7 +50,7 @@



-
+



Index: lancelot/app/src/models/Devices.cpp
===================================================================
--- lancelot/app/src/models/Devices.cpp (révision 911112)
+++ lancelot/app/src/models/Devices.cpp (copie de travail)
@@ -20,7 +20,7 @@

#include "Devices.h"

-#include
+#include
#include
#include

@@ -238,7 +238,7 @@
access->disconnect(this, SLOT(deviceSetupDone(Solid::ErrorType, QVariant, const QString &)));

if (!access || !access->isAccessible()) {
- QMessageBox::critical(NULL, i18n("Failed to open"), i18n("The requested device can not be accessed."));
+ KMessageBox::error(NULL, i18n("Failed to open"), i18n("The requested device can not be accessed."));
return;
}

Index: weatherstation/weatherconfig.ui
===================================================================
--- weatherstation/weatherconfig.ui (révision 911112)
+++ weatherstation/weatherconfig.ui (copie de travail)
@@ -189,7 +189,7 @@



-
+


0
@@ -218,7 +218,7 @@



-
+


0
@@ -247,7 +247,7 @@



-
+


0
Index: weatherstation/weatherconfigsearch.ui
===================================================================
--- weatherstation/weatherconfigsearch.ui (révision 911112)
+++ weatherstation/weatherconfigsearch.ui (copie de travail)
@@ -24,7 +24,7 @@



-
+



@@ -57,7 +57,7 @@


KComboBox
- QComboBox
+ KComboBox
kcombobox.h


Index: twitter/configuration.ui
===================================================================
--- twitter/configuration.ui (révision 911112)
+++ twitter/configuration.ui (copie de travail)
@@ -37,9 +37,9 @@



-
+

- QLineEdit::Password
+ KLineEdit::Password



@@ -221,7 +221,7 @@



-
+



Index: frame/config.ui
===================================================================
--- frame/config.ui (révision 911112)
+++ frame/config.ui (copie de travail)
@@ -29,7 +29,7 @@



-
+


Image
@@ -290,7 +290,7 @@



-
+



Index: pastebin/pastebinConfig.ui
===================================================================
--- pastebin/pastebinConfig.ui (révision 911112)
+++ pastebin/pastebinConfig.ui (copie de travail)
@@ -13,7 +13,7 @@



-
+


Pastebin.ca
@@ -34,7 +34,7 @@



-
+


Imagebin.ca
@@ -49,6 +49,13 @@



+
+
+ KComboBox
+ QComboBox
+ kcombobox.h
+
+



Index: paste/snippetconfig.ui
===================================================================
--- paste/snippetconfig.ui (révision 911112)
+++ paste/snippetconfig.ui (copie de travail)
@@ -55,7 +55,7 @@



-
+



@@ -82,7 +82,7 @@



-
+


0
@@ -90,7 +90,7 @@



- QTextEdit::NoWrap
+ KTextEdit::NoWrap


false
Index: paste/addmacro.cpp
===================================================================
--- paste/addmacro.cpp (révision 911112)
+++ paste/addmacro.cpp (copie de travail)
@@ -18,10 +18,10 @@
#include "addmacro.h"
#include
#include
-#include
+#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -39,7 +39,7 @@
m_layout->setMargin(0);
m_layout->setSpacing(spacingHint());

- m_macrosComboBox = new QComboBox(m_widget);
+ m_macrosComboBox = new KComboBox(m_widget);
const QMap& macros = PasteMacroExpander::instance().macros();
foreach (const QString& macro, macros.keys()) {
m_macrosComboBox->addItem(macros[macro][0].toString(), macro);
@@ -77,7 +77,7 @@
}
case MacroParam::String:
layout->addWidget(new QLabel(param.name + ':', m_params));
- layout->addWidget(w = new QLineEdit(m_params));
+ layout->addWidget(w = new KLineEdit(m_params));
break;
case MacroParam::Url:
layout->addWidget(new QLabel(param.name + ':'));
@@ -111,7 +111,7 @@
}
case MacroParam::String:
{
- QLineEdit* w = m_params->findChildren(param.name)[0];
+ KLineEdit* w = m_params->findChildren(param.name)[0];
values.append(w->text());
break;
}
Index: paste/addmacro.h
===================================================================
--- paste/addmacro.h (révision 911112)
+++ paste/addmacro.h (copie de travail)
@@ -21,7 +21,7 @@
#include
#include

-class QComboBox;
+class KComboBox;
class QVBoxLayout;

class AddMacro : public KDialog
@@ -37,7 +37,7 @@
void currentIndexChanged(int index);

private:
- QComboBox* m_macrosComboBox;
+ KComboBox* m_macrosComboBox;
QVBoxLayout* m_layout;
QWidget* m_widget;
QWidget* m_params;
[/code]

doublequote_chars
[code=diff]Index: lancelot/app/src/models/MessagesKmail.cpp
===================================================================
--- lancelot/app/src/models/MessagesKmail.cpp (révision 910278)
+++ lancelot/app/src/models/MessagesKmail.cpp (copie de travail)
@@ -128,7 +128,7 @@
QDBusReply ricon = m_folderinterface->normalIconPath();
KIcon icon;
add(
- name.value() + " (" + QString::number(unread) + ")", path,
+ name.value() + " (" + QString::number(unread) + ')', path,
KIcon(
(ricon.isValid() && !ricon.value().isEmpty())
? (ricon.value()) : "mail-folder-inbox"
Index: lancelot/app/src/models/ContactsKopete.cpp
===================================================================
--- lancelot/app/src/models/ContactsKopete.cpp (révision 910278)
+++ lancelot/app/src/models/ContactsKopete.cpp (copie de travail)
@@ -89,7 +89,7 @@
}

foreach (const QString& contact, contacts.value()) {
- QStringList contactParts = contact.split(":");
+ QStringList contactParts = contact.split(':');
if (contactParts.size() != 3) {
continue;
}
@@ -103,7 +103,7 @@
continue;
}

- QString avatarPath = m_kopeteAvatarsDir + "/" + account + "/" + contactID + ".png";
+ QString avatarPath = m_kopeteAvatarsDir + '/' + account + '/' + contactID + ".png";
add(contactName.value(), contactID,
KIcon(
(QFile::exists(avatarPath))?avatarPath:"user-online"
Index: lancelot/app/src/models/BaseModel.cpp
===================================================================
--- lancelot/app/src/models/BaseModel.cpp (révision 910278)
+++ lancelot/app/src/models/BaseModel.cpp (copie de travail)
@@ -92,7 +92,7 @@
{
int result = 0;
foreach (const QString & serviceAlternatives, serviceNames) {
- foreach (const QString & serviceName, serviceAlternatives.split("|")) {
+ foreach (const QString & serviceName, serviceAlternatives.split('|')) {
if (addService(serviceName)) {
++result;
break;
Index: lancelot/app/src/parts/LancelotPart.cpp
===================================================================
--- lancelot/app/src/parts/LancelotPart.cpp (révision 910278)
+++ lancelot/app/src/parts/LancelotPart.cpp (copie de travail)
@@ -356,7 +356,7 @@

if (loaded) {
if (!m_data.isEmpty()) {
- m_data += "n";
+ m_data += 'n';
}
m_data += input;
saveConfig();
@@ -393,7 +393,7 @@
if (data.isEmpty()) {
return false;
}
- return loadFromList(data.split("n"));
+ return loadFromList(data.split('n'));
}

void LancelotPart::removeModel(int index)
@@ -404,7 +404,7 @@
delete model;
}

- QStringList configs = m_data.split("n");
+ QStringList configs = m_data.split('n');
configs.removeAt(index);
m_data = configs.join("n");

Index: lancelot/app/src/Serializator.cpp
===================================================================
--- lancelot/app/src/Serializator.cpp (révision 910278)
+++ lancelot/app/src/Serializator.cpp (copie de travail)
@@ -34,11 +34,11 @@
i.next();

if (!result.isEmpty()) {
- result += "&";
+ result += '&';
}

result +=
- QUrl::toPercentEncoding(i.key()) + "=" +
+ QUrl::toPercentEncoding(i.key()) + '=' +
QUrl::toPercentEncoding(i.value());
}
return result;
@@ -48,9 +48,9 @@
{
QMap result;

- QStringList items = data.split("&");
+ QStringList items = data.split('&');
foreach (const QString & item, items) {
- QStringList broken = item.split("=");
+ QStringList broken = item.split('=');
if (broken.size() != 2) {
continue;
}
Index: lancelot/libs/lancelot/Global.cpp
===================================================================
--- lancelot/libs/lancelot/Global.cpp (révision 910278)
+++ lancelot/libs/lancelot/Global.cpp (copie de travail)
@@ -321,7 +321,7 @@
if (app == "lancelot") {
app = "";
} else {
- app += "-";
+ app += '-';
}

d->confMain = new KConfig("lancelot" + app + "rc");
Index: weatherstation/weatherstation.cpp
===================================================================
--- weatherstation/weatherstation.cpp (révision 910278)
+++ weatherstation/weatherstation.cpp (copie de travail)
@@ -285,7 +285,7 @@

void WeatherStation::setHumidity(QString humidity)
{
- humidity.replace("%", "");
+ humidity.remove('%');
m_lcd->setNumber("humidity", humidity);
}

Index: weatherstation/weatherconfig.cpp
===================================================================
--- weatherstation/weatherconfig.cpp (révision 910278)
+++ weatherstation/weatherconfig.cpp (copie de travail)
@@ -133,7 +133,7 @@
if (m_dataengine) {
QVariantList plugins = m_dataengine->query("ions").values();
foreach (const QVariant& plugin, plugins) {
- QStringList pluginInfo = plugin.toString().split("|");
+ QStringList pluginInfo = plugin.toString().split('|');
providerComboBox->addItem(pluginInfo[0], pluginInfo[1]);
}
}
Index: previewer/previewwidget.cpp
===================================================================
--- previewer/previewwidget.cpp (révision 910278)
+++ previewer/previewwidget.cpp (copie de travail)
@@ -494,7 +494,7 @@
painter->setFont(font);
painter->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
painter->drawText(QRect(39, 3, contentsRect.width() - 39, 30), Qt::AlignBottom | Qt::AlignLeft,
- " " + i18n("Previewer"));
+ ' ' + i18n("Previewer"));
QFontMetrics fm(font);
int length = fm.width(i18n("Previewer") + " ");
font.setBold(false);
Index: bluemarble/kwinglutils.cpp
===================================================================
--- bluemarble/kwinglutils.cpp (révision 910278)
+++ bluemarble/kwinglutils.cpp (copie de travail)
@@ -65,7 +65,7 @@
glVersion = MAKE_GL_VERSION(glversioninfo[0].toInt(), glversioninfo[1].toInt(),
glversioninfo.count() > 2 ? glversioninfo[2].toInt() : 0);
// Get list of supported OpenGL extensions
- glExtensions = QString((const char*)glGetString(GL_EXTENSIONS)).split(" ");
+ glExtensions = QString((const char*)glGetString(GL_EXTENSIONS)).split(' ');

// handle OpenGL extensions functions
glResolveFunctions();
Index: news/news.cpp
===================================================================
--- news/news.cpp (révision 910278)
+++ news/news.cpp (copie de travail)
@@ -351,7 +351,7 @@
}
uint timeStamp = item["time"].toUInt();
QString title = item["title"].toString();
- QString description = item["description"].toString().replace(QRegExp("]*>"), "");
+ QString description = item["description"].toString().remove(QRegExp("]*>"));
QString line;

if (title != 0 && m_showTitles) {
Index: rssnow/news.cpp
===================================================================
--- rssnow/news.cpp (révision 910278)
+++ rssnow/news.cpp (copie de travail)
@@ -325,7 +325,7 @@
if (m_showdroptarget && (i == (m_layout->count() - 1))) {
m_feedlist.append(feeds);
} else {
- if (!m_feedlist[i-start].endsWith(" ")) {
+ if (!m_feedlist[i-start].endsWith(' ')) {
m_feedlist[i-start].append(" ");
}
m_feedlist[i-start].append(feeds);
@@ -353,7 +353,7 @@
//group all feeds together so it can fit (only a single time):
QString allfeeds;
foreach (QString feed, m_feedlist) {
- if (!feed.endsWith(" ")) {
+ if (!feed.endsWith(' ')) {
feed.append(" ");
}
allfeeds.append(feed);
Index: pastebin/backends/pastebinca.cpp
===================================================================
--- pastebin/backends/pastebinca.cpp (révision 910278)
+++ pastebin/backends/pastebinca.cpp (copie de travail)
@@ -44,7 +44,7 @@
}

QString url(_data);
- url.replace("SUCCESS:","");
+ url.remove("SUCCESS:");
url.prepend(QString("%1/").arg(m_server));
emit postFinished(url);
}[/code]

emptystrcompare
[code=diff]Index: lancelot/app/src/models/Devices.cpp
===================================================================
--- lancelot/app/src/models/Devices.cpp (révision 910278)
+++ lancelot/app/src/models/Devices.cpp (copie de travail)
@@ -39,7 +39,7 @@

namespace Models {

-#define StringCoalesce(A, B) (A == "")?(B):(A)
+#define StringCoalesce(A, B) (A.isEmpty())?(B):(A)

Devices::Devices(Type filter)
: m_filter(filter)
Index: lancelot/libs/lancelot/Global.cpp
===================================================================
--- lancelot/libs/lancelot/Global.cpp (révision 910278)
+++ lancelot/libs/lancelot/Global.cpp (copie de travail)
@@ -330,11 +330,11 @@
kDebug() &urls, QObject *parent = 0)
+ explicit PreviewItemModel(const QList &urls, QObject *parent = 0)
: QAbstractListModel(parent), urlList(urls) {}

int rowCount(const QModelIndex &parent = QModelIndex()) const;
Index: bluemarble/kwinglutils.h
===================================================================
--- bluemarble/kwinglutils.h (révision 911112)
+++ bluemarble/kwinglutils.h (copie de travail)
@@ -64,8 +64,8 @@
{
public:
GLTexture();
- GLTexture( const QImage& image, GLenum target = GL_TEXTURE_2D );
- GLTexture( const QPixmap& pixmap, GLenum target = GL_TEXTURE_2D );
+ explicit GLTexture( const QImage& image, GLenum target = GL_TEXTURE_2D );
+ explicit GLTexture( const QPixmap& pixmap, GLenum target = GL_TEXTURE_2D );
GLTexture( const QString& fileName );
GLTexture( int width, int height );
virtual ~GLTexture();
Index: paste/pastemacroexpander.h
===================================================================
--- paste/pastemacroexpander.h (révision 911112)
+++ paste/pastemacroexpander.h (copie de travail)
@@ -33,7 +33,7 @@
Url
};

- MacroParam(const QString& n = QString(), ParamType t = String) : name(n), type(t) {};
+ explicit MacroParam(const QString& n = QString(), ParamType t = String) : name(n), type(t) {};
QString name;
ParamType type;
};
[/code]

nullstrassign
[code=diff]Index: weatherstation/weatherconfig.cpp
===================================================================
--- weatherstation/weatherconfig.cpp (révision 911112)
+++ weatherstation/weatherconfig.cpp (copie de travail)
@@ -93,7 +93,7 @@
places[result[i + 1]] = result[i + 3];
i += 4;
} else {
- places[result[i + 1]] = QString();
+ places[result[i + 1]].clear();
i += 2;
}
}
[/code]

nullstrcompare
[code=diff]Index: lancelot/libs/lancelot/widgets/Panel.cpp
===================================================================
--- lancelot/libs/lancelot/widgets/Panel.cpp (révision 911112)
+++ lancelot/libs/lancelot/widgets/Panel.cpp (copie de travail)
@@ -29,7 +29,7 @@
public:
Private(QIcon icon, QString title, Panel * parent)
: layoutItem(NULL),
- hasTitle(title != QString()),
+ hasTitle(!title.isEmpty()),
titleWidget(icon, title, "", parent),
q(parent)
{
@@ -38,7 +38,7 @@

Private(QString title, Panel * parent)
: layoutItem(NULL),
- hasTitle(title != QString()),
+ hasTitle(!title.isEmpty()),
titleWidget(title, "", parent),
q(parent)
{
[/code]

sigsandslots
[code=diff]Index: lancelot/libs/lancelot/models/ActionListViewModels.h
===================================================================
--- lancelot/libs/lancelot/models/ActionListViewModels.h (révision 911112)
+++ lancelot/libs/lancelot/models/ActionListViewModels.h (copie de travail)
@@ -126,7 +126,7 @@
*/
virtual void contextActivate(int index, QAction * context);

-public slots:
+public Q_SLOTS:
/**
* Activates the specified element
* @param index of the element that should be activated
@@ -408,7 +408,7 @@
QList > m_modelsMetadata;
bool m_hideEmptyModels;

-private slots:
+private Q_SLOTS:
// listen to model changes
void modelUpdated();
void modelItemInserted(int index);
Index: lancelot/libs/lancelot/widgets/ActionListView.h
===================================================================
--- lancelot/libs/lancelot/widgets/ActionListView.h (révision 911112)
+++ lancelot/libs/lancelot/widgets/ActionListView.h (copie de travail)
@@ -96,7 +96,7 @@
Q_SIGNALS:
void activated(int index);

-protected slots:
+protected Q_SLOTS:
void scrollTimer();
void itemActivated(int index);
void itemContextRequested(int index);
Index: lancelot/libs/lancelot/widgets/ExtenderButton.h
===================================================================
--- lancelot/libs/lancelot/widgets/ExtenderButton.h (révision 911112)
+++ lancelot/libs/lancelot/widgets/ExtenderButton.h (copie de travail)
@@ -138,7 +138,7 @@
L_Override virtual void paint(QPainter * painter,
const QStyleOptionGraphicsItem * option, QWidget * widget = 0);

-public slots:
+public Q_SLOTS:
/**
* Sets whether the button is checked.
* Has no effect if button is not checkable.
@@ -169,7 +169,7 @@
L_Override virtual void hoverEnterEvent(QGraphicsSceneHoverEvent * event);
L_Override virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent * event);

-protected slots:
+protected Q_SLOTS:
void activate();

private:
[/code]

spelling
[code=diff]Index: twitter/twitter.cpp
===================================================================
--- twitter/twitter.cpp (révision 911112)
+++ twitter/twitter.cpp (copie de travail)
@@ -303,7 +303,7 @@
if (success &&
enterWalletFolder(QString::fromLatin1("Plasma-Twitter")) &&
(m_wallet->readPassword(m_username, pwd) == 0)) {
- kDebug() << "successfully retreived password from wallet";
+ kDebug() << "successfully retrieved password from wallet";
m_password = pwd;
downloadHistory();
} else if (m_password.isEmpty()) {
[/code]

Last edited by bruno on Thu Jan 15, 2009 9:43 pm, edited 1 time in total.


bruno, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: [Kourse 3] Fixing krazy2 issues

Thu Jan 15, 2009 7:37 pm
Great work, Bruno. I already saw your mail to the mailing list. But I am not sure about the following change:
Code: Select all
#
-#define StringCoalesce(A, B) (A == "")?:(A)
#
+#define StringCoalesce(A, B) (A.isEmpty())?:(A)

Could you point out where this is used? I am wondering because there are no quotes around the html tags. Not that this change causes a bug somewhere.

Also thanks to pklaffert for his bugfixes. He also send a mail to the mailing list.

And of couse thanks to the other students. I do not follow each mailing list. If you already mailed something, please post the link as reply to this thread.

Cheers, m.

Last edited by msoeken on Thu Jan 15, 2009 8:11 pm, edited 1 time in total.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
bruno
KDE Developer
Posts
40
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Thu Jan 15, 2009 9:45 pm
msoeken wrote:Great work, Bruno. I already saw your mail to the mailing list. But I am not sure about the following change:
Code: Select all
#
-#define StringCoalesce(A, B) (A == "")?:(A)
#
+#define StringCoalesce(A, B) (A.isEmpty())?:(A)

Could you point out where this is used? I am wondering because there are no quotes around the html tags. Not that this change causes a bug somewhere.


Thanks!

My bad, I didn't thought about deactivating the smileys. It should read :

Code: Select all
#
-#define StringCoalesce(A, B) (A == "")?(B):(A)
#
+#define StringCoalesce(A, B) (A.isEmpty())?(B):(A)


bruno, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: [Kourse 3] Fixing krazy2 issues

Thu Jan 15, 2009 10:03 pm
bruno wrote:Thanks!

My bad, I didn't thought about deactivating the smileys. It should read :


That's funny ... and very confusing ;)


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
bruno
KDE Developer
Posts
40
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Fri Jan 16, 2009 12:23 am
msoeken wrote:
bruno wrote:Thanks!

My bad, I didn't thought about deactivating the smileys. It should read :


That's funny ... and very confusing ;)


Indeed :-D

Patches sent to the mailing list.


bruno, proud to be a member of KDE forums since 2008-Oct.
pklaffert
Alumni
Posts
3
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Fri Jan 16, 2009 2:06 pm
I fixed some of the minor krazy2 issues in kdeplasma-addons.

Code: Select all
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; inumber.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"
+

 


patch already send to the mailing list

Last edited by pklaffert on Fri Jan 16, 2009 4:03 pm, edited 1 time in total.
HappySmileMan
Alumni
Posts
17
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Fri Jan 16, 2009 5:03 pm
Patch made for dragonplayer, only very small changes so I figure only one patch is needed (might make another for one of the issues I haven't fixed yet, as explained below.):

Code: Select all
Index: app/mainWindow.cpp
===================================================================
--- app/mainWindow.cpp   (revision 910592)
+++ app/mainWindow.cpp   (working copy)
@@ -220,7 +220,7 @@
         if (args.isSet( "play-dvd" ))
             engine()->playDvd();
         else if (args.count() > 0 ) {
-            open( args.url( 0 ) );
+            this->open( args.url( 0 ) );
             args.clear();
             adjustSize(); //will resize us to reflect the videoWindow's sizeHint()
         }
@@ -272,7 +272,7 @@
     connect( playerStop, SIGNAL( triggered() ), engine(), SLOT( stop() ) );
     addToAc( playerStop )
 
-    KToggleAction* mute = new KToggleAction( KIcon("player-volume-muted"), i18n("Mute"), ac );
+    KToggleAction* mute = new KToggleAction( KIcon("player-volume-muted"), i18nc( "Mute the sound output", "Mute"), ac );
     mute->setObjectName( "mute" );
     mute->setShortcut( Qt::Key_M );
     connect( mute, SIGNAL( toggled( bool ) ), videoWindow(), SLOT( mute( bool ) ) );
@@ -394,7 +394,7 @@
         m_volumeSlider->setDisabled ( engine()->isMuted() );
 
         m_muteCheckBox = new QCheckBox();
-        m_muteCheckBox->setText( i18n( "Mute " ) );
+        m_muteCheckBox->setText( i18nc( "Mute the sound output", "Mute " ) );
         m_muteCheckBox->setChecked ( engine()->isMuted() );
         connect( m_muteCheckBox, SIGNAL( toggled( bool ) ), videoWindow(), SLOT( mute( bool ) ) );
 
@@ -550,17 +550,17 @@
         const KUrl url = KFileDialog::getOpenUrl( KUrl("kfiledialog:///dragonplayer"),mimeFilter.join(" "), this, i18n("Select A File To Play") );
         if( url.isEmpty() )
         {
-             debug() open( url );
         } break;
     case PlayDialog::RECENT_FILE:
       
         break;
     case PlayDialog::VCD:
-        open( KUrl( "vcd://" ) ); // one / is not enough
+        this->open( KUrl( "vcd://" ) ); // one / is not enough
         break;
     case PlayDialog::DVD:
         playDisc();
@@ -611,7 +611,7 @@
 {
     m_playDialog->deleteLater();
     m_playDialog = 0;
-    open( url );
+    this->open( url );
 }
 
 void
@@ -702,7 +702,7 @@
 {
     KUrl::List uriList = KUrl::List::fromMimeData( e->mimeData() );
     if( !uriList.isEmpty() )
-        open( uriList.first() );
+        this->open( uriList.first() );
     else
         engineMessage( i18n("Sorry, no media was found in the drop") );
 }
Index: app/theStream.cpp
===================================================================
--- app/theStream.cpp   (revision 910592)
+++ app/theStream.cpp   (working copy)
@@ -138,8 +138,8 @@
     TheStream::prettyTitle()
     {
         const KUrl& url      = videoWindow()->m_media->currentSource().url();
-        const QString artist = QString();
-        const QString title  = QString();
+        const QString artist;
+        const QString title;
 
         if (hasVideo() && !title.isEmpty())
             return title;
Index: app/actions.cpp
===================================================================
--- app/actions.cpp   (revision 910592)
+++ app/actions.cpp   (working copy)
@@ -67,7 +67,7 @@
 ///Codeine::VolumeAction
 ////////////////////////////////////////////////////
 Codeine::VolumeAction::VolumeAction( QObject *receiver, const char *slot, KActionCollection *ac )
-        : KToggleAction( i18n("Volume"), ac )
+        : KToggleAction( i18nc( "Volume of sound output", "Volume"), ac )
 {
     setObjectName( "volume" );
     setIcon( KIcon( "player-volume" ) );
Index: app/playlistFile.cpp
===================================================================
--- app/playlistFile.cpp   (revision 910592)
+++ app/playlistFile.cpp   (working copy)
@@ -41,9 +41,9 @@
 
     QString &path = m_path = url.path();
 
-    if( path.endsWith( ".pls", Qt::CaseInsensitive ) )
+    if( path.endsWith( QString(".pls"), Qt::CaseInsensitive ) )
         m_type = PLS; else
-    if( path.endsWith( ".m3u", Qt::CaseInsensitive ) )
+    if( path.endsWith( QString(".m3u"), Qt::CaseInsensitive ) )
         m_type = M3U;
     else {
         m_type = Unknown;
@@ -52,7 +52,7 @@
     }
 
     if( m_isRemoteFile ) {
-        path = QString();
+        path.clear();
         if( !KIO::NetAccess::download( url, path, Codeine::mainWindow() ) ) {
             m_error = i18n( "Dragon Player could not download the remote playlist: %1", url.prettyUrl() );
             return;
@@ -91,7 +91,7 @@
 
     for( QString line = stream.readLine(); !line.isNull(); )
     {
-        if( line.startsWith( "File" ) ) {
+        if( line.startsWith( QString("File") ) ) {
             const KUrl url = line.section( '=', -1 );
             const QString title = stream.readLine().section( '=', -1 );
 
@@ -116,7 +116,7 @@
     {
         line = stream.readLine();
 
-        if( line.startsWith( "#EXTINF", Qt::CaseInsensitive ) )
+        if( line.startsWith( QString("#EXTINF"), Qt::CaseInsensitive ) )
             continue;
 
         else if( !line.startsWith( '#' ) && !line.isEmpty() )
Index: app/fht.cpp
===================================================================
--- app/fht.cpp   (revision 910592)
+++ app/fht.cpp   (working copy)
@@ -122,7 +122,7 @@
    }
    semiLogSpectrum(p);
    *out++ = *p = *p / 100;
-   for (k = i = 1, r = m_log; i < n; i++) {
+   for (k = i = 1, r = m_log; i < n; ++i) {
       j = *r++;
       if (i == j)
          *out++ = p[i];
Index: app/stateChange.cpp
===================================================================
--- app/stateChange.cpp   (revision 910592)
+++ app/stateChange.cpp   (working copy)
@@ -143,7 +143,7 @@
         const QString url_string = url.url();
         if( !(url_string.contains( "porn", Qt::CaseInsensitive ) || url_string.contains( "pr0n", Qt::CaseInsensitive )) )
         #endif
-            if( url.protocol() != "dvd" && url.protocol() != "vcd" && url.prettyUrl()!="") {
+            if( url.protocol() != "dvd" && url.protocol() != "vcd" && !url.prettyUrl().isEmpty()) {
                 KConfigGroup config = KConfigGroup( KGlobal::config(), "General" );
                 const QString prettyUrl = url.prettyUrl();
 


Things not fixed:

Check for cpp macros and usage [cpp]... 1 issue found:
debug.h line 44 contains platform specific macro, this should be done using cmake instead, I don't know how I would fix this.

Check for an acceptable license [license]... 2 issues found:
app/recentlyPlayedList.cpp and app/recentlyPlayedList.h missing license.
It's not my own work, AFAIK the actual author would have to do this (just a formality I guess)

Check for Qt classes that should not be used [qclasses]... 2 issues found:
app/playDialog.h/.cpp use a QDialog instead of a KDialog, I've tried changing this and got some weird graphical errors, seems it'd require a bit more changes than the other issues, I'll look at it again and if I do get it to work I'll send in another patch, but no luck so far (don't have much experience)

Sending it to mailing list now.

Last edited by HappySmileMan on Fri Jan 16, 2009 5:04 pm, edited 1 time in total.


HappySmileMan, proud to be a member of KDE forums since 2008-Oct.
fengshaun
Alumni
Posts
32
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Sat Jan 17, 2009 1:45 am
So are my two patches good enough to be sent to the kdelibs-bugs mailing list?


A proud KDE user and Linux enthusiast.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: [Kourse 3] Fixing krazy2 issues

Sat Jan 17, 2009 10:30 am
@Fengshaun: I think the mailing list for KDE libs ( patches, discussion, etc ) is kde-core-devel@kde.org


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
michael4910
Alumni
Posts
100
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Sat Jan 17, 2009 10:35 am
Working on konqueror I just wonder why on http://englishbreakfastnetwork.org/kraz ... index.html there are no issues found for i18ncheckarg but my local krazy finds about 50 issues like for example:
Code: Select all
./src/konqview.cpp: single adjective as message, probably ambiguous; use context call to explain what it refers to line#1314

Code: Select all
if ( KMessageBox::warningContinueCancel( 0, i18n(
            "The page you are trying to view is the result of posted form data. "
            "If you resend the data, any action the form carried out (such as search or online purchase) will be repeated. "),
            i18n( "Warning" ), KGuiItem(i18nc( "Resend the data", "Resend" )) ) == KMessageBox::Continue )
        {

Did I miss something?


michael4910, proud to be a member of KDE forums since 2008-Oct.
bruno
KDE Developer
Posts
40
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Sat Jan 17, 2009 6:06 pm
michael4910 wrote:Working on konqueror I just wonder why on http://englishbreakfastnetwork.org/kraz ... index.html there are no issues found for i18ncheckarg but my local krazy finds about 50 issues like for example:

Did I miss something?



I asked about that, this is the reason :

[quote=Chusslove Illich]Re: Krazy : i18ncheckarg's check not showing issues on EBN

That's because the --priority=important is used for the web report,
reporting only issues that should really be fix. While when you run it
locally without the --priority option, all issues are reported.

You can see all of those locally reported issues are of "add context"
variety. Contexts are very useful for translators, but not so essential on
the technical side. So they drowned the web report, causing people not to
fix even the essential issues, and therefore we decided to relegate them to
lower priority and not show them.[/quote]


bruno, proud to be a member of KDE forums since 2008-Oct.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kesang, Yahoo [Bot]