summaryrefslogtreecommitdiffstats
path: root/kalarm/undo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kalarm/undo.cpp')
-rw-r--r--kalarm/undo.cpp144
1 files changed, 72 insertions, 72 deletions
diff --git a/kalarm/undo.cpp b/kalarm/undo.cpp
index bab085ae3..8d6a46a32 100644
--- a/kalarm/undo.cpp
+++ b/kalarm/undo.cpp
@@ -20,8 +20,8 @@
#include "kalarm.h"
-#include <qobject.h>
-#include <qstringlist.h>
+#include <tqobject.h>
+#include <tqstringlist.h>
#include <kapplication.h>
#include <klocale.h>
@@ -44,18 +44,18 @@ class UndoItem
UndoItem(); // needed by QValueList
virtual ~UndoItem();
virtual Operation operation() const = 0;
- virtual QString actionText() const = 0;
- virtual QString description() const { return QString::null; }
- virtual QString eventID() const { return QString::null; }
- virtual QString oldEventID() const { return QString::null; }
- virtual QString newEventID() const { return QString::null; }
+ virtual TQString actionText() const = 0;
+ virtual TQString description() const { return TQString::null; }
+ virtual TQString eventID() const { return TQString::null; }
+ virtual TQString oldEventID() const { return TQString::null; }
+ virtual TQString newEventID() const { return TQString::null; }
int id() const { return mId; }
Undo::Type type() const { return mType; }
void setType(Undo::Type t) { mType = t; }
KAEvent::Status calendar() const { return mCalendar; }
virtual void setCalendar(KAEvent::Status s) { mCalendar = s; }
virtual UndoItem* restore() = 0;
- virtual bool deleteID(const QString& /*id*/) { return false; }
+ virtual bool deleteID(const TQString& /*id*/) { return false; }
enum Error { ERR_NONE, ERR_PROG, ERR_NOT_FOUND, ERR_CREATE, ERR_TEMPLATE, ERR_EXPIRED };
enum Warning { WARN_NONE, WARN_KORG_ADD, WARN_KORG_MODIFY, WARN_KORG_DELETE };
@@ -66,8 +66,8 @@ class UndoItem
protected:
UndoItem(Undo::Type);
- static QString addDeleteActionText(KAEvent::Status, bool add);
- QString description(const KAEvent&) const;
+ static TQString addDeleteActionText(KAEvent::Status, bool add);
+ TQString description(const KAEvent&) const;
void replaceWith(UndoItem* item) { Undo::replace(this, item); }
int mId; // unique identifier (only for mType = UNDO, REDO)
@@ -89,11 +89,11 @@ class UndoMultiBase : public UndoItem
template <class T> class UndoMulti : public UndoMultiBase
{
public:
- UndoMulti(Undo::Type, const QValueList<KAEvent>&);
+ UndoMulti(Undo::Type, const TQValueList<KAEvent>&);
UndoMulti(Undo::Type t, Undo::List& undos) : UndoMultiBase(t, undos) { }
virtual Operation operation() const { return MULTI; }
virtual UndoItem* restore();
- virtual bool deleteID(const QString& id);
+ virtual bool deleteID(const TQString& id);
virtual UndoItem* createRedo(Undo::List&) = 0;
};
@@ -103,35 +103,35 @@ class UndoAdd : public UndoItem
UndoAdd(Undo::Type, const KAEvent&);
UndoAdd(Undo::Type, const KAEvent&, KAEvent::Status);
virtual Operation operation() const { return ADD; }
- virtual QString actionText() const;
- virtual QString description() const { return mDescription; }
- virtual QString eventID() const { return mEventID; }
- virtual QString newEventID() const { return mEventID; }
+ virtual TQString actionText() const;
+ virtual TQString description() const { return mDescription; }
+ virtual TQString eventID() const { return mEventID; }
+ virtual TQString newEventID() const { return mEventID; }
virtual UndoItem* restore() { return doRestore(); }
protected:
UndoItem* doRestore(bool setArchive = false);
virtual UndoItem* createRedo(const KAEvent&);
private:
- QString mEventID;
- QString mDescription;
+ TQString mEventID;
+ TQString mDescription;
};
class UndoEdit : public UndoItem
{
public:
- UndoEdit(Undo::Type, const KAEvent& oldEvent, const QString& newEventID, const QString& description);
+ UndoEdit(Undo::Type, const KAEvent& oldEvent, const TQString& newEventID, const TQString& description);
~UndoEdit();
virtual Operation operation() const { return EDIT; }
- virtual QString actionText() const;
- virtual QString description() const { return mDescription; }
- virtual QString eventID() const { return mNewEventID; }
- virtual QString oldEventID() const { return mOldEvent->id(); }
- virtual QString newEventID() const { return mNewEventID; }
+ virtual TQString actionText() const;
+ virtual TQString description() const { return mDescription; }
+ virtual TQString eventID() const { return mNewEventID; }
+ virtual TQString oldEventID() const { return mOldEvent->id(); }
+ virtual TQString newEventID() const { return mNewEventID; }
virtual UndoItem* restore();
private:
KAEvent* mOldEvent;
- QString mNewEventID;
- QString mDescription;
+ TQString mNewEventID;
+ TQString mDescription;
};
class UndoDelete : public UndoItem
@@ -140,10 +140,10 @@ class UndoDelete : public UndoItem
UndoDelete(Undo::Type, const KAEvent&);
~UndoDelete();
virtual Operation operation() const { return DELETE; }
- virtual QString actionText() const;
- virtual QString description() const { return UndoItem::description(*mEvent); }
- virtual QString eventID() const { return mEvent->id(); }
- virtual QString oldEventID() const { return mEvent->id(); }
+ virtual TQString actionText() const;
+ virtual TQString description() const { return UndoItem::description(*mEvent); }
+ virtual TQString eventID() const { return mEvent->id(); }
+ virtual TQString oldEventID() const { return mEvent->id(); }
virtual UndoItem* restore();
KAEvent* event() const { return mEvent; }
protected:
@@ -157,7 +157,7 @@ class UndoReactivate : public UndoAdd
public:
UndoReactivate(Undo::Type t, const KAEvent& e) : UndoAdd(t, e, KAEvent::ACTIVE) { }
virtual Operation operation() const { return REACTIVATE; }
- virtual QString actionText() const;
+ virtual TQString actionText() const;
virtual UndoItem* restore();
protected:
virtual UndoItem* createRedo(const KAEvent&);
@@ -168,7 +168,7 @@ class UndoDeactivate : public UndoDelete
public:
UndoDeactivate(Undo::Type t, const KAEvent& e) : UndoDelete(t, e) { }
virtual Operation operation() const { return DEACTIVATE; }
- virtual QString actionText() const;
+ virtual TQString actionText() const;
virtual UndoItem* restore();
protected:
virtual UndoItem* createRedo(const KAEvent&);
@@ -177,22 +177,22 @@ class UndoDeactivate : public UndoDelete
class UndoDeletes : public UndoMulti<UndoDelete>
{
public:
- UndoDeletes(Undo::Type t, const QValueList<KAEvent>& events)
+ UndoDeletes(Undo::Type t, const TQValueList<KAEvent>& events)
: UndoMulti<UndoDelete>(t, events) { } // UNDO only
UndoDeletes(Undo::Type t, Undo::List& undos)
: UndoMulti<UndoDelete>(t, undos) { }
- virtual QString actionText() const;
+ virtual TQString actionText() const;
virtual UndoItem* createRedo(Undo::List&);
};
class UndoReactivates : public UndoMulti<UndoReactivate>
{
public:
- UndoReactivates(Undo::Type t, const QValueList<KAEvent>& events)
+ UndoReactivates(Undo::Type t, const TQValueList<KAEvent>& events)
: UndoMulti<UndoReactivate>(t, events) { } // UNDO only
UndoReactivates(Undo::Type t, Undo::List& undos)
: UndoMulti<UndoReactivate>(t, undos) { }
- virtual QString actionText() const;
+ virtual TQString actionText() const;
virtual UndoItem* createRedo(Undo::List&);
};
@@ -252,7 +252,7 @@ void Undo::saveDelete(const KAEvent& event)
emitChanged();
}
-void Undo::saveDeletes(const QValueList<KAEvent>& events)
+void Undo::saveDeletes(const TQValueList<KAEvent>& events)
{
int count = events.count();
if (count == 1)
@@ -260,7 +260,7 @@ void Undo::saveDeletes(const QValueList<KAEvent>& events)
else if (count > 1)
{
new UndoDeletes(UNDO, events);
- for (QValueList<KAEvent>::ConstIterator it = events.begin(); it != events.end(); ++it)
+ for (TQValueList<KAEvent>::ConstIterator it = events.begin(); it != events.end(); ++it)
removeRedos((*it).id()); // remove any redos which are made invalid by these deletions
emitChanged();
}
@@ -272,7 +272,7 @@ void Undo::saveReactivate(const KAEvent& event)
emitChanged();
}
-void Undo::saveReactivates(const QValueList<KAEvent>& events)
+void Undo::saveReactivates(const TQValueList<KAEvent>& events)
{
int count = events.count();
if (count == 1)
@@ -287,9 +287,9 @@ void Undo::saveReactivates(const QValueList<KAEvent>& events)
/******************************************************************************
* Remove any redos which are made invalid by a new undo.
*/
-void Undo::removeRedos(const QString& eventID)
+void Undo::removeRedos(const TQString& eventID)
{
- QString id = eventID;
+ TQString id = eventID;
for (Iterator it = mRedoList.begin(); it != mRedoList.end(); )
{
UndoItem* item = *it;
@@ -320,7 +320,7 @@ void Undo::removeRedos(const QString& eventID)
* Undo or redo a specified item.
* Reply = true if success, or if the item no longer exists.
*/
-bool Undo::undo(Undo::Iterator it, Undo::Type type, QWidget* parent, const QString& action)
+bool Undo::undo(Undo::Iterator it, Undo::Type type, TQWidget* parent, const TQString& action)
{
UndoItem::mRestoreError = UndoItem::ERR_NONE;
UndoItem::mRestoreWarning = UndoItem::WARN_NONE;
@@ -332,7 +332,7 @@ bool Undo::undo(Undo::Iterator it, Undo::Type type, QWidget* parent, const QStri
emitChanged();
}
- QString err;
+ TQString err;
switch (UndoItem::mRestoreError)
{
case UndoItem::ERR_NONE:
@@ -416,28 +416,28 @@ void Undo::replace(UndoItem* old, UndoItem* New)
/******************************************************************************
* Return the action description of the latest undo/redo item.
*/
-QString Undo::actionText(Undo::Type type)
+TQString Undo::actionText(Undo::Type type)
{
List* list = (type == UNDO) ? &mUndoList : (type == REDO) ? &mRedoList : 0;
- return (list && !list->isEmpty()) ? list->first()->actionText() : QString::null;
+ return (list && !list->isEmpty()) ? list->first()->actionText() : TQString::null;
}
/******************************************************************************
* Return the action description of the undo/redo item with the specified ID.
*/
-QString Undo::actionText(Undo::Type type, int id)
+TQString Undo::actionText(Undo::Type type, int id)
{
UndoItem* undo = getItem(id, type);
- return undo ? undo->actionText() : QString::null;
+ return undo ? undo->actionText() : TQString::null;
}
/******************************************************************************
* Return the alarm description of the undo/redo item with the specified ID.
*/
-QString Undo::description(Undo::Type type, int id)
+TQString Undo::description(Undo::Type type, int id)
{
UndoItem* undo = getItem(id, type);
- return undo ? undo->description() : QString::null;
+ return undo ? undo->description() : TQString::null;
}
/******************************************************************************
@@ -446,10 +446,10 @@ QString Undo::description(Undo::Type type, int id)
* listed, to force dependent undos to be executed in their correct order.
* If 'ids' is non-null, also returns a list of their corresponding IDs.
*/
-QValueList<int> Undo::ids(Undo::Type type)
+TQValueList<int> Undo::ids(Undo::Type type)
{
- QValueList<int> ids;
- QStringList ignoreIDs;
+ TQValueList<int> ids;
+ TQStringList ignoreIDs;
//int n=0;
List* list = (type == UNDO) ? &mUndoList : (type == REDO) ? &mRedoList : 0;
if (!list)
@@ -463,11 +463,11 @@ QValueList<int> Undo::ids(Undo::Type type)
if (item->operation() == UndoItem::MULTI)
{
// If any item in a multi-undo is disqualified, omit the whole multi-undo
- QStringList newIDs;
+ TQStringList newIDs;
const Undo::List& undos = ((UndoMultiBase*)item)->undos();
for (Undo::List::ConstIterator u = undos.begin(); u != undos.end(); ++u)
{
- QString evid = (*u)->eventID();
+ TQString evid = (*u)->eventID();
if (ignoreIDs.find(evid) != ignoreIDs.end())
omit = true;
else if (omit)
@@ -477,7 +477,7 @@ QValueList<int> Undo::ids(Undo::Type type)
}
if (omit)
{
- for (QStringList::ConstIterator i = newIDs.begin(); i != newIDs.end(); ++i)
+ for (TQStringList::ConstIterator i = newIDs.begin(); i != newIDs.end(); ++i)
ignoreIDs.append(*i);
}
}
@@ -578,7 +578,7 @@ UndoItem::~UndoItem()
/******************************************************************************
* Return the description of an event.
*/
-QString UndoItem::description(const KAEvent& event) const
+TQString UndoItem::description(const KAEvent& event) const
{
return (mCalendar == KAEvent::TEMPLATE) ? event.templateName() : AlarmText::summary(event);
}
@@ -586,7 +586,7 @@ QString UndoItem::description(const KAEvent& event) const
/******************************************************************************
* Return the action description of an add or delete Undo/Redo item for displaying.
*/
-QString UndoItem::addDeleteActionText(KAEvent::Status calendar, bool add)
+TQString UndoItem::addDeleteActionText(KAEvent::Status calendar, bool add)
{
switch (calendar)
{
@@ -605,7 +605,7 @@ QString UndoItem::addDeleteActionText(KAEvent::Status calendar, bool add)
default:
break;
}
- return QString::null;
+ return TQString::null;
}
@@ -615,10 +615,10 @@ QString UndoItem::addDeleteActionText(KAEvent::Status calendar, bool add)
=============================================================================*/
template <class T>
-UndoMulti<T>::UndoMulti(Undo::Type type, const QValueList<KAEvent>& events)
+UndoMulti<T>::UndoMulti(Undo::Type type, const TQValueList<KAEvent>& events)
: UndoMultiBase(type) // UNDO only
{
- for (QValueList<KAEvent>::ConstIterator it = events.begin(); it != events.end(); ++it)
+ for (TQValueList<KAEvent>::ConstIterator it = events.begin(); it != events.end(); ++it)
mUndos.append(new T(Undo::NONE, *it));
}
@@ -659,7 +659,7 @@ UndoItem* UndoMulti<T>::restore()
* = false otherwise.
*/
template <class T>
-bool UndoMulti<T>::deleteID(const QString& id)
+bool UndoMulti<T>::deleteID(const TQString& id)
{
for (Undo::List::Iterator it = mUndos.begin(); it != mUndos.end(); ++it)
{
@@ -776,7 +776,7 @@ UndoItem* UndoAdd::createRedo(const KAEvent& event)
/******************************************************************************
* Return the action description of the Undo item for displaying.
*/
-QString UndoAdd::actionText() const
+TQString UndoAdd::actionText() const
{
return addDeleteActionText(calendar(), (type() == Undo::UNDO));
}
@@ -787,7 +787,7 @@ QString UndoAdd::actionText() const
= Undo item for alarm edit.
=============================================================================*/
-UndoEdit::UndoEdit(Undo::Type type, const KAEvent& oldEvent, const QString& newEventID, const QString& description)
+UndoEdit::UndoEdit(Undo::Type type, const KAEvent& oldEvent, const TQString& newEventID, const TQString& description)
: UndoItem(type),
mOldEvent(new KAEvent(oldEvent)),
mNewEventID(newEventID),
@@ -856,7 +856,7 @@ UndoItem* UndoEdit::restore()
/******************************************************************************
* Return the action description of the Undo item for displaying.
*/
-QString UndoEdit::actionText() const
+TQString UndoEdit::actionText() const
{
switch (calendar())
{
@@ -867,7 +867,7 @@ QString UndoEdit::actionText() const
default:
break;
}
- return QString::null;
+ return TQString::null;
}
@@ -972,7 +972,7 @@ UndoItem* UndoDelete::createRedo(const KAEvent& event)
/******************************************************************************
* Return the action description of the Undo item for displaying.
*/
-QString UndoDelete::actionText() const
+TQString UndoDelete::actionText() const
{
return addDeleteActionText(calendar(), (type() == Undo::REDO));
}
@@ -995,10 +995,10 @@ UndoItem* UndoDeletes::createRedo(Undo::List& undos)
/******************************************************************************
* Return the action description of the Undo item for displaying.
*/
-QString UndoDeletes::actionText() const
+TQString UndoDeletes::actionText() const
{
if (mUndos.isEmpty())
- return QString::null;
+ return TQString::null;
for (Undo::List::ConstIterator it = mUndos.begin(); it != mUndos.end(); ++it)
{
switch ((*it)->calendar())
@@ -1010,7 +1010,7 @@ QString UndoDeletes::actionText() const
case KAEvent::EXPIRED:
break; // check if they are ALL expired
default:
- return QString::null;
+ return TQString::null;
}
}
return i18n("Delete multiple expired alarms");
@@ -1054,7 +1054,7 @@ UndoItem* UndoReactivate::createRedo(const KAEvent& event)
/******************************************************************************
* Return the action description of the Undo item for displaying.
*/
-QString UndoReactivate::actionText() const
+TQString UndoReactivate::actionText() const
{
return i18n("Reactivate alarm");
}
@@ -1098,7 +1098,7 @@ UndoItem* UndoDeactivate::createRedo(const KAEvent& event)
/******************************************************************************
* Return the action description of the Undo item for displaying.
*/
-QString UndoDeactivate::actionText() const
+TQString UndoDeactivate::actionText() const
{
return i18n("Reactivate alarm");
}
@@ -1121,7 +1121,7 @@ UndoItem* UndoReactivates::createRedo(Undo::List& undos)
/******************************************************************************
* Return the action description of the Undo item for displaying.
*/
-QString UndoReactivates::actionText() const
+TQString UndoReactivates::actionText() const
{
return i18n("Reactivate multiple alarms");
}