author | conber <conber> | 2002-08-06 16:32:49 (UTC) |
---|---|---|
committer | conber <conber> | 2002-08-06 16:32:49 (UTC) |
commit | 8084d002de5e310491eec7fac0713ef29d0cf30f (patch) (unidiff) | |
tree | fe74e3cf2ee2f7d87e74910fbf4bfa34b9a439a0 | |
parent | e6a512dc2e0602298f8a745036d25eb171ced977 (diff) | |
download | opie-8084d002de5e310491eec7fac0713ef29d0cf30f.zip opie-8084d002de5e310491eec7fac0713ef29d0cf30f.tar.gz opie-8084d002de5e310491eec7fac0713ef29d0cf30f.tar.bz2 |
ui improvements
-rw-r--r-- | noncore/unsupported/mail2/composer.cpp | 18 | ||||
-rw-r--r-- | noncore/unsupported/mail2/composerbase.cpp | 20 | ||||
-rw-r--r-- | noncore/unsupported/mail2/composerbase.h | 6 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mail.pro | 2 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mailstatusbar.cpp | 58 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mailstatusbar.h | 38 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mainwindow.cpp | 20 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mainwindowbase.cpp | 20 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mainwindowbase.h | 8 |
9 files changed, 131 insertions, 59 deletions
diff --git a/noncore/unsupported/mail2/composer.cpp b/noncore/unsupported/mail2/composer.cpp index 52ebbdd..cb80299 100644 --- a/noncore/unsupported/mail2/composer.cpp +++ b/noncore/unsupported/mail2/composer.cpp | |||
@@ -1,389 +1,389 @@ | |||
1 | #include <qmultilineedit.h> | 1 | #include <qmultilineedit.h> |
2 | #include <qmessagebox.h> | 2 | #include <qmessagebox.h> |
3 | #include <qpopupmenu.h> | 3 | #include <qpopupmenu.h> |
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <qaction.h> | 6 | #include <qaction.h> |
7 | #include <qtimer.h> | 7 | #include <qtimer.h> |
8 | #include <qlabel.h> | 8 | #include <qlabel.h> |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | 10 | ||
11 | #include <qpe/resource.h> | 11 | #include <qpe/resource.h> |
12 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
13 | 13 | ||
14 | #include <opie/ofiledialog.h> | 14 | #include <opie/ofiledialog.h> |
15 | //#include "attachdiag.h" | ||
16 | 15 | ||
16 | #include "mailstatusbar.h" | ||
17 | #include "addresspicker.h" | 17 | #include "addresspicker.h" |
18 | #include "listviewplus.h" | 18 | #include "listviewplus.h" |
19 | #include "smtphandler.h" | 19 | #include "smtphandler.h" |
20 | #include "composer.h" | 20 | #include "composer.h" |
21 | #include "rename.h" | 21 | #include "rename.h" |
22 | 22 | ||
23 | AttachViewItem::AttachViewItem(QListView *parent, Attachment &attachment) | 23 | AttachViewItem::AttachViewItem(QListView *parent, Attachment &attachment) |
24 | : QListViewItem(parent), _attachment(attachment) | 24 | : QListViewItem(parent), _attachment(attachment) |
25 | { | 25 | { |
26 | setPixmap(0, _attachment.docLnk().pixmap().isNull() ? Resource::loadPixmap("UnknownDocument-14") : _attachment.docLnk().pixmap()); | 26 | setPixmap(0, _attachment.docLnk().pixmap().isNull() ? Resource::loadPixmap("UnknownDocument-14") : _attachment.docLnk().pixmap()); |
27 | setText(0, _attachment.newName().isEmpty() ? _attachment.fileName() : _attachment.newName()); | 27 | setText(0, _attachment.newName().isEmpty() ? _attachment.fileName() : _attachment.newName()); |
28 | setText(1, _attachment.description()); | 28 | setText(1, _attachment.description()); |
29 | } | 29 | } |
30 | 30 | ||
31 | Composer::Composer(QWidget *parent, const char *name, WFlags fl, bool sendQueue) | 31 | Composer::Composer(QWidget *parent, const char *name, WFlags fl, bool sendQueue) |
32 | : ComposerBase(parent, name, fl), _inLoop(false) | 32 | : ComposerBase(parent, name, fl), _inLoop(false) |
33 | { | 33 | { |
34 | _sendQueued = sendQueue; | 34 | _sendQueued = sendQueue; |
35 | abort->setEnabled(false); | 35 | status->setStopEnabled(false); |
36 | to->setFocus(); | 36 | to->setFocus(); |
37 | 37 | ||
38 | connect(sendmail, SIGNAL(activated()), SLOT(slotSendMail())); | 38 | connect(sendmail, SIGNAL(activated()), SLOT(slotSendMail())); |
39 | connect(queuemail, SIGNAL(activated()), SLOT(slotQueueMail())); | 39 | connect(queuemail, SIGNAL(activated()), SLOT(slotQueueMail())); |
40 | connect(addressbook, SIGNAL(activated()), SLOT(slotOpenAddressPicker())); | 40 | connect(addressbook, SIGNAL(activated()), SLOT(slotOpenAddressPicker())); |
41 | connect(addattach, SIGNAL(activated()), SLOT(slotAddAttach())); | 41 | connect(addattach, SIGNAL(activated()), SLOT(slotAddAttach())); |
42 | connect(delattach, SIGNAL(activated()), SLOT(slotDelAttach())); | 42 | connect(delattach, SIGNAL(activated()), SLOT(slotDelAttach())); |
43 | 43 | ||
44 | connect(from, SIGNAL(activated(int)), SLOT(slotFromChanged(int))); | 44 | connect(from, SIGNAL(activated(int)), SLOT(slotFromChanged(int))); |
45 | 45 | ||
46 | connect(attachPopup, SIGNAL(activated(int)), SLOT(slotPopupHandler(int))); | 46 | connect(attachPopup, SIGNAL(activated(int)), SLOT(slotPopupHandler(int))); |
47 | 47 | ||
48 | QTimer::singleShot(0, this, SLOT(slotFillStuff())); | 48 | QTimer::singleShot(0, this, SLOT(slotFillStuff())); |
49 | QTimer::singleShot(0, this, SLOT(slotResizing())); | 49 | QTimer::singleShot(0, this, SLOT(slotResizing())); |
50 | 50 | ||
51 | } | 51 | } |
52 | 52 | ||
53 | Composer::~Composer() | 53 | Composer::~Composer() |
54 | { | 54 | { |
55 | hide(); | 55 | hide(); |
56 | } | 56 | } |
57 | 57 | ||
58 | void Composer::hide() | 58 | void Composer::hide() |
59 | { | 59 | { |
60 | QWidget::hide(); | 60 | QWidget::hide(); |
61 | 61 | ||
62 | if (_inLoop) { | 62 | if (_inLoop) { |
63 | _inLoop = false; | 63 | _inLoop = false; |
64 | qApp->exit_loop(); | 64 | qApp->exit_loop(); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | void Composer::exec() | 68 | void Composer::exec() |
69 | { | 69 | { |
70 | show(); | 70 | show(); |
71 | if (!_inLoop) { | 71 | if (!_inLoop) { |
72 | _inLoop = true; | 72 | _inLoop = true; |
73 | qApp->enter_loop(); | 73 | qApp->enter_loop(); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | void Composer::setSendMail(SendMail &sendMail) | 77 | void Composer::setSendMail(SendMail &sendMail) |
78 | { | 78 | { |
79 | to->setText(sendMail.to()); | 79 | to->setText(sendMail.to()); |
80 | cc->setText(sendMail.cc()); | 80 | cc->setText(sendMail.cc()); |
81 | bcc->setText(sendMail.bcc()); | 81 | bcc->setText(sendMail.bcc()); |
82 | subject->setText(sendMail.subject()); | 82 | subject->setText(sendMail.subject()); |
83 | message->setText(sendMail.message()); | 83 | message->setText(sendMail.message()); |
84 | _inReplyTo = sendMail.inReplyTo(); | 84 | _inReplyTo = sendMail.inReplyTo(); |
85 | 85 | ||
86 | QValueList<Attachment> attachments = sendMail.attachments(); | 86 | QValueList<Attachment> attachments = sendMail.attachments(); |
87 | QValueList<Attachment>::Iterator it; | 87 | QValueList<Attachment>::Iterator it; |
88 | for (it = attachments.begin(); it != attachments.end(); it++) { | 88 | for (it = attachments.begin(); it != attachments.end(); it++) { |
89 | (void) new AttachViewItem(attachView, *it); | 89 | (void) new AttachViewItem(attachView, *it); |
90 | if (attachView->isHidden()) attachView->show(); | 90 | if (attachView->isHidden()) attachView->show(); |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | void Composer::slotResizing() | 94 | void Composer::slotResizing() |
95 | { | 95 | { |
96 | from->setMaximumWidth(width() - fromBox->width()); | 96 | from->setMaximumWidth(width() - fromBox->width()); |
97 | from->resize(width() - fromBox->width(), y()); | 97 | from->resize(width() - fromBox->width(), y()); |
98 | if (_sendQueued) slotSendQueued(); | 98 | if (_sendQueued) slotSendQueued(); |
99 | } | 99 | } |
100 | 100 | ||
101 | void Composer::slotPopupHandler(int itemid) | 101 | void Composer::slotPopupHandler(int itemid) |
102 | { | 102 | { |
103 | if (attachView->currentItem() == NULL) { | 103 | if (attachView->currentItem() == NULL) { |
104 | QMessageBox::information(this, tr("Error"), tr("Please select an entry first."), tr("Ok")); | 104 | QMessageBox::information(this, tr("Error"), tr("Please select an entry first."), tr("Ok")); |
105 | return; | 105 | return; |
106 | } | 106 | } |
107 | 107 | ||
108 | if (itemid == POPUP_ATTACH_RENAME) { | 108 | if (itemid == POPUP_ATTACH_RENAME) { |
109 | QString tmp = Rename::rename(attachView->currentItem()->text(0), this); | 109 | QString tmp = Rename::rename(attachView->currentItem()->text(0), this); |
110 | if (tmp != QString(0)) attachView->currentItem()->setText(0, tmp); | 110 | if (tmp != QString(0)) attachView->currentItem()->setText(0, tmp); |
111 | } else if (itemid == POPUP_ATTACH_DESC) { | 111 | } else if (itemid == POPUP_ATTACH_DESC) { |
112 | QString tmp = Rename::getText(tr("Set Description"), tr("<div align=center>Description"), this); | 112 | QString tmp = Rename::getText(tr("Set Description"), tr("<div align=center>Description"), this); |
113 | if (tmp != QString(0)) attachView->currentItem()->setText(1, tmp); | 113 | if (tmp != QString(0)) attachView->currentItem()->setText(1, tmp); |
114 | } else if (itemid == POPUP_ATTACH_REMOVE) { | 114 | } else if (itemid == POPUP_ATTACH_REMOVE) { |
115 | attachView->takeItem(attachView->currentItem()); | 115 | attachView->takeItem(attachView->currentItem()); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | void Composer::slotSendMail() | 119 | void Composer::slotSendMail() |
120 | { | 120 | { |
121 | if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { | 121 | if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { |
122 | QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); | 122 | QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); |
123 | return; | 123 | return; |
124 | } | 124 | } |
125 | 125 | ||
126 | SendMail smail; | 126 | SendMail smail; |
127 | smail.setFrom(from->currentText()); | 127 | smail.setFrom(from->currentText()); |
128 | smail.setReplyTo(replyto->text()); | 128 | smail.setReplyTo(replyto->text()); |
129 | smail.setTo(to->text()); | 129 | smail.setTo(to->text()); |
130 | smail.setCc(cc->text()); | 130 | smail.setCc(cc->text()); |
131 | smail.setBcc(bcc->text()); | 131 | smail.setBcc(bcc->text()); |
132 | smail.setSubject(subject->text()); | 132 | smail.setSubject(subject->text()); |
133 | smail.setMessage(message->text()); | 133 | smail.setMessage(message->text()); |
134 | smail.setNeedsMime(attachView->childCount() == 0 ? false : true); | 134 | smail.setNeedsMime(attachView->childCount() == 0 ? false : true); |
135 | smail.setAccount(accountsLoaded[from->currentItem()]); | 135 | smail.setAccount(accountsLoaded[from->currentItem()]); |
136 | 136 | ||
137 | if (priority->currentItem() == POPUP_PRIO_LOW) { | 137 | if (priority->currentItem() == POPUP_PRIO_LOW) { |
138 | smail.setPriority("Low");// No i18n on purpose | 138 | smail.setPriority("Low");// No i18n on purpose |
139 | } else if (priority->currentItem() == POPUP_PRIO_NORMAL) { | 139 | } else if (priority->currentItem() == POPUP_PRIO_NORMAL) { |
140 | smail.setPriority("Normal");// No i18n on purpose | 140 | smail.setPriority("Normal");// No i18n on purpose |
141 | } else if (priority->currentItem() == POPUP_PRIO_HIGH) { | 141 | } else if (priority->currentItem() == POPUP_PRIO_HIGH) { |
142 | smail.setPriority("High");// No i18n on purpose | 142 | smail.setPriority("High");// No i18n on purpose |
143 | } | 143 | } |
144 | 144 | ||
145 | QValueList<Attachment> attachments; | 145 | QValueList<Attachment> attachments; |
146 | QListViewItem *item; | 146 | QListViewItem *item; |
147 | for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { | 147 | for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { |
148 | attachments.append(((AttachViewItem *)item)->attachment()); | 148 | attachments.append(((AttachViewItem *)item)->attachment()); |
149 | } | 149 | } |
150 | 150 | ||
151 | smail.setAttachments(attachments); | 151 | smail.setAttachments(attachments); |
152 | 152 | ||
153 | QString header, message; | 153 | QString header, message; |
154 | MailFactory::genMail(header, message, smail, this); | 154 | MailFactory::genMail(header, message, smail, this); |
155 | if (header.isNull() || message.isNull()) return;// Aborted. | 155 | if (header.isNull() || message.isNull()) return;// Aborted. |
156 | 156 | ||
157 | abort->setEnabled(true); | 157 | status->setStopEnabled(true); |
158 | 158 | ||
159 | SmtpHandler *handler = new SmtpHandler(header, message, accountsLoaded[from->currentItem()], to->text()); | 159 | SmtpHandler *handler = new SmtpHandler(header, message, accountsLoaded[from->currentItem()], to->text()); |
160 | connect(handler, SIGNAL(finished()), SLOT(slotSendFinished())); | 160 | connect(handler, SIGNAL(finished()), SLOT(slotSendFinished())); |
161 | connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &))); | 161 | connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &))); |
162 | connect(handler, SIGNAL(status(const QString &)), status, SLOT(setText(const QString &))); | 162 | connect(handler, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); |
163 | } | 163 | } |
164 | 164 | ||
165 | void Composer::slotSendQueued() | 165 | void Composer::slotSendQueued() |
166 | { | 166 | { |
167 | int effSendCount = 0; | 167 | int effSendCount = 0; |
168 | qDebug("Sending queued messages"); | 168 | qDebug("Sending queued messages"); |
169 | Config cfg( "mailqueue", Config::User ); | 169 | Config cfg( "mailqueue", Config::User ); |
170 | cfg.setGroup( "Settings" ); | 170 | cfg.setGroup( "Settings" ); |
171 | _sendCount = 0; | 171 | _sendCount = 0; |
172 | _sendError = 0; | 172 | _sendError = 0; |
173 | _toSend = cfg.readNumEntry( "count", 0 ); | 173 | _toSend = cfg.readNumEntry( "count", 0 ); |
174 | 174 | ||
175 | if (_toSend == 0) close(); | 175 | if (_toSend == 0) close(); |
176 | 176 | ||
177 | qDebug("%i messages to send", _toSend); | 177 | qDebug("%i messages to send", _toSend); |
178 | QString str; | 178 | QString str; |
179 | for (int i=1;i<=_toSend;i++) | 179 | for (int i=1;i<=_toSend;i++) |
180 | { | 180 | { |
181 | qDebug("sending message %i",i); | 181 | qDebug("sending message %i",i); |
182 | cfg.setGroup( "Mail_" + QString::number(i) ); | 182 | cfg.setGroup( "Mail_" + QString::number(i) ); |
183 | SendMail smail; | 183 | SendMail smail; |
184 | str = cfg.readEntry("from"); | 184 | str = cfg.readEntry("from"); |
185 | qDebug("setFrom %s",str.latin1()); | 185 | qDebug("setFrom %s",str.latin1()); |
186 | smail.setFrom( str ); | 186 | smail.setFrom( str ); |
187 | str = cfg.readEntry("reply"); | 187 | str = cfg.readEntry("reply"); |
188 | qDebug("setReplyTo %s",str.latin1()); | 188 | qDebug("setReplyTo %s",str.latin1()); |
189 | smail.setReplyTo( str ); | 189 | smail.setReplyTo( str ); |
190 | QString toAdr = cfg.readEntry("to"); | 190 | QString toAdr = cfg.readEntry("to"); |
191 | qDebug("to %s",toAdr.latin1()); | 191 | qDebug("to %s",toAdr.latin1()); |
192 | smail.setTo( toAdr ); //to->text()); | 192 | smail.setTo( toAdr ); //to->text()); |
193 | str = cfg.readEntry("cc"); | 193 | str = cfg.readEntry("cc"); |
194 | qDebug("setCc %s",str.latin1()); | 194 | qDebug("setCc %s",str.latin1()); |
195 | smail.setCc( str ); //cc->text()); | 195 | smail.setCc( str ); //cc->text()); |
196 | smail.setBcc( cfg.readEntry("bcc") ); //bcc->text()); | 196 | smail.setBcc( cfg.readEntry("bcc") ); //bcc->text()); |
197 | str = cfg.readEntry("subject"); | 197 | str = cfg.readEntry("subject"); |
198 | qDebug("setSubject %s",str.latin1()); | 198 | qDebug("setSubject %s",str.latin1()); |
199 | smail.setSubject( str ); //subject->text()); | 199 | smail.setSubject( str ); //subject->text()); |
200 | str = cfg.readEntryCrypt("message"); | 200 | str = cfg.readEntryCrypt("message"); |
201 | qDebug("setMessage %s",str.latin1()); | 201 | qDebug("setMessage %s",str.latin1()); |
202 | smail.setMessage( str ); //message->text()); | 202 | smail.setMessage( str ); //message->text()); |
203 | smail.setNeedsMime( cfg.readBoolEntry("mime") ); //attachView->childCount() == 0 ? false : true); | 203 | smail.setNeedsMime( cfg.readBoolEntry("mime") ); //attachView->childCount() == 0 ? false : true); |
204 | 204 | ||
205 | qDebug("setting account [%i]",cfg.readNumEntry("account")); | 205 | qDebug("setting account [%i]",cfg.readNumEntry("account")); |
206 | Account accnt = accountsLoaded[ cfg.readNumEntry("account") ]; | 206 | Account accnt = accountsLoaded[ cfg.readNumEntry("account") ]; |
207 | smail.setAccount( accnt ); //accountsLoaded[from->currentItem()]); | 207 | smail.setAccount( accnt ); //accountsLoaded[from->currentItem()]); |
208 | 208 | ||
209 | 209 | ||
210 | int prio = cfg.readNumEntry( "priority" ); | 210 | int prio = cfg.readNumEntry( "priority" ); |
211 | qDebug("setting priority %i",prio); | 211 | qDebug("setting priority %i",prio); |
212 | if (prio == POPUP_PRIO_LOW) { | 212 | if (prio == POPUP_PRIO_LOW) { |
213 | smail.setPriority("Low");// No i18n on purpose | 213 | smail.setPriority("Low");// No i18n on purpose |
214 | } else if (prio == POPUP_PRIO_NORMAL) { | 214 | } else if (prio == POPUP_PRIO_NORMAL) { |
215 | smail.setPriority("Normal");// No i18n on purpose | 215 | smail.setPriority("Normal");// No i18n on purpose |
216 | } else if (prio == POPUP_PRIO_HIGH) { | 216 | } else if (prio == POPUP_PRIO_HIGH) { |
217 | smail.setPriority("High");// No i18n on purpose | 217 | smail.setPriority("High");// No i18n on purpose |
218 | } | 218 | } |
219 | 219 | ||
220 | QValueList<Attachment> attachments; | 220 | QValueList<Attachment> attachments; |
221 | Attachment a; | 221 | Attachment a; |
222 | QString an; | 222 | QString an; |
223 | 223 | ||
224 | int ac = cfg.readNumEntry( "attachments", 0 ); | 224 | int ac = cfg.readNumEntry( "attachments", 0 ); |
225 | qDebug("%i Attachments",ac); | 225 | qDebug("%i Attachments",ac); |
226 | for (int j = 0; i < ac; ac++) { | 226 | for (int j = 0; i < ac; ac++) { |
227 | an = "Attachment_" + QString::number( j ); | 227 | an = "Attachment_" + QString::number( j ); |
228 | qDebug(an.latin1()); | 228 | qDebug(an.latin1()); |
229 | a.setFileName(cfg.readEntry( an + "fileName" )); | 229 | a.setFileName(cfg.readEntry( an + "fileName" )); |
230 | a.setNewName(cfg.readEntry( an + "newName" )); | 230 | a.setNewName(cfg.readEntry( an + "newName" )); |
231 | a.setDescription(cfg.readEntry( an + "description" )); | 231 | a.setDescription(cfg.readEntry( an + "description" )); |
232 | a.setDocLnk( DocLnk( cfg.readEntry( an + "docLnk" )) ); | 232 | a.setDocLnk( DocLnk( cfg.readEntry( an + "docLnk" )) ); |
233 | attachments.append( a ); | 233 | attachments.append( a ); |
234 | } | 234 | } |
235 | 235 | ||
236 | smail.setAttachments(attachments); | 236 | smail.setAttachments(attachments); |
237 | 237 | ||
238 | qDebug("putting mail together"); | 238 | qDebug("putting mail together"); |
239 | 239 | ||
240 | QString header, message; | 240 | QString header, message; |
241 | MailFactory::genMail(header, message, smail, this); | 241 | MailFactory::genMail(header, message, smail, this); |
242 | if (header.isNull() || message.isNull()) continue;//return;// Aborted. | 242 | if (header.isNull() || message.isNull()) continue;//return;// Aborted. |
243 | 243 | ||
244 | // abort->setEnabled(true); | 244 | // abort->setEnabled(true); |
245 | 245 | ||
246 | qDebug("Sending to %s",toAdr.latin1()); | 246 | qDebug("Sending to %s",toAdr.latin1()); |
247 | SmtpHandler *handler = new SmtpHandler(header, message, accnt ,toAdr); | 247 | SmtpHandler *handler = new SmtpHandler(header, message, accnt ,toAdr); |
248 | effSendCount++; | 248 | effSendCount++; |
249 | connect(handler, SIGNAL(finished()), SLOT(slotSendQueuedFinished())); | 249 | connect(handler, SIGNAL(finished()), SLOT(slotSendQueuedFinished())); |
250 | connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendQueuedError(const QString &))); | 250 | connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendQueuedError(const QString &))); |
251 | connect(handler, SIGNAL(status(const QString &)), status, SLOT(setText(const QString &))); | 251 | connect(handler, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); |
252 | 252 | ||
253 | } | 253 | } |
254 | if (effSendCount < _toSend) | 254 | if (effSendCount < _toSend) |
255 | { | 255 | { |
256 | _toSend = effSendCount; | 256 | _toSend = effSendCount; |
257 | QMessageBox::information(this, tr("Error"), tr("<p>There was a problem sending some of the queued mails.</p>"), tr("Ok")); | 257 | QMessageBox::information(this, tr("Error"), tr("<p>There was a problem sending some of the queued mails.</p>"), tr("Ok")); |
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | void Composer::slotQueueMail() | 261 | void Composer::slotQueueMail() |
262 | { | 262 | { |
263 | if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { | 263 | if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { |
264 | QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); | 264 | QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); |
265 | return; | 265 | return; |
266 | } | 266 | } |
267 | 267 | ||
268 | Config cfg( "mailqueue", Config::User ); | 268 | Config cfg( "mailqueue", Config::User ); |
269 | 269 | ||
270 | cfg.setGroup( "Settings" ); | 270 | cfg.setGroup( "Settings" ); |
271 | int count = cfg.readNumEntry( "count", 0 ); | 271 | int count = cfg.readNumEntry( "count", 0 ); |
272 | count++; | 272 | count++; |
273 | cfg.writeEntry( "count", count ); | 273 | cfg.writeEntry( "count", count ); |
274 | qDebug("queueing mail %i",count); | 274 | qDebug("queueing mail %i",count); |
275 | 275 | ||
276 | cfg.setGroup( "Mail_" + QString::number( count )); | 276 | cfg.setGroup( "Mail_" + QString::number( count )); |
277 | cfg.writeEntry( "from", from->currentText() ); | 277 | cfg.writeEntry( "from", from->currentText() ); |
278 | cfg.writeEntry( "reply", replyto->text()); | 278 | cfg.writeEntry( "reply", replyto->text()); |
279 | cfg.writeEntry( "to", to->text()); | 279 | cfg.writeEntry( "to", to->text()); |
280 | cfg.writeEntry( "cc", cc->text()); | 280 | cfg.writeEntry( "cc", cc->text()); |
281 | cfg.writeEntry( "bcc", bcc->text()); | 281 | cfg.writeEntry( "bcc", bcc->text()); |
282 | cfg.writeEntry( "subject", subject->text()); | 282 | cfg.writeEntry( "subject", subject->text()); |
283 | cfg.writeEntryCrypt( "message", message->text()); | 283 | cfg.writeEntryCrypt( "message", message->text()); |
284 | cfg.writeEntry( "mime", attachView->childCount() == 0 ); | 284 | cfg.writeEntry( "mime", attachView->childCount() == 0 ); |
285 | cfg.writeEntry( "account", from->currentItem()); | 285 | cfg.writeEntry( "account", from->currentItem()); |
286 | cfg.writeEntry( "priority", priority->currentItem() ); | 286 | cfg.writeEntry( "priority", priority->currentItem() ); |
287 | cfg.writeEntry( "attachments", attachView->childCount() ); | 287 | cfg.writeEntry( "attachments", attachView->childCount() ); |
288 | 288 | ||
289 | Attachment a; | 289 | Attachment a; |
290 | QListViewItem *item; | 290 | QListViewItem *item; |
291 | QString an; | 291 | QString an; |
292 | int i = 0; | 292 | int i = 0; |
293 | for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { | 293 | for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { |
294 | a = ((AttachViewItem *)item)->attachment(); | 294 | a = ((AttachViewItem *)item)->attachment(); |
295 | an = "Attachment_" + QString::number( i++ ); | 295 | an = "Attachment_" + QString::number( i++ ); |
296 | cfg.writeEntry( an + "fileName", a.fileName() ); | 296 | cfg.writeEntry( an + "fileName", a.fileName() ); |
297 | cfg.writeEntry( an + "newName", a.newName() ); | 297 | cfg.writeEntry( an + "newName", a.newName() ); |
298 | cfg.writeEntry( an + "description", a.description() ); | 298 | cfg.writeEntry( an + "description", a.description() ); |
299 | cfg.writeEntry( an + "docLnk", a.docLnk().file() ); | 299 | cfg.writeEntry( an + "docLnk", a.docLnk().file() ); |
300 | } | 300 | } |
301 | 301 | ||
302 | QMessageBox::information(this, tr("Success"), tr("<p>The mail was queued successfully.</p><p>The queue contains ")+QString::number(count)+tr(" mails.</p>"), tr("Ok")); | 302 | QMessageBox::information(this, tr("Success"), tr("<p>The mail was queued successfully.</p><p>The queue contains ")+QString::number(count)+tr(" mails.</p>"), tr("Ok")); |
303 | 303 | ||
304 | } | 304 | } |
305 | 305 | ||
306 | void Composer::slotSendError(const QString &error) | 306 | void Composer::slotSendError(const QString &error) |
307 | { | 307 | { |
308 | status->setText(tr("<font color=#ff0000>Error occoured during sending.</font>")); | 308 | status->setStatusText(tr("<font color=#ff0000>Error occoured during sending.</font>")); |
309 | QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok")); | 309 | QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok")); |
310 | } | 310 | } |
311 | 311 | ||
312 | void Composer::slotSendQueuedError(const QString &error) | 312 | void Composer::slotSendQueuedError(const QString &error) |
313 | { | 313 | { |
314 | _sendError++; | 314 | _sendError++; |
315 | qDebug("error send mail %i",_sendCount); | 315 | qDebug("error send mail %i",_sendCount); |
316 | status->setText(tr("<font color=#ff0000>Error occoured during sending.</font>")); | 316 | status->setStatusText(tr("<font color=#ff0000>Error occoured during sending.</font>")); |
317 | QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok")); | 317 | QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok")); |
318 | } | 318 | } |
319 | 319 | ||
320 | void Composer::slotSendFinished() | 320 | void Composer::slotSendFinished() |
321 | { | 321 | { |
322 | QMessageBox::information(this, tr("Success"), tr("<p>The mail was sent successfully.</p>"), tr("Ok")); | 322 | QMessageBox::information(this, tr("Success"), tr("<p>The mail was sent successfully.</p>"), tr("Ok")); |
323 | 323 | ||
324 | status->setText(QString(0)); | 324 | status->setStatusText(QString(0)); |
325 | abort->setEnabled(false); | 325 | status->setStopEnabled(false); |
326 | } | 326 | } |
327 | 327 | ||
328 | void Composer::slotSendQueuedFinished() | 328 | void Composer::slotSendQueuedFinished() |
329 | { | 329 | { |
330 | 330 | ||
331 | _sendCount++; | 331 | _sendCount++; |
332 | qDebug("finished send mail %i of %i (error %i)",_sendCount,_toSend,_sendError); | 332 | qDebug("finished send mail %i of %i (error %i)",_sendCount,_toSend,_sendError); |
333 | if (_sendCount < _toSend) return; | 333 | if (_sendCount < _toSend) return; |
334 | if (_sendError == _toSend) close(); | 334 | if (_sendError == _toSend) close(); |
335 | QMessageBox::information(this, tr("Success"), tr("<p>The queued mails ")+QString::number(_toSend-_sendError)+tr(" of ")+QString::number(_toSend)+(" were sent successfully.</p>"), tr("Ok")); | 335 | QMessageBox::information(this, tr("Success"), tr("<p>The queued mails ")+QString::number(_toSend-_sendError)+tr(" of ")+QString::number(_toSend)+(" were sent successfully.</p>"), tr("Ok")); |
336 | Config cfg( "mailqueue", Config::User ); | 336 | Config cfg( "mailqueue", Config::User ); |
337 | cfg.setGroup( "Settings" ); | 337 | cfg.setGroup( "Settings" ); |
338 | cfg.writeEntry( "count", 0 ); | 338 | cfg.writeEntry( "count", 0 ); |
339 | for (int i=1;i<=_sendCount;i++) | 339 | for (int i=1;i<=_sendCount;i++) |
340 | { | 340 | { |
341 | cfg.setGroup( "Mail_" + QString::number(i) ); | 341 | cfg.setGroup( "Mail_" + QString::number(i) ); |
342 | qDebug("remove mail %i", i); | 342 | qDebug("remove mail %i", i); |
343 | cfg.clearGroup(); | 343 | cfg.clearGroup(); |
344 | cfg.removeEntry( "Mail_" + QString::number(i) ); | 344 | cfg.removeEntry( "Mail_" + QString::number(i) ); |
345 | } | 345 | } |
346 | close(); | 346 | close(); |
347 | } | 347 | } |
348 | 348 | ||
349 | void Composer::slotFillStuff() | 349 | void Composer::slotFillStuff() |
350 | { | 350 | { |
351 | QValueList<Account> accounts = ConfigFile::getAccounts(); | 351 | QValueList<Account> accounts = ConfigFile::getAccounts(); |
352 | int i = 0; | 352 | int i = 0; |
353 | 353 | ||
354 | QValueList<Account>::Iterator it; | 354 | QValueList<Account>::Iterator it; |
355 | for (it = accounts.begin(); it != accounts.end(); it++) { | 355 | for (it = accounts.begin(); it != accounts.end(); it++) { |
356 | if (!(*it).email().isEmpty() && !(*it).smtpServer().isEmpty() && !(*it).smtpPort().isEmpty()) { | 356 | if (!(*it).email().isEmpty() && !(*it).smtpServer().isEmpty() && !(*it).smtpPort().isEmpty()) { |
357 | if (!(*it).realName().isEmpty()) | 357 | if (!(*it).realName().isEmpty()) |
358 | from->insertItem((*it).realName() + " <" + (*it).email() + ">", i); | 358 | from->insertItem((*it).realName() + " <" + (*it).email() + ">", i); |
359 | else | 359 | else |
360 | from->insertItem((*it).email()); | 360 | from->insertItem((*it).email()); |
361 | 361 | ||
362 | accountsLoaded.append(*it); | 362 | accountsLoaded.append(*it); |
363 | i++; | 363 | i++; |
364 | } | 364 | } |
365 | } | 365 | } |
366 | } | 366 | } |
367 | 367 | ||
368 | void Composer::slotFromChanged(int id) | 368 | void Composer::slotFromChanged(int id) |
369 | { | 369 | { |
370 | Account account = accountsLoaded[id]; | 370 | Account account = accountsLoaded[id]; |
371 | 371 | ||
372 | if (account.defaultCc()) cc->setText(account.cc()); | 372 | if (account.defaultCc()) cc->setText(account.cc()); |
373 | if (account.defaultBcc()) bcc->setText(account.bcc()); | 373 | if (account.defaultBcc()) bcc->setText(account.bcc()); |
374 | if (account.defaultReplyTo()) replyto->setText(account.replyTo()); | 374 | if (account.defaultReplyTo()) replyto->setText(account.replyTo()); |
375 | if (!account.signature().isEmpty()) | 375 | if (!account.signature().isEmpty()) |
376 | message->setText(message->text() + "\n\n-- \n" + account.signature()); | 376 | message->setText(message->text() + "\n\n-- \n" + account.signature()); |
377 | } | 377 | } |
378 | 378 | ||
379 | void Composer::slotOpenAddressPicker() | 379 | void Composer::slotOpenAddressPicker() |
380 | { | 380 | { |
381 | if (!to->isHidden() && cc->isHidden() && bcc->isHidden()) { | 381 | if (!to->isHidden() && cc->isHidden() && bcc->isHidden()) { |
382 | if (to->text().isEmpty()) { | 382 | if (to->text().isEmpty()) { |
383 | to->setText(AddressPicker::getNames()); | 383 | to->setText(AddressPicker::getNames()); |
384 | } else { | 384 | } else { |
385 | to->setText(to->text() + ", " + AddressPicker::getNames()); | 385 | to->setText(to->text() + ", " + AddressPicker::getNames()); |
386 | } | 386 | } |
387 | } else if (to->isHidden() && !cc->isHidden() && bcc->isHidden()) { | 387 | } else if (to->isHidden() && !cc->isHidden() && bcc->isHidden()) { |
388 | if (cc->text().isEmpty()) { | 388 | if (cc->text().isEmpty()) { |
389 | cc->setText(AddressPicker::getNames()); | 389 | cc->setText(AddressPicker::getNames()); |
diff --git a/noncore/unsupported/mail2/composerbase.cpp b/noncore/unsupported/mail2/composerbase.cpp index c456ae5..6f6ab8e 100644 --- a/noncore/unsupported/mail2/composerbase.cpp +++ b/noncore/unsupported/mail2/composerbase.cpp | |||
@@ -1,211 +1,205 @@ | |||
1 | #include <qmultilineedit.h> | 1 | #include <qmultilineedit.h> |
2 | #include <qpopupmenu.h> | 2 | #include <qpopupmenu.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include <qaction.h> | 6 | #include <qaction.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qvbox.h> | 8 | #include <qvbox.h> |
9 | 9 | ||
10 | #include <qpe/qpetoolbar.h> | 10 | #include <qpe/qpetoolbar.h> |
11 | #include <qpe/qpemenubar.h> | 11 | #include <qpe/qpemenubar.h> |
12 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
13 | 13 | ||
14 | #include "mailstatusbar.h" | ||
14 | #include "listviewplus.h" | 15 | #include "listviewplus.h" |
15 | #include "composerbase.h" | 16 | #include "composerbase.h" |
16 | 17 | ||
17 | ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) | 18 | ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) |
18 | : QMainWindow(parent, name, fl) | 19 | : QMainWindow(parent, name, fl) |
19 | { | 20 | { |
20 | setCaption(tr("Compose Message")); | 21 | setCaption(tr("Compose Message")); |
21 | setToolBarsMovable(false); | 22 | setToolBarsMovable(false); |
22 | 23 | ||
23 | toolbar = new QPEToolBar(this); | 24 | toolbar = new QPEToolBar(this); |
24 | menubar = new QPEMenuBar( toolbar ); | 25 | menubar = new QPEMenuBar( toolbar ); |
25 | mailmenu = new QPopupMenu( menubar ); | 26 | mailmenu = new QPopupMenu( menubar ); |
26 | menubar->insertItem( tr( "Mail" ), mailmenu ); | 27 | menubar->insertItem( tr( "Mail" ), mailmenu ); |
27 | addToolBar(toolbar); | 28 | addToolBar(toolbar); |
28 | toolbar->setHorizontalStretchable(true); | 29 | toolbar->setHorizontalStretchable(true); |
29 | 30 | ||
30 | QLabel *spacer = new QLabel(toolbar); | 31 | QLabel *spacer = new QLabel(toolbar); |
31 | spacer->setBackgroundMode(QWidget::PaletteButton); | 32 | spacer->setBackgroundMode(QWidget::PaletteButton); |
32 | toolbar->setStretchableWidget(spacer); | 33 | toolbar->setStretchableWidget(spacer); |
33 | 34 | ||
34 | sendmail = new QAction(tr("Send the mail"), QIconSet(Resource::loadPixmap("mail/sendmail")), 0, 0, this); | 35 | sendmail = new QAction(tr("Send the mail"), QIconSet(Resource::loadPixmap("mail/sendmail")), 0, 0, this); |
35 | sendmail->addTo(toolbar); | 36 | sendmail->addTo(toolbar); |
36 | sendmail->addTo(mailmenu); | 37 | sendmail->addTo(mailmenu); |
37 | 38 | ||
38 | queuemail = new QAction(tr("Queue the mail"), QIconSet(Resource::loadPixmap("mail/sendall")), 0, 0, this); | 39 | queuemail = new QAction(tr("Queue the mail"), QIconSet(Resource::loadPixmap("mail/sendall")), 0, 0, this); |
39 | queuemail->addTo(toolbar); | 40 | queuemail->addTo(toolbar); |
40 | queuemail->addTo(mailmenu); | 41 | queuemail->addTo(mailmenu); |
41 | 42 | ||
42 | attachfile = new QAction(tr("Attach a file"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); | 43 | attachfile = new QAction(tr("Attach a file"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); |
43 | attachfile->addTo(toolbar); | 44 | attachfile->addTo(toolbar); |
44 | attachfile->addTo(mailmenu); | 45 | attachfile->addTo(mailmenu); |
45 | connect(attachfile, SIGNAL(toggled(bool)), SLOT(slotAttachfileChanged(bool))); | 46 | connect(attachfile, SIGNAL(toggled(bool)), SLOT(slotAttachfileChanged(bool))); |
46 | 47 | ||
47 | addressbook = new QAction(tr("Addressbook"), QIconSet(Resource::loadPixmap("mail/addbook")), 0, 0, this); | 48 | addressbook = new QAction(tr("Addressbook"), QIconSet(Resource::loadPixmap("mail/addbook")), 0, 0, this); |
48 | addressbook->addTo(toolbar); | 49 | addressbook->addTo(toolbar); |
49 | addressbook->addTo(mailmenu); | 50 | addressbook->addTo(mailmenu); |
50 | 51 | ||
51 | abort = new QAction(tr("Abort sending"), QIconSet(Resource::loadPixmap("mail/abort")), 0, 0, this); | ||
52 | abort->addTo(toolbar); | ||
53 | abort->addTo(mailmenu); | ||
54 | |||
55 | QWidget *main = new QWidget(this); | 52 | QWidget *main = new QWidget(this); |
56 | setCentralWidget(main); | 53 | setCentralWidget(main); |
57 | 54 | ||
58 | QGridLayout *layout = new QGridLayout(main); | 55 | QGridLayout *layout = new QGridLayout(main); |
59 | 56 | ||
60 | fromBox = new QComboBox(main); | 57 | fromBox = new QComboBox(main); |
61 | fromBox->insertItem(tr("From"), POPUP_FROM_FROM); | 58 | fromBox->insertItem(tr("From"), POPUP_FROM_FROM); |
62 | fromBox->insertItem(tr("Reply"), POPUP_FROM_REPLYTO); | 59 | fromBox->insertItem(tr("Reply"), POPUP_FROM_REPLYTO); |
63 | layout->addWidget(fromBox, 0, 0); | 60 | layout->addWidget(fromBox, 0, 0); |
64 | 61 | ||
65 | connect(fromBox, SIGNAL(activated(int)), SLOT(slotFromMenuChanged(int))); | 62 | connect(fromBox, SIGNAL(activated(int)), SLOT(slotFromMenuChanged(int))); |
66 | 63 | ||
67 | QHBoxLayout *fromLayout = new QHBoxLayout(); | 64 | QHBoxLayout *fromLayout = new QHBoxLayout(); |
68 | layout->addLayout(fromLayout, 0, 1); | 65 | layout->addLayout(fromLayout, 0, 1); |
69 | 66 | ||
70 | from = new QComboBox(main); | 67 | from = new QComboBox(main); |
71 | fromLayout->addWidget(from); | 68 | fromLayout->addWidget(from); |
72 | 69 | ||
73 | replyto = new QLineEdit(main); | 70 | replyto = new QLineEdit(main); |
74 | replyto->hide(); | 71 | replyto->hide(); |
75 | fromLayout->addWidget(replyto); | 72 | fromLayout->addWidget(replyto); |
76 | 73 | ||
77 | receiversBox = new QComboBox(main); | 74 | receiversBox = new QComboBox(main); |
78 | receiversBox->insertItem(tr("To"), POPUP_RECV_TO); | 75 | receiversBox->insertItem(tr("To"), POPUP_RECV_TO); |
79 | receiversBox->insertItem(tr("Cc"), POPUP_RECV_CC); | 76 | receiversBox->insertItem(tr("Cc"), POPUP_RECV_CC); |
80 | receiversBox->insertItem(tr("Bcc"), POPUP_RECV_BCC); | 77 | receiversBox->insertItem(tr("Bcc"), POPUP_RECV_BCC); |
81 | layout->addWidget(receiversBox, 1, 0); | 78 | layout->addWidget(receiversBox, 1, 0); |
82 | 79 | ||
83 | connect(receiversBox, SIGNAL(activated(int)), SLOT(slotReceiverMenuChanged(int))); | 80 | connect(receiversBox, SIGNAL(activated(int)), SLOT(slotReceiverMenuChanged(int))); |
84 | 81 | ||
85 | QHBoxLayout *receiverLayout = new QHBoxLayout(); | 82 | QHBoxLayout *receiverLayout = new QHBoxLayout(); |
86 | layout->addLayout(receiverLayout, 1, 1); | 83 | layout->addLayout(receiverLayout, 1, 1); |
87 | 84 | ||
88 | to = new QLineEdit(main); | 85 | to = new QLineEdit(main); |
89 | receiverLayout->addWidget(to); | 86 | receiverLayout->addWidget(to); |
90 | 87 | ||
91 | cc = new QLineEdit(main); | 88 | cc = new QLineEdit(main); |
92 | cc->hide(); | 89 | cc->hide(); |
93 | receiverLayout->addWidget(cc); | 90 | receiverLayout->addWidget(cc); |
94 | 91 | ||
95 | bcc = new QLineEdit(main); | 92 | bcc = new QLineEdit(main); |
96 | bcc->hide(); | 93 | bcc->hide(); |
97 | receiverLayout->addWidget(bcc); | 94 | receiverLayout->addWidget(bcc); |
98 | 95 | ||
99 | subjectBox = new QComboBox(main); | 96 | subjectBox = new QComboBox(main); |
100 | subjectBox->insertItem(tr("Subj."), POPUP_SUBJ_SUBJECT); | 97 | subjectBox->insertItem(tr("Subj."), POPUP_SUBJ_SUBJECT); |
101 | subjectBox->insertItem(tr("Prio."), POPUP_SUBJ_PRIORITY); | 98 | subjectBox->insertItem(tr("Prio."), POPUP_SUBJ_PRIORITY); |
102 | layout->addWidget(subjectBox, 2, 0); | 99 | layout->addWidget(subjectBox, 2, 0); |
103 | connect(subjectBox, SIGNAL(activated(int)), SLOT(slotSubjectMenuChanged(int))); | 100 | connect(subjectBox, SIGNAL(activated(int)), SLOT(slotSubjectMenuChanged(int))); |
104 | 101 | ||
105 | QHBoxLayout *subjectLayout = new QHBoxLayout(); | 102 | QHBoxLayout *subjectLayout = new QHBoxLayout(); |
106 | layout->addLayout(subjectLayout, 2, 1); | 103 | layout->addLayout(subjectLayout, 2, 1); |
107 | 104 | ||
108 | subject = new QLineEdit(main); | 105 | subject = new QLineEdit(main); |
109 | subjectLayout->addWidget(subject); | 106 | subjectLayout->addWidget(subject); |
110 | 107 | ||
111 | priority = new QComboBox(main); | 108 | priority = new QComboBox(main); |
112 | priority->insertItem(tr("Low"), POPUP_PRIO_LOW); | 109 | priority->insertItem(tr("Low"), POPUP_PRIO_LOW); |
113 | priority->insertItem(tr("Normal"), POPUP_PRIO_NORMAL); | 110 | priority->insertItem(tr("Normal"), POPUP_PRIO_NORMAL); |
114 | priority->insertItem(tr("High"), POPUP_PRIO_HIGH); | 111 | priority->insertItem(tr("High"), POPUP_PRIO_HIGH); |
115 | priority->setCurrentItem(POPUP_PRIO_NORMAL); | 112 | priority->setCurrentItem(POPUP_PRIO_NORMAL); |
116 | priority->hide(); | 113 | priority->hide(); |
117 | subjectLayout->addWidget(priority); | 114 | subjectLayout->addWidget(priority); |
118 | 115 | ||
119 | QVBox *view = new QVBox(main); | 116 | QVBox *view = new QVBox(main); |
120 | layout->addMultiCellWidget(view, 3, 3, 0, 1); | 117 | layout->addMultiCellWidget(view, 3, 3, 0, 1); |
121 | 118 | ||
122 | message = new QMultiLineEdit(view); | 119 | message = new QMultiLineEdit(view); |
123 | message->setMinimumHeight(30); | 120 | message->setMinimumHeight(30); |
124 | 121 | ||
125 | attachWindow = new QMainWindow(view, 0, 0); | 122 | attachWindow = new QMainWindow(view, 0, 0); |
126 | attachWindow->setMinimumHeight(100); | 123 | attachWindow->setMinimumHeight(80); |
127 | attachWindow->setMaximumHeight(100); | 124 | attachWindow->setMaximumHeight(80); |
128 | attachWindow->setToolBarsMovable(false); | 125 | attachWindow->setToolBarsMovable(false); |
129 | attachWindow->hide(); | 126 | attachWindow->hide(); |
130 | 127 | ||
131 | attachToolbar = new QPEToolBar(attachWindow); | 128 | attachToolbar = new QPEToolBar(attachWindow); |
132 | attachToolbar->setVerticalStretchable(true); | 129 | attachToolbar->setVerticalStretchable(true); |
133 | 130 | ||
134 | addattach = new QAction(tr("Add an Attachement"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this); | 131 | addattach = new QAction(tr("Add an Attachement"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this); |
135 | addattach->addTo(attachToolbar); | 132 | addattach->addTo(attachToolbar); |
136 | 133 | ||
137 | delattach = new QAction(tr("Remove Attachement"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); | 134 | delattach = new QAction(tr("Remove Attachement"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); |
138 | delattach->addTo(attachToolbar); | 135 | delattach->addTo(attachToolbar); |
139 | 136 | ||
140 | QLabel *attachSpacer = new QLabel(attachToolbar); | 137 | QLabel *attachSpacer = new QLabel(attachToolbar); |
141 | attachSpacer->setBackgroundMode(QWidget::PaletteButton); | 138 | attachSpacer->setBackgroundMode(QWidget::PaletteButton); |
142 | attachToolbar->setStretchableWidget(attachSpacer); | 139 | attachToolbar->setStretchableWidget(attachSpacer); |
143 | 140 | ||
144 | attachWindow->addToolBar(attachToolbar, QMainWindow::Left); | 141 | attachWindow->addToolBar(attachToolbar, QMainWindow::Left); |
145 | 142 | ||
146 | attachView = new ListViewPlus(attachWindow); | 143 | attachView = new ListViewPlus(attachWindow); |
147 | attachView->addColumn(tr("Name"), 80); | 144 | attachView->addColumn(tr("Name"), 80); |
148 | attachView->addColumn(tr("Description"), 110); | 145 | attachView->addColumn(tr("Description"), 110); |
149 | attachView->setAllColumnsShowFocus(true); | 146 | attachView->setAllColumnsShowFocus(true); |
150 | attachWindow->setCentralWidget(attachView); | 147 | attachWindow->setCentralWidget(attachView); |
151 | 148 | ||
152 | attachPopup = new QPopupMenu(attachView); | 149 | attachPopup = new QPopupMenu(attachView); |
153 | attachPopup->insertItem(tr("Rename"), POPUP_ATTACH_RENAME); | 150 | attachPopup->insertItem(tr("Rename"), POPUP_ATTACH_RENAME); |
154 | attachPopup->insertItem(tr("Change Description"), POPUP_ATTACH_DESC); | 151 | attachPopup->insertItem(tr("Change Description"), POPUP_ATTACH_DESC); |
155 | attachPopup->insertSeparator(); | 152 | attachPopup->insertSeparator(); |
156 | attachPopup->insertItem(tr("Remove"), POPUP_ATTACH_REMOVE); | 153 | attachPopup->insertItem(tr("Remove"), POPUP_ATTACH_REMOVE); |
157 | attachView->setPopup(attachPopup); | 154 | attachView->setPopup(attachPopup); |
158 | 155 | ||
159 | status = new QLabel(view); | 156 | status = new MailStatusBar(view); |
160 | QFont tmpFont = status->font(); | ||
161 | tmpFont.setPixelSize(8); | ||
162 | status->setFont(tmpFont); | ||
163 | } | 157 | } |
164 | 158 | ||
165 | void ComposerBase::slotAttachfileChanged(bool toggled) | 159 | void ComposerBase::slotAttachfileChanged(bool toggled) |
166 | { | 160 | { |
167 | if (toggled) { | 161 | if (toggled) { |
168 | if (attachWindow->isHidden()) attachWindow->show(); | 162 | if (attachWindow->isHidden()) attachWindow->show(); |
169 | } else { | 163 | } else { |
170 | if (!attachWindow->isHidden()) attachWindow->hide(); | 164 | if (!attachWindow->isHidden()) attachWindow->hide(); |
171 | } | 165 | } |
172 | } | 166 | } |
173 | 167 | ||
174 | void ComposerBase::slotFromMenuChanged(int id) | 168 | void ComposerBase::slotFromMenuChanged(int id) |
175 | { | 169 | { |
176 | if (POPUP_FROM_FROM == id) { | 170 | if (POPUP_FROM_FROM == id) { |
177 | if (from->isHidden()) from->show(); | 171 | if (from->isHidden()) from->show(); |
178 | if (!replyto->isHidden()) replyto->hide(); | 172 | if (!replyto->isHidden()) replyto->hide(); |
179 | } else if (POPUP_FROM_REPLYTO == id) { | 173 | } else if (POPUP_FROM_REPLYTO == id) { |
180 | if (!from->isHidden()) from->hide(); | 174 | if (!from->isHidden()) from->hide(); |
181 | if (replyto->isHidden()) replyto->show(); | 175 | if (replyto->isHidden()) replyto->show(); |
182 | } | 176 | } |
183 | } | 177 | } |
184 | 178 | ||
185 | void ComposerBase::slotReceiverMenuChanged(int id) | 179 | void ComposerBase::slotReceiverMenuChanged(int id) |
186 | { | 180 | { |
187 | if (POPUP_RECV_TO == id) { | 181 | if (POPUP_RECV_TO == id) { |
188 | if (to->isHidden()) to->show(); | 182 | if (to->isHidden()) to->show(); |
189 | if (!cc->isHidden()) cc->hide(); | 183 | if (!cc->isHidden()) cc->hide(); |
190 | if (!bcc->isHidden()) bcc->hide(); | 184 | if (!bcc->isHidden()) bcc->hide(); |
191 | } else if (POPUP_RECV_CC == id) { | 185 | } else if (POPUP_RECV_CC == id) { |
192 | if (!to->isHidden()) to->hide(); | 186 | if (!to->isHidden()) to->hide(); |
193 | if (cc->isHidden()) cc->show(); | 187 | if (cc->isHidden()) cc->show(); |
194 | if (!bcc->isHidden()) bcc->hide(); | 188 | if (!bcc->isHidden()) bcc->hide(); |
195 | } else if (POPUP_RECV_BCC == id) { | 189 | } else if (POPUP_RECV_BCC == id) { |
196 | if (!to->isHidden()) to->hide(); | 190 | if (!to->isHidden()) to->hide(); |
197 | if (!cc->isHidden()) cc->hide(); | 191 | if (!cc->isHidden()) cc->hide(); |
198 | if (bcc->isHidden()) bcc->show(); | 192 | if (bcc->isHidden()) bcc->show(); |
199 | } | 193 | } |
200 | } | 194 | } |
201 | 195 | ||
202 | void ComposerBase::slotSubjectMenuChanged(int id) | 196 | void ComposerBase::slotSubjectMenuChanged(int id) |
203 | { | 197 | { |
204 | if (POPUP_SUBJ_SUBJECT == id) { | 198 | if (POPUP_SUBJ_SUBJECT == id) { |
205 | if (subject->isHidden()) subject->show(); | 199 | if (subject->isHidden()) subject->show(); |
206 | if (!priority->isHidden()) priority->hide(); | 200 | if (!priority->isHidden()) priority->hide(); |
207 | } else if (POPUP_SUBJ_PRIORITY == id) { | 201 | } else if (POPUP_SUBJ_PRIORITY == id) { |
208 | if (!subject->isHidden()) subject->hide(); | 202 | if (!subject->isHidden()) subject->hide(); |
209 | if (priority->isHidden()) priority->show(); | 203 | if (priority->isHidden()) priority->show(); |
210 | } | 204 | } |
211 | } | 205 | } |
diff --git a/noncore/unsupported/mail2/composerbase.h b/noncore/unsupported/mail2/composerbase.h index d832623..58f1157 100644 --- a/noncore/unsupported/mail2/composerbase.h +++ b/noncore/unsupported/mail2/composerbase.h | |||
@@ -1,59 +1,61 @@ | |||
1 | #ifndef COMPOSERBASE_H | 1 | #ifndef COMPOSERBASE_H |
2 | #define COMPOSERBASE_H | 2 | #define COMPOSERBASE_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | 5 | ||
6 | class QMultiLineEdit; | 6 | class QMultiLineEdit; |
7 | class MailStatusBar; | ||
7 | class ListViewPlus; | 8 | class ListViewPlus; |
8 | class QPopupMenu; | 9 | class QPopupMenu; |
9 | class QPEToolBar; | 10 | class QPEToolBar; |
10 | class QPEMenuBar; | 11 | class QPEMenuBar; |
11 | class QPopupMenu; | 12 | class QPopupMenu; |
12 | class QComboBox; | 13 | class QComboBox; |
13 | class QLineEdit; | 14 | class QLineEdit; |
14 | class QAction; | 15 | class QAction; |
15 | class QLabel; | 16 | class QLabel; |
16 | 17 | ||
17 | class ComposerBase : public QMainWindow | 18 | class ComposerBase : public QMainWindow |
18 | { | 19 | { |
19 | Q_OBJECT | 20 | Q_OBJECT |
20 | 21 | ||
21 | public: | 22 | public: |
22 | ComposerBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 23 | ComposerBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); |
23 | 24 | ||
24 | protected: | 25 | protected: |
25 | static const int POPUP_FROM_FROM = 0; | 26 | static const int POPUP_FROM_FROM = 0; |
26 | static const int POPUP_FROM_REPLYTO = 1; | 27 | static const int POPUP_FROM_REPLYTO = 1; |
27 | static const int POPUP_RECV_TO = 0; | 28 | static const int POPUP_RECV_TO = 0; |
28 | static const int POPUP_RECV_CC = 1; | 29 | static const int POPUP_RECV_CC = 1; |
29 | static const int POPUP_RECV_BCC = 2; | 30 | static const int POPUP_RECV_BCC = 2; |
30 | static const int POPUP_SUBJ_SUBJECT = 0; | 31 | static const int POPUP_SUBJ_SUBJECT = 0; |
31 | static const int POPUP_SUBJ_PRIORITY = 1; | 32 | static const int POPUP_SUBJ_PRIORITY = 1; |
32 | static const int POPUP_PRIO_LOW = 0; | 33 | static const int POPUP_PRIO_LOW = 0; |
33 | static const int POPUP_PRIO_NORMAL = 1; | 34 | static const int POPUP_PRIO_NORMAL = 1; |
34 | static const int POPUP_PRIO_HIGH = 2; | 35 | static const int POPUP_PRIO_HIGH = 2; |
35 | static const int POPUP_ATTACH_RENAME = 0; | 36 | static const int POPUP_ATTACH_RENAME = 0; |
36 | static const int POPUP_ATTACH_DESC = 1; | 37 | static const int POPUP_ATTACH_DESC = 1; |
37 | static const int POPUP_ATTACH_REMOVE = 2; | 38 | static const int POPUP_ATTACH_REMOVE = 2; |
38 | 39 | ||
39 | QMultiLineEdit *message; | 40 | QMultiLineEdit *message; |
41 | MailStatusBar *status; | ||
40 | ListViewPlus *attachView; | 42 | ListViewPlus *attachView; |
41 | QMainWindow *attachWindow; | 43 | QMainWindow *attachWindow; |
42 | QPopupMenu *attachPopup; | 44 | QPopupMenu *attachPopup; |
43 | QPEToolBar *toolbar, *attachToolbar; | 45 | QPEToolBar *toolbar, *attachToolbar; |
44 | QPEMenuBar *menubar; | 46 | QPEMenuBar *menubar; |
45 | QPopupMenu *mailmenu; | 47 | QPopupMenu *mailmenu; |
46 | QComboBox *fromBox, *from, *receiversBox, *subjectBox, *priority; | 48 | QComboBox *fromBox, *from, *receiversBox, *subjectBox, *priority; |
47 | QLineEdit *replyto, *to, *cc, *bcc, *subject; | 49 | QLineEdit *replyto, *to, *cc, *bcc, *subject; |
48 | QAction *sendmail, *queuemail, *attachfile, *addressbook, *abort, *addattach, *delattach; | 50 | QAction *sendmail, *queuemail, *attachfile, *addressbook, *abort, *addattach, *delattach; |
49 | QLabel *fromLabel, *status; | 51 | QLabel *fromLabel; |
50 | 52 | ||
51 | protected slots: | 53 | protected slots: |
52 | void slotAttachfileChanged(bool toggled); | 54 | void slotAttachfileChanged(bool toggled); |
53 | void slotFromMenuChanged(int id); | 55 | void slotFromMenuChanged(int id); |
54 | void slotReceiverMenuChanged(int id); | 56 | void slotReceiverMenuChanged(int id); |
55 | void slotSubjectMenuChanged(int id); | 57 | void slotSubjectMenuChanged(int id); |
56 | 58 | ||
57 | }; | 59 | }; |
58 | 60 | ||
59 | #endif | 61 | #endif |
diff --git a/noncore/unsupported/mail2/mail.pro b/noncore/unsupported/mail2/mail.pro index 985a6fb..177509d 100644 --- a/noncore/unsupported/mail2/mail.pro +++ b/noncore/unsupported/mail2/mail.pro | |||
@@ -1,59 +1,61 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | #CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | HEADERS = accounteditor.h \ | 4 | HEADERS = accounteditor.h \ |
5 | addresspicker.h \ | 5 | addresspicker.h \ |
6 | composer.h \ | 6 | composer.h \ |
7 | composerbase.h \ | 7 | composerbase.h \ |
8 | configdiag.h \ | 8 | configdiag.h \ |
9 | folderwidget.h \ | 9 | folderwidget.h \ |
10 | listviewplus.h \ | 10 | listviewplus.h \ |
11 | mailstatusbar.h \ | ||
11 | mailtable.h \ | 12 | mailtable.h \ |
12 | mainwindow.h \ | 13 | mainwindow.h \ |
13 | mainwindowbase.h \ | 14 | mainwindowbase.h \ |
14 | opendiag.h \ | 15 | opendiag.h \ |
15 | rename.h \ | 16 | rename.h \ |
16 | searchdiag.h \ | 17 | searchdiag.h \ |
17 | viewmail.h \ | 18 | viewmail.h \ |
18 | viewmailbase.h | 19 | viewmailbase.h |
19 | SOURCES = accounteditor.cpp \ | 20 | SOURCES = accounteditor.cpp \ |
20 | addresspicker.cpp \ | 21 | addresspicker.cpp \ |
21 | composer.cpp \ | 22 | composer.cpp \ |
22 | composerbase.cpp \ | 23 | composerbase.cpp \ |
23 | configdiag.cpp \ | 24 | configdiag.cpp \ |
24 | folderwidget.cpp \ | 25 | folderwidget.cpp \ |
25 | listviewplus.cpp \ | 26 | listviewplus.cpp \ |
27 | mailstatusbar.cpp \ | ||
26 | mailtable.cpp \ | 28 | mailtable.cpp \ |
27 | main.cpp \ | 29 | main.cpp \ |
28 | mainwindow.cpp \ | 30 | mainwindow.cpp \ |
29 | mainwindowbase.cpp \ | 31 | mainwindowbase.cpp \ |
30 | opendiag.cpp \ | 32 | opendiag.cpp \ |
31 | rename.cpp \ | 33 | rename.cpp \ |
32 | searchdiag.cpp \ | 34 | searchdiag.cpp \ |
33 | viewmail.cpp \ | 35 | viewmail.cpp \ |
34 | viewmailbase.cpp | 36 | viewmailbase.cpp |
35 | INTERFACES = accounteditorbase.ui \ | 37 | INTERFACES = accounteditorbase.ui \ |
36 | addresspickerbase.ui \ | 38 | addresspickerbase.ui \ |
37 | configdiagbase.ui \ | 39 | configdiagbase.ui \ |
38 | opendiagbase.ui \ | 40 | opendiagbase.ui \ |
39 | renamebase.ui \ | 41 | renamebase.ui \ |
40 | searchdiagbase.ui | 42 | searchdiagbase.ui |
41 | INCLUDEPATH += $(OPIEDIR)/include libmail | 43 | INCLUDEPATH += $(OPIEDIR)/include libmail |
42 | LIBS += -lmail -lqpe -lopie | 44 | LIBS += -lmail -lqpe -lopie |
43 | TARGET = mail | 45 | TARGET = mail |
44 | DESTDIR = $(OPIEDIR)/bin | 46 | DESTDIR = $(OPIEDIR)/bin |
45 | 47 | ||
46 | TRANSLATIONS = ../../i18n/de/mail.ts \ | 48 | TRANSLATIONS = ../../i18n/de/mail.ts \ |
47 | ../../i18n/en/mail.ts \ | 49 | ../../i18n/en/mail.ts \ |
48 | ../../i18n/es/mail.ts \ | 50 | ../../i18n/es/mail.ts \ |
49 | ../../i18n/fr/mail.ts \ | 51 | ../../i18n/fr/mail.ts \ |
50 | ../../i18n/hu/mail.ts \ | 52 | ../../i18n/hu/mail.ts \ |
51 | ../../i18n/ja/mail.ts \ | 53 | ../../i18n/ja/mail.ts \ |
52 | ../../i18n/ko/mail.ts \ | 54 | ../../i18n/ko/mail.ts \ |
53 | ../../i18n/no/mail.ts \ | 55 | ../../i18n/no/mail.ts \ |
54 | ../../i18n/pl/mail.ts \ | 56 | ../../i18n/pl/mail.ts \ |
55 | ../../i18n/pt/mail.ts \ | 57 | ../../i18n/pt/mail.ts \ |
56 | ../../i18n/pt_BR/mail.ts \ | 58 | ../../i18n/pt_BR/mail.ts \ |
57 | ../../i18n/sl/mail.ts \ | 59 | ../../i18n/sl/mail.ts \ |
58 | ../../i18n/zh_CN/mail.ts \ | 60 | ../../i18n/zh_CN/mail.ts \ |
59 | ../../i18n/zh_TW/mail.ts | 61 | ../../i18n/zh_TW/mail.ts |
diff --git a/noncore/unsupported/mail2/mailstatusbar.cpp b/noncore/unsupported/mail2/mailstatusbar.cpp new file mode 100644 index 0000000..470ea4f --- a/dev/null +++ b/noncore/unsupported/mail2/mailstatusbar.cpp | |||
@@ -0,0 +1,58 @@ | |||
1 | #include <qprogressbar.h> | ||
2 | #include <qtoolbutton.h> | ||
3 | #include <qlabel.h> | ||
4 | |||
5 | #include "mailstatusbar.h" | ||
6 | |||
7 | MailStatusBar::MailStatusBar(QWidget *parent, const char *name, WFlags fl) | ||
8 | : QHBox(parent, name, fl) | ||
9 | { | ||
10 | label = new QLabel(this); | ||
11 | QFont tmpFont = label->font(); | ||
12 | tmpFont.setPixelSize(8); | ||
13 | label->setFont(tmpFont); | ||
14 | |||
15 | stopButton = new QToolButton(this); | ||
16 | stopButton->setText(" X "); | ||
17 | stopButton->setMaximumHeight(15); | ||
18 | stopButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
19 | connect(stopButton, SIGNAL(clicked()), SLOT(stopClicked())); | ||
20 | |||
21 | progress = new QProgressBar(this); | ||
22 | progress->setCenterIndicator(true); | ||
23 | progress->setMinimumHeight(15); | ||
24 | progress->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
25 | progress->setFrameShape(QFrame::Box); | ||
26 | progress->setFrameShadow(QFrame::Raised); | ||
27 | } | ||
28 | |||
29 | void MailStatusBar::setStatusText(const QString &text) | ||
30 | { | ||
31 | label->setText(text); | ||
32 | } | ||
33 | |||
34 | void MailStatusBar::setStopEnabled(bool enabled) | ||
35 | { | ||
36 | stopButton->setEnabled(enabled); | ||
37 | } | ||
38 | |||
39 | void MailStatusBar::setProgressTotalSteps(int steps) | ||
40 | { | ||
41 | progress->setTotalSteps(steps); | ||
42 | } | ||
43 | |||
44 | void MailStatusBar::setProgress(int pg) | ||
45 | { | ||
46 | progress->setProgress(pg); | ||
47 | } | ||
48 | |||
49 | void MailStatusBar::resetProgress() | ||
50 | { | ||
51 | progress->reset(); | ||
52 | } | ||
53 | |||
54 | void MailStatusBar::stopClicked() | ||
55 | { | ||
56 | emit stop(); | ||
57 | } | ||
58 | |||
diff --git a/noncore/unsupported/mail2/mailstatusbar.h b/noncore/unsupported/mail2/mailstatusbar.h new file mode 100644 index 0000000..11cd538 --- a/dev/null +++ b/noncore/unsupported/mail2/mailstatusbar.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef MAILSTATUSBAR_H | ||
2 | #define MAILSTATUSBAR_H | ||
3 | |||
4 | #include <qhbox.h> | ||
5 | |||
6 | class QLabel; | ||
7 | class QToolButton; | ||
8 | class QProgressBar; | ||
9 | |||
10 | class MailStatusBar : public QHBox | ||
11 | { | ||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | MailStatusBar(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | ||
16 | |||
17 | public slots: | ||
18 | void setStatusText(const QString &text); | ||
19 | void setStopEnabled(bool enabled); | ||
20 | void setProgressTotalSteps(int steps); | ||
21 | void setProgress(int progress); | ||
22 | void resetProgress(); | ||
23 | |||
24 | signals: | ||
25 | void stop(); | ||
26 | |||
27 | protected slots: | ||
28 | void stopClicked(); | ||
29 | |||
30 | private: | ||
31 | QLabel *label; | ||
32 | QToolButton *stopButton; | ||
33 | QProgressBar *progress; | ||
34 | |||
35 | }; | ||
36 | |||
37 | #endif | ||
38 | |||
diff --git a/noncore/unsupported/mail2/mainwindow.cpp b/noncore/unsupported/mail2/mainwindow.cpp index 0044693..047c54b 100644 --- a/noncore/unsupported/mail2/mainwindow.cpp +++ b/noncore/unsupported/mail2/mainwindow.cpp | |||
@@ -1,76 +1,74 @@ | |||
1 | #include <qprogressbar.h> | ||
2 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
3 | #include <qtoolbutton.h> | ||
4 | #include <qaction.h> | 2 | #include <qaction.h> |
5 | #include <qlabel.h> | ||
6 | 3 | ||
4 | #include "mailstatusbar.h" | ||
7 | #include "folderwidget.h" | 5 | #include "folderwidget.h" |
8 | #include "mainwindow.h" | 6 | #include "mainwindow.h" |
9 | #include "configdiag.h" | 7 | #include "configdiag.h" |
10 | #include "configfile.h" | 8 | #include "configfile.h" |
11 | #include "searchdiag.h" | 9 | #include "searchdiag.h" |
12 | #include "mailtable.h" | 10 | #include "mailtable.h" |
13 | #include "composer.h" | 11 | #include "composer.h" |
14 | #include "viewmail.h" | 12 | #include "viewmail.h" |
15 | 13 | ||
16 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl) | 14 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl) |
17 | : MainWindowBase(parent, name, fl) | 15 | : MainWindowBase(parent, name, fl) |
18 | { | 16 | { |
19 | stopButton->setEnabled(false); | 17 | status->setStopEnabled(false); |
20 | 18 | ||
21 | connect(folderView, SIGNAL(status(const QString &)), statusLabel, SLOT(setText(const QString &))); | 19 | connect(folderView, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); |
22 | connect(folderView, SIGNAL(folderSelected(Folder)), mailView, SLOT(setFolder(Folder))); | 20 | connect(folderView, SIGNAL(folderSelected(Folder)), mailView, SLOT(setFolder(Folder))); |
23 | 21 | ||
24 | connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH, IMAPHandler *)), SLOT(mailClicked(IMAPResponseFETCH, IMAPHandler *))); | 22 | connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH, IMAPHandler *)), SLOT(mailClicked(IMAPResponseFETCH, IMAPHandler *))); |
25 | connect(mailView, SIGNAL(status(const QString &)), statusLabel, SLOT(setText(const QString &))); | 23 | connect(mailView, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); |
26 | connect(mailView, SIGNAL(totalSteps(int)), statusProgress, SLOT(setTotalSteps(int))); | 24 | connect(mailView, SIGNAL(totalSteps(int)), status, SLOT(setProgressTotalSteps(int))); |
27 | connect(mailView, SIGNAL(progress(int)), statusProgress, SLOT(setProgress(int))); | 25 | connect(mailView, SIGNAL(progress(int)), status, SLOT(setProgress(int))); |
28 | connect(mailView, SIGNAL(resetProgress()), statusProgress, SLOT(reset())); | 26 | connect(mailView, SIGNAL(resetProgress()), status, SLOT(resetProgress())); |
29 | connect(mailView, SIGNAL(stopEnabled(bool)), stopButton, SLOT(setEnabled(bool))); | 27 | connect(mailView, SIGNAL(stopEnabled(bool)), status, SLOT(setStopEnabled(bool))); |
30 | 28 | ||
31 | connect(stopButton, SIGNAL(clicked()), mailView, SLOT(stop())); | 29 | connect(status, SIGNAL(stop()), mailView, SLOT(stop())); |
32 | 30 | ||
33 | connect(compose, SIGNAL(activated()), SLOT(slotCompose())); | 31 | connect(compose, SIGNAL(activated()), SLOT(slotCompose())); |
34 | connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued())); | 32 | connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued())); |
35 | connect(findmails, SIGNAL(activated()), SLOT(slotSearch())); | 33 | connect(findmails, SIGNAL(activated()), SLOT(slotSearch())); |
36 | connect(configure, SIGNAL(activated()), SLOT(slotConfigure())); | 34 | connect(configure, SIGNAL(activated()), SLOT(slotConfigure())); |
37 | } | 35 | } |
38 | 36 | ||
39 | void MainWindow::slotCompose() | 37 | void MainWindow::slotCompose() |
40 | { | 38 | { |
41 | Composer composer(this, 0, true); | 39 | Composer composer(this, 0, true); |
42 | composer.showMaximized(); | 40 | composer.showMaximized(); |
43 | composer.exec(); | 41 | composer.exec(); |
44 | } | 42 | } |
45 | 43 | ||
46 | void MainWindow::slotSendQueued() | 44 | void MainWindow::slotSendQueued() |
47 | { | 45 | { |
48 | Composer composer(this, 0, true, true); | 46 | Composer composer(this, 0, true, true); |
49 | // composer.sendQueue(); | 47 | // composer.sendQueue(); |
50 | composer.showMaximized(); | 48 | composer.showMaximized(); |
51 | composer.exec(); | 49 | composer.exec(); |
52 | //composer.close(); | 50 | //composer.close(); |
53 | } | 51 | } |
54 | 52 | ||
55 | void MainWindow::slotSearch() | 53 | void MainWindow::slotSearch() |
56 | { | 54 | { |
57 | SearchDiag searchDiag(this, 0, true); | 55 | SearchDiag searchDiag(this, 0, true); |
58 | searchDiag.showMaximized(); | 56 | searchDiag.showMaximized(); |
59 | searchDiag.exec(); | 57 | searchDiag.exec(); |
60 | } | 58 | } |
61 | 59 | ||
62 | void MainWindow::slotConfigure() | 60 | void MainWindow::slotConfigure() |
63 | { | 61 | { |
64 | ConfigDiag configDiag(this, 0, true); | 62 | ConfigDiag configDiag(this, 0, true); |
65 | configDiag.showMaximized(); | 63 | configDiag.showMaximized(); |
66 | configDiag.exec(); | 64 | configDiag.exec(); |
67 | 65 | ||
68 | connect(&configDiag, SIGNAL(changed()), folderView, SLOT(update())); | 66 | connect(&configDiag, SIGNAL(changed()), folderView, SLOT(update())); |
69 | } | 67 | } |
70 | 68 | ||
71 | void MainWindow::mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler) | 69 | void MainWindow::mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler) |
72 | { | 70 | { |
73 | ViewMail viewMail(mail, handler, this, 0, true); | 71 | ViewMail viewMail(mail, handler, this, 0, true); |
74 | viewMail.showMaximized(); | 72 | viewMail.showMaximized(); |
75 | viewMail.exec(); | 73 | viewMail.exec(); |
76 | } | 74 | } |
diff --git a/noncore/unsupported/mail2/mainwindowbase.cpp b/noncore/unsupported/mail2/mainwindowbase.cpp index bffe8b3..e35d489 100644 --- a/noncore/unsupported/mail2/mainwindowbase.cpp +++ b/noncore/unsupported/mail2/mainwindowbase.cpp | |||
@@ -1,91 +1,75 @@ | |||
1 | #include <qprogressbar.h> | ||
2 | #include <qtoolbutton.h> | ||
3 | #include <qpopupmenu.h> | 1 | #include <qpopupmenu.h> |
4 | #include <qaction.h> | 2 | #include <qaction.h> |
5 | #include <qheader.h> | 3 | #include <qheader.h> |
6 | #include <qlabel.h> | 4 | #include <qlabel.h> |
7 | #include <qvbox.h> | 5 | #include <qvbox.h> |
8 | 6 | ||
9 | #include <qpe/qpetoolbar.h> | 7 | #include <qpe/qpetoolbar.h> |
10 | #include <qpe/qpemenubar.h> | 8 | #include <qpe/qpemenubar.h> |
11 | #include <qpe/resource.h> | 9 | #include <qpe/resource.h> |
12 | 10 | ||
13 | #include "mainwindowbase.h" | 11 | #include "mainwindowbase.h" |
12 | #include "mailstatusbar.h" | ||
14 | #include "folderwidget.h" | 13 | #include "folderwidget.h" |
15 | #include "mailtable.h" | 14 | #include "mailtable.h" |
16 | 15 | ||
17 | MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) | 16 | MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) |
18 | : QMainWindow(parent, name, fl) | 17 | : QMainWindow(parent, name, fl) |
19 | { | 18 | { |
20 | setCaption(tr("E-Mail")); | 19 | setCaption(tr("E-Mail")); |
21 | setToolBarsMovable(false); | 20 | setToolBarsMovable(false); |
22 | 21 | ||
23 | toolbar = new QPEToolBar(this); | 22 | toolbar = new QPEToolBar(this); |
24 | menubar = new QPEMenuBar( toolbar ); | 23 | menubar = new QPEMenuBar( toolbar ); |
25 | mailmenu = new QPopupMenu( menubar ); | 24 | mailmenu = new QPopupMenu( menubar ); |
26 | servermenu = new QPopupMenu( menubar ); | 25 | servermenu = new QPopupMenu( menubar ); |
27 | menubar->insertItem( tr( "Mail" ), mailmenu ); | 26 | menubar->insertItem( tr( "Mail" ), mailmenu ); |
28 | menubar->insertItem( tr( "Servers" ), servermenu ); | 27 | menubar->insertItem( tr( "Servers" ), servermenu ); |
29 | 28 | ||
30 | addToolBar(toolbar); | 29 | addToolBar(toolbar); |
31 | toolbar->setHorizontalStretchable(true); | 30 | toolbar->setHorizontalStretchable(true); |
32 | 31 | ||
33 | QLabel *spacer = new QLabel(toolbar); | 32 | QLabel *spacer = new QLabel(toolbar); |
34 | spacer->setBackgroundMode(QWidget::PaletteButton); | 33 | spacer->setBackgroundMode(QWidget::PaletteButton); |
35 | toolbar->setStretchableWidget(spacer); | 34 | toolbar->setStretchableWidget(spacer); |
36 | 35 | ||
37 | compose = new QAction(tr("Compose new mail"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this); | 36 | compose = new QAction(tr("Compose new mail"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this); |
38 | compose->addTo(toolbar); | 37 | compose->addTo(toolbar); |
39 | compose->addTo(mailmenu); | 38 | compose->addTo(mailmenu); |
40 | 39 | ||
41 | sendQueue = new QAction(tr("Send queued mails"), QIconSet(Resource::loadPixmap("mail/sendqueue")), 0, 0, this); | 40 | sendQueue = new QAction(tr("Send queued mails"), QIconSet(Resource::loadPixmap("mail/sendqueue")), 0, 0, this); |
42 | sendQueue->addTo(toolbar); | 41 | sendQueue->addTo(toolbar); |
43 | sendQueue->addTo(mailmenu); | 42 | sendQueue->addTo(mailmenu); |
44 | 43 | ||
45 | folders = new QAction(tr("Show/hide folders"), QIconSet(Resource::loadPixmap("mail/folder")), 0, 0, this, 0, true); | 44 | folders = new QAction(tr("Show/hide folders"), QIconSet(Resource::loadPixmap("mail/folder")), 0, 0, this, 0, true); |
46 | folders->addTo(toolbar); | 45 | folders->addTo(toolbar); |
47 | folders->addTo(servermenu); | 46 | folders->addTo(servermenu); |
48 | connect(folders, SIGNAL(toggled(bool)), SLOT(slotFoldersToggled(bool))); | 47 | connect(folders, SIGNAL(toggled(bool)), SLOT(slotFoldersToggled(bool))); |
49 | 48 | ||
50 | findmails = new QAction(tr("Search mails"), QIconSet(Resource::loadPixmap("mail/find")), 0, 0, this); | 49 | findmails = new QAction(tr("Search mails"), QIconSet(Resource::loadPixmap("mail/find")), 0, 0, this); |
51 | findmails->addTo(toolbar); | 50 | findmails->addTo(toolbar); |
52 | findmails->addTo(mailmenu); | 51 | findmails->addTo(mailmenu); |
53 | 52 | ||
54 | configure = new QAction(tr("Configuration"), QIconSet(Resource::loadPixmap("mail/configure")), 0, 0, this); | 53 | configure = new QAction(tr("Configuration"), QIconSet(Resource::loadPixmap("mail/configure")), 0, 0, this); |
55 | configure->addTo(servermenu); | 54 | configure->addTo(servermenu); |
56 | 55 | ||
57 | QVBox *view = new QVBox(this); | 56 | QVBox *view = new QVBox(this); |
58 | setCentralWidget(view); | 57 | setCentralWidget(view); |
59 | 58 | ||
60 | folderView = new FolderWidget(view); | 59 | folderView = new FolderWidget(view); |
61 | folderView->setMinimumHeight(90); | 60 | folderView->setMinimumHeight(90); |
62 | folderView->setMaximumHeight(90); | 61 | folderView->setMaximumHeight(90); |
63 | folderView->hide(); | 62 | folderView->hide(); |
64 | 63 | ||
65 | mailView = new MailTable(view); | 64 | mailView = new MailTable(view); |
66 | mailView->setMinimumHeight(50); | 65 | mailView->setMinimumHeight(50); |
67 | 66 | ||
68 | QHBox *status = new QHBox(view); | 67 | status = new MailStatusBar(view); |
69 | |||
70 | statusLabel = new QLabel(status); | ||
71 | QFont tmpFont = statusLabel->font(); | ||
72 | tmpFont.setPixelSize(8); | ||
73 | statusLabel->setFont(tmpFont); | ||
74 | |||
75 | stopButton = new QToolButton(status); | ||
76 | stopButton->setText(" X "); | ||
77 | stopButton->setMaximumHeight(15); | ||
78 | stopButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
79 | |||
80 | statusProgress = new QProgressBar(status); | ||
81 | statusProgress->setCenterIndicator(true); | ||
82 | statusProgress->setMaximumHeight(15); | ||
83 | statusProgress->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
84 | } | 68 | } |
85 | 69 | ||
86 | void MainWindowBase::slotFoldersToggled(bool toggled) | 70 | void MainWindowBase::slotFoldersToggled(bool toggled) |
87 | { | 71 | { |
88 | if (folderView->isHidden() && toggled) folderView->show(); | 72 | if (folderView->isHidden() && toggled) folderView->show(); |
89 | if (!folderView->isHidden() && !toggled) folderView->hide(); | 73 | if (!folderView->isHidden() && !toggled) folderView->hide(); |
90 | } | 74 | } |
91 | 75 | ||
diff --git a/noncore/unsupported/mail2/mainwindowbase.h b/noncore/unsupported/mail2/mainwindowbase.h index 702933a..11c5ea0 100644 --- a/noncore/unsupported/mail2/mainwindowbase.h +++ b/noncore/unsupported/mail2/mainwindowbase.h | |||
@@ -1,41 +1,37 @@ | |||
1 | #ifndef MAINWINDOWBASE_H | 1 | #ifndef MAINWINDOWBASE_H |
2 | #define MAINWINDOWBASE_H | 2 | #define MAINWINDOWBASE_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | 5 | ||
6 | class ServerConnection; | 6 | class ServerConnection; |
7 | class QProgressBar; | 7 | class MailStatusBar; |
8 | class FolderWidget; | 8 | class FolderWidget; |
9 | class QToolButton; | ||
10 | class QPEToolBar; | 9 | class QPEToolBar; |
11 | class QPEMenuBar; | 10 | class QPEMenuBar; |
12 | class QPopupMenu; | 11 | class QPopupMenu; |
13 | class MailTable; | 12 | class MailTable; |
14 | class QAction; | 13 | class QAction; |
15 | class QLabel; | ||
16 | 14 | ||
17 | class MainWindowBase : public QMainWindow | 15 | class MainWindowBase : public QMainWindow |
18 | { | 16 | { |
19 | Q_OBJECT | 17 | Q_OBJECT |
20 | 18 | ||
21 | public: | 19 | public: |
22 | MainWindowBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 20 | MainWindowBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); |
23 | 21 | ||
24 | protected slots: | 22 | protected slots: |
25 | void slotFoldersToggled(bool toggled); | 23 | void slotFoldersToggled(bool toggled); |
26 | 24 | ||
27 | protected: | 25 | protected: |
28 | ServerConnection *serverConnection; | 26 | ServerConnection *serverConnection; |
29 | QProgressBar *statusProgress; | 27 | MailStatusBar *status; |
30 | FolderWidget *folderView; | 28 | FolderWidget *folderView; |
31 | QToolButton *stopButton; | ||
32 | QPEToolBar *toolbar; | 29 | QPEToolBar *toolbar; |
33 | QPEMenuBar *menubar; | 30 | QPEMenuBar *menubar; |
34 | QPopupMenu *mailmenu, *servermenu; | 31 | QPopupMenu *mailmenu, *servermenu; |
35 | MailTable *mailView; | 32 | MailTable *mailView; |
36 | QAction *compose, *sendQueue, *folders, *findmails, *configure; | 33 | QAction *compose, *sendQueue, *folders, *findmails, *configure; |
37 | QLabel *statusLabel; | ||
38 | 34 | ||
39 | }; | 35 | }; |
40 | 36 | ||
41 | #endif | 37 | #endif |