author | zautrix <zautrix> | 2004-07-05 14:16:54 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-05 14:16:54 (UTC) |
commit | 9a90061115ee2cac8adc5b2d21e607b6c5c9b890 (patch) (unidiff) | |
tree | 87efb03b00559f3a7fbb5c693d6d7b734f0d1eb7 /kaddressbook | |
parent | af75333f69c6b7284a7fbe7ab63c08e10ae4541b (diff) | |
download | kdepimpi-9a90061115ee2cac8adc5b2d21e607b6c5c9b890.zip kdepimpi-9a90061115ee2cac8adc5b2d21e607b6c5c9b890.tar.gz kdepimpi-9a90061115ee2cac8adc5b2d21e607b6c5c9b890.tar.bz2 |
Improved pasting of many items
-rw-r--r-- | kaddressbook/addresseeeditordialog.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/undocmds.cpp | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp index 790f148..6bc4129 100644 --- a/kaddressbook/addresseeeditordialog.cpp +++ b/kaddressbook/addresseeeditordialog.cpp | |||
@@ -1,121 +1,121 @@ | |||
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("----------------------------------------------- "); | 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 | ||
105 | } | 105 | } |
106 | 106 | ||
107 | void AddresseeEditorDialog::widgetModified() | 107 | void AddresseeEditorDialog::widgetModified() |
108 | { | 108 | { |
109 | enableButton( KDialogBase::Apply, true ); | 109 | enableButton( KDialogBase::Apply, true ); |
110 | } | 110 | } |
111 | 111 | ||
112 | void AddresseeEditorDialog::slotCancel() | 112 | void AddresseeEditorDialog::slotCancel() |
113 | { | 113 | { |
114 | KDialogBase::slotCancel(); | 114 | KDialogBase::slotCancel(); |
115 | 115 | ||
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | #ifndef KAB_EMBEDDED | 119 | #ifndef KAB_EMBEDDED |
120 | #include "addresseeeditordialog.moc" | 120 | #include "addresseeeditordialog.moc" |
121 | #endif //KAB_EMBEDDED | 121 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/undocmds.cpp b/kaddressbook/undocmds.cpp index db773be..5fbeec3 100644 --- a/kaddressbook/undocmds.cpp +++ b/kaddressbook/undocmds.cpp | |||
@@ -1,240 +1,241 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (C) 1999 Don Sanders <sanders@kde.org> | 3 | Copyright (C) 1999 Don Sanders <sanders@kde.org> |
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 <qtextstream.h> | 24 | #include <qtextstream.h> |
25 | 25 | ||
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #include <qclipboard.h> | 27 | #include <qclipboard.h> |
28 | 28 | ||
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kapplication.h> | 31 | #include <kapplication.h> |
32 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
33 | 33 | ||
34 | #include "addresseeutil.h" | 34 | #include "addresseeutil.h" |
35 | #include "addresseeconfig.h" | 35 | #include "addresseeconfig.h" |
36 | #include "kabcore.h" | 36 | #include "kabcore.h" |
37 | 37 | ||
38 | #include "undocmds.h" | 38 | #include "undocmds.h" |
39 | 39 | ||
40 | ///////////////////////////////// | 40 | ///////////////////////////////// |
41 | // PwDelete Methods | 41 | // PwDelete Methods |
42 | 42 | ||
43 | PwDeleteCommand::PwDeleteCommand(KABC::AddressBook *doc, | 43 | PwDeleteCommand::PwDeleteCommand(KABC::AddressBook *doc, |
44 | const QStringList &uidList) | 44 | const QStringList &uidList) |
45 | : Command(), mDocument(doc), mAddresseeList(), mUidList(uidList) | 45 | : Command(), mDocument(doc), mAddresseeList(), mUidList(uidList) |
46 | { | 46 | { |
47 | redo(); | 47 | redo(); |
48 | } | 48 | } |
49 | 49 | ||
50 | PwDeleteCommand::~PwDeleteCommand() | 50 | PwDeleteCommand::~PwDeleteCommand() |
51 | { | 51 | { |
52 | } | 52 | } |
53 | 53 | ||
54 | QString PwDeleteCommand::name() | 54 | QString PwDeleteCommand::name() |
55 | { | 55 | { |
56 | return i18n( "Delete" ); | 56 | return i18n( "Delete" ); |
57 | } | 57 | } |
58 | 58 | ||
59 | void PwDeleteCommand::undo() | 59 | void PwDeleteCommand::undo() |
60 | { | 60 | { |
61 | // Put it back in the document | 61 | // Put it back in the document |
62 | KABC::Addressee::List::Iterator iter; | 62 | KABC::Addressee::List::Iterator iter; |
63 | for (iter = mAddresseeList.begin(); iter != mAddresseeList.end(); ++iter) | 63 | for (iter = mAddresseeList.begin(); iter != mAddresseeList.end(); ++iter) |
64 | { | 64 | { |
65 | mDocument->insertAddressee(*iter); | 65 | mDocument->insertAddressee(*iter); |
66 | } | 66 | } |
67 | 67 | ||
68 | mAddresseeList.clear(); | 68 | mAddresseeList.clear(); |
69 | } | 69 | } |
70 | 70 | ||
71 | void PwDeleteCommand::redo() | 71 | void PwDeleteCommand::redo() |
72 | { | 72 | { |
73 | // Just remove it from the document. This is enough to make the user | 73 | // Just remove it from the document. This is enough to make the user |
74 | // Think the item has been deleted | 74 | // Think the item has been deleted |
75 | KABC::Addressee a; | 75 | KABC::Addressee a; |
76 | QStringList::Iterator iter; | 76 | QStringList::Iterator iter; |
77 | for (iter = mUidList.begin(); iter != mUidList.end(); ++iter) | 77 | for (iter = mUidList.begin(); iter != mUidList.end(); ++iter) |
78 | { | 78 | { |
79 | a = mDocument->findByUid(*iter); | 79 | a = mDocument->findByUid(*iter); |
80 | mDocument->removeAddressee(a); | 80 | mDocument->removeAddressee(a); |
81 | mAddresseeList.append(a); | 81 | mAddresseeList.append(a); |
82 | AddresseeConfig::instance()->remove(a.uid()); | 82 | AddresseeConfig::instance()->remove(a.uid()); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | ///////////////////////////////// | 86 | ///////////////////////////////// |
87 | // PwPaste Methods | 87 | // PwPaste Methods |
88 | 88 | ||
89 | PwPasteCommand::PwPasteCommand( KABCore *core, const KABC::Addressee::List &list ) | 89 | PwPasteCommand::PwPasteCommand( KABCore *core, const KABC::Addressee::List &list ) |
90 | : Command(), mCore( core ), mAddresseeList( list ) | 90 | : Command(), mCore( core ), mAddresseeList( list ) |
91 | { | 91 | { |
92 | redo(); | 92 | redo(); |
93 | } | 93 | } |
94 | 94 | ||
95 | QString PwPasteCommand::name() | 95 | QString PwPasteCommand::name() |
96 | { | 96 | { |
97 | return i18n( "Paste" ); | 97 | return i18n( "Paste" ); |
98 | } | 98 | } |
99 | 99 | ||
100 | void PwPasteCommand::undo() | 100 | void PwPasteCommand::undo() |
101 | { | 101 | { |
102 | KABC::Addressee::List::Iterator it; | 102 | KABC::Addressee::List::Iterator it; |
103 | for ( it = mAddresseeList.begin(); it != mAddresseeList.end(); ++it ) | 103 | for ( it = mAddresseeList.begin(); it != mAddresseeList.end(); ++it ) |
104 | mCore->addressBook()->removeAddressee( *it ); | 104 | mCore->addressBook()->removeAddressee( *it ); |
105 | } | 105 | } |
106 | 106 | ||
107 | void PwPasteCommand::redo() | 107 | void PwPasteCommand::redo() |
108 | { | 108 | { |
109 | QStringList uids; | 109 | QStringList uids; |
110 | KABC::Addressee::List::Iterator it; | 110 | KABC::Addressee::List::Iterator it; |
111 | for ( it = mAddresseeList.begin(); it != mAddresseeList.end(); ++it ) { | 111 | for ( it = mAddresseeList.begin(); it != mAddresseeList.end(); ++it ) { |
112 | /* we have to set a new uid for the contact, otherwise insertAddressee() | 112 | /* we have to set a new uid for the contact, otherwise insertAddressee() |
113 | ignore it. | 113 | ignore it. |
114 | */ | 114 | */ |
115 | (*it).setUid( KApplication::randomString( 10 ) ); | 115 | (*it).setUid( KApplication::randomString( 10 ) ); |
116 | uids.append( (*it).uid() ); | 116 | uids.append( (*it).uid() ); |
117 | mCore->addressBook()->insertAddressee( *it ); | 117 | mCore->addressBook()->insertAddressee( *it ); |
118 | } | 118 | } |
119 | 119 | if ( uids.count() < 4 ) { | |
120 | QStringList::Iterator uidIt; | 120 | QStringList::Iterator uidIt; |
121 | for ( uidIt = uids.begin(); uidIt != uids.end(); ++uidIt ) | 121 | for ( uidIt = uids.begin(); uidIt != uids.end(); ++uidIt ) |
122 | mCore->editContact( *uidIt ); | 122 | mCore->editContact( *uidIt ); |
123 | } | ||
123 | } | 124 | } |
124 | 125 | ||
125 | ///////////////////////////////// | 126 | ///////////////////////////////// |
126 | // PwNew Methods | 127 | // PwNew Methods |
127 | 128 | ||
128 | PwNewCommand::PwNewCommand( KABC::AddressBook *doc, const KABC::Addressee &a ) | 129 | PwNewCommand::PwNewCommand( KABC::AddressBook *doc, const KABC::Addressee &a ) |
129 | : Command(), mDocument( doc ), mA( a ) | 130 | : Command(), mDocument( doc ), mA( a ) |
130 | { | 131 | { |
131 | mDocument->insertAddressee(mA); | 132 | mDocument->insertAddressee(mA); |
132 | } | 133 | } |
133 | 134 | ||
134 | PwNewCommand::~PwNewCommand() | 135 | PwNewCommand::~PwNewCommand() |
135 | { | 136 | { |
136 | } | 137 | } |
137 | 138 | ||
138 | QString PwNewCommand::name() | 139 | QString PwNewCommand::name() |
139 | { | 140 | { |
140 | return i18n( "New Contact" ); | 141 | return i18n( "New Contact" ); |
141 | } | 142 | } |
142 | 143 | ||
143 | void PwNewCommand::undo() | 144 | void PwNewCommand::undo() |
144 | { | 145 | { |
145 | mDocument->removeAddressee( mA ); | 146 | mDocument->removeAddressee( mA ); |
146 | } | 147 | } |
147 | 148 | ||
148 | void PwNewCommand::redo() | 149 | void PwNewCommand::redo() |
149 | { | 150 | { |
150 | mDocument->insertAddressee( mA ); | 151 | mDocument->insertAddressee( mA ); |
151 | } | 152 | } |
152 | 153 | ||
153 | ///////////////////////////////// | 154 | ///////////////////////////////// |
154 | // PwEdit Methods | 155 | // PwEdit Methods |
155 | 156 | ||
156 | PwEditCommand::PwEditCommand(KABC::AddressBook *doc, | 157 | PwEditCommand::PwEditCommand(KABC::AddressBook *doc, |
157 | const KABC::Addressee &oldA, | 158 | const KABC::Addressee &oldA, |
158 | const KABC::Addressee &newA ) | 159 | const KABC::Addressee &newA ) |
159 | : Command(), mDocument(doc), mOldA(oldA), mNewA(newA) | 160 | : Command(), mDocument(doc), mOldA(oldA), mNewA(newA) |
160 | { | 161 | { |
161 | redo(); | 162 | redo(); |
162 | } | 163 | } |
163 | 164 | ||
164 | PwEditCommand::~PwEditCommand() | 165 | PwEditCommand::~PwEditCommand() |
165 | { | 166 | { |
166 | } | 167 | } |
167 | 168 | ||
168 | QString PwEditCommand::name() | 169 | QString PwEditCommand::name() |
169 | { | 170 | { |
170 | return i18n( "Entry Edit" ); | 171 | return i18n( "Entry Edit" ); |
171 | } | 172 | } |
172 | 173 | ||
173 | void PwEditCommand::undo() | 174 | void PwEditCommand::undo() |
174 | { | 175 | { |
175 | mDocument->insertAddressee(mOldA); | 176 | mDocument->insertAddressee(mOldA); |
176 | } | 177 | } |
177 | 178 | ||
178 | void PwEditCommand::redo() | 179 | void PwEditCommand::redo() |
179 | { | 180 | { |
180 | mDocument->insertAddressee(mNewA); | 181 | mDocument->insertAddressee(mNewA); |
181 | } | 182 | } |
182 | 183 | ||
183 | ///////////////////////////////// | 184 | ///////////////////////////////// |
184 | // PwCut Methods | 185 | // PwCut Methods |
185 | 186 | ||
186 | PwCutCommand::PwCutCommand(KABC::AddressBook *doc, const QStringList &uidList) | 187 | PwCutCommand::PwCutCommand(KABC::AddressBook *doc, const QStringList &uidList) |
187 | : Command(), mDocument(doc), mAddresseeList(), mUidList(uidList), | 188 | : Command(), mDocument(doc), mAddresseeList(), mUidList(uidList), |
188 | mClipText(), mOldText() | 189 | mClipText(), mOldText() |
189 | { | 190 | { |
190 | redo(); | 191 | redo(); |
191 | } | 192 | } |
192 | 193 | ||
193 | QString PwCutCommand::name() | 194 | QString PwCutCommand::name() |
194 | { | 195 | { |
195 | return i18n( "Cut" ); | 196 | return i18n( "Cut" ); |
196 | } | 197 | } |
197 | 198 | ||
198 | void PwCutCommand::undo() | 199 | void PwCutCommand::undo() |
199 | { | 200 | { |
200 | KABC::Addressee::List::Iterator iter; | 201 | KABC::Addressee::List::Iterator iter; |
201 | for (iter = mAddresseeList.begin(); iter != mAddresseeList.end(); ++iter) | 202 | for (iter = mAddresseeList.begin(); iter != mAddresseeList.end(); ++iter) |
202 | { | 203 | { |
203 | mDocument->insertAddressee(*iter); | 204 | mDocument->insertAddressee(*iter); |
204 | } | 205 | } |
205 | mAddresseeList.clear(); | 206 | mAddresseeList.clear(); |
206 | 207 | ||
207 | QClipboard *cb = QApplication::clipboard(); | 208 | QClipboard *cb = QApplication::clipboard(); |
208 | //US | 209 | //US |
209 | #ifndef KAB_EMBEDDED | 210 | #ifndef KAB_EMBEDDED |
210 | kapp->processEvents(); | 211 | kapp->processEvents(); |
211 | #else //KAB_EMBEDDED | 212 | #else //KAB_EMBEDDED |
212 | qApp->processEvents(); | 213 | qApp->processEvents(); |
213 | #endif //KAB_EMBEDDED | 214 | #endif //KAB_EMBEDDED |
214 | cb->setText( mOldText ); | 215 | cb->setText( mOldText ); |
215 | } | 216 | } |
216 | 217 | ||
217 | void PwCutCommand::redo() | 218 | void PwCutCommand::redo() |
218 | { | 219 | { |
219 | KABC::Addressee a; | 220 | KABC::Addressee a; |
220 | QStringList::Iterator iter; | 221 | QStringList::Iterator iter; |
221 | for (iter = mUidList.begin(); iter != mUidList.end(); ++iter) | 222 | for (iter = mUidList.begin(); iter != mUidList.end(); ++iter) |
222 | { | 223 | { |
223 | a = mDocument->findByUid(*iter); | 224 | a = mDocument->findByUid(*iter); |
224 | mDocument->removeAddressee(a); | 225 | mDocument->removeAddressee(a); |
225 | mAddresseeList.append(a); | 226 | mAddresseeList.append(a); |
226 | } | 227 | } |
227 | 228 | ||
228 | // Convert to clipboard | 229 | // Convert to clipboard |
229 | mClipText = AddresseeUtil::addresseesToClipboard(mAddresseeList); | 230 | mClipText = AddresseeUtil::addresseesToClipboard(mAddresseeList); |
230 | 231 | ||
231 | QClipboard *cb = QApplication::clipboard(); | 232 | QClipboard *cb = QApplication::clipboard(); |
232 | mOldText = cb->text(); | 233 | mOldText = cb->text(); |
233 | //US | 234 | //US |
234 | #ifndef KAB_EMBEDDED | 235 | #ifndef KAB_EMBEDDED |
235 | kapp->processEvents(); | 236 | kapp->processEvents(); |
236 | #else //KAB_EMBEDDED | 237 | #else //KAB_EMBEDDED |
237 | qApp->processEvents(); | 238 | qApp->processEvents(); |
238 | #endif //KAB_EMBEDDED | 239 | #endif //KAB_EMBEDDED |
239 | cb->setText( mClipText ); | 240 | cb->setText( mClipText ); |
240 | } | 241 | } |