-rw-r--r-- | noncore/net/mail/defines.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 17 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/viewmailbase.cpp | 2 | ||||
-rw-r--r-- | pics/mail/abort.png | bin | 702 -> 0 bytes | |||
-rw-r--r-- | pics/mail/configure.png | bin | 697 -> 0 bytes | |||
-rw-r--r-- | pics/mail/delete.png | bin | 626 -> 0 bytes | |||
-rw-r--r-- | pics/mail/deletemail.png | bin | 679 -> 0 bytes | |||
-rw-r--r-- | pics/mail/editsettings.png | bin | 697 -> 0 bytes | |||
-rw-r--r-- | pics/mail/find.png | bin | 809 -> 0 bytes | |||
-rw-r--r-- | pics/mail/folder.png | bin | 767 -> 0 bytes | |||
-rw-r--r-- | pics/mail/mailchecker.png | bin | 832 -> 0 bytes | |||
-rw-r--r-- | pics/mail/reload.png | bin | 699 -> 0 bytes | |||
-rw-r--r-- | pics/mail/savemail.png | bin | 757 -> 0 bytes | |||
-rw-r--r-- | pics/mail/searchmails.png | bin | 820 -> 0 bytes |
16 files changed, 16 insertions, 17 deletions
diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h index 36c85c7..ebe8e08 100644 --- a/noncore/net/mail/defines.h +++ b/noncore/net/mail/defines.h | |||
@@ -1,57 +1,54 @@ | |||
1 | #ifndef DEFINE_CONSTANTS_H | 1 | #ifndef DEFINE_CONSTANTS_H |
2 | #define DEFINE_CONSTANTS_H | 2 | #define DEFINE_CONSTANTS_H |
3 | 3 | ||
4 | #include <qpe/resource.h> | 4 | #include <qpe/resource.h> |
5 | 5 | ||
6 | #define USER_AGENT "OpieMail v0.1" | 6 | #define USER_AGENT "OpieMail v0.3" |
7 | 7 | ||
8 | #define PIC_COMPOSEMAIL "mail/composemail" | 8 | #define PIC_COMPOSEMAIL "mail/composemail" |
9 | #define PIC_SENDQUEUED "mail/sendqueued" | 9 | #define PIC_SENDQUEUED "mail/sendqueued" |
10 | #define PIC_SHOWFOLDERS "mail/showfolders" | 10 | #define PIC_SHOWFOLDERS "mail/showfolders" |
11 | #define PIC_SEARCHMAILS "mail/searchmails" | ||
12 | #define PIC_EDITSETTINGS "mail/editsettings" | ||
13 | #define PIC_EDITACCOUNTS "mail/editaccounts" | ||
14 | #define PIC_SYNC "mail/sync" | 11 | #define PIC_SYNC "mail/sync" |
15 | #define PIC_IMAPFOLDER "mail/imapfolder" | 12 | #define PIC_IMAPFOLDER "mail/imapfolder" |
16 | #define PIC_MBOXFOLDER "mail/mboxfolder" | 13 | #define PIC_MBOXFOLDER "mail/mboxfolder" |
17 | #define PIC_POP3FOLDER "mail/pop3folder" | 14 | #define PIC_POP3FOLDER "mail/pop3folder" |
18 | #define PIC_INBOXFOLDER "mail/inbox" | 15 | #define PIC_INBOXFOLDER "mail/inbox" |
19 | #define PIC_OUTBOXFOLDER "mail/outbox" | 16 | #define PIC_OUTBOXFOLDER "mail/outbox" |
20 | #define PIC_LOCALFOLDER "mail/localfolder" | 17 | #define PIC_LOCALFOLDER "mail/localfolder" |
21 | 18 | ||
22 | #define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) ) | 19 | #define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) ) |
23 | #define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) ) | 20 | #define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) ) |
24 | #define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) ) | 21 | #define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) ) |
25 | #define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) ) | 22 | #define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) ) |
26 | #define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) ) | 23 | #define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) ) |
27 | #define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) ) | 24 | #define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) ) |
28 | #define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) ) | 25 | #define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) ) |
29 | 26 | ||
30 | #define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) ) | 27 | #define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) ) |
31 | #define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) ) | 28 | #define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) ) |
32 | #define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) ) | 29 | #define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) ) |
33 | #define PIXMAP_MBOXFOLDER QPixmap( Resource::loadPixmap( PIC_MBOXFOLDER ) ) | 30 | #define PIXMAP_MBOXFOLDER QPixmap( Resource::loadPixmap( PIC_MBOXFOLDER ) ) |
34 | #define PIXMAP_OUTBOXFOLDER QPixmap( Resource::loadPixmap( PIC_OUTBOXFOLDER) ) | 31 | #define PIXMAP_OUTBOXFOLDER QPixmap( Resource::loadPixmap( PIC_OUTBOXFOLDER) ) |
35 | #define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) ) | 32 | #define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) ) |
36 | 33 | ||
37 | #define IMAP_PORT "143" | 34 | #define IMAP_PORT "143" |
38 | #define IMAP_SSL_PORT "993" | 35 | #define IMAP_SSL_PORT "993" |
39 | #define SMTP_PORT "25" | 36 | #define SMTP_PORT "25" |
40 | #define SMTP_SSL_PORT "465" | 37 | #define SMTP_SSL_PORT "465" |
41 | #define POP3_PORT "110" | 38 | #define POP3_PORT "110" |
42 | #define POP3_SSL_PORT "995" | 39 | #define POP3_SSL_PORT "995" |
43 | #define NNTP_PORT "119" | 40 | #define NNTP_PORT "119" |
44 | #define NNTP_SSL_PORT "563" | 41 | #define NNTP_SSL_PORT "563" |
45 | 42 | ||
46 | /* used for decoding imapfoldername */ | 43 | /* used for decoding imapfoldername */ |
47 | #define UNDEFINED 64 | 44 | #define UNDEFINED 64 |
48 | #define MAXLINE 76 | 45 | #define MAXLINE 76 |
49 | #define UTF16MASK 0x03FFUL | 46 | #define UTF16MASK 0x03FFUL |
50 | #define UTF16SHIFT 10 | 47 | #define UTF16SHIFT 10 |
51 | #define UTF16BASE 0x10000UL | 48 | #define UTF16BASE 0x10000UL |
52 | #define UTF16HIGHSTART 0xD800UL | 49 | #define UTF16HIGHSTART 0xD800UL |
53 | #define UTF16HIGHEND 0xDBFFUL | 50 | #define UTF16HIGHEND 0xDBFFUL |
54 | #define UTF16LOSTART 0xDC00UL | 51 | #define UTF16LOSTART 0xDC00UL |
55 | #define UTF16LOEND 0xDFFFUL | 52 | #define UTF16LOEND 0xDFFFUL |
56 | 53 | ||
57 | #endif | 54 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index ec4dcd2..cceb22e 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -1,250 +1,251 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include "pop3wrapper.h" | 2 | #include "pop3wrapper.h" |
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
4 | #include "logindialog.h" | 4 | #include "logindialog.h" |
5 | #include <libetpan/libetpan.h> | 5 | #include <libetpan/libetpan.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qstring.h> | 8 | #include <qstring.h> |
9 | 9 | ||
10 | /* we don't fetch messages larger than 5 MB */ | 10 | /* we don't fetch messages larger than 5 MB */ |
11 | #define HARD_MSG_SIZE_LIMIT 5242880 | 11 | #define HARD_MSG_SIZE_LIMIT 5242880 |
12 | 12 | ||
13 | POP3wrapper::POP3wrapper( POP3account *a ) | 13 | POP3wrapper::POP3wrapper( POP3account *a ) |
14 | : Genericwrapper() | 14 | : Genericwrapper() |
15 | { | 15 | { |
16 | account = a; | 16 | account = a; |
17 | m_pop3 = NULL; | 17 | m_pop3 = NULL; |
18 | m_folder = NULL; | 18 | m_folder = NULL; |
19 | msgTempName = a->getFileName()+"_msg_cache"; | 19 | msgTempName = a->getFileName()+"_msg_cache"; |
20 | last_msg_id = 0; | 20 | last_msg_id = 0; |
21 | } | 21 | } |
22 | 22 | ||
23 | POP3wrapper::~POP3wrapper() | 23 | POP3wrapper::~POP3wrapper() |
24 | { | 24 | { |
25 | logout(); | 25 | logout(); |
26 | QFile msg_cache(msgTempName); | 26 | QFile msg_cache(msgTempName); |
27 | if (msg_cache.exists()) { | 27 | if (msg_cache.exists()) { |
28 | msg_cache.remove(); | 28 | msg_cache.remove(); |
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
32 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) | 32 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) |
33 | { | 33 | { |
34 | qDebug( "POP3: %i of %i", current, maximum ); | 34 | qDebug( "POP3: %i of %i", current, maximum ); |
35 | } | 35 | } |
36 | 36 | ||
37 | RecBody POP3wrapper::fetchBody( const RecMail &mail ) | 37 | RecBody POP3wrapper::fetchBody( const RecMail &mail ) |
38 | { | 38 | { |
39 | int err = MAILPOP3_NO_ERROR; | 39 | int err = MAILPOP3_NO_ERROR; |
40 | char *message = 0; | 40 | char *message = 0; |
41 | size_t length = 0; | 41 | size_t length = 0; |
42 | 42 | ||
43 | login(); | 43 | login(); |
44 | if ( !m_pop3 ) { | 44 | if ( !m_pop3 ) { |
45 | return RecBody(); | 45 | return RecBody(); |
46 | } | 46 | } |
47 | 47 | ||
48 | RecBody body; | 48 | RecBody body; |
49 | mailmessage * mailmsg; | 49 | mailmessage * mailmsg; |
50 | if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { | 50 | if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { |
51 | qDebug("Message to large: %i",mail.Msgsize()); | 51 | qDebug("Message to large: %i",mail.Msgsize()); |
52 | return body; | 52 | return body; |
53 | } | 53 | } |
54 | 54 | ||
55 | QFile msg_cache(msgTempName); | 55 | QFile msg_cache(msgTempName); |
56 | 56 | ||
57 | cleanMimeCache(); | 57 | cleanMimeCache(); |
58 | 58 | ||
59 | if (mail.getNumber()!=last_msg_id) { | 59 | if (mail.getNumber()!=last_msg_id) { |
60 | if (msg_cache.exists()) { | 60 | if (msg_cache.exists()) { |
61 | msg_cache.remove(); | 61 | msg_cache.remove(); |
62 | } | 62 | } |
63 | msg_cache.open(IO_ReadWrite|IO_Truncate); | 63 | msg_cache.open(IO_ReadWrite|IO_Truncate); |
64 | last_msg_id = mail.getNumber(); | 64 | last_msg_id = mail.getNumber(); |
65 | err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); | 65 | err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); |
66 | err = mailmessage_fetch(mailmsg,&message,&length); | 66 | err = mailmessage_fetch(mailmsg,&message,&length); |
67 | msg_cache.writeBlock(message,length); | 67 | msg_cache.writeBlock(message,length); |
68 | } else { | 68 | } else { |
69 | QString msg=""; | 69 | QString msg=""; |
70 | msg_cache.open(IO_ReadOnly); | 70 | msg_cache.open(IO_ReadOnly); |
71 | message = new char[4096]; | 71 | message = new char[4096]; |
72 | memset(message,0,4096); | 72 | memset(message,0,4096); |
73 | while (msg_cache.readBlock(message,4095)>0) { | 73 | while (msg_cache.readBlock(message,4095)>0) { |
74 | msg+=message; | 74 | msg+=message; |
75 | memset(message,0,4096); | 75 | memset(message,0,4096); |
76 | } | 76 | } |
77 | delete message; | 77 | delete message; |
78 | message = (char*)malloc(msg.length()+1*sizeof(char)); | 78 | message = (char*)malloc(msg.length()+1*sizeof(char)); |
79 | memset(message,0,msg.length()+1); | 79 | memset(message,0,msg.length()+1); |
80 | memcpy(message,msg.latin1(),msg.length()); | 80 | memcpy(message,msg.latin1(),msg.length()); |
81 | /* transform to libetpan stuff */ | 81 | /* transform to libetpan stuff */ |
82 | mailmsg = mailmessage_new(); | 82 | mailmsg = mailmessage_new(); |
83 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); | 83 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); |
84 | generic_message_t * msg_data; | 84 | generic_message_t * msg_data; |
85 | msg_data = (generic_message_t *)mailmsg->msg_data; | 85 | msg_data = (generic_message_t *)mailmsg->msg_data; |
86 | msg_data->msg_fetched = 1; | 86 | msg_data->msg_fetched = 1; |
87 | msg_data->msg_message = message; | 87 | msg_data->msg_message = message; |
88 | msg_data->msg_length = strlen(message); | 88 | msg_data->msg_length = strlen(message); |
89 | } | 89 | } |
90 | body = parseMail(mailmsg); | 90 | body = parseMail(mailmsg); |
91 | 91 | ||
92 | /* clean up */ | 92 | /* clean up */ |
93 | if (mailmsg) mailmessage_free(mailmsg); | 93 | if (mailmsg) mailmessage_free(mailmsg); |
94 | if (message) free(message); | 94 | if (message) free(message); |
95 | 95 | ||
96 | return body; | 96 | return body; |
97 | } | 97 | } |
98 | 98 | ||
99 | void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | 99 | void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) |
100 | { | 100 | { |
101 | login(); | 101 | login(); |
102 | if (!m_pop3) return; | 102 | if (!m_pop3) return; |
103 | uint32_t res_messages,res_recent,res_unseen; | 103 | uint32_t res_messages,res_recent,res_unseen; |
104 | mailsession_status_folder(m_folder->fld_session,"INBOX",&res_messages,&res_recent,&res_unseen); | 104 | mailsession_status_folder(m_folder->fld_session,"INBOX",&res_messages,&res_recent,&res_unseen); |
105 | parseList(target,m_folder->fld_session,"INBOX"); | 105 | parseList(target,m_folder->fld_session,"INBOX"); |
106 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); | 106 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); |
107 | } | 107 | } |
108 | 108 | ||
109 | void POP3wrapper::login() | 109 | void POP3wrapper::login() |
110 | { | 110 | { |
111 | /* we'll hold the line */ | 111 | /* we'll hold the line */ |
112 | if ( m_pop3 != NULL ) return; | 112 | if ( m_pop3 != NULL ) return; |
113 | 113 | ||
114 | const char *server, *user, *pass; | 114 | const char *server, *user, *pass; |
115 | uint16_t port; | 115 | uint16_t port; |
116 | int err = MAILPOP3_NO_ERROR; | 116 | int err = MAILPOP3_NO_ERROR; |
117 | 117 | ||
118 | server = account->getServer().latin1(); | 118 | server = account->getServer().latin1(); |
119 | port = account->getPort().toUInt(); | 119 | port = account->getPort().toUInt(); |
120 | 120 | ||
121 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 121 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
122 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 122 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
123 | login.show(); | 123 | login.show(); |
124 | if ( QDialog::Accepted == login.exec() ) { | 124 | if ( QDialog::Accepted == login.exec() ) { |
125 | // ok | 125 | // ok |
126 | user = login.getUser().latin1(); | 126 | user = login.getUser().latin1(); |
127 | pass = login.getPassword().latin1(); | 127 | pass = login.getPassword().latin1(); |
128 | } else { | 128 | } else { |
129 | // cancel | 129 | // cancel |
130 | qDebug( "POP3: Login canceled" ); | 130 | qDebug( "POP3: Login canceled" ); |
131 | return; | 131 | return; |
132 | } | 132 | } |
133 | } else { | 133 | } else { |
134 | user = account->getUser().latin1(); | 134 | user = account->getUser().latin1(); |
135 | pass = account->getPassword().latin1(); | 135 | pass = account->getPassword().latin1(); |
136 | } | 136 | } |
137 | 137 | ||
138 | bool ssl = account->getSSL(); | 138 | bool ssl = account->getSSL(); |
139 | 139 | ||
140 | m_pop3=mailstorage_new(NULL); | 140 | m_pop3=mailstorage_new(NULL); |
141 | int conntype = (ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); | 141 | int conntype = (ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); |
142 | 142 | ||
143 | pop3_mailstorage_init(m_pop3,(char*)server,port,NULL,conntype,POP3_AUTH_TYPE_PLAIN, | 143 | pop3_mailstorage_init(m_pop3,(char*)server,port,NULL,conntype,POP3_AUTH_TYPE_PLAIN, |
144 | (char*)user,(char*)pass,0,0,0); | 144 | (char*)user,(char*)pass,0,0,0); |
145 | 145 | ||
146 | m_folder = mailfolder_new(m_pop3, NULL, NULL); | 146 | m_folder = mailfolder_new(m_pop3, NULL, NULL); |
147 | 147 | ||
148 | if (m_folder==0) { | 148 | if (m_folder==0) { |
149 | Global::statusMessage(tr("Error initializing folder")); | 149 | Global::statusMessage(tr("Error initializing folder")); |
150 | mailstorage_free(m_pop3); | 150 | mailstorage_free(m_pop3); |
151 | m_pop3 = NULL; | 151 | m_pop3 = NULL; |
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | err = mailfolder_connect(m_folder); | 154 | err = mailfolder_connect(m_folder); |
155 | if (err != MAIL_NO_ERROR) { | 155 | if (err != MAIL_NO_ERROR) { |
156 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); | ||
156 | Global::statusMessage(tr("Error initializing folder")); | 157 | Global::statusMessage(tr("Error initializing folder")); |
157 | mailfolder_free(m_folder); | 158 | mailfolder_free(m_folder); |
158 | m_folder = 0; | 159 | m_folder = 0; |
159 | mailstorage_free(m_pop3); | 160 | mailstorage_free(m_pop3); |
160 | m_pop3 = 0; | 161 | m_pop3 = 0; |
161 | } | 162 | } |
162 | } | 163 | } |
163 | 164 | ||
164 | void POP3wrapper::logout() | 165 | void POP3wrapper::logout() |
165 | { | 166 | { |
166 | int err = MAILPOP3_NO_ERROR; | 167 | int err = MAILPOP3_NO_ERROR; |
167 | if ( m_pop3 == NULL ) return; | 168 | if ( m_pop3 == NULL ) return; |
168 | mailfolder_free(m_folder); | 169 | mailfolder_free(m_folder); |
169 | m_folder = 0; | 170 | m_folder = 0; |
170 | mailstorage_free(m_pop3); | 171 | mailstorage_free(m_pop3); |
171 | m_pop3 = 0; | 172 | m_pop3 = 0; |
172 | } | 173 | } |
173 | 174 | ||
174 | 175 | ||
175 | QList<Folder>* POP3wrapper::listFolders() | 176 | QList<Folder>* POP3wrapper::listFolders() |
176 | { | 177 | { |
177 | QList<Folder> * folders = new QList<Folder>(); | 178 | QList<Folder> * folders = new QList<Folder>(); |
178 | folders->setAutoDelete( false ); | 179 | folders->setAutoDelete( false ); |
179 | Folder*inb=new Folder("INBOX","/"); | 180 | Folder*inb=new Folder("INBOX","/"); |
180 | folders->append(inb); | 181 | folders->append(inb); |
181 | return folders; | 182 | return folders; |
182 | } | 183 | } |
183 | 184 | ||
184 | void POP3wrapper::deleteMail(const RecMail&mail) | 185 | void POP3wrapper::deleteMail(const RecMail&mail) |
185 | { | 186 | { |
186 | login(); | 187 | login(); |
187 | if (!m_pop3) return; | 188 | if (!m_pop3) return; |
188 | int err = mailsession_remove_message(m_folder->fld_session,mail.getNumber()); | 189 | int err = mailsession_remove_message(m_folder->fld_session,mail.getNumber()); |
189 | if (err != MAIL_NO_ERROR) { | 190 | if (err != MAIL_NO_ERROR) { |
190 | Global::statusMessage(tr("error deleting mail")); | 191 | Global::statusMessage(tr("error deleting mail")); |
191 | } | 192 | } |
192 | } | 193 | } |
193 | 194 | ||
194 | void POP3wrapper::answeredMail(const RecMail&) | 195 | void POP3wrapper::answeredMail(const RecMail&) |
195 | { | 196 | { |
196 | } | 197 | } |
197 | 198 | ||
198 | int POP3wrapper::deleteAllMail(const Folder*) | 199 | int POP3wrapper::deleteAllMail(const Folder*) |
199 | { | 200 | { |
200 | login(); | 201 | login(); |
201 | if (!m_pop3) return 0; | 202 | if (!m_pop3) return 0; |
202 | int res = 1; | 203 | int res = 1; |
203 | 204 | ||
204 | uint32_t result = 0; | 205 | uint32_t result = 0; |
205 | int err = mailsession_messages_number(m_folder->fld_session,NULL,&result); | 206 | int err = mailsession_messages_number(m_folder->fld_session,NULL,&result); |
206 | if (err != MAIL_NO_ERROR) { | 207 | if (err != MAIL_NO_ERROR) { |
207 | Global::statusMessage(tr("Error getting folder info")); | 208 | Global::statusMessage(tr("Error getting folder info")); |
208 | return 0; | 209 | return 0; |
209 | } | 210 | } |
210 | for (unsigned int i = 0; i < result; ++i) { | 211 | for (unsigned int i = 0; i < result; ++i) { |
211 | err = mailsession_remove_message(m_folder->fld_session,i+1); | 212 | err = mailsession_remove_message(m_folder->fld_session,i+1); |
212 | if (err != MAIL_NO_ERROR) { | 213 | if (err != MAIL_NO_ERROR) { |
213 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | 214 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); |
214 | res=0; | 215 | res=0; |
215 | } | 216 | } |
216 | break; | 217 | break; |
217 | } | 218 | } |
218 | return res; | 219 | return res; |
219 | } | 220 | } |
220 | 221 | ||
221 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) | 222 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) |
222 | { | 223 | { |
223 | login(); | 224 | login(); |
224 | target_stat.message_count = 0; | 225 | target_stat.message_count = 0; |
225 | target_stat.message_unseen = 0; | 226 | target_stat.message_unseen = 0; |
226 | target_stat.message_recent = 0; | 227 | target_stat.message_recent = 0; |
227 | if (!m_pop3) return; | 228 | if (!m_pop3) return; |
228 | int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, | 229 | int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, |
229 | &target_stat.message_recent,&target_stat.message_unseen); | 230 | &target_stat.message_recent,&target_stat.message_unseen); |
230 | } | 231 | } |
231 | 232 | ||
232 | encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) | 233 | encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) |
233 | { | 234 | { |
234 | char*target=0; | 235 | char*target=0; |
235 | size_t length=0; | 236 | size_t length=0; |
236 | encodedString*res = 0; | 237 | encodedString*res = 0; |
237 | mailmessage * mailmsg = 0; | 238 | mailmessage * mailmsg = 0; |
238 | int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); | 239 | int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); |
239 | err = mailmessage_fetch(mailmsg,&target,&length); | 240 | err = mailmessage_fetch(mailmsg,&target,&length); |
240 | if (mailmsg) mailmessage_free(mailmsg); | 241 | if (mailmsg) mailmessage_free(mailmsg); |
241 | if (target) { | 242 | if (target) { |
242 | res = new encodedString(target,length); | 243 | res = new encodedString(target,length); |
243 | } | 244 | } |
244 | return res; | 245 | return res; |
245 | } | 246 | } |
246 | 247 | ||
247 | const QString&POP3wrapper::getType()const | 248 | const QString&POP3wrapper::getType()const |
248 | { | 249 | { |
249 | return account->getType(); | 250 | return account->getType(); |
250 | } | 251 | } |
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 43d02e7..3c659e4 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -1,180 +1,180 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qvbox.h> | 2 | #include <qvbox.h> |
3 | #include <qheader.h> | 3 | #include <qheader.h> |
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <qtextstream.h> | 7 | #include <qtextstream.h> |
8 | 8 | ||
9 | #include <qpe/qpeapplication.h> | 9 | #include <qpe/qpeapplication.h> |
10 | #include <qpe/resource.h> | 10 | #include <qpe/resource.h> |
11 | 11 | ||
12 | 12 | ||
13 | #include "defines.h" | 13 | #include "defines.h" |
14 | #include "mainwindow.h" | 14 | #include "mainwindow.h" |
15 | #include "viewmail.h" | 15 | #include "viewmail.h" |
16 | #include <libmailwrapper/mailtypes.h> | 16 | #include <libmailwrapper/mailtypes.h> |
17 | #include "mailistviewitem.h" | 17 | #include "mailistviewitem.h" |
18 | 18 | ||
19 | 19 | ||
20 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 20 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
21 | : QMainWindow( parent, name, flags ) | 21 | : QMainWindow( parent, name, flags ) |
22 | { | 22 | { |
23 | 23 | ||
24 | setCaption( tr( "Mail" ) ); | 24 | setCaption( tr( "Mail" ) ); |
25 | setToolBarsMovable( false ); | 25 | setToolBarsMovable( false ); |
26 | 26 | ||
27 | toolBar = new QToolBar( this ); | 27 | toolBar = new QToolBar( this ); |
28 | menuBar = new QMenuBar( toolBar ); | 28 | menuBar = new QMenuBar( toolBar ); |
29 | mailMenu = new QPopupMenu( menuBar ); | 29 | mailMenu = new QPopupMenu( menuBar ); |
30 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 30 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
31 | settingsMenu = new QPopupMenu( menuBar ); | 31 | settingsMenu = new QPopupMenu( menuBar ); |
32 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 32 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
33 | 33 | ||
34 | addToolBar( toolBar ); | 34 | addToolBar( toolBar ); |
35 | toolBar->setHorizontalStretchable( true ); | 35 | toolBar->setHorizontalStretchable( true ); |
36 | 36 | ||
37 | QLabel *spacer = new QLabel( toolBar ); | 37 | QLabel *spacer = new QLabel( toolBar ); |
38 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 38 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
39 | toolBar->setStretchableWidget( spacer ); | 39 | toolBar->setStretchableWidget( spacer ); |
40 | 40 | ||
41 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, | 41 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, |
42 | 0, 0, this ); | 42 | 0, 0, this ); |
43 | composeMail->addTo( toolBar ); | 43 | composeMail->addTo( toolBar ); |
44 | composeMail->addTo( mailMenu ); | 44 | composeMail->addTo( mailMenu ); |
45 | 45 | ||
46 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, | 46 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, |
47 | 0, 0, this ); | 47 | 0, 0, this ); |
48 | sendQueued->addTo( toolBar ); | 48 | sendQueued->addTo( toolBar ); |
49 | sendQueued->addTo( mailMenu ); | 49 | sendQueued->addTo( mailMenu ); |
50 | 50 | ||
51 | /* | 51 | /* |
52 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 52 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
53 | 0, 0, this ); | 53 | 0, 0, this ); |
54 | syncFolders->addTo( toolBar ); | 54 | syncFolders->addTo( toolBar ); |
55 | syncFolders->addTo( mailMenu ); | 55 | syncFolders->addTo( mailMenu ); |
56 | */ | 56 | */ |
57 | 57 | ||
58 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, | 58 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, |
59 | 0, 0, this, 0, true ); | 59 | 0, 0, this, 0, true ); |
60 | showFolders->addTo( toolBar ); | 60 | showFolders->addTo( toolBar ); |
61 | showFolders->addTo( mailMenu ); | 61 | showFolders->addTo( mailMenu ); |
62 | showFolders->setOn( true ); | 62 | showFolders->setOn( true ); |
63 | connect(showFolders, SIGNAL( toggled( bool ) ), | 63 | connect(showFolders, SIGNAL( toggled( bool ) ), |
64 | SLOT( slotShowFolders( bool ) ) ); | 64 | SLOT( slotShowFolders( bool ) ) ); |
65 | 65 | ||
66 | /* | 66 | /* |
67 | searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, | 67 | searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), |
68 | 0, 0, this ); | 68 | 0, 0, this ); |
69 | searchMails->addTo( toolBar ); | 69 | searchMails->addTo( toolBar ); |
70 | searchMails->addTo( mailMenu ); | 70 | searchMails->addTo( mailMenu ); |
71 | */ | 71 | */ |
72 | 72 | ||
73 | deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); | 73 | deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); |
74 | deleteMails->addTo( toolBar ); | 74 | deleteMails->addTo( toolBar ); |
75 | deleteMails->addTo( mailMenu ); | 75 | deleteMails->addTo( mailMenu ); |
76 | connect( deleteMails, SIGNAL( activated() ), | 76 | connect( deleteMails, SIGNAL( activated() ), |
77 | SLOT( slotDeleteMail() ) ); | 77 | SLOT( slotDeleteMail() ) ); |
78 | 78 | ||
79 | editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, | 79 | editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , |
80 | 0, 0, this ); | 80 | 0, 0, this ); |
81 | editSettings->addTo( settingsMenu ); | 81 | editSettings->addTo( settingsMenu ); |
82 | connect( editSettings, SIGNAL( activated() ), | 82 | connect( editSettings, SIGNAL( activated() ), |
83 | SLOT( slotEditSettings() ) ); | 83 | SLOT( slotEditSettings() ) ); |
84 | editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, | 84 | editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , |
85 | 0, 0, this ); | 85 | 0, 0, this ); |
86 | editAccounts->addTo( settingsMenu ); | 86 | editAccounts->addTo( settingsMenu ); |
87 | 87 | ||
88 | //setCentralWidget( view ); | 88 | //setCentralWidget( view ); |
89 | 89 | ||
90 | QVBox* wrapperBox = new QVBox( this ); | 90 | QVBox* wrapperBox = new QVBox( this ); |
91 | setCentralWidget( wrapperBox ); | 91 | setCentralWidget( wrapperBox ); |
92 | 92 | ||
93 | QWidget *view = new QWidget( wrapperBox ); | 93 | QWidget *view = new QWidget( wrapperBox ); |
94 | 94 | ||
95 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); | 95 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); |
96 | 96 | ||
97 | folderView = new AccountView( view ); | 97 | folderView = new AccountView( view ); |
98 | folderView->header()->hide(); | 98 | folderView->header()->hide(); |
99 | folderView->setRootIsDecorated( true ); | 99 | folderView->setRootIsDecorated( true ); |
100 | folderView->addColumn( tr( "Mailbox" ) ); | 100 | folderView->addColumn( tr( "Mailbox" ) ); |
101 | 101 | ||
102 | layout->addWidget( folderView ); | 102 | layout->addWidget( folderView ); |
103 | 103 | ||
104 | mailView = new QListView( view ); | 104 | mailView = new QListView( view ); |
105 | mailView->addColumn( tr( "" ) ); | 105 | mailView->addColumn( tr( "" ) ); |
106 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 106 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
107 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 107 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
108 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 108 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
109 | mailView->addColumn( tr( "Date" )); | 109 | mailView->addColumn( tr( "Date" )); |
110 | mailView->setAllColumnsShowFocus(true); | 110 | mailView->setAllColumnsShowFocus(true); |
111 | mailView->setSorting(-1); | 111 | mailView->setSorting(-1); |
112 | 112 | ||
113 | statusWidget = new StatusWidget( wrapperBox ); | 113 | statusWidget = new StatusWidget( wrapperBox ); |
114 | statusWidget->hide(); | 114 | statusWidget->hide(); |
115 | 115 | ||
116 | layout->addWidget( mailView ); | 116 | layout->addWidget( mailView ); |
117 | layout->setStretchFactor( folderView, 1 ); | 117 | layout->setStretchFactor( folderView, 1 ); |
118 | layout->setStretchFactor( mailView, 2 ); | 118 | layout->setStretchFactor( mailView, 2 ); |
119 | 119 | ||
120 | slotAdjustLayout(); | 120 | slotAdjustLayout(); |
121 | 121 | ||
122 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 122 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
123 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 123 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
124 | 124 | ||
125 | connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, | 125 | connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, |
126 | SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); | 126 | SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); |
127 | connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, | 127 | connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, |
128 | SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); | 128 | SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); |
129 | connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); | 129 | connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); |
130 | 130 | ||
131 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 131 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
135 | void MainWindow::slotAdjustLayout() { | 135 | void MainWindow::slotAdjustLayout() { |
136 | 136 | ||
137 | QWidget *d = QApplication::desktop(); | 137 | QWidget *d = QApplication::desktop(); |
138 | 138 | ||
139 | if ( d->width() < d->height() ) { | 139 | if ( d->width() < d->height() ) { |
140 | layout->setDirection( QBoxLayout::TopToBottom ); | 140 | layout->setDirection( QBoxLayout::TopToBottom ); |
141 | } else { | 141 | } else { |
142 | layout->setDirection( QBoxLayout::LeftToRight ); | 142 | layout->setDirection( QBoxLayout::LeftToRight ); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | void MainWindow::slotAdjustColumns() | 146 | void MainWindow::slotAdjustColumns() |
147 | { | 147 | { |
148 | bool hidden = folderView->isHidden(); | 148 | bool hidden = folderView->isHidden(); |
149 | if ( hidden ) folderView->show(); | 149 | if ( hidden ) folderView->show(); |
150 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 150 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
151 | if ( hidden ) folderView->hide(); | 151 | if ( hidden ) folderView->hide(); |
152 | 152 | ||
153 | mailView->setColumnWidth( 0, 10 ); | 153 | mailView->setColumnWidth( 0, 10 ); |
154 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); | 154 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); |
155 | mailView->setColumnWidth( 2, 80 ); | 155 | mailView->setColumnWidth( 2, 80 ); |
156 | mailView->setColumnWidth( 3, 50 ); | 156 | mailView->setColumnWidth( 3, 50 ); |
157 | mailView->setColumnWidth( 4, 50 ); | 157 | mailView->setColumnWidth( 4, 50 ); |
158 | } | 158 | } |
159 | 159 | ||
160 | void MainWindow::slotEditSettings() | 160 | void MainWindow::slotEditSettings() |
161 | { | 161 | { |
162 | } | 162 | } |
163 | 163 | ||
164 | void MainWindow::slotShowFolders( bool show ) | 164 | void MainWindow::slotShowFolders( bool show ) |
165 | { | 165 | { |
166 | qDebug( "Show Folders" ); | 166 | qDebug( "Show Folders" ); |
167 | if ( show && folderView->isHidden() ) { | 167 | if ( show && folderView->isHidden() ) { |
168 | qDebug( "-> showing" ); | 168 | qDebug( "-> showing" ); |
169 | folderView->show(); | 169 | folderView->show(); |
170 | } else if ( !show && !folderView->isHidden() ) { | 170 | } else if ( !show && !folderView->isHidden() ) { |
171 | qDebug( "-> hiding" ); | 171 | qDebug( "-> hiding" ); |
172 | folderView->hide(); | 172 | folderView->hide(); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | void MainWindow::refreshMailView(QList<RecMail>*list) | 176 | void MainWindow::refreshMailView(QList<RecMail>*list) |
177 | { | 177 | { |
178 | MailListViewItem*item = 0; | 178 | MailListViewItem*item = 0; |
179 | mailView->clear(); | 179 | mailView->clear(); |
180 | for (unsigned int i = 0; i < list->count();++i) { | 180 | for (unsigned int i = 0; i < list->count();++i) { |
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp index a261d14..991b5fb 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.cpp +++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp | |||
@@ -1,138 +1,139 @@ | |||
1 | #include <qpainter.h> | 1 | #include <qpainter.h> |
2 | #include <qtimer.h> | 2 | #include <qtimer.h> |
3 | 3 | ||
4 | #include <qpe/qcopenvelope_qws.h> | 4 | #include <qpe/qcopenvelope_qws.h> |
5 | #include <qpe/resource.h> | 5 | #include <qpe/resource.h> |
6 | #include <qpe/config.h> | 6 | #include <qpe/config.h> |
7 | #include <qpe/applnk.h> | 7 | #include <qpe/applnk.h> |
8 | 8 | ||
9 | #include <opie/odevice.h> | 9 | #include <opie/odevice.h> |
10 | 10 | ||
11 | #include <libmailwrapper/settings.h> | 11 | #include <libmailwrapper/settings.h> |
12 | 12 | ||
13 | #include "mailapplet.h" | 13 | #include "mailapplet.h" |
14 | 14 | ||
15 | using namespace Opie; | 15 | using namespace Opie; |
16 | 16 | ||
17 | MailApplet::MailApplet( QWidget *parent ) | 17 | MailApplet::MailApplet( QWidget *parent ) |
18 | : QWidget( parent ) { | 18 | : QWidget( parent ) { |
19 | 19 | ||
20 | m_config = new Config( "mail" ); | 20 | m_config = new Config( "mail" ); |
21 | m_config->setGroup( "Applet" ); | 21 | m_config->setGroup( "Applet" ); |
22 | 22 | ||
23 | setFixedWidth( AppLnk::smallIconSize() ); | 23 | setFixedWidth( AppLnk::smallIconSize() ); |
24 | setFixedHeight( AppLnk::smallIconSize() ); | 24 | setFixedHeight( AppLnk::smallIconSize() ); |
25 | 25 | ||
26 | hide(); | 26 | hide(); |
27 | 27 | ||
28 | m_newMails = 0; | 28 | m_newMails = 0; |
29 | m_statusMail = 0l; | 29 | m_statusMail = 0l; |
30 | 30 | ||
31 | if ( !m_config->readBoolEntry( "Disabled", false ) ) { | 31 | if ( !m_config->readBoolEntry( "Disabled", false ) ) { |
32 | // delay 5 sec until the whole mail backend gets started .-) | 32 | // delay 5 sec until the whole mail backend gets started .-) |
33 | QTimer::singleShot( 5000, this, SLOT( startup() ) ); | 33 | QTimer::singleShot( 5000, this, SLOT( startup() ) ); |
34 | } | 34 | } |
35 | repaint( true ); | 35 | repaint( true ); |
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | MailApplet::~MailApplet() { | 39 | MailApplet::~MailApplet() { |
40 | if ( m_statusMail ) | 40 | if ( m_statusMail ) |
41 | delete m_statusMail; | 41 | delete m_statusMail; |
42 | if ( m_config ) | 42 | if ( m_config ) |
43 | delete m_config; | 43 | delete m_config; |
44 | } | 44 | } |
45 | 45 | ||
46 | void MailApplet::paintEvent( QPaintEvent* ) { | 46 | void MailApplet::paintEvent( QPaintEvent* ) { |
47 | QPainter p( this ); | 47 | QPainter p( this ); |
48 | p.drawPixmap( 0, 0, Resource::loadPixmap( "mail/inbox" ) ); | 48 | p.drawPixmap( 0, 0, Resource::loadPixmap( "mail/inbox" ) ); |
49 | QFont f( "vera", AppLnk::smallIconSize() ); | 49 | QFont f( "vera", AppLnk::smallIconSize() ); |
50 | QFontMetrics fm( f ); | 50 | QFontMetrics fm( f ); |
51 | p.setFont( f ); | 51 | p.setFont( f ); |
52 | p.setPen( Qt::blue ); | ||
52 | p.drawText( AppLnk::smallIconSize()/3, AppLnk::smallIconSize() - 2, QString::number( m_newMails ) ); | 53 | p.drawText( AppLnk::smallIconSize()/3, AppLnk::smallIconSize() - 2, QString::number( m_newMails ) ); |
53 | return; | 54 | return; |
54 | 55 | ||
55 | } | 56 | } |
56 | 57 | ||
57 | void MailApplet::mouseReleaseEvent( QMouseEvent* e ) { | 58 | void MailApplet::mouseReleaseEvent( QMouseEvent* e ) { |
58 | slotClicked(); | 59 | slotClicked(); |
59 | } | 60 | } |
60 | 61 | ||
61 | void MailApplet::slotClicked() { | 62 | void MailApplet::slotClicked() { |
62 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 63 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
63 | e << QString( "opiemail" ); | 64 | e << QString( "opiemail" ); |
64 | 65 | ||
65 | ODevice *device = ODevice::inst(); | 66 | ODevice *device = ODevice::inst(); |
66 | if ( !device-> ledList().isEmpty() ) { | 67 | if ( !device-> ledList().isEmpty() ) { |
67 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; | 68 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; |
68 | 69 | ||
69 | device->setLedState( led, Led_Off ); | 70 | device->setLedState( led, Led_Off ); |
70 | } | 71 | } |
71 | 72 | ||
72 | // m_statusMails->reset_status(); | 73 | // m_statusMails->reset_status(); |
73 | } | 74 | } |
74 | 75 | ||
75 | void MailApplet::startup() { | 76 | void MailApplet::startup() { |
76 | Settings *settings = new Settings(); | 77 | Settings *settings = new Settings(); |
77 | QList<Account> ma = settings->getAccounts(); | 78 | QList<Account> ma = settings->getAccounts(); |
78 | m_statusMail = new StatusMail( ma ); | 79 | m_statusMail = new StatusMail( ma ); |
79 | delete settings; | 80 | delete settings; |
80 | 81 | ||
81 | m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; | 82 | m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; |
82 | m_intervalTimer = new QTimer(); | 83 | m_intervalTimer = new QTimer(); |
83 | m_intervalTimer->start( m_intervalMs ); | 84 | m_intervalTimer->start( m_intervalMs ); |
84 | connect( m_intervalTimer, SIGNAL( timeout() ), this, SLOT( slotCheck() ) ); | 85 | connect( m_intervalTimer, SIGNAL( timeout() ), this, SLOT( slotCheck() ) ); |
85 | } | 86 | } |
86 | 87 | ||
87 | void MailApplet::slotCheck() { | 88 | void MailApplet::slotCheck() { |
88 | // Check wether the check interval has been changed. | 89 | // Check wether the check interval has been changed. |
89 | int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; | 90 | int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; |
90 | if ( newIntervalMs != m_intervalMs ) { | 91 | if ( newIntervalMs != m_intervalMs ) { |
91 | m_intervalTimer->changeInterval( newIntervalMs ); | 92 | m_intervalTimer->changeInterval( newIntervalMs ); |
92 | m_intervalMs = newIntervalMs; | 93 | m_intervalMs = newIntervalMs; |
93 | } | 94 | } |
94 | 95 | ||
95 | if (m_statusMail == 0) { | 96 | if (m_statusMail == 0) { |
96 | return; | 97 | return; |
97 | } | 98 | } |
98 | 99 | ||
99 | folderStat stat; | 100 | folderStat stat; |
100 | m_statusMail->check_current_stat( stat ); | 101 | m_statusMail->check_current_stat( stat ); |
101 | m_newMails = stat.message_unseen; | 102 | m_newMails = stat.message_unseen; |
102 | qDebug( QString( "test %1" ).arg( m_newMails ) ); | 103 | qDebug( QString( "test %1" ).arg( m_newMails ) ); |
103 | if ( m_newMails > 0 ) { | 104 | if ( m_newMails > 0 ) { |
104 | ODevice *device = ODevice::inst(); | 105 | ODevice *device = ODevice::inst(); |
105 | if ( isHidden() ) | 106 | if ( isHidden() ) |
106 | show(); | 107 | show(); |
107 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { | 108 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { |
108 | if ( !device->ledList().isEmpty() ) { | 109 | if ( !device->ledList().isEmpty() ) { |
109 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; | 110 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; |
110 | device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); | 111 | device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); |
111 | } | 112 | } |
112 | } | 113 | } |
113 | if ( m_config->readBoolEntry( "PlaySound", false ) ) | 114 | if ( m_config->readBoolEntry( "PlaySound", false ) ) |
114 | device->alarmSound(); | 115 | device->alarmSound(); |
115 | 116 | ||
116 | Config cfg( "mail" ); | 117 | Config cfg( "mail" ); |
117 | cfg.setGroup( "Status" ); | 118 | cfg.setGroup( "Status" ); |
118 | cfg.writeEntry( "newMails", m_newMails ); | 119 | cfg.writeEntry( "newMails", m_newMails ); |
119 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); | 120 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); |
120 | env << m_newMails; | 121 | env << m_newMails; |
121 | repaint( true ); | 122 | repaint( true ); |
122 | 123 | ||
123 | } else { | 124 | } else { |
124 | ODevice *device = ODevice::inst(); | 125 | ODevice *device = ODevice::inst(); |
125 | if ( !isHidden() ) | 126 | if ( !isHidden() ) |
126 | hide(); | 127 | hide(); |
127 | if ( !device->ledList().isEmpty() ) { | 128 | if ( !device->ledList().isEmpty() ) { |
128 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; | 129 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; |
129 | device->setLedState( led, Led_Off ); | 130 | device->setLedState( led, Led_Off ); |
130 | } | 131 | } |
131 | 132 | ||
132 | Config cfg( "mail" ); | 133 | Config cfg( "mail" ); |
133 | cfg.setGroup( "Status" ); | 134 | cfg.setGroup( "Status" ); |
134 | cfg.writeEntry( "newMails", m_newMails ); | 135 | cfg.writeEntry( "newMails", m_newMails ); |
135 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); | 136 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); |
136 | env << m_newMails; | 137 | env << m_newMails; |
137 | } | 138 | } |
138 | } | 139 | } |
diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp index 0e994d4..153ba9d 100644 --- a/noncore/net/mail/viewmailbase.cpp +++ b/noncore/net/mail/viewmailbase.cpp | |||
@@ -1,82 +1,82 @@ | |||
1 | #include <qtextbrowser.h> | 1 | #include <qtextbrowser.h> |
2 | #include <qlistview.h> | 2 | #include <qlistview.h> |
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qvbox.h> | 5 | #include <qvbox.h> |
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | 7 | ||
8 | #include <qpe/qpetoolbar.h> | 8 | #include <qpe/qpetoolbar.h> |
9 | #include <qmenubar.h> | 9 | #include <qmenubar.h> |
10 | #include <qpe/resource.h> | 10 | #include <qpe/resource.h> |
11 | 11 | ||
12 | #include "viewmailbase.h" | 12 | #include "viewmailbase.h" |
13 | //#include "opendiag.h" | 13 | //#include "opendiag.h" |
14 | 14 | ||
15 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) | 15 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) |
16 | : QMainWindow(parent, name, fl) | 16 | : QMainWindow(parent, name, fl) |
17 | { | 17 | { |
18 | setCaption(tr("E-Mail by %1")); | 18 | setCaption(tr("E-Mail by %1")); |
19 | setToolBarsMovable(false); | 19 | setToolBarsMovable(false); |
20 | 20 | ||
21 | toolbar = new QToolBar(this); | 21 | toolbar = new QToolBar(this); |
22 | menubar = new QMenuBar( toolbar ); | 22 | menubar = new QMenuBar( toolbar ); |
23 | mailmenu = new QPopupMenu( menubar ); | 23 | mailmenu = new QPopupMenu( menubar ); |
24 | menubar->insertItem( tr( "Mail" ), mailmenu ); | 24 | menubar->insertItem( tr( "Mail" ), mailmenu ); |
25 | 25 | ||
26 | toolbar->setHorizontalStretchable(true); | 26 | toolbar->setHorizontalStretchable(true); |
27 | addToolBar(toolbar); | 27 | addToolBar(toolbar); |
28 | 28 | ||
29 | QLabel *spacer = new QLabel(toolbar); | 29 | QLabel *spacer = new QLabel(toolbar); |
30 | spacer->setBackgroundMode(QWidget::PaletteButton); | 30 | spacer->setBackgroundMode(QWidget::PaletteButton); |
31 | toolbar->setStretchableWidget(spacer); | 31 | toolbar->setStretchableWidget(spacer); |
32 | 32 | ||
33 | reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this); | 33 | reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this); |
34 | reply->addTo(toolbar); | 34 | reply->addTo(toolbar); |
35 | reply->addTo(mailmenu); | 35 | reply->addTo(mailmenu); |
36 | 36 | ||
37 | forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this); | 37 | forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this); |
38 | forward->addTo(toolbar); | 38 | forward->addTo(toolbar); |
39 | forward->addTo(mailmenu); | 39 | forward->addTo(mailmenu); |
40 | 40 | ||
41 | attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); | 41 | attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); |
42 | attachbutton->addTo(toolbar); | 42 | attachbutton->addTo(toolbar); |
43 | attachbutton->addTo(mailmenu); | 43 | attachbutton->addTo(mailmenu); |
44 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); | 44 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); |
45 | 45 | ||
46 | 46 | ||
47 | showHtml = new QAction( tr( "Show Html" ), QIconSet( Resource::loadPixmap( "mail/html" ) ), 0, 0, this, 0, true ); | 47 | showHtml = new QAction( tr( "Show Html" ), QIconSet( Resource::loadPixmap( "mail/html" ) ), 0, 0, this, 0, true ); |
48 | showHtml->addTo( toolbar ); | 48 | showHtml->addTo( toolbar ); |
49 | showHtml->addTo( mailmenu ); | 49 | showHtml->addTo( mailmenu ); |
50 | 50 | ||
51 | deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); | 51 | deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("trash")), 0, 0, this); |
52 | deleteMail->addTo(toolbar); | 52 | deleteMail->addTo(toolbar); |
53 | deleteMail->addTo(mailmenu); | 53 | deleteMail->addTo(mailmenu); |
54 | 54 | ||
55 | QVBox *view = new QVBox(this); | 55 | QVBox *view = new QVBox(this); |
56 | setCentralWidget(view); | 56 | setCentralWidget(view); |
57 | 57 | ||
58 | attachments = new QListView(view); | 58 | attachments = new QListView(view); |
59 | attachments->setMinimumHeight(90); | 59 | attachments->setMinimumHeight(90); |
60 | attachments->setMaximumHeight(90); | 60 | attachments->setMaximumHeight(90); |
61 | attachments->setAllColumnsShowFocus(true); | 61 | attachments->setAllColumnsShowFocus(true); |
62 | attachments->addColumn("Mime Type", 60); | 62 | attachments->addColumn("Mime Type", 60); |
63 | attachments->addColumn(tr("Description"), 100); | 63 | attachments->addColumn(tr("Description"), 100); |
64 | attachments->addColumn(tr("Filename"), 80); | 64 | attachments->addColumn(tr("Filename"), 80); |
65 | attachments->addColumn(tr("Size"), 80); | 65 | attachments->addColumn(tr("Size"), 80); |
66 | attachments->setSorting(-1); | 66 | attachments->setSorting(-1); |
67 | attachments->hide(); | 67 | attachments->hide(); |
68 | 68 | ||
69 | browser = new QTextBrowser(view); | 69 | browser = new QTextBrowser(view); |
70 | 70 | ||
71 | //openDiag = new OpenDiag(view); | 71 | //openDiag = new OpenDiag(view); |
72 | //openDiag->hide(); | 72 | //openDiag->hide(); |
73 | 73 | ||
74 | } | 74 | } |
75 | 75 | ||
76 | void ViewMailBase::slotChangeAttachview(bool state) | 76 | void ViewMailBase::slotChangeAttachview(bool state) |
77 | { | 77 | { |
78 | if (state) attachments->show(); | 78 | if (state) attachments->show(); |
79 | else attachments->hide(); | 79 | else attachments->hide(); |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
diff --git a/pics/mail/abort.png b/pics/mail/abort.png deleted file mode 100644 index 13d0588..0000000 --- a/pics/mail/abort.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/pics/mail/configure.png b/pics/mail/configure.png deleted file mode 100644 index 9bbde25..0000000 --- a/pics/mail/configure.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/pics/mail/delete.png b/pics/mail/delete.png deleted file mode 100644 index 3d3daf2..0000000 --- a/pics/mail/delete.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/pics/mail/deletemail.png b/pics/mail/deletemail.png deleted file mode 100644 index 78a5f62..0000000 --- a/pics/mail/deletemail.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/pics/mail/editsettings.png b/pics/mail/editsettings.png deleted file mode 100644 index 9bbde25..0000000 --- a/pics/mail/editsettings.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/pics/mail/find.png b/pics/mail/find.png deleted file mode 100644 index 0dbfa0b..0000000 --- a/pics/mail/find.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/pics/mail/folder.png b/pics/mail/folder.png deleted file mode 100644 index 0c980dc..0000000 --- a/pics/mail/folder.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/pics/mail/mailchecker.png b/pics/mail/mailchecker.png deleted file mode 100644 index 7fb36b1..0000000 --- a/pics/mail/mailchecker.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/pics/mail/reload.png b/pics/mail/reload.png deleted file mode 100644 index 3bfff11..0000000 --- a/pics/mail/reload.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/pics/mail/savemail.png b/pics/mail/savemail.png deleted file mode 100644 index a44dd1f..0000000 --- a/pics/mail/savemail.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/pics/mail/searchmails.png b/pics/mail/searchmails.png deleted file mode 100644 index 21dc83e..0000000 --- a/pics/mail/searchmails.png +++ b/dev/null | |||
Binary files differ | |||