summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
authorzautrix <zautrix>2005-02-28 14:46:07 (UTC)
committer zautrix <zautrix>2005-02-28 14:46:07 (UTC)
commitb1f912cbb6a9daf050e94d337de0e0e73417284a (patch) (unidiff)
tree09220df0ef11ccc32c4eafcc2a63b64056068036 /kmicromail/opiemail.cpp
parentff810f8f74f6928e664bf52f8e8d128edb8ac5ad (diff)
downloadkdepimpi-b1f912cbb6a9daf050e94d337de0e0e73417284a.zip
kdepimpi-b1f912cbb6a9daf050e94d337de0e0e73417284a.tar.gz
kdepimpi-b1f912cbb6a9daf050e94d337de0e0e73417284a.tar.bz2
ompi refresh outgoing fix
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index e159b73..f68467c 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -143,193 +143,193 @@ void OpieMail::slotwriteMail2(const QString& namemail )
143 mCurrentComposer = &compose; 143 mCurrentComposer = &compose;
144 compose.exec(); 144 compose.exec();
145 mCurrentComposer = 0; 145 mCurrentComposer = 0;
146 raise(); 146 raise();
147 //qDebug("retttich "); 147 //qDebug("retttich ");
148} 148}
149void OpieMail::slotwriteMail(const QString&name,const QString&email) 149void OpieMail::slotwriteMail(const QString&name,const QString&email)
150{ 150{
151 // qDebug("OpieMail::slotwriteMail "); 151 // qDebug("OpieMail::slotwriteMail ");
152 ComposeMail compose( settings, this, 0, true ); 152 ComposeMail compose( settings, this, 0, true );
153 if (!email.isEmpty()) 153 if (!email.isEmpty())
154 { 154 {
155 if (!name.isEmpty()) 155 if (!name.isEmpty())
156 { 156 {
157 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 157 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
158 } 158 }
159 else 159 else
160 { 160 {
161 compose.setTo(email); 161 compose.setTo(email);
162 } 162 }
163 } 163 }
164 compose.slotAdjustColumns(); 164 compose.slotAdjustColumns();
165#ifndef DESKTOP_VERSION 165#ifndef DESKTOP_VERSION
166 compose.showMaximized(); 166 compose.showMaximized();
167#endif 167#endif
168 168
169 mCurrentComposer = &compose; 169 mCurrentComposer = &compose;
170 compose.exec(); 170 compose.exec();
171 mCurrentComposer = 0; 171 mCurrentComposer = 0;
172 raise(); 172 raise();
173} 173}
174 174
175void OpieMail::slotComposeMail() 175void OpieMail::slotComposeMail()
176{ 176{
177 if ( mPendingEmail == QString::null && mPendingName == QString::null) 177 if ( mPendingEmail == QString::null && mPendingName == QString::null)
178 slotwriteMail2( QString () ); 178 slotwriteMail2( QString () );
179 else { 179 else {
180 if ( mPendingEmail == QString::null ) 180 if ( mPendingEmail == QString::null )
181 slotwriteMail2( mPendingName ); 181 slotwriteMail2( mPendingName );
182 else 182 else
183 slotwriteMail( mPendingName, mPendingEmail ); 183 slotwriteMail( mPendingName, mPendingEmail );
184 } 184 }
185 //slotwriteMail(0l,0l); 185 //slotwriteMail(0l,0l);
186} 186}
187 187
188void OpieMail::slotSendQueued() 188void OpieMail::slotSendQueued()
189{ 189{
190 SMTPaccount *smtp = 0; 190 SMTPaccount *smtp = 0;
191 191
192 QList<Account> list = settings->getAccounts(); 192 QList<Account> list = settings->getAccounts();
193 QList<SMTPaccount> smtpList; 193 QList<SMTPaccount> smtpList;
194 smtpList.setAutoDelete(false); 194 smtpList.setAutoDelete(false);
195 Account *it; 195 Account *it;
196 for ( it = list.first(); it; it = list.next() ) 196 for ( it = list.first(); it; it = list.next() )
197 { 197 {
198 if ( it->getType() == MAILLIB::A_SMTP ) 198 if ( it->getType() == MAILLIB::A_SMTP )
199 { 199 {
200 smtp = static_cast<SMTPaccount *>(it); 200 smtp = static_cast<SMTPaccount *>(it);
201 smtpList.append(smtp); 201 smtpList.append(smtp);
202 } 202 }
203 } 203 }
204 if (smtpList.count()==0) 204 if (smtpList.count()==0)
205 { 205 {
206 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); 206 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n"));
207 return; 207 return;
208 } 208 }
209 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 209 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
210 return; 210 return;
211 if (smtpList.count()==1) 211 if (smtpList.count()==1)
212 { 212 {
213 smtp = smtpList.at(0); 213 smtp = smtpList.at(0);
214 } 214 }
215 else 215 else
216 { 216 {
217 smtp = 0; 217 smtp = 0;
218 selectsmtp selsmtp; 218 selectsmtp selsmtp;
219 selsmtp.setSelectionlist(&smtpList); 219 selsmtp.setSelectionlist(&smtpList);
220#ifndef DESKTOP_VERSION 220#ifndef DESKTOP_VERSION
221 selsmtp.showMaximized(); 221 selsmtp.showMaximized();
222#endif 222#endif
223 if ( selsmtp.exec() == QDialog::Accepted ) 223 if ( selsmtp.exec() == QDialog::Accepted )
224 { 224 {
225 smtp = selsmtp.selected_smtp(); 225 smtp = selsmtp.selected_smtp();
226 } 226 }
227 } 227 }
228 if (smtp) 228 if (smtp)
229 { 229 {
230 230
231 Global::statusMessage("Sending mails...!"); 231 Global::statusMessage("Sending mails...!");
232 SMTPwrapper * wrap = new SMTPwrapper(smtp); 232 SMTPwrapper * wrap = new SMTPwrapper(smtp);
233 if ( wrap->flushOutbox() ) 233 if ( wrap->flushOutbox() )
234 { 234 {
235 Global::statusMessage("Mails sent!"); 235 Global::statusMessage("Mails sent!");
236 } 236 }
237 delete wrap; 237 delete wrap;
238 } 238 }
239 // pending refresh list view, if outgoing is displayed 239 folderView->refreshOutgoing();
240} 240}
241 241
242void OpieMail::slotSearchMails() 242void OpieMail::slotSearchMails()
243{ 243{
244 qDebug("OpieMail::slotSearchMails():not implemented "); 244 qDebug("OpieMail::slotSearchMails():not implemented ");
245} 245}
246 246
247void OpieMail::slotEditSettings() 247void OpieMail::slotEditSettings()
248{ 248{
249 249
250 KOPrefsDialog settingsDialog( this, "koprefs", true ); 250 KOPrefsDialog settingsDialog( this, "koprefs", true );
251#ifndef DESKTOP_VERSION 251#ifndef DESKTOP_VERSION
252 settingsDialog.showMaximized(); 252 settingsDialog.showMaximized();
253#endif 253#endif
254 settingsDialog.exec(); 254 settingsDialog.exec();
255 255
256 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 256 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
257 // KApplication::execDialog(settingsDialog); 257 // KApplication::execDialog(settingsDialog);
258} 258}
259 259
260void OpieMail::slotEditAccounts() 260void OpieMail::slotEditAccounts()
261{ 261{
262 EditAccounts eaDialog( settings, this, 0, true ); 262 EditAccounts eaDialog( settings, this, 0, true );
263 eaDialog.slotAdjustColumns(); 263 eaDialog.slotAdjustColumns();
264#ifndef DESKTOP_VERSION 264#ifndef DESKTOP_VERSION
265 eaDialog.showMaximized(); 265 eaDialog.showMaximized();
266#endif 266#endif
267 eaDialog.exec(); 267 eaDialog.exec();
268 if ( settings ) delete settings; 268 if ( settings ) delete settings;
269 settings = new Settings(); 269 settings = new Settings();
270 270
271 folderView->populate( settings->getAccounts() ); 271 folderView->populate( settings->getAccounts() );
272} 272}
273void OpieMail::replyMail() 273void OpieMail::replyMail()
274{ 274{
275 275
276 QListViewItem*item = mailView->currentItem(); 276 QListViewItem*item = mailView->currentItem();
277 if (!item) return; 277 if (!item) return;
278 RecMailP mail = ((MailListViewItem*)item)->data(); 278 RecMailP mail = ((MailListViewItem*)item)->data();
279 RecBodyP body = folderView->fetchBody(mail); 279 RecBodyP body = folderView->fetchBody(mail);
280 280
281 QString rtext; 281 QString rtext;
282 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 282 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
283 .arg( mail->getFrom()) 283 .arg( mail->getFrom())
284 .arg( mail->getDate()); 284 .arg( mail->getDate());
285 285
286 QString text = body->Bodytext(); 286 QString text = body->Bodytext();
287 QStringList lines = QStringList::split(QRegExp("\\n"), text); 287 QStringList lines = QStringList::split(QRegExp("\\n"), text);
288 QStringList::Iterator it; 288 QStringList::Iterator it;
289 for (it = lines.begin(); it != lines.end(); it++) 289 for (it = lines.begin(); it != lines.end(); it++)
290 { 290 {
291 rtext += "> " + *it + "\n"; 291 rtext += "> " + *it + "\n";
292 } 292 }
293 rtext += "\n"; 293 rtext += "\n";
294 294
295 QString prefix; 295 QString prefix;
296 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; 296 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
297 else prefix = "Re: "; // no i18n on purpose 297 else prefix = "Re: "; // no i18n on purpose
298 298
299 Settings *settings = new Settings(); 299 Settings *settings = new Settings();
300 ComposeMail composer( settings ,this, 0, true); 300 ComposeMail composer( settings ,this, 0, true);
301 if (mail->Replyto().isEmpty()) { 301 if (mail->Replyto().isEmpty()) {
302 composer.setTo( mail->getFrom()); 302 composer.setTo( mail->getFrom());
303 } else { 303 } else {
304 composer.setTo( mail->Replyto()); 304 composer.setTo( mail->Replyto());
305 } 305 }
306 composer.setSubject( prefix + mail->getSubject()); 306 composer.setSubject( prefix + mail->getSubject());
307 composer.setMessage( rtext ); 307 composer.setMessage( rtext );
308 composer.setInReplyTo( mail->Msgid()); 308 composer.setInReplyTo( mail->Msgid());
309 composer.setCharset( body->getCharset() ); 309 composer.setCharset( body->getCharset() );
310 310
311 mCurrentComposer = &composer; 311 mCurrentComposer = &composer;
312 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 312 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
313 { 313 {
314 mail->Wrapper()->answeredMail(mail); 314 mail->Wrapper()->answeredMail(mail);
315 } 315 }
316 mCurrentComposer = 0; 316 mCurrentComposer = 0;
317 delete settings; 317 delete settings;
318 318
319} 319}
320void OpieMail::closeViewMail(ViewMail * vm) 320void OpieMail::closeViewMail(ViewMail * vm)
321{ 321{
322 vm->hide(); 322 vm->hide();
323} 323}
324 324
325void OpieMail::slotDownloadMail( ) 325void OpieMail::slotDownloadMail( )
326{ 326{
327 QListViewItem*item = mailView->currentItem(); 327 QListViewItem*item = mailView->currentItem();
328 if (!item ) { 328 if (!item ) {
329 Global::statusMessage("Error: No item slected!"); 329 Global::statusMessage("Error: No item slected!");
330 return; 330 return;
331 } 331 }
332 RecMailP mail = ((MailListViewItem*)item)->data(); 332 RecMailP mail = ((MailListViewItem*)item)->data();
333 Account * acc = mail->Wrapper()->getAccount(); 333 Account * acc = mail->Wrapper()->getAccount();
334 if ( !acc ) { 334 if ( !acc ) {
335 Global::statusMessage("Mail is already stored locally!"); 335 Global::statusMessage("Mail is already stored locally!");