23#include "kmfolderdir.h"
24#include "kmfoldermbox.h"
25#include "folderstorage.h"
26#include "kmfoldercachedimap.h"
27#include "kmfoldersearch.h"
28#include "kmfolderimap.h"
29#include "kmfoldermgr.h"
30#include <libkpimidentities/identitymanager.h>
31#include <libkpimidentities/identity.h>
33#include "compactionjob.h"
34#include "kmfoldertree.h"
35#include "kmailicalifaceimpl.h"
42#include <tdeshortcut.h>
43#include <tdemessagebox.h>
45#include <tqfileinfo.h>
49 KMFolderType aFolderType,
bool withIndex,
bool exportedSernums )
50 : KMFolderNode( aParent, aFolderName ), mStorage(0),
52 mIsSystemFolder( false ),
53 mHasIndex( withIndex ),
54 mExportsSernums( exportedSernums ),
55 mMoveInProgress( false ),
56 mExpireMessages( false ), mUnreadExpireAge( 28 ),
57 mReadExpireAge( 14 ), mUnreadExpireUnits( expireNever ),
58 mReadExpireUnits( expireNever ),
59 mExpireAction( ExpireDelete ),
60 mUseCustomIcons( false ), mMailingListEnabled( false ),
63 mPutRepliesInSameFolder( false ),
64 mIgnoreNewMail( false )
66 if( aFolderType == KMFolderTypeCachedImap )
67 mStorage =
new KMFolderCachedImap(
this, aFolderName.latin1() );
68 else if( aFolderType == KMFolderTypeImap )
69 mStorage =
new KMFolderImap(
this, aFolderName.latin1() );
70 else if( aFolderType == KMFolderTypeMaildir )
71 mStorage =
new KMFolderMaildir(
this, aFolderName.latin1() );
72 else if( aFolderType == KMFolderTypeSearch )
73 mStorage =
new KMFolderSearch(
this, aFolderName.latin1() );
75 mStorage =
new KMFolderMbox(
this, aFolderName.latin1() );
80 dirinfo.setFile( mStorage->location() );
81 if ( !dirinfo.exists() ) {
82 int rc = mStorage->create();
83 TQString msg = i18n(
"<qt>Error while creating file <b>%1</b>:<br>%2</qt>").arg(aFolderName).arg(strerror(rc));
85 KMessageBox::information(0, msg);
90 connect( mStorage, TQ_SIGNAL( msgAdded(
KMFolder*, TQ_UINT32 ) ),
91 aParent->manager(), TQ_SIGNAL( msgAdded(
KMFolder*, TQ_UINT32 ) ) );
92 connect( mStorage, TQ_SIGNAL( msgRemoved(
KMFolder*, TQ_UINT32 ) ),
93 parent()->manager(), TQ_SIGNAL( msgRemoved(
KMFolder*, TQ_UINT32 ) ) );
94 connect(
this, TQ_SIGNAL( msgChanged(
KMFolder*, TQ_UINT32,
int ) ),
95 parent()->manager(), TQ_SIGNAL( msgChanged(
KMFolder*, TQ_UINT32,
int ) ) );
96 connect(
this, TQ_SIGNAL( msgHeaderChanged(
KMFolder*,
int ) ),
97 parent()->manager(), TQ_SIGNAL( msgHeaderChanged(
KMFolder*,
int ) ) );
98 connect( mStorage, TQ_SIGNAL( invalidated(
KMFolder* ) ),
99 parent()->manager(), TQ_SIGNAL( folderInvalidated(
KMFolder* ) ) );
103 connect( mStorage, TQ_SIGNAL( changed() ), TQ_SIGNAL( changed() ) );
104 connect( mStorage, TQ_SIGNAL( cleared() ), TQ_SIGNAL( cleared() ) );
105 connect( mStorage, TQ_SIGNAL( expunged(
KMFolder* ) ),
106 TQ_SIGNAL( expunged(
KMFolder* ) ) );
107 connect( mStorage, TQ_SIGNAL( nameChanged() ), TQ_SIGNAL( nameChanged() ) );
108 connect( mStorage, TQ_SIGNAL( msgRemoved(
KMFolder*, TQ_UINT32 ) ),
109 TQ_SIGNAL( msgRemoved(
KMFolder*, TQ_UINT32 ) ) );
110 connect( mStorage, TQ_SIGNAL( msgRemoved(
int, TQString ) ),
111 TQ_SIGNAL( msgRemoved(
int, TQString ) ) );
112 connect( mStorage, TQ_SIGNAL( msgRemoved(
KMFolder* ) ),
113 TQ_SIGNAL( msgRemoved(
KMFolder* ) ) );
114 connect( mStorage, TQ_SIGNAL( msgAdded(
int ) ), TQ_SIGNAL( msgAdded(
int ) ) );
115 connect( mStorage, TQ_SIGNAL( msgAdded(
KMFolder*, TQ_UINT32 ) ),
116 TQ_SIGNAL( msgAdded(
KMFolder*, TQ_UINT32 ) ) );
117 connect( mStorage, TQ_SIGNAL( msgChanged(
KMFolder*, TQ_UINT32 ,
int ) ),
118 TQ_SIGNAL( msgChanged(
KMFolder*, TQ_UINT32 ,
int ) ) );
119 connect( mStorage, TQ_SIGNAL( msgHeaderChanged(
KMFolder*,
int ) ),
120 TQ_SIGNAL( msgHeaderChanged(
KMFolder*,
int ) ) );
121 connect( mStorage, TQ_SIGNAL( statusMsg(
const TQString& ) ),
122 TQ_SIGNAL( statusMsg(
const TQString& ) ) );
123 connect( mStorage, TQ_SIGNAL( numUnreadMsgsChanged(
KMFolder* ) ),
124 TQ_SIGNAL( numUnreadMsgsChanged(
KMFolder* ) ) );
125 connect( mStorage, TQ_SIGNAL( removed(
KMFolder*,
bool ) ),
126 TQ_SIGNAL( removed(
KMFolder*,
bool ) ) );
127 connect( mStorage, TQ_SIGNAL(noContentChanged()),
128 TQ_SIGNAL(noContentChanged()) );
129 connect( mStorage, TQ_SIGNAL(syncStateChanged()),
130 TQ_SIGNAL(syncStateChanged()) );
132 connect( mStorage, TQ_SIGNAL( contentsTypeChanged( KMail::FolderContentsType ) ),
133 this, TQ_SLOT( slotContentsTypeChanged( KMail::FolderContentsType ) ) );
135 connect( mStorage, TQ_SIGNAL( folderSizeChanged() ),
136 this, TQ_SLOT( slotFolderSizeChanged() ) );
141 mStorage->readConfig();
144 if ( mExportsSernums )
145 mStorage->registerWithMessageDict();
147 mStorage->setAutoCreateIndex(
false );
149 if ( mId == 0 && aParent )
150 mId = aParent->manager()->createId();
155 mStorage->close(
"~KMFolder",
true );
157 if ( mHasIndex ) mStorage->deregisterFromMessageDict();
163 if ( !config->readEntry(
"SystemLabel").isEmpty() )
164 mSystemLabel = config->readEntry(
"SystemLabel");
165 mExpireMessages = config->readBoolEntry(
"ExpireMessages",
false);
166 mReadExpireAge = config->readNumEntry(
"ReadExpireAge", 3);
167 mReadExpireUnits = (ExpireUnits)config->readNumEntry(
"ReadExpireUnits", expireMonths);
168 mUnreadExpireAge = config->readNumEntry(
"UnreadExpireAge", 12);
169 mUnreadExpireUnits = (ExpireUnits)config->readNumEntry(
"UnreadExpireUnits", expireNever);
170 mExpireAction = config->readEntry(
"ExpireAction",
"Delete") ==
"Move" ? ExpireMove : ExpireDelete;
171 mExpireToFolderId = config->readEntry(
"ExpireToFolder");
173 mUseCustomIcons = config->readBoolEntry(
"UseCustomIcons",
false );
174 mNormalIconPath = config->readEntry(
"NormalIconPath" );
175 mUnreadIconPath = config->readEntry(
"UnreadIconPath" );
177 mMailingListEnabled = config->readBoolEntry(
"MailingListEnabled");
178 mMailingList.readConfig( config );
180 mIdentity = config->readUnsignedNumEntry(
"Identity",0);
182 setUserWhoField( config->readEntry(
"WhoField"),
false );
183 uint savedId = config->readUnsignedNumEntry(
"Id", 0);
185 if ( savedId != 0 && mId == 0 )
187 mPutRepliesInSameFolder = config->readBoolEntry(
"PutRepliesInSameFolder",
false );
188 mIgnoreNewMail = config->readBoolEntry(
"IgnoreNewMail",
false );
190 if ( mUseCustomIcons )
193 TQString shortcut( config->readEntry(
"Shortcut" ) );
194 if ( !shortcut.isEmpty() ) {
195 TDEShortcut sc( shortcut );
202 config->writeEntry(
"SystemLabel", mSystemLabel);
203 config->writeEntry(
"ExpireMessages", mExpireMessages);
204 config->writeEntry(
"ReadExpireAge", mReadExpireAge);
205 config->writeEntry(
"ReadExpireUnits", mReadExpireUnits);
206 config->writeEntry(
"UnreadExpireAge", mUnreadExpireAge);
207 config->writeEntry(
"UnreadExpireUnits", mUnreadExpireUnits);
208 config->writeEntry(
"ExpireAction", mExpireAction == ExpireDelete ?
"Delete" :
"Move");
209 config->writeEntry(
"ExpireToFolder", mExpireToFolderId);
211 config->writeEntry(
"UseCustomIcons", mUseCustomIcons);
212 config->writeEntry(
"NormalIconPath", mNormalIconPath);
213 config->writeEntry(
"UnreadIconPath", mUnreadIconPath);
215 config->writeEntry(
"MailingListEnabled", mMailingListEnabled);
216 mMailingList.writeConfig( config );
218 if ( mIdentity != 0 && ( !mStorage || !mStorage->account() || mIdentity != mStorage->account()->identityId() ) )
219 config->writeEntry(
"Identity", mIdentity);
221 config->deleteEntry(
"Identity");
223 config->writeEntry(
"WhoField", mUserWhoField);
224 config->writeEntry(
"Id", mId);
225 config->writeEntry(
"PutRepliesInSameFolder", mPutRepliesInSameFolder );
226 config->writeEntry(
"IgnoreNewMail", mIgnoreNewMail );
227 if ( !mShortcut.isNull() )
228 config->writeEntry(
"Shortcut", mShortcut.toString() );
230 config->deleteEntry(
"Shortcut" );
235 return mStorage ? mStorage->folderType() : KMFolderTypeUnknown;
240 return mStorage ? mStorage->fileName() : TQString();
245 return mStorage ? mStorage->location() : TQString();
250 return mStorage ? mStorage->indexLocation() : TQString();
255 TQString sLocation( path() );
257 if( !sLocation.isEmpty() )
269 TQString childName =
"." +
fileName() +
".directory";
270 TQString childDir = path() +
"/" + childName;
271 if (access(TQFile::encodeName(childDir), W_OK) != 0)
273 if (mkdir(TQFile::encodeName(childDir), S_IRWXU) != 0
274 && chmod(TQFile::encodeName(childDir), S_IRWXU) != 0) {
275 TQString wmsg = TQString(
" '%1': %2").arg(childDir).arg(strerror(errno));
276 KMessageBox::information(0,i18n(
"Failed to create folder") + wmsg);
281 KMFolderDirType newType = KMStandardDir;
283 newType = KMDImapDir;
287 mChild =
new KMFolderDir(
this, parent(), childName, newType );
291 parent()->append( mChild );
298 mStorage->updateChildrenState();
303 return mStorage ? mStorage->noContent() :
true;
308 mStorage->setNoContent( aNoContent );
313 return mStorage->noChildren();
318 mStorage->setNoChildren( aNoChildren );
323 return mStorage->getMsg( idx );
328 return mStorage->unGetMsg( idx );
333 return mStorage->isMessage( idx );
338 return mStorage->getDwString( idx );
343 mStorage->ignoreJobsForMessage( m );
347 KMFolder *folder, TQString partSpecifier,
348 const AttachmentStrategy *as )
const
350 return mStorage->createJob( msg, jt, folder, partSpecifier, as );
354 const TQString& sets,
355 FolderJob::JobType jt,
KMFolder *folder )
const
357 return mStorage->
createJob( msgList, sets, jt, folder );
362 return mStorage->getMsgBase( idx );
372 return mStorage->operator[]( idx );
377 return mStorage->operator[]( idx );
382 return mStorage->take( idx );
387 mStorage->
take( msgList );
392 return mStorage->addMsg( msg, index_return );
397 return mStorage->addMsgKeepUID( msg, index_return );
402 return mStorage->addMsg( list, index_return );
407 mStorage->emitMsgAddedSignals( idx );
412 mStorage->removeMsg( i, imapQuiet );
417 mStorage->
removeMsg( msgList, imapQuiet );
422 return mStorage->expungeOldMsg( days );
427 return mStorage->moveMsg( msg, index_return );
432 return mStorage->
moveMsg( q, index_return );
437 return mStorage ? mStorage->find( msg ) : -1;
442 return mStorage ? mStorage->
find( msg ) : -1;
447 return mStorage->count( cache );
452 return mStorage->countUnread();
463 TQPtrListIterator<KMFolderNode> it(*dir);
464 for ( ; it.current(); ++it )
465 if (!it.current()->isDir()) {
466 folder =
static_cast<KMFolder*
>(it.current());
474 const KMMsgStatus newStatus,
int idx )
476 mStorage->msgStatusChanged( oldStatus, newStatus, idx );
481 return mStorage->open(owner);
486 return mStorage->canAccess();
492 mStorage->close( owner, force );
502 return mStorage->isOpened();
507 mStorage->markNewAsUnread();
512 mStorage->markUnreadAsRead();
522 mStorage->open(
"kmfolder_remove");
528 return mStorage->expunge();
533 return mStorage->rename( newName, aParent );
538 return mStorage->dirty();
543 mStorage->setDirty( f );
548 return mStorage->needsCompacting();
551void KMFolder::setNeedsCompacting(
bool f )
553 mStorage->setNeedsCompacting( f );
558 mStorage->quiet( beQuiet );
563 return mStorage->isReadOnly();
566bool KMFolder::mailCheckInProgress()
const
568 return mStorage->mailCheckInProgress();
573 return !mStorage->isReadOnly() && mStorage->canDeleteMessages();
578 return mStorage->canDeleteMessages();
583 if ( !mSystemLabel.isEmpty() )
585 if ( !mLabel.isEmpty() )
588 return i18n( name().utf8() );
597 parentUrl = parent()->prettyURL();
598 if ( !parentUrl.isEmpty() )
599 return parentUrl +
'/' +
label();
605TQString KMFolder::mailingListPostAddress()
const
607 if ( mMailingList.features() & MailingList::Post ) {
608 KURL::List::const_iterator it;
609 KURL::List post = mMailingList.postURLS();
610 for( it = post.begin(); it != post.end(); ++it ) {
613 if ( (*it).protocol() ==
"mailto" || (*it).protocol().isEmpty() )
622 mMailingListEnabled = enabled;
623 mStorage->writeConfig();
626void KMFolder::setMailingList(
const MailingList& mlist )
628 mMailingList = mlist;
632void KMFolder::setIdentity( uint identity )
634 mIdentity = identity;
635 kmkernel->slotRequestConfigSync();
638uint KMFolder::identity()
const
641 kdDebug() <<
"FOO: " << mIdentity <<
" :: " << mStorage << endl;
642 if ( !mIdentity && mStorage )
643 if ( KMAccount *act = mStorage->account() )
644 return act->identityId();
648void KMFolder::setWhoField(
const TQString& aWhoField )
650 mWhoField = aWhoField;
653 mStorage->writeConfig();
657void KMFolder::setUserWhoField(
const TQString& whoField,
bool writeConfig )
664 const KPIM::Identity & identity =
665 kmkernel->identityManager()->identityForUoidOrDefault( mIdentity );
669 if (
this == kmkernel->inboxFolder() ||
670 this == kmkernel->trashFolder() )
672 if (
this == kmkernel->outboxFolder() ||
673 this == kmkernel->sentFolder() ||
674 this == kmkernel->draftsFolder() ||
675 this == kmkernel->templatesFolder() )
677 }
else if ( identity.drafts() ==
idString() ||
678 identity.templates() ==
idString() ||
689 kdDebug(5006) <<
"Illegal setting " <<
whoField <<
" for userWhoField!"
696 mStorage->writeConfig();
702 mStorage->correctUnreadMsgsCount();
707 KMFolderNode* folderNode = parent();
710 while ( folderNode->parent() )
711 folderNode = folderNode->parent();
712 TQString myPath = path();
713 int pathLen = myPath.length() - folderNode->path().length();
714 TQString relativePath = myPath.right( pathLen );
715 if (!relativePath.isEmpty())
716 relativePath = relativePath.right( relativePath.length() - 1 ) +
"/";
717 TQString escapedName = name();
720 escapedName.replace(
"[",
"%(" );
721 escapedName.replace(
"]",
"%)" );
722 return relativePath + escapedName;
727 if( enabled != mExpireMessages ) {
728 mExpireMessages = enabled;
729 mStorage->writeConfig();
735 if( age >= 0 && age != mUnreadExpireAge ) {
736 mUnreadExpireAge = age;
737 mStorage->writeConfig();
743 if (units >= expireNever && units < expireMaxUnits)
744 mUnreadExpireUnits = units;
745 mStorage->writeConfig();
750 if( age >= 0 && age != mReadExpireAge ) {
751 mReadExpireAge = age;
752 mStorage->writeConfig();
758 if (units >= expireNever && units <= expireMaxUnits)
759 mReadExpireUnits = units;
760 mStorage->writeConfig();
764void KMFolder::setExpireAction( ExpireAction a )
766 if ( a != mExpireAction ) {
772void KMFolder::setExpireToFolderId(
const TQString&
id )
774 if (
id != mExpireToFolderId ) {
775 mExpireToFolderId = id;
776 mStorage->writeConfig();
781static int daysToExpire(
int number, ExpireUnits units )
796void KMFolder::daysToExpire(
int& unreadDays,
int& readDays) {
804 kmkernel->jobScheduler()->registerTask( task );
813 if ( options == CompactLater ) {
815 kmkernel->jobScheduler()->registerTask( task );
817 mStorage->compact( options == CompactSilentlyNow );
828 return mStorage->writeIndex( createEmptyIndex );
833 mStorage->setStatus( idx, status, toggle );
839 mStorage->setStatus( ids, status, toggle);
842void KMFolder::setIconPaths(
const TQString &normalPath,
843 const TQString &unreadPath )
845 mNormalIconPath = normalPath;
846 mUnreadIconPath = unreadPath;
851void KMFolder::removeJobs()
853 mStorage->removeJobs();
858 return mStorage->updateIndex();
863 mStorage->reallyAddMsg( aMsg );
868 mStorage->reallyAddCopyOfMsg( aMsg );
871void KMFolder::setShortcut(
const TDEShortcut &sc )
873 if ( mShortcut != sc ) {
884void KMFolder::slotContentsTypeChanged( KMail::FolderContentsType type )
886 kmkernel->iCalIface().folderContentsTypeChanged(
this, type );
890void KMFolder::slotFolderSizeChanged()
893 KMFolder* papa = parent()->manager()->parentFolder(
this );
894 if ( papa && papa !=
this ) {
895 papa->slotFolderSizeChanged();
904 if ( folderName.find(
'/' ) != -1 &&
905 fldType != KMFolderTypeImap &&
906 fldType != KMFolderTypeCachedImap ) {
907 message = i18n(
"Folder names cannot contain the / (slash) character; please choose another folder name." );
912 if ( folderName.startsWith(
"." ) ) {
913 message = i18n(
"Folder names cannot start with a . (dot) character; please choose another folder name." );
918 if ( fldType == KMFolderTypeImap || fldType == KMFolderTypeCachedImap ) {
920 if ( fldType == KMFolderTypeImap ) {
921 KMAcctImap *ai =
static_cast<KMFolderImap*
>( mStorage )->account();
923 delimiter = ai->delimiterForFolder( mStorage );
926 KMAcctCachedImap *ai =
static_cast<KMFolderCachedImap*
>( mStorage )->account();
928 delimiter = ai->delimiterForFolder( mStorage );
931 if ( !delimiter.isEmpty() && folderName.find( delimiter ) != -1 ) {
932 message = i18n(
"Your IMAP server does not allow the character '%1'; please choose another folder name." ).arg( delimiter );
939#include "kmfolder.moc"
virtual KMMessage * take(int idx)
Detach message from this folder.
virtual int find(const KMMsgBase *msg) const =0
Returns the index of the given message or -1 if not found.
virtual FolderJob * createJob(KMMessage *msg, FolderJob::JobType jt=FolderJob::tGetMessage, KMFolder *folder=0, TQString partSpecifier=TQString(), const AttachmentStrategy *as=0) const
These methods create respective FolderJob (You should derive FolderJob for each derived KMFolder).
virtual const KMMsgBase * getMsgBase(int idx) const =0
Provides access to the basic message fields that are also stored in the index.
static TQString dotEscape(const TQString &)
Escape a leading dot.
virtual void removeMsg(int i, bool imapQuiet=false)
Remove (first occurrence of) given message from the folder.
virtual void writeConfig()
Write the config file.
virtual int moveMsg(KMMessage *msg, int *index_return=0)
Detaches the given message from it's current folder and adds it to this folder.
KMail list that manages the contents of one directory that may contain folders and/or other directori...
int getUnreadExpireAge() const
Get the age at which unread messages are expired.
bool isOpened() const
Test if folder is opened.
void sync()
fsync buffers to disk
void setNoChildren(bool aNoChildren)
Specify, that the folder can't have children.
void viewConfigChanged()
Emitted when the variables for the config of the view have changed.
int countUnread()
Number of new or unread messages in this folder.
TQString subdirLocation() const
Returns full path to sub directory file.
KMFolder * trashFolder() const
If this folder has a special trash folder set, return it.
void emitMsgAddedSignals(int idx)
Called by derived classes implementation of addMsg.
int updateIndex()
Incrementally update the index if possible else call writeIndex.
int moveMsg(KMMessage *msg, int *index_return=0)
Detaches the given message from it's current folder and adds it to this folder.
int addMsgKeepUID(KMMessage *msg, int *index_return=0)
(Note(bo): This needs to be fixed better at a later point.) This is overridden by dIMAP because addMs...
void correctUnreadMsgsCount()
A cludge to help make sure the count of unread messges is kept in sync.
void setReadExpireUnits(ExpireUnits units)
Set units to use for expiry of read messages.
KMFolder(KMFolderDir *parent, const TQString &name, KMFolderType aFolderType, bool withIndex=true, bool exportedSernums=true)
Constructs a new Folder object.
TQString idString() const
Returns a string that can be used to identify this folder.
void msgStatusChanged(const KMMsgStatus oldStatus, const KMMsgStatus newStatus, int idx)
Called by KMMsgBase::setStatus when status of a message has changed required to keep the number unrea...
virtual TQString prettyURL() const
URL of the node for visualization purposes.
void shortcutChanged(KMFolder *)
Emitted when the shortcut associated with this folder changes.
void reallyAddCopyOfMsg(KMMessage *aMsg)
Add a copy of the message to the folder after it has been retrieved from an IMAP server.
int writeIndex(bool createEmptyIndex=false)
Write index to index-file.
void ignoreJobsForMessage(KMMessage *)
Removes and deletes all jobs associated with the particular message.
virtual TQString label() const
Returns the label of the folder for visualization.
bool noChildren() const
Returns, if the folder can't have children.
ExpireUnits getReadExpireUnits() const
Units getReadExpireAge() is returned in.
void markNewAsUnread()
Mark all new messages as unread.
bool isValidName(const TQString &folderName, TQString &message)
Returns true if the name is valid for a child of this folder.
TQString fileName() const
Returns the filename of the folder (reimplemented in KMFolderImap).
KMMsgInfo * unGetMsg(int idx)
Replace KMMessage with KMMsgInfo and delete KMMessage.
FolderJob * createJob(KMMessage *msg, FolderJob::JobType jt=FolderJob::tGetMessage, KMFolder *folder=0, TQString partSpecifier=TQString(), const AttachmentStrategy *as=0) const
These methods create respective FolderJob (You should derive FolderJob for each derived KMFolder).
int canAccess()
Check folder for permissions Returns zero if readable and writable.
int addMsg(KMMessage *msg, int *index_return=0)
Add the given message to the folder.
bool canDeleteMessages() const
Can messages in this folder be deleted?
TQString whoField() const
Get / set the name of the field that is used for the Sender/Receiver column in the headers (From/To).
int getReadExpireAge() const
Get the age at which read messages are expired.
bool isMessage(int idx)
Checks if the message is already "gotten" with getMsg.
void markUnreadAsRead()
Mark all new and unread messages as read.
DwString getDwString(int idx)
Read a message and returns a DwString.
bool needsCompacting() const
Returns true if the folder contains deleted messages.
void setUnreadExpireAge(int age)
Set the maximum age for unread messages in this folder.
KMMessage * take(int idx)
Detach message from this folder.
int expunge()
Delete entire folder.
int expungeOldMsg(int days)
Delete messages in the folder that are older than days.
bool isSystemFolder() const
Returns true if the folder is a kmail system folder.
void close(const char *owner, bool force=false)
Close folder.
void setDirty(bool f)
Change the dirty flag.
void setAutoExpire(bool enabled)
Set whether this folder automatically expires messages.
int rename(const TQString &newName, KMFolderDir *aParent=0)
Physically rename the folder.
KMFolderDir * createChildFolder()
Create a child folder directory and associates it with this folder.
void readConfig(TDEConfig *config)
This is used by the storage to read the folder specific configuration.
void expireOldMessages(bool immediate)
Expire old messages in this folder.
void setNoContent(bool aNoContent)
Specify, that the folder can't contain mails.
KMMessage * getMsg(int idx)
Read message at given index.
const KMMsgBase * getMsgBase(int idx) const
Provides access to the basic message fields that are also stored in the index.
KMFolderType folderType() const
Returns the type of this folder.
bool isMoveable() const
Returns true if this folder can be moved.
void folderSizeChanged(KMFolder *)
Emitted when the folder's size changes.
void setStatus(int idx, KMMsgStatus status, bool toggle=false)
Set the status of the message at index idx to status.
void setMailingListEnabled(bool enabled)
Returns true if this folder is associated with a mailing-list.
int count(bool cache=false) const
Number of messages in this folder.
const KMMsgBase * operator[](int idx) const
Same as getMsgBase(int).
TQString indexLocation() const
Returns full path to index file.
int open(const char *owner)
Open folder for access.
int countUnreadRecursive()
Number of new or unread messages in this folder and all folders contained by this folder.
bool isWritable() const
Can we write into and delete from this folder (on IMAP that's not necessarily !isReadOnly()).
void remove()
Removes the folder physically from disk and empties the contents of the folder in memory.
void compact(CompactOptions options)
Compact this folder.
TQString location() const
Returns full path to folder file.
bool noContent() const
Returns, if the folder can't contain mails, but only subfolder.
void setUnreadExpireUnits(ExpireUnits units)
Set units to use for expiry of unread messages.
void setReadExpireAge(int age)
Set the maximum age for read messages in this folder.
void writeConfig(TDEConfig *config) const
This is used by the storage to save the folder specific configuration.
KMFolderDir * child() const
Returns the folder directory associated with this node or 0 if no such directory exists.
void removeMsg(int i, bool imapQuiet=false)
Remove (first occurrence of) given message from the folder.
void quiet(bool beQuiet)
If set to quiet the folder will not emit msgAdded(idx) signal.
ExpireUnits getUnreadExpireUnits() const
Units getUnreadExpireAge() is returned in.
bool dirty() const
Returns true if the table of contents is dirty.
int find(const KMMsgBase *msg) const
Returns the index of the given message or -1 if not found.
void setChild(KMFolderDir *aChild)
Set the folder directory associated with this node.
void reallyAddMsg(KMMessage *aMsg)
Add the message to the folder after it has been retrieved from an IMAP server.
bool isReadOnly() const
Is the folder read-only?
void iconsChanged()
Emitted when the icon paths are set.
Class is used for all Mailing List handling inside KMail.
A scheduled "compact mails in this folder" task.
A scheduled "expire mails in this folder" task.