Lines 1373-1384
Link Here
|
1373 |
|
1373 |
|
1374 |
KMFilterAction::ReturnCode KMFilterActionCopy::process(KMMessage* msg) const |
1374 |
KMFilterAction::ReturnCode KMFilterActionCopy::process(KMMessage* msg) const |
1375 |
{ |
1375 |
{ |
|
|
1376 |
bool opened = false; |
1377 |
|
1376 |
// TODO opening and closing the folder is a trade off. |
1378 |
// TODO opening and closing the folder is a trade off. |
1377 |
// Perhaps Copy is a seldomly used action for now, |
1379 |
// Perhaps Copy is a seldomly used action for now, |
1378 |
// but I gonna look at improvements ASAP. |
1380 |
// but I gonna look at improvements ASAP. |
1379 |
if ( !mFolder && mFolder->open() != 0 ) |
1381 |
if ( !mFolder ) { |
1380 |
return ErrorButGoOn; |
1382 |
if (!mFolder->isOpened()) { |
1381 |
|
1383 |
int rc; |
|
|
1384 |
opened = true; |
1385 |
rc = mFolder->open(); |
1386 |
kdDebug(5006) << "KMFolderMaildir::addMsg-open: " << rc << " of folder: " << label() << endl; |
1387 |
if (rc) return ErrorButGoOn; |
1388 |
} |
1389 |
} |
1390 |
|
1382 |
// copy the message 1:1 |
1391 |
// copy the message 1:1 |
1383 |
KMMessage* msgCopy = new KMMessage; |
1392 |
KMMessage* msgCopy = new KMMessage; |
1384 |
msgCopy->fromDwString(msg->asDwString()); |
1393 |
msgCopy->fromDwString(msg->asDwString()); |
Lines 1387-1394
Link Here
|
1387 |
int rc = mFolder->addMsg(msgCopy, &index); |
1396 |
int rc = mFolder->addMsg(msgCopy, &index); |
1388 |
if (rc == 0 && index != -1) |
1397 |
if (rc == 0 && index != -1) |
1389 |
mFolder->unGetMsg( index ); |
1398 |
mFolder->unGetMsg( index ); |
1390 |
mFolder->close(); |
|
|
1391 |
|
1399 |
|
|
|
1400 |
if (opened) mFolder->close(); |
1401 |
|
1392 |
return GoOn; |
1402 |
return GoOn; |
1393 |
} |
1403 |
} |
1394 |
|
1404 |
|