-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mailit/getmail.xpm | 21 | ||||
-rw-r--r-- | noncore/net/mailit/sendmail.xpm | 20 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/mailit/getmail.xpm | 21 | ||||
-rw-r--r-- | noncore/unsupported/mailit/sendmail.xpm | 20 |
6 files changed, 4 insertions, 86 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index 7ba5c75..2e82623 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -1,343 +1,343 @@ | |||
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 <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <qfile.h> | 22 | #include <qfile.h> |
23 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
24 | #include <qmenubar.h> | 24 | #include <qmenubar.h> |
25 | #include <qaction.h> | 25 | #include <qaction.h> |
26 | #include "resource.h" | 26 | #include "resource.h" |
27 | #include "emailclient.h" | 27 | #include "emailclient.h" |
28 | 28 | ||
29 | QCollection::Item AccountList::newItem(QCollection::Item d) | 29 | QCollection::Item AccountList::newItem(QCollection::Item d) |
30 | { | 30 | { |
31 | return dupl( (MailAccount *) d); | 31 | return dupl( (MailAccount *) d); |
32 | } | 32 | } |
33 | 33 | ||
34 | MailAccount* AccountList::dupl(MailAccount *in) | 34 | MailAccount* AccountList::dupl(MailAccount *in) |
35 | { | 35 | { |
36 | ac = new MailAccount(*in); | 36 | ac = new MailAccount(*in); |
37 | return ac; | 37 | return ac; |
38 | } | 38 | } |
39 | 39 | ||
40 | EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | 40 | EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) |
41 | : QMainWindow( parent, name, fl ) | 41 | : QMainWindow( parent, name, fl ) |
42 | { | 42 | { |
43 | emailHandler = new EmailHandler(); | 43 | emailHandler = new EmailHandler(); |
44 | addressList = new AddressList( getPath(FALSE) + "mail_adr"); | 44 | addressList = new AddressList( getPath(FALSE) + "mail_adr"); |
45 | 45 | ||
46 | sending = FALSE; | 46 | sending = FALSE; |
47 | receiving = FALSE; | 47 | receiving = FALSE; |
48 | previewingMail = FALSE; | 48 | previewingMail = FALSE; |
49 | mailIdCount = 1; | 49 | mailIdCount = 1; |
50 | accountIdCount = 1; | 50 | accountIdCount = 1; |
51 | allAccounts = FALSE; | 51 | allAccounts = FALSE; |
52 | 52 | ||
53 | init(); | 53 | init(); |
54 | 54 | ||
55 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); | 55 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); |
56 | 56 | ||
57 | connect(emailHandler, SIGNAL(smtpError(int)), this, | 57 | connect(emailHandler, SIGNAL(smtpError(int)), this, |
58 | SLOT(smtpError(int)) ); | 58 | SLOT(smtpError(int)) ); |
59 | connect(emailHandler, SIGNAL(popError(int)), this, | 59 | connect(emailHandler, SIGNAL(popError(int)), this, |
60 | SLOT(popError(int)) ); | 60 | SLOT(popError(int)) ); |
61 | 61 | ||
62 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); | 62 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); |
63 | connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); | 63 | connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); |
64 | 64 | ||
65 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, | 65 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, |
66 | SLOT(mailArrived(const Email &, bool)) ); | 66 | SLOT(mailArrived(const Email &, bool)) ); |
67 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, | 67 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, |
68 | SLOT(allMailArrived(int)) ); | 68 | SLOT(allMailArrived(int)) ); |
69 | 69 | ||
70 | mailconf = new Config("mailit"); | 70 | mailconf = new Config("mailit"); |
71 | //In case Synchronize is not defined in settings.txt | 71 | //In case Synchronize is not defined in settings.txt |
72 | 72 | ||
73 | readSettings(); | 73 | readSettings(); |
74 | 74 | ||
75 | updateAccounts(); | 75 | updateAccounts(); |
76 | 76 | ||
77 | lineShift = "\n"; | 77 | lineShift = "\n"; |
78 | readMail(); | 78 | readMail(); |
79 | lineShift = "\r\n"; | 79 | lineShift = "\r\n"; |
80 | 80 | ||
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | EmailClient::~EmailClient() | 84 | EmailClient::~EmailClient() |
85 | { | 85 | { |
86 | //needs to be moved from destructor to closewindow event | 86 | //needs to be moved from destructor to closewindow event |
87 | saveMail(getPath(FALSE) + "inbox.txt", inboxView); | 87 | saveMail(getPath(FALSE) + "inbox.txt", inboxView); |
88 | //does not currently work. Defining outbox in the same | 88 | //does not currently work. Defining outbox in the same |
89 | //format as inbox is not a good solution as they have | 89 | //format as inbox is not a good solution as they have |
90 | //different properties | 90 | //different properties |
91 | saveMail(getPath(FALSE) + "outbox.txt", outboxView); | 91 | saveMail(getPath(FALSE) + "outbox.txt", outboxView); |
92 | saveSettings(); | 92 | saveSettings(); |
93 | 93 | ||
94 | mailconf->write(); | 94 | mailconf->write(); |
95 | delete mailconf; | 95 | delete mailconf; |
96 | 96 | ||
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"), QPixmap("getmail.xpm"), 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"), QPixmap("sendmail.xpm"), 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("reset"), 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 QTabWidget( 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->insertTab( widget, 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->insertTab( widget_2, 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 | ||
259 | void EmailClient::setMailAccount() | 259 | void EmailClient::setMailAccount() |
260 | { | 260 | { |
261 | emailHandler->setAccount(*currentAccount); | 261 | emailHandler->setAccount(*currentAccount); |
262 | } | 262 | } |
263 | 263 | ||
264 | void EmailClient::mailSent() | 264 | void EmailClient::mailSent() |
265 | { | 265 | { |
266 | sending = FALSE; | 266 | sending = FALSE; |
267 | sendMailButton->setEnabled(TRUE); | 267 | sendMailButton->setEnabled(TRUE); |
268 | 268 | ||
269 | quedMessages.clear(); | 269 | quedMessages.clear(); |
270 | outboxView->clear(); //should be moved to an sentBox | 270 | outboxView->clear(); //should be moved to an sentBox |
271 | } | 271 | } |
272 | 272 | ||
273 | void EmailClient::getNewMail() { | 273 | void EmailClient::getNewMail() { |
274 | 274 | ||
275 | if (accountList.count() == 0) { | 275 | if (accountList.count() == 0) { |
276 | QMessageBox::warning(qApp->activeWindow(),"No account selected", | 276 | QMessageBox::warning(qApp->activeWindow(),"No account selected", |
277 | "You must create an account", "OK\n"); | 277 | "You must create an account", "OK\n"); |
278 | return; | 278 | return; |
279 | } | 279 | } |
280 | 280 | ||
281 | setMailAccount(); | 281 | setMailAccount(); |
282 | 282 | ||
283 | receiving = TRUE; | 283 | receiving = TRUE; |
284 | previewingMail = TRUE; | 284 | previewingMail = TRUE; |
285 | getMailButton->setEnabled(FALSE); | 285 | getMailButton->setEnabled(FALSE); |
286 | cancelButton->setEnabled(TRUE); | 286 | cancelButton->setEnabled(TRUE); |
287 | selectAccountMenu->setEnabled(FALSE); | 287 | selectAccountMenu->setEnabled(FALSE); |
288 | 288 | ||
289 | status1Label->setText(currentAccount->accountName + " headers"); | 289 | status1Label->setText(currentAccount->accountName + " headers"); |
290 | progressBar->reset(); | 290 | progressBar->reset(); |
291 | 291 | ||
292 | //get any previous mails not downloaded and add to queue | 292 | //get any previous mails not downloaded and add to queue |
293 | mailDownloadList.clear(); | 293 | mailDownloadList.clear(); |
294 | Email *mailPtr; | 294 | Email *mailPtr; |
295 | item = (EmailListItem *) inboxView->firstChild(); | 295 | item = (EmailListItem *) inboxView->firstChild(); |
296 | while (item != NULL) { | 296 | while (item != NULL) { |
297 | mailPtr = item->getMail(); | 297 | mailPtr = item->getMail(); |
298 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { | 298 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { |
299 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); | 299 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); |
300 | } | 300 | } |
301 | item = (EmailListItem *) item->nextSibling(); | 301 | item = (EmailListItem *) item->nextSibling(); |
302 | } | 302 | } |
303 | 303 | ||
304 | emailHandler->getMailHeaders(); | 304 | emailHandler->getMailHeaders(); |
305 | } | 305 | } |
306 | 306 | ||
307 | void EmailClient::getAllNewMail() | 307 | void EmailClient::getAllNewMail() |
308 | { | 308 | { |
309 | allAccounts = TRUE; | 309 | allAccounts = TRUE; |
310 | currentAccount = accountList.first(); | 310 | currentAccount = accountList.first(); |
311 | getNewMail(); | 311 | getNewMail(); |
312 | } | 312 | } |
313 | 313 | ||
314 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) | 314 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) |
315 | { | 315 | { |
316 | Enclosure *ePtr; | 316 | Enclosure *ePtr; |
317 | Email newMail; | 317 | Email newMail; |
318 | int thisMailId; | 318 | int thisMailId; |
319 | emailHandler->parse(mail.rawMail, lineShift, &newMail); | 319 | emailHandler->parse(mail.rawMail, lineShift, &newMail); |
320 | 320 | ||
321 | mailconf->setGroup(newMail.id); | 321 | mailconf->setGroup(newMail.id); |
322 | 322 | ||
323 | if (fromDisk) { | 323 | if (fromDisk) { |
324 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); | 324 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); |
325 | newMail.size = mailconf->readNumEntry("size"); | 325 | newMail.size = mailconf->readNumEntry("size"); |
326 | newMail.serverId = mailconf->readNumEntry("serverid"); | 326 | newMail.serverId = mailconf->readNumEntry("serverid"); |
327 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); | 327 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); |
328 | } else { //mail arrived from server | 328 | } else { //mail arrived from server |
329 | newMail.serverId = mail.serverId; | 329 | newMail.serverId = mail.serverId; |
330 | newMail.size = mail.size; | 330 | newMail.size = mail.size; |
331 | newMail.downloaded = mail.downloaded; | 331 | newMail.downloaded = mail.downloaded; |
332 | 332 | ||
333 | newMail.fromAccountId = currentAccount->id; | 333 | newMail.fromAccountId = currentAccount->id; |
334 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); | 334 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); |
335 | } | 335 | } |
336 | 336 | ||
337 | //add if read or not | 337 | //add if read or not |
338 | newMail.read = mailconf->readBoolEntry("mailread"); | 338 | newMail.read = mailconf->readBoolEntry("mailread"); |
339 | 339 | ||
340 | //check if new mail | 340 | //check if new mail |
341 | if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { | 341 | if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { |
342 | thisMailId = mailIdCount; | 342 | thisMailId = mailIdCount; |
343 | mailIdCount++; | 343 | mailIdCount++; |
diff --git a/noncore/net/mailit/getmail.xpm b/noncore/net/mailit/getmail.xpm deleted file mode 100644 index d294656..0000000 --- a/noncore/net/mailit/getmail.xpm +++ b/dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char*getmail[]={ | ||
3 | "16 13 5 1", | ||
4 | "# c #040404", | ||
5 | "a c #c3c3c3", | ||
6 | "c c #000000", | ||
7 | ". c None", | ||
8 | "b c #ffffff", | ||
9 | ".........###....", | ||
10 | "........#...#.#.", | ||
11 | ".............##.", | ||
12 | "............###.", | ||
13 | "................", | ||
14 | "..............aa", | ||
15 | ".bbbbbbbbbbbbbba", | ||
16 | ".bbbcbbcbbbcccba", | ||
17 | ".bbcbccbbbbcbcba", | ||
18 | ".bbbbbbbbbbcccba", | ||
19 | ".bbcbcccbbbbbbba", | ||
20 | ".bbbcbbbbbbbbbba", | ||
21 | ".bbbbbbbbbbbbbba"}; | ||
diff --git a/noncore/net/mailit/sendmail.xpm b/noncore/net/mailit/sendmail.xpm deleted file mode 100644 index 2803793..0000000 --- a/noncore/net/mailit/sendmail.xpm +++ b/dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char*sendmail[]={ | ||
3 | "16 13 4 1", | ||
4 | "a c #c3c3c3", | ||
5 | "# c #000000", | ||
6 | ". c None", | ||
7 | "b c #ffffff", | ||
8 | ".....#####aaa...", | ||
9 | "....####aaaaa.a.", | ||
10 | "....#.###...aaa.", | ||
11 | "....#..###..aaa.", | ||
12 | ".......###......", | ||
13 | "..............aa", | ||
14 | ".bbbbbbbbbbbbbba", | ||
15 | ".bbb#bb#bbb###ba", | ||
16 | ".bb#b##bbbb#b#ba", | ||
17 | ".bbbbbbbbbb###ba", | ||
18 | ".bb#b###bbbbbbba", | ||
19 | ".bbb#bbbbbbbbbba", | ||
20 | ".bbbbbbbbbbbbbba"}; | ||
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 7ba5c75..2e82623 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -1,343 +1,343 @@ | |||
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 <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <qfile.h> | 22 | #include <qfile.h> |
23 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
24 | #include <qmenubar.h> | 24 | #include <qmenubar.h> |
25 | #include <qaction.h> | 25 | #include <qaction.h> |
26 | #include "resource.h" | 26 | #include "resource.h" |
27 | #include "emailclient.h" | 27 | #include "emailclient.h" |
28 | 28 | ||
29 | QCollection::Item AccountList::newItem(QCollection::Item d) | 29 | QCollection::Item AccountList::newItem(QCollection::Item d) |
30 | { | 30 | { |
31 | return dupl( (MailAccount *) d); | 31 | return dupl( (MailAccount *) d); |
32 | } | 32 | } |
33 | 33 | ||
34 | MailAccount* AccountList::dupl(MailAccount *in) | 34 | MailAccount* AccountList::dupl(MailAccount *in) |
35 | { | 35 | { |
36 | ac = new MailAccount(*in); | 36 | ac = new MailAccount(*in); |
37 | return ac; | 37 | return ac; |
38 | } | 38 | } |
39 | 39 | ||
40 | EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | 40 | EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) |
41 | : QMainWindow( parent, name, fl ) | 41 | : QMainWindow( parent, name, fl ) |
42 | { | 42 | { |
43 | emailHandler = new EmailHandler(); | 43 | emailHandler = new EmailHandler(); |
44 | addressList = new AddressList( getPath(FALSE) + "mail_adr"); | 44 | addressList = new AddressList( getPath(FALSE) + "mail_adr"); |
45 | 45 | ||
46 | sending = FALSE; | 46 | sending = FALSE; |
47 | receiving = FALSE; | 47 | receiving = FALSE; |
48 | previewingMail = FALSE; | 48 | previewingMail = FALSE; |
49 | mailIdCount = 1; | 49 | mailIdCount = 1; |
50 | accountIdCount = 1; | 50 | accountIdCount = 1; |
51 | allAccounts = FALSE; | 51 | allAccounts = FALSE; |
52 | 52 | ||
53 | init(); | 53 | init(); |
54 | 54 | ||
55 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); | 55 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); |
56 | 56 | ||
57 | connect(emailHandler, SIGNAL(smtpError(int)), this, | 57 | connect(emailHandler, SIGNAL(smtpError(int)), this, |
58 | SLOT(smtpError(int)) ); | 58 | SLOT(smtpError(int)) ); |
59 | connect(emailHandler, SIGNAL(popError(int)), this, | 59 | connect(emailHandler, SIGNAL(popError(int)), this, |
60 | SLOT(popError(int)) ); | 60 | SLOT(popError(int)) ); |
61 | 61 | ||
62 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); | 62 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); |
63 | connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); | 63 | connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); |
64 | 64 | ||
65 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, | 65 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, |
66 | SLOT(mailArrived(const Email &, bool)) ); | 66 | SLOT(mailArrived(const Email &, bool)) ); |
67 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, | 67 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, |
68 | SLOT(allMailArrived(int)) ); | 68 | SLOT(allMailArrived(int)) ); |
69 | 69 | ||
70 | mailconf = new Config("mailit"); | 70 | mailconf = new Config("mailit"); |
71 | //In case Synchronize is not defined in settings.txt | 71 | //In case Synchronize is not defined in settings.txt |
72 | 72 | ||
73 | readSettings(); | 73 | readSettings(); |
74 | 74 | ||
75 | updateAccounts(); | 75 | updateAccounts(); |
76 | 76 | ||
77 | lineShift = "\n"; | 77 | lineShift = "\n"; |
78 | readMail(); | 78 | readMail(); |
79 | lineShift = "\r\n"; | 79 | lineShift = "\r\n"; |
80 | 80 | ||
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | EmailClient::~EmailClient() | 84 | EmailClient::~EmailClient() |
85 | { | 85 | { |
86 | //needs to be moved from destructor to closewindow event | 86 | //needs to be moved from destructor to closewindow event |
87 | saveMail(getPath(FALSE) + "inbox.txt", inboxView); | 87 | saveMail(getPath(FALSE) + "inbox.txt", inboxView); |
88 | //does not currently work. Defining outbox in the same | 88 | //does not currently work. Defining outbox in the same |
89 | //format as inbox is not a good solution as they have | 89 | //format as inbox is not a good solution as they have |
90 | //different properties | 90 | //different properties |
91 | saveMail(getPath(FALSE) + "outbox.txt", outboxView); | 91 | saveMail(getPath(FALSE) + "outbox.txt", outboxView); |
92 | saveSettings(); | 92 | saveSettings(); |
93 | 93 | ||
94 | mailconf->write(); | 94 | mailconf->write(); |
95 | delete mailconf; | 95 | delete mailconf; |
96 | 96 | ||
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"), QPixmap("getmail.xpm"), 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"), QPixmap("sendmail.xpm"), 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("reset"), 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 QTabWidget( 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->insertTab( widget, 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->insertTab( widget_2, 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 | ||
259 | void EmailClient::setMailAccount() | 259 | void EmailClient::setMailAccount() |
260 | { | 260 | { |
261 | emailHandler->setAccount(*currentAccount); | 261 | emailHandler->setAccount(*currentAccount); |
262 | } | 262 | } |
263 | 263 | ||
264 | void EmailClient::mailSent() | 264 | void EmailClient::mailSent() |
265 | { | 265 | { |
266 | sending = FALSE; | 266 | sending = FALSE; |
267 | sendMailButton->setEnabled(TRUE); | 267 | sendMailButton->setEnabled(TRUE); |
268 | 268 | ||
269 | quedMessages.clear(); | 269 | quedMessages.clear(); |
270 | outboxView->clear(); //should be moved to an sentBox | 270 | outboxView->clear(); //should be moved to an sentBox |
271 | } | 271 | } |
272 | 272 | ||
273 | void EmailClient::getNewMail() { | 273 | void EmailClient::getNewMail() { |
274 | 274 | ||
275 | if (accountList.count() == 0) { | 275 | if (accountList.count() == 0) { |
276 | QMessageBox::warning(qApp->activeWindow(),"No account selected", | 276 | QMessageBox::warning(qApp->activeWindow(),"No account selected", |
277 | "You must create an account", "OK\n"); | 277 | "You must create an account", "OK\n"); |
278 | return; | 278 | return; |
279 | } | 279 | } |
280 | 280 | ||
281 | setMailAccount(); | 281 | setMailAccount(); |
282 | 282 | ||
283 | receiving = TRUE; | 283 | receiving = TRUE; |
284 | previewingMail = TRUE; | 284 | previewingMail = TRUE; |
285 | getMailButton->setEnabled(FALSE); | 285 | getMailButton->setEnabled(FALSE); |
286 | cancelButton->setEnabled(TRUE); | 286 | cancelButton->setEnabled(TRUE); |
287 | selectAccountMenu->setEnabled(FALSE); | 287 | selectAccountMenu->setEnabled(FALSE); |
288 | 288 | ||
289 | status1Label->setText(currentAccount->accountName + " headers"); | 289 | status1Label->setText(currentAccount->accountName + " headers"); |
290 | progressBar->reset(); | 290 | progressBar->reset(); |
291 | 291 | ||
292 | //get any previous mails not downloaded and add to queue | 292 | //get any previous mails not downloaded and add to queue |
293 | mailDownloadList.clear(); | 293 | mailDownloadList.clear(); |
294 | Email *mailPtr; | 294 | Email *mailPtr; |
295 | item = (EmailListItem *) inboxView->firstChild(); | 295 | item = (EmailListItem *) inboxView->firstChild(); |
296 | while (item != NULL) { | 296 | while (item != NULL) { |
297 | mailPtr = item->getMail(); | 297 | mailPtr = item->getMail(); |
298 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { | 298 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { |
299 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); | 299 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); |
300 | } | 300 | } |
301 | item = (EmailListItem *) item->nextSibling(); | 301 | item = (EmailListItem *) item->nextSibling(); |
302 | } | 302 | } |
303 | 303 | ||
304 | emailHandler->getMailHeaders(); | 304 | emailHandler->getMailHeaders(); |
305 | } | 305 | } |
306 | 306 | ||
307 | void EmailClient::getAllNewMail() | 307 | void EmailClient::getAllNewMail() |
308 | { | 308 | { |
309 | allAccounts = TRUE; | 309 | allAccounts = TRUE; |
310 | currentAccount = accountList.first(); | 310 | currentAccount = accountList.first(); |
311 | getNewMail(); | 311 | getNewMail(); |
312 | } | 312 | } |
313 | 313 | ||
314 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) | 314 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) |
315 | { | 315 | { |
316 | Enclosure *ePtr; | 316 | Enclosure *ePtr; |
317 | Email newMail; | 317 | Email newMail; |
318 | int thisMailId; | 318 | int thisMailId; |
319 | emailHandler->parse(mail.rawMail, lineShift, &newMail); | 319 | emailHandler->parse(mail.rawMail, lineShift, &newMail); |
320 | 320 | ||
321 | mailconf->setGroup(newMail.id); | 321 | mailconf->setGroup(newMail.id); |
322 | 322 | ||
323 | if (fromDisk) { | 323 | if (fromDisk) { |
324 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); | 324 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); |
325 | newMail.size = mailconf->readNumEntry("size"); | 325 | newMail.size = mailconf->readNumEntry("size"); |
326 | newMail.serverId = mailconf->readNumEntry("serverid"); | 326 | newMail.serverId = mailconf->readNumEntry("serverid"); |
327 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); | 327 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); |
328 | } else { //mail arrived from server | 328 | } else { //mail arrived from server |
329 | newMail.serverId = mail.serverId; | 329 | newMail.serverId = mail.serverId; |
330 | newMail.size = mail.size; | 330 | newMail.size = mail.size; |
331 | newMail.downloaded = mail.downloaded; | 331 | newMail.downloaded = mail.downloaded; |
332 | 332 | ||
333 | newMail.fromAccountId = currentAccount->id; | 333 | newMail.fromAccountId = currentAccount->id; |
334 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); | 334 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); |
335 | } | 335 | } |
336 | 336 | ||
337 | //add if read or not | 337 | //add if read or not |
338 | newMail.read = mailconf->readBoolEntry("mailread"); | 338 | newMail.read = mailconf->readBoolEntry("mailread"); |
339 | 339 | ||
340 | //check if new mail | 340 | //check if new mail |
341 | if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { | 341 | if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { |
342 | thisMailId = mailIdCount; | 342 | thisMailId = mailIdCount; |
343 | mailIdCount++; | 343 | mailIdCount++; |
diff --git a/noncore/unsupported/mailit/getmail.xpm b/noncore/unsupported/mailit/getmail.xpm deleted file mode 100644 index d294656..0000000 --- a/noncore/unsupported/mailit/getmail.xpm +++ b/dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char*getmail[]={ | ||
3 | "16 13 5 1", | ||
4 | "# c #040404", | ||
5 | "a c #c3c3c3", | ||
6 | "c c #000000", | ||
7 | ". c None", | ||
8 | "b c #ffffff", | ||
9 | ".........###....", | ||
10 | "........#...#.#.", | ||
11 | ".............##.", | ||
12 | "............###.", | ||
13 | "................", | ||
14 | "..............aa", | ||
15 | ".bbbbbbbbbbbbbba", | ||
16 | ".bbbcbbcbbbcccba", | ||
17 | ".bbcbccbbbbcbcba", | ||
18 | ".bbbbbbbbbbcccba", | ||
19 | ".bbcbcccbbbbbbba", | ||
20 | ".bbbcbbbbbbbbbba", | ||
21 | ".bbbbbbbbbbbbbba"}; | ||
diff --git a/noncore/unsupported/mailit/sendmail.xpm b/noncore/unsupported/mailit/sendmail.xpm deleted file mode 100644 index 2803793..0000000 --- a/noncore/unsupported/mailit/sendmail.xpm +++ b/dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char*sendmail[]={ | ||
3 | "16 13 4 1", | ||
4 | "a c #c3c3c3", | ||
5 | "# c #000000", | ||
6 | ". c None", | ||
7 | "b c #ffffff", | ||
8 | ".....#####aaa...", | ||
9 | "....####aaaaa.a.", | ||
10 | "....#.###...aaa.", | ||
11 | "....#..###..aaa.", | ||
12 | ".......###......", | ||
13 | "..............aa", | ||
14 | ".bbbbbbbbbbbbbba", | ||
15 | ".bbb#bb#bbb###ba", | ||
16 | ".bb#b##bbbb#b#ba", | ||
17 | ".bbbbbbbbbb###ba", | ||
18 | ".bb#b###bbbbbbba", | ||
19 | ".bbb#bbbbbbbbbba", | ||
20 | ".bbbbbbbbbbbbbba"}; | ||