-rw-r--r-- | kmicromail/koprefs.cpp | 1 | ||||
-rw-r--r-- | kmicromail/koprefs.h | 2 | ||||
-rw-r--r-- | kmicromail/koprefsdialog.cpp | 3 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 49 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 4 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 17 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 3 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 25 | ||||
-rw-r--r-- | kmicromail/viewmail.h | 4 | ||||
-rw-r--r-- | kmicromail/viewmailbase.cpp | 8 | ||||
-rw-r--r-- | kmicromail/viewmailbase.h | 2 |
11 files changed, 66 insertions, 52 deletions
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp index 342bbf3..2bae5f6 100644 --- a/kmicromail/koprefs.cpp +++ b/kmicromail/koprefs.cpp | |||
@@ -17,96 +17,97 @@ | |||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
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 | ||
49 | KOPrefs *KOPrefs::mInstance = 0; | 49 | KOPrefs *KOPrefs::mInstance = 0; |
50 | static KStaticDeleter<KOPrefs> insd; | 50 | static KStaticDeleter<KOPrefs> insd; |
51 | 51 | ||
52 | KOPrefs::KOPrefs() : | 52 | KOPrefs::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 | ||
77 | KOPrefs::~KOPrefs() | 78 | KOPrefs::~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 | ||
87 | KOPrefs *KOPrefs::instance() | 88 | KOPrefs *KOPrefs::instance() |
88 | { | 89 | { |
89 | if (!mInstance) { | 90 | if (!mInstance) { |
90 | mInstance = insd.setObject(new KOPrefs()); | 91 | mInstance = insd.setObject(new KOPrefs()); |
91 | mInstance->readConfig(); | 92 | mInstance->readConfig(); |
92 | } | 93 | } |
93 | 94 | ||
94 | return mInstance; | 95 | return mInstance; |
95 | } | 96 | } |
96 | 97 | ||
97 | void KOPrefs::usrSetDefaults() | 98 | void KOPrefs::usrSetDefaults() |
98 | { | 99 | { |
99 | 100 | ||
100 | } | 101 | } |
101 | 102 | ||
102 | void KOPrefs::fillMailDefaults() | 103 | void KOPrefs::fillMailDefaults() |
103 | { | 104 | { |
104 | if (mName.isEmpty()) mName = i18n ("Please set at"); | 105 | if (mName.isEmpty()) mName = i18n ("Please set at"); |
105 | if (mEmail.isEmpty()) mEmail = i18n ("Settings@General TAB"); | 106 | if (mEmail.isEmpty()) mEmail = i18n ("Settings@General TAB"); |
106 | } | 107 | } |
107 | 108 | ||
108 | void KOPrefs::usrReadConfig() | 109 | void KOPrefs::usrReadConfig() |
109 | { | 110 | { |
110 | 111 | ||
111 | KPimPrefs::usrReadConfig(); | 112 | KPimPrefs::usrReadConfig(); |
112 | } | 113 | } |
diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h index 91f3fa3..f2c4fbb 100644 --- a/kmicromail/koprefs.h +++ b/kmicromail/koprefs.h | |||
@@ -27,54 +27,54 @@ | |||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | 28 | ||
29 | class KConfig; | 29 | class KConfig; |
30 | class QFont; | 30 | class QFont; |
31 | class QColor; | 31 | class QColor; |
32 | class QStringList; | 32 | class QStringList; |
33 | 33 | ||
34 | class KOPrefs : public KPimPrefs | 34 | class KOPrefs : public KPimPrefs |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | virtual ~KOPrefs(); | 37 | virtual ~KOPrefs(); |
38 | 38 | ||
39 | /** Get instance of KOPrefs. It is made sure that there is only one | 39 | /** Get instance of KOPrefs. It is made sure that there is only one |
40 | instance. */ | 40 | instance. */ |
41 | static KOPrefs *instance(); | 41 | static KOPrefs *instance(); |
42 | 42 | ||
43 | /** Set preferences to default values */ | 43 | /** Set preferences to default values */ |
44 | void usrSetDefaults(); | 44 | void usrSetDefaults(); |
45 | 45 | ||
46 | /** Read preferences from config file */ | 46 | /** Read preferences from config file */ |
47 | void usrReadConfig(); | 47 | void usrReadConfig(); |
48 | 48 | ||
49 | /** Write preferences to config file */ | 49 | /** Write preferences to config file */ |
50 | void usrWriteConfig(); | 50 | void usrWriteConfig(); |
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 | |||
@@ -102,96 +102,99 @@ void KOPrefsDialog::setupGlobalTab() | |||
102 | QFrame *topFrame = addPage(i18n("Global"),0,0); | 102 | QFrame *topFrame = addPage(i18n("Global"),0,0); |
103 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); | 103 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); |
104 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | 104 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); |
105 | topLayout->addWidget( kdelibcfg ); | 105 | topLayout->addWidget( kdelibcfg ); |
106 | 106 | ||
107 | 107 | ||
108 | } | 108 | } |
109 | void KOPrefsDialog::setupMainTab() | 109 | void KOPrefsDialog::setupMainTab() |
110 | { | 110 | { |
111 | QFrame *topFrame = addPage(i18n("General"),0,0); | 111 | QFrame *topFrame = addPage(i18n("General"),0,0); |
112 | 112 | ||
113 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 113 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
114 | topLayout->setSpacing(spacingHint()); | 114 | topLayout->setSpacing(spacingHint()); |
115 | topLayout->setMargin(marginHint()); | 115 | topLayout->setMargin(marginHint()); |
116 | 116 | ||
117 | 117 | ||
118 | mNameEdit = new QLineEdit(topFrame); | 118 | mNameEdit = new QLineEdit(topFrame); |
119 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | 119 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); |
120 | topLayout->addWidget(mNameLabel,0,0); | 120 | topLayout->addWidget(mNameLabel,0,0); |
121 | topLayout->addWidget(mNameEdit,0,1); | 121 | topLayout->addWidget(mNameEdit,0,1); |
122 | 122 | ||
123 | mEmailEdit = new QLineEdit(topFrame); | 123 | mEmailEdit = new QLineEdit(topFrame); |
124 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | 124 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); |
125 | topLayout->addWidget(mEmailLabel,1,0); | 125 | topLayout->addWidget(mEmailLabel,1,0); |
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 | ||
134 | void KOPrefsDialog::setupMailTab() | 134 | void 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 | } |
157 | void KOPrefsDialog::setupFontsTab() | 160 | void 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); |
174 | ++i; | 177 | ++i; |
175 | 178 | ||
176 | 179 | ||
177 | timeLabelsFont = | 180 | timeLabelsFont = |
178 | addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), | 181 | addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), |
179 | &(KOPrefs::instance()->mComposeFont),topFrame); | 182 | &(KOPrefs::instance()->mComposeFont),topFrame); |
180 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 183 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
181 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 184 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
182 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 185 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
183 | ++i; | 186 | ++i; |
184 | 187 | ||
185 | KPrefsDialogWidFont *timeBarFont = | 188 | KPrefsDialogWidFont *timeBarFont = |
186 | addWidFont(i18n("Hello"),i18n("Read mail:"), | 189 | addWidFont(i18n("Hello"),i18n("Read mail:"), |
187 | &(KOPrefs::instance()->mReadFont),topFrame); | 190 | &(KOPrefs::instance()->mReadFont),topFrame); |
188 | topLayout->addWidget(timeBarFont->label(),i,0); | 191 | topLayout->addWidget(timeBarFont->label(),i,0); |
189 | topLayout->addWidget(timeBarFont->preview(),i,1); | 192 | topLayout->addWidget(timeBarFont->preview(),i,1); |
190 | topLayout->addWidget(timeBarFont->button(),i,2); | 193 | topLayout->addWidget(timeBarFont->button(),i,2); |
191 | ++i; | 194 | ++i; |
192 | 195 | ||
193 | topLayout->setColStretch(1,1); | 196 | topLayout->setColStretch(1,1); |
194 | topLayout->setRowStretch(4,1); | 197 | topLayout->setRowStretch(4,1); |
195 | 198 | ||
196 | } | 199 | } |
197 | void KOPrefsDialog::usrReadConfig() | 200 | void KOPrefsDialog::usrReadConfig() |
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 484a635..ffb835c 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -1,146 +1,103 @@ | |||
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 | ||
8 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 9 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
9 | :QListViewItem(parent,item),mail_data() | 10 | :QListViewItem(parent,item),mail_data() |
10 | { | 11 | { |
11 | } | 12 | } |
12 | 13 | ||
13 | void MailListViewItem::showEntry() | 14 | void 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; |
30 | } | 31 | } |
31 | QString fsort; | 32 | QString fsort; |
32 | fsort.sprintf( "%.2f", s ); | 33 | fsort.sprintf( "%.2f", s ); |
33 | QString fsize = QString::number( s, 'f', 2 ); | 34 | QString fsize = QString::number( s, 'f', 2 ); |
34 | // 1.23 | 35 | // 1.23 |
35 | // 11.23 | 36 | // 11.23 |
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 | ||
110 | void MailListViewItem::storeData(const RecMailP&data) | 67 | void MailListViewItem::storeData(const RecMailP&data) |
111 | { | 68 | { |
112 | mail_data = data; | 69 | mail_data = data; |
113 | } | 70 | } |
114 | void MailListViewItem::setSortKey(int column,const QString &key) | 71 | void MailListViewItem::setSortKey(int column,const QString &key) |
115 | { | 72 | { |
116 | mKeyMap.insert(column,key); | 73 | mKeyMap.insert(column,key); |
117 | } | 74 | } |
118 | QString MailListViewItem::key(int column, bool) const | 75 | QString 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); |
132 | if (it == mKeyMap.end()) return text(column); | 89 | if (it == mKeyMap.end()) return text(column); |
133 | else return *it; | 90 | else return *it; |
134 | */ | 91 | */ |
135 | } | 92 | } |
136 | 93 | ||
137 | const RecMailP& MailListViewItem::data()const | 94 | const RecMailP& MailListViewItem::data()const |
138 | { | 95 | { |
139 | return mail_data; | 96 | return mail_data; |
140 | } | 97 | } |
141 | 98 | ||
142 | MAILLIB::ATYPE MailListViewItem::wrapperType() | 99 | MAILLIB::ATYPE MailListViewItem::wrapperType() |
143 | { | 100 | { |
144 | if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; | 101 | if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; |
145 | return mail_data->Wrapper()->getType(); | 102 | return mail_data->Wrapper()->getType(); |
146 | } | 103 | } |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 1dc374b..875ab77 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -88,96 +88,98 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
88 | */ | 88 | */ |
89 | 89 | ||
90 | deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 90 | deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
91 | deleteMails->addTo( toolBar ); | 91 | deleteMails->addTo( toolBar ); |
92 | deleteMails->addTo( mailMenu ); | 92 | deleteMails->addTo( mailMenu ); |
93 | connect( deleteMails, SIGNAL( activated() ), | 93 | connect( deleteMails, SIGNAL( activated() ), |
94 | SLOT( slotDeleteAllMail() ) ); | 94 | SLOT( slotDeleteAllMail() ) ); |
95 | 95 | ||
96 | editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , | 96 | editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , |
97 | 0, 0, this ); | 97 | 0, 0, this ); |
98 | editSettings->addTo( settingsMenu ); | 98 | editSettings->addTo( settingsMenu ); |
99 | connect( editSettings, SIGNAL( activated() ), | 99 | connect( editSettings, SIGNAL( activated() ), |
100 | SLOT( slotEditSettings() ) ); | 100 | SLOT( slotEditSettings() ) ); |
101 | editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , | 101 | editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , |
102 | 0, 0, this ); | 102 | 0, 0, this ); |
103 | editAccounts->addTo( settingsMenu ); | 103 | editAccounts->addTo( settingsMenu ); |
104 | codecMenu = new QPopupMenu( menuBar ); | 104 | codecMenu = new QPopupMenu( menuBar ); |
105 | codecMenu->insertItem( "Western (iso-8859-1)",0,0); | 105 | codecMenu->insertItem( "Western (iso-8859-1)",0,0); |
106 | codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); | 106 | codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); |
107 | codecMenu->insertItem( "Western (iso-8859-15)",2,2); | 107 | codecMenu->insertItem( "Western (iso-8859-15)",2,2); |
108 | codecMenu->insertItem( "Chinese (big-5)",3,3); | 108 | codecMenu->insertItem( "Chinese (big-5)",3,3); |
109 | codecMenu->insertItem( "Unicode (utf-8)",4,4); | 109 | codecMenu->insertItem( "Unicode (utf-8)",4,4); |
110 | codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); | 110 | codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); |
111 | //disabled | 111 | //disabled |
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() ) ); |
160 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 162 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
161 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 163 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
162 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 164 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
163 | //mailView->setMultiSelection ( true ); | 165 | //mailView->setMultiSelection ( true ); |
164 | mailView->setSelectionMode( QListView::Extended ); | 166 | mailView->setSelectionMode( QListView::Extended ); |
165 | QValueList<int> list; | 167 | QValueList<int> list; |
166 | int fw = 100; | 168 | int fw = 100; |
167 | if ( QApplication::desktop()->width() > 320 ) | 169 | if ( QApplication::desktop()->width() > 320 ) |
168 | fw = 50; | 170 | fw = 50; |
169 | list.append( fw ); | 171 | list.append( fw ); |
170 | list.append( 100 ); | 172 | list.append( 100 ); |
171 | split->setSizes( list ); | 173 | split->setSizes( list ); |
172 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 174 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
173 | mailView->setShowSortIndicator ( true ); | 175 | mailView->setShowSortIndicator ( true ); |
174 | QLabel *spacer = new QLabel( toolBar ); | 176 | QLabel *spacer = new QLabel( toolBar ); |
175 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 177 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
176 | toolBar->setStretchableWidget( spacer ); | 178 | toolBar->setStretchableWidget( spacer ); |
177 | 179 | ||
178 | QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); | 180 | QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); |
179 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 181 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
180 | if ( QApplication::desktop()->width() > 320 ) | 182 | if ( QApplication::desktop()->width() > 320 ) |
181 | closeMail->addTo(toolBar); | 183 | closeMail->addTo(toolBar); |
182 | closeMail->addTo(mailMenu); | 184 | closeMail->addTo(mailMenu); |
183 | 185 | ||
@@ -258,96 +260,98 @@ void MainWindow::showAbout() | |||
258 | 260 | ||
259 | 261 | ||
260 | "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" | 262 | "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" |
261 | "KOpieMail/Pi is based on Opie Mail\n" | 263 | "KOpieMail/Pi is based on Opie Mail\n" |
262 | "Copyright (c) Rajko Albrecht and the Opie team\n" | 264 | "Copyright (c) Rajko Albrecht and the Opie team\n" |
263 | "KOpieMail/Pi is licensed under the GPL\n" | 265 | "KOpieMail/Pi is licensed under the GPL\n" |
264 | "\n" | 266 | "\n" |
265 | "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" | 267 | "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" |
266 | "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" | 268 | "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" |
267 | "libEtPan has its own licence - see LibEtPan licence\n"; | 269 | "libEtPan has its own licence - see LibEtPan licence\n"; |
268 | 270 | ||
269 | KApplication::showText( cap, text ); | 271 | KApplication::showText( cap, text ); |
270 | } | 272 | } |
271 | void MainWindow::showEtpanLicence() | 273 | void MainWindow::showEtpanLicence() |
272 | { | 274 | { |
273 | KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); | 275 | KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); |
274 | 276 | ||
275 | } | 277 | } |
276 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 278 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
277 | { | 279 | { |
278 | qDebug("appMessage implemented by subclass"); | 280 | qDebug("appMessage implemented by subclass"); |
279 | } | 281 | } |
280 | 282 | ||
281 | void MainWindow::slotAdjustLayout() { | 283 | 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 | ||
294 | void MainWindow::slotAdjustColumns() | 296 | void 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 | ||
308 | void MainWindow::slotEditSettings() | 312 | void MainWindow::slotEditSettings() |
309 | { | 313 | { |
310 | } | 314 | } |
311 | 315 | ||
312 | void MainWindow::slotShowFolders( bool ) | 316 | void MainWindow::slotShowFolders( bool ) |
313 | { | 317 | { |
314 | qDebug("not implemented: "); | 318 | qDebug("not implemented: "); |
315 | } | 319 | } |
316 | 320 | ||
317 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) | 321 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) |
318 | { | 322 | { |
319 | qDebug("not implemented: "); | 323 | qDebug("not implemented: "); |
320 | } | 324 | } |
321 | 325 | ||
322 | void MainWindow::mailLeftClicked(QListViewItem * ) | 326 | void MainWindow::mailLeftClicked(QListViewItem * ) |
323 | { | 327 | { |
324 | qDebug("not implemented: "); | 328 | qDebug("not implemented: "); |
325 | } | 329 | } |
326 | 330 | ||
327 | void MainWindow::displayMail() | 331 | void MainWindow::displayMail() |
328 | { | 332 | { |
329 | qDebug("not implemented: "); | 333 | qDebug("not implemented: "); |
330 | } | 334 | } |
331 | 335 | ||
332 | void MainWindow::slotDeleteMail() | 336 | void MainWindow::slotDeleteMail() |
333 | { | 337 | { |
334 | qDebug("not implemented: "); | 338 | qDebug("not implemented: "); |
335 | } | 339 | } |
336 | 340 | ||
337 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 341 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) |
338 | { | 342 | { |
339 | qDebug("not implemented: "); | 343 | qDebug("not implemented: "); |
340 | } | 344 | } |
341 | 345 | ||
342 | void MainWindow::slotSendQueued() | 346 | void MainWindow::slotSendQueued() |
343 | { | 347 | { |
344 | qDebug("not implemented: "); | 348 | qDebug("not implemented: "); |
345 | } | 349 | } |
346 | 350 | ||
347 | void MainWindow::slotEditAccounts() | 351 | void MainWindow::slotEditAccounts() |
348 | { | 352 | { |
349 | qDebug("not implemented: "); | 353 | qDebug("not implemented: "); |
350 | } | 354 | } |
351 | 355 | ||
352 | void MainWindow::slotComposeMail() | 356 | void MainWindow::slotComposeMail() |
353 | { | 357 | { |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 915b3e8..6e54bf4 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,100 +1,107 @@ | |||
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 | ||
40 | OpieMail::OpieMail( QWidget *parent, const char *name ) | 45 | OpieMail::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 | ||
50 | OpieMail::~OpieMail() | 55 | OpieMail::~OpieMail() |
51 | { | 56 | { |
52 | if (settings) delete settings; | 57 | if (settings) delete settings; |
58 | if ( tb ) | ||
59 | delete tb; | ||
53 | } | 60 | } |
54 | 61 | ||
55 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 62 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
56 | { | 63 | { |
57 | 64 | ||
58 | } | 65 | } |
59 | #include <stdlib.h> | 66 | #include <stdlib.h> |
60 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 67 | void 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; |
77 | // removing the whitespaces at beginning and end is needed! | 84 | // removing the whitespaces at beginning and end is needed! |
78 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 85 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
79 | } | 86 | } |
80 | else if (msg == "newMail()") | 87 | else if (msg == "newMail()") |
81 | { | 88 | { |
82 | //qDebug("slotComposeMail() "); | 89 | //qDebug("slotComposeMail() "); |
83 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call | 90 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call |
84 | // and a QCOP call does not like a processevents in his execution | 91 | // and a QCOP call does not like a processevents in his execution |
85 | // with the Qtimer we call slotComposeMail() after we reached the main event loop | 92 | // with the Qtimer we call slotComposeMail() after we reached the main event loop |
86 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 93 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
87 | // slotComposeMail(); | 94 | // slotComposeMail(); |
88 | } | 95 | } |
89 | else if (msg == "newMail(QString)") | 96 | else if (msg == "newMail(QString)") |
90 | { | 97 | { |
91 | //qDebug(" newMail(QString)"); | 98 | //qDebug(" newMail(QString)"); |
92 | QDataStream stream(data,IO_ReadOnly); | 99 | QDataStream stream(data,IO_ReadOnly); |
93 | stream >> mPendingName; | 100 | stream >> mPendingName; |
94 | // the format is | 101 | // the format is |
95 | // NAME <EMAIL>:SUBJECT | 102 | // NAME <EMAIL>:SUBJECT |
96 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 103 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
97 | } else { | 104 | } else { |
98 | mPendingData = data; | 105 | mPendingData = data; |
99 | mPendingMessage = msg; | 106 | mPendingMessage = msg; |
100 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); | 107 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); |
@@ -258,148 +265,156 @@ void OpieMail::slotEditAccounts() | |||
258 | void OpieMail::replyMail() | 265 | void OpieMail::replyMail() |
259 | { | 266 | { |
260 | 267 | ||
261 | QListViewItem*item = mailView->currentItem(); | 268 | QListViewItem*item = mailView->currentItem(); |
262 | if (!item) return; | 269 | if (!item) return; |
263 | RecMailP mail = ((MailListViewItem*)item)->data(); | 270 | RecMailP mail = ((MailListViewItem*)item)->data(); |
264 | RecBodyP body = folderView->fetchBody(mail); | 271 | RecBodyP body = folderView->fetchBody(mail); |
265 | 272 | ||
266 | QString rtext; | 273 | QString rtext; |
267 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 274 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
268 | .arg( mail->getFrom()) | 275 | .arg( mail->getFrom()) |
269 | .arg( mail->getDate()); | 276 | .arg( mail->getDate()); |
270 | 277 | ||
271 | QString text = body->Bodytext(); | 278 | QString text = body->Bodytext(); |
272 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 279 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
273 | QStringList::Iterator it; | 280 | QStringList::Iterator it; |
274 | for (it = lines.begin(); it != lines.end(); it++) | 281 | for (it = lines.begin(); it != lines.end(); it++) |
275 | { | 282 | { |
276 | rtext += "> " + *it + "\n"; | 283 | rtext += "> " + *it + "\n"; |
277 | } | 284 | } |
278 | rtext += "\n"; | 285 | rtext += "\n"; |
279 | 286 | ||
280 | QString prefix; | 287 | QString prefix; |
281 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 288 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
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 | } |
302 | void OpieMail::closeViewMail(ViewMail * vm) | 309 | void OpieMail::closeViewMail(ViewMail * vm) |
303 | { | 310 | { |
304 | vm->hide(); | 311 | vm->hide(); |
305 | } | 312 | } |
313 | |||
314 | void OpieMail::slotDownloadMail( ) | ||
315 | { | ||
316 | qDebug("slotDownloadMail( ) "); | ||
317 | } | ||
318 | |||
319 | |||
306 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) | 320 | void 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 | } |
326 | void OpieMail::displayNextMail(ViewMail * vm) | 340 | void OpieMail::displayNextMail(ViewMail * vm) |
327 | { | 341 | { |
328 | QListViewItem*item = mailView->currentItem(); | 342 | QListViewItem*item = mailView->currentItem(); |
329 | if (!item) return; | 343 | if (!item) return; |
330 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 344 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
331 | item = item->itemBelow(); | 345 | item = item->itemBelow(); |
332 | if (!item) { | 346 | if (!item) { |
333 | vm->setCaption(i18n("End of List" )); | 347 | vm->setCaption(i18n("End of List" )); |
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 | } |
342 | void OpieMail::displayMail() | 356 | void 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 | } |
370 | void OpieMail::slotGetAllMail() | 385 | void 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 | } |
378 | void OpieMail::slotGetMail() | 393 | void OpieMail::slotGetMail() |
379 | { | 394 | { |
380 | QListViewItem * item = folderView->currentItem(); | 395 | QListViewItem * item = folderView->currentItem(); |
381 | if ( ! item ) return; | 396 | if ( ! item ) return; |
382 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 397 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
383 | } | 398 | } |
384 | void OpieMail::slotDeleteMail() | 399 | void OpieMail::slotDeleteMail() |
385 | { | 400 | { |
386 | if (!mailView->currentItem()) return; | 401 | if (!mailView->currentItem()) return; |
387 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 402 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
388 | 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 ) | 403 | 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 ) |
389 | { | 404 | { |
390 | mail->Wrapper()->deleteMail( mail ); | 405 | mail->Wrapper()->deleteMail( mail ); |
391 | folderView->refreshCurrent(); | 406 | folderView->refreshCurrent(); |
392 | } | 407 | } |
393 | } | 408 | } |
394 | void OpieMail::slotDeleteAllMail() | 409 | void OpieMail::slotDeleteAllMail() |
395 | { | 410 | { |
396 | 411 | ||
397 | QValueList<RecMailP> t; | 412 | QValueList<RecMailP> t; |
398 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 413 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
399 | { | 414 | { |
400 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 415 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
401 | while ( item ) { | 416 | while ( item ) { |
402 | if ( item->isSelected() ) { | 417 | if ( item->isSelected() ) { |
403 | t.append( item->data() ); | 418 | t.append( item->data() ); |
404 | } | 419 | } |
405 | item = (MailListViewItem*)item->nextSibling(); | 420 | item = (MailListViewItem*)item->nextSibling(); |
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index a81a34c..b8a527f 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h | |||
@@ -1,60 +1,61 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef OPIEMAIL_H | 2 | #ifndef OPIEMAIL_H |
3 | #define OPIEMAIL_H | 3 | #define OPIEMAIL_H |
4 | 4 | ||
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | 7 | ||
8 | #include <opie2/osmartpointer.h> | 8 | #include <opie2/osmartpointer.h> |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | #include <viewmail.h> | 10 | #include <viewmail.h> |
11 | 11 | ||
12 | class OpieMail : public MainWindow | 12 | class OpieMail : public MainWindow |
13 | { | 13 | { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | OpieMail( QWidget *parent = 0, const char *name = 0 ); | 17 | OpieMail( QWidget *parent = 0, const char *name = 0 ); |
18 | virtual ~OpieMail(); | 18 | virtual ~OpieMail(); |
19 | static QString appName() { return QString::fromLatin1("kopiemail"); } | 19 | static QString appName() { return QString::fromLatin1("kopiemail"); } |
20 | 20 | ||
21 | public slots: | 21 | public slots: |
22 | virtual void slotwriteMail(const QString&name,const QString&email); | 22 | virtual void slotwriteMail(const QString&name,const QString&email); |
23 | virtual void slotwriteMail2(const QString&nameemail); | 23 | virtual void slotwriteMail2(const QString&nameemail); |
24 | virtual void slotComposeMail(); | 24 | virtual void slotComposeMail(); |
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); |
28 | protected slots: | 28 | protected 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(); | |
50 | private: | 50 | private: |
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 | |||
@@ -158,96 +158,114 @@ void ViewMail::setBody(const RecBodyP&body ) | |||
158 | { | 158 | { |
159 | if (it.key().lower()=="name") | 159 | if (it.key().lower()=="name") |
160 | { | 160 | { |
161 | filename=it.data(); | 161 | filename=it.data(); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | s = body->Parts()[i]->Size(); | 164 | s = body->Parts()[i]->Size(); |
165 | w = 0; | 165 | w = 0; |
166 | while (s>1024) | 166 | while (s>1024) |
167 | { | 167 | { |
168 | s/=1024; | 168 | s/=1024; |
169 | ++w; | 169 | ++w; |
170 | if (w>=2) break; | 170 | if (w>=2) break; |
171 | } | 171 | } |
172 | switch(w) | 172 | switch(w) |
173 | { | 173 | { |
174 | case 1: | 174 | case 1: |
175 | q="k"; | 175 | q="k"; |
176 | break; | 176 | break; |
177 | case 2: | 177 | case 2: |
178 | q="M"; | 178 | q="M"; |
179 | break; | 179 | break; |
180 | default: | 180 | default: |
181 | q=""; | 181 | q=""; |
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 | ||
206 | void 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 | } | ||
206 | void ViewMail::slotShowHtml( bool state ) | 224 | void ViewMail::slotShowHtml( bool state ) |
207 | { | 225 | { |
208 | m_showHtml = state; | 226 | m_showHtml = state; |
209 | setText(); | 227 | setText(); |
210 | } | 228 | } |
211 | 229 | ||
212 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) | 230 | void 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/") { |
230 | menu->insertItem(i18n("Display image preview"),2); | 248 | menu->insertItem(i18n("Display image preview"),2); |
231 | } | 249 | } |
232 | menu->insertItem( i18n( "Save Attachment" ), 0 ); | 250 | menu->insertItem( i18n( "Save Attachment" ), 0 ); |
233 | menu->insertSeparator(1); | 251 | menu->insertSeparator(1); |
234 | 252 | ||
235 | ret = menu->exec( point, 0 ); | 253 | ret = menu->exec( point, 0 ); |
236 | 254 | ||
237 | switch(ret) | 255 | switch(ret) |
238 | { | 256 | { |
239 | case 0: | 257 | case 0: |
240 | { | 258 | { |
241 | //MimeTypes types; | 259 | //MimeTypes types; |
242 | //types.insert( "all", "*" ); | 260 | //types.insert( "all", "*" ); |
243 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); | 261 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); |
244 | 262 | ||
245 | if( !str.isEmpty() ) | 263 | if( !str.isEmpty() ) |
246 | { | 264 | { |
247 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 265 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
248 | if (content) | 266 | if (content) |
249 | { | 267 | { |
250 | QFile output(str); | 268 | QFile output(str); |
251 | output.open(IO_WriteOnly); | 269 | output.open(IO_WriteOnly); |
252 | output.writeBlock(content->Content(),content->Length()); | 270 | output.writeBlock(content->Content(),content->Length()); |
253 | output.close(); | 271 | output.close(); |
@@ -275,122 +293,126 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
275 | iview.setName(tmpfile); | 293 | iview.setName(tmpfile); |
276 | KApplication::execDialog(&iview); | 294 | KApplication::execDialog(&iview); |
277 | output.remove(); | 295 | output.remove(); |
278 | } | 296 | } |
279 | } | 297 | } |
280 | break; | 298 | break; |
281 | case 1: | 299 | case 1: |
282 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 300 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
283 | { | 301 | { |
284 | setText(); | 302 | setText(); |
285 | } | 303 | } |
286 | else | 304 | else |
287 | { | 305 | { |
288 | if ( m_recMail->Wrapper() != 0l ) | 306 | if ( m_recMail->Wrapper() != 0l ) |
289 | { // make sure that there is a wrapper , even after delete or simular actions | 307 | { // make sure that there is a wrapper , even after delete or simular actions |
290 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 308 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
291 | } | 309 | } |
292 | } | 310 | } |
293 | break; | 311 | break; |
294 | } | 312 | } |
295 | delete menu; | 313 | delete menu; |
296 | } | 314 | } |
297 | 315 | ||
298 | 316 | ||
299 | void ViewMail::setMail(const RecMailP&mail ) | 317 | void 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 | ||
318 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 336 | ViewMail::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 | ||
338 | void ViewMail::readConfig() | 358 | void 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 | ||
346 | void ViewMail::setText() | 366 | void 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 | { |
373 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); | 395 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); |
374 | } | 396 | } |
375 | else | 397 | else |
376 | { | 398 | { |
377 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | 399 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); |
378 | } | 400 | } |
379 | // remove later in favor of a real handling | 401 | // remove later in favor of a real handling |
380 | m_gotBody = true; | 402 | m_gotBody = true; |
381 | } | 403 | } |
382 | 404 | ||
383 | 405 | ||
384 | ViewMail::~ViewMail() | 406 | ViewMail::~ViewMail() |
385 | { | 407 | { |
386 | m_recMail->Wrapper()->cleanMimeCache(); | 408 | m_recMail->Wrapper()->cleanMimeCache(); |
387 | hide(); | 409 | hide(); |
388 | } | 410 | } |
389 | 411 | ||
390 | void ViewMail::hide() | 412 | void ViewMail::hide() |
391 | { | 413 | { |
392 | QWidget::hide(); | 414 | QWidget::hide(); |
393 | 415 | ||
394 | if (_inLoop) | 416 | if (_inLoop) |
395 | { | 417 | { |
396 | _inLoop = false; | 418 | _inLoop = false; |
@@ -487,48 +509,49 @@ void ViewMail::slotForward() | |||
487 | if (!m_mail[1].isNull()) | 509 | if (!m_mail[1].isNull()) |
488 | ftext += QString("Subject: %1\n") | 510 | ftext += QString("Subject: %1\n") |
489 | .arg( m_mail[1] ); | 511 | .arg( m_mail[1] ); |
490 | 512 | ||
491 | ftext += QString("\n%1\n") | 513 | ftext += QString("\n%1\n") |
492 | .arg( m_mail[2]); | 514 | .arg( m_mail[2]); |
493 | 515 | ||
494 | ftext += QString("----- End forwarded message -----\n"); | 516 | ftext += QString("----- End forwarded message -----\n"); |
495 | 517 | ||
496 | Settings *settings = new Settings(); | 518 | Settings *settings = new Settings(); |
497 | ComposeMail composer( settings ,this, 0, true); | 519 | ComposeMail composer( settings ,this, 0, true); |
498 | composer.setSubject( "Fwd: " + m_mail[1] ); | 520 | composer.setSubject( "Fwd: " + m_mail[1] ); |
499 | composer.setMessage( ftext ); | 521 | composer.setMessage( ftext ); |
500 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) | 522 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) |
501 | { | 523 | { |
502 | } | 524 | } |
503 | } | 525 | } |
504 | 526 | ||
505 | void ViewMail::slotDeleteMail( ) | 527 | void ViewMail::slotDeleteMail( ) |
506 | { | 528 | { |
507 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 529 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
508 | { | 530 | { |
509 | emit deleteAndDisplayNextMail( this); | 531 | emit deleteAndDisplayNextMail( this); |
510 | //m_recMail->Wrapper()->deleteMail( m_recMail ); | 532 | //m_recMail->Wrapper()->deleteMail( m_recMail ); |
511 | //hide(); | 533 | //hide(); |
512 | deleted = true; | 534 | deleted = true; |
513 | } | 535 | } |
514 | } | 536 | } |
515 | 537 | ||
516 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) | 538 | MailImageDlg::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 | ||
526 | MailImageDlg::~MailImageDlg() | 548 | MailImageDlg::~MailImageDlg() |
527 | { | 549 | { |
528 | } | 550 | } |
529 | 551 | ||
530 | void MailImageDlg::setName(const QString&fname) | 552 | void 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 | |||
@@ -1,89 +1,91 @@ | |||
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 | 8 | ||
9 | #include <qlistview.h> | 9 | #include <qlistview.h> |
10 | #include <qmap.h> | 10 | #include <qmap.h> |
11 | #include <qstringlist.h> | 11 | #include <qstringlist.h> |
12 | #include <qvaluelist.h> | 12 | #include <qvaluelist.h> |
13 | 13 | ||
14 | //namespace Opie { namespace MM { class OImageScrollView; } } | 14 | //namespace Opie { namespace MM { class OImageScrollView; } } |
15 | 15 | ||
16 | class AttachItem : public QListViewItem | 16 | class AttachItem : public QListViewItem |
17 | { | 17 | { |
18 | public: | 18 | public: |
19 | AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 19 | AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
20 | const QString&fsize,int num,const QValueList<int>&path); | 20 | const QString&fsize,int num,const QValueList<int>&path); |
21 | AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 21 | AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
22 | const QString&fsize,int num,const QValueList<int>&path); | 22 | const QString&fsize,int num,const QValueList<int>&path); |
23 | int Partnumber() { return _partNum; } | 23 | int Partnumber() { return _partNum; } |
24 | bool isParentof(const QValueList<int>&path); | 24 | bool isParentof(const QValueList<int>&path); |
25 | 25 | ||
26 | private: | 26 | private: |
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 | ||
32 | class ViewMail : public ViewMailBase | 32 | class ViewMail : public ViewMailBase |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
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(); | ||
48 | protected: | 49 | protected: |
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 | ||
53 | protected slots: | 54 | protected 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 | ||
62 | private: | 64 | private: |
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 | ||
78 | class MailImageDlg:public QDialog | 80 | class MailImageDlg:public QDialog |
79 | { | 81 | { |
80 | Q_OBJECT | 82 | Q_OBJECT |
81 | public: | 83 | public: |
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&); |
85 | protected: | 87 | protected: |
86 | //Opie::MM::OImageScrollView*m_imageview; | 88 | //Opie::MM::OImageScrollView*m_imageview; |
87 | }; | 89 | }; |
88 | 90 | ||
89 | #endif | 91 | #endif |
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp index d21696a..9365c23 100644 --- a/kmicromail/viewmailbase.cpp +++ b/kmicromail/viewmailbase.cpp | |||
@@ -1,78 +1,86 @@ | |||
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 | ||
17 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) | 17 | ViewMailBase::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 | ||
55 | nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this); | 63 | nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this); |
56 | QLabel *spacer = new QLabel(toolbar); | 64 | QLabel *spacer = new QLabel(toolbar); |
57 | nextMail->addTo(toolbar); | 65 | nextMail->addTo(toolbar); |
58 | nextMail->addTo(mailmenu); | 66 | nextMail->addTo(mailmenu); |
59 | 67 | ||
60 | 68 | ||
61 | 69 | ||
62 | 70 | ||
63 | closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); | 71 | closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); |
64 | //QLabel *spacer = new QLabel(toolbar); | 72 | //QLabel *spacer = new QLabel(toolbar); |
65 | spacer->setBackgroundMode(QWidget::PaletteButton); | 73 | spacer->setBackgroundMode(QWidget::PaletteButton); |
66 | toolbar->setStretchableWidget(spacer); | 74 | toolbar->setStretchableWidget(spacer); |
67 | closeMail->addTo(toolbar); | 75 | closeMail->addTo(toolbar); |
68 | closeMail->addTo(mailmenu); | 76 | closeMail->addTo(mailmenu); |
69 | QVBox *view = new QVBox(this); | 77 | QVBox *view = new QVBox(this); |
70 | setCentralWidget(view); | 78 | setCentralWidget(view); |
71 | 79 | ||
72 | attachments = new QListView(view); | 80 | attachments = new QListView(view); |
73 | attachments->setMinimumHeight(90); | 81 | attachments->setMinimumHeight(90); |
74 | attachments->setMaximumHeight(90); | 82 | attachments->setMaximumHeight(90); |
75 | attachments->setAllColumnsShowFocus(true); | 83 | attachments->setAllColumnsShowFocus(true); |
76 | attachments->addColumn("Mime Type", 60); | 84 | attachments->addColumn("Mime Type", 60); |
77 | attachments->addColumn(i18n("Description"), 100); | 85 | attachments->addColumn(i18n("Description"), 100); |
78 | attachments->addColumn(i18n("Filename"), 80); | 86 | attachments->addColumn(i18n("Filename"), 80); |
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 | ||
7 | class QAction; | 7 | class QAction; |
8 | class OpenDiag; | 8 | class OpenDiag; |
9 | class QListView; | 9 | class QListView; |
10 | class QToolBar; | 10 | class QToolBar; |
11 | class QTextBrowser; | 11 | class QTextBrowser; |
12 | class QMenuBar; | 12 | class QMenuBar; |
13 | class QPopupMenu; | 13 | class QPopupMenu; |
14 | 14 | ||
15 | class ViewMailBase : public QMainWindow | 15 | class ViewMailBase : public QMainWindow |
16 | { | 16 | { |
17 | Q_OBJECT | 17 | Q_OBJECT |
18 | 18 | ||
19 | public: | 19 | public: |
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 | ||
22 | protected: | 22 | protected: |
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 | ||
31 | protected slots: | 31 | protected 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 | ||