+
 #include "mapeditor.h"
 
 VymView::VymView(VymModel *model)
 {
 	// Create TreeView
-	QTreeView *treeview=new QTreeView;
+	treeview=new QTreeView;
 	treeview->setModel ((QAbstractItemModel*)model);
 	treeview->setMinimumWidth (350);
 	treeview->setColumnWidth (0,350);
 
+	// ItemSelectionModel
+	selModel=treeview->selectionModel();
+	connect (
+		selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), 
+		this,SLOT (changeSelection(const QItemSelection &,const QItemSelection &)));
+	model->setSelectionModel (selModel);
+
 	// Create good old MapEditor
 	MapEditor* me=model->getMapEditor();
 	if (!me) me=new MapEditor (model);
 
-	me->setSelectionModel (treeview->selectionModel() );
+	me->setSelectionModel (selModel);
 
 	//me->viewport()->setFocus();
 	//FIXME me->setAntiAlias (actionViewToggleAntiAlias->isOn());
@@ -32,8 +41,17 @@
 
 QItemSelectionModel* VymView::selectionModel() 
 {
-	if (treeview) return treeview->selectionModel();
+	if (treeview) return selModel;
+	else std::cout <<"hey, no treeview so far???\n";
 	return NULL;
 }
 
 
+void VymView::changeSelection (const QItemSelection &newSel, const QItemSelection &delSel)
+{
+	// FIXME Currently this works only from treeview->ME
+	treeview->expandAll();	//FIXME only for testing
+
+	((VymModel*)treeview->model())->select ();
+}
+
diff -r 7f43b93242aa -r 96402b172173 vymview.h
--- a/vymview.h	Mon Oct 06 11:10:20 2008 +0000
+++ b/vymview.h	Wed Oct 29 17:42:34 2008 +0000
@@ -10,11 +10,17 @@
 
 class VymView : public QSplitter 
 {
+	Q_OBJECT
 public:
 	VymView(VymModel *model);
 	QItemSelectionModel* selectionModel();
+
+public slots:
+	void changeSelection (const QItemSelection &newSel, const QItemSelection &delSel);
+
 private:
 	QTreeView *treeview;
+	QItemSelectionModel *selModel;
 };
 
 
diff -r 7f43b93242aa -r 96402b172173 xml-vym.cpp
--- a/xml-vym.cpp	Mon Oct 06 11:10:20 2008 +0000
+++ b/xml-vym.cpp	Wed Oct 29 17:42:34 2008 +0000
@@ -47,25 +47,6 @@
 	{
         state = StateMap;
 
-		if (loadMode==NewMap)
-			model->clear();	// remove existing mapCenter
-
-		// Check version
-		if (!atts.value( "version").isEmpty() ) 
-		{
-			if (!checkVersion(atts.value("version")))
-				QMessageBox::warning( 0, "Warning: Version Problem" ,
-				   "Map is newer than VYM
"
-				   "The map you are just trying to load was "
-				   "saved using vym " +atts.value("version")+". "
-				   "The version of this vym is " + vymVersion + 
-				   ". If you run into problems after pressing "
-				   "the ok-button below, updating vym should help.");
-			else	   
-				model->setVersion(atts.value( "version" ));
-
-		}
-
 		if (loadMode==NewMap )
 		{
 			// Create mapCenter
@@ -108,6 +89,22 @@
 			if (!atts.value( "defXLinkWidth").isEmpty() ) 
 				model->setMapDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
 		}	
+		// Check version
+		if (!atts.value( "version").isEmpty() ) 
+		{
+			if (!checkVersion(atts.value("version")))
+				QMessageBox::warning( 0, "Warning: Version Problem" ,
+				   "
Map is newer than VYM
"
+				   "The map you are just trying to load was "
+				   "saved using vym " +atts.value("version")+". "
+				   "The version of this vym is " + vymVersion + 
+				   ". If you run into problems after pressing "
+				   "the ok-button below, updating vym should help.");
+			else	   
+				model->setVersion(atts.value( "version" ));
+
+		}
+
 	} else if ( eName == "select" && state == StateMap ) 
 	{
 		state=StateMapSelect;