author | zautrix <zautrix> | 2004-07-06 20:10:47 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-06 20:10:47 (UTC) |
commit | 3db5c4e190d1031f2471516f8a52114f06d1a3eb (patch) (unidiff) | |
tree | dbccf9780829b25c01a2a65439409591b8da422e /kaddressbook | |
parent | 9c1abdb6194f9539b26d9f3045bde5cd91960dd0 (diff) | |
download | kdepimpi-3db5c4e190d1031f2471516f8a52114f06d1a3eb.zip kdepimpi-3db5c4e190d1031f2471516f8a52114f06d1a3eb.tar.gz kdepimpi-3db5c4e190d1031f2471516f8a52114f06d1a3eb.tar.bz2 |
Fixed the qdialog::accept problem
-rw-r--r-- | kaddressbook/addresseeeditordialog.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp index 6bc4129..d8c1aca 100644 --- a/kaddressbook/addresseeeditordialog.cpp +++ b/kaddressbook/addresseeeditordialog.cpp | |||
@@ -1,121 +1,122 @@ | |||
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 | 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 | ||
36 | AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, | 36 | AddresseeEditorDialog::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 | ||
59 | AddresseeEditorDialog::~AddresseeEditorDialog() | 59 | AddresseeEditorDialog::~AddresseeEditorDialog() |
60 | { | 60 | { |
61 | qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()"); | 61 | qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()"); |
62 | //emit editorDestroyed( mEditorWidget->addressee().uid() ); | 62 | //emit editorDestroyed( mEditorWidget->addressee().uid() ); |
63 | } | 63 | } |
64 | 64 | ||
65 | void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) | 65 | void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) |
66 | { | 66 | { |
67 | enableButton( KDialogBase::Apply, false ); | 67 | enableButton( KDialogBase::Apply, false ); |
68 | 68 | ||
69 | mEditorWidget->setAddressee( addr ); | 69 | mEditorWidget->setAddressee( addr ); |
70 | } | 70 | } |
71 | 71 | ||
72 | KABC::Addressee AddresseeEditorDialog::addressee() | 72 | KABC::Addressee AddresseeEditorDialog::addressee() |
73 | { | 73 | { |
74 | return mEditorWidget->addressee(); | 74 | return mEditorWidget->addressee(); |
75 | } | 75 | } |
76 | 76 | ||
77 | bool AddresseeEditorDialog::dirty() | 77 | bool AddresseeEditorDialog::dirty() |
78 | { | 78 | { |
79 | return mEditorWidget->dirty(); | 79 | return mEditorWidget->dirty(); |
80 | } | 80 | } |
81 | 81 | ||
82 | void AddresseeEditorDialog::slotApply() | 82 | void AddresseeEditorDialog::slotApply() |
83 | { | 83 | { |
84 | if ( mEditorWidget->dirty() ) { | 84 | if ( mEditorWidget->dirty() ) { |
85 | mEditorWidget->save(); | 85 | mEditorWidget->save(); |
86 | emit contactModified( mEditorWidget->addressee() ); | 86 | emit contactModified( mEditorWidget->addressee() ); |
87 | } | 87 | } |
88 | 88 | ||
89 | enableButton( KDialogBase::Apply, false ); | 89 | enableButton( KDialogBase::Apply, false ); |
90 | 90 | ||
91 | KDialogBase::slotApply(); | 91 | KDialogBase::slotApply(); |
92 | } | 92 | } |
93 | 93 | ||
94 | void AddresseeEditorDialog:: accept () | 94 | void AddresseeEditorDialog:: accept () |
95 | { | 95 | { |
96 | slotOk(); | 96 | slotOk(); |
97 | 97 | ||
98 | } | 98 | } |
99 | void AddresseeEditorDialog::slotOk() | 99 | void AddresseeEditorDialog::slotOk() |
100 | { | 100 | { |
101 | slotApply(); | 101 | slotApply(); |
102 | 102 | ||
103 | KDialogBase::slotOk(); | 103 | //KDialogBase::slotOk(); |
104 | 104 | emit okClicked(); | |
105 | QDialog::accept(); | ||
105 | } | 106 | } |
106 | 107 | ||
107 | void AddresseeEditorDialog::widgetModified() | 108 | void AddresseeEditorDialog::widgetModified() |
108 | { | 109 | { |
109 | enableButton( KDialogBase::Apply, true ); | 110 | enableButton( KDialogBase::Apply, true ); |
110 | } | 111 | } |
111 | 112 | ||
112 | void AddresseeEditorDialog::slotCancel() | 113 | void AddresseeEditorDialog::slotCancel() |
113 | { | 114 | { |
114 | KDialogBase::slotCancel(); | 115 | KDialogBase::slotCancel(); |
115 | 116 | ||
116 | 117 | ||
117 | } | 118 | } |
118 | 119 | ||
119 | #ifndef KAB_EMBEDDED | 120 | #ifndef KAB_EMBEDDED |
120 | #include "addresseeeditordialog.moc" | 121 | #include "addresseeeditordialog.moc" |
121 | #endif //KAB_EMBEDDED | 122 | #endif //KAB_EMBEDDED |