summaryrefslogtreecommitdiffabout
path: root/kaddressbook/undocmds.cpp
Unidiff
Diffstat (limited to 'kaddressbook/undocmds.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/undocmds.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/kaddressbook/undocmds.cpp b/kaddressbook/undocmds.cpp
index 5fbeec3..5807dc0 100644
--- a/kaddressbook/undocmds.cpp
+++ b/kaddressbook/undocmds.cpp
@@ -27,25 +27,25 @@
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 39extern bool pasteWithNewUid;
40///////////////////////////////// 40/////////////////////////////////
41// PwDelete Methods 41// PwDelete Methods
42 42
43PwDeleteCommand::PwDeleteCommand(KABC::AddressBook *doc, 43PwDeleteCommand::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
50PwDeleteCommand::~PwDeleteCommand() 50PwDeleteCommand::~PwDeleteCommand()
51{ 51{
@@ -103,25 +103,26 @@ void PwPasteCommand::undo()
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
107void PwPasteCommand::redo() 107void 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 if ( pasteWithNewUid )
116 (*it).setUid( KApplication::randomString( 10 ) );
116 uids.append( (*it).uid() ); 117 uids.append( (*it).uid() );
117 mCore->addressBook()->insertAddressee( *it ); 118 mCore->addressBook()->insertAddressee( *it );
118 } 119 }
119 if ( uids.count() < 4 ) { 120 if ( uids.count() < 4 ) {
120 QStringList::Iterator uidIt; 121 QStringList::Iterator uidIt;
121 for ( uidIt = uids.begin(); uidIt != uids.end(); ++uidIt ) 122 for ( uidIt = uids.begin(); uidIt != uids.end(); ++uidIt )
122 mCore->editContact( *uidIt ); 123 mCore->editContact( *uidIt );
123 } 124 }
124} 125}
125 126
126///////////////////////////////// 127/////////////////////////////////
127// PwNew Methods 128// PwNew Methods