summaryrefslogtreecommitdiff
path: root/noncore/net/mail
Unidiff
Diffstat (limited to 'noncore/net/mail') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp8
-rw-r--r--noncore/net/mail/composemail.cpp2
-rw-r--r--noncore/net/mail/editaccounts.cpp18
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp8
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp2
-rw-r--r--noncore/net/mail/mainwindow.cpp16
-rw-r--r--noncore/net/mail/viewmail.cpp6
7 files changed, 30 insertions, 30 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index c2185f2..64557ee 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -1,119 +1,119 @@
1 1
2#include "accountview.h" 2#include "accountview.h"
3#include "accountitem.h" 3#include "accountitem.h"
4#include "selectstore.h" 4#include "selectstore.h"
5 5
6/* OPIE */ 6/* OPIE */
7#include <libmailwrapper/settings.h> 7#include <libmailwrapper/settings.h>
8#include <libmailwrapper/mailwrapper.h> 8#include <libmailwrapper/mailwrapper.h>
9#include <libmailwrapper/mailtypes.h> 9#include <libmailwrapper/mailtypes.h>
10#include <libmailwrapper/abstractmail.h> 10#include <libmailwrapper/abstractmail.h>
11#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
12 12
13/* QT */ 13/* QT */
14#include <qmessagebox.h> 14#include <qmessagebox.h>
15#include <qpopupmenu.h> 15#include <qpopupmenu.h>
16 16
17AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) 17AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
18 : QListView( parent, name, flags ) 18 : QListView( parent, name, flags )
19{ 19{
20 connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), 20 connect( this, SIGNAL( selectionChanged(QListViewItem*) ),
21 SLOT( refresh( QListViewItem * ) ) ); 21 SLOT( refresh(QListViewItem*) ) );
22 connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, 22 connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
23 SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); 23 SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) );
24 setSorting(0); 24 setSorting(0);
25} 25}
26 26
27AccountView::~AccountView() 27AccountView::~AccountView()
28{ 28{
29 imapAccounts.clear(); 29 imapAccounts.clear();
30 mhAccounts.clear(); 30 mhAccounts.clear();
31} 31}
32 32
33void AccountView::slotContextMenu(int id) 33void AccountView::slotContextMenu(int id)
34{ 34{
35 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); 35 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
36 if (!view) return; 36 if (!view) return;
37 view->contextMenuSelected(id); 37 view->contextMenuSelected(id);
38} 38}
39 39
40void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) 40void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
41{ 41{
42 if (button==1) {return;} 42 if (button==1) {return;}
43 if (!item) return; 43 if (!item) return;
44 AccountViewItem *view = static_cast<AccountViewItem *>(item); 44 AccountViewItem *view = static_cast<AccountViewItem *>(item);
45 QPopupMenu*m = view->getContextMenu(); 45 QPopupMenu*m = view->getContextMenu();
46 if (!m) return; 46 if (!m) return;
47 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); 47 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
48 m->setFocus(); 48 m->setFocus();
49 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 49 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
50 delete m; 50 delete m;
51} 51}
52 52
53void AccountView::populate( QList<Account> list ) 53void AccountView::populate( QList<Account> list )
54{ 54{
55 clear(); 55 clear();
56 56
57 imapAccounts.clear(); 57 imapAccounts.clear();
58 mhAccounts.clear(); 58 mhAccounts.clear();
59 59
60 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); 60 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
61 61
62 Account *it; 62 Account *it;
63 for ( it = list.first(); it; it = list.next() ) 63 for ( it = list.first(); it; it = list.next() )
64 { 64 {
65 if ( it->getType().compare( "IMAP" ) == 0 ) 65 if ( it->getType().compare( "IMAP" ) == 0 )
66 { 66 {
67 IMAPaccount *imap = static_cast<IMAPaccount *>(it); 67 IMAPaccount *imap = static_cast<IMAPaccount *>(it);
68 qDebug( "added IMAP " + imap->getAccountName() ); 68 qDebug( "added IMAP " + imap->getAccountName() );
69 imapAccounts.append(new IMAPviewItem( imap, this )); 69 imapAccounts.append(new IMAPviewItem( imap, this ));
70 } 70 }
71 else if ( it->getType().compare( "POP3" ) == 0 ) 71 else if ( it->getType().compare( "POP3" ) == 0 )
72 { 72 {
73 POP3account *pop3 = static_cast<POP3account *>(it); 73 POP3account *pop3 = static_cast<POP3account *>(it);
74 qDebug( "added POP3 " + pop3->getAccountName() ); 74 qDebug( "added POP3 " + pop3->getAccountName() );
75 /* must not be hold 'cause it isn't required */ 75 /* must not be hold 'cause it isn't required */
76 (void) new POP3viewItem( pop3, this ); 76 (void) new POP3viewItem( pop3, this );
77 } 77 }
78 else if ( it->getType().compare( "NNTP" ) == 0 ) 78 else if ( it->getType().compare( "NNTP" ) == 0 )
79 { 79 {
80 NNTPaccount *nntp = static_cast<NNTPaccount *>(it); 80 NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
81 qDebug( "added NNTP " + nntp->getAccountName() ); 81 qDebug( "added NNTP " + nntp->getAccountName() );
82 /* must not be hold 'cause it isn't required */ 82 /* must not be hold 'cause it isn't required */
83 (void) new NNTPviewItem( nntp, this ); 83 (void) new NNTPviewItem( nntp, this );
84 } 84 }
85 } 85 }
86} 86}
87 87
88void AccountView::refresh(QListViewItem *item) 88void AccountView::refresh(QListViewItem *item)
89{ 89{
90 90
91 qDebug("AccountView refresh..."); 91 qDebug("AccountView refresh...");
92 if ( item ) 92 if ( item )
93 { 93 {
94 m_currentItem = item; 94 m_currentItem = item;
95 QList<RecMail> headerlist; 95 QList<RecMail> headerlist;
96 headerlist.setAutoDelete(true); 96 headerlist.setAutoDelete(true);
97 AccountViewItem *view = static_cast<AccountViewItem *>(item); 97 AccountViewItem *view = static_cast<AccountViewItem *>(item);
98 view->refresh(headerlist); 98 view->refresh(headerlist);
99 emit refreshMailview(&headerlist); 99 emit refreshMailview(&headerlist);
100 } 100 }
101} 101}
102 102
103void AccountView::refreshCurrent() 103void AccountView::refreshCurrent()
104{ 104{
105 m_currentItem = currentItem(); 105 m_currentItem = currentItem();
106 if ( !m_currentItem ) return; 106 if ( !m_currentItem ) return;
107 QList<RecMail> headerlist; 107 QList<RecMail> headerlist;
108 headerlist.setAutoDelete(true); 108 headerlist.setAutoDelete(true);
109 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 109 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
110 view->refresh(headerlist); 110 view->refresh(headerlist);
111 emit refreshMailview(&headerlist); 111 emit refreshMailview(&headerlist);
112} 112}
113 113
114void AccountView::refreshAll() 114void AccountView::refreshAll()
115{ 115{
116} 116}
117 117
118RecBody AccountView::fetchBody(const RecMail&aMail) 118RecBody AccountView::fetchBody(const RecMail&aMail)
119{ 119{
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 6708779..f51a8fe 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -1,161 +1,161 @@
1#include <qt.h> 1#include <qt.h>
2 2
3#include <opie2/ofiledialog.h> 3#include <opie2/ofiledialog.h>
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5#include <qpe/config.h> 5#include <qpe/config.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <qpe/contact.h> 7#include <qpe/contact.h>
8 8
9#include "composemail.h" 9#include "composemail.h"
10 10
11#include <libmailwrapper/smtpwrapper.h> 11#include <libmailwrapper/smtpwrapper.h>
12 12
13ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 13ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
14 : ComposeMailUI( parent, name, modal, flags ) 14 : ComposeMailUI( parent, name, modal, flags )
15{ 15{
16 settings = s; 16 settings = s;
17 17
18 QString vfilename = Global::applicationFileName("addressbook", 18 QString vfilename = Global::applicationFileName("addressbook",
19 "businesscard.vcf"); 19 "businesscard.vcf");
20 Contact c; 20 Contact c;
21 if (QFile::exists(vfilename)) { 21 if (QFile::exists(vfilename)) {
22 c = Contact::readVCard( vfilename )[0]; 22 c = Contact::readVCard( vfilename )[0];
23 } 23 }
24 24
25 QStringList mails = c.emailList(); 25 QStringList mails = c.emailList();
26 QString defmail = c.defaultEmail(); 26 QString defmail = c.defaultEmail();
27 27
28 if (defmail.length()!=0) { 28 if (defmail.length()!=0) {
29 fromBox->insertItem(defmail); 29 fromBox->insertItem(defmail);
30 } 30 }
31 QStringList::ConstIterator sit = mails.begin(); 31 QStringList::ConstIterator sit = mails.begin();
32 for (;sit!=mails.end();++sit) { 32 for (;sit!=mails.end();++sit) {
33 if ( (*sit)==defmail) 33 if ( (*sit)==defmail)
34 continue; 34 continue;
35 fromBox->insertItem((*sit)); 35 fromBox->insertItem((*sit));
36 } 36 }
37 senderNameEdit->setText(c.firstName()+" "+c.lastName()); 37 senderNameEdit->setText(c.firstName()+" "+c.lastName());
38 Config cfg( "mail" ); 38 Config cfg( "mail" );
39 cfg.setGroup( "Compose" ); 39 cfg.setGroup( "Compose" );
40 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 40 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
41 41
42 attList->addColumn( tr( "Name" ) ); 42 attList->addColumn( tr( "Name" ) );
43 attList->addColumn( tr( "Size" ) ); 43 attList->addColumn( tr( "Size" ) );
44 44
45 QList<Account> accounts = settings->getAccounts(); 45 QList<Account> accounts = settings->getAccounts();
46 46
47 Account *it; 47 Account *it;
48 for ( it = accounts.first(); it; it = accounts.next() ) { 48 for ( it = accounts.first(); it; it = accounts.next() ) {
49 if ( it->getType().compare( "SMTP" ) == 0 ) { 49 if ( it->getType().compare( "SMTP" ) == 0 ) {
50 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 50 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
51 smtpAccountBox->insertItem( smtp->getAccountName() ); 51 smtpAccountBox->insertItem( smtp->getAccountName() );
52 smtpAccounts.append( smtp ); 52 smtpAccounts.append( smtp );
53 } 53 }
54 } 54 }
55 55
56 if ( smtpAccounts.count() > 0 ) { 56 if ( smtpAccounts.count() > 0 ) {
57 fillValues( smtpAccountBox->currentItem() ); 57 fillValues( smtpAccountBox->currentItem() );
58 } else { 58 } else {
59 QMessageBox::information( this, tr( "Problem" ), 59 QMessageBox::information( this, tr( "Problem" ),
60 tr( "<p>Please create an SMTP account first.</p>" ), 60 tr( "<p>Please create an SMTP account first.</p>" ),
61 tr( "Ok" ) ); 61 tr( "Ok" ) );
62 return; 62 return;
63 } 63 }
64 64
65 connect( smtpAccountBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); 65 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
66 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 66 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
67 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 67 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
68 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 68 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
69 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 69 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
70 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 70 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
71 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 71 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
72} 72}
73 73
74void ComposeMail::pickAddress( QLineEdit *line ) 74void ComposeMail::pickAddress( QLineEdit *line )
75{ 75{
76 QString names = AddressPicker::getNames(); 76 QString names = AddressPicker::getNames();
77 if ( line->text().isEmpty() ) { 77 if ( line->text().isEmpty() ) {
78 line->setText( names ); 78 line->setText( names );
79 } else if ( !names.isEmpty() ) { 79 } else if ( !names.isEmpty() ) {
80 line->setText( line->text() + ", " + names ); 80 line->setText( line->text() + ", " + names );
81 } 81 }
82} 82}
83 83
84 84
85void ComposeMail::setTo( const QString & to ) 85void ComposeMail::setTo( const QString & to )
86{ 86{
87/* QString toline; 87/* QString toline;
88 QStringList toEntry = to; 88 QStringList toEntry = to;
89 for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) { 89 for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) {
90 toline += (*it); 90 toline += (*it);
91 } 91 }
92 toLine->setText( toline ); 92 toLine->setText( toline );
93*/ 93*/
94toLine->setText( to ); 94toLine->setText( to );
95} 95}
96 96
97void ComposeMail::setSubject( const QString & subject ) 97void ComposeMail::setSubject( const QString & subject )
98{ 98{
99 subjectLine->setText( subject ); 99 subjectLine->setText( subject );
100} 100}
101 101
102void ComposeMail::setInReplyTo( const QString & messageId ) 102void ComposeMail::setInReplyTo( const QString & messageId )
103{ 103{
104 104
105} 105}
106 106
107void ComposeMail::setMessage( const QString & text ) 107void ComposeMail::setMessage( const QString & text )
108{ 108{
109 message->setText( text ); 109 message->setText( text );
110} 110}
111 111
112 112
113void ComposeMail::pickAddressTo() 113void ComposeMail::pickAddressTo()
114{ 114{
115 pickAddress( toLine ); 115 pickAddress( toLine );
116} 116}
117 117
118void ComposeMail::pickAddressCC() 118void ComposeMail::pickAddressCC()
119{ 119{
120 pickAddress( ccLine ); 120 pickAddress( ccLine );
121} 121}
122 122
123void ComposeMail::pickAddressBCC() 123void ComposeMail::pickAddressBCC()
124{ 124{
125 pickAddress( bccLine ); 125 pickAddress( bccLine );
126} 126}
127 127
128void ComposeMail::pickAddressReply() 128void ComposeMail::pickAddressReply()
129{ 129{
130 pickAddress( replyLine ); 130 pickAddress( replyLine );
131} 131}
132 132
133void ComposeMail::fillValues( int current ) 133void ComposeMail::fillValues( int current )
134{ 134{
135#if 0 135#if 0
136 SMTPaccount *smtp = smtpAccounts.at( current ); 136 SMTPaccount *smtp = smtpAccounts.at( current );
137 ccLine->clear(); 137 ccLine->clear();
138 if ( smtp->getUseCC() ) { 138 if ( smtp->getUseCC() ) {
139 ccLine->setText( smtp->getCC() ); 139 ccLine->setText( smtp->getCC() );
140 } 140 }
141 bccLine->clear(); 141 bccLine->clear();
142 if ( smtp->getUseBCC() ) { 142 if ( smtp->getUseBCC() ) {
143 bccLine->setText( smtp->getBCC() ); 143 bccLine->setText( smtp->getBCC() );
144 } 144 }
145 replyLine->clear(); 145 replyLine->clear();
146 if ( smtp->getUseReply() ) { 146 if ( smtp->getUseReply() ) {
147 replyLine->setText( smtp->getReply() ); 147 replyLine->setText( smtp->getReply() );
148 } 148 }
149 sigMultiLine->setText( smtp->getSignature() ); 149 sigMultiLine->setText( smtp->getSignature() );
150#endif 150#endif
151} 151}
152 152
153void ComposeMail::slotAdjustColumns() 153void ComposeMail::slotAdjustColumns()
154{ 154{
155 int currPage = tabWidget->currentPageIndex(); 155 int currPage = tabWidget->currentPageIndex();
156 156
157 tabWidget->showPage( attachTab ); 157 tabWidget->showPage( attachTab );
158 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 158 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
159 attList->setColumnWidth( 1, 80 ); 159 attList->setColumnWidth( 1, 80 );
160 160
161 tabWidget->setCurrentPage( currPage ); 161 tabWidget->setCurrentPage( currPage );
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 60bffa5..edeb1de 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -191,342 +191,342 @@ void EditAccounts::slotDeleteAccount( Account *account )
191 191
192void EditAccounts::slotEditMail() 192void EditAccounts::slotEditMail()
193{ 193{
194 qDebug( "Edit Mail Account" ); 194 qDebug( "Edit Mail Account" );
195 if ( !mailList->currentItem() ) 195 if ( !mailList->currentItem() )
196 { 196 {
197 QMessageBox::information( this, tr( "Error" ), 197 QMessageBox::information( this, tr( "Error" ),
198 tr( "<p>Please select an account.</p>" ), 198 tr( "<p>Please select an account.</p>" ),
199 tr( "Ok" ) ); 199 tr( "Ok" ) );
200 return; 200 return;
201 } 201 }
202 202
203 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 203 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
204 slotEditAccount( a ); 204 slotEditAccount( a );
205} 205}
206 206
207void EditAccounts::slotDeleteMail() 207void EditAccounts::slotDeleteMail()
208{ 208{
209 if ( !mailList->currentItem() ) 209 if ( !mailList->currentItem() )
210 { 210 {
211 QMessageBox::information( this, tr( "Error" ), 211 QMessageBox::information( this, tr( "Error" ),
212 tr( "<p>Please select an account.</p>" ), 212 tr( "<p>Please select an account.</p>" ),
213 tr( "Ok" ) ); 213 tr( "Ok" ) );
214 return; 214 return;
215 } 215 }
216 216
217 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 217 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
218 slotDeleteAccount( a ); 218 slotDeleteAccount( a );
219} 219}
220 220
221void EditAccounts::slotNewNews() 221void EditAccounts::slotNewNews()
222{ 222{
223 qDebug( "New News Account" ); 223 qDebug( "New News Account" );
224 slotNewAccount( "NNTP" ); 224 slotNewAccount( "NNTP" );
225} 225}
226 226
227void EditAccounts::slotEditNews() 227void EditAccounts::slotEditNews()
228{ 228{
229 qDebug( "Edit News Account" ); 229 qDebug( "Edit News Account" );
230 if ( !newsList->currentItem() ) 230 if ( !newsList->currentItem() )
231 { 231 {
232 QMessageBox::information( this, tr( "Error" ), 232 QMessageBox::information( this, tr( "Error" ),
233 tr( "<p>Please select an account.</p>" ), 233 tr( "<p>Please select an account.</p>" ),
234 tr( "Ok" ) ); 234 tr( "Ok" ) );
235 return; 235 return;
236 } 236 }
237 237
238 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 238 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
239 slotEditAccount( a ); 239 slotEditAccount( a );
240} 240}
241 241
242void EditAccounts::slotDeleteNews() 242void EditAccounts::slotDeleteNews()
243{ 243{
244 qDebug( "Delete News Account" ); 244 qDebug( "Delete News Account" );
245 if ( !newsList->currentItem() ) 245 if ( !newsList->currentItem() )
246 { 246 {
247 QMessageBox::information( this, tr( "Error" ), 247 QMessageBox::information( this, tr( "Error" ),
248 tr( "<p>Please select an account.</p>" ), 248 tr( "<p>Please select an account.</p>" ),
249 tr( "Ok" ) ); 249 tr( "Ok" ) );
250 return; 250 return;
251 } 251 }
252 252
253 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 253 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
254 slotDeleteAccount( a ); 254 slotDeleteAccount( a );
255} 255}
256 256
257void EditAccounts::slotAdjustColumns() 257void EditAccounts::slotAdjustColumns()
258{ 258{
259 int currPage = configTab->currentPageIndex(); 259 int currPage = configTab->currentPageIndex();
260 260
261 configTab->showPage( mailTab ); 261 configTab->showPage( mailTab );
262 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); 262 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
263 mailList->setColumnWidth( 1, 50 ); 263 mailList->setColumnWidth( 1, 50 );
264 264
265 configTab->showPage( newsTab ); 265 configTab->showPage( newsTab );
266 newsList->setColumnWidth( 0, newsList->visibleWidth() ); 266 newsList->setColumnWidth( 0, newsList->visibleWidth() );
267 267
268 configTab->setCurrentPage( currPage ); 268 configTab->setCurrentPage( currPage );
269} 269}
270 270
271void EditAccounts::accept() 271void EditAccounts::accept()
272{ 272{
273 settings->saveAccounts(); 273 settings->saveAccounts();
274 274
275 QDialog::accept(); 275 QDialog::accept();
276} 276}
277 277
278/** 278/**
279 * SelectMailType 279 * SelectMailType
280 */ 280 */
281 281
282SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) 282SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags )
283 : SelectMailTypeUI( parent, name, modal, flags ) 283 : SelectMailTypeUI( parent, name, modal, flags )
284{ 284{
285 selected = selection; 285 selected = selection;
286 selected->replace( 0, selected->length(), typeBox->currentText() ); 286 selected->replace( 0, selected->length(), typeBox->currentText() );
287 connect( typeBox, SIGNAL( activated( const QString & ) ), SLOT( slotSelection( const QString & ) ) ); 287 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) );
288} 288}
289 289
290void SelectMailType::slotSelection( const QString &sel ) 290void SelectMailType::slotSelection( const QString &sel )
291{ 291{
292 selected->replace( 0, selected->length(), sel ); 292 selected->replace( 0, selected->length(), sel );
293} 293}
294 294
295/** 295/**
296 * IMAPconfig 296 * IMAPconfig
297 */ 297 */
298 298
299IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 299IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
300 : IMAPconfigUI( parent, name, modal, flags ) 300 : IMAPconfigUI( parent, name, modal, flags )
301{ 301{
302 data = account; 302 data = account;
303 303
304 fillValues(); 304 fillValues();
305 305
306 connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); 306 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
307 ComboBox1->insertItem( "Only if available", 0 ); 307 ComboBox1->insertItem( "Only if available", 0 );
308 ComboBox1->insertItem( "Always, Negotiated", 1 ); 308 ComboBox1->insertItem( "Always, Negotiated", 1 );
309 ComboBox1->insertItem( "Connect on secure port", 2 ); 309 ComboBox1->insertItem( "Connect on secure port", 2 );
310 ComboBox1->insertItem( "Run command instead", 3 ); 310 ComboBox1->insertItem( "Run command instead", 3 );
311 CommandEdit->hide(); 311 CommandEdit->hide();
312 ComboBox1->setCurrentItem( data->ConnectionType() ); 312 ComboBox1->setCurrentItem( data->ConnectionType() );
313} 313}
314 314
315void IMAPconfig::slotConnectionToggle( int index ) 315void IMAPconfig::slotConnectionToggle( int index )
316{ 316{
317 if ( index == 2 ) 317 if ( index == 2 )
318 { 318 {
319 portLine->setText( IMAP_SSL_PORT ); 319 portLine->setText( IMAP_SSL_PORT );
320 } 320 }
321 else if ( index == 3 ) 321 else if ( index == 3 )
322 { 322 {
323 portLine->setText( IMAP_PORT ); 323 portLine->setText( IMAP_PORT );
324 CommandEdit->show(); 324 CommandEdit->show();
325 } 325 }
326 else 326 else
327 { 327 {
328 portLine->setText( IMAP_PORT ); 328 portLine->setText( IMAP_PORT );
329 } 329 }
330} 330}
331 331
332void IMAPconfig::fillValues() 332void IMAPconfig::fillValues()
333{ 333{
334 accountLine->setText( data->getAccountName() ); 334 accountLine->setText( data->getAccountName() );
335 serverLine->setText( data->getServer() ); 335 serverLine->setText( data->getServer() );
336 portLine->setText( data->getPort() ); 336 portLine->setText( data->getPort() );
337 ComboBox1->setCurrentItem( data->ConnectionType() ); 337 ComboBox1->setCurrentItem( data->ConnectionType() );
338 userLine->setText( data->getUser() ); 338 userLine->setText( data->getUser() );
339 passLine->setText( data->getPassword() ); 339 passLine->setText( data->getPassword() );
340 prefixLine->setText(data->getPrefix()); 340 prefixLine->setText(data->getPrefix());
341} 341}
342 342
343void IMAPconfig::accept() 343void IMAPconfig::accept()
344{ 344{
345 data->setAccountName( accountLine->text() ); 345 data->setAccountName( accountLine->text() );
346 data->setServer( serverLine->text() ); 346 data->setServer( serverLine->text() );
347 data->setPort( portLine->text() ); 347 data->setPort( portLine->text() );
348 data->setConnectionType( ComboBox1->currentItem() ); 348 data->setConnectionType( ComboBox1->currentItem() );
349 data->setUser( userLine->text() ); 349 data->setUser( userLine->text() );
350 data->setPassword( passLine->text() ); 350 data->setPassword( passLine->text() );
351 data->setPrefix(prefixLine->text()); 351 data->setPrefix(prefixLine->text());
352 352
353 QDialog::accept(); 353 QDialog::accept();
354} 354}
355 355
356/** 356/**
357 * POP3config 357 * POP3config
358 */ 358 */
359 359
360POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 360POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
361 : POP3configUI( parent, name, modal, flags ) 361 : POP3configUI( parent, name, modal, flags )
362{ 362{
363 data = account; 363 data = account;
364 fillValues(); 364 fillValues();
365 365
366 connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); 366 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
367 ComboBox1->insertItem( "Only if available", 0 ); 367 ComboBox1->insertItem( "Only if available", 0 );
368 ComboBox1->insertItem( "Always, Negotiated", 1 ); 368 ComboBox1->insertItem( "Always, Negotiated", 1 );
369 ComboBox1->insertItem( "Connect on secure port", 2 ); 369 ComboBox1->insertItem( "Connect on secure port", 2 );
370 ComboBox1->insertItem( "Run command instead", 3 ); 370 ComboBox1->insertItem( "Run command instead", 3 );
371 CommandEdit->hide(); 371 CommandEdit->hide();
372 ComboBox1->setCurrentItem( data->ConnectionType() ); 372 ComboBox1->setCurrentItem( data->ConnectionType() );
373} 373}
374 374
375void POP3config::slotConnectionToggle( int index ) 375void POP3config::slotConnectionToggle( int index )
376{ 376{
377 // 2 is ssl connection 377 // 2 is ssl connection
378 if ( index == 2 ) 378 if ( index == 2 )
379 { 379 {
380 portLine->setText( POP3_SSL_PORT ); 380 portLine->setText( POP3_SSL_PORT );
381 } 381 }
382 else if ( index == 3 ) 382 else if ( index == 3 )
383 { 383 {
384 portLine->setText( POP3_PORT ); 384 portLine->setText( POP3_PORT );
385 CommandEdit->show(); 385 CommandEdit->show();
386 } 386 }
387 else 387 else
388 { 388 {
389 portLine->setText( POP3_PORT ); 389 portLine->setText( POP3_PORT );
390 } 390 }
391} 391}
392 392
393void POP3config::fillValues() 393void POP3config::fillValues()
394{ 394{
395 accountLine->setText( data->getAccountName() ); 395 accountLine->setText( data->getAccountName() );
396 serverLine->setText( data->getServer() ); 396 serverLine->setText( data->getServer() );
397 portLine->setText( data->getPort() ); 397 portLine->setText( data->getPort() );
398 ComboBox1->setCurrentItem( data->ConnectionType() ); 398 ComboBox1->setCurrentItem( data->ConnectionType() );
399 userLine->setText( data->getUser() ); 399 userLine->setText( data->getUser() );
400 passLine->setText( data->getPassword() ); 400 passLine->setText( data->getPassword() );
401} 401}
402 402
403void POP3config::accept() 403void POP3config::accept()
404{ 404{
405 data->setAccountName( accountLine->text() ); 405 data->setAccountName( accountLine->text() );
406 data->setServer( serverLine->text() ); 406 data->setServer( serverLine->text() );
407 data->setPort( portLine->text() ); 407 data->setPort( portLine->text() );
408 data->setConnectionType( ComboBox1->currentItem() ); 408 data->setConnectionType( ComboBox1->currentItem() );
409 data->setUser( userLine->text() ); 409 data->setUser( userLine->text() );
410 data->setPassword( passLine->text() ); 410 data->setPassword( passLine->text() );
411 411
412 QDialog::accept(); 412 QDialog::accept();
413} 413}
414 414
415/** 415/**
416 * SMTPconfig 416 * SMTPconfig
417 */ 417 */
418 418
419SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 419SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
420 : SMTPconfigUI( parent, name, modal, flags ) 420 : SMTPconfigUI( parent, name, modal, flags )
421{ 421{
422 data = account; 422 data = account;
423 423
424 connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); 424 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
425 connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); 425 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
426 426
427 fillValues(); 427 fillValues();
428 428
429 connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); 429 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
430 ComboBox1->insertItem( "Only if available", 0 ); 430 ComboBox1->insertItem( "Only if available", 0 );
431 ComboBox1->insertItem( "Always, Negotiated", 1 ); 431 ComboBox1->insertItem( "Always, Negotiated", 1 );
432 ComboBox1->insertItem( "Connect on secure port", 2 ); 432 ComboBox1->insertItem( "Connect on secure port", 2 );
433 ComboBox1->insertItem( "Run command instead", 3 ); 433 ComboBox1->insertItem( "Run command instead", 3 );
434 CommandEdit->hide(); 434 CommandEdit->hide();
435 ComboBox1->setCurrentItem( data->ConnectionType() ); 435 ComboBox1->setCurrentItem( data->ConnectionType() );
436} 436}
437 437
438void SMTPconfig::slotConnectionToggle( int index ) 438void SMTPconfig::slotConnectionToggle( int index )
439{ 439{
440 // 2 is ssl connection 440 // 2 is ssl connection
441 if ( index == 2 ) 441 if ( index == 2 )
442 { 442 {
443 portLine->setText( SMTP_SSL_PORT ); 443 portLine->setText( SMTP_SSL_PORT );
444 } 444 }
445 else if ( index == 3 ) 445 else if ( index == 3 )
446 { 446 {
447 portLine->setText( SMTP_PORT ); 447 portLine->setText( SMTP_PORT );
448 CommandEdit->show(); 448 CommandEdit->show();
449 } 449 }
450 else 450 else
451 { 451 {
452 portLine->setText( SMTP_PORT ); 452 portLine->setText( SMTP_PORT );
453 } 453 }
454} 454}
455 455
456void SMTPconfig::fillValues() 456void SMTPconfig::fillValues()
457{ 457{
458 accountLine->setText( data->getAccountName() ); 458 accountLine->setText( data->getAccountName() );
459 serverLine->setText( data->getServer() ); 459 serverLine->setText( data->getServer() );
460 portLine->setText( data->getPort() ); 460 portLine->setText( data->getPort() );
461 ComboBox1->setCurrentItem( data->ConnectionType() ); 461 ComboBox1->setCurrentItem( data->ConnectionType() );
462 loginBox->setChecked( data->getLogin() ); 462 loginBox->setChecked( data->getLogin() );
463 userLine->setText( data->getUser() ); 463 userLine->setText( data->getUser() );
464 passLine->setText( data->getPassword() ); 464 passLine->setText( data->getPassword() );
465} 465}
466 466
467void SMTPconfig::accept() 467void SMTPconfig::accept()
468{ 468{
469 data->setAccountName( accountLine->text() ); 469 data->setAccountName( accountLine->text() );
470 data->setServer( serverLine->text() ); 470 data->setServer( serverLine->text() );
471 data->setPort( portLine->text() ); 471 data->setPort( portLine->text() );
472 data->setConnectionType( ComboBox1->currentItem() ); 472 data->setConnectionType( ComboBox1->currentItem() );
473 data->setLogin( loginBox->isChecked() ); 473 data->setLogin( loginBox->isChecked() );
474 data->setUser( userLine->text() ); 474 data->setUser( userLine->text() );
475 data->setPassword( passLine->text() ); 475 data->setPassword( passLine->text() );
476 476
477 QDialog::accept(); 477 QDialog::accept();
478} 478}
479 479
480/** 480/**
481 * NNTPconfig 481 * NNTPconfig
482 */ 482 */
483 483
484NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 484NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
485 : NNTPconfigUI( parent, name, modal, flags ) 485 : NNTPconfigUI( parent, name, modal, flags )
486{ 486{
487 data = account; 487 data = account;
488 488
489 connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); 489 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
490 connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); 490 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
491 491
492 fillValues(); 492 fillValues();
493 493
494 connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); 494 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
495} 495}
496 496
497void NNTPconfig::slotSSL( bool enabled ) 497void NNTPconfig::slotSSL( bool enabled )
498{ 498{
499 if ( enabled ) 499 if ( enabled )
500 { 500 {
501 portLine->setText( NNTP_SSL_PORT ); 501 portLine->setText( NNTP_SSL_PORT );
502 } 502 }
503 else 503 else
504 { 504 {
505 portLine->setText( NNTP_PORT ); 505 portLine->setText( NNTP_PORT );
506 } 506 }
507} 507}
508 508
509void NNTPconfig::fillValues() 509void NNTPconfig::fillValues()
510{ 510{
511 accountLine->setText( data->getAccountName() ); 511 accountLine->setText( data->getAccountName() );
512 serverLine->setText( data->getServer() ); 512 serverLine->setText( data->getServer() );
513 portLine->setText( data->getPort() ); 513 portLine->setText( data->getPort() );
514 sslBox->setChecked( data->getSSL() ); 514 sslBox->setChecked( data->getSSL() );
515 loginBox->setChecked( data->getLogin() ); 515 loginBox->setChecked( data->getLogin() );
516 userLine->setText( data->getUser() ); 516 userLine->setText( data->getUser() );
517 passLine->setText( data->getPassword() ); 517 passLine->setText( data->getPassword() );
518} 518}
519 519
520void NNTPconfig::accept() 520void NNTPconfig::accept()
521{ 521{
522 data->setAccountName( accountLine->text() ); 522 data->setAccountName( accountLine->text() );
523 data->setServer( serverLine->text() ); 523 data->setServer( serverLine->text() );
524 data->setPort( portLine->text() ); 524 data->setPort( portLine->text() );
525 data->setSSL( sslBox->isChecked() ); 525 data->setSSL( sslBox->isChecked() );
526 data->setLogin( loginBox->isChecked() ); 526 data->setLogin( loginBox->isChecked() );
527 data->setUser( userLine->text() ); 527 data->setUser( userLine->text() );
528 data->setPassword( passLine->text() ); 528 data->setPassword( passLine->text() );
529 529
530 QDialog::accept(); 530 QDialog::accept();
531} 531}
532 532
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index dfc00d8..df7f773 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
@@ -229,196 +229,196 @@ encodedString* MHwrapper::fetchRawBody(const RecMail&mail)
229 if (r!=MAIL_NO_ERROR) { 229 if (r!=MAIL_NO_ERROR) {
230 qDebug("error selecting folder!"); 230 qDebug("error selecting folder!");
231 return result; 231 return result;
232 } 232 }
233 r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg); 233 r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg);
234 if (r != MAIL_NO_ERROR) { 234 if (r != MAIL_NO_ERROR) {
235 Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); 235 Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber()));
236 return 0; 236 return 0;
237 } 237 }
238 r = mailmessage_fetch(msg,&data,&size); 238 r = mailmessage_fetch(msg,&data,&size);
239 if (r != MAIL_NO_ERROR) { 239 if (r != MAIL_NO_ERROR) {
240 Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); 240 Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber()));
241 if (msg) mailmessage_free(msg); 241 if (msg) mailmessage_free(msg);
242 return 0; 242 return 0;
243 } 243 }
244 result = new encodedString(data,size); 244 result = new encodedString(data,size);
245 if (msg) mailmessage_free(msg); 245 if (msg) mailmessage_free(msg);
246 return result; 246 return result;
247} 247}
248 248
249void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) 249void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target)
250{ 250{
251 QString f = buildPath(mailbox); 251 QString f = buildPath(mailbox);
252 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 252 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
253 if (r!=MAIL_NO_ERROR) { 253 if (r!=MAIL_NO_ERROR) {
254 qDebug("deleteMails: error selecting folder!"); 254 qDebug("deleteMails: error selecting folder!");
255 return; 255 return;
256 } 256 }
257 RecMail*c = 0; 257 RecMail*c = 0;
258 for (unsigned int i=0; i < target.count();++i) { 258 for (unsigned int i=0; i < target.count();++i) {
259 c = target.at(i); 259 c = target.at(i);
260 r = mailsession_remove_message(m_storage->sto_session,c->getNumber()); 260 r = mailsession_remove_message(m_storage->sto_session,c->getNumber());
261 if (r != MAIL_NO_ERROR) { 261 if (r != MAIL_NO_ERROR) {
262 qDebug("error deleting mail"); 262 qDebug("error deleting mail");
263 break; 263 break;
264 } 264 }
265 } 265 }
266} 266}
267 267
268int MHwrapper::deleteAllMail(const Folder*tfolder) 268int MHwrapper::deleteAllMail(const Folder*tfolder)
269{ 269{
270 init_storage(); 270 init_storage();
271 if (!m_storage) { 271 if (!m_storage) {
272 return 0; 272 return 0;
273 } 273 }
274 int res = 1; 274 int res = 1;
275 if (!tfolder) return 0; 275 if (!tfolder) return 0;
276 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 276 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
277 if (r!=MAIL_NO_ERROR) { 277 if (r!=MAIL_NO_ERROR) {
278 qDebug("error selecting folder!"); 278 qDebug("error selecting folder!");
279 return 0; 279 return 0;
280 } 280 }
281 mailmessage_list*l=0; 281 mailmessage_list*l=0;
282 r = mailsession_get_messages_list(m_storage->sto_session,&l); 282 r = mailsession_get_messages_list(m_storage->sto_session,&l);
283 if (r != MAIL_NO_ERROR) { 283 if (r != MAIL_NO_ERROR) {
284 qDebug("Error message list"); 284 qDebug("Error message list");
285 res = 0; 285 res = 0;
286 } 286 }
287 unsigned j = 0; 287 unsigned j = 0;
288 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { 288 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
289 mailmessage * msg; 289 mailmessage * msg;
290 msg = (mailmessage*)carray_get(l->msg_tab, i); 290 msg = (mailmessage*)carray_get(l->msg_tab, i);
291 j = msg->msg_index; 291 j = msg->msg_index;
292 r = mailsession_remove_message(m_storage->sto_session,j); 292 r = mailsession_remove_message(m_storage->sto_session,j);
293 if (r != MAIL_NO_ERROR) { 293 if (r != MAIL_NO_ERROR) {
294 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 294 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
295 res = 0; 295 res = 0;
296 break; 296 break;
297 } 297 }
298 } 298 }
299 if (l) mailmessage_list_free(l); 299 if (l) mailmessage_list_free(l);
300 return res; 300 return res;
301} 301}
302 302
303int MHwrapper::deleteMbox(const Folder*tfolder) 303int MHwrapper::deleteMbox(const Folder*tfolder)
304{ 304{
305 init_storage(); 305 init_storage();
306 if (!m_storage) { 306 if (!m_storage) {
307 return 0; 307 return 0;
308 } 308 }
309 if (!tfolder) return 0; 309 if (!tfolder) return 0;
310 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; 310 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0;
311 311
312 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 312 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
313 313
314 if (r != MAIL_NO_ERROR) { 314 if (r != MAIL_NO_ERROR) {
315 qDebug("error deleting mail box"); 315 qDebug("error deleting mail box");
316 return 0; 316 return 0;
317 } 317 }
318 QString cmd = "rm -rf "+tfolder->getName(); 318 QString cmd = "rm -rf "+tfolder->getName();
319 QStringList command; 319 QStringList command;
320 command << "/bin/sh"; 320 command << "/bin/sh";
321 command << "-c"; 321 command << "-c";
322 command << cmd.latin1(); 322 command << cmd.latin1();
323 OProcess *process = new OProcess(); 323 OProcess *process = new OProcess();
324 324
325 connect(process, SIGNAL(processExited(OProcess *)), 325 connect(process, SIGNAL(processExited(OProcess*)),
326 this, SLOT( processEnded(OProcess *))); 326 this, SLOT( processEnded(OProcess*)));
327 connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), 327 connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)),
328 this, SLOT( oprocessStderr(OProcess *, char *, int))); 328 this, SLOT( oprocessStderr(OProcess*,char*,int)));
329 329
330 *process << command; 330 *process << command;
331 removeMboxfailed = false; 331 removeMboxfailed = false;
332 if(!process->start(OProcess::Block, OProcess::All) ) { 332 if(!process->start(OProcess::Block, OProcess::All) ) {
333 qDebug("could not start process"); 333 qDebug("could not start process");
334 return 0; 334 return 0;
335 } 335 }
336 qDebug("mail box deleted"); 336 qDebug("mail box deleted");
337 return 1; 337 return 1;
338} 338}
339 339
340void MHwrapper::processEnded(OProcess *p) 340void MHwrapper::processEnded(OProcess *p)
341{ 341{
342 if (p) delete p; 342 if (p) delete p;
343} 343}
344 344
345void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) 345void MHwrapper::oprocessStderr(OProcess*, char *buffer, int )
346{ 346{
347 QString lineStr = buffer; 347 QString lineStr = buffer;
348 QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); 348 QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") );
349 removeMboxfailed = true; 349 removeMboxfailed = true;
350} 350}
351 351
352void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 352void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
353{ 353{
354 init_storage(); 354 init_storage();
355 if (!m_storage) { 355 if (!m_storage) {
356 return; 356 return;
357 } 357 }
358 target_stat.message_count = 0; 358 target_stat.message_count = 0;
359 target_stat.message_unseen = 0; 359 target_stat.message_unseen = 0;
360 target_stat.message_recent = 0; 360 target_stat.message_recent = 0;
361 QString f = buildPath(mailbox); 361 QString f = buildPath(mailbox);
362 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, 362 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count,
363 &target_stat.message_recent,&target_stat.message_unseen); 363 &target_stat.message_recent,&target_stat.message_unseen);
364 if (r != MAIL_NO_ERROR) { 364 if (r != MAIL_NO_ERROR) {
365 Global::statusMessage(tr("Error retrieving status")); 365 Global::statusMessage(tr("Error retrieving status"));
366 } 366 }
367} 367}
368 368
369const QString&MHwrapper::getType()const 369const QString&MHwrapper::getType()const
370{ 370{
371 return wrapperType; 371 return wrapperType;
372} 372}
373 373
374const QString&MHwrapper::getName()const 374const QString&MHwrapper::getName()const
375{ 375{
376 return MHName; 376 return MHName;
377} 377}
378void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 378void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
379{ 379{
380 init_storage(); 380 init_storage();
381 if (!m_storage) { 381 if (!m_storage) {
382 return; 382 return;
383 } 383 }
384 if (targetWrapper != this) { 384 if (targetWrapper != this) {
385 qDebug("Using generic"); 385 qDebug("Using generic");
386 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); 386 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
387 return; 387 return;
388 } 388 }
389 qDebug("Using internal routines for move/copy"); 389 qDebug("Using internal routines for move/copy");
390 QString tf = buildPath(targetFolder); 390 QString tf = buildPath(targetFolder);
391 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); 391 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1());
392 if (r != MAIL_NO_ERROR) { 392 if (r != MAIL_NO_ERROR) {
393 qDebug("Error selecting source mailbox"); 393 qDebug("Error selecting source mailbox");
394 return; 394 return;
395 } 395 }
396 if (moveit) { 396 if (moveit) {
397 r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); 397 r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1());
398 } else { 398 } else {
399 r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); 399 r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1());
400 } 400 }
401 if (r != MAIL_NO_ERROR) { 401 if (r != MAIL_NO_ERROR) {
402 qDebug("Error copy/moving mail internal (%i)",r); 402 qDebug("Error copy/moving mail internal (%i)",r);
403 } 403 }
404} 404}
405 405
406void MHwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 406void MHwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
407{ 407{
408 init_storage(); 408 init_storage();
409 if (!m_storage) { 409 if (!m_storage) {
410 return; 410 return;
411 } 411 }
412 if (targetWrapper != this) { 412 if (targetWrapper != this) {
413 qDebug("Using generic"); 413 qDebug("Using generic");
414 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); 414 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
415 return; 415 return;
416 } 416 }
417 if (!fromFolder) return; 417 if (!fromFolder) return;
418 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); 418 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1());
419 if (r!=MAIL_NO_ERROR) { 419 if (r!=MAIL_NO_ERROR) {
420 qDebug("error selecting source folder!"); 420 qDebug("error selecting source folder!");
421 return; 421 return;
422 } 422 }
423 QString tf = buildPath(targetFolder); 423 QString tf = buildPath(targetFolder);
424 mailmessage_list*l=0; 424 mailmessage_list*l=0;
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index a3c68ae..d75d52a 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -1,131 +1,131 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <sys/stat.h> 2#include <sys/stat.h>
3#include <sys/types.h> 3#include <sys/types.h>
4#include <unistd.h> 4#include <unistd.h>
5#include <fcntl.h> 5#include <fcntl.h>
6#include <string.h> 6#include <string.h>
7#include <qdir.h> 7#include <qdir.h>
8#include <qt.h> 8#include <qt.h>
9#include <qmessagebox.h> 9#include <qmessagebox.h>
10 10
11#include <qpe/config.h> 11#include <qpe/config.h>
12#include <qpe/qcopenvelope_qws.h> 12#include <qpe/qcopenvelope_qws.h>
13 13
14#include <libetpan/libetpan.h> 14#include <libetpan/libetpan.h>
15 15
16#include "smtpwrapper.h" 16#include "smtpwrapper.h"
17#include "mailwrapper.h" 17#include "mailwrapper.h"
18#include "abstractmail.h" 18#include "abstractmail.h"
19#include "logindialog.h" 19#include "logindialog.h"
20#include "mailtypes.h" 20#include "mailtypes.h"
21#include "sendmailprogress.h" 21#include "sendmailprogress.h"
22 22
23const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; 23const char* SMTPwrapper::USER_AGENT="OpieMail v0.4";
24 24
25progressMailSend*SMTPwrapper::sendProgress = 0; 25progressMailSend*SMTPwrapper::sendProgress = 0;
26 26
27SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) 27SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
28 : QObject() 28 : QObject()
29{ 29{
30 m_SmtpAccount = aSmtp; 30 m_SmtpAccount = aSmtp;
31 Config cfg( "mail" ); 31 Config cfg( "mail" );
32 cfg.setGroup( "Status" ); 32 cfg.setGroup( "Status" );
33 m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); 33 m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
34 emit queuedMails( m_queuedMail ); 34 emit queuedMails( m_queuedMail );
35 connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); 35 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) );
36 m_smtp = 0; 36 m_smtp = 0;
37} 37}
38 38
39SMTPwrapper::~SMTPwrapper() 39SMTPwrapper::~SMTPwrapper()
40{ 40{
41 disc_server(); 41 disc_server();
42} 42}
43 43
44void SMTPwrapper::emitQCop( int queued ) { 44void SMTPwrapper::emitQCop( int queued ) {
45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); 45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
46 env << queued; 46 env << queued;
47} 47}
48 48
49QString SMTPwrapper::mailsmtpError( int errnum ) { 49QString SMTPwrapper::mailsmtpError( int errnum ) {
50 switch ( errnum ) { 50 switch ( errnum ) {
51 case MAILSMTP_NO_ERROR: 51 case MAILSMTP_NO_ERROR:
52 return tr( "No error" ); 52 return tr( "No error" );
53 case MAILSMTP_ERROR_UNEXPECTED_CODE: 53 case MAILSMTP_ERROR_UNEXPECTED_CODE:
54 return tr( "Unexpected error code" ); 54 return tr( "Unexpected error code" );
55 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 55 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
56 return tr( "Service not available" ); 56 return tr( "Service not available" );
57 case MAILSMTP_ERROR_STREAM: 57 case MAILSMTP_ERROR_STREAM:
58 return tr( "Stream error" ); 58 return tr( "Stream error" );
59 case MAILSMTP_ERROR_HOSTNAME: 59 case MAILSMTP_ERROR_HOSTNAME:
60 return tr( "gethostname() failed" ); 60 return tr( "gethostname() failed" );
61 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 61 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
62 return tr( "Not implemented" ); 62 return tr( "Not implemented" );
63 case MAILSMTP_ERROR_ACTION_NOT_TAKEN: 63 case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
64 return tr( "Error, action not taken" ); 64 return tr( "Error, action not taken" );
65 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: 65 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
66 return tr( "Data exceeds storage allocation" ); 66 return tr( "Data exceeds storage allocation" );
67 case MAILSMTP_ERROR_IN_PROCESSING: 67 case MAILSMTP_ERROR_IN_PROCESSING:
68 return tr( "Error in processing" ); 68 return tr( "Error in processing" );
69 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: 69 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED:
70 return tr( "Starttls not supported" ); 70 return tr( "Starttls not supported" );
71 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: 71 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
72 // return tr( "Insufficient system storage" ); 72 // return tr( "Insufficient system storage" );
73 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: 73 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
74 return tr( "Mailbox unavailable" ); 74 return tr( "Mailbox unavailable" );
75 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: 75 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
76 return tr( "Mailbox name not allowed" ); 76 return tr( "Mailbox name not allowed" );
77 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: 77 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
78 return tr( "Bad command sequence" ); 78 return tr( "Bad command sequence" );
79 case MAILSMTP_ERROR_USER_NOT_LOCAL: 79 case MAILSMTP_ERROR_USER_NOT_LOCAL:
80 return tr( "User not local" ); 80 return tr( "User not local" );
81 case MAILSMTP_ERROR_TRANSACTION_FAILED: 81 case MAILSMTP_ERROR_TRANSACTION_FAILED:
82 return tr( "Transaction failed" ); 82 return tr( "Transaction failed" );
83 case MAILSMTP_ERROR_MEMORY: 83 case MAILSMTP_ERROR_MEMORY:
84 return tr( "Memory error" ); 84 return tr( "Memory error" );
85 case MAILSMTP_ERROR_CONNECTION_REFUSED: 85 case MAILSMTP_ERROR_CONNECTION_REFUSED:
86 return tr( "Connection refused" ); 86 return tr( "Connection refused" );
87 default: 87 default:
88 return tr( "Unknown error code" ); 88 return tr( "Unknown error code" );
89 } 89 }
90} 90}
91 91
92mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { 92mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) {
93 return mailimf_mailbox_new( strdup( name.latin1() ), 93 return mailimf_mailbox_new( strdup( name.latin1() ),
94 strdup( mail.latin1() ) ); 94 strdup( mail.latin1() ) );
95} 95}
96 96
97mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { 97mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) {
98 mailimf_address_list *addresses; 98 mailimf_address_list *addresses;
99 99
100 if ( addr.isEmpty() ) 100 if ( addr.isEmpty() )
101 return NULL; 101 return NULL;
102 102
103 addresses = mailimf_address_list_new_empty(); 103 addresses = mailimf_address_list_new_empty();
104 104
105 bool literal_open = false; 105 bool literal_open = false;
106 unsigned int startpos = 0; 106 unsigned int startpos = 0;
107 QStringList list; 107 QStringList list;
108 QString s; 108 QString s;
109 unsigned int i = 0; 109 unsigned int i = 0;
110 for (; i < addr.length();++i) { 110 for (; i < addr.length();++i) {
111 switch (addr[i]) { 111 switch (addr[i]) {
112 case '\"': 112 case '\"':
113 literal_open = !literal_open; 113 literal_open = !literal_open;
114 break; 114 break;
115 case ',': 115 case ',':
116 if (!literal_open) { 116 if (!literal_open) {
117 s = addr.mid(startpos,i-startpos); 117 s = addr.mid(startpos,i-startpos);
118 if (!s.isEmpty()) { 118 if (!s.isEmpty()) {
119 list.append(s); 119 list.append(s);
120 qDebug("Appended %s",s.latin1()); 120 qDebug("Appended %s",s.latin1());
121 } 121 }
122 // !!!! this is a MUST BE! 122 // !!!! this is a MUST BE!
123 startpos = ++i; 123 startpos = ++i;
124 } 124 }
125 break; 125 break;
126 default: 126 default:
127 break; 127 break;
128 } 128 }
129 } 129 }
130 s = addr.mid(startpos,i-startpos); 130 s = addr.mid(startpos,i-startpos);
131 if (!s.isEmpty()) { 131 if (!s.isEmpty()) {
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 2a1f90d..3f34fe7 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,217 +1,217 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qvbox.h> 2#include <qvbox.h>
3#include <qheader.h> 3#include <qheader.h>
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qlayout.h> 5#include <qlayout.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7 7
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpe/resource.h> 9#include <qpe/resource.h>
10 10
11#include "defines.h" 11#include "defines.h"
12#include "mainwindow.h" 12#include "mainwindow.h"
13 13
14 14
15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
16 : QMainWindow( parent, name, flags ) 16 : QMainWindow( parent, name, flags )
17{ 17{
18 18
19 setCaption( tr( "Mail" ) ); 19 setCaption( tr( "Mail" ) );
20 setToolBarsMovable( false ); 20 setToolBarsMovable( false );
21 21
22 toolBar = new QToolBar( this ); 22 toolBar = new QToolBar( this );
23 menuBar = new QMenuBar( toolBar ); 23 menuBar = new QMenuBar( toolBar );
24 mailMenu = new QPopupMenu( menuBar ); 24 mailMenu = new QPopupMenu( menuBar );
25 menuBar->insertItem( tr( "Mail" ), mailMenu ); 25 menuBar->insertItem( tr( "Mail" ), mailMenu );
26 settingsMenu = new QPopupMenu( menuBar ); 26 settingsMenu = new QPopupMenu( menuBar );
27 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 27 menuBar->insertItem( tr( "Settings" ), settingsMenu );
28 28
29 addToolBar( toolBar ); 29 addToolBar( toolBar );
30 toolBar->setHorizontalStretchable( true ); 30 toolBar->setHorizontalStretchable( true );
31 31
32 QLabel *spacer = new QLabel( toolBar ); 32 QLabel *spacer = new QLabel( toolBar );
33 spacer->setBackgroundMode( QWidget::PaletteButton ); 33 spacer->setBackgroundMode( QWidget::PaletteButton );
34 toolBar->setStretchableWidget( spacer ); 34 toolBar->setStretchableWidget( spacer );
35 35
36 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 36 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
37 0, 0, this ); 37 0, 0, this );
38 composeMail->addTo( toolBar ); 38 composeMail->addTo( toolBar );
39 composeMail->addTo( mailMenu ); 39 composeMail->addTo( mailMenu );
40 40
41 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 41 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
42 0, 0, this ); 42 0, 0, this );
43 sendQueued->addTo( toolBar ); 43 sendQueued->addTo( toolBar );
44 sendQueued->addTo( mailMenu ); 44 sendQueued->addTo( mailMenu );
45 45
46 /* 46 /*
47 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 47 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
48 0, 0, this ); 48 0, 0, this );
49 syncFolders->addTo( toolBar ); 49 syncFolders->addTo( toolBar );
50 syncFolders->addTo( mailMenu ); 50 syncFolders->addTo( mailMenu );
51 */ 51 */
52 52
53 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 53 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
54 0, 0, this, 0, true ); 54 0, 0, this, 0, true );
55 showFolders->addTo( toolBar ); 55 showFolders->addTo( toolBar );
56 showFolders->addTo( mailMenu ); 56 showFolders->addTo( mailMenu );
57 showFolders->setOn( true ); 57 showFolders->setOn( true );
58 connect(showFolders, SIGNAL( toggled( bool ) ), 58 connect(showFolders, SIGNAL( toggled(bool) ),
59 SLOT( slotShowFolders( bool ) ) ); 59 SLOT( slotShowFolders(bool) ) );
60 60
61 /* 61 /*
62 searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), 62 searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ),
63 0, 0, this ); 63 0, 0, this );
64 searchMails->addTo( toolBar ); 64 searchMails->addTo( toolBar );
65 searchMails->addTo( mailMenu ); 65 searchMails->addTo( mailMenu );
66 */ 66 */
67 67
68 deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); 68 deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this);
69 deleteMails->addTo( toolBar ); 69 deleteMails->addTo( toolBar );
70 deleteMails->addTo( mailMenu ); 70 deleteMails->addTo( mailMenu );
71 connect( deleteMails, SIGNAL( activated() ), 71 connect( deleteMails, SIGNAL( activated() ),
72 SLOT( slotDeleteMail() ) ); 72 SLOT( slotDeleteMail() ) );
73 73
74 editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , 74 editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) ,
75 0, 0, this ); 75 0, 0, this );
76 editSettings->addTo( settingsMenu ); 76 editSettings->addTo( settingsMenu );
77 connect( editSettings, SIGNAL( activated() ), 77 connect( editSettings, SIGNAL( activated() ),
78 SLOT( slotEditSettings() ) ); 78 SLOT( slotEditSettings() ) );
79 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , 79 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) ,
80 0, 0, this ); 80 0, 0, this );
81 editAccounts->addTo( settingsMenu ); 81 editAccounts->addTo( settingsMenu );
82 82
83 //setCentralWidget( view ); 83 //setCentralWidget( view );
84 84
85 QVBox* wrapperBox = new QVBox( this ); 85 QVBox* wrapperBox = new QVBox( this );
86 setCentralWidget( wrapperBox ); 86 setCentralWidget( wrapperBox );
87 87
88 QWidget *view = new QWidget( wrapperBox ); 88 QWidget *view = new QWidget( wrapperBox );
89 89
90 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 90 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
91 91
92 folderView = new AccountView( view ); 92 folderView = new AccountView( view );
93 folderView->header()->hide(); 93 folderView->header()->hide();
94 folderView->setRootIsDecorated( true ); 94 folderView->setRootIsDecorated( true );
95 folderView->addColumn( tr( "Mailbox" ) ); 95 folderView->addColumn( tr( "Mailbox" ) );
96 96
97 layout->addWidget( folderView ); 97 layout->addWidget( folderView );
98 98
99 mailView = new QListView( view ); 99 mailView = new QListView( view );
100 mailView->addColumn( tr( "" ) ); 100 mailView->addColumn( tr( "" ) );
101 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 101 mailView->addColumn( tr( "Subject" ),QListView::Manual );
102 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 102 mailView->addColumn( tr( "Sender" ),QListView::Manual );
103 mailView->addColumn( tr( "Size" ),QListView::Manual); 103 mailView->addColumn( tr( "Size" ),QListView::Manual);
104 mailView->addColumn( tr( "Date" )); 104 mailView->addColumn( tr( "Date" ));
105 mailView->setAllColumnsShowFocus(true); 105 mailView->setAllColumnsShowFocus(true);
106 mailView->setSorting(-1); 106 mailView->setSorting(-1);
107 107
108 statusWidget = new StatusWidget( wrapperBox ); 108 statusWidget = new StatusWidget( wrapperBox );
109 statusWidget->hide(); 109 statusWidget->hide();
110 110
111 layout->addWidget( mailView ); 111 layout->addWidget( mailView );
112 layout->setStretchFactor( folderView, 1 ); 112 layout->setStretchFactor( folderView, 1 );
113 layout->setStretchFactor( mailView, 2 ); 113 layout->setStretchFactor( mailView, 2 );
114 114
115 slotAdjustLayout(); 115 slotAdjustLayout();
116 116
117 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 117 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
118 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 118 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
119 119
120 connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, 120 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
121 SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); 121 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
122 connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, 122 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
123 SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); 123 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
124 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); 124 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
125 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 125 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
126 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 126 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
127// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 127// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
128 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 128 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
129 // Added by Stefan Eilers to allow starting by addressbook.. 129 // Added by Stefan Eilers to allow starting by addressbook..
130 // copied from old mail2 130 // copied from old mail2
131#if !defined(QT_NO_COP) 131#if !defined(QT_NO_COP)
132 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), 132 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
133 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 133 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
134#endif 134#endif
135 135
136 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 136 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
137} 137}
138 138
139MainWindow::~MainWindow() 139MainWindow::~MainWindow()
140{ 140{
141} 141}
142 142
143void MainWindow::appMessage(const QCString &, const QByteArray &) 143void MainWindow::appMessage(const QCString &, const QByteArray &)
144{ 144{
145 qDebug("appMessage not reached"); 145 qDebug("appMessage not reached");
146} 146}
147 147
148void MainWindow::slotAdjustLayout() { 148void MainWindow::slotAdjustLayout() {
149 149
150 QWidget *d = QApplication::desktop(); 150 QWidget *d = QApplication::desktop();
151 151
152 if ( d->width() < d->height() ) { 152 if ( d->width() < d->height() ) {
153 layout->setDirection( QBoxLayout::TopToBottom ); 153 layout->setDirection( QBoxLayout::TopToBottom );
154 } else { 154 } else {
155 layout->setDirection( QBoxLayout::LeftToRight ); 155 layout->setDirection( QBoxLayout::LeftToRight );
156 } 156 }
157} 157}
158 158
159void MainWindow::slotAdjustColumns() 159void MainWindow::slotAdjustColumns()
160{ 160{
161 bool hidden = folderView->isHidden(); 161 bool hidden = folderView->isHidden();
162 if ( hidden ) folderView->show(); 162 if ( hidden ) folderView->show();
163 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 163 folderView->setColumnWidth( 0, folderView->visibleWidth() );
164 if ( hidden ) folderView->hide(); 164 if ( hidden ) folderView->hide();
165 165
166 mailView->setColumnWidth( 0, 10 ); 166 mailView->setColumnWidth( 0, 10 );
167 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 167 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
168 mailView->setColumnWidth( 2, 80 ); 168 mailView->setColumnWidth( 2, 80 );
169 mailView->setColumnWidth( 3, 50 ); 169 mailView->setColumnWidth( 3, 50 );
170 mailView->setColumnWidth( 4, 50 ); 170 mailView->setColumnWidth( 4, 50 );
171} 171}
172 172
173void MainWindow::slotEditSettings() 173void MainWindow::slotEditSettings()
174{ 174{
175} 175}
176 176
177void MainWindow::slotShowFolders( bool ) 177void MainWindow::slotShowFolders( bool )
178{ 178{
179 qDebug( "slotShowFolders not reached" ); 179 qDebug( "slotShowFolders not reached" );
180} 180}
181 181
182void MainWindow::refreshMailView(QList<RecMail>*) 182void MainWindow::refreshMailView(QList<RecMail>*)
183{ 183{
184 qDebug( "refreshMailView not reached" ); 184 qDebug( "refreshMailView not reached" );
185} 185}
186 186
187void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) 187void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
188{ 188{
189 qDebug( "mailLeftClicked not reached" ); 189 qDebug( "mailLeftClicked not reached" );
190} 190}
191 191
192void MainWindow::displayMail() 192void MainWindow::displayMail()
193{ 193{
194 qDebug("displayMail not reached"); 194 qDebug("displayMail not reached");
195} 195}
196 196
197void MainWindow::slotDeleteMail() 197void MainWindow::slotDeleteMail()
198{ 198{
199 qDebug("deleteMail not reached"); 199 qDebug("deleteMail not reached");
200} 200}
201 201
202void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 202void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
203{ 203{
204 qDebug("mailHold not reached"); 204 qDebug("mailHold not reached");
205} 205}
206 206
207void MainWindow::slotSendQueued() 207void MainWindow::slotSendQueued()
208{ 208{
209} 209}
210 210
211void MainWindow::slotEditAccounts() 211void MainWindow::slotEditAccounts()
212{ 212{
213} 213}
214 214
215void MainWindow::slotComposeMail() 215void MainWindow::slotComposeMail()
216{ 216{
217} 217}
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index f015228..8636957 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -192,197 +192,197 @@ void ViewMail::slotShowHtml( bool state )
192{ 192{
193 m_showHtml = state; 193 m_showHtml = state;
194 setText(); 194 setText();
195} 195}
196 196
197void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) 197void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
198{ 198{
199 if (!item ) 199 if (!item )
200 return; 200 return;
201 201
202 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 202 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
203 { 203 {
204 setText(); 204 setText();
205 return; 205 return;
206 } 206 }
207 QPopupMenu *menu = new QPopupMenu(); 207 QPopupMenu *menu = new QPopupMenu();
208 int ret=0; 208 int ret=0;
209 209
210 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 210 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
211 { 211 {
212 menu->insertItem( tr( "Show Text" ), 1 ); 212 menu->insertItem( tr( "Show Text" ), 1 );
213 } 213 }
214 menu->insertItem( tr( "Save Attachment" ), 0 ); 214 menu->insertItem( tr( "Save Attachment" ), 0 );
215 menu->insertSeparator(1); 215 menu->insertSeparator(1);
216 216
217 ret = menu->exec( point, 0 ); 217 ret = menu->exec( point, 0 );
218 218
219 switch(ret) 219 switch(ret)
220 { 220 {
221 case 0: 221 case 0:
222 { 222 {
223 MimeTypes types; 223 MimeTypes types;
224 types.insert( "all", "*" ); 224 types.insert( "all", "*" );
225 QString str = Opie::OFileDialog::getSaveFileName( 1, 225 QString str = Opie::OFileDialog::getSaveFileName( 1,
226 "/", item->text( 2 ) , types, 0 ); 226 "/", item->text( 2 ) , types, 0 );
227 227
228 if( !str.isEmpty() ) 228 if( !str.isEmpty() )
229 { 229 {
230 encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 230 encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
231 if (content) 231 if (content)
232 { 232 {
233 QFile output(str); 233 QFile output(str);
234 output.open(IO_WriteOnly); 234 output.open(IO_WriteOnly);
235 output.writeBlock(content->Content(),content->Length()); 235 output.writeBlock(content->Content(),content->Length());
236 output.close(); 236 output.close();
237 delete content; 237 delete content;
238 } 238 }
239 } 239 }
240 } 240 }
241 break ; 241 break ;
242 242
243 case 1: 243 case 1:
244 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 244 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
245 { 245 {
246 setText(); 246 setText();
247 } 247 }
248 else 248 else
249 { 249 {
250 if ( m_recMail.Wrapper() != 0l ) 250 if ( m_recMail.Wrapper() != 0l )
251 { // make sure that there is a wrapper , even after delete or simular actions 251 { // make sure that there is a wrapper , even after delete or simular actions
252 browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 252 browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
253 } 253 }
254 } 254 }
255 break; 255 break;
256 } 256 }
257 delete menu; 257 delete menu;
258} 258}
259 259
260 260
261void ViewMail::setMail( RecMail mail ) 261void ViewMail::setMail( RecMail mail )
262{ 262{
263 263
264 m_recMail = mail; 264 m_recMail = mail;
265 265
266 m_mail[0] = mail.getFrom(); 266 m_mail[0] = mail.getFrom();
267 m_mail[1] = mail.getSubject(); 267 m_mail[1] = mail.getSubject();
268 m_mail[3] = mail.getDate(); 268 m_mail[3] = mail.getDate();
269 m_mail[4] = mail.Msgid(); 269 m_mail[4] = mail.Msgid();
270 270
271 m_mail2[0] = mail.To(); 271 m_mail2[0] = mail.To();
272 m_mail2[1] = mail.CC(); 272 m_mail2[1] = mail.CC();
273 m_mail2[2] = mail.Bcc(); 273 m_mail2[2] = mail.Bcc();
274 274
275 setText(); 275 setText();
276} 276}
277 277
278 278
279 279
280ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 280ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
281 : ViewMailBase(parent, name, fl), _inLoop(false) 281 : ViewMailBase(parent, name, fl), _inLoop(false)
282{ 282{
283 m_gotBody = false; 283 m_gotBody = false;
284 deleted = false; 284 deleted = false;
285 285
286 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 286 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
287 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 287 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
288 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) ); 288 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
289 connect( showHtml, SIGNAL( toggled( bool ) ), SLOT( slotShowHtml( bool ) ) ); 289 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
290 290
291 attachments->setEnabled(m_gotBody); 291 attachments->setEnabled(m_gotBody);
292 connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); 292 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
293 293
294 readConfig(); 294 readConfig();
295 attachments->setSorting(-1); 295 attachments->setSorting(-1);
296} 296}
297 297
298void ViewMail::readConfig() 298void ViewMail::readConfig()
299{ 299{
300 Config cfg( "mail" ); 300 Config cfg( "mail" );
301 cfg.setGroup( "Settings" ); 301 cfg.setGroup( "Settings" );
302 m_showHtml = cfg.readBoolEntry( "showHtml", false ); 302 m_showHtml = cfg.readBoolEntry( "showHtml", false );
303 showHtml->setOn( m_showHtml ); 303 showHtml->setOn( m_showHtml );
304} 304}
305 305
306void ViewMail::setText() 306void ViewMail::setText()
307{ 307{
308 308
309 QString toString; 309 QString toString;
310 QString ccString; 310 QString ccString;
311 QString bccString; 311 QString bccString;
312 312
313 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) 313 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
314 { 314 {
315 toString += (*it); 315 toString += (*it);
316 } 316 }
317 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) 317 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it )
318 { 318 {
319 ccString += (*it); 319 ccString += (*it);
320 } 320 }
321 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) 321 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it )
322 { 322 {
323 bccString += (*it); 323 bccString += (*it);
324 } 324 }
325 325
326 setCaption( caption().arg( m_mail[0] ) ); 326 setCaption( caption().arg( m_mail[0] ) );
327 327
328 m_mailHtml = "<html><body>" 328 m_mailHtml = "<html><body>"
329 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 329 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
330 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 330 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
331 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 331 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
332 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 332 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
333 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 333 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
334 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 334 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
335 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + 335 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] +
336 "</td></tr></table><font face=fixed>"; 336 "</td></tr></table><font face=fixed>";
337 337
338 if ( !m_showHtml ) 338 if ( !m_showHtml )
339 { 339 {
340 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); 340 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
341 } 341 }
342 else 342 else
343 { 343 {
344 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); 344 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
345 } 345 }
346 // remove later in favor of a real handling 346 // remove later in favor of a real handling
347 m_gotBody = true; 347 m_gotBody = true;
348} 348}
349 349
350 350
351ViewMail::~ViewMail() 351ViewMail::~ViewMail()
352{ 352{
353 m_recMail.Wrapper()->cleanMimeCache(); 353 m_recMail.Wrapper()->cleanMimeCache();
354 hide(); 354 hide();
355} 355}
356 356
357void ViewMail::hide() 357void ViewMail::hide()
358{ 358{
359 QWidget::hide(); 359 QWidget::hide();
360 360
361 if (_inLoop) 361 if (_inLoop)
362 { 362 {
363 _inLoop = false; 363 _inLoop = false;
364 qApp->exit_loop(); 364 qApp->exit_loop();
365 365
366 } 366 }
367 367
368} 368}
369 369
370void ViewMail::exec() 370void ViewMail::exec()
371{ 371{
372 show(); 372 show();
373 373
374 if (!_inLoop) 374 if (!_inLoop)
375 { 375 {
376 _inLoop = true; 376 _inLoop = true;
377 qApp->enter_loop(); 377 qApp->enter_loop();
378 } 378 }
379 379
380} 380}
381 381
382QString ViewMail::deHtml(const QString &string) 382QString ViewMail::deHtml(const QString &string)
383{ 383{
384 QString string_ = string; 384 QString string_ = string;
385 string_.replace(QRegExp("&"), "&amp;"); 385 string_.replace(QRegExp("&"), "&amp;");
386 string_.replace(QRegExp("<"), "&lt;"); 386 string_.replace(QRegExp("<"), "&lt;");
387 string_.replace(QRegExp(">"), "&gt;"); 387 string_.replace(QRegExp(">"), "&gt;");
388 string_.replace(QRegExp("\\n"), "<br>"); 388 string_.replace(QRegExp("\\n"), "<br>");