scribus/string-compare.diff

171 lines
6.2 KiB
Diff

--- scribus/plugins/scriptplugin/cmdcolor.cpp
+++ scribus/plugins/scriptplugin/cmdcolor.cpp
@@ -147,7 +147,7 @@ PyObject *scribus_delcolor(PyObject* /* self */, PyObject* args)
char *Repl = const_cast<char*>(CommonStrings::None.latin1());
if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Name, "utf-8", &Repl))
return NULL;
- if (Name == "")
+ if (!*Name)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot delete a color with an empty name.","python error"));
return NULL;
--- scribus/plugins/scriptplugin/cmdmisc.cpp
+++ scribus/plugins/scriptplugin/cmdmisc.cpp
@@ -190,7 +190,7 @@ PyObject *scribus_senttolayer(PyObject* /* self */, PyObject* args)
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Layer == "")
+ if (!*Layer)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
return NULL;
@@ -229,7 +229,7 @@ PyObject *scribus_layervisible(PyObject* /* self */, PyObject* args)
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == "")
+ if (!*Name)
{
PyErr_SetString(PyExc_ValueError, QString("Cannot have an empty layer name"));
return NULL;
@@ -261,7 +261,7 @@ PyObject *scribus_layerprint(PyObject* /* self */, PyObject* args)
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == "")
+ if (!*Name)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
return NULL;
@@ -292,7 +292,7 @@ PyObject *scribus_glayervisib(PyObject* /* self */, PyObject* args)
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == "")
+ if (!*Name)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
return NULL;
@@ -323,7 +323,7 @@ PyObject *scribus_glayerprint(PyObject* /* self */, PyObject* args)
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == "")
+ if (!*Name)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
return NULL;
@@ -355,7 +355,7 @@ PyObject *scribus_removelayer(PyObject* /* self */, PyObject* args)
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == "")
+ if (!*Name)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
return NULL;
@@ -410,7 +410,7 @@ PyObject *scribus_createlayer(PyObject* /* self */, PyObject* args)
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == "")
+ if (!*Name)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot create layer without a name.","python error"));
return NULL;
--- scribus/plugins/scriptplugin/cmdobj.cpp
+++ scribus/plugins/scriptplugin/cmdobj.cpp
@@ -30,7 +30,7 @@ PyObject *scribus_newrect(PyObject* /* self */, PyObject* args)
ScMW->doc->toolSettings.dWidth,
ScMW->doc->toolSettings.dBrush, ScMW->doc->toolSettings.dPen, true);
ScMW->doc->setRedrawBounding(ScMW->doc->Items->at(i));
- if (Name != "")
+ if (*Name)
ScMW->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScMW->doc->Items->at(i)->itemName().utf8());
}
@@ -59,7 +59,7 @@ PyObject *scribus_newellipse(PyObject* /* self */, PyObject* args)
return NULL;
}
ScMW->doc->setRedrawBounding(ScMW->doc->Items->at(i));
- if (Name != "")
+ if (*Name)
ScMW->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScMW->doc->Items->at(i)->itemName().utf8());
}
@@ -86,7 +86,7 @@ PyObject *scribus_newimage(PyObject* /* self */, PyObject* args)
return NULL;
}
ScMW->doc->setRedrawBounding(ScMW->doc->Items->at(i));
- if (Name != "")
+ if (*Name)
ScMW->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScMW->doc->Items->at(i)->itemName().utf8());
}
@@ -113,7 +113,7 @@ PyObject *scribus_newtext(PyObject* /* self */, PyObject* args)
return NULL;
}
ScMW->doc->setRedrawBounding(ScMW->doc->Items->at(i));
- if (Name != "")
+ if (*Name)
ScMW->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScMW->doc->Items->at(i)->itemName().utf8());
}
@@ -151,7 +151,7 @@ PyObject *scribus_newline(PyObject* /* self */, PyObject* args)
it->updateClip();
ScMW->doc->setRedrawBounding(it);
it->OwnPage = ScMW->doc->OnPage(it);
- if (Name != "")
+ if (*Name)
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
}
@@ -224,7 +224,7 @@ PyObject *scribus_polyline(PyObject* /* self */, PyObject* args)
}
ScMW->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScMW->view->AdjustItemSize(it);
- if (Name != "")
+ if (*Name)
{
it->setItemName(QString::fromUtf8(Name));
}
@@ -304,7 +304,7 @@ PyObject *scribus_polygon(PyObject* /* self */, PyObject* args)
}
ScMW->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScMW->view->AdjustItemSize(it);
- if (Name != "")
+ if (*Name)
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
}
@@ -429,7 +429,7 @@ PyObject *scribus_pathtext(PyObject* /* self */, PyObject* args)
PageItem *it = ScMW->doc->Items->at(i);
ScMW->view->ToPathText();
ScMW->view->MoveItem(pageUnitXToDocX(x) - it->xPos(), pageUnitYToDocY(y) - it->yPos(), it);
- if (Name != "")
+ if (*Name)
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
}
@@ -532,7 +532,7 @@ PyObject *scribus_setstyle(PyObject* /* self */, PyObject* args)
return NULL;
}
// for current item only
- if (ScMW->doc->m_Selection->count() == 0 || name != "")
+ if (ScMW->doc->m_Selection->count() == 0 || *name)
{
// quick hack to always apply on the right frame - pv
ScMW->view->Deselect(true);
--- scribus/plugins/scriptplugin/cmdobj.cpp
+++ scribus/plugins/scriptplugin/cmdobj.cpp
@@ -391,7 +391,7 @@ PyObject *scribus_bezierline(PyObject* /* self */, PyObject* args)
}
ScMW->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScMW->view->AdjustItemSize(it);
- if (Name != "")
+ if (*Name)
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
}