kmail

KMFolderImap Class Reference

Inheritance diagram for KMFolderImap:

KMFolderMbox KMFolderIndex FolderStorage List of all members.

Detailed Description

Definition at line 77 of file kmfolderimap.h.


Public Types

enum  imapState { imapNoInformation = 0, imapListingInProgress = 1, imapDownloadInProgress = 2, imapFinished = 3 }

Public Slots

virtual void addMsgQuiet (KMMessage *)
virtual void addMsgQuiet (QPtrList< KMMessage >)
virtual int addMsg (KMMessage *msg, int *index_return=0)
virtual int addMsg (QPtrList< KMMessage > &, QValueList< int > &index_return)
void copyMsg (QPtrList< KMMessage > &msgList)
virtual KMMessagetake (int idx)
virtual void take (QPtrList< KMMessage >)
void slotSimpleData (KIO::Job *job, const QByteArray &data)
static void flagsToStatus (KMMsgBase *msg, int flags, bool newMsg=TRUE, int supportedFalgs=31)
static void seenFlagToStatus (KMMsgBase *msg, int flags, bool newMsg=true)
void slotCopyMsgResult (KMail::FolderJob *job)
void slotSearchDone (QValueList< Q_UINT32 > serNums, const KMSearchPattern *pattern, bool complete)
void slotSearchDone (Q_UINT32 serNum, const KMSearchPattern *pattern, bool matches)
void slotListResult (const QStringList &, const QStringList &, const QStringList &, const QStringList &, const ImapAccountBase::jobData &)
void slotCheckNamespace (const QStringList &, const QStringList &, const QStringList &, const QStringList &, const ImapAccountBase::jobData &)

Signals

void folderComplete (KMFolderImap *folder, bool success)
void deleted (KMFolderImap *)
void directoryListingFinished (KMFolderImap *)
void folderCreationResult (const QString &name, bool success)

Public Member Functions

virtual imapState getContentState ()
virtual void setContentState (imapState state)
virtual imapState getSubfolderState ()
virtual void setSubfolderState (imapState state)
 KMFolderImap (KMFolder *folder, const char *name=0)
virtual ~KMFolderImap ()
virtual KMFolderType folderType () const
virtual KMMessagegetMsg (int idx)
void setImapPath (const QString &path)
QString imapPath () const
ulong lastUid ()
void setUidValidity (const QString &validity)
QString uidValidity ()
void setAccount (KMAcctImap *acct)
KMAcctImapaccount () const
virtual void removeMsg (int i, bool quiet=FALSE)
virtual void removeMsg (const QPtrList< KMMessage > &msgList, bool quiet=FALSE)
virtual int rename (const QString &newName, KMFolderDir *aParent=0)
virtual void remove ()
bool autoExpunge ()
virtual void writeConfig ()
virtual void readConfig ()
virtual bool listDirectory ()
void getFolder (bool force=FALSE)
void getAndCheckFolder (bool force=FALSE)
void getMessage (KMFolder *folder, KMMessage *msg)
void createFolder (const QString &name, const QString &imapPath=QString::null, bool askUser=true)
void deleteMessage (KMMessage *msg)
void deleteMessage (const QPtrList< KMMessage > &msgList)
virtual void setStatus (int idx, KMMsgStatus status, bool toggle)
virtual void setStatus (QValueList< int > &_ids, KMMsgStatus status, bool toggle)
void getUids (QValueList< int > &ids, QValueList< ulong > &uids)
void getUids (const QPtrList< KMMessage > &msgList, QValueList< ulong > &uids)
void expungeFolder (KMFolderImap *aFolder, bool quiet)
virtual int compact (bool)
void sendFolderComplete (bool success)
bool processNewMail (bool interactive)
void setSelected (bool selected)
bool isSelected ()
virtual QString fileName () const
const ulong serNumForUID (ulong uid)
void saveMsgMetaData (KMMessage *msg, ulong uid=0)
virtual void ignoreJobsForMessage (KMMessage *)
bool includeInMailCheck ()
void setIncludeInMailCheck (bool check)
virtual int create ()
virtual bool isAutoExpire () const
virtual void reallyDoClose (const char *owner)
void setCheckingValidity (bool val)
KMFoldertrashFolder () const
void setAlreadyRemoved (bool removed)
bool isReadOnly () const
bool canDeleteMessages () const
unsigned int userRights () const
void setUserRights (unsigned int userRights)
virtual void search (const KMSearchPattern *)
virtual void search (const KMSearchPattern *, Q_UINT32 serNum)
virtual bool isMoveable () const
void initializeFrom (KMFolderImap *parent, QString path, QString mimeType)
int permanentFlags () const

Static Public Member Functions

static QString cacheLocation ()
static QStringList makeSets (QValueList< ulong > &, bool sort=true)
static QStringList makeSets (const QStringList &, bool sort=true)
static QPtrList< KMMessagesplitMessageList (const QString &set, QPtrList< KMMessage > &msgList)
static QString encodeFileName (const QString &)
static QString decodeFileName (const QString &)
static QTextCodec * utf7Codec ()
static QString statusToFlags (KMMsgStatus status, int supportedFalgs)
static QValueList< ulong > splitSets (const QString)

Protected Slots

void checkValidity ()
void slotCheckValidityResult (KIO::Job *job)
void reallyGetFolder (const QString &startUid=QString::null)
void slotListFolderResult (KIO::Job *job)
void slotListFolderEntries (KIO::Job *job, const KIO::UDSEntryList &uds)
void slotGetMessagesResult (KIO::Job *job)
void slotGetLastMessagesResult (KIO::Job *job)
void slotGetMessagesData (KIO::Job *job, const QByteArray &data)
void slotCreateFolderResult (KIO::Job *job)
void slotRemoveFolderResult (KIO::Job *job)
void slotStatResult (KIO::Job *job)
void slotCompleteMailCheckProgress ()
void slotProcessNewMail (int errorCode, const QString &errorMsg)
void slotCreatePendingFolders (int errorCode, const QString &errorMsg)
void slotListNamespaces ()

Protected Member Functions

virtual FolderJob * doCreateJob (KMMessage *msg, FolderJob::JobType jt, KMFolder *folder, QString partSpecifier, const AttachmentStrategy *as) const
virtual FolderJob * doCreateJob (QPtrList< KMMessage > &msgList, const QString &sets, FolderJob::JobType jt, KMFolder *folder) const
void getMessagesResult (KIO::Job *job, bool lastSet)
virtual int expungeContents ()
void setChildrenState (QString attributes)
void initInbox ()
KMFolderImapfindParent (const QString &path, const QString &name)
void checkFolders (const QStringList &folderNames, const QString &ns)
void finishMailCheck (const char *func, imapState state)

Protected Attributes

QString mImapPath
ulong mLastUid
imapState mContentState
imapState mSubfolderState
bool mIsSelected
bool mCheckFlags
bool mReadOnly
bool mCheckMail
QGuardedPtr< KMAcctImapmAccount
QString mUidValidity
unsigned int mUserRights

Friends

class ::KMail::ImapJob

Constructor & Destructor Documentation

KMFolderImap::KMFolderImap ( KMFolder folder,
const char *  name = 0 
)

Usually a parent is given.

But in some cases there is no fitting parent object available. Then the name of the folder is used as the absolute path to the folder file.

Definition at line 64 of file kmfolderimap.cpp.


Member Function Documentation

virtual KMFolderType KMFolderImap::folderType (  )  const [inline, virtual]

Returns the type of this folder.

Reimplemented from KMFolderMbox.

Definition at line 107 of file kmfolderimap.h.

KMMessage * KMFolderImap::getMsg ( int  idx  )  [virtual]

Read message at given index.

Indexing starts at zero

Reimplemented from FolderStorage.

Definition at line 139 of file kmfolderimap.cpp.

void KMFolderImap::setImapPath ( const QString &  path  ) 

The path to the imap folder on the server.

Definition at line 2418 of file kmfolderimap.cpp.

ulong KMFolderImap::lastUid (  ) 

The highest UID in the folder.

Definition at line 1092 of file kmfolderimap.cpp.

void KMFolderImap::setUidValidity ( const QString &  validity  )  [inline]

The uidvalidity of the last update.

Definition at line 118 of file kmfolderimap.h.

void KMFolderImap::setAccount ( KMAcctImap acct  ) 

The imap account associated with this folder.

Definition at line 178 of file kmfolderimap.cpp.

void KMFolderImap::removeMsg ( int  i,
bool  quiet = FALSE 
) [virtual]

Remove (first occurrence of) given message from the folder.

Reimplemented from FolderStorage.

Definition at line 278 of file kmfolderimap.cpp.

int KMFolderImap::rename ( const QString &  newName,
KMFolderDir aParent = 0 
) [virtual]

Physically rename the folder.

Returns zero on success and an errno on failure.

Reimplemented from FolderStorage.

Definition at line 318 of file kmfolderimap.cpp.

void KMFolderImap::remove (  )  [virtual]

Remove the IMAP folder on the server and if successful also locally.

Reimplemented from FolderStorage.

Definition at line 231 of file kmfolderimap.cpp.

bool KMFolderImap::autoExpunge (  ) 

Automatically expunge deleted messages when leaving the folder.

Definition at line 1800 of file kmfolderimap.cpp.

void KMFolderImap::writeConfig (  )  [virtual]

Write the config file.

Reimplemented from FolderStorage.

Definition at line 216 of file kmfolderimap.cpp.

void KMFolderImap::readConfig (  )  [virtual]

Read the config file.

Reimplemented from FolderStorage.

Definition at line 192 of file kmfolderimap.cpp.

bool KMFolderImap::listDirectory (  )  [virtual]

List a directory and add the contents to kmfoldermgr It uses a ListJob to get the folders returns false if the connection failed.

Definition at line 740 of file kmfolderimap.cpp.

void KMFolderImap::getFolder ( bool  force = FALSE  ) 

Retrieve all mails in a folder.

Definition at line 1200 of file kmfolderimap.cpp.

void KMFolderImap::getAndCheckFolder ( bool  force = FALSE  ) 

same as above but also checks for new mails

Definition at line 1186 of file kmfolderimap.cpp.

void KMFolderImap::getMessage ( KMFolder folder,
KMMessage msg 
)

Get the whole message.

void KMFolderImap::createFolder ( const QString &  name,
const QString &  imapPath = QString::null,
bool  askUser = true 
)

Create a new subfolder You may specify the root imap path or this folder will be used If you set askUser to false and the server can only handle folders that contain messages _or_ folders the new folder is set to "contains messages" by default.

Definition at line 1721 of file kmfolderimap.cpp.

void KMFolderImap::deleteMessage ( KMMessage msg  ) 

Delete a message.

Definition at line 1822 of file kmfolderimap.cpp.

void KMFolderImap::setStatus ( int  idx,
KMMsgStatus  status,
bool  toggle 
) [virtual]

Change the status of the message indicated by index Overloaded function for the following one.

Reimplemented from FolderStorage.

Definition at line 1883 of file kmfolderimap.cpp.

void KMFolderImap::setStatus ( QValueList< int > &  _ids,
KMMsgStatus  status,
bool  toggle 
) [virtual]

Change the status of several messages indicated by ids.

Reimplemented from FolderStorage.

Definition at line 1889 of file kmfolderimap.cpp.

QStringList KMFolderImap::makeSets ( QValueList< ulong > &  ,
bool  sort = true 
) [static]

generates sets of uids

Definition at line 1986 of file kmfolderimap.cpp.

QPtrList< KMMessage > KMFolderImap::splitMessageList ( const QString &  set,
QPtrList< KMMessage > &  msgList 
) [static]

splits the message list according to sets.

Modifies the .

Definition at line 551 of file kmfolderimap.cpp.

void KMFolderImap::getUids ( QValueList< int > &  ids,
QValueList< ulong > &  uids 
)

gets the uids of the given ids

Definition at line 2040 of file kmfolderimap.cpp.

void KMFolderImap::getUids ( const QPtrList< KMMessage > &  msgList,
QValueList< ulong > &  uids 
)

same as above but accepts a Message-List

Definition at line 2052 of file kmfolderimap.cpp.

void KMFolderImap::expungeFolder ( KMFolderImap aFolder,
bool  quiet 
)

Expunge deleted messages from the folder.

Definition at line 2066 of file kmfolderimap.cpp.

virtual int KMFolderImap::compact ( bool   )  [inline, virtual]

Remove deleted messages from the folder.

Returns zero on success and an errno on failure.

Reimplemented from KMFolderMbox.

Definition at line 211 of file kmfolderimap.h.

void KMFolderImap::sendFolderComplete ( bool  success  )  [inline]

Emit the folderComplete signal.

Definition at line 216 of file kmfolderimap.h.

bool KMFolderImap::processNewMail ( bool  interactive  ) 

Refresh the number of unseen mails Returns false in an error condition.

Definition at line 2095 of file kmfolderimap.cpp.

void KMFolderImap::setSelected ( bool  selected  )  [inline]

Tell the folder, this it is selected and shall also display new mails, not only their number, when checking for mail.

Definition at line 229 of file kmfolderimap.h.

QString KMFolderImap::encodeFileName ( const QString &   )  [static]

Encode the given string in a filename save 7 bit string.

Definition at line 1785 of file kmfolderimap.cpp.

QString KMFolderImap::statusToFlags ( KMMsgStatus  status,
int  supportedFalgs 
) [static]

Convert message status to a list of IMAP flags.

Definition at line 1481 of file kmfolderimap.cpp.

virtual QString KMFolderImap::fileName (  )  const [inline, virtual]

Return the filename of the folder (reimplemented from KFolder).

Reimplemented from FolderStorage.

Definition at line 247 of file kmfolderimap.h.

const ulong KMFolderImap::serNumForUID ( ulong  uid  ) 

Get the serial number for the given UID (if available).

Definition at line 2396 of file kmfolderimap.cpp.

void KMFolderImap::saveMsgMetaData ( KMMessage msg,
ulong  uid = 0 
)

Save the metadata for the UID If the UID is not supplied the one from the message is taken.

Definition at line 2408 of file kmfolderimap.cpp.

QValueList< ulong > KMFolderImap::splitSets ( const   QString  )  [static]

Splits a uid-set into single uids.

Definition at line 2183 of file kmfolderimap.cpp.

void KMFolderImap::ignoreJobsForMessage ( KMMessage  )  [virtual]

Removes and deletes all jobs associated with the particular message.

Reimplemented from FolderStorage.

Definition at line 1509 of file kmfolderimap.cpp.

bool KMFolderImap::includeInMailCheck (  )  [inline]

If this folder should be included in new-mail-check.

Definition at line 271 of file kmfolderimap.h.

int KMFolderImap::create (  )  [virtual]

Inherited.

Reimplemented from KMFolderMbox.

Definition at line 2176 of file kmfolderimap.cpp.

virtual bool KMFolderImap::isAutoExpire (  )  const [inline, virtual]

imap folders cannot expire

Definition at line 278 of file kmfolderimap.h.

void KMFolderImap::reallyDoClose ( const char *  owner  )  [virtual]

Closes and cancels all pending jobs.

Reimplemented from KMFolderMbox.

Definition at line 110 of file kmfolderimap.cpp.

KMFolder * KMFolderImap::trashFolder (  )  const [virtual]

Return the trash folder.

Reimplemented from FolderStorage.

Definition at line 132 of file kmfolderimap.cpp.

void KMFolderImap::setAlreadyRemoved ( bool  removed  ) 

Mark the folder as already removed from the server If set to true the folder will only be deleted locally This will recursively be applied to all children.

Definition at line 2310 of file kmfolderimap.cpp.

bool KMFolderImap::isReadOnly (  )  const [inline, virtual]

Is the folder readonly?

Reimplemented from KMFolderMbox.

Definition at line 296 of file kmfolderimap.h.

bool KMFolderImap::canDeleteMessages (  )  const [virtual]

Can messages in this folder be deleted?

Reimplemented from FolderStorage.

Definition at line 2435 of file kmfolderimap.cpp.

unsigned int KMFolderImap::userRights (  )  const [inline]

The user's rights on this folder - see bitfield in ACLJobs namespace.

Returns:
0 when not known yet

Definition at line 303 of file kmfolderimap.h.

void KMFolderImap::setUserRights ( unsigned int  userRights  ) 

Set the user's rights on this folder - called by getUserRights.

Definition at line 2265 of file kmfolderimap.cpp.

void KMFolderImap::search ( const KMSearchPattern  )  [virtual]

Search for messages The actual search is done in slotSearch and the end is signaled with searchDone().

Reimplemented from FolderStorage.

Definition at line 2343 of file kmfolderimap.cpp.

void KMFolderImap::search ( const KMSearchPattern ,
Q_UINT32  serNum 
) [virtual]

Check if the message matches the search criteria The end is signaled with searchDone().

Reimplemented from FolderStorage.

Definition at line 2367 of file kmfolderimap.cpp.

bool KMFolderImap::isMoveable (  )  const [virtual]

Returns true if this folder can be moved.

Reimplemented from FolderStorage.

Definition at line 2389 of file kmfolderimap.cpp.

void KMFolderImap::initializeFrom ( KMFolderImap parent,
QString  path,
QString  mimeType 
)

Initialize this storage from another one.

Used when creating a child folder

Definition at line 994 of file kmfolderimap.cpp.

int KMFolderImap::permanentFlags (  )  const [inline]

Returns the IMAP flags that can be stored on the server.

Definition at line 323 of file kmfolderimap.h.

void KMFolderImap::deleted ( KMFolderImap  )  [signal]

Emitted, when the account is deleted.

void KMFolderImap::directoryListingFinished ( KMFolderImap  )  [signal]

Emitted at the end of the directory listing.

void KMFolderImap::folderCreationResult ( const QString &  name,
bool  success 
) [signal]

Emitted when a folder creation has finished.

Parameters:
name The name of the folder that should have been created.
success True if the folder was created, false otherwise.

void KMFolderImap::addMsgQuiet ( KMMessage  )  [virtual, slot]

Add a message to a folder after is has been added on an IMAP server.

Definition at line 327 of file kmfolderimap.cpp.

int KMFolderImap::addMsg ( KMMessage msg,
int *  index_return = 0 
) [virtual, slot]

Add the given message to the folder.

Usually the message is added at the end of the folder. Returns zero on success and an errno error code on failure. The index of the new message is stored in index_return if given. Please note that the message is added as is to the folder and the folder takes ownership of the message (deleting it in the destructor).

Reimplemented from KMFolderMbox.

Definition at line 389 of file kmfolderimap.cpp.

int KMFolderImap::addMsg ( QPtrList< KMMessage > &  ,
QValueList< int > &  index_return 
) [virtual, slot]

Adds the given messages to the folder.

Behaviour is identical to addMsg(msg)

Reimplemented from FolderStorage.

Definition at line 399 of file kmfolderimap.cpp.

void KMFolderImap::copyMsg ( QPtrList< KMMessage > &  msgList  )  [slot]

Copy the messages to this folder.

Definition at line 525 of file kmfolderimap.cpp.

KMMessage * KMFolderImap::take ( int  idx  )  [virtual, slot]

Detach message from this folder.

Usable to call addMsg() afterwards. Loads the message if it is not loaded up to now.

Reimplemented from FolderStorage.

Definition at line 589 of file kmfolderimap.cpp.

void KMFolderImap::slotSimpleData ( KIO::Job *  job,
const QByteArray &  data 
) [slot]

Add the data a KIO::Job retrieves to the buffer.

Definition at line 1810 of file kmfolderimap.cpp.

void KMFolderImap::flagsToStatus ( KMMsgBase msg,
int  flags,
bool  newMsg = TRUE,
int  supportedFalgs = 31 
) [static, slot]

Convert IMAP flags to a message status.

Parameters:
newMsg specifies whether unseen messages are new or unread

Definition at line 1424 of file kmfolderimap.cpp.

void KMFolderImap::seenFlagToStatus ( KMMsgBase msg,
int  flags,
bool  newMsg = true 
) [static, slot]

Convert IMAP seen flag to a message status.

Parameters:
newMsg specifies whether unseen messages are new or unread

Definition at line 1457 of file kmfolderimap.cpp.

void KMFolderImap::slotCopyMsgResult ( KMail::FolderJob job  )  [slot]

Connected to the result signal of the copy/move job.

Definition at line 517 of file kmfolderimap.cpp.

void KMFolderImap::slotSearchDone ( QValueList< Q_UINT32 >  serNums,
const KMSearchPattern pattern,
bool  complete 
) [slot]

Called from the SearchJob when the folder is done or messages where found.

Definition at line 2359 of file kmfolderimap.cpp.

void KMFolderImap::slotSearchDone ( Q_UINT32  serNum,
const KMSearchPattern pattern,
bool  matches 
) [slot]

Called from the SearchJob when the message was searched.

Definition at line 2382 of file kmfolderimap.cpp.

void KMFolderImap::slotListResult ( const QStringList &  ,
const QStringList &  ,
const QStringList &  ,
const QStringList &  ,
const ImapAccountBase::jobData &   
) [slot]

Connected to ListJob::receivedFolders creates/removes folders.

Definition at line 775 of file kmfolderimap.cpp.

void KMFolderImap::slotCheckNamespace ( const QStringList &  ,
const QStringList &  ,
const QStringList &  ,
const QStringList &  ,
const ImapAccountBase::jobData &   
) [slot]

Connected to slotListNamespaces creates/removes namespace folders.

Definition at line 669 of file kmfolderimap.cpp.

FolderJob * KMFolderImap::doCreateJob ( KMMessage msg,
FolderJob::JobType  jt,
KMFolder folder,
QString  partSpecifier,
const AttachmentStrategy as 
) const [protected, virtual]

These two methods actually create the jobs.

They have to be implemented in all folders.

See also:
createJob

Reimplemented from KMFolderMbox.

Definition at line 1646 of file kmfolderimap.cpp.

int KMFolderImap::expungeContents (  )  [protected, virtual]

Called by KMFolder::expunge() to delete the actual contents.

At the time of the call the folder has already been closed, and the various index files deleted. Returns 0 on success.

Reimplemented from KMFolderMbox.

Definition at line 2235 of file kmfolderimap.cpp.

void KMFolderImap::initInbox (  )  [protected]

Create or find the INBOX and initialize it.

Definition at line 892 of file kmfolderimap.cpp.

KMFolderImap * KMFolderImap::findParent ( const QString &  path,
const QString &  name 
) [protected]

See if there is a better parent then this folder.

Definition at line 922 of file kmfolderimap.cpp.

void KMFolderImap::checkFolders ( const QStringList &  folderNames,
const QString &  ns 
) [protected]

See if all folders are still present on server, otherwise delete them.

Definition at line 949 of file kmfolderimap.cpp.

void KMFolderImap::checkValidity (  )  [protected, slot]

Retrieve the whole folder or only the changes.

Definition at line 1025 of file kmfolderimap.cpp.

void KMFolderImap::reallyGetFolder ( const QString &  startUid = QString::null  )  [protected, slot]

Get the folder now (internal).

Definition at line 1220 of file kmfolderimap.cpp.

void KMFolderImap::slotListFolderResult ( KIO::Job *  job  )  [protected, slot]

For listing the contents of a folder.

Definition at line 1266 of file kmfolderimap.cpp.

void KMFolderImap::slotGetMessagesResult ( KIO::Job *  job  )  [protected, slot]

For retrieving a message digest.

Definition at line 1714 of file kmfolderimap.cpp.

void KMFolderImap::slotCreateFolderResult ( KIO::Job *  job  )  [protected, slot]

For creating a new subfolder.

Definition at line 1749 of file kmfolderimap.cpp.

void KMFolderImap::slotRemoveFolderResult ( KIO::Job *  job  )  [protected, slot]

Remove the folder also locally, if removing on the server succeeded.

Definition at line 262 of file kmfolderimap.cpp.

void KMFolderImap::slotStatResult ( KIO::Job *  job  )  [protected, slot]

Update the number of unseen messages.

Definition at line 2147 of file kmfolderimap.cpp.

void KMFolderImap::slotCompleteMailCheckProgress (  )  [protected, slot]

notify the progress item that the mail check for this folder is done.

Definition at line 2272 of file kmfolderimap.cpp.

void KMFolderImap::slotProcessNewMail ( int  errorCode,
const QString &  errorMsg 
) [protected, slot]

Is called when the slave is connected and triggers a newmail check.

Definition at line 2083 of file kmfolderimap.cpp.

void KMFolderImap::slotCreatePendingFolders ( int  errorCode,
const QString &  errorMsg 
) [protected, slot]

Is connected when there are folders to be created on startup and the account is still connecting.

Once the account emits the connected signal this slot is called and the folders created.

Definition at line 2328 of file kmfolderimap.cpp.

void KMFolderImap::slotListNamespaces (  )  [protected, slot]

Starts a namespace listing.

Definition at line 611 of file kmfolderimap.cpp.


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