SOURCES: kdepim-branch.diff - updated

arekm arekm at pld-linux.org
Thu Sep 7 17:18:04 CEST 2006


Author: arekm                        Date: Thu Sep  7 15:18:04 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- updated

---- Files affected:
SOURCES:
   kdepim-branch.diff (1.19 -> 1.20) 

---- Diffs:

================================================================
Index: SOURCES/kdepim-branch.diff
diff -u SOURCES/kdepim-branch.diff:1.19 SOURCES/kdepim-branch.diff:1.20
--- SOURCES/kdepim-branch.diff:1.19	Tue Aug  8 08:10:53 2006
+++ SOURCES/kdepim-branch.diff	Thu Sep  7 17:17:59 2006
@@ -1,7 +1,782 @@
+Index: akregator/ChangeLog
+===================================================================
+--- akregator/ChangeLog	(.../tags/KDE/3.5.4/kdepim)	(revision 581794)
++++ akregator/ChangeLog	(.../branches/KDE/3.5/kdepim)	(revision 581794)
+@@ -2,6 +2,22 @@
+ ===================
+ (c) 2004-2006 the Akregator authors.
+ 
++Changes after 1.2.4:
++-----------------------------
++
++Bug fixes:
++
++ 2006/08/28 Do not create multiple items in the feed lists when dragging feeds to a folder
++            that was moved before (#124303) -fo
++ 2006/08/26 Fix a possible crash in the internal browser when going forward -fo
++ 2006/08/26 show error messages while browsing as HTML, not as annoying popups (#107740) -fo
++ 2006/08/25 Show title of selected feed in window caption (#111471) -fo
++ 2006/08/25 Konqueror plugins: correctly enable/disable icon when enabling/disabling the plugin (#132823) -fo
++ 2006/08/21 Don't crash on very long URLs (>255 chars) used for feed logos (#130849) -fo
++ 2006/08/20 Konqueror plugins: Fix crash when using the Akregator plugin in file manager mode (#124891) -fo
++ 2006/08/20 Feed detection: Fix detection when relative URLs are used in the link tags (#132687) -fo
++ 2006/08/17 Speak selected text in internal browser when using the "Speak Text" button (#132505) -fo
++
+ Changes after 1.2.3:
+ -----------------------------
+ 
+Index: akregator/src/aboutdata.cpp
+===================================================================
+--- akregator/src/aboutdata.cpp	(.../tags/KDE/3.5.4/kdepim)	(revision 581794)
++++ akregator/src/aboutdata.cpp	(.../branches/KDE/3.5/kdepim)	(revision 581794)
+@@ -31,7 +31,7 @@
+ AboutData::AboutData()
+     : KAboutData("akregator", I18N_NOOP("Akregator"), AKREGATOR_VERSION, I18N_NOOP("A KDE Feed Aggregator"),
+                  License_GPL, I18N_NOOP("(C) 2004, 2005 Akregator developers"), 0,
+-                     "http://akregator.sourceforge.net/")
++                     "http://akregator.kde.org/")
+ {
+     addAuthor( "Frank Osterfeld", I18N_NOOP("Maintainer"), "frank.osterfeld at kdemail.net" );
+     addAuthor( "Teemu Rytilahti", I18N_NOOP("Developer"), "tpr at d5k.net" );
+Index: akregator/src/articleviewer.cpp
+===================================================================
+--- akregator/src/articleviewer.cpp	(.../tags/KDE/3.5.4/kdepim)	(revision 581794)
++++ akregator/src/articleviewer.cpp	(.../branches/KDE/3.5/kdepim)	(revision 581794)
+@@ -384,7 +384,7 @@
+             "<p>Thank you,</p>\n"
+             "<p style='margin-bottom: 0px'>&nbsp; &nbsp; The Akregator Team</p>\n")
+             .arg(AKREGATOR_VERSION) // Akregator version
+-            .arg("http://akregator.sourceforge.net/"); // Akregator homepage URL
++            .arg("http://akregator.kde.org/"); // Akregator homepage URL
+ 
+     QString fontSize = QString::number( pointsToPixel( Settings::mediumFontSize() ));
+     QString appTitle = i18n("Akregator");
+@@ -428,8 +428,7 @@
+ 
+     if (feed && !feed->image().isNull())
+     {
+-        QString url=feed->xmlUrl();
+-        QString file = url.replace("/", "_").replace(":", "_");
++        QString file = Utils::fileNameForUrl(feed->xmlUrl());
+         KURL u(m_imageDir);
+         u.setFileName(file);
+         text += QString("<a href=\"%1\"><img class=\"headimage\" src=\"%2.png\"></a>\n").arg(feed->htmlUrl()).arg(u.url());
+@@ -493,13 +492,15 @@
+     QString text;
+     text = QString("<div class=\"headerbox\" dir=\"%1\">\n").arg(QApplication::reverseLayout() ? "rtl" : "ltr");
+ 
++    KURL link = article.link();
++    
+     if (!article.title().isEmpty())
+     {
+         text += QString("<div class=\"headertitle\" dir=\"%1\">\n").arg(directionOf(Utils::stripTags(article.title())));
+-        if (article.link().isValid())
+-            text += "<a href=\""+article.link().url()+"\">";
++        if (link.isValid())
++            text += "<a href=\""+link.url()+"\">";
+         text += article.title().replace("<", "&lt;").replace(">", "&gt;"); // TODO: better leave things escaped in the parser
+-        if (article.link().isValid())
++        if (link.isValid())
+             text += "</a>";
+         text += "</div>\n";
+     }
+@@ -524,8 +525,7 @@
+ 
+     if (feed && !feed->image().isNull())
+     {
+-        QString url=feed->xmlUrl();
+-        QString file = url.replace("/", "_").replace(":", "_");
++        QString file = Utils::fileNameForUrl(feed->xmlUrl());
+         KURL u(m_imageDir);
+         u.setFileName(file);
+         text += QString("<a href=\"%1\"><img class=\"headimage\" src=\"%2.png\"></a>\n").arg(feed->htmlUrl()).arg(u.url());
+@@ -554,13 +554,13 @@
+         text += "</a>";
+     }
+ 
+-    if (article.link().isValid() || (article.guidIsPermaLink() && KURL(article.guid()).isValid()))
++    if (link.isValid() || (article.guidIsPermaLink() && KURL(article.guid()).isValid()))
+     {
+         text += "<p><a class=\"contentlink\" href=\"";
+         // in case link isn't valid, fall back to the guid permaLink.
+-        if (article.link().isValid())
++        if (link.isValid())
+         {
+-            text += article.link().url();
++            text += link.url();
+         }
+         else
+          {
+Index: akregator/src/feed.cpp
+===================================================================
+--- akregator/src/feed.cpp	(.../tags/KDE/3.5.4/kdepim)	(revision 581794)
++++ akregator/src/feed.cpp	(.../branches/KDE/3.5/kdepim)	(revision 581794)
+@@ -46,6 +46,7 @@
+ #include "feedstorage.h"
+ #include "storage.h"
+ #include "treenodevisitor.h"
++#include "utils.h"
+ 
+ #include "librss/librss.h"
+ 
+@@ -205,8 +206,9 @@
+ 
+ void Feed::loadImage()
+ {
+-    QString u = d->xmlUrl;
+-    QString imageFileName = KGlobal::dirs()->saveLocation("cache", "akregator/Media/") + u.replace("/", "_").replace(":", "_")+".png";
++    QString imageFileName = KGlobal::dirs()->saveLocation("cache", "akregator/Media/") 
++                            + Utils::fileNameForUrl(d->xmlUrl) + 
++".png";
+     d->imagePixmap.load(imageFileName, "PNG");
+ }
+         
+@@ -585,8 +587,9 @@
+     if (image.isNull())
+         return;
+     d->imagePixmap=image;
+-    QString u = d->xmlUrl;
+-    d->imagePixmap.save(KGlobal::dirs()->saveLocation("cache", "akregator/Media/")+u.replace("/", "_").replace(":", "_")+".png","PNG");
++    d->imagePixmap.save(KGlobal::dirs()->saveLocation("cache", "akregator/Media/") 
++                        + Utils::fileNameForUrl(d->xmlUrl) + 
++".png","PNG");
+     nodeModified();
+ }
+ 
+Index: akregator/src/articlelistview.cpp
+===================================================================
+--- akregator/src/articlelistview.cpp	(.../tags/KDE/3.5.4/kdepim)	(revision 581794)
++++ akregator/src/articlelistview.cpp	(.../branches/KDE/3.5/kdepim)	(revision 581794)
+@@ -424,6 +424,11 @@
+         setSelected(next, true);
+         setCurrentItem(next);
+     }
++    else
++    {
++        d->noneSelected = true;
++    }
++    
+ 
+     setUpdatesEnabled(true);
+     triggerUpdate();
+@@ -465,7 +470,11 @@
+         setSelected(next, true);
+         setCurrentItem(next);
+     }
+-
++    else
++    {
++        d->noneSelected = true;
++    }
++     
+     setUpdatesEnabled(true);
+     triggerUpdate();
+ }
+@@ -745,8 +754,11 @@
+     ArticleItem* ai = dynamic_cast<ArticleItem*> (item);
+     if (ai)
+         emit signalArticleChosen( ai->article() );
+-    else 
++    else
++    {
++        d->noneSelected = true;
+         emit signalArticleChosen( Article() );
++    }
+ } 
+ 
+ 
+Index: akregator/src/librss/feeddetector.h
+===================================================================
+--- akregator/src/librss/feeddetector.h	(.../tags/KDE/3.5.4/kdepim)	(revision 0)
++++ akregator/src/librss/feeddetector.h	(.../branches/KDE/3.5/kdepim)	(revision 581794)
+@@ -0,0 +1,80 @@
++/*
++    This file is part of Akregator.
++
++    Copyright (C) 2004 Teemu Rytilahti <tpr at d5k.net>
++
++    This program is free software; you can redistribute it and/or modify
++    it under the terms of the GNU General Public License as published by
++    the Free Software Foundation; either version 2 of the License, or
++    (at your option) any later version.
++
++    This program is distributed in the hope that it will be useful,
++    but WITHOUT ANY WARRANTY; without even the implied warranty of
++    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++    GNU General Public License for more details.
++
++    You should have received a copy of the GNU General Public License
++    along with this program; if not, write to the Free Software
++    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
++
++    As a special exception, permission is given to link this program
++    with any edition of Qt, and distribute the resulting executable,
++    without including the source code for Qt in the source distribution.
++*/
++ 
++#ifndef LIBRSS_FEEDDETECTOR_H
++#define LIBRSS_FEEDDETECTOR_H
++
++#include <qstring.h>
++#include <qvaluelist.h>
++
++class QStringList;
++class KURL;
++
++namespace RSS
++{
++
++    class FeedDetectorEntry
++    {
++        public:
++            FeedDetectorEntry() {}
++            FeedDetectorEntry(const QString& url, const QString& title) 
++                : m_url(url), m_title(title) {}
++
++            const QString& url() const { return m_url; } 
++            const QString& title() const { return m_title; }
++
++        private:	
++            const QString m_url;
++            const QString m_title;
++    };	
++
++    typedef QValueList<FeedDetectorEntry> FeedDetectorEntryList; 
++
++    /** a class providing functions to detect linked feeds in HTML sources */
++    class FeedDetector
++    {
++        public:
++            /** \brief searches an HTML page for feeds listed in @c <link> tags
++            @c <link> tags with @c rel attribute values @c alternate or 
++            @c service.feed are considered as feeds 
++            @param s the html source to scan (the actual source, no URI)
++            @return a list containing the detected feeds
++            */
++            static FeedDetectorEntryList extractFromLinkTags(const QString& s);
++
++            /** \brief searches an HTML page for slightly feed-like looking links and catches everything not running away quickly enough. 
++            Extracts links from @c <a @c href> tags which end with @c xml, @c rss or @c rdf
++            @param s the html source to scan (the actual source, no URI)
++            @return a list containing the detected feeds
++            */
++            static QStringList extractBruteForce(const QString& s);
++
++            static QString fixRelativeURL(const QString &s, const KURL &baseurl);
++            
++        private:
++            FeedDetector() {}
++    };
++}
++
++#endif //LIBRSS_FEEDDETECTOR_H
+Index: akregator/src/librss/loader.cpp
+===================================================================
+--- akregator/src/librss/loader.cpp	(.../tags/KDE/3.5.4/kdepim)	(revision 581794)
++++ akregator/src/librss/loader.cpp	(.../branches/KDE/3.5/kdepim)	(revision 581794)
+@@ -10,6 +10,7 @@
+  */
+ #include "loader.h"
+ #include "document.h"
++#include "feeddetector.h"
+ 
+ #include <kio/job.h>
+ #include <kprocess.h>
+@@ -377,74 +378,35 @@
+ void Loader::discoverFeeds(const QByteArray &data)
+ {
+     QString str = QString(data).simplifyWhiteSpace();
+-    QString s2;
+-    //QTextStream ts( &str, IO_WriteOnly );
+-    //ts << data.data();
+-
+-    // "<[\\s]link[^>]*rel[\\s]=[\\s]\\\"[\\s]alternate[\\s]\\\"[^>]*>"
+-    // "type[\\s]=[\\s]\\\"application/rss+xml\\\""
+-    // "href[\\s]=[\\s]\\\"application/rss+xml\\\""
+-    QRegExp rx( "(?:REL)[^=]*=[^sAa]*(?:service.feed|ALTERNATE)[\\s]*[^s][^s](?:[^>]*)(?:HREF)[^=]*=[^A-Z0-9-_~,./$]*([^'\">\\s]*)", false);
+-    if (rx.search(str)!=-1)
+-        s2=rx.cap(1);
+-    else{
+-    // does not support Atom/RSS autodiscovery.. try finding feeds by brute force....
+-        int pos=0;
+-        QStringList feeds;
+-        QString host=d->url.host();
+-        rx.setPattern("(?:<A )[^H]*(?:HREF)[^=]*=[^A-Z0-9-_~,./]*([^'\">\\s]*)");
+-        while ( pos >= 0 ) {
+-            pos = rx.search( str, pos );
+-            s2=rx.cap(1);
+-            if (s2.endsWith(".rdf") || s2.endsWith(".rss") || s2.endsWith(".xml"))
+-                    feeds.append(s2);
+-            if ( pos >= 0 ) {
+-                pos += rx.matchedLength();
+-            }
+-        }
+-
+-        s2=feeds.first();
+-        KURL testURL;
+-        // loop through, prefer feeds on same host
+-        QStringList::Iterator end( feeds.end() );
+-        for ( QStringList::Iterator it = feeds.begin(); it != end; ++it ) {
+-            testURL=*it;
+-            if (testURL.host()==host)
+-            {
+-                s2=*it;
+-                break;
+-            }
+-        }
+-    }
+-
+-    if (s2.isNull()) {
+-        //kdDebug() << "No feed found for a site" << endl;
+-        return;
+-    }
+-
+-    if (KURL::isRelativeURL(s2))
++    
++    QStringList feeds; 
++    
++    FeedDetectorEntryList list = FeedDetector::extractFromLinkTags(str); 
++    
++    for (FeedDetectorEntryList::ConstIterator it = list.begin(); it != list.end(); ++it)
+     {
+-        if (s2.startsWith("//"))
++        feeds += (*it).url();
++    }  
++    
++    if (list.isEmpty())
++        feeds = FeedDetector::extractBruteForce(str);
++        
++    QString feed = feeds.first();
++    QString host = d->url.host();
++    KURL testURL;
++    // loop through, prefer feeds on same host
++    QStringList::Iterator end( feeds.end() );
++    for ( QStringList::Iterator it = feeds.begin(); it != end; ++it) 
++    {
++        testURL=*it;
++        if (testURL.host() == host)
+         {
+-            s2=s2.prepend(d->url.protocol()+":");
+-            d->discoveredFeedURL=s2;
++            feed = *it;
++            break;
+         }
+-        else if (s2.startsWith("/"))
+-        {
+-            d->discoveredFeedURL=d->url;
+-            d->discoveredFeedURL.setPath(s2);
+-        }
+-        else
+-        {
+-            d->discoveredFeedURL=d->url;
+-            d->discoveredFeedURL.addPath(s2);
+-        }
+-        d->discoveredFeedURL.cleanPath();
+     }
+-    else
+-        d->discoveredFeedURL=s2;
+ 
+-    d->discoveredFeedURL.cleanPath();
++    d->discoveredFeedURL = feed.isNull() ? QString() : FeedDetector::fixRelativeURL(feed, d->url); 
+ }
+ 
+ #include "loader.moc"
+Index: akregator/src/librss/Makefile.am
+===================================================================
+--- akregator/src/librss/Makefile.am	(.../tags/KDE/3.5.4/kdepim)	(revision 581794)
++++ akregator/src/librss/Makefile.am	(.../branches/KDE/3.5/kdepim)	(revision 581794)
+@@ -9,7 +9,7 @@
+   loader.h librss.h enclosure.h
+ 
+ librsslocal_la_SOURCES = article.cpp document.cpp image.cpp textinput.cpp \
+-  tools_p.cpp loader.cpp enclosure.cpp category.cpp
++  tools_p.cpp loader.cpp enclosure.cpp category.cpp feeddetector.cpp
+ 
+ librsslocal_la_METASOURCES = AUTO
+ 
+Index: akregator/src/librss/feeddetector.cpp
+===================================================================
+--- akregator/src/librss/feeddetector.cpp	(.../tags/KDE/3.5.4/kdepim)	(revision 0)
++++ akregator/src/librss/feeddetector.cpp	(.../branches/KDE/3.5/kdepim)	(revision 581794)
+@@ -0,0 +1,179 @@
++/*
++    This file is part of Akregator.
++
++    Copyright (C) 2004 Teemu Rytilahti <tpr at d5k.net>
++
++    This program is free software; you can redistribute it and/or modify
++    it under the terms of the GNU General Public License as published by
++    the Free Software Foundation; either version 2 of the License, or
++    (at your option) any later version.
++
++    This program is distributed in the hope that it will be useful,
++    but WITHOUT ANY WARRANTY; without even the implied warranty of
++    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++    GNU General Public License for more details.
++
++    You should have received a copy of the GNU General Public License
++    along with this program; if not, write to the Free Software
++    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
++
++    As a special exception, permission is given to link this program
++    with any edition of Qt, and distribute the resulting executable,
++    without including the source code for Qt in the source distribution.
++*/
++ 
++#include <qregexp.h>
++#include <qstring.h>
++#include <qstringlist.h>
++#include <qvaluelist.h>
++#include <kcharsets.h>
++#include <kurl.h>
++
++#include "feeddetector.h"
++
++
++using namespace RSS;
++
++FeedDetectorEntryList FeedDetector::extractFromLinkTags(const QString& s)	
++{
++    //reduce all sequences of spaces, newlines etc. to one space:
++    QString str = s.simplifyWhiteSpace();
++
++    // extracts <link> tags
++    QRegExp reLinkTag("<[\\s]?LINK[^>]*REL[\\s]?=[\\s]?\\\"[\\s]?(ALTERNATE|SERVICE\\.FEED)[\\s]?\\\"[^>]*>", false);
++
++    // extracts the URL (href="url")
++    QRegExp reHref("HREF[\\s]?=[\\s]?\\\"([^\\\"]*)\\\"", false);
++    // extracts type attribute
++    QRegExp reType("TYPE[\\s]?=[\\s]?\\\"([^\\\"]*)\\\"", false);
++    // extracts the title (title="title")
++    QRegExp reTitle("TITLE[\\s]?=[\\s]?\\\"([^\\\"]*)\\\"", false);
++
++    int pos = 0;
++    int matchpos = 0;
++
++    // get all <link> tags
++    QStringList linkTags;
++    //int strlength = str.length();
++    while ( matchpos != -1 )
++    {
++        matchpos = reLinkTag.search(str, pos);
++        if (matchpos != -1)
++        {
++            linkTags.append( str.mid(matchpos, reLinkTag.matchedLength()) );
++            pos = matchpos + reLinkTag.matchedLength();
++        }
++    }
++
++    FeedDetectorEntryList list;
++
++    for ( QStringList::Iterator it = linkTags.begin(); it != linkTags.end(); ++it )
++    {
++        QString type;
++        int pos = reType.search(*it, 0);
++        if (pos != -1)
++            type = reType.cap(1).lower();
++
++        // we accept only type attributes indicating a feed
++        if ( type != "application/rss+xml" && type != "application/rdf+xml"
++	      && type != "application/atom+xml" && type != "text/xml" )
++            continue;
++                
++        QString title;
++        pos = reTitle.search(*it, 0);
++        if (pos != -1)
++        title = reTitle.cap(1);
++
++        title = KCharsets::resolveEntities(title);
++
++        QString url;
++        pos = reHref.search(*it, 0);
++        if (pos != -1)
++            url = reHref.cap(1);
++
++        url = KCharsets::resolveEntities(url);
++
++        // if feed has no title, use the url as preliminary title (until feed is parsed)
++        if ( title.isEmpty() )
++            title = url;
++
++        if ( !url.isEmpty() )
++            list.append(FeedDetectorEntry(url, title) );		
++    }
++
++
++    return list;
++}
++
++QStringList FeedDetector::extractBruteForce(const QString& s)
++{
++    QString str = s.simplifyWhiteSpace();
++    
++    QRegExp reAhrefTag("<[\\s]?A[^>]?HREF=[\\s]?\\\"[^\\\"]*\\\"[^>]*>", false);
++    
++    // extracts the URL (href="url")
++    QRegExp reHref("HREF[\\s]?=[\\s]?\\\"([^\\\"]*)\\\"", false);
++
++    QRegExp rssrdfxml(".*(RSS|RDF|XML)", false);
++
++    int pos = 0;
++    int matchpos = 0;
++    
++    // get all <a href> tags and capture url
++    QStringList list;
++    //int strlength = str.length();
++    while ( matchpos != -1 )
++    {
++        matchpos = reAhrefTag.search(str, pos);
++        if ( matchpos != -1 )
++        {
++            QString ahref = str.mid(matchpos, reAhrefTag.matchedLength());
++            int hrefpos = reHref.search(ahref, 0);
++            if ( hrefpos != -1 )
++            {
++                QString url = reHref.cap(1);
++
++                url = KCharsets::resolveEntities(url);
++
++                if ( rssrdfxml.exactMatch(url) )
++                    list.append(url);
++            }
++
++            pos = matchpos + reAhrefTag.matchedLength();
++        }
++    }
++    
++    return list;
++}
++
++QString FeedDetector::fixRelativeURL(const QString &s, const KURL &baseurl)
++{
++    QString s2=s;
++    KURL u;
++    if (KURL::isRelativeURL(s2))
++    {
++        if (s2.startsWith("//"))
++        {
++            s2=s2.prepend(baseurl.protocol()+":");
++            u=s2;
++        }
++        else if (s2.startsWith("/"))
++        {
++            KURL b2(baseurl);
++            b2.setPath(QString()); // delete path and query, so that only protocol://host remains
++            b2.setQuery(QString());
++            u = KURL(b2, s2.remove(0,1)); // remove leading "/" 
++        }
++        else
++        {
++            u = KURL(baseurl, s2);
++        }
++    }
++    else
++        u=s2;
++
++    u.cleanPath();
++    //kdDebug() << "AKREGATOR_PLUGIN_FIXURL: " << "url=" << s << " baseurl=" << baseurl.url() << " fixed=" << u.url() << 
++    endl;
++    return u.url();
++}
+Index: akregator/src/feedlistview.cpp
+===================================================================
+--- akregator/src/feedlistview.cpp	(.../tags/KDE/3.5.4/kdepim)	(revision 581794)
++++ akregator/src/feedlistview.cpp	(.../branches/KDE/3.5/kdepim)	(revision 581794)
+@@ -72,47 +72,8 @@
+     DisconnectNodeVisitor* disconnectNodeVisitor;
+     CreateItemVisitor* createItemVisitor;
+     DeleteItemVisitor* deleteItemVisitor;
+-    DragAndDropVisitor* dragAndDropVisitor;
+ };
+ 
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/kdepim-branch.diff?r1=1.19&r2=1.20&f=u



More information about the pld-cvs-commit mailing list