kmail

kmacctseldlg.cpp

Go to the documentation of this file.
00001 /*
00002  *   kmail: KDE mail client
00003  *   This file: Copyright (C) 2000 Espen Sand, <espen@kde.org>
00004  *   Contains code segments and ideas from earlier kmail dialog code
00005  *   by Stefan Taferner <taferner@kde.org>
00006  *
00007  *   This program is free software; you can redistribute it and/or modify
00008  *   it under the terms of the GNU General Public License as published by
00009  *   the Free Software Foundation; either version 2 of the License, or
00010  *   (at your option) any later version.
00011  *
00012  *   This program is distributed in the hope that it will be useful,
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *   GNU General Public License for more details.
00016  *
00017  *   You should have received a copy of the GNU General Public License
00018  *   along with this program; if not, write to the Free Software
00019  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include <qbuttongroup.h>
00028 #include <qlayout.h>
00029 #include <qradiobutton.h>
00030 
00031 #include <klocale.h>
00032 
00033 #include "kmacctseldlg.moc"
00034 
00035 KMAcctSelDlg::KMAcctSelDlg( QWidget *parent, const char *name, bool modal )
00036   : KDialogBase( parent, name, modal, i18n("Add Account"), Ok|Cancel, Ok )
00037 {
00038   QFrame *page = makeMainWidget();
00039   QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
00040 
00041   QButtonGroup *group = new QButtonGroup( i18n("Account Type"), page );
00042   connect(group, SIGNAL(clicked(int)), SLOT(buttonClicked(int)) );
00043 
00044   topLayout->addWidget( group, 10 );
00045   QVBoxLayout *vlay = new QVBoxLayout( group, spacingHint()*2, spacingHint() );
00046   vlay->addSpacing( fontMetrics().lineSpacing() );
00047 
00048   QRadioButton *radioButton1 = new QRadioButton( i18n("&Local mailbox"), group );
00049   vlay->addWidget( radioButton1 );
00050   QRadioButton *radioButton2 = new QRadioButton( i18n("&POP3"), group );
00051   vlay->addWidget( radioButton2 );
00052   QRadioButton *radioButton3 = new QRadioButton( i18n("&IMAP"), group );
00053   vlay->addWidget( radioButton3 );
00054   QRadioButton *radioButton4 = new QRadioButton( i18n("&Disconnected IMAP"), group );
00055   vlay->addWidget( radioButton4 );
00056   QRadioButton *radioButton5 = new QRadioButton( i18n("&Maildir mailbox"), group );
00057   vlay->addWidget( radioButton5 );
00058 
00059   vlay->addStretch( 10 );
00060 
00061   radioButton2->setChecked(true); // Pop is most common ?
00062   buttonClicked(1);
00063 }
00064 
00065 
00066 void KMAcctSelDlg::buttonClicked( int id )
00067 {
00068   mSelectedButton = id;
00069 }
00070 
00071 
00072 int KMAcctSelDlg::selected( void ) const
00073 {
00074   return mSelectedButton;
00075 }
00076 
00077