summaryrefslogtreecommitdiffabout
path: root/kaddressbook/undocmds.cpp
Side-by-side diff
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
@@ -71,100 +71,101 @@ void PwDeleteCommand::undo()
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 );
}
-
- QStringList::Iterator uidIt;
- for ( uidIt = uids.begin(); uidIt != uids.end(); ++uidIt )
- mCore->editContact( *uidIt );
+ 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" );