kaddressbook

undocmds.h

00001 /*
00002     This file is part of KAddressBook.
00003     Copyright (C) 1999 Don Sanders <sanders@kde.org>
00004                   2005 Tobias Koenig <tokoe@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 
00025 #ifndef COMMANDS_H
00026 #define COMMANDS_H
00027 
00028 // Commands for undo/redo functionality.
00029 
00030 #include <qstring.h>
00031 #include <qstringlist.h>
00032 
00033 #include <kabc/addressbook.h>
00034 #include <kabc/addressee.h>
00035 #include <kcommand.h>
00036 
00037 #include "kablock.h"
00038 
00039 namespace KAB {
00040 class Core;
00041 }
00042 
00043 class Command : public KCommand
00044 {
00045   public:
00046     Command( KABC::AddressBook *addressBook ) { mAddressBook = addressBook; }
00047 
00048   protected:
00049     KABC::AddressBook *addressBook() const { return mAddressBook; }
00050     KABLock *lock() const { return KABLock::self( mAddressBook ); }
00051 
00052   private:
00053     KABC::AddressBook *mAddressBook;
00054 };
00055 
00056 class DeleteCommand : public Command
00057 {
00058   public:
00059     DeleteCommand( KABC::AddressBook *addressBook, const QStringList &uidList );
00060 
00061     virtual QString name() const;
00062     virtual void unexecute();
00063     virtual void execute();
00064 
00065   private:
00066     KABC::Addressee::List mAddresseeList;
00067     QStringList mUIDList;
00068 };
00069 
00070 class PasteCommand : public Command
00071 {
00072   public:
00073     PasteCommand( KAB::Core *core,
00074                   const KABC::Addressee::List &addressees );
00075 
00076     virtual QString name() const;
00077     virtual void unexecute();
00078     virtual void execute();
00079 
00080   private:
00081     KABC::Addressee::List mAddresseeList;
00082     KAB::Core *mCore;
00083 };
00084 
00085 class CutCommand : public Command
00086 {
00087   public:
00088     CutCommand( KABC::AddressBook *addressBook, const QStringList &uidList );
00089 
00090     virtual QString name() const;
00091     virtual void unexecute();
00092     virtual void execute();
00093 
00094   private:
00095     KABC::Addressee::List mAddresseeList;
00096     QStringList mUIDList;
00097     QString mClipText;
00098     QString mOldText;
00099 };
00100 
00101 class NewCommand : public Command
00102 {
00103   public:
00104     NewCommand( KABC::AddressBook *addressBook,
00105                 const KABC::Addressee::List &addressees );
00106 
00107     virtual QString name() const;
00108     virtual void unexecute();
00109     virtual void execute();
00110 
00111   private:
00112     KABC::Addressee::List mAddresseeList;
00113 };
00114 
00115 class EditCommand : public Command
00116 {
00117   public:
00118     EditCommand( KABC::AddressBook *addressBook, const KABC::Addressee &oldAddressee,
00119                  const KABC::Addressee &newAddressee );
00120 
00121     virtual QString name() const;
00122     virtual void unexecute();
00123     virtual void execute();
00124 
00125   private:
00126     KABC::Addressee mOldAddressee;
00127     KABC::Addressee mNewAddressee;
00128 };
00129 
00130 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys