author | zautrix <zautrix> | 2004-10-31 08:38:17 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-31 08:38:17 (UTC) |
commit | f77a9457e676a11520c8f52b33265cd825db0c79 (patch) (unidiff) | |
tree | d35fc3ef29edf54f413c40621ae760407f659d0c /kmicromail | |
parent | c48af43f15e8917a441fc8ca4e1bc3adfd1d822e (diff) | |
download | kdepimpi-f77a9457e676a11520c8f52b33265cd825db0c79.zip kdepimpi-f77a9457e676a11520c8f52b33265cd825db0c79.tar.gz kdepimpi-f77a9457e676a11520c8f52b33265cd825db0c79.tar.bz2 |
added delete dir to ompi
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 3 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.cpp | 57 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.h | 1 |
3 files changed, 36 insertions, 25 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 | |||
@@ -170,14 +170,15 @@ void IMAPwrapper::login() | |||
170 | } | 170 | } |
171 | if (account->ConnectionType()==1) { | 171 | if (account->ConnectionType()==1) { |
172 | force_tls = true; | 172 | force_tls = true; |
173 | } | 173 | } |
174 | 174 | ||
175 | if ( ssl ) { | 175 | if ( ssl ) { |
176 | //qDebug("using ssl "); | 176 | qDebug("using ssl "); |
177 | err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); | 177 | err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); |
178 | qDebug("back "); | ||
178 | } else { | 179 | } else { |
179 | err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); | 180 | err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); |
180 | } | 181 | } |
181 | 182 | ||
182 | if ( err != MAILIMAP_NO_ERROR && | 183 | if ( err != MAILIMAP_NO_ERROR && |
183 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && | 184 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && |
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 | |||
@@ -296,13 +296,40 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder) | |||
296 | break; | 296 | break; |
297 | } | 297 | } |
298 | } | 298 | } |
299 | if (l) mailmessage_list_free(l); | 299 | if (l) mailmessage_list_free(l); |
300 | return res; | 300 | return res; |
301 | } | 301 | } |
302 | 302 | bool MHwrapper::rmDir(QString folder) // absolute path! | |
303 | { | ||
304 | QDir dir ( folder ); | ||
305 | if ( !dir.exists() ) | ||
306 | return false; | ||
307 | int i; | ||
308 | // qDebug("rmdir %s ",folder.latin1()); | ||
309 | QStringList list = dir.entryList(QDir::Dirs|QDir::Files|QDir::NoSymLinks|QDir::Hidden ); | ||
310 | for (i=0; i<list.count(); i++ ) { | ||
311 | bool result = true; | ||
312 | QString entry = folder+"/"+ list[i] ; | ||
313 | //qDebug("entry %s ",entry.latin1() ); | ||
314 | |||
315 | QFileInfo fi ( entry ); | ||
316 | if ( fi.isFile() ) { | ||
317 | //qDebug("file %s ",entry.latin1() ); | ||
318 | result = QFile::remove ( entry ) ; | ||
319 | } else { | ||
320 | //qDebug("dir %s ",entry.latin1()); | ||
321 | if ( list[i] != "." && list[i] != ".." ) | ||
322 | result = rmDir( entry ); | ||
323 | } | ||
324 | if ( ! result ) | ||
325 | return false; | ||
326 | } | ||
327 | //qDebug("removing... "); | ||
328 | return QDir::root().rmdir ( folder, true ); | ||
329 | } | ||
303 | int MHwrapper::deleteMbox(const FolderP&tfolder) | 330 | int MHwrapper::deleteMbox(const FolderP&tfolder) |
304 | { | 331 | { |
305 | init_storage(); | 332 | init_storage(); |
306 | if (!m_storage) { | 333 | if (!m_storage) { |
307 | return 0; | 334 | return 0; |
308 | } | 335 | } |
@@ -312,36 +339,18 @@ int MHwrapper::deleteMbox(const FolderP&tfolder) | |||
312 | int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); | 339 | int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); |
313 | 340 | ||
314 | if (r != MAIL_NO_ERROR) { | 341 | if (r != MAIL_NO_ERROR) { |
315 | qDebug("error deleting mail box "); | 342 | qDebug("error deleting mail box "); |
316 | return 0; | 343 | return 0; |
317 | } | 344 | } |
318 | QString delDir = locateLocal( "apps", "kopiemail")+ "localmail"; | 345 | //qDebug("*****************\ndel %s %s ", delDir.latin1(),tfolder->getName().latin1() ); |
319 | qDebug("*****************\ndel %s %s ", delDir.latin1(),tfolder->getName().latin1() ); | 346 | if ( !rmDir( tfolder->getName() )) { |
320 | #if 0 | 347 | qDebug("error deleteing folder %s ",tfolder->getName().latin1()); |
321 | QString cmd = "rm -rf "+tfolder->getName(); | ||
322 | QStringList command; | ||
323 | command << "/bin/sh"; | ||
324 | command << "-c"; | ||
325 | command << cmd.latin1(); | ||
326 | OProcess *process = new OProcess(); | ||
327 | |||
328 | /* | ||
329 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), | ||
330 | this, SLOT( processEnded(Opie::Core::OProcess*))); | ||
331 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), | ||
332 | this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); | ||
333 | */ | ||
334 | *process << command; | ||
335 | removeMboxfailed = false; | ||
336 | if(!process->start(OProcess::Block, OProcess::All) ) { | ||
337 | qDebug("could not start process "); | ||
338 | return 0; | ||
339 | } | 348 | } |
340 | #endif | 349 | else |
341 | qDebug("mail box deleted "); | 350 | qDebug("mail box deleted %s ", tfolder->getName().latin1()); |
342 | return 1; | 351 | return 1; |
343 | } | 352 | } |
344 | 353 | ||
345 | 354 | ||
346 | void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | 355 | void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) |
347 | { | 356 | { |
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 | |||
@@ -48,11 +48,12 @@ protected: | |||
48 | QString buildPath(const QString&p); | 48 | QString buildPath(const QString&p); |
49 | QString MHPath; | 49 | QString MHPath; |
50 | QString MHName; | 50 | QString MHName; |
51 | 51 | ||
52 | void init_storage(); | 52 | void init_storage(); |
53 | void clean_storage(); | 53 | void clean_storage(); |
54 | bool rmDir(QString folderabspath); | ||
54 | 55 | ||
55 | bool removeMboxfailed; | 56 | bool removeMboxfailed; |
56 | }; | 57 | }; |
57 | 58 | ||
58 | #endif | 59 | #endif |