author | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
commit | b6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff) | |
tree | d3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/unsupported/mailit/emailclient.cpp | |
parent | 0d59c780513da78033f4d9040475dee9db0256d4 (diff) | |
download | opie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2 |
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/unsupported/mailit/emailclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 8359acf..86c7987 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -1,319 +1,319 @@ | |||
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 <qvbox.h> | 22 | #include <qvbox.h> |
23 | #include <qfile.h> | 23 | #include <qfile.h> |
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qmenubar.h> | 25 | #include <qmenubar.h> |
26 | #include <qaction.h> | 26 | #include <qaction.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include "emailclient.h" | 29 | #include "emailclient.h" |
30 | #include "writemail.h" | 30 | #include "writemail.h" |
31 | 31 | ||
32 | QCollection::Item AccountList::newItem(QCollection::Item d) | 32 | QCollection::Item AccountList::newItem(QCollection::Item d) |
33 | { | 33 | { |
34 | return dupl( (MailAccount *) d); | 34 | return dupl( (MailAccount *) d); |
35 | } | 35 | } |
36 | 36 | ||
37 | MailAccount* AccountList::dupl(MailAccount *in) | 37 | MailAccount* AccountList::dupl(MailAccount *in) |
38 | { | 38 | { |
39 | ac = new MailAccount(*in); | 39 | ac = new MailAccount(*in); |
40 | return ac; | 40 | return ac; |
41 | } | 41 | } |
42 | 42 | ||
43 | EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | 43 | EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) |
44 | : QMainWindow( parent, name, fl ) | 44 | : QMainWindow( parent, name, fl ) |
45 | { | 45 | { |
46 | emailHandler = new EmailHandler(); | 46 | emailHandler = new EmailHandler(); |
47 | addressList = new AddressList(); | 47 | addressList = new AddressList(); |
48 | 48 | ||
49 | sending = FALSE; | 49 | sending = FALSE; |
50 | receiving = FALSE; | 50 | receiving = FALSE; |
51 | previewingMail = FALSE; | 51 | previewingMail = FALSE; |
52 | mailIdCount = 1; | 52 | mailIdCount = 1; |
53 | accountIdCount = 1; | 53 | accountIdCount = 1; |
54 | allAccounts = FALSE; | 54 | allAccounts = FALSE; |
55 | 55 | ||
56 | init(); | 56 | init(); |
57 | 57 | ||
58 | 58 | ||
59 | 59 | ||
60 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); | 60 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); |
61 | 61 | ||
62 | connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, | 62 | connect(emailHandler, SIGNAL(smtpError(int,const QString&)), this, |
63 | SLOT(smtpError(int,const QString &)) ); | 63 | SLOT(smtpError(int,const QString&)) ); |
64 | connect(emailHandler, SIGNAL(popError(int,const QString &)), this, | 64 | connect(emailHandler, SIGNAL(popError(int,const QString&)), this, |
65 | SLOT(popError(int,const QString &)) ); | 65 | SLOT(popError(int,const QString&)) ); |
66 | 66 | ||
67 | connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); | 67 | connect(inboxView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(inboxItemSelected()) ); |
68 | connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); | 68 | connect(outboxView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(outboxItemSelected()) ); |
69 | 69 | ||
70 | connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); | 70 | connect(inboxView, SIGNAL(pressed(QListViewItem*)), this, SLOT(inboxItemPressed()) ); |
71 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); | 71 | connect(inboxView, SIGNAL(clicked(QListViewItem*)), this, SLOT(inboxItemReleased()) ); |
72 | 72 | ||
73 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, | 73 | connect(emailHandler, SIGNAL(mailArrived(const Email&,bool)), this, |
74 | SLOT(mailArrived(const Email &, bool)) ); | 74 | SLOT(mailArrived(const Email&,bool)) ); |
75 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, | 75 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, |
76 | SLOT(allMailArrived(int)) ); | 76 | SLOT(allMailArrived(int)) ); |
77 | 77 | ||
78 | mailconf = new Config("mailit"); | 78 | mailconf = new Config("mailit"); |
79 | //In case Synchronize is not defined in settings.txt | 79 | //In case Synchronize is not defined in settings.txt |
80 | 80 | ||
81 | readSettings(); | 81 | readSettings(); |
82 | 82 | ||
83 | updateAccounts(); | 83 | updateAccounts(); |
84 | 84 | ||
85 | lineShift = "\n"; | 85 | lineShift = "\n"; |
86 | readMail(); | 86 | readMail(); |
87 | lineShift = "\r\n"; | 87 | lineShift = "\r\n"; |
88 | 88 | ||
89 | mailboxView->setCurrentTab(0); //ensure that inbox has focus | 89 | mailboxView->setCurrentTab(0); //ensure that inbox has focus |
90 | 90 | ||
91 | /*channel = new QCopChannel( "QPE/Application/mailit", this ); | 91 | /*channel = new QCopChannel( "QPE/Application/mailit", this ); |
92 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 92 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
93 | this, SLOT(receive(const QCString&, const QByteArray&)) );*/ | 93 | this, SLOT(receive(const QCString&,const QByteArray&)) );*/ |
94 | 94 | ||
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | EmailClient::~EmailClient() | 98 | EmailClient::~EmailClient() |
99 | { | 99 | { |
100 | //needs to be moved from destructor to closewindow event | 100 | //needs to be moved from destructor to closewindow event |
101 | saveMail(getPath(FALSE) + "inbox.txt", inboxView); | 101 | saveMail(getPath(FALSE) + "inbox.txt", inboxView); |
102 | //does not currently work. Defining outbox in the same | 102 | //does not currently work. Defining outbox in the same |
103 | //format as inbox is not a good solution as they have | 103 | //format as inbox is not a good solution as they have |
104 | //different properties | 104 | //different properties |
105 | saveMail(getPath(FALSE) + "outbox.txt", outboxView); | 105 | saveMail(getPath(FALSE) + "outbox.txt", outboxView); |
106 | saveSettings(); | 106 | saveSettings(); |
107 | 107 | ||
108 | mailconf->write(); | 108 | mailconf->write(); |
109 | delete mailconf; | 109 | delete mailconf; |
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | void EmailClient::init() | 113 | void EmailClient::init() |
114 | { | 114 | { |
115 | initStatusBar(this); | 115 | initStatusBar(this); |
116 | 116 | ||
117 | setToolBarsMovable(FALSE); | 117 | setToolBarsMovable(FALSE); |
118 | 118 | ||
119 | bar = new QToolBar(this); | 119 | bar = new QToolBar(this); |
120 | QWhatsThis::add(bar,tr("Main operation toolbar")); | 120 | QWhatsThis::add(bar,tr("Main operation toolbar")); |
121 | bar->setHorizontalStretchable( TRUE ); | 121 | bar->setHorizontalStretchable( TRUE ); |
122 | 122 | ||
123 | mb = new QMenuBar( bar ); | 123 | mb = new QMenuBar( bar ); |
124 | 124 | ||
125 | QPopupMenu *mail = new QPopupMenu(mb); | 125 | QPopupMenu *mail = new QPopupMenu(mb); |
126 | mb->insertItem( tr( "&Mail" ), mail); | 126 | mb->insertItem( tr( "&Mail" ), mail); |
127 | 127 | ||
128 | QPopupMenu *configure = new QPopupMenu(mb); | 128 | QPopupMenu *configure = new QPopupMenu(mb); |
129 | mb->insertItem( tr( "Accounts" ), configure); | 129 | mb->insertItem( tr( "Accounts" ), configure); |
130 | 130 | ||
131 | selectAccountMenu = new QPopupMenu(mb); | 131 | selectAccountMenu = new QPopupMenu(mb); |
132 | editAccountMenu = new QPopupMenu(mb); | 132 | editAccountMenu = new QPopupMenu(mb); |
133 | deleteAccountMenu = new QPopupMenu(mb); | 133 | deleteAccountMenu = new QPopupMenu(mb); |
134 | 134 | ||
135 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); | 135 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); |
136 | configure->insertItem(tr("Edit account"), editAccountMenu); | 136 | configure->insertItem(tr("Edit account"), editAccountMenu); |
137 | configure->insertItem(tr("Delete account"), deleteAccountMenu); | 137 | configure->insertItem(tr("Delete account"), deleteAccountMenu); |
138 | 138 | ||
139 | bar = new QToolBar(this); | 139 | bar = new QToolBar(this); |
140 | 140 | ||
141 | getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); | 141 | getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); |
142 | QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account.")); | 142 | QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account.")); |
143 | 143 | ||
144 | getMailButton->setPopup(selectAccountMenu); | 144 | getMailButton->setPopup(selectAccountMenu); |
145 | 145 | ||
146 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); | 146 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); |
147 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); | 147 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); |
148 | sendMailButton->addTo(bar); | 148 | sendMailButton->addTo(bar); |
149 | sendMailButton->addTo(mail); | 149 | sendMailButton->addTo(mail); |
150 | sendMailButton->setWhatsThis("Send mail queued in the outbox"); | 150 | sendMailButton->setWhatsThis("Send mail queued in the outbox"); |
151 | 151 | ||
152 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 152 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
153 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); | 153 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); |
154 | composeButton->addTo(bar); | 154 | composeButton->addTo(bar); |
155 | composeButton->addTo(mail); | 155 | composeButton->addTo(mail); |
156 | composeButton->setWhatsThis("Compose a new mail"); | 156 | composeButton->setWhatsThis("Compose a new mail"); |
157 | 157 | ||
158 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); | 158 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); |
159 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); | 159 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); |
160 | cancelButton->addTo(mail); | 160 | cancelButton->addTo(mail); |
161 | cancelButton->addTo(bar); | 161 | cancelButton->addTo(bar); |
162 | cancelButton->setEnabled(FALSE); | 162 | cancelButton->setEnabled(FALSE); |
163 | cancelButton->setWhatsThis("Stop the currently active mail transfer"); | 163 | cancelButton->setWhatsThis("Stop the currently active mail transfer"); |
164 | 164 | ||
165 | 165 | ||
166 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | 166 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); |
167 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | 167 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); |
168 | deleteButton->addTo(bar); | 168 | deleteButton->addTo(bar); |
169 | deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); | 169 | deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); |
170 | 170 | ||
171 | mailboxView = new OTabWidget( this, "mailboxView" ); | 171 | mailboxView = new OTabWidget( this, "mailboxView" ); |
172 | 172 | ||
173 | QWidget* widget = new QWidget( mailboxView, "widget" ); | 173 | QWidget* widget = new QWidget( mailboxView, "widget" ); |
174 | grid_2 = new QGridLayout( widget ); | 174 | grid_2 = new QGridLayout( widget ); |
175 | // grid_2->setSpacing(6); | 175 | // grid_2->setSpacing(6); |
176 | // grid_2->setMargin( 11 ); | 176 | // grid_2->setMargin( 11 ); |
177 | 177 | ||
178 | inboxView = new QListView( widget, "inboxView" ); | 178 | inboxView = new QListView( widget, "inboxView" ); |
179 | inboxView->addColumn( tr( "From" ) ); | 179 | inboxView->addColumn( tr( "From" ) ); |
180 | inboxView->addColumn( tr( "Subject" ) ); | 180 | inboxView->addColumn( tr( "Subject" ) ); |
181 | inboxView->addColumn( tr( "Date" ) ); | 181 | inboxView->addColumn( tr( "Date" ) ); |
182 | inboxView->setMinimumSize( QSize( 0, 0 ) ); | 182 | inboxView->setMinimumSize( QSize( 0, 0 ) ); |
183 | inboxView->setAllColumnsShowFocus(TRUE); | 183 | inboxView->setAllColumnsShowFocus(TRUE); |
184 | QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n" | 184 | QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n" |
185 | "It keeps the fetched mail which can be \n" | 185 | "It keeps the fetched mail which can be \n" |
186 | "viewed by double clicking the entry.\n" | 186 | "viewed by double clicking the entry.\n" |
187 | "blue attachment icon shows whether this \n" | 187 | "blue attachment icon shows whether this \n" |
188 | "mailhas attachments.\n")); | 188 | "mailhas attachments.\n")); |
189 | 189 | ||
190 | grid_2->addWidget( inboxView, 2, 0 ); | 190 | grid_2->addWidget( inboxView, 2, 0 ); |
191 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); | 191 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); |
192 | 192 | ||
193 | QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); | 193 | QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); |
194 | grid_3 = new QGridLayout( widget_2 ); | 194 | grid_3 = new QGridLayout( widget_2 ); |
195 | // grid_3->setSpacing(6); | 195 | // grid_3->setSpacing(6); |
196 | // grid_3->setMargin( 11 ); | 196 | // grid_3->setMargin( 11 ); |
197 | 197 | ||
198 | outboxView = new QListView( widget_2, "outboxView" ); | 198 | outboxView = new QListView( widget_2, "outboxView" ); |
199 | outboxView->addColumn( tr( "To" ) ); | 199 | outboxView->addColumn( tr( "To" ) ); |
200 | outboxView->addColumn( tr( "Subject" ) ); | 200 | outboxView->addColumn( tr( "Subject" ) ); |
201 | outboxView->setAllColumnsShowFocus(TRUE); | 201 | outboxView->setAllColumnsShowFocus(TRUE); |
202 | 202 | ||
203 | QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" | 203 | QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" |
204 | "It keeps the queued mails to send which can be \n" | 204 | "It keeps the queued mails to send which can be \n" |
205 | "reviewed by double clicking the entry.")); | 205 | "reviewed by double clicking the entry.")); |
206 | grid_3->addWidget( outboxView, 0, 0 ); | 206 | grid_3->addWidget( outboxView, 0, 0 ); |
207 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); | 207 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); |
208 | 208 | ||
209 | setCentralWidget(mailboxView); | 209 | setCentralWidget(mailboxView); |
210 | 210 | ||
211 | } | 211 | } |
212 | 212 | ||
213 | void EmailClient::initStatusBar(QWidget* parent) | 213 | void EmailClient::initStatusBar(QWidget* parent) |
214 | { | 214 | { |
215 | statusBar = new QStatusBar(parent); | 215 | statusBar = new QStatusBar(parent); |
216 | statusBar->setSizeGripEnabled(FALSE); | 216 | statusBar->setSizeGripEnabled(FALSE); |
217 | 217 | ||
218 | status1Label = new QLabel( tr("Idle"), statusBar); | 218 | status1Label = new QLabel( tr("Idle"), statusBar); |
219 | status2Label = new QLabel("", statusBar); | 219 | status2Label = new QLabel("", statusBar); |
220 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), | 220 | connect(emailHandler, SIGNAL(updatePopStatus(const QString&)), |
221 | status2Label, SLOT(setText(const QString &)) ); | 221 | status2Label, SLOT(setText(const QString&)) ); |
222 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), | 222 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString&)), |
223 | status2Label, SLOT(setText(const QString &)) ); | 223 | status2Label, SLOT(setText(const QString&)) ); |
224 | 224 | ||
225 | progressBar = new QProgressBar(statusBar); | 225 | progressBar = new QProgressBar(statusBar); |
226 | 226 | ||
227 | connect(emailHandler, SIGNAL(mailboxSize(int)), | 227 | connect(emailHandler, SIGNAL(mailboxSize(int)), |
228 | this, SLOT(setTotalSize(int)) ); | 228 | this, SLOT(setTotalSize(int)) ); |
229 | connect(emailHandler, SIGNAL(currentMailSize(int)), | 229 | connect(emailHandler, SIGNAL(currentMailSize(int)), |
230 | this, SLOT(setMailSize(int)) ); | 230 | this, SLOT(setMailSize(int)) ); |
231 | connect(emailHandler, SIGNAL(downloadedSize(int)), | 231 | connect(emailHandler, SIGNAL(downloadedSize(int)), |
232 | this, SLOT(setDownloadedSize(int)) ); | 232 | this, SLOT(setDownloadedSize(int)) ); |
233 | 233 | ||
234 | statusBar->addWidget(status1Label); | 234 | statusBar->addWidget(status1Label); |
235 | statusBar->addWidget(progressBar); | 235 | statusBar->addWidget(progressBar); |
236 | statusBar->addWidget(status2Label); | 236 | statusBar->addWidget(status2Label); |
237 | 237 | ||
238 | } | 238 | } |
239 | 239 | ||
240 | void EmailClient::compose() | 240 | void EmailClient::compose() |
241 | { | 241 | { |
242 | emit composeRequested(); | 242 | emit composeRequested(); |
243 | } | 243 | } |
244 | 244 | ||
245 | void EmailClient::cancel() | 245 | void EmailClient::cancel() |
246 | { | 246 | { |
247 | emailHandler->cancel(); | 247 | emailHandler->cancel(); |
248 | } | 248 | } |
249 | 249 | ||
250 | AddressList* EmailClient::getAdrListRef() | 250 | AddressList* EmailClient::getAdrListRef() |
251 | { | 251 | { |
252 | return addressList; | 252 | return addressList; |
253 | } | 253 | } |
254 | 254 | ||
255 | //this needs to be rewritten to syncronize with outboxView | 255 | //this needs to be rewritten to syncronize with outboxView |
256 | void EmailClient::enqueMail(const Email &mail) | 256 | void EmailClient::enqueMail(const Email &mail) |
257 | { | 257 | { |
258 | if (accountList.count() == 0) { | 258 | if (accountList.count() == 0) { |
259 | QMessageBox::warning(qApp->activeWindow(), | 259 | QMessageBox::warning(qApp->activeWindow(), |
260 | tr("No account selected"), tr("You must create an account"), "OK\n"); | 260 | tr("No account selected"), tr("You must create an account"), "OK\n"); |
261 | return; | 261 | return; |
262 | } | 262 | } |
263 | 263 | ||
264 | if (accountList.count() > 0) { | 264 | if (accountList.count() > 0) { |
265 | currentAccount = accountList.first(); | 265 | currentAccount = accountList.first(); |
266 | qWarning("using account " + currentAccount->name); | 266 | qWarning("using account " + currentAccount->name); |
267 | } | 267 | } |
268 | 268 | ||
269 | Email addMail = mail; | 269 | Email addMail = mail; |
270 | addMail.from = currentAccount->name; | 270 | addMail.from = currentAccount->name; |
271 | addMail.fromMail = currentAccount->emailAddress; | 271 | addMail.fromMail = currentAccount->emailAddress; |
272 | addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n"); | 272 | addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n"); |
273 | item = new EmailListItem(outboxView, addMail, false); | 273 | item = new EmailListItem(outboxView, addMail, false); |
274 | 274 | ||
275 | mailboxView->setCurrentTab(1); | 275 | mailboxView->setCurrentTab(1); |
276 | 276 | ||
277 | } | 277 | } |
278 | 278 | ||
279 | void EmailClient::sendQuedMail() | 279 | void EmailClient::sendQuedMail() |
280 | { | 280 | { |
281 | int count = 0; | 281 | int count = 0; |
282 | 282 | ||
283 | if (accountList.count() == 0) { | 283 | if (accountList.count() == 0) { |
284 | QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n"); | 284 | QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n"); |
285 | return; | 285 | return; |
286 | } | 286 | } |
287 | //traverse listview, find messages to send | 287 | //traverse listview, find messages to send |
288 | if (! sending) { | 288 | if (! sending) { |
289 | item = (EmailListItem *) outboxView->firstChild(); | 289 | item = (EmailListItem *) outboxView->firstChild(); |
290 | if (item != NULL) { | 290 | if (item != NULL) { |
291 | while (item != NULL) { | 291 | while (item != NULL) { |
292 | quedMessages.append(item->getMail()); | 292 | quedMessages.append(item->getMail()); |
293 | item = (EmailListItem *) item->nextSibling(); | 293 | item = (EmailListItem *) item->nextSibling(); |
294 | count++; | 294 | count++; |
295 | } | 295 | } |
296 | setMailAccount(); | 296 | setMailAccount(); |
297 | emailHandler->sendMail(&quedMessages); | 297 | emailHandler->sendMail(&quedMessages); |
298 | sending = TRUE; | 298 | sending = TRUE; |
299 | sendMailButton->setEnabled(FALSE); | 299 | sendMailButton->setEnabled(FALSE); |
300 | cancelButton->setEnabled(TRUE); | 300 | cancelButton->setEnabled(TRUE); |
301 | } else { | 301 | } else { |
302 | qWarning("sendQuedMail(): no messages to send"); | 302 | qWarning("sendQuedMail(): no messages to send"); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | } | 305 | } |
306 | 306 | ||
307 | void EmailClient::setMailAccount() | 307 | void EmailClient::setMailAccount() |
308 | { | 308 | { |
309 | emailHandler->setAccount(*currentAccount); | 309 | emailHandler->setAccount(*currentAccount); |
310 | } | 310 | } |
311 | 311 | ||
312 | void EmailClient::mailSent() | 312 | void EmailClient::mailSent() |
313 | { | 313 | { |
314 | sending = FALSE; | 314 | sending = FALSE; |
315 | sendMailButton->setEnabled(TRUE); | 315 | sendMailButton->setEnabled(TRUE); |
316 | 316 | ||
317 | quedMessages.clear(); | 317 | quedMessages.clear(); |
318 | outboxView->clear(); //should be moved to an sentBox | 318 | outboxView->clear(); //should be moved to an sentBox |
319 | } | 319 | } |