-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 @@ -29,65 +29,65 @@ #include <kglobal.h> #include "addresseeeditorwidget.h" #include "kabcore.h" #include "addresseeeditordialog.h" AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, const char *name ) : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ), KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, KDialogBase::Ok, parent, name, true ) { QWidget *page = plainPage(); QVBoxLayout *layout = new QVBoxLayout( page ); mEditorWidget = new AddresseeEditorWidget( core, false, page ); connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), SLOT( widgetModified() ) ); layout->addWidget( mEditorWidget ); enableButton( KDialogBase::Apply, false ); if ( QApplication::desktop()->width() < 480 ) { hideButtons(); } } AddresseeEditorDialog::~AddresseeEditorDialog() { - qDebug("----------------------------------------------- "); + qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()"); //emit editorDestroyed( mEditorWidget->addressee().uid() ); } void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) { enableButton( KDialogBase::Apply, false ); mEditorWidget->setAddressee( addr ); } KABC::Addressee AddresseeEditorDialog::addressee() { return mEditorWidget->addressee(); } bool AddresseeEditorDialog::dirty() { return mEditorWidget->dirty(); } void AddresseeEditorDialog::slotApply() { if ( mEditorWidget->dirty() ) { mEditorWidget->save(); emit contactModified( mEditorWidget->addressee() ); } enableButton( KDialogBase::Apply, false ); KDialogBase::slotApply(); } diff --git a/kaddressbook/undocmds.cpp b/kaddressbook/undocmds.cpp index db773be..5fbeec3 100644 --- a/kaddressbook/undocmds.cpp +++ b/kaddressbook/undocmds.cpp @@ -87,68 +87,69 @@ void PwDeleteCommand::redo() // 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 |