Diffstat (limited to 'noncore/net/mail/editaccounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 28d531b..5c4bdf7 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp | |||
@@ -7,25 +7,43 @@ | |||
7 | 7 | ||
8 | /* QT */ | 8 | /* QT */ |
9 | #include <qt.h> | 9 | #include <qt.h> |
10 | #include <qstringlist.h> | 10 | #include <qstringlist.h> |
11 | 11 | ||
12 | #include <libmailwrapper/nntpwrapper.h> | 12 | #include <libmailwrapper/nntpwrapper.h> |
13 | 13 | ||
14 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 14 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
15 | : QListViewItem( parent ) | 15 | : QListViewItem( parent ) |
16 | { | 16 | { |
17 | account = a; | 17 | account = a; |
18 | setText( 0, account->getAccountName() ); | 18 | setText( 0, account->getAccountName() ); |
19 | setText( 1, account->getType() ); | 19 | QString ttext = ""; |
20 | switch (account->getType()) { | ||
21 | case MAILLIB::A_NNTP: | ||
22 | ttext="NNTP"; | ||
23 | break; | ||
24 | case MAILLIB::A_POP3: | ||
25 | ttext = "POP3"; | ||
26 | break; | ||
27 | case MAILLIB::A_IMAP: | ||
28 | ttext = "IMAP"; | ||
29 | break; | ||
30 | case MAILLIB::A_SMTP: | ||
31 | ttext = "SMTP"; | ||
32 | break; | ||
33 | default: | ||
34 | ttext = "UNKNOWN"; | ||
35 | break; | ||
36 | } | ||
37 | setText( 1, ttext); | ||
20 | } | 38 | } |
21 | 39 | ||
22 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 40 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
23 | : EditAccountsUI( parent, name, modal, flags ) | 41 | : EditAccountsUI( parent, name, modal, flags ) |
24 | { | 42 | { |
25 | qDebug( "New Account Configuration Widget" ); | 43 | qDebug( "New Account Configuration Widget" ); |
26 | settings = s; | 44 | settings = s; |
27 | 45 | ||
28 | mailList->addColumn( tr( "Account" ) ); | 46 | mailList->addColumn( tr( "Account" ) ); |
29 | mailList->addColumn( tr( "Type" ) ); | 47 | mailList->addColumn( tr( "Type" ) ); |
30 | 48 | ||
31 | newsList->addColumn( tr( "Account" ) ); | 49 | newsList->addColumn( tr( "Account" ) ); |
@@ -40,25 +58,25 @@ EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool | |||
40 | slotFillLists(); | 58 | slotFillLists(); |
41 | } | 59 | } |
42 | 60 | ||
43 | void EditAccounts::slotFillLists() | 61 | void EditAccounts::slotFillLists() |
44 | { | 62 | { |
45 | mailList->clear(); | 63 | mailList->clear(); |
46 | newsList->clear(); | 64 | newsList->clear(); |
47 | 65 | ||
48 | QList<Account> accounts = settings->getAccounts(); | 66 | QList<Account> accounts = settings->getAccounts(); |
49 | Account *it; | 67 | Account *it; |
50 | for ( it = accounts.first(); it; it = accounts.next() ) | 68 | for ( it = accounts.first(); it; it = accounts.next() ) |
51 | { | 69 | { |
52 | if ( it->getType().compare( "NNTP" ) == 0 ) | 70 | if ( it->getType()==MAILLIB::A_NNTP ) |
53 | { | 71 | { |
54 | (void) new AccountListItem( newsList, it ); | 72 | (void) new AccountListItem( newsList, it ); |
55 | } | 73 | } |
56 | else | 74 | else |
57 | { | 75 | { |
58 | (void) new AccountListItem( mailList, it ); | 76 | (void) new AccountListItem( mailList, it ); |
59 | } | 77 | } |
60 | } | 78 | } |
61 | } | 79 | } |
62 | 80 | ||
63 | void EditAccounts::slotNewMail() | 81 | void EditAccounts::slotNewMail() |
64 | { | 82 | { |
@@ -134,52 +152,52 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
134 | account->save(); | 152 | account->save(); |
135 | slotFillLists(); | 153 | slotFillLists(); |
136 | } | 154 | } |
137 | else | 155 | else |
138 | { | 156 | { |
139 | account->remove(); | 157 | account->remove(); |
140 | } | 158 | } |
141 | } | 159 | } |
142 | } | 160 | } |
143 | 161 | ||
144 | void EditAccounts::slotEditAccount( Account *account ) | 162 | void EditAccounts::slotEditAccount( Account *account ) |
145 | { | 163 | { |
146 | if ( account->getType().compare( "IMAP" ) == 0 ) | 164 | if ( account->getType() == MAILLIB::A_IMAP ) |
147 | { | 165 | { |
148 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); | 166 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); |
149 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); | 167 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); |
150 | if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) | 168 | if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) |
151 | { | 169 | { |
152 | slotFillLists(); | 170 | slotFillLists(); |
153 | } | 171 | } |
154 | } | 172 | } |
155 | else if ( account->getType().compare( "POP3" ) == 0 ) | 173 | else if ( account->getType()==MAILLIB::A_POP3 ) |
156 | { | 174 | { |
157 | POP3account *pop3Acc = static_cast<POP3account *>(account); | 175 | POP3account *pop3Acc = static_cast<POP3account *>(account); |
158 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); | 176 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); |
159 | if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) | 177 | if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) |
160 | { | 178 | { |
161 | slotFillLists(); | 179 | slotFillLists(); |
162 | } | 180 | } |
163 | } | 181 | } |
164 | else if ( account->getType().compare( "SMTP" ) == 0 ) | 182 | else if ( account->getType()==MAILLIB::A_SMTP ) |
165 | { | 183 | { |
166 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); | 184 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); |
167 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); | 185 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); |
168 | if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) | 186 | if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) |
169 | { | 187 | { |
170 | slotFillLists(); | 188 | slotFillLists(); |
171 | } | 189 | } |
172 | } | 190 | } |
173 | else if ( account->getType().compare( "NNTP" ) == 0 ) | 191 | else if ( account->getType()==MAILLIB::A_NNTP) |
174 | { | 192 | { |
175 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); | 193 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); |
176 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); | 194 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); |
177 | if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) | 195 | if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) |
178 | { | 196 | { |
179 | slotFillLists(); | 197 | slotFillLists(); |
180 | } | 198 | } |
181 | } | 199 | } |
182 | } | 200 | } |
183 | 201 | ||
184 | void EditAccounts::slotDeleteAccount( Account *account ) | 202 | void EditAccounts::slotDeleteAccount( Account *account ) |
185 | { | 203 | { |