-rw-r--r-- | kmicromail/composemail.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 9060364..654cfc0 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,375 +1,376 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | 2 | ||
2 | #include "composemail.h" | 3 | #include "composemail.h" |
3 | 4 | ||
4 | #include <libmailwrapper/smtpwrapper.h> | 5 | #include <libmailwrapper/smtpwrapper.h> |
5 | #include <libmailwrapper/storemail.h> | 6 | #include <libmailwrapper/storemail.h> |
6 | #include <libmailwrapper/abstractmail.h> | 7 | #include <libmailwrapper/abstractmail.h> |
7 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
8 | 9 | ||
9 | /* OPIE */ | 10 | /* OPIE */ |
10 | //#include <opie2/ofiledialog.h> | 11 | //#include <opie2/ofiledialog.h> |
11 | //#include <opie2/odebug.h> | 12 | //#include <opie2/odebug.h> |
12 | #include <kfiledialog.h> | 13 | #include <kfiledialog.h> |
13 | //#include <qpe/resource.h> | 14 | //#include <qpe/resource.h> |
14 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
15 | #include <qpe/global.h> | 16 | #include <qpe/global.h> |
16 | //#include <qpe/contact.h> | 17 | //#include <qpe/contact.h> |
17 | 18 | ||
18 | 19 | ||
19 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
20 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
21 | #include <qtimer.h> | 22 | #include <qtimer.h> |
22 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
23 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
24 | #include <qmultilineedit.h> | 25 | #include <qmultilineedit.h> |
25 | #include <qlabel.h> | 26 | #include <qlabel.h> |
26 | #include <qtabwidget.h> | 27 | #include <qtabwidget.h> |
27 | #include <qlistview.h> | 28 | #include <qlistview.h> |
28 | #include <kabc/addresseedialog.h> | 29 | #include <kabc/addresseedialog.h> |
29 | #include <kabc/stdaddressbook.h> | 30 | #include <kabc/stdaddressbook.h> |
30 | #include <kabc/addressee.h> | 31 | #include <kabc/addressee.h> |
31 | 32 | ||
32 | 33 | ||
33 | 34 | ||
34 | //using namespace Opie::Core; | 35 | //using namespace Opie::Core; |
35 | //using namespace Opie::Ui; | 36 | //using namespace Opie::Ui; |
36 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 37 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
37 | : ComposeMailUI( parent, name, modal, flags ) | 38 | : ComposeMailUI( parent, name, modal, flags ) |
38 | { | 39 | { |
39 | 40 | ||
40 | settings = s; | 41 | settings = s; |
41 | m_replyid = ""; | 42 | m_replyid = ""; |
42 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 43 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
43 | QStringList mails = con.emails(); | 44 | QStringList mails = con.emails(); |
44 | QString defmail = con.preferredEmail(); | 45 | QString defmail = con.preferredEmail(); |
45 | if ( mails.count() == 0) | 46 | if ( mails.count() == 0) |
46 | QMessageBox::information( 0, tr( "Hint" ), | 47 | QMessageBox::information( 0, tr( "Hint" ), |
47 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 48 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
48 | tr( "Ok" ) ); | 49 | tr( "Ok" ) ); |
49 | if (defmail.length()!=0) { | 50 | if (defmail.length()!=0) { |
50 | fromBox->insertItem(defmail); | 51 | fromBox->insertItem(defmail); |
51 | } | 52 | } |
52 | QStringList::ConstIterator sit = mails.begin(); | 53 | QStringList::ConstIterator sit = mails.begin(); |
53 | for (;sit!=mails.end();++sit) { | 54 | for (;sit!=mails.end();++sit) { |
54 | if ( (*sit)==defmail) | 55 | if ( (*sit)==defmail) |
55 | continue; | 56 | continue; |
56 | fromBox->insertItem((*sit)); | 57 | fromBox->insertItem((*sit)); |
57 | } | 58 | } |
58 | senderNameEdit->setText(con.formattedName()); | 59 | senderNameEdit->setText(con.formattedName()); |
59 | Config cfg( "mail" ); | 60 | Config cfg( "mail" ); |
60 | cfg.setGroup( "Compose" ); | 61 | cfg.setGroup( "Compose" ); |
61 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 62 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
62 | 63 | ||
63 | attList->addColumn( tr( "Name" ) ); | 64 | attList->addColumn( tr( "Name" ) ); |
64 | attList->addColumn( tr( "Size" ) ); | 65 | attList->addColumn( tr( "Size" ) ); |
65 | 66 | ||
66 | QList<Account> accounts = settings->getAccounts(); | 67 | QList<Account> accounts = settings->getAccounts(); |
67 | 68 | ||
68 | Account *it; | 69 | Account *it; |
69 | for ( it = accounts.first(); it; it = accounts.next() ) { | 70 | for ( it = accounts.first(); it; it = accounts.next() ) { |
70 | if ( it->getType()==MAILLIB::A_SMTP ) { | 71 | if ( it->getType()==MAILLIB::A_SMTP ) { |
71 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 72 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
72 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 73 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
73 | smtpAccounts.append( smtp ); | 74 | smtpAccounts.append( smtp ); |
74 | } | 75 | } |
75 | } | 76 | } |
76 | if ( smtpAccounts.count() > 0 ) { | 77 | if ( smtpAccounts.count() > 0 ) { |
77 | fillValues( smtpAccountBox->currentItem() ); | 78 | fillValues( smtpAccountBox->currentItem() ); |
78 | } else { | 79 | } else { |
79 | QMessageBox::information( 0, tr( "Problem" ), | 80 | QMessageBox::information( 0, tr( "Problem" ), |
80 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), | 81 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), |
81 | tr( "Ok" ) ); | 82 | tr( "Ok" ) ); |
82 | return; | 83 | return; |
83 | } | 84 | } |
84 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 85 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
85 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 86 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
86 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 87 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
87 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 88 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
88 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 89 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
89 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 90 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
90 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 91 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
91 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 92 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
92 | mMail = 0; | 93 | mMail = 0; |
93 | warnAttach = true; | 94 | warnAttach = true; |
94 | 95 | ||
95 | } | 96 | } |
96 | void ComposeMail::saveAsDraft() | 97 | void ComposeMail::saveAsDraft() |
97 | { | 98 | { |
98 | 99 | ||
99 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 100 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
100 | mail->setMail(fromBox->currentText()); | 101 | mail->setMail(fromBox->currentText()); |
101 | mail->setTo( toLine->text() ); | 102 | mail->setTo( toLine->text() ); |
102 | mail->setName(senderNameEdit->text()); | 103 | mail->setName(senderNameEdit->text()); |
103 | mail->setCC( ccLine->text() ); | 104 | mail->setCC( ccLine->text() ); |
104 | mail->setBCC( bccLine->text() ); | 105 | mail->setBCC( bccLine->text() ); |
105 | mail->setReply( replyLine->text() ); | 106 | mail->setReply( replyLine->text() ); |
106 | mail->setSubject( subjectLine->text() ); | 107 | mail->setSubject( subjectLine->text() ); |
107 | if (!m_replyid.isEmpty()) { | 108 | if (!m_replyid.isEmpty()) { |
108 | QStringList ids; | 109 | QStringList ids; |
109 | ids.append(m_replyid); | 110 | ids.append(m_replyid); |
110 | mail->setInreply(ids); | 111 | mail->setInreply(ids); |
111 | } | 112 | } |
112 | QString txt = message->text(); | 113 | QString txt = message->text(); |
113 | if ( !sigMultiLine->text().isEmpty() ) { | 114 | if ( !sigMultiLine->text().isEmpty() ) { |
114 | txt.append( "\n--\n" ); | 115 | txt.append( "\n--\n" ); |
115 | txt.append( sigMultiLine->text() ); | 116 | txt.append( sigMultiLine->text() ); |
116 | } | 117 | } |
117 | mail->setMessage( txt ); | 118 | mail->setMessage( txt ); |
118 | 119 | ||
119 | /* only use the default drafts folder name! */ | 120 | /* only use the default drafts folder name! */ |
120 | Storemail wrapper(AbstractMail::draftFolder()); | 121 | Storemail wrapper(AbstractMail::draftFolder()); |
121 | wrapper.storeMail(mail); | 122 | wrapper.storeMail(mail); |
122 | 123 | ||
123 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 124 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
124 | /* attachments we will ignore! */ | 125 | /* attachments we will ignore! */ |
125 | if ( it != 0 ) { | 126 | if ( it != 0 ) { |
126 | if ( warnAttach ) | 127 | if ( warnAttach ) |
127 | QMessageBox::warning(0,tr("Store message"), | 128 | QMessageBox::warning(0,tr("Store message"), |
128 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 129 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
129 | warnAttach = false; | 130 | warnAttach = false; |
130 | } | 131 | } |
131 | setStatus( tr("Mail saved as draft!") ); | 132 | setStatus( tr("Mail saved as draft!") ); |
132 | } | 133 | } |
133 | void ComposeMail::clearStatus() | 134 | void ComposeMail::clearStatus() |
134 | { | 135 | { |
135 | topLevelWidget()->setCaption( tr("Compose mail") ); | 136 | topLevelWidget()->setCaption( tr("Compose mail") ); |
136 | } | 137 | } |
137 | void ComposeMail::setStatus( QString status ) | 138 | void ComposeMail::setStatus( QString status ) |
138 | { | 139 | { |
139 | topLevelWidget()->setCaption( status ); | 140 | topLevelWidget()->setCaption( status ); |
140 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; | 141 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; |
141 | } | 142 | } |
142 | void ComposeMail::pickAddress( QLineEdit *line ) | 143 | void ComposeMail::pickAddress( QLineEdit *line ) |
143 | { | 144 | { |
144 | //qDebug(" ComposeMail::pickAddress "); | 145 | //qDebug(" ComposeMail::pickAddress "); |
145 | QString names ;//= AddressPicker::getNames(); | 146 | QString names ;//= AddressPicker::getNames(); |
146 | 147 | ||
147 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 148 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
148 | uint i=0; | 149 | uint i=0; |
149 | for (i=0; i < list.count(); i++) { | 150 | for (i=0; i < list.count(); i++) { |
150 | if ( !list[i].preferredEmail().isEmpty()) { | 151 | if ( !list[i].preferredEmail().isEmpty()) { |
151 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | 152 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; |
152 | if ( i < list.count() -1 ) | 153 | if ( i < list.count() -1 ) |
153 | names+= ","; | 154 | names+= ","; |
154 | } | 155 | } |
155 | } | 156 | } |
156 | 157 | ||
157 | 158 | ||
158 | if ( line->text().isEmpty() ) { | 159 | if ( line->text().isEmpty() ) { |
159 | line->setText( names ); | 160 | line->setText( names ); |
160 | } else if ( !names.isEmpty() ) { | 161 | } else if ( !names.isEmpty() ) { |
161 | line->setText( line->text() + ", " + names ); | 162 | line->setText( line->text() + ", " + names ); |
162 | } | 163 | } |
163 | } | 164 | } |
164 | 165 | ||
165 | 166 | ||
166 | void ComposeMail::setTo( const QString & to ) | 167 | void ComposeMail::setTo( const QString & to ) |
167 | { | 168 | { |
168 | toLine->setText( to ); | 169 | toLine->setText( to ); |
169 | } | 170 | } |
170 | 171 | ||
171 | void ComposeMail::setSubject( const QString & subject ) | 172 | void ComposeMail::setSubject( const QString & subject ) |
172 | { | 173 | { |
173 | subjectLine->setText( subject ); | 174 | subjectLine->setText( subject ); |
174 | } | 175 | } |
175 | 176 | ||
176 | void ComposeMail::setInReplyTo( const QString & messageId ) | 177 | void ComposeMail::setInReplyTo( const QString & messageId ) |
177 | { | 178 | { |
178 | m_replyid = messageId; | 179 | m_replyid = messageId; |
179 | } | 180 | } |
180 | 181 | ||
181 | void ComposeMail::setMessage( const QString & text ) | 182 | void ComposeMail::setMessage( const QString & text ) |
182 | { | 183 | { |
183 | message->setText( text ); | 184 | message->setText( text ); |
184 | } | 185 | } |
185 | 186 | ||
186 | 187 | ||
187 | void ComposeMail::pickAddressTo() | 188 | void ComposeMail::pickAddressTo() |
188 | { | 189 | { |
189 | pickAddress( toLine ); | 190 | pickAddress( toLine ); |
190 | } | 191 | } |
191 | 192 | ||
192 | void ComposeMail::pickAddressCC() | 193 | void ComposeMail::pickAddressCC() |
193 | { | 194 | { |
194 | pickAddress( ccLine ); | 195 | pickAddress( ccLine ); |
195 | } | 196 | } |
196 | 197 | ||
197 | void ComposeMail::pickAddressBCC() | 198 | void ComposeMail::pickAddressBCC() |
198 | { | 199 | { |
199 | pickAddress( bccLine ); | 200 | pickAddress( bccLine ); |
200 | } | 201 | } |
201 | 202 | ||
202 | void ComposeMail::pickAddressReply() | 203 | void ComposeMail::pickAddressReply() |
203 | { | 204 | { |
204 | pickAddress( replyLine ); | 205 | pickAddress( replyLine ); |
205 | } | 206 | } |
206 | 207 | ||
207 | void ComposeMail::fillValues( int ) | 208 | void ComposeMail::fillValues( int ) |
208 | { | 209 | { |
209 | #if 0 | 210 | #if 0 |
210 | SMTPaccount *smtp = smtpAccounts.at( current ); | 211 | SMTPaccount *smtp = smtpAccounts.at( current ); |
211 | ccLine->clear(); | 212 | ccLine->clear(); |
212 | if ( smtp->getUseCC() ) { | 213 | if ( smtp->getUseCC() ) { |
213 | ccLine->setText( smtp->getCC() ); | 214 | ccLine->setText( smtp->getCC() ); |
214 | } | 215 | } |
215 | bccLine->clear(); | 216 | bccLine->clear(); |
216 | if ( smtp->getUseBCC() ) { | 217 | if ( smtp->getUseBCC() ) { |
217 | bccLine->setText( smtp->getBCC() ); | 218 | bccLine->setText( smtp->getBCC() ); |
218 | } | 219 | } |
219 | replyLine->clear(); | 220 | replyLine->clear(); |
220 | if ( smtp->getUseReply() ) { | 221 | if ( smtp->getUseReply() ) { |
221 | replyLine->setText( smtp->getReply() ); | 222 | replyLine->setText( smtp->getReply() ); |
222 | } | 223 | } |
223 | sigMultiLine->setText( smtp->getSignature() ); | 224 | sigMultiLine->setText( smtp->getSignature() ); |
224 | #endif | 225 | #endif |
225 | } | 226 | } |
226 | 227 | ||
227 | void ComposeMail::slotAdjustColumns() | 228 | void ComposeMail::slotAdjustColumns() |
228 | { | 229 | { |
229 | int currPage = tabWidget->currentPageIndex(); | 230 | int currPage = tabWidget->currentPageIndex(); |
230 | 231 | ||
231 | tabWidget->showPage( attachTab ); | 232 | tabWidget->showPage( attachTab ); |
232 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 233 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
233 | attList->setColumnWidth( 1, 80 ); | 234 | attList->setColumnWidth( 1, 80 ); |
234 | 235 | ||
235 | tabWidget->setCurrentPage( currPage ); | 236 | tabWidget->setCurrentPage( currPage ); |
236 | } | 237 | } |
237 | 238 | ||
238 | void ComposeMail::addAttachment() | 239 | void ComposeMail::addAttachment() |
239 | { | 240 | { |
240 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); | 241 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); |
241 | if ( !lnk.isEmpty() ) { | 242 | if ( !lnk.isEmpty() ) { |
242 | Attachment *att = new Attachment( lnk ); | 243 | Attachment *att = new Attachment( lnk ); |
243 | (void) new AttachViewItem( attList, att ); | 244 | (void) new AttachViewItem( attList, att ); |
244 | } | 245 | } |
245 | } | 246 | } |
246 | 247 | ||
247 | void ComposeMail::removeAttachment() | 248 | void ComposeMail::removeAttachment() |
248 | { | 249 | { |
249 | if ( !attList->currentItem() ) { | 250 | if ( !attList->currentItem() ) { |
250 | QMessageBox::information( this, tr( "Error" ), | 251 | QMessageBox::information( this, tr( "Error" ), |
251 | tr( "<p>Please select a File.</p>" ), | 252 | tr( "<p>Please select a File.</p>" ), |
252 | tr( "Ok" ) ); | 253 | tr( "Ok" ) ); |
253 | } else { | 254 | } else { |
254 | attList->takeItem( attList->currentItem() ); | 255 | attList->takeItem( attList->currentItem() ); |
255 | } | 256 | } |
256 | } | 257 | } |
257 | 258 | ||
258 | void ComposeMail::accept() | 259 | void ComposeMail::accept() |
259 | { | 260 | { |
260 | if ( smtpAccountBox->count() == 0 ) { | 261 | if ( smtpAccountBox->count() == 0 ) { |
261 | 262 | ||
262 | reject(); | 263 | reject(); |
263 | return; | 264 | return; |
264 | } | 265 | } |
265 | 266 | ||
266 | if (! checkBoxLater->isChecked() ) { | 267 | if (! checkBoxLater->isChecked() ) { |
267 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), | 268 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), |
268 | tr("Send this message?"), | 269 | tr("Send this message?"), |
269 | tr("Yes"), | 270 | tr("Yes"), |
270 | tr("Cancel")); | 271 | tr("Cancel")); |
271 | 272 | ||
272 | if (yesno == 1) { | 273 | if (yesno == 1) { |
273 | return; | 274 | return; |
274 | } | 275 | } |
275 | } | 276 | } |
276 | #if 0 | 277 | #if 0 |
277 | odebug << "Sending Mail with " | 278 | odebug << "Sending Mail with " |
278 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; | 279 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
279 | #endif | 280 | #endif |
280 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 281 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
281 | 282 | ||
282 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 283 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
283 | mail->setMail(fromBox->currentText()); | 284 | mail->setMail(fromBox->currentText()); |
284 | 285 | ||
285 | if ( !toLine->text().isEmpty() ) { | 286 | if ( !toLine->text().isEmpty() ) { |
286 | mail->setTo( toLine->text() ); | 287 | mail->setTo( toLine->text() ); |
287 | } else { | 288 | } else { |
288 | QMessageBox::warning(0,tr("Sending mail"), | 289 | QMessageBox::warning(0,tr("Sending mail"), |
289 | tr("No Receiver spezified" ) ); | 290 | tr("No Receiver spezified" ) ); |
290 | return; | 291 | return; |
291 | } | 292 | } |
292 | 293 | ||
293 | mail->setName(senderNameEdit->text()); | 294 | mail->setName(senderNameEdit->text()); |
294 | mail->setCC( ccLine->text() ); | 295 | mail->setCC( ccLine->text() ); |
295 | mail->setBCC( bccLine->text() ); | 296 | mail->setBCC( bccLine->text() ); |
296 | mail->setReply( replyLine->text() ); | 297 | mail->setReply( replyLine->text() ); |
297 | mail->setSubject( subjectLine->text() ); | 298 | mail->setSubject( subjectLine->text() ); |
298 | if (!m_replyid.isEmpty()) { | 299 | if (!m_replyid.isEmpty()) { |
299 | QStringList ids; | 300 | QStringList ids; |
300 | ids.append(m_replyid); | 301 | ids.append(m_replyid); |
301 | mail->setInreply(ids); | 302 | mail->setInreply(ids); |
302 | } | 303 | } |
303 | QString txt = message->text(); | 304 | QString txt = message->text(); |
304 | if ( !sigMultiLine->text().isEmpty() ) { | 305 | if ( !sigMultiLine->text().isEmpty() ) { |
305 | txt.append( "\n--\n" ); | 306 | txt.append( "\n--\n" ); |
306 | txt.append( sigMultiLine->text() ); | 307 | txt.append( sigMultiLine->text() ); |
307 | } | 308 | } |
308 | mail->setMessage( txt ); | 309 | mail->setMessage( txt ); |
309 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 310 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
310 | while ( it != 0 ) { | 311 | while ( it != 0 ) { |
311 | mail->addAttachment( it->getAttachment() ); | 312 | mail->addAttachment( it->getAttachment() ); |
312 | it = (AttachViewItem *) it->nextSibling(); | 313 | it = (AttachViewItem *) it->nextSibling(); |
313 | } | 314 | } |
314 | 315 | ||
315 | SMTPwrapper wrapper( smtp ); | 316 | SMTPwrapper wrapper( smtp ); |
316 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) | 317 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) |
317 | setStatus( tr ("Mail sent")); | 318 | setStatus( tr ("Mail sent")); |
318 | else { | 319 | else { |
319 | setStatus( tr ("Error: Something went wrong. Nothing sent")); | 320 | setStatus( tr ("Error: Something went wrong. Nothing sent")); |
320 | return; | 321 | return; |
321 | } | 322 | } |
322 | 323 | ||
323 | 324 | ||
324 | QDialog::accept(); | 325 | QDialog::accept(); |
325 | } | 326 | } |
326 | 327 | ||
327 | void ComposeMail::reject() | 328 | void ComposeMail::reject() |
328 | { | 329 | { |
329 | //qDebug("ComposeMail::reject() "); | 330 | //qDebug("ComposeMail::reject() "); |
330 | int yesno = QMessageBox::warning(0,tr("Store message?"), | 331 | int yesno = QMessageBox::warning(0,tr("Store message?"), |
331 | tr("Store message into drafts?\n"), | 332 | tr("Store message into drafts?\n"), |
332 | tr("Yes"), | 333 | tr("Yes"), |
333 | tr("No")); | 334 | tr("No")); |
334 | 335 | ||
335 | //qDebug("button %d ", yesno); | 336 | //qDebug("button %d ", yesno); |
336 | if (yesno == 0) { | 337 | if (yesno == 0) { |
337 | if ( toLine->text().isEmpty() ) { | 338 | if ( toLine->text().isEmpty() ) { |
338 | QMessageBox::warning(0,tr("Sending mail"), | 339 | QMessageBox::warning(0,tr("Sending mail"), |
339 | tr("No Receiver spezified" ) ); | 340 | tr("No Receiver spezified" ) ); |
340 | return; | 341 | return; |
341 | } | 342 | } |
342 | saveAsDraft(); | 343 | saveAsDraft(); |
343 | } | 344 | } |
344 | if (yesno == 2) { | 345 | if (yesno == 2) { |
345 | qDebug("return "); | 346 | qDebug("return "); |
346 | return; | 347 | return; |
347 | } | 348 | } |
348 | QDialog::reject(); | 349 | QDialog::reject(); |
349 | } | 350 | } |
350 | 351 | ||
351 | ComposeMail::~ComposeMail() | 352 | ComposeMail::~ComposeMail() |
352 | { | 353 | { |
353 | } | 354 | } |
354 | 355 | ||
355 | void ComposeMail::reEditMail(const RecMailP¤t) | 356 | void ComposeMail::reEditMail(const RecMailP¤t) |
356 | { | 357 | { |
357 | RecMailP data = current; | 358 | RecMailP data = current; |
358 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); | 359 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
359 | subjectLine->setText( data->getSubject()); | 360 | subjectLine->setText( data->getSubject()); |
360 | toLine->setText(data->To().join(",")); | 361 | toLine->setText(data->To().join(",")); |
361 | ccLine->setText(data->CC().join(",")); | 362 | ccLine->setText(data->CC().join(",")); |
362 | bccLine->setText(data->Bcc().join(",")); | 363 | bccLine->setText(data->Bcc().join(",")); |
363 | replyLine->setText(data->Replyto()); | 364 | replyLine->setText(data->Replyto()); |
364 | } | 365 | } |
365 | 366 | ||
366 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 367 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
367 | : QListViewItem( parent ) | 368 | : QListViewItem( parent ) |
368 | { | 369 | { |
369 | attachment = att; | 370 | attachment = att; |
370 | if ( !attachment->getPixmap().isNull() ) | 371 | if ( !attachment->getPixmap().isNull() ) |
371 | setPixmap( 0,attachment->getPixmap() ); | 372 | setPixmap( 0,attachment->getPixmap() ); |
372 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 373 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
373 | setText( 1, QString::number( att->getSize() ) ); | 374 | setText( 1, QString::number( att->getSize() ) ); |
374 | } | 375 | } |
375 | 376 | ||