author | alwin <alwin> | 2004-03-12 19:24:38 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-12 19:24:38 (UTC) |
commit | b600871ce93553a116a66fd80acd6dfc1cc46829 (patch) (unidiff) | |
tree | b361346a49e09d9f0220993583bf183cf29bd974 /noncore/net/mail/composemail.cpp | |
parent | 874d5a34eca296263dcd1adf857aebe9981825a1 (diff) | |
download | opie-b600871ce93553a116a66fd80acd6dfc1cc46829.zip opie-b600871ce93553a116a66fd80acd6dfc1cc46829.tar.gz opie-b600871ce93553a116a66fd80acd6dfc1cc46829.tar.bz2 |
some more smart-pointers
some bugfixes
some renaming of internals
Diffstat (limited to 'noncore/net/mail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/composemail.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 445cc5e..74ccc7b 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -167,134 +167,134 @@ void ComposeMail::addAttachment() | |||
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | void ComposeMail::removeAttachment() | 170 | void ComposeMail::removeAttachment() |
171 | { | 171 | { |
172 | if ( !attList->currentItem() ) { | 172 | if ( !attList->currentItem() ) { |
173 | QMessageBox::information( this, tr( "Error" ), | 173 | QMessageBox::information( this, tr( "Error" ), |
174 | tr( "<p>Please select a File.</p>" ), | 174 | tr( "<p>Please select a File.</p>" ), |
175 | tr( "Ok" ) ); | 175 | tr( "Ok" ) ); |
176 | } else { | 176 | } else { |
177 | attList->takeItem( attList->currentItem() ); | 177 | attList->takeItem( attList->currentItem() ); |
178 | } | 178 | } |
179 | } | 179 | } |
180 | 180 | ||
181 | void ComposeMail::accept() | 181 | void ComposeMail::accept() |
182 | { | 182 | { |
183 | if ( checkBoxLater->isChecked() ) { | 183 | if ( checkBoxLater->isChecked() ) { |
184 | qDebug( "Send later" ); | 184 | qDebug( "Send later" ); |
185 | } | 185 | } |
186 | 186 | ||
187 | #if 0 | 187 | #if 0 |
188 | qDebug( "Sending Mail with " + | 188 | qDebug( "Sending Mail with " + |
189 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); | 189 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); |
190 | #endif | 190 | #endif |
191 | Opie::osmart_pointer<Mail> mail=new Mail; | 191 | Opie::OSmartPointer<Mail> mail=new Mail; |
192 | 192 | ||
193 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 193 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
194 | mail->setMail(fromBox->currentText()); | 194 | mail->setMail(fromBox->currentText()); |
195 | 195 | ||
196 | if ( !toLine->text().isEmpty() ) { | 196 | if ( !toLine->text().isEmpty() ) { |
197 | mail->setTo( toLine->text() ); | 197 | mail->setTo( toLine->text() ); |
198 | } else { | 198 | } else { |
199 | QMessageBox::warning(0,tr("Sending mail"), | 199 | QMessageBox::warning(0,tr("Sending mail"), |
200 | tr("No Receiver spezified" ) ); | 200 | tr("No Receiver spezified" ) ); |
201 | return; | 201 | return; |
202 | } | 202 | } |
203 | mail->setName(senderNameEdit->text()); | 203 | mail->setName(senderNameEdit->text()); |
204 | mail->setCC( ccLine->text() ); | 204 | mail->setCC( ccLine->text() ); |
205 | mail->setBCC( bccLine->text() ); | 205 | mail->setBCC( bccLine->text() ); |
206 | mail->setReply( replyLine->text() ); | 206 | mail->setReply( replyLine->text() ); |
207 | mail->setSubject( subjectLine->text() ); | 207 | mail->setSubject( subjectLine->text() ); |
208 | if (!m_replyid.isEmpty()) { | 208 | if (!m_replyid.isEmpty()) { |
209 | QStringList ids; | 209 | QStringList ids; |
210 | ids.append(m_replyid); | 210 | ids.append(m_replyid); |
211 | mail->setInreply(ids); | 211 | mail->setInreply(ids); |
212 | } | 212 | } |
213 | QString txt = message->text(); | 213 | QString txt = message->text(); |
214 | if ( !sigMultiLine->text().isEmpty() ) { | 214 | if ( !sigMultiLine->text().isEmpty() ) { |
215 | txt.append( "\n--\n" ); | 215 | txt.append( "\n--\n" ); |
216 | txt.append( sigMultiLine->text() ); | 216 | txt.append( sigMultiLine->text() ); |
217 | } | 217 | } |
218 | mail->setMessage( txt ); | 218 | mail->setMessage( txt ); |
219 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 219 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
220 | while ( it != NULL ) { | 220 | while ( it != NULL ) { |
221 | mail->addAttachment( it->getAttachment() ); | 221 | mail->addAttachment( it->getAttachment() ); |
222 | it = (AttachViewItem *) it->nextSibling(); | 222 | it = (AttachViewItem *) it->nextSibling(); |
223 | } | 223 | } |
224 | 224 | ||
225 | SMTPwrapper wrapper( smtp ); | 225 | SMTPwrapper wrapper( smtp ); |
226 | wrapper.sendMail( mail,checkBoxLater->isChecked() ); | 226 | wrapper.sendMail( mail,checkBoxLater->isChecked() ); |
227 | 227 | ||
228 | QDialog::accept(); | 228 | QDialog::accept(); |
229 | } | 229 | } |
230 | 230 | ||
231 | void ComposeMail::reject() | 231 | void ComposeMail::reject() |
232 | { | 232 | { |
233 | int yesno = QMessageBox::warning(0,tr("Store message"), | 233 | int yesno = QMessageBox::warning(0,tr("Store message"), |
234 | tr("Store message into drafts?"), | 234 | tr("Store message into drafts?"), |
235 | tr("Yes"), | 235 | tr("Yes"), |
236 | tr("No"),QString::null,0,1); | 236 | tr("No"),QString::null,0,1); |
237 | 237 | ||
238 | if (yesno == 0) { | 238 | if (yesno == 0) { |
239 | Opie::osmart_pointer<Mail> mail=new Mail(); | 239 | Opie::OSmartPointer<Mail> mail=new Mail(); |
240 | mail->setMail(fromBox->currentText()); | 240 | mail->setMail(fromBox->currentText()); |
241 | mail->setTo( toLine->text() ); | 241 | mail->setTo( toLine->text() ); |
242 | mail->setName(senderNameEdit->text()); | 242 | mail->setName(senderNameEdit->text()); |
243 | mail->setCC( ccLine->text() ); | 243 | mail->setCC( ccLine->text() ); |
244 | mail->setBCC( bccLine->text() ); | 244 | mail->setBCC( bccLine->text() ); |
245 | mail->setReply( replyLine->text() ); | 245 | mail->setReply( replyLine->text() ); |
246 | mail->setSubject( subjectLine->text() ); | 246 | mail->setSubject( subjectLine->text() ); |
247 | if (!m_replyid.isEmpty()) { | 247 | if (!m_replyid.isEmpty()) { |
248 | QStringList ids; | 248 | QStringList ids; |
249 | ids.append(m_replyid); | 249 | ids.append(m_replyid); |
250 | mail->setInreply(ids); | 250 | mail->setInreply(ids); |
251 | } | 251 | } |
252 | QString txt = message->text(); | 252 | QString txt = message->text(); |
253 | if ( !sigMultiLine->text().isEmpty() ) { | 253 | if ( !sigMultiLine->text().isEmpty() ) { |
254 | txt.append( "\n--\n" ); | 254 | txt.append( "\n--\n" ); |
255 | txt.append( sigMultiLine->text() ); | 255 | txt.append( sigMultiLine->text() ); |
256 | } | 256 | } |
257 | qDebug(txt); | 257 | qDebug(txt); |
258 | mail->setMessage( txt ); | 258 | mail->setMessage( txt ); |
259 | 259 | ||
260 | /* only use the default drafts folder name! */ | 260 | /* only use the default drafts folder name! */ |
261 | Storemail wrapper(AbstractMail::draftFolder()); | 261 | Storemail wrapper(AbstractMail::draftFolder()); |
262 | wrapper.storeMail(mail); | 262 | wrapper.storeMail(mail); |
263 | 263 | ||
264 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 264 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
265 | /* attachments we will ignore! */ | 265 | /* attachments we will ignore! */ |
266 | if ( it != NULL ) { | 266 | if ( it != NULL ) { |
267 | QMessageBox::warning(0,tr("Store message"), | 267 | QMessageBox::warning(0,tr("Store message"), |
268 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 268 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
269 | } | 269 | } |
270 | } | 270 | } |
271 | QDialog::reject(); | 271 | QDialog::reject(); |
272 | } | 272 | } |
273 | 273 | ||
274 | ComposeMail::~ComposeMail() | 274 | ComposeMail::~ComposeMail() |
275 | { | 275 | { |
276 | } | 276 | } |
277 | 277 | ||
278 | void ComposeMail::reEditMail(const RecMail¤t) | 278 | void ComposeMail::reEditMail(const RecMailP¤t) |
279 | { | 279 | { |
280 | RecMail data = current; | 280 | RecMailP data = current; |
281 | message->setText(data.Wrapper()->fetchBody(current).Bodytext()); | 281 | message->setText(data->Wrapper()->fetchBody(current).Bodytext()); |
282 | subjectLine->setText( data.getSubject()); | 282 | subjectLine->setText( data->getSubject()); |
283 | toLine->setText(data.To().join(",")); | 283 | toLine->setText(data->To().join(",")); |
284 | ccLine->setText(data.CC().join(",")); | 284 | ccLine->setText(data->CC().join(",")); |
285 | bccLine->setText(data.Bcc().join(",")); | 285 | bccLine->setText(data->Bcc().join(",")); |
286 | replyLine->setText(data.Replyto()); | 286 | replyLine->setText(data->Replyto()); |
287 | } | 287 | } |
288 | 288 | ||
289 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 289 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
290 | : QListViewItem( parent ) | 290 | : QListViewItem( parent ) |
291 | { | 291 | { |
292 | attachment = att; | 292 | attachment = att; |
293 | qDebug( att->getMimeType() ); | 293 | qDebug( att->getMimeType() ); |
294 | setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? | 294 | setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? |
295 | Resource::loadPixmap( "UnknownDocument-14" ) : | 295 | Resource::loadPixmap( "UnknownDocument-14" ) : |
296 | attachment->getDocLnk().pixmap() ); | 296 | attachment->getDocLnk().pixmap() ); |
297 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 297 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
298 | setText( 1, QString::number( att->getSize() ) ); | 298 | setText( 1, QString::number( att->getSize() ) ); |
299 | } | 299 | } |
300 | 300 | ||