summaryrefslogtreecommitdiff
path: root/noncore/net/mail/editaccounts.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/editaccounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/editaccounts.cpp30
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 @@
/* QT */
#include <qt.h>
#include <qstringlist.h>
#include <libmailwrapper/nntpwrapper.h>
AccountListItem::AccountListItem( QListView *parent, Account *a)
: QListViewItem( parent )
{
account = a;
setText( 0, account->getAccountName() );
- setText( 1, account->getType() );
+ QString ttext = "";
+ switch (account->getType()) {
+ case MAILLIB::A_NNTP:
+ ttext="NNTP";
+ break;
+ case MAILLIB::A_POP3:
+ ttext = "POP3";
+ break;
+ case MAILLIB::A_IMAP:
+ ttext = "IMAP";
+ break;
+ case MAILLIB::A_SMTP:
+ ttext = "SMTP";
+ break;
+ default:
+ ttext = "UNKNOWN";
+ break;
+ }
+ setText( 1, ttext);
}
EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: EditAccountsUI( parent, name, modal, flags )
{
qDebug( "New Account Configuration Widget" );
settings = s;
mailList->addColumn( tr( "Account" ) );
mailList->addColumn( tr( "Type" ) );
newsList->addColumn( tr( "Account" ) );
@@ -40,25 +58,25 @@ EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool
slotFillLists();
}
void EditAccounts::slotFillLists()
{
mailList->clear();
newsList->clear();
QList<Account> accounts = settings->getAccounts();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() )
{
- if ( it->getType().compare( "NNTP" ) == 0 )
+ if ( it->getType()==MAILLIB::A_NNTP )
{
(void) new AccountListItem( newsList, it );
}
else
{
(void) new AccountListItem( mailList, it );
}
}
}
void EditAccounts::slotNewMail()
{
@@ -134,52 +152,52 @@ void EditAccounts::slotNewAccount( const QString &type )
account->save();
slotFillLists();
}
else
{
account->remove();
}
}
}
void EditAccounts::slotEditAccount( Account *account )
{
- if ( account->getType().compare( "IMAP" ) == 0 )
+ if ( account->getType() == MAILLIB::A_IMAP )
{
IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) )
{
slotFillLists();
}
}
- else if ( account->getType().compare( "POP3" ) == 0 )
+ else if ( account->getType()==MAILLIB::A_POP3 )
{
POP3account *pop3Acc = static_cast<POP3account *>(account);
POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) )
{
slotFillLists();
}
}
- else if ( account->getType().compare( "SMTP" ) == 0 )
+ else if ( account->getType()==MAILLIB::A_SMTP )
{
SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account);
SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) )
{
slotFillLists();
}
}
- else if ( account->getType().compare( "NNTP" ) == 0 )
+ else if ( account->getType()==MAILLIB::A_NNTP)
{
NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) )
{
slotFillLists();
}
}
}
void EditAccounts::slotDeleteAccount( Account *account )
{