summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--kmicromail/koprefs.cpp1
-rw-r--r--kmicromail/koprefs.h2
-rw-r--r--kmicromail/koprefsdialog.cpp3
-rw-r--r--kmicromail/mailistviewitem.cpp49
-rw-r--r--kmicromail/mainwindow.cpp4
-rw-r--r--kmicromail/opiemail.cpp17
-rw-r--r--kmicromail/opiemail.h3
-rw-r--r--kmicromail/viewmail.cpp25
-rw-r--r--kmicromail/viewmail.h4
-rw-r--r--kmicromail/viewmailbase.cpp8
-rw-r--r--kmicromail/viewmailbase.h2
12 files changed, 68 insertions, 52 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index cbed872..2516b2a 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,48 +1,50 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 1.9.20 ************ 3********** VERSION 1.9.20 ************
4 4
5KO/Pi: 5KO/Pi:
6Added for the "dislplay one day" agenda mode 6Added for the "dislplay one day" agenda mode
7info in the caption and in the day lables: 7info in the caption and in the day lables:
8Now it is displayed, if the selected day is from "day before yesterday" 8Now it is displayed, if the selected day is from "day before yesterday"
9to "day after tomorrow". 9to "day after tomorrow".
10Made it possible to delete a Todo, which has sub-todos. 10Made it possible to delete a Todo, which has sub-todos.
11Fixed two small problems in the todo view. 11Fixed two small problems in the todo view.
12Added missing German translation for filter edit and print dialog. 12Added missing German translation for filter edit and print dialog.
13Made search dialog closeable by cancel key. 13Made search dialog closeable by cancel key.
14 14
15Made it possible to select in the date picker the (ligt grey ) 15Made it possible to select in the date picker the (ligt grey )
16dates of the prev./next month with the mouse. 16dates of the prev./next month with the mouse.
17 17
18OM/Pi: 18OM/Pi:
19"Delete mail" icon in main window now deletes all selected mails. 19"Delete mail" icon in main window now deletes all selected mails.
20Fixed the problem, that the state flag of imap mails was ignored. 20Fixed the problem, that the state flag of imap mails was ignored.
21Now mails with "FLAG_SEEN" on the imap server get no icon in the list view 21Now mails with "FLAG_SEEN" on the imap server get no icon in the list view
22to idecate that they are already seen. 22to idecate that they are already seen.
23Fixed the problem that the body of some mails was not displayed in the 23Fixed the problem that the body of some mails was not displayed in the
24mail viewer when fetching them from the imap server directly to read them. 24mail viewer when fetching them from the imap server directly to read them.
25Made it (configurable) possible to show the "To:" field in the list view.
26Added to the mail viewer the option "View Source" to make it possible to see the raw mail data.
25 27
26 28
27 29
28********** VERSION 1.9.19 ************ 30********** VERSION 1.9.19 ************
29 31
30Added a lot of missing translations to KA/Pi, 32Added a lot of missing translations to KA/Pi,
31Added some missing translations to KO/Pi and OM/Pi. 33Added some missing translations to KO/Pi and OM/Pi.
32 34
33Fixed some minor problems in KA/Pi + KO/Pi. 35Fixed some minor problems in KA/Pi + KO/Pi.
34 36
35Fixed a crash when closing PwM/Pi. 37Fixed a crash when closing PwM/Pi.
36Added German translation for PwM/Pi. 38Added German translation for PwM/Pi.
37 39
38Made view change and Month View update faster in KO/Pi. 40Made view change and Month View update faster in KO/Pi.
39 41
40 42
41********** VERSION 1.9.18 ************ 43********** VERSION 1.9.18 ************
42 44
43FYI: The VERSION 1.9.17 was a testing release only. 45FYI: The VERSION 1.9.17 was a testing release only.
44Please read the changelog of VERSION 1.9.17 as well. 46Please read the changelog of VERSION 1.9.17 as well.
45 47
46Cleaned up the syncing config dialog. 48Cleaned up the syncing config dialog.
47Added sync config options for date range for events. 49Added sync config options for date range for events.
48Added sync config options for filters on incoming data. 50Added sync config options for filters on incoming data.
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp
index 342bbf3..2bae5f6 100644
--- a/kmicromail/koprefs.cpp
+++ b/kmicromail/koprefs.cpp
@@ -41,48 +41,49 @@
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kemailsettings.h> 42#include <kemailsettings.h>
43#include <kstaticdeleter.h> 43#include <kstaticdeleter.h>
44 44
45#include "koprefs.h" 45#include "koprefs.h"
46#include "mainwindow.h" 46#include "mainwindow.h"
47 47
48 48
49KOPrefs *KOPrefs::mInstance = 0; 49KOPrefs *KOPrefs::mInstance = 0;
50static KStaticDeleter<KOPrefs> insd; 50static KStaticDeleter<KOPrefs> insd;
51 51
52KOPrefs::KOPrefs() : 52KOPrefs::KOPrefs() :
53 KPimPrefs("kopiemailrc") 53 KPimPrefs("kopiemailrc")
54{ 54{
55 mAppFont = QFont("helvetica",12); 55 mAppFont = QFont("helvetica",12);
56 mComposeFont = QFont("helvetica",12); 56 mComposeFont = QFont("helvetica",12);
57 mReadFont = QFont("helvetica",12); 57 mReadFont = QFont("helvetica",12);
58 58
59 KPrefs::setCurrentGroup("General"); 59 KPrefs::setCurrentGroup("General");
60 addItemString("SendCodec",&mSendCodec,i18n ("userdefined") ); 60 addItemString("SendCodec",&mSendCodec,i18n ("userdefined") );
61 addItemString("SenderName",&mName,i18n ("Please set at") ); 61 addItemString("SenderName",&mName,i18n ("Please set at") );
62 addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); 62 addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") );
63 addItemBool("ViewMailAsHtml",&mViewAsHtml,false); 63 addItemBool("ViewMailAsHtml",&mViewAsHtml,false);
64 addItemBool("SendMailLater",&mSendLater,true); 64 addItemBool("SendMailLater",&mSendLater,true);
65 addItemBool("ShowToField",&mShowToField,false);
65 addItemBool("UseKapi",&mUseKapi,false); 66 addItemBool("UseKapi",&mUseKapi,false);
66 addItemInt("CurrentCodec",&mCurrentCodec,0); 67 addItemInt("CurrentCodec",&mCurrentCodec,0);
67 68
68 KPrefs::setCurrentGroup("Fonts"); 69 KPrefs::setCurrentGroup("Fonts");
69 addItemFont("Application Font",&mAppFont); 70 addItemFont("Application Font",&mAppFont);
70 addItemFont("Compose Font",&mComposeFont); 71 addItemFont("Compose Font",&mComposeFont);
71 addItemFont("Read Font",&mReadFont); 72 addItemFont("Read Font",&mReadFont);
72 fillMailDefaults(); 73 fillMailDefaults();
73 isDirty = false; 74 isDirty = false;
74} 75}
75 76
76 77
77KOPrefs::~KOPrefs() 78KOPrefs::~KOPrefs()
78{ 79{
79 if ( isDirty ) 80 if ( isDirty )
80 writeConfig(); 81 writeConfig();
81 if (mInstance == this) 82 if (mInstance == this)
82 mInstance = insd.setObject(0); 83 mInstance = insd.setObject(0);
83 84
84} 85}
85 86
86 87
87KOPrefs *KOPrefs::instance() 88KOPrefs *KOPrefs::instance()
88{ 89{
diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h
index 91f3fa3..f2c4fbb 100644
--- a/kmicromail/koprefs.h
+++ b/kmicromail/koprefs.h
@@ -51,30 +51,30 @@ class KOPrefs : public KPimPrefs
51 void setCategoryDefaults(){;}; 51 void setCategoryDefaults(){;};
52 52
53 protected: 53 protected:
54 54
55 /** Fill empty mail fields with default values. */ 55 /** Fill empty mail fields with default values. */
56 void fillMailDefaults(); 56 void fillMailDefaults();
57 57
58 private: 58 private:
59 /** Constructor disabled for public. Use instance() to create a KOPrefs 59 /** Constructor disabled for public. Use instance() to create a KOPrefs
60 object. */ 60 object. */
61 KOPrefs(); 61 KOPrefs();
62 62
63 static KOPrefs *mInstance; 63 static KOPrefs *mInstance;
64 public: 64 public:
65 // preferences data 65 // preferences data
66 KConfig* getConfig(); 66 KConfig* getConfig();
67 QFont mAppFont; 67 QFont mAppFont;
68 QFont mComposeFont; 68 QFont mComposeFont;
69 QFont mReadFont; 69 QFont mReadFont;
70 QString mName; 70 QString mName;
71 QString mSendCodec; 71 QString mSendCodec;
72 QString mEmail; 72 QString mEmail;
73 QString mCurrentCodeName; 73 QString mCurrentCodeName;
74 int mCurrentCodec; 74 int mCurrentCodec;
75 bool mSendLater, mViewAsHtml, mUseKapi, isDirty; 75 bool mSendLater, mViewAsHtml, mUseKapi, isDirty, mShowToField;
76 private: 76 private:
77 77
78}; 78};
79 79
80#endif 80#endif
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp
index 13d6681..5c8a5a9 100644
--- a/kmicromail/koprefsdialog.cpp
+++ b/kmicromail/koprefsdialog.cpp
@@ -126,48 +126,51 @@ void KOPrefsDialog::setupMainTab()
126 topLayout->addWidget(mEmailEdit,1,1); 126 topLayout->addWidget(mEmailEdit,1,1);
127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); 127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame);
128 topLayout->addMultiCellWidget(lab,2,2,0,1); 128 topLayout->addMultiCellWidget(lab,2,2,0,1);
129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), 129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"),
130 &(KOPrefs::instance()->mUseKapi),topFrame); 130 &(KOPrefs::instance()->mUseKapi),topFrame);
131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); 131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1);
132} 132}
133 133
134void KOPrefsDialog::setupMailTab() 134void KOPrefsDialog::setupMailTab()
135{ 135{
136 QFrame *topFrame = addPage(i18n("Mail"),0,0); 136 QFrame *topFrame = addPage(i18n("Mail"),0,0);
137 137
138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
139 topLayout->setSpacing(spacingHint()); 139 topLayout->setSpacing(spacingHint());
140 topLayout->setMargin(marginHint()); 140 topLayout->setMargin(marginHint());
141 141
142 KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), 142 KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"),
143 &(KOPrefs::instance()->mViewAsHtml),topFrame); 143 &(KOPrefs::instance()->mViewAsHtml),topFrame);
144 topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); 144 topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1);
145 145
146 146
147 ttt = addWidBool(i18n("Send mails later"), 147 ttt = addWidBool(i18n("Send mails later"),
148 &(KOPrefs::instance()->mSendLater),topFrame); 148 &(KOPrefs::instance()->mSendLater),topFrame);
149 topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); 149 topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1);
150 ttt = addWidBool(i18n("Show \"To\" field in list view"),
151 &(KOPrefs::instance()->mShowToField),topFrame);
152 topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1);
150 /* 153 /*
151 mCodecEdit = new QLineEdit(topFrame); 154 mCodecEdit = new QLineEdit(topFrame);
152 topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1); 155 topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1);
153 topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1); 156 topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1);
154 topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); 157 topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1);
155 */ 158 */
156} 159}
157void KOPrefsDialog::setupFontsTab() 160void KOPrefsDialog::setupFontsTab()
158{ 161{
159 162
160 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 163 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
161 // DesktopIcon("fonts",KIcon::SizeMedium)); 164 // DesktopIcon("fonts",KIcon::SizeMedium));
162 165
163 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 166 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
164 topLayout->setSpacing(1); 167 topLayout->setSpacing(1);
165 topLayout->setMargin(3); 168 topLayout->setMargin(3);
166 KPrefsDialogWidFont * tVFont; 169 KPrefsDialogWidFont * tVFont;
167 int i = 0; 170 int i = 0;
168 KPrefsDialogWidFont *timeLabelsFont = 171 KPrefsDialogWidFont *timeLabelsFont =
169 addWidFont(i18n("OK"),i18n("Application(nr)"), 172 addWidFont(i18n("OK"),i18n("Application(nr)"),
170 &(KOPrefs::instance()->mAppFont),topFrame); 173 &(KOPrefs::instance()->mAppFont),topFrame);
171 topLayout->addWidget(timeLabelsFont->label(),i,0); 174 topLayout->addWidget(timeLabelsFont->label(),i,0);
172 topLayout->addWidget(timeLabelsFont->preview(),i,1); 175 topLayout->addWidget(timeLabelsFont->preview(),i,1);
173 topLayout->addWidget(timeLabelsFont->button(),i,2); 176 topLayout->addWidget(timeLabelsFont->button(),i,2);
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 484a635..ffb835c 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -1,29 +1,30 @@
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 <qpe/resource.h> 7//#include <qpe/resource.h>
7 8
8MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 9MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
9 :QListViewItem(parent,item),mail_data() 10 :QListViewItem(parent,item),mail_data()
10{ 11{
11} 12}
12 13
13void MailListViewItem::showEntry() 14void MailListViewItem::showEntry()
14{ 15{
15 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { 16 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
16 setPixmap( 0, SmallIcon ( "kmmsgreplied") ); 17 setPixmap( 0, SmallIcon ( "kmmsgreplied") );
17 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { 18 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
18 /* I think it looks nicer if there are not such a log of icons but only on mails 19 /* I think it looks nicer if there are not such a log of icons but only on mails
19 replied or new - Alwin*/ 20 replied or new - Alwin*/
20 //setPixmap( 0,SmallIcon ("kmmsgunseen") ); 21 //setPixmap( 0,SmallIcon ("kmmsgunseen") );
21 } else { 22 } else {
22 setPixmap( 0,SmallIcon ( "kmmsgnew") ); 23 setPixmap( 0,SmallIcon ( "kmmsgnew") );
23 } 24 }
24 double s = mail_data->Msgsize(); 25 double s = mail_data->Msgsize();
25 int w = 0; 26 int w = 0;
26 s/=1024; 27 s/=1024;
27 if (s>999.0) { 28 if (s>999.0) {
28 s/=1024.0; 29 s/=1024.0;
29 ++w; 30 ++w;
@@ -36,96 +37,52 @@ void MailListViewItem::showEntry()
36 // 111.23 37 // 111.23
37 // 999.23 maxlen 38 // 999.23 maxlen
38 switch(fsize.length() ) { 39 switch(fsize.length() ) {
39 case 4: 40 case 4:
40 fsort = "00" + fsize ; 41 fsort = "00" + fsize ;
41 break; 42 break;
42 case 5: 43 case 5:
43 fsort = "0" + fsize ; 44 fsort = "0" + fsize ;
44 break; 45 break;
45 default: 46 default:
46 fsort = fsize ; 47 fsort = fsize ;
47 break; 48 break;
48 49
49 } 50 }
50 if ( w == 0 ) { 51 if ( w == 0 ) {
51 setText(3, fsize + "kB" ); 52 setText(3, fsize + "kB" );
52 mKeyMap.insert(3, "k" + fsort); 53 mKeyMap.insert(3, "k" + fsort);
53 //setText(3, "kB" + fsort ); // test only 54 //setText(3, "kB" + fsort ); // test only
54 } else { 55 } else {
55 //setText(3, fsize + "MB"); 56 //setText(3, fsize + "MB");
56 mKeyMap.insert(3, "M" +fsort ); 57 mKeyMap.insert(3, "M" +fsort );
57 } 58 }
58 setText(1,mail_data->getSubject()); 59 setText(1,mail_data->getSubject());
59 setText(2,mail_data->getFrom()); 60 setText(2,mail_data->getFrom());
60#if 0
61 QString date = mail_data->getDate();
62
63 int kom = date.find( ",")+2;
64 if ( kom == 1 )
65 kom = 0;
66 if ( date.mid(kom,1) == " ")
67 ++kom;
68 if ( date.mid(kom+1,1) == " " )
69 date = "0" + date.mid( kom );
70 else if ( kom )
71 date = date.mid( kom );
72 if ( kom || date.mid(2,1 ) == " ") {
73 QString mon = date.mid(3,3);
74 QString so = 00;
75 if ( mon == "Jan" )
76 so = "01";
77 else if ( mon == "Feb" )
78 so = "02";
79 else if ( mon == "Mar" )
80 so = "03";
81 else if ( mon == "Apr" )
82 so = "04";
83 else if ( mon == "May" )
84 so = "05";
85 else if ( mon == "Jun" )
86 so = "06";
87 else if ( mon == "Jul" )
88 so = "07";
89 else if ( mon == "Aug" )
90 so = "08";
91 else if ( mon == "Sep" )
92 so = "09";
93 else if ( mon == "Oct" )
94 so = "10";
95 else if ( mon == "Nov" )
96 so = "11";
97 else if ( mon == "Dec" )
98 so = "12";
99 date = date.mid(7,4)+so+date.left(2)+date.mid(12,14);
100 }
101 //qDebug("insert Date %s ", date.latin1());
102 // if ( date.left(1) != "1" || date.left(1) != "2" )
103 // date = date.mid(5);
104 mKeyMap.insert(4,date);
105#endif
106 mKeyMap.insert(4,mail_data->getIsoDate()); 61 mKeyMap.insert(4,mail_data->getIsoDate());
107 setText(4,mail_data->getDate()); 62 setText(4,mail_data->getDate());
63 if ( KOPrefs::instance()->mShowToField )
64 setText(5,mail_data->To()[0]);
108} 65}
109 66
110void MailListViewItem::storeData(const RecMailP&data) 67void MailListViewItem::storeData(const RecMailP&data)
111{ 68{
112 mail_data = data; 69 mail_data = data;
113} 70}
114void MailListViewItem::setSortKey(int column,const QString &key) 71void MailListViewItem::setSortKey(int column,const QString &key)
115{ 72{
116 mKeyMap.insert(column,key); 73 mKeyMap.insert(column,key);
117} 74}
118QString MailListViewItem::key(int column, bool) const 75QString MailListViewItem::key(int column, bool) const
119{ 76{
120 // to make is fast, we use here special cases 77 // to make is fast, we use here special cases
121 if ( column == 3 || column == 4 ) { 78 if ( column == 3 || column == 4 ) {
122 return *mKeyMap.find(column); 79 return *mKeyMap.find(column);
123 } 80 }
124 if ( column == 1 ) { 81 if ( column == 1 ) {
125 if ( text(1).left(4).lower() == "re: " ) 82 if ( text(1).left(4).lower() == "re: " )
126 return text(1).mid(4); 83 return text(1).mid(4);
127 84
128 } 85 }
129 return text(column); 86 return text(column);
130 /* 87 /*
131 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 88 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 1dc374b..875ab77 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -112,48 +112,50 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
112 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); 112 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu);
113 //setCentralWidget( view ); 113 //setCentralWidget( view );
114 114
115 QVBox* wrapperBox = new QVBox( this ); 115 QVBox* wrapperBox = new QVBox( this );
116 setCentralWidget( wrapperBox ); 116 setCentralWidget( wrapperBox );
117 117
118 // QWidget *view = new QWidget( wrapperBox ); 118 // QWidget *view = new QWidget( wrapperBox );
119 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 119 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
120 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 120 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
121 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 121 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
122 122
123 folderView = new AccountView( split ); 123 folderView = new AccountView( split );
124 folderView->header()->hide(); 124 folderView->header()->hide();
125 folderView->setRootIsDecorated( false ); 125 folderView->setRootIsDecorated( false );
126 folderView->addColumn( i18n( "Mailbox" ) ); 126 folderView->addColumn( i18n( "Mailbox" ) );
127 127
128 //layout->addWidget( folderView ); 128 //layout->addWidget( folderView );
129 129
130 mailView = new QListView( split ); 130 mailView = new QListView( split );
131 mailView->addColumn( i18n( " " ) ); 131 mailView->addColumn( i18n( " " ) );
132 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 132 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
133 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 133 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
134 mailView->addColumn( i18n( "Size" ),QListView::Manual); 134 mailView->addColumn( i18n( "Size" ),QListView::Manual);
135 mailView->addColumn( i18n( "Date" ),QListView::Manual); 135 mailView->addColumn( i18n( "Date" ),QListView::Manual);
136 if ( KOPrefs::instance()->mShowToField )
137 mailView->addColumn( i18n( "To" ),QListView::Manual);
136 mailView->setAllColumnsShowFocus(true); 138 mailView->setAllColumnsShowFocus(true);
137 //mailView->setSorting(-1); 139 //mailView->setSorting(-1);
138 mailView->setRootIsDecorated( false ); 140 mailView->setRootIsDecorated( false );
139 statusWidget = new StatusWidget( wrapperBox ); 141 statusWidget = new StatusWidget( wrapperBox );
140 statusWidget->hide(); 142 statusWidget->hide();
141 143
142 //layout->addWidget( mailView ); 144 //layout->addWidget( mailView );
143 //layout->setStretchFactor( folderView, 1 ); 145 //layout->setStretchFactor( folderView, 1 );
144 //layout->setStretchFactor( mailView, 2 ); 146 //layout->setStretchFactor( mailView, 2 );
145 147
146 slotAdjustLayout(); 148 slotAdjustLayout();
147#ifndef DESKTOP_VERSION 149#ifndef DESKTOP_VERSION
148 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 150 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
149 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 151 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
150#endif 152#endif
151 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 153 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
152 SLOT( mailLeftClicked(QListViewItem*) ) ); 154 SLOT( mailLeftClicked(QListViewItem*) ) );
153 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 155 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
154 SLOT( mailLeftClicked(QListViewItem*) ) ); 156 SLOT( mailLeftClicked(QListViewItem*) ) );
155 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 157 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
156 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 158 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
157 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 159 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
158 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 160 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
159 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 161 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
@@ -282,48 +284,50 @@ void MainWindow::slotAdjustLayout() {
282 284
283 /* 285 /*
284 QWidget *d = QApplication::desktop(); 286 QWidget *d = QApplication::desktop();
285 287
286 if ( d->width() < d->height() ) { 288 if ( d->width() < d->height() ) {
287 layout->setDirection( QBoxLayout::TopToBottom ); 289 layout->setDirection( QBoxLayout::TopToBottom );
288 } else { 290 } else {
289 layout->setDirection( QBoxLayout::LeftToRight ); 291 layout->setDirection( QBoxLayout::LeftToRight );
290 } 292 }
291 */ 293 */
292} 294}
293 295
294void MainWindow::slotAdjustColumns() 296void MainWindow::slotAdjustColumns()
295{ 297{
296 bool hidden = folderView->isHidden(); 298 bool hidden = folderView->isHidden();
297 if ( hidden ) folderView->show(); 299 if ( hidden ) folderView->show();
298 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 300 folderView->setColumnWidth( 0, folderView->visibleWidth() );
299 if ( hidden ) folderView->hide(); 301 if ( hidden ) folderView->hide();
300 302
301 mailView->setColumnWidth( 0, 10 ); 303 mailView->setColumnWidth( 0, 10 );
302 mailView->setColumnWidth( 1, 100 ); 304 mailView->setColumnWidth( 1, 100 );
303 mailView->setColumnWidth( 2, 100 ); 305 mailView->setColumnWidth( 2, 100 );
304 mailView->setColumnWidth( 3, 50 ); 306 mailView->setColumnWidth( 3, 50 );
305 mailView->setColumnWidth( 4, 120 ); 307 mailView->setColumnWidth( 4, 120 );
308 if ( KOPrefs::instance()->mShowToField )
309 mailView->setColumnWidth( 5, 100 );
306} 310}
307 311
308void MainWindow::slotEditSettings() 312void MainWindow::slotEditSettings()
309{ 313{
310} 314}
311 315
312void MainWindow::slotShowFolders( bool ) 316void MainWindow::slotShowFolders( bool )
313{ 317{
314 qDebug("not implemented: "); 318 qDebug("not implemented: ");
315} 319}
316 320
317void MainWindow::refreshMailView(const QValueList<RecMailP>&) 321void MainWindow::refreshMailView(const QValueList<RecMailP>&)
318{ 322{
319 qDebug("not implemented: "); 323 qDebug("not implemented: ");
320} 324}
321 325
322void MainWindow::mailLeftClicked(QListViewItem * ) 326void MainWindow::mailLeftClicked(QListViewItem * )
323{ 327{
324 qDebug("not implemented: "); 328 qDebug("not implemented: ");
325} 329}
326 330
327void MainWindow::displayMail() 331void MainWindow::displayMail()
328{ 332{
329 qDebug("not implemented: "); 333 qDebug("not implemented: ");
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 915b3e8..6e54bf4 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,76 +1,83 @@
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
5#define protected public
6#include <qwidget.h>
7#undef protected
4#include "koprefsdialog.h" 8#include "koprefsdialog.h"
5#include <kapplication.h> 9#include <kapplication.h>
6#include <libkdepim/externalapphandler.h> 10#include <libkdepim/externalapphandler.h>
7#include <libkdepim/kpimglobalprefs.h> 11#include <libkdepim/kpimglobalprefs.h>
8#ifdef MINIKDE_KDIALOG_H 12#ifdef MINIKDE_KDIALOG_H
9#undef MINIKDE_KDIALOG_H 13#undef MINIKDE_KDIALOG_H
10#endif 14#endif
11#include "settingsdialog.h" 15#include "settingsdialog.h"
12#include "opiemail.h" 16#include "opiemail.h"
13#include "editaccounts.h" 17#include "editaccounts.h"
14#include "composemail.h" 18#include "composemail.h"
15#include "mailistviewitem.h" 19#include "mailistviewitem.h"
16#include "viewmail.h" 20#include "viewmail.h"
17#include "selectstore.h" 21#include "selectstore.h"
18#include "selectsmtp.h" 22#include "selectsmtp.h"
19#include "accountitem.h" 23#include "accountitem.h"
20#include "klocale.h" 24#include "klocale.h"
21 25
22#include <qmessagebox.h> 26#include <qmessagebox.h>
23#include <qtimer.h> 27#include <qtimer.h>
24#include <qcursor.h> 28#include <qcursor.h>
29#include <qtextbrowser.h>
25#include <qregexp.h> 30#include <qregexp.h>
26#include <qpe/global.h> 31#include <qpe/global.h>
27 32
28#ifdef DESKTOP_VERSION 33#ifdef DESKTOP_VERSION
29#include <qapplication.h> 34#include <qapplication.h>
30#else 35#else
31#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
32#endif 37#endif
33#include <libmailwrapper/smtpwrapper.h> 38#include <libmailwrapper/smtpwrapper.h>
34#include <libmailwrapper/mailtypes.h> 39#include <libmailwrapper/mailtypes.h>
35#include <libmailwrapper/abstractmail.h> 40#include <libmailwrapper/abstractmail.h>
36#include "koprefs.h" 41#include "koprefs.h"
37 42
38//using namespace Opie::Core; 43//using namespace Opie::Core;
39 44
40OpieMail::OpieMail( QWidget *parent, const char *name ) 45OpieMail::OpieMail( QWidget *parent, const char *name )
41 : MainWindow( parent, name) //, WStyle_ContextHelp ) 46 : MainWindow( parent, name) //, WStyle_ContextHelp )
42{ 47{
43 settings = new Settings(); 48 settings = new Settings();
44 49 tb = 0;
45 setIcon(SmallIcon( "kmicromail" ) ); 50 setIcon(SmallIcon( "kmicromail" ) );
46 folderView->populate( settings->getAccounts() ); 51 folderView->populate( settings->getAccounts() );
47 52
48} 53}
49 54
50OpieMail::~OpieMail() 55OpieMail::~OpieMail()
51{ 56{
52 if (settings) delete settings; 57 if (settings) delete settings;
58 if ( tb )
59 delete tb;
53} 60}
54 61
55void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 62void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
56{ 63{
57 64
58} 65}
59#include <stdlib.h> 66#include <stdlib.h>
60void OpieMail::message(const QCString &msg, const QByteArray &data) 67void OpieMail::message(const QCString &msg, const QByteArray &data)
61{ 68{
62 // copied from old mail2 69 // copied from old mail2
63 static int ii = 0; 70 static int ii = 0;
64 //qDebug("QCOP CALL ############################# %d ", ii); 71 //qDebug("QCOP CALL ############################# %d ", ii);
65 //QString mess ( msg ); 72 //QString mess ( msg );
66 //qDebug("Message = %s ",mess.latin1()); 73 //qDebug("Message = %s ",mess.latin1());
67 ++ii; 74 ++ii;
68 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 75 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
69 76
70 mPendingEmail = QString::null; 77 mPendingEmail = QString::null;
71 mPendingName = QString::null; 78 mPendingName = QString::null;
72 if (msg == "writeMail(QString,QString)") 79 if (msg == "writeMail(QString,QString)")
73 { 80 {
74 //qDebug("writeMail(QString,QString) "); 81 //qDebug("writeMail(QString,QString) ");
75 QDataStream stream(data,IO_ReadOnly); 82 QDataStream stream(data,IO_ReadOnly);
76 stream >> mPendingName >> mPendingEmail; 83 stream >> mPendingName >> mPendingEmail;
@@ -282,48 +289,55 @@ void OpieMail::replyMail()
282 else prefix = "Re: "; // no i18n on purpose 289 else prefix = "Re: "; // no i18n on purpose
283 290
284 Settings *settings = new Settings(); 291 Settings *settings = new Settings();
285 ComposeMail composer( settings ,this, 0, true); 292 ComposeMail composer( settings ,this, 0, true);
286 if (mail->Replyto().isEmpty()) { 293 if (mail->Replyto().isEmpty()) {
287 composer.setTo( mail->getFrom()); 294 composer.setTo( mail->getFrom());
288 } else { 295 } else {
289 composer.setTo( mail->Replyto()); 296 composer.setTo( mail->Replyto());
290 } 297 }
291 composer.setSubject( prefix + mail->getSubject()); 298 composer.setSubject( prefix + mail->getSubject());
292 composer.setMessage( rtext ); 299 composer.setMessage( rtext );
293 composer.setInReplyTo( mail->Msgid()); 300 composer.setInReplyTo( mail->Msgid());
294 composer.setCharset( body->getCharset() ); 301 composer.setCharset( body->getCharset() );
295 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 302 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
296 { 303 {
297 mail->Wrapper()->answeredMail(mail); 304 mail->Wrapper()->answeredMail(mail);
298 } 305 }
299 delete settings; 306 delete settings;
300 307
301} 308}
302void OpieMail::closeViewMail(ViewMail * vm) 309void OpieMail::closeViewMail(ViewMail * vm)
303{ 310{
304 vm->hide(); 311 vm->hide();
305} 312}
313
314void OpieMail::slotDownloadMail( )
315{
316 qDebug("slotDownloadMail( ) ");
317}
318
319
306void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) 320void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
307{ 321{
308 QListViewItem*item = mailView->currentItem(); 322 QListViewItem*item = mailView->currentItem();
309 if (!item ) { 323 if (!item ) {
310 closeViewMail(vm); 324 closeViewMail(vm);
311 return; 325 return;
312 } 326 }
313 RecMailP mail = ((MailListViewItem*)item)->data(); 327 RecMailP mail = ((MailListViewItem*)item)->data();
314 mail->Wrapper()->deleteMail( mail ); 328 mail->Wrapper()->deleteMail( mail );
315 item = item->itemBelow(); 329 item = item->itemBelow();
316 if (!item ) { 330 if (!item ) {
317 closeViewMail(vm); 331 closeViewMail(vm);
318 return; 332 return;
319 } 333 }
320 mailView->setCurrentItem(item); 334 mailView->setCurrentItem(item);
321 mail = ((MailListViewItem*)item)->data(); 335 mail = ((MailListViewItem*)item)->data();
322 RecBodyP body = folderView->fetchBody(mail); 336 RecBodyP body = folderView->fetchBody(mail);
323 vm->setBody( body ); 337 vm->setBody( body );
324 vm->setMail( mail ); 338 vm->setMail( mail );
325} 339}
326void OpieMail::displayNextMail(ViewMail * vm) 340void OpieMail::displayNextMail(ViewMail * vm)
327{ 341{
328 QListViewItem*item = mailView->currentItem(); 342 QListViewItem*item = mailView->currentItem();
329 if (!item) return; 343 if (!item) return;
@@ -334,48 +348,49 @@ void OpieMail::displayNextMail(ViewMail * vm)
334 return; 348 return;
335 } 349 }
336 mailView->setCurrentItem(item); 350 mailView->setCurrentItem(item);
337 RecMailP mail = ((MailListViewItem*)item)->data(); 351 RecMailP mail = ((MailListViewItem*)item)->data();
338 RecBodyP body = folderView->fetchBody(mail); 352 RecBodyP body = folderView->fetchBody(mail);
339 vm->setBody( body ); 353 vm->setBody( body );
340 vm->setMail( mail ); 354 vm->setMail( mail );
341} 355}
342void OpieMail::displayMail() 356void OpieMail::displayMail()
343{ 357{
344 QListViewItem*item = mailView->currentItem(); 358 QListViewItem*item = mailView->currentItem();
345 if (!item) return; 359 if (!item) return;
346 RecMailP mail = ((MailListViewItem*)item)->data(); 360 RecMailP mail = ((MailListViewItem*)item)->data();
347 RecBodyP body = folderView->fetchBody(mail); 361 RecBodyP body = folderView->fetchBody(mail);
348 ViewMail readMail( this,"", Qt::WType_Modal ); 362 ViewMail readMail( this,"", Qt::WType_Modal );
349 readMail.setBody( body ); 363 readMail.setBody( body );
350 readMail.setMail( mail ); 364 readMail.setMail( mail );
351#ifndef DESKTOP_VERSION 365#ifndef DESKTOP_VERSION
352 readMail.showMaximized(); 366 readMail.showMaximized();
353#else 367#else
354 readMail.resize( 640, 480); 368 readMail.resize( 640, 480);
355#endif 369#endif
356 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); 370 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
357 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); 371 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
372 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
358 373
359 readMail.exec(); 374 readMail.exec();
360 375
361 if ( readMail.deleted ) 376 if ( readMail.deleted )
362 { 377 {
363 folderView->refreshCurrent(); 378 folderView->refreshCurrent();
364 } 379 }
365 else 380 else
366 { 381 {
367 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 382 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
368 } 383 }
369} 384}
370void OpieMail::slotGetAllMail() 385void OpieMail::slotGetAllMail()
371{ 386{
372 QListViewItem * item = folderView->firstChild(); 387 QListViewItem * item = folderView->firstChild();
373 while ( item ){ 388 while ( item ){
374 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 389 ((AccountViewItem *)item)->contextMenuSelected( 101 );
375 item = item->nextSibling (); 390 item = item->nextSibling ();
376 } 391 }
377} 392}
378void OpieMail::slotGetMail() 393void OpieMail::slotGetMail()
379{ 394{
380 QListViewItem * item = folderView->currentItem(); 395 QListViewItem * item = folderView->currentItem();
381 if ( ! item ) return; 396 if ( ! item ) return;
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index a81a34c..b8a527f 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -25,36 +25,37 @@ public slots:
25 virtual void slotExtAppHandler(); 25 virtual void slotExtAppHandler();
26 virtual void appMessage(const QCString &msg, const QByteArray &data); 26 virtual void appMessage(const QCString &msg, const QByteArray &data);
27 virtual void message(const QCString &msg, const QByteArray &data); 27 virtual void message(const QCString &msg, const QByteArray &data);
28protected slots: 28protected slots:
29 virtual void deleteAndDisplayNextMail(ViewMail * vm); 29 virtual void deleteAndDisplayNextMail(ViewMail * vm);
30 virtual void displayNextMail(ViewMail * vm); 30 virtual void displayNextMail(ViewMail * vm);
31 virtual void slotSendQueued(); 31 virtual void slotSendQueued();
32 virtual void slotSearchMails(); 32 virtual void slotSearchMails();
33 virtual void slotEditSettings(); 33 virtual void slotEditSettings();
34 virtual void slotEditAccounts(); 34 virtual void slotEditAccounts();
35 virtual void displayMail(); 35 virtual void displayMail();
36 virtual void replyMail(); 36 virtual void replyMail();
37 virtual void slotDeleteMail(); 37 virtual void slotDeleteMail();
38 virtual void slotGetMail(); 38 virtual void slotGetMail();
39 virtual void slotGetAllMail(); 39 virtual void slotGetAllMail();
40 virtual void slotDeleteAllMail(); 40 virtual void slotDeleteAllMail();
41 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 41 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
42 virtual void slotShowFolders( bool show ); 42 virtual void slotShowFolders( bool show );
43 virtual void refreshMailView(const QValueList<RecMailP>&); 43 virtual void refreshMailView(const QValueList<RecMailP>&);
44 virtual void mailLeftClicked( QListViewItem * ); 44 virtual void mailLeftClicked( QListViewItem * );
45 virtual void slotMoveCopyMail(); 45 virtual void slotMoveCopyMail();
46 virtual void slotMoveCopyAllMail(); 46 virtual void slotMoveCopyAllMail();
47 virtual void reEditMail(); 47 virtual void reEditMail();
48 void clearSelection(); 48 void clearSelection();
49 49 void slotDownloadMail();
50private: 50private:
51 void closeViewMail(ViewMail * vm); 51 void closeViewMail(ViewMail * vm);
52 QString mPendingEmail; 52 QString mPendingEmail;
53 QString mPendingName; 53 QString mPendingName;
54 QByteArray mPendingData; 54 QByteArray mPendingData;
55 QCString mPendingMessage; 55 QCString mPendingMessage;
56 Settings *settings; 56 Settings *settings;
57 QTextBrowser * tb;
57 58
58}; 59};
59 60
60#endif 61#endif
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 6d88cad..767a369 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -182,48 +182,66 @@ void ViewMail::setBody(const RecBodyP&body )
182 break; 182 break;
183 } 183 }
184 QTextOStream o(&fsize); 184 QTextOStream o(&fsize);
185 if (w>0) o.precision(2); else o.precision(0); 185 if (w>0) o.precision(2); else o.precision(0);
186 o.setf(QTextStream::fixed); 186 o.setf(QTextStream::fixed);
187 o << s << " " << q << "Byte"; 187 o << s << " " << q << "Byte";
188 desc = body->Parts()[i]->Description(); 188 desc = body->Parts()[i]->Description();
189 parentItem = searchParent(body->Parts()[i]->Positionlist()); 189 parentItem = searchParent(body->Parts()[i]->Positionlist());
190 if (parentItem) 190 if (parentItem)
191 { 191 {
192 AttachItem*temp = lastChild(parentItem); 192 AttachItem*temp = lastChild(parentItem);
193 if (temp) curItem = temp; 193 if (temp) curItem = temp;
194 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 194 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
195 attachments->setRootIsDecorated(true); 195 attachments->setRootIsDecorated(true);
196 curItem = parentItem; 196 curItem = parentItem;
197 } 197 }
198 else 198 else
199 { 199 {
200 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 200 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
201 } 201 }
202 } 202 }
203} 203}
204 204
205 205
206void ViewMail::slotViewSource()
207{
208
209 if ( !sourceOn ) {
210 sourceOn = true;
211 viewSource->setText(i18n("View Body Text"));
212 encodedString*st = 0;
213 st = m_recMail->Wrapper()->fetchRawBody(m_recMail);
214 if ( st ) {
215 QString source = QString::fromUtf8( st->Content(), st->Length());
216 browser->setText( source );
217 delete st;
218 }
219 } else
220 setText();
221
222
223}
206void ViewMail::slotShowHtml( bool state ) 224void ViewMail::slotShowHtml( bool state )
207{ 225{
208 m_showHtml = state; 226 m_showHtml = state;
209 setText(); 227 setText();
210} 228}
211 229
212void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) 230void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
213{ 231{
214 if (!item ) 232 if (!item )
215 return; 233 return;
216 234
217 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 235 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
218 { 236 {
219 setText(); 237 setText();
220 return; 238 return;
221 } 239 }
222 QPopupMenu *menu = new QPopupMenu(); 240 QPopupMenu *menu = new QPopupMenu();
223 int ret=0; 241 int ret=0;
224 242
225 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 243 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
226 { 244 {
227 menu->insertItem( i18n( "Show Text" ), 1 ); 245 menu->insertItem( i18n( "Show Text" ), 1 );
228 } 246 }
229 if (item->text(0).left(6)=="image/") { 247 if (item->text(0).left(6)=="image/") {
@@ -299,74 +317,78 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
299void ViewMail::setMail(const RecMailP&mail ) 317void ViewMail::setMail(const RecMailP&mail )
300{ 318{
301 319
302 m_recMail = mail; 320 m_recMail = mail;
303 321
304 m_mail[0] = mail->getFrom(); 322 m_mail[0] = mail->getFrom();
305 m_mail[1] = mail->getSubject(); 323 m_mail[1] = mail->getSubject();
306 m_mail[3] = mail->getDate(); 324 m_mail[3] = mail->getDate();
307 m_mail[4] = mail->Msgid(); 325 m_mail[4] = mail->Msgid();
308 326
309 m_mail2[0] = mail->To(); 327 m_mail2[0] = mail->To();
310 m_mail2[1] = mail->CC(); 328 m_mail2[1] = mail->CC();
311 m_mail2[2] = mail->Bcc(); 329 m_mail2[2] = mail->Bcc();
312 330
313 setText(); 331 setText();
314} 332}
315 333
316 334
317 335
318ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 336ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
319 : ViewMailBase(parent, name, fl), _inLoop(false) 337 : ViewMailBase(parent, name, fl), _inLoop(false)
320{ 338{
321 m_gotBody = false; 339 m_gotBody = false;
322 deleted = false; 340 deleted = false;
323 341 sourceOn = false;
324 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 342 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
325 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 343 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
326 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 344 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
327 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 345 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
328 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 346 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
329 connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); 347 connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) );
348 connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) );
349 connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) );
330 350
331 attachments->setEnabled(m_gotBody); 351 attachments->setEnabled(m_gotBody);
332 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 352 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
333 353
334 readConfig(); 354 readConfig();
335 attachments->setSorting(-1); 355 attachments->setSorting(-1);
336} 356}
337 357
338void ViewMail::readConfig() 358void ViewMail::readConfig()
339{ 359{
340 360
341 setFont ( KOPrefs::instance()->mReadFont ); 361 setFont ( KOPrefs::instance()->mReadFont );
342 m_showHtml = KOPrefs::instance()->mViewAsHtml; 362 m_showHtml = KOPrefs::instance()->mViewAsHtml;
343 showHtml->setOn( m_showHtml ); 363 showHtml->setOn( m_showHtml );
344} 364}
345 365
346void ViewMail::setText() 366void ViewMail::setText()
347{ 367{
348 368
369 viewSource->setText(i18n("View Source"));
370 sourceOn = false;
349 QString toString; 371 QString toString;
350 QString ccString; 372 QString ccString;
351 QString bccString; 373 QString bccString;
352 374
353 375
354 toString = m_mail2[0].join(","); 376 toString = m_mail2[0].join(",");
355 ccString = m_mail2[1].join(","); 377 ccString = m_mail2[1].join(",");
356 bccString = m_mail2[2].join(","); 378 bccString = m_mail2[2].join(",");
357 379
358 380
359 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); 381 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) );
360 382
361 m_mailHtml = "<html><body>" 383 m_mailHtml = "<html><body>"
362 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 384 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
363 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 385 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
364 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 386 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
365 "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 387 "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
366 "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 388 "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
367 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 389 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
368 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + 390 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] +
369 "</td></tr></table><font>"; 391 "</td></tr></table><font>";
370 392
371 if ( !m_showHtml ) 393 if ( !m_showHtml )
372 { 394 {
@@ -511,24 +533,25 @@ void ViewMail::slotDeleteMail( )
511 //hide(); 533 //hide();
512 deleted = true; 534 deleted = true;
513 } 535 }
514} 536}
515 537
516MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) 538MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
517 : QDialog(parent,name,modal) 539 : QDialog(parent,name,modal)
518{ 540{
519 QVBoxLayout*dlglayout = new QVBoxLayout(this); 541 QVBoxLayout*dlglayout = new QVBoxLayout(this);
520 dlglayout->setSpacing(2); 542 dlglayout->setSpacing(2);
521 dlglayout->setMargin(1); 543 dlglayout->setMargin(1);
522 //m_imageview = new Opie::MM::OImageScrollView(this); 544 //m_imageview = new Opie::MM::OImageScrollView(this);
523 //dlglayout->addWidget(m_imageview); 545 //dlglayout->addWidget(m_imageview);
524} 546}
525 547
526MailImageDlg::~MailImageDlg() 548MailImageDlg::~MailImageDlg()
527{ 549{
528} 550}
529 551
530void MailImageDlg::setName(const QString&fname) 552void MailImageDlg::setName(const QString&fname)
531{ 553{
532 qDebug("viewmail.cpp: MailImageDlg::setName Pending"); 554 qDebug("viewmail.cpp: MailImageDlg::setName Pending");
533 // m_imageview->setImage(fname); 555 // m_imageview->setImage(fname);
534} 556}
557
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h
index d85b8b2..561989e 100644
--- a/kmicromail/viewmail.h
+++ b/kmicromail/viewmail.h
@@ -24,65 +24,67 @@ public:
24 bool isParentof(const QValueList<int>&path); 24 bool isParentof(const QValueList<int>&path);
25 25
26private: 26private:
27 int _partNum; 27 int _partNum;
28 /* needed for a better display of attachments */ 28 /* needed for a better display of attachments */
29 QValueList<int> _path; 29 QValueList<int> _path;
30}; 30};
31 31
32class ViewMail : public ViewMailBase 32class ViewMail : public ViewMailBase
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36public: 36public:
37 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 37 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
38 ~ViewMail(); 38 ~ViewMail();
39 39
40 void hide(); 40 void hide();
41 void exec(); 41 void exec();
42 void setMail(const RecMailP&mail ); 42 void setMail(const RecMailP&mail );
43 void setBody(const RecBodyP&body); 43 void setBody(const RecBodyP&body);
44 bool deleted; 44 bool deleted;
45 signals: 45 signals:
46 void showNextMail(ViewMail*); 46 void showNextMail(ViewMail*);
47 void deleteAndDisplayNextMail(ViewMail *); 47 void deleteAndDisplayNextMail(ViewMail *);
48 void signalDownloadMail();
48protected: 49protected:
49 QString deHtml(const QString &string); 50 QString deHtml(const QString &string);
50 AttachItem* searchParent(const QValueList<int>&path); 51 AttachItem* searchParent(const QValueList<int>&path);
51 AttachItem* lastChild(AttachItem*parent); 52 AttachItem* lastChild(AttachItem*parent);
52 53
53protected slots: 54protected slots:
54 void slotNextMail() { emit showNextMail(this); }; 55 void slotNextMail() { emit showNextMail(this); };
55 void slotReply(); 56 void slotReply();
56 void slotForward(); 57 void slotForward();
57 void setText(); 58 void setText();
58 void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); 59 void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
59 void slotDeleteMail( ); 60 void slotDeleteMail( );
60 void slotShowHtml( bool ); 61 void slotShowHtml( bool );
62 void slotViewSource();
61 63
62private: 64private:
63 void readConfig(); 65 void readConfig();
64 66 bool sourceOn;;
65 bool _inLoop; 67 bool _inLoop;
66 QString m_mailHtml; 68 QString m_mailHtml;
67 bool m_gotBody; 69 bool m_gotBody;
68 RecBodyP m_body; 70 RecBodyP m_body;
69 RecMailP m_recMail; 71 RecMailP m_recMail;
70 bool m_showHtml; 72 bool m_showHtml;
71 73
72 // 0 from 1 subject 2 bodytext 3 date 74 // 0 from 1 subject 2 bodytext 3 date
73 QMap <int,QString> m_mail; 75 QMap <int,QString> m_mail;
74 // 0 to 1 cc 2 bcc 76 // 0 to 1 cc 2 bcc
75 QMap <int,QStringList> m_mail2; 77 QMap <int,QStringList> m_mail2;
76}; 78};
77 79
78class MailImageDlg:public QDialog 80class MailImageDlg:public QDialog
79{ 81{
80 Q_OBJECT 82 Q_OBJECT
81public: 83public:
82 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); 84 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0);
83 ~MailImageDlg(); 85 ~MailImageDlg();
84 void setName(const QString&); 86 void setName(const QString&);
85protected: 87protected:
86 //Opie::MM::OImageScrollView*m_imageview; 88 //Opie::MM::OImageScrollView*m_imageview;
87}; 89};
88 90
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp
index d21696a..9365c23 100644
--- a/kmicromail/viewmailbase.cpp
+++ b/kmicromail/viewmailbase.cpp
@@ -7,48 +7,56 @@
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);
32 viewSource->addTo(mailmenu);
33
34 downloadMail= new QAction(i18n("Download Mail"),SmallIcon("add"), 0, 0, this);
35 downloadMail->addTo(toolbar);
36 downloadMail->addTo(mailmenu);
37
38
31 reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this); 39 reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this);
32 reply->addTo(toolbar); 40 reply->addTo(toolbar);
33 reply->addTo(mailmenu); 41 reply->addTo(mailmenu);
34 42
35 forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this); 43 forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this);
36 forward->addTo(toolbar); 44 forward->addTo(toolbar);
37 forward->addTo(mailmenu); 45 forward->addTo(mailmenu);
38 46
39 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);
40 attachbutton->addTo(toolbar); 48 attachbutton->addTo(toolbar);
41 attachbutton->addTo(mailmenu); 49 attachbutton->addTo(mailmenu);
42 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); 50 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
43 51
44 52
45 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 );
46 showHtml->addTo( toolbar ); 54 showHtml->addTo( toolbar );
47 showHtml->addTo( mailmenu ); 55 showHtml->addTo( mailmenu );
48 56
49 deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this); 57 deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this);
50 deleteMail->addTo(toolbar); 58 deleteMail->addTo(toolbar);
51 deleteMail->addTo(mailmenu); 59 deleteMail->addTo(mailmenu);
52 60
53 61
54 62
diff --git a/kmicromail/viewmailbase.h b/kmicromail/viewmailbase.h
index c97e9e3..7ad1eec 100644
--- a/kmicromail/viewmailbase.h
+++ b/kmicromail/viewmailbase.h
@@ -1,39 +1,39 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#ifndef VIEWMAILBASE_H 2#ifndef VIEWMAILBASE_H
3#define VIEWMAILBASE_H 3#define VIEWMAILBASE_H
4 4
5#include <qmainwindow.h> 5#include <qmainwindow.h>
6 6
7class QAction; 7class QAction;
8class OpenDiag; 8class OpenDiag;
9class QListView; 9class QListView;
10class QToolBar; 10class QToolBar;
11class QTextBrowser; 11class QTextBrowser;
12class QMenuBar; 12class QMenuBar;
13class QPopupMenu; 13class QPopupMenu;
14 14
15class ViewMailBase : public QMainWindow 15class ViewMailBase : public QMainWindow
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18 18
19public: 19public:
20 ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 20 ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
21 21
22protected: 22protected:
23 QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail; 23 QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail, *downloadMail, *viewSource;
24 QListView *attachments; 24 QListView *attachments;
25 QToolBar *toolbar; 25 QToolBar *toolbar;
26 QTextBrowser *browser; 26 QTextBrowser *browser;
27 OpenDiag *openDiag; 27 OpenDiag *openDiag;
28 QMenuBar *menubar; 28 QMenuBar *menubar;
29 QPopupMenu *mailmenu; 29 QPopupMenu *mailmenu;
30 30
31protected slots: 31protected slots:
32 void slotChangeAttachview(bool state); 32 void slotChangeAttachview(bool state);
33 virtual void keyPressEvent ( QKeyEvent * e ); 33 virtual void keyPressEvent ( QKeyEvent * e );
34 34
35 35
36}; 36};
37 37
38#endif 38#endif
39 39