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"
26 #include <QButtonGroup>
28 #include <QRadioButton>
29 #include <QVBoxLayout>
33 KMAcctSelDlg::KMAcctSelDlg( QWidget
*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
,
62 QRadioButton
*radioButton
=
63 new QRadioButton( KAccount::displayNameForType (type
) );
64 mAccountTypeGroup
->addButton( radioButton
, type
);
65 layout
->addWidget( radioButton
);
69 KAccount::Type
KMAcctSelDlg::selected( void ) const
71 return static_cast<KAccount::Type
>( mAccountTypeGroup
->checkedId() );
74 #include "kmacctseldlg.moc"