@ -478,9 +478,8 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
}
}
bAccept = true ;
bAccept = true ;
}
} else if ( NULL ! = pMimeData & & pMimeData - > hasUrls ( ) ) {
else if ( NULL ! = event - > mimeData ( ) & & event - > mimeData ( ) - > hasUrls ( ) ) {
QList < QUrl > urls = pMimeData - > urls ( ) ;
QList < QUrl > urls = event - > mimeData ( ) - > urls ( ) ;
foreach ( QUrl eachUrl , urls ) {
foreach ( QUrl eachUrl , urls ) {
QString sUrl = eachUrl . toString ( ) ;
QString sUrl = eachUrl . toString ( ) ;
if ( ! sUrl . startsWith ( " uniboardTool:// " ) & & ! sUrl . startsWith ( " file:// " ) & & ! sUrl . startsWith ( " / " ) ) {
if ( ! sUrl . startsWith ( " uniboardTool:// " ) & & ! sUrl . startsWith ( " file:// " ) & & ! sUrl . startsWith ( " / " ) ) {
@ -503,11 +502,10 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
}
}
}
}
bAccept = true ;
bAccept = true ;
}
} else if ( NULL ! = pMimeData & & pMimeData - > hasText ( ) ) {
else if ( NULL ! = event - > mimeData ( ) & & event - > mimeData ( ) - > hasText ( ) ) {
// The user can only drop an Url in this location so if the text is not an Url,
// The user can only drop an Url in this location so if the text is not an Url,
// we discard it.
// we discard it.
QString qsTxt = event - > mimeData ( ) - > text ( ) . remove ( QRegExp ( " [ \\ 0] " ) ) ;
QString qsTxt = pMimeData - > text ( ) . remove ( QRegExp ( " [ \\ 0] " ) ) ;
if ( qsTxt . startsWith ( " http " ) ) {
if ( qsTxt . startsWith ( " http " ) ) {
// Show the download palette if it is hidden
// Show the download palette if it is hidden
UBApplication : : boardController - > paletteManager ( ) - > startDownloads ( ) ;
UBApplication : : boardController - > paletteManager ( ) - > startDownloads ( ) ;
@ -524,6 +522,27 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
UBDownloadManager : : downloadManager ( ) - > addFileToDownload ( desc ) ;
UBDownloadManager : : downloadManager ( ) - > addFileToDownload ( desc ) ;
bAccept = true ;
bAccept = true ;
}
}
} else if ( NULL ! = pMimeData & & pMimeData - > hasHtml ( ) ) {
QString html = pMimeData - > html ( ) ;
QString url = UBApplication : : urlFromHtml ( html ) ;
if ( " " ! = url )
{
bAccept = true ;
// Show the download palette if it is hidden
UBApplication : : boardController - > paletteManager ( ) - > startDownloads ( ) ;
// Add the dropped url to the download list
sDownloadFileDesc desc ;
desc . currentSize = 0 ;
desc . id = 0 ;
desc . isBackground = false ;
desc . modal = false ;
desc . name = QFileInfo ( url ) . fileName ( ) ;
desc . totalSize = 0 ;
desc . url = url ;
UBDownloadManager : : downloadManager ( ) - > addFileToDownload ( desc ) ;
}
}
}
if ( bAccept ) {
if ( bAccept ) {
event - > accept ( ) ;
event - > accept ( ) ;