summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-24 18:27:06 (UTC)
committer zautrix <zautrix>2005-01-24 18:27:06 (UTC)
commitbb33b559609356149ae51cb50c081b3e82aecafb (patch) (unidiff)
tree4878aa5887bf1c539845ce9c4e5470eea94d41cc
parent77f93c632b66b5c8d92e4c63330362272ca1fc40 (diff)
downloadkdepimpi-bb33b559609356149ae51cb50c081b3e82aecafb.zip
kdepimpi-bb33b559609356149ae51cb50c081b3e82aecafb.tar.gz
kdepimpi-bb33b559609356149ae51cb50c081b3e82aecafb.tar.bz2
pixmap update fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/mailistviewitem.cpp5
-rw-r--r--kmicromail/opiemail.cpp4
-rw-r--r--kmicromail/viewmail.h4
-rw-r--r--kmicromail/viewmailbase.cpp12
4 files changed, 13 insertions, 12 deletions
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 137c482..5119744 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -1,95 +1,98 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#include "mailistviewitem.h" 2#include "mailistviewitem.h"
3#include <libmailwrapper/abstractmail.h> 3#include <libmailwrapper/abstractmail.h>
4#include <qtextstream.h> 4#include <qtextstream.h>
5#include <kiconloader.h> 5#include <kiconloader.h>
6#include "koprefs.h" 6#include "koprefs.h"
7//#include <qpe/resource.h> 7//#include <qpe/resource.h>
8 8
9MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 9MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
10 :QListViewItem(parent,item),mail_data() 10 :QListViewItem(parent,item),mail_data()
11{ 11{
12} 12}
13 13
14void MailListViewItem::showEntry() 14void MailListViewItem::showEntry()
15{ 15{
16 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { 16 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
17 setPixmap( 0, SmallIcon ( "kmmsgreplied") ); 17 setPixmap( 0, SmallIcon ( "kmmsgreplied") );
18 mKeyMap.insert(0, "r" );
18 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { 19 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
19 /* I think it looks nicer if there are not such a log of icons but only on mails 20 /* I think it looks nicer if there are not such a log of icons but only on mails
20 replied or new - Alwin*/ 21 replied or new - Alwin*/
21 //setPixmap( 0,SmallIcon ("kmmsgunseen") ); 22 //setPixmap( 0,SmallIcon ("kmmsgunseen") );
23 mKeyMap.insert(0, "s" );
22 } else { 24 } else {
23 setPixmap( 0,SmallIcon ( "kmmsgnew") ); 25 setPixmap( 0,SmallIcon ( "kmmsgnew") );
26 mKeyMap.insert(0, "u" );
24 } 27 }
25 QString fsize = mail_data->MsgsizeString(); 28 QString fsize = mail_data->MsgsizeString();
26 // 1.23 29 // 1.23
27 // 11.23 30 // 11.23
28 // 111.23 31 // 111.23
29 // 999.23 maxlen 32 // 999.23 maxlen
30 QString fsort; 33 QString fsort;
31 switch(fsize.length() ) { 34 switch(fsize.length() ) {
32 case 6: 35 case 6:
33 fsort = "00" + fsize ; 36 fsort = "00" + fsize ;
34 break; 37 break;
35 case 7: 38 case 7:
36 fsort = "0" + fsize ; 39 fsort = "0" + fsize ;
37 break; 40 break;
38 default: 41 default:
39 fsort = fsize ; 42 fsort = fsize ;
40 break; 43 break;
41 44
42 } 45 }
43 setText(3, fsize ); 46 setText(3, fsize );
44 //qDebug("fsize *%s* ",fsize.latin1() ); 47 //qDebug("fsize *%s* ",fsize.latin1() );
45 //qDebug("fsort *%s* ",fsort.latin1() ); 48 //qDebug("fsort *%s* ",fsort.latin1() );
46 if ( fsize.right(2) == "kB" ) { 49 if ( fsize.right(2) == "kB" ) {
47 mKeyMap.insert(3, "k" + fsort); 50 mKeyMap.insert(3, "k" + fsort);
48 } else { 51 } else {
49 mKeyMap.insert(3, "M" +fsort ); 52 mKeyMap.insert(3, "M" +fsort );
50 } 53 }
51 setText(1,mail_data->getSubject()); 54 setText(1,mail_data->getSubject());
52 setText(2,mail_data->getFrom()); 55 setText(2,mail_data->getFrom());
53 mKeyMap.insert(4,mail_data->getIsoDate()); 56 mKeyMap.insert(4,mail_data->getIsoDate());
54 setText(4,mail_data->getDate()); 57 setText(4,mail_data->getDate());
55 if ( KOPrefs::instance()->mShowToField ) 58 if ( KOPrefs::instance()->mShowToField )
56 setText(5,mail_data->To()[0]); 59 setText(5,mail_data->To()[0]);
57} 60}
58 61
59void MailListViewItem::storeData(const RecMailP&data) 62void MailListViewItem::storeData(const RecMailP&data)
60{ 63{
61 mail_data = data; 64 mail_data = data;
62} 65}
63void MailListViewItem::setSortKey(int column,const QString &key) 66void MailListViewItem::setSortKey(int column,const QString &key)
64{ 67{
65 mKeyMap.insert(column,key); 68 mKeyMap.insert(column,key);
66} 69}
67QString MailListViewItem::key(int column, bool) const 70QString MailListViewItem::key(int column, bool) const
68{ 71{
69 // to make is fast, we use here special cases 72 // to make is fast, we use here special cases
70 if ( column == 3 || column == 4 ) { 73 if ( column == 3 || column == 4 || column == 0) {
71 return *mKeyMap.find(column); 74 return *mKeyMap.find(column);
72 } 75 }
73 if ( column == 1 ) { 76 if ( column == 1 ) {
74 if ( text(1).left(4).lower() == "re: " ) 77 if ( text(1).left(4).lower() == "re: " )
75 return text(1).mid(4); 78 return text(1).mid(4);
76 79
77 } 80 }
78 return text(column); 81 return text(column);
79 /* 82 /*
80 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 83 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
81 if (it == mKeyMap.end()) return text(column); 84 if (it == mKeyMap.end()) return text(column);
82 else return *it; 85 else return *it;
83 */ 86 */
84} 87}
85 88
86const RecMailP& MailListViewItem::data()const 89const RecMailP& MailListViewItem::data()const
87{ 90{
88 return mail_data; 91 return mail_data;
89} 92}
90 93
91MAILLIB::ATYPE MailListViewItem::wrapperType() 94MAILLIB::ATYPE MailListViewItem::wrapperType()
92{ 95{
93 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; 96 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
94 return mail_data->Wrapper()->getType(); 97 return mail_data->Wrapper()->getType();
95} 98}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 760e3b0..68f0eb3 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,638 +1,640 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4 4
5#define protected public 5#define protected public
6#include <qwidget.h> 6#include <qwidget.h>
7#undef protected 7#undef protected
8#include "koprefsdialog.h" 8#include "koprefsdialog.h"
9#include <kapplication.h> 9#include <kapplication.h>
10#include <libkdepim/externalapphandler.h> 10#include <libkdepim/externalapphandler.h>
11#include <libkdepim/kpimglobalprefs.h> 11#include <libkdepim/kpimglobalprefs.h>
12#ifdef MINIKDE_KDIALOG_H 12#ifdef MINIKDE_KDIALOG_H
13#undef MINIKDE_KDIALOG_H 13#undef MINIKDE_KDIALOG_H
14#endif 14#endif
15#include "settingsdialog.h" 15#include "settingsdialog.h"
16#include "opiemail.h" 16#include "opiemail.h"
17#include "editaccounts.h" 17#include "editaccounts.h"
18#include "composemail.h" 18#include "composemail.h"
19#include "mailistviewitem.h" 19#include "mailistviewitem.h"
20#include "viewmail.h" 20#include "viewmail.h"
21#include "selectstore.h" 21#include "selectstore.h"
22#include "selectsmtp.h" 22#include "selectsmtp.h"
23#include "accountitem.h" 23#include "accountitem.h"
24#include "accountview.h" 24#include "accountview.h"
25#include "klocale.h" 25#include "klocale.h"
26 26
27#include <qmessagebox.h> 27#include <qmessagebox.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qcursor.h> 29#include <qcursor.h>
30#include <qtextbrowser.h> 30#include <qtextbrowser.h>
31#include <qregexp.h> 31#include <qregexp.h>
32#include <qpe/global.h> 32#include <qpe/global.h>
33 33
34#ifdef DESKTOP_VERSION 34#ifdef DESKTOP_VERSION
35#include <qapplication.h> 35#include <qapplication.h>
36#else 36#else
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38#endif 38#endif
39#include <libmailwrapper/smtpwrapper.h> 39#include <libmailwrapper/smtpwrapper.h>
40#include <libmailwrapper/mailtypes.h> 40#include <libmailwrapper/mailtypes.h>
41#include <libmailwrapper/abstractmail.h> 41#include <libmailwrapper/abstractmail.h>
42#include "koprefs.h" 42#include "koprefs.h"
43 43
44//using namespace Opie::Core; 44//using namespace Opie::Core;
45 45
46OpieMail::OpieMail( QWidget *parent, const char *name ) 46OpieMail::OpieMail( QWidget *parent, const char *name )
47 : MainWindow( parent, name) //, WStyle_ContextHelp ) 47 : MainWindow( parent, name) //, WStyle_ContextHelp )
48{ 48{
49 settings = new Settings(); 49 settings = new Settings();
50 tb = 0; 50 tb = 0;
51 setIcon(SmallIcon( "kmicromail" ) ); 51 setIcon(SmallIcon( "kmicromail" ) );
52 folderView->populate( settings->getAccounts() ); 52 folderView->populate( settings->getAccounts() );
53 53
54} 54}
55 55
56OpieMail::~OpieMail() 56OpieMail::~OpieMail()
57{ 57{
58 if (settings) delete settings; 58 if (settings) delete settings;
59 if ( tb ) 59 if ( tb )
60 delete tb; 60 delete tb;
61} 61}
62 62
63void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 63void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
64{ 64{
65 65
66} 66}
67#include <stdlib.h> 67#include <stdlib.h>
68void OpieMail::message(const QCString &msg, const QByteArray &data) 68void OpieMail::message(const QCString &msg, const QByteArray &data)
69{ 69{
70 // copied from old mail2 70 // copied from old mail2
71 static int ii = 0; 71 static int ii = 0;
72 //qDebug("QCOP CALL ############################# %d ", ii); 72 //qDebug("QCOP CALL ############################# %d ", ii);
73 //QString mess ( msg ); 73 //QString mess ( msg );
74 //qDebug("Message = %s ",mess.latin1()); 74 //qDebug("Message = %s ",mess.latin1());
75 ++ii; 75 ++ii;
76 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 76 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
77 77
78 mPendingEmail = QString::null; 78 mPendingEmail = QString::null;
79 mPendingName = QString::null; 79 mPendingName = QString::null;
80 if (msg == "writeMail(QString,QString)") 80 if (msg == "writeMail(QString,QString)")
81 { 81 {
82 //qDebug("writeMail(QString,QString) "); 82 //qDebug("writeMail(QString,QString) ");
83 QDataStream stream(data,IO_ReadOnly); 83 QDataStream stream(data,IO_ReadOnly);
84 stream >> mPendingName >> mPendingEmail; 84 stream >> mPendingName >> mPendingEmail;
85 // removing the whitespaces at beginning and end is needed! 85 // removing the whitespaces at beginning and end is needed!
86 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 86 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
87 } 87 }
88 else if (msg == "newMail()") 88 else if (msg == "newMail()")
89 { 89 {
90 //qDebug("slotComposeMail() "); 90 //qDebug("slotComposeMail() ");
91 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 91 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
92 // and a QCOP call does not like a processevents in his execution 92 // and a QCOP call does not like a processevents in his execution
93 // with the Qtimer we call slotComposeMail() after we reached the main event loop 93 // with the Qtimer we call slotComposeMail() after we reached the main event loop
94 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 94 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
95 // slotComposeMail(); 95 // slotComposeMail();
96 } 96 }
97 else if (msg == "newMail(QString)") 97 else if (msg == "newMail(QString)")
98 { 98 {
99 //qDebug(" newMail(QString)"); 99 //qDebug(" newMail(QString)");
100 QDataStream stream(data,IO_ReadOnly); 100 QDataStream stream(data,IO_ReadOnly);
101 stream >> mPendingName; 101 stream >> mPendingName;
102 // the format is 102 // the format is
103 // NAME <EMAIL>:SUBJECT 103 // NAME <EMAIL>:SUBJECT
104 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 104 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
105 } else { 105 } else {
106 mPendingData = data; 106 mPendingData = data;
107 mPendingMessage = msg; 107 mPendingMessage = msg;
108 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 108 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
109 } 109 }
110 110
111 //qDebug("END OpieMail::message "); 111 //qDebug("END OpieMail::message ");
112} 112}
113void OpieMail::slotExtAppHandler() 113void OpieMail::slotExtAppHandler()
114{ 114{
115 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 115 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
116} 116}
117void OpieMail::slotwriteMail2(const QString& namemail ) 117void OpieMail::slotwriteMail2(const QString& namemail )
118{ 118{
119 //qDebug("OpieMail::slotwriteMail2 "); 119 //qDebug("OpieMail::slotwriteMail2 ");
120 //qApp->processEvents(); 120 //qApp->processEvents();
121 ComposeMail compose( settings, this, 0, true ); 121 ComposeMail compose( settings, this, 0, true );
122 if ( !namemail.isEmpty() ) { 122 if ( !namemail.isEmpty() ) {
123 QString to = namemail; 123 QString to = namemail;
124 if ( namemail.find( " <") > 1 ) { 124 if ( namemail.find( " <") > 1 ) {
125 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 125 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
126 } else 126 } else
127 if ( namemail.find( "<") > 1 ) { 127 if ( namemail.find( "<") > 1 ) {
128 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 128 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
129 } 129 }
130 int sub = to.find( ">:"); 130 int sub = to.find( ">:");
131 if ( sub > 0 ) { 131 if ( sub > 0 ) {
132 compose.setTo( to.left(sub+1) ); 132 compose.setTo( to.left(sub+1) );
133 compose.setSubject( to.mid(sub+2) ); 133 compose.setSubject( to.mid(sub+2) );
134 } else 134 } else
135 compose.setTo( to ); 135 compose.setTo( to );
136 } 136 }
137 compose.slotAdjustColumns(); 137 compose.slotAdjustColumns();
138#ifndef DESKTOP_VERSION 138#ifndef DESKTOP_VERSION
139 compose.showMaximized(); 139 compose.showMaximized();
140#endif 140#endif
141 compose.exec(); 141 compose.exec();
142 raise(); 142 raise();
143 //qDebug("retttich "); 143 //qDebug("retttich ");
144} 144}
145void OpieMail::slotwriteMail(const QString&name,const QString&email) 145void OpieMail::slotwriteMail(const QString&name,const QString&email)
146{ 146{
147 // qDebug("OpieMail::slotwriteMail "); 147 // qDebug("OpieMail::slotwriteMail ");
148 ComposeMail compose( settings, this, 0, true ); 148 ComposeMail compose( settings, this, 0, true );
149 if (!email.isEmpty()) 149 if (!email.isEmpty())
150 { 150 {
151 if (!name.isEmpty()) 151 if (!name.isEmpty())
152 { 152 {
153 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 153 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
154 } 154 }
155 else 155 else
156 { 156 {
157 compose.setTo(email); 157 compose.setTo(email);
158 } 158 }
159 } 159 }
160 compose.slotAdjustColumns(); 160 compose.slotAdjustColumns();
161#ifndef DESKTOP_VERSION 161#ifndef DESKTOP_VERSION
162 compose.showMaximized(); 162 compose.showMaximized();
163#endif 163#endif
164 compose.exec(); 164 compose.exec();
165 raise(); 165 raise();
166} 166}
167 167
168void OpieMail::slotComposeMail() 168void OpieMail::slotComposeMail()
169{ 169{
170 if ( mPendingEmail == QString::null && mPendingName == QString::null) 170 if ( mPendingEmail == QString::null && mPendingName == QString::null)
171 slotwriteMail2( QString () ); 171 slotwriteMail2( QString () );
172 else { 172 else {
173 if ( mPendingEmail == QString::null ) 173 if ( mPendingEmail == QString::null )
174 slotwriteMail2( mPendingName ); 174 slotwriteMail2( mPendingName );
175 else 175 else
176 slotwriteMail( mPendingName, mPendingEmail ); 176 slotwriteMail( mPendingName, mPendingEmail );
177 } 177 }
178 //slotwriteMail(0l,0l); 178 //slotwriteMail(0l,0l);
179} 179}
180 180
181void OpieMail::slotSendQueued() 181void OpieMail::slotSendQueued()
182{ 182{
183 SMTPaccount *smtp = 0; 183 SMTPaccount *smtp = 0;
184 184
185 QList<Account> list = settings->getAccounts(); 185 QList<Account> list = settings->getAccounts();
186 QList<SMTPaccount> smtpList; 186 QList<SMTPaccount> smtpList;
187 smtpList.setAutoDelete(false); 187 smtpList.setAutoDelete(false);
188 Account *it; 188 Account *it;
189 for ( it = list.first(); it; it = list.next() ) 189 for ( it = list.first(); it; it = list.next() )
190 { 190 {
191 if ( it->getType() == MAILLIB::A_SMTP ) 191 if ( it->getType() == MAILLIB::A_SMTP )
192 { 192 {
193 smtp = static_cast<SMTPaccount *>(it); 193 smtp = static_cast<SMTPaccount *>(it);
194 smtpList.append(smtp); 194 smtpList.append(smtp);
195 } 195 }
196 } 196 }
197 if (smtpList.count()==0) 197 if (smtpList.count()==0)
198 { 198 {
199 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); 199 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n"));
200 return; 200 return;
201 } 201 }
202 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 202 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
203 return; 203 return;
204 if (smtpList.count()==1) 204 if (smtpList.count()==1)
205 { 205 {
206 smtp = smtpList.at(0); 206 smtp = smtpList.at(0);
207 } 207 }
208 else 208 else
209 { 209 {
210 smtp = 0; 210 smtp = 0;
211 selectsmtp selsmtp; 211 selectsmtp selsmtp;
212 selsmtp.setSelectionlist(&smtpList); 212 selsmtp.setSelectionlist(&smtpList);
213#ifndef DESKTOP_VERSION 213#ifndef DESKTOP_VERSION
214 selsmtp.showMaximized(); 214 selsmtp.showMaximized();
215#endif 215#endif
216 if ( selsmtp.exec() == QDialog::Accepted ) 216 if ( selsmtp.exec() == QDialog::Accepted )
217 { 217 {
218 smtp = selsmtp.selected_smtp(); 218 smtp = selsmtp.selected_smtp();
219 } 219 }
220 } 220 }
221 if (smtp) 221 if (smtp)
222 { 222 {
223 223
224 Global::statusMessage("Sending mails...!"); 224 Global::statusMessage("Sending mails...!");
225 SMTPwrapper * wrap = new SMTPwrapper(smtp); 225 SMTPwrapper * wrap = new SMTPwrapper(smtp);
226 if ( wrap->flushOutbox() ) 226 if ( wrap->flushOutbox() )
227 { 227 {
228 Global::statusMessage("Mails sent!"); 228 Global::statusMessage("Mails sent!");
229 } 229 }
230 delete wrap; 230 delete wrap;
231 } 231 }
232 // pending refresh list view, if outgoing is displayed 232 // pending refresh list view, if outgoing is displayed
233} 233}
234 234
235void OpieMail::slotSearchMails() 235void OpieMail::slotSearchMails()
236{ 236{
237 qDebug("OpieMail::slotSearchMails():not implemented "); 237 qDebug("OpieMail::slotSearchMails():not implemented ");
238} 238}
239 239
240void OpieMail::slotEditSettings() 240void OpieMail::slotEditSettings()
241{ 241{
242 242
243 KOPrefsDialog settingsDialog( this, "koprefs", true ); 243 KOPrefsDialog settingsDialog( this, "koprefs", true );
244#ifndef DESKTOP_VERSION 244#ifndef DESKTOP_VERSION
245 settingsDialog.showMaximized(); 245 settingsDialog.showMaximized();
246#endif 246#endif
247 settingsDialog.exec(); 247 settingsDialog.exec();
248 248
249 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 249 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
250 // KApplication::execDialog(settingsDialog); 250 // KApplication::execDialog(settingsDialog);
251} 251}
252 252
253void OpieMail::slotEditAccounts() 253void OpieMail::slotEditAccounts()
254{ 254{
255 EditAccounts eaDialog( settings, this, 0, true ); 255 EditAccounts eaDialog( settings, this, 0, true );
256 eaDialog.slotAdjustColumns(); 256 eaDialog.slotAdjustColumns();
257#ifndef DESKTOP_VERSION 257#ifndef DESKTOP_VERSION
258 eaDialog.showMaximized(); 258 eaDialog.showMaximized();
259#endif 259#endif
260 eaDialog.exec(); 260 eaDialog.exec();
261 if ( settings ) delete settings; 261 if ( settings ) delete settings;
262 settings = new Settings(); 262 settings = new Settings();
263 263
264 folderView->populate( settings->getAccounts() ); 264 folderView->populate( settings->getAccounts() );
265} 265}
266void OpieMail::replyMail() 266void OpieMail::replyMail()
267{ 267{
268 268
269 QListViewItem*item = mailView->currentItem(); 269 QListViewItem*item = mailView->currentItem();
270 if (!item) return; 270 if (!item) return;
271 RecMailP mail = ((MailListViewItem*)item)->data(); 271 RecMailP mail = ((MailListViewItem*)item)->data();
272 RecBodyP body = folderView->fetchBody(mail); 272 RecBodyP body = folderView->fetchBody(mail);
273 273
274 QString rtext; 274 QString rtext;
275 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 275 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
276 .arg( mail->getFrom()) 276 .arg( mail->getFrom())
277 .arg( mail->getDate()); 277 .arg( mail->getDate());
278 278
279 QString text = body->Bodytext(); 279 QString text = body->Bodytext();
280 QStringList lines = QStringList::split(QRegExp("\\n"), text); 280 QStringList lines = QStringList::split(QRegExp("\\n"), text);
281 QStringList::Iterator it; 281 QStringList::Iterator it;
282 for (it = lines.begin(); it != lines.end(); it++) 282 for (it = lines.begin(); it != lines.end(); it++)
283 { 283 {
284 rtext += "> " + *it + "\n"; 284 rtext += "> " + *it + "\n";
285 } 285 }
286 rtext += "\n"; 286 rtext += "\n";
287 287
288 QString prefix; 288 QString prefix;
289 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; 289 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
290 else prefix = "Re: "; // no i18n on purpose 290 else prefix = "Re: "; // no i18n on purpose
291 291
292 Settings *settings = new Settings(); 292 Settings *settings = new Settings();
293 ComposeMail composer( settings ,this, 0, true); 293 ComposeMail composer( settings ,this, 0, true);
294 if (mail->Replyto().isEmpty()) { 294 if (mail->Replyto().isEmpty()) {
295 composer.setTo( mail->getFrom()); 295 composer.setTo( mail->getFrom());
296 } else { 296 } else {
297 composer.setTo( mail->Replyto()); 297 composer.setTo( mail->Replyto());
298 } 298 }
299 composer.setSubject( prefix + mail->getSubject()); 299 composer.setSubject( prefix + mail->getSubject());
300 composer.setMessage( rtext ); 300 composer.setMessage( rtext );
301 composer.setInReplyTo( mail->Msgid()); 301 composer.setInReplyTo( mail->Msgid());
302 composer.setCharset( body->getCharset() ); 302 composer.setCharset( body->getCharset() );
303 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 303 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
304 { 304 {
305 mail->Wrapper()->answeredMail(mail); 305 mail->Wrapper()->answeredMail(mail);
306 } 306 }
307 delete settings; 307 delete settings;
308 308
309} 309}
310void OpieMail::closeViewMail(ViewMail * vm) 310void OpieMail::closeViewMail(ViewMail * vm)
311{ 311{
312 vm->hide(); 312 vm->hide();
313} 313}
314 314
315void OpieMail::slotDownloadMail( ) 315void OpieMail::slotDownloadMail( )
316{ 316{
317 QListViewItem*item = mailView->currentItem(); 317 QListViewItem*item = mailView->currentItem();
318 if (!item ) { 318 if (!item ) {
319 Global::statusMessage("Error: No item slected!"); 319 Global::statusMessage("Error: No item slected!");
320 return; 320 return;
321 } 321 }
322 RecMailP mail = ((MailListViewItem*)item)->data(); 322 RecMailP mail = ((MailListViewItem*)item)->data();
323 Account * acc = mail->Wrapper()->getAccount(); 323 Account * acc = mail->Wrapper()->getAccount();
324 if ( !acc ) { 324 if ( !acc ) {
325 Global::statusMessage("Mail is already stored locally!"); 325 Global::statusMessage("Mail is already stored locally!");
326 return; 326 return;
327 } 327 }
328 QString lfName = acc->getLocalFolder(); 328 QString lfName = acc->getLocalFolder();
329 //qDebug("local folder " + lfName ); 329 //qDebug("local folder " + lfName );
330 if ( lfName.isEmpty() ) 330 if ( lfName.isEmpty() )
331 lfName = acc->getAccountName(); 331 lfName = acc->getAccountName();
332 AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); 332 AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper();
333 //qDebug("target %d %d ",targetMail,mail->Wrapper() ); 333 //qDebug("target %d %d ",targetMail,mail->Wrapper() );
334 if ( targetMail == mail->Wrapper() ) { 334 if ( targetMail == mail->Wrapper() ) {
335 Global::statusMessage("Mail is already locally stored!"); 335 Global::statusMessage("Mail is already locally stored!");
336 return; 336 return;
337 } 337 }
338 if ( !targetMail->createMbox(lfName)) { 338 if ( !targetMail->createMbox(lfName)) {
339 Global::statusMessage("Error creating folder!"); 339 Global::statusMessage("Error creating folder!");
340 return; 340 return;
341 } 341 }
342 Global::statusMessage("Fetching mail...please wait!"); 342 Global::statusMessage("Fetching mail...please wait!");
343 qApp->processEvents(); 343 qApp->processEvents();
344 encodedString*st = 0; 344 encodedString*st = 0;
345 st = mail->Wrapper()->fetchRawBody(mail); 345 st = mail->Wrapper()->fetchRawBody(mail);
346 if ( st ) { 346 if ( st ) {
347 targetMail->storeMessage(st->Content(),st->Length(),lfName); 347 targetMail->storeMessage(st->Content(),st->Length(),lfName);
348 Global::statusMessage("Mail stored in "+ lfName); 348 Global::statusMessage("Mail stored in "+ lfName);
349 delete st; 349 delete st;
350 } else { 350 } else {
351 Global::statusMessage("Error: Cannot fetch mail!"); 351 Global::statusMessage("Error: Cannot fetch mail!");
352 } 352 }
353} 353}
354 354
355 355
356void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) 356void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
357{ 357{
358 QListViewItem*item = mailView->currentItem(); 358 QListViewItem*item = mailView->currentItem();
359 if (!item ) { 359 if (!item ) {
360 closeViewMail(vm); 360 closeViewMail(vm);
361 return; 361 return;
362 } 362 }
363 RecMailP mail = ((MailListViewItem*)item)->data(); 363 RecMailP mail = ((MailListViewItem*)item)->data();
364 mail->Wrapper()->deleteMail( mail ); 364 mail->Wrapper()->deleteMail( mail );
365 item = item->itemBelow(); 365 item = item->itemBelow();
366 if (!item ) { 366 if (!item ) {
367 closeViewMail(vm); 367 closeViewMail(vm);
368 return; 368 return;
369 } 369 }
370 mailView->setCurrentItem(item); 370 mailView->setCurrentItem(item);
371 mail = ((MailListViewItem*)item)->data(); 371 mail = ((MailListViewItem*)item)->data();
372 RecBodyP body = folderView->fetchBody(mail); 372 RecBodyP body = folderView->fetchBody(mail);
373 vm->setBody( body ); 373 vm->setBody( body );
374 vm->setMail( mail ); 374 vm->setMail( mail );
375} 375}
376void OpieMail::displayNextMail(ViewMail * vm) 376void OpieMail::displayNextMail(ViewMail * vm)
377{ 377{
378 QListViewItem*item = mailView->currentItem(); 378 QListViewItem*item = mailView->currentItem();
379 if (!item) return; 379 if (!item) return;
380 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 380 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
381 item = item->itemBelow(); 381 item = item->itemBelow();
382 if (!item) { 382 if (!item) {
383 vm->setCaption(i18n("End of List" )); 383 vm->setCaption(i18n("End of List" ));
384 return; 384 return;
385 } 385 }
386 mailView->setCurrentItem(item); 386 mailView->setCurrentItem(item);
387 RecMailP mail = ((MailListViewItem*)item)->data(); 387 RecMailP mail = ((MailListViewItem*)item)->data();
388 RecBodyP body = folderView->fetchBody(mail); 388 RecBodyP body = folderView->fetchBody(mail);
389 vm->setBody( body ); 389 vm->setBody( body );
390 vm->setMail( mail ); 390 vm->setMail( mail );
391} 391}
392void OpieMail::displayMail() 392void OpieMail::displayMail()
393{ 393{
394 QListViewItem*item = mailView->currentItem(); 394 QListViewItem*item = mailView->currentItem();
395 if (!item) return; 395 if (!item) return;
396 RecMailP mail = ((MailListViewItem*)item)->data(); 396 RecMailP mail = ((MailListViewItem*)item)->data();
397 RecBodyP body = folderView->fetchBody(mail); 397 RecBodyP body = folderView->fetchBody(mail);
398 ViewMail readMail( this,"", Qt::WType_Modal ); 398 ViewMail readMail( this,"", Qt::WType_Modal );
399 readMail.setBody( body ); 399 readMail.setBody( body );
400 readMail.setMail( mail ); 400 readMail.setMail( mail );
401#ifndef DESKTOP_VERSION 401#ifndef DESKTOP_VERSION
402 readMail.showMaximized(); 402 readMail.showMaximized();
403#else 403#else
404 readMail.resize( 640, 480); 404 readMail.resize( 640, 480);
405#endif 405#endif
406 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); 406 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
407 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); 407 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
408 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); 408 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
409 409
410 readMail.exec(); 410 readMail.exec();
411 411
412 if ( readMail.deleted ) 412 if ( readMail.deleted )
413 { 413 {
414 folderView->refreshCurrent(); 414 folderView->refreshCurrent();
415 } 415 }
416 else 416 else
417 { 417 {
418 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 418 QListViewItem*item = mailView->currentItem();
419 if (item)
420 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
419 } 421 }
420} 422}
421void OpieMail::slotGetAllMail() 423void OpieMail::slotGetAllMail()
422{ 424{
423 QListViewItem * item = folderView->firstChild(); 425 QListViewItem * item = folderView->firstChild();
424 while ( item ){ 426 while ( item ){
425 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 427 ((AccountViewItem *)item)->contextMenuSelected( 101 );
426 item = item->nextSibling (); 428 item = item->nextSibling ();
427 } 429 }
428} 430}
429void OpieMail::slotGetMail() 431void OpieMail::slotGetMail()
430{ 432{
431 QListViewItem * item = folderView->currentItem(); 433 QListViewItem * item = folderView->currentItem();
432 if ( ! item ) return; 434 if ( ! item ) return;
433 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 435 ((AccountViewItem *)item)->contextMenuSelected( 101 );
434} 436}
435void OpieMail::slotDeleteMail() 437void OpieMail::slotDeleteMail()
436{ 438{
437 if (!mailView->currentItem()) return; 439 if (!mailView->currentItem()) return;
438 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 440 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
439 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 441 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
440 { 442 {
441 mail->Wrapper()->deleteMail( mail ); 443 mail->Wrapper()->deleteMail( mail );
442 folderView->refreshCurrent(); 444 folderView->refreshCurrent();
443 } 445 }
444} 446}
445void OpieMail::slotDeleteAllMail() 447void OpieMail::slotDeleteAllMail()
446{ 448{
447 449
448 QValueList<RecMailP> t; 450 QValueList<RecMailP> t;
449 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 451 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
450 { 452 {
451 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 453 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
452 while ( item ) { 454 while ( item ) {
453 if ( item->isSelected() ) { 455 if ( item->isSelected() ) {
454 t.append( item->data() ); 456 t.append( item->data() );
455 } 457 }
456 item = (MailListViewItem*)item->nextSibling(); 458 item = (MailListViewItem*)item->nextSibling();
457 } 459 }
458 } 460 }
459 else 461 else
460 return; 462 return;
461 if ( t.count() == 0 ) 463 if ( t.count() == 0 )
462 return; 464 return;
463 RecMailP mail = t.first(); 465 RecMailP mail = t.first();
464 mail->Wrapper()->deleteMailList(t); 466 mail->Wrapper()->deleteMailList(t);
465 folderView->refreshCurrent(); 467 folderView->refreshCurrent();
466 468
467 469
468} 470}
469void OpieMail::clearSelection() 471void OpieMail::clearSelection()
470{ 472{
471 mailView->clearSelection(); 473 mailView->clearSelection();
472 474
473} 475}
474 476
475void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 477void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
476{ 478{
477 if (!mailView->currentItem()) return; 479 if (!mailView->currentItem()) return;
478 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 480 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
479 /* just the RIGHT button - or hold on pda */ 481 /* just the RIGHT button - or hold on pda */
480 if (button!=2) {return;} 482 if (button!=2) {return;}
481 if (!item) return; 483 if (!item) return;
482 QPopupMenu *m = new QPopupMenu(0); 484 QPopupMenu *m = new QPopupMenu(0);
483 if (m) 485 if (m)
484 { 486 {
485 if (mailtype==MAILLIB::A_NNTP) { 487 if (mailtype==MAILLIB::A_NNTP) {
486 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); 488 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
487 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); 489 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
488 m->insertSeparator(); 490 m->insertSeparator();
489 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 491 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
490 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 492 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
491 } else { 493 } else {
492 if (folderView->currentisDraft()) { 494 if (folderView->currentisDraft()) {
493 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); 495 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
494 } 496 }
495 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); 497 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
496 m->insertSeparator(); 498 m->insertSeparator();
497 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); 499 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
498 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 500 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
499 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); 501 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
500 m->insertSeparator(); 502 m->insertSeparator();
501 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 503 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
502 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 504 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
503 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 505 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
504 } 506 }
505 m->setFocus(); 507 m->setFocus();
506 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 508 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
507 delete m; 509 delete m;
508 } 510 }
509} 511}
510 512
511void OpieMail::slotShowFolders( bool show ) 513void OpieMail::slotShowFolders( bool show )
512{ 514{
513 if ( show && folderView->isHidden() ) 515 if ( show && folderView->isHidden() )
514 { 516 {
515 folderView->show(); 517 folderView->show();
516 } 518 }
517 else if ( !show && !folderView->isHidden() ) 519 else if ( !show && !folderView->isHidden() )
518 { 520 {
519 folderView->hide(); 521 folderView->hide();
520 } 522 }
521} 523}
522 524
523void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 525void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
524{ 526{
525 MailListViewItem*item = 0; 527 MailListViewItem*item = 0;
526 mailView->clear(); 528 mailView->clear();
527 529
528 QValueList<RecMailP>::ConstIterator it; 530 QValueList<RecMailP>::ConstIterator it;
529 for (it = list.begin(); it != list.end();++it) 531 for (it = list.begin(); it != list.end();++it)
530 { 532 {
531 item = new MailListViewItem(mailView,item); 533 item = new MailListViewItem(mailView,item);
532 item->storeData((*it)); 534 item->storeData((*it));
533 item->showEntry(); 535 item->showEntry();
534 } 536 }
535 mailView->setSorting ( 4, false ); 537 mailView->setSorting ( 4, false );
536} 538}
537 539
538void OpieMail::mailLeftClicked( QListViewItem *item ) 540void OpieMail::mailLeftClicked( QListViewItem *item )
539{ 541{
540 mailView->clearSelection(); 542 mailView->clearSelection();
541 /* just LEFT button - or tap with stylus on pda */ 543 /* just LEFT button - or tap with stylus on pda */
542 //if (button!=1) return; 544 //if (button!=1) return;
543 if (!item) return; 545 if (!item) return;
544 if (folderView->currentisDraft()) { 546 if (folderView->currentisDraft()) {
545 reEditMail(); 547 reEditMail();
546 } else { 548 } else {
547 displayMail(); 549 displayMail();
548 } 550 }
549} 551}
550 552
551void OpieMail::slotMoveCopyMail() 553void OpieMail::slotMoveCopyMail()
552{ 554{
553 if (!mailView->currentItem()) return; 555 if (!mailView->currentItem()) return;
554 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 556 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
555 AbstractMail*targetMail = 0; 557 AbstractMail*targetMail = 0;
556 QString targetFolder = ""; 558 QString targetFolder = "";
557 Selectstore sels; 559 Selectstore sels;
558 folderView->setupFolderselect(&sels); 560 folderView->setupFolderselect(&sels);
559 if (!sels.exec()) return; 561 if (!sels.exec()) return;
560 targetMail = sels.currentMail(); 562 targetMail = sels.currentMail();
561 targetFolder = sels.currentFolder(); 563 targetFolder = sels.currentFolder();
562 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 564 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
563 targetFolder.isEmpty()) 565 targetFolder.isEmpty())
564 { 566 {
565 return; 567 return;
566 } 568 }
567 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 569 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
568 { 570 {
569 QMessageBox::critical(0,i18n("Error creating new Folder"), 571 QMessageBox::critical(0,i18n("Error creating new Folder"),
570 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 572 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
571 return; 573 return;
572 } 574 }
573 sels.hide(); 575 sels.hide();
574 qApp->processEvents(); 576 qApp->processEvents();
575 // qDebug("hiding sels "); 577 // qDebug("hiding sels ");
576 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 578 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
577 folderView->refreshCurrent(); 579 folderView->refreshCurrent();
578} 580}
579 581
580void OpieMail::slotMoveCopyAllMail() 582void OpieMail::slotMoveCopyAllMail()
581{ 583{
582 584
583 if (!mailView->currentItem()) return; 585 if (!mailView->currentItem()) return;
584 QValueList<RecMailP> t; 586 QValueList<RecMailP> t;
585 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 587 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
586 { 588 {
587 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 589 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
588 while ( item ) { 590 while ( item ) {
589 if ( item->isSelected() ) { 591 if ( item->isSelected() ) {
590 t.append( item->data() ); 592 t.append( item->data() );
591 } 593 }
592 item = (MailListViewItem*)item->nextSibling(); 594 item = (MailListViewItem*)item->nextSibling();
593 } 595 }
594 } 596 }
595 // else 597 // else
596 // return; 598 // return;
597 if ( t.count() == 0 ) 599 if ( t.count() == 0 )
598 return; 600 return;
599 RecMailP mail = t.first(); 601 RecMailP mail = t.first();
600 AbstractMail*targetMail = 0; 602 AbstractMail*targetMail = 0;
601 QString targetFolder = ""; 603 QString targetFolder = "";
602 Selectstore sels; 604 Selectstore sels;
603 folderView->setupFolderselect(&sels); 605 folderView->setupFolderselect(&sels);
604 if (!sels.exec()) return; 606 if (!sels.exec()) return;
605 targetMail = sels.currentMail(); 607 targetMail = sels.currentMail();
606 targetFolder = sels.currentFolder(); 608 targetFolder = sels.currentFolder();
607 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 609 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
608 targetFolder.isEmpty()) 610 targetFolder.isEmpty())
609 { 611 {
610 return; 612 return;
611 } 613 }
612 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 614 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
613 { 615 {
614 QMessageBox::critical(0,i18n("Error creating new Folder"), 616 QMessageBox::critical(0,i18n("Error creating new Folder"),
615 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 617 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
616 return; 618 return;
617 } 619 }
618 sels.hide(); 620 sels.hide();
619 qApp->processEvents(); 621 qApp->processEvents();
620 //qDebug("hiding sels "); 622 //qDebug("hiding sels ");
621 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); 623 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails());
622 folderView->refreshCurrent(); 624 folderView->refreshCurrent();
623} 625}
624 626
625void OpieMail::reEditMail() 627void OpieMail::reEditMail()
626{ 628{
627 if (!mailView->currentItem()) return; 629 if (!mailView->currentItem()) return;
628 630
629 ComposeMail compose( settings, this, 0, true ); 631 ComposeMail compose( settings, this, 0, true );
630 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 632 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
631 compose.slotAdjustColumns(); 633 compose.slotAdjustColumns();
632#ifndef DESKTOP_VERSION 634#ifndef DESKTOP_VERSION
633 compose.showMaximized(); 635 compose.showMaximized();
634#else 636#else
635 compose.resize(640,480); 637 compose.resize(640,480);
636#endif 638#endif
637 compose.exec(); 639 compose.exec();
638} 640}
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h
index 561989e..fc5edcf 100644
--- a/kmicromail/viewmail.h
+++ b/kmicromail/viewmail.h
@@ -1,91 +1,93 @@
1#ifndef VIEWMAIL_H 1#ifndef VIEWMAIL_H
2#define VIEWMAIL_H 2#define VIEWMAIL_H
3 3
4#include "viewmailbase.h" 4#include "viewmailbase.h"
5#include <libmailwrapper/mailtypes.h> 5#include <libmailwrapper/mailtypes.h>
6 6
7#include <qdialog.h> 7#include <qdialog.h>
8#include <qapplication.h>
8 9
9#include <qlistview.h> 10#include <qlistview.h>
10#include <qmap.h> 11#include <qmap.h>
12#include <klocale.h>
11#include <qstringlist.h> 13#include <qstringlist.h>
12#include <qvaluelist.h> 14#include <qvaluelist.h>
13 15
14//namespace Opie { namespace MM { class OImageScrollView; } } 16//namespace Opie { namespace MM { class OImageScrollView; } }
15 17
16class AttachItem : public QListViewItem 18class AttachItem : public QListViewItem
17{ 19{
18public: 20public:
19 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 21 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
20 const QString&fsize,int num,const QValueList<int>&path); 22 const QString&fsize,int num,const QValueList<int>&path);
21 AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 23 AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
22 const QString&fsize,int num,const QValueList<int>&path); 24 const QString&fsize,int num,const QValueList<int>&path);
23 int Partnumber() { return _partNum; } 25 int Partnumber() { return _partNum; }
24 bool isParentof(const QValueList<int>&path); 26 bool isParentof(const QValueList<int>&path);
25 27
26private: 28private:
27 int _partNum; 29 int _partNum;
28 /* needed for a better display of attachments */ 30 /* needed for a better display of attachments */
29 QValueList<int> _path; 31 QValueList<int> _path;
30}; 32};
31 33
32class ViewMail : public ViewMailBase 34class ViewMail : public ViewMailBase
33{ 35{
34 Q_OBJECT 36 Q_OBJECT
35 37
36public: 38public:
37 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 39 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
38 ~ViewMail(); 40 ~ViewMail();
39 41
40 void hide(); 42 void hide();
41 void exec(); 43 void exec();
42 void setMail(const RecMailP&mail ); 44 void setMail(const RecMailP&mail );
43 void setBody(const RecBodyP&body); 45 void setBody(const RecBodyP&body);
44 bool deleted; 46 bool deleted;
45 signals: 47 signals:
46 void showNextMail(ViewMail*); 48 void showNextMail(ViewMail*);
47 void deleteAndDisplayNextMail(ViewMail *); 49 void deleteAndDisplayNextMail(ViewMail *);
48 void signalDownloadMail(); 50 void signalDownloadMail();
49protected: 51protected:
50 QString deHtml(const QString &string); 52 QString deHtml(const QString &string);
51 AttachItem* searchParent(const QValueList<int>&path); 53 AttachItem* searchParent(const QValueList<int>&path);
52 AttachItem* lastChild(AttachItem*parent); 54 AttachItem* lastChild(AttachItem*parent);
53 55
54protected slots: 56protected slots:
55 void slotNextMail() { emit showNextMail(this); }; 57 void slotNextMail() { setCaption(i18n("Displaying next mail...please wait!")); qApp->processEvents();emit showNextMail(this); };
56 void slotReply(); 58 void slotReply();
57 void slotForward(); 59 void slotForward();
58 void setText(); 60 void setText();
59 void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); 61 void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
60 void slotDeleteMail( ); 62 void slotDeleteMail( );
61 void slotShowHtml( bool ); 63 void slotShowHtml( bool );
62 void slotViewSource(); 64 void slotViewSource();
63 65
64private: 66private:
65 void readConfig(); 67 void readConfig();
66 bool sourceOn;; 68 bool sourceOn;;
67 bool _inLoop; 69 bool _inLoop;
68 QString m_mailHtml; 70 QString m_mailHtml;
69 bool m_gotBody; 71 bool m_gotBody;
70 RecBodyP m_body; 72 RecBodyP m_body;
71 RecMailP m_recMail; 73 RecMailP m_recMail;
72 bool m_showHtml; 74 bool m_showHtml;
73 75
74 // 0 from 1 subject 2 bodytext 3 date 76 // 0 from 1 subject 2 bodytext 3 date
75 QMap <int,QString> m_mail; 77 QMap <int,QString> m_mail;
76 // 0 to 1 cc 2 bcc 78 // 0 to 1 cc 2 bcc
77 QMap <int,QStringList> m_mail2; 79 QMap <int,QStringList> m_mail2;
78}; 80};
79 81
80class MailImageDlg:public QDialog 82class MailImageDlg:public QDialog
81{ 83{
82 Q_OBJECT 84 Q_OBJECT
83public: 85public:
84 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); 86 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0);
85 ~MailImageDlg(); 87 ~MailImageDlg();
86 void setName(const QString&); 88 void setName(const QString&);
87protected: 89protected:
88 //Opie::MM::OImageScrollView*m_imageview; 90 //Opie::MM::OImageScrollView*m_imageview;
89}; 91};
90 92
91#endif 93#endif
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp
index 9365c23..3a41ba0 100644
--- a/kmicromail/viewmailbase.cpp
+++ b/kmicromail/viewmailbase.cpp
@@ -1,112 +1,106 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#include <qtextbrowser.h> 2#include <qtextbrowser.h>
3#include <qlistview.h> 3#include <qlistview.h>
4#include <qaction.h> 4#include <qaction.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qvbox.h> 6#include <qvbox.h>
7 7
8#include <qtoolbar.h> 8#include <qtoolbar.h>
9#include <qmenubar.h> 9#include <qmenubar.h>
10#include <kiconloader.h> 10#include <kiconloader.h>
11//#include <qpe/resource.h> 11//#include <qpe/resource.h>
12#include <klocale.h> 12#include <klocale.h>
13 13
14#include "viewmailbase.h" 14#include "viewmailbase.h"
15//#include "opendiag.h" 15//#include "opendiag.h"
16 16
17ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) 17ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
18 : QMainWindow(parent, name, fl) 18 : QMainWindow(parent, name, fl)
19{ 19{
20 20
21 setToolBarsMovable(false); 21 setToolBarsMovable(false);
22 22
23 toolbar = new QToolBar(this); 23 toolbar = new QToolBar(this);
24 menubar = new QMenuBar( toolbar ); 24 menubar = new QMenuBar( toolbar );
25 mailmenu = new QPopupMenu( menubar ); 25 mailmenu = new QPopupMenu( menubar );
26 menubar->insertItem( i18n( "Mail" ), mailmenu ); 26 menubar->insertItem( i18n( "Mail" ), mailmenu );
27 27
28 toolbar->setHorizontalStretchable(true); 28 toolbar->setHorizontalStretchable(true);
29 addToolBar(toolbar); 29 addToolBar(toolbar);
30 30
31 viewSource = new QAction(i18n("View Source"), 0, 0, this); 31 viewSource = new QAction(i18n("View Source"), 0, 0, this);
32 viewSource->addTo(mailmenu); 32 viewSource->addTo(mailmenu);
33 33
34 downloadMail= new QAction(i18n("Download Mail"),SmallIcon("add"), 0, 0, this); 34 downloadMail= new QAction(i18n("Download Mail"),SmallIcon("add"), 0, 0, this);
35 downloadMail->addTo(toolbar); 35 downloadMail->addTo(toolbar);
36 downloadMail->addTo(mailmenu); 36 downloadMail->addTo(mailmenu);
37 37
38 38
39 reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this); 39 reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this);
40 reply->addTo(toolbar); 40 reply->addTo(toolbar);
41 reply->addTo(mailmenu); 41 reply->addTo(mailmenu);
42 42
43 forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this); 43 forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this);
44 forward->addTo(toolbar); 44 forward->addTo(toolbar);
45 forward->addTo(mailmenu); 45 forward->addTo(mailmenu);
46 46
47 attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); 47 attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true);
48 attachbutton->addTo(toolbar); 48 attachbutton->addTo(toolbar);
49 attachbutton->addTo(mailmenu); 49 attachbutton->addTo(mailmenu);
50 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); 50 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
51 51
52 52 showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true );
53 showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); 53 showHtml->addTo( toolbar );
54 showHtml->addTo( toolbar ); 54 showHtml->addTo( mailmenu );
55 showHtml->addTo( mailmenu );
56 55
57 deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this); 56 deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this);
58 deleteMail->addTo(toolbar); 57 deleteMail->addTo(toolbar);
59 deleteMail->addTo(mailmenu); 58 deleteMail->addTo(mailmenu);
60 59
61
62
63 nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this); 60 nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this);
64 QLabel *spacer = new QLabel(toolbar); 61 QLabel *spacer = new QLabel(toolbar);
65 nextMail->addTo(toolbar); 62 nextMail->addTo(toolbar);
66 nextMail->addTo(mailmenu); 63 nextMail->addTo(mailmenu);
67 64
68
69
70
71 closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); 65 closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
72 //QLabel *spacer = new QLabel(toolbar); 66 //QLabel *spacer = new QLabel(toolbar);
73 spacer->setBackgroundMode(QWidget::PaletteButton); 67 spacer->setBackgroundMode(QWidget::PaletteButton);
74 toolbar->setStretchableWidget(spacer); 68 toolbar->setStretchableWidget(spacer);
75 closeMail->addTo(toolbar); 69 closeMail->addTo(toolbar);
76 closeMail->addTo(mailmenu); 70 closeMail->addTo(mailmenu);
77 QVBox *view = new QVBox(this); 71 QVBox *view = new QVBox(this);
78 setCentralWidget(view); 72 setCentralWidget(view);
79 73
80 attachments = new QListView(view); 74 attachments = new QListView(view);
81 attachments->setMinimumHeight(90); 75 attachments->setMinimumHeight(90);
82 attachments->setMaximumHeight(90); 76 attachments->setMaximumHeight(90);
83 attachments->setAllColumnsShowFocus(true); 77 attachments->setAllColumnsShowFocus(true);
84 attachments->addColumn("Mime Type", 60); 78 attachments->addColumn("Mime Type", 60);
85 attachments->addColumn(i18n("Description"), 100); 79 attachments->addColumn(i18n("Description"), 100);
86 attachments->addColumn(i18n("Filename"), 80); 80 attachments->addColumn(i18n("Filename"), 80);
87 attachments->addColumn(i18n("Size"), 80); 81 attachments->addColumn(i18n("Size"), 80);
88 attachments->setSorting(-1); 82 attachments->setSorting(-1);
89 attachments->hide(); 83 attachments->hide();
90 84
91 browser = new QTextBrowser(view); 85 browser = new QTextBrowser(view);
92 86
93 //openDiag = new OpenDiag(view); 87 //openDiag = new OpenDiag(view);
94 //openDiag->hide(); 88 //openDiag->hide();
95 89
96} 90}
97 91
98void ViewMailBase::slotChangeAttachview(bool state) 92void ViewMailBase::slotChangeAttachview(bool state)
99{ 93{
100 if (state) attachments->show(); 94 if (state) attachments->show();
101 else attachments->hide(); 95 else attachments->hide();
102} 96}
103 97
104void ViewMailBase::keyPressEvent ( QKeyEvent * e ) 98void ViewMailBase::keyPressEvent ( QKeyEvent * e )
105{ 99{
106 if( e->key()==Qt::Key_Escape ) { 100 if( e->key()==Qt::Key_Escape ) {
107 close(); 101 close();
108 e->accept(); 102 e->accept();
109 return; 103 return;
110 } 104 }
111 QWidget::keyPressEvent(e); 105 QWidget::keyPressEvent(e);
112} 106}