summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/composemail.cpp7
-rw-r--r--noncore/net/mail/editaccounts.cpp1
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp2
-rw-r--r--noncore/net/mail/mailwrapper.cpp2
-rw-r--r--noncore/net/mail/main.cpp1
-rw-r--r--noncore/net/mail/mainwindow.cpp1
6 files changed, 0 insertions, 14 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index a17ccb3..88dd780 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -1,180 +1,173 @@
1#include <qt.h> 1#include <qt.h>
2#include <qcombobox.h>
3#include <qmessagebox.h>
4#include <qlistview.h>
5#include <qtabwidget.h>
6#include <qmultilineedit.h>
7#include <qregexp.h>
8 2
9#include <opie/ofiledialog.h> 3#include <opie/ofiledialog.h>
10#include <qpe/resource.h> 4#include <qpe/resource.h>
11 5
12#include "composemail.h" 6#include "composemail.h"
13#include "mailwrapper.h"
14 7
15ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 8ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
16 : ComposeMailUI( parent, name, modal, flags ) 9 : ComposeMailUI( parent, name, modal, flags )
17{ 10{
18 settings = s; 11 settings = s;
19 12
20 attList->addColumn( tr( "Name" ) ); 13 attList->addColumn( tr( "Name" ) );
21 attList->addColumn( tr( "Size" ) ); 14 attList->addColumn( tr( "Size" ) );
22 15
23 QList<Account> accounts = settings->getAccounts(); 16 QList<Account> accounts = settings->getAccounts();
24 Account *it; 17 Account *it;
25 for ( it = accounts.first(); it; it = accounts.next() ) { 18 for ( it = accounts.first(); it; it = accounts.next() ) {
26 if ( it->getType().compare( "SMTP" ) == 0 ) { 19 if ( it->getType().compare( "SMTP" ) == 0 ) {
27 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 20 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
28 fromBox->insertItem( smtp->getMail() ); 21 fromBox->insertItem( smtp->getMail() );
29 smtpAccounts.append( smtp ); 22 smtpAccounts.append( smtp );
30 } 23 }
31 } 24 }
32 25
33 if ( smtpAccounts.count() > 0 ) { 26 if ( smtpAccounts.count() > 0 ) {
34 fillValues( fromBox->currentItem() ); 27 fillValues( fromBox->currentItem() );
35 } else { 28 } else {
36 QMessageBox::information( this, tr( "Problem" ), 29 QMessageBox::information( this, tr( "Problem" ),
37 tr( "<p>Please create an SMTP account first.</p>" ), 30 tr( "<p>Please create an SMTP account first.</p>" ),
38 tr( "Ok" ) ); 31 tr( "Ok" ) );
39 } 32 }
40 33
41 connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); 34 connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) );
42 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 35 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
43 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 36 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
44 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 37 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
45 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 38 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
46 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 39 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
47 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 40 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
48} 41}
49 42
50void ComposeMail::pickAddress( QLineEdit *line ) 43void ComposeMail::pickAddress( QLineEdit *line )
51{ 44{
52 QString names = AddressPicker::getNames(); 45 QString names = AddressPicker::getNames();
53 if ( line->text().isEmpty() ) { 46 if ( line->text().isEmpty() ) {
54 line->setText( names ); 47 line->setText( names );
55 } else if ( !names.isEmpty() ) { 48 } else if ( !names.isEmpty() ) {
56 line->setText( line->text() + ", " + names ); 49 line->setText( line->text() + ", " + names );
57 } 50 }
58} 51}
59 52
60void ComposeMail::pickAddressTo() 53void ComposeMail::pickAddressTo()
61{ 54{
62 pickAddress( toLine ); 55 pickAddress( toLine );
63} 56}
64 57
65void ComposeMail::pickAddressCC() 58void ComposeMail::pickAddressCC()
66{ 59{
67 pickAddress( ccLine ); 60 pickAddress( ccLine );
68} 61}
69 62
70void ComposeMail::pickAddressBCC() 63void ComposeMail::pickAddressBCC()
71{ 64{
72 pickAddress( bccLine ); 65 pickAddress( bccLine );
73} 66}
74 67
75void ComposeMail::pickAddressReply() 68void ComposeMail::pickAddressReply()
76{ 69{
77 pickAddress( replyLine ); 70 pickAddress( replyLine );
78} 71}
79 72
80void ComposeMail::fillValues( int current ) 73void ComposeMail::fillValues( int current )
81{ 74{
82 SMTPaccount *smtp = smtpAccounts.at( current ); 75 SMTPaccount *smtp = smtpAccounts.at( current );
83 76
84 ccLine->clear(); 77 ccLine->clear();
85 if ( smtp->getUseCC() ) { 78 if ( smtp->getUseCC() ) {
86 ccLine->setText( smtp->getCC() ); 79 ccLine->setText( smtp->getCC() );
87 } 80 }
88 bccLine->clear(); 81 bccLine->clear();
89 if ( smtp->getUseBCC() ) { 82 if ( smtp->getUseBCC() ) {
90 bccLine->setText( smtp->getBCC() ); 83 bccLine->setText( smtp->getBCC() );
91 } 84 }
92 replyLine->clear(); 85 replyLine->clear();
93 if ( smtp->getUseReply() ) { 86 if ( smtp->getUseReply() ) {
94 replyLine->setText( smtp->getReply() ); 87 replyLine->setText( smtp->getReply() );
95 } 88 }
96 89
97 sigMultiLine->setText( smtp->getSignature() ); 90 sigMultiLine->setText( smtp->getSignature() );
98} 91}
99 92
100void ComposeMail::slotAdjustColumns() 93void ComposeMail::slotAdjustColumns()
101{ 94{
102 int currPage = tabWidget->currentPageIndex(); 95 int currPage = tabWidget->currentPageIndex();
103 96
104 tabWidget->showPage( attachTab ); 97 tabWidget->showPage( attachTab );
105 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 98 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
106 attList->setColumnWidth( 1, 80 ); 99 attList->setColumnWidth( 1, 80 );
107 100
108 tabWidget->setCurrentPage( currPage ); 101 tabWidget->setCurrentPage( currPage );
109} 102}
110 103
111void ComposeMail::addAttachment() 104void ComposeMail::addAttachment()
112{ 105{
113 DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" ); 106 DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" );
114 if ( !lnk.name().isEmpty() ) { 107 if ( !lnk.name().isEmpty() ) {
115 Attachment *att = new Attachment( lnk ); 108 Attachment *att = new Attachment( lnk );
116 (void) new AttachViewItem( attList, att ); 109 (void) new AttachViewItem( attList, att );
117 } 110 }
118} 111}
119 112
120void ComposeMail::removeAttachment() 113void ComposeMail::removeAttachment()
121{ 114{
122 if ( !attList->currentItem() ) { 115 if ( !attList->currentItem() ) {
123 QMessageBox::information( this, tr( "Error" ), 116 QMessageBox::information( this, tr( "Error" ),
124 tr( "<p>Please select a File.</p>" ), 117 tr( "<p>Please select a File.</p>" ),
125 tr( "Ok" ) ); 118 tr( "Ok" ) );
126 } else { 119 } else {
127 attList->takeItem( attList->currentItem() ); 120 attList->takeItem( attList->currentItem() );
128 } 121 }
129} 122}
130 123
131void ComposeMail::accept() 124void ComposeMail::accept()
132{ 125{
133 qDebug( "Sending Mail with " + 126 qDebug( "Sending Mail with " +
134 smtpAccounts.at( fromBox->currentItem() )->getAccountName() ); 127 smtpAccounts.at( fromBox->currentItem() )->getAccountName() );
135 Mail *mail = new Mail(); 128 Mail *mail = new Mail();
136 SMTPaccount *smtp = smtpAccounts.at( fromBox->currentItem() ); 129 SMTPaccount *smtp = smtpAccounts.at( fromBox->currentItem() );
137 mail->setMail( smtp->getMail() ); 130 mail->setMail( smtp->getMail() );
138 mail->setName( smtp->getName() ); 131 mail->setName( smtp->getName() );
139 132
140 if ( !toLine->text().isEmpty() ) { 133 if ( !toLine->text().isEmpty() ) {
141 mail->setTo( toLine->text() ); 134 mail->setTo( toLine->text() );
142 } else { 135 } else {
143 qDebug( "No Reciever spezified -> returning" ); 136 qDebug( "No Reciever spezified -> returning" );
144 return; 137 return;
145 } 138 }
146 139
147 mail->setCC( ccLine->text() ); 140 mail->setCC( ccLine->text() );
148 mail->setBCC( bccLine->text() ); 141 mail->setBCC( bccLine->text() );
149 mail->setReply( replyLine->text() ); 142 mail->setReply( replyLine->text() );
150 mail->setSubject( subjectLine->text() ); 143 mail->setSubject( subjectLine->text() );
151 QString txt = message->text(); 144 QString txt = message->text();
152 if ( !sigMultiLine->text().isEmpty() ) { 145 if ( !sigMultiLine->text().isEmpty() ) {
153 txt.append( "\n--\n" ); 146 txt.append( "\n--\n" );
154 txt.append( sigMultiLine->text() ); 147 txt.append( sigMultiLine->text() );
155 } 148 }
156 mail->setMessage( txt ); 149 mail->setMessage( txt );
157 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 150 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
158 while ( it != NULL ) { 151 while ( it != NULL ) {
159 mail->addAttachment( it->getAttachment() ); 152 mail->addAttachment( it->getAttachment() );
160 it = (AttachViewItem *) it->itemBelow(); 153 it = (AttachViewItem *) it->itemBelow();
161 } 154 }
162 155
163 MailWrapper wrapper( settings ); 156 MailWrapper wrapper( settings );
164 wrapper.sendMail( *mail ); 157 wrapper.sendMail( *mail );
165 158
166 QDialog::accept(); 159 QDialog::accept();
167} 160}
168 161
169AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 162AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
170 : QListViewItem( parent ) 163 : QListViewItem( parent )
171{ 164{
172 attachment = att; 165 attachment = att;
173 qDebug( att->getMimeType() ); 166 qDebug( att->getMimeType() );
174 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? 167 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
175 Resource::loadPixmap( "UnknownDocument-14" ) : 168 Resource::loadPixmap( "UnknownDocument-14" ) :
176 attachment->getDocLnk().pixmap() ); 169 attachment->getDocLnk().pixmap() );
177 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 170 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
178 setText( 1, QString::number( att->getSize() ) ); 171 setText( 1, QString::number( att->getSize() ) );
179} 172}
180 173
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 7e2dd24..1c80adb 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -1,194 +1,193 @@
1#include <qt.h> 1#include <qt.h>
2#include <qtabwidget.h>
3 2
4#include "defines.h" 3#include "defines.h"
5#include "editaccounts.h" 4#include "editaccounts.h"
6 5
7AccountListItem::AccountListItem( QListView *parent, Account *a) 6AccountListItem::AccountListItem( QListView *parent, Account *a)
8 : QListViewItem( parent ) 7 : QListViewItem( parent )
9{ 8{
10 account = a; 9 account = a;
11 setText( 0, account->getAccountName() ); 10 setText( 0, account->getAccountName() );
12 setText( 1, account->getType() ); 11 setText( 1, account->getType() );
13} 12}
14 13
15EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 14EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
16 : EditAccountsUI( parent, name, modal, flags ) 15 : EditAccountsUI( parent, name, modal, flags )
17{ 16{
18 qDebug( "New Account Configuration Widget" ); 17 qDebug( "New Account Configuration Widget" );
19 settings = s; 18 settings = s;
20 19
21 mailList->addColumn( tr( "Account" ) ); 20 mailList->addColumn( tr( "Account" ) );
22 mailList->addColumn( tr( "Type" ) ); 21 mailList->addColumn( tr( "Type" ) );
23 22
24 newsList->addColumn( tr( "Account" ) ); 23 newsList->addColumn( tr( "Account" ) );
25 24
26 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 25 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
27 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 26 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
28 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 27 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
29 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); 28 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
30 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); 29 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
31 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); 30 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
32 31
33 slotFillLists(); 32 slotFillLists();
34} 33}
35 34
36void EditAccounts::slotFillLists() 35void EditAccounts::slotFillLists()
37{ 36{
38 mailList->clear(); 37 mailList->clear();
39 newsList->clear(); 38 newsList->clear();
40 39
41 QList<Account> accounts = settings->getAccounts(); 40 QList<Account> accounts = settings->getAccounts();
42 Account *it; 41 Account *it;
43 for ( it = accounts.first(); it; it = accounts.next() ) { 42 for ( it = accounts.first(); it; it = accounts.next() ) {
44 if ( it->getType().compare( "NNTP" ) == 0 ) { 43 if ( it->getType().compare( "NNTP" ) == 0 ) {
45 (void) new AccountListItem( newsList, it ); 44 (void) new AccountListItem( newsList, it );
46 } else { 45 } else {
47 (void) new AccountListItem( mailList, it ); 46 (void) new AccountListItem( mailList, it );
48 } 47 }
49 } 48 }
50} 49}
51 50
52void EditAccounts::slotNewMail() 51void EditAccounts::slotNewMail()
53{ 52{
54 qDebug( "New Mail Account" ); 53 qDebug( "New Mail Account" );
55 QString *selection = new QString(); 54 QString *selection = new QString();
56 SelectMailType selType( selection, this, 0, true ); 55 SelectMailType selType( selection, this, 0, true );
57 selType.show(); 56 selType.show();
58 if ( QDialog::Accepted == selType.exec() ) { 57 if ( QDialog::Accepted == selType.exec() ) {
59 slotNewAccount( *selection ); 58 slotNewAccount( *selection );
60 } 59 }
61} 60}
62 61
63void EditAccounts::slotNewAccount( const QString &type ) 62void EditAccounts::slotNewAccount( const QString &type )
64{ 63{
65 if ( type.compare( "IMAP" ) == 0 ) { 64 if ( type.compare( "IMAP" ) == 0 ) {
66 qDebug( "-> config IMAP" ); 65 qDebug( "-> config IMAP" );
67 IMAPaccount *account = new IMAPaccount(); 66 IMAPaccount *account = new IMAPaccount();
68 IMAPconfig imap( account, this, 0, true ); 67 IMAPconfig imap( account, this, 0, true );
69 imap.showMaximized(); 68 imap.showMaximized();
70 if ( QDialog::Accepted == imap.exec() ) { 69 if ( QDialog::Accepted == imap.exec() ) {
71 settings->addAccount( account ); 70 settings->addAccount( account );
72 account->save(); 71 account->save();
73 slotFillLists(); 72 slotFillLists();
74 } else { 73 } else {
75 account->remove(); 74 account->remove();
76 } 75 }
77 } else if ( type.compare( "POP3" ) == 0 ) { 76 } else if ( type.compare( "POP3" ) == 0 ) {
78 qDebug( "-> config POP3" ); 77 qDebug( "-> config POP3" );
79 POP3account *account = new POP3account(); 78 POP3account *account = new POP3account();
80 POP3config pop3( account, this, 0, true ); 79 POP3config pop3( account, this, 0, true );
81 pop3.showMaximized(); 80 pop3.showMaximized();
82 if ( QDialog::Accepted == pop3.exec() ) { 81 if ( QDialog::Accepted == pop3.exec() ) {
83 settings->addAccount( account ); 82 settings->addAccount( account );
84 account->save(); 83 account->save();
85 slotFillLists(); 84 slotFillLists();
86 } else { 85 } else {
87 account->remove(); 86 account->remove();
88 } 87 }
89 } else if ( type.compare( "SMTP" ) == 0 ) { 88 } else if ( type.compare( "SMTP" ) == 0 ) {
90 qDebug( "-> config SMTP" ); 89 qDebug( "-> config SMTP" );
91 SMTPaccount *account = new SMTPaccount(); 90 SMTPaccount *account = new SMTPaccount();
92 SMTPconfig smtp( account, this, 0, true ); 91 SMTPconfig smtp( account, this, 0, true );
93 smtp.showMaximized(); 92 smtp.showMaximized();
94 if ( QDialog::Accepted == smtp.exec() ) { 93 if ( QDialog::Accepted == smtp.exec() ) {
95 settings->addAccount( account ); 94 settings->addAccount( account );
96 account->save(); 95 account->save();
97 slotFillLists(); 96 slotFillLists();
98 } else { 97 } else {
99 account->remove(); 98 account->remove();
100 } 99 }
101 } else if ( type.compare( "NNTP" ) == 0 ) { 100 } else if ( type.compare( "NNTP" ) == 0 ) {
102 qDebug( "-> config NNTP" ); 101 qDebug( "-> config NNTP" );
103 NNTPaccount *account = new NNTPaccount(); 102 NNTPaccount *account = new NNTPaccount();
104 NNTPconfig nntp( account, this, 0, true ); 103 NNTPconfig nntp( account, this, 0, true );
105 nntp.showMaximized(); 104 nntp.showMaximized();
106 if ( QDialog::Accepted == nntp.exec() ) { 105 if ( QDialog::Accepted == nntp.exec() ) {
107 settings->addAccount( account ); 106 settings->addAccount( account );
108 account->save(); 107 account->save();
109 slotFillLists(); 108 slotFillLists();
110 } else { 109 } else {
111 account->remove(); 110 account->remove();
112 } 111 }
113 } 112 }
114} 113}
115 114
116void EditAccounts::slotEditAccount( Account *account ) 115void EditAccounts::slotEditAccount( Account *account )
117{ 116{
118 if ( account->getType().compare( "IMAP" ) == 0 ) { 117 if ( account->getType().compare( "IMAP" ) == 0 ) {
119 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); 118 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
120 IMAPconfig imap( imapAcc, this, 0, true ); 119 IMAPconfig imap( imapAcc, this, 0, true );
121 imap.showMaximized(); 120 imap.showMaximized();
122 if ( QDialog::Accepted == imap.exec() ) { 121 if ( QDialog::Accepted == imap.exec() ) {
123 slotFillLists(); 122 slotFillLists();
124 } 123 }
125 } else if ( account->getType().compare( "POP3" ) == 0 ) { 124 } else if ( account->getType().compare( "POP3" ) == 0 ) {
126 POP3account *pop3Acc = static_cast<POP3account *>(account); 125 POP3account *pop3Acc = static_cast<POP3account *>(account);
127 POP3config pop3( pop3Acc, this, 0, true ); 126 POP3config pop3( pop3Acc, this, 0, true );
128 pop3.showMaximized(); 127 pop3.showMaximized();
129 if ( QDialog::Accepted == pop3.exec() ) { 128 if ( QDialog::Accepted == pop3.exec() ) {
130 slotFillLists(); 129 slotFillLists();
131 } 130 }
132 } else if ( account->getType().compare( "SMTP" ) == 0 ) { 131 } else if ( account->getType().compare( "SMTP" ) == 0 ) {
133 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); 132 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account);
134 SMTPconfig smtp( smtpAcc, this, 0, true ); 133 SMTPconfig smtp( smtpAcc, this, 0, true );
135 smtp.showMaximized(); 134 smtp.showMaximized();
136 if ( QDialog::Accepted == smtp.exec() ) { 135 if ( QDialog::Accepted == smtp.exec() ) {
137 slotFillLists(); 136 slotFillLists();
138 } 137 }
139 } else if ( account->getType().compare( "NNTP" ) == 0 ) { 138 } else if ( account->getType().compare( "NNTP" ) == 0 ) {
140 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); 139 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
141 NNTPconfig nntp( nntpAcc, this, 0, true ); 140 NNTPconfig nntp( nntpAcc, this, 0, true );
142 nntp.showMaximized(); 141 nntp.showMaximized();
143 if ( QDialog::Accepted == nntp.exec() ) { 142 if ( QDialog::Accepted == nntp.exec() ) {
144 slotFillLists(); 143 slotFillLists();
145 } 144 }
146 } 145 }
147} 146}
148 147
149void EditAccounts::slotDeleteAccount( Account *account ) 148void EditAccounts::slotDeleteAccount( Account *account )
150{ 149{
151 if ( QMessageBox::information( this, tr( "Question" ), 150 if ( QMessageBox::information( this, tr( "Question" ),
152 tr( "<p>Do you really want to delete the selected Account?</p>" ), 151 tr( "<p>Do you really want to delete the selected Account?</p>" ),
153 tr( "Yes" ), tr( "No" ) ) == 0 ) { 152 tr( "Yes" ), tr( "No" ) ) == 0 ) {
154 settings->delAccount( account ); 153 settings->delAccount( account );
155 slotFillLists(); 154 slotFillLists();
156 } 155 }
157} 156}
158 157
159void EditAccounts::slotEditMail() 158void EditAccounts::slotEditMail()
160{ 159{
161 qDebug( "Edit Mail Account" ); 160 qDebug( "Edit Mail Account" );
162 if ( !mailList->currentItem() ) { 161 if ( !mailList->currentItem() ) {
163 QMessageBox::information( this, tr( "Error" ), 162 QMessageBox::information( this, tr( "Error" ),
164 tr( "<p>Please select an account.</p>" ), 163 tr( "<p>Please select an account.</p>" ),
165 tr( "Ok" ) ); 164 tr( "Ok" ) );
166 return; 165 return;
167 } 166 }
168 167
169 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 168 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
170 slotEditAccount( a ); 169 slotEditAccount( a );
171} 170}
172 171
173void EditAccounts::slotDeleteMail() 172void EditAccounts::slotDeleteMail()
174{ 173{
175 if ( !mailList->currentItem() ) { 174 if ( !mailList->currentItem() ) {
176 QMessageBox::information( this, tr( "Error" ), 175 QMessageBox::information( this, tr( "Error" ),
177 tr( "<p>Please select an account.</p>" ), 176 tr( "<p>Please select an account.</p>" ),
178 tr( "Ok" ) ); 177 tr( "Ok" ) );
179 return; 178 return;
180 } 179 }
181 180
182 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 181 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
183 slotDeleteAccount( a ); 182 slotDeleteAccount( a );
184} 183}
185 184
186void EditAccounts::slotNewNews() 185void EditAccounts::slotNewNews()
187{ 186{
188 qDebug( "New News Account" ); 187 qDebug( "New News Account" );
189 slotNewAccount( "NNTP" ); 188 slotNewAccount( "NNTP" );
190} 189}
191 190
192void EditAccounts::slotEditNews() 191void EditAccounts::slotEditNews()
193{ 192{
194 qDebug( "Edit News Account" ); 193 qDebug( "Edit News Account" );
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
index 13a3fd9..ea9e7b2 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
@@ -1,201 +1,199 @@
1#include <qfileinfo.h>
2#include <stdlib.h> 1#include <stdlib.h>
3#include <sys/stat.h> 2#include <sys/stat.h>
4#include <sys/types.h> 3#include <sys/types.h>
5#include <unistd.h> 4#include <unistd.h>
6#include <fcntl.h> 5#include <fcntl.h>
7#include <string.h> 6#include <string.h>
8#include <qdir.h> 7#include <qdir.h>
9#include <qtextstream.h>
10 8
11#include "mailwrapper.h" 9#include "mailwrapper.h"
12#include "logindialog.h" 10#include "logindialog.h"
13//#include "mail.h" 11//#include "mail.h"
14#include "defines.h" 12#include "defines.h"
15 13
16Attachment::Attachment( DocLnk lnk ) 14Attachment::Attachment( DocLnk lnk )
17{ 15{
18 doc = lnk; 16 doc = lnk;
19 size = QFileInfo( doc.file() ).size(); 17 size = QFileInfo( doc.file() ).size();
20} 18}
21 19
22Folder::Folder(const QString&tmp_name ) 20Folder::Folder(const QString&tmp_name )
23{ 21{
24 name = tmp_name; 22 name = tmp_name;
25 nameDisplay = name; 23 nameDisplay = name;
26 24
27 for ( int pos = nameDisplay.find( '&' ); pos != -1; 25 for ( int pos = nameDisplay.find( '&' ); pos != -1;
28 pos = nameDisplay.find( '&' ) ) { 26 pos = nameDisplay.find( '&' ) ) {
29 int end = nameDisplay.find( '-' ); 27 int end = nameDisplay.find( '-' );
30 if ( end == -1 || end <= pos ) break; 28 if ( end == -1 || end <= pos ) break;
31 QString str64 = nameDisplay.mid( pos + 1, end - pos - 1 ); 29 QString str64 = nameDisplay.mid( pos + 1, end - pos - 1 );
32 // TODO: do real base64 decoding here ! 30 // TODO: do real base64 decoding here !
33 if ( str64.compare( "APw" ) == 0 ) { 31 if ( str64.compare( "APw" ) == 0 ) {
34 nameDisplay = nameDisplay.replace( pos, end - pos + 1, "ue" ); 32 nameDisplay = nameDisplay.replace( pos, end - pos + 1, "ue" );
35 } else if ( str64.compare( "APY" ) == 0 ) { 33 } else if ( str64.compare( "APY" ) == 0 ) {
36 nameDisplay = nameDisplay.replace( pos, end - pos + 1, "oe" ); 34 nameDisplay = nameDisplay.replace( pos, end - pos + 1, "oe" );
37 } 35 }
38 } 36 }
39 37
40 qDebug( "folder " + name + " - displayed as " + nameDisplay ); 38 qDebug( "folder " + name + " - displayed as " + nameDisplay );
41} 39}
42 40
43MailWrapper::MailWrapper( Settings *s ) 41MailWrapper::MailWrapper( Settings *s )
44 : QObject() 42 : QObject()
45{ 43{
46 settings = s; 44 settings = s;
47} 45}
48 46
49QString MailWrapper::mailsmtpError( int errnum ) 47QString MailWrapper::mailsmtpError( int errnum )
50{ 48{
51 switch ( errnum ) { 49 switch ( errnum ) {
52 case MAILSMTP_NO_ERROR: 50 case MAILSMTP_NO_ERROR:
53 return tr( "No error" ); 51 return tr( "No error" );
54 case MAILSMTP_ERROR_UNEXPECTED_CODE: 52 case MAILSMTP_ERROR_UNEXPECTED_CODE:
55 return tr( "Unexpected error code" ); 53 return tr( "Unexpected error code" );
56 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 54 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
57 return tr( "Service not available" ); 55 return tr( "Service not available" );
58 case MAILSMTP_ERROR_STREAM: 56 case MAILSMTP_ERROR_STREAM:
59 return tr( "Stream error" ); 57 return tr( "Stream error" );
60 case MAILSMTP_ERROR_HOSTNAME: 58 case MAILSMTP_ERROR_HOSTNAME:
61 return tr( "gethostname() failed" ); 59 return tr( "gethostname() failed" );
62 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 60 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
63 return tr( "Not implemented" ); 61 return tr( "Not implemented" );
64 case MAILSMTP_ERROR_ACTION_NOT_TAKEN: 62 case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
65 return tr( "Error, action not taken" ); 63 return tr( "Error, action not taken" );
66 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: 64 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
67 return tr( "Data exceeds storage allocation" ); 65 return tr( "Data exceeds storage allocation" );
68 case MAILSMTP_ERROR_IN_PROCESSING: 66 case MAILSMTP_ERROR_IN_PROCESSING:
69 return tr( "Error in processing" ); 67 return tr( "Error in processing" );
70 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: 68 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
71 // return tr( "Insufficient system storage" ); 69 // return tr( "Insufficient system storage" );
72 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: 70 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
73 return tr( "Mailbox unavailable" ); 71 return tr( "Mailbox unavailable" );
74 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: 72 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
75 return tr( "Mailbox name not allowed" ); 73 return tr( "Mailbox name not allowed" );
76 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: 74 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
77 return tr( "Bad command sequence" ); 75 return tr( "Bad command sequence" );
78 case MAILSMTP_ERROR_USER_NOT_LOCAL: 76 case MAILSMTP_ERROR_USER_NOT_LOCAL:
79 return tr( "User not local" ); 77 return tr( "User not local" );
80 case MAILSMTP_ERROR_TRANSACTION_FAILED: 78 case MAILSMTP_ERROR_TRANSACTION_FAILED:
81 return tr( "Transaction failed" ); 79 return tr( "Transaction failed" );
82 case MAILSMTP_ERROR_MEMORY: 80 case MAILSMTP_ERROR_MEMORY:
83 return tr( "Memory error" ); 81 return tr( "Memory error" );
84 case MAILSMTP_ERROR_CONNECTION_REFUSED: 82 case MAILSMTP_ERROR_CONNECTION_REFUSED:
85 return tr( "Connection refused" ); 83 return tr( "Connection refused" );
86 default: 84 default:
87 return tr( "Unknown error code" ); 85 return tr( "Unknown error code" );
88 } 86 }
89} 87}
90 88
91mailimf_mailbox *MailWrapper::newMailbox(const QString&name, const QString&mail ) 89mailimf_mailbox *MailWrapper::newMailbox(const QString&name, const QString&mail )
92{ 90{
93 return mailimf_mailbox_new( strdup( name.latin1() ), 91 return mailimf_mailbox_new( strdup( name.latin1() ),
94 strdup( mail.latin1() ) ); 92 strdup( mail.latin1() ) );
95} 93}
96 94
97mailimf_address_list *MailWrapper::parseAddresses(const QString&addr ) 95mailimf_address_list *MailWrapper::parseAddresses(const QString&addr )
98{ 96{
99 mailimf_address_list *addresses; 97 mailimf_address_list *addresses;
100 98
101 if ( addr.isEmpty() ) return NULL; 99 if ( addr.isEmpty() ) return NULL;
102 100
103 addresses = mailimf_address_list_new_empty(); 101 addresses = mailimf_address_list_new_empty();
104 102
105 QStringList list = QStringList::split( ',', addr ); 103 QStringList list = QStringList::split( ',', addr );
106 QStringList::Iterator it; 104 QStringList::Iterator it;
107 for ( it = list.begin(); it != list.end(); it++ ) { 105 for ( it = list.begin(); it != list.end(); it++ ) {
108 char *str = strdup( (*it).latin1() ); 106 char *str = strdup( (*it).latin1() );
109 int err = mailimf_address_list_add_parse( addresses, str ); 107 int err = mailimf_address_list_add_parse( addresses, str );
110 if ( err != MAILIMF_NO_ERROR ) { 108 if ( err != MAILIMF_NO_ERROR ) {
111 qDebug( "Error parsing" ); 109 qDebug( "Error parsing" );
112 qDebug( *it ); 110 qDebug( *it );
113 free( str ); 111 free( str );
114 } else { 112 } else {
115 qDebug( "Parse success! :)" ); 113 qDebug( "Parse success! :)" );
116 } 114 }
117 } 115 }
118 116
119 return addresses; 117 return addresses;
120} 118}
121 119
122mailimf_fields *MailWrapper::createImfFields( Mail *mail ) 120mailimf_fields *MailWrapper::createImfFields( Mail *mail )
123{ 121{
124 mailimf_fields *fields; 122 mailimf_fields *fields;
125 mailimf_field *xmailer; 123 mailimf_field *xmailer;
126 mailimf_mailbox *sender, *fromBox; 124 mailimf_mailbox *sender, *fromBox;
127 mailimf_mailbox_list *from; 125 mailimf_mailbox_list *from;
128 mailimf_address_list *to, *cc, *bcc, *reply; 126 mailimf_address_list *to, *cc, *bcc, *reply;
129 char *subject = strdup( mail->getSubject().latin1() ); 127 char *subject = strdup( mail->getSubject().latin1() );
130 int err; 128 int err;
131 129
132 sender = newMailbox( mail->getName(), mail->getMail() ); 130 sender = newMailbox( mail->getName(), mail->getMail() );
133 if ( sender == NULL ) goto err_free; 131 if ( sender == NULL ) goto err_free;
134 132
135 fromBox = newMailbox( mail->getName(), mail->getMail() ); 133 fromBox = newMailbox( mail->getName(), mail->getMail() );
136 if ( fromBox == NULL ) goto err_free_sender; 134 if ( fromBox == NULL ) goto err_free_sender;
137 135
138 from = mailimf_mailbox_list_new_empty(); 136 from = mailimf_mailbox_list_new_empty();
139 if ( from == NULL ) goto err_free_fromBox; 137 if ( from == NULL ) goto err_free_fromBox;
140 138
141 err = mailimf_mailbox_list_add( from, fromBox ); 139 err = mailimf_mailbox_list_add( from, fromBox );
142 if ( err != MAILIMF_NO_ERROR ) goto err_free_from; 140 if ( err != MAILIMF_NO_ERROR ) goto err_free_from;
143 141
144 to = parseAddresses( mail->getTo() ); 142 to = parseAddresses( mail->getTo() );
145 if ( to == NULL ) goto err_free_from; 143 if ( to == NULL ) goto err_free_from;
146 144
147 cc = parseAddresses( mail->getCC() ); 145 cc = parseAddresses( mail->getCC() );
148 bcc = parseAddresses( mail->getBCC() ); 146 bcc = parseAddresses( mail->getBCC() );
149 reply = parseAddresses( mail->getReply() ); 147 reply = parseAddresses( mail->getReply() );
150 148
151 fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, 149 fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc,
152 NULL, NULL, subject ); 150 NULL, NULL, subject );
153 if ( fields == NULL ) goto err_free_reply; 151 if ( fields == NULL ) goto err_free_reply;
154 152
155 xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), 153 xmailer = mailimf_field_new_custom( strdup( "User-Agent" ),
156 strdup( USER_AGENT ) ); 154 strdup( USER_AGENT ) );
157 if ( xmailer == NULL ) goto err_free_fields; 155 if ( xmailer == NULL ) goto err_free_fields;
158 156
159 err = mailimf_fields_add( fields, xmailer ); 157 err = mailimf_fields_add( fields, xmailer );
160 if ( err != MAILIMF_NO_ERROR ) goto err_free_xmailer; 158 if ( err != MAILIMF_NO_ERROR ) goto err_free_xmailer;
161 159
162 return fields; // Success :) 160 return fields; // Success :)
163 161
164err_free_xmailer: 162err_free_xmailer:
165 mailimf_field_free( xmailer ); 163 mailimf_field_free( xmailer );
166err_free_fields: 164err_free_fields:
167 mailimf_fields_free( fields ); 165 mailimf_fields_free( fields );
168err_free_reply: 166err_free_reply:
169 mailimf_address_list_free( reply ); 167 mailimf_address_list_free( reply );
170 mailimf_address_list_free( bcc ); 168 mailimf_address_list_free( bcc );
171 mailimf_address_list_free( cc ); 169 mailimf_address_list_free( cc );
172 mailimf_address_list_free( to ); 170 mailimf_address_list_free( to );
173err_free_from: 171err_free_from:
174 mailimf_mailbox_list_free( from ); 172 mailimf_mailbox_list_free( from );
175err_free_fromBox: 173err_free_fromBox:
176 mailimf_mailbox_free( fromBox ); 174 mailimf_mailbox_free( fromBox );
177err_free_sender: 175err_free_sender:
178 mailimf_mailbox_free( sender ); 176 mailimf_mailbox_free( sender );
179err_free: 177err_free:
180 free( subject ); 178 free( subject );
181 qDebug( "createImfFields - error" ); 179 qDebug( "createImfFields - error" );
182 180
183 return NULL; // Error :( 181 return NULL; // Error :(
184} 182}
185 183
186mailmime *MailWrapper::buildTxtPart( QString str ) 184mailmime *MailWrapper::buildTxtPart( QString str )
187{ 185{
188 mailmime *txtPart; 186 mailmime *txtPart;
189 mailmime_fields *fields; 187 mailmime_fields *fields;
190 mailmime_content *content; 188 mailmime_content *content;
191 mailmime_parameter *param; 189 mailmime_parameter *param;
192 char *txt = strdup( str.latin1() ); 190 char *txt = strdup( str.latin1() );
193 int err; 191 int err;
194 192
195 param = mailmime_parameter_new( strdup( "charset" ), 193 param = mailmime_parameter_new( strdup( "charset" ),
196 strdup( "iso-8859-1" ) ); 194 strdup( "iso-8859-1" ) );
197 if ( param == NULL ) goto err_free; 195 if ( param == NULL ) goto err_free;
198 196
199 content = mailmime_content_new_with_str( "text/plain" ); 197 content = mailmime_content_new_with_str( "text/plain" );
200 if ( content == NULL ) goto err_free_param; 198 if ( content == NULL ) goto err_free_param;
201 199
diff --git a/noncore/net/mail/mailwrapper.cpp b/noncore/net/mail/mailwrapper.cpp
index 13a3fd9..ea9e7b2 100644
--- a/noncore/net/mail/mailwrapper.cpp
+++ b/noncore/net/mail/mailwrapper.cpp
@@ -1,201 +1,199 @@
1#include <qfileinfo.h>
2#include <stdlib.h> 1#include <stdlib.h>
3#include <sys/stat.h> 2#include <sys/stat.h>
4#include <sys/types.h> 3#include <sys/types.h>
5#include <unistd.h> 4#include <unistd.h>
6#include <fcntl.h> 5#include <fcntl.h>
7#include <string.h> 6#include <string.h>
8#include <qdir.h> 7#include <qdir.h>
9#include <qtextstream.h>
10 8
11#include "mailwrapper.h" 9#include "mailwrapper.h"
12#include "logindialog.h" 10#include "logindialog.h"
13//#include "mail.h" 11//#include "mail.h"
14#include "defines.h" 12#include "defines.h"
15 13
16Attachment::Attachment( DocLnk lnk ) 14Attachment::Attachment( DocLnk lnk )
17{ 15{
18 doc = lnk; 16 doc = lnk;
19 size = QFileInfo( doc.file() ).size(); 17 size = QFileInfo( doc.file() ).size();
20} 18}
21 19
22Folder::Folder(const QString&tmp_name ) 20Folder::Folder(const QString&tmp_name )
23{ 21{
24 name = tmp_name; 22 name = tmp_name;
25 nameDisplay = name; 23 nameDisplay = name;
26 24
27 for ( int pos = nameDisplay.find( '&' ); pos != -1; 25 for ( int pos = nameDisplay.find( '&' ); pos != -1;
28 pos = nameDisplay.find( '&' ) ) { 26 pos = nameDisplay.find( '&' ) ) {
29 int end = nameDisplay.find( '-' ); 27 int end = nameDisplay.find( '-' );
30 if ( end == -1 || end <= pos ) break; 28 if ( end == -1 || end <= pos ) break;
31 QString str64 = nameDisplay.mid( pos + 1, end - pos - 1 ); 29 QString str64 = nameDisplay.mid( pos + 1, end - pos - 1 );
32 // TODO: do real base64 decoding here ! 30 // TODO: do real base64 decoding here !
33 if ( str64.compare( "APw" ) == 0 ) { 31 if ( str64.compare( "APw" ) == 0 ) {
34 nameDisplay = nameDisplay.replace( pos, end - pos + 1, "ue" ); 32 nameDisplay = nameDisplay.replace( pos, end - pos + 1, "ue" );
35 } else if ( str64.compare( "APY" ) == 0 ) { 33 } else if ( str64.compare( "APY" ) == 0 ) {
36 nameDisplay = nameDisplay.replace( pos, end - pos + 1, "oe" ); 34 nameDisplay = nameDisplay.replace( pos, end - pos + 1, "oe" );
37 } 35 }
38 } 36 }
39 37
40 qDebug( "folder " + name + " - displayed as " + nameDisplay ); 38 qDebug( "folder " + name + " - displayed as " + nameDisplay );
41} 39}
42 40
43MailWrapper::MailWrapper( Settings *s ) 41MailWrapper::MailWrapper( Settings *s )
44 : QObject() 42 : QObject()
45{ 43{
46 settings = s; 44 settings = s;
47} 45}
48 46
49QString MailWrapper::mailsmtpError( int errnum ) 47QString MailWrapper::mailsmtpError( int errnum )
50{ 48{
51 switch ( errnum ) { 49 switch ( errnum ) {
52 case MAILSMTP_NO_ERROR: 50 case MAILSMTP_NO_ERROR:
53 return tr( "No error" ); 51 return tr( "No error" );
54 case MAILSMTP_ERROR_UNEXPECTED_CODE: 52 case MAILSMTP_ERROR_UNEXPECTED_CODE:
55 return tr( "Unexpected error code" ); 53 return tr( "Unexpected error code" );
56 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 54 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
57 return tr( "Service not available" ); 55 return tr( "Service not available" );
58 case MAILSMTP_ERROR_STREAM: 56 case MAILSMTP_ERROR_STREAM:
59 return tr( "Stream error" ); 57 return tr( "Stream error" );
60 case MAILSMTP_ERROR_HOSTNAME: 58 case MAILSMTP_ERROR_HOSTNAME:
61 return tr( "gethostname() failed" ); 59 return tr( "gethostname() failed" );
62 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 60 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
63 return tr( "Not implemented" ); 61 return tr( "Not implemented" );
64 case MAILSMTP_ERROR_ACTION_NOT_TAKEN: 62 case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
65 return tr( "Error, action not taken" ); 63 return tr( "Error, action not taken" );
66 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: 64 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
67 return tr( "Data exceeds storage allocation" ); 65 return tr( "Data exceeds storage allocation" );
68 case MAILSMTP_ERROR_IN_PROCESSING: 66 case MAILSMTP_ERROR_IN_PROCESSING:
69 return tr( "Error in processing" ); 67 return tr( "Error in processing" );
70 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: 68 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
71 // return tr( "Insufficient system storage" ); 69 // return tr( "Insufficient system storage" );
72 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: 70 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
73 return tr( "Mailbox unavailable" ); 71 return tr( "Mailbox unavailable" );
74 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: 72 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
75 return tr( "Mailbox name not allowed" ); 73 return tr( "Mailbox name not allowed" );
76 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: 74 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
77 return tr( "Bad command sequence" ); 75 return tr( "Bad command sequence" );
78 case MAILSMTP_ERROR_USER_NOT_LOCAL: 76 case MAILSMTP_ERROR_USER_NOT_LOCAL:
79 return tr( "User not local" ); 77 return tr( "User not local" );
80 case MAILSMTP_ERROR_TRANSACTION_FAILED: 78 case MAILSMTP_ERROR_TRANSACTION_FAILED:
81 return tr( "Transaction failed" ); 79 return tr( "Transaction failed" );
82 case MAILSMTP_ERROR_MEMORY: 80 case MAILSMTP_ERROR_MEMORY:
83 return tr( "Memory error" ); 81 return tr( "Memory error" );
84 case MAILSMTP_ERROR_CONNECTION_REFUSED: 82 case MAILSMTP_ERROR_CONNECTION_REFUSED:
85 return tr( "Connection refused" ); 83 return tr( "Connection refused" );
86 default: 84 default:
87 return tr( "Unknown error code" ); 85 return tr( "Unknown error code" );
88 } 86 }
89} 87}
90 88
91mailimf_mailbox *MailWrapper::newMailbox(const QString&name, const QString&mail ) 89mailimf_mailbox *MailWrapper::newMailbox(const QString&name, const QString&mail )
92{ 90{
93 return mailimf_mailbox_new( strdup( name.latin1() ), 91 return mailimf_mailbox_new( strdup( name.latin1() ),
94 strdup( mail.latin1() ) ); 92 strdup( mail.latin1() ) );
95} 93}
96 94
97mailimf_address_list *MailWrapper::parseAddresses(const QString&addr ) 95mailimf_address_list *MailWrapper::parseAddresses(const QString&addr )
98{ 96{
99 mailimf_address_list *addresses; 97 mailimf_address_list *addresses;
100 98
101 if ( addr.isEmpty() ) return NULL; 99 if ( addr.isEmpty() ) return NULL;
102 100
103 addresses = mailimf_address_list_new_empty(); 101 addresses = mailimf_address_list_new_empty();
104 102
105 QStringList list = QStringList::split( ',', addr ); 103 QStringList list = QStringList::split( ',', addr );
106 QStringList::Iterator it; 104 QStringList::Iterator it;
107 for ( it = list.begin(); it != list.end(); it++ ) { 105 for ( it = list.begin(); it != list.end(); it++ ) {
108 char *str = strdup( (*it).latin1() ); 106 char *str = strdup( (*it).latin1() );
109 int err = mailimf_address_list_add_parse( addresses, str ); 107 int err = mailimf_address_list_add_parse( addresses, str );
110 if ( err != MAILIMF_NO_ERROR ) { 108 if ( err != MAILIMF_NO_ERROR ) {
111 qDebug( "Error parsing" ); 109 qDebug( "Error parsing" );
112 qDebug( *it ); 110 qDebug( *it );
113 free( str ); 111 free( str );
114 } else { 112 } else {
115 qDebug( "Parse success! :)" ); 113 qDebug( "Parse success! :)" );
116 } 114 }
117 } 115 }
118 116
119 return addresses; 117 return addresses;
120} 118}
121 119
122mailimf_fields *MailWrapper::createImfFields( Mail *mail ) 120mailimf_fields *MailWrapper::createImfFields( Mail *mail )
123{ 121{
124 mailimf_fields *fields; 122 mailimf_fields *fields;
125 mailimf_field *xmailer; 123 mailimf_field *xmailer;
126 mailimf_mailbox *sender, *fromBox; 124 mailimf_mailbox *sender, *fromBox;
127 mailimf_mailbox_list *from; 125 mailimf_mailbox_list *from;
128 mailimf_address_list *to, *cc, *bcc, *reply; 126 mailimf_address_list *to, *cc, *bcc, *reply;
129 char *subject = strdup( mail->getSubject().latin1() ); 127 char *subject = strdup( mail->getSubject().latin1() );
130 int err; 128 int err;
131 129
132 sender = newMailbox( mail->getName(), mail->getMail() ); 130 sender = newMailbox( mail->getName(), mail->getMail() );
133 if ( sender == NULL ) goto err_free; 131 if ( sender == NULL ) goto err_free;
134 132
135 fromBox = newMailbox( mail->getName(), mail->getMail() ); 133 fromBox = newMailbox( mail->getName(), mail->getMail() );
136 if ( fromBox == NULL ) goto err_free_sender; 134 if ( fromBox == NULL ) goto err_free_sender;
137 135
138 from = mailimf_mailbox_list_new_empty(); 136 from = mailimf_mailbox_list_new_empty();
139 if ( from == NULL ) goto err_free_fromBox; 137 if ( from == NULL ) goto err_free_fromBox;
140 138
141 err = mailimf_mailbox_list_add( from, fromBox ); 139 err = mailimf_mailbox_list_add( from, fromBox );
142 if ( err != MAILIMF_NO_ERROR ) goto err_free_from; 140 if ( err != MAILIMF_NO_ERROR ) goto err_free_from;
143 141
144 to = parseAddresses( mail->getTo() ); 142 to = parseAddresses( mail->getTo() );
145 if ( to == NULL ) goto err_free_from; 143 if ( to == NULL ) goto err_free_from;
146 144
147 cc = parseAddresses( mail->getCC() ); 145 cc = parseAddresses( mail->getCC() );
148 bcc = parseAddresses( mail->getBCC() ); 146 bcc = parseAddresses( mail->getBCC() );
149 reply = parseAddresses( mail->getReply() ); 147 reply = parseAddresses( mail->getReply() );
150 148
151 fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, 149 fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc,
152 NULL, NULL, subject ); 150 NULL, NULL, subject );
153 if ( fields == NULL ) goto err_free_reply; 151 if ( fields == NULL ) goto err_free_reply;
154 152
155 xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), 153 xmailer = mailimf_field_new_custom( strdup( "User-Agent" ),
156 strdup( USER_AGENT ) ); 154 strdup( USER_AGENT ) );
157 if ( xmailer == NULL ) goto err_free_fields; 155 if ( xmailer == NULL ) goto err_free_fields;
158 156
159 err = mailimf_fields_add( fields, xmailer ); 157 err = mailimf_fields_add( fields, xmailer );
160 if ( err != MAILIMF_NO_ERROR ) goto err_free_xmailer; 158 if ( err != MAILIMF_NO_ERROR ) goto err_free_xmailer;
161 159
162 return fields; // Success :) 160 return fields; // Success :)
163 161
164err_free_xmailer: 162err_free_xmailer:
165 mailimf_field_free( xmailer ); 163 mailimf_field_free( xmailer );
166err_free_fields: 164err_free_fields:
167 mailimf_fields_free( fields ); 165 mailimf_fields_free( fields );
168err_free_reply: 166err_free_reply:
169 mailimf_address_list_free( reply ); 167 mailimf_address_list_free( reply );
170 mailimf_address_list_free( bcc ); 168 mailimf_address_list_free( bcc );
171 mailimf_address_list_free( cc ); 169 mailimf_address_list_free( cc );
172 mailimf_address_list_free( to ); 170 mailimf_address_list_free( to );
173err_free_from: 171err_free_from:
174 mailimf_mailbox_list_free( from ); 172 mailimf_mailbox_list_free( from );
175err_free_fromBox: 173err_free_fromBox:
176 mailimf_mailbox_free( fromBox ); 174 mailimf_mailbox_free( fromBox );
177err_free_sender: 175err_free_sender:
178 mailimf_mailbox_free( sender ); 176 mailimf_mailbox_free( sender );
179err_free: 177err_free:
180 free( subject ); 178 free( subject );
181 qDebug( "createImfFields - error" ); 179 qDebug( "createImfFields - error" );
182 180
183 return NULL; // Error :( 181 return NULL; // Error :(
184} 182}
185 183
186mailmime *MailWrapper::buildTxtPart( QString str ) 184mailmime *MailWrapper::buildTxtPart( QString str )
187{ 185{
188 mailmime *txtPart; 186 mailmime *txtPart;
189 mailmime_fields *fields; 187 mailmime_fields *fields;
190 mailmime_content *content; 188 mailmime_content *content;
191 mailmime_parameter *param; 189 mailmime_parameter *param;
192 char *txt = strdup( str.latin1() ); 190 char *txt = strdup( str.latin1() );
193 int err; 191 int err;
194 192
195 param = mailmime_parameter_new( strdup( "charset" ), 193 param = mailmime_parameter_new( strdup( "charset" ),
196 strdup( "iso-8859-1" ) ); 194 strdup( "iso-8859-1" ) );
197 if ( param == NULL ) goto err_free; 195 if ( param == NULL ) goto err_free;
198 196
199 content = mailmime_content_new_with_str( "text/plain" ); 197 content = mailmime_content_new_with_str( "text/plain" );
200 if ( content == NULL ) goto err_free_param; 198 if ( content == NULL ) goto err_free_param;
201 199
diff --git a/noncore/net/mail/main.cpp b/noncore/net/mail/main.cpp
index f97bea1..3bfcb4a 100644
--- a/noncore/net/mail/main.cpp
+++ b/noncore/net/mail/main.cpp
@@ -1,6 +1,5 @@
1#include <qpe/qpeapplication.h>
2#include <opie/oapplicationfactory.h> 1#include <opie/oapplicationfactory.h>
3 2
4#include "opiemail.h" 3#include "opiemail.h"
5 4
6OPIE_EXPORT_APP( OApplicationFactory<OpieMail> ) 5OPIE_EXPORT_APP( OApplicationFactory<OpieMail> )
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 28111d0..6f054cc 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,150 +1,149 @@
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 5
6#include <qpe/resource.h>
7 6
8#include "defines.h" 7#include "defines.h"
9#include "mainwindow.h" 8#include "mainwindow.h"
10 9
11MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 10MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
12 : QMainWindow( parent, name, flags ) 11 : QMainWindow( parent, name, flags )
13{ 12{
14 setCaption( tr( "Opie-Mail" ) ); 13 setCaption( tr( "Opie-Mail" ) );
15 setToolBarsMovable( false ); 14 setToolBarsMovable( false );
16 15
17 toolBar = new QToolBar( this ); 16 toolBar = new QToolBar( this );
18 menuBar = new QMenuBar( toolBar ); 17 menuBar = new QMenuBar( toolBar );
19 mailMenu = new QPopupMenu( menuBar ); 18 mailMenu = new QPopupMenu( menuBar );
20 menuBar->insertItem( tr( "Mail" ), mailMenu ); 19 menuBar->insertItem( tr( "Mail" ), mailMenu );
21 settingsMenu = new QPopupMenu( menuBar ); 20 settingsMenu = new QPopupMenu( menuBar );
22 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 21 menuBar->insertItem( tr( "Settings" ), settingsMenu );
23 22
24 addToolBar( toolBar ); 23 addToolBar( toolBar );
25 toolBar->setHorizontalStretchable( true ); 24 toolBar->setHorizontalStretchable( true );
26 25
27 QLabel *spacer = new QLabel( toolBar ); 26 QLabel *spacer = new QLabel( toolBar );
28 spacer->setBackgroundMode( QWidget::PaletteButton ); 27 spacer->setBackgroundMode( QWidget::PaletteButton );
29 toolBar->setStretchableWidget( spacer ); 28 toolBar->setStretchableWidget( spacer );
30 29
31 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 30 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
32 0, 0, this ); 31 0, 0, this );
33 composeMail->addTo( toolBar ); 32 composeMail->addTo( toolBar );
34 composeMail->addTo( mailMenu ); 33 composeMail->addTo( mailMenu );
35 34
36 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 35 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
37 0, 0, this ); 36 0, 0, this );
38 sendQueued->addTo( toolBar ); 37 sendQueued->addTo( toolBar );
39 sendQueued->addTo( mailMenu ); 38 sendQueued->addTo( mailMenu );
40 39
41 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 40 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
42 0, 0, this ); 41 0, 0, this );
43 syncFolders->addTo( toolBar ); 42 syncFolders->addTo( toolBar );
44 syncFolders->addTo( mailMenu ); 43 syncFolders->addTo( mailMenu );
45 44
46 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 45 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
47 0, 0, this, 0, true ); 46 0, 0, this, 0, true );
48 showFolders->addTo( toolBar ); 47 showFolders->addTo( toolBar );
49 showFolders->addTo( mailMenu ); 48 showFolders->addTo( mailMenu );
50 connect(showFolders, SIGNAL( toggled( bool ) ), 49 connect(showFolders, SIGNAL( toggled( bool ) ),
51 SLOT( slotShowFolders( bool ) ) ); 50 SLOT( slotShowFolders( bool ) ) );
52 51
53 searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, 52 searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS,
54 0, 0, this ); 53 0, 0, this );
55 searchMails->addTo( toolBar ); 54 searchMails->addTo( toolBar );
56 searchMails->addTo( mailMenu ); 55 searchMails->addTo( mailMenu );
57 56
58 57
59 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, 58 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS,
60 0, 0, this ); 59 0, 0, this );
61 editSettings->addTo( settingsMenu ); 60 editSettings->addTo( settingsMenu );
62 61
63 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, 62 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS,
64 0, 0, this ); 63 0, 0, this );
65 editAccounts->addTo( settingsMenu ); 64 editAccounts->addTo( settingsMenu );
66 65
67 QVBox *view = new QVBox( this ); 66 QVBox *view = new QVBox( this );
68 setCentralWidget( view ); 67 setCentralWidget( view );
69 68
70 folderView = new AccountView( view ); 69 folderView = new AccountView( view );
71 folderView->header()->hide(); 70 folderView->header()->hide();
72 folderView->setMinimumHeight( 90 ); 71 folderView->setMinimumHeight( 90 );
73 folderView->setMaximumHeight( 90 ); 72 folderView->setMaximumHeight( 90 );
74 folderView->addColumn( tr( "Mailbox" ) ); 73 folderView->addColumn( tr( "Mailbox" ) );
75 folderView->hide(); 74 folderView->hide();
76 75
77 mailView = new QListView( view ); 76 mailView = new QListView( view );
78 mailView->setMinimumHeight( 50 ); 77 mailView->setMinimumHeight( 50 );
79 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 78 mailView->addColumn( tr( "Subject" ),QListView::Manual );
80 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 79 mailView->addColumn( tr( "Sender" ),QListView::Manual );
81 mailView->addColumn( tr( "Date" )); 80 mailView->addColumn( tr( "Date" ));
82 mailView->setAllColumnsShowFocus(true); 81 mailView->setAllColumnsShowFocus(true);
83 mailView->setSorting(-1); 82 mailView->setSorting(-1);
84 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, 83 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this,
85 SLOT( displayMail( QListViewItem * ) ) ); 84 SLOT( displayMail( QListViewItem * ) ) );
86 85
87 connect(folderView,SIGNAL(refreshMailview(Maillist*)),this,SLOT(refreshMailView(Maillist*))); 86 connect(folderView,SIGNAL(refreshMailview(Maillist*)),this,SLOT(refreshMailView(Maillist*)));
88 87
89 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 88 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
90} 89}
91 90
92void MainWindow::slotAdjustColumns() 91void MainWindow::slotAdjustColumns()
93{ 92{
94 bool hidden = folderView->isHidden(); 93 bool hidden = folderView->isHidden();
95 if ( hidden ) folderView->show(); 94 if ( hidden ) folderView->show();
96 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 95 folderView->setColumnWidth( 0, folderView->visibleWidth() );
97 if ( hidden ) folderView->hide(); 96 if ( hidden ) folderView->hide();
98 97
99 mailView->setColumnWidth( 0, mailView->visibleWidth() - 130 ); 98 mailView->setColumnWidth( 0, mailView->visibleWidth() - 130 );
100 mailView->setColumnWidth( 1, 80 ); 99 mailView->setColumnWidth( 1, 80 );
101 mailView->setColumnWidth( 2, 50 ); 100 mailView->setColumnWidth( 2, 50 );
102} 101}
103 102
104void MainWindow::slotShowFolders( bool show ) 103void MainWindow::slotShowFolders( bool show )
105{ 104{
106 qDebug( "Show Folders" ); 105 qDebug( "Show Folders" );
107 if ( show && folderView->isHidden() ) { 106 if ( show && folderView->isHidden() ) {
108 qDebug( "-> showing" ); 107 qDebug( "-> showing" );
109 folderView->show(); 108 folderView->show();
110 } else if ( !show && !folderView->isHidden() ) { 109 } else if ( !show && !folderView->isHidden() ) {
111 qDebug( "-> hiding" ); 110 qDebug( "-> hiding" );
112 folderView->hide(); 111 folderView->hide();
113 } 112 }
114} 113}
115 114
116void MainWindow::refreshMailView(Maillist*list) 115void MainWindow::refreshMailView(Maillist*list)
117{ 116{
118 MailListViewItem*item = 0; 117 MailListViewItem*item = 0;
119 mailView->clear(); 118 mailView->clear();
120#if 0 119#if 0
121 QFont f = mailView->getFont(); 120 QFont f = mailView->getFont();
122 QFont bf = f; 121 QFont bf = f;
123#endif 122#endif
124 for (unsigned int i = 0; i < list->count();++i) { 123 for (unsigned int i = 0; i < list->count();++i) {
125 item = new MailListViewItem(mailView,item); 124 item = new MailListViewItem(mailView,item);
126 item->storeData(*(list->at(i))); 125 item->storeData(*(list->at(i)));
127 item->showEntry(); 126 item->showEntry();
128#if 0 127#if 0
129 if (!list->at(i)->getFlags().testBit(FLAG_SEEN)) { 128 if (!list->at(i)->getFlags().testBit(FLAG_SEEN)) {
130 item->setFont(bf); 129 item->setFont(bf);
131 } 130 }
132#endif 131#endif
133 } 132 }
134} 133}
135void MainWindow::displayMail(QListViewItem*item) 134void MainWindow::displayMail(QListViewItem*item)
136{ 135{
137 if (!item) return; 136 if (!item) return;
138 qDebug("View mail"); 137 qDebug("View mail");
139 RecMail mail = ((MailListViewItem*)item)->data(); 138 RecMail mail = ((MailListViewItem*)item)->data();
140 QString body = folderView->fetchBody(mail); 139 QString body = folderView->fetchBody(mail);
141 140
142 qDebug(body); 141 qDebug(body);
143} 142}
144 143
145void MailListViewItem::showEntry() 144void MailListViewItem::showEntry()
146{ 145{
147 setText(0,mail_data.getSubject()); 146 setText(0,mail_data.getSubject());
148 setText(1,mail_data.getFrom()); 147 setText(1,mail_data.getFrom());
149 setText(2,mail_data.getDate()); 148 setText(2,mail_data.getDate());
150} 149}