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

mailcommon

  • sources
  • kde-4.12
  • kdepim
  • mailcommon
  • util
mailutil.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 #include "mailutil.h"
40 #include "mailutil_p.h"
41 #include "mailcommon/collectionpage/newmailnotifierattribute.h"
42 
43 #include "calendarinterface.h"
44 #include "job/expirejob.h"
45 #include "foldercollection.h"
46 #include "pop3settings.h"
47 #include "kernel/mailkernel.h"
48 #include "filter/dialog/filteractionmissingargumentdialog.h"
49 
50 #include "mailimporter/filterbalsa.h"
51 #include "mailimporter/filter_evolution.h"
52 #include "mailimporter/filter_evolution_v2.h"
53 #include "mailimporter/filter_evolution_v3.h"
54 #include "mailimporter/filter_clawsmail.h"
55 #include "mailimporter/filter_sylpheed.h"
56 #include "mailimporter/filter_thunderbird.h"
57 #include "mailimporter/filter_opera.h"
58 #include "mailimporter/othermailerutil.h"
59 
60 #include <incidenceeditor-ng/globalsettings.h>
61 #include <incidenceeditor-ng/incidencedialogfactory.h>
62 
63 #include <messagecore/utils/stringutil.h>
64 #include <messagecore/helpers/messagehelpers.h>
65 
66 #include <messagecomposer/helper/messagehelper.h>
67 
68 #include <Akonadi/AgentManager>
69 #include <Akonadi/EntityMimeTypeFilterModel>
70 #include <Akonadi/EntityTreeModel>
71 #include <Akonadi/ItemFetchJob>
72 #include <Akonadi/ItemFetchScope>
73 #include <Akonadi/KMime/MessageParts>
74 
75 #include <KMime/KMimeMessage>
76 
77 #include <KPIMUtils/Email>
78 
79 #include <KColorScheme>
80 #include <KDBusServiceStarter>
81 #include <KJob>
82 #include <KLocale>
83 #include <KMessageBox>
84 #include <KTemporaryFile>
85 #include <KIO/JobUiDelegate>
86 
87 
88 OrgKdeAkonadiPOP3SettingsInterface *MailCommon::Util::createPop3SettingsInterface(
89  const QString &ident )
90 {
91  return
92  new OrgKdeAkonadiPOP3SettingsInterface(
93  QLatin1String("org.freedesktop.Akonadi.Resource.") + ident, QLatin1String("/Settings"), QDBusConnection::sessionBus() );
94 }
95 
96 bool MailCommon::Util::isVirtualCollection( const Akonadi::Collection &collection )
97 {
98  return MailCommon::Util::isVirtualCollection( collection.resource() );
99 }
100 
101 bool MailCommon::Util::isVirtualCollection( const QString &resource )
102 {
103  return
104  (
105  resource == QLatin1String( "akonadi_nepomuktag_resource" ) ||
106  resource == QLatin1String( "akonadi_search_resource" ) );
107 }
108 
109 bool MailCommon::Util::isLocalCollection( const QString &resource )
110 {
111  return resource.contains(QLatin1String("akonadi_mbox_resource")) ||
112  resource.contains(QLatin1String("akonadi_maildir_resource")) ||
113  resource.contains(QLatin1String("akonadi_mixedmaildir_resource"));
114 }
115 
116 
117 QString MailCommon::Util::fullCollectionPath( const Akonadi::Collection &collection )
118 {
119  QString fullPath;
120 
121  QModelIndex idx =
122  Akonadi::EntityTreeModel::modelIndexForCollection( KernelIf->collectionModel(), collection );
123  if ( !idx.isValid() ) {
124  return fullPath;
125  }
126 
127  fullPath = idx.data().toString();
128  idx = idx.parent();
129  while ( idx != QModelIndex() ) {
130  fullPath = idx.data().toString() + QLatin1Char('/') + fullPath;
131  idx = idx.parent();
132  }
133  return fullPath;
134 }
135 
136 bool MailCommon::Util::showJobErrorMessage( KJob *job )
137 {
138  if ( job->error() ) {
139  if ( static_cast<KIO::Job*>( job )->ui() ) {
140  static_cast<KIO::Job*>(job)->ui()->showErrorMessage();
141  } else {
142  kDebug() << " job->errorString() :"<<job->errorString();
143  }
144  return true;
145  }
146  return false;
147 }
148 
149 Akonadi::AgentInstance::List MailCommon::Util::agentInstances( bool excludeMailDispacher )
150 {
151  Akonadi::AgentInstance::List relevantInstances;
152  foreach ( const Akonadi::AgentInstance &instance, Akonadi::AgentManager::self()->instances() ) {
153  const QStringList capabilities( instance.type().capabilities() );
154  if ( instance.type().mimeTypes().contains( KMime::Message::mimeType() ) ) {
155  if ( capabilities.contains( QLatin1String("Resource") ) &&
156  !capabilities.contains( QLatin1String("Virtual") ) &&
157  !capabilities.contains( QLatin1String("MailTransport") ) )
158  {
159  relevantInstances << instance;
160  } else if ( !excludeMailDispacher &&
161  instance.identifier() == QLatin1String( "akonadi_maildispatcher_agent" ) ) {
162  relevantInstances << instance;
163  }
164  }
165  }
166  return relevantInstances;
167 }
168 
169 /* static */
170 bool MailCommon::Util::ensureKorganizerRunning( bool switchTo )
171 {
172  // FIXME: this function should be inside a QObject, and async,
173  // and emit a signal when korg registered itself successfuly
174 
175  QString error;
176  bool result = true;
177  QString dbusService;
178 
179 #if defined (Q_OS_WINCE) || defined(Q_OS_WIN32)
180  //Can't run the korganizer-mobile.sh through KDBusServiceStarter in these platforms.
181  QDBusInterface *interface = new QDBusInterface( QLatin1String("org.kde.korganizer"), QLatin1String("/MainApplication") );
182  if ( !interface->isValid() ) {
183  kDebug() << "Starting korganizer...";
184 
185  QDBusServiceWatcher *watcher =
186  new QDBusServiceWatcher( QLatin1String("org.kde.korganizer"), QDBusConnection::sessionBus(),
187  QDBusServiceWatcher::WatchForRegistration );
188  QEventLoop loop;
189  watcher->connect( watcher, SIGNAL(serviceRegistered(QString)), &loop, SLOT(quit()) );
190  result = QProcess::startDetached( QLatin1String("korganizer-mobile") );
191  if ( result ) {
192  kDebug() << "Starting loop";
193  loop.exec();
194  kDebug() << "Korganizer finished starting";
195  } else {
196  kWarning() << "Failed to start korganizer with QProcess";
197  }
198 
199  delete watcher;
200  }
201  delete interface;
202 #else
203  QString constraint;
204 
205 #ifdef KDEPIM_MOBILE_UI
206  // start the mobile korg instead of the desktop one
207  constraint = QLatin1String("'mobile' in Keywords");
208 #endif
209 
210  result = KDBusServiceStarter::self()->findServiceFor( QLatin1String("DBUS/Organizer"),
211  constraint,
212  &error, &dbusService ) == 0;
213 #endif
214  if ( result ) {
215  // OK, so korganizer (or kontact) is running. Now ensure the object we want is loaded.
216  QDBusInterface iface( QLatin1String("org.kde.korganizer"), QLatin1String("/MainApplication"),
217  QLatin1String("org.kde.KUniqueApplication") );
218  if ( iface.isValid() ) {
219  if ( switchTo ) {
220  iface.call( QLatin1String("newInstance") ); // activate korganizer window
221  }
222 #if 0 //Not exist
223  QDBusInterface pimIface( "org.kde.korganizer", "/korganizer_PimApplication",
224  "org.kde.KUniqueApplication" );
225  QDBusReply<bool> r = pimIface.call( "load" );
226  if ( !r.isValid() || !r.value() ) {
227  kWarning() << "Loading korganizer failed: " << pimIface.lastError().message();
228  }
229 #endif
230  } else {
231  kWarning() << "Couldn't obtain korganizer D-Bus interface" << iface.lastError().message();
232  }
233 
234  // We don't do anything with it, we just need it to be running so that it handles
235  // the incoming directory.
236  } else {
237  kWarning() << "Couldn't start DBUS/Organizer:" << dbusService << error;
238  }
239  return result;
240 }
241 
242 static bool createIncidenceFromMail( KCalCore::IncidenceBase::IncidenceType type,
243  const Akonadi::Item &mailItem )
244 {
245  Akonadi::Item item( mailItem );
246 
247  // We need the full payload to attach the mail to the incidence
248  if ( !item.loadedPayloadParts().contains( Akonadi::MessagePart::Body ) ) {
249  Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( item );
250  job->fetchScope().fetchFullPayload();
251  if ( job->exec() ) {
252  if ( job->items().count() == 1 ) {
253  item = job->items().first();
254  }
255  }
256  }
257 
258  KMime::Message::Ptr msg = MessageCore::Util::message( item );
259 
260  if ( !msg ) {
261  return false;
262  }
263 
264  bool isInlineAttachment = false;
265  QStringList attachmentUris;
266 
267  KTemporaryFile tf;
268  tf.setAutoRemove( false );
269 
270  if ( !tf.open() ) {
271  kWarning() << "CreateIncidenceFromMail: Unable to open temp file.";
272  return false;
273  }
274 
275  const QString incidenceDescription =
276  i18n( "From: %1\nTo: %2\nSubject: %3",
277  msg->from()->asUnicodeString(),
278  msg->to()->asUnicodeString(),
279  msg->subject()->asUnicodeString() );
280 
281  QStringList attachmentLabels;
282  attachmentLabels << msg->subject()->asUnicodeString();
283 
284  QStringList attachmentMimeTypes;
285  attachmentMimeTypes << QLatin1String( "message/rfc822" );
286 
287  int action = IncidenceEditorNG::GlobalSettings::self()->defaultEmailAttachMethod();
288  if ( IncidenceEditorNG::GlobalSettings::self()->defaultEmailAttachMethod() ==
289  IncidenceEditorNG::GlobalSettings::Ask ) {
290  MailCommon::AttachmentSelectionDialog dialog;
291 
292  if ( !dialog.exec() ) {
293  return true; // canceled by user
294  }
295 
296  switch ( dialog.attachmentType() ) {
297  case MailCommon::AttachmentSelectionDialog::AttachAsLink:
298  action = IncidenceEditorNG::GlobalSettings::Link;
299  break;
300  case MailCommon::AttachmentSelectionDialog::AttachInline:
301  action = IncidenceEditorNG::GlobalSettings::InlineFull;
302  break;
303  case MailCommon::AttachmentSelectionDialog::AttachWithoutAttachments:
304  action = IncidenceEditorNG::GlobalSettings::InlineBody;
305  break;
306  }
307  }
308 
309  switch ( action ) {
310  case IncidenceEditorNG::GlobalSettings::Link:
311  attachmentUris << mailItem.url( Akonadi::Item::UrlWithMimeType ).url();
312  isInlineAttachment = false;
313  break;
314  case IncidenceEditorNG::GlobalSettings::InlineFull:
315  tf.write( msg->encodedContent() );
316  tf.flush();
317 
318  attachmentUris << tf.fileName();
319  isInlineAttachment = true;
320  break;
321  case IncidenceEditorNG::GlobalSettings::InlineBody:
322  {
323  if ( msg.get() == msg->textContent() || msg->textContent() == 0 ) { // no attachments
324  tf.write( msg->encodedContent() );
325  tf.flush();
326 
327  attachmentUris << tf.fileName();
328  isInlineAttachment = true;
329  } else {
330  if ( KMessageBox::warningContinueCancel(
331  0,
332  i18n( "Removing attachments from an email might invalidate its signature." ),
333  i18n( "Remove Attachments" ),
334  KStandardGuiItem::cont(),
335  KStandardGuiItem::cancel(),
336  QLatin1String("BodyOnlyInlineAttachment") ) != KMessageBox::Continue ) {
337  return true; // canceled by user
338  }
339 
340  KMime::Message::Ptr newMsg( new KMime::Message() );
341  newMsg->setHead( msg->head() );
342  newMsg->setBody( msg->textContent()->body() );
343  newMsg->parse();
344  newMsg->contentTransferEncoding()->from7BitString(
345  msg->textContent()->contentTransferEncoding()->as7BitString() );
346  newMsg->contentType()->from7BitString( msg->textContent()->contentType()->as7BitString() );
347  newMsg->assemble();
348  tf.write( newMsg->encodedContent() );
349  tf.flush();
350 
351  attachmentUris << tf.fileName();
352  isInlineAttachment = true;
353  }
354  break;
355  }
356  default:
357  return false;
358  }
359  kDebug() << "AttachmentUris = " << attachmentUris
360  << "; isInlineAttachment = " << isInlineAttachment
361  << "; mimeTypes = " << attachmentMimeTypes;
362 
363 #ifndef KDEPIM_MOBILE_UI
364  kDebug() << "desktop";
365  switch ( type ) {
366  case KCalCore::IncidenceBase::TypeEvent:
367  IncidenceEditorNG::IncidenceDialogFactory::createEventEditor(
368  i18n( "Mail: %1", msg->subject()->asUnicodeString() ),
369  incidenceDescription,
370  attachmentUris,
371  QStringList(), /* attendees */
372  attachmentMimeTypes,
373  attachmentLabels,
374  isInlineAttachment,
375  Akonadi::Collection(),
376  true /* cleanup temp files */);
377  break;
378 
379  case KCalCore::IncidenceBase::TypeTodo:
380  IncidenceEditorNG::IncidenceDialogFactory::createTodoEditor(
381  i18n( "Mail: %1", msg->subject()->asUnicodeString() ),
382  incidenceDescription,
383  attachmentUris,
384  QStringList(), /* attendees */
385  attachmentMimeTypes,
386  attachmentLabels,
387  isInlineAttachment,
388  Akonadi::Collection(),
389  true /* cleanup temp files */);
390  break;
391 
392  default:
393  Q_ASSERT( false );
394  break;
395  }
396 #else
397  kDebug() << "mobile";
398  if (MailCommon::Util::ensureKorganizerRunning( false )) {
399  kDebug() << "opening editor";
400  OrgKdeKorganizerCalendarInterface *iface =
401  new OrgKdeKorganizerCalendarInterface( QLatin1String("org.kde.korganizer"), QLatin1String("/Calendar"),
402  QDBusConnection::sessionBus() );
403  switch( type ) {
404  case KCalCore::IncidenceBase::TypeEvent:
405  iface->openEventEditor(
406  i18n( "Mail: %1", msg->subject()->asUnicodeString() ),
407  incidenceDescription,
408  attachmentUris,
409  QStringList(),
410  attachmentMimeTypes,
411  isInlineAttachment );
412  break;
413 
414  case KCalCore::IncidenceBase::TypeTodo:
415  iface->openTodoEditor(
416  i18n( "Mail: %1", msg->subject()->asUnicodeString() ),
417  incidenceDescription,
418  attachmentUris,
419  QStringList(),
420  attachmentMimeTypes,
421  isInlineAttachment );
422  break;
423 
424  default:
425  Q_ASSERT( false );
426  break;
427  }
428  delete iface;
429  }
430 #endif
431 
432  tf.close();
433  return true;
434 }
435 
436 bool MailCommon::Util::createTodoFromMail( const Akonadi::Item &mailItem )
437 {
438  return createIncidenceFromMail( KCalCore::IncidenceBase::TypeTodo, mailItem );
439 }
440 
441 bool MailCommon::Util::createEventFromMail( const Akonadi::Item &mailItem )
442 {
443  return createIncidenceFromMail( KCalCore::IncidenceBase::TypeEvent, mailItem );
444 }
445 
446 uint MailCommon::Util::folderIdentity( const Akonadi::Item &item )
447 {
448  uint id = 0;
449  if ( item.isValid() && item.parentCollection().isValid() ) {
450  Akonadi::Collection col = item.parentCollection();
451  if ( col.resource().isEmpty()) {
452  col = parentCollectionFromItem(item);
453  }
454  const QSharedPointer<FolderCollection> fd =
455  FolderCollection::forCollection( col, false );
456 
457  id = fd->identity();
458  }
459  return id;
460 }
461 
462 static QModelIndex indexBelow( QAbstractItemModel *model, const QModelIndex &current )
463 {
464  // if we have children, return first child
465  if ( model->rowCount( current ) > 0 ) {
466  return model->index( 0, 0, current );
467  }
468 
469  // if we have siblings, return next sibling
470  const QModelIndex parent = model->parent( current );
471  const QModelIndex sibling = model->index( current.row() + 1, 0, parent );
472 
473  if ( sibling.isValid() ) { // found valid sibling
474  return sibling;
475  }
476 
477  if ( !parent.isValid() ) { // our parent is the tree root and we have no siblings
478  return QModelIndex(); // we reached the bottom of the tree
479  }
480 
481  // We are the last child, the next index to check is our uncle, parent's first sibling
482  const QModelIndex parentsSibling = parent.sibling( parent.row() + 1, 0 );
483  if ( parentsSibling.isValid() ) {
484  return parentsSibling;
485  }
486 
487  // iterate over our parents back to root until we find a parent with a valid sibling
488  QModelIndex currentParent = parent;
489  QModelIndex grandParent = model->parent( currentParent );
490  while ( currentParent.isValid() ) {
491  // check if the parent has children except from us
492  if ( model->rowCount( grandParent ) > currentParent.row() + 1 ) {
493  const QModelIndex index =
494  indexBelow( model, model->index( currentParent.row() + 1, 0, grandParent ) );
495  if ( index.isValid() ) {
496  return index;
497  }
498  }
499 
500  currentParent = grandParent;
501  grandParent = model->parent( currentParent );
502  }
503 
504  return QModelIndex(); // nothing found -> end of tree
505 }
506 
507 static QModelIndex lastChildOfModel( QAbstractItemModel *model, const QModelIndex &current )
508 {
509  if ( model->rowCount( current ) == 0 ) {
510  return current;
511  }
512 
513  return lastChildOfModel( model, model->index( model->rowCount( current ) - 1, 0, current ) );
514 }
515 
516 static QModelIndex indexAbove( QAbstractItemModel *model, const QModelIndex &current )
517 {
518  const QModelIndex parent = model->parent( current );
519 
520  if ( current.row() == 0 ) {
521  // we have no previous siblings -> our parent is the next item above us
522  return parent;
523  }
524 
525  // find previous sibling
526  const QModelIndex previousSibling = model->index( current.row() - 1, 0, parent );
527 
528  // the item above us is the last child (or grandchild, or grandgrandchild... etc)
529  // of our previous sibling
530  return lastChildOfModel( model, previousSibling );
531 }
532 
533 QModelIndex MailCommon::Util::nextUnreadCollection( QAbstractItemModel *model,
534  const QModelIndex &current,
535  SearchDirection direction,
536  bool (*ignoreCollectionCallback)( const Akonadi::Collection &collection ) )
537 {
538  QModelIndex index = current;
539  while ( true ) {
540  if ( direction == MailCommon::Util::ForwardSearch ) {
541  index = indexBelow( model, index );
542  } else if ( direction == MailCommon::Util::BackwardSearch ) {
543  index = indexAbove( model, index );
544  }
545 
546  if ( !index.isValid() ) { // reach end or top of the model
547  return QModelIndex();
548  }
549 
550  // check if the index is a collection
551  const Akonadi::Collection collection =
552  index.data( Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>();
553 
554  if ( collection.isValid() ) {
555 
556  // check if it is unread
557  if ( collection.statistics().unreadCount() > 0 ) {
558  if ( ignoreCollectionCallback && ignoreCollectionCallback( collection ) ) {
559  continue;
560  }
561  if ( !ignoreNewMailInFolder(collection) ) {
562  return index; // we found the next unread collection
563  }
564  }
565  }
566  }
567 
568  return QModelIndex(); // no unread collection found
569 }
570 
571 bool MailCommon::Util::ignoreNewMailInFolder(const Akonadi::Collection &collection)
572 {
573  if ( collection.hasAttribute<NewMailNotifierAttribute>() ) {
574  if (collection.attribute<NewMailNotifierAttribute>()->ignoreNewMail()) {
575  return true;
576  }
577  }
578  return false;
579 }
580 
581 Akonadi::Collection MailCommon::Util::parentCollectionFromItem( const Akonadi::Item &item )
582 {
583  return updatedCollection(item.parentCollection());
584 }
585 
586 QString MailCommon::Util::realFolderPath( const QString &path )
587 {
588  QString realPath( path );
589  realPath.remove( QLatin1String(".directory") );
590  realPath.replace( QLatin1String("/."), QLatin1String("/") );
591  if ( !realPath.isEmpty() && ( realPath.at( 0 ) == QLatin1Char('.') ) ) {
592  realPath.remove( 0, 1 ); //remove first "."
593  }
594  return realPath;
595 }
596 
597 QColor MailCommon::Util::defaultQuotaColor()
598 {
599  KColorScheme scheme( QPalette::Active, KColorScheme::View );
600  return scheme.foreground( KColorScheme::NegativeText ).color();
601 }
602 
603 void MailCommon::Util::expireOldMessages( const Akonadi::Collection &collection, bool immediate )
604 {
605  ScheduledExpireTask *task = new ScheduledExpireTask( collection, immediate );
606  KernelIf->jobScheduler()->registerTask( task );
607 }
608 
609 Akonadi::Collection MailCommon::Util::updatedCollection( const Akonadi::Collection& col )
610 {
611  const QModelIndex idx = Akonadi::EntityTreeModel::modelIndexForCollection( KernelIf->collectionModel(), col );
612  const Akonadi::Collection collection = idx.data( Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>();
613  return collection;
614 }
615 
616 Akonadi::Collection::Id MailCommon::Util::convertFolderPathToCollectionId( const QString& folder)
617 {
618  Akonadi::Collection::Id newFolderId=-1;
619  bool exactPath = false;
620  Akonadi::Collection::List lst = FilterActionMissingCollectionDialog::potentialCorrectFolders( folder, exactPath );
621  if ( lst.count() == 1 && exactPath )
622  newFolderId = lst.at( 0 ).id();
623  else {
624  QPointer<FilterActionMissingCollectionDialog> dlg = new FilterActionMissingCollectionDialog( lst, QString(), folder );
625  if ( dlg->exec() ) {
626  newFolderId = dlg->selectedCollection().id();
627  }
628  delete dlg;
629  }
630  return newFolderId;
631 }
632 
633 QString MailCommon::Util::convertFolderPathToCollectionStr( const QString& folder)
634 {
635  Akonadi::Collection::Id newFolderId= MailCommon::Util::convertFolderPathToCollectionId(folder);
636  if (newFolderId == -1 )
637  return QString();
638  return QString::number(newFolderId);
639 }
640 
641 bool MailCommon::Util::foundMailer()
642 {
643  QStringList lst;
644  lst << MailImporter::FilterEvolution::defaultSettingsPath();
645  lst << MailImporter::FilterEvolution_v2::defaultSettingsPath();
646  lst << MailImporter::FilterEvolution_v3::defaultSettingsPath();
647  lst << MailImporter::FilterBalsa::defaultSettingsPath();
648  lst << MailImporter::FilterClawsMail::defaultSettingsPath();
649  lst << MailImporter::FilterOpera::defaultSettingsPath();
650  lst << MailImporter::FilterSylpheed::defaultSettingsPath();
651  lst << MailImporter::FilterThunderbird::defaultSettingsPath();
652  lst << MailImporter::OtherMailerUtil::trojitaDefaultPath();
653 
654  Q_FOREACH(const QString& path, lst) {
655  QDir directory( path );
656  if ( directory.exists() ) {
657  return true;
658  }
659  }
660  return false;
661 }
662 
MailCommon::Util::ignoreNewMailInFolder
MAILCOMMON_EXPORT bool ignoreNewMailInFolder(const Akonadi::Collection &collection)
Definition: mailutil.cpp:571
MailCommon::Util::defaultQuotaColor
MAILCOMMON_EXPORT QColor defaultQuotaColor()
Definition: mailutil.cpp:597
MailCommon::Util::agentInstances
MAILCOMMON_EXPORT Akonadi::AgentInstance::List agentInstances(bool excludeMailTransport=true)
Definition: mailutil.cpp:149
foldercollection.h
mailutil_p.h
QSharedPointer
Definition: collectiongeneralpage.h:30
KernelIf
#define KernelIf
Definition: mailkernel.h:186
MailCommon::Util::createEventFromMail
MAILCOMMON_EXPORT bool createEventFromMail(const Akonadi::Item &mailItem)
Definition: mailutil.cpp:441
expirejob.h
indexAbove
static QModelIndex indexAbove(QAbstractItemModel *model, const QModelIndex &current)
Definition: mailutil.cpp:516
MailCommon::Util::isLocalCollection
MAILCOMMON_EXPORT bool isLocalCollection(const QString &resource)
Definition: mailutil.cpp:109
filteractionmissingargumentdialog.h
MailCommon::Util::isVirtualCollection
MAILCOMMON_EXPORT bool isVirtualCollection(const Akonadi::Collection &col)
Definition: mailutil.cpp:96
MailCommon::AttachmentSelectionDialog::AttachInline
Definition: mailutil_p.h:40
id
SearchRule::Function id
Definition: daterulewidgethandler.cpp:34
MailCommon::AttachmentSelectionDialog
Definition: mailutil_p.h:33
MailCommon::AttachmentSelectionDialog::attachmentType
Type attachmentType() const
Definition: mailutil_p.h:61
MailCommon::ScheduledExpireTask
A scheduled "expire mails in this folder" task.
Definition: expirejob.h:70
newmailnotifierattribute.h
MailCommon::Util::SearchDirection
SearchDirection
Describes the direction for searching next unread collection.
Definition: mailutil.h:96
FilterActionMissingCollectionDialog
Definition: filteractionmissingargumentdialog.h:49
MailCommon::Util::ForwardSearch
Definition: mailutil.h:97
MailCommon::AttachmentSelectionDialog::AttachWithoutAttachments
Definition: mailutil_p.h:41
MailCommon::Util::updatedCollection
MAILCOMMON_EXPORT Akonadi::Collection updatedCollection(const Akonadi::Collection &col)
Definition: mailutil.cpp:609
MailCommon::Util::parentCollectionFromItem
MAILCOMMON_EXPORT Akonadi::Collection parentCollectionFromItem(const Akonadi::Item &item)
Definition: mailutil.cpp:581
MailCommon::Util::convertFolderPathToCollectionId
MAILCOMMON_EXPORT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &folder)
Definition: mailutil.cpp:616
indexBelow
static QModelIndex indexBelow(QAbstractItemModel *model, const QModelIndex &current)
Definition: mailutil.cpp:462
MailCommon::Util::createTodoFromMail
MAILCOMMON_EXPORT bool createTodoFromMail(const Akonadi::Item &mailItem)
Definition: mailutil.cpp:436
QAbstractItemModel
MailCommon::Util::BackwardSearch
Definition: mailutil.h:98
lastChildOfModel
static QModelIndex lastChildOfModel(QAbstractItemModel *model, const QModelIndex &current)
Definition: mailutil.cpp:507
MailCommon::Util::folderIdentity
MAILCOMMON_EXPORT uint folderIdentity(const Akonadi::Item &item)
Returns the identity of the folder that contains the given Akonadi::Item.
Definition: mailutil.cpp:446
MailCommon::Util::showJobErrorMessage
MAILCOMMON_EXPORT bool showJobErrorMessage(KJob *job)
Definition: mailutil.cpp:136
MailCommon::NewMailNotifierAttribute
Definition: newmailnotifierattribute.h:27
mailkernel.h
MailCommon::Util::fullCollectionPath
MAILCOMMON_EXPORT QString fullCollectionPath(const Akonadi::Collection &collection)
Definition: mailutil.cpp:117
MailCommon::Util::convertFolderPathToCollectionStr
MAILCOMMON_EXPORT QString convertFolderPathToCollectionStr(const QString &folder)
Definition: mailutil.cpp:633
MailCommon::Util::nextUnreadCollection
MAILCOMMON_EXPORT QModelIndex nextUnreadCollection(QAbstractItemModel *model, const QModelIndex &current, SearchDirection direction, bool(*ignoreCollectionCallback)(const Akonadi::Collection &collection)=0)
Returns the index of the next unread collection following a given index.
Definition: mailutil.cpp:533
MailCommon::NewMailNotifierAttribute::ignoreNewMail
bool ignoreNewMail() const
Definition: newmailnotifierattribute.cpp:74
MailCommon::Util::expireOldMessages
MAILCOMMON_EXPORT void expireOldMessages(const Akonadi::Collection &collection, bool immediate)
Definition: mailutil.cpp:603
MailCommon::AttachmentSelectionDialog::AttachAsLink
Definition: mailutil_p.h:39
MailCommon::Util::foundMailer
MAILCOMMON_EXPORT bool foundMailer()
Definition: mailutil.cpp:641
MailCommon::Util::realFolderPath
MAILCOMMON_EXPORT QString realFolderPath(const QString &path)
Definition: mailutil.cpp:586
mailutil.h
MailCommon::Util::ensureKorganizerRunning
MAILCOMMON_EXPORT bool ensureKorganizerRunning(bool switchTo)
Definition: mailutil.cpp:170
FilterActionMissingCollectionDialog::potentialCorrectFolders
static Akonadi::Collection::List potentialCorrectFolders(const QString &path, bool &exactPath)
Definition: filteractionmissingargumentdialog.cpp:166
MailCommon::Util::createPop3SettingsInterface
MAILCOMMON_EXPORT OrgKdeAkonadiPOP3SettingsInterface * createPop3SettingsInterface(const QString &ident)
Definition: mailutil.cpp:88
createIncidenceFromMail
static bool createIncidenceFromMail(KCalCore::IncidenceBase::IncidenceType type, const Akonadi::Item &mailItem)
Definition: mailutil.cpp:242
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailcommon

Skip menu "mailcommon"
  • 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