summaryrefslogtreecommitdiffabout
Unidiff
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
@@ -1,363 +1,375 @@
1 1
2#include "composemail.h" 2#include "composemail.h"
3 3
4#include <libmailwrapper/smtpwrapper.h> 4#include <libmailwrapper/smtpwrapper.h>
5#include <libmailwrapper/storemail.h> 5#include <libmailwrapper/storemail.h>
6#include <libmailwrapper/abstractmail.h> 6#include <libmailwrapper/abstractmail.h>
7#include <libmailwrapper/mailtypes.h> 7#include <libmailwrapper/mailtypes.h>
8 8
9/* OPIE */ 9/* OPIE */
10//#include <opie2/ofiledialog.h> 10//#include <opie2/ofiledialog.h>
11//#include <opie2/odebug.h> 11//#include <opie2/odebug.h>
12#include <kfiledialog.h> 12#include <kfiledialog.h>
13//#include <qpe/resource.h> 13//#include <qpe/resource.h>
14#include <qpe/config.h> 14#include <qpe/config.h>
15#include <qpe/global.h> 15#include <qpe/global.h>
16//#include <qpe/contact.h> 16//#include <qpe/contact.h>
17 17
18 18
19#include <qcombobox.h> 19#include <qcombobox.h>
20#include <qcheckbox.h> 20#include <qcheckbox.h>
21#include <qtimer.h> 21#include <qtimer.h>
22#include <qmessagebox.h> 22#include <qmessagebox.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qmultilineedit.h> 24#include <qmultilineedit.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qtabwidget.h> 26#include <qtabwidget.h>
27#include <qlistview.h> 27#include <qlistview.h>
28#include <kabc/addresseedialog.h> 28#include <kabc/addresseedialog.h>
29#include <kabc/stdaddressbook.h> 29#include <kabc/stdaddressbook.h>
30#include <kabc/addressee.h> 30#include <kabc/addressee.h>
31 31
32 32
33 33
34//using namespace Opie::Core; 34//using namespace Opie::Core;
35//using namespace Opie::Ui; 35//using namespace Opie::Ui;
36ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 36ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
37 : ComposeMailUI( parent, name, modal, flags ) 37 : ComposeMailUI( parent, name, modal, flags )
38{ 38{
39 39
40 settings = s; 40 settings = s;
41 m_replyid = ""; 41 m_replyid = "";
42 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 42 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
43 QStringList mails = con.emails(); 43 QStringList mails = con.emails();
44 QString defmail = con.preferredEmail(); 44 QString defmail = con.preferredEmail();
45 if ( mails.count() == 0) 45 if ( mails.count() == 0)
46 QMessageBox::information( 0, tr( "Hint" ), 46 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" ), 47 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
48 tr( "Ok" ) ); 48 tr( "Ok" ) );
49 if (defmail.length()!=0) { 49 if (defmail.length()!=0) {
50 fromBox->insertItem(defmail); 50 fromBox->insertItem(defmail);
51 } 51 }
52 QStringList::ConstIterator sit = mails.begin(); 52 QStringList::ConstIterator sit = mails.begin();
53 for (;sit!=mails.end();++sit) { 53 for (;sit!=mails.end();++sit) {
54 if ( (*sit)==defmail) 54 if ( (*sit)==defmail)
55 continue; 55 continue;
56 fromBox->insertItem((*sit)); 56 fromBox->insertItem((*sit));
57 } 57 }
58 senderNameEdit->setText(con.formattedName()); 58 senderNameEdit->setText(con.formattedName());
59 Config cfg( "mail" ); 59 Config cfg( "mail" );
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);
110 } 111 }
111 QString txt = message->text(); 112 QString txt = message->text();
112 if ( !sigMultiLine->text().isEmpty() ) { 113 if ( !sigMultiLine->text().isEmpty() ) {
113 txt.append( "\n--\n" ); 114 txt.append( "\n--\n" );
114 txt.append( sigMultiLine->text() ); 115 txt.append( sigMultiLine->text() );
115 } 116 }
116 mail->setMessage( txt ); 117 mail->setMessage( txt );
117 118
118 /* only use the default drafts folder name! */ 119 /* only use the default drafts folder name! */
119 Storemail wrapper(AbstractMail::draftFolder()); 120 Storemail wrapper(AbstractMail::draftFolder());
120 wrapper.storeMail(mail); 121 wrapper.storeMail(mail);
121 122
122 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 123 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
123 /* attachments we will ignore! */ 124 /* attachments we will ignore! */
124 if ( it != 0 ) { 125 if ( it != 0 ) {
125 if ( warnAttach ) 126 if ( warnAttach )
126 QMessageBox::warning(0,tr("Store message"), 127 QMessageBox::warning(0,tr("Store message"),
127 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 128 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
128 warnAttach = false; 129 warnAttach = false;
129 } 130 }
130 setStatus( tr("Mail saved as draft!") ); 131 setStatus( tr("Mail saved as draft!") );
131} 132}
132void ComposeMail::clearStatus() 133void ComposeMail::clearStatus()
133{ 134{
134 topLevelWidget()->setCaption( tr("Compose mail") ); 135 topLevelWidget()->setCaption( tr("Compose mail") );
135} 136}
136void ComposeMail::setStatus( QString status ) 137void ComposeMail::setStatus( QString status )
137{ 138{
138 topLevelWidget()->setCaption( status ); 139 topLevelWidget()->setCaption( status );
139 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; 140 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
140} 141}
141void ComposeMail::pickAddress( QLineEdit *line ) 142void ComposeMail::pickAddress( QLineEdit *line )
142{ 143{
143 //qDebug(" ComposeMail::pickAddress "); 144 //qDebug(" ComposeMail::pickAddress ");
144 QString names ;//= AddressPicker::getNames(); 145 QString names ;//= AddressPicker::getNames();
145 146
146 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 147 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
147 uint i=0; 148 uint i=0;
148 for (i=0; i < list.count(); i++) { 149 for (i=0; i < list.count(); i++) {
149 if ( !list[i].preferredEmail().isEmpty()) { 150 if ( !list[i].preferredEmail().isEmpty()) {
150 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 151 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
151 if ( i < list.count() -1 ) 152 if ( i < list.count() -1 )
152 names+= ","; 153 names+= ",";
153 } 154 }
154 } 155 }
155 156
156 157
157 if ( line->text().isEmpty() ) { 158 if ( line->text().isEmpty() ) {
158 line->setText( names ); 159 line->setText( names );
159 } else if ( !names.isEmpty() ) { 160 } else if ( !names.isEmpty() ) {
160 line->setText( line->text() + ", " + names ); 161 line->setText( line->text() + ", " + names );
161 } 162 }
162} 163}
163 164
164 165
165void ComposeMail::setTo( const QString & to ) 166void ComposeMail::setTo( const QString & to )
166{ 167{
167 toLine->setText( to ); 168 toLine->setText( to );
168} 169}
169 170
170void ComposeMail::setSubject( const QString & subject ) 171void ComposeMail::setSubject( const QString & subject )
171{ 172{
172 subjectLine->setText( subject ); 173 subjectLine->setText( subject );
173} 174}
174 175
175void ComposeMail::setInReplyTo( const QString & messageId ) 176void ComposeMail::setInReplyTo( const QString & messageId )
176{ 177{
177 m_replyid = messageId; 178 m_replyid = messageId;
178} 179}
179 180
180void ComposeMail::setMessage( const QString & text ) 181void ComposeMail::setMessage( const QString & text )
181{ 182{
182 message->setText( text ); 183 message->setText( text );
183} 184}
184 185
185 186
186void ComposeMail::pickAddressTo() 187void ComposeMail::pickAddressTo()
187{ 188{
188 pickAddress( toLine ); 189 pickAddress( toLine );
189} 190}
190 191
191void ComposeMail::pickAddressCC() 192void ComposeMail::pickAddressCC()
192{ 193{
193 pickAddress( ccLine ); 194 pickAddress( ccLine );
194} 195}
195 196
196void ComposeMail::pickAddressBCC() 197void ComposeMail::pickAddressBCC()
197{ 198{
198 pickAddress( bccLine ); 199 pickAddress( bccLine );
199} 200}
200 201
201void ComposeMail::pickAddressReply() 202void ComposeMail::pickAddressReply()
202{ 203{
203 pickAddress( replyLine ); 204 pickAddress( replyLine );
204} 205}
205 206
206void ComposeMail::fillValues( int ) 207void ComposeMail::fillValues( int )
207{ 208{
208#if 0 209#if 0
209 SMTPaccount *smtp = smtpAccounts.at( current ); 210 SMTPaccount *smtp = smtpAccounts.at( current );
210 ccLine->clear(); 211 ccLine->clear();
211 if ( smtp->getUseCC() ) { 212 if ( smtp->getUseCC() ) {
212 ccLine->setText( smtp->getCC() ); 213 ccLine->setText( smtp->getCC() );
213 } 214 }
214 bccLine->clear(); 215 bccLine->clear();
215 if ( smtp->getUseBCC() ) { 216 if ( smtp->getUseBCC() ) {
216 bccLine->setText( smtp->getBCC() ); 217 bccLine->setText( smtp->getBCC() );
217 } 218 }
218 replyLine->clear(); 219 replyLine->clear();
219 if ( smtp->getUseReply() ) { 220 if ( smtp->getUseReply() ) {
220 replyLine->setText( smtp->getReply() ); 221 replyLine->setText( smtp->getReply() );
221 } 222 }
222 sigMultiLine->setText( smtp->getSignature() ); 223 sigMultiLine->setText( smtp->getSignature() );
223#endif 224#endif
224} 225}
225 226
226void ComposeMail::slotAdjustColumns() 227void ComposeMail::slotAdjustColumns()
227{ 228{
228 int currPage = tabWidget->currentPageIndex(); 229 int currPage = tabWidget->currentPageIndex();
229 230
230 tabWidget->showPage( attachTab ); 231 tabWidget->showPage( attachTab );
231 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 232 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
232 attList->setColumnWidth( 1, 80 ); 233 attList->setColumnWidth( 1, 80 );
233 234
234 tabWidget->setCurrentPage( currPage ); 235 tabWidget->setCurrentPage( currPage );
235} 236}
236 237
237void ComposeMail::addAttachment() 238void ComposeMail::addAttachment()
238{ 239{
239 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); 240 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this );
240 if ( !lnk.isEmpty() ) { 241 if ( !lnk.isEmpty() ) {
241 Attachment *att = new Attachment( lnk ); 242 Attachment *att = new Attachment( lnk );
242 (void) new AttachViewItem( attList, att ); 243 (void) new AttachViewItem( attList, att );
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
275 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 282 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
276 mail->setMail(fromBox->currentText()); 283 mail->setMail(fromBox->currentText());
277 284
278 if ( !toLine->text().isEmpty() ) { 285 if ( !toLine->text().isEmpty() ) {
279 mail->setTo( toLine->text() ); 286 mail->setTo( toLine->text() );
280 } else { 287 } else {
281 QMessageBox::warning(0,tr("Sending mail"), 288 QMessageBox::warning(0,tr("Sending mail"),
282 tr("No Receiver spezified" ) ); 289 tr("No Receiver spezified" ) );
283 return; 290 return;
284 } 291 }
285 292
286 mail->setName(senderNameEdit->text()); 293 mail->setName(senderNameEdit->text());
287 mail->setCC( ccLine->text() ); 294 mail->setCC( ccLine->text() );
288 mail->setBCC( bccLine->text() ); 295 mail->setBCC( bccLine->text() );
289 mail->setReply( replyLine->text() ); 296 mail->setReply( replyLine->text() );
290 mail->setSubject( subjectLine->text() ); 297 mail->setSubject( subjectLine->text() );
291 if (!m_replyid.isEmpty()) { 298 if (!m_replyid.isEmpty()) {
292 QStringList ids; 299 QStringList ids;
293 ids.append(m_replyid); 300 ids.append(m_replyid);
294 mail->setInreply(ids); 301 mail->setInreply(ids);
295 } 302 }
296 QString txt = message->text(); 303 QString txt = message->text();
297 if ( !sigMultiLine->text().isEmpty() ) { 304 if ( !sigMultiLine->text().isEmpty() ) {
298 txt.append( "\n--\n" ); 305 txt.append( "\n--\n" );
299 txt.append( sigMultiLine->text() ); 306 txt.append( sigMultiLine->text() );
300 } 307 }
301 mail->setMessage( txt ); 308 mail->setMessage( txt );
302 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 309 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
303 while ( it != 0 ) { 310 while ( it != 0 ) {
304 mail->addAttachment( it->getAttachment() ); 311 mail->addAttachment( it->getAttachment() );
305 it = (AttachViewItem *) it->nextSibling(); 312 it = (AttachViewItem *) it->nextSibling();
306 } 313 }
307 314
308 SMTPwrapper wrapper( smtp ); 315 SMTPwrapper wrapper( smtp );
309 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) 316 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
310 setStatus( tr ("Mail sent")); 317 setStatus( tr ("Mail sent"));
311 else { 318 else {
312 setStatus( tr ("Error: Something went wrong. Nothing sent")); 319 setStatus( tr ("Error: Something went wrong. Nothing sent"));
313 return; 320 return;
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;
346 message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); 358 message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
347 subjectLine->setText( data->getSubject()); 359 subjectLine->setText( data->getSubject());
348 toLine->setText(data->To().join(",")); 360 toLine->setText(data->To().join(","));
349 ccLine->setText(data->CC().join(",")); 361 ccLine->setText(data->CC().join(","));
350 bccLine->setText(data->Bcc().join(",")); 362 bccLine->setText(data->Bcc().join(","));
351 replyLine->setText(data->Replyto()); 363 replyLine->setText(data->Replyto());
352} 364}
353 365
354AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 366AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
355 : QListViewItem( parent ) 367 : QListViewItem( parent )
356{ 368{
357 attachment = att; 369 attachment = att;
358 if ( !attachment->getPixmap().isNull() ) 370 if ( !attachment->getPixmap().isNull() )
359 setPixmap( 0,attachment->getPixmap() ); 371 setPixmap( 0,attachment->getPixmap() );
360 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 372 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
361 setText( 1, QString::number( att->getSize() ) ); 373 setText( 1, QString::number( att->getSize() ) );
362} 374}
363 375