Fixed dropping of URLs
authorinsilmaril
Tue, 05 Jan 2010 11:23:12 +0000
changeset 820735c7ea1d2a9
parent 819 8f987e376035
child 821 4a84d7e444d8
Fixed dropping of URLs
mainwindow.cpp
mainwindow.h
mapeditor.cpp
tex/vym.changelog
version.h
vymmodel.cpp
vymmodel.h
     1.1 --- a/mainwindow.cpp	Mon Jan 04 20:36:06 2010 +0000
     1.2 +++ b/mainwindow.cpp	Tue Jan 05 11:23:12 2010 +0000
     1.3 @@ -805,6 +805,16 @@
     1.4  	connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) );
     1.5  	actionBugzilla2URL=a;
     1.6  
     1.7 +	a = new QAction(tr( "Create URL to Novell Bugzilla","Edit menu" ), this);
     1.8 +	a->setStatusTip ( tr( "Get data from Novell Bugzilla" ));
     1.9 +	a->setEnabled (false);
    1.10 +	actionListBranches.append(a);
    1.11 +	a->setShortcut ( Qt::Key_B + Qt::SHIFT);
    1.12 +	a->setShortcutContext (Qt::WindowShortcut);
    1.13 +	addAction(a);
    1.14 +	connect( a, SIGNAL( triggered() ), this, SLOT( getBugzillaData() ) );
    1.15 +	actionGetBugzillaData=a;
    1.16 +
    1.17  	a = new QAction(tr( "Create URL to Novell FATE","Edit menu" ), this);
    1.18  	a->setStatusTip ( tr( "Create URL to Novell FATE" ));
    1.19  	a->setEnabled (false);
    1.20 @@ -1621,6 +1631,7 @@
    1.21  		branchLinksContextMenu->addAction ( actionBugzilla2URL );
    1.22  		if (settings.value( "/mainwindow/showTestMenu",false).toBool() )
    1.23  		{
    1.24 +			branchLinksContextMenu->addAction ( actionGetBugzillaData );
    1.25  			branchLinksContextMenu->addAction ( actionFATE2URL );
    1.26  		}	
    1.27  		branchLinksContextMenu->addSeparator();	
    1.28 @@ -2648,6 +2659,12 @@
    1.29  	if (m) m->editBugzilla2URL();
    1.30  }
    1.31  
    1.32 +void Main::getBugzillaData()
    1.33 +{
    1.34 +	VymModel *m=currentModel();
    1.35 +	if (m) m->getBugzillaData();
    1.36 +}
    1.37 +
    1.38  void Main::editFATE2URL()
    1.39  {
    1.40  	VymModel *m=currentModel();
     2.1 --- a/mainwindow.h	Mon Jan 04 20:36:06 2010 +0000
     2.2 +++ b/mainwindow.h	Tue Jan 05 11:23:12 2010 +0000
     2.3 @@ -129,6 +129,7 @@
     2.4  	void editLocalURL();
     2.5  	void editHeading2URL();
     2.6  	void editBugzilla2URL();
     2.7 +	void getBugzillaData();
     2.8  	void editFATE2URL();
     2.9  	void openVymLinks(const QStringList &);
    2.10  	void editVymLink();
    2.11 @@ -294,6 +295,7 @@
    2.12  	QAction* actionLocalURL;
    2.13  	QAction* actionHeading2URL;
    2.14  	QAction* actionBugzilla2URL;
    2.15 +	QAction* actionGetBugzillaData;
    2.16  	QAction* actionFATE2URL;
    2.17  	QAction *actionOpenVymLink;
    2.18  	QAction *actionOpenMultipleVymLinks;
     3.1 --- a/mapeditor.cpp	Mon Jan 04 20:36:06 2010 +0000
     3.2 +++ b/mapeditor.cpp	Tue Jan 05 11:23:12 2010 +0000
     3.3 @@ -1613,21 +1613,43 @@
     3.4  	if (selbi)
     3.5  	{
     3.6  		if (debug)
     3.7 +		{
     3.8  			foreach (QString format,event->mimeData()->formats()) 
     3.9  				cout << "MapEditor: Dropped format: "<<qPrintable (format)<<endl;
    3.10 +			foreach (QString url,event->mimeData()->urls())
    3.11 +				cout << "  URL:"<<url.toStdString()<<endl;
    3.12 +			//foreach (QString plain,event->mimeData()->text())
    3.13 +			//	cout << "   PLAIN:"<<plain.toStdString()<<endl;
    3.14 +			QByteArray ba=event->mimeData()->data("STRING");
    3.15 +			
    3.16 +			QString s;
    3.17 +			s=ba;
    3.18 +			cout << "  STRING:" <<s.toStdString()<<endl;
    3.19  
    3.20 +			ba=event->mimeData()->data("TEXT");
    3.21 +			s=ba;
    3.22 +			cout << "    TEXT:" <<s.toStdString()<<endl;
    3.23  
    3.24 -		QList <QUrl> uris;
    3.25 +			ba=event->mimeData()->data("COMPOUND_TEXT");
    3.26 +			s=ba;
    3.27 +			cout << "   CTEXT:" <<s.toStdString()<<endl;
    3.28 +
    3.29 +			ba=event->mimeData()->data("text/x-moz-url");
    3.30 +			s=ba;
    3.31 +			cout << "   x-moz-url:" <<s.toStdString()<<endl;
    3.32 +			foreach (char b,ba)
    3.33 +				if (b!=0) cout << "b="<<b<<endl;
    3.34 +		}
    3.35 +
    3.36  		if (event->mimeData()->hasImage()) 
    3.37  		{
    3.38  			 QVariant imageData = event->mimeData()->imageData();
    3.39  			 model->addFloatImage (qvariant_cast<QPixmap>(imageData));
    3.40  		} else
    3.41  		if (event->mimeData()->hasUrls())
    3.42 -			uris=event->mimeData()->urls();
    3.43 -
    3.44 -		if (uris.count()>0)
    3.45  		{
    3.46 +			//model->selectLastBranch();
    3.47 +			QList <QUrl> uris=event->mimeData()->urls();
    3.48  			QStringList files;
    3.49  			QString s;
    3.50  			QString heading;
    3.51 @@ -1640,7 +1662,9 @@
    3.52  					bi=model->addNewBranch();
    3.53  					if (bi)
    3.54  					{
    3.55 +						model->select(bi);
    3.56  						   /* FIXME-2 
    3.57 +							 */  
    3.58  						s=uris.at(i).toLocalFile();
    3.59  						if (!s.isEmpty()) 
    3.60  						{
    3.61 @@ -1648,24 +1672,24 @@
    3.62  						   heading = QFileInfo(file).baseName();
    3.63  						   files.append(file);
    3.64  						   if (file.endsWith(".vym", false))
    3.65 -							   bi->setVymLink(file);
    3.66 +							   model->setVymLink(file);
    3.67  						   else
    3.68 -							   bi->setURL(uris.at(i).toString());
    3.69 +							   model->setURL(uris.at(i).toString());
    3.70  					   } else 
    3.71  					   {
    3.72 -						   bo->setURL(uris.at(i).toString());
    3.73 +						   model->setURL(uris.at(i).toString());
    3.74  					   }
    3.75 -							 */  
    3.76  
    3.77  					   if (!heading.isEmpty())
    3.78 -						   bi->setHeading(heading);
    3.79 +						   model->setHeading(heading);
    3.80  					   else
    3.81 -						   bi->setHeading(uris.at(i).toString());
    3.82 +						   model->setHeading(uris.at(i).toString());
    3.83  						   
    3.84 +						model->select (bi->parent());	   
    3.85  					}
    3.86  				}
    3.87  			}
    3.88 -			model->reposition();
    3.89 +			//model->reposition();
    3.90  		}
    3.91  	}	
    3.92  	event->acceptProposedAction();
     4.1 --- a/tex/vym.changelog	Mon Jan 04 20:36:06 2010 +0000
     4.2 +++ b/tex/vym.changelog	Tue Jan 05 11:23:12 2010 +0000
     4.3 @@ -1,3 +1,8 @@
     4.4 +-------------------------------------------------------------------
     4.5 +Tue Jan  5 12:22:27 CET 2010 - vym@insilmaril.de
     4.6 +
     4.7 +- Bugfix: Dropping URLs
     4.8 +
     4.9  -------------------------------------------------------------------
    4.10  Mon Jan  4 09:36:24 CET 2010 - vym@insilmaril.de
    4.11  
     5.1 --- a/version.h	Mon Jan 04 20:36:06 2010 +0000
     5.2 +++ b/version.h	Tue Jan 05 11:23:12 2010 +0000
     5.3 @@ -7,7 +7,7 @@
     5.4  #define __VYM_VERSION "1.13.0"
     5.5  //#define __VYM_CODENAME "Codename: RC-1"
     5.6  #define __VYM_CODENAME "Codename: development version, not for production!"
     5.7 -#define __VYM_BUILD_DATE "2010-01-04"
     5.8 +#define __VYM_BUILD_DATE "2010-01-05"
     5.9  
    5.10  
    5.11  bool checkVersion(const QString &);
     6.1 --- a/vymmodel.cpp	Mon Jan 04 20:36:06 2010 +0000
     6.2 +++ b/vymmodel.cpp	Tue Jan 05 11:23:12 2010 +0000
     6.3 @@ -2878,6 +2878,21 @@
     6.4  	}
     6.5  }	
     6.6  
     6.7 +void VymModel::getBugzillaData()	
     6.8 +{
     6.9 +	TreeItem *selti=getSelectedItem();
    6.10 +	if (selti)
    6.11 +	{		
    6.12 +		QString url=selti->getURL();
    6.13 +		if (!url.isEmpty())
    6.14 +		{
    6.15 +			QRegExp rx("(\\d+)");
    6.16 +			if (rx.indexIn(url) !=-1)
    6.17 +				cout << "VM::getBugzillaData bug="<<rx.cap(1).toStdString()<<endl;
    6.18 +		}
    6.19 +	}
    6.20 +}	
    6.21 +
    6.22  void VymModel::editFATE2URL()
    6.23  {
    6.24  	TreeItem *selti=getSelectedItem();
     7.1 --- a/vymmodel.h	Mon Jan 04 20:36:06 2010 +0000
     7.2 +++ b/vymmodel.h	Tue Jan 05 11:23:12 2010 +0000
     7.3 @@ -391,6 +391,7 @@
     7.4  	void editLocalURL();					// edit URL to local file
     7.5  	void editHeading2URL();					// copy heading to URL
     7.6  	void editBugzilla2URL();				// create URL to Bugzilla
     7.7 +	void getBugzillaData();					// get data from Novell Bugzilla
     7.8  	void editFATE2URL();					// create URL to FATE
     7.9  	void editVymLink();						// edit link to another map
    7.10  	void setVymLink (const QString &);	// Set vymLink for selection