summaryrefslogtreecommitdiffabout
path: root/kaddressbook/undocmds.cpp
Unidiff
Diffstat (limited to 'kaddressbook/undocmds.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/undocmds.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/kaddressbook/undocmds.cpp b/kaddressbook/undocmds.cpp
index db773be..5fbeec3 100644
--- a/kaddressbook/undocmds.cpp
+++ b/kaddressbook/undocmds.cpp
@@ -95,52 +95,53 @@ PwPasteCommand::PwPasteCommand( KABCore *core, const KABC::Addressee::List &list
95QString PwPasteCommand::name() 95QString PwPasteCommand::name()
96{ 96{
97 return i18n( "Paste" ); 97 return i18n( "Paste" );
98} 98}
99 99
100void PwPasteCommand::undo() 100void 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
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 (*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
128PwNewCommand::PwNewCommand( KABC::AddressBook *doc, const KABC::Addressee &a ) 129PwNewCommand::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
134PwNewCommand::~PwNewCommand() 135PwNewCommand::~PwNewCommand()
135{ 136{
136} 137}
137 138
138QString PwNewCommand::name() 139QString PwNewCommand::name()
139{ 140{
140 return i18n( "New Contact" ); 141 return i18n( "New Contact" );
141} 142}
142 143
143void PwNewCommand::undo() 144void PwNewCommand::undo()
144{ 145{
145 mDocument->removeAddressee( mA ); 146 mDocument->removeAddressee( mA );
146} 147}