summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 3cbac8e..9a1a750 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -140,258 +140,256 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email)
140 compose.slotAdjustColumns(); 140 compose.slotAdjustColumns();
141 compose.showMaximized(); 141 compose.showMaximized();
142 compose.exec(); 142 compose.exec();
143 raise(); 143 raise();
144} 144}
145 145
146void OpieMail::slotComposeMail() 146void OpieMail::slotComposeMail()
147{ 147{
148 if ( mPendingEmail == QString::null && mPendingName == QString::null) 148 if ( mPendingEmail == QString::null && mPendingName == QString::null)
149 slotwriteMail2( QString () ); 149 slotwriteMail2( QString () );
150 else { 150 else {
151 if ( mPendingEmail == QString::null ) 151 if ( mPendingEmail == QString::null )
152 slotwriteMail2( mPendingName ); 152 slotwriteMail2( mPendingName );
153 else 153 else
154 slotwriteMail( mPendingName, mPendingEmail ); 154 slotwriteMail( mPendingName, mPendingEmail );
155 } 155 }
156 //slotwriteMail(0l,0l); 156 //slotwriteMail(0l,0l);
157} 157}
158 158
159void OpieMail::slotSendQueued() 159void OpieMail::slotSendQueued()
160{ 160{
161 SMTPaccount *smtp = 0; 161 SMTPaccount *smtp = 0;
162 162
163 QList<Account> list = settings->getAccounts(); 163 QList<Account> list = settings->getAccounts();
164 QList<SMTPaccount> smtpList; 164 QList<SMTPaccount> smtpList;
165 smtpList.setAutoDelete(false); 165 smtpList.setAutoDelete(false);
166 Account *it; 166 Account *it;
167 for ( it = list.first(); it; it = list.next() ) 167 for ( it = list.first(); it; it = list.next() )
168 { 168 {
169 if ( it->getType() == MAILLIB::A_SMTP ) 169 if ( it->getType() == MAILLIB::A_SMTP )
170 { 170 {
171 smtp = static_cast<SMTPaccount *>(it); 171 smtp = static_cast<SMTPaccount *>(it);
172 smtpList.append(smtp); 172 smtpList.append(smtp);
173 } 173 }
174 } 174 }
175 if (smtpList.count()==0) 175 if (smtpList.count()==0)
176 { 176 {
177 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); 177 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n"));
178 return; 178 return;
179 } 179 }
180 if (smtpList.count()==1) 180 if (smtpList.count()==1)
181 { 181 {
182 smtp = smtpList.at(0); 182 smtp = smtpList.at(0);
183 } 183 }
184 else 184 else
185 { 185 {
186 smtp = 0; 186 smtp = 0;
187 selectsmtp selsmtp; 187 selectsmtp selsmtp;
188 selsmtp.setSelectionlist(&smtpList); 188 selsmtp.setSelectionlist(&smtpList);
189 selsmtp.showMaximized(); 189 selsmtp.showMaximized();
190 if ( selsmtp.exec() == QDialog::Accepted ) 190 if ( selsmtp.exec() == QDialog::Accepted )
191 { 191 {
192 smtp = selsmtp.selected_smtp(); 192 smtp = selsmtp.selected_smtp();
193 } 193 }
194 } 194 }
195 if (smtp) 195 if (smtp)
196 { 196 {
197 SMTPwrapper * wrap = new SMTPwrapper(smtp); 197 SMTPwrapper * wrap = new SMTPwrapper(smtp);
198 if ( wrap->flushOutbox() ) 198 if ( wrap->flushOutbox() )
199 { 199 {
200 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 200 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
201 } 201 }
202 delete wrap; 202 delete wrap;
203 } 203 }
204} 204}
205 205
206void OpieMail::slotSearchMails() 206void OpieMail::slotSearchMails()
207{ 207{
208 qDebug("OpieMail::slotSearchMails():not implemented "); 208 qDebug("OpieMail::slotSearchMails():not implemented ");
209} 209}
210 210
211void OpieMail::slotEditSettings() 211void OpieMail::slotEditSettings()
212{ 212{
213#if 0 213#if 0
214 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 214 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
215 settingsDialog.showMaximized(); 215 settingsDialog.showMaximized();
216 settingsDialog.exec(); 216 settingsDialog.exec();
217#endif 217#endif
218 KOPrefsDialog settingsDialog( this, "koprefs", true ); 218 KOPrefsDialog settingsDialog( this, "koprefs", true );
219 settingsDialog.showMaximized(); 219 settingsDialog.showMaximized();
220 settingsDialog.exec(); 220 settingsDialog.exec();
221} 221}
222 222
223void OpieMail::slotEditAccounts() 223void OpieMail::slotEditAccounts()
224{ 224{
225 EditAccounts eaDialog( settings, this, 0, true ); 225 EditAccounts eaDialog( settings, this, 0, true );
226 eaDialog.slotAdjustColumns(); 226 eaDialog.slotAdjustColumns();
227 eaDialog.showMaximized(); 227 eaDialog.showMaximized();
228 eaDialog.exec(); 228 eaDialog.exec();
229 if ( settings ) delete settings; 229 if ( settings ) delete settings;
230 settings = new Settings(); 230 settings = new Settings();
231 231
232 folderView->populate( settings->getAccounts() ); 232 folderView->populate( settings->getAccounts() );
233} 233}
234 234
235void OpieMail::displayMail() 235void OpieMail::displayMail()
236{ 236{
237 QListViewItem*item = mailView->currentItem(); 237 QListViewItem*item = mailView->currentItem();
238 if (!item) return; 238 if (!item) return;
239 RecMailP mail = ((MailListViewItem*)item)->data(); 239 RecMailP mail = ((MailListViewItem*)item)->data();
240 RecBodyP body = folderView->fetchBody(mail); 240 RecBodyP body = folderView->fetchBody(mail);
241 ViewMail readMail( this,"", Qt::WType_Modal ); 241 ViewMail readMail( this,"", Qt::WType_Modal );
242 readMail.setBody( body ); 242 readMail.setBody( body );
243 readMail.setMail( mail ); 243 readMail.setMail( mail );
244 readMail.showMaximized(); 244 readMail.showMaximized();
245 readMail.exec(); 245 readMail.exec();
246 246
247 if ( readMail.deleted ) 247 if ( readMail.deleted )
248 { 248 {
249 folderView->refreshCurrent(); 249 folderView->refreshCurrent();
250 } 250 }
251 else 251 else
252 { 252 {
253 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 253 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
254 } 254 }
255} 255}
256void OpieMail::slotGetAllMail() 256void OpieMail::slotGetAllMail()
257{ 257{
258 QListViewItem * item = folderView->firstChild(); 258 QListViewItem * item = folderView->firstChild();
259 while ( item ){ 259 while ( item ){
260 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 260 ((AccountViewItem *)item)->contextMenuSelected( 101 );
261 item = item->nextSibling (); 261 item = item->nextSibling ();
262 } 262 }
263} 263}
264void OpieMail::slotGetMail() 264void OpieMail::slotGetMail()
265{ 265{
266 QListViewItem * item = folderView->currentItem(); 266 QListViewItem * item = folderView->currentItem();
267 if ( ! item ) return; 267 if ( ! item ) return;
268 while ( item->parent () )
269 item = item->parent ();
270 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 268 ((AccountViewItem *)item)->contextMenuSelected( 101 );
271} 269}
272void OpieMail::slotDeleteMail() 270void OpieMail::slotDeleteMail()
273{ 271{
274 if (!mailView->currentItem()) return; 272 if (!mailView->currentItem()) return;
275 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 273 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
276 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 274 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
277 { 275 {
278 mail->Wrapper()->deleteMail( mail ); 276 mail->Wrapper()->deleteMail( mail );
279 folderView->refreshCurrent(); 277 folderView->refreshCurrent();
280 } 278 }
281} 279}
282void OpieMail::slotDeleteAllMail() 280void OpieMail::slotDeleteAllMail()
283{ 281{
284 282
285 QValueList<RecMailP> t; 283 QValueList<RecMailP> t;
286 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 284 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
287 { 285 {
288 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 286 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
289 while ( item ) { 287 while ( item ) {
290 if ( item->isSelected() ) { 288 if ( item->isSelected() ) {
291 t.append( item->data() ); 289 t.append( item->data() );
292 } 290 }
293 item = (MailListViewItem*)item->nextSibling(); 291 item = (MailListViewItem*)item->nextSibling();
294 } 292 }
295 } 293 }
296 else 294 else
297 return; 295 return;
298 if ( t.count() == 0 ) 296 if ( t.count() == 0 )
299 return; 297 return;
300 RecMailP mail = t.first(); 298 RecMailP mail = t.first();
301 mail->Wrapper()->deleteMailList(t); 299 mail->Wrapper()->deleteMailList(t);
302 folderView->refreshCurrent(); 300 folderView->refreshCurrent();
303 301
304 302
305} 303}
306void OpieMail::clearSelection() 304void OpieMail::clearSelection()
307{ 305{
308 mailView->clearSelection(); 306 mailView->clearSelection();
309 307
310} 308}
311 309
312void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 310void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
313{ 311{
314 if (!mailView->currentItem()) return; 312 if (!mailView->currentItem()) return;
315 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 313 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
316 /* just the RIGHT button - or hold on pda */ 314 /* just the RIGHT button - or hold on pda */
317 if (button!=2) {return;} 315 if (button!=2) {return;}
318 if (!item) return; 316 if (!item) return;
319 QPopupMenu *m = new QPopupMenu(0); 317 QPopupMenu *m = new QPopupMenu(0);
320 if (m) 318 if (m)
321 { 319 {
322 if (mailtype==MAILLIB::A_NNTP) { 320 if (mailtype==MAILLIB::A_NNTP) {
323 m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); 321 m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
324 m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); 322 m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
325 m->insertSeparator(); 323 m->insertSeparator();
326 m->insertItem(tr("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 324 m->insertItem(tr("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
327 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); 325 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection()));
328 } else { 326 } else {
329 if (folderView->currentisDraft()) { 327 if (folderView->currentisDraft()) {
330 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); 328 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
331 } 329 }
332 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 330 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
333 m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 331 m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
334 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 332 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
335 m->insertSeparator(); 333 m->insertSeparator();
336 m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 334 m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
337 m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 335 m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
338 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); 336 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection()));
339 } 337 }
340 m->setFocus(); 338 m->setFocus();
341 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 339 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
342 delete m; 340 delete m;
343 } 341 }
344} 342}
345 343
346void OpieMail::slotShowFolders( bool show ) 344void OpieMail::slotShowFolders( bool show )
347{ 345{
348 if ( show && folderView->isHidden() ) 346 if ( show && folderView->isHidden() )
349 { 347 {
350 folderView->show(); 348 folderView->show();
351 } 349 }
352 else if ( !show && !folderView->isHidden() ) 350 else if ( !show && !folderView->isHidden() )
353 { 351 {
354 folderView->hide(); 352 folderView->hide();
355 } 353 }
356} 354}
357 355
358void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 356void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
359{ 357{
360 MailListViewItem*item = 0; 358 MailListViewItem*item = 0;
361 mailView->clear(); 359 mailView->clear();
362 360
363 QValueList<RecMailP>::ConstIterator it; 361 QValueList<RecMailP>::ConstIterator it;
364 for (it = list.begin(); it != list.end();++it) 362 for (it = list.begin(); it != list.end();++it)
365 { 363 {
366 item = new MailListViewItem(mailView,item); 364 item = new MailListViewItem(mailView,item);
367 item->storeData((*it)); 365 item->storeData((*it));
368 item->showEntry(); 366 item->showEntry();
369 } 367 }
370} 368}
371 369
372void OpieMail::mailLeftClicked( QListViewItem *item ) 370void OpieMail::mailLeftClicked( QListViewItem *item )
373{ 371{
374 mailView->clearSelection(); 372 mailView->clearSelection();
375 /* just LEFT button - or tap with stylus on pda */ 373 /* just LEFT button - or tap with stylus on pda */
376 //if (button!=1) return; 374 //if (button!=1) return;
377 if (!item) return; 375 if (!item) return;
378 if (folderView->currentisDraft()) { 376 if (folderView->currentisDraft()) {
379 reEditMail(); 377 reEditMail();
380 } else { 378 } else {
381 displayMail(); 379 displayMail();
382 } 380 }
383} 381}
384 382
385void OpieMail::slotMoveCopyMail() 383void OpieMail::slotMoveCopyMail()
386{ 384{
387 if (!mailView->currentItem()) return; 385 if (!mailView->currentItem()) return;
388 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 386 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
389 AbstractMail*targetMail = 0; 387 AbstractMail*targetMail = 0;
390 QString targetFolder = ""; 388 QString targetFolder = "";
391 Selectstore sels; 389 Selectstore sels;
392 folderView->setupFolderselect(&sels); 390 folderView->setupFolderselect(&sels);
393 if (!sels.exec()) return; 391 if (!sels.exec()) return;
394 targetMail = sels.currentMail(); 392 targetMail = sels.currentMail();
395 targetFolder = sels.currentFolder(); 393 targetFolder = sels.currentFolder();
396 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 394 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
397 targetFolder.isEmpty()) 395 targetFolder.isEmpty())