author | alwin <alwin> | 2004-03-12 14:12:00 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-12 14:12:00 (UTC) |
commit | d1929ef43f0eaaa17aa42196384d1ed925132873 (patch) (unidiff) | |
tree | eff911f93fe7919d7820e5a2e68b72f2f76143da /noncore/net/mail/libmailwrapper/mhwrapper.cpp | |
parent | d38384a6edb0110117e0297864f813b379d52789 (diff) | |
download | opie-d1929ef43f0eaaa17aa42196384d1ed925132873.zip opie-d1929ef43f0eaaa17aa42196384d1ed925132873.tar.gz opie-d1929ef43f0eaaa17aa42196384d1ed925132873.tar.bz2 |
some pointers embedded into osmart_pointer handling
Diffstat (limited to 'noncore/net/mail/libmailwrapper/mhwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/mhwrapper.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 560eab0..aaaa20a 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp | |||
@@ -73,16 +73,15 @@ void MHwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
73 | return; | 73 | return; |
74 | } | 74 | } |
75 | parseList(target,m_storage->sto_session,f); | 75 | parseList(target,m_storage->sto_session,f); |
76 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); | 76 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); |
77 | } | 77 | } |
78 | 78 | ||
79 | QList<Folder>* MHwrapper::listFolders() | 79 | QValueList<Opie::osmart_pointer<Folder> >* MHwrapper::listFolders() |
80 | { | 80 | { |
81 | QList<Folder> * folders = new QList<Folder>(); | 81 | QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); |
82 | folders->setAutoDelete( false ); | ||
83 | /* this is needed! */ | 82 | /* this is needed! */ |
84 | if (m_storage) mailstorage_disconnect(m_storage); | 83 | if (m_storage) mailstorage_disconnect(m_storage); |
85 | init_storage(); | 84 | init_storage(); |
86 | if (!m_storage) { | 85 | if (!m_storage) { |
87 | return folders; | 86 | return folders; |
88 | } | 87 | } |
@@ -141,13 +140,13 @@ RecBody MHwrapper::fetchBody( const RecMail &mail ) | |||
141 | } | 140 | } |
142 | r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg); | 141 | r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg); |
143 | if (r != MAIL_NO_ERROR) { | 142 | if (r != MAIL_NO_ERROR) { |
144 | qDebug("Error fetching mail %i",mail.getNumber()); | 143 | qDebug("Error fetching mail %i",mail.getNumber()); |
145 | return body; | 144 | return body; |
146 | } | 145 | } |
147 | body = parseMail(msg); | 146 | body = parseMail(msg); |
148 | mailmessage_fetch_result_free(msg,data); | 147 | mailmessage_fetch_result_free(msg,data); |
149 | return body; | 148 | return body; |
150 | } | 149 | } |
151 | 150 | ||
152 | void MHwrapper::mbox_progress( size_t current, size_t maximum ) | 151 | void MHwrapper::mbox_progress( size_t current, size_t maximum ) |
153 | { | 152 | { |
@@ -166,13 +165,13 @@ QString MHwrapper::buildPath(const QString&p) | |||
166 | f+="/"; | 165 | f+="/"; |
167 | } | 166 | } |
168 | f+=p; | 167 | f+=p; |
169 | return f; | 168 | return f; |
170 | } | 169 | } |
171 | 170 | ||
172 | int MHwrapper::createMbox(const QString&folder,const Folder*pfolder,const QString&,bool ) | 171 | int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) |
173 | { | 172 | { |
174 | init_storage(); | 173 | init_storage(); |
175 | if (!m_storage) { | 174 | if (!m_storage) { |
176 | return 0; | 175 | return 0; |
177 | } | 176 | } |
178 | QString f; | 177 | QString f; |
@@ -260,13 +259,13 @@ void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) | |||
260 | qDebug("error deleting mail"); | 259 | qDebug("error deleting mail"); |
261 | break; | 260 | break; |
262 | } | 261 | } |
263 | } | 262 | } |
264 | } | 263 | } |
265 | 264 | ||
266 | int MHwrapper::deleteAllMail(const Folder*tfolder) | 265 | int MHwrapper::deleteAllMail(const FolderP&tfolder) |
267 | { | 266 | { |
268 | init_storage(); | 267 | init_storage(); |
269 | if (!m_storage) { | 268 | if (!m_storage) { |
270 | return 0; | 269 | return 0; |
271 | } | 270 | } |
272 | int res = 1; | 271 | int res = 1; |
@@ -295,34 +294,34 @@ int MHwrapper::deleteAllMail(const Folder*tfolder) | |||
295 | } | 294 | } |
296 | } | 295 | } |
297 | if (l) mailmessage_list_free(l); | 296 | if (l) mailmessage_list_free(l); |
298 | return res; | 297 | return res; |
299 | } | 298 | } |
300 | 299 | ||
301 | int MHwrapper::deleteMbox(const Folder*tfolder) | 300 | int MHwrapper::deleteMbox(const FolderP&tfolder) |
302 | { | 301 | { |
303 | init_storage(); | 302 | init_storage(); |
304 | if (!m_storage) { | 303 | if (!m_storage) { |
305 | return 0; | 304 | return 0; |
306 | } | 305 | } |
307 | if (!tfolder) return 0; | 306 | if (!tfolder) return 0; |
308 | if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; | 307 | if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; |
309 | 308 | ||
310 | int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); | 309 | int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); |
311 | 310 | ||
312 | if (r != MAIL_NO_ERROR) { | 311 | if (r != MAIL_NO_ERROR) { |
313 | qDebug("error deleting mail box"); | 312 | qDebug("error deleting mail box"); |
314 | return 0; | 313 | return 0; |
315 | } | 314 | } |
316 | QString cmd = "rm -rf "+tfolder->getName(); | 315 | QString cmd = "rm -rf "+tfolder->getName(); |
317 | QStringList command; | 316 | QStringList command; |
318 | command << "/bin/sh"; | 317 | command << "/bin/sh"; |
319 | command << "-c"; | 318 | command << "-c"; |
320 | command << cmd.latin1(); | 319 | command << cmd.latin1(); |
321 | OProcess *process = new OProcess(); | 320 | OProcess *process = new OProcess(); |
322 | 321 | ||
323 | connect(process, SIGNAL(processExited(OProcess*)), | 322 | connect(process, SIGNAL(processExited(OProcess*)), |
324 | this, SLOT( processEnded(OProcess*))); | 323 | this, SLOT( processEnded(OProcess*))); |
325 | connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)), | 324 | connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)), |
326 | this, SLOT( oprocessStderr(OProcess*,char*,int))); | 325 | this, SLOT( oprocessStderr(OProcess*,char*,int))); |
327 | 326 | ||
328 | *process << command; | 327 | *process << command; |
@@ -383,13 +382,13 @@ void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractM | |||
383 | qDebug("Using generic"); | 382 | qDebug("Using generic"); |
384 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); | 383 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); |
385 | return; | 384 | return; |
386 | } | 385 | } |
387 | qDebug("Using internal routines for move/copy"); | 386 | qDebug("Using internal routines for move/copy"); |
388 | QString tf = buildPath(targetFolder); | 387 | QString tf = buildPath(targetFolder); |
389 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); | 388 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); |
390 | if (r != MAIL_NO_ERROR) { | 389 | if (r != MAIL_NO_ERROR) { |
391 | qDebug("Error selecting source mailbox"); | 390 | qDebug("Error selecting source mailbox"); |
392 | return; | 391 | return; |
393 | } | 392 | } |
394 | if (moveit) { | 393 | if (moveit) { |
395 | r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); | 394 | r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); |
@@ -398,13 +397,14 @@ void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractM | |||
398 | } | 397 | } |
399 | if (r != MAIL_NO_ERROR) { | 398 | if (r != MAIL_NO_ERROR) { |
400 | qDebug("Error copy/moving mail internal (%i)",r); | 399 | qDebug("Error copy/moving mail internal (%i)",r); |
401 | } | 400 | } |
402 | } | 401 | } |
403 | 402 | ||
404 | void MHwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 403 | void MHwrapper::mvcpAllMails(const FolderP&fromFolder, |
404 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | ||
405 | { | 405 | { |
406 | init_storage(); | 406 | init_storage(); |
407 | if (!m_storage) { | 407 | if (!m_storage) { |
408 | return; | 408 | return; |
409 | } | 409 | } |
410 | if (targetWrapper != this) { | 410 | if (targetWrapper != this) { |