kmail

KMail::ImapAccountBase Class Reference

Inheritance diagram for KMail::ImapAccountBase:

KMail::NetworkAccount KMAccount KMAcctCachedImap KMAcctImap List of all members.

Detailed Description

Definition at line 56 of file imapaccountbase.h.


Public Types

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

Public Slots

void getNamespaces ()

Signals

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

Public Member Functions

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

Protected Slots

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

Protected Member Functions

 ImapAccountBase (AccountManager *parent, const QString &name, uint id)
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)
virtual QString protocol () const
virtual unsigned short int defaultPort () const
void constructParts (QDataStream &stream, int count, KMMessagePart *parentKMPart, DwBodyPart *parent, const DwMessage *dwmsg)
void migratePrefix ()

Protected Attributes

QPtrList< QGuardedPtr< KMFolder > > mOpenFolders
QStringList mSubfolderNames
QStringList mSubfolderPaths
QStringList mSubfolderMimeTypes
QStringList mSubfolderAttributes
QMap< KIO::Job *, jobDatamapJobData
QTimer mIdleTimer
QTimer mNoopTimer
int mTotal
int mCountUnread
int mCountLastUnread
QMap< QString, int > mUnreadBeforeCheck
bool mAutoExpunge: 1
bool mHiddenFolders: 1
bool mOnlySubscribedFolders: 1
bool mLoadOnDemand: 1
bool mListOnlyOpenFolders: 1
bool mProgressEnabled: 1
bool mErrorDialogIsActive: 1
bool mPasswordDialogIsActive: 1
bool mACLSupport: 1
bool mAnnotationSupport: 1
bool mSlaveConnected: 1
bool mSlaveConnectionError: 1
bool mCheckingSingleFolder: 1
QValueList< QGuardedPtr< KMFolder > > mMailCheckFolders
QValueList< QGuardedPtr< KMFolder > > mFoldersQueuedForChecking
QPtrList< KMMessagePartmBodyPartList
KMMessagemCurrentMsg
QGuardedPtr< KPIM::ProgressItem > mListDirProgressItem
nsMap mNamespaces
namespaceDelim mNamespaceToDelimiter
QString mOldPrefix
QStringList mCapabilities

Classes

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

Member Enumeration Documentation

enum KMail::ImapAccountBase::ConnectionState
 

The state of the kioslave connection.

Definition at line 99 of file imapaccountbase.h.


Member Function Documentation

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

Adds "/" as needed to the given namespace.

Definition at line 1219 of file imapaccountbase.cpp.

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

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

Definition at line 71 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 920 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 345 of file imapaccountbase.cpp.

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

Set/Get if this account is currently checking mail.

Reimplemented from KMAccount.

Definition at line 245 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 985 of file imapaccountbase.cpp.

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

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

Definition at line 231 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 1062 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 1269 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 1297 of file imapaccountbase.cpp.

QString KMail::ImapAccountBase::delimiterForFolder FolderStorage  ) 
 

Returns:
the delimiter for the folderstorage

Definition at line 790 of file imapaccountbase.cpp.

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

Returns:
the delimiter for the namespace

Definition at line 759 of file imapaccountbase.cpp.

JobIterator KMail::ImapAccountBase::findJob KIO::Job *  job  )  [inline]
 

Look for the jobData related to a given job.

Compare with end()

Definition at line 171 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 1211 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 451 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 570 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 396 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 993 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 843 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 315 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 824 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 262 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 268 of file imapaccountbase.h.

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

Returns true if the account has the given capability.

Definition at line 354 of file imapaccountbase.h.

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

Returns:
whether to show hidden files on the server

Definition at line 75 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  )  [virtual]
 

Set the config options to a decent state.

Reimplemented from KMail::NetworkAccount.

Reimplemented in KMAcctCachedImap.

Definition at line 117 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::insertJob KIO::Job *  job,
const jobData data
[inline]
 

Call this when starting a new job.

Definition at line 165 of file imapaccountbase.h.

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

Returns true if the given string is a namespace.

Definition at line 1233 of file imapaccountbase.cpp.

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 1187 of file imapaccountbase.cpp.

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

Returns:
whether to list only open folders

Definition at line 87 of file imapaccountbase.h.

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

Returns:
whether to load attachments on demand

Definition at line 83 of file imapaccountbase.h.

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 257 of file imapaccountbase.cpp.

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

Migrate the prefix.

Definition at line 663 of file imapaccountbase.cpp.

QString KMail::ImapAccountBase::namespaceForFolder FolderStorage  ) 
 

Returns:
the namespace for the folder

Definition at line 729 of file imapaccountbase.cpp.

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

Returns:
defined namespaces

Definition at line 300 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 1249 of file imapaccountbase.cpp.

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

Returns:
the namespace - delimiter map

Definition at line 337 of file imapaccountbase.h.

bool KMail::ImapAccountBase::onlySubscribedFolders  )  const [inline]
 

Returns:
whether to show only subscribed folders

Definition at line 79 of file imapaccountbase.h.

void KMail::ImapAccountBase::postProcessNewMail bool  setStatusMsg = true  ) 
 

Called when we're completely done checking mail for this account When setStatusMsg is true a status msg is shown.

Definition at line 327 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::processNewMailSingleFolder KMFolder folder  ) 
 

Init a new-mail-check for a single folder.

Definition at line 956 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::pseudoAssign const KMAccount a  )  [virtual]
 

A weak assignment operator.

Reimplemented from KMail::NetworkAccount.

Reimplemented in KMAcctCachedImap, and KMAcctImap.

Definition at line 126 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::readConfig KConfig &  config  )  [virtual]
 

Read config file entries.

This method is called by the account manager when a new account is created. The config group is already properly set by the caller.

Reimplemented from KMail::NetworkAccount.

Reimplemented in KMAcctCachedImap, and KMAcctImap.

Definition at line 181 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::receivedACL KMFolder folder,
KIO::Job *  job,
const KMail::ACLList entries
[signal]
 

Emitted when the get-the-ACLs job is done, as a result of a getACL call.

Parameters:
folder the folder for which we were listing the ACLs (can be 0)
job the job that was used for doing so (can be used to display errors)
entries the ACL list. Make your copy of it, it comes from the job.

void KMail::ImapAccountBase::receivedUserRights KMFolder folder  )  [signal]
 

Emitted when the get-user-rights job is done, as a result of a getUserRights call.

Use userRights() to retrieve them, they will still be on 0 if the job failed.

void KMail::ImapAccountBase::removeJob JobIterator it  ) 
 

Call this when a job is finished.

Don't use *it afterwards!

Definition at line 1171 of file imapaccountbase.cpp.

virtual FolderStorage* const KMail::ImapAccountBase::rootFolder  )  const [pure virtual]
 

Returns the root folder of this account.

Implemented in KMAcctCachedImap, and KMAcctImap.

void KMail::ImapAccountBase::setFolder KMFolder ,
bool  addAccount = false
[virtual]
 

Reimplemented.

Additionally set the folder label

Reimplemented from KMAccount.

Definition at line 1160 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::setHasNoAnnotationSupport  )  [inline]
 

Called if the annotation command failed due to 'unsupported'.

Definition at line 273 of file imapaccountbase.h.

void KMail::ImapAccountBase::setImapStatus KMFolder folder,
const QString &  path,
const QCString &  flags
 

Set the status on the server Emits imapStatusChanged signal on success/error.

Definition at line 1118 of file imapaccountbase.cpp.

virtual void KMail::ImapAccountBase::setNamespaces nsMap  map  )  [inline, virtual]
 

Set defined namespaces.

Definition at line 305 of file imapaccountbase.h.

void KMail::ImapAccountBase::setNamespaceToDelimiter namespaceDelim  map  )  [inline]
 

Set the namespace - delimiter map.

Definition at line 343 of file imapaccountbase.h.

MetaData KMail::ImapAccountBase::slaveConfig  )  const [virtual]
 

Configure the slave by adding to the meta data map.

Reimplemented from KMail::NetworkAccount.

Definition at line 247 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slaveDied  )  [inline]
 

The KIO-Slave died.

Definition at line 211 of file imapaccountbase.h.

void KMail::ImapAccountBase::slotAbortRequested KPIM::ProgressItem *   )  [protected, slot]
 

Kills all jobs.

Definition at line 508 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotCapabilitiesResult KIO::Job *  ,
const QString &  result
[protected, slot]
 

Saves the capabilities list.

Definition at line 563 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotGetACLResult KIO::Job *  _job  )  [protected, slot]
 

Result of getACL() job.

Definition at line 465 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotGetUserRightsResult KIO::Job *  _job  )  [protected, slot]
 

Result of getUserRights() job.

Definition at line 424 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotIdleTimeout  )  [protected, slot]
 

Log out when idle.

Definition at line 496 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotNamespaceResult KIO::Job *  ,
const QString &  str
[protected, slot]
 

Gets and parses the namespaces.

Definition at line 608 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotNoopTimeout  )  [protected, slot]
 

Send a NOOP command regularly to keep the slave from disconnecting.

Definition at line 477 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotSaveNamespaces const ImapAccountBase::nsDelimMap map  )  [protected, slot]
 

Saves the fetched namespaces.

Definition at line 636 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotSchedulerSlaveConnected KIO::Slave *  aSlave  )  [protected, slot]
 

Handle a message coming from the KIO scheduler saying that the slave is now connected.

Definition at line 539 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotSchedulerSlaveError KIO::Slave *  aSlave,
int  ,
const QString &  errorMsg
[protected, slot]
 

Handle an error coming from the KIO scheduler.

Definition at line 517 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotSetStatusResult KIO::Job *  job  )  [protected, slot]
 

Only delete information about the job and ignore write errors.

Definition at line 1142 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::slotSimpleResult KIO::Job *  job  )  [protected, slot]
 

Only delete information about the job.

Definition at line 798 of file imapaccountbase.cpp.

void KMail::ImapAccountBase::subscriptionChanged const QString &  imapPath,
bool  subscribed
[signal]
 

Emitted when the subscription has changed, as a result of a changeSubscription call.

void KMail::ImapAccountBase::writeConfig KConfig &  config  )  [virtual]
 

Write all account information to given config file.

The config group is already properly set by the caller.

Reimplemented from KMail::NetworkAccount.

Reimplemented in KMAcctCachedImap.

Definition at line 218 of file imapaccountbase.cpp.


Member Data Documentation

QTimer KMail::ImapAccountBase::mIdleTimer [protected]
 

used to detect when the slave has not been used for a while

Definition at line 477 of file imapaccountbase.h.

QTimer KMail::ImapAccountBase::mNoopTimer [protected]
 

used to send a noop to the slave in regular intervals to keep it from disonnecting

Definition at line 479 of file imapaccountbase.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys