-rw-r--r-- | kaddressbook/undocmds.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kaddressbook/undocmds.cpp b/kaddressbook/undocmds.cpp index db773be..5fbeec3 100644 --- a/kaddressbook/undocmds.cpp +++ b/kaddressbook/undocmds.cpp @@ -55,133 +55,134 @@ QString PwDeleteCommand::name() { return i18n( "Delete" ); } void PwDeleteCommand::undo() { // Put it back in the document KABC::Addressee::List::Iterator iter; for (iter = mAddresseeList.begin(); iter != mAddresseeList.end(); ++iter) { mDocument->insertAddressee(*iter); } mAddresseeList.clear(); } void PwDeleteCommand::redo() { // Just remove it from the document. This is enough to make the user // Think the item has been deleted KABC::Addressee a; QStringList::Iterator iter; for (iter = mUidList.begin(); iter != mUidList.end(); ++iter) { a = mDocument->findByUid(*iter); mDocument->removeAddressee(a); mAddresseeList.append(a); AddresseeConfig::instance()->remove(a.uid()); } } ///////////////////////////////// // PwPaste Methods PwPasteCommand::PwPasteCommand( KABCore *core, const KABC::Addressee::List &list ) : Command(), mCore( core ), mAddresseeList( list ) { redo(); } QString PwPasteCommand::name() { return i18n( "Paste" ); } void PwPasteCommand::undo() { KABC::Addressee::List::Iterator it; for ( it = mAddresseeList.begin(); it != mAddresseeList.end(); ++it ) mCore->addressBook()->removeAddressee( *it ); } void PwPasteCommand::redo() { QStringList uids; KABC::Addressee::List::Iterator it; for ( it = mAddresseeList.begin(); it != mAddresseeList.end(); ++it ) { /* we have to set a new uid for the contact, otherwise insertAddressee() ignore it. */ (*it).setUid( KApplication::randomString( 10 ) ); uids.append( (*it).uid() ); mCore->addressBook()->insertAddressee( *it ); } - + if ( uids.count() < 4 ) { QStringList::Iterator uidIt; for ( uidIt = uids.begin(); uidIt != uids.end(); ++uidIt ) mCore->editContact( *uidIt ); } +} ///////////////////////////////// // PwNew Methods PwNewCommand::PwNewCommand( KABC::AddressBook *doc, const KABC::Addressee &a ) : Command(), mDocument( doc ), mA( a ) { mDocument->insertAddressee(mA); } PwNewCommand::~PwNewCommand() { } QString PwNewCommand::name() { return i18n( "New Contact" ); } void PwNewCommand::undo() { mDocument->removeAddressee( mA ); } void PwNewCommand::redo() { mDocument->insertAddressee( mA ); } ///////////////////////////////// // PwEdit Methods PwEditCommand::PwEditCommand(KABC::AddressBook *doc, const KABC::Addressee &oldA, const KABC::Addressee &newA ) : Command(), mDocument(doc), mOldA(oldA), mNewA(newA) { redo(); } PwEditCommand::~PwEditCommand() { } QString PwEditCommand::name() { return i18n( "Entry Edit" ); } void PwEditCommand::undo() { mDocument->insertAddressee(mOldA); } void PwEditCommand::redo() { mDocument->insertAddressee(mNewA); } ///////////////////////////////// // PwCut Methods PwCutCommand::PwCutCommand(KABC::AddressBook *doc, const QStringList &uidList) : Command(), mDocument(doc), mAddresseeList(), mUidList(uidList), |