From kde-commits Fri Jul 29 21:15:47 2005 From: Spiros Georgaras Date: Fri, 29 Jul 2005 21:15:47 +0000 To: kde-commits Subject: kdenonbeta/kio_mhtml Message-Id: <1122671747.825429.21705.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=112267175900265 SVN commit 440104 by sngeorgaras: adding colors for quoted text in EML M +113 -6 kmhtmlarchive.cpp M +5 -0 kmhtmlarchive.h --- trunk/kdenonbeta/kio_mhtml/kmhtmlarchive.cpp #440103:440104 @@ -1469,6 +1469,110 @@ // if(archive->isEML){ // make links if(archive->isMarkupFromText){ + // create colored >> fields + gtEl=new struct GT_ELEMENTS[5]; + struct GT_ELEMENTS *tmpEl; + int gtElCount=5; + int curGtEl=-1; + int find=0; + int gtCount; + while((find=str.find("\n> ",find))!=-1){ + //kdDebug()<<"find="<isDOS) end=str.find("\r",find); + else end=str.find("\n",find); + //kdDebug()<<"end="< ",tmp))!=-1){ + if(tmp-oldTmp-2>0) break; + gtEl[curGtEl].level++; + oldTmp=tmp; + tmp++; + } + gtEl[curGtEl].level=gtEl[curGtEl].level%3; + //kdDebug()<"); + } + + // add font tags + for(int i=curGtEl;i>=0;i--){ + str.insert(gtEl[i].end,""); + str.insert(gtEl[i].start,cols[gtEl[i].level]); + } + + + // insert level 0 color in lines + // that contain only a > + QCString onlyGt; + if(archive->isDOS) onlyGt="\n>
\r"; + else onlyGt="\n>
\n"; + // insert font tags for level 0 color + // in lines that contain only a > + find=0; + while((find=str.find(onlyGt,find))!=-1){ + str.insert(find+2,""); + str.insert(find+1,cols[0]); + } + + delete gtEl; + + + // convert links to html #define LINKS 3 char s[LINKS][15]={ @@ -1510,7 +1614,7 @@ // convert mail to html //kdDebug()<< - int find=0; + find=0; while((find=str.find('@',find))!=-1){ int st=find-1; QCString ff=str.mid(st,1); @@ -1662,11 +1766,13 @@ // read subject fore color QColor hTxtCol=KGlobalSettings::highlightedTextColor(); QString hTxt; - hTxt.sprintf("%X%X%X", hTxtCol.red(),hTxtCol.green(), hTxtCol.blue()); + hTxt.sprintf("#%2X%2X%2X", hTxtCol.red(),hTxtCol.green(), hTxtCol.blue()); + hTxt.replace(" ","0"); // read dubject back color QColor hCol=KGlobalSettings::highlightColor(); QString hC; - hC.sprintf("%X%X%X", hCol.red(),hCol.green(), hCol.blue()); + hC.sprintf("#%2X%2X%2X", hCol.red(),hCol.green(), hCol.blue()); + hC.replace(" ","0"); // create fallback color for others back color int h=0,s=0,v=0; hCol.getHsv(h,s,v); @@ -1681,7 +1787,8 @@ config.setGroup("WM"); QColor bCol=config.readColorEntry("frame",&hTxtCol); QString bC; - bC.sprintf("%X%X%X", bCol.red(),bCol.green(), bCol.blue()); + bC.sprintf("#%2X%2X%2X", bCol.red(),bCol.green(), bCol.blue()); + bC.replace(" ","0"); // write HTML code QCString ins=""; if(archive->isDOS) ins.append(archive->controlChars[0]); @@ -2203,12 +2310,12 @@ ret.append(mDate.mid(3,4)); month=mDate.mid(7,3); left=10; - kdDebug()<<"month(1)="<