# HG changeset patch
# User insilmaril
# Date 1262690592 0
# Node ID 735c7ea1d2a956ab9449e91359c158ae55384cbf
# Parent  8f987e376035023b1dadc12d03ba27a3eb6039c8
Fixed dropping of URLs

diff -r 8f987e376035 -r 735c7ea1d2a9 mainwindow.cpp
--- a/mainwindow.cpp	Mon Jan 04 20:36:06 2010 +0000
+++ b/mainwindow.cpp	Tue Jan 05 11:23:12 2010 +0000
@@ -805,6 +805,16 @@
 	connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) );
 	actionBugzilla2URL=a;
 
+	a = new QAction(tr( "Create URL to Novell Bugzilla","Edit menu" ), this);
+	a->setStatusTip ( tr( "Get data from Novell Bugzilla" ));
+	a->setEnabled (false);
+	actionListBranches.append(a);
+	a->setShortcut ( Qt::Key_B + Qt::SHIFT);
+	a->setShortcutContext (Qt::WindowShortcut);
+	addAction(a);
+	connect( a, SIGNAL( triggered() ), this, SLOT( getBugzillaData() ) );
+	actionGetBugzillaData=a;
+
 	a = new QAction(tr( "Create URL to Novell FATE","Edit menu" ), this);
 	a->setStatusTip ( tr( "Create URL to Novell FATE" ));
 	a->setEnabled (false);
@@ -1621,6 +1631,7 @@
 		branchLinksContextMenu->addAction ( actionBugzilla2URL );
 		if (settings.value( "/mainwindow/showTestMenu",false).toBool() )
 		{
+			branchLinksContextMenu->addAction ( actionGetBugzillaData );
 			branchLinksContextMenu->addAction ( actionFATE2URL );
 		}	
 		branchLinksContextMenu->addSeparator();	
@@ -2648,6 +2659,12 @@
 	if (m) m->editBugzilla2URL();
 }
 
+void Main::getBugzillaData()
+{
+	VymModel *m=currentModel();
+	if (m) m->getBugzillaData();
+}
+
 void Main::editFATE2URL()
 {
 	VymModel *m=currentModel();
diff -r 8f987e376035 -r 735c7ea1d2a9 mainwindow.h
--- a/mainwindow.h	Mon Jan 04 20:36:06 2010 +0000
+++ b/mainwindow.h	Tue Jan 05 11:23:12 2010 +0000
@@ -129,6 +129,7 @@
 	void editLocalURL();
 	void editHeading2URL();
 	void editBugzilla2URL();
+	void getBugzillaData();
 	void editFATE2URL();
 	void openVymLinks(const QStringList &);
 	void editVymLink();
@@ -294,6 +295,7 @@
 	QAction* actionLocalURL;
 	QAction* actionHeading2URL;
 	QAction* actionBugzilla2URL;
+	QAction* actionGetBugzillaData;
 	QAction* actionFATE2URL;
 	QAction *actionOpenVymLink;
 	QAction *actionOpenMultipleVymLinks;
diff -r 8f987e376035 -r 735c7ea1d2a9 mapeditor.cpp
--- a/mapeditor.cpp	Mon Jan 04 20:36:06 2010 +0000
+++ b/mapeditor.cpp	Tue Jan 05 11:23:12 2010 +0000
@@ -1613,21 +1613,43 @@
 	if (selbi)
 	{
 		if (debug)
+		{
 			foreach (QString format,event->mimeData()->formats()) 
 				cout << "MapEditor: Dropped format: "<<qPrintable (format)<<endl;
+			foreach (QString url,event->mimeData()->urls())
+				cout << "  URL:"<<url.toStdString()<<endl;
+			//foreach (QString plain,event->mimeData()->text())
+			//	cout << "   PLAIN:"<<plain.toStdString()<<endl;
+			QByteArray ba=event->mimeData()->data("STRING");
+			
+			QString s;
+			s=ba;
+			cout << "  STRING:" <<s.toStdString()<<endl;
 
+			ba=event->mimeData()->data("TEXT");
+			s=ba;
+			cout << "    TEXT:" <<s.toStdString()<<endl;
 
-		QList <QUrl> uris;
+			ba=event->mimeData()->data("COMPOUND_TEXT");
+			s=ba;
+			cout << "   CTEXT:" <<s.toStdString()<<endl;
+
+			ba=event->mimeData()->data("text/x-moz-url");
+			s=ba;
+			cout << "   x-moz-url:" <<s.toStdString()<<endl;
+			foreach (char b,ba)
+				if (b!=0) cout << "b="<<b<<endl;
+		}
+
 		if (event->mimeData()->hasImage()) 
 		{
 			 QVariant imageData = event->mimeData()->imageData();
 			 model->addFloatImage (qvariant_cast<QPixmap>(imageData));
 		} else
 		if (event->mimeData()->hasUrls())
-			uris=event->mimeData()->urls();
-
-		if (uris.count()>0)
 		{
+			//model->selectLastBranch();
+			QList <QUrl> uris=event->mimeData()->urls();
 			QStringList files;
 			QString s;
 			QString heading;
@@ -1640,7 +1662,9 @@
 					bi=model->addNewBranch();
 					if (bi)
 					{
+						model->select(bi);
 						   /* FIXME-2 
+							 */  
 						s=uris.at(i).toLocalFile();
 						if (!s.isEmpty()) 
 						{
@@ -1648,24 +1672,24 @@
 						   heading = QFileInfo(file).baseName();
 						   files.append(file);
 						   if (file.endsWith(".vym", false))
-							   bi->setVymLink(file);
+							   model->setVymLink(file);
 						   else
-							   bi->setURL(uris.at(i).toString());
+							   model->setURL(uris.at(i).toString());
 					   } else 
 					   {
-						   bo->setURL(uris.at(i).toString());
+						   model->setURL(uris.at(i).toString());
 					   }
-							 */  
 
 					   if (!heading.isEmpty())
-						   bi->setHeading(heading);
+						   model->setHeading(heading);
 					   else
-						   bi->setHeading(uris.at(i).toString());
+						   model->setHeading(uris.at(i).toString());
 						   
+						model->select (bi->parent());	   
 					}
 				}
 			}
-			model->reposition();
+			//model->reposition();
 		}
 	}	
 	event->acceptProposedAction();
diff -r 8f987e376035 -r 735c7ea1d2a9 tex/vym.changelog
--- a/tex/vym.changelog	Mon Jan 04 20:36:06 2010 +0000
+++ b/tex/vym.changelog	Tue Jan 05 11:23:12 2010 +0000
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Tue Jan  5 12:22:27 CET 2010 - vym@insilmaril.de
+
+- Bugfix: Dropping URLs
+
 -------------------------------------------------------------------
 Mon Jan  4 09:36:24 CET 2010 - vym@insilmaril.de
 
diff -r 8f987e376035 -r 735c7ea1d2a9 version.h
--- a/version.h	Mon Jan 04 20:36:06 2010 +0000
+++ b/version.h	Tue Jan 05 11:23:12 2010 +0000
@@ -7,7 +7,7 @@
 #define __VYM_VERSION "1.13.0"
 //#define __VYM_CODENAME "Codename: RC-1"
 #define __VYM_CODENAME "Codename: development version, not for production!"
-#define __VYM_BUILD_DATE "2010-01-04"
+#define __VYM_BUILD_DATE "2010-01-05"
 
 
 bool checkVersion(const QString &);
diff -r 8f987e376035 -r 735c7ea1d2a9 vymmodel.cpp
--- a/vymmodel.cpp	Mon Jan 04 20:36:06 2010 +0000
+++ b/vymmodel.cpp	Tue Jan 05 11:23:12 2010 +0000
@@ -2878,6 +2878,21 @@
 	}
 }	
 
+void VymModel::getBugzillaData()	
+{
+	TreeItem *selti=getSelectedItem();
+	if (selti)
+	{		
+		QString url=selti->getURL();
+		if (!url.isEmpty())
+		{
+			QRegExp rx("(\\d+)");
+			if (rx.indexIn(url) !=-1)
+				cout << "VM::getBugzillaData bug="<<rx.cap(1).toStdString()<<endl;
+		}
+	}
+}	
+
 void VymModel::editFATE2URL()
 {
 	TreeItem *selti=getSelectedItem();
diff -r 8f987e376035 -r 735c7ea1d2a9 vymmodel.h
--- a/vymmodel.h	Mon Jan 04 20:36:06 2010 +0000
+++ b/vymmodel.h	Tue Jan 05 11:23:12 2010 +0000
@@ -391,6 +391,7 @@
 	void editLocalURL();					// edit URL to local file
 	void editHeading2URL();					// copy heading to URL
 	void editBugzilla2URL();				// create URL to Bugzilla
+	void getBugzillaData();					// get data from Novell Bugzilla
 	void editFATE2URL();					// create URL to FATE
 	void editVymLink();						// edit link to another map
 	void setVymLink (const QString &);	// Set vymLink for selection