-rw-r--r-- | kmicromail/composemail.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 976e309..ed8a2ee 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -140,42 +140,51 @@ ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, boo | |||
140 | #endif | 140 | #endif |
141 | message->setFont ( KOPrefs::instance()->mComposeFont ); | 141 | message->setFont ( KOPrefs::instance()->mComposeFont ); |
142 | message->setWordWrap (QMultiLineEdit::WidgetWidth); | 142 | message->setWordWrap (QMultiLineEdit::WidgetWidth); |
143 | if ( smtpAccounts.count() > 0 ) { | 143 | if ( smtpAccounts.count() > 0 ) { |
144 | fillValues( smtpAccountBox->currentItem() ); | 144 | fillValues( smtpAccountBox->currentItem() ); |
145 | } else { | 145 | } else { |
146 | QMessageBox::information( 0, i18n( "Problem" ), | 146 | QMessageBox::information( 0, i18n( "Problem" ), |
147 | i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), | 147 | i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), |
148 | i18n( "Ok" ) ); | 148 | i18n( "Ok" ) ); |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 151 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
152 | 152 | connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) ); | |
153 | if ( smtpAccountBox->count()) | ||
154 | fillValues(0); | ||
153 | 155 | ||
154 | } | 156 | } |
155 | 157 | ||
156 | void ComposeMail::fillSettings() | 158 | void ComposeMail::fillSettings() |
157 | { | 159 | { |
158 | if ( QApplication::desktop()->width() < 320 ) | 160 | if ( QApplication::desktop()->width() < 320 ) |
159 | fromBox->setMaximumWidth( 100 ); | 161 | fromBox->setMaximumWidth( 100 ); |
160 | QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); | 162 | QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); |
161 | QStringList::ConstIterator sit = mailList.begin(); | 163 | QStringList::ConstIterator sit = mailList.begin(); |
162 | int pref = 0; | 164 | int pref = 0; |
163 | for (;sit!=mailList.end();++sit) { | 165 | for (;sit!=mailList.end();++sit) { |
164 | fromBox->insertItem((*sit)); | 166 | fromBox->insertItem((*sit)); |
165 | } | 167 | } |
166 | senderNameEdit->setText(KOPrefs::instance()->mName); | 168 | senderNameEdit->setText(KOPrefs::instance()->mName); |
167 | } | 169 | } |
168 | 170 | void ComposeMail::saveSig() | |
169 | 171 | { | |
172 | if ( smtpAccountBox->count()) { | ||
173 | int cur = smtpAccountBox->currentItem (); | ||
174 | SMTPaccount *smtp = smtpAccounts.at( cur ); | ||
175 | if ( smtp ) | ||
176 | smtp->setSignature( sigMultiLine->text()); | ||
177 | } | ||
178 | } | ||
170 | void ComposeMail::saveAsDraft() | 179 | void ComposeMail::saveAsDraft() |
171 | { | 180 | { |
172 | 181 | ||
173 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 182 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
174 | mail->setMail(fromBox->currentText()); | 183 | mail->setMail(fromBox->currentText()); |
175 | mail->setTo( toLine->text() ); | 184 | mail->setTo( toLine->text() ); |
176 | mail->setName(senderNameEdit->text()); | 185 | mail->setName(senderNameEdit->text()); |
177 | mail->setCC( ccLine->text() ); | 186 | mail->setCC( ccLine->text() ); |
178 | mail->setBCC( bccLine->text() ); | 187 | mail->setBCC( bccLine->text() ); |
179 | mail->setReply( replyLine->text() ); | 188 | mail->setReply( replyLine->text() ); |
180 | mail->setSubject( subjectLine->text() ); | 189 | mail->setSubject( subjectLine->text() ); |
181 | if (!m_replyid.isEmpty()) { | 190 | if (!m_replyid.isEmpty()) { |
@@ -329,42 +338,44 @@ void ComposeMail::pickAddressCC() | |||
329 | void ComposeMail::pickAddressBCC() | 338 | void ComposeMail::pickAddressBCC() |
330 | { | 339 | { |
331 | mPickLineEdit = bccLine; | 340 | mPickLineEdit = bccLine; |
332 | pickAddress( ); | 341 | pickAddress( ); |
333 | } | 342 | } |
334 | 343 | ||
335 | void ComposeMail::pickAddressReply() | 344 | void ComposeMail::pickAddressReply() |
336 | { | 345 | { |
337 | mPickLineEdit = replyLine; | 346 | mPickLineEdit = replyLine; |
338 | pickAddress( ); | 347 | pickAddress( ); |
339 | } | 348 | } |
340 | 349 | ||
341 | void ComposeMail::fillValues( int ) | 350 | void ComposeMail::fillValues( int current ) |
342 | { | 351 | { |
343 | #if 0 | 352 | #if 0 |
344 | SMTPaccount *smtp = smtpAccounts.at( current ); | 353 | SMTPaccount *smtp = smtpAccounts.at( current ); |
345 | ccLine->clear(); | 354 | ccLine->clear(); |
346 | if ( smtp->getUseCC() ) { | 355 | if ( smtp->getUseCC() ) { |
347 | ccLine->setText( smtp->getCC() ); | 356 | ccLine->setText( smtp->getCC() ); |
348 | } | 357 | } |
349 | bccLine->clear(); | 358 | bccLine->clear(); |
350 | if ( smtp->getUseBCC() ) { | 359 | if ( smtp->getUseBCC() ) { |
351 | bccLine->setText( smtp->getBCC() ); | 360 | bccLine->setText( smtp->getBCC() ); |
352 | } | 361 | } |
353 | replyLine->clear(); | 362 | replyLine->clear(); |
354 | if ( smtp->getUseReply() ) { | 363 | if ( smtp->getUseReply() ) { |
355 | replyLine->setText( smtp->getReply() ); | 364 | replyLine->setText( smtp->getReply() ); |
356 | } | 365 | } |
357 | sigMultiLine->setText( smtp->getSignature() ); | ||
358 | #endif | 366 | #endif |
367 | SMTPaccount *smtp = smtpAccounts.at( current ); | ||
368 | if ( smtp ) | ||
369 | sigMultiLine->setText( smtp->getSignature() ); | ||
359 | } | 370 | } |
360 | 371 | ||
361 | void ComposeMail::slotAdjustColumns() | 372 | void ComposeMail::slotAdjustColumns() |
362 | { | 373 | { |
363 | int currPage = tabWidget->currentPageIndex(); | 374 | int currPage = tabWidget->currentPageIndex(); |
364 | 375 | ||
365 | tabWidget->showPage( attachTab ); | 376 | tabWidget->showPage( attachTab ); |
366 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 377 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
367 | attList->setColumnWidth( 1, 80 ); | 378 | attList->setColumnWidth( 1, 80 ); |
368 | 379 | ||
369 | tabWidget->setCurrentPage( currPage ); | 380 | tabWidget->setCurrentPage( currPage ); |
370 | } | 381 | } |