[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 75866] JJ: rename sent-messages folder at start of month
From: Marc-Antoine Avon-Charreyron <mavon006 () uottawa ! ca>
Date: 2004-10-18 15:37:49
Message-ID: 20041018153749.3412.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=75866
------- Additional Comments From mavon006 uottawa ca 2004-10-18 17:37 -------
Yeah I guess code might help :D
-thisMonth is called in the KMKernel constructor and determines the present month to \
check if it has changed
-A timer is created in KMKernel to check if the month has changed and if so it calls \
KMKernel::moveSentMail()
void KMKernel::moveSentMail()
{
int doMove=-1;
doMove = KMessageBox::questionYesNo(0, i18n("Move sent mail to a monthly \
folder?")); if (doMove == KMessageBox::No)
return;
QStringList actList = acctMgr()->getAccounts(false);
QStringList::Iterator it( actList.begin() );
for( ; it != actList.end() ; ++it ){
acct = acctMgr()->findByName(*it);
acct->moveSentMail(thisMonth);
}
void KMAccount::moveSentMail(int month)
{
int i, count, doMove=-1;
char date[8];
KMMsgBase *email;
KMMessage *msg;
KMFolderDir *fldrDir;
KMFolderNode *node;
KMFolder *newFldr;
time_t t;
struct tm *mTime;
sentFldr->open();
count=sentFldr->count(true);
for(i=0; i<count; i++){
email = sentFldr->getMsgBase(i);
t = email->date();
mTime = localtime(&t);
if(month != mTime->tm_mon){
if(doMove != KMessageBox::Yes)
doMove = KMessageBox::questionYesNo(0, i18n("Move sent mail to a monthly \
folder?")); if (doMove == KMessageBox::No)
return;
msg = sentFldr->getMsg(i);
if((fldrDir=sentFldr->child()) == 0)
fldrDir=sentFldr->createChildFolder();
snprintf(date, 8, "%d-%02d", ((mTime->tm_year)+1900), (mTime->tm_mon));
node=fldrDir->hasNamedFolder(i18n(date));
if(node==0)
newFldr=fldrDir->createFolder(i18n(date), false, KMFolderTypeMbox);
else
newFldr=(KMFolder*)node;
newFldr->moveMsg(msg);
count=sentFldr->count(true);
i=-1;
}
}
}
Any other suggestion/criticism would welcomed, has this is the first time I'm writing \
a patch so I'm not too sure about conventions and so. For example i'm not sure if my \
code is in the right class or if it should be divided so code in each one is not too \
long, etc...
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic