[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    compile error in kdeartwork from 3.5 branch
From:       Frank Osterfeld <frank.osterfeld () gmx ! de>
Date:       2006-01-24 0:21:55
Message-ID: 200601240121.59963.frank.osterfeld () gmx ! de
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Trying to compile kdeartwork from 3.5 branch, I get compile errors in 
kdeartwork/kscreensaver/kxsconfig/kxscontrol.cpp, using 

gcc (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)

from Kubuntu breezy.

All errors look like this:

---------------------------------------------------------------------
kxscontrol.cpp: In constructor ‘KXSRangeControl::KXSRangeControl(QWidget*, 
const QString&, const QXmlAttributes&)':
kxscontrol.cpp:54: error: no matching function for call to ‘i18n(QString&)'
/opt2/kde-3.5/include/klocale.h:78: note: candidates are: QString i18n(const 
char*)
/opt2/kde-3.5/include/klocale.h:87: note:                 QString i18n(const 
char*, const char*)
/opt2/kde-3.5/include/klocale.h:100: note:                 QString i18n(const 
char*, const char*, long unsigned int)
---------------------------------------------------------------------

The problem are calls like i18n(mLabel), where mLabel is a QString:

   new QLabel(i18n(mLabel), this);

To make it compile, I tried two ways, both attached as patch.

1) removing i18n:

   new QLabel(mLabel, this);

2) adding .utf8():

  new QLabel(i18n(mLabel.toUtf8()), this);

Both fix compilation.

1) makes most sense to me. It seems the label values are read from XML, so I 
don't know how i18n() should work here at all. However, I leave that to the 
people knowing also the most esoteric uses of i18n, maybe I am missing 
something here.

Frank

["kdeartwork-compile-fix-2.diff" (text/x-diff)]

Index: kscreensaver/kxsconfig/kxscontrol.cpp
===================================================================
--- kscreensaver/kxsconfig/kxscontrol.cpp	(revision 501817)
+++ kscreensaver/kxsconfig/kxscontrol.cpp	(working copy)
@@ -51,7 +51,7 @@
     if (attr.value("type") == "spinbutton" ) {
 	QHBoxLayout *hb = new QHBoxLayout(this);
 	if (!mLabel.isEmpty()) {
-	    QLabel *l = new QLabel(i18n(mLabel), this);
+            QLabel *l = new QLabel(i18n(mLabel.utf8()), this);
 	    hb->add(l);
 	}
 	mSpinBox = new QSpinBox(mMinimum, mMaximum, 1, this);
@@ -63,19 +63,19 @@
 	QString highLabel = attr.value("_high-label");
 	QVBoxLayout *vb = new QVBoxLayout(this);
 	if (!mLabel.isEmpty()) {
-	    QLabel *l = new QLabel(i18n(mLabel), this);
+            QLabel *l = new QLabel(i18n(mLabel.utf8()), this);
 	    vb->add(l);
 	}
 	QHBoxLayout *hb = new QHBoxLayout(vb);
 	if (!lowLabel.isEmpty()) {
-	    QLabel *l = new QLabel(i18n(lowLabel), this);
+            QLabel *l = new QLabel(i18n(lowLabel.utf8()), this);
 	    hb->addWidget(l);
 	}
 	mSlider = new QSlider(mMinimum, mMaximum, 10, mValue, Qt::Horizontal, this);
 	connect(mSlider, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)));
 	hb->add(mSlider);
 	if (!highLabel.isEmpty()){
-	    QLabel *l = new QLabel(i18n(highLabel), this);
+            QLabel *l = new QLabel(i18n(highLabel.utf8()), this);
 	    hb->addWidget(l);
 	}
     }
@@ -120,12 +120,12 @@
     QString highLabel = attr.value("_high-label");
     QVBoxLayout *vb = new QVBoxLayout(this);
     if (!mLabel.isEmpty()) {
-	QLabel *l = new QLabel(i18n(mLabel), this);
+        QLabel *l = new QLabel(i18n(mLabel.utf8()), this);
 	vb->add(l);
     }
     QHBoxLayout *hb = new QHBoxLayout(vb);
     if (!lowLabel.isEmpty()) {
-	QLabel *l = new QLabel(i18n(lowLabel), this);
+        QLabel *l = new QLabel(i18n(lowLabel.utf8()), this);
 	hb->addWidget(l);
     }
     int value = int((mValue - mMinimum) * 100 / (mMaximum - mMinimum));
@@ -133,7 +133,7 @@
     connect(mSlider, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)));
     hb->add(mSlider);
     if (!highLabel.isEmpty()){
-	QLabel *l = new QLabel(i18n(highLabel), this);
+        QLabel *l = new QLabel(i18n(highLabel.utf8()), this);
 	hb->addWidget(l);
     }
 }
@@ -165,7 +165,7 @@
                                       const QXmlAttributes &attr)
   : QCheckBox(parent), KXSBoolItem(name, attr)
 {
-  setText(i18n(mLabel));
+  setText(i18n(mLabel.utf8()));
   setChecked(mValue);
   connect(this, SIGNAL(toggled(bool)), SLOT(slotToggled(bool)));
 }
@@ -192,7 +192,7 @@
   l->add(label);
   mCombo = new QComboBox(this);
   for(uint i=0; i < mOptions.count(); i++)
-      mCombo->insertItem( i18n(mOptions[i]) );
+      mCombo->insertItem( i18n(mOptions[i].utf8()) );
   mCombo->setCurrentItem(mValue);
   connect(mCombo, SIGNAL(activated(int)), SLOT(slotActivated(int)));
   l->add(mCombo);
@@ -203,7 +203,7 @@
   : QWidget(parent), KXSSelectItem(name, attr)
 {
   QVBoxLayout *l = new QVBoxLayout(this);
-  QLabel *label = new QLabel(i18n(mLabel), this);
+  QLabel *label = new QLabel(i18n(mLabel.utf8()), this);
   l->add(label);
   mCombo = new QComboBox(this);
   connect(mCombo, SIGNAL(activated(int)), SLOT(slotActivated(int)));
@@ -213,7 +213,7 @@
 void KXSDropListControl::addOption(const QXmlAttributes &attr)
 {
     KXSSelectItem::addOption( attr );
-    mCombo->insertItem( i18n(mOptions[mOptions.count()-1]) );
+    mCombo->insertItem( i18n(mOptions[mOptions.count()-1].utf8()) );
     if ( (unsigned)mValue == mOptions.count()-1 )
 	mCombo->setCurrentItem(mOptions.count()-1);
 }
@@ -248,7 +248,7 @@
   : QWidget(parent), KXSStringItem(name, attr)
 {
   QVBoxLayout *l = new QVBoxLayout(this);
-  QLabel *label = new QLabel(i18n(mLabel), this);
+  QLabel *label = new QLabel(i18n(mLabel.utf8()), this);
   l->add(label);
   mEdit = new QLineEdit(this);
   connect(mEdit, SIGNAL(textChanged(const QString &)), SLOT(textChanged(const QString &)));
@@ -285,7 +285,7 @@
   : QWidget(parent), KXSStringItem(name, attr)
 {
   QVBoxLayout *l = new QVBoxLayout(this);
-  QLabel *label = new QLabel(i18n(mLabel), this);
+  QLabel *label = new QLabel(i18n(mLabel.utf8()), this);
   l->add(label);
   QHBoxLayout *hb = new QHBoxLayout(l);
   mEdit = new QLineEdit(this);

["kdeartwork-compile-fix-1.diff" (text/x-diff)]

Index: kscreensaver/kxsconfig/kxscontrol.cpp
===================================================================
--- kscreensaver/kxsconfig/kxscontrol.cpp	(revision 501807)
+++ kscreensaver/kxsconfig/kxscontrol.cpp	(working copy)
@@ -51,7 +51,7 @@
     if (attr.value("type") == "spinbutton" ) {
 	QHBoxLayout *hb = new QHBoxLayout(this);
 	if (!mLabel.isEmpty()) {
-	    QLabel *l = new QLabel(i18n(mLabel), this);
+	    QLabel *l = new QLabel(mLabel, this);
 	    hb->add(l);
 	}
 	mSpinBox = new QSpinBox(mMinimum, mMaximum, 1, this);
@@ -63,19 +63,19 @@
 	QString highLabel = attr.value("_high-label");
 	QVBoxLayout *vb = new QVBoxLayout(this);
 	if (!mLabel.isEmpty()) {
-	    QLabel *l = new QLabel(i18n(mLabel), this);
+	    QLabel *l = new QLabel(mLabel, this);
 	    vb->add(l);
 	}
 	QHBoxLayout *hb = new QHBoxLayout(vb);
 	if (!lowLabel.isEmpty()) {
-	    QLabel *l = new QLabel(i18n(lowLabel), this);
+	    QLabel *l = new QLabel(lowLabel, this);
 	    hb->addWidget(l);
 	}
 	mSlider = new QSlider(mMinimum, mMaximum, 10, mValue, Qt::Horizontal, this);
 	connect(mSlider, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)));
 	hb->add(mSlider);
 	if (!highLabel.isEmpty()){
-	    QLabel *l = new QLabel(i18n(highLabel), this);
+	    QLabel *l = new QLabel(highLabel, this);
 	    hb->addWidget(l);
 	}
     }
@@ -120,12 +120,12 @@
     QString highLabel = attr.value("_high-label");
     QVBoxLayout *vb = new QVBoxLayout(this);
     if (!mLabel.isEmpty()) {
-	QLabel *l = new QLabel(i18n(mLabel), this);
+	QLabel *l = new QLabel(mLabel, this);
 	vb->add(l);
     }
     QHBoxLayout *hb = new QHBoxLayout(vb);
     if (!lowLabel.isEmpty()) {
-	QLabel *l = new QLabel(i18n(lowLabel), this);
+	QLabel *l = new QLabel(lowLabel, this);
 	hb->addWidget(l);
     }
     int value = int((mValue - mMinimum) * 100 / (mMaximum - mMinimum));
@@ -133,7 +133,7 @@
     connect(mSlider, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)));
     hb->add(mSlider);
     if (!highLabel.isEmpty()){
-	QLabel *l = new QLabel(i18n(highLabel), this);
+	QLabel *l = new QLabel(highLabel, this);
 	hb->addWidget(l);
     }
 }
@@ -165,7 +165,7 @@
                                       const QXmlAttributes &attr)
   : QCheckBox(parent), KXSBoolItem(name, attr)
 {
-  setText(i18n(mLabel));
+  setText(mLabel);
   setChecked(mValue);
   connect(this, SIGNAL(toggled(bool)), SLOT(slotToggled(bool)));
 }
@@ -192,7 +192,7 @@
   l->add(label);
   mCombo = new QComboBox(this);
   for(uint i=0; i < mOptions.count(); i++)
-      mCombo->insertItem( i18n(mOptions[i]) );
+      mCombo->insertItem( mOptions[i] );
   mCombo->setCurrentItem(mValue);
   connect(mCombo, SIGNAL(activated(int)), SLOT(slotActivated(int)));
   l->add(mCombo);
@@ -203,7 +203,7 @@
   : QWidget(parent), KXSSelectItem(name, attr)
 {
   QVBoxLayout *l = new QVBoxLayout(this);
-  QLabel *label = new QLabel(i18n(mLabel), this);
+  QLabel *label = new QLabel(mLabel, this);
   l->add(label);
   mCombo = new QComboBox(this);
   connect(mCombo, SIGNAL(activated(int)), SLOT(slotActivated(int)));
@@ -213,7 +213,7 @@
 void KXSDropListControl::addOption(const QXmlAttributes &attr)
 {
     KXSSelectItem::addOption( attr );
-    mCombo->insertItem( i18n(mOptions[mOptions.count()-1]) );
+    mCombo->insertItem( mOptions[mOptions.count()-1] );
     if ( (unsigned)mValue == mOptions.count()-1 )
 	mCombo->setCurrentItem(mOptions.count()-1);
 }
@@ -248,7 +248,7 @@
   : QWidget(parent), KXSStringItem(name, attr)
 {
   QVBoxLayout *l = new QVBoxLayout(this);
-  QLabel *label = new QLabel(i18n(mLabel), this);
+  QLabel *label = new QLabel(mLabel, this);
   l->add(label);
   mEdit = new QLineEdit(this);
   connect(mEdit, SIGNAL(textChanged(const QString &)), SLOT(textChanged(const QString &)));
@@ -285,7 +285,7 @@
   : QWidget(parent), KXSStringItem(name, attr)
 {
   QVBoxLayout *l = new QVBoxLayout(this);
-  QLabel *label = new QLabel(i18n(mLabel), this);
+  QLabel *label = new QLabel(mLabel, this);
   l->add(label);
   QHBoxLayout *hb = new QHBoxLayout(l);
   mEdit = new QLineEdit(this);

[Attachment #7 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic