Index: cmdmani.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v
retrieving revision 1.14
diff -u -r1.14 cmdmani.cpp
--- cmdmani.cpp	10 Dec 2004 19:28:41 -0000	1.14
+++ cmdmani.cpp	12 Dec 2004 13:58:49 -0000
@@ -5,11 +5,11 @@
 {
 	char *Name = "";
 	char *Image;
-	if (!PyArg_ParseTuple(args, "s|s", &Image, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Image, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (item->PType != FRAME_IMAGE)
@@ -17,20 +17,21 @@
 		PyErr_SetString(WrongFrameTypeError, QObject::tr("Target is not an image frame.","python error"));
 		return NULL;
 	}
-	item->OwnPage->LoadPict(QString(Image), item->ItemNr);
+	item->OwnPage->LoadPict(QString::fromUtf8(Image), item->ItemNr);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
 
 PyObject *scribus_scaleimage(PyObject *self, PyObject* args)
 {
+	// FIXME: This function doesn't seem to work...
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(Name);
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (!item->PType == FRAME_IMAGE)
@@ -48,11 +49,11 @@
 {
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (item->OwnPage->GroupSel)
@@ -67,11 +68,11 @@
 {
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (item->OwnPage->GroupSel)
@@ -91,11 +92,11 @@
 {
 	char *Name = "";
 	double x;
-	if (!PyArg_ParseTuple(args, "d|s", &x, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &x, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	item->OwnPage->RotateItem(item->Rot - x, item->ItemNr);
@@ -107,11 +108,11 @@
 {
 	char *Name = "";
 	double x;
-	if (!PyArg_ParseTuple(args, "d|s", &x, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &x, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	item->OwnPage->RotateItem(x * -1.0, item->ItemNr);
@@ -123,11 +124,11 @@
 {
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	item->OwnPage->SizeItem(ValueToPoint(x) - item->Xpos, ValueToPoint(y) - item->Ypos, item->ItemNr);
@@ -155,8 +156,11 @@
 		}
 		for (int i = 0; i < len; i++)
 		{
+			// FIXME: We might need to explicitly get this string as utf8
+			// but as sysdefaultencoding is utf8 it should be a no-op to do
+			// so anyway.
 			Name = PyString_AsString(PyList_GetItem(il, i));
-			PageItem *ic = GetUniqueItem(QString(Name));
+			PageItem *ic = GetUniqueItem(QString::fromUtf8(Name));
 			if (ic == NULL)
 				return NULL;
 			ic->OwnPage->SelectItemNr(ic->ItemNr);
@@ -177,11 +181,11 @@
 PyObject *scribus_ungroupobj(PyObject *self, PyObject* args)
 {
 	char *Name = "";;
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	uint p = Carrier->doc->ActPage->PageNr;
@@ -196,7 +200,7 @@
 {
 	char *Name = "";
 	double sc;
-	if (!PyArg_ParseTuple(args, "d|s", &sc, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &sc, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -205,7 +209,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't scale by 0%","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->OwnPage->Deselect();
@@ -228,6 +232,7 @@
 	if ((i < static_cast<int>(Carrier->doc->ActPage->SelItem.count())) && (i > -1))
 		return PyString_FromString(Carrier->doc->ActPage->SelItem.at(i)->AnName);
 	else
+		// FIXME: Should probably return None if no selection?
 		return PyString_FromString("");
 }
 
@@ -241,11 +246,11 @@
 PyObject *scribus_selectobj(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->OwnPage->SelectItemNr(i->ItemNr);
@@ -266,11 +271,11 @@
 PyObject *scribus_lockobject(PyObject *self, PyObject* args)
 {
 	char *name = "";
-	if (!PyArg_ParseTuple(args, "|s", &name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
 	// FIXME: Rather than toggling the lock, we should probably let the user set the lock state
@@ -284,11 +289,11 @@
 PyObject *scribus_islocked(PyObject *self, PyObject* args)
 {
 	char *name = "";
-	if (!PyArg_ParseTuple(args, "|s", &name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(name);
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
 	if (item->Locked)
