summaryrefslogtreecommitdiffabout
path: root/kabc/distributionlisteditor.cpp
Unidiff
Diffstat (limited to 'kabc/distributionlisteditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/distributionlisteditor.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/kabc/distributionlisteditor.cpp b/kabc/distributionlisteditor.cpp
index bad1efc..9f5840b 100644
--- a/kabc/distributionlisteditor.cpp
+++ b/kabc/distributionlisteditor.cpp
@@ -1,121 +1,125 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library 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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <qlistview.h> 21#include <qlistview.h>
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25#ifdef DESKTOP_VERSION
25#include <qinputdialog.h> 26#include <qinputdialog.h>
27#else
28#include <qtcompat/qinputdialog.h>
29#endif
26#include <qbuttongroup.h> 30#include <qbuttongroup.h>
27#include <qradiobutton.h> 31#include <qradiobutton.h>
28 32
29#include <klocale.h> 33#include <klocale.h>
30#include <kdebug.h> 34#include <kdebug.h>
31 35
32#include "addressbook.h" 36#include "addressbook.h"
33#include "addresseedialog.h" 37#include "addresseedialog.h"
34#include "distributionlist.h" 38#include "distributionlist.h"
35 39
36#include "distributionlisteditor.h" 40#include "distributionlisteditor.h"
37 41
38//US #include "distributionlisteditor.moc" 42//US #include "distributionlisteditor.moc"
39 43
40using namespace KABC; 44using namespace KABC;
41 45
42EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString &current, 46EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString &current,
43 QWidget *parent ) : 47 QWidget *parent ) :
44 KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, 48 KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok,
45 parent ) 49 parent )
46{ 50{
47 QFrame *topFrame = plainPage(); 51 QFrame *topFrame = plainPage();
48 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 52 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
49 53
50 mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"), 54 mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"),
51 topFrame ); 55 topFrame );
52 topLayout->addWidget( mButtonGroup ); 56 topLayout->addWidget( mButtonGroup );
53 57
54 QStringList::ConstIterator it; 58 QStringList::ConstIterator it;
55 for( it = emails.begin(); it != emails.end(); ++it ) { 59 for( it = emails.begin(); it != emails.end(); ++it ) {
56 QRadioButton *button = new QRadioButton( *it, mButtonGroup ); 60 QRadioButton *button = new QRadioButton( *it, mButtonGroup );
57 if ( (*it) == current ) { 61 if ( (*it) == current ) {
58 button->setDown( true ); 62 button->setDown( true );
59 } 63 }
60 } 64 }
61} 65}
62 66
63QString EmailSelectDialog::selected() 67QString EmailSelectDialog::selected()
64{ 68{
65 QButton *button = mButtonGroup->selected(); 69 QButton *button = mButtonGroup->selected();
66 if ( button ) return button->text(); 70 if ( button ) return button->text();
67 return QString::null; 71 return QString::null;
68} 72}
69 73
70QString EmailSelectDialog::getEmail( const QStringList &emails, const QString &current, 74QString EmailSelectDialog::getEmail( const QStringList &emails, const QString &current,
71 QWidget *parent ) 75 QWidget *parent )
72{ 76{
73 77
74 EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent ); 78 EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent );
75 dlg->exec(); 79 dlg->exec();
76 80
77 QString result = dlg->selected(); 81 QString result = dlg->selected();
78 82
79 delete dlg; 83 delete dlg;
80 84
81 return result; 85 return result;
82} 86}
83 87
84class EditEntryItem : public QListViewItem 88class EditEntryItem : public QListViewItem
85{ 89{
86 public: 90 public:
87 EditEntryItem( QListView *parent, const Addressee &addressee, 91 EditEntryItem( QListView *parent, const Addressee &addressee,
88 const QString &email=QString::null ) : 92 const QString &email=QString::null ) :
89 QListViewItem( parent ), 93 QListViewItem( parent ),
90 mAddressee( addressee ), 94 mAddressee( addressee ),
91 mEmail( email ) 95 mEmail( email )
92 { 96 {
93 setText( 0, addressee.realName() ); 97 setText( 0, addressee.realName() );
94 if( email.isEmpty() ) { 98 if( email.isEmpty() ) {
95 setText( 1, addressee.preferredEmail() ); 99 setText( 1, addressee.preferredEmail() );
96 setText( 2, i18n("Yes") ); 100 setText( 2, i18n("Yes") );
97 } else { 101 } else {
98 setText( 1, email ); 102 setText( 1, email );
99 setText( 2, i18n("No") ); 103 setText( 2, i18n("No") );
100 } 104 }
101 } 105 }
102 106
103 Addressee addressee() const 107 Addressee addressee() const
104 { 108 {
105 return mAddressee; 109 return mAddressee;
106 } 110 }
107 111
108 QString email() const 112 QString email() const
109 { 113 {
110 return mEmail; 114 return mEmail;
111 } 115 }
112 116
113 private: 117 private:
114 Addressee mAddressee; 118 Addressee mAddressee;
115 QString mEmail; 119 QString mEmail;
116}; 120};
117 121
118DistributionListEditor::DistributionListEditor( AddressBook *addressBook, QWidget *parent) : 122DistributionListEditor::DistributionListEditor( AddressBook *addressBook, QWidget *parent) :
119 QWidget( parent ), 123 QWidget( parent ),
120 mAddressBook( addressBook ) 124 mAddressBook( addressBook )
121{ 125{