Diffstat (limited to 'noncore/net/mail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 5da2161..0669b5a 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -46,194 +46,194 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | |||
46 | slotComposeMail(); | 46 | slotComposeMail(); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 50 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
51 | { | 51 | { |
52 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 52 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
53 | if (!email.isEmpty()) | 53 | if (!email.isEmpty()) |
54 | { | 54 | { |
55 | if (!name.isEmpty()) | 55 | if (!name.isEmpty()) |
56 | { | 56 | { |
57 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 57 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
58 | } | 58 | } |
59 | else | 59 | else |
60 | { | 60 | { |
61 | compose.setTo(email); | 61 | compose.setTo(email); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | compose.slotAdjustColumns(); | 64 | compose.slotAdjustColumns(); |
65 | QPEApplication::execDialog( &compose ); | 65 | QPEApplication::execDialog( &compose ); |
66 | } | 66 | } |
67 | 67 | ||
68 | void OpieMail::slotComposeMail() | 68 | void OpieMail::slotComposeMail() |
69 | { | 69 | { |
70 | qDebug( "Compose Mail" ); | 70 | odebug << "Compose Mail" << oendl; |
71 | slotwriteMail(0l,0l); | 71 | slotwriteMail(0l,0l); |
72 | } | 72 | } |
73 | 73 | ||
74 | void OpieMail::slotSendQueued() | 74 | void OpieMail::slotSendQueued() |
75 | { | 75 | { |
76 | qDebug( "Send Queued" ); | 76 | odebug << "Send Queued" << oendl; |
77 | SMTPaccount *smtp = 0; | 77 | SMTPaccount *smtp = 0; |
78 | 78 | ||
79 | QList<Account> list = settings->getAccounts(); | 79 | QList<Account> list = settings->getAccounts(); |
80 | QList<SMTPaccount> smtpList; | 80 | QList<SMTPaccount> smtpList; |
81 | smtpList.setAutoDelete(false); | 81 | smtpList.setAutoDelete(false); |
82 | Account *it; | 82 | Account *it; |
83 | for ( it = list.first(); it; it = list.next() ) | 83 | for ( it = list.first(); it; it = list.next() ) |
84 | { | 84 | { |
85 | if ( it->getType() == MAILLIB::A_SMTP ) | 85 | if ( it->getType() == MAILLIB::A_SMTP ) |
86 | { | 86 | { |
87 | smtp = static_cast<SMTPaccount *>(it); | 87 | smtp = static_cast<SMTPaccount *>(it); |
88 | smtpList.append(smtp); | 88 | smtpList.append(smtp); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | if (smtpList.count()==0) | 91 | if (smtpList.count()==0) |
92 | { | 92 | { |
93 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); | 93 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); |
94 | return; | 94 | return; |
95 | } | 95 | } |
96 | if (smtpList.count()==1) | 96 | if (smtpList.count()==1) |
97 | { | 97 | { |
98 | smtp = smtpList.at(0); | 98 | smtp = smtpList.at(0); |
99 | } | 99 | } |
100 | else | 100 | else |
101 | { | 101 | { |
102 | smtp = 0; | 102 | smtp = 0; |
103 | selectsmtp selsmtp; | 103 | selectsmtp selsmtp; |
104 | selsmtp.setSelectionlist(&smtpList); | 104 | selsmtp.setSelectionlist(&smtpList); |
105 | if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) | 105 | if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) |
106 | { | 106 | { |
107 | smtp = selsmtp.selected_smtp(); | 107 | smtp = selsmtp.selected_smtp(); |
108 | } | 108 | } |
109 | } | 109 | } |
110 | if (smtp) | 110 | if (smtp) |
111 | { | 111 | { |
112 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 112 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
113 | if ( wrap->flushOutbox() ) | 113 | if ( wrap->flushOutbox() ) |
114 | { | 114 | { |
115 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 115 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
116 | } | 116 | } |
117 | delete wrap; | 117 | delete wrap; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | void OpieMail::slotSearchMails() | 121 | void OpieMail::slotSearchMails() |
122 | { | 122 | { |
123 | qDebug( "Search Mails" ); | 123 | odebug << "Search Mails" << oendl; |
124 | } | 124 | } |
125 | 125 | ||
126 | void OpieMail::slotEditSettings() | 126 | void OpieMail::slotEditSettings() |
127 | { | 127 | { |
128 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 128 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
129 | QPEApplication::execDialog( &settingsDialog ); | 129 | QPEApplication::execDialog( &settingsDialog ); |
130 | } | 130 | } |
131 | 131 | ||
132 | void OpieMail::slotEditAccounts() | 132 | void OpieMail::slotEditAccounts() |
133 | { | 133 | { |
134 | qDebug( "Edit Accounts" ); | 134 | odebug << "Edit Accounts" << oendl; |
135 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 135 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
136 | eaDialog.slotAdjustColumns(); | 136 | eaDialog.slotAdjustColumns(); |
137 | QPEApplication::execDialog( &eaDialog ); | 137 | QPEApplication::execDialog( &eaDialog ); |
138 | if ( settings ) delete settings; | 138 | if ( settings ) delete settings; |
139 | settings = new Settings(); | 139 | settings = new Settings(); |
140 | 140 | ||
141 | folderView->populate( settings->getAccounts() ); | 141 | folderView->populate( settings->getAccounts() ); |
142 | } | 142 | } |
143 | 143 | ||
144 | void OpieMail::displayMail() | 144 | void OpieMail::displayMail() |
145 | { | 145 | { |
146 | QListViewItem*item = mailView->currentItem(); | 146 | QListViewItem*item = mailView->currentItem(); |
147 | if (!item) return; | 147 | if (!item) return; |
148 | RecMailP mail = ((MailListViewItem*)item)->data(); | 148 | RecMailP mail = ((MailListViewItem*)item)->data(); |
149 | RecBodyP body = folderView->fetchBody(mail); | 149 | RecBodyP body = folderView->fetchBody(mail); |
150 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 150 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
151 | readMail.setBody( body ); | 151 | readMail.setBody( body ); |
152 | readMail.setMail( mail ); | 152 | readMail.setMail( mail ); |
153 | readMail.showMaximized(); | 153 | readMail.showMaximized(); |
154 | readMail.exec(); | 154 | readMail.exec(); |
155 | 155 | ||
156 | if ( readMail.deleted ) | 156 | if ( readMail.deleted ) |
157 | { | 157 | { |
158 | folderView->refreshCurrent(); | 158 | folderView->refreshCurrent(); |
159 | } | 159 | } |
160 | else | 160 | else |
161 | { | 161 | { |
162 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); | 162 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | void OpieMail::slotDeleteMail() | 166 | void OpieMail::slotDeleteMail() |
167 | { | 167 | { |
168 | if (!mailView->currentItem()) return; | 168 | if (!mailView->currentItem()) return; |
169 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 169 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
170 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 170 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
171 | { | 171 | { |
172 | mail->Wrapper()->deleteMail( mail ); | 172 | mail->Wrapper()->deleteMail( mail ); |
173 | folderView->refreshCurrent(); | 173 | folderView->refreshCurrent(); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 177 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
178 | { | 178 | { |
179 | if (!mailView->currentItem()) return; | 179 | if (!mailView->currentItem()) return; |
180 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 180 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
181 | /* just the RIGHT button - or hold on pda */ | 181 | /* just the RIGHT button - or hold on pda */ |
182 | if (button!=2) {return;} | 182 | if (button!=2) {return;} |
183 | qDebug("Event right/hold"); | 183 | odebug << "Event right/hold" << oendl; |
184 | if (!item) return; | 184 | if (!item) return; |
185 | QPopupMenu *m = new QPopupMenu(0); | 185 | QPopupMenu *m = new QPopupMenu(0); |
186 | if (m) | 186 | if (m) |
187 | { | 187 | { |
188 | if (mailtype==MAILLIB::A_NNTP) { | 188 | if (mailtype==MAILLIB::A_NNTP) { |
189 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 189 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
190 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 190 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
191 | } else { | 191 | } else { |
192 | if (folderView->currentisDraft()) { | 192 | if (folderView->currentisDraft()) { |
193 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 193 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
194 | } | 194 | } |
195 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 195 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
196 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 196 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
197 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); | 197 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); |
198 | } | 198 | } |
199 | m->setFocus(); | 199 | m->setFocus(); |
200 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 200 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
201 | delete m; | 201 | delete m; |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | void OpieMail::slotShowFolders( bool show ) | 205 | void OpieMail::slotShowFolders( bool show ) |
206 | { | 206 | { |
207 | qDebug( "Show Folders" ); | 207 | odebug << "Show Folders" << oendl; |
208 | if ( show && folderView->isHidden() ) | 208 | if ( show && folderView->isHidden() ) |
209 | { | 209 | { |
210 | qDebug( "-> showing" ); | 210 | odebug << "-> showing" << oendl; |
211 | folderView->show(); | 211 | folderView->show(); |
212 | } | 212 | } |
213 | else if ( !show && !folderView->isHidden() ) | 213 | else if ( !show && !folderView->isHidden() ) |
214 | { | 214 | { |
215 | qDebug( "-> hiding" ); | 215 | odebug << "-> hiding" << oendl; |
216 | folderView->hide(); | 216 | folderView->hide(); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 220 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
221 | { | 221 | { |
222 | MailListViewItem*item = 0; | 222 | MailListViewItem*item = 0; |
223 | mailView->clear(); | 223 | mailView->clear(); |
224 | 224 | ||
225 | QValueList<RecMailP>::ConstIterator it; | 225 | QValueList<RecMailP>::ConstIterator it; |
226 | for (it = list.begin(); it != list.end();++it) | 226 | for (it = list.begin(); it != list.end();++it) |
227 | { | 227 | { |
228 | item = new MailListViewItem(mailView,item); | 228 | item = new MailListViewItem(mailView,item); |
229 | item->storeData((*it)); | 229 | item->storeData((*it)); |
230 | item->showEntry(); | 230 | item->showEntry(); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | 233 | ||
234 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) | 234 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) |
235 | { | 235 | { |
236 | /* just LEFT button - or tap with stylus on pda */ | 236 | /* just LEFT button - or tap with stylus on pda */ |
237 | if (button!=1) return; | 237 | if (button!=1) return; |
238 | if (!item) return; | 238 | if (!item) return; |
239 | if (folderView->currentisDraft()) { | 239 | if (folderView->currentisDraft()) { |