Bug 120087

Summary: Problems in the HTML viewer
Product: [Applications] akregator Reporter: András Manţia <amantia>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: NOR    
Version: 1.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description András Manţia 2006-01-14 09:46:26 UTC
Version:           1.2 (using KDE 3.5.0, compiled sources)
Compiler:          Target: x86_64-suse-linux
OS:                Linux (x86_64) release 2.6.13-15.7-default

1. Proxy settings are not honoured. I have set up privoxy to filter the unwanted ads, but they still appear in aKregator as it does not use Konqueror's proxy settings.

2. Clicking on binary links opens the files in the HTML part instead of asking to open in external app or to save. Try to click on a download link from www.kde-apps.org. Related to this, if you explicitely try to save the link from the context menu, you get a "Malformed URL" error. The only way to save the binary data is to first open the page in an external browser.
Comment 1 Frank Osterfeld 2006-01-17 16:05:48 UTC
SVN commit 499312 by osterfeld:

Fix handling of binary files in pageviewer. Increase the breakage in the URL handling of Viewer and PageViewer.
Man, I am so happy that this all goes the way of the dodo in trunk.
CCBUG: 120087


 M  +3 -0      ChangeLog  
 M  +14 -6     src/akregator_view.cpp  
 M  +1 -1      src/akregator_view.h  
 M  +13 -15    src/pageviewer.cpp  
 M  +7 -2      src/viewer.cpp  
 M  +3 -1      src/viewer.h  


--- branches/KDE/3.5/kdepim/akregator/ChangeLog #499311:499312
@@ -7,6 +7,9 @@
 
 Bug fixes:
 
+ 2006/01/17 Do not open binary files in the HTML viewer but externally. 
+            Fix Save Link As for binary files (regression introduced after 1.2) 
+            (#120087 (partially)) -fo
  2006/01/16 Fix article order in Combined View: sort by date (reversed) (#118055) -fo
  2006/01/15 Fix parsing of Atom 1.0 feeds with escaped HTML in it: Don't show tags
             as text (#112491, #117938) -fo
--- branches/KDE/3.5/kdepim/akregator/src/akregator_view.cpp #499311:499312
@@ -306,8 +306,8 @@
 
     connect(m_searchBar, SIGNAL(signalSearch(const Akregator::Filters::ArticleMatcher&, const Akregator::Filters::ArticleMatcher&)), m_articleViewer, SLOT(slotSetFilter(const Akregator::Filters::ArticleMatcher&, const Akregator::Filters::ArticleMatcher&)));
 
-    connect( m_articleViewer, SIGNAL(urlClicked(const KURL&, bool)),
-             this, SLOT(slotUrlClickedInViewer(const KURL&, bool)) );
+    connect( m_articleViewer, SIGNAL(urlClicked(const KURL&, Viewer*, bool, bool)),
+             this, SLOT(slotUrlClickedInViewer(const KURL&, Viewer*, bool, bool)) );
 
     connect( m_articleViewer->browserExtension(), SIGNAL(mouseOverInfo(const KFileItem *)),
                                             this, SLOT(slotMouseOverInfo(const KFileItem *)) );
@@ -430,8 +430,8 @@
 
     connect( page, SIGNAL(setTabIcon(const QPixmap&)),
             this, SLOT(setTabIcon(const QPixmap&)));
-    connect( page, SIGNAL(urlClicked(const KURL &,bool)),
-            this, SLOT(slotUrlClickedInViewer(const KURL &, bool)) );
+    connect( page, SIGNAL(urlClicked(const KURL &, Viewer*, bool, bool)),
+            this, SLOT(slotUrlClickedInViewer(const KURL &, Viewer*, bool, bool)) );
 
     Frame* frame = new Frame(this, page, page->widget(), i18n("Untitled"));
     frame->setAutoDeletePart(true); // delete page viewer when removing the tab
@@ -839,9 +839,17 @@
 }
 
 //TODO: KDE4 remove this ugly ugly hack
-void View::slotUrlClickedInViewer(const KURL& url, bool background)
+void View::slotUrlClickedInViewer(const KURL& url, Viewer* viewer, bool newTab, bool background)
 {
-    slotOpenURL(url, 0L, background ? BrowserRun::NEW_TAB_BACKGROUND : BrowserRun::NEW_TAB_FOREGROUND);
+    
+    if (!newTab)
+    {
+        slotOpenURL(url, viewer, BrowserRun::CURRENT_TAB);
+    }
+    else
+    {
+        slotOpenURL(url, 0L, background ? BrowserRun::NEW_TAB_BACKGROUND : BrowserRun::NEW_TAB_FOREGROUND);
+    }
 }
 
 //TODO: KDE4 remove this ugly ugly hack
--- branches/KDE/3.5/kdepim/akregator/src/akregator_view.h #499311:499312
@@ -294,7 +294,7 @@
             void slotOpenURLReply(const KURL& url, Akregator::Viewer* currentViewer, Akregator::BrowserRun::OpeningMode mode);
 
             /** HACK: part of the url opening hack for 3.5. called when a viewer emits urlClicked(). TODO: Remove for KDE4 */
-            void slotUrlClickedInViewer(const KURL& url, bool background);
+            void slotUrlClickedInViewer(const KURL& url, Viewer* viewer, bool newTab, bool background);
 
             void slotOpenURL(const KURL& url, Akregator::Viewer* currentViewer, Akregator::BrowserRun::OpeningMode mode);
 
--- branches/KDE/3.5/kdepim/akregator/src/pageviewer.cpp #499311:499312
@@ -270,21 +270,6 @@
 
 }
 
-void PageViewer::urlSelected(const QString &url, int button, int state, const QString &_target, KParts::URLArgs args)
-{
-    updateHistoryEntry();
-    if (button == MidButton)
-        Viewer::urlSelected(url, button, state, _target, args);
-    else
-    {
-        browserExtension()->setURLArgs(args);
-        if (_target.lower() == "_blank")
-            Viewer::urlSelected(url, button, state, _target, args);
-        else
-            openURL(completeURL(url) );
-    }
-}
-
 void PageViewer::slotPopupActivated( int id )
 {
     QValueList<HistoryEntry>::Iterator it = d->history.begin();
@@ -360,6 +345,19 @@
     d->stopAction->setEnabled(false);
 }
 
+void PageViewer::urlSelected(const QString &url, int button, int state, const QString &_target, KParts::URLArgs args)
+{
+    if (button == LeftButton)
+    {
+        m_url = completeURL(url);
+        browserExtension()->setURLArgs(args); 
+        slotOpenLinkInThisTab();
+    }
+    else
+    {
+        Viewer::urlSelected(url,button,state,_target,args);
+    }
+}
 
 void PageViewer::slotSetCaption(const QString& cap) 
 {
--- branches/KDE/3.5/kdepim/akregator/src/viewer.cpp #499311:499312
@@ -232,14 +232,19 @@
 
 void Viewer::slotOpenLinkInForegroundTab()
 {
-    emit urlClicked(m_url, false);
+    emit urlClicked(m_url, this, true, false);
 }
 
 void Viewer::slotOpenLinkInBackgroundTab()
 {
-    emit urlClicked(m_url, true);
+    emit urlClicked(m_url, this, true, true);
 }
 
+void Viewer::slotOpenLinkInThisTab()
+{
+    emit urlClicked(m_url, this, false, false);
+}
+
 void Viewer::slotOpenLinkInBrowser()
 {
     displayInExternalBrowser(m_url, QString::null);
--- branches/KDE/3.5/kdepim/akregator/src/viewer.h #499311:499312
@@ -66,7 +66,7 @@
         
         signals:
             /** This gets emitted when url gets clicked */
-            void urlClicked(const KURL& url, bool background=false);
+            void urlClicked(const KURL& url, Viewer* viewer, bool newTab, bool background);
 
             protected: // methods
             int pointsToPixel(int points) const;
@@ -100,6 +100,8 @@
 
             /** Opens @c m_url in background tab */
             virtual void slotOpenLinkInBackgroundTab();
+            
+            virtual void slotOpenLinkInThisTab();
 
             virtual void slotSaveLinkAs();
 
Comment 2 Frank Osterfeld 2006-01-25 23:41:50 UTC
2) is fixed, 1) is a dupe of 118247

*** This bug has been marked as a duplicate of 118247 ***