mapeditor.cpp
changeset 820 735c7ea1d2a9
parent 819 8f987e376035
child 821 4a84d7e444d8
     1.1 --- a/mapeditor.cpp	Mon Jan 04 20:36:06 2010 +0000
     1.2 +++ b/mapeditor.cpp	Tue Jan 05 11:23:12 2010 +0000
     1.3 @@ -1613,21 +1613,43 @@
     1.4  	if (selbi)
     1.5  	{
     1.6  		if (debug)
     1.7 +		{
     1.8  			foreach (QString format,event->mimeData()->formats()) 
     1.9  				cout << "MapEditor: Dropped format: "<<qPrintable (format)<<endl;
    1.10 +			foreach (QString url,event->mimeData()->urls())
    1.11 +				cout << "  URL:"<<url.toStdString()<<endl;
    1.12 +			//foreach (QString plain,event->mimeData()->text())
    1.13 +			//	cout << "   PLAIN:"<<plain.toStdString()<<endl;
    1.14 +			QByteArray ba=event->mimeData()->data("STRING");
    1.15 +			
    1.16 +			QString s;
    1.17 +			s=ba;
    1.18 +			cout << "  STRING:" <<s.toStdString()<<endl;
    1.19  
    1.20 +			ba=event->mimeData()->data("TEXT");
    1.21 +			s=ba;
    1.22 +			cout << "    TEXT:" <<s.toStdString()<<endl;
    1.23  
    1.24 -		QList <QUrl> uris;
    1.25 +			ba=event->mimeData()->data("COMPOUND_TEXT");
    1.26 +			s=ba;
    1.27 +			cout << "   CTEXT:" <<s.toStdString()<<endl;
    1.28 +
    1.29 +			ba=event->mimeData()->data("text/x-moz-url");
    1.30 +			s=ba;
    1.31 +			cout << "   x-moz-url:" <<s.toStdString()<<endl;
    1.32 +			foreach (char b,ba)
    1.33 +				if (b!=0) cout << "b="<<b<<endl;
    1.34 +		}
    1.35 +
    1.36  		if (event->mimeData()->hasImage()) 
    1.37  		{
    1.38  			 QVariant imageData = event->mimeData()->imageData();
    1.39  			 model->addFloatImage (qvariant_cast<QPixmap>(imageData));
    1.40  		} else
    1.41  		if (event->mimeData()->hasUrls())
    1.42 -			uris=event->mimeData()->urls();
    1.43 -
    1.44 -		if (uris.count()>0)
    1.45  		{
    1.46 +			//model->selectLastBranch();
    1.47 +			QList <QUrl> uris=event->mimeData()->urls();
    1.48  			QStringList files;
    1.49  			QString s;
    1.50  			QString heading;
    1.51 @@ -1640,7 +1662,9 @@
    1.52  					bi=model->addNewBranch();
    1.53  					if (bi)
    1.54  					{
    1.55 +						model->select(bi);
    1.56  						   /* FIXME-2 
    1.57 +							 */  
    1.58  						s=uris.at(i).toLocalFile();
    1.59  						if (!s.isEmpty()) 
    1.60  						{
    1.61 @@ -1648,24 +1672,24 @@
    1.62  						   heading = QFileInfo(file).baseName();
    1.63  						   files.append(file);
    1.64  						   if (file.endsWith(".vym", false))
    1.65 -							   bi->setVymLink(file);
    1.66 +							   model->setVymLink(file);
    1.67  						   else
    1.68 -							   bi->setURL(uris.at(i).toString());
    1.69 +							   model->setURL(uris.at(i).toString());
    1.70  					   } else 
    1.71  					   {
    1.72 -						   bo->setURL(uris.at(i).toString());
    1.73 +						   model->setURL(uris.at(i).toString());
    1.74  					   }
    1.75 -							 */  
    1.76  
    1.77  					   if (!heading.isEmpty())
    1.78 -						   bi->setHeading(heading);
    1.79 +						   model->setHeading(heading);
    1.80  					   else
    1.81 -						   bi->setHeading(uris.at(i).toString());
    1.82 +						   model->setHeading(uris.at(i).toString());
    1.83  						   
    1.84 +						model->select (bi->parent());	   
    1.85  					}
    1.86  				}
    1.87  			}
    1.88 -			model->reposition();
    1.89 +			//model->reposition();
    1.90  		}
    1.91  	}	
    1.92  	event->acceptProposedAction();