• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messageviewer

  • sources
  • kde-4.12
  • kdepim
  • messageviewer
  • utils
util.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 **
3 ** Filename : util
4 ** Created on : 03 April, 2005
5 ** Copyright : (c) 2005 Till Adam
6 ** Email : <adam@kde.org>
7 **
8 *******************************************************************************/
9 
10 /*******************************************************************************
11 **
12 ** This program is free software; you can redistribute it and/or modify
13 ** it under the terms of the GNU General Public License as published by
14 ** the Free Software Foundation; either version 2 of the License, or
15 ** (at your option) any later version.
16 **
17 ** It is distributed in the hope that it will be useful, but
18 ** WITHOUT ANY WARRANTY; without even the implied warranty of
19 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ** General Public License for more details.
21 **
22 ** You should have received a copy of the GNU General Public License
23 ** along with this program; if not, write to the Free Software
24 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 **
26 ** In addition, as a special exception, the copyright holders give
27 ** permission to link the code of this program with any edition of
28 ** the Qt library by Trolltech AS, Norway (or with modified versions
29 ** of Qt that use the same license as Qt), and distribute linked
30 ** combinations including the two. You must obey the GNU General
31 ** Public License in all respects for all of the code used other than
32 ** Qt. If you modify this file, you may extend this exception to
33 ** your version of the file, but you are not obligated to do so. If
34 ** you do not wish to do so, delete this exception statement from
35 ** your version.
36 **
37 *******************************************************************************/
38 
39 
40 #include "utils/util.h"
41 
42 #include "utils/iconnamecache.h"
43 #include "viewer/nodehelper.h"
44 
45 #include "messagecore/settings/globalsettings.h"
46 #include "messagecore/helpers/nodehelper.h"
47 #include "messagecore/utils/stringutil.h"
48 
49 #include "pimcommon/widgets/renamefiledialog.h"
50 
51 #include <akonadi/item.h>
52 
53 
54 #include <kmbox/mbox.h>
55 
56 #include <KMime/Message>
57 
58 #include <kcharsets.h>
59 #include <KFileDialog>
60 #include <kglobal.h>
61 #include <klocale.h>
62 #include <kmessagebox.h>
63 #include <kio/netaccess.h>
64 #include <kdebug.h>
65 #include <KMimeType>
66 #include <KTemporaryFile>
67 #include <ktoolinvocation.h>
68 #include <KAction>
69 
70 #include <QTextCodec>
71 #include <QWidget>
72 #include <QDBusInterface>
73 #include <QDBusConnectionInterface>
74 #include <QActionGroup>
75 #include <QPointer>
76 
77 using namespace MessageViewer;
78 
79 bool Util::checkOverwrite( const KUrl &url, QWidget *w )
80 {
81  if ( KIO::NetAccess::exists( url, KIO::NetAccess::DestinationSide, w ) ) {
82  if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(
83  w,
84  i18n( "A file named \"%1\" already exists. "
85  "Are you sure you want to overwrite it?", url.prettyUrl() ),
86  i18n( "Overwrite File?" ),
87  KStandardGuiItem::overwrite() ) )
88  return false;
89  }
90  return true;
91 }
92 
93 QString Util::fileNameForMimetype( const QString &mimeType, int iconSize,
94  const QString &fallbackFileName1,
95  const QString &fallbackFileName2 )
96 {
97  QString fileName;
98  QString tMimeType = mimeType;
99 
100  // convert non-registered types to registered types
101  if ( mimeType == QLatin1String( "application/x-vnd.kolab.contact" ) ) {
102  tMimeType = QLatin1String( "text/x-vcard" );
103  } else if ( mimeType == QLatin1String( "application/x-vnd.kolab.event" ) ) {
104  tMimeType = QLatin1String( "application/x-vnd.akonadi.calendar.event" );
105  } else if ( mimeType == QLatin1String( "application/x-vnd.kolab.task" ) ) {
106  tMimeType = QLatin1String( "application/x-vnd.akonadi.calendar.todo" );
107  } else if ( mimeType == QLatin1String( "application/x-vnd.kolab.journal" ) ) {
108  tMimeType = QLatin1String( "application/x-vnd.akonadi.calendar.journal" );
109  } else if ( mimeType == QLatin1String( "application/x-vnd.kolab.note" ) ) {
110  tMimeType = QLatin1String( "application/x-vnd.akonadi.note" );
111  }
112  KMimeType::Ptr mime = KMimeType::mimeType( tMimeType, KMimeType::ResolveAliases );
113  if ( mime ) {
114  fileName = mime->iconName();
115  } else {
116  fileName = QLatin1String( "unknown" );
117  if ( !tMimeType.isEmpty() ) {
118  kWarning() << "unknown mimetype" << tMimeType;
119  }
120  }
121  //WorkAround for #199083
122  if(fileName == QLatin1String("text-vcard")) {
123  fileName = QLatin1String("text-x-vcard");
124  }
125  if ( fileName.isEmpty() ) {
126  fileName = fallbackFileName1;
127  if ( fileName.isEmpty() ) {
128  fileName = fallbackFileName2;
129  }
130  if ( !fileName.isEmpty() ) {
131  fileName = KMimeType::findByPath( QLatin1String("/tmp/") + fileName, 0, true )->iconName();
132  }
133  }
134 
135  return IconNameCache::instance()->iconPath( fileName, iconSize );
136 }
137 
138 #if defined Q_WS_WIN || defined Q_WS_MACX
139 #include <QDesktopServices>
140 #endif
141 
142 bool Util::handleUrlWithQDesktopServices( const KUrl& url )
143 {
144 #if defined Q_WS_WIN || defined Q_WS_MACX
145  QDesktopServices::openUrl( url );
146  return true;
147 #else
148  Q_UNUSED( url );
149  return false;
150 #endif
151 }
152 
153 QList<KMime::Content*> Util::allContents( const KMime::Content *message )
154 {
155  KMime::Content::List result;
156  KMime::Content *child = MessageCore::NodeHelper::firstChild( message );
157  if ( child ) {
158  result += child;
159  result += allContents( child );
160  }
161  KMime::Content *next = MessageCore::NodeHelper::nextSibling( message );
162  if ( next ) {
163  result += next;
164  result += allContents( next );
165  }
166 
167  return result;
168 }
169 
170 QList<KMime::Content*> Util::extractAttachments( const KMime::Message *message )
171 {
172  const KMime::Content::List contents = allContents( message );
173  KMime::Content::List result;
174  for ( KMime::Content::List::const_iterator it = contents.constBegin();
175  it != contents.constEnd(); ) {
176  KMime::Content* content = *it;
177  if ( content->contentDisposition()->filename().trimmed().isEmpty() &&
178  ( content->contentType()->name().trimmed().isEmpty() ||
179  content == message ) ) {
180  ++it;
181  } else {
182  result <<( *it );
183  ++it;
184  }
185  }
186 
187  return result;
188 }
189 
190 bool Util::saveContents( QWidget *parent, const QList<KMime::Content*> &contents )
191 {
192  KUrl url, dirUrl;
193  const bool multiple = (contents.count() > 1);
194  if ( multiple ) {
195  // get the dir
196  dirUrl = KFileDialog::getExistingDirectoryUrl( KUrl( QLatin1String("kfiledialog:///saveAttachment") ),
197  parent,
198  i18n( "Save Attachments To" ) );
199  if ( !dirUrl.isValid() ) {
200  return false;
201  }
202 
203  // we may not get a slash-terminated url out of KFileDialog
204  dirUrl.adjustPath( KUrl::AddTrailingSlash );
205  } else {
206  // only one item, get the desired filename
207  KMime::Content *content = contents.first();
208  QString fileName = NodeHelper::fileName( content );
209  fileName = MessageCore::StringUtil::cleanFileName( fileName );
210  if ( fileName.isEmpty() ) {
211  fileName = i18nc( "filename for an unnamed attachment", "attachment.1" );
212  }
213  KUrl pathUrl = KUrl( QLatin1String("kfiledialog:///saveAttachment/"));
214  pathUrl.addPath(fileName);
215  url = KFileDialog::getSaveUrl( pathUrl ,
216  QString(),
217  parent,
218  i18n( "Save Attachment" ) );
219  if ( url.isEmpty() ) {
220  return false;
221  }
222  }
223 
224  QMap< QString, int > renameNumbering;
225 
226  bool globalResult = true;
227  int unnamedAtmCount = 0;
228  PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE;
229  foreach( KMime::Content *content, contents ) {
230  KUrl curUrl;
231  if ( !dirUrl.isEmpty() ) {
232  curUrl = dirUrl;
233  QString fileName = MessageViewer::NodeHelper::fileName( content );
234  fileName = MessageCore::StringUtil::cleanFileName( fileName );
235  if ( fileName.isEmpty() ) {
236  ++unnamedAtmCount;
237  fileName = i18nc( "filename for the %1-th unnamed attachment",
238  "attachment.%1", unnamedAtmCount );
239  }
240  curUrl.setFileName( fileName );
241  } else {
242  curUrl = url;
243  }
244  if ( !curUrl.isEmpty() ) {
245  //Bug #312954
246  if (multiple && (curUrl.fileName() == QLatin1String("smime.p7s")) ) {
247  continue;
248  }
249  // Rename the file if we have already saved one with the same name:
250  // try appending a number before extension (e.g. "pic.jpg" => "pic_2.jpg")
251  QString origFile = curUrl.fileName();
252  QString file = origFile;
253 
254  while ( renameNumbering.contains(file) ) {
255  file = origFile;
256  int num = renameNumbering[file] + 1;
257  int dotIdx = file.lastIndexOf(QLatin1Char('.'));
258  file = file.insert( (dotIdx>=0) ? dotIdx : file.length(), QLatin1String("_") + QString::number(num) );
259  }
260  curUrl.setFileName(file);
261 
262  // Increment the counter for both the old and the new filename
263  if ( !renameNumbering.contains(origFile))
264  renameNumbering[origFile] = 1;
265  else
266  renameNumbering[origFile]++;
267 
268  if ( file != origFile ) {
269  if ( !renameNumbering.contains(file))
270  renameNumbering[file] = 1;
271  else
272  renameNumbering[file]++;
273  }
274 
275 
276  if( !(result == PimCommon::RenameFileDialog::RENAMEFILE_OVERWRITEALL ||
277  result == PimCommon::RenameFileDialog::RENAMEFILE_IGNOREALL )) {
278  if ( KIO::NetAccess::exists( curUrl, KIO::NetAccess::DestinationSide, parent ) ) {
279  PimCommon::RenameFileDialog *dlg = new PimCommon::RenameFileDialog(curUrl, multiple, parent);
280  result = static_cast<PimCommon::RenameFileDialog::RenameFileDialogResult>(dlg->exec());
281  if ( result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE ||
282  result == PimCommon::RenameFileDialog::RENAMEFILE_IGNOREALL)
283  {
284  delete dlg;
285  continue;
286  }
287  else if ( result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME )
288  {
289  curUrl = dlg->newName();
290  }
291  delete dlg;
292  }
293  }
294  // save
295  if( result != PimCommon::RenameFileDialog::RENAMEFILE_IGNOREALL ) {
296  const bool result = saveContent( parent, content, curUrl );
297  if ( !result )
298  globalResult = result;
299  }
300  }
301  }
302 
303  return globalResult;
304 }
305 
306 bool Util::saveContent( QWidget *parent, KMime::Content* content, const KUrl& url )
307 {
308  // FIXME: This is all horribly broken. First of all, creating a NodeHelper and then immediatley
309  // reading out the encryption/signature state will not work at all.
310  // Then, topLevel() will not work for attachments that are inside encrypted parts.
311  // What should actually be done is either passing in an ObjectTreeParser that has already
312  // parsed the message, or creating an OTP here (which would have the downside that the
313  // password dialog for decrypting messages is shown twice)
314 #if 0 // totally broken
315  KMime::Content *topContent = content->topLevel();
316  MessageViewer::NodeHelper *mNodeHelper = new MessageViewer::NodeHelper;
317  bool bSaveEncrypted = false;
318  bool bEncryptedParts = mNodeHelper->encryptionState( content ) != MessageViewer::KMMsgNotEncrypted;
319  if( bEncryptedParts )
320  if( KMessageBox::questionYesNo( parent,
321  i18n( "The part %1 of the message is encrypted. Do you want to keep the encryption when saving?",
322  url.fileName() ),
323  i18n( "KMail Question" ), KGuiItem(i18n("Keep Encryption")), KGuiItem(i18n("Do Not Keep")) ) ==
324  KMessageBox::Yes )
325  bSaveEncrypted = true;
326 
327  bool bSaveWithSig = true;
328  if(mNodeHelper->signatureState( content ) != MessageViewer::KMMsgNotSigned )
329  if( KMessageBox::questionYesNo( parent,
330  i18n( "The part %1 of the message is signed. Do you want to keep the signature when saving?",
331  url.fileName() ),
332  i18n( "KMail Question" ), KGuiItem(i18n("Keep Signature")), KGuiItem(i18n("Do Not Keep")) ) !=
333  KMessageBox::Yes )
334  bSaveWithSig = false;
335 
336  QByteArray data;
337  if( bSaveEncrypted || !bEncryptedParts) {
338  KMime::Content *dataNode = content;
339  QByteArray rawDecryptedBody;
340  bool gotRawDecryptedBody = false;
341  if ( !bSaveWithSig ) {
342  if ( topContent->contentType()->mimeType() == "multipart/signed" ) {
343  // carefully look for the part that is *not* the signature part:
344  if ( ObjectTreeParser::findType( topContent, "application/pgp-signature", true, false ) ) {
345  dataNode = ObjectTreeParser::findTypeNot( topContent, "application", "pgp-signature", true, false );
346  } else if ( ObjectTreeParser::findType( topContent, "application/pkcs7-mime" , true, false ) ) {
347  dataNode = ObjectTreeParser::findTypeNot( topContent, "application", "pkcs7-mime", true, false );
348  } else {
349  dataNode = ObjectTreeParser::findTypeNot( topContent, "multipart", "", true, false );
350  }
351  } else {
352  EmptySource emptySource;
353  ObjectTreeParser otp( &emptySource, 0, 0, false, false );
354 
355  // process this node and all it's siblings and descendants
356  mNodeHelper->setNodeUnprocessed( dataNode, true );
357  otp.parseObjectTree( dataNode );
358 
359  rawDecryptedBody = otp.rawDecryptedBody();
360  gotRawDecryptedBody = true;
361  }
362  }
363  QByteArray cstr = gotRawDecryptedBody
364  ? rawDecryptedBody
365  : dataNode->decodedContent();
366  data = KMime::CRLFtoLF( cstr );
367  }
368 #else
369  const QByteArray data = content->decodedContent();
370  kWarning() << "Port the encryption/signature handling when saving a KMime::Content.";
371 #endif
372  QDataStream ds;
373  QFile file;
374  KTemporaryFile tf;
375  if ( url.isLocalFile() )
376  {
377  // save directly
378  file.setFileName( url.toLocalFile() );
379  if ( !file.open( QIODevice::WriteOnly ) )
380  {
381  KMessageBox::error( parent,
382  i18nc( "1 = file name, 2 = error string",
383  "<qt>Could not write to the file<br><filename>%1</filename><br><br>%2",
384  file.fileName(),
385  file.errorString() ),
386  i18n( "Error saving attachment" ) );
387  return false;
388  }
389 
390  const int permissions = MessageViewer::Util::getWritePermissions();
391  if ( permissions >= 0 )
392  fchmod( file.handle(), permissions );
393 
394  ds.setDevice( &file );
395  } else
396  {
397  // tmp file for upload
398  tf.open();
399  ds.setDevice( &tf );
400  }
401 
402  const int bytesWritten = ds.writeRawData( data.data(), data.size() );
403  if ( bytesWritten != data.size() ) {
404  QFile *f = static_cast<QFile *>( ds.device() );
405  KMessageBox::error( parent,
406  i18nc( "1 = file name, 2 = error string",
407  "<qt>Could not write to the file<br><filename>%1</filename><br><br>%2",
408  f->fileName(),
409  f->errorString() ),
410  i18n( "Error saving attachment" ) );
411  // Remove the newly created empty or partial file
412  f->remove();
413  return false;
414  }
415 
416  if ( !url.isLocalFile() )
417  {
418  // QTemporaryFile::fileName() is only defined while the file is open
419  QString tfName = tf.fileName();
420  tf.close();
421  if ( !KIO::NetAccess::upload( tfName, url, parent ) )
422  {
423  KMessageBox::error( parent,
424  i18nc( "1 = file name, 2 = error string",
425  "<qt>Could not write to the file<br><filename>%1</filename><br><br>%2",
426  url.prettyUrl(),
427  KIO::NetAccess::lastErrorString() ),
428  i18n( "Error saving attachment" ) );
429  return false;
430  }
431  }
432  else
433  file.close();
434 
435 #if 0
436  mNodeHelper->removeTempFiles();
437  delete mNodeHelper;
438 #endif
439  return true;
440 }
441 
442 
443 int Util::getWritePermissions()
444 {
445  // #79685, #232001 by default use the umask the user defined, but let it be configurable
446  if ( MessageCore::GlobalSettings::self()->disregardUmask() ) {
447  return S_IRUSR | S_IWUSR;
448  } else {
449  return -1;
450  }
451 }
452 
453 bool Util::saveAttachments( const KMime::Content::List& contents, QWidget *parent )
454 {
455  if ( contents.isEmpty() ) {
456  KMessageBox::information( parent, i18n( "Found no attachments to save." ) );
457  return false;
458  }
459 
460  return Util::saveContents( parent, contents );
461 }
462 
463 bool Util::saveMessageInMbox( const QList<Akonadi::Item>& retrievedMsgs, QWidget *parent, bool appendMessages )
464 {
465 
466  QString fileName;
467  if ( retrievedMsgs.isEmpty() )
468  return true;
469  const Akonadi::Item msgBase = retrievedMsgs.first();
470 
471  if( msgBase.hasPayload<KMime::Message::Ptr>() )
472  fileName = MessageCore::StringUtil::cleanFileName(MessageViewer::NodeHelper::cleanSubject ( msgBase.payload<KMime::Message::Ptr>().get() ).trimmed() );
473  else
474  fileName = i18n("message");
475 
476  if ( !fileName.endsWith( QLatin1String( ".mbox" ) ) )
477  fileName += QLatin1String(".mbox");
478 
479  const QString filter = i18n( "*.mbox|email messages (*.mbox)\n*|all files (*)" );
480  QPointer<KFileDialog> dlg = new KFileDialog(KUrl::fromPath( fileName ), filter, parent);
481  dlg->setCaption(i18np("Save Message", "Save Messages", retrievedMsgs.count()));
482  dlg->setMode(KFile::File|KFile::LocalOnly);
483  dlg->setOperationMode(KFileDialog::Saving);
484  if( !appendMessages )
485  dlg->setConfirmOverwrite(true);
486  if (dlg->exec()) {
487  KUrl url = dlg->selectedUrl();
488  if ( url.isEmpty() ) {
489  delete dlg;
490  return true;
491  }
492 
493  const QString localFileName = url.toLocalFile();
494  if ( localFileName.isEmpty() ) {
495  delete dlg;
496  return true;
497  }
498 
499  if( !appendMessages ) {
500  QFile::remove(localFileName);
501  }
502 
503  KMBox::MBox mbox;
504  if ( !mbox.load( localFileName ) ) {
505  if( appendMessages ) {
506  KMessageBox::error( parent, i18n("File %1 could not be loaded.",localFileName) , i18n( "Error loading message" ) );
507  } else {
508  KMessageBox::error( parent, i18n("File %1 could not be created.",localFileName) , i18n( "Error saving message" ) );
509  }
510  delete dlg;
511  return false;
512  }
513  foreach ( const Akonadi::Item &item, retrievedMsgs ) {
514  if ( item.hasPayload<KMime::Message::Ptr>() ) {
515  mbox.appendMessage( item.payload<KMime::Message::Ptr>() );
516  }
517  }
518 
519  if ( !mbox.save() ) {
520  KMessageBox::error( parent, i18n("We cannot save message.") , i18n( "Error saving message" ) );
521  delete dlg;
522  return false;
523  }
524  }
525  delete dlg;
526  return true;
527 }
528 
529 
530 bool Util::speakSelectedText( const QString& text, QWidget *parent)
531 {
532  if(text.isEmpty())
533  return false;
534 
535  // If KTTSD not running, start it.
536  if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String("org.kde.kttsd")))
537  {
538  QString error;
539  if (KToolInvocation::startServiceByDesktopName(QLatin1String("kttsd"), QStringList(), &error))
540  {
541  KMessageBox::error(parent, i18n( "Starting Jovie Text-to-Speech Service Failed"), error );
542  return false;
543  }
544  }
545  QDBusInterface ktts(QLatin1String("org.kde.kttsd"), QLatin1String("/KSpeech"), QLatin1String("org.kde.KSpeech"));
546  ktts.asyncCall(QLatin1String("say"), text, 0);
547  return true;
548 }
549 
550 KAction* Util::createAppAction(const KService::Ptr& service, bool singleOffer, QActionGroup *actionGroup, QObject *parent )
551 {
552  QString actionName(service->name().replace(QLatin1Char('&'), QLatin1String("&&")));
553  if (singleOffer) {
554  actionName = i18n("Open &with %1", actionName);
555  } else {
556  actionName = i18nc("@item:inmenu Open With, %1 is application name", "%1", actionName);
557  }
558 
559  KAction *act = new KAction(parent);
560  act->setIcon(KIcon(service->icon()));
561  act->setText(actionName);
562  actionGroup->addAction( act );
563  act->setData(QVariant::fromValue(service));
564  return act;
565 }
566 
567 
568 KMimeType::Ptr Util::mimetype(const QString& name)
569 {
570  // consider the filename if mimetype cannot be found by content-type
571  KMimeType::Ptr mimeType = KMimeType::findByPath( name, 0, true /* no disk access */ );
572  if ( mimeType->name() == QLatin1String("application/octet-stream") ) {
573  // consider the attachment's contents if neither the Content-Type header
574  // nor the filename give us a clue
575  mimeType = KMimeType::findByFileContent( name );
576  }
577  return mimeType;
578 }
MessageViewer::Util::fileNameForMimetype
QString MESSAGEVIEWER_EXPORT fileNameForMimetype(const QString &mimeType, int iconSize, const QString &fallbackFileName1=QString(), const QString &fallbackFileName2=QString())
Finds the filename of an icon based on the given mimetype or filenames.
Definition: util.cpp:93
iconnamecache.h
MessageViewer::Util::saveAttachments
bool MESSAGEVIEWER_EXPORT saveAttachments(const KMime::Content::List &contents, QWidget *parent)
Definition: util.cpp:453
MessageViewer::Util::speakSelectedText
bool MESSAGEVIEWER_EXPORT speakSelectedText(const QString &text, QWidget *parent)
Definition: util.cpp:530
MessageViewer::Util::saveMessageInMbox
bool MESSAGEVIEWER_EXPORT saveMessageInMbox(const QList< Akonadi::Item > &retrievedMsgs, QWidget *parent, bool appendMessages=false)
Definition: util.cpp:463
QWidget
MessageViewer::EmptySource
An ObjectTreeSource that does not work on anything.
Definition: objecttreeemptysource.h:31
nodehelper.h
QObject
MessageViewer::ObjectTreeParser::findTypeNot
static KMime::Content * findTypeNot(KMime::Content *content, const QByteArray &mediaType, const QByteArray &subType, bool deep=true, bool wide=true)
Definition: objecttreeparser.cpp:3487
MessageViewer::KMMsgNotSigned
Definition: nodehelper.h:61
MessageViewer::Util::saveContents
bool MESSAGEVIEWER_EXPORT saveContents(QWidget *parent, const QList< KMime::Content * > &contents)
Definition: util.cpp:190
MessageViewer::IconNameCache::instance
static IconNameCache * instance()
Definition: iconnamecache.cpp:28
MessageViewer::KMMsgNotEncrypted
Definition: nodehelper.h:51
MessageViewer::ObjectTreeParser::parseObjectTree
void parseObjectTree(KMime::Content *node)
Parse beginning at a given node and recursively parsing the children of that node and it's next sibli...
Definition: objecttreeparser.cpp:263
MessageViewer::Util::createAppAction
MESSAGEVIEWER_EXPORT KAction * createAppAction(const KService::Ptr &service, bool singleOffer, QActionGroup *actionGroup, QObject *parent)
Definition: util.cpp:550
util.h
MessageViewer::ObjectTreeParser::rawDecryptedBody
KDE_DEPRECATED QByteArray rawDecryptedBody() const
The origin and purpose of this function is unknown, the ancient wisdom about it got lost during the c...
Definition: objecttreeparser.h:330
MessageViewer::NodeHelper::encryptionState
KMMsgEncryptionState encryptionState(KMime::Content *node) const
Definition: nodehelper.cpp:191
MessageViewer::IconNameCache::iconPath
QString iconPath(const QString &name, int size) const
Definition: iconnamecache.cpp:42
MessageViewer::Util::mimetype
MESSAGEVIEWER_EXPORT KMimeType::Ptr mimetype(const QString &name)
Search mimetype from filename when mimetype is empty or application/octet-stream. ...
Definition: util.cpp:568
MessageViewer::NodeHelper::cleanSubject
static QString cleanSubject(KMime::Message *message)
Return this mails subject, with all "forward" and "reply" prefixes removed.
Definition: nodehelper.cpp:526
MessageViewer::NodeHelper
Definition: nodehelper.h:71
MessageViewer::Util::saveContent
bool MESSAGEVIEWER_EXPORT saveContent(QWidget *parent, KMime::Content *content, const KUrl &url)
Definition: util.cpp:306
MessageViewer::ObjectTreeParser::findType
static KMime::Content * findType(KMime::Content *content, const QByteArray &mimeType, bool deep, bool wide)
Definition: objecttreeparser.cpp:3453
MessageViewer::Util::checkOverwrite
bool MESSAGEVIEWER_EXPORT checkOverwrite(const KUrl &url, QWidget *w)
Definition: util.cpp:79
MessageViewer::NodeHelper::setNodeUnprocessed
void setNodeUnprocessed(KMime::Content *node, bool recurse)
Definition: nodehelper.cpp:111
MessageViewer::NodeHelper::removeTempFiles
void removeTempFiles()
Cleanup the attachment temp files.
Definition: nodehelper.cpp:307
MessageViewer::NodeHelper::signatureState
KMMsgSignatureState signatureState(KMime::Content *node) const
Definition: nodehelper.cpp:201
MessageViewer::ObjectTreeParser
Parses messages and generates HTML display code out of them.
Definition: objecttreeparser.h:287
MessageViewer::Util::allContents
QList< KMime::Content * > MESSAGEVIEWER_EXPORT allContents(const KMime::Content *message)
Definition: util.cpp:153
MessageViewer::Util::handleUrlWithQDesktopServices
bool MESSAGEVIEWER_EXPORT handleUrlWithQDesktopServices(const KUrl &url)
Delegates opening a URL to the QDesktopServices mechanisms for that on Windows and MacOSX...
Definition: util.cpp:142
MessageViewer::Util::getWritePermissions
int MESSAGEVIEWER_EXPORT getWritePermissions()
evaluates GlobalSettings->disregardUmask() and returns resulting permissions for storing files ...
Definition: util.cpp:443
MessageViewer::Util::extractAttachments
QList< KMime::Content * > MESSAGEVIEWER_EXPORT extractAttachments(const KMime::Message *message)
Definition: util.cpp:170
MessageViewer::NodeHelper::fileName
static QString fileName(const KMime::Content *node)
Returns a usable filename for a node, that can be the filename from the content disposition header...
Definition: nodehelper.cpp:586
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal