-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mailit/emailclient.h | 4 | ||||
-rw-r--r-- | noncore/net/mailit/mailit.pro | 2 | ||||
-rw-r--r-- | noncore/net/mailit/readmail.cpp | 6 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 8 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.h | 4 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailit.pro | 2 | ||||
-rw-r--r-- | noncore/unsupported/mailit/readmail.cpp | 6 |
8 files changed, 20 insertions, 20 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index 2e82623..fc4276b 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -97,162 +97,162 @@ EmailClient::~EmailClient() | |||
97 | } | 97 | } |
98 | 98 | ||
99 | void EmailClient::init() | 99 | void EmailClient::init() |
100 | { | 100 | { |
101 | statusBar = new QStatusBar(this); | 101 | statusBar = new QStatusBar(this); |
102 | statusBar->setSizeGripEnabled(FALSE); | 102 | statusBar->setSizeGripEnabled(FALSE); |
103 | 103 | ||
104 | status1Label = new QLabel( tr("Idle"), statusBar); | 104 | status1Label = new QLabel( tr("Idle"), statusBar); |
105 | status2Label = new QLabel("", statusBar); | 105 | status2Label = new QLabel("", statusBar); |
106 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), | 106 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), |
107 | status2Label, SLOT(setText(const QString &)) ); | 107 | status2Label, SLOT(setText(const QString &)) ); |
108 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), | 108 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), |
109 | status2Label, SLOT(setText(const QString &)) ); | 109 | status2Label, SLOT(setText(const QString &)) ); |
110 | 110 | ||
111 | progressBar = new QProgressBar(statusBar); | 111 | progressBar = new QProgressBar(statusBar); |
112 | connect(emailHandler, SIGNAL(mailboxSize(int)), | 112 | connect(emailHandler, SIGNAL(mailboxSize(int)), |
113 | this, SLOT(setTotalSize(int)) ); | 113 | this, SLOT(setTotalSize(int)) ); |
114 | connect(emailHandler, SIGNAL(currentMailSize(int)), | 114 | connect(emailHandler, SIGNAL(currentMailSize(int)), |
115 | this, SLOT(setMailSize(int)) ); | 115 | this, SLOT(setMailSize(int)) ); |
116 | connect(emailHandler, SIGNAL(downloadedSize(int)), | 116 | connect(emailHandler, SIGNAL(downloadedSize(int)), |
117 | this, SLOT(setDownloadedSize(int)) ); | 117 | this, SLOT(setDownloadedSize(int)) ); |
118 | 118 | ||
119 | statusBar->addWidget(status1Label); | 119 | statusBar->addWidget(status1Label); |
120 | statusBar->addWidget(progressBar); | 120 | statusBar->addWidget(progressBar); |
121 | statusBar->addWidget(status2Label); | 121 | statusBar->addWidget(status2Label); |
122 | 122 | ||
123 | setToolBarsMovable(FALSE); | 123 | setToolBarsMovable(FALSE); |
124 | 124 | ||
125 | bar = new QToolBar(this); | 125 | bar = new QToolBar(this); |
126 | bar->setHorizontalStretchable( TRUE ); | 126 | bar->setHorizontalStretchable( TRUE ); |
127 | 127 | ||
128 | mb = new QMenuBar( bar ); | 128 | mb = new QMenuBar( bar ); |
129 | 129 | ||
130 | QPopupMenu *mail = new QPopupMenu(mb); | 130 | QPopupMenu *mail = new QPopupMenu(mb); |
131 | mb->insertItem( tr( "&Mail" ), mail); | 131 | mb->insertItem( tr( "&Mail" ), mail); |
132 | 132 | ||
133 | QPopupMenu *configure = new QPopupMenu(mb); | 133 | QPopupMenu *configure = new QPopupMenu(mb); |
134 | mb->insertItem( tr( "Accounts" ), configure); | 134 | mb->insertItem( tr( "Accounts" ), configure); |
135 | 135 | ||
136 | selectAccountMenu = new QPopupMenu(mb); | 136 | selectAccountMenu = new QPopupMenu(mb); |
137 | editAccountMenu = new QPopupMenu(mb); | 137 | editAccountMenu = new QPopupMenu(mb); |
138 | deleteAccountMenu = new QPopupMenu(mb); | 138 | deleteAccountMenu = new QPopupMenu(mb); |
139 | 139 | ||
140 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); | 140 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); |
141 | configure->insertItem(tr("Edit account"), editAccountMenu); | 141 | configure->insertItem(tr("Edit account"), editAccountMenu); |
142 | configure->insertItem(tr("Delete account"), deleteAccountMenu); | 142 | configure->insertItem(tr("Delete account"), deleteAccountMenu); |
143 | 143 | ||
144 | bar = new QToolBar(this); | 144 | bar = new QToolBar(this); |
145 | 145 | ||
146 | getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); | 146 | getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); |
147 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); | 147 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); |
148 | getMailButton->addTo(bar); | 148 | getMailButton->addTo(bar); |
149 | getMailButton->addTo(mail); | 149 | getMailButton->addTo(mail); |
150 | 150 | ||
151 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendmail"), QString::null, 0, this, 0); | 151 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendmail"), QString::null, 0, this, 0); |
152 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); | 152 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); |
153 | sendMailButton->addTo(bar); | 153 | sendMailButton->addTo(bar); |
154 | sendMailButton->addTo(mail); | 154 | sendMailButton->addTo(mail); |
155 | 155 | ||
156 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 156 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
157 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); | 157 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); |
158 | composeButton->addTo(bar); | 158 | composeButton->addTo(bar); |
159 | composeButton->addTo(mail); | 159 | composeButton->addTo(mail); |
160 | 160 | ||
161 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("reset"), QString::null, 0, this, 0); | 161 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); |
162 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); | 162 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); |
163 | cancelButton->addTo(mail); | 163 | cancelButton->addTo(mail); |
164 | cancelButton->setEnabled(FALSE); | 164 | cancelButton->setEnabled(FALSE); |
165 | 165 | ||
166 | mailboxView = new QTabWidget( this, "mailboxView" ); | 166 | mailboxView = new OTabWidget( this, "mailboxView" ); |
167 | 167 | ||
168 | QWidget* widget = new QWidget( mailboxView, "widget" ); | 168 | QWidget* widget = new QWidget( mailboxView, "widget" ); |
169 | grid_2 = new QGridLayout( widget ); | 169 | grid_2 = new QGridLayout( widget ); |
170 | // grid_2->setSpacing(6); | 170 | // grid_2->setSpacing(6); |
171 | // grid_2->setMargin( 11 ); | 171 | // grid_2->setMargin( 11 ); |
172 | 172 | ||
173 | inboxView = new QListView( widget, "inboxView" ); | 173 | inboxView = new QListView( widget, "inboxView" ); |
174 | inboxView->addColumn( tr( "From" ) ); | 174 | inboxView->addColumn( tr( "From" ) ); |
175 | inboxView->addColumn( tr( "Subject" ) ); | 175 | inboxView->addColumn( tr( "Subject" ) ); |
176 | inboxView->addColumn( tr( "Date" ) ); | 176 | inboxView->addColumn( tr( "Date" ) ); |
177 | inboxView->setMinimumSize( QSize( 0, 0 ) ); | 177 | inboxView->setMinimumSize( QSize( 0, 0 ) ); |
178 | inboxView->setAllColumnsShowFocus(TRUE); | 178 | inboxView->setAllColumnsShowFocus(TRUE); |
179 | 179 | ||
180 | grid_2->addWidget( inboxView, 2, 0 ); | 180 | grid_2->addWidget( inboxView, 2, 0 ); |
181 | mailboxView->insertTab( widget, tr( "Inbox" ) ); | 181 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); |
182 | 182 | ||
183 | QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); | 183 | QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); |
184 | grid_3 = new QGridLayout( widget_2 ); | 184 | grid_3 = new QGridLayout( widget_2 ); |
185 | // grid_3->setSpacing(6); | 185 | // grid_3->setSpacing(6); |
186 | // grid_3->setMargin( 11 ); | 186 | // grid_3->setMargin( 11 ); |
187 | 187 | ||
188 | outboxView = new QListView( widget_2, "outboxView" ); | 188 | outboxView = new QListView( widget_2, "outboxView" ); |
189 | outboxView->addColumn( tr( "To" ) ); | 189 | outboxView->addColumn( tr( "To" ) ); |
190 | outboxView->addColumn( tr( "Subject" ) ); | 190 | outboxView->addColumn( tr( "Subject" ) ); |
191 | outboxView->setAllColumnsShowFocus(TRUE); | 191 | outboxView->setAllColumnsShowFocus(TRUE); |
192 | 192 | ||
193 | grid_3->addWidget( outboxView, 0, 0 ); | 193 | grid_3->addWidget( outboxView, 0, 0 ); |
194 | mailboxView->insertTab( widget_2, tr( "Outbox" ) ); | 194 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); |
195 | 195 | ||
196 | setCentralWidget(mailboxView); | 196 | setCentralWidget(mailboxView); |
197 | } | 197 | } |
198 | 198 | ||
199 | void EmailClient::compose() | 199 | void EmailClient::compose() |
200 | { | 200 | { |
201 | emit composeRequested(); | 201 | emit composeRequested(); |
202 | } | 202 | } |
203 | 203 | ||
204 | void EmailClient::cancel() | 204 | void EmailClient::cancel() |
205 | { | 205 | { |
206 | emailHandler->cancel(); | 206 | emailHandler->cancel(); |
207 | } | 207 | } |
208 | 208 | ||
209 | AddressList* EmailClient::getAdrListRef() | 209 | AddressList* EmailClient::getAdrListRef() |
210 | { | 210 | { |
211 | return addressList; | 211 | return addressList; |
212 | } | 212 | } |
213 | 213 | ||
214 | //this needs to be rewritten to syncronize with outboxView | 214 | //this needs to be rewritten to syncronize with outboxView |
215 | void EmailClient::enqueMail(const Email &mail) | 215 | void EmailClient::enqueMail(const Email &mail) |
216 | { | 216 | { |
217 | if (accountList.count() > 0) { | 217 | if (accountList.count() > 0) { |
218 | currentAccount = accountList.first(); | 218 | currentAccount = accountList.first(); |
219 | qWarning("using account " + currentAccount->name); | 219 | qWarning("using account " + currentAccount->name); |
220 | } | 220 | } |
221 | 221 | ||
222 | Email addMail = mail; | 222 | Email addMail = mail; |
223 | addMail.from = currentAccount->name; | 223 | addMail.from = currentAccount->name; |
224 | addMail.fromMail = currentAccount->emailAddress; | 224 | addMail.fromMail = currentAccount->emailAddress; |
225 | addMail.rawMail.prepend("From: " + addMail.from + "<" + addMail.fromMail + ">\n"); | 225 | addMail.rawMail.prepend("From: " + addMail.from + "<" + addMail.fromMail + ">\n"); |
226 | item = new EmailListItem(outboxView, addMail, false); | 226 | item = new EmailListItem(outboxView, addMail, false); |
227 | 227 | ||
228 | } | 228 | } |
229 | 229 | ||
230 | void EmailClient::sendQuedMail() | 230 | void EmailClient::sendQuedMail() |
231 | { | 231 | { |
232 | int count = 0; | 232 | int count = 0; |
233 | 233 | ||
234 | if (accountList.count() == 0) { | 234 | if (accountList.count() == 0) { |
235 | QMessageBox::warning(qApp->activeWindow(), | 235 | QMessageBox::warning(qApp->activeWindow(), |
236 | "No account selected", "You must create an account", "OK\n"); | 236 | "No account selected", "You must create an account", "OK\n"); |
237 | return; | 237 | return; |
238 | } | 238 | } |
239 | //traverse listview, find messages to send | 239 | //traverse listview, find messages to send |
240 | if (! sending) { | 240 | if (! sending) { |
241 | item = (EmailListItem *) outboxView->firstChild(); | 241 | item = (EmailListItem *) outboxView->firstChild(); |
242 | if (item != NULL) { | 242 | if (item != NULL) { |
243 | while (item != NULL) { | 243 | while (item != NULL) { |
244 | quedMessages.append(item->getMail()); | 244 | quedMessages.append(item->getMail()); |
245 | item = (EmailListItem *) item->nextSibling(); | 245 | item = (EmailListItem *) item->nextSibling(); |
246 | count++; | 246 | count++; |
247 | } | 247 | } |
248 | setMailAccount(); | 248 | setMailAccount(); |
249 | emailHandler->sendMail(&quedMessages); | 249 | emailHandler->sendMail(&quedMessages); |
250 | sending = TRUE; | 250 | sending = TRUE; |
251 | sendMailButton->setEnabled(FALSE); | 251 | sendMailButton->setEnabled(FALSE); |
252 | cancelButton->setEnabled(TRUE); | 252 | cancelButton->setEnabled(TRUE); |
253 | } else { | 253 | } else { |
254 | qWarning("sendQuedMail(): no messages to send"); | 254 | qWarning("sendQuedMail(): no messages to send"); |
255 | } | 255 | } |
256 | } | 256 | } |
257 | } | 257 | } |
258 | 258 | ||
diff --git a/noncore/net/mailit/emailclient.h b/noncore/net/mailit/emailclient.h index 135bfaa..80457f9 100644 --- a/noncore/net/mailit/emailclient.h +++ b/noncore/net/mailit/emailclient.h | |||
@@ -1,149 +1,149 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef EMAILCLIENT_H | 20 | #ifndef EMAILCLIENT_H |
21 | #define EMAILCLIENT_H | 21 | #define EMAILCLIENT_H |
22 | 22 | ||
23 | #include <qlist.h> | 23 | #include <qlist.h> |
24 | #include <qcstring.h> | 24 | #include <qcstring.h> |
25 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
26 | 26 | ||
27 | #include <qtoolbar.h> | 27 | #include <qtoolbar.h> |
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | #include <qtabwidget.h> | ||
33 | #include <qaction.h> | 32 | #include <qaction.h> |
34 | #include <qlayout.h> | 33 | #include <qlayout.h> |
35 | #include <qtooltip.h> | 34 | #include <qtooltip.h> |
36 | #include <qimage.h> | 35 | #include <qimage.h> |
37 | #include <qpixmap.h> | 36 | #include <qpixmap.h> |
38 | #include <qstringlist.h> | 37 | #include <qstringlist.h> |
39 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
40 | #include <qstatusbar.h> | 39 | #include <qstatusbar.h> |
41 | #include <qdir.h> | 40 | #include <qdir.h> |
42 | #include <stdlib.h> | 41 | #include <stdlib.h> |
42 | #include <opie/otabwidget.h> | ||
43 | 43 | ||
44 | #include "emailhandler.h" | 44 | #include "emailhandler.h" |
45 | #include "emaillistitem.h" | 45 | #include "emaillistitem.h" |
46 | #include "textparser.h" | 46 | #include "textparser.h" |
47 | #include "editaccount.h" | 47 | #include "editaccount.h" |
48 | #include "maillist.h" | 48 | #include "maillist.h" |
49 | #include "addresslist.h" | 49 | #include "addresslist.h" |
50 | 50 | ||
51 | #include <qpe/config.h> | 51 | #include <qpe/config.h> |
52 | 52 | ||
53 | class AccountList : public QList<MailAccount> | 53 | class AccountList : public QList<MailAccount> |
54 | { | 54 | { |
55 | public: | 55 | public: |
56 | Item newItem(Item d); | 56 | Item newItem(Item d); |
57 | private: | 57 | private: |
58 | MailAccount* dupl(MailAccount *in); | 58 | MailAccount* dupl(MailAccount *in); |
59 | MailAccount *ac; | 59 | MailAccount *ac; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | //class EmailClient : public EmailClientBase | 62 | //class EmailClient : public EmailClientBase |
63 | class EmailClient : public QMainWindow | 63 | class EmailClient : public QMainWindow |
64 | { | 64 | { |
65 | Q_OBJECT | 65 | Q_OBJECT |
66 | 66 | ||
67 | public: | 67 | public: |
68 | EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); | 68 | EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); |
69 | ~EmailClient(); | 69 | ~EmailClient(); |
70 | AddressList* getAdrListRef(); | 70 | AddressList* getAdrListRef(); |
71 | 71 | ||
72 | signals: | 72 | signals: |
73 | void composeRequested(); | 73 | void composeRequested(); |
74 | void viewEmail(QListView *, Email *); | 74 | void viewEmail(QListView *, Email *); |
75 | void mailUpdated(Email *); | 75 | void mailUpdated(Email *); |
76 | void newCaption(const QString &); | 76 | void newCaption(const QString &); |
77 | 77 | ||
78 | public slots: | 78 | public slots: |
79 | void compose(); | 79 | void compose(); |
80 | void cancel(); | 80 | void cancel(); |
81 | void enqueMail(const Email &mail); | 81 | void enqueMail(const Email &mail); |
82 | void setMailAccount(); | 82 | void setMailAccount(); |
83 | void sendQuedMail(); | 83 | void sendQuedMail(); |
84 | void mailSent(); | 84 | void mailSent(); |
85 | void getNewMail(); | 85 | void getNewMail(); |
86 | void getAllNewMail(); | 86 | void getAllNewMail(); |
87 | void smtpError(int code); | 87 | void smtpError(int code); |
88 | void popError(int code); | 88 | void popError(int code); |
89 | void inboxItemSelected(); | 89 | void inboxItemSelected(); |
90 | void outboxItemSelected(); | 90 | void outboxItemSelected(); |
91 | void mailArrived(const Email &mail, bool fromDisk); | 91 | void mailArrived(const Email &mail, bool fromDisk); |
92 | void allMailArrived(int); | 92 | void allMailArrived(int); |
93 | void saveMail(QString fileName, QListView *view); | 93 | void saveMail(QString fileName, QListView *view); |
94 | void selectAccount(int); | 94 | void selectAccount(int); |
95 | void editAccount(int); | 95 | void editAccount(int); |
96 | void updateAccounts(); | 96 | void updateAccounts(); |
97 | void deleteAccount(int); | 97 | void deleteAccount(int); |
98 | void deleteMail(EmailListItem *mailItem, bool &inbox); | 98 | void deleteMail(EmailListItem *mailItem, bool &inbox); |
99 | void setTotalSize(int); | 99 | void setTotalSize(int); |
100 | void setMailSize(int); | 100 | void setMailSize(int); |
101 | void setDownloadedSize(int); | 101 | void setDownloadedSize(int); |
102 | void moveMailFront(Email *mailPtr); | 102 | void moveMailFront(Email *mailPtr); |
103 | 103 | ||
104 | private: | 104 | private: |
105 | void init(); | 105 | void init(); |
106 | void readMail(); | 106 | void readMail(); |
107 | QString getPath(bool enclosurePath); | 107 | QString getPath(bool enclosurePath); |
108 | void readSettings(); | 108 | void readSettings(); |
109 | void saveSettings(); | 109 | void saveSettings(); |
110 | 110 | ||
111 | private: | 111 | private: |
112 | Config *mailconf; | 112 | Config *mailconf; |
113 | int newAccountId, idCount, mailIdCount; | 113 | int newAccountId, idCount, mailIdCount; |
114 | int accountIdCount; | 114 | int accountIdCount; |
115 | AccountList accountList; | 115 | AccountList accountList; |
116 | AddressList *addressList; | 116 | AddressList *addressList; |
117 | 117 | ||
118 | EditAccount *editAccountView; | 118 | EditAccount *editAccountView; |
119 | EmailListItem *item; | 119 | EmailListItem *item; |
120 | EmailHandler *emailHandler; | 120 | EmailHandler *emailHandler; |
121 | QList<Email> quedMessages; | 121 | QList<Email> quedMessages; |
122 | MailList mailDownloadList; | 122 | MailList mailDownloadList; |
123 | bool sending, receiving, previewingMail, allAccounts; | 123 | bool sending, receiving, previewingMail, allAccounts; |
124 | QString lineShift; | 124 | QString lineShift; |
125 | MailAccount account, *currentAccount; | 125 | MailAccount account, *currentAccount; |
126 | 126 | ||
127 | QToolBar *bar; | 127 | QToolBar *bar; |
128 | QProgressBar *progressBar; | 128 | QProgressBar *progressBar; |
129 | QStatusBar *statusBar; | 129 | QStatusBar *statusBar; |
130 | QLabel *status1Label, *status2Label; | 130 | QLabel *status1Label, *status2Label; |
131 | QAction *getMailButton; | 131 | QAction *getMailButton; |
132 | QAction *sendMailButton; | 132 | QAction *sendMailButton; |
133 | QAction *composeButton; | 133 | QAction *composeButton; |
134 | QAction *cancelButton; | 134 | QAction *cancelButton; |
135 | 135 | ||
136 | QMenuBar *mb; | 136 | QMenuBar *mb; |
137 | QPopupMenu *selectAccountMenu; | 137 | QPopupMenu *selectAccountMenu; |
138 | QPopupMenu *editAccountMenu; | 138 | QPopupMenu *editAccountMenu; |
139 | QPopupMenu *deleteAccountMenu; | 139 | QPopupMenu *deleteAccountMenu; |
140 | 140 | ||
141 | QTabWidget* mailboxView; | 141 | OTabWidget* mailboxView; |
142 | QListView* inboxView; | 142 | QListView* inboxView; |
143 | QListView* outboxView; | 143 | QListView* outboxView; |
144 | 144 | ||
145 | QGridLayout* grid_2; | 145 | QGridLayout* grid_2; |
146 | QGridLayout* grid_3; | 146 | QGridLayout* grid_3; |
147 | }; | 147 | }; |
148 | 148 | ||
149 | #endif // EMAILCLIENT_H | 149 | #endif // EMAILCLIENT_H |
diff --git a/noncore/net/mailit/mailit.pro b/noncore/net/mailit/mailit.pro index d51126a..a404884 100644 --- a/noncore/net/mailit/mailit.pro +++ b/noncore/net/mailit/mailit.pro | |||
@@ -1,43 +1,43 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | HEADERS = emailclient.h \ | 3 | HEADERS = emailclient.h \ |
4 | emailhandler.h \ | 4 | emailhandler.h \ |
5 | emaillistitem.h \ | 5 | emaillistitem.h \ |
6 | mailitwindow.h \ | 6 | mailitwindow.h \ |
7 | md5.h \ | 7 | md5.h \ |
8 | popclient.h \ | 8 | popclient.h \ |
9 | readmail.h \ | 9 | readmail.h \ |
10 | smtpclient.h \ | 10 | smtpclient.h \ |
11 | writemail.h \ | 11 | writemail.h \ |
12 | textparser.h \ | 12 | textparser.h \ |
13 | viewatt.h \ | 13 | viewatt.h \ |
14 | addatt.h \ | 14 | addatt.h \ |
15 | editaccount.h \ | 15 | editaccount.h \ |
16 | maillist.h \ | 16 | maillist.h \ |
17 | addresslist.h | 17 | addresslist.h |
18 | SOURCES = emailclient.cpp \ | 18 | SOURCES = emailclient.cpp \ |
19 | emailhandler.cpp \ | 19 | emailhandler.cpp \ |
20 | emaillistitem.cpp \ | 20 | emaillistitem.cpp \ |
21 | mailitwindow.cpp \ | 21 | mailitwindow.cpp \ |
22 | main.cpp \ | 22 | main.cpp \ |
23 | md5.c \ | 23 | md5.c \ |
24 | popclient.cpp \ | 24 | popclient.cpp \ |
25 | readmail.cpp \ | 25 | readmail.cpp \ |
26 | smtpclient.cpp \ | 26 | smtpclient.cpp \ |
27 | writemail.cpp \ | 27 | writemail.cpp \ |
28 | textparser.cpp \ | 28 | textparser.cpp \ |
29 | viewatt.cpp \ | 29 | viewatt.cpp \ |
30 | addatt.cpp \ | 30 | addatt.cpp \ |
31 | editaccount.cpp \ | 31 | editaccount.cpp \ |
32 | maillist.cpp \ | 32 | maillist.cpp \ |
33 | addresslist.cpp | 33 | addresslist.cpp |
34 | 34 | ||
35 | INCLUDEPATH += $(OPIEDIR)/include | 35 | INCLUDEPATH += $(OPIEDIR)/include |
36 | DEPENDPATH += $(OPIEDIR)/include | 36 | DEPENDPATH += $(OPIEDIR)/include |
37 | LIBS += -lqpe | 37 | LIBS += -lqpe -lopie |
38 | # -lssl | 38 | # -lssl |
39 | MOC_DIR=qpeobj | 39 | MOC_DIR=qpeobj |
40 | OBJECTS_DIR=qpeobj | 40 | OBJECTS_DIR=qpeobj |
41 | DESTDIR=$(OPIEDIR)/bin | 41 | DESTDIR=$(OPIEDIR)/bin |
42 | 42 | ||
43 | include ( $(OPIEDIR)/include.pro ) | 43 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/mailit/readmail.cpp b/noncore/net/mailit/readmail.cpp index 4954f34..2011ecf 100644 --- a/noncore/net/mailit/readmail.cpp +++ b/noncore/net/mailit/readmail.cpp | |||
@@ -1,143 +1,143 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "readmail.h" | 20 | #include "readmail.h" |
21 | #include <qimage.h> | 21 | #include <qimage.h> |
22 | #include <qmime.h> | 22 | #include <qmime.h> |
23 | #include <qaction.h> | 23 | #include <qaction.h> |
24 | #include "resource.h" | 24 | #include "resource.h" |
25 | 25 | ||
26 | ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) | 26 | ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) |
27 | : QMainWindow(parent, name, fl) | 27 | : QMainWindow(parent, name, fl) |
28 | { | 28 | { |
29 | plainTxt = FALSE; | 29 | plainTxt = FALSE; |
30 | 30 | ||
31 | init(); | 31 | init(); |
32 | viewAtt = new ViewAtt(0, "View Attatchments"); | 32 | viewAtt = new ViewAtt(0, "View Attatchments"); |
33 | } | 33 | } |
34 | 34 | ||
35 | ReadMail::~ReadMail() | 35 | ReadMail::~ReadMail() |
36 | { | 36 | { |
37 | delete emailView->mimeSourceFactory(); | 37 | delete emailView->mimeSourceFactory(); |
38 | delete viewAtt; | 38 | delete viewAtt; |
39 | } | 39 | } |
40 | 40 | ||
41 | void ReadMail::init() | 41 | void ReadMail::init() |
42 | { | 42 | { |
43 | setToolBarsMovable(FALSE); | 43 | setToolBarsMovable(FALSE); |
44 | 44 | ||
45 | bar = new QToolBar(this); | 45 | bar = new QToolBar(this); |
46 | bar->setHorizontalStretchable( TRUE ); | 46 | bar->setHorizontalStretchable( TRUE ); |
47 | 47 | ||
48 | menu = new QMenuBar( bar ); | 48 | menu = new QMenuBar( bar ); |
49 | 49 | ||
50 | viewMenu = new QPopupMenu(menu); | 50 | viewMenu = new QPopupMenu(menu); |
51 | menu->insertItem( tr( "&View" ), viewMenu); | 51 | menu->insertItem( tr( "&View" ), viewMenu); |
52 | 52 | ||
53 | mailMenu = new QPopupMenu(menu); | 53 | mailMenu = new QPopupMenu(menu); |
54 | menu->insertItem( tr( "&Mail" ), mailMenu); | 54 | menu->insertItem( tr( "&Mail" ), mailMenu); |
55 | 55 | ||
56 | bar = new QToolBar(this); | 56 | bar = new QToolBar(this); |
57 | 57 | ||
58 | //reply dependant on viewing inbox | 58 | //reply dependant on viewing inbox |
59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "pass" ), | 59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), |
60 | QString::null, 0, this, 0 ); | 60 | QString::null, 0, this, 0 ); |
61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); | 61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); |
62 | 62 | ||
63 | previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 63 | previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
64 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); | 64 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); |
65 | previousButton->addTo(bar); | 65 | previousButton->addTo(bar); |
66 | previousButton->addTo(viewMenu); | 66 | previousButton->addTo(viewMenu); |
67 | 67 | ||
68 | nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); | 68 | nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); |
69 | connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) ); | 69 | connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) ); |
70 | nextButton->addTo(bar); | 70 | nextButton->addTo(bar); |
71 | nextButton->addTo(viewMenu); | 71 | nextButton->addTo(viewMenu); |
72 | 72 | ||
73 | attatchmentsButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); | 73 | attatchmentsButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "mailit/attach" ), QString::null, 0, this, 0 ); |
74 | connect( attatchmentsButton, SIGNAL( activated() ), this, | 74 | connect( attatchmentsButton, SIGNAL( activated() ), this, |
75 | SLOT( viewAttatchments() ) ); | 75 | SLOT( viewAttatchments() ) ); |
76 | attatchmentsButton->addTo(bar); | 76 | attatchmentsButton->addTo(bar); |
77 | attatchmentsButton->addTo(viewMenu); | 77 | attatchmentsButton->addTo(viewMenu); |
78 | 78 | ||
79 | plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0, TRUE); | 79 | plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE); |
80 | connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); | 80 | connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); |
81 | plainTextButton->addTo(bar); | 81 | plainTextButton->addTo(bar); |
82 | plainTextButton->addTo(viewMenu); | 82 | plainTextButton->addTo(viewMenu); |
83 | 83 | ||
84 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | 84 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); |
85 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | 85 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); |
86 | deleteButton->addTo(bar); | 86 | deleteButton->addTo(bar); |
87 | deleteButton->addTo(mailMenu); | 87 | deleteButton->addTo(mailMenu); |
88 | 88 | ||
89 | viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); | 89 | viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); |
90 | 90 | ||
91 | emailView = new QTextView( this, "emailView" ); | 91 | emailView = new QTextView( this, "emailView" ); |
92 | setCentralWidget(emailView); | 92 | setCentralWidget(emailView); |
93 | 93 | ||
94 | mime = new QMimeSourceFactory(); | 94 | mime = new QMimeSourceFactory(); |
95 | emailView->setMimeSourceFactory(mime); | 95 | emailView->setMimeSourceFactory(mime); |
96 | } | 96 | } |
97 | 97 | ||
98 | void ReadMail::updateView() | 98 | void ReadMail::updateView() |
99 | { | 99 | { |
100 | Enclosure *ePtr; | 100 | Enclosure *ePtr; |
101 | QString mailStringSize; | 101 | QString mailStringSize; |
102 | QString text, temp; | 102 | QString text, temp; |
103 | 103 | ||
104 | mail->read = TRUE; //mark as read | 104 | mail->read = TRUE; //mark as read |
105 | inbox = mail->received; | 105 | inbox = mail->received; |
106 | 106 | ||
107 | replyButton->removeFrom(mailMenu); | 107 | replyButton->removeFrom(mailMenu); |
108 | replyButton->removeFrom(bar); | 108 | replyButton->removeFrom(bar); |
109 | 109 | ||
110 | if (inbox == TRUE) { | 110 | if (inbox == TRUE) { |
111 | replyButton->addTo(bar); | 111 | replyButton->addTo(bar); |
112 | replyButton->addTo(mailMenu); | 112 | replyButton->addTo(mailMenu); |
113 | 113 | ||
114 | if (!mail->downloaded) { | 114 | if (!mail->downloaded) { |
115 | //report currently viewed mail so that it will be | 115 | //report currently viewed mail so that it will be |
116 | //placed first in the queue of new mails to download | 116 | //placed first in the queue of new mails to download |
117 | emit viewingMail(mail); | 117 | emit viewingMail(mail); |
118 | 118 | ||
119 | double mailSize = (double) mail->size; | 119 | double mailSize = (double) mail->size; |
120 | if (mailSize < 1024) { | 120 | if (mailSize < 1024) { |
121 | mailStringSize.setNum(mailSize); | 121 | mailStringSize.setNum(mailSize); |
122 | mailStringSize += " Bytes"; | 122 | mailStringSize += " Bytes"; |
123 | } else if (mailSize < 1024*1024) { | 123 | } else if (mailSize < 1024*1024) { |
124 | mailStringSize.setNum( (mailSize / 1024), 'g', 2 ); | 124 | mailStringSize.setNum( (mailSize / 1024), 'g', 2 ); |
125 | mailStringSize += " Kb"; | 125 | mailStringSize += " Kb"; |
126 | } else { | 126 | } else { |
127 | mailStringSize.setNum( (mailSize / (1024*1024)), 'g', 3); | 127 | mailStringSize.setNum( (mailSize / (1024*1024)), 'g', 3); |
128 | mailStringSize += " Mb"; | 128 | mailStringSize += " Mb"; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | QMimeSourceFactory *mime = emailView->mimeSourceFactory(); | 133 | QMimeSourceFactory *mime = emailView->mimeSourceFactory(); |
134 | 134 | ||
135 | if (! plainTxt) { //use RichText, inline pics etc. | 135 | if (! plainTxt) { //use RichText, inline pics etc. |
136 | emailView->setTextFormat(QTextView::RichText); | 136 | emailView->setTextFormat(QTextView::RichText); |
137 | text = "<b><big><center><font color=\"blue\">" + mail->subject | 137 | text = "<b><big><center><font color=\"blue\">" + mail->subject |
138 | +"</font></center></big></b><br>"; | 138 | +"</font></center></big></b><br>"; |
139 | text += "<b>From: </b>" + mail->from + " <i>" + | 139 | text += "<b>From: </b>" + mail->from + " <i>" + |
140 | mail->fromMail + "</i><br>"; | 140 | mail->fromMail + "</i><br>"; |
141 | 141 | ||
142 | text +="<b>To: </b>"; | 142 | text +="<b>To: </b>"; |
143 | for (QStringList::Iterator it = mail->recipients.begin(); | 143 | for (QStringList::Iterator it = mail->recipients.begin(); |
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 2e82623..fc4276b 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -97,162 +97,162 @@ EmailClient::~EmailClient() | |||
97 | } | 97 | } |
98 | 98 | ||
99 | void EmailClient::init() | 99 | void EmailClient::init() |
100 | { | 100 | { |
101 | statusBar = new QStatusBar(this); | 101 | statusBar = new QStatusBar(this); |
102 | statusBar->setSizeGripEnabled(FALSE); | 102 | statusBar->setSizeGripEnabled(FALSE); |
103 | 103 | ||
104 | status1Label = new QLabel( tr("Idle"), statusBar); | 104 | status1Label = new QLabel( tr("Idle"), statusBar); |
105 | status2Label = new QLabel("", statusBar); | 105 | status2Label = new QLabel("", statusBar); |
106 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), | 106 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), |
107 | status2Label, SLOT(setText(const QString &)) ); | 107 | status2Label, SLOT(setText(const QString &)) ); |
108 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), | 108 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), |
109 | status2Label, SLOT(setText(const QString &)) ); | 109 | status2Label, SLOT(setText(const QString &)) ); |
110 | 110 | ||
111 | progressBar = new QProgressBar(statusBar); | 111 | progressBar = new QProgressBar(statusBar); |
112 | connect(emailHandler, SIGNAL(mailboxSize(int)), | 112 | connect(emailHandler, SIGNAL(mailboxSize(int)), |
113 | this, SLOT(setTotalSize(int)) ); | 113 | this, SLOT(setTotalSize(int)) ); |
114 | connect(emailHandler, SIGNAL(currentMailSize(int)), | 114 | connect(emailHandler, SIGNAL(currentMailSize(int)), |
115 | this, SLOT(setMailSize(int)) ); | 115 | this, SLOT(setMailSize(int)) ); |
116 | connect(emailHandler, SIGNAL(downloadedSize(int)), | 116 | connect(emailHandler, SIGNAL(downloadedSize(int)), |
117 | this, SLOT(setDownloadedSize(int)) ); | 117 | this, SLOT(setDownloadedSize(int)) ); |
118 | 118 | ||
119 | statusBar->addWidget(status1Label); | 119 | statusBar->addWidget(status1Label); |
120 | statusBar->addWidget(progressBar); | 120 | statusBar->addWidget(progressBar); |
121 | statusBar->addWidget(status2Label); | 121 | statusBar->addWidget(status2Label); |
122 | 122 | ||
123 | setToolBarsMovable(FALSE); | 123 | setToolBarsMovable(FALSE); |
124 | 124 | ||
125 | bar = new QToolBar(this); | 125 | bar = new QToolBar(this); |
126 | bar->setHorizontalStretchable( TRUE ); | 126 | bar->setHorizontalStretchable( TRUE ); |
127 | 127 | ||
128 | mb = new QMenuBar( bar ); | 128 | mb = new QMenuBar( bar ); |
129 | 129 | ||
130 | QPopupMenu *mail = new QPopupMenu(mb); | 130 | QPopupMenu *mail = new QPopupMenu(mb); |
131 | mb->insertItem( tr( "&Mail" ), mail); | 131 | mb->insertItem( tr( "&Mail" ), mail); |
132 | 132 | ||
133 | QPopupMenu *configure = new QPopupMenu(mb); | 133 | QPopupMenu *configure = new QPopupMenu(mb); |
134 | mb->insertItem( tr( "Accounts" ), configure); | 134 | mb->insertItem( tr( "Accounts" ), configure); |
135 | 135 | ||
136 | selectAccountMenu = new QPopupMenu(mb); | 136 | selectAccountMenu = new QPopupMenu(mb); |
137 | editAccountMenu = new QPopupMenu(mb); | 137 | editAccountMenu = new QPopupMenu(mb); |
138 | deleteAccountMenu = new QPopupMenu(mb); | 138 | deleteAccountMenu = new QPopupMenu(mb); |
139 | 139 | ||
140 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); | 140 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); |
141 | configure->insertItem(tr("Edit account"), editAccountMenu); | 141 | configure->insertItem(tr("Edit account"), editAccountMenu); |
142 | configure->insertItem(tr("Delete account"), deleteAccountMenu); | 142 | configure->insertItem(tr("Delete account"), deleteAccountMenu); |
143 | 143 | ||
144 | bar = new QToolBar(this); | 144 | bar = new QToolBar(this); |
145 | 145 | ||
146 | getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); | 146 | getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); |
147 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); | 147 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); |
148 | getMailButton->addTo(bar); | 148 | getMailButton->addTo(bar); |
149 | getMailButton->addTo(mail); | 149 | getMailButton->addTo(mail); |
150 | 150 | ||
151 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendmail"), QString::null, 0, this, 0); | 151 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendmail"), QString::null, 0, this, 0); |
152 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); | 152 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); |
153 | sendMailButton->addTo(bar); | 153 | sendMailButton->addTo(bar); |
154 | sendMailButton->addTo(mail); | 154 | sendMailButton->addTo(mail); |
155 | 155 | ||
156 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 156 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
157 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); | 157 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); |
158 | composeButton->addTo(bar); | 158 | composeButton->addTo(bar); |
159 | composeButton->addTo(mail); | 159 | composeButton->addTo(mail); |
160 | 160 | ||
161 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("reset"), QString::null, 0, this, 0); | 161 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); |
162 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); | 162 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); |
163 | cancelButton->addTo(mail); | 163 | cancelButton->addTo(mail); |
164 | cancelButton->setEnabled(FALSE); | 164 | cancelButton->setEnabled(FALSE); |
165 | 165 | ||
166 | mailboxView = new QTabWidget( this, "mailboxView" ); | 166 | mailboxView = new OTabWidget( this, "mailboxView" ); |
167 | 167 | ||
168 | QWidget* widget = new QWidget( mailboxView, "widget" ); | 168 | QWidget* widget = new QWidget( mailboxView, "widget" ); |
169 | grid_2 = new QGridLayout( widget ); | 169 | grid_2 = new QGridLayout( widget ); |
170 | // grid_2->setSpacing(6); | 170 | // grid_2->setSpacing(6); |
171 | // grid_2->setMargin( 11 ); | 171 | // grid_2->setMargin( 11 ); |
172 | 172 | ||
173 | inboxView = new QListView( widget, "inboxView" ); | 173 | inboxView = new QListView( widget, "inboxView" ); |
174 | inboxView->addColumn( tr( "From" ) ); | 174 | inboxView->addColumn( tr( "From" ) ); |
175 | inboxView->addColumn( tr( "Subject" ) ); | 175 | inboxView->addColumn( tr( "Subject" ) ); |
176 | inboxView->addColumn( tr( "Date" ) ); | 176 | inboxView->addColumn( tr( "Date" ) ); |
177 | inboxView->setMinimumSize( QSize( 0, 0 ) ); | 177 | inboxView->setMinimumSize( QSize( 0, 0 ) ); |
178 | inboxView->setAllColumnsShowFocus(TRUE); | 178 | inboxView->setAllColumnsShowFocus(TRUE); |
179 | 179 | ||
180 | grid_2->addWidget( inboxView, 2, 0 ); | 180 | grid_2->addWidget( inboxView, 2, 0 ); |
181 | mailboxView->insertTab( widget, tr( "Inbox" ) ); | 181 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); |
182 | 182 | ||
183 | QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); | 183 | QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); |
184 | grid_3 = new QGridLayout( widget_2 ); | 184 | grid_3 = new QGridLayout( widget_2 ); |
185 | // grid_3->setSpacing(6); | 185 | // grid_3->setSpacing(6); |
186 | // grid_3->setMargin( 11 ); | 186 | // grid_3->setMargin( 11 ); |
187 | 187 | ||
188 | outboxView = new QListView( widget_2, "outboxView" ); | 188 | outboxView = new QListView( widget_2, "outboxView" ); |
189 | outboxView->addColumn( tr( "To" ) ); | 189 | outboxView->addColumn( tr( "To" ) ); |
190 | outboxView->addColumn( tr( "Subject" ) ); | 190 | outboxView->addColumn( tr( "Subject" ) ); |
191 | outboxView->setAllColumnsShowFocus(TRUE); | 191 | outboxView->setAllColumnsShowFocus(TRUE); |
192 | 192 | ||
193 | grid_3->addWidget( outboxView, 0, 0 ); | 193 | grid_3->addWidget( outboxView, 0, 0 ); |
194 | mailboxView->insertTab( widget_2, tr( "Outbox" ) ); | 194 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); |
195 | 195 | ||
196 | setCentralWidget(mailboxView); | 196 | setCentralWidget(mailboxView); |
197 | } | 197 | } |
198 | 198 | ||
199 | void EmailClient::compose() | 199 | void EmailClient::compose() |
200 | { | 200 | { |
201 | emit composeRequested(); | 201 | emit composeRequested(); |
202 | } | 202 | } |
203 | 203 | ||
204 | void EmailClient::cancel() | 204 | void EmailClient::cancel() |
205 | { | 205 | { |
206 | emailHandler->cancel(); | 206 | emailHandler->cancel(); |
207 | } | 207 | } |
208 | 208 | ||
209 | AddressList* EmailClient::getAdrListRef() | 209 | AddressList* EmailClient::getAdrListRef() |
210 | { | 210 | { |
211 | return addressList; | 211 | return addressList; |
212 | } | 212 | } |
213 | 213 | ||
214 | //this needs to be rewritten to syncronize with outboxView | 214 | //this needs to be rewritten to syncronize with outboxView |
215 | void EmailClient::enqueMail(const Email &mail) | 215 | void EmailClient::enqueMail(const Email &mail) |
216 | { | 216 | { |
217 | if (accountList.count() > 0) { | 217 | if (accountList.count() > 0) { |
218 | currentAccount = accountList.first(); | 218 | currentAccount = accountList.first(); |
219 | qWarning("using account " + currentAccount->name); | 219 | qWarning("using account " + currentAccount->name); |
220 | } | 220 | } |
221 | 221 | ||
222 | Email addMail = mail; | 222 | Email addMail = mail; |
223 | addMail.from = currentAccount->name; | 223 | addMail.from = currentAccount->name; |
224 | addMail.fromMail = currentAccount->emailAddress; | 224 | addMail.fromMail = currentAccount->emailAddress; |
225 | addMail.rawMail.prepend("From: " + addMail.from + "<" + addMail.fromMail + ">\n"); | 225 | addMail.rawMail.prepend("From: " + addMail.from + "<" + addMail.fromMail + ">\n"); |
226 | item = new EmailListItem(outboxView, addMail, false); | 226 | item = new EmailListItem(outboxView, addMail, false); |
227 | 227 | ||
228 | } | 228 | } |
229 | 229 | ||
230 | void EmailClient::sendQuedMail() | 230 | void EmailClient::sendQuedMail() |
231 | { | 231 | { |
232 | int count = 0; | 232 | int count = 0; |
233 | 233 | ||
234 | if (accountList.count() == 0) { | 234 | if (accountList.count() == 0) { |
235 | QMessageBox::warning(qApp->activeWindow(), | 235 | QMessageBox::warning(qApp->activeWindow(), |
236 | "No account selected", "You must create an account", "OK\n"); | 236 | "No account selected", "You must create an account", "OK\n"); |
237 | return; | 237 | return; |
238 | } | 238 | } |
239 | //traverse listview, find messages to send | 239 | //traverse listview, find messages to send |
240 | if (! sending) { | 240 | if (! sending) { |
241 | item = (EmailListItem *) outboxView->firstChild(); | 241 | item = (EmailListItem *) outboxView->firstChild(); |
242 | if (item != NULL) { | 242 | if (item != NULL) { |
243 | while (item != NULL) { | 243 | while (item != NULL) { |
244 | quedMessages.append(item->getMail()); | 244 | quedMessages.append(item->getMail()); |
245 | item = (EmailListItem *) item->nextSibling(); | 245 | item = (EmailListItem *) item->nextSibling(); |
246 | count++; | 246 | count++; |
247 | } | 247 | } |
248 | setMailAccount(); | 248 | setMailAccount(); |
249 | emailHandler->sendMail(&quedMessages); | 249 | emailHandler->sendMail(&quedMessages); |
250 | sending = TRUE; | 250 | sending = TRUE; |
251 | sendMailButton->setEnabled(FALSE); | 251 | sendMailButton->setEnabled(FALSE); |
252 | cancelButton->setEnabled(TRUE); | 252 | cancelButton->setEnabled(TRUE); |
253 | } else { | 253 | } else { |
254 | qWarning("sendQuedMail(): no messages to send"); | 254 | qWarning("sendQuedMail(): no messages to send"); |
255 | } | 255 | } |
256 | } | 256 | } |
257 | } | 257 | } |
258 | 258 | ||
diff --git a/noncore/unsupported/mailit/emailclient.h b/noncore/unsupported/mailit/emailclient.h index 135bfaa..80457f9 100644 --- a/noncore/unsupported/mailit/emailclient.h +++ b/noncore/unsupported/mailit/emailclient.h | |||
@@ -1,149 +1,149 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef EMAILCLIENT_H | 20 | #ifndef EMAILCLIENT_H |
21 | #define EMAILCLIENT_H | 21 | #define EMAILCLIENT_H |
22 | 22 | ||
23 | #include <qlist.h> | 23 | #include <qlist.h> |
24 | #include <qcstring.h> | 24 | #include <qcstring.h> |
25 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
26 | 26 | ||
27 | #include <qtoolbar.h> | 27 | #include <qtoolbar.h> |
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | #include <qtabwidget.h> | ||
33 | #include <qaction.h> | 32 | #include <qaction.h> |
34 | #include <qlayout.h> | 33 | #include <qlayout.h> |
35 | #include <qtooltip.h> | 34 | #include <qtooltip.h> |
36 | #include <qimage.h> | 35 | #include <qimage.h> |
37 | #include <qpixmap.h> | 36 | #include <qpixmap.h> |
38 | #include <qstringlist.h> | 37 | #include <qstringlist.h> |
39 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
40 | #include <qstatusbar.h> | 39 | #include <qstatusbar.h> |
41 | #include <qdir.h> | 40 | #include <qdir.h> |
42 | #include <stdlib.h> | 41 | #include <stdlib.h> |
42 | #include <opie/otabwidget.h> | ||
43 | 43 | ||
44 | #include "emailhandler.h" | 44 | #include "emailhandler.h" |
45 | #include "emaillistitem.h" | 45 | #include "emaillistitem.h" |
46 | #include "textparser.h" | 46 | #include "textparser.h" |
47 | #include "editaccount.h" | 47 | #include "editaccount.h" |
48 | #include "maillist.h" | 48 | #include "maillist.h" |
49 | #include "addresslist.h" | 49 | #include "addresslist.h" |
50 | 50 | ||
51 | #include <qpe/config.h> | 51 | #include <qpe/config.h> |
52 | 52 | ||
53 | class AccountList : public QList<MailAccount> | 53 | class AccountList : public QList<MailAccount> |
54 | { | 54 | { |
55 | public: | 55 | public: |
56 | Item newItem(Item d); | 56 | Item newItem(Item d); |
57 | private: | 57 | private: |
58 | MailAccount* dupl(MailAccount *in); | 58 | MailAccount* dupl(MailAccount *in); |
59 | MailAccount *ac; | 59 | MailAccount *ac; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | //class EmailClient : public EmailClientBase | 62 | //class EmailClient : public EmailClientBase |
63 | class EmailClient : public QMainWindow | 63 | class EmailClient : public QMainWindow |
64 | { | 64 | { |
65 | Q_OBJECT | 65 | Q_OBJECT |
66 | 66 | ||
67 | public: | 67 | public: |
68 | EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); | 68 | EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); |
69 | ~EmailClient(); | 69 | ~EmailClient(); |
70 | AddressList* getAdrListRef(); | 70 | AddressList* getAdrListRef(); |
71 | 71 | ||
72 | signals: | 72 | signals: |
73 | void composeRequested(); | 73 | void composeRequested(); |
74 | void viewEmail(QListView *, Email *); | 74 | void viewEmail(QListView *, Email *); |
75 | void mailUpdated(Email *); | 75 | void mailUpdated(Email *); |
76 | void newCaption(const QString &); | 76 | void newCaption(const QString &); |
77 | 77 | ||
78 | public slots: | 78 | public slots: |
79 | void compose(); | 79 | void compose(); |
80 | void cancel(); | 80 | void cancel(); |
81 | void enqueMail(const Email &mail); | 81 | void enqueMail(const Email &mail); |
82 | void setMailAccount(); | 82 | void setMailAccount(); |
83 | void sendQuedMail(); | 83 | void sendQuedMail(); |
84 | void mailSent(); | 84 | void mailSent(); |
85 | void getNewMail(); | 85 | void getNewMail(); |
86 | void getAllNewMail(); | 86 | void getAllNewMail(); |
87 | void smtpError(int code); | 87 | void smtpError(int code); |
88 | void popError(int code); | 88 | void popError(int code); |
89 | void inboxItemSelected(); | 89 | void inboxItemSelected(); |
90 | void outboxItemSelected(); | 90 | void outboxItemSelected(); |
91 | void mailArrived(const Email &mail, bool fromDisk); | 91 | void mailArrived(const Email &mail, bool fromDisk); |
92 | void allMailArrived(int); | 92 | void allMailArrived(int); |
93 | void saveMail(QString fileName, QListView *view); | 93 | void saveMail(QString fileName, QListView *view); |
94 | void selectAccount(int); | 94 | void selectAccount(int); |
95 | void editAccount(int); | 95 | void editAccount(int); |
96 | void updateAccounts(); | 96 | void updateAccounts(); |
97 | void deleteAccount(int); | 97 | void deleteAccount(int); |
98 | void deleteMail(EmailListItem *mailItem, bool &inbox); | 98 | void deleteMail(EmailListItem *mailItem, bool &inbox); |
99 | void setTotalSize(int); | 99 | void setTotalSize(int); |
100 | void setMailSize(int); | 100 | void setMailSize(int); |
101 | void setDownloadedSize(int); | 101 | void setDownloadedSize(int); |
102 | void moveMailFront(Email *mailPtr); | 102 | void moveMailFront(Email *mailPtr); |
103 | 103 | ||
104 | private: | 104 | private: |
105 | void init(); | 105 | void init(); |
106 | void readMail(); | 106 | void readMail(); |
107 | QString getPath(bool enclosurePath); | 107 | QString getPath(bool enclosurePath); |
108 | void readSettings(); | 108 | void readSettings(); |
109 | void saveSettings(); | 109 | void saveSettings(); |
110 | 110 | ||
111 | private: | 111 | private: |
112 | Config *mailconf; | 112 | Config *mailconf; |
113 | int newAccountId, idCount, mailIdCount; | 113 | int newAccountId, idCount, mailIdCount; |
114 | int accountIdCount; | 114 | int accountIdCount; |
115 | AccountList accountList; | 115 | AccountList accountList; |
116 | AddressList *addressList; | 116 | AddressList *addressList; |
117 | 117 | ||
118 | EditAccount *editAccountView; | 118 | EditAccount *editAccountView; |
119 | EmailListItem *item; | 119 | EmailListItem *item; |
120 | EmailHandler *emailHandler; | 120 | EmailHandler *emailHandler; |
121 | QList<Email> quedMessages; | 121 | QList<Email> quedMessages; |
122 | MailList mailDownloadList; | 122 | MailList mailDownloadList; |
123 | bool sending, receiving, previewingMail, allAccounts; | 123 | bool sending, receiving, previewingMail, allAccounts; |
124 | QString lineShift; | 124 | QString lineShift; |
125 | MailAccount account, *currentAccount; | 125 | MailAccount account, *currentAccount; |
126 | 126 | ||
127 | QToolBar *bar; | 127 | QToolBar *bar; |
128 | QProgressBar *progressBar; | 128 | QProgressBar *progressBar; |
129 | QStatusBar *statusBar; | 129 | QStatusBar *statusBar; |
130 | QLabel *status1Label, *status2Label; | 130 | QLabel *status1Label, *status2Label; |
131 | QAction *getMailButton; | 131 | QAction *getMailButton; |
132 | QAction *sendMailButton; | 132 | QAction *sendMailButton; |
133 | QAction *composeButton; | 133 | QAction *composeButton; |
134 | QAction *cancelButton; | 134 | QAction *cancelButton; |
135 | 135 | ||
136 | QMenuBar *mb; | 136 | QMenuBar *mb; |
137 | QPopupMenu *selectAccountMenu; | 137 | QPopupMenu *selectAccountMenu; |
138 | QPopupMenu *editAccountMenu; | 138 | QPopupMenu *editAccountMenu; |
139 | QPopupMenu *deleteAccountMenu; | 139 | QPopupMenu *deleteAccountMenu; |
140 | 140 | ||
141 | QTabWidget* mailboxView; | 141 | OTabWidget* mailboxView; |
142 | QListView* inboxView; | 142 | QListView* inboxView; |
143 | QListView* outboxView; | 143 | QListView* outboxView; |
144 | 144 | ||
145 | QGridLayout* grid_2; | 145 | QGridLayout* grid_2; |
146 | QGridLayout* grid_3; | 146 | QGridLayout* grid_3; |
147 | }; | 147 | }; |
148 | 148 | ||
149 | #endif // EMAILCLIENT_H | 149 | #endif // EMAILCLIENT_H |
diff --git a/noncore/unsupported/mailit/mailit.pro b/noncore/unsupported/mailit/mailit.pro index d51126a..a404884 100644 --- a/noncore/unsupported/mailit/mailit.pro +++ b/noncore/unsupported/mailit/mailit.pro | |||
@@ -1,43 +1,43 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | HEADERS = emailclient.h \ | 3 | HEADERS = emailclient.h \ |
4 | emailhandler.h \ | 4 | emailhandler.h \ |
5 | emaillistitem.h \ | 5 | emaillistitem.h \ |
6 | mailitwindow.h \ | 6 | mailitwindow.h \ |
7 | md5.h \ | 7 | md5.h \ |
8 | popclient.h \ | 8 | popclient.h \ |
9 | readmail.h \ | 9 | readmail.h \ |
10 | smtpclient.h \ | 10 | smtpclient.h \ |
11 | writemail.h \ | 11 | writemail.h \ |
12 | textparser.h \ | 12 | textparser.h \ |
13 | viewatt.h \ | 13 | viewatt.h \ |
14 | addatt.h \ | 14 | addatt.h \ |
15 | editaccount.h \ | 15 | editaccount.h \ |
16 | maillist.h \ | 16 | maillist.h \ |
17 | addresslist.h | 17 | addresslist.h |
18 | SOURCES = emailclient.cpp \ | 18 | SOURCES = emailclient.cpp \ |
19 | emailhandler.cpp \ | 19 | emailhandler.cpp \ |
20 | emaillistitem.cpp \ | 20 | emaillistitem.cpp \ |
21 | mailitwindow.cpp \ | 21 | mailitwindow.cpp \ |
22 | main.cpp \ | 22 | main.cpp \ |
23 | md5.c \ | 23 | md5.c \ |
24 | popclient.cpp \ | 24 | popclient.cpp \ |
25 | readmail.cpp \ | 25 | readmail.cpp \ |
26 | smtpclient.cpp \ | 26 | smtpclient.cpp \ |
27 | writemail.cpp \ | 27 | writemail.cpp \ |
28 | textparser.cpp \ | 28 | textparser.cpp \ |
29 | viewatt.cpp \ | 29 | viewatt.cpp \ |
30 | addatt.cpp \ | 30 | addatt.cpp \ |
31 | editaccount.cpp \ | 31 | editaccount.cpp \ |
32 | maillist.cpp \ | 32 | maillist.cpp \ |
33 | addresslist.cpp | 33 | addresslist.cpp |
34 | 34 | ||
35 | INCLUDEPATH += $(OPIEDIR)/include | 35 | INCLUDEPATH += $(OPIEDIR)/include |
36 | DEPENDPATH += $(OPIEDIR)/include | 36 | DEPENDPATH += $(OPIEDIR)/include |
37 | LIBS += -lqpe | 37 | LIBS += -lqpe -lopie |
38 | # -lssl | 38 | # -lssl |
39 | MOC_DIR=qpeobj | 39 | MOC_DIR=qpeobj |
40 | OBJECTS_DIR=qpeobj | 40 | OBJECTS_DIR=qpeobj |
41 | DESTDIR=$(OPIEDIR)/bin | 41 | DESTDIR=$(OPIEDIR)/bin |
42 | 42 | ||
43 | include ( $(OPIEDIR)/include.pro ) | 43 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/unsupported/mailit/readmail.cpp b/noncore/unsupported/mailit/readmail.cpp index 4954f34..2011ecf 100644 --- a/noncore/unsupported/mailit/readmail.cpp +++ b/noncore/unsupported/mailit/readmail.cpp | |||
@@ -1,143 +1,143 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "readmail.h" | 20 | #include "readmail.h" |
21 | #include <qimage.h> | 21 | #include <qimage.h> |
22 | #include <qmime.h> | 22 | #include <qmime.h> |
23 | #include <qaction.h> | 23 | #include <qaction.h> |
24 | #include "resource.h" | 24 | #include "resource.h" |
25 | 25 | ||
26 | ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) | 26 | ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) |
27 | : QMainWindow(parent, name, fl) | 27 | : QMainWindow(parent, name, fl) |
28 | { | 28 | { |
29 | plainTxt = FALSE; | 29 | plainTxt = FALSE; |
30 | 30 | ||
31 | init(); | 31 | init(); |
32 | viewAtt = new ViewAtt(0, "View Attatchments"); | 32 | viewAtt = new ViewAtt(0, "View Attatchments"); |
33 | } | 33 | } |
34 | 34 | ||
35 | ReadMail::~ReadMail() | 35 | ReadMail::~ReadMail() |
36 | { | 36 | { |
37 | delete emailView->mimeSourceFactory(); | 37 | delete emailView->mimeSourceFactory(); |
38 | delete viewAtt; | 38 | delete viewAtt; |
39 | } | 39 | } |
40 | 40 | ||
41 | void ReadMail::init() | 41 | void ReadMail::init() |
42 | { | 42 | { |
43 | setToolBarsMovable(FALSE); | 43 | setToolBarsMovable(FALSE); |
44 | 44 | ||
45 | bar = new QToolBar(this); | 45 | bar = new QToolBar(this); |
46 | bar->setHorizontalStretchable( TRUE ); | 46 | bar->setHorizontalStretchable( TRUE ); |
47 | 47 | ||
48 | menu = new QMenuBar( bar ); | 48 | menu = new QMenuBar( bar ); |
49 | 49 | ||
50 | viewMenu = new QPopupMenu(menu); | 50 | viewMenu = new QPopupMenu(menu); |
51 | menu->insertItem( tr( "&View" ), viewMenu); | 51 | menu->insertItem( tr( "&View" ), viewMenu); |
52 | 52 | ||
53 | mailMenu = new QPopupMenu(menu); | 53 | mailMenu = new QPopupMenu(menu); |
54 | menu->insertItem( tr( "&Mail" ), mailMenu); | 54 | menu->insertItem( tr( "&Mail" ), mailMenu); |
55 | 55 | ||
56 | bar = new QToolBar(this); | 56 | bar = new QToolBar(this); |
57 | 57 | ||
58 | //reply dependant on viewing inbox | 58 | //reply dependant on viewing inbox |
59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "pass" ), | 59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), |
60 | QString::null, 0, this, 0 ); | 60 | QString::null, 0, this, 0 ); |
61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); | 61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); |
62 | 62 | ||
63 | previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 63 | previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
64 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); | 64 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); |
65 | previousButton->addTo(bar); | 65 | previousButton->addTo(bar); |
66 | previousButton->addTo(viewMenu); | 66 | previousButton->addTo(viewMenu); |
67 | 67 | ||
68 | nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); | 68 | nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); |
69 | connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) ); | 69 | connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) ); |
70 | nextButton->addTo(bar); | 70 | nextButton->addTo(bar); |
71 | nextButton->addTo(viewMenu); | 71 | nextButton->addTo(viewMenu); |
72 | 72 | ||
73 | attatchmentsButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); | 73 | attatchmentsButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "mailit/attach" ), QString::null, 0, this, 0 ); |
74 | connect( attatchmentsButton, SIGNAL( activated() ), this, | 74 | connect( attatchmentsButton, SIGNAL( activated() ), this, |
75 | SLOT( viewAttatchments() ) ); | 75 | SLOT( viewAttatchments() ) ); |
76 | attatchmentsButton->addTo(bar); | 76 | attatchmentsButton->addTo(bar); |
77 | attatchmentsButton->addTo(viewMenu); | 77 | attatchmentsButton->addTo(viewMenu); |
78 | 78 | ||
79 | plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0, TRUE); | 79 | plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE); |
80 | connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); | 80 | connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); |
81 | plainTextButton->addTo(bar); | 81 | plainTextButton->addTo(bar); |
82 | plainTextButton->addTo(viewMenu); | 82 | plainTextButton->addTo(viewMenu); |
83 | 83 | ||
84 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | 84 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); |
85 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | 85 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); |
86 | deleteButton->addTo(bar); | 86 | deleteButton->addTo(bar); |
87 | deleteButton->addTo(mailMenu); | 87 | deleteButton->addTo(mailMenu); |
88 | 88 | ||
89 | viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); | 89 | viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); |
90 | 90 | ||
91 | emailView = new QTextView( this, "emailView" ); | 91 | emailView = new QTextView( this, "emailView" ); |
92 | setCentralWidget(emailView); | 92 | setCentralWidget(emailView); |
93 | 93 | ||
94 | mime = new QMimeSourceFactory(); | 94 | mime = new QMimeSourceFactory(); |
95 | emailView->setMimeSourceFactory(mime); | 95 | emailView->setMimeSourceFactory(mime); |
96 | } | 96 | } |
97 | 97 | ||
98 | void ReadMail::updateView() | 98 | void ReadMail::updateView() |
99 | { | 99 | { |
100 | Enclosure *ePtr; | 100 | Enclosure *ePtr; |
101 | QString mailStringSize; | 101 | QString mailStringSize; |
102 | QString text, temp; | 102 | QString text, temp; |
103 | 103 | ||
104 | mail->read = TRUE; //mark as read | 104 | mail->read = TRUE; //mark as read |
105 | inbox = mail->received; | 105 | inbox = mail->received; |
106 | 106 | ||
107 | replyButton->removeFrom(mailMenu); | 107 | replyButton->removeFrom(mailMenu); |
108 | replyButton->removeFrom(bar); | 108 | replyButton->removeFrom(bar); |
109 | 109 | ||
110 | if (inbox == TRUE) { | 110 | if (inbox == TRUE) { |
111 | replyButton->addTo(bar); | 111 | replyButton->addTo(bar); |
112 | replyButton->addTo(mailMenu); | 112 | replyButton->addTo(mailMenu); |
113 | 113 | ||
114 | if (!mail->downloaded) { | 114 | if (!mail->downloaded) { |
115 | //report currently viewed mail so that it will be | 115 | //report currently viewed mail so that it will be |
116 | //placed first in the queue of new mails to download | 116 | //placed first in the queue of new mails to download |
117 | emit viewingMail(mail); | 117 | emit viewingMail(mail); |
118 | 118 | ||
119 | double mailSize = (double) mail->size; | 119 | double mailSize = (double) mail->size; |
120 | if (mailSize < 1024) { | 120 | if (mailSize < 1024) { |
121 | mailStringSize.setNum(mailSize); | 121 | mailStringSize.setNum(mailSize); |
122 | mailStringSize += " Bytes"; | 122 | mailStringSize += " Bytes"; |
123 | } else if (mailSize < 1024*1024) { | 123 | } else if (mailSize < 1024*1024) { |
124 | mailStringSize.setNum( (mailSize / 1024), 'g', 2 ); | 124 | mailStringSize.setNum( (mailSize / 1024), 'g', 2 ); |
125 | mailStringSize += " Kb"; | 125 | mailStringSize += " Kb"; |
126 | } else { | 126 | } else { |
127 | mailStringSize.setNum( (mailSize / (1024*1024)), 'g', 3); | 127 | mailStringSize.setNum( (mailSize / (1024*1024)), 'g', 3); |
128 | mailStringSize += " Mb"; | 128 | mailStringSize += " Mb"; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | QMimeSourceFactory *mime = emailView->mimeSourceFactory(); | 133 | QMimeSourceFactory *mime = emailView->mimeSourceFactory(); |
134 | 134 | ||
135 | if (! plainTxt) { //use RichText, inline pics etc. | 135 | if (! plainTxt) { //use RichText, inline pics etc. |
136 | emailView->setTextFormat(QTextView::RichText); | 136 | emailView->setTextFormat(QTextView::RichText); |
137 | text = "<b><big><center><font color=\"blue\">" + mail->subject | 137 | text = "<b><big><center><font color=\"blue\">" + mail->subject |
138 | +"</font></center></big></b><br>"; | 138 | +"</font></center></big></b><br>"; |
139 | text += "<b>From: </b>" + mail->from + " <i>" + | 139 | text += "<b>From: </b>" + mail->from + " <i>" + |
140 | mail->fromMail + "</i><br>"; | 140 | mail->fromMail + "</i><br>"; |
141 | 141 | ||
142 | text +="<b>To: </b>"; | 142 | text +="<b>To: </b>"; |
143 | for (QStringList::Iterator it = mail->recipients.begin(); | 143 | for (QStringList::Iterator it = mail->recipients.begin(); |