author | alwin <alwin> | 2004-10-26 19:23:23 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-10-26 19:23:23 (UTC) |
commit | c95aeb8fd283fe9d2f220209e696726120857257 (patch) (unidiff) | |
tree | e7ea89f2c7a74f30af99466eef07b279c5adf53a | |
parent | 8d8b23bff18b8afd42840ef1d4574ef3ea9f8cee (diff) | |
download | opie-c95aeb8fd283fe9d2f220209e696726120857257.zip opie-c95aeb8fd283fe9d2f220209e696726120857257.tar.gz opie-c95aeb8fd283fe9d2f220209e696726120857257.tar.bz2 |
commented out useless example code (forgot it)
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 5654476..2bbc8f1 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -1,394 +1,394 @@ | |||
1 | 1 | ||
2 | #include "settingsdialog.h" | 2 | #include "settingsdialog.h" |
3 | #include "opiemail.h" | 3 | #include "opiemail.h" |
4 | #include "editaccounts.h" | 4 | #include "editaccounts.h" |
5 | #include "composemail.h" | 5 | #include "composemail.h" |
6 | #include "mailistviewitem.h" | 6 | #include "mailistviewitem.h" |
7 | #include "viewmail.h" | 7 | #include "viewmail.h" |
8 | #include "selectstore.h" | 8 | #include "selectstore.h" |
9 | #include "selectsmtp.h" | 9 | #include "selectsmtp.h" |
10 | 10 | ||
11 | #include <libmailwrapper/smtpwrapper.h> | 11 | #include <libmailwrapper/smtpwrapper.h> |
12 | #include <libmailwrapper/mailtypes.h> | 12 | #include <libmailwrapper/mailtypes.h> |
13 | #include <libmailwrapper/abstractmail.h> | 13 | #include <libmailwrapper/abstractmail.h> |
14 | /* OPIE */ | 14 | /* OPIE */ |
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
18 | 18 | ||
19 | /* QT */ | 19 | /* QT */ |
20 | #include <qmap.h> | 20 | #include <qmap.h> |
21 | #include <qvaluelist.h> | 21 | #include <qvaluelist.h> |
22 | 22 | ||
23 | /* UNIX */ | 23 | /* UNIX */ |
24 | #include <signal.h> | 24 | #include <signal.h> |
25 | 25 | ||
26 | using namespace Opie::Core; | 26 | using namespace Opie::Core; |
27 | 27 | ||
28 | typedef QMapNode<QString,QString> tkeyvalues; | 28 | typedef QMapNode<QString,QString> tkeyvalues; |
29 | typedef QValueList<tkeyvalues> tvaluelist; | 29 | typedef QValueList<tkeyvalues> tvaluelist; |
30 | 30 | ||
31 | class ValueExplode | 31 | class ValueExplode |
32 | { | 32 | { |
33 | protected: | 33 | protected: |
34 | //! what was parsed last | 34 | //! what was parsed last |
35 | tvaluelist m_LastParsed; | 35 | tvaluelist m_LastParsed; |
36 | //! the delemiter to use | 36 | //! the delemiter to use |
37 | QString mDelemiter; | 37 | QString mDelemiter; |
38 | //! the inner delemiter | 38 | //! the inner delemiter |
39 | QString m2Delemiter; | 39 | QString m2Delemiter; |
40 | //! the real split routine | 40 | //! the real split routine |
41 | void splitit(); | 41 | void splitit(); |
42 | //! the content | 42 | //! the content |
43 | QString m_Command; | 43 | QString m_Command; |
44 | //! constructor | 44 | //! constructor |
45 | ValueExplode(){} | 45 | ValueExplode(){} |
46 | public: | 46 | public: |
47 | //! constructor | 47 | //! constructor |
48 | /*! | 48 | /*! |
49 | * \param aCommand the string to be splitted | 49 | * \param aCommand the string to be splitted |
50 | * \param aDelemiter which sign will be the delemiter character | 50 | * \param aDelemiter which sign will be the delemiter character |
51 | * \param a2Delemiter which sign will delemiter the key-value-pairs between other delemiters | 51 | * \param a2Delemiter which sign will delemiter the key-value-pairs between other delemiters |
52 | */ | 52 | */ |
53 | ValueExplode(const QString&aCommand,const char aDelemiter = '&',const char a2Delemiter='='); | 53 | ValueExplode(const QString&aCommand,const char aDelemiter = '&',const char a2Delemiter='='); |
54 | //! destructor | 54 | //! destructor |
55 | virtual ~ValueExplode(); | 55 | virtual ~ValueExplode(); |
56 | //! assigen operator | 56 | //! assigen operator |
57 | /*! | 57 | /*! |
58 | * \return a list of substrings | 58 | * \return a list of substrings |
59 | */ | 59 | */ |
60 | operator const tvaluelist& (){return m_LastParsed;} | 60 | operator const tvaluelist& (){return m_LastParsed;} |
61 | }; | 61 | }; |
62 | 62 | ||
63 | ValueExplode::~ValueExplode() | 63 | ValueExplode::~ValueExplode() |
64 | { | 64 | { |
65 | } | 65 | } |
66 | 66 | ||
67 | ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const char a2Delemiter) | 67 | ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const char a2Delemiter) |
68 | :m_LastParsed(),m_Command(aCommand) | 68 | :m_LastParsed(),m_Command(aCommand) |
69 | { | 69 | { |
70 | mDelemiter = aDelemiter; | 70 | mDelemiter = aDelemiter; |
71 | m2Delemiter = a2Delemiter; | 71 | m2Delemiter = a2Delemiter; |
72 | splitit(); | 72 | splitit(); |
73 | } | 73 | } |
74 | 74 | ||
75 | void ValueExplode::splitit() | 75 | void ValueExplode::splitit() |
76 | { | 76 | { |
77 | QString iLine; | 77 | QString iLine; |
78 | m_LastParsed.clear(); | 78 | m_LastParsed.clear(); |
79 | if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) { | 79 | if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) { |
80 | m_LastParsed.append(tkeyvalues(m_Command,"")); | 80 | m_LastParsed.append(tkeyvalues(m_Command,"")); |
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | int pos,pos2,startpos; | 83 | int pos,pos2,startpos; |
84 | startpos = 0; | 84 | startpos = 0; |
85 | iLine = m_Command; | 85 | iLine = m_Command; |
86 | while ( (pos = iLine.find(mDelemiter,startpos))!=-1) { | 86 | while ( (pos = iLine.find(mDelemiter,startpos))!=-1) { |
87 | pos2 = iLine.find(m2Delemiter,startpos); | 87 | pos2 = iLine.find(m2Delemiter,startpos); |
88 | if (pos2==-1||pos2>pos) { | 88 | if (pos2==-1||pos2>pos) { |
89 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),"")); | 89 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),"")); |
90 | } else { | 90 | } else { |
91 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1,pos-pos2-1))); | 91 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1,pos-pos2-1))); |
92 | } | 92 | } |
93 | startpos = pos+1; | 93 | startpos = pos+1; |
94 | } | 94 | } |
95 | if (startpos<iLine.length()) { | 95 | if (startpos<iLine.length()) { |
96 | pos2 = iLine.find(m2Delemiter,startpos); | 96 | pos2 = iLine.find(m2Delemiter,startpos); |
97 | if (pos2==-1) { | 97 | if (pos2==-1) { |
98 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos),"")); | 98 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos),"")); |
99 | } else { | 99 | } else { |
100 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1))); | 100 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1))); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags ) | 105 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags ) |
106 | : MainWindow( parent, name, WStyle_ContextHelp ) | 106 | : MainWindow( parent, name, WStyle_ContextHelp ) |
107 | { | 107 | { |
108 | setup_signalblocking(); | 108 | setup_signalblocking(); |
109 | settings = new Settings(); | 109 | settings = new Settings(); |
110 | 110 | ||
111 | folderView->populate( settings->getAccounts() ); | 111 | folderView->populate( settings->getAccounts() ); |
112 | #if 1 | 112 | #if 0 |
113 | tvaluelist s = ValueExplode("a=1&b=holladiewaldfee&c=3&d=&e=3450"); | 113 | tvaluelist s = ValueExplode("a=1&b=holladiewaldfee&c=3&d=&e=3450"); |
114 | for (int i = 0; i < s.count();++i) { | 114 | for (int i = 0; i < s.count();++i) { |
115 | odebug<<"Key: " << s[i].key << " Value: " << s[i].data << oendl; | 115 | odebug<<"Key: " << s[i].key << " Value: " << s[i].data << oendl; |
116 | } | 116 | } |
117 | #endif | 117 | #endif |
118 | } | 118 | } |
119 | 119 | ||
120 | OpieMail::~OpieMail() | 120 | OpieMail::~OpieMail() |
121 | { | 121 | { |
122 | if (settings) delete settings; | 122 | if (settings) delete settings; |
123 | } | 123 | } |
124 | 124 | ||
125 | void OpieMail::setup_signalblocking() | 125 | void OpieMail::setup_signalblocking() |
126 | { | 126 | { |
127 | /* for networking we must block SIGPIPE and Co. */ | 127 | /* for networking we must block SIGPIPE and Co. */ |
128 | struct sigaction blocking_action,temp_action; | 128 | struct sigaction blocking_action,temp_action; |
129 | blocking_action.sa_handler = SIG_IGN; | 129 | blocking_action.sa_handler = SIG_IGN; |
130 | sigemptyset(&(blocking_action.sa_mask)); | 130 | sigemptyset(&(blocking_action.sa_mask)); |
131 | blocking_action.sa_flags = 0; | 131 | blocking_action.sa_flags = 0; |
132 | sigaction(SIGPIPE,&blocking_action,&temp_action); | 132 | sigaction(SIGPIPE,&blocking_action,&temp_action); |
133 | } | 133 | } |
134 | 134 | ||
135 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 135 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
136 | { | 136 | { |
137 | // copied from old mail2 | 137 | // copied from old mail2 |
138 | if (msg == "writeMail(QString,QString)") | 138 | if (msg == "writeMail(QString,QString)") |
139 | { | 139 | { |
140 | QDataStream stream(data,IO_ReadOnly); | 140 | QDataStream stream(data,IO_ReadOnly); |
141 | QString name, email; | 141 | QString name, email; |
142 | stream >> name >> email; | 142 | stream >> name >> email; |
143 | // removing the whitespaces at beginning and end is needed! | 143 | // removing the whitespaces at beginning and end is needed! |
144 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 144 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
145 | } | 145 | } |
146 | else if (msg == "newMail()") | 146 | else if (msg == "newMail()") |
147 | { | 147 | { |
148 | slotComposeMail(); | 148 | slotComposeMail(); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | /** | 152 | /** |
153 | * Konqueror calls us with the mailto:name@address | 153 | * Konqueror calls us with the mailto:name@address |
154 | */ | 154 | */ |
155 | void OpieMail::setDocument(const QString& mail) | 155 | void OpieMail::setDocument(const QString& mail) |
156 | { | 156 | { |
157 | /* | 157 | /* |
158 | * It looks like a mailto address, lets try it | 158 | * It looks like a mailto address, lets try it |
159 | */ | 159 | */ |
160 | if( mail.startsWith(QString::fromLatin1("mailto:")) ) | 160 | if( mail.startsWith(QString::fromLatin1("mailto:")) ) |
161 | slotwriteMail(QString::null, mail.mid(7)); | 161 | slotwriteMail(QString::null, mail.mid(7)); |
162 | } | 162 | } |
163 | 163 | ||
164 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 164 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
165 | { | 165 | { |
166 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 166 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
167 | if (!email.isEmpty()) | 167 | if (!email.isEmpty()) |
168 | { | 168 | { |
169 | if (!name.isEmpty()) | 169 | if (!name.isEmpty()) |
170 | { | 170 | { |
171 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 171 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
172 | } | 172 | } |
173 | else | 173 | else |
174 | { | 174 | { |
175 | compose.setTo(email); | 175 | compose.setTo(email); |
176 | } | 176 | } |
177 | } | 177 | } |
178 | compose.slotAdjustColumns(); | 178 | compose.slotAdjustColumns(); |
179 | QPEApplication::execDialog( &compose ); | 179 | QPEApplication::execDialog( &compose ); |
180 | } | 180 | } |
181 | 181 | ||
182 | void OpieMail::slotComposeMail() | 182 | void OpieMail::slotComposeMail() |
183 | { | 183 | { |
184 | odebug << "Compose Mail" << oendl; | 184 | odebug << "Compose Mail" << oendl; |
185 | slotwriteMail(0l,0l); | 185 | slotwriteMail(0l,0l); |
186 | } | 186 | } |
187 | 187 | ||
188 | void OpieMail::slotSendQueued() | 188 | void OpieMail::slotSendQueued() |
189 | { | 189 | { |
190 | odebug << "Send Queued" << oendl; | 190 | odebug << "Send Queued" << oendl; |
191 | SMTPaccount *smtp = 0; | 191 | SMTPaccount *smtp = 0; |
192 | 192 | ||
193 | QList<Account> list = settings->getAccounts(); | 193 | QList<Account> list = settings->getAccounts(); |
194 | QList<SMTPaccount> smtpList; | 194 | QList<SMTPaccount> smtpList; |
195 | smtpList.setAutoDelete(false); | 195 | smtpList.setAutoDelete(false); |
196 | Account *it; | 196 | Account *it; |
197 | for ( it = list.first(); it; it = list.next() ) | 197 | for ( it = list.first(); it; it = list.next() ) |
198 | { | 198 | { |
199 | if ( it->getType() == MAILLIB::A_SMTP ) | 199 | if ( it->getType() == MAILLIB::A_SMTP ) |
200 | { | 200 | { |
201 | smtp = static_cast<SMTPaccount *>(it); | 201 | smtp = static_cast<SMTPaccount *>(it); |
202 | smtpList.append(smtp); | 202 | smtpList.append(smtp); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | if (smtpList.count()==0) | 205 | if (smtpList.count()==0) |
206 | { | 206 | { |
207 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); | 207 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); |
208 | return; | 208 | return; |
209 | } | 209 | } |
210 | if (smtpList.count()==1) | 210 | if (smtpList.count()==1) |
211 | { | 211 | { |
212 | smtp = smtpList.at(0); | 212 | smtp = smtpList.at(0); |
213 | } | 213 | } |
214 | else | 214 | else |
215 | { | 215 | { |
216 | smtp = 0; | 216 | smtp = 0; |
217 | selectsmtp selsmtp; | 217 | selectsmtp selsmtp; |
218 | selsmtp.setSelectionlist(&smtpList); | 218 | selsmtp.setSelectionlist(&smtpList); |
219 | if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) | 219 | if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) |
220 | { | 220 | { |
221 | smtp = selsmtp.selected_smtp(); | 221 | smtp = selsmtp.selected_smtp(); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | if (smtp) | 224 | if (smtp) |
225 | { | 225 | { |
226 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 226 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
227 | if ( wrap->flushOutbox() ) | 227 | if ( wrap->flushOutbox() ) |
228 | { | 228 | { |
229 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 229 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
230 | } | 230 | } |
231 | delete wrap; | 231 | delete wrap; |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | void OpieMail::slotSearchMails() | 235 | void OpieMail::slotSearchMails() |
236 | { | 236 | { |
237 | odebug << "Search Mails" << oendl; | 237 | odebug << "Search Mails" << oendl; |
238 | } | 238 | } |
239 | 239 | ||
240 | void OpieMail::slotEditSettings() | 240 | void OpieMail::slotEditSettings() |
241 | { | 241 | { |
242 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 242 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
243 | QPEApplication::execDialog( &settingsDialog ); | 243 | QPEApplication::execDialog( &settingsDialog ); |
244 | } | 244 | } |
245 | 245 | ||
246 | void OpieMail::slotEditAccounts() | 246 | void OpieMail::slotEditAccounts() |
247 | { | 247 | { |
248 | odebug << "Edit Accounts" << oendl; | 248 | odebug << "Edit Accounts" << oendl; |
249 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 249 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
250 | eaDialog.slotAdjustColumns(); | 250 | eaDialog.slotAdjustColumns(); |
251 | QPEApplication::execDialog( &eaDialog ); | 251 | QPEApplication::execDialog( &eaDialog ); |
252 | if ( settings ) delete settings; | 252 | if ( settings ) delete settings; |
253 | settings = new Settings(); | 253 | settings = new Settings(); |
254 | 254 | ||
255 | folderView->populate( settings->getAccounts() ); | 255 | folderView->populate( settings->getAccounts() ); |
256 | } | 256 | } |
257 | 257 | ||
258 | void OpieMail::displayMail() | 258 | void OpieMail::displayMail() |
259 | { | 259 | { |
260 | QListViewItem*item = mailView->currentItem(); | 260 | QListViewItem*item = mailView->currentItem(); |
261 | if (!item) return; | 261 | if (!item) return; |
262 | RecMailP mail = ((MailListViewItem*)item)->data(); | 262 | RecMailP mail = ((MailListViewItem*)item)->data(); |
263 | RecBodyP body = folderView->fetchBody(mail); | 263 | RecBodyP body = folderView->fetchBody(mail); |
264 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 264 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
265 | readMail.setBody( body ); | 265 | readMail.setBody( body ); |
266 | readMail.setMail( mail ); | 266 | readMail.setMail( mail ); |
267 | readMail.showMaximized(); | 267 | readMail.showMaximized(); |
268 | readMail.exec(); | 268 | readMail.exec(); |
269 | 269 | ||
270 | if ( readMail.deleted ) | 270 | if ( readMail.deleted ) |
271 | { | 271 | { |
272 | folderView->refreshCurrent(); | 272 | folderView->refreshCurrent(); |
273 | } | 273 | } |
274 | else | 274 | else |
275 | { | 275 | { |
276 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); | 276 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | void OpieMail::slotDeleteMail() | 280 | void OpieMail::slotDeleteMail() |
281 | { | 281 | { |
282 | if (!mailView->currentItem()) return; | 282 | if (!mailView->currentItem()) return; |
283 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 283 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
284 | 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 ) | 284 | 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 ) |
285 | { | 285 | { |
286 | mail->Wrapper()->deleteMail( mail ); | 286 | mail->Wrapper()->deleteMail( mail ); |
287 | folderView->refreshCurrent(); | 287 | folderView->refreshCurrent(); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 291 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
292 | { | 292 | { |
293 | if (!mailView->currentItem()) return; | 293 | if (!mailView->currentItem()) return; |
294 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 294 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
295 | /* just the RIGHT button - or hold on pda */ | 295 | /* just the RIGHT button - or hold on pda */ |
296 | if (button!=2) {return;} | 296 | if (button!=2) {return;} |
297 | odebug << "Event right/hold" << oendl; | 297 | odebug << "Event right/hold" << oendl; |
298 | if (!item) return; | 298 | if (!item) return; |
299 | QPopupMenu *m = new QPopupMenu(0); | 299 | QPopupMenu *m = new QPopupMenu(0); |
300 | if (m) | 300 | if (m) |
301 | { | 301 | { |
302 | if (mailtype==MAILLIB::A_NNTP) { | 302 | if (mailtype==MAILLIB::A_NNTP) { |
303 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 303 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
304 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 304 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
305 | } else { | 305 | } else { |
306 | if (folderView->currentisDraft()) { | 306 | if (folderView->currentisDraft()) { |
307 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 307 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
308 | } | 308 | } |
309 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 309 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
310 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 310 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
311 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); | 311 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); |
312 | } | 312 | } |
313 | m->setFocus(); | 313 | m->setFocus(); |
314 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 314 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
315 | delete m; | 315 | delete m; |
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
319 | void OpieMail::slotShowFolders( bool show ) | 319 | void OpieMail::slotShowFolders( bool show ) |
320 | { | 320 | { |
321 | odebug << "Show Folders" << oendl; | 321 | odebug << "Show Folders" << oendl; |
322 | if ( show && folderView->isHidden() ) | 322 | if ( show && folderView->isHidden() ) |
323 | { | 323 | { |
324 | odebug << "-> showing" << oendl; | 324 | odebug << "-> showing" << oendl; |
325 | folderView->show(); | 325 | folderView->show(); |
326 | } | 326 | } |
327 | else if ( !show && !folderView->isHidden() ) | 327 | else if ( !show && !folderView->isHidden() ) |
328 | { | 328 | { |
329 | odebug << "-> hiding" << oendl; | 329 | odebug << "-> hiding" << oendl; |
330 | folderView->hide(); | 330 | folderView->hide(); |
331 | } | 331 | } |
332 | } | 332 | } |
333 | 333 | ||
334 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 334 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
335 | { | 335 | { |
336 | MailListViewItem*item = 0; | 336 | MailListViewItem*item = 0; |
337 | mailView->clear(); | 337 | mailView->clear(); |
338 | 338 | ||
339 | QValueList<RecMailP>::ConstIterator it; | 339 | QValueList<RecMailP>::ConstIterator it; |
340 | for (it = list.begin(); it != list.end();++it) | 340 | for (it = list.begin(); it != list.end();++it) |
341 | { | 341 | { |
342 | item = new MailListViewItem(mailView,item); | 342 | item = new MailListViewItem(mailView,item); |
343 | item->storeData((*it)); | 343 | item->storeData((*it)); |
344 | item->showEntry(); | 344 | item->showEntry(); |
345 | } | 345 | } |
346 | } | 346 | } |
347 | 347 | ||
348 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) | 348 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) |
349 | { | 349 | { |
350 | /* just LEFT button - or tap with stylus on pda */ | 350 | /* just LEFT button - or tap with stylus on pda */ |
351 | if (button!=1) return; | 351 | if (button!=1) return; |
352 | if (!item) return; | 352 | if (!item) return; |
353 | if (folderView->currentisDraft()) { | 353 | if (folderView->currentisDraft()) { |
354 | reEditMail(); | 354 | reEditMail(); |
355 | } else { | 355 | } else { |
356 | displayMail(); | 356 | displayMail(); |
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | void OpieMail::slotMoveCopyMail() | 360 | void OpieMail::slotMoveCopyMail() |
361 | { | 361 | { |
362 | if (!mailView->currentItem()) return; | 362 | if (!mailView->currentItem()) return; |
363 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 363 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
364 | AbstractMail*targetMail = 0; | 364 | AbstractMail*targetMail = 0; |
365 | QString targetFolder = ""; | 365 | QString targetFolder = ""; |
366 | Selectstore sels; | 366 | Selectstore sels; |
367 | folderView->setupFolderselect(&sels); | 367 | folderView->setupFolderselect(&sels); |
368 | if (!sels.exec()) return; | 368 | if (!sels.exec()) return; |
369 | targetMail = sels.currentMail(); | 369 | targetMail = sels.currentMail(); |
370 | targetFolder = sels.currentFolder(); | 370 | targetFolder = sels.currentFolder(); |
371 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 371 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
372 | targetFolder.isEmpty()) | 372 | targetFolder.isEmpty()) |
373 | { | 373 | { |
374 | return; | 374 | return; |
375 | } | 375 | } |
376 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 376 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
377 | { | 377 | { |
378 | QMessageBox::critical(0,tr("Error creating new Folder"), | 378 | QMessageBox::critical(0,tr("Error creating new Folder"), |
379 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 379 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
380 | return; | 380 | return; |
381 | } | 381 | } |
382 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 382 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
383 | folderView->refreshCurrent(); | 383 | folderView->refreshCurrent(); |
384 | } | 384 | } |
385 | 385 | ||
386 | void OpieMail::reEditMail() | 386 | void OpieMail::reEditMail() |
387 | { | 387 | { |
388 | if (!mailView->currentItem()) return; | 388 | if (!mailView->currentItem()) return; |
389 | 389 | ||
390 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 390 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
391 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 391 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
392 | compose.slotAdjustColumns(); | 392 | compose.slotAdjustColumns(); |
393 | QPEApplication::execDialog( &compose ); | 393 | QPEApplication::execDialog( &compose ); |
394 | } | 394 | } |