-rw-r--r-- | noncore/net/mail/composemail.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/mailwrapper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/main.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 1 |
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,109 +1,102 @@ | |||
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 | ||
15 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 8 | ComposeMail::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 | ||
50 | void ComposeMail::pickAddress( QLineEdit *line ) | 43 | void 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 | ||
60 | void ComposeMail::pickAddressTo() | 53 | void ComposeMail::pickAddressTo() |
61 | { | 54 | { |
62 | pickAddress( toLine ); | 55 | pickAddress( toLine ); |
63 | } | 56 | } |
64 | 57 | ||
65 | void ComposeMail::pickAddressCC() | 58 | void ComposeMail::pickAddressCC() |
66 | { | 59 | { |
67 | pickAddress( ccLine ); | 60 | pickAddress( ccLine ); |
68 | } | 61 | } |
69 | 62 | ||
70 | void ComposeMail::pickAddressBCC() | 63 | void ComposeMail::pickAddressBCC() |
71 | { | 64 | { |
72 | pickAddress( bccLine ); | 65 | pickAddress( bccLine ); |
73 | } | 66 | } |
74 | 67 | ||
75 | void ComposeMail::pickAddressReply() | 68 | void ComposeMail::pickAddressReply() |
76 | { | 69 | { |
77 | pickAddress( replyLine ); | 70 | pickAddress( replyLine ); |
78 | } | 71 | } |
79 | 72 | ||
80 | void ComposeMail::fillValues( int current ) | 73 | void 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 | ||
100 | void ComposeMail::slotAdjustColumns() | 93 | void 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 | } |
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,98 +1,97 @@ | |||
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 | ||
7 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 6 | AccountListItem::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 | ||
15 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 14 | EditAccounts::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 | ||
36 | void EditAccounts::slotFillLists() | 35 | void 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 | ||
52 | void EditAccounts::slotNewMail() | 51 | void 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 | ||
63 | void EditAccounts::slotNewAccount( const QString &type ) | 62 | void 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 { |
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,105 +1,103 @@ | |||
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 | ||
16 | Attachment::Attachment( DocLnk lnk ) | 14 | Attachment::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 | ||
22 | Folder::Folder(const QString&tmp_name ) | 20 | Folder::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 | ||
43 | MailWrapper::MailWrapper( Settings *s ) | 41 | MailWrapper::MailWrapper( Settings *s ) |
44 | : QObject() | 42 | : QObject() |
45 | { | 43 | { |
46 | settings = s; | 44 | settings = s; |
47 | } | 45 | } |
48 | 46 | ||
49 | QString MailWrapper::mailsmtpError( int errnum ) | 47 | QString 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 | ||
91 | mailimf_mailbox *MailWrapper::newMailbox(const QString&name, const QString&mail ) | 89 | mailimf_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 | ||
97 | mailimf_address_list *MailWrapper::parseAddresses(const QString&addr ) | 95 | mailimf_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 ); |
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,105 +1,103 @@ | |||
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 | ||
16 | Attachment::Attachment( DocLnk lnk ) | 14 | Attachment::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 | ||
22 | Folder::Folder(const QString&tmp_name ) | 20 | Folder::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 | ||
43 | MailWrapper::MailWrapper( Settings *s ) | 41 | MailWrapper::MailWrapper( Settings *s ) |
44 | : QObject() | 42 | : QObject() |
45 | { | 43 | { |
46 | settings = s; | 44 | settings = s; |
47 | } | 45 | } |
48 | 46 | ||
49 | QString MailWrapper::mailsmtpError( int errnum ) | 47 | QString 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 | ||
91 | mailimf_mailbox *MailWrapper::newMailbox(const QString&name, const QString&mail ) | 89 | mailimf_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 | ||
97 | mailimf_address_list *MailWrapper::parseAddresses(const QString&addr ) | 95 | mailimf_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 ); |
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 | ||
6 | OPIE_EXPORT_APP( OApplicationFactory<OpieMail> ) | 5 | OPIE_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,102 +1,101 @@ | |||
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 | ||
11 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 10 | MainWindow::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 | ||
92 | void MainWindow::slotAdjustColumns() | 91 | void 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 | } |