-rw-r--r-- | kmicromail/main.cpp | 3 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 48 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 41 |
3 files changed, 47 insertions, 45 deletions
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index 5362f08..8947ff8 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp @@ -1,62 +1,63 @@ // CHANGED 2004-08-06 Lutz Rogowski #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #include <libkdepim/externalapphandler.h> #include <stdlib.h> #else #include <qapplication.h> #include <qstring.h> #include <qwindowsstyle.h> #include <qplatinumstyle.h> #include <qsgistyle.h> #endif #include "opiemail.h" #include <qdir.h> #include <kstandarddirs.h> #include <kglobal.h> #include <stdio.h> #include "mainwindow.h" #include "koprefs.h" - +void dumpMissing(); //using namespace Opie::Core; int main( int argc, char **argv ) { #ifndef DESKTOP_VERSION QPEApplication a( argc, argv ); a.setKeepRunning (); #else QApplication a( argc, argv ); QApplication::setStyle( new QPlatinumStyle ()); #endif a.setFont( KOPrefs::instance()->mAppFont ); KGlobal::setAppName( "kopiemail" ); QString fileName ; #ifndef DESKTOP_VERSION fileName = getenv("QPEDIR"); if ( QApplication::desktop()->width() > 320 ) KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); else KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); #else fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/"; KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); OpieMail mw; #ifndef DESKTOP_VERSION //qDebug("CONNECT "); QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); a.showMainWidget(&mw ); #else a.setMainWidget(&mw ); mw.show(); //m.resize( 800, 600 ); QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); #endif int rv = a.exec(); + dumpMissing(); return rv; } diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index ddded2a..c77345b 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -1,303 +1,303 @@ // CHANGED 2004-08-06 Lutz Rogowski #include <qlabel.h> #include <qvbox.h> #include <qheader.h> #include <qtimer.h> #include <qlayout.h> #include <kdialog.h> #include <kiconloader.h> #include <kapplication.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #endif #include "defines.h" #include "mainwindow.h" #include <KDGanttMinimizeSplitter.h> #include <kabc/stdaddressbook.h> MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name ) //, flags ) { - setCaption( tr( "KOpieMail/Pi" ) ); + setCaption( i18n( "KOpieMail/Pi" ) ); setToolBarsMovable( false ); //KABC::StdAddressBook::self(); toolBar = new QToolBar( this ); menuBar = new QPEMenuBar( toolBar ); mailMenu = new QPopupMenu( menuBar ); - menuBar->insertItem( tr( "Mail" ), mailMenu ); + menuBar->insertItem( i18n( "Mail" ), mailMenu ); settingsMenu = new QPopupMenu( menuBar ); - menuBar->insertItem( tr( "Settings" ), settingsMenu ); + menuBar->insertItem( i18n( "Settings" ), settingsMenu ); addToolBar( toolBar ); toolBar->setHorizontalStretchable( true ); - QAction* getMail = new QAction( tr( "Get all new mails" ), SmallIcon("enter"), + QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), 0, 0, this ); connect(getMail, SIGNAL( activated() ), SLOT( slotGetAllMail() ) ); getMail->addTo( mailMenu ); - getMail = new QAction( tr( "Get new messages" ), SmallIcon("add"), + getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), 0, 0, this ); getMail->addTo( toolBar ); getMail->addTo( mailMenu ); connect(getMail, SIGNAL( activated() ), SLOT( slotGetMail() ) ); - composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), + composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), 0, 0, this ); composeMail->addTo( toolBar ); composeMail->addTo( mailMenu ); - sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , + sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , 0, 0, this ); sendQueued->addTo( toolBar ); sendQueued->addTo( mailMenu ); /* - syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, + syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, 0, 0, this ); syncFolders->addTo( toolBar ); syncFolders->addTo( mailMenu ); */ - showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , + showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , 0, 0, this, 0, true ); showFolders->addTo( toolBar ); showFolders->addTo( mailMenu ); showFolders->setOn( true ); connect(showFolders, SIGNAL( toggled(bool) ), SLOT( slotShowFolders(bool) ) ); /* - searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), + searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 0, 0, this ); searchMails->addTo( toolBar ); searchMails->addTo( mailMenu ); */ - deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); + deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); deleteMails->addTo( toolBar ); deleteMails->addTo( mailMenu ); connect( deleteMails, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); - editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , + editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , 0, 0, this ); editSettings->addTo( settingsMenu ); connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); - editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , + editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 0, 0, this ); editAccounts->addTo( settingsMenu ); //setCentralWidget( view ); QVBox* wrapperBox = new QVBox( this ); setCentralWidget( wrapperBox ); // QWidget *view = new QWidget( wrapperBox ); KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); folderView = new AccountView( split ); folderView->header()->hide(); folderView->setRootIsDecorated( false ); - folderView->addColumn( tr( "Mailbox" ) ); + folderView->addColumn( i18n( "Mailbox" ) ); //layout->addWidget( folderView ); mailView = new QListView( split ); - mailView->addColumn( tr( " " ) ); - mailView->addColumn( tr( "Subject" ),QListView::Manual ); - mailView->addColumn( tr( "Sender" ),QListView::Manual ); - mailView->addColumn( tr( "Size" ),QListView::Manual); - mailView->addColumn( tr( "Date" ),QListView::Manual); + mailView->addColumn( i18n( " " ) ); + mailView->addColumn( i18n( "Subject" ),QListView::Manual ); + mailView->addColumn( i18n( "Sender" ),QListView::Manual ); + mailView->addColumn( i18n( "Size" ),QListView::Manual); + mailView->addColumn( i18n( "Date" ),QListView::Manual); mailView->setAllColumnsShowFocus(true); //mailView->setSorting(-1); mailView->setRootIsDecorated( false ); statusWidget = new StatusWidget( wrapperBox ); statusWidget->hide(); //layout->addWidget( mailView ); //layout->setStretchFactor( folderView, 1 ); //layout->setStretchFactor( mailView, 2 ); slotAdjustLayout(); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); #endif connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, SLOT( mailLeftClicked(QListViewItem*) ) ); connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, SLOT( mailLeftClicked(QListViewItem*) ) ); connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), this,SLOT(refreshMailView(const QValueList<RecMailP>&))); connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); //mailView->setMultiSelection ( true ); mailView->setSelectionMode( QListView::Extended ); QValueList<int> list; int fw = 100; if ( QApplication::desktop()->width() > 320 ) fw = 50; list.append( fw ); list.append( 100 ); split->setSizes( list ); QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); mailView->setShowSortIndicator ( true ); QLabel *spacer = new QLabel( toolBar ); spacer->setBackgroundMode( QWidget::PaletteButton ); toolBar->setStretchableWidget( spacer ); - QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); + QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); if ( QApplication::desktop()->width() > 320 ) closeMail->addTo(toolBar); closeMail->addTo(mailMenu); QPopupMenu* helpMenu = new QPopupMenu( menuBar ); - menuBar->insertItem( tr( "Help" ), helpMenu ); - QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this); + menuBar->insertItem( i18n( "Help" ), helpMenu ); + QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); li->addTo(helpMenu); - li = new QAction(tr("Licence"),QPixmap(), 0, 0, this); + li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); li->addTo(helpMenu); - li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this); + li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); li->addTo(helpMenu); } MainWindow::~MainWindow() { } void MainWindow::showLicence() { KApplication::showLicence(); } void MainWindow::showAbout() { QString version; #include <../version> QString cap = "About KOpieMail/Pi"; QString text = i18n("KOpieMail/Platform-independent\n") + "(OM/Pi) " + version + " - " #ifdef DESKTOP_VERSION "Desktop Edition\n" #else "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" #endif "www.pi-sync.net\n\n" "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" "KOpieMail/Pi is based on Opie Mail\n" "Copyright (c) Rajko Albrecht and the Opie team\n" "KOpieMail/Pi is licensed under the GPL\n" "\n" "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" "libEtPan has its own licence - see LibEtPan licence\n"; KApplication::showText( cap, text ); } void MainWindow::showEtpanLicence() { KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); } void MainWindow::appMessage(const QCString &, const QByteArray &) { qDebug("appMessage implemented by subclass"); } void MainWindow::slotAdjustLayout() { /* QWidget *d = QApplication::desktop(); if ( d->width() < d->height() ) { layout->setDirection( QBoxLayout::TopToBottom ); } else { layout->setDirection( QBoxLayout::LeftToRight ); } */ } void MainWindow::slotAdjustColumns() { bool hidden = folderView->isHidden(); if ( hidden ) folderView->show(); folderView->setColumnWidth( 0, folderView->visibleWidth() ); if ( hidden ) folderView->hide(); mailView->setColumnWidth( 0, 10 ); mailView->setColumnWidth( 1, 100 ); mailView->setColumnWidth( 2, 100 ); mailView->setColumnWidth( 3, 50 ); mailView->setColumnWidth( 4, 120 ); } void MainWindow::slotEditSettings() { } void MainWindow::slotShowFolders( bool ) { qDebug("not implemented: "); } void MainWindow::refreshMailView(const QValueList<RecMailP>&) { qDebug("not implemented: "); } void MainWindow::mailLeftClicked(QListViewItem * ) { qDebug("not implemented: "); } void MainWindow::displayMail() { qDebug("not implemented: "); } void MainWindow::slotDeleteMail() { qDebug("not implemented: "); } void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) { qDebug("not implemented: "); } void MainWindow::slotSendQueued() { qDebug("not implemented: "); } void MainWindow::slotEditAccounts() { qDebug("not implemented: "); } void MainWindow::slotComposeMail() { qDebug("not implemented: "); } diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 164988c..3aa7905 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -1,468 +1,469 @@ // 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(); folderView->populate( settings->getAccounts() ); } OpieMail::~OpieMail() { if (settings) delete settings; } void OpieMail::appMessage(const QCString &msg, const QByteArray &data) { } #include <stdlib.h> void OpieMail::message(const QCString &msg, const QByteArray &data) { // copied from old mail2 static int ii = 0; //qDebug("QCOP CALL ############################# %d ", ii); //QString mess ( msg ); //qDebug("Message = %s ",mess.latin1()); ++ii; //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); mPendingEmail = QString::null; mPendingName = QString::null; if (msg == "writeMail(QString,QString)") { //qDebug("writeMail(QString,QString) "); QDataStream stream(data,IO_ReadOnly); stream >> mPendingName >> mPendingEmail; // removing the whitespaces at beginning and end is needed! QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); } else if (msg == "newMail()") { //qDebug("slotComposeMail() "); // we cannot call slotComposeMail(); directly, because may be executing a QCOP call // and a QCOP call does not like a processevents in his execution // with the Qtimer we call slotComposeMail() after we reached the main event loop QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); // slotComposeMail(); } else if (msg == "newMail(QString)") { //qDebug(" newMail(QString)"); QDataStream stream(data,IO_ReadOnly); stream >> mPendingName; // the format is // NAME <EMAIL>:SUBJECT QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); } else { mPendingData = data; mPendingMessage = msg; QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); } //qDebug("END OpieMail::message "); } void OpieMail::slotExtAppHandler() { ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); } void OpieMail::slotwriteMail2(const QString& namemail ) { //qDebug("OpieMail::slotwriteMail2 "); //qApp->processEvents(); ComposeMail compose( settings, this, 0, true ); if ( !namemail.isEmpty() ) { QString to = namemail; if ( namemail.find( " <") > 1 ) { to = "\"" +to.replace( QRegExp( " <"), "\" <") ; } else if ( namemail.find( "<") > 1 ) { to = "\"" +to.replace( QRegExp( "<"), "\" <") ; } int sub = to.find( ">:"); if ( sub > 0 ) { compose.setTo( to.left(sub+1) ); compose.setSubject( to.mid(sub+2) ); } else compose.setTo( to ); } compose.slotAdjustColumns(); compose.showMaximized(); compose.exec(); raise(); //qDebug("retttich "); } void OpieMail::slotwriteMail(const QString&name,const QString&email) { // qDebug("OpieMail::slotwriteMail "); ComposeMail compose( settings, this, 0, true ); if (!email.isEmpty()) { if (!name.isEmpty()) { compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); } else { compose.setTo(email); } } compose.slotAdjustColumns(); compose.showMaximized(); compose.exec(); raise(); } void OpieMail::slotComposeMail() { if ( mPendingEmail == QString::null && mPendingName == QString::null) slotwriteMail2( QString () ); else { if ( mPendingEmail == QString::null ) slotwriteMail2( mPendingName ); 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() { EditAccounts eaDialog( settings, this, 0, true ); eaDialog.slotAdjustColumns(); eaDialog.showMaximized(); eaDialog.exec(); if ( settings ) delete settings; settings = new Settings(); folderView->populate( settings->getAccounts() ); } void OpieMail::displayMail() { QListViewItem*item = mailView->currentItem(); if (!item) return; RecMailP mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); ViewMail readMail( this,"", Qt::WType_Modal ); readMail.setBody( body ); readMail.setMail( mail ); readMail.showMaximized(); readMail.exec(); if ( readMail.deleted ) { folderView->refreshCurrent(); } 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(); QValueList<RecMailP>::ConstIterator it; for (it = list.begin(); it != list.end();++it) { item = new MailListViewItem(mailView,item); item->storeData((*it)); item->showEntry(); } } void OpieMail::mailLeftClicked( QListViewItem *item ) { mailView->clearSelection(); /* just LEFT button - or tap with stylus on pda */ //if (button!=1) return; if (!item) return; if (folderView->currentisDraft()) { 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(); } |