summaryrefslogtreecommitdiffabout
path: root/kaddressbook/addviewdialog.cpp
Unidiff
Diffstat (limited to 'kaddressbook/addviewdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/addviewdialog.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/kaddressbook/addviewdialog.cpp b/kaddressbook/addviewdialog.cpp
index 6def26b..b52a83c 100644
--- a/kaddressbook/addviewdialog.cpp
+++ b/kaddressbook/addviewdialog.cpp
@@ -1,118 +1,120 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KAB_EMBEDDED 24#ifndef KAB_EMBEDDED
25#endif //KAB_EMBEDDED 25#endif //KAB_EMBEDDED
26 26
27#include <qradiobutton.h> 27#include <qradiobutton.h>
28#include <qbuttongroup.h> 28#include <q3buttongroup.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qlayout.h> 31#include <qlayout.h>
32//Added by qt3to4:
33#include <Q3GridLayout>
32 34
33#include <klocale.h> 35#include <klocale.h>
34#include <kglobal.h> 36#include <kglobal.h>
35#include "kaddressbookview.h" 37#include "kaddressbookview.h"
36#include "addviewdialog.h" 38#include "addviewdialog.h"
37 39
38AddViewDialog::AddViewDialog( QDict<ViewFactory> *viewFactoryDict, 40AddViewDialog::AddViewDialog( Q3Dict<ViewFactory> *viewFactoryDict,
39 QWidget *parent, const char *name ) 41 QWidget *parent, const char *name )
40 : KDialogBase( KDialogBase::Plain, i18n( "Add View" ), 42 : KDialogBase( KDialogBase::Plain, i18n( "Add View" ),
41 KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, 43 KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
42 parent, name ), 44 parent, name ),
43 mViewFactoryDict( viewFactoryDict ) 45 mViewFactoryDict( viewFactoryDict )
44{ 46{
45//US setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 300)); 47//US setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 300));
46 48
47 mTypeId = 0; 49 mTypeId = 0;
48 50
49 QWidget *page = plainPage(); 51 QWidget *page = plainPage();
50 52
51 QGridLayout *layout = new QGridLayout( page, 2, 2 ); 53 Q3GridLayout *layout = new Q3GridLayout( page, 2, 2 );
52 layout->setSpacing( spacingHint() ); 54 layout->setSpacing( spacingHint() );
53 layout->setRowStretch( 1, 1 ); 55 layout->setRowStretch( 1, 1 );
54 layout->setColStretch( 1, 1 ); 56 layout->setColStretch( 1, 1 );
55 57
56 QLabel *label = new QLabel( i18n( "View name:" ), page ); 58 QLabel *label = new QLabel( i18n( "View name:" ), page );
57 layout->addWidget( label, 0, 0 ); 59 layout->addWidget( label, 0, 0 );
58 60
59 mViewNameEdit = new QLineEdit( page ); 61 mViewNameEdit = new QLineEdit( page );
60 connect( mViewNameEdit, SIGNAL( textChanged( const QString& ) ), 62 connect( mViewNameEdit, SIGNAL( textChanged( const QString& ) ),
61 SLOT( textChanged( const QString& ) ) ); 63 SLOT( textChanged( const QString& ) ) );
62 layout->addWidget( mViewNameEdit, 0, 1 ); 64 layout->addWidget( mViewNameEdit, 0, 1 );
63 65
64 mTypeGroup = new QButtonGroup( 2, Qt::Horizontal, i18n( "View Type" ), page ); 66 mTypeGroup = new Q3ButtonGroup( 2, Qt::Horizontal, i18n( "View Type" ), page );
65 connect( mTypeGroup, SIGNAL( clicked( int ) ), this, SLOT( clicked( int ) ) ); 67 connect( mTypeGroup, SIGNAL( clicked( int ) ), this, SLOT( clicked( int ) ) );
66 layout->addMultiCellWidget( mTypeGroup, 1, 1, 0, 1 ); 68 layout->addMultiCellWidget( mTypeGroup, 1, 1, 0, 1 );
67 69
68 // Now create the radio buttons. This needs some layout work. 70 // Now create the radio buttons. This needs some layout work.
69 QDictIterator<ViewFactory> iter( *mViewFactoryDict ); 71 Q3DictIterator<ViewFactory> iter( *mViewFactoryDict );
70 for ( iter.toFirst(); iter.current(); ++iter ) { 72 for ( iter.toFirst(); iter.current(); ++iter ) {
71//US i am not quit sure, why I can nopt use (*iter)-> here 73//US i am not quit sure, why I can nopt use (*iter)-> here
72//US new QRadioButton( (*iter)->type(), mTypeGroup ); 74//US new QRadioButton( (*iter)->type(), mTypeGroup );
73//US label = new QLabel( (*iter)->description(), mTypeGroup ); 75//US label = new QLabel( (*iter)->description(), mTypeGroup );
74#ifdef DESKTOP_VERSION 76#ifdef DESKTOP_VERSION
75 new QRadioButton( (*iter)->type(), mTypeGroup ); 77 new QRadioButton( (*iter)->type(), mTypeGroup );
76 label = new QLabel( (*iter)->description(), mTypeGroup ); 78 label = new QLabel( (*iter)->description(), mTypeGroup );
77#else 79#else
78 new QRadioButton( (*iter).type(), mTypeGroup ); 80 new QRadioButton( (*iter).type(), mTypeGroup );
79 label = new QLabel( (*iter).description(), mTypeGroup ); 81 label = new QLabel( (*iter).description(), mTypeGroup );
80 82
81#endif 83#endif
82 label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); 84 label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
83 } 85 }
84 86
85 mTypeGroup->setButton( 0 ); 87 mTypeGroup->setButton( 0 );
86 mViewNameEdit->setFocus(); 88 mViewNameEdit->setFocus();
87 enableButton( KDialogBase::Ok, false ); 89 enableButton( KDialogBase::Ok, false );
88 90
89 91
90} 92}
91 93
92AddViewDialog::~AddViewDialog() 94AddViewDialog::~AddViewDialog()
93{ 95{
94} 96}
95 97
96QString AddViewDialog::viewName()const 98QString AddViewDialog::viewName()const
97{ 99{
98 return mViewNameEdit->text(); 100 return mViewNameEdit->text();
99} 101}
100 102
101QString AddViewDialog::viewType()const 103QString AddViewDialog::viewType()const
102{ 104{
103 return mTypeGroup->find( mTypeId )->text(); 105 return mTypeGroup->find( mTypeId )->text();
104} 106}
105 107
106void AddViewDialog::clicked( int id ) 108void AddViewDialog::clicked( int id )
107{ 109{
108 mTypeId = id; 110 mTypeId = id;
109} 111}
110 112
111void AddViewDialog::textChanged( const QString &text ) 113void AddViewDialog::textChanged( const QString &text )
112{ 114{
113 enableButton( KDialogBase::Ok, !text.isEmpty() ); 115 enableButton( KDialogBase::Ok, !text.isEmpty() );
114} 116}
115 117
116#ifndef KAB_EMBEDDED 118#ifndef KAB_EMBEDDED_
117#include "addviewdialog.moc" 119#include "moc_addviewdialog.cpp"
118#endif //KAB_EMBEDDED 120#endif //KAB_EMBEDDED