summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-06 16:42:29 (UTC)
committer zautrix <zautrix>2004-07-06 16:42:29 (UTC)
commit12695014a6bbf791f084d479a33883eeeb6d4e3b (patch) (unidiff)
tree7877a59b574584303f930a91c8f265aa27e84e0a
parent45e2744074e876a74919b340efc320bdadadcb25 (diff)
downloadkdepimpi-12695014a6bbf791f084d479a33883eeeb6d4e3b.zip
kdepimpi-12695014a6bbf791f084d479a33883eeeb6d4e3b.tar.gz
kdepimpi-12695014a6bbf791f084d479a33883eeeb6d4e3b.tar.bz2
Fixed a crash
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index c1b58a4..9060364 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -60,50 +60,51 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
60 cfg.setGroup( "Compose" ); 60 cfg.setGroup( "Compose" );
61 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 61 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
62 62
63 attList->addColumn( tr( "Name" ) ); 63 attList->addColumn( tr( "Name" ) );
64 attList->addColumn( tr( "Size" ) ); 64 attList->addColumn( tr( "Size" ) );
65 65
66 QList<Account> accounts = settings->getAccounts(); 66 QList<Account> accounts = settings->getAccounts();
67 67
68 Account *it; 68 Account *it;
69 for ( it = accounts.first(); it; it = accounts.next() ) { 69 for ( it = accounts.first(); it; it = accounts.next() ) {
70 if ( it->getType()==MAILLIB::A_SMTP ) { 70 if ( it->getType()==MAILLIB::A_SMTP ) {
71 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 71 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
72 smtpAccountBox->insertItem( smtp->getAccountName() ); 72 smtpAccountBox->insertItem( smtp->getAccountName() );
73 smtpAccounts.append( smtp ); 73 smtpAccounts.append( smtp );
74 } 74 }
75 } 75 }
76 if ( smtpAccounts.count() > 0 ) {
77 fillValues( smtpAccountBox->currentItem() );
78 } else {
79 QMessageBox::information( 0, tr( "Problem" ),
80 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
81 tr( "Ok" ) );
82 return;
83 }
76 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 84 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
77 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 85 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
78 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 86 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
79 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 87 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
80 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 88 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
81 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 89 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
82 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 90 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
83 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 91 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
84 mMail = 0; 92 mMail = 0;
85 warnAttach = true; 93 warnAttach = true;
86 if ( smtpAccounts.count() > 0 ) { 94
87 fillValues( smtpAccountBox->currentItem() );
88 } else {
89 QMessageBox::information( 0, tr( "Problem" ),
90 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
91 tr( "Ok" ) );
92 return;
93 }
94} 95}
95void ComposeMail::saveAsDraft() 96void ComposeMail::saveAsDraft()
96{ 97{
97 98
98 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 99 Opie::Core::OSmartPointer<Mail> mail= new Mail();
99 mail->setMail(fromBox->currentText()); 100 mail->setMail(fromBox->currentText());
100 mail->setTo( toLine->text() ); 101 mail->setTo( toLine->text() );
101 mail->setName(senderNameEdit->text()); 102 mail->setName(senderNameEdit->text());
102 mail->setCC( ccLine->text() ); 103 mail->setCC( ccLine->text() );
103 mail->setBCC( bccLine->text() ); 104 mail->setBCC( bccLine->text() );
104 mail->setReply( replyLine->text() ); 105 mail->setReply( replyLine->text() );
105 mail->setSubject( subjectLine->text() ); 106 mail->setSubject( subjectLine->text() );
106 if (!m_replyid.isEmpty()) { 107 if (!m_replyid.isEmpty()) {
107 QStringList ids; 108 QStringList ids;
108 ids.append(m_replyid); 109 ids.append(m_replyid);
109 mail->setInreply(ids); 110 mail->setInreply(ids);
@@ -243,32 +244,38 @@ void ComposeMail::addAttachment()
243 } 244 }
244} 245}
245 246
246void ComposeMail::removeAttachment() 247void ComposeMail::removeAttachment()
247{ 248{
248 if ( !attList->currentItem() ) { 249 if ( !attList->currentItem() ) {
249 QMessageBox::information( this, tr( "Error" ), 250 QMessageBox::information( this, tr( "Error" ),
250 tr( "<p>Please select a File.</p>" ), 251 tr( "<p>Please select a File.</p>" ),
251 tr( "Ok" ) ); 252 tr( "Ok" ) );
252 } else { 253 } else {
253 attList->takeItem( attList->currentItem() ); 254 attList->takeItem( attList->currentItem() );
254 } 255 }
255} 256}
256 257
257void ComposeMail::accept() 258void ComposeMail::accept()
258{ 259{
260 if ( smtpAccountBox->count() == 0 ) {
261
262 reject();
263 return;
264 }
265
259 if (! checkBoxLater->isChecked() ) { 266 if (! checkBoxLater->isChecked() ) {
260 int yesno = QMessageBox::warning(0,tr("Stop editing message"), 267 int yesno = QMessageBox::warning(0,tr("Stop editing message"),
261 tr("Send this message?"), 268 tr("Send this message?"),
262 tr("Yes"), 269 tr("Yes"),
263 tr("Cancel")); 270 tr("Cancel"));
264 271
265 if (yesno == 1) { 272 if (yesno == 1) {
266 return; 273 return;
267 } 274 }
268 } 275 }
269#if 0 276#if 0
270 odebug << "Sending Mail with " 277 odebug << "Sending Mail with "
271 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; 278 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
272#endif 279#endif
273 Opie::Core::OSmartPointer<Mail> mail=new Mail; 280 Opie::Core::OSmartPointer<Mail> mail=new Mail;
274 281
@@ -314,32 +321,37 @@ void ComposeMail::accept()
314 } 321 }
315 322
316 323
317 QDialog::accept(); 324 QDialog::accept();
318} 325}
319 326
320void ComposeMail::reject() 327void ComposeMail::reject()
321{ 328{
322 //qDebug("ComposeMail::reject() "); 329 //qDebug("ComposeMail::reject() ");
323 int yesno = QMessageBox::warning(0,tr("Store message?"), 330 int yesno = QMessageBox::warning(0,tr("Store message?"),
324 tr("Store message into drafts?\n"), 331 tr("Store message into drafts?\n"),
325 tr("Yes"), 332 tr("Yes"),
326 tr("No")); 333 tr("No"));
327 334
328 //qDebug("button %d ", yesno); 335 //qDebug("button %d ", yesno);
329 if (yesno == 0) { 336 if (yesno == 0) {
337 if ( toLine->text().isEmpty() ) {
338 QMessageBox::warning(0,tr("Sending mail"),
339 tr("No Receiver spezified" ) );
340 return;
341 }
330 saveAsDraft(); 342 saveAsDraft();
331 } 343 }
332 if (yesno == 2) { 344 if (yesno == 2) {
333 qDebug("return "); 345 qDebug("return ");
334 return; 346 return;
335 } 347 }
336 QDialog::reject(); 348 QDialog::reject();
337} 349}
338 350
339ComposeMail::~ComposeMail() 351ComposeMail::~ComposeMail()
340{ 352{
341} 353}
342 354
343void ComposeMail::reEditMail(const RecMailP&current) 355void ComposeMail::reEditMail(const RecMailP&current)
344{ 356{
345 RecMailP data = current; 357 RecMailP data = current;