-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,388 +1,389 @@ | |||
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() ); |