summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/distributionlistdialog.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/kabc/distributionlistdialog.cpp b/kabc/distributionlistdialog.cpp
index 31d5944..d2e1144 100644
--- a/kabc/distributionlistdialog.cpp
+++ b/kabc/distributionlistdialog.cpp
@@ -1,170 +1,168 @@
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 <qlabel.h> 23#include <qlabel.h>
24#include <qpushbutton.h> 24#include <qpushbutton.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <klineeditdlg.h> 26#include <klineeditdlg.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qradiobutton.h> 28#include <qradiobutton.h>
29 29
30#include <klocale.h> 30#include <klocale.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kmessagebox.h> 32#include <kmessagebox.h>
33 33
34#include "addressbook.h" 34#include "addressbook.h"
35#include "addresseedialog.h" 35#include "addresseedialog.h"
36#include "distributionlist.h" 36#include "distributionlist.h"
37 37
38#include "distributionlistdialog.h" 38#include "distributionlistdialog.h"
39 39
40#ifndef KAB_EMBEDDED 40//US #include "distributionlistdialog.moc"
41#include "distributionlistdialog.moc"
42#endif //KAB_EMBEDDED
43 41
44using namespace KABC; 42using namespace KABC;
45 43
46DistributionListDialog::DistributionListDialog( AddressBook *addressBook, QWidget *parent) 44DistributionListDialog::DistributionListDialog( AddressBook *addressBook, QWidget *parent)
47 : KDialogBase( parent, "", true, i18n("Configure Distribution Lists"), Ok, Ok, true) 45 : KDialogBase( parent, "", true, i18n("Configure Distribution Lists"), Ok, Ok, true)
48{ 46{
49 mEditor = new DistributionListEditorWidget( addressBook, this ); 47 mEditor = new DistributionListEditorWidget( addressBook, this );
50 setMainWidget( mEditor ); 48 setMainWidget( mEditor );
51 49
52 connect( this, SIGNAL( okClicked() ), mEditor, SLOT( save() ) ); 50 connect( this, SIGNAL( okClicked() ), mEditor, SLOT( save() ) );
53} 51}
54 52
55DistributionListDialog::~DistributionListDialog() 53DistributionListDialog::~DistributionListDialog()
56{ 54{
57} 55}
58 56
59 57
60EmailSelector::EmailSelector( const QStringList &emails, const QString &current, 58EmailSelector::EmailSelector( const QStringList &emails, const QString &current,
61 QWidget *parent ) : 59 QWidget *parent ) :
62 KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, 60 KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok,
63 parent ) 61 parent )
64{ 62{
65 QFrame *topFrame = plainPage(); 63 QFrame *topFrame = plainPage();
66 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 64 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
67 65
68 mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"), 66 mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"),
69 topFrame ); 67 topFrame );
70 topLayout->addWidget( mButtonGroup ); 68 topLayout->addWidget( mButtonGroup );
71 69
72 QStringList::ConstIterator it; 70 QStringList::ConstIterator it;
73 for( it = emails.begin(); it != emails.end(); ++it ) { 71 for( it = emails.begin(); it != emails.end(); ++it ) {
74 QRadioButton *button = new QRadioButton( *it, mButtonGroup ); 72 QRadioButton *button = new QRadioButton( *it, mButtonGroup );
75 if ( (*it) == current ) { 73 if ( (*it) == current ) {
76 button->setDown( true ); 74 button->setDown( true );
77 } 75 }
78 } 76 }
79} 77}
80 78
81QString EmailSelector::selected() 79QString EmailSelector::selected()
82{ 80{
83 QButton *button = mButtonGroup->selected(); 81 QButton *button = mButtonGroup->selected();
84 if ( button ) return button->text(); 82 if ( button ) return button->text();
85 return QString::null; 83 return QString::null;
86} 84}
87 85
88QString EmailSelector::getEmail( const QStringList &emails, const QString &current, 86QString EmailSelector::getEmail( const QStringList &emails, const QString &current,
89 QWidget *parent ) 87 QWidget *parent )
90{ 88{
91 EmailSelector *dlg = new EmailSelector( emails, current, parent ); 89 EmailSelector *dlg = new EmailSelector( emails, current, parent );
92 dlg->exec(); 90 dlg->exec();
93 91
94 QString result = dlg->selected(); 92 QString result = dlg->selected();
95 93
96 delete dlg; 94 delete dlg;
97 95
98 return result; 96 return result;
99} 97}
100 98
101class EntryItem : public QListViewItem 99class EntryItem : public QListViewItem
102{ 100{
103 public: 101 public:
104 EntryItem( QListView *parent, const Addressee &addressee, 102 EntryItem( QListView *parent, const Addressee &addressee,
105 const QString &email=QString::null ) : 103 const QString &email=QString::null ) :
106 QListViewItem( parent ), 104 QListViewItem( parent ),
107 mAddressee( addressee ), 105 mAddressee( addressee ),
108 mEmail( email ) 106 mEmail( email )
109 { 107 {
110 setText( 0, addressee.realName() ); 108 setText( 0, addressee.realName() );
111 if( email.isEmpty() ) { 109 if( email.isEmpty() ) {
112 setText( 1, addressee.preferredEmail() ); 110 setText( 1, addressee.preferredEmail() );
113 setText( 2, i18n("Yes") ); 111 setText( 2, i18n("Yes") );
114 } else { 112 } else {
115 setText( 1, email ); 113 setText( 1, email );
116 setText( 2, i18n("No") ); 114 setText( 2, i18n("No") );
117 } 115 }
118 } 116 }
119 117
120 Addressee addressee() const 118 Addressee addressee() const
121 { 119 {
122 return mAddressee; 120 return mAddressee;
123 } 121 }
124 122
125 QString email() const 123 QString email() const
126 { 124 {
127 return mEmail; 125 return mEmail;
128 } 126 }
129 127
130 private: 128 private:
131 Addressee mAddressee; 129 Addressee mAddressee;
132 QString mEmail; 130 QString mEmail;
133}; 131};
134 132
135DistributionListEditorWidget::DistributionListEditorWidget( AddressBook *addressBook, QWidget *parent) : 133DistributionListEditorWidget::DistributionListEditorWidget( AddressBook *addressBook, QWidget *parent) :
136 QWidget( parent ), 134 QWidget( parent ),
137 mAddressBook( addressBook ) 135 mAddressBook( addressBook )
138{ 136{
139 kdDebug(5700) << "DistributionListEditor()" << endl; 137 kdDebug(5700) << "DistributionListEditor()" << endl;
140 138
141 QBoxLayout *topLayout = new QVBoxLayout( this ); 139 QBoxLayout *topLayout = new QVBoxLayout( this );
142 topLayout->setSpacing( KDialog::spacingHint() ); 140 topLayout->setSpacing( KDialog::spacingHint() );
143 141
144 QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ; 142 QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ;
145 143
146 mNameCombo = new QComboBox( this ); 144 mNameCombo = new QComboBox( this );
147 nameLayout->addWidget( mNameCombo ); 145 nameLayout->addWidget( mNameCombo );
148 connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) ); 146 connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) );
149 147
150 mNewButton = new QPushButton( i18n("New List..."), this ); 148 mNewButton = new QPushButton( i18n("New List..."), this );
151 nameLayout->addWidget( mNewButton ); 149 nameLayout->addWidget( mNewButton );
152 connect( mNewButton, SIGNAL( clicked() ), SLOT( newList() ) ); 150 connect( mNewButton, SIGNAL( clicked() ), SLOT( newList() ) );
153 151
154 mEditButton = new QPushButton( i18n("Rename List..."), this ); 152 mEditButton = new QPushButton( i18n("Rename List..."), this );
155 nameLayout->addWidget( mEditButton ); 153 nameLayout->addWidget( mEditButton );
156 connect( mEditButton, SIGNAL( clicked() ), SLOT( editList() ) ); 154 connect( mEditButton, SIGNAL( clicked() ), SLOT( editList() ) );
157 155
158 mRemoveButton = new QPushButton( i18n("Remove List"), this ); 156 mRemoveButton = new QPushButton( i18n("Remove List"), this );
159 nameLayout->addWidget( mRemoveButton ); 157 nameLayout->addWidget( mRemoveButton );
160 connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeList() ) ); 158 connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeList() ) );
161 159
162 QGridLayout *gridLayout = new QGridLayout( topLayout, 3, 3 ); 160 QGridLayout *gridLayout = new QGridLayout( topLayout, 3, 3 );
163 gridLayout->setColStretch(1, 1); 161 gridLayout->setColStretch(1, 1);
164 162
165 QLabel *listLabel = new QLabel( i18n("Available addresses:"), this ); 163 QLabel *listLabel = new QLabel( i18n("Available addresses:"), this );
166 gridLayout->addWidget( listLabel, 0, 0 ); 164 gridLayout->addWidget( listLabel, 0, 0 );
167 165
168 mListLabel = new QLabel( this ); 166 mListLabel = new QLabel( this );
169 gridLayout->addMultiCellWidget( mListLabel, 0, 0, 1, 2 ); 167 gridLayout->addMultiCellWidget( mListLabel, 0, 0, 1, 2 );
170 168