summaryrefslogtreecommitdiffabout
path: root/kmicromail/composemail.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 946e97d..35ad367 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -31,112 +31,112 @@
#ifdef DESKTOP_VERSION
#include <kabc/addresseedialog.h>
#else //DESKTOP_VERSION
#include <libkdepim/externalapphandler.h>
#endif //DESKTOP_VERSION
#include "koprefs.h"
//using namespace Opie::Core;
//using namespace Opie::Ui;
ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal )
: ComposeMailUI( parent, name, modal )
{
mPickLineEdit = 0;
connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
settings = s;
m_replyid = "";
if ( KOPrefs::instance()->mUseKapi) {
KConfig config( locateLocal("config", "kabcrc") );
config.setGroup( "General" );
QString whoami_uid = config.readEntry( "WhoAmI" );
if ( whoami_uid.isEmpty() ) {
- QMessageBox::information( 0, tr( "Hint" ),
- tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
- tr( "Ok" ) );
+ QMessageBox::information( 0, i18n( "Hint" ),
+ i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
+ i18n( "Ok" ) );
fillSettings();
} else
ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
#ifdef DESKTOP_VERSION
KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
QStringList mails = con.emails();
QString defmail = con.preferredEmail();
if ( mails.count() == 0)
- QMessageBox::information( 0, tr( "Hint" ),
- tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
- tr( "Ok" ) );
+ QMessageBox::information( 0, i18n( "Hint" ),
+ i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
+ i18n( "Ok" ) );
if (defmail.length()!=0) {
fromBox->insertItem(defmail);
}
QStringList::ConstIterator sit = mails.begin();
for (;sit!=mails.end();++sit) {
if ( (*sit)==defmail)
continue;
fromBox->insertItem((*sit));
}
senderNameEdit->setText(con.formattedName());
#endif
} else {
fillSettings();
}
checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
- attList->addColumn( tr( "Name" ) );
- attList->addColumn( tr( "Size" ) );
+ attList->addColumn( i18n( "Name" ) );
+ attList->addColumn( i18n( "Size" ) );
QList<Account> accounts = settings->getAccounts();
if ( QApplication::desktop()->width() < 320 )
smtpAccountBox->setMaximumWidth( 80 );
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
if ( it->getType()==MAILLIB::A_SMTP ) {
SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
smtpAccountBox->insertItem( smtp->getAccountName() );
smtpAccounts.append( smtp );
}
}
connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
mMail = 0;
warnAttach = true;
if ( smtpAccounts.count() > 0 ) {
fillValues( smtpAccountBox->currentItem() );
} else {
- QMessageBox::information( 0, tr( "Problem" ),
- tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
- tr( "Ok" ) );
+ QMessageBox::information( 0, i18n( "Problem" ),
+ i18n( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
+ i18n( "Ok" ) );
return;
}
connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
message->setFont ( KOPrefs::instance()->mComposeFont );
message->setWordWrap (QMultiLineEdit::WidgetWidth);
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
#endif
}
void ComposeMail::fillSettings()
{
if ( QApplication::desktop()->width() < 320 )
fromBox->setMaximumWidth( 100 );
QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
QStringList::ConstIterator sit = mailList.begin();
int pref = 0;
for (;sit!=mailList.end();++sit) {
fromBox->insertItem((*sit));
}
senderNameEdit->setText(KOPrefs::instance()->mName);
}
@@ -151,107 +151,107 @@ void ComposeMail::saveAsDraft()
mail->setCC( ccLine->text() );
mail->setBCC( bccLine->text() );
mail->setReply( replyLine->text() );
mail->setSubject( subjectLine->text() );
if (!m_replyid.isEmpty()) {
QStringList ids;
ids.append(m_replyid);
mail->setInreply(ids);
}
QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
txt.append( sigMultiLine->text() );
}
mail->setMessage( txt );
/* only use the default drafts folder name! */
Storemail wrapper(AbstractMail::draftFolder());
wrapper.storeMail(mail);
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
/* attachments we will ignore! */
if ( it != 0 ) {
if ( warnAttach )
- QMessageBox::warning(0,tr("Store message"),
- tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
+ QMessageBox::warning(0,i18n("Store message"),
+ i18n("<center>Attachments will not be stored in \"Draft\" folder</center>"));
warnAttach = false;
}
- setStatus( tr("Mail saved as draft!") );
+ setStatus( i18n("Mail saved as draft!") );
}
void ComposeMail::clearStatus()
{
- topLevelWidget()->setCaption( tr("Compose mail") );
+ topLevelWidget()->setCaption( i18n("Compose mail") );
}
void ComposeMail::setStatus( QString status )
{
topLevelWidget()->setCaption( status );
QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
}
void ComposeMail::pickAddress( )
{
QLineEdit *line = mPickLineEdit;
if ( line == 0 )
return;
#ifdef DESKTOP_VERSION
//qDebug(" ComposeMail::pickAddress ");
QString names ;//= AddressPicker::getNames();
KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
uint i=0;
for (i=0; i < list.count(); i++) {
if ( !list[i].preferredEmail().isEmpty()) {
if ( ! names.isEmpty() )
names+= ",";
names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
}
}
if ( line->text().isEmpty() ) {
line->setText( names );
} else if ( !names.isEmpty() ) {
line->setText( line->text() + ", " + names );
}
#else
bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
// the result should now arrive through method insertAttendees
#endif
}
//the map includes name/email pairs, that comes from Ka/Pi
void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
{
//qDebug("ComposeMail::insertAttendees ");
raise();
if ( mPickLineEdit == 0 ) { //whoami received
QString defmail = uidList[0];
if ( emailList.count() == 0 )
- QMessageBox::information( 0, tr( "Hint" ),
- tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
- tr( "Ok" ) );
+ QMessageBox::information( 0, i18n( "Hint" ),
+ i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
+ i18n( "Ok" ) );
if (defmail.length()!=0) {
fromBox->insertItem(defmail);
}
QStringList::ConstIterator sit = emailList.begin();
int pref = 0;
for (;sit!=emailList.end();++sit) {
if ( (*sit)==defmail)
continue;
fromBox->insertItem((*sit));
}
senderNameEdit->setText(nameList[0]);
return;
}
QString names ;
QLineEdit *line = mPickLineEdit;
if (uid == this->name())
{
for ( int i = 0; i < nameList.count(); i++)
{
QString _name = nameList[i];
QString _email = emailList[i];
QString _uid = uidList[i];
if ( ! _email.isEmpty() ) {
if ( ! names.isEmpty() )
@@ -334,138 +334,138 @@ void ComposeMail::fillValues( int )
void ComposeMail::slotAdjustColumns()
{
int currPage = tabWidget->currentPageIndex();
tabWidget->showPage( attachTab );
attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
attList->setColumnWidth( 1, 80 );
tabWidget->setCurrentPage( currPage );
}
void ComposeMail::addAttachment()
{
QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this );
if ( !lnk.isEmpty() ) {
Attachment *att = new Attachment( lnk );
(void) new AttachViewItem( attList, att );
}
}
void ComposeMail::removeAttachment()
{
if ( !attList->currentItem() ) {
- QMessageBox::information( this, tr( "Error" ),
- tr( "<p>Please select a File.</p>" ),
- tr( "Ok" ) );
+ QMessageBox::information( this, i18n( "Error" ),
+ i18n( "<p>Please select a File.</p>" ),
+ i18n( "Ok" ) );
} else {
attList->takeItem( attList->currentItem() );
}
}
void ComposeMail::accept()
{
if ( smtpAccountBox->count() == 0 ) {
reject();
return;
}
if (! checkBoxLater->isChecked() ) {
- int yesno = QMessageBox::warning(0,tr("Stop editing message"),
- tr("Send this message?"),
- tr("Yes"),
- tr("Cancel"));
+ int yesno = QMessageBox::warning(0,i18n("Stop editing message"),
+ i18n("Send this message?"),
+ i18n("Yes"),
+ i18n("Cancel"));
if (yesno == 1) {
return;
}
}
#if 0
odebug << "Sending Mail with "
<< smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
#endif
Opie::Core::OSmartPointer<Mail> mail=new Mail;
SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
mail->setMail(fromBox->currentText());
if ( !toLine->text().isEmpty() ) {
mail->setTo( toLine->text() );
} else {
- QMessageBox::warning(0,tr("Sending mail"),
- tr("No Receiver spezified" ) );
+ QMessageBox::warning(0,i18n("Sending mail"),
+ i18n("No Receiver spezified" ) );
return;
}
mail->setName(senderNameEdit->text());
mail->setCC( ccLine->text() );
mail->setBCC( bccLine->text() );
mail->setReply( replyLine->text() );
mail->setSubject( subjectLine->text() );
if (!m_replyid.isEmpty()) {
QStringList ids;
ids.append(m_replyid);
mail->setInreply(ids);
}
QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
txt.append( sigMultiLine->text() );
}
mail->setMessage( txt );
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
while ( it != 0 ) {
mail->addAttachment( it->getAttachment() );
it = (AttachViewItem *) it->nextSibling();
}
SMTPwrapper wrapper( smtp );
if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
setStatus( tr ("Mail sent"));
else {
setStatus( tr ("Error: Something went wrong. Nothing sent"));
return;
}
QDialog::accept();
}
void ComposeMail::reject()
{
//qDebug("ComposeMail::reject() ");
- int yesno = QMessageBox::warning(0,tr("Store message?"),
- tr("Store message into drafts?\n"),
- tr("Yes"),
- tr("No"));
+ int yesno = QMessageBox::warning(0,i18n("Store message?"),
+ i18n("Store message into drafts?\n"),
+ i18n("Yes"),
+ i18n("No"));
//qDebug("button %d ", yesno);
if (yesno == 0) {
if ( toLine->text().isEmpty() ) {
- QMessageBox::warning(0,tr("Sending mail"),
- tr("No Receiver spezified" ) );
+ QMessageBox::warning(0,i18n("Sending mail"),
+ i18n("No Receiver spezified" ) );
return;
}
saveAsDraft();
}
if (yesno == 2) {
qDebug("return ");
return;
}
QDialog::reject();
}
ComposeMail::~ComposeMail()
{
}
void ComposeMail::reEditMail(const RecMailP&current)
{
RecMailP data = current;
message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
subjectLine->setText( data->getSubject());
toLine->setText(data->To().join(","));
ccLine->setText(data->CC().join(","));
bccLine->setText(data->Bcc().join(","));
replyLine->setText(data->Replyto());