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