49 #include <messagecore/utils/stringutil.h>
50 #include <libkdepim/misc/broadcaststatus.h>
51 #include <libkdepim/job/openemailaddressjob.h>
53 #include <akonadi/contact/contactsearchjob.h>
55 #include <kmime/kmime_content.h>
56 #include <KPIMUtils/Email>
57 #include <KPIMUtils/KFileIO>
62 #include <KStandardDirs>
65 #include <QApplication>
77 using namespace MessageViewer;
78 using namespace MessageCore;
83 class KMailProtocolURLHandler :
public URLHandler {
86 ~KMailProtocolURLHandler() {}
89 bool handleContextMenuRequest(
const KUrl & url,
const QPoint &,
ViewerPrivate * )
const {
90 return url.protocol() == QLatin1String(
"kmail" );
92 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const;
95 class ExpandCollapseQuoteURLManager :
public URLHandler {
97 ExpandCollapseQuoteURLManager() :
URLHandler() {}
98 ~ExpandCollapseQuoteURLManager() {}
101 bool handleContextMenuRequest(
const KUrl &,
const QPoint &,
ViewerPrivate * )
const {
104 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const;
111 ~SMimeURLHandler() {}
114 bool handleContextMenuRequest(
const KUrl &,
const QPoint &,
ViewerPrivate * )
const {
117 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const;
123 ~MailToURLHandler() {}
125 bool handleClick(
const KUrl &,
ViewerPrivate * )
const {
return false; }
126 bool handleContextMenuRequest(
const KUrl &,
const QPoint &,
ViewerPrivate * )
const {
129 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const;
132 class ContactUidURLHandler :
public URLHandler {
135 ~ContactUidURLHandler() {}
138 bool handleContextMenuRequest(
const KUrl &url,
const QPoint &p,
ViewerPrivate * )
const;
139 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const;
145 ~HtmlAnchorHandler() {}
148 bool handleContextMenuRequest(
const KUrl &,
const QPoint &,
ViewerPrivate * )
const {
151 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const {
return QString(); }
154 class AttachmentURLHandler :
public URLHandler {
157 ~AttachmentURLHandler() {}
160 bool handleShiftClick(
const KUrl &,
ViewerPrivate *window )
const;
161 bool handleContextMenuRequest(
const KUrl &,
const QPoint &,
ViewerPrivate * )
const;
162 bool handleDrag(
const KUrl &url,
ViewerPrivate *window )
const;
163 bool willHandleDrag(
const KUrl &url,
ViewerPrivate *window )
const;
164 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const;
166 KMime::Content* nodeForUrl(
const KUrl &url,
ViewerPrivate *w )
const;
167 bool attachmentIsInHeader(
const KUrl &url )
const;
170 class ShowAuditLogURLHandler :
public URLHandler {
173 ~ShowAuditLogURLHandler() {}
176 bool handleContextMenuRequest(
const KUrl &,
const QPoint &,
ViewerPrivate * )
const;
177 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const;
182 class InternalImageURLHandler :
public URLHandler {
186 ~InternalImageURLHandler()
188 bool handleDrag(
const KUrl &url,
ViewerPrivate *window )
const;
189 bool willHandleDrag(
const KUrl &url,
ViewerPrivate *window )
const;
192 bool handleContextMenuRequest(
const KUrl &,
const QPoint &,
ViewerPrivate * )
const
194 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const
195 {
return QString(); }
206 bool handleContextMenuRequest(
const KUrl &,
const QPoint &,
ViewerPrivate * )
const {
209 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const {
return QString(); }
221 class URLHandlerManager::BodyPartURLHandlerManager :
public URLHandler {
224 ~BodyPartURLHandlerManager();
227 bool handleContextMenuRequest(
const KUrl &,
const QPoint &,
ViewerPrivate * )
const;
228 QString statusBarMessage(
const KUrl &,
ViewerPrivate * )
const;
234 typedef QVector<const Interface::BodyPartURLHandler*> BodyPartHandlerList;
235 BodyPartHandlerList mHandlers;
238 URLHandlerManager::BodyPartURLHandlerManager::~BodyPartURLHandlerManager() {
239 for_each( mHandlers.begin(), mHandlers.end(),
246 unregisterHandler( handler );
247 mHandlers.push_back( handler );
252 mHandlers.erase(
remove( mHandlers.begin(), mHandlers.end(), handler ), mHandlers.end() );
258 if ( !w || url.protocol() != QLatin1String(
"x-kmail" ) )
260 const QString urlPath = url.path();
264 kDebug() <<
"BodyPartURLHandler: urlPath ==" << urlPath;
265 if ( !urlPath.startsWith( QLatin1String(
"/bodypart/") ) )
268 const QStringList urlParts = urlPath.mid( 10 ).split( QLatin1Char(
'/') );
269 if ( urlParts.size() != 3 )
272 *path = KUrl::fromPercentEncoding( urlParts[2].toLatin1() );
276 bool URLHandlerManager::BodyPartURLHandlerManager::handleClick(
const KUrl & url,
ViewerPrivate * w )
const {
283 BodyPartHandlerList::const_iterator end( mHandlers.constEnd() );
285 for ( BodyPartHandlerList::const_iterator it = mHandlers.constBegin() ; it != end ; ++it ) {
286 if ( (*it)->handleClick( w->
viewer(), &part, path ) )
293 bool URLHandlerManager::BodyPartURLHandlerManager::handleContextMenuRequest(
const KUrl & url,
const QPoint & p,
ViewerPrivate * w )
const {
300 BodyPartHandlerList::const_iterator end( mHandlers.constEnd() );
301 for ( BodyPartHandlerList::const_iterator it = mHandlers.constBegin() ; it != end ; ++it )
302 if ( (*it)->handleContextMenuRequest( &part, path, p ) )
307 QString URLHandlerManager::BodyPartURLHandlerManager::statusBarMessage(
const KUrl & url,
ViewerPrivate * w )
const {
314 BodyPartHandlerList::const_iterator end( mHandlers.constEnd() );
315 for ( BodyPartHandlerList::const_iterator it = mHandlers.constBegin() ; it != end ; ++it ) {
316 const QString msg = (*it)->statusBarMessage( &part, path );
317 if ( !msg.isEmpty() )
329 URLHandlerManager::URLHandlerManager() {
330 registerHandler(
new KMailProtocolURLHandler() );
331 registerHandler(
new ExpandCollapseQuoteURLManager() );
332 registerHandler(
new SMimeURLHandler() );
333 registerHandler(
new MailToURLHandler() );
334 registerHandler(
new ContactUidURLHandler() );
335 registerHandler(
new HtmlAnchorHandler() );
336 registerHandler(
new AttachmentURLHandler() );
337 registerHandler( mBodyPartURLHandlerManager =
new BodyPartURLHandlerManager() );
338 registerHandler(
new ShowAuditLogURLHandler() );
339 registerHandler(
new InternalImageURLHandler );
340 registerHandler(
new KRunURLHandler() );
344 for_each( mHandlers.begin(), mHandlers.end(),
351 unregisterHandler( handler );
352 mHandlers.push_back( handler );
357 mHandlers.erase(
remove( mHandlers.begin(), mHandlers.end(), handler ), mHandlers.end() );
361 if ( mBodyPartURLHandlerManager )
362 mBodyPartURLHandlerManager->registerHandler( handler );
366 if ( mBodyPartURLHandlerManager )
367 mBodyPartURLHandlerManager->unregisterHandler( handler );
371 HandlerList::const_iterator end( mHandlers.constEnd() );
372 for ( HandlerList::const_iterator it = mHandlers.constBegin() ; it != end ; ++it )
373 if ( (*it)->handleClick( url, w ) )
380 HandlerList::const_iterator end( mHandlers.constEnd() );
381 for ( HandlerList::const_iterator it = mHandlers.constBegin() ; it != end ; ++it )
382 if ( (*it)->handleShiftClick( url, window ) )
389 HandlerList::const_iterator end( mHandlers.constEnd() );
391 for ( HandlerList::const_iterator it = mHandlers.constBegin() ; it != end ; ++it )
392 if ( (*it)->willHandleDrag( url, window ) )
399 HandlerList::const_iterator end( mHandlers.constEnd() );
400 for ( HandlerList::const_iterator it = mHandlers.constBegin() ; it != end ; ++it )
401 if ( (*it)->handleDrag( url, window ) )
408 HandlerList::const_iterator end( mHandlers.constEnd() );
409 for ( HandlerList::const_iterator it = mHandlers.constBegin() ; it != end ; ++it )
410 if ( (*it)->handleContextMenuRequest( url, p, w ) )
416 HandlerList::const_iterator end( mHandlers.constEnd() );
417 for ( HandlerList::const_iterator it = mHandlers.constBegin() ; it != end ; ++it ) {
418 const QString msg = (*it)->statusBarMessage( url, w );
419 if ( !msg.isEmpty() )
432 #include <ui/messagebox.h>
435 #include <kmessagebox.h>
438 bool KMailProtocolURLHandler::handleClick(
const KUrl & url,
ViewerPrivate * w )
const {
439 if ( url.protocol() == QLatin1String(
"kmail" ) ) {
442 const QString urlPath( url.path() );
443 if ( urlPath == QLatin1String(
"showHTML" ) ) {
448 else if ( urlPath == QLatin1String(
"goOnline" ) ) {
452 else if ( urlPath == QLatin1String(
"goResourceOnline" ) ) {
456 else if ( urlPath == QLatin1String(
"loadExternal" ) ) {
461 else if ( urlPath == QLatin1String(
"decryptMessage" ) ) {
466 else if ( urlPath == QLatin1String(
"showSignatureDetails" ) ) {
471 else if ( urlPath == QLatin1String(
"hideSignatureDetails" ) ) {
476 else if ( urlPath == QLatin1String(
"showAttachmentQuicklist" ) ) {
481 else if ( urlPath == QLatin1String(
"hideAttachmentQuicklist" ) ) {
486 else if ( urlPath == QLatin1String(
"showFullToAddressList" ) ) {
491 else if ( urlPath == QLatin1String(
"hideFullToAddressList" ) ) {
496 else if ( urlPath == QLatin1String(
"showFullCcAddressList" ) ) {
501 else if ( urlPath == QLatin1String(
"hideFullCcAddressList" ) ) {
506 else if ( urlPath == QLatin1String(
"showRawToltecMail" ) ) {
515 QString KMailProtocolURLHandler::statusBarMessage(
const KUrl & url,
ViewerPrivate * )
const {
516 if ( url.protocol() == QLatin1String(
"kmail" ) )
518 const QString urlPath( url.path() );
519 if ( urlPath == QLatin1String(
"showHTML" ) )
520 return i18n(
"Turn on HTML rendering for this message.");
521 else if ( urlPath == QLatin1String(
"loadExternal" ) )
522 return i18n(
"Load external references from the Internet for this message.");
523 else if ( urlPath == QLatin1String(
"goOnline" ) )
524 return i18n(
"Work online.");
525 else if ( urlPath == QLatin1String(
"goResourceOnline" ) )
526 return i18n(
"Make account online.");
527 else if ( urlPath == QLatin1String(
"decryptMessage" ) )
528 return i18n(
"Decrypt message.");
529 else if ( urlPath == QLatin1String(
"showSignatureDetails" ) )
530 return i18n(
"Show signature details.");
531 else if ( urlPath == QLatin1String(
"hideSignatureDetails" ) )
532 return i18n(
"Hide signature details.");
533 else if ( urlPath == QLatin1String(
"showAttachmentQuicklist" ) )
534 return i18n(
"Show attachment list." );
535 else if ( urlPath == QLatin1String(
"hideAttachmentQuicklist" ) )
536 return i18n(
"Hide attachment list." );
537 else if ( urlPath == QLatin1String(
"showFullToAddressList" ) )
538 return i18n(
"Show full \"To\" list" );
539 else if ( urlPath == QLatin1String(
"hideFullToAddressList" ) )
540 return i18n(
"Hide full \"To\" list" );
541 else if ( urlPath == QLatin1String(
"showFullCcAddressList" ) )
542 return i18n(
"Show full \"Cc\" list" );
543 else if ( urlPath == QLatin1String(
"hideFullCcAddressList" ) )
544 return i18n(
"Hide full \"Cc\" list" );
545 else if ( urlPath == QLatin1String(
"showRawToltecMail" ) )
546 return i18n(
"Show Raw Message" );
547 else return QString();
555 bool ExpandCollapseQuoteURLManager::handleClick(
560 if ( url.protocol() == QLatin1String(
"kmail" ) && url.path()==QLatin1String(
"levelquote" ) )
562 const QString levelStr= url.query().mid( 1,url.query().length() );
563 bool isNumber =
false;
564 const int levelQuote= levelStr.toInt(&isNumber);
571 QString ExpandCollapseQuoteURLManager::statusBarMessage(
574 if ( url.protocol() == QLatin1String(
"kmail" ) && url.path() == QLatin1String(
"levelquote" ) )
576 const QString query= url.query();
577 if ( query.length()>=2 ) {
578 if ( query[ 1 ] ==QLatin1Char(
'-' ) ) {
579 return i18n(
"Expand all quoted text.");
582 return i18n(
"Collapse quoted text.");
592 QString& displayName,
596 static QString showCertMan(QLatin1String(
"showCertificate#"));
600 int i1 = aUrl.indexOf( showCertMan );
602 i1 += showCertMan.length();
603 int i2 = aUrl.indexOf(QLatin1String(
" ### "), i1);
606 displayName = aUrl.mid( i1, i2-i1 );
608 i2 = aUrl.indexOf(QLatin1String(
" ### "), i1);
611 libName = aUrl.mid( i1, i2-i1 );
614 keyId = aUrl.mid( i2 );
630 return !keyId.isEmpty();
635 bool SMimeURLHandler::handleClick(
const KUrl & url,
ViewerPrivate * w )
const {
638 QString displayName, libName, keyId;
640 QUrl::fromPercentEncoding( url.ref().toLatin1() ),
641 displayName, libName, keyId ) )
644 lst << QLatin1String(
"-parent-windowid") << QString::number((qlonglong)w->
viewer()->
mainWindow()->winId() ) << QLatin1String(
"-query") << keyId;
645 if ( !QProcess::startDetached( QLatin1String(
"kleopatra"),lst) )
646 KMessageBox::error( w->
mMainWindow, i18n(
"Could not start certificate manager. "
647 "Please check your installation."),
648 i18n(
"KMail Error") );
652 QString SMimeURLHandler::statusBarMessage(
const KUrl & url,
ViewerPrivate * )
const {
653 QString displayName, libName, keyId;
655 QUrl::fromPercentEncoding( url.ref().toLatin1() ),
656 displayName, libName, keyId ) )
658 return i18n(
"Show certificate 0x%1", keyId );
663 bool HtmlAnchorHandler::handleClick(
const KUrl & url,
ViewerPrivate * w )
const {
664 if ( url.hasHost() || !url.hasRef() )
673 QString MailToURLHandler::statusBarMessage(
const KUrl & url,
ViewerPrivate * )
const {
674 if ( url.protocol() == QLatin1String(
"mailto" ) )
675 return KPIMUtils::decodeMailtoUrl( url );
681 static QString searchFullEmailByUid(
const QString &uid )
684 Akonadi::ContactSearchJob *job =
new Akonadi::ContactSearchJob();
686 job->setQuery( Akonadi::ContactSearchJob::ContactUid, uid, Akonadi::ContactSearchJob::ExactMatch );
688 const KABC::Addressee::List res = job->contacts();
689 if ( !res.isEmpty() ) {
690 KABC::Addressee addr = res.first();
691 fullEmail = addr.fullEmail();
696 static void runKAddressBook(
const KUrl &url )
698 KPIM::OpenEmailAddressJob *job =
new KPIM::OpenEmailAddressJob( url.path(), 0 );
702 bool ContactUidURLHandler::handleClick(
const KUrl &url,
ViewerPrivate * )
const
704 if ( url.protocol() == QLatin1String(
"uid" ) ) {
705 runKAddressBook( url );
712 bool ContactUidURLHandler::handleContextMenuRequest(
const KUrl &url,
const QPoint &p,
715 if ( url.protocol() != QLatin1String(
"uid" ) || url.path().isEmpty() ) {
719 KMenu *menu =
new KMenu();
721 menu->addAction( KIcon( QLatin1String(
"view-pim-contacts") ), i18n(
"&Open in Address Book" ) );
722 #ifndef QT_NO_CLIPBOARD
724 menu->addAction( KIcon( QLatin1String(
"edit-copy") ), i18n(
"&Copy Email Address" ) );
727 QAction *a = menu->exec( p );
729 runKAddressBook( url );
730 #ifndef QT_NO_CLIPBOARD
731 }
else if ( a == copy ) {
732 const QString fullEmail = searchFullEmailByUid( url.path() );
733 if ( !fullEmail.isEmpty() ) {
734 QClipboard *clip = QApplication::clipboard();
735 clip->setText( fullEmail, QClipboard::Clipboard );
736 clip->setText( fullEmail, QClipboard::Selection );
737 KPIM::BroadcastStatus::instance()->setStatusMsg( i18n(
"Address copied to clipboard." ) );
746 QString ContactUidURLHandler::statusBarMessage(
const KUrl &url,
ViewerPrivate * )
const
748 if ( url.protocol() == QLatin1String(
"uid" ) ) {
749 return i18n(
"Lookup the contact in KAddressbook" );
757 KMime::Content* AttachmentURLHandler::nodeForUrl(
const KUrl &url,
ViewerPrivate *w )
const
761 if ( url.protocol() == QLatin1String(
"attachment" ) )
769 bool AttachmentURLHandler::attachmentIsInHeader(
const KUrl &url )
const
771 bool inHeader =
false;
772 const QString place = url.queryItem( QLatin1String(
"place") ).toLower();
773 if ( !place.isNull() ) {
774 inHeader = ( place == QLatin1String(
"header" ) );
779 bool AttachmentURLHandler::handleClick(
const KUrl & url,
ViewerPrivate * w )
const
781 KMime::Content *node = nodeForUrl( url, w );
785 const bool inHeader = attachmentIsInHeader( url );
789 if ( shouldShowDialog )
796 bool AttachmentURLHandler::handleShiftClick(
const KUrl &url,
ViewerPrivate *window )
const
798 KMime::Content *node = nodeForUrl( url, window );
807 bool AttachmentURLHandler::willHandleDrag(
const KUrl &url,
ViewerPrivate *window )
const
809 return nodeForUrl( url, window ) != 0;
812 bool AttachmentURLHandler::handleDrag(
const KUrl &url,
ViewerPrivate *window )
const
814 #ifndef QT_NO_DRAGANDDROP
815 KMime::Content *node = nodeForUrl( url, window );
820 const QString fileName = tUrl.path();
821 if ( !fileName.isEmpty() ) {
823 f.setPermissions(QFile::ReadOwner|QFile::WriteOwner|QFile::ReadUser|QFile::ReadGroup|QFile::ReadOther);
825 QDrag *drag =
new QDrag( window->
viewer() );
826 QMimeData *mimeData =
new QMimeData();
827 mimeData->setUrls( QList<QUrl>() << tUrl );
828 drag->setMimeData( mimeData );
829 if ( !icon.isEmpty() ) {
830 drag->setPixmap( QPixmap( icon ) );
840 bool AttachmentURLHandler::handleContextMenuRequest(
const KUrl & url,
const QPoint & p,
ViewerPrivate * w )
const
842 KMime::Content *node = nodeForUrl( url, w );
850 QString AttachmentURLHandler::statusBarMessage(
const KUrl & url,
ViewerPrivate * w )
const
852 KMime::Content *node = nodeForUrl( url, w );
856 if ( !name.isEmpty() )
857 return i18n(
"Attachment: %1", name );
858 else if ( dynamic_cast<KMime::Message*>( node ) ) {
859 if ( node->header<KMime::Headers::Subject>() ) {
860 return i18n(
"Encapsulated Message (Subject: %1)",
861 node->header<KMime::Headers::Subject>()->asUnicodeString() );
863 return i18n(
"Encapsulated Message" );
866 return i18n(
"Unnamed attachment" );
871 static QString extractAuditLog(
const KUrl & url ) {
872 if ( url.protocol() != QLatin1String(
"kmail" )
873 || url.path() != QLatin1String(
"showAuditLog" ) )
875 assert( !url.queryItem( QLatin1String(
"log") ).isEmpty() );
876 return url.queryItem( QLatin1String(
"log") );
879 bool ShowAuditLogURLHandler::handleClick(
const KUrl & url,
ViewerPrivate * w )
const {
880 const QString auditLog = extractAuditLog( url );
881 if ( auditLog.isEmpty() )
883 Kleo::MessageBox::auditLog( w->
mMainWindow, auditLog );
887 bool ShowAuditLogURLHandler::handleContextMenuRequest(
const KUrl & url,
const QPoint &,
ViewerPrivate * w )
const {
890 return !extractAuditLog( url ).isEmpty();
893 QString ShowAuditLogURLHandler::statusBarMessage(
const KUrl & url,
ViewerPrivate * )
const {
894 if ( extractAuditLog( url ).isEmpty() )
897 return i18n(
"Show GnuPG Audit Log for this operation");
902 bool InternalImageURLHandler::handleDrag(
const KUrl &url,
ViewerPrivate *window )
const
912 bool InternalImageURLHandler::willHandleDrag(
const KUrl &url,
ViewerPrivate *window )
const
915 if ( url.protocol() == QLatin1String(
"data" ) && url.path().startsWith( QLatin1String(
"image") ) )
918 const QString imagePath = KStandardDirs::locate(
"data", QLatin1String(
"libmessageviewer/pics/") );
919 return url.path().contains( imagePath );
924 bool KRunURLHandler::handleClick(
const KUrl & url,
ViewerPrivate * w )
const
926 const QString protocol(url.protocol() );
927 if ( ( protocol == QLatin1String(
"http" ) ) || ( protocol == QLatin1String(
"https" ) ) ||
928 ( protocol == QLatin1String(
"ftp" ) ) || ( protocol == QLatin1String(
"file" ) ) ||
929 ( protocol == QLatin1String(
"ftps" ) ) || ( protocol == QLatin1String(
"sftp" ) ) ||
930 ( protocol == QLatin1String(
"help" ) ) || ( protocol == QLatin1String(
"vnc" ) ) ||
931 ( protocol == QLatin1String(
"smb" ) ) || ( protocol == QLatin1String(
"fish" ) ) ||
932 ( protocol == QLatin1String(
"news" ) ) )
934 KPIM::BroadcastStatus::instance()->setTransientStatusMsg( i18n(
"Opening URL..."));
935 QTimer::singleShot( 2000, KPIM::BroadcastStatus::instance(), SLOT(reset()) );
937 KMimeType::Ptr mime = KMimeType::findByUrl( url );
938 if (mime->name() == QLatin1String(
"application/x-desktop") ||
939 mime->name() == QLatin1String(
"application/x-executable") ||
940 mime->name() == QLatin1String(
"application/x-ms-dos-executable") ||
941 mime->name() == QLatin1String(
"application/x-shellscript") )
943 if ( KMessageBox::warningYesNo( 0, i18nc(
"@info",
"Do you really want to execute <filename>%1</filename>?",
944 url.pathOrUrl() ), QString(), KGuiItem(i18n(
"Execute")), KStandardGuiItem::cancel() ) != KMessageBox::Yes)
948 KRun *runner =
new KRun( url, w->
viewer() );
949 runner->setRunExecutables(
false );
void setShowSignatureDetails(bool showDetails=true)
Show signature details.
bool foundSMIMEData(const QString &aUrl, QString &displayName, QString &libName, QString &keyId)
QString statusBarMessage(const KUrl &url, ViewerPrivate *w=0) const
KMime::Message::Ptr mMessage
an implementation of the BodyPart interface using KMime::Content's
void registerHandler(const URLHandler *handler)
bool handleShiftClick(const KUrl &url, ViewerPrivate *window=0) const
void scrollToAttachment(KMime::Content *node)
void setDecryptMessageOverwrite(bool overwrite=true)
Enforce message decryption.
void setHtmlLoadExtOverride(bool override)
Override default load external references setting.
bool htmlLoadExtOverride() const
Get the load external references override setting.
KMime::Content * nodeFromUrl(const KUrl &url)
Returns message part from given URL or null if invalid.
Private class for the Viewer, the main widget in the messageviewer library.
bool MESSAGEVIEWER_EXPORT saveContents(QWidget *parent, const QList< KMime::Content * > &contents)
void scrollToAnchor(const QString &anchor)
An interface to body part reader link handlers.
void setShowRawToltecMail(bool showRawToltecMail)
Singleton to manage the list of URLHandlers.
MailWebView * htmlPart() const
Access to the MailWebView used for the viewer.
bool handleContextMenuRequest(const KUrl &url, const QPoint &p, ViewerPrivate *w=0) const
NodeHelper * nodeHelper() const
const QTextCodec * overrideCodec() const
Get codec corresponding to the currently selected override character encoding.
KUrl tempFileUrlFromNode(const KMime::Content *node)
Returns the temporary file path and name where this node was saved, or an empty url if it wasn't save...
void slotLevelQuote(int l)
bool htmlOverride() const
Get the html override setting.
An interface to reader link handlers.
static KMime::Content * partNodeFromXKMailUrl(const KUrl &url, ViewerPrivate *w, QString *path)
void setShowAttachmentQuicklist(bool showAttachmentQuicklist=true)
void showAttachmentPopup(KMime::Content *node, const QString &name, const QPoint &p)
void setShowFullToAddressList(bool showFullToAddressList=true)
Show or hide the full list of "To" addresses.
void update(MessageViewer::Viewer::UpdateMode updateMode=Viewer::Delayed)
Re-parse the current message.
bool handleDrag(const KUrl &url, ViewerPrivate *window=0) const
static QString iconName(KMime::Content *node, int size=KIconLoader::Desktop)
void setShowFullCcAddressList(bool showFullCcAddressList=true)
Show or hide the full list of "To" addresses.
void setHtmlOverride(bool override)
Override default html mail setting.
void openAttachment(KMime::Content *node, const QString &fileName)
Open the attachment pointed to the node.
KMime::Message::Ptr message() const
bool isNodeDisplayedEmbedded(KMime::Content *node) const
bool handleClick(const KUrl &url, ViewerPrivate *w=0) const
bool MESSAGEVIEWER_EXPORT handleUrlWithQDesktopServices(const KUrl &url)
Delegates opening a URL to the QDesktopServices mechanisms for that on Windows and MacOSX...
static QString fileName(const KMime::Content *node)
Returns a usable filename for a node, that can be the filename from the content disposition header...
void unregisterHandler(const URLHandler *handler)
bool willHandleDrag(const KUrl &url, ViewerPrivate *window=0) const