|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
|
|
|
|
|
// define this to copy all html that is written to the readerwindow to
|
|
|
|
|
// filehtmlwriter.out in the current working directory
|
|
|
|
|
//#define KMAIL_READER_HTML_DEBUG 1
|
|
|
|
|
// #define KMAIL_READER_HTML_DEBUG 1
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
@ -415,6 +415,7 @@ KMReaderWin::KMReaderWin(TQWidget *aParent,
|
|
|
|
|
mUpdateReaderWinTimer( 0, "mUpdateReaderWinTimer" ),
|
|
|
|
|
mResizeTimer( 0, "mResizeTimer" ),
|
|
|
|
|
mDelayedMarkTimer( 0, "mDelayedMarkTimer" ),
|
|
|
|
|
mHeaderRefreshTimer( 0, "mHeaderRefreshTimer" ),
|
|
|
|
|
mOldGlobalOverrideEncoding( "---" ), // init with dummy value
|
|
|
|
|
mCSSHelper( 0 ),
|
|
|
|
|
mRootNode( 0 ),
|
|
|
|
@ -472,6 +473,8 @@ KMReaderWin::KMReaderWin(TQWidget *aParent,
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT(slotDelayedResize()) );
|
|
|
|
|
connect( &mDelayedMarkTimer, TQT_SIGNAL(timeout()),
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT(slotTouchMessage()) );
|
|
|
|
|
connect( &mHeaderRefreshTimer, TQT_SIGNAL(timeout()),
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT(updateHeader()) );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1174,8 +1177,6 @@ void KMReaderWin::setMsg( KMMessage* aMsg, bool force, bool updateOnly )
|
|
|
|
|
aMsg->attach( this );
|
|
|
|
|
mAtmUpdate = false;
|
|
|
|
|
|
|
|
|
|
// connect to the updates if we have hancy headers
|
|
|
|
|
|
|
|
|
|
mDelayedMarkTimer.stop();
|
|
|
|
|
|
|
|
|
|
mMessage = 0;
|
|
|
|
@ -1227,6 +1228,8 @@ void KMReaderWin::setMsg( KMMessage* aMsg, bool force, bool updateOnly )
|
|
|
|
|
else
|
|
|
|
|
slotTouchMessage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mHeaderRefreshTimer.start( 1000, false );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
@ -1664,6 +1667,66 @@ kdDebug(5006) << "KMReaderWin - composing unencrypted message" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
void KMReaderWin::updateHeader()
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* TODO: mess around with KHTML DOM some more and figure out how to
|
|
|
|
|
* replace the entire header div w/out flickering to hell and back
|
|
|
|
|
*
|
|
|
|
|
* DOM::NodeList divs(mViewer->document().documentElement().getElementsByTagName("div"));
|
|
|
|
|
* static_cast<DOM::HTMLDivElement>(divs.item(0)).setInnerHTML(writeMsgHeader());
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
KMMessage* currentMessage = message();
|
|
|
|
|
|
|
|
|
|
if (currentMessage &&
|
|
|
|
|
mHeaderStyle == HeaderStyle::fancy() &&
|
|
|
|
|
currentMessage->parent())
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int divNumber = -1;
|
|
|
|
|
DOM::NodeList divs(mViewer->document().documentElement().getElementsByTagName("div"));
|
|
|
|
|
DOM::NodeList headerDivs(static_cast<DOM::HTMLDivElement>(divs.item(0)).getElementsByTagName("div"));
|
|
|
|
|
for (i=0; i<((int)headerDivs.length()); i++) {
|
|
|
|
|
if (static_cast<DOM::HTMLDivElement>(headerDivs.item(i)).id().string() == "sendersCurrentTime") {
|
|
|
|
|
divNumber = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (divNumber >= 0) {
|
|
|
|
|
DOM::HTMLDivElement elem = static_cast<DOM::HTMLDivElement>(headerDivs.item(i));
|
|
|
|
|
|
|
|
|
|
// HACK
|
|
|
|
|
// Get updated time information
|
|
|
|
|
TQString latestHeader = headerStyle()->format( currentMessage, headerStrategy(), "", mPrinting, false );
|
|
|
|
|
int startPos = latestHeader.find("<div id=\"sendersCurrentTime\" style=\"");
|
|
|
|
|
if (startPos >= 0) {
|
|
|
|
|
latestHeader = latestHeader.mid(startPos);
|
|
|
|
|
int endPos = latestHeader.find("</div>");
|
|
|
|
|
if (endPos >= 0) {
|
|
|
|
|
endPos = endPos + 6;
|
|
|
|
|
latestHeader.truncate(endPos);
|
|
|
|
|
|
|
|
|
|
TQString divText = latestHeader;
|
|
|
|
|
TQString divStyle = latestHeader;
|
|
|
|
|
|
|
|
|
|
divText = divText.mid(divText.find(">")+1);
|
|
|
|
|
divText.truncate(divText.find("</div>"));
|
|
|
|
|
|
|
|
|
|
divStyle = divStyle.mid(TQString("<div id=\"sendersCurrentTime\" style=\"").length());
|
|
|
|
|
divStyle.truncate(divStyle.find("\""));
|
|
|
|
|
|
|
|
|
|
elem.setInnerHTML(divText);
|
|
|
|
|
elem.setAttribute("style", divStyle);
|
|
|
|
|
elem.applyChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
TQString KMReaderWin::writeMsgHeader( KMMessage* aMsg, partNode *vCardNode, bool topLevel )
|
|
|
|
|
{
|
|
|
|
@ -1675,7 +1738,7 @@ TQString KMReaderWin::writeMsgHeader( KMMessage* aMsg, partNode *vCardNode, bool
|
|
|
|
|
if ( vCardNode )
|
|
|
|
|
href = vCardNode->asHREF( "body" );
|
|
|
|
|
|
|
|
|
|
return headerStyle()->format( aMsg, headerStrategy(), href, mPrinting, topLevel );
|
|
|
|
|
return headerStyle()->format( aMsg, headerStrategy(), href, mPrinting, topLevel );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|