summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-11-07 19:40:36 (UTC)
committer zautrix <zautrix>2004-11-07 19:40:36 (UTC)
commit90e33436f6d1c502a5620760ac6592b9881ee4ab (patch) (unidiff)
treef493a1eeecd3dc8124bb4c0373b7bda9e85e9863 /kmicromail
parentd90d17044d7daf6677074b0964d59f94407157d5 (diff)
downloadkdepimpi-90e33436f6d1c502a5620760ac6592b9881ee4ab.zip
kdepimpi-90e33436f6d1c502a5620760ac6592b9881ee4ab.tar.gz
kdepimpi-90e33436f6d1c502a5620760ac6592b9881ee4ab.tar.bz2
compile fixes and translation updates
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp4
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp2
-rw-r--r--kmicromail/mainwindow.cpp1
3 files changed, 7 insertions, 0 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 49fd14f..976e309 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,515 +1,519 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3 3
4#ifdef DESKTOP_VERSION 4#ifdef DESKTOP_VERSION
5#include <qapplication.h> 5#include <qapplication.h>
6#include <kabc/addresseedialog.h> 6#include <kabc/addresseedialog.h>
7#include <kabc/stdaddressbook.h> 7#include <kabc/stdaddressbook.h>
8#include <kabc/addressee.h> 8#include <kabc/addressee.h>
9#else
10#include <qpe/qpeapplication.h>
9#endif //DESKTOP_VERSION 11#endif //DESKTOP_VERSION
10#include <libkdepim/externalapphandler.h> 12#include <libkdepim/externalapphandler.h>
11 13
12#include "koprefs.h" 14#include "koprefs.h"
15#include <klocale.h>
16#include <kglobal.h>
13 17
14#ifdef MINIKDE_KDIALOG_H 18#ifdef MINIKDE_KDIALOG_H
15#undef MINIKDE_KDIALOG_H 19#undef MINIKDE_KDIALOG_H
16#endif 20#endif
17 21
18 22
19#include "composemail.h" 23#include "composemail.h"
20 24
21#include <libmailwrapper/smtpwrapper.h> 25#include <libmailwrapper/smtpwrapper.h>
22#include <libmailwrapper/storemail.h> 26#include <libmailwrapper/storemail.h>
23#include <libmailwrapper/abstractmail.h> 27#include <libmailwrapper/abstractmail.h>
24#include <libmailwrapper/mailtypes.h> 28#include <libmailwrapper/mailtypes.h>
25 29
26/* OPIE */ 30/* OPIE */
27//#include <opie2/ofiledialog.h> 31//#include <opie2/ofiledialog.h>
28//#include <opie2/odebug.h> 32//#include <opie2/odebug.h>
29#include <kfiledialog.h> 33#include <kfiledialog.h>
30//#include <qpe/resource.h> 34//#include <qpe/resource.h>
31#include <qpe/global.h> 35#include <qpe/global.h>
32//#include <qpe/contact.h> 36//#include <qpe/contact.h>
33 37
34 38
35#include <qcombobox.h> 39#include <qcombobox.h>
36#include <qcheckbox.h> 40#include <qcheckbox.h>
37#include <qiconset.h> 41#include <qiconset.h>
38#include <qtimer.h> 42#include <qtimer.h>
39#include <qmessagebox.h> 43#include <qmessagebox.h>
40#include <qpushbutton.h> 44#include <qpushbutton.h>
41#include <qmultilineedit.h> 45#include <qmultilineedit.h>
42#include <qlabel.h> 46#include <qlabel.h>
43#include <qtabwidget.h> 47#include <qtabwidget.h>
44#include <qlistview.h> 48#include <qlistview.h>
45 49
46//using namespace Opie::Core; 50//using namespace Opie::Core;
47//using namespace Opie::Ui; 51//using namespace Opie::Ui;
48ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) 52ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal )
49 : ComposeMailUI( parent, name, modal ) 53 : ComposeMailUI( parent, name, modal )
50{ 54{
51 55
52 mPickLineEdit = 0; 56 mPickLineEdit = 0;
53 mEncoding = KOPrefs::instance()->mCurrentCodeName; 57 mEncoding = KOPrefs::instance()->mCurrentCodeName;
54 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 58 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
55 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 59 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
56 settings = sett; 60 settings = sett;
57 m_replyid = ""; 61 m_replyid = "";
58 if ( KOPrefs::instance()->mUseKapi) { 62 if ( KOPrefs::instance()->mUseKapi) {
59 KConfig config( locateLocal("config", "kabcrc") ); 63 KConfig config( locateLocal("config", "kabcrc") );
60 config.setGroup( "General" ); 64 config.setGroup( "General" );
61 QString whoami_uid = config.readEntry( "WhoAmI" ); 65 QString whoami_uid = config.readEntry( "WhoAmI" );
62 66
63 if ( whoami_uid.isEmpty() ) { 67 if ( whoami_uid.isEmpty() ) {
64 QMessageBox::information( 0, i18n( "Hint" ), 68 QMessageBox::information( 0, i18n( "Hint" ),
65 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 69 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
66 i18n( "Ok" ) ); 70 i18n( "Ok" ) );
67 71
68 72
69 fillSettings(); 73 fillSettings();
70 } else 74 } else
71 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 75 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
72 76
73 77
74#ifdef DESKTOP_VERSION 78#ifdef DESKTOP_VERSION
75 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 79 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
76 QStringList mails = con.emails(); 80 QStringList mails = con.emails();
77 QString defmail = con.preferredEmail(); 81 QString defmail = con.preferredEmail();
78 if ( mails.count() == 0) 82 if ( mails.count() == 0)
79 QMessageBox::information( 0, i18n( "Hint" ), 83 QMessageBox::information( 0, i18n( "Hint" ),
80 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 84 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
81 i18n( "Ok" ) ); 85 i18n( "Ok" ) );
82 if (defmail.length()!=0) { 86 if (defmail.length()!=0) {
83 fromBox->insertItem(defmail); 87 fromBox->insertItem(defmail);
84 } 88 }
85 QStringList::ConstIterator sit = mails.begin(); 89 QStringList::ConstIterator sit = mails.begin();
86 for (;sit!=mails.end();++sit) { 90 for (;sit!=mails.end();++sit) {
87 if ( (*sit)==defmail) 91 if ( (*sit)==defmail)
88 continue; 92 continue;
89 fromBox->insertItem((*sit)); 93 fromBox->insertItem((*sit));
90 } 94 }
91 senderNameEdit->setText(con.formattedName()); 95 senderNameEdit->setText(con.formattedName());
92#endif 96#endif
93 97
94 } else { 98 } else {
95 fillSettings(); 99 fillSettings();
96 } 100 }
97 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); 101 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
98 102
99 attList->addColumn( i18n( "Name" ) ); 103 attList->addColumn( i18n( "Name" ) );
100 attList->addColumn( i18n( "Size" ) ); 104 attList->addColumn( i18n( "Size" ) );
101 QList<Account> accounts = settings->getAccounts(); 105 QList<Account> accounts = settings->getAccounts();
102 106
103 if ( QApplication::desktop()->width() < 320 ) 107 if ( QApplication::desktop()->width() < 320 )
104 smtpAccountBox->setMaximumWidth( 80 ); 108 smtpAccountBox->setMaximumWidth( 80 );
105 Account *it; 109 Account *it;
106 for ( it = accounts.first(); it; it = accounts.next() ) { 110 for ( it = accounts.first(); it; it = accounts.next() ) {
107 if ( it->getType()==MAILLIB::A_SMTP ) { 111 if ( it->getType()==MAILLIB::A_SMTP ) {
108 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 112 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
109 smtpAccountBox->insertItem( smtp->getAccountName() ); 113 smtpAccountBox->insertItem( smtp->getAccountName() );
110 smtpAccounts.append( smtp ); 114 smtpAccounts.append( smtp );
111 } 115 }
112 } 116 }
113 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 117 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
114 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 118 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
115 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 119 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
116 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 120 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
117 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 121 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
118 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 122 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
119 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 123 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
120 mMail = 0; 124 mMail = 0;
121 warnAttach = true; 125 warnAttach = true;
122 QIconSet icon; 126 QIconSet icon;
123 //icon = SmallIcon("fileexport"); 127 //icon = SmallIcon("fileexport");
124 icon = SmallIcon("filesave"); 128 icon = SmallIcon("filesave");
125 SaveButton->setIconSet (icon ) ; 129 SaveButton->setIconSet (icon ) ;
126 if ( QApplication::desktop()->width() < 320 ) { 130 if ( QApplication::desktop()->width() < 320 ) {
127 SaveButton->setText ("") ; 131 SaveButton->setText ("") ;
128 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; 132 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ;
129 } 133 }
130 else 134 else
131 SaveButton->setText (i18n("Save")); 135 SaveButton->setText (i18n("Save"));
132#ifndef DESKTOP_VERSION 136#ifndef DESKTOP_VERSION
133 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); 137 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
134 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); 138 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold );
135 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); 139 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold );
136#endif 140#endif
137 message->setFont ( KOPrefs::instance()->mComposeFont ); 141 message->setFont ( KOPrefs::instance()->mComposeFont );
138 message->setWordWrap (QMultiLineEdit::WidgetWidth); 142 message->setWordWrap (QMultiLineEdit::WidgetWidth);
139 if ( smtpAccounts.count() > 0 ) { 143 if ( smtpAccounts.count() > 0 ) {
140 fillValues( smtpAccountBox->currentItem() ); 144 fillValues( smtpAccountBox->currentItem() );
141 } else { 145 } else {
142 QMessageBox::information( 0, i18n( "Problem" ), 146 QMessageBox::information( 0, i18n( "Problem" ),
143 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), 147 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ),
144 i18n( "Ok" ) ); 148 i18n( "Ok" ) );
145 return; 149 return;
146 } 150 }
147 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 151 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
148 152
149 153
150} 154}
151 155
152void ComposeMail::fillSettings() 156void ComposeMail::fillSettings()
153{ 157{
154 if ( QApplication::desktop()->width() < 320 ) 158 if ( QApplication::desktop()->width() < 320 )
155 fromBox->setMaximumWidth( 100 ); 159 fromBox->setMaximumWidth( 100 );
156 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); 160 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
157 QStringList::ConstIterator sit = mailList.begin(); 161 QStringList::ConstIterator sit = mailList.begin();
158 int pref = 0; 162 int pref = 0;
159 for (;sit!=mailList.end();++sit) { 163 for (;sit!=mailList.end();++sit) {
160 fromBox->insertItem((*sit)); 164 fromBox->insertItem((*sit));
161 } 165 }
162 senderNameEdit->setText(KOPrefs::instance()->mName); 166 senderNameEdit->setText(KOPrefs::instance()->mName);
163} 167}
164 168
165 169
166void ComposeMail::saveAsDraft() 170void ComposeMail::saveAsDraft()
167{ 171{
168 172
169 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 173 Opie::Core::OSmartPointer<Mail> mail= new Mail();
170 mail->setMail(fromBox->currentText()); 174 mail->setMail(fromBox->currentText());
171 mail->setTo( toLine->text() ); 175 mail->setTo( toLine->text() );
172 mail->setName(senderNameEdit->text()); 176 mail->setName(senderNameEdit->text());
173 mail->setCC( ccLine->text() ); 177 mail->setCC( ccLine->text() );
174 mail->setBCC( bccLine->text() ); 178 mail->setBCC( bccLine->text() );
175 mail->setReply( replyLine->text() ); 179 mail->setReply( replyLine->text() );
176 mail->setSubject( subjectLine->text() ); 180 mail->setSubject( subjectLine->text() );
177 if (!m_replyid.isEmpty()) { 181 if (!m_replyid.isEmpty()) {
178 QStringList ids; 182 QStringList ids;
179 ids.append(m_replyid); 183 ids.append(m_replyid);
180 mail->setInreply(ids); 184 mail->setInreply(ids);
181 } 185 }
182 QString txt = message->text(); 186 QString txt = message->text();
183 if ( !sigMultiLine->text().isEmpty() ) { 187 if ( !sigMultiLine->text().isEmpty() ) {
184 txt.append( "\n--\n" ); 188 txt.append( "\n--\n" );
185 txt.append( sigMultiLine->text() ); 189 txt.append( sigMultiLine->text() );
186 } 190 }
187 mail->setMessage( txt ); 191 mail->setMessage( txt );
188 mail->setCharset (mEncoding); 192 mail->setCharset (mEncoding);
189 /* only use the default drafts folder name! */ 193 /* only use the default drafts folder name! */
190 Storemail wrapper(AbstractMail::draftFolder()); 194 Storemail wrapper(AbstractMail::draftFolder());
191 wrapper.storeMail(mail); 195 wrapper.storeMail(mail);
192 196
193 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 197 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
194 /* attachments we will ignore! */ 198 /* attachments we will ignore! */
195 if ( it != 0 ) { 199 if ( it != 0 ) {
196 if ( warnAttach ) 200 if ( warnAttach )
197 QMessageBox::warning(0,i18n("Store message"), 201 QMessageBox::warning(0,i18n("Store message"),
198 i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); 202 i18n("<center>Attachments will not be stored in \"Draft\" folder</center>"));
199 warnAttach = false; 203 warnAttach = false;
200 } 204 }
201 setStatus( i18n("Mail saved as draft!") ); 205 setStatus( i18n("Mail saved as draft!") );
202} 206}
203void ComposeMail::clearStatus() 207void ComposeMail::clearStatus()
204{ 208{
205 topLevelWidget()->setCaption( i18n("Compose mail") ); 209 topLevelWidget()->setCaption( i18n("Compose mail") );
206} 210}
207void ComposeMail::setStatus( QString status ) 211void ComposeMail::setStatus( QString status )
208{ 212{
209 topLevelWidget()->setCaption( status ); 213 topLevelWidget()->setCaption( status );
210 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; 214 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
211} 215}
212void ComposeMail::pickAddress( ) 216void ComposeMail::pickAddress( )
213{ 217{
214 218
215 QLineEdit *line = mPickLineEdit; 219 QLineEdit *line = mPickLineEdit;
216 if ( line == 0 ) 220 if ( line == 0 )
217 return; 221 return;
218#ifdef DESKTOP_VERSION 222#ifdef DESKTOP_VERSION
219 //qDebug(" ComposeMail::pickAddress "); 223 //qDebug(" ComposeMail::pickAddress ");
220 QString names ;//= AddressPicker::getNames(); 224 QString names ;//= AddressPicker::getNames();
221 225
222 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 226 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
223 uint i=0; 227 uint i=0;
224 for (i=0; i < list.count(); i++) { 228 for (i=0; i < list.count(); i++) {
225 if ( !list[i].preferredEmail().isEmpty()) { 229 if ( !list[i].preferredEmail().isEmpty()) {
226 if ( ! names.isEmpty() ) 230 if ( ! names.isEmpty() )
227 names+= ","; 231 names+= ",";
228 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 232 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
229 233
230 } 234 }
231 } 235 }
232 236
233 237
234 if ( line->text().isEmpty() ) { 238 if ( line->text().isEmpty() ) {
235 line->setText( names ); 239 line->setText( names );
236 } else if ( !names.isEmpty() ) { 240 } else if ( !names.isEmpty() ) {
237 line->setText( line->text() + ", " + names ); 241 line->setText( line->text() + ", " + names );
238 } 242 }
239#else 243#else
240 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); 244 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
241 // the result should now arrive through method insertAttendees 245 // the result should now arrive through method insertAttendees
242#endif 246#endif
243} 247}
244//the map includes name/email pairs, that comes from Ka/Pi 248//the map includes name/email pairs, that comes from Ka/Pi
245void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 249void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
246{ 250{
247 //qDebug("ComposeMail::insertAttendees "); 251 //qDebug("ComposeMail::insertAttendees ");
248 raise(); 252 raise();
249 253
250 if ( mPickLineEdit == 0 ) { //whoami received 254 if ( mPickLineEdit == 0 ) { //whoami received
251 QString defmail = uidList[0]; 255 QString defmail = uidList[0];
252 if ( emailList.count() == 0 ) 256 if ( emailList.count() == 0 )
253 QMessageBox::information( 0, i18n( "Hint" ), 257 QMessageBox::information( 0, i18n( "Hint" ),
254 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 258 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
255 i18n( "Ok" ) ); 259 i18n( "Ok" ) );
256 if (defmail.length()!=0) { 260 if (defmail.length()!=0) {
257 fromBox->insertItem(defmail); 261 fromBox->insertItem(defmail);
258 } 262 }
259 QStringList::ConstIterator sit = emailList.begin(); 263 QStringList::ConstIterator sit = emailList.begin();
260 int pref = 0; 264 int pref = 0;
261 for (;sit!=emailList.end();++sit) { 265 for (;sit!=emailList.end();++sit) {
262 if ( (*sit)==defmail) 266 if ( (*sit)==defmail)
263 continue; 267 continue;
264 fromBox->insertItem((*sit)); 268 fromBox->insertItem((*sit));
265 } 269 }
266 senderNameEdit->setText(nameList[0]); 270 senderNameEdit->setText(nameList[0]);
267 return; 271 return;
268 } 272 }
269 QString names ; 273 QString names ;
270 QLineEdit *line = mPickLineEdit; 274 QLineEdit *line = mPickLineEdit;
271 if (uid == this->name()) 275 if (uid == this->name())
272 { 276 {
273 for ( int i = 0; i < nameList.count(); i++) 277 for ( int i = 0; i < nameList.count(); i++)
274 { 278 {
275 QString _name = nameList[i]; 279 QString _name = nameList[i];
276 QString _email = emailList[i]; 280 QString _email = emailList[i];
277 QString _uid = uidList[i]; 281 QString _uid = uidList[i];
278 if ( ! _email.isEmpty() ) { 282 if ( ! _email.isEmpty() ) {
279 if ( ! names.isEmpty() ) 283 if ( ! names.isEmpty() )
280 names+= ","; 284 names+= ",";
281 names+= "\""+_name +"\"<" +_email +">"; 285 names+= "\""+_name +"\"<" +_email +">";
282 } 286 }
283 } 287 }
284 } 288 }
285 if ( line->text().isEmpty() ) { 289 if ( line->text().isEmpty() ) {
286 line->setText( names ); 290 line->setText( names );
287 } else if ( !names.isEmpty() ) { 291 } else if ( !names.isEmpty() ) {
288 line->setText( line->text() + ", " + names ); 292 line->setText( line->text() + ", " + names );
289 } 293 }
290} 294}
291 295
292void ComposeMail::setTo( const QString & to ) 296void ComposeMail::setTo( const QString & to )
293{ 297{
294 toLine->setText( to ); 298 toLine->setText( to );
295} 299}
296 300
297void ComposeMail::setSubject( const QString & subject ) 301void ComposeMail::setSubject( const QString & subject )
298{ 302{
299 subjectLine->setText( subject ); 303 subjectLine->setText( subject );
300} 304}
301 305
302void ComposeMail::setInReplyTo( const QString & messageId ) 306void ComposeMail::setInReplyTo( const QString & messageId )
303{ 307{
304 m_replyid = messageId; 308 m_replyid = messageId;
305} 309}
306 310
307void ComposeMail::setMessage( const QString & text ) 311void ComposeMail::setMessage( const QString & text )
308{ 312{
309 message->setText( text ); 313 message->setText( text );
310} 314}
311 315
312 316
313void ComposeMail::pickAddressTo() 317void ComposeMail::pickAddressTo()
314{ 318{
315 mPickLineEdit = toLine; 319 mPickLineEdit = toLine;
316 pickAddress( ); 320 pickAddress( );
317} 321}
318 322
319void ComposeMail::pickAddressCC() 323void ComposeMail::pickAddressCC()
320{ 324{
321 mPickLineEdit = ccLine; 325 mPickLineEdit = ccLine;
322 pickAddress( ); 326 pickAddress( );
323} 327}
324 328
325void ComposeMail::pickAddressBCC() 329void ComposeMail::pickAddressBCC()
326{ 330{
327 mPickLineEdit = bccLine; 331 mPickLineEdit = bccLine;
328 pickAddress( ); 332 pickAddress( );
329} 333}
330 334
331void ComposeMail::pickAddressReply() 335void ComposeMail::pickAddressReply()
332{ 336{
333 mPickLineEdit = replyLine; 337 mPickLineEdit = replyLine;
334 pickAddress( ); 338 pickAddress( );
335} 339}
336 340
337void ComposeMail::fillValues( int ) 341void ComposeMail::fillValues( int )
338{ 342{
339#if 0 343#if 0
340 SMTPaccount *smtp = smtpAccounts.at( current ); 344 SMTPaccount *smtp = smtpAccounts.at( current );
341 ccLine->clear(); 345 ccLine->clear();
342 if ( smtp->getUseCC() ) { 346 if ( smtp->getUseCC() ) {
343 ccLine->setText( smtp->getCC() ); 347 ccLine->setText( smtp->getCC() );
344 } 348 }
345 bccLine->clear(); 349 bccLine->clear();
346 if ( smtp->getUseBCC() ) { 350 if ( smtp->getUseBCC() ) {
347 bccLine->setText( smtp->getBCC() ); 351 bccLine->setText( smtp->getBCC() );
348 } 352 }
349 replyLine->clear(); 353 replyLine->clear();
350 if ( smtp->getUseReply() ) { 354 if ( smtp->getUseReply() ) {
351 replyLine->setText( smtp->getReply() ); 355 replyLine->setText( smtp->getReply() );
352 } 356 }
353 sigMultiLine->setText( smtp->getSignature() ); 357 sigMultiLine->setText( smtp->getSignature() );
354#endif 358#endif
355} 359}
356 360
357void ComposeMail::slotAdjustColumns() 361void ComposeMail::slotAdjustColumns()
358{ 362{
359 int currPage = tabWidget->currentPageIndex(); 363 int currPage = tabWidget->currentPageIndex();
360 364
361 tabWidget->showPage( attachTab ); 365 tabWidget->showPage( attachTab );
362 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 366 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
363 attList->setColumnWidth( 1, 80 ); 367 attList->setColumnWidth( 1, 80 );
364 368
365 tabWidget->setCurrentPage( currPage ); 369 tabWidget->setCurrentPage( currPage );
366} 370}
367 371
368void ComposeMail::addAttachment() 372void ComposeMail::addAttachment()
369{ 373{
370 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); 374 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this );
371 if ( !lnk.isEmpty() ) { 375 if ( !lnk.isEmpty() ) {
372 Attachment *att = new Attachment( lnk ); 376 Attachment *att = new Attachment( lnk );
373 (void) new AttachViewItem( attList, att ); 377 (void) new AttachViewItem( attList, att );
374 } 378 }
375} 379}
376 380
377void ComposeMail::removeAttachment() 381void ComposeMail::removeAttachment()
378{ 382{
379 if ( !attList->currentItem() ) { 383 if ( !attList->currentItem() ) {
380 QMessageBox::information( this, i18n( "Error" ), 384 QMessageBox::information( this, i18n( "Error" ),
381 i18n( "<p>Please select a File.</p>" ), 385 i18n( "<p>Please select a File.</p>" ),
382 i18n( "Ok" ) ); 386 i18n( "Ok" ) );
383 } else { 387 } else {
384 attList->takeItem( attList->currentItem() ); 388 attList->takeItem( attList->currentItem() );
385 } 389 }
386} 390}
387 391
388void ComposeMail::accept() 392void ComposeMail::accept()
389{ 393{
390 if ( smtpAccountBox->count() == 0 ) { 394 if ( smtpAccountBox->count() == 0 ) {
391 395
392 reject(); 396 reject();
393 return; 397 return;
394 } 398 }
395 399
396 if (! checkBoxLater->isChecked() ) { 400 if (! checkBoxLater->isChecked() ) {
397 int yesno = QMessageBox::warning(0,i18n("Stop editing message"), 401 int yesno = QMessageBox::warning(0,i18n("Stop editing message"),
398 i18n("Send this message?"), 402 i18n("Send this message?"),
399 i18n("Yes"), 403 i18n("Yes"),
400 i18n("Cancel")); 404 i18n("Cancel"));
401 405
402 if (yesno == 1) { 406 if (yesno == 1) {
403 return; 407 return;
404 } 408 }
405 } 409 }
406#if 0 410#if 0
407 odebug << "Sending Mail with " 411 odebug << "Sending Mail with "
408 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; 412 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
409#endif 413#endif
410 Opie::Core::OSmartPointer<Mail> mail=new Mail; 414 Opie::Core::OSmartPointer<Mail> mail=new Mail;
411 415
412 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 416 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
413 mail->setMail(fromBox->currentText()); 417 mail->setMail(fromBox->currentText());
414 418
415 if ( !toLine->text().isEmpty() ) { 419 if ( !toLine->text().isEmpty() ) {
416 mail->setTo( toLine->text() ); 420 mail->setTo( toLine->text() );
417 } else { 421 } else {
418 QMessageBox::warning(0,i18n("Sending mail"), 422 QMessageBox::warning(0,i18n("Sending mail"),
419 i18n("No Receiver spezified" ) ); 423 i18n("No Receiver spezified" ) );
420 return; 424 return;
421 } 425 }
422 426
423 mail->setName(senderNameEdit->text()); 427 mail->setName(senderNameEdit->text());
424 mail->setCC( ccLine->text() ); 428 mail->setCC( ccLine->text() );
425 mail->setBCC( bccLine->text() ); 429 mail->setBCC( bccLine->text() );
426 mail->setReply( replyLine->text() ); 430 mail->setReply( replyLine->text() );
427 mail->setSubject( subjectLine->text() ); 431 mail->setSubject( subjectLine->text() );
428 if (!m_replyid.isEmpty()) { 432 if (!m_replyid.isEmpty()) {
429 QStringList ids; 433 QStringList ids;
430 ids.append(m_replyid); 434 ids.append(m_replyid);
431 mail->setInreply(ids); 435 mail->setInreply(ids);
432 } 436 }
433 QString txt = message->text(); 437 QString txt = message->text();
434 if ( !sigMultiLine->text().isEmpty() ) { 438 if ( !sigMultiLine->text().isEmpty() ) {
435 txt.append( "\n--\n" ); 439 txt.append( "\n--\n" );
436 txt.append( sigMultiLine->text() ); 440 txt.append( sigMultiLine->text() );
437 } 441 }
438 mail->setMessage( txt ); 442 mail->setMessage( txt );
439 mail->setCharset (mEncoding); 443 mail->setCharset (mEncoding);
440 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 444 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
441 while ( it != 0 ) { 445 while ( it != 0 ) {
442 mail->addAttachment( it->getAttachment() ); 446 mail->addAttachment( it->getAttachment() );
443 it = (AttachViewItem *) it->nextSibling(); 447 it = (AttachViewItem *) it->nextSibling();
444 } 448 }
445 449
446 SMTPwrapper wrapper( smtp ); 450 SMTPwrapper wrapper( smtp );
447 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) 451 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
448 setStatus( tr ("Mail sent")); 452 setStatus( tr ("Mail sent"));
449 else { 453 else {
450 setStatus( tr ("Error: Something went wrong. Nothing sent")); 454 setStatus( tr ("Error: Something went wrong. Nothing sent"));
451 return; 455 return;
452 } 456 }
453 457
454 458
455 QDialog::accept(); 459 QDialog::accept();
456} 460}
457 461
458void ComposeMail::reject() 462void ComposeMail::reject()
459{ 463{
460 //qDebug("ComposeMail::reject() "); 464 //qDebug("ComposeMail::reject() ");
461 int yesno = QMessageBox::warning(0,i18n("Store message?"), 465 int yesno = QMessageBox::warning(0,i18n("Store message?"),
462 i18n("Store message into drafts?\n"), 466 i18n("Store message into drafts?\n"),
463 i18n("Yes"), 467 i18n("Yes"),
464 i18n("No")); 468 i18n("No"));
465 469
466 //qDebug("button %d ", yesno); 470 //qDebug("button %d ", yesno);
467 if (yesno == 0) { 471 if (yesno == 0) {
468 if ( toLine->text().isEmpty() ) { 472 if ( toLine->text().isEmpty() ) {
469 QMessageBox::warning(0,i18n("Sending mail"), 473 QMessageBox::warning(0,i18n("Sending mail"),
470 i18n("No Receiver spezified" ) ); 474 i18n("No Receiver spezified" ) );
471 return; 475 return;
472 } 476 }
473 saveAsDraft(); 477 saveAsDraft();
474 } 478 }
475 if (yesno == 2) { 479 if (yesno == 2) {
476 qDebug("return "); 480 qDebug("return ");
477 return; 481 return;
478 } 482 }
479 QDialog::reject(); 483 QDialog::reject();
480} 484}
481 485
482void ComposeMail::setCharset(const QString& charset) 486void ComposeMail::setCharset(const QString& charset)
483{ 487{
484 if ( !charset.isEmpty() ) 488 if ( !charset.isEmpty() )
485 mEncoding = charset; 489 mEncoding = charset;
486 qDebug("ComposeMail::setCharset %s ", mEncoding.latin1()); 490 qDebug("ComposeMail::setCharset %s ", mEncoding.latin1());
487} 491}
488ComposeMail::~ComposeMail() 492ComposeMail::~ComposeMail()
489{ 493{
490} 494}
491 495
492void ComposeMail::reEditMail(const RecMailP&current) 496void ComposeMail::reEditMail(const RecMailP&current)
493{ 497{
494 RecMailP data = current; 498 RecMailP data = current;
495 RecBodyP body = data->Wrapper()->fetchBody(current); 499 RecBodyP body = data->Wrapper()->fetchBody(current);
496 500
497 message->setText(body->Bodytext()); 501 message->setText(body->Bodytext());
498 subjectLine->setText( data->getSubject()); 502 subjectLine->setText( data->getSubject());
499 toLine->setText(data->To().join(",")); 503 toLine->setText(data->To().join(","));
500 ccLine->setText(data->CC().join(",")); 504 ccLine->setText(data->CC().join(","));
501 bccLine->setText(data->Bcc().join(",")); 505 bccLine->setText(data->Bcc().join(","));
502 replyLine->setText(data->Replyto()); 506 replyLine->setText(data->Replyto());
503 setCharset(body->getCharset()); 507 setCharset(body->getCharset());
504} 508}
505 509
506AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 510AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
507 : QListViewItem( parent ) 511 : QListViewItem( parent )
508{ 512{
509 attachment = att; 513 attachment = att;
510 if ( !attachment->getPixmap().isNull() ) 514 if ( !attachment->getPixmap().isNull() )
511 setPixmap( 0,attachment->getPixmap() ); 515 setPixmap( 0,attachment->getPixmap() );
512 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 516 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
513 setText( 1, QString::number( att->getSize() ) ); 517 setText( 1, QString::number( att->getSize() ) );
514} 518}
515 519
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index eac05e5..1ed9f34 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -1,546 +1,548 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#include "genericwrapper.h" 2#include "genericwrapper.h"
3#include <libetpan/libetpan.h> 3#include <libetpan/libetpan.h>
4#include "mailtypes.h" 4#include "mailtypes.h"
5 5
6#include <kconfig.h> 6#include <kconfig.h>
7#include <kglobal.h> 7#include <kglobal.h>
8#include <kstandarddirs.h> 8#include <kstandarddirs.h>
9 9
10 10
11using namespace Opie::Core; 11using namespace Opie::Core;
12Genericwrapper::Genericwrapper() 12Genericwrapper::Genericwrapper()
13 : AbstractMail() 13 : AbstractMail()
14{ 14{
15 bodyCache.clear(); 15 bodyCache.clear();
16 m_storage = 0; 16 m_storage = 0;
17 m_folder = 0; 17 m_folder = 0;
18} 18}
19 19
20Genericwrapper::~Genericwrapper() 20Genericwrapper::~Genericwrapper()
21{ 21{
22 if (m_folder) { 22 if (m_folder) {
23 mailfolder_free(m_folder); 23 mailfolder_free(m_folder);
24 } 24 }
25 if (m_storage) { 25 if (m_storage) {
26 mailstorage_free(m_storage); 26 mailstorage_free(m_storage);
27 } 27 }
28 cleanMimeCache(); 28 cleanMimeCache();
29} 29}
30const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date ) 30const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date )
31{ 31{
32 32
33 QDate da (date->dt_year,date->dt_month, date->dt_day ); 33 QDate da (date->dt_year,date->dt_month, date->dt_day );
34 QTime ti ( date->dt_hour, date->dt_min, date->dt_sec ); 34 QTime ti ( date->dt_hour, date->dt_min, date->dt_sec );
35 QDateTime dt ( da ,ti ); 35 QDateTime dt ( da ,ti );
36 int addsec = -date->dt_zone*36; 36 int addsec = -date->dt_zone*36;
37 //qDebug("adsec1 %d ",addsec ); 37 //qDebug("adsec1 %d ",addsec );
38 dt = dt.addSecs( addsec ); 38 dt = dt.addSecs( addsec );
39 int off = KGlobal::locale()->localTimeOffset( dt ); 39 int off = KGlobal::locale()->localTimeOffset( dt );
40 //qDebug("adsec2 %d ",off*60 ); 40 //qDebug("adsec2 %d ",off*60 );
41 41
42 dt = dt.addSecs( off*60 ); 42 dt = dt.addSecs( off*60 );
43 return dt; 43 return dt;
44#if 0 44#if 0
45 QString ret; 45 QString ret;
46 if ( dt.date() == QDate::currentDate () ) 46 if ( dt.date() == QDate::currentDate () )
47 ret = KGlobal::locale()->formatTime( dt.time(),true); 47 ret = KGlobal::locale()->formatTime( dt.time(),true);
48 48
49 else { 49 else {
50 ret = KGlobal::locale()->formatDateTime( dt,true,true); 50 ret = KGlobal::locale()->formatDateTime( dt,true,true);
51 } 51 }
52#endif 52#endif
53#if 0 53#if 0
54 if ( off < 0 ) 54 if ( off < 0 )
55 ret += " -"; 55 ret += " -";
56 else 56 else
57 ret += " +"; 57 ret += " +";
58 ret += QString::number( off / 60 ); 58 ret += QString::number( off / 60 );
59 ret += "h"; 59 ret += "h";
60#endif 60#endif
61#if 0 61#if 0
62 char tmp[23]; 62 char tmp[23];
63 63
64 // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", 64 // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i",
65 // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); 65 // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
66 snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", 66 snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i",
67 date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); 67 date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
68 68
69 69
70 return QString( tmp ); 70 return QString( tmp );
71#endif 71#endif
72 //return ret; 72 //return ret;
73} 73}
74 74
75void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) 75void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime)
76{ 76{
77 if (!mime) { 77 if (!mime) {
78 return; 78 return;
79 } 79 }
80 mailmime_field*field = 0; 80 mailmime_field*field = 0;
81 mailmime_single_fields fields; 81 mailmime_single_fields fields;
82 memset(&fields, 0, sizeof(struct mailmime_single_fields)); 82 memset(&fields, 0, sizeof(struct mailmime_single_fields));
83 if (mime->mm_mime_fields != NULL) { 83 if (mime->mm_mime_fields != NULL) {
84 mailmime_single_fields_init(&fields, mime->mm_mime_fields, 84 mailmime_single_fields_init(&fields, mime->mm_mime_fields,
85 mime->mm_content_type); 85 mime->mm_content_type);
86 } 86 }
87 87
88 mailmime_content*type = fields.fld_content; 88 mailmime_content*type = fields.fld_content;
89 clistcell*current; 89 clistcell*current;
90 if (!type) { 90 if (!type) {
91 target->setType("text"); 91 target->setType("text");
92 target->setSubtype("plain"); 92 target->setSubtype("plain");
93 } else { 93 } else {
94 target->setSubtype(type->ct_subtype); 94 target->setSubtype(type->ct_subtype);
95 switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { 95 switch(type->ct_type->tp_data.tp_discrete_type->dt_type) {
96 case MAILMIME_DISCRETE_TYPE_TEXT: 96 case MAILMIME_DISCRETE_TYPE_TEXT:
97 target->setType("text"); 97 target->setType("text");
98 break; 98 break;
99 case MAILMIME_DISCRETE_TYPE_IMAGE: 99 case MAILMIME_DISCRETE_TYPE_IMAGE:
100 target->setType("image"); 100 target->setType("image");
101 break; 101 break;
102 case MAILMIME_DISCRETE_TYPE_AUDIO: 102 case MAILMIME_DISCRETE_TYPE_AUDIO:
103 target->setType("audio"); 103 target->setType("audio");
104 break; 104 break;
105 case MAILMIME_DISCRETE_TYPE_VIDEO: 105 case MAILMIME_DISCRETE_TYPE_VIDEO:
106 target->setType("video"); 106 target->setType("video");
107 break; 107 break;
108 case MAILMIME_DISCRETE_TYPE_APPLICATION: 108 case MAILMIME_DISCRETE_TYPE_APPLICATION:
109 target->setType("application"); 109 target->setType("application");
110 break; 110 break;
111 case MAILMIME_DISCRETE_TYPE_EXTENSION: 111 case MAILMIME_DISCRETE_TYPE_EXTENSION:
112 default: 112 default:
113 if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { 113 if (type->ct_type->tp_data.tp_discrete_type->dt_extension) {
114 target->setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); 114 target->setType(type->ct_type->tp_data.tp_discrete_type->dt_extension);
115 } 115 }
116 break; 116 break;
117 } 117 }
118 if (type->ct_parameters) { 118 if (type->ct_parameters) {
119 fillParameters(target,type->ct_parameters); 119 fillParameters(target,type->ct_parameters);
120 } 120 }
121 } 121 }
122 if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { 122 if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) {
123 for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) { 123 for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) {
124 field = (mailmime_field*)current->data; 124 field = (mailmime_field*)current->data;
125 switch(field->fld_type) { 125 switch(field->fld_type) {
126 case MAILMIME_FIELD_TRANSFER_ENCODING: 126 case MAILMIME_FIELD_TRANSFER_ENCODING:
127 target->setEncoding(getencoding(field->fld_data.fld_encoding)); 127 target->setEncoding(getencoding(field->fld_data.fld_encoding));
128 break; 128 break;
129 case MAILMIME_FIELD_ID: 129 case MAILMIME_FIELD_ID:
130 target->setIdentifier(field->fld_data.fld_id); 130 target->setIdentifier(field->fld_data.fld_id);
131 break; 131 break;
132 case MAILMIME_FIELD_DESCRIPTION: 132 case MAILMIME_FIELD_DESCRIPTION:
133 target->setDescription(field->fld_data.fld_description); 133 target->setDescription(field->fld_data.fld_description);
134 break; 134 break;
135 default: 135 default:
136 break; 136 break;
137 } 137 }
138 } 138 }
139 } 139 }
140} 140}
141 141
142void Genericwrapper::fillParameters(RecPartP&target,clist*parameters) 142void Genericwrapper::fillParameters(RecPartP&target,clist*parameters)
143{ 143{
144 if (!parameters) {return;} 144 if (!parameters) {return;}
145 clistcell*current=0; 145 clistcell*current=0;
146 mailmime_parameter*param; 146 mailmime_parameter*param;
147 for (current=clist_begin(parameters);current!=0;current=clist_next(current)) { 147 for (current=clist_begin(parameters);current!=0;current=clist_next(current)) {
148 param = (mailmime_parameter*)current->data; 148 param = (mailmime_parameter*)current->data;
149 if (param) { 149 if (param) {
150 target->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); 150 target->addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
151 } 151 }
152 } 152 }
153} 153}
154 154
155QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) 155QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
156{ 156{
157 QString enc="7bit"; 157 QString enc="7bit";
158 if (!aEnc) return enc; 158 if (!aEnc) return enc;
159 switch(aEnc->enc_type) { 159 switch(aEnc->enc_type) {
160 case MAILMIME_MECHANISM_7BIT: 160 case MAILMIME_MECHANISM_7BIT:
161 enc = "7bit"; 161 enc = "7bit";
162 break; 162 break;
163 case MAILMIME_MECHANISM_8BIT: 163 case MAILMIME_MECHANISM_8BIT:
164 enc = "8bit"; 164 enc = "8bit";
165 break; 165 break;
166 case MAILMIME_MECHANISM_BINARY: 166 case MAILMIME_MECHANISM_BINARY:
167 enc = "binary"; 167 enc = "binary";
168 break; 168 break;
169 case MAILMIME_MECHANISM_QUOTED_PRINTABLE: 169 case MAILMIME_MECHANISM_QUOTED_PRINTABLE:
170 enc = "quoted-printable"; 170 enc = "quoted-printable";
171 break; 171 break;
172 case MAILMIME_MECHANISM_BASE64: 172 case MAILMIME_MECHANISM_BASE64:
173 enc = "base64"; 173 enc = "base64";
174 break; 174 break;
175 case MAILMIME_MECHANISM_TOKEN: 175 case MAILMIME_MECHANISM_TOKEN:
176 default: 176 default:
177 if (aEnc->enc_token) { 177 if (aEnc->enc_token) {
178 enc = QString(aEnc->enc_token); 178 enc = QString(aEnc->enc_token);
179 } 179 }
180 break; 180 break;
181 } 181 }
182 return enc; 182 return enc;
183} 183}
184 184
185void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) 185void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
186{ 186{
187 if (current_rec >= 10) { 187 if (current_rec >= 10) {
188 ; // odebug << "too deep recursion!" << oendl; 188 ; // odebug << "too deep recursion!" << oendl;
189 } 189 }
190 if (!message || !mime) { 190 if (!message || !mime) {
191 return; 191 return;
192 } 192 }
193 int r; 193 int r;
194 char*data = 0; 194 char*data = 0;
195 size_t len; 195 size_t len;
196 clistiter * cur = 0; 196 clistiter * cur = 0;
197 QString b; 197 QString b;
198 RecPartP part = new RecPart(); 198 RecPartP part = new RecPart();
199 199
200 switch (mime->mm_type) { 200 switch (mime->mm_type) {
201 case MAILMIME_SINGLE: 201 case MAILMIME_SINGLE:
202 { 202 {
203 QValueList<int>countlist = recList; 203 QValueList<int>countlist = recList;
204 countlist.append(current_count); 204 countlist.append(current_count);
205 r = mailmessage_fetch_section(message,mime,&data,&len); 205 r = mailmessage_fetch_section(message,mime,&data,&len);
206 part->setSize(len); 206 part->setSize(len);
207 part->setPositionlist(countlist); 207 part->setPositionlist(countlist);
208 b = gen_attachment_id(); 208 b = gen_attachment_id();
209 part->setIdentifier(b); 209 part->setIdentifier(b);
210 fillSingleBody(part,message,mime); 210 fillSingleBody(part,message,mime);
211 if (part->Type()=="text" && target->Bodytext().isNull()) { 211 if (part->Type()=="text" && target->Bodytext().isNull()) {
212 encodedString*rs = new encodedString(); 212 encodedString*rs = new encodedString();
213 rs->setContent(data,len); 213 rs->setContent(data,len);
214 encodedString*res = decode_String(rs,part->Encoding()); 214 encodedString*res = decode_String(rs,part->Encoding());
215 if (countlist.count()>2) { 215 if (countlist.count()>2) {
216 bodyCache[b]=rs; 216 bodyCache[b]=rs;
217 target->addPart(part); 217 target->addPart(part);
218 } else { 218 } else {
219 delete rs; 219 delete rs;
220 } 220 }
221 b = QString(res->Content()); 221 b = QString(res->Content());
222 delete res; 222 delete res;
223 size_t index = 0; 223 size_t index = 0;
224 char*resu = 0; 224 char*resu = 0;
225 int err = MAILIMF_NO_ERROR; 225 int err = MAILIMF_NO_ERROR;
226 QString charset = part->searchParamter( "charset"); 226 QString charset = part->searchParamter( "charset");
227 qDebug("CHARSET %s ",charset.latin1() ); 227 qDebug("CHARSET %s ",charset.latin1() );
228#if 0
228 if (false ) { 229 if (false ) {
229 //if ( !charset.isEmpty() ) { 230 //if ( !charset.isEmpty() ) {
230 target->setCharset( charset ); 231 target->setCharset( charset );
231 err = mailmime_encoded_phrase_parse(charset.latin1(), 232 err = mailmime_encoded_phrase_parse(charset.latin1(),
232 b.latin1(), b.length(),&index, "utf-8",&resu); 233 b.latin1(), b.length(),&index, "utf-8",&resu);
233 if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { 234 if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) {
234 //qDebug("res %d %s ", index, resu); 235 //qDebug("res %d %s ", index, resu);
235 b = QString::fromUtf8(resu); 236 b = QString::fromUtf8(resu);
236 } 237 }
237 if (resu) free(resu); 238 if (resu) free(resu);
238 } 239 }
240#endif
239 target->setBodytext(b); 241 target->setBodytext(b);
240 target->setDescription(part); 242 target->setDescription(part);
241 } else { 243 } else {
242 bodyCache[b]=new encodedString(data,len); 244 bodyCache[b]=new encodedString(data,len);
243 target->addPart(part); 245 target->addPart(part);
244 } 246 }
245 } 247 }
246 break; 248 break;
247 case MAILMIME_MULTIPLE: 249 case MAILMIME_MULTIPLE:
248 { 250 {
249 unsigned int ccount = 1; 251 unsigned int ccount = 1;
250 mailmime*cbody=0; 252 mailmime*cbody=0;
251 QValueList<int>countlist = recList; 253 QValueList<int>countlist = recList;
252 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { 254 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
253 cbody = (mailmime*)clist_content(cur); 255 cbody = (mailmime*)clist_content(cur);
254 if (cbody->mm_type==MAILMIME_MULTIPLE) { 256 if (cbody->mm_type==MAILMIME_MULTIPLE) {
255 RecPartP targetPart = new RecPart(); 257 RecPartP targetPart = new RecPart();
256 targetPart->setType("multipart"); 258 targetPart->setType("multipart");
257 countlist.append(current_count); 259 countlist.append(current_count);
258 targetPart->setPositionlist(countlist); 260 targetPart->setPositionlist(countlist);
259 target->addPart(targetPart); 261 target->addPart(targetPart);
260 } 262 }
261 traverseBody(target,message, cbody,countlist,current_rec+1,ccount); 263 traverseBody(target,message, cbody,countlist,current_rec+1,ccount);
262 if (cbody->mm_type==MAILMIME_MULTIPLE) { 264 if (cbody->mm_type==MAILMIME_MULTIPLE) {
263 countlist = recList; 265 countlist = recList;
264 } 266 }
265 ++ccount; 267 ++ccount;
266 } 268 }
267 } 269 }
268 break; 270 break;
269 case MAILMIME_MESSAGE: 271 case MAILMIME_MESSAGE:
270 { 272 {
271 QValueList<int>countlist = recList; 273 QValueList<int>countlist = recList;
272 countlist.append(current_count); 274 countlist.append(current_count);
273 /* the own header is always at recursion 0 - we don't need that */ 275 /* the own header is always at recursion 0 - we don't need that */
274 if (current_rec > 0) { 276 if (current_rec > 0) {
275 part->setPositionlist(countlist); 277 part->setPositionlist(countlist);
276 r = mailmessage_fetch_section(message,mime,&data,&len); 278 r = mailmessage_fetch_section(message,mime,&data,&len);
277 part->setSize(len); 279 part->setSize(len);
278 part->setPositionlist(countlist); 280 part->setPositionlist(countlist);
279 b = gen_attachment_id(); 281 b = gen_attachment_id();
280 part->setIdentifier(b); 282 part->setIdentifier(b);
281 part->setType("message"); 283 part->setType("message");
282 part->setSubtype("rfc822"); 284 part->setSubtype("rfc822");
283 bodyCache[b]=new encodedString(data,len); 285 bodyCache[b]=new encodedString(data,len);
284 target->addPart(part); 286 target->addPart(part);
285 } 287 }
286 if (mime->mm_data.mm_message.mm_msg_mime != NULL) { 288 if (mime->mm_data.mm_message.mm_msg_mime != NULL) {
287 traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); 289 traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1);
288 } 290 }
289 } 291 }
290 break; 292 break;
291 } 293 }
292} 294}
293 295
294RecBodyP Genericwrapper::parseMail( mailmessage * msg ) 296RecBodyP Genericwrapper::parseMail( mailmessage * msg )
295{ 297{
296 int err = MAILIMF_NO_ERROR; 298 int err = MAILIMF_NO_ERROR;
297 //mailmime_single_fields fields; 299 //mailmime_single_fields fields;
298 /* is bound to msg and will be freed there */ 300 /* is bound to msg and will be freed there */
299 mailmime * mime=0; 301 mailmime * mime=0;
300 RecBodyP body = new RecBody(); 302 RecBodyP body = new RecBody();
301 //memset(&fields, 0, sizeof(struct mailmime_single_fields)); 303 //memset(&fields, 0, sizeof(struct mailmime_single_fields));
302 err = mailmessage_get_bodystructure(msg,&mime); 304 err = mailmessage_get_bodystructure(msg,&mime);
303 QValueList<int>recList; 305 QValueList<int>recList;
304 traverseBody(body,msg,mime,recList); 306 traverseBody(body,msg,mime,recList);
305 return body; 307 return body;
306} 308}
307 309
308 310
309QString Genericwrapper::parseAddressList( mailimf_address_list *list ) 311QString Genericwrapper::parseAddressList( mailimf_address_list *list )
310{ 312{
311 QString result( "" ); 313 QString result( "" );
312 314
313 bool first = true; 315 bool first = true;
314 if (list == 0) return result; 316 if (list == 0) return result;
315 for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { 317 for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) {
316 mailimf_address *addr = (mailimf_address *) current->data; 318 mailimf_address *addr = (mailimf_address *) current->data;
317 319
318 if ( !first ) { 320 if ( !first ) {
319 result.append( "," ); 321 result.append( "," );
320 } else { 322 } else {
321 first = false; 323 first = false;
322 } 324 }
323 325
324 switch ( addr->ad_type ) { 326 switch ( addr->ad_type ) {
325 case MAILIMF_ADDRESS_MAILBOX: 327 case MAILIMF_ADDRESS_MAILBOX:
326 result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); 328 result.append( parseMailbox( addr->ad_data.ad_mailbox ) );
327 break; 329 break;
328 case MAILIMF_ADDRESS_GROUP: 330 case MAILIMF_ADDRESS_GROUP:
329 result.append( parseGroup( addr->ad_data.ad_group ) ); 331 result.append( parseGroup( addr->ad_data.ad_group ) );
330 break; 332 break;
331 default: 333 default:
332 ; // odebug << "Generic: unkown mailimf address type" << oendl; 334 ; // odebug << "Generic: unkown mailimf address type" << oendl;
333 break; 335 break;
334 } 336 }
335 } 337 }
336 338
337 return result; 339 return result;
338} 340}
339 341
340QString Genericwrapper::parseGroup( mailimf_group *group ) 342QString Genericwrapper::parseGroup( mailimf_group *group )
341{ 343{
342 QString result( "" ); 344 QString result( "" );
343 345
344 result.append( group->grp_display_name ); 346 result.append( group->grp_display_name );
345 result.append( ": " ); 347 result.append( ": " );
346 348
347 if ( group->grp_mb_list != NULL ) { 349 if ( group->grp_mb_list != NULL ) {
348 result.append( parseMailboxList( group->grp_mb_list ) ); 350 result.append( parseMailboxList( group->grp_mb_list ) );
349 } 351 }
350 352
351 result.append( ";" ); 353 result.append( ";" );
352 354
353 return result; 355 return result;
354} 356}
355 357
356QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) 358QString Genericwrapper::parseMailbox( mailimf_mailbox *box )
357{ 359{
358 QString result( "" ); 360 QString result( "" );
359 361
360 if ( box->mb_display_name == NULL ) { 362 if ( box->mb_display_name == NULL ) {
361 result.append( box->mb_addr_spec ); 363 result.append( box->mb_addr_spec );
362 } else { 364 } else {
363 result.append( convert_String(box->mb_display_name) ); 365 result.append( convert_String(box->mb_display_name) );
364 result.append( " <" ); 366 result.append( " <" );
365 result.append( box->mb_addr_spec ); 367 result.append( box->mb_addr_spec );
366 result.append( ">" ); 368 result.append( ">" );
367 } 369 }
368 370
369 return result; 371 return result;
370} 372}
371 373
372QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) 374QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list )
373{ 375{
374 QString result( "" ); 376 QString result( "" );
375 377
376 bool first = true; 378 bool first = true;
377 for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { 379 for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) {
378 mailimf_mailbox *box = (mailimf_mailbox *) current->data; 380 mailimf_mailbox *box = (mailimf_mailbox *) current->data;
379 381
380 if ( !first ) { 382 if ( !first ) {
381 result.append( "," ); 383 result.append( "," );
382 } else { 384 } else {
383 first = false; 385 first = false;
384 } 386 }
385 387
386 result.append( parseMailbox( box ) ); 388 result.append( parseMailbox( box ) );
387 } 389 }
388 390
389 return result; 391 return result;
390} 392}
391 393
392encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPartP&part) 394encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPartP&part)
393{ 395{
394 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); 396 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier());
395 if (it==bodyCache.end()) return new encodedString(); 397 if (it==bodyCache.end()) return new encodedString();
396 encodedString*t = decode_String(it.data(),part->Encoding()); 398 encodedString*t = decode_String(it.data(),part->Encoding());
397 return t; 399 return t;
398} 400}
399 401
400encodedString* Genericwrapper::fetchRawPart(const RecMailP&,const RecPartP&part) 402encodedString* Genericwrapper::fetchRawPart(const RecMailP&,const RecPartP&part)
401{ 403{
402 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); 404 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier());
403 if (it==bodyCache.end()) return new encodedString(); 405 if (it==bodyCache.end()) return new encodedString();
404 encodedString*t = it.data(); 406 encodedString*t = it.data();
405 return t; 407 return t;
406} 408}
407 409
408QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) 410QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part)
409{ 411{
410 encodedString*t = fetchDecodedPart(mail,part); 412 encodedString*t = fetchDecodedPart(mail,part);
411 QString text=t->Content(); 413 QString text=t->Content();
412 delete t; 414 delete t;
413 return text; 415 return text;
414} 416}
415 417
416void Genericwrapper::cleanMimeCache() 418void Genericwrapper::cleanMimeCache()
417{ 419{
418 QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); 420 QMap<QString,encodedString*>::Iterator it = bodyCache.begin();
419 for (;it!=bodyCache.end();++it) { 421 for (;it!=bodyCache.end();++it) {
420 encodedString*t = it.data(); 422 encodedString*t = it.data();
421 //it.setValue(0); 423 //it.setValue(0);
422 if (t) delete t; 424 if (t) delete t;
423 } 425 }
424 bodyCache.clear(); 426 bodyCache.clear();
425 ; // odebug << "Genericwrapper: cache cleaned" << oendl; 427 ; // odebug << "Genericwrapper: cache cleaned" << oendl;
426} 428}
427 429
428QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) 430QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
429{ 431{
430 QStringList res; 432 QStringList res;
431 if (!in_replies || !in_replies->mid_list) return res; 433 if (!in_replies || !in_replies->mid_list) return res;
432 clistiter * current = 0; 434 clistiter * current = 0;
433 for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { 435 for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) {
434 QString h((char*)current->data); 436 QString h((char*)current->data);
435 while (h.length()>0 && h[0]=='<') { 437 while (h.length()>0 && h[0]=='<') {
436 h.remove(0,1); 438 h.remove(0,1);
437 } 439 }
438 while (h.length()>0 && h[h.length()-1]=='>') { 440 while (h.length()>0 && h[h.length()-1]=='>') {
439 h.remove(h.length()-1,1); 441 h.remove(h.length()-1,1);
440 } 442 }
441 if (h.length()>0) { 443 if (h.length()>0) {
442 res.append(h); 444 res.append(h);
443 } 445 }
444 } 446 }
445 return res; 447 return res;
446} 448}
447 449
448void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb) 450void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb)
449{ 451{
450 int r; 452 int r;
451 mailmessage_list * env_list = 0; 453 mailmessage_list * env_list = 0;
452 r = mailsession_get_messages_list(session,&env_list); 454 r = mailsession_get_messages_list(session,&env_list);
453 if (r != MAIL_NO_ERROR) { 455 if (r != MAIL_NO_ERROR) {
454 ; // odebug << "Error message list" << oendl; 456 ; // odebug << "Error message list" << oendl;
455 return; 457 return;
456 } 458 }
457 r = mailsession_get_envelopes_list(session, env_list); 459 r = mailsession_get_envelopes_list(session, env_list);
458 if (r != MAIL_NO_ERROR) { 460 if (r != MAIL_NO_ERROR) {
459 ; // odebug << "Error filling message list" << oendl; 461 ; // odebug << "Error filling message list" << oendl;
460 if (env_list) { 462 if (env_list) {
461 mailmessage_list_free(env_list); 463 mailmessage_list_free(env_list);
462 } 464 }
463 return; 465 return;
464 } 466 }
465 mailimf_references * refs = 0; 467 mailimf_references * refs = 0;
466 mailimf_in_reply_to * in_replies = 0; 468 mailimf_in_reply_to * in_replies = 0;
467 uint32_t i = 0; 469 uint32_t i = 0;
468 for(; i < carray_count(env_list->msg_tab) ; ++i) { 470 for(; i < carray_count(env_list->msg_tab) ; ++i) {
469 mailmessage * msg; 471 mailmessage * msg;
470 QBitArray mFlags(7); 472 QBitArray mFlags(7);
471 msg = (mailmessage*)carray_get(env_list->msg_tab, i); 473 msg = (mailmessage*)carray_get(env_list->msg_tab, i);
472 if (msg->msg_fields == NULL) { 474 if (msg->msg_fields == NULL) {
473 //; // odebug << "could not fetch envelope of message " << i << "" << oendl; 475 //; // odebug << "could not fetch envelope of message " << i << "" << oendl;
474 continue; 476 continue;
475 } 477 }
476 RecMailP mail = new RecMail(); 478 RecMailP mail = new RecMail();
477 mail->setWrapper(this); 479 mail->setWrapper(this);
478 mail_flags * flag_result = 0; 480 mail_flags * flag_result = 0;
479 r = mailmessage_get_flags(msg,&flag_result); 481 r = mailmessage_get_flags(msg,&flag_result);
480 if (r == MAIL_ERROR_NOT_IMPLEMENTED) { 482 if (r == MAIL_ERROR_NOT_IMPLEMENTED) {
481 mFlags.setBit(FLAG_SEEN); 483 mFlags.setBit(FLAG_SEEN);
482 } 484 }
483 mailimf_single_fields single_fields; 485 mailimf_single_fields single_fields;
484 mailimf_single_fields_init(&single_fields, msg->msg_fields); 486 mailimf_single_fields_init(&single_fields, msg->msg_fields);
485 mail->setMsgsize(msg->msg_size); 487 mail->setMsgsize(msg->msg_size);
486 mail->setFlags(mFlags); 488 mail->setFlags(mFlags);
487 mail->setMbox(mailbox); 489 mail->setMbox(mailbox);
488 mail->setNumber(msg->msg_index); 490 mail->setNumber(msg->msg_index);
489 if (single_fields.fld_subject) 491 if (single_fields.fld_subject)
490 mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); 492 mail->setSubject( convert_String(single_fields.fld_subject->sbj_value));
491 if (single_fields.fld_from) 493 if (single_fields.fld_from)
492 mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); 494 mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list));
493 if (!mbox_as_to) { 495 if (!mbox_as_to) {
494 if (single_fields.fld_to) 496 if (single_fields.fld_to)
495 mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); 497 mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) );
496 } else { 498 } else {
497 mail->setTo(mailbox); 499 mail->setTo(mailbox);
498 } 500 }
499 if (single_fields.fld_cc) 501 if (single_fields.fld_cc)
500 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); 502 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
501 if (single_fields.fld_bcc) 503 if (single_fields.fld_bcc)
502 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); 504 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
503 if (single_fields.fld_orig_date) { 505 if (single_fields.fld_orig_date) {
504 QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time ); 506 QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time );
505 QString ret; 507 QString ret;
506 if ( dt.date() == QDate::currentDate () ) 508 if ( dt.date() == QDate::currentDate () )
507 ret = KGlobal::locale()->formatTime( dt.time(),true); 509 ret = KGlobal::locale()->formatTime( dt.time(),true);
508 else { 510 else {
509 ret = KGlobal::locale()->formatDateTime( dt,true,true); 511 ret = KGlobal::locale()->formatDateTime( dt,true,true);
510 } 512 }
511 mail->setDate( ret ); 513 mail->setDate( ret );
512 char tmp[20]; 514 char tmp[20];
513 snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", 515 snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i",
514 dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); 516 dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() );
515 //qDebug(" iso %s ", tmp); 517 //qDebug(" iso %s ", tmp);
516 mail->setIsoDate( QString( tmp ) ); 518 mail->setIsoDate( QString( tmp ) );
517 } 519 }
518 // crashes when accessing pop3 account? 520 // crashes when accessing pop3 account?
519 if (single_fields.fld_message_id) { 521 if (single_fields.fld_message_id) {
520 mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); 522 mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
521 ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; 523 ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl;
522 } 524 }
523 if (single_fields.fld_reply_to) { 525 if (single_fields.fld_reply_to) {
524 QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); 526 QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list);
525 if (t.count()>0) { 527 if (t.count()>0) {
526 mail->setReplyto(t[0]); 528 mail->setReplyto(t[0]);
527 } 529 }
528 } 530 }
529#if 0 531#if 0
530 refs = single_fields.fld_references; 532 refs = single_fields.fld_references;
531 if (refs && refs->mid_list && clist_count(refs->mid_list)) { 533 if (refs && refs->mid_list && clist_count(refs->mid_list)) {
532 char * text = (char*)refs->mid_list->first->data; 534 char * text = (char*)refs->mid_list->first->data;
533 mail->setReplyto(QString(text)); 535 mail->setReplyto(QString(text));
534 } 536 }
535#endif 537#endif
536 if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && 538 if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list &&
537 clist_count(single_fields.fld_in_reply_to->mid_list)) { 539 clist_count(single_fields.fld_in_reply_to->mid_list)) {
538 mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); 540 mail->setInreply(parseInreplies(single_fields.fld_in_reply_to));
539 } 541 }
540 if ( maxSizeInKb == 0 || mail->Msgsize()<=maxSizeInKb*1024 ) 542 if ( maxSizeInKb == 0 || mail->Msgsize()<=maxSizeInKb*1024 )
541 target.append(mail); 543 target.append(mail);
542 } 544 }
543 if (env_list) { 545 if (env_list) {
544 mailmessage_list_free(env_list); 546 mailmessage_list_free(env_list);
545 } 547 }
546} 548}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 8c0a4cb..0e4a64f 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,354 +1,355 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qvbox.h> 4#include <qvbox.h>
5#include <qheader.h> 5#include <qheader.h>
6#include <qtimer.h> 6#include <qtimer.h>
7#include <qlayout.h> 7#include <qlayout.h>
8//#include <kdialog.h> 8//#include <kdialog.h>
9#include <kiconloader.h> 9#include <kiconloader.h>
10#include <kapplication.h> 10#include <kapplication.h>
11 11
12#ifdef DESKTOP_VERSION 12#ifdef DESKTOP_VERSION
13#include <qapplication.h> 13#include <qapplication.h>
14#include <qstatusbar.h> 14#include <qstatusbar.h>
15#include <kabc/stdaddressbook.h> 15#include <kabc/stdaddressbook.h>
16extern QStatusBar* globalSstatusBarMainWindow; 16extern QStatusBar* globalSstatusBarMainWindow;
17#else 17#else
18#include <qpe/qpeapplication.h> 18#include <qpe/qpeapplication.h>
19#include <klocale.h>
19#endif 20#endif
20#include "defines.h" 21#include "defines.h"
21#include "mainwindow.h" 22#include "mainwindow.h"
22#include <KDGanttMinimizeSplitter.h> 23#include <KDGanttMinimizeSplitter.h>
23 24
24#include "koprefs.h" 25#include "koprefs.h"
25 26
26MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 27MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
27 : QMainWindow( parent, name ) //, flags ) 28 : QMainWindow( parent, name ) //, flags )
28{ 29{
29#ifdef DESKTOP_VERSION 30#ifdef DESKTOP_VERSION
30 globalSstatusBarMainWindow = statusBar(); 31 globalSstatusBarMainWindow = statusBar();
31#endif 32#endif
32 setCaption( i18n( "KOpieMail/Pi" ) ); 33 setCaption( i18n( "KOpieMail/Pi" ) );
33 setToolBarsMovable( false ); 34 setToolBarsMovable( false );
34 //KABC::StdAddressBook::self(); 35 //KABC::StdAddressBook::self();
35 toolBar = new QToolBar( this ); 36 toolBar = new QToolBar( this );
36 menuBar = new QPEMenuBar( toolBar ); 37 menuBar = new QPEMenuBar( toolBar );
37 mailMenu = new QPopupMenu( menuBar ); 38 mailMenu = new QPopupMenu( menuBar );
38 menuBar->insertItem( i18n( "Mail" ), mailMenu ); 39 menuBar->insertItem( i18n( "Mail" ), mailMenu );
39 settingsMenu = new QPopupMenu( menuBar ); 40 settingsMenu = new QPopupMenu( menuBar );
40 menuBar->insertItem( i18n( "Settings" ), settingsMenu ); 41 menuBar->insertItem( i18n( "Settings" ), settingsMenu );
41 42
42 addToolBar( toolBar ); 43 addToolBar( toolBar );
43 toolBar->setHorizontalStretchable( true ); 44 toolBar->setHorizontalStretchable( true );
44 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), 45 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"),
45 0, 0, this ); 46 0, 0, this );
46 connect(getMail, SIGNAL( activated() ), 47 connect(getMail, SIGNAL( activated() ),
47 SLOT( slotGetAllMail() ) ); 48 SLOT( slotGetAllMail() ) );
48 getMail->addTo( mailMenu ); 49 getMail->addTo( mailMenu );
49 50
50 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), 51 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
51 0, 0, this ); 52 0, 0, this );
52 getMail->addTo( toolBar ); 53 getMail->addTo( toolBar );
53 getMail->addTo( mailMenu ); 54 getMail->addTo( mailMenu );
54 connect(getMail, SIGNAL( activated() ), 55 connect(getMail, SIGNAL( activated() ),
55 SLOT( slotGetMail() ) ); 56 SLOT( slotGetMail() ) );
56 57
57 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), 58 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
58 0, 0, this ); 59 0, 0, this );
59 composeMail->addTo( toolBar ); 60 composeMail->addTo( toolBar );
60 composeMail->addTo( mailMenu ); 61 composeMail->addTo( mailMenu );
61 62
62 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , 63 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
63 0, 0, this ); 64 0, 0, this );
64 sendQueued->addTo( toolBar ); 65 sendQueued->addTo( toolBar );
65 sendQueued->addTo( mailMenu ); 66 sendQueued->addTo( mailMenu );
66 67
67 /* 68 /*
68 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, 69 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
69 0, 0, this ); 70 0, 0, this );
70 syncFolders->addTo( toolBar ); 71 syncFolders->addTo( toolBar );
71 syncFolders->addTo( mailMenu ); 72 syncFolders->addTo( mailMenu );
72 */ 73 */
73 74
74 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , 75 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") ,
75 0, 0, this, 0, true ); 76 0, 0, this, 0, true );
76 showFolders->addTo( toolBar ); 77 showFolders->addTo( toolBar );
77 showFolders->addTo( mailMenu ); 78 showFolders->addTo( mailMenu );
78 showFolders->setOn( true ); 79 showFolders->setOn( true );
79 connect(showFolders, SIGNAL( toggled(bool) ), 80 connect(showFolders, SIGNAL( toggled(bool) ),
80 SLOT( slotShowFolders(bool) ) ); 81 SLOT( slotShowFolders(bool) ) );
81 82
82 /* 83 /*
83 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 84 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
84 0, 0, this ); 85 0, 0, this );
85 searchMails->addTo( toolBar ); 86 searchMails->addTo( toolBar );
86 searchMails->addTo( mailMenu ); 87 searchMails->addTo( mailMenu );
87 */ 88 */
88 89
89 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); 90 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
90 deleteMails->addTo( toolBar ); 91 deleteMails->addTo( toolBar );
91 deleteMails->addTo( mailMenu ); 92 deleteMails->addTo( mailMenu );
92 connect( deleteMails, SIGNAL( activated() ), 93 connect( deleteMails, SIGNAL( activated() ),
93 SLOT( slotDeleteMail() ) ); 94 SLOT( slotDeleteMail() ) );
94 95
95 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , 96 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") ,
96 0, 0, this ); 97 0, 0, this );
97 editSettings->addTo( settingsMenu ); 98 editSettings->addTo( settingsMenu );
98 connect( editSettings, SIGNAL( activated() ), 99 connect( editSettings, SIGNAL( activated() ),
99 SLOT( slotEditSettings() ) ); 100 SLOT( slotEditSettings() ) );
100 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 101 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
101 0, 0, this ); 102 0, 0, this );
102 editAccounts->addTo( settingsMenu ); 103 editAccounts->addTo( settingsMenu );
103 codecMenu = new QPopupMenu( menuBar ); 104 codecMenu = new QPopupMenu( menuBar );
104 codecMenu->insertItem( "Western (iso-8859-1)",0,0); 105 codecMenu->insertItem( "Western (iso-8859-1)",0,0);
105 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); 106 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1);
106 codecMenu->insertItem( "Western (iso-8859-15)",2,2); 107 codecMenu->insertItem( "Western (iso-8859-15)",2,2);
107 codecMenu->insertItem( "Chinese (big-5)",3,3); 108 codecMenu->insertItem( "Chinese (big-5)",3,3);
108 codecMenu->insertItem( "Unicode (utf-8)",4,4); 109 codecMenu->insertItem( "Unicode (utf-8)",4,4);
109 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); 110 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5);
110 //disabled 111 //disabled
111 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); 112 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu);
112 //setCentralWidget( view ); 113 //setCentralWidget( view );
113 114
114 QVBox* wrapperBox = new QVBox( this ); 115 QVBox* wrapperBox = new QVBox( this );
115 setCentralWidget( wrapperBox ); 116 setCentralWidget( wrapperBox );
116 117
117 // QWidget *view = new QWidget( wrapperBox ); 118 // QWidget *view = new QWidget( wrapperBox );
118 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 119 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
119 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 120 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
120 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 121 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
121 122
122 folderView = new AccountView( split ); 123 folderView = new AccountView( split );
123 folderView->header()->hide(); 124 folderView->header()->hide();
124 folderView->setRootIsDecorated( false ); 125 folderView->setRootIsDecorated( false );
125 folderView->addColumn( i18n( "Mailbox" ) ); 126 folderView->addColumn( i18n( "Mailbox" ) );
126 127
127 //layout->addWidget( folderView ); 128 //layout->addWidget( folderView );
128 129
129 mailView = new QListView( split ); 130 mailView = new QListView( split );
130 mailView->addColumn( i18n( " " ) ); 131 mailView->addColumn( i18n( " " ) );
131 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 132 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
132 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 133 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
133 mailView->addColumn( i18n( "Size" ),QListView::Manual); 134 mailView->addColumn( i18n( "Size" ),QListView::Manual);
134 mailView->addColumn( i18n( "Date" ),QListView::Manual); 135 mailView->addColumn( i18n( "Date" ),QListView::Manual);
135 mailView->setAllColumnsShowFocus(true); 136 mailView->setAllColumnsShowFocus(true);
136 //mailView->setSorting(-1); 137 //mailView->setSorting(-1);
137 mailView->setRootIsDecorated( false ); 138 mailView->setRootIsDecorated( false );
138 statusWidget = new StatusWidget( wrapperBox ); 139 statusWidget = new StatusWidget( wrapperBox );
139 statusWidget->hide(); 140 statusWidget->hide();
140 141
141 //layout->addWidget( mailView ); 142 //layout->addWidget( mailView );
142 //layout->setStretchFactor( folderView, 1 ); 143 //layout->setStretchFactor( folderView, 1 );
143 //layout->setStretchFactor( mailView, 2 ); 144 //layout->setStretchFactor( mailView, 2 );
144 145
145 slotAdjustLayout(); 146 slotAdjustLayout();
146#ifndef DESKTOP_VERSION 147#ifndef DESKTOP_VERSION
147 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 148 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
148 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 149 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
149#endif 150#endif
150 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 151 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
151 SLOT( mailLeftClicked(QListViewItem*) ) ); 152 SLOT( mailLeftClicked(QListViewItem*) ) );
152 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 153 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
153 SLOT( mailLeftClicked(QListViewItem*) ) ); 154 SLOT( mailLeftClicked(QListViewItem*) ) );
154 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 155 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
155 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 156 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
156 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 157 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
157 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 158 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
158 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 159 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
159 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 160 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
160// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 161// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
161 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 162 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
162 //mailView->setMultiSelection ( true ); 163 //mailView->setMultiSelection ( true );
163 mailView->setSelectionMode( QListView::Extended ); 164 mailView->setSelectionMode( QListView::Extended );
164 QValueList<int> list; 165 QValueList<int> list;
165 int fw = 100; 166 int fw = 100;
166 if ( QApplication::desktop()->width() > 320 ) 167 if ( QApplication::desktop()->width() > 320 )
167 fw = 50; 168 fw = 50;
168 list.append( fw ); 169 list.append( fw );
169 list.append( 100 ); 170 list.append( 100 );
170 split->setSizes( list ); 171 split->setSizes( list );
171 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 172 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
172 mailView->setShowSortIndicator ( true ); 173 mailView->setShowSortIndicator ( true );
173 QLabel *spacer = new QLabel( toolBar ); 174 QLabel *spacer = new QLabel( toolBar );
174 spacer->setBackgroundMode( QWidget::PaletteButton ); 175 spacer->setBackgroundMode( QWidget::PaletteButton );
175 toolBar->setStretchableWidget( spacer ); 176 toolBar->setStretchableWidget( spacer );
176 177
177 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); 178 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
178 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 179 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
179 if ( QApplication::desktop()->width() > 320 ) 180 if ( QApplication::desktop()->width() > 320 )
180 closeMail->addTo(toolBar); 181 closeMail->addTo(toolBar);
181 closeMail->addTo(mailMenu); 182 closeMail->addTo(mailMenu);
182 183
183 184
184 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 185 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
185 menuBar->insertItem( i18n( "Help" ), helpMenu ); 186 menuBar->insertItem( i18n( "Help" ), helpMenu );
186 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); 187 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this);
187 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 188 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
188 li->addTo(helpMenu); 189 li->addTo(helpMenu);
189 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); 190 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this);
190 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 191 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
191 li->addTo(helpMenu); 192 li->addTo(helpMenu);
192 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); 193 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this);
193 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 194 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
194 li->addTo(helpMenu); 195 li->addTo(helpMenu);
195 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); 196 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) );
196 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 197 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
197#ifdef DESKTOP_VERSION 198#ifdef DESKTOP_VERSION
198 resize ( 640, 480 ); 199 resize ( 640, 480 );
199#endif 200#endif
200} 201}
201 202
202MainWindow::~MainWindow() 203MainWindow::~MainWindow()
203{ 204{
204} 205}
205 206
206void MainWindow::slotSetCodec( int codec ) 207void MainWindow::slotSetCodec( int codec )
207{ 208{
208 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); 209 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false );
209 //qDebug("codec %d ", codec); 210 //qDebug("codec %d ", codec);
210 KOPrefs::instance()->mCurrentCodec = codec; 211 KOPrefs::instance()->mCurrentCodec = codec;
211 KOPrefs::instance()->isDirty = true; 212 KOPrefs::instance()->isDirty = true;
212 QString name; 213 QString name;
213 switch ( codec ) { 214 switch ( codec ) {
214 case 0: 215 case 0:
215 name = "iso-8859-1"; 216 name = "iso-8859-1";
216 break; 217 break;
217 case 1: 218 case 1:
218 name = "iso-8859-5"; 219 name = "iso-8859-5";
219 break; 220 break;
220 case 2: 221 case 2:
221 name = "iso-8859-15"; 222 name = "iso-8859-15";
222 break; 223 break;
223 case 3: 224 case 3:
224 name = "big-5"; 225 name = "big-5";
225 break; 226 break;
226 case 4: 227 case 4:
227 name = "utf-8"; 228 name = "utf-8";
228 break; 229 break;
229 case 5: 230 case 5:
230 name = KOPrefs::instance()->mSendCodec.lower(); 231 name = KOPrefs::instance()->mSendCodec.lower();
231 break; 232 break;
232 } 233 }
233 KOPrefs::instance()->mCurrentCodeName = name ; 234 KOPrefs::instance()->mCurrentCodeName = name ;
234 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); 235 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")");
235 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); 236 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true );
236} 237}
237void MainWindow::showLicence() 238void MainWindow::showLicence()
238{ 239{
239 KApplication::showLicence(); 240 KApplication::showLicence();
240} 241}
241void MainWindow::showAbout() 242void MainWindow::showAbout()
242{ 243{
243 QString version; 244 QString version;
244#include <../version> 245#include <../version>
245 246
246 QString cap = "About KOpieMail/Pi"; 247 QString cap = "About KOpieMail/Pi";
247 QString text =i18n("KOpieMail/Platform-independent\n") + 248 QString text =i18n("KOpieMail/Platform-independent\n") +
248 "(OM/Pi) " + version + " - " 249 "(OM/Pi) " + version + " - "
249 250
250#ifdef DESKTOP_VERSION 251#ifdef DESKTOP_VERSION
251 "Desktop Edition\n" 252 "Desktop Edition\n"
252#else 253#else
253 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 254 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
254#endif 255#endif
255 "www.pi-sync.net\n\n" 256 "www.pi-sync.net\n\n"
256 257
257 258
258 259
259"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" 260"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n"
260 "KOpieMail/Pi is based on Opie Mail\n" 261 "KOpieMail/Pi is based on Opie Mail\n"
261 "Copyright (c) Rajko Albrecht and the Opie team\n" 262 "Copyright (c) Rajko Albrecht and the Opie team\n"
262 "KOpieMail/Pi is licensed under the GPL\n" 263 "KOpieMail/Pi is licensed under the GPL\n"
263 "\n" 264 "\n"
264 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 265 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
265 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 266 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
266 "libEtPan has its own licence - see LibEtPan licence\n"; 267 "libEtPan has its own licence - see LibEtPan licence\n";
267 268
268 KApplication::showText( cap, text ); 269 KApplication::showText( cap, text );
269} 270}
270void MainWindow::showEtpanLicence() 271void MainWindow::showEtpanLicence()
271{ 272{
272 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 273 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
273 274
274} 275}
275void MainWindow::appMessage(const QCString &, const QByteArray &) 276void MainWindow::appMessage(const QCString &, const QByteArray &)
276{ 277{
277 qDebug("appMessage implemented by subclass"); 278 qDebug("appMessage implemented by subclass");
278} 279}
279 280
280void MainWindow::slotAdjustLayout() { 281void MainWindow::slotAdjustLayout() {
281 282
282 /* 283 /*
283 QWidget *d = QApplication::desktop(); 284 QWidget *d = QApplication::desktop();
284 285
285 if ( d->width() < d->height() ) { 286 if ( d->width() < d->height() ) {
286 layout->setDirection( QBoxLayout::TopToBottom ); 287 layout->setDirection( QBoxLayout::TopToBottom );
287 } else { 288 } else {
288 layout->setDirection( QBoxLayout::LeftToRight ); 289 layout->setDirection( QBoxLayout::LeftToRight );
289 } 290 }
290 */ 291 */
291} 292}
292 293
293void MainWindow::slotAdjustColumns() 294void MainWindow::slotAdjustColumns()
294{ 295{
295 bool hidden = folderView->isHidden(); 296 bool hidden = folderView->isHidden();
296 if ( hidden ) folderView->show(); 297 if ( hidden ) folderView->show();
297 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 298 folderView->setColumnWidth( 0, folderView->visibleWidth() );
298 if ( hidden ) folderView->hide(); 299 if ( hidden ) folderView->hide();
299 300
300 mailView->setColumnWidth( 0, 10 ); 301 mailView->setColumnWidth( 0, 10 );
301 mailView->setColumnWidth( 1, 100 ); 302 mailView->setColumnWidth( 1, 100 );
302 mailView->setColumnWidth( 2, 100 ); 303 mailView->setColumnWidth( 2, 100 );
303 mailView->setColumnWidth( 3, 50 ); 304 mailView->setColumnWidth( 3, 50 );
304 mailView->setColumnWidth( 4, 120 ); 305 mailView->setColumnWidth( 4, 120 );
305} 306}
306 307
307void MainWindow::slotEditSettings() 308void MainWindow::slotEditSettings()
308{ 309{
309} 310}
310 311
311void MainWindow::slotShowFolders( bool ) 312void MainWindow::slotShowFolders( bool )
312{ 313{
313 qDebug("not implemented: "); 314 qDebug("not implemented: ");
314} 315}
315 316
316void MainWindow::refreshMailView(const QValueList<RecMailP>&) 317void MainWindow::refreshMailView(const QValueList<RecMailP>&)
317{ 318{
318 qDebug("not implemented: "); 319 qDebug("not implemented: ");
319} 320}
320 321
321void MainWindow::mailLeftClicked(QListViewItem * ) 322void MainWindow::mailLeftClicked(QListViewItem * )
322{ 323{
323 qDebug("not implemented: "); 324 qDebug("not implemented: ");
324} 325}
325 326
326void MainWindow::displayMail() 327void MainWindow::displayMail()
327{ 328{
328 qDebug("not implemented: "); 329 qDebug("not implemented: ");
329} 330}
330 331
331void MainWindow::slotDeleteMail() 332void MainWindow::slotDeleteMail()
332{ 333{
333 qDebug("not implemented: "); 334 qDebug("not implemented: ");
334} 335}
335 336
336void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 337void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
337{ 338{
338 qDebug("not implemented: "); 339 qDebug("not implemented: ");
339} 340}
340 341
341void MainWindow::slotSendQueued() 342void MainWindow::slotSendQueued()
342{ 343{
343 qDebug("not implemented: "); 344 qDebug("not implemented: ");
344} 345}
345 346
346void MainWindow::slotEditAccounts() 347void MainWindow::slotEditAccounts()
347{ 348{
348 qDebug("not implemented: "); 349 qDebug("not implemented: ");
349} 350}
350 351
351void MainWindow::slotComposeMail() 352void MainWindow::slotComposeMail()
352{ 353{
353 qDebug("not implemented: "); 354 qDebug("not implemented: ");
354} 355}