Backport r950340 | aacid | 2009-04-06 23:21:18 +0200 (Mon, 06 Apr 2009) | 4 lines
[kdepim.git] / kmail / kmacctseldlg.cpp
blobc9e685659e5d65ee92130d4b0b5734bad93cedc7
1 /*
2 * kmail: KDE mail client
3 * Copyright (C) 2000 Espen Sand, <espen@kde.org>
4 * Contains code segments and ideas from earlier kmail dialog code
5 * by Stefan Taferner <taferner@kde.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "kmacctseldlg.h"
25 #include <QGroupBox>
26 #include <QButtonGroup>
27 #include <QLayout>
28 #include <QRadioButton>
29 #include <QVBoxLayout>
31 #include <klocale.h>
33 KMAcctSelDlg::KMAcctSelDlg( QWidget *parent )
34 : KDialog( parent )
36 setCaption( i18n("Add Account") );
37 setButtons( Ok|Cancel );
38 QWidget *page = new QWidget( this );
39 setMainWidget( page );
40 QVBoxLayout *topLayout = new QVBoxLayout( page );
41 topLayout->setSpacing( spacingHint() );
42 topLayout->setMargin( 0 );
44 QGroupBox *group = new QGroupBox(i18n("Account Type"));
45 topLayout->addWidget( group, 10 );
47 QVBoxLayout *vlay = new QVBoxLayout( group );
48 vlay->setSpacing( spacingHint() );
49 vlay->setMargin( spacingHint()*2 );
51 mAccountTypeGroup = new QButtonGroup;
52 addButton( KAccount::Local, vlay );
53 addButton( KAccount::Pop, vlay )->setChecked(true); // Pop is most common ?
54 addButton( KAccount::Imap, vlay );
55 addButton( KAccount::DImap, vlay );
56 addButton( KAccount::Maildir, vlay );
59 QRadioButton* KMAcctSelDlg::addButton( const KAccount::Type type,
60 QLayout *layout )
62 QRadioButton *radioButton =
63 new QRadioButton( KAccount::displayNameForType (type ) );
64 mAccountTypeGroup->addButton( radioButton, type );
65 layout->addWidget( radioButton );
66 return radioButton;
69 KAccount::Type KMAcctSelDlg::selected( void ) const
71 return static_cast<KAccount::Type>( mAccountTypeGroup->checkedId() );
74 #include "kmacctseldlg.moc"