summaryrefslogtreecommitdiffabout
path: root/kaddressbook/undocmds.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/undocmds.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/undocmds.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/kaddressbook/undocmds.cpp b/kaddressbook/undocmds.cpp
index 5fbeec3..5807dc0 100644
--- a/kaddressbook/undocmds.cpp
+++ b/kaddressbook/undocmds.cpp
@@ -15,49 +15,49 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtextstream.h>
#include <qapplication.h>
#include <qclipboard.h>
#include <klocale.h>
#include <kdebug.h>
#include <kapplication.h>
#include <kabc/addressbook.h>
#include "addresseeutil.h"
#include "addresseeconfig.h"
#include "kabcore.h"
#include "undocmds.h"
-
+extern bool pasteWithNewUid;
/////////////////////////////////
// PwDelete Methods
PwDeleteCommand::PwDeleteCommand(KABC::AddressBook *doc,
const QStringList &uidList)
: Command(), mDocument(doc), mAddresseeList(), mUidList(uidList)
{
redo();
}
PwDeleteCommand::~PwDeleteCommand()
{
}
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)
@@ -91,48 +91,49 @@ PwPasteCommand::PwPasteCommand( KABCore *core, const KABC::Addressee::List &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.
*/
+ if ( pasteWithNewUid )
(*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()
{
}