-rw-r--r-- | kmicromail/opiemail.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 164988c..3aa7905 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -1,37 +1,38 @@ // CHANGED 2004-09-31 Lutz Rogowski // CHANGED 2004-08-06 Lutz Rogowski #include "settingsdialog.h" #include "opiemail.h" #include "editaccounts.h" #include "composemail.h" #include "mailistviewitem.h" #include "viewmail.h" #include "selectstore.h" #include "selectsmtp.h" #include "accountitem.h" #include "koprefsdialog.h" +#include "klocale.h" #include <qmessagebox.h> #include <qtimer.h> #include <libkdepim/externalapphandler.h> #include <libkdepim/kpimglobalprefs.h> #include <qpe/qpeapplication.h> #include <libmailwrapper/smtpwrapper.h> #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> /* OPIE */ //#include <qpe/resource.h> //#include <qpe/qpeapplication.h> /* QT */ //using namespace Opie::Core; OpieMail::OpieMail( QWidget *parent, const char *name ) : MainWindow( parent, name) //, WStyle_ContextHelp ) { settings = new Settings(); KPimGlobalPrefs::instance()->setGlobalConfig(); @@ -155,72 +156,72 @@ void OpieMail::slotComposeMail() else slotwriteMail( mPendingName, mPendingEmail ); } //slotwriteMail(0l,0l); } void OpieMail::slotSendQueued() { SMTPaccount *smtp = 0; QList<Account> list = settings->getAccounts(); QList<SMTPaccount> smtpList; smtpList.setAutoDelete(false); Account *it; for ( it = list.first(); it; it = list.next() ) { if ( it->getType() == MAILLIB::A_SMTP ) { smtp = static_cast<SMTPaccount *>(it); smtpList.append(smtp); } } if (smtpList.count()==0) { - QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); + QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); return; } if (smtpList.count()==1) { smtp = smtpList.at(0); } else { smtp = 0; selectsmtp selsmtp; selsmtp.setSelectionlist(&smtpList); selsmtp.showMaximized(); if ( selsmtp.exec() == QDialog::Accepted ) { smtp = selsmtp.selected_smtp(); } } if (smtp) { SMTPwrapper * wrap = new SMTPwrapper(smtp); if ( wrap->flushOutbox() ) { - QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); + QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed")); } delete wrap; } } void OpieMail::slotSearchMails() { qDebug("OpieMail::slotSearchMails():not implemented "); } void OpieMail::slotEditSettings() { #if 0 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); settingsDialog.showMaximized(); settingsDialog.exec(); #endif KOPrefsDialog settingsDialog( this, "koprefs", true ); settingsDialog.showMaximized(); settingsDialog.exec(); } void OpieMail::slotEditAccounts() { @@ -252,111 +253,111 @@ void OpieMail::displayMail() } else { ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); } } void OpieMail::slotGetAllMail() { QListViewItem * item = folderView->firstChild(); while ( item ){ ((AccountViewItem *)item)->contextMenuSelected( 101 ); item = item->nextSibling (); } } void OpieMail::slotGetMail() { QListViewItem * item = folderView->currentItem(); if ( ! item ) return; ((AccountViewItem *)item)->contextMenuSelected( 101 ); } void OpieMail::slotDeleteMail() { if (!mailView->currentItem()) return; RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); - 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 ) + if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { mail->Wrapper()->deleteMail( mail ); folderView->refreshCurrent(); } } void OpieMail::slotDeleteAllMail() { QValueList<RecMailP> t; - if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) + if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); while ( item ) { if ( item->isSelected() ) { t.append( item->data() ); } item = (MailListViewItem*)item->nextSibling(); } } else return; if ( t.count() == 0 ) return; RecMailP mail = t.first(); mail->Wrapper()->deleteMailList(t); folderView->refreshCurrent(); } void OpieMail::clearSelection() { mailView->clearSelection(); } void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) { if (!mailView->currentItem()) return; MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); /* just the RIGHT button - or hold on pda */ if (button!=2) {return;} if (!item) return; QPopupMenu *m = new QPopupMenu(0); if (m) { if (mailtype==MAILLIB::A_NNTP) { - m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); - m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); + m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); + m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); m->insertSeparator(); - m->insertItem(tr("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); - m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); + m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); + m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); } else { if (folderView->currentisDraft()) { - m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); + m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); } - m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); - m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); - m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); + m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); + m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); + m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); m->insertSeparator(); - m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); - m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); - m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); + m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); + m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); + m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); } m->setFocus(); m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); delete m; } } void OpieMail::slotShowFolders( bool show ) { if ( show && folderView->isHidden() ) { folderView->show(); } else if ( !show && !folderView->isHidden() ) { folderView->hide(); } } void OpieMail::refreshMailView(const QValueList<RecMailP>&list) { MailListViewItem*item = 0; mailView->clear(); @@ -379,90 +380,90 @@ void OpieMail::mailLeftClicked( QListViewItem *item ) reEditMail(); } else { displayMail(); } } void OpieMail::slotMoveCopyMail() { if (!mailView->currentItem()) return; RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); AbstractMail*targetMail = 0; QString targetFolder = ""; Selectstore sels; folderView->setupFolderselect(&sels); if (!sels.exec()) return; targetMail = sels.currentMail(); targetFolder = sels.currentFolder(); if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || targetFolder.isEmpty()) { return; } if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { - QMessageBox::critical(0,tr("Error creating new Folder"), - tr("<center>Error while creating<br>new folder - breaking.</center>")); + QMessageBox::critical(0,i18n("Error creating new Folder"), + i18n("<center>Error while creating<br>new folder - breaking.</center>")); return; } sels.hide(); qApp->processEvents(); // qDebug("hiding sels "); mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); folderView->refreshCurrent(); } void OpieMail::slotMoveCopyAllMail() { if (!mailView->currentItem()) return; QValueList<RecMailP> t; - // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) + // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); while ( item ) { if ( item->isSelected() ) { t.append( item->data() ); } item = (MailListViewItem*)item->nextSibling(); } } // else // return; if ( t.count() == 0 ) return; RecMailP mail = t.first(); AbstractMail*targetMail = 0; QString targetFolder = ""; Selectstore sels; folderView->setupFolderselect(&sels); if (!sels.exec()) return; targetMail = sels.currentMail(); targetFolder = sels.currentFolder(); if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || targetFolder.isEmpty()) { return; } if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { - QMessageBox::critical(0,tr("Error creating new Folder"), - tr("<center>Error while creating<br>new folder - breaking.</center>")); + QMessageBox::critical(0,i18n("Error creating new Folder"), + i18n("<center>Error while creating<br>new folder - breaking.</center>")); return; } sels.hide(); qApp->processEvents(); //qDebug("hiding sels "); mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); folderView->refreshCurrent(); } void OpieMail::reEditMail() { if (!mailView->currentItem()) return; ComposeMail compose( settings, this, 0, true ); compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); compose.slotAdjustColumns(); compose.showMaximized(); compose.exec(); } |