# HG changeset patch
# User insilmaril
# Date 1268127477 0
# Node ID 6a6018ba4cc7e591f139d024e5f2968a258d5021
# Parent  25a950c2eb98c7a74f73118ea25f918a329d36fa
Minor changes to improve remote execution of commands via DBUS

diff -r 25a950c2eb98 -r 6a6018ba4cc7 adaptormodel.cpp
--- a/adaptormodel.cpp	Tue Mar 09 08:29:09 2010 +0000
+++ b/adaptormodel.cpp	Tue Mar 09 09:37:57 2010 +0000
@@ -3,9 +3,11 @@
 #include <QtCore/QString>
 #include <QtCore/QVariant>
 
+#include "mainwindow.h"
 #include "vymmodel.h"
 
 extern QString vymInstanceName;
+extern Main *mainWindow;
 
 AdaptorModel::AdaptorModel(QObject *obj)
          : QDBusAbstractAdaptor(obj)
@@ -45,6 +47,11 @@
 	return QDBusVariant (s);
 }
 
+QDBusVariant AdaptorModel::getCurrentModelID()
+{
+	return QDBusVariant (mainWindow->currentModelID());
+}
+
 QDBusVariant AdaptorModel::getHeading()
 {
 	QString s;
diff -r 25a950c2eb98 -r 6a6018ba4cc7 adaptormodel.h
--- a/adaptormodel.h	Tue Mar 09 08:29:09 2010 +0000
+++ b/adaptormodel.h	Tue Mar 09 09:37:57 2010 +0000
@@ -28,6 +28,7 @@
 	void setCaption(const QString &newCaption);
 public slots: // METHODS
    QDBusVariant query(const QString &query);
+   QDBusVariant getCurrentModelID();
    QDBusVariant getHeading();
    void setHeading (const QString &s);
    QDBusVariant getInstanceName();
diff -r 25a950c2eb98 -r 6a6018ba4cc7 mainwindow.cpp
--- a/mainwindow.cpp	Tue Mar 09 08:29:09 2010 +0000
+++ b/mainwindow.cpp	Tue Mar 09 09:37:57 2010 +0000
@@ -1913,6 +1913,13 @@
 	return NULL;	
 }
 
+uint  Main::currentModelID() const
+{
+	if (currentModel())
+		return currentModel()->getID();
+	return 0;	
+}
+
 VymModel* Main::currentModel() const
 {
 	if ( tabWidget->currentPage())
diff -r 25a950c2eb98 -r 6a6018ba4cc7 mainwindow.h
--- a/mainwindow.h	Tue Mar 09 08:29:09 2010 +0000
+++ b/mainwindow.h	Tue Mar 09 09:37:57 2010 +0000
@@ -74,6 +74,7 @@
 	MapEditor* currentMapEditor() const;
 	VymModel* currentModel() const;
 public:	
+	uint currentModelID() const;
 	VymModel* getModel(uint) const;
     
 private slots:
diff -r 25a950c2eb98 -r 6a6018ba4cc7 vymmodel.cpp
--- a/vymmodel.cpp	Tue Mar 09 08:29:09 2010 +0000
+++ b/vymmodel.cpp	Tue Mar 09 09:37:57 2010 +0000
@@ -3149,7 +3149,7 @@
 	double x,y;
 	int n;
 	bool b,ok;
-	QVariant returnValue;
+	QVariant returnValue="";
 
 	// Split string s into command and parameters
 	parser.parseAtom (atom);
@@ -4183,6 +4183,7 @@
 		qWarning(parser.errorMessage());
 		noErr=false;
 		errorMsg=parser.errorMessage();
+		returnValue=errorMsg;
 	} 
 	return returnValue;
 }