author | alwin <alwin> | 2004-01-03 02:15:10 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-03 02:15:10 (UTC) |
commit | 79bca648a80c42d5dc7e7674b251715292db33b3 (patch) (unidiff) | |
tree | 812b854bf4b99d259462a43e1ec10f08f5d72df2 | |
parent | 2e6d55ed011834320165462b64e03ea451c90ead (diff) | |
download | opie-79bca648a80c42d5dc7e7674b251715292db33b3.zip opie-79bca648a80c42d5dc7e7674b251715292db33b3.tar.gz opie-79bca648a80c42d5dc7e7674b251715292db33b3.tar.bz2 |
mail attachments will be displayed in order of attachment not sorted
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 5e7ffeb..d4c5150 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -127,48 +127,49 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { | |||
127 | s/=1024; | 127 | s/=1024; |
128 | ++w; | 128 | ++w; |
129 | if (w>=2) break; | 129 | if (w>=2) break; |
130 | } | 130 | } |
131 | switch(w) { | 131 | switch(w) { |
132 | case 1: | 132 | case 1: |
133 | q="k"; | 133 | q="k"; |
134 | break; | 134 | break; |
135 | case 2: | 135 | case 2: |
136 | q="M"; | 136 | q="M"; |
137 | break; | 137 | break; |
138 | default: | 138 | default: |
139 | q=""; | 139 | q=""; |
140 | break; | 140 | break; |
141 | } | 141 | } |
142 | QTextOStream o(&fsize); | 142 | QTextOStream o(&fsize); |
143 | if (w>0) o.precision(2); else o.precision(0); | 143 | if (w>0) o.precision(2); else o.precision(0); |
144 | o.setf(QTextStream::fixed); | 144 | o.setf(QTextStream::fixed); |
145 | o << s << " " << q << "Byte"; | 145 | o << s << " " << q << "Byte"; |
146 | desc = body.Parts()[i].Description(); | 146 | desc = body.Parts()[i].Description(); |
147 | parentItem = searchParent(body.Parts()[i].Positionlist()); | 147 | parentItem = searchParent(body.Parts()[i].Positionlist()); |
148 | if (parentItem) { | 148 | if (parentItem) { |
149 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); | 149 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); |
150 | attachments->setRootIsDecorated(true); | 150 | attachments->setRootIsDecorated(true); |
151 | curItem = parentItem; | ||
151 | } else { | 152 | } else { |
152 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); | 153 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); |
153 | } | 154 | } |
154 | } | 155 | } |
155 | } | 156 | } |
156 | 157 | ||
157 | 158 | ||
158 | void ViewMail::slotShowHtml( bool state ) { | 159 | void ViewMail::slotShowHtml( bool state ) { |
159 | m_showHtml = state; | 160 | m_showHtml = state; |
160 | setText(); | 161 | setText(); |
161 | } | 162 | } |
162 | 163 | ||
163 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) { | 164 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) { |
164 | if (!item ) | 165 | if (!item ) |
165 | return; | 166 | return; |
166 | 167 | ||
167 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { | 168 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { |
168 | setText(); | 169 | setText(); |
169 | return; | 170 | return; |
170 | } | 171 | } |
171 | QPopupMenu *menu = new QPopupMenu(); | 172 | QPopupMenu *menu = new QPopupMenu(); |
172 | int ret=0; | 173 | int ret=0; |
173 | 174 | ||
174 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) { | 175 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) { |
@@ -225,49 +226,49 @@ void ViewMail::setMail( RecMail mail ) { | |||
225 | m_mail2[0] = mail.To(); | 226 | m_mail2[0] = mail.To(); |
226 | m_mail2[1] = mail.CC(); | 227 | m_mail2[1] = mail.CC(); |
227 | m_mail2[2] = mail.Bcc(); | 228 | m_mail2[2] = mail.Bcc(); |
228 | 229 | ||
229 | setText(); | 230 | setText(); |
230 | } | 231 | } |
231 | 232 | ||
232 | 233 | ||
233 | 234 | ||
234 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 235 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
235 | : ViewMailBase(parent, name, fl), _inLoop(false) | 236 | : ViewMailBase(parent, name, fl), _inLoop(false) |
236 | { | 237 | { |
237 | m_gotBody = false; | 238 | m_gotBody = false; |
238 | deleted = false; | 239 | deleted = false; |
239 | 240 | ||
240 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); | 241 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); |
241 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); | 242 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); |
242 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) ); | 243 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) ); |
243 | connect( showHtml, SIGNAL( toggled( bool ) ), SLOT( slotShowHtml( bool ) ) ); | 244 | connect( showHtml, SIGNAL( toggled( bool ) ), SLOT( slotShowHtml( bool ) ) ); |
244 | 245 | ||
245 | attachments->setEnabled(m_gotBody); | 246 | attachments->setEnabled(m_gotBody); |
246 | connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); | 247 | connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); |
247 | 248 | ||
248 | readConfig(); | 249 | readConfig(); |
249 | 250 | attachments->setSorting(-1); | |
250 | } | 251 | } |
251 | 252 | ||
252 | void ViewMail::readConfig() { | 253 | void ViewMail::readConfig() { |
253 | Config cfg( "mail" ); | 254 | Config cfg( "mail" ); |
254 | cfg.setGroup( "Settings" ); | 255 | cfg.setGroup( "Settings" ); |
255 | m_showHtml = cfg.readBoolEntry( "showHtml", false ); | 256 | m_showHtml = cfg.readBoolEntry( "showHtml", false ); |
256 | showHtml->setOn( m_showHtml ); | 257 | showHtml->setOn( m_showHtml ); |
257 | } | 258 | } |
258 | 259 | ||
259 | void ViewMail::setText() | 260 | void ViewMail::setText() |
260 | { | 261 | { |
261 | 262 | ||
262 | QString toString; | 263 | QString toString; |
263 | QString ccString; | 264 | QString ccString; |
264 | QString bccString; | 265 | QString bccString; |
265 | 266 | ||
266 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { | 267 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { |
267 | toString += (*it); | 268 | toString += (*it); |
268 | } | 269 | } |
269 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { | 270 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { |
270 | ccString += (*it); | 271 | ccString += (*it); |
271 | } | 272 | } |
272 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { | 273 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { |
273 | bccString += (*it); | 274 | bccString += (*it); |