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

mailcommon

  • sources
  • kde-4.14
  • 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 "mailcommon/collectionpage/attributes/newmailnotifierattribute.h"
41 
42 #include "calendarinterface.h"
43 #include "job/expirejob.h"
44 #include "foldercollection.h"
45 #include "pop3settings.h"
46 #include "kernel/mailkernel.h"
47 #include "filter/dialog/filteractionmissingargumentdialog.h"
48 
49 #include "mailimporter/filterbalsa.h"
50 #include "mailimporter/filter_evolution.h"
51 #include "mailimporter/filter_evolution_v2.h"
52 #include "mailimporter/filter_evolution_v3.h"
53 #include "mailimporter/filter_clawsmail.h"
54 #include "mailimporter/filter_sylpheed.h"
55 #include "mailimporter/filter_thunderbird.h"
56 #include "mailimporter/filter_opera.h"
57 #include "mailimporter/filtericedove.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 #include <collectionpage/attributes/expirecollectionattribute.h>
87 
88 
89 OrgKdeAkonadiPOP3SettingsInterface *MailCommon::Util::createPop3SettingsInterface(
90  const QString &ident )
91 {
92  return
93  new OrgKdeAkonadiPOP3SettingsInterface(
94  QLatin1String("org.freedesktop.Akonadi.Resource.") + ident, QLatin1String("/Settings"), QDBusConnection::sessionBus() );
95 }
96 
97 bool MailCommon::Util::isVirtualCollection( const Akonadi::Collection &collection )
98 {
99  return MailCommon::Util::isVirtualCollection( collection.resource() );
100 }
101 
102 bool MailCommon::Util::isVirtualCollection( const QString &resource )
103 {
104  return resource == QLatin1String( "akonadi_search_resource" );
105 }
106 
107 bool MailCommon::Util::isLocalCollection( const QString &resource )
108 {
109  return resource.contains(QLatin1String("akonadi_mbox_resource")) ||
110  resource.contains(QLatin1String("akonadi_maildir_resource")) ||
111  resource.contains(QLatin1String("akonadi_mixedmaildir_resource"));
112 }
113 
114 
115 QString MailCommon::Util::fullCollectionPath( const Akonadi::Collection &collection )
116 {
117  QString fullPath;
118 
119  QModelIndex idx =
120  Akonadi::EntityTreeModel::modelIndexForCollection( KernelIf->collectionModel(), collection );
121  if ( !idx.isValid() ) {
122  return fullPath;
123  }
124 
125  fullPath = idx.data().toString();
126  idx = idx.parent();
127  while ( idx != QModelIndex() ) {
128  fullPath = idx.data().toString() + QLatin1Char('/') + fullPath;
129  idx = idx.parent();
130  }
131  return fullPath;
132 }
133 
134 bool MailCommon::Util::showJobErrorMessage( KJob *job )
135 {
136  if ( job->error() ) {
137  if ( static_cast<KIO::Job*>( job )->ui() ) {
138  static_cast<KIO::Job*>(job)->ui()->showErrorMessage();
139  } else {
140  kDebug() << " job->errorString() :"<<job->errorString();
141  }
142  return true;
143  }
144  return false;
145 }
146 
147 Akonadi::AgentInstance::List MailCommon::Util::agentInstances( bool excludeMailDispacher )
148 {
149  Akonadi::AgentInstance::List relevantInstances;
150  foreach ( const Akonadi::AgentInstance &instance, Akonadi::AgentManager::self()->instances() ) {
151  const QStringList capabilities( instance.type().capabilities() );
152  if ( instance.type().mimeTypes().contains( KMime::Message::mimeType() ) ) {
153  if ( capabilities.contains( QLatin1String("Resource") ) &&
154  !capabilities.contains( QLatin1String("Virtual") ) &&
155  !capabilities.contains( QLatin1String("MailTransport") ) )
156  {
157  relevantInstances << instance;
158  } else if ( !excludeMailDispacher &&
159  instance.identifier() == QLatin1String( "akonadi_maildispatcher_agent" ) ) {
160  relevantInstances << instance;
161  }
162  }
163  }
164  return relevantInstances;
165 }
166 
167 /* static */
168 bool MailCommon::Util::ensureKorganizerRunning( bool switchTo )
169 {
170  // FIXME: this function should be inside a QObject, and async,
171  // and emit a signal when korg registered itself successfuly
172 
173  QString error;
174  bool result = true;
175  QString dbusService;
176 
177 #if defined(Q_OS_WIN32)
178  //Can't run the korganizer-mobile.sh through KDBusServiceStarter in these platforms.
179  QDBusInterface *interface = new QDBusInterface( QLatin1String("org.kde.korganizer"), QLatin1String("/MainApplication") );
180  if ( !interface->isValid() ) {
181  kDebug() << "Starting korganizer...";
182 
183  QDBusServiceWatcher *watcher =
184  new QDBusServiceWatcher( QLatin1String("org.kde.korganizer"), QDBusConnection::sessionBus(),
185  QDBusServiceWatcher::WatchForRegistration );
186  QEventLoop loop;
187  watcher->connect( watcher, SIGNAL(serviceRegistered(QString)), &loop, SLOT(quit()) );
188  result = QProcess::startDetached( QLatin1String("korganizer-mobile") );
189  if ( result ) {
190  kDebug() << "Starting loop";
191  loop.exec();
192  kDebug() << "Korganizer finished starting";
193  } else {
194  kWarning() << "Failed to start korganizer with QProcess";
195  }
196 
197  delete watcher;
198  }
199  delete interface;
200 #else
201  QString constraint;
202 
203 #ifdef KDEPIM_MOBILE_UI
204  // start the mobile korg instead of the desktop one
205  constraint = QLatin1String("'mobile' in Keywords");
206 #endif
207 
208  result = KDBusServiceStarter::self()->findServiceFor( QLatin1String("DBUS/Organizer"),
209  constraint,
210  &error, &dbusService ) == 0;
211 #endif
212  if ( result ) {
213  // OK, so korganizer (or kontact) is running. Now ensure the object we want is loaded.
214  QDBusInterface iface( QLatin1String("org.kde.korganizer"), QLatin1String("/MainApplication"),
215  QLatin1String("org.kde.KUniqueApplication") );
216  if ( iface.isValid() ) {
217  if ( switchTo ) {
218  iface.call( QLatin1String("newInstance") ); // activate korganizer window
219  }
220 #if 0 //Not exist
221  QDBusInterface pimIface( "org.kde.korganizer", "/korganizer_PimApplication",
222  "org.kde.KUniqueApplication" );
223  QDBusReply<bool> r = pimIface.call( "load" );
224  if ( !r.isValid() || !r.value() ) {
225  kWarning() << "Loading korganizer failed: " << pimIface.lastError().message();
226  }
227 #endif
228  } else {
229  kWarning() << "Couldn't obtain korganizer D-Bus interface" << iface.lastError().message();
230  }
231 
232  // We don't do anything with it, we just need it to be running so that it handles
233  // the incoming directory.
234  } else {
235  kWarning() << "Couldn't start DBUS/Organizer:" << dbusService << error;
236  }
237  return result;
238 }
239 
240 uint MailCommon::Util::folderIdentity( const Akonadi::Item &item )
241 {
242  uint id = 0;
243  if ( item.isValid() && item.parentCollection().isValid() ) {
244  Akonadi::Collection col = item.parentCollection();
245  if ( col.resource().isEmpty()) {
246  col = parentCollectionFromItem(item);
247  }
248  const QSharedPointer<FolderCollection> fd =
249  FolderCollection::forCollection( col, false );
250 
251  id = fd->identity();
252  }
253  return id;
254 }
255 
256 static QModelIndex indexBelow( QAbstractItemModel *model, const QModelIndex &current )
257 {
258  // if we have children, return first child
259  if ( model->rowCount( current ) > 0 ) {
260  return model->index( 0, 0, current );
261  }
262 
263  // if we have siblings, return next sibling
264  const QModelIndex parent = model->parent( current );
265  const QModelIndex sibling = model->index( current.row() + 1, 0, parent );
266 
267  if ( sibling.isValid() ) { // found valid sibling
268  return sibling;
269  }
270 
271  if ( !parent.isValid() ) { // our parent is the tree root and we have no siblings
272  return QModelIndex(); // we reached the bottom of the tree
273  }
274 
275  // We are the last child, the next index to check is our uncle, parent's first sibling
276  const QModelIndex parentsSibling = parent.sibling( parent.row() + 1, 0 );
277  if ( parentsSibling.isValid() ) {
278  return parentsSibling;
279  }
280 
281  // iterate over our parents back to root until we find a parent with a valid sibling
282  QModelIndex currentParent = parent;
283  QModelIndex grandParent = model->parent( currentParent );
284  while ( currentParent.isValid() ) {
285  // check if the parent has children except from us
286  if ( model->rowCount( grandParent ) > currentParent.row() + 1 ) {
287  const QModelIndex index =
288  indexBelow( model, model->index( currentParent.row() + 1, 0, grandParent ) );
289  if ( index.isValid() ) {
290  return index;
291  }
292  }
293 
294  currentParent = grandParent;
295  grandParent = model->parent( currentParent );
296  }
297 
298  return QModelIndex(); // nothing found -> end of tree
299 }
300 
301 static QModelIndex lastChildOfModel( QAbstractItemModel *model, const QModelIndex &current )
302 {
303  if ( model->rowCount( current ) == 0 ) {
304  return current;
305  }
306 
307  return lastChildOfModel( model, model->index( model->rowCount( current ) - 1, 0, current ) );
308 }
309 
310 static QModelIndex indexAbove( QAbstractItemModel *model, const QModelIndex &current )
311 {
312  const QModelIndex parent = model->parent( current );
313 
314  if ( current.row() == 0 ) {
315  // we have no previous siblings -> our parent is the next item above us
316  return parent;
317  }
318 
319  // find previous sibling
320  const QModelIndex previousSibling = model->index( current.row() - 1, 0, parent );
321 
322  // the item above us is the last child (or grandchild, or grandgrandchild... etc)
323  // of our previous sibling
324  return lastChildOfModel( model, previousSibling );
325 }
326 
327 QModelIndex MailCommon::Util::nextUnreadCollection( QAbstractItemModel *model,
328  const QModelIndex &current,
329  SearchDirection direction,
330  bool (*ignoreCollectionCallback)( const Akonadi::Collection &collection ) )
331 {
332  QModelIndex index = current;
333  while ( true ) {
334  if ( direction == MailCommon::Util::ForwardSearch ) {
335  index = indexBelow( model, index );
336  } else if ( direction == MailCommon::Util::BackwardSearch ) {
337  index = indexAbove( model, index );
338  }
339 
340  if ( !index.isValid() ) { // reach end or top of the model
341  return QModelIndex();
342  }
343 
344  // check if the index is a collection
345  const Akonadi::Collection collection =
346  index.data( Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>();
347 
348  if ( collection.isValid() ) {
349 
350  // check if it is unread
351  if ( collection.statistics().unreadCount() > 0 ) {
352  if ( ignoreCollectionCallback && ignoreCollectionCallback( collection ) ) {
353  continue;
354  }
355  if ( !ignoreNewMailInFolder(collection) ) {
356  return index; // we found the next unread collection
357  }
358  }
359  }
360  }
361 
362  return QModelIndex(); // no unread collection found
363 }
364 
365 bool MailCommon::Util::ignoreNewMailInFolder(const Akonadi::Collection &collection)
366 {
367  if ( collection.hasAttribute<NewMailNotifierAttribute>() ) {
368  if (collection.attribute<NewMailNotifierAttribute>()->ignoreNewMail()) {
369  return true;
370  }
371  }
372  return false;
373 }
374 
375 Akonadi::Collection MailCommon::Util::parentCollectionFromItem( const Akonadi::Item &item )
376 {
377  return updatedCollection(item.parentCollection());
378 }
379 
380 QString MailCommon::Util::realFolderPath( const QString &path )
381 {
382  QString realPath( path );
383  realPath.remove( QLatin1String(".directory") );
384  realPath.replace( QLatin1String("/."), QLatin1String("/") );
385  if ( !realPath.isEmpty() && ( realPath.at( 0 ) == QLatin1Char('.') ) ) {
386  realPath.remove( 0, 1 ); //remove first "."
387  }
388  return realPath;
389 }
390 
391 QColor MailCommon::Util::defaultQuotaColor()
392 {
393  KColorScheme scheme( QPalette::Active, KColorScheme::View );
394  return scheme.foreground( KColorScheme::NegativeText ).color();
395 }
396 
397 void MailCommon::Util::expireOldMessages( const Akonadi::Collection &collection, bool immediate )
398 {
399  ScheduledExpireTask *task = new ScheduledExpireTask( collection, immediate );
400  KernelIf->jobScheduler()->registerTask( task );
401 }
402 
403 Akonadi::Collection MailCommon::Util::updatedCollection( const Akonadi::Collection& col )
404 {
405  const QModelIndex idx = Akonadi::EntityTreeModel::modelIndexForCollection( KernelIf->collectionModel(), col );
406  const Akonadi::Collection collection = idx.data( Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>();
407  return collection;
408 }
409 
410 Akonadi::Collection::Id MailCommon::Util::convertFolderPathToCollectionId( const QString& folder)
411 {
412  Akonadi::Collection::Id newFolderId=-1;
413  bool exactPath = false;
414  Akonadi::Collection::List lst = FilterActionMissingCollectionDialog::potentialCorrectFolders( folder, exactPath );
415  if ( lst.count() == 1 && exactPath )
416  newFolderId = lst.at( 0 ).id();
417  else {
418  QPointer<FilterActionMissingCollectionDialog> dlg = new FilterActionMissingCollectionDialog( lst, QString(), folder );
419  if ( dlg->exec() ) {
420  newFolderId = dlg->selectedCollection().id();
421  }
422  delete dlg;
423  }
424  return newFolderId;
425 }
426 
427 QString MailCommon::Util::convertFolderPathToCollectionStr( const QString& folder)
428 {
429  Akonadi::Collection::Id newFolderId= MailCommon::Util::convertFolderPathToCollectionId(folder);
430  if (newFolderId == -1 )
431  return QString();
432  return QString::number(newFolderId);
433 }
434 
435 bool MailCommon::Util::foundMailer()
436 {
437  QStringList lst;
438  lst << MailImporter::FilterEvolution::defaultSettingsPath();
439  lst << MailImporter::FilterEvolution_v2::defaultSettingsPath();
440  lst << MailImporter::FilterEvolution_v3::defaultSettingsPath();
441  lst << MailImporter::FilterBalsa::defaultSettingsPath();
442  lst << MailImporter::FilterClawsMail::defaultSettingsPath();
443  lst << MailImporter::FilterOpera::defaultSettingsPath();
444  lst << MailImporter::FilterSylpheed::defaultSettingsPath();
445  lst << MailImporter::FilterThunderbird::defaultSettingsPath();
446  lst << MailImporter::OtherMailerUtil::trojitaDefaultPath();
447  lst << MailImporter::FilterIcedove::defaultSettingsPath();
448 
449  Q_FOREACH(const QString& path, lst) {
450  QDir directory( path );
451  if ( directory.exists() ) {
452  return true;
453  }
454  }
455  return false;
456 }
457 
458 MailCommon::ExpireCollectionAttribute *MailCommon::Util::expirationCollectionAttribute(const Akonadi::Collection &collection, bool &mustDeleteExpirationAttribute )
459 {
460  MailCommon::ExpireCollectionAttribute *attr = 0;
461  if ( collection.hasAttribute<MailCommon::ExpireCollectionAttribute>() ) {
462  attr = collection.attribute<MailCommon::ExpireCollectionAttribute>();
463  mustDeleteExpirationAttribute = false;
464  } else {
465  attr = new MailCommon::ExpireCollectionAttribute();
466  KConfigGroup configGroup( KernelIf->config(),
467  MailCommon::FolderCollection::configGroupName( collection ) );
468 
469  if ( configGroup.hasKey( "ExpireMessages" ) ) {
470  attr->setAutoExpire(configGroup.readEntry( "ExpireMessages", false ));
471  attr->setReadExpireAge(configGroup.readEntry( "ReadExpireAge", 3 ));
472  attr->setReadExpireUnits((MailCommon::ExpireCollectionAttribute::ExpireUnits)configGroup.readEntry( "ReadExpireUnits", (int)MailCommon::ExpireCollectionAttribute::ExpireMonths ));
473  attr->setUnreadExpireAge(configGroup.readEntry( "UnreadExpireAge", 12 ));
474  attr->setUnreadExpireUnits((MailCommon::ExpireCollectionAttribute::ExpireUnits)configGroup.readEntry( "UnreadExpireUnits", (int)MailCommon::ExpireCollectionAttribute::ExpireNever ));
475  attr->setExpireAction(configGroup.readEntry( "ExpireAction", "Delete" ) == QLatin1String( "Move" ) ?
476  MailCommon::ExpireCollectionAttribute::ExpireMove :
477  MailCommon::ExpireCollectionAttribute::ExpireDelete);
478  attr->setExpireToFolderId(configGroup.readEntry( "ExpireToFolder", -1 ));
479  }
480 
481  mustDeleteExpirationAttribute = true;
482  }
483  return attr;
484 }
485 
MailCommon::Util::ignoreNewMailInFolder
MAILCOMMON_EXPORT bool ignoreNewMailInFolder(const Akonadi::Collection &collection)
Definition: mailutil.cpp:365
MailCommon::Util::defaultQuotaColor
MAILCOMMON_EXPORT QColor defaultQuotaColor()
Definition: mailutil.cpp:391
expirecollectionattribute.h
QModelIndex
MailCommon::Util::agentInstances
MAILCOMMON_EXPORT Akonadi::AgentInstance::List agentInstances(bool excludeMailTransport=true)
Definition: mailutil.cpp:147
QAbstractItemModel::rowCount
virtual int rowCount(const QModelIndex &parent) const =0
QDBusAbstractInterface::isValid
bool isValid() const
foldercollection.h
KernelIf
#define KernelIf
Definition: mailkernel.h:191
QAbstractItemModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const =0
QEventLoop
MailCommon::ExpireCollectionAttribute::ExpireMonths
Definition: expirecollectionattribute.h:43
QDBusReply
MailCommon::ExpireCollectionAttribute::setUnreadExpireUnits
void setUnreadExpireUnits(ExpireUnits units)
Sets the units to use for expiry of unread messages.
Definition: expirecollectionattribute.cpp:79
expirejob.h
indexAbove
static QModelIndex indexAbove(QAbstractItemModel *model, const QModelIndex &current)
Definition: mailutil.cpp:310
QProcess::startDetached
bool startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
QPointer
MailCommon::ExpireCollectionAttribute::setReadExpireUnits
void setReadExpireUnits(ExpireUnits units)
Sets the units to use for expiry of read messages.
Definition: expirecollectionattribute.cpp:98
MailCommon::Util::isLocalCollection
MAILCOMMON_EXPORT bool isLocalCollection(const QString &resource)
Definition: mailutil.cpp:107
MailCommon::Util::expirationCollectionAttribute
MAILCOMMON_EXPORT MailCommon::ExpireCollectionAttribute * expirationCollectionAttribute(const Akonadi::Collection &collection, bool &mustDeleteExpirationAttribute)
Definition: mailutil.cpp:458
filteractionmissingargumentdialog.h
QDBusError::message
QString message() const
QVariant::value
T value() const
QDBusReply::isValid
bool isValid() const
QDBusConnection::sessionBus
QDBusConnection sessionBus()
MailCommon::ExpireCollectionAttribute
Definition: expirecollectionattribute.h:29
MailCommon::Util::isVirtualCollection
MAILCOMMON_EXPORT bool isVirtualCollection(const Akonadi::Collection &col)
Definition: mailutil.cpp:97
MailCommon::ExpireCollectionAttribute::ExpireMove
Definition: expirecollectionattribute.h:49
QString::remove
QString & remove(int position, int n)
id
SearchRule::Function id
Definition: daterulewidgethandler.cpp:34
QDBusAbstractInterface::call
QDBusMessage call(const QString &method, const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8)
MailCommon::ExpireCollectionAttribute::setAutoExpire
void setAutoExpire(bool enabled)
Sets whether this folder automatically expires messages.
Definition: expirecollectionattribute.cpp:57
MailCommon::ScheduledExpireTask
A scheduled "expire mails in this folder" task.
Definition: expirejob.h:70
newmailnotifierattribute.h
QModelIndex::isValid
bool isValid() const
MailCommon::Util::SearchDirection
SearchDirection
Describes the direction for searching next unread collection.
Definition: mailutil.h:88
QString::number
QString number(int n, int base)
QDir::exists
bool exists() const
QSharedPointer
Definition: collectiongeneralpage.h:30
QEventLoop::exec
int exec(QFlags< QEventLoop::ProcessEventsFlag > flags)
QDBusReply::value
Type value() const
FilterActionMissingCollectionDialog
Definition: filteractionmissingargumentdialog.h:49
QString::isEmpty
bool isEmpty() const
QModelIndex::row
int row() const
MailCommon::Util::ForwardSearch
Definition: mailutil.h:89
MailCommon::Util::updatedCollection
MAILCOMMON_EXPORT Akonadi::Collection updatedCollection(const Akonadi::Collection &col)
Definition: mailutil.cpp:403
QString
QColor
QModelIndex::parent
QModelIndex parent() const
MailCommon::Util::parentCollectionFromItem
MAILCOMMON_EXPORT Akonadi::Collection parentCollectionFromItem(const Akonadi::Item &item)
Definition: mailutil.cpp:375
MailCommon::Util::convertFolderPathToCollectionId
MAILCOMMON_EXPORT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &folder)
Definition: mailutil.cpp:410
indexBelow
static QModelIndex indexBelow(QAbstractItemModel *model, const QModelIndex &current)
Definition: mailutil.cpp:256
QStringList
QDBusInterface
QAbstractItemModel::parent
virtual QModelIndex parent(const QModelIndex &index) const =0
MailCommon::ExpireCollectionAttribute::ExpireNever
Definition: expirecollectionattribute.h:40
QString::contains
bool contains(QChar ch, Qt::CaseSensitivity cs) const
MailCommon::Util::BackwardSearch
Definition: mailutil.h:90
QLatin1Char
lastChildOfModel
static QModelIndex lastChildOfModel(QAbstractItemModel *model, const QModelIndex &current)
Definition: mailutil.cpp:301
MailCommon::FolderCollection::configGroupName
static QString configGroupName(const Akonadi::Collection &col)
Definition: foldercollection.cpp:174
QDir
QString::replace
QString & replace(int position, int n, QChar after)
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:240
MailCommon::Util::showJobErrorMessage
MAILCOMMON_EXPORT bool showJobErrorMessage(KJob *job)
Definition: mailutil.cpp:134
MailCommon::ExpireCollectionAttribute::ExpireDelete
Definition: expirecollectionattribute.h:48
MailCommon::ExpireCollectionAttribute::ExpireUnits
ExpireUnits
Definition: expirecollectionattribute.h:39
QModelIndex::data
QVariant data(int role) const
MailCommon::NewMailNotifierAttribute
Definition: newmailnotifierattribute.h:27
QLatin1String
mailkernel.h
MailCommon::Util::fullCollectionPath
MAILCOMMON_EXPORT QString fullCollectionPath(const Akonadi::Collection &collection)
Definition: mailutil.cpp:115
QModelIndex::sibling
QModelIndex sibling(int row, int column) const
QString::at
const QChar at(int position) const
MailCommon::Util::convertFolderPathToCollectionStr
MAILCOMMON_EXPORT QString convertFolderPathToCollectionStr(const QString &folder)
Definition: mailutil.cpp:427
QAbstractItemModel
MailCommon::ExpireCollectionAttribute::setReadExpireAge
void setReadExpireAge(int age)
Sets the maximum age for read messages in this folder.
Definition: expirecollectionattribute.cpp:86
MailCommon::ExpireCollectionAttribute::setExpireToFolderId
void setExpireToFolderId(Akonadi::Collection::Id id)
Definition: expirecollectionattribute.cpp:115
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:327
MailCommon::NewMailNotifierAttribute::ignoreNewMail
bool ignoreNewMail() const
Definition: newmailnotifierattribute.cpp:74
MailCommon::ExpireCollectionAttribute::setExpireAction
void setExpireAction(ExpireAction a)
Definition: expirecollectionattribute.cpp:105
MailCommon::Util::expireOldMessages
MAILCOMMON_EXPORT void expireOldMessages(const Akonadi::Collection &collection, bool immediate)
Definition: mailutil.cpp:397
QDBusAbstractInterface::lastError
QDBusError lastError() const
MailCommon::Util::foundMailer
MAILCOMMON_EXPORT bool foundMailer()
Definition: mailutil.cpp:435
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
MailCommon::Util::realFolderPath
MAILCOMMON_EXPORT QString realFolderPath(const QString &path)
Definition: mailutil.cpp:380
QVariant::toString
QString toString() const
MailCommon::ExpireCollectionAttribute::setUnreadExpireAge
void setUnreadExpireAge(int age)
Sets the maximum age for unread messages in this folder.
Definition: expirecollectionattribute.cpp:67
mailutil.h
MailCommon::Util::ensureKorganizerRunning
MAILCOMMON_EXPORT bool ensureKorganizerRunning(bool switchTo)
Definition: mailutil.cpp:168
FilterActionMissingCollectionDialog::potentialCorrectFolders
static Akonadi::Collection::List potentialCorrectFolders(const QString &path, bool &exactPath)
Definition: filteractionmissingargumentdialog.cpp:166
QDBusServiceWatcher
MailCommon::Util::createPop3SettingsInterface
MAILCOMMON_EXPORT OrgKdeAkonadiPOP3SettingsInterface * createPop3SettingsInterface(const QString &ident)
Definition: mailutil.cpp:89
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:40 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
  • pimprint

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