summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
authorzautrix <zautrix>2005-02-28 18:16:03 (UTC)
committer zautrix <zautrix>2005-02-28 18:16:03 (UTC)
commit27466d3bc668e7a4c4bdedb6f407e14844908347 (patch) (unidiff)
treeecc5f637b7430d34161a267bd4047cdd0de056f3 /kmicromail/opiemail.cpp
parent16575cca67c9047de72530080dfeb5793a66c935 (diff)
downloadkdepimpi-27466d3bc668e7a4c4bdedb6f407e14844908347.zip
kdepimpi-27466d3bc668e7a4c4bdedb6f407e14844908347.tar.gz
kdepimpi-27466d3bc668e7a4c4bdedb6f407e14844908347.tar.bz2
ompi fixes
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 197f7ec..b701446 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -112,209 +112,207 @@ void OpieMail::message(const QCString &msg, const QByteArray &data)
112 112
113 //qDebug("END OpieMail::message "); 113 //qDebug("END OpieMail::message ");
114} 114}
115void OpieMail::slotExtAppHandler() 115void OpieMail::slotExtAppHandler()
116{ 116{
117 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 117 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
118} 118}
119void OpieMail::slotwriteMail2(const QString& namemail ) 119void OpieMail::slotwriteMail2(const QString& namemail )
120{ 120{
121 //qDebug("OpieMail::slotwriteMail2 "); 121 //qDebug("OpieMail::slotwriteMail2 ");
122 //qApp->processEvents(); 122 //qApp->processEvents();
123 ComposeMail compose( settings, this, 0, true ); 123 ComposeMail compose( settings, this, 0, true );
124 if ( !namemail.isEmpty() ) { 124 if ( !namemail.isEmpty() ) {
125 QString to = namemail; 125 QString to = namemail;
126 if ( namemail.find( " <") > 1 ) { 126 if ( namemail.find( " <") > 1 ) {
127 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 127 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
128 } else 128 } else
129 if ( namemail.find( "<") > 1 ) { 129 if ( namemail.find( "<") > 1 ) {
130 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 130 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
131 } 131 }
132 int sub = to.find( ">:"); 132 int sub = to.find( ">:");
133 if ( sub > 0 ) { 133 if ( sub > 0 ) {
134 compose.setTo( to.left(sub+1) ); 134 compose.setTo( to.left(sub+1) );
135 compose.setSubject( to.mid(sub+2) ); 135 compose.setSubject( to.mid(sub+2) );
136 } else 136 } else
137 compose.setTo( to ); 137 compose.setTo( to );
138 } 138 }
139 compose.slotAdjustColumns(); 139 compose.slotAdjustColumns();
140#ifndef DESKTOP_VERSION 140#ifndef DESKTOP_VERSION
141 compose.showMaximized(); 141 compose.showMaximized();
142#endif 142#endif
143 mCurrentComposer = &compose; 143 mCurrentComposer = &compose;
144 compose.exec(); 144 compose.exec();
145 mCurrentComposer = 0; 145 mCurrentComposer = 0;
146 folderView->refreshOutgoing(); 146 folderView->refreshOutgoing();
147 raise(); 147 raise();
148 //qDebug("retttich "); 148 //qDebug("retttich ");
149} 149}
150void OpieMail::slotwriteMail(const QString&name,const QString&email) 150void OpieMail::slotwriteMail(const QString&name,const QString&email)
151{ 151{
152 // qDebug("OpieMail::slotwriteMail "); 152 // qDebug("OpieMail::slotwriteMail ");
153 ComposeMail compose( settings, this, 0, true ); 153 ComposeMail compose( settings, this, 0, true );
154 if (!email.isEmpty()) 154 if (!email.isEmpty())
155 { 155 {
156 if (!name.isEmpty()) 156 if (!name.isEmpty())
157 { 157 {
158 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 158 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
159 } 159 }
160 else 160 else
161 { 161 {
162 compose.setTo(email); 162 compose.setTo(email);
163 } 163 }
164 } 164 }
165 compose.slotAdjustColumns(); 165 compose.slotAdjustColumns();
166#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
167 compose.showMaximized(); 167 compose.showMaximized();
168#endif 168#endif
169 169
170 mCurrentComposer = &compose; 170 mCurrentComposer = &compose;
171 compose.exec(); 171 compose.exec();
172 mCurrentComposer = 0; 172 mCurrentComposer = 0;
173 folderView->refreshOutgoing(); 173 folderView->refreshOutgoing();
174 raise(); 174 raise();
175} 175}
176 176
177void OpieMail::slotComposeMail() 177void OpieMail::slotComposeMail()
178{ 178{
179 if ( mPendingEmail == QString::null && mPendingName == QString::null) 179 if ( mPendingEmail == QString::null && mPendingName == QString::null)
180 slotwriteMail2( QString () ); 180 slotwriteMail2( QString () );
181 else { 181 else {
182 if ( mPendingEmail == QString::null ) 182 if ( mPendingEmail == QString::null )
183 slotwriteMail2( mPendingName ); 183 slotwriteMail2( mPendingName );
184 else 184 else
185 slotwriteMail( mPendingName, mPendingEmail ); 185 slotwriteMail( mPendingName, mPendingEmail );
186 } 186 }
187 //slotwriteMail(0l,0l); 187 //slotwriteMail(0l,0l);
188} 188}
189 189
190void OpieMail::slotSendQueued() 190void OpieMail::slotSendQueued()
191{ 191{
192 SMTPaccount *smtp = 0; 192 SMTPaccount *smtp = 0;
193 193
194 QList<Account> list = settings->getAccounts(); 194 QList<Account> list = settings->getAccounts();
195 QList<SMTPaccount> smtpList; 195 QList<SMTPaccount> smtpList;
196 smtpList.setAutoDelete(false); 196 smtpList.setAutoDelete(false);
197 Account *it; 197 Account *it;
198 for ( it = list.first(); it; it = list.next() ) 198 for ( it = list.first(); it; it = list.next() )
199 { 199 {
200 if ( it->getType() == MAILLIB::A_SMTP ) 200 if ( it->getType() == MAILLIB::A_SMTP )
201 { 201 {
202 smtp = static_cast<SMTPaccount *>(it); 202 smtp = static_cast<SMTPaccount *>(it);
203 smtpList.append(smtp); 203 smtpList.append(smtp);
204 } 204 }
205 } 205 }
206 if (smtpList.count()==0) 206 if (smtpList.count()==0)
207 { 207 {
208 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); 208 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp\n account first!\n"));
209 return; 209 return;
210 } 210 }
211 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 211 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to\nsend all queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
212 return; 212 return;
213 if (smtpList.count()==1) 213 if (smtpList.count()==1)
214 { 214 {
215 smtp = smtpList.at(0); 215 smtp = smtpList.at(0);
216 } 216 }
217 else 217 else
218 { 218 {
219 smtp = 0; 219 smtp = 0;
220 selectsmtp selsmtp; 220 selectsmtp selsmtp;
221 selsmtp.setSelectionlist(&smtpList); 221 selsmtp.setSelectionlist(&smtpList);
222#ifndef DESKTOP_VERSION 222 selsmtp.resize( selsmtp.sizeHint() );
223 selsmtp.showMaximized();
224#endif
225 if ( selsmtp.exec() == QDialog::Accepted ) 223 if ( selsmtp.exec() == QDialog::Accepted )
226 { 224 {
227 smtp = selsmtp.selected_smtp(); 225 smtp = selsmtp.selected_smtp();
228 } 226 }
229 } 227 }
230 if (smtp) 228 if (smtp)
231 { 229 {
232 230
233 Global::statusMessage("Sending mails...!"); 231 Global::statusMessage("Sending mails...!");
234 SMTPwrapper * wrap = new SMTPwrapper(smtp); 232 SMTPwrapper * wrap = new SMTPwrapper(smtp);
235 if ( wrap->flushOutbox() ) 233 if ( wrap->flushOutbox() )
236 { 234 {
237 Global::statusMessage("Mails sent!"); 235 Global::statusMessage("Mails sent!");
238 } 236 }
239 delete wrap; 237 delete wrap;
240 } 238 }
241 folderView->refreshOutgoing(); 239 folderView->refreshOutgoing();
242} 240}
243 241
244void OpieMail::slotSearchMails() 242void OpieMail::slotSearchMails()
245{ 243{
246 qDebug("OpieMail::slotSearchMails():not implemented "); 244 qDebug("OpieMail::slotSearchMails():not implemented ");
247} 245}
248 246
249void OpieMail::slotEditSettings() 247void OpieMail::slotEditSettings()
250{ 248{
251 249
252 KOPrefsDialog settingsDialog( this, "koprefs", true ); 250 KOPrefsDialog settingsDialog( this, "koprefs", true );
253#ifndef DESKTOP_VERSION 251#ifndef DESKTOP_VERSION
254 settingsDialog.showMaximized(); 252 settingsDialog.showMaximized();
255#endif 253#endif
256 settingsDialog.exec(); 254 settingsDialog.exec();
257 255
258 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 256 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
259 // KApplication::execDialog(settingsDialog); 257 // KApplication::execDialog(settingsDialog);
260} 258}
261 259
262void OpieMail::slotEditAccounts() 260void OpieMail::slotEditAccounts()
263{ 261{
264 EditAccounts eaDialog( settings, this, 0, true ); 262 EditAccounts eaDialog( settings, this, 0, true );
265 eaDialog.slotAdjustColumns(); 263 eaDialog.slotAdjustColumns();
266#ifndef DESKTOP_VERSION 264#ifndef DESKTOP_VERSION
267 eaDialog.showMaximized(); 265 eaDialog.showMaximized();
268#endif 266#endif
269 eaDialog.exec(); 267 eaDialog.exec();
270 if ( settings ) delete settings; 268 if ( settings ) delete settings;
271 settings = new Settings(); 269 settings = new Settings();
272 270
273 folderView->populate( settings->getAccounts() ); 271 folderView->populate( settings->getAccounts() );
274} 272}
275void OpieMail::replyMail() 273void OpieMail::replyMail()
276{ 274{
277 275
278 QListViewItem*item = mailView->currentItem(); 276 QListViewItem*item = mailView->currentItem();
279 if (!item) return; 277 if (!item) return;
280 RecMailP mail = ((MailListViewItem*)item)->data(); 278 RecMailP mail = ((MailListViewItem*)item)->data();
281 RecBodyP body = folderView->fetchBody(mail); 279 RecBodyP body = folderView->fetchBody(mail);
282 280
283 QString rtext; 281 QString rtext;
284 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 282 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
285 .arg( mail->getFrom()) 283 .arg( mail->getFrom())
286 .arg( mail->getDate()); 284 .arg( mail->getDate());
287 285
288 QString text = body->Bodytext(); 286 QString text = body->Bodytext();
289 QStringList lines = QStringList::split(QRegExp("\\n"), text); 287 QStringList lines = QStringList::split(QRegExp("\\n"), text);
290 QStringList::Iterator it; 288 QStringList::Iterator it;
291 for (it = lines.begin(); it != lines.end(); it++) 289 for (it = lines.begin(); it != lines.end(); it++)
292 { 290 {
293 rtext += "> " + *it + "\n"; 291 rtext += "> " + *it + "\n";
294 } 292 }
295 rtext += "\n"; 293 rtext += "\n";
296 294
297 QString prefix; 295 QString prefix;
298 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; 296 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
299 else prefix = "Re: "; // no i18n on purpose 297 else prefix = "Re: "; // no i18n on purpose
300 298
301 Settings *settings = new Settings(); 299 Settings *settings = new Settings();
302 ComposeMail composer( settings ,this, 0, true); 300 ComposeMail composer( settings ,this, 0, true);
303 if (mail->Replyto().isEmpty()) { 301 if (mail->Replyto().isEmpty()) {
304 composer.setTo( mail->getFrom()); 302 composer.setTo( mail->getFrom());
305 } else { 303 } else {
306 composer.setTo( mail->Replyto()); 304 composer.setTo( mail->Replyto());
307 } 305 }
308 composer.setSubject( prefix + mail->getSubject()); 306 composer.setSubject( prefix + mail->getSubject());
309 composer.setMessage( rtext ); 307 composer.setMessage( rtext );
310 composer.setInReplyTo( mail->Msgid()); 308 composer.setInReplyTo( mail->Msgid());
311 composer.setCharset( body->getCharset() ); 309 composer.setCharset( body->getCharset() );
312 310
313 mCurrentComposer = &composer; 311 mCurrentComposer = &composer;
314 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 312 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
315 { 313 {
316 mail->Wrapper()->answeredMail(mail); 314 mail->Wrapper()->answeredMail(mail);
317 } 315 }
318 mCurrentComposer = 0; 316 mCurrentComposer = 0;
319 folderView->refreshOutgoing(); 317 folderView->refreshOutgoing();
320 delete settings; 318 delete settings;