63 files changed, 612 insertions, 512 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 985a762..9b1ea2f 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -1,220 +1,222 @@ | |||
1 | 1 | ||
2 | #include "accountitem.h" | 2 | #include "accountitem.h" |
3 | #include "accountview.h" | 3 | #include "accountview.h" |
4 | #include "newmaildir.h" | 4 | #include "newmaildir.h" |
5 | #include "nntpgroupsdlg.h" | 5 | #include "nntpgroupsdlg.h" |
6 | #include "defines.h" | 6 | #include "defines.h" |
7 | 7 | ||
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | #include <libmailwrapper/abstractmail.h> | 9 | #include <libmailwrapper/abstractmail.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 10 | #include <libmailwrapper/mailwrapper.h> |
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | //#include <qpe/qpeapplication.h> | 12 | //#include <qpe/qpeapplication.h> |
13 | 13 | ||
14 | /* QT */ | 14 | /* QT */ |
15 | #include <qpopupmenu.h> | 15 | #include <q3popupmenu.h> |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | //Added by qt3to4: | ||
18 | #include <Q3ValueList> | ||
17 | #include <kiconloader.h> | 19 | #include <kiconloader.h> |
18 | #include <klocale.h> | 20 | #include <klocale.h> |
19 | 21 | ||
20 | #define GET_NEW_MAILS 101 | 22 | #define GET_NEW_MAILS 101 |
21 | 23 | ||
22 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
23 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} | 25 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} |
24 | /** | 26 | /** |
25 | * POP3 Account stuff | 27 | * POP3 Account stuff |
26 | */ | 28 | */ |
27 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | 29 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) |
28 | : AccountViewItem( parent ) | 30 | : AccountViewItem( parent ) |
29 | { | 31 | { |
30 | account = a; | 32 | account = a; |
31 | wrapper = AbstractMail::getWrapper( account ); | 33 | wrapper = AbstractMail::getWrapper( account ); |
32 | SETPIX(PIXMAP_POP3FOLDER); | 34 | SETPIX(PIXMAP_POP3FOLDER); |
33 | #if 0 | 35 | #if 0 |
34 | if (!account->getOffline()) | 36 | if (!account->getOffline()) |
35 | { | 37 | { |
36 | setPixmap( 0, ); | 38 | setPixmap( 0, ); |
37 | } | 39 | } |
38 | else | 40 | else |
39 | { | 41 | { |
40 | setPixmap( 0, PIXMAP_OFFLINE ); | 42 | setPixmap( 0, PIXMAP_OFFLINE ); |
41 | } | 43 | } |
42 | #endif | 44 | #endif |
43 | setText( 0, account->getAccountName() ); | 45 | setText( 0, account->getAccountName() ); |
44 | setOpen( true ); | 46 | setOpen( true ); |
45 | } | 47 | } |
46 | 48 | ||
47 | POP3viewItem::~POP3viewItem() | 49 | POP3viewItem::~POP3viewItem() |
48 | { | 50 | { |
49 | delete wrapper; | 51 | delete wrapper; |
50 | } | 52 | } |
51 | 53 | ||
52 | AbstractMail *POP3viewItem::getWrapper() | 54 | AbstractMail *POP3viewItem::getWrapper() |
53 | { | 55 | { |
54 | return wrapper; | 56 | return wrapper; |
55 | } | 57 | } |
56 | 58 | ||
57 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) | 59 | void POP3viewItem::refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> > & ) |
58 | { | 60 | { |
59 | refresh(); | 61 | refresh(); |
60 | } | 62 | } |
61 | 63 | ||
62 | void POP3viewItem::refresh() | 64 | void POP3viewItem::refresh() |
63 | { | 65 | { |
64 | if (account->getOffline()) return; | 66 | if (account->getOffline()) return; |
65 | QValueList<FolderP> *folders = wrapper->listFolders(); | 67 | Q3ValueList<FolderP> *folders = wrapper->listFolders(); |
66 | QListViewItem *child = firstChild(); | 68 | Q3ListViewItem *child = firstChild(); |
67 | while ( child ) | 69 | while ( child ) |
68 | { | 70 | { |
69 | QListViewItem *tmp = child; | 71 | Q3ListViewItem *tmp = child; |
70 | child = child->nextSibling(); | 72 | child = child->nextSibling(); |
71 | delete tmp; | 73 | delete tmp; |
72 | } | 74 | } |
73 | QValueList<FolderP>::ConstIterator it; | 75 | Q3ValueList<FolderP>::ConstIterator it; |
74 | QListViewItem*item = 0; | 76 | Q3ListViewItem*item = 0; |
75 | for ( it = folders->begin(); it!=folders->end(); ++it) | 77 | for ( it = folders->begin(); it!=folders->end(); ++it) |
76 | { | 78 | { |
77 | item = new POP3folderItem( (*it), this , item ); | 79 | item = new POP3folderItem( (*it), this , item ); |
78 | item->setSelectable( (*it)->may_select()); | 80 | item->setSelectable( (*it)->may_select()); |
79 | } | 81 | } |
80 | delete folders; | 82 | delete folders; |
81 | } | 83 | } |
82 | 84 | ||
83 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 85 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
84 | { | 86 | { |
85 | 87 | ||
86 | return wrapper->fetchBody( mail ); | 88 | return wrapper->fetchBody( mail ); |
87 | } | 89 | } |
88 | 90 | ||
89 | QPopupMenu * POP3viewItem::getContextMenu() | 91 | Q3PopupMenu * POP3viewItem::getContextMenu() |
90 | { | 92 | { |
91 | QPopupMenu *m = new QPopupMenu(0); | 93 | Q3PopupMenu *m = new Q3PopupMenu(0); |
92 | if (m) | 94 | if (m) |
93 | { | 95 | { |
94 | if (!account->getOffline()) | 96 | if (!account->getOffline()) |
95 | { | 97 | { |
96 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 98 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
97 | m->insertItem(i18n("Disconnect"),0); | 99 | m->insertItem(i18n("Disconnect"),0); |
98 | m->insertItem(i18n("Set offline"),1); | 100 | m->insertItem(i18n("Set offline"),1); |
99 | } | 101 | } |
100 | else | 102 | else |
101 | { | 103 | { |
102 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 104 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
103 | m->insertItem(i18n("Set online"),1); | 105 | m->insertItem(i18n("Set online"),1); |
104 | } | 106 | } |
105 | } | 107 | } |
106 | return m; | 108 | return m; |
107 | } | 109 | } |
108 | 110 | ||
109 | void POP3viewItem::disconnect() | 111 | void POP3viewItem::disconnect() |
110 | { | 112 | { |
111 | QListViewItem *child = firstChild(); | 113 | Q3ListViewItem *child = firstChild(); |
112 | while ( child ) | 114 | while ( child ) |
113 | { | 115 | { |
114 | QListViewItem *tmp = child; | 116 | Q3ListViewItem *tmp = child; |
115 | child = child->nextSibling(); | 117 | child = child->nextSibling(); |
116 | delete tmp; | 118 | delete tmp; |
117 | } | 119 | } |
118 | wrapper->logout(); | 120 | wrapper->logout(); |
119 | } | 121 | } |
120 | 122 | ||
121 | void POP3viewItem::setOnOffline() | 123 | void POP3viewItem::setOnOffline() |
122 | { | 124 | { |
123 | if (!account->getOffline()) | 125 | if (!account->getOffline()) |
124 | { | 126 | { |
125 | disconnect(); | 127 | disconnect(); |
126 | } | 128 | } |
127 | account->setOffline(!account->getOffline()); | 129 | account->setOffline(!account->getOffline()); |
128 | account->save(); | 130 | account->save(); |
129 | SETPIX(PIXMAP_POP3FOLDER); | 131 | SETPIX(PIXMAP_POP3FOLDER); |
130 | refresh(); | 132 | refresh(); |
131 | } | 133 | } |
132 | 134 | ||
133 | void POP3viewItem::contextMenuSelected(int which) | 135 | void POP3viewItem::contextMenuSelected(int which) |
134 | { | 136 | { |
135 | switch (which) | 137 | switch (which) |
136 | { | 138 | { |
137 | case 0: | 139 | case 0: |
138 | disconnect(); | 140 | disconnect(); |
139 | break; | 141 | break; |
140 | case 1: | 142 | case 1: |
141 | setOnOffline(); | 143 | setOnOffline(); |
142 | break; | 144 | break; |
143 | case GET_NEW_MAILS: // daunlood | 145 | case GET_NEW_MAILS: // daunlood |
144 | if (account->getOffline()) | 146 | if (account->getOffline()) |
145 | setOnOffline(); | 147 | setOnOffline(); |
146 | AccountView*bl = accountView(); | 148 | AccountView*bl = accountView(); |
147 | if (!bl) return; | 149 | if (!bl) return; |
148 | AccountViewItem* in = findSubItem( "inbox" , 0); | 150 | AccountViewItem* in = findSubItem( "inbox" , 0); |
149 | if ( ! in ) | 151 | if ( ! in ) |
150 | return; | 152 | return; |
151 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); | 153 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); |
152 | setOnOffline(); | 154 | setOnOffline(); |
153 | break; | 155 | break; |
154 | } | 156 | } |
155 | } | 157 | } |
156 | 158 | ||
157 | POP3folderItem::~POP3folderItem() | 159 | POP3folderItem::~POP3folderItem() |
158 | {} | 160 | {} |
159 | 161 | ||
160 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) | 162 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , Q3ListViewItem*after ) |
161 | : AccountViewItem(folderInit,parent,after ) | 163 | : AccountViewItem(folderInit,parent,after ) |
162 | { | 164 | { |
163 | pop3 = parent; | 165 | pop3 = parent; |
164 | if (folder->getDisplayName().lower()!="inbox") | 166 | if (folder->getDisplayName().lower()!="inbox") |
165 | { | 167 | { |
166 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 168 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
167 | } | 169 | } |
168 | else | 170 | else |
169 | { | 171 | { |
170 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 172 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
171 | } | 173 | } |
172 | setText( 0, folder->getDisplayName() ); | 174 | setText( 0, folder->getDisplayName() ); |
173 | } | 175 | } |
174 | 176 | ||
175 | void POP3folderItem::refresh(QValueList<RecMailP>&target) | 177 | void POP3folderItem::refresh(Q3ValueList<RecMailP>&target) |
176 | { | 178 | { |
177 | if (folder->may_select()) | 179 | if (folder->may_select()) |
178 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 180 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
179 | } | 181 | } |
180 | 182 | ||
181 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) | 183 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) |
182 | { | 184 | { |
183 | return pop3->getWrapper()->fetchBody(aMail); | 185 | return pop3->getWrapper()->fetchBody(aMail); |
184 | } | 186 | } |
185 | 187 | ||
186 | QPopupMenu * POP3folderItem::getContextMenu() | 188 | Q3PopupMenu * POP3folderItem::getContextMenu() |
187 | { | 189 | { |
188 | QPopupMenu *m = new QPopupMenu(0); | 190 | Q3PopupMenu *m = new Q3PopupMenu(0); |
189 | if (m) | 191 | if (m) |
190 | { | 192 | { |
191 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 193 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
192 | m->insertItem(i18n("Refresh header list"),0); | 194 | m->insertItem(i18n("Refresh header list"),0); |
193 | m->insertItem(i18n("Delete all mails"),1); | 195 | m->insertItem(i18n("Delete all mails"),1); |
194 | m->insertItem(i18n("Move/Copie all mails"),2); | 196 | m->insertItem(i18n("Move/Copie all mails"),2); |
195 | } | 197 | } |
196 | return m; | 198 | return m; |
197 | } | 199 | } |
198 | 200 | ||
199 | void POP3folderItem::downloadMails() | 201 | void POP3folderItem::downloadMails() |
200 | { | 202 | { |
201 | AccountView*bl = pop3->accountView(); | 203 | AccountView*bl = pop3->accountView(); |
202 | if (!bl) return; | 204 | if (!bl) return; |
203 | bl->downloadMails(folder,pop3->getWrapper()); | 205 | bl->downloadMails(folder,pop3->getWrapper()); |
204 | } | 206 | } |
205 | 207 | ||
206 | void POP3folderItem::contextMenuSelected(int which) | 208 | void POP3folderItem::contextMenuSelected(int which) |
207 | { | 209 | { |
208 | AccountView * view = (AccountView*)listView(); | 210 | AccountView * view = (AccountView*)listView(); |
209 | switch (which) | 211 | switch (which) |
210 | { | 212 | { |
211 | case 0: | 213 | case 0: |
212 | /* must be 'cause pop3 lists are cached */ | 214 | /* must be 'cause pop3 lists are cached */ |
213 | pop3->getWrapper()->logout(); | 215 | pop3->getWrapper()->logout(); |
214 | view->refreshCurrent(); | 216 | view->refreshCurrent(); |
215 | break; | 217 | break; |
216 | case 1: | 218 | case 1: |
217 | deleteAllMail(pop3->getWrapper(),folder); | 219 | deleteAllMail(pop3->getWrapper(),folder); |
218 | break; | 220 | break; |
219 | case 2: | 221 | case 2: |
220 | downloadMails(); | 222 | downloadMails(); |
@@ -232,319 +234,319 @@ void POP3folderItem::contextMenuSelected(int which) | |||
232 | */ | 234 | */ |
233 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | 235 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) |
234 | : AccountViewItem( parent ) | 236 | : AccountViewItem( parent ) |
235 | { | 237 | { |
236 | account = a; | 238 | account = a; |
237 | wrapper = AbstractMail::getWrapper( account ); | 239 | wrapper = AbstractMail::getWrapper( account ); |
238 | //FIXME | 240 | //FIXME |
239 | SETPIX(PIXMAP_POP3FOLDER); | 241 | SETPIX(PIXMAP_POP3FOLDER); |
240 | #if 0 | 242 | #if 0 |
241 | if (!account->getOffline()) | 243 | if (!account->getOffline()) |
242 | { | 244 | { |
243 | setPixmap( 0, ); | 245 | setPixmap( 0, ); |
244 | } | 246 | } |
245 | else | 247 | else |
246 | { | 248 | { |
247 | setPixmap( 0, PIXMAP_OFFLINE ); | 249 | setPixmap( 0, PIXMAP_OFFLINE ); |
248 | } | 250 | } |
249 | #endif | 251 | #endif |
250 | setText( 0, account->getAccountName() ); | 252 | setText( 0, account->getAccountName() ); |
251 | setOpen( true ); | 253 | setOpen( true ); |
252 | } | 254 | } |
253 | 255 | ||
254 | NNTPviewItem::~NNTPviewItem() | 256 | NNTPviewItem::~NNTPviewItem() |
255 | { | 257 | { |
256 | delete wrapper; | 258 | delete wrapper; |
257 | } | 259 | } |
258 | 260 | ||
259 | AbstractMail *NNTPviewItem::getWrapper() | 261 | AbstractMail *NNTPviewItem::getWrapper() |
260 | { | 262 | { |
261 | return wrapper; | 263 | return wrapper; |
262 | } | 264 | } |
263 | 265 | ||
264 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) | 266 | void NNTPviewItem::refresh( Q3ValueList<RecMailP> & ) |
265 | { | 267 | { |
266 | refresh(); | 268 | refresh(); |
267 | } | 269 | } |
268 | 270 | ||
269 | void NNTPviewItem::refresh() | 271 | void NNTPviewItem::refresh() |
270 | { | 272 | { |
271 | if (account->getOffline()) return; | 273 | if (account->getOffline()) return; |
272 | QValueList<FolderP> *folders = wrapper->listFolders(); | 274 | Q3ValueList<FolderP> *folders = wrapper->listFolders(); |
273 | 275 | ||
274 | QListViewItem *child = firstChild(); | 276 | Q3ListViewItem *child = firstChild(); |
275 | while ( child ) | 277 | while ( child ) |
276 | { | 278 | { |
277 | QListViewItem *tmp = child; | 279 | Q3ListViewItem *tmp = child; |
278 | child = child->nextSibling(); | 280 | child = child->nextSibling(); |
279 | delete tmp; | 281 | delete tmp; |
280 | } | 282 | } |
281 | QValueList<FolderP>::ConstIterator it; | 283 | Q3ValueList<FolderP>::ConstIterator it; |
282 | QListViewItem*item = 0; | 284 | Q3ListViewItem*item = 0; |
283 | for ( it = folders->begin(); it!=folders->end(); ++it) | 285 | for ( it = folders->begin(); it!=folders->end(); ++it) |
284 | { | 286 | { |
285 | item = new NNTPfolderItem( (*it), this , item ); | 287 | item = new NNTPfolderItem( (*it), this , item ); |
286 | item->setSelectable( (*it)->may_select()); | 288 | item->setSelectable( (*it)->may_select()); |
287 | } | 289 | } |
288 | delete folders; | 290 | delete folders; |
289 | } | 291 | } |
290 | 292 | ||
291 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 293 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
292 | { | 294 | { |
293 | 295 | ||
294 | return wrapper->fetchBody( mail ); | 296 | return wrapper->fetchBody( mail ); |
295 | } | 297 | } |
296 | 298 | ||
297 | QPopupMenu * NNTPviewItem::getContextMenu() | 299 | Q3PopupMenu * NNTPviewItem::getContextMenu() |
298 | { | 300 | { |
299 | QPopupMenu *m = new QPopupMenu(0); | 301 | Q3PopupMenu *m = new Q3PopupMenu(0); |
300 | if (m) | 302 | if (m) |
301 | { | 303 | { |
302 | if (!account->getOffline()) | 304 | if (!account->getOffline()) |
303 | { | 305 | { |
304 | m->insertItem(i18n("Disconnect"),0); | 306 | m->insertItem(i18n("Disconnect"),0); |
305 | m->insertItem(i18n("Set offline"),1); | 307 | m->insertItem(i18n("Set offline"),1); |
306 | //m->insertItem(i18n("(Un-)Subscribe groups"),2); | 308 | //m->insertItem(i18n("(Un-)Subscribe groups"),2); |
307 | } | 309 | } |
308 | else | 310 | else |
309 | { | 311 | { |
310 | m->insertItem(i18n("Set online"),1); | 312 | m->insertItem(i18n("Set online"),1); |
311 | } | 313 | } |
312 | } | 314 | } |
313 | return m; | 315 | return m; |
314 | } | 316 | } |
315 | 317 | ||
316 | void NNTPviewItem::subscribeGroups() | 318 | void NNTPviewItem::subscribeGroups() |
317 | { | 319 | { |
318 | NNTPGroupsDlg dlg(account); | 320 | NNTPGroupsDlg dlg(account); |
319 | #ifndef DESKTOP_VERSION | 321 | #ifndef DESKTOP_VERSION |
320 | dlg.showMaximized(); | 322 | dlg.showMaximized(); |
321 | #endif | 323 | #endif |
322 | if ( dlg.exec()== QDialog::Accepted ){ | 324 | if ( dlg.exec()== QDialog::Accepted ){ |
323 | refresh(); | 325 | refresh(); |
324 | } | 326 | } |
325 | } | 327 | } |
326 | 328 | ||
327 | void NNTPviewItem::disconnect() | 329 | void NNTPviewItem::disconnect() |
328 | { | 330 | { |
329 | QListViewItem *child = firstChild(); | 331 | Q3ListViewItem *child = firstChild(); |
330 | while ( child ) | 332 | while ( child ) |
331 | { | 333 | { |
332 | QListViewItem *tmp = child; | 334 | Q3ListViewItem *tmp = child; |
333 | child = child->nextSibling(); | 335 | child = child->nextSibling(); |
334 | delete tmp; | 336 | delete tmp; |
335 | } | 337 | } |
336 | wrapper->logout(); | 338 | wrapper->logout(); |
337 | } | 339 | } |
338 | 340 | ||
339 | void NNTPviewItem::setOnOffline() | 341 | void NNTPviewItem::setOnOffline() |
340 | { | 342 | { |
341 | if (!account->getOffline()) | 343 | if (!account->getOffline()) |
342 | { | 344 | { |
343 | disconnect(); | 345 | disconnect(); |
344 | } | 346 | } |
345 | account->setOffline(!account->getOffline()); | 347 | account->setOffline(!account->getOffline()); |
346 | account->save(); | 348 | account->save(); |
347 | //FIXME | 349 | //FIXME |
348 | SETPIX(PIXMAP_POP3FOLDER); | 350 | SETPIX(PIXMAP_POP3FOLDER); |
349 | refresh(); | 351 | refresh(); |
350 | } | 352 | } |
351 | 353 | ||
352 | void NNTPviewItem::contextMenuSelected(int which) | 354 | void NNTPviewItem::contextMenuSelected(int which) |
353 | { | 355 | { |
354 | switch (which) | 356 | switch (which) |
355 | { | 357 | { |
356 | case 0: | 358 | case 0: |
357 | disconnect(); | 359 | disconnect(); |
358 | break; | 360 | break; |
359 | case 1: | 361 | case 1: |
360 | setOnOffline(); | 362 | setOnOffline(); |
361 | break; | 363 | break; |
362 | case 2: | 364 | case 2: |
363 | subscribeGroups(); | 365 | subscribeGroups(); |
364 | break; | 366 | break; |
365 | } | 367 | } |
366 | } | 368 | } |
367 | 369 | ||
368 | NNTPfolderItem::~NNTPfolderItem() | 370 | NNTPfolderItem::~NNTPfolderItem() |
369 | {} | 371 | {} |
370 | 372 | ||
371 | NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) | 373 | NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , Q3ListViewItem*after ) |
372 | : AccountViewItem( folderInit, parent,after ) | 374 | : AccountViewItem( folderInit, parent,after ) |
373 | { | 375 | { |
374 | nntp = parent; | 376 | nntp = parent; |
375 | if (folder->getDisplayName().lower()!="inbox") | 377 | if (folder->getDisplayName().lower()!="inbox") |
376 | { | 378 | { |
377 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 379 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
378 | } | 380 | } |
379 | else | 381 | else |
380 | { | 382 | { |
381 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 383 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
382 | } | 384 | } |
383 | setText( 0, folder->getDisplayName() ); | 385 | setText( 0, folder->getDisplayName() ); |
384 | } | 386 | } |
385 | 387 | ||
386 | void NNTPfolderItem::refresh(QValueList<RecMailP>&target) | 388 | void NNTPfolderItem::refresh(Q3ValueList<RecMailP>&target) |
387 | { | 389 | { |
388 | if (folder->may_select()) | 390 | if (folder->may_select()) |
389 | nntp->getWrapper()->listMessages( folder->getName(),target ); | 391 | nntp->getWrapper()->listMessages( folder->getName(),target ); |
390 | } | 392 | } |
391 | 393 | ||
392 | RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) | 394 | RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) |
393 | { | 395 | { |
394 | return nntp->getWrapper()->fetchBody(aMail); | 396 | return nntp->getWrapper()->fetchBody(aMail); |
395 | } | 397 | } |
396 | 398 | ||
397 | QPopupMenu * NNTPfolderItem::getContextMenu() | 399 | Q3PopupMenu * NNTPfolderItem::getContextMenu() |
398 | { | 400 | { |
399 | QPopupMenu *m = new QPopupMenu(0); | 401 | Q3PopupMenu *m = new Q3PopupMenu(0); |
400 | if (m) | 402 | if (m) |
401 | { | 403 | { |
402 | m->insertItem(i18n("Refresh header list"),0); | 404 | m->insertItem(i18n("Refresh header list"),0); |
403 | m->insertItem(i18n("Copy all postings"),1); | 405 | m->insertItem(i18n("Copy all postings"),1); |
404 | } | 406 | } |
405 | return m; | 407 | return m; |
406 | } | 408 | } |
407 | 409 | ||
408 | void NNTPfolderItem::downloadMails() | 410 | void NNTPfolderItem::downloadMails() |
409 | { | 411 | { |
410 | AccountView*bl = nntp->accountView(); | 412 | AccountView*bl = nntp->accountView(); |
411 | if (!bl) return; | 413 | if (!bl) return; |
412 | bl->downloadMails(folder,nntp->getWrapper()); | 414 | bl->downloadMails(folder,nntp->getWrapper()); |
413 | } | 415 | } |
414 | 416 | ||
415 | void NNTPfolderItem::contextMenuSelected(int which) | 417 | void NNTPfolderItem::contextMenuSelected(int which) |
416 | { | 418 | { |
417 | AccountView * view = (AccountView*)listView(); | 419 | AccountView * view = (AccountView*)listView(); |
418 | switch (which) | 420 | switch (which) |
419 | { | 421 | { |
420 | case 0: | 422 | case 0: |
421 | /* must be 'cause pop3 lists are cached */ | 423 | /* must be 'cause pop3 lists are cached */ |
422 | nntp->getWrapper()->logout(); | 424 | nntp->getWrapper()->logout(); |
423 | view->refreshCurrent(); | 425 | view->refreshCurrent(); |
424 | break; | 426 | break; |
425 | case 1: | 427 | case 1: |
426 | downloadMails(); | 428 | downloadMails(); |
427 | break; | 429 | break; |
428 | default: | 430 | default: |
429 | break; | 431 | break; |
430 | } | 432 | } |
431 | } | 433 | } |
432 | 434 | ||
433 | /** | 435 | /** |
434 | * IMAP Account stuff | 436 | * IMAP Account stuff |
435 | */ | 437 | */ |
436 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) | 438 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) |
437 | : AccountViewItem( parent ) | 439 | : AccountViewItem( parent ) |
438 | { | 440 | { |
439 | account = a; | 441 | account = a; |
440 | wrapper = AbstractMail::getWrapper( account ); | 442 | wrapper = AbstractMail::getWrapper( account ); |
441 | SETPIX(PIXMAP_IMAPFOLDER); | 443 | SETPIX(PIXMAP_IMAPFOLDER); |
442 | setText( 0, account->getAccountName() ); | 444 | setText( 0, account->getAccountName() ); |
443 | setOpen( true ); | 445 | setOpen( true ); |
444 | } | 446 | } |
445 | 447 | ||
446 | IMAPviewItem::~IMAPviewItem() | 448 | IMAPviewItem::~IMAPviewItem() |
447 | { | 449 | { |
448 | delete wrapper; | 450 | delete wrapper; |
449 | } | 451 | } |
450 | 452 | ||
451 | AbstractMail *IMAPviewItem::getWrapper() | 453 | AbstractMail *IMAPviewItem::getWrapper() |
452 | { | 454 | { |
453 | return wrapper; | 455 | return wrapper; |
454 | } | 456 | } |
455 | 457 | ||
456 | void IMAPviewItem::refresh(QValueList<RecMailP>&) | 458 | void IMAPviewItem::refresh(Q3ValueList<RecMailP>&) |
457 | { | 459 | { |
458 | refreshFolders(false); | 460 | refreshFolders(false); |
459 | } | 461 | } |
460 | 462 | ||
461 | const QStringList&IMAPviewItem::subFolders() | 463 | const QStringList&IMAPviewItem::subFolders() |
462 | { | 464 | { |
463 | return currentFolders; | 465 | return currentFolders; |
464 | } | 466 | } |
465 | 467 | ||
466 | void IMAPviewItem::refreshFolders(bool force) | 468 | void IMAPviewItem::refreshFolders(bool force) |
467 | { | 469 | { |
468 | if (childCount()>0 && force==false) return; | 470 | if (childCount()>0 && force==false) return; |
469 | if (account->getOffline()) return; | 471 | if (account->getOffline()) return; |
470 | 472 | ||
471 | removeChilds(); | 473 | removeChilds(); |
472 | currentFolders.clear(); | 474 | currentFolders.clear(); |
473 | QValueList<FolderP> * folders = wrapper->listFolders(); | 475 | Q3ValueList<FolderP> * folders = wrapper->listFolders(); |
474 | 476 | ||
475 | QValueList<FolderP>::Iterator it; | 477 | Q3ValueList<FolderP>::Iterator it; |
476 | QListViewItem*item = 0; | 478 | Q3ListViewItem*item = 0; |
477 | QListViewItem*titem = 0; | 479 | Q3ListViewItem*titem = 0; |
478 | QString fname,del,search; | 480 | QString fname,del,search; |
479 | int pos; | 481 | int pos; |
480 | 482 | ||
481 | for ( it = folders->begin(); it!=folders->end(); ++it) | 483 | for ( it = folders->begin(); it!=folders->end(); ++it) |
482 | { | 484 | { |
483 | if ((*it)->getDisplayName().lower()=="inbox") | 485 | if ((*it)->getDisplayName().lower()=="inbox") |
484 | { | 486 | { |
485 | item = new IMAPfolderItem( (*it), this , item ); | 487 | item = new IMAPfolderItem( (*it), this , item ); |
486 | folders->remove(it); | 488 | folders->remove(it); |
487 | break; | 489 | break; |
488 | } | 490 | } |
489 | } | 491 | } |
490 | for ( it = folders->begin(); it!=folders->end(); ++it) | 492 | for ( it = folders->begin(); it!=folders->end(); ++it) |
491 | { | 493 | { |
492 | fname = (*it)->getDisplayName(); | 494 | fname = (*it)->getDisplayName(); |
493 | currentFolders.append((*it)->getName()); | 495 | currentFolders.append((*it)->getName()); |
494 | pos = fname.findRev((*it)->Separator()); | 496 | pos = fname.findRev((*it)->Separator()); |
495 | if (pos != -1) | 497 | if (pos != -1) |
496 | { | 498 | { |
497 | fname = fname.left(pos); | 499 | fname = fname.left(pos); |
498 | } | 500 | } |
499 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 501 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
500 | if (pitem) | 502 | if (pitem) |
501 | { | 503 | { |
502 | titem = item; | 504 | titem = item; |
503 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); | 505 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); |
504 | /* setup the short name */ | 506 | /* setup the short name */ |
505 | item->setText(0,(*it)->getDisplayName().mid(pos+1)); | 507 | item->setText(0,(*it)->getDisplayName().mid(pos+1)); |
506 | item = titem; | 508 | item = titem; |
507 | } | 509 | } |
508 | else | 510 | else |
509 | { | 511 | { |
510 | item = new IMAPfolderItem( (*it), this , item ); | 512 | item = new IMAPfolderItem( (*it), this , item ); |
511 | } | 513 | } |
512 | } | 514 | } |
513 | delete folders; | 515 | delete folders; |
514 | } | 516 | } |
515 | 517 | ||
516 | QPopupMenu * IMAPviewItem::getContextMenu() | 518 | Q3PopupMenu * IMAPviewItem::getContextMenu() |
517 | { | 519 | { |
518 | QPopupMenu *m = new QPopupMenu(0); | 520 | Q3PopupMenu *m = new Q3PopupMenu(0); |
519 | if (m) | 521 | if (m) |
520 | { | 522 | { |
521 | if (!account->getOffline()) | 523 | if (!account->getOffline()) |
522 | { | 524 | { |
523 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 525 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
524 | m->insertItem(i18n("Refresh folder list"),0); | 526 | m->insertItem(i18n("Refresh folder list"),0); |
525 | m->insertItem(i18n("Create new folder"),1); | 527 | m->insertItem(i18n("Create new folder"),1); |
526 | m->insertSeparator(); | 528 | m->insertSeparator(); |
527 | m->insertItem(i18n("Disconnect"),2); | 529 | m->insertItem(i18n("Disconnect"),2); |
528 | m->insertItem(i18n("Set offline"),3); | 530 | m->insertItem(i18n("Set offline"),3); |
529 | m->insertSeparator(); | 531 | m->insertSeparator(); |
530 | } | 532 | } |
531 | else | 533 | else |
532 | { | 534 | { |
533 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 535 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
534 | m->insertItem(i18n("Set online"),3); | 536 | m->insertItem(i18n("Set online"),3); |
535 | } | 537 | } |
536 | } | 538 | } |
537 | return m; | 539 | return m; |
538 | } | 540 | } |
539 | 541 | ||
540 | void IMAPviewItem::createNewFolder() | 542 | void IMAPviewItem::createNewFolder() |
541 | { | 543 | { |
542 | Newmdirdlg ndirdlg; | 544 | Newmdirdlg ndirdlg; |
543 | 545 | ||
544 | #ifndef DESKTOP_VERSION | 546 | #ifndef DESKTOP_VERSION |
545 | //ndirdlg.showMaximized(); | 547 | //ndirdlg.showMaximized(); |
546 | #endif | 548 | #endif |
547 | if ( ndirdlg.exec() ) | 549 | if ( ndirdlg.exec() ) |
548 | { | 550 | { |
549 | QString ndir = ndirdlg.Newdir(); | 551 | QString ndir = ndirdlg.Newdir(); |
550 | bool makesubs = ndirdlg.subpossible(); | 552 | bool makesubs = ndirdlg.subpossible(); |
@@ -586,171 +588,171 @@ void IMAPviewItem::contextMenuSelected(int id) | |||
586 | account->save(); | 588 | account->save(); |
587 | SETPIX(PIXMAP_IMAPFOLDER); | 589 | SETPIX(PIXMAP_IMAPFOLDER); |
588 | refreshFolders(false); | 590 | refreshFolders(false); |
589 | break; | 591 | break; |
590 | case GET_NEW_MAILS: // daunlood | 592 | case GET_NEW_MAILS: // daunlood |
591 | { | 593 | { |
592 | if (account->getOffline()) { | 594 | if (account->getOffline()) { |
593 | contextMenuSelected( 3 ); | 595 | contextMenuSelected( 3 ); |
594 | } | 596 | } |
595 | AccountView*bl = accountView(); | 597 | AccountView*bl = accountView(); |
596 | if (!bl) return; | 598 | if (!bl) return; |
597 | AccountViewItem* in = findSubItem( "inbox" , 0); | 599 | AccountViewItem* in = findSubItem( "inbox" , 0); |
598 | if ( ! in ) | 600 | if ( ! in ) |
599 | return; | 601 | return; |
600 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); | 602 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); |
601 | } | 603 | } |
602 | break; | 604 | break; |
603 | default: | 605 | default: |
604 | break; | 606 | break; |
605 | } | 607 | } |
606 | } | 608 | } |
607 | 609 | ||
608 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) | 610 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) |
609 | { | 611 | { |
610 | return new RecBody(); | 612 | return new RecBody(); |
611 | } | 613 | } |
612 | 614 | ||
613 | bool IMAPviewItem::offline() | 615 | bool IMAPviewItem::offline() |
614 | { | 616 | { |
615 | return account->getOffline(); | 617 | return account->getOffline(); |
616 | } | 618 | } |
617 | 619 | ||
618 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) | 620 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , Q3ListViewItem*after ) |
619 | : AccountViewItem( folderInit, parent , after ) | 621 | : AccountViewItem( folderInit, parent , after ) |
620 | { | 622 | { |
621 | imap = parent; | 623 | imap = parent; |
622 | if (folder->getDisplayName().lower()!="inbox") | 624 | if (folder->getDisplayName().lower()!="inbox") |
623 | { | 625 | { |
624 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 626 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
625 | } | 627 | } |
626 | else | 628 | else |
627 | { | 629 | { |
628 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 630 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
629 | } | 631 | } |
630 | setText( 0, folder->getDisplayName() ); | 632 | setText( 0, folder->getDisplayName() ); |
631 | } | 633 | } |
632 | 634 | ||
633 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 635 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , Q3ListViewItem*after, IMAPviewItem *master ) |
634 | : AccountViewItem(folderInit, parent,after ) | 636 | : AccountViewItem(folderInit, parent,after ) |
635 | { | 637 | { |
636 | imap = master; | 638 | imap = master; |
637 | if (folder->getDisplayName().lower()!="inbox") | 639 | if (folder->getDisplayName().lower()!="inbox") |
638 | { | 640 | { |
639 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 641 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
640 | } | 642 | } |
641 | else | 643 | else |
642 | { | 644 | { |
643 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 645 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
644 | } | 646 | } |
645 | setText( 0, folder->getDisplayName() ); | 647 | setText( 0, folder->getDisplayName() ); |
646 | } | 648 | } |
647 | 649 | ||
648 | IMAPfolderItem::~IMAPfolderItem() | 650 | IMAPfolderItem::~IMAPfolderItem() |
649 | {} | 651 | {} |
650 | 652 | ||
651 | const QString& IMAPfolderItem::Delemiter()const | 653 | const QString& IMAPfolderItem::Delemiter()const |
652 | { | 654 | { |
653 | return folder->Separator(); | 655 | return folder->Separator(); |
654 | } | 656 | } |
655 | 657 | ||
656 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) | 658 | void IMAPfolderItem::refresh(Q3ValueList<RecMailP>&target) |
657 | { | 659 | { |
658 | if (folder->may_select()) | 660 | if (folder->may_select()) |
659 | { | 661 | { |
660 | imap->getWrapper()->listMessages( folder->getName(),target ); | 662 | imap->getWrapper()->listMessages( folder->getName(),target ); |
661 | } | 663 | } |
662 | else | 664 | else |
663 | { | 665 | { |
664 | target.clear(); | 666 | target.clear(); |
665 | } | 667 | } |
666 | } | 668 | } |
667 | 669 | ||
668 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) | 670 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) |
669 | { | 671 | { |
670 | return imap->getWrapper()->fetchBody(aMail); | 672 | return imap->getWrapper()->fetchBody(aMail); |
671 | } | 673 | } |
672 | 674 | ||
673 | QPopupMenu * IMAPfolderItem::getContextMenu() | 675 | Q3PopupMenu * IMAPfolderItem::getContextMenu() |
674 | { | 676 | { |
675 | QPopupMenu *m = new QPopupMenu(0); | 677 | Q3PopupMenu *m = new Q3PopupMenu(0); |
676 | if (m) | 678 | if (m) |
677 | { | 679 | { |
678 | if (folder->may_select()) | 680 | if (folder->may_select()) |
679 | { | 681 | { |
680 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 682 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
681 | m->insertItem(i18n("Refresh header list"),0); | 683 | m->insertItem(i18n("Refresh header list"),0); |
682 | m->insertItem(i18n("Move/Copie all mails"),4); | 684 | m->insertItem(i18n("Move/Copie all mails"),4); |
683 | m->insertItem(i18n("Delete all mails"),1); | 685 | m->insertItem(i18n("Delete all mails"),1); |
684 | } | 686 | } |
685 | if (folder->no_inferior()==false) | 687 | if (folder->no_inferior()==false) |
686 | { | 688 | { |
687 | m->insertItem(i18n("Create new subfolder"),2); | 689 | m->insertItem(i18n("Create new subfolder"),2); |
688 | } | 690 | } |
689 | if (folder->getDisplayName().lower()!="inbox") | 691 | if (folder->getDisplayName().lower()!="inbox") |
690 | { | 692 | { |
691 | m->insertItem(i18n("Delete folder"),3); | 693 | m->insertItem(i18n("Delete folder"),3); |
692 | } | 694 | } |
693 | } | 695 | } |
694 | return m; | 696 | return m; |
695 | } | 697 | } |
696 | 698 | ||
697 | void IMAPfolderItem::createNewFolder() | 699 | void IMAPfolderItem::createNewFolder() |
698 | { | 700 | { |
699 | Newmdirdlg ndirdlg; | 701 | Newmdirdlg ndirdlg; |
700 | //ndirdlg.showMaximized(); | 702 | //ndirdlg.showMaximized(); |
701 | if ( ndirdlg.exec() ) | 703 | if ( ndirdlg.exec() ) |
702 | { | 704 | { |
703 | QString ndir = ndirdlg.Newdir(); | 705 | QString ndir = ndirdlg.Newdir(); |
704 | bool makesubs = ndirdlg.subpossible(); | 706 | bool makesubs = ndirdlg.subpossible(); |
705 | QString delemiter = Delemiter(); | 707 | QString delemiter = Delemiter(); |
706 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 708 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
707 | { | 709 | { |
708 | imap->refreshFolders(true); | 710 | imap->refreshFolders(true); |
709 | } | 711 | } |
710 | } | 712 | } |
711 | } | 713 | } |
712 | 714 | ||
713 | void IMAPfolderItem::deleteFolder() | 715 | void IMAPfolderItem::deleteFolder() |
714 | { | 716 | { |
715 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), | 717 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), |
716 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), | 718 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), |
717 | i18n("Yes"), | 719 | i18n("Yes"), |
718 | i18n("No"),QString::null,1,1); | 720 | i18n("No"),QString::null,1,1); |
719 | 721 | ||
720 | if (yesno == 0) | 722 | if (yesno == 0) |
721 | { | 723 | { |
722 | if (imap->getWrapper()->deleteMbox(folder)) | 724 | if (imap->getWrapper()->deleteMbox(folder)) |
723 | { | 725 | { |
724 | QListView*v=listView(); | 726 | Q3ListView*v=listView(); |
725 | IMAPviewItem * box = imap; | 727 | IMAPviewItem * box = imap; |
726 | /* be carefull - after that this object is destroyd so don't use | 728 | /* be carefull - after that this object is destroyd so don't use |
727 | * any member of it after that call!!*/ | 729 | * any member of it after that call!!*/ |
728 | imap->refreshFolders(true); | 730 | imap->refreshFolders(true); |
729 | if (v) | 731 | if (v) |
730 | { | 732 | { |
731 | v->setSelected(box,true); | 733 | v->setSelected(box,true); |
732 | } | 734 | } |
733 | } | 735 | } |
734 | } | 736 | } |
735 | } | 737 | } |
736 | 738 | ||
737 | void IMAPfolderItem::downloadMails() | 739 | void IMAPfolderItem::downloadMails() |
738 | { | 740 | { |
739 | AccountView*bl = imap->accountView(); | 741 | AccountView*bl = imap->accountView(); |
740 | if (!bl) return; | 742 | if (!bl) return; |
741 | bl->downloadMails(folder,imap->getWrapper()); | 743 | bl->downloadMails(folder,imap->getWrapper()); |
742 | } | 744 | } |
743 | 745 | ||
744 | void IMAPfolderItem::contextMenuSelected(int id) | 746 | void IMAPfolderItem::contextMenuSelected(int id) |
745 | { | 747 | { |
746 | 748 | ||
747 | AccountView * view = (AccountView*)listView(); | 749 | AccountView * view = (AccountView*)listView(); |
748 | switch(id) | 750 | switch(id) |
749 | { | 751 | { |
750 | case 0: | 752 | case 0: |
751 | view->refreshCurrent(); | 753 | view->refreshCurrent(); |
752 | break; | 754 | break; |
753 | case 1: | 755 | case 1: |
754 | deleteAllMail(imap->getWrapper(),folder); | 756 | deleteAllMail(imap->getWrapper(),folder); |
755 | break; | 757 | break; |
756 | case 2: | 758 | case 2: |
@@ -771,408 +773,408 @@ void IMAPfolderItem::contextMenuSelected(int id) | |||
771 | default: | 773 | default: |
772 | break; | 774 | break; |
773 | } | 775 | } |
774 | } | 776 | } |
775 | 777 | ||
776 | /** | 778 | /** |
777 | * MH Account stuff | 779 | * MH Account stuff |
778 | */ | 780 | */ |
779 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 781 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
780 | POP3 and MBOX */ | 782 | POP3 and MBOX */ |
781 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 783 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
782 | : AccountViewItem( parent ) | 784 | : AccountViewItem( parent ) |
783 | { | 785 | { |
784 | m_Path = aPath; | 786 | m_Path = aPath; |
785 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 787 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
786 | wrapper = AbstractMail::getWrapper( m_Path,"Local Mailfolders"); | 788 | wrapper = AbstractMail::getWrapper( m_Path,"Local Mailfolders"); |
787 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 789 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
788 | setText( 0, i18n(" Local Mailfolders") ); | 790 | setText( 0, i18n(" Local Mailfolders") ); |
789 | setOpen( true ); | 791 | setOpen( true ); |
790 | folder = 0; | 792 | folder = 0; |
791 | } | 793 | } |
792 | 794 | ||
793 | MHviewItem::~MHviewItem() | 795 | MHviewItem::~MHviewItem() |
794 | { | 796 | { |
795 | delete wrapper; | 797 | delete wrapper; |
796 | } | 798 | } |
797 | 799 | ||
798 | AbstractMail *MHviewItem::getWrapper() | 800 | AbstractMail *MHviewItem::getWrapper() |
799 | { | 801 | { |
800 | return wrapper; | 802 | return wrapper; |
801 | } | 803 | } |
802 | 804 | ||
803 | void MHviewItem::refresh( QValueList<RecMailP> & target) | 805 | void MHviewItem::refresh( Q3ValueList<RecMailP> & target) |
804 | { | 806 | { |
805 | refresh(false); | 807 | refresh(false); |
806 | getWrapper()->listMessages( "",target ); | 808 | getWrapper()->listMessages( "",target ); |
807 | } | 809 | } |
808 | 810 | ||
809 | void MHviewItem::refresh(bool force) | 811 | void MHviewItem::refresh(bool force) |
810 | { | 812 | { |
811 | if (childCount()>0 && force==false) return; | 813 | if (childCount()>0 && force==false) return; |
812 | removeChilds(); | 814 | removeChilds(); |
813 | currentFolders.clear(); | 815 | currentFolders.clear(); |
814 | QValueList<FolderP> *folders = wrapper->listFolders(); | 816 | Q3ValueList<FolderP> *folders = wrapper->listFolders(); |
815 | QValueList<FolderP>::ConstIterator it; | 817 | Q3ValueList<FolderP>::ConstIterator it; |
816 | MHfolderItem*item = 0; | 818 | MHfolderItem*item = 0; |
817 | MHfolderItem*pmaster = 0; | 819 | MHfolderItem*pmaster = 0; |
818 | QString fname = ""; | 820 | QString fname = ""; |
819 | int pos; | 821 | int pos; |
820 | for ( it = folders->begin(); it!=folders->end(); ++it) | 822 | for ( it = folders->begin(); it!=folders->end(); ++it) |
821 | { | 823 | { |
822 | fname = (*it)->getDisplayName(); | 824 | fname = (*it)->getDisplayName(); |
823 | /* this folder itself */ | 825 | /* this folder itself */ |
824 | if (fname=="/") | 826 | if (fname=="/") |
825 | { | 827 | { |
826 | currentFolders.append(fname); | 828 | currentFolders.append(fname); |
827 | folder = (*it); | 829 | folder = (*it); |
828 | continue; | 830 | continue; |
829 | } | 831 | } |
830 | currentFolders.append(fname); | 832 | currentFolders.append(fname); |
831 | pos = fname.findRev("/"); | 833 | pos = fname.findRev("/"); |
832 | if (pos > 0) | 834 | if (pos > 0) |
833 | { | 835 | { |
834 | fname = fname.left(pos); | 836 | fname = fname.left(pos); |
835 | pmaster = (MHfolderItem*)findSubItem(fname); | 837 | pmaster = (MHfolderItem*)findSubItem(fname); |
836 | } | 838 | } |
837 | else | 839 | else |
838 | { | 840 | { |
839 | pmaster = 0; | 841 | pmaster = 0; |
840 | } | 842 | } |
841 | if (pmaster) | 843 | if (pmaster) |
842 | { | 844 | { |
843 | item = new MHfolderItem( (*it), pmaster, item, this ); | 845 | item = new MHfolderItem( (*it), pmaster, item, this ); |
844 | } | 846 | } |
845 | else | 847 | else |
846 | { | 848 | { |
847 | item = new MHfolderItem( (*it), this , item ); | 849 | item = new MHfolderItem( (*it), this , item ); |
848 | } | 850 | } |
849 | item->setSelectable((*it)->may_select()); | 851 | item->setSelectable((*it)->may_select()); |
850 | } | 852 | } |
851 | delete folders; | 853 | delete folders; |
852 | } | 854 | } |
853 | 855 | ||
854 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 856 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
855 | { | 857 | { |
856 | 858 | ||
857 | return wrapper->fetchBody( mail ); | 859 | return wrapper->fetchBody( mail ); |
858 | } | 860 | } |
859 | 861 | ||
860 | QPopupMenu * MHviewItem::getContextMenu() | 862 | Q3PopupMenu * MHviewItem::getContextMenu() |
861 | { | 863 | { |
862 | QPopupMenu *m = new QPopupMenu(0); | 864 | Q3PopupMenu *m = new Q3PopupMenu(0); |
863 | if (m) | 865 | if (m) |
864 | { | 866 | { |
865 | m->insertItem(i18n("Refresh folder list"),0); | 867 | m->insertItem(i18n("Refresh folder list"),0); |
866 | m->insertItem(i18n("Create new folder"),1); | 868 | m->insertItem(i18n("Create new folder"),1); |
867 | m->insertItem(i18n("Delete all mails"),2); | 869 | m->insertItem(i18n("Delete all mails"),2); |
868 | m->insertItem(i18n("Move/Copie all mails"),3); | 870 | m->insertItem(i18n("Move/Copie all mails"),3); |
869 | } | 871 | } |
870 | return m; | 872 | return m; |
871 | } | 873 | } |
872 | 874 | ||
873 | void MHviewItem::createFolder() | 875 | void MHviewItem::createFolder() |
874 | { | 876 | { |
875 | Newmdirdlg ndirdlg(0,0,true); | 877 | Newmdirdlg ndirdlg(0,0,true); |
876 | //ndirdlg.showMaximized(); | 878 | //ndirdlg.showMaximized(); |
877 | if ( ndirdlg.exec() ) | 879 | if ( ndirdlg.exec() ) |
878 | { | 880 | { |
879 | QString ndir = ndirdlg.Newdir(); | 881 | QString ndir = ndirdlg.Newdir(); |
880 | if (wrapper->createMbox(ndir)) | 882 | if (wrapper->createMbox(ndir)) |
881 | { | 883 | { |
882 | refresh(true); | 884 | refresh(true); |
883 | } | 885 | } |
884 | } | 886 | } |
885 | } | 887 | } |
886 | 888 | ||
887 | void MHviewItem::downloadMails() | 889 | void MHviewItem::downloadMails() |
888 | { | 890 | { |
889 | AccountView*bl = accountView(); | 891 | AccountView*bl = accountView(); |
890 | if (!bl) return; | 892 | if (!bl) return; |
891 | bl->downloadMails(folder,getWrapper()); | 893 | bl->downloadMails(folder,getWrapper()); |
892 | } | 894 | } |
893 | 895 | ||
894 | QStringList MHviewItem::subFolders() | 896 | QStringList MHviewItem::subFolders() |
895 | { | 897 | { |
896 | return currentFolders; | 898 | return currentFolders; |
897 | } | 899 | } |
898 | 900 | ||
899 | void MHviewItem::contextMenuSelected(int which) | 901 | void MHviewItem::contextMenuSelected(int which) |
900 | { | 902 | { |
901 | switch (which) | 903 | switch (which) |
902 | { | 904 | { |
903 | case 0: | 905 | case 0: |
904 | refresh(true); | 906 | refresh(true); |
905 | break; | 907 | break; |
906 | case 1: | 908 | case 1: |
907 | createFolder(); | 909 | createFolder(); |
908 | break; | 910 | break; |
909 | case 2: | 911 | case 2: |
910 | deleteAllMail(getWrapper(),folder); | 912 | deleteAllMail(getWrapper(),folder); |
911 | break; | 913 | break; |
912 | case 3: | 914 | case 3: |
913 | downloadMails(); | 915 | downloadMails(); |
914 | break; | 916 | break; |
915 | default: | 917 | default: |
916 | break; | 918 | break; |
917 | } | 919 | } |
918 | } | 920 | } |
919 | 921 | ||
920 | MHfolderItem::~MHfolderItem() | 922 | MHfolderItem::~MHfolderItem() |
921 | {} | 923 | {} |
922 | 924 | ||
923 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) | 925 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , Q3ListViewItem*after ) |
924 | : AccountViewItem(folderInit, parent,after ) | 926 | : AccountViewItem(folderInit, parent,after ) |
925 | { | 927 | { |
926 | mbox = parent; | 928 | mbox = parent; |
927 | initName(); | 929 | initName(); |
928 | } | 930 | } |
929 | 931 | ||
930 | MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) | 932 | MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, Q3ListViewItem*after, MHviewItem*master) |
931 | : AccountViewItem(folderInit, parent,after ) | 933 | : AccountViewItem(folderInit, parent,after ) |
932 | { | 934 | { |
933 | folder = folderInit; | 935 | folder = folderInit; |
934 | mbox = master; | 936 | mbox = master; |
935 | initName(); | 937 | initName(); |
936 | } | 938 | } |
937 | 939 | ||
938 | void MHfolderItem::initName() | 940 | void MHfolderItem::initName() |
939 | { | 941 | { |
940 | QString bName = folder->getDisplayName(); | 942 | QString bName = folder->getDisplayName(); |
941 | if (bName.startsWith("/")&&bName.length()>1) | 943 | if (bName.startsWith("/")&&bName.length()>1) |
942 | { | 944 | { |
943 | bName.replace(0,1,""); | 945 | bName.replace(0,1,""); |
944 | } | 946 | } |
945 | int pos = bName.findRev("/"); | 947 | int pos = bName.findRev("/"); |
946 | if (pos > 0) | 948 | if (pos > 0) |
947 | { | 949 | { |
948 | bName.replace(0,pos+1,""); | 950 | bName.replace(0,pos+1,""); |
949 | } | 951 | } |
950 | if (bName.lower() == "outgoing") | 952 | if (bName.lower() == "outgoing") |
951 | { | 953 | { |
952 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 954 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
953 | } | 955 | } |
954 | else if (bName.lower() == "inbox") | 956 | else if (bName.lower() == "inbox") |
955 | { | 957 | { |
956 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 958 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
957 | } else if (bName.lower() == "drafts") { | 959 | } else if (bName.lower() == "drafts") { |
958 | setPixmap(0, SmallIcon ("edit")); | 960 | setPixmap(0, SmallIcon ("edit")); |
959 | } else { | 961 | } else { |
960 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 962 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
961 | } | 963 | } |
962 | setText( 0, bName ); | 964 | setText( 0, bName ); |
963 | } | 965 | } |
964 | 966 | ||
965 | const FolderP&MHfolderItem::getFolder()const | 967 | const FolderP&MHfolderItem::getFolder()const |
966 | { | 968 | { |
967 | return folder; | 969 | return folder; |
968 | } | 970 | } |
969 | 971 | ||
970 | void MHfolderItem::refresh(QValueList<RecMailP>&target) | 972 | void MHfolderItem::refresh(Q3ValueList<RecMailP>&target) |
971 | { | 973 | { |
972 | if (folder->may_select()) | 974 | if (folder->may_select()) |
973 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 975 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
974 | } | 976 | } |
975 | 977 | ||
976 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) | 978 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) |
977 | { | 979 | { |
978 | return mbox->getWrapper()->fetchBody(aMail); | 980 | return mbox->getWrapper()->fetchBody(aMail); |
979 | } | 981 | } |
980 | 982 | ||
981 | void MHfolderItem::deleteFolder() | 983 | void MHfolderItem::deleteFolder() |
982 | { | 984 | { |
983 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), | 985 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), |
984 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), | 986 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), |
985 | i18n("Yes"), | 987 | i18n("Yes"), |
986 | i18n("No"),QString::null,1,1); | 988 | i18n("No"),QString::null,1,1); |
987 | 989 | ||
988 | if (yesno == 0) | 990 | if (yesno == 0) |
989 | { | 991 | { |
990 | if (mbox->getWrapper()->deleteMbox(folder)) | 992 | if (mbox->getWrapper()->deleteMbox(folder)) |
991 | { | 993 | { |
992 | QListView*v=listView(); | 994 | Q3ListView*v=listView(); |
993 | MHviewItem * box = mbox; | 995 | MHviewItem * box = mbox; |
994 | /* be carefull - after that this object is destroyd so don't use | 996 | /* be carefull - after that this object is destroyd so don't use |
995 | * any member of it after that call!!*/ | 997 | * any member of it after that call!!*/ |
996 | mbox->refresh(true); | 998 | mbox->refresh(true); |
997 | if (v) | 999 | if (v) |
998 | { | 1000 | { |
999 | v->setSelected(box,true); | 1001 | v->setSelected(box,true); |
1000 | } | 1002 | } |
1001 | } | 1003 | } |
1002 | } | 1004 | } |
1003 | } | 1005 | } |
1004 | 1006 | ||
1005 | QPopupMenu * MHfolderItem::getContextMenu() | 1007 | Q3PopupMenu * MHfolderItem::getContextMenu() |
1006 | { | 1008 | { |
1007 | QPopupMenu *m = new QPopupMenu(0); | 1009 | Q3PopupMenu *m = new Q3PopupMenu(0); |
1008 | if (m) | 1010 | if (m) |
1009 | { | 1011 | { |
1010 | m->insertItem(i18n("Move/Copie all mails"),2); | 1012 | m->insertItem(i18n("Move/Copie all mails"),2); |
1011 | m->insertItem(i18n("Delete all mails"),0); | 1013 | m->insertItem(i18n("Delete all mails"),0); |
1012 | m->insertItem(i18n("Create new subfolder"),3); | 1014 | m->insertItem(i18n("Create new subfolder"),3); |
1013 | m->insertItem(i18n("Delete folder"),1); | 1015 | m->insertItem(i18n("Delete folder"),1); |
1014 | } | 1016 | } |
1015 | return m; | 1017 | return m; |
1016 | } | 1018 | } |
1017 | 1019 | ||
1018 | void MHfolderItem::downloadMails() | 1020 | void MHfolderItem::downloadMails() |
1019 | { | 1021 | { |
1020 | AccountView*bl = mbox->accountView(); | 1022 | AccountView*bl = mbox->accountView(); |
1021 | if (!bl) return; | 1023 | if (!bl) return; |
1022 | bl->downloadMails(folder,mbox->getWrapper()); | 1024 | bl->downloadMails(folder,mbox->getWrapper()); |
1023 | } | 1025 | } |
1024 | 1026 | ||
1025 | void MHfolderItem::createFolder() | 1027 | void MHfolderItem::createFolder() |
1026 | { | 1028 | { |
1027 | Newmdirdlg ndirdlg(0,0,true); | 1029 | Newmdirdlg ndirdlg(0,0,true); |
1028 | //ndirdlg.showMaximized(); | 1030 | //ndirdlg.showMaximized(); |
1029 | if (ndirdlg.exec() ) | 1031 | if (ndirdlg.exec() ) |
1030 | { | 1032 | { |
1031 | QString ndir = ndirdlg.Newdir(); | 1033 | QString ndir = ndirdlg.Newdir(); |
1032 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 1034 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
1033 | { | 1035 | { |
1034 | QListView*v=listView(); | 1036 | Q3ListView*v=listView(); |
1035 | MHviewItem * box = mbox; | 1037 | MHviewItem * box = mbox; |
1036 | /* be carefull - after that this object is destroyd so don't use | 1038 | /* be carefull - after that this object is destroyd so don't use |
1037 | * any member of it after that call!!*/ | 1039 | * any member of it after that call!!*/ |
1038 | mbox->refresh(true); | 1040 | mbox->refresh(true); |
1039 | if (v) | 1041 | if (v) |
1040 | { | 1042 | { |
1041 | v->setSelected(box,true); | 1043 | v->setSelected(box,true); |
1042 | } | 1044 | } |
1043 | } | 1045 | } |
1044 | } | 1046 | } |
1045 | } | 1047 | } |
1046 | 1048 | ||
1047 | void MHfolderItem::contextMenuSelected(int which) | 1049 | void MHfolderItem::contextMenuSelected(int which) |
1048 | { | 1050 | { |
1049 | switch(which) | 1051 | switch(which) |
1050 | { | 1052 | { |
1051 | case 0: | 1053 | case 0: |
1052 | deleteAllMail(mbox->getWrapper(),folder); | 1054 | deleteAllMail(mbox->getWrapper(),folder); |
1053 | break; | 1055 | break; |
1054 | case 1: | 1056 | case 1: |
1055 | deleteFolder(); | 1057 | deleteFolder(); |
1056 | break; | 1058 | break; |
1057 | case 2: | 1059 | case 2: |
1058 | downloadMails(); | 1060 | downloadMails(); |
1059 | break; | 1061 | break; |
1060 | case 3: | 1062 | case 3: |
1061 | createFolder(); | 1063 | createFolder(); |
1062 | break; | 1064 | break; |
1063 | default: | 1065 | default: |
1064 | break; | 1066 | break; |
1065 | } | 1067 | } |
1066 | } | 1068 | } |
1067 | 1069 | ||
1068 | bool MHfolderItem::isDraftfolder() | 1070 | bool MHfolderItem::isDraftfolder() |
1069 | { | 1071 | { |
1070 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; | 1072 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; |
1071 | return false; | 1073 | return false; |
1072 | } | 1074 | } |
1073 | 1075 | ||
1074 | /** | 1076 | /** |
1075 | * Generic stuff | 1077 | * Generic stuff |
1076 | */ | 1078 | */ |
1077 | 1079 | ||
1078 | const QString AccountViewItem::contextName="AccountViewItem"; | 1080 | const QString AccountViewItem::contextName="AccountViewItem"; |
1079 | 1081 | ||
1080 | AccountViewItem::AccountViewItem( AccountView *parent ) | 1082 | AccountViewItem::AccountViewItem( AccountView *parent ) |
1081 | : QListViewItem( parent ) | 1083 | : Q3ListViewItem( parent ) |
1082 | { | 1084 | { |
1083 | init(); | 1085 | init(); |
1084 | m_Backlink = parent; | 1086 | m_Backlink = parent; |
1085 | } | 1087 | } |
1086 | 1088 | ||
1087 | AccountViewItem::AccountViewItem( QListViewItem *parent) | 1089 | AccountViewItem::AccountViewItem( Q3ListViewItem *parent) |
1088 | : QListViewItem( parent),folder(0) | 1090 | : Q3ListViewItem( parent),folder(0) |
1089 | { | 1091 | { |
1090 | init(); | 1092 | init(); |
1091 | } | 1093 | } |
1092 | 1094 | ||
1093 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) | 1095 | AccountViewItem::AccountViewItem( Q3ListViewItem *parent , Q3ListViewItem*after ) |
1094 | :QListViewItem( parent,after ),folder(0) | 1096 | :Q3ListViewItem( parent,after ),folder(0) |
1095 | { | 1097 | { |
1096 | init(); | 1098 | init(); |
1097 | } | 1099 | } |
1098 | 1100 | ||
1099 | AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) | 1101 | AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,Q3ListViewItem *parent , Q3ListViewItem*after ) |
1100 | :QListViewItem( parent,after ),folder(folderInit) | 1102 | :Q3ListViewItem( parent,after ),folder(folderInit) |
1101 | { | 1103 | { |
1102 | init(); | 1104 | init(); |
1103 | } | 1105 | } |
1104 | 1106 | ||
1105 | void AccountViewItem::init() | 1107 | void AccountViewItem::init() |
1106 | { | 1108 | { |
1107 | m_Backlink = 0; | 1109 | m_Backlink = 0; |
1108 | } | 1110 | } |
1109 | 1111 | ||
1110 | AccountViewItem::~AccountViewItem() | 1112 | AccountViewItem::~AccountViewItem() |
1111 | { | 1113 | { |
1112 | folder = 0; | 1114 | folder = 0; |
1113 | } | 1115 | } |
1114 | 1116 | ||
1115 | AccountView*AccountViewItem::accountView() | 1117 | AccountView*AccountViewItem::accountView() |
1116 | { | 1118 | { |
1117 | return m_Backlink; | 1119 | return m_Backlink; |
1118 | } | 1120 | } |
1119 | 1121 | ||
1120 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) | 1122 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) |
1121 | { | 1123 | { |
1122 | if (!wrapper) return; | 1124 | if (!wrapper) return; |
1123 | QString fname=""; | 1125 | QString fname=""; |
1124 | if (folder) fname = folder->getDisplayName(); | 1126 | if (folder) fname = folder->getDisplayName(); |
1125 | int yesno = QMessageBox::warning(0,i18n("Delete all mails"), | 1127 | int yesno = QMessageBox::warning(0,i18n("Delete all mails"), |
1126 | i18n("<center>Realy delete all mails in box <br>%1</center>"). | 1128 | i18n("<center>Realy delete all mails in box <br>%1</center>"). |
1127 | arg(fname), | 1129 | arg(fname), |
1128 | i18n("Yes"), | 1130 | i18n("Yes"), |
1129 | i18n("No"),QString::null,1,1); | 1131 | i18n("No"),QString::null,1,1); |
1130 | 1132 | ||
1131 | if (yesno == 0) | 1133 | if (yesno == 0) |
1132 | { | 1134 | { |
1133 | if (wrapper->deleteAllMail(folder)) | 1135 | if (wrapper->deleteAllMail(folder)) |
1134 | { | 1136 | { |
1135 | AccountView * view = (AccountView*)listView(); | 1137 | AccountView * view = (AccountView*)listView(); |
1136 | if (view) view->refreshCurrent(); | 1138 | if (view) view->refreshCurrent(); |
1137 | } | 1139 | } |
1138 | } | 1140 | } |
1139 | } | 1141 | } |
1140 | 1142 | ||
1141 | void AccountViewItem::removeChilds() | 1143 | void AccountViewItem::removeChilds() |
1142 | { | 1144 | { |
1143 | QListViewItem *child = firstChild(); | 1145 | Q3ListViewItem *child = firstChild(); |
1144 | while ( child ) | 1146 | while ( child ) |
1145 | { | 1147 | { |
1146 | QListViewItem *tmp = child; | 1148 | Q3ListViewItem *tmp = child; |
1147 | child = child->nextSibling(); | 1149 | child = child->nextSibling(); |
1148 | delete tmp; | 1150 | delete tmp; |
1149 | } | 1151 | } |
1150 | } | 1152 | } |
1151 | 1153 | ||
1152 | bool AccountViewItem::matchName(const QString&name)const | 1154 | bool AccountViewItem::matchName(const QString&name)const |
1153 | { | 1155 | { |
1154 | if (!folder) return false; | 1156 | if (!folder) return false; |
1155 | return folder->getDisplayName().lower()==name.lower(); | 1157 | return folder->getDisplayName().lower()==name.lower(); |
1156 | } | 1158 | } |
1157 | 1159 | ||
1158 | 1160 | ||
1159 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) | 1161 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) |
1160 | { | 1162 | { |
1161 | AccountViewItem*pitem,*sitem; | 1163 | AccountViewItem*pitem,*sitem; |
1162 | if (!start) pitem = (AccountViewItem*)firstChild(); | 1164 | if (!start) pitem = (AccountViewItem*)firstChild(); |
1163 | else pitem = (AccountViewItem*)start->firstChild(); | 1165 | else pitem = (AccountViewItem*)start->firstChild(); |
1164 | while (pitem) | 1166 | while (pitem) |
1165 | { | 1167 | { |
1166 | if (pitem->matchName(path)) | 1168 | if (pitem->matchName(path)) |
1167 | { | 1169 | { |
1168 | break; | 1170 | break; |
1169 | } | 1171 | } |
1170 | if (pitem->childCount()>0) | 1172 | if (pitem->childCount()>0) |
1171 | { | 1173 | { |
1172 | sitem = findSubItem(path,pitem); | 1174 | sitem = findSubItem(path,pitem); |
1173 | if (sitem) | 1175 | if (sitem) |
1174 | { | 1176 | { |
1175 | pitem = sitem; | 1177 | pitem = sitem; |
1176 | break; | 1178 | break; |
1177 | } | 1179 | } |
1178 | } | 1180 | } |
diff --git a/kmicromail/accountitem.h b/kmicromail/accountitem.h index 4c92bfc..bbfd05f 100644 --- a/kmicromail/accountitem.h +++ b/kmicromail/accountitem.h | |||
@@ -1,215 +1,218 @@ | |||
1 | #ifndef __ACCOUNT_ITEM | 1 | #ifndef __ACCOUNT_ITEM |
2 | #define __ACCOUNT_ITEM | 2 | #define __ACCOUNT_ITEM |
3 | 3 | ||
4 | 4 | ||
5 | #include <qlistview.h> | 5 | #include <q3listview.h> |
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | //Added by qt3to4: | ||
8 | #include <Q3ValueList> | ||
9 | #include <Q3PopupMenu> | ||
7 | #include <opie2/osmartpointer.h> | 10 | #include <opie2/osmartpointer.h> |
8 | #include <libmailwrapper/mailwrapper.h> | 11 | #include <libmailwrapper/mailwrapper.h> |
9 | 12 | ||
10 | class POP3wrapper; | 13 | class POP3wrapper; |
11 | class RecMail; | 14 | class RecMail; |
12 | class RecBody; | 15 | class RecBody; |
13 | class QPopupMenu; | 16 | class Q3PopupMenu; |
14 | class Selectstore; | 17 | class Selectstore; |
15 | class AccountView; | 18 | class AccountView; |
16 | class POP3account; | 19 | class POP3account; |
17 | class NNTPaccount; | 20 | class NNTPaccount; |
18 | class IMAPaccount; | 21 | class IMAPaccount; |
19 | class AbstractMail; | 22 | class AbstractMail; |
20 | class Folder; | 23 | class Folder; |
21 | 24 | ||
22 | #define RECBODYP Opie::Core::OSmartPointer<RecBody> | 25 | #define RECBODYP Opie::Core::OSmartPointer<RecBody> |
23 | 26 | ||
24 | class AccountViewItem : public QListViewItem | 27 | class AccountViewItem : public Q3ListViewItem |
25 | { | 28 | { |
26 | 29 | ||
27 | public: | 30 | public: |
28 | AccountViewItem( AccountView *parent ); | 31 | AccountViewItem( AccountView *parent ); |
29 | AccountViewItem( QListViewItem *parent); | 32 | AccountViewItem( Q3ListViewItem *parent); |
30 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); | 33 | AccountViewItem( Q3ListViewItem *parent , Q3ListViewItem*after ); |
31 | AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); | 34 | AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,Q3ListViewItem *parent , Q3ListViewItem*after ); |
32 | 35 | ||
33 | virtual ~AccountViewItem(); | 36 | virtual ~AccountViewItem(); |
34 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; | 37 | virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; |
35 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; | 38 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; |
36 | virtual QPopupMenu * getContextMenu(){return 0;}; | 39 | virtual Q3PopupMenu * getContextMenu(){return 0;}; |
37 | virtual void contextMenuSelected(int){} | 40 | virtual void contextMenuSelected(int){} |
38 | virtual AccountView*accountView(); | 41 | virtual AccountView*accountView(); |
39 | virtual bool matchName(const QString&name)const; | 42 | virtual bool matchName(const QString&name)const; |
40 | virtual bool isDraftfolder(); | 43 | virtual bool isDraftfolder(); |
41 | Opie::Core::OSmartPointer<Folder> getFolder() { return folder; }; | 44 | Opie::Core::OSmartPointer<Folder> getFolder() { return folder; }; |
42 | 45 | ||
43 | protected: | 46 | protected: |
44 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); | 47 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); |
45 | virtual void init(); | 48 | virtual void init(); |
46 | virtual void removeChilds(); | 49 | virtual void removeChilds(); |
47 | virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f); | 50 | virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f); |
48 | static const QString contextName; | 51 | static const QString contextName; |
49 | AccountView*m_Backlink; | 52 | AccountView*m_Backlink; |
50 | Opie::Core::OSmartPointer<Folder> folder; | 53 | Opie::Core::OSmartPointer<Folder> folder; |
51 | }; | 54 | }; |
52 | 55 | ||
53 | class POP3viewItem : public AccountViewItem | 56 | class POP3viewItem : public AccountViewItem |
54 | { | 57 | { |
55 | 58 | ||
56 | public: | 59 | public: |
57 | POP3viewItem( POP3account *a, AccountView *parent ); | 60 | POP3viewItem( POP3account *a, AccountView *parent ); |
58 | virtual ~POP3viewItem(); | 61 | virtual ~POP3viewItem(); |
59 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 62 | virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
60 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 63 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
61 | AbstractMail *getWrapper(); | 64 | AbstractMail *getWrapper(); |
62 | virtual QPopupMenu * getContextMenu(); | 65 | virtual Q3PopupMenu * getContextMenu(); |
63 | virtual void contextMenuSelected(int); | 66 | virtual void contextMenuSelected(int); |
64 | 67 | ||
65 | protected: | 68 | protected: |
66 | POP3account *account; | 69 | POP3account *account; |
67 | virtual void refresh(); | 70 | virtual void refresh(); |
68 | AbstractMail *wrapper; | 71 | AbstractMail *wrapper; |
69 | void disconnect(); | 72 | void disconnect(); |
70 | void setOnOffline(); | 73 | void setOnOffline(); |
71 | }; | 74 | }; |
72 | 75 | ||
73 | class POP3folderItem : public AccountViewItem | 76 | class POP3folderItem : public AccountViewItem |
74 | { | 77 | { |
75 | 78 | ||
76 | public: | 79 | public: |
77 | POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); | 80 | POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , Q3ListViewItem*after ); |
78 | virtual ~POP3folderItem(); | 81 | virtual ~POP3folderItem(); |
79 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 82 | virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&); |
80 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 83 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
81 | virtual QPopupMenu * getContextMenu(); | 84 | virtual Q3PopupMenu * getContextMenu(); |
82 | virtual void contextMenuSelected(int); | 85 | virtual void contextMenuSelected(int); |
83 | 86 | ||
84 | protected: | 87 | protected: |
85 | void downloadMails(); | 88 | void downloadMails(); |
86 | POP3viewItem *pop3; | 89 | POP3viewItem *pop3; |
87 | }; | 90 | }; |
88 | 91 | ||
89 | 92 | ||
90 | class NNTPviewItem : public AccountViewItem | 93 | class NNTPviewItem : public AccountViewItem |
91 | { | 94 | { |
92 | 95 | ||
93 | public: | 96 | public: |
94 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); | 97 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); |
95 | virtual ~NNTPviewItem(); | 98 | virtual ~NNTPviewItem(); |
96 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 99 | virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
97 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 100 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
98 | AbstractMail *getWrapper(); | 101 | AbstractMail *getWrapper(); |
99 | virtual QPopupMenu * getContextMenu(); | 102 | virtual Q3PopupMenu * getContextMenu(); |
100 | virtual void contextMenuSelected(int); | 103 | virtual void contextMenuSelected(int); |
101 | 104 | ||
102 | protected: | 105 | protected: |
103 | NNTPaccount *account; | 106 | NNTPaccount *account; |
104 | virtual void refresh(); | 107 | virtual void refresh(); |
105 | AbstractMail *wrapper; | 108 | AbstractMail *wrapper; |
106 | void disconnect(); | 109 | void disconnect(); |
107 | void setOnOffline(); | 110 | void setOnOffline(); |
108 | void subscribeGroups(); | 111 | void subscribeGroups(); |
109 | }; | 112 | }; |
110 | 113 | ||
111 | class NNTPfolderItem : public AccountViewItem | 114 | class NNTPfolderItem : public AccountViewItem |
112 | { | 115 | { |
113 | 116 | ||
114 | public: | 117 | public: |
115 | NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); | 118 | NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , Q3ListViewItem*after ); |
116 | virtual ~NNTPfolderItem(); | 119 | virtual ~NNTPfolderItem(); |
117 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 120 | virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&); |
118 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 121 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
119 | virtual QPopupMenu * getContextMenu(); | 122 | virtual Q3PopupMenu * getContextMenu(); |
120 | virtual void contextMenuSelected(int); | 123 | virtual void contextMenuSelected(int); |
121 | 124 | ||
122 | protected: | 125 | protected: |
123 | void downloadMails(); | 126 | void downloadMails(); |
124 | NNTPviewItem *nntp; | 127 | NNTPviewItem *nntp; |
125 | }; | 128 | }; |
126 | 129 | ||
127 | 130 | ||
128 | 131 | ||
129 | class IMAPviewItem : public AccountViewItem | 132 | class IMAPviewItem : public AccountViewItem |
130 | { | 133 | { |
131 | friend class IMAPfolderItem; | 134 | friend class IMAPfolderItem; |
132 | public: | 135 | public: |
133 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); | 136 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); |
134 | virtual ~IMAPviewItem(); | 137 | virtual ~IMAPviewItem(); |
135 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 138 | virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&); |
136 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 139 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
137 | AbstractMail *getWrapper(); | 140 | AbstractMail *getWrapper(); |
138 | virtual QPopupMenu * getContextMenu(); | 141 | virtual Q3PopupMenu * getContextMenu(); |
139 | virtual void contextMenuSelected(int); | 142 | virtual void contextMenuSelected(int); |
140 | const QStringList&subFolders(); | 143 | const QStringList&subFolders(); |
141 | virtual void refreshFolders(bool force=false); | 144 | virtual void refreshFolders(bool force=false); |
142 | bool offline(); | 145 | bool offline(); |
143 | 146 | ||
144 | protected: | 147 | protected: |
145 | virtual void createNewFolder(); | 148 | virtual void createNewFolder(); |
146 | IMAPaccount *account; | 149 | IMAPaccount *account; |
147 | AbstractMail *wrapper; | 150 | AbstractMail *wrapper; |
148 | QStringList currentFolders; | 151 | QStringList currentFolders; |
149 | }; | 152 | }; |
150 | 153 | ||
151 | class IMAPfolderItem : public AccountViewItem | 154 | class IMAPfolderItem : public AccountViewItem |
152 | { | 155 | { |
153 | 156 | ||
154 | public: | 157 | public: |
155 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); | 158 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , Q3ListViewItem*after ); |
156 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | 159 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , Q3ListViewItem*after, IMAPviewItem *master ); |
157 | virtual ~IMAPfolderItem(); | 160 | virtual ~IMAPfolderItem(); |
158 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 161 | virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&); |
159 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 162 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
160 | virtual QPopupMenu * getContextMenu(); | 163 | virtual Q3PopupMenu * getContextMenu(); |
161 | virtual void contextMenuSelected(int); | 164 | virtual void contextMenuSelected(int); |
162 | virtual const QString& Delemiter()const; | 165 | virtual const QString& Delemiter()const; |
163 | protected: | 166 | protected: |
164 | virtual void createNewFolder(); | 167 | virtual void createNewFolder(); |
165 | virtual void deleteFolder(); | 168 | virtual void deleteFolder(); |
166 | virtual void downloadMails(); | 169 | virtual void downloadMails(); |
167 | IMAPviewItem *imap; | 170 | IMAPviewItem *imap; |
168 | }; | 171 | }; |
169 | 172 | ||
170 | class MHviewItem : public AccountViewItem | 173 | class MHviewItem : public AccountViewItem |
171 | { | 174 | { |
172 | friend class MHfolderItem; | 175 | friend class MHfolderItem; |
173 | 176 | ||
174 | public: | 177 | public: |
175 | MHviewItem( const QString&aMboxPath, AccountView *parent ); | 178 | MHviewItem( const QString&aMboxPath, AccountView *parent ); |
176 | virtual ~MHviewItem(); | 179 | virtual ~MHviewItem(); |
177 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 180 | virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
178 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 181 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
179 | AbstractMail *getWrapper(); | 182 | AbstractMail *getWrapper(); |
180 | virtual QPopupMenu * getContextMenu(); | 183 | virtual Q3PopupMenu * getContextMenu(); |
181 | virtual void contextMenuSelected(int); | 184 | virtual void contextMenuSelected(int); |
182 | QStringList subFolders(); | 185 | QStringList subFolders(); |
183 | virtual void refresh(bool force=false); | 186 | virtual void refresh(bool force=false); |
184 | 187 | ||
185 | protected: | 188 | protected: |
186 | void downloadMails(); | 189 | void downloadMails(); |
187 | virtual void createFolder(); | 190 | virtual void createFolder(); |
188 | QString m_Path; | 191 | QString m_Path; |
189 | AbstractMail *wrapper; | 192 | AbstractMail *wrapper; |
190 | QStringList currentFolders; | 193 | QStringList currentFolders; |
191 | }; | 194 | }; |
192 | 195 | ||
193 | class MHfolderItem : public AccountViewItem | 196 | class MHfolderItem : public AccountViewItem |
194 | { | 197 | { |
195 | 198 | ||
196 | public: | 199 | public: |
197 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after ); | 200 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , Q3ListViewItem*after ); |
198 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); | 201 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, Q3ListViewItem*after, MHviewItem*master); |
199 | virtual ~MHfolderItem(); | 202 | virtual ~MHfolderItem(); |
200 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 203 | virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&); |
201 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 204 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
202 | virtual QPopupMenu * getContextMenu(); | 205 | virtual Q3PopupMenu * getContextMenu(); |
203 | virtual void contextMenuSelected(int); | 206 | virtual void contextMenuSelected(int); |
204 | virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; | 207 | virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; |
205 | virtual bool isDraftfolder(); | 208 | virtual bool isDraftfolder(); |
206 | 209 | ||
207 | protected: | 210 | protected: |
208 | void downloadMails(); | 211 | void downloadMails(); |
209 | virtual void createFolder(); | 212 | virtual void createFolder(); |
210 | virtual void deleteFolder(); | 213 | virtual void deleteFolder(); |
211 | void initName(); | 214 | void initName(); |
212 | MHviewItem *mbox; | 215 | MHviewItem *mbox; |
213 | }; | 216 | }; |
214 | 217 | ||
215 | #endif | 218 | #endif |
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index d1d4f7e..eea1f65 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp | |||
@@ -1,201 +1,203 @@ | |||
1 | 1 | ||
2 | #include "accountview.h" | 2 | #include "accountview.h" |
3 | #include "accountitem.h" | 3 | #include "accountitem.h" |
4 | #include "selectstore.h" | 4 | #include "selectstore.h" |
5 | 5 | ||
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | #include <libmailwrapper/mailwrapper.h> | 7 | #include <libmailwrapper/mailwrapper.h> |
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | #include <libmailwrapper/abstractmail.h> | 9 | #include <libmailwrapper/abstractmail.h> |
10 | 10 | ||
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | 13 | ||
14 | /* QT */ | 14 | /* QT */ |
15 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
16 | #include <qpopupmenu.h> | 16 | #include <q3popupmenu.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qtimer.h> | 18 | #include <qtimer.h> |
19 | #include <qspinbox.h> | 19 | #include <qspinbox.h> |
20 | //Added by qt3to4: | ||
21 | #include <Q3ValueList> | ||
20 | #include <klocale.h> | 22 | #include <klocale.h> |
21 | #include <kmessagebox.h> | 23 | #include <kmessagebox.h> |
22 | 24 | ||
23 | using namespace Opie::Core; | 25 | using namespace Opie::Core; |
24 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 26 | AccountView::AccountView( QWidget *parent, const char *name, Qt::WFlags flags ) |
25 | : QListView( parent, name, flags ) | 27 | : Q3ListView( parent, name, flags ) |
26 | { | 28 | { |
27 | //connect( this, SIGNAL( selectionChanged(QListViewItem*) ), | 29 | //connect( this, SIGNAL( selectionChanged(QListViewItem*) ), |
28 | // SLOT( refresh(QListViewItem*) ) ); | 30 | // SLOT( refresh(QListViewItem*) ) ); |
29 | connect( this, SIGNAL( clicked(QListViewItem*) ), | 31 | connect( this, SIGNAL( clicked(Q3ListViewItem*) ), |
30 | SLOT( refresh(QListViewItem*) ) ); | 32 | SLOT( refresh(Q3ListViewItem*) ) ); |
31 | connect( this, SIGNAL( returnPressed(QListViewItem*) ), | 33 | connect( this, SIGNAL( returnPressed(Q3ListViewItem*) ), |
32 | SLOT( refresh(QListViewItem*) ) ); | 34 | SLOT( refresh(Q3ListViewItem*) ) ); |
33 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 35 | connect( this, SIGNAL( mouseButtonPressed(int,Q3ListViewItem*,const QPoint&,int) ),this, |
34 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); | 36 | SLOT( slotHold(int,Q3ListViewItem*,const QPoint&,int) ) ); |
35 | setSorting(0); | 37 | setSorting(0); |
36 | } | 38 | } |
37 | 39 | ||
38 | AccountView::~AccountView() | 40 | AccountView::~AccountView() |
39 | { | 41 | { |
40 | imapAccounts.clear(); | 42 | imapAccounts.clear(); |
41 | mhAccounts.clear(); | 43 | mhAccounts.clear(); |
42 | } | 44 | } |
43 | 45 | ||
44 | void AccountView::slotContextMenu(int id) | 46 | void AccountView::slotContextMenu(int id) |
45 | { | 47 | { |
46 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 48 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
47 | if (!view) return; | 49 | if (!view) return; |
48 | view->contextMenuSelected(id); | 50 | view->contextMenuSelected(id); |
49 | } | 51 | } |
50 | 52 | ||
51 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 53 | void AccountView::slotHold(int button, Q3ListViewItem * item,const QPoint&,int) |
52 | { | 54 | { |
53 | if (button==1) {return;} | 55 | if (button==1) {return;} |
54 | if (!item) return; | 56 | if (!item) return; |
55 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 57 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
56 | QPopupMenu*m = view->getContextMenu(); | 58 | Q3PopupMenu*m = view->getContextMenu(); |
57 | if (!m) return; | 59 | if (!m) return; |
58 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 60 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
59 | m->setFocus(); | 61 | m->setFocus(); |
60 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 62 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
61 | delete m; | 63 | delete m; |
62 | } | 64 | } |
63 | 65 | ||
64 | void AccountView::populate( QList<Account> list ) | 66 | void AccountView::populate( QList<Account> list ) |
65 | { | 67 | { |
66 | clear(); | 68 | clear(); |
67 | 69 | ||
68 | imapAccounts.clear(); | 70 | imapAccounts.clear(); |
69 | mhAccounts.clear(); | 71 | mhAccounts.clear(); |
70 | 72 | ||
71 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 73 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
72 | 74 | ||
73 | Account *it; | 75 | Account *it; |
74 | for ( it = list.first(); it; it = list.next() ) | 76 | for ( it = list.first(); it; it = list.next() ) |
75 | { | 77 | { |
76 | if ( it->getType() == MAILLIB::A_IMAP ) | 78 | if ( it->getType() == MAILLIB::A_IMAP ) |
77 | { | 79 | { |
78 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 80 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
79 | imapAccounts.append(new IMAPviewItem( imap, this )); | 81 | imapAccounts.append(new IMAPviewItem( imap, this )); |
80 | } | 82 | } |
81 | else if ( it->getType() == MAILLIB::A_POP3 ) | 83 | else if ( it->getType() == MAILLIB::A_POP3 ) |
82 | { | 84 | { |
83 | POP3account *pop3 = static_cast<POP3account *>(it); | 85 | POP3account *pop3 = static_cast<POP3account *>(it); |
84 | /* must not be hold 'cause it isn't required */ | 86 | /* must not be hold 'cause it isn't required */ |
85 | (void) new POP3viewItem( pop3, this ); | 87 | (void) new POP3viewItem( pop3, this ); |
86 | } | 88 | } |
87 | else if ( it->getType() == MAILLIB::A_NNTP ) | 89 | else if ( it->getType() == MAILLIB::A_NNTP ) |
88 | { | 90 | { |
89 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 91 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
90 | /* must not be hold 'cause it isn't required */ | 92 | /* must not be hold 'cause it isn't required */ |
91 | (void) new NNTPviewItem( nntp, this ); | 93 | (void) new NNTPviewItem( nntp, this ); |
92 | } | 94 | } |
93 | } | 95 | } |
94 | } | 96 | } |
95 | 97 | ||
96 | void AccountView::refresh(QListViewItem *item) | 98 | void AccountView::refresh(Q3ListViewItem *item) |
97 | { | 99 | { |
98 | if ( item ) | 100 | if ( item ) |
99 | { | 101 | { |
100 | bool ask = true; | 102 | bool ask = true; |
101 | //qDebug("text -%s- ",item->text( 0 ).latin1() ); | 103 | //qDebug("text -%s- ",item->text( 0 ).latin1() ); |
102 | if ( item->text( 0 ) == i18n (" Local Mailfolders") ) | 104 | if ( item->text( 0 ) == i18n (" Local Mailfolders") ) |
103 | ask = false; | 105 | ask = false; |
104 | else { | 106 | else { |
105 | if ( item->parent() ) | 107 | if ( item->parent() ) |
106 | if ( item->parent()->text( 0 ) == i18n (" Local Mailfolders") ) | 108 | if ( item->parent()->text( 0 ) == i18n (" Local Mailfolders") ) |
107 | ask = false; | 109 | ask = false; |
108 | } | 110 | } |
109 | if ( ask ) { | 111 | if ( ask ) { |
110 | int result = KMessageBox::warningContinueCancel(this, | 112 | int result = KMessageBox::warningContinueCancel(this, |
111 | i18n("Refresh\n%1\n?").arg( item->text(0) ), | 113 | i18n("Refresh\n%1\n?").arg( item->text(0) ), |
112 | i18n("Refresh"),i18n("Refresh"),i18n("Cancel"), | 114 | i18n("Refresh"),i18n("Refresh"),i18n("Cancel"), |
113 | true); | 115 | true); |
114 | if (result != KMessageBox::Continue) return; | 116 | if (result != KMessageBox::Continue) return; |
115 | } | 117 | } |
116 | m_currentItem = item; | 118 | m_currentItem = item; |
117 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; | 119 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; |
118 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); | 120 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); |
119 | 121 | ||
120 | } | 122 | } |
121 | } | 123 | } |
122 | void AccountView::refreshOutgoing() | 124 | void AccountView::refreshOutgoing() |
123 | { | 125 | { |
124 | m_currentItem = currentItem(); | 126 | m_currentItem = currentItem(); |
125 | if ( !m_currentItem ) return; | 127 | if ( !m_currentItem ) return; |
126 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 128 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
127 | if ( !view->getFolder() ) | 129 | if ( !view->getFolder() ) |
128 | return; | 130 | return; |
129 | QString bName = view->getFolder()->getDisplayName(); | 131 | QString bName = view->getFolder()->getDisplayName(); |
130 | if (bName.startsWith("/")&&bName.length()>1) | 132 | if (bName.startsWith("/")&&bName.length()>1) |
131 | { | 133 | { |
132 | bName.replace(0,1,""); | 134 | bName.replace(0,1,""); |
133 | } | 135 | } |
134 | int pos = bName.findRev("/"); | 136 | int pos = bName.findRev("/"); |
135 | if (pos > 0) | 137 | if (pos > 0) |
136 | { | 138 | { |
137 | bName.replace(0,pos+1,""); | 139 | bName.replace(0,pos+1,""); |
138 | } | 140 | } |
139 | //qDebug("name *%s* ",bName.lower().latin1() ); | 141 | //qDebug("name *%s* ",bName.lower().latin1() ); |
140 | if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { | 142 | if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { |
141 | refreshCurrent(); | 143 | refreshCurrent(); |
142 | // qDebug("refresh "); | 144 | // qDebug("refresh "); |
143 | } | 145 | } |
144 | } | 146 | } |
145 | void AccountView::refreshCurrentSelected() | 147 | void AccountView::refreshCurrentSelected() |
146 | { | 148 | { |
147 | if ( !m_currentItem ) return; | 149 | if ( !m_currentItem ) return; |
148 | QValueList<RecMailP> headerlist; | 150 | Q3ValueList<RecMailP> headerlist; |
149 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 151 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
150 | view->refresh(headerlist); | 152 | view->refresh(headerlist); |
151 | emit refreshMailview(headerlist); | 153 | emit refreshMailview(headerlist); |
152 | topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ; | 154 | topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ; |
153 | } | 155 | } |
154 | 156 | ||
155 | void AccountView::refreshCurrent() | 157 | void AccountView::refreshCurrent() |
156 | { | 158 | { |
157 | m_currentItem = currentItem(); | 159 | m_currentItem = currentItem(); |
158 | if ( !m_currentItem ) return; | 160 | if ( !m_currentItem ) return; |
159 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; | 161 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; |
160 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); | 162 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); |
161 | } | 163 | } |
162 | 164 | ||
163 | void AccountView::refreshAll() | 165 | void AccountView::refreshAll() |
164 | { | 166 | { |
165 | } | 167 | } |
166 | 168 | ||
167 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) | 169 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) |
168 | { | 170 | { |
169 | QListViewItem*item = selectedItem (); | 171 | Q3ListViewItem*item = selectedItem (); |
170 | if (!item) return new RecBody(); | 172 | if (!item) return new RecBody(); |
171 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 173 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
172 | return view->fetchBody(aMail); | 174 | return view->fetchBody(aMail); |
173 | } | 175 | } |
174 | 176 | ||
175 | void AccountView::setupFolderselect(Selectstore*sels) | 177 | void AccountView::setupFolderselect(Selectstore*sels) |
176 | { | 178 | { |
177 | 179 | ||
178 | #ifndef DESKTOP_VERSION | 180 | #ifndef DESKTOP_VERSION |
179 | sels->showMaximized(); | 181 | sels->showMaximized(); |
180 | #else | 182 | #else |
181 | sels->show(); | 183 | sels->show(); |
182 | #endif | 184 | #endif |
183 | QStringList sFolders; | 185 | QStringList sFolders; |
184 | unsigned int i = 0; | 186 | unsigned int i = 0; |
185 | for (i=0; i < mhAccounts.count();++i) | 187 | for (i=0; i < mhAccounts.count();++i) |
186 | { | 188 | { |
187 | mhAccounts[i]->refresh(false); | 189 | mhAccounts[i]->refresh(false); |
188 | sFolders = mhAccounts[i]->subFolders(); | 190 | sFolders = mhAccounts[i]->subFolders(); |
189 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); | 191 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); |
190 | } | 192 | } |
191 | for (i=0; i < imapAccounts.count();++i) | 193 | for (i=0; i < imapAccounts.count();++i) |
192 | { | 194 | { |
193 | if (imapAccounts[i]->offline()) | 195 | if (imapAccounts[i]->offline()) |
194 | continue; | 196 | continue; |
195 | imapAccounts[i]->refreshFolders(false); | 197 | imapAccounts[i]->refreshFolders(false); |
196 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | 198 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); |
197 | } | 199 | } |
198 | } | 200 | } |
199 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) | 201 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) |
200 | { | 202 | { |
201 | #if 0 | 203 | #if 0 |
diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h index 33f3479..14b0ff9 100644 --- a/kmicromail/accountview.h +++ b/kmicromail/accountview.h | |||
@@ -1,48 +1,50 @@ | |||
1 | #ifndef ACCOUNTVIEW_H | 1 | #ifndef ACCOUNTVIEW_H |
2 | #define ACCOUNTVIEW_H | 2 | #define ACCOUNTVIEW_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <q3listview.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | //Added by qt3to4: | ||
7 | #include <Q3ValueList> | ||
6 | #include <opie2/osmartpointer.h> | 8 | #include <opie2/osmartpointer.h> |
7 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
8 | 10 | ||
9 | class Selectstore; | 11 | class Selectstore; |
10 | class Folder; | 12 | class Folder; |
11 | class AbstractMail; | 13 | class AbstractMail; |
12 | class Account; | 14 | class Account; |
13 | class IMAPviewItem; | 15 | class IMAPviewItem; |
14 | class MHviewItem; | 16 | class MHviewItem; |
15 | 17 | ||
16 | class AccountView : public QListView | 18 | class AccountView : public Q3ListView |
17 | { | 19 | { |
18 | Q_OBJECT | 20 | Q_OBJECT |
19 | 21 | ||
20 | public: | 22 | public: |
21 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 23 | AccountView( QWidget *parent = 0, const char *name = 0, Qt::WFlags flags = 0 ); |
22 | virtual ~AccountView(); | 24 | virtual ~AccountView(); |
23 | virtual void populate( QList<Account> list ); | 25 | virtual void populate( QList<Account> list ); |
24 | virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); | 26 | virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); |
25 | virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); | 27 | virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); |
26 | virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); | 28 | virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); |
27 | virtual bool currentisDraft(); | 29 | virtual bool currentisDraft(); |
28 | QValueList<MHviewItem*> allAccounts() { return mhAccounts;} | 30 | Q3ValueList<MHviewItem*> allAccounts() { return mhAccounts;} |
29 | public slots: | 31 | public slots: |
30 | virtual void refreshAll(); | 32 | virtual void refreshAll(); |
31 | virtual void refresh(QListViewItem *item); | 33 | virtual void refresh(Q3ListViewItem *item); |
32 | virtual void refreshCurrent(); | 34 | virtual void refreshCurrent(); |
33 | virtual void refreshCurrentSelected(); | 35 | virtual void refreshCurrentSelected(); |
34 | virtual void refreshOutgoing(); | 36 | virtual void refreshOutgoing(); |
35 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); | 37 | virtual void slotHold(int, Q3ListViewItem *,const QPoint&,int); |
36 | virtual void slotContextMenu(int id); | 38 | virtual void slotContextMenu(int id); |
37 | void setupFolderselect(Selectstore*sels); | 39 | void setupFolderselect(Selectstore*sels); |
38 | 40 | ||
39 | signals: | 41 | signals: |
40 | void refreshMailview(const QValueList<RecMailP>& ); | 42 | void refreshMailview(const Q3ValueList<RecMailP>& ); |
41 | 43 | ||
42 | protected: | 44 | protected: |
43 | QListViewItem* m_currentItem; | 45 | Q3ListViewItem* m_currentItem; |
44 | QValueList<IMAPviewItem*> imapAccounts; | 46 | Q3ValueList<IMAPviewItem*> imapAccounts; |
45 | QValueList<MHviewItem*> mhAccounts; | 47 | Q3ValueList<MHviewItem*> mhAccounts; |
46 | }; | 48 | }; |
47 | 49 | ||
48 | #endif | 50 | #endif |
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 4bc4441..81d7b52 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -9,72 +9,72 @@ | |||
9 | #else | 9 | #else |
10 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
11 | #endif //DESKTOP_VERSION | 11 | #endif //DESKTOP_VERSION |
12 | #include <libkdepim/externalapphandler.h> | 12 | #include <libkdepim/externalapphandler.h> |
13 | 13 | ||
14 | #include "koprefs.h" | 14 | #include "koprefs.h" |
15 | #include <klocale.h> | 15 | #include <klocale.h> |
16 | #include <kglobal.h> | 16 | #include <kglobal.h> |
17 | 17 | ||
18 | #ifdef MINIKDE_KDIALOG_H | 18 | #ifdef MINIKDE_KDIALOG_H |
19 | #undef MINIKDE_KDIALOG_H | 19 | #undef MINIKDE_KDIALOG_H |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | 22 | ||
23 | #include "composemail.h" | 23 | #include "composemail.h" |
24 | 24 | ||
25 | #include <libmailwrapper/smtpwrapper.h> | 25 | #include <libmailwrapper/smtpwrapper.h> |
26 | #include <libmailwrapper/storemail.h> | 26 | #include <libmailwrapper/storemail.h> |
27 | #include <libmailwrapper/abstractmail.h> | 27 | #include <libmailwrapper/abstractmail.h> |
28 | #include <libmailwrapper/mailtypes.h> | 28 | #include <libmailwrapper/mailtypes.h> |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | //#include <opie2/ofiledialog.h> | 31 | //#include <opie2/ofiledialog.h> |
32 | //#include <opie2/odebug.h> | 32 | //#include <opie2/odebug.h> |
33 | #include <kfiledialog.h> | 33 | #include <kfiledialog.h> |
34 | //#include <qpe/resource.h> | 34 | //#include <qpe/resource.h> |
35 | #include <qpe/global.h> | 35 | #include <qpe/global.h> |
36 | //#include <qpe/contact.h> | 36 | //#include <qpe/contact.h> |
37 | 37 | ||
38 | 38 | ||
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
41 | #include <qiconset.h> | 41 | #include <qicon.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
44 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
45 | #include <qmultilineedit.h> | 45 | #include <q3multilineedit.h> |
46 | #include <qlabel.h> | 46 | #include <qlabel.h> |
47 | #include <qtabwidget.h> | 47 | #include <qtabwidget.h> |
48 | #include <qlistview.h> | 48 | #include <q3listview.h> |
49 | 49 | ||
50 | //using namespace Opie::Core; | 50 | //using namespace Opie::Core; |
51 | //using namespace Opie::Ui; | 51 | //using namespace Opie::Ui; |
52 | ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) | 52 | ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) |
53 | : ComposeMailUI( parent, name, modal ) | 53 | : ComposeMailUI( parent, name, modal ) |
54 | { | 54 | { |
55 | 55 | ||
56 | topLevelWidget()->setCaption( i18n("Compose mail - Click OK to send ->") ); | 56 | topLevelWidget()->setCaption( i18n("Compose mail - Click OK to send ->") ); |
57 | mPickLineEdit = 0; | 57 | mPickLineEdit = 0; |
58 | mEncoding = KOPrefs::instance()->mCurrentCodeName; | 58 | mEncoding = KOPrefs::instance()->mCurrentCodeName; |
59 | //managed from opiemail now | 59 | //managed from opiemail now |
60 | //connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 60 | //connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
61 | // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 61 | // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
62 | settings = sett; | 62 | settings = sett; |
63 | m_replyid = ""; | 63 | m_replyid = ""; |
64 | if ( KOPrefs::instance()->mUseKapi) { | 64 | if ( KOPrefs::instance()->mUseKapi) { |
65 | KConfig config( locateLocal("config", "kabcrc") ); | 65 | KConfig config( locateLocal("config", "kabcrc") ); |
66 | config.setGroup( "General" ); | 66 | config.setGroup( "General" ); |
67 | QString whoami_uid = config.readEntry( "WhoAmI" ); | 67 | QString whoami_uid = config.readEntry( "WhoAmI" ); |
68 | 68 | ||
69 | if ( whoami_uid.isEmpty() ) { | 69 | if ( whoami_uid.isEmpty() ) { |
70 | QMessageBox::information( 0, i18n( "Hint" ), | 70 | QMessageBox::information( 0, i18n( "Hint" ), |
71 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 71 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
72 | i18n( "Ok" ) ); | 72 | i18n( "Ok" ) ); |
73 | 73 | ||
74 | 74 | ||
75 | fillSettings(); | 75 | fillSettings(); |
76 | } else | 76 | } else |
77 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | 77 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); |
78 | 78 | ||
79 | 79 | ||
80 | #ifdef DESKTOP_VERSION | 80 | #ifdef DESKTOP_VERSION |
@@ -96,81 +96,81 @@ ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, boo | |||
96 | } | 96 | } |
97 | senderNameEdit->setText(con.formattedName()); | 97 | senderNameEdit->setText(con.formattedName()); |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | } else { | 100 | } else { |
101 | fillSettings(); | 101 | fillSettings(); |
102 | } | 102 | } |
103 | checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); | 103 | checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); |
104 | 104 | ||
105 | attList->addColumn( i18n( "Name" ) ); | 105 | attList->addColumn( i18n( "Name" ) ); |
106 | attList->addColumn( i18n( "Size" ) ); | 106 | attList->addColumn( i18n( "Size" ) ); |
107 | QList<Account> accounts = settings->getAccounts(); | 107 | QList<Account> accounts = settings->getAccounts(); |
108 | 108 | ||
109 | if ( QApplication::desktop()->width() < 320 ) | 109 | if ( QApplication::desktop()->width() < 320 ) |
110 | smtpAccountBox->setMaximumWidth( 80 ); | 110 | smtpAccountBox->setMaximumWidth( 80 ); |
111 | Account *it; | 111 | Account *it; |
112 | for ( it = accounts.first(); it; it = accounts.next() ) { | 112 | for ( it = accounts.first(); it; it = accounts.next() ) { |
113 | if ( it->getType()==MAILLIB::A_SMTP ) { | 113 | if ( it->getType()==MAILLIB::A_SMTP ) { |
114 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 114 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
115 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 115 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
116 | smtpAccounts.append( smtp ); | 116 | smtpAccounts.append( smtp ); |
117 | } | 117 | } |
118 | } | 118 | } |
119 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 119 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
120 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 120 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
121 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 121 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
122 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 122 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
123 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 123 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
124 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 124 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
125 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 125 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
126 | mMail = 0; | 126 | mMail = 0; |
127 | warnAttach = true; | 127 | warnAttach = true; |
128 | QIconSet icon; | 128 | QIcon icon; |
129 | //icon = SmallIcon("fileexport"); | 129 | //icon = SmallIcon("fileexport"); |
130 | icon = SmallIcon("filesave"); | 130 | icon = SmallIcon("filesave"); |
131 | SaveButton->setIconSet (icon ) ; | 131 | SaveButton->setIconSet (icon ) ; |
132 | if ( QApplication::desktop()->width() < 320 ) { | 132 | if ( QApplication::desktop()->width() < 320 ) { |
133 | SaveButton->setText ("") ; | 133 | SaveButton->setText ("") ; |
134 | SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; | 134 | SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; |
135 | } | 135 | } |
136 | else | 136 | else |
137 | SaveButton->setText (i18n("Save")); | 137 | SaveButton->setText (i18n("Save")); |
138 | #ifndef DESKTOP_VERSION | 138 | #ifndef DESKTOP_VERSION |
139 | QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); | 139 | QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); |
140 | QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); | 140 | QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); |
141 | QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); | 141 | QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); |
142 | #endif | 142 | #endif |
143 | message->setFont ( KOPrefs::instance()->mComposeFont ); | 143 | message->setFont ( KOPrefs::instance()->mComposeFont ); |
144 | message->setWordWrap (QMultiLineEdit::WidgetWidth); | 144 | message->setWordWrap (Q3MultiLineEdit::WidgetWidth); |
145 | if ( smtpAccounts.count() > 0 ) { | 145 | if ( smtpAccounts.count() > 0 ) { |
146 | fillValues( smtpAccountBox->currentItem() ); | 146 | fillValues( smtpAccountBox->currentItem() ); |
147 | } else { | 147 | } else { |
148 | QMessageBox::information( 0, i18n( "Problem" ), | 148 | QMessageBox::information( 0, i18n( "Problem" ), |
149 | i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), | 149 | i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), |
150 | i18n( "Ok" ) ); | 150 | i18n( "Ok" ) ); |
151 | return; | 151 | return; |
152 | } | 152 | } |
153 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 153 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
154 | connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) ); | 154 | connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) ); |
155 | if ( smtpAccountBox->count()) | 155 | if ( smtpAccountBox->count()) |
156 | fillValues(0); | 156 | fillValues(0); |
157 | #ifdef DESKTOP_VERSION | 157 | #ifdef DESKTOP_VERSION |
158 | if ( QApplication::desktop()->width() <= 800 ) { | 158 | if ( QApplication::desktop()->width() <= 800 ) { |
159 | resize( QApplication::desktop()->size() ); | 159 | resize( QApplication::desktop()->size() ); |
160 | } else | 160 | } else |
161 | resize( 800, 600 ); | 161 | resize( 800, 600 ); |
162 | if ( QApplication::desktop()->width() >= 640 ) | 162 | if ( QApplication::desktop()->width() >= 640 ) |
163 | senderNameEdit->setFixedWidth( 200 ); | 163 | senderNameEdit->setFixedWidth( 200 ); |
164 | #endif | 164 | #endif |
165 | } | 165 | } |
166 | 166 | ||
167 | void ComposeMail::fillSettings() | 167 | void ComposeMail::fillSettings() |
168 | { | 168 | { |
169 | if ( QApplication::desktop()->width() < 320 ) | 169 | if ( QApplication::desktop()->width() < 320 ) |
170 | fromBox->setMaximumWidth( 100 ); | 170 | fromBox->setMaximumWidth( 100 ); |
171 | QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); | 171 | QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); |
172 | QStringList::ConstIterator sit = mailList.begin(); | 172 | QStringList::ConstIterator sit = mailList.begin(); |
173 | int pref = 0; | 173 | int pref = 0; |
174 | for (;sit!=mailList.end();++sit) { | 174 | for (;sit!=mailList.end();++sit) { |
175 | fromBox->insertItem((*sit)); | 175 | fromBox->insertItem((*sit)); |
176 | } | 176 | } |
@@ -505,42 +505,42 @@ void ComposeMail::reject() | |||
505 | } | 505 | } |
506 | if (yesno == 2) { | 506 | if (yesno == 2) { |
507 | qDebug("return "); | 507 | qDebug("return "); |
508 | return; | 508 | return; |
509 | } | 509 | } |
510 | QDialog::reject(); | 510 | QDialog::reject(); |
511 | } | 511 | } |
512 | 512 | ||
513 | void ComposeMail::setCharset(const QString& charset) | 513 | void ComposeMail::setCharset(const QString& charset) |
514 | { | 514 | { |
515 | if ( !charset.isEmpty() ) | 515 | if ( !charset.isEmpty() ) |
516 | mEncoding = charset; | 516 | mEncoding = charset; |
517 | qDebug("ComposeMail::setCharset %s ", mEncoding.latin1()); | 517 | qDebug("ComposeMail::setCharset %s ", mEncoding.latin1()); |
518 | } | 518 | } |
519 | ComposeMail::~ComposeMail() | 519 | ComposeMail::~ComposeMail() |
520 | { | 520 | { |
521 | } | 521 | } |
522 | 522 | ||
523 | void ComposeMail::reEditMail(const RecMailP¤t) | 523 | void ComposeMail::reEditMail(const RecMailP¤t) |
524 | { | 524 | { |
525 | RecMailP data = current; | 525 | RecMailP data = current; |
526 | RecBodyP body = data->Wrapper()->fetchBody(current); | 526 | RecBodyP body = data->Wrapper()->fetchBody(current); |
527 | 527 | ||
528 | message->setText(body->Bodytext()); | 528 | message->setText(body->Bodytext()); |
529 | subjectLine->setText( data->getSubject()); | 529 | subjectLine->setText( data->getSubject()); |
530 | toLine->setText(data->To().join(",")); | 530 | toLine->setText(data->To().join(",")); |
531 | ccLine->setText(data->CC().join(",")); | 531 | ccLine->setText(data->CC().join(",")); |
532 | bccLine->setText(data->Bcc().join(",")); | 532 | bccLine->setText(data->Bcc().join(",")); |
533 | replyLine->setText(data->Replyto()); | 533 | replyLine->setText(data->Replyto()); |
534 | setCharset(body->getCharset()); | 534 | setCharset(body->getCharset()); |
535 | } | 535 | } |
536 | 536 | ||
537 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 537 | AttachViewItem::AttachViewItem( Q3ListView *parent, Attachment *att ) |
538 | : QListViewItem( parent ) | 538 | : Q3ListViewItem( parent ) |
539 | { | 539 | { |
540 | attachment = att; | 540 | attachment = att; |
541 | if ( !attachment->getPixmap().isNull() ) | 541 | if ( !attachment->getPixmap().isNull() ) |
542 | setPixmap( 0,attachment->getPixmap() ); | 542 | setPixmap( 0,attachment->getPixmap() ); |
543 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 543 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
544 | setText( 1, QString::number( att->getSize() ) ); | 544 | setText( 1, QString::number( att->getSize() ) ); |
545 | } | 545 | } |
546 | 546 | ||
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h index 966ac3e..9aef4e1 100644 --- a/kmicromail/composemail.h +++ b/kmicromail/composemail.h | |||
@@ -1,37 +1,37 @@ | |||
1 | #ifndef COMPOSEMAIL_H | 1 | #ifndef COMPOSEMAIL_H |
2 | #define COMPOSEMAIL_H | 2 | #define COMPOSEMAIL_H |
3 | 3 | ||
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qlistview.h> | 5 | #include <q3listview.h> |
6 | 6 | ||
7 | #include "composemailui.h" | 7 | #include "composemailui.h" |
8 | //#include "addresspickerui.h" | 8 | //#include "addresspickerui.h" |
9 | #include <libmailwrapper/settings.h> | 9 | #include <libmailwrapper/settings.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 10 | #include <libmailwrapper/mailwrapper.h> |
11 | 11 | ||
12 | class RecMail; | 12 | class RecMail; |
13 | 13 | ||
14 | #include <opie2/osmartpointer.h> | 14 | #include <opie2/osmartpointer.h> |
15 | #if 0 | 15 | #if 0 |
16 | class AddressPicker : public AddressPickerUI | 16 | class AddressPicker : public AddressPickerUI |
17 | { | 17 | { |
18 | //Q_OBJECT | 18 | //Q_OBJECT |
19 | 19 | ||
20 | public: | 20 | public: |
21 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false ); | 21 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false ); |
22 | static QString getNames(); | 22 | static QString getNames(); |
23 | 23 | ||
24 | protected: | 24 | protected: |
25 | QString selectedNames; | 25 | QString selectedNames; |
26 | void accept(); | 26 | void accept(); |
27 | 27 | ||
28 | }; | 28 | }; |
29 | #endif | 29 | #endif |
30 | class RecMail; | 30 | class RecMail; |
31 | 31 | ||
32 | class ComposeMail : public ComposeMailUI | 32 | class ComposeMail : public ComposeMailUI |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | 37 | ||
@@ -51,44 +51,44 @@ public slots: | |||
51 | void setCharset(const QString&); | 51 | void setCharset(const QString&); |
52 | 52 | ||
53 | 53 | ||
54 | protected slots: | 54 | protected slots: |
55 | void accept(); | 55 | void accept(); |
56 | void reject(); | 56 | void reject(); |
57 | 57 | ||
58 | private slots: | 58 | private slots: |
59 | void fillValues( int current ); | 59 | void fillValues( int current ); |
60 | void fillSettings(); | 60 | void fillSettings(); |
61 | void pickAddress(); | 61 | void pickAddress(); |
62 | void pickAddressTo(); | 62 | void pickAddressTo(); |
63 | void pickAddressCC(); | 63 | void pickAddressCC(); |
64 | void pickAddressBCC(); | 64 | void pickAddressBCC(); |
65 | void pickAddressReply(); | 65 | void pickAddressReply(); |
66 | void saveAsDraft(); | 66 | void saveAsDraft(); |
67 | void addAttachment(); | 67 | void addAttachment(); |
68 | void removeAttachment(); | 68 | void removeAttachment(); |
69 | void clearStatus(); | 69 | void clearStatus(); |
70 | void setStatus( QString ); | 70 | void setStatus( QString ); |
71 | void saveSig(); | 71 | void saveSig(); |
72 | 72 | ||
73 | protected: | 73 | protected: |
74 | QLineEdit* mPickLineEdit; | 74 | QLineEdit* mPickLineEdit; |
75 | Opie::Core::OSmartPointer<Mail> mMail; | 75 | Opie::Core::OSmartPointer<Mail> mMail; |
76 | Settings *settings; | 76 | Settings *settings; |
77 | QList<SMTPaccount> smtpAccounts; | 77 | QList<SMTPaccount> smtpAccounts; |
78 | QString m_replyid; | 78 | QString m_replyid; |
79 | QString mEncoding; | 79 | QString mEncoding; |
80 | bool warnAttach; | 80 | bool warnAttach; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | class AttachViewItem : public QListViewItem | 83 | class AttachViewItem : public Q3ListViewItem |
84 | { | 84 | { |
85 | public: | 85 | public: |
86 | AttachViewItem( QListView *parent, Attachment *att ); | 86 | AttachViewItem( Q3ListView *parent, Attachment *att ); |
87 | Attachment *getAttachment() { return attachment; } | 87 | Attachment *getAttachment() { return attachment; } |
88 | 88 | ||
89 | private: | 89 | private: |
90 | Attachment *attachment; | 90 | Attachment *attachment; |
91 | 91 | ||
92 | }; | 92 | }; |
93 | 93 | ||
94 | #endif | 94 | #endif |
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 2c0f2d8..f274dc3 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp | |||
@@ -1,86 +1,86 @@ | |||
1 | 1 | ||
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include "kapplication.h" | 3 | #include "kapplication.h" |
4 | #include "defines.h" | 4 | #include "defines.h" |
5 | #include "editaccounts.h" | 5 | #include "editaccounts.h" |
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | 8 | ||
9 | /* QT */ | 9 | /* QT */ |
10 | #include <qstringlist.h> | 10 | #include <qstringlist.h> |
11 | 11 | ||
12 | #include <qcombobox.h> | 12 | #include <qcombobox.h> |
13 | #include <qcheckbox.h> | 13 | #include <qcheckbox.h> |
14 | #include <qmessagebox.h> | 14 | #include <qmessagebox.h> |
15 | #include <qpushbutton.h> | 15 | #include <qpushbutton.h> |
16 | #include <qlineedit.h> | 16 | #include <qlineedit.h> |
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | #include <qtabwidget.h> | 18 | #include <qtabwidget.h> |
19 | #include <qlistview.h> | 19 | #include <q3listview.h> |
20 | #include <qspinbox.h> | 20 | #include <qspinbox.h> |
21 | #include <klocale.h> | 21 | #include <klocale.h> |
22 | #include <kfiledialog.h> | 22 | #include <kfiledialog.h> |
23 | 23 | ||
24 | #include <libmailwrapper/nntpwrapper.h> | 24 | #include <libmailwrapper/nntpwrapper.h> |
25 | 25 | ||
26 | using namespace Opie::Core; | 26 | using namespace Opie::Core; |
27 | 27 | ||
28 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 28 | AccountListItem::AccountListItem( Q3ListView *parent, Account *a) |
29 | : QListViewItem( parent ) | 29 | : Q3ListViewItem( parent ) |
30 | { | 30 | { |
31 | account = a; | 31 | account = a; |
32 | setText( 0, account->getAccountName() ); | 32 | setText( 0, account->getAccountName() ); |
33 | QString ttext = ""; | 33 | QString ttext = ""; |
34 | switch (account->getType()) { | 34 | switch (account->getType()) { |
35 | case MAILLIB::A_NNTP: | 35 | case MAILLIB::A_NNTP: |
36 | ttext="NNTP"; | 36 | ttext="NNTP"; |
37 | break; | 37 | break; |
38 | case MAILLIB::A_POP3: | 38 | case MAILLIB::A_POP3: |
39 | ttext = "POP3"; | 39 | ttext = "POP3"; |
40 | break; | 40 | break; |
41 | case MAILLIB::A_IMAP: | 41 | case MAILLIB::A_IMAP: |
42 | ttext = "IMAP"; | 42 | ttext = "IMAP"; |
43 | break; | 43 | break; |
44 | case MAILLIB::A_SMTP: | 44 | case MAILLIB::A_SMTP: |
45 | ttext = "SMTP"; | 45 | ttext = "SMTP"; |
46 | break; | 46 | break; |
47 | default: | 47 | default: |
48 | ttext = "UNKNOWN"; | 48 | ttext = "UNKNOWN"; |
49 | break; | 49 | break; |
50 | } | 50 | } |
51 | setText( 1, ttext); | 51 | setText( 1, ttext); |
52 | } | 52 | } |
53 | 53 | ||
54 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 54 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, Qt::WFlags flags ) |
55 | : EditAccountsUI( parent, name, modal, flags ) | 55 | : EditAccountsUI( parent, name, modal, flags ) |
56 | { | 56 | { |
57 | settings = s; | 57 | settings = s; |
58 | 58 | ||
59 | mailList->addColumn( i18n( "Account" ) ); | 59 | mailList->addColumn( i18n( "Account" ) ); |
60 | mailList->addColumn( i18n( "Type" ) ); | 60 | mailList->addColumn( i18n( "Type" ) ); |
61 | 61 | ||
62 | newsList->addColumn( i18n( "Account" ) ); | 62 | newsList->addColumn( i18n( "Account" ) ); |
63 | 63 | ||
64 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 64 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
65 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 65 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
66 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 66 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
67 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 67 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
68 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 68 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
69 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 69 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
70 | 70 | ||
71 | slotFillLists(); | 71 | slotFillLists(); |
72 | } | 72 | } |
73 | 73 | ||
74 | void EditAccounts::slotFillLists() | 74 | void EditAccounts::slotFillLists() |
75 | { | 75 | { |
76 | mailList->clear(); | 76 | mailList->clear(); |
77 | newsList->clear(); | 77 | newsList->clear(); |
78 | 78 | ||
79 | QList<Account> accounts = settings->getAccounts(); | 79 | QList<Account> accounts = settings->getAccounts(); |
80 | Account *it; | 80 | Account *it; |
81 | for ( it = accounts.first(); it; it = accounts.next() ) | 81 | for ( it = accounts.first(); it; it = accounts.next() ) |
82 | { | 82 | { |
83 | if ( it->getType()==MAILLIB::A_NNTP ) | 83 | if ( it->getType()==MAILLIB::A_NNTP ) |
84 | { | 84 | { |
85 | (void) new AccountListItem( newsList, it ); | 85 | (void) new AccountListItem( newsList, it ); |
86 | } | 86 | } |
@@ -279,82 +279,82 @@ void EditAccounts::slotDeleteNews() | |||
279 | return; | 279 | return; |
280 | } | 280 | } |
281 | 281 | ||
282 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 282 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
283 | slotDeleteAccount( a ); | 283 | slotDeleteAccount( a ); |
284 | } | 284 | } |
285 | 285 | ||
286 | void EditAccounts::slotAdjustColumns() | 286 | void EditAccounts::slotAdjustColumns() |
287 | { | 287 | { |
288 | int currPage = configTab->currentPageIndex(); | 288 | int currPage = configTab->currentPageIndex(); |
289 | 289 | ||
290 | configTab->showPage( mailTab ); | 290 | configTab->showPage( mailTab ); |
291 | mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); | 291 | mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); |
292 | mailList->setColumnWidth( 1, 50 ); | 292 | mailList->setColumnWidth( 1, 50 ); |
293 | 293 | ||
294 | configTab->showPage( newsTab ); | 294 | configTab->showPage( newsTab ); |
295 | newsList->setColumnWidth( 0, newsList->visibleWidth() ); | 295 | newsList->setColumnWidth( 0, newsList->visibleWidth() ); |
296 | 296 | ||
297 | configTab->setCurrentPage( currPage ); | 297 | configTab->setCurrentPage( currPage ); |
298 | } | 298 | } |
299 | 299 | ||
300 | void EditAccounts::accept() | 300 | void EditAccounts::accept() |
301 | { | 301 | { |
302 | settings->saveAccounts(); | 302 | settings->saveAccounts(); |
303 | 303 | ||
304 | QDialog::accept(); | 304 | QDialog::accept(); |
305 | } | 305 | } |
306 | 306 | ||
307 | /** | 307 | /** |
308 | * SelectMailType | 308 | * SelectMailType |
309 | */ | 309 | */ |
310 | 310 | ||
311 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) | 311 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, Qt::WFlags flags ) |
312 | : SelectMailTypeUI( parent, name, modal, flags ) | 312 | : SelectMailTypeUI( parent, name, modal, flags ) |
313 | { | 313 | { |
314 | selected = selection; | 314 | selected = selection; |
315 | selected->replace( 0, selected->length(), typeBox->currentText() ); | 315 | selected->replace( 0, selected->length(), typeBox->currentText() ); |
316 | connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); | 316 | connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); |
317 | } | 317 | } |
318 | 318 | ||
319 | void SelectMailType::slotSelection( const QString &sel ) | 319 | void SelectMailType::slotSelection( const QString &sel ) |
320 | { | 320 | { |
321 | selected->replace( 0, selected->length(), sel ); | 321 | selected->replace( 0, selected->length(), sel ); |
322 | } | 322 | } |
323 | 323 | ||
324 | /** | 324 | /** |
325 | * IMAPconfig | 325 | * IMAPconfig |
326 | */ | 326 | */ |
327 | 327 | ||
328 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 328 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags ) |
329 | : IMAPconfigUI( parent, name, modal, flags ) | 329 | : IMAPconfigUI( parent, name, modal, flags ) |
330 | { | 330 | { |
331 | data = account; | 331 | data = account; |
332 | 332 | ||
333 | //fillValues(); | 333 | //fillValues(); |
334 | 334 | ||
335 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 335 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
336 | ComboBox1->insertItem( "Only if available", 0 ); | 336 | ComboBox1->insertItem( "Only if available", 0 ); |
337 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 337 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
338 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 338 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
339 | ComboBox1->insertItem( "Run command instead", 3 ); | 339 | ComboBox1->insertItem( "Run command instead", 3 ); |
340 | CommandEdit->hide(); | 340 | CommandEdit->hide(); |
341 | fillValues(); | 341 | fillValues(); |
342 | // ComboBox1->setCurrentItem( data->ConnectionType() ); | 342 | // ComboBox1->setCurrentItem( data->ConnectionType() ); |
343 | } | 343 | } |
344 | 344 | ||
345 | void IMAPconfig::slotConnectionToggle( int index ) | 345 | void IMAPconfig::slotConnectionToggle( int index ) |
346 | { | 346 | { |
347 | if ( index == 2 ) | 347 | if ( index == 2 ) |
348 | { | 348 | { |
349 | portLine->setText( IMAP_SSL_PORT ); | 349 | portLine->setText( IMAP_SSL_PORT ); |
350 | CommandEdit->hide(); | 350 | CommandEdit->hide(); |
351 | } | 351 | } |
352 | else if ( index == 3 ) | 352 | else if ( index == 3 ) |
353 | { | 353 | { |
354 | portLine->setText( IMAP_PORT ); | 354 | portLine->setText( IMAP_PORT ); |
355 | CommandEdit->show(); | 355 | CommandEdit->show(); |
356 | } | 356 | } |
357 | else | 357 | else |
358 | { | 358 | { |
359 | portLine->setText( IMAP_PORT ); | 359 | portLine->setText( IMAP_PORT ); |
360 | CommandEdit->hide(); | 360 | CommandEdit->hide(); |
@@ -379,65 +379,65 @@ void IMAPconfig::fillValues() | |||
379 | CheckBoxDown->setChecked( false ); | 379 | CheckBoxDown->setChecked( false ); |
380 | SpinBoxDown->setValue ( 5 ); | 380 | SpinBoxDown->setValue ( 5 ); |
381 | } | 381 | } |
382 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | 382 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); |
383 | } | 383 | } |
384 | 384 | ||
385 | void IMAPconfig::accept() | 385 | void IMAPconfig::accept() |
386 | { | 386 | { |
387 | if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { | 387 | if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { |
388 | QMessageBox::information( this, i18n( "Error" ), | 388 | QMessageBox::information( this, i18n( "Error" ), |
389 | i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), | 389 | i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), |
390 | i18n( "Ok" ) ); | 390 | i18n( "Ok" ) ); |
391 | return; | 391 | return; |
392 | } | 392 | } |
393 | data->setAccountName( accountLine->text() ); | 393 | data->setAccountName( accountLine->text() ); |
394 | data->setServer( serverLine->text() ); | 394 | data->setServer( serverLine->text() ); |
395 | data->setPort( portLine->text() ); | 395 | data->setPort( portLine->text() ); |
396 | data->setConnectionType( ComboBox1->currentItem() ); | 396 | data->setConnectionType( ComboBox1->currentItem() ); |
397 | data->setUser( userLine->text() ); | 397 | data->setUser( userLine->text() ); |
398 | data->setPassword( passLine->text() ); | 398 | data->setPassword( passLine->text() ); |
399 | data->setPrefix(prefixLine->text()); | 399 | data->setPrefix(prefixLine->text()); |
400 | data->setLocalFolder( localFolder->text() ); | 400 | data->setLocalFolder( localFolder->text() ); |
401 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 401 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
402 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | 402 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); |
403 | 403 | ||
404 | QDialog::accept(); | 404 | QDialog::accept(); |
405 | } | 405 | } |
406 | 406 | ||
407 | /** | 407 | /** |
408 | * POP3config | 408 | * POP3config |
409 | */ | 409 | */ |
410 | 410 | ||
411 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 411 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags ) |
412 | : POP3configUI( parent, name, modal, flags ) | 412 | : POP3configUI( parent, name, modal, flags ) |
413 | { | 413 | { |
414 | data = account; | 414 | data = account; |
415 | //fillValues(); | 415 | //fillValues(); |
416 | 416 | ||
417 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 417 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
418 | ComboBox1->insertItem( "Only if available", 0 ); | 418 | ComboBox1->insertItem( "Only if available", 0 ); |
419 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 419 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
420 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 420 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
421 | ComboBox1->insertItem( "Run command instead", 3 ); | 421 | ComboBox1->insertItem( "Run command instead", 3 ); |
422 | CommandEdit->hide(); | 422 | CommandEdit->hide(); |
423 | fillValues(); | 423 | fillValues(); |
424 | //ComboBox1->setCurrentItem( data->ConnectionType() ); | 424 | //ComboBox1->setCurrentItem( data->ConnectionType() ); |
425 | } | 425 | } |
426 | 426 | ||
427 | void POP3config::slotConnectionToggle( int index ) | 427 | void POP3config::slotConnectionToggle( int index ) |
428 | { | 428 | { |
429 | // 2 is ssl connection | 429 | // 2 is ssl connection |
430 | if ( index == 2 ) | 430 | if ( index == 2 ) |
431 | { | 431 | { |
432 | portLine->setText( POP3_SSL_PORT ); | 432 | portLine->setText( POP3_SSL_PORT ); |
433 | CommandEdit->hide(); | 433 | CommandEdit->hide(); |
434 | } | 434 | } |
435 | else if ( index == 3 ) | 435 | else if ( index == 3 ) |
436 | { | 436 | { |
437 | portLine->setText( POP3_PORT ); | 437 | portLine->setText( POP3_PORT ); |
438 | CommandEdit->show(); | 438 | CommandEdit->show(); |
439 | } | 439 | } |
440 | else | 440 | else |
441 | { | 441 | { |
442 | portLine->setText( POP3_PORT ); | 442 | portLine->setText( POP3_PORT ); |
443 | CommandEdit->hide(); | 443 | CommandEdit->hide(); |
@@ -460,74 +460,74 @@ void POP3config::fillValues() | |||
460 | } else { | 460 | } else { |
461 | CheckBoxDown->setChecked( false ); | 461 | CheckBoxDown->setChecked( false ); |
462 | SpinBoxDown->setValue ( 5 ); | 462 | SpinBoxDown->setValue ( 5 ); |
463 | } | 463 | } |
464 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | 464 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); |
465 | } | 465 | } |
466 | 466 | ||
467 | void POP3config::accept() | 467 | void POP3config::accept() |
468 | { | 468 | { |
469 | if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { | 469 | if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { |
470 | QMessageBox::information( this, i18n( "Error" ), | 470 | QMessageBox::information( this, i18n( "Error" ), |
471 | i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), | 471 | i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), |
472 | i18n( "Ok" ) ); | 472 | i18n( "Ok" ) ); |
473 | return; | 473 | return; |
474 | } | 474 | } |
475 | data->setAccountName( accountLine->text() ); | 475 | data->setAccountName( accountLine->text() ); |
476 | data->setServer( serverLine->text() ); | 476 | data->setServer( serverLine->text() ); |
477 | data->setPort( portLine->text() ); | 477 | data->setPort( portLine->text() ); |
478 | data->setConnectionType( ComboBox1->currentItem() ); | 478 | data->setConnectionType( ComboBox1->currentItem() ); |
479 | data->setUser( userLine->text() ); | 479 | data->setUser( userLine->text() ); |
480 | data->setPassword( passLine->text() ); | 480 | data->setPassword( passLine->text() ); |
481 | data->setLocalFolder( localFolder->text() ); | 481 | data->setLocalFolder( localFolder->text() ); |
482 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 482 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
483 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | 483 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); |
484 | 484 | ||
485 | QDialog::accept(); | 485 | QDialog::accept(); |
486 | } | 486 | } |
487 | 487 | ||
488 | /** | 488 | /** |
489 | * SMTPconfig | 489 | * SMTPconfig |
490 | */ | 490 | */ |
491 | 491 | ||
492 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 492 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags ) |
493 | : SMTPconfigUI( parent, name, modal, flags ) | 493 | : SMTPconfigUI( parent, name, modal, flags ) |
494 | { | 494 | { |
495 | data = account; | 495 | data = account; |
496 | 496 | ||
497 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 497 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
498 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 498 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
499 | 499 | ||
500 | // fillValues(); | 500 | // fillValues(); |
501 | QIconSet icon; | 501 | QIcon icon; |
502 | //icon = SmallIcon("fileexport"); | 502 | //icon = SmallIcon("fileexport"); |
503 | icon = SmallIcon("fileopen"); | 503 | icon = SmallIcon("fileopen"); |
504 | SignaturButton->setText(""); | 504 | SignaturButton->setText(""); |
505 | SignaturButton->setIconSet (icon ) ; | 505 | SignaturButton->setIconSet (icon ) ; |
506 | SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; | 506 | SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; |
507 | connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); | 507 | connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); |
508 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 508 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
509 | ComboBox1->insertItem( "No secure connection, no TLS", 0 ); | 509 | ComboBox1->insertItem( "No secure connection, no TLS", 0 ); |
510 | ComboBox1->insertItem( "Only if available, try TLS", 1 ); | 510 | ComboBox1->insertItem( "Only if available, try TLS", 1 ); |
511 | ComboBox1->insertItem( "Always, use TLS", 2 ); | 511 | ComboBox1->insertItem( "Always, use TLS", 2 ); |
512 | ComboBox1->insertItem( "Connect on secure port (SSL)", 3 ); | 512 | ComboBox1->insertItem( "Connect on secure port (SSL)", 3 ); |
513 | ComboBox1->insertItem( "Run command instead", 4 ); | 513 | ComboBox1->insertItem( "Run command instead", 4 ); |
514 | CommandEdit->hide(); | 514 | CommandEdit->hide(); |
515 | fillValues(); | 515 | fillValues(); |
516 | //ComboBox1->setCurrentItem( data->ConnectionType() ); | 516 | //ComboBox1->setCurrentItem( data->ConnectionType() ); |
517 | } | 517 | } |
518 | void SMTPconfig::chooseSig() | 518 | void SMTPconfig::chooseSig() |
519 | { | 519 | { |
520 | QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); | 520 | QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); |
521 | if ( !lnk.isEmpty() ) { | 521 | if ( !lnk.isEmpty() ) { |
522 | SignaturEdit->setText( lnk ); | 522 | SignaturEdit->setText( lnk ); |
523 | } | 523 | } |
524 | } | 524 | } |
525 | void SMTPconfig::slotConnectionToggle( int index ) | 525 | void SMTPconfig::slotConnectionToggle( int index ) |
526 | { | 526 | { |
527 | // 3 is ssl connection | 527 | // 3 is ssl connection |
528 | if ( index == 3 ) | 528 | if ( index == 3 ) |
529 | { | 529 | { |
530 | portLine->setText( SMTP_SSL_PORT ); | 530 | portLine->setText( SMTP_SSL_PORT ); |
531 | CommandEdit->hide(); | 531 | CommandEdit->hide(); |
532 | } | 532 | } |
533 | else if ( index == 4 ) | 533 | else if ( index == 4 ) |
@@ -543,161 +543,161 @@ void SMTPconfig::slotConnectionToggle( int index ) | |||
543 | } | 543 | } |
544 | 544 | ||
545 | void SMTPconfig::fillValues() | 545 | void SMTPconfig::fillValues() |
546 | { | 546 | { |
547 | accountLine->setText( data->getAccountName() ); | 547 | accountLine->setText( data->getAccountName() ); |
548 | serverLine->setText( data->getServer() ); | 548 | serverLine->setText( data->getServer() ); |
549 | portLine->setText( data->getPort() ); | 549 | portLine->setText( data->getPort() ); |
550 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 550 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
551 | loginBox->setChecked( data->getLogin() ); | 551 | loginBox->setChecked( data->getLogin() ); |
552 | userLine->setText( data->getUser() ); | 552 | userLine->setText( data->getUser() ); |
553 | passLine->setText( data->getPassword() ); | 553 | passLine->setText( data->getPassword() ); |
554 | SignaturEdit->setText( data->getSigFile() ); | 554 | SignaturEdit->setText( data->getSigFile() ); |
555 | } | 555 | } |
556 | 556 | ||
557 | void SMTPconfig::accept() | 557 | void SMTPconfig::accept() |
558 | { | 558 | { |
559 | data->setAccountName( accountLine->text() ); | 559 | data->setAccountName( accountLine->text() ); |
560 | data->setServer( serverLine->text() ); | 560 | data->setServer( serverLine->text() ); |
561 | data->setPort( portLine->text() ); | 561 | data->setPort( portLine->text() ); |
562 | data->setConnectionType( ComboBox1->currentItem() ); | 562 | data->setConnectionType( ComboBox1->currentItem() ); |
563 | data->setLogin( loginBox->isChecked() ); | 563 | data->setLogin( loginBox->isChecked() ); |
564 | data->setUser( userLine->text() ); | 564 | data->setUser( userLine->text() ); |
565 | data->setPassword( passLine->text() ); | 565 | data->setPassword( passLine->text() ); |
566 | data->setSigFile( SignaturEdit->text() ); | 566 | data->setSigFile( SignaturEdit->text() ); |
567 | 567 | ||
568 | QDialog::accept(); | 568 | QDialog::accept(); |
569 | } | 569 | } |
570 | 570 | ||
571 | /** | 571 | /** |
572 | * NNTPconfig | 572 | * NNTPconfig |
573 | */ | 573 | */ |
574 | 574 | ||
575 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 575 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags ) |
576 | : NNTPconfigUI( parent, name, modal, flags ) | 576 | : NNTPconfigUI( parent, name, modal, flags ) |
577 | { | 577 | { |
578 | data = account; | 578 | data = account; |
579 | 579 | ||
580 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 580 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
581 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 581 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
582 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); | 582 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); |
583 | connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); | 583 | connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); |
584 | connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); | 584 | connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); |
585 | fillValues(); | 585 | fillValues(); |
586 | 586 | ||
587 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); | 587 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); |
588 | } | 588 | } |
589 | 589 | ||
590 | void NNTPconfig::slotShowSub() | 590 | void NNTPconfig::slotShowSub() |
591 | { | 591 | { |
592 | save(); | 592 | save(); |
593 | data->save(); | 593 | data->save(); |
594 | ListViewGroups->clear(); | 594 | ListViewGroups->clear(); |
595 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | 595 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { |
596 | QCheckListItem *item; | 596 | Q3CheckListItem *item; |
597 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 597 | item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox ); |
598 | item->setOn( true ); | 598 | item->setOn( true ); |
599 | } | 599 | } |
600 | topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); | 600 | topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); |
601 | } | 601 | } |
602 | void NNTPconfig::slotShowFilter() | 602 | void NNTPconfig::slotShowFilter() |
603 | { | 603 | { |
604 | save(); | 604 | save(); |
605 | data->save(); | 605 | data->save(); |
606 | ListViewGroups->clear(); | 606 | ListViewGroups->clear(); |
607 | int count = 0; | 607 | int count = 0; |
608 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { | 608 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { |
609 | QCheckListItem *item; | 609 | Q3CheckListItem *item; |
610 | if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { | 610 | if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { |
611 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 611 | item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox ); |
612 | ++count; | 612 | ++count; |
613 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | 613 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
614 | item->setOn( true ); | 614 | item->setOn( true ); |
615 | } | 615 | } |
616 | } | 616 | } |
617 | } | 617 | } |
618 | topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); | 618 | topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); |
619 | } | 619 | } |
620 | void NNTPconfig::slotGetNG() { | 620 | void NNTPconfig::slotGetNG() { |
621 | save(); | 621 | save(); |
622 | data->save(); | 622 | data->save(); |
623 | topLevelWidget()->setCaption( i18n("Fetching group list...")); | 623 | topLevelWidget()->setCaption( i18n("Fetching group list...")); |
624 | qApp->processEvents(); | 624 | qApp->processEvents(); |
625 | NNTPwrapper* tmp = new NNTPwrapper( data ); | 625 | NNTPwrapper* tmp = new NNTPwrapper( data ); |
626 | allGroups = tmp->listAllNewsgroups(); | 626 | allGroups = tmp->listAllNewsgroups(); |
627 | topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); | 627 | topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); |
628 | 628 | ||
629 | ListViewGroups->clear(); | 629 | ListViewGroups->clear(); |
630 | 630 | ||
631 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { | 631 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { |
632 | QCheckListItem *item; | 632 | Q3CheckListItem *item; |
633 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 633 | item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox ); |
634 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | 634 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
635 | item->setOn( true ); | 635 | item->setOn( true ); |
636 | 636 | ||
637 | } | 637 | } |
638 | } | 638 | } |
639 | delete tmp; | 639 | delete tmp; |
640 | } | 640 | } |
641 | 641 | ||
642 | void NNTPconfig::slotSSL( bool enabled ) | 642 | void NNTPconfig::slotSSL( bool enabled ) |
643 | { | 643 | { |
644 | if ( enabled ) | 644 | if ( enabled ) |
645 | { | 645 | { |
646 | portLine->setText( NNTP_SSL_PORT ); | 646 | portLine->setText( NNTP_SSL_PORT ); |
647 | } | 647 | } |
648 | else | 648 | else |
649 | { | 649 | { |
650 | portLine->setText( NNTP_PORT ); | 650 | portLine->setText( NNTP_PORT ); |
651 | } | 651 | } |
652 | } | 652 | } |
653 | 653 | ||
654 | void NNTPconfig::fillValues() | 654 | void NNTPconfig::fillValues() |
655 | { | 655 | { |
656 | accountLine->setText( data->getAccountName() ); | 656 | accountLine->setText( data->getAccountName() ); |
657 | serverLine->setText( data->getServer() ); | 657 | serverLine->setText( data->getServer() ); |
658 | portLine->setText( data->getPort() ); | 658 | portLine->setText( data->getPort() ); |
659 | sslBox->setChecked( data->getSSL() ); | 659 | sslBox->setChecked( data->getSSL() ); |
660 | loginBox->setChecked( data->getLogin() ); | 660 | loginBox->setChecked( data->getLogin() ); |
661 | userLine->setText( data->getUser() ); | 661 | userLine->setText( data->getUser() ); |
662 | passLine->setText( data->getPassword() ); | 662 | passLine->setText( data->getPassword() ); |
663 | subscribedGroups = data->getGroups(); | 663 | subscribedGroups = data->getGroups(); |
664 | /* don't forget that - you will overwrite values if user clicks cancel! */ | 664 | /* don't forget that - you will overwrite values if user clicks cancel! */ |
665 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | 665 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { |
666 | QCheckListItem *item; | 666 | Q3CheckListItem *item; |
667 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 667 | item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox ); |
668 | item->setOn( true ); | 668 | item->setOn( true ); |
669 | } | 669 | } |
670 | } | 670 | } |
671 | 671 | ||
672 | void NNTPconfig::save() | 672 | void NNTPconfig::save() |
673 | { | 673 | { |
674 | data->setAccountName( accountLine->text() ); | 674 | data->setAccountName( accountLine->text() ); |
675 | data->setServer( serverLine->text() ); | 675 | data->setServer( serverLine->text() ); |
676 | data->setPort( portLine->text() ); | 676 | data->setPort( portLine->text() ); |
677 | data->setSSL( sslBox->isChecked() ); | 677 | data->setSSL( sslBox->isChecked() ); |
678 | data->setLogin( loginBox->isChecked() ); | 678 | data->setLogin( loginBox->isChecked() ); |
679 | data->setUser( userLine->text() ); | 679 | data->setUser( userLine->text() ); |
680 | data->setPassword( passLine->text() ); | 680 | data->setPassword( passLine->text() ); |
681 | 681 | ||
682 | QListViewItemIterator list_it( ListViewGroups ); | 682 | Q3ListViewItemIterator list_it( ListViewGroups ); |
683 | 683 | ||
684 | for ( ; list_it.current(); ++list_it ) { | 684 | for ( ; list_it.current(); ++list_it ) { |
685 | 685 | ||
686 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { | 686 | if ( ( (Q3CheckListItem*)list_it.current() )->isOn() ) { |
687 | if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) | 687 | if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) |
688 | subscribedGroups.append( list_it.current()->text(0) ); | 688 | subscribedGroups.append( list_it.current()->text(0) ); |
689 | } else { | 689 | } else { |
690 | if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) | 690 | if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) |
691 | subscribedGroups.remove( list_it.current()->text(0) ); | 691 | subscribedGroups.remove( list_it.current()->text(0) ); |
692 | } | 692 | } |
693 | 693 | ||
694 | } | 694 | } |
695 | data->setGroups( subscribedGroups ); | 695 | data->setGroups( subscribedGroups ); |
696 | } | 696 | } |
697 | 697 | ||
698 | void NNTPconfig::accept() | 698 | void NNTPconfig::accept() |
699 | { | 699 | { |
700 | save(); | 700 | save(); |
701 | QDialog::accept(); | 701 | QDialog::accept(); |
702 | } | 702 | } |
703 | 703 | ||
diff --git a/kmicromail/editaccounts.h b/kmicromail/editaccounts.h index 465780c..3d01d23 100644 --- a/kmicromail/editaccounts.h +++ b/kmicromail/editaccounts.h | |||
@@ -1,157 +1,157 @@ | |||
1 | #ifndef EDITACCOUNTS_H | 1 | #ifndef EDITACCOUNTS_H |
2 | #define EDITACCOUNTS_H | 2 | #define EDITACCOUNTS_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qlistview.h> | 5 | #include <q3listview.h> |
6 | 6 | ||
7 | #include "editaccountsui.h" | 7 | #include "editaccountsui.h" |
8 | #include "selectmailtypeui.h" | 8 | #include "selectmailtypeui.h" |
9 | #include "imapconfigui.h" | 9 | #include "imapconfigui.h" |
10 | #include "pop3configui.h" | 10 | #include "pop3configui.h" |
11 | #include "smtpconfigui.h" | 11 | #include "smtpconfigui.h" |
12 | #include "nntpconfigui.h" | 12 | #include "nntpconfigui.h" |
13 | 13 | ||
14 | #include <libetpan/clist.h> | 14 | #include <libetpan/clist.h> |
15 | #include <libmailwrapper/settings.h> | 15 | #include <libmailwrapper/settings.h> |
16 | 16 | ||
17 | 17 | ||
18 | class AccountListItem : public QListViewItem | 18 | class AccountListItem : public Q3ListViewItem |
19 | { | 19 | { |
20 | 20 | ||
21 | public: | 21 | public: |
22 | AccountListItem( QListView *parent, Account *a); | 22 | AccountListItem( Q3ListView *parent, Account *a); |
23 | Account *getAccount() { return account; } | 23 | Account *getAccount() { return account; } |
24 | 24 | ||
25 | private: | 25 | private: |
26 | Account *account; | 26 | Account *account; |
27 | 27 | ||
28 | }; | 28 | }; |
29 | 29 | ||
30 | class EditAccounts : public EditAccountsUI | 30 | class EditAccounts : public EditAccountsUI |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | 33 | ||
34 | public: | 34 | public: |
35 | EditAccounts( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 35 | EditAccounts( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 ); |
36 | 36 | ||
37 | public slots: | 37 | public slots: |
38 | void slotNewAccount( const QString &type ); | 38 | void slotNewAccount( const QString &type ); |
39 | void slotEditAccount( Account *account ); | 39 | void slotEditAccount( Account *account ); |
40 | void slotDeleteAccount( Account * account ); | 40 | void slotDeleteAccount( Account * account ); |
41 | void slotAdjustColumns(); | 41 | void slotAdjustColumns(); |
42 | 42 | ||
43 | protected slots: | 43 | protected slots: |
44 | void slotFillLists(); | 44 | void slotFillLists(); |
45 | void slotNewMail(); | 45 | void slotNewMail(); |
46 | void slotEditMail(); | 46 | void slotEditMail(); |
47 | void slotDeleteMail(); | 47 | void slotDeleteMail(); |
48 | void slotNewNews(); | 48 | void slotNewNews(); |
49 | void slotEditNews(); | 49 | void slotEditNews(); |
50 | void slotDeleteNews(); | 50 | void slotDeleteNews(); |
51 | void accept(); | 51 | void accept(); |
52 | 52 | ||
53 | private: | 53 | private: |
54 | Settings *settings; | 54 | Settings *settings; |
55 | 55 | ||
56 | }; | 56 | }; |
57 | 57 | ||
58 | class SelectMailType : public SelectMailTypeUI | 58 | class SelectMailType : public SelectMailTypeUI |
59 | { | 59 | { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | 61 | ||
62 | public: | 62 | public: |
63 | SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 63 | SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 ); |
64 | 64 | ||
65 | private slots: | 65 | private slots: |
66 | void slotSelection( const QString &sel ); | 66 | void slotSelection( const QString &sel ); |
67 | 67 | ||
68 | private: | 68 | private: |
69 | QString *selected; | 69 | QString *selected; |
70 | 70 | ||
71 | }; | 71 | }; |
72 | 72 | ||
73 | class IMAPconfig : public IMAPconfigUI | 73 | class IMAPconfig : public IMAPconfigUI |
74 | { | 74 | { |
75 | Q_OBJECT | 75 | Q_OBJECT |
76 | 76 | ||
77 | public: | 77 | public: |
78 | IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 78 | IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 ); |
79 | 79 | ||
80 | public slots: | 80 | public slots: |
81 | void fillValues(); | 81 | void fillValues(); |
82 | 82 | ||
83 | protected slots: | 83 | protected slots: |
84 | void slotConnectionToggle( int index ); | 84 | void slotConnectionToggle( int index ); |
85 | void accept(); | 85 | void accept(); |
86 | 86 | ||
87 | private: | 87 | private: |
88 | IMAPaccount *data; | 88 | IMAPaccount *data; |
89 | 89 | ||
90 | }; | 90 | }; |
91 | 91 | ||
92 | class POP3config : public POP3configUI | 92 | class POP3config : public POP3configUI |
93 | { | 93 | { |
94 | Q_OBJECT | 94 | Q_OBJECT |
95 | 95 | ||
96 | public: | 96 | public: |
97 | POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 97 | POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 ); |
98 | 98 | ||
99 | public slots: | 99 | public slots: |
100 | void fillValues(); | 100 | void fillValues(); |
101 | 101 | ||
102 | protected slots: | 102 | protected slots: |
103 | void slotConnectionToggle( int index ); | 103 | void slotConnectionToggle( int index ); |
104 | void accept(); | 104 | void accept(); |
105 | 105 | ||
106 | private: | 106 | private: |
107 | POP3account *data; | 107 | POP3account *data; |
108 | 108 | ||
109 | }; | 109 | }; |
110 | 110 | ||
111 | class SMTPconfig : public SMTPconfigUI | 111 | class SMTPconfig : public SMTPconfigUI |
112 | { | 112 | { |
113 | Q_OBJECT | 113 | Q_OBJECT |
114 | 114 | ||
115 | public: | 115 | public: |
116 | SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 116 | SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 ); |
117 | 117 | ||
118 | public slots: | 118 | public slots: |
119 | void fillValues(); | 119 | void fillValues(); |
120 | 120 | ||
121 | protected slots: | 121 | protected slots: |
122 | void slotConnectionToggle( int index ); | 122 | void slotConnectionToggle( int index ); |
123 | void accept(); | 123 | void accept(); |
124 | void chooseSig(); | 124 | void chooseSig(); |
125 | 125 | ||
126 | private: | 126 | private: |
127 | SMTPaccount *data; | 127 | SMTPaccount *data; |
128 | 128 | ||
129 | }; | 129 | }; |
130 | 130 | ||
131 | class NNTPconfig : public NNTPconfigUI | 131 | class NNTPconfig : public NNTPconfigUI |
132 | { | 132 | { |
133 | Q_OBJECT | 133 | Q_OBJECT |
134 | 134 | ||
135 | public: | 135 | public: |
136 | NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 136 | NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 ); |
137 | 137 | ||
138 | public slots: | 138 | public slots: |
139 | void fillValues(); | 139 | void fillValues(); |
140 | 140 | ||
141 | protected slots: | 141 | protected slots: |
142 | void slotSSL( bool enabled ); | 142 | void slotSSL( bool enabled ); |
143 | void accept(); | 143 | void accept(); |
144 | void slotGetNG(); | 144 | void slotGetNG(); |
145 | void slotShowSub(); | 145 | void slotShowSub(); |
146 | void slotShowFilter(); | 146 | void slotShowFilter(); |
147 | 147 | ||
148 | private: | 148 | private: |
149 | QStringList subscribedGroups; | 149 | QStringList subscribedGroups; |
150 | QStringList allGroups; | 150 | QStringList allGroups; |
151 | void save(); | 151 | void save(); |
152 | NNTPaccount *data; | 152 | NNTPaccount *data; |
153 | clist* list; | 153 | clist* list; |
154 | 154 | ||
155 | }; | 155 | }; |
156 | 156 | ||
157 | #endif | 157 | #endif |
diff --git a/kmicromail/kmicromail.pro b/kmicromail/kmicromail.pro index 9f4d4bd..ce30bbf 100644 --- a/kmicromail/kmicromail.pro +++ b/kmicromail/kmicromail.pro | |||
@@ -12,67 +12,73 @@ HEADERS = defines.h \ | |||
12 | mailistviewitem.h \ | 12 | mailistviewitem.h \ |
13 | settingsdialog.h \ | 13 | settingsdialog.h \ |
14 | statuswidget.h \ | 14 | statuswidget.h \ |
15 | newmaildir.h \ | 15 | newmaildir.h \ |
16 | selectstore.h \ | 16 | selectstore.h \ |
17 | selectsmtp.h \ | 17 | selectsmtp.h \ |
18 | ./qpe/qdialog.h \ | 18 | ./qpe/qdialog.h \ |
19 | nntpgroups.h \ | 19 | nntpgroups.h \ |
20 | koprefs.h \ | 20 | koprefs.h \ |
21 | koprefsdialog.h \ | 21 | koprefsdialog.h \ |
22 | nntpgroupsdlg.h | 22 | nntpgroupsdlg.h |
23 | 23 | ||
24 | SOURCES = main.cpp \ | 24 | SOURCES = main.cpp \ |
25 | opiemail.cpp \ | 25 | opiemail.cpp \ |
26 | mainwindow.cpp \ | 26 | mainwindow.cpp \ |
27 | accountview.cpp \ | 27 | accountview.cpp \ |
28 | accountitem.cpp \ | 28 | accountitem.cpp \ |
29 | composemail.cpp \ | 29 | composemail.cpp \ |
30 | editaccounts.cpp \ | 30 | editaccounts.cpp \ |
31 | viewmail.cpp \ | 31 | viewmail.cpp \ |
32 | viewmailbase.cpp \ | 32 | viewmailbase.cpp \ |
33 | mailistviewitem.cpp \ | 33 | mailistviewitem.cpp \ |
34 | settingsdialog.cpp \ | 34 | settingsdialog.cpp \ |
35 | statuswidget.cpp \ | 35 | statuswidget.cpp \ |
36 | newmaildir.cpp \ | 36 | newmaildir.cpp \ |
37 | selectstore.cpp \ | 37 | selectstore.cpp \ |
38 | selectsmtp.cpp \ | 38 | selectsmtp.cpp \ |
39 | nntpgroups.cpp \ | 39 | nntpgroups.cpp \ |
40 | koprefs.cpp\ | 40 | koprefs.cpp\ |
41 | koprefsdialog.cpp\ | 41 | koprefsdialog.cpp\ |
42 | nntpgroupsdlg.cpp | 42 | nntpgroupsdlg.cpp |
43 | 43 | ||
44 | INTERFACES = editaccountsui.ui \ | 44 | #The following line was changed from INTERFACES to FORMS3 by qt3to4 |
45 | FORMS3 = editaccountsui.ui \ | ||
45 | selectmailtypeui.ui \ | 46 | selectmailtypeui.ui \ |
46 | imapconfigui.ui \ | 47 | imapconfigui.ui \ |
47 | pop3configui.ui \ | 48 | pop3configui.ui \ |
48 | nntpconfigui.ui \ | 49 | nntpconfigui.ui \ |
49 | smtpconfigui.ui \ | 50 | smtpconfigui.ui \ |
50 | composemailui.ui \ | 51 | composemailui.ui \ |
51 | settingsdialogui.ui \ | 52 | settingsdialogui.ui \ |
52 | statuswidgetui.ui \ | 53 | statuswidgetui.ui \ |
53 | newmaildirui.ui \ | 54 | newmaildirui.ui \ |
54 | selectstoreui.ui \ | 55 | selectstoreui.ui \ |
55 | nntpgroupsui.ui | 56 | nntpgroupsui.ui |
56 | 57 | ||
57 | 58 | ||
58 | INCLUDEPATH += ./qpe . .. ../libkdepim ../microkde ../microkde/kdecore ../libetpan/include ../microkde/kdeui | 59 | INCLUDEPATH += ./qpe . .. ../libkdepim ../microkde ../microkde/kdecore ../libetpan/include ../microkde/kdeui |
59 | LIBS += -L../bin -lmicromailwrapper -lmicrolibetpan -lmicrokde -lssl -lcrypto -lmicrokdepim -lmicrokabc -lpthread | 60 | LIBS += -L../bin -lmicromailwrapper -lxmicrolibetpan -lxmicrokde -lssl -lcrypto -lxmicrokdepim -lxmicrokabc -lpthread |
60 | 61 | ||
61 | DESTDIR= ../bin | 62 | DESTDIR= ../bin |
62 | TARGET = ompi | 63 | TARGET = ompi |
63 | 64 | ||
64 | DEFINES += DESKTOP_VERSION | 65 | DEFINES += DESKTOP_VERSION |
65 | unix : { | 66 | unix : { |
66 | OBJECTS_DIR = obj/unix | 67 | OBJECTS_DIR = obj/unix |
67 | MOC_DIR = moc/unix | 68 | MOC_DIR = moc/unix |
68 | } | 69 | } |
69 | win32: { | 70 | win32: { |
70 | DEFINES += _WIN32_ | 71 | DEFINES += _WIN32_ |
71 | LIBS += mfc71u.lib | 72 | LIBS += mfc71u.lib |
72 | QMAKE_LINK += /NODEFAULTLIB:LIBC | 73 | QMAKE_LINK += /NODEFAULTLIB:LIBC |
73 | #QMAKE_LINK += /NODEFAULTLIB:MSVCRT | 74 | #QMAKE_LINK += /NODEFAULTLIB:MSVCRT |
74 | #QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib | 75 | #QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib |
75 | OBJECTS_DIR = obj/win | 76 | OBJECTS_DIR = obj/win |
76 | MOC_DIR = moc/win | 77 | MOC_DIR = moc/win |
77 | } | 78 | } |
78 | 79 | ||
80 | #The following line was inserted by qt3to4 | ||
81 | QT += xml qt3support | ||
82 | #The following line was inserted by qt3to4 | ||
83 | CONFIG += uic3 | ||
84 | |||
diff --git a/kmicromail/kmicromailE.pro b/kmicromail/kmicromailE.pro index a5a51f7..19fa398 100644 --- a/kmicromail/kmicromailE.pro +++ b/kmicromail/kmicromailE.pro | |||
@@ -26,47 +26,47 @@ SOURCES = main.cpp \ | |||
26 | accountview.cpp \ | 26 | accountview.cpp \ |
27 | accountitem.cpp \ | 27 | accountitem.cpp \ |
28 | composemail.cpp \ | 28 | composemail.cpp \ |
29 | editaccounts.cpp \ | 29 | editaccounts.cpp \ |
30 | viewmail.cpp \ | 30 | viewmail.cpp \ |
31 | viewmailbase.cpp \ | 31 | viewmailbase.cpp \ |
32 | mailistviewitem.cpp \ | 32 | mailistviewitem.cpp \ |
33 | settingsdialog.cpp \ | 33 | settingsdialog.cpp \ |
34 | statuswidget.cpp \ | 34 | statuswidget.cpp \ |
35 | newmaildir.cpp \ | 35 | newmaildir.cpp \ |
36 | selectstore.cpp \ | 36 | selectstore.cpp \ |
37 | selectsmtp.cpp \ | 37 | selectsmtp.cpp \ |
38 | nntpgroups.cpp \ | 38 | nntpgroups.cpp \ |
39 | koprefs.cpp\ | 39 | koprefs.cpp\ |
40 | koprefsdialog.cpp\ | 40 | koprefsdialog.cpp\ |
41 | nntpgroupsdlg.cpp | 41 | nntpgroupsdlg.cpp |
42 | 42 | ||
43 | INTERFACES = editaccountsui.ui \ | 43 | INTERFACES = editaccountsui.ui \ |
44 | selectmailtypeui.ui \ | 44 | selectmailtypeui.ui \ |
45 | imapconfigui.ui \ | 45 | imapconfigui.ui \ |
46 | pop3configui.ui \ | 46 | pop3configui.ui \ |
47 | nntpconfigui.ui \ | 47 | nntpconfigui.ui \ |
48 | smtpconfigui.ui \ | 48 | smtpconfigui.ui \ |
49 | composemailui.ui \ | 49 | composemailui.ui \ |
50 | settingsdialogui.ui \ | 50 | settingsdialogui.ui \ |
51 | statuswidgetui.ui \ | 51 | statuswidgetui.ui \ |
52 | newmaildirui.ui \ | 52 | newmaildirui.ui \ |
53 | selectstoreui.ui \ | 53 | selectstoreui.ui \ |
54 | nntpgroupsui.ui | 54 | nntpgroupsui.ui |
55 | 55 | ||
56 | 56 | ||
57 | INCLUDEPATH += $(QPEDIR)/include . $(KDEPIMDIR) $(KDEPIMDIR)/libkdepim $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/libetpan/include $(KDEPIMDIR)/microkde/kdeui | 57 | INCLUDEPATH += $(QPEDIR)/include . $(KDEPIMDIR) $(KDEPIMDIR)/libkdepim $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/libetpan/include $(KDEPIMDIR)/microkde/kdeui |
58 | LIBS += -L$(QPEDIR)/lib -lmicromailwrapper -lqpe -lmicrolibetpan -lmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lmicrokdepim -lpthread | 58 | LIBS += -L$(QPEDIR)/lib -lmicromailwrapper -lqpe -lxmicrolibetpan -lxmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lxmicrokdepim -lpthread |
59 | LIBS += $(QTOPIALIB) | 59 | LIBS += $(QTOPIALIB) |
60 | #LIBS += -lqtopia | 60 | #LIBS += -lqtopia |
61 | #next line for Zaurus only | 61 | #next line for Zaurus only |
62 | #LIBS += -luuid | 62 | #LIBS += -luuid |
63 | 63 | ||
64 | LIBS += $(GCC3EXTRALIB1) | 64 | LIBS += $(GCC3EXTRALIB1) |
65 | LIBS += $(GCC3EXTRALIB2) | 65 | LIBS += $(GCC3EXTRALIB2) |
66 | # | 66 | # |
67 | OBJECTS_DIR = obj/$(PLATFORM) | 67 | OBJECTS_DIR = obj/$(PLATFORM) |
68 | MOC_DIR = moc/$(PLATFORM) | 68 | MOC_DIR = moc/$(PLATFORM) |
69 | DESTDIR=$(QPEDIR)/bin | 69 | DESTDIR=$(QPEDIR)/bin |
70 | TARGET = ompi | 70 | TARGET = ompi |
71 | 71 | ||
72 | 72 | ||
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp index e4b61dc..e2eed9a 100644 --- a/kmicromail/koprefs.cpp +++ b/kmicromail/koprefs.cpp | |||
@@ -1,61 +1,61 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <q3textstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kemailsettings.h> | 42 | #include <kemailsettings.h> |
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <kglobalsettings.h> | 44 | #include <kglobalsettings.h> |
45 | 45 | ||
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "mainwindow.h" | 47 | #include "mainwindow.h" |
48 | 48 | ||
49 | 49 | ||
50 | KOPrefs *KOPrefs::mInstance = 0; | 50 | KOPrefs *KOPrefs::mInstance = 0; |
51 | static KStaticDeleter<KOPrefs> insd; | 51 | static KStaticDeleter<KOPrefs> insd; |
52 | 52 | ||
53 | KOPrefs::KOPrefs() : | 53 | KOPrefs::KOPrefs() : |
54 | KPimPrefs("kopiemailrc") | 54 | KPimPrefs("kopiemailrc") |
55 | { | 55 | { |
56 | KPrefs::setCurrentGroup("General"); | 56 | KPrefs::setCurrentGroup("General"); |
57 | addItemString("SendCodec",&mSendCodec,i18n ("userdefined") ); | 57 | addItemString("SendCodec",&mSendCodec,i18n ("userdefined") ); |
58 | addItemString("SenderName",&mName,i18n ("Please set at") ); | 58 | addItemString("SenderName",&mName,i18n ("Please set at") ); |
59 | addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); | 59 | addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); |
60 | addItemBool("ViewMailAsHtml",&mViewAsHtml,false); | 60 | addItemBool("ViewMailAsHtml",&mViewAsHtml,false); |
61 | addItemBool("SendMailLater",&mSendLater,true); | 61 | addItemBool("SendMailLater",&mSendLater,true); |
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp index 017f1f7..e3102a4 100644 --- a/kmicromail/koprefsdialog.cpp +++ b/kmicromail/koprefsdialog.cpp | |||
@@ -1,75 +1,80 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #include <kdialog.h> | 23 | #include <kdialog.h> |
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qgroupbox.h> | 26 | #include <q3groupbox.h> |
27 | #include <qbuttongroup.h> | 27 | #include <q3buttongroup.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qfont.h> | 29 | #include <qfont.h> |
30 | #include <qslider.h> | 30 | #include <qslider.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtextstream.h> | 32 | #include <q3textstream.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qvbox.h> | 34 | #include <q3vbox.h> |
35 | #include <qhbox.h> | 35 | #include <q3hbox.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qradiobutton.h> | 40 | #include <qradiobutton.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qstrlist.h> | 42 | #include <q3strlist.h> |
43 | #include <qapplication.h> | 43 | #include <qapplication.h> |
44 | //Added by qt3to4: | ||
45 | #include <Q3HBoxLayout> | ||
46 | #include <Q3GridLayout> | ||
47 | #include <QPixmap> | ||
48 | #include <Q3Frame> | ||
44 | 49 | ||
45 | #include <kcolorbutton.h> | 50 | #include <kcolorbutton.h> |
46 | #include <kdebug.h> | 51 | #include <kdebug.h> |
47 | #include <klocale.h> | 52 | #include <klocale.h> |
48 | #include <kglobal.h> | 53 | #include <kglobal.h> |
49 | #include <kfontdialog.h> | 54 | #include <kfontdialog.h> |
50 | #include <kfiledialog.h> | 55 | #include <kfiledialog.h> |
51 | #include <kmessagebox.h> | 56 | #include <kmessagebox.h> |
52 | #include <kcolordialog.h> | 57 | #include <kcolordialog.h> |
53 | #include <kiconloader.h> | 58 | #include <kiconloader.h> |
54 | #include <kemailsettings.h> | 59 | #include <kemailsettings.h> |
55 | #include <kstandarddirs.h> | 60 | #include <kstandarddirs.h> |
56 | #include <kglobalsettings.h> | 61 | #include <kglobalsettings.h> |
57 | 62 | ||
58 | #include <klineedit.h> | 63 | #include <klineedit.h> |
59 | 64 | ||
60 | 65 | ||
61 | #include "koprefs.h" | 66 | #include "koprefs.h" |
62 | 67 | ||
63 | #include "koprefsdialog.h" | 68 | #include "koprefsdialog.h" |
64 | //#include <kprefswidget.h> | 69 | //#include <kprefswidget.h> |
65 | 70 | ||
66 | 71 | ||
67 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : | 72 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : |
68 | KPrefsDialog(KOPrefs::instance(),parent,name,true) | 73 | KPrefsDialog(KOPrefs::instance(),parent,name,true) |
69 | { | 74 | { |
70 | 75 | ||
71 | setFont( KGlobalSettings::generalMaxFont() ); | 76 | setFont( KGlobalSettings::generalMaxFont() ); |
72 | setCaption( i18n("Settings - some need a restart (nr)")); | 77 | setCaption( i18n("Settings - some need a restart (nr)")); |
73 | setupGlobalTab(); | 78 | setupGlobalTab(); |
74 | setupMainTab(); | 79 | setupMainTab(); |
75 | setupMailTab();; | 80 | setupMailTab();; |
@@ -82,483 +87,483 @@ KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : | |||
82 | 87 | ||
83 | #if 0 | 88 | #if 0 |
84 | 89 | ||
85 | setupMainTab(); | 90 | setupMainTab(); |
86 | setupLocaleTab(); | 91 | setupLocaleTab(); |
87 | setupTimeZoneTab(); | 92 | setupTimeZoneTab(); |
88 | setupTimeTab(); | 93 | setupTimeTab(); |
89 | setupLocaleDateTab(); | 94 | setupLocaleDateTab(); |
90 | setupFontsTab(); | 95 | setupFontsTab(); |
91 | setupColorsTab(); | 96 | setupColorsTab(); |
92 | setupViewsTab(); | 97 | setupViewsTab(); |
93 | //setupSyncTab(); | 98 | //setupSyncTab(); |
94 | //setupSyncAlgTab(); | 99 | //setupSyncAlgTab(); |
95 | //setupPrinterTab(); | 100 | //setupPrinterTab(); |
96 | //setupGroupSchedulingTab(); | 101 | //setupGroupSchedulingTab(); |
97 | //setupGroupAutomationTab(); | 102 | //setupGroupAutomationTab(); |
98 | #endif | 103 | #endif |
99 | } | 104 | } |
100 | 105 | ||
101 | #include "kpimglobalprefs.h" | 106 | #include "kpimglobalprefs.h" |
102 | 107 | ||
103 | KOPrefsDialog::~KOPrefsDialog() | 108 | KOPrefsDialog::~KOPrefsDialog() |
104 | { | 109 | { |
105 | } | 110 | } |
106 | void KOPrefsDialog::setupGlobalTab() | 111 | void KOPrefsDialog::setupGlobalTab() |
107 | { | 112 | { |
108 | 113 | ||
109 | 114 | ||
110 | 115 | ||
111 | } | 116 | } |
112 | void KOPrefsDialog::setupMainTab() | 117 | void KOPrefsDialog::setupMainTab() |
113 | { | 118 | { |
114 | QFrame *topFrame = addPage(i18n("General"),0,0); | 119 | Q3Frame *topFrame = addPage(i18n("General"),0,0); |
115 | 120 | ||
116 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 121 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2); |
117 | topLayout->setSpacing(spacingHint()); | 122 | topLayout->setSpacing(spacingHint()); |
118 | topLayout->setMargin(marginHint()); | 123 | topLayout->setMargin(marginHint()); |
119 | 124 | ||
120 | 125 | ||
121 | mNameEdit = new QLineEdit(topFrame); | 126 | mNameEdit = new QLineEdit(topFrame); |
122 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | 127 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); |
123 | topLayout->addWidget(mNameLabel,0,0); | 128 | topLayout->addWidget(mNameLabel,0,0); |
124 | topLayout->addWidget(mNameEdit,0,1); | 129 | topLayout->addWidget(mNameEdit,0,1); |
125 | 130 | ||
126 | mEmailEdit = new QLineEdit(topFrame); | 131 | mEmailEdit = new QLineEdit(topFrame); |
127 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | 132 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); |
128 | topLayout->addWidget(mEmailLabel,1,0); | 133 | topLayout->addWidget(mEmailLabel,1,0); |
129 | topLayout->addWidget(mEmailEdit,1,1); | 134 | topLayout->addWidget(mEmailEdit,1,1); |
130 | QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); | 135 | QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); |
131 | topLayout->addMultiCellWidget(lab,2,2,0,1); | 136 | topLayout->addMultiCellWidget(lab,2,2,0,1); |
132 | KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), | 137 | KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), |
133 | &(KOPrefs::instance()->mUseKapi),topFrame); | 138 | &(KOPrefs::instance()->mUseKapi),topFrame); |
134 | topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); | 139 | topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); |
135 | } | 140 | } |
136 | 141 | ||
137 | void KOPrefsDialog::setupMailTab() | 142 | void KOPrefsDialog::setupMailTab() |
138 | { | 143 | { |
139 | QFrame *topFrame = addPage(i18n("Mail"),0,0); | 144 | Q3Frame *topFrame = addPage(i18n("Mail"),0,0); |
140 | 145 | ||
141 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 146 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2); |
142 | topLayout->setSpacing(spacingHint()); | 147 | topLayout->setSpacing(spacingHint()); |
143 | topLayout->setMargin(marginHint()); | 148 | topLayout->setMargin(marginHint()); |
144 | 149 | ||
145 | KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), | 150 | KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), |
146 | &(KOPrefs::instance()->mViewAsHtml),topFrame); | 151 | &(KOPrefs::instance()->mViewAsHtml),topFrame); |
147 | topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); | 152 | topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); |
148 | 153 | ||
149 | 154 | ||
150 | ttt = addWidBool(i18n("Send mails later"), | 155 | ttt = addWidBool(i18n("Send mails later"), |
151 | &(KOPrefs::instance()->mSendLater),topFrame); | 156 | &(KOPrefs::instance()->mSendLater),topFrame); |
152 | topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); | 157 | topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); |
153 | ttt = addWidBool(i18n("Show \"To\" field in list view"), | 158 | ttt = addWidBool(i18n("Show \"To\" field in list view"), |
154 | &(KOPrefs::instance()->mShowToField),topFrame); | 159 | &(KOPrefs::instance()->mShowToField),topFrame); |
155 | topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1); | 160 | topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1); |
156 | 161 | ||
157 | int iii =3; | 162 | int iii =3; |
158 | ttt = addWidBool(i18n("Show info fields at startup"), | 163 | ttt = addWidBool(i18n("Show info fields at startup"), |
159 | &(KOPrefs::instance()->mShowInfoStart),topFrame); | 164 | &(KOPrefs::instance()->mShowInfoStart),topFrame); |
160 | topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); | 165 | topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); |
161 | ++iii; | 166 | ++iii; |
162 | ttt = addWidBool(i18n("Show \"Subject\" info field"), | 167 | ttt = addWidBool(i18n("Show \"Subject\" info field"), |
163 | &(KOPrefs::instance()->mShowInfoSub),topFrame); | 168 | &(KOPrefs::instance()->mShowInfoSub),topFrame); |
164 | topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); | 169 | topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); |
165 | ++iii; | 170 | ++iii; |
166 | ttt = addWidBool(i18n("Show \"From\" info field"), | 171 | ttt = addWidBool(i18n("Show \"From\" info field"), |
167 | &(KOPrefs::instance()->mShowInfoFrom),topFrame); | 172 | &(KOPrefs::instance()->mShowInfoFrom),topFrame); |
168 | topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); | 173 | topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); |
169 | ++iii; | 174 | ++iii; |
170 | ttt = addWidBool(i18n("Show \"To\" info field"), | 175 | ttt = addWidBool(i18n("Show \"To\" info field"), |
171 | &(KOPrefs::instance()->mShowInfoTo),topFrame); | 176 | &(KOPrefs::instance()->mShowInfoTo),topFrame); |
172 | topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); | 177 | topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); |
173 | ++iii; | 178 | ++iii; |
174 | 179 | ||
175 | /* | 180 | /* |
176 | mCodecEdit = new QLineEdit(topFrame); | 181 | mCodecEdit = new QLineEdit(topFrame); |
177 | topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1); | 182 | topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1); |
178 | topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1); | 183 | topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1); |
179 | topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); | 184 | topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); |
180 | */ | 185 | */ |
181 | } | 186 | } |
182 | void KOPrefsDialog::setupFontsTab() | 187 | void KOPrefsDialog::setupFontsTab() |
183 | { | 188 | { |
184 | 189 | ||
185 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 190 | Q3Frame *topFrame = addPage(i18n("Fonts"),0,0); |
186 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 191 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
187 | 192 | ||
188 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | 193 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,7,3); |
189 | topLayout->setSpacing(1); | 194 | topLayout->setSpacing(1); |
190 | topLayout->setMargin(3); | 195 | topLayout->setMargin(3); |
191 | KPrefsDialogWidFont * tVFont; | 196 | KPrefsDialogWidFont * tVFont; |
192 | int i = 0; | 197 | int i = 0; |
193 | KPrefsDialogWidFont *timeLabelsFont = | 198 | KPrefsDialogWidFont *timeLabelsFont = |
194 | addWidFont(i18n("OK"),i18n("Application(nr)"), | 199 | addWidFont(i18n("OK"),i18n("Application(nr)"), |
195 | &(KOPrefs::instance()->mAppFont),topFrame); | 200 | &(KOPrefs::instance()->mAppFont),topFrame); |
196 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 201 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
197 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 202 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
198 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 203 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
199 | ++i; | 204 | ++i; |
200 | 205 | ||
201 | 206 | ||
202 | timeLabelsFont = | 207 | timeLabelsFont = |
203 | addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), | 208 | addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), |
204 | &(KOPrefs::instance()->mComposeFont),topFrame); | 209 | &(KOPrefs::instance()->mComposeFont),topFrame); |
205 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 210 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
206 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 211 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
207 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 212 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
208 | ++i; | 213 | ++i; |
209 | 214 | ||
210 | KPrefsDialogWidFont *timeBarFont = | 215 | KPrefsDialogWidFont *timeBarFont = |
211 | addWidFont(i18n("Hello"),i18n("Read mail:"), | 216 | addWidFont(i18n("Hello"),i18n("Read mail:"), |
212 | &(KOPrefs::instance()->mReadFont),topFrame); | 217 | &(KOPrefs::instance()->mReadFont),topFrame); |
213 | topLayout->addWidget(timeBarFont->label(),i,0); | 218 | topLayout->addWidget(timeBarFont->label(),i,0); |
214 | topLayout->addWidget(timeBarFont->preview(),i,1); | 219 | topLayout->addWidget(timeBarFont->preview(),i,1); |
215 | topLayout->addWidget(timeBarFont->button(),i,2); | 220 | topLayout->addWidget(timeBarFont->button(),i,2); |
216 | ++i; | 221 | ++i; |
217 | 222 | ||
218 | topLayout->setColStretch(1,1); | 223 | topLayout->setColStretch(1,1); |
219 | topLayout->setRowStretch(4,1); | 224 | topLayout->setRowStretch(4,1); |
220 | 225 | ||
221 | } | 226 | } |
222 | void KOPrefsDialog::usrReadConfig() | 227 | void KOPrefsDialog::usrReadConfig() |
223 | { | 228 | { |
224 | 229 | ||
225 | mNameEdit->setText(KOPrefs::instance()->mName); | 230 | mNameEdit->setText(KOPrefs::instance()->mName); |
226 | mEmailEdit->setText(KOPrefs::instance()->mEmail); | 231 | mEmailEdit->setText(KOPrefs::instance()->mEmail); |
227 | //mCodecEdit->setText(KOPrefs::instance()->mSendCodec); | 232 | //mCodecEdit->setText(KOPrefs::instance()->mSendCodec); |
228 | } | 233 | } |
229 | void KOPrefsDialog::usrWriteConfig() | 234 | void KOPrefsDialog::usrWriteConfig() |
230 | { | 235 | { |
231 | KOPrefs::instance()->mName = mNameEdit->text(); | 236 | KOPrefs::instance()->mName = mNameEdit->text(); |
232 | KOPrefs::instance()->mEmail = mEmailEdit->text(); | 237 | KOPrefs::instance()->mEmail = mEmailEdit->text(); |
233 | //KOPrefs::instance()->mSendCodec = mCodecEdit->text(); | 238 | //KOPrefs::instance()->mSendCodec = mCodecEdit->text(); |
234 | 239 | ||
235 | 240 | ||
236 | } | 241 | } |
237 | 242 | ||
238 | #if 0 | 243 | #if 0 |
239 | void KOPrefsDialog::setupLocaleDateTab() | 244 | void KOPrefsDialog::setupLocaleDateTab() |
240 | { | 245 | { |
241 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); | 246 | Q3Frame *topFrame = addPage(i18n("Date Format"),0,0); |
242 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); | 247 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,3,2); |
243 | topLayout->setSpacing(spacingHint()); | 248 | topLayout->setSpacing(spacingHint()); |
244 | topLayout->setMargin(marginHint()); | 249 | topLayout->setMargin(marginHint()); |
245 | int iii = 0; | 250 | int iii = 0; |
246 | 251 | ||
247 | 252 | ||
248 | KPrefsWidRadios *syncPrefsGroup = | 253 | KPrefsWidRadios *syncPrefsGroup = |
249 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); | 254 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); |
250 | QString format; | 255 | QString format; |
251 | if ( QApplication::desktop()->width() < 480 ) | 256 | if ( QApplication::desktop()->width() < 480 ) |
252 | format = "(%d.%m.%Y)"; | 257 | format = "(%d.%m.%Y)"; |
253 | else | 258 | else |
254 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 259 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
255 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 260 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
256 | if ( QApplication::desktop()->width() < 480 ) | 261 | if ( QApplication::desktop()->width() < 480 ) |
257 | format = "(%m.%d.%Y)"; | 262 | format = "(%m.%d.%Y)"; |
258 | else | 263 | else |
259 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 264 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
260 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 265 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
261 | if ( QApplication::desktop()->width() < 480 ) | 266 | if ( QApplication::desktop()->width() < 480 ) |
262 | format = "(%Y-%m-%d)"; | 267 | format = "(%Y-%m-%d)"; |
263 | else | 268 | else |
264 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 269 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
265 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 270 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
266 | syncPrefsGroup->addRadio(i18n("User defined")); | 271 | syncPrefsGroup->addRadio(i18n("User defined")); |
267 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 272 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
268 | ++iii; | 273 | ++iii; |
269 | ++iii; | 274 | ++iii; |
270 | QLabel * lab; | 275 | QLabel * lab; |
271 | mUserDateFormatLong = new QLineEdit(topFrame); | 276 | mUserDateFormatLong = new QLineEdit(topFrame); |
272 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 277 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
273 | topLayout->addWidget(lab ,iii,0); | 278 | topLayout->addWidget(lab ,iii,0); |
274 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 279 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
275 | ++iii; | 280 | ++iii; |
276 | mUserDateFormatShort = new QLineEdit(topFrame); | 281 | mUserDateFormatShort = new QLineEdit(topFrame); |
277 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 282 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
278 | topLayout->addWidget(lab ,iii,0); | 283 | topLayout->addWidget(lab ,iii,0); |
279 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 284 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
280 | ++iii; | 285 | ++iii; |
281 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 286 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
282 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 287 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
283 | ++iii; | 288 | ++iii; |
284 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 289 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
285 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 290 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
286 | ++iii; | 291 | ++iii; |
287 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 292 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
288 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 293 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
289 | ++iii; | 294 | ++iii; |
290 | 295 | ||
291 | } | 296 | } |
292 | 297 | ||
293 | void KOPrefsDialog::setupLocaleTab() | 298 | void KOPrefsDialog::setupLocaleTab() |
294 | { | 299 | { |
295 | QFrame *topFrame = addPage(i18n("Locale"),0,0); | 300 | Q3Frame *topFrame = addPage(i18n("Locale"),0,0); |
296 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 301 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2); |
297 | topLayout->setSpacing(spacingHint()); | 302 | topLayout->setSpacing(spacingHint()); |
298 | topLayout->setMargin(marginHint()); | 303 | topLayout->setMargin(marginHint()); |
299 | int iii = 0; | 304 | int iii = 0; |
300 | KPrefsWidRadios *syncPrefsGroup = | 305 | KPrefsWidRadios *syncPrefsGroup = |
301 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); | 306 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); |
302 | syncPrefsGroup->addRadio(i18n("English")); | 307 | syncPrefsGroup->addRadio(i18n("English")); |
303 | syncPrefsGroup->addRadio(i18n("German")); | 308 | syncPrefsGroup->addRadio(i18n("German")); |
304 | syncPrefsGroup->addRadio(i18n("French")); | 309 | syncPrefsGroup->addRadio(i18n("French")); |
305 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 310 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
306 | if ( QApplication::desktop()->width() < 300 ) | 311 | if ( QApplication::desktop()->width() < 300 ) |
307 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 312 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
308 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 313 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
309 | ++iii; | 314 | ++iii; |
310 | 315 | ||
311 | syncPrefsGroup = | 316 | syncPrefsGroup = |
312 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); | 317 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); |
313 | if ( QApplication::desktop()->width() > 300 ) | 318 | if ( QApplication::desktop()->width() > 300 ) |
314 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 319 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
315 | syncPrefsGroup->addRadio(i18n("24:00")); | 320 | syncPrefsGroup->addRadio(i18n("24:00")); |
316 | syncPrefsGroup->addRadio(i18n("12:00am")); | 321 | syncPrefsGroup->addRadio(i18n("12:00am")); |
317 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 322 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
318 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 323 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
319 | ++iii; | 324 | ++iii; |
320 | KPrefsDialogWidBool *sb; | 325 | KPrefsDialogWidBool *sb; |
321 | if ( QApplication::desktop()->width() < 300 ) { | 326 | if ( QApplication::desktop()->width() < 300 ) { |
322 | sb = | 327 | sb = |
323 | addWidBool(i18n("Week starts on Sunday"), | 328 | addWidBool(i18n("Week starts on Sunday"), |
324 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); | 329 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); |
325 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 330 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
326 | ++iii; | 331 | ++iii; |
327 | sb = | 332 | sb = |
328 | addWidBool(i18n("Use short date in (WN/E) view"), | 333 | addWidBool(i18n("Use short date in (WN/E) view"), |
329 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 334 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
330 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 335 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
331 | } | 336 | } |
332 | else { | 337 | else { |
333 | QWidget * hb = new QWidget( topFrame ); | 338 | QWidget * hb = new QWidget( topFrame ); |
334 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); | 339 | Q3HBoxLayout *hbLayout = new Q3HBoxLayout(hb); |
335 | sb = | 340 | sb = |
336 | addWidBool(i18n("Week starts on Sunday"), | 341 | addWidBool(i18n("Week starts on Sunday"), |
337 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); | 342 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); |
338 | hbLayout->addWidget(sb->checkBox() ); | 343 | hbLayout->addWidget(sb->checkBox() ); |
339 | sb = | 344 | sb = |
340 | addWidBool(i18n("Use short date in (WN/E) view"), | 345 | addWidBool(i18n("Use short date in (WN/E) view"), |
341 | &(KOPrefs::instance()->mShortDateInViewer),hb); | 346 | &(KOPrefs::instance()->mShortDateInViewer),hb); |
342 | hbLayout->addWidget(sb->checkBox() ); | 347 | hbLayout->addWidget(sb->checkBox() ); |
343 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); | 348 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); |
344 | 349 | ||
345 | } | 350 | } |
346 | //#ifndef DESKTOP_VERSION | 351 | //#ifndef DESKTOP_VERSION |
347 | #if 0 | 352 | #if 0 |
348 | ++iii; | 353 | ++iii; |
349 | sb = | 354 | sb = |
350 | addWidBool(i18n("Quick load/save (w/o Unicode)"), | 355 | addWidBool(i18n("Quick load/save (w/o Unicode)"), |
351 | &(KOPrefs::instance()->mUseQuicksave),topFrame); | 356 | &(KOPrefs::instance()->mUseQuicksave),topFrame); |
352 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 357 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
353 | #endif | 358 | #endif |
354 | } | 359 | } |
355 | void KOPrefsDialog::showSyncPage() | 360 | void KOPrefsDialog::showSyncPage() |
356 | { | 361 | { |
357 | showPage ( 2 ) ; | 362 | showPage ( 2 ) ; |
358 | 363 | ||
359 | } | 364 | } |
360 | void KOPrefsDialog::setupSyncAlgTab() | 365 | void KOPrefsDialog::setupSyncAlgTab() |
361 | { | 366 | { |
362 | #if 0 | 367 | #if 0 |
363 | QLabel * lab; | 368 | QLabel * lab; |
364 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); | 369 | Q3Frame *topFrame = addPage(i18n("Sync Prefs"),0,0); |
365 | mSetupSyncAlgTab = topFrame; | 370 | mSetupSyncAlgTab = topFrame; |
366 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 371 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2); |
367 | topLayout->setSpacing(spacingHint()); | 372 | topLayout->setSpacing(spacingHint()); |
368 | topLayout->setMargin(marginHint()); | 373 | topLayout->setMargin(marginHint()); |
369 | int iii = 0; | 374 | int iii = 0; |
370 | 375 | ||
371 | KPrefsDialogWidBool *sb = | 376 | KPrefsDialogWidBool *sb = |
372 | addWidBool(i18n("Ask for preferences before syncing"), | 377 | addWidBool(i18n("Ask for preferences before syncing"), |
373 | &(KOPrefs::instance()->mAskForPreferences),topFrame); | 378 | &(KOPrefs::instance()->mAskForPreferences),topFrame); |
374 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 379 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
375 | 380 | ||
376 | ++iii; | 381 | ++iii; |
377 | 382 | ||
378 | KPrefsWidRadios *syncPrefsGroup = | 383 | KPrefsWidRadios *syncPrefsGroup = |
379 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), | 384 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), |
380 | topFrame); | 385 | topFrame); |
381 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 386 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
382 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 387 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
383 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 388 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
384 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 389 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
385 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 390 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
386 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 391 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
387 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 392 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
388 | ++iii; | 393 | ++iii; |
389 | sb = | 394 | sb = |
390 | addWidBool(i18n("Show summary after syncing"), | 395 | addWidBool(i18n("Show summary after syncing"), |
391 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); | 396 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); |
392 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 397 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
393 | 398 | ||
394 | ++iii; | 399 | ++iii; |
395 | #endif | 400 | #endif |
396 | 401 | ||
397 | 402 | ||
398 | 403 | ||
399 | } | 404 | } |
400 | 405 | ||
401 | 406 | ||
402 | void KOPrefsDialog::setupSyncTab() | 407 | void KOPrefsDialog::setupSyncTab() |
403 | { | 408 | { |
404 | #if 0 | 409 | #if 0 |
405 | QLabel * lab; | 410 | QLabel * lab; |
406 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); | 411 | Q3Frame *topFrame = addPage(i18n("Sync Network"),0,0); |
407 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 412 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2); |
408 | topLayout->setSpacing(spacingHint()); | 413 | topLayout->setSpacing(spacingHint()); |
409 | topLayout->setMargin(marginHint()); | 414 | topLayout->setMargin(marginHint()); |
410 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); | 415 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); |
411 | int iii = 0; | 416 | int iii = 0; |
412 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); | 417 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); |
413 | ++iii; | 418 | ++iii; |
414 | 419 | ||
415 | mRemoteIPEdit = new QLineEdit(topFrame); | 420 | mRemoteIPEdit = new QLineEdit(topFrame); |
416 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); | 421 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); |
417 | topLayout->addWidget(lab ,iii,0); | 422 | topLayout->addWidget(lab ,iii,0); |
418 | topLayout->addWidget(mRemoteIPEdit,iii,1); | 423 | topLayout->addWidget(mRemoteIPEdit,iii,1); |
419 | ++iii; | 424 | ++iii; |
420 | mRemoteUser = new QLineEdit(topFrame); | 425 | mRemoteUser = new QLineEdit(topFrame); |
421 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); | 426 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); |
422 | topLayout->addWidget(lab ,iii,0); | 427 | topLayout->addWidget(lab ,iii,0); |
423 | topLayout->addWidget(mRemoteUser, iii,1); | 428 | topLayout->addWidget(mRemoteUser, iii,1); |
424 | ++iii; | 429 | ++iii; |
425 | 430 | ||
426 | mRemoteFile = new QLineEdit(topFrame); | 431 | mRemoteFile = new QLineEdit(topFrame); |
427 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); | 432 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); |
428 | topLayout->addWidget(lab ,iii,0); | 433 | topLayout->addWidget(lab ,iii,0); |
429 | topLayout->addWidget(mRemoteFile,iii,1); | 434 | topLayout->addWidget(mRemoteFile,iii,1); |
430 | ++iii; | 435 | ++iii; |
431 | 436 | ||
432 | mLocalTempFile = new QLineEdit(topFrame); | 437 | mLocalTempFile = new QLineEdit(topFrame); |
433 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); | 438 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); |
434 | topLayout->addWidget(lab ,iii,0); | 439 | topLayout->addWidget(lab ,iii,0); |
435 | topLayout->addWidget(mLocalTempFile,iii,1); | 440 | topLayout->addWidget(mLocalTempFile,iii,1); |
436 | ++iii; | 441 | ++iii; |
437 | 442 | ||
438 | KPrefsDialogWidBool *wb = | 443 | KPrefsDialogWidBool *wb = |
439 | addWidBool(i18n("Write back synced file"), | 444 | addWidBool(i18n("Write back synced file"), |
440 | &(KOPrefs::instance()->mWriteBackFile),topFrame); | 445 | &(KOPrefs::instance()->mWriteBackFile),topFrame); |
441 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 446 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
442 | ++iii; | 447 | ++iii; |
443 | wb = | 448 | wb = |
444 | addWidBool(i18n("Write back existing entries only"), | 449 | addWidBool(i18n("Write back existing entries only"), |
445 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); | 450 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); |
446 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 451 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
447 | ++iii; | 452 | ++iii; |
448 | 453 | ||
449 | #endif | 454 | #endif |
450 | } | 455 | } |
451 | 456 | ||
452 | void KOPrefsDialog::setupMainTab() | 457 | void KOPrefsDialog::setupMainTab() |
453 | { | 458 | { |
454 | QFrame *topFrame = addPage(i18n("General"),0,0); | 459 | Q3Frame *topFrame = addPage(i18n("General"),0,0); |
455 | // DesktopIcon("identity",KIcon::SizeMedium)); | 460 | // DesktopIcon("identity",KIcon::SizeMedium)); |
456 | 461 | ||
457 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 462 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2); |
458 | topLayout->setSpacing(spacingHint()); | 463 | topLayout->setSpacing(spacingHint()); |
459 | topLayout->setMargin(marginHint()); | 464 | topLayout->setMargin(marginHint()); |
460 | 465 | ||
461 | // KPrefsDialogWidBool *emailControlCenter = | 466 | // KPrefsDialogWidBool *emailControlCenter = |
462 | // addWidBool(i18n("&Use email settings from Control Center"), | 467 | // addWidBool(i18n("&Use email settings from Control Center"), |
463 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); | 468 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); |
464 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); | 469 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); |
465 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), | 470 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), |
466 | // SLOT(toggleEmailSettings(bool))); | 471 | // SLOT(toggleEmailSettings(bool))); |
467 | 472 | ||
468 | mNameEdit = new QLineEdit(topFrame); | 473 | mNameEdit = new QLineEdit(topFrame); |
469 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | 474 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); |
470 | topLayout->addWidget(mNameLabel,0,0); | 475 | topLayout->addWidget(mNameLabel,0,0); |
471 | topLayout->addWidget(mNameEdit,0,1); | 476 | topLayout->addWidget(mNameEdit,0,1); |
472 | 477 | ||
473 | mEmailEdit = new QLineEdit(topFrame); | 478 | mEmailEdit = new QLineEdit(topFrame); |
474 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | 479 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); |
475 | topLayout->addWidget(mEmailLabel,1,0); | 480 | topLayout->addWidget(mEmailLabel,1,0); |
476 | topLayout->addWidget(mEmailEdit,1,1); | 481 | topLayout->addWidget(mEmailEdit,1,1); |
477 | KPrefsDialogWidBool *wb; | 482 | KPrefsDialogWidBool *wb; |
478 | QHBox *dummy; | 483 | Q3HBox *dummy; |
479 | if ( QApplication::desktop()->width() > 480 ) { | 484 | if ( QApplication::desktop()->width() > 480 ) { |
480 | dummy = new QHBox(topFrame); | 485 | dummy = new Q3HBox(topFrame); |
481 | } else { | 486 | } else { |
482 | dummy = new QVBox(topFrame); | 487 | dummy = new Q3VBox(topFrame); |
483 | } | 488 | } |
484 | 489 | ||
485 | topLayout->addMultiCellWidget(dummy, 2,2,0,1); | 490 | topLayout->addMultiCellWidget(dummy, 2,2,0,1); |
486 | addWidBool(i18n("Full menu bar(nr)"), | 491 | addWidBool(i18n("Full menu bar(nr)"), |
487 | &(KOPrefs::instance()->mShowFullMenu),dummy); | 492 | &(KOPrefs::instance()->mShowFullMenu),dummy); |
488 | 493 | ||
489 | 494 | ||
490 | addWidBool(i18n("Mini icons in toolbar(nr)"), | 495 | addWidBool(i18n("Mini icons in toolbar(nr)"), |
491 | &(KOPrefs::instance()->mToolBarMiniIcons),dummy); | 496 | &(KOPrefs::instance()->mToolBarMiniIcons),dummy); |
492 | 497 | ||
493 | 498 | ||
494 | dummy = new QHBox(topFrame); | 499 | dummy = new Q3HBox(topFrame); |
495 | new QLabel(i18n("Days in What's Next:"),dummy); | 500 | new QLabel(i18n("Days in What's Next:"),dummy); |
496 | mWhatsNextSpin = new QSpinBox(1,14,1,dummy); | 501 | mWhatsNextSpin = new QSpinBox(1,14,1,dummy); |
497 | 502 | ||
498 | topLayout->addMultiCellWidget(dummy,3,3,0,1); | 503 | topLayout->addMultiCellWidget(dummy,3,3,0,1); |
499 | 504 | ||
500 | 505 | ||
501 | 506 | ||
502 | dummy = new QHBox(topFrame); | 507 | dummy = new Q3HBox(topFrame); |
503 | new QLabel(i18n("Days in Next-X-Days:"),dummy); | 508 | new QLabel(i18n("Days in Next-X-Days:"),dummy); |
504 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); | 509 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); |
505 | 510 | ||
506 | topLayout->addMultiCellWidget(dummy,4,4,0,1); | 511 | topLayout->addMultiCellWidget(dummy,4,4,0,1); |
507 | 512 | ||
508 | QHBox *prioBox = new QHBox(topFrame); | 513 | Q3HBox *prioBox = new Q3HBox(topFrame); |
509 | // intervalBox->setSpacing(spacingHint()); | 514 | // intervalBox->setSpacing(spacingHint()); |
510 | topLayout->addMultiCellWidget(prioBox,5,5,0,1); | 515 | topLayout->addMultiCellWidget(prioBox,5,5,0,1); |
511 | QString messa = i18n("Show topmost todo prios in What's Next:"); | 516 | QString messa = i18n("Show topmost todo prios in What's Next:"); |
512 | 517 | ||
513 | if ( QApplication::desktop()->width() < 300 ) | 518 | if ( QApplication::desktop()->width() < 300 ) |
514 | messa = i18n("Show topmost todo prios in What's N.:"); | 519 | messa = i18n("Show topmost todo prios in What's N.:"); |
515 | QLabel *prioLabel = new QLabel(messa, prioBox); | 520 | QLabel *prioLabel = new QLabel(messa, prioBox); |
516 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | 521 | mPrioSpin = new QSpinBox(0,5,1,prioBox); |
517 | if ( QApplication::desktop()->width() < 300 ) | 522 | if ( QApplication::desktop()->width() < 300 ) |
518 | mPrioSpin->setFixedWidth( 40 ); | 523 | mPrioSpin->setFixedWidth( 40 ); |
519 | 524 | ||
520 | // KPrefsDialogWidBool *bcc = | 525 | // KPrefsDialogWidBool *bcc = |
521 | // addWidBool(i18n("Send copy to owner when mailing events"), | 526 | // addWidBool(i18n("Send copy to owner when mailing events"), |
522 | // &(KOPrefs::instance()->mBcc),topFrame); | 527 | // &(KOPrefs::instance()->mBcc),topFrame); |
523 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); | 528 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); |
524 | 529 | ||
525 | 530 | ||
526 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); | 531 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); |
527 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); | 532 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); |
528 | 533 | ||
529 | // addWidBool(i18n("Enable automatic saving of calendar"), | 534 | // addWidBool(i18n("Enable automatic saving of calendar"), |
530 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); | 535 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); |
531 | 536 | ||
532 | QHBox *intervalBox = new QHBox(topFrame); | 537 | Q3HBox *intervalBox = new Q3HBox(topFrame); |
533 | // intervalBox->setSpacing(spacingHint()); | 538 | // intervalBox->setSpacing(spacingHint()); |
534 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); | 539 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); |
535 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); | 540 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); |
536 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); | 541 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); |
537 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); | 542 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); |
538 | /* | 543 | /* |
539 | QHBox * agendasize = new QHBox ( topFrame ); | 544 | QHBox * agendasize = new QHBox ( topFrame ); |
540 | 545 | ||
541 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); | 546 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); |
542 | 547 | ||
543 | 548 | ||
544 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); | 549 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); |
545 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); | 550 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); |
546 | */ | 551 | */ |
547 | KPrefsDialogWidBool *verticalScreen = | 552 | KPrefsDialogWidBool *verticalScreen = |
548 | addWidBool(i18n("Show vertical screen (Needs restart)"), | 553 | addWidBool(i18n("Show vertical screen (Needs restart)"), |
549 | &(KOPrefs::instance()->mVerticalScreen),topFrame); | 554 | &(KOPrefs::instance()->mVerticalScreen),topFrame); |
550 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); | 555 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); |
551 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); | 556 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); |
552 | 557 | ||
553 | KPrefsDialogWidBool *ask = | 558 | KPrefsDialogWidBool *ask = |
554 | addWidBool(i18n("Ask for quit when closing KO/Pi"), | 559 | addWidBool(i18n("Ask for quit when closing KO/Pi"), |
555 | &(KOPrefs::instance()->mAskForQuit),topFrame); | 560 | &(KOPrefs::instance()->mAskForQuit),topFrame); |
556 | topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); | 561 | topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); |
557 | 562 | ||
558 | 563 | ||
559 | /* | 564 | /* |
560 | KPrefsDialogWidBool *confirmCheck = | 565 | KPrefsDialogWidBool *confirmCheck = |
561 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), | 566 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), |
562 | topFrame); | 567 | topFrame); |
563 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); | 568 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); |
564 | 569 | ||
@@ -591,141 +596,141 @@ void KOPrefsDialog::setupMainTab() | |||
591 | 596 | ||
592 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); | 597 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); |
593 | 598 | ||
594 | // Default format unconditionally is iCalendar | 599 | // Default format unconditionally is iCalendar |
595 | defaultFormatGroup->groupBox()->hide(); | 600 | defaultFormatGroup->groupBox()->hide(); |
596 | 601 | ||
597 | KPrefsWidRadios *mailClientGroup = | 602 | KPrefsWidRadios *mailClientGroup = |
598 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), | 603 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), |
599 | topFrame); | 604 | topFrame); |
600 | mailClientGroup->addRadio(i18n("KMail")); | 605 | mailClientGroup->addRadio(i18n("KMail")); |
601 | mailClientGroup->addRadio(i18n("Sendmail")); | 606 | mailClientGroup->addRadio(i18n("Sendmail")); |
602 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); | 607 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); |
603 | 608 | ||
604 | KPrefsDialogWidBool *htmlsave = | 609 | KPrefsDialogWidBool *htmlsave = |
605 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), | 610 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), |
606 | topFrame); | 611 | topFrame); |
607 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); | 612 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); |
608 | 613 | ||
609 | KPrefsWidRadios *destinationGroup = | 614 | KPrefsWidRadios *destinationGroup = |
610 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), | 615 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), |
611 | topFrame); | 616 | topFrame); |
612 | destinationGroup->addRadio(i18n("be added to the standard resource")); | 617 | destinationGroup->addRadio(i18n("be added to the standard resource")); |
613 | destinationGroup->addRadio(i18n("be asked which resource to use")); | 618 | destinationGroup->addRadio(i18n("be asked which resource to use")); |
614 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); | 619 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); |
615 | 620 | ||
616 | topLayout->setRowStretch(14,1); | 621 | topLayout->setRowStretch(14,1); |
617 | */ | 622 | */ |
618 | } | 623 | } |
619 | 624 | ||
620 | 625 | ||
621 | void KOPrefsDialog::setupTimeTab() | 626 | void KOPrefsDialog::setupTimeTab() |
622 | { | 627 | { |
623 | QFrame *topFrame = addPage(i18n("Time"),0,0); | 628 | Q3Frame *topFrame = addPage(i18n("Time"),0,0); |
624 | // DesktopIcon("clock",KIcon::SizeMedium)); | 629 | // DesktopIcon("clock",KIcon::SizeMedium)); |
625 | 630 | ||
626 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 631 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2); |
627 | topLayout->setSpacing(spacingHint()); | 632 | topLayout->setSpacing(spacingHint()); |
628 | topLayout->setMargin(marginHint()); | 633 | topLayout->setMargin(marginHint()); |
629 | 634 | ||
630 | QHBox *dummy = new QHBox(topFrame); | 635 | Q3HBox *dummy = new Q3HBox(topFrame); |
631 | KPrefsWidTime *dayBegins = | 636 | KPrefsWidTime *dayBegins = |
632 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 637 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
633 | dummy); | 638 | dummy); |
634 | //topLayout->addWidget(dayBegins->label(),2,0); | 639 | //topLayout->addWidget(dayBegins->label(),2,0); |
635 | 640 | ||
636 | //topLayout->addWidget(dayBegins->spinBox(),2,1); | 641 | //topLayout->addWidget(dayBegins->spinBox(),2,1); |
637 | topLayout->addMultiCellWidget(dummy,0,0,0,1); | 642 | topLayout->addMultiCellWidget(dummy,0,0,0,1); |
638 | 643 | ||
639 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), | 644 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), |
640 | topFrame),1,0); | 645 | topFrame),1,0); |
641 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); | 646 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); |
642 | mStartTimeSpin->setSuffix(":00"); | 647 | mStartTimeSpin->setSuffix(":00"); |
643 | topLayout->addWidget(mStartTimeSpin,1,1); | 648 | topLayout->addWidget(mStartTimeSpin,1,1); |
644 | 649 | ||
645 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), | 650 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), |
646 | topFrame),2,0); | 651 | topFrame),2,0); |
647 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); | 652 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); |
648 | mDefaultDurationSpin->setSuffix(":00"); | 653 | mDefaultDurationSpin->setSuffix(":00"); |
649 | topLayout->addWidget(mDefaultDurationSpin,2,1); | 654 | topLayout->addWidget(mDefaultDurationSpin,2,1); |
650 | 655 | ||
651 | QStringList alarmList; | 656 | QStringList alarmList; |
652 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") | 657 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") |
653 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; | 658 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; |
654 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), | 659 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), |
655 | 3,0); | 660 | 3,0); |
656 | mAlarmTimeCombo = new QComboBox(topFrame); | 661 | mAlarmTimeCombo = new QComboBox(topFrame); |
657 | mAlarmTimeCombo->insertStringList(alarmList); | 662 | mAlarmTimeCombo->insertStringList(alarmList); |
658 | topLayout->addWidget(mAlarmTimeCombo,3,1); | 663 | topLayout->addWidget(mAlarmTimeCombo,3,1); |
659 | 664 | ||
660 | 665 | ||
661 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, | 666 | Q3GroupBox *workingHoursGroup = new Q3GroupBox(1,Qt::Horizontal, |
662 | i18n("Working Hours"), | 667 | i18n("Working Hours"), |
663 | topFrame); | 668 | topFrame); |
664 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); | 669 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); |
665 | workingHoursGroup->layout()->setSpacing( 0 ); | 670 | workingHoursGroup->layout()->setSpacing( 0 ); |
666 | workingHoursGroup->layout()->setMargin( 4 ); | 671 | workingHoursGroup->layout()->setMargin( 4 ); |
667 | QHBox *workStartBox = new QHBox(workingHoursGroup); | 672 | Q3HBox *workStartBox = new Q3HBox(workingHoursGroup); |
668 | // workStartBox->setMargin( 0 ); | 673 | // workStartBox->setMargin( 0 ); |
669 | addWidTime(i18n("Daily starting hour:"), | 674 | addWidTime(i18n("Daily starting hour:"), |
670 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); | 675 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); |
671 | 676 | ||
672 | QHBox *workEndBox = new QHBox(workingHoursGroup); | 677 | Q3HBox *workEndBox = new Q3HBox(workingHoursGroup); |
673 | //workEndBox->setMargin( 0 ); | 678 | //workEndBox->setMargin( 0 ); |
674 | addWidTime(i18n("Daily ending hour:"), | 679 | addWidTime(i18n("Daily ending hour:"), |
675 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); | 680 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); |
676 | QVBox *excludeBox = new QVBox(workingHoursGroup); | 681 | Q3VBox *excludeBox = new Q3VBox(workingHoursGroup); |
677 | //excludeBox->setMargin( 0 ); | 682 | //excludeBox->setMargin( 0 ); |
678 | addWidBool(i18n("Exclude holidays"), | 683 | addWidBool(i18n("Exclude holidays"), |
679 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); | 684 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); |
680 | 685 | ||
681 | addWidBool(i18n("Exclude Saturdays"), | 686 | addWidBool(i18n("Exclude Saturdays"), |
682 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); | 687 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); |
683 | 688 | ||
684 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), | 689 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), |
685 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), | 690 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), |
686 | // topFrame); | 691 | // topFrame); |
687 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); | 692 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); |
688 | 693 | ||
689 | // topLayout->setRowStretch(6,1); | 694 | // topLayout->setRowStretch(6,1); |
690 | } | 695 | } |
691 | 696 | ||
692 | 697 | ||
693 | void KOPrefsDialog::setupViewsTab() | 698 | void KOPrefsDialog::setupViewsTab() |
694 | { | 699 | { |
695 | 700 | ||
696 | QFrame *topFrame = addPage(i18n("Views"),0,0); | 701 | Q3Frame *topFrame = addPage(i18n("Views"),0,0); |
697 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 702 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
698 | 703 | ||
699 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); | 704 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,1); |
700 | topLayout->setSpacing(spacingHint()); | 705 | topLayout->setSpacing(spacingHint()); |
701 | topLayout->setMargin(marginHint()); | 706 | topLayout->setMargin(marginHint()); |
702 | 707 | ||
703 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; | 708 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; |
704 | // topLayout->addLayout(dayBeginsLayout,0,0); | 709 | // topLayout->addLayout(dayBeginsLayout,0,0); |
705 | 710 | ||
706 | // KPrefsWidTime *dayBegins = | 711 | // KPrefsWidTime *dayBegins = |
707 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 712 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
708 | // topFrame); | 713 | // topFrame); |
709 | // dayBeginsLayout->addWidget(dayBegins->label()); | 714 | // dayBeginsLayout->addWidget(dayBegins->label()); |
710 | // dayBeginsLayout->addStretch(1); | 715 | // dayBeginsLayout->addStretch(1); |
711 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); | 716 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); |
712 | 717 | ||
713 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; | 718 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; |
714 | // topLayout->addLayout(nextDaysLayout,1,0); | 719 | // topLayout->addLayout(nextDaysLayout,1,0); |
715 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); | 720 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); |
716 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); | 721 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); |
717 | // nextDaysLayout->addStretch(1); | 722 | // nextDaysLayout->addStretch(1); |
718 | // nextDaysLayout->addWidget(mNextXDaysSpin); | 723 | // nextDaysLayout->addWidget(mNextXDaysSpin); |
719 | 724 | ||
720 | 725 | ||
721 | int ii = 0; | 726 | int ii = 0; |
722 | KPrefsDialogWidBool *dummy = | 727 | KPrefsDialogWidBool *dummy = |
723 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), | 728 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), |
724 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); | 729 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); |
725 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 730 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
726 | 731 | ||
727 | dummy = | 732 | dummy = |
728 | addWidBool(i18n("Highlight current day in agenda"), | 733 | addWidBool(i18n("Highlight current day in agenda"), |
729 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); | 734 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); |
730 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 735 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
731 | 736 | ||
@@ -756,145 +761,145 @@ void KOPrefsDialog::setupViewsTab() | |||
756 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 761 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
757 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 762 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
758 | 763 | ||
759 | passwdk = | 764 | passwdk = |
760 | addWidBool(i18n("Show location in What's Next view"), | 765 | addWidBool(i18n("Show location in What's Next view"), |
761 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 766 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
762 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 767 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
763 | 768 | ||
764 | passwdk = | 769 | passwdk = |
765 | addWidBool(i18n("Show Sync Events in WN/Agenda view"), | 770 | addWidBool(i18n("Show Sync Events in WN/Agenda view"), |
766 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 771 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
767 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 772 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
768 | 773 | ||
769 | 774 | ||
770 | KPrefsDialogWidBool *marcusBainsEnabled = | 775 | KPrefsDialogWidBool *marcusBainsEnabled = |
771 | addWidBool(i18n("Show Marcus Bains line"), | 776 | addWidBool(i18n("Show Marcus Bains line"), |
772 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); | 777 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); |
773 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); | 778 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); |
774 | 779 | ||
775 | 780 | ||
776 | // topLayout->addWidget(hourSizeGroup,ii++,0); | 781 | // topLayout->addWidget(hourSizeGroup,ii++,0); |
777 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); | 782 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); |
778 | //topLayout->setRowStretch(11,1); | 783 | //topLayout->setRowStretch(11,1); |
779 | 784 | ||
780 | 785 | ||
781 | 786 | ||
782 | 787 | ||
783 | 788 | ||
784 | 789 | ||
785 | topFrame = addPage(i18n("ViewChange"),0,0); | 790 | topFrame = addPage(i18n("ViewChange"),0,0); |
786 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 791 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
787 | 792 | ||
788 | topLayout = new QGridLayout(topFrame,6,1); | 793 | topLayout = new Q3GridLayout(topFrame,6,1); |
789 | topLayout->setSpacing(spacingHint()); | 794 | topLayout->setSpacing(spacingHint()); |
790 | topLayout->setMargin(marginHint()); | 795 | topLayout->setMargin(marginHint()); |
791 | ii = 0; | 796 | ii = 0; |
792 | 797 | ||
793 | 798 | ||
794 | dummy = | 799 | dummy = |
795 | addWidBool(i18n("Hold fullscreen on view change"), | 800 | addWidBool(i18n("Hold fullscreen on view change"), |
796 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); | 801 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); |
797 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 802 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
798 | 803 | ||
799 | dummy = | 804 | dummy = |
800 | addWidBool(i18n("Hold non-fullscreen on view change"), | 805 | addWidBool(i18n("Hold non-fullscreen on view change"), |
801 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); | 806 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); |
802 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 807 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
803 | 808 | ||
804 | 809 | ||
805 | KPrefsDialogWidBool *fullViewTodo = | 810 | KPrefsDialogWidBool *fullViewTodo = |
806 | addWidBool(i18n("Event list view uses full window"), | 811 | addWidBool(i18n("Event list view uses full window"), |
807 | &(KOPrefs::instance()->mFullViewTodo),topFrame); | 812 | &(KOPrefs::instance()->mFullViewTodo),topFrame); |
808 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); | 813 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); |
809 | 814 | ||
810 | KPrefsDialogWidBool *fullViewMonth = | 815 | KPrefsDialogWidBool *fullViewMonth = |
811 | addWidBool(i18n("Next days view uses full window"), | 816 | addWidBool(i18n("Next days view uses full window"), |
812 | &(KOPrefs::instance()->mFullViewMonth),topFrame); | 817 | &(KOPrefs::instance()->mFullViewMonth),topFrame); |
813 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); | 818 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); |
814 | 819 | ||
815 | dummy = | 820 | dummy = |
816 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), | 821 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), |
817 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); | 822 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); |
818 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 823 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
819 | 824 | ||
820 | dummy = | 825 | dummy = |
821 | addWidBool(i18n("Set agenda to current time on change"), | 826 | addWidBool(i18n("Set agenda to current time on change"), |
822 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | 827 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); |
823 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 828 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
824 | 829 | ||
825 | dummy = | 830 | dummy = |
826 | addWidBool(i18n("Listview uses monthly timespan"), | 831 | addWidBool(i18n("Listview uses monthly timespan"), |
827 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); | 832 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); |
828 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 833 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
829 | dummy = | 834 | dummy = |
830 | addWidBool(i18n("Highlight selection in Time Edit"), | 835 | addWidBool(i18n("Highlight selection in Time Edit"), |
831 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); | 836 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); |
832 | topLayout->addWidget( dummy->checkBox(), ii++,0); | 837 | topLayout->addWidget( dummy->checkBox(), ii++,0); |
833 | 838 | ||
834 | 839 | ||
835 | 840 | ||
836 | 841 | ||
837 | 842 | ||
838 | topFrame = addPage(i18n("Month View"),0,0); | 843 | topFrame = addPage(i18n("Month View"),0,0); |
839 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 844 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
840 | 845 | ||
841 | topLayout = new QGridLayout(topFrame,5,1); | 846 | topLayout = new Q3GridLayout(topFrame,5,1); |
842 | topLayout->setSpacing(spacingHint()); | 847 | topLayout->setSpacing(spacingHint()); |
843 | topLayout->setMargin(marginHint()); | 848 | topLayout->setMargin(marginHint()); |
844 | ii = 0; | 849 | ii = 0; |
845 | QLabel *lab; | 850 | QLabel *lab; |
846 | QHBox *habo = new QHBox( topFrame ); | 851 | Q3HBox *habo = new Q3HBox( topFrame ); |
847 | if ( QApplication::desktop()->width() < 320 ) { | 852 | if ( QApplication::desktop()->width() < 320 ) { |
848 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | 853 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); |
849 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 854 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
850 | ii++; | 855 | ii++; |
851 | 856 | ||
852 | } else { | 857 | } else { |
853 | new QLabel ( i18n("Show events that recur "), habo ); | 858 | new QLabel ( i18n("Show events that recur "), habo ); |
854 | 859 | ||
855 | } | 860 | } |
856 | dailyRecur = | 861 | dailyRecur = |
857 | addWidBool(i18n("daily"), | 862 | addWidBool(i18n("daily"), |
858 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | 863 | &(KOPrefs::instance()->mMonthDailyRecur),habo); |
859 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 864 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
860 | 865 | ||
861 | weeklyRecur = | 866 | weeklyRecur = |
862 | addWidBool(i18n("weekly"), | 867 | addWidBool(i18n("weekly"), |
863 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | 868 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); |
864 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 869 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
865 | ii++; | 870 | ii++; |
866 | 871 | ||
867 | 872 | ||
868 | habo = new QHBox( topFrame ); | 873 | habo = new Q3HBox( topFrame ); |
869 | if ( QApplication::desktop()->width() < 320 ) { | 874 | if ( QApplication::desktop()->width() < 320 ) { |
870 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | 875 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); |
871 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 876 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
872 | ii++; | 877 | ii++; |
873 | 878 | ||
874 | } else { | 879 | } else { |
875 | new QLabel ( i18n("Show in every cell "), habo ); | 880 | new QLabel ( i18n("Show in every cell "), habo ); |
876 | } | 881 | } |
877 | weeklyRecur = | 882 | weeklyRecur = |
878 | addWidBool(i18n("short month"), | 883 | addWidBool(i18n("short month"), |
879 | &(KOPrefs::instance()->mMonthShowShort),habo); | 884 | &(KOPrefs::instance()->mMonthShowShort),habo); |
880 | weeklyRecur = | 885 | weeklyRecur = |
881 | addWidBool(i18n("icons"), | 886 | addWidBool(i18n("icons"), |
882 | &(KOPrefs::instance()->mMonthShowIcons),habo); | 887 | &(KOPrefs::instance()->mMonthShowIcons),habo); |
883 | 888 | ||
884 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 889 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
885 | ii++; | 890 | ii++; |
886 | #ifdef DESKTOP_VERSION | 891 | #ifdef DESKTOP_VERSION |
887 | KPrefsDialogWidBool *enableMonthScroll = | 892 | KPrefsDialogWidBool *enableMonthScroll = |
888 | addWidBool(i18n("Enable scrollbars in month view cells"), | 893 | addWidBool(i18n("Enable scrollbars in month view cells"), |
889 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | 894 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); |
890 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | 895 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); |
891 | #endif | 896 | #endif |
892 | 897 | ||
893 | dummy = | 898 | dummy = |
894 | addWidBool(i18n("Show Sat/Sun together"), | 899 | addWidBool(i18n("Show Sat/Sun together"), |
895 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | 900 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); |
896 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 901 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
897 | 902 | ||
898 | KPrefsDialogWidBool *coloredCategoriesInMonthView = | 903 | KPrefsDialogWidBool *coloredCategoriesInMonthView = |
899 | addWidBool(i18n("Month view uses category colors"), | 904 | addWidBool(i18n("Month view uses category colors"), |
900 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | 905 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); |
@@ -904,217 +909,217 @@ void KOPrefsDialog::setupViewsTab() | |||
904 | addWidBool(i18n("Categorie colors are applied to text"), | 909 | addWidBool(i18n("Categorie colors are applied to text"), |
905 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 910 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
906 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 911 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
907 | coloredCategoriesInMonthView = | 912 | coloredCategoriesInMonthView = |
908 | addWidBool(i18n("Month view uses day colors"), | 913 | addWidBool(i18n("Month view uses day colors"), |
909 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 914 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
910 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 915 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
911 | 916 | ||
912 | KPrefsWidColor *holidayColor = | 917 | KPrefsWidColor *holidayColor = |
913 | addWidColor(i18n("Day color odd months"), | 918 | addWidColor(i18n("Day color odd months"), |
914 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 919 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
915 | topLayout->addWidget(holidayColor->label(),ii,0); | 920 | topLayout->addWidget(holidayColor->label(),ii,0); |
916 | topLayout->addWidget(holidayColor->button(),ii++,1); | 921 | topLayout->addWidget(holidayColor->button(),ii++,1); |
917 | 922 | ||
918 | holidayColor = | 923 | holidayColor = |
919 | addWidColor(i18n("Day color even months"), | 924 | addWidColor(i18n("Day color even months"), |
920 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 925 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
921 | topLayout->addWidget(holidayColor->label(),ii,0); | 926 | topLayout->addWidget(holidayColor->label(),ii,0); |
922 | topLayout->addWidget(holidayColor->button(),ii++,1); | 927 | topLayout->addWidget(holidayColor->button(),ii++,1); |
923 | 928 | ||
924 | 929 | ||
925 | holidayColor = | 930 | holidayColor = |
926 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 931 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
927 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 932 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
928 | topLayout->addWidget(holidayColor->label(),ii,0); | 933 | topLayout->addWidget(holidayColor->label(),ii,0); |
929 | topLayout->addWidget(holidayColor->button(),ii++,1); | 934 | topLayout->addWidget(holidayColor->button(),ii++,1); |
930 | 935 | ||
931 | // *********************** Todo View | 936 | // *********************** Todo View |
932 | 937 | ||
933 | topFrame = addPage(i18n("Todo View"),0,0); | 938 | topFrame = addPage(i18n("Todo View"),0,0); |
934 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 939 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
935 | 940 | ||
936 | topLayout = new QGridLayout(topFrame,4,1); | 941 | topLayout = new Q3GridLayout(topFrame,4,1); |
937 | topLayout->setSpacing(spacingHint()); | 942 | topLayout->setSpacing(spacingHint()); |
938 | topLayout->setMargin(marginHint()); | 943 | topLayout->setMargin(marginHint()); |
939 | ii = 0; | 944 | ii = 0; |
940 | 945 | ||
941 | KPrefsDialogWidBool *showCompletedTodo = | 946 | KPrefsDialogWidBool *showCompletedTodo = |
942 | addWidBool(i18n("To-do view shows completed Todos"), | 947 | addWidBool(i18n("To-do view shows completed Todos"), |
943 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 948 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
944 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 949 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
945 | dummy = | 950 | dummy = |
946 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 951 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
947 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 952 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
948 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 953 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
949 | 954 | ||
950 | dummy = | 955 | dummy = |
951 | addWidBool(i18n("Small To-do view uses smaller font"), | 956 | addWidBool(i18n("Small To-do view uses smaller font"), |
952 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | 957 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); |
953 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 958 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
954 | 959 | ||
955 | 960 | ||
956 | 961 | ||
957 | dummy = | 962 | dummy = |
958 | addWidBool(i18n("Todo view uses category colors"), | 963 | addWidBool(i18n("Todo view uses category colors"), |
959 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | 964 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); |
960 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 965 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
961 | 966 | ||
962 | 967 | ||
963 | QWidget* wid = new QWidget( topFrame ); | 968 | QWidget* wid = new QWidget( topFrame ); |
964 | // Todo due today color | 969 | // Todo due today color |
965 | KPrefsWidColor *todoDueTodayColor = | 970 | KPrefsWidColor *todoDueTodayColor = |
966 | addWidColor(i18n("Todo due today color:"), | 971 | addWidColor(i18n("Todo due today color:"), |
967 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | 972 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); |
968 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | 973 | Q3HBoxLayout *widLayout = new Q3HBoxLayout(wid); |
969 | widLayout->addWidget( todoDueTodayColor->label() ); | 974 | widLayout->addWidget( todoDueTodayColor->label() ); |
970 | widLayout->addWidget( todoDueTodayColor->button() ); | 975 | widLayout->addWidget( todoDueTodayColor->button() ); |
971 | topLayout->addWidget(wid,ii++,0); | 976 | topLayout->addWidget(wid,ii++,0); |
972 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | 977 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); |
973 | 978 | ||
974 | // Todo overdue color | 979 | // Todo overdue color |
975 | wid = new QWidget( topFrame ); | 980 | wid = new QWidget( topFrame ); |
976 | widLayout = new QHBoxLayout(wid); | 981 | widLayout = new Q3HBoxLayout(wid); |
977 | KPrefsWidColor *todoOverdueColor = | 982 | KPrefsWidColor *todoOverdueColor = |
978 | addWidColor(i18n("Todo overdue color:"), | 983 | addWidColor(i18n("Todo overdue color:"), |
979 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | 984 | &(KOPrefs::instance()->mTodoOverdueColor),wid); |
980 | widLayout->addWidget(todoOverdueColor->label()); | 985 | widLayout->addWidget(todoOverdueColor->label()); |
981 | widLayout->addWidget(todoOverdueColor->button()); | 986 | widLayout->addWidget(todoOverdueColor->button()); |
982 | topLayout->addWidget(wid,ii++,0); | 987 | topLayout->addWidget(wid,ii++,0); |
983 | 988 | ||
984 | dummy = | 989 | dummy = |
985 | addWidBool(i18n("Colors are applied to text"), | 990 | addWidBool(i18n("Colors are applied to text"), |
986 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | 991 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); |
987 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 992 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
988 | 993 | ||
989 | dummy = | 994 | dummy = |
990 | addWidBool(i18n("Allday Agenda view shows todos"), | 995 | addWidBool(i18n("Allday Agenda view shows todos"), |
991 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | 996 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); |
992 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 997 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
993 | 998 | ||
994 | 999 | ||
995 | 1000 | ||
996 | 1001 | ||
997 | topFrame = addPage(i18n("Alarm"),0,0); | 1002 | topFrame = addPage(i18n("Alarm"),0,0); |
998 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 1003 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
999 | 1004 | ||
1000 | topLayout = new QGridLayout(topFrame,2,1); | 1005 | topLayout = new Q3GridLayout(topFrame,2,1); |
1001 | topLayout->setSpacing(spacingHint()); | 1006 | topLayout->setSpacing(spacingHint()); |
1002 | topLayout->setMargin(marginHint()); | 1007 | topLayout->setMargin(marginHint()); |
1003 | int iii = 0; | 1008 | int iii = 0; |
1004 | 1009 | ||
1005 | dummy = | 1010 | dummy = |
1006 | addWidBool(i18n("Use internal alarm notification"), | 1011 | addWidBool(i18n("Use internal alarm notification"), |
1007 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | 1012 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); |
1008 | topLayout->addWidget(dummy->checkBox(),iii++,0); | 1013 | topLayout->addWidget(dummy->checkBox(),iii++,0); |
1009 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); | 1014 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); |
1010 | 1015 | ||
1011 | topLayout->addWidget(lab ,iii++,0); | 1016 | topLayout->addWidget(lab ,iii++,0); |
1012 | #ifndef DESKTOP_VERSION | 1017 | #ifndef DESKTOP_VERSION |
1013 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 1018 | lab->setAlignment( Qt::AlignLeft|Qt::TextWordWrap|Qt::AlignTop); |
1014 | #else | 1019 | #else |
1015 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 1020 | lab->setAlignment( Qt::AlignLeft|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop); |
1016 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 1021 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
1017 | #endif | 1022 | #endif |
1018 | 1023 | ||
1019 | QHBox* dummyBox = new QHBox(topFrame); | 1024 | Q3HBox* dummyBox = new Q3HBox(topFrame); |
1020 | new QLabel(i18n("Play beeps count:"),dummyBox); | 1025 | new QLabel(i18n("Play beeps count:"),dummyBox); |
1021 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | 1026 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); |
1022 | topLayout->addWidget(dummyBox,iii++,0); | 1027 | topLayout->addWidget(dummyBox,iii++,0); |
1023 | 1028 | ||
1024 | dummyBox = new QHBox(topFrame); | 1029 | dummyBox = new Q3HBox(topFrame); |
1025 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | 1030 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); |
1026 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | 1031 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); |
1027 | topLayout->addWidget(dummyBox,iii++,0); | 1032 | topLayout->addWidget(dummyBox,iii++,0); |
1028 | 1033 | ||
1029 | dummyBox = new QHBox(topFrame); | 1034 | dummyBox = new Q3HBox(topFrame); |
1030 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | 1035 | new QLabel(i18n("Default suspend time in min:"),dummyBox); |
1031 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | 1036 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); |
1032 | topLayout->addWidget(dummyBox,iii++,0); | 1037 | topLayout->addWidget(dummyBox,iii++,0); |
1033 | 1038 | ||
1034 | dummyBox = new QHBox(topFrame); | 1039 | dummyBox = new Q3HBox(topFrame); |
1035 | new QLabel(i18n("Auto suspend count:"),dummyBox); | 1040 | new QLabel(i18n("Auto suspend count:"),dummyBox); |
1036 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | 1041 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); |
1037 | topLayout->addWidget(dummyBox,iii++,0); | 1042 | topLayout->addWidget(dummyBox,iii++,0); |
1038 | 1043 | ||
1039 | 1044 | ||
1040 | 1045 | ||
1041 | 1046 | ||
1042 | 1047 | ||
1043 | 1048 | ||
1044 | 1049 | ||
1045 | QHBox* hbo = new QHBox ( topFrame ); | 1050 | Q3HBox* hbo = new Q3HBox ( topFrame ); |
1046 | mDefaultAlarmFile = new QLineEdit(hbo); | 1051 | mDefaultAlarmFile = new QLineEdit(hbo); |
1047 | QPushButton * loadTemplate = new QPushButton(hbo); | 1052 | QPushButton * loadTemplate = new QPushButton(hbo); |
1048 | QPixmap icon; | 1053 | QPixmap icon; |
1049 | if ( QApplication::desktop()->width() < 321 ) | 1054 | if ( QApplication::desktop()->width() < 321 ) |
1050 | icon = SmallIcon("fileimport16"); | 1055 | icon = SmallIcon("fileimport16"); |
1051 | else | 1056 | else |
1052 | icon = SmallIcon("fileimport"); | 1057 | icon = SmallIcon("fileimport"); |
1053 | loadTemplate->setIconSet (icon ) ; | 1058 | loadTemplate->setIconSet (icon ) ; |
1054 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | 1059 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); |
1055 | int size = loadTemplate->sizeHint().height(); | 1060 | int size = loadTemplate->sizeHint().height(); |
1056 | loadTemplate->setFixedSize( size, size ); | 1061 | loadTemplate->setFixedSize( size, size ); |
1057 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | 1062 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); |
1058 | // topLayout->addWidget(lab ,iii++,0); | 1063 | // topLayout->addWidget(lab ,iii++,0); |
1059 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | 1064 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); |
1060 | topLayout->addWidget(lab ,iii++,0); | 1065 | topLayout->addWidget(lab ,iii++,0); |
1061 | topLayout->addWidget(hbo,iii++,0); | 1066 | topLayout->addWidget(hbo,iii++,0); |
1062 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); | 1067 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); |
1063 | 1068 | ||
1064 | // topLayout->addWidget(lab ,iii++,0); | 1069 | // topLayout->addWidget(lab ,iii++,0); |
1065 | // #ifndef DESKTOP_VERSION | 1070 | // #ifndef DESKTOP_VERSION |
1066 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 1071 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
1067 | // #else | 1072 | // #else |
1068 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 1073 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
1069 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 1074 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
1070 | // #endif | 1075 | // #endif |
1071 | 1076 | ||
1072 | 1077 | ||
1073 | } | 1078 | } |
1074 | 1079 | ||
1075 | void KOPrefsDialog::selectSoundFile() | 1080 | void KOPrefsDialog::selectSoundFile() |
1076 | { | 1081 | { |
1077 | QString fileName = mDefaultAlarmFile->text(); | 1082 | QString fileName = mDefaultAlarmFile->text(); |
1078 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | 1083 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); |
1079 | if ( fileName.length() > 0 ) | 1084 | if ( fileName.length() > 0 ) |
1080 | mDefaultAlarmFile->setText( fileName ); | 1085 | mDefaultAlarmFile->setText( fileName ); |
1081 | } | 1086 | } |
1082 | void KOPrefsDialog::setupFontsTab() | 1087 | void KOPrefsDialog::setupFontsTab() |
1083 | { | 1088 | { |
1084 | 1089 | ||
1085 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 1090 | Q3Frame *topFrame = addPage(i18n("Fonts"),0,0); |
1086 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 1091 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
1087 | 1092 | ||
1088 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | 1093 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,7,3); |
1089 | topLayout->setSpacing(1); | 1094 | topLayout->setSpacing(1); |
1090 | topLayout->setMargin(3); | 1095 | topLayout->setMargin(3); |
1091 | KPrefsDialogWidFont * tVFont; | 1096 | KPrefsDialogWidFont * tVFont; |
1092 | int i = 0; | 1097 | int i = 0; |
1093 | KPrefsDialogWidFont *timeLabelsFont = | 1098 | KPrefsDialogWidFont *timeLabelsFont = |
1094 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | 1099 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), |
1095 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | 1100 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); |
1096 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1101 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1097 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1102 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1098 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1103 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1099 | ++i; | 1104 | ++i; |
1100 | 1105 | ||
1101 | 1106 | ||
1102 | timeLabelsFont = | 1107 | timeLabelsFont = |
1103 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | 1108 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), |
1104 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | 1109 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); |
1105 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1110 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1106 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1111 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1107 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1112 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1108 | ++i; | 1113 | ++i; |
1109 | 1114 | ||
1110 | KPrefsDialogWidFont *timeBarFont = | 1115 | KPrefsDialogWidFont *timeBarFont = |
1111 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | 1116 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), |
1112 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | 1117 | &(KOPrefs::instance()->mTimeBarFont),topFrame); |
1113 | topLayout->addWidget(timeBarFont->label(),i,0); | 1118 | topLayout->addWidget(timeBarFont->label(),i,0); |
1114 | topLayout->addWidget(timeBarFont->preview(),i,1); | 1119 | topLayout->addWidget(timeBarFont->preview(),i,1); |
1115 | topLayout->addWidget(timeBarFont->button(),i,2); | 1120 | topLayout->addWidget(timeBarFont->button(),i,2); |
1116 | ++i; | 1121 | ++i; |
1117 | 1122 | ||
1118 | 1123 | ||
1119 | KPrefsDialogWidFont *marcusBainsFont = | 1124 | KPrefsDialogWidFont *marcusBainsFont = |
1120 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | 1125 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), |
@@ -1123,65 +1128,65 @@ void KOPrefsDialog::setupFontsTab() | |||
1123 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | 1128 | topLayout->addWidget(marcusBainsFont->preview(),i,1); |
1124 | topLayout->addWidget(marcusBainsFont->button(),i,2); | 1129 | topLayout->addWidget(marcusBainsFont->button(),i,2); |
1125 | ++i; | 1130 | ++i; |
1126 | 1131 | ||
1127 | tVFont = | 1132 | tVFont = |
1128 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | 1133 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), |
1129 | &(KOPrefs::instance()->mEventViewFont),topFrame); | 1134 | &(KOPrefs::instance()->mEventViewFont),topFrame); |
1130 | topLayout->addWidget(tVFont->label(),i,0); | 1135 | topLayout->addWidget(tVFont->label(),i,0); |
1131 | topLayout->addWidget(tVFont->preview(),i,1); | 1136 | topLayout->addWidget(tVFont->preview(),i,1); |
1132 | topLayout->addWidget(tVFont->button(),i,2); | 1137 | topLayout->addWidget(tVFont->button(),i,2); |
1133 | ++i; | 1138 | ++i; |
1134 | 1139 | ||
1135 | 1140 | ||
1136 | 1141 | ||
1137 | tVFont = | 1142 | tVFont = |
1138 | addWidFont(i18n("Details"),i18n("EditorBox:"), | 1143 | addWidFont(i18n("Details"),i18n("EditorBox:"), |
1139 | &(KOPrefs::instance()->mEditBoxFont),topFrame); | 1144 | &(KOPrefs::instance()->mEditBoxFont),topFrame); |
1140 | topLayout->addWidget(tVFont->label(),i,0); | 1145 | topLayout->addWidget(tVFont->label(),i,0); |
1141 | topLayout->addWidget(tVFont->preview(),i,1); | 1146 | topLayout->addWidget(tVFont->preview(),i,1); |
1142 | topLayout->addWidget(tVFont->button(),i,2); | 1147 | topLayout->addWidget(tVFont->button(),i,2); |
1143 | ++i; | 1148 | ++i; |
1144 | 1149 | ||
1145 | 1150 | ||
1146 | 1151 | ||
1147 | topLayout->setColStretch(1,1); | 1152 | topLayout->setColStretch(1,1); |
1148 | topLayout->setRowStretch(4,1); | 1153 | topLayout->setRowStretch(4,1); |
1149 | 1154 | ||
1150 | 1155 | ||
1151 | i = 0; | 1156 | i = 0; |
1152 | topFrame = addPage(i18n("View Fonts"),0, | 1157 | topFrame = addPage(i18n("View Fonts"),0, |
1153 | DesktopIcon("fonts",KIcon::SizeMedium)); | 1158 | DesktopIcon("fonts",KIcon::SizeMedium)); |
1154 | 1159 | ||
1155 | topLayout = new QGridLayout(topFrame,7,3); | 1160 | topLayout = new Q3GridLayout(topFrame,7,3); |
1156 | topLayout->setSpacing(1); | 1161 | topLayout->setSpacing(1); |
1157 | topLayout->setMargin(3); | 1162 | topLayout->setMargin(3); |
1158 | 1163 | ||
1159 | tVFont = | 1164 | tVFont = |
1160 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), | 1165 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), |
1161 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); | 1166 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); |
1162 | topLayout->addWidget(tVFont->label(),i,0); | 1167 | topLayout->addWidget(tVFont->label(),i,0); |
1163 | topLayout->addWidget(tVFont->preview(),i,1); | 1168 | topLayout->addWidget(tVFont->preview(),i,1); |
1164 | topLayout->addWidget(tVFont->button(),i,2); | 1169 | topLayout->addWidget(tVFont->button(),i,2); |
1165 | ++i; | 1170 | ++i; |
1166 | KPrefsDialogWidFont *agendaViewFont = | 1171 | KPrefsDialogWidFont *agendaViewFont = |
1167 | addWidFont(i18n("Event text"),i18n("Agenda view:"), | 1172 | addWidFont(i18n("Event text"),i18n("Agenda view:"), |
1168 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); | 1173 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); |
1169 | topLayout->addWidget(agendaViewFont->label(),i,0); | 1174 | topLayout->addWidget(agendaViewFont->label(),i,0); |
1170 | topLayout->addWidget(agendaViewFont->preview(),i,1); | 1175 | topLayout->addWidget(agendaViewFont->preview(),i,1); |
1171 | topLayout->addWidget(agendaViewFont->button(),i,2); | 1176 | topLayout->addWidget(agendaViewFont->button(),i,2); |
1172 | ++i; | 1177 | ++i; |
1173 | 1178 | ||
1174 | 1179 | ||
1175 | KPrefsDialogWidFont *monthViewFont = | 1180 | KPrefsDialogWidFont *monthViewFont = |
1176 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), | 1181 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), |
1177 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); | 1182 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); |
1178 | topLayout->addWidget(monthViewFont->label(),i,0); | 1183 | topLayout->addWidget(monthViewFont->label(),i,0); |
1179 | topLayout->addWidget(monthViewFont->preview(),i,1); | 1184 | topLayout->addWidget(monthViewFont->preview(),i,1); |
1180 | topLayout->addWidget(monthViewFont->button(),i,2); | 1185 | topLayout->addWidget(monthViewFont->button(),i,2); |
1181 | ++i; | 1186 | ++i; |
1182 | 1187 | ||
1183 | 1188 | ||
1184 | KPrefsDialogWidFont *lVFont = | 1189 | KPrefsDialogWidFont *lVFont = |
1185 | addWidFont(i18n("Event"),i18n("List View:"), | 1190 | addWidFont(i18n("Event"),i18n("List View:"), |
1186 | &(KOPrefs::instance()->mListViewFont),topFrame); | 1191 | &(KOPrefs::instance()->mListViewFont),topFrame); |
1187 | topLayout->addWidget(lVFont->label(),i,0); | 1192 | topLayout->addWidget(lVFont->label(),i,0); |
@@ -1191,78 +1196,78 @@ void KOPrefsDialog::setupFontsTab() | |||
1191 | 1196 | ||
1192 | 1197 | ||
1193 | tVFont = | 1198 | tVFont = |
1194 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), | 1199 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), |
1195 | &(KOPrefs::instance()->mTodoViewFont),topFrame); | 1200 | &(KOPrefs::instance()->mTodoViewFont),topFrame); |
1196 | topLayout->addWidget(tVFont->label(),i,0); | 1201 | topLayout->addWidget(tVFont->label(),i,0); |
1197 | topLayout->addWidget(tVFont->preview(),i,1); | 1202 | topLayout->addWidget(tVFont->preview(),i,1); |
1198 | topLayout->addWidget(tVFont->button(),i,2); | 1203 | topLayout->addWidget(tVFont->button(),i,2); |
1199 | ++i; | 1204 | ++i; |
1200 | 1205 | ||
1201 | 1206 | ||
1202 | tVFont = | 1207 | tVFont = |
1203 | addWidFont(i18n("Today"),i18n("JournalView:"), | 1208 | addWidFont(i18n("Today"),i18n("JournalView:"), |
1204 | &(KOPrefs::instance()->mJornalViewFont),topFrame); | 1209 | &(KOPrefs::instance()->mJornalViewFont),topFrame); |
1205 | topLayout->addWidget(tVFont->label(),i,0); | 1210 | topLayout->addWidget(tVFont->label(),i,0); |
1206 | topLayout->addWidget(tVFont->preview(),i,1); | 1211 | topLayout->addWidget(tVFont->preview(),i,1); |
1207 | topLayout->addWidget(tVFont->button(),i,2); | 1212 | topLayout->addWidget(tVFont->button(),i,2); |
1208 | ++i; | 1213 | ++i; |
1209 | 1214 | ||
1210 | 1215 | ||
1211 | 1216 | ||
1212 | 1217 | ||
1213 | topLayout->setColStretch(1,1); | 1218 | topLayout->setColStretch(1,1); |
1214 | topLayout->setRowStretch(4,1); | 1219 | topLayout->setRowStretch(4,1); |
1215 | 1220 | ||
1216 | 1221 | ||
1217 | 1222 | ||
1218 | 1223 | ||
1219 | } | 1224 | } |
1220 | 1225 | ||
1221 | void KOPrefsDialog::setupColorsTab() | 1226 | void KOPrefsDialog::setupColorsTab() |
1222 | { | 1227 | { |
1223 | QFrame *topFrame = addPage(i18n("Colors"),0,0); | 1228 | Q3Frame *topFrame = addPage(i18n("Colors"),0,0); |
1224 | // DesktopIcon("colorize",KIcon::SizeMedium)); | 1229 | // DesktopIcon("colorize",KIcon::SizeMedium)); |
1225 | 1230 | ||
1226 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1231 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,2); |
1227 | // topLayout->setSpacing(spacingHint()); | 1232 | // topLayout->setSpacing(spacingHint()); |
1228 | // topLayout->setMargin(marginHint()); | 1233 | // topLayout->setMargin(marginHint()); |
1229 | 1234 | ||
1230 | topLayout->setSpacing(2); | 1235 | topLayout->setSpacing(2); |
1231 | topLayout->setMargin(3); | 1236 | topLayout->setMargin(3); |
1232 | 1237 | ||
1233 | int ii = 1; | 1238 | int ii = 1; |
1234 | QGroupBox *categoryGroup ; | 1239 | Q3GroupBox *categoryGroup ; |
1235 | 1240 | ||
1236 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), | 1241 | categoryGroup = new Q3GroupBox(1,Qt::Vertical,i18n("Categories"), |
1237 | topFrame); | 1242 | topFrame); |
1238 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); | 1243 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); |
1239 | 1244 | ||
1240 | mCategoryCombo = new QComboBox(categoryGroup); | 1245 | mCategoryCombo = new QComboBox(categoryGroup); |
1241 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1246 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1242 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); | 1247 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); |
1243 | 1248 | ||
1244 | mCategoryButton = new KColorButton(categoryGroup); | 1249 | mCategoryButton = new KColorButton(categoryGroup); |
1245 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); | 1250 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); |
1246 | updateCategoryColor(); | 1251 | updateCategoryColor(); |
1247 | 1252 | ||
1248 | 1253 | ||
1249 | // Holiday Color | 1254 | // Holiday Color |
1250 | 1255 | ||
1251 | KPrefsWidColor *holidayColor = | 1256 | KPrefsWidColor *holidayColor = |
1252 | addWidColor(i18n("Holiday color:"), | 1257 | addWidColor(i18n("Holiday color:"), |
1253 | &(KOPrefs::instance()->mHolidayColor),topFrame); | 1258 | &(KOPrefs::instance()->mHolidayColor),topFrame); |
1254 | topLayout->addWidget(holidayColor->label(),ii,0); | 1259 | topLayout->addWidget(holidayColor->label(),ii,0); |
1255 | topLayout->addWidget(holidayColor->button(),ii++,1); | 1260 | topLayout->addWidget(holidayColor->button(),ii++,1); |
1256 | 1261 | ||
1257 | // Highlight Color | 1262 | // Highlight Color |
1258 | KPrefsWidColor *highlightColor = | 1263 | KPrefsWidColor *highlightColor = |
1259 | addWidColor(i18n("Highlight color:"), | 1264 | addWidColor(i18n("Highlight color:"), |
1260 | &(KOPrefs::instance()->mHighlightColor),topFrame); | 1265 | &(KOPrefs::instance()->mHighlightColor),topFrame); |
1261 | topLayout->addWidget(highlightColor->label(),ii,0); | 1266 | topLayout->addWidget(highlightColor->label(),ii,0); |
1262 | topLayout->addWidget(highlightColor->button(),ii++,1); | 1267 | topLayout->addWidget(highlightColor->button(),ii++,1); |
1263 | 1268 | ||
1264 | // Event color | 1269 | // Event color |
1265 | KPrefsWidColor *eventColor = | 1270 | KPrefsWidColor *eventColor = |
1266 | addWidColor(i18n("Default event color:"), | 1271 | addWidColor(i18n("Default event color:"), |
1267 | &(KOPrefs::instance()->mEventColor),topFrame); | 1272 | &(KOPrefs::instance()->mEventColor),topFrame); |
1268 | topLayout->addWidget(eventColor->label(),ii,0); | 1273 | topLayout->addWidget(eventColor->label(),ii,0); |
@@ -1297,129 +1302,129 @@ void KOPrefsDialog::setupColorsTab() | |||
1297 | KPrefsWidColor * workingHoursColor2 = | 1302 | KPrefsWidColor * workingHoursColor2 = |
1298 | addWidColor(i18n("Frames, labels, etc.:"), | 1303 | addWidColor(i18n("Frames, labels, etc.:"), |
1299 | &(KOPrefs::instance()->mAppColor2),topFrame); | 1304 | &(KOPrefs::instance()->mAppColor2),topFrame); |
1300 | topLayout->addWidget(workingHoursColor2->label(),ii,0); | 1305 | topLayout->addWidget(workingHoursColor2->label(),ii,0); |
1301 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); | 1306 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); |
1302 | 1307 | ||
1303 | 1308 | ||
1304 | 1309 | ||
1305 | } | 1310 | } |
1306 | 1311 | ||
1307 | void KOPrefsDialog::setCategoryColor() | 1312 | void KOPrefsDialog::setCategoryColor() |
1308 | { | 1313 | { |
1309 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); | 1314 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); |
1310 | } | 1315 | } |
1311 | 1316 | ||
1312 | void KOPrefsDialog::updateCategoryColor() | 1317 | void KOPrefsDialog::updateCategoryColor() |
1313 | { | 1318 | { |
1314 | QString cat = mCategoryCombo->currentText(); | 1319 | QString cat = mCategoryCombo->currentText(); |
1315 | QColor *color = mCategoryDict.find(cat); | 1320 | QColor *color = mCategoryDict.find(cat); |
1316 | if (!color) { | 1321 | if (!color) { |
1317 | color = KOPrefs::instance()->categoryColor(cat); | 1322 | color = KOPrefs::instance()->categoryColor(cat); |
1318 | } | 1323 | } |
1319 | if (color) { | 1324 | if (color) { |
1320 | mCategoryButton->setColor(*color); | 1325 | mCategoryButton->setColor(*color); |
1321 | } | 1326 | } |
1322 | } | 1327 | } |
1323 | 1328 | ||
1324 | void KOPrefsDialog::setupPrinterTab() | 1329 | void KOPrefsDialog::setupPrinterTab() |
1325 | { | 1330 | { |
1326 | mPrinterTab = addPage(i18n("Printing"),0, | 1331 | mPrinterTab = addPage(i18n("Printing"),0, |
1327 | DesktopIcon("fileprint",KIcon::SizeMedium)); | 1332 | DesktopIcon("fileprint",KIcon::SizeMedium)); |
1328 | 1333 | ||
1329 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); | 1334 | Q3GridLayout *topLayout = new Q3GridLayout(mPrinterTab,5,2); |
1330 | topLayout->setSpacing(spacingHint()); | 1335 | topLayout->setSpacing(spacingHint()); |
1331 | topLayout->setMargin(marginHint()); | 1336 | topLayout->setMargin(marginHint()); |
1332 | 1337 | ||
1333 | topLayout->setRowStretch(4,1); | 1338 | topLayout->setRowStretch(4,1); |
1334 | } | 1339 | } |
1335 | 1340 | ||
1336 | void KOPrefsDialog::setupGroupSchedulingTab() | 1341 | void KOPrefsDialog::setupGroupSchedulingTab() |
1337 | { | 1342 | { |
1338 | #if 0 | 1343 | #if 0 |
1339 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, | 1344 | Q3Frame *topFrame = addPage(i18n("Group Scheduling"),0, |
1340 | DesktopIcon("personal",KIcon::SizeMedium)); | 1345 | DesktopIcon("personal",KIcon::SizeMedium)); |
1341 | 1346 | ||
1342 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 1347 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2); |
1343 | topLayout->setSpacing(spacingHint()); | 1348 | topLayout->setSpacing(spacingHint()); |
1344 | topLayout->setMargin(marginHint()); | 1349 | topLayout->setMargin(marginHint()); |
1345 | 1350 | ||
1346 | #if 0 | 1351 | #if 0 |
1347 | KPrefsWidRadios *schedulerGroup = | 1352 | KPrefsWidRadios *schedulerGroup = |
1348 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), | 1353 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), |
1349 | topFrame); | 1354 | topFrame); |
1350 | schedulerGroup->addRadio("Dummy"); // Only for debugging | 1355 | schedulerGroup->addRadio("Dummy"); // Only for debugging |
1351 | schedulerGroup->addRadio(i18n("Mail client")); | 1356 | schedulerGroup->addRadio(i18n("Mail client")); |
1352 | 1357 | ||
1353 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); | 1358 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); |
1354 | #endif | 1359 | #endif |
1355 | 1360 | ||
1356 | KPrefsWidRadios *sendGroup = | 1361 | KPrefsWidRadios *sendGroup = |
1357 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), | 1362 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), |
1358 | topFrame); | 1363 | topFrame); |
1359 | sendGroup->addRadio(i18n("Send to outbox")); | 1364 | sendGroup->addRadio(i18n("Send to outbox")); |
1360 | sendGroup->addRadio(i18n("Send directly")); | 1365 | sendGroup->addRadio(i18n("Send directly")); |
1361 | 1366 | ||
1362 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); | 1367 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); |
1363 | 1368 | ||
1364 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); | 1369 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); |
1365 | mAMails = new QListView(topFrame); | 1370 | mAMails = new Q3ListView(topFrame); |
1366 | mAMails->addColumn(i18n("Email"),300); | 1371 | mAMails->addColumn(i18n("Email"),300); |
1367 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); | 1372 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); |
1368 | 1373 | ||
1369 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); | 1374 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); |
1370 | aEmailsEdit = new QLineEdit(topFrame); | 1375 | aEmailsEdit = new QLineEdit(topFrame); |
1371 | aEmailsEdit->setEnabled(false); | 1376 | aEmailsEdit->setEnabled(false); |
1372 | topLayout->addWidget(aEmailsEdit,4,1); | 1377 | topLayout->addWidget(aEmailsEdit,4,1); |
1373 | 1378 | ||
1374 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); | 1379 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); |
1375 | topLayout->addWidget(add,5,0); | 1380 | topLayout->addWidget(add,5,0); |
1376 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); | 1381 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); |
1377 | topLayout->addWidget(del,5,1); | 1382 | topLayout->addWidget(del,5,1); |
1378 | 1383 | ||
1379 | //topLayout->setRowStretch(2,1); | 1384 | //topLayout->setRowStretch(2,1); |
1380 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); | 1385 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); |
1381 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); | 1386 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); |
1382 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); | 1387 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); |
1383 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); | 1388 | connect(mAMails,SIGNAL(selectionChanged(Q3ListViewItem *)),SLOT(updateInput())); |
1384 | #endif | 1389 | #endif |
1385 | } | 1390 | } |
1386 | 1391 | ||
1387 | void KOPrefsDialog::setupGroupAutomationTab() | 1392 | void KOPrefsDialog::setupGroupAutomationTab() |
1388 | { | 1393 | { |
1389 | return; | 1394 | return; |
1390 | QFrame *topFrame = addPage(i18n("Group Automation"),0, | 1395 | Q3Frame *topFrame = addPage(i18n("Group Automation"),0, |
1391 | DesktopIcon("personal",KIcon::SizeMedium)); | 1396 | DesktopIcon("personal",KIcon::SizeMedium)); |
1392 | 1397 | ||
1393 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); | 1398 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,1); |
1394 | topLayout->setSpacing(spacingHint()); | 1399 | topLayout->setSpacing(spacingHint()); |
1395 | topLayout->setMargin(marginHint()); | 1400 | topLayout->setMargin(marginHint()); |
1396 | 1401 | ||
1397 | KPrefsWidRadios *autoRefreshGroup = | 1402 | KPrefsWidRadios *autoRefreshGroup = |
1398 | addWidRadios(i18n("Auto Send Refresh"), | 1403 | addWidRadios(i18n("Auto Send Refresh"), |
1399 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); | 1404 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); |
1400 | autoRefreshGroup->addRadio(i18n("Never")); | 1405 | autoRefreshGroup->addRadio(i18n("Never")); |
1401 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); | 1406 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); |
1402 | //autoRefreshGroup->addRadio(i18n("selected emails")); | 1407 | //autoRefreshGroup->addRadio(i18n("selected emails")); |
1403 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); | 1408 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); |
1404 | 1409 | ||
1405 | KPrefsWidRadios *autoInsertGroup = | 1410 | KPrefsWidRadios *autoInsertGroup = |
1406 | addWidRadios(i18n("Auto Insert IMIP Replies"), | 1411 | addWidRadios(i18n("Auto Insert IMIP Replies"), |
1407 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); | 1412 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); |
1408 | autoInsertGroup->addRadio(i18n("Never")); | 1413 | autoInsertGroup->addRadio(i18n("Never")); |
1409 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); | 1414 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); |
1410 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1415 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1411 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); | 1416 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); |
1412 | 1417 | ||
1413 | KPrefsWidRadios *autoRequestGroup = | 1418 | KPrefsWidRadios *autoRequestGroup = |
1414 | addWidRadios(i18n("Auto Insert IMIP Requests"), | 1419 | addWidRadios(i18n("Auto Insert IMIP Requests"), |
1415 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); | 1420 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); |
1416 | autoRequestGroup->addRadio(i18n("Never")); | 1421 | autoRequestGroup->addRadio(i18n("Never")); |
1417 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); | 1422 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); |
1418 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1423 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1419 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); | 1424 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); |
1420 | 1425 | ||
1421 | KPrefsWidRadios *autoFreeBusyGroup = | 1426 | KPrefsWidRadios *autoFreeBusyGroup = |
1422 | addWidRadios(i18n("Auto Send FreeBusy Information"), | 1427 | addWidRadios(i18n("Auto Send FreeBusy Information"), |
1423 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); | 1428 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); |
1424 | autoFreeBusyGroup->addRadio(i18n("Never")); | 1429 | autoFreeBusyGroup->addRadio(i18n("Never")); |
1425 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); | 1430 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); |
@@ -1514,65 +1519,65 @@ void KOPrefsDialog::usrWriteConfig() | |||
1514 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); | 1519 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); |
1515 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); | 1520 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); |
1516 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); | 1521 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); |
1517 | 1522 | ||
1518 | KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | 1523 | KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); |
1519 | KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | 1524 | KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); |
1520 | KOPrefs::instance()->setFullName(mNameEdit->text()); | 1525 | KOPrefs::instance()->setFullName(mNameEdit->text()); |
1521 | KOPrefs::instance()->setEmail(mEmailEdit->text()); | 1526 | KOPrefs::instance()->setEmail(mEmailEdit->text()); |
1522 | 1527 | ||
1523 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); | 1528 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); |
1524 | 1529 | ||
1525 | KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); | 1530 | KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); |
1526 | QDate date; | 1531 | QDate date; |
1527 | date = mStartDateSavingEdit->date(); | 1532 | date = mStartDateSavingEdit->date(); |
1528 | int sub = 0; | 1533 | int sub = 0; |
1529 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 1534 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
1530 | sub = 1; | 1535 | sub = 1; |
1531 | KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; | 1536 | KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; |
1532 | date = mEndDateSavingEdit->date(); | 1537 | date = mEndDateSavingEdit->date(); |
1533 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 1538 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
1534 | sub = 1; | 1539 | sub = 1; |
1535 | else | 1540 | else |
1536 | sub = 0; | 1541 | sub = 0; |
1537 | KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; | 1542 | KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; |
1538 | // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); | 1543 | // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); |
1539 | 1544 | ||
1540 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); | 1545 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); |
1541 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); | 1546 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); |
1542 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); | 1547 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); |
1543 | 1548 | ||
1544 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); | 1549 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); |
1545 | 1550 | ||
1546 | QDictIterator<QColor> it(mCategoryDict); | 1551 | Q3DictIterator<QColor> it(mCategoryDict); |
1547 | while (it.current()) { | 1552 | while (it.current()) { |
1548 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); | 1553 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); |
1549 | ++it; | 1554 | ++it; |
1550 | } | 1555 | } |
1551 | 1556 | ||
1552 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); | 1557 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); |
1553 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); | 1558 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); |
1554 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); | 1559 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); |
1555 | 1560 | ||
1556 | KOPrefs::instance()->mAdditionalMails.clear(); | 1561 | KOPrefs::instance()->mAdditionalMails.clear(); |
1557 | // QListViewItem *item; | 1562 | // QListViewItem *item; |
1558 | // item = mAMails->firstChild(); | 1563 | // item = mAMails->firstChild(); |
1559 | // while (item) | 1564 | // while (item) |
1560 | // { | 1565 | // { |
1561 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); | 1566 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); |
1562 | // item = item->nextSibling(); | 1567 | // item = item->nextSibling(); |
1563 | // } | 1568 | // } |
1564 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); | 1569 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); |
1565 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; | 1570 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; |
1566 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; | 1571 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; |
1567 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; | 1572 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; |
1568 | 1573 | ||
1569 | } | 1574 | } |
1570 | 1575 | ||
1571 | void KOPrefsDialog::updateCategories() | 1576 | void KOPrefsDialog::updateCategories() |
1572 | { | 1577 | { |
1573 | mCategoryCombo->clear(); | 1578 | mCategoryCombo->clear(); |
1574 | mCategoryDict.clear(); | 1579 | mCategoryDict.clear(); |
1575 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1580 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1576 | updateCategoryColor(); | 1581 | updateCategoryColor(); |
1577 | } | 1582 | } |
1578 | 1583 | ||
@@ -1654,72 +1659,72 @@ void KOPrefsDialog::updateItem() | |||
1654 | void KOPrefsDialog::updateInput() | 1659 | void KOPrefsDialog::updateInput() |
1655 | { | 1660 | { |
1656 | // QListViewItem *item; | 1661 | // QListViewItem *item; |
1657 | // item = mAMails->selectedItem(); | 1662 | // item = mAMails->selectedItem(); |
1658 | // if (!item) return; | 1663 | // if (!item) return; |
1659 | // aEmailsEdit->setEnabled(true); | 1664 | // aEmailsEdit->setEnabled(true); |
1660 | // aEmailsEdit->setText(item->text(0)); | 1665 | // aEmailsEdit->setText(item->text(0)); |
1661 | } | 1666 | } |
1662 | void KOPrefsDialog::updateTimezoneOffset( int index ) | 1667 | void KOPrefsDialog::updateTimezoneOffset( int index ) |
1663 | { | 1668 | { |
1664 | /* | 1669 | /* |
1665 | qDebug("updateTimezoneOffset %d ", index); | 1670 | qDebug("updateTimezoneOffset %d ", index); |
1666 | if ( index < 24 ) { | 1671 | if ( index < 24 ) { |
1667 | mTimezoneOffsetSpin->setEnabled ( false ); | 1672 | mTimezoneOffsetSpin->setEnabled ( false ); |
1668 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); | 1673 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); |
1669 | 1674 | ||
1670 | 1675 | ||
1671 | } else { | 1676 | } else { |
1672 | if ( index == 24 ) { | 1677 | if ( index == 24 ) { |
1673 | mTimezoneOffsetSpin->setEnabled ( true ); | 1678 | mTimezoneOffsetSpin->setEnabled ( true ); |
1674 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | 1679 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); |
1675 | 1680 | ||
1676 | } else { | 1681 | } else { |
1677 | mTimezoneOffsetSpin->setEnabled ( false ); | 1682 | mTimezoneOffsetSpin->setEnabled ( false ); |
1678 | mTimezoneOffsetSpin->setValue( 0 ); | 1683 | mTimezoneOffsetSpin->setValue( 0 ); |
1679 | } | 1684 | } |
1680 | } | 1685 | } |
1681 | */ | 1686 | */ |
1682 | } | 1687 | } |
1683 | 1688 | ||
1684 | void KOPrefsDialog::setupTimeZoneTab() | 1689 | void KOPrefsDialog::setupTimeZoneTab() |
1685 | { | 1690 | { |
1686 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); | 1691 | Q3Frame *topFrame = addPage(i18n("Time Zone"),0,0); |
1687 | // DesktopIcon("clock",KIcon::SizeMedium)); | 1692 | // DesktopIcon("clock",KIcon::SizeMedium)); |
1688 | 1693 | ||
1689 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1694 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,2); |
1690 | topLayout->setSpacing(spacingHint()); | 1695 | topLayout->setSpacing(spacingHint()); |
1691 | topLayout->setMargin(marginHint()); | 1696 | topLayout->setMargin(marginHint()); |
1692 | 1697 | ||
1693 | QHBox *timeZoneBox = new QHBox( topFrame ); | 1698 | Q3HBox *timeZoneBox = new Q3HBox( topFrame ); |
1694 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 1699 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
1695 | 1700 | ||
1696 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 1701 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
1697 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 1702 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
1698 | if ( QApplication::desktop()->width() < 300 ) { | 1703 | if ( QApplication::desktop()->width() < 300 ) { |
1699 | mTimeZoneCombo->setMaximumWidth(150); | 1704 | mTimeZoneCombo->setMaximumWidth(150); |
1700 | } | 1705 | } |
1701 | 1706 | ||
1702 | QStringList list; | 1707 | QStringList list; |
1703 | list = KGlobal::locale()->timeZoneList(); | 1708 | list = KGlobal::locale()->timeZoneList(); |
1704 | mTimeZoneCombo->insertStringList(list); | 1709 | mTimeZoneCombo->insertStringList(list); |
1705 | 1710 | ||
1706 | // find the currently set time zone and select it | 1711 | // find the currently set time zone and select it |
1707 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; | 1712 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; |
1708 | int nCurrentlySet = 11; | 1713 | int nCurrentlySet = 11; |
1709 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 1714 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
1710 | { | 1715 | { |
1711 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 1716 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
1712 | { | 1717 | { |
1713 | nCurrentlySet = i; | 1718 | nCurrentlySet = i; |
1714 | break; | 1719 | break; |
1715 | } | 1720 | } |
1716 | } | 1721 | } |
1717 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 1722 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
1718 | int iii = 1; | 1723 | int iii = 1; |
1719 | KPrefsDialogWidBool *sb = | 1724 | KPrefsDialogWidBool *sb = |
1720 | addWidBool(i18n("Timezone has daylight saving"), | 1725 | addWidBool(i18n("Timezone has daylight saving"), |
1721 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); | 1726 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); |
1722 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 1727 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
1723 | ++iii; | 1728 | ++iii; |
1724 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 1729 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
1725 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 1730 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
diff --git a/kmicromail/koprefsdialog.h b/kmicromail/koprefsdialog.h index 7fa9261..042af3f 100644 --- a/kmicromail/koprefsdialog.h +++ b/kmicromail/koprefsdialog.h | |||
@@ -1,61 +1,63 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef _KOPREFSDIALOG_H | 23 | #ifndef _KOPREFSDIALOG_H |
24 | #define _KOPREFSDIALOG_H | 24 | #define _KOPREFSDIALOG_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <q3frame.h> |
27 | #include <qdict.h> | 27 | #include <q3dict.h> |
28 | #include <qcolor.h> | 28 | #include <qcolor.h> |
29 | #include <qlistview.h> | 29 | #include <q3listview.h> |
30 | //Added by qt3to4: | ||
31 | #include <QLabel> | ||
30 | 32 | ||
31 | #include <kdialogbase.h> | 33 | #include <kdialogbase.h> |
32 | 34 | ||
33 | #include <libkdepim/kprefsdialog.h> | 35 | #include <libkdepim/kprefsdialog.h> |
34 | #include <libkdepim/kdateedit.h> | 36 | #include <libkdepim/kdateedit.h> |
35 | #include <kcmconfigs/kdepimconfigwidget.h> | 37 | #include <kcmconfigs/kdepimconfigwidget.h> |
36 | 38 | ||
37 | class KColorButton; | 39 | class KColorButton; |
38 | class QSpinBox; | 40 | class QSpinBox; |
39 | class QSlider; | 41 | class QSlider; |
40 | class KURLRequester; | 42 | class KURLRequester; |
41 | class QComboBox; | 43 | class QComboBox; |
42 | class QLineEdit; | 44 | class QLineEdit; |
43 | class QStringList; | 45 | class QStringList; |
44 | 46 | ||
45 | /** Dialog to change the korganizer configuration. | 47 | /** Dialog to change the korganizer configuration. |
46 | */ | 48 | */ |
47 | class KOPrefsDialog : public KPrefsDialog | 49 | class KOPrefsDialog : public KPrefsDialog |
48 | { | 50 | { |
49 | Q_OBJECT | 51 | Q_OBJECT |
50 | public: | 52 | public: |
51 | /** Initialize dialog and pages */ | 53 | /** Initialize dialog and pages */ |
52 | KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); | 54 | KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); |
53 | ~KOPrefsDialog(); | 55 | ~KOPrefsDialog(); |
54 | 56 | ||
55 | protected: | 57 | protected: |
56 | void usrReadConfig(); | 58 | void usrReadConfig(); |
57 | void usrWriteConfig(); | 59 | void usrWriteConfig(); |
58 | 60 | ||
59 | void setupMainTab(); | 61 | void setupMainTab(); |
60 | void setupGlobalTab(); | 62 | void setupGlobalTab(); |
61 | void setupMailTab(); | 63 | void setupMailTab(); |
@@ -90,90 +92,90 @@ protected: | |||
90 | //additional emails | 92 | //additional emails |
91 | void addItem(); | 93 | void addItem(); |
92 | void removeItem(); | 94 | void removeItem(); |
93 | void updateItem(); | 95 | void updateItem(); |
94 | void updateInput(); | 96 | void updateInput(); |
95 | */ | 97 | */ |
96 | protected: | 98 | protected: |
97 | void usrReadConfig(); | 99 | void usrReadConfig(); |
98 | void usrWriteConfig(); | 100 | void usrWriteConfig(); |
99 | 101 | ||
100 | void setupMainTab(); | 102 | void setupMainTab(); |
101 | void setupTimeTab(); | 103 | void setupTimeTab(); |
102 | void setupTimeZoneTab(); | 104 | void setupTimeZoneTab(); |
103 | void setupLocaleTab(); | 105 | void setupLocaleTab(); |
104 | void setupLocaleDateTab(); | 106 | void setupLocaleDateTab(); |
105 | void setupFontsTab(); | 107 | void setupFontsTab(); |
106 | void setupColorsTab(); | 108 | void setupColorsTab(); |
107 | void setupViewsTab(); | 109 | void setupViewsTab(); |
108 | void setupDisplayTab(); | 110 | void setupDisplayTab(); |
109 | void setupPrinterTab(); | 111 | void setupPrinterTab(); |
110 | void setupGroupSchedulingTab(); | 112 | void setupGroupSchedulingTab(); |
111 | void setupGroupAutomationTab(); | 113 | void setupGroupAutomationTab(); |
112 | void setupSyncTab(); | 114 | void setupSyncTab(); |
113 | void setupSyncAlgTab(); | 115 | void setupSyncAlgTab(); |
114 | 116 | ||
115 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); | 117 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); |
116 | 118 | ||
117 | 119 | ||
118 | private: | 120 | private: |
119 | KPrefsWidBool *mEnableGroupScheduling; | 121 | KPrefsWidBool *mEnableGroupScheduling; |
120 | KPrefsWidBool *mEnableProjectView; | 122 | KPrefsWidBool *mEnableProjectView; |
121 | 123 | ||
122 | QFrame *mPrinterTab; | 124 | Q3Frame *mPrinterTab; |
123 | 125 | ||
124 | QLineEdit *nameEdit; | 126 | QLineEdit *nameEdit; |
125 | QLineEdit *emailEdit; | 127 | QLineEdit *emailEdit; |
126 | 128 | ||
127 | QComboBox *timeCombo; | 129 | QComboBox *timeCombo; |
128 | QComboBox *tzCombo; | 130 | QComboBox *tzCombo; |
129 | 131 | ||
130 | // widgets holding preferences data | 132 | // widgets holding preferences data |
131 | QLineEdit *mNameEdit; | 133 | QLineEdit *mNameEdit; |
132 | QLineEdit *mEmailEdit; | 134 | QLineEdit *mEmailEdit; |
133 | QLabel *mNameLabel; | 135 | QLabel *mNameLabel; |
134 | QLabel *mEmailLabel; | 136 | QLabel *mEmailLabel; |
135 | QLineEdit *mAdditionalEdit; | 137 | QLineEdit *mAdditionalEdit; |
136 | QSpinBox *mAutoSaveIntervalSpin; | 138 | QSpinBox *mAutoSaveIntervalSpin; |
137 | QSpinBox *mPrioSpin; | 139 | QSpinBox *mPrioSpin; |
138 | // QListView *mAMails; | 140 | // QListView *mAMails; |
139 | QLineEdit *aEmailsEdit; | 141 | QLineEdit *aEmailsEdit; |
140 | 142 | ||
141 | QComboBox *mTimeZoneCombo; | 143 | QComboBox *mTimeZoneCombo; |
142 | QStringList tzonenames; | 144 | QStringList tzonenames; |
143 | QSpinBox *mStartTimeSpin; | 145 | QSpinBox *mStartTimeSpin; |
144 | QSpinBox *mDefaultDurationSpin; | 146 | QSpinBox *mDefaultDurationSpin; |
145 | QComboBox *mAlarmTimeCombo; | 147 | QComboBox *mAlarmTimeCombo; |
146 | 148 | ||
147 | QComboBox *mCategoryCombo; | 149 | QComboBox *mCategoryCombo; |
148 | KColorButton *mCategoryButton; | 150 | KColorButton *mCategoryButton; |
149 | QDict<QColor> mCategoryDict; | 151 | Q3Dict<QColor> mCategoryDict; |
150 | 152 | ||
151 | QSlider *mHourSizeSlider; | 153 | QSlider *mHourSizeSlider; |
152 | 154 | ||
153 | QSpinBox *mNextXDaysSpin; | 155 | QSpinBox *mNextXDaysSpin; |
154 | QSpinBox *mWhatsNextSpin; | 156 | QSpinBox *mWhatsNextSpin; |
155 | 157 | ||
156 | QLineEdit * mRemoteIPEdit; | 158 | QLineEdit * mRemoteIPEdit; |
157 | QLineEdit * mRemoteUser; | 159 | QLineEdit * mRemoteUser; |
158 | QLineEdit * mRemotePassWd; | 160 | QLineEdit * mRemotePassWd; |
159 | QLineEdit * mRemoteFile; | 161 | QLineEdit * mRemoteFile; |
160 | QLineEdit * mLocalTempFile; | 162 | QLineEdit * mLocalTempFile; |
161 | QWidget* mSetupSyncAlgTab; | 163 | QWidget* mSetupSyncAlgTab; |
162 | QLineEdit * mUserDateFormatLong; | 164 | QLineEdit * mUserDateFormatLong; |
163 | QLineEdit * mUserDateFormatShort; | 165 | QLineEdit * mUserDateFormatShort; |
164 | 166 | ||
165 | QSpinBox *mTimezoneOffsetSpin; | 167 | QSpinBox *mTimezoneOffsetSpin; |
166 | QSpinBox *mDaylightsavingStart; | 168 | QSpinBox *mDaylightsavingStart; |
167 | QSpinBox *mDaylightsavingEnd; | 169 | QSpinBox *mDaylightsavingEnd; |
168 | KDateEdit* mStartDateSavingEdit; | 170 | KDateEdit* mStartDateSavingEdit; |
169 | KDateEdit* mEndDateSavingEdit; | 171 | KDateEdit* mEndDateSavingEdit; |
170 | QSpinBox * mAlarmPlayBeeps; | 172 | QSpinBox * mAlarmPlayBeeps; |
171 | QSpinBox * mAlarmSuspendTime; | 173 | QSpinBox * mAlarmSuspendTime; |
172 | QSpinBox * mAlarmSuspendCount; | 174 | QSpinBox * mAlarmSuspendCount; |
173 | QSpinBox * mAlarmBeepInterval; | 175 | QSpinBox * mAlarmBeepInterval; |
174 | 176 | ||
175 | QLineEdit * mDefaultAlarmFile; | 177 | QLineEdit * mDefaultAlarmFile; |
176 | #endif | 178 | #endif |
177 | }; | 179 | }; |
178 | 180 | ||
179 | #endif | 181 | #endif |
diff --git a/kmicromail/libetpan/libetpan.pro b/kmicromail/libetpan/libetpan.pro index dfafa07..4b2654e 100644 --- a/kmicromail/libetpan/libetpan.pro +++ b/kmicromail/libetpan/libetpan.pro | |||
@@ -1,38 +1,38 @@ | |||
1 | ###################################################################### | 1 | ###################################################################### |
2 | # Automatically generated by qmake (1.07a) Thu Jul 1 00:54:03 2004 | 2 | # Automatically generated by qmake (1.07a) Thu Jul 1 00:54:03 2004 |
3 | ###################################################################### | 3 | ###################################################################### |
4 | 4 | ||
5 | TEMPLATE = lib | 5 | TEMPLATE = lib |
6 | TARGET = microlibetpan | 6 | TARGET = xmicrolibetpan |
7 | 7 | ||
8 | OBJECTS_DIR = obj | 8 | OBJECTS_DIR = obj |
9 | MOC_DIR = moc | 9 | MOC_DIR = moc |
10 | DESTDIR=../../bin | 10 | DESTDIR=../../bin |
11 | 11 | ||
12 | DEPENDPATH += generic \ | 12 | DEPENDPATH += generic \ |
13 | imap \ | 13 | imap \ |
14 | imf \ | 14 | imf \ |
15 | maildir \ | 15 | maildir \ |
16 | mbox \ | 16 | mbox \ |
17 | mh \ | 17 | mh \ |
18 | mime \ | 18 | mime \ |
19 | nntp \ | 19 | nntp \ |
20 | pop3 \ | 20 | pop3 \ |
21 | smtp \ | 21 | smtp \ |
22 | tests \ | 22 | tests \ |
23 | tools \ | 23 | tools \ |
24 | include/libetpan | 24 | include/libetpan |
25 | INCLUDEPATH += . \ | 25 | INCLUDEPATH += . \ |
26 | generic \ | 26 | generic \ |
27 | include \ | 27 | include \ |
28 | tools \ | 28 | tools \ |
29 | imf \ | 29 | imf \ |
30 | imap \ | 30 | imap \ |
31 | mime \ | 31 | mime \ |
32 | maildir \ | 32 | maildir \ |
33 | mbox \ | 33 | mbox \ |
34 | mh \ | 34 | mh \ |
35 | nntp \ | 35 | nntp \ |
36 | pop3 \ | 36 | pop3 \ |
37 | smtp \ | 37 | smtp \ |
38 | tests | 38 | tests |
diff --git a/kmicromail/libetpan/libetpanE.pro b/kmicromail/libetpan/libetpanE.pro index 7f37948..ea22692 100644 --- a/kmicromail/libetpan/libetpanE.pro +++ b/kmicromail/libetpan/libetpanE.pro | |||
@@ -1,38 +1,38 @@ | |||
1 | ###################################################################### | 1 | ###################################################################### |
2 | # Automatically generated by qmake (1.07a) Thu Jul 1 00:54:03 2004 | 2 | # Automatically generated by qmake (1.07a) Thu Jul 1 00:54:03 2004 |
3 | ###################################################################### | 3 | ###################################################################### |
4 | 4 | ||
5 | TEMPLATE = lib | 5 | TEMPLATE = lib |
6 | TARGET = microlibetpan | 6 | TARGET = xmicrolibetpan |
7 | 7 | ||
8 | OBJECTS_DIR = obj/$(PLATFORM) | 8 | OBJECTS_DIR = obj/$(PLATFORM) |
9 | MOC_DIR = moc/$(PLATFORM) | 9 | MOC_DIR = moc/$(PLATFORM) |
10 | DESTDIR=$(QPEDIR)/lib | 10 | DESTDIR=$(QPEDIR)/lib |
11 | 11 | ||
12 | DEPENDPATH += generic \ | 12 | DEPENDPATH += generic \ |
13 | imap \ | 13 | imap \ |
14 | imf \ | 14 | imf \ |
15 | maildir \ | 15 | maildir \ |
16 | mbox \ | 16 | mbox \ |
17 | mh \ | 17 | mh \ |
18 | mime \ | 18 | mime \ |
19 | nntp \ | 19 | nntp \ |
20 | pop3 \ | 20 | pop3 \ |
21 | smtp \ | 21 | smtp \ |
22 | tests \ | 22 | tests \ |
23 | tools \ | 23 | tools \ |
24 | include/libetpan | 24 | include/libetpan |
25 | INCLUDEPATH += . \ | 25 | INCLUDEPATH += . \ |
26 | generic \ | 26 | generic \ |
27 | include \ | 27 | include \ |
28 | tools \ | 28 | tools \ |
29 | imf \ | 29 | imf \ |
30 | imap \ | 30 | imap \ |
31 | mime \ | 31 | mime \ |
32 | maildir \ | 32 | maildir \ |
33 | mbox \ | 33 | mbox \ |
34 | mh \ | 34 | mh \ |
35 | nntp \ | 35 | nntp \ |
36 | pop3 \ | 36 | pop3 \ |
37 | smtp \ | 37 | smtp \ |
38 | tests | 38 | tests |
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index 870985e..746d2ae 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp | |||
@@ -1,49 +1,51 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include "abstractmail.h" | 2 | #include "abstractmail.h" |
3 | #include "imapwrapper.h" | 3 | #include "imapwrapper.h" |
4 | #include "pop3wrapper.h" | 4 | #include "pop3wrapper.h" |
5 | #include "nntpwrapper.h" | 5 | #include "nntpwrapper.h" |
6 | #include "mhwrapper.h" | 6 | #include "mhwrapper.h" |
7 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
8 | #include <qpe/global.h> | 8 | #include <qpe/global.h> |
9 | 9 | ||
10 | 10 | ||
11 | #include <qprogressbar.h> | 11 | #include <q3progressbar.h> |
12 | #include <qapplication.h> | 12 | #include <qapplication.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | //Added by qt3to4: | ||
15 | #include <Q3ValueList> | ||
14 | #include <klocale.h> | 16 | #include <klocale.h> |
15 | #include <kdecore/kstandarddirs.h> | 17 | #include <kdecore/kstandarddirs.h> |
16 | #include <qfile.h> | 18 | #include <qfile.h> |
17 | #include <qtextstream.h> | 19 | #include <q3textstream.h> |
18 | #include <stdlib.h> | 20 | #include <stdlib.h> |
19 | #include <libetpan/mailmime_content.h> | 21 | #include <libetpan/mailmime_content.h> |
20 | #include <libetpan/mailmime.h> | 22 | #include <libetpan/mailmime.h> |
21 | 23 | ||
22 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
23 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | 25 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) |
24 | { | 26 | { |
25 | return new IMAPwrapper(a); | 27 | return new IMAPwrapper(a); |
26 | } | 28 | } |
27 | 29 | ||
28 | AbstractMail* AbstractMail::getWrapper(POP3account *a) | 30 | AbstractMail* AbstractMail::getWrapper(POP3account *a) |
29 | { | 31 | { |
30 | return new POP3wrapper(a); | 32 | return new POP3wrapper(a); |
31 | } | 33 | } |
32 | 34 | ||
33 | AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) | 35 | AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) |
34 | { | 36 | { |
35 | return new NNTPwrapper(a); | 37 | return new NNTPwrapper(a); |
36 | } | 38 | } |
37 | 39 | ||
38 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) | 40 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) |
39 | { | 41 | { |
40 | return new MHwrapper(a,name); | 42 | return new MHwrapper(a,name); |
41 | } | 43 | } |
42 | 44 | ||
43 | AbstractMail* AbstractMail::getWrapper(Account*a) | 45 | AbstractMail* AbstractMail::getWrapper(Account*a) |
44 | { | 46 | { |
45 | if (!a) return 0; | 47 | if (!a) return 0; |
46 | switch (a->getType()) { | 48 | switch (a->getType()) { |
47 | case MAILLIB::A_IMAP: | 49 | case MAILLIB::A_IMAP: |
48 | return new IMAPwrapper((IMAPaccount*)a); | 50 | return new IMAPwrapper((IMAPaccount*)a); |
49 | break; | 51 | break; |
@@ -82,200 +84,200 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin | |||
82 | encodedString* result = new encodedString(); | 84 | encodedString* result = new encodedString(); |
83 | if (err == MAILIMF_NO_ERROR) { | 85 | if (err == MAILIMF_NO_ERROR) { |
84 | result->setContent(result_text,target_length); | 86 | result->setContent(result_text,target_length); |
85 | } | 87 | } |
86 | //odebug << "Decode string finished" << oendl; | 88 | //odebug << "Decode string finished" << oendl; |
87 | return result; | 89 | return result; |
88 | } | 90 | } |
89 | 91 | ||
90 | QString AbstractMail::convert_String(const char*text) | 92 | QString AbstractMail::convert_String(const char*text) |
91 | { | 93 | { |
92 | size_t index = 0; | 94 | size_t index = 0; |
93 | char*res = 0; | 95 | char*res = 0; |
94 | int err = MAILIMF_NO_ERROR; | 96 | int err = MAILIMF_NO_ERROR; |
95 | 97 | ||
96 | QString result(text); | 98 | QString result(text); |
97 | //qDebug("convert_String %s ", text); | 99 | //qDebug("convert_String %s ", text); |
98 | //err = mailmime_encoded_phrase_parse("iso-8859-1", | 100 | //err = mailmime_encoded_phrase_parse("iso-8859-1", |
99 | // text, strlen(text),&index, "iso-8859-1",&res); | 101 | // text, strlen(text),&index, "iso-8859-1",&res); |
100 | err = mailmime_encoded_phrase_parse("iso-8859-1", | 102 | err = mailmime_encoded_phrase_parse("iso-8859-1", |
101 | text, strlen(text),&index, "utf-8",&res); | 103 | text, strlen(text),&index, "utf-8",&res); |
102 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { | 104 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { |
103 | result = QString::fromUtf8(res); | 105 | result = QString::fromUtf8(res); |
104 | } | 106 | } |
105 | //qDebug("convert_String:%s ",result.latin1() ); | 107 | //qDebug("convert_String:%s ",result.latin1() ); |
106 | if (res) free(res); | 108 | if (res) free(res); |
107 | return result; | 109 | return result; |
108 | } | 110 | } |
109 | 111 | ||
110 | /* cp & paste from launcher */ | 112 | /* cp & paste from launcher */ |
111 | QString AbstractMail::gen_attachment_id() | 113 | QString AbstractMail::gen_attachment_id() |
112 | { | 114 | { |
113 | QFile file( "/proc/sys/kernel/random/uuid" ); | 115 | QFile file( "/proc/sys/kernel/random/uuid" ); |
114 | if (!file.open(IO_ReadOnly ) ) | 116 | if (!file.open(QIODevice::ReadOnly ) ) |
115 | return QString::null; | 117 | return QString::null; |
116 | 118 | ||
117 | QTextStream stream(&file); | 119 | Q3TextStream stream(&file); |
118 | 120 | ||
119 | return "{" + stream.read().stripWhiteSpace() + "}"; | 121 | return "{" + stream.read().stripWhiteSpace() + "}"; |
120 | } | 122 | } |
121 | 123 | ||
122 | int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) | 124 | int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) |
123 | { | 125 | { |
124 | return 0; | 126 | return 0; |
125 | } | 127 | } |
126 | 128 | ||
127 | QString AbstractMail::defaultLocalfolder() | 129 | QString AbstractMail::defaultLocalfolder() |
128 | { | 130 | { |
129 | // QString f = getenv( "HOME" ); | 131 | // QString f = getenv( "HOME" ); |
130 | QString f = locateLocal( "data", "kopiemail/localmail"); | 132 | QString f = locateLocal( "data", "kopiemail/localmail"); |
131 | // f += "/Applications/opiemail/localmail"; | 133 | // f += "/Applications/opiemail/localmail"; |
132 | return f; | 134 | return f; |
133 | } | 135 | } |
134 | 136 | ||
135 | QString AbstractMail::draftFolder() | 137 | QString AbstractMail::draftFolder() |
136 | { | 138 | { |
137 | return QString("Drafts"); | 139 | return QString("Drafts"); |
138 | } | 140 | } |
139 | 141 | ||
140 | /* temporary - will be removed when implemented in all classes */ | 142 | /* temporary - will be removed when implemented in all classes */ |
141 | void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) | 143 | void AbstractMail::deleteMails(const QString &,const Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &) |
142 | { | 144 | { |
143 | } | 145 | } |
144 | void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) | 146 | void AbstractMail::deleteMailList(const Q3ValueList<RecMailP>&target) |
145 | { | 147 | { |
146 | //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); | 148 | //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); |
147 | // this is currently re-implemented in pop3wrapper and imapwrapper | 149 | // this is currently re-implemented in pop3wrapper and imapwrapper |
148 | int iii = 0; | 150 | int iii = 0; |
149 | int count = target.count(); | 151 | int count = target.count(); |
150 | QProgressBar wid ( count ); | 152 | Q3ProgressBar wid ( count ); |
151 | wid.setCaption( i18n("Deleting ...")); | 153 | wid.setCaption( i18n("Deleting ...")); |
152 | wid.show(); | 154 | wid.show(); |
153 | while (iii < count ) { | 155 | while (iii < count ) { |
154 | Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); | 156 | Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); |
155 | wid.setProgress( iii ); | 157 | wid.setProgress( iii ); |
156 | wid.raise(); | 158 | wid.raise(); |
157 | qApp->processEvents(); | 159 | qApp->processEvents(); |
158 | RecMailP mail = (*target.at( iii )); | 160 | RecMailP mail = (*target.at( iii )); |
159 | deleteMail(mail); | 161 | deleteMail(mail); |
160 | ++iii; | 162 | ++iii; |
161 | } | 163 | } |
162 | } | 164 | } |
163 | 165 | ||
164 | void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) | 166 | void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) |
165 | { | 167 | { |
166 | //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); | 168 | //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); |
167 | // get local folder | 169 | // get local folder |
168 | Account * acc = getAccount(); | 170 | Account * acc = getAccount(); |
169 | if ( !acc ) return; | 171 | if ( !acc ) return; |
170 | QString lfName = acc->getLocalFolder(); | 172 | QString lfName = acc->getLocalFolder(); |
171 | if ( lfName.isEmpty() ) | 173 | if ( lfName.isEmpty() ) |
172 | lfName = acc->getAccountName(); | 174 | lfName = acc->getAccountName(); |
173 | // create local folder | 175 | // create local folder |
174 | if ( !targetMail->createMbox(lfName)) | 176 | if ( !targetMail->createMbox(lfName)) |
175 | { | 177 | { |
176 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 178 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
177 | i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); | 179 | i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); |
178 | return; | 180 | return; |
179 | } | 181 | } |
180 | QValueList<RecMailP> t; | 182 | Q3ValueList<RecMailP> t; |
181 | listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); | 183 | listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); |
182 | if ( t.count() == 0 ) { | 184 | if ( t.count() == 0 ) { |
183 | qDebug("There are no new messages %s", fromFolder->getName().latin1()); | 185 | qDebug("There are no new messages %s", fromFolder->getName().latin1()); |
184 | Global::statusMessage(i18n("There are no new messages")); | 186 | Global::statusMessage(i18n("There are no new messages")); |
185 | return; | 187 | return; |
186 | } | 188 | } |
187 | Global::statusMessage(i18n("%1 :Downloading mails..."). arg(acc->getAccountName())); | 189 | Global::statusMessage(i18n("%1 :Downloading mails..."). arg(acc->getAccountName())); |
188 | qDebug(i18n("%1 :Downloading mails..."). arg(acc->getAccountName())); | 190 | qDebug(i18n("%1 :Downloading mails..."). arg(acc->getAccountName())); |
189 | qApp->processEvents(); | 191 | qApp->processEvents(); |
190 | QValueList<RecMailP> e; | 192 | Q3ValueList<RecMailP> e; |
191 | targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); | 193 | targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); |
192 | //qDebug("target has mails %d ", e.count()); | 194 | //qDebug("target has mails %d ", e.count()); |
193 | QValueList<RecMailP> n; | 195 | Q3ValueList<RecMailP> n; |
194 | int iii = 0; | 196 | int iii = 0; |
195 | int count = t.count(); | 197 | int count = t.count(); |
196 | while (iii < count ) { | 198 | while (iii < count ) { |
197 | RecMailP r = (*t.at( iii )); | 199 | RecMailP r = (*t.at( iii )); |
198 | bool found = false; | 200 | bool found = false; |
199 | int jjj = 0; | 201 | int jjj = 0; |
200 | int countE = e.count(); | 202 | int countE = e.count(); |
201 | while (jjj < countE ) { | 203 | while (jjj < countE ) { |
202 | RecMailP re = (*e.at( jjj )); | 204 | RecMailP re = (*e.at( jjj )); |
203 | if ( re->isEqual(r) ) { | 205 | if ( re->isEqual(r) ) { |
204 | found = true; | 206 | found = true; |
205 | break; | 207 | break; |
206 | } | 208 | } |
207 | ++jjj; | 209 | ++jjj; |
208 | } | 210 | } |
209 | if ( !found ) { | 211 | if ( !found ) { |
210 | //qDebug("AAAdate *%s* ", r->isodate.latin1() ); | 212 | //qDebug("AAAdate *%s* ", r->isodate.latin1() ); |
211 | n.append( r ); | 213 | n.append( r ); |
212 | } | 214 | } |
213 | ++iii; | 215 | ++iii; |
214 | } | 216 | } |
215 | qDebug("Downloaded %d messages ",n.count() ); | 217 | qDebug("Downloaded %d messages ",n.count() ); |
216 | if ( n.count() == 0 ) { | 218 | if ( n.count() == 0 ) { |
217 | Global::statusMessage(i18n("There are no new messages")); | 219 | Global::statusMessage(i18n("There are no new messages")); |
218 | return; | 220 | return; |
219 | } | 221 | } |
220 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); | 222 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); |
221 | Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count())); | 223 | Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count())); |
222 | 224 | ||
223 | #if 0 | 225 | #if 0 |
224 | QValueList<RecMailP> t; | 226 | Q3ValueList<RecMailP> t; |
225 | listMessages(fromFolder->getName(),t, maxSizeInKb); | 227 | listMessages(fromFolder->getName(),t, maxSizeInKb); |
226 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | 228 | mvcpMailList( t,targetFolder,targetWrapper,moveit); |
227 | #endif | 229 | #endif |
228 | 230 | ||
229 | } | 231 | } |
230 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, | 232 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, |
231 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) | 233 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
232 | { | 234 | { |
233 | QValueList<RecMailP> t; | 235 | Q3ValueList<RecMailP> t; |
234 | listMessages(fromFolder->getName(),t, maxSizeInKb); | 236 | listMessages(fromFolder->getName(),t, maxSizeInKb); |
235 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | 237 | mvcpMailList( t,targetFolder,targetWrapper,moveit); |
236 | 238 | ||
237 | } | 239 | } |
238 | void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, | 240 | void AbstractMail::mvcpMailList(const Q3ValueList<RecMailP>& t, |
239 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 241 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
240 | { | 242 | { |
241 | encodedString*st = 0; | 243 | encodedString*st = 0; |
242 | int iii = 0; | 244 | int iii = 0; |
243 | int count = t.count(); | 245 | int count = t.count(); |
244 | if ( count == 0 ) | 246 | if ( count == 0 ) |
245 | return; | 247 | return; |
246 | // wel, processevents is qite strange, we need a widget for getting | 248 | // wel, processevents is qite strange, we need a widget for getting |
247 | // Global::statusMessage(i18n("Copy2 message %1").arg(iii)); displaye | 249 | // Global::statusMessage(i18n("Copy2 message %1").arg(iii)); displaye |
248 | 250 | ||
249 | QProgressBar wid ( count ); | 251 | Q3ProgressBar wid ( count ); |
250 | wid.setCaption( i18n("Copying...")); | 252 | wid.setCaption( i18n("Copying...")); |
251 | wid.show(); | 253 | wid.show(); |
252 | while (iii < count ) { | 254 | while (iii < count ) { |
253 | Global::statusMessage(i18n("Copy message %1 of %2").arg(iii).arg(count)); | 255 | Global::statusMessage(i18n("Copy message %1 of %2").arg(iii).arg(count)); |
254 | wid.setProgress( iii ); | 256 | wid.setProgress( iii ); |
255 | wid.raise(); | 257 | wid.raise(); |
256 | qApp->processEvents(); | 258 | qApp->processEvents(); |
257 | RecMailP r = (*t.at( iii )); | 259 | RecMailP r = (*t.at( iii )); |
258 | st = fetchRawBody(r); | 260 | st = fetchRawBody(r); |
259 | if (st) { | 261 | if (st) { |
260 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | 262 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); |
261 | delete st; | 263 | delete st; |
262 | } | 264 | } |
263 | ++iii; | 265 | ++iii; |
264 | } | 266 | } |
265 | if (moveit) { | 267 | if (moveit) { |
266 | deleteMailList( t ); | 268 | deleteMailList( t ); |
267 | //deleteAllMail(fromFolder); | 269 | //deleteAllMail(fromFolder); |
268 | } | 270 | } |
269 | } | 271 | } |
270 | 272 | ||
271 | void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 273 | void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
272 | { | 274 | { |
273 | encodedString*st = 0; | 275 | encodedString*st = 0; |
274 | st = fetchRawBody(mail); | 276 | st = fetchRawBody(mail); |
275 | if (st) { | 277 | if (st) { |
276 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | 278 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); |
277 | delete st; | 279 | delete st; |
278 | } | 280 | } |
279 | if (moveit) { | 281 | if (moveit) { |
280 | deleteMail(mail); | 282 | deleteMail(mail); |
281 | } | 283 | } |
diff --git a/kmicromail/libmailwrapper/abstractmail.h b/kmicromail/libmailwrapper/abstractmail.h index 2069ca1..f606b1f 100644 --- a/kmicromail/libmailwrapper/abstractmail.h +++ b/kmicromail/libmailwrapper/abstractmail.h | |||
@@ -1,79 +1,81 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef __abstract_mail_ | 2 | #ifndef __abstract_mail_ |
3 | #define __abstract_mail_ | 3 | #define __abstract_mail_ |
4 | 4 | ||
5 | #include "maildefines.h" | 5 | #include "maildefines.h" |
6 | 6 | ||
7 | #include "settings.h" | 7 | #include "settings.h" |
8 | 8 | ||
9 | #include <qobject.h> | 9 | #include <qobject.h> |
10 | //Added by qt3to4: | ||
11 | #include <Q3ValueList> | ||
10 | #include <opie2/osmartpointer.h> | 12 | #include <opie2/osmartpointer.h> |
11 | #include "mailtypes.h" | 13 | #include "mailtypes.h" |
12 | 14 | ||
13 | 15 | ||
14 | #include "mailwrapper.h" | 16 | #include "mailwrapper.h" |
15 | 17 | ||
16 | class IMAPwrapper; | 18 | class IMAPwrapper; |
17 | class POP3wrapper; | 19 | class POP3wrapper; |
18 | class Folder; | 20 | class Folder; |
19 | class encodedString; | 21 | class encodedString; |
20 | struct folderStat; | 22 | struct folderStat; |
21 | 23 | ||
22 | class AbstractMail:public QObject | 24 | class AbstractMail:public QObject |
23 | { | 25 | { |
24 | Q_OBJECT | 26 | Q_OBJECT |
25 | public: | 27 | public: |
26 | AbstractMail(){}; | 28 | AbstractMail(){}; |
27 | virtual ~AbstractMail(){} | 29 | virtual ~AbstractMail(){} |
28 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0; | 30 | virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0; |
29 | virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target, int sizeInKb = 0 )=0; | 31 | virtual void listMessages(const QString & mailbox,Q3ValueList<RecMailP>&target, int sizeInKb = 0 )=0; |
30 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; | 32 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; |
31 | virtual RecBodyP fetchBody(const RecMailP&mail)=0; | 33 | virtual RecBodyP fetchBody(const RecMailP&mail)=0; |
32 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0; | 34 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0; |
33 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0; | 35 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0; |
34 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0; | 36 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0; |
35 | virtual encodedString* fetchRawBody(const RecMailP&mail)=0; | 37 | virtual encodedString* fetchRawBody(const RecMailP&mail)=0; |
36 | 38 | ||
37 | virtual void deleteMail(const RecMailP&mail)=0; | 39 | virtual void deleteMail(const RecMailP&mail)=0; |
38 | virtual void deleteMailList(const QValueList<RecMailP>&target); | 40 | virtual void deleteMailList(const Q3ValueList<RecMailP>&target); |
39 | virtual void answeredMail(const RecMailP&mail)=0; | 41 | virtual void answeredMail(const RecMailP&mail)=0; |
40 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0; | 42 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0; |
41 | virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> >&target); | 43 | virtual void deleteMails(const QString & FolderName,const Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target); |
42 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0; | 44 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0; |
43 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 45 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
44 | void downloadNewMails(const FolderP&fromFolder,AbstractMail*targetWrapper ); | 46 | void downloadNewMails(const FolderP&fromFolder,AbstractMail*targetWrapper ); |
45 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, | 47 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
46 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int sizeInKb = 0); | 48 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int sizeInKb = 0); |
47 | virtual void mvcpMailList(const QValueList<RecMailP>& t, | 49 | virtual void mvcpMailList(const Q3ValueList<RecMailP>& t, |
48 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 50 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
49 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 51 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
50 | 52 | ||
51 | virtual void cleanMimeCache(){}; | 53 | virtual void cleanMimeCache(){}; |
52 | /* mail box methods */ | 54 | /* mail box methods */ |
53 | /* parameter is the box to create. | 55 | /* parameter is the box to create. |
54 | * if the implementing subclass has prefixes, | 56 | * if the implementing subclass has prefixes, |
55 | * them has to be appended automatic. | 57 | * them has to be appended automatic. |
56 | */ | 58 | */ |
57 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, | 59 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, |
58 | const QString& delemiter="/",bool getsubfolder=false); | 60 | const QString& delemiter="/",bool getsubfolder=false); |
59 | virtual void logout()=0; | 61 | virtual void logout()=0; |
60 | 62 | ||
61 | virtual Account* getAccount() = 0; | 63 | virtual Account* getAccount() = 0; |
62 | 64 | ||
63 | static AbstractMail* getWrapper(IMAPaccount *a); | 65 | static AbstractMail* getWrapper(IMAPaccount *a); |
64 | static AbstractMail* getWrapper(POP3account *a); | 66 | static AbstractMail* getWrapper(POP3account *a); |
65 | static AbstractMail* getWrapper(NNTPaccount *a); | 67 | static AbstractMail* getWrapper(NNTPaccount *a); |
66 | /* mbox only! */ | 68 | /* mbox only! */ |
67 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); | 69 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); |
68 | static AbstractMail* getWrapper(Account*a); | 70 | static AbstractMail* getWrapper(Account*a); |
69 | 71 | ||
70 | static QString defaultLocalfolder(); | 72 | static QString defaultLocalfolder(); |
71 | static QString draftFolder(); | 73 | static QString draftFolder(); |
72 | 74 | ||
73 | virtual MAILLIB::ATYPE getType()const=0; | 75 | virtual MAILLIB::ATYPE getType()const=0; |
74 | virtual const QString&getName()const=0; | 76 | virtual const QString&getName()const=0; |
75 | 77 | ||
76 | protected: | 78 | protected: |
77 | static encodedString*decode_String(const encodedString*text,const QString&enc); | 79 | static encodedString*decode_String(const encodedString*text,const QString&enc); |
78 | static QString convert_String(const char*text); | 80 | static QString convert_String(const char*text); |
79 | static QString gen_attachment_id(); | 81 | static QString gen_attachment_id(); |
diff --git a/kmicromail/libmailwrapper/generatemail.cpp b/kmicromail/libmailwrapper/generatemail.cpp index 2d213fe..ddad21b 100644 --- a/kmicromail/libmailwrapper/generatemail.cpp +++ b/kmicromail/libmailwrapper/generatemail.cpp | |||
@@ -1,41 +1,43 @@ | |||
1 | #include "generatemail.h" | 1 | #include "generatemail.h" |
2 | #include "mailwrapper.h" | 2 | #include "mailwrapper.h" |
3 | 3 | ||
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | 5 | ||
6 | //#include <qt.h> | 6 | //#include <qt.h> |
7 | 7 | ||
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <qfileinfo.h> | 9 | #include <qfileinfo.h> |
10 | //Added by qt3to4: | ||
11 | #include <Q3CString> | ||
10 | 12 | ||
11 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
12 | const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; | 14 | const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; |
13 | 15 | ||
14 | Generatemail::Generatemail() | 16 | Generatemail::Generatemail() |
15 | { | 17 | { |
16 | mCharset = "iso-8859-1"; | 18 | mCharset = "iso-8859-1"; |
17 | } | 19 | } |
18 | 20 | ||
19 | Generatemail::~Generatemail() | 21 | Generatemail::~Generatemail() |
20 | { | 22 | { |
21 | } | 23 | } |
22 | 24 | ||
23 | void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { | 25 | void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { |
24 | clistiter *it, *it2; | 26 | clistiter *it, *it2; |
25 | 27 | ||
26 | for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) { | 28 | for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) { |
27 | mailimf_address *addr; | 29 | mailimf_address *addr; |
28 | addr = (mailimf_address *) it->data; | 30 | addr = (mailimf_address *) it->data; |
29 | 31 | ||
30 | if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) { | 32 | if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) { |
31 | esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL ); | 33 | esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL ); |
32 | } else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) { | 34 | } else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) { |
33 | clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list; | 35 | clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list; |
34 | for ( it2 = clist_begin( l ); it2; it2 = it2->next ) { | 36 | for ( it2 = clist_begin( l ); it2; it2 = it2->next ) { |
35 | mailimf_mailbox *mbox; | 37 | mailimf_mailbox *mbox; |
36 | mbox = (mailimf_mailbox *) it2->data; | 38 | mbox = (mailimf_mailbox *) it2->data; |
37 | esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL ); | 39 | esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL ); |
38 | } | 40 | } |
39 | } | 41 | } |
40 | } | 42 | } |
41 | } | 43 | } |
@@ -199,89 +201,89 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet | |||
199 | } | 201 | } |
200 | } | 202 | } |
201 | } | 203 | } |
202 | return filePart; // Success :) | 204 | return filePart; // Success :) |
203 | 205 | ||
204 | } | 206 | } |
205 | 207 | ||
206 | void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) { | 208 | void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) { |
207 | const Attachment *it; | 209 | const Attachment *it; |
208 | unsigned int count = files.count(); | 210 | unsigned int count = files.count(); |
209 | for ( unsigned int i = 0; i < count; ++i ) { | 211 | for ( unsigned int i = 0; i < count; ++i ) { |
210 | mailmime *filePart; | 212 | mailmime *filePart; |
211 | int err; | 213 | int err; |
212 | it = ((QList<Attachment>)files).at(i); | 214 | it = ((QList<Attachment>)files).at(i); |
213 | 215 | ||
214 | filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); | 216 | filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); |
215 | if ( filePart == NULL ) { | 217 | if ( filePart == NULL ) { |
216 | continue; | 218 | continue; |
217 | } | 219 | } |
218 | err = mailmime_smart_add_part( message, filePart ); | 220 | err = mailmime_smart_add_part( message, filePart ); |
219 | if ( err != MAILIMF_NO_ERROR ) { | 221 | if ( err != MAILIMF_NO_ERROR ) { |
220 | mailmime_free( filePart ); | 222 | mailmime_free( filePart ); |
221 | } | 223 | } |
222 | } | 224 | } |
223 | } | 225 | } |
224 | 226 | ||
225 | mailmime *Generatemail::buildTxtPart(const QString&str ) { | 227 | mailmime *Generatemail::buildTxtPart(const QString&str ) { |
226 | mailmime *txtPart; | 228 | mailmime *txtPart; |
227 | mailmime_fields *fields; | 229 | mailmime_fields *fields; |
228 | mailmime_content *content; | 230 | mailmime_content *content; |
229 | mailmime_parameter *param; | 231 | mailmime_parameter *param; |
230 | int err; | 232 | int err; |
231 | QCString __str; | 233 | Q3CString __str; |
232 | //qDebug(" Generatemail::buildTxtPart %s", str.latin1()); | 234 | //qDebug(" Generatemail::buildTxtPart %s", str.latin1()); |
233 | param = mailmime_parameter_new( strdup( "charset" ), | 235 | param = mailmime_parameter_new( strdup( "charset" ), |
234 | strdup( mCharset.latin1() ) ); | 236 | strdup( mCharset.latin1() ) ); |
235 | if ( param == NULL ) | 237 | if ( param == NULL ) |
236 | goto err_free; | 238 | goto err_free; |
237 | 239 | ||
238 | content = mailmime_content_new_with_str( "text/plain" ); | 240 | content = mailmime_content_new_with_str( "text/plain" ); |
239 | if ( content == NULL ) | 241 | if ( content == NULL ) |
240 | goto err_free_param; | 242 | goto err_free_param; |
241 | 243 | ||
242 | err = clist_append( content->ct_parameters, param ); | 244 | err = clist_append( content->ct_parameters, param ); |
243 | if ( err != MAILIMF_NO_ERROR ) | 245 | if ( err != MAILIMF_NO_ERROR ) |
244 | goto err_free_content; | 246 | goto err_free_content; |
245 | 247 | ||
246 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); | 248 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); |
247 | if ( fields == NULL ) | 249 | if ( fields == NULL ) |
248 | goto err_free_content; | 250 | goto err_free_content; |
249 | 251 | ||
250 | txtPart = mailmime_new_empty( content, fields ); | 252 | txtPart = mailmime_new_empty( content, fields ); |
251 | if ( txtPart == NULL ) | 253 | if ( txtPart == NULL ) |
252 | goto err_free_fields; | 254 | goto err_free_fields; |
253 | { | 255 | { |
254 | //__str = str.utf8(); | 256 | //__str = str.utf8(); |
255 | __str = QCString (str.latin1()); | 257 | __str = Q3CString (str.latin1()); |
256 | err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() ); | 258 | err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() ); |
257 | } | 259 | } |
258 | if ( err != MAILIMF_NO_ERROR ) | 260 | if ( err != MAILIMF_NO_ERROR ) |
259 | goto err_free_txtPart; | 261 | goto err_free_txtPart; |
260 | 262 | ||
261 | return txtPart; // Success :) | 263 | return txtPart; // Success :) |
262 | 264 | ||
263 | err_free_txtPart: | 265 | err_free_txtPart: |
264 | mailmime_free( txtPart ); | 266 | mailmime_free( txtPart ); |
265 | err_free_fields: | 267 | err_free_fields: |
266 | mailmime_fields_free( fields ); | 268 | mailmime_fields_free( fields ); |
267 | err_free_content: | 269 | err_free_content: |
268 | mailmime_content_free( content ); | 270 | mailmime_content_free( content ); |
269 | err_free_param: | 271 | err_free_param: |
270 | mailmime_parameter_free( param ); | 272 | mailmime_parameter_free( param ); |
271 | err_free: | 273 | err_free: |
272 | ; | 274 | ; |
273 | 275 | ||
274 | return NULL; // Error :( | 276 | return NULL; // Error :( |
275 | } | 277 | } |
276 | 278 | ||
277 | mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { | 279 | mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { |
278 | return mailimf_mailbox_new( strdup( name.latin1() ), | 280 | return mailimf_mailbox_new( strdup( name.latin1() ), |
279 | strdup( mail.latin1() ) ); | 281 | strdup( mail.latin1() ) ); |
280 | } | 282 | } |
281 | 283 | ||
282 | mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail ) | 284 | mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail ) |
283 | { | 285 | { |
284 | mailimf_fields *fields = NULL; | 286 | mailimf_fields *fields = NULL; |
285 | mailimf_field *xmailer = NULL; | 287 | mailimf_field *xmailer = NULL; |
286 | mailimf_mailbox *sender=0,*fromBox=0; | 288 | mailimf_mailbox *sender=0,*fromBox=0; |
287 | mailimf_mailbox_list *from=0; | 289 | mailimf_mailbox_list *from=0; |
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index 0b6adf7..633ab42 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp | |||
@@ -1,40 +1,42 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include "genericwrapper.h" | 2 | #include "genericwrapper.h" |
3 | #include <libetpan/libetpan.h> | 3 | #include <libetpan/libetpan.h> |
4 | #include "mailtypes.h" | 4 | #include "mailtypes.h" |
5 | 5 | ||
6 | #include <kconfig.h> | 6 | #include <kconfig.h> |
7 | #include <kglobal.h> | 7 | #include <kglobal.h> |
8 | #include <kstandarddirs.h> | 8 | #include <kstandarddirs.h> |
9 | //Added by qt3to4: | ||
10 | #include <Q3ValueList> | ||
9 | 11 | ||
10 | 12 | ||
11 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
12 | Genericwrapper::Genericwrapper() | 14 | Genericwrapper::Genericwrapper() |
13 | : AbstractMail() | 15 | : AbstractMail() |
14 | { | 16 | { |
15 | bodyCache.clear(); | 17 | bodyCache.clear(); |
16 | m_storage = 0; | 18 | m_storage = 0; |
17 | m_folder = 0; | 19 | m_folder = 0; |
18 | } | 20 | } |
19 | 21 | ||
20 | Genericwrapper::~Genericwrapper() | 22 | Genericwrapper::~Genericwrapper() |
21 | { | 23 | { |
22 | if (m_folder) { | 24 | if (m_folder) { |
23 | mailfolder_free(m_folder); | 25 | mailfolder_free(m_folder); |
24 | } | 26 | } |
25 | if (m_storage) { | 27 | if (m_storage) { |
26 | mailstorage_free(m_storage); | 28 | mailstorage_free(m_storage); |
27 | } | 29 | } |
28 | cleanMimeCache(); | 30 | cleanMimeCache(); |
29 | } | 31 | } |
30 | const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date ) | 32 | const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date ) |
31 | { | 33 | { |
32 | 34 | ||
33 | QDate da (date->dt_year,date->dt_month, date->dt_day ); | 35 | QDate da (date->dt_year,date->dt_month, date->dt_day ); |
34 | QTime ti ( date->dt_hour, date->dt_min, date->dt_sec ); | 36 | QTime ti ( date->dt_hour, date->dt_min, date->dt_sec ); |
35 | QDateTime dt ( da ,ti ); | 37 | QDateTime dt ( da ,ti ); |
36 | int addsec = -date->dt_zone*36; | 38 | int addsec = -date->dt_zone*36; |
37 | //qDebug("adsec1 %d ",addsec ); | 39 | //qDebug("adsec1 %d ",addsec ); |
38 | dt = dt.addSecs( addsec ); | 40 | dt = dt.addSecs( addsec ); |
39 | int off = KGlobal::locale()->localTimeOffset( dt ); | 41 | int off = KGlobal::locale()->localTimeOffset( dt ); |
40 | //qDebug("adsec2 %d ",off*60 ); | 42 | //qDebug("adsec2 %d ",off*60 ); |
@@ -153,185 +155,185 @@ void Genericwrapper::fillParameters(RecPartP&target,clist*parameters) | |||
153 | } | 155 | } |
154 | 156 | ||
155 | QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) | 157 | QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) |
156 | { | 158 | { |
157 | QString enc="7bit"; | 159 | QString enc="7bit"; |
158 | if (!aEnc) return enc; | 160 | if (!aEnc) return enc; |
159 | switch(aEnc->enc_type) { | 161 | switch(aEnc->enc_type) { |
160 | case MAILMIME_MECHANISM_7BIT: | 162 | case MAILMIME_MECHANISM_7BIT: |
161 | enc = "7bit"; | 163 | enc = "7bit"; |
162 | break; | 164 | break; |
163 | case MAILMIME_MECHANISM_8BIT: | 165 | case MAILMIME_MECHANISM_8BIT: |
164 | enc = "8bit"; | 166 | enc = "8bit"; |
165 | break; | 167 | break; |
166 | case MAILMIME_MECHANISM_BINARY: | 168 | case MAILMIME_MECHANISM_BINARY: |
167 | enc = "binary"; | 169 | enc = "binary"; |
168 | break; | 170 | break; |
169 | case MAILMIME_MECHANISM_QUOTED_PRINTABLE: | 171 | case MAILMIME_MECHANISM_QUOTED_PRINTABLE: |
170 | enc = "quoted-printable"; | 172 | enc = "quoted-printable"; |
171 | break; | 173 | break; |
172 | case MAILMIME_MECHANISM_BASE64: | 174 | case MAILMIME_MECHANISM_BASE64: |
173 | enc = "base64"; | 175 | enc = "base64"; |
174 | break; | 176 | break; |
175 | case MAILMIME_MECHANISM_TOKEN: | 177 | case MAILMIME_MECHANISM_TOKEN: |
176 | default: | 178 | default: |
177 | if (aEnc->enc_token) { | 179 | if (aEnc->enc_token) { |
178 | enc = QString(aEnc->enc_token); | 180 | enc = QString(aEnc->enc_token); |
179 | } | 181 | } |
180 | break; | 182 | break; |
181 | } | 183 | } |
182 | return enc; | 184 | return enc; |
183 | } | 185 | } |
184 | 186 | ||
185 | void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) | 187 | void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,Q3ValueList<int>recList,unsigned int current_rec,int current_count) |
186 | { | 188 | { |
187 | if (current_rec >= 10) { | 189 | if (current_rec >= 10) { |
188 | ; // odebug << "too deep recursion!" << oendl; | 190 | ; // odebug << "too deep recursion!" << oendl; |
189 | } | 191 | } |
190 | if (!message || !mime) { | 192 | if (!message || !mime) { |
191 | return; | 193 | return; |
192 | } | 194 | } |
193 | int r; | 195 | int r; |
194 | char*data = 0; | 196 | char*data = 0; |
195 | size_t len; | 197 | size_t len; |
196 | clistiter * cur = 0; | 198 | clistiter * cur = 0; |
197 | QString b; | 199 | QString b; |
198 | RecPartP part = new RecPart(); | 200 | RecPartP part = new RecPart(); |
199 | 201 | ||
200 | switch (mime->mm_type) { | 202 | switch (mime->mm_type) { |
201 | case MAILMIME_SINGLE: | 203 | case MAILMIME_SINGLE: |
202 | { | 204 | { |
203 | QValueList<int>countlist = recList; | 205 | Q3ValueList<int>countlist = recList; |
204 | countlist.append(current_count); | 206 | countlist.append(current_count); |
205 | r = mailmessage_fetch_section(message,mime,&data,&len); | 207 | r = mailmessage_fetch_section(message,mime,&data,&len); |
206 | part->setSize(len); | 208 | part->setSize(len); |
207 | part->setPositionlist(countlist); | 209 | part->setPositionlist(countlist); |
208 | b = gen_attachment_id(); | 210 | b = gen_attachment_id(); |
209 | part->setIdentifier(b); | 211 | part->setIdentifier(b); |
210 | fillSingleBody(part,message,mime); | 212 | fillSingleBody(part,message,mime); |
211 | if (part->Type()=="text" && target->Bodytext().isNull()) { | 213 | if (part->Type()=="text" && target->Bodytext().isNull()) { |
212 | encodedString*rs = new encodedString(); | 214 | encodedString*rs = new encodedString(); |
213 | rs->setContent(data,len); | 215 | rs->setContent(data,len); |
214 | encodedString*res = decode_String(rs,part->Encoding()); | 216 | encodedString*res = decode_String(rs,part->Encoding()); |
215 | if (countlist.count()>2) { | 217 | if (countlist.count()>2) { |
216 | bodyCache[b]=rs; | 218 | bodyCache[b]=rs; |
217 | target->addPart(part); | 219 | target->addPart(part); |
218 | } else { | 220 | } else { |
219 | delete rs; | 221 | delete rs; |
220 | } | 222 | } |
221 | b = QString(res->Content()); | 223 | b = QString(res->Content()); |
222 | delete res; | 224 | delete res; |
223 | size_t index = 0; | 225 | size_t index = 0; |
224 | char*resu = 0; | 226 | char*resu = 0; |
225 | int err = MAILIMF_NO_ERROR; | 227 | int err = MAILIMF_NO_ERROR; |
226 | QString charset = part->searchParamter( "charset"); | 228 | QString charset = part->searchParamter( "charset"); |
227 | qDebug("CHARSET %s ",charset.latin1() ); | 229 | qDebug("CHARSET %s ",charset.latin1() ); |
228 | #if 0 | 230 | #if 0 |
229 | if (false ) { | 231 | if (false ) { |
230 | //if ( !charset.isEmpty() ) { | 232 | //if ( !charset.isEmpty() ) { |
231 | target->setCharset( charset ); | 233 | target->setCharset( charset ); |
232 | err = mailmime_encoded_phrase_parse(charset.latin1(), | 234 | err = mailmime_encoded_phrase_parse(charset.latin1(), |
233 | b.latin1(), b.length(),&index, "utf-8",&resu); | 235 | b.latin1(), b.length(),&index, "utf-8",&resu); |
234 | if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { | 236 | if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { |
235 | //qDebug("res %d %s ", index, resu); | 237 | //qDebug("res %d %s ", index, resu); |
236 | b = QString::fromUtf8(resu); | 238 | b = QString::fromUtf8(resu); |
237 | } | 239 | } |
238 | if (resu) free(resu); | 240 | if (resu) free(resu); |
239 | } | 241 | } |
240 | #endif | 242 | #endif |
241 | target->setBodytext(b); | 243 | target->setBodytext(b); |
242 | target->setDescription(part); | 244 | target->setDescription(part); |
243 | } else { | 245 | } else { |
244 | bodyCache[b]=new encodedString(data,len); | 246 | bodyCache[b]=new encodedString(data,len); |
245 | target->addPart(part); | 247 | target->addPart(part); |
246 | } | 248 | } |
247 | } | 249 | } |
248 | break; | 250 | break; |
249 | case MAILMIME_MULTIPLE: | 251 | case MAILMIME_MULTIPLE: |
250 | { | 252 | { |
251 | unsigned int ccount = 1; | 253 | unsigned int ccount = 1; |
252 | mailmime*cbody=0; | 254 | mailmime*cbody=0; |
253 | QValueList<int>countlist = recList; | 255 | Q3ValueList<int>countlist = recList; |
254 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { | 256 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { |
255 | cbody = (mailmime*)clist_content(cur); | 257 | cbody = (mailmime*)clist_content(cur); |
256 | if (cbody->mm_type==MAILMIME_MULTIPLE) { | 258 | if (cbody->mm_type==MAILMIME_MULTIPLE) { |
257 | RecPartP targetPart = new RecPart(); | 259 | RecPartP targetPart = new RecPart(); |
258 | targetPart->setType("multipart"); | 260 | targetPart->setType("multipart"); |
259 | countlist.append(current_count); | 261 | countlist.append(current_count); |
260 | targetPart->setPositionlist(countlist); | 262 | targetPart->setPositionlist(countlist); |
261 | target->addPart(targetPart); | 263 | target->addPart(targetPart); |
262 | } | 264 | } |
263 | traverseBody(target,message, cbody,countlist,current_rec+1,ccount); | 265 | traverseBody(target,message, cbody,countlist,current_rec+1,ccount); |
264 | if (cbody->mm_type==MAILMIME_MULTIPLE) { | 266 | if (cbody->mm_type==MAILMIME_MULTIPLE) { |
265 | countlist = recList; | 267 | countlist = recList; |
266 | } | 268 | } |
267 | ++ccount; | 269 | ++ccount; |
268 | } | 270 | } |
269 | } | 271 | } |
270 | break; | 272 | break; |
271 | case MAILMIME_MESSAGE: | 273 | case MAILMIME_MESSAGE: |
272 | { | 274 | { |
273 | QValueList<int>countlist = recList; | 275 | Q3ValueList<int>countlist = recList; |
274 | countlist.append(current_count); | 276 | countlist.append(current_count); |
275 | /* the own header is always at recursion 0 - we don't need that */ | 277 | /* the own header is always at recursion 0 - we don't need that */ |
276 | if (current_rec > 0) { | 278 | if (current_rec > 0) { |
277 | part->setPositionlist(countlist); | 279 | part->setPositionlist(countlist); |
278 | r = mailmessage_fetch_section(message,mime,&data,&len); | 280 | r = mailmessage_fetch_section(message,mime,&data,&len); |
279 | part->setSize(len); | 281 | part->setSize(len); |
280 | part->setPositionlist(countlist); | 282 | part->setPositionlist(countlist); |
281 | b = gen_attachment_id(); | 283 | b = gen_attachment_id(); |
282 | part->setIdentifier(b); | 284 | part->setIdentifier(b); |
283 | part->setType("message"); | 285 | part->setType("message"); |
284 | part->setSubtype("rfc822"); | 286 | part->setSubtype("rfc822"); |
285 | bodyCache[b]=new encodedString(data,len); | 287 | bodyCache[b]=new encodedString(data,len); |
286 | target->addPart(part); | 288 | target->addPart(part); |
287 | } | 289 | } |
288 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { | 290 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { |
289 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); | 291 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); |
290 | } | 292 | } |
291 | } | 293 | } |
292 | break; | 294 | break; |
293 | } | 295 | } |
294 | } | 296 | } |
295 | 297 | ||
296 | RecBodyP Genericwrapper::parseMail( mailmessage * msg ) | 298 | RecBodyP Genericwrapper::parseMail( mailmessage * msg ) |
297 | { | 299 | { |
298 | int err = MAILIMF_NO_ERROR; | 300 | int err = MAILIMF_NO_ERROR; |
299 | //mailmime_single_fields fields; | 301 | //mailmime_single_fields fields; |
300 | /* is bound to msg and will be freed there */ | 302 | /* is bound to msg and will be freed there */ |
301 | mailmime * mime=0; | 303 | mailmime * mime=0; |
302 | RecBodyP body = new RecBody(); | 304 | RecBodyP body = new RecBody(); |
303 | //memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 305 | //memset(&fields, 0, sizeof(struct mailmime_single_fields)); |
304 | err = mailmessage_get_bodystructure(msg,&mime); | 306 | err = mailmessage_get_bodystructure(msg,&mime); |
305 | QValueList<int>recList; | 307 | Q3ValueList<int>recList; |
306 | traverseBody(body,msg,mime,recList); | 308 | traverseBody(body,msg,mime,recList); |
307 | return body; | 309 | return body; |
308 | } | 310 | } |
309 | 311 | ||
310 | 312 | ||
311 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) | 313 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) |
312 | { | 314 | { |
313 | QString result( "" ); | 315 | QString result( "" ); |
314 | 316 | ||
315 | bool first = true; | 317 | bool first = true; |
316 | if (list == 0) return result; | 318 | if (list == 0) return result; |
317 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { | 319 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { |
318 | mailimf_address *addr = (mailimf_address *) current->data; | 320 | mailimf_address *addr = (mailimf_address *) current->data; |
319 | 321 | ||
320 | if ( !first ) { | 322 | if ( !first ) { |
321 | result.append( "," ); | 323 | result.append( "," ); |
322 | } else { | 324 | } else { |
323 | first = false; | 325 | first = false; |
324 | } | 326 | } |
325 | 327 | ||
326 | switch ( addr->ad_type ) { | 328 | switch ( addr->ad_type ) { |
327 | case MAILIMF_ADDRESS_MAILBOX: | 329 | case MAILIMF_ADDRESS_MAILBOX: |
328 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); | 330 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); |
329 | break; | 331 | break; |
330 | case MAILIMF_ADDRESS_GROUP: | 332 | case MAILIMF_ADDRESS_GROUP: |
331 | result.append( parseGroup( addr->ad_data.ad_group ) ); | 333 | result.append( parseGroup( addr->ad_data.ad_group ) ); |
332 | break; | 334 | break; |
333 | default: | 335 | default: |
334 | ; // odebug << "Generic: unkown mailimf address type" << oendl; | 336 | ; // odebug << "Generic: unkown mailimf address type" << oendl; |
335 | break; | 337 | break; |
336 | } | 338 | } |
337 | } | 339 | } |
@@ -418,65 +420,65 @@ QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) | |||
418 | void Genericwrapper::cleanMimeCache() | 420 | void Genericwrapper::cleanMimeCache() |
419 | { | 421 | { |
420 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); | 422 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); |
421 | for (;it!=bodyCache.end();++it) { | 423 | for (;it!=bodyCache.end();++it) { |
422 | encodedString*t = it.data(); | 424 | encodedString*t = it.data(); |
423 | //it.setValue(0); | 425 | //it.setValue(0); |
424 | if (t) delete t; | 426 | if (t) delete t; |
425 | } | 427 | } |
426 | bodyCache.clear(); | 428 | bodyCache.clear(); |
427 | ; // odebug << "Genericwrapper: cache cleaned" << oendl; | 429 | ; // odebug << "Genericwrapper: cache cleaned" << oendl; |
428 | } | 430 | } |
429 | 431 | ||
430 | QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) | 432 | QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) |
431 | { | 433 | { |
432 | QStringList res; | 434 | QStringList res; |
433 | if (!in_replies || !in_replies->mid_list) return res; | 435 | if (!in_replies || !in_replies->mid_list) return res; |
434 | clistiter * current = 0; | 436 | clistiter * current = 0; |
435 | for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { | 437 | for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { |
436 | QString h((char*)current->data); | 438 | QString h((char*)current->data); |
437 | while (h.length()>0 && h[0]=='<') { | 439 | while (h.length()>0 && h[0]=='<') { |
438 | h.remove(0,1); | 440 | h.remove(0,1); |
439 | } | 441 | } |
440 | while (h.length()>0 && h[h.length()-1]=='>') { | 442 | while (h.length()>0 && h[h.length()-1]=='>') { |
441 | h.remove(h.length()-1,1); | 443 | h.remove(h.length()-1,1); |
442 | } | 444 | } |
443 | if (h.length()>0) { | 445 | if (h.length()>0) { |
444 | res.append(h); | 446 | res.append(h); |
445 | } | 447 | } |
446 | } | 448 | } |
447 | return res; | 449 | return res; |
448 | } | 450 | } |
449 | 451 | ||
450 | void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb) | 452 | void Genericwrapper::parseList(Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb) |
451 | { | 453 | { |
452 | int r; | 454 | int r; |
453 | mailmessage_list * env_list = 0; | 455 | mailmessage_list * env_list = 0; |
454 | r = mailsession_get_messages_list(session,&env_list); | 456 | r = mailsession_get_messages_list(session,&env_list); |
455 | if (r != MAIL_NO_ERROR) { | 457 | if (r != MAIL_NO_ERROR) { |
456 | ; // odebug << "Error message list" << oendl; | 458 | ; // odebug << "Error message list" << oendl; |
457 | return; | 459 | return; |
458 | } | 460 | } |
459 | r = mailsession_get_envelopes_list(session, env_list); | 461 | r = mailsession_get_envelopes_list(session, env_list); |
460 | if (r != MAIL_NO_ERROR) { | 462 | if (r != MAIL_NO_ERROR) { |
461 | ; // odebug << "Error filling message list" << oendl; | 463 | ; // odebug << "Error filling message list" << oendl; |
462 | if (env_list) { | 464 | if (env_list) { |
463 | mailmessage_list_free(env_list); | 465 | mailmessage_list_free(env_list); |
464 | } | 466 | } |
465 | return; | 467 | return; |
466 | } | 468 | } |
467 | mailimf_references * refs = 0; | 469 | mailimf_references * refs = 0; |
468 | mailimf_in_reply_to * in_replies = 0; | 470 | mailimf_in_reply_to * in_replies = 0; |
469 | uint32_t i = 0; | 471 | uint32_t i = 0; |
470 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | 472 | for(; i < carray_count(env_list->msg_tab) ; ++i) { |
471 | mailmessage * msg; | 473 | mailmessage * msg; |
472 | QBitArray mFlags(7); | 474 | QBitArray mFlags(7); |
473 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 475 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
474 | if (msg->msg_fields == NULL) { | 476 | if (msg->msg_fields == NULL) { |
475 | //; // odebug << "could not fetch envelope of message " << i << "" << oendl; | 477 | //; // odebug << "could not fetch envelope of message " << i << "" << oendl; |
476 | continue; | 478 | continue; |
477 | } | 479 | } |
478 | RecMailP mail = new RecMail(); | 480 | RecMailP mail = new RecMail(); |
479 | mail->setWrapper(this); | 481 | mail->setWrapper(this); |
480 | mail_flags * flag_result = 0; | 482 | mail_flags * flag_result = 0; |
481 | r = mailmessage_get_flags(msg,&flag_result); | 483 | r = mailmessage_get_flags(msg,&flag_result); |
482 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | 484 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { |
diff --git a/kmicromail/libmailwrapper/genericwrapper.h b/kmicromail/libmailwrapper/genericwrapper.h index c35a6da..a50161d 100644 --- a/kmicromail/libmailwrapper/genericwrapper.h +++ b/kmicromail/libmailwrapper/genericwrapper.h | |||
@@ -1,68 +1,70 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef __GENERIC_WRAPPER_H | 2 | #ifndef __GENERIC_WRAPPER_H |
3 | #define __GENERIC_WRAPPER_H | 3 | #define __GENERIC_WRAPPER_H |
4 | 4 | ||
5 | #include "abstractmail.h" | 5 | #include "abstractmail.h" |
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | //Added by qt3to4: | ||
9 | #include <Q3ValueList> | ||
8 | #include <libetpan/clist.h> | 10 | #include <libetpan/clist.h> |
9 | 11 | ||
10 | class RecMail; | 12 | class RecMail; |
11 | class RecBody; | 13 | class RecBody; |
12 | class encodedString; | 14 | class encodedString; |
13 | struct mailpop3; | 15 | struct mailpop3; |
14 | struct mailmessage; | 16 | struct mailmessage; |
15 | struct mailmime; | 17 | struct mailmime; |
16 | struct mailmime_mechanism; | 18 | struct mailmime_mechanism; |
17 | struct mailimf_mailbox_list; | 19 | struct mailimf_mailbox_list; |
18 | struct mailimf_mailbox; | 20 | struct mailimf_mailbox; |
19 | struct mailimf_date_time; | 21 | struct mailimf_date_time; |
20 | struct mailimf_group; | 22 | struct mailimf_group; |
21 | struct mailimf_address_list; | 23 | struct mailimf_address_list; |
22 | struct mailsession; | 24 | struct mailsession; |
23 | struct mailstorage; | 25 | struct mailstorage; |
24 | struct mailfolder; | 26 | struct mailfolder; |
25 | struct mailimf_in_reply_to; | 27 | struct mailimf_in_reply_to; |
26 | 28 | ||
27 | /* this class hold just the funs shared between | 29 | /* this class hold just the funs shared between |
28 | * mbox and pop3 (later mh, too) mail access. | 30 | * mbox and pop3 (later mh, too) mail access. |
29 | * it is not desigend to make a instance of it! | 31 | * it is not desigend to make a instance of it! |
30 | */ | 32 | */ |
31 | class Genericwrapper : public AbstractMail | 33 | class Genericwrapper : public AbstractMail |
32 | { | 34 | { |
33 | Q_OBJECT | 35 | Q_OBJECT |
34 | public: | 36 | public: |
35 | Genericwrapper(); | 37 | Genericwrapper(); |
36 | virtual ~Genericwrapper(); | 38 | virtual ~Genericwrapper(); |
37 | 39 | ||
38 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); | 40 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); |
39 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); | 41 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); |
40 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); | 42 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); |
41 | virtual void cleanMimeCache(); | 43 | virtual void cleanMimeCache(); |
42 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;} | 44 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;} |
43 | virtual void logout(){}; | 45 | virtual void logout(){}; |
44 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; | 46 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; |
45 | static const QDateTime parseDateTime( mailimf_date_time *date ); | 47 | static const QDateTime parseDateTime( mailimf_date_time *date ); |
46 | 48 | ||
47 | protected: | 49 | protected: |
48 | RecBodyP parseMail( mailmessage * msg ); | 50 | RecBodyP parseMail( mailmessage * msg ); |
49 | QString parseMailboxList( mailimf_mailbox_list *list ); | 51 | QString parseMailboxList( mailimf_mailbox_list *list ); |
50 | QString parseMailbox( mailimf_mailbox *box ); | 52 | QString parseMailbox( mailimf_mailbox *box ); |
51 | QString parseGroup( mailimf_group *group ); | 53 | QString parseGroup( mailimf_group *group ); |
52 | QString parseAddressList( mailimf_address_list *list ); | 54 | QString parseAddressList( mailimf_address_list *list ); |
53 | 55 | ||
54 | void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); | 56 | void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,Q3ValueList<int>recList,unsigned int current_rek=0,int current_count=1); |
55 | static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime); | 57 | static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime); |
56 | static void fillParameters(RecPartP&target,clist*parameters); | 58 | static void fillParameters(RecPartP&target,clist*parameters); |
57 | static QString getencoding(mailmime_mechanism*aEnc); | 59 | static QString getencoding(mailmime_mechanism*aEnc); |
58 | virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0); | 60 | virtual void parseList(Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0); |
59 | QStringList parseInreplies(mailimf_in_reply_to * in_replies); | 61 | QStringList parseInreplies(mailimf_in_reply_to * in_replies); |
60 | 62 | ||
61 | QString msgTempName; | 63 | QString msgTempName; |
62 | unsigned int last_msg_id; | 64 | unsigned int last_msg_id; |
63 | QMap<QString,encodedString*> bodyCache; | 65 | QMap<QString,encodedString*> bodyCache; |
64 | mailstorage * m_storage; | 66 | mailstorage * m_storage; |
65 | mailfolder*m_folder; | 67 | mailfolder*m_folder; |
66 | }; | 68 | }; |
67 | 69 | ||
68 | #endif | 70 | #endif |
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 4f0c849..f73f4cc 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -1,41 +1,43 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <libetpan/libetpan.h> | 3 | #include <libetpan/libetpan.h> |
4 | #include <qpe/global.h> | 4 | #include <qpe/global.h> |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | //Added by qt3to4: | ||
7 | #include <Q3ValueList> | ||
6 | #include "imapwrapper.h" | 8 | #include "imapwrapper.h" |
7 | #include "mailtypes.h" | 9 | #include "mailtypes.h" |
8 | #include "logindialog.h" | 10 | #include "logindialog.h" |
9 | #include <qprogressbar.h> | 11 | #include <q3progressbar.h> |
10 | #include "genericwrapper.h" | 12 | #include "genericwrapper.h" |
11 | #include <kglobal.h> | 13 | #include <kglobal.h> |
12 | 14 | ||
13 | using namespace Opie::Core; | 15 | using namespace Opie::Core; |
14 | int IMAPwrapper::mMax = 0; | 16 | int IMAPwrapper::mMax = 0; |
15 | int IMAPwrapper::mCurrent = 0; | 17 | int IMAPwrapper::mCurrent = 0; |
16 | 18 | ||
17 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 19 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
18 | : AbstractMail() | 20 | : AbstractMail() |
19 | { | 21 | { |
20 | account = a; | 22 | account = a; |
21 | m_imap = 0; | 23 | m_imap = 0; |
22 | m_Lastmbox = ""; | 24 | m_Lastmbox = ""; |
23 | mCurrent = 0; | 25 | mCurrent = 0; |
24 | mMax = 0; | 26 | mMax = 0; |
25 | } | 27 | } |
26 | 28 | ||
27 | IMAPwrapper::~IMAPwrapper() | 29 | IMAPwrapper::~IMAPwrapper() |
28 | { | 30 | { |
29 | logout(); | 31 | logout(); |
30 | } | 32 | } |
31 | 33 | ||
32 | /* to avoid to often select statements in loops etc. | 34 | /* to avoid to often select statements in loops etc. |
33 | we trust that we are logged in and connection is established!*/ | 35 | we trust that we are logged in and connection is established!*/ |
34 | int IMAPwrapper::selectMbox(const QString&mbox) | 36 | int IMAPwrapper::selectMbox(const QString&mbox) |
35 | { | 37 | { |
36 | if (mbox == m_Lastmbox) { | 38 | if (mbox == m_Lastmbox) { |
37 | return MAILIMAP_NO_ERROR; | 39 | return MAILIMAP_NO_ERROR; |
38 | } | 40 | } |
39 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); | 41 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); |
40 | if ( err != MAILIMAP_NO_ERROR ) { | 42 | if ( err != MAILIMAP_NO_ERROR ) { |
41 | m_Lastmbox = ""; | 43 | m_Lastmbox = ""; |
@@ -210,65 +212,65 @@ void IMAPwrapper::login(bool tryTLS) // = true) | |||
210 | if (ok) { | 212 | if (ok) { |
211 | err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() ); | 213 | err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() ); |
212 | if ( err != MAILIMAP_NO_ERROR ) { | 214 | if ( err != MAILIMAP_NO_ERROR ) { |
213 | if ( tryTLS && !force_tls && !try_tls ) { | 215 | if ( tryTLS && !force_tls && !try_tls ) { |
214 | err = mailimap_close( m_imap ); | 216 | err = mailimap_close( m_imap ); |
215 | mailimap_free( m_imap ); | 217 | mailimap_free( m_imap ); |
216 | m_imap = 0; | 218 | m_imap = 0; |
217 | login( false ); | 219 | login( false ); |
218 | return; | 220 | return; |
219 | } | 221 | } |
220 | Global::statusMessage(i18n("error logging in imap server: %1").arg(m_imap->imap_response)); | 222 | Global::statusMessage(i18n("error logging in imap server: %1").arg(m_imap->imap_response)); |
221 | ok = false; | 223 | ok = false; |
222 | } | 224 | } |
223 | } | 225 | } |
224 | if (!ok) { | 226 | if (!ok) { |
225 | err = mailimap_close( m_imap ); | 227 | err = mailimap_close( m_imap ); |
226 | mailimap_free( m_imap ); | 228 | mailimap_free( m_imap ); |
227 | m_imap = 0; | 229 | m_imap = 0; |
228 | } | 230 | } |
229 | } | 231 | } |
230 | 232 | ||
231 | void IMAPwrapper::logout() | 233 | void IMAPwrapper::logout() |
232 | { | 234 | { |
233 | int err = MAILIMAP_NO_ERROR; | 235 | int err = MAILIMAP_NO_ERROR; |
234 | if (!m_imap) return; | 236 | if (!m_imap) return; |
235 | err = mailimap_logout( m_imap ); | 237 | err = mailimap_logout( m_imap ); |
236 | err = mailimap_close( m_imap ); | 238 | err = mailimap_close( m_imap ); |
237 | mailimap_free( m_imap ); | 239 | mailimap_free( m_imap ); |
238 | m_imap = 0; | 240 | m_imap = 0; |
239 | m_Lastmbox = ""; | 241 | m_Lastmbox = ""; |
240 | } | 242 | } |
241 | 243 | ||
242 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) | 244 | void IMAPwrapper::listMessages(const QString&mailbox,Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) |
243 | { | 245 | { |
244 | 246 | ||
245 | int tryAgain = 1; | 247 | int tryAgain = 1; |
246 | while ( tryAgain >= 0 ) { | 248 | while ( tryAgain >= 0 ) { |
247 | int err = MAILIMAP_NO_ERROR; | 249 | int err = MAILIMAP_NO_ERROR; |
248 | clist *result = 0; | 250 | clist *result = 0; |
249 | clistcell *current; | 251 | clistcell *current; |
250 | mailimap_fetch_type *fetchType = 0; | 252 | mailimap_fetch_type *fetchType = 0; |
251 | mailimap_set *set = 0; | 253 | mailimap_set *set = 0; |
252 | 254 | ||
253 | login(); | 255 | login(); |
254 | if (!m_imap) { | 256 | if (!m_imap) { |
255 | return; | 257 | return; |
256 | } | 258 | } |
257 | /* select mailbox READONLY for operations */ | 259 | /* select mailbox READONLY for operations */ |
258 | err = selectMbox(mailbox); | 260 | err = selectMbox(mailbox); |
259 | if ( err != MAILIMAP_NO_ERROR ) { | 261 | if ( err != MAILIMAP_NO_ERROR ) { |
260 | return; | 262 | return; |
261 | } | 263 | } |
262 | 264 | ||
263 | int last = m_imap->imap_selection_info->sel_exists; | 265 | int last = m_imap->imap_selection_info->sel_exists; |
264 | 266 | ||
265 | if (last == 0) { | 267 | if (last == 0) { |
266 | Global::statusMessage(i18n("Mailbox has no mails")); | 268 | Global::statusMessage(i18n("Mailbox has no mails")); |
267 | return; | 269 | return; |
268 | } else { | 270 | } else { |
269 | } | 271 | } |
270 | progress( i18n("Fetch ")); | 272 | progress( i18n("Fetch ")); |
271 | mMax = last; | 273 | mMax = last; |
272 | //qDebug("last %d ", last); | 274 | //qDebug("last %d ", last); |
273 | Global::statusMessage(i18n("Fetching header list")); | 275 | Global::statusMessage(i18n("Fetching header list")); |
274 | qApp->processEvents(); | 276 | qApp->processEvents(); |
@@ -291,74 +293,74 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
291 | if ( err == MAILIMAP_NO_ERROR ) { | 293 | if ( err == MAILIMAP_NO_ERROR ) { |
292 | tryAgain = -1; | 294 | tryAgain = -1; |
293 | mailimap_msg_att * msg_att; | 295 | mailimap_msg_att * msg_att; |
294 | int i = 0; | 296 | int i = 0; |
295 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { | 297 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
296 | ++i; | 298 | ++i; |
297 | //qDebug("iii %d ",i); | 299 | //qDebug("iii %d ",i); |
298 | msg_att = (mailimap_msg_att*)current->data; | 300 | msg_att = (mailimap_msg_att*)current->data; |
299 | RecMail*m = parse_list_result(msg_att); | 301 | RecMail*m = parse_list_result(msg_att); |
300 | if (m) { | 302 | if (m) { |
301 | if ( maxSizeInKb == 0 || m->Msgsize()<=(unsigned int ) maxSizeInKb*1024 ) { | 303 | if ( maxSizeInKb == 0 || m->Msgsize()<=(unsigned int ) maxSizeInKb*1024 ) { |
302 | m->setNumber(i); | 304 | m->setNumber(i); |
303 | m->setMbox(mailbox); | 305 | m->setMbox(mailbox); |
304 | m->setWrapper(this); | 306 | m->setWrapper(this); |
305 | target.append(m); | 307 | target.append(m); |
306 | } | 308 | } |
307 | } | 309 | } |
308 | } | 310 | } |
309 | Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count())); | 311 | Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count())); |
310 | } else { | 312 | } else { |
311 | --tryAgain; | 313 | --tryAgain; |
312 | --tryAgain;//disabled tryagain by adding this line | 314 | --tryAgain;//disabled tryagain by adding this line |
313 | if ( tryAgain < 0 ) | 315 | if ( tryAgain < 0 ) |
314 | Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response)); | 316 | Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response)); |
315 | else | 317 | else |
316 | qDebug("try again... "); | 318 | qDebug("try again... "); |
317 | } | 319 | } |
318 | 320 | ||
319 | if (result) mailimap_fetch_list_free(result); | 321 | if (result) mailimap_fetch_list_free(result); |
320 | } | 322 | } |
321 | } | 323 | } |
322 | 324 | ||
323 | QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | 325 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() |
324 | { | 326 | { |
325 | const char *path, *mask; | 327 | const char *path, *mask; |
326 | int err = MAILIMAP_NO_ERROR; | 328 | int err = MAILIMAP_NO_ERROR; |
327 | clist *result = 0; | 329 | clist *result = 0; |
328 | clistcell *current = 0; | 330 | clistcell *current = 0; |
329 | clistcell*cur_flag = 0; | 331 | clistcell*cur_flag = 0; |
330 | mailimap_mbx_list_flags*bflags = 0; | 332 | mailimap_mbx_list_flags*bflags = 0; |
331 | 333 | ||
332 | QValueList<FolderP>* folders = new QValueList<FolderP>(); | 334 | Q3ValueList<FolderP>* folders = new Q3ValueList<FolderP>(); |
333 | login(); | 335 | login(); |
334 | if (!m_imap) { | 336 | if (!m_imap) { |
335 | return folders; | 337 | return folders; |
336 | } | 338 | } |
337 | 339 | ||
338 | /* | 340 | /* |
339 | * First we have to check for INBOX 'cause it sometimes it's not inside the path. | 341 | * First we have to check for INBOX 'cause it sometimes it's not inside the path. |
340 | * We must not forget to filter them out in next loop! | 342 | * We must not forget to filter them out in next loop! |
341 | * it seems like ugly code. and yes - it is ugly code. but the best way. | 343 | * it seems like ugly code. and yes - it is ugly code. but the best way. |
342 | */ | 344 | */ |
343 | Global::statusMessage(i18n("Fetching folder list")); | 345 | Global::statusMessage(i18n("Fetching folder list")); |
344 | qApp->processEvents(); | 346 | qApp->processEvents(); |
345 | QString temp; | 347 | QString temp; |
346 | mask = "INBOX" ; | 348 | mask = "INBOX" ; |
347 | mailimap_mailbox_list *list; | 349 | mailimap_mailbox_list *list; |
348 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); | 350 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); |
349 | QString del; | 351 | QString del; |
350 | bool selectable = true; | 352 | bool selectable = true; |
351 | bool no_inferiors = false; | 353 | bool no_inferiors = false; |
352 | if ( err == MAILIMAP_NO_ERROR ) { | 354 | if ( err == MAILIMAP_NO_ERROR ) { |
353 | current = result->first; | 355 | current = result->first; |
354 | for ( int i = result->count; i > 0; i-- ) { | 356 | for ( int i = result->count; i > 0; i-- ) { |
355 | list = (mailimap_mailbox_list *) current->data; | 357 | list = (mailimap_mailbox_list *) current->data; |
356 | // it is better use the deep copy mechanism of qt itself | 358 | // it is better use the deep copy mechanism of qt itself |
357 | // instead of using strdup! | 359 | // instead of using strdup! |
358 | temp = list->mb_name; | 360 | temp = list->mb_name; |
359 | del = list->mb_delimiter; | 361 | del = list->mb_delimiter; |
360 | current = current->next; | 362 | current = current->next; |
361 | if ( (bflags = list->mb_flag) ) { | 363 | if ( (bflags = list->mb_flag) ) { |
362 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 364 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
363 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 365 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
364 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { | 366 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { |
@@ -584,116 +586,116 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) | |||
584 | const char *mb; | 586 | const char *mb; |
585 | int err = MAILIMAP_NO_ERROR; | 587 | int err = MAILIMAP_NO_ERROR; |
586 | clist *result = 0; | 588 | clist *result = 0; |
587 | clistcell *current; | 589 | clistcell *current; |
588 | mailimap_fetch_att *fetchAtt = 0; | 590 | mailimap_fetch_att *fetchAtt = 0; |
589 | mailimap_fetch_type *fetchType = 0; | 591 | mailimap_fetch_type *fetchType = 0; |
590 | mailimap_set *set = 0; | 592 | mailimap_set *set = 0; |
591 | mailimap_body*body_desc = 0; | 593 | mailimap_body*body_desc = 0; |
592 | 594 | ||
593 | mb = mail->getMbox().latin1(); | 595 | mb = mail->getMbox().latin1(); |
594 | 596 | ||
595 | login(); | 597 | login(); |
596 | if (!m_imap) { | 598 | if (!m_imap) { |
597 | return body; | 599 | return body; |
598 | } | 600 | } |
599 | err = selectMbox(mail->getMbox()); | 601 | err = selectMbox(mail->getMbox()); |
600 | if ( err != MAILIMAP_NO_ERROR ) { | 602 | if ( err != MAILIMAP_NO_ERROR ) { |
601 | return body; | 603 | return body; |
602 | } | 604 | } |
603 | 605 | ||
604 | /* the range has to start at 1!!! not with 0!!!! */ | 606 | /* the range has to start at 1!!! not with 0!!!! */ |
605 | set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); | 607 | set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); |
606 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 608 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
607 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 609 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
608 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 610 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
609 | mailimap_set_free( set ); | 611 | mailimap_set_free( set ); |
610 | mailimap_fetch_type_free( fetchType ); | 612 | mailimap_fetch_type_free( fetchType ); |
611 | 613 | ||
612 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 614 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
613 | mailimap_msg_att * msg_att; | 615 | mailimap_msg_att * msg_att; |
614 | msg_att = (mailimap_msg_att*)current->data; | 616 | msg_att = (mailimap_msg_att*)current->data; |
615 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; | 617 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; |
616 | QValueList<int> path; | 618 | Q3ValueList<int> path; |
617 | body_desc = item->att_data.att_static->att_data.att_body; | 619 | body_desc = item->att_data.att_static->att_data.att_body; |
618 | traverseBody(mail,body_desc,body,0,path); | 620 | traverseBody(mail,body_desc,body,0,path); |
619 | } else { | 621 | } else { |
620 | qDebug("error fetching body %d (%d): %s", err, MAILIMAP_NO_ERROR, m_imap->imap_response ); | 622 | qDebug("error fetching body %d (%d): %s", err, MAILIMAP_NO_ERROR, m_imap->imap_response ); |
621 | } | 623 | } |
622 | if (result) mailimap_fetch_list_free(result); | 624 | if (result) mailimap_fetch_list_free(result); |
623 | return body; | 625 | return body; |
624 | } | 626 | } |
625 | 627 | ||
626 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | 628 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) |
627 | { | 629 | { |
628 | QStringList l; | 630 | QStringList l; |
629 | QString from; | 631 | QString from; |
630 | bool named_from; | 632 | bool named_from; |
631 | clistcell *current = NULL; | 633 | clistcell *current = NULL; |
632 | mailimap_address * current_address=NULL; | 634 | mailimap_address * current_address=NULL; |
633 | if (!list) { | 635 | if (!list) { |
634 | return l; | 636 | return l; |
635 | } | 637 | } |
636 | unsigned int count = 0; | 638 | unsigned int count = 0; |
637 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { | 639 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { |
638 | from = ""; | 640 | from = ""; |
639 | named_from = false; | 641 | named_from = false; |
640 | current_address=(mailimap_address*)current->data; | 642 | current_address=(mailimap_address*)current->data; |
641 | if (current_address->ad_personal_name){ | 643 | if (current_address->ad_personal_name){ |
642 | from+=convert_String((const char*)current_address->ad_personal_name); | 644 | from+=convert_String((const char*)current_address->ad_personal_name); |
643 | from+=" "; | 645 | from+=" "; |
644 | named_from = true; | 646 | named_from = true; |
645 | } | 647 | } |
646 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 648 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
647 | from+="<"; | 649 | from+="<"; |
648 | } | 650 | } |
649 | if (current_address->ad_mailbox_name) { | 651 | if (current_address->ad_mailbox_name) { |
650 | from+=QString(current_address->ad_mailbox_name); | 652 | from+=QString(current_address->ad_mailbox_name); |
651 | from+="@"; | 653 | from+="@"; |
652 | } | 654 | } |
653 | if (current_address->ad_host_name) { | 655 | if (current_address->ad_host_name) { |
654 | from+=QString(current_address->ad_host_name); | 656 | from+=QString(current_address->ad_host_name); |
655 | } | 657 | } |
656 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 658 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
657 | from+=">"; | 659 | from+=">"; |
658 | } | 660 | } |
659 | l.append(QString(from)); | 661 | l.append(QString(from)); |
660 | if (++count > 99) { | 662 | if (++count > 99) { |
661 | break; | 663 | break; |
662 | } | 664 | } |
663 | } | 665 | } |
664 | return l; | 666 | return l; |
665 | } | 667 | } |
666 | 668 | ||
667 | encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call) | 669 | encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call) |
668 | { | 670 | { |
669 | encodedString*res=new encodedString; | 671 | encodedString*res=new encodedString; |
670 | int err; | 672 | int err; |
671 | mailimap_fetch_type *fetchType; | 673 | mailimap_fetch_type *fetchType; |
672 | mailimap_set *set; | 674 | mailimap_set *set; |
673 | clistcell*current,*cur; | 675 | clistcell*current,*cur; |
674 | mailimap_section_part * section_part = 0; | 676 | mailimap_section_part * section_part = 0; |
675 | mailimap_section_spec * section_spec = 0; | 677 | mailimap_section_spec * section_spec = 0; |
676 | mailimap_section * section = 0; | 678 | mailimap_section * section = 0; |
677 | mailimap_fetch_att * fetch_att = 0; | 679 | mailimap_fetch_att * fetch_att = 0; |
678 | 680 | ||
679 | login(); | 681 | login(); |
680 | if (!m_imap) { | 682 | if (!m_imap) { |
681 | return res; | 683 | return res; |
682 | } | 684 | } |
683 | if (!internal_call) { | 685 | if (!internal_call) { |
684 | err = selectMbox(mail->getMbox()); | 686 | err = selectMbox(mail->getMbox()); |
685 | if ( err != MAILIMAP_NO_ERROR ) { | 687 | if ( err != MAILIMAP_NO_ERROR ) { |
686 | return res; | 688 | return res; |
687 | } | 689 | } |
688 | } | 690 | } |
689 | set = mailimap_set_new_single(mail->getNumber()); | 691 | set = mailimap_set_new_single(mail->getNumber()); |
690 | 692 | ||
691 | clist*id_list = 0; | 693 | clist*id_list = 0; |
692 | 694 | ||
693 | /* if path == empty then its a request for the whole rfc822 mail and generates | 695 | /* if path == empty then its a request for the whole rfc822 mail and generates |
694 | a "fetch <id> (body[])" statement on imap server */ | 696 | a "fetch <id> (body[])" statement on imap server */ |
695 | if (path.count()>0 ) { | 697 | if (path.count()>0 ) { |
696 | id_list = clist_new(); | 698 | id_list = clist_new(); |
697 | for (unsigned j=0; j < path.count();++j) { | 699 | for (unsigned j=0; j < path.count();++j) { |
698 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | 700 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); |
699 | *p_id = path[j]; | 701 | *p_id = path[j]; |
@@ -709,126 +711,126 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int | |||
709 | 711 | ||
710 | clist*result = 0; | 712 | clist*result = 0; |
711 | 713 | ||
712 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 714 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
713 | mailimap_set_free( set ); | 715 | mailimap_set_free( set ); |
714 | mailimap_fetch_type_free( fetchType ); | 716 | mailimap_fetch_type_free( fetchType ); |
715 | 717 | ||
716 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 718 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
717 | mailimap_msg_att * msg_att; | 719 | mailimap_msg_att * msg_att; |
718 | msg_att = (mailimap_msg_att*)current->data; | 720 | msg_att = (mailimap_msg_att*)current->data; |
719 | mailimap_msg_att_item*msg_att_item; | 721 | mailimap_msg_att_item*msg_att_item; |
720 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { | 722 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { |
721 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | 723 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); |
722 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | 724 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { |
723 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | 725 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { |
724 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 726 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
725 | /* detach - we take over the content */ | 727 | /* detach - we take over the content */ |
726 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 728 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
727 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); | 729 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); |
728 | } | 730 | } |
729 | } | 731 | } |
730 | } | 732 | } |
731 | } else { | 733 | } else { |
732 | ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; | 734 | ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; |
733 | } | 735 | } |
734 | if (result) mailimap_fetch_list_free(result); | 736 | if (result) mailimap_fetch_list_free(result); |
735 | return res; | 737 | return res; |
736 | } | 738 | } |
737 | 739 | ||
738 | /* current_recursion is for recursive calls. | 740 | /* current_recursion is for recursive calls. |
739 | current_count means the position inside the internal loop! */ | 741 | current_count means the position inside the internal loop! */ |
740 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, | 742 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, |
741 | int current_recursion,QValueList<int>recList,int current_count) | 743 | int current_recursion,Q3ValueList<int>recList,int current_count) |
742 | { | 744 | { |
743 | if (!body || current_recursion>=10) { | 745 | if (!body || current_recursion>=10) { |
744 | return; | 746 | return; |
745 | } | 747 | } |
746 | switch (body->bd_type) { | 748 | switch (body->bd_type) { |
747 | case MAILIMAP_BODY_1PART: | 749 | case MAILIMAP_BODY_1PART: |
748 | { | 750 | { |
749 | QValueList<int>countlist = recList; | 751 | Q3ValueList<int>countlist = recList; |
750 | countlist.append(current_count); | 752 | countlist.append(current_count); |
751 | RecPartP currentPart = new RecPart(); | 753 | RecPartP currentPart = new RecPart(); |
752 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; | 754 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; |
753 | QString id(""); | 755 | QString id(""); |
754 | currentPart->setPositionlist(countlist); | 756 | currentPart->setPositionlist(countlist); |
755 | for (unsigned int j = 0; j < countlist.count();++j) { | 757 | for (unsigned int j = 0; j < countlist.count();++j) { |
756 | id+=(j>0?" ":""); | 758 | id+=(j>0?" ":""); |
757 | id+=QString("%1").arg(countlist[j]); | 759 | id+=QString("%1").arg(countlist[j]); |
758 | } | 760 | } |
759 | //odebug << "ID = " << id.latin1() << "" << oendl; | 761 | //odebug << "ID = " << id.latin1() << "" << oendl; |
760 | currentPart->setIdentifier(id); | 762 | currentPart->setIdentifier(id); |
761 | fillSinglePart(currentPart,part1); | 763 | fillSinglePart(currentPart,part1); |
762 | /* important: Check for is NULL 'cause a body can be empty! | 764 | /* important: Check for is NULL 'cause a body can be empty! |
763 | And we put it only into the mail if it is the FIRST part */ | 765 | And we put it only into the mail if it is the FIRST part */ |
764 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { | 766 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { |
765 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); | 767 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); |
766 | 768 | ||
767 | size_t index = 0; | 769 | size_t index = 0; |
768 | char*res = 0; | 770 | char*res = 0; |
769 | int err = MAILIMF_NO_ERROR; | 771 | int err = MAILIMF_NO_ERROR; |
770 | 772 | ||
771 | QString charset = currentPart->searchParamter( "charset"); | 773 | QString charset = currentPart->searchParamter( "charset"); |
772 | qDebug("CHARSET %s ",charset.latin1() ); | 774 | qDebug("CHARSET %s ",charset.latin1() ); |
773 | if ( false ) { | 775 | if ( false ) { |
774 | //if ( !charset.isEmpty() ) { | 776 | //if ( !charset.isEmpty() ) { |
775 | target_body->setCharset( charset ); | 777 | target_body->setCharset( charset ); |
776 | //err = mailmime_encoded_phrase_parse("iso-8859-1", | 778 | //err = mailmime_encoded_phrase_parse("iso-8859-1", |
777 | // text, strlen(text),&index, "iso-8859-1",&res); | 779 | // text, strlen(text),&index, "iso-8859-1",&res); |
778 | err = mailmime_encoded_phrase_parse(charset.latin1(), | 780 | err = mailmime_encoded_phrase_parse(charset.latin1(), |
779 | body_text.latin1(), body_text.length(),&index, "utf-8",&res); | 781 | body_text.latin1(), body_text.length(),&index, "utf-8",&res); |
780 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { | 782 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { |
781 | //qDebug("res %d %s ", index, res); | 783 | //qDebug("res %d %s ", index, res); |
782 | body_text = QString::fromUtf8(res); | 784 | body_text = QString::fromUtf8(res); |
783 | } | 785 | } |
784 | if (res) free(res); | 786 | if (res) free(res); |
785 | } | 787 | } |
786 | //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); | 788 | //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); |
787 | target_body->setDescription(currentPart); | 789 | target_body->setDescription(currentPart); |
788 | target_body->setBodytext(body_text); | 790 | target_body->setBodytext(body_text); |
789 | if (countlist.count()>1) { | 791 | if (countlist.count()>1) { |
790 | target_body->addPart(currentPart); | 792 | target_body->addPart(currentPart); |
791 | } | 793 | } |
792 | } else { | 794 | } else { |
793 | target_body->addPart(currentPart); | 795 | target_body->addPart(currentPart); |
794 | } | 796 | } |
795 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { | 797 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { |
796 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); | 798 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); |
797 | } | 799 | } |
798 | } | 800 | } |
799 | break; | 801 | break; |
800 | case MAILIMAP_BODY_MPART: | 802 | case MAILIMAP_BODY_MPART: |
801 | { | 803 | { |
802 | QValueList<int>countlist = recList; | 804 | Q3ValueList<int>countlist = recList; |
803 | clistcell*current=0; | 805 | clistcell*current=0; |
804 | mailimap_body*current_body=0; | 806 | mailimap_body*current_body=0; |
805 | unsigned int ccount = 1; | 807 | unsigned int ccount = 1; |
806 | mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; | 808 | mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; |
807 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | 809 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { |
808 | current_body = (mailimap_body*)current->data; | 810 | current_body = (mailimap_body*)current->data; |
809 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 811 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
810 | RecPartP targetPart = new RecPart(); | 812 | RecPartP targetPart = new RecPart(); |
811 | targetPart->setType("multipart"); | 813 | targetPart->setType("multipart"); |
812 | fillMultiPart(targetPart,mailDescription); | 814 | fillMultiPart(targetPart,mailDescription); |
813 | countlist.append(current_count); | 815 | countlist.append(current_count); |
814 | targetPart->setPositionlist(countlist); | 816 | targetPart->setPositionlist(countlist); |
815 | target_body->addPart(targetPart); | 817 | target_body->addPart(targetPart); |
816 | QString id(""); | 818 | QString id(""); |
817 | for (unsigned int j = 0; j < countlist.count();++j) { | 819 | for (unsigned int j = 0; j < countlist.count();++j) { |
818 | id+=(j>0?" ":""); | 820 | id+=(j>0?" ":""); |
819 | id+=QString("%1").arg(countlist[j]); | 821 | id+=QString("%1").arg(countlist[j]); |
820 | } | 822 | } |
821 | // odebug << "ID(mpart) = " << id.latin1() << "" << oendl; | 823 | // odebug << "ID(mpart) = " << id.latin1() << "" << oendl; |
822 | } | 824 | } |
823 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); | 825 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); |
824 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 826 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
825 | countlist = recList; | 827 | countlist = recList; |
826 | } | 828 | } |
827 | ++ccount; | 829 | ++ccount; |
828 | } | 830 | } |
829 | } | 831 | } |
830 | break; | 832 | break; |
831 | default: | 833 | default: |
832 | break; | 834 | break; |
833 | } | 835 | } |
834 | } | 836 | } |
@@ -956,85 +958,85 @@ void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which | |||
956 | QString encoding(""); | 958 | QString encoding(""); |
957 | switch (enc->enc_type) { | 959 | switch (enc->enc_type) { |
958 | case MAILIMAP_BODY_FLD_ENC_7BIT: | 960 | case MAILIMAP_BODY_FLD_ENC_7BIT: |
959 | encoding = "7bit"; | 961 | encoding = "7bit"; |
960 | break; | 962 | break; |
961 | case MAILIMAP_BODY_FLD_ENC_8BIT: | 963 | case MAILIMAP_BODY_FLD_ENC_8BIT: |
962 | encoding = "8bit"; | 964 | encoding = "8bit"; |
963 | break; | 965 | break; |
964 | case MAILIMAP_BODY_FLD_ENC_BINARY: | 966 | case MAILIMAP_BODY_FLD_ENC_BINARY: |
965 | encoding="binary"; | 967 | encoding="binary"; |
966 | break; | 968 | break; |
967 | case MAILIMAP_BODY_FLD_ENC_BASE64: | 969 | case MAILIMAP_BODY_FLD_ENC_BASE64: |
968 | encoding="base64"; | 970 | encoding="base64"; |
969 | break; | 971 | break; |
970 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: | 972 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: |
971 | encoding="quoted-printable"; | 973 | encoding="quoted-printable"; |
972 | break; | 974 | break; |
973 | case MAILIMAP_BODY_FLD_ENC_OTHER: | 975 | case MAILIMAP_BODY_FLD_ENC_OTHER: |
974 | default: | 976 | default: |
975 | if (enc->enc_value) { | 977 | if (enc->enc_value) { |
976 | char*t=enc->enc_value; | 978 | char*t=enc->enc_value; |
977 | encoding=QString(enc->enc_value); | 979 | encoding=QString(enc->enc_value); |
978 | enc->enc_value=0L; | 980 | enc->enc_value=0L; |
979 | free(t); | 981 | free(t); |
980 | } | 982 | } |
981 | } | 983 | } |
982 | if (which->bd_description) { | 984 | if (which->bd_description) { |
983 | target_part->setDescription(QString(which->bd_description)); | 985 | target_part->setDescription(QString(which->bd_description)); |
984 | } | 986 | } |
985 | target_part->setEncoding(encoding); | 987 | target_part->setEncoding(encoding); |
986 | target_part->setSize(which->bd_size); | 988 | target_part->setSize(which->bd_size); |
987 | } | 989 | } |
988 | void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | 990 | void IMAPwrapper::deleteMailList(const Q3ValueList<RecMailP>&target) |
989 | { | 991 | { |
990 | //#if 0 | 992 | //#if 0 |
991 | mailimap_flag_list*flist; | 993 | mailimap_flag_list*flist; |
992 | mailimap_set *set; | 994 | mailimap_set *set; |
993 | mailimap_store_att_flags * store_flags; | 995 | mailimap_store_att_flags * store_flags; |
994 | int err; | 996 | int err; |
995 | login(); | 997 | login(); |
996 | //#endif | 998 | //#endif |
997 | if (!m_imap) { | 999 | if (!m_imap) { |
998 | return; | 1000 | return; |
999 | } | 1001 | } |
1000 | int iii = 0; | 1002 | int iii = 0; |
1001 | int count = target.count(); | 1003 | int count = target.count(); |
1002 | // qDebug("imap remove count %d ", count); | 1004 | // qDebug("imap remove count %d ", count); |
1003 | 1005 | ||
1004 | 1006 | ||
1005 | mMax = count; | 1007 | mMax = count; |
1006 | progress( i18n("Delete")); | 1008 | progress( i18n("Delete")); |
1007 | 1009 | ||
1008 | QProgressBar wid ( count ); | 1010 | Q3ProgressBar wid ( count ); |
1009 | wid.setCaption( i18n("Deleting ...")); | 1011 | wid.setCaption( i18n("Deleting ...")); |
1010 | wid.show(); | 1012 | wid.show(); |
1011 | while (iii < count ) { | 1013 | while (iii < count ) { |
1012 | Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); | 1014 | Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); |
1013 | wid.setProgress( iii ); | 1015 | wid.setProgress( iii ); |
1014 | wid.raise(); | 1016 | wid.raise(); |
1015 | qApp->processEvents(); | 1017 | qApp->processEvents(); |
1016 | RecMailP mail = (*target.at( iii )); | 1018 | RecMailP mail = (*target.at( iii )); |
1017 | //#if 0 | 1019 | //#if 0 |
1018 | //qDebug("IMAP remove %d %d ", iii, mail->getNumber() ); | 1020 | //qDebug("IMAP remove %d %d ", iii, mail->getNumber() ); |
1019 | err = selectMbox(mail->getMbox()); | 1021 | err = selectMbox(mail->getMbox()); |
1020 | if ( err != MAILIMAP_NO_ERROR ) { | 1022 | if ( err != MAILIMAP_NO_ERROR ) { |
1021 | return; | 1023 | return; |
1022 | } | 1024 | } |
1023 | flist = mailimap_flag_list_new_empty(); | 1025 | flist = mailimap_flag_list_new_empty(); |
1024 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 1026 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
1025 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 1027 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
1026 | set = mailimap_set_new_single(mail->getNumber()); | 1028 | set = mailimap_set_new_single(mail->getNumber()); |
1027 | err = mailimap_store(m_imap,set,store_flags); | 1029 | err = mailimap_store(m_imap,set,store_flags); |
1028 | mailimap_set_free( set ); | 1030 | mailimap_set_free( set ); |
1029 | mailimap_store_att_flags_free(store_flags); | 1031 | mailimap_store_att_flags_free(store_flags); |
1030 | 1032 | ||
1031 | if (err != MAILIMAP_NO_ERROR) { | 1033 | if (err != MAILIMAP_NO_ERROR) { |
1032 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; | 1034 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; |
1033 | return; | 1035 | return; |
1034 | } | 1036 | } |
1035 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; | 1037 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
1036 | /* should we realy do that at this moment? */ | 1038 | /* should we realy do that at this moment? */ |
1037 | 1039 | ||
1038 | // err = mailimap_expunge(m_imap); | 1040 | // err = mailimap_expunge(m_imap); |
1039 | //if (err != MAILIMAP_NO_ERROR) { | 1041 | //if (err != MAILIMAP_NO_ERROR) { |
1040 | // Global::statusMessage(i18n("Error deleting mails: %s").arg(m_imap->imap_response)); | 1042 | // Global::statusMessage(i18n("Error deleting mails: %s").arg(m_imap->imap_response)); |
@@ -1085,65 +1087,65 @@ void IMAPwrapper::deleteMail(const RecMailP&mail) | |||
1085 | //qDebug("IMAPwrapper::deleteMail 2"); | 1087 | //qDebug("IMAPwrapper::deleteMail 2"); |
1086 | 1088 | ||
1087 | } | 1089 | } |
1088 | 1090 | ||
1089 | void IMAPwrapper::answeredMail(const RecMailP&mail) | 1091 | void IMAPwrapper::answeredMail(const RecMailP&mail) |
1090 | { | 1092 | { |
1091 | mailimap_flag_list*flist; | 1093 | mailimap_flag_list*flist; |
1092 | mailimap_set *set; | 1094 | mailimap_set *set; |
1093 | mailimap_store_att_flags * store_flags; | 1095 | mailimap_store_att_flags * store_flags; |
1094 | int err; | 1096 | int err; |
1095 | login(); | 1097 | login(); |
1096 | if (!m_imap) { | 1098 | if (!m_imap) { |
1097 | return; | 1099 | return; |
1098 | } | 1100 | } |
1099 | err = selectMbox(mail->getMbox()); | 1101 | err = selectMbox(mail->getMbox()); |
1100 | if ( err != MAILIMAP_NO_ERROR ) { | 1102 | if ( err != MAILIMAP_NO_ERROR ) { |
1101 | return; | 1103 | return; |
1102 | } | 1104 | } |
1103 | flist = mailimap_flag_list_new_empty(); | 1105 | flist = mailimap_flag_list_new_empty(); |
1104 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); | 1106 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); |
1105 | store_flags = mailimap_store_att_flags_new_add_flags(flist); | 1107 | store_flags = mailimap_store_att_flags_new_add_flags(flist); |
1106 | set = mailimap_set_new_single(mail->getNumber()); | 1108 | set = mailimap_set_new_single(mail->getNumber()); |
1107 | err = mailimap_store(m_imap,set,store_flags); | 1109 | err = mailimap_store(m_imap,set,store_flags); |
1108 | mailimap_set_free( set ); | 1110 | mailimap_set_free( set ); |
1109 | mailimap_store_att_flags_free(store_flags); | 1111 | mailimap_store_att_flags_free(store_flags); |
1110 | 1112 | ||
1111 | if (err != MAILIMAP_NO_ERROR) { | 1113 | if (err != MAILIMAP_NO_ERROR) { |
1112 | // odebug << "error marking mail: " << m_imap->imap_response << "" << oendl; | 1114 | // odebug << "error marking mail: " << m_imap->imap_response << "" << oendl; |
1113 | return; | 1115 | return; |
1114 | } | 1116 | } |
1115 | } | 1117 | } |
1116 | 1118 | ||
1117 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc) | 1119 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call,const QString&enc) |
1118 | { | 1120 | { |
1119 | QString body(""); | 1121 | QString body(""); |
1120 | encodedString*res = fetchRawPart(mail,path,internal_call); | 1122 | encodedString*res = fetchRawPart(mail,path,internal_call); |
1121 | encodedString*r = decode_String(res,enc); | 1123 | encodedString*r = decode_String(res,enc); |
1122 | delete res; | 1124 | delete res; |
1123 | if (r) { | 1125 | if (r) { |
1124 | if (r->Length()>0) { | 1126 | if (r->Length()>0) { |
1125 | body = r->Content(); | 1127 | body = r->Content(); |
1126 | } | 1128 | } |
1127 | delete r; | 1129 | delete r; |
1128 | } | 1130 | } |
1129 | return body; | 1131 | return body; |
1130 | } | 1132 | } |
1131 | 1133 | ||
1132 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) | 1134 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) |
1133 | { | 1135 | { |
1134 | return fetchTextPart(mail,part->Positionlist(),false,part->Encoding()); | 1136 | return fetchTextPart(mail,part->Positionlist(),false,part->Encoding()); |
1135 | } | 1137 | } |
1136 | 1138 | ||
1137 | encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPartP&part) | 1139 | encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPartP&part) |
1138 | { | 1140 | { |
1139 | encodedString*res = fetchRawPart(mail,part->Positionlist(),false); | 1141 | encodedString*res = fetchRawPart(mail,part->Positionlist(),false); |
1140 | encodedString*r = decode_String(res,part->Encoding()); | 1142 | encodedString*r = decode_String(res,part->Encoding()); |
1141 | delete res; | 1143 | delete res; |
1142 | return r; | 1144 | return r; |
1143 | } | 1145 | } |
1144 | 1146 | ||
1145 | encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPartP&part) | 1147 | encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPartP&part) |
1146 | { | 1148 | { |
1147 | return fetchRawPart(mail,part->Positionlist(),false); | 1149 | return fetchRawPart(mail,part->Positionlist(),false); |
1148 | } | 1150 | } |
1149 | 1151 | ||
@@ -1270,65 +1272,65 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
1270 | } else { | 1272 | } else { |
1271 | // odebug << "Error retrieving status" << oendl; | 1273 | // odebug << "Error retrieving status" << oendl; |
1272 | } | 1274 | } |
1273 | if (status) mailimap_mailbox_data_status_free(status); | 1275 | if (status) mailimap_mailbox_data_status_free(status); |
1274 | if (att_list) mailimap_status_att_list_free(att_list); | 1276 | if (att_list) mailimap_status_att_list_free(att_list); |
1275 | } | 1277 | } |
1276 | 1278 | ||
1277 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | 1279 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) |
1278 | { | 1280 | { |
1279 | login(); | 1281 | login(); |
1280 | if (!m_imap) return; | 1282 | if (!m_imap) return; |
1281 | if (!msg) return; | 1283 | if (!msg) return; |
1282 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); | 1284 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); |
1283 | if (r != MAILIMAP_NO_ERROR) { | 1285 | if (r != MAILIMAP_NO_ERROR) { |
1284 | Global::statusMessage("Error storing mail!"); | 1286 | Global::statusMessage("Error storing mail!"); |
1285 | } | 1287 | } |
1286 | } | 1288 | } |
1287 | 1289 | ||
1288 | MAILLIB::ATYPE IMAPwrapper::getType()const | 1290 | MAILLIB::ATYPE IMAPwrapper::getType()const |
1289 | { | 1291 | { |
1290 | return account->getType(); | 1292 | return account->getType(); |
1291 | } | 1293 | } |
1292 | 1294 | ||
1293 | const QString&IMAPwrapper::getName()const | 1295 | const QString&IMAPwrapper::getName()const |
1294 | { | 1296 | { |
1295 | // odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; | 1297 | // odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; |
1296 | return account->getAccountName(); | 1298 | return account->getAccountName(); |
1297 | } | 1299 | } |
1298 | 1300 | ||
1299 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) | 1301 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) |
1300 | { | 1302 | { |
1301 | // dummy | 1303 | // dummy |
1302 | QValueList<int> path; | 1304 | Q3ValueList<int> path; |
1303 | return fetchRawPart(mail,path,false); | 1305 | return fetchRawPart(mail,path,false); |
1304 | } | 1306 | } |
1305 | 1307 | ||
1306 | void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | 1308 | void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, |
1307 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) | 1309 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
1308 | { | 1310 | { |
1309 | if (targetWrapper != this || maxSizeInKb > 0 ) { | 1311 | if (targetWrapper != this || maxSizeInKb > 0 ) { |
1310 | mMax = 0; | 1312 | mMax = 0; |
1311 | progress( i18n("Copy")); | 1313 | progress( i18n("Copy")); |
1312 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); | 1314 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); |
1313 | //qDebug("IMAPwrapper::mvcpAllMails::Using generic"); | 1315 | //qDebug("IMAPwrapper::mvcpAllMails::Using generic"); |
1314 | // odebug << "Using generic" << oendl; | 1316 | // odebug << "Using generic" << oendl; |
1315 | return; | 1317 | return; |
1316 | } | 1318 | } |
1317 | mailimap_set *set = 0; | 1319 | mailimap_set *set = 0; |
1318 | login(); | 1320 | login(); |
1319 | if (!m_imap) { | 1321 | if (!m_imap) { |
1320 | return; | 1322 | return; |
1321 | } | 1323 | } |
1322 | int err = selectMbox(fromFolder->getName()); | 1324 | int err = selectMbox(fromFolder->getName()); |
1323 | if ( err != MAILIMAP_NO_ERROR ) { | 1325 | if ( err != MAILIMAP_NO_ERROR ) { |
1324 | return; | 1326 | return; |
1325 | } | 1327 | } |
1326 | Global::statusMessage( i18n("Copying mails on server...") ); | 1328 | Global::statusMessage( i18n("Copying mails on server...") ); |
1327 | int last = m_imap->imap_selection_info->sel_exists; | 1329 | int last = m_imap->imap_selection_info->sel_exists; |
1328 | set = mailimap_set_new_interval( 1, last ); | 1330 | set = mailimap_set_new_interval( 1, last ); |
1329 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); | 1331 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); |
1330 | mailimap_set_free( set ); | 1332 | mailimap_set_free( set ); |
1331 | if ( err != MAILIMAP_NO_ERROR ) { | 1333 | if ( err != MAILIMAP_NO_ERROR ) { |
1332 | QString error_msg = i18n("Error copy mails: %1").arg(m_imap->imap_response); | 1334 | QString error_msg = i18n("Error copy mails: %1").arg(m_imap->imap_response); |
1333 | Global::statusMessage(error_msg); | 1335 | Global::statusMessage(error_msg); |
1334 | // odebug << error_msg << oendl; | 1336 | // odebug << error_msg << oendl; |
diff --git a/kmicromail/libmailwrapper/imapwrapper.h b/kmicromail/libmailwrapper/imapwrapper.h index 31c60a8..d3d3ecd 100644 --- a/kmicromail/libmailwrapper/imapwrapper.h +++ b/kmicromail/libmailwrapper/imapwrapper.h | |||
@@ -1,85 +1,87 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef __IMAPWRAPPER | 2 | #ifndef __IMAPWRAPPER |
3 | #define __IMAPWRAPPER | 3 | #define __IMAPWRAPPER |
4 | 4 | ||
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | //Added by qt3to4: | ||
7 | #include <Q3ValueList> | ||
6 | #include "mailwrapper.h" | 8 | #include "mailwrapper.h" |
7 | #include "abstractmail.h" | 9 | #include "abstractmail.h" |
8 | #include <libetpan/clist.h> | 10 | #include <libetpan/clist.h> |
9 | 11 | ||
10 | struct mailimap; | 12 | struct mailimap; |
11 | struct mailimap_body; | 13 | struct mailimap_body; |
12 | struct mailimap_body_type_1part; | 14 | struct mailimap_body_type_1part; |
13 | struct mailimap_body_type_text; | 15 | struct mailimap_body_type_text; |
14 | struct mailimap_body_type_basic; | 16 | struct mailimap_body_type_basic; |
15 | struct mailimap_body_type_msg; | 17 | struct mailimap_body_type_msg; |
16 | struct mailimap_body_type_mpart; | 18 | struct mailimap_body_type_mpart; |
17 | struct mailimap_body_fields; | 19 | struct mailimap_body_fields; |
18 | struct mailimap_msg_att; | 20 | struct mailimap_msg_att; |
19 | class encodedString; | 21 | class encodedString; |
20 | 22 | ||
21 | class IMAPwrapper : public AbstractMail | 23 | class IMAPwrapper : public AbstractMail |
22 | { | 24 | { |
23 | Q_OBJECT | 25 | Q_OBJECT |
24 | public: | 26 | public: |
25 | IMAPwrapper( IMAPaccount *a ); | 27 | IMAPwrapper( IMAPaccount *a ); |
26 | virtual ~IMAPwrapper(); | 28 | virtual ~IMAPwrapper(); |
27 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); | 29 | virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
28 | virtual void listMessages(const QString & mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> >&target , int sizeInKb = 0); | 30 | virtual void listMessages(const QString & mailbox,Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target , int sizeInKb = 0); |
29 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 31 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
30 | 32 | ||
31 | virtual void deleteMail(const RecMailP&mail); | 33 | virtual void deleteMail(const RecMailP&mail); |
32 | void deleteMailList(const QValueList<RecMailP>&target); | 34 | void deleteMailList(const Q3ValueList<RecMailP>&target); |
33 | virtual void answeredMail(const RecMailP&mail); | 35 | virtual void answeredMail(const RecMailP&mail); |
34 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&folder); | 36 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&folder); |
35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 37 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
36 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, | 38 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
37 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit,int sizeInKb = 0); | 39 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit,int sizeInKb = 0); |
38 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 40 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
39 | 41 | ||
40 | virtual RecBodyP fetchBody(const RecMailP&mail); | 42 | virtual RecBodyP fetchBody(const RecMailP&mail); |
41 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); | 43 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); |
42 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); | 44 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); |
43 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); | 45 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); |
44 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 46 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
45 | 47 | ||
46 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, | 48 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, |
47 | const QString& delemiter="/",bool getsubfolder=false); | 49 | const QString& delemiter="/",bool getsubfolder=false); |
48 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder); | 50 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder); |
49 | 51 | ||
50 | static void imap_progress( size_t current, size_t maximum ); | 52 | static void imap_progress( size_t current, size_t maximum ); |
51 | 53 | ||
52 | virtual void logout(); | 54 | virtual void logout(); |
53 | virtual MAILLIB::ATYPE getType()const; | 55 | virtual MAILLIB::ATYPE getType()const; |
54 | virtual const QString&getName()const; | 56 | virtual const QString&getName()const; |
55 | virtual Account* getAccount() { return account; }; | 57 | virtual Account* getAccount() { return account; }; |
56 | 58 | ||
57 | protected: | 59 | protected: |
58 | RecMail*parse_list_result(mailimap_msg_att*); | 60 | RecMail*parse_list_result(mailimap_msg_att*); |
59 | void login(bool tryTLS = true); | 61 | void login(bool tryTLS = true); |
60 | bool start_tls(bool force=true); | 62 | bool start_tls(bool force=true); |
61 | 63 | ||
62 | virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); | 64 | virtual QString fetchTextPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call=false,const QString&enc=""); |
63 | virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call); | 65 | virtual encodedString*fetchRawPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call); |
64 | int selectMbox(const QString&mbox); | 66 | int selectMbox(const QString&mbox); |
65 | 67 | ||
66 | void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description); | 68 | void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description); |
67 | void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which); | 69 | void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which); |
68 | void fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which); | 70 | void fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which); |
69 | void fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which); | 71 | void fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which); |
70 | void fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which); | 72 | void fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which); |
71 | void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,QValueList<int>recList,int current_count=1); | 73 | void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,Q3ValueList<int>recList,int current_count=1); |
72 | 74 | ||
73 | /* just helpers */ | 75 | /* just helpers */ |
74 | static void fillBodyFields(RecPartP&target_part,mailimap_body_fields*which); | 76 | static void fillBodyFields(RecPartP&target_part,mailimap_body_fields*which); |
75 | static QStringList address_list_to_stringlist(clist*list); | 77 | static QStringList address_list_to_stringlist(clist*list); |
76 | 78 | ||
77 | static void progress(QString mess = QString::null); | 79 | static void progress(QString mess = QString::null); |
78 | static int mCurrent; | 80 | static int mCurrent; |
79 | static int mMax; | 81 | static int mMax; |
80 | IMAPaccount *account; | 82 | IMAPaccount *account; |
81 | mailimap *m_imap; | 83 | mailimap *m_imap; |
82 | QString m_Lastmbox; | 84 | QString m_Lastmbox; |
83 | }; | 85 | }; |
84 | 86 | ||
85 | #endif | 87 | #endif |
diff --git a/kmicromail/libmailwrapper/libmailwrapper.pro b/kmicromail/libmailwrapper/libmailwrapper.pro index 646630b..6b595ab 100644 --- a/kmicromail/libmailwrapper/libmailwrapper.pro +++ b/kmicromail/libmailwrapper/libmailwrapper.pro | |||
@@ -9,57 +9,63 @@ HEADERS = mailwrapper.h \ | |||
9 | smtpwrapper.h \ | 9 | smtpwrapper.h \ |
10 | genericwrapper.h \ | 10 | genericwrapper.h \ |
11 | mboxwrapper.h \ | 11 | mboxwrapper.h \ |
12 | settings.h \ | 12 | settings.h \ |
13 | logindialog.h \ | 13 | logindialog.h \ |
14 | sendmailprogress.h \ | 14 | sendmailprogress.h \ |
15 | statusmail.h \ | 15 | statusmail.h \ |
16 | mhwrapper.h \ | 16 | mhwrapper.h \ |
17 | nntpwrapper.h \ | 17 | nntpwrapper.h \ |
18 | generatemail.h \ | 18 | generatemail.h \ |
19 | storemail.h \ | 19 | storemail.h \ |
20 | ../qpe/global.h | 20 | ../qpe/global.h |
21 | 21 | ||
22 | SOURCES = imapwrapper.cpp \ | 22 | SOURCES = imapwrapper.cpp \ |
23 | mailwrapper.cpp \ | 23 | mailwrapper.cpp \ |
24 | mailtypes.cpp \ | 24 | mailtypes.cpp \ |
25 | pop3wrapper.cpp \ | 25 | pop3wrapper.cpp \ |
26 | abstractmail.cpp \ | 26 | abstractmail.cpp \ |
27 | smtpwrapper.cpp \ | 27 | smtpwrapper.cpp \ |
28 | genericwrapper.cpp \ | 28 | genericwrapper.cpp \ |
29 | mboxwrapper.cpp \ | 29 | mboxwrapper.cpp \ |
30 | settings.cpp \ | 30 | settings.cpp \ |
31 | logindialog.cpp \ | 31 | logindialog.cpp \ |
32 | sendmailprogress.cpp \ | 32 | sendmailprogress.cpp \ |
33 | statusmail.cpp \ | 33 | statusmail.cpp \ |
34 | mhwrapper.cpp \ | 34 | mhwrapper.cpp \ |
35 | nntpwrapper.cpp \ | 35 | nntpwrapper.cpp \ |
36 | generatemail.cpp \ | 36 | generatemail.cpp \ |
37 | storemail.cpp \ | 37 | storemail.cpp \ |
38 | ../qpe/qdialog_hacked.cpp \ | 38 | ../qpe/qdialog_hacked.cpp \ |
39 | ../qpe/global.cpp | 39 | ../qpe/global.cpp |
40 | 40 | ||
41 | INTERFACES = logindialogui.ui \ | 41 | #The following line was changed from INTERFACES to FORMS3 by qt3to4 |
42 | FORMS3 = logindialogui.ui \ | ||
42 | sendmailprogressui.ui | 43 | sendmailprogressui.ui |
43 | 44 | ||
44 | INCLUDEPATH += ../qpe .. ../../microkde ../../microkde/kdecore ../../libetpan/include | 45 | INCLUDEPATH += ../qpe .. ../../microkde ../../microkde/kdecore ../../libetpan/include |
45 | LIBS += -lssl -lcrypto | 46 | LIBS += -lssl -lcrypto |
46 | 47 | ||
47 | #-lqpe -letpan | 48 | #-lqpe -letpan |
48 | 49 | ||
49 | DESTDIR = ../../bin | 50 | DESTDIR = ../../bin |
50 | TARGET = micromailwrapper | 51 | TARGET = micromailwrapper |
51 | 52 | ||
52 | DEFINES += DESKTOP_VERSION | 53 | DEFINES += DESKTOP_VERSION |
53 | unix : { | 54 | unix : { |
54 | OBJECTS_DIR = obj/unix | 55 | OBJECTS_DIR = obj/unix |
55 | MOC_DIR = moc/unix | 56 | MOC_DIR = moc/unix |
56 | } | 57 | } |
57 | win32: { | 58 | win32: { |
58 | DEFINES += _WIN32_ | 59 | DEFINES += _WIN32_ |
59 | LIBS += mfc71u.lib | 60 | LIBS += mfc71u.lib |
60 | QMAKE_LINK += /NODEFAULTLIB:LIBC | 61 | QMAKE_LINK += /NODEFAULTLIB:LIBC |
61 | #QMAKE_LINK += /NODEFAULTLIB:MSVCRT | 62 | #QMAKE_LINK += /NODEFAULTLIB:MSVCRT |
62 | #QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib | 63 | #QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib |
63 | OBJECTS_DIR = obj/win | 64 | OBJECTS_DIR = obj/win |
64 | MOC_DIR = moc/win | 65 | MOC_DIR = moc/win |
65 | } | 66 | } |
67 | #The following line was inserted by qt3to4 | ||
68 | QT += xml qt3support | ||
69 | #The following line was inserted by qt3to4 | ||
70 | CONFIG += uic3 | ||
71 | |||
diff --git a/kmicromail/libmailwrapper/logindialog.cpp b/kmicromail/libmailwrapper/logindialog.cpp index 31b75d0..d1f4b5d 100644 --- a/kmicromail/libmailwrapper/logindialog.cpp +++ b/kmicromail/libmailwrapper/logindialog.cpp | |||
@@ -1,33 +1,33 @@ | |||
1 | #include <qlineedit.h> | 1 | #include <qlineedit.h> |
2 | 2 | ||
3 | #include "logindialog.h" | 3 | #include "logindialog.h" |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
7 | //using namespace Opie::Core; | 7 | //using namespace Opie::Core; |
8 | 8 | ||
9 | LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, const char *name, bool modal, WFlags flags ) | 9 | LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, const char *name, bool modal, Qt::WFlags flags ) |
10 | : LoginDialogUI( parent, name, modal, flags ) | 10 | : LoginDialogUI( parent, name, modal, flags ) |
11 | { | 11 | { |
12 | userLine->setText( (user.isEmpty()?QString(""):user) ); | 12 | userLine->setText( (user.isEmpty()?QString(""):user) ); |
13 | passLine->setText( (pass.isEmpty()?QString(""):pass) ); | 13 | passLine->setText( (pass.isEmpty()?QString(""):pass) ); |
14 | _user = user; | 14 | _user = user; |
15 | _pass = pass; | 15 | _pass = pass; |
16 | 16 | ||
17 | if ( user.isEmpty() ) { | 17 | if ( user.isEmpty() ) { |
18 | userLine->setFocus(); | 18 | userLine->setFocus(); |
19 | } else { | 19 | } else { |
20 | passLine->setFocus(); | 20 | passLine->setFocus(); |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | void LoginDialog::accept() | 24 | void LoginDialog::accept() |
25 | { | 25 | { |
26 | //_user.replace( 0, _user.length(), userLine->text() ); | 26 | //_user.replace( 0, _user.length(), userLine->text() ); |
27 | //_pass.replace( 0, _pass.length(), passLine->text() ); | 27 | //_pass.replace( 0, _pass.length(), passLine->text() ); |
28 | _user = userLine->text(); | 28 | _user = userLine->text(); |
29 | _pass = passLine->text(); | 29 | _pass = passLine->text(); |
30 | 30 | ||
31 | //odebug << "User im accept: |" << _user.latin1() << "|" << oendl; | 31 | //odebug << "User im accept: |" << _user.latin1() << "|" << oendl; |
32 | QDialog::accept(); | 32 | QDialog::accept(); |
33 | } | 33 | } |
diff --git a/kmicromail/libmailwrapper/logindialog.h b/kmicromail/libmailwrapper/logindialog.h index f406f2c..a18daa5 100644 --- a/kmicromail/libmailwrapper/logindialog.h +++ b/kmicromail/libmailwrapper/logindialog.h | |||
@@ -1,23 +1,23 @@ | |||
1 | #ifndef LOGINDIALOG_H | 1 | #ifndef LOGINDIALOG_H |
2 | #define LOGINDIALOG_H | 2 | #define LOGINDIALOG_H |
3 | 3 | ||
4 | #include "logindialogui.h" | 4 | #include "logindialogui.h" |
5 | 5 | ||
6 | class LoginDialog : public LoginDialogUI | 6 | class LoginDialog : public LoginDialogUI |
7 | { | 7 | { |
8 | Q_OBJECT | 8 | Q_OBJECT |
9 | 9 | ||
10 | public: | 10 | public: |
11 | LoginDialog(const QString&user,const QString&pass, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 11 | LoginDialog(const QString&user,const QString&pass, QWidget *parent = 0, const char *name = 0, bool modal = false, Qt::WFlags flags = 0 ); |
12 | QString getUser() { return _user; } | 12 | QString getUser() { return _user; } |
13 | QString getPassword() { return _pass; } | 13 | QString getPassword() { return _pass; } |
14 | 14 | ||
15 | protected slots: | 15 | protected slots: |
16 | void accept(); | 16 | void accept(); |
17 | 17 | ||
18 | private: | 18 | private: |
19 | QString _user, _pass; | 19 | QString _user, _pass; |
20 | 20 | ||
21 | }; | 21 | }; |
22 | 22 | ||
23 | #endif | 23 | #endif |
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp index 70a0ab5..84ccf9f 100644 --- a/kmicromail/libmailwrapper/mailtypes.cpp +++ b/kmicromail/libmailwrapper/mailtypes.cpp | |||
@@ -1,37 +1,39 @@ | |||
1 | #include "mailtypes.h" | 1 | #include "mailtypes.h" |
2 | 2 | ||
3 | //#include <opie2/odebug.h> | 3 | //#include <opie2/odebug.h> |
4 | 4 | ||
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | //Added by qt3to4: | ||
7 | #include <Q3ValueList> | ||
6 | 8 | ||
7 | using namespace Opie::Core; | 9 | using namespace Opie::Core; |
8 | RecMail::RecMail() | 10 | RecMail::RecMail() |
9 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) | 11 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) |
10 | { | 12 | { |
11 | init(); | 13 | init(); |
12 | } | 14 | } |
13 | 15 | ||
14 | RecMail::RecMail(const RecMail&old) | 16 | RecMail::RecMail(const RecMail&old) |
15 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 17 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) |
16 | { | 18 | { |
17 | init(); | 19 | init(); |
18 | copy_old(old); | 20 | copy_old(old); |
19 | // odebug << "Copy constructor RecMail" << oendl; | 21 | // odebug << "Copy constructor RecMail" << oendl; |
20 | } | 22 | } |
21 | 23 | ||
22 | RecMail::~RecMail() | 24 | RecMail::~RecMail() |
23 | { | 25 | { |
24 | wrapper = 0; | 26 | wrapper = 0; |
25 | } | 27 | } |
26 | static bool stringCompareRec( const QString& s1, const QString& s2 ) | 28 | static bool stringCompareRec( const QString& s1, const QString& s2 ) |
27 | { | 29 | { |
28 | if ( s1.isEmpty() && s2.isEmpty() ) | 30 | if ( s1.isEmpty() && s2.isEmpty() ) |
29 | return true; | 31 | return true; |
30 | return s1 == s2; | 32 | return s1 == s2; |
31 | } | 33 | } |
32 | #if 0 | 34 | #if 0 |
33 | QString RecMail::MsgsizeString() const | 35 | QString RecMail::MsgsizeString() const |
34 | { | 36 | { |
35 | 37 | ||
36 | double s = msg_size; | 38 | double s = msg_size; |
37 | int w = 0; | 39 | int w = 0; |
@@ -254,111 +256,111 @@ const QString& RecPart::Description()const | |||
254 | } | 256 | } |
255 | 257 | ||
256 | void RecPart::setDescription(const QString&desc) | 258 | void RecPart::setDescription(const QString&desc) |
257 | { | 259 | { |
258 | m_description = desc; | 260 | m_description = desc; |
259 | } | 261 | } |
260 | 262 | ||
261 | void RecPart::setParameters(const part_plist_t&list) | 263 | void RecPart::setParameters(const part_plist_t&list) |
262 | { | 264 | { |
263 | m_Parameters = list; | 265 | m_Parameters = list; |
264 | } | 266 | } |
265 | 267 | ||
266 | const part_plist_t& RecPart::Parameters()const | 268 | const part_plist_t& RecPart::Parameters()const |
267 | { | 269 | { |
268 | return m_Parameters; | 270 | return m_Parameters; |
269 | } | 271 | } |
270 | 272 | ||
271 | void RecPart::addParameter(const QString&key,const QString&value) | 273 | void RecPart::addParameter(const QString&key,const QString&value) |
272 | { | 274 | { |
273 | m_Parameters[key]=value; | 275 | m_Parameters[key]=value; |
274 | } | 276 | } |
275 | 277 | ||
276 | const QString RecPart::searchParamter(const QString&key)const | 278 | const QString RecPart::searchParamter(const QString&key)const |
277 | { | 279 | { |
278 | QString value(""); | 280 | QString value(""); |
279 | part_plist_t::ConstIterator it = m_Parameters.find(key); | 281 | part_plist_t::ConstIterator it = m_Parameters.find(key); |
280 | if (it != m_Parameters.end()) { | 282 | if (it != m_Parameters.end()) { |
281 | value = it.data(); | 283 | value = it.data(); |
282 | } | 284 | } |
283 | return value; | 285 | return value; |
284 | } | 286 | } |
285 | 287 | ||
286 | void RecPart::setPositionlist(const QValueList<int>&poslist) | 288 | void RecPart::setPositionlist(const Q3ValueList<int>&poslist) |
287 | { | 289 | { |
288 | m_poslist = poslist; | 290 | m_poslist = poslist; |
289 | } | 291 | } |
290 | 292 | ||
291 | const QValueList<int>& RecPart::Positionlist()const | 293 | const Q3ValueList<int>& RecPart::Positionlist()const |
292 | { | 294 | { |
293 | return m_poslist; | 295 | return m_poslist; |
294 | } | 296 | } |
295 | 297 | ||
296 | RecBody::RecBody() | 298 | RecBody::RecBody() |
297 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) | 299 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) |
298 | { | 300 | { |
299 | m_PartsList.clear(); | 301 | m_PartsList.clear(); |
300 | } | 302 | } |
301 | 303 | ||
302 | RecBody::RecBody(const RecBody&old) | 304 | RecBody::RecBody(const RecBody&old) |
303 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) | 305 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) |
304 | { | 306 | { |
305 | m_BodyText = old.m_BodyText; | 307 | m_BodyText = old.m_BodyText; |
306 | m_PartsList = old.m_PartsList; | 308 | m_PartsList = old.m_PartsList; |
307 | m_description = old.m_description; | 309 | m_description = old.m_description; |
308 | mCharset = old.mCharset; | 310 | mCharset = old.mCharset; |
309 | // odebug << "Recbody copy constructor" << oendl; | 311 | // odebug << "Recbody copy constructor" << oendl; |
310 | } | 312 | } |
311 | 313 | ||
312 | RecBody::~RecBody() | 314 | RecBody::~RecBody() |
313 | { | 315 | { |
314 | } | 316 | } |
315 | 317 | ||
316 | void RecBody::setBodytext(const QString&bodyText) | 318 | void RecBody::setBodytext(const QString&bodyText) |
317 | { | 319 | { |
318 | m_BodyText = bodyText; | 320 | m_BodyText = bodyText; |
319 | } | 321 | } |
320 | 322 | ||
321 | const QString& RecBody::Bodytext()const | 323 | const QString& RecBody::Bodytext()const |
322 | { | 324 | { |
323 | return m_BodyText; | 325 | return m_BodyText; |
324 | } | 326 | } |
325 | 327 | ||
326 | void RecBody::setParts(const QValueList<RecPartP>&parts) | 328 | void RecBody::setParts(const Q3ValueList<RecPartP>&parts) |
327 | { | 329 | { |
328 | m_PartsList.clear(); | 330 | m_PartsList.clear(); |
329 | m_PartsList = parts; | 331 | m_PartsList = parts; |
330 | } | 332 | } |
331 | 333 | ||
332 | const QValueList<RecPartP>& RecBody::Parts()const | 334 | const Q3ValueList<RecPartP>& RecBody::Parts()const |
333 | { | 335 | { |
334 | return m_PartsList; | 336 | return m_PartsList; |
335 | } | 337 | } |
336 | 338 | ||
337 | void RecBody::addPart(const RecPartP& part) | 339 | void RecBody::addPart(const RecPartP& part) |
338 | { | 340 | { |
339 | m_PartsList.append(part); | 341 | m_PartsList.append(part); |
340 | } | 342 | } |
341 | 343 | ||
342 | void RecBody::setDescription(const RecPartP&des) | 344 | void RecBody::setDescription(const RecPartP&des) |
343 | { | 345 | { |
344 | m_description = des; | 346 | m_description = des; |
345 | } | 347 | } |
346 | 348 | ||
347 | const RecPartP& RecBody::Description()const | 349 | const RecPartP& RecBody::Description()const |
348 | { | 350 | { |
349 | return m_description; | 351 | return m_description; |
350 | } | 352 | } |
351 | 353 | ||
352 | void RecBody::setCharset(const QString& str) | 354 | void RecBody::setCharset(const QString& str) |
353 | { | 355 | { |
354 | mCharset = str; | 356 | mCharset = str; |
355 | } | 357 | } |
356 | 358 | ||
357 | QString RecBody::getCharset()const | 359 | QString RecBody::getCharset()const |
358 | { | 360 | { |
359 | return mCharset; | 361 | return mCharset; |
360 | } | 362 | } |
361 | 363 | ||
362 | /* handling encoded content */ | 364 | /* handling encoded content */ |
363 | encodedString::encodedString() | 365 | encodedString::encodedString() |
364 | { | 366 | { |
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h index 97f10d7..ac7f8da 100644 --- a/kmicromail/libmailwrapper/mailtypes.h +++ b/kmicromail/libmailwrapper/mailtypes.h | |||
@@ -1,49 +1,49 @@ | |||
1 | #ifndef __MAIL_TYPES_H | 1 | #ifndef __MAIL_TYPES_H |
2 | #define __MAIL_TYPES_H | 2 | #define __MAIL_TYPES_H |
3 | 3 | ||
4 | #define FLAG_ANSWERED 0 | 4 | #define FLAG_ANSWERED 0 |
5 | #define FLAG_FLAGGED 1 | 5 | #define FLAG_FLAGGED 1 |
6 | #define FLAG_DELETED 2 | 6 | #define FLAG_DELETED 2 |
7 | #define FLAG_SEEN 3 | 7 | #define FLAG_SEEN 3 |
8 | #define FLAG_DRAFT 4 | 8 | #define FLAG_DRAFT 4 |
9 | #define FLAG_RECENT 5 | 9 | #define FLAG_RECENT 5 |
10 | 10 | ||
11 | #include <opie2/osmartpointer.h> | 11 | #include <opie2/osmartpointer.h> |
12 | 12 | ||
13 | #include <qbitarray.h> | 13 | #include <qbitarray.h> |
14 | #include <qstring.h> | 14 | #include <qstring.h> |
15 | #include <qstringlist.h> | 15 | #include <qstringlist.h> |
16 | #include <qmap.h> | 16 | #include <qmap.h> |
17 | #include <qvaluelist.h> | 17 | #include <q3valuelist.h> |
18 | 18 | ||
19 | class AbstractMail; | 19 | class AbstractMail; |
20 | /* a class to describe mails in a mailbox */ | 20 | /* a class to describe mails in a mailbox */ |
21 | /* Attention! | 21 | /* Attention! |
22 | From programmers point of view it would make sense to | 22 | From programmers point of view it would make sense to |
23 | store the mail body into this class, too. | 23 | store the mail body into this class, too. |
24 | But: not from the point of view of the device. | 24 | But: not from the point of view of the device. |
25 | Mailbodies can be real large. So we request them when | 25 | Mailbodies can be real large. So we request them when |
26 | needed from the mail-wrapper class direct from the server itself | 26 | needed from the mail-wrapper class direct from the server itself |
27 | (imap) or from a file-based cache (pop3?) | 27 | (imap) or from a file-based cache (pop3?) |
28 | So there is no interface "const QString&body()" but you should | 28 | So there is no interface "const QString&body()" but you should |
29 | make a request to the mailwrapper with this class as parameter to | 29 | make a request to the mailwrapper with this class as parameter to |
30 | get the body. Same words for the attachments. | 30 | get the body. Same words for the attachments. |
31 | */ | 31 | */ |
32 | class RecMail:public Opie::Core::ORefCount | 32 | class RecMail:public Opie::Core::ORefCount |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | RecMail(); | 35 | RecMail(); |
36 | RecMail(const RecMail&old); | 36 | RecMail(const RecMail&old); |
37 | virtual ~RecMail(); | 37 | virtual ~RecMail(); |
38 | bool isEqual( RecMail* r1 ); | 38 | bool isEqual( RecMail* r1 ); |
39 | 39 | ||
40 | const unsigned int getNumber()const{return msg_number;} | 40 | const unsigned int getNumber()const{return msg_number;} |
41 | void setNumber(unsigned int number){msg_number=number;} | 41 | void setNumber(unsigned int number){msg_number=number;} |
42 | const QString&getDate()const{ return date; } | 42 | const QString&getDate()const{ return date; } |
43 | void setDate( const QString&a ) { date = a; } | 43 | void setDate( const QString&a ) { date = a; } |
44 | const QString&getIsoDate()const{ return isodate; } | 44 | const QString&getIsoDate()const{ return isodate; } |
45 | void setIsoDate( const QString&a ) { isodate = a; } | 45 | void setIsoDate( const QString&a ) { isodate = a; } |
46 | const QString&getFrom()const{ return from; } | 46 | const QString&getFrom()const{ return from; } |
47 | void setFrom( const QString&a ) { from = a; } | 47 | void setFrom( const QString&a ) { from = a; } |
48 | const QString&getSubject()const { return subject; } | 48 | const QString&getSubject()const { return subject; } |
49 | void setSubject( const QString&s ) { subject = s; } | 49 | void setSubject( const QString&s ) { subject = s; } |
@@ -80,119 +80,119 @@ public: | |||
80 | const QStringList&Inreply()const; | 80 | const QStringList&Inreply()const; |
81 | void setReferences(const QStringList&list); | 81 | void setReferences(const QStringList&list); |
82 | const QStringList&References()const; | 82 | const QStringList&References()const; |
83 | 83 | ||
84 | const QBitArray&getFlags()const{return msg_flags;} | 84 | const QBitArray&getFlags()const{return msg_flags;} |
85 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 85 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
86 | 86 | ||
87 | void setWrapper(AbstractMail*wrapper); | 87 | void setWrapper(AbstractMail*wrapper); |
88 | AbstractMail* Wrapper(); | 88 | AbstractMail* Wrapper(); |
89 | // public for debugging | 89 | // public for debugging |
90 | QString subject,date,isodate,from,mbox,msg_id,replyto; | 90 | QString subject,date,isodate,from,mbox,msg_id,replyto; |
91 | 91 | ||
92 | protected: | 92 | protected: |
93 | //QString subject,date,isodate,from,mbox,msg_id,replyto; | 93 | //QString subject,date,isodate,from,mbox,msg_id,replyto; |
94 | unsigned int msg_number,msg_size; | 94 | unsigned int msg_number,msg_size; |
95 | QBitArray msg_flags; | 95 | QBitArray msg_flags; |
96 | QStringList to,cc,bcc,in_reply_to,references; | 96 | QStringList to,cc,bcc,in_reply_to,references; |
97 | AbstractMail*wrapper; | 97 | AbstractMail*wrapper; |
98 | void init(); | 98 | void init(); |
99 | void copy_old(const RecMail&old); | 99 | void copy_old(const RecMail&old); |
100 | }; | 100 | }; |
101 | 101 | ||
102 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; | 102 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; |
103 | typedef QMap<QString,QString> part_plist_t; | 103 | typedef QMap<QString,QString> part_plist_t; |
104 | 104 | ||
105 | class RecPart:public Opie::Core::ORefCount | 105 | class RecPart:public Opie::Core::ORefCount |
106 | { | 106 | { |
107 | protected: | 107 | protected: |
108 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; | 108 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; |
109 | unsigned int m_lines,m_size; | 109 | unsigned int m_lines,m_size; |
110 | part_plist_t m_Parameters; | 110 | part_plist_t m_Parameters; |
111 | /* describes the position in the mail */ | 111 | /* describes the position in the mail */ |
112 | QValueList<int> m_poslist; | 112 | Q3ValueList<int> m_poslist; |
113 | 113 | ||
114 | public: | 114 | public: |
115 | RecPart(); | 115 | RecPart(); |
116 | RecPart(const RecPart&); | 116 | RecPart(const RecPart&); |
117 | virtual ~RecPart(); | 117 | virtual ~RecPart(); |
118 | 118 | ||
119 | const QString&Type()const; | 119 | const QString&Type()const; |
120 | void setType(const QString&type); | 120 | void setType(const QString&type); |
121 | const QString&Subtype()const; | 121 | const QString&Subtype()const; |
122 | void setSubtype(const QString&subtype); | 122 | void setSubtype(const QString&subtype); |
123 | const QString&Identifier()const; | 123 | const QString&Identifier()const; |
124 | void setIdentifier(const QString&identifier); | 124 | void setIdentifier(const QString&identifier); |
125 | const QString&Encoding()const; | 125 | const QString&Encoding()const; |
126 | void setEncoding(const QString&encoding); | 126 | void setEncoding(const QString&encoding); |
127 | const QString&Description()const; | 127 | const QString&Description()const; |
128 | void setDescription(const QString&desc); | 128 | void setDescription(const QString&desc); |
129 | void setLines(unsigned int lines); | 129 | void setLines(unsigned int lines); |
130 | const unsigned int Lines()const; | 130 | const unsigned int Lines()const; |
131 | void setSize(unsigned int size); | 131 | void setSize(unsigned int size); |
132 | const unsigned int Size()const; | 132 | const unsigned int Size()const; |
133 | 133 | ||
134 | 134 | ||
135 | void setParameters(const part_plist_t&list); | 135 | void setParameters(const part_plist_t&list); |
136 | const part_plist_t&Parameters()const; | 136 | const part_plist_t&Parameters()const; |
137 | void addParameter(const QString&key,const QString&value); | 137 | void addParameter(const QString&key,const QString&value); |
138 | const QString searchParamter(const QString&key)const; | 138 | const QString searchParamter(const QString&key)const; |
139 | void setPositionlist(const QValueList<int>&poslist); | 139 | void setPositionlist(const Q3ValueList<int>&poslist); |
140 | const QValueList<int>& Positionlist()const; | 140 | const Q3ValueList<int>& Positionlist()const; |
141 | }; | 141 | }; |
142 | 142 | ||
143 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; | 143 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; |
144 | 144 | ||
145 | class RecBody:public Opie::Core::ORefCount | 145 | class RecBody:public Opie::Core::ORefCount |
146 | { | 146 | { |
147 | protected: | 147 | protected: |
148 | QString m_BodyText; | 148 | QString m_BodyText; |
149 | QString mCharset; | 149 | QString mCharset; |
150 | QValueList<RecPartP> m_PartsList; | 150 | Q3ValueList<RecPartP> m_PartsList; |
151 | RecPartP m_description; | 151 | RecPartP m_description; |
152 | 152 | ||
153 | public: | 153 | public: |
154 | RecBody(); | 154 | RecBody(); |
155 | RecBody(const RecBody&old); | 155 | RecBody(const RecBody&old); |
156 | virtual ~RecBody(); | 156 | virtual ~RecBody(); |
157 | void setBodytext(const QString&); | 157 | void setBodytext(const QString&); |
158 | const QString& Bodytext()const; | 158 | const QString& Bodytext()const; |
159 | void setCharset(const QString&); | 159 | void setCharset(const QString&); |
160 | QString getCharset()const; | 160 | QString getCharset()const; |
161 | 161 | ||
162 | void setDescription(const RecPartP&des); | 162 | void setDescription(const RecPartP&des); |
163 | const RecPartP& Description()const; | 163 | const RecPartP& Description()const; |
164 | 164 | ||
165 | void setParts(const QValueList<RecPartP>&parts); | 165 | void setParts(const Q3ValueList<RecPartP>&parts); |
166 | const QValueList<RecPartP>& Parts()const; | 166 | const Q3ValueList<RecPartP>& Parts()const; |
167 | void addPart(const RecPartP&part); | 167 | void addPart(const RecPartP&part); |
168 | }; | 168 | }; |
169 | 169 | ||
170 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; | 170 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; |
171 | 171 | ||
172 | class encodedString | 172 | class encodedString |
173 | { | 173 | { |
174 | public: | 174 | public: |
175 | encodedString(); | 175 | encodedString(); |
176 | /* | 176 | /* |
177 | creates an new content string. | 177 | creates an new content string. |
178 | it makes a deep copy of it! | 178 | it makes a deep copy of it! |
179 | */ | 179 | */ |
180 | encodedString(const char*nContent,unsigned int length); | 180 | encodedString(const char*nContent,unsigned int length); |
181 | /* | 181 | /* |
182 | Take over the nContent. Means: it will just copy the pointer, not the content. | 182 | Take over the nContent. Means: it will just copy the pointer, not the content. |
183 | so make sure: No one else frees the string, the string has allocated with | 183 | so make sure: No one else frees the string, the string has allocated with |
184 | malloc for compatibility with c-based libs | 184 | malloc for compatibility with c-based libs |
185 | */ | 185 | */ |
186 | encodedString(char*nContent,unsigned int nSize); | 186 | encodedString(char*nContent,unsigned int nSize); |
187 | /* copy construkor - makes ALWAYS a deep copy!!!! */ | 187 | /* copy construkor - makes ALWAYS a deep copy!!!! */ |
188 | encodedString(const encodedString&old); | 188 | encodedString(const encodedString&old); |
189 | /* assign operator - makes ALWAYS a deep copy!!!! */ | 189 | /* assign operator - makes ALWAYS a deep copy!!!! */ |
190 | encodedString& operator=(const encodedString&old); | 190 | encodedString& operator=(const encodedString&old); |
191 | /* destructor - cleans the content */ | 191 | /* destructor - cleans the content */ |
192 | virtual ~encodedString(); | 192 | virtual ~encodedString(); |
193 | 193 | ||
194 | /* returns a pointer to the content - do not delete yoursel! */ | 194 | /* returns a pointer to the content - do not delete yoursel! */ |
195 | const char*Content()const; | 195 | const char*Content()const; |
196 | /* returns the lengths of the content 'cause it must not be a null-terminated string! */ | 196 | /* returns the lengths of the content 'cause it must not be a null-terminated string! */ |
197 | const int Length()const; | 197 | const int Length()const; |
198 | 198 | ||
diff --git a/kmicromail/libmailwrapper/mailwrapper.cpp b/kmicromail/libmailwrapper/mailwrapper.cpp index 2ee1ab3..9c299e8 100644 --- a/kmicromail/libmailwrapper/mailwrapper.cpp +++ b/kmicromail/libmailwrapper/mailwrapper.cpp | |||
@@ -1,39 +1,41 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <sys/stat.h> | 2 | #include <sys/stat.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | //Added by qt3to4: | ||
9 | #include <Q3CString> | ||
8 | 10 | ||
9 | #include "mailwrapper.h" | 11 | #include "mailwrapper.h" |
10 | //#include "logindialog.h" | 12 | //#include "logindialog.h" |
11 | //#include "defines.h" | 13 | //#include "defines.h" |
12 | 14 | ||
13 | #define UNDEFINED 64 | 15 | #define UNDEFINED 64 |
14 | #define MAXLINE 76 | 16 | #define MAXLINE 76 |
15 | #define UTF16MASK 0x03FFUL | 17 | #define UTF16MASK 0x03FFUL |
16 | #define UTF16SHIFT 10 | 18 | #define UTF16SHIFT 10 |
17 | #define UTF16BASE 0x10000UL | 19 | #define UTF16BASE 0x10000UL |
18 | #define UTF16HIGHSTART 0xD800UL | 20 | #define UTF16HIGHSTART 0xD800UL |
19 | #define UTF16HIGHEND 0xDBFFUL | 21 | #define UTF16HIGHEND 0xDBFFUL |
20 | #define UTF16LOSTART 0xDC00UL | 22 | #define UTF16LOSTART 0xDC00UL |
21 | #define UTF16LOEND 0xDFFFUL | 23 | #define UTF16LOEND 0xDFFFUL |
22 | 24 | ||
23 | 25 | ||
24 | using namespace Opie::Core; | 26 | using namespace Opie::Core; |
25 | Attachment::Attachment( QString lnk ) | 27 | Attachment::Attachment( QString lnk ) |
26 | { | 28 | { |
27 | doc = lnk; | 29 | doc = lnk; |
28 | size = QFileInfo( doc ).size(); | 30 | size = QFileInfo( doc ).size(); |
29 | mPix = SmallIcon( "files" ); | 31 | mPix = SmallIcon( "files" ); |
30 | } | 32 | } |
31 | 33 | ||
32 | Folder::Folder(const QString&tmp_name, const QString&sep ) | 34 | Folder::Folder(const QString&tmp_name, const QString&sep ) |
33 | { | 35 | { |
34 | name = tmp_name; | 36 | name = tmp_name; |
35 | nameDisplay = name; | 37 | nameDisplay = name; |
36 | separator = sep; | 38 | separator = sep; |
37 | prefix = ""; | 39 | prefix = ""; |
38 | } | 40 | } |
39 | 41 | ||
@@ -52,130 +54,130 @@ IMAPFolder::IMAPFolder(const QString&t_name,const QString&sep, bool select,bool | |||
52 | // Decode IMAP foldername | 54 | // Decode IMAP foldername |
53 | nameDisplay = IMAPFolder::decodeFolderName( t_name ); | 55 | nameDisplay = IMAPFolder::decodeFolderName( t_name ); |
54 | name = nameDisplay ; | 56 | name = nameDisplay ; |
55 | /* | 57 | /* |
56 | odebug << "folder " + name + " - displayed as " + nameDisplay << oendl; | 58 | odebug << "folder " + name + " - displayed as " + nameDisplay << oendl; |
57 | */ | 59 | */ |
58 | prefix = aprefix; | 60 | prefix = aprefix; |
59 | 61 | ||
60 | if (prefix.length()>0) { | 62 | if (prefix.length()>0) { |
61 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { | 63 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { |
62 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); | 64 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); |
63 | } | 65 | } |
64 | } | 66 | } |
65 | } | 67 | } |
66 | 68 | ||
67 | IMAPFolder::~IMAPFolder() | 69 | IMAPFolder::~IMAPFolder() |
68 | { | 70 | { |
69 | } | 71 | } |
70 | 72 | ||
71 | static unsigned char base64chars[] = | 73 | static unsigned char base64chars[] = |
72 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; | 74 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; |
73 | 75 | ||
74 | /** | 76 | /** |
75 | * Decodes base64 encoded parts of the imapfolder name | 77 | * Decodes base64 encoded parts of the imapfolder name |
76 | * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc | 78 | * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc |
77 | */ | 79 | */ |
78 | QString IMAPFolder::decodeFolderName( const QString &name ) | 80 | QString IMAPFolder::decodeFolderName( const QString &name ) |
79 | { | 81 | { |
80 | unsigned char c, i, bitcount; | 82 | unsigned char c, i, bitcount; |
81 | unsigned long ucs4, utf16, bitbuf; | 83 | unsigned long ucs4, utf16, bitbuf; |
82 | unsigned char base64[256], utf8[6]; | 84 | unsigned char base64[256], utf8[6]; |
83 | unsigned long srcPtr = 0; | 85 | unsigned long srcPtr = 0; |
84 | QCString dst = ""; | 86 | Q3CString dst = ""; |
85 | QCString src = name.ascii(); | 87 | Q3CString src = name.ascii(); |
86 | 88 | ||
87 | /* initialize modified base64 decoding table */ | 89 | /* initialize modified base64 decoding table */ |
88 | memset(base64, UNDEFINED, sizeof(base64)); | 90 | memset(base64, UNDEFINED, sizeof(base64)); |
89 | for (i = 0; i < sizeof(base64chars); ++i) { | 91 | for (i = 0; i < sizeof(base64chars); ++i) { |
90 | base64[(int)base64chars[i]] = i; | 92 | base64[(int)base64chars[i]] = i; |
91 | } | 93 | } |
92 | 94 | ||
93 | /* loop until end of string */ | 95 | /* loop until end of string */ |
94 | while (srcPtr < src.length ()) { | 96 | while (srcPtr < src.length ()) { |
95 | c = src[srcPtr++]; | 97 | c = src.at(srcPtr++); |
96 | /* deal with literal characters and &- */ | 98 | /* deal with literal characters and &- */ |
97 | if (c != '&' || src[srcPtr] == '-') { | 99 | if (c != '&' || src.at(srcPtr) == '-') { |
98 | /* encode literally */ | 100 | /* encode literally */ |
99 | dst += c; | 101 | dst += c; |
100 | /* skip over the '-' if this is an &- sequence */ | 102 | /* skip over the '-' if this is an &- sequence */ |
101 | if (c == '&') | 103 | if (c == '&') |
102 | srcPtr++; | 104 | srcPtr++; |
103 | } else { | 105 | } else { |
104 | /* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */ | 106 | /* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */ |
105 | bitbuf = 0; | 107 | bitbuf = 0; |
106 | bitcount = 0; | 108 | bitcount = 0; |
107 | ucs4 = 0; | 109 | ucs4 = 0; |
108 | while ((c = base64[(unsigned char) src[srcPtr]]) != UNDEFINED) { | 110 | while ((c = base64[(unsigned char) src.at(srcPtr)]) != UNDEFINED) { |
109 | ++srcPtr; | 111 | ++srcPtr; |
110 | bitbuf = (bitbuf << 6) | c; | 112 | bitbuf = (bitbuf << 6) | c; |
111 | bitcount += 6; | 113 | bitcount += 6; |
112 | /* enough bits for a UTF-16 character? */ | 114 | /* enough bits for a UTF-16 character? */ |
113 | if (bitcount >= 16) { | 115 | if (bitcount >= 16) { |
114 | bitcount -= 16; | 116 | bitcount -= 16; |
115 | utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff; | 117 | utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff; |
116 | /* convert UTF16 to UCS4 */ | 118 | /* convert UTF16 to UCS4 */ |
117 | if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) { | 119 | if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) { |
118 | ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT; | 120 | ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT; |
119 | continue; | 121 | continue; |
120 | } else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) { | 122 | } else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) { |
121 | ucs4 += utf16 - UTF16LOSTART + UTF16BASE; | 123 | ucs4 += utf16 - UTF16LOSTART + UTF16BASE; |
122 | } else { | 124 | } else { |
123 | ucs4 = utf16; | 125 | ucs4 = utf16; |
124 | } | 126 | } |
125 | /* convert UTF-16 range of UCS4 to UTF-8 */ | 127 | /* convert UTF-16 range of UCS4 to UTF-8 */ |
126 | if (ucs4 <= 0x7fUL) { | 128 | if (ucs4 <= 0x7fUL) { |
127 | utf8[0] = ucs4; | 129 | utf8[0] = ucs4; |
128 | i = 1; | 130 | i = 1; |
129 | } else if (ucs4 <= 0x7ffUL) { | 131 | } else if (ucs4 <= 0x7ffUL) { |
130 | utf8[0] = 0xc0 | (ucs4 >> 6); | 132 | utf8[0] = 0xc0 | (ucs4 >> 6); |
131 | utf8[1] = 0x80 | (ucs4 & 0x3f); | 133 | utf8[1] = 0x80 | (ucs4 & 0x3f); |
132 | i = 2; | 134 | i = 2; |
133 | } else if (ucs4 <= 0xffffUL) { | 135 | } else if (ucs4 <= 0xffffUL) { |
134 | utf8[0] = 0xe0 | (ucs4 >> 12); | 136 | utf8[0] = 0xe0 | (ucs4 >> 12); |
135 | utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f); | 137 | utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f); |
136 | utf8[2] = 0x80 | (ucs4 & 0x3f); | 138 | utf8[2] = 0x80 | (ucs4 & 0x3f); |
137 | i = 3; | 139 | i = 3; |
138 | } else { | 140 | } else { |
139 | utf8[0] = 0xf0 | (ucs4 >> 18); | 141 | utf8[0] = 0xf0 | (ucs4 >> 18); |
140 | utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f); | 142 | utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f); |
141 | utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f); | 143 | utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f); |
142 | utf8[3] = 0x80 | (ucs4 & 0x3f); | 144 | utf8[3] = 0x80 | (ucs4 & 0x3f); |
143 | i = 4; | 145 | i = 4; |
144 | } | 146 | } |
145 | /* copy it */ | 147 | /* copy it */ |
146 | for (c = 0; c < i; ++c) { | 148 | for (c = 0; c < i; ++c) { |
147 | dst += utf8[c]; | 149 | dst += utf8[c]; |
148 | } | 150 | } |
149 | } | 151 | } |
150 | } | 152 | } |
151 | /* skip over trailing '-' in modified UTF-7 encoding */ | 153 | /* skip over trailing '-' in modified UTF-7 encoding */ |
152 | if (src[srcPtr] == '-') | 154 | if (src.at(srcPtr) == '-') |
153 | ++srcPtr; | 155 | ++srcPtr; |
154 | } | 156 | } |
155 | } | 157 | } |
156 | 158 | ||
157 | return QString::fromUtf8( dst.data() ); | 159 | return QString::fromUtf8( dst.data() ); |
158 | } | 160 | } |
159 | 161 | ||
160 | Mail::Mail() | 162 | Mail::Mail() |
161 | :Opie::Core::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") | 163 | :Opie::Core::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") |
162 | { | 164 | { |
163 | } | 165 | } |
164 | 166 | ||
165 | MHFolder::MHFolder(const QString&disp_name,const QString&mbox) | 167 | MHFolder::MHFolder(const QString&disp_name,const QString&mbox) |
166 | : Folder( disp_name,"/" ) | 168 | : Folder( disp_name,"/" ) |
167 | { | 169 | { |
168 | separator = "/"; | 170 | separator = "/"; |
169 | name = mbox; | 171 | name = mbox; |
170 | if (!disp_name.startsWith("/") && disp_name.length()>0) | 172 | if (!disp_name.startsWith("/") && disp_name.length()>0) |
171 | name+="/"; | 173 | name+="/"; |
172 | name+=disp_name; | 174 | name+=disp_name; |
173 | if (disp_name.length()==0) { | 175 | if (disp_name.length()==0) { |
174 | nameDisplay = separator; | 176 | nameDisplay = separator; |
175 | } | 177 | } |
176 | prefix = mbox; | 178 | prefix = mbox; |
177 | } | 179 | } |
178 | 180 | ||
179 | MHFolder::~MHFolder() | 181 | MHFolder::~MHFolder() |
180 | { | 182 | { |
181 | } | 183 | } |
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h index 3e8b51f..bebabf4 100644 --- a/kmicromail/libmailwrapper/mailwrapper.h +++ b/kmicromail/libmailwrapper/mailwrapper.h | |||
@@ -1,121 +1,123 @@ | |||
1 | #ifndef MAILWRAPPER_H | 1 | #ifndef MAILWRAPPER_H |
2 | #define MAILWRAPPER_H | 2 | #define MAILWRAPPER_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 <qfileinfo.h> | 8 | #include <qfileinfo.h> |
9 | //Added by qt3to4: | ||
10 | #include <QPixmap> | ||
9 | #include <kiconloader.h> | 11 | #include <kiconloader.h> |
10 | 12 | ||
11 | #include "settings.h" | 13 | #include "settings.h" |
12 | 14 | ||
13 | #include <opie2/osmartpointer.h> | 15 | #include <opie2/osmartpointer.h> |
14 | /* | 16 | /* |
15 | class Attachment | 17 | class Attachment |
16 | { | 18 | { |
17 | public: | 19 | public: |
18 | Attachment( DocLnk lnk ); | 20 | Attachment( DocLnk lnk ); |
19 | virtual ~Attachment(){} | 21 | virtual ~Attachment(){} |
20 | const QString getFileName()const{ return doc.file(); } | 22 | const QString getFileName()const{ return doc.file(); } |
21 | const QString getName()const{ return doc.name(); } | 23 | const QString getName()const{ return doc.name(); } |
22 | const QString getMimeType()const{ return doc.type(); } | 24 | const QString getMimeType()const{ return doc.type(); } |
23 | const QPixmap getPixmap()const{ return doc.pixmap(); } | 25 | const QPixmap getPixmap()const{ return doc.pixmap(); } |
24 | const int getSize()const { return size; } | 26 | const int getSize()const { return size; } |
25 | DocLnk getDocLnk() { return doc; } | 27 | DocLnk getDocLnk() { return doc; } |
26 | 28 | ||
27 | protected: | 29 | protected: |
28 | DocLnk doc; | 30 | DocLnk doc; |
29 | int size; | 31 | int size; |
30 | 32 | ||
31 | }; | 33 | }; |
32 | */ | 34 | */ |
33 | 35 | ||
34 | class Attachment | 36 | class Attachment |
35 | { | 37 | { |
36 | public: | 38 | public: |
37 | Attachment( QString lnk ); | 39 | Attachment( QString lnk ); |
38 | virtual ~Attachment(){} | 40 | virtual ~Attachment(){} |
39 | const QString getFileName()const{ return doc; } | 41 | const QString getFileName()const{ return doc; } |
40 | const QString getName()const{ return QFileInfo( doc ).baseName (); } | 42 | const QString getName()const{ return QFileInfo( doc ).baseName (); } |
41 | const QString getMimeType()const{ return QFileInfo( doc ).extension(false); } | 43 | const QString getMimeType()const{ return QFileInfo( doc ).extension(false); } |
42 | const QPixmap getPixmap()const{ return mPix; } | 44 | const QPixmap getPixmap()const{ return mPix; } |
43 | const int getSize()const { return size; } | 45 | const int getSize()const { return size; } |
44 | QString getDocLnk() { return doc; } | 46 | QString getDocLnk() { return doc; } |
45 | 47 | ||
46 | protected: | 48 | protected: |
47 | QPixmap mPix; | 49 | QPixmap mPix; |
48 | QString doc; | 50 | QString doc; |
49 | int size; | 51 | int size; |
50 | 52 | ||
51 | }; | 53 | }; |
52 | 54 | ||
53 | class Mail:public Opie::Core::ORefCount | 55 | class Mail:public Opie::Core::ORefCount |
54 | { | 56 | { |
55 | public: | 57 | public: |
56 | Mail(); | 58 | Mail(); |
57 | /* Possible that this destructor must not be declared virtual | 59 | /* Possible that this destructor must not be declared virtual |
58 | * 'cause it seems that it will never have some child classes. | 60 | * 'cause it seems that it will never have some child classes. |
59 | * in this case this object will not get a virtual table -> memory and | 61 | * in this case this object will not get a virtual table -> memory and |
60 | * speed will be a little bit better? | 62 | * speed will be a little bit better? |
61 | */ | 63 | */ |
62 | virtual ~Mail(){} | 64 | virtual ~Mail(){} |
63 | void addAttachment( Attachment *att ) { attList.append( att ); } | 65 | void addAttachment( Attachment *att ) { attList.append( att ); } |
64 | const QList<Attachment>& getAttachments()const { return attList; } | 66 | const QList<Attachment*>& getAttachments()const { return attList; } |
65 | void removeAttachment( Attachment *att ) { attList.remove( att ); } | 67 | void removeAttachment( Attachment *att ) { attList.remove( att ); } |
66 | const QString&getName()const { return name; } | 68 | const QString&getName()const { return name; } |
67 | void setName( QString s ) { name = s; } | 69 | void setName( QString s ) { name = s; } |
68 | const QString&getMail()const{ return mail; } | 70 | const QString&getMail()const{ return mail; } |
69 | void setMail( const QString&s ) { mail = s; } | 71 | void setMail( const QString&s ) { mail = s; } |
70 | const QString&getTo()const{ return to; } | 72 | const QString&getTo()const{ return to; } |
71 | void setTo( const QString&s ) { to = s; } | 73 | void setTo( const QString&s ) { to = s; } |
72 | const QString&getCC()const{ return cc; } | 74 | const QString&getCC()const{ return cc; } |
73 | void setCC( const QString&s ) { cc = s; } | 75 | void setCC( const QString&s ) { cc = s; } |
74 | const QString&getBCC()const { return bcc; } | 76 | const QString&getBCC()const { return bcc; } |
75 | void setBCC( const QString&s ) { bcc = s; } | 77 | void setBCC( const QString&s ) { bcc = s; } |
76 | const QString&getMessage()const { return message; } | 78 | const QString&getMessage()const { return message; } |
77 | void setMessage( const QString&s ) { message = s; } | 79 | void setMessage( const QString&s ) { message = s; } |
78 | const QString&getSubject()const { return subject; } | 80 | const QString&getSubject()const { return subject; } |
79 | void setSubject( const QString&s ) { subject = s; } | 81 | void setSubject( const QString&s ) { subject = s; } |
80 | const QString&getReply()const{ return reply; } | 82 | const QString&getReply()const{ return reply; } |
81 | void setReply( const QString&a ) { reply = a; } | 83 | void setReply( const QString&a ) { reply = a; } |
82 | void setInreply(const QStringList&list){m_in_reply_to = list;} | 84 | void setInreply(const QStringList&list){m_in_reply_to = list;} |
83 | const QStringList&Inreply()const{return m_in_reply_to;} | 85 | const QStringList&Inreply()const{return m_in_reply_to;} |
84 | 86 | ||
85 | void setCharset( const QString&a ) { charset= a; } | 87 | void setCharset( const QString&a ) { charset= a; } |
86 | const QString& getCharset() const { return charset; } | 88 | const QString& getCharset() const { return charset; } |
87 | 89 | ||
88 | private: | 90 | private: |
89 | QList<Attachment> attList; | 91 | QList<Attachment*> attList; |
90 | QString name, mail, to, cc, bcc, reply, subject, message, charset; | 92 | QString name, mail, to, cc, bcc, reply, subject, message, charset; |
91 | QStringList m_in_reply_to; | 93 | QStringList m_in_reply_to; |
92 | }; | 94 | }; |
93 | 95 | ||
94 | class Folder:public Opie::Core::ORefCount | 96 | class Folder:public Opie::Core::ORefCount |
95 | { | 97 | { |
96 | public: | 98 | public: |
97 | Folder( const QString&init_name,const QString&sep ); | 99 | Folder( const QString&init_name,const QString&sep ); |
98 | virtual ~Folder(); | 100 | virtual ~Folder(); |
99 | const QString&getDisplayName()const { return nameDisplay; } | 101 | const QString&getDisplayName()const { return nameDisplay; } |
100 | const QString&getName()const { return name; } | 102 | const QString&getName()const { return name; } |
101 | const QString&getPrefix()const{return prefix; } | 103 | const QString&getPrefix()const{return prefix; } |
102 | virtual bool may_select()const{return true;} | 104 | virtual bool may_select()const{return true;} |
103 | virtual bool no_inferior()const{return true;} | 105 | virtual bool no_inferior()const{return true;} |
104 | const QString&Separator()const; | 106 | const QString&Separator()const; |
105 | 107 | ||
106 | protected: | 108 | protected: |
107 | QString nameDisplay, name, separator,prefix; | 109 | QString nameDisplay, name, separator,prefix; |
108 | }; | 110 | }; |
109 | 111 | ||
110 | typedef Opie::Core::OSmartPointer<Folder> FolderP; | 112 | typedef Opie::Core::OSmartPointer<Folder> FolderP; |
111 | 113 | ||
112 | class MHFolder : public Folder | 114 | class MHFolder : public Folder |
113 | { | 115 | { |
114 | public: | 116 | public: |
115 | MHFolder(const QString&disp_name,const QString&mbox); | 117 | MHFolder(const QString&disp_name,const QString&mbox); |
116 | virtual ~MHFolder(); | 118 | virtual ~MHFolder(); |
117 | }; | 119 | }; |
118 | 120 | ||
119 | class IMAPFolder : public Folder | 121 | class IMAPFolder : public Folder |
120 | { | 122 | { |
121 | public: | 123 | public: |
diff --git a/kmicromail/libmailwrapper/mboxwrapper.cpp b/kmicromail/libmailwrapper/mboxwrapper.cpp index 87f8c8a..888cae2 100644 --- a/kmicromail/libmailwrapper/mboxwrapper.cpp +++ b/kmicromail/libmailwrapper/mboxwrapper.cpp | |||
@@ -1,85 +1,87 @@ | |||
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 | //Added by qt3to4: | ||
7 | #include <Q3ValueList> | ||
6 | #include <stdlib.h> | 8 | #include <stdlib.h> |
7 | #include <klocale.h> | 9 | #include <klocale.h> |
8 | 10 | ||
9 | 11 | ||
10 | #include <qpe/global.h> | 12 | #include <qpe/global.h> |
11 | 13 | ||
12 | using namespace Opie::Core; | 14 | using namespace Opie::Core; |
13 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) | 15 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) |
14 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) | 16 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) |
15 | { | 17 | { |
16 | QDir dir(MBOXPath); | 18 | QDir dir(MBOXPath); |
17 | if (!dir.exists()) { | 19 | if (!dir.exists()) { |
18 | dir.mkdir(MBOXPath); | 20 | dir.mkdir(MBOXPath); |
19 | } | 21 | } |
20 | } | 22 | } |
21 | 23 | ||
22 | MBOXwrapper::~MBOXwrapper() | 24 | MBOXwrapper::~MBOXwrapper() |
23 | { | 25 | { |
24 | } | 26 | } |
25 | 27 | ||
26 | void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target ) | 28 | void MBOXwrapper::listMessages(const QString & mailbox, Q3ValueList<RecMailP> &target ) |
27 | { | 29 | { |
28 | mailstorage*storage = mailstorage_new(NULL); | 30 | mailstorage*storage = mailstorage_new(NULL); |
29 | QString p = MBOXPath+"/"; | 31 | QString p = MBOXPath+"/"; |
30 | p+=mailbox; | 32 | p+=mailbox; |
31 | 33 | ||
32 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 34 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
33 | mailfolder*folder; | 35 | mailfolder*folder; |
34 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 36 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
35 | r = mailfolder_connect(folder); | 37 | r = mailfolder_connect(folder); |
36 | if (r != MAIL_NO_ERROR) { | 38 | if (r != MAIL_NO_ERROR) { |
37 | //odebug << "Error initializing mbox" << oendl; | 39 | //odebug << "Error initializing mbox" << oendl; |
38 | mailfolder_free(folder); | 40 | mailfolder_free(folder); |
39 | mailstorage_free(storage); | 41 | mailstorage_free(storage); |
40 | return; | 42 | return; |
41 | } | 43 | } |
42 | 44 | ||
43 | parseList(target,folder->fld_session,mailbox); | 45 | parseList(target,folder->fld_session,mailbox); |
44 | 46 | ||
45 | mailfolder_disconnect(folder); | 47 | mailfolder_disconnect(folder); |
46 | mailfolder_free(folder); | 48 | mailfolder_free(folder); |
47 | mailstorage_free(storage); | 49 | mailstorage_free(storage); |
48 | Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count())); | 50 | Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count())); |
49 | } | 51 | } |
50 | 52 | ||
51 | QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders() | 53 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders() |
52 | { | 54 | { |
53 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); | 55 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<Opie::Core::OSmartPointer<Folder> >(); |
54 | QDir dir(MBOXPath); | 56 | QDir dir(MBOXPath); |
55 | if (!dir.exists()) return folders; | 57 | if (!dir.exists()) return folders; |
56 | dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable); | 58 | dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable); |
57 | QStringList entries = dir.entryList(); | 59 | QStringList entries = dir.entryList(); |
58 | QStringList::ConstIterator it = entries.begin(); | 60 | QStringList::ConstIterator it = entries.begin(); |
59 | for (;it!=entries.end();++it) { | 61 | for (;it!=entries.end();++it) { |
60 | FolderP inb=new Folder(*it,"/"); | 62 | FolderP inb=new Folder(*it,"/"); |
61 | folders->append(inb); | 63 | folders->append(inb); |
62 | } | 64 | } |
63 | return folders; | 65 | return folders; |
64 | } | 66 | } |
65 | 67 | ||
66 | void MBOXwrapper::deleteMail(const RecMailP & mail) | 68 | void MBOXwrapper::deleteMail(const RecMailP & mail) |
67 | { | 69 | { |
68 | mailstorage*storage = mailstorage_new(NULL); | 70 | mailstorage*storage = mailstorage_new(NULL); |
69 | QString p = MBOXPath+"/"; | 71 | QString p = MBOXPath+"/"; |
70 | p+=mail->getMbox(); | 72 | p+=mail->getMbox(); |
71 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 73 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
72 | mailfolder*folder; | 74 | mailfolder*folder; |
73 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 75 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
74 | r = mailfolder_connect(folder); | 76 | r = mailfolder_connect(folder); |
75 | if (r != MAIL_NO_ERROR) { | 77 | if (r != MAIL_NO_ERROR) { |
76 | ; // << "Error initializing mbox" << oendl; | 78 | ; // << "Error initializing mbox" << oendl; |
77 | mailfolder_free(folder); | 79 | mailfolder_free(folder); |
78 | mailstorage_free(storage); | 80 | mailstorage_free(storage); |
79 | return; | 81 | return; |
80 | } | 82 | } |
81 | r = mailsession_remove_message(folder->fld_session,mail->getNumber()); | 83 | r = mailsession_remove_message(folder->fld_session,mail->getNumber()); |
82 | if (r != MAIL_NO_ERROR) { | 84 | if (r != MAIL_NO_ERROR) { |
83 | ; // << "error deleting mail" << oendl; | 85 | ; // << "error deleting mail" << oendl; |
84 | } | 86 | } |
85 | mailfolder_free(folder); | 87 | mailfolder_free(folder); |
@@ -188,83 +190,83 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail) | |||
188 | mailfolder*folder; | 190 | mailfolder*folder; |
189 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 191 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
190 | r = mailfolder_connect(folder); | 192 | r = mailfolder_connect(folder); |
191 | if (r != MAIL_NO_ERROR) { | 193 | if (r != MAIL_NO_ERROR) { |
192 | Global::statusMessage(i18n("Error initializing mbox")); | 194 | Global::statusMessage(i18n("Error initializing mbox")); |
193 | mailfolder_free(folder); | 195 | mailfolder_free(folder); |
194 | mailstorage_free(storage); | 196 | mailstorage_free(storage); |
195 | return 0; | 197 | return 0; |
196 | } | 198 | } |
197 | r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg); | 199 | r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg); |
198 | if (r != MAIL_NO_ERROR) { | 200 | if (r != MAIL_NO_ERROR) { |
199 | Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); | 201 | Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); |
200 | mailfolder_free(folder); | 202 | mailfolder_free(folder); |
201 | mailstorage_free(storage); | 203 | mailstorage_free(storage); |
202 | return 0; | 204 | return 0; |
203 | } | 205 | } |
204 | r = mailmessage_fetch(msg,&data,&size); | 206 | r = mailmessage_fetch(msg,&data,&size); |
205 | if (r != MAIL_NO_ERROR) { | 207 | if (r != MAIL_NO_ERROR) { |
206 | Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); | 208 | Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); |
207 | mailfolder_free(folder); | 209 | mailfolder_free(folder); |
208 | mailstorage_free(storage); | 210 | mailstorage_free(storage); |
209 | mailmessage_free(msg); | 211 | mailmessage_free(msg); |
210 | return 0; | 212 | return 0; |
211 | } | 213 | } |
212 | encodedString*result = new encodedString(data,size); | 214 | encodedString*result = new encodedString(data,size); |
213 | 215 | ||
214 | mailfolder_free(folder); | 216 | mailfolder_free(folder); |
215 | mailstorage_free(storage); | 217 | mailstorage_free(storage); |
216 | mailmessage_free(msg); | 218 | mailmessage_free(msg); |
217 | return result; | 219 | return result; |
218 | } | 220 | } |
219 | 221 | ||
220 | void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) | 222 | void MBOXwrapper::deleteMails(const QString & mailbox,const Q3ValueList<RecMailP> &target) |
221 | { | 223 | { |
222 | QString p = MBOXPath+"/"; | 224 | QString p = MBOXPath+"/"; |
223 | p+=mailbox; | 225 | p+=mailbox; |
224 | mailmbox_folder*f = 0; | 226 | mailmbox_folder*f = 0; |
225 | int r = mailmbox_init(p.latin1(),0,1,0,&f); | 227 | int r = mailmbox_init(p.latin1(),0,1,0,&f); |
226 | if (r != MAIL_NO_ERROR) { | 228 | if (r != MAIL_NO_ERROR) { |
227 | ; // << "Error init folder" << oendl; | 229 | ; // << "Error init folder" << oendl; |
228 | return; | 230 | return; |
229 | } | 231 | } |
230 | deleteMails(f,target); | 232 | deleteMails(f,target); |
231 | mailmbox_done(f); | 233 | mailmbox_done(f); |
232 | } | 234 | } |
233 | 235 | ||
234 | void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target) | 236 | void MBOXwrapper::deleteMails(mailmbox_folder*f,const Q3ValueList<RecMailP> &target) |
235 | { | 237 | { |
236 | if (!f) return; | 238 | if (!f) return; |
237 | int r; | 239 | int r; |
238 | QValueList<RecMailP>::ConstIterator it; | 240 | Q3ValueList<RecMailP>::ConstIterator it; |
239 | for (it=target.begin(); it != target.end();++it) { | 241 | for (it=target.begin(); it != target.end();++it) { |
240 | r = mailmbox_delete_msg(f,(*it)->getNumber()); | 242 | r = mailmbox_delete_msg(f,(*it)->getNumber()); |
241 | if (r!=MAILMBOX_NO_ERROR) { | 243 | if (r!=MAILMBOX_NO_ERROR) { |
242 | ; // << "error delete mail" << oendl; | 244 | ; // << "error delete mail" << oendl; |
243 | } | 245 | } |
244 | } | 246 | } |
245 | r = mailmbox_expunge(f); | 247 | r = mailmbox_expunge(f); |
246 | if (r != MAILMBOX_NO_ERROR) { | 248 | if (r != MAILMBOX_NO_ERROR) { |
247 | ; // << "error expunge mailbox" << oendl; | 249 | ; // << "error expunge mailbox" << oendl; |
248 | } | 250 | } |
249 | } | 251 | } |
250 | 252 | ||
251 | int MBOXwrapper::deleteAllMail(const FolderP&tfolder) | 253 | int MBOXwrapper::deleteAllMail(const FolderP&tfolder) |
252 | { | 254 | { |
253 | if (!tfolder) return 0; | 255 | if (!tfolder) return 0; |
254 | QString p = MBOXPath+"/"+tfolder->getDisplayName(); | 256 | QString p = MBOXPath+"/"+tfolder->getDisplayName(); |
255 | int res = 1; | 257 | int res = 1; |
256 | 258 | ||
257 | mailfolder*folder = 0; | 259 | mailfolder*folder = 0; |
258 | mailmessage_list*l=0; | 260 | mailmessage_list*l=0; |
259 | mailstorage*storage = mailstorage_new(NULL); | 261 | mailstorage*storage = mailstorage_new(NULL); |
260 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 262 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
261 | if (r != MAIL_NO_ERROR) { | 263 | if (r != MAIL_NO_ERROR) { |
262 | Global::statusMessage(i18n("Error initializing mbox")); | 264 | Global::statusMessage(i18n("Error initializing mbox")); |
263 | res = 0; | 265 | res = 0; |
264 | } | 266 | } |
265 | if (res) { | 267 | if (res) { |
266 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 268 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
267 | r = mailfolder_connect(folder); | 269 | r = mailfolder_connect(folder); |
268 | if (r != MAIL_NO_ERROR) { | 270 | if (r != MAIL_NO_ERROR) { |
269 | Global::statusMessage(i18n("Error initializing mbox")); | 271 | Global::statusMessage(i18n("Error initializing mbox")); |
270 | res = 0; | 272 | res = 0; |
diff --git a/kmicromail/libmailwrapper/mboxwrapper.h b/kmicromail/libmailwrapper/mboxwrapper.h index d03940f..e658a71 100644 --- a/kmicromail/libmailwrapper/mboxwrapper.h +++ b/kmicromail/libmailwrapper/mboxwrapper.h | |||
@@ -1,47 +1,49 @@ | |||
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 | //Added by qt3to4: | ||
7 | #include <Q3ValueList> | ||
6 | 8 | ||
7 | class encodedString; | 9 | class encodedString; |
8 | struct mailmbox_folder; | 10 | struct mailmbox_folder; |
9 | 11 | ||
10 | class MBOXwrapper : public Genericwrapper | 12 | class MBOXwrapper : public Genericwrapper |
11 | { | 13 | { |
12 | Q_OBJECT | 14 | Q_OBJECT |
13 | 15 | ||
14 | public: | 16 | public: |
15 | MBOXwrapper(const QString & dir,const QString&name); | 17 | MBOXwrapper(const QString & dir,const QString&name); |
16 | virtual ~MBOXwrapper(); | 18 | virtual ~MBOXwrapper(); |
17 | 19 | ||
18 | virtual void listMessages(const QString & mailbox, QValueList<RecMailP>&target ); | 20 | virtual void listMessages(const QString & mailbox, Q3ValueList<RecMailP>&target ); |
19 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); | 21 | virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
20 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 22 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
21 | 23 | ||
22 | virtual void deleteMail(const RecMailP&mail); | 24 | virtual void deleteMail(const RecMailP&mail); |
23 | virtual void answeredMail(const RecMailP&mail); | 25 | virtual void answeredMail(const RecMailP&mail); |
24 | 26 | ||
25 | virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0, | 27 | virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0, |
26 | const QString&d="",bool s=false); | 28 | const QString&d="",bool s=false); |
27 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); | 29 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); |
28 | 30 | ||
29 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 31 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
30 | 32 | ||
31 | virtual RecBodyP fetchBody( const RecMailP &mail ); | 33 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
32 | static void mbox_progress( size_t current, size_t maximum ); | 34 | static void mbox_progress( size_t current, size_t maximum ); |
33 | 35 | ||
34 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 36 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
35 | virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target); | 37 | virtual void deleteMails(const QString & FolderName,const Q3ValueList<RecMailP> &target); |
36 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 38 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
37 | virtual MAILLIB::ATYPE getType()const; | 39 | virtual MAILLIB::ATYPE getType()const; |
38 | virtual const QString&getName()const; | 40 | virtual const QString&getName()const; |
39 | virtual Account* getAccount() { return 0; }; | 41 | virtual Account* getAccount() { return 0; }; |
40 | 42 | ||
41 | protected: | 43 | protected: |
42 | static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target); | 44 | static void deleteMails(mailmbox_folder*f,const Q3ValueList<RecMailP> &target); |
43 | QString MBOXPath; | 45 | QString MBOXPath; |
44 | QString MBOXName; | 46 | QString MBOXName; |
45 | }; | 47 | }; |
46 | 48 | ||
47 | #endif | 49 | #endif |
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp index 787e85d..4cd7a94 100644 --- a/kmicromail/libmailwrapper/mhwrapper.cpp +++ b/kmicromail/libmailwrapper/mhwrapper.cpp | |||
@@ -1,117 +1,119 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include "mhwrapper.h" | 2 | #include "mhwrapper.h" |
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
4 | #include "mailwrapper.h" | 4 | #include "mailwrapper.h" |
5 | #include <libetpan/libetpan.h> | 5 | #include <libetpan/libetpan.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | //Added by qt3to4: | ||
9 | #include <Q3ValueList> | ||
8 | #include <stdlib.h> | 10 | #include <stdlib.h> |
9 | #include <qpe/global.h> | 11 | #include <qpe/global.h> |
10 | #include <klocale.h> | 12 | #include <klocale.h> |
11 | #include <kglobal.h> | 13 | #include <kglobal.h> |
12 | //#include <opie2/odebug.h> | 14 | //#include <opie2/odebug.h> |
13 | 15 | ||
14 | using namespace Opie::Core; | 16 | using namespace Opie::Core; |
15 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) | 17 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) |
16 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) | 18 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) |
17 | { | 19 | { |
18 | if (MHPath.length()>0) { | 20 | if (MHPath.length()>0) { |
19 | if (MHPath[MHPath.length()-1]=='/') { | 21 | if (MHPath[MHPath.length()-1]=='/') { |
20 | MHPath=MHPath.left(MHPath.length()-1); | 22 | MHPath=MHPath.left(MHPath.length()-1); |
21 | } | 23 | } |
22 | //odebug << MHPath << oendl; | 24 | //odebug << MHPath << oendl; |
23 | QDir dir(MHPath); | 25 | QDir dir(MHPath); |
24 | if (!dir.exists()) { | 26 | if (!dir.exists()) { |
25 | dir.mkdir(MHPath); | 27 | dir.mkdir(MHPath); |
26 | } | 28 | } |
27 | init_storage(); | 29 | init_storage(); |
28 | } | 30 | } |
29 | } | 31 | } |
30 | 32 | ||
31 | void MHwrapper::init_storage() | 33 | void MHwrapper::init_storage() |
32 | { | 34 | { |
33 | int r; | 35 | int r; |
34 | QString pre = MHPath; | 36 | QString pre = MHPath; |
35 | if (!m_storage) { | 37 | if (!m_storage) { |
36 | m_storage = mailstorage_new(NULL); | 38 | m_storage = mailstorage_new(NULL); |
37 | r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); | 39 | r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); |
38 | if (r != MAIL_NO_ERROR) { | 40 | if (r != MAIL_NO_ERROR) { |
39 | qDebug(" error init storage "); | 41 | qDebug(" error init storage "); |
40 | mailstorage_free(m_storage); | 42 | mailstorage_free(m_storage); |
41 | m_storage = 0; | 43 | m_storage = 0; |
42 | return; | 44 | return; |
43 | } | 45 | } |
44 | } | 46 | } |
45 | r = mailstorage_connect(m_storage); | 47 | r = mailstorage_connect(m_storage); |
46 | if (r!=MAIL_NO_ERROR) { | 48 | if (r!=MAIL_NO_ERROR) { |
47 | qDebug("error connecting storage "); | 49 | qDebug("error connecting storage "); |
48 | mailstorage_free(m_storage); | 50 | mailstorage_free(m_storage); |
49 | m_storage = 0; | 51 | m_storage = 0; |
50 | } | 52 | } |
51 | } | 53 | } |
52 | 54 | ||
53 | void MHwrapper::clean_storage() | 55 | void MHwrapper::clean_storage() |
54 | { | 56 | { |
55 | if (m_storage) { | 57 | if (m_storage) { |
56 | mailstorage_disconnect(m_storage); | 58 | mailstorage_disconnect(m_storage); |
57 | mailstorage_free(m_storage); | 59 | mailstorage_free(m_storage); |
58 | m_storage = 0; | 60 | m_storage = 0; |
59 | } | 61 | } |
60 | } | 62 | } |
61 | 63 | ||
62 | MHwrapper::~MHwrapper() | 64 | MHwrapper::~MHwrapper() |
63 | { | 65 | { |
64 | clean_storage(); | 66 | clean_storage(); |
65 | } | 67 | } |
66 | 68 | ||
67 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) | 69 | void MHwrapper::listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) |
68 | { | 70 | { |
69 | init_storage(); | 71 | init_storage(); |
70 | if (!m_storage) { | 72 | if (!m_storage) { |
71 | return; | 73 | return; |
72 | } | 74 | } |
73 | QString f = buildPath(mailbox); | 75 | QString f = buildPath(mailbox); |
74 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 76 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
75 | if (r!=MAIL_NO_ERROR) { | 77 | if (r!=MAIL_NO_ERROR) { |
76 | qDebug("listMessages: error selecting folder! "); | 78 | qDebug("listMessages: error selecting folder! "); |
77 | return; | 79 | return; |
78 | } | 80 | } |
79 | parseList(target,m_storage->sto_session,f, false, maxSizeInKb ); | 81 | parseList(target,m_storage->sto_session,f, false, maxSizeInKb ); |
80 | Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count())); | 82 | Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count())); |
81 | } | 83 | } |
82 | 84 | ||
83 | QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() | 85 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() |
84 | { | 86 | { |
85 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); | 87 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<Opie::Core::OSmartPointer<Folder> >(); |
86 | /* this is needed! */ | 88 | /* this is needed! */ |
87 | if (m_storage) mailstorage_disconnect(m_storage); | 89 | if (m_storage) mailstorage_disconnect(m_storage); |
88 | init_storage(); | 90 | init_storage(); |
89 | if (!m_storage) { | 91 | if (!m_storage) { |
90 | return folders; | 92 | return folders; |
91 | } | 93 | } |
92 | mail_list*flist = 0; | 94 | mail_list*flist = 0; |
93 | clistcell*current=0; | 95 | clistcell*current=0; |
94 | int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); | 96 | int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); |
95 | if (r != MAIL_NO_ERROR || !flist) { | 97 | if (r != MAIL_NO_ERROR || !flist) { |
96 | qDebug("error getting folder list "); | 98 | qDebug("error getting folder list "); |
97 | return folders; | 99 | return folders; |
98 | } | 100 | } |
99 | for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) { | 101 | for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) { |
100 | QString t = (char*)current->data; | 102 | QString t = (char*)current->data; |
101 | t.replace(0,MHPath.length(),""); | 103 | t.replace(0,MHPath.length(),""); |
102 | folders->append(new MHFolder(t,MHPath)); | 104 | folders->append(new MHFolder(t,MHPath)); |
103 | } | 105 | } |
104 | mail_list_free(flist); | 106 | mail_list_free(flist); |
105 | return folders; | 107 | return folders; |
106 | } | 108 | } |
107 | 109 | ||
108 | void MHwrapper::deleteMail(const RecMailP&mail) | 110 | void MHwrapper::deleteMail(const RecMailP&mail) |
109 | { | 111 | { |
110 | init_storage(); | 112 | init_storage(); |
111 | if (!m_storage) { | 113 | if (!m_storage) { |
112 | return; | 114 | return; |
113 | } | 115 | } |
114 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); | 116 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); |
115 | if (r!=MAIL_NO_ERROR) { | 117 | if (r!=MAIL_NO_ERROR) { |
116 | qDebug("error selecting folder! "); | 118 | qDebug("error selecting folder! "); |
117 | return; | 119 | return; |
@@ -226,73 +228,73 @@ void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) | |||
226 | 228 | ||
227 | encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) | 229 | encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) |
228 | { | 230 | { |
229 | encodedString*result = 0; | 231 | encodedString*result = 0; |
230 | init_storage(); | 232 | init_storage(); |
231 | if (!m_storage) { | 233 | if (!m_storage) { |
232 | return result; | 234 | return result; |
233 | } | 235 | } |
234 | mailmessage * msg = 0; | 236 | mailmessage * msg = 0; |
235 | char*data=0; | 237 | char*data=0; |
236 | size_t size; | 238 | size_t size; |
237 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); | 239 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); |
238 | if (r!=MAIL_NO_ERROR) { | 240 | if (r!=MAIL_NO_ERROR) { |
239 | qDebug("error selecting folder! "); | 241 | qDebug("error selecting folder! "); |
240 | return result; | 242 | return result; |
241 | } | 243 | } |
242 | r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); | 244 | r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); |
243 | if (r != MAIL_NO_ERROR) { | 245 | if (r != MAIL_NO_ERROR) { |
244 | Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); | 246 | Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); |
245 | return 0; | 247 | return 0; |
246 | } | 248 | } |
247 | r = mailmessage_fetch(msg,&data,&size); | 249 | r = mailmessage_fetch(msg,&data,&size); |
248 | if (r != MAIL_NO_ERROR) { | 250 | if (r != MAIL_NO_ERROR) { |
249 | Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); | 251 | Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); |
250 | if (msg) mailmessage_free(msg); | 252 | if (msg) mailmessage_free(msg); |
251 | return 0; | 253 | return 0; |
252 | } | 254 | } |
253 | result = new encodedString(data,size); | 255 | result = new encodedString(data,size); |
254 | if (msg) mailmessage_free(msg); | 256 | if (msg) mailmessage_free(msg); |
255 | return result; | 257 | return result; |
256 | } | 258 | } |
257 | 259 | ||
258 | void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) | 260 | void MHwrapper::deleteMails(const QString & mailbox,const Q3ValueList<RecMailP> &target) |
259 | { | 261 | { |
260 | QString f = buildPath(mailbox); | 262 | QString f = buildPath(mailbox); |
261 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 263 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
262 | if (r!=MAIL_NO_ERROR) { | 264 | if (r!=MAIL_NO_ERROR) { |
263 | qDebug("deleteMails: error selecting folder! "); | 265 | qDebug("deleteMails: error selecting folder! "); |
264 | return; | 266 | return; |
265 | } | 267 | } |
266 | QValueList<RecMailP>::ConstIterator it; | 268 | Q3ValueList<RecMailP>::ConstIterator it; |
267 | for (it=target.begin(); it!=target.end();++it) { | 269 | for (it=target.begin(); it!=target.end();++it) { |
268 | r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); | 270 | r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); |
269 | if (r != MAIL_NO_ERROR) { | 271 | if (r != MAIL_NO_ERROR) { |
270 | qDebug("error deleting mail "); | 272 | qDebug("error deleting mail "); |
271 | break; | 273 | break; |
272 | } | 274 | } |
273 | } | 275 | } |
274 | } | 276 | } |
275 | 277 | ||
276 | int MHwrapper::deleteAllMail(const FolderP&tfolder) | 278 | int MHwrapper::deleteAllMail(const FolderP&tfolder) |
277 | { | 279 | { |
278 | init_storage(); | 280 | init_storage(); |
279 | if (!m_storage) { | 281 | if (!m_storage) { |
280 | return 0; | 282 | return 0; |
281 | } | 283 | } |
282 | int res = 1; | 284 | int res = 1; |
283 | if (!tfolder) return 0; | 285 | if (!tfolder) return 0; |
284 | int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); | 286 | int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); |
285 | if (r!=MAIL_NO_ERROR) { | 287 | if (r!=MAIL_NO_ERROR) { |
286 | qDebug("error selecting folder! "); | 288 | qDebug("error selecting folder! "); |
287 | return 0; | 289 | return 0; |
288 | } | 290 | } |
289 | mailmessage_list*l=0; | 291 | mailmessage_list*l=0; |
290 | r = mailsession_get_messages_list(m_storage->sto_session,&l); | 292 | r = mailsession_get_messages_list(m_storage->sto_session,&l); |
291 | if (r != MAIL_NO_ERROR) { | 293 | if (r != MAIL_NO_ERROR) { |
292 | qDebug("Error message list "); | 294 | qDebug("Error message list "); |
293 | res = 0; | 295 | res = 0; |
294 | } | 296 | } |
295 | unsigned j = 0; | 297 | unsigned j = 0; |
296 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { | 298 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { |
297 | mailmessage * msg; | 299 | mailmessage * msg; |
298 | msg = (mailmessage*)carray_get(l->msg_tab, i); | 300 | msg = (mailmessage*)carray_get(l->msg_tab, i); |
diff --git a/kmicromail/libmailwrapper/mhwrapper.h b/kmicromail/libmailwrapper/mhwrapper.h index 36a443a..6151ff1 100644 --- a/kmicromail/libmailwrapper/mhwrapper.h +++ b/kmicromail/libmailwrapper/mhwrapper.h | |||
@@ -1,59 +1,61 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef __MH_WRAPPER_H | 2 | #ifndef __MH_WRAPPER_H |
3 | #define __MH_WRAPPER_H | 3 | #define __MH_WRAPPER_H |
4 | 4 | ||
5 | #include "maildefines.h" | 5 | #include "maildefines.h" |
6 | 6 | ||
7 | #include "genericwrapper.h" | 7 | #include "genericwrapper.h" |
8 | #include <qstring.h> | 8 | #include <qstring.h> |
9 | //Added by qt3to4: | ||
10 | #include <Q3ValueList> | ||
9 | 11 | ||
10 | class encodedString; | 12 | class encodedString; |
11 | struct mailmbox_folder; | 13 | struct mailmbox_folder; |
12 | class MHwrapper : public Genericwrapper | 14 | class MHwrapper : public Genericwrapper |
13 | { | 15 | { |
14 | Q_OBJECT | 16 | Q_OBJECT |
15 | public: | 17 | public: |
16 | MHwrapper(const QString & dir,const QString&name); | 18 | MHwrapper(const QString & dir,const QString&name); |
17 | virtual ~MHwrapper(); | 19 | virtual ~MHwrapper(); |
18 | 20 | ||
19 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); | 21 | virtual void listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); |
20 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); | 22 | virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
21 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 23 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
22 | 24 | ||
23 | virtual void deleteMail(const RecMailP&mail); | 25 | virtual void deleteMail(const RecMailP&mail); |
24 | virtual void answeredMail(const RecMailP&mail); | 26 | virtual void answeredMail(const RecMailP&mail); |
25 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 27 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
26 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, | 28 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
27 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 29 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
28 | 30 | ||
29 | virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0, | 31 | virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0, |
30 | const QString&d="",bool s=false); | 32 | const QString&d="",bool s=false); |
31 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); | 33 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); |
32 | 34 | ||
33 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
34 | 36 | ||
35 | virtual RecBodyP fetchBody( const RecMailP &mail ); | 37 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
36 | static void mbox_progress( size_t current, size_t maximum ); | 38 | static void mbox_progress( size_t current, size_t maximum ); |
37 | 39 | ||
38 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 40 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
39 | virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> > &target); | 41 | virtual void deleteMails(const QString & FolderName,const Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target); |
40 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 42 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
41 | virtual MAILLIB::ATYPE getType()const; | 43 | virtual MAILLIB::ATYPE getType()const; |
42 | virtual const QString&getName()const; | 44 | virtual const QString&getName()const; |
43 | virtual Account* getAccount() { return 0; }; | 45 | virtual Account* getAccount() { return 0; }; |
44 | 46 | ||
45 | public slots: | 47 | public slots: |
46 | 48 | ||
47 | protected: | 49 | protected: |
48 | QString buildPath(const QString&p); | 50 | QString buildPath(const QString&p); |
49 | QString MHPath; | 51 | QString MHPath; |
50 | QString MHName; | 52 | QString MHName; |
51 | 53 | ||
52 | void init_storage(); | 54 | void init_storage(); |
53 | void clean_storage(); | 55 | void clean_storage(); |
54 | bool rmDir(QString folderabspath); | 56 | bool rmDir(QString folderabspath); |
55 | 57 | ||
56 | bool removeMboxfailed; | 58 | bool removeMboxfailed; |
57 | }; | 59 | }; |
58 | 60 | ||
59 | #endif | 61 | #endif |
diff --git a/kmicromail/libmailwrapper/nntpwrapper.cpp b/kmicromail/libmailwrapper/nntpwrapper.cpp index 93cd2b5..b328ecd 100644 --- a/kmicromail/libmailwrapper/nntpwrapper.cpp +++ b/kmicromail/libmailwrapper/nntpwrapper.cpp | |||
@@ -1,134 +1,136 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include "nntpwrapper.h" | 2 | #include "nntpwrapper.h" |
3 | #include "logindialog.h" | 3 | #include "logindialog.h" |
4 | #include "mailtypes.h" | 4 | #include "mailtypes.h" |
5 | 5 | ||
6 | #include <qfile.h> | 6 | #include <qfile.h> |
7 | //Added by qt3to4: | ||
8 | #include <Q3ValueList> | ||
7 | 9 | ||
8 | #include <stdlib.h> | 10 | #include <stdlib.h> |
9 | 11 | ||
10 | #include <libetpan/libetpan.h> | 12 | #include <libetpan/libetpan.h> |
11 | 13 | ||
12 | 14 | ||
13 | 15 | ||
14 | #define HARD_MSG_SIZE_LIMIT 5242880 | 16 | #define HARD_MSG_SIZE_LIMIT 5242880 |
15 | 17 | ||
16 | using namespace Opie::Core; | 18 | using namespace Opie::Core; |
17 | NNTPwrapper::NNTPwrapper( NNTPaccount *a ) | 19 | NNTPwrapper::NNTPwrapper( NNTPaccount *a ) |
18 | : Genericwrapper() { | 20 | : Genericwrapper() { |
19 | account = a; | 21 | account = a; |
20 | m_nntp = NULL; | 22 | m_nntp = NULL; |
21 | msgTempName = a->getFileName()+"_msg_cache"; | 23 | msgTempName = a->getFileName()+"_msg_cache"; |
22 | last_msg_id = 0; | 24 | last_msg_id = 0; |
23 | } | 25 | } |
24 | 26 | ||
25 | NNTPwrapper::~NNTPwrapper() { | 27 | NNTPwrapper::~NNTPwrapper() { |
26 | logout(); | 28 | logout(); |
27 | QFile msg_cache(msgTempName); | 29 | QFile msg_cache(msgTempName); |
28 | if (msg_cache.exists()) { | 30 | if (msg_cache.exists()) { |
29 | msg_cache.remove(); | 31 | msg_cache.remove(); |
30 | } | 32 | } |
31 | } | 33 | } |
32 | 34 | ||
33 | void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { | 35 | void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { |
34 | ; // << "NNTP: " << current << " of " << maximum << "" << oendl; | 36 | ; // << "NNTP: " << current << " of " << maximum << "" << oendl; |
35 | } | 37 | } |
36 | 38 | ||
37 | 39 | ||
38 | RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { | 40 | RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { |
39 | int err = NEWSNNTP_NO_ERROR; | 41 | int err = NEWSNNTP_NO_ERROR; |
40 | char *message = 0; | 42 | char *message = 0; |
41 | size_t length = 0; | 43 | size_t length = 0; |
42 | 44 | ||
43 | RecBodyP body = new RecBody(); | 45 | RecBodyP body = new RecBody(); |
44 | login(); | 46 | login(); |
45 | if ( !m_nntp ) { | 47 | if ( !m_nntp ) { |
46 | return body; | 48 | return body; |
47 | } | 49 | } |
48 | 50 | ||
49 | mailmessage * mailmsg; | 51 | mailmessage * mailmsg; |
50 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { | 52 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { |
51 | ; // << "Message to large: " << mail->Msgsize() << "" << oendl; | 53 | ; // << "Message to large: " << mail->Msgsize() << "" << oendl; |
52 | return body; | 54 | return body; |
53 | } | 55 | } |
54 | 56 | ||
55 | QFile msg_cache(msgTempName); | 57 | QFile msg_cache(msgTempName); |
56 | 58 | ||
57 | cleanMimeCache(); | 59 | cleanMimeCache(); |
58 | 60 | ||
59 | if (mail->getNumber()!=last_msg_id) { | 61 | if (mail->getNumber()!=last_msg_id) { |
60 | if (msg_cache.exists()) { | 62 | if (msg_cache.exists()) { |
61 | msg_cache.remove(); | 63 | msg_cache.remove(); |
62 | } | 64 | } |
63 | msg_cache.open(IO_ReadWrite|IO_Truncate); | 65 | msg_cache.open(QIODevice::ReadWrite|QIODevice::Truncate); |
64 | last_msg_id = mail->getNumber(); | 66 | last_msg_id = mail->getNumber(); |
65 | err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg); | 67 | err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg); |
66 | err = mailmessage_fetch(mailmsg,&message,&length); | 68 | err = mailmessage_fetch(mailmsg,&message,&length); |
67 | msg_cache.writeBlock(message,length); | 69 | msg_cache.writeBlock(message,length); |
68 | } else { | 70 | } else { |
69 | QString msg=""; | 71 | QString msg=""; |
70 | msg_cache.open(IO_ReadOnly); | 72 | msg_cache.open(QIODevice::ReadOnly); |
71 | message = new char[4096]; | 73 | message = new char[4096]; |
72 | memset(message,0,4096); | 74 | memset(message,0,4096); |
73 | while (msg_cache.readBlock(message,4095)>0) { | 75 | while (msg_cache.readBlock(message,4095)>0) { |
74 | msg+=message; | 76 | msg+=message; |
75 | memset(message,0,4096); | 77 | memset(message,0,4096); |
76 | } | 78 | } |
77 | delete message; | 79 | delete message; |
78 | message = (char*)malloc(msg.length()+1*sizeof(char)); | 80 | message = (char*)malloc(msg.length()+1*sizeof(char)); |
79 | memset(message,0,msg.length()+1); | 81 | memset(message,0,msg.length()+1); |
80 | memcpy(message,msg.latin1(),msg.length()); | 82 | memcpy(message,msg.latin1(),msg.length()); |
81 | /* transform to libetpan stuff */ | 83 | /* transform to libetpan stuff */ |
82 | mailmsg = mailmessage_new(); | 84 | mailmsg = mailmessage_new(); |
83 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); | 85 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); |
84 | generic_message_t * msg_data; | 86 | generic_message_t * msg_data; |
85 | msg_data = (generic_message_t *)mailmsg->msg_data; | 87 | msg_data = (generic_message_t *)mailmsg->msg_data; |
86 | msg_data->msg_fetched = 1; | 88 | msg_data->msg_fetched = 1; |
87 | msg_data->msg_message = message; | 89 | msg_data->msg_message = message; |
88 | msg_data->msg_length = strlen(message); | 90 | msg_data->msg_length = strlen(message); |
89 | } | 91 | } |
90 | body = parseMail(mailmsg); | 92 | body = parseMail(mailmsg); |
91 | 93 | ||
92 | /* clean up */ | 94 | /* clean up */ |
93 | if (mailmsg) | 95 | if (mailmsg) |
94 | mailmessage_free(mailmsg); | 96 | mailmessage_free(mailmsg); |
95 | if (message) | 97 | if (message) |
96 | free(message); | 98 | free(message); |
97 | 99 | ||
98 | return body; | 100 | return body; |
99 | } | 101 | } |
100 | 102 | ||
101 | 103 | ||
102 | void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb) | 104 | void NNTPwrapper::listMessages(const QString & which, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb) |
103 | { | 105 | { |
104 | login(); | 106 | login(); |
105 | if (!m_nntp) | 107 | if (!m_nntp) |
106 | return; | 108 | return; |
107 | uint32_t res_messages,res_recent,res_unseen; | 109 | uint32_t res_messages,res_recent,res_unseen; |
108 | mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen); | 110 | mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen); |
109 | parseList(target,m_nntp->sto_session,which,true, maxSizeInKb); | 111 | parseList(target,m_nntp->sto_session,which,true, maxSizeInKb); |
110 | } | 112 | } |
111 | 113 | ||
112 | void NNTPwrapper::login() | 114 | void NNTPwrapper::login() |
113 | { | 115 | { |
114 | if (account->getOffline()) | 116 | if (account->getOffline()) |
115 | return; | 117 | return; |
116 | /* we'll hold the line */ | 118 | /* we'll hold the line */ |
117 | if ( m_nntp != NULL ) | 119 | if ( m_nntp != NULL ) |
118 | return; | 120 | return; |
119 | 121 | ||
120 | QString server; | 122 | QString server; |
121 | QString User,Pass; | 123 | QString User,Pass; |
122 | uint16_t port; | 124 | uint16_t port; |
123 | int err = NEWSNNTP_NO_ERROR; | 125 | int err = NEWSNNTP_NO_ERROR; |
124 | 126 | ||
125 | server = account->getServer(); | 127 | server = account->getServer(); |
126 | port = account->getPort().toUInt(); | 128 | port = account->getPort().toUInt(); |
127 | 129 | ||
128 | if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) { | 130 | if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) { |
129 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 131 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
130 | login.show(); | 132 | login.show(); |
131 | if ( QDialog::Accepted == login.exec() ) { | 133 | if ( QDialog::Accepted == login.exec() ) { |
132 | // ok | 134 | // ok |
133 | User = login.getUser(); | 135 | User = login.getUser(); |
134 | Pass = login.getPassword(); | 136 | Pass = login.getPassword(); |
@@ -157,67 +159,67 @@ void NNTPwrapper::login() | |||
157 | } else if ( conntypeset == 0 ) { | 159 | } else if ( conntypeset == 0 ) { |
158 | conntype = CONNECTION_TYPE_TRY_STARTTLS; | 160 | conntype = CONNECTION_TYPE_TRY_STARTTLS; |
159 | } | 161 | } |
160 | 162 | ||
161 | nntp_mailstorage_init(m_nntp,(char*)server.latin1(), port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, | 163 | nntp_mailstorage_init(m_nntp,(char*)server.latin1(), port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, |
162 | (char*)User.latin1(),(char*)Pass.latin1(),0,0,0); | 164 | (char*)User.latin1(),(char*)Pass.latin1(),0,0,0); |
163 | 165 | ||
164 | err = mailstorage_connect( m_nntp ); | 166 | err = mailstorage_connect( m_nntp ); |
165 | 167 | ||
166 | if (err != NEWSNNTP_NO_ERROR) { | 168 | if (err != NEWSNNTP_NO_ERROR) { |
167 | ; // << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; | 169 | ; // << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; |
168 | // Global::statusMessage(tr("Error initializing folder")); | 170 | // Global::statusMessage(tr("Error initializing folder")); |
169 | mailstorage_free(m_nntp); | 171 | mailstorage_free(m_nntp); |
170 | m_nntp = 0; | 172 | m_nntp = 0; |
171 | 173 | ||
172 | } else { | 174 | } else { |
173 | mailsession * session = m_nntp->sto_session; | 175 | mailsession * session = m_nntp->sto_session; |
174 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; | 176 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; |
175 | news->nntp_progr_fun = &nntp_progress; | 177 | news->nntp_progr_fun = &nntp_progress; |
176 | } | 178 | } |
177 | 179 | ||
178 | } | 180 | } |
179 | 181 | ||
180 | void NNTPwrapper::logout() | 182 | void NNTPwrapper::logout() |
181 | { | 183 | { |
182 | int err = NEWSNNTP_NO_ERROR; | 184 | int err = NEWSNNTP_NO_ERROR; |
183 | if ( m_nntp == NULL ) | 185 | if ( m_nntp == NULL ) |
184 | return; | 186 | return; |
185 | mailstorage_free(m_nntp); | 187 | mailstorage_free(m_nntp); |
186 | m_nntp = 0; | 188 | m_nntp = 0; |
187 | } | 189 | } |
188 | 190 | ||
189 | QValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() { | 191 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() { |
190 | 192 | ||
191 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); | 193 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<Opie::Core::OSmartPointer<Folder> >(); |
192 | QStringList groups; | 194 | QStringList groups; |
193 | if (account) { | 195 | if (account) { |
194 | groups = account->getGroups(); | 196 | groups = account->getGroups(); |
195 | } | 197 | } |
196 | for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) { | 198 | for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) { |
197 | folders->append(new Folder((*it),".")); | 199 | folders->append(new Folder((*it),".")); |
198 | } | 200 | } |
199 | return folders; | 201 | return folders; |
200 | } | 202 | } |
201 | 203 | ||
202 | /* we made this method in raw nntp access of etpan and not via generic interface | 204 | /* we made this method in raw nntp access of etpan and not via generic interface |
203 | * 'cause in that case there will be doubled copy operations. eg. the etpan would | 205 | * 'cause in that case there will be doubled copy operations. eg. the etpan would |
204 | * copy that stuff into its own structures and we must copy it into useable c++ | 206 | * copy that stuff into its own structures and we must copy it into useable c++ |
205 | * structures for our frontend. this would not make sense, so it is better to reimplement | 207 | * structures for our frontend. this would not make sense, so it is better to reimplement |
206 | * the stuff from generic interface of etpan but copy it direct to qt classes. | 208 | * the stuff from generic interface of etpan but copy it direct to qt classes. |
207 | */ | 209 | */ |
208 | QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) { | 210 | QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) { |
209 | login(); | 211 | login(); |
210 | QStringList res; | 212 | QStringList res; |
211 | clist *result = 0; | 213 | clist *result = 0; |
212 | clistcell *current = 0; | 214 | clistcell *current = 0; |
213 | newsnntp_group_description *group; | 215 | newsnntp_group_description *group; |
214 | 216 | ||
215 | if ( m_nntp ) { | 217 | if ( m_nntp ) { |
216 | mailsession * session = m_nntp->sto_session; | 218 | mailsession * session = m_nntp->sto_session; |
217 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; | 219 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; |
218 | int err = NEWSNNTP_NO_ERROR; | 220 | int err = NEWSNNTP_NO_ERROR; |
219 | if (mask.isEmpty()) { | 221 | if (mask.isEmpty()) { |
220 | err = newsnntp_list(news, &result); | 222 | err = newsnntp_list(news, &result); |
221 | } else { | 223 | } else { |
222 | /* taken from generic wrapper of etpan */ | 224 | /* taken from generic wrapper of etpan */ |
223 | QString nmask = mask+".*"; | 225 | QString nmask = mask+".*"; |
diff --git a/kmicromail/libmailwrapper/nntpwrapper.h b/kmicromail/libmailwrapper/nntpwrapper.h index 8c54f12..7c8e671 100644 --- a/kmicromail/libmailwrapper/nntpwrapper.h +++ b/kmicromail/libmailwrapper/nntpwrapper.h | |||
@@ -1,50 +1,52 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef __NNTPWRAPPER | 2 | #ifndef __NNTPWRAPPER |
3 | #define __NNTPWRAPPER | 3 | #define __NNTPWRAPPER |
4 | 4 | ||
5 | #include "mailwrapper.h" | 5 | #include "mailwrapper.h" |
6 | #include "genericwrapper.h" | 6 | #include "genericwrapper.h" |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | //Added by qt3to4: | ||
9 | #include <Q3ValueList> | ||
8 | #include <libetpan/clist.h> | 10 | #include <libetpan/clist.h> |
9 | 11 | ||
10 | class encodedString; | 12 | class encodedString; |
11 | struct mailstorage; | 13 | struct mailstorage; |
12 | struct mailfolder; | 14 | struct mailfolder; |
13 | 15 | ||
14 | class NNTPwrapper : public Genericwrapper | 16 | class NNTPwrapper : public Genericwrapper |
15 | { | 17 | { |
16 | 18 | ||
17 | Q_OBJECT | 19 | Q_OBJECT |
18 | 20 | ||
19 | public: | 21 | public: |
20 | NNTPwrapper( NNTPaccount *a ); | 22 | NNTPwrapper( NNTPaccount *a ); |
21 | virtual ~NNTPwrapper(); | 23 | virtual ~NNTPwrapper(); |
22 | 24 | ||
23 | /* mailbox will be ignored */ | 25 | /* mailbox will be ignored */ |
24 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); | 26 | virtual void listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); |
25 | /* should only get the subscribed one */ | 27 | /* should only get the subscribed one */ |
26 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); | 28 | virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
27 | /* mailbox will be ignored */ | 29 | /* mailbox will be ignored */ |
28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 30 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
29 | QStringList listAllNewsgroups(const QString&mask = QString::null); | 31 | QStringList listAllNewsgroups(const QString&mask = QString::null); |
30 | virtual void deleteMail(const RecMailP&mail); | 32 | virtual void deleteMail(const RecMailP&mail); |
31 | virtual void answeredMail(const RecMailP&mail); | 33 | virtual void answeredMail(const RecMailP&mail); |
32 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 34 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
33 | 35 | ||
34 | virtual RecBodyP fetchBody( const RecMailP &mail ); | 36 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
35 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 37 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
36 | virtual void logout(); | 38 | virtual void logout(); |
37 | virtual MAILLIB::ATYPE getType()const; | 39 | virtual MAILLIB::ATYPE getType()const; |
38 | virtual const QString&getName()const; | 40 | virtual const QString&getName()const; |
39 | static void nntp_progress( size_t current, size_t maximum ); | 41 | static void nntp_progress( size_t current, size_t maximum ); |
40 | virtual Account* getAccount() { return account; }; | 42 | virtual Account* getAccount() { return account; }; |
41 | 43 | ||
42 | protected: | 44 | protected: |
43 | void login(); | 45 | void login(); |
44 | NNTPaccount *account; | 46 | NNTPaccount *account; |
45 | mailstorage* m_nntp; | 47 | mailstorage* m_nntp; |
46 | 48 | ||
47 | 49 | ||
48 | }; | 50 | }; |
49 | 51 | ||
50 | #endif | 52 | #endif |
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp index 2888f7c..ebeed71 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.cpp +++ b/kmicromail/libmailwrapper/pop3wrapper.cpp | |||
@@ -1,135 +1,137 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include "pop3wrapper.h" | 3 | #include "pop3wrapper.h" |
4 | #include "mailtypes.h" | 4 | #include "mailtypes.h" |
5 | #include "logindialog.h" | 5 | #include "logindialog.h" |
6 | #include <libetpan/libetpan.h> | 6 | #include <libetpan/libetpan.h> |
7 | 7 | ||
8 | #include <klocale.h> | 8 | #include <klocale.h> |
9 | 9 | ||
10 | #include <qpe/global.h> | 10 | #include <qpe/global.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qprogressbar.h> | 12 | #include <q3progressbar.h> |
13 | #include <qapplication.h> | 13 | #include <qapplication.h> |
14 | //Added by qt3to4: | ||
15 | #include <Q3ValueList> | ||
14 | 16 | ||
15 | /* we don't fetch messages larger than 5 MB */ | 17 | /* we don't fetch messages larger than 5 MB */ |
16 | #define HARD_MSG_SIZE_LIMIT 5242880 | 18 | #define HARD_MSG_SIZE_LIMIT 5242880 |
17 | 19 | ||
18 | using namespace Opie::Core; | 20 | using namespace Opie::Core; |
19 | POP3wrapper::POP3wrapper( POP3account *a ) | 21 | POP3wrapper::POP3wrapper( POP3account *a ) |
20 | : Genericwrapper() { | 22 | : Genericwrapper() { |
21 | account = a; | 23 | account = a; |
22 | m_pop3 = NULL; | 24 | m_pop3 = NULL; |
23 | msgTempName = a->getFileName()+"_msg_cache"; | 25 | msgTempName = a->getFileName()+"_msg_cache"; |
24 | last_msg_id = 0; | 26 | last_msg_id = 0; |
25 | } | 27 | } |
26 | 28 | ||
27 | POP3wrapper::~POP3wrapper() { | 29 | POP3wrapper::~POP3wrapper() { |
28 | logout(); | 30 | logout(); |
29 | QFile msg_cache(msgTempName); | 31 | QFile msg_cache(msgTempName); |
30 | if (msg_cache.exists()) { | 32 | if (msg_cache.exists()) { |
31 | msg_cache.remove(); | 33 | msg_cache.remove(); |
32 | } | 34 | } |
33 | } | 35 | } |
34 | 36 | ||
35 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { | 37 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { |
36 | ; // odebug << "POP3: " << current << " of " << maximum << "" << oendl; | 38 | ; // odebug << "POP3: " << current << " of " << maximum << "" << oendl; |
37 | } | 39 | } |
38 | 40 | ||
39 | RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { | 41 | RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { |
40 | int err = MAILPOP3_NO_ERROR; | 42 | int err = MAILPOP3_NO_ERROR; |
41 | char *message = 0; | 43 | char *message = 0; |
42 | size_t length = 0; | 44 | size_t length = 0; |
43 | 45 | ||
44 | RecBodyP body = new RecBody(); | 46 | RecBodyP body = new RecBody(); |
45 | 47 | ||
46 | login(); | 48 | login(); |
47 | if ( !m_pop3 ) { | 49 | if ( !m_pop3 ) { |
48 | return body; | 50 | return body; |
49 | } | 51 | } |
50 | 52 | ||
51 | mailmessage * mailmsg; | 53 | mailmessage * mailmsg; |
52 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { | 54 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { |
53 | ; // odebug << "Message to large: " << mail->Msgsize() << "" << oendl; | 55 | ; // odebug << "Message to large: " << mail->Msgsize() << "" << oendl; |
54 | return body; | 56 | return body; |
55 | } | 57 | } |
56 | 58 | ||
57 | QFile msg_cache(msgTempName); | 59 | QFile msg_cache(msgTempName); |
58 | 60 | ||
59 | cleanMimeCache(); | 61 | cleanMimeCache(); |
60 | 62 | ||
61 | if (mail->getNumber()!=last_msg_id) { | 63 | if (mail->getNumber()!=last_msg_id) { |
62 | if (msg_cache.exists()) { | 64 | if (msg_cache.exists()) { |
63 | msg_cache.remove(); | 65 | msg_cache.remove(); |
64 | } | 66 | } |
65 | msg_cache.open(IO_ReadWrite|IO_Truncate); | 67 | msg_cache.open(QIODevice::ReadWrite|QIODevice::Truncate); |
66 | last_msg_id = mail->getNumber(); | 68 | last_msg_id = mail->getNumber(); |
67 | err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); | 69 | err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); |
68 | err = mailmessage_fetch(mailmsg,&message,&length); | 70 | err = mailmessage_fetch(mailmsg,&message,&length); |
69 | msg_cache.writeBlock(message,length); | 71 | msg_cache.writeBlock(message,length); |
70 | } else { | 72 | } else { |
71 | QString msg=""; | 73 | QString msg=""; |
72 | msg_cache.open(IO_ReadOnly); | 74 | msg_cache.open(QIODevice::ReadOnly); |
73 | message = new char[4096]; | 75 | message = new char[4096]; |
74 | memset(message,0,4096); | 76 | memset(message,0,4096); |
75 | while (msg_cache.readBlock(message,4095)>0) { | 77 | while (msg_cache.readBlock(message,4095)>0) { |
76 | msg+=message; | 78 | msg+=message; |
77 | memset(message,0,4096); | 79 | memset(message,0,4096); |
78 | } | 80 | } |
79 | delete message; | 81 | delete message; |
80 | message = (char*)malloc(msg.length()+1*sizeof(char)); | 82 | message = (char*)malloc(msg.length()+1*sizeof(char)); |
81 | memset(message,0,msg.length()+1); | 83 | memset(message,0,msg.length()+1); |
82 | memcpy(message,msg.latin1(),msg.length()); | 84 | memcpy(message,msg.latin1(),msg.length()); |
83 | /* transform to libetpan stuff */ | 85 | /* transform to libetpan stuff */ |
84 | mailmsg = mailmessage_new(); | 86 | mailmsg = mailmessage_new(); |
85 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); | 87 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); |
86 | generic_message_t * msg_data; | 88 | generic_message_t * msg_data; |
87 | msg_data = (generic_message_t *)mailmsg->msg_data; | 89 | msg_data = (generic_message_t *)mailmsg->msg_data; |
88 | msg_data->msg_fetched = 1; | 90 | msg_data->msg_fetched = 1; |
89 | msg_data->msg_message = message; | 91 | msg_data->msg_message = message; |
90 | msg_data->msg_length = strlen(message); | 92 | msg_data->msg_length = strlen(message); |
91 | } | 93 | } |
92 | body = parseMail(mailmsg); | 94 | body = parseMail(mailmsg); |
93 | 95 | ||
94 | /* clean up */ | 96 | /* clean up */ |
95 | if (mailmsg) | 97 | if (mailmsg) |
96 | mailmessage_free(mailmsg); | 98 | mailmessage_free(mailmsg); |
97 | if (message) | 99 | if (message) |
98 | free(message); | 100 | free(message); |
99 | 101 | ||
100 | return body; | 102 | return body; |
101 | } | 103 | } |
102 | 104 | ||
103 | void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) | 105 | void POP3wrapper::listMessages(const QString &, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) |
104 | { | 106 | { |
105 | login(); | 107 | login(); |
106 | if (!m_pop3) | 108 | if (!m_pop3) |
107 | return; | 109 | return; |
108 | uint32_t res_messages,res_recent,res_unseen; | 110 | uint32_t res_messages,res_recent,res_unseen; |
109 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); | 111 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); |
110 | parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb); | 112 | parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb); |
111 | Global::statusMessage( i18n("Mailbox contains %1 mail(s)").arg(res_messages)); | 113 | Global::statusMessage( i18n("Mailbox contains %1 mail(s)").arg(res_messages)); |
112 | } | 114 | } |
113 | 115 | ||
114 | void POP3wrapper::login() | 116 | void POP3wrapper::login() |
115 | { | 117 | { |
116 | if (account->getOffline()) | 118 | if (account->getOffline()) |
117 | return; | 119 | return; |
118 | /* we'll hold the line */ | 120 | /* we'll hold the line */ |
119 | if ( m_pop3 != NULL ) | 121 | if ( m_pop3 != NULL ) |
120 | return; | 122 | return; |
121 | 123 | ||
122 | QString server,user, pass; | 124 | QString server,user, pass; |
123 | uint16_t port; | 125 | uint16_t port; |
124 | int err = MAILPOP3_NO_ERROR; | 126 | int err = MAILPOP3_NO_ERROR; |
125 | 127 | ||
126 | server = account->getServer(); | 128 | server = account->getServer(); |
127 | port = account->getPort().toUInt(); | 129 | port = account->getPort().toUInt(); |
128 | 130 | ||
129 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 131 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
130 | qApp->processEvents(); | 132 | qApp->processEvents(); |
131 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 133 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
132 | login.show(); | 134 | login.show(); |
133 | if ( QDialog::Accepted == login.exec() ) { | 135 | if ( QDialog::Accepted == login.exec() ) { |
134 | // ok | 136 | // ok |
135 | user = login.getUser(); | 137 | user = login.getUser(); |
@@ -158,124 +160,124 @@ void POP3wrapper::login() | |||
158 | conntype = CONNECTION_TYPE_TRY_STARTTLS; | 160 | conntype = CONNECTION_TYPE_TRY_STARTTLS; |
159 | } | 161 | } |
160 | 162 | ||
161 | //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); | 163 | //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); |
162 | 164 | ||
163 | pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, | 165 | pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, |
164 | (char*)user.latin1(),(char*)pass.latin1(),0,0,0); | 166 | (char*)user.latin1(),(char*)pass.latin1(),0,0,0); |
165 | 167 | ||
166 | err = mailstorage_connect(m_pop3); | 168 | err = mailstorage_connect(m_pop3); |
167 | if (err != MAIL_NO_ERROR) { | 169 | if (err != MAIL_NO_ERROR) { |
168 | ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; | 170 | ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; |
169 | Global::statusMessage(i18n("Error %1 initializing folder").arg( err )); | 171 | Global::statusMessage(i18n("Error %1 initializing folder").arg( err )); |
170 | mailstorage_free(m_pop3); | 172 | mailstorage_free(m_pop3); |
171 | m_pop3 = 0; | 173 | m_pop3 = 0; |
172 | } else { | 174 | } else { |
173 | mailsession * session = m_pop3->sto_session; | 175 | mailsession * session = m_pop3->sto_session; |
174 | mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; | 176 | mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; |
175 | if (mail) { | 177 | if (mail) { |
176 | mail->pop3_progr_fun = &pop3_progress; | 178 | mail->pop3_progr_fun = &pop3_progress; |
177 | } | 179 | } |
178 | } | 180 | } |
179 | } | 181 | } |
180 | 182 | ||
181 | void POP3wrapper::logout() | 183 | void POP3wrapper::logout() |
182 | { | 184 | { |
183 | if ( m_pop3 == NULL ) | 185 | if ( m_pop3 == NULL ) |
184 | return; | 186 | return; |
185 | mailstorage_free(m_pop3); | 187 | mailstorage_free(m_pop3); |
186 | m_pop3 = 0; | 188 | m_pop3 = 0; |
187 | } | 189 | } |
188 | 190 | ||
189 | 191 | ||
190 | QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { | 192 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { |
191 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); | 193 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<FolderP>(); |
192 | FolderP inb=new Folder("INBOX","/"); | 194 | FolderP inb=new Folder("INBOX","/"); |
193 | folders->append(inb); | 195 | folders->append(inb); |
194 | return folders; | 196 | return folders; |
195 | } | 197 | } |
196 | 198 | ||
197 | void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target) | 199 | void POP3wrapper::deleteMailList(const Q3ValueList<RecMailP>&target) |
198 | { | 200 | { |
199 | login(); | 201 | login(); |
200 | if (!m_pop3) | 202 | if (!m_pop3) |
201 | return; | 203 | return; |
202 | int iii = 0; | 204 | int iii = 0; |
203 | int count = target.count(); | 205 | int count = target.count(); |
204 | 206 | ||
205 | QProgressBar wid ( count ); | 207 | Q3ProgressBar wid ( count ); |
206 | wid.setCaption( i18n("Deleting ...")); | 208 | wid.setCaption( i18n("Deleting ...")); |
207 | wid.show(); | 209 | wid.show(); |
208 | while (iii < count ) { | 210 | while (iii < count ) { |
209 | Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); | 211 | Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); |
210 | wid.setProgress( iii ); | 212 | wid.setProgress( iii ); |
211 | wid.raise(); | 213 | wid.raise(); |
212 | qApp->processEvents(); | 214 | qApp->processEvents(); |
213 | //qDebug("delete "); | 215 | //qDebug("delete "); |
214 | RecMailP mail = (*target.at( iii )); | 216 | RecMailP mail = (*target.at( iii )); |
215 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); | 217 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); |
216 | if (err != MAIL_NO_ERROR) { | 218 | if (err != MAIL_NO_ERROR) { |
217 | Global::statusMessage(i18n("Error deleting mail")); | 219 | Global::statusMessage(i18n("Error deleting mail")); |
218 | } | 220 | } |
219 | ++iii; | 221 | ++iii; |
220 | } | 222 | } |
221 | } | 223 | } |
222 | void POP3wrapper::deleteMail(const RecMailP&mail) { | 224 | void POP3wrapper::deleteMail(const RecMailP&mail) { |
223 | login(); | 225 | login(); |
224 | if (!m_pop3) | 226 | if (!m_pop3) |
225 | return; | 227 | return; |
226 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); | 228 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); |
227 | if (err != MAIL_NO_ERROR) { | 229 | if (err != MAIL_NO_ERROR) { |
228 | Global::statusMessage(i18n("error deleting mail")); | 230 | Global::statusMessage(i18n("error deleting mail")); |
229 | } | 231 | } |
230 | } | 232 | } |
231 | 233 | ||
232 | void POP3wrapper::answeredMail(const RecMailP&) {} | 234 | void POP3wrapper::answeredMail(const RecMailP&) {} |
233 | 235 | ||
234 | int POP3wrapper::deleteAllMail(const FolderP&) { | 236 | int POP3wrapper::deleteAllMail(const FolderP&) { |
235 | login(); | 237 | login(); |
236 | if (!m_pop3) | 238 | if (!m_pop3) |
237 | return 0; | 239 | return 0; |
238 | int res = 1; | 240 | int res = 1; |
239 | 241 | ||
240 | uint32_t result = 0; | 242 | uint32_t result = 0; |
241 | int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); | 243 | int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); |
242 | if (err != MAIL_NO_ERROR) { | 244 | if (err != MAIL_NO_ERROR) { |
243 | Global::statusMessage(i18n("Error getting folder info")); | 245 | Global::statusMessage(i18n("Error getting folder info")); |
244 | return 0; | 246 | return 0; |
245 | } | 247 | } |
246 | 248 | ||
247 | 249 | ||
248 | 250 | ||
249 | QProgressBar wid ( result ); | 251 | Q3ProgressBar wid ( result ); |
250 | wid.setCaption( i18n("Deleting ...")); | 252 | wid.setCaption( i18n("Deleting ...")); |
251 | wid.show(); | 253 | wid.show(); |
252 | for (unsigned int i = 0; i < result; ++i) { | 254 | for (unsigned int i = 0; i < result; ++i) { |
253 | Global::statusMessage(i18n("Delete message %1 of %2").arg(i).arg(result)); | 255 | Global::statusMessage(i18n("Delete message %1 of %2").arg(i).arg(result)); |
254 | wid.setProgress( i ); | 256 | wid.setProgress( i ); |
255 | wid.raise(); | 257 | wid.raise(); |
256 | qApp->processEvents(); | 258 | qApp->processEvents(); |
257 | 259 | ||
258 | err = mailsession_remove_message(m_pop3->sto_session,i+1); | 260 | err = mailsession_remove_message(m_pop3->sto_session,i+1); |
259 | if (err != MAIL_NO_ERROR) { | 261 | if (err != MAIL_NO_ERROR) { |
260 | Global::statusMessage(i18n("Error deleting mail %1").arg(i+1)); | 262 | Global::statusMessage(i18n("Error deleting mail %1").arg(i+1)); |
261 | res=0; | 263 | res=0; |
262 | } | 264 | } |
263 | break; | 265 | break; |
264 | } | 266 | } |
265 | return res; | 267 | return res; |
266 | } | 268 | } |
267 | 269 | ||
268 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { | 270 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { |
269 | login(); | 271 | login(); |
270 | target_stat.message_count = 0; | 272 | target_stat.message_count = 0; |
271 | target_stat.message_unseen = 0; | 273 | target_stat.message_unseen = 0; |
272 | target_stat.message_recent = 0; | 274 | target_stat.message_recent = 0; |
273 | if (!m_pop3) | 275 | if (!m_pop3) |
274 | return; | 276 | return; |
275 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, | 277 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, |
276 | &target_stat.message_recent,&target_stat.message_unseen); | 278 | &target_stat.message_recent,&target_stat.message_unseen); |
277 | if (r != MAIL_NO_ERROR) { | 279 | if (r != MAIL_NO_ERROR) { |
278 | ; // odebug << "error getting folter status." << oendl; | 280 | ; // odebug << "error getting folter status." << oendl; |
279 | } | 281 | } |
280 | } | 282 | } |
281 | 283 | ||
diff --git a/kmicromail/libmailwrapper/pop3wrapper.h b/kmicromail/libmailwrapper/pop3wrapper.h index ebc2fc7..a077877 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.h +++ b/kmicromail/libmailwrapper/pop3wrapper.h | |||
@@ -1,44 +1,46 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef __POP3WRAPPER | 2 | #ifndef __POP3WRAPPER |
3 | #define __POP3WRAPPER | 3 | #define __POP3WRAPPER |
4 | 4 | ||
5 | #include "mailwrapper.h" | 5 | #include "mailwrapper.h" |
6 | #include "genericwrapper.h" | 6 | #include "genericwrapper.h" |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | //Added by qt3to4: | ||
9 | #include <Q3ValueList> | ||
8 | 10 | ||
9 | class encodedString; | 11 | class encodedString; |
10 | struct mailstorage; | 12 | struct mailstorage; |
11 | struct mailfolder; | 13 | struct mailfolder; |
12 | 14 | ||
13 | class POP3wrapper : public Genericwrapper | 15 | class POP3wrapper : public Genericwrapper |
14 | { | 16 | { |
15 | Q_OBJECT | 17 | Q_OBJECT |
16 | 18 | ||
17 | public: | 19 | public: |
18 | POP3wrapper( POP3account *a ); | 20 | POP3wrapper( POP3account *a ); |
19 | virtual ~POP3wrapper(); | 21 | virtual ~POP3wrapper(); |
20 | /* mailbox will be ignored */ | 22 | /* mailbox will be ignored */ |
21 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); | 23 | virtual void listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); |
22 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); | 24 | virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
23 | /* mailbox will be ignored */ | 25 | /* mailbox will be ignored */ |
24 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 26 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
25 | 27 | ||
26 | virtual void deleteMail(const RecMailP&mail); | 28 | virtual void deleteMail(const RecMailP&mail); |
27 | virtual void deleteMailList(const QValueList<RecMailP>&target); | 29 | virtual void deleteMailList(const Q3ValueList<RecMailP>&target); |
28 | virtual void answeredMail(const RecMailP&mail); | 30 | virtual void answeredMail(const RecMailP&mail); |
29 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 31 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
30 | 32 | ||
31 | virtual RecBodyP fetchBody( const RecMailP &mail ); | 33 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
32 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 34 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
33 | virtual void logout(); | 35 | virtual void logout(); |
34 | virtual MAILLIB::ATYPE getType()const; | 36 | virtual MAILLIB::ATYPE getType()const; |
35 | virtual const QString&getName()const; | 37 | virtual const QString&getName()const; |
36 | static void pop3_progress( size_t current, size_t maximum ); | 38 | static void pop3_progress( size_t current, size_t maximum ); |
37 | virtual Account* getAccount() { return account; }; | 39 | virtual Account* getAccount() { return account; }; |
38 | protected: | 40 | protected: |
39 | void login(); | 41 | void login(); |
40 | POP3account *account; | 42 | POP3account *account; |
41 | mailstorage*m_pop3; | 43 | mailstorage*m_pop3; |
42 | }; | 44 | }; |
43 | 45 | ||
44 | #endif | 46 | #endif |
diff --git a/kmicromail/libmailwrapper/sendmailprogress.cpp b/kmicromail/libmailwrapper/sendmailprogress.cpp index 20dfe9b..6cd6409 100644 --- a/kmicromail/libmailwrapper/sendmailprogress.cpp +++ b/kmicromail/libmailwrapper/sendmailprogress.cpp | |||
@@ -1,34 +1,34 @@ | |||
1 | #include "sendmailprogress.h" | 1 | #include "sendmailprogress.h" |
2 | #include <qprogressbar.h> | 2 | #include <q3progressbar.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <klocale.h> | 4 | #include <klocale.h> |
5 | 5 | ||
6 | progressMailSend::progressMailSend(QWidget*parent, const char * name) | 6 | progressMailSend::progressMailSend(QWidget*parent, const char * name) |
7 | :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) | 7 | :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) |
8 | { | 8 | { |
9 | } | 9 | } |
10 | 10 | ||
11 | progressMailSend::~progressMailSend() | 11 | progressMailSend::~progressMailSend() |
12 | { | 12 | { |
13 | } | 13 | } |
14 | 14 | ||
15 | void progressMailSend::setMaxMails(unsigned int aMaxMails) | 15 | void progressMailSend::setMaxMails(unsigned int aMaxMails) |
16 | { | 16 | { |
17 | m_max_mail = aMaxMails; | 17 | m_max_mail = aMaxMails; |
18 | allMailProgressBar->setTotalSteps(aMaxMails); | 18 | allMailProgressBar->setTotalSteps(aMaxMails); |
19 | setMails(); | 19 | setMails(); |
20 | } | 20 | } |
21 | 21 | ||
22 | void progressMailSend::setCurrentMails(unsigned int aCurrent) | 22 | void progressMailSend::setCurrentMails(unsigned int aCurrent) |
23 | { | 23 | { |
24 | m_current_mail = aCurrent; | 24 | m_current_mail = aCurrent; |
25 | allMailProgressBar->setProgress(aCurrent); | 25 | allMailProgressBar->setProgress(aCurrent); |
26 | setMails(); | 26 | setMails(); |
27 | } | 27 | } |
28 | 28 | ||
29 | void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax) | 29 | void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax) |
30 | { | 30 | { |
31 | m_current_single = aCurrent; | 31 | m_current_single = aCurrent; |
32 | m_max_single = aMax; | 32 | m_max_single = aMax; |
33 | setSingle(); | 33 | setSingle(); |
34 | } | 34 | } |
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index 9436d43..fc01528 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp | |||
@@ -1,37 +1,37 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | 3 | ||
4 | #include <qtextcodec.h> | 4 | #include <qtextcodec.h> |
5 | #include <qtextstream.h> | 5 | #include <q3textstream.h> |
6 | #include <qfile.h> | 6 | #include <qfile.h> |
7 | 7 | ||
8 | //#include <opie2/odebug.h> | 8 | //#include <opie2/odebug.h> |
9 | #include <kconfig.h> | 9 | #include <kconfig.h> |
10 | 10 | ||
11 | #include <kstandarddirs.h> | 11 | #include <kstandarddirs.h> |
12 | #include "settings.h" | 12 | #include "settings.h" |
13 | //#include "defines.h" | 13 | //#include "defines.h" |
14 | 14 | ||
15 | #define IMAP_PORT "143" | 15 | #define IMAP_PORT "143" |
16 | #define IMAP_SSL_PORT "993" | 16 | #define IMAP_SSL_PORT "993" |
17 | #define SMTP_PORT "25" | 17 | #define SMTP_PORT "25" |
18 | #define SMTP_SSL_PORT "465" | 18 | #define SMTP_SSL_PORT "465" |
19 | #define POP3_PORT "110" | 19 | #define POP3_PORT "110" |
20 | #define POP3_SSL_PORT "995" | 20 | #define POP3_SSL_PORT "995" |
21 | #define NNTP_PORT "119" | 21 | #define NNTP_PORT "119" |
22 | #define NNTP_SSL_PORT "563" | 22 | #define NNTP_SSL_PORT "563" |
23 | 23 | ||
24 | 24 | ||
25 | Settings::Settings() | 25 | Settings::Settings() |
26 | : QObject() | 26 | : QObject() |
27 | { | 27 | { |
28 | accounts.setAutoDelete( true ); ; | 28 | accounts.setAutoDelete( true ); ; |
29 | updateAccounts(); | 29 | updateAccounts(); |
30 | //qDebug("++++++++++++++++++new settings "); | 30 | //qDebug("++++++++++++++++++new settings "); |
31 | } | 31 | } |
32 | 32 | ||
33 | void Settings::checkDirectory() | 33 | void Settings::checkDirectory() |
34 | { | 34 | { |
35 | return; | 35 | return; |
36 | locateLocal("data", "kopiemail" ); | 36 | locateLocal("data", "kopiemail" ); |
37 | /* | 37 | /* |
@@ -347,92 +347,92 @@ SMTPaccount::SMTPaccount() | |||
347 | { | 347 | { |
348 | file = SMTPaccount::getUniqueFileName(); | 348 | file = SMTPaccount::getUniqueFileName(); |
349 | accountName = "New SMTP Account"; | 349 | accountName = "New SMTP Account"; |
350 | ssl = false; | 350 | ssl = false; |
351 | connectionType = 1; | 351 | connectionType = 1; |
352 | login = false; | 352 | login = false; |
353 | useCC = false; | 353 | useCC = false; |
354 | useBCC = false; | 354 | useBCC = false; |
355 | useReply = false; | 355 | useReply = false; |
356 | type = MAILLIB::A_SMTP; | 356 | type = MAILLIB::A_SMTP; |
357 | port = SMTP_PORT; | 357 | port = SMTP_PORT; |
358 | } | 358 | } |
359 | 359 | ||
360 | SMTPaccount::SMTPaccount( QString filename ) | 360 | SMTPaccount::SMTPaccount( QString filename ) |
361 | : Account() | 361 | : Account() |
362 | { | 362 | { |
363 | file = filename; | 363 | file = filename; |
364 | accountName = "New SMTP Account"; | 364 | accountName = "New SMTP Account"; |
365 | ssl = false; | 365 | ssl = false; |
366 | connectionType = 1; | 366 | connectionType = 1; |
367 | login = false; | 367 | login = false; |
368 | type = MAILLIB::A_SMTP; | 368 | type = MAILLIB::A_SMTP; |
369 | port = SMTP_PORT; | 369 | port = SMTP_PORT; |
370 | } | 370 | } |
371 | 371 | ||
372 | QString SMTPaccount::getSignature() | 372 | QString SMTPaccount::getSignature() |
373 | { | 373 | { |
374 | QFileInfo fi ( signature ); | 374 | QFileInfo fi ( signature ); |
375 | if ( ! fi.exists() ) | 375 | if ( ! fi.exists() ) |
376 | return QString(); | 376 | return QString(); |
377 | 377 | ||
378 | QFile file( signature ); | 378 | QFile file( signature ); |
379 | if (!file.open( IO_ReadOnly ) ) { | 379 | if (!file.open( QIODevice::ReadOnly ) ) { |
380 | return QString(); | 380 | return QString(); |
381 | 381 | ||
382 | } | 382 | } |
383 | QTextStream ts( &file ); | 383 | Q3TextStream ts( &file ); |
384 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 384 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
385 | QString text = ts.read(); | 385 | QString text = ts.read(); |
386 | file.close(); | 386 | file.close(); |
387 | 387 | ||
388 | return text; | 388 | return text; |
389 | 389 | ||
390 | } | 390 | } |
391 | void SMTPaccount::setSignature( QString b ) | 391 | void SMTPaccount::setSignature( QString b ) |
392 | { | 392 | { |
393 | 393 | ||
394 | QFileInfo fi ( signature ); | 394 | QFileInfo fi ( signature ); |
395 | if ( ! fi.exists() ) { | 395 | if ( ! fi.exists() ) { |
396 | QString filedir( locateLocal("data", "kopiemail" ) ); | 396 | QString filedir( locateLocal("data", "kopiemail" ) ); |
397 | signature = filedir+ "/" + getAccountName() +".sig"; | 397 | signature = filedir+ "/" + getAccountName() +".sig"; |
398 | qDebug("new sig %s ", signature.latin1()); | 398 | qDebug("new sig %s ", signature.latin1()); |
399 | save(); | 399 | save(); |
400 | } | 400 | } |
401 | QFile fileIn( signature ); | 401 | QFile fileIn( signature ); |
402 | if (!fileIn.open( IO_WriteOnly ) ) { | 402 | if (!fileIn.open( QIODevice::WriteOnly ) ) { |
403 | qDebug("OM: Cannot write signature file %s ", signature.latin1() ); | 403 | qDebug("OM: Cannot write signature file %s ", signature.latin1() ); |
404 | return ; | 404 | return ; |
405 | } | 405 | } |
406 | QTextStream tsIn( &fileIn ); | 406 | Q3TextStream tsIn( &fileIn ); |
407 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 407 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
408 | tsIn << b ; | 408 | tsIn << b ; |
409 | fileIn.close(); | 409 | fileIn.close(); |
410 | } | 410 | } |
411 | QString SMTPaccount::getUniqueFileName() | 411 | QString SMTPaccount::getUniqueFileName() |
412 | { | 412 | { |
413 | int num = 0; | 413 | int num = 0; |
414 | QString unique; | 414 | QString unique; |
415 | 415 | ||
416 | QDir dir( locateLocal("data", "kopiemail" ) ); | 416 | QDir dir( locateLocal("data", "kopiemail" ) ); |
417 | 417 | ||
418 | QStringList imap = dir.entryList( "smtp-*" ); | 418 | QStringList imap = dir.entryList( "smtp-*" ); |
419 | do { | 419 | do { |
420 | unique.setNum( num++ ); | 420 | unique.setNum( num++ ); |
421 | } while ( imap.contains( "smtp-" + unique ) > 0 ); | 421 | } while ( imap.contains( "smtp-" + unique ) > 0 ); |
422 | 422 | ||
423 | return unique; | 423 | return unique; |
424 | } | 424 | } |
425 | 425 | ||
426 | void SMTPaccount::read() | 426 | void SMTPaccount::read() |
427 | { | 427 | { |
428 | KConfig *conf = new KConfig( getFileName() ); | 428 | KConfig *conf = new KConfig( getFileName() ); |
429 | conf->setGroup( "SMTP Account" ); | 429 | conf->setGroup( "SMTP Account" ); |
430 | accountName = conf->readEntry( "Account" ); | 430 | accountName = conf->readEntry( "Account" ); |
431 | server = conf->readEntry( "Server" ); | 431 | server = conf->readEntry( "Server" ); |
432 | port = conf->readEntry( "Port" ); | 432 | port = conf->readEntry( "Port" ); |
433 | ssl = conf->readBoolEntry( "SSL" ); | 433 | ssl = conf->readBoolEntry( "SSL" ); |
434 | connectionType = conf->readNumEntry( "ConnectionType" ); | 434 | connectionType = conf->readNumEntry( "ConnectionType" ); |
435 | login = conf->readBoolEntry( "Login" ); | 435 | login = conf->readBoolEntry( "Login" ); |
436 | user = conf->readEntry( "User" ); | 436 | user = conf->readEntry( "User" ); |
437 | signature = conf->readEntry( "SigFile" ); | 437 | signature = conf->readEntry( "SigFile" ); |
438 | setPasswordList( conf->readListEntry( "FolderHistory")); | 438 | setPasswordList( conf->readListEntry( "FolderHistory")); |
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp index 7c813cc..2df55ff 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.cpp +++ b/kmicromail/libmailwrapper/smtpwrapper.cpp | |||
@@ -1,43 +1,45 @@ | |||
1 | #include "smtpwrapper.h" | 1 | #include "smtpwrapper.h" |
2 | #include "mailwrapper.h" | 2 | #include "mailwrapper.h" |
3 | #include "abstractmail.h" | 3 | #include "abstractmail.h" |
4 | #include "logindialog.h" | 4 | #include "logindialog.h" |
5 | #include "mailtypes.h" | 5 | #include "mailtypes.h" |
6 | #include "sendmailprogress.h" | 6 | #include "sendmailprogress.h" |
7 | 7 | ||
8 | //#include <opie2/odebug.h> | 8 | //#include <opie2/odebug.h> |
9 | //#include <qt.h> | 9 | //#include <qt.h> |
10 | #include <qapplication.h> | 10 | #include <qapplication.h> |
11 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
12 | //Added by qt3to4: | ||
13 | #include <Q3ValueList> | ||
12 | #include <stdlib.h> | 14 | #include <stdlib.h> |
13 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
14 | //#include <qpe/config.h> | 16 | //#include <qpe/config.h> |
15 | #include <qpe/qcopenvelope_qws.h> | 17 | #include <qpe/qcopenvelope_qws.h> |
16 | #endif | 18 | #endif |
17 | #include <libetpan/libetpan.h> | 19 | #include <libetpan/libetpan.h> |
18 | #include <klocale.h> | 20 | #include <klocale.h> |
19 | #include <kglobal.h> | 21 | #include <kglobal.h> |
20 | #include <kconfig.h> | 22 | #include <kconfig.h> |
21 | 23 | ||
22 | 24 | ||
23 | using namespace Opie::Core; | 25 | using namespace Opie::Core; |
24 | progressMailSend*SMTPwrapper::sendProgress = 0; | 26 | progressMailSend*SMTPwrapper::sendProgress = 0; |
25 | 27 | ||
26 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) | 28 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) |
27 | : Generatemail() | 29 | : Generatemail() |
28 | { | 30 | { |
29 | m_SmtpAccount = aSmtp; | 31 | m_SmtpAccount = aSmtp; |
30 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); | 32 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); |
31 | cfg.setGroup( "Status" ); | 33 | cfg.setGroup( "Status" ); |
32 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | 34 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); |
33 | emit queuedMails( m_queuedMail ); | 35 | emit queuedMails( m_queuedMail ); |
34 | connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); | 36 | connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); |
35 | m_smtp = 0; | 37 | m_smtp = 0; |
36 | } | 38 | } |
37 | 39 | ||
38 | SMTPwrapper::~SMTPwrapper() | 40 | SMTPwrapper::~SMTPwrapper() |
39 | { | 41 | { |
40 | disc_server(); | 42 | disc_server(); |
41 | } | 43 | } |
42 | 44 | ||
43 | void SMTPwrapper::emitQCop( int queued ) { | 45 | void SMTPwrapper::emitQCop( int queued ) { |
@@ -405,66 +407,66 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { | |||
405 | fields = 0; | 407 | fields = 0; |
406 | } | 408 | } |
407 | if (data) { | 409 | if (data) { |
408 | delete data; | 410 | delete data; |
409 | } | 411 | } |
410 | if (from) { | 412 | if (from) { |
411 | free(from); | 413 | free(from); |
412 | } | 414 | } |
413 | if (rcpts) { | 415 | if (rcpts) { |
414 | smtp_address_list_free( rcpts ); | 416 | smtp_address_list_free( rcpts ); |
415 | } | 417 | } |
416 | return res; | 418 | return res; |
417 | } | 419 | } |
418 | 420 | ||
419 | /* this is a special fun */ | 421 | /* this is a special fun */ |
420 | bool SMTPwrapper::flushOutbox() { | 422 | bool SMTPwrapper::flushOutbox() { |
421 | bool returnValue = true; | 423 | bool returnValue = true; |
422 | 424 | ||
423 | ; // odebug << "Sending the queue" << oendl; | 425 | ; // odebug << "Sending the queue" << oendl; |
424 | if (!m_SmtpAccount) { | 426 | if (!m_SmtpAccount) { |
425 | ; // odebug << "No smtp account given" << oendl; | 427 | ; // odebug << "No smtp account given" << oendl; |
426 | return false; | 428 | return false; |
427 | } | 429 | } |
428 | 430 | ||
429 | bool reset_user_value = false; | 431 | bool reset_user_value = false; |
430 | QString localfolders = AbstractMail::defaultLocalfolder(); | 432 | QString localfolders = AbstractMail::defaultLocalfolder(); |
431 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); | 433 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
432 | if (!wrap) { | 434 | if (!wrap) { |
433 | ; // odebug << "memory error" << oendl; | 435 | ; // odebug << "memory error" << oendl; |
434 | return false; | 436 | return false; |
435 | } | 437 | } |
436 | QString oldPw, oldUser; | 438 | QString oldPw, oldUser; |
437 | QValueList<RecMailP> mailsToSend; | 439 | Q3ValueList<RecMailP> mailsToSend; |
438 | QValueList<RecMailP> mailsToRemove; | 440 | Q3ValueList<RecMailP> mailsToRemove; |
439 | QString mbox("Outgoing"); | 441 | QString mbox("Outgoing"); |
440 | wrap->listMessages(mbox,mailsToSend); | 442 | wrap->listMessages(mbox,mailsToSend); |
441 | if (mailsToSend.count()==0) { | 443 | if (mailsToSend.count()==0) { |
442 | delete wrap; | 444 | delete wrap; |
443 | ; // odebug << "No mails to send" << oendl; | 445 | ; // odebug << "No mails to send" << oendl; |
444 | return false; | 446 | return false; |
445 | } | 447 | } |
446 | 448 | ||
447 | oldPw = m_SmtpAccount->getPassword(); | 449 | oldPw = m_SmtpAccount->getPassword(); |
448 | oldUser = m_SmtpAccount->getUser(); | 450 | oldUser = m_SmtpAccount->getUser(); |
449 | if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { | 451 | if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { |
450 | // get'em | 452 | // get'em |
451 | QString user,pass; | 453 | QString user,pass; |
452 | LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); | 454 | LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); |
453 | login.show(); | 455 | login.show(); |
454 | if ( QDialog::Accepted == login.exec() ) { | 456 | if ( QDialog::Accepted == login.exec() ) { |
455 | // ok | 457 | // ok |
456 | user = login.getUser().latin1(); | 458 | user = login.getUser().latin1(); |
457 | pass = login.getPassword().latin1(); | 459 | pass = login.getPassword().latin1(); |
458 | reset_user_value = true; | 460 | reset_user_value = true; |
459 | m_SmtpAccount->setUser(user); | 461 | m_SmtpAccount->setUser(user); |
460 | m_SmtpAccount->setPassword(pass); | 462 | m_SmtpAccount->setPassword(pass); |
461 | } else { | 463 | } else { |
462 | return true; | 464 | return true; |
463 | } | 465 | } |
464 | } | 466 | } |
465 | 467 | ||
466 | 468 | ||
467 | sendProgress = new progressMailSend(); | 469 | sendProgress = new progressMailSend(); |
468 | sendProgress->show(); | 470 | sendProgress->show(); |
469 | sendProgress->setMaxMails(mailsToSend.count()); | 471 | sendProgress->setMaxMails(mailsToSend.count()); |
470 | 472 | ||
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 41cee52..d8eee7d 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -1,41 +1,41 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | #include "mailistviewitem.h" | 2 | #include "mailistviewitem.h" |
3 | #include <libmailwrapper/abstractmail.h> | 3 | #include <libmailwrapper/abstractmail.h> |
4 | #include <qtextstream.h> | 4 | #include <q3textstream.h> |
5 | #include <kiconloader.h> | 5 | #include <kiconloader.h> |
6 | #include "koprefs.h" | 6 | #include "koprefs.h" |
7 | //#include <qpe/resource.h> | 7 | //#include <qpe/resource.h> |
8 | 8 | ||
9 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 9 | MailListViewItem::MailListViewItem(Q3ListView * parent, MailListViewItem * item ) |
10 | :KListViewItem(parent,item),mail_data() | 10 | :KListViewItem(parent,item),mail_data() |
11 | { | 11 | { |
12 | } | 12 | } |
13 | 13 | ||
14 | void MailListViewItem::showEntry() | 14 | void MailListViewItem::showEntry() |
15 | { | 15 | { |
16 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { | 16 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { |
17 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); | 17 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); |
18 | mKeyMap.insert(0, "r" ); | 18 | mKeyMap.insert(0, "r" ); |
19 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { | 19 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { |
20 | /* I think it looks nicer if there are not such a log of icons but only on mails | 20 | /* I think it looks nicer if there are not such a log of icons but only on mails |
21 | replied or new - Alwin*/ | 21 | replied or new - Alwin*/ |
22 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); | 22 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); |
23 | mKeyMap.insert(0, "s" ); | 23 | mKeyMap.insert(0, "s" ); |
24 | } else { | 24 | } else { |
25 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); | 25 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); |
26 | mKeyMap.insert(0, "u" ); | 26 | mKeyMap.insert(0, "u" ); |
27 | } | 27 | } |
28 | QString fsize = mail_data->MsgsizeString(); | 28 | QString fsize = mail_data->MsgsizeString(); |
29 | // 1.23 | 29 | // 1.23 |
30 | // 11.23 | 30 | // 11.23 |
31 | // 111.23 | 31 | // 111.23 |
32 | // 999.23 maxlen | 32 | // 999.23 maxlen |
33 | QString fsort; | 33 | QString fsort; |
34 | switch(fsize.length() ) { | 34 | switch(fsize.length() ) { |
35 | case 6: | 35 | case 6: |
36 | fsort = "00" + fsize ; | 36 | fsort = "00" + fsize ; |
37 | break; | 37 | break; |
38 | case 7: | 38 | case 7: |
39 | fsort = "0" + fsize ; | 39 | fsort = "0" + fsize ; |
40 | break; | 40 | break; |
41 | default: | 41 | default: |
diff --git a/kmicromail/mailistviewitem.h b/kmicromail/mailistviewitem.h index b409c9d..ecc01ba 100644 --- a/kmicromail/mailistviewitem.h +++ b/kmicromail/mailistviewitem.h | |||
@@ -1,27 +1,27 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | #ifndef __MAILLISTVIEWITEM_H | 2 | #ifndef __MAILLISTVIEWITEM_H |
3 | #define __MAILLISTVIEWITEM_H | 3 | #define __MAILLISTVIEWITEM_H |
4 | 4 | ||
5 | #include <klistview.h> | 5 | #include <klistview.h> |
6 | #include <libmailwrapper/mailtypes.h> | 6 | #include <libmailwrapper/mailtypes.h> |
7 | #include <libmailwrapper/maildefines.h> | 7 | #include <libmailwrapper/maildefines.h> |
8 | 8 | ||
9 | class MailListViewItem:public KListViewItem | 9 | class MailListViewItem:public KListViewItem |
10 | { | 10 | { |
11 | public: | 11 | public: |
12 | MailListViewItem(QListView * parent, MailListViewItem * after ); | 12 | MailListViewItem(Q3ListView * parent, MailListViewItem * after ); |
13 | virtual ~MailListViewItem(){} | 13 | virtual ~MailListViewItem(){} |
14 | 14 | ||
15 | void storeData(const RecMailP&data); | 15 | void storeData(const RecMailP&data); |
16 | const RecMailP&data()const; | 16 | const RecMailP&data()const; |
17 | void showEntry(); | 17 | void showEntry(); |
18 | MAILLIB::ATYPE wrapperType(); | 18 | MAILLIB::ATYPE wrapperType(); |
19 | QString key(int column, bool) const; | 19 | QString key(int column, bool) const; |
20 | void setSortKey(int column,const QString &key); | 20 | void setSortKey(int column,const QString &key); |
21 | protected: | 21 | protected: |
22 | RecMailP mail_data; | 22 | RecMailP mail_data; |
23 | private: | 23 | private: |
24 | QMap<int,QString> mKeyMap; | 24 | QMap<int,QString> mKeyMap; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | #endif | 27 | #endif |
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index fe4bc76..dc73455 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp | |||
@@ -1,69 +1,72 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | 3 | ||
4 | #ifndef DESKTOP_VERSION | 4 | #ifndef DESKTOP_VERSION |
5 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
6 | //Added by qt3to4: | ||
7 | #include <Q3CString> | ||
6 | #include <libkdepim/externalapphandler.h> | 8 | #include <libkdepim/externalapphandler.h> |
7 | #include <stdlib.h> | 9 | #include <stdlib.h> |
8 | #else | 10 | #else |
9 | #include <qapplication.h> | 11 | #include <qapplication.h> |
10 | #include <qstring.h> | 12 | #include <qstring.h> |
11 | #include <qwindowsstyle.h> | 13 | #include <qwindowsstyle.h> |
12 | #include <qplatinumstyle.h> | 14 | #include <qplatinumstyle.h> |
13 | #include <qsgistyle.h> | 15 | #include <qsgistyle.h> |
14 | #endif | 16 | #endif |
15 | #include "opiemail.h" | 17 | #include "opiemail.h" |
16 | #include <qdir.h> | 18 | #include <qdir.h> |
17 | #include <kstandarddirs.h> | 19 | #include <kstandarddirs.h> |
18 | #include <kglobal.h> | 20 | #include <kglobal.h> |
19 | #include <stdio.h> | 21 | #include <stdio.h> |
20 | #include "mainwindow.h" | 22 | #include "mainwindow.h" |
21 | #include "koprefs.h" | 23 | #include "koprefs.h" |
22 | #include <libkdepim/kpimglobalprefs.h> | 24 | #include <libkdepim/kpimglobalprefs.h> |
23 | void dumpMissing(); | 25 | void dumpMissing(); |
24 | //using namespace Opie::Core; | 26 | //using namespace Opie::Core; |
25 | int main( int argc, char **argv ) { | 27 | int main( int argc, char **argv ) { |
28 | if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi"); | ||
26 | 29 | ||
27 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
28 | QPEApplication a( argc, argv ); | 31 | QPEApplication a( argc, argv ); |
29 | a.setKeepRunning (); | 32 | a.setKeepRunning (); |
30 | #else | 33 | #else |
31 | QApplication a( argc, argv ); | 34 | QApplication a( argc, argv ); |
32 | QApplication::setStyle( new QPlatinumStyle ()); | 35 | QApplication::setStyle( new QPlatinumStyle ()); |
33 | #endif | 36 | #endif |
34 | //a.setFont( KOPrefs::instance()->mAppFont ); | 37 | //a.setFont( KOPrefs::instance()->mAppFont ); |
35 | KGlobal::setAppName( "kopiemail" ); | 38 | KGlobal::setAppName( "kopiemail" ); |
36 | QString fileName ; | 39 | QString fileName ; |
37 | #ifndef DESKTOP_VERSION | 40 | #ifndef DESKTOP_VERSION |
38 | fileName = getenv("QPEDIR"); | 41 | fileName = getenv("QPEDIR"); |
39 | if ( QApplication::desktop()->width() > 320 ) | 42 | if ( QApplication::desktop()->width() > 320 ) |
40 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); | 43 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); |
41 | else | 44 | else |
42 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); | 45 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); |
43 | #else | 46 | #else |
44 | fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/icons22/"; | 47 | fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/icons22/"; |
45 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 48 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
46 | #endif | 49 | #endif |
47 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); | 50 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); |
48 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 51 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
49 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); | 52 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); |
50 | QApplication::setFont( KOPrefs::instance()->mAppFont ); | 53 | QApplication::setFont( KOPrefs::instance()->mAppFont ); |
51 | OpieMail mw; | 54 | OpieMail mw; |
52 | #ifndef DESKTOP_VERSION | 55 | #ifndef DESKTOP_VERSION |
53 | //qDebug("CONNECT "); | 56 | //qDebug("CONNECT "); |
54 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); | 57 | QObject::connect( &a, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )),&mw, SLOT(message( const Q3CString&, const QByteArray& ))); |
55 | // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 58 | // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
56 | a.showMainWidget(&mw ); | 59 | a.showMainWidget(&mw ); |
57 | #else | 60 | #else |
58 | a.setMainWidget(&mw ); | 61 | a.setMainWidget(&mw ); |
59 | mw.show(); | 62 | mw.show(); |
60 | //m.resize( 800, 600 ); | 63 | //m.resize( 800, 600 ); |
61 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 64 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
62 | #endif | 65 | #endif |
63 | int rv = a.exec(); | 66 | int rv = a.exec(); |
64 | dumpMissing(); | 67 | dumpMissing(); |
65 | 68 | ||
66 | KPimGlobalPrefs::instance()->writeConfig(); | 69 | KPimGlobalPrefs::instance()->writeConfig(); |
67 | return rv; | 70 | return rv; |
68 | 71 | ||
69 | } | 72 | } |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index d547dda..627d92e 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,75 +1,81 @@ | |||
1 | 1 | ||
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qvbox.h> | 4 | #include <q3vbox.h> |
5 | #include <qheader.h> | 5 | #include <q3header.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | //Added by qt3to4: | ||
9 | #include <Q3CString> | ||
10 | #include <Q3GridLayout> | ||
11 | #include <Q3ValueList> | ||
12 | #include <QPixmap> | ||
13 | #include <Q3PopupMenu> | ||
8 | //#include <kdialog.h> | 14 | //#include <kdialog.h> |
9 | #include <kiconloader.h> | 15 | #include <kiconloader.h> |
10 | #include <kapplication.h> | 16 | #include <kapplication.h> |
11 | 17 | ||
12 | #ifdef DESKTOP_VERSION | 18 | #ifdef DESKTOP_VERSION |
13 | #include <qapplication.h> | 19 | #include <qapplication.h> |
14 | #include <qstatusbar.h> | 20 | #include <qstatusbar.h> |
15 | #include <kabc/stdaddressbook.h> | 21 | #include <kabc/stdaddressbook.h> |
16 | extern QStatusBar* globalSstatusBarMainWindow; | 22 | extern QStatusBar* globalSstatusBarMainWindow; |
17 | #else | 23 | #else |
18 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
19 | #include <klocale.h> | 25 | #include <klocale.h> |
20 | #endif | 26 | #endif |
21 | #include "defines.h" | 27 | #include "defines.h" |
22 | #include "koprefs.h" | 28 | #include "koprefs.h" |
23 | #include "mainwindow.h" | 29 | #include "mainwindow.h" |
24 | #include "mailistviewitem.h" | 30 | #include "mailistviewitem.h" |
25 | #include <KDGanttMinimizeSplitter.h> | 31 | #include <KDGanttMinimizeSplitter.h> |
26 | #include <libkdepim/kpimglobalprefs.h> | 32 | #include <libkdepim/kpimglobalprefs.h> |
27 | 33 | ||
28 | #include "koprefs.h" | 34 | #include "koprefs.h" |
29 | 35 | ||
30 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 36 | MainWindow::MainWindow( QWidget *parent, const char *name, Qt::WFlags flags ) |
31 | : QMainWindow( parent, name ) //, flags ) | 37 | : Q3MainWindow( parent, name ) //, flags ) |
32 | { | 38 | { |
33 | #ifdef DESKTOP_VERSION | 39 | #ifdef DESKTOP_VERSION |
34 | globalSstatusBarMainWindow = statusBar(); | 40 | globalSstatusBarMainWindow = statusBar(); |
35 | #endif | 41 | #endif |
36 | setCaption( i18n( "KOpieMail/Pi" ) ); | 42 | setCaption( i18n( "KOpieMail/Pi" ) ); |
37 | setToolBarsMovable( false ); | 43 | setToolBarsMovable( false ); |
38 | //KABC::StdAddressBook::self(); | 44 | //KABC::StdAddressBook::self(); |
39 | toolBar = new QToolBar( this ); | 45 | toolBar = new Q3ToolBar( this ); |
40 | menuBar = new QPEMenuBar( toolBar ); | 46 | menuBar = new QPEMenuBar( toolBar ); |
41 | mailMenu = new QPopupMenu( menuBar ); | 47 | mailMenu = new Q3PopupMenu( menuBar ); |
42 | menuBar->insertItem( i18n( "Mail" ), mailMenu ); | 48 | menuBar->insertItem( i18n( "Mail" ), mailMenu ); |
43 | settingsMenu = new QPopupMenu( menuBar ); | 49 | settingsMenu = new Q3PopupMenu( menuBar ); |
44 | menuBar->insertItem( i18n( "Settings" ), settingsMenu ); | 50 | menuBar->insertItem( i18n( "Settings" ), settingsMenu ); |
45 | 51 | ||
46 | addToolBar( toolBar ); | 52 | addToolBar( toolBar ); |
47 | toolBar->setHorizontalStretchable( true ); | 53 | toolBar->setHorizontalStretchable( true ); |
48 | QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), | 54 | QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), |
49 | 0, 0, this ); | 55 | 0, 0, this ); |
50 | connect(getMail, SIGNAL( activated() ), | 56 | connect(getMail, SIGNAL( activated() ), |
51 | SLOT( slotGetAllMail() ) ); | 57 | SLOT( slotGetAllMail() ) ); |
52 | getMail->addTo( mailMenu ); | 58 | getMail->addTo( mailMenu ); |
53 | 59 | ||
54 | getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), | 60 | getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), |
55 | 0, 0, this ); | 61 | 0, 0, this ); |
56 | getMail->addTo( toolBar ); | 62 | getMail->addTo( toolBar ); |
57 | getMail->addTo( mailMenu ); | 63 | getMail->addTo( mailMenu ); |
58 | connect(getMail, SIGNAL( activated() ), | 64 | connect(getMail, SIGNAL( activated() ), |
59 | SLOT( slotGetMail() ) ); | 65 | SLOT( slotGetMail() ) ); |
60 | 66 | ||
61 | composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), | 67 | composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), |
62 | 0, 0, this ); | 68 | 0, 0, this ); |
63 | composeMail->addTo( toolBar ); | 69 | composeMail->addTo( toolBar ); |
64 | composeMail->addTo( mailMenu ); | 70 | composeMail->addTo( mailMenu ); |
65 | 71 | ||
66 | sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , | 72 | sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , |
67 | 0, 0, this ); | 73 | 0, 0, this ); |
68 | sendQueued->addTo( toolBar ); | 74 | sendQueued->addTo( toolBar ); |
69 | sendQueued->addTo( mailMenu ); | 75 | sendQueued->addTo( mailMenu ); |
70 | 76 | ||
71 | /* | 77 | /* |
72 | syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, | 78 | syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, |
73 | 0, 0, this ); | 79 | 0, 0, this ); |
74 | syncFolders->addTo( toolBar ); | 80 | syncFolders->addTo( toolBar ); |
75 | syncFolders->addTo( mailMenu ); | 81 | syncFolders->addTo( mailMenu ); |
@@ -85,210 +91,210 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
85 | 91 | ||
86 | /* | 92 | /* |
87 | searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), | 93 | searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), |
88 | 0, 0, this ); | 94 | 0, 0, this ); |
89 | searchMails->kopddTo( toolBar ); | 95 | searchMails->kopddTo( toolBar ); |
90 | searchMails->addTo( mailMenu ); | 96 | searchMails->addTo( mailMenu ); |
91 | */ | 97 | */ |
92 | 98 | ||
93 | deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 99 | deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
94 | deleteMails->addTo( toolBar ); | 100 | deleteMails->addTo( toolBar ); |
95 | deleteMails->addTo( mailMenu ); | 101 | deleteMails->addTo( mailMenu ); |
96 | connect( deleteMails, SIGNAL( activated() ), | 102 | connect( deleteMails, SIGNAL( activated() ), |
97 | SLOT( slotDeleteAllMail() ) ); | 103 | SLOT( slotDeleteAllMail() ) ); |
98 | 104 | ||
99 | editSettings = new QAction( i18n( "Configure OM/Pi..." ), SmallIcon("SettingsIcon") , | 105 | editSettings = new QAction( i18n( "Configure OM/Pi..." ), SmallIcon("SettingsIcon") , |
100 | 0, 0, this ); | 106 | 0, 0, this ); |
101 | editSettings->addTo( settingsMenu ); | 107 | editSettings->addTo( settingsMenu ); |
102 | connect( editSettings, SIGNAL( activated() ), | 108 | connect( editSettings, SIGNAL( activated() ), |
103 | SLOT( slotEditSettings() ) ); | 109 | SLOT( slotEditSettings() ) ); |
104 | 110 | ||
105 | 111 | ||
106 | QAction * editSettings2 = new QAction( i18n( "Global Settings..." ), SmallIcon("SettingsIcon") , | 112 | QAction * editSettings2 = new QAction( i18n( "Global Settings..." ), SmallIcon("SettingsIcon") , |
107 | 0, 0, this ); | 113 | 0, 0, this ); |
108 | editSettings2->addTo( settingsMenu ); | 114 | editSettings2->addTo( settingsMenu ); |
109 | connect( editSettings2, SIGNAL( activated() ), | 115 | connect( editSettings2, SIGNAL( activated() ), |
110 | SLOT( slotEditGlobalSettings() ) ); | 116 | SLOT( slotEditGlobalSettings() ) ); |
111 | 117 | ||
112 | 118 | ||
113 | 119 | ||
114 | editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , | 120 | editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , |
115 | 0, 0, this ); | 121 | 0, 0, this ); |
116 | editAccounts->addTo( settingsMenu ); | 122 | editAccounts->addTo( settingsMenu ); |
117 | codecMenu = new QPopupMenu( menuBar ); | 123 | codecMenu = new Q3PopupMenu( menuBar ); |
118 | codecMenu->insertItem( "Western (iso-8859-1)",0,0); | 124 | codecMenu->insertItem( "Western (iso-8859-1)",0,0); |
119 | codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); | 125 | codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); |
120 | codecMenu->insertItem( "Western (iso-8859-15)",2,2); | 126 | codecMenu->insertItem( "Western (iso-8859-15)",2,2); |
121 | codecMenu->insertItem( "Chinese (big-5)",3,3); | 127 | codecMenu->insertItem( "Chinese (big-5)",3,3); |
122 | codecMenu->insertItem( "Unicode (utf-8)",4,4); | 128 | codecMenu->insertItem( "Unicode (utf-8)",4,4); |
123 | codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); | 129 | codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); |
124 | //disabled | 130 | //disabled |
125 | //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); | 131 | //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); |
126 | //setCentralWidget( view ); | 132 | //setCentralWidget( view ); |
127 | 133 | ||
128 | QVBox* wrapperBox = new QVBox( this ); | 134 | Q3VBox* wrapperBox = new Q3VBox( this ); |
129 | setCentralWidget( wrapperBox ); | 135 | setCentralWidget( wrapperBox ); |
130 | 136 | ||
131 | // QWidget *view = new QWidget( wrapperBox ); | 137 | // QWidget *view = new QWidget( wrapperBox ); |
132 | KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox); | 138 | KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox); |
133 | splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down); | 139 | splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down); |
134 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor); | 140 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor); |
135 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 141 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
136 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 142 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
137 | subLE = 0; | 143 | subLE = 0; |
138 | fromLE = 0; | 144 | fromLE = 0; |
139 | toLE = 0; | 145 | toLE = 0; |
140 | if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) { | 146 | if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) { |
141 | QWidget* infoBox = new QWidget( splithor ); | 147 | QWidget* infoBox = new QWidget( splithor ); |
142 | QGridLayout *griLay = new QGridLayout( infoBox, 2,2); | 148 | Q3GridLayout *griLay = new Q3GridLayout( infoBox, 2,2); |
143 | if ( KOPrefs::instance()->mShowInfoSub ) { | 149 | if ( KOPrefs::instance()->mShowInfoSub ) { |
144 | griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 ); | 150 | griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 ); |
145 | griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ; | 151 | griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ; |
146 | } | 152 | } |
147 | if ( KOPrefs::instance()->mShowInfoFrom ) { | 153 | if ( KOPrefs::instance()->mShowInfoFrom ) { |
148 | griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 ); | 154 | griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 ); |
149 | griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ; | 155 | griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ; |
150 | } | 156 | } |
151 | if ( KOPrefs::instance()->mShowInfoTo ) { | 157 | if ( KOPrefs::instance()->mShowInfoTo ) { |
152 | griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 ); | 158 | griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 ); |
153 | griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ; | 159 | griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ; |
154 | } | 160 | } |
155 | infoBox->setMaximumHeight( infoBox->sizeHint().height() ); | 161 | infoBox->setMaximumHeight( infoBox->sizeHint().height() ); |
156 | if ( !KOPrefs::instance()->mShowInfoStart ) { | 162 | if ( !KOPrefs::instance()->mShowInfoStart ) { |
157 | QTimer::singleShot( 1,splithor, SLOT ( toggle() ) ); | 163 | QTimer::singleShot( 1,splithor, SLOT ( toggle() ) ); |
158 | } | 164 | } |
159 | } | 165 | } |
160 | 166 | ||
161 | 167 | ||
162 | folderView = new AccountView( split ); | 168 | folderView = new AccountView( split ); |
163 | folderView->header()->hide(); | 169 | folderView->header()->hide(); |
164 | folderView->setRootIsDecorated( false ); | 170 | folderView->setRootIsDecorated( false ); |
165 | folderView->addColumn( i18n( "Mailbox" ) ); | 171 | folderView->addColumn( i18n( "Mailbox" ) ); |
166 | 172 | ||
167 | //layout->addWidget( folderView ); | 173 | //layout->addWidget( folderView ); |
168 | 174 | ||
169 | mailView = new KListView( split ); | 175 | mailView = new KListView( split ); |
170 | mailView->addColumn( i18n( " " ) ); | 176 | mailView->addColumn( i18n( " " ) ); |
171 | mailView->addColumn( i18n( "Subject" ),QListView::Manual ); | 177 | mailView->addColumn( i18n( "Subject" ),Q3ListView::Manual ); |
172 | mailView->addColumn( i18n( "Sender" ),QListView::Manual ); | 178 | mailView->addColumn( i18n( "Sender" ),Q3ListView::Manual ); |
173 | mailView->addColumn( i18n( "Size" ),QListView::Manual); | 179 | mailView->addColumn( i18n( "Size" ),Q3ListView::Manual); |
174 | mailView->addColumn( i18n( "Date" ),QListView::Manual); | 180 | mailView->addColumn( i18n( "Date" ),Q3ListView::Manual); |
175 | if ( KOPrefs::instance()->mShowToField ) | 181 | if ( KOPrefs::instance()->mShowToField ) |
176 | mailView->addColumn( i18n( "To" ),QListView::Manual); | 182 | mailView->addColumn( i18n( "To" ),Q3ListView::Manual); |
177 | mailView->setAllColumnsShowFocus(true); | 183 | mailView->setAllColumnsShowFocus(true); |
178 | //mailView->setSorting(-1); | 184 | //mailView->setSorting(-1); |
179 | mailView->setRootIsDecorated( false ); | 185 | mailView->setRootIsDecorated( false ); |
180 | statusWidget = new StatusWidget( wrapperBox ); | 186 | statusWidget = new StatusWidget( wrapperBox ); |
181 | statusWidget->hide(); | 187 | statusWidget->hide(); |
182 | mailView->setSelectionMode( QListView::Multi ); | 188 | mailView->setSelectionMode( Q3ListView::Multi ); |
183 | mailView->setMultiSelection( true); | 189 | mailView->setMultiSelection( true); |
184 | mailView->setAlternateBackground(KPimGlobalPrefs::instance()->mAlternateColor ); | 190 | mailView->setAlternateBackground(KPimGlobalPrefs::instance()->mAlternateColor ); |
185 | //layout->addWidget( mailView ); | 191 | //layout->addWidget( mailView ); |
186 | //layout->setStretchFactor( folderView, 1 ); | 192 | //layout->setStretchFactor( folderView, 1 ); |
187 | //layout->setStretchFactor( mailView, 2 ); | 193 | //layout->setStretchFactor( mailView, 2 ); |
188 | 194 | ||
189 | slotAdjustLayout(); | 195 | slotAdjustLayout(); |
190 | #ifndef DESKTOP_VERSION | 196 | #ifndef DESKTOP_VERSION |
191 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 197 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
192 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 198 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
193 | if ( subLE ) | 199 | if ( subLE ) |
194 | QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); | 200 | QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); |
195 | if ( fromLE ) | 201 | if ( fromLE ) |
196 | QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); | 202 | QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); |
197 | if ( toLE ) | 203 | if ( toLE ) |
198 | QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); | 204 | QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); |
199 | #endif | 205 | #endif |
200 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, | 206 | connect( mailView, SIGNAL( doubleClicked (Q3ListViewItem* )),this, |
201 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 207 | SLOT( mailLeftClicked(Q3ListViewItem*) ) ); |
202 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, | 208 | connect( mailView, SIGNAL( returnPressed (Q3ListViewItem* )),this, |
203 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 209 | SLOT( mailLeftClicked(Q3ListViewItem*) ) ); |
204 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 210 | connect( mailView, SIGNAL( mouseButtonPressed(int,Q3ListViewItem*,const QPoint&,int) ),this, |
205 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 211 | SLOT( mailHold(int,Q3ListViewItem*,const QPoint&,int) ) ); |
206 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 212 | connect(folderView, SIGNAL(refreshMailview(const Q3ValueList<RecMailP>&)), |
207 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 213 | this,SLOT(refreshMailView(const Q3ValueList<RecMailP>&))); |
208 | 214 | ||
209 | connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this, | 215 | connect( mailView, SIGNAL( currentChanged (Q3ListViewItem* )),this, |
210 | SLOT( setInfoFields(QListViewItem*) ) ); | 216 | SLOT( setInfoFields(Q3ListViewItem*) ) ); |
211 | 217 | ||
212 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 218 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
213 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 219 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
214 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 220 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
215 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 221 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
216 | //mailView->setMultiSelection ( true ); | 222 | //mailView->setMultiSelection ( true ); |
217 | //mailView->setSelectionMode( QListView::Extended ); | 223 | //mailView->setSelectionMode( QListView::Extended ); |
218 | QValueList<int> list; | 224 | Q3ValueList<int> list; |
219 | int fw = 100; | 225 | int fw = 100; |
220 | if ( QApplication::desktop()->width() > 320 ) | 226 | if ( QApplication::desktop()->width() > 320 ) |
221 | fw = 50; | 227 | fw = 50; |
222 | list.append( fw ); | 228 | list.append( fw ); |
223 | list.append( 100 ); | 229 | list.append( 100 ); |
224 | split->setSizes( list ); | 230 | split->setSizes( list ); |
225 | QTimer::singleShot( 100, this, SLOT( slotAdjustColumns() ) ); | 231 | QTimer::singleShot( 100, this, SLOT( slotAdjustColumns() ) ); |
226 | mailView->setShowSortIndicator ( true ); | 232 | mailView->setShowSortIndicator ( true ); |
227 | QLabel *spacer = new QLabel( toolBar ); | 233 | QLabel *spacer = new QLabel( toolBar ); |
228 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 234 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
229 | toolBar->setStretchableWidget( spacer ); | 235 | toolBar->setStretchableWidget( spacer ); |
230 | 236 | ||
231 | QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); | 237 | QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); |
232 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 238 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
233 | if ( QApplication::desktop()->width() > 320 ) | 239 | if ( QApplication::desktop()->width() > 320 ) |
234 | closeMail->addTo(toolBar); | 240 | closeMail->addTo(toolBar); |
235 | closeMail->addTo(mailMenu); | 241 | closeMail->addTo(mailMenu); |
236 | 242 | ||
237 | 243 | ||
238 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); | 244 | Q3PopupMenu* helpMenu = new Q3PopupMenu( menuBar ); |
239 | menuBar->insertItem( i18n( "Help" ), helpMenu ); | 245 | menuBar->insertItem( i18n( "Help" ), helpMenu ); |
240 | QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); | 246 | QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); |
241 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); | 247 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); |
242 | li->addTo(helpMenu); | 248 | li->addTo(helpMenu); |
243 | li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); | 249 | li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); |
244 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); | 250 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); |
245 | li->addTo(helpMenu); | 251 | li->addTo(helpMenu); |
246 | li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); | 252 | li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); |
247 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); | 253 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); |
248 | li->addTo(helpMenu); | 254 | li->addTo(helpMenu); |
249 | connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); | 255 | connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); |
250 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); | 256 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); |
251 | menuBar->setMaximumWidth( menuBar->sizeHint().width()); | 257 | menuBar->setMaximumWidth( menuBar->sizeHint().width()); |
252 | //menuBar->setMaximumSize( menuBar->sizeHint()); | 258 | //menuBar->setMaximumSize( menuBar->sizeHint()); |
253 | #ifdef DESKTOP_VERSION | 259 | #ifdef DESKTOP_VERSION |
254 | resize ( 640, 480 ); | 260 | resize ( 640, 480 ); |
255 | #endif | 261 | #endif |
256 | } | 262 | } |
257 | 263 | ||
258 | MainWindow::~MainWindow() | 264 | MainWindow::~MainWindow() |
259 | { | 265 | { |
260 | } | 266 | } |
261 | 267 | ||
262 | void MainWindow::setInfoFields(QListViewItem* item ) | 268 | void MainWindow::setInfoFields(Q3ListViewItem* item ) |
263 | { | 269 | { |
264 | if ( item == 0) { | 270 | if ( item == 0) { |
265 | if ( subLE ) subLE->setText(""); | 271 | if ( subLE ) subLE->setText(""); |
266 | if ( fromLE ) fromLE->setText(""); | 272 | if ( fromLE ) fromLE->setText(""); |
267 | if ( toLE ) toLE->setText(""); | 273 | if ( toLE ) toLE->setText(""); |
268 | return; | 274 | return; |
269 | } | 275 | } |
270 | RecMailP mail = ((MailListViewItem*)item)->data(); | 276 | RecMailP mail = ((MailListViewItem*)item)->data(); |
271 | if ( subLE ) subLE->setText(mail->getSubject()); | 277 | if ( subLE ) subLE->setText(mail->getSubject()); |
272 | if ( fromLE ) fromLE->setText(mail->getFrom()); | 278 | if ( fromLE ) fromLE->setText(mail->getFrom()); |
273 | if ( toLE ) toLE->setText(mail->To().join(";" )); | 279 | if ( toLE ) toLE->setText(mail->To().join(";" )); |
274 | if ( subLE ) subLE->setCursorPosition(0); | 280 | if ( subLE ) subLE->setCursorPosition(0); |
275 | if ( fromLE ) fromLE->setCursorPosition(0); | 281 | if ( fromLE ) fromLE->setCursorPosition(0); |
276 | if ( toLE ) toLE->setCursorPosition(0); | 282 | if ( toLE ) toLE->setCursorPosition(0); |
277 | 283 | ||
278 | } | 284 | } |
279 | void MainWindow::slotSetCodec( int codec ) | 285 | void MainWindow::slotSetCodec( int codec ) |
280 | { | 286 | { |
281 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); | 287 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); |
282 | //qDebug("codec %d ", codec); | 288 | //qDebug("codec %d ", codec); |
283 | KOPrefs::instance()->mCurrentCodec = codec; | 289 | KOPrefs::instance()->mCurrentCodec = codec; |
284 | KOPrefs::instance()->isDirty = true; | 290 | KOPrefs::instance()->isDirty = true; |
285 | QString name; | 291 | QString name; |
286 | switch ( codec ) { | 292 | switch ( codec ) { |
287 | case 0: | 293 | case 0: |
288 | name = "iso-8859-1"; | 294 | name = "iso-8859-1"; |
289 | break; | 295 | break; |
290 | case 1: | 296 | case 1: |
291 | name = "iso-8859-5"; | 297 | name = "iso-8859-5"; |
292 | break; | 298 | break; |
293 | case 2: | 299 | case 2: |
294 | name = "iso-8859-15"; | 300 | name = "iso-8859-15"; |
@@ -316,131 +322,131 @@ void MainWindow::showAbout() | |||
316 | QString version; | 322 | QString version; |
317 | #include <../version> | 323 | #include <../version> |
318 | 324 | ||
319 | QString cap = "About KOpieMail/Pi"; | 325 | QString cap = "About KOpieMail/Pi"; |
320 | QString text =i18n("KOpieMail/Platform-independent\n") + | 326 | QString text =i18n("KOpieMail/Platform-independent\n") + |
321 | "(OM/Pi) " + version + " - " | 327 | "(OM/Pi) " + version + " - " |
322 | 328 | ||
323 | #ifdef DESKTOP_VERSION | 329 | #ifdef DESKTOP_VERSION |
324 | "Desktop Edition\n" | 330 | "Desktop Edition\n" |
325 | #else | 331 | #else |
326 | "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" | 332 | "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" |
327 | #endif | 333 | #endif |
328 | "www.pi-sync.info\n\n" | 334 | "www.pi-sync.info\n\n" |
329 | 335 | ||
330 | 336 | ||
331 | 337 | ||
332 | "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n" | 338 | "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n" |
333 | "KOpieMail/Pi is based on Opie Mail\n" | 339 | "KOpieMail/Pi is based on Opie Mail\n" |
334 | "Copyright (c) Rajko Albrecht and the Opie team\n" | 340 | "Copyright (c) Rajko Albrecht and the Opie team\n" |
335 | "KOpieMail/Pi is licensed under the GPL\n" | 341 | "KOpieMail/Pi is licensed under the GPL\n" |
336 | "\n" | 342 | "\n" |
337 | "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" | 343 | "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" |
338 | "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" | 344 | "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" |
339 | "libEtPan has its own licence - see LibEtPan licence\n"; | 345 | "libEtPan has its own licence - see LibEtPan licence\n"; |
340 | 346 | ||
341 | KApplication::showText( cap, text ); | 347 | KApplication::showText( cap, text ); |
342 | } | 348 | } |
343 | void MainWindow::showEtpanLicence() | 349 | void MainWindow::showEtpanLicence() |
344 | { | 350 | { |
345 | KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); | 351 | KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); |
346 | 352 | ||
347 | } | 353 | } |
348 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 354 | void MainWindow::appMessage(const Q3CString &, const QByteArray &) |
349 | { | 355 | { |
350 | qDebug("appMessage implemented by subclass"); | 356 | qDebug("appMessage implemented by subclass"); |
351 | } | 357 | } |
352 | 358 | ||
353 | void MainWindow::slotAdjustLayout() { | 359 | void MainWindow::slotAdjustLayout() { |
354 | 360 | ||
355 | /* | 361 | /* |
356 | QWidget *d = QApplication::desktop(); | 362 | QWidget *d = QApplication::desktop(); |
357 | 363 | ||
358 | if ( d->width() < d->height() ) { | 364 | if ( d->width() < d->height() ) { |
359 | layout->setDirection( QBoxLayout::TopToBottom ); | 365 | layout->setDirection( QBoxLayout::TopToBottom ); |
360 | } else { | 366 | } else { |
361 | layout->setDirection( QBoxLayout::LeftToRight ); | 367 | layout->setDirection( QBoxLayout::LeftToRight ); |
362 | } | 368 | } |
363 | */ | 369 | */ |
364 | } | 370 | } |
365 | 371 | ||
366 | void MainWindow::slotAdjustColumns() | 372 | void MainWindow::slotAdjustColumns() |
367 | { | 373 | { |
368 | 374 | ||
369 | if ( !folderView->isHidden() ) | 375 | if ( !folderView->isHidden() ) |
370 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 376 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
371 | 377 | ||
372 | mailView->setColumnWidth( 0, 10 ); | 378 | mailView->setColumnWidth( 0, 10 ); |
373 | mailView->setColumnWidth( 1, 100 ); | 379 | mailView->setColumnWidth( 1, 100 ); |
374 | mailView->setColumnWidth( 2, 100 ); | 380 | mailView->setColumnWidth( 2, 100 ); |
375 | mailView->setColumnWidth( 3, 70 ); | 381 | mailView->setColumnWidth( 3, 70 ); |
376 | mailView->setColumnWidth( 4, 180 ); | 382 | mailView->setColumnWidth( 4, 180 ); |
377 | if ( KOPrefs::instance()->mShowToField ) | 383 | if ( KOPrefs::instance()->mShowToField ) |
378 | mailView->setColumnWidth( 5, 100 ); | 384 | mailView->setColumnWidth( 5, 100 ); |
379 | mailView->setColumnAlignment( 3, AlignRight); | 385 | mailView->setColumnAlignment( 3, AlignRight); |
380 | } | 386 | } |
381 | void MainWindow::slotAdjustColumnsWide() | 387 | void MainWindow::slotAdjustColumnsWide() |
382 | { | 388 | { |
383 | if ( !folderView->isHidden() ) | 389 | if ( !folderView->isHidden() ) |
384 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 390 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
385 | 391 | ||
386 | mailView->setColumnWidth( 0, 10 ); | 392 | mailView->setColumnWidth( 0, 10 ); |
387 | mailView->setColumnWidth( 1, 200 ); | 393 | mailView->setColumnWidth( 1, 200 ); |
388 | mailView->setColumnWidth( 2, 200 ); | 394 | mailView->setColumnWidth( 2, 200 ); |
389 | mailView->setColumnWidth( 3, 70 ); | 395 | mailView->setColumnWidth( 3, 70 ); |
390 | mailView->setColumnWidth( 4, 180 ); | 396 | mailView->setColumnWidth( 4, 180 ); |
391 | if ( KOPrefs::instance()->mShowToField ) | 397 | if ( KOPrefs::instance()->mShowToField ) |
392 | mailView->setColumnWidth( 5, 100 ); | 398 | mailView->setColumnWidth( 5, 100 ); |
393 | mailView->setColumnAlignment( 3, AlignRight); | 399 | mailView->setColumnAlignment( 3, AlignRight); |
394 | } | 400 | } |
395 | 401 | ||
396 | void MainWindow::slotEditSettings() | 402 | void MainWindow::slotEditSettings() |
397 | { | 403 | { |
398 | } | 404 | } |
399 | void MainWindow::slotEditGlobalSettings() | 405 | void MainWindow::slotEditGlobalSettings() |
400 | { | 406 | { |
401 | } | 407 | } |
402 | 408 | ||
403 | void MainWindow::slotShowFolders( bool ) | 409 | void MainWindow::slotShowFolders( bool ) |
404 | { | 410 | { |
405 | qDebug("not implemented: "); | 411 | qDebug("not implemented: "); |
406 | } | 412 | } |
407 | 413 | ||
408 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) | 414 | void MainWindow::refreshMailView(const Q3ValueList<RecMailP>&) |
409 | { | 415 | { |
410 | qDebug("not implemented: "); | 416 | qDebug("not implemented: "); |
411 | } | 417 | } |
412 | 418 | ||
413 | void MainWindow::mailLeftClicked(QListViewItem * ) | 419 | void MainWindow::mailLeftClicked(Q3ListViewItem * ) |
414 | { | 420 | { |
415 | qDebug("not implemented: "); | 421 | qDebug("not implemented: "); |
416 | } | 422 | } |
417 | 423 | ||
418 | void MainWindow::displayMail() | 424 | void MainWindow::displayMail() |
419 | { | 425 | { |
420 | qDebug("not implemented: "); | 426 | qDebug("not implemented: "); |
421 | } | 427 | } |
422 | 428 | ||
423 | void MainWindow::slotDeleteMail() | 429 | void MainWindow::slotDeleteMail() |
424 | { | 430 | { |
425 | qDebug("not implemented: "); | 431 | qDebug("not implemented: "); |
426 | } | 432 | } |
427 | 433 | ||
428 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 434 | void MainWindow::mailHold(int, Q3ListViewItem *,const QPoint&,int ) |
429 | { | 435 | { |
430 | qDebug("not implemented: "); | 436 | qDebug("not implemented: "); |
431 | } | 437 | } |
432 | 438 | ||
433 | void MainWindow::slotSendQueued() | 439 | void MainWindow::slotSendQueued() |
434 | { | 440 | { |
435 | qDebug("not implemented: "); | 441 | qDebug("not implemented: "); |
436 | } | 442 | } |
437 | 443 | ||
438 | void MainWindow::slotEditAccounts() | 444 | void MainWindow::slotEditAccounts() |
439 | { | 445 | { |
440 | qDebug("not implemented: "); | 446 | qDebug("not implemented: "); |
441 | } | 447 | } |
442 | 448 | ||
443 | void MainWindow::slotComposeMail() | 449 | void MainWindow::slotComposeMail() |
444 | { | 450 | { |
445 | qDebug("not implemented: "); | 451 | qDebug("not implemented: "); |
446 | } | 452 | } |
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h index f65f3b4..1ccadc2 100644 --- a/kmicromail/mainwindow.h +++ b/kmicromail/mainwindow.h | |||
@@ -1,75 +1,79 @@ | |||
1 | 1 | ||
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | #ifndef MAINWINDOW_H | 3 | #ifndef MAINWINDOW_H |
4 | #define MAINWINDOW_H | 4 | #define MAINWINDOW_H |
5 | 5 | ||
6 | #include <qmainwindow.h> | 6 | #include <q3mainwindow.h> |
7 | //Added by qt3to4: | ||
8 | #include <Q3CString> | ||
9 | #include <Q3ValueList> | ||
10 | #include <Q3PopupMenu> | ||
7 | #include <klistview.h> | 11 | #include <klistview.h> |
8 | #include <qaction.h> | 12 | #include <qaction.h> |
9 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
10 | 14 | ||
11 | #include <qtoolbar.h> | 15 | #include <q3toolbar.h> |
12 | #ifdef DESKTOP_VERSION | 16 | #ifdef DESKTOP_VERSION |
13 | #include <qmenubar.h> | 17 | #include <qmenubar.h> |
14 | #define QPEMenuBar QMenuBar | 18 | #define QPEMenuBar QMenuBar |
15 | #else | 19 | #else |
16 | #include <qpe/qpemenubar.h> | 20 | #include <qpe/qpemenubar.h> |
17 | #endif | 21 | #endif |
18 | 22 | ||
19 | #include "accountview.h" | 23 | #include "accountview.h" |
20 | #include "statuswidget.h" | 24 | #include "statuswidget.h" |
21 | 25 | ||
22 | #include <libmailwrapper/mailtypes.h> | 26 | #include <libmailwrapper/mailtypes.h> |
23 | #include <opie2/osmartpointer.h> | 27 | #include <opie2/osmartpointer.h> |
24 | 28 | ||
25 | class RecMail; | 29 | class RecMail; |
26 | 30 | ||
27 | class MainWindow : public QMainWindow | 31 | class MainWindow : public Q3MainWindow |
28 | { | 32 | { |
29 | Q_OBJECT | 33 | Q_OBJECT |
30 | 34 | ||
31 | public: | 35 | public: |
32 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 36 | MainWindow( QWidget *parent = 0, const char *name = 0, Qt::WFlags flags = 0 ); |
33 | virtual ~MainWindow(); | 37 | virtual ~MainWindow(); |
34 | 38 | ||
35 | public slots: | 39 | public slots: |
36 | virtual void slotAdjustColumns(); | 40 | virtual void slotAdjustColumns(); |
37 | virtual void slotAdjustColumnsWide(); | 41 | virtual void slotAdjustColumnsWide(); |
38 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 42 | virtual void appMessage(const Q3CString &msg, const QByteArray &data); |
39 | virtual void slotComposeMail(); | 43 | virtual void slotComposeMail(); |
40 | 44 | ||
41 | protected slots: | 45 | protected slots: |
42 | virtual void setInfoFields(QListViewItem* ); | 46 | virtual void setInfoFields(Q3ListViewItem* ); |
43 | virtual void slotSendQueued(); | 47 | virtual void slotSendQueued(); |
44 | virtual void slotEditAccounts(); | 48 | virtual void slotEditAccounts(); |
45 | virtual void slotShowFolders( bool show ); | 49 | virtual void slotShowFolders( bool show ); |
46 | virtual void refreshMailView(const QValueList<RecMailP>&); | 50 | virtual void refreshMailView(const Q3ValueList<RecMailP>&); |
47 | virtual void displayMail(); | 51 | virtual void displayMail(); |
48 | virtual void slotGetMail() = 0; | 52 | virtual void slotGetMail() = 0; |
49 | virtual void slotGetAllMail() = 0; | 53 | virtual void slotGetAllMail() = 0; |
50 | virtual void slotDeleteMail(); | 54 | virtual void slotDeleteMail(); |
51 | virtual void slotDeleteAllMail() = 0; | 55 | virtual void slotDeleteAllMail() = 0; |
52 | virtual void slotSetCodec(int); | 56 | virtual void slotSetCodec(int); |
53 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 57 | virtual void mailHold(int, Q3ListViewItem *,const QPoint&,int); |
54 | virtual void slotAdjustLayout(); | 58 | virtual void slotAdjustLayout(); |
55 | virtual void slotEditSettings(); | 59 | virtual void slotEditSettings(); |
56 | virtual void slotEditGlobalSettings(); | 60 | virtual void slotEditGlobalSettings(); |
57 | virtual void mailLeftClicked( QListViewItem * ); | 61 | virtual void mailLeftClicked( Q3ListViewItem * ); |
58 | void showLicence(); | 62 | void showLicence(); |
59 | void showAbout(); | 63 | void showAbout(); |
60 | void showEtpanLicence(); | 64 | void showEtpanLicence(); |
61 | 65 | ||
62 | protected: | 66 | protected: |
63 | QToolBar *toolBar; | 67 | Q3ToolBar *toolBar; |
64 | StatusWidget *statusWidget; | 68 | StatusWidget *statusWidget; |
65 | QPEMenuBar *menuBar; | 69 | QPEMenuBar *menuBar; |
66 | QPopupMenu *mailMenu, *settingsMenu, *codecMenu; | 70 | Q3PopupMenu *mailMenu, *settingsMenu, *codecMenu; |
67 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, | 71 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, |
68 | *editSettings, *editAccounts, *syncFolders; | 72 | *editSettings, *editAccounts, *syncFolders; |
69 | AccountView *folderView; | 73 | AccountView *folderView; |
70 | KListView *mailView; | 74 | KListView *mailView; |
71 | QLineEdit* toLE,*fromLE,*subLE; | 75 | QLineEdit* toLE,*fromLE,*subLE; |
72 | //QBoxLayout *layout; | 76 | //QBoxLayout *layout; |
73 | }; | 77 | }; |
74 | 78 | ||
75 | #endif | 79 | #endif |
diff --git a/kmicromail/nntpgroups.cpp b/kmicromail/nntpgroups.cpp index c729f79..d2213d4 100644 --- a/kmicromail/nntpgroups.cpp +++ b/kmicromail/nntpgroups.cpp | |||
@@ -1,62 +1,62 @@ | |||
1 | #include "nntpgroups.h" | 1 | #include "nntpgroups.h" |
2 | 2 | ||
3 | #include <libmailwrapper/settings.h> | 3 | #include <libmailwrapper/settings.h> |
4 | #include <qlistview.h> | 4 | #include <q3listview.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | 6 | ||
7 | using namespace Opie::Core; | 7 | using namespace Opie::Core; |
8 | 8 | ||
9 | NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, WFlags fl) | 9 | NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, Qt::WFlags fl) |
10 | : NNTPGroupsUI(parent,name,fl),subscribedGroups() | 10 | : NNTPGroupsUI(parent,name,fl),subscribedGroups() |
11 | { | 11 | { |
12 | m_Account = account; | 12 | m_Account = account; |
13 | fillGroups(); | 13 | fillGroups(); |
14 | } | 14 | } |
15 | 15 | ||
16 | NNTPGroups::~NNTPGroups() | 16 | NNTPGroups::~NNTPGroups() |
17 | { | 17 | { |
18 | 18 | ||
19 | } | 19 | } |
20 | 20 | ||
21 | void NNTPGroups::slotGetNG() | 21 | void NNTPGroups::slotGetNG() |
22 | { | 22 | { |
23 | if (!m_Account) return; | 23 | if (!m_Account) return; |
24 | GroupListView->clear(); | 24 | GroupListView->clear(); |
25 | NNTPwrapper tmp( m_Account ); | 25 | NNTPwrapper tmp( m_Account ); |
26 | QString filter = Groupfilteredit->text(); | 26 | QString filter = Groupfilteredit->text(); |
27 | QStringList list = tmp.listAllNewsgroups(filter); | 27 | QStringList list = tmp.listAllNewsgroups(filter); |
28 | subscribedGroupsNotListed = subscribedGroups; | 28 | subscribedGroupsNotListed = subscribedGroups; |
29 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 29 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
30 | QCheckListItem *item; | 30 | Q3CheckListItem *item; |
31 | item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); | 31 | item = new Q3CheckListItem( GroupListView, (*it), Q3CheckListItem::CheckBox ); |
32 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | 32 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
33 | item->setOn( true ); | 33 | item->setOn( true ); |
34 | subscribedGroupsNotListed.remove((*it)); | 34 | subscribedGroupsNotListed.remove((*it)); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
39 | void NNTPGroups::fillGroups() | 39 | void NNTPGroups::fillGroups() |
40 | { | 40 | { |
41 | if (!m_Account) return; | 41 | if (!m_Account) return; |
42 | subscribedGroups = m_Account->getGroups(); | 42 | subscribedGroups = m_Account->getGroups(); |
43 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | 43 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { |
44 | QCheckListItem *item; | 44 | Q3CheckListItem *item; |
45 | item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); | 45 | item = new Q3CheckListItem( GroupListView, (*it), Q3CheckListItem::CheckBox ); |
46 | item->setOn( true ); | 46 | item->setOn( true ); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | void NNTPGroups::storeValues() | 50 | void NNTPGroups::storeValues() |
51 | { | 51 | { |
52 | if (!m_Account) return; | 52 | if (!m_Account) return; |
53 | QListViewItemIterator list_it( GroupListView ); | 53 | Q3ListViewItemIterator list_it( GroupListView ); |
54 | subscribedGroups.clear(); | 54 | subscribedGroups.clear(); |
55 | for ( ; list_it.current(); ++list_it ) { | 55 | for ( ; list_it.current(); ++list_it ) { |
56 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { | 56 | if ( ( (Q3CheckListItem*)list_it.current() )->isOn() ) { |
57 | subscribedGroups.append( list_it.current()->text(0) ); | 57 | subscribedGroups.append( list_it.current()->text(0) ); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | subscribedGroups+=subscribedGroupsNotListed; | 60 | subscribedGroups+=subscribedGroupsNotListed; |
61 | m_Account->setGroups( subscribedGroups ); | 61 | m_Account->setGroups( subscribedGroups ); |
62 | } | 62 | } |
diff --git a/kmicromail/nntpgroups.h b/kmicromail/nntpgroups.h index e5b7c35..80cc329 100644 --- a/kmicromail/nntpgroups.h +++ b/kmicromail/nntpgroups.h | |||
@@ -1,33 +1,33 @@ | |||
1 | #ifndef __NNTPGROUPS_WINDOW__ | 1 | #ifndef __NNTPGROUPS_WINDOW__ |
2 | #define __NNTPGROUPS_WINDOW__ | 2 | #define __NNTPGROUPS_WINDOW__ |
3 | 3 | ||
4 | #include "nntpgroupsui.h" | 4 | #include "nntpgroupsui.h" |
5 | 5 | ||
6 | #include <libmailwrapper/nntpwrapper.h> | 6 | #include <libmailwrapper/nntpwrapper.h> |
7 | 7 | ||
8 | class NNTPaccount; | 8 | class NNTPaccount; |
9 | class QStringList; | 9 | class QStringList; |
10 | 10 | ||
11 | class NNTPGroups:public NNTPGroupsUI | 11 | class NNTPGroups:public NNTPGroupsUI |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | public: | 14 | public: |
15 | NNTPGroups(NNTPaccount *account, QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 15 | NNTPGroups(NNTPaccount *account, QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0); |
16 | virtual ~NNTPGroups(); | 16 | virtual ~NNTPGroups(); |
17 | /* must be called from external. | 17 | /* must be called from external. |
18 | * it will store the new subscription list into the account | 18 | * it will store the new subscription list into the account |
19 | * but don't save them, this must be done by the calling class. | 19 | * but don't save them, this must be done by the calling class. |
20 | */ | 20 | */ |
21 | void storeValues(); | 21 | void storeValues(); |
22 | 22 | ||
23 | protected slots: | 23 | protected slots: |
24 | virtual void slotGetNG(); | 24 | virtual void slotGetNG(); |
25 | 25 | ||
26 | protected: | 26 | protected: |
27 | virtual void fillGroups(); | 27 | virtual void fillGroups(); |
28 | 28 | ||
29 | NNTPaccount*m_Account; | 29 | NNTPaccount*m_Account; |
30 | QStringList subscribedGroups,subscribedGroupsNotListed; | 30 | QStringList subscribedGroups,subscribedGroupsNotListed; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | #endif | 33 | #endif |
diff --git a/kmicromail/nntpgroupsdlg.cpp b/kmicromail/nntpgroupsdlg.cpp index f564b10..bfe1d35 100644 --- a/kmicromail/nntpgroupsdlg.cpp +++ b/kmicromail/nntpgroupsdlg.cpp | |||
@@ -1,30 +1,32 @@ | |||
1 | #include "nntpgroupsdlg.h" | 1 | #include "nntpgroupsdlg.h" |
2 | #include "nntpgroups.h" | 2 | #include "nntpgroups.h" |
3 | #include <klocale.h> | 3 | #include <klocale.h> |
4 | 4 | ||
5 | #include <libmailwrapper/settings.h> | 5 | #include <libmailwrapper/settings.h> |
6 | 6 | ||
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | //Added by qt3to4: | ||
9 | #include <Q3VBoxLayout> | ||
8 | 10 | ||
9 | NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name) | 11 | NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name) |
10 | : QDialog(parent,name,true,0) | 12 | : QDialog(parent,name,true,0) |
11 | { | 13 | { |
12 | setCaption(i18n("Subscribed newsgroups")); | 14 | setCaption(i18n("Subscribed newsgroups")); |
13 | m_Account = account; | 15 | m_Account = account; |
14 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 16 | Q3VBoxLayout*dlglayout = new Q3VBoxLayout(this); |
15 | dlglayout->setSpacing(2); | 17 | dlglayout->setSpacing(2); |
16 | dlglayout->setMargin(1); | 18 | dlglayout->setMargin(1); |
17 | groupsWidget = new NNTPGroups(account,this); | 19 | groupsWidget = new NNTPGroups(account,this); |
18 | dlglayout->addWidget(groupsWidget); | 20 | dlglayout->addWidget(groupsWidget); |
19 | } | 21 | } |
20 | 22 | ||
21 | NNTPGroupsDlg::~NNTPGroupsDlg() | 23 | NNTPGroupsDlg::~NNTPGroupsDlg() |
22 | { | 24 | { |
23 | } | 25 | } |
24 | 26 | ||
25 | void NNTPGroupsDlg::accept() | 27 | void NNTPGroupsDlg::accept() |
26 | { | 28 | { |
27 | groupsWidget->storeValues(); | 29 | groupsWidget->storeValues(); |
28 | m_Account->save(); | 30 | m_Account->save(); |
29 | QDialog::accept(); | 31 | QDialog::accept(); |
30 | } | 32 | } |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 75a75b9..f453be5 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,135 +1,140 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | 3 | ||
4 | 4 | ||
5 | #define protected public | 5 | #define protected public |
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | //Added by qt3to4: | ||
8 | #include <Q3ValueList> | ||
9 | #include <Q3CString> | ||
10 | #include <QPixmap> | ||
11 | #include <Q3PopupMenu> | ||
7 | #undef protected | 12 | #undef protected |
8 | #include "koprefsdialog.h" | 13 | #include "koprefsdialog.h" |
9 | #include <kapplication.h> | 14 | #include <kapplication.h> |
10 | #include <libkdepim/externalapphandler.h> | 15 | #include <libkdepim/externalapphandler.h> |
11 | #include <libkdepim/kpimglobalprefs.h> | 16 | #include <libkdepim/kpimglobalprefs.h> |
12 | #ifdef MINIKDE_KDIALOG_H | 17 | #ifdef MINIKDE_KDIALOG_H |
13 | #undef MINIKDE_KDIALOG_H | 18 | #undef MINIKDE_KDIALOG_H |
14 | #endif | 19 | #endif |
15 | #include "settingsdialog.h" | 20 | #include "settingsdialog.h" |
16 | #include "opiemail.h" | 21 | #include "opiemail.h" |
17 | #include "editaccounts.h" | 22 | #include "editaccounts.h" |
18 | #include "composemail.h" | 23 | #include "composemail.h" |
19 | #include "mailistviewitem.h" | 24 | #include "mailistviewitem.h" |
20 | #include "viewmail.h" | 25 | #include "viewmail.h" |
21 | #include "selectstore.h" | 26 | #include "selectstore.h" |
22 | #include "selectsmtp.h" | 27 | #include "selectsmtp.h" |
23 | #include "accountitem.h" | 28 | #include "accountitem.h" |
24 | #include "accountview.h" | 29 | #include "accountview.h" |
25 | #include "klocale.h" | 30 | #include "klocale.h" |
26 | 31 | ||
27 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
28 | #include <qtimer.h> | 33 | #include <qtimer.h> |
29 | #include <qcursor.h> | 34 | #include <qcursor.h> |
30 | #include <qtextbrowser.h> | 35 | #include <q3textbrowser.h> |
31 | #include <qregexp.h> | 36 | #include <qregexp.h> |
32 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
33 | 38 | ||
34 | #ifdef DESKTOP_VERSION | 39 | #ifdef DESKTOP_VERSION |
35 | #include <qapplication.h> | 40 | #include <qapplication.h> |
36 | #else | 41 | #else |
37 | #include <qpe/qpeapplication.h> | 42 | #include <qpe/qpeapplication.h> |
38 | #endif | 43 | #endif |
39 | #include <libmailwrapper/smtpwrapper.h> | 44 | #include <libmailwrapper/smtpwrapper.h> |
40 | #include <libmailwrapper/mailtypes.h> | 45 | #include <libmailwrapper/mailtypes.h> |
41 | #include <libmailwrapper/abstractmail.h> | 46 | #include <libmailwrapper/abstractmail.h> |
42 | #include "koprefs.h" | 47 | #include "koprefs.h" |
43 | 48 | ||
44 | //using namespace Opie::Core; | 49 | //using namespace Opie::Core; |
45 | 50 | ||
46 | OpieMail::OpieMail( QWidget *parent, const char *name ) | 51 | OpieMail::OpieMail( QWidget *parent, const char *name ) |
47 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 52 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
48 | { | 53 | { |
49 | mCurrentComposer = 0; | 54 | mCurrentComposer = 0; |
50 | settings = new Settings(); | 55 | settings = new Settings(); |
51 | tb = 0; | 56 | tb = 0; |
52 | setIcon(SmallIcon( "kmicromail" ) ); | 57 | setIcon(SmallIcon( "kmicromail" ) ); |
53 | folderView->populate( settings->getAccounts() ); | 58 | folderView->populate( settings->getAccounts() ); |
54 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 59 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
55 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 60 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
56 | folderView->setFocus(); | 61 | folderView->setFocus(); |
57 | } | 62 | } |
58 | 63 | ||
59 | OpieMail::~OpieMail() | 64 | OpieMail::~OpieMail() |
60 | { | 65 | { |
61 | if (settings) delete settings; | 66 | if (settings) delete settings; |
62 | if ( tb ) | 67 | if ( tb ) |
63 | delete tb; | 68 | delete tb; |
64 | } | 69 | } |
65 | 70 | ||
66 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 71 | void OpieMail::appMessage(const Q3CString &msg, const QByteArray &data) |
67 | { | 72 | { |
68 | 73 | ||
69 | } | 74 | } |
70 | #include <stdlib.h> | 75 | #include <stdlib.h> |
71 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 76 | void OpieMail::message(const Q3CString &msg, const QByteArray &data) |
72 | { | 77 | { |
73 | // copied from old mail2 | 78 | // copied from old mail2 |
74 | static int ii = 0; | 79 | static int ii = 0; |
75 | //qDebug("QCOP CALL ############################# %d ", ii); | 80 | //qDebug("QCOP CALL ############################# %d ", ii); |
76 | //QString mess ( msg ); | 81 | //QString mess ( msg ); |
77 | //qDebug("Message = %s ",mess.latin1()); | 82 | //qDebug("Message = %s ",mess.latin1()); |
78 | ++ii; | 83 | ++ii; |
79 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 84 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
80 | 85 | ||
81 | mPendingEmail = QString::null; | 86 | mPendingEmail = QString::null; |
82 | mPendingName = QString::null; | 87 | mPendingName = QString::null; |
83 | if (msg == "writeMail(QString,QString)") | 88 | if (msg == "writeMail(QString,QString)") |
84 | { | 89 | { |
85 | //qDebug("writeMail(QString,QString) "); | 90 | //qDebug("writeMail(QString,QString) "); |
86 | QDataStream stream(data,IO_ReadOnly); | 91 | QDataStream stream(data,QIODevice::ReadOnly); |
87 | stream >> mPendingName >> mPendingEmail; | 92 | stream >> mPendingName >> mPendingEmail; |
88 | // removing the whitespaces at beginning and end is needed! | 93 | // removing the whitespaces at beginning and end is needed! |
89 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 94 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
90 | } | 95 | } |
91 | else if (msg == "newMail()") | 96 | else if (msg == "newMail()") |
92 | { | 97 | { |
93 | //qDebug("slotComposeMail() "); | 98 | //qDebug("slotComposeMail() "); |
94 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call | 99 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call |
95 | // and a QCOP call does not like a processevents in his execution | 100 | // and a QCOP call does not like a processevents in his execution |
96 | // with the Qtimer we call slotComposeMail() after we reached the main event loop | 101 | // with the Qtimer we call slotComposeMail() after we reached the main event loop |
97 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 102 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
98 | // slotComposeMail(); | 103 | // slotComposeMail(); |
99 | } | 104 | } |
100 | else if (msg == "newMail(QString)") | 105 | else if (msg == "newMail(QString)") |
101 | { | 106 | { |
102 | //qDebug(" newMail(QString)"); | 107 | //qDebug(" newMail(QString)"); |
103 | QDataStream stream(data,IO_ReadOnly); | 108 | QDataStream stream(data,QIODevice::ReadOnly); |
104 | stream >> mPendingName; | 109 | stream >> mPendingName; |
105 | // the format is | 110 | // the format is |
106 | // NAME <EMAIL>:SUBJECT | 111 | // NAME <EMAIL>:SUBJECT |
107 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 112 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
108 | } else { | 113 | } else { |
109 | mPendingData = data; | 114 | mPendingData = data; |
110 | mPendingMessage = msg; | 115 | mPendingMessage = msg; |
111 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); | 116 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); |
112 | } | 117 | } |
113 | 118 | ||
114 | //qDebug("END OpieMail::message "); | 119 | //qDebug("END OpieMail::message "); |
115 | } | 120 | } |
116 | void OpieMail::slotExtAppHandler() | 121 | void OpieMail::slotExtAppHandler() |
117 | { | 122 | { |
118 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); | 123 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); |
119 | } | 124 | } |
120 | void OpieMail::slotwriteMail2(const QString& namemail ) | 125 | void OpieMail::slotwriteMail2(const QString& namemail ) |
121 | { | 126 | { |
122 | //qDebug("OpieMail::slotwriteMail2 "); | 127 | //qDebug("OpieMail::slotwriteMail2 "); |
123 | //qApp->processEvents(); | 128 | //qApp->processEvents(); |
124 | ComposeMail compose( settings, this, 0, true ); | 129 | ComposeMail compose( settings, this, 0, true ); |
125 | if ( !namemail.isEmpty() ) { | 130 | if ( !namemail.isEmpty() ) { |
126 | QString to = namemail; | 131 | QString to = namemail; |
127 | if ( namemail.find( " <") > 1 ) { | 132 | if ( namemail.find( " <") > 1 ) { |
128 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 133 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
129 | } else | 134 | } else |
130 | if ( namemail.find( "<") > 1 ) { | 135 | if ( namemail.find( "<") > 1 ) { |
131 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 136 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
132 | } | 137 | } |
133 | int sub = to.find( ">:"); | 138 | int sub = to.find( ">:"); |
134 | if ( sub > 0 ) { | 139 | if ( sub > 0 ) { |
135 | compose.setTo( to.left(sub+1) ); | 140 | compose.setTo( to.left(sub+1) ); |
@@ -250,400 +255,400 @@ void OpieMail::slotEditGlobalSettings() | |||
250 | gc.exec(); | 255 | gc.exec(); |
251 | } | 256 | } |
252 | 257 | ||
253 | void OpieMail::slotEditSettings() | 258 | void OpieMail::slotEditSettings() |
254 | { | 259 | { |
255 | 260 | ||
256 | KOPrefsDialog settingsDialog( this, "koprefs", true ); | 261 | KOPrefsDialog settingsDialog( this, "koprefs", true ); |
257 | #ifndef DESKTOP_VERSION | 262 | #ifndef DESKTOP_VERSION |
258 | settingsDialog.showMaximized(); | 263 | settingsDialog.showMaximized(); |
259 | #endif | 264 | #endif |
260 | settingsDialog.exec(); | 265 | settingsDialog.exec(); |
261 | 266 | ||
262 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); | 267 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); |
263 | // KApplication::execDialog(settingsDialog); | 268 | // KApplication::execDialog(settingsDialog); |
264 | } | 269 | } |
265 | 270 | ||
266 | void OpieMail::slotEditAccounts() | 271 | void OpieMail::slotEditAccounts() |
267 | { | 272 | { |
268 | EditAccounts eaDialog( settings, this, 0, true ); | 273 | EditAccounts eaDialog( settings, this, 0, true ); |
269 | eaDialog.slotAdjustColumns(); | 274 | eaDialog.slotAdjustColumns(); |
270 | #ifndef DESKTOP_VERSION | 275 | #ifndef DESKTOP_VERSION |
271 | eaDialog.showMaximized(); | 276 | eaDialog.showMaximized(); |
272 | #endif | 277 | #endif |
273 | eaDialog.exec(); | 278 | eaDialog.exec(); |
274 | if ( settings ) delete settings; | 279 | if ( settings ) delete settings; |
275 | settings = new Settings(); | 280 | settings = new Settings(); |
276 | 281 | ||
277 | folderView->populate( settings->getAccounts() ); | 282 | folderView->populate( settings->getAccounts() ); |
278 | } | 283 | } |
279 | void OpieMail::replyMail() | 284 | void OpieMail::replyMail() |
280 | { | 285 | { |
281 | 286 | ||
282 | QListViewItem*item = mailView->currentItem(); | 287 | Q3ListViewItem*item = mailView->currentItem(); |
283 | if (!item) return; | 288 | if (!item) return; |
284 | RecMailP mail = ((MailListViewItem*)item)->data(); | 289 | RecMailP mail = ((MailListViewItem*)item)->data(); |
285 | RecBodyP body = folderView->fetchBody(mail); | 290 | RecBodyP body = folderView->fetchBody(mail); |
286 | 291 | ||
287 | QString rtext; | 292 | QString rtext; |
288 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 293 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
289 | .arg( mail->getFrom()) | 294 | .arg( mail->getFrom()) |
290 | .arg( mail->getDate()); | 295 | .arg( mail->getDate()); |
291 | 296 | ||
292 | QString text = body->Bodytext(); | 297 | QString text = body->Bodytext(); |
293 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 298 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
294 | QStringList::Iterator it; | 299 | QStringList::Iterator it; |
295 | for (it = lines.begin(); it != lines.end(); it++) | 300 | for (it = lines.begin(); it != lines.end(); it++) |
296 | { | 301 | { |
297 | rtext += "> " + *it + "\n"; | 302 | rtext += "> " + *it + "\n"; |
298 | } | 303 | } |
299 | rtext += "\n"; | 304 | rtext += "\n"; |
300 | 305 | ||
301 | QString prefix; | 306 | QString prefix; |
302 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 307 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
303 | else prefix = "Re: "; // no i18n on purpose | 308 | else prefix = "Re: "; // no i18n on purpose |
304 | 309 | ||
305 | Settings *settings = new Settings(); | 310 | Settings *settings = new Settings(); |
306 | ComposeMail composer( settings ,this, 0, true); | 311 | ComposeMail composer( settings ,this, 0, true); |
307 | if (mail->Replyto().isEmpty()) { | 312 | if (mail->Replyto().isEmpty()) { |
308 | composer.setTo( mail->getFrom()); | 313 | composer.setTo( mail->getFrom()); |
309 | } else { | 314 | } else { |
310 | composer.setTo( mail->Replyto()); | 315 | composer.setTo( mail->Replyto()); |
311 | } | 316 | } |
312 | composer.setSubject( prefix + mail->getSubject()); | 317 | composer.setSubject( prefix + mail->getSubject()); |
313 | composer.setMessage( rtext ); | 318 | composer.setMessage( rtext ); |
314 | composer.setInReplyTo( mail->Msgid()); | 319 | composer.setInReplyTo( mail->Msgid()); |
315 | composer.setCharset( body->getCharset() ); | 320 | composer.setCharset( body->getCharset() ); |
316 | 321 | ||
317 | mCurrentComposer = &composer; | 322 | mCurrentComposer = &composer; |
318 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 323 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
319 | { | 324 | { |
320 | mail->Wrapper()->answeredMail(mail); | 325 | mail->Wrapper()->answeredMail(mail); |
321 | } | 326 | } |
322 | mCurrentComposer = 0; | 327 | mCurrentComposer = 0; |
323 | folderView->refreshOutgoing(); | 328 | folderView->refreshOutgoing(); |
324 | delete settings; | 329 | delete settings; |
325 | 330 | ||
326 | } | 331 | } |
327 | void OpieMail::closeViewMail(ViewMail * vm) | 332 | void OpieMail::closeViewMail(ViewMail * vm) |
328 | { | 333 | { |
329 | vm->hide(); | 334 | vm->hide(); |
330 | } | 335 | } |
331 | 336 | ||
332 | void OpieMail::slotDownloadMail( ) | 337 | void OpieMail::slotDownloadMail( ) |
333 | { | 338 | { |
334 | QListViewItem*item = mailView->currentItem(); | 339 | Q3ListViewItem*item = mailView->currentItem(); |
335 | if (!item ) { | 340 | if (!item ) { |
336 | Global::statusMessage("Error: No item slected!"); | 341 | Global::statusMessage("Error: No item slected!"); |
337 | return; | 342 | return; |
338 | } | 343 | } |
339 | RecMailP mail = ((MailListViewItem*)item)->data(); | 344 | RecMailP mail = ((MailListViewItem*)item)->data(); |
340 | Account * acc = mail->Wrapper()->getAccount(); | 345 | Account * acc = mail->Wrapper()->getAccount(); |
341 | if ( !acc ) { | 346 | if ( !acc ) { |
342 | Global::statusMessage("Mail is already stored locally!"); | 347 | Global::statusMessage("Mail is already stored locally!"); |
343 | return; | 348 | return; |
344 | } | 349 | } |
345 | QString lfName = acc->getLocalFolder(); | 350 | QString lfName = acc->getLocalFolder(); |
346 | //qDebug("local folder " + lfName ); | 351 | //qDebug("local folder " + lfName ); |
347 | if ( lfName.isEmpty() ) | 352 | if ( lfName.isEmpty() ) |
348 | lfName = acc->getAccountName(); | 353 | lfName = acc->getAccountName(); |
349 | AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); | 354 | AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); |
350 | //qDebug("target %d %d ",targetMail,mail->Wrapper() ); | 355 | //qDebug("target %d %d ",targetMail,mail->Wrapper() ); |
351 | if ( targetMail == mail->Wrapper() ) { | 356 | if ( targetMail == mail->Wrapper() ) { |
352 | Global::statusMessage("Mail is already locally stored!"); | 357 | Global::statusMessage("Mail is already locally stored!"); |
353 | return; | 358 | return; |
354 | } | 359 | } |
355 | if ( !targetMail->createMbox(lfName)) { | 360 | if ( !targetMail->createMbox(lfName)) { |
356 | Global::statusMessage("Error creating folder!"); | 361 | Global::statusMessage("Error creating folder!"); |
357 | return; | 362 | return; |
358 | } | 363 | } |
359 | Global::statusMessage("Fetching mail...please wait!"); | 364 | Global::statusMessage("Fetching mail...please wait!"); |
360 | qApp->processEvents(); | 365 | qApp->processEvents(); |
361 | encodedString*st = 0; | 366 | encodedString*st = 0; |
362 | st = mail->Wrapper()->fetchRawBody(mail); | 367 | st = mail->Wrapper()->fetchRawBody(mail); |
363 | if ( st ) { | 368 | if ( st ) { |
364 | targetMail->storeMessage(st->Content(),st->Length(),lfName); | 369 | targetMail->storeMessage(st->Content(),st->Length(),lfName); |
365 | Global::statusMessage("Mail stored in "+ lfName); | 370 | Global::statusMessage("Mail stored in "+ lfName); |
366 | delete st; | 371 | delete st; |
367 | } else { | 372 | } else { |
368 | Global::statusMessage("Error: Cannot fetch mail!"); | 373 | Global::statusMessage("Error: Cannot fetch mail!"); |
369 | } | 374 | } |
370 | } | 375 | } |
371 | 376 | ||
372 | 377 | ||
373 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) | 378 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) |
374 | { | 379 | { |
375 | QListViewItem*item = mailView->currentItem(); | 380 | Q3ListViewItem*item = mailView->currentItem(); |
376 | if (!item ) { | 381 | if (!item ) { |
377 | closeViewMail(vm); | 382 | closeViewMail(vm); |
378 | return; | 383 | return; |
379 | } | 384 | } |
380 | RecMailP mail = ((MailListViewItem*)item)->data(); | 385 | RecMailP mail = ((MailListViewItem*)item)->data(); |
381 | mail->Wrapper()->deleteMail( mail ); | 386 | mail->Wrapper()->deleteMail( mail ); |
382 | item = item->itemBelow(); | 387 | item = item->itemBelow(); |
383 | if (!item ) { | 388 | if (!item ) { |
384 | closeViewMail(vm); | 389 | closeViewMail(vm); |
385 | return; | 390 | return; |
386 | } | 391 | } |
387 | mailView->setCurrentItem(item); | 392 | mailView->setCurrentItem(item); |
388 | mail = ((MailListViewItem*)item)->data(); | 393 | mail = ((MailListViewItem*)item)->data(); |
389 | RecBodyP body = folderView->fetchBody(mail); | 394 | RecBodyP body = folderView->fetchBody(mail); |
390 | vm->setBody( body ); | 395 | vm->setBody( body ); |
391 | vm->setMail( mail ); | 396 | vm->setMail( mail ); |
392 | } | 397 | } |
393 | void OpieMail::displayNextMail(ViewMail * vm) | 398 | void OpieMail::displayNextMail(ViewMail * vm) |
394 | { | 399 | { |
395 | QListViewItem*item = mailView->currentItem(); | 400 | Q3ListViewItem*item = mailView->currentItem(); |
396 | if (!item) return; | 401 | if (!item) return; |
397 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 402 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
398 | item = item->itemBelow(); | 403 | item = item->itemBelow(); |
399 | if (!item) { | 404 | if (!item) { |
400 | vm->setCaption(i18n("End of List" )); | 405 | vm->setCaption(i18n("End of List" )); |
401 | return; | 406 | return; |
402 | } | 407 | } |
403 | mailView->setCurrentItem(item); | 408 | mailView->setCurrentItem(item); |
404 | RecMailP mail = ((MailListViewItem*)item)->data(); | 409 | RecMailP mail = ((MailListViewItem*)item)->data(); |
405 | RecBodyP body = folderView->fetchBody(mail); | 410 | RecBodyP body = folderView->fetchBody(mail); |
406 | vm->setBody( body ); | 411 | vm->setBody( body ); |
407 | vm->setMail( mail ); | 412 | vm->setMail( mail ); |
408 | } | 413 | } |
409 | void OpieMail::displayMail() | 414 | void OpieMail::displayMail() |
410 | { | 415 | { |
411 | QListViewItem*item = mailView->currentItem(); | 416 | Q3ListViewItem*item = mailView->currentItem(); |
412 | if (!item) return; | 417 | if (!item) return; |
413 | RecMailP mail = ((MailListViewItem*)item)->data(); | 418 | RecMailP mail = ((MailListViewItem*)item)->data(); |
414 | RecBodyP body = folderView->fetchBody(mail); | 419 | RecBodyP body = folderView->fetchBody(mail); |
415 | ViewMail readMail( this,"", Qt::WType_Modal ); | 420 | ViewMail readMail( this,"", Qt::WType_Modal ); |
416 | readMail.setBody( body ); | 421 | readMail.setBody( body ); |
417 | readMail.setMail( mail ); | 422 | readMail.setMail( mail ); |
418 | #ifndef DESKTOP_VERSION | 423 | #ifndef DESKTOP_VERSION |
419 | readMail.showMaximized(); | 424 | readMail.showMaximized(); |
420 | #else | 425 | #else |
421 | readMail.resize( 640, 480); | 426 | readMail.resize( 640, 480); |
422 | #endif | 427 | #endif |
423 | connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); | 428 | connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); |
424 | connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); | 429 | connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); |
425 | connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); | 430 | connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); |
426 | 431 | ||
427 | readMail.exec(); | 432 | readMail.exec(); |
428 | 433 | ||
429 | if ( readMail.deleted ) | 434 | if ( readMail.deleted ) |
430 | { | 435 | { |
431 | folderView->refreshCurrent(); | 436 | folderView->refreshCurrent(); |
432 | } | 437 | } |
433 | else | 438 | else |
434 | { | 439 | { |
435 | QListViewItem*item = mailView->currentItem(); | 440 | Q3ListViewItem*item = mailView->currentItem(); |
436 | if (item) | 441 | if (item) |
437 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 442 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
438 | } | 443 | } |
439 | } | 444 | } |
440 | void OpieMail::slotGetAllMail() | 445 | void OpieMail::slotGetAllMail() |
441 | { | 446 | { |
442 | QListViewItem * item = folderView->firstChild(); | 447 | Q3ListViewItem * item = folderView->firstChild(); |
443 | while ( item ){ | 448 | while ( item ){ |
444 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 449 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
445 | item = item->nextSibling (); | 450 | item = item->nextSibling (); |
446 | } | 451 | } |
447 | } | 452 | } |
448 | void OpieMail::slotGetMail() | 453 | void OpieMail::slotGetMail() |
449 | { | 454 | { |
450 | QListViewItem * item = folderView->currentItem(); | 455 | Q3ListViewItem * item = folderView->currentItem(); |
451 | if ( ! item ) return; | 456 | if ( ! item ) return; |
452 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 457 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
453 | } | 458 | } |
454 | void OpieMail::slotDeleteMail() | 459 | void OpieMail::slotDeleteMail() |
455 | { | 460 | { |
456 | if (!mailView->currentItem()) return; | 461 | if (!mailView->currentItem()) return; |
457 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 462 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
458 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 463 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
459 | { | 464 | { |
460 | mail->Wrapper()->deleteMail( mail ); | 465 | mail->Wrapper()->deleteMail( mail ); |
461 | folderView->refreshCurrent(); | 466 | folderView->refreshCurrent(); |
462 | } | 467 | } |
463 | } | 468 | } |
464 | void OpieMail::slotDeleteAllMail() | 469 | void OpieMail::slotDeleteAllMail() |
465 | { | 470 | { |
466 | 471 | ||
467 | QValueList<RecMailP> t; | 472 | Q3ValueList<RecMailP> t; |
468 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 473 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
469 | { | 474 | { |
470 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 475 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
471 | while ( item ) { | 476 | while ( item ) { |
472 | if ( item->isSelected() ) { | 477 | if ( item->isSelected() ) { |
473 | t.append( item->data() ); | 478 | t.append( item->data() ); |
474 | } | 479 | } |
475 | item = (MailListViewItem*)item->nextSibling(); | 480 | item = (MailListViewItem*)item->nextSibling(); |
476 | } | 481 | } |
477 | } | 482 | } |
478 | else | 483 | else |
479 | return; | 484 | return; |
480 | if ( t.count() == 0 ) | 485 | if ( t.count() == 0 ) |
481 | return; | 486 | return; |
482 | RecMailP mail = t.first(); | 487 | RecMailP mail = t.first(); |
483 | mail->Wrapper()->deleteMailList(t); | 488 | mail->Wrapper()->deleteMailList(t); |
484 | folderView->refreshCurrent(); | 489 | folderView->refreshCurrent(); |
485 | 490 | ||
486 | 491 | ||
487 | } | 492 | } |
488 | void OpieMail::clearSelection() | 493 | void OpieMail::clearSelection() |
489 | { | 494 | { |
490 | mailView->clearSelection(); | 495 | mailView->clearSelection(); |
491 | 496 | ||
492 | } | 497 | } |
493 | void OpieMail::selectAll() | 498 | void OpieMail::selectAll() |
494 | { | 499 | { |
495 | QListViewItem* item = mailView->firstChild (); | 500 | Q3ListViewItem* item = mailView->firstChild (); |
496 | while ( item ) { | 501 | while ( item ) { |
497 | mailView->setSelected ( item, true ); | 502 | mailView->setSelected ( item, true ); |
498 | item = item->nextSibling(); | 503 | item = item->nextSibling(); |
499 | } | 504 | } |
500 | } | 505 | } |
501 | 506 | ||
502 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 507 | void OpieMail::mailHold(int button, Q3ListViewItem *item,const QPoint&,int ) |
503 | { | 508 | { |
504 | if (!mailView->currentItem()) return; | 509 | if (!mailView->currentItem()) return; |
505 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 510 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
506 | /* just the RIGHT button - or hold on pda */ | 511 | /* just the RIGHT button - or hold on pda */ |
507 | if (button!=2) {return;} | 512 | if (button!=2) {return;} |
508 | if (!item) return; | 513 | if (!item) return; |
509 | QPopupMenu *m = new QPopupMenu(0); | 514 | Q3PopupMenu *m = new Q3PopupMenu(0); |
510 | if (m) | 515 | if (m) |
511 | { | 516 | { |
512 | if (mailtype==MAILLIB::A_NNTP) { | 517 | if (mailtype==MAILLIB::A_NNTP) { |
513 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); | 518 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); |
514 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 519 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
515 | m->insertSeparator(); | 520 | m->insertSeparator(); |
516 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); | 521 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); |
517 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 522 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
518 | } else { | 523 | } else { |
519 | if (folderView->currentisDraft()) { | 524 | if (folderView->currentisDraft()) { |
520 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); | 525 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); |
521 | } | 526 | } |
522 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); | 527 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); |
523 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); | 528 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); |
524 | m->insertSeparator(); | 529 | m->insertSeparator(); |
525 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 530 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
526 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); | 531 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); |
527 | m->insertSeparator(); | 532 | m->insertSeparator(); |
528 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 533 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
529 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 534 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
530 | m->insertSeparator(); | 535 | m->insertSeparator(); |
531 | m->insertItem(i18n("Select all"),this,SLOT(selectAll())); | 536 | m->insertItem(i18n("Select all"),this,SLOT(selectAll())); |
532 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 537 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
533 | } | 538 | } |
534 | m->setFocus(); | 539 | m->setFocus(); |
535 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 540 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
536 | delete m; | 541 | delete m; |
537 | } | 542 | } |
538 | } | 543 | } |
539 | 544 | ||
540 | void OpieMail::slotShowFolders( bool show ) | 545 | void OpieMail::slotShowFolders( bool show ) |
541 | { | 546 | { |
542 | if ( show && folderView->isHidden() ) | 547 | if ( show && folderView->isHidden() ) |
543 | { | 548 | { |
544 | slotAdjustColumns(); | 549 | slotAdjustColumns(); |
545 | folderView->show(); | 550 | folderView->show(); |
546 | //slotAdjustColumns(); | 551 | //slotAdjustColumns(); |
547 | } | 552 | } |
548 | else if ( !show && !folderView->isHidden() ) | 553 | else if ( !show && !folderView->isHidden() ) |
549 | { | 554 | { |
550 | slotAdjustColumnsWide(); | 555 | slotAdjustColumnsWide(); |
551 | folderView->hide(); | 556 | folderView->hide(); |
552 | //slotAdjustColumnsWide(); | 557 | //slotAdjustColumnsWide(); |
553 | } | 558 | } |
554 | } | 559 | } |
555 | 560 | ||
556 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 561 | void OpieMail::refreshMailView(const Q3ValueList<RecMailP>&list) |
557 | { | 562 | { |
558 | MailListViewItem*item = 0; | 563 | MailListViewItem*item = 0; |
559 | mailView->clear(); | 564 | mailView->clear(); |
560 | 565 | ||
561 | QValueList<RecMailP>::ConstIterator it; | 566 | Q3ValueList<RecMailP>::ConstIterator it; |
562 | for (it = list.begin(); it != list.end();++it) | 567 | for (it = list.begin(); it != list.end();++it) |
563 | { | 568 | { |
564 | item = new MailListViewItem(mailView,item); | 569 | item = new MailListViewItem(mailView,item); |
565 | item->storeData((*it)); | 570 | item->storeData((*it)); |
566 | item->showEntry(); | 571 | item->showEntry(); |
567 | } | 572 | } |
568 | mailView->setSorting ( 4, false ); | 573 | mailView->setSorting ( 4, false ); |
569 | } | 574 | } |
570 | 575 | ||
571 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 576 | void OpieMail::mailLeftClicked( Q3ListViewItem *item ) |
572 | { | 577 | { |
573 | mailView->clearSelection(); | 578 | mailView->clearSelection(); |
574 | /* just LEFT button - or tap with stylus on pda */ | 579 | /* just LEFT button - or tap with stylus on pda */ |
575 | //if (button!=1) return; | 580 | //if (button!=1) return; |
576 | if (!item) return; | 581 | if (!item) return; |
577 | if (folderView->currentisDraft()) { | 582 | if (folderView->currentisDraft()) { |
578 | reEditMail(); | 583 | reEditMail(); |
579 | } else { | 584 | } else { |
580 | displayMail(); | 585 | displayMail(); |
581 | } | 586 | } |
582 | } | 587 | } |
583 | 588 | ||
584 | void OpieMail::slotMoveCopyMail() | 589 | void OpieMail::slotMoveCopyMail() |
585 | { | 590 | { |
586 | if (!mailView->currentItem()) return; | 591 | if (!mailView->currentItem()) return; |
587 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 592 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
588 | AbstractMail*targetMail = 0; | 593 | AbstractMail*targetMail = 0; |
589 | QString targetFolder = ""; | 594 | QString targetFolder = ""; |
590 | Selectstore sels; | 595 | Selectstore sels; |
591 | folderView->setupFolderselect(&sels); | 596 | folderView->setupFolderselect(&sels); |
592 | if (!sels.exec()) return; | 597 | if (!sels.exec()) return; |
593 | targetMail = sels.currentMail(); | 598 | targetMail = sels.currentMail(); |
594 | targetFolder = sels.currentFolder(); | 599 | targetFolder = sels.currentFolder(); |
595 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 600 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
596 | targetFolder.isEmpty()) | 601 | targetFolder.isEmpty()) |
597 | { | 602 | { |
598 | return; | 603 | return; |
599 | } | 604 | } |
600 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 605 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
601 | { | 606 | { |
602 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 607 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
603 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 608 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
604 | return; | 609 | return; |
605 | } | 610 | } |
606 | sels.hide(); | 611 | sels.hide(); |
607 | qApp->processEvents(); | 612 | qApp->processEvents(); |
608 | // qDebug("hiding sels "); | 613 | // qDebug("hiding sels "); |
609 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 614 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
610 | folderView->refreshCurrent(); | 615 | folderView->refreshCurrent(); |
611 | } | 616 | } |
612 | 617 | ||
613 | void OpieMail::slotMoveCopyAllMail() | 618 | void OpieMail::slotMoveCopyAllMail() |
614 | { | 619 | { |
615 | 620 | ||
616 | if (!mailView->currentItem()) return; | 621 | if (!mailView->currentItem()) return; |
617 | QValueList<RecMailP> t; | 622 | Q3ValueList<RecMailP> t; |
618 | // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 623 | // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
619 | { | 624 | { |
620 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 625 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
621 | while ( item ) { | 626 | while ( item ) { |
622 | if ( item->isSelected() ) { | 627 | if ( item->isSelected() ) { |
623 | t.append( item->data() ); | 628 | t.append( item->data() ); |
624 | } | 629 | } |
625 | item = (MailListViewItem*)item->nextSibling(); | 630 | item = (MailListViewItem*)item->nextSibling(); |
626 | } | 631 | } |
627 | } | 632 | } |
628 | // else | 633 | // else |
629 | // return; | 634 | // return; |
630 | if ( t.count() == 0 ) | 635 | if ( t.count() == 0 ) |
631 | return; | 636 | return; |
632 | RecMailP mail = t.first(); | 637 | RecMailP mail = t.first(); |
633 | AbstractMail*targetMail = 0; | 638 | AbstractMail*targetMail = 0; |
634 | QString targetFolder = ""; | 639 | QString targetFolder = ""; |
635 | Selectstore sels; | 640 | Selectstore sels; |
636 | folderView->setupFolderselect(&sels); | 641 | folderView->setupFolderselect(&sels); |
637 | if (!sels.exec()) return; | 642 | if (!sels.exec()) return; |
638 | targetMail = sels.currentMail(); | 643 | targetMail = sels.currentMail(); |
639 | targetFolder = sels.currentFolder(); | 644 | targetFolder = sels.currentFolder(); |
640 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 645 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
641 | targetFolder.isEmpty()) | 646 | targetFolder.isEmpty()) |
642 | { | 647 | { |
643 | return; | 648 | return; |
644 | } | 649 | } |
645 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 650 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
646 | { | 651 | { |
647 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 652 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
648 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 653 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
649 | return; | 654 | return; |
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index bdd9058..ea64dc4 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h | |||
@@ -1,68 +1,71 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef OPIEMAIL_H | 2 | #ifndef OPIEMAIL_H |
3 | #define OPIEMAIL_H | 3 | #define OPIEMAIL_H |
4 | 4 | ||
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | 7 | ||
8 | #include <opie2/osmartpointer.h> | 8 | #include <opie2/osmartpointer.h> |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | #include <viewmail.h> | 10 | #include <viewmail.h> |
11 | #include <qstringlist.h> | 11 | #include <qstringlist.h> |
12 | //Added by qt3to4: | ||
13 | #include <Q3CString> | ||
14 | #include <Q3ValueList> | ||
12 | 15 | ||
13 | class ComposeMail; | 16 | class ComposeMail; |
14 | 17 | ||
15 | class OpieMail : public MainWindow | 18 | class OpieMail : public MainWindow |
16 | { | 19 | { |
17 | Q_OBJECT | 20 | Q_OBJECT |
18 | 21 | ||
19 | public: | 22 | public: |
20 | OpieMail( QWidget *parent = 0, const char *name = 0 ); | 23 | OpieMail( QWidget *parent = 0, const char *name = 0 ); |
21 | virtual ~OpieMail(); | 24 | virtual ~OpieMail(); |
22 | static QString appName() { return QString::fromLatin1("kopiemail"); } | 25 | static QString appName() { return QString::fromLatin1("kopiemail"); } |
23 | 26 | ||
24 | public slots: | 27 | public slots: |
25 | virtual void slotwriteMail(const QString&name,const QString&email); | 28 | virtual void slotwriteMail(const QString&name,const QString&email); |
26 | virtual void slotwriteMail2(const QString&nameemail); | 29 | virtual void slotwriteMail2(const QString&nameemail); |
27 | virtual void slotComposeMail(); | 30 | virtual void slotComposeMail(); |
28 | virtual void slotExtAppHandler(); | 31 | virtual void slotExtAppHandler(); |
29 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 32 | virtual void appMessage(const Q3CString &msg, const QByteArray &data); |
30 | virtual void message(const QCString &msg, const QByteArray &data); | 33 | virtual void message(const Q3CString &msg, const QByteArray &data); |
31 | void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); | 34 | void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); |
32 | protected slots: | 35 | protected slots: |
33 | virtual void deleteAndDisplayNextMail(ViewMail * vm); | 36 | virtual void deleteAndDisplayNextMail(ViewMail * vm); |
34 | virtual void displayNextMail(ViewMail * vm); | 37 | virtual void displayNextMail(ViewMail * vm); |
35 | virtual void slotSendQueued(); | 38 | virtual void slotSendQueued(); |
36 | virtual void slotSearchMails(); | 39 | virtual void slotSearchMails(); |
37 | virtual void slotEditSettings(); | 40 | virtual void slotEditSettings(); |
38 | virtual void slotEditGlobalSettings(); | 41 | virtual void slotEditGlobalSettings(); |
39 | virtual void slotEditAccounts(); | 42 | virtual void slotEditAccounts(); |
40 | virtual void displayMail(); | 43 | virtual void displayMail(); |
41 | virtual void replyMail(); | 44 | virtual void replyMail(); |
42 | virtual void slotDeleteMail(); | 45 | virtual void slotDeleteMail(); |
43 | virtual void slotGetMail(); | 46 | virtual void slotGetMail(); |
44 | virtual void slotGetAllMail(); | 47 | virtual void slotGetAllMail(); |
45 | virtual void slotDeleteAllMail(); | 48 | virtual void slotDeleteAllMail(); |
46 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 49 | virtual void mailHold(int, Q3ListViewItem *,const QPoint&,int); |
47 | virtual void slotShowFolders( bool show ); | 50 | virtual void slotShowFolders( bool show ); |
48 | virtual void refreshMailView(const QValueList<RecMailP>&); | 51 | virtual void refreshMailView(const Q3ValueList<RecMailP>&); |
49 | virtual void mailLeftClicked( QListViewItem * ); | 52 | virtual void mailLeftClicked( Q3ListViewItem * ); |
50 | virtual void slotMoveCopyMail(); | 53 | virtual void slotMoveCopyMail(); |
51 | virtual void slotMoveCopyAllMail(); | 54 | virtual void slotMoveCopyAllMail(); |
52 | virtual void reEditMail(); | 55 | virtual void reEditMail(); |
53 | void clearSelection(); | 56 | void clearSelection(); |
54 | void selectAll(); | 57 | void selectAll(); |
55 | void slotDownloadMail(); | 58 | void slotDownloadMail(); |
56 | private: | 59 | private: |
57 | ComposeMail* mCurrentComposer; | 60 | ComposeMail* mCurrentComposer; |
58 | void closeViewMail(ViewMail * vm); | 61 | void closeViewMail(ViewMail * vm); |
59 | QString mPendingEmail; | 62 | QString mPendingEmail; |
60 | QString mPendingName; | 63 | QString mPendingName; |
61 | QByteArray mPendingData; | 64 | QByteArray mPendingData; |
62 | QCString mPendingMessage; | 65 | Q3CString mPendingMessage; |
63 | Settings *settings; | 66 | Settings *settings; |
64 | QTextBrowser * tb; | 67 | Q3TextBrowser * tb; |
65 | 68 | ||
66 | }; | 69 | }; |
67 | 70 | ||
68 | #endif | 71 | #endif |
diff --git a/kmicromail/qpe/qdialog.h b/kmicromail/qpe/qdialog.h index c63133d..3720182 100644 --- a/kmicromail/qpe/qdialog.h +++ b/kmicromail/qpe/qdialog.h | |||
@@ -1,29 +1,29 @@ | |||
1 | 1 | ||
2 | #ifndef MINIKDE_KDIALOG_H | 2 | #ifndef MINIKDE_KDIALOG_H |
3 | 3 | ||
4 | #ifndef DEFINE_QDIALOG_HACK | 4 | #ifndef DEFINE_QDIALOG_HACK |
5 | #define DEFINE_QDIALOG_HACK | 5 | #define DEFINE_QDIALOG_HACK |
6 | #warning call of include <qdialog.h> | 6 | #warning call of include <qdialog.h> |
7 | #warning including /usr/local/qt/include/qdialog.h | 7 | #warning including /usr/local/qt/include/qdialog.h |
8 | #warning if you get a compiling error | 8 | #warning if you get a compiling error |
9 | #warning please adjust your path here! | 9 | #warning please adjust your path here! |
10 | 10 | ||
11 | #include "/usr/local/qt/include/qdialog.h" | 11 | #include "/usr/local/qt/include/qdialog.h" |
12 | class QDialog_hacked : public QDialog | 12 | class QDialog_hacked : public QDialog |
13 | { | 13 | { |
14 | //Q__OBJECT | 14 | //Q__OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | QDialog_hacked ( QWidget * parent=0, const char * name=0, bool modal=true, WFlags f=0 ); | 17 | QDialog_hacked ( QWidget * parent=0, const char * name=0, bool modal=true, Qt::WFlags f=0 ); |
18 | 18 | ||
19 | }; | 19 | }; |
20 | 20 | ||
21 | #define QDialog QDialog_hacked | 21 | #define QDialog QDialog_hacked |
22 | 22 | ||
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #else | 25 | #else |
26 | #warning "/usr/local/qt/include/qdialog.h" for KDialog | 26 | #warning "/usr/local/qt/include/qdialog.h" for KDialog |
27 | #include "/usr/local/qt/include/qdialog.h" | 27 | #include "/usr/local/qt/include/qdialog.h" |
28 | 28 | ||
29 | #endif | 29 | #endif |
diff --git a/kmicromail/qpe/qdialog_hacked.cpp b/kmicromail/qpe/qdialog_hacked.cpp index 0a34cec..5d4d353 100644 --- a/kmicromail/qpe/qdialog_hacked.cpp +++ b/kmicromail/qpe/qdialog_hacked.cpp | |||
@@ -1,27 +1,27 @@ | |||
1 | 1 | ||
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include <qhbox.h> | 3 | #include <q3hbox.h> |
4 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
5 | #include <klocale.h> | 5 | #include <klocale.h> |
6 | #ifdef QDialog | 6 | #ifdef QDialog |
7 | #undef QDialog | 7 | #undef QDialog |
8 | #endif | 8 | #endif |
9 | QDialog_hacked::QDialog_hacked ( QWidget * parent, const char * name, bool modal, WFlags f ) | 9 | QDialog_hacked::QDialog_hacked ( QWidget * parent, const char * name, bool modal, Qt::WFlags f ) |
10 | : QDialog( parent,name,modal, f) | 10 | : QDialog( parent,name,modal, f) |
11 | { | 11 | { |
12 | qDebug("New hacked QDialog for ompi desktop"); | 12 | qDebug("New hacked QDialog for ompi desktop"); |
13 | //QTimer::singleShot( 1, this,SLOT(addaddbuttons()) ); | 13 | //QTimer::singleShot( 1, this,SLOT(addaddbuttons()) ); |
14 | 14 | ||
15 | setOrientation ( Vertical ); | 15 | setOrientation ( Vertical ); |
16 | QHBox * hb = new QHBox ( this ); | 16 | Q3HBox * hb = new Q3HBox ( this ); |
17 | QPushButton *ok = new QPushButton( i18n("OK"), hb ); | 17 | QPushButton *ok = new QPushButton( i18n("OK"), hb ); |
18 | QPushButton *cancel = new QPushButton( i18n("Cancel"), hb ); | 18 | QPushButton *cancel = new QPushButton( i18n("Cancel"), hb ); |
19 | setExtension ( hb ); | 19 | setExtension ( hb ); |
20 | showExtension ( true ); | 20 | showExtension ( true ); |
21 | connect ( ok, SIGNAL ( clicked()),this, SLOT (accept() ) ); | 21 | connect ( ok, SIGNAL ( clicked()),this, SLOT (accept() ) ); |
22 | connect ( cancel, SIGNAL ( clicked()),this, SLOT (reject() ) ); | 22 | connect ( cancel, SIGNAL ( clicked()),this, SLOT (reject() ) ); |
23 | //setWFlags(WStyle_MinMax ); | 23 | //setWFlags(WStyle_MinMax ); |
24 | 24 | ||
25 | } | 25 | } |
26 | 26 | ||
27 | 27 | ||
diff --git a/kmicromail/selectsmtp.cpp b/kmicromail/selectsmtp.cpp index 10b6d79..ead723c 100644 --- a/kmicromail/selectsmtp.cpp +++ b/kmicromail/selectsmtp.cpp | |||
@@ -1,45 +1,45 @@ | |||
1 | #include "selectsmtp.h" | 1 | #include "selectsmtp.h" |
2 | #include <libmailwrapper/mailwrapper.h> | 2 | #include <libmailwrapper/mailwrapper.h> |
3 | 3 | ||
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qlabel.h> | 9 | #include <qlabel.h> |
10 | #include <qtabwidget.h> | 10 | #include <qtabwidget.h> |
11 | #include <qlistview.h> | 11 | #include <q3listview.h> |
12 | #include <klocale.h> | 12 | #include <klocale.h> |
13 | selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, WFlags fl) | 13 | selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) |
14 | : selectstoreui(parent,name,modal,fl) | 14 | : selectstoreui(parent,name,modal,fl) |
15 | { | 15 | { |
16 | //m_smtpList.setAutoDelete(false); | 16 | //m_smtpList.setAutoDelete(false); |
17 | m_smtpList = 0; | 17 | m_smtpList = 0; |
18 | //headlabel->setText(i18n("<center>Select SMTP account to use</center>")); | 18 | //headlabel->setText(i18n("<center>Select SMTP account to use</center>")); |
19 | headlabel->hide(); | 19 | headlabel->hide(); |
20 | folderSelection->hide(); | 20 | folderSelection->hide(); |
21 | folderLabel->hide(); | 21 | folderLabel->hide(); |
22 | //accountlabel->setText(i18n("SMTP\nAccount:")); | 22 | //accountlabel->setText(i18n("SMTP\nAccount:")); |
23 | Line1->hide(); | 23 | Line1->hide(); |
24 | newFoldersel->hide(); | 24 | newFoldersel->hide(); |
25 | newFolderedit->hide(); | 25 | newFolderedit->hide(); |
26 | newFolderLabel->hide(); | 26 | newFolderLabel->hide(); |
27 | Line2->hide(); | 27 | Line2->hide(); |
28 | selMove->hide(); | 28 | selMove->hide(); |
29 | m_current_smtp = 0; | 29 | m_current_smtp = 0; |
30 | setCaption(i18n("Select SMTP Account")); | 30 | setCaption(i18n("Select SMTP Account")); |
31 | } | 31 | } |
32 | 32 | ||
33 | selectsmtp::~selectsmtp() | 33 | selectsmtp::~selectsmtp() |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | void selectsmtp::slotAccountselected(int which) | 37 | void selectsmtp::slotAccountselected(int which) |
38 | { | 38 | { |
39 | if (!m_smtpList || (unsigned)which>=m_smtpList->count() || which < 0) { | 39 | if (!m_smtpList || (unsigned)which>=m_smtpList->count() || which < 0) { |
40 | m_current_smtp = 0; | 40 | m_current_smtp = 0; |
41 | return; | 41 | return; |
42 | } | 42 | } |
43 | m_current_smtp = m_smtpList->at(which); | 43 | m_current_smtp = m_smtpList->at(which); |
44 | } | 44 | } |
45 | 45 | ||
diff --git a/kmicromail/selectsmtp.h b/kmicromail/selectsmtp.h index 9157ddf..d7accf6 100644 --- a/kmicromail/selectsmtp.h +++ b/kmicromail/selectsmtp.h | |||
@@ -1,27 +1,27 @@ | |||
1 | #ifndef __selectsmtp_h | 1 | #ifndef __selectsmtp_h |
2 | #define __selectstmp_h | 2 | #define __selectstmp_h |
3 | 3 | ||
4 | 4 | ||
5 | #include "selectstoreui.h" | 5 | #include "selectstoreui.h" |
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | 7 | ||
8 | class SMTPaccount; | 8 | class SMTPaccount; |
9 | 9 | ||
10 | class selectsmtp : public selectstoreui | 10 | class selectsmtp : public selectstoreui |
11 | { | 11 | { |
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | public: | 13 | public: |
14 | selectsmtp(QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0 ); | 14 | selectsmtp(QWidget* parent = 0, const char* name = 0, bool modal = TRUE, Qt::WFlags fl = 0 ); |
15 | virtual ~selectsmtp(); | 15 | virtual ~selectsmtp(); |
16 | void setSelectionlist(QList<SMTPaccount>*list); | 16 | void setSelectionlist(QList<SMTPaccount>*list); |
17 | SMTPaccount*selected_smtp(); | 17 | SMTPaccount*selected_smtp(); |
18 | 18 | ||
19 | protected: | 19 | protected: |
20 | QList<SMTPaccount>*m_smtpList; | 20 | QList<SMTPaccount>*m_smtpList; |
21 | SMTPaccount*m_current_smtp; | 21 | SMTPaccount*m_current_smtp; |
22 | 22 | ||
23 | protected slots: | 23 | protected slots: |
24 | virtual void slotAccountselected(int); | 24 | virtual void slotAccountselected(int); |
25 | }; | 25 | }; |
26 | 26 | ||
27 | #endif | 27 | #endif |
diff --git a/kmicromail/selectstore.h b/kmicromail/selectstore.h index 447a6ae..d312c1d 100644 --- a/kmicromail/selectstore.h +++ b/kmicromail/selectstore.h | |||
@@ -1,33 +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> | 5 | #include <q3valuelist.h> |
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include <qstringlist.h> | 7 | #include <qstringlist.h> |
8 | 8 | ||
9 | class AbstractMail; | 9 | class AbstractMail; |
10 | 10 | ||
11 | class Selectstore:public selectstoreui | 11 | class Selectstore:public selectstoreui |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | public: | 14 | public: |
15 | Selectstore(QWidget* parent = 0, const char* name = 0); | 15 | Selectstore(QWidget* parent = 0, const char* name = 0); |
16 | virtual ~Selectstore(); | 16 | virtual ~Selectstore(); |
17 | virtual void addAccounts(AbstractMail*mail,const QStringList&folders); | 17 | virtual void addAccounts(AbstractMail*mail,const QStringList&folders); |
18 | virtual QString currentFolder(); | 18 | virtual QString currentFolder(); |
19 | virtual AbstractMail*currentMail(); | 19 | virtual AbstractMail*currentMail(); |
20 | bool newFolder(); | 20 | bool newFolder(); |
21 | bool moveMails(); | 21 | bool moveMails(); |
22 | 22 | ||
23 | protected slots: | 23 | protected slots: |
24 | virtual void slotCreateNewFolder(); | 24 | virtual void slotCreateNewFolder(); |
25 | virtual void slotMoveMail(); | 25 | virtual void slotMoveMail(); |
26 | virtual void slotAccountselected(int); | 26 | virtual void slotAccountselected(int); |
27 | 27 | ||
28 | protected: | 28 | protected: |
29 | QMap<int,QStringList> folderMap; | 29 | QMap<int,QStringList> folderMap; |
30 | QMap<int,AbstractMail*> mailMap; | 30 | QMap<int,AbstractMail*> mailMap; |
31 | AbstractMail*cMail; | 31 | AbstractMail*cMail; |
32 | }; | 32 | }; |
33 | #endif | 33 | #endif |
diff --git a/kmicromail/settingsdialog.cpp b/kmicromail/settingsdialog.cpp index c593b48..889c490 100644 --- a/kmicromail/settingsdialog.cpp +++ b/kmicromail/settingsdialog.cpp | |||
@@ -1,53 +1,55 @@ | |||
1 | #include <qcheckbox.h> | 1 | #include <qcheckbox.h> |
2 | #include <qspinbox.h> | 2 | #include <qspinbox.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qtabwidget.h> | 4 | #include <qtabwidget.h> |
5 | //Added by qt3to4: | ||
6 | #include <Q3GridLayout> | ||
5 | 7 | ||
6 | #include <kconfig.h> | 8 | #include <kconfig.h> |
7 | #include <kprefs.h> | 9 | #include <kprefs.h> |
8 | #include <klocale.h> | 10 | #include <klocale.h> |
9 | #include <kglobal.h> | 11 | #include <kglobal.h> |
10 | #include <kfontdialog.h> | 12 | #include <kfontdialog.h> |
11 | 13 | ||
12 | #include "settingsdialog.h" | 14 | #include "settingsdialog.h" |
13 | 15 | ||
14 | 16 | ||
15 | SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 17 | SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) |
16 | : SettingsDialogUI( parent, name, modal, fl ) { | 18 | : SettingsDialogUI( parent, name, modal, fl ) { |
17 | 19 | ||
18 | #if 0 | 20 | #if 0 |
19 | QTabWidget *topFrame = TabWidget2; | 21 | QTabWidget *topFrame = TabWidget2; |
20 | 22 | ||
21 | QGridLayout *topLayout = new QGridLayout(topFrame,3,3); | 23 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,3,3); |
22 | topLayout->setSpacing(2); | 24 | topLayout->setSpacing(2); |
23 | topLayout->setMargin(3); | 25 | topLayout->setMargin(3); |
24 | KPrefsWidFont * tVFont; | 26 | KPrefsWidFont * tVFont; |
25 | int i = 0; | 27 | int i = 0; |
26 | KPrefsWidFont *timeLabelsFont = | 28 | KPrefsWidFont *timeLabelsFont = |
27 | addWidFont(i18n("OK"),i18n("Application(nr):"), | 29 | addWidFont(i18n("OK"),i18n("Application(nr):"), |
28 | &(mAppFont),topFrame); | 30 | &(mAppFont),topFrame); |
29 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 31 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
30 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 32 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
31 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 33 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
32 | ++i; | 34 | ++i; |
33 | 35 | ||
34 | 36 | ||
35 | timeLabelsFont = | 37 | timeLabelsFont = |
36 | addWidFont(i18n("Mon 15"),i18n("Compose Mail:"), | 38 | addWidFont(i18n("Mon 15"),i18n("Compose Mail:"), |
37 | &(mComposeFont),topFrame); | 39 | &(mComposeFont),topFrame); |
38 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 40 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
39 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 41 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
40 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 42 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
41 | ++i; | 43 | ++i; |
42 | 44 | ||
43 | KPrefsWidFont *timeBarFont = | 45 | KPrefsWidFont *timeBarFont = |
44 | addWidFont(i18n("Mon 15"),i18n("Read Mail:"), | 46 | addWidFont(i18n("Mon 15"),i18n("Read Mail:"), |
45 | &(mReadFont),topFrame); | 47 | &(mReadFont),topFrame); |
46 | topLayout->addWidget(timeBarFont->label(),i,0); | 48 | topLayout->addWidget(timeBarFont->label(),i,0); |
47 | topLayout->addWidget(timeBarFont->preview(),i,1); | 49 | topLayout->addWidget(timeBarFont->preview(),i,1); |
48 | topLayout->addWidget(timeBarFont->button(),i,2); | 50 | topLayout->addWidget(timeBarFont->button(),i,2); |
49 | ++i; | 51 | ++i; |
50 | 52 | ||
51 | readConfig(); | 53 | readConfig(); |
52 | #endif | 54 | #endif |
53 | } | 55 | } |
diff --git a/kmicromail/settingsdialog.h b/kmicromail/settingsdialog.h index 042b69f..b168226 100644 --- a/kmicromail/settingsdialog.h +++ b/kmicromail/settingsdialog.h | |||
@@ -1,30 +1,30 @@ | |||
1 | #ifndef SETTINGS_DIALOG_H | 1 | #ifndef SETTINGS_DIALOG_H |
2 | #define SETTINGS_DIALOG_H | 2 | #define SETTINGS_DIALOG_H |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | #include <qfont.h> | 5 | #include <qfont.h> |
6 | 6 | ||
7 | #include "settingsdialogui.h" | 7 | #include "settingsdialogui.h" |
8 | 8 | ||
9 | class SettingsDialog : public SettingsDialogUI { | 9 | class SettingsDialog : public SettingsDialogUI { |
10 | 10 | ||
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | SettingsDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 14 | SettingsDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); |
15 | ~SettingsDialog(); | 15 | ~SettingsDialog(); |
16 | 16 | ||
17 | private: | 17 | private: |
18 | void readConfig(); | 18 | void readConfig(); |
19 | void writeConfig(); | 19 | void writeConfig(); |
20 | QFont mAppFont, mComposeFont, mReadFont; | 20 | QFont mAppFont, mComposeFont, mReadFont; |
21 | 21 | ||
22 | private slots: | 22 | private slots: |
23 | void accept(); | 23 | void accept(); |
24 | 24 | ||
25 | 25 | ||
26 | }; | 26 | }; |
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | #endif | 30 | #endif |
diff --git a/kmicromail/statuswidget.cpp b/kmicromail/statuswidget.cpp index 19cf635..6da6f54 100644 --- a/kmicromail/statuswidget.cpp +++ b/kmicromail/statuswidget.cpp | |||
@@ -1,33 +1,33 @@ | |||
1 | #include <qtimer.h> | 1 | #include <qtimer.h> |
2 | #include <qprogressbar.h> | 2 | #include <q3progressbar.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | 4 | ||
5 | #include "statuswidget.h" | 5 | #include "statuswidget.h" |
6 | 6 | ||
7 | // the current problem I see is "locking": used exclusive by one sender | 7 | // the current problem I see is "locking": used exclusive by one sender |
8 | 8 | ||
9 | 9 | ||
10 | StatusWidget::StatusWidget( QWidget* parent, const char* name,WFlags fl ) | 10 | StatusWidget::StatusWidget( QWidget* parent, const char* name,Qt::WFlags fl ) |
11 | : StatusWidgetUI( parent, name, fl ) { | 11 | : StatusWidgetUI( parent, name, fl ) { |
12 | 12 | ||
13 | setMaximumHeight( 15 ); | 13 | setMaximumHeight( 15 ); |
14 | // hide for now since nothing reports decent progress data yet. | 14 | // hide for now since nothing reports decent progress data yet. |
15 | statusProgress->hide(); | 15 | statusProgress->hide(); |
16 | } | 16 | } |
17 | 17 | ||
18 | StatusWidget::~StatusWidget() { | 18 | StatusWidget::~StatusWidget() { |
19 | } | 19 | } |
20 | 20 | ||
21 | void StatusWidget::setText( const QString& text ) { | 21 | void StatusWidget::setText( const QString& text ) { |
22 | show(); | 22 | show(); |
23 | statusText->setText( text ); | 23 | statusText->setText( text ); |
24 | QTimer::singleShot( 5000, this, SLOT( hide() ) ); | 24 | QTimer::singleShot( 5000, this, SLOT( hide() ) ); |
25 | } | 25 | } |
26 | 26 | ||
27 | void StatusWidget::setProgress( int progress ) { | 27 | void StatusWidget::setProgress( int progress ) { |
28 | show(); | 28 | show(); |
29 | statusProgress->setProgress( progress ); | 29 | statusProgress->setProgress( progress ); |
30 | if ( progress == 100 ) { | 30 | if ( progress == 100 ) { |
31 | hide(); | 31 | hide(); |
32 | } | 32 | } |
33 | } | 33 | } |
diff --git a/kmicromail/statuswidget.h b/kmicromail/statuswidget.h index 73f0d75..1d29daf 100644 --- a/kmicromail/statuswidget.h +++ b/kmicromail/statuswidget.h | |||
@@ -1,24 +1,24 @@ | |||
1 | #ifndef STATUS_WIDGET_H | 1 | #ifndef STATUS_WIDGET_H |
2 | #define STATUS_WIDGET_H | 2 | #define STATUS_WIDGET_H |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | #include "statuswidgetui.h" | 5 | #include "statuswidgetui.h" |
6 | 6 | ||
7 | class StatusWidget : public StatusWidgetUI { | 7 | class StatusWidget : public StatusWidgetUI { |
8 | 8 | ||
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | 10 | ||
11 | public: | 11 | public: |
12 | StatusWidget( QWidget* parent = 0, const char* name = 0,WFlags fl = 0 ); | 12 | StatusWidget( QWidget* parent = 0, const char* name = 0,Qt::WFlags fl = 0 ); |
13 | ~StatusWidget(); | 13 | ~StatusWidget(); |
14 | 14 | ||
15 | 15 | ||
16 | public slots: | 16 | public slots: |
17 | 17 | ||
18 | void setText( const QString& text ); | 18 | void setText( const QString& text ); |
19 | void setProgress( int progress ); | 19 | void setProgress( int progress ); |
20 | }; | 20 | }; |
21 | 21 | ||
22 | 22 | ||
23 | #endif | 23 | #endif |
24 | 24 | ||
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 685b4e4..c9dedb0 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -1,107 +1,110 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | 3 | ||
4 | 4 | ||
5 | #include <kfiledialog.h> | 5 | #include <kfiledialog.h> |
6 | #include "koprefs.h" | 6 | #include "koprefs.h" |
7 | #include <klocale.h> | 7 | #include <klocale.h> |
8 | #include <kglobal.h> | 8 | #include <kglobal.h> |
9 | #include <kapplication.h> | 9 | #include <kapplication.h> |
10 | 10 | ||
11 | #ifdef MINIKDE_KDIALOG_H | 11 | #ifdef MINIKDE_KDIALOG_H |
12 | #undef MINIKDE_KDIALOG_H | 12 | #undef MINIKDE_KDIALOG_H |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #include "composemail.h" | 15 | #include "composemail.h" |
16 | #include "viewmail.h" | 16 | #include "viewmail.h" |
17 | 17 | ||
18 | #include <libmailwrapper/settings.h> | 18 | #include <libmailwrapper/settings.h> |
19 | #include <libmailwrapper/abstractmail.h> | 19 | #include <libmailwrapper/abstractmail.h> |
20 | #include <libmailwrapper/mailtypes.h> | 20 | #include <libmailwrapper/mailtypes.h> |
21 | 21 | ||
22 | #include <qdialog.h> | 22 | #include <qdialog.h> |
23 | 23 | ||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | 25 | ||
26 | /* QT */ | 26 | /* QT */ |
27 | #include <qtextbrowser.h> | 27 | #include <q3textbrowser.h> |
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | #include <qtextstream.h> | 29 | #include <q3textstream.h> |
30 | #include <qaction.h> | 30 | #include <qaction.h> |
31 | #include <qpopupmenu.h> | 31 | #include <q3popupmenu.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3ValueList> | ||
36 | #include <Q3VBoxLayout> | ||
34 | 37 | ||
35 | //using namespace Opie::Ui; | 38 | //using namespace Opie::Ui; |
36 | //using namespace Opie::Core; | 39 | //using namespace Opie::Core; |
37 | 40 | ||
38 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 41 | AttachItem::AttachItem(Q3ListView * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
39 | const QString&fsize,int num,const QValueList<int>&path) | 42 | const QString&fsize,int num,const Q3ValueList<int>&path) |
40 | : QListViewItem(parent,after),_partNum(num) | 43 | : Q3ListViewItem(parent,after),_partNum(num) |
41 | { | 44 | { |
42 | _path=path; | 45 | _path=path; |
43 | setText(0, mime); | 46 | setText(0, mime); |
44 | setText(1, desc); | 47 | setText(1, desc); |
45 | setText(2, file); | 48 | setText(2, file); |
46 | setText(3, fsize); | 49 | setText(3, fsize); |
47 | } | 50 | } |
48 | 51 | ||
49 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 52 | AttachItem::AttachItem(Q3ListViewItem * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
50 | const QString&fsize,int num,const QValueList<int>&path) | 53 | const QString&fsize,int num,const Q3ValueList<int>&path) |
51 | : QListViewItem(parent,after),_partNum(num) | 54 | : Q3ListViewItem(parent,after),_partNum(num) |
52 | { | 55 | { |
53 | _path=path; | 56 | _path=path; |
54 | setText(0, mime); | 57 | setText(0, mime); |
55 | setText(1, desc); | 58 | setText(1, desc); |
56 | setText(2, file); | 59 | setText(2, file); |
57 | setText(3, fsize); | 60 | setText(3, fsize); |
58 | } | 61 | } |
59 | 62 | ||
60 | bool AttachItem::isParentof(const QValueList<int>&path) | 63 | bool AttachItem::isParentof(const Q3ValueList<int>&path) |
61 | { | 64 | { |
62 | /* if not set, then no parent */ | 65 | /* if not set, then no parent */ |
63 | if (path.count()==0||_path.count()==0) return false; | 66 | if (path.count()==0||_path.count()==0) return false; |
64 | /* the parent must have one digit less then a child */ | 67 | /* the parent must have one digit less then a child */ |
65 | if (path.count()!=_path.count()+1) return false; | 68 | if (path.count()!=_path.count()+1) return false; |
66 | for (unsigned int i=0; i < _path.count();++i) | 69 | for (unsigned int i=0; i < _path.count();++i) |
67 | { | 70 | { |
68 | if (_path[i]!=path[i]) return false; | 71 | if (_path[i]!=path[i]) return false; |
69 | } | 72 | } |
70 | return true; | 73 | return true; |
71 | } | 74 | } |
72 | 75 | ||
73 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) | 76 | AttachItem* ViewMail::searchParent(const Q3ValueList<int>&path) |
74 | { | 77 | { |
75 | QListViewItemIterator it( attachments ); | 78 | Q3ListViewItemIterator it( attachments ); |
76 | for ( ; it.current(); ++it ) | 79 | for ( ; it.current(); ++it ) |
77 | { | 80 | { |
78 | AttachItem*ati = (AttachItem*)it.current(); | 81 | AttachItem*ati = (AttachItem*)it.current(); |
79 | if (ati->isParentof(path)) return ati; | 82 | if (ati->isParentof(path)) return ati; |
80 | } | 83 | } |
81 | return 0; | 84 | return 0; |
82 | } | 85 | } |
83 | 86 | ||
84 | AttachItem* ViewMail::lastChild(AttachItem*parent) | 87 | AttachItem* ViewMail::lastChild(AttachItem*parent) |
85 | { | 88 | { |
86 | if (!parent) return 0; | 89 | if (!parent) return 0; |
87 | AttachItem* item = (AttachItem*)parent->firstChild(); | 90 | AttachItem* item = (AttachItem*)parent->firstChild(); |
88 | if (!item) return item; | 91 | if (!item) return item; |
89 | AttachItem*temp=0; | 92 | AttachItem*temp=0; |
90 | while( (temp=(AttachItem*)item->nextSibling())) | 93 | while( (temp=(AttachItem*)item->nextSibling())) |
91 | { | 94 | { |
92 | item = temp; | 95 | item = temp; |
93 | } | 96 | } |
94 | return item; | 97 | return item; |
95 | } | 98 | } |
96 | 99 | ||
97 | void ViewMail::setBody(const RecBodyP&body ) | 100 | void ViewMail::setBody(const RecBodyP&body ) |
98 | { | 101 | { |
99 | 102 | ||
100 | m_body = body; | 103 | m_body = body; |
101 | m_mail[2] = body->Bodytext(); | 104 | m_mail[2] = body->Bodytext(); |
102 | m_showHtml = KOPrefs::instance()->mViewAsHtml; | 105 | m_showHtml = KOPrefs::instance()->mViewAsHtml; |
103 | if ( m_showHtml ) { | 106 | if ( m_showHtml ) { |
104 | if ( m_mail[2].find ("<html>",0,false ) > -1 ) { | 107 | if ( m_mail[2].find ("<html>",0,false ) > -1 ) { |
105 | qDebug("html mail "); | 108 | qDebug("html mail "); |
106 | } else { | 109 | } else { |
107 | qDebug("no html mail "); | 110 | qDebug("no html mail "); |
@@ -125,280 +128,280 @@ void ViewMail::setBody(const RecBodyP&body ) | |||
125 | double s = body->Description()->Size(); | 128 | double s = body->Description()->Size(); |
126 | int w; | 129 | int w; |
127 | w=0; | 130 | w=0; |
128 | 131 | ||
129 | while (s>1024) | 132 | while (s>1024) |
130 | { | 133 | { |
131 | s/=1024; | 134 | s/=1024; |
132 | ++w; | 135 | ++w; |
133 | if (w>=2) break; | 136 | if (w>=2) break; |
134 | } | 137 | } |
135 | 138 | ||
136 | QString q=""; | 139 | QString q=""; |
137 | switch(w) | 140 | switch(w) |
138 | { | 141 | { |
139 | case 1: | 142 | case 1: |
140 | q="k"; | 143 | q="k"; |
141 | break; | 144 | break; |
142 | case 2: | 145 | case 2: |
143 | q="M"; | 146 | q="M"; |
144 | break; | 147 | break; |
145 | default: | 148 | default: |
146 | break; | 149 | break; |
147 | } | 150 | } |
148 | 151 | ||
149 | { | 152 | { |
150 | /* I did not found a method to make a CONTENT reset on a QTextStream | 153 | /* I did not found a method to make a CONTENT reset on a QTextStream |
151 | so I use this construct that the stream will re-constructed in each | 154 | so I use this construct that the stream will re-constructed in each |
152 | loop. To let it work, the textstream is packed into a own area of | 155 | loop. To let it work, the textstream is packed into a own area of |
153 | code is it will be destructed after finishing its small job. | 156 | code is it will be destructed after finishing its small job. |
154 | */ | 157 | */ |
155 | QTextOStream o(&fsize); | 158 | QTextOStream o(&fsize); |
156 | if (w>0) o.precision(2); else o.precision(0); | 159 | if (w>0) o.precision(2); else o.precision(0); |
157 | o.setf(QTextStream::fixed); | 160 | o.setf(Q3TextStream::fixed); |
158 | o << s << " " << q << "Byte"; | 161 | o << s << " " << q << "Byte"; |
159 | } | 162 | } |
160 | 163 | ||
161 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); | 164 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); |
162 | QString filename = ""; | 165 | QString filename = ""; |
163 | 166 | ||
164 | for (unsigned int i = 0; i < body->Parts().count();++i) | 167 | for (unsigned int i = 0; i < body->Parts().count();++i) |
165 | { | 168 | { |
166 | filename = ""; | 169 | filename = ""; |
167 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); | 170 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); |
168 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); | 171 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); |
169 | for (;it!=body->Parts()[i]->Parameters().end();++it) | 172 | for (;it!=body->Parts()[i]->Parameters().end();++it) |
170 | { | 173 | { |
171 | if (it.key().lower()=="name") | 174 | if (it.key().lower()=="name") |
172 | { | 175 | { |
173 | filename=it.data(); | 176 | filename=it.data(); |
174 | } | 177 | } |
175 | } | 178 | } |
176 | s = body->Parts()[i]->Size(); | 179 | s = body->Parts()[i]->Size(); |
177 | w = 0; | 180 | w = 0; |
178 | while (s>1024) | 181 | while (s>1024) |
179 | { | 182 | { |
180 | s/=1024; | 183 | s/=1024; |
181 | ++w; | 184 | ++w; |
182 | if (w>=2) break; | 185 | if (w>=2) break; |
183 | } | 186 | } |
184 | switch(w) | 187 | switch(w) |
185 | { | 188 | { |
186 | case 1: | 189 | case 1: |
187 | q="k"; | 190 | q="k"; |
188 | break; | 191 | break; |
189 | case 2: | 192 | case 2: |
190 | q="M"; | 193 | q="M"; |
191 | break; | 194 | break; |
192 | default: | 195 | default: |
193 | q=""; | 196 | q=""; |
194 | break; | 197 | break; |
195 | } | 198 | } |
196 | QTextOStream o(&fsize); | 199 | QTextOStream o(&fsize); |
197 | if (w>0) o.precision(2); else o.precision(0); | 200 | if (w>0) o.precision(2); else o.precision(0); |
198 | o.setf(QTextStream::fixed); | 201 | o.setf(Q3TextStream::fixed); |
199 | o << s << " " << q << "Byte"; | 202 | o << s << " " << q << "Byte"; |
200 | desc = body->Parts()[i]->Description(); | 203 | desc = body->Parts()[i]->Description(); |
201 | parentItem = searchParent(body->Parts()[i]->Positionlist()); | 204 | parentItem = searchParent(body->Parts()[i]->Positionlist()); |
202 | if (parentItem) | 205 | if (parentItem) |
203 | { | 206 | { |
204 | AttachItem*temp = lastChild(parentItem); | 207 | AttachItem*temp = lastChild(parentItem); |
205 | if (temp) curItem = temp; | 208 | if (temp) curItem = temp; |
206 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 209 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
207 | attachments->setRootIsDecorated(true); | 210 | attachments->setRootIsDecorated(true); |
208 | curItem = parentItem; | 211 | curItem = parentItem; |
209 | } | 212 | } |
210 | else | 213 | else |
211 | { | 214 | { |
212 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 215 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
213 | } | 216 | } |
214 | } | 217 | } |
215 | } | 218 | } |
216 | 219 | ||
217 | 220 | ||
218 | void ViewMail::slotViewSource() | 221 | void ViewMail::slotViewSource() |
219 | { | 222 | { |
220 | 223 | ||
221 | if ( !sourceOn ) { | 224 | if ( !sourceOn ) { |
222 | sourceOn = true; | 225 | sourceOn = true; |
223 | viewSource->setText(i18n("View Body Text")); | 226 | viewSource->setText(i18n("View Body Text")); |
224 | encodedString*st = 0; | 227 | encodedString*st = 0; |
225 | st = m_recMail->Wrapper()->fetchRawBody(m_recMail); | 228 | st = m_recMail->Wrapper()->fetchRawBody(m_recMail); |
226 | if ( st ) { | 229 | if ( st ) { |
227 | QString source = QString::fromUtf8( st->Content(), st->Length()); | 230 | QString source = QString::fromUtf8( st->Content(), st->Length()); |
228 | browser->setText( source ); | 231 | browser->setText( source ); |
229 | delete st; | 232 | delete st; |
230 | } | 233 | } |
231 | } else | 234 | } else |
232 | setText(); | 235 | setText(); |
233 | 236 | ||
234 | 237 | ||
235 | } | 238 | } |
236 | void ViewMail::slotShowHtml( bool state ) | 239 | void ViewMail::slotShowHtml( bool state ) |
237 | { | 240 | { |
238 | m_showHtml = state; | 241 | m_showHtml = state; |
239 | setText(); | 242 | setText(); |
240 | } | 243 | } |
241 | 244 | ||
242 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) | 245 | void ViewMail::slotItemClicked( Q3ListViewItem * item , const QPoint & point, int ) |
243 | { | 246 | { |
244 | if (!item ) | 247 | if (!item ) |
245 | return; | 248 | return; |
246 | 249 | ||
247 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 250 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
248 | { | 251 | { |
249 | setText(); | 252 | setText(); |
250 | return; | 253 | return; |
251 | } | 254 | } |
252 | QPopupMenu *menu = new QPopupMenu(); | 255 | Q3PopupMenu *menu = new Q3PopupMenu(); |
253 | int ret=0; | 256 | int ret=0; |
254 | 257 | ||
255 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) | 258 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) |
256 | { | 259 | { |
257 | menu->insertItem( i18n( "Show Text" ), 1 ); | 260 | menu->insertItem( i18n( "Show Text" ), 1 ); |
258 | } | 261 | } |
259 | if (item->text(0).left(6)=="image/") { | 262 | if (item->text(0).left(6)=="image/") { |
260 | menu->insertItem(i18n("Display image preview"),2); | 263 | menu->insertItem(i18n("Display image preview"),2); |
261 | } | 264 | } |
262 | menu->insertItem( i18n( "Save Attachment" ), 0 ); | 265 | menu->insertItem( i18n( "Save Attachment" ), 0 ); |
263 | menu->insertSeparator(1); | 266 | menu->insertSeparator(1); |
264 | 267 | ||
265 | ret = menu->exec( point, 0 ); | 268 | ret = menu->exec( point, 0 ); |
266 | 269 | ||
267 | switch(ret) | 270 | switch(ret) |
268 | { | 271 | { |
269 | case 0: | 272 | case 0: |
270 | { | 273 | { |
271 | //MimeTypes types; | 274 | //MimeTypes types; |
272 | //types.insert( "all", "*" ); | 275 | //types.insert( "all", "*" ); |
273 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); | 276 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); |
274 | 277 | ||
275 | if( !str.isEmpty() ) | 278 | if( !str.isEmpty() ) |
276 | { | 279 | { |
277 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 280 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
278 | if (content) | 281 | if (content) |
279 | { | 282 | { |
280 | QFile output(str); | 283 | QFile output(str); |
281 | output.open(IO_WriteOnly); | 284 | output.open(QIODevice::WriteOnly); |
282 | output.writeBlock(content->Content(),content->Length()); | 285 | output.writeBlock(content->Content(),content->Length()); |
283 | output.close(); | 286 | output.close(); |
284 | delete content; | 287 | delete content; |
285 | } | 288 | } |
286 | } | 289 | } |
287 | } | 290 | } |
288 | break ; | 291 | break ; |
289 | 292 | ||
290 | case 2: | 293 | case 2: |
291 | { | 294 | { |
292 | #ifdef DESKTOP_VERSION | 295 | #ifdef DESKTOP_VERSION |
293 | QString tmpfile = locateLocal( "tmp", "opiemail-image"); | 296 | QString tmpfile = locateLocal( "tmp", "opiemail-image"); |
294 | #else | 297 | #else |
295 | QString tmpfile = "/tmp/opiemail-image"; | 298 | QString tmpfile = "/tmp/opiemail-image"; |
296 | #endif | 299 | #endif |
297 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 300 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
298 | if (content) { | 301 | if (content) { |
299 | QFile output(tmpfile); | 302 | QFile output(tmpfile); |
300 | output.open(IO_WriteOnly); | 303 | output.open(QIODevice::WriteOnly); |
301 | output.writeBlock(content->Content(),content->Length()); | 304 | output.writeBlock(content->Content(),content->Length()); |
302 | output.close(); | 305 | output.close(); |
303 | delete content; | 306 | delete content; |
304 | MailImageDlg iview(""); | 307 | MailImageDlg iview(""); |
305 | iview.setName(tmpfile); | 308 | iview.setName(tmpfile); |
306 | KApplication::execDialog(&iview); | 309 | KApplication::execDialog(&iview); |
307 | output.remove(); | 310 | output.remove(); |
308 | } | 311 | } |
309 | } | 312 | } |
310 | break; | 313 | break; |
311 | case 1: | 314 | case 1: |
312 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 315 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
313 | { | 316 | { |
314 | setText(); | 317 | setText(); |
315 | } | 318 | } |
316 | else | 319 | else |
317 | { | 320 | { |
318 | if ( m_recMail->Wrapper() != 0l ) | 321 | if ( m_recMail->Wrapper() != 0l ) |
319 | { // make sure that there is a wrapper , even after delete or simular actions | 322 | { // make sure that there is a wrapper , even after delete or simular actions |
320 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 323 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
321 | } | 324 | } |
322 | } | 325 | } |
323 | break; | 326 | break; |
324 | } | 327 | } |
325 | delete menu; | 328 | delete menu; |
326 | } | 329 | } |
327 | 330 | ||
328 | 331 | ||
329 | void ViewMail::setMail(const RecMailP&mail ) | 332 | void ViewMail::setMail(const RecMailP&mail ) |
330 | { | 333 | { |
331 | 334 | ||
332 | m_recMail = mail; | 335 | m_recMail = mail; |
333 | 336 | ||
334 | m_mail[0] = mail->getFrom(); | 337 | m_mail[0] = mail->getFrom(); |
335 | m_mail[1] = mail->getSubject(); | 338 | m_mail[1] = mail->getSubject(); |
336 | m_mail[3] = mail->getDate(); | 339 | m_mail[3] = mail->getDate(); |
337 | m_mail[4] = mail->Msgid(); | 340 | m_mail[4] = mail->Msgid(); |
338 | 341 | ||
339 | m_mail2[0] = mail->To(); | 342 | m_mail2[0] = mail->To(); |
340 | m_mail2[1] = mail->CC(); | 343 | m_mail2[1] = mail->CC(); |
341 | m_mail2[2] = mail->Bcc(); | 344 | m_mail2[2] = mail->Bcc(); |
342 | 345 | ||
343 | setText(); | 346 | setText(); |
344 | } | 347 | } |
345 | 348 | ||
346 | void ViewMail::slotNextMail() | 349 | void ViewMail::slotNextMail() |
347 | { | 350 | { |
348 | nextMail->blockSignals( true ); | 351 | nextMail->blockSignals( true ); |
349 | setCaption(i18n("Displaying next mail...please wait!")); | 352 | setCaption(i18n("Displaying next mail...please wait!")); |
350 | qApp->processEvents(); | 353 | qApp->processEvents(); |
351 | emit showNextMail(this); | 354 | emit showNextMail(this); |
352 | nextMail->blockSignals( false ); | 355 | nextMail->blockSignals( false ); |
353 | } | 356 | } |
354 | 357 | ||
355 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 358 | ViewMail::ViewMail( QWidget *parent, const char *name, Qt::WFlags fl) |
356 | : ViewMailBase(parent, name, fl), _inLoop(false) | 359 | : ViewMailBase(parent, name, fl), _inLoop(false) |
357 | { | 360 | { |
358 | m_gotBody = false; | 361 | m_gotBody = false; |
359 | deleted = false; | 362 | deleted = false; |
360 | sourceOn = false; | 363 | sourceOn = false; |
361 | readConfig(); | 364 | readConfig(); |
362 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); | 365 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); |
363 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); | 366 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); |
364 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); | 367 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); |
365 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); | 368 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); |
366 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 369 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
367 | connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); | 370 | connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); |
368 | connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); | 371 | connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); |
369 | connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); | 372 | connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); |
370 | 373 | ||
371 | attachments->setEnabled(m_gotBody); | 374 | attachments->setEnabled(m_gotBody); |
372 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); | 375 | connect( attachments, SIGNAL( clicked(Q3ListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(Q3ListViewItem*,const QPoint&, int) ) ); |
373 | 376 | ||
374 | attachments->setSorting(-1); | 377 | attachments->setSorting(-1); |
375 | } | 378 | } |
376 | 379 | ||
377 | void ViewMail::readConfig() | 380 | void ViewMail::readConfig() |
378 | { | 381 | { |
379 | 382 | ||
380 | setFont ( KOPrefs::instance()->mReadFont ); | 383 | setFont ( KOPrefs::instance()->mReadFont ); |
381 | m_showHtml = KOPrefs::instance()->mViewAsHtml; | 384 | m_showHtml = KOPrefs::instance()->mViewAsHtml; |
382 | showHtml->setOn( m_showHtml ); | 385 | showHtml->setOn( m_showHtml ); |
383 | } | 386 | } |
384 | 387 | ||
385 | void ViewMail::setText() | 388 | void ViewMail::setText() |
386 | { | 389 | { |
387 | 390 | ||
388 | viewSource->setText(i18n("View Source")); | 391 | viewSource->setText(i18n("View Source")); |
389 | sourceOn = false; | 392 | sourceOn = false; |
390 | QString toString; | 393 | QString toString; |
391 | QString ccString; | 394 | QString ccString; |
392 | QString bccString; | 395 | QString bccString; |
393 | 396 | ||
394 | 397 | ||
395 | toString = m_mail2[0].join(","); | 398 | toString = m_mail2[0].join(","); |
396 | ccString = m_mail2[1].join(","); | 399 | ccString = m_mail2[1].join(","); |
397 | bccString = m_mail2[2].join(","); | 400 | bccString = m_mail2[2].join(","); |
398 | 401 | ||
399 | #ifdef DESKTOP_VERSION | 402 | #ifdef DESKTOP_VERSION |
400 | setCaption( i18n("Size: ")+m_recMail->MsgsizeString()+" - "+i18n("E-Mail by %1").arg( m_mail[0] ) ); | 403 | setCaption( i18n("Size: ")+m_recMail->MsgsizeString()+" - "+i18n("E-Mail by %1").arg( m_mail[0] ) ); |
401 | #else | 404 | #else |
402 | setCaption( m_recMail->MsgsizeString()+" - "+m_mail[0] ); | 405 | setCaption( m_recMail->MsgsizeString()+" - "+m_mail[0] ); |
403 | #endif | 406 | #endif |
404 | 407 | ||
@@ -528,52 +531,52 @@ void ViewMail::slotForward() | |||
528 | if (!m_mail[0].isNull()) | 531 | if (!m_mail[0].isNull()) |
529 | ftext += QString("From: %1\n") | 532 | ftext += QString("From: %1\n") |
530 | .arg( m_mail[0] ); | 533 | .arg( m_mail[0] ); |
531 | if (!m_mail[1].isNull()) | 534 | if (!m_mail[1].isNull()) |
532 | ftext += QString("Subject: %1\n") | 535 | ftext += QString("Subject: %1\n") |
533 | .arg( m_mail[1] ); | 536 | .arg( m_mail[1] ); |
534 | 537 | ||
535 | ftext += QString("\n%1\n") | 538 | ftext += QString("\n%1\n") |
536 | .arg( m_mail[2]); | 539 | .arg( m_mail[2]); |
537 | 540 | ||
538 | ftext += QString("----- End forwarded message -----\n"); | 541 | ftext += QString("----- End forwarded message -----\n"); |
539 | 542 | ||
540 | Settings *settings = new Settings(); | 543 | Settings *settings = new Settings(); |
541 | ComposeMail composer( settings ,this, 0, true); | 544 | ComposeMail composer( settings ,this, 0, true); |
542 | composer.setSubject( "Fwd: " + m_mail[1] ); | 545 | composer.setSubject( "Fwd: " + m_mail[1] ); |
543 | composer.setMessage( ftext ); | 546 | composer.setMessage( ftext ); |
544 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) | 547 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) |
545 | { | 548 | { |
546 | } | 549 | } |
547 | } | 550 | } |
548 | 551 | ||
549 | void ViewMail::slotDeleteMail( ) | 552 | void ViewMail::slotDeleteMail( ) |
550 | { | 553 | { |
551 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 554 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
552 | { | 555 | { |
553 | emit deleteAndDisplayNextMail( this); | 556 | emit deleteAndDisplayNextMail( this); |
554 | //m_recMail->Wrapper()->deleteMail( m_recMail ); | 557 | //m_recMail->Wrapper()->deleteMail( m_recMail ); |
555 | //hide(); | 558 | //hide(); |
556 | deleted = true; | 559 | deleted = true; |
557 | } | 560 | } |
558 | } | 561 | } |
559 | 562 | ||
560 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) | 563 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, Qt::WFlags f) |
561 | : QDialog(parent,name,modal) | 564 | : QDialog(parent,name,modal) |
562 | { | 565 | { |
563 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 566 | Q3VBoxLayout*dlglayout = new Q3VBoxLayout(this); |
564 | dlglayout->setSpacing(2); | 567 | dlglayout->setSpacing(2); |
565 | dlglayout->setMargin(1); | 568 | dlglayout->setMargin(1); |
566 | //m_imageview = new Opie::MM::OImageScrollView(this); | 569 | //m_imageview = new Opie::MM::OImageScrollView(this); |
567 | //dlglayout->addWidget(m_imageview); | 570 | //dlglayout->addWidget(m_imageview); |
568 | } | 571 | } |
569 | 572 | ||
570 | MailImageDlg::~MailImageDlg() | 573 | MailImageDlg::~MailImageDlg() |
571 | { | 574 | { |
572 | } | 575 | } |
573 | 576 | ||
574 | void MailImageDlg::setName(const QString&fname) | 577 | void MailImageDlg::setName(const QString&fname) |
575 | { | 578 | { |
576 | qDebug("viewmail.cpp: MailImageDlg::setName Pending"); | 579 | qDebug("viewmail.cpp: MailImageDlg::setName Pending"); |
577 | // m_imageview->setImage(fname); | 580 | // m_imageview->setImage(fname); |
578 | } | 581 | } |
579 | 582 | ||
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h index bb5b685..6cf6efb 100644 --- a/kmicromail/viewmail.h +++ b/kmicromail/viewmail.h | |||
@@ -1,93 +1,93 @@ | |||
1 | #ifndef VIEWMAIL_H | 1 | #ifndef VIEWMAIL_H |
2 | #define VIEWMAIL_H | 2 | #define VIEWMAIL_H |
3 | 3 | ||
4 | #include "viewmailbase.h" | 4 | #include "viewmailbase.h" |
5 | #include <libmailwrapper/mailtypes.h> | 5 | #include <libmailwrapper/mailtypes.h> |
6 | 6 | ||
7 | #include <qdialog.h> | 7 | #include <qdialog.h> |
8 | #include <qapplication.h> | 8 | #include <qapplication.h> |
9 | 9 | ||
10 | #include <qlistview.h> | 10 | #include <q3listview.h> |
11 | #include <qmap.h> | 11 | #include <qmap.h> |
12 | #include <klocale.h> | 12 | #include <klocale.h> |
13 | #include <qstringlist.h> | 13 | #include <qstringlist.h> |
14 | #include <qvaluelist.h> | 14 | #include <q3valuelist.h> |
15 | 15 | ||
16 | //namespace Opie { namespace MM { class OImageScrollView; } } | 16 | //namespace Opie { namespace MM { class OImageScrollView; } } |
17 | 17 | ||
18 | class AttachItem : public QListViewItem | 18 | class AttachItem : public Q3ListViewItem |
19 | { | 19 | { |
20 | public: | 20 | public: |
21 | AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 21 | AttachItem(Q3ListView * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
22 | const QString&fsize,int num,const QValueList<int>&path); | 22 | const QString&fsize,int num,const Q3ValueList<int>&path); |
23 | AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 23 | AttachItem(Q3ListViewItem * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
24 | const QString&fsize,int num,const QValueList<int>&path); | 24 | const QString&fsize,int num,const Q3ValueList<int>&path); |
25 | int Partnumber() { return _partNum; } | 25 | int Partnumber() { return _partNum; } |
26 | bool isParentof(const QValueList<int>&path); | 26 | bool isParentof(const Q3ValueList<int>&path); |
27 | 27 | ||
28 | private: | 28 | private: |
29 | int _partNum; | 29 | int _partNum; |
30 | /* needed for a better display of attachments */ | 30 | /* needed for a better display of attachments */ |
31 | QValueList<int> _path; | 31 | Q3ValueList<int> _path; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | class ViewMail : public ViewMailBase | 34 | class ViewMail : public ViewMailBase |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 39 | ViewMail( QWidget *parent = 0, const char *name = 0, Qt::WFlags fl = 0); |
40 | ~ViewMail(); | 40 | ~ViewMail(); |
41 | 41 | ||
42 | void hide(); | 42 | void hide(); |
43 | void exec(); | 43 | void exec(); |
44 | void setMail(const RecMailP&mail ); | 44 | void setMail(const RecMailP&mail ); |
45 | void setBody(const RecBodyP&body); | 45 | void setBody(const RecBodyP&body); |
46 | bool deleted; | 46 | bool deleted; |
47 | signals: | 47 | signals: |
48 | void showNextMail(ViewMail*); | 48 | void showNextMail(ViewMail*); |
49 | void deleteAndDisplayNextMail(ViewMail *); | 49 | void deleteAndDisplayNextMail(ViewMail *); |
50 | void signalDownloadMail(); | 50 | void signalDownloadMail(); |
51 | protected: | 51 | protected: |
52 | QString deHtml(const QString &string); | 52 | QString deHtml(const QString &string); |
53 | AttachItem* searchParent(const QValueList<int>&path); | 53 | AttachItem* searchParent(const Q3ValueList<int>&path); |
54 | AttachItem* lastChild(AttachItem*parent); | 54 | AttachItem* lastChild(AttachItem*parent); |
55 | 55 | ||
56 | protected slots: | 56 | protected slots: |
57 | void slotNextMail(); | 57 | void slotNextMail(); |
58 | void slotReply(); | 58 | void slotReply(); |
59 | void slotForward(); | 59 | void slotForward(); |
60 | void setText(); | 60 | void setText(); |
61 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); | 61 | void slotItemClicked( Q3ListViewItem * item , const QPoint & point, int c ); |
62 | void slotDeleteMail( ); | 62 | void slotDeleteMail( ); |
63 | void slotShowHtml( bool ); | 63 | void slotShowHtml( bool ); |
64 | void slotViewSource(); | 64 | void slotViewSource(); |
65 | 65 | ||
66 | private: | 66 | private: |
67 | void readConfig(); | 67 | void readConfig(); |
68 | bool sourceOn;; | 68 | bool sourceOn;; |
69 | bool _inLoop; | 69 | bool _inLoop; |
70 | QString m_mailHtml; | 70 | QString m_mailHtml; |
71 | bool m_gotBody; | 71 | bool m_gotBody; |
72 | RecBodyP m_body; | 72 | RecBodyP m_body; |
73 | RecMailP m_recMail; | 73 | RecMailP m_recMail; |
74 | bool m_showHtml; | 74 | bool m_showHtml; |
75 | 75 | ||
76 | // 0 from 1 subject 2 bodytext 3 date | 76 | // 0 from 1 subject 2 bodytext 3 date |
77 | QMap <int,QString> m_mail; | 77 | QMap <int,QString> m_mail; |
78 | // 0 to 1 cc 2 bcc | 78 | // 0 to 1 cc 2 bcc |
79 | QMap <int,QStringList> m_mail2; | 79 | QMap <int,QStringList> m_mail2; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | class MailImageDlg:public QDialog | 82 | class MailImageDlg:public QDialog |
83 | { | 83 | { |
84 | Q_OBJECT | 84 | Q_OBJECT |
85 | public: | 85 | public: |
86 | MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); | 86 | MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, Qt::WFlags f = 0); |
87 | ~MailImageDlg(); | 87 | ~MailImageDlg(); |
88 | void setName(const QString&); | 88 | void setName(const QString&); |
89 | protected: | 89 | protected: |
90 | //Opie::MM::OImageScrollView*m_imageview; | 90 | //Opie::MM::OImageScrollView*m_imageview; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | #endif | 93 | #endif |
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp index 3bb964e..371ee91 100644 --- a/kmicromail/viewmailbase.cpp +++ b/kmicromail/viewmailbase.cpp | |||
@@ -1,109 +1,112 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | #include <qtextbrowser.h> | 2 | #include <q3textbrowser.h> |
3 | #include <qlistview.h> | 3 | #include <q3listview.h> |
4 | #include <qaction.h> | 4 | #include <qaction.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qvbox.h> | 6 | #include <q3vbox.h> |
7 | #include <qapplication.h> | 7 | #include <qapplication.h> |
8 | 8 | ||
9 | #include <qtoolbar.h> | 9 | #include <q3toolbar.h> |
10 | #include <qmenubar.h> | 10 | #include <qmenubar.h> |
11 | //Added by qt3to4: | ||
12 | #include <QKeyEvent> | ||
13 | #include <Q3PopupMenu> | ||
11 | #include <kiconloader.h> | 14 | #include <kiconloader.h> |
12 | //#include <qpe/resource.h> | 15 | //#include <qpe/resource.h> |
13 | #include <klocale.h> | 16 | #include <klocale.h> |
14 | 17 | ||
15 | #include "viewmailbase.h" | 18 | #include "viewmailbase.h" |
16 | //#include "opendiag.h" | 19 | //#include "opendiag.h" |
17 | 20 | ||
18 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) | 21 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, Qt::WFlags fl) |
19 | : QMainWindow(parent, name, fl) | 22 | : Q3MainWindow(parent, name, fl) |
20 | { | 23 | { |
21 | 24 | ||
22 | setToolBarsMovable(false); | 25 | setToolBarsMovable(false); |
23 | 26 | ||
24 | toolbar = new QToolBar(this); | 27 | toolbar = new Q3ToolBar(this); |
25 | menubar = new QMenuBar( toolbar ); | 28 | menubar = new QMenuBar( toolbar ); |
26 | mailmenu = new QPopupMenu( menubar ); | 29 | mailmenu = new Q3PopupMenu( menubar ); |
27 | menubar->insertItem( i18n( "Mail" ), mailmenu ); | 30 | menubar->insertItem( i18n( "Mail" ), mailmenu ); |
28 | 31 | ||
29 | toolbar->setHorizontalStretchable(true); | 32 | toolbar->setHorizontalStretchable(true); |
30 | addToolBar(toolbar); | 33 | addToolBar(toolbar); |
31 | 34 | ||
32 | viewSource = new QAction(i18n("View Source"), 0, 0, this); | 35 | viewSource = new QAction(i18n("View Source"), 0, 0, this); |
33 | viewSource->addTo(mailmenu); | 36 | viewSource->addTo(mailmenu); |
34 | 37 | ||
35 | downloadMail= new QAction(i18n("Download Mail"),SmallIcon("add"), 0, 0, this); | 38 | downloadMail= new QAction(i18n("Download Mail"),SmallIcon("add"), 0, 0, this); |
36 | downloadMail->addTo(toolbar); | 39 | downloadMail->addTo(toolbar); |
37 | downloadMail->addTo(mailmenu); | 40 | downloadMail->addTo(mailmenu); |
38 | 41 | ||
39 | 42 | ||
40 | reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this); | 43 | reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this); |
41 | reply->addTo(toolbar); | 44 | reply->addTo(toolbar); |
42 | reply->addTo(mailmenu); | 45 | reply->addTo(mailmenu); |
43 | 46 | ||
44 | forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this); | 47 | forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this); |
45 | forward->addTo(toolbar); | 48 | forward->addTo(toolbar); |
46 | forward->addTo(mailmenu); | 49 | forward->addTo(mailmenu); |
47 | 50 | ||
48 | attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); | 51 | attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); |
49 | attachbutton->addTo(toolbar); | 52 | attachbutton->addTo(toolbar); |
50 | attachbutton->addTo(mailmenu); | 53 | attachbutton->addTo(mailmenu); |
51 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); | 54 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); |
52 | 55 | ||
53 | showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); | 56 | showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); |
54 | showHtml->addTo( toolbar ); | 57 | showHtml->addTo( toolbar ); |
55 | showHtml->addTo( mailmenu ); | 58 | showHtml->addTo( mailmenu ); |
56 | 59 | ||
57 | deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this); | 60 | deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this); |
58 | deleteMail->addTo(toolbar); | 61 | deleteMail->addTo(toolbar); |
59 | deleteMail->addTo(mailmenu); | 62 | deleteMail->addTo(mailmenu); |
60 | 63 | ||
61 | nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this); | 64 | nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this); |
62 | QLabel *spacer = new QLabel(toolbar); | 65 | QLabel *spacer = new QLabel(toolbar); |
63 | nextMail->addTo(toolbar); | 66 | nextMail->addTo(toolbar); |
64 | nextMail->addTo(mailmenu); | 67 | nextMail->addTo(mailmenu); |
65 | 68 | ||
66 | closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); | 69 | closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); |
67 | //QLabel *spacer = new QLabel(toolbar); | 70 | //QLabel *spacer = new QLabel(toolbar); |
68 | spacer->setBackgroundMode(QWidget::PaletteButton); | 71 | spacer->setBackgroundMode(QWidget::PaletteButton); |
69 | toolbar->setStretchableWidget(spacer); | 72 | toolbar->setStretchableWidget(spacer); |
70 | closeMail->addTo(toolbar); | 73 | closeMail->addTo(toolbar); |
71 | closeMail->addTo(mailmenu); | 74 | closeMail->addTo(mailmenu); |
72 | QVBox *view = new QVBox(this); | 75 | Q3VBox *view = new Q3VBox(this); |
73 | setCentralWidget(view); | 76 | setCentralWidget(view); |
74 | 77 | ||
75 | attachments = new QListView(view); | 78 | attachments = new Q3ListView(view); |
76 | int fixh = 100; | 79 | int fixh = 100; |
77 | if ( QApplication::desktop()->width() > 320 ) | 80 | if ( QApplication::desktop()->width() > 320 ) |
78 | fixh = 200; | 81 | fixh = 200; |
79 | attachments->setFixedHeight(fixh); | 82 | attachments->setFixedHeight(fixh); |
80 | attachments->setAllColumnsShowFocus(true); | 83 | attachments->setAllColumnsShowFocus(true); |
81 | attachments->addColumn("Mime Type", fixh-30); | 84 | attachments->addColumn("Mime Type", fixh-30); |
82 | attachments->addColumn(i18n("Description"), 100); | 85 | attachments->addColumn(i18n("Description"), 100); |
83 | attachments->addColumn(i18n("Filename"), 80); | 86 | attachments->addColumn(i18n("Filename"), 80); |
84 | attachments->addColumn(i18n("Size"), 80); | 87 | attachments->addColumn(i18n("Size"), 80); |
85 | attachments->setSorting(-1); | 88 | attachments->setSorting(-1); |
86 | attachments->hide(); | 89 | attachments->hide(); |
87 | 90 | ||
88 | browser = new QTextBrowser(view); | 91 | browser = new Q3TextBrowser(view); |
89 | 92 | ||
90 | //openDiag = new OpenDiag(view); | 93 | //openDiag = new OpenDiag(view); |
91 | //openDiag->hide(); | 94 | //openDiag->hide(); |
92 | 95 | ||
93 | } | 96 | } |
94 | 97 | ||
95 | void ViewMailBase::slotChangeAttachview(bool state) | 98 | void ViewMailBase::slotChangeAttachview(bool state) |
96 | { | 99 | { |
97 | if (state) attachments->show(); | 100 | if (state) attachments->show(); |
98 | else attachments->hide(); | 101 | else attachments->hide(); |
99 | } | 102 | } |
100 | 103 | ||
101 | void ViewMailBase::keyPressEvent ( QKeyEvent * e ) | 104 | void ViewMailBase::keyPressEvent ( QKeyEvent * e ) |
102 | { | 105 | { |
103 | if( e->key()==Qt::Key_Escape ) { | 106 | if( e->key()==Qt::Key_Escape ) { |
104 | close(); | 107 | close(); |
105 | e->accept(); | 108 | e->accept(); |
106 | return; | 109 | return; |
107 | } | 110 | } |
108 | QWidget::keyPressEvent(e); | 111 | QWidget::keyPressEvent(e); |
109 | } | 112 | } |
diff --git a/kmicromail/viewmailbase.h b/kmicromail/viewmailbase.h index 7c075eb..3f1dead 100644 --- a/kmicromail/viewmailbase.h +++ b/kmicromail/viewmailbase.h | |||
@@ -1,44 +1,47 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | #ifndef VIEWMAILBASE_H | 2 | #ifndef VIEWMAILBASE_H |
3 | #define VIEWMAILBASE_H | 3 | #define VIEWMAILBASE_H |
4 | 4 | ||
5 | #include <qmainwindow.h> | 5 | #include <q3mainwindow.h> |
6 | //Added by qt3to4: | ||
7 | #include <Q3PopupMenu> | ||
8 | #include <QKeyEvent> | ||
6 | 9 | ||
7 | #ifndef DESKTOP_VERSION | 10 | #ifndef DESKTOP_VERSION |
8 | #include <qpe/qpemenubar.h> | 11 | #include <qpe/qpemenubar.h> |
9 | #define QMenuBar QPEMenuBar | 12 | #define QMenuBar QPEMenuBar |
10 | #endif | 13 | #endif |
11 | 14 | ||
12 | class QAction; | 15 | class QAction; |
13 | class OpenDiag; | 16 | class OpenDiag; |
14 | class QListView; | 17 | class Q3ListView; |
15 | class QToolBar; | 18 | class Q3ToolBar; |
16 | class QTextBrowser; | 19 | class Q3TextBrowser; |
17 | class QMenuBar; | 20 | class QMenuBar; |
18 | class QPopupMenu; | 21 | class Q3PopupMenu; |
19 | 22 | ||
20 | class ViewMailBase : public QMainWindow | 23 | class ViewMailBase : public Q3MainWindow |
21 | { | 24 | { |
22 | Q_OBJECT | 25 | Q_OBJECT |
23 | 26 | ||
24 | public: | 27 | public: |
25 | ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 28 | ViewMailBase(QWidget *parent = 0, const char *name = 0, Qt::WFlags fl = 0); |
26 | 29 | ||
27 | protected: | 30 | protected: |
28 | QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail, *downloadMail, *viewSource; | 31 | QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail, *downloadMail, *viewSource; |
29 | QListView *attachments; | 32 | Q3ListView *attachments; |
30 | QToolBar *toolbar; | 33 | Q3ToolBar *toolbar; |
31 | QTextBrowser *browser; | 34 | Q3TextBrowser *browser; |
32 | OpenDiag *openDiag; | 35 | OpenDiag *openDiag; |
33 | QMenuBar *menubar; | 36 | QMenuBar *menubar; |
34 | QPopupMenu *mailmenu; | 37 | Q3PopupMenu *mailmenu; |
35 | 38 | ||
36 | protected slots: | 39 | protected slots: |
37 | void slotChangeAttachview(bool state); | 40 | void slotChangeAttachview(bool state); |
38 | virtual void keyPressEvent ( QKeyEvent * e ); | 41 | virtual void keyPressEvent ( QKeyEvent * e ); |
39 | 42 | ||
40 | 43 | ||
41 | }; | 44 | }; |
42 | 45 | ||
43 | #endif | 46 | #endif |
44 | 47 | ||