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