Summary: | When dragging a URL link with an image, the image is pasted and not the link URL | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Manuel Mejia <kde> |
Component: | khtml | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Mandrake RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | patch-71162-1.diff |
Description
Manuel Mejia
2003-12-24 02:06:01 UTC
Due to this bug it's now impossible to download the linked data by dragging it to an DownloadManager like KGet or D4X (gentoo and KDE 3.2.0). For me it's a main feature that I can easily use a DownloadManager, so I wait for a khtml fix and switched in the meantime to Mozilla as default browser, because Mozilla still worked well with this. Michael ditto here - showed up in beta2 afaict - makes it (nearly) impossible to use download managers like kget. I should have mentioned it then - this behavior is still evident in kde3.2. edfardos(@yahoo.com) It's in khtml_part.cpp (kdelibs), line 5349, comment "// Image inside a link?". That condition is never met, it's treated like a "// Normal image" (confirmed with debugging printfs). --edfardos This bug causes also the grave bug #65553 in KMail! Hi, The attached patch is intended to address the regression with dragging links and images as described in these reports. Please test... Created an attachment (id=5246) patch-71162-1.diff After applying the patch, drag&drop is working properly here (actual cvs, gentoo distribution) Steffen CVS commit by adawit: Backport: - Regression fix for BR# 71162 & BR# 65553. - Set the suggested filename if available when prompting user to save files. CCMAIL: 71162-done@bugs.kde.org CCMAIL: 65553-done@bugs.kde.org M +19 -17 khtml_part.cpp 1.959.2.9 --- kdelibs/khtml/khtml_part.cpp #1.959.2.8:1.959.2.9 @@ -3777,9 +3777,13 @@ bool KHTMLPart::processObjectRequest( kh if ( child->m_type != khtml::ChildFrame::Object ) { + QString suggestedFilename; + if ( child->m_run ) + suggestedFilename = child->m_run->suggestedFilename(); + KParts::BrowserRun::AskSaveResult res = KParts::BrowserRun::askEmbedOrSave( - url, mimetype/*, suggestedFilename */ ); + url, mimetype, suggestedFilename ); switch( res ) { case KParts::BrowserRun::Save: - KHTMLPopupGUIClient::saveURL( widget(), i18n( "Save As" ), url, child->m_args.metaData(), QString::null, 0 /*, suggestedFilename */ ); + KHTMLPopupGUIClient::saveURL( widget(), i18n( "Save As" ), url, child->m_args.metaData(), QString::null, 0, suggestedFilename); // fall-through case KParts::BrowserRun::Cancel: @@ -5364,4 +5368,9 @@ void KHTMLPart::khtmlMouseMoveEvent( kht d->m_bRightMousePressed = false; } + + DOM::DOMString url = event->url(); + DOM::DOMString target = event->target(); + DOM::Node innerNode = event->innerNode(); + #ifndef QT_NO_DRAGANDDROP if( d->m_bDnd && d->m_bMousePressed && @@ -5375,21 +5384,18 @@ void KHTMLPart::khtmlMouseMoveEvent( kht QDragObject *drag = 0; KURL u; - if ( d->m_mousePressNode.handle() && d->m_mousePressNode.handle()->id() == ID_IMG ) + + // qDebug("****************** Event URL: %s", url.string().latin1()); + // qDebug("****************** Event Target: %s", target.string().latin1()); + + // Normal image... + if ( url.length() == 0 && innerNode.handle() && innerNode.handle()->id() == ID_IMG ) { - // Normal image - img = static_cast<HTMLImageElementImpl *>(d->m_mousePressNode.handle()); + img = static_cast<HTMLImageElementImpl *>(innerNode.handle()); u = KURL( completeURL( khtml::parseURL(img->getAttribute(ATTR_SRC)).string() ) ); pix = KMimeType::mimeType("image/png")->pixmap(KIcon::Desktop); } - else if ( event->innerNode().handle() && event->innerNode().handle()->id() == ID_IMG ) - { - // Image inside a link? - img = static_cast<HTMLImageElementImpl *>(event->innerNode().handle()); - u = completeURL( d->m_strSelectedURL ); - pix = KMimeType::mimeType("image/png")->pixmap(KIcon::Desktop); - } else { - // Text link + // Text or image link... u = completeURL( d->m_strSelectedURL ); pix = KMimeType::pixmapForURL(u, 0, KIcon::Desktop, KIcon::SizeMedium); @@ -5423,8 +5429,4 @@ void KHTMLPart::khtmlMouseMoveEvent( kht #endif - DOM::DOMString url = event->url(); - DOM::DOMString target = event->target(); - DOM::Node innerNode = event->innerNode(); - // Not clicked -> mouse over stuff if ( !d->m_bMousePressed ) |