summaryrefslogtreecommitdiffabout
path: root/kmicromail/editaccounts.cpp
Unidiff
Diffstat (limited to 'kmicromail/editaccounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index 7ad4ec8..c931e45 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -9,240 +9,240 @@
9#include <qstringlist.h> 9#include <qstringlist.h>
10 10
11#include <qcombobox.h> 11#include <qcombobox.h>
12#include <qcheckbox.h> 12#include <qcheckbox.h>
13#include <qmessagebox.h> 13#include <qmessagebox.h>
14#include <qpushbutton.h> 14#include <qpushbutton.h>
15#include <qlineedit.h> 15#include <qlineedit.h>
16#include <qlabel.h> 16#include <qlabel.h>
17#include <qtabwidget.h> 17#include <qtabwidget.h>
18#include <qlistview.h> 18#include <qlistview.h>
19#include <qspinbox.h> 19#include <qspinbox.h>
20#include <klocale.h> 20#include <klocale.h>
21 21
22#include <libmailwrapper/nntpwrapper.h> 22#include <libmailwrapper/nntpwrapper.h>
23 23
24using namespace Opie::Core; 24using namespace Opie::Core;
25 25
26AccountListItem::AccountListItem( QListView *parent, Account *a) 26AccountListItem::AccountListItem( QListView *parent, Account *a)
27 : QListViewItem( parent ) 27 : QListViewItem( parent )
28{ 28{
29 account = a; 29 account = a;
30 setText( 0, account->getAccountName() ); 30 setText( 0, account->getAccountName() );
31 QString ttext = ""; 31 QString ttext = "";
32 switch (account->getType()) { 32 switch (account->getType()) {
33 case MAILLIB::A_NNTP: 33 case MAILLIB::A_NNTP:
34 ttext="NNTP"; 34 ttext="NNTP";
35 break; 35 break;
36 case MAILLIB::A_POP3: 36 case MAILLIB::A_POP3:
37 ttext = "POP3"; 37 ttext = "POP3";
38 break; 38 break;
39 case MAILLIB::A_IMAP: 39 case MAILLIB::A_IMAP:
40 ttext = "IMAP"; 40 ttext = "IMAP";
41 break; 41 break;
42 case MAILLIB::A_SMTP: 42 case MAILLIB::A_SMTP:
43 ttext = "SMTP"; 43 ttext = "SMTP";
44 break; 44 break;
45 default: 45 default:
46 ttext = "UNKNOWN"; 46 ttext = "UNKNOWN";
47 break; 47 break;
48 } 48 }
49 setText( 1, ttext); 49 setText( 1, ttext);
50} 50}
51 51
52EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 52EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
53 : EditAccountsUI( parent, name, modal, flags ) 53 : EditAccountsUI( parent, name, modal, flags )
54{ 54{
55 settings = s; 55 settings = s;
56 56
57 mailList->addColumn( i18n( "Account" ) ); 57 mailList->addColumn( i18n( "Account" ) );
58 mailList->addColumn( i18n( "Type" ) ); 58 mailList->addColumn( i18n( "Type" ) );
59 59
60 newsList->addColumn( i18n( "Account" ) ); 60 newsList->addColumn( i18n( "Account" ) );
61 61
62 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 62 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
63 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 63 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
64 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 64 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
65 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); 65 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
66 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); 66 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
67 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); 67 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
68 68
69 slotFillLists(); 69 slotFillLists();
70} 70}
71 71
72void EditAccounts::slotFillLists() 72void EditAccounts::slotFillLists()
73{ 73{
74 mailList->clear(); 74 mailList->clear();
75 newsList->clear(); 75 newsList->clear();
76 76
77 QList<Account> accounts = settings->getAccounts(); 77 QList<Account> accounts = settings->getAccounts();
78 Account *it; 78 Account *it;
79 for ( it = accounts.first(); it; it = accounts.next() ) 79 for ( it = accounts.first(); it; it = accounts.next() )
80 { 80 {
81 if ( it->getType()==MAILLIB::A_NNTP ) 81 if ( it->getType()==MAILLIB::A_NNTP )
82 { 82 {
83 (void) new AccountListItem( newsList, it ); 83 (void) new AccountListItem( newsList, it );
84 } 84 }
85 else 85 else
86 { 86 {
87 (void) new AccountListItem( mailList, it ); 87 (void) new AccountListItem( mailList, it );
88 } 88 }
89 } 89 }
90} 90}
91 91
92void EditAccounts::slotNewMail() 92void EditAccounts::slotNewMail()
93{ 93{
94 QString *selection = new QString(); 94 QString *selection = new QString();
95 SelectMailType selType( selection, this, 0, true ); 95 SelectMailType selType( selection, this, 0, true );
96 selType.show(); 96 selType.show();
97 if ( QDialog::Accepted == selType.exec() ) 97 if ( QDialog::Accepted == selType.exec() )
98 { 98 {
99 slotNewAccount( *selection ); 99 slotNewAccount( *selection );
100 } 100 }
101} 101}
102 102
103void EditAccounts::slotNewAccount( const QString &type ) 103void EditAccounts::slotNewAccount( const QString &type )
104{ 104{
105 if ( type.compare( "IMAP" ) == 0 ) 105 if ( type.compare( i18n("IMAP") ) == 0 )
106 { 106 {
107 IMAPaccount *account = new IMAPaccount(); 107 IMAPaccount *account = new IMAPaccount();
108 IMAPconfig imap( account, this, 0, true ); 108 IMAPconfig imap( account, this, 0, true );
109 imap.showMaximized(); 109 imap.showMaximized();
110 if ( QDialog::Accepted == imap.exec() ) 110 if ( QDialog::Accepted == imap.exec() )
111 { 111 {
112 settings->addAccount( account ); 112 settings->addAccount( account );
113 account->save(); 113 account->save();
114 slotFillLists(); 114 slotFillLists();
115 } 115 }
116 else 116 else
117 { 117 {
118 account->remove(); 118 account->remove();
119 } 119 }
120 } 120 }
121 else if ( type.compare( "POP3" ) == 0 ) 121 else if ( type.compare( i18n("POP3") ) == 0 )
122 { 122 {
123 POP3account *account = new POP3account(); 123 POP3account *account = new POP3account();
124 POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); 124 POP3config pop3( account, this, 0, true, WStyle_ContextHelp );
125 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) 125 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) )
126 { 126 {
127 settings->addAccount( account ); 127 settings->addAccount( account );
128 account->save(); 128 account->save();
129 slotFillLists(); 129 slotFillLists();
130 } 130 }
131 else 131 else
132 { 132 {
133 account->remove(); 133 account->remove();
134 } 134 }
135 } 135 }
136 else if ( type.compare( "SMTP" ) == 0 ) 136 else if ( type.compare( i18n("SMTP") ) == 0 )
137 { 137 {
138 SMTPaccount *account = new SMTPaccount(); 138 SMTPaccount *account = new SMTPaccount();
139 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); 139 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp );
140 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) 140 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) )
141 { 141 {
142 settings->addAccount( account ); 142 settings->addAccount( account );
143 account->save(); 143 account->save();
144 slotFillLists(); 144 slotFillLists();
145 145
146 } 146 }
147 else 147 else
148 { 148 {
149 account->remove(); 149 account->remove();
150 } 150 }
151 } 151 }
152 else if ( type.compare( "NNTP" ) == 0 ) 152 else if ( type.compare( i18n("NNTP") ) == 0 )
153 { 153 {
154 NNTPaccount *account = new NNTPaccount(); 154 NNTPaccount *account = new NNTPaccount();
155 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); 155 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp );
156 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) 156 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) )
157 { 157 {
158 settings->addAccount( account ); 158 settings->addAccount( account );
159 account->save(); 159 account->save();
160 slotFillLists(); 160 slotFillLists();
161 } 161 }
162 else 162 else
163 { 163 {
164 account->remove(); 164 account->remove();
165 } 165 }
166 } 166 }
167} 167}
168 168
169void EditAccounts::slotEditAccount( Account *account ) 169void EditAccounts::slotEditAccount( Account *account )
170{ 170{
171 if ( account->getType() == MAILLIB::A_IMAP ) 171 if ( account->getType() == MAILLIB::A_IMAP )
172 { 172 {
173 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); 173 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
174 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); 174 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp );
175 if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) 175 if ( QDialog::Accepted == KApplication::execDialog( &imap ) )
176 { 176 {
177 slotFillLists(); 177 slotFillLists();
178 } 178 }
179 } 179 }
180 else if ( account->getType()==MAILLIB::A_POP3 ) 180 else if ( account->getType()==MAILLIB::A_POP3 )
181 { 181 {
182 POP3account *pop3Acc = static_cast<POP3account *>(account); 182 POP3account *pop3Acc = static_cast<POP3account *>(account);
183 POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); 183 POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp );
184 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) 184 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) )
185 { 185 {
186 slotFillLists(); 186 slotFillLists();
187 } 187 }
188 } 188 }
189 else if ( account->getType()==MAILLIB::A_SMTP ) 189 else if ( account->getType()==MAILLIB::A_SMTP )
190 { 190 {
191 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); 191 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account);
192 SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); 192 SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp );
193 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) 193 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) )
194 { 194 {
195 slotFillLists(); 195 slotFillLists();
196 } 196 }
197 } 197 }
198 else if ( account->getType()==MAILLIB::A_NNTP) 198 else if ( account->getType()==MAILLIB::A_NNTP)
199 { 199 {
200 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); 200 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
201 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); 201 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
202 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) 202 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) )
203 { 203 {
204 slotFillLists(); 204 slotFillLists();
205 } 205 }
206 } 206 }
207} 207}
208 208
209void EditAccounts::slotDeleteAccount( Account *account ) 209void EditAccounts::slotDeleteAccount( Account *account )
210{ 210{
211 if ( QMessageBox::information( this, i18n( "Question" ), 211 if ( QMessageBox::information( this, i18n( "Question" ),
212 i18n( "<p>Do you really want to delete the selected Account?</p>" ), 212 i18n( "<p>Do you really want to delete the selected Account?</p>" ),
213 i18n( "Yes" ), i18n( "No" ) ) == 0 ) 213 i18n( "Yes" ), i18n( "No" ) ) == 0 )
214 { 214 {
215 settings->delAccount( account ); 215 settings->delAccount( account );
216 slotFillLists(); 216 slotFillLists();
217 } 217 }
218} 218}
219 219
220void EditAccounts::slotEditMail() 220void EditAccounts::slotEditMail()
221{ 221{
222 if ( !mailList->currentItem() ) 222 if ( !mailList->currentItem() )
223 { 223 {
224 QMessageBox::information( this, i18n( "Error" ), 224 QMessageBox::information( this, i18n( "Error" ),
225 i18n( "<p>Please select an account.</p>" ), 225 i18n( "<p>Please select an account.</p>" ),
226 i18n( "Ok" ) ); 226 i18n( "Ok" ) );
227 return; 227 return;
228 } 228 }
229 229
230 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 230 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
231 slotEditAccount( a ); 231 slotEditAccount( a );
232} 232}
233 233
234void EditAccounts::slotDeleteMail() 234void EditAccounts::slotDeleteMail()
235{ 235{
236 if ( !mailList->currentItem() ) 236 if ( !mailList->currentItem() )
237 { 237 {
238 QMessageBox::information( this, i18n( "Error" ), 238 QMessageBox::information( this, i18n( "Error" ),
239 i18n( "<p>Please select an account.</p>" ), 239 i18n( "<p>Please select an account.</p>" ),
240 i18n( "Ok" ) ); 240 i18n( "Ok" ) );
241 return; 241 return;
242 } 242 }
243 243
244 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 244 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
245 slotDeleteAccount( a ); 245 slotDeleteAccount( a );
246} 246}
247 247
248void EditAccounts::slotNewNews() 248void EditAccounts::slotNewNews()