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

List:       kde-pim
Subject:    [Kde-pim] [PATCH] Nice headers for akregator
From:       Kolja <nikj () gmx ! de>
Date:       2008-08-16 20:24:34
Message-ID: 200808162224.34552.nikj () gmx ! de
[Download RAW message or body]

Hello!

I'm new to kde development and this is my first
post to this mailing list.

The attached patch changes the appearance of the
headers in akregator. For a preview take a look at:

http://datenschreck.net/kde/akregator_freshedHeaders_beforeAfter.jpg
http://datenschreck.net/kde/akregator_freshedHeaders_beforeAfter_combinedView.jpg

What's wrong with the old ones?
    - they look old
    - they do _not_ fit into the fresh oxygen
      environment

What about the new ones?
    + they look more modern
    + they fit better into the environment
    + the title of an article is blue
      (QPalette::Link), so more users would
      recognice this as a link. With this the user
      can go to the complete article by "Complete
      Story" in the end and also by clicking the
      title.
    + if you select a feed in the tree view, the
      presented title (in the article viewer
      part/header) is now clickable (home page)
    + Colors (grey) from the color palette were used
      (http://wiki.kde.org/tiki-index.php?page=Colors)
    - they need more space

The attached patch applies to the directory
akregator/src, but only articleformatter.cpp is
affected. It's meant for trunk.

Comments and suggestions?! :)

Best regards,
    Kolja

["niceheaderspatch.diff" (text/x-diff)]

Index: articleformatter.cpp
===================================================================
--- articleformatter.cpp	(revision 848062)
+++ articleformatter.cpp	(working copy)
@@ -81,11 +81,15 @@ class DefaultNormalViewFormatter::Summar
             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(node->title()))); +            \
if (!node->htmlUrl().isEmpty()) +                text += "<a \
href=\""+node->htmlUrl()+"\">";  text += node->title();
             if(node->unread() == 0)
                 text += i18n(" (no unread articles)");
             else
                 text += i18np(" (1 unread article)", " (%1 unread articles)", \
node->unread()); +            if (!node->htmlUrl().isEmpty())
+                text += "</a>";
             text += "</div>\n"; // headertitle
             text += "</div>\n"; // /headerbox
 
@@ -102,16 +106,16 @@ class DefaultNormalViewFormatter::Summar
 
             if( !node->description().isEmpty() )
             {
-                text += QString("<div \
                dir=\"%1\">").arg(Utils::stripTags(Utils::directionOf(node->description())));
                
-                text += i18n("<b>Description:</b> %1<br /><br />", \
                node->description());
-                text += "</div>\n"; // /description
+                text += QString("<span class=\"header\" \
dir=\"%1\">").arg(Utils::stripTags(Utils::directionOf(node->description()))); +       \
text += QString ("%1:").arg(i18n("Description")) + "</span>"; +                text \
+= "<span class=\"headertext\">" + node->description() + "</span><br/>\n";  }
 
             if ( !node->htmlUrl().isEmpty() )
             {
-                text += QString("<div \
                dir=\"%1\">").arg(Utils::directionOf(node->htmlUrl()));
-                text += i18n("<b>Homepage:</b> <a href=\"%1\">%2</a>", \
                node->htmlUrl(), node->htmlUrl());
-                text += "</div>\n"; // / link
+                text += QString("<span class=\"header\" \
dir=\"%1\">").arg(Utils::directionOf(node->htmlUrl())); +                text += \
QString ("%1:").arg(i18n("Homepage")) + "</span>"; +                text += \
QString("<span class=\"headertext\"><a \
href=\"%1\">%2</a>").arg(node->htmlUrl(),node->htmlUrl()) + "</span>\n";  }
 
         //text += i18n("<b>Unread articles:</b> %1").arg(node->unread());
@@ -235,7 +239,7 @@ QString DefaultNormalViewFormatter::form
 
         //text += QString("<hr><div><a href=\"%1\">%2</a> (%3, \
%4)</div>").arg(url).arg(url).arg(lengthStr).arg(type);  // }
-    //kDebug() << text;
+    kDebug() << text;
     return text;
 }
 
@@ -263,48 +267,52 @@ QString DefaultNormalViewFormatter::getC
             + QString(!Settings::underlineLinks() ? " text-decoration: none ! \
important;\n" : "")  +       "}\n\n"
             +".headerbox {\n"
-            +"  background: %2 ! important;\n"
-            +"  color: %3 ! important;\n"
-            +"  border:1px solid #000;\n"
-            +"  margin-bottom: 10pt;\n"
+            +"  color: %2 ! important;\n"
             +        "}\n\n")
             .arg( pal.color( QPalette::Link ).name(),
-                  pal.color( QPalette::Background ).name(),
                   pal.color( QPalette::Text ).name() );
     css += QString(".headertitle a:link { color: %1 ! important;\n text-decoration: \
                none ! important;\n }\n"
             ".headertitle a:visited { color: %1 ! important;\n text-decoration: none \
                ! important;\n }\n"
             ".headertitle a:hover{ color: %1 ! important;\n text-decoration: none ! \
                important;\n }\n"
             ".headertitle a:active { color: %1 ! important;\n  text-decoration: none \
                ! important;\n }\n" )
-            .arg( pal.color( QPalette::HighlightedText ).name() );
+            .arg( pal.color( QPalette::Link ).name() );
     css += QString(
             ".headertitle {\n"
-            "  background: %1 ! important;\n"
-            "  padding:2px;\n"
-            "  color: %2 ! important;\n"
+            "  background: #EBECED ! important;\n"
+            "  padding:10px;\n"
+            "  color: %1 ! important;\n"
+            "  border-bottom: 1px solid #BBBFC3;\n"
             "  font-weight: bold;\n"
+            "  font-size: large;\n"
             "  text-decoration: none ! important;\n"
+            "  margin-bottom: 10px ! important;\n"
             "}\n\n"
             ".header {\n"
             "  font-weight: bold;\n"
             "  padding:2px;\n"
+            "  color: #6D7179;\n"
+            "  padding-left:20px;\n"
             "  margin-right: 5px;\n"
             "  text-decoration: none ! important;\n"
             "}\n\n"
+            ".headertext {\n"
+            "  text-decoration: none ! important;\n"
+            "  color:#6D7179;\n"
+            "}\n\n"
             ".headertext a {\n"
             "  text-decoration: none ! important;\n"
+            "  color: #6D7179;\n"
             "}\n\n"
             ".headimage {\n"
             "  float: right;\n"
             "  margin-left: 5px;\n"
-            "}\n\n").arg(
-                    pal.color( QPalette::Highlight ).name(),
-                    pal.color( QPalette::HighlightedText ).name() );
+            "}\n\n").arg( pal.color( QPalette::Highlight ).name() );
 
     css += QString(
             "body { clear: none; }\n\n"
             ".content {\n"
             "  display: block;\n"
-            "  margin-bottom: 6px;\n"
+            "  padding: 10px 15px 0px 15px;\n"
             "}\n\n"
     // these rules make sure that there is no leading space between the header and \
the first of the text  ".content > P:first-child {\n margin-top: 1px; }\n"
@@ -316,6 +324,7 @@ QString DefaultNormalViewFormatter::getC
     //"@media screen { body { overflow: auto; } }\n"
             "\n\n");
 
+    //kDebug() << css;
     return css;
 }
 
@@ -443,49 +452,52 @@ QString DefaultCombinedViewFormatter::ge
             + QString(!Settings::underlineLinks() ? " text-decoration: none ! \
important;\n" : "")  +       "}\n\n"
             +".headerbox {\n"
-            +"  background: %2 ! important;\n"
-            +"  color: %3 ! important;\n"
-            +"  border:1px solid #000;\n"
-            +"  margin-bottom: 10pt;\n"
+            +"  color: %2 ! important;\n"
 //    +"  width: 99%;\n"
             +        "}\n\n")
             .arg( pal.color( QPalette::Link ).name(),
-                  pal.color( QPalette::Background ).name(),
                   pal.color( QPalette::Text ).name() );
 
     css += QString(".headertitle a:link { color: %1  ! important; text-decoration: \
                none ! important;\n }\n"
             ".headertitle a:visited { color: %1 ! important; text-decoration: none ! \
                important;\n }\n"
             ".headertitle a:hover{ color: %1 ! important; text-decoration: none ! \
                important;\n }\n"
             ".headertitle a:active { color: %1 ! important; text-decoration: none ! \
                important;\n }\n")
-            .arg( pal.color( QPalette::HighlightedText ).name() );
+            .arg( pal.color( QPalette::Link ).name() );
     css += QString(
             ".headertitle {\n"
-            "  background: %1 ! important;\n"
-            "  padding:2px;\n"
-            "  color: %2 ! important;\n"
+            "  background: #EBECED ! important;\n"
+            "  padding:10px;\n"
+            "  color: %1 ! important;\n"
+            "  border-bottom: 1px solid #BBBFC3;\n"
             "  font-weight: bold;\n"
+            "  font-size: large;\n"
             "  text-decoration: none ! important;\n"
+            "  margin-bottom: 10px ! important;\n"
             "}\n\n"
             ".header {\n"
             "  font-weight: bold;\n"
             "  padding:2px;\n"
+            "  color:#6D7179;\n"
+            "  padding-left:20px;\n"
             "  margin-right: 5px;\n"
             "  text-decoration: none ! important;\n"
             "}\n\n"
             ".headertext {\n"
             "  text-decoration: none ! important;\n"
+            "  color:#6D7179;\n"
             "}\n\n"
             ".headimage {\n"
             "  float: right;\n"
             "  margin-left: 5px;\n"
-            "}\n\n").arg( pal.color( QPalette::Highlight ).name(),
-                          pal.color( QPalette::HighlightedText ).name() );
+            "}\n\n").arg( pal.color( QPalette::Highlight ).name() );
+                          
 
     css += QString(
             "body { clear: none; }\n\n"
             ".content {\n"
             "  display: block;\n"
-            "  margin-bottom: 6px;\n"
+            "  padding: 10px 15px 0px 15px;\n"
+            //"  margin-bottom: 6px;\n"
             "}\n\n"
     // these rules make sure that there is no leading space between the header and \
the first of the text  ".content > P:first-child {\n margin-top: 1px; }\n"



_______________________________________________
KDE PIM mailing list kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/

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

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