From 7f4446124f23f4ef412a86324f68de31f86a4d5d Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Mon, 27 Jul 2009 08:53:39 +0000 Subject: [PATCH] SVN_MERGE Merged revisions 999615-999625,999627,999630,999658,999674,999758,999760,999765,999879,999883,1000002 via svnmerge from https://vkrause@svn.kde.org/home/kde/trunk/KDE/kdepim ........ r999615 | skelly | 2009-07-20 11:41:05 +0200 (Mon, 20 Jul 2009) | 1 line Clean up a little bit of finding the first row. ........ r999616 | skelly | 2009-07-20 11:41:08 +0200 (Mon, 20 Jul 2009) | 1 line Only retrieve the row from the ModelIndex once. ........ r999617 | skelly | 2009-07-20 11:41:10 +0200 (Mon, 20 Jul 2009) | 1 line Use start.column as the column. At least, don't set it to the wrong value. ........ r999618 | skelly | 2009-07-20 11:41:12 +0200 (Mon, 20 Jul 2009) | 1 line Add a way to clear the Dynamic Tree Model ........ r999619 | skelly | 2009-07-20 11:41:15 +0200 (Mon, 20 Jul 2009) | 4 lines Move the commands for the tests into a separate class. This will allow running tests individually, and putting the tests into the gui test app. ........ r999620 | skelly | 2009-07-20 11:41:17 +0200 (Mon, 20 Jul 2009) | 1 line Use init method to that tests get set up correctly each time. ........ r999621 | skelly | 2009-07-20 11:41:19 +0200 (Mon, 20 Jul 2009) | 1 line Stop and start the model spy spying when needed. ........ r999622 | skelly | 2009-07-20 11:41:21 +0200 (Mon, 20 Jul 2009) | 1 line Add some infrastructure for signalling moves. ........ r999623 | skelly | 2009-07-20 11:41:24 +0200 (Mon, 20 Jul 2009) | 1 line Some test fixes and asserts. ........ r999624 | skelly | 2009-07-20 11:41:27 +0200 (Mon, 20 Jul 2009) | 1 line add some skeletal stuff for move testing. ........ r999625 | skelly | 2009-07-20 11:41:32 +0200 (Mon, 20 Jul 2009) | 3 lines Update for changes in ProxyModelTest. This will allow testing making different selections. ........ r999627 | ervin | 2009-07-20 11:48:46 +0200 (Mon, 20 Jul 2009) | 2 lines Allow to remove a collection from the favorites list. ........ r999630 | ervin | 2009-07-20 11:49:37 +0200 (Mon, 20 Jul 2009) | 3 lines Make use of the new action to remove a collection from the favorites list. ........ r999658 | skelly | 2009-07-20 12:45:12 +0200 (Mon, 20 Jul 2009) | 5 lines Try again to move tests for proxy models to kdelibs. SVN is wierd. ........ r999674 | skelly | 2009-07-20 13:01:30 +0200 (Mon, 20 Jul 2009) | 2 lines Try again to move proxymodel dox from kdepim to kdelibs. ........ r999758 | ervin | 2009-07-20 15:33:32 +0200 (Mon, 20 Jul 2009) | 2 lines Allow to change the label of a favorite. Make the labels persistent. ........ r999760 | ervin | 2009-07-20 15:34:19 +0200 (Mon, 20 Jul 2009) | 2 lines Make use of the rename action for favorite folders. ........ r999765 | jarmond | 2009-07-20 15:40:37 +0200 (Mon, 20 Jul 2009) | 5 lines Implement %SIGNATURE template command to allow customised signature insertion location. FEATURE: 6376 FEATURE: 159789 ........ r999879 | scripty | 2009-07-20 16:33:00 +0200 (Mon, 20 Jul 2009) | 1 line SVN_SILENT made messages (.desktop file) ........ r999883 | bbroeksema | 2009-07-20 16:34:56 +0200 (Mon, 20 Jul 2009) | 7 lines Replace the combobox widget with a treeview in the settings pages of akonadi based conduits. Thanks Robert Marmorstein for providing this patch! BUG: 181558 ........ r1000002 | ervin | 2009-07-20 19:47:58 +0200 (Mon, 20 Jul 2009) | 3 lines Attach a favorite selection model to the standard action manager of akonadiconsole. ........ svn path=/branches/work/akonadi-ports/kdepim/; revision=1002886 --- templateparser.cpp | 24 ++++++++++++++++++++++++ templateparser.h | 6 ++++++ templatesinsertcommand.cpp | 3 +++ templatesinsertcommand.h | 2 +- 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/templateparser.cpp b/templateparser.cpp index 17fffe1f0..52b539328 100644 --- a/templateparser.cpp +++ b/templateparser.cpp @@ -846,6 +846,11 @@ void TemplateParser::processWithTemplate( const QString &tmpl ) i += strlen( "CURSOR" ); mMsg->setCursorPos( body.length() ); + } else if ( cmd.startsWith( QLatin1String( "SIGNATURE" ) ) ) { + kDebug() << "Command: SIGNATURE"; + i += strlen( "SIGNATURE" ); + body.append( getSignature() ); + } else { // wrong command, do nothing body.append( c ); @@ -868,6 +873,25 @@ void TemplateParser::processWithTemplate( const QString &tmpl ) addProcessedBodyToMessage( body ); } +QString TemplateParser::getSignature() const +{ + const KPIMIdentities::Identity &identity = + kmkernel->identityManager()->identityForUoid( mIdentity ); + if ( identity.isNull() ) + return QString(); + + KPIMIdentities::Signature signature = const_cast + ( identity ).signature(); + if ( signature.type() == KPIMIdentities::Signature::Inlined && + signature.isInlinedHtml() ) { + // templates don't support HTML; convert to plain text + return signature.plainText(); + } + else { + return signature.rawText(); + } +} + void TemplateParser::addProcessedBodyToMessage( const QString &body ) { diff --git a/templateparser.h b/templateparser.h index f378e1c7c..81f6f31f3 100644 --- a/templateparser.h +++ b/templateparser.h @@ -96,6 +96,12 @@ class TemplateParser : public QObject int parseQuotes( const QString &prefix, const QString &str, QString "e ) const; + + private: + /** + * Return the text signature used the by current identity. + */ + QString getSignature() const; }; } // namespace KMail diff --git a/templatesinsertcommand.cpp b/templatesinsertcommand.cpp index 06d157eb7..5a9456ce2 100644 --- a/templatesinsertcommand.cpp +++ b/templatesinsertcommand.cpp @@ -112,6 +112,8 @@ static const int extCommandsCount = sizeof( extCommands ) / sizeof( *extCommands ); static const InsertCommand miscCommands[] = { + { I18N_NOOP2( "Inserts user signature, also known as footer, into message", "Signature" ), + TemplatesInsertCommand::CSignature }, { I18N_NOOP( "Insert File Content" ), TemplatesInsertCommand::CInsert }, { I18N_NOOP2( "All characters, up to and including the next newline, are discarded without performing any macro expansion", "Discard to Next Line" ), TemplatesInsertCommand::CDnl }, @@ -261,6 +263,7 @@ void TemplatesInsertCommand::slotMapped( int cmd ) case TemplatesInsertCommand::CBodyPipe: emit insertCommand("%BODYPIPE=\"\"", -1); break; case TemplatesInsertCommand::CClearPipe: emit insertCommand("%CLEARPIPE=\"\"", -1); break; case TemplatesInsertCommand::CCursor: emit insertCommand("%CURSOR"); break; + case TemplatesInsertCommand::CSignature: emit insertCommand( "%SIGNATURE" ); break; case TemplatesInsertCommand::CInsert: emit insertCommand("%INSERT=\"\"", -1); break; case TemplatesInsertCommand::CDnl: emit insertCommand("%-"); break; case TemplatesInsertCommand::CRem: emit insertCommand("%REM=\"\"", -1); break; diff --git a/templatesinsertcommand.h b/templatesinsertcommand.h index a2ee1d426..98900aecf 100644 --- a/templatesinsertcommand.h +++ b/templatesinsertcommand.h @@ -44,7 +44,7 @@ class TemplatesInsertCommand : public QPushButton CBlank, CNop, CClear, CDebug, CDebugOff, CToFName, CToLName, CFromFName, CFromLName, COToFName, COToLName, COFromFName, COFromLName, CCursor, CCCAddr, CCCName, CCCFName, CCCLName, COCCAddr, COCCName, COCCFName, COCCLName, - COAddresseesAddr }; + COAddresseesAddr, CSignature }; signals: void insertCommand( TemplatesInsertCommand::Command cmd );