[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim/work/akonadi-ports] /: use entitydisplayattribute for feed
From:       Frank Osterfeld <frank.osterfeld () kdab ! com>
Date:       2011-09-21 18:41:01
Message-ID: 20110921184101.2EC91A607A () git ! kde ! org
[Download RAW message or body]

Git commit 01195d4bfa0428157eef3a7a9b72016d2926a827 by Frank Osterfeld.
Committed on 21/09/2011 at 19:41.
Pushed by osterfeld into branch 'work/akonadi-ports'.

use entitydisplayattribute for feed title

M  +3    -3    akregator/src/articleformatter.cpp
M  +1    -1    akregator/src/editfeedcommand.cpp
M  +1    -1    akregator/src/mainwidget.cpp
M  +2    -2    akregator/src/modifycommands.cpp
M  +14   -2    krss/krss/feedcollection.cpp
M  +3    -0    krss/krss/feedcollection.h
M  +1    -1    krss/krss/feeditemmodel.cpp

http://commits.kde.org/kdepim/01195d4bfa0428157eef3a7a9b72016d2926a827

diff --git a/akregator/src/articleformatter.cpp b/akregator/src/articleformatter.cpp
index 3a6033d..798138c 100644
--- a/akregator/src/articleformatter.cpp
+++ b/akregator/src/articleformatter.cpp
@@ -114,7 +114,7 @@ int ArticleFormatter::pointsToPixel(int pointSize) const
 }
 
 static QString formatFolderSummary( const Collection& c ) {
-    const QString title = c.name();
+    const QString title = FeedCollection( c ).title();
     QString text = QString::fromLatin1("<div class=\"headerbox\" \
                dir=\"%1\">\n").arg(QApplication::isRightToLeft() ? "rtl" : "ltr");
     text += QString::fromLatin1("<div class=\"headertitle\" \
dir=\"%1\">%2").arg(Utils::directionOf(Utils::stripTags(title)), title);  #ifdef \
KRSS_PORT_DISABLED @@ -134,8 +134,8 @@ static QString formatFeedSummary( const \
FeedCollection& feed, const KUrl& imageD  
     QString text = QString("<div class=\"headerbox\" \
dir=\"%1\">\n").arg(QApplication::isRightToLeft() ? "rtl" : "ltr");  
-    text += QString("<div class=\"headertitle\" \
                dir=\"%1\">").arg(Utils::directionOf(Utils::stripTags(feed.name())));
-    text += feed.name();
+    text += QString("<div class=\"headertitle\" \
dir=\"%1\">").arg(Utils::directionOf(Utils::stripTags(feed.title()))); +    text += \
feed.title();  #ifdef KRSS_PORT_DISABLED
     if(node->unread() == 0)
         text += i18n(" (no unread articles)");
diff --git a/akregator/src/editfeedcommand.cpp b/akregator/src/editfeedcommand.cpp
index 53dce41..297c516 100644
--- a/akregator/src/editfeedcommand.cpp
+++ b/akregator/src/editfeedcommand.cpp
@@ -68,7 +68,7 @@ public:
             //TODO
         } else {
             QPointer<FeedPropertiesDialog> dlg( new FeedPropertiesDialog( \
                q->parentWidget() ) );
-            dlg->setFeedTitle( collection.name() );
+            dlg->setFeedTitle( fc.title() );
             dlg->setUrl( fc.xmlUrl() );
             dlg->setCustomFetchInterval( fc.fetchInterval() > 0 ); //PENDING(frank) \
correct?  dlg->setFetchInterval( fc.fetchInterval() );
diff --git a/akregator/src/mainwidget.cpp b/akregator/src/mainwidget.cpp
index b00b1cc..057089f 100644
--- a/akregator/src/mainwidget.cpp
+++ b/akregator/src/mainwidget.cpp
@@ -542,7 +542,7 @@ void Akregator::MainWidget::slotNodeSelected(const \
Akonadi::Collection& c)  }
 
     if ( c.isValid() )
-        m_mainFrame->setWindowTitle( c.name() );
+        m_mainFrame->setWindowTitle( KRss::FeedCollection( c ).title() );
 
     m_actionManager->slotNodeSelected(c);
 }
diff --git a/akregator/src/modifycommands.cpp b/akregator/src/modifycommands.cpp
index a3ab655..4385a47 100644
--- a/akregator/src/modifycommands.cpp
+++ b/akregator/src/modifycommands.cpp
@@ -84,7 +84,7 @@ void MarkAsReadCommand::doStart() {
 void MarkAsReadCommand::collectionsFetched( KJob* j ) {
     if ( j->error() ) {
         setError( KJob::UserDefinedError );
-        setErrorText( i18n("Could not fetch collection %1: %2", \
d->collection.name(), j->errorString() ) ); +        setErrorText( i18n("Could not \
fetch collection %1: %2", KRss::FeedCollection( d->collection ).title(), \
j->errorString() ) );  emitResult();
         return;
     }
@@ -115,7 +115,7 @@ void MarkAsReadCommand::itemsFetched( KJob* j ) {
 
     if ( j->error() ) {
         setError( KJob::UserDefinedError );
-        setErrorText( i18n("Could not fetch items for collection %1: %2", \
d->collection.name(), j->errorString() ) ); +        setErrorText( i18n("Could not \
fetch items for collection %1: %2", KRss::FeedCollection( d->collection ).title(), \
j->errorString() ) );  } else {
         const ItemFetchJob * const fjob = qobject_cast<const ItemFetchJob*>( j );
         Q_ASSERT( fjob );
diff --git a/krss/krss/feedcollection.cpp b/krss/krss/feedcollection.cpp
index 590e087..6dcd89e 100644
--- a/krss/krss/feedcollection.cpp
+++ b/krss/krss/feedcollection.cpp
@@ -17,10 +17,10 @@
 
 #include "feedcollection.h"
 #include "feedpropertiescollectionattribute.h"
-#
+#include <Akonadi/EntityDisplayAttribute>
 #include <akonadi/cachepolicy.h>
 
-using Akonadi::Collection;
+using namespace Akonadi;
 using namespace KRss;
 
 
@@ -59,6 +59,18 @@ void FeedCollection::setXmlUrl( const QString &xmlUrl )
     attribute<FeedPropertiesCollectionAttribute>( AddIfMissing )->setXmlUrl( xmlUrl \
);  }
 
+QString FeedCollection::title() const {
+    EntityDisplayAttribute* attr = attribute<EntityDisplayAttribute>();
+    if ( attr )
+        return attr->displayName();
+    else
+        return name();
+}
+
+void FeedCollection::setTitle( const QString& t ) {
+    attribute<EntityDisplayAttribute>( AddIfMissing )->setDisplayName( t );
+}
+
 QString FeedCollection::htmlUrl() const
 {
     FeedPropertiesCollectionAttribute *attr = \
                attribute<FeedPropertiesCollectionAttribute>();
diff --git a/krss/krss/feedcollection.h b/krss/krss/feedcollection.h
index 4ca53f8..0900f3e 100644
--- a/krss/krss/feedcollection.h
+++ b/krss/krss/feedcollection.h
@@ -34,6 +34,9 @@ public:
 
     bool isFolder() const;
 
+    QString title() const;
+    void setTitle( const QString& title );
+
     QString xmlUrl() const;
     void setXmlUrl( const QString &xmlUrl );
     QString htmlUrl() const;
diff --git a/krss/krss/feeditemmodel.cpp b/krss/krss/feeditemmodel.cpp
index c10c2a7..6608134 100644
--- a/krss/krss/feeditemmodel.cpp
+++ b/krss/krss/feeditemmodel.cpp
@@ -124,7 +124,7 @@ QVariant FeedItemModel::entityData( const Collection &collection, \
int column, in  return false;
         case FeedTitleColumn:
         {
-            const QString title = collection.name();
+            const QString title = FeedCollection( collection ).title();
             if ( !title.isEmpty() )
                 return title;
             break;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic