author | alwin <alwin> | 2004-01-05 22:21:41 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-05 22:21:41 (UTC) |
commit | c8d0dd53a75b7142a5ce924e4afbea77b86e56b0 (patch) (unidiff) | |
tree | 2845e68c4a3ee0daa7f732a29fefd81d47c90f9d | |
parent | 07278dd6ba68e3ff55d22acc76a28956b06d5d9c (diff) | |
download | opie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.zip opie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.tar.gz opie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.tar.bz2 |
bugfix in imapwrapper
storemail for all possible mail-accounts
raw body fetch in all wrappers
unified public interface
dialog for selecting a target mailbox started
-rw-r--r-- | noncore/net/mail/accountview.cpp | 33 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 74 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 13 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 11 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 17 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/mail.pro | 9 | ||||
-rw-r--r-- | noncore/net/mail/selectstore.cpp | 19 | ||||
-rw-r--r-- | noncore/net/mail/selectstore.h | 19 | ||||
-rw-r--r-- | noncore/net/mail/selectstoreui.ui | 244 |
15 files changed, 400 insertions, 55 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 77fa706..faa6982 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,312 +1,337 @@ | |||
1 | #include "accountview.h" | 1 | #include "accountview.h" |
2 | #include <libmailwrapper/mailtypes.h> | 2 | #include <libmailwrapper/mailtypes.h> |
3 | #include <libmailwrapper/abstractmail.h> | 3 | #include <libmailwrapper/abstractmail.h> |
4 | #include "defines.h" | 4 | #include "defines.h" |
5 | #include "newmaildir.h" | 5 | #include "newmaildir.h" |
6 | #include "selectstore.h" | ||
6 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
7 | #include <qpopupmenu.h> | 8 | #include <qpopupmenu.h> |
8 | 9 | ||
9 | /** | 10 | /** |
10 | * POP3 Account stuff | 11 | * POP3 Account stuff |
11 | */ | 12 | */ |
12 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) | 13 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) |
13 | : AccountViewItem( parent ) | 14 | : AccountViewItem( parent ) |
14 | { | 15 | { |
15 | account = a; | 16 | account = a; |
16 | wrapper = AbstractMail::getWrapper( account ); | 17 | wrapper = AbstractMail::getWrapper( account ); |
17 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 18 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
18 | setText( 0, account->getAccountName() ); | 19 | setText( 0, account->getAccountName() ); |
19 | setOpen( true ); | 20 | setOpen( true ); |
20 | } | 21 | } |
21 | 22 | ||
22 | POP3viewItem::~POP3viewItem() | 23 | POP3viewItem::~POP3viewItem() |
23 | { | 24 | { |
24 | delete wrapper; | 25 | delete wrapper; |
25 | } | 26 | } |
26 | 27 | ||
27 | AbstractMail *POP3viewItem::getWrapper() | 28 | AbstractMail *POP3viewItem::getWrapper() |
28 | { | 29 | { |
29 | return wrapper; | 30 | return wrapper; |
30 | } | 31 | } |
31 | 32 | ||
32 | void POP3viewItem::refresh( QList<RecMail> & ) | 33 | void POP3viewItem::refresh( QList<RecMail> & ) |
33 | { | 34 | { |
34 | QList<Folder> *folders = wrapper->listFolders(); | 35 | QList<Folder> *folders = wrapper->listFolders(); |
35 | QListViewItem *child = firstChild(); | 36 | QListViewItem *child = firstChild(); |
36 | while ( child ) { | 37 | while ( child ) { |
37 | QListViewItem *tmp = child; | 38 | QListViewItem *tmp = child; |
38 | child = child->nextSibling(); | 39 | child = child->nextSibling(); |
39 | delete tmp; | 40 | delete tmp; |
40 | } | 41 | } |
41 | Folder *it; | 42 | Folder *it; |
42 | QListViewItem*item = 0; | 43 | QListViewItem*item = 0; |
43 | for ( it = folders->first(); it; it = folders->next() ) { | 44 | for ( it = folders->first(); it; it = folders->next() ) { |
44 | item = new POP3folderItem( it, this , item ); | 45 | item = new POP3folderItem( it, this , item ); |
45 | item->setSelectable(it->may_select()); | 46 | item->setSelectable(it->may_select()); |
46 | } | 47 | } |
47 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 48 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
48 | folders->setAutoDelete(false); | 49 | folders->setAutoDelete(false); |
49 | delete folders; | 50 | delete folders; |
50 | } | 51 | } |
51 | 52 | ||
52 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) | 53 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) |
53 | { | 54 | { |
54 | qDebug( "POP3 fetchBody" ); | 55 | qDebug( "POP3 fetchBody" ); |
55 | return wrapper->fetchBody( mail ); | 56 | return wrapper->fetchBody( mail ); |
56 | } | 57 | } |
57 | 58 | ||
58 | POP3folderItem::~POP3folderItem() | 59 | POP3folderItem::~POP3folderItem() |
59 | { | 60 | { |
60 | delete folder; | 61 | delete folder; |
61 | } | 62 | } |
62 | 63 | ||
63 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) | 64 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) |
64 | : AccountViewItem( parent,after ) | 65 | : AccountViewItem( parent,after ) |
65 | { | 66 | { |
66 | folder = folderInit; | 67 | folder = folderInit; |
67 | pop3 = parent; | 68 | pop3 = parent; |
68 | if (folder->getDisplayName().lower()!="inbox") { | 69 | if (folder->getDisplayName().lower()!="inbox") { |
69 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 70 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
70 | } else { | 71 | } else { |
71 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 72 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
72 | } | 73 | } |
73 | setText( 0, folder->getDisplayName() ); | 74 | setText( 0, folder->getDisplayName() ); |
74 | } | 75 | } |
75 | 76 | ||
76 | void POP3folderItem::refresh(QList<RecMail>&target) | 77 | void POP3folderItem::refresh(QList<RecMail>&target) |
77 | { | 78 | { |
78 | if (folder->may_select()) | 79 | if (folder->may_select()) |
79 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 80 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
80 | } | 81 | } |
81 | 82 | ||
82 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) | 83 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) |
83 | { | 84 | { |
84 | return pop3->getWrapper()->fetchBody(aMail); | 85 | return pop3->getWrapper()->fetchBody(aMail); |
85 | } | 86 | } |
86 | 87 | ||
87 | QPopupMenu * POP3folderItem::getContextMenu() | 88 | QPopupMenu * POP3folderItem::getContextMenu() |
88 | { | 89 | { |
89 | QPopupMenu *m = new QPopupMenu(0); | 90 | QPopupMenu *m = new QPopupMenu(0); |
90 | if (m) { | 91 | if (m) { |
91 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 92 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
92 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 93 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
94 | m->insertItem(QObject::tr("Download all mails",contextName),2); | ||
93 | } | 95 | } |
94 | return m; | 96 | return m; |
95 | } | 97 | } |
96 | 98 | ||
99 | void POP3folderItem::downloadMails() | ||
100 | { | ||
101 | Selectstore sels; | ||
102 | sels.showMaximized(); | ||
103 | sels.exec(); | ||
104 | } | ||
105 | |||
97 | void POP3folderItem::contextMenuSelected(int which) | 106 | void POP3folderItem::contextMenuSelected(int which) |
98 | { | 107 | { |
99 | AccountView * view = (AccountView*)listView(); | 108 | AccountView * view = (AccountView*)listView(); |
100 | switch (which) { | 109 | switch (which) { |
101 | case 0: | 110 | case 0: |
111 | /* must be 'cause pop3 lists are cached */ | ||
112 | pop3->getWrapper()->logout(); | ||
102 | view->refreshCurrent(); | 113 | view->refreshCurrent(); |
103 | break; | 114 | break; |
104 | case 1: | 115 | case 1: |
105 | deleteAllMail(pop3->getWrapper(),folder); | 116 | deleteAllMail(pop3->getWrapper(),folder); |
106 | break; | 117 | break; |
118 | case 2: | ||
119 | downloadMails(); | ||
120 | break; | ||
107 | default: | 121 | default: |
108 | break; | 122 | break; |
109 | } | 123 | } |
110 | } | 124 | } |
111 | 125 | ||
112 | /** | 126 | /** |
113 | * IMAP Account stuff | 127 | * IMAP Account stuff |
114 | */ | 128 | */ |
115 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) | 129 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) |
116 | : AccountViewItem( parent ) | 130 | : AccountViewItem( parent ) |
117 | { | 131 | { |
118 | account = a; | 132 | account = a; |
119 | wrapper = AbstractMail::getWrapper( account ); | 133 | wrapper = AbstractMail::getWrapper( account ); |
120 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 134 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
121 | setText( 0, account->getAccountName() ); | 135 | setText( 0, account->getAccountName() ); |
122 | setOpen( true ); | 136 | setOpen( true ); |
123 | } | 137 | } |
124 | 138 | ||
125 | IMAPviewItem::~IMAPviewItem() | 139 | IMAPviewItem::~IMAPviewItem() |
126 | { | 140 | { |
127 | delete wrapper; | 141 | delete wrapper; |
128 | } | 142 | } |
129 | 143 | ||
130 | AbstractMail *IMAPviewItem::getWrapper() | 144 | AbstractMail *IMAPviewItem::getWrapper() |
131 | { | 145 | { |
132 | return wrapper; | 146 | return wrapper; |
133 | } | 147 | } |
134 | 148 | ||
135 | IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) | 149 | IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) |
136 | { | 150 | { |
137 | IMAPfolderItem*pitem,*sitem; | 151 | IMAPfolderItem*pitem,*sitem; |
138 | if (!start) pitem = (IMAPfolderItem*)firstChild(); | 152 | if (!start) pitem = (IMAPfolderItem*)firstChild(); |
139 | else pitem = (IMAPfolderItem*)start->firstChild(); | 153 | else pitem = (IMAPfolderItem*)start->firstChild(); |
140 | while (pitem) { | 154 | while (pitem) { |
141 | if (pitem->matchName(path)) { | 155 | if (pitem->matchName(path)) { |
142 | break; | 156 | break; |
143 | } | 157 | } |
144 | if (pitem->childCount()>0) { | 158 | if (pitem->childCount()>0) { |
145 | sitem = findSubItem(path,pitem); | 159 | sitem = findSubItem(path,pitem); |
146 | if (sitem) { | 160 | if (sitem) { |
147 | pitem = sitem; | 161 | pitem = sitem; |
148 | break; | 162 | break; |
149 | } | 163 | } |
150 | } | 164 | } |
151 | pitem=(IMAPfolderItem*)pitem->nextSibling(); | 165 | pitem=(IMAPfolderItem*)pitem->nextSibling(); |
152 | } | 166 | } |
153 | return pitem; | 167 | return pitem; |
154 | } | 168 | } |
155 | 169 | ||
156 | void IMAPviewItem::refresh(QList<RecMail>&) | 170 | void IMAPviewItem::refresh(QList<RecMail>&) |
157 | { | 171 | { |
158 | refreshFolders(false); | 172 | refreshFolders(false); |
159 | } | 173 | } |
160 | 174 | ||
161 | void IMAPviewItem::refreshFolders(bool force) | 175 | void IMAPviewItem::removeChilds() |
162 | { | 176 | { |
163 | if (childCount()>0 && force==false) return; | ||
164 | QList<Folder> *folders = wrapper->listFolders(); | ||
165 | |||
166 | QListViewItem *child = firstChild(); | 177 | QListViewItem *child = firstChild(); |
167 | while ( child ) { | 178 | while ( child ) { |
168 | QListViewItem *tmp = child; | 179 | QListViewItem *tmp = child; |
169 | child = child->nextSibling(); | 180 | child = child->nextSibling(); |
170 | delete tmp; | 181 | delete tmp; |
171 | } | 182 | } |
172 | 183 | ||
184 | } | ||
185 | |||
186 | void IMAPviewItem::refreshFolders(bool force) | ||
187 | { | ||
188 | if (childCount()>0 && force==false) return; | ||
189 | |||
190 | removeChilds(); | ||
191 | |||
192 | QList<Folder> *folders = wrapper->listFolders(); | ||
193 | |||
173 | Folder *it; | 194 | Folder *it; |
174 | QListViewItem*item = 0; | 195 | QListViewItem*item = 0; |
175 | QListViewItem*titem = 0; | 196 | QListViewItem*titem = 0; |
176 | QString fname,del,search; | 197 | QString fname,del,search; |
177 | int pos; | 198 | int pos; |
178 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 199 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
179 | folders->setAutoDelete(false); | 200 | folders->setAutoDelete(false); |
180 | 201 | ||
181 | for ( it = folders->first(); it; it = folders->next() ) { | 202 | for ( it = folders->first(); it; it = folders->next() ) { |
182 | if (it->getDisplayName().lower()=="inbox") { | 203 | if (it->getDisplayName().lower()=="inbox") { |
183 | item = new IMAPfolderItem( it, this , item ); | 204 | item = new IMAPfolderItem( it, this , item ); |
184 | folders->remove(it); | 205 | folders->remove(it); |
185 | qDebug("inbox found"); | 206 | qDebug("inbox found"); |
186 | break; | 207 | break; |
187 | } | 208 | } |
188 | } | 209 | } |
189 | for ( it = folders->first(); it; it = folders->next() ) { | 210 | for ( it = folders->first(); it; it = folders->next() ) { |
190 | fname = it->getDisplayName(); | 211 | fname = it->getDisplayName(); |
191 | pos = fname.findRev(it->Separator()); | 212 | pos = fname.findRev(it->Separator()); |
192 | if (pos != -1) { | 213 | if (pos != -1) { |
193 | fname = fname.left(pos); | 214 | fname = fname.left(pos); |
194 | } | 215 | } |
195 | IMAPfolderItem*pitem = findSubItem(fname); | 216 | IMAPfolderItem*pitem = findSubItem(fname); |
196 | if (pitem) { | 217 | if (pitem) { |
197 | titem = item; | 218 | titem = item; |
198 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); | 219 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); |
199 | /* setup the short name */ | 220 | /* setup the short name */ |
200 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); | 221 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); |
201 | item = titem; | 222 | item = titem; |
202 | } else { | 223 | } else { |
203 | item = new IMAPfolderItem( it, this , item ); | 224 | item = new IMAPfolderItem( it, this , item ); |
204 | } | 225 | } |
205 | } | 226 | } |
206 | delete folders; | 227 | delete folders; |
207 | } | 228 | } |
208 | 229 | ||
209 | QPopupMenu * IMAPviewItem::getContextMenu() | 230 | QPopupMenu * IMAPviewItem::getContextMenu() |
210 | { | 231 | { |
211 | QPopupMenu *m = new QPopupMenu(0); | 232 | QPopupMenu *m = new QPopupMenu(0); |
212 | if (m) { | 233 | if (m) { |
213 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 234 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
214 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 235 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
215 | m->insertSeparator(); | 236 | m->insertSeparator(); |
216 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 237 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
217 | } | 238 | } |
218 | return m; | 239 | return m; |
219 | } | 240 | } |
220 | 241 | ||
221 | void IMAPviewItem::createNewFolder() | 242 | void IMAPviewItem::createNewFolder() |
222 | { | 243 | { |
223 | Newmdirdlg ndirdlg; | 244 | Newmdirdlg ndirdlg; |
224 | ndirdlg.showMaximized(); | 245 | ndirdlg.showMaximized(); |
225 | if (ndirdlg.exec()) { | 246 | if (ndirdlg.exec()) { |
226 | QString ndir = ndirdlg.Newdir(); | 247 | QString ndir = ndirdlg.Newdir(); |
227 | bool makesubs = ndirdlg.subpossible(); | 248 | bool makesubs = ndirdlg.subpossible(); |
228 | QString delemiter = "/"; | 249 | QString delemiter = "/"; |
229 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 250 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
230 | if (item) { | 251 | if (item) { |
231 | delemiter = item->Delemiter(); | 252 | delemiter = item->Delemiter(); |
232 | } | 253 | } |
233 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { | 254 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { |
234 | refreshFolders(true); | 255 | refreshFolders(true); |
235 | } | 256 | } |
236 | } | 257 | } |
237 | } | 258 | } |
238 | 259 | ||
239 | void IMAPviewItem::contextMenuSelected(int id) | 260 | void IMAPviewItem::contextMenuSelected(int id) |
240 | { | 261 | { |
241 | qDebug("Id selected: %i",id); | 262 | qDebug("Id selected: %i",id); |
242 | switch (id) { | 263 | switch (id) { |
243 | case 0: | 264 | case 0: |
244 | refreshFolders(true); | 265 | refreshFolders(true); |
245 | break; | 266 | break; |
246 | case 1: | 267 | case 1: |
247 | createNewFolder(); | 268 | createNewFolder(); |
248 | break; | 269 | break; |
270 | case 2: | ||
271 | removeChilds(); | ||
272 | wrapper->logout(); | ||
273 | break; | ||
249 | default: | 274 | default: |
250 | break; | 275 | break; |
251 | } | 276 | } |
252 | } | 277 | } |
253 | 278 | ||
254 | RecBody IMAPviewItem::fetchBody(const RecMail&) | 279 | RecBody IMAPviewItem::fetchBody(const RecMail&) |
255 | { | 280 | { |
256 | return RecBody(); | 281 | return RecBody(); |
257 | } | 282 | } |
258 | 283 | ||
259 | IMAPfolderItem::~IMAPfolderItem() | 284 | IMAPfolderItem::~IMAPfolderItem() |
260 | { | 285 | { |
261 | delete folder; | 286 | delete folder; |
262 | } | 287 | } |
263 | 288 | ||
264 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) | 289 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) |
265 | : AccountViewItem( parent , after ) | 290 | : AccountViewItem( parent , after ) |
266 | { | 291 | { |
267 | folder = folderInit; | 292 | folder = folderInit; |
268 | imap = parent; | 293 | imap = parent; |
269 | if (folder->getDisplayName().lower()!="inbox") { | 294 | if (folder->getDisplayName().lower()!="inbox") { |
270 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 295 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
271 | } else { | 296 | } else { |
272 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 297 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
273 | } | 298 | } |
274 | setText( 0, folder->getDisplayName() ); | 299 | setText( 0, folder->getDisplayName() ); |
275 | } | 300 | } |
276 | 301 | ||
277 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 302 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
278 | : AccountViewItem( parent,after ) | 303 | : AccountViewItem( parent,after ) |
279 | { | 304 | { |
280 | folder = folderInit; | 305 | folder = folderInit; |
281 | imap = master; | 306 | imap = master; |
282 | if (folder->getDisplayName().lower()!="inbox") { | 307 | if (folder->getDisplayName().lower()!="inbox") { |
283 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 308 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
284 | } else { | 309 | } else { |
285 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 310 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
286 | } | 311 | } |
287 | setText( 0, folder->getDisplayName() ); | 312 | setText( 0, folder->getDisplayName() ); |
288 | } | 313 | } |
289 | 314 | ||
290 | const QString& IMAPfolderItem::Delemiter()const | 315 | const QString& IMAPfolderItem::Delemiter()const |
291 | { | 316 | { |
292 | return folder->Separator(); | 317 | return folder->Separator(); |
293 | } | 318 | } |
294 | 319 | ||
295 | bool IMAPfolderItem::matchName(const QString&name)const | 320 | bool IMAPfolderItem::matchName(const QString&name)const |
296 | { | 321 | { |
297 | return folder->getDisplayName()==name; | 322 | return folder->getDisplayName()==name; |
298 | } | 323 | } |
299 | 324 | ||
300 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 325 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
301 | { | 326 | { |
302 | if (folder->may_select()) { | 327 | if (folder->may_select()) { |
303 | imap->getWrapper()->listMessages( folder->getName(),target ); | 328 | imap->getWrapper()->listMessages( folder->getName(),target ); |
304 | } else { | 329 | } else { |
305 | target.clear(); | 330 | target.clear(); |
306 | } | 331 | } |
307 | } | 332 | } |
308 | 333 | ||
309 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | 334 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) |
310 | { | 335 | { |
311 | return imap->getWrapper()->fetchBody(aMail); | 336 | return imap->getWrapper()->fetchBody(aMail); |
312 | } | 337 | } |
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index 1d2bf19..7131192 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -1,144 +1,148 @@ | |||
1 | #ifndef ACCOUNTVIEW_H | 1 | #ifndef ACCOUNTVIEW_H |
2 | #define ACCOUNTVIEW_H | 2 | #define ACCOUNTVIEW_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | 6 | ||
7 | #include <libmailwrapper/settings.h> | 7 | #include <libmailwrapper/settings.h> |
8 | #include <libmailwrapper/mailwrapper.h> | 8 | #include <libmailwrapper/mailwrapper.h> |
9 | #include <libmailwrapper/abstractmail.h> | 9 | #include <libmailwrapper/abstractmail.h> |
10 | 10 | ||
11 | class POP3wrapper; | 11 | class POP3wrapper; |
12 | class RecMail; | 12 | class RecMail; |
13 | class RecBody; | 13 | class RecBody; |
14 | class QPopupMenu; | 14 | class QPopupMenu; |
15 | 15 | ||
16 | class AccountViewItem : public QListViewItem | 16 | class AccountViewItem : public QListViewItem |
17 | { | 17 | { |
18 | 18 | ||
19 | public: | 19 | public: |
20 | AccountViewItem( QListView *parent ) : QListViewItem( parent ) {} | 20 | AccountViewItem( QListView *parent ) : QListViewItem( parent ) {} |
21 | AccountViewItem( QListViewItem *parent) : QListViewItem( parent) {} | 21 | AccountViewItem( QListViewItem *parent) : QListViewItem( parent) {} |
22 | AccountViewItem( QListViewItem *parent , QListViewItem*after ) : QListViewItem( parent,after ) {} | 22 | AccountViewItem( QListViewItem *parent , QListViewItem*after ) : QListViewItem( parent,after ) {} |
23 | virtual void refresh(QList<RecMail>&)=0; | 23 | virtual void refresh(QList<RecMail>&)=0; |
24 | virtual RecBody fetchBody(const RecMail&)=0; | 24 | virtual RecBody fetchBody(const RecMail&)=0; |
25 | virtual QPopupMenu * getContextMenu(){return 0;}; | 25 | virtual QPopupMenu * getContextMenu(){return 0;}; |
26 | virtual void contextMenuSelected(int){} | 26 | virtual void contextMenuSelected(int){} |
27 | protected: | 27 | protected: |
28 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); | 28 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); |
29 | static const QString contextName; | 29 | static const QString contextName; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | class POP3viewItem : public AccountViewItem | 32 | class POP3viewItem : public AccountViewItem |
33 | { | 33 | { |
34 | 34 | ||
35 | public: | 35 | public: |
36 | POP3viewItem( POP3account *a, QListView *parent ); | 36 | POP3viewItem( POP3account *a, QListView *parent ); |
37 | ~POP3viewItem(); | 37 | ~POP3viewItem(); |
38 | virtual void refresh( QList<RecMail> &target ); | 38 | virtual void refresh( QList<RecMail> &target ); |
39 | virtual RecBody fetchBody( const RecMail &mail ); | 39 | virtual RecBody fetchBody( const RecMail &mail ); |
40 | AbstractMail *getWrapper(); | 40 | AbstractMail *getWrapper(); |
41 | private: | 41 | private: |
42 | POP3account *account; | 42 | POP3account *account; |
43 | AbstractMail *wrapper; | 43 | AbstractMail *wrapper; |
44 | 44 | ||
45 | }; | 45 | }; |
46 | 46 | ||
47 | class POP3folderItem : public AccountViewItem | 47 | class POP3folderItem : public AccountViewItem |
48 | { | 48 | { |
49 | 49 | ||
50 | public: | 50 | public: |
51 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); | 51 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); |
52 | ~POP3folderItem(); | 52 | ~POP3folderItem(); |
53 | virtual void refresh(QList<RecMail>&); | 53 | virtual void refresh(QList<RecMail>&); |
54 | virtual RecBody fetchBody(const RecMail&); | 54 | virtual RecBody fetchBody(const RecMail&); |
55 | virtual QPopupMenu * getContextMenu(); | 55 | virtual QPopupMenu * getContextMenu(); |
56 | virtual void contextMenuSelected(int); | 56 | virtual void contextMenuSelected(int); |
57 | 57 | ||
58 | protected: | ||
59 | void downloadMails(); | ||
60 | |||
58 | private: | 61 | private: |
59 | Folder *folder; | 62 | Folder *folder; |
60 | POP3viewItem *pop3; | 63 | POP3viewItem *pop3; |
61 | }; | 64 | }; |
62 | 65 | ||
63 | class IMAPfolderItem; | 66 | class IMAPfolderItem; |
64 | 67 | ||
65 | class IMAPviewItem : public AccountViewItem | 68 | class IMAPviewItem : public AccountViewItem |
66 | { | 69 | { |
67 | friend class IMAPfolderItem; | 70 | friend class IMAPfolderItem; |
68 | public: | 71 | public: |
69 | IMAPviewItem( IMAPaccount *a, QListView *parent ); | 72 | IMAPviewItem( IMAPaccount *a, QListView *parent ); |
70 | ~IMAPviewItem(); | 73 | ~IMAPviewItem(); |
71 | virtual void refresh(QList<RecMail>&); | 74 | virtual void refresh(QList<RecMail>&); |
72 | virtual RecBody fetchBody(const RecMail&); | 75 | virtual RecBody fetchBody(const RecMail&); |
73 | AbstractMail *getWrapper(); | 76 | AbstractMail *getWrapper(); |
74 | virtual QPopupMenu * getContextMenu(); | 77 | virtual QPopupMenu * getContextMenu(); |
75 | virtual void contextMenuSelected(int); | 78 | virtual void contextMenuSelected(int); |
76 | 79 | ||
77 | protected: | 80 | protected: |
78 | IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0); | 81 | IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0); |
79 | virtual void refreshFolders(bool force=false); | 82 | virtual void refreshFolders(bool force=false); |
80 | virtual void createNewFolder(); | 83 | virtual void createNewFolder(); |
84 | virtual void removeChilds(); | ||
81 | 85 | ||
82 | private: | 86 | private: |
83 | IMAPaccount *account; | 87 | IMAPaccount *account; |
84 | AbstractMail *wrapper; | 88 | AbstractMail *wrapper; |
85 | }; | 89 | }; |
86 | 90 | ||
87 | class IMAPfolderItem : public AccountViewItem | 91 | class IMAPfolderItem : public AccountViewItem |
88 | { | 92 | { |
89 | 93 | ||
90 | public: | 94 | public: |
91 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); | 95 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); |
92 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | 96 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); |
93 | ~IMAPfolderItem(); | 97 | ~IMAPfolderItem(); |
94 | virtual void refresh(QList<RecMail>&); | 98 | virtual void refresh(QList<RecMail>&); |
95 | virtual RecBody fetchBody(const RecMail&); | 99 | virtual RecBody fetchBody(const RecMail&); |
96 | bool matchName(const QString&name)const; | 100 | bool matchName(const QString&name)const; |
97 | virtual QPopupMenu * getContextMenu(); | 101 | virtual QPopupMenu * getContextMenu(); |
98 | virtual void contextMenuSelected(int); | 102 | virtual void contextMenuSelected(int); |
99 | virtual const QString& Delemiter()const; | 103 | virtual const QString& Delemiter()const; |
100 | protected: | 104 | protected: |
101 | virtual void createNewFolder(); | 105 | virtual void createNewFolder(); |
102 | virtual void deleteFolder(); | 106 | virtual void deleteFolder(); |
103 | 107 | ||
104 | private: | 108 | private: |
105 | Folder *folder; | 109 | Folder *folder; |
106 | IMAPviewItem *imap; | 110 | IMAPviewItem *imap; |
107 | }; | 111 | }; |
108 | 112 | ||
109 | class MBOXviewItem : public AccountViewItem | 113 | class MBOXviewItem : public AccountViewItem |
110 | { | 114 | { |
111 | friend class MBOXfolderItem; | 115 | friend class MBOXfolderItem; |
112 | 116 | ||
113 | public: | 117 | public: |
114 | // MBOXviewItem( MBOXaccount *a, QListView *parent ); | 118 | // MBOXviewItem( MBOXaccount *a, QListView *parent ); |
115 | MBOXviewItem( const QString&aMboxPath, QListView *parent ); | 119 | MBOXviewItem( const QString&aMboxPath, QListView *parent ); |
116 | ~MBOXviewItem(); | 120 | ~MBOXviewItem(); |
117 | virtual void refresh( QList<RecMail> &target ); | 121 | virtual void refresh( QList<RecMail> &target ); |
118 | virtual RecBody fetchBody( const RecMail &mail ); | 122 | virtual RecBody fetchBody( const RecMail &mail ); |
119 | AbstractMail *getWrapper(); | 123 | AbstractMail *getWrapper(); |
120 | virtual QPopupMenu * getContextMenu(); | 124 | virtual QPopupMenu * getContextMenu(); |
121 | virtual void contextMenuSelected(int); | 125 | virtual void contextMenuSelected(int); |
122 | 126 | ||
123 | protected: | 127 | protected: |
124 | virtual void refresh(bool force=false); | 128 | virtual void refresh(bool force=false); |
125 | virtual void createFolder(); | 129 | virtual void createFolder(); |
126 | 130 | ||
127 | private: | 131 | private: |
128 | // MBOXaccount *account; | 132 | // MBOXaccount *account; |
129 | QString m_Path; | 133 | QString m_Path; |
130 | AbstractMail *wrapper; | 134 | AbstractMail *wrapper; |
131 | 135 | ||
132 | }; | 136 | }; |
133 | 137 | ||
134 | class MBOXfolderItem : public AccountViewItem | 138 | class MBOXfolderItem : public AccountViewItem |
135 | { | 139 | { |
136 | 140 | ||
137 | public: | 141 | public: |
138 | MBOXfolderItem( Folder *folder, MBOXviewItem *parent , QListViewItem*after ); | 142 | MBOXfolderItem( Folder *folder, MBOXviewItem *parent , QListViewItem*after ); |
139 | ~MBOXfolderItem(); | 143 | ~MBOXfolderItem(); |
140 | virtual void refresh(QList<RecMail>&); | 144 | virtual void refresh(QList<RecMail>&); |
141 | virtual RecBody fetchBody(const RecMail&); | 145 | virtual RecBody fetchBody(const RecMail&); |
142 | virtual QPopupMenu * getContextMenu(); | 146 | virtual QPopupMenu * getContextMenu(); |
143 | virtual void contextMenuSelected(int); | 147 | virtual void contextMenuSelected(int); |
144 | 148 | ||
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 7c060db..9770991 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -1,59 +1,60 @@ | |||
1 | #ifndef __abstract_mail_ | 1 | #ifndef __abstract_mail_ |
2 | #define __abstract_mail_ | 2 | #define __abstract_mail_ |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | #include "settings.h" | 5 | #include "settings.h" |
6 | 6 | ||
7 | class RecMail; | 7 | class RecMail; |
8 | class RecBody; | 8 | class RecBody; |
9 | class RecPart; | 9 | class RecPart; |
10 | class IMAPwrapper; | 10 | class IMAPwrapper; |
11 | class POP3wrapper; | 11 | class POP3wrapper; |
12 | class Folder; | 12 | class Folder; |
13 | class encodedString; | 13 | class encodedString; |
14 | struct folderStat; | 14 | struct folderStat; |
15 | 15 | ||
16 | class AbstractMail:public QObject | 16 | class AbstractMail:public QObject |
17 | { | 17 | { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | public: | 19 | public: |
20 | AbstractMail(){}; | 20 | AbstractMail(){}; |
21 | virtual ~AbstractMail(){} | 21 | virtual ~AbstractMail(){} |
22 | virtual QList<Folder>* listFolders()=0; | 22 | virtual QList<Folder>* listFolders()=0; |
23 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; | 23 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; |
24 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; | 24 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; |
25 | virtual RecBody fetchBody(const RecMail&mail)=0; | 25 | virtual RecBody fetchBody(const RecMail&mail)=0; |
26 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; | 26 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; |
27 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; | 27 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; |
28 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; | 28 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; |
29 | virtual encodedString* fetchRawBody(const RecMail&mail)=0; | ||
29 | 30 | ||
30 | virtual void deleteMail(const RecMail&mail)=0; | 31 | virtual void deleteMail(const RecMail&mail)=0; |
31 | virtual void answeredMail(const RecMail&mail)=0; | 32 | virtual void answeredMail(const RecMail&mail)=0; |
32 | virtual int deleteAllMail(const Folder*)=0; | 33 | virtual int deleteAllMail(const Folder*)=0; |
33 | virtual int deleteMbox(const Folder*)=0; | 34 | virtual int deleteMbox(const Folder*)=0; |
34 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
35 | 36 | ||
36 | virtual void cleanMimeCache(){}; | 37 | virtual void cleanMimeCache(){}; |
37 | /* mail box methods */ | 38 | /* mail box methods */ |
38 | /* parameter is the box to create. | 39 | /* parameter is the box to create. |
39 | * if the implementing subclass has prefixes, | 40 | * if the implementing subclass has prefixes, |
40 | * them has to be appended automatic. | 41 | * them has to be appended automatic. |
41 | */ | 42 | */ |
42 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); | 43 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); |
43 | virtual void logout()=0; | 44 | virtual void logout()=0; |
44 | 45 | ||
45 | static AbstractMail* getWrapper(IMAPaccount *a); | 46 | static AbstractMail* getWrapper(IMAPaccount *a); |
46 | static AbstractMail* getWrapper(POP3account *a); | 47 | static AbstractMail* getWrapper(POP3account *a); |
47 | /* mbox only! */ | 48 | /* mbox only! */ |
48 | static AbstractMail* getWrapper(const QString&a); | 49 | static AbstractMail* getWrapper(const QString&a); |
49 | 50 | ||
50 | static QString defaultLocalfolder(); | 51 | static QString defaultLocalfolder(); |
51 | 52 | ||
52 | virtual const QString&getType()const=0; | 53 | virtual const QString&getType()const=0; |
53 | 54 | ||
54 | protected: | 55 | protected: |
55 | static encodedString*decode_String(const encodedString*text,const QString&enc); | 56 | static encodedString*decode_String(const encodedString*text,const QString&enc); |
56 | static QString convert_String(const char*text); | 57 | static QString convert_String(const char*text); |
57 | static QString gen_attachment_id(); | 58 | static QString gen_attachment_id(); |
58 | }; | 59 | }; |
59 | #endif | 60 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 95b317a..d252159 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -405,153 +405,164 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
405 | 405 | ||
406 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 406 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
407 | mailimap_msg_att * msg_att; | 407 | mailimap_msg_att * msg_att; |
408 | msg_att = (mailimap_msg_att*)current->data; | 408 | msg_att = (mailimap_msg_att*)current->data; |
409 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; | 409 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; |
410 | QValueList<int> path; | 410 | QValueList<int> path; |
411 | body_desc = item->att_data.att_static->att_data.att_body; | 411 | body_desc = item->att_data.att_static->att_data.att_body; |
412 | traverseBody(mail,body_desc,body,0,path); | 412 | traverseBody(mail,body_desc,body,0,path); |
413 | } else { | 413 | } else { |
414 | qDebug("error fetching body: %s",m_imap->imap_response); | 414 | qDebug("error fetching body: %s",m_imap->imap_response); |
415 | } | 415 | } |
416 | if (result) mailimap_fetch_list_free(result); | 416 | if (result) mailimap_fetch_list_free(result); |
417 | return body; | 417 | return body; |
418 | } | 418 | } |
419 | 419 | ||
420 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | 420 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) |
421 | { | 421 | { |
422 | QStringList l; | 422 | QStringList l; |
423 | QString from; | 423 | QString from; |
424 | bool named_from; | 424 | bool named_from; |
425 | clistcell *current = NULL; | 425 | clistcell *current = NULL; |
426 | mailimap_address * current_address=NULL; | 426 | mailimap_address * current_address=NULL; |
427 | if (!list) { | 427 | if (!list) { |
428 | return l; | 428 | return l; |
429 | } | 429 | } |
430 | unsigned int count = 0; | 430 | unsigned int count = 0; |
431 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { | 431 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { |
432 | from = ""; | 432 | from = ""; |
433 | named_from = false; | 433 | named_from = false; |
434 | current_address=(mailimap_address*)current->data; | 434 | current_address=(mailimap_address*)current->data; |
435 | if (current_address->ad_personal_name){ | 435 | if (current_address->ad_personal_name){ |
436 | from+=convert_String((const char*)current_address->ad_personal_name); | 436 | from+=convert_String((const char*)current_address->ad_personal_name); |
437 | from+=" "; | 437 | from+=" "; |
438 | named_from = true; | 438 | named_from = true; |
439 | } | 439 | } |
440 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 440 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
441 | from+="<"; | 441 | from+="<"; |
442 | } | 442 | } |
443 | if (current_address->ad_mailbox_name) { | 443 | if (current_address->ad_mailbox_name) { |
444 | from+=QString(current_address->ad_mailbox_name); | 444 | from+=QString(current_address->ad_mailbox_name); |
445 | from+="@"; | 445 | from+="@"; |
446 | } | 446 | } |
447 | if (current_address->ad_host_name) { | 447 | if (current_address->ad_host_name) { |
448 | from+=QString(current_address->ad_host_name); | 448 | from+=QString(current_address->ad_host_name); |
449 | } | 449 | } |
450 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 450 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
451 | from+=">"; | 451 | from+=">"; |
452 | } | 452 | } |
453 | l.append(QString(from)); | 453 | l.append(QString(from)); |
454 | if (++count > 99) { | 454 | if (++count > 99) { |
455 | break; | 455 | break; |
456 | } | 456 | } |
457 | } | 457 | } |
458 | return l; | 458 | return l; |
459 | } | 459 | } |
460 | 460 | ||
461 | encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) | 461 | encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) |
462 | { | 462 | { |
463 | encodedString*res=new encodedString; | 463 | encodedString*res=new encodedString; |
464 | const char*mb; | 464 | const char*mb; |
465 | int err; | 465 | int err; |
466 | mailimap_fetch_type *fetchType; | 466 | mailimap_fetch_type *fetchType; |
467 | mailimap_set *set; | 467 | mailimap_set *set; |
468 | clistcell*current,*cur; | 468 | clistcell*current,*cur; |
469 | mailimap_section_part * section_part = 0; | ||
470 | mailimap_section_spec * section_spec = 0; | ||
471 | mailimap_section * section = 0; | ||
472 | mailimap_fetch_att * fetch_att = 0; | ||
469 | 473 | ||
470 | login(); | 474 | login(); |
471 | if (!m_imap) { | 475 | if (!m_imap) { |
472 | return res; | 476 | return res; |
473 | } | 477 | } |
474 | if (!internal_call) { | 478 | if (!internal_call) { |
475 | mb = mail.getMbox().latin1(); | 479 | mb = mail.getMbox().latin1(); |
476 | err = mailimap_select( m_imap, (char*)mb); | 480 | err = mailimap_select( m_imap, (char*)mb); |
477 | if ( err != MAILIMAP_NO_ERROR ) { | 481 | if ( err != MAILIMAP_NO_ERROR ) { |
478 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 482 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
479 | return res; | 483 | return res; |
480 | } | 484 | } |
481 | } | 485 | } |
482 | set = mailimap_set_new_single(mail.getNumber()); | 486 | set = mailimap_set_new_single(mail.getNumber()); |
483 | clist*id_list=clist_new(); | ||
484 | for (unsigned j=0; j < path.count();++j) { | ||
485 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | ||
486 | *p_id = path[j]; | ||
487 | clist_append(id_list,p_id); | ||
488 | } | ||
489 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); | ||
490 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | ||
491 | mailimap_section * section = mailimap_section_new(section_spec); | ||
492 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | ||
493 | 487 | ||
488 | clist*id_list = 0; | ||
489 | |||
490 | /* if path == empty then its a request for the whole rfc822 mail and generates | ||
491 | a "fetch <id> (body[])" statement on imap server */ | ||
492 | if (path.count()>0 ) { | ||
493 | id_list = clist_new(); | ||
494 | for (unsigned j=0; j < path.count();++j) { | ||
495 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | ||
496 | *p_id = path[j]; | ||
497 | clist_append(id_list,p_id); | ||
498 | } | ||
499 | section_part = mailimap_section_part_new(id_list); | ||
500 | section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | ||
501 | } | ||
502 | |||
503 | section = mailimap_section_new(section_spec); | ||
504 | fetch_att = mailimap_fetch_att_new_body_section(section); | ||
494 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | 505 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); |
495 | 506 | ||
496 | clist*result = 0; | 507 | clist*result = 0; |
497 | 508 | ||
498 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 509 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
499 | mailimap_set_free( set ); | 510 | mailimap_set_free( set ); |
500 | mailimap_fetch_type_free( fetchType ); | 511 | mailimap_fetch_type_free( fetchType ); |
501 | 512 | ||
502 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 513 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
503 | mailimap_msg_att * msg_att; | 514 | mailimap_msg_att * msg_att; |
504 | msg_att = (mailimap_msg_att*)current->data; | 515 | msg_att = (mailimap_msg_att*)current->data; |
505 | mailimap_msg_att_item*msg_att_item; | 516 | mailimap_msg_att_item*msg_att_item; |
506 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { | 517 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { |
507 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | 518 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); |
508 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | 519 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { |
509 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | 520 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { |
510 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 521 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
511 | /* detach - we take over the content */ | 522 | /* detach - we take over the content */ |
512 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 523 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
513 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); | 524 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); |
514 | } | 525 | } |
515 | } | 526 | } |
516 | } | 527 | } |
517 | } else { | 528 | } else { |
518 | qDebug("error fetching text: %s",m_imap->imap_response); | 529 | qDebug("error fetching text: %s",m_imap->imap_response); |
519 | } | 530 | } |
520 | if (result) mailimap_fetch_list_free(result); | 531 | if (result) mailimap_fetch_list_free(result); |
521 | return res; | 532 | return res; |
522 | } | 533 | } |
523 | 534 | ||
524 | /* current_recursion is for recursive calls. | 535 | /* current_recursion is for recursive calls. |
525 | current_count means the position inside the internal loop! */ | 536 | current_count means the position inside the internal loop! */ |
526 | void IMAPwrapper::traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body, | 537 | void IMAPwrapper::traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body, |
527 | int current_recursion,QValueList<int>recList,int current_count) | 538 | int current_recursion,QValueList<int>recList,int current_count) |
528 | { | 539 | { |
529 | if (!body || current_recursion>=10) { | 540 | if (!body || current_recursion>=10) { |
530 | return; | 541 | return; |
531 | } | 542 | } |
532 | switch (body->bd_type) { | 543 | switch (body->bd_type) { |
533 | case MAILIMAP_BODY_1PART: | 544 | case MAILIMAP_BODY_1PART: |
534 | { | 545 | { |
535 | QValueList<int>countlist = recList; | 546 | QValueList<int>countlist = recList; |
536 | countlist.append(current_count); | 547 | countlist.append(current_count); |
537 | RecPart currentPart; | 548 | RecPart currentPart; |
538 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; | 549 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; |
539 | QString id(""); | 550 | QString id(""); |
540 | currentPart.setPositionlist(countlist); | 551 | currentPart.setPositionlist(countlist); |
541 | for (unsigned int j = 0; j < countlist.count();++j) { | 552 | for (unsigned int j = 0; j < countlist.count();++j) { |
542 | id+=(j>0?" ":""); | 553 | id+=(j>0?" ":""); |
543 | id+=QString("%1").arg(countlist[j]); | 554 | id+=QString("%1").arg(countlist[j]); |
544 | } | 555 | } |
545 | qDebug("ID = %s",id.latin1()); | 556 | qDebug("ID = %s",id.latin1()); |
546 | currentPart.setIdentifier(id); | 557 | currentPart.setIdentifier(id); |
547 | fillSinglePart(currentPart,part1); | 558 | fillSinglePart(currentPart,part1); |
548 | /* important: Check for is NULL 'cause a body can be empty! | 559 | /* important: Check for is NULL 'cause a body can be empty! |
549 | And we put it only into the mail if it is the FIRST part */ | 560 | And we put it only into the mail if it is the FIRST part */ |
550 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body.Bodytext().isNull() && countlist[0]==1) { | 561 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body.Bodytext().isNull() && countlist[0]==1) { |
551 | QString body_text = fetchTextPart(mail,countlist,true,currentPart.Encoding()); | 562 | QString body_text = fetchTextPart(mail,countlist,true,currentPart.Encoding()); |
552 | target_body.setDescription(currentPart); | 563 | target_body.setDescription(currentPart); |
553 | target_body.setBodytext(body_text); | 564 | target_body.setBodytext(body_text); |
554 | if (countlist.count()>1) { | 565 | if (countlist.count()>1) { |
555 | target_body.addPart(currentPart); | 566 | target_body.addPart(currentPart); |
556 | } | 567 | } |
557 | } else { | 568 | } else { |
@@ -894,99 +905,110 @@ int IMAPwrapper::deleteAllMail(const Folder*folder) | |||
894 | 905 | ||
895 | int IMAPwrapper::createMbox(const QString&folder,const Folder*parentfolder,const QString& delemiter,bool getsubfolder) | 906 | int IMAPwrapper::createMbox(const QString&folder,const Folder*parentfolder,const QString& delemiter,bool getsubfolder) |
896 | { | 907 | { |
897 | if (folder.length()==0) return 0; | 908 | if (folder.length()==0) return 0; |
898 | login(); | 909 | login(); |
899 | if (!m_imap) {return 0;} | 910 | if (!m_imap) {return 0;} |
900 | QString pre = account->getPrefix(); | 911 | QString pre = account->getPrefix(); |
901 | if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { | 912 | if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { |
902 | pre+=delemiter; | 913 | pre+=delemiter; |
903 | } | 914 | } |
904 | if (parentfolder) { | 915 | if (parentfolder) { |
905 | pre += parentfolder->getDisplayName()+delemiter; | 916 | pre += parentfolder->getDisplayName()+delemiter; |
906 | } | 917 | } |
907 | pre+=folder; | 918 | pre+=folder; |
908 | if (getsubfolder) { | 919 | if (getsubfolder) { |
909 | if (delemiter.length()>0) { | 920 | if (delemiter.length()>0) { |
910 | pre+=delemiter; | 921 | pre+=delemiter; |
911 | } else { | 922 | } else { |
912 | Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre)); | 923 | Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre)); |
913 | return 0; | 924 | return 0; |
914 | } | 925 | } |
915 | } | 926 | } |
916 | qDebug("Creating %s",pre.latin1()); | 927 | qDebug("Creating %s",pre.latin1()); |
917 | int res = mailimap_create(m_imap,pre.latin1()); | 928 | int res = mailimap_create(m_imap,pre.latin1()); |
918 | if (res != MAILIMAP_NO_ERROR) { | 929 | if (res != MAILIMAP_NO_ERROR) { |
919 | Global::statusMessage(tr("%1").arg(m_imap->imap_response)); | 930 | Global::statusMessage(tr("%1").arg(m_imap->imap_response)); |
920 | return 0; | 931 | return 0; |
921 | } | 932 | } |
922 | return 1; | 933 | return 1; |
923 | } | 934 | } |
924 | 935 | ||
925 | int IMAPwrapper::deleteMbox(const Folder*folder) | 936 | int IMAPwrapper::deleteMbox(const Folder*folder) |
926 | { | 937 | { |
927 | if (!folder) return 0; | 938 | if (!folder) return 0; |
928 | login(); | 939 | login(); |
929 | if (!m_imap) {return 0;} | 940 | if (!m_imap) {return 0;} |
930 | int res = mailimap_delete(m_imap,folder->getName()); | 941 | int res = mailimap_delete(m_imap,folder->getName()); |
931 | if (res != MAILIMAP_NO_ERROR) { | 942 | if (res != MAILIMAP_NO_ERROR) { |
932 | Global::statusMessage(tr("%1").arg(m_imap->imap_response)); | 943 | Global::statusMessage(tr("%1").arg(m_imap->imap_response)); |
933 | return 0; | 944 | return 0; |
934 | } | 945 | } |
935 | return 1; | 946 | return 1; |
936 | } | 947 | } |
937 | 948 | ||
938 | void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | 949 | void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) |
939 | { | 950 | { |
940 | mailimap_status_att_list * att_list =0; | 951 | mailimap_status_att_list * att_list =0; |
941 | mailimap_mailbox_data_status * status=0; | 952 | mailimap_mailbox_data_status * status=0; |
942 | clistiter * cur = 0; | 953 | clistiter * cur = 0; |
943 | int r = 0; | 954 | int r = 0; |
944 | int res = 0; | 955 | int res = 0; |
945 | target_stat.message_count = 0; | 956 | target_stat.message_count = 0; |
946 | target_stat.message_unseen = 0; | 957 | target_stat.message_unseen = 0; |
947 | target_stat.message_recent = 0; | 958 | target_stat.message_recent = 0; |
948 | login(); | 959 | login(); |
949 | if (!m_imap) { | 960 | if (!m_imap) { |
950 | return; | 961 | return; |
951 | } | 962 | } |
952 | att_list = mailimap_status_att_list_new_empty(); | 963 | att_list = mailimap_status_att_list_new_empty(); |
953 | if (!att_list) return; | 964 | if (!att_list) return; |
954 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES); | 965 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES); |
955 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT); | 966 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT); |
956 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); | 967 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); |
957 | r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); | 968 | r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); |
958 | for (cur = clist_begin(status->st_info_list); | 969 | if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) { |
959 | cur != NULL ; cur = clist_next(cur)) { | 970 | for (cur = clist_begin(status->st_info_list); |
960 | mailimap_status_info * status_info; | 971 | cur != NULL ; cur = clist_next(cur)) { |
961 | status_info = (mailimap_status_info *)clist_content(cur); | 972 | mailimap_status_info * status_info; |
962 | switch (status_info->st_att) { | 973 | status_info = (mailimap_status_info *)clist_content(cur); |
963 | case MAILIMAP_STATUS_ATT_MESSAGES: | 974 | switch (status_info->st_att) { |
964 | target_stat.message_count = status_info->st_value; | 975 | case MAILIMAP_STATUS_ATT_MESSAGES: |
965 | break; | 976 | target_stat.message_count = status_info->st_value; |
966 | case MAILIMAP_STATUS_ATT_RECENT: | 977 | break; |
967 | target_stat.message_recent = status_info->st_value; | 978 | case MAILIMAP_STATUS_ATT_RECENT: |
968 | break; | 979 | target_stat.message_recent = status_info->st_value; |
969 | case MAILIMAP_STATUS_ATT_UNSEEN: | 980 | break; |
970 | target_stat.message_unseen = status_info->st_value; | 981 | case MAILIMAP_STATUS_ATT_UNSEEN: |
971 | break; | 982 | target_stat.message_unseen = status_info->st_value; |
983 | break; | ||
984 | } | ||
972 | } | 985 | } |
986 | } else { | ||
987 | qDebug("Error retrieving status"); | ||
973 | } | 988 | } |
974 | mailimap_mailbox_data_status_free(status); | 989 | if (status) mailimap_mailbox_data_status_free(status); |
975 | mailimap_status_att_list_free(att_list); | 990 | if (att_list) mailimap_status_att_list_free(att_list); |
976 | } | 991 | } |
977 | 992 | ||
978 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | 993 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) |
979 | { | 994 | { |
980 | login(); | 995 | login(); |
981 | if (!m_imap) return; | 996 | if (!m_imap) return; |
982 | if (!msg) return; | 997 | if (!msg) return; |
983 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); | 998 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); |
984 | if (r != MAILIMAP_NO_ERROR) { | 999 | if (r != MAILIMAP_NO_ERROR) { |
985 | Global::statusMessage("Error storing mail!"); | 1000 | Global::statusMessage("Error storing mail!"); |
986 | } | 1001 | } |
987 | } | 1002 | } |
988 | 1003 | ||
989 | const QString&IMAPwrapper::getType()const | 1004 | const QString&IMAPwrapper::getType()const |
990 | { | 1005 | { |
991 | return account->getType(); | 1006 | return account->getType(); |
992 | } | 1007 | } |
1008 | |||
1009 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) | ||
1010 | { | ||
1011 | // dummy | ||
1012 | QValueList<int> path; | ||
1013 | return fetchRawPart(mail,path,false); | ||
1014 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 6a9c411..b246f58 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -1,70 +1,71 @@ | |||
1 | #ifndef __IMAPWRAPPER | 1 | #ifndef __IMAPWRAPPER |
2 | #define __IMAPWRAPPER | 2 | #define __IMAPWRAPPER |
3 | 3 | ||
4 | #include <qlist.h> | 4 | #include <qlist.h> |
5 | #include "mailwrapper.h" | 5 | #include "mailwrapper.h" |
6 | #include "abstractmail.h" | 6 | #include "abstractmail.h" |
7 | #include <libetpan/clist.h> | 7 | #include <libetpan/clist.h> |
8 | 8 | ||
9 | struct mailimap; | 9 | struct mailimap; |
10 | struct mailimap_body; | 10 | struct mailimap_body; |
11 | struct mailimap_body_type_1part; | 11 | struct mailimap_body_type_1part; |
12 | struct mailimap_body_type_text; | 12 | struct mailimap_body_type_text; |
13 | struct mailimap_body_type_basic; | 13 | struct mailimap_body_type_basic; |
14 | struct mailimap_body_type_msg; | 14 | struct mailimap_body_type_msg; |
15 | struct mailimap_body_type_mpart; | 15 | struct mailimap_body_type_mpart; |
16 | struct mailimap_body_fields; | 16 | struct mailimap_body_fields; |
17 | struct mailimap_msg_att; | 17 | struct mailimap_msg_att; |
18 | class encodedString; | 18 | class encodedString; |
19 | 19 | ||
20 | class IMAPwrapper : public AbstractMail | 20 | class IMAPwrapper : public AbstractMail |
21 | { | 21 | { |
22 | Q_OBJECT | 22 | Q_OBJECT |
23 | public: | 23 | public: |
24 | IMAPwrapper( IMAPaccount *a ); | 24 | IMAPwrapper( IMAPaccount *a ); |
25 | virtual ~IMAPwrapper(); | 25 | virtual ~IMAPwrapper(); |
26 | virtual QList<Folder>* listFolders(); | 26 | virtual QList<Folder>* listFolders(); |
27 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); | 27 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); |
28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
29 | 29 | ||
30 | virtual void deleteMail(const RecMail&mail); | 30 | virtual void deleteMail(const RecMail&mail); |
31 | virtual void answeredMail(const RecMail&mail); | 31 | virtual void answeredMail(const RecMail&mail); |
32 | virtual int deleteAllMail(const Folder*folder); | 32 | virtual int deleteAllMail(const Folder*folder); |
33 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 33 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
34 | 34 | ||
35 | virtual RecBody fetchBody(const RecMail&mail); | 35 | virtual RecBody fetchBody(const RecMail&mail); |
36 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | 36 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); |
37 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); | 37 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); |
38 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); | 38 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); |
39 | virtual encodedString* fetchRawBody(const RecMail&mail); | ||
39 | 40 | ||
40 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); | 41 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); |
41 | virtual int deleteMbox(const Folder*folder); | 42 | virtual int deleteMbox(const Folder*folder); |
42 | 43 | ||
43 | static void imap_progress( size_t current, size_t maximum ); | 44 | static void imap_progress( size_t current, size_t maximum ); |
44 | 45 | ||
45 | virtual void logout(); | 46 | virtual void logout(); |
46 | virtual const QString&getType()const; | 47 | virtual const QString&getType()const; |
47 | protected: | 48 | protected: |
48 | RecMail*parse_list_result(mailimap_msg_att*); | 49 | RecMail*parse_list_result(mailimap_msg_att*); |
49 | void login(); | 50 | void login(); |
50 | 51 | ||
51 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); | 52 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); |
52 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); | 53 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); |
53 | 54 | ||
54 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); | 55 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); |
55 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); | 56 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); |
56 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); | 57 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); |
57 | void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); | 58 | void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); |
58 | void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); | 59 | void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); |
59 | void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); | 60 | void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); |
60 | 61 | ||
61 | /* just helpers */ | 62 | /* just helpers */ |
62 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); | 63 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); |
63 | static QStringList address_list_to_stringlist(clist*list); | 64 | static QStringList address_list_to_stringlist(clist*list); |
64 | 65 | ||
65 | 66 | ||
66 | IMAPaccount *account; | 67 | IMAPaccount *account; |
67 | mailimap *m_imap; | 68 | mailimap *m_imap; |
68 | }; | 69 | }; |
69 | 70 | ||
70 | #endif | 71 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 60f7507..3a0b30a 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -111,168 +111,169 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) | |||
111 | } | 111 | } |
112 | r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); | 112 | r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); |
113 | if (r != MAIL_NO_ERROR) { | 113 | if (r != MAIL_NO_ERROR) { |
114 | qDebug("Error fetching mail %i",mail.getNumber()); | 114 | qDebug("Error fetching mail %i",mail.getNumber()); |
115 | mailfolder_free(folder); | 115 | mailfolder_free(folder); |
116 | mailstorage_free(storage); | 116 | mailstorage_free(storage); |
117 | return body; | 117 | return body; |
118 | } | 118 | } |
119 | r = mailmessage_fetch(msg,&data,&size); | 119 | r = mailmessage_fetch(msg,&data,&size); |
120 | if (r != MAIL_NO_ERROR) { | 120 | if (r != MAIL_NO_ERROR) { |
121 | qDebug("Error fetching mail %i",mail.getNumber()); | 121 | qDebug("Error fetching mail %i",mail.getNumber()); |
122 | mailfolder_free(folder); | 122 | mailfolder_free(folder); |
123 | mailstorage_free(storage); | 123 | mailstorage_free(storage); |
124 | mailmessage_free(msg); | 124 | mailmessage_free(msg); |
125 | return body; | 125 | return body; |
126 | } | 126 | } |
127 | body = parseMail(msg); | 127 | body = parseMail(msg); |
128 | mailmessage_fetch_result_free(msg,data); | 128 | mailmessage_fetch_result_free(msg,data); |
129 | mailfolder_free(folder); | 129 | mailfolder_free(folder); |
130 | mailstorage_free(storage); | 130 | mailstorage_free(storage); |
131 | 131 | ||
132 | return body; | 132 | return body; |
133 | } | 133 | } |
134 | 134 | ||
135 | void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) | 135 | void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) |
136 | { | 136 | { |
137 | qDebug("MBOX %i von %i",current,maximum); | 137 | qDebug("MBOX %i von %i",current,maximum); |
138 | } | 138 | } |
139 | 139 | ||
140 | int MBOXwrapper::createMbox(const QString&folder,const Folder*,const QString&,bool ) | 140 | int MBOXwrapper::createMbox(const QString&folder,const Folder*,const QString&,bool ) |
141 | { | 141 | { |
142 | QString p = MBOXPath+"/"; | 142 | QString p = MBOXPath+"/"; |
143 | p+=folder; | 143 | p+=folder; |
144 | QFileInfo fi(p); | 144 | QFileInfo fi(p); |
145 | if (fi.exists()) { | 145 | if (fi.exists()) { |
146 | Global::statusMessage(tr("Mailbox exists.")); | 146 | Global::statusMessage(tr("Mailbox exists.")); |
147 | return 0; | 147 | return 0; |
148 | } | 148 | } |
149 | mailmbox_folder*f = 0; | 149 | mailmbox_folder*f = 0; |
150 | if (mailmbox_init(p.latin1(),0,1,0,&f) != MAIL_NO_ERROR) { | 150 | if (mailmbox_init(p.latin1(),0,1,0,&f) != MAIL_NO_ERROR) { |
151 | Global::statusMessage(tr("Error init folder")); | 151 | Global::statusMessage(tr("Error init folder")); |
152 | return 0; | 152 | return 0; |
153 | } | 153 | } |
154 | if (f) mailmbox_done(f); | 154 | if (f) mailmbox_done(f); |
155 | return 1; | 155 | return 1; |
156 | } | 156 | } |
157 | 157 | ||
158 | void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | 158 | void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folder) |
159 | { | 159 | { |
160 | QString p = MBOXPath+"/"; | 160 | QString p = MBOXPath+"/"; |
161 | p+=folder; | 161 | p+=folder; |
162 | mailmbox_folder*f = 0; | 162 | mailmbox_folder*f = 0; |
163 | int r = mailmbox_init(p.latin1(),0,1,0,&f); | 163 | int r = mailmbox_init(p.latin1(),0,1,0,&f); |
164 | if (r != MAIL_NO_ERROR) { | 164 | if (r != MAIL_NO_ERROR) { |
165 | Global::statusMessage(tr("Error init folder")); | 165 | Global::statusMessage(tr("Error init folder")); |
166 | return; | 166 | return; |
167 | } | 167 | } |
168 | r = mailmbox_append_message(f,msg,length); | 168 | r = mailmbox_append_message(f,msg,length); |
169 | if (r != MAIL_NO_ERROR) { | 169 | if (r != MAIL_NO_ERROR) { |
170 | Global::statusMessage(tr("Error writing to message folder")); | 170 | Global::statusMessage(tr("Error writing to message folder")); |
171 | } | 171 | } |
172 | mailmbox_done(f); | 172 | mailmbox_done(f); |
173 | } | 173 | } |
174 | 174 | ||
175 | void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | 175 | encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail) |
176 | { | 176 | { |
177 | RecBody body; | 177 | RecBody body; |
178 | mailstorage*storage = mailstorage_new(NULL); | 178 | mailstorage*storage = mailstorage_new(NULL); |
179 | QString p = MBOXPath+"/"; | 179 | QString p = MBOXPath+"/"; |
180 | p+=mail.getMbox(); | 180 | p+=mail.getMbox(); |
181 | mailmessage * msg; | 181 | mailmessage * msg; |
182 | char*data=0; | 182 | char*data=0; |
183 | size_t size; | 183 | size_t size; |
184 | 184 | ||
185 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 185 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
186 | mailfolder*folder; | 186 | mailfolder*folder; |
187 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 187 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
188 | r = mailfolder_connect(folder); | 188 | r = mailfolder_connect(folder); |
189 | if (r != MAIL_NO_ERROR) { | 189 | if (r != MAIL_NO_ERROR) { |
190 | Global::statusMessage(tr("Error initializing mbox")); | 190 | Global::statusMessage(tr("Error initializing mbox")); |
191 | mailfolder_free(folder); | 191 | mailfolder_free(folder); |
192 | mailstorage_free(storage); | 192 | mailstorage_free(storage); |
193 | return; | 193 | return 0; |
194 | } | 194 | } |
195 | r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); | 195 | r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); |
196 | if (r != MAIL_NO_ERROR) { | 196 | if (r != MAIL_NO_ERROR) { |
197 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); | 197 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); |
198 | mailfolder_free(folder); | 198 | mailfolder_free(folder); |
199 | mailstorage_free(storage); | 199 | mailstorage_free(storage); |
200 | return; | 200 | return 0; |
201 | } | 201 | } |
202 | r = mailmessage_fetch(msg,&data,&size); | 202 | r = mailmessage_fetch(msg,&data,&size); |
203 | if (r != MAIL_NO_ERROR) { | 203 | if (r != MAIL_NO_ERROR) { |
204 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); | 204 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); |
205 | mailfolder_free(folder); | 205 | mailfolder_free(folder); |
206 | mailstorage_free(storage); | 206 | mailstorage_free(storage); |
207 | mailmessage_free(msg); | 207 | mailmessage_free(msg); |
208 | return; | 208 | return 0; |
209 | } | 209 | } |
210 | *target = data; | 210 | encodedString*result = new encodedString(data,size); |
211 | *length = size; | 211 | |
212 | mailfolder_free(folder); | 212 | mailfolder_free(folder); |
213 | mailstorage_free(storage); | 213 | mailstorage_free(storage); |
214 | mailmessage_free(msg); | 214 | mailmessage_free(msg); |
215 | return result; | ||
215 | } | 216 | } |
216 | 217 | ||
217 | void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) | 218 | void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) |
218 | { | 219 | { |
219 | QString p = MBOXPath+"/"; | 220 | QString p = MBOXPath+"/"; |
220 | p+=mailbox; | 221 | p+=mailbox; |
221 | mailmbox_folder*f = 0; | 222 | mailmbox_folder*f = 0; |
222 | int r = mailmbox_init(p.latin1(),0,1,0,&f); | 223 | int r = mailmbox_init(p.latin1(),0,1,0,&f); |
223 | if (r != MAIL_NO_ERROR) { | 224 | if (r != MAIL_NO_ERROR) { |
224 | qDebug("Error init folder"); | 225 | qDebug("Error init folder"); |
225 | return; | 226 | return; |
226 | } | 227 | } |
227 | deleteMails(f,target); | 228 | deleteMails(f,target); |
228 | mailmbox_done(f); | 229 | mailmbox_done(f); |
229 | } | 230 | } |
230 | 231 | ||
231 | void MBOXwrapper::deleteMails(mailmbox_folder*f,QList<RecMail> &target) | 232 | void MBOXwrapper::deleteMails(mailmbox_folder*f,QList<RecMail> &target) |
232 | { | 233 | { |
233 | if (!f) return; | 234 | if (!f) return; |
234 | int r; | 235 | int r; |
235 | for (unsigned int i=0; i < target.count();++i) { | 236 | for (unsigned int i=0; i < target.count();++i) { |
236 | r = mailmbox_delete_msg(f,target.at(i)->getNumber()); | 237 | r = mailmbox_delete_msg(f,target.at(i)->getNumber()); |
237 | if (r!=MAILMBOX_NO_ERROR) { | 238 | if (r!=MAILMBOX_NO_ERROR) { |
238 | qDebug("error delete mail"); | 239 | qDebug("error delete mail"); |
239 | } | 240 | } |
240 | } | 241 | } |
241 | r = mailmbox_expunge(f); | 242 | r = mailmbox_expunge(f); |
242 | if (r != MAILMBOX_NO_ERROR) { | 243 | if (r != MAILMBOX_NO_ERROR) { |
243 | qDebug("error expunge mailbox"); | 244 | qDebug("error expunge mailbox"); |
244 | } | 245 | } |
245 | } | 246 | } |
246 | 247 | ||
247 | int MBOXwrapper::deleteAllMail(const Folder*tfolder) | 248 | int MBOXwrapper::deleteAllMail(const Folder*tfolder) |
248 | { | 249 | { |
249 | if (!tfolder) return 0; | 250 | if (!tfolder) return 0; |
250 | QString p = MBOXPath+tfolder->getDisplayName(); | 251 | QString p = MBOXPath+tfolder->getDisplayName(); |
251 | int res = 1; | 252 | int res = 1; |
252 | 253 | ||
253 | mailfolder*folder = 0; | 254 | mailfolder*folder = 0; |
254 | mailmessage_list*l=0; | 255 | mailmessage_list*l=0; |
255 | mailstorage*storage = mailstorage_new(NULL); | 256 | mailstorage*storage = mailstorage_new(NULL); |
256 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 257 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
257 | if (r != MAIL_NO_ERROR) { | 258 | if (r != MAIL_NO_ERROR) { |
258 | Global::statusMessage(tr("Error initializing mbox")); | 259 | Global::statusMessage(tr("Error initializing mbox")); |
259 | res = 0; | 260 | res = 0; |
260 | } | 261 | } |
261 | if (res) { | 262 | if (res) { |
262 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 263 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
263 | r = mailfolder_connect(folder); | 264 | r = mailfolder_connect(folder); |
264 | if (r != MAIL_NO_ERROR) { | 265 | if (r != MAIL_NO_ERROR) { |
265 | Global::statusMessage(tr("Error initializing mbox")); | 266 | Global::statusMessage(tr("Error initializing mbox")); |
266 | res = 0; | 267 | res = 0; |
267 | } | 268 | } |
268 | } | 269 | } |
269 | if (res) { | 270 | if (res) { |
270 | r = mailsession_get_messages_list(folder->fld_session,&l); | 271 | r = mailsession_get_messages_list(folder->fld_session,&l); |
271 | if (r != MAIL_NO_ERROR) { | 272 | if (r != MAIL_NO_ERROR) { |
272 | qDebug("Error message list"); | 273 | qDebug("Error message list"); |
273 | res=0; | 274 | res=0; |
274 | } | 275 | } |
275 | } | 276 | } |
276 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { | 277 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { |
277 | r = mailsession_remove_message(folder->fld_session,i+1); | 278 | r = mailsession_remove_message(folder->fld_session,i+1); |
278 | if (r != MAIL_NO_ERROR) { | 279 | if (r != MAIL_NO_ERROR) { |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index f97fce2..2794014 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h | |||
@@ -1,44 +1,45 @@ | |||
1 | #ifndef __MBOX_WRAPPER_H | 1 | #ifndef __MBOX_WRAPPER_H |
2 | #define __MBOX_WRAPPER_H | 2 | #define __MBOX_WRAPPER_H |
3 | 3 | ||
4 | #include "genericwrapper.h" | 4 | #include "genericwrapper.h" |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | 6 | ||
7 | class RecMail; | 7 | class RecMail; |
8 | class RecBody; | 8 | class RecBody; |
9 | class encodedString; | ||
9 | struct mailmbox_folder; | 10 | struct mailmbox_folder; |
10 | 11 | ||
11 | class MBOXwrapper : public Genericwrapper | 12 | class MBOXwrapper : public Genericwrapper |
12 | { | 13 | { |
13 | Q_OBJECT | 14 | Q_OBJECT |
14 | public: | 15 | public: |
15 | MBOXwrapper(const QString & dir); | 16 | MBOXwrapper(const QString & dir); |
16 | virtual ~MBOXwrapper(); | 17 | virtual ~MBOXwrapper(); |
17 | 18 | ||
18 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
19 | virtual QList<Folder>* listFolders(); | 20 | virtual QList<Folder>* listFolders(); |
20 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 21 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
21 | 22 | ||
22 | virtual void deleteMail(const RecMail&mail); | 23 | virtual void deleteMail(const RecMail&mail); |
23 | virtual void answeredMail(const RecMail&mail); | 24 | virtual void answeredMail(const RecMail&mail); |
24 | 25 | ||
25 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); | 26 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); |
26 | virtual int deleteMbox(const Folder*); | 27 | virtual int deleteMbox(const Folder*); |
27 | 28 | ||
28 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 29 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
29 | 30 | ||
30 | virtual RecBody fetchBody( const RecMail &mail ); | 31 | virtual RecBody fetchBody( const RecMail &mail ); |
31 | static void mbox_progress( size_t current, size_t maximum ); | 32 | static void mbox_progress( size_t current, size_t maximum ); |
32 | 33 | ||
33 | virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); | 34 | virtual encodedString* fetchRawBody(const RecMail&mail); |
34 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); | 35 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); |
35 | virtual int deleteAllMail(const Folder*); | 36 | virtual int deleteAllMail(const Folder*); |
36 | virtual const QString&getType()const; | 37 | virtual const QString&getType()const; |
37 | 38 | ||
38 | protected: | 39 | protected: |
39 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); | 40 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); |
40 | QString MBOXPath; | 41 | QString MBOXPath; |
41 | static const QString wrapperType; | 42 | static const QString wrapperType; |
42 | }; | 43 | }; |
43 | 44 | ||
44 | #endif | 45 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 45408dd..72c145b 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -167,76 +167,83 @@ void POP3wrapper::logout() | |||
167 | mailfolder_free(m_folder); | 167 | mailfolder_free(m_folder); |
168 | m_folder = 0; | 168 | m_folder = 0; |
169 | mailstorage_free(m_pop3); | 169 | mailstorage_free(m_pop3); |
170 | m_pop3 = 0; | 170 | m_pop3 = 0; |
171 | } | 171 | } |
172 | 172 | ||
173 | 173 | ||
174 | QList<Folder>* POP3wrapper::listFolders() | 174 | QList<Folder>* POP3wrapper::listFolders() |
175 | { | 175 | { |
176 | QList<Folder> * folders = new QList<Folder>(); | 176 | QList<Folder> * folders = new QList<Folder>(); |
177 | folders->setAutoDelete( false ); | 177 | folders->setAutoDelete( false ); |
178 | Folder*inb=new Folder("INBOX","/"); | 178 | Folder*inb=new Folder("INBOX","/"); |
179 | folders->append(inb); | 179 | folders->append(inb); |
180 | return folders; | 180 | return folders; |
181 | } | 181 | } |
182 | 182 | ||
183 | void POP3wrapper::deleteMail(const RecMail&mail) | 183 | void POP3wrapper::deleteMail(const RecMail&mail) |
184 | { | 184 | { |
185 | login(); | 185 | login(); |
186 | if (!m_pop3) return; | 186 | if (!m_pop3) return; |
187 | int err = mailsession_remove_message(m_folder->fld_session,mail.getNumber()); | 187 | int err = mailsession_remove_message(m_folder->fld_session,mail.getNumber()); |
188 | if (err != MAIL_NO_ERROR) { | 188 | if (err != MAIL_NO_ERROR) { |
189 | Global::statusMessage(tr("error deleting mail")); | 189 | Global::statusMessage(tr("error deleting mail")); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | void POP3wrapper::answeredMail(const RecMail&) | 193 | void POP3wrapper::answeredMail(const RecMail&) |
194 | { | 194 | { |
195 | } | 195 | } |
196 | 196 | ||
197 | int POP3wrapper::deleteAllMail(const Folder*) | 197 | int POP3wrapper::deleteAllMail(const Folder*) |
198 | { | 198 | { |
199 | login(); | 199 | login(); |
200 | if (!m_pop3) return 0; | 200 | if (!m_pop3) return 0; |
201 | int res = 1; | 201 | int res = 1; |
202 | 202 | ||
203 | uint32_t result = 0; | 203 | uint32_t result = 0; |
204 | int err = mailsession_messages_number(m_folder->fld_session,NULL,&result); | 204 | int err = mailsession_messages_number(m_folder->fld_session,NULL,&result); |
205 | if (err != MAIL_NO_ERROR) { | 205 | if (err != MAIL_NO_ERROR) { |
206 | Global::statusMessage(tr("Error getting folder info")); | 206 | Global::statusMessage(tr("Error getting folder info")); |
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | for (unsigned int i = 0; i < result; ++i) { | 209 | for (unsigned int i = 0; i < result; ++i) { |
210 | err = mailsession_remove_message(m_folder->fld_session,i+1); | 210 | err = mailsession_remove_message(m_folder->fld_session,i+1); |
211 | if (err != MAIL_NO_ERROR) { | 211 | if (err != MAIL_NO_ERROR) { |
212 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | 212 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); |
213 | res=0; | 213 | res=0; |
214 | } | 214 | } |
215 | break; | 215 | break; |
216 | } | 216 | } |
217 | return res; | 217 | return res; |
218 | } | 218 | } |
219 | 219 | ||
220 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) | 220 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) |
221 | { | 221 | { |
222 | login(); | 222 | login(); |
223 | target_stat.message_count = 0; | 223 | target_stat.message_count = 0; |
224 | target_stat.message_unseen = 0; | 224 | target_stat.message_unseen = 0; |
225 | target_stat.message_recent = 0; | 225 | target_stat.message_recent = 0; |
226 | if (!m_pop3) return; | 226 | if (!m_pop3) return; |
227 | int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, | 227 | int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, |
228 | &target_stat.message_recent,&target_stat.message_unseen); | 228 | &target_stat.message_recent,&target_stat.message_unseen); |
229 | } | 229 | } |
230 | 230 | ||
231 | void POP3wrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | 231 | encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) |
232 | { | 232 | { |
233 | char*target=0; | ||
234 | size_t length=0; | ||
235 | encodedString*res = 0; | ||
233 | mailmessage * mailmsg = 0; | 236 | mailmessage * mailmsg = 0; |
234 | int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); | 237 | int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); |
235 | err = mailmessage_fetch(mailmsg,target,length); | 238 | err = mailmessage_fetch(mailmsg,&target,&length); |
236 | if (mailmsg) mailmessage_free(mailmsg); | 239 | if (mailmsg) mailmessage_free(mailmsg); |
240 | if (target) { | ||
241 | res = new encodedString(target,length); | ||
242 | } | ||
243 | return res; | ||
237 | } | 244 | } |
238 | 245 | ||
239 | const QString&POP3wrapper::getType()const | 246 | const QString&POP3wrapper::getType()const |
240 | { | 247 | { |
241 | return account->getType(); | 248 | return account->getType(); |
242 | } | 249 | } |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index b7e8f27..f0307b6 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -1,41 +1,42 @@ | |||
1 | #ifndef __POP3WRAPPER | 1 | #ifndef __POP3WRAPPER |
2 | #define __POP3WRAPPER | 2 | #define __POP3WRAPPER |
3 | 3 | ||
4 | #include "mailwrapper.h" | 4 | #include "mailwrapper.h" |
5 | #include "genericwrapper.h" | 5 | #include "genericwrapper.h" |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | 7 | ||
8 | class encodedString; | ||
8 | struct mailstorage; | 9 | struct mailstorage; |
9 | struct mailfolder; | 10 | struct mailfolder; |
10 | 11 | ||
11 | class POP3wrapper : public Genericwrapper | 12 | class POP3wrapper : public Genericwrapper |
12 | { | 13 | { |
13 | Q_OBJECT | 14 | Q_OBJECT |
14 | 15 | ||
15 | public: | 16 | public: |
16 | POP3wrapper( POP3account *a ); | 17 | POP3wrapper( POP3account *a ); |
17 | virtual ~POP3wrapper(); | 18 | virtual ~POP3wrapper(); |
18 | /* mailbox will be ignored */ | 19 | /* mailbox will be ignored */ |
19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 20 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
20 | virtual QList<Folder>* listFolders(); | 21 | virtual QList<Folder>* listFolders(); |
21 | /* mailbox will be ignored */ | 22 | /* mailbox will be ignored */ |
22 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 23 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
23 | 24 | ||
24 | virtual void deleteMail(const RecMail&mail); | 25 | virtual void deleteMail(const RecMail&mail); |
25 | virtual void answeredMail(const RecMail&mail); | 26 | virtual void answeredMail(const RecMail&mail); |
26 | virtual int deleteAllMail(const Folder*); | 27 | virtual int deleteAllMail(const Folder*); |
27 | 28 | ||
28 | virtual RecBody fetchBody( const RecMail &mail ); | 29 | virtual RecBody fetchBody( const RecMail &mail ); |
29 | virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); | 30 | virtual encodedString* fetchRawBody(const RecMail&mail); |
30 | virtual void logout(); | 31 | virtual void logout(); |
31 | virtual const QString&getType()const; | 32 | virtual const QString&getType()const; |
32 | static void pop3_progress( size_t current, size_t maximum ); | 33 | static void pop3_progress( size_t current, size_t maximum ); |
33 | 34 | ||
34 | protected: | 35 | protected: |
35 | void login(); | 36 | void login(); |
36 | POP3account *account; | 37 | POP3account *account; |
37 | mailstorage*m_pop3; | 38 | mailstorage*m_pop3; |
38 | mailfolder*m_folder; | 39 | mailfolder*m_folder; |
39 | }; | 40 | }; |
40 | 41 | ||
41 | #endif | 42 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index e054365..00181ff 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -424,311 +424,308 @@ void SMTPwrapper::addRcpts( clist *list, mailimf_address_list *addr_list ) | |||
424 | } | 424 | } |
425 | } | 425 | } |
426 | } | 426 | } |
427 | 427 | ||
428 | clist *SMTPwrapper::createRcptList( mailimf_fields *fields ) | 428 | clist *SMTPwrapper::createRcptList( mailimf_fields *fields ) |
429 | { | 429 | { |
430 | clist *rcptList; | 430 | clist *rcptList; |
431 | mailimf_field *field; | 431 | mailimf_field *field; |
432 | 432 | ||
433 | rcptList = esmtp_address_list_new(); | 433 | rcptList = esmtp_address_list_new(); |
434 | 434 | ||
435 | field = getField( fields, MAILIMF_FIELD_TO ); | 435 | field = getField( fields, MAILIMF_FIELD_TO ); |
436 | if ( field && (field->fld_type == MAILIMF_FIELD_TO) | 436 | if ( field && (field->fld_type == MAILIMF_FIELD_TO) |
437 | && field->fld_data.fld_to->to_addr_list ) { | 437 | && field->fld_data.fld_to->to_addr_list ) { |
438 | addRcpts( rcptList, field->fld_data.fld_to->to_addr_list ); | 438 | addRcpts( rcptList, field->fld_data.fld_to->to_addr_list ); |
439 | } | 439 | } |
440 | 440 | ||
441 | field = getField( fields, MAILIMF_FIELD_CC ); | 441 | field = getField( fields, MAILIMF_FIELD_CC ); |
442 | if ( field && (field->fld_type == MAILIMF_FIELD_CC) | 442 | if ( field && (field->fld_type == MAILIMF_FIELD_CC) |
443 | && field->fld_data.fld_cc->cc_addr_list ) { | 443 | && field->fld_data.fld_cc->cc_addr_list ) { |
444 | addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list ); | 444 | addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list ); |
445 | } | 445 | } |
446 | 446 | ||
447 | field = getField( fields, MAILIMF_FIELD_BCC ); | 447 | field = getField( fields, MAILIMF_FIELD_BCC ); |
448 | if ( field && (field->fld_type == MAILIMF_FIELD_BCC) | 448 | if ( field && (field->fld_type == MAILIMF_FIELD_BCC) |
449 | && field->fld_data.fld_bcc->bcc_addr_list ) { | 449 | && field->fld_data.fld_bcc->bcc_addr_list ) { |
450 | addRcpts( rcptList, field->fld_data.fld_bcc->bcc_addr_list ); | 450 | addRcpts( rcptList, field->fld_data.fld_bcc->bcc_addr_list ); |
451 | } | 451 | } |
452 | 452 | ||
453 | return rcptList; | 453 | return rcptList; |
454 | } | 454 | } |
455 | 455 | ||
456 | char *SMTPwrapper::getFrom( mailimf_field *ffrom) | 456 | char *SMTPwrapper::getFrom( mailimf_field *ffrom) |
457 | { | 457 | { |
458 | char *from = NULL; | 458 | char *from = NULL; |
459 | if ( ffrom && (ffrom->fld_type == MAILIMF_FIELD_FROM) | 459 | if ( ffrom && (ffrom->fld_type == MAILIMF_FIELD_FROM) |
460 | && ffrom->fld_data.fld_from->frm_mb_list && ffrom->fld_data.fld_from->frm_mb_list->mb_list ) { | 460 | && ffrom->fld_data.fld_from->frm_mb_list && ffrom->fld_data.fld_from->frm_mb_list->mb_list ) { |
461 | clist *cl = ffrom->fld_data.fld_from->frm_mb_list->mb_list; | 461 | clist *cl = ffrom->fld_data.fld_from->frm_mb_list->mb_list; |
462 | clistiter *it; | 462 | clistiter *it; |
463 | for ( it = clist_begin( cl ); it; it = it->next ) { | 463 | for ( it = clist_begin( cl ); it; it = it->next ) { |
464 | mailimf_mailbox *mb = (mailimf_mailbox *) it->data; | 464 | mailimf_mailbox *mb = (mailimf_mailbox *) it->data; |
465 | from = strdup( mb->mb_addr_spec ); | 465 | from = strdup( mb->mb_addr_spec ); |
466 | } | 466 | } |
467 | } | 467 | } |
468 | 468 | ||
469 | return from; | 469 | return from; |
470 | } | 470 | } |
471 | 471 | ||
472 | char *SMTPwrapper::getFrom( mailmime *mail ) | 472 | char *SMTPwrapper::getFrom( mailmime *mail ) |
473 | { | 473 | { |
474 | /* no need to delete - its just a pointer to structure content */ | 474 | /* no need to delete - its just a pointer to structure content */ |
475 | mailimf_field *ffrom = 0; | 475 | mailimf_field *ffrom = 0; |
476 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); | 476 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); |
477 | return getFrom(ffrom); | 477 | return getFrom(ffrom); |
478 | } | 478 | } |
479 | 479 | ||
480 | void SMTPwrapper::progress( size_t current, size_t maximum ) | 480 | void SMTPwrapper::progress( size_t current, size_t maximum ) |
481 | { | 481 | { |
482 | if (SMTPwrapper::sendProgress) { | 482 | if (SMTPwrapper::sendProgress) { |
483 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); | 483 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); |
484 | qApp->processEvents(); | 484 | qApp->processEvents(); |
485 | } | 485 | } |
486 | } | 486 | } |
487 | 487 | ||
488 | void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box) | 488 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) |
489 | { | 489 | { |
490 | if (!mail) return; | 490 | if (!mail) return; |
491 | QString localfolders = AbstractMail::defaultLocalfolder(); | 491 | QString localfolders = AbstractMail::defaultLocalfolder(); |
492 | MBOXwrapper*wrap = new MBOXwrapper(localfolders); | 492 | MBOXwrapper*wrap = new MBOXwrapper(localfolders); |
493 | wrap->storeMessage(mail,length,box); | 493 | wrap->storeMessage(mail,length,box); |
494 | delete wrap; | 494 | delete wrap; |
495 | } | 495 | } |
496 | 496 | ||
497 | void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | 497 | void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) |
498 | { | 498 | { |
499 | clist *rcpts = 0; | 499 | clist *rcpts = 0; |
500 | char *from, *data; | 500 | char *from, *data; |
501 | size_t size; | 501 | size_t size; |
502 | 502 | ||
503 | if ( smtp == NULL ) { | 503 | if ( smtp == NULL ) { |
504 | return; | 504 | return; |
505 | } | 505 | } |
506 | from = data = 0; | 506 | from = data = 0; |
507 | 507 | ||
508 | mailmessage * msg = 0; | 508 | mailmessage * msg = 0; |
509 | msg = mime_message_init(mail); | 509 | msg = mime_message_init(mail); |
510 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | 510 | mime_message_set_tmpdir(msg,getenv( "HOME" )); |
511 | int r = mailmessage_fetch(msg,&data,&size); | 511 | int r = mailmessage_fetch(msg,&data,&size); |
512 | mime_message_detach_mime(msg); | 512 | mime_message_detach_mime(msg); |
513 | mailmessage_free(msg); | 513 | mailmessage_free(msg); |
514 | if (r != MAIL_NO_ERROR || !data) { | 514 | if (r != MAIL_NO_ERROR || !data) { |
515 | if (data) free(data); | 515 | if (data) free(data); |
516 | qDebug("Error fetching mime..."); | 516 | qDebug("Error fetching mime..."); |
517 | return; | 517 | return; |
518 | } | 518 | } |
519 | QString tmp = data; | 519 | QString tmp = data; |
520 | tmp.replace(QRegExp("\r+",true,false),""); | 520 | tmp.replace(QRegExp("\r+",true,false),""); |
521 | msg = 0; | 521 | msg = 0; |
522 | if (later) { | 522 | if (later) { |
523 | storeMail((char*)tmp.data(),tmp.length(),"Outgoing"); | 523 | storeMail((char*)tmp.data(),tmp.length(),"Outgoing"); |
524 | if (data) free( data ); | 524 | if (data) free( data ); |
525 | Config cfg( "mail" ); | 525 | Config cfg( "mail" ); |
526 | cfg.setGroup( "Status" ); | 526 | cfg.setGroup( "Status" ); |
527 | cfg.writeEntry( "outgoing", ++m_queuedMail ); | 527 | cfg.writeEntry( "outgoing", ++m_queuedMail ); |
528 | emit queuedMails( m_queuedMail ); | 528 | emit queuedMails( m_queuedMail ); |
529 | return; | 529 | return; |
530 | } | 530 | } |
531 | from = getFrom( mail ); | 531 | from = getFrom( mail ); |
532 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); | 532 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); |
533 | smtpSend(from,rcpts,data,size,smtp); | 533 | smtpSend(from,rcpts,data,size,smtp); |
534 | if (data) {free(data);} | 534 | if (data) {free(data);} |
535 | if (from) {free(from);} | 535 | if (from) {free(from);} |
536 | if (rcpts) smtp_address_list_free( rcpts ); | 536 | if (rcpts) smtp_address_list_free( rcpts ); |
537 | } | 537 | } |
538 | 538 | ||
539 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ) | 539 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) |
540 | { | 540 | { |
541 | char *server, *user, *pass; | 541 | char *server, *user, *pass; |
542 | bool ssl; | 542 | bool ssl; |
543 | uint16_t port; | 543 | uint16_t port; |
544 | mailsmtp *session; | 544 | mailsmtp *session; |
545 | int err,result; | 545 | int err,result; |
546 | 546 | ||
547 | result = 1; | 547 | result = 1; |
548 | server = user = pass = 0; | 548 | server = user = pass = 0; |
549 | server = strdup( smtp->getServer().latin1() ); | 549 | server = strdup( smtp->getServer().latin1() ); |
550 | ssl = smtp->getSSL(); | 550 | ssl = smtp->getSSL(); |
551 | port = smtp->getPort().toUInt(); | 551 | port = smtp->getPort().toUInt(); |
552 | 552 | ||
553 | session = mailsmtp_new( 20, &progress ); | 553 | session = mailsmtp_new( 20, &progress ); |
554 | if ( session == NULL ) goto free_mem; | 554 | if ( session == NULL ) goto free_mem; |
555 | 555 | ||
556 | qDebug( "Servername %s at port %i", server, port ); | 556 | qDebug( "Servername %s at port %i", server, port ); |
557 | if ( ssl ) { | 557 | if ( ssl ) { |
558 | qDebug( "SSL session" ); | 558 | qDebug( "SSL session" ); |
559 | err = mailsmtp_ssl_connect( session, server, port ); | 559 | err = mailsmtp_ssl_connect( session, server, port ); |
560 | } else { | 560 | } else { |
561 | qDebug( "No SSL session" ); | 561 | qDebug( "No SSL session" ); |
562 | err = mailsmtp_socket_connect( session, server, port ); | 562 | err = mailsmtp_socket_connect( session, server, port ); |
563 | } | 563 | } |
564 | if ( err != MAILSMTP_NO_ERROR ) {result = 0;goto free_mem_session;} | 564 | if ( err != MAILSMTP_NO_ERROR ) {result = 0;goto free_mem_session;} |
565 | 565 | ||
566 | err = mailsmtp_init( session ); | 566 | err = mailsmtp_init( session ); |
567 | if ( err != MAILSMTP_NO_ERROR ) {result = 0; goto free_con_session;} | 567 | if ( err != MAILSMTP_NO_ERROR ) {result = 0; goto free_con_session;} |
568 | 568 | ||
569 | qDebug( "INIT OK" ); | 569 | qDebug( "INIT OK" ); |
570 | 570 | ||
571 | if ( smtp->getLogin() ) { | 571 | if ( smtp->getLogin() ) { |
572 | if ( smtp->getUser().isEmpty() || smtp->getPassword().isEmpty() ) { | 572 | if ( smtp->getUser().isEmpty() || smtp->getPassword().isEmpty() ) { |
573 | // get'em | 573 | // get'em |
574 | LoginDialog login( smtp->getUser(), smtp->getPassword(), NULL, 0, true ); | 574 | LoginDialog login( smtp->getUser(), smtp->getPassword(), NULL, 0, true ); |
575 | login.show(); | 575 | login.show(); |
576 | if ( QDialog::Accepted == login.exec() ) { | 576 | if ( QDialog::Accepted == login.exec() ) { |
577 | // ok | 577 | // ok |
578 | user = strdup( login.getUser().latin1() ); | 578 | user = strdup( login.getUser().latin1() ); |
579 | pass = strdup( login.getPassword().latin1() ); | 579 | pass = strdup( login.getPassword().latin1() ); |
580 | } else { | 580 | } else { |
581 | result = 0; goto free_con_session; | 581 | result = 0; goto free_con_session; |
582 | } | 582 | } |
583 | } else { | 583 | } else { |
584 | user = strdup( smtp->getUser().latin1() ); | 584 | user = strdup( smtp->getUser().latin1() ); |
585 | pass = strdup( smtp->getPassword().latin1() ); | 585 | pass = strdup( smtp->getPassword().latin1() ); |
586 | } | 586 | } |
587 | qDebug( "session->auth: %i", session->auth); | 587 | qDebug( "session->auth: %i", session->auth); |
588 | err = mailsmtp_auth( session, user, pass ); | 588 | err = mailsmtp_auth( session, user, pass ); |
589 | if ( err == MAILSMTP_NO_ERROR ) qDebug("auth ok"); | 589 | if ( err == MAILSMTP_NO_ERROR ) qDebug("auth ok"); |
590 | qDebug( "Done auth!" ); | 590 | qDebug( "Done auth!" ); |
591 | } | 591 | } |
592 | 592 | ||
593 | err = mailsmtp_send( session, from, rcpts, data, size ); | 593 | err = mailsmtp_send( session, from, rcpts, data, size ); |
594 | if ( err != MAILSMTP_NO_ERROR ) { | 594 | if ( err != MAILSMTP_NO_ERROR ) { |
595 | qDebug("Error sending mail: %s",mailsmtpError(err).latin1()); | 595 | qDebug("Error sending mail: %s",mailsmtpError(err).latin1()); |
596 | result = 0; goto free_con_session; | 596 | result = 0; goto free_con_session; |
597 | } | 597 | } |
598 | 598 | ||
599 | qDebug( "Mail sent." ); | 599 | qDebug( "Mail sent." ); |
600 | storeMail(data,size,"Sent"); | 600 | storeMail(data,size,"Sent"); |
601 | 601 | ||
602 | free_con_session: | 602 | free_con_session: |
603 | mailsmtp_quit( session ); | 603 | mailsmtp_quit( session ); |
604 | free_mem_session: | 604 | free_mem_session: |
605 | mailsmtp_free( session ); | 605 | mailsmtp_free( session ); |
606 | free_mem: | 606 | free_mem: |
607 | if (server) free( server ); | 607 | if (server) free( server ); |
608 | if ( smtp->getLogin() ) { | 608 | if ( smtp->getLogin() ) { |
609 | free( user ); | 609 | free( user ); |
610 | free( pass ); | 610 | free( pass ); |
611 | } | 611 | } |
612 | return result; | 612 | return result; |
613 | } | 613 | } |
614 | 614 | ||
615 | void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) | 615 | void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) |
616 | { | 616 | { |
617 | mailmime * mimeMail; | 617 | mailmime * mimeMail; |
618 | 618 | ||
619 | SMTPaccount *smtp = aSmtp; | 619 | SMTPaccount *smtp = aSmtp; |
620 | 620 | ||
621 | if (!later && !smtp) { | 621 | if (!later && !smtp) { |
622 | qDebug("Didn't get any send method - giving up"); | 622 | qDebug("Didn't get any send method - giving up"); |
623 | return; | 623 | return; |
624 | } | 624 | } |
625 | mimeMail = createMimeMail(mail ); | 625 | mimeMail = createMimeMail(mail ); |
626 | if ( mimeMail == NULL ) { | 626 | if ( mimeMail == NULL ) { |
627 | qDebug( "sendMail: error creating mime mail" ); | 627 | qDebug( "sendMail: error creating mime mail" ); |
628 | } else { | 628 | } else { |
629 | sendProgress = new progressMailSend(); | 629 | sendProgress = new progressMailSend(); |
630 | sendProgress->show(); | 630 | sendProgress->show(); |
631 | sendProgress->setMaxMails(1); | 631 | sendProgress->setMaxMails(1); |
632 | smtpSend( mimeMail,later,smtp); | 632 | smtpSend( mimeMail,later,smtp); |
633 | qDebug("Clean up done"); | 633 | qDebug("Clean up done"); |
634 | sendProgress->hide(); | 634 | sendProgress->hide(); |
635 | delete sendProgress; | 635 | delete sendProgress; |
636 | sendProgress = 0; | 636 | sendProgress = 0; |
637 | mailmime_free( mimeMail ); | 637 | mailmime_free( mimeMail ); |
638 | } | 638 | } |
639 | } | 639 | } |
640 | 640 | ||
641 | int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | 641 | int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) |
642 | { | 642 | { |
643 | char*data = 0; | ||
644 | size_t length = 0; | ||
645 | size_t curTok = 0; | 643 | size_t curTok = 0; |
646 | mailimf_fields *fields = 0; | 644 | mailimf_fields *fields = 0; |
647 | mailimf_field*ffrom = 0; | 645 | mailimf_field*ffrom = 0; |
648 | clist *rcpts = 0; | 646 | clist *rcpts = 0; |
649 | char*from = 0; | 647 | char*from = 0; |
650 | int res = 0; | 648 | int res = 0; |
651 | 649 | ||
652 | wrap->fetchRawBody(*which,&data,&length); | 650 | encodedString * data = wrap->fetchRawBody(*which); |
653 | if (!data) return 0; | 651 | if (!data) return 0; |
654 | int err = mailimf_fields_parse( data, length, &curTok, &fields ); | 652 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); |
655 | if (err != MAILIMF_NO_ERROR) { | 653 | if (err != MAILIMF_NO_ERROR) { |
656 | free(data); | 654 | delete data; |
657 | delete wrap; | 655 | delete wrap; |
658 | return 0; | 656 | return 0; |
659 | } | 657 | } |
660 | 658 | ||
661 | rcpts = createRcptList( fields ); | 659 | rcpts = createRcptList( fields ); |
662 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); | 660 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); |
663 | from = getFrom(ffrom); | 661 | from = getFrom(ffrom); |
664 | 662 | ||
665 | qDebug("Size: %i vs. %i",length,strlen(data)); | ||
666 | if (rcpts && from) { | 663 | if (rcpts && from) { |
667 | res = smtpSend(from,rcpts,data,length,smtp ); | 664 | res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp ); |
668 | } | 665 | } |
669 | if (fields) { | 666 | if (fields) { |
670 | mailimf_fields_free(fields); | 667 | mailimf_fields_free(fields); |
671 | fields = 0; | 668 | fields = 0; |
672 | } | 669 | } |
673 | if (data) { | 670 | if (data) { |
674 | free(data); | 671 | delete data; |
675 | } | 672 | } |
676 | if (from) { | 673 | if (from) { |
677 | free(from); | 674 | free(from); |
678 | } | 675 | } |
679 | if (rcpts) { | 676 | if (rcpts) { |
680 | smtp_address_list_free( rcpts ); | 677 | smtp_address_list_free( rcpts ); |
681 | } | 678 | } |
682 | return res; | 679 | return res; |
683 | } | 680 | } |
684 | 681 | ||
685 | /* this is a special fun */ | 682 | /* this is a special fun */ |
686 | bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | 683 | bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) |
687 | { | 684 | { |
688 | bool returnValue = true; | 685 | bool returnValue = true; |
689 | 686 | ||
690 | if (!smtp) return false; | 687 | if (!smtp) return false; |
691 | 688 | ||
692 | QString localfolders = AbstractMail::defaultLocalfolder(); | 689 | QString localfolders = AbstractMail::defaultLocalfolder(); |
693 | MBOXwrapper*wrap = new MBOXwrapper(localfolders); | 690 | MBOXwrapper*wrap = new MBOXwrapper(localfolders); |
694 | if (!wrap) { | 691 | if (!wrap) { |
695 | qDebug("memory error"); | 692 | qDebug("memory error"); |
696 | return false; | 693 | return false; |
697 | } | 694 | } |
698 | QList<RecMail> mailsToSend; | 695 | QList<RecMail> mailsToSend; |
699 | QList<RecMail> mailsToRemove; | 696 | QList<RecMail> mailsToRemove; |
700 | QString mbox("Outgoing"); | 697 | QString mbox("Outgoing"); |
701 | wrap->listMessages(mbox,mailsToSend); | 698 | wrap->listMessages(mbox,mailsToSend); |
702 | if (mailsToSend.count()==0) { | 699 | if (mailsToSend.count()==0) { |
703 | delete wrap; | 700 | delete wrap; |
704 | return false; | 701 | return false; |
705 | } | 702 | } |
706 | mailsToSend.setAutoDelete(false); | 703 | mailsToSend.setAutoDelete(false); |
707 | sendProgress = new progressMailSend(); | 704 | sendProgress = new progressMailSend(); |
708 | sendProgress->show(); | 705 | sendProgress->show(); |
709 | sendProgress->setMaxMails(mailsToSend.count()); | 706 | sendProgress->setMaxMails(mailsToSend.count()); |
710 | 707 | ||
711 | while (mailsToSend.count()>0) { | 708 | while (mailsToSend.count()>0) { |
712 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { | 709 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { |
713 | QMessageBox::critical(0,tr("Error sending mail"), | 710 | QMessageBox::critical(0,tr("Error sending mail"), |
714 | tr("Error sending queued mail - breaking")); | 711 | tr("Error sending queued mail - breaking")); |
715 | returnValue = false; | 712 | returnValue = false; |
716 | break; | 713 | break; |
717 | } | 714 | } |
718 | mailsToRemove.append(mailsToSend.at(0)); | 715 | mailsToRemove.append(mailsToSend.at(0)); |
719 | mailsToSend.removeFirst(); | 716 | mailsToSend.removeFirst(); |
720 | sendProgress->setCurrentMails(mailsToRemove.count()); | 717 | sendProgress->setCurrentMails(mailsToRemove.count()); |
721 | } | 718 | } |
722 | Config cfg( "mail" ); | 719 | Config cfg( "mail" ); |
723 | cfg.setGroup( "Status" ); | 720 | cfg.setGroup( "Status" ); |
724 | m_queuedMail = 0; | 721 | m_queuedMail = 0; |
725 | cfg.writeEntry( "outgoing", m_queuedMail ); | 722 | cfg.writeEntry( "outgoing", m_queuedMail ); |
726 | emit queuedMails( m_queuedMail ); | 723 | emit queuedMails( m_queuedMail ); |
727 | sendProgress->hide(); | 724 | sendProgress->hide(); |
728 | delete sendProgress; | 725 | delete sendProgress; |
729 | sendProgress = 0; | 726 | sendProgress = 0; |
730 | wrap->deleteMails(mbox,mailsToRemove); | 727 | wrap->deleteMails(mbox,mailsToRemove); |
731 | mailsToSend.setAutoDelete(true); | 728 | mailsToSend.setAutoDelete(true); |
732 | delete wrap; | 729 | delete wrap; |
733 | return returnValue; | 730 | return returnValue; |
734 | } | 731 | } |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index 4a4352f..04fc4b0 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h | |||
@@ -1,72 +1,72 @@ | |||
1 | #ifndef SMTPwrapper_H | 1 | #ifndef SMTPwrapper_H |
2 | #define SMTPwrapper_H | 2 | #define SMTPwrapper_H |
3 | 3 | ||
4 | #include <qpe/applnk.h> | 4 | #include <qpe/applnk.h> |
5 | 5 | ||
6 | #include <qbitarray.h> | 6 | #include <qbitarray.h> |
7 | #include <qdatetime.h> | 7 | #include <qdatetime.h> |
8 | #include <libetpan/clist.h> | 8 | #include <libetpan/clist.h> |
9 | 9 | ||
10 | #include "settings.h" | 10 | #include "settings.h" |
11 | 11 | ||
12 | class Mail; | 12 | class Mail; |
13 | class MBOXwrapper; | 13 | class MBOXwrapper; |
14 | class RecMail; | 14 | class RecMail; |
15 | class Attachment; | 15 | class Attachment; |
16 | struct mailimf_fields; | 16 | struct mailimf_fields; |
17 | struct mailimf_field; | 17 | struct mailimf_field; |
18 | struct mailimf_mailbox; | 18 | struct mailimf_mailbox; |
19 | struct mailmime; | 19 | struct mailmime; |
20 | struct mailimf_address_list; | 20 | struct mailimf_address_list; |
21 | class progressMailSend; | 21 | class progressMailSend; |
22 | 22 | ||
23 | class SMTPwrapper : public QObject | 23 | class SMTPwrapper : public QObject |
24 | { | 24 | { |
25 | Q_OBJECT | 25 | Q_OBJECT |
26 | 26 | ||
27 | public: | 27 | public: |
28 | SMTPwrapper( Settings *s ); | 28 | SMTPwrapper( Settings *s ); |
29 | virtual ~SMTPwrapper(){} | 29 | virtual ~SMTPwrapper(){} |
30 | void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false ); | 30 | void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false ); |
31 | bool flushOutbox(SMTPaccount*smtp); | 31 | bool flushOutbox(SMTPaccount*smtp); |
32 | 32 | ||
33 | static progressMailSend*sendProgress; | 33 | static progressMailSend*sendProgress; |
34 | 34 | ||
35 | signals: | 35 | signals: |
36 | void queuedMails( int ); | 36 | void queuedMails( int ); |
37 | 37 | ||
38 | protected: | 38 | protected: |
39 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); | 39 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); |
40 | mailimf_fields *createImfFields(const Mail &mail ); | 40 | mailimf_fields *createImfFields(const Mail &mail ); |
41 | mailmime *createMimeMail(const Mail&mail ); | 41 | mailmime *createMimeMail(const Mail&mail ); |
42 | 42 | ||
43 | mailimf_address_list *parseAddresses(const QString&addr ); | 43 | mailimf_address_list *parseAddresses(const QString&addr ); |
44 | void addFileParts( mailmime *message,const QList<Attachment>&files ); | 44 | void addFileParts( mailmime *message,const QList<Attachment>&files ); |
45 | mailmime *buildTxtPart(const QString&str ); | 45 | mailmime *buildTxtPart(const QString&str ); |
46 | mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); | 46 | mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); |
47 | void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); | 47 | void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); |
48 | clist *createRcptList( mailimf_fields *fields ); | 48 | clist *createRcptList( mailimf_fields *fields ); |
49 | 49 | ||
50 | static void storeMail(char*mail, size_t length, const QString&box); | 50 | static void storeMail(const char*mail, size_t length, const QString&box); |
51 | static QString mailsmtpError( int err ); | 51 | static QString mailsmtpError( int err ); |
52 | static void progress( size_t current, size_t maximum ); | 52 | static void progress( size_t current, size_t maximum ); |
53 | static void addRcpts( clist *list, mailimf_address_list *addr_list ); | 53 | static void addRcpts( clist *list, mailimf_address_list *addr_list ); |
54 | static char *getFrom( mailmime *mail ); | 54 | static char *getFrom( mailmime *mail ); |
55 | static char *getFrom( mailimf_field *ffrom); | 55 | static char *getFrom( mailimf_field *ffrom); |
56 | static mailimf_field *getField( mailimf_fields *fields, int type ); | 56 | static mailimf_field *getField( mailimf_fields *fields, int type ); |
57 | int smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ); | 57 | int smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ); |
58 | 58 | ||
59 | void storeMail(mailmime*mail, const QString&box); | 59 | void storeMail(mailmime*mail, const QString&box); |
60 | Settings *settings; | 60 | Settings *settings; |
61 | 61 | ||
62 | int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which); | 62 | int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which); |
63 | 63 | ||
64 | int m_queuedMail; | 64 | int m_queuedMail; |
65 | static const char* USER_AGENT; | 65 | static const char* USER_AGENT; |
66 | 66 | ||
67 | protected slots: | 67 | protected slots: |
68 | void emitQCop( int queued ); | 68 | void emitQCop( int queued ); |
69 | 69 | ||
70 | }; | 70 | }; |
71 | 71 | ||
72 | #endif | 72 | #endif |
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro index 96ffaa8..1abd2e8 100644 --- a/noncore/net/mail/mail.pro +++ b/noncore/net/mail/mail.pro | |||
@@ -1,53 +1,56 @@ | |||
1 | CONFIG += qt warn_on debug quick-app | 1 | CONFIG += qt warn_on debug quick-app |
2 | 2 | ||
3 | HEADERS = defines.h \ | 3 | HEADERS = defines.h \ |
4 | editaccounts.h \ | 4 | editaccounts.h \ |
5 | composemail.h \ | 5 | composemail.h \ |
6 | accountview.h \ | 6 | accountview.h \ |
7 | mainwindow.h \ | 7 | mainwindow.h \ |
8 | viewmail.h \ | 8 | viewmail.h \ |
9 | viewmailbase.h \ | 9 | viewmailbase.h \ |
10 | opiemail.h \ | 10 | opiemail.h \ |
11 | mailistviewitem.h \ | 11 | mailistviewitem.h \ |
12 | settingsdialog.h \ | 12 | settingsdialog.h \ |
13 | statuswidget.h \ | 13 | statuswidget.h \ |
14 | newmaildir.h | 14 | newmaildir.h \ |
15 | selectstore.h | ||
15 | 16 | ||
16 | SOURCES = main.cpp \ | 17 | SOURCES = main.cpp \ |
17 | opiemail.cpp \ | 18 | opiemail.cpp \ |
18 | mainwindow.cpp \ | 19 | mainwindow.cpp \ |
19 | accountview.cpp \ | 20 | accountview.cpp \ |
20 | composemail.cpp \ | 21 | composemail.cpp \ |
21 | addresspicker.cpp \ | 22 | addresspicker.cpp \ |
22 | editaccounts.cpp \ | 23 | editaccounts.cpp \ |
23 | viewmail.cpp \ | 24 | viewmail.cpp \ |
24 | viewmailbase.cpp \ | 25 | viewmailbase.cpp \ |
25 | settingsdialog.cpp \ | 26 | settingsdialog.cpp \ |
26 | statuswidget.cpp \ | 27 | statuswidget.cpp \ |
27 | newmaildir.cpp | 28 | newmaildir.cpp \ |
29 | selectstore.cpp | ||
28 | 30 | ||
29 | INTERFACES = editaccountsui.ui \ | 31 | INTERFACES = editaccountsui.ui \ |
30 | selectmailtypeui.ui \ | 32 | selectmailtypeui.ui \ |
31 | imapconfigui.ui \ | 33 | imapconfigui.ui \ |
32 | pop3configui.ui \ | 34 | pop3configui.ui \ |
33 | nntpconfigui.ui \ | 35 | nntpconfigui.ui \ |
34 | smtpconfigui.ui \ | 36 | smtpconfigui.ui \ |
35 | addresspickerui.ui \ | 37 | addresspickerui.ui \ |
36 | composemailui.ui \ | 38 | composemailui.ui \ |
37 | settingsdialogui.ui \ | 39 | settingsdialogui.ui \ |
38 | statuswidgetui.ui \ | 40 | statuswidgetui.ui \ |
39 | newmaildirui.ui | 41 | newmaildirui.ui \ |
42 | selectstoreui.ui | ||
40 | 43 | ||
41 | 44 | ||
42 | INCLUDEPATH += $(OPIEDIR)/include | 45 | INCLUDEPATH += $(OPIEDIR)/include |
43 | 46 | ||
44 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | 47 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) |
45 | contains( CONFTEST, y ){ | 48 | contains( CONFTEST, y ){ |
46 | LIBS += -lqpe -lopie -lmailwrapper -liconv | 49 | LIBS += -lqpe -lopie -lmailwrapper -liconv |
47 | }else{ | 50 | }else{ |
48 | LIBS += -lqpe -lopie -lmailwrapper | 51 | LIBS += -lqpe -lopie -lmailwrapper |
49 | } | 52 | } |
50 | 53 | ||
51 | TARGET = opiemail | 54 | TARGET = opiemail |
52 | 55 | ||
53 | include ( $(OPIEDIR)/include.pro ) | 56 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/mail/selectstore.cpp b/noncore/net/mail/selectstore.cpp new file mode 100644 index 0000000..28ab5a8 --- a/dev/null +++ b/noncore/net/mail/selectstore.cpp | |||
@@ -0,0 +1,19 @@ | |||
1 | #include "selectstore.h" | ||
2 | |||
3 | Selectstore::Selectstore(QWidget* parent, const char* name) | ||
4 | :selectstoreui(parent,name,true) | ||
5 | { | ||
6 | |||
7 | } | ||
8 | |||
9 | Selectstore::~Selectstore() | ||
10 | { | ||
11 | } | ||
12 | |||
13 | void Selectstore::slotCreateNewFolder() | ||
14 | { | ||
15 | } | ||
16 | |||
17 | void Selectstore::slotMoveMail() | ||
18 | { | ||
19 | } | ||
diff --git a/noncore/net/mail/selectstore.h b/noncore/net/mail/selectstore.h new file mode 100644 index 0000000..8b8e8ee --- a/dev/null +++ b/noncore/net/mail/selectstore.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _SELECTSTORE_H | ||
2 | #define _SELECTSTORE_H | ||
3 | |||
4 | #include "selectstoreui.h" | ||
5 | |||
6 | class Selectstore:public selectstoreui | ||
7 | { | ||
8 | Q_OBJECT | ||
9 | public: | ||
10 | Selectstore(QWidget* parent = 0, const char* name = 0); | ||
11 | virtual ~Selectstore(); | ||
12 | |||
13 | protected: | ||
14 | virtual void slotCreateNewFolder(); | ||
15 | virtual void slotMoveMail(); | ||
16 | protected slots: | ||
17 | |||
18 | }; | ||
19 | #endif | ||
diff --git a/noncore/net/mail/selectstoreui.ui b/noncore/net/mail/selectstoreui.ui new file mode 100644 index 0000000..3741b71 --- a/dev/null +++ b/noncore/net/mail/selectstoreui.ui | |||
@@ -0,0 +1,244 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>selectstoreui</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>selectstoreui</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>190</width> | ||
15 | <height>273</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Select target box</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QLabel</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>headlabel</cstring> | ||
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>text</name> | ||
45 | <string><b>Store mail(s) to</b></string> | ||
46 | </property> | ||
47 | <property stdset="1"> | ||
48 | <name>alignment</name> | ||
49 | <set>AlignCenter</set> | ||
50 | </property> | ||
51 | <property> | ||
52 | <name>hAlign</name> | ||
53 | </property> | ||
54 | </widget> | ||
55 | <widget> | ||
56 | <class>QLayoutWidget</class> | ||
57 | <property stdset="1"> | ||
58 | <name>name</name> | ||
59 | <cstring>Layout2</cstring> | ||
60 | </property> | ||
61 | <grid> | ||
62 | <property stdset="1"> | ||
63 | <name>margin</name> | ||
64 | <number>0</number> | ||
65 | </property> | ||
66 | <property stdset="1"> | ||
67 | <name>spacing</name> | ||
68 | <number>6</number> | ||
69 | </property> | ||
70 | <widget row="1" column="1" > | ||
71 | <class>QComboBox</class> | ||
72 | <property stdset="1"> | ||
73 | <name>name</name> | ||
74 | <cstring>folderSelection</cstring> | ||
75 | </property> | ||
76 | <property stdset="1"> | ||
77 | <name>sizePolicy</name> | ||
78 | <sizepolicy> | ||
79 | <hsizetype>3</hsizetype> | ||
80 | <vsizetype>0</vsizetype> | ||
81 | </sizepolicy> | ||
82 | </property> | ||
83 | </widget> | ||
84 | <widget row="1" column="0" > | ||
85 | <class>QLabel</class> | ||
86 | <property stdset="1"> | ||
87 | <name>name</name> | ||
88 | <cstring>folderLabel</cstring> | ||
89 | </property> | ||
90 | <property stdset="1"> | ||
91 | <name>text</name> | ||
92 | <string>Folder:</string> | ||
93 | </property> | ||
94 | <property stdset="1"> | ||
95 | <name>alignment</name> | ||
96 | <set>AlignVCenter|AlignRight</set> | ||
97 | </property> | ||
98 | <property> | ||
99 | <name>hAlign</name> | ||
100 | </property> | ||
101 | </widget> | ||
102 | <widget row="0" column="1" > | ||
103 | <class>QComboBox</class> | ||
104 | <property stdset="1"> | ||
105 | <name>name</name> | ||
106 | <cstring>accountSelection</cstring> | ||
107 | </property> | ||
108 | <property stdset="1"> | ||
109 | <name>sizePolicy</name> | ||
110 | <sizepolicy> | ||
111 | <hsizetype>3</hsizetype> | ||
112 | <vsizetype>0</vsizetype> | ||
113 | </sizepolicy> | ||
114 | </property> | ||
115 | </widget> | ||
116 | <widget row="0" column="0" > | ||
117 | <class>QLabel</class> | ||
118 | <property stdset="1"> | ||
119 | <name>name</name> | ||
120 | <cstring>accountlabel</cstring> | ||
121 | </property> | ||
122 | <property stdset="1"> | ||
123 | <name>sizePolicy</name> | ||
124 | <sizepolicy> | ||
125 | <hsizetype>1</hsizetype> | ||
126 | <vsizetype>1</vsizetype> | ||
127 | </sizepolicy> | ||
128 | </property> | ||
129 | <property stdset="1"> | ||
130 | <name>text</name> | ||
131 | <string>Account:</string> | ||
132 | </property> | ||
133 | <property stdset="1"> | ||
134 | <name>alignment</name> | ||
135 | <set>AlignVCenter|AlignRight</set> | ||
136 | </property> | ||
137 | <property> | ||
138 | <name>hAlign</name> | ||
139 | </property> | ||
140 | </widget> | ||
141 | </grid> | ||
142 | </widget> | ||
143 | <widget> | ||
144 | <class>Line</class> | ||
145 | <property stdset="1"> | ||
146 | <name>name</name> | ||
147 | <cstring>Line1</cstring> | ||
148 | </property> | ||
149 | <property stdset="1"> | ||
150 | <name>orientation</name> | ||
151 | <enum>Horizontal</enum> | ||
152 | </property> | ||
153 | </widget> | ||
154 | <widget> | ||
155 | <class>QCheckBox</class> | ||
156 | <property stdset="1"> | ||
157 | <name>name</name> | ||
158 | <cstring>newFoldersel</cstring> | ||
159 | </property> | ||
160 | <property stdset="1"> | ||
161 | <name>text</name> | ||
162 | <string>Create new folder</string> | ||
163 | </property> | ||
164 | </widget> | ||
165 | <widget> | ||
166 | <class>QLineEdit</class> | ||
167 | <property stdset="1"> | ||
168 | <name>name</name> | ||
169 | <cstring>newFolderedit</cstring> | ||
170 | </property> | ||
171 | <property stdset="1"> | ||
172 | <name>enabled</name> | ||
173 | <bool>false</bool> | ||
174 | </property> | ||
175 | </widget> | ||
176 | <widget> | ||
177 | <class>Line</class> | ||
178 | <property stdset="1"> | ||
179 | <name>name</name> | ||
180 | <cstring>Line2</cstring> | ||
181 | </property> | ||
182 | <property stdset="1"> | ||
183 | <name>orientation</name> | ||
184 | <enum>Horizontal</enum> | ||
185 | </property> | ||
186 | </widget> | ||
187 | <widget> | ||
188 | <class>QCheckBox</class> | ||
189 | <property stdset="1"> | ||
190 | <name>name</name> | ||
191 | <cstring>selMove</cstring> | ||
192 | </property> | ||
193 | <property stdset="1"> | ||
194 | <name>text</name> | ||
195 | <string>Move mail(s)</string> | ||
196 | </property> | ||
197 | </widget> | ||
198 | <spacer> | ||
199 | <property> | ||
200 | <name>name</name> | ||
201 | <cstring>Spacer2</cstring> | ||
202 | </property> | ||
203 | <property stdset="1"> | ||
204 | <name>orientation</name> | ||
205 | <enum>Vertical</enum> | ||
206 | </property> | ||
207 | <property stdset="1"> | ||
208 | <name>sizeType</name> | ||
209 | <enum>Expanding</enum> | ||
210 | </property> | ||
211 | <property> | ||
212 | <name>sizeHint</name> | ||
213 | <size> | ||
214 | <width>20</width> | ||
215 | <height>20</height> | ||
216 | </size> | ||
217 | </property> | ||
218 | </spacer> | ||
219 | </vbox> | ||
220 | </widget> | ||
221 | <connections> | ||
222 | <connection> | ||
223 | <sender>selMove</sender> | ||
224 | <signal>clicked()</signal> | ||
225 | <receiver>selectstoreui</receiver> | ||
226 | <slot>slotMoveMail()</slot> | ||
227 | </connection> | ||
228 | <connection> | ||
229 | <sender>newFoldersel</sender> | ||
230 | <signal>clicked()</signal> | ||
231 | <receiver>selectstoreui</receiver> | ||
232 | <slot>slotCreateNewFolder()</slot> | ||
233 | </connection> | ||
234 | <slot access="protected">slotMoveMail()</slot> | ||
235 | <slot access="protected">slotCreateNewFolder()</slot> | ||
236 | </connections> | ||
237 | <tabstops> | ||
238 | <tabstop>accountSelection</tabstop> | ||
239 | <tabstop>folderSelection</tabstop> | ||
240 | <tabstop>newFoldersel</tabstop> | ||
241 | <tabstop>newFolderedit</tabstop> | ||
242 | <tabstop>selMove</tabstop> | ||
243 | </tabstops> | ||
244 | </UI> | ||