author | zautrix <zautrix> | 2004-09-11 08:56:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-11 08:56:57 (UTC) |
commit | 0f45c977d7530b6ca827b7a7c7da7469f01800ca (patch) (unidiff) | |
tree | 0368bbd4865a0b21bb197cfd0a190fd0c2cd9242 /kmicromail | |
parent | 1b41a0e3bf63364940daf132446939e3570c57ad (diff) | |
download | kdepimpi-0f45c977d7530b6ca827b7a7c7da7469f01800ca.zip kdepimpi-0f45c977d7530b6ca827b7a7c7da7469f01800ca.tar.gz kdepimpi-0f45c977d7530b6ca827b7a7c7da7469f01800ca.tar.bz2 |
More config changes
-rw-r--r-- | kmicromail/accountitem.cpp | 12 | ||||
-rw-r--r-- | kmicromail/accountitem.h | 1 | ||||
-rw-r--r-- | kmicromail/accountview.cpp | 27 | ||||
-rw-r--r-- | kmicromail/accountview.h | 1 | ||||
-rw-r--r-- | kmicromail/imapconfigui.ui | 506 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.cpp | 14 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.h | 4 | ||||
-rw-r--r-- | kmicromail/pop3configui.ui | 19 |
8 files changed, 434 insertions, 150 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index d0321ef..1698b40 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -1,265 +1,275 @@ | |||
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 <qpopupmenu.h> |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | #include <kiconloader.h> | 17 | #include <kiconloader.h> |
18 | 18 | ||
19 | using namespace Opie::Core; | 19 | using namespace Opie::Core; |
20 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} | 20 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} |
21 | /** | 21 | /** |
22 | * POP3 Account stuff | 22 | * POP3 Account stuff |
23 | */ | 23 | */ |
24 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | 24 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) |
25 | : AccountViewItem( parent ) | 25 | : AccountViewItem( parent ) |
26 | { | 26 | { |
27 | account = a; | 27 | account = a; |
28 | wrapper = AbstractMail::getWrapper( account ); | 28 | wrapper = AbstractMail::getWrapper( account ); |
29 | SETPIX(PIXMAP_POP3FOLDER); | 29 | SETPIX(PIXMAP_POP3FOLDER); |
30 | #if 0 | 30 | #if 0 |
31 | if (!account->getOffline()) | 31 | if (!account->getOffline()) |
32 | { | 32 | { |
33 | setPixmap( 0, ); | 33 | setPixmap( 0, ); |
34 | } | 34 | } |
35 | else | 35 | else |
36 | { | 36 | { |
37 | setPixmap( 0, PIXMAP_OFFLINE ); | 37 | setPixmap( 0, PIXMAP_OFFLINE ); |
38 | } | 38 | } |
39 | #endif | 39 | #endif |
40 | setText( 0, account->getAccountName() ); | 40 | setText( 0, account->getAccountName() ); |
41 | setOpen( true ); | 41 | setOpen( true ); |
42 | } | 42 | } |
43 | 43 | ||
44 | POP3viewItem::~POP3viewItem() | 44 | POP3viewItem::~POP3viewItem() |
45 | { | 45 | { |
46 | delete wrapper; | 46 | delete wrapper; |
47 | } | 47 | } |
48 | 48 | ||
49 | AbstractMail *POP3viewItem::getWrapper() | 49 | AbstractMail *POP3viewItem::getWrapper() |
50 | { | 50 | { |
51 | return wrapper; | 51 | return wrapper; |
52 | } | 52 | } |
53 | 53 | ||
54 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) | 54 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) |
55 | { | 55 | { |
56 | refresh(); | 56 | refresh(); |
57 | } | 57 | } |
58 | 58 | ||
59 | void POP3viewItem::refresh() | 59 | void POP3viewItem::refresh() |
60 | { | 60 | { |
61 | if (account->getOffline()) return; | 61 | if (account->getOffline()) return; |
62 | QValueList<FolderP> *folders = wrapper->listFolders(); | 62 | QValueList<FolderP> *folders = wrapper->listFolders(); |
63 | QListViewItem *child = firstChild(); | 63 | QListViewItem *child = firstChild(); |
64 | while ( child ) | 64 | while ( child ) |
65 | { | 65 | { |
66 | QListViewItem *tmp = child; | 66 | QListViewItem *tmp = child; |
67 | child = child->nextSibling(); | 67 | child = child->nextSibling(); |
68 | delete tmp; | 68 | delete tmp; |
69 | } | 69 | } |
70 | QValueList<FolderP>::ConstIterator it; | 70 | QValueList<FolderP>::ConstIterator it; |
71 | QListViewItem*item = 0; | 71 | QListViewItem*item = 0; |
72 | for ( it = folders->begin(); it!=folders->end(); ++it) | 72 | for ( it = folders->begin(); it!=folders->end(); ++it) |
73 | { | 73 | { |
74 | item = new POP3folderItem( (*it), this , item ); | 74 | item = new POP3folderItem( (*it), this , item ); |
75 | item->setSelectable( (*it)->may_select()); | 75 | item->setSelectable( (*it)->may_select()); |
76 | } | 76 | } |
77 | delete folders; | 77 | delete folders; |
78 | } | 78 | } |
79 | 79 | ||
80 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 80 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
81 | { | 81 | { |
82 | 82 | ||
83 | return wrapper->fetchBody( mail ); | 83 | return wrapper->fetchBody( mail ); |
84 | } | 84 | } |
85 | 85 | ||
86 | QPopupMenu * POP3viewItem::getContextMenu() | 86 | QPopupMenu * POP3viewItem::getContextMenu() |
87 | { | 87 | { |
88 | QPopupMenu *m = new QPopupMenu(0); | 88 | QPopupMenu *m = new QPopupMenu(0); |
89 | if (m) | 89 | if (m) |
90 | { | 90 | { |
91 | if (!account->getOffline()) | 91 | if (!account->getOffline()) |
92 | { | 92 | { |
93 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 93 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
94 | m->insertItem(QObject::tr("Set offline",contextName),1); | 94 | m->insertItem(QObject::tr("Set offline",contextName),1); |
95 | m->insertItem(QObject::tr("Download messages",contextName),2); | ||
95 | } | 96 | } |
96 | else | 97 | else |
97 | { | 98 | { |
98 | m->insertItem(QObject::tr("Set online",contextName),1); | 99 | m->insertItem(QObject::tr("Set online",contextName),1); |
99 | } | 100 | } |
100 | } | 101 | } |
101 | return m; | 102 | return m; |
102 | } | 103 | } |
103 | 104 | ||
104 | void POP3viewItem::disconnect() | 105 | void POP3viewItem::disconnect() |
105 | { | 106 | { |
106 | QListViewItem *child = firstChild(); | 107 | QListViewItem *child = firstChild(); |
107 | while ( child ) | 108 | while ( child ) |
108 | { | 109 | { |
109 | QListViewItem *tmp = child; | 110 | QListViewItem *tmp = child; |
110 | child = child->nextSibling(); | 111 | child = child->nextSibling(); |
111 | delete tmp; | 112 | delete tmp; |
112 | } | 113 | } |
113 | wrapper->logout(); | 114 | wrapper->logout(); |
114 | } | 115 | } |
115 | 116 | ||
116 | void POP3viewItem::setOnOffline() | 117 | void POP3viewItem::setOnOffline() |
117 | { | 118 | { |
118 | if (!account->getOffline()) | 119 | if (!account->getOffline()) |
119 | { | 120 | { |
120 | disconnect(); | 121 | disconnect(); |
121 | } | 122 | } |
122 | account->setOffline(!account->getOffline()); | 123 | account->setOffline(!account->getOffline()); |
123 | account->save(); | 124 | account->save(); |
124 | SETPIX(PIXMAP_POP3FOLDER); | 125 | SETPIX(PIXMAP_POP3FOLDER); |
125 | refresh(); | 126 | refresh(); |
126 | } | 127 | } |
127 | 128 | ||
128 | void POP3viewItem::contextMenuSelected(int which) | 129 | void POP3viewItem::contextMenuSelected(int which) |
129 | { | 130 | { |
130 | switch (which) | 131 | switch (which) |
131 | { | 132 | { |
132 | case 0: | 133 | case 0: |
133 | disconnect(); | 134 | disconnect(); |
134 | break; | 135 | break; |
135 | case 1: | 136 | case 1: |
136 | setOnOffline(); | 137 | setOnOffline(); |
137 | break; | 138 | break; |
139 | case 2: // daunlood | ||
140 | AccountView*bl = accountView(); | ||
141 | if (!bl) return; | ||
142 | AccountViewItem* in = findSubItem( "inbox" , 0); | ||
143 | if ( ! in ) | ||
144 | return; | ||
145 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); | ||
146 | setOnOffline(); | ||
147 | break; | ||
138 | } | 148 | } |
139 | } | 149 | } |
140 | 150 | ||
141 | POP3folderItem::~POP3folderItem() | 151 | POP3folderItem::~POP3folderItem() |
142 | {} | 152 | {} |
143 | 153 | ||
144 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) | 154 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) |
145 | : AccountViewItem(folderInit,parent,after ) | 155 | : AccountViewItem(folderInit,parent,after ) |
146 | { | 156 | { |
147 | pop3 = parent; | 157 | pop3 = parent; |
148 | if (folder->getDisplayName().lower()!="inbox") | 158 | if (folder->getDisplayName().lower()!="inbox") |
149 | { | 159 | { |
150 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 160 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
151 | } | 161 | } |
152 | else | 162 | else |
153 | { | 163 | { |
154 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 164 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
155 | } | 165 | } |
156 | setText( 0, folder->getDisplayName() ); | 166 | setText( 0, folder->getDisplayName() ); |
157 | } | 167 | } |
158 | 168 | ||
159 | void POP3folderItem::refresh(QValueList<RecMailP>&target) | 169 | void POP3folderItem::refresh(QValueList<RecMailP>&target) |
160 | { | 170 | { |
161 | if (folder->may_select()) | 171 | if (folder->may_select()) |
162 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 172 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
163 | } | 173 | } |
164 | 174 | ||
165 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) | 175 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) |
166 | { | 176 | { |
167 | return pop3->getWrapper()->fetchBody(aMail); | 177 | return pop3->getWrapper()->fetchBody(aMail); |
168 | } | 178 | } |
169 | 179 | ||
170 | QPopupMenu * POP3folderItem::getContextMenu() | 180 | QPopupMenu * POP3folderItem::getContextMenu() |
171 | { | 181 | { |
172 | QPopupMenu *m = new QPopupMenu(0); | 182 | QPopupMenu *m = new QPopupMenu(0); |
173 | if (m) | 183 | if (m) |
174 | { | 184 | { |
175 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 185 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
176 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 186 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
177 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 187 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
178 | } | 188 | } |
179 | return m; | 189 | return m; |
180 | } | 190 | } |
181 | 191 | ||
182 | void POP3folderItem::downloadMails() | 192 | void POP3folderItem::downloadMails() |
183 | { | 193 | { |
184 | AccountView*bl = pop3->accountView(); | 194 | AccountView*bl = pop3->accountView(); |
185 | if (!bl) return; | 195 | if (!bl) return; |
186 | bl->downloadMails(folder,pop3->getWrapper()); | 196 | bl->downloadMails(folder,pop3->getWrapper()); |
187 | } | 197 | } |
188 | 198 | ||
189 | void POP3folderItem::contextMenuSelected(int which) | 199 | void POP3folderItem::contextMenuSelected(int which) |
190 | { | 200 | { |
191 | AccountView * view = (AccountView*)listView(); | 201 | AccountView * view = (AccountView*)listView(); |
192 | switch (which) | 202 | switch (which) |
193 | { | 203 | { |
194 | case 0: | 204 | case 0: |
195 | /* must be 'cause pop3 lists are cached */ | 205 | /* must be 'cause pop3 lists are cached */ |
196 | pop3->getWrapper()->logout(); | 206 | pop3->getWrapper()->logout(); |
197 | view->refreshCurrent(); | 207 | view->refreshCurrent(); |
198 | break; | 208 | break; |
199 | case 1: | 209 | case 1: |
200 | deleteAllMail(pop3->getWrapper(),folder); | 210 | deleteAllMail(pop3->getWrapper(),folder); |
201 | break; | 211 | break; |
202 | case 2: | 212 | case 2: |
203 | downloadMails(); | 213 | downloadMails(); |
204 | break; | 214 | break; |
205 | default: | 215 | default: |
206 | break; | 216 | break; |
207 | } | 217 | } |
208 | } | 218 | } |
209 | 219 | ||
210 | /** | 220 | /** |
211 | * NNTP Account stuff | 221 | * NNTP Account stuff |
212 | */ | 222 | */ |
213 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | 223 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) |
214 | : AccountViewItem( parent ) | 224 | : AccountViewItem( parent ) |
215 | { | 225 | { |
216 | account = a; | 226 | account = a; |
217 | wrapper = AbstractMail::getWrapper( account ); | 227 | wrapper = AbstractMail::getWrapper( account ); |
218 | //FIXME | 228 | //FIXME |
219 | SETPIX(PIXMAP_POP3FOLDER); | 229 | SETPIX(PIXMAP_POP3FOLDER); |
220 | #if 0 | 230 | #if 0 |
221 | if (!account->getOffline()) | 231 | if (!account->getOffline()) |
222 | { | 232 | { |
223 | setPixmap( 0, ); | 233 | setPixmap( 0, ); |
224 | } | 234 | } |
225 | else | 235 | else |
226 | { | 236 | { |
227 | setPixmap( 0, PIXMAP_OFFLINE ); | 237 | setPixmap( 0, PIXMAP_OFFLINE ); |
228 | } | 238 | } |
229 | #endif | 239 | #endif |
230 | setText( 0, account->getAccountName() ); | 240 | setText( 0, account->getAccountName() ); |
231 | setOpen( true ); | 241 | setOpen( true ); |
232 | } | 242 | } |
233 | 243 | ||
234 | NNTPviewItem::~NNTPviewItem() | 244 | NNTPviewItem::~NNTPviewItem() |
235 | { | 245 | { |
236 | delete wrapper; | 246 | delete wrapper; |
237 | } | 247 | } |
238 | 248 | ||
239 | AbstractMail *NNTPviewItem::getWrapper() | 249 | AbstractMail *NNTPviewItem::getWrapper() |
240 | { | 250 | { |
241 | return wrapper; | 251 | return wrapper; |
242 | } | 252 | } |
243 | 253 | ||
244 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) | 254 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) |
245 | { | 255 | { |
246 | refresh(); | 256 | refresh(); |
247 | } | 257 | } |
248 | 258 | ||
249 | void NNTPviewItem::refresh() | 259 | void NNTPviewItem::refresh() |
250 | { | 260 | { |
251 | if (account->getOffline()) return; | 261 | if (account->getOffline()) return; |
252 | QValueList<FolderP> *folders = wrapper->listFolders(); | 262 | QValueList<FolderP> *folders = wrapper->listFolders(); |
253 | 263 | ||
254 | QListViewItem *child = firstChild(); | 264 | QListViewItem *child = firstChild(); |
255 | while ( child ) | 265 | while ( child ) |
256 | { | 266 | { |
257 | QListViewItem *tmp = child; | 267 | QListViewItem *tmp = child; |
258 | child = child->nextSibling(); | 268 | child = child->nextSibling(); |
259 | delete tmp; | 269 | delete tmp; |
260 | } | 270 | } |
261 | QValueList<FolderP>::ConstIterator it; | 271 | QValueList<FolderP>::ConstIterator it; |
262 | QListViewItem*item = 0; | 272 | QListViewItem*item = 0; |
263 | for ( it = folders->begin(); it!=folders->end(); ++it) | 273 | for ( it = folders->begin(); it!=folders->end(); ++it) |
264 | { | 274 | { |
265 | item = new NNTPfolderItem( (*it), this , item ); | 275 | item = new NNTPfolderItem( (*it), this , item ); |
@@ -980,161 +990,161 @@ void MHfolderItem::createFolder() | |||
980 | Newmdirdlg ndirdlg(0,0,true); | 990 | Newmdirdlg ndirdlg(0,0,true); |
981 | ndirdlg.showMaximized(); | 991 | ndirdlg.showMaximized(); |
982 | if (ndirdlg.exec() ) | 992 | if (ndirdlg.exec() ) |
983 | { | 993 | { |
984 | QString ndir = ndirdlg.Newdir(); | 994 | QString ndir = ndirdlg.Newdir(); |
985 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 995 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
986 | { | 996 | { |
987 | QListView*v=listView(); | 997 | QListView*v=listView(); |
988 | MHviewItem * box = mbox; | 998 | MHviewItem * box = mbox; |
989 | /* be carefull - after that this object is destroyd so don't use | 999 | /* be carefull - after that this object is destroyd so don't use |
990 | * any member of it after that call!!*/ | 1000 | * any member of it after that call!!*/ |
991 | mbox->refresh(true); | 1001 | mbox->refresh(true); |
992 | if (v) | 1002 | if (v) |
993 | { | 1003 | { |
994 | v->setSelected(box,true); | 1004 | v->setSelected(box,true); |
995 | } | 1005 | } |
996 | } | 1006 | } |
997 | } | 1007 | } |
998 | } | 1008 | } |
999 | 1009 | ||
1000 | void MHfolderItem::contextMenuSelected(int which) | 1010 | void MHfolderItem::contextMenuSelected(int which) |
1001 | { | 1011 | { |
1002 | switch(which) | 1012 | switch(which) |
1003 | { | 1013 | { |
1004 | case 0: | 1014 | case 0: |
1005 | deleteAllMail(mbox->getWrapper(),folder); | 1015 | deleteAllMail(mbox->getWrapper(),folder); |
1006 | break; | 1016 | break; |
1007 | case 1: | 1017 | case 1: |
1008 | deleteFolder(); | 1018 | deleteFolder(); |
1009 | break; | 1019 | break; |
1010 | case 2: | 1020 | case 2: |
1011 | downloadMails(); | 1021 | downloadMails(); |
1012 | break; | 1022 | break; |
1013 | case 3: | 1023 | case 3: |
1014 | createFolder(); | 1024 | createFolder(); |
1015 | break; | 1025 | break; |
1016 | default: | 1026 | default: |
1017 | break; | 1027 | break; |
1018 | } | 1028 | } |
1019 | } | 1029 | } |
1020 | 1030 | ||
1021 | bool MHfolderItem::isDraftfolder() | 1031 | bool MHfolderItem::isDraftfolder() |
1022 | { | 1032 | { |
1023 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; | 1033 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; |
1024 | return false; | 1034 | return false; |
1025 | } | 1035 | } |
1026 | 1036 | ||
1027 | /** | 1037 | /** |
1028 | * Generic stuff | 1038 | * Generic stuff |
1029 | */ | 1039 | */ |
1030 | 1040 | ||
1031 | const QString AccountViewItem::contextName="AccountViewItem"; | 1041 | const QString AccountViewItem::contextName="AccountViewItem"; |
1032 | 1042 | ||
1033 | AccountViewItem::AccountViewItem( AccountView *parent ) | 1043 | AccountViewItem::AccountViewItem( AccountView *parent ) |
1034 | : QListViewItem( parent ) | 1044 | : QListViewItem( parent ) |
1035 | { | 1045 | { |
1036 | init(); | 1046 | init(); |
1037 | m_Backlink = parent; | 1047 | m_Backlink = parent; |
1038 | } | 1048 | } |
1039 | 1049 | ||
1040 | AccountViewItem::AccountViewItem( QListViewItem *parent) | 1050 | AccountViewItem::AccountViewItem( QListViewItem *parent) |
1041 | : QListViewItem( parent),folder(0) | 1051 | : QListViewItem( parent),folder(0) |
1042 | { | 1052 | { |
1043 | init(); | 1053 | init(); |
1044 | } | 1054 | } |
1045 | 1055 | ||
1046 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) | 1056 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) |
1047 | :QListViewItem( parent,after ),folder(0) | 1057 | :QListViewItem( parent,after ),folder(0) |
1048 | { | 1058 | { |
1049 | init(); | 1059 | init(); |
1050 | } | 1060 | } |
1051 | 1061 | ||
1052 | AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) | 1062 | AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) |
1053 | :QListViewItem( parent,after ),folder(folderInit) | 1063 | :QListViewItem( parent,after ),folder(folderInit) |
1054 | { | 1064 | { |
1055 | init(); | 1065 | init(); |
1056 | } | 1066 | } |
1057 | 1067 | ||
1058 | void AccountViewItem::init() | 1068 | void AccountViewItem::init() |
1059 | { | 1069 | { |
1060 | m_Backlink = 0; | 1070 | m_Backlink = 0; |
1061 | } | 1071 | } |
1062 | 1072 | ||
1063 | AccountViewItem::~AccountViewItem() | 1073 | AccountViewItem::~AccountViewItem() |
1064 | { | 1074 | { |
1065 | folder = 0; | 1075 | folder = 0; |
1066 | } | 1076 | } |
1067 | 1077 | ||
1068 | AccountView*AccountViewItem::accountView() | 1078 | AccountView*AccountViewItem::accountView() |
1069 | { | 1079 | { |
1070 | return m_Backlink; | 1080 | return m_Backlink; |
1071 | } | 1081 | } |
1072 | 1082 | ||
1073 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) | 1083 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) |
1074 | { | 1084 | { |
1075 | if (!wrapper) return; | 1085 | if (!wrapper) return; |
1076 | QString fname=""; | 1086 | QString fname=""; |
1077 | if (folder) fname = folder->getDisplayName(); | 1087 | if (folder) fname = folder->getDisplayName(); |
1078 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | 1088 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
1079 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). | 1089 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). |
1080 | arg(fname), | 1090 | arg(fname), |
1081 | QObject::tr("Yes",contextName), | 1091 | QObject::tr("Yes",contextName), |
1082 | QObject::tr("No",contextName),QString::null,1,1); | 1092 | QObject::tr("No",contextName),QString::null,1,1); |
1083 | 1093 | ||
1084 | if (yesno == 0) | 1094 | if (yesno == 0) |
1085 | { | 1095 | { |
1086 | if (wrapper->deleteAllMail(folder)) | 1096 | if (wrapper->deleteAllMail(folder)) |
1087 | { | 1097 | { |
1088 | AccountView * view = (AccountView*)listView(); | 1098 | AccountView * view = (AccountView*)listView(); |
1089 | if (view) view->refreshCurrent(); | 1099 | if (view) view->refreshCurrent(); |
1090 | } | 1100 | } |
1091 | } | 1101 | } |
1092 | } | 1102 | } |
1093 | 1103 | ||
1094 | void AccountViewItem::removeChilds() | 1104 | void AccountViewItem::removeChilds() |
1095 | { | 1105 | { |
1096 | QListViewItem *child = firstChild(); | 1106 | QListViewItem *child = firstChild(); |
1097 | while ( child ) | 1107 | while ( child ) |
1098 | { | 1108 | { |
1099 | QListViewItem *tmp = child; | 1109 | QListViewItem *tmp = child; |
1100 | child = child->nextSibling(); | 1110 | child = child->nextSibling(); |
1101 | delete tmp; | 1111 | delete tmp; |
1102 | } | 1112 | } |
1103 | } | 1113 | } |
1104 | 1114 | ||
1105 | bool AccountViewItem::matchName(const QString&name)const | 1115 | bool AccountViewItem::matchName(const QString&name)const |
1106 | { | 1116 | { |
1107 | if (!folder) return false; | 1117 | if (!folder) return false; |
1108 | return folder->getDisplayName()==name; | 1118 | return folder->getDisplayName().lower()==name.lower(); |
1109 | } | 1119 | } |
1110 | 1120 | ||
1111 | 1121 | ||
1112 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) | 1122 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) |
1113 | { | 1123 | { |
1114 | AccountViewItem*pitem,*sitem; | 1124 | AccountViewItem*pitem,*sitem; |
1115 | if (!start) pitem = (AccountViewItem*)firstChild(); | 1125 | if (!start) pitem = (AccountViewItem*)firstChild(); |
1116 | else pitem = (AccountViewItem*)start->firstChild(); | 1126 | else pitem = (AccountViewItem*)start->firstChild(); |
1117 | while (pitem) | 1127 | while (pitem) |
1118 | { | 1128 | { |
1119 | if (pitem->matchName(path)) | 1129 | if (pitem->matchName(path)) |
1120 | { | 1130 | { |
1121 | break; | 1131 | break; |
1122 | } | 1132 | } |
1123 | if (pitem->childCount()>0) | 1133 | if (pitem->childCount()>0) |
1124 | { | 1134 | { |
1125 | sitem = findSubItem(path,pitem); | 1135 | sitem = findSubItem(path,pitem); |
1126 | if (sitem) | 1136 | if (sitem) |
1127 | { | 1137 | { |
1128 | pitem = sitem; | 1138 | pitem = sitem; |
1129 | break; | 1139 | break; |
1130 | } | 1140 | } |
1131 | } | 1141 | } |
1132 | pitem=(AccountViewItem*)pitem->nextSibling(); | 1142 | pitem=(AccountViewItem*)pitem->nextSibling(); |
1133 | } | 1143 | } |
1134 | return pitem; | 1144 | return pitem; |
1135 | } | 1145 | } |
1136 | 1146 | ||
1137 | bool AccountViewItem::isDraftfolder() | 1147 | bool AccountViewItem::isDraftfolder() |
1138 | { | 1148 | { |
1139 | return false; | 1149 | return false; |
1140 | } | 1150 | } |
diff --git a/kmicromail/accountitem.h b/kmicromail/accountitem.h index f125eeb..faf919d 100644 --- a/kmicromail/accountitem.h +++ b/kmicromail/accountitem.h | |||
@@ -1,166 +1,167 @@ | |||
1 | #ifndef __ACCOUNT_ITEM | 1 | #ifndef __ACCOUNT_ITEM |
2 | #define __ACCOUNT_ITEM | 2 | #define __ACCOUNT_ITEM |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include <opie2/osmartpointer.h> | 6 | #include <opie2/osmartpointer.h> |
7 | 7 | ||
8 | class POP3wrapper; | 8 | class POP3wrapper; |
9 | class RecMail; | 9 | class RecMail; |
10 | class RecBody; | 10 | class RecBody; |
11 | class QPopupMenu; | 11 | class QPopupMenu; |
12 | class Selectstore; | 12 | class Selectstore; |
13 | class AccountView; | 13 | class AccountView; |
14 | class POP3account; | 14 | class POP3account; |
15 | class NNTPaccount; | 15 | class NNTPaccount; |
16 | class IMAPaccount; | 16 | class IMAPaccount; |
17 | class AbstractMail; | 17 | class AbstractMail; |
18 | class Folder; | 18 | class Folder; |
19 | 19 | ||
20 | #define RECBODYP Opie::Core::OSmartPointer<RecBody> | 20 | #define RECBODYP Opie::Core::OSmartPointer<RecBody> |
21 | 21 | ||
22 | class AccountViewItem : public QListViewItem | 22 | class AccountViewItem : public QListViewItem |
23 | { | 23 | { |
24 | 24 | ||
25 | public: | 25 | public: |
26 | AccountViewItem( AccountView *parent ); | 26 | AccountViewItem( AccountView *parent ); |
27 | AccountViewItem( QListViewItem *parent); | 27 | AccountViewItem( QListViewItem *parent); |
28 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); | 28 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); |
29 | AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); | 29 | AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); |
30 | 30 | ||
31 | virtual ~AccountViewItem(); | 31 | virtual ~AccountViewItem(); |
32 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; | 32 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; |
33 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; | 33 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; |
34 | virtual QPopupMenu * getContextMenu(){return 0;}; | 34 | virtual QPopupMenu * getContextMenu(){return 0;}; |
35 | virtual void contextMenuSelected(int){} | 35 | virtual void contextMenuSelected(int){} |
36 | virtual AccountView*accountView(); | 36 | virtual AccountView*accountView(); |
37 | virtual bool matchName(const QString&name)const; | 37 | virtual bool matchName(const QString&name)const; |
38 | virtual bool isDraftfolder(); | 38 | virtual bool isDraftfolder(); |
39 | Opie::Core::OSmartPointer<Folder> getFolder() { return folder; }; | ||
39 | 40 | ||
40 | protected: | 41 | protected: |
41 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); | 42 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); |
42 | virtual void init(); | 43 | virtual void init(); |
43 | virtual void removeChilds(); | 44 | virtual void removeChilds(); |
44 | virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f); | 45 | virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f); |
45 | static const QString contextName; | 46 | static const QString contextName; |
46 | AccountView*m_Backlink; | 47 | AccountView*m_Backlink; |
47 | Opie::Core::OSmartPointer<Folder> folder; | 48 | Opie::Core::OSmartPointer<Folder> folder; |
48 | }; | 49 | }; |
49 | 50 | ||
50 | class POP3viewItem : public AccountViewItem | 51 | class POP3viewItem : public AccountViewItem |
51 | { | 52 | { |
52 | 53 | ||
53 | public: | 54 | public: |
54 | POP3viewItem( POP3account *a, AccountView *parent ); | 55 | POP3viewItem( POP3account *a, AccountView *parent ); |
55 | virtual ~POP3viewItem(); | 56 | virtual ~POP3viewItem(); |
56 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 57 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
57 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 58 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
58 | AbstractMail *getWrapper(); | 59 | AbstractMail *getWrapper(); |
59 | virtual QPopupMenu * getContextMenu(); | 60 | virtual QPopupMenu * getContextMenu(); |
60 | virtual void contextMenuSelected(int); | 61 | virtual void contextMenuSelected(int); |
61 | 62 | ||
62 | protected: | 63 | protected: |
63 | POP3account *account; | 64 | POP3account *account; |
64 | virtual void refresh(); | 65 | virtual void refresh(); |
65 | AbstractMail *wrapper; | 66 | AbstractMail *wrapper; |
66 | void disconnect(); | 67 | void disconnect(); |
67 | void setOnOffline(); | 68 | void setOnOffline(); |
68 | }; | 69 | }; |
69 | 70 | ||
70 | class POP3folderItem : public AccountViewItem | 71 | class POP3folderItem : public AccountViewItem |
71 | { | 72 | { |
72 | 73 | ||
73 | public: | 74 | public: |
74 | POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); | 75 | POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); |
75 | virtual ~POP3folderItem(); | 76 | virtual ~POP3folderItem(); |
76 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 77 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
77 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 78 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
78 | virtual QPopupMenu * getContextMenu(); | 79 | virtual QPopupMenu * getContextMenu(); |
79 | virtual void contextMenuSelected(int); | 80 | virtual void contextMenuSelected(int); |
80 | 81 | ||
81 | protected: | 82 | protected: |
82 | void downloadMails(); | 83 | void downloadMails(); |
83 | POP3viewItem *pop3; | 84 | POP3viewItem *pop3; |
84 | }; | 85 | }; |
85 | 86 | ||
86 | 87 | ||
87 | class NNTPviewItem : public AccountViewItem | 88 | class NNTPviewItem : public AccountViewItem |
88 | { | 89 | { |
89 | 90 | ||
90 | public: | 91 | public: |
91 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); | 92 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); |
92 | virtual ~NNTPviewItem(); | 93 | virtual ~NNTPviewItem(); |
93 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 94 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
94 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 95 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
95 | AbstractMail *getWrapper(); | 96 | AbstractMail *getWrapper(); |
96 | virtual QPopupMenu * getContextMenu(); | 97 | virtual QPopupMenu * getContextMenu(); |
97 | virtual void contextMenuSelected(int); | 98 | virtual void contextMenuSelected(int); |
98 | 99 | ||
99 | protected: | 100 | protected: |
100 | NNTPaccount *account; | 101 | NNTPaccount *account; |
101 | virtual void refresh(); | 102 | virtual void refresh(); |
102 | AbstractMail *wrapper; | 103 | AbstractMail *wrapper; |
103 | void disconnect(); | 104 | void disconnect(); |
104 | void setOnOffline(); | 105 | void setOnOffline(); |
105 | void subscribeGroups(); | 106 | void subscribeGroups(); |
106 | }; | 107 | }; |
107 | 108 | ||
108 | class NNTPfolderItem : public AccountViewItem | 109 | class NNTPfolderItem : public AccountViewItem |
109 | { | 110 | { |
110 | 111 | ||
111 | public: | 112 | public: |
112 | NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); | 113 | NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); |
113 | virtual ~NNTPfolderItem(); | 114 | virtual ~NNTPfolderItem(); |
114 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 115 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
115 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 116 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
116 | virtual QPopupMenu * getContextMenu(); | 117 | virtual QPopupMenu * getContextMenu(); |
117 | virtual void contextMenuSelected(int); | 118 | virtual void contextMenuSelected(int); |
118 | 119 | ||
119 | protected: | 120 | protected: |
120 | void downloadMails(); | 121 | void downloadMails(); |
121 | NNTPviewItem *nntp; | 122 | NNTPviewItem *nntp; |
122 | }; | 123 | }; |
123 | 124 | ||
124 | 125 | ||
125 | 126 | ||
126 | class IMAPviewItem : public AccountViewItem | 127 | class IMAPviewItem : public AccountViewItem |
127 | { | 128 | { |
128 | friend class IMAPfolderItem; | 129 | friend class IMAPfolderItem; |
129 | public: | 130 | public: |
130 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); | 131 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); |
131 | virtual ~IMAPviewItem(); | 132 | virtual ~IMAPviewItem(); |
132 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 133 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
133 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 134 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
134 | AbstractMail *getWrapper(); | 135 | AbstractMail *getWrapper(); |
135 | virtual QPopupMenu * getContextMenu(); | 136 | virtual QPopupMenu * getContextMenu(); |
136 | virtual void contextMenuSelected(int); | 137 | virtual void contextMenuSelected(int); |
137 | const QStringList&subFolders(); | 138 | const QStringList&subFolders(); |
138 | virtual void refreshFolders(bool force=false); | 139 | virtual void refreshFolders(bool force=false); |
139 | bool offline(); | 140 | bool offline(); |
140 | 141 | ||
141 | protected: | 142 | protected: |
142 | virtual void createNewFolder(); | 143 | virtual void createNewFolder(); |
143 | IMAPaccount *account; | 144 | IMAPaccount *account; |
144 | AbstractMail *wrapper; | 145 | AbstractMail *wrapper; |
145 | QStringList currentFolders; | 146 | QStringList currentFolders; |
146 | }; | 147 | }; |
147 | 148 | ||
148 | class IMAPfolderItem : public AccountViewItem | 149 | class IMAPfolderItem : public AccountViewItem |
149 | { | 150 | { |
150 | 151 | ||
151 | public: | 152 | public: |
152 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); | 153 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); |
153 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | 154 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); |
154 | virtual ~IMAPfolderItem(); | 155 | virtual ~IMAPfolderItem(); |
155 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 156 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
156 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 157 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
157 | virtual QPopupMenu * getContextMenu(); | 158 | virtual QPopupMenu * getContextMenu(); |
158 | virtual void contextMenuSelected(int); | 159 | virtual void contextMenuSelected(int); |
159 | virtual const QString& Delemiter()const; | 160 | virtual const QString& Delemiter()const; |
160 | protected: | 161 | protected: |
161 | virtual void createNewFolder(); | 162 | virtual void createNewFolder(); |
162 | virtual void deleteFolder(); | 163 | virtual void deleteFolder(); |
163 | virtual void downloadMails(); | 164 | virtual void downloadMails(); |
164 | IMAPviewItem *imap; | 165 | IMAPviewItem *imap; |
165 | }; | 166 | }; |
166 | 167 | ||
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index 4ead545..85523b1 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp | |||
@@ -14,163 +14,190 @@ | |||
14 | /* QT */ | 14 | /* QT */ |
15 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
16 | #include <qpopupmenu.h> | 16 | #include <qpopupmenu.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qspinbox.h> | 18 | #include <qspinbox.h> |
19 | 19 | ||
20 | using namespace Opie::Core; | 20 | using namespace Opie::Core; |
21 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 21 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
22 | : QListView( parent, name, flags ) | 22 | : QListView( parent, name, flags ) |
23 | { | 23 | { |
24 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), | 24 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), |
25 | SLOT( refresh(QListViewItem*) ) ); | 25 | SLOT( refresh(QListViewItem*) ) ); |
26 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 26 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
27 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); | 27 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); |
28 | setSorting(0); | 28 | setSorting(0); |
29 | } | 29 | } |
30 | 30 | ||
31 | AccountView::~AccountView() | 31 | AccountView::~AccountView() |
32 | { | 32 | { |
33 | imapAccounts.clear(); | 33 | imapAccounts.clear(); |
34 | mhAccounts.clear(); | 34 | mhAccounts.clear(); |
35 | } | 35 | } |
36 | 36 | ||
37 | void AccountView::slotContextMenu(int id) | 37 | void AccountView::slotContextMenu(int id) |
38 | { | 38 | { |
39 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 39 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
40 | if (!view) return; | 40 | if (!view) return; |
41 | view->contextMenuSelected(id); | 41 | view->contextMenuSelected(id); |
42 | } | 42 | } |
43 | 43 | ||
44 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 44 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) |
45 | { | 45 | { |
46 | if (button==1) {return;} | 46 | if (button==1) {return;} |
47 | if (!item) return; | 47 | if (!item) return; |
48 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 48 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
49 | QPopupMenu*m = view->getContextMenu(); | 49 | QPopupMenu*m = view->getContextMenu(); |
50 | if (!m) return; | 50 | if (!m) return; |
51 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 51 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
52 | m->setFocus(); | 52 | m->setFocus(); |
53 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 53 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
54 | delete m; | 54 | delete m; |
55 | } | 55 | } |
56 | 56 | ||
57 | void AccountView::populate( QList<Account> list ) | 57 | void AccountView::populate( QList<Account> list ) |
58 | { | 58 | { |
59 | clear(); | 59 | clear(); |
60 | 60 | ||
61 | imapAccounts.clear(); | 61 | imapAccounts.clear(); |
62 | mhAccounts.clear(); | 62 | mhAccounts.clear(); |
63 | 63 | ||
64 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 64 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
65 | 65 | ||
66 | Account *it; | 66 | Account *it; |
67 | for ( it = list.first(); it; it = list.next() ) | 67 | for ( it = list.first(); it; it = list.next() ) |
68 | { | 68 | { |
69 | if ( it->getType() == MAILLIB::A_IMAP ) | 69 | if ( it->getType() == MAILLIB::A_IMAP ) |
70 | { | 70 | { |
71 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 71 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
72 | imapAccounts.append(new IMAPviewItem( imap, this )); | 72 | imapAccounts.append(new IMAPviewItem( imap, this )); |
73 | } | 73 | } |
74 | else if ( it->getType() == MAILLIB::A_POP3 ) | 74 | else if ( it->getType() == MAILLIB::A_POP3 ) |
75 | { | 75 | { |
76 | POP3account *pop3 = static_cast<POP3account *>(it); | 76 | POP3account *pop3 = static_cast<POP3account *>(it); |
77 | /* must not be hold 'cause it isn't required */ | 77 | /* must not be hold 'cause it isn't required */ |
78 | (void) new POP3viewItem( pop3, this ); | 78 | (void) new POP3viewItem( pop3, this ); |
79 | } | 79 | } |
80 | else if ( it->getType() == MAILLIB::A_NNTP ) | 80 | else if ( it->getType() == MAILLIB::A_NNTP ) |
81 | { | 81 | { |
82 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 82 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
83 | /* must not be hold 'cause it isn't required */ | 83 | /* must not be hold 'cause it isn't required */ |
84 | (void) new NNTPviewItem( nntp, this ); | 84 | (void) new NNTPviewItem( nntp, this ); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | void AccountView::refresh(QListViewItem *item) | 89 | void AccountView::refresh(QListViewItem *item) |
90 | { | 90 | { |
91 | if ( item ) | 91 | if ( item ) |
92 | { | 92 | { |
93 | m_currentItem = item; | 93 | m_currentItem = item; |
94 | QValueList<RecMailP> headerlist; | 94 | QValueList<RecMailP> headerlist; |
95 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 95 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
96 | view->refresh(headerlist); | 96 | view->refresh(headerlist); |
97 | emit refreshMailview(headerlist); | 97 | emit refreshMailview(headerlist); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | void AccountView::refreshCurrent() | 101 | void AccountView::refreshCurrent() |
102 | { | 102 | { |
103 | m_currentItem = currentItem(); | 103 | m_currentItem = currentItem(); |
104 | if ( !m_currentItem ) return; | 104 | if ( !m_currentItem ) return; |
105 | QValueList<RecMailP> headerlist; | 105 | QValueList<RecMailP> headerlist; |
106 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 106 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
107 | view->refresh(headerlist); | 107 | view->refresh(headerlist); |
108 | emit refreshMailview(headerlist); | 108 | emit refreshMailview(headerlist); |
109 | } | 109 | } |
110 | 110 | ||
111 | void AccountView::refreshAll() | 111 | void AccountView::refreshAll() |
112 | { | 112 | { |
113 | } | 113 | } |
114 | 114 | ||
115 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) | 115 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) |
116 | { | 116 | { |
117 | QListViewItem*item = selectedItem (); | 117 | QListViewItem*item = selectedItem (); |
118 | if (!item) return new RecBody(); | 118 | if (!item) return new RecBody(); |
119 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 119 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
120 | return view->fetchBody(aMail); | 120 | return view->fetchBody(aMail); |
121 | } | 121 | } |
122 | 122 | ||
123 | void AccountView::setupFolderselect(Selectstore*sels) | 123 | void AccountView::setupFolderselect(Selectstore*sels) |
124 | { | 124 | { |
125 | sels->showMaximized(); | 125 | sels->showMaximized(); |
126 | QStringList sFolders; | 126 | QStringList sFolders; |
127 | unsigned int i = 0; | 127 | unsigned int i = 0; |
128 | for (i=0; i < mhAccounts.count();++i) | 128 | for (i=0; i < mhAccounts.count();++i) |
129 | { | 129 | { |
130 | mhAccounts[i]->refresh(false); | 130 | mhAccounts[i]->refresh(false); |
131 | sFolders = mhAccounts[i]->subFolders(); | 131 | sFolders = mhAccounts[i]->subFolders(); |
132 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); | 132 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); |
133 | } | 133 | } |
134 | for (i=0; i < imapAccounts.count();++i) | 134 | for (i=0; i < imapAccounts.count();++i) |
135 | { | 135 | { |
136 | if (imapAccounts[i]->offline()) | 136 | if (imapAccounts[i]->offline()) |
137 | continue; | 137 | continue; |
138 | imapAccounts[i]->refreshFolders(false); | 138 | imapAccounts[i]->refreshFolders(false); |
139 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | 139 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); |
140 | } | 140 | } |
141 | } | 141 | } |
142 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) | ||
143 | { | ||
144 | AbstractMail*targetMail = 0; | ||
145 | QString targetFolder = ""; | ||
146 | Selectstore sels; | ||
147 | setupFolderselect(&sels); | ||
148 | if (!sels.exec()) return; | ||
149 | targetMail = sels.currentMail(); | ||
150 | targetFolder = sels.currentFolder(); | ||
151 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | ||
152 | targetFolder.isEmpty()) | ||
153 | { | ||
154 | return; | ||
155 | } | ||
156 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | ||
157 | { | ||
158 | QMessageBox::critical(0,tr("Error creating new Folder"), | ||
159 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | ||
160 | return; | ||
161 | } | ||
162 | int maxsize = 0; | ||
163 | if ( sels.useSize->isChecked()) | ||
164 | maxsize = sels.sizeSpinBox->value(); | ||
165 | |||
166 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); | ||
167 | refreshCurrent(); | ||
168 | } | ||
142 | 169 | ||
143 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) | 170 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) |
144 | { | 171 | { |
145 | AbstractMail*targetMail = 0; | 172 | AbstractMail*targetMail = 0; |
146 | QString targetFolder = ""; | 173 | QString targetFolder = ""; |
147 | Selectstore sels; | 174 | Selectstore sels; |
148 | setupFolderselect(&sels); | 175 | setupFolderselect(&sels); |
149 | if (!sels.exec()) return; | 176 | if (!sels.exec()) return; |
150 | targetMail = sels.currentMail(); | 177 | targetMail = sels.currentMail(); |
151 | targetFolder = sels.currentFolder(); | 178 | targetFolder = sels.currentFolder(); |
152 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 179 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
153 | targetFolder.isEmpty()) | 180 | targetFolder.isEmpty()) |
154 | { | 181 | { |
155 | return; | 182 | return; |
156 | } | 183 | } |
157 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 184 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
158 | { | 185 | { |
159 | QMessageBox::critical(0,tr("Error creating new Folder"), | 186 | QMessageBox::critical(0,tr("Error creating new Folder"), |
160 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 187 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
161 | return; | 188 | return; |
162 | } | 189 | } |
163 | int maxsize = 0; | 190 | int maxsize = 0; |
164 | if ( sels.useSize->isChecked()) | 191 | if ( sels.useSize->isChecked()) |
165 | maxsize = sels.sizeSpinBox->value(); | 192 | maxsize = sels.sizeSpinBox->value(); |
166 | 193 | ||
167 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); | 194 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); |
168 | refreshCurrent(); | 195 | refreshCurrent(); |
169 | } | 196 | } |
170 | 197 | ||
171 | bool AccountView::currentisDraft() | 198 | bool AccountView::currentisDraft() |
172 | { | 199 | { |
173 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 200 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
174 | if (!view) return false; | 201 | if (!view) return false; |
175 | return view->isDraftfolder(); | 202 | return view->isDraftfolder(); |
176 | } | 203 | } |
diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h index 787b0b0..fcf33d1 100644 --- a/kmicromail/accountview.h +++ b/kmicromail/accountview.h | |||
@@ -1,45 +1,46 @@ | |||
1 | #ifndef ACCOUNTVIEW_H | 1 | #ifndef ACCOUNTVIEW_H |
2 | #define ACCOUNTVIEW_H | 2 | #define ACCOUNTVIEW_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include <opie2/osmartpointer.h> | 6 | #include <opie2/osmartpointer.h> |
7 | #include <libmailwrapper/mailtypes.h> | 7 | #include <libmailwrapper/mailtypes.h> |
8 | 8 | ||
9 | class Selectstore; | 9 | class Selectstore; |
10 | class Folder; | 10 | class Folder; |
11 | class AbstractMail; | 11 | class AbstractMail; |
12 | class Account; | 12 | class Account; |
13 | class IMAPviewItem; | 13 | class IMAPviewItem; |
14 | class MHviewItem; | 14 | class MHviewItem; |
15 | 15 | ||
16 | class AccountView : public QListView | 16 | class AccountView : public QListView |
17 | { | 17 | { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | 19 | ||
20 | public: | 20 | public: |
21 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 21 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
22 | virtual ~AccountView(); | 22 | virtual ~AccountView(); |
23 | virtual void populate( QList<Account> list ); | 23 | virtual void populate( QList<Account> list ); |
24 | virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); | 24 | virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); |
25 | virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); | 25 | virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); |
26 | virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); | ||
26 | virtual bool currentisDraft(); | 27 | virtual bool currentisDraft(); |
27 | 28 | ||
28 | public slots: | 29 | public slots: |
29 | virtual void refreshAll(); | 30 | virtual void refreshAll(); |
30 | virtual void refresh(QListViewItem *item); | 31 | virtual void refresh(QListViewItem *item); |
31 | virtual void refreshCurrent(); | 32 | virtual void refreshCurrent(); |
32 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); | 33 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); |
33 | virtual void slotContextMenu(int id); | 34 | virtual void slotContextMenu(int id); |
34 | void setupFolderselect(Selectstore*sels); | 35 | void setupFolderselect(Selectstore*sels); |
35 | 36 | ||
36 | signals: | 37 | signals: |
37 | void refreshMailview(const QValueList<RecMailP>& ); | 38 | void refreshMailview(const QValueList<RecMailP>& ); |
38 | 39 | ||
39 | protected: | 40 | protected: |
40 | QListViewItem* m_currentItem; | 41 | QListViewItem* m_currentItem; |
41 | QValueList<IMAPviewItem*> imapAccounts; | 42 | QValueList<IMAPviewItem*> imapAccounts; |
42 | QValueList<MHviewItem*> mhAccounts; | 43 | QValueList<MHviewItem*> mhAccounts; |
43 | }; | 44 | }; |
44 | 45 | ||
45 | #endif | 46 | #endif |
diff --git a/kmicromail/imapconfigui.ui b/kmicromail/imapconfigui.ui index a96c1a2..2e4c9ca 100644 --- a/kmicromail/imapconfigui.ui +++ b/kmicromail/imapconfigui.ui | |||
@@ -1,259 +1,475 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>IMAPconfigUI</class> | 2 | <class>IMAPconfigUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>IMAPconfigUI</cstring> | 7 | <cstring>IMAPconfigUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>425</width> | 14 | <width>306</width> |
15 | <height>428</height> | 15 | <height>396</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Configure IMAP</string> | 20 | <string>Configure IMAP</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <grid> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>3</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>3</number> | 35 | <number>1</number> |
36 | </property> | 36 | </property> |
37 | <widget row="2" column="1" > | 37 | <widget> |
38 | <class>QLineEdit</class> | 38 | <class>QLayoutWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>serverLine</cstring> | 41 | <cstring>Layout22</cstring> |
42 | </property> | 42 | </property> |
43 | </widget> | 43 | <hbox> |
44 | <widget row="3" column="0" > | 44 | <property stdset="1"> |
45 | <class>QLabel</class> | 45 | <name>margin</name> |
46 | <property stdset="1"> | 46 | <number>0</number> |
47 | <name>name</name> | 47 | </property> |
48 | <cstring>portLabel</cstring> | 48 | <property stdset="1"> |
49 | </property> | 49 | <name>spacing</name> |
50 | <property stdset="1"> | 50 | <number>6</number> |
51 | <name>text</name> | 51 | </property> |
52 | <string>Port</string> | 52 | <widget> |
53 | </property> | 53 | <class>QLabel</class> |
54 | <property stdset="1"> | ||
55 | <name>name</name> | ||
56 | <cstring>accountLabel</cstring> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>text</name> | ||
60 | <string>Account</string> | ||
61 | </property> | ||
62 | </widget> | ||
63 | <widget> | ||
64 | <class>QLineEdit</class> | ||
65 | <property stdset="1"> | ||
66 | <name>name</name> | ||
67 | <cstring>accountLine</cstring> | ||
68 | </property> | ||
69 | <property> | ||
70 | <name>toolTip</name> | ||
71 | <string>Name of the Account</string> | ||
72 | </property> | ||
73 | </widget> | ||
74 | </hbox> | ||
54 | </widget> | 75 | </widget> |
55 | <widget row="2" column="0" > | 76 | <widget> |
56 | <class>QLabel</class> | ||
57 | <property stdset="1"> | ||
58 | <name>name</name> | ||
59 | <cstring>serverLabel</cstring> | ||
60 | </property> | ||
61 | <property stdset="1"> | ||
62 | <name>text</name> | ||
63 | <string>Server</string> | ||
64 | </property> | ||
65 | </widget> | ||
66 | <widget row="3" column="1" > | ||
67 | <class>QLineEdit</class> | ||
68 | <property stdset="1"> | ||
69 | <name>name</name> | ||
70 | <cstring>portLine</cstring> | ||
71 | </property> | ||
72 | </widget> | ||
73 | <widget row="0" column="1" > | ||
74 | <class>QLineEdit</class> | ||
75 | <property stdset="1"> | ||
76 | <name>name</name> | ||
77 | <cstring>accountLine</cstring> | ||
78 | </property> | ||
79 | <property> | ||
80 | <name>toolTip</name> | ||
81 | <string>Name of the Account</string> | ||
82 | </property> | ||
83 | </widget> | ||
84 | <widget row="0" column="0" > | ||
85 | <class>QLabel</class> | ||
86 | <property stdset="1"> | ||
87 | <name>name</name> | ||
88 | <cstring>accountLabel</cstring> | ||
89 | </property> | ||
90 | <property stdset="1"> | ||
91 | <name>text</name> | ||
92 | <string>Account</string> | ||
93 | </property> | ||
94 | </widget> | ||
95 | <widget row="1" column="0" rowspan="1" colspan="2" > | ||
96 | <class>Line</class> | 77 | <class>Line</class> |
97 | <property stdset="1"> | 78 | <property stdset="1"> |
98 | <name>name</name> | 79 | <name>name</name> |
99 | <cstring>line1</cstring> | 80 | <cstring>line1</cstring> |
100 | </property> | 81 | </property> |
101 | <property stdset="1"> | 82 | <property stdset="1"> |
102 | <name>orientation</name> | 83 | <name>orientation</name> |
103 | <enum>Horizontal</enum> | 84 | <enum>Horizontal</enum> |
104 | </property> | 85 | </property> |
105 | </widget> | 86 | </widget> |
106 | <spacer row="12" column="1" > | 87 | <widget> |
107 | <property> | 88 | <class>QLayoutWidget</class> |
108 | <name>name</name> | ||
109 | <cstring>spacer</cstring> | ||
110 | </property> | ||
111 | <property stdset="1"> | ||
112 | <name>orientation</name> | ||
113 | <enum>Vertical</enum> | ||
114 | </property> | ||
115 | <property stdset="1"> | ||
116 | <name>sizeType</name> | ||
117 | <enum>Expanding</enum> | ||
118 | </property> | ||
119 | <property> | ||
120 | <name>sizeHint</name> | ||
121 | <size> | ||
122 | <width>20</width> | ||
123 | <height>20</height> | ||
124 | </size> | ||
125 | </property> | ||
126 | </spacer> | ||
127 | <widget row="8" column="1" > | ||
128 | <class>QLineEdit</class> | ||
129 | <property stdset="1"> | 89 | <property stdset="1"> |
130 | <name>name</name> | 90 | <name>name</name> |
131 | <cstring>userLine</cstring> | 91 | <cstring>Layout23</cstring> |
132 | </property> | 92 | </property> |
133 | </widget> | 93 | <hbox> |
134 | <widget row="9" column="1" > | 94 | <property stdset="1"> |
135 | <class>QLineEdit</class> | 95 | <name>margin</name> |
136 | <property stdset="1"> | 96 | <number>0</number> |
137 | <name>name</name> | 97 | </property> |
138 | <cstring>passLine</cstring> | 98 | <property stdset="1"> |
139 | </property> | 99 | <name>spacing</name> |
140 | <property stdset="1"> | 100 | <number>6</number> |
141 | <name>echoMode</name> | 101 | </property> |
142 | <enum>Password</enum> | 102 | <widget> |
143 | </property> | 103 | <class>QLabel</class> |
144 | </widget> | 104 | <property stdset="1"> |
145 | <widget row="11" column="0" > | 105 | <name>name</name> |
146 | <class>QLabel</class> | 106 | <cstring>serverLabel</cstring> |
147 | <property stdset="1"> | 107 | </property> |
148 | <name>name</name> | 108 | <property stdset="1"> |
149 | <cstring>prefixLabel</cstring> | 109 | <name>text</name> |
150 | </property> | 110 | <string>Server</string> |
151 | <property stdset="1"> | 111 | </property> |
152 | <name>text</name> | 112 | </widget> |
153 | <string>Prefix</string> | 113 | <widget> |
154 | </property> | 114 | <class>QLineEdit</class> |
115 | <property stdset="1"> | ||
116 | <name>name</name> | ||
117 | <cstring>serverLine</cstring> | ||
118 | </property> | ||
119 | </widget> | ||
120 | </hbox> | ||
155 | </widget> | 121 | </widget> |
156 | <widget row="11" column="1" > | 122 | <widget> |
157 | <class>QLineEdit</class> | 123 | <class>QLayoutWidget</class> |
158 | <property stdset="1"> | 124 | <property stdset="1"> |
159 | <name>name</name> | 125 | <name>name</name> |
160 | <cstring>prefixLine</cstring> | 126 | <cstring>Layout24</cstring> |
161 | </property> | 127 | </property> |
128 | <hbox> | ||
129 | <property stdset="1"> | ||
130 | <name>margin</name> | ||
131 | <number>0</number> | ||
132 | </property> | ||
133 | <property stdset="1"> | ||
134 | <name>spacing</name> | ||
135 | <number>6</number> | ||
136 | </property> | ||
137 | <widget> | ||
138 | <class>QLabel</class> | ||
139 | <property stdset="1"> | ||
140 | <name>name</name> | ||
141 | <cstring>portLabel</cstring> | ||
142 | </property> | ||
143 | <property stdset="1"> | ||
144 | <name>text</name> | ||
145 | <string>Port</string> | ||
146 | </property> | ||
147 | </widget> | ||
148 | <widget> | ||
149 | <class>QLineEdit</class> | ||
150 | <property stdset="1"> | ||
151 | <name>name</name> | ||
152 | <cstring>portLine</cstring> | ||
153 | </property> | ||
154 | </widget> | ||
155 | </hbox> | ||
162 | </widget> | 156 | </widget> |
163 | <widget row="8" column="0" > | 157 | <widget> |
164 | <class>QLabel</class> | 158 | <class>QLayoutWidget</class> |
165 | <property stdset="1"> | 159 | <property stdset="1"> |
166 | <name>name</name> | 160 | <name>name</name> |
167 | <cstring>userLabel</cstring> | 161 | <cstring>Layout16</cstring> |
168 | </property> | 162 | </property> |
169 | <property stdset="1"> | 163 | <vbox> |
170 | <name>text</name> | 164 | <property stdset="1"> |
171 | <string>User</string> | 165 | <name>margin</name> |
172 | </property> | 166 | <number>0</number> |
167 | </property> | ||
168 | <property stdset="1"> | ||
169 | <name>spacing</name> | ||
170 | <number>6</number> | ||
171 | </property> | ||
172 | <widget> | ||
173 | <class>QLabel</class> | ||
174 | <property stdset="1"> | ||
175 | <name>name</name> | ||
176 | <cstring>TextLabel1</cstring> | ||
177 | </property> | ||
178 | <property stdset="1"> | ||
179 | <name>text</name> | ||
180 | <string>Use secure sockets:</string> | ||
181 | </property> | ||
182 | </widget> | ||
183 | <widget> | ||
184 | <class>QComboBox</class> | ||
185 | <property stdset="1"> | ||
186 | <name>name</name> | ||
187 | <cstring>ComboBox1</cstring> | ||
188 | </property> | ||
189 | </widget> | ||
190 | <widget> | ||
191 | <class>QLineEdit</class> | ||
192 | <property stdset="1"> | ||
193 | <name>name</name> | ||
194 | <cstring>CommandEdit</cstring> | ||
195 | </property> | ||
196 | <property stdset="1"> | ||
197 | <name>text</name> | ||
198 | <string>ssh $SERVER exec</string> | ||
199 | </property> | ||
200 | </widget> | ||
201 | </vbox> | ||
173 | </widget> | 202 | </widget> |
174 | <widget row="7" column="0" rowspan="1" colspan="2" > | 203 | <widget> |
175 | <class>Line</class> | 204 | <class>Line</class> |
176 | <property stdset="1"> | 205 | <property stdset="1"> |
177 | <name>name</name> | 206 | <name>name</name> |
178 | <cstring>line2</cstring> | 207 | <cstring>line2</cstring> |
179 | </property> | 208 | </property> |
180 | <property stdset="1"> | 209 | <property stdset="1"> |
181 | <name>enabled</name> | 210 | <name>enabled</name> |
182 | <bool>true</bool> | 211 | <bool>true</bool> |
183 | </property> | 212 | </property> |
184 | <property stdset="1"> | 213 | <property stdset="1"> |
185 | <name>caption</name> | 214 | <name>caption</name> |
186 | <string></string> | 215 | <string></string> |
187 | </property> | 216 | </property> |
188 | <property stdset="1"> | 217 | <property stdset="1"> |
189 | <name>orientation</name> | 218 | <name>orientation</name> |
190 | <enum>Horizontal</enum> | 219 | <enum>Horizontal</enum> |
191 | </property> | 220 | </property> |
192 | <property> | 221 | <property> |
193 | <name>layoutMargin</name> | 222 | <name>layoutMargin</name> |
194 | </property> | 223 | </property> |
195 | <property> | 224 | <property> |
196 | <name>layoutSpacing</name> | 225 | <name>layoutSpacing</name> |
197 | </property> | 226 | </property> |
198 | </widget> | 227 | </widget> |
199 | <widget row="10" column="0" rowspan="1" colspan="2" > | 228 | <widget> |
229 | <class>QLayoutWidget</class> | ||
230 | <property stdset="1"> | ||
231 | <name>name</name> | ||
232 | <cstring>Layout25</cstring> | ||
233 | </property> | ||
234 | <hbox> | ||
235 | <property stdset="1"> | ||
236 | <name>margin</name> | ||
237 | <number>0</number> | ||
238 | </property> | ||
239 | <property stdset="1"> | ||
240 | <name>spacing</name> | ||
241 | <number>6</number> | ||
242 | </property> | ||
243 | <widget> | ||
244 | <class>QLabel</class> | ||
245 | <property stdset="1"> | ||
246 | <name>name</name> | ||
247 | <cstring>userLabel</cstring> | ||
248 | </property> | ||
249 | <property stdset="1"> | ||
250 | <name>text</name> | ||
251 | <string>User</string> | ||
252 | </property> | ||
253 | </widget> | ||
254 | <widget> | ||
255 | <class>QLineEdit</class> | ||
256 | <property stdset="1"> | ||
257 | <name>name</name> | ||
258 | <cstring>userLine</cstring> | ||
259 | </property> | ||
260 | </widget> | ||
261 | </hbox> | ||
262 | </widget> | ||
263 | <widget> | ||
264 | <class>QLayoutWidget</class> | ||
265 | <property stdset="1"> | ||
266 | <name>name</name> | ||
267 | <cstring>Layout26</cstring> | ||
268 | </property> | ||
269 | <hbox> | ||
270 | <property stdset="1"> | ||
271 | <name>margin</name> | ||
272 | <number>0</number> | ||
273 | </property> | ||
274 | <property stdset="1"> | ||
275 | <name>spacing</name> | ||
276 | <number>6</number> | ||
277 | </property> | ||
278 | <widget> | ||
279 | <class>QLabel</class> | ||
280 | <property stdset="1"> | ||
281 | <name>name</name> | ||
282 | <cstring>passLabel</cstring> | ||
283 | </property> | ||
284 | <property stdset="1"> | ||
285 | <name>text</name> | ||
286 | <string>Password</string> | ||
287 | </property> | ||
288 | </widget> | ||
289 | <widget> | ||
290 | <class>QLineEdit</class> | ||
291 | <property stdset="1"> | ||
292 | <name>name</name> | ||
293 | <cstring>passLine</cstring> | ||
294 | </property> | ||
295 | <property stdset="1"> | ||
296 | <name>echoMode</name> | ||
297 | <enum>Password</enum> | ||
298 | </property> | ||
299 | </widget> | ||
300 | </hbox> | ||
301 | </widget> | ||
302 | <widget> | ||
200 | <class>Line</class> | 303 | <class>Line</class> |
201 | <property stdset="1"> | 304 | <property stdset="1"> |
202 | <name>name</name> | 305 | <name>name</name> |
203 | <cstring>Line3</cstring> | 306 | <cstring>Line3</cstring> |
204 | </property> | 307 | </property> |
205 | <property stdset="1"> | 308 | <property stdset="1"> |
206 | <name>orientation</name> | 309 | <name>orientation</name> |
207 | <enum>Horizontal</enum> | 310 | <enum>Horizontal</enum> |
208 | </property> | 311 | </property> |
209 | </widget> | 312 | </widget> |
210 | <widget row="9" column="0" > | 313 | <widget> |
211 | <class>QLabel</class> | 314 | <class>QLayoutWidget</class> |
212 | <property stdset="1"> | 315 | <property stdset="1"> |
213 | <name>name</name> | 316 | <name>name</name> |
214 | <cstring>passLabel</cstring> | 317 | <cstring>Layout27</cstring> |
215 | </property> | 318 | </property> |
319 | <hbox> | ||
320 | <property stdset="1"> | ||
321 | <name>margin</name> | ||
322 | <number>0</number> | ||
323 | </property> | ||
324 | <property stdset="1"> | ||
325 | <name>spacing</name> | ||
326 | <number>6</number> | ||
327 | </property> | ||
328 | <widget> | ||
329 | <class>QLabel</class> | ||
330 | <property stdset="1"> | ||
331 | <name>name</name> | ||
332 | <cstring>prefixLabel</cstring> | ||
333 | </property> | ||
334 | <property stdset="1"> | ||
335 | <name>text</name> | ||
336 | <string>Prefix</string> | ||
337 | </property> | ||
338 | </widget> | ||
339 | <widget> | ||
340 | <class>QLineEdit</class> | ||
341 | <property stdset="1"> | ||
342 | <name>name</name> | ||
343 | <cstring>prefixLine</cstring> | ||
344 | </property> | ||
345 | </widget> | ||
346 | </hbox> | ||
347 | </widget> | ||
348 | <widget> | ||
349 | <class>QLayoutWidget</class> | ||
216 | <property stdset="1"> | 350 | <property stdset="1"> |
217 | <name>text</name> | 351 | <name>name</name> |
218 | <string>Password</string> | 352 | <cstring>Layout11</cstring> |
219 | </property> | 353 | </property> |
354 | <hbox> | ||
355 | <property stdset="1"> | ||
356 | <name>margin</name> | ||
357 | <number>0</number> | ||
358 | </property> | ||
359 | <property stdset="1"> | ||
360 | <name>spacing</name> | ||
361 | <number>6</number> | ||
362 | </property> | ||
363 | <widget> | ||
364 | <class>QLabel</class> | ||
365 | <property stdset="1"> | ||
366 | <name>name</name> | ||
367 | <cstring>TextLabel1_2</cstring> | ||
368 | </property> | ||
369 | <property stdset="1"> | ||
370 | <name>text</name> | ||
371 | <string>Local storage folder:</string> | ||
372 | </property> | ||
373 | </widget> | ||
374 | <widget> | ||
375 | <class>QLineEdit</class> | ||
376 | <property stdset="1"> | ||
377 | <name>name</name> | ||
378 | <cstring>localFolder</cstring> | ||
379 | </property> | ||
380 | <property stdset="1"> | ||
381 | <name>text</name> | ||
382 | <string></string> | ||
383 | </property> | ||
384 | </widget> | ||
385 | </hbox> | ||
386 | </widget> | ||
387 | <widget> | ||
388 | <class>QLayoutWidget</class> | ||
389 | <property stdset="1"> | ||
390 | <name>name</name> | ||
391 | <cstring>Layout12</cstring> | ||
392 | </property> | ||
393 | <hbox> | ||
394 | <property stdset="1"> | ||
395 | <name>margin</name> | ||
396 | <number>0</number> | ||
397 | </property> | ||
398 | <property stdset="1"> | ||
399 | <name>spacing</name> | ||
400 | <number>6</number> | ||
401 | </property> | ||
402 | <widget> | ||
403 | <class>QCheckBox</class> | ||
404 | <property stdset="1"> | ||
405 | <name>name</name> | ||
406 | <cstring>CheckBoxDown</cstring> | ||
407 | </property> | ||
408 | <property stdset="1"> | ||
409 | <name>text</name> | ||
410 | <string>Download only messages smaller</string> | ||
411 | </property> | ||
412 | </widget> | ||
413 | <widget> | ||
414 | <class>QSpinBox</class> | ||
415 | <property stdset="1"> | ||
416 | <name>name</name> | ||
417 | <cstring>SpinBoxDown</cstring> | ||
418 | </property> | ||
419 | <property stdset="1"> | ||
420 | <name>suffix</name> | ||
421 | <string>kB</string> | ||
422 | </property> | ||
423 | <property stdset="1"> | ||
424 | <name>maxValue</name> | ||
425 | <number>99999</number> | ||
426 | </property> | ||
427 | <property stdset="1"> | ||
428 | <name>minValue</name> | ||
429 | <number>1</number> | ||
430 | </property> | ||
431 | </widget> | ||
432 | </hbox> | ||
220 | </widget> | 433 | </widget> |
221 | <widget row="6" column="0" rowspan="1" colspan="2" > | 434 | <widget> |
222 | <class>QLineEdit</class> | 435 | <class>QCheckBox</class> |
223 | <property stdset="1"> | 436 | <property stdset="1"> |
224 | <name>name</name> | 437 | <name>name</name> |
225 | <cstring>CommandEdit</cstring> | 438 | <cstring>CheckBoxLeaveOn</cstring> |
226 | </property> | 439 | </property> |
227 | <property stdset="1"> | 440 | <property stdset="1"> |
228 | <name>text</name> | 441 | <name>text</name> |
229 | <string>ssh $SERVER exec</string> | 442 | <string>Leave Messages on Server</string> |
230 | </property> | 443 | </property> |
231 | </widget> | 444 | </widget> |
232 | <widget row="5" column="0" rowspan="1" colspan="2" > | 445 | <spacer> |
233 | <class>QComboBox</class> | 446 | <property> |
234 | <property stdset="1"> | ||
235 | <name>name</name> | 447 | <name>name</name> |
236 | <cstring>ComboBox1</cstring> | 448 | <cstring>spacer</cstring> |
237 | </property> | 449 | </property> |
238 | </widget> | ||
239 | <widget row="4" column="0" rowspan="1" colspan="2" > | ||
240 | <class>QLabel</class> | ||
241 | <property stdset="1"> | 450 | <property stdset="1"> |
242 | <name>name</name> | 451 | <name>orientation</name> |
243 | <cstring>TextLabel1</cstring> | 452 | <enum>Vertical</enum> |
244 | </property> | 453 | </property> |
245 | <property stdset="1"> | 454 | <property stdset="1"> |
246 | <name>text</name> | 455 | <name>sizeType</name> |
247 | <string>Use secure sockets:</string> | 456 | <enum>Expanding</enum> |
248 | </property> | 457 | </property> |
249 | </widget> | 458 | <property> |
250 | </grid> | 459 | <name>sizeHint</name> |
460 | <size> | ||
461 | <width>20</width> | ||
462 | <height>20</height> | ||
463 | </size> | ||
464 | </property> | ||
465 | </spacer> | ||
466 | </vbox> | ||
251 | </widget> | 467 | </widget> |
252 | <tabstops> | 468 | <tabstops> |
253 | <tabstop>accountLine</tabstop> | 469 | <tabstop>accountLine</tabstop> |
254 | <tabstop>serverLine</tabstop> | 470 | <tabstop>serverLine</tabstop> |
255 | <tabstop>portLine</tabstop> | 471 | <tabstop>portLine</tabstop> |
256 | <tabstop>userLine</tabstop> | 472 | <tabstop>userLine</tabstop> |
257 | <tabstop>passLine</tabstop> | 473 | <tabstop>passLine</tabstop> |
258 | </tabstops> | 474 | </tabstops> |
259 | </UI> | 475 | </UI> |
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index 90e32fa..f996d9c 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp | |||
@@ -52,361 +52,375 @@ void Settings::delAccount( Account *account ) | |||
52 | accounts.remove( account ); | 52 | accounts.remove( account ); |
53 | account->remove(); | 53 | account->remove(); |
54 | } | 54 | } |
55 | 55 | ||
56 | void Settings::updateAccounts() | 56 | void Settings::updateAccounts() |
57 | { | 57 | { |
58 | accounts.clear(); | 58 | accounts.clear(); |
59 | QDir dir( locateLocal("data", "kopiemail" ) ); | 59 | QDir dir( locateLocal("data", "kopiemail" ) ); |
60 | QStringList::Iterator it; | 60 | QStringList::Iterator it; |
61 | 61 | ||
62 | QStringList imap = dir.entryList( "imap-*" ); | 62 | QStringList imap = dir.entryList( "imap-*" ); |
63 | for ( it = imap.begin(); it != imap.end(); it++ ) { | 63 | for ( it = imap.begin(); it != imap.end(); it++ ) { |
64 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); | 64 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); |
65 | accounts.append( account ); | 65 | accounts.append( account ); |
66 | } | 66 | } |
67 | 67 | ||
68 | QStringList pop3 = dir.entryList( "pop3-*" ); | 68 | QStringList pop3 = dir.entryList( "pop3-*" ); |
69 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { | 69 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { |
70 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); | 70 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); |
71 | accounts.append( account ); | 71 | accounts.append( account ); |
72 | } | 72 | } |
73 | 73 | ||
74 | QStringList smtp = dir.entryList( "smtp-*" ); | 74 | QStringList smtp = dir.entryList( "smtp-*" ); |
75 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { | 75 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { |
76 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); | 76 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); |
77 | accounts.append( account ); | 77 | accounts.append( account ); |
78 | } | 78 | } |
79 | 79 | ||
80 | QStringList nntp = dir.entryList( "nntp-*" ); | 80 | QStringList nntp = dir.entryList( "nntp-*" ); |
81 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { | 81 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { |
82 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); | 82 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); |
83 | accounts.append( account ); | 83 | accounts.append( account ); |
84 | } | 84 | } |
85 | 85 | ||
86 | readAccounts(); | 86 | readAccounts(); |
87 | } | 87 | } |
88 | 88 | ||
89 | void Settings::saveAccounts() | 89 | void Settings::saveAccounts() |
90 | { | 90 | { |
91 | checkDirectory(); | 91 | checkDirectory(); |
92 | Account *it; | 92 | Account *it; |
93 | 93 | ||
94 | for ( it = accounts.first(); it; it = accounts.next() ) { | 94 | for ( it = accounts.first(); it; it = accounts.next() ) { |
95 | it->save(); | 95 | it->save(); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | void Settings::readAccounts() | 99 | void Settings::readAccounts() |
100 | { | 100 | { |
101 | checkDirectory(); | 101 | checkDirectory(); |
102 | Account *it; | 102 | Account *it; |
103 | 103 | ||
104 | for ( it = accounts.first(); it; it = accounts.next() ) { | 104 | for ( it = accounts.first(); it; it = accounts.next() ) { |
105 | it->read(); | 105 | it->read(); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | Account::Account() | 109 | Account::Account() |
110 | { | 110 | { |
111 | accountName = "changeMe"; | 111 | accountName = "changeMe"; |
112 | type = MAILLIB::A_UNDEFINED; | 112 | type = MAILLIB::A_UNDEFINED; |
113 | ssl = false; | 113 | ssl = false; |
114 | connectionType = 1; | 114 | connectionType = 1; |
115 | offline = false; | 115 | offline = false; |
116 | } | 116 | } |
117 | 117 | ||
118 | void Account::remove() | 118 | void Account::remove() |
119 | { | 119 | { |
120 | QFile file( getFileName() ); | 120 | QFile file( getFileName() ); |
121 | file.remove(); | 121 | file.remove(); |
122 | } | 122 | } |
123 | 123 | ||
124 | IMAPaccount::IMAPaccount() | 124 | IMAPaccount::IMAPaccount() |
125 | : Account() | 125 | : Account() |
126 | { | 126 | { |
127 | file = IMAPaccount::getUniqueFileName(); | 127 | file = IMAPaccount::getUniqueFileName(); |
128 | accountName = "New IMAP Account"; | 128 | accountName = "New IMAP Account"; |
129 | ssl = false; | 129 | ssl = false; |
130 | connectionType = 1; | 130 | connectionType = 1; |
131 | type = MAILLIB::A_IMAP; | 131 | type = MAILLIB::A_IMAP; |
132 | port = IMAP_PORT; | 132 | port = IMAP_PORT; |
133 | } | 133 | } |
134 | 134 | ||
135 | IMAPaccount::IMAPaccount( QString filename ) | 135 | IMAPaccount::IMAPaccount( QString filename ) |
136 | : Account() | 136 | : Account() |
137 | { | 137 | { |
138 | file = filename; | 138 | file = filename; |
139 | accountName = "New IMAP Account"; | 139 | accountName = "New IMAP Account"; |
140 | ssl = false; | 140 | ssl = false; |
141 | connectionType = 1; | 141 | connectionType = 1; |
142 | type = MAILLIB::A_IMAP; | 142 | type = MAILLIB::A_IMAP; |
143 | port = IMAP_PORT; | 143 | port = IMAP_PORT; |
144 | } | 144 | } |
145 | 145 | ||
146 | QString IMAPaccount::getUniqueFileName() | 146 | QString IMAPaccount::getUniqueFileName() |
147 | { | 147 | { |
148 | int num = 0; | 148 | int num = 0; |
149 | QString unique; | 149 | QString unique; |
150 | 150 | ||
151 | QDir dir( locateLocal("data", "kopiemail" ) ); | 151 | QDir dir( locateLocal("data", "kopiemail" ) ); |
152 | 152 | ||
153 | QStringList imap = dir.entryList( "imap-*" ); | 153 | QStringList imap = dir.entryList( "imap-*" ); |
154 | do { | 154 | do { |
155 | unique.setNum( num++ ); | 155 | unique.setNum( num++ ); |
156 | } while ( imap.contains( "imap-" + unique ) > 0 ); | 156 | } while ( imap.contains( "imap-" + unique ) > 0 ); |
157 | 157 | ||
158 | return unique; | 158 | return unique; |
159 | } | 159 | } |
160 | 160 | ||
161 | void IMAPaccount::read() | 161 | void IMAPaccount::read() |
162 | { | 162 | { |
163 | Config *conf = new Config( getFileName(), Config::File ); | 163 | Config *conf = new Config( getFileName(), Config::File ); |
164 | conf->setGroup( "IMAP Account" ); | 164 | conf->setGroup( "IMAP Account" ); |
165 | accountName = conf->readEntry( "Account","" ); | 165 | accountName = conf->readEntry( "Account","" ); |
166 | if (accountName.isNull()) accountName = ""; | 166 | if (accountName.isNull()) accountName = ""; |
167 | server = conf->readEntry( "Server","" ); | 167 | server = conf->readEntry( "Server","" ); |
168 | if (server.isNull()) server=""; | 168 | if (server.isNull()) server=""; |
169 | port = conf->readEntry( "Port","" ); | 169 | port = conf->readEntry( "Port","" ); |
170 | if (port.isNull()) port="143"; | 170 | if (port.isNull()) port="143"; |
171 | connectionType = conf->readNumEntry( "ConnectionType" ); | 171 | connectionType = conf->readNumEntry( "ConnectionType" ); |
172 | ssl = conf->readBoolEntry( "SSL",false ); | 172 | ssl = conf->readBoolEntry( "SSL",false ); |
173 | user = conf->readEntry( "User","" ); | 173 | user = conf->readEntry( "User","" ); |
174 | if (user.isNull()) user = ""; | 174 | if (user.isNull()) user = ""; |
175 | password = conf->readEntryCrypt( "Password","" ); | 175 | password = conf->readEntryCrypt( "Password","" ); |
176 | if (password.isNull()) password = ""; | 176 | if (password.isNull()) password = ""; |
177 | prefix = conf->readEntry("MailPrefix",""); | 177 | prefix = conf->readEntry("MailPrefix",""); |
178 | if (prefix.isNull()) prefix = ""; | 178 | if (prefix.isNull()) prefix = ""; |
179 | offline = conf->readBoolEntry("Offline",false); | 179 | offline = conf->readBoolEntry("Offline",false); |
180 | localFolder = conf->readEntry( "LocalFolder" ); | ||
181 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); | ||
182 | int lf = conf->readNumEntry( "LastFetch",0 ); | ||
183 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | ||
184 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); | ||
185 | lastFetch = dt.addSecs( lf ); | ||
180 | delete conf; | 186 | delete conf; |
181 | } | 187 | } |
182 | 188 | ||
183 | void IMAPaccount::save() | 189 | void IMAPaccount::save() |
184 | { | 190 | { |
185 | qDebug("saving %s ",getFileName().latin1() ); | 191 | qDebug("saving %s ",getFileName().latin1() ); |
186 | Settings::checkDirectory(); | 192 | Settings::checkDirectory(); |
187 | 193 | ||
188 | Config *conf = new Config( getFileName(), Config::File ); | 194 | Config *conf = new Config( getFileName(), Config::File ); |
189 | conf->setGroup( "IMAP Account" ); | 195 | conf->setGroup( "IMAP Account" ); |
190 | conf->writeEntry( "Account", accountName ); | 196 | conf->writeEntry( "Account", accountName ); |
191 | conf->writeEntry( "Server", server ); | 197 | conf->writeEntry( "Server", server ); |
192 | conf->writeEntry( "Port", port ); | 198 | conf->writeEntry( "Port", port ); |
193 | conf->writeEntry( "SSL", ssl ); | 199 | conf->writeEntry( "SSL", ssl ); |
194 | conf->writeEntry( "ConnectionType", connectionType ); | 200 | conf->writeEntry( "ConnectionType", connectionType ); |
195 | conf->writeEntry( "User", user ); | 201 | conf->writeEntry( "User", user ); |
196 | conf->writeEntryCrypt( "Password", password ); | 202 | conf->writeEntryCrypt( "Password", password ); |
197 | conf->writeEntry( "MailPrefix",prefix); | 203 | conf->writeEntry( "MailPrefix",prefix); |
198 | conf->writeEntry( "Offline",offline); | 204 | conf->writeEntry( "Offline",offline); |
205 | conf->writeEntry( "LocalFolder", localFolder ); | ||
206 | conf->writeEntry( "MaxSize", maxMailSize ); | ||
207 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | ||
208 | int lf = dt.secsTo ( lastFetch ); | ||
209 | conf->writeEntry( "LastFetch", lf ); | ||
210 | conf->writeEntry( "LeaveOnServer", leaveOnServer); | ||
199 | conf->write(); | 211 | conf->write(); |
200 | delete conf; | 212 | delete conf; |
201 | } | 213 | } |
202 | 214 | ||
203 | 215 | ||
204 | QString IMAPaccount::getFileName() | 216 | QString IMAPaccount::getFileName() |
205 | { | 217 | { |
206 | return locateLocal("data", "kopiemail" ) +"/imap-" + file; | 218 | return locateLocal("data", "kopiemail" ) +"/imap-" + file; |
207 | } | 219 | } |
208 | 220 | ||
209 | POP3account::POP3account() | 221 | POP3account::POP3account() |
210 | : Account() | 222 | : Account() |
211 | { | 223 | { |
212 | file = POP3account::getUniqueFileName(); | 224 | file = POP3account::getUniqueFileName(); |
213 | accountName = "New POP3 Account"; | 225 | accountName = "New POP3 Account"; |
214 | ssl = false; | 226 | ssl = false; |
215 | connectionType = 1; | 227 | connectionType = 1; |
216 | type = MAILLIB::A_POP3; | 228 | type = MAILLIB::A_POP3; |
217 | port = POP3_PORT; | 229 | port = POP3_PORT; |
218 | } | 230 | } |
219 | 231 | ||
220 | POP3account::POP3account( QString filename ) | 232 | POP3account::POP3account( QString filename ) |
221 | : Account() | 233 | : Account() |
222 | { | 234 | { |
223 | file = filename; | 235 | file = filename; |
224 | accountName = "New POP3 Account"; | 236 | accountName = "New POP3 Account"; |
225 | ssl = false; | 237 | ssl = false; |
226 | connectionType = 1; | 238 | connectionType = 1; |
227 | type = MAILLIB::A_POP3; | 239 | type = MAILLIB::A_POP3; |
228 | port = POP3_PORT; | 240 | port = POP3_PORT; |
229 | } | 241 | } |
230 | 242 | ||
231 | QString POP3account::getUniqueFileName() | 243 | QString POP3account::getUniqueFileName() |
232 | { | 244 | { |
233 | int num = 0; | 245 | int num = 0; |
234 | QString unique; | 246 | QString unique; |
235 | 247 | ||
236 | QDir dir( locateLocal("data", "kopiemail" ) ); | 248 | QDir dir( locateLocal("data", "kopiemail" ) ); |
237 | 249 | ||
238 | QStringList imap = dir.entryList( "pop3-*" ); | 250 | QStringList imap = dir.entryList( "pop3-*" ); |
239 | do { | 251 | do { |
240 | unique.setNum( num++ ); | 252 | unique.setNum( num++ ); |
241 | } while ( imap.contains( "pop3-" + unique ) > 0 ); | 253 | } while ( imap.contains( "pop3-" + unique ) > 0 ); |
242 | 254 | ||
243 | return unique; | 255 | return unique; |
244 | } | 256 | } |
245 | 257 | ||
246 | void POP3account::read() | 258 | void POP3account::read() |
247 | { | 259 | { |
248 | Config *conf = new Config( getFileName(), Config::File ); | 260 | Config *conf = new Config( getFileName(), Config::File ); |
249 | conf->setGroup( "POP3 Account" ); | 261 | conf->setGroup( "POP3 Account" ); |
250 | accountName = conf->readEntry( "Account" ); | 262 | accountName = conf->readEntry( "Account" ); |
251 | server = conf->readEntry( "Server" ); | 263 | server = conf->readEntry( "Server" ); |
252 | port = conf->readEntry( "Port" ); | 264 | port = conf->readEntry( "Port" ); |
253 | ssl = conf->readBoolEntry( "SSL" ); | 265 | ssl = conf->readBoolEntry( "SSL" ); |
254 | connectionType = conf->readNumEntry( "ConnectionType" ); | 266 | connectionType = conf->readNumEntry( "ConnectionType" ); |
255 | user = conf->readEntry( "User" ); | 267 | user = conf->readEntry( "User" ); |
256 | password = conf->readEntryCrypt( "Password" ); | 268 | password = conf->readEntryCrypt( "Password" ); |
257 | offline = conf->readBoolEntry("Offline",false); | 269 | offline = conf->readBoolEntry("Offline",false); |
258 | localFolder = conf->readEntry( "LocalFolder" ); | 270 | localFolder = conf->readEntry( "LocalFolder" ); |
259 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); | 271 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); |
260 | int lf = conf->readNumEntry( "LastFetch",0 ); | 272 | int lf = conf->readNumEntry( "LastFetch",0 ); |
261 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 273 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
274 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); | ||
262 | lastFetch = dt.addSecs( lf ); | 275 | lastFetch = dt.addSecs( lf ); |
263 | delete conf; | 276 | delete conf; |
264 | } | 277 | } |
265 | 278 | ||
266 | void POP3account::save() | 279 | void POP3account::save() |
267 | { | 280 | { |
268 | Settings::checkDirectory(); | 281 | Settings::checkDirectory(); |
269 | 282 | ||
270 | Config *conf = new Config( getFileName(), Config::File ); | 283 | Config *conf = new Config( getFileName(), Config::File ); |
271 | conf->setGroup( "POP3 Account" ); | 284 | conf->setGroup( "POP3 Account" ); |
272 | conf->writeEntry( "Account", accountName ); | 285 | conf->writeEntry( "Account", accountName ); |
273 | conf->writeEntry( "Server", server ); | 286 | conf->writeEntry( "Server", server ); |
274 | conf->writeEntry( "Port", port ); | 287 | conf->writeEntry( "Port", port ); |
275 | conf->writeEntry( "SSL", ssl ); | 288 | conf->writeEntry( "SSL", ssl ); |
276 | conf->writeEntry( "ConnectionType", connectionType ); | 289 | conf->writeEntry( "ConnectionType", connectionType ); |
277 | conf->writeEntry( "User", user ); | 290 | conf->writeEntry( "User", user ); |
278 | conf->writeEntryCrypt( "Password", password ); | 291 | conf->writeEntryCrypt( "Password", password ); |
279 | conf->writeEntry( "Offline",offline); | 292 | conf->writeEntry( "Offline",offline); |
280 | conf->writeEntry( "LocalFolder", localFolder ); | 293 | conf->writeEntry( "LocalFolder", localFolder ); |
281 | conf->writeEntry( "MaxSize", maxMailSize ); | 294 | conf->writeEntry( "MaxSize", maxMailSize ); |
282 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 295 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
283 | int lf = dt.secsTo ( lastFetch ); | 296 | int lf = dt.secsTo ( lastFetch ); |
284 | conf->writeEntry( "LastFetch", lf ); | 297 | conf->writeEntry( "LastFetch", lf ); |
298 | conf->writeEntry( "LeaveOnServer", leaveOnServer); | ||
285 | conf->write(); | 299 | conf->write(); |
286 | delete conf; | 300 | delete conf; |
287 | } | 301 | } |
288 | 302 | ||
289 | 303 | ||
290 | QString POP3account::getFileName() | 304 | QString POP3account::getFileName() |
291 | { | 305 | { |
292 | return locateLocal("data", "kopiemail" ) +"/pop3-" + file; | 306 | return locateLocal("data", "kopiemail" ) +"/pop3-" + file; |
293 | } | 307 | } |
294 | 308 | ||
295 | SMTPaccount::SMTPaccount() | 309 | SMTPaccount::SMTPaccount() |
296 | : Account() | 310 | : Account() |
297 | { | 311 | { |
298 | file = SMTPaccount::getUniqueFileName(); | 312 | file = SMTPaccount::getUniqueFileName(); |
299 | accountName = "New SMTP Account"; | 313 | accountName = "New SMTP Account"; |
300 | ssl = false; | 314 | ssl = false; |
301 | connectionType = 1; | 315 | connectionType = 1; |
302 | login = false; | 316 | login = false; |
303 | useCC = false; | 317 | useCC = false; |
304 | useBCC = false; | 318 | useBCC = false; |
305 | useReply = false; | 319 | useReply = false; |
306 | type = MAILLIB::A_SMTP; | 320 | type = MAILLIB::A_SMTP; |
307 | port = SMTP_PORT; | 321 | port = SMTP_PORT; |
308 | } | 322 | } |
309 | 323 | ||
310 | SMTPaccount::SMTPaccount( QString filename ) | 324 | SMTPaccount::SMTPaccount( QString filename ) |
311 | : Account() | 325 | : Account() |
312 | { | 326 | { |
313 | file = filename; | 327 | file = filename; |
314 | accountName = "New SMTP Account"; | 328 | accountName = "New SMTP Account"; |
315 | ssl = false; | 329 | ssl = false; |
316 | connectionType = 1; | 330 | connectionType = 1; |
317 | login = false; | 331 | login = false; |
318 | type = MAILLIB::A_SMTP; | 332 | type = MAILLIB::A_SMTP; |
319 | port = SMTP_PORT; | 333 | port = SMTP_PORT; |
320 | } | 334 | } |
321 | 335 | ||
322 | QString SMTPaccount::getUniqueFileName() | 336 | QString SMTPaccount::getUniqueFileName() |
323 | { | 337 | { |
324 | int num = 0; | 338 | int num = 0; |
325 | QString unique; | 339 | QString unique; |
326 | 340 | ||
327 | QDir dir( locateLocal("data", "kopiemail" ) ); | 341 | QDir dir( locateLocal("data", "kopiemail" ) ); |
328 | 342 | ||
329 | QStringList imap = dir.entryList( "smtp-*" ); | 343 | QStringList imap = dir.entryList( "smtp-*" ); |
330 | do { | 344 | do { |
331 | unique.setNum( num++ ); | 345 | unique.setNum( num++ ); |
332 | } while ( imap.contains( "smtp-" + unique ) > 0 ); | 346 | } while ( imap.contains( "smtp-" + unique ) > 0 ); |
333 | 347 | ||
334 | return unique; | 348 | return unique; |
335 | } | 349 | } |
336 | 350 | ||
337 | void SMTPaccount::read() | 351 | void SMTPaccount::read() |
338 | { | 352 | { |
339 | Config *conf = new Config( getFileName(), Config::File ); | 353 | Config *conf = new Config( getFileName(), Config::File ); |
340 | conf->setGroup( "SMTP Account" ); | 354 | conf->setGroup( "SMTP Account" ); |
341 | accountName = conf->readEntry( "Account" ); | 355 | accountName = conf->readEntry( "Account" ); |
342 | server = conf->readEntry( "Server" ); | 356 | server = conf->readEntry( "Server" ); |
343 | port = conf->readEntry( "Port" ); | 357 | port = conf->readEntry( "Port" ); |
344 | ssl = conf->readBoolEntry( "SSL" ); | 358 | ssl = conf->readBoolEntry( "SSL" ); |
345 | connectionType = conf->readNumEntry( "ConnectionType" ); | 359 | connectionType = conf->readNumEntry( "ConnectionType" ); |
346 | login = conf->readBoolEntry( "Login" ); | 360 | login = conf->readBoolEntry( "Login" ); |
347 | user = conf->readEntry( "User" ); | 361 | user = conf->readEntry( "User" ); |
348 | password = conf->readEntryCrypt( "Password" ); | 362 | password = conf->readEntryCrypt( "Password" ); |
349 | delete conf; | 363 | delete conf; |
350 | } | 364 | } |
351 | 365 | ||
352 | void SMTPaccount::save() | 366 | void SMTPaccount::save() |
353 | { | 367 | { |
354 | Settings::checkDirectory(); | 368 | Settings::checkDirectory(); |
355 | 369 | ||
356 | Config *conf = new Config( getFileName(), Config::File ); | 370 | Config *conf = new Config( getFileName(), Config::File ); |
357 | conf->setGroup( "SMTP Account" ); | 371 | conf->setGroup( "SMTP Account" ); |
358 | conf->writeEntry( "Account", accountName ); | 372 | conf->writeEntry( "Account", accountName ); |
359 | conf->writeEntry( "Server", server ); | 373 | conf->writeEntry( "Server", server ); |
360 | conf->writeEntry( "Port", port ); | 374 | conf->writeEntry( "Port", port ); |
361 | conf->writeEntry( "SSL", ssl ); | 375 | conf->writeEntry( "SSL", ssl ); |
362 | conf->writeEntry( "ConnectionType", connectionType ); | 376 | conf->writeEntry( "ConnectionType", connectionType ); |
363 | conf->writeEntry( "Login", login ); | 377 | conf->writeEntry( "Login", login ); |
364 | conf->writeEntry( "User", user ); | 378 | conf->writeEntry( "User", user ); |
365 | conf->writeEntryCrypt( "Password", password ); | 379 | conf->writeEntryCrypt( "Password", password ); |
366 | conf->write(); | 380 | conf->write(); |
367 | delete conf; | 381 | delete conf; |
368 | } | 382 | } |
369 | 383 | ||
370 | 384 | ||
371 | QString SMTPaccount::getFileName() | 385 | QString SMTPaccount::getFileName() |
372 | { | 386 | { |
373 | return locateLocal("data", "kopiemail" ) +"/smtp-" + file; | 387 | return locateLocal("data", "kopiemail" ) +"/smtp-" + file; |
374 | } | 388 | } |
375 | 389 | ||
376 | NNTPaccount::NNTPaccount() | 390 | NNTPaccount::NNTPaccount() |
377 | : Account() | 391 | : Account() |
378 | { | 392 | { |
379 | file = NNTPaccount::getUniqueFileName(); | 393 | file = NNTPaccount::getUniqueFileName(); |
380 | accountName = "New NNTP Account"; | 394 | accountName = "New NNTP Account"; |
381 | ssl = false; | 395 | ssl = false; |
382 | login = false; | 396 | login = false; |
383 | type = MAILLIB::A_NNTP; | 397 | type = MAILLIB::A_NNTP; |
384 | port = NNTP_PORT; | 398 | port = NNTP_PORT; |
385 | } | 399 | } |
386 | 400 | ||
387 | NNTPaccount::NNTPaccount( QString filename ) | 401 | NNTPaccount::NNTPaccount( QString filename ) |
388 | : Account() | 402 | : Account() |
389 | { | 403 | { |
390 | file = filename; | 404 | file = filename; |
391 | accountName = "New NNTP Account"; | 405 | accountName = "New NNTP Account"; |
392 | ssl = false; | 406 | ssl = false; |
393 | login = false; | 407 | login = false; |
394 | type = MAILLIB::A_NNTP; | 408 | type = MAILLIB::A_NNTP; |
395 | port = NNTP_PORT; | 409 | port = NNTP_PORT; |
396 | } | 410 | } |
397 | 411 | ||
398 | QString NNTPaccount::getUniqueFileName() | 412 | QString NNTPaccount::getUniqueFileName() |
399 | { | 413 | { |
400 | int num = 0; | 414 | int num = 0; |
401 | QString unique; | 415 | QString unique; |
402 | 416 | ||
403 | QDir dir( locateLocal("data", "kopiemail" ) ); | 417 | QDir dir( locateLocal("data", "kopiemail" ) ); |
404 | 418 | ||
405 | QStringList imap = dir.entryList( "nntp-*" ); | 419 | QStringList imap = dir.entryList( "nntp-*" ); |
406 | do { | 420 | do { |
407 | unique.setNum( num++ ); | 421 | unique.setNum( num++ ); |
408 | } while ( imap.contains( "nntp-" + unique ) > 0 ); | 422 | } while ( imap.contains( "nntp-" + unique ) > 0 ); |
409 | 423 | ||
410 | return unique; | 424 | return unique; |
411 | } | 425 | } |
412 | 426 | ||
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h index c33c403..85b817c 100644 --- a/kmicromail/libmailwrapper/settings.h +++ b/kmicromail/libmailwrapper/settings.h | |||
@@ -1,173 +1,177 @@ | |||
1 | #ifndef SETTINGS_H | 1 | #ifndef SETTINGS_H |
2 | #define SETTINGS_H | 2 | #define SETTINGS_H |
3 | 3 | ||
4 | #include "maildefines.h" | 4 | #include "maildefines.h" |
5 | 5 | ||
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | 7 | ||
8 | /* QT */ | 8 | /* QT */ |
9 | #include <qobject.h> | 9 | #include <qobject.h> |
10 | #include <qlist.h> | 10 | #include <qlist.h> |
11 | #include <qdatetime.h> | 11 | #include <qdatetime.h> |
12 | 12 | ||
13 | class Account | 13 | class Account |
14 | { | 14 | { |
15 | 15 | ||
16 | public: | 16 | public: |
17 | Account(); | 17 | Account(); |
18 | virtual ~Account() {} | 18 | virtual ~Account() {} |
19 | 19 | ||
20 | void remove(); | 20 | void remove(); |
21 | void setAccountName( QString name ) { accountName = name; } | 21 | void setAccountName( QString name ) { accountName = name; } |
22 | const QString&getAccountName()const{ return accountName; } | 22 | const QString&getAccountName()const{ return accountName; } |
23 | MAILLIB::ATYPE getType()const{ return type; } | 23 | MAILLIB::ATYPE getType()const{ return type; } |
24 | 24 | ||
25 | void setServer(const QString&str){ server = str; } | 25 | void setServer(const QString&str){ server = str; } |
26 | const QString&getServer()const{ return server; } | 26 | const QString&getServer()const{ return server; } |
27 | 27 | ||
28 | void setLocalFolder( QString name ) { localFolder = name; } | 28 | void setLocalFolder( QString name ) { localFolder = name; } |
29 | const QString& getLocalFolder()const{ return localFolder; } | 29 | const QString& getLocalFolder()const{ return localFolder; } |
30 | 30 | ||
31 | void setPort(const QString&str) { port = str; } | 31 | void setPort(const QString&str) { port = str; } |
32 | const QString&getPort()const{ return port; } | 32 | const QString&getPort()const{ return port; } |
33 | 33 | ||
34 | void setUser(const QString&str){ user = str; } | 34 | void setUser(const QString&str){ user = str; } |
35 | const QString&getUser()const{ return user; } | 35 | const QString&getUser()const{ return user; } |
36 | 36 | ||
37 | void setPassword(const QString&str) { password = str; } | 37 | void setPassword(const QString&str) { password = str; } |
38 | const QString&getPassword()const { return password; } | 38 | const QString&getPassword()const { return password; } |
39 | 39 | ||
40 | void setSSL( bool b ) { ssl = b; } | 40 | void setSSL( bool b ) { ssl = b; } |
41 | bool getSSL() { return ssl; } | 41 | bool getSSL() { return ssl; } |
42 | 42 | ||
43 | void setConnectionType( int x ) { connectionType = x; } | 43 | void setConnectionType( int x ) { connectionType = x; } |
44 | int ConnectionType() { return connectionType; } | 44 | int ConnectionType() { return connectionType; } |
45 | 45 | ||
46 | void setMaxMailSize( int x ) { maxMailSize = x; } | 46 | void setMaxMailSize( int x ) { maxMailSize = x; } |
47 | int getMaxMailSize() { return maxMailSize; } | 47 | int getMaxMailSize() { return maxMailSize; } |
48 | 48 | ||
49 | void setOffline(bool b) {offline = b;} | 49 | void setOffline(bool b) {offline = b;} |
50 | bool getOffline()const{return offline;} | 50 | bool getOffline()const{return offline;} |
51 | 51 | ||
52 | bool getLeaveOnServer(){ return leaveOnServer;} | ||
53 | void setLeaveOnServer(bool b){ leaveOnServer = b;} | ||
54 | |||
52 | virtual QString getFileName() { return accountName; } | 55 | virtual QString getFileName() { return accountName; } |
53 | virtual void read() { ; } | 56 | virtual void read() { ; } |
54 | virtual void save() { ; } | 57 | virtual void save() { ; } |
55 | 58 | ||
56 | protected: | 59 | protected: |
57 | QString accountName, server, port, user, password; | 60 | QString accountName, server, port, user, password; |
58 | bool ssl; | 61 | bool ssl; |
59 | int connectionType; | 62 | int connectionType; |
60 | bool offline; | 63 | bool offline; |
61 | MAILLIB::ATYPE type; | 64 | MAILLIB::ATYPE type; |
62 | QString localFolder; | 65 | QString localFolder; |
63 | int maxMailSize; | 66 | int maxMailSize; |
64 | QDateTime lastFetch; | 67 | QDateTime lastFetch; |
68 | bool leaveOnServer; | ||
65 | }; | 69 | }; |
66 | 70 | ||
67 | class IMAPaccount : public Account | 71 | class IMAPaccount : public Account |
68 | { | 72 | { |
69 | 73 | ||
70 | public: | 74 | public: |
71 | IMAPaccount(); | 75 | IMAPaccount(); |
72 | IMAPaccount( QString filename ); | 76 | IMAPaccount( QString filename ); |
73 | 77 | ||
74 | static QString getUniqueFileName(); | 78 | static QString getUniqueFileName(); |
75 | 79 | ||
76 | virtual void read(); | 80 | virtual void read(); |
77 | virtual void save(); | 81 | virtual void save(); |
78 | virtual QString getFileName(); | 82 | virtual QString getFileName(); |
79 | 83 | ||
80 | void setPrefix(const QString&str) {prefix=str;} | 84 | void setPrefix(const QString&str) {prefix=str;} |
81 | const QString&getPrefix()const{return prefix;} | 85 | const QString&getPrefix()const{return prefix;} |
82 | 86 | ||
83 | private: | 87 | private: |
84 | QString file,prefix; | 88 | QString file,prefix; |
85 | 89 | ||
86 | }; | 90 | }; |
87 | 91 | ||
88 | class POP3account : public Account | 92 | class POP3account : public Account |
89 | { | 93 | { |
90 | 94 | ||
91 | public: | 95 | public: |
92 | POP3account(); | 96 | POP3account(); |
93 | POP3account( QString filename ); | 97 | POP3account( QString filename ); |
94 | 98 | ||
95 | static QString getUniqueFileName(); | 99 | static QString getUniqueFileName(); |
96 | 100 | ||
97 | virtual void read(); | 101 | virtual void read(); |
98 | virtual void save(); | 102 | virtual void save(); |
99 | virtual QString getFileName(); | 103 | virtual QString getFileName(); |
100 | 104 | ||
101 | private: | 105 | private: |
102 | QString file; | 106 | QString file; |
103 | 107 | ||
104 | }; | 108 | }; |
105 | 109 | ||
106 | class SMTPaccount : public Account | 110 | class SMTPaccount : public Account |
107 | { | 111 | { |
108 | 112 | ||
109 | public: | 113 | public: |
110 | SMTPaccount(); | 114 | SMTPaccount(); |
111 | SMTPaccount( QString filename ); | 115 | SMTPaccount( QString filename ); |
112 | 116 | ||
113 | static QString getUniqueFileName(); | 117 | static QString getUniqueFileName(); |
114 | 118 | ||
115 | virtual void read(); | 119 | virtual void read(); |
116 | virtual void save(); | 120 | virtual void save(); |
117 | virtual QString getFileName(); | 121 | virtual QString getFileName(); |
118 | 122 | ||
119 | void setLogin( bool b ) { login = b; } | 123 | void setLogin( bool b ) { login = b; } |
120 | bool getLogin() { return login; } | 124 | bool getLogin() { return login; } |
121 | 125 | ||
122 | private: | 126 | private: |
123 | QString file, name, mail, org, cc, bcc, reply, signature; | 127 | QString file, name, mail, org, cc, bcc, reply, signature; |
124 | bool useCC, useBCC, useReply, login; | 128 | bool useCC, useBCC, useReply, login; |
125 | 129 | ||
126 | }; | 130 | }; |
127 | 131 | ||
128 | class NNTPaccount : public Account | 132 | class NNTPaccount : public Account |
129 | { | 133 | { |
130 | 134 | ||
131 | public: | 135 | public: |
132 | NNTPaccount(); | 136 | NNTPaccount(); |
133 | NNTPaccount( QString filename ); | 137 | NNTPaccount( QString filename ); |
134 | 138 | ||
135 | static QString getUniqueFileName(); | 139 | static QString getUniqueFileName(); |
136 | 140 | ||
137 | virtual void read(); | 141 | virtual void read(); |
138 | virtual void save(); | 142 | virtual void save(); |
139 | virtual QString getFileName(); | 143 | virtual QString getFileName(); |
140 | 144 | ||
141 | void setLogin( bool b ) { login = b; } | 145 | void setLogin( bool b ) { login = b; } |
142 | bool getLogin() { return login; } | 146 | bool getLogin() { return login; } |
143 | 147 | ||
144 | void setGroups( QStringList list ) { subscribedGroups = list; } | 148 | void setGroups( QStringList list ) { subscribedGroups = list; } |
145 | QStringList getGroups() { return subscribedGroups; } | 149 | QStringList getGroups() { return subscribedGroups; } |
146 | 150 | ||
147 | private: | 151 | private: |
148 | QString file; | 152 | QString file; |
149 | bool login; | 153 | bool login; |
150 | QStringList subscribedGroups; | 154 | QStringList subscribedGroups; |
151 | 155 | ||
152 | }; | 156 | }; |
153 | 157 | ||
154 | class Settings : public QObject | 158 | class Settings : public QObject |
155 | { | 159 | { |
156 | Q_OBJECT | 160 | Q_OBJECT |
157 | 161 | ||
158 | public: | 162 | public: |
159 | Settings(); | 163 | Settings(); |
160 | QList<Account> getAccounts(); | 164 | QList<Account> getAccounts(); |
161 | void addAccount(Account *account); | 165 | void addAccount(Account *account); |
162 | void delAccount(Account *account); | 166 | void delAccount(Account *account); |
163 | void saveAccounts(); | 167 | void saveAccounts(); |
164 | void readAccounts(); | 168 | void readAccounts(); |
165 | static void checkDirectory(); | 169 | static void checkDirectory(); |
166 | 170 | ||
167 | private: | 171 | private: |
168 | void updateAccounts(); | 172 | void updateAccounts(); |
169 | QList<Account> accounts; | 173 | QList<Account> accounts; |
170 | 174 | ||
171 | }; | 175 | }; |
172 | 176 | ||
173 | #endif | 177 | #endif |
diff --git a/kmicromail/pop3configui.ui b/kmicromail/pop3configui.ui index a2d43bd..6acd394 100644 --- a/kmicromail/pop3configui.ui +++ b/kmicromail/pop3configui.ui | |||
@@ -1,163 +1,163 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>POP3configUI</class> | 2 | <class>POP3configUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>POP3configUI</cstring> | 7 | <cstring>POP3configUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>322</width> | 14 | <width>306</width> |
15 | <height>404</height> | 15 | <height>371</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Configure POP3</string> | 20 | <string>Configure POP3</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>11</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>6</number> | 35 | <number>1</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QLayoutWidget</class> | 38 | <class>QLayoutWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>Layout12</cstring> | 41 | <cstring>Layout12</cstring> |
42 | </property> | 42 | </property> |
43 | <hbox> | 43 | <hbox> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>margin</name> | 45 | <name>margin</name> |
46 | <number>0</number> | 46 | <number>0</number> |
47 | </property> | 47 | </property> |
48 | <property stdset="1"> | 48 | <property stdset="1"> |
49 | <name>spacing</name> | 49 | <name>spacing</name> |
50 | <number>6</number> | 50 | <number>6</number> |
51 | </property> | 51 | </property> |
52 | <widget> | 52 | <widget> |
53 | <class>QLabel</class> | 53 | <class>QLabel</class> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>name</name> | 55 | <name>name</name> |
56 | <cstring>accountLabel</cstring> | 56 | <cstring>accountLabel</cstring> |
57 | </property> | 57 | </property> |
58 | <property stdset="1"> | 58 | <property stdset="1"> |
59 | <name>text</name> | 59 | <name>text</name> |
60 | <string>Account</string> | 60 | <string>Account</string> |
61 | </property> | 61 | </property> |
62 | </widget> | 62 | </widget> |
63 | <widget> | 63 | <widget> |
64 | <class>QLineEdit</class> | 64 | <class>QLineEdit</class> |
65 | <property stdset="1"> | 65 | <property stdset="1"> |
66 | <name>name</name> | 66 | <name>name</name> |
67 | <cstring>accountLine</cstring> | 67 | <cstring>accountLine</cstring> |
68 | </property> | 68 | </property> |
69 | <property> | 69 | <property> |
70 | <name>toolTip</name> | 70 | <name>toolTip</name> |
71 | <string>Name of the Account</string> | 71 | <string>Name of the Account</string> |
72 | </property> | 72 | </property> |
73 | </widget> | 73 | </widget> |
74 | </hbox> | 74 | </hbox> |
75 | </widget> | 75 | </widget> |
76 | <widget> | 76 | <widget> |
77 | <class>Line</class> | 77 | <class>Line</class> |
78 | <property stdset="1"> | 78 | <property stdset="1"> |
79 | <name>name</name> | 79 | <name>name</name> |
80 | <cstring>line1</cstring> | 80 | <cstring>line1</cstring> |
81 | </property> | 81 | </property> |
82 | <property stdset="1"> | 82 | <property stdset="1"> |
83 | <name>orientation</name> | 83 | <name>orientation</name> |
84 | <enum>Horizontal</enum> | 84 | <enum>Horizontal</enum> |
85 | </property> | 85 | </property> |
86 | </widget> | 86 | </widget> |
87 | <widget> | 87 | <widget> |
88 | <class>QLayoutWidget</class> | 88 | <class>QLayoutWidget</class> |
89 | <property stdset="1"> | 89 | <property stdset="1"> |
90 | <name>name</name> | 90 | <name>name</name> |
91 | <cstring>Layout11</cstring> | 91 | <cstring>Layout11</cstring> |
92 | </property> | 92 | </property> |
93 | <hbox> | 93 | <hbox> |
94 | <property stdset="1"> | 94 | <property stdset="1"> |
95 | <name>margin</name> | 95 | <name>margin</name> |
96 | <number>0</number> | 96 | <number>0</number> |
97 | </property> | 97 | </property> |
98 | <property stdset="1"> | 98 | <property stdset="1"> |
99 | <name>spacing</name> | 99 | <name>spacing</name> |
100 | <number>6</number> | 100 | <number>6</number> |
101 | </property> | 101 | </property> |
102 | <widget> | 102 | <widget> |
103 | <class>QLayoutWidget</class> | 103 | <class>QLayoutWidget</class> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>name</name> | 105 | <name>name</name> |
106 | <cstring>Layout9</cstring> | 106 | <cstring>Layout9</cstring> |
107 | </property> | 107 | </property> |
108 | <vbox> | 108 | <vbox> |
109 | <property stdset="1"> | 109 | <property stdset="1"> |
110 | <name>margin</name> | 110 | <name>margin</name> |
111 | <number>0</number> | 111 | <number>0</number> |
112 | </property> | 112 | </property> |
113 | <property stdset="1"> | 113 | <property stdset="1"> |
114 | <name>spacing</name> | 114 | <name>spacing</name> |
115 | <number>6</number> | 115 | <number>6</number> |
116 | </property> | 116 | </property> |
117 | <widget> | 117 | <widget> |
118 | <class>QLabel</class> | 118 | <class>QLabel</class> |
119 | <property stdset="1"> | 119 | <property stdset="1"> |
120 | <name>name</name> | 120 | <name>name</name> |
121 | <cstring>serverLabel</cstring> | 121 | <cstring>serverLabel</cstring> |
122 | </property> | 122 | </property> |
123 | <property stdset="1"> | 123 | <property stdset="1"> |
124 | <name>text</name> | 124 | <name>text</name> |
125 | <string>Server</string> | 125 | <string>Server</string> |
126 | </property> | 126 | </property> |
127 | </widget> | 127 | </widget> |
128 | <widget> | 128 | <widget> |
129 | <class>QLabel</class> | 129 | <class>QLabel</class> |
130 | <property stdset="1"> | 130 | <property stdset="1"> |
131 | <name>name</name> | 131 | <name>name</name> |
132 | <cstring>portLabel</cstring> | 132 | <cstring>portLabel</cstring> |
133 | </property> | 133 | </property> |
134 | <property stdset="1"> | 134 | <property stdset="1"> |
135 | <name>text</name> | 135 | <name>text</name> |
136 | <string>Port</string> | 136 | <string>Port</string> |
137 | </property> | 137 | </property> |
138 | </widget> | 138 | </widget> |
139 | </vbox> | 139 | </vbox> |
140 | </widget> | 140 | </widget> |
141 | <widget> | 141 | <widget> |
142 | <class>QLayoutWidget</class> | 142 | <class>QLayoutWidget</class> |
143 | <property stdset="1"> | 143 | <property stdset="1"> |
144 | <name>name</name> | 144 | <name>name</name> |
145 | <cstring>Layout10</cstring> | 145 | <cstring>Layout10</cstring> |
146 | </property> | 146 | </property> |
147 | <vbox> | 147 | <vbox> |
148 | <property stdset="1"> | 148 | <property stdset="1"> |
149 | <name>margin</name> | 149 | <name>margin</name> |
150 | <number>0</number> | 150 | <number>0</number> |
151 | </property> | 151 | </property> |
152 | <property stdset="1"> | 152 | <property stdset="1"> |
153 | <name>spacing</name> | 153 | <name>spacing</name> |
154 | <number>6</number> | 154 | <number>6</number> |
155 | </property> | 155 | </property> |
156 | <widget> | 156 | <widget> |
157 | <class>QLineEdit</class> | 157 | <class>QLineEdit</class> |
158 | <property stdset="1"> | 158 | <property stdset="1"> |
159 | <name>name</name> | 159 | <name>name</name> |
160 | <cstring>serverLine</cstring> | 160 | <cstring>serverLine</cstring> |
161 | </property> | 161 | </property> |
162 | </widget> | 162 | </widget> |
163 | <widget> | 163 | <widget> |
@@ -280,159 +280,170 @@ | |||
280 | <string>Password</string> | 280 | <string>Password</string> |
281 | </property> | 281 | </property> |
282 | </widget> | 282 | </widget> |
283 | </vbox> | 283 | </vbox> |
284 | </widget> | 284 | </widget> |
285 | <widget> | 285 | <widget> |
286 | <class>QLayoutWidget</class> | 286 | <class>QLayoutWidget</class> |
287 | <property stdset="1"> | 287 | <property stdset="1"> |
288 | <name>name</name> | 288 | <name>name</name> |
289 | <cstring>Layout5</cstring> | 289 | <cstring>Layout5</cstring> |
290 | </property> | 290 | </property> |
291 | <vbox> | 291 | <vbox> |
292 | <property stdset="1"> | 292 | <property stdset="1"> |
293 | <name>margin</name> | 293 | <name>margin</name> |
294 | <number>0</number> | 294 | <number>0</number> |
295 | </property> | 295 | </property> |
296 | <property stdset="1"> | 296 | <property stdset="1"> |
297 | <name>spacing</name> | 297 | <name>spacing</name> |
298 | <number>6</number> | 298 | <number>6</number> |
299 | </property> | 299 | </property> |
300 | <widget> | 300 | <widget> |
301 | <class>QLineEdit</class> | 301 | <class>QLineEdit</class> |
302 | <property stdset="1"> | 302 | <property stdset="1"> |
303 | <name>name</name> | 303 | <name>name</name> |
304 | <cstring>userLine</cstring> | 304 | <cstring>userLine</cstring> |
305 | </property> | 305 | </property> |
306 | </widget> | 306 | </widget> |
307 | <widget> | 307 | <widget> |
308 | <class>QLineEdit</class> | 308 | <class>QLineEdit</class> |
309 | <property stdset="1"> | 309 | <property stdset="1"> |
310 | <name>name</name> | 310 | <name>name</name> |
311 | <cstring>passLine</cstring> | 311 | <cstring>passLine</cstring> |
312 | </property> | 312 | </property> |
313 | <property stdset="1"> | 313 | <property stdset="1"> |
314 | <name>echoMode</name> | 314 | <name>echoMode</name> |
315 | <enum>Password</enum> | 315 | <enum>Password</enum> |
316 | </property> | 316 | </property> |
317 | </widget> | 317 | </widget> |
318 | </vbox> | 318 | </vbox> |
319 | </widget> | 319 | </widget> |
320 | </hbox> | 320 | </hbox> |
321 | </widget> | 321 | </widget> |
322 | <widget> | 322 | <widget> |
323 | <class>QLayoutWidget</class> | 323 | <class>QLayoutWidget</class> |
324 | <property stdset="1"> | 324 | <property stdset="1"> |
325 | <name>name</name> | 325 | <name>name</name> |
326 | <cstring>Layout9</cstring> | 326 | <cstring>Layout9</cstring> |
327 | </property> | 327 | </property> |
328 | <hbox> | 328 | <hbox> |
329 | <property stdset="1"> | 329 | <property stdset="1"> |
330 | <name>margin</name> | 330 | <name>margin</name> |
331 | <number>0</number> | 331 | <number>0</number> |
332 | </property> | 332 | </property> |
333 | <property stdset="1"> | 333 | <property stdset="1"> |
334 | <name>spacing</name> | 334 | <name>spacing</name> |
335 | <number>6</number> | 335 | <number>6</number> |
336 | </property> | 336 | </property> |
337 | <widget> | 337 | <widget> |
338 | <class>QLabel</class> | 338 | <class>QLabel</class> |
339 | <property stdset="1"> | 339 | <property stdset="1"> |
340 | <name>name</name> | 340 | <name>name</name> |
341 | <cstring>TextLabel1_2</cstring> | 341 | <cstring>TextLabel1_2</cstring> |
342 | </property> | 342 | </property> |
343 | <property stdset="1"> | 343 | <property stdset="1"> |
344 | <name>text</name> | 344 | <name>text</name> |
345 | <string>Local storage folder:</string> | 345 | <string>Local storage folder:</string> |
346 | </property> | 346 | </property> |
347 | </widget> | 347 | </widget> |
348 | <widget> | 348 | <widget> |
349 | <class>QLineEdit</class> | 349 | <class>QLineEdit</class> |
350 | <property stdset="1"> | 350 | <property stdset="1"> |
351 | <name>name</name> | 351 | <name>name</name> |
352 | <cstring>localFolder</cstring> | 352 | <cstring>localFolder</cstring> |
353 | </property> | 353 | </property> |
354 | <property stdset="1"> | 354 | <property stdset="1"> |
355 | <name>text</name> | 355 | <name>text</name> |
356 | <string></string> | 356 | <string></string> |
357 | </property> | 357 | </property> |
358 | </widget> | 358 | </widget> |
359 | </hbox> | 359 | </hbox> |
360 | </widget> | 360 | </widget> |
361 | <widget> | 361 | <widget> |
362 | <class>QLayoutWidget</class> | 362 | <class>QLayoutWidget</class> |
363 | <property stdset="1"> | 363 | <property stdset="1"> |
364 | <name>name</name> | 364 | <name>name</name> |
365 | <cstring>Layout10</cstring> | 365 | <cstring>Layout10</cstring> |
366 | </property> | 366 | </property> |
367 | <hbox> | 367 | <hbox> |
368 | <property stdset="1"> | 368 | <property stdset="1"> |
369 | <name>margin</name> | 369 | <name>margin</name> |
370 | <number>0</number> | 370 | <number>0</number> |
371 | </property> | 371 | </property> |
372 | <property stdset="1"> | 372 | <property stdset="1"> |
373 | <name>spacing</name> | 373 | <name>spacing</name> |
374 | <number>6</number> | 374 | <number>6</number> |
375 | </property> | 375 | </property> |
376 | <widget> | 376 | <widget> |
377 | <class>QCheckBox</class> | 377 | <class>QCheckBox</class> |
378 | <property stdset="1"> | 378 | <property stdset="1"> |
379 | <name>name</name> | 379 | <name>name</name> |
380 | <cstring>CheckBoxDown</cstring> | 380 | <cstring>CheckBoxDown</cstring> |
381 | </property> | 381 | </property> |
382 | <property stdset="1"> | 382 | <property stdset="1"> |
383 | <name>text</name> | 383 | <name>text</name> |
384 | <string>Download only messages smaller</string> | 384 | <string>Download only messages smaller</string> |
385 | </property> | 385 | </property> |
386 | </widget> | 386 | </widget> |
387 | <widget> | 387 | <widget> |
388 | <class>QSpinBox</class> | 388 | <class>QSpinBox</class> |
389 | <property stdset="1"> | 389 | <property stdset="1"> |
390 | <name>name</name> | 390 | <name>name</name> |
391 | <cstring>SpinBoxDown</cstring> | 391 | <cstring>SpinBoxDown</cstring> |
392 | </property> | 392 | </property> |
393 | <property stdset="1"> | 393 | <property stdset="1"> |
394 | <name>suffix</name> | 394 | <name>suffix</name> |
395 | <string>kB</string> | 395 | <string>kB</string> |
396 | </property> | 396 | </property> |
397 | <property stdset="1"> | 397 | <property stdset="1"> |
398 | <name>maxValue</name> | 398 | <name>maxValue</name> |
399 | <number>99999</number> | 399 | <number>99999</number> |
400 | </property> | 400 | </property> |
401 | <property stdset="1"> | 401 | <property stdset="1"> |
402 | <name>minValue</name> | 402 | <name>minValue</name> |
403 | <number>1</number> | 403 | <number>1</number> |
404 | </property> | 404 | </property> |
405 | </widget> | 405 | </widget> |
406 | </hbox> | 406 | </hbox> |
407 | </widget> | 407 | </widget> |
408 | <widget> | ||
409 | <class>QCheckBox</class> | ||
410 | <property stdset="1"> | ||
411 | <name>name</name> | ||
412 | <cstring>CheckBoxLeaveOn</cstring> | ||
413 | </property> | ||
414 | <property stdset="1"> | ||
415 | <name>text</name> | ||
416 | <string>Leave Messages on Server</string> | ||
417 | </property> | ||
418 | </widget> | ||
408 | <spacer> | 419 | <spacer> |
409 | <property> | 420 | <property> |
410 | <name>name</name> | 421 | <name>name</name> |
411 | <cstring>spacer</cstring> | 422 | <cstring>spacer</cstring> |
412 | </property> | 423 | </property> |
413 | <property stdset="1"> | 424 | <property stdset="1"> |
414 | <name>orientation</name> | 425 | <name>orientation</name> |
415 | <enum>Vertical</enum> | 426 | <enum>Vertical</enum> |
416 | </property> | 427 | </property> |
417 | <property stdset="1"> | 428 | <property stdset="1"> |
418 | <name>sizeType</name> | 429 | <name>sizeType</name> |
419 | <enum>Expanding</enum> | 430 | <enum>Expanding</enum> |
420 | </property> | 431 | </property> |
421 | <property> | 432 | <property> |
422 | <name>sizeHint</name> | 433 | <name>sizeHint</name> |
423 | <size> | 434 | <size> |
424 | <width>20</width> | 435 | <width>20</width> |
425 | <height>20</height> | 436 | <height>20</height> |
426 | </size> | 437 | </size> |
427 | </property> | 438 | </property> |
428 | </spacer> | 439 | </spacer> |
429 | </vbox> | 440 | </vbox> |
430 | </widget> | 441 | </widget> |
431 | <tabstops> | 442 | <tabstops> |
432 | <tabstop>accountLine</tabstop> | 443 | <tabstop>accountLine</tabstop> |
433 | <tabstop>serverLine</tabstop> | 444 | <tabstop>serverLine</tabstop> |
434 | <tabstop>portLine</tabstop> | 445 | <tabstop>portLine</tabstop> |
435 | <tabstop>userLine</tabstop> | 446 | <tabstop>userLine</tabstop> |
436 | <tabstop>passLine</tabstop> | 447 | <tabstop>passLine</tabstop> |
437 | </tabstops> | 448 | </tabstops> |
438 | </UI> | 449 | </UI> |