summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.cpp13
-rw-r--r--kmicromail/libmailwrapper/sendmailprogress.cpp5
-rw-r--r--kmicromail/main.cpp1
-rw-r--r--kmicromail/opiemail.cpp1
4 files changed, 11 insertions, 9 deletions
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp
index 641d4d9..f4133c0 100644
--- a/kmicromail/libmailwrapper/mhwrapper.cpp
+++ b/kmicromail/libmailwrapper/mhwrapper.cpp
@@ -1,446 +1,447 @@
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> 10#include <oprocess.h>
11#include <klocale.h>
11//#include <opie2/odebug.h> 12//#include <opie2/odebug.h>
12 13
13using namespace Opie::Core; 14using namespace Opie::Core;
14MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) 15MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
15 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) 16 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
16{ 17{
17 if (MHPath.length()>0) { 18 if (MHPath.length()>0) {
18 if (MHPath[MHPath.length()-1]=='/') { 19 if (MHPath[MHPath.length()-1]=='/') {
19 MHPath=MHPath.left(MHPath.length()-1); 20 MHPath=MHPath.left(MHPath.length()-1);
20 } 21 }
21 //odebug << MHPath << oendl; 22 //odebug << MHPath << oendl;
22 QDir dir(MHPath); 23 QDir dir(MHPath);
23 if (!dir.exists()) { 24 if (!dir.exists()) {
24 dir.mkdir(MHPath); 25 dir.mkdir(MHPath);
25 } 26 }
26 init_storage(); 27 init_storage();
27 } 28 }
28} 29}
29 30
30void MHwrapper::init_storage() 31void MHwrapper::init_storage()
31{ 32{
32 int r; 33 int r;
33 QString pre = MHPath; 34 QString pre = MHPath;
34 if (!m_storage) { 35 if (!m_storage) {
35 m_storage = mailstorage_new(NULL); 36 m_storage = mailstorage_new(NULL);
36 r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); 37 r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0);
37 if (r != MAIL_NO_ERROR) { 38 if (r != MAIL_NO_ERROR) {
38 qDebug(" error init storage "); 39 qDebug(" error init storage ");
39 mailstorage_free(m_storage); 40 mailstorage_free(m_storage);
40 m_storage = 0; 41 m_storage = 0;
41 return; 42 return;
42 } 43 }
43 } 44 }
44 r = mailstorage_connect(m_storage); 45 r = mailstorage_connect(m_storage);
45 if (r!=MAIL_NO_ERROR) { 46 if (r!=MAIL_NO_ERROR) {
46 qDebug("error connecting storage "); 47 qDebug("error connecting storage ");
47 mailstorage_free(m_storage); 48 mailstorage_free(m_storage);
48 m_storage = 0; 49 m_storage = 0;
49 } 50 }
50} 51}
51 52
52void MHwrapper::clean_storage() 53void MHwrapper::clean_storage()
53{ 54{
54 if (m_storage) { 55 if (m_storage) {
55 mailstorage_disconnect(m_storage); 56 mailstorage_disconnect(m_storage);
56 mailstorage_free(m_storage); 57 mailstorage_free(m_storage);
57 m_storage = 0; 58 m_storage = 0;
58 } 59 }
59} 60}
60 61
61MHwrapper::~MHwrapper() 62MHwrapper::~MHwrapper()
62{ 63{
63 clean_storage(); 64 clean_storage();
64} 65}
65 66
66void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) 67void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
67{ 68{
68 init_storage(); 69 init_storage();
69 if (!m_storage) { 70 if (!m_storage) {
70 return; 71 return;
71 } 72 }
72 QString f = buildPath(mailbox); 73 QString f = buildPath(mailbox);
73 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 74 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
74 if (r!=MAIL_NO_ERROR) { 75 if (r!=MAIL_NO_ERROR) {
75 qDebug("listMessages: error selecting folder! "); 76 qDebug("listMessages: error selecting folder! ");
76 return; 77 return;
77 } 78 }
78 parseList(target,m_storage->sto_session,f, false, maxSizeInKb ); 79 parseList(target,m_storage->sto_session,f, false, maxSizeInKb );
79 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); 80 Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count()));
80} 81}
81 82
82QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() 83QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
83{ 84{
84 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); 85 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
85 /* this is needed! */ 86 /* this is needed! */
86 if (m_storage) mailstorage_disconnect(m_storage); 87 if (m_storage) mailstorage_disconnect(m_storage);
87 init_storage(); 88 init_storage();
88 if (!m_storage) { 89 if (!m_storage) {
89 return folders; 90 return folders;
90 } 91 }
91 mail_list*flist = 0; 92 mail_list*flist = 0;
92 clistcell*current=0; 93 clistcell*current=0;
93 int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); 94 int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist);
94 if (r != MAIL_NO_ERROR || !flist) { 95 if (r != MAIL_NO_ERROR || !flist) {
95 qDebug("error getting folder list "); 96 qDebug("error getting folder list ");
96 return folders; 97 return folders;
97 } 98 }
98 for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) { 99 for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) {
99 QString t = (char*)current->data; 100 QString t = (char*)current->data;
100 t.replace(0,MHPath.length(),""); 101 t.replace(0,MHPath.length(),"");
101 folders->append(new MHFolder(t,MHPath)); 102 folders->append(new MHFolder(t,MHPath));
102 } 103 }
103 mail_list_free(flist); 104 mail_list_free(flist);
104 return folders; 105 return folders;
105} 106}
106 107
107void MHwrapper::deleteMail(const RecMailP&mail) 108void MHwrapper::deleteMail(const RecMailP&mail)
108{ 109{
109 init_storage(); 110 init_storage();
110 if (!m_storage) { 111 if (!m_storage) {
111 return; 112 return;
112 } 113 }
113 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 114 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
114 if (r!=MAIL_NO_ERROR) { 115 if (r!=MAIL_NO_ERROR) {
115 qDebug("error selecting folder! "); 116 qDebug("error selecting folder! ");
116 return; 117 return;
117 } 118 }
118 r = mailsession_remove_message(m_storage->sto_session,mail->getNumber()); 119 r = mailsession_remove_message(m_storage->sto_session,mail->getNumber());
119 if (r != MAIL_NO_ERROR) { 120 if (r != MAIL_NO_ERROR) {
120 qDebug("error deleting mail "); 121 qDebug("error deleting mail ");
121 } 122 }
122} 123}
123 124
124void MHwrapper::answeredMail(const RecMailP&) 125void MHwrapper::answeredMail(const RecMailP&)
125{ 126{
126} 127}
127 128
128RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) 129RecBodyP MHwrapper::fetchBody( const RecMailP &mail )
129{ 130{
130 RecBodyP body = new RecBody(); 131 RecBodyP body = new RecBody();
131 init_storage(); 132 init_storage();
132 if (!m_storage) { 133 if (!m_storage) {
133 return body; 134 return body;
134 } 135 }
135 mailmessage * msg; 136 mailmessage * msg;
136 char*data=0; 137 char*data=0;
137 138
138 /* mail should hold the complete path! */ 139 /* mail should hold the complete path! */
139 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 140 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
140 if (r != MAIL_NO_ERROR) { 141 if (r != MAIL_NO_ERROR) {
141 return body; 142 return body;
142 } 143 }
143 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); 144 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
144 if (r != MAIL_NO_ERROR) { 145 if (r != MAIL_NO_ERROR) {
145 qDebug("Error fetching mail "); 146 qDebug("Error fetching mail ");
146 147
147 return body; 148 return body;
148 } 149 }
149 body = parseMail(msg); 150 body = parseMail(msg);
150 mailmessage_fetch_result_free(msg,data); 151 mailmessage_fetch_result_free(msg,data);
151 return body; 152 return body;
152} 153}
153 154
154void MHwrapper::mbox_progress( size_t current, size_t maximum ) 155void MHwrapper::mbox_progress( size_t current, size_t maximum )
155{ 156{
156 qDebug("MBox Progress %d of %d",current,maximum ); 157 qDebug("MBox Progress %d of %d",current,maximum );
157 //odebug << "MH " << current << " von " << maximum << "" << oendl; 158 //odebug << "MH " << current << " von " << maximum << "" << oendl;
158} 159}
159 160
160QString MHwrapper::buildPath(const QString&p) 161QString MHwrapper::buildPath(const QString&p)
161{ 162{
162 QString f=""; 163 QString f="";
163 if (p.length()==0||p=="/") 164 if (p.length()==0||p=="/")
164 return MHPath; 165 return MHPath;
165 if (!p.startsWith(MHPath)) { 166 if (!p.startsWith(MHPath)) {
166 f+=MHPath; 167 f+=MHPath;
167 } 168 }
168 if (!p.startsWith("/")) { 169 if (!p.startsWith("/")) {
169 f+="/"; 170 f+="/";
170 } 171 }
171 f+=p; 172 f+=p;
172 return f; 173 return f;
173} 174}
174 175
175int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) 176int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool )
176{ 177{
177 init_storage(); 178 init_storage();
178 if (!m_storage) { 179 if (!m_storage) {
179 return 0; 180 return 0;
180 } 181 }
181 QString f; 182 QString f;
182 if (!pfolder) { 183 if (!pfolder) {
183 // toplevel folder 184 // toplevel folder
184 f = buildPath(folder); 185 f = buildPath(folder);
185 } else { 186 } else {
186 f = pfolder->getName(); 187 f = pfolder->getName();
187 f+="/"; 188 f+="/";
188 f+=folder; 189 f+=folder;
189 } 190 }
190 191
191 int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); 192 int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1());
192 if (r != MAIL_NO_ERROR) { 193 if (r != MAIL_NO_ERROR) {
193 qDebug("error creating folder "); 194 qDebug("error creating folder ");
194 return 0; 195 return 0;
195 } 196 }
196 return 1; 197 return 1;
197} 198}
198 199
199void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) 200void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
200{ 201{
201 init_storage(); 202 init_storage();
202 if (!m_storage) { 203 if (!m_storage) {
203 return; 204 return;
204 } 205 }
205 QString f = buildPath(Folder); 206 QString f = buildPath(Folder);
206 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 207 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
207 if (r!=MAIL_NO_ERROR) { 208 if (r!=MAIL_NO_ERROR) {
208 qDebug("error selecting folder! "); 209 qDebug("error selecting folder! ");
209 return; 210 return;
210 } 211 }
211 r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); 212 r = mailsession_append_message(m_storage->sto_session,(char*)msg,length);
212 if (r!=MAIL_NO_ERROR) { 213 if (r!=MAIL_NO_ERROR) {
213 qDebug("error storing mail "); 214 qDebug("error storing mail ");
214 } 215 }
215 return; 216 return;
216} 217}
217 218
218encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) 219encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
219{ 220{
220 encodedString*result = 0; 221 encodedString*result = 0;
221 init_storage(); 222 init_storage();
222 if (!m_storage) { 223 if (!m_storage) {
223 return result; 224 return result;
224 } 225 }
225 mailmessage * msg = 0; 226 mailmessage * msg = 0;
226 char*data=0; 227 char*data=0;
227 size_t size; 228 size_t size;
228 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 229 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
229 if (r!=MAIL_NO_ERROR) { 230 if (r!=MAIL_NO_ERROR) {
230 qDebug("error selecting folder! "); 231 qDebug("error selecting folder! ");
231 return result; 232 return result;
232 } 233 }
233 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); 234 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
234 if (r != MAIL_NO_ERROR) { 235 if (r != MAIL_NO_ERROR) {
235 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 236 Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
236 return 0; 237 return 0;
237 } 238 }
238 r = mailmessage_fetch(msg,&data,&size); 239 r = mailmessage_fetch(msg,&data,&size);
239 if (r != MAIL_NO_ERROR) { 240 if (r != MAIL_NO_ERROR) {
240 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 241 Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
241 if (msg) mailmessage_free(msg); 242 if (msg) mailmessage_free(msg);
242 return 0; 243 return 0;
243 } 244 }
244 result = new encodedString(data,size); 245 result = new encodedString(data,size);
245 if (msg) mailmessage_free(msg); 246 if (msg) mailmessage_free(msg);
246 return result; 247 return result;
247} 248}
248 249
249void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) 250void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
250{ 251{
251 QString f = buildPath(mailbox); 252 QString f = buildPath(mailbox);
252 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 253 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
253 if (r!=MAIL_NO_ERROR) { 254 if (r!=MAIL_NO_ERROR) {
254 qDebug("deleteMails: error selecting folder! "); 255 qDebug("deleteMails: error selecting folder! ");
255 return; 256 return;
256 } 257 }
257 QValueList<RecMailP>::ConstIterator it; 258 QValueList<RecMailP>::ConstIterator it;
258 for (it=target.begin(); it!=target.end();++it) { 259 for (it=target.begin(); it!=target.end();++it) {
259 r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); 260 r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
260 if (r != MAIL_NO_ERROR) { 261 if (r != MAIL_NO_ERROR) {
261 qDebug("error deleting mail "); 262 qDebug("error deleting mail ");
262 break; 263 break;
263 } 264 }
264 } 265 }
265} 266}
266 267
267int MHwrapper::deleteAllMail(const FolderP&tfolder) 268int MHwrapper::deleteAllMail(const FolderP&tfolder)
268{ 269{
269 init_storage(); 270 init_storage();
270 if (!m_storage) { 271 if (!m_storage) {
271 return 0; 272 return 0;
272 } 273 }
273 int res = 1; 274 int res = 1;
274 if (!tfolder) return 0; 275 if (!tfolder) return 0;
275 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 276 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
276 if (r!=MAIL_NO_ERROR) { 277 if (r!=MAIL_NO_ERROR) {
277 qDebug("error selecting folder! "); 278 qDebug("error selecting folder! ");
278 return 0; 279 return 0;
279 } 280 }
280 mailmessage_list*l=0; 281 mailmessage_list*l=0;
281 r = mailsession_get_messages_list(m_storage->sto_session,&l); 282 r = mailsession_get_messages_list(m_storage->sto_session,&l);
282 if (r != MAIL_NO_ERROR) { 283 if (r != MAIL_NO_ERROR) {
283 qDebug("Error message list "); 284 qDebug("Error message list ");
284 res = 0; 285 res = 0;
285 } 286 }
286 unsigned j = 0; 287 unsigned j = 0;
287 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { 288 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
288 mailmessage * msg; 289 mailmessage * msg;
289 msg = (mailmessage*)carray_get(l->msg_tab, i); 290 msg = (mailmessage*)carray_get(l->msg_tab, i);
290 j = msg->msg_index; 291 j = msg->msg_index;
291 r = mailsession_remove_message(m_storage->sto_session,j); 292 r = mailsession_remove_message(m_storage->sto_session,j);
292 if (r != MAIL_NO_ERROR) { 293 if (r != MAIL_NO_ERROR) {
293 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 294 Global::statusMessage(i18n("Error deleting mail %1").arg(i+1));
294 res = 0; 295 res = 0;
295 break; 296 break;
296 } 297 }
297 } 298 }
298 if (l) mailmessage_list_free(l); 299 if (l) mailmessage_list_free(l);
299 return res; 300 return res;
300} 301}
301 302
302int MHwrapper::deleteMbox(const FolderP&tfolder) 303int MHwrapper::deleteMbox(const FolderP&tfolder)
303{ 304{
304 init_storage(); 305 init_storage();
305 if (!m_storage) { 306 if (!m_storage) {
306 return 0; 307 return 0;
307 } 308 }
308 if (!tfolder) return 0; 309 if (!tfolder) return 0;
309 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; 310 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0;
310 311
311 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());
312 313
313 if (r != MAIL_NO_ERROR) { 314 if (r != MAIL_NO_ERROR) {
314 qDebug("error deleting mail box "); 315 qDebug("error deleting mail box ");
315 return 0; 316 return 0;
316 } 317 }
317 QString cmd = "rm -rf "+tfolder->getName(); 318 QString cmd = "rm -rf "+tfolder->getName();
318 QStringList command; 319 QStringList command;
319 command << "/bin/sh"; 320 command << "/bin/sh";
320 command << "-c"; 321 command << "-c";
321 command << cmd.latin1(); 322 command << cmd.latin1();
322 OProcess *process = new OProcess(); 323 OProcess *process = new OProcess();
323 324
324 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), 325 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
325 this, SLOT( processEnded(Opie::Core::OProcess*))); 326 this, SLOT( processEnded(Opie::Core::OProcess*)));
326 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), 327 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
327 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); 328 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
328 329
329 *process << command; 330 *process << command;
330 removeMboxfailed = false; 331 removeMboxfailed = false;
331 if(!process->start(OProcess::Block, OProcess::All) ) { 332 if(!process->start(OProcess::Block, OProcess::All) ) {
332 qDebug("could not start process "); 333 qDebug("could not start process ");
333 return 0; 334 return 0;
334 } 335 }
335 qDebug("mail box deleted "); 336 qDebug("mail box deleted ");
336 return 1; 337 return 1;
337} 338}
338 339
339void MHwrapper::processEnded(OProcess *p) 340void MHwrapper::processEnded(OProcess *p)
340{ 341{
341 if (p) delete p; 342 if (p) delete p;
342} 343}
343 344
344void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) 345void MHwrapper::oprocessStderr(OProcess*, char *buffer, int )
345{ 346{
346 QString lineStr = buffer; 347 QString lineStr = buffer;
347 QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); 348 QMessageBox::warning( 0, i18n("Error"), lineStr ,i18n("Ok") );
348 removeMboxfailed = true; 349 removeMboxfailed = true;
349} 350}
350 351
351void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 352void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
352{ 353{
353 init_storage(); 354 init_storage();
354 if (!m_storage) { 355 if (!m_storage) {
355 return; 356 return;
356 } 357 }
357 target_stat.message_count = 0; 358 target_stat.message_count = 0;
358 target_stat.message_unseen = 0; 359 target_stat.message_unseen = 0;
359 target_stat.message_recent = 0; 360 target_stat.message_recent = 0;
360 QString f = buildPath(mailbox); 361 QString f = buildPath(mailbox);
361 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, 362 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count,
362 &target_stat.message_recent,&target_stat.message_unseen); 363 &target_stat.message_recent,&target_stat.message_unseen);
363 if (r != MAIL_NO_ERROR) { 364 if (r != MAIL_NO_ERROR) {
364 Global::statusMessage(tr("Error retrieving status")); 365 Global::statusMessage(i18n("Error retrieving status"));
365 } 366 }
366} 367}
367 368
368MAILLIB::ATYPE MHwrapper::getType()const 369MAILLIB::ATYPE MHwrapper::getType()const
369{ 370{
370 return MAILLIB::A_MH; 371 return MAILLIB::A_MH;
371} 372}
372 373
373const QString&MHwrapper::getName()const 374const QString&MHwrapper::getName()const
374{ 375{
375 return MHName; 376 return MHName;
376} 377}
377void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 378void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
378{ 379{
379 init_storage(); 380 init_storage();
380 if (!m_storage) { 381 if (!m_storage) {
381 return; 382 return;
382 } 383 }
383 if (targetWrapper != this) { 384 if (targetWrapper != this) {
384 qDebug("Using generic "); 385 qDebug("Using generic ");
385 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); 386 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
386 return; 387 return;
387 } 388 }
388 qDebug("Using internal routines for move/copy "); 389 qDebug("Using internal routines for move/copy ");
389 QString tf = buildPath(targetFolder); 390 QString tf = buildPath(targetFolder);
390 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 391 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
391 if (r != MAIL_NO_ERROR) { 392 if (r != MAIL_NO_ERROR) {
392 qDebug("Error selecting source mailbox "); 393 qDebug("Error selecting source mailbox ");
393 return; 394 return;
394 } 395 }
395 if (moveit) { 396 if (moveit) {
396 r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); 397 r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
397 } else { 398 } else {
398 r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); 399 r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
399 } 400 }
400 if (r != MAIL_NO_ERROR) { 401 if (r != MAIL_NO_ERROR) {
401 qDebug("Error copy/moving mail internal "); 402 qDebug("Error copy/moving mail internal ");
402 } 403 }
403} 404}
404 405
405void MHwrapper::mvcpAllMails(const FolderP&fromFolder, 406void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
406 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 407 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
407{ 408{
408 init_storage(); 409 init_storage();
409 if (!m_storage) { 410 if (!m_storage) {
410 return; 411 return;
411 } 412 }
412 if (targetWrapper != this) { 413 if (targetWrapper != this) {
413 qDebug("Using generic "); 414 qDebug("Using generic ");
414 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); 415 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
415 return; 416 return;
416 } 417 }
417 if (!fromFolder) return; 418 if (!fromFolder) return;
418 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); 419 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1());
419 if (r!=MAIL_NO_ERROR) { 420 if (r!=MAIL_NO_ERROR) {
420 qDebug("error selecting source folder! "); 421 qDebug("error selecting source folder! ");
421 return; 422 return;
422 } 423 }
423 QString tf = buildPath(targetFolder); 424 QString tf = buildPath(targetFolder);
424 mailmessage_list*l=0; 425 mailmessage_list*l=0;
425 r = mailsession_get_messages_list(m_storage->sto_session,&l); 426 r = mailsession_get_messages_list(m_storage->sto_session,&l);
426 if (r != MAIL_NO_ERROR) { 427 if (r != MAIL_NO_ERROR) {
427 qDebug("Error message list "); 428 qDebug("Error message list ");
428 } 429 }
429 unsigned j = 0; 430 unsigned j = 0;
430 for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) { 431 for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) {
431 mailmessage * msg; 432 mailmessage * msg;
432 msg = (mailmessage*)carray_get(l->msg_tab, i); 433 msg = (mailmessage*)carray_get(l->msg_tab, i);
433 j = msg->msg_index; 434 j = msg->msg_index;
434 if (moveit) { 435 if (moveit) {
435 r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1()); 436 r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1());
436 } else { 437 } else {
437 r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1()); 438 r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1());
438 } 439 }
439 if (r != MAIL_NO_ERROR) { 440 if (r != MAIL_NO_ERROR) {
440 qDebug("Error copy/moving mail interna "); 441 qDebug("Error copy/moving mail interna ");
441 442
442 break; 443 break;
443 } 444 }
444 } 445 }
445 if (l) mailmessage_list_free(l); 446 if (l) mailmessage_list_free(l);
446} 447}
diff --git a/kmicromail/libmailwrapper/sendmailprogress.cpp b/kmicromail/libmailwrapper/sendmailprogress.cpp
index dc0c75a..20dfe9b 100644
--- a/kmicromail/libmailwrapper/sendmailprogress.cpp
+++ b/kmicromail/libmailwrapper/sendmailprogress.cpp
@@ -1,47 +1,48 @@
1#include "sendmailprogress.h" 1#include "sendmailprogress.h"
2#include <qprogressbar.h> 2#include <qprogressbar.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <klocale.h>
4 5
5progressMailSend::progressMailSend(QWidget*parent, const char * name) 6progressMailSend::progressMailSend(QWidget*parent, const char * name)
6 :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) 7 :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0)
7{ 8{
8} 9}
9 10
10progressMailSend::~progressMailSend() 11progressMailSend::~progressMailSend()
11{ 12{
12} 13}
13 14
14void progressMailSend::setMaxMails(unsigned int aMaxMails) 15void progressMailSend::setMaxMails(unsigned int aMaxMails)
15{ 16{
16 m_max_mail = aMaxMails; 17 m_max_mail = aMaxMails;
17 allMailProgressBar->setTotalSteps(aMaxMails); 18 allMailProgressBar->setTotalSteps(aMaxMails);
18 setMails(); 19 setMails();
19} 20}
20 21
21void progressMailSend::setCurrentMails(unsigned int aCurrent) 22void progressMailSend::setCurrentMails(unsigned int aCurrent)
22{ 23{
23 m_current_mail = aCurrent; 24 m_current_mail = aCurrent;
24 allMailProgressBar->setProgress(aCurrent); 25 allMailProgressBar->setProgress(aCurrent);
25 setMails(); 26 setMails();
26} 27}
27 28
28void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax) 29void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax)
29{ 30{
30 m_current_single = aCurrent; 31 m_current_single = aCurrent;
31 m_max_single = aMax; 32 m_max_single = aMax;
32 setSingle(); 33 setSingle();
33} 34}
34 35
35void progressMailSend::setSingle() 36void progressMailSend::setSingle()
36{ 37{
37 QString text = QString(tr("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single); 38 QString text = QString(i18n("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single);
38 singleMailLabel->setText(text); 39 singleMailLabel->setText(text);
39 singleMailProgressBar->setTotalSteps(m_max_single); 40 singleMailProgressBar->setTotalSteps(m_max_single);
40 singleMailProgressBar->setProgress(m_current_single); 41 singleMailProgressBar->setProgress(m_current_single);
41} 42}
42 43
43void progressMailSend::setMails() 44void progressMailSend::setMails()
44{ 45{
45 QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail); 46 QString text = QString(i18n("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail);
46 allMailLabel->setText(text); 47 allMailLabel->setText(text);
47} 48}
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index 8341c5a..006390c 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -1,66 +1,67 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3 3
4#ifndef DESKTOP_VERSION 4#ifndef DESKTOP_VERSION
5#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
6#include <libkdepim/externalapphandler.h> 6#include <libkdepim/externalapphandler.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#else 8#else
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
12#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
13#include <qsgistyle.h> 13#include <qsgistyle.h>
14#endif 14#endif
15#include "opiemail.h" 15#include "opiemail.h"
16#include <qdir.h> 16#include <qdir.h>
17#include <kstandarddirs.h> 17#include <kstandarddirs.h>
18#include <kglobal.h> 18#include <kglobal.h>
19#include <stdio.h> 19#include <stdio.h>
20#include "mainwindow.h" 20#include "mainwindow.h"
21#include "koprefs.h" 21#include "koprefs.h"
22#include <libkdepim/kpimglobalprefs.h> 22#include <libkdepim/kpimglobalprefs.h>
23void dumpMissing(); 23void dumpMissing();
24//using namespace Opie::Core; 24//using namespace Opie::Core;
25int main( int argc, char **argv ) { 25int main( int argc, char **argv ) {
26 26
27#ifndef DESKTOP_VERSION 27#ifndef DESKTOP_VERSION
28 QPEApplication a( argc, argv ); 28 QPEApplication a( argc, argv );
29 a.setKeepRunning (); 29 a.setKeepRunning ();
30#else 30#else
31 QApplication a( argc, argv ); 31 QApplication a( argc, argv );
32 QApplication::setStyle( new QPlatinumStyle ()); 32 QApplication::setStyle( new QPlatinumStyle ());
33#endif 33#endif
34 a.setFont( KOPrefs::instance()->mAppFont ); 34 a.setFont( KOPrefs::instance()->mAppFont );
35 KGlobal::setAppName( "kopiemail" ); 35 KGlobal::setAppName( "kopiemail" );
36 QString fileName ; 36 QString fileName ;
37#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
38 fileName = getenv("QPEDIR"); 38 fileName = getenv("QPEDIR");
39 if ( QApplication::desktop()->width() > 320 ) 39 if ( QApplication::desktop()->width() > 320 )
40 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); 40 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/");
41 else 41 else
42 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); 42 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/");
43#else 43#else
44 fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/"; 44 fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/";
45 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 45 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
46#endif 46#endif
47 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); 47 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail")));
48 KPimGlobalPrefs::instance()->setGlobalConfig();
48 OpieMail mw; 49 OpieMail mw;
49#ifndef DESKTOP_VERSION 50#ifndef DESKTOP_VERSION
50 //qDebug("CONNECT "); 51 //qDebug("CONNECT ");
51 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); 52 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& )));
52 // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 53 // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
53 a.showMainWidget(&mw ); 54 a.showMainWidget(&mw );
54#else 55#else
55 a.setMainWidget(&mw ); 56 a.setMainWidget(&mw );
56 mw.show(); 57 mw.show();
57 //m.resize( 800, 600 ); 58 //m.resize( 800, 600 );
58 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 59 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
59#endif 60#endif
60 int rv = a.exec(); 61 int rv = a.exec();
61 dumpMissing(); 62 dumpMissing();
62 63
63 KPimGlobalPrefs::instance()->writeConfig(); 64 KPimGlobalPrefs::instance()->writeConfig();
64 return rv; 65 return rv;
65 66
66} 67}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 3aa7905..a32983c 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,165 +1,164 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4#include "settingsdialog.h" 4#include "settingsdialog.h"
5#include "opiemail.h" 5#include "opiemail.h"
6#include "editaccounts.h" 6#include "editaccounts.h"
7#include "composemail.h" 7#include "composemail.h"
8#include "mailistviewitem.h" 8#include "mailistviewitem.h"
9#include "viewmail.h" 9#include "viewmail.h"
10#include "selectstore.h" 10#include "selectstore.h"
11#include "selectsmtp.h" 11#include "selectsmtp.h"
12#include "accountitem.h" 12#include "accountitem.h"
13#include "koprefsdialog.h" 13#include "koprefsdialog.h"
14#include "klocale.h" 14#include "klocale.h"
15 15
16#include <qmessagebox.h> 16#include <qmessagebox.h>
17#include <qtimer.h> 17#include <qtimer.h>
18#include <libkdepim/externalapphandler.h> 18#include <libkdepim/externalapphandler.h>
19#include <libkdepim/kpimglobalprefs.h> 19#include <libkdepim/kpimglobalprefs.h>
20 20
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <libmailwrapper/smtpwrapper.h> 22#include <libmailwrapper/smtpwrapper.h>
23#include <libmailwrapper/mailtypes.h> 23#include <libmailwrapper/mailtypes.h>
24#include <libmailwrapper/abstractmail.h> 24#include <libmailwrapper/abstractmail.h>
25/* OPIE */ 25/* OPIE */
26//#include <qpe/resource.h> 26//#include <qpe/resource.h>
27//#include <qpe/qpeapplication.h> 27//#include <qpe/qpeapplication.h>
28 28
29/* QT */ 29/* QT */
30 30
31//using namespace Opie::Core; 31//using namespace Opie::Core;
32 32
33OpieMail::OpieMail( QWidget *parent, const char *name ) 33OpieMail::OpieMail( QWidget *parent, const char *name )
34 : MainWindow( parent, name) //, WStyle_ContextHelp ) 34 : MainWindow( parent, name) //, WStyle_ContextHelp )
35{ 35{
36 settings = new Settings(); 36 settings = new Settings();
37 KPimGlobalPrefs::instance()->setGlobalConfig();
38 37
39 folderView->populate( settings->getAccounts() ); 38 folderView->populate( settings->getAccounts() );
40 39
41} 40}
42 41
43OpieMail::~OpieMail() 42OpieMail::~OpieMail()
44{ 43{
45 if (settings) delete settings; 44 if (settings) delete settings;
46} 45}
47 46
48void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 47void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
49{ 48{
50 49
51} 50}
52#include <stdlib.h> 51#include <stdlib.h>
53void OpieMail::message(const QCString &msg, const QByteArray &data) 52void OpieMail::message(const QCString &msg, const QByteArray &data)
54{ 53{
55 // copied from old mail2 54 // copied from old mail2
56 static int ii = 0; 55 static int ii = 0;
57 //qDebug("QCOP CALL ############################# %d ", ii); 56 //qDebug("QCOP CALL ############################# %d ", ii);
58 //QString mess ( msg ); 57 //QString mess ( msg );
59 //qDebug("Message = %s ",mess.latin1()); 58 //qDebug("Message = %s ",mess.latin1());
60 ++ii; 59 ++ii;
61 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 60 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
62 61
63 mPendingEmail = QString::null; 62 mPendingEmail = QString::null;
64 mPendingName = QString::null; 63 mPendingName = QString::null;
65 if (msg == "writeMail(QString,QString)") 64 if (msg == "writeMail(QString,QString)")
66 { 65 {
67 //qDebug("writeMail(QString,QString) "); 66 //qDebug("writeMail(QString,QString) ");
68 QDataStream stream(data,IO_ReadOnly); 67 QDataStream stream(data,IO_ReadOnly);
69 stream >> mPendingName >> mPendingEmail; 68 stream >> mPendingName >> mPendingEmail;
70 // removing the whitespaces at beginning and end is needed! 69 // removing the whitespaces at beginning and end is needed!
71 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 70 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
72 } 71 }
73 else if (msg == "newMail()") 72 else if (msg == "newMail()")
74 { 73 {
75 //qDebug("slotComposeMail() "); 74 //qDebug("slotComposeMail() ");
76 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 75 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
77 // and a QCOP call does not like a processevents in his execution 76 // and a QCOP call does not like a processevents in his execution
78 // with the Qtimer we call slotComposeMail() after we reached the main event loop 77 // with the Qtimer we call slotComposeMail() after we reached the main event loop
79 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 78 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
80 // slotComposeMail(); 79 // slotComposeMail();
81 } 80 }
82 else if (msg == "newMail(QString)") 81 else if (msg == "newMail(QString)")
83 { 82 {
84 //qDebug(" newMail(QString)"); 83 //qDebug(" newMail(QString)");
85 QDataStream stream(data,IO_ReadOnly); 84 QDataStream stream(data,IO_ReadOnly);
86 stream >> mPendingName; 85 stream >> mPendingName;
87 // the format is 86 // the format is
88 // NAME <EMAIL>:SUBJECT 87 // NAME <EMAIL>:SUBJECT
89 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 88 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
90 } else { 89 } else {
91 mPendingData = data; 90 mPendingData = data;
92 mPendingMessage = msg; 91 mPendingMessage = msg;
93 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 92 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
94 } 93 }
95 94
96 //qDebug("END OpieMail::message "); 95 //qDebug("END OpieMail::message ");
97} 96}
98void OpieMail::slotExtAppHandler() 97void OpieMail::slotExtAppHandler()
99{ 98{
100 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 99 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
101} 100}
102void OpieMail::slotwriteMail2(const QString& namemail ) 101void OpieMail::slotwriteMail2(const QString& namemail )
103{ 102{
104 //qDebug("OpieMail::slotwriteMail2 "); 103 //qDebug("OpieMail::slotwriteMail2 ");
105 //qApp->processEvents(); 104 //qApp->processEvents();
106 ComposeMail compose( settings, this, 0, true ); 105 ComposeMail compose( settings, this, 0, true );
107 if ( !namemail.isEmpty() ) { 106 if ( !namemail.isEmpty() ) {
108 QString to = namemail; 107 QString to = namemail;
109 if ( namemail.find( " <") > 1 ) { 108 if ( namemail.find( " <") > 1 ) {
110 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 109 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
111 } else 110 } else
112 if ( namemail.find( "<") > 1 ) { 111 if ( namemail.find( "<") > 1 ) {
113 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 112 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
114 } 113 }
115 int sub = to.find( ">:"); 114 int sub = to.find( ">:");
116 if ( sub > 0 ) { 115 if ( sub > 0 ) {
117 compose.setTo( to.left(sub+1) ); 116 compose.setTo( to.left(sub+1) );
118 compose.setSubject( to.mid(sub+2) ); 117 compose.setSubject( to.mid(sub+2) );
119 } else 118 } else
120 compose.setTo( to ); 119 compose.setTo( to );
121 } 120 }
122 compose.slotAdjustColumns(); 121 compose.slotAdjustColumns();
123 compose.showMaximized(); 122 compose.showMaximized();
124 compose.exec(); 123 compose.exec();
125 raise(); 124 raise();
126 //qDebug("retttich "); 125 //qDebug("retttich ");
127} 126}
128void OpieMail::slotwriteMail(const QString&name,const QString&email) 127void OpieMail::slotwriteMail(const QString&name,const QString&email)
129{ 128{
130 // qDebug("OpieMail::slotwriteMail "); 129 // qDebug("OpieMail::slotwriteMail ");
131 ComposeMail compose( settings, this, 0, true ); 130 ComposeMail compose( settings, this, 0, true );
132 if (!email.isEmpty()) 131 if (!email.isEmpty())
133 { 132 {
134 if (!name.isEmpty()) 133 if (!name.isEmpty())
135 { 134 {
136 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 135 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
137 } 136 }
138 else 137 else
139 { 138 {
140 compose.setTo(email); 139 compose.setTo(email);
141 } 140 }
142 } 141 }
143 compose.slotAdjustColumns(); 142 compose.slotAdjustColumns();
144 compose.showMaximized(); 143 compose.showMaximized();
145 compose.exec(); 144 compose.exec();
146 raise(); 145 raise();
147} 146}
148 147
149void OpieMail::slotComposeMail() 148void OpieMail::slotComposeMail()
150{ 149{
151 if ( mPendingEmail == QString::null && mPendingName == QString::null) 150 if ( mPendingEmail == QString::null && mPendingName == QString::null)
152 slotwriteMail2( QString () ); 151 slotwriteMail2( QString () );
153 else { 152 else {
154 if ( mPendingEmail == QString::null ) 153 if ( mPendingEmail == QString::null )
155 slotwriteMail2( mPendingName ); 154 slotwriteMail2( mPendingName );
156 else 155 else
157 slotwriteMail( mPendingName, mPendingEmail ); 156 slotwriteMail( mPendingName, mPendingEmail );
158 } 157 }
159 //slotwriteMail(0l,0l); 158 //slotwriteMail(0l,0l);
160} 159}
161 160
162void OpieMail::slotSendQueued() 161void OpieMail::slotSendQueued()
163{ 162{
164 SMTPaccount *smtp = 0; 163 SMTPaccount *smtp = 0;
165 164