summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp3
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.cpp55
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.h1
3 files changed, 35 insertions, 24 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index 3aec13d..110583f 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -175,4 +175,5 @@ void IMAPwrapper::login()
if ( ssl ) {
- //qDebug("using ssl ");
+ qDebug("using ssl ");
err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port );
+ qDebug("back ");
} else {
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp
index de6d220..90b5d23 100644
--- a/kmicromail/libmailwrapper/mhwrapper.cpp
+++ b/kmicromail/libmailwrapper/mhwrapper.cpp
@@ -301,3 +301,30 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder)
}
+bool MHwrapper::rmDir(QString folder) // absolute path!
+{
+ QDir dir ( folder );
+ if ( !dir.exists() )
+ return false;
+ int i;
+ // qDebug("rmdir %s ",folder.latin1());
+ QStringList list = dir.entryList(QDir::Dirs|QDir::Files|QDir::NoSymLinks|QDir::Hidden );
+ for (i=0; i<list.count(); i++ ) {
+ bool result = true;
+ QString entry = folder+"/"+ list[i] ;
+ //qDebug("entry %s ",entry.latin1() );
+ QFileInfo fi ( entry );
+ if ( fi.isFile() ) {
+ //qDebug("file %s ",entry.latin1() );
+ result = QFile::remove ( entry ) ;
+ } else {
+ //qDebug("dir %s ",entry.latin1());
+ if ( list[i] != "." && list[i] != ".." )
+ result = rmDir( entry );
+ }
+ if ( ! result )
+ return false;
+ }
+ //qDebug("removing... ");
+ return QDir::root().rmdir ( folder, true );
+}
int MHwrapper::deleteMbox(const FolderP&tfolder)
@@ -317,26 +344,8 @@ int MHwrapper::deleteMbox(const FolderP&tfolder)
}
- QString delDir = locateLocal( "apps", "kopiemail")+ "localmail";
- qDebug("*****************\ndel %s %s ", delDir.latin1(),tfolder->getName().latin1() );
-#if 0
- QString cmd = "rm -rf "+tfolder->getName();
- QStringList command;
- command << "/bin/sh";
- command << "-c";
- command << cmd.latin1();
- OProcess *process = new OProcess();
-
- /*
- connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
- this, SLOT( processEnded(Opie::Core::OProcess*)));
- connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
- this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
- */
- *process << command;
- removeMboxfailed = false;
- if(!process->start(OProcess::Block, OProcess::All) ) {
- qDebug("could not start process ");
- return 0;
+ //qDebug("*****************\ndel %s %s ", delDir.latin1(),tfolder->getName().latin1() );
+ if ( !rmDir( tfolder->getName() )) {
+ qDebug("error deleteing folder %s ",tfolder->getName().latin1());
}
-#endif
- qDebug("mail box deleted ");
+ else
+ qDebug("mail box deleted %s ", tfolder->getName().latin1());
return 1;
diff --git a/kmicromail/libmailwrapper/mhwrapper.h b/kmicromail/libmailwrapper/mhwrapper.h
index 87f8ca1..36a443a 100644
--- a/kmicromail/libmailwrapper/mhwrapper.h
+++ b/kmicromail/libmailwrapper/mhwrapper.h
@@ -53,2 +53,3 @@ protected:
void clean_storage();
+ bool rmDir(QString folderabspath);