-rw-r--r-- | kmicromail/composemail.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 2dcbc75..f44100b 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -230,274 +230,274 @@ void ComposeMail::pickAddress( ) 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, 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() ) names+= ","; names+= "\""+_name +"\"<" +_email +">"; } } } if ( line->text().isEmpty() ) { line->setText( names ); } else if ( !names.isEmpty() ) { line->setText( line->text() + ", " + names ); } } void ComposeMail::setTo( const QString & to ) { toLine->setText( to ); } void ComposeMail::setSubject( const QString & subject ) { subjectLine->setText( subject ); } void ComposeMail::setInReplyTo( const QString & messageId ) { m_replyid = messageId; } void ComposeMail::setMessage( const QString & text ) { message->setText( text ); } void ComposeMail::pickAddressTo() { mPickLineEdit = toLine; pickAddress( ); } void ComposeMail::pickAddressCC() { mPickLineEdit = ccLine; pickAddress( ); } void ComposeMail::pickAddressBCC() { mPickLineEdit = bccLine; pickAddress( ); } void ComposeMail::pickAddressReply() { mPickLineEdit = replyLine; pickAddress( ); } void ComposeMail::fillValues( int ) { #if 0 SMTPaccount *smtp = smtpAccounts.at( current ); ccLine->clear(); if ( smtp->getUseCC() ) { ccLine->setText( smtp->getCC() ); } bccLine->clear(); if ( smtp->getUseBCC() ) { bccLine->setText( smtp->getBCC() ); } replyLine->clear(); if ( smtp->getUseReply() ) { replyLine->setText( smtp->getReply() ); } sigMultiLine->setText( smtp->getSignature() ); #endif } 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, 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,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().utf8 ()); if ( !toLine->text().isEmpty() ) { mail->setTo( toLine->text().utf8 () ); } else { QMessageBox::warning(0,i18n("Sending mail"), i18n("No Receiver spezified" ) ); return; } mail->setName(senderNameEdit->text().utf8 ()); mail->setCC( ccLine->text().utf8 () ); mail->setBCC( bccLine->text().utf8 () ); mail->setReply( replyLine->text().utf8 () ); mail->setSubject( subjectLine->text().utf8 () ); if (!m_replyid.isEmpty()) { QStringList ids; ids.append(m_replyid.utf8 ()); mail->setInreply(ids); } QString txt = message->text().utf8 (); if ( !sigMultiLine->text().isEmpty() ) { txt.append( "\n--\n" ); txt.append( sigMultiLine->text().utf8 () ); } 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,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,i18n("Sending mail"), i18n("No Receiver spezified" ) ); return; } saveAsDraft(); } if (yesno == 2) { qDebug("return "); return; } QDialog::reject(); } ComposeMail::~ComposeMail() { } void ComposeMail::reEditMail(const RecMailP¤t) { RecMailP data = current; - message->setText(QString::fromUtf8( data->Wrapper()->fetchBody(current)->Bodytext().latin1() )); - subjectLine->setText( QString::fromUtf8( data->getSubject().latin1() )); - toLine->setText(QString::fromUtf8( data->To().join(",").latin1() )); - ccLine->setText(QString::fromUtf8( data->CC().join(",").latin1() )); - bccLine->setText(QString::fromUtf8( data->Bcc().join(",").latin1() )); - replyLine->setText(QString::fromUtf8( data->Replyto().latin1() )); + 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()); } AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) : QListViewItem( parent ) { attachment = att; if ( !attachment->getPixmap().isNull() ) setPixmap( 0,attachment->getPixmap() ); setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); setText( 1, QString::number( att->getSize() ) ); } |