author | alwin <alwin> | 2004-01-07 19:27:47 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-07 19:27:47 (UTC) |
commit | 24a62e8789083f446138aebfa11409b73886aa88 (patch) (unidiff) | |
tree | 177bd3de4ad46fd29e93b87c6a0423a4ca132682 | |
parent | 7fdc50c5ff3fe42aba6d940165e99ed7150df4f1 (diff) | |
download | opie-24a62e8789083f446138aebfa11409b73886aa88.zip opie-24a62e8789083f446138aebfa11409b73886aa88.tar.gz opie-24a62e8789083f446138aebfa11409b73886aa88.tar.bz2 |
download mail mostly finished
accounts can be switched "offline"
-rw-r--r-- | noncore/net/mail/accountview.cpp | 234 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 71 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 9 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 9 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.h | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 10 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/selectstore.cpp | 53 | ||||
-rw-r--r-- | noncore/net/mail/selectstore.h | 18 | ||||
-rw-r--r-- | noncore/net/mail/selectstoreui.ui | 43 |
17 files changed, 415 insertions, 78 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index faa6982..eea021f 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,153 +1,200 @@ | |||
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 "selectstore.h" |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qpopupmenu.h> | 8 | #include <qpopupmenu.h> |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * POP3 Account stuff | 11 | * POP3 Account stuff |
12 | */ | 12 | */ |
13 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) | 13 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) |
14 | : AccountViewItem( parent ) | 14 | : AccountViewItem( parent ) |
15 | { | 15 | { |
16 | account = a; | 16 | account = a; |
17 | wrapper = AbstractMail::getWrapper( account ); | 17 | wrapper = AbstractMail::getWrapper( account ); |
18 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 18 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
19 | setText( 0, account->getAccountName() ); | 19 | setText( 0, account->getAccountName() ); |
20 | setOpen( true ); | 20 | setOpen( true ); |
21 | } | 21 | } |
22 | 22 | ||
23 | POP3viewItem::~POP3viewItem() | 23 | POP3viewItem::~POP3viewItem() |
24 | { | 24 | { |
25 | delete wrapper; | 25 | delete wrapper; |
26 | } | 26 | } |
27 | 27 | ||
28 | AbstractMail *POP3viewItem::getWrapper() | 28 | AbstractMail *POP3viewItem::getWrapper() |
29 | { | 29 | { |
30 | return wrapper; | 30 | return wrapper; |
31 | } | 31 | } |
32 | 32 | ||
33 | void POP3viewItem::refresh( QList<RecMail> & ) | 33 | void POP3viewItem::refresh( QList<RecMail> & ) |
34 | { | 34 | { |
35 | if (account->getOffline()) return; | ||
35 | QList<Folder> *folders = wrapper->listFolders(); | 36 | QList<Folder> *folders = wrapper->listFolders(); |
36 | QListViewItem *child = firstChild(); | 37 | QListViewItem *child = firstChild(); |
37 | while ( child ) { | 38 | while ( child ) { |
38 | QListViewItem *tmp = child; | 39 | QListViewItem *tmp = child; |
39 | child = child->nextSibling(); | 40 | child = child->nextSibling(); |
40 | delete tmp; | 41 | delete tmp; |
41 | } | 42 | } |
42 | Folder *it; | 43 | Folder *it; |
43 | QListViewItem*item = 0; | 44 | QListViewItem*item = 0; |
44 | for ( it = folders->first(); it; it = folders->next() ) { | 45 | for ( it = folders->first(); it; it = folders->next() ) { |
45 | item = new POP3folderItem( it, this , item ); | 46 | item = new POP3folderItem( it, this , item ); |
46 | item->setSelectable(it->may_select()); | 47 | item->setSelectable(it->may_select()); |
47 | } | 48 | } |
48 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 49 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
49 | folders->setAutoDelete(false); | 50 | folders->setAutoDelete(false); |
50 | delete folders; | 51 | delete folders; |
51 | } | 52 | } |
52 | 53 | ||
53 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) | 54 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) |
54 | { | 55 | { |
55 | qDebug( "POP3 fetchBody" ); | 56 | qDebug( "POP3 fetchBody" ); |
56 | return wrapper->fetchBody( mail ); | 57 | return wrapper->fetchBody( mail ); |
57 | } | 58 | } |
58 | 59 | ||
60 | QPopupMenu * POP3viewItem::getContextMenu() | ||
61 | { | ||
62 | QPopupMenu *m = new QPopupMenu(0); | ||
63 | if (m) { | ||
64 | if (!account->getOffline()) { | ||
65 | m->insertItem(QObject::tr("Disconnect",contextName),0); | ||
66 | m->insertItem(QObject::tr("Set offline",contextName),1); | ||
67 | } else { | ||
68 | m->insertItem(QObject::tr("Set online",contextName),1); | ||
69 | } | ||
70 | } | ||
71 | return m; | ||
72 | } | ||
73 | |||
74 | void POP3viewItem::disconnect() | ||
75 | { | ||
76 | QListViewItem *child = firstChild(); | ||
77 | while ( child ) { | ||
78 | QListViewItem *tmp = child; | ||
79 | child = child->nextSibling(); | ||
80 | delete tmp; | ||
81 | } | ||
82 | wrapper->logout(); | ||
83 | } | ||
84 | |||
85 | void POP3viewItem::setOnOffline() | ||
86 | { | ||
87 | if (!account->getOffline()) { | ||
88 | disconnect(); | ||
89 | } | ||
90 | account->setOffline(!account->getOffline()); | ||
91 | account->save(); | ||
92 | } | ||
93 | |||
94 | void POP3viewItem::contextMenuSelected(int which) | ||
95 | { | ||
96 | switch (which) { | ||
97 | case 0: | ||
98 | disconnect(); | ||
99 | break; | ||
100 | case 1: | ||
101 | setOnOffline(); | ||
102 | break; | ||
103 | } | ||
104 | } | ||
105 | |||
59 | POP3folderItem::~POP3folderItem() | 106 | POP3folderItem::~POP3folderItem() |
60 | { | 107 | { |
61 | delete folder; | 108 | delete folder; |
62 | } | 109 | } |
63 | 110 | ||
64 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) | 111 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) |
65 | : AccountViewItem( parent,after ) | 112 | : AccountViewItem( parent,after ) |
66 | { | 113 | { |
67 | folder = folderInit; | 114 | folder = folderInit; |
68 | pop3 = parent; | 115 | pop3 = parent; |
69 | if (folder->getDisplayName().lower()!="inbox") { | 116 | if (folder->getDisplayName().lower()!="inbox") { |
70 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 117 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
71 | } else { | 118 | } else { |
72 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 119 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
73 | } | 120 | } |
74 | setText( 0, folder->getDisplayName() ); | 121 | setText( 0, folder->getDisplayName() ); |
75 | } | 122 | } |
76 | 123 | ||
77 | void POP3folderItem::refresh(QList<RecMail>&target) | 124 | void POP3folderItem::refresh(QList<RecMail>&target) |
78 | { | 125 | { |
79 | if (folder->may_select()) | 126 | if (folder->may_select()) |
80 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 127 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
81 | } | 128 | } |
82 | 129 | ||
83 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) | 130 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) |
84 | { | 131 | { |
85 | return pop3->getWrapper()->fetchBody(aMail); | 132 | return pop3->getWrapper()->fetchBody(aMail); |
86 | } | 133 | } |
87 | 134 | ||
88 | QPopupMenu * POP3folderItem::getContextMenu() | 135 | QPopupMenu * POP3folderItem::getContextMenu() |
89 | { | 136 | { |
90 | QPopupMenu *m = new QPopupMenu(0); | 137 | QPopupMenu *m = new QPopupMenu(0); |
91 | if (m) { | 138 | if (m) { |
92 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 139 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
93 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 140 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
94 | m->insertItem(QObject::tr("Download all mails",contextName),2); | 141 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
95 | } | 142 | } |
96 | return m; | 143 | return m; |
97 | } | 144 | } |
98 | 145 | ||
99 | void POP3folderItem::downloadMails() | 146 | void POP3folderItem::downloadMails() |
100 | { | 147 | { |
101 | Selectstore sels; | 148 | AccountView*bl = pop3->accountView(); |
102 | sels.showMaximized(); | 149 | if (!bl) return; |
103 | sels.exec(); | 150 | bl->downloadMails(folder,pop3->getWrapper()); |
104 | } | 151 | } |
105 | 152 | ||
106 | void POP3folderItem::contextMenuSelected(int which) | 153 | void POP3folderItem::contextMenuSelected(int which) |
107 | { | 154 | { |
108 | AccountView * view = (AccountView*)listView(); | 155 | AccountView * view = (AccountView*)listView(); |
109 | switch (which) { | 156 | switch (which) { |
110 | case 0: | 157 | case 0: |
111 | /* must be 'cause pop3 lists are cached */ | 158 | /* must be 'cause pop3 lists are cached */ |
112 | pop3->getWrapper()->logout(); | 159 | pop3->getWrapper()->logout(); |
113 | view->refreshCurrent(); | 160 | view->refreshCurrent(); |
114 | break; | 161 | break; |
115 | case 1: | 162 | case 1: |
116 | deleteAllMail(pop3->getWrapper(),folder); | 163 | deleteAllMail(pop3->getWrapper(),folder); |
117 | break; | 164 | break; |
118 | case 2: | 165 | case 2: |
119 | downloadMails(); | 166 | downloadMails(); |
120 | break; | 167 | break; |
121 | default: | 168 | default: |
122 | break; | 169 | break; |
123 | } | 170 | } |
124 | } | 171 | } |
125 | 172 | ||
126 | /** | 173 | /** |
127 | * IMAP Account stuff | 174 | * IMAP Account stuff |
128 | */ | 175 | */ |
129 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) | 176 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) |
130 | : AccountViewItem( parent ) | 177 | : AccountViewItem( parent ) |
131 | { | 178 | { |
132 | account = a; | 179 | account = a; |
133 | wrapper = AbstractMail::getWrapper( account ); | 180 | wrapper = AbstractMail::getWrapper( account ); |
134 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 181 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
135 | setText( 0, account->getAccountName() ); | 182 | setText( 0, account->getAccountName() ); |
136 | setOpen( true ); | 183 | setOpen( true ); |
137 | } | 184 | } |
138 | 185 | ||
139 | IMAPviewItem::~IMAPviewItem() | 186 | IMAPviewItem::~IMAPviewItem() |
140 | { | 187 | { |
141 | delete wrapper; | 188 | delete wrapper; |
142 | } | 189 | } |
143 | 190 | ||
144 | AbstractMail *IMAPviewItem::getWrapper() | 191 | AbstractMail *IMAPviewItem::getWrapper() |
145 | { | 192 | { |
146 | return wrapper; | 193 | return wrapper; |
147 | } | 194 | } |
148 | 195 | ||
149 | IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) | 196 | IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) |
150 | { | 197 | { |
151 | IMAPfolderItem*pitem,*sitem; | 198 | IMAPfolderItem*pitem,*sitem; |
152 | if (!start) pitem = (IMAPfolderItem*)firstChild(); | 199 | if (!start) pitem = (IMAPfolderItem*)firstChild(); |
153 | else pitem = (IMAPfolderItem*)start->firstChild(); | 200 | else pitem = (IMAPfolderItem*)start->firstChild(); |
@@ -162,398 +209,519 @@ IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start | |||
162 | break; | 209 | break; |
163 | } | 210 | } |
164 | } | 211 | } |
165 | pitem=(IMAPfolderItem*)pitem->nextSibling(); | 212 | pitem=(IMAPfolderItem*)pitem->nextSibling(); |
166 | } | 213 | } |
167 | return pitem; | 214 | return pitem; |
168 | } | 215 | } |
169 | 216 | ||
170 | void IMAPviewItem::refresh(QList<RecMail>&) | 217 | void IMAPviewItem::refresh(QList<RecMail>&) |
171 | { | 218 | { |
172 | refreshFolders(false); | 219 | refreshFolders(false); |
173 | } | 220 | } |
174 | 221 | ||
175 | void IMAPviewItem::removeChilds() | 222 | void IMAPviewItem::removeChilds() |
176 | { | 223 | { |
177 | QListViewItem *child = firstChild(); | 224 | QListViewItem *child = firstChild(); |
178 | while ( child ) { | 225 | while ( child ) { |
179 | QListViewItem *tmp = child; | 226 | QListViewItem *tmp = child; |
180 | child = child->nextSibling(); | 227 | child = child->nextSibling(); |
181 | delete tmp; | 228 | delete tmp; |
182 | } | 229 | } |
183 | 230 | ||
184 | } | 231 | } |
185 | 232 | ||
233 | const QStringList&IMAPviewItem::subFolders() | ||
234 | { | ||
235 | return currentFolders; | ||
236 | } | ||
237 | |||
186 | void IMAPviewItem::refreshFolders(bool force) | 238 | void IMAPviewItem::refreshFolders(bool force) |
187 | { | 239 | { |
188 | if (childCount()>0 && force==false) return; | 240 | if (childCount()>0 && force==false) return; |
189 | 241 | if (account->getOffline()) return; | |
190 | removeChilds(); | ||
191 | 242 | ||
243 | removeChilds(); | ||
244 | currentFolders.clear(); | ||
192 | QList<Folder> *folders = wrapper->listFolders(); | 245 | QList<Folder> *folders = wrapper->listFolders(); |
193 | 246 | ||
194 | Folder *it; | 247 | Folder *it; |
195 | QListViewItem*item = 0; | 248 | QListViewItem*item = 0; |
196 | QListViewItem*titem = 0; | 249 | QListViewItem*titem = 0; |
197 | QString fname,del,search; | 250 | QString fname,del,search; |
198 | int pos; | 251 | int pos; |
199 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 252 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
200 | folders->setAutoDelete(false); | 253 | folders->setAutoDelete(false); |
201 | 254 | ||
202 | for ( it = folders->first(); it; it = folders->next() ) { | 255 | for ( it = folders->first(); it; it = folders->next() ) { |
203 | if (it->getDisplayName().lower()=="inbox") { | 256 | if (it->getDisplayName().lower()=="inbox") { |
204 | item = new IMAPfolderItem( it, this , item ); | 257 | item = new IMAPfolderItem( it, this , item ); |
205 | folders->remove(it); | 258 | folders->remove(it); |
206 | qDebug("inbox found"); | 259 | qDebug("inbox found"); |
207 | break; | 260 | break; |
208 | } | 261 | } |
209 | } | 262 | } |
210 | for ( it = folders->first(); it; it = folders->next() ) { | 263 | for ( it = folders->first(); it; it = folders->next() ) { |
211 | fname = it->getDisplayName(); | 264 | fname = it->getDisplayName(); |
265 | currentFolders.append(it->getName()); | ||
212 | pos = fname.findRev(it->Separator()); | 266 | pos = fname.findRev(it->Separator()); |
213 | if (pos != -1) { | 267 | if (pos != -1) { |
214 | fname = fname.left(pos); | 268 | fname = fname.left(pos); |
215 | } | 269 | } |
216 | IMAPfolderItem*pitem = findSubItem(fname); | 270 | IMAPfolderItem*pitem = findSubItem(fname); |
217 | if (pitem) { | 271 | if (pitem) { |
218 | titem = item; | 272 | titem = item; |
219 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); | 273 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); |
220 | /* setup the short name */ | 274 | /* setup the short name */ |
221 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); | 275 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); |
222 | item = titem; | 276 | item = titem; |
223 | } else { | 277 | } else { |
224 | item = new IMAPfolderItem( it, this , item ); | 278 | item = new IMAPfolderItem( it, this , item ); |
225 | } | 279 | } |
226 | } | 280 | } |
227 | delete folders; | 281 | delete folders; |
228 | } | 282 | } |
229 | 283 | ||
230 | QPopupMenu * IMAPviewItem::getContextMenu() | 284 | QPopupMenu * IMAPviewItem::getContextMenu() |
231 | { | 285 | { |
232 | QPopupMenu *m = new QPopupMenu(0); | 286 | QPopupMenu *m = new QPopupMenu(0); |
233 | if (m) { | 287 | if (m) { |
234 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 288 | if (!account->getOffline()) { |
235 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 289 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
236 | m->insertSeparator(); | 290 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
237 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 291 | m->insertSeparator(); |
292 | m->insertItem(QObject::tr("Disconnect",contextName),2); | ||
293 | m->insertItem(QObject::tr("Set offline",contextName),3); | ||
294 | } else { | ||
295 | m->insertItem(QObject::tr("Set online",contextName),3); | ||
296 | } | ||
238 | } | 297 | } |
239 | return m; | 298 | return m; |
240 | } | 299 | } |
241 | 300 | ||
242 | void IMAPviewItem::createNewFolder() | 301 | void IMAPviewItem::createNewFolder() |
243 | { | 302 | { |
244 | Newmdirdlg ndirdlg; | 303 | Newmdirdlg ndirdlg; |
245 | ndirdlg.showMaximized(); | 304 | ndirdlg.showMaximized(); |
246 | if (ndirdlg.exec()) { | 305 | if (ndirdlg.exec()) { |
247 | QString ndir = ndirdlg.Newdir(); | 306 | QString ndir = ndirdlg.Newdir(); |
248 | bool makesubs = ndirdlg.subpossible(); | 307 | bool makesubs = ndirdlg.subpossible(); |
249 | QString delemiter = "/"; | 308 | QString delemiter = "/"; |
250 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 309 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
251 | if (item) { | 310 | if (item) { |
252 | delemiter = item->Delemiter(); | 311 | delemiter = item->Delemiter(); |
253 | } | 312 | } |
254 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { | 313 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { |
255 | refreshFolders(true); | 314 | refreshFolders(true); |
256 | } | 315 | } |
257 | } | 316 | } |
258 | } | 317 | } |
259 | 318 | ||
260 | void IMAPviewItem::contextMenuSelected(int id) | 319 | void IMAPviewItem::contextMenuSelected(int id) |
261 | { | 320 | { |
262 | qDebug("Id selected: %i",id); | 321 | qDebug("Id selected: %i",id); |
263 | switch (id) { | 322 | switch (id) { |
264 | case 0: | 323 | case 0: |
265 | refreshFolders(true); | 324 | refreshFolders(true); |
266 | break; | 325 | break; |
267 | case 1: | 326 | case 1: |
268 | createNewFolder(); | 327 | createNewFolder(); |
269 | break; | 328 | break; |
270 | case 2: | 329 | case 2: |
271 | removeChilds(); | 330 | removeChilds(); |
272 | wrapper->logout(); | 331 | wrapper->logout(); |
273 | break; | 332 | break; |
333 | case 3: | ||
334 | if (account->getOffline()==false) { | ||
335 | removeChilds(); | ||
336 | wrapper->logout(); | ||
337 | } | ||
338 | account->setOffline(!account->getOffline()); | ||
339 | account->save(); | ||
340 | refreshFolders(false); | ||
341 | break; | ||
274 | default: | 342 | default: |
275 | break; | 343 | break; |
276 | } | 344 | } |
277 | } | 345 | } |
278 | 346 | ||
279 | RecBody IMAPviewItem::fetchBody(const RecMail&) | 347 | RecBody IMAPviewItem::fetchBody(const RecMail&) |
280 | { | 348 | { |
281 | return RecBody(); | 349 | return RecBody(); |
282 | } | 350 | } |
283 | 351 | ||
284 | IMAPfolderItem::~IMAPfolderItem() | 352 | bool IMAPviewItem::offline() |
285 | { | 353 | { |
286 | delete folder; | 354 | return account->getOffline(); |
287 | } | 355 | } |
288 | 356 | ||
289 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) | 357 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) |
290 | : AccountViewItem( parent , after ) | 358 | : AccountViewItem( parent , after ) |
291 | { | 359 | { |
292 | folder = folderInit; | 360 | folder = folderInit; |
293 | imap = parent; | 361 | imap = parent; |
294 | if (folder->getDisplayName().lower()!="inbox") { | 362 | if (folder->getDisplayName().lower()!="inbox") { |
295 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 363 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
296 | } else { | 364 | } else { |
297 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 365 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
298 | } | 366 | } |
299 | setText( 0, folder->getDisplayName() ); | 367 | setText( 0, folder->getDisplayName() ); |
300 | } | 368 | } |
301 | 369 | ||
302 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 370 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
303 | : AccountViewItem( parent,after ) | 371 | : AccountViewItem( parent,after ) |
304 | { | 372 | { |
305 | folder = folderInit; | 373 | folder = folderInit; |
306 | imap = master; | 374 | imap = master; |
307 | if (folder->getDisplayName().lower()!="inbox") { | 375 | if (folder->getDisplayName().lower()!="inbox") { |
308 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 376 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
309 | } else { | 377 | } else { |
310 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 378 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
311 | } | 379 | } |
312 | setText( 0, folder->getDisplayName() ); | 380 | setText( 0, folder->getDisplayName() ); |
313 | } | 381 | } |
314 | 382 | ||
383 | IMAPfolderItem::~IMAPfolderItem() | ||
384 | { | ||
385 | delete folder; | ||
386 | } | ||
387 | |||
315 | const QString& IMAPfolderItem::Delemiter()const | 388 | const QString& IMAPfolderItem::Delemiter()const |
316 | { | 389 | { |
317 | return folder->Separator(); | 390 | return folder->Separator(); |
318 | } | 391 | } |
319 | 392 | ||
320 | bool IMAPfolderItem::matchName(const QString&name)const | 393 | bool IMAPfolderItem::matchName(const QString&name)const |
321 | { | 394 | { |
322 | return folder->getDisplayName()==name; | 395 | return folder->getDisplayName()==name; |
323 | } | 396 | } |
324 | 397 | ||
325 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 398 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
326 | { | 399 | { |
327 | if (folder->may_select()) { | 400 | if (folder->may_select()) { |
328 | imap->getWrapper()->listMessages( folder->getName(),target ); | 401 | imap->getWrapper()->listMessages( folder->getName(),target ); |
329 | } else { | 402 | } else { |
330 | target.clear(); | 403 | target.clear(); |
331 | } | 404 | } |
332 | } | 405 | } |
333 | 406 | ||
334 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | 407 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) |
335 | { | 408 | { |
336 | return imap->getWrapper()->fetchBody(aMail); | 409 | return imap->getWrapper()->fetchBody(aMail); |
337 | } | 410 | } |
338 | 411 | ||
339 | QPopupMenu * IMAPfolderItem::getContextMenu() | 412 | QPopupMenu * IMAPfolderItem::getContextMenu() |
340 | { | 413 | { |
341 | QPopupMenu *m = new QPopupMenu(0); | 414 | QPopupMenu *m = new QPopupMenu(0); |
342 | if (m) { | 415 | if (m) { |
343 | if (folder->may_select()) { | 416 | if (folder->may_select()) { |
344 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 417 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
418 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | ||
345 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 419 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
346 | } | 420 | } |
347 | if (folder->no_inferior()==false) { | 421 | if (folder->no_inferior()==false) { |
348 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 422 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
349 | } | 423 | } |
350 | if (folder->getDisplayName().lower()!="inbox") { | 424 | if (folder->getDisplayName().lower()!="inbox") { |
351 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 425 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
352 | } | 426 | } |
353 | } | 427 | } |
354 | return m; | 428 | return m; |
355 | } | 429 | } |
356 | 430 | ||
357 | void IMAPfolderItem::createNewFolder() | 431 | void IMAPfolderItem::createNewFolder() |
358 | { | 432 | { |
359 | Newmdirdlg ndirdlg; | 433 | Newmdirdlg ndirdlg; |
360 | ndirdlg.showMaximized(); | 434 | ndirdlg.showMaximized(); |
361 | if (ndirdlg.exec()) { | 435 | if (ndirdlg.exec()) { |
362 | QString ndir = ndirdlg.Newdir(); | 436 | QString ndir = ndirdlg.Newdir(); |
363 | bool makesubs = ndirdlg.subpossible(); | 437 | bool makesubs = ndirdlg.subpossible(); |
364 | QString delemiter = Delemiter(); | 438 | QString delemiter = Delemiter(); |
365 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) { | 439 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) { |
366 | imap->refreshFolders(true); | 440 | imap->refreshFolders(true); |
367 | } | 441 | } |
368 | } | 442 | } |
369 | } | 443 | } |
370 | 444 | ||
371 | void IMAPfolderItem::deleteFolder() | 445 | void IMAPfolderItem::deleteFolder() |
372 | { | 446 | { |
373 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 447 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
374 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 448 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
375 | QObject::tr("Yes",contextName), | 449 | QObject::tr("Yes",contextName), |
376 | QObject::tr("No",contextName),QString::null,1,1); | 450 | QObject::tr("No",contextName),QString::null,1,1); |
377 | qDebug("Auswahl: %i",yesno); | 451 | qDebug("Auswahl: %i",yesno); |
378 | if (yesno == 0) { | 452 | if (yesno == 0) { |
379 | if (imap->getWrapper()->deleteMbox(folder)) { | 453 | if (imap->getWrapper()->deleteMbox(folder)) { |
380 | QListView*v=listView(); | 454 | QListView*v=listView(); |
381 | IMAPviewItem * box = imap; | 455 | IMAPviewItem * box = imap; |
382 | /* be carefull - after that this object is destroyd so don't use | 456 | /* be carefull - after that this object is destroyd so don't use |
383 | * any member of it after that call!!*/ | 457 | * any member of it after that call!!*/ |
384 | imap->refreshFolders(true); | 458 | imap->refreshFolders(true); |
385 | if (v) { | 459 | if (v) { |
386 | v->setSelected(box,true); | 460 | v->setSelected(box,true); |
387 | } | 461 | } |
388 | } | 462 | } |
389 | } | 463 | } |
390 | } | 464 | } |
391 | 465 | ||
466 | void IMAPfolderItem::downloadMails() | ||
467 | { | ||
468 | AccountView*bl = imap->accountView(); | ||
469 | if (!bl) return; | ||
470 | bl->downloadMails(folder,imap->getWrapper()); | ||
471 | } | ||
472 | |||
392 | void IMAPfolderItem::contextMenuSelected(int id) | 473 | void IMAPfolderItem::contextMenuSelected(int id) |
393 | { | 474 | { |
394 | qDebug("Selected id: %i",id); | 475 | qDebug("Selected id: %i",id); |
395 | AccountView * view = (AccountView*)listView(); | 476 | AccountView * view = (AccountView*)listView(); |
396 | switch(id) { | 477 | switch(id) { |
397 | case 0: | 478 | case 0: |
398 | view->refreshCurrent(); | 479 | view->refreshCurrent(); |
399 | break; | 480 | break; |
400 | case 1: | 481 | case 1: |
401 | deleteAllMail(imap->getWrapper(),folder); | 482 | deleteAllMail(imap->getWrapper(),folder); |
402 | break; | 483 | break; |
403 | case 2: | 484 | case 2: |
404 | createNewFolder(); | 485 | createNewFolder(); |
405 | break; | 486 | break; |
406 | case 3: | 487 | case 3: |
407 | deleteFolder(); | 488 | deleteFolder(); |
408 | break; | 489 | break; |
490 | case 4: | ||
491 | downloadMails(); | ||
492 | break; | ||
409 | default: | 493 | default: |
410 | break; | 494 | break; |
411 | } | 495 | } |
412 | } | 496 | } |
413 | 497 | ||
414 | /** | 498 | /** |
415 | * Generic stuff | 499 | * Generic stuff |
416 | */ | 500 | */ |
417 | 501 | ||
418 | const QString AccountViewItem::contextName="AccountViewItem"; | 502 | const QString AccountViewItem::contextName="AccountViewItem"; |
419 | 503 | ||
504 | AccountViewItem::AccountViewItem( AccountView *parent ) | ||
505 | : QListViewItem( parent ) | ||
506 | { | ||
507 | m_Backlink = parent; | ||
508 | } | ||
509 | |||
510 | AccountViewItem::AccountViewItem( QListViewItem *parent) | ||
511 | : QListViewItem( parent) | ||
512 | { | ||
513 | m_Backlink = 0; | ||
514 | } | ||
515 | |||
516 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) | ||
517 | :QListViewItem( parent,after ) | ||
518 | { | ||
519 | m_Backlink = 0; | ||
520 | } | ||
521 | |||
522 | AccountViewItem::~AccountViewItem() | ||
523 | { | ||
524 | } | ||
525 | |||
526 | AccountView*AccountViewItem::accountView() | ||
527 | { | ||
528 | return m_Backlink; | ||
529 | } | ||
530 | |||
420 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) | 531 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) |
421 | { | 532 | { |
422 | if (!wrapper) return; | 533 | if (!wrapper) return; |
423 | QString fname=""; | 534 | QString fname=""; |
424 | if (folder) fname = folder->getDisplayName(); | 535 | if (folder) fname = folder->getDisplayName(); |
425 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | 536 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
426 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). | 537 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). |
427 | arg(fname), | 538 | arg(fname), |
428 | QObject::tr("Yes",contextName), | 539 | QObject::tr("Yes",contextName), |
429 | QObject::tr("No",contextName),QString::null,1,1); | 540 | QObject::tr("No",contextName),QString::null,1,1); |
430 | qDebug("Auswahl: %i",yesno); | 541 | qDebug("Auswahl: %i",yesno); |
431 | if (yesno == 0) { | 542 | if (yesno == 0) { |
432 | if (wrapper->deleteAllMail(folder)) { | 543 | if (wrapper->deleteAllMail(folder)) { |
433 | AccountView * view = (AccountView*)listView(); | 544 | AccountView * view = (AccountView*)listView(); |
434 | if (view) view->refreshCurrent(); | 545 | if (view) view->refreshCurrent(); |
435 | } | 546 | } |
436 | } | 547 | } |
437 | } | 548 | } |
438 | 549 | ||
439 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 550 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
440 | : QListView( parent, name, flags ) | 551 | : QListView( parent, name, flags ) |
441 | { | 552 | { |
442 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), | 553 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), |
443 | SLOT( refresh( QListViewItem * ) ) ); | 554 | SLOT( refresh( QListViewItem * ) ) ); |
444 | connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, | 555 | connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, |
445 | SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); | 556 | SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); |
446 | 557 | ||
447 | setSorting(0); | 558 | setSorting(0); |
448 | } | 559 | } |
449 | 560 | ||
561 | AccountView::~AccountView() | ||
562 | { | ||
563 | imapAccounts.clear(); | ||
564 | mboxAccounts.clear(); | ||
565 | } | ||
566 | |||
450 | void AccountView::slotContextMenu(int id) | 567 | void AccountView::slotContextMenu(int id) |
451 | { | 568 | { |
452 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 569 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
453 | if (!view) return; | 570 | if (!view) return; |
454 | view->contextMenuSelected(id); | 571 | view->contextMenuSelected(id); |
455 | } | 572 | } |
456 | 573 | ||
457 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 574 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) |
458 | { | 575 | { |
459 | if (button==1) {return;} | 576 | if (button==1) {return;} |
460 | if (!item) return; | 577 | if (!item) return; |
461 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 578 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
462 | QPopupMenu*m = view->getContextMenu(); | 579 | QPopupMenu*m = view->getContextMenu(); |
463 | if (!m) return; | 580 | if (!m) return; |
464 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 581 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
465 | m->setFocus(); | 582 | m->setFocus(); |
466 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 583 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
467 | delete m; | 584 | delete m; |
468 | } | 585 | } |
469 | 586 | ||
470 | void AccountView::populate( QList<Account> list ) | 587 | void AccountView::populate( QList<Account> list ) |
471 | { | 588 | { |
472 | clear(); | 589 | clear(); |
473 | 590 | ||
474 | (void) new MBOXviewItem(AbstractMail::defaultLocalfolder(),this); | 591 | imapAccounts.clear(); |
592 | mboxAccounts.clear(); | ||
593 | |||
594 | mboxAccounts.append(new MBOXviewItem(AbstractMail::defaultLocalfolder(),this)); | ||
475 | 595 | ||
476 | Account *it; | 596 | Account *it; |
477 | for ( it = list.first(); it; it = list.next() ) { | 597 | for ( it = list.first(); it; it = list.next() ) { |
478 | if ( it->getType().compare( "IMAP" ) == 0 ) { | 598 | if ( it->getType().compare( "IMAP" ) == 0 ) { |
479 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 599 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
480 | qDebug( "added IMAP " + imap->getAccountName() ); | 600 | qDebug( "added IMAP " + imap->getAccountName() ); |
481 | (void) new IMAPviewItem( imap, this ); | 601 | imapAccounts.append(new IMAPviewItem( imap, this )); |
482 | } else if ( it->getType().compare( "POP3" ) == 0 ) { | 602 | } else if ( it->getType().compare( "POP3" ) == 0 ) { |
483 | POP3account *pop3 = static_cast<POP3account *>(it); | 603 | POP3account *pop3 = static_cast<POP3account *>(it); |
484 | qDebug( "added POP3 " + pop3->getAccountName() ); | 604 | qDebug( "added POP3 " + pop3->getAccountName() ); |
605 | /* must not be hold 'cause it isn't required */ | ||
485 | (void) new POP3viewItem( pop3, this ); | 606 | (void) new POP3viewItem( pop3, this ); |
486 | } | 607 | } |
487 | } | 608 | } |
488 | } | 609 | } |
489 | 610 | ||
490 | void AccountView::refresh(QListViewItem *item) { | 611 | void AccountView::refresh(QListViewItem *item) { |
491 | 612 | ||
492 | qDebug("AccountView refresh..."); | 613 | qDebug("AccountView refresh..."); |
493 | if ( item ) { | 614 | if ( item ) { |
494 | m_currentItem = item; | 615 | m_currentItem = item; |
495 | QList<RecMail> headerlist; | 616 | QList<RecMail> headerlist; |
496 | headerlist.setAutoDelete(true); | 617 | headerlist.setAutoDelete(true); |
497 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 618 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
498 | view->refresh(headerlist); | 619 | view->refresh(headerlist); |
499 | emit refreshMailview(&headerlist); | 620 | emit refreshMailview(&headerlist); |
500 | } | 621 | } |
501 | } | 622 | } |
502 | 623 | ||
503 | void AccountView::refreshCurrent() | 624 | void AccountView::refreshCurrent() |
504 | { | 625 | { |
505 | m_currentItem = currentItem(); | 626 | m_currentItem = currentItem(); |
506 | if ( !m_currentItem ) return; | 627 | if ( !m_currentItem ) return; |
507 | QList<RecMail> headerlist; | 628 | QList<RecMail> headerlist; |
508 | headerlist.setAutoDelete(true); | 629 | headerlist.setAutoDelete(true); |
509 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 630 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
510 | view->refresh(headerlist); | 631 | view->refresh(headerlist); |
511 | emit refreshMailview(&headerlist); | 632 | emit refreshMailview(&headerlist); |
512 | } | 633 | } |
513 | 634 | ||
514 | void AccountView::refreshAll() | 635 | void AccountView::refreshAll() |
515 | { | 636 | { |
516 | 637 | ||
517 | } | 638 | } |
518 | 639 | ||
519 | RecBody AccountView::fetchBody(const RecMail&aMail) | 640 | RecBody AccountView::fetchBody(const RecMail&aMail) |
520 | { | 641 | { |
521 | QListViewItem*item = selectedItem (); | 642 | QListViewItem*item = selectedItem (); |
522 | if (!item) return RecBody(); | 643 | if (!item) return RecBody(); |
523 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 644 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
524 | return view->fetchBody(aMail); | 645 | return view->fetchBody(aMail); |
525 | } | 646 | } |
526 | 647 | ||
648 | void AccountView::setupFolderselect(Selectstore*sels) | ||
649 | { | ||
650 | sels->showMaximized(); | ||
651 | QStringList sFolders; | ||
652 | unsigned int i = 0; | ||
653 | for (i=0; i < mboxAccounts.count();++i) { | ||
654 | mboxAccounts[i]->refresh(false); | ||
655 | sFolders = mboxAccounts[i]->subFolders(); | ||
656 | sels->addAccounts(mboxAccounts[i]->getWrapper(),sFolders); | ||
657 | } | ||
658 | for (i=0; i < imapAccounts.count();++i) { | ||
659 | if (imapAccounts[i]->offline()) | ||
660 | continue; | ||
661 | imapAccounts[i]->refreshFolders(false); | ||
662 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | ||
663 | } | ||
664 | } | ||
665 | |||
666 | void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) | ||
667 | { | ||
668 | unsigned int i = 0; | ||
669 | AbstractMail*targetMail = 0; | ||
670 | QString targetFolder = ""; | ||
671 | Selectstore sels; | ||
672 | setupFolderselect(&sels); | ||
673 | if (!sels.exec()) return; | ||
674 | targetMail = sels.currentMail(); | ||
675 | targetFolder = sels.currentFolder(); | ||
676 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | ||
677 | targetFolder.isEmpty()) { | ||
678 | return; | ||
679 | } | ||
680 | |||
681 | QList<RecMail> t; | ||
682 | fromWrapper->listMessages(fromFolder->getName(),t); | ||
683 | encodedString*st = 0; | ||
684 | for (i = 0; i < t.count();++i) { | ||
685 | RecMail*r = t.at(i); | ||
686 | st = fromWrapper->fetchRawBody(*r); | ||
687 | if (st) { | ||
688 | targetMail->storeMessage(st->Content(),st->Length(),targetFolder); | ||
689 | delete st; | ||
690 | } | ||
691 | } | ||
692 | } | ||
693 | |||
527 | /** | 694 | /** |
528 | * MBOX Account stuff | 695 | * MBOX Account stuff |
529 | */ | 696 | */ |
530 | 697 | ||
531 | MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) | 698 | MBOXviewItem::MBOXviewItem( const QString&aPath, AccountView *parent ) |
532 | : AccountViewItem( parent ) | 699 | : AccountViewItem( parent ) |
533 | { | 700 | { |
534 | m_Path = aPath; | 701 | m_Path = aPath; |
535 | wrapper = AbstractMail::getWrapper( m_Path ); | 702 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
703 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | ||
536 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 704 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
537 | setText( 0, " Local Folders" ); | 705 | setText( 0, " Local Folders" ); |
538 | setOpen( true ); | 706 | setOpen( true ); |
539 | } | 707 | } |
540 | 708 | ||
541 | MBOXviewItem::~MBOXviewItem() | 709 | MBOXviewItem::~MBOXviewItem() |
542 | { | 710 | { |
543 | delete wrapper; | 711 | delete wrapper; |
544 | } | 712 | } |
545 | 713 | ||
546 | AbstractMail *MBOXviewItem::getWrapper() | 714 | AbstractMail *MBOXviewItem::getWrapper() |
547 | { | 715 | { |
548 | return wrapper; | 716 | return wrapper; |
549 | } | 717 | } |
550 | 718 | ||
551 | void MBOXviewItem::refresh( QList<RecMail> & ) | 719 | void MBOXviewItem::refresh( QList<RecMail> & ) |
552 | { | 720 | { |
553 | refresh(false); | 721 | refresh(false); |
554 | } | 722 | } |
555 | 723 | ||
556 | void MBOXviewItem::refresh(bool force) | 724 | void MBOXviewItem::refresh(bool force) |
557 | { | 725 | { |
558 | if (childCount()>0 && force==false) return; | 726 | if (childCount()>0 && force==false) return; |
559 | QList<Folder> *folders = wrapper->listFolders(); | 727 | QList<Folder> *folders = wrapper->listFolders(); |
@@ -581,82 +749,100 @@ RecBody MBOXviewItem::fetchBody( const RecMail &mail ) | |||
581 | } | 749 | } |
582 | 750 | ||
583 | QPopupMenu * MBOXviewItem::getContextMenu() | 751 | QPopupMenu * MBOXviewItem::getContextMenu() |
584 | { | 752 | { |
585 | QPopupMenu *m = new QPopupMenu(0); | 753 | QPopupMenu *m = new QPopupMenu(0); |
586 | if (m) { | 754 | if (m) { |
587 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 755 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
588 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 756 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
589 | } | 757 | } |
590 | return m; | 758 | return m; |
591 | } | 759 | } |
592 | 760 | ||
593 | void MBOXviewItem::createFolder() | 761 | void MBOXviewItem::createFolder() |
594 | { | 762 | { |
595 | Newmdirdlg ndirdlg(0,0,true); | 763 | Newmdirdlg ndirdlg(0,0,true); |
596 | ndirdlg.showMaximized(); | 764 | ndirdlg.showMaximized(); |
597 | if (ndirdlg.exec()) { | 765 | if (ndirdlg.exec()) { |
598 | QString ndir = ndirdlg.Newdir(); | 766 | QString ndir = ndirdlg.Newdir(); |
599 | if (wrapper->createMbox(ndir)) { | 767 | if (wrapper->createMbox(ndir)) { |
600 | refresh(true); | 768 | refresh(true); |
601 | } | 769 | } |
602 | } | 770 | } |
603 | } | 771 | } |
604 | 772 | ||
773 | QStringList MBOXviewItem::subFolders() | ||
774 | { | ||
775 | QStringList result; | ||
776 | QListViewItem *child = firstChild(); | ||
777 | while ( child ) { | ||
778 | MBOXfolderItem *tmp = (MBOXfolderItem*)child; | ||
779 | child = child->nextSibling(); | ||
780 | result.append(tmp->getFolder()->getName()); | ||
781 | } | ||
782 | qDebug("Size of result: %i",result.count()); | ||
783 | return result; | ||
784 | } | ||
785 | |||
605 | void MBOXviewItem::contextMenuSelected(int which) | 786 | void MBOXviewItem::contextMenuSelected(int which) |
606 | { | 787 | { |
607 | switch (which) { | 788 | switch (which) { |
608 | case 0: | 789 | case 0: |
609 | refresh(true); | 790 | refresh(true); |
610 | break; | 791 | break; |
611 | case 1: | 792 | case 1: |
612 | createFolder(); | 793 | createFolder(); |
613 | break; | 794 | break; |
614 | default: | 795 | default: |
615 | break; | 796 | break; |
616 | } | 797 | } |
617 | } | 798 | } |
618 | 799 | ||
619 | MBOXfolderItem::~MBOXfolderItem() | 800 | MBOXfolderItem::~MBOXfolderItem() |
620 | { | 801 | { |
621 | delete folder; | 802 | delete folder; |
622 | } | 803 | } |
623 | 804 | ||
624 | MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) | 805 | MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) |
625 | : AccountViewItem( parent,after ) | 806 | : AccountViewItem( parent,after ) |
626 | { | 807 | { |
627 | folder = folderInit; | 808 | folder = folderInit; |
628 | mbox = parent; | 809 | mbox = parent; |
629 | if (folder->getDisplayName().lower() == "outgoing") { | 810 | if (folder->getDisplayName().lower() == "outgoing") { |
630 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 811 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
631 | } else if (folder->getDisplayName().lower() == "inbox") { | 812 | } else if (folder->getDisplayName().lower() == "inbox") { |
632 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 813 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
633 | } else { | 814 | } else { |
634 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 815 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
635 | } | 816 | } |
636 | setText( 0, folder->getDisplayName() ); | 817 | setText( 0, folder->getDisplayName() ); |
637 | } | 818 | } |
638 | 819 | ||
820 | Folder*MBOXfolderItem::getFolder() | ||
821 | { | ||
822 | return folder; | ||
823 | } | ||
824 | |||
639 | void MBOXfolderItem::refresh(QList<RecMail>&target) | 825 | void MBOXfolderItem::refresh(QList<RecMail>&target) |
640 | { | 826 | { |
641 | if (folder->may_select()) | 827 | if (folder->may_select()) |
642 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 828 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
643 | } | 829 | } |
644 | 830 | ||
645 | RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) | 831 | RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) |
646 | { | 832 | { |
647 | return mbox->getWrapper()->fetchBody(aMail); | 833 | return mbox->getWrapper()->fetchBody(aMail); |
648 | } | 834 | } |
649 | 835 | ||
650 | void MBOXfolderItem::deleteFolder() | 836 | void MBOXfolderItem::deleteFolder() |
651 | { | 837 | { |
652 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 838 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
653 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 839 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
654 | QObject::tr("Yes",contextName), | 840 | QObject::tr("Yes",contextName), |
655 | QObject::tr("No",contextName),QString::null,1,1); | 841 | QObject::tr("No",contextName),QString::null,1,1); |
656 | qDebug("Auswahl: %i",yesno); | 842 | qDebug("Auswahl: %i",yesno); |
657 | if (yesno == 0) { | 843 | if (yesno == 0) { |
658 | if (mbox->getWrapper()->deleteMbox(folder)) { | 844 | if (mbox->getWrapper()->deleteMbox(folder)) { |
659 | QListView*v=listView(); | 845 | QListView*v=listView(); |
660 | MBOXviewItem * box = mbox; | 846 | MBOXviewItem * box = mbox; |
661 | /* be carefull - after that this object is destroyd so don't use | 847 | /* be carefull - after that this object is destroyd so don't use |
662 | * any member of it after that call!!*/ | 848 | * any member of it after that call!!*/ |
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index 7131192..48f52c7 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -1,179 +1,188 @@ | |||
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 | class Selectstore; | ||
16 | class AccountView; | ||
15 | 17 | ||
16 | class AccountViewItem : public QListViewItem | 18 | class AccountViewItem : public QListViewItem |
17 | { | 19 | { |
18 | 20 | ||
19 | public: | 21 | public: |
20 | AccountViewItem( QListView *parent ) : QListViewItem( parent ) {} | 22 | AccountViewItem( AccountView *parent ); |
21 | AccountViewItem( QListViewItem *parent) : QListViewItem( parent) {} | 23 | AccountViewItem( QListViewItem *parent); |
22 | AccountViewItem( QListViewItem *parent , QListViewItem*after ) : QListViewItem( parent,after ) {} | 24 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); |
25 | virtual ~AccountViewItem(); | ||
23 | virtual void refresh(QList<RecMail>&)=0; | 26 | virtual void refresh(QList<RecMail>&)=0; |
24 | virtual RecBody fetchBody(const RecMail&)=0; | 27 | virtual RecBody fetchBody(const RecMail&)=0; |
25 | virtual QPopupMenu * getContextMenu(){return 0;}; | 28 | virtual QPopupMenu * getContextMenu(){return 0;}; |
26 | virtual void contextMenuSelected(int){} | 29 | virtual void contextMenuSelected(int){} |
30 | virtual AccountView*accountView(); | ||
27 | protected: | 31 | protected: |
28 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); | 32 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); |
29 | static const QString contextName; | 33 | static const QString contextName; |
34 | AccountView*m_Backlink; | ||
30 | }; | 35 | }; |
31 | 36 | ||
32 | class POP3viewItem : public AccountViewItem | 37 | class POP3viewItem : public AccountViewItem |
33 | { | 38 | { |
34 | 39 | ||
35 | public: | 40 | public: |
36 | POP3viewItem( POP3account *a, QListView *parent ); | 41 | POP3viewItem( POP3account *a, AccountView *parent ); |
37 | ~POP3viewItem(); | 42 | virtual ~POP3viewItem(); |
38 | virtual void refresh( QList<RecMail> &target ); | 43 | virtual void refresh( QList<RecMail> &target ); |
39 | virtual RecBody fetchBody( const RecMail &mail ); | 44 | virtual RecBody fetchBody( const RecMail &mail ); |
40 | AbstractMail *getWrapper(); | 45 | AbstractMail *getWrapper(); |
41 | private: | 46 | virtual QPopupMenu * getContextMenu(); |
47 | virtual void contextMenuSelected(int); | ||
48 | |||
49 | protected: | ||
42 | POP3account *account; | 50 | POP3account *account; |
43 | AbstractMail *wrapper; | 51 | AbstractMail *wrapper; |
44 | 52 | void disconnect(); | |
53 | void setOnOffline(); | ||
45 | }; | 54 | }; |
46 | 55 | ||
47 | class POP3folderItem : public AccountViewItem | 56 | class POP3folderItem : public AccountViewItem |
48 | { | 57 | { |
49 | 58 | ||
50 | public: | 59 | public: |
51 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); | 60 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); |
52 | ~POP3folderItem(); | 61 | virtual ~POP3folderItem(); |
53 | virtual void refresh(QList<RecMail>&); | 62 | virtual void refresh(QList<RecMail>&); |
54 | virtual RecBody fetchBody(const RecMail&); | 63 | virtual RecBody fetchBody(const RecMail&); |
55 | virtual QPopupMenu * getContextMenu(); | 64 | virtual QPopupMenu * getContextMenu(); |
56 | virtual void contextMenuSelected(int); | 65 | virtual void contextMenuSelected(int); |
57 | 66 | ||
58 | protected: | 67 | protected: |
59 | void downloadMails(); | 68 | void downloadMails(); |
60 | |||
61 | private: | ||
62 | Folder *folder; | 69 | Folder *folder; |
63 | POP3viewItem *pop3; | 70 | POP3viewItem *pop3; |
64 | }; | 71 | }; |
65 | 72 | ||
66 | class IMAPfolderItem; | 73 | class IMAPfolderItem; |
67 | 74 | ||
68 | class IMAPviewItem : public AccountViewItem | 75 | class IMAPviewItem : public AccountViewItem |
69 | { | 76 | { |
70 | friend class IMAPfolderItem; | 77 | friend class IMAPfolderItem; |
71 | public: | 78 | public: |
72 | IMAPviewItem( IMAPaccount *a, QListView *parent ); | 79 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); |
73 | ~IMAPviewItem(); | 80 | virtual ~IMAPviewItem(); |
74 | virtual void refresh(QList<RecMail>&); | 81 | virtual void refresh(QList<RecMail>&); |
75 | virtual RecBody fetchBody(const RecMail&); | 82 | virtual RecBody fetchBody(const RecMail&); |
76 | AbstractMail *getWrapper(); | 83 | AbstractMail *getWrapper(); |
77 | virtual QPopupMenu * getContextMenu(); | 84 | virtual QPopupMenu * getContextMenu(); |
78 | virtual void contextMenuSelected(int); | 85 | virtual void contextMenuSelected(int); |
86 | const QStringList&subFolders(); | ||
87 | virtual void refreshFolders(bool force=false); | ||
88 | bool offline(); | ||
79 | 89 | ||
80 | protected: | 90 | protected: |
81 | IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0); | 91 | IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0); |
82 | virtual void refreshFolders(bool force=false); | ||
83 | virtual void createNewFolder(); | 92 | virtual void createNewFolder(); |
84 | virtual void removeChilds(); | 93 | virtual void removeChilds(); |
85 | |||
86 | private: | ||
87 | IMAPaccount *account; | 94 | IMAPaccount *account; |
88 | AbstractMail *wrapper; | 95 | AbstractMail *wrapper; |
96 | QStringList currentFolders; | ||
89 | }; | 97 | }; |
90 | 98 | ||
91 | class IMAPfolderItem : public AccountViewItem | 99 | class IMAPfolderItem : public AccountViewItem |
92 | { | 100 | { |
93 | 101 | ||
94 | public: | 102 | public: |
95 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); | 103 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); |
96 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | 104 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); |
97 | ~IMAPfolderItem(); | 105 | virtual ~IMAPfolderItem(); |
98 | virtual void refresh(QList<RecMail>&); | 106 | virtual void refresh(QList<RecMail>&); |
99 | virtual RecBody fetchBody(const RecMail&); | 107 | virtual RecBody fetchBody(const RecMail&); |
100 | bool matchName(const QString&name)const; | 108 | bool matchName(const QString&name)const; |
101 | virtual QPopupMenu * getContextMenu(); | 109 | virtual QPopupMenu * getContextMenu(); |
102 | virtual void contextMenuSelected(int); | 110 | virtual void contextMenuSelected(int); |
103 | virtual const QString& Delemiter()const; | 111 | virtual const QString& Delemiter()const; |
104 | protected: | 112 | protected: |
105 | virtual void createNewFolder(); | 113 | virtual void createNewFolder(); |
106 | virtual void deleteFolder(); | 114 | virtual void deleteFolder(); |
107 | 115 | virtual void downloadMails(); | |
108 | private: | ||
109 | Folder *folder; | 116 | Folder *folder; |
110 | IMAPviewItem *imap; | 117 | IMAPviewItem *imap; |
111 | }; | 118 | }; |
112 | 119 | ||
113 | class MBOXviewItem : public AccountViewItem | 120 | class MBOXviewItem : public AccountViewItem |
114 | { | 121 | { |
115 | friend class MBOXfolderItem; | 122 | friend class MBOXfolderItem; |
116 | 123 | ||
117 | public: | 124 | public: |
118 | // MBOXviewItem( MBOXaccount *a, QListView *parent ); | 125 | MBOXviewItem( const QString&aMboxPath, AccountView *parent ); |
119 | MBOXviewItem( const QString&aMboxPath, QListView *parent ); | 126 | virtual ~MBOXviewItem(); |
120 | ~MBOXviewItem(); | ||
121 | virtual void refresh( QList<RecMail> &target ); | 127 | virtual void refresh( QList<RecMail> &target ); |
122 | virtual RecBody fetchBody( const RecMail &mail ); | 128 | virtual RecBody fetchBody( const RecMail &mail ); |
123 | AbstractMail *getWrapper(); | 129 | AbstractMail *getWrapper(); |
124 | virtual QPopupMenu * getContextMenu(); | 130 | virtual QPopupMenu * getContextMenu(); |
125 | virtual void contextMenuSelected(int); | 131 | virtual void contextMenuSelected(int); |
132 | QStringList subFolders(); | ||
133 | virtual void refresh(bool force=false); | ||
126 | 134 | ||
127 | protected: | 135 | protected: |
128 | virtual void refresh(bool force=false); | ||
129 | virtual void createFolder(); | 136 | virtual void createFolder(); |
130 | |||
131 | private: | ||
132 | // MBOXaccount *account; | ||
133 | QString m_Path; | 137 | QString m_Path; |
134 | AbstractMail *wrapper; | 138 | AbstractMail *wrapper; |
135 | 139 | ||
136 | }; | 140 | }; |
137 | 141 | ||
138 | class MBOXfolderItem : public AccountViewItem | 142 | class MBOXfolderItem : public AccountViewItem |
139 | { | 143 | { |
140 | 144 | ||
141 | public: | 145 | public: |
142 | MBOXfolderItem( Folder *folder, MBOXviewItem *parent , QListViewItem*after ); | 146 | MBOXfolderItem( Folder *folder, MBOXviewItem *parent , QListViewItem*after ); |
143 | ~MBOXfolderItem(); | 147 | virtual ~MBOXfolderItem(); |
144 | virtual void refresh(QList<RecMail>&); | 148 | virtual void refresh(QList<RecMail>&); |
145 | virtual RecBody fetchBody(const RecMail&); | 149 | virtual RecBody fetchBody(const RecMail&); |
146 | virtual QPopupMenu * getContextMenu(); | 150 | virtual QPopupMenu * getContextMenu(); |
147 | virtual void contextMenuSelected(int); | 151 | virtual void contextMenuSelected(int); |
152 | virtual Folder*getFolder(); | ||
148 | 153 | ||
149 | protected: | 154 | protected: |
150 | virtual void deleteFolder(); | 155 | virtual void deleteFolder(); |
151 | private: | ||
152 | Folder *folder; | 156 | Folder *folder; |
153 | MBOXviewItem *mbox; | 157 | MBOXviewItem *mbox; |
154 | }; | 158 | }; |
155 | 159 | ||
156 | class AccountView : public QListView | 160 | class AccountView : public QListView |
157 | { | 161 | { |
158 | Q_OBJECT | 162 | Q_OBJECT |
159 | 163 | ||
160 | public: | 164 | public: |
161 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 165 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
162 | void populate( QList<Account> list ); | 166 | virtual ~AccountView(); |
163 | RecBody fetchBody(const RecMail&aMail); | 167 | virtual void populate( QList<Account> list ); |
168 | virtual RecBody fetchBody(const RecMail&aMail); | ||
169 | virtual void downloadMails(Folder*fromFolder,AbstractMail*fromWrapper); | ||
164 | 170 | ||
165 | public slots: | 171 | public slots: |
166 | virtual void refreshAll(); | 172 | virtual void refreshAll(); |
167 | virtual void refresh(QListViewItem *item); | 173 | virtual void refresh(QListViewItem *item); |
168 | virtual void refreshCurrent(); | 174 | virtual void refreshCurrent(); |
169 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); | 175 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); |
170 | virtual void slotContextMenu(int id); | 176 | virtual void slotContextMenu(int id); |
177 | void setupFolderselect(Selectstore*sels); | ||
171 | 178 | ||
172 | signals: | 179 | signals: |
173 | void refreshMailview(QList<RecMail>*); | 180 | void refreshMailview(QList<RecMail>*); |
174 | 181 | ||
175 | private: | 182 | protected: |
176 | QListViewItem* m_currentItem; | 183 | QListViewItem* m_currentItem; |
184 | QValueList<IMAPviewItem*> imapAccounts; | ||
185 | QValueList<MBOXviewItem*> mboxAccounts; | ||
177 | }; | 186 | }; |
178 | 187 | ||
179 | #endif | 188 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 80d0b52..3dd2fce 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -1,50 +1,50 @@ | |||
1 | #include "abstractmail.h" | 1 | #include "abstractmail.h" |
2 | #include "imapwrapper.h" | 2 | #include "imapwrapper.h" |
3 | #include "pop3wrapper.h" | 3 | #include "pop3wrapper.h" |
4 | #include "mboxwrapper.h" | 4 | #include "mboxwrapper.h" |
5 | #include "mailtypes.h" | 5 | #include "mailtypes.h" |
6 | 6 | ||
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qfile.h> | 8 | #include <qfile.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | #include <libetpan/mailmime_content.h> | 11 | #include <libetpan/mailmime_content.h> |
12 | #include <libetpan/mailmime.h> | 12 | #include <libetpan/mailmime.h> |
13 | 13 | ||
14 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | 14 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) |
15 | { | 15 | { |
16 | return new IMAPwrapper(a); | 16 | return new IMAPwrapper(a); |
17 | } | 17 | } |
18 | 18 | ||
19 | AbstractMail* AbstractMail::getWrapper(POP3account *a) | 19 | AbstractMail* AbstractMail::getWrapper(POP3account *a) |
20 | { | 20 | { |
21 | return new POP3wrapper(a); | 21 | return new POP3wrapper(a); |
22 | } | 22 | } |
23 | 23 | ||
24 | AbstractMail* AbstractMail::getWrapper(const QString&a) | 24 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) |
25 | { | 25 | { |
26 | return new MBOXwrapper(a); | 26 | return new MBOXwrapper(a,name); |
27 | } | 27 | } |
28 | 28 | ||
29 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) | 29 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) |
30 | { | 30 | { |
31 | qDebug("Decode string start"); | 31 | qDebug("Decode string start"); |
32 | char*result_text; | 32 | char*result_text; |
33 | size_t index = 0; | 33 | size_t index = 0; |
34 | /* reset for recursive use! */ | 34 | /* reset for recursive use! */ |
35 | size_t target_length = 0; | 35 | size_t target_length = 0; |
36 | result_text = 0; | 36 | result_text = 0; |
37 | int mimetype = MAILMIME_MECHANISM_7BIT; | 37 | int mimetype = MAILMIME_MECHANISM_7BIT; |
38 | if (enc.lower()=="quoted-printable") { | 38 | if (enc.lower()=="quoted-printable") { |
39 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; | 39 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; |
40 | } else if (enc.lower()=="base64") { | 40 | } else if (enc.lower()=="base64") { |
41 | mimetype = MAILMIME_MECHANISM_BASE64; | 41 | mimetype = MAILMIME_MECHANISM_BASE64; |
42 | } else if (enc.lower()=="8bit") { | 42 | } else if (enc.lower()=="8bit") { |
43 | mimetype = MAILMIME_MECHANISM_8BIT; | 43 | mimetype = MAILMIME_MECHANISM_8BIT; |
44 | } else if (enc.lower()=="binary") { | 44 | } else if (enc.lower()=="binary") { |
45 | mimetype = MAILMIME_MECHANISM_BINARY; | 45 | mimetype = MAILMIME_MECHANISM_BINARY; |
46 | } | 46 | } |
47 | 47 | ||
48 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, | 48 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, |
49 | &result_text,&target_length); | 49 | &result_text,&target_length); |
50 | 50 | ||
@@ -78,24 +78,29 @@ QString AbstractMail::convert_String(const char*text) | |||
78 | 78 | ||
79 | /* cp & paste from launcher */ | 79 | /* cp & paste from launcher */ |
80 | QString AbstractMail::gen_attachment_id() | 80 | QString AbstractMail::gen_attachment_id() |
81 | { | 81 | { |
82 | QFile file( "/proc/sys/kernel/random/uuid" ); | 82 | QFile file( "/proc/sys/kernel/random/uuid" ); |
83 | if (!file.open(IO_ReadOnly ) ) | 83 | if (!file.open(IO_ReadOnly ) ) |
84 | return QString::null; | 84 | return QString::null; |
85 | 85 | ||
86 | QTextStream stream(&file); | 86 | QTextStream stream(&file); |
87 | 87 | ||
88 | return "{" + stream.read().stripWhiteSpace() + "}"; | 88 | return "{" + stream.read().stripWhiteSpace() + "}"; |
89 | } | 89 | } |
90 | 90 | ||
91 | int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) | 91 | int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) |
92 | { | 92 | { |
93 | return 0; | 93 | return 0; |
94 | } | 94 | } |
95 | 95 | ||
96 | QString AbstractMail::defaultLocalfolder() | 96 | QString AbstractMail::defaultLocalfolder() |
97 | { | 97 | { |
98 | QString f = getenv( "HOME" ); | 98 | QString f = getenv( "HOME" ); |
99 | f += "/Applications/opiemail/localmail"; | 99 | f += "/Applications/opiemail/localmail"; |
100 | return f; | 100 | return f; |
101 | } | 101 | } |
102 | |||
103 | /* temporary - will be removed when implemented in all classes */ | ||
104 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) | ||
105 | { | ||
106 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 9770991..15d83cb 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -10,51 +10,53 @@ 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 | virtual encodedString* fetchRawBody(const RecMail&mail)=0; |
30 | 30 | ||
31 | virtual void deleteMail(const RecMail&mail)=0; | 31 | virtual void deleteMail(const RecMail&mail)=0; |
32 | virtual void answeredMail(const RecMail&mail)=0; | 32 | virtual void answeredMail(const RecMail&mail)=0; |
33 | virtual int deleteAllMail(const Folder*)=0; | 33 | virtual int deleteAllMail(const Folder*)=0; |
34 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); | ||
34 | virtual int deleteMbox(const Folder*)=0; | 35 | virtual int deleteMbox(const Folder*)=0; |
35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 36 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
36 | 37 | ||
37 | virtual void cleanMimeCache(){}; | 38 | virtual void cleanMimeCache(){}; |
38 | /* mail box methods */ | 39 | /* mail box methods */ |
39 | /* parameter is the box to create. | 40 | /* parameter is the box to create. |
40 | * if the implementing subclass has prefixes, | 41 | * if the implementing subclass has prefixes, |
41 | * them has to be appended automatic. | 42 | * them has to be appended automatic. |
42 | */ | 43 | */ |
43 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); | 44 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); |
44 | virtual void logout()=0; | 45 | virtual void logout()=0; |
45 | 46 | ||
46 | static AbstractMail* getWrapper(IMAPaccount *a); | 47 | static AbstractMail* getWrapper(IMAPaccount *a); |
47 | static AbstractMail* getWrapper(POP3account *a); | 48 | static AbstractMail* getWrapper(POP3account *a); |
48 | /* mbox only! */ | 49 | /* mbox only! */ |
49 | static AbstractMail* getWrapper(const QString&a); | 50 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); |
50 | 51 | ||
51 | static QString defaultLocalfolder(); | 52 | static QString defaultLocalfolder(); |
52 | 53 | ||
53 | virtual const QString&getType()const=0; | 54 | virtual const QString&getType()const=0; |
55 | virtual const QString&getName()const=0; | ||
54 | 56 | ||
55 | protected: | 57 | protected: |
56 | static encodedString*decode_String(const encodedString*text,const QString&enc); | 58 | static encodedString*decode_String(const encodedString*text,const QString&enc); |
57 | static QString convert_String(const char*text); | 59 | static QString convert_String(const char*text); |
58 | static QString gen_attachment_id(); | 60 | static QString gen_attachment_id(); |
59 | }; | 61 | }; |
60 | #endif | 62 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index d252159..bb74de9 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -8,48 +8,49 @@ | |||
8 | 8 | ||
9 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 9 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
10 | : AbstractMail() | 10 | : AbstractMail() |
11 | { | 11 | { |
12 | account = a; | 12 | account = a; |
13 | m_imap = 0; | 13 | m_imap = 0; |
14 | } | 14 | } |
15 | 15 | ||
16 | IMAPwrapper::~IMAPwrapper() | 16 | IMAPwrapper::~IMAPwrapper() |
17 | { | 17 | { |
18 | logout(); | 18 | logout(); |
19 | } | 19 | } |
20 | 20 | ||
21 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) | 21 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) |
22 | { | 22 | { |
23 | qDebug( "IMAP: %i of %i", current, maximum ); | 23 | qDebug( "IMAP: %i of %i", current, maximum ); |
24 | } | 24 | } |
25 | 25 | ||
26 | void IMAPwrapper::login() | 26 | void IMAPwrapper::login() |
27 | { | 27 | { |
28 | const char *server, *user, *pass; | 28 | const char *server, *user, *pass; |
29 | uint16_t port; | 29 | uint16_t port; |
30 | int err = MAILIMAP_NO_ERROR; | 30 | int err = MAILIMAP_NO_ERROR; |
31 | 31 | ||
32 | if (account->getOffline()) return; | ||
32 | /* we are connected this moment */ | 33 | /* we are connected this moment */ |
33 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ | 34 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ |
34 | if (m_imap) { | 35 | if (m_imap) { |
35 | err = mailimap_noop(m_imap); | 36 | err = mailimap_noop(m_imap); |
36 | if (err!=MAILIMAP_NO_ERROR) { | 37 | if (err!=MAILIMAP_NO_ERROR) { |
37 | logout(); | 38 | logout(); |
38 | } else { | 39 | } else { |
39 | mailstream_flush(m_imap->imap_stream); | 40 | mailstream_flush(m_imap->imap_stream); |
40 | return; | 41 | return; |
41 | } | 42 | } |
42 | } | 43 | } |
43 | server = account->getServer().latin1(); | 44 | server = account->getServer().latin1(); |
44 | port = account->getPort().toUInt(); | 45 | port = account->getPort().toUInt(); |
45 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 46 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
46 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 47 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
47 | login.show(); | 48 | login.show(); |
48 | if ( QDialog::Accepted == login.exec() ) { | 49 | if ( QDialog::Accepted == login.exec() ) { |
49 | // ok | 50 | // ok |
50 | user = login.getUser().latin1(); | 51 | user = login.getUser().latin1(); |
51 | pass = login.getPassword().latin1(); | 52 | pass = login.getPassword().latin1(); |
52 | } else { | 53 | } else { |
53 | // cancel | 54 | // cancel |
54 | qDebug( "IMAP: Login canceled" ); | 55 | qDebug( "IMAP: Login canceled" ); |
55 | return; | 56 | return; |
@@ -985,30 +986,35 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
985 | } | 986 | } |
986 | } else { | 987 | } else { |
987 | qDebug("Error retrieving status"); | 988 | qDebug("Error retrieving status"); |
988 | } | 989 | } |
989 | if (status) mailimap_mailbox_data_status_free(status); | 990 | if (status) mailimap_mailbox_data_status_free(status); |
990 | if (att_list) mailimap_status_att_list_free(att_list); | 991 | if (att_list) mailimap_status_att_list_free(att_list); |
991 | } | 992 | } |
992 | 993 | ||
993 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | 994 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) |
994 | { | 995 | { |
995 | login(); | 996 | login(); |
996 | if (!m_imap) return; | 997 | if (!m_imap) return; |
997 | if (!msg) return; | 998 | if (!msg) return; |
998 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); | 999 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); |
999 | if (r != MAILIMAP_NO_ERROR) { | 1000 | if (r != MAILIMAP_NO_ERROR) { |
1000 | Global::statusMessage("Error storing mail!"); | 1001 | Global::statusMessage("Error storing mail!"); |
1001 | } | 1002 | } |
1002 | } | 1003 | } |
1003 | 1004 | ||
1004 | const QString&IMAPwrapper::getType()const | 1005 | const QString&IMAPwrapper::getType()const |
1005 | { | 1006 | { |
1006 | return account->getType(); | 1007 | return account->getType(); |
1007 | } | 1008 | } |
1008 | 1009 | ||
1010 | const QString&IMAPwrapper::getName()const | ||
1011 | { | ||
1012 | return account->getAccountName(); | ||
1013 | } | ||
1014 | |||
1009 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) | 1015 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) |
1010 | { | 1016 | { |
1011 | // dummy | 1017 | // dummy |
1012 | QValueList<int> path; | 1018 | QValueList<int> path; |
1013 | return fetchRawPart(mail,path,false); | 1019 | return fetchRawPart(mail,path,false); |
1014 | } | 1020 | } |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index b246f58..b2bd7e9 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -24,48 +24,50 @@ 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 | virtual encodedString* fetchRawBody(const RecMail&mail); |
40 | 40 | ||
41 | 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); |
42 | virtual int deleteMbox(const Folder*folder); | 42 | virtual int deleteMbox(const Folder*folder); |
43 | 43 | ||
44 | static void imap_progress( size_t current, size_t maximum ); | 44 | static void imap_progress( size_t current, size_t maximum ); |
45 | 45 | ||
46 | virtual void logout(); | 46 | virtual void logout(); |
47 | virtual const QString&getType()const; | 47 | virtual const QString&getType()const; |
48 | virtual const QString&getName()const; | ||
49 | |||
48 | protected: | 50 | protected: |
49 | RecMail*parse_list_result(mailimap_msg_att*); | 51 | RecMail*parse_list_result(mailimap_msg_att*); |
50 | void login(); | 52 | void login(); |
51 | 53 | ||
52 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); | 54 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); |
53 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); | 55 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); |
54 | 56 | ||
55 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); | 57 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); |
56 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); | 58 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); |
57 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); | 59 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); |
58 | void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); | 60 | void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); |
59 | void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); | 61 | void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); |
60 | void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); | 62 | void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); |
61 | 63 | ||
62 | /* just helpers */ | 64 | /* just helpers */ |
63 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); | 65 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); |
64 | static QStringList address_list_to_stringlist(clist*list); | 66 | static QStringList address_list_to_stringlist(clist*list); |
65 | 67 | ||
66 | 68 | ||
67 | IMAPaccount *account; | 69 | IMAPaccount *account; |
68 | mailimap *m_imap; | 70 | mailimap *m_imap; |
69 | }; | 71 | }; |
70 | 72 | ||
71 | #endif | 73 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index bc496f7..97f301e 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -1,36 +1,36 @@ | |||
1 | #include "mboxwrapper.h" | 1 | #include "mboxwrapper.h" |
2 | #include "mailtypes.h" | 2 | #include "mailtypes.h" |
3 | #include "mailwrapper.h" | 3 | #include "mailwrapper.h" |
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | #include <qdir.h> | 5 | #include <qdir.h> |
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include <qpe/global.h> | 7 | #include <qpe/global.h> |
8 | 8 | ||
9 | const QString MBOXwrapper::wrapperType="MBOX"; | 9 | const QString MBOXwrapper::wrapperType="MBOX"; |
10 | 10 | ||
11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) | 11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) |
12 | : Genericwrapper(),MBOXPath(mbox_dir) | 12 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) |
13 | { | 13 | { |
14 | QDir dir(MBOXPath); | 14 | QDir dir(MBOXPath); |
15 | if (!dir.exists()) { | 15 | if (!dir.exists()) { |
16 | dir.mkdir(MBOXPath); | 16 | dir.mkdir(MBOXPath); |
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
20 | MBOXwrapper::~MBOXwrapper() | 20 | MBOXwrapper::~MBOXwrapper() |
21 | { | 21 | { |
22 | } | 22 | } |
23 | 23 | ||
24 | void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | 24 | void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) |
25 | { | 25 | { |
26 | mailstorage*storage = mailstorage_new(NULL); | 26 | mailstorage*storage = mailstorage_new(NULL); |
27 | QString p = MBOXPath+"/"; | 27 | QString p = MBOXPath+"/"; |
28 | p+=mailbox; | 28 | p+=mailbox; |
29 | 29 | ||
30 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 30 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
31 | mailfolder*folder; | 31 | mailfolder*folder; |
32 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 32 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
33 | r = mailfolder_connect(folder); | 33 | r = mailfolder_connect(folder); |
34 | if (r != MAIL_NO_ERROR) { | 34 | if (r != MAIL_NO_ERROR) { |
35 | qDebug("Error initializing mbox"); | 35 | qDebug("Error initializing mbox"); |
36 | mailfolder_free(folder); | 36 | mailfolder_free(folder); |
@@ -309,24 +309,29 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
309 | mailfolder*folder = 0; | 309 | mailfolder*folder = 0; |
310 | mailstorage*storage = mailstorage_new(NULL); | 310 | mailstorage*storage = mailstorage_new(NULL); |
311 | target_stat.message_count = 0; | 311 | target_stat.message_count = 0; |
312 | target_stat.message_unseen = 0; | 312 | target_stat.message_unseen = 0; |
313 | target_stat.message_recent = 0; | 313 | target_stat.message_recent = 0; |
314 | QString p = MBOXPath+"/"+mailbox; | 314 | QString p = MBOXPath+"/"+mailbox; |
315 | QFile fi(p); | 315 | QFile fi(p); |
316 | if (!fi.exists()) { | 316 | if (!fi.exists()) { |
317 | Global::statusMessage(tr("Mailbox doesn't exist.")); | 317 | Global::statusMessage(tr("Mailbox doesn't exist.")); |
318 | return; | 318 | return; |
319 | } | 319 | } |
320 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 320 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
321 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 321 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
322 | r = mailfolder_connect(folder); | 322 | r = mailfolder_connect(folder); |
323 | r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, | 323 | r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, |
324 | &target_stat.message_recent,&target_stat.message_unseen); | 324 | &target_stat.message_recent,&target_stat.message_unseen); |
325 | if (folder) mailfolder_free(folder); | 325 | if (folder) mailfolder_free(folder); |
326 | if (storage) mailstorage_free(storage); | 326 | if (storage) mailstorage_free(storage); |
327 | } | 327 | } |
328 | 328 | ||
329 | const QString&MBOXwrapper::getType()const | 329 | const QString&MBOXwrapper::getType()const |
330 | { | 330 | { |
331 | return wrapperType; | 331 | return wrapperType; |
332 | } | 332 | } |
333 | |||
334 | const QString&MBOXwrapper::getName()const | ||
335 | { | ||
336 | return MBOXName; | ||
337 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index 2794014..194ff86 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h | |||
@@ -1,45 +1,47 @@ | |||
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 | class encodedString; |
10 | struct mailmbox_folder; | 10 | struct mailmbox_folder; |
11 | 11 | ||
12 | class MBOXwrapper : public Genericwrapper | 12 | class MBOXwrapper : public Genericwrapper |
13 | { | 13 | { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | public: | 15 | public: |
16 | MBOXwrapper(const QString & dir); | 16 | MBOXwrapper(const QString & dir,const QString&name); |
17 | virtual ~MBOXwrapper(); | 17 | virtual ~MBOXwrapper(); |
18 | 18 | ||
19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
20 | virtual QList<Folder>* listFolders(); | 20 | virtual QList<Folder>* listFolders(); |
21 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 21 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
22 | 22 | ||
23 | virtual void deleteMail(const RecMail&mail); | 23 | virtual void deleteMail(const RecMail&mail); |
24 | virtual void answeredMail(const RecMail&mail); | 24 | virtual void answeredMail(const RecMail&mail); |
25 | 25 | ||
26 | 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); |
27 | virtual int deleteMbox(const Folder*); | 27 | virtual int deleteMbox(const Folder*); |
28 | 28 | ||
29 | 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); |
30 | 30 | ||
31 | virtual RecBody fetchBody( const RecMail &mail ); | 31 | virtual RecBody fetchBody( const RecMail &mail ); |
32 | static void mbox_progress( size_t current, size_t maximum ); | 32 | static void mbox_progress( size_t current, size_t maximum ); |
33 | 33 | ||
34 | virtual encodedString* fetchRawBody(const RecMail&mail); | 34 | virtual encodedString* fetchRawBody(const RecMail&mail); |
35 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); | 35 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); |
36 | virtual int deleteAllMail(const Folder*); | 36 | virtual int deleteAllMail(const Folder*); |
37 | virtual const QString&getType()const; | 37 | virtual const QString&getType()const; |
38 | virtual const QString&getName()const; | ||
38 | 39 | ||
39 | protected: | 40 | protected: |
40 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); | 41 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); |
41 | QString MBOXPath; | 42 | QString MBOXPath; |
43 | QString MBOXName; | ||
42 | static const QString wrapperType; | 44 | static const QString wrapperType; |
43 | }; | 45 | }; |
44 | 46 | ||
45 | #endif | 47 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index cceb22e..67bde38 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -87,48 +87,49 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) | |||
87 | msg_data->msg_message = message; | 87 | msg_data->msg_message = message; |
88 | msg_data->msg_length = strlen(message); | 88 | msg_data->msg_length = strlen(message); |
89 | } | 89 | } |
90 | body = parseMail(mailmsg); | 90 | body = parseMail(mailmsg); |
91 | 91 | ||
92 | /* clean up */ | 92 | /* clean up */ |
93 | if (mailmsg) mailmessage_free(mailmsg); | 93 | if (mailmsg) mailmessage_free(mailmsg); |
94 | if (message) free(message); | 94 | if (message) free(message); |
95 | 95 | ||
96 | return body; | 96 | return body; |
97 | } | 97 | } |
98 | 98 | ||
99 | void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | 99 | void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) |
100 | { | 100 | { |
101 | login(); | 101 | login(); |
102 | if (!m_pop3) return; | 102 | if (!m_pop3) return; |
103 | uint32_t res_messages,res_recent,res_unseen; | 103 | uint32_t res_messages,res_recent,res_unseen; |
104 | mailsession_status_folder(m_folder->fld_session,"INBOX",&res_messages,&res_recent,&res_unseen); | 104 | mailsession_status_folder(m_folder->fld_session,"INBOX",&res_messages,&res_recent,&res_unseen); |
105 | parseList(target,m_folder->fld_session,"INBOX"); | 105 | parseList(target,m_folder->fld_session,"INBOX"); |
106 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); | 106 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); |
107 | } | 107 | } |
108 | 108 | ||
109 | void POP3wrapper::login() | 109 | void POP3wrapper::login() |
110 | { | 110 | { |
111 | if (account->getOffline()) return; | ||
111 | /* we'll hold the line */ | 112 | /* we'll hold the line */ |
112 | if ( m_pop3 != NULL ) return; | 113 | if ( m_pop3 != NULL ) return; |
113 | 114 | ||
114 | const char *server, *user, *pass; | 115 | const char *server, *user, *pass; |
115 | uint16_t port; | 116 | uint16_t port; |
116 | int err = MAILPOP3_NO_ERROR; | 117 | int err = MAILPOP3_NO_ERROR; |
117 | 118 | ||
118 | server = account->getServer().latin1(); | 119 | server = account->getServer().latin1(); |
119 | port = account->getPort().toUInt(); | 120 | port = account->getPort().toUInt(); |
120 | 121 | ||
121 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 122 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
122 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 123 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
123 | login.show(); | 124 | login.show(); |
124 | if ( QDialog::Accepted == login.exec() ) { | 125 | if ( QDialog::Accepted == login.exec() ) { |
125 | // ok | 126 | // ok |
126 | user = login.getUser().latin1(); | 127 | user = login.getUser().latin1(); |
127 | pass = login.getPassword().latin1(); | 128 | pass = login.getPassword().latin1(); |
128 | } else { | 129 | } else { |
129 | // cancel | 130 | // cancel |
130 | qDebug( "POP3: Login canceled" ); | 131 | qDebug( "POP3: Login canceled" ); |
131 | return; | 132 | return; |
132 | } | 133 | } |
133 | } else { | 134 | } else { |
134 | user = account->getUser().latin1(); | 135 | user = account->getUser().latin1(); |
@@ -228,24 +229,29 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) | |||
228 | if (!m_pop3) return; | 229 | if (!m_pop3) return; |
229 | int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, | 230 | int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, |
230 | &target_stat.message_recent,&target_stat.message_unseen); | 231 | &target_stat.message_recent,&target_stat.message_unseen); |
231 | } | 232 | } |
232 | 233 | ||
233 | encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) | 234 | encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) |
234 | { | 235 | { |
235 | char*target=0; | 236 | char*target=0; |
236 | size_t length=0; | 237 | size_t length=0; |
237 | encodedString*res = 0; | 238 | encodedString*res = 0; |
238 | mailmessage * mailmsg = 0; | 239 | mailmessage * mailmsg = 0; |
239 | int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); | 240 | int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); |
240 | err = mailmessage_fetch(mailmsg,&target,&length); | 241 | err = mailmessage_fetch(mailmsg,&target,&length); |
241 | if (mailmsg) mailmessage_free(mailmsg); | 242 | if (mailmsg) mailmessage_free(mailmsg); |
242 | if (target) { | 243 | if (target) { |
243 | res = new encodedString(target,length); | 244 | res = new encodedString(target,length); |
244 | } | 245 | } |
245 | return res; | 246 | return res; |
246 | } | 247 | } |
247 | 248 | ||
248 | const QString&POP3wrapper::getType()const | 249 | const QString&POP3wrapper::getType()const |
249 | { | 250 | { |
250 | return account->getType(); | 251 | return account->getType(); |
251 | } | 252 | } |
253 | |||
254 | const QString&POP3wrapper::getName()const | ||
255 | { | ||
256 | return account->getAccountName(); | ||
257 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index f0307b6..d2b708d 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -9,34 +9,35 @@ class encodedString; | |||
9 | struct mailstorage; | 9 | struct mailstorage; |
10 | struct mailfolder; | 10 | struct mailfolder; |
11 | 11 | ||
12 | class POP3wrapper : public Genericwrapper | 12 | class POP3wrapper : public Genericwrapper |
13 | { | 13 | { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | POP3wrapper( POP3account *a ); | 17 | POP3wrapper( POP3account *a ); |
18 | virtual ~POP3wrapper(); | 18 | virtual ~POP3wrapper(); |
19 | /* mailbox will be ignored */ | 19 | /* mailbox will be ignored */ |
20 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 20 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
21 | virtual QList<Folder>* listFolders(); | 21 | virtual QList<Folder>* listFolders(); |
22 | /* mailbox will be ignored */ | 22 | /* mailbox will be ignored */ |
23 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 23 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
24 | 24 | ||
25 | virtual void deleteMail(const RecMail&mail); | 25 | virtual void deleteMail(const RecMail&mail); |
26 | virtual void answeredMail(const RecMail&mail); | 26 | virtual void answeredMail(const RecMail&mail); |
27 | virtual int deleteAllMail(const Folder*); | 27 | virtual int deleteAllMail(const Folder*); |
28 | 28 | ||
29 | virtual RecBody fetchBody( const RecMail &mail ); | 29 | virtual RecBody fetchBody( const RecMail &mail ); |
30 | virtual encodedString* fetchRawBody(const RecMail&mail); | 30 | virtual encodedString* fetchRawBody(const RecMail&mail); |
31 | virtual void logout(); | 31 | virtual void logout(); |
32 | virtual const QString&getType()const; | 32 | virtual const QString&getType()const; |
33 | virtual const QString&getName()const; | ||
33 | static void pop3_progress( size_t current, size_t maximum ); | 34 | static void pop3_progress( size_t current, size_t maximum ); |
34 | 35 | ||
35 | protected: | 36 | protected: |
36 | void login(); | 37 | void login(); |
37 | POP3account *account; | 38 | POP3account *account; |
38 | mailstorage*m_pop3; | 39 | mailstorage*m_pop3; |
39 | mailfolder*m_folder; | 40 | mailfolder*m_folder; |
40 | }; | 41 | }; |
41 | 42 | ||
42 | #endif | 43 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index c5187f5..02a80a3 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -147,65 +147,69 @@ QString IMAPaccount::getUniqueFileName() | |||
147 | do { | 147 | do { |
148 | unique.setNum( num++ ); | 148 | unique.setNum( num++ ); |
149 | } while ( imap.contains( "imap-" + unique ) > 0 ); | 149 | } while ( imap.contains( "imap-" + unique ) > 0 ); |
150 | 150 | ||
151 | return unique; | 151 | return unique; |
152 | } | 152 | } |
153 | 153 | ||
154 | void IMAPaccount::read() | 154 | void IMAPaccount::read() |
155 | { | 155 | { |
156 | Config *conf = new Config( getFileName(), Config::File ); | 156 | Config *conf = new Config( getFileName(), Config::File ); |
157 | conf->setGroup( "IMAP Account" ); | 157 | conf->setGroup( "IMAP Account" ); |
158 | accountName = conf->readEntry( "Account","" ); | 158 | accountName = conf->readEntry( "Account","" ); |
159 | if (accountName.isNull()) accountName = ""; | 159 | if (accountName.isNull()) accountName = ""; |
160 | server = conf->readEntry( "Server","" ); | 160 | server = conf->readEntry( "Server","" ); |
161 | if (server.isNull()) server=""; | 161 | if (server.isNull()) server=""; |
162 | port = conf->readEntry( "Port","" ); | 162 | port = conf->readEntry( "Port","" ); |
163 | if (port.isNull()) port="143"; | 163 | if (port.isNull()) port="143"; |
164 | ssl = conf->readBoolEntry( "SSL",false ); | 164 | ssl = conf->readBoolEntry( "SSL",false ); |
165 | user = conf->readEntry( "User","" ); | 165 | user = conf->readEntry( "User","" ); |
166 | if (user.isNull()) user = ""; | 166 | if (user.isNull()) user = ""; |
167 | password = conf->readEntryCrypt( "Password","" ); | 167 | password = conf->readEntryCrypt( "Password","" ); |
168 | if (password.isNull()) password = ""; | 168 | if (password.isNull()) password = ""; |
169 | prefix = conf->readEntry("MailPrefix",""); | 169 | prefix = conf->readEntry("MailPrefix",""); |
170 | if (prefix.isNull()) prefix = ""; | 170 | if (prefix.isNull()) prefix = ""; |
171 | offline = conf->readBoolEntry("Offline",false); | ||
172 | delete conf; | ||
171 | } | 173 | } |
172 | 174 | ||
173 | void IMAPaccount::save() | 175 | void IMAPaccount::save() |
174 | { | 176 | { |
175 | qDebug( "saving " + getFileName() ); | 177 | qDebug( "saving " + getFileName() ); |
176 | Settings::checkDirectory(); | 178 | Settings::checkDirectory(); |
177 | 179 | ||
178 | Config *conf = new Config( getFileName(), Config::File ); | 180 | Config *conf = new Config( getFileName(), Config::File ); |
179 | conf->setGroup( "IMAP Account" ); | 181 | conf->setGroup( "IMAP Account" ); |
180 | conf->writeEntry( "Account", accountName ); | 182 | conf->writeEntry( "Account", accountName ); |
181 | conf->writeEntry( "Server", server ); | 183 | conf->writeEntry( "Server", server ); |
182 | conf->writeEntry( "Port", port ); | 184 | conf->writeEntry( "Port", port ); |
183 | conf->writeEntry( "SSL", ssl ); | 185 | conf->writeEntry( "SSL", ssl ); |
184 | conf->writeEntry( "User", user ); | 186 | conf->writeEntry( "User", user ); |
185 | conf->writeEntryCrypt( "Password", password ); | 187 | conf->writeEntryCrypt( "Password", password ); |
186 | conf->writeEntry( "MailPrefix",prefix); | 188 | conf->writeEntry( "MailPrefix",prefix); |
189 | conf->writeEntry( "Offline",offline); | ||
187 | conf->write(); | 190 | conf->write(); |
191 | delete conf; | ||
188 | } | 192 | } |
189 | 193 | ||
190 | 194 | ||
191 | QString IMAPaccount::getFileName() | 195 | QString IMAPaccount::getFileName() |
192 | { | 196 | { |
193 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; | 197 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; |
194 | } | 198 | } |
195 | 199 | ||
196 | POP3account::POP3account() | 200 | POP3account::POP3account() |
197 | : Account() | 201 | : Account() |
198 | { | 202 | { |
199 | file = POP3account::getUniqueFileName(); | 203 | file = POP3account::getUniqueFileName(); |
200 | accountName = "New POP3 Account"; | 204 | accountName = "New POP3 Account"; |
201 | ssl = false; | 205 | ssl = false; |
202 | type = "POP3"; | 206 | type = "POP3"; |
203 | port = POP3_PORT; | 207 | port = POP3_PORT; |
204 | } | 208 | } |
205 | 209 | ||
206 | POP3account::POP3account( QString filename ) | 210 | POP3account::POP3account( QString filename ) |
207 | : Account() | 211 | : Account() |
208 | { | 212 | { |
209 | file = filename; | 213 | file = filename; |
210 | accountName = "New POP3 Account"; | 214 | accountName = "New POP3 Account"; |
211 | ssl = false; | 215 | ssl = false; |
@@ -217,64 +221,68 @@ QString POP3account::getUniqueFileName() | |||
217 | { | 221 | { |
218 | int num = 0; | 222 | int num = 0; |
219 | QString unique; | 223 | QString unique; |
220 | 224 | ||
221 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 225 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
222 | 226 | ||
223 | QStringList imap = dir.entryList( "pop3-*" ); | 227 | QStringList imap = dir.entryList( "pop3-*" ); |
224 | do { | 228 | do { |
225 | unique.setNum( num++ ); | 229 | unique.setNum( num++ ); |
226 | } while ( imap.contains( "pop3-" + unique ) > 0 ); | 230 | } while ( imap.contains( "pop3-" + unique ) > 0 ); |
227 | 231 | ||
228 | return unique; | 232 | return unique; |
229 | } | 233 | } |
230 | 234 | ||
231 | void POP3account::read() | 235 | void POP3account::read() |
232 | { | 236 | { |
233 | Config *conf = new Config( getFileName(), Config::File ); | 237 | Config *conf = new Config( getFileName(), Config::File ); |
234 | conf->setGroup( "POP3 Account" ); | 238 | conf->setGroup( "POP3 Account" ); |
235 | accountName = conf->readEntry( "Account" ); | 239 | accountName = conf->readEntry( "Account" ); |
236 | server = conf->readEntry( "Server" ); | 240 | server = conf->readEntry( "Server" ); |
237 | port = conf->readEntry( "Port" ); | 241 | port = conf->readEntry( "Port" ); |
238 | ssl = conf->readBoolEntry( "SSL" ); | 242 | ssl = conf->readBoolEntry( "SSL" ); |
239 | user = conf->readEntry( "User" ); | 243 | user = conf->readEntry( "User" ); |
240 | password = conf->readEntryCrypt( "Password" ); | 244 | password = conf->readEntryCrypt( "Password" ); |
245 | offline = conf->readBoolEntry("Offline",false); | ||
246 | delete conf; | ||
241 | } | 247 | } |
242 | 248 | ||
243 | void POP3account::save() | 249 | void POP3account::save() |
244 | { | 250 | { |
245 | qDebug( "saving " + getFileName() ); | 251 | qDebug( "saving " + getFileName() ); |
246 | Settings::checkDirectory(); | 252 | Settings::checkDirectory(); |
247 | 253 | ||
248 | Config *conf = new Config( getFileName(), Config::File ); | 254 | Config *conf = new Config( getFileName(), Config::File ); |
249 | conf->setGroup( "POP3 Account" ); | 255 | conf->setGroup( "POP3 Account" ); |
250 | conf->writeEntry( "Account", accountName ); | 256 | conf->writeEntry( "Account", accountName ); |
251 | conf->writeEntry( "Server", server ); | 257 | conf->writeEntry( "Server", server ); |
252 | conf->writeEntry( "Port", port ); | 258 | conf->writeEntry( "Port", port ); |
253 | conf->writeEntry( "SSL", ssl ); | 259 | conf->writeEntry( "SSL", ssl ); |
254 | conf->writeEntry( "User", user ); | 260 | conf->writeEntry( "User", user ); |
255 | conf->writeEntryCrypt( "Password", password ); | 261 | conf->writeEntryCrypt( "Password", password ); |
262 | conf->writeEntry( "Offline",offline); | ||
256 | conf->write(); | 263 | conf->write(); |
264 | delete conf; | ||
257 | } | 265 | } |
258 | 266 | ||
259 | 267 | ||
260 | QString POP3account::getFileName() | 268 | QString POP3account::getFileName() |
261 | { | 269 | { |
262 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; | 270 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; |
263 | } | 271 | } |
264 | 272 | ||
265 | SMTPaccount::SMTPaccount() | 273 | SMTPaccount::SMTPaccount() |
266 | : Account() | 274 | : Account() |
267 | { | 275 | { |
268 | file = SMTPaccount::getUniqueFileName(); | 276 | file = SMTPaccount::getUniqueFileName(); |
269 | accountName = "New SMTP Account"; | 277 | accountName = "New SMTP Account"; |
270 | ssl = false; | 278 | ssl = false; |
271 | login = false; | 279 | login = false; |
272 | useCC = false; | 280 | useCC = false; |
273 | useBCC = false; | 281 | useBCC = false; |
274 | useReply = false; | 282 | useReply = false; |
275 | type = "SMTP"; | 283 | type = "SMTP"; |
276 | port = SMTP_PORT; | 284 | port = SMTP_PORT; |
277 | } | 285 | } |
278 | 286 | ||
279 | SMTPaccount::SMTPaccount( QString filename ) | 287 | SMTPaccount::SMTPaccount( QString filename ) |
280 | : Account() | 288 | : Account() |
@@ -292,65 +300,67 @@ QString SMTPaccount::getUniqueFileName() | |||
292 | int num = 0; | 300 | int num = 0; |
293 | QString unique; | 301 | QString unique; |
294 | 302 | ||
295 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 303 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
296 | 304 | ||
297 | QStringList imap = dir.entryList( "smtp-*" ); | 305 | QStringList imap = dir.entryList( "smtp-*" ); |
298 | do { | 306 | do { |
299 | unique.setNum( num++ ); | 307 | unique.setNum( num++ ); |
300 | } while ( imap.contains( "smtp-" + unique ) > 0 ); | 308 | } while ( imap.contains( "smtp-" + unique ) > 0 ); |
301 | 309 | ||
302 | return unique; | 310 | return unique; |
303 | } | 311 | } |
304 | 312 | ||
305 | void SMTPaccount::read() | 313 | void SMTPaccount::read() |
306 | { | 314 | { |
307 | Config *conf = new Config( getFileName(), Config::File ); | 315 | Config *conf = new Config( getFileName(), Config::File ); |
308 | conf->setGroup( "SMTP Account" ); | 316 | conf->setGroup( "SMTP Account" ); |
309 | accountName = conf->readEntry( "Account" ); | 317 | accountName = conf->readEntry( "Account" ); |
310 | server = conf->readEntry( "Server" ); | 318 | server = conf->readEntry( "Server" ); |
311 | port = conf->readEntry( "Port" ); | 319 | port = conf->readEntry( "Port" ); |
312 | ssl = conf->readBoolEntry( "SSL" ); | 320 | ssl = conf->readBoolEntry( "SSL" ); |
313 | login = conf->readBoolEntry( "Login" ); | 321 | login = conf->readBoolEntry( "Login" ); |
314 | user = conf->readEntry( "User" ); | 322 | user = conf->readEntry( "User" ); |
315 | password = conf->readEntryCrypt( "Password" ); | 323 | password = conf->readEntryCrypt( "Password" ); |
324 | delete conf; | ||
316 | } | 325 | } |
317 | 326 | ||
318 | void SMTPaccount::save() | 327 | void SMTPaccount::save() |
319 | { | 328 | { |
320 | qDebug( "saving " + getFileName() ); | 329 | qDebug( "saving " + getFileName() ); |
321 | Settings::checkDirectory(); | 330 | Settings::checkDirectory(); |
322 | 331 | ||
323 | Config *conf = new Config( getFileName(), Config::File ); | 332 | Config *conf = new Config( getFileName(), Config::File ); |
324 | conf->setGroup( "SMTP Account" ); | 333 | conf->setGroup( "SMTP Account" ); |
325 | conf->writeEntry( "Account", accountName ); | 334 | conf->writeEntry( "Account", accountName ); |
326 | conf->writeEntry( "Server", server ); | 335 | conf->writeEntry( "Server", server ); |
327 | conf->writeEntry( "Port", port ); | 336 | conf->writeEntry( "Port", port ); |
328 | conf->writeEntry( "SSL", ssl ); | 337 | conf->writeEntry( "SSL", ssl ); |
329 | conf->writeEntry( "Login", login ); | 338 | conf->writeEntry( "Login", login ); |
330 | conf->writeEntry( "User", user ); | 339 | conf->writeEntry( "User", user ); |
331 | conf->writeEntryCrypt( "Password", password ); | 340 | conf->writeEntryCrypt( "Password", password ); |
332 | conf->write(); | 341 | conf->write(); |
342 | delete conf; | ||
333 | } | 343 | } |
334 | 344 | ||
335 | 345 | ||
336 | QString SMTPaccount::getFileName() | 346 | QString SMTPaccount::getFileName() |
337 | { | 347 | { |
338 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; | 348 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; |
339 | } | 349 | } |
340 | 350 | ||
341 | NNTPaccount::NNTPaccount() | 351 | NNTPaccount::NNTPaccount() |
342 | : Account() | 352 | : Account() |
343 | { | 353 | { |
344 | file = NNTPaccount::getUniqueFileName(); | 354 | file = NNTPaccount::getUniqueFileName(); |
345 | accountName = "New NNTP Account"; | 355 | accountName = "New NNTP Account"; |
346 | ssl = false; | 356 | ssl = false; |
347 | login = false; | 357 | login = false; |
348 | type = "NNTP"; | 358 | type = "NNTP"; |
349 | port = NNTP_PORT; | 359 | port = NNTP_PORT; |
350 | } | 360 | } |
351 | 361 | ||
352 | NNTPaccount::NNTPaccount( QString filename ) | 362 | NNTPaccount::NNTPaccount( QString filename ) |
353 | : Account() | 363 | : Account() |
354 | { | 364 | { |
355 | file = filename; | 365 | file = filename; |
356 | accountName = "New NNTP Account"; | 366 | accountName = "New NNTP Account"; |
@@ -365,49 +375,51 @@ QString NNTPaccount::getUniqueFileName() | |||
365 | int num = 0; | 375 | int num = 0; |
366 | QString unique; | 376 | QString unique; |
367 | 377 | ||
368 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 378 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
369 | 379 | ||
370 | QStringList imap = dir.entryList( "nntp-*" ); | 380 | QStringList imap = dir.entryList( "nntp-*" ); |
371 | do { | 381 | do { |
372 | unique.setNum( num++ ); | 382 | unique.setNum( num++ ); |
373 | } while ( imap.contains( "nntp-" + unique ) > 0 ); | 383 | } while ( imap.contains( "nntp-" + unique ) > 0 ); |
374 | 384 | ||
375 | return unique; | 385 | return unique; |
376 | } | 386 | } |
377 | 387 | ||
378 | void NNTPaccount::read() | 388 | void NNTPaccount::read() |
379 | { | 389 | { |
380 | Config *conf = new Config( getFileName(), Config::File ); | 390 | Config *conf = new Config( getFileName(), Config::File ); |
381 | conf->setGroup( "NNTP Account" ); | 391 | conf->setGroup( "NNTP Account" ); |
382 | accountName = conf->readEntry( "Account" ); | 392 | accountName = conf->readEntry( "Account" ); |
383 | server = conf->readEntry( "Server" ); | 393 | server = conf->readEntry( "Server" ); |
384 | port = conf->readEntry( "Port" ); | 394 | port = conf->readEntry( "Port" ); |
385 | ssl = conf->readBoolEntry( "SSL" ); | 395 | ssl = conf->readBoolEntry( "SSL" ); |
386 | login = conf->readBoolEntry( "Login" ); | 396 | login = conf->readBoolEntry( "Login" ); |
387 | user = conf->readEntry( "User" ); | 397 | user = conf->readEntry( "User" ); |
388 | password = conf->readEntryCrypt( "Password" ); | 398 | password = conf->readEntryCrypt( "Password" ); |
399 | delete conf; | ||
389 | } | 400 | } |
390 | 401 | ||
391 | void NNTPaccount::save() | 402 | void NNTPaccount::save() |
392 | { | 403 | { |
393 | qDebug( "saving " + getFileName() ); | 404 | qDebug( "saving " + getFileName() ); |
394 | Settings::checkDirectory(); | 405 | Settings::checkDirectory(); |
395 | 406 | ||
396 | Config *conf = new Config( getFileName(), Config::File ); | 407 | Config *conf = new Config( getFileName(), Config::File ); |
397 | conf->setGroup( "NNTP Account" ); | 408 | conf->setGroup( "NNTP Account" ); |
398 | conf->writeEntry( "Account", accountName ); | 409 | conf->writeEntry( "Account", accountName ); |
399 | conf->writeEntry( "Server", server ); | 410 | conf->writeEntry( "Server", server ); |
400 | conf->writeEntry( "Port", port ); | 411 | conf->writeEntry( "Port", port ); |
401 | conf->writeEntry( "SSL", ssl ); | 412 | conf->writeEntry( "SSL", ssl ); |
402 | conf->writeEntry( "Login", login ); | 413 | conf->writeEntry( "Login", login ); |
403 | conf->writeEntry( "User", user ); | 414 | conf->writeEntry( "User", user ); |
404 | conf->writeEntryCrypt( "Password", password ); | 415 | conf->writeEntryCrypt( "Password", password ); |
405 | conf->write(); | 416 | conf->write(); |
417 | delete conf; | ||
406 | } | 418 | } |
407 | 419 | ||
408 | 420 | ||
409 | QString NNTPaccount::getFileName() | 421 | QString NNTPaccount::getFileName() |
410 | { | 422 | { |
411 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; | 423 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; |
412 | } | 424 | } |
413 | 425 | ||
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h index caa5dfc..2104997 100644 --- a/noncore/net/mail/libmailwrapper/settings.h +++ b/noncore/net/mail/libmailwrapper/settings.h | |||
@@ -9,57 +9,60 @@ class Account | |||
9 | 9 | ||
10 | public: | 10 | public: |
11 | Account(); | 11 | Account(); |
12 | virtual ~Account() {} | 12 | virtual ~Account() {} |
13 | 13 | ||
14 | void remove(); | 14 | void remove(); |
15 | void setAccountName( QString name ) { accountName = name; } | 15 | void setAccountName( QString name ) { accountName = name; } |
16 | const QString&getAccountName()const{ return accountName; } | 16 | const QString&getAccountName()const{ return accountName; } |
17 | const QString&getType()const{ return type; } | 17 | const QString&getType()const{ return type; } |
18 | 18 | ||
19 | void setServer(const QString&str){ server = str; } | 19 | void setServer(const QString&str){ server = str; } |
20 | const QString&getServer()const{ return server; } | 20 | const QString&getServer()const{ return server; } |
21 | 21 | ||
22 | void setPort(const QString&str) { port = str; } | 22 | void setPort(const QString&str) { port = str; } |
23 | const QString&getPort()const{ return port; } | 23 | const QString&getPort()const{ return port; } |
24 | 24 | ||
25 | void setUser(const QString&str){ user = str; } | 25 | void setUser(const QString&str){ user = str; } |
26 | const QString&getUser()const{ return user; } | 26 | const QString&getUser()const{ return user; } |
27 | 27 | ||
28 | void setPassword(const QString&str) { password = str; } | 28 | void setPassword(const QString&str) { password = str; } |
29 | const QString&getPassword()const { return password; } | 29 | const QString&getPassword()const { return password; } |
30 | 30 | ||
31 | void setSSL( bool b ) { ssl = b; } | 31 | void setSSL( bool b ) { ssl = b; } |
32 | bool getSSL() { return ssl; } | 32 | bool getSSL() { return ssl; } |
33 | |||
34 | void setOffline(bool b) {offline = b;} | ||
35 | bool getOffline()const{return offline;} | ||
33 | 36 | ||
34 | virtual QString getFileName() { return accountName; } | 37 | virtual QString getFileName() { return accountName; } |
35 | virtual void read() { qDebug( "base reading..." ); } | 38 | virtual void read() { qDebug( "base reading..." ); } |
36 | virtual void save() { qDebug( "base saving..." ); } | 39 | virtual void save() { qDebug( "base saving..." ); } |
37 | 40 | ||
38 | protected: | 41 | protected: |
39 | QString accountName, type, server, port, user, password; | 42 | QString accountName, type, server, port, user, password; |
40 | bool ssl; | 43 | bool ssl; |
41 | 44 | bool offline; | |
42 | }; | 45 | }; |
43 | 46 | ||
44 | class IMAPaccount : public Account | 47 | class IMAPaccount : public Account |
45 | { | 48 | { |
46 | 49 | ||
47 | public: | 50 | public: |
48 | IMAPaccount(); | 51 | IMAPaccount(); |
49 | IMAPaccount( QString filename ); | 52 | IMAPaccount( QString filename ); |
50 | 53 | ||
51 | static QString getUniqueFileName(); | 54 | static QString getUniqueFileName(); |
52 | 55 | ||
53 | virtual void read(); | 56 | virtual void read(); |
54 | virtual void save(); | 57 | virtual void save(); |
55 | virtual QString getFileName(); | 58 | virtual QString getFileName(); |
56 | 59 | ||
57 | void setPrefix(const QString&str) {prefix=str;} | 60 | void setPrefix(const QString&str) {prefix=str;} |
58 | const QString&getPrefix()const{return prefix;} | 61 | const QString&getPrefix()const{return prefix;} |
59 | 62 | ||
60 | private: | 63 | private: |
61 | QString file,prefix; | 64 | QString file,prefix; |
62 | 65 | ||
63 | }; | 66 | }; |
64 | 67 | ||
65 | class POP3account : public Account | 68 | class POP3account : public Account |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 4764b77..281b88e 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -468,80 +468,78 @@ char *SMTPwrapper::getFrom( mailimf_field *ffrom) | |||
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(const 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 | AbstractMail*wrap = AbstractMail::getWrapper(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; | ||
520 | tmp.replace(QRegExp("\r+",true,false),""); | ||
521 | msg = 0; | 519 | msg = 0; |
522 | if (later) { | 520 | if (later) { |
523 | storeMail((char*)tmp.data(),tmp.length(),"Outgoing"); | 521 | storeMail(data,size,"Outgoing"); |
524 | if (data) free( data ); | 522 | if (data) free( data ); |
525 | Config cfg( "mail" ); | 523 | Config cfg( "mail" ); |
526 | cfg.setGroup( "Status" ); | 524 | cfg.setGroup( "Status" ); |
527 | cfg.writeEntry( "outgoing", ++m_queuedMail ); | 525 | cfg.writeEntry( "outgoing", ++m_queuedMail ); |
528 | emit queuedMails( m_queuedMail ); | 526 | emit queuedMails( m_queuedMail ); |
529 | return; | 527 | return; |
530 | } | 528 | } |
531 | from = getFrom( mail ); | 529 | from = getFrom( mail ); |
532 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); | 530 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); |
533 | smtpSend(from,rcpts,data,size,smtp); | 531 | smtpSend(from,rcpts,data,size,smtp); |
534 | if (data) {free(data);} | 532 | if (data) {free(data);} |
535 | if (from) {free(from);} | 533 | if (from) {free(from);} |
536 | if (rcpts) smtp_address_list_free( rcpts ); | 534 | if (rcpts) smtp_address_list_free( rcpts ); |
537 | } | 535 | } |
538 | 536 | ||
539 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) | 537 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) |
540 | { | 538 | { |
541 | const char *server, *user, *pass; | 539 | const char *server, *user, *pass; |
542 | bool ssl; | 540 | bool ssl; |
543 | uint16_t port; | 541 | uint16_t port; |
544 | mailsmtp *session; | 542 | mailsmtp *session; |
545 | int err,result; | 543 | int err,result; |
546 | 544 | ||
547 | result = 1; | 545 | result = 1; |
@@ -615,98 +613,98 @@ void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) | |||
615 | mailmime * mimeMail; | 613 | mailmime * mimeMail; |
616 | 614 | ||
617 | SMTPaccount *smtp = aSmtp; | 615 | SMTPaccount *smtp = aSmtp; |
618 | 616 | ||
619 | if (!later && !smtp) { | 617 | if (!later && !smtp) { |
620 | qDebug("Didn't get any send method - giving up"); | 618 | qDebug("Didn't get any send method - giving up"); |
621 | return; | 619 | return; |
622 | } | 620 | } |
623 | mimeMail = createMimeMail(mail ); | 621 | mimeMail = createMimeMail(mail ); |
624 | if ( mimeMail == NULL ) { | 622 | if ( mimeMail == NULL ) { |
625 | qDebug( "sendMail: error creating mime mail" ); | 623 | qDebug( "sendMail: error creating mime mail" ); |
626 | } else { | 624 | } else { |
627 | sendProgress = new progressMailSend(); | 625 | sendProgress = new progressMailSend(); |
628 | sendProgress->show(); | 626 | sendProgress->show(); |
629 | sendProgress->setMaxMails(1); | 627 | sendProgress->setMaxMails(1); |
630 | smtpSend( mimeMail,later,smtp); | 628 | smtpSend( mimeMail,later,smtp); |
631 | qDebug("Clean up done"); | 629 | qDebug("Clean up done"); |
632 | sendProgress->hide(); | 630 | sendProgress->hide(); |
633 | delete sendProgress; | 631 | delete sendProgress; |
634 | sendProgress = 0; | 632 | sendProgress = 0; |
635 | mailmime_free( mimeMail ); | 633 | mailmime_free( mimeMail ); |
636 | } | 634 | } |
637 | } | 635 | } |
638 | 636 | ||
639 | int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | 637 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which) |
640 | { | 638 | { |
641 | size_t curTok = 0; | 639 | size_t curTok = 0; |
642 | mailimf_fields *fields = 0; | 640 | mailimf_fields *fields = 0; |
643 | mailimf_field*ffrom = 0; | 641 | mailimf_field*ffrom = 0; |
644 | clist *rcpts = 0; | 642 | clist *rcpts = 0; |
645 | char*from = 0; | 643 | char*from = 0; |
646 | int res = 0; | 644 | int res = 0; |
647 | 645 | ||
648 | encodedString * data = wrap->fetchRawBody(*which); | 646 | encodedString * data = wrap->fetchRawBody(*which); |
649 | if (!data) return 0; | 647 | if (!data) return 0; |
650 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); | 648 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); |
651 | if (err != MAILIMF_NO_ERROR) { | 649 | if (err != MAILIMF_NO_ERROR) { |
652 | delete data; | 650 | delete data; |
653 | delete wrap; | 651 | delete wrap; |
654 | return 0; | 652 | return 0; |
655 | } | 653 | } |
656 | 654 | ||
657 | rcpts = createRcptList( fields ); | 655 | rcpts = createRcptList( fields ); |
658 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); | 656 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); |
659 | from = getFrom(ffrom); | 657 | from = getFrom(ffrom); |
660 | 658 | ||
661 | if (rcpts && from) { | 659 | if (rcpts && from) { |
662 | res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp ); | 660 | res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp ); |
663 | } | 661 | } |
664 | if (fields) { | 662 | if (fields) { |
665 | mailimf_fields_free(fields); | 663 | mailimf_fields_free(fields); |
666 | fields = 0; | 664 | fields = 0; |
667 | } | 665 | } |
668 | if (data) { | 666 | if (data) { |
669 | delete data; | 667 | delete data; |
670 | } | 668 | } |
671 | if (from) { | 669 | if (from) { |
672 | free(from); | 670 | free(from); |
673 | } | 671 | } |
674 | if (rcpts) { | 672 | if (rcpts) { |
675 | smtp_address_list_free( rcpts ); | 673 | smtp_address_list_free( rcpts ); |
676 | } | 674 | } |
677 | return res; | 675 | return res; |
678 | } | 676 | } |
679 | 677 | ||
680 | /* this is a special fun */ | 678 | /* this is a special fun */ |
681 | bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | 679 | bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) |
682 | { | 680 | { |
683 | bool returnValue = true; | 681 | bool returnValue = true; |
684 | 682 | ||
685 | if (!smtp) return false; | 683 | if (!smtp) return false; |
686 | 684 | ||
687 | QString localfolders = AbstractMail::defaultLocalfolder(); | 685 | QString localfolders = AbstractMail::defaultLocalfolder(); |
688 | MBOXwrapper*wrap = new MBOXwrapper(localfolders); | 686 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
689 | if (!wrap) { | 687 | if (!wrap) { |
690 | qDebug("memory error"); | 688 | qDebug("memory error"); |
691 | return false; | 689 | return false; |
692 | } | 690 | } |
693 | QList<RecMail> mailsToSend; | 691 | QList<RecMail> mailsToSend; |
694 | QList<RecMail> mailsToRemove; | 692 | QList<RecMail> mailsToRemove; |
695 | QString mbox("Outgoing"); | 693 | QString mbox("Outgoing"); |
696 | wrap->listMessages(mbox,mailsToSend); | 694 | wrap->listMessages(mbox,mailsToSend); |
697 | if (mailsToSend.count()==0) { | 695 | if (mailsToSend.count()==0) { |
698 | delete wrap; | 696 | delete wrap; |
699 | return false; | 697 | return false; |
700 | } | 698 | } |
701 | mailsToSend.setAutoDelete(false); | 699 | mailsToSend.setAutoDelete(false); |
702 | sendProgress = new progressMailSend(); | 700 | sendProgress = new progressMailSend(); |
703 | sendProgress->show(); | 701 | sendProgress->show(); |
704 | sendProgress->setMaxMails(mailsToSend.count()); | 702 | sendProgress->setMaxMails(mailsToSend.count()); |
705 | 703 | ||
706 | while (mailsToSend.count()>0) { | 704 | while (mailsToSend.count()>0) { |
707 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { | 705 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { |
708 | QMessageBox::critical(0,tr("Error sending mail"), | 706 | QMessageBox::critical(0,tr("Error sending mail"), |
709 | tr("Error sending queued mail - breaking")); | 707 | tr("Error sending queued mail - breaking")); |
710 | returnValue = false; | 708 | returnValue = false; |
711 | break; | 709 | break; |
712 | } | 710 | } |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index 04fc4b0..7dcdbfd 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 AbstractMail; |
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(const 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,const 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(AbstractMail*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/selectstore.cpp b/noncore/net/mail/selectstore.cpp index 28ab5a8..0a07d51 100644 --- a/noncore/net/mail/selectstore.cpp +++ b/noncore/net/mail/selectstore.cpp | |||
@@ -1,19 +1,70 @@ | |||
1 | #include "selectstore.h" | 1 | #include "selectstore.h" |
2 | #include <qlineedit.h> | ||
3 | #include <qcheckbox.h> | ||
4 | #include <qcombobox.h> | ||
5 | #include <libmailwrapper/abstractmail.h> | ||
2 | 6 | ||
3 | Selectstore::Selectstore(QWidget* parent, const char* name) | 7 | Selectstore::Selectstore(QWidget* parent, const char* name) |
4 | :selectstoreui(parent,name,true) | 8 | :selectstoreui(parent,name,true) |
5 | { | 9 | { |
6 | 10 | folderMap.clear(); | |
11 | mailMap.clear(); | ||
12 | cMail = 0; | ||
7 | } | 13 | } |
8 | 14 | ||
9 | Selectstore::~Selectstore() | 15 | Selectstore::~Selectstore() |
10 | { | 16 | { |
11 | } | 17 | } |
12 | 18 | ||
13 | void Selectstore::slotCreateNewFolder() | 19 | void Selectstore::slotCreateNewFolder() |
14 | { | 20 | { |
21 | bool how = newFoldersel->isChecked(); | ||
22 | folderSelection->setEnabled(!how); | ||
23 | newFolderedit->setEnabled(how); | ||
15 | } | 24 | } |
16 | 25 | ||
17 | void Selectstore::slotMoveMail() | 26 | void Selectstore::slotMoveMail() |
18 | { | 27 | { |
19 | } | 28 | } |
29 | |||
30 | void Selectstore::addAccounts(AbstractMail*mail,const QStringList&folders) | ||
31 | { | ||
32 | accountSelection->insertItem(mail->getName()); | ||
33 | mailMap[accountSelection->count()-1]=mail; | ||
34 | folderMap[accountSelection->count()-1]=folders; | ||
35 | if (accountSelection->count()==1) { | ||
36 | cMail = mail; | ||
37 | folderSelection->insertStringList(folders); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | void Selectstore::slotAccountselected(int i) | ||
42 | { | ||
43 | folderSelection->clear(); | ||
44 | folderSelection->insertStringList(folderMap[i]); | ||
45 | cMail = mailMap[i]; | ||
46 | } | ||
47 | |||
48 | QString Selectstore::currentFolder() | ||
49 | { | ||
50 | if (newFoldersel->isChecked()) { | ||
51 | return newFolderedit->text(); | ||
52 | } else { | ||
53 | return folderSelection->currentText(); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | AbstractMail*Selectstore::currentMail() | ||
58 | { | ||
59 | return cMail; | ||
60 | } | ||
61 | |||
62 | bool Selectstore::newFolder() | ||
63 | { | ||
64 | return newFoldersel->isChecked(); | ||
65 | } | ||
66 | |||
67 | bool Selectstore::moveMails() | ||
68 | { | ||
69 | return selMove->isChecked(); | ||
70 | } | ||
diff --git a/noncore/net/mail/selectstore.h b/noncore/net/mail/selectstore.h index 8b8e8ee..447a6ae 100644 --- a/noncore/net/mail/selectstore.h +++ b/noncore/net/mail/selectstore.h | |||
@@ -1,19 +1,33 @@ | |||
1 | #ifndef _SELECTSTORE_H | 1 | #ifndef _SELECTSTORE_H |
2 | #define _SELECTSTORE_H | 2 | #define _SELECTSTORE_H |
3 | 3 | ||
4 | #include "selectstoreui.h" | 4 | #include "selectstoreui.h" |
5 | #include <qvaluelist.h> | ||
6 | #include <qmap.h> | ||
7 | #include <qstringlist.h> | ||
8 | |||
9 | class AbstractMail; | ||
5 | 10 | ||
6 | class Selectstore:public selectstoreui | 11 | class Selectstore:public selectstoreui |
7 | { | 12 | { |
8 | Q_OBJECT | 13 | Q_OBJECT |
9 | public: | 14 | public: |
10 | Selectstore(QWidget* parent = 0, const char* name = 0); | 15 | Selectstore(QWidget* parent = 0, const char* name = 0); |
11 | virtual ~Selectstore(); | 16 | virtual ~Selectstore(); |
17 | virtual void addAccounts(AbstractMail*mail,const QStringList&folders); | ||
18 | virtual QString currentFolder(); | ||
19 | virtual AbstractMail*currentMail(); | ||
20 | bool newFolder(); | ||
21 | bool moveMails(); | ||
12 | 22 | ||
13 | protected: | 23 | protected slots: |
14 | virtual void slotCreateNewFolder(); | 24 | virtual void slotCreateNewFolder(); |
15 | virtual void slotMoveMail(); | 25 | virtual void slotMoveMail(); |
16 | protected slots: | 26 | virtual void slotAccountselected(int); |
17 | 27 | ||
28 | protected: | ||
29 | QMap<int,QStringList> folderMap; | ||
30 | QMap<int,AbstractMail*> mailMap; | ||
31 | AbstractMail*cMail; | ||
18 | }; | 32 | }; |
19 | #endif | 33 | #endif |
diff --git a/noncore/net/mail/selectstoreui.ui b/noncore/net/mail/selectstoreui.ui index 3741b71..5f0e507 100644 --- a/noncore/net/mail/selectstoreui.ui +++ b/noncore/net/mail/selectstoreui.ui | |||
@@ -1,59 +1,59 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>selectstoreui</class> | 2 | <class>selectstoreui</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>selectstoreui</cstring> | 7 | <cstring>selectstoreui</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>190</width> | 14 | <width>182</width> |
15 | <height>273</height> | 15 | <height>273</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Select target box</string> | 20 | <string>Select target box</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>1</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>1</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QLabel</class> | 38 | <class>QLabel</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>headlabel</cstring> | 41 | <cstring>headlabel</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>text</name> | 44 | <name>text</name> |
45 | <string><b>Store mail(s) to</b></string> | 45 | <string><b>Store mail(s) to</b></string> |
46 | </property> | 46 | </property> |
47 | <property stdset="1"> | 47 | <property stdset="1"> |
48 | <name>alignment</name> | 48 | <name>alignment</name> |
49 | <set>AlignCenter</set> | 49 | <set>AlignCenter</set> |
50 | </property> | 50 | </property> |
51 | <property> | 51 | <property> |
52 | <name>hAlign</name> | 52 | <name>hAlign</name> |
53 | </property> | 53 | </property> |
54 | </widget> | 54 | </widget> |
55 | <widget> | 55 | <widget> |
56 | <class>QLayoutWidget</class> | 56 | <class>QLayoutWidget</class> |
57 | <property stdset="1"> | 57 | <property stdset="1"> |
58 | <name>name</name> | 58 | <name>name</name> |
59 | <cstring>Layout2</cstring> | 59 | <cstring>Layout2</cstring> |
@@ -153,48 +153,69 @@ | |||
153 | </widget> | 153 | </widget> |
154 | <widget> | 154 | <widget> |
155 | <class>QCheckBox</class> | 155 | <class>QCheckBox</class> |
156 | <property stdset="1"> | 156 | <property stdset="1"> |
157 | <name>name</name> | 157 | <name>name</name> |
158 | <cstring>newFoldersel</cstring> | 158 | <cstring>newFoldersel</cstring> |
159 | </property> | 159 | </property> |
160 | <property stdset="1"> | 160 | <property stdset="1"> |
161 | <name>text</name> | 161 | <name>text</name> |
162 | <string>Create new folder</string> | 162 | <string>Create new folder</string> |
163 | </property> | 163 | </property> |
164 | </widget> | 164 | </widget> |
165 | <widget> | 165 | <widget> |
166 | <class>QLineEdit</class> | 166 | <class>QLineEdit</class> |
167 | <property stdset="1"> | 167 | <property stdset="1"> |
168 | <name>name</name> | 168 | <name>name</name> |
169 | <cstring>newFolderedit</cstring> | 169 | <cstring>newFolderedit</cstring> |
170 | </property> | 170 | </property> |
171 | <property stdset="1"> | 171 | <property stdset="1"> |
172 | <name>enabled</name> | 172 | <name>enabled</name> |
173 | <bool>false</bool> | 173 | <bool>false</bool> |
174 | </property> | 174 | </property> |
175 | </widget> | 175 | </widget> |
176 | <widget> | 176 | <widget> |
177 | <class>QLabel</class> | ||
178 | <property stdset="1"> | ||
179 | <name>name</name> | ||
180 | <cstring>newFolderLabel</cstring> | ||
181 | </property> | ||
182 | <property stdset="1"> | ||
183 | <name>text</name> | ||
184 | <string>Prefix will prepend, no need to enter it!</string> | ||
185 | </property> | ||
186 | <property stdset="1"> | ||
187 | <name>alignment</name> | ||
188 | <set>WordBreak|AlignCenter</set> | ||
189 | </property> | ||
190 | <property> | ||
191 | <name>hAlign</name> | ||
192 | </property> | ||
193 | <property> | ||
194 | <name>wordwrap</name> | ||
195 | </property> | ||
196 | </widget> | ||
197 | <widget> | ||
177 | <class>Line</class> | 198 | <class>Line</class> |
178 | <property stdset="1"> | 199 | <property stdset="1"> |
179 | <name>name</name> | 200 | <name>name</name> |
180 | <cstring>Line2</cstring> | 201 | <cstring>Line2</cstring> |
181 | </property> | 202 | </property> |
182 | <property stdset="1"> | 203 | <property stdset="1"> |
183 | <name>orientation</name> | 204 | <name>orientation</name> |
184 | <enum>Horizontal</enum> | 205 | <enum>Horizontal</enum> |
185 | </property> | 206 | </property> |
186 | </widget> | 207 | </widget> |
187 | <widget> | 208 | <widget> |
188 | <class>QCheckBox</class> | 209 | <class>QCheckBox</class> |
189 | <property stdset="1"> | 210 | <property stdset="1"> |
190 | <name>name</name> | 211 | <name>name</name> |
191 | <cstring>selMove</cstring> | 212 | <cstring>selMove</cstring> |
192 | </property> | 213 | </property> |
193 | <property stdset="1"> | 214 | <property stdset="1"> |
194 | <name>text</name> | 215 | <name>text</name> |
195 | <string>Move mail(s)</string> | 216 | <string>Move mail(s)</string> |
196 | </property> | 217 | </property> |
197 | </widget> | 218 | </widget> |
198 | <spacer> | 219 | <spacer> |
199 | <property> | 220 | <property> |
200 | <name>name</name> | 221 | <name>name</name> |
@@ -210,35 +231,49 @@ | |||
210 | </property> | 231 | </property> |
211 | <property> | 232 | <property> |
212 | <name>sizeHint</name> | 233 | <name>sizeHint</name> |
213 | <size> | 234 | <size> |
214 | <width>20</width> | 235 | <width>20</width> |
215 | <height>20</height> | 236 | <height>20</height> |
216 | </size> | 237 | </size> |
217 | </property> | 238 | </property> |
218 | </spacer> | 239 | </spacer> |
219 | </vbox> | 240 | </vbox> |
220 | </widget> | 241 | </widget> |
221 | <connections> | 242 | <connections> |
222 | <connection> | 243 | <connection> |
223 | <sender>selMove</sender> | 244 | <sender>selMove</sender> |
224 | <signal>clicked()</signal> | 245 | <signal>clicked()</signal> |
225 | <receiver>selectstoreui</receiver> | 246 | <receiver>selectstoreui</receiver> |
226 | <slot>slotMoveMail()</slot> | 247 | <slot>slotMoveMail()</slot> |
227 | </connection> | 248 | </connection> |
228 | <connection> | 249 | <connection> |
229 | <sender>newFoldersel</sender> | 250 | <sender>newFoldersel</sender> |
230 | <signal>clicked()</signal> | 251 | <signal>clicked()</signal> |
231 | <receiver>selectstoreui</receiver> | 252 | <receiver>selectstoreui</receiver> |
232 | <slot>slotCreateNewFolder()</slot> | 253 | <slot>slotCreateNewFolder()</slot> |
233 | </connection> | 254 | </connection> |
234 | <slot access="protected">slotMoveMail()</slot> | 255 | <connection> |
256 | <sender>accountSelection</sender> | ||
257 | <signal>activated(int)</signal> | ||
258 | <receiver>selectstoreui</receiver> | ||
259 | <slot>slotAccountselected(int)</slot> | ||
260 | </connection> | ||
261 | <connection> | ||
262 | <sender>folderSelection</sender> | ||
263 | <signal>activated(int)</signal> | ||
264 | <receiver>selectstoreui</receiver> | ||
265 | <slot>slotFolderSelected(int)</slot> | ||
266 | </connection> | ||
267 | <slot access="protected">slotFolderSelected(int)</slot> | ||
268 | <slot access="protected">slotAccountselected(int)</slot> | ||
235 | <slot access="protected">slotCreateNewFolder()</slot> | 269 | <slot access="protected">slotCreateNewFolder()</slot> |
270 | <slot access="protected">slotMoveMail()</slot> | ||
236 | </connections> | 271 | </connections> |
237 | <tabstops> | 272 | <tabstops> |
238 | <tabstop>accountSelection</tabstop> | 273 | <tabstop>accountSelection</tabstop> |
239 | <tabstop>folderSelection</tabstop> | 274 | <tabstop>folderSelection</tabstop> |
240 | <tabstop>newFoldersel</tabstop> | 275 | <tabstop>newFoldersel</tabstop> |
241 | <tabstop>newFolderedit</tabstop> | 276 | <tabstop>newFolderedit</tabstop> |
242 | <tabstop>selMove</tabstop> | 277 | <tabstop>selMove</tabstop> |
243 | </tabstops> | 278 | </tabstops> |
244 | </UI> | 279 | </UI> |