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

kmail

KMail::ImapAccountBase

KMail::ImapAccountBase Class Reference

#include <imapaccountbase.h>

Inheritance diagram for KMail::ImapAccountBase:

Inheritance graph
[legend]

List of all members.


Detailed Description

Definition at line 63 of file imapaccountbase.h.


Public Types

enum  ConnectionState { Error = 0, Connected, Connecting }
enum  imapNamespace { PersonalNS = 0, OtherUsersNS = 1, SharedNS = 2 }
typedef QMap< KJob *, jobData >
::Iterator 
JobIterator
enum  ListType {
  List, ListSubscribed, ListSubscribedNoCheck, ListFolderOnly,
  ListFolderOnlySubscribed
}
typedef QMap< QString, QString > namespaceDelim
typedef QMap< imapNamespace,
namespaceDelim > 
nsDelimMap
typedef QMap< imapNamespace,
QStringList > 
nsMap

Public Slots

void getNamespaces ()

Signals

void connectionResult (int errorCode, const QString &errorMsg)
void imapStatusChanged (KMFolder *, const QString &imapPath, bool cont)
void namespacesFetched ()
void namespacesFetched (const ImapAccountBase::nsDelimMap &)
void receivedACL (KMFolder *folder, KIO::Job *job, const KMail::ACLList &entries)
void receivedStorageQuotaInfo (KMFolder *folder, KIO::Job *job, const KMail::QuotaInfo &entries)
void receivedUserRights (KMFolder *folder)
void subscriptionChanged (const QString &imapPath, bool subscribed)

Public Member Functions

QString addPathToNamespace (const QString &ns)
bool autoExpunge () const
virtual void cancelMailCheck ()
void changeLocalSubscription (const QString &imapPath, bool subscribe)
void changeSubscription (bool subscribe, const QString &imapPath)
bool checkingMail ()
bool checkingMail (KMFolder *folder)
bool checkingSingleFolder ()
QString createImapPath (const QString &parent, const QString &folderName)
QString createImapPath (FolderStorage *parent, const QString &folderName)
QString delimiterForFolder (FolderStorage *)
QString delimiterForNamespace (const QString &prefix)
JobIterator findJob (KJob *job)
virtual unsigned int folderCount () const
void getACL (KMFolder *folder, const QString &imapPath)
void getStorageQuotaInfo (KMFolder *folder, const QString &imapPath)
void getUserRights (KMFolder *folder, const QString &imapPath)
void handleBodyStructure (QDataStream &stream, KMMessage *msg, const AttachmentStrategy *as)
bool handleJobError (KIO::Job *job, const QString &context, bool abortSync=false)
bool hasACLSupport () const
bool hasAnnotationSupport () const
bool hasCapability (const QString &capa)
bool hasQuotaSupport () const
bool hiddenFolders () const
virtual void init ()
void insertJob (KJob *job, const jobData &data)
bool isNamespaceFolder (QString &name)
JobIterator jobsEnd ()
void killAllJobs (bool disconnectSlave=false)=0
KPIM::ProgressItem * listDirProgressItem ()
bool listOnlyOpenFolders () const
bool loadOnDemand () const
bool locallySubscribedTo (const QString &imapPath)
ConnectionState makeConnection ()
QString namespaceForFolder (FolderStorage *)
nsMap namespaces () const
nsDelimMap namespacesWithDelimiter ()
namespaceDelim namespaceToDelimiter () const
bool onlyLocallySubscribedFolders () const
bool onlySubscribedFolders () const
void postProcessNewMail (bool setStatusMsg=true)
void processNewMailSingleFolder (KMFolder *folder)
virtual void pseudoAssign (const KMAccount *a)
virtual void readConfig (KConfigGroup &config)
void removeJob (KIO::Job *job)
void removeJob (JobIterator &it)
virtual FolderStorage * rootFolder () const =0
virtual void setAutoExpunge (bool expunge)
virtual void setFolder (KMFolder *, bool addAccount=false)
void setHasNoAnnotationSupport ()
void setHasNoQuotaSupport ()
virtual void setHiddenFolders (bool show)
void setImapSeenStatus (KMFolder *folder, const QString &path, bool seen)
void setImapStatus (KMFolder *folder, const QString &path, const QByteArray &flags)
virtual void setListOnlyOpenFolders (bool only)
virtual void setLoadOnDemand (bool load)
virtual void setNamespaces (nsMap map)
void setNamespaceToDelimiter (namespaceDelim map)
virtual void setOnlyLocallySubscribedFolders (bool show)
virtual void setOnlySubscribedFolders (bool show)
virtual KIO::MetaData slaveConfig () const
void slaveDied ()
virtual void writeConfig (KConfigGroup &config)
virtual ~ImapAccountBase ()

Protected Slots

void slotAbortRequested (KPIM::ProgressItem *)
void slotCapabilitiesResult (KJob *, const QString &result, const QString &)
virtual void slotCheckQueuedFolders ()
void slotGetACLResult (KJob *_job)
void slotGetStorageQuotaInfoResult (KJob *_job)
void slotGetUserRightsResult (KJob *_job)
void slotIdleTimeout ()
void slotNamespaceResult (KJob *, const QString &str, const QString &)
void slotNoopTimeout ()
void slotSaveNamespaces (const ImapAccountBase::nsDelimMap &map)
void slotSchedulerSlaveConnected (KIO::Slave *aSlave)
void slotSchedulerSlaveError (KIO::Slave *aSlave, int, const QString &errorMsg)
void slotSetStatusResult (KJob *job)
void slotSimpleResult (KJob *job)

Protected Member Functions

void constructParts (QDataStream &stream, int count, KMMessagePart *parentKMPart, DwBodyPart *parent, const DwMessage *dwmsg)
virtual unsigned short int defaultPort () const
virtual bool handleError (int error, const QString &errorMsg, KIO::Job *job, const QString &context, bool abortSync=false)
bool handlePutError (KIO::Job *job, jobData &jd, KMFolder *folder)
 ImapAccountBase (AccountManager *parent, const QString &name, uint id)
void localBlacklistFromStringList (const QStringList &)
QStringList locallyBlacklistedFolders () const
void migratePrefix ()
QString prettifyQuotaError (const QString &_error, KIO::Job *job)
virtual QString protocol () const

Protected Attributes

bool mACLSupport: 1
bool mAnnotationSupport: 1
QMap< KJob *, jobData > mapJobData
bool mAutoExpunge: 1
QList< KMMessagePart * > mBodyPartList
QStringList mCapabilities
bool mCheckingSingleFolder: 1
int mCountLastUnread
int mCountUnread
KMMessage * mCurrentMsg
bool mErrorDialogIsActive: 1
QList< QPointer< KMFolder > > mFoldersQueuedForChecking
bool mHiddenFolders: 1
QTimer mIdleTimer
QPointer< KPIM::ProgressItem > mListDirProgressItem
bool mListOnlyOpenFolders: 1
bool mLoadOnDemand: 1
std::set< QString > mLocalSubscriptionBlackList
QList< QPointer< KMFolder > > mMailCheckFolders
nsMap mNamespaces
namespaceDelim mNamespaceToDelimiter
QTimer mNoopTimer
QString mOldPrefix
bool mOnlyLocallySubscribedFolders: 1
bool mOnlySubscribedFolders: 1
QList< QPointer< KMFolder > * > mOpenFolders
bool mPasswordDialogIsActive: 1
bool mPasswordEnteredAndEmpty: 1
bool mProgressEnabled: 1
bool mQuotaSupport: 1
bool mSlaveConnected: 1
bool mSlaveConnectionError: 1
QStringList mSubfolderAttributes
QStringList mSubfolderMimeTypes
QStringList mSubfolderNames
QStringList mSubfolderPaths
int mTotal
QMap< QString, int > mUnreadBeforeCheck

Classes

struct  jobData
 Info Data for the Job. More...

Member Typedef Documentation

typedef QMap<KJob *, jobData>::Iterator KMail::ImapAccountBase::JobIterator

Definition at line 170 of file imapaccountbase.h.

typedef QMap<QString, QString> KMail::ImapAccountBase::namespaceDelim

Definition at line 137 of file imapaccountbase.h.

typedef QMap<imapNamespace, namespaceDelim> KMail::ImapAccountBase::nsDelimMap

Definition at line 140 of file imapaccountbase.h.

typedef QMap<imapNamespace, QStringList> KMail::ImapAccountBase::nsMap

Definition at line 134 of file imapaccountbase.h.


Member Enumeration Documentation

enum KMail::ImapAccountBase::ConnectionState

The state of the kioslave connection.

Enumerator:
Error 
Connected 
Connecting 

Definition at line 111 of file imapaccountbase.h.

enum KMail::ImapAccountBase::imapNamespace

Enumerator:
PersonalNS 
OtherUsersNS 
SharedNS 

Definition at line 131 of file imapaccountbase.h.

enum KMail::ImapAccountBase::ListType

Enumerator:
List 
ListSubscribed 
ListSubscribedNoCheck 
ListFolderOnly 
ListFolderOnlySubscribed 

Definition at line 114 of file imapaccountbase.h.


Constructor & Destructor Documentation

KMail::ImapAccountBase::ImapAccountBase ( AccountManager *  parent,
const QString &  name,
uint  id 
) [protected]

Definition at line 79 of file imapaccountbase.cpp.

KMail::ImapAccountBase::~ImapAccountBase (  )  [virtual]

Definition at line 111 of file imapaccountbase.cpp.


Member Function Documentation

QString KMail::ImapAccountBase::addPathToNamespace ( const QString &  ns  ) 

Adds "/" as needed to the given namespace.

Definition at line 1408 of file imapaccountbase.cpp.

bool KMail::ImapAccountBase::autoExpunge (  )  const [inline]

Returns:
whether to automatically expunge deleted messages when leaving the folder

Definition at line 78 of file imapaccountbase.h.

void KMail::ImapAccountBase::cancelMailCheck (  )  [virtual]

Abort all running mail checks.

Used when exiting.

Reimplemented from KMAccount.

Reimplemented in KMAcctCachedImap, and KMAcctImap.

Definition at line 1090 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::changeLocalSubscription ( const QString &  imapPath,
bool  subscribe 
)

Locally subscribe (subscribe = TRUE) / Unsubscribe the folder identified by imapPath.

Definition at line 1505 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::changeSubscription ( bool  subscribe,
const QString &  imapPath 
)

Subscribe (subscribe = true) / Unsubscribe the folder identified by imapPath.

Emits subscriptionChanged signal on success.

Definition at line 391 of file imapaccountbase.cpp.

bool KMail::ImapAccountBase::checkingMail (  )  [inline]

Set/Get if this account is currently checking mail.

Reimplemented from KMAccount.

Definition at line 280 of file imapaccountbase.h.

bool KMail::ImapAccountBase::checkingMail ( KMFolder *  folder  ) 

Check whether we're checking for new mail and the folder is included.

Definition at line 1153 of file imapaccountbase.cpp.

bool KMail::ImapAccountBase::checkingSingleFolder (  )  [inline]

Return true if we are processing a mailcheck for a single folder.

Definition at line 266 of file imapaccountbase.h.

void KMail::ImapAccountBase::connectionResult ( int  errorCode,
const QString &  errorMsg 
) [signal]

Emitted when the slave managed or failed to connect This is always emitted at some point after makeConnection returned Connecting.

Parameters:
errorCode 0 for success, != 0 in case of error
errorMsg if errorCode is != 0, this goes with errorCode to call KIO::buildErrorString

void KMail::ImapAccountBase::constructParts ( QDataStream &  stream,
int  count,
KMMessagePart *  parentKMPart,
DwBodyPart *  parent,
const DwMessage *  dwmsg 
) [protected]

Build KMMessageParts and DwBodyParts from the bodystructure-stream.

Definition at line 1230 of file imapaccountbase.cpp.

QString KMail::ImapAccountBase::createImapPath ( const QString &  parent,
const QString &  folderName 
)

Create an IMAP path for a parent imapPath and a folderName.

Definition at line 1456 of file imapaccountbase.cpp.

QString KMail::ImapAccountBase::createImapPath ( FolderStorage *  parent,
const QString &  folderName 
)

Create an IMAP path for a parent folder and a foldername Parent and folder are separated with the delimiter of the account The path starts and ends with '/'.

Definition at line 1484 of file imapaccountbase.cpp.

unsigned short int KMail::ImapAccountBase::defaultPort (  )  const [protected, virtual]

Implements KMail::NetworkAccount.

Definition at line 149 of file imapaccountbase.cpp.

QString KMail::ImapAccountBase::delimiterForFolder ( FolderStorage *  storage  ) 

Returns:
the delimiter for the folderstorage

Definition at line 900 of file imapaccountbase.cpp.

QString KMail::ImapAccountBase::delimiterForNamespace ( const QString &  prefix  ) 

Returns:
the delimiter for the namespace

Definition at line 870 of file imapaccountbase.cpp.

JobIterator KMail::ImapAccountBase::findJob ( KJob *  job  )  [inline]

Look for the jobData related to a given job.

Compare with end()

Definition at line 180 of file imapaccountbase.h.

unsigned int KMail::ImapAccountBase::folderCount (  )  const [virtual]

Returns:
the number of (subscribed, if applicable) folders in this account.

Definition at line 1399 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::getACL ( KMFolder *  folder,
const QString &  imapPath 
)

Retrieve the complete list of ACLs on the folder identified by imapPath.

Emits receivedACL signal on success/error.

Definition at line 517 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::getNamespaces (  )  [slot]

Call this to get the namespaces You are notified by the signal namespacesFetched.

Definition at line 682 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::getStorageQuotaInfo ( KMFolder *  folder,
const QString &  imapPath 
)

Retrieve the quota information on the folder identified by imapPath.

Emits receivedQuotaInfo signal on success/error.

Definition at line 548 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::getUserRights ( KMFolder *  folder,
const QString &  imapPath 
)

Retrieve the users' right on the folder identified by folder and imapPath.

Emits receivedUserRights signal on success/error.

Definition at line 449 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::handleBodyStructure ( QDataStream &  stream,
KMMessage *  msg,
const AttachmentStrategy *  as 
)

Handles the result from a BODYSTRUCTURE fetch.

Definition at line 1162 of file imapaccountbase.cpp.

bool KMail::ImapAccountBase::handleError ( int  error,
const QString &  errorMsg,
KIO::Job *  job,
const QString &  context,
bool  abortSync = false 
) [protected, virtual]

Handle an error coming from a KIO job or from a KIO slave (via the scheduler) and abort everything (in all cases) if abortSync is true [this is for slotSchedulerSlaveError].

Otherwise (abortSync==false), dimap will only abort in case of severe errors (connection broken), but on "normal" errors (no permission to delete, etc.) it will ask the user.

Parameters:
error the error code, usually job->error())
errorMsg the error message, usually job->errorText()
job the kio job (can be 0). If set, removeJob will be called automatically. This is important! It means you should not call removeJob yourself in case of errors. We can't let the caller do that, since it should only be done afterwards, and only if we didn't abort.
context a sentence that gives some context to the error, e.g. i18n("Error while uploading message [...]")
abortSync if true, abort sync in all cases (see above). If false, ask the user (when possible).
Returns:
false when aborting, true when continuing

Reimplemented in KMAcctImap.

Definition at line 989 of file imapaccountbase.cpp.

bool KMail::ImapAccountBase::handleJobError ( KIO::Job *  job,
const QString &  context,
bool  abortSync = false 
)

React to an error from the job.

Uses job->error and job->errorString and calls the protected virtual handleJobError with them. See handleError below for details.

Definition at line 360 of file imapaccountbase.cpp.

bool KMail::ImapAccountBase::handlePutError ( KIO::Job *  job,
jobData &  jd,
KMFolder *  folder 
) [protected]

Handle an error during KIO::put - helper method.

Definition at line 937 of file imapaccountbase.cpp.

bool KMail::ImapAccountBase::hasACLSupport (  )  const [inline]

Returns false if the IMAP server for this account doesn't support ACLs.

(and true if it does, or if we didn't try yet).

Definition at line 297 of file imapaccountbase.h.

bool KMail::ImapAccountBase::hasAnnotationSupport (  )  const [inline]

Returns false if the IMAP server for this account doesn't support annotations.

(and true if it does, or if we didn't try yet).

Definition at line 303 of file imapaccountbase.h.

bool KMail::ImapAccountBase::hasCapability ( const QString &  capa  )  [inline]

Returns true if the account has the given capability.

Definition at line 400 of file imapaccountbase.h.

bool KMail::ImapAccountBase::hasQuotaSupport (  )  const [inline]

Returns false if the IMAP server for this account doesn't support quotas.

(and true if it does, or if we didn't try yet).

Definition at line 314 of file imapaccountbase.h.

bool KMail::ImapAccountBase::hiddenFolders (  )  const [inline]

Returns:
whether to show hidden files on the server

Definition at line 82 of file imapaccountbase.h.

void KMail::ImapAccountBase::imapStatusChanged ( KMFolder *  ,
const QString &  imapPath,
bool  cont 
) [signal]

Emitted upon completion of the job for setting the status for a group of UIDs, as a result of a setImapStatus call.

On error, if the user chooses abort (not continue), cont is set to false.

void KMail::ImapAccountBase::init ( void   )  [virtual]

Set the config options to a decent state.

Reimplemented from KMail::NetworkAccount.

Reimplemented in KMAcctCachedImap.

Definition at line 118 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::insertJob ( KJob *  job,
const jobData &  data 
) [inline]

Call this when starting a new job.

Definition at line 174 of file imapaccountbase.h.

bool KMail::ImapAccountBase::isNamespaceFolder ( QString &  name  ) 

Returns true if the given string is a namespace.

Definition at line 1422 of file imapaccountbase.cpp.

JobIterator KMail::ImapAccountBase::jobsEnd (  )  [inline]

Definition at line 181 of file imapaccountbase.h.

void KMail::ImapAccountBase::killAllJobs ( bool  disconnectSlave = false  )  [pure virtual]

Kill the slave if any jobs are active.

Implements KMail::NetworkAccount.

Implemented in KMAcctCachedImap, and KMAcctImap.

KPIM::ProgressItem * KMail::ImapAccountBase::listDirProgressItem (  ) 

Progress item for listDir.

Definition at line 1376 of file imapaccountbase.cpp.

bool KMail::ImapAccountBase::listOnlyOpenFolders (  )  const [inline]

Returns:
whether to list only open folders

Definition at line 99 of file imapaccountbase.h.

bool KMail::ImapAccountBase::loadOnDemand (  )  const [inline]

Returns:
whether to load attachments on demand

Definition at line 95 of file imapaccountbase.h.

void KMail::ImapAccountBase::localBlacklistFromStringList ( const QStringList &  list  )  [protected]

Definition at line 1531 of file imapaccountbase.cpp.

QStringList KMail::ImapAccountBase::locallyBlacklistedFolders (  )  const [protected]

Definition at line 1520 of file imapaccountbase.cpp.

bool KMail::ImapAccountBase::locallySubscribedTo ( const QString &  imapPath  ) 

Returns whether the account is locally subscribed to the folder.

Parameters:
imapPath. No relation to server side subscription above.

Definition at line 1500 of file imapaccountbase.cpp.

ImapAccountBase::ConnectionState KMail::ImapAccountBase::makeConnection (  ) 

Connect to the server, if no connection is active Returns Connected (ok), Error (ko) or Connecting - which means that one should wait for the slaveConnected signal from KIO::Scheduler before proceeding.

Reimplemented in KMAcctImap.

Definition at line 288 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::migratePrefix (  )  [protected]

Migrate the prefix.

Definition at line 777 of file imapaccountbase.cpp.

QString KMail::ImapAccountBase::namespaceForFolder ( FolderStorage *  storage  ) 

Returns:
the namespace for the folder

Definition at line 842 of file imapaccountbase.cpp.

nsMap KMail::ImapAccountBase::namespaces (  )  const [inline]

Returns:
defined namespaces

Definition at line 346 of file imapaccountbase.h.

void KMail::ImapAccountBase::namespacesFetched (  )  [signal]

Emitted when we got the namespaces, and they were set on the object.

void KMail::ImapAccountBase::namespacesFetched ( const ImapAccountBase::nsDelimMap &   )  [signal]

Emitted when we got the namespaces.

ImapAccountBase::nsDelimMap KMail::ImapAccountBase::namespacesWithDelimiter (  ) 

Full blown section - namespace - delimiter map Do not call this very often as the map is constructed on the fly.

Definition at line 1438 of file imapaccountbase.cpp.

namespaceDelim KMail::ImapAccountBase::namespaceToDelimiter (  )  const [inline]

Returns:
the namespace - delimiter map

Definition at line 383 of file imapaccountbase.h.

bool KMail::ImapAccountBase::onlyLocallySubscribedFolders (  )  const [inline]

Returns:
whether to show only locally subscribed folders

Definition at line 90 of file imapaccountbase.h.

bool KMail::ImapAccountBase::onlySubscribedFolders (  )