You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tellico/src/commands/collectioncommand.h

64 lines
1.7 KiB

/***************************************************************************
copyright : (C) 2005-2006 by Robby Stephenson
email : robby@periapsis.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of version 2 of the GNU General Public License as *
* published by the Free Software Foundation; *
* *
***************************************************************************/
#ifndef TELLICO_COLLECTIONCOMMAND_H
#define TELLICO_COLLECTIONCOMMAND_H
#include "../datavectors.h"
#include <kcommand.h>
#include <kurl.h>
namespace Tellico {
namespace Command {
/**
* @author Robby Stephenson
*/
class CollectionCommand : public KCommand {
public:
enum Mode {
Append,
Merge,
Replace
};
CollectionCommand(Mode mode, Data::CollPtr currentColl, Data::CollPtr newColl);
~CollectionCommand();
virtual void execute();
virtual void unexecute();
virtual TQString name() const;
private:
void copyFields();
Mode m_mode;
Data::CollPtr m_origColl;
Data::CollPtr m_newColl;
KURL m_origURL;
Data::FieldVec m_origFields;
Data::MergePair m_mergePair;
// for the Replace case, the collection that got replaced needs to be cleared
enum CleanupMode {
DoNothing, ClearOriginal, ClearNew
};
CleanupMode m_cleanup;
};
} // end namespace
}
#endif