RIP dear dialog based on setGeometry() and fixed sizes.


			
			
				wilder-work
			
			
		
Espen Sand 26 years ago
parent 03bc09ce5a
commit d45eb9aa24
  1. 103
      kmacctseldlg.cpp
  2. 57
      kmacctseldlg.h

@ -1,68 +1,71 @@
// kmacctseldlg.cpp
/*
* kmail: KDE mail client
* This file: Copyright (C) 2000 Espen Sand, <espen@kde.org>
* Contains code segments and ideas from earlier kmail dialog code
* by Stefan Taferner <taferner@alpin.or.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <qpushbutton.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <kapp.h>
#include <qlayout.h>
#include <qradiobutton.h>
#include "kmacctseldlg.h"
#include "kmglobal.h"
#include <klocale.h>
//-----------------------------------------------------------------------------
KMAcctSelDlg::KMAcctSelDlg(QWidget* parent, const char* name):
KMAcctSelDlgInherited(parent, name, TRUE)
{
QPushButton *cancel;
QRadioButton *rbtn;
initMetaObject();
setFixedSize(230,180);
setCaption(name);
mSelBtn = 0;
#include "kmacctseldlg.h"
#include "kmacctseldlg.moc"
grp = new QButtonGroup(i18n("Account Type"), this);
grp->resize(230, 140);
connect(grp, SIGNAL(clicked(int)), SLOT(buttonClicked(int)));
KMAcctSelDlg::KMAcctSelDlg( QWidget *parent, const char *name, bool modal )
: KDialogBase( parent, name, modal, i18n("Add Account"), Ok|Cancel, Ok )
{
QFrame *page = makeMainWidget();
QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
QButtonGroup *group = new QButtonGroup( i18n("Account Type"), page );
connect(group, SIGNAL(clicked(int)), SLOT(buttonClicked(int)) );
ok = new QPushButton(i18n("OK"), this);
ok->adjustSize();
ok->setMinimumSize(ok->sizeHint());
ok->resize(100, ok->size().height());
ok->move(10, 175-ok->size().height());
ok->setEnabled(FALSE);
connect(ok, SIGNAL(clicked()), SLOT(accept()));
topLayout->addWidget( group, 10 );
QVBoxLayout *vlay = new QVBoxLayout( group, spacingHint()*2, spacingHint() );
vlay->addSpacing( fontMetrics().lineSpacing() );
QRadioButton *radioButton1 = new QRadioButton(i18n("Local Mailbox"), group );
vlay->addWidget( radioButton1 );
QRadioButton *radioButton2 = new QRadioButton(i18n("Pop3"), group );
vlay->addWidget( radioButton2 );
QRadioButton *radioButton3 =
new QRadioButton(i18n("Experimental Pop3"), group );
vlay->addWidget( radioButton3 );
cancel = new QPushButton(i18n("Cancel"), this);
cancel->adjustSize();
cancel->setMinimumSize(cancel->sizeHint());
cancel->resize(100, cancel->size().height());
cancel->move(120, 175-cancel->size().height());
connect(cancel, SIGNAL(clicked()), SLOT(reject()));
vlay->addStretch( 10 );
rbtn = new QRadioButton(i18n("Local Mailbox"), grp);
rbtn->adjustSize();
rbtn->move(30,30);
radioButton2->setChecked(true); // Pop is most common ?
buttonClicked(1);
}
rbtn = new QRadioButton(i18n("Pop3"), grp);
rbtn->adjustSize();
rbtn->move(30,60);
rbtn = new QRadioButton(i18n("Experimental Pop3"), grp);
rbtn->adjustSize();
rbtn->move(30,90);
void KMAcctSelDlg::buttonClicked( int id )
{
mSelectedButton = id;
}
//-----------------------------------------------------------------------------
void KMAcctSelDlg::buttonClicked(int id)
{
mSelBtn = id;
ok->setEnabled(TRUE);
int KMAcctSelDlg::selected( void ) const
{
return mSelectedButton;
}
//-----------------------------------------------------------------------------
#include "kmacctseldlg.moc"

@ -1,34 +1,51 @@
/* Select account from given list of account types
* Author: Stefan Taferner <taferner@alpin.or.at>
/*
* kmail: KDE mail client
* This file: Copyright (C) 2000 Espen Sand, <espen@kde.org>
* Contains code segments and ideas from earlier kmail dialog code
* by Stefan Taferner <taferner@alpin.or.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef kmacctseldlg_h
#define kmacctseldlg_h
#include <qdialog.h>
// Select account from given list of account types
class QButtonGroup;
class QPushButton;
#ifndef kmacctseldlg_h
#define kmacctseldlg_h
#define KMAcctSelDlgInherited QDialog
#include <kdialogbase.h>
class KMAcctSelDlg: public QDialog
class KMAcctSelDlg: public KDialogBase
{
Q_OBJECT
public:
KMAcctSelDlg(QWidget* parent=0, const char* name=0);
public:
KMAcctSelDlg( QWidget *parent=0, const char *name=0, bool modal=true );
/** Returns selected button from the account selection group:
0=local mail, 1=pop3, 2=experimental pop3. */
int selected(void) const { return mSelBtn; }
/**
* Returns selected button from the account selection group:
* 0=local mail, 1=pop3, 2=experimental pop3.
*/
int selected(void) const;
protected slots:
void buttonClicked(int);
private slots:
void buttonClicked(int);
protected:
QButtonGroup* grp;
QPushButton* ok;
int mSelBtn;
private:
int mSelectedButton;
};
#endif /*kmacctseldlg_h*/

Loading…
Cancel
Save