[Kita-svn] [2555] - Kita::Parser::createTitleHtml -> DatInfo::createTitleHtml

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 8月 12日 (水) 06:29:06 JST


Revision: 2555
          http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2555
Author:   nogu
Date:     2009-08-12 06:29:06 +0900 (Wed, 12 Aug 2009)

Log Message:
-----------
- Kita::Parser::createTitleHtml -> DatInfo::createTitleHtml
- remove ParseMisc class

Modified Paths:
--------------
    kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp
    kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h
    kita/branches/KITA-KDE4/kita/src/libkita/parser.cpp
    kita/branches/KITA-KDE4/kita/src/libkita/parser.h
    kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp

Removed Paths:
-------------
    kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h

Modified: kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp
===================================================================
--- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp	2009-08-11 13:32:39 UTC (rev 2554)
+++ kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp	2009-08-11 21:29:06 UTC (rev 2555)
@@ -384,10 +384,10 @@
     if (!parseDat(num)) return QString();
 
     QString titleHtml;
-	Parser::createTitleHtml(m_resDatVec[ num ], titleHtml);
+    createTitleHtml(m_resDatVec[ num ], titleHtml);
 
     QString retStr;
-	Parser::datToText(titleHtml, retStr);
+    Parser::datToText(titleHtml, retStr);
 
     return retStr;
 }
@@ -399,7 +399,7 @@
     if (!parseDat(num)) return QString();
 
     QString retStr;
-	Parser::datToText(m_resDatVec[ num ].bodyHTML, retStr);
+    Parser::datToText(m_resDatVec[ num ].bodyHTML, retStr);
 
     return retStr;
 }
@@ -452,7 +452,7 @@
 
         return HTML_BROKEN;
     } else {
-		Parser::createTitleHtml(resdat, titleHtml);
+        createTitleHtml(resdat, titleHtml);
         bodyHtml = resdat.bodyHTML;
         
         return HTML_NORMAL;
@@ -909,7 +909,7 @@
     //   qDebug("parseDat %d",num);
 
     QString subject;
-	Parser::parseResDat(m_resDatVec[ num ], subject);
+    Parser::parseResDat(m_resDatVec[ num ], subject);
     if (num == 1 && !subject.isEmpty())
         m_thread->setThreadName(subject);
     if (m_resDatVec[ num ].broken)
@@ -927,3 +927,88 @@
 {
     m_isOpened = isOpened;
 }
+
+/* create HTML of title.
+  
+  struct RESDAT resdat should be parsed by parseResDat before  calling this function.
+ 
+  output: titleHtml
+  
+*/
+void DatInfo::createTitleHtml(RESDAT& resdat, QString& titleHtml)
+{
+    titleHtml.clear();
+    if (!resdat.parsed) return ;
+
+    bool showMailAddress = GlobalConfig::showMailAddress();
+    bool useTableTag = GlobalConfig::useStyleSheet();
+
+    if (useTableTag) titleHtml += "<table class=\"res_title\"><tr>";
+
+    /* res number */
+    if (useTableTag) titleHtml += "<td class=\"res_title_number\">";
+    titleHtml += "<a href=\"#write" + QString::number(resdat.num) + "\">";
+    titleHtml += QString::number(resdat.num);
+    titleHtml += "</a> ";
+
+    /* name & mail address */
+    if (useTableTag) titleHtml += "<td class=\"res_title_name\">";
+    titleHtml += "<b>" + QString::fromUtf8(KITAUTF8_NAME);
+
+    /* show name with mail address */
+    if (showMailAddress) {
+
+        titleHtml += resdat.nameHTML;
+        if (!resdat.address.isEmpty()) titleHtml += " [" + resdat.address + ']';
+
+    } else { /* don't show mail address */
+
+        if (resdat.address.isEmpty()) {
+
+            titleHtml += "<span class=\"name_noaddr\">";
+            titleHtml += resdat.name;
+            titleHtml += "</span>";
+
+        } else {
+
+            titleHtml += "<a href=\"mailto:" + resdat.address + "\"";
+            titleHtml += " title=\"" + resdat.address + "\">";
+            titleHtml += resdat.name;
+            titleHtml += "</a>";
+        }
+    }
+
+    titleHtml += "</b> ";
+
+    /* date */
+    if (useTableTag) titleHtml += "<td class=\"res_title_date\">";
+    titleHtml += QString::fromUtf8(KITAUTF8_COLON) + resdat.date;
+    if (useTableTag) titleHtml += "</td>";
+
+    /* ID */
+    if (!resdat.id.isEmpty()) {
+
+        if (useTableTag) titleHtml += "<td class=\"res_title_id\">";
+        if (resdat.id.count("???") >= 1) titleHtml += " ID:" + resdat.id;
+        else titleHtml += " <a href=\"#idpop" + resdat.id + "\">ID</a>" + ":" + resdat.id;
+        if (useTableTag) titleHtml += "</td>";
+    }
+
+    /* BE */
+    if (!resdat.be.isEmpty()) {
+
+        if (useTableTag) titleHtml += "<td class=\"res_title_be\">";
+        titleHtml += " <a href=\"#bepop" + resdat.be + "\">?" + resdat.bepointmark + "</a>";
+        if (useTableTag) titleHtml += "</td>";
+    }
+
+    /* host */
+    if (!resdat.host.isEmpty()) {
+
+        if (useTableTag) titleHtml += "<td class=\"res_title_host\">";
+        titleHtml += " HOST:" + resdat.host;
+        if (useTableTag) titleHtml += "</td>";
+    }
+
+    if (useTableTag) titleHtml += "</tr></table>";
+}

Modified: kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h
===================================================================
--- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h	2009-08-11 13:32:39 UTC (rev 2554)
+++ kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h	2009-08-11 21:29:06 UTC (rev 2555)
@@ -218,6 +218,8 @@
         /* parsing functions */
         bool parseDat(int num);
 
+        void createTitleHtml(RESDAT& resdat, QString& titleHtml);
+
         DatInfo(const DatInfo&);
         DatInfo& operator=(const DatInfo&);
         /*----------------------------*/

Deleted: kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h
===================================================================
--- kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h	2009-08-11 13:32:39 UTC (rev 2554)
+++ kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h	2009-08-11 21:29:06 UTC (rev 2555)
@@ -1,40 +0,0 @@
-/***************************************************************************
-*   Copyright (C) 2004 by Kita Developers                                 *
-*   ikemo****@users*****                                            *
-*                                                                         *
-*   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.                                   *
-***************************************************************************/
-
-/* obsolete */
-
-#ifndef KITAPARSEMISC_H
-#define KITAPARSEMISC_H
-
-#include "kita_misc.h"
-
-class KUrl;
-
-namespace Kita
-{
-
-    class ParseMisc
-    {
-    public:
-        static KUrl parseUrl(const KUrl& url , QString& refstr)
-        {
-            return getDatUrl(url , refstr);
-        }
-
-        static KUrl parseUrlOnly(const KUrl& url) { return getDatUrl(url); }
-
-        static QString utf8ToUnicode(const QByteArray& str)
-        { return utf8ToUnicode(str); }
-    };
-
-}
-
-#endif
-

Modified: kita/branches/KITA-KDE4/kita/src/libkita/parser.cpp
===================================================================
--- kita/branches/KITA-KDE4/kita/src/libkita/parser.cpp	2009-08-11 13:32:39 UTC (rev 2554)
+++ kita/branches/KITA-KDE4/kita/src/libkita/parser.cpp	2009-08-11 21:29:06 UTC (rev 2555)
@@ -665,88 +665,3 @@
 
     return true;
 }
-
-/* create HTML of title.
-  
-  struct RESDAT resdat should be parsed by parseResDat before  calling this function.
- 
-  output: titleHtml
-  
-*/
-void Parser::createTitleHtml(RESDAT& resdat, QString& titleHtml)
-{
-    titleHtml.clear();
-    if (!resdat.parsed) return ;
-
-    bool showMailAddress = GlobalConfig::showMailAddress();
-    bool useTableTag = GlobalConfig::useStyleSheet();
-
-    if (useTableTag) titleHtml += "<table class=\"res_title\"><tr>";
-
-    /* res number */
-    if (useTableTag) titleHtml += "<td class=\"res_title_number\">";
-    titleHtml += "<a href=\"#write" + QString::number(resdat.num) + "\">";
-    titleHtml += QString::number(resdat.num);
-    titleHtml += "</a> ";
-
-    /* name & mail address */
-    if (useTableTag) titleHtml += "<td class=\"res_title_name\">";
-    titleHtml += "<b>" + QString::fromUtf8(KITAUTF8_NAME);
-
-    /* show name with mail address */
-    if (showMailAddress) {
-
-        titleHtml += resdat.nameHTML;
-        if (!resdat.address.isEmpty()) titleHtml += " [" + resdat.address + ']';
-
-    } else { /* don't show mail address */
-
-        if (resdat.address.isEmpty()) {
-
-            titleHtml += "<span class=\"name_noaddr\">";
-            titleHtml += resdat.name;
-            titleHtml += "</span>";
-
-        } else {
-
-            titleHtml += "<a href=\"mailto:" + resdat.address + "\"";
-            titleHtml += " title=\"" + resdat.address + "\">";
-            titleHtml += resdat.name;
-            titleHtml += "</a>";
-        }
-    }
-
-    titleHtml += "</b> ";
-
-    /* date */
-    if (useTableTag) titleHtml += "<td class=\"res_title_date\">";
-    titleHtml += QString::fromUtf8(KITAUTF8_COLON) + resdat.date;
-    if (useTableTag) titleHtml += "</td>";
-
-    /* ID */
-    if (!resdat.id.isEmpty()) {
-
-        if (useTableTag) titleHtml += "<td class=\"res_title_id\">";
-        if (resdat.id.count("???") >= 1) titleHtml += " ID:" + resdat.id;
-        else titleHtml += " <a href=\"#idpop" + resdat.id + "\">ID</a>" + ":" + resdat.id;
-        if (useTableTag) titleHtml += "</td>";
-    }
-
-    /* BE */
-    if (!resdat.be.isEmpty()) {
-
-        if (useTableTag) titleHtml += "<td class=\"res_title_be\">";
-        titleHtml += " <a href=\"#bepop" + resdat.be + "\">?" + resdat.bepointmark + "</a>";
-        if (useTableTag) titleHtml += "</td>";
-    }
-
-    /* host */
-    if (!resdat.host.isEmpty()) {
-
-        if (useTableTag) titleHtml += "<td class=\"res_title_host\">";
-        titleHtml += " HOST:" + resdat.host;
-        if (useTableTag) titleHtml += "</td>";
-    }
-
-    if (useTableTag) titleHtml += "</tr></table>";
-}

Modified: kita/branches/KITA-KDE4/kita/src/libkita/parser.h
===================================================================
--- kita/branches/KITA-KDE4/kita/src/libkita/parser.h	2009-08-11 13:32:39 UTC (rev 2554)
+++ kita/branches/KITA-KDE4/kita/src/libkita/parser.h	2009-08-11 21:29:06 UTC (rev 2555)
@@ -18,7 +18,6 @@
     namespace Parser {
         bool parseResDat(RESDAT& resdat, QString& subject);
         void datToText(const QString &rawData, QString& text);
-        void createTitleHtml(RESDAT& resdat, QString& titleHtml);
     }
 }
 

Modified: kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp
===================================================================
--- kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp	2009-08-11 13:32:39 UTC (rev 2554)
+++ kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp	2009-08-11 21:29:06 UTC (rev 2555)
@@ -25,7 +25,7 @@
 #include "viewmediator.h"
 #include "libkita/datmanager.h"
 #include "libkita/globalconfig.h"
-#include "libkita/parsemisc.h"
+#include "libkita/kita_misc.h"
 
 using namespace Kita;
 
@@ -48,7 +48,7 @@
 void ThreadTabWidget::slotShowMainThread(const KUrl& url)
 {
     QString refstr;
-    KUrl datUrl = ParseMisc::parseUrl(url, refstr);
+    KUrl datUrl = getDatUrl(url, refstr);
     QString threadName = DatManager(datUrl).threadName();
     int jumpNum = 0;
 
@@ -95,7 +95,7 @@
 {
     int max = count();
     if (max == 0) return ;
-    KUrl datUrl = ParseMisc::parseUrlOnly(url);
+    KUrl datUrl = getDatUrl(url);
 
     int i, i2;
     i = i2 = 0;
@@ -127,7 +127,7 @@
 /* private */
 ThreadView* ThreadTabWidget::findMainView(const KUrl& url)
 {
-    KUrl datUrl = ParseMisc::parseUrlOnly(url);
+    KUrl datUrl = getDatUrl(url);
 
     int max = count();
     if (max == 0) return 0;
@@ -160,7 +160,7 @@
 /* private slots */
 void ThreadTabWidget::slotUpdateThreadTab(const KUrl& url)
 {
-    KUrl datUrl = ParseMisc::parseUrlOnly(url);
+    KUrl datUrl = getDatUrl(url);
 
     ThreadView * view = findMainView(datUrl);
     if (view) {




Kita-svn メーリングリストの案内
Back to archive index