diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kross/api/eventslot.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kross/api/eventslot.cpp')
-rw-r--r-- | lib/kross/api/eventslot.cpp | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/lib/kross/api/eventslot.cpp b/lib/kross/api/eventslot.cpp index df70c9c8..fed92ea0 100644 --- a/lib/kross/api/eventslot.cpp +++ b/lib/kross/api/eventslot.cpp @@ -22,15 +22,15 @@ #include "variant.h" #include "qtobject.h" -#include <qmetaobject.h> -#include <private/qucom_p.h> // for the Qt QUObject API. +#include <tqmetaobject.h> +#include <tqucom_p.h> // for the TQt TQUObject API. using namespace Kross::Api; -EventSlot::EventSlot(const QString& name, QObject* receiver, QCString slot) +EventSlot::EventSlot(const TQString& name, TQObject* receiver, TQCString slot) : Event<EventSlot>(name) , m_receiver(receiver) - , m_slot(slot) //QObject::normalizeSignalSlot(slot) + , m_slot(slot) //TQObject::normalizeSignalSlot(slot) { } @@ -38,75 +38,75 @@ EventSlot::~EventSlot() { } -const QString EventSlot::getClassName() const +const TQString EventSlot::getClassName() const { return "Kross::Api::EventSlot"; } -Object::Ptr EventSlot::call(const QString& /*name*/, List::Ptr arguments) +Object::Ptr EventSlot::call(const TQString& /*name*/, List::Ptr arguments) { #ifdef KROSS_API_EVENTSLOT_CALL_DEBUG - krossdebug( QString("EventSlot::call() m_slot=%1 arguments=%2").arg(m_slot).arg(arguments->toString()) ); + krossdebug( TQString("EventSlot::call() m_slot=%1 arguments=%2").tqarg(m_slot).tqarg(arguments->toString()) ); #endif - QString n = m_slot; //TODO name; //Variant::toString(args->item(0)); + TQString n = m_slot; //TODO name; //Variant::toString(args->item(0)); if(n.startsWith("1")) // Remove prefix of SLOT-macros n.remove(0,1); - int slotid = m_receiver->metaObject()->findSlot(n.latin1(), false); + int slotid = m_receiver->tqmetaObject()->tqfindSlot(n.latin1(), false); if(slotid < 0) - throw Exception::Ptr( new Exception(QString("No such slot '%1'.").arg(n)) ); + throw Exception::Ptr( new Exception(TQString("No such slot '%1'.").tqarg(n)) ); - QUObject* uo = QtObject::toQUObject(n, arguments); + TQUObject* uo = QtObject::toTQUObject(n, arguments); m_receiver->qt_invoke(slotid, uo); // invoke the slot delete [] uo; - return new Variant( QVariant(true,0) ); + return new Variant( TQVariant(true,0) ); } /* -QCString EventSlot::getSlot(const QCString& signal) +TQCString EventSlot::getSlot(const TQCString& signal) { - QString signature = QString(signal).mid(1); - int startpos = signature.find("("); - int endpos = signature.findRev(")"); + TQString signature = TQString(signal).mid(1); + int startpos = signature.tqfind("("); + int endpos = signature.tqfindRev(")"); if(startpos < 0 || startpos > endpos) { - krosswarning( QString("EventSlot::getSlot(%1) Invalid signal.").arg(signal) ); - return QCString(); + krosswarning( TQString("EventSlot::getSlot(%1) Invalid signal.").tqarg(signal) ); + return TQCString(); } - QString signalname = signature.left(startpos); - QString params = signature.mid(startpos + 1, endpos - startpos - 1); - //QStringList paramlist = QStringList::split(",", params); - QCString slot = QString("callback(" + params + ")").latin1(); //normalizeSignalSlot(); + TQString signalname = signature.left(startpos); + TQString params = signature.mid(startpos + 1, endpos - startpos - 1); + //TQStringList paramlist = TQStringList::split(",", params); + TQCString slot = TQString("callback(" + params + ")").latin1(); //normalizeSignalSlot(); - QMetaObject* mo = metaObject(); + TQMetaObject* mo = tqmetaObject(); int slotid = mo->findSlot(slot, false); if(slotid < 0) { - krossdebug( QString("EventSlot::getSlot(%1) No such slot '%2' avaiable.").arg(signal).arg(slot) ); - return QCString(); + krossdebug( TQString("EventSlot::getSlot(%1) No such slot '%2' avaiable.").tqarg(signal).tqarg(slot) ); + return TQCString(); } - const QMetaData* md = mo->slot(slotid, false); - if(md->access != QMetaData::Public) { - krossdebug( QString("EventSlot::getSlot(%1) The slot '%2' is not public.").arg(signal).arg(slot) ); - return QCString(); + const TQMetaData* md = mo->slot(slotid, false); + if(md->access != TQMetaData::Public) { + krossdebug( TQString("EventSlot::getSlot(%1) The slot '%2' is not public.").tqarg(signal).tqarg(slot) ); + return TQCString(); } -//QMember* member = md->member; -//const QUMethod *method = md->method; +//TQMember* member = md->member; +//const TQUMethod *method = md->method; - krossdebug( QString("signal=%1 slot=%2 slotid=%3 params=%4 mdname=%5") - .arg(signal).arg(slot).arg(slotid).arg(params).arg(md->name) ); - return QCString("1" + slot); // Emulate the SLOT(...) macro by adding as first char a "1". + krossdebug( TQString("signal=%1 slot=%2 slotid=%3 params=%4 mdname=%5") + .tqarg(signal).tqarg(slot).tqarg(slotid).tqarg(params).tqarg(md->name) ); + return TQCString("1" + slot); // Emulate the TQT_SLOT(...) macro by adding as first char a "1". } -bool EventSlot::connect(EventManager* eventmanager, QObject* senderobj, const QCString& signal, QString function, const QCString& slot) +bool EventSlot::connect(EventManager* eventmanager, TQObject* senderobj, const TQCString& signal, TQString function, const TQCString& slot) { if(m_sender && ! disconnect()) return false; - const QCString& myslot = slot.isEmpty() ? getSlot(signal) : slot; + const TQCString& myslot = slot.isEmpty() ? getSlot(signal) : slot; if(! myslot) return false; @@ -114,18 +114,18 @@ bool EventSlot::connect(EventManager* eventmanager, QObject* senderobj, const QC EventSlot* eventslot = create(eventmanager); eventslot->connect(eventmanager, senderobj, signal, function, slot); m_slots.append(eventslot); - krossdebug( QString("EventSlot::connect(%1, %2, %3) added child EventSlot !!!").arg(senderobj->name()).arg(signal).arg(function) ); + krossdebug( TQString("EventSlot::connect(%1, %2, %3) added child EventSlot !!!").tqarg(senderobj->name()).tqarg(signal).tqarg(function) ); } else { m_sender = senderobj; m_signal = signal; m_function = function; m_slot = myslot; - if(! QObject::connect((QObject*)senderobj, signal, this, myslot)) { - krossdebug( QString("EventSlot::connect(%1, %2, %3) failed.").arg(senderobj->name()).arg(signal).arg(function) ); + if(! TQObject::connect((TQObject*)senderobj, signal, this, myslot)) { + krossdebug( TQString("EventSlot::connect(%1, %2, %3) failed.").tqarg(senderobj->name()).tqarg(signal).tqarg(function) ); return false; } - krossdebug( QString("EventSlot::connect(%1, %2, %3) successfully connected.").arg(senderobj->name()).arg(signal).arg(function) ); + krossdebug( TQString("EventSlot::connect(%1, %2, %3) successfully connected.").tqarg(senderobj->name()).tqarg(signal).tqarg(function) ); } return true; } @@ -133,22 +133,22 @@ bool EventSlot::connect(EventManager* eventmanager, QObject* senderobj, const QC bool EventSlot::disconnect() { if(! m_sender) return false; - QObject::disconnect((QObject*)m_sender, m_signal, this, m_slot); + TQObject::disconnect((TQObject*)m_sender, m_signal, this, m_slot); m_sender = 0; m_signal = 0; m_slot = 0; - m_function = QString::null; + m_function = TQString(); return true; } -void EventSlot::call(const QVariant& variant) +void EventSlot::call(const TQVariant& variant) { - krossdebug( QString("EventSlot::call() sender='%1' signal='%2' function='%3'") - .arg(m_sender->name()).arg(m_signal).arg(m_function) ); + krossdebug( TQString("EventSlot::call() sender='%1' signal='%2' function='%3'") + .tqarg(m_sender->name()).tqarg(m_signal).tqarg(m_function) ); Kross::Api::List* arglist = 0; - QValueList<Kross::Api::Object*> args; + TQValueList<Kross::Api::Object*> args; if(variant.isValid()) { args.append(Kross::Api::Variant::create(variant)); arglist = Kross::Api::List::create(args); @@ -159,64 +159,64 @@ void EventSlot::call(const QVariant& variant) } catch(Exception& e) { //TODO add hadError(), getError() and setError() - krossdebug( QString("EXCEPTION in EventSlot::call('%1') type='%2' description='%3'").arg(variant.toString()).arg(e.type()).arg(e.description()) ); + krossdebug( TQString("EXCEPTION in EventSlot::call('%1') type='%2' description='%3'").tqarg(variant.toString()).tqarg(e.type()).tqarg(e.description()) ); } } void EventSlot::callback() { - call(QVariant()); } + call(TQVariant()); } void EventSlot::callback(short s) { - call(QVariant(s)); } + call(TQVariant(s)); } void EventSlot::callback(int i) { - call(QVariant(i)); } + call(TQVariant(i)); } void EventSlot::callback(int i1, int i2) { - call(QVariant( QValueList<QVariant>() << i1 << i2 )); } + call(TQVariant( TQValueList<TQVariant>() << i1 << i2 )); } void EventSlot::callback(int i1, int i2, int i3) { - call(QVariant( QValueList<QVariant>() << i1 << i2 << i3 )); } + call(TQVariant( TQValueList<TQVariant>() << i1 << i2 << i3 )); } void EventSlot::callback(int i1, int i2, int i3, int i4) { - call(QVariant( QValueList<QVariant>() << i1 << i2 << i3 << i4 )); } + call(TQVariant( TQValueList<TQVariant>() << i1 << i2 << i3 << i4 )); } void EventSlot::callback(int i1, int i2, int i3, int i4, int i5) { - call(QVariant( QValueList<QVariant>() << i1 << i2 << i3 << i4 << i5 )); } + call(TQVariant( TQValueList<TQVariant>() << i1 << i2 << i3 << i4 << i5 )); } void EventSlot::callback(int i1, int i2, int i3, int i4, bool b) { - call(QVariant( QValueList<QVariant>() << i1 << i2 << i3 << i4 << b )); } + call(TQVariant( TQValueList<TQVariant>() << i1 << i2 << i3 << i4 << b )); } void EventSlot::callback(int i1, bool b) { - call(QVariant( QValueList<QVariant>() << i1 << b )); } + call(TQVariant( TQValueList<TQVariant>() << i1 << b )); } void EventSlot::callback(int i1, int i2, bool b) { - call(QVariant( QValueList<QVariant>() << i1 << i2 << b )); } -void EventSlot::callback(int i1, int i2, const QString& s) { - call(QVariant( QValueList<QVariant>() << i1 << i2 << s )); } + call(TQVariant( TQValueList<TQVariant>() << i1 << i2 << b )); } +void EventSlot::callback(int i1, int i2, const TQString& s) { + call(TQVariant( TQValueList<TQVariant>() << i1 << i2 << s )); } void EventSlot::callback(uint i) { - call(QVariant(i)); } + call(TQVariant(i)); } void EventSlot::callback(long l) { - call(QVariant((Q_LLONG)l)); } + call(TQVariant((TQ_LLONG)l)); } void EventSlot::callback(ulong l) { - call(QVariant((Q_ULLONG)l)); } + call(TQVariant((TQ_ULLONG)l)); } void EventSlot::callback(double d) { - call(QVariant(d)); } + call(TQVariant(d)); } void EventSlot::callback(const char* c) { - call(QVariant(c)); } + call(TQVariant(c)); } void EventSlot::callback(bool b) { - call(QVariant(b)); } -void EventSlot::callback(const QString& s) { - call(QVariant(s)); } -void EventSlot::callback(const QString& s, int i) { - call(QVariant( QValueList<QVariant>() << s << i )); } -void EventSlot::callback(const QString& s, int i1, int i2) { - call(QVariant( QValueList<QVariant>() << s << i1 << i2 )); } -void EventSlot::callback(const QString& s, uint i) { - call(QVariant( QValueList<QVariant>() << s << i )); } -void EventSlot::callback(const QString& s, bool b) { - call(QVariant( QValueList<QVariant>() << s << b )); } -void EventSlot::callback(const QString& s, bool b1, bool b2) { - call(QVariant( QValueList<QVariant>() << s << b1 << b2 )); } -void EventSlot::callback(const QString& s, bool b, int i) { - call(QVariant( QValueList<QVariant>() << s << b << i )); } -void EventSlot::callback(const QString& s1, const QString& s2) { - call(QVariant( QValueList<QVariant>() << s1 << s2 )); } -void EventSlot::callback(const QString& s1, const QString& s2, const QString& s3) { - call(QVariant( QValueList<QVariant>() << s1 << s2 << s3 )); } -void EventSlot::callback(const QStringList& sl) { - call(QVariant(sl)); } -void EventSlot::callback(const QVariant& variant) { + call(TQVariant(b)); } +void EventSlot::callback(const TQString& s) { + call(TQVariant(s)); } +void EventSlot::callback(const TQString& s, int i) { + call(TQVariant( TQValueList<TQVariant>() << s << i )); } +void EventSlot::callback(const TQString& s, int i1, int i2) { + call(TQVariant( TQValueList<TQVariant>() << s << i1 << i2 )); } +void EventSlot::callback(const TQString& s, uint i) { + call(TQVariant( TQValueList<TQVariant>() << s << i )); } +void EventSlot::callback(const TQString& s, bool b) { + call(TQVariant( TQValueList<TQVariant>() << s << b )); } +void EventSlot::callback(const TQString& s, bool b1, bool b2) { + call(TQVariant( TQValueList<TQVariant>() << s << b1 << b2 )); } +void EventSlot::callback(const TQString& s, bool b, int i) { + call(TQVariant( TQValueList<TQVariant>() << s << b << i )); } +void EventSlot::callback(const TQString& s1, const TQString& s2) { + call(TQVariant( TQValueList<TQVariant>() << s1 << s2 )); } +void EventSlot::callback(const TQString& s1, const TQString& s2, const TQString& s3) { + call(TQVariant( TQValueList<TQVariant>() << s1 << s2 << s3 )); } +void EventSlot::callback(const TQStringList& sl) { + call(TQVariant(sl)); } +void EventSlot::callback(const TQVariant& variant) { call(variant); } */ |