• R/O
  • SSH
  • HTTPS

kita: Commit


Commit MetaInfo

Revision2555 (tree)
Time2009-08-12 06:29:06
Authornogu

Log Message

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

Change Summary

Incremental Difference

--- kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h (revision 2554)
+++ kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h (nonexistent)
@@ -1,40 +0,0 @@
1-/***************************************************************************
2-* Copyright (C) 2004 by Kita Developers *
3-* ikemo@users.sourceforge.jp *
4-* *
5-* This program is free software; you can redistribute it and/or modify *
6-* it under the terms of the GNU General Public License as published by *
7-* the Free Software Foundation; either version 2 of the License, or *
8-* (at your option) any later version. *
9-***************************************************************************/
10-
11-/* obsolete */
12-
13-#ifndef KITAPARSEMISC_H
14-#define KITAPARSEMISC_H
15-
16-#include "kita_misc.h"
17-
18-class KUrl;
19-
20-namespace Kita
21-{
22-
23- class ParseMisc
24- {
25- public:
26- static KUrl parseUrl(const KUrl& url , QString& refstr)
27- {
28- return getDatUrl(url , refstr);
29- }
30-
31- static KUrl parseUrlOnly(const KUrl& url) { return getDatUrl(url); }
32-
33- static QString utf8ToUnicode(const QByteArray& str)
34- { return utf8ToUnicode(str); }
35- };
36-
37-}
38-
39-#endif
40-
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
--- kita/branches/KITA-KDE4/kita/src/libkita/parser.h (revision 2554)
+++ kita/branches/KITA-KDE4/kita/src/libkita/parser.h (revision 2555)
@@ -18,7 +18,6 @@
1818 namespace Parser {
1919 bool parseResDat(RESDAT& resdat, QString& subject);
2020 void datToText(const QString &rawData, QString& text);
21- void createTitleHtml(RESDAT& resdat, QString& titleHtml);
2221 }
2322 }
2423
--- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp (revision 2554)
+++ kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp (revision 2555)
@@ -384,10 +384,10 @@
384384 if (!parseDat(num)) return QString();
385385
386386 QString titleHtml;
387- Parser::createTitleHtml(m_resDatVec[ num ], titleHtml);
387+ createTitleHtml(m_resDatVec[ num ], titleHtml);
388388
389389 QString retStr;
390- Parser::datToText(titleHtml, retStr);
390+ Parser::datToText(titleHtml, retStr);
391391
392392 return retStr;
393393 }
@@ -399,7 +399,7 @@
399399 if (!parseDat(num)) return QString();
400400
401401 QString retStr;
402- Parser::datToText(m_resDatVec[ num ].bodyHTML, retStr);
402+ Parser::datToText(m_resDatVec[ num ].bodyHTML, retStr);
403403
404404 return retStr;
405405 }
@@ -452,7 +452,7 @@
452452
453453 return HTML_BROKEN;
454454 } else {
455- Parser::createTitleHtml(resdat, titleHtml);
455+ createTitleHtml(resdat, titleHtml);
456456 bodyHtml = resdat.bodyHTML;
457457
458458 return HTML_NORMAL;
@@ -909,7 +909,7 @@
909909 // qDebug("parseDat %d",num);
910910
911911 QString subject;
912- Parser::parseResDat(m_resDatVec[ num ], subject);
912+ Parser::parseResDat(m_resDatVec[ num ], subject);
913913 if (num == 1 && !subject.isEmpty())
914914 m_thread->setThreadName(subject);
915915 if (m_resDatVec[ num ].broken)
@@ -927,3 +927,88 @@
927927 {
928928 m_isOpened = isOpened;
929929 }
930+
931+/* create HTML of title.
932+
933+ struct RESDAT resdat should be parsed by parseResDat before calling this function.
934+
935+ output: titleHtml
936+
937+*/
938+void DatInfo::createTitleHtml(RESDAT& resdat, QString& titleHtml)
939+{
940+ titleHtml.clear();
941+ if (!resdat.parsed) return ;
942+
943+ bool showMailAddress = GlobalConfig::showMailAddress();
944+ bool useTableTag = GlobalConfig::useStyleSheet();
945+
946+ if (useTableTag) titleHtml += "<table class=\"res_title\"><tr>";
947+
948+ /* res number */
949+ if (useTableTag) titleHtml += "<td class=\"res_title_number\">";
950+ titleHtml += "<a href=\"#write" + QString::number(resdat.num) + "\">";
951+ titleHtml += QString::number(resdat.num);
952+ titleHtml += "</a> ";
953+
954+ /* name & mail address */
955+ if (useTableTag) titleHtml += "<td class=\"res_title_name\">";
956+ titleHtml += "<b>" + QString::fromUtf8(KITAUTF8_NAME);
957+
958+ /* show name with mail address */
959+ if (showMailAddress) {
960+
961+ titleHtml += resdat.nameHTML;
962+ if (!resdat.address.isEmpty()) titleHtml += " [" + resdat.address + ']';
963+
964+ } else { /* don't show mail address */
965+
966+ if (resdat.address.isEmpty()) {
967+
968+ titleHtml += "<span class=\"name_noaddr\">";
969+ titleHtml += resdat.name;
970+ titleHtml += "</span>";
971+
972+ } else {
973+
974+ titleHtml += "<a href=\"mailto:" + resdat.address + "\"";
975+ titleHtml += " title=\"" + resdat.address + "\">";
976+ titleHtml += resdat.name;
977+ titleHtml += "</a>";
978+ }
979+ }
980+
981+ titleHtml += "</b> ";
982+
983+ /* date */
984+ if (useTableTag) titleHtml += "<td class=\"res_title_date\">";
985+ titleHtml += QString::fromUtf8(KITAUTF8_COLON) + resdat.date;
986+ if (useTableTag) titleHtml += "</td>";
987+
988+ /* ID */
989+ if (!resdat.id.isEmpty()) {
990+
991+ if (useTableTag) titleHtml += "<td class=\"res_title_id\">";
992+ if (resdat.id.count("???") >= 1) titleHtml += " ID:" + resdat.id;
993+ else titleHtml += " <a href=\"#idpop" + resdat.id + "\">ID</a>" + ":" + resdat.id;
994+ if (useTableTag) titleHtml += "</td>";
995+ }
996+
997+ /* BE */
998+ if (!resdat.be.isEmpty()) {
999+
1000+ if (useTableTag) titleHtml += "<td class=\"res_title_be\">";
1001+ titleHtml += " <a href=\"#bepop" + resdat.be + "\">?" + resdat.bepointmark + "</a>";
1002+ if (useTableTag) titleHtml += "</td>";
1003+ }
1004+
1005+ /* host */
1006+ if (!resdat.host.isEmpty()) {
1007+
1008+ if (useTableTag) titleHtml += "<td class=\"res_title_host\">";
1009+ titleHtml += " HOST:" + resdat.host;
1010+ if (useTableTag) titleHtml += "</td>";
1011+ }
1012+
1013+ if (useTableTag) titleHtml += "</tr></table>";
1014+}
--- kita/branches/KITA-KDE4/kita/src/libkita/parser.cpp (revision 2554)
+++ kita/branches/KITA-KDE4/kita/src/libkita/parser.cpp (revision 2555)
@@ -665,88 +665,3 @@
665665
666666 return true;
667667 }
668-
669-/* create HTML of title.
670-
671- struct RESDAT resdat should be parsed by parseResDat before calling this function.
672-
673- output: titleHtml
674-
675-*/
676-void Parser::createTitleHtml(RESDAT& resdat, QString& titleHtml)
677-{
678- titleHtml.clear();
679- if (!resdat.parsed) return ;
680-
681- bool showMailAddress = GlobalConfig::showMailAddress();
682- bool useTableTag = GlobalConfig::useStyleSheet();
683-
684- if (useTableTag) titleHtml += "<table class=\"res_title\"><tr>";
685-
686- /* res number */
687- if (useTableTag) titleHtml += "<td class=\"res_title_number\">";
688- titleHtml += "<a href=\"#write" + QString::number(resdat.num) + "\">";
689- titleHtml += QString::number(resdat.num);
690- titleHtml += "</a> ";
691-
692- /* name & mail address */
693- if (useTableTag) titleHtml += "<td class=\"res_title_name\">";
694- titleHtml += "<b>" + QString::fromUtf8(KITAUTF8_NAME);
695-
696- /* show name with mail address */
697- if (showMailAddress) {
698-
699- titleHtml += resdat.nameHTML;
700- if (!resdat.address.isEmpty()) titleHtml += " [" + resdat.address + ']';
701-
702- } else { /* don't show mail address */
703-
704- if (resdat.address.isEmpty()) {
705-
706- titleHtml += "<span class=\"name_noaddr\">";
707- titleHtml += resdat.name;
708- titleHtml += "</span>";
709-
710- } else {
711-
712- titleHtml += "<a href=\"mailto:" + resdat.address + "\"";
713- titleHtml += " title=\"" + resdat.address + "\">";
714- titleHtml += resdat.name;
715- titleHtml += "</a>";
716- }
717- }
718-
719- titleHtml += "</b> ";
720-
721- /* date */
722- if (useTableTag) titleHtml += "<td class=\"res_title_date\">";
723- titleHtml += QString::fromUtf8(KITAUTF8_COLON) + resdat.date;
724- if (useTableTag) titleHtml += "</td>";
725-
726- /* ID */
727- if (!resdat.id.isEmpty()) {
728-
729- if (useTableTag) titleHtml += "<td class=\"res_title_id\">";
730- if (resdat.id.count("???") >= 1) titleHtml += " ID:" + resdat.id;
731- else titleHtml += " <a href=\"#idpop" + resdat.id + "\">ID</a>" + ":" + resdat.id;
732- if (useTableTag) titleHtml += "</td>";
733- }
734-
735- /* BE */
736- if (!resdat.be.isEmpty()) {
737-
738- if (useTableTag) titleHtml += "<td class=\"res_title_be\">";
739- titleHtml += " <a href=\"#bepop" + resdat.be + "\">?" + resdat.bepointmark + "</a>";
740- if (useTableTag) titleHtml += "</td>";
741- }
742-
743- /* host */
744- if (!resdat.host.isEmpty()) {
745-
746- if (useTableTag) titleHtml += "<td class=\"res_title_host\">";
747- titleHtml += " HOST:" + resdat.host;
748- if (useTableTag) titleHtml += "</td>";
749- }
750-
751- if (useTableTag) titleHtml += "</tr></table>";
752-}
--- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h (revision 2554)
+++ kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h (revision 2555)
@@ -218,6 +218,8 @@
218218 /* parsing functions */
219219 bool parseDat(int num);
220220
221+ void createTitleHtml(RESDAT& resdat, QString& titleHtml);
222+
221223 DatInfo(const DatInfo&);
222224 DatInfo& operator=(const DatInfo&);
223225 /*----------------------------*/
--- kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp (revision 2554)
+++ kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp (revision 2555)
@@ -25,7 +25,7 @@
2525 #include "viewmediator.h"
2626 #include "libkita/datmanager.h"
2727 #include "libkita/globalconfig.h"
28-#include "libkita/parsemisc.h"
28+#include "libkita/kita_misc.h"
2929
3030 using namespace Kita;
3131
@@ -48,7 +48,7 @@
4848 void ThreadTabWidget::slotShowMainThread(const KUrl& url)
4949 {
5050 QString refstr;
51- KUrl datUrl = ParseMisc::parseUrl(url, refstr);
51+ KUrl datUrl = getDatUrl(url, refstr);
5252 QString threadName = DatManager(datUrl).threadName();
5353 int jumpNum = 0;
5454
@@ -95,7 +95,7 @@
9595 {
9696 int max = count();
9797 if (max == 0) return ;
98- KUrl datUrl = ParseMisc::parseUrlOnly(url);
98+ KUrl datUrl = getDatUrl(url);
9999
100100 int i, i2;
101101 i = i2 = 0;
@@ -127,7 +127,7 @@
127127 /* private */
128128 ThreadView* ThreadTabWidget::findMainView(const KUrl& url)
129129 {
130- KUrl datUrl = ParseMisc::parseUrlOnly(url);
130+ KUrl datUrl = getDatUrl(url);
131131
132132 int max = count();
133133 if (max == 0) return 0;
@@ -160,7 +160,7 @@
160160 /* private slots */
161161 void ThreadTabWidget::slotUpdateThreadTab(const KUrl& url)
162162 {
163- KUrl datUrl = ParseMisc::parseUrlOnly(url);
163+ KUrl datUrl = getDatUrl(url);
164164
165165 ThreadView * view = findMainView(datUrl);
166166 if (view) {
Show on old repository browser