summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditordialog.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp
index 5e42640..a84fc61 100644
--- a/kaddressbook/addresseeeditordialog.cpp
+++ b/kaddressbook/addresseeeditordialog.cpp
@@ -5,117 +5,119 @@
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#include <qlayout.h> 24#include <qlayout.h>
25#include <qapplication.h> 25#include <qapplication.h>
26 26
27#include <kdebug.h> 27#include <kdebug.h>
28#include <klocale.h> 28#include <klocale.h>
29#include <kglobal.h> 29#include <kglobal.h>
30 30
31#include "addresseeeditorwidget.h" 31#include "addresseeeditorwidget.h"
32#include "kabcore.h" 32#include "kabcore.h"
33 33
34#include "addresseeeditordialog.h" 34#include "addresseeeditordialog.h"
35 35
36AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, 36AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
37 const char *name ) 37 const char *name )
38 : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ), 38 : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ),
39 KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, 39 KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply,
40 KDialogBase::Ok, parent, name, true ) 40 KDialogBase::Ok, parent, name, true )
41{ 41{
42 42
43 43
44 QWidget *page = plainPage(); 44 QWidget *page = plainPage();
45 45
46 QVBoxLayout *layout = new QVBoxLayout( page ); 46 QVBoxLayout *layout = new QVBoxLayout( page );
47 47
48 mEditorWidget = new AddresseeEditorWidget( core, false, page ); 48 mEditorWidget = new AddresseeEditorWidget( core, false, page );
49 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), 49 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ),
50 SLOT( widgetModified() ) ); 50 SLOT( widgetModified() ) );
51 layout->addWidget( mEditorWidget ); 51 layout->addWidget( mEditorWidget );
52 52
53 enableButton( KDialogBase::Apply, false ); 53 enableButton( KDialogBase::Apply, false );
54 if ( QApplication::desktop()->width() < 480 ) { 54 if ( QApplication::desktop()->width() < 480 ) {
55 hideButtons(); 55 hideButtons();
56 } 56 }
57} 57}
58 58
59AddresseeEditorDialog::~AddresseeEditorDialog() 59AddresseeEditorDialog::~AddresseeEditorDialog()
60{ 60{
61 //emit editorDestroyed( mEditorWidget->addressee().uid() ); 61 //emit editorDestroyed( mEditorWidget->addressee().uid() );
62} 62}
63 63
64void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) 64void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr )
65{ 65{
66 enableButton( KDialogBase::Apply, false ); 66 enableButton( KDialogBase::Apply, false );
67 67
68 mEditorWidget->setAddressee( addr ); 68 mEditorWidget->setAddressee( addr );
69
70 this->setCaption("Edit " + addr.formattedName());
69} 71}
70 72
71KABC::Addressee AddresseeEditorDialog::addressee() 73KABC::Addressee AddresseeEditorDialog::addressee()
72{ 74{
73 return mEditorWidget->addressee(); 75 return mEditorWidget->addressee();
74} 76}
75 77
76bool AddresseeEditorDialog::dirty() 78bool AddresseeEditorDialog::dirty()
77{ 79{
78 return mEditorWidget->dirty(); 80 return mEditorWidget->dirty();
79} 81}
80 82
81void AddresseeEditorDialog::slotApply() 83void AddresseeEditorDialog::slotApply()
82{ 84{
83 if ( mEditorWidget->dirty() ) { 85 if ( mEditorWidget->dirty() ) {
84 mEditorWidget->save(); 86 mEditorWidget->save();
85 emit contactModified( mEditorWidget->addressee() ); 87 emit contactModified( mEditorWidget->addressee() );
86 } 88 }
87 89
88 enableButton( KDialogBase::Apply, false ); 90 enableButton( KDialogBase::Apply, false );
89 91
90 KDialogBase::slotApply(); 92 KDialogBase::slotApply();
91} 93}
92 94
93void AddresseeEditorDialog:: accept () 95void AddresseeEditorDialog:: accept ()
94{ 96{
95 slotOk(); 97 slotOk();
96 98
97} 99}
98void AddresseeEditorDialog::slotOk() 100void AddresseeEditorDialog::slotOk()
99{ 101{
100 slotApply(); 102 slotApply();
101 103
102 //KDialogBase::slotOk(); 104 //KDialogBase::slotOk();
103 emit okClicked(); 105 emit okClicked();
104 QDialog::accept(); 106 QDialog::accept();
105} 107}
106 108
107void AddresseeEditorDialog::widgetModified() 109void AddresseeEditorDialog::widgetModified()
108{ 110{
109 enableButton( KDialogBase::Apply, true ); 111 enableButton( KDialogBase::Apply, true );
110} 112}
111 113
112void AddresseeEditorDialog::slotCancel() 114void AddresseeEditorDialog::slotCancel()
113{ 115{
114 KDialogBase::slotCancel(); 116 KDialogBase::slotCancel();
115 117
116 118
117} 119}
118 120
119#ifndef KAB_EMBEDDED 121#ifndef KAB_EMBEDDED
120#include "addresseeeditordialog.moc" 122#include "addresseeeditordialog.moc"
121#endif //KAB_EMBEDDED 123#endif //KAB_EMBEDDED