-rw-r--r-- | kmicromail/editaccounts.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 7ad4ec8..c931e45 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp | |||
@@ -1,536 +1,536 @@ | |||
1 | 1 | ||
2 | #include "defines.h" | 2 | #include "defines.h" |
3 | #include "editaccounts.h" | 3 | #include "editaccounts.h" |
4 | #include "kapplication.h" | 4 | #include "kapplication.h" |
5 | /* OPIE */ | 5 | /* OPIE */ |
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | 7 | ||
8 | /* QT */ | 8 | /* QT */ |
9 | #include <qstringlist.h> | 9 | #include <qstringlist.h> |
10 | 10 | ||
11 | #include <qcombobox.h> | 11 | #include <qcombobox.h> |
12 | #include <qcheckbox.h> | 12 | #include <qcheckbox.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | #include <qpushbutton.h> | 14 | #include <qpushbutton.h> |
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qlabel.h> | 16 | #include <qlabel.h> |
17 | #include <qtabwidget.h> | 17 | #include <qtabwidget.h> |
18 | #include <qlistview.h> | 18 | #include <qlistview.h> |
19 | #include <qspinbox.h> | 19 | #include <qspinbox.h> |
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | 21 | ||
22 | #include <libmailwrapper/nntpwrapper.h> | 22 | #include <libmailwrapper/nntpwrapper.h> |
23 | 23 | ||
24 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
25 | 25 | ||
26 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 26 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
27 | : QListViewItem( parent ) | 27 | : QListViewItem( parent ) |
28 | { | 28 | { |
29 | account = a; | 29 | account = a; |
30 | setText( 0, account->getAccountName() ); | 30 | setText( 0, account->getAccountName() ); |
31 | QString ttext = ""; | 31 | QString ttext = ""; |
32 | switch (account->getType()) { | 32 | switch (account->getType()) { |
33 | case MAILLIB::A_NNTP: | 33 | case MAILLIB::A_NNTP: |
34 | ttext="NNTP"; | 34 | ttext="NNTP"; |
35 | break; | 35 | break; |
36 | case MAILLIB::A_POP3: | 36 | case MAILLIB::A_POP3: |
37 | ttext = "POP3"; | 37 | ttext = "POP3"; |
38 | break; | 38 | break; |
39 | case MAILLIB::A_IMAP: | 39 | case MAILLIB::A_IMAP: |
40 | ttext = "IMAP"; | 40 | ttext = "IMAP"; |
41 | break; | 41 | break; |
42 | case MAILLIB::A_SMTP: | 42 | case MAILLIB::A_SMTP: |
43 | ttext = "SMTP"; | 43 | ttext = "SMTP"; |
44 | break; | 44 | break; |
45 | default: | 45 | default: |
46 | ttext = "UNKNOWN"; | 46 | ttext = "UNKNOWN"; |
47 | break; | 47 | break; |
48 | } | 48 | } |
49 | setText( 1, ttext); | 49 | setText( 1, ttext); |
50 | } | 50 | } |
51 | 51 | ||
52 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 52 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
53 | : EditAccountsUI( parent, name, modal, flags ) | 53 | : EditAccountsUI( parent, name, modal, flags ) |
54 | { | 54 | { |
55 | settings = s; | 55 | settings = s; |
56 | 56 | ||
57 | mailList->addColumn( i18n( "Account" ) ); | 57 | mailList->addColumn( i18n( "Account" ) ); |
58 | mailList->addColumn( i18n( "Type" ) ); | 58 | mailList->addColumn( i18n( "Type" ) ); |
59 | 59 | ||
60 | newsList->addColumn( i18n( "Account" ) ); | 60 | newsList->addColumn( i18n( "Account" ) ); |
61 | 61 | ||
62 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 62 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
63 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 63 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
64 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 64 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
65 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 65 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
66 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 66 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
67 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 67 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
68 | 68 | ||
69 | slotFillLists(); | 69 | slotFillLists(); |
70 | } | 70 | } |
71 | 71 | ||
72 | void EditAccounts::slotFillLists() | 72 | void EditAccounts::slotFillLists() |
73 | { | 73 | { |
74 | mailList->clear(); | 74 | mailList->clear(); |
75 | newsList->clear(); | 75 | newsList->clear(); |
76 | 76 | ||
77 | QList<Account> accounts = settings->getAccounts(); | 77 | QList<Account> accounts = settings->getAccounts(); |
78 | Account *it; | 78 | Account *it; |
79 | for ( it = accounts.first(); it; it = accounts.next() ) | 79 | for ( it = accounts.first(); it; it = accounts.next() ) |
80 | { | 80 | { |
81 | if ( it->getType()==MAILLIB::A_NNTP ) | 81 | if ( it->getType()==MAILLIB::A_NNTP ) |
82 | { | 82 | { |
83 | (void) new AccountListItem( newsList, it ); | 83 | (void) new AccountListItem( newsList, it ); |
84 | } | 84 | } |
85 | else | 85 | else |
86 | { | 86 | { |
87 | (void) new AccountListItem( mailList, it ); | 87 | (void) new AccountListItem( mailList, it ); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | void EditAccounts::slotNewMail() | 92 | void EditAccounts::slotNewMail() |
93 | { | 93 | { |
94 | QString *selection = new QString(); | 94 | QString *selection = new QString(); |
95 | SelectMailType selType( selection, this, 0, true ); | 95 | SelectMailType selType( selection, this, 0, true ); |
96 | selType.show(); | 96 | selType.show(); |
97 | if ( QDialog::Accepted == selType.exec() ) | 97 | if ( QDialog::Accepted == selType.exec() ) |
98 | { | 98 | { |
99 | slotNewAccount( *selection ); | 99 | slotNewAccount( *selection ); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | void EditAccounts::slotNewAccount( const QString &type ) | 103 | void EditAccounts::slotNewAccount( const QString &type ) |
104 | { | 104 | { |
105 | if ( type.compare( "IMAP" ) == 0 ) | 105 | if ( type.compare( i18n("IMAP") ) == 0 ) |
106 | { | 106 | { |
107 | IMAPaccount *account = new IMAPaccount(); | 107 | IMAPaccount *account = new IMAPaccount(); |
108 | IMAPconfig imap( account, this, 0, true ); | 108 | IMAPconfig imap( account, this, 0, true ); |
109 | imap.showMaximized(); | 109 | imap.showMaximized(); |
110 | if ( QDialog::Accepted == imap.exec() ) | 110 | if ( QDialog::Accepted == imap.exec() ) |
111 | { | 111 | { |
112 | settings->addAccount( account ); | 112 | settings->addAccount( account ); |
113 | account->save(); | 113 | account->save(); |
114 | slotFillLists(); | 114 | slotFillLists(); |
115 | } | 115 | } |
116 | else | 116 | else |
117 | { | 117 | { |
118 | account->remove(); | 118 | account->remove(); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | else if ( type.compare( "POP3" ) == 0 ) | 121 | else if ( type.compare( i18n("POP3") ) == 0 ) |
122 | { | 122 | { |
123 | POP3account *account = new POP3account(); | 123 | POP3account *account = new POP3account(); |
124 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); | 124 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); |
125 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) | 125 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) |
126 | { | 126 | { |
127 | settings->addAccount( account ); | 127 | settings->addAccount( account ); |
128 | account->save(); | 128 | account->save(); |
129 | slotFillLists(); | 129 | slotFillLists(); |
130 | } | 130 | } |
131 | else | 131 | else |
132 | { | 132 | { |
133 | account->remove(); | 133 | account->remove(); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | else if ( type.compare( "SMTP" ) == 0 ) | 136 | else if ( type.compare( i18n("SMTP") ) == 0 ) |
137 | { | 137 | { |
138 | SMTPaccount *account = new SMTPaccount(); | 138 | SMTPaccount *account = new SMTPaccount(); |
139 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); | 139 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); |
140 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) | 140 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) |
141 | { | 141 | { |
142 | settings->addAccount( account ); | 142 | settings->addAccount( account ); |
143 | account->save(); | 143 | account->save(); |
144 | slotFillLists(); | 144 | slotFillLists(); |
145 | 145 | ||
146 | } | 146 | } |
147 | else | 147 | else |
148 | { | 148 | { |
149 | account->remove(); | 149 | account->remove(); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | else if ( type.compare( "NNTP" ) == 0 ) | 152 | else if ( type.compare( i18n("NNTP") ) == 0 ) |
153 | { | 153 | { |
154 | NNTPaccount *account = new NNTPaccount(); | 154 | NNTPaccount *account = new NNTPaccount(); |
155 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); | 155 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); |
156 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) | 156 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) |
157 | { | 157 | { |
158 | settings->addAccount( account ); | 158 | settings->addAccount( account ); |
159 | account->save(); | 159 | account->save(); |
160 | slotFillLists(); | 160 | slotFillLists(); |
161 | } | 161 | } |
162 | else | 162 | else |
163 | { | 163 | { |
164 | account->remove(); | 164 | account->remove(); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | void EditAccounts::slotEditAccount( Account *account ) | 169 | void EditAccounts::slotEditAccount( Account *account ) |
170 | { | 170 | { |
171 | if ( account->getType() == MAILLIB::A_IMAP ) | 171 | if ( account->getType() == MAILLIB::A_IMAP ) |
172 | { | 172 | { |
173 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); | 173 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); |
174 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); | 174 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); |
175 | if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) | 175 | if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) |
176 | { | 176 | { |
177 | slotFillLists(); | 177 | slotFillLists(); |
178 | } | 178 | } |
179 | } | 179 | } |
180 | else if ( account->getType()==MAILLIB::A_POP3 ) | 180 | else if ( account->getType()==MAILLIB::A_POP3 ) |
181 | { | 181 | { |
182 | POP3account *pop3Acc = static_cast<POP3account *>(account); | 182 | POP3account *pop3Acc = static_cast<POP3account *>(account); |
183 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); | 183 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); |
184 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) | 184 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) |
185 | { | 185 | { |
186 | slotFillLists(); | 186 | slotFillLists(); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | else if ( account->getType()==MAILLIB::A_SMTP ) | 189 | else if ( account->getType()==MAILLIB::A_SMTP ) |
190 | { | 190 | { |
191 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); | 191 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); |
192 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); | 192 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); |
193 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) | 193 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) |
194 | { | 194 | { |
195 | slotFillLists(); | 195 | slotFillLists(); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | else if ( account->getType()==MAILLIB::A_NNTP) | 198 | else if ( account->getType()==MAILLIB::A_NNTP) |
199 | { | 199 | { |
200 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); | 200 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); |
201 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); | 201 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); |
202 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) | 202 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) |
203 | { | 203 | { |
204 | slotFillLists(); | 204 | slotFillLists(); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | void EditAccounts::slotDeleteAccount( Account *account ) | 209 | void EditAccounts::slotDeleteAccount( Account *account ) |
210 | { | 210 | { |
211 | if ( QMessageBox::information( this, i18n( "Question" ), | 211 | if ( QMessageBox::information( this, i18n( "Question" ), |
212 | i18n( "<p>Do you really want to delete the selected Account?</p>" ), | 212 | i18n( "<p>Do you really want to delete the selected Account?</p>" ), |
213 | i18n( "Yes" ), i18n( "No" ) ) == 0 ) | 213 | i18n( "Yes" ), i18n( "No" ) ) == 0 ) |
214 | { | 214 | { |
215 | settings->delAccount( account ); | 215 | settings->delAccount( account ); |
216 | slotFillLists(); | 216 | slotFillLists(); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | void EditAccounts::slotEditMail() | 220 | void EditAccounts::slotEditMail() |
221 | { | 221 | { |
222 | if ( !mailList->currentItem() ) | 222 | if ( !mailList->currentItem() ) |
223 | { | 223 | { |
224 | QMessageBox::information( this, i18n( "Error" ), | 224 | QMessageBox::information( this, i18n( "Error" ), |
225 | i18n( "<p>Please select an account.</p>" ), | 225 | i18n( "<p>Please select an account.</p>" ), |
226 | i18n( "Ok" ) ); | 226 | i18n( "Ok" ) ); |
227 | return; | 227 | return; |
228 | } | 228 | } |
229 | 229 | ||
230 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 230 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
231 | slotEditAccount( a ); | 231 | slotEditAccount( a ); |
232 | } | 232 | } |
233 | 233 | ||
234 | void EditAccounts::slotDeleteMail() | 234 | void EditAccounts::slotDeleteMail() |
235 | { | 235 | { |
236 | if ( !mailList->currentItem() ) | 236 | if ( !mailList->currentItem() ) |
237 | { | 237 | { |
238 | QMessageBox::information( this, i18n( "Error" ), | 238 | QMessageBox::information( this, i18n( "Error" ), |
239 | i18n( "<p>Please select an account.</p>" ), | 239 | i18n( "<p>Please select an account.</p>" ), |
240 | i18n( "Ok" ) ); | 240 | i18n( "Ok" ) ); |
241 | return; | 241 | return; |
242 | } | 242 | } |
243 | 243 | ||
244 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 244 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
245 | slotDeleteAccount( a ); | 245 | slotDeleteAccount( a ); |
246 | } | 246 | } |
247 | 247 | ||
248 | void EditAccounts::slotNewNews() | 248 | void EditAccounts::slotNewNews() |
249 | { | 249 | { |
250 | slotNewAccount( "NNTP" ); | 250 | slotNewAccount( "NNTP" ); |
251 | } | 251 | } |
252 | 252 | ||
253 | void EditAccounts::slotEditNews() | 253 | void EditAccounts::slotEditNews() |
254 | { | 254 | { |
255 | if ( !newsList->currentItem() ) | 255 | if ( !newsList->currentItem() ) |
256 | { | 256 | { |
257 | QMessageBox::information( this, i18n( "Error" ), | 257 | QMessageBox::information( this, i18n( "Error" ), |
258 | i18n( "<p>Please select an account.</p>" ), | 258 | i18n( "<p>Please select an account.</p>" ), |
259 | i18n( "Ok" ) ); | 259 | i18n( "Ok" ) ); |
260 | return; | 260 | return; |
261 | } | 261 | } |
262 | 262 | ||
263 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 263 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
264 | slotEditAccount( a ); | 264 | slotEditAccount( a ); |
265 | } | 265 | } |
266 | 266 | ||
267 | void EditAccounts::slotDeleteNews() | 267 | void EditAccounts::slotDeleteNews() |
268 | { | 268 | { |
269 | if ( !newsList->currentItem() ) | 269 | if ( !newsList->currentItem() ) |
270 | { | 270 | { |
271 | QMessageBox::information( this, i18n( "Error" ), | 271 | QMessageBox::information( this, i18n( "Error" ), |
272 | i18n( "<p>Please select an account.</p>" ), | 272 | i18n( "<p>Please select an account.</p>" ), |
273 | i18n( "Ok" ) ); | 273 | i18n( "Ok" ) ); |
274 | return; | 274 | return; |
275 | } | 275 | } |
276 | 276 | ||
277 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 277 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
278 | slotDeleteAccount( a ); | 278 | slotDeleteAccount( a ); |
279 | } | 279 | } |
280 | 280 | ||
281 | void EditAccounts::slotAdjustColumns() | 281 | void EditAccounts::slotAdjustColumns() |
282 | { | 282 | { |
283 | int currPage = configTab->currentPageIndex(); | 283 | int currPage = configTab->currentPageIndex(); |
284 | 284 | ||
285 | configTab->showPage( mailTab ); | 285 | configTab->showPage( mailTab ); |
286 | mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); | 286 | mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); |
287 | mailList->setColumnWidth( 1, 50 ); | 287 | mailList->setColumnWidth( 1, 50 ); |
288 | 288 | ||
289 | configTab->showPage( newsTab ); | 289 | configTab->showPage( newsTab ); |
290 | newsList->setColumnWidth( 0, newsList->visibleWidth() ); | 290 | newsList->setColumnWidth( 0, newsList->visibleWidth() ); |
291 | 291 | ||
292 | configTab->setCurrentPage( currPage ); | 292 | configTab->setCurrentPage( currPage ); |
293 | } | 293 | } |
294 | 294 | ||
295 | void EditAccounts::accept() | 295 | void EditAccounts::accept() |
296 | { | 296 | { |
297 | settings->saveAccounts(); | 297 | settings->saveAccounts(); |
298 | 298 | ||
299 | QDialog::accept(); | 299 | QDialog::accept(); |
300 | } | 300 | } |
301 | 301 | ||
302 | /** | 302 | /** |
303 | * SelectMailType | 303 | * SelectMailType |
304 | */ | 304 | */ |
305 | 305 | ||
306 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) | 306 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) |
307 | : SelectMailTypeUI( parent, name, modal, flags ) | 307 | : SelectMailTypeUI( parent, name, modal, flags ) |
308 | { | 308 | { |
309 | selected = selection; | 309 | selected = selection; |
310 | selected->replace( 0, selected->length(), typeBox->currentText() ); | 310 | selected->replace( 0, selected->length(), typeBox->currentText() ); |
311 | connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); | 311 | connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); |
312 | } | 312 | } |
313 | 313 | ||
314 | void SelectMailType::slotSelection( const QString &sel ) | 314 | void SelectMailType::slotSelection( const QString &sel ) |
315 | { | 315 | { |
316 | selected->replace( 0, selected->length(), sel ); | 316 | selected->replace( 0, selected->length(), sel ); |
317 | } | 317 | } |
318 | 318 | ||
319 | /** | 319 | /** |
320 | * IMAPconfig | 320 | * IMAPconfig |
321 | */ | 321 | */ |
322 | 322 | ||
323 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 323 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
324 | : IMAPconfigUI( parent, name, modal, flags ) | 324 | : IMAPconfigUI( parent, name, modal, flags ) |
325 | { | 325 | { |
326 | data = account; | 326 | data = account; |
327 | 327 | ||
328 | fillValues(); | 328 | fillValues(); |
329 | 329 | ||
330 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 330 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
331 | ComboBox1->insertItem( "Only if available", 0 ); | 331 | ComboBox1->insertItem( "Only if available", 0 ); |
332 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 332 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
333 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 333 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
334 | ComboBox1->insertItem( "Run command instead", 3 ); | 334 | ComboBox1->insertItem( "Run command instead", 3 ); |
335 | CommandEdit->hide(); | 335 | CommandEdit->hide(); |
336 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 336 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
337 | } | 337 | } |
338 | 338 | ||
339 | void IMAPconfig::slotConnectionToggle( int index ) | 339 | void IMAPconfig::slotConnectionToggle( int index ) |
340 | { | 340 | { |
341 | if ( index == 2 ) | 341 | if ( index == 2 ) |
342 | { | 342 | { |
343 | portLine->setText( IMAP_SSL_PORT ); | 343 | portLine->setText( IMAP_SSL_PORT ); |
344 | } | 344 | } |
345 | else if ( index == 3 ) | 345 | else if ( index == 3 ) |
346 | { | 346 | { |
347 | portLine->setText( IMAP_PORT ); | 347 | portLine->setText( IMAP_PORT ); |
348 | CommandEdit->show(); | 348 | CommandEdit->show(); |
349 | } | 349 | } |
350 | else | 350 | else |
351 | { | 351 | { |
352 | portLine->setText( IMAP_PORT ); | 352 | portLine->setText( IMAP_PORT ); |
353 | } | 353 | } |
354 | } | 354 | } |
355 | 355 | ||
356 | void IMAPconfig::fillValues() | 356 | void IMAPconfig::fillValues() |
357 | { | 357 | { |
358 | accountLine->setText( data->getAccountName() ); | 358 | accountLine->setText( data->getAccountName() ); |
359 | serverLine->setText( data->getServer() ); | 359 | serverLine->setText( data->getServer() ); |
360 | portLine->setText( data->getPort() ); | 360 | portLine->setText( data->getPort() ); |
361 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 361 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
362 | userLine->setText( data->getUser() ); | 362 | userLine->setText( data->getUser() ); |
363 | passLine->setText( data->getPassword() ); | 363 | passLine->setText( data->getPassword() ); |
364 | prefixLine->setText(data->getPrefix()); | 364 | prefixLine->setText(data->getPrefix()); |
365 | localFolder->setText( data->getLocalFolder() ); | 365 | localFolder->setText( data->getLocalFolder() ); |
366 | int max = data->getMaxMailSize() ; | 366 | int max = data->getMaxMailSize() ; |
367 | if ( max ) { | 367 | if ( max ) { |
368 | CheckBoxDown->setChecked( true ); | 368 | CheckBoxDown->setChecked( true ); |
369 | SpinBoxDown->setValue ( max ); | 369 | SpinBoxDown->setValue ( max ); |
370 | } else { | 370 | } else { |
371 | CheckBoxDown->setChecked( false ); | 371 | CheckBoxDown->setChecked( false ); |
372 | SpinBoxDown->setValue ( 5 ); | 372 | SpinBoxDown->setValue ( 5 ); |
373 | } | 373 | } |
374 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | 374 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); |
375 | } | 375 | } |
376 | 376 | ||
377 | void IMAPconfig::accept() | 377 | void IMAPconfig::accept() |
378 | { | 378 | { |
379 | data->setAccountName( accountLine->text() ); | 379 | data->setAccountName( accountLine->text() ); |
380 | data->setServer( serverLine->text() ); | 380 | data->setServer( serverLine->text() ); |
381 | data->setPort( portLine->text() ); | 381 | data->setPort( portLine->text() ); |
382 | data->setConnectionType( ComboBox1->currentItem() ); | 382 | data->setConnectionType( ComboBox1->currentItem() ); |
383 | data->setUser( userLine->text() ); | 383 | data->setUser( userLine->text() ); |
384 | data->setPassword( passLine->text() ); | 384 | data->setPassword( passLine->text() ); |
385 | data->setPrefix(prefixLine->text()); | 385 | data->setPrefix(prefixLine->text()); |
386 | data->setLocalFolder( localFolder->text() ); | 386 | data->setLocalFolder( localFolder->text() ); |
387 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 387 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
388 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | 388 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); |
389 | 389 | ||
390 | QDialog::accept(); | 390 | QDialog::accept(); |
391 | } | 391 | } |
392 | 392 | ||
393 | /** | 393 | /** |
394 | * POP3config | 394 | * POP3config |
395 | */ | 395 | */ |
396 | 396 | ||
397 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 397 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
398 | : POP3configUI( parent, name, modal, flags ) | 398 | : POP3configUI( parent, name, modal, flags ) |
399 | { | 399 | { |
400 | data = account; | 400 | data = account; |
401 | fillValues(); | 401 | fillValues(); |
402 | 402 | ||
403 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 403 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
404 | ComboBox1->insertItem( "Only if available", 0 ); | 404 | ComboBox1->insertItem( "Only if available", 0 ); |
405 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 405 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
406 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 406 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
407 | ComboBox1->insertItem( "Run command instead", 3 ); | 407 | ComboBox1->insertItem( "Run command instead", 3 ); |
408 | CommandEdit->hide(); | 408 | CommandEdit->hide(); |
409 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 409 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
410 | } | 410 | } |
411 | 411 | ||
412 | void POP3config::slotConnectionToggle( int index ) | 412 | void POP3config::slotConnectionToggle( int index ) |
413 | { | 413 | { |
414 | // 2 is ssl connection | 414 | // 2 is ssl connection |
415 | if ( index == 2 ) | 415 | if ( index == 2 ) |
416 | { | 416 | { |
417 | portLine->setText( POP3_SSL_PORT ); | 417 | portLine->setText( POP3_SSL_PORT ); |
418 | } | 418 | } |
419 | else if ( index == 3 ) | 419 | else if ( index == 3 ) |
420 | { | 420 | { |
421 | portLine->setText( POP3_PORT ); | 421 | portLine->setText( POP3_PORT ); |
422 | CommandEdit->show(); | 422 | CommandEdit->show(); |
423 | } | 423 | } |
424 | else | 424 | else |
425 | { | 425 | { |
426 | portLine->setText( POP3_PORT ); | 426 | portLine->setText( POP3_PORT ); |
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
430 | void POP3config::fillValues() | 430 | void POP3config::fillValues() |
431 | { | 431 | { |
432 | accountLine->setText( data->getAccountName() ); | 432 | accountLine->setText( data->getAccountName() ); |
433 | serverLine->setText( data->getServer() ); | 433 | serverLine->setText( data->getServer() ); |
434 | portLine->setText( data->getPort() ); | 434 | portLine->setText( data->getPort() ); |
435 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 435 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
436 | userLine->setText( data->getUser() ); | 436 | userLine->setText( data->getUser() ); |
437 | passLine->setText( data->getPassword() ); | 437 | passLine->setText( data->getPassword() ); |
438 | localFolder->setText( data->getLocalFolder() ); | 438 | localFolder->setText( data->getLocalFolder() ); |
439 | int max = data->getMaxMailSize() ; | 439 | int max = data->getMaxMailSize() ; |
440 | if ( max ) { | 440 | if ( max ) { |
441 | CheckBoxDown->setChecked( true ); | 441 | CheckBoxDown->setChecked( true ); |
442 | SpinBoxDown->setValue ( max ); | 442 | SpinBoxDown->setValue ( max ); |
443 | } else { | 443 | } else { |
444 | CheckBoxDown->setChecked( false ); | 444 | CheckBoxDown->setChecked( false ); |
445 | SpinBoxDown->setValue ( 5 ); | 445 | SpinBoxDown->setValue ( 5 ); |
446 | } | 446 | } |
447 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | 447 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); |
448 | } | 448 | } |
449 | 449 | ||
450 | void POP3config::accept() | 450 | void POP3config::accept() |
451 | { | 451 | { |
452 | data->setAccountName( accountLine->text() ); | 452 | data->setAccountName( accountLine->text() ); |
453 | data->setServer( serverLine->text() ); | 453 | data->setServer( serverLine->text() ); |
454 | data->setPort( portLine->text() ); | 454 | data->setPort( portLine->text() ); |
455 | data->setConnectionType( ComboBox1->currentItem() ); | 455 | data->setConnectionType( ComboBox1->currentItem() ); |
456 | data->setUser( userLine->text() ); | 456 | data->setUser( userLine->text() ); |
457 | data->setPassword( passLine->text() ); | 457 | data->setPassword( passLine->text() ); |
458 | data->setLocalFolder( localFolder->text() ); | 458 | data->setLocalFolder( localFolder->text() ); |
459 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 459 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
460 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | 460 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); |
461 | 461 | ||
462 | QDialog::accept(); | 462 | QDialog::accept(); |
463 | } | 463 | } |
464 | 464 | ||
465 | /** | 465 | /** |
466 | * SMTPconfig | 466 | * SMTPconfig |
467 | */ | 467 | */ |
468 | 468 | ||
469 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 469 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
470 | : SMTPconfigUI( parent, name, modal, flags ) | 470 | : SMTPconfigUI( parent, name, modal, flags ) |
471 | { | 471 | { |
472 | data = account; | 472 | data = account; |
473 | 473 | ||
474 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 474 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
475 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 475 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
476 | 476 | ||
477 | fillValues(); | 477 | fillValues(); |
478 | 478 | ||
479 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 479 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
480 | ComboBox1->insertItem( "Only if available", 0 ); | 480 | ComboBox1->insertItem( "Only if available", 0 ); |
481 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 481 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
482 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 482 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
483 | ComboBox1->insertItem( "Run command instead", 3 ); | 483 | ComboBox1->insertItem( "Run command instead", 3 ); |
484 | CommandEdit->hide(); | 484 | CommandEdit->hide(); |
485 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 485 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
486 | } | 486 | } |
487 | 487 | ||
488 | void SMTPconfig::slotConnectionToggle( int index ) | 488 | void SMTPconfig::slotConnectionToggle( int index ) |
489 | { | 489 | { |
490 | // 2 is ssl connection | 490 | // 2 is ssl connection |
491 | if ( index == 2 ) | 491 | if ( index == 2 ) |
492 | { | 492 | { |
493 | portLine->setText( SMTP_SSL_PORT ); | 493 | portLine->setText( SMTP_SSL_PORT ); |
494 | } | 494 | } |
495 | else if ( index == 3 ) | 495 | else if ( index == 3 ) |
496 | { | 496 | { |
497 | portLine->setText( SMTP_PORT ); | 497 | portLine->setText( SMTP_PORT ); |
498 | CommandEdit->show(); | 498 | CommandEdit->show(); |
499 | } | 499 | } |
500 | else | 500 | else |
501 | { | 501 | { |
502 | portLine->setText( SMTP_PORT ); | 502 | portLine->setText( SMTP_PORT ); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | void SMTPconfig::fillValues() | 506 | void SMTPconfig::fillValues() |
507 | { | 507 | { |
508 | accountLine->setText( data->getAccountName() ); | 508 | accountLine->setText( data->getAccountName() ); |
509 | serverLine->setText( data->getServer() ); | 509 | serverLine->setText( data->getServer() ); |
510 | portLine->setText( data->getPort() ); | 510 | portLine->setText( data->getPort() ); |
511 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 511 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
512 | loginBox->setChecked( data->getLogin() ); | 512 | loginBox->setChecked( data->getLogin() ); |
513 | userLine->setText( data->getUser() ); | 513 | userLine->setText( data->getUser() ); |
514 | passLine->setText( data->getPassword() ); | 514 | passLine->setText( data->getPassword() ); |
515 | } | 515 | } |
516 | 516 | ||
517 | void SMTPconfig::accept() | 517 | void SMTPconfig::accept() |
518 | { | 518 | { |
519 | data->setAccountName( accountLine->text() ); | 519 | data->setAccountName( accountLine->text() ); |
520 | data->setServer( serverLine->text() ); | 520 | data->setServer( serverLine->text() ); |
521 | data->setPort( portLine->text() ); | 521 | data->setPort( portLine->text() ); |
522 | data->setConnectionType( ComboBox1->currentItem() ); | 522 | data->setConnectionType( ComboBox1->currentItem() ); |
523 | data->setLogin( loginBox->isChecked() ); | 523 | data->setLogin( loginBox->isChecked() ); |
524 | data->setUser( userLine->text() ); | 524 | data->setUser( userLine->text() ); |
525 | data->setPassword( passLine->text() ); | 525 | data->setPassword( passLine->text() ); |
526 | 526 | ||
527 | QDialog::accept(); | 527 | QDialog::accept(); |
528 | } | 528 | } |
529 | 529 | ||
530 | /** | 530 | /** |
531 | * NNTPconfig | 531 | * NNTPconfig |
532 | */ | 532 | */ |
533 | 533 | ||
534 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 534 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
535 | : NNTPconfigUI( parent, name, modal, flags ) | 535 | : NNTPconfigUI( parent, name, modal, flags ) |
536 | { | 536 | { |