summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/mhwrapper.cpp
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/mhwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp
index f4133c0..de6d220 100644
--- a/kmicromail/libmailwrapper/mhwrapper.cpp
+++ b/kmicromail/libmailwrapper/mhwrapper.cpp
@@ -1,24 +1,24 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#include "mhwrapper.h" 2#include "mhwrapper.h"
3#include "mailtypes.h" 3#include "mailtypes.h"
4#include "mailwrapper.h" 4#include "mailwrapper.h"
5#include <libetpan/libetpan.h> 5#include <libetpan/libetpan.h>
6#include <qdir.h> 6#include <qdir.h>
7#include <qmessagebox.h> 7#include <qmessagebox.h>
8#include <stdlib.h> 8#include <stdlib.h>
9#include <qpe/global.h> 9#include <qpe/global.h>
10#include <oprocess.h>
11#include <klocale.h> 10#include <klocale.h>
12//#include <opie2/odebug.h> 11#include <kglobal.h>
12//#include <opie2/odebug.h>
13 13
14using namespace Opie::Core; 14using namespace Opie::Core;
15MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) 15MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
16 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) 16 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
17{ 17{
18 if (MHPath.length()>0) { 18 if (MHPath.length()>0) {
19 if (MHPath[MHPath.length()-1]=='/') { 19 if (MHPath[MHPath.length()-1]=='/') {
20 MHPath=MHPath.left(MHPath.length()-1); 20 MHPath=MHPath.left(MHPath.length()-1);
21 } 21 }
22 //odebug << MHPath << oendl; 22 //odebug << MHPath << oendl;
23 QDir dir(MHPath); 23 QDir dir(MHPath);
24 if (!dir.exists()) { 24 if (!dir.exists()) {
@@ -306,57 +306,51 @@ int MHwrapper::deleteMbox(const FolderP&tfolder)
306 if (!m_storage) { 306 if (!m_storage) {
307 return 0; 307 return 0;
308 } 308 }
309 if (!tfolder) return 0; 309 if (!tfolder) return 0;
310 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; 310 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0;
311 311
312 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 312 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
313 313
314 if (r != MAIL_NO_ERROR) { 314 if (r != MAIL_NO_ERROR) {
315 qDebug("error deleting mail box "); 315 qDebug("error deleting mail box ");
316 return 0; 316 return 0;
317 } 317 }
318 QString delDir = locateLocal( "apps", "kopiemail")+ "localmail";
319 qDebug("*****************\ndel %s %s ", delDir.latin1(),tfolder->getName().latin1() );
320#if 0
318 QString cmd = "rm -rf "+tfolder->getName(); 321 QString cmd = "rm -rf "+tfolder->getName();
319 QStringList command; 322 QStringList command;
320 command << "/bin/sh"; 323 command << "/bin/sh";
321 command << "-c"; 324 command << "-c";
322 command << cmd.latin1(); 325 command << cmd.latin1();
323 OProcess *process = new OProcess(); 326 OProcess *process = new OProcess();
324 327
328 /*
325 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), 329 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
326 this, SLOT( processEnded(Opie::Core::OProcess*))); 330 this, SLOT( processEnded(Opie::Core::OProcess*)));
327 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), 331 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
328 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); 332 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
329 333 */
330 *process << command; 334 *process << command;
331 removeMboxfailed = false; 335 removeMboxfailed = false;
332 if(!process->start(OProcess::Block, OProcess::All) ) { 336 if(!process->start(OProcess::Block, OProcess::All) ) {
333 qDebug("could not start process "); 337 qDebug("could not start process ");
334 return 0; 338 return 0;
335 } 339 }
340#endif
336 qDebug("mail box deleted "); 341 qDebug("mail box deleted ");
337 return 1; 342 return 1;
338} 343}
339 344
340void MHwrapper::processEnded(OProcess *p)
341{
342 if (p) delete p;
343}
344
345void MHwrapper::oprocessStderr(OProcess*, char *buffer, int )
346{
347 QString lineStr = buffer;
348 QMessageBox::warning( 0, i18n("Error"), lineStr ,i18n("Ok") );
349 removeMboxfailed = true;
350}
351 345
352void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 346void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
353{ 347{
354 init_storage(); 348 init_storage();
355 if (!m_storage) { 349 if (!m_storage) {
356 return; 350 return;
357 } 351 }
358 target_stat.message_count = 0; 352 target_stat.message_count = 0;
359 target_stat.message_unseen = 0; 353 target_stat.message_unseen = 0;
360 target_stat.message_recent = 0; 354 target_stat.message_recent = 0;
361 QString f = buildPath(mailbox); 355 QString f = buildPath(mailbox);
362 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, 356 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count,