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