Version: (using KDE KDE 3.2.2) Installed from: Gentoo Packages OS: Linux kmail need to support HTML signature right now, the code are just pasted, as a plain/text signature
This also ahppens in kde 3.3.0 alpa, even though kmail now supports formatting HTML mail. This need to be supported.
Created attachment 6704 [details] patch to strip html from signatures Well, until this gets fixed, here's something to at least make things a little nicer and mirror some functionality of Evolution. This patch uses some code borrowed from kmmessage.cpp to strip the HTML from signatures.
I also want nice HTML-formated signatures, including images (that should probably be attached), etc.
Created attachment 9268 [details] Patch to enable HTMl signatures Here is a patch to add full HTML signature support. It tries to auto-detect if the signature has HTML in it. If so, and you have FOrmatting (HTML) enabled, the signature will be inserted as HTML.
why dont http://bugs.kde.org/show_bug.cgi?id=97603 ?
yes, please add this feature, I need it as well!! :) Thanks!
I applied that patch on kde 3.4.2's kmail: it works :) please port it to current trunk
oh I found a bug in that patch: if you have several identities with different html signatures, the signature is not changed when you change the indentity.
another bug: replying and forwarding destroys the formatting: each line becomes its own paragraph (<p>). The colouring of quotes won't work anymore either.
I've taken a look at how other clients do this and it seems that both mozilla firebird and outlook send html signatures as attachments. Doing it this way provides a way of displaying images within the html by also sending them as attachments. I'm gonna have a dig in the code to see if it might be simple enough to implement this way.
Hi! This is still missing on the current stable kmail. Any chance to get it?
i really need this feature... my boss is driving me nuts because my signature cannot be compliant to my company's standards.
SVN commit 599323 by winterz: FEATURE: HTML Signatures Apply patch that Jason Keirstead provided over 1.5 years ago. Please test. CCMAIL: jason@keirstead.org CCBUGS: 81989 M +55 -7 branches/work/kdepim-3.5.5+/kmail/kmcomposewin.cpp M +6 -0 branches/work/kdepim-3.5.5+/kmail/kmcomposewin.h --- branches/work/kdepim-3.5.5+/kmail/kmcomposewin.cpp #599322:599323 @@ -3498,7 +3498,7 @@ #undef KeyPress #endif - QKeyEvent k(QEvent::KeyPress, Key_C , 0 , ControlButton); + QKeyEvent k(QEvent::KeyPress, Key_C, 0, ControlButton); kapp->notify(fw, &k); } @@ -3518,7 +3518,7 @@ #undef KeyPress #endif - QKeyEvent k(QEvent::KeyPress, Key_V , 0 , ControlButton); + QKeyEvent k(QEvent::KeyPress, Key_V, 0, ControlButton); kapp->notify(fw, &k); } @@ -4029,19 +4029,67 @@ { bool mod = mEditor->isModified(); - const KPIM::Identity & ident = - kmkernel->identityManager()->identityForUoidOrDefault( mIdentity->currentIdentity() ); + const KPIM::Identity &ident = + kmkernel->identityManager()-> + identityForUoidOrDefault( mIdentity->currentIdentity() ); + mOldSigText = ident.signatureText(); + kdDebug() << "KMAIL: APPEND SIG " << mOldSigText << endl; if( !mOldSigText.isEmpty() ) { - mEditor->append(mOldSigText); - mEditor->setModified(mod); + mEditor->sync(); + kdDebug() << "KMAIL: HAS A SIG TO APPEND" << endl; + bool sigHasTags = + mOldSigText.contains( QRegExp( QString::fromLatin1( "<[^>]*>" ) ) ); + + if( markupAction->isChecked() && sigHasTags ) { + kdDebug() << "KMAIL: TOGGLE MARKUP TRUE" << endl; + // Turn on markup since we have an HTML sig + toggleMarkup( true ); + + // Replace separator linefeed, will always be this format according + // to Signature + mOldSigText = QString::fromLatin1( "--<p>" ) + mOldSigText.mid( 4 ); + + // Note - Can't use append() because it always inserts plain text + mEditor->setText( mEditor->text() + + QString::fromLatin1( "<p>" ) + mOldSigText ); + } else { + kdDebug() << "KMAIL: NOT AN HTML SIG" << endl; + mEditor->append( sigHasTags ? stripHTML( mOldSigText ) : mOldSigText ); + } + + mEditor->update(); + mEditor->setModified( mod ); mEditor->setContentsPos( 0, 0 ); - mEditor->sync(); } } +QString KMComposeWin::stripHTML( const QString &str ) +{ + QRegExp htmlTags( QString::fromLatin1( "<[^>]*>" ) ); + QString data = str; + //remove linebreak and multiple spaces + data.replace( QRegExp( QString::fromLatin1( "\\s*[\n\r\t]+\\s*" ), false ), + QString::fromLatin1(" " )) ; + data.replace( QRegExp( QString::fromLatin1( "< */ *p[^>]*>" ), false ), + QString::fromLatin1( "\n" ) ); + data.replace( QRegExp( QString::fromLatin1( "< */ *div[^>]*>" ), false ), + QString::fromLatin1( "\n" ) ); + data.replace( QRegExp( QString::fromLatin1( "< *br */? *>" ), false ), + QString::fromLatin1( "\n" ) ); + data.replace( htmlTags, QString::null ); + + data.replace( QString::fromLatin1( ">" ), QString::fromLatin1( ">" ) ); + data.replace( QString::fromLatin1( "<" ), QString::fromLatin1( "<" ) ); + data.replace( QString::fromLatin1( """ ), QString::fromLatin1( "\"" ) ); + data.replace( QString::fromLatin1( " " ), QString::fromLatin1( " " ) ); + data.replace( QString::fromLatin1( "&" ), QString::fromLatin1( "&" ) ); + + return data; +} + //----------------------------------------------------------------------------- void KMComposeWin::slotHelp() { --- branches/work/kdepim-3.5.5+/kmail/kmcomposewin.h #599322:599323 @@ -630,6 +630,12 @@ KMComposeWin::SaveIn saveIn = KMComposeWin::None ); /** + * Returns a string contains the input string @p str that has been striped of + * all @acronym HTML tags. + */ + QString stripHTML( const QString &str ); + + /** * Returns the autosave interval in milliseconds (as needed for QTimer). */ int autoSaveInterval() const;
s some of you might now, we are in the process of testing a new kdepim features branch. You might want to read my blog for some details: http://www.kdedevelopers.org/blog/1451 Anyhow, I am committing Jason's patch that is included in this bug report to the kmail that is in that new branch. But I don't know the typical use case for html signatures so I need some folks to help test. I'll put up a new blog entry with more info soon.
i don't have the faintest idea about how to apply this patch... guidelines welcome. thanks. Le jeudi 26 octobre 2006 18:59, Allen Winter a écrit : [bugs.kde.org quoted mail]
Then please don't even try. I wasn't clear. I should have stated to apply the patch if you know how to compile and install the KDE software (or know someone who will help you).
Are there any news about html signature? I've installed kde 3.5.6 and it's not supported yet.
>Are there any news about html signature? I've installed kde 3.5.6 and it's not supported yet. It is not yet supported in the main branch, only in the PIM 3.5.5+ branch, If you want to try this, you need to manually compile the subversion checkout from there. http://techbase.kde.org/Projects/kdepim/Installing_the_KDE_PIM_3.5.5+_feature_branch Note that that branch also contains unstable, crashy things like label support.
I'll give this more votes, because it is really needed!! I'm trying to convince my wife to switch to KDE, but if she can't compose nice colourfull mail's with ditto sig's, it's a nono.
in the mean time, she could use a different email client than kmail? switching to KDE is a great thing. if she does not use kmail for a year or two yet. it is still awesome. I dont know of any client who does html signature though, so sorry no suggestion. but get her to switch. gambatte.
On Kmail 1.9.6, KDE 3.5.7: Best way to add a HTML signature is to create a HTML file (say with NVU), then go to the template folder (should be under drafts folder) and create a template and attach that HTML file. Next, while still in the Message, open the properties of the HTML file and choose "Suggest Automatic Display" and make sure the type (at the top of the panel) is text/html. Now save it back into the templates folder and you will see it does what you want. Use the template every time you need a new email - you can send it straight from the template folder without having to re-create the original. So now you have the ability to write a non-html e-mail (and please the purists) but send it with a HTML attachment (and then infuriate them). Best of all worlds really
Our corporate signature I have to use is a html snippet including an image. I tried Johns approach, but I cant seem to get the image to display. Any hints?
honestly Fred, your wife wont like kmail. Until the kmail team stop this anal attitude of putting out what is a dated e-mail client, Kmail will be the downfall of KDE. Many people I know use gnome simply for evolution and wont touch KDE because of Kmail, and those that do use Kmail use evolution on it. All you have to do is look at all the other email clients, Evolution, Apple Mail, Windows Live Mail, Firefox, they are all moving in a direction allowing users to get huge enjoyment out of their email, including, inserting photo's emails, etc. Kmail, is still stuck in the early 90's wanting to be a boring old piece of crap. Manfred, install Evolution, dpending on what distro you are on it isn't hard.
kmail was my favorite mail client since KDE 1.0 and I've been swearing by it and only by it... until their unstable support for dIMAP killed many of my mails. that's without mentioning the numerous crashes.
To clarify Johns instructions a bit and what I had to do to get the image there. Just create a new message. Add the signature you want. Attach the image you want at the bottom. Right click on the image and select properties. Click suggest automatic display. That seems to do the trick for me. I have a non html email (beautiful) and I still adhere to the corporate overlords requiring the signature image (with address and stuff not readable... dumb but true).
Oh and a note to alienwithin@gmail.com: I tried Evolution. It just reminded me too much of Outlook to be painless to use. Anyway .. I used to use Thunderbird under Windows and that was fine too. But now that I work under Linux/KDE all day Kontact is it for me...
Well, this is my answer. The other comments are right on, this is 2007 and any email client needs to support html signatures. They are required by many employers and the continued lack of support after this bug was opened in May of 2004 shows me that kmail is not being developed as a serious email client. For the record, I was a Unix admin for 12 years and prefer text based email over anything else. However, we all have to grow up someday. I suggest to everyone else that you cease using kmail if you want HTML signature support and look to other clients. This lack of support is more than a little juvenile.
wow, what a hidden gem it is! you can do inline images with kmail if you get to right click and then check some "advanced" option. Is so hard to leave there also CID field? Or is it so hard to guess it automatically from the filename? cDisp += "\nContent-ID: <" + encName.replace( '\\', "\\\\" ).replace( '"', "\\\"" ) + ">"; One should realize how easier it could make the things. Don't get me wrong, I am KDE and KMail fan since some 2.x KDE version. Evolution is worse than Outlook, Thunderbird is worse than Outlook Express even. The only option I find usable is KMail. But there are things that are just unacceptable. "Patch to enable HTMl signatures"? Does it worth anything without images? Don't you realize that must people just want a table with company logo in the left td and info in the right one? I do understand that a good support for inline images would require reworking of the current message editor, so just make a workaround, do some shortcuts... >Use the template every time you need a new email Oh... how nice... what about reply and forward? is there an option like "reply using template from templates folder"? with all the respect this issue falls directly into "power of ignorance". sorry for being so aggressive.
> with all the respect this issue falls directly into "power of ignorance". > sorry for being so aggressive. No, it does not fall into "power of ignorance". It rather falls into "lack of time" and "shortage of developers".
Dear all, I use KMail from day 1, but, the arrogance of the kdepim regarding HTML support is something that kills me. You cannot fight Spam by not permitting HTML emails. Besides, Linux is about choice. Give users both options and leave it to us to decide if we want HTML or not. Of course, if any option is hidden somewhere, is useless.
> I use KMail from day 1, but, the arrogance of the kdepim regarding HTML support is something that kills me. Huh? I just said in the previous comment that this has nothing to do with unwillingness or even arrogance, but rather the lack of time by the developers and the actual lack of developers. Patches for the trunk (KDE4) versions are always welcome. The 3.5 branch is in a feature freeze however.
Gentlemen, gentlemen...calm...down! The right way of getting this done is one of three things: 1. If you're a developer, start developing 2. If you're not a developer, vote this thing up. Find other users to vote for this. Make it THE most popular request for the pim package. 3. Keep bugging the developers on the dev-list (although they might not like this option)
>Additional Comment #29 From Thomas McGuire 2007-11-26 17:39 Thomas, it is not the matter of "lack of time". If one does not have time to finish something then just don't start! That is the problem! I was soooo happy when I've seen "Patch to enable HTMl signatures", but can you compare what I have expected with what I've got? Obviously it is less related to kdepim and more to the way things work in community driven projects. Sorry for my previous post, it was certainly overreacted. Again, I thought my favorite software just got better and instead I was disappointed enough to try the Evolution-Thunderbird-GMail cycle again for a day.
> Additional Comment #32 From Fred van Zwieten 2007-11-26 22:50 I am not a developer, especially when it comes to C++, neither I can start learning KDE code internal logics. I've tried for an hour to find in the code the reason why "Content-ID" gets stripped with "new from template" approach, or where I can add "Content-ID: <filename>" again... no luck. All I've found was to add it through attachment properties dialog as I've posted above. If someone would be so kind to point me into where it is I'd be very grateful.
>Additional Comment #33 From Michael 2007-11-27 15:59 Michael you have to understand that 99% people who work on KDE do it for fun in their spare time. If no one finds development on KMail fun anymore they will work on something else, which is what has happened. Until either a company steps up to fund a complete re-write of the KMail composer subsystem (which is what is actually needed to fix all of its problems if you look at the crazy code), it is not going to get done. People have moved onto other things in KDE. You being frustrated and yelling at people won't motivate anyone. I do agree with you that it is somewhat sad and frustrating that such an important piece of the desktop is so badly neglected. If I had the spare time I would step up and fix it myself. Using KMail is like going back to the dark ages of email - I can't put up with it anymore, I use Thunderbird always now.
Maybe you have better luck with asking the Mailody developer, which seems to be less abandoned than kmail.. http://www.mailody.net/
>Additional Comment #35 From Jason Keirstead 2007-11-27 16:13 Jason, I do understand perfectly that most of the contributions done to kde are "free time". I have GNU/Linux only computers since I've seen windows XP for the first and for the last time on a new notebook, so I have some experince. And I know what it is to "have fun" when doing something, I know it very well, I have some "free time" projects too (not to mention projects I do for money, which are even more boring). And I am not yelling, ok maybe I do ;) the thing is that nobody can fix kmail without rewriting most of it, so just give up with that, don't say you support anything until you DO support it. Otherwise it seems like a toy and this way nobody will grow up. not kde. not linux. Thunderbird is terrible in all the rest of functionality. Only composer works good.
>Additional Comment #36 From Bart Verwilst 2007-11-27 16:41 tried the latest today, will better wait until it gets qt4 ported. looks promising but not really working ;)
>Patches for the trunk (KDE4) versions are always welcome. The 3.5 branch is in a feature freeze however. Well, in case not enough developers create code for KMail, then, why is it a part of KDE? I mean, there are alternatives! Of course that's not an option. What IS an option, is to ask large companies for support!
http://kde-apps.org/content/show.php?content=29552 constructive?
I dont see how is this related...
Created attachment 23227 [details] HTML signature Hi, This (and the next) is a patch against trunk that enables HTML signatures. Can I commit? It still needs some finetuning (like naming), but the functionality is basically there. Regards, Edwin
Created attachment 23228 [details] HTML signature (kdepimlibs) This is a kdepimlibs patch against trunk that enables HTML signatures together with the previous patch.
You have my blessing to please commit the patch for kdepimlibs. Thomas has promised to look at the patch for the KMail part soon.
Thanks for the patch. I tested it, but it seems that it doesn't work. When I enable HTML signatures, KMail adds the signature as HTML code instead of actually formatting it as HTML. It seems that this is because of KMeditor::insertSignature(), which always calls insertPlainText(). You probably need to change that so it calls insertHtml() instead, but only if the signature is a HTML signature. >+ QString _InlinedHtml = config.readEntry( sigTypeInlinedHtmlKey ); >+ if ( _InlinedHtml == "true") >+ mInlinedHtml = true; No need to take the detour to read a QString and changing it to a bool then, readEntry supports reading bools directly. Change that to >mInlinedHtml = config.readEntry( sigTypeInlinedHtmlKey, false ); Otherwise, mInlinedHtml is even undefined if _InlinedHtml is something else than "true", which leads to the signature being always HTML, regardless of the config value. A couple of minor nitpicks follow now: >+ /** @return true if the inlined signature is html formatted */ >+ bool SignatureIsInlinedHtml() const; You need to add "@since 4.1" into the comment to make clear that this method does not exist with the kdepimlibs from 4.0 Additionally, method names should always start with a lowercase letter, so change it to signatureIsInlinedHtml. >+ void setInlinedHtml( bool isHtml ); >+ bool isInlinedHtml() const; add "@since 4.1", and comments for @return and @param isHtml. Generally, new methods for libraries should be well documented. >+ mHtmlCheck = new QCheckBox( i18n("&use HTML"), page ); Should be "&Use HTML" >+ void setBtnState(ViewMode state); Change this to the following, as per the KMail code style: >+ void setBtnState( ViewMode state ); Same with: >+ setBtnState(ShowHtml); >+ setBtnState(ShowCode); >+ void SignatureConfigurator::setBtnState(ViewMode state) { and maybe others >+ } >+ void SignatureConfigurator::setBtnState(ViewMode state) { Add a newline between the two lines >+ kDebug(5006) << "SignatureConfigurator::slotSetHtml"; Unnecessary, change it to >kDebug(5006);
Oh, and another thing: The HTML produced by QTextEdit is crap, it has lots of unneccesary tags. For "Hello World" I get: ><html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li > { white-space: pre-wrap; } > </style></head><body style=" font-family:'Monospace'; font-size:10pt; > font-weight:400; font-style:normal;"> > <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; > margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" > font-weight:600;">Hello World</span></p></body></html> But that is a Qt bug. However, it makes manually adding some tags to the signature a pain. Maybe most of the above standard tags can be removed when switching from plaintext to HTML?
Oh, another thing that needs to be fixed is that changing the identity in the composer does not change the signature.
(as maintainer of that part of kdepimlibs) After you fix the issues outlined by tmg, you can commit the kdepimlibs part.
SVN commit 768920 by eschepers: FEATURE: HTML signatures BUG: 81989 TODO : - correct handling when changing identity - inserting images - some kind of button/toolbar to create html signature in wysiwyg mode? M +7 -1 kmcomposewin.cpp M +99 -4 signatureconfigurator.cpp M +16 -0 signatureconfigurator.h WebSVN link: http://websvn.kde.org/?view=rev&revision=768920
*** Bug 158028 has been marked as a duplicate of this bug. ***