summaryrefslogtreecommitdiffabout
path: root/kmicromail/editaccounts.cpp
Unidiff
Diffstat (limited to 'kmicromail/editaccounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index 733e38a..7ad4ec8 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -8,24 +8,25 @@
8/* QT */ 8/* QT */
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 21
21#include <libmailwrapper/nntpwrapper.h> 22#include <libmailwrapper/nntpwrapper.h>
22 23
23using namespace Opie::Core; 24using namespace Opie::Core;
24 25
25AccountListItem::AccountListItem( QListView *parent, Account *a) 26AccountListItem::AccountListItem( QListView *parent, Account *a)
26 : QListViewItem( parent ) 27 : QListViewItem( parent )
27{ 28{
28 account = a; 29 account = a;
29 setText( 0, account->getAccountName() ); 30 setText( 0, account->getAccountName() );
30 QString ttext = ""; 31 QString ttext = "";
31 switch (account->getType()) { 32 switch (account->getType()) {
@@ -44,28 +45,28 @@ AccountListItem::AccountListItem( QListView *parent, Account *a)
44 default: 45 default:
45 ttext = "UNKNOWN"; 46 ttext = "UNKNOWN";
46 break; 47 break;
47 } 48 }
48 setText( 1, ttext); 49 setText( 1, ttext);
49} 50}
50 51
51EditAccounts::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 )
52 : EditAccountsUI( parent, name, modal, flags ) 53 : EditAccountsUI( parent, name, modal, flags )
53{ 54{
54 settings = s; 55 settings = s;
55 56
56 mailList->addColumn( tr( "Account" ) ); 57 mailList->addColumn( i18n( "Account" ) );
57 mailList->addColumn( tr( "Type" ) ); 58 mailList->addColumn( i18n( "Type" ) );
58 59
59 newsList->addColumn( tr( "Account" ) ); 60 newsList->addColumn( i18n( "Account" ) );
60 61
61 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 62 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
62 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 63 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
63 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 64 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
64 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); 65 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
65 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); 66 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
66 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); 67 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
67 68
68 slotFillLists(); 69 slotFillLists();
69} 70}
70 71
71void EditAccounts::slotFillLists() 72void EditAccounts::slotFillLists()
@@ -198,87 +199,87 @@ void EditAccounts::slotEditAccount( Account *account )
198 { 199 {
199 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); 200 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
200 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); 201 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
201 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) 202 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) )
202 { 203 {
203 slotFillLists(); 204 slotFillLists();
204 } 205 }
205 } 206 }
206} 207}
207 208
208void EditAccounts::slotDeleteAccount( Account *account ) 209void EditAccounts::slotDeleteAccount( Account *account )
209{ 210{
210 if ( QMessageBox::information( this, tr( "Question" ), 211 if ( QMessageBox::information( this, i18n( "Question" ),
211 tr( "<p>Do you really want to delete the selected Account?</p>" ), 212 i18n( "<p>Do you really want to delete the selected Account?</p>" ),
212 tr( "Yes" ), tr( "No" ) ) == 0 ) 213 i18n( "Yes" ), i18n( "No" ) ) == 0 )
213 { 214 {
214 settings->delAccount( account ); 215 settings->delAccount( account );
215 slotFillLists(); 216 slotFillLists();
216 } 217 }
217} 218}
218 219
219void EditAccounts::slotEditMail() 220void EditAccounts::slotEditMail()
220{ 221{
221 if ( !mailList->currentItem() ) 222 if ( !mailList->currentItem() )
222 { 223 {
223 QMessageBox::information( this, tr( "Error" ), 224 QMessageBox::information( this, i18n( "Error" ),
224 tr( "<p>Please select an account.</p>" ), 225 i18n( "<p>Please select an account.</p>" ),
225 tr( "Ok" ) ); 226 i18n( "Ok" ) );
226 return; 227 return;
227 } 228 }
228 229
229 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 230 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
230 slotEditAccount( a ); 231 slotEditAccount( a );
231} 232}
232 233
233void EditAccounts::slotDeleteMail() 234void EditAccounts::slotDeleteMail()
234{ 235{
235 if ( !mailList->currentItem() ) 236 if ( !mailList->currentItem() )
236 { 237 {
237 QMessageBox::information( this, tr( "Error" ), 238 QMessageBox::information( this, i18n( "Error" ),
238 tr( "<p>Please select an account.</p>" ), 239 i18n( "<p>Please select an account.</p>" ),
239 tr( "Ok" ) ); 240 i18n( "Ok" ) );
240 return; 241 return;
241 } 242 }
242 243
243 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 244 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
244 slotDeleteAccount( a ); 245 slotDeleteAccount( a );
245} 246}
246 247
247void EditAccounts::slotNewNews() 248void EditAccounts::slotNewNews()
248{ 249{
249 slotNewAccount( "NNTP" ); 250 slotNewAccount( "NNTP" );
250} 251}
251 252
252void EditAccounts::slotEditNews() 253void EditAccounts::slotEditNews()
253{ 254{
254 if ( !newsList->currentItem() ) 255 if ( !newsList->currentItem() )
255 { 256 {
256 QMessageBox::information( this, tr( "Error" ), 257 QMessageBox::information( this, i18n( "Error" ),
257 tr( "<p>Please select an account.</p>" ), 258 i18n( "<p>Please select an account.</p>" ),
258 tr( "Ok" ) ); 259 i18n( "Ok" ) );
259 return; 260 return;
260 } 261 }
261 262
262 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 263 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
263 slotEditAccount( a ); 264 slotEditAccount( a );
264} 265}
265 266
266void EditAccounts::slotDeleteNews() 267void EditAccounts::slotDeleteNews()
267{ 268{
268 if ( !newsList->currentItem() ) 269 if ( !newsList->currentItem() )
269 { 270 {
270 QMessageBox::information( this, tr( "Error" ), 271 QMessageBox::information( this, i18n( "Error" ),
271 tr( "<p>Please select an account.</p>" ), 272 i18n( "<p>Please select an account.</p>" ),
272 tr( "Ok" ) ); 273 i18n( "Ok" ) );
273 return; 274 return;
274 } 275 }
275 276
276 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 277 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
277 slotDeleteAccount( a ); 278 slotDeleteAccount( a );
278} 279}
279 280
280void EditAccounts::slotAdjustColumns() 281void EditAccounts::slotAdjustColumns()
281{ 282{
282 int currPage = configTab->currentPageIndex(); 283 int currPage = configTab->currentPageIndex();
283 284
284 configTab->showPage( mailTab ); 285 configTab->showPage( mailTab );
@@ -546,52 +547,52 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name,
546} 547}
547 548
548void NNTPconfig::slotShowSub() 549void NNTPconfig::slotShowSub()
549{ 550{
550 save(); 551 save();
551 data->save(); 552 data->save();
552 ListViewGroups->clear(); 553 ListViewGroups->clear();
553 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 554 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
554 QCheckListItem *item; 555 QCheckListItem *item;
555 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 556 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
556 item->setOn( true ); 557 item->setOn( true );
557 } 558 }
558 topLevelWidget()->setCaption( tr("%1 groups subscribed").arg( subscribedGroups.count())); 559 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count()));
559} 560}
560void NNTPconfig::slotShowFilter() 561void NNTPconfig::slotShowFilter()
561{ 562{
562 save(); 563 save();
563 data->save(); 564 data->save();
564 ListViewGroups->clear(); 565 ListViewGroups->clear();
565 int count = 0; 566 int count = 0;
566 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 567 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
567 QCheckListItem *item; 568 QCheckListItem *item;
568 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { 569 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) {
569 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 570 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
570 ++count; 571 ++count;
571 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 572 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
572 item->setOn( true ); 573 item->setOn( true );
573 } 574 }
574 } 575 }
575 } 576 }
576 topLevelWidget()->setCaption( tr("Filter found %1 groups").arg( count)); 577 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count));
577} 578}
578void NNTPconfig::slotGetNG() { 579void NNTPconfig::slotGetNG() {
579 save(); 580 save();
580 data->save(); 581 data->save();
581 topLevelWidget()->setCaption( tr("Fetching group list...")); 582 topLevelWidget()->setCaption( i18n("Fetching group list..."));
582 qApp->processEvents(); 583 qApp->processEvents();
583 NNTPwrapper* tmp = new NNTPwrapper( data ); 584 NNTPwrapper* tmp = new NNTPwrapper( data );
584 allGroups = tmp->listAllNewsgroups(); 585 allGroups = tmp->listAllNewsgroups();
585 topLevelWidget()->setCaption( tr("Downloaded %1 group names").arg( allGroups.count())); 586 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count()));
586 587
587 ListViewGroups->clear(); 588 ListViewGroups->clear();
588 589
589 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 590 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
590 QCheckListItem *item; 591 QCheckListItem *item;
591 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 592 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
592 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 593 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
593 item->setOn( true ); 594 item->setOn( true );
594 595
595 } 596 }
596 } 597 }
597 delete tmp; 598 delete tmp;