# HG changeset patch
# User insilmaril
# Date 1171886512 0
# Node ID 9ae68208e2fff104489ea8bef260905008c24056
# Parent  fb74fa7bfb4cbbc2dfc7632fcce1e1359b2a2b2a
1.8.67 Bugfixes

diff -r fb74fa7bfb4c -r 9ae68208e2ff exports.cpp
--- a/exports.cpp	Mon Feb 12 09:28:47 2007 +0000
+++ b/exports.cpp	Mon Feb 19 12:01:52 2007 +0000
@@ -166,6 +166,7 @@
 	if (mapCenter) me=mapCenter->getMapEditor();
 	if (me)
 	{
+		cout << "starting KDE export\n";
 		WarningDialog dia;
 		dia.showCancelButton (true);
 		dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE"));
@@ -179,9 +180,11 @@
 			p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
 			p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
 			p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
+			cout << "Trying to call vym2kde\n";
 			p.process();
 
 			QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
+			cout << "Trying to call "<<ub.ascii()<<endl;
 			QProcess *proc= new QProcess ;
 			proc->start( ub);
 			if (!proc->waitForStarted())
diff -r fb74fa7bfb4c -r 9ae68208e2ff exportxhtmldialog.cpp
--- a/exportxhtmldialog.cpp	Mon Feb 12 09:28:47 2007 +0000
+++ b/exportxhtmldialog.cpp	Mon Feb 19 12:01:52 2007 +0000
@@ -394,8 +394,7 @@
 					   tr("Could not start %1").arg(spath) );
 	} else
 	{
-		scriptProc->waitFinished();
-		if (scriptProc->exitStatus()!=QProcess::NormalExit )
+		if (!scriptProc->waitForFinished())
 			QMessageBox::critical( 0, tr( "Critical Error" ),
 			   tr("%1 didn't exit normally").arg(spath) +
 			   scriptProc->getErrout() );
diff -r fb74fa7bfb4c -r 9ae68208e2ff file.cpp
--- a/file.cpp	Mon Feb 12 09:28:47 2007 +0000
+++ b/file.cpp	Mon Feb 19 12:01:52 2007 +0000
@@ -210,7 +210,7 @@
 		{
 			if (zipProc->exitCode()>0)
 			{
-				if (zipProc->exitStatus()==9)
+				if (zipProc->exitCode()==9)
 					// no zipped file, but maybe .xml or old version? Try again.
 					err=nozip;
 				else	
diff -r fb74fa7bfb4c -r 9ae68208e2ff headingobj.cpp
--- a/headingobj.cpp	Mon Feb 12 09:28:47 2007 +0000
+++ b/headingobj.cpp	Mon Feb 19 12:01:52 2007 +0000
@@ -90,12 +90,13 @@
     bbox.setSize (QSizeF(w,h));
 }
 
-QGraphicsTextItem* HeadingObj::newLine(QString s)
+QGraphicsSimpleTextItem* HeadingObj::newLine(QString s)
 {
-    QGraphicsTextItem *t=scene->addText(s);
+    QGraphicsSimpleTextItem *t=new QGraphicsSimpleTextItem (s,0,scene);
     t->setFont (font);
     t->setZValue(Z_TEXT);
-    t->setDefaultTextColor(color);
+    //t->setDefaultTextColor(color);
+    t->setBrush(color);
     return t;
 }
 
@@ -217,7 +218,8 @@
     {
 		color=c;
 		for (int i=0; i<textline.size(); ++i)
-			textline.at(i)->setDefaultTextColor(c);
+			//textline.at(i)->setDefaultTextColor(c);
+			textline.at(i)->setBrush(c);
     }	    
 }
 
diff -r fb74fa7bfb4c -r 9ae68208e2ff headingobj.h
--- a/headingobj.h	Mon Feb 12 09:28:47 2007 +0000
+++ b/headingobj.h	Mon Feb 19 12:01:52 2007 +0000
@@ -15,7 +15,7 @@
     virtual void positionBBox();
 	virtual void calcBBoxSize();
 private:
-    QGraphicsTextItem* newLine(QString);		// generate new textline
+    QGraphicsSimpleTextItem* newLine(QString);		// generate new textline
 public:    
     virtual void setText(QString);
     virtual QString text();
@@ -30,7 +30,7 @@
 protected:
     QString heading;
     int textwidth;								// width for formatting text
-    QList <QGraphicsTextItem*> textline;		// a part of e.g. the parabel
+    QList <QGraphicsSimpleTextItem*> textline;	// a part of e.g. the parabel
     QColor color;
     QFont font;
 };
diff -r fb74fa7bfb4c -r 9ae68208e2ff mainwindow.cpp
--- a/mainwindow.cpp	Mon Feb 12 09:28:47 2007 +0000
+++ b/mainwindow.cpp	Mon Feb 19 12:01:52 2007 +0000
@@ -1780,7 +1780,7 @@
 			if (!file.exists() )
 			{
 				// mapname.xml does not exist, well, 
-				// maybe some renamed the mapname.vym file...
+				// maybe someone renamed the mapname.vym file...
 				// Try to find any .xml in the toplevel 
 				// directory of the .vym file
 				QStringList flist=QDir (tmpMapDir).entryList("*.xml");
@@ -2793,7 +2793,7 @@
 void Main::editUnScrollAll()
 {
 	if (currentMapEditor())
-		currentMapEditor()->unScrollAll();	
+		currentMapEditor()->unscrollChilds();	
 }
 
 void Main::editNewBranch()
diff -r fb74fa7bfb4c -r 9ae68208e2ff mapeditor.cpp
--- a/mapeditor.cpp	Mon Feb 12 09:28:47 2007 +0000
+++ b/mapeditor.cpp	Mon Feb 19 12:01:52 2007 +0000
@@ -3003,17 +3003,21 @@
 	}
 }
 
-void MapEditor::unScrollAll()
+void MapEditor::unscrollChilds() // FIXME saveState missing
 {
-	BranchObj *bo;
-	bo=mapCenter->first();
-	while (bo) 
+	BranchObj *bo=xelection.getBranch();
+	if (bo)
 	{
-		if (bo->isScrolled()) bo->toggleScroll();
-		bo=bo->next();
-	}
+		bo->first();
+		while (bo) 
+		{
+			if (bo->isScrolled()) bo->toggleScroll();
+			bo=bo->next();
+		}
+	}	
 }
 
+
 void MapEditor::loadFloatImage ()
 {
 	BranchObj *bo=xelection.getBranch();
@@ -3268,10 +3272,8 @@
 	WarningDialog dia;
 	dia.showCancelButton (true);
 	dia.setText("This is a longer \nWarning");
-	/*
 	dia.setCaption("Warning: Flux problem");
 	dia.setShowAgainName("/warnings/mapeditor");
-	*/
 	if (dia.exec()==QDialog::Accepted)
 		cout << "accepted!\n";
 	else	
@@ -3603,8 +3605,6 @@
 					else	
 						lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() -lmosel->getTopPad());
 				} 
-				// reposition subbranch
-				lmosel->reposition();	
 
 				if (lmo && (lmo!=lmosel) && xelection.getBranch() ) 
 				{
@@ -3621,6 +3621,8 @@
 				{
 					lmosel->unsetParObjTmp();
 				}		
+				// reposition subbranch
+				lmosel->reposition();	
 			} // depth>0
 
 		} // no FloatImageObj
@@ -3863,30 +3865,34 @@
 			QString s;
 			QString heading;
 			BranchObj *bo;
-			for (int i=0; i<uris.count();++i)
+			for (int i=0; i<uris.count();i++)
 			{
-				bo=sel->addBranch();
-				if (bo)
+				// Workaround to avoid adding empty branches
+				if (!uris.at(i).toString().isEmpty())
 				{
-					s=uris.at(i).toLocalFile();
-					if (!s.isEmpty()) 
+					bo=sel->addBranch();
+					if (bo)
 					{
-                       QString file = QDir::convertSeparators(s);
-                       heading = QFileInfo(file).baseName();
-                       files.append(file);
-                       if (file.endsWith(".vym", false))
-                           bo->setVymLink(file);
-                       else
-                           bo->setURL(uris.at(i).toString());
-                   } else 
-				   {
-                       bo->setURL(uris.at(i).toString());
-                   }
-
-                   if (!heading.isEmpty())
-                       bo->setHeading(heading);
-                   else
-                       bo->setHeading(uris.at(i).toString());
+						s=uris.at(i).toLocalFile();
+						if (!s.isEmpty()) 
+						{
+						   QString file = QDir::convertSeparators(s);
+						   heading = QFileInfo(file).baseName();
+						   files.append(file);
+						   if (file.endsWith(".vym", false))
+							   bo->setVymLink(file);
+						   else
+							   bo->setURL(uris.at(i).toString());
+					   } else 
+					   {
+						   bo->setURL(uris.at(i).toString());
+					   }
+
+					   if (!heading.isEmpty())
+						   bo->setHeading(heading);
+					   else
+						   bo->setHeading(uris.at(i).toString());
+					}
 				}
 			}
 			mapCenter->reposition();
diff -r fb74fa7bfb4c -r 9ae68208e2ff mapeditor.h
--- a/mapeditor.h	Mon Feb 12 09:28:47 2007 +0000
+++ b/mapeditor.h	Mon Feb 19 12:01:52 2007 +0000
@@ -161,7 +161,7 @@
 	bool scrollBranch();
 	bool unscrollBranch();
     void toggleScroll();
-    void unScrollAll();
+    void unscrollChilds();
 	void loadFloatImage ();
 	void saveFloatImage ();
 	void setFrame(const FrameType &);
diff -r fb74fa7bfb4c -r 9ae68208e2ff xml.cpp
--- a/xml.cpp	Mon Feb 12 09:28:47 2007 +0000
+++ b/xml.cpp	Mon Feb 19 12:01:52 2007 +0000
@@ -23,6 +23,7 @@
 
 QString mapBuilderHandler::errorProtocol() { return errorProt; }
 
+
 bool mapBuilderHandler::startDocument()
 {
     errorProt = "";
@@ -52,10 +53,12 @@
 {
     QColor col;
 	/* Testing
-	cout << "startElement <"<< eName.ascii()<<
-		">  state="<<state <<
-		"  laststate="<<stateStack.last()<<
-		"   loadMode="<<loadMode<<endl;
+	cout << "startElement <"<< eName.ascii()
+		<<">  state="<<state 
+		<<"  laststate="<<stateStack.last()
+		<<"   loadMode="<<loadMode
+		<<"       line="<<QXmlDefaultHandler::lineNumber()
+		<<endl;
 	*/	
 	stateStack.append (state);	
     if ( state == StateInit && (eName == "vymmap")  )