-rw-r--r-- | kmicromail/editaccounts.cpp | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 733e38a..7ad4ec8 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp | |||
@@ -1,661 +1,662 @@ | |||
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 | 21 | ||
21 | #include <libmailwrapper/nntpwrapper.h> | 22 | #include <libmailwrapper/nntpwrapper.h> |
22 | 23 | ||
23 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
24 | 25 | ||
25 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 26 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
26 | : QListViewItem( parent ) | 27 | : QListViewItem( parent ) |
27 | { | 28 | { |
28 | account = a; | 29 | account = a; |
29 | setText( 0, account->getAccountName() ); | 30 | setText( 0, account->getAccountName() ); |
30 | QString ttext = ""; | 31 | QString ttext = ""; |
31 | switch (account->getType()) { | 32 | switch (account->getType()) { |
32 | case MAILLIB::A_NNTP: | 33 | case MAILLIB::A_NNTP: |
33 | ttext="NNTP"; | 34 | ttext="NNTP"; |
34 | break; | 35 | break; |
35 | case MAILLIB::A_POP3: | 36 | case MAILLIB::A_POP3: |
36 | ttext = "POP3"; | 37 | ttext = "POP3"; |
37 | break; | 38 | break; |
38 | case MAILLIB::A_IMAP: | 39 | case MAILLIB::A_IMAP: |
39 | ttext = "IMAP"; | 40 | ttext = "IMAP"; |
40 | break; | 41 | break; |
41 | case MAILLIB::A_SMTP: | 42 | case MAILLIB::A_SMTP: |
42 | ttext = "SMTP"; | 43 | ttext = "SMTP"; |
43 | break; | 44 | break; |
44 | default: | 45 | default: |
45 | ttext = "UNKNOWN"; | 46 | ttext = "UNKNOWN"; |
46 | break; | 47 | break; |
47 | } | 48 | } |
48 | setText( 1, ttext); | 49 | setText( 1, ttext); |
49 | } | 50 | } |
50 | 51 | ||
51 | 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 ) |
52 | : EditAccountsUI( parent, name, modal, flags ) | 53 | : EditAccountsUI( parent, name, modal, flags ) |
53 | { | 54 | { |
54 | settings = s; | 55 | settings = s; |
55 | 56 | ||
56 | mailList->addColumn( tr( "Account" ) ); | 57 | mailList->addColumn( i18n( "Account" ) ); |
57 | mailList->addColumn( tr( "Type" ) ); | 58 | mailList->addColumn( i18n( "Type" ) ); |
58 | 59 | ||
59 | newsList->addColumn( tr( "Account" ) ); | 60 | newsList->addColumn( i18n( "Account" ) ); |
60 | 61 | ||
61 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 62 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
62 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 63 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
63 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 64 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
64 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 65 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
65 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 66 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
66 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 67 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
67 | 68 | ||
68 | slotFillLists(); | 69 | slotFillLists(); |
69 | } | 70 | } |
70 | 71 | ||
71 | void EditAccounts::slotFillLists() | 72 | void EditAccounts::slotFillLists() |
72 | { | 73 | { |
73 | mailList->clear(); | 74 | mailList->clear(); |
74 | newsList->clear(); | 75 | newsList->clear(); |
75 | 76 | ||
76 | QList<Account> accounts = settings->getAccounts(); | 77 | QList<Account> accounts = settings->getAccounts(); |
77 | Account *it; | 78 | Account *it; |
78 | for ( it = accounts.first(); it; it = accounts.next() ) | 79 | for ( it = accounts.first(); it; it = accounts.next() ) |
79 | { | 80 | { |
80 | if ( it->getType()==MAILLIB::A_NNTP ) | 81 | if ( it->getType()==MAILLIB::A_NNTP ) |
81 | { | 82 | { |
82 | (void) new AccountListItem( newsList, it ); | 83 | (void) new AccountListItem( newsList, it ); |
83 | } | 84 | } |
84 | else | 85 | else |
85 | { | 86 | { |
86 | (void) new AccountListItem( mailList, it ); | 87 | (void) new AccountListItem( mailList, it ); |
87 | } | 88 | } |
88 | } | 89 | } |
89 | } | 90 | } |
90 | 91 | ||
91 | void EditAccounts::slotNewMail() | 92 | void EditAccounts::slotNewMail() |
92 | { | 93 | { |
93 | QString *selection = new QString(); | 94 | QString *selection = new QString(); |
94 | SelectMailType selType( selection, this, 0, true ); | 95 | SelectMailType selType( selection, this, 0, true ); |
95 | selType.show(); | 96 | selType.show(); |
96 | if ( QDialog::Accepted == selType.exec() ) | 97 | if ( QDialog::Accepted == selType.exec() ) |
97 | { | 98 | { |
98 | slotNewAccount( *selection ); | 99 | slotNewAccount( *selection ); |
99 | } | 100 | } |
100 | } | 101 | } |
101 | 102 | ||
102 | void EditAccounts::slotNewAccount( const QString &type ) | 103 | void EditAccounts::slotNewAccount( const QString &type ) |
103 | { | 104 | { |
104 | if ( type.compare( "IMAP" ) == 0 ) | 105 | if ( type.compare( "IMAP" ) == 0 ) |
105 | { | 106 | { |
106 | IMAPaccount *account = new IMAPaccount(); | 107 | IMAPaccount *account = new IMAPaccount(); |
107 | IMAPconfig imap( account, this, 0, true ); | 108 | IMAPconfig imap( account, this, 0, true ); |
108 | imap.showMaximized(); | 109 | imap.showMaximized(); |
109 | if ( QDialog::Accepted == imap.exec() ) | 110 | if ( QDialog::Accepted == imap.exec() ) |
110 | { | 111 | { |
111 | settings->addAccount( account ); | 112 | settings->addAccount( account ); |
112 | account->save(); | 113 | account->save(); |
113 | slotFillLists(); | 114 | slotFillLists(); |
114 | } | 115 | } |
115 | else | 116 | else |
116 | { | 117 | { |
117 | account->remove(); | 118 | account->remove(); |
118 | } | 119 | } |
119 | } | 120 | } |
120 | else if ( type.compare( "POP3" ) == 0 ) | 121 | else if ( type.compare( "POP3" ) == 0 ) |
121 | { | 122 | { |
122 | POP3account *account = new POP3account(); | 123 | POP3account *account = new POP3account(); |
123 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); | 124 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); |
124 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) | 125 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) |
125 | { | 126 | { |
126 | settings->addAccount( account ); | 127 | settings->addAccount( account ); |
127 | account->save(); | 128 | account->save(); |
128 | slotFillLists(); | 129 | slotFillLists(); |
129 | } | 130 | } |
130 | else | 131 | else |
131 | { | 132 | { |
132 | account->remove(); | 133 | account->remove(); |
133 | } | 134 | } |
134 | } | 135 | } |
135 | else if ( type.compare( "SMTP" ) == 0 ) | 136 | else if ( type.compare( "SMTP" ) == 0 ) |
136 | { | 137 | { |
137 | SMTPaccount *account = new SMTPaccount(); | 138 | SMTPaccount *account = new SMTPaccount(); |
138 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); | 139 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); |
139 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) | 140 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) |
140 | { | 141 | { |
141 | settings->addAccount( account ); | 142 | settings->addAccount( account ); |
142 | account->save(); | 143 | account->save(); |
143 | slotFillLists(); | 144 | slotFillLists(); |
144 | 145 | ||
145 | } | 146 | } |
146 | else | 147 | else |
147 | { | 148 | { |
148 | account->remove(); | 149 | account->remove(); |
149 | } | 150 | } |
150 | } | 151 | } |
151 | else if ( type.compare( "NNTP" ) == 0 ) | 152 | else if ( type.compare( "NNTP" ) == 0 ) |
152 | { | 153 | { |
153 | NNTPaccount *account = new NNTPaccount(); | 154 | NNTPaccount *account = new NNTPaccount(); |
154 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); | 155 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); |
155 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) | 156 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) |
156 | { | 157 | { |
157 | settings->addAccount( account ); | 158 | settings->addAccount( account ); |
158 | account->save(); | 159 | account->save(); |
159 | slotFillLists(); | 160 | slotFillLists(); |
160 | } | 161 | } |
161 | else | 162 | else |
162 | { | 163 | { |
163 | account->remove(); | 164 | account->remove(); |
164 | } | 165 | } |
165 | } | 166 | } |
166 | } | 167 | } |
167 | 168 | ||
168 | void EditAccounts::slotEditAccount( Account *account ) | 169 | void EditAccounts::slotEditAccount( Account *account ) |
169 | { | 170 | { |
170 | if ( account->getType() == MAILLIB::A_IMAP ) | 171 | if ( account->getType() == MAILLIB::A_IMAP ) |
171 | { | 172 | { |
172 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); | 173 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); |
173 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); | 174 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); |
174 | if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) | 175 | if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) |
175 | { | 176 | { |
176 | slotFillLists(); | 177 | slotFillLists(); |
177 | } | 178 | } |
178 | } | 179 | } |
179 | else if ( account->getType()==MAILLIB::A_POP3 ) | 180 | else if ( account->getType()==MAILLIB::A_POP3 ) |
180 | { | 181 | { |
181 | POP3account *pop3Acc = static_cast<POP3account *>(account); | 182 | POP3account *pop3Acc = static_cast<POP3account *>(account); |
182 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); | 183 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); |
183 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) | 184 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) |
184 | { | 185 | { |
185 | slotFillLists(); | 186 | slotFillLists(); |
186 | } | 187 | } |
187 | } | 188 | } |
188 | else if ( account->getType()==MAILLIB::A_SMTP ) | 189 | else if ( account->getType()==MAILLIB::A_SMTP ) |
189 | { | 190 | { |
190 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); | 191 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); |
191 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); | 192 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); |
192 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) | 193 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) |
193 | { | 194 | { |
194 | slotFillLists(); | 195 | slotFillLists(); |
195 | } | 196 | } |
196 | } | 197 | } |
197 | else if ( account->getType()==MAILLIB::A_NNTP) | 198 | else if ( account->getType()==MAILLIB::A_NNTP) |
198 | { | 199 | { |
199 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); | 200 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); |
200 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); | 201 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); |
201 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) | 202 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) |
202 | { | 203 | { |
203 | slotFillLists(); | 204 | slotFillLists(); |
204 | } | 205 | } |
205 | } | 206 | } |
206 | } | 207 | } |
207 | 208 | ||
208 | void EditAccounts::slotDeleteAccount( Account *account ) | 209 | void EditAccounts::slotDeleteAccount( Account *account ) |
209 | { | 210 | { |
210 | if ( QMessageBox::information( this, tr( "Question" ), | 211 | if ( QMessageBox::information( this, i18n( "Question" ), |
211 | tr( "<p>Do you really want to delete the selected Account?</p>" ), | 212 | i18n( "<p>Do you really want to delete the selected Account?</p>" ), |
212 | tr( "Yes" ), tr( "No" ) ) == 0 ) | 213 | i18n( "Yes" ), i18n( "No" ) ) == 0 ) |
213 | { | 214 | { |
214 | settings->delAccount( account ); | 215 | settings->delAccount( account ); |
215 | slotFillLists(); | 216 | slotFillLists(); |
216 | } | 217 | } |
217 | } | 218 | } |
218 | 219 | ||
219 | void EditAccounts::slotEditMail() | 220 | void EditAccounts::slotEditMail() |
220 | { | 221 | { |
221 | if ( !mailList->currentItem() ) | 222 | if ( !mailList->currentItem() ) |
222 | { | 223 | { |
223 | QMessageBox::information( this, tr( "Error" ), | 224 | QMessageBox::information( this, i18n( "Error" ), |
224 | tr( "<p>Please select an account.</p>" ), | 225 | i18n( "<p>Please select an account.</p>" ), |
225 | tr( "Ok" ) ); | 226 | i18n( "Ok" ) ); |
226 | return; | 227 | return; |
227 | } | 228 | } |
228 | 229 | ||
229 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 230 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
230 | slotEditAccount( a ); | 231 | slotEditAccount( a ); |
231 | } | 232 | } |
232 | 233 | ||
233 | void EditAccounts::slotDeleteMail() | 234 | void EditAccounts::slotDeleteMail() |
234 | { | 235 | { |
235 | if ( !mailList->currentItem() ) | 236 | if ( !mailList->currentItem() ) |
236 | { | 237 | { |
237 | QMessageBox::information( this, tr( "Error" ), | 238 | QMessageBox::information( this, i18n( "Error" ), |
238 | tr( "<p>Please select an account.</p>" ), | 239 | i18n( "<p>Please select an account.</p>" ), |
239 | tr( "Ok" ) ); | 240 | i18n( "Ok" ) ); |
240 | return; | 241 | return; |
241 | } | 242 | } |
242 | 243 | ||
243 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 244 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
244 | slotDeleteAccount( a ); | 245 | slotDeleteAccount( a ); |
245 | } | 246 | } |
246 | 247 | ||
247 | void EditAccounts::slotNewNews() | 248 | void EditAccounts::slotNewNews() |
248 | { | 249 | { |
249 | slotNewAccount( "NNTP" ); | 250 | slotNewAccount( "NNTP" ); |
250 | } | 251 | } |
251 | 252 | ||
252 | void EditAccounts::slotEditNews() | 253 | void EditAccounts::slotEditNews() |
253 | { | 254 | { |
254 | if ( !newsList->currentItem() ) | 255 | if ( !newsList->currentItem() ) |
255 | { | 256 | { |
256 | QMessageBox::information( this, tr( "Error" ), | 257 | QMessageBox::information( this, i18n( "Error" ), |
257 | tr( "<p>Please select an account.</p>" ), | 258 | i18n( "<p>Please select an account.</p>" ), |
258 | tr( "Ok" ) ); | 259 | i18n( "Ok" ) ); |
259 | return; | 260 | return; |
260 | } | 261 | } |
261 | 262 | ||
262 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 263 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
263 | slotEditAccount( a ); | 264 | slotEditAccount( a ); |
264 | } | 265 | } |
265 | 266 | ||
266 | void EditAccounts::slotDeleteNews() | 267 | void EditAccounts::slotDeleteNews() |
267 | { | 268 | { |
268 | if ( !newsList->currentItem() ) | 269 | if ( !newsList->currentItem() ) |
269 | { | 270 | { |
270 | QMessageBox::information( this, tr( "Error" ), | 271 | QMessageBox::information( this, i18n( "Error" ), |
271 | tr( "<p>Please select an account.</p>" ), | 272 | i18n( "<p>Please select an account.</p>" ), |
272 | tr( "Ok" ) ); | 273 | i18n( "Ok" ) ); |
273 | return; | 274 | return; |
274 | } | 275 | } |
275 | 276 | ||
276 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 277 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
277 | slotDeleteAccount( a ); | 278 | slotDeleteAccount( a ); |
278 | } | 279 | } |
279 | 280 | ||
280 | void EditAccounts::slotAdjustColumns() | 281 | void EditAccounts::slotAdjustColumns() |
281 | { | 282 | { |
282 | int currPage = configTab->currentPageIndex(); | 283 | int currPage = configTab->currentPageIndex(); |
283 | 284 | ||
284 | configTab->showPage( mailTab ); | 285 | configTab->showPage( mailTab ); |
285 | mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); | 286 | mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); |
286 | mailList->setColumnWidth( 1, 50 ); | 287 | mailList->setColumnWidth( 1, 50 ); |
287 | 288 | ||
288 | configTab->showPage( newsTab ); | 289 | configTab->showPage( newsTab ); |
289 | newsList->setColumnWidth( 0, newsList->visibleWidth() ); | 290 | newsList->setColumnWidth( 0, newsList->visibleWidth() ); |
290 | 291 | ||
291 | configTab->setCurrentPage( currPage ); | 292 | configTab->setCurrentPage( currPage ); |
292 | } | 293 | } |
293 | 294 | ||
294 | void EditAccounts::accept() | 295 | void EditAccounts::accept() |
295 | { | 296 | { |
296 | settings->saveAccounts(); | 297 | settings->saveAccounts(); |
297 | 298 | ||
298 | QDialog::accept(); | 299 | QDialog::accept(); |
299 | } | 300 | } |
300 | 301 | ||
301 | /** | 302 | /** |
302 | * SelectMailType | 303 | * SelectMailType |
303 | */ | 304 | */ |
304 | 305 | ||
305 | 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 ) |
306 | : SelectMailTypeUI( parent, name, modal, flags ) | 307 | : SelectMailTypeUI( parent, name, modal, flags ) |
307 | { | 308 | { |
308 | selected = selection; | 309 | selected = selection; |
309 | selected->replace( 0, selected->length(), typeBox->currentText() ); | 310 | selected->replace( 0, selected->length(), typeBox->currentText() ); |
310 | connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); | 311 | connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); |
311 | } | 312 | } |
312 | 313 | ||
313 | void SelectMailType::slotSelection( const QString &sel ) | 314 | void SelectMailType::slotSelection( const QString &sel ) |
314 | { | 315 | { |
315 | selected->replace( 0, selected->length(), sel ); | 316 | selected->replace( 0, selected->length(), sel ); |
316 | } | 317 | } |
317 | 318 | ||
318 | /** | 319 | /** |
319 | * IMAPconfig | 320 | * IMAPconfig |
320 | */ | 321 | */ |
321 | 322 | ||
322 | 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 ) |
323 | : IMAPconfigUI( parent, name, modal, flags ) | 324 | : IMAPconfigUI( parent, name, modal, flags ) |
324 | { | 325 | { |
325 | data = account; | 326 | data = account; |
326 | 327 | ||
327 | fillValues(); | 328 | fillValues(); |
328 | 329 | ||
329 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 330 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
330 | ComboBox1->insertItem( "Only if available", 0 ); | 331 | ComboBox1->insertItem( "Only if available", 0 ); |
331 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 332 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
332 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 333 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
333 | ComboBox1->insertItem( "Run command instead", 3 ); | 334 | ComboBox1->insertItem( "Run command instead", 3 ); |
334 | CommandEdit->hide(); | 335 | CommandEdit->hide(); |
335 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 336 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
336 | } | 337 | } |
337 | 338 | ||
338 | void IMAPconfig::slotConnectionToggle( int index ) | 339 | void IMAPconfig::slotConnectionToggle( int index ) |
339 | { | 340 | { |
340 | if ( index == 2 ) | 341 | if ( index == 2 ) |
341 | { | 342 | { |
342 | portLine->setText( IMAP_SSL_PORT ); | 343 | portLine->setText( IMAP_SSL_PORT ); |
343 | } | 344 | } |
344 | else if ( index == 3 ) | 345 | else if ( index == 3 ) |
345 | { | 346 | { |
346 | portLine->setText( IMAP_PORT ); | 347 | portLine->setText( IMAP_PORT ); |
347 | CommandEdit->show(); | 348 | CommandEdit->show(); |
348 | } | 349 | } |
349 | else | 350 | else |
350 | { | 351 | { |
351 | portLine->setText( IMAP_PORT ); | 352 | portLine->setText( IMAP_PORT ); |
352 | } | 353 | } |
353 | } | 354 | } |
354 | 355 | ||
355 | void IMAPconfig::fillValues() | 356 | void IMAPconfig::fillValues() |
356 | { | 357 | { |
357 | accountLine->setText( data->getAccountName() ); | 358 | accountLine->setText( data->getAccountName() ); |
358 | serverLine->setText( data->getServer() ); | 359 | serverLine->setText( data->getServer() ); |
359 | portLine->setText( data->getPort() ); | 360 | portLine->setText( data->getPort() ); |
360 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 361 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
361 | userLine->setText( data->getUser() ); | 362 | userLine->setText( data->getUser() ); |
362 | passLine->setText( data->getPassword() ); | 363 | passLine->setText( data->getPassword() ); |
363 | prefixLine->setText(data->getPrefix()); | 364 | prefixLine->setText(data->getPrefix()); |
364 | localFolder->setText( data->getLocalFolder() ); | 365 | localFolder->setText( data->getLocalFolder() ); |
365 | int max = data->getMaxMailSize() ; | 366 | int max = data->getMaxMailSize() ; |
366 | if ( max ) { | 367 | if ( max ) { |
367 | CheckBoxDown->setChecked( true ); | 368 | CheckBoxDown->setChecked( true ); |
368 | SpinBoxDown->setValue ( max ); | 369 | SpinBoxDown->setValue ( max ); |
369 | } else { | 370 | } else { |
370 | CheckBoxDown->setChecked( false ); | 371 | CheckBoxDown->setChecked( false ); |
371 | SpinBoxDown->setValue ( 5 ); | 372 | SpinBoxDown->setValue ( 5 ); |
372 | } | 373 | } |
373 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | 374 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); |
374 | } | 375 | } |
375 | 376 | ||
376 | void IMAPconfig::accept() | 377 | void IMAPconfig::accept() |
377 | { | 378 | { |
378 | data->setAccountName( accountLine->text() ); | 379 | data->setAccountName( accountLine->text() ); |
379 | data->setServer( serverLine->text() ); | 380 | data->setServer( serverLine->text() ); |
380 | data->setPort( portLine->text() ); | 381 | data->setPort( portLine->text() ); |
381 | data->setConnectionType( ComboBox1->currentItem() ); | 382 | data->setConnectionType( ComboBox1->currentItem() ); |
382 | data->setUser( userLine->text() ); | 383 | data->setUser( userLine->text() ); |
383 | data->setPassword( passLine->text() ); | 384 | data->setPassword( passLine->text() ); |
384 | data->setPrefix(prefixLine->text()); | 385 | data->setPrefix(prefixLine->text()); |
385 | data->setLocalFolder( localFolder->text() ); | 386 | data->setLocalFolder( localFolder->text() ); |
386 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 387 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
387 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | 388 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); |
388 | 389 | ||
389 | QDialog::accept(); | 390 | QDialog::accept(); |
390 | } | 391 | } |
391 | 392 | ||
392 | /** | 393 | /** |
393 | * POP3config | 394 | * POP3config |
394 | */ | 395 | */ |
395 | 396 | ||
396 | 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 ) |
397 | : POP3configUI( parent, name, modal, flags ) | 398 | : POP3configUI( parent, name, modal, flags ) |
398 | { | 399 | { |
399 | data = account; | 400 | data = account; |
400 | fillValues(); | 401 | fillValues(); |
401 | 402 | ||
402 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 403 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
403 | ComboBox1->insertItem( "Only if available", 0 ); | 404 | ComboBox1->insertItem( "Only if available", 0 ); |
404 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 405 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
405 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 406 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
406 | ComboBox1->insertItem( "Run command instead", 3 ); | 407 | ComboBox1->insertItem( "Run command instead", 3 ); |
407 | CommandEdit->hide(); | 408 | CommandEdit->hide(); |
408 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 409 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
409 | } | 410 | } |
410 | 411 | ||
411 | void POP3config::slotConnectionToggle( int index ) | 412 | void POP3config::slotConnectionToggle( int index ) |
412 | { | 413 | { |
413 | // 2 is ssl connection | 414 | // 2 is ssl connection |
414 | if ( index == 2 ) | 415 | if ( index == 2 ) |
415 | { | 416 | { |
416 | portLine->setText( POP3_SSL_PORT ); | 417 | portLine->setText( POP3_SSL_PORT ); |
417 | } | 418 | } |
418 | else if ( index == 3 ) | 419 | else if ( index == 3 ) |
419 | { | 420 | { |
420 | portLine->setText( POP3_PORT ); | 421 | portLine->setText( POP3_PORT ); |
421 | CommandEdit->show(); | 422 | CommandEdit->show(); |
422 | } | 423 | } |
423 | else | 424 | else |
424 | { | 425 | { |
425 | portLine->setText( POP3_PORT ); | 426 | portLine->setText( POP3_PORT ); |
426 | } | 427 | } |
427 | } | 428 | } |
428 | 429 | ||
429 | void POP3config::fillValues() | 430 | void POP3config::fillValues() |
430 | { | 431 | { |
431 | accountLine->setText( data->getAccountName() ); | 432 | accountLine->setText( data->getAccountName() ); |
432 | serverLine->setText( data->getServer() ); | 433 | serverLine->setText( data->getServer() ); |
433 | portLine->setText( data->getPort() ); | 434 | portLine->setText( data->getPort() ); |
434 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 435 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
435 | userLine->setText( data->getUser() ); | 436 | userLine->setText( data->getUser() ); |
436 | passLine->setText( data->getPassword() ); | 437 | passLine->setText( data->getPassword() ); |
437 | localFolder->setText( data->getLocalFolder() ); | 438 | localFolder->setText( data->getLocalFolder() ); |
438 | int max = data->getMaxMailSize() ; | 439 | int max = data->getMaxMailSize() ; |
439 | if ( max ) { | 440 | if ( max ) { |
440 | CheckBoxDown->setChecked( true ); | 441 | CheckBoxDown->setChecked( true ); |
441 | SpinBoxDown->setValue ( max ); | 442 | SpinBoxDown->setValue ( max ); |
442 | } else { | 443 | } else { |
443 | CheckBoxDown->setChecked( false ); | 444 | CheckBoxDown->setChecked( false ); |
444 | SpinBoxDown->setValue ( 5 ); | 445 | SpinBoxDown->setValue ( 5 ); |
445 | } | 446 | } |
446 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | 447 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); |
447 | } | 448 | } |
448 | 449 | ||
449 | void POP3config::accept() | 450 | void POP3config::accept() |
450 | { | 451 | { |
451 | data->setAccountName( accountLine->text() ); | 452 | data->setAccountName( accountLine->text() ); |
452 | data->setServer( serverLine->text() ); | 453 | data->setServer( serverLine->text() ); |
453 | data->setPort( portLine->text() ); | 454 | data->setPort( portLine->text() ); |
454 | data->setConnectionType( ComboBox1->currentItem() ); | 455 | data->setConnectionType( ComboBox1->currentItem() ); |
455 | data->setUser( userLine->text() ); | 456 | data->setUser( userLine->text() ); |
456 | data->setPassword( passLine->text() ); | 457 | data->setPassword( passLine->text() ); |
457 | data->setLocalFolder( localFolder->text() ); | 458 | data->setLocalFolder( localFolder->text() ); |
458 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 459 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
459 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | 460 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); |
460 | 461 | ||
461 | QDialog::accept(); | 462 | QDialog::accept(); |
462 | } | 463 | } |
463 | 464 | ||
464 | /** | 465 | /** |
465 | * SMTPconfig | 466 | * SMTPconfig |
466 | */ | 467 | */ |
467 | 468 | ||
468 | 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 ) |
469 | : SMTPconfigUI( parent, name, modal, flags ) | 470 | : SMTPconfigUI( parent, name, modal, flags ) |
470 | { | 471 | { |
471 | data = account; | 472 | data = account; |
472 | 473 | ||
473 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 474 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
474 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 475 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
475 | 476 | ||
476 | fillValues(); | 477 | fillValues(); |
477 | 478 | ||
478 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 479 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
479 | ComboBox1->insertItem( "Only if available", 0 ); | 480 | ComboBox1->insertItem( "Only if available", 0 ); |
480 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 481 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
481 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 482 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
482 | ComboBox1->insertItem( "Run command instead", 3 ); | 483 | ComboBox1->insertItem( "Run command instead", 3 ); |
483 | CommandEdit->hide(); | 484 | CommandEdit->hide(); |
484 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 485 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
485 | } | 486 | } |
486 | 487 | ||
487 | void SMTPconfig::slotConnectionToggle( int index ) | 488 | void SMTPconfig::slotConnectionToggle( int index ) |
488 | { | 489 | { |
489 | // 2 is ssl connection | 490 | // 2 is ssl connection |
490 | if ( index == 2 ) | 491 | if ( index == 2 ) |
491 | { | 492 | { |
492 | portLine->setText( SMTP_SSL_PORT ); | 493 | portLine->setText( SMTP_SSL_PORT ); |
493 | } | 494 | } |
494 | else if ( index == 3 ) | 495 | else if ( index == 3 ) |
495 | { | 496 | { |
496 | portLine->setText( SMTP_PORT ); | 497 | portLine->setText( SMTP_PORT ); |
497 | CommandEdit->show(); | 498 | CommandEdit->show(); |
498 | } | 499 | } |
499 | else | 500 | else |
500 | { | 501 | { |
501 | portLine->setText( SMTP_PORT ); | 502 | portLine->setText( SMTP_PORT ); |
502 | } | 503 | } |
503 | } | 504 | } |
504 | 505 | ||
505 | void SMTPconfig::fillValues() | 506 | void SMTPconfig::fillValues() |
506 | { | 507 | { |
507 | accountLine->setText( data->getAccountName() ); | 508 | accountLine->setText( data->getAccountName() ); |
508 | serverLine->setText( data->getServer() ); | 509 | serverLine->setText( data->getServer() ); |
509 | portLine->setText( data->getPort() ); | 510 | portLine->setText( data->getPort() ); |
510 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 511 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
511 | loginBox->setChecked( data->getLogin() ); | 512 | loginBox->setChecked( data->getLogin() ); |
512 | userLine->setText( data->getUser() ); | 513 | userLine->setText( data->getUser() ); |
513 | passLine->setText( data->getPassword() ); | 514 | passLine->setText( data->getPassword() ); |
514 | } | 515 | } |
515 | 516 | ||
516 | void SMTPconfig::accept() | 517 | void SMTPconfig::accept() |
517 | { | 518 | { |
518 | data->setAccountName( accountLine->text() ); | 519 | data->setAccountName( accountLine->text() ); |
519 | data->setServer( serverLine->text() ); | 520 | data->setServer( serverLine->text() ); |
520 | data->setPort( portLine->text() ); | 521 | data->setPort( portLine->text() ); |
521 | data->setConnectionType( ComboBox1->currentItem() ); | 522 | data->setConnectionType( ComboBox1->currentItem() ); |
522 | data->setLogin( loginBox->isChecked() ); | 523 | data->setLogin( loginBox->isChecked() ); |
523 | data->setUser( userLine->text() ); | 524 | data->setUser( userLine->text() ); |
524 | data->setPassword( passLine->text() ); | 525 | data->setPassword( passLine->text() ); |
525 | 526 | ||
526 | QDialog::accept(); | 527 | QDialog::accept(); |
527 | } | 528 | } |
528 | 529 | ||
529 | /** | 530 | /** |
530 | * NNTPconfig | 531 | * NNTPconfig |
531 | */ | 532 | */ |
532 | 533 | ||
533 | 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 ) |
534 | : NNTPconfigUI( parent, name, modal, flags ) | 535 | : NNTPconfigUI( parent, name, modal, flags ) |
535 | { | 536 | { |
536 | data = account; | 537 | data = account; |
537 | 538 | ||
538 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 539 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
539 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 540 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
540 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); | 541 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); |
541 | connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); | 542 | connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); |
542 | connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); | 543 | connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); |
543 | fillValues(); | 544 | fillValues(); |
544 | 545 | ||
545 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); | 546 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); |
546 | } | 547 | } |
547 | 548 | ||
548 | void NNTPconfig::slotShowSub() | 549 | void NNTPconfig::slotShowSub() |
549 | { | 550 | { |
550 | save(); | 551 | save(); |
551 | data->save(); | 552 | data->save(); |
552 | ListViewGroups->clear(); | 553 | ListViewGroups->clear(); |
553 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | 554 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { |
554 | QCheckListItem *item; | 555 | QCheckListItem *item; |
555 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 556 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
556 | item->setOn( true ); | 557 | item->setOn( true ); |
557 | } | 558 | } |
558 | topLevelWidget()->setCaption( tr("%1 groups subscribed").arg( subscribedGroups.count())); | 559 | topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); |
559 | } | 560 | } |
560 | void NNTPconfig::slotShowFilter() | 561 | void NNTPconfig::slotShowFilter() |
561 | { | 562 | { |
562 | save(); | 563 | save(); |
563 | data->save(); | 564 | data->save(); |
564 | ListViewGroups->clear(); | 565 | ListViewGroups->clear(); |
565 | int count = 0; | 566 | int count = 0; |
566 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { | 567 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { |
567 | QCheckListItem *item; | 568 | QCheckListItem *item; |
568 | if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { | 569 | if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { |
569 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 570 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
570 | ++count; | 571 | ++count; |
571 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | 572 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
572 | item->setOn( true ); | 573 | item->setOn( true ); |
573 | } | 574 | } |
574 | } | 575 | } |
575 | } | 576 | } |
576 | topLevelWidget()->setCaption( tr("Filter found %1 groups").arg( count)); | 577 | topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); |
577 | } | 578 | } |
578 | void NNTPconfig::slotGetNG() { | 579 | void NNTPconfig::slotGetNG() { |
579 | save(); | 580 | save(); |
580 | data->save(); | 581 | data->save(); |
581 | topLevelWidget()->setCaption( tr("Fetching group list...")); | 582 | topLevelWidget()->setCaption( i18n("Fetching group list...")); |
582 | qApp->processEvents(); | 583 | qApp->processEvents(); |
583 | NNTPwrapper* tmp = new NNTPwrapper( data ); | 584 | NNTPwrapper* tmp = new NNTPwrapper( data ); |
584 | allGroups = tmp->listAllNewsgroups(); | 585 | allGroups = tmp->listAllNewsgroups(); |
585 | topLevelWidget()->setCaption( tr("Downloaded %1 group names").arg( allGroups.count())); | 586 | topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); |
586 | 587 | ||
587 | ListViewGroups->clear(); | 588 | ListViewGroups->clear(); |
588 | 589 | ||
589 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { | 590 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { |
590 | QCheckListItem *item; | 591 | QCheckListItem *item; |
591 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 592 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
592 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | 593 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
593 | item->setOn( true ); | 594 | item->setOn( true ); |
594 | 595 | ||
595 | } | 596 | } |
596 | } | 597 | } |
597 | delete tmp; | 598 | delete tmp; |
598 | } | 599 | } |
599 | 600 | ||
600 | void NNTPconfig::slotSSL( bool enabled ) | 601 | void NNTPconfig::slotSSL( bool enabled ) |
601 | { | 602 | { |
602 | if ( enabled ) | 603 | if ( enabled ) |
603 | { | 604 | { |
604 | portLine->setText( NNTP_SSL_PORT ); | 605 | portLine->setText( NNTP_SSL_PORT ); |
605 | } | 606 | } |
606 | else | 607 | else |
607 | { | 608 | { |
608 | portLine->setText( NNTP_PORT ); | 609 | portLine->setText( NNTP_PORT ); |
609 | } | 610 | } |
610 | } | 611 | } |
611 | 612 | ||
612 | void NNTPconfig::fillValues() | 613 | void NNTPconfig::fillValues() |
613 | { | 614 | { |
614 | accountLine->setText( data->getAccountName() ); | 615 | accountLine->setText( data->getAccountName() ); |
615 | serverLine->setText( data->getServer() ); | 616 | serverLine->setText( data->getServer() ); |
616 | portLine->setText( data->getPort() ); | 617 | portLine->setText( data->getPort() ); |
617 | sslBox->setChecked( data->getSSL() ); | 618 | sslBox->setChecked( data->getSSL() ); |
618 | loginBox->setChecked( data->getLogin() ); | 619 | loginBox->setChecked( data->getLogin() ); |
619 | userLine->setText( data->getUser() ); | 620 | userLine->setText( data->getUser() ); |
620 | passLine->setText( data->getPassword() ); | 621 | passLine->setText( data->getPassword() ); |
621 | subscribedGroups = data->getGroups(); | 622 | subscribedGroups = data->getGroups(); |
622 | /* don't forget that - you will overwrite values if user clicks cancel! */ | 623 | /* don't forget that - you will overwrite values if user clicks cancel! */ |
623 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | 624 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { |
624 | QCheckListItem *item; | 625 | QCheckListItem *item; |
625 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 626 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
626 | item->setOn( true ); | 627 | item->setOn( true ); |
627 | } | 628 | } |
628 | } | 629 | } |
629 | 630 | ||
630 | void NNTPconfig::save() | 631 | void NNTPconfig::save() |
631 | { | 632 | { |
632 | data->setAccountName( accountLine->text() ); | 633 | data->setAccountName( accountLine->text() ); |
633 | data->setServer( serverLine->text() ); | 634 | data->setServer( serverLine->text() ); |
634 | data->setPort( portLine->text() ); | 635 | data->setPort( portLine->text() ); |
635 | data->setSSL( sslBox->isChecked() ); | 636 | data->setSSL( sslBox->isChecked() ); |
636 | data->setLogin( loginBox->isChecked() ); | 637 | data->setLogin( loginBox->isChecked() ); |
637 | data->setUser( userLine->text() ); | 638 | data->setUser( userLine->text() ); |
638 | data->setPassword( passLine->text() ); | 639 | data->setPassword( passLine->text() ); |
639 | 640 | ||
640 | QListViewItemIterator list_it( ListViewGroups ); | 641 | QListViewItemIterator list_it( ListViewGroups ); |
641 | 642 | ||
642 | for ( ; list_it.current(); ++list_it ) { | 643 | for ( ; list_it.current(); ++list_it ) { |
643 | 644 | ||
644 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { | 645 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { |
645 | if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) | 646 | if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) |
646 | subscribedGroups.append( list_it.current()->text(0) ); | 647 | subscribedGroups.append( list_it.current()->text(0) ); |
647 | } else { | 648 | } else { |
648 | if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) | 649 | if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) |
649 | subscribedGroups.remove( list_it.current()->text(0) ); | 650 | subscribedGroups.remove( list_it.current()->text(0) ); |
650 | } | 651 | } |
651 | 652 | ||
652 | } | 653 | } |
653 | data->setGroups( subscribedGroups ); | 654 | data->setGroups( subscribedGroups ); |
654 | } | 655 | } |
655 | 656 | ||
656 | void NNTPconfig::accept() | 657 | void NNTPconfig::accept() |
657 | { | 658 | { |
658 | save(); | 659 | save(); |
659 | QDialog::accept(); | 660 | QDialog::accept(); |
660 | } | 661 | } |
661 | 662 | ||