diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
commit | 69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch) | |
tree | 073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /kfile-plugins | |
parent | 3467e6464beac3a162839bf7078e22e3a74d73e7 (diff) | |
download | tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip |
TQt4 port kdenetwork
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kfile-plugins')
-rw-r--r-- | kfile-plugins/torrent/bdict.cpp | 14 | ||||
-rw-r--r-- | kfile-plugins/torrent/bdict.h | 6 | ||||
-rw-r--r-- | kfile-plugins/torrent/bint.cpp | 8 | ||||
-rw-r--r-- | kfile-plugins/torrent/bint.h | 4 | ||||
-rw-r--r-- | kfile-plugins/torrent/blist.cpp | 2 | ||||
-rw-r--r-- | kfile-plugins/torrent/blist.h | 4 | ||||
-rw-r--r-- | kfile-plugins/torrent/bstring.cpp | 12 | ||||
-rw-r--r-- | kfile-plugins/torrent/bytetape.h | 4 | ||||
-rw-r--r-- | kfile-plugins/torrent/kfile_torrent.cpp | 28 | ||||
-rw-r--r-- | kfile-plugins/torrent/kfile_torrent.h | 5 |
10 files changed, 44 insertions, 43 deletions
diff --git a/kfile-plugins/torrent/bdict.cpp b/kfile-plugins/torrent/bdict.cpp index 4819165c..f19c70b9 100644 --- a/kfile-plugins/torrent/bdict.cpp +++ b/kfile-plugins/torrent/bdict.cpp @@ -114,7 +114,7 @@ BDict::~BDict () BInt *BDict::findInt (const char *key) { - BBase *base = find(key); + BBase *base = tqfind(key); if (base && base->type_id() == bInt) return dynamic_cast<BInt*>(base); @@ -124,7 +124,7 @@ BInt *BDict::findInt (const char *key) BList *BDict::findList (const char *key) { - BBase *base = find(key); + BBase *base = tqfind(key); if (base && base->type_id() == bList) return dynamic_cast<BList*>(base); @@ -134,7 +134,7 @@ BList *BDict::findList (const char *key) BDict *BDict::findDict (const char *key) { - BBase *base = find(key); + BBase *base = tqfind(key); if (base && base->type_id() == bDict) return dynamic_cast<BDict*>(base); @@ -144,7 +144,7 @@ BDict *BDict::findDict (const char *key) BString *BDict::findStr (const char *key) { - BBase *base = find(key); + BBase *base = tqfind(key); if (base && base->type_id() == bString) return dynamic_cast<BString*>(base); @@ -159,7 +159,7 @@ bool BDict::writeToDevice(TQIODevice &device) const char *d_str = "d"; const char *e_str = "e"; - Q_LONG written = 0, result = 0; + TQ_LONG written = 0, result = 0; written = device.writeBlock (d_str, 1); while (written < 1) @@ -188,7 +188,7 @@ bool BDict::writeToDevice(TQIODevice &device) for (key_iter = key_list.begin(); key_iter != key_list.end(); ++key_iter) { TQCString utfString = (*key_iter).utf8(); - TQString str = TQString("%1:").arg(utfString.size() - 1); + TQString str = TQString("%1:").tqarg(utfString.size() - 1); TQCString lenString = str.utf8(); @@ -199,7 +199,7 @@ bool BDict::writeToDevice(TQIODevice &device) device.writeBlock(utfString.data(), utfString.size() - 1); // Write out the key's data - BBase *base = m_map.find(*key_iter); + BBase *base = m_map.tqfind(*key_iter); if (!base->writeToDevice (device)) return false; } diff --git a/kfile-plugins/torrent/bdict.h b/kfile-plugins/torrent/bdict.h index 77516c7f..b50e46eb 100644 --- a/kfile-plugins/torrent/bdict.h +++ b/kfile-plugins/torrent/bdict.h @@ -20,7 +20,7 @@ #define _BDICT_H #include <tqdict.h> -#include <tqcstring.h> // QByteArray +#include <tqcstring.h> // TQByteArray #include "bytetape.h" #include "bbase.h" @@ -106,7 +106,7 @@ class BDict : public BBase * @return true, if there is a value for the @p key in the * dictionary, false otherwise */ - virtual bool contains (const char *key) { return m_map.find(key) != 0; } + virtual bool tqcontains (const char *key) { return m_map.tqfind(key) != 0; } /** * Returns a pointer to the BBase descendant keyed by @p key. You @@ -118,7 +118,7 @@ class BDict : public BBase * matches the key * @see BBase */ - virtual BBase *find (const char *key) { return m_map.find(key); } + virtual BBase *tqfind (const char *key) { return m_map.tqfind(key); } /** * Convienience function to find and return a BInt keyed by @p key. diff --git a/kfile-plugins/torrent/bint.cpp b/kfile-plugins/torrent/bint.cpp index 567edece..0e23731c 100644 --- a/kfile-plugins/torrent/bint.cpp +++ b/kfile-plugins/torrent/bint.cpp @@ -46,19 +46,19 @@ void BInt::init (ByteTape &tape) tape ++; // Move to start of digits TQByteArray &dict (tape.data()); - if (dict.find('e', tape.pos()) == -1) + if (dict.tqfind('e', tape.pos()) == -1) return; // Copy the part from the start to the e. The values in-between // should be digits, perhaps preceded by a negative sign. - int length = dict.find('e', tape.pos()) - tape.pos(); + int length = dict.tqfind('e', tape.pos()) - tape.pos(); char *ptr = dict.data(); // Get start of buffer ptr += tape.pos(); // Advance to current position in tape // Allocate temporary data buffer TQByteArray buffer(length + 1); - qmemmove (buffer.data(), ptr, length); + tqmemmove (buffer.data(), ptr, length); buffer[length] = 0; // Null-terminate TQString numberString (buffer); @@ -86,7 +86,7 @@ bool BInt::writeToDevice (TQIODevice &device) TQString str = TQString("i%1e"). arg (m_value); - Q_LONG written = 0, result = 0; + TQ_LONG written = 0, result = 0; written = device.writeBlock (str.latin1(), str.length()); while ((uint) written < str.length()) { diff --git a/kfile-plugins/torrent/bint.h b/kfile-plugins/torrent/bint.h index 7e1fc582..e2ce2cc3 100644 --- a/kfile-plugins/torrent/bint.h +++ b/kfile-plugins/torrent/bint.h @@ -66,7 +66,7 @@ class BInt : public BBase * * @return this object's integer value */ - Q_LLONG get_value () const { return m_value; } + TQ_LLONG get_value () const { return m_value; } /** * Returns the type of this class. @@ -102,7 +102,7 @@ class BInt : public BBase */ void init(ByteTape &tape); - Q_LLONG m_value; + TQ_LLONG m_value; bool m_valid; }; diff --git a/kfile-plugins/torrent/blist.cpp b/kfile-plugins/torrent/blist.cpp index 8b11fbc6..4b510e76 100644 --- a/kfile-plugins/torrent/blist.cpp +++ b/kfile-plugins/torrent/blist.cpp @@ -143,7 +143,7 @@ bool BList::writeToDevice(TQIODevice &device) const char *l_str = "l"; const char *e_str = "e"; - Q_LONG written = 0, result = 0; + TQ_LONG written = 0, result = 0; written = device.writeBlock (l_str, 1); while (written < 1) diff --git a/kfile-plugins/torrent/blist.h b/kfile-plugins/torrent/blist.h index 4085ec39..89721822 100644 --- a/kfile-plugins/torrent/blist.h +++ b/kfile-plugins/torrent/blist.h @@ -158,7 +158,7 @@ class BList : public BBase * at this time. * * @return iterator pointing to the beginning of the list - * @see QValueList + * @see TQValueList */ BBaseVectorIterator begin(void) { return m_array.begin(); } @@ -169,7 +169,7 @@ class BList : public BBase * it as a boundary condition to avoid. * * @return iterator pointing one element past the end of the list - * @see QValueList + * @see TQValueList */ BBaseVectorIterator end(void) { return m_array.end(); } diff --git a/kfile-plugins/torrent/bstring.cpp b/kfile-plugins/torrent/bstring.cpp index 924acdbc..acf16190 100644 --- a/kfile-plugins/torrent/bstring.cpp +++ b/kfile-plugins/torrent/bstring.cpp @@ -44,21 +44,21 @@ void BString::init (ByteTape &tape) { TQByteArray &dict(tape.data()); - if (dict.find(':', tape.pos()) == -1) + if (dict.tqfind(':', tape.pos()) == -1) { - kdDebug(7034) << "Can't find : for string!" << endl; + kdDebug(7034) << "Can't tqfind : for string!" << endl; return; } // Copy the part from start to :, as it will be a number // That number is the number of characters to read - int length = dict.find(':', tape.pos()) - tape.pos(); + int length = dict.tqfind(':', tape.pos()) - tape.pos(); char *ptr = dict.data(); ptr += tape.pos(); TQByteArray buffer (length + 1); - qmemmove (buffer.data(), ptr, length); + tqmemmove (buffer.data(), ptr, length); buffer[length] = 0; TQString numberString (buffer); @@ -85,10 +85,10 @@ void BString::init (ByteTape &tape) // Time to copy the data char *textBuffer = tape.at(tape.pos()); - if (!m_data.resize(len + 1)) + if (!m_data.tqresize(len + 1)) return; - qmemmove (m_data.data(), textBuffer, len); + tqmemmove (m_data.data(), textBuffer, len); m_data[len] = 0; // Null terminate for convienience tape += len; diff --git a/kfile-plugins/torrent/bytetape.h b/kfile-plugins/torrent/bytetape.h index 4c803122..f7309b11 100644 --- a/kfile-plugins/torrent/bytetape.h +++ b/kfile-plugins/torrent/bytetape.h @@ -39,7 +39,7 @@ class ByteTapeShared : public KShared * by design. * * @author Michael Pyne <mpyne@grammarian.homelinux.net> - * @see QByteArray + * @see TQByteArray */ class ByteTape { @@ -180,7 +180,7 @@ class ByteTape * Returns a reference to the TQByteArray used to hold all the data. * * @return the TQByteArray used to hold the data - * @see QByteArray + * @see TQByteArray */ TQByteArray &data() { return m_array; } diff --git a/kfile-plugins/torrent/kfile_torrent.cpp b/kfile-plugins/torrent/kfile_torrent.cpp index 4aca75bc..a5de60f0 100644 --- a/kfile-plugins/torrent/kfile_torrent.cpp +++ b/kfile-plugins/torrent/kfile_torrent.cpp @@ -35,11 +35,11 @@ typedef KGenericFactory<KTorrentPlugin> TorrentFactory; K_EXPORT_COMPONENT_FACTORY(kfile_torrent, TorrentFactory("kfile_torrent")) TQStringList filesList (BList *list); -Q_ULLONG filesLength (BList *list); +TQ_ULLONG filesLength (BList *list); -KTorrentPlugin::KTorrentPlugin (TQObject *parent, const char *name, +KTorrentPlugin::KTorrentPlugin (TQObject *tqparent, const char *name, const TQStringList &args) - : KFilePlugin (parent, name, args), m_failed(true), m_dict(0) + : KFilePlugin (tqparent, name, args), m_failed(true), m_dict(0) { KFileMimeTypeInfo *info = addMimeTypeInfo ("application/x-bittorrent"); if (!info) @@ -140,7 +140,7 @@ bool KTorrentPlugin::readInfo (KFileMetaInfo &info, unsigned int) TQByteArray buf = file.readAll(); file.close(); - if (!buf) + if (buf.isEmpty()) { kdError() << "Empty file: " << info.path() << endl; return false; @@ -166,7 +166,7 @@ bool KTorrentPlugin::readInfo (KFileMetaInfo &info, unsigned int) // If a torrent has a key, but it is of the wrong type, then it isn't a valid // torrent, and so we should just die. - if (m_dict->contains("announce")) + if (m_dict->tqcontains("announce")) { BString *str = m_dict->findStr ("announce"); if (!str) @@ -174,7 +174,7 @@ bool KTorrentPlugin::readInfo (KFileMetaInfo &info, unsigned int) appendItem (group, "announce", TQString(str->get_string())); } - if (m_dict->contains("creation date")) + if (m_dict->tqcontains("creation date")) { BInt *the_data = m_dict->findInt ("creation date"); TQDateTime my_date; @@ -193,12 +193,12 @@ bool KTorrentPlugin::readInfo (KFileMetaInfo &info, unsigned int) // it. BDict *info_dict = m_dict->findDict("info"); int num_files = 1; - Q_ULLONG length = 0; + TQ_ULLONG length = 0; if (!info_dict) return false; - if (!info_dict->contains("length")) + if (!info_dict->tqcontains("length")) { /* Has more than one file. The list of files is contained in a * list called, appropriately enough, 'files' @@ -223,7 +223,7 @@ bool KTorrentPlugin::readInfo (KFileMetaInfo &info, unsigned int) appendItem (group, "NumFiles", num_files); appendItem (group, "length", length); - if (info_dict->contains("name")) + if (info_dict->tqcontains("name")) { BString *str = info_dict->findStr("name"); if (!str) @@ -244,7 +244,7 @@ bool KTorrentPlugin::readInfo (KFileMetaInfo &info, unsigned int) appendItem (group, "piece length", piece_length->get_value()); - if (m_dict->contains("comment")) + if (m_dict->tqcontains("comment")) { BString *comment = m_dict->findStr("comment"); if (!comment) @@ -315,9 +315,9 @@ TQStringList filesList (BList *list) /* This function determines the total length of a torrent stream. * The list provided should be the same one provided for filesList. */ -Q_ULLONG filesLength (BList *list) +TQ_ULLONG filesLength (BList *list) { - Q_ULLONG length = 0; + TQ_ULLONG length = 0; for (unsigned int i = 0; i < list->count(); ++i) { @@ -383,7 +383,7 @@ bool KTorrentPlugin::writeInfo(const KFileMetaInfo &info) const TQString the_name = info[*it][key].value().toString(); // Remove trailing slashes - the_name.replace (TQRegExp("/*$"), ""); + the_name.tqreplace (TQRegExp("/*$"), ""); name_str->setValue (the_name); } @@ -396,7 +396,7 @@ bool KTorrentPlugin::writeInfo(const KFileMetaInfo &info) const if (!output.open(IO_WriteOnly | IO_Truncate)) return false; - return m_dict->writeToDevice(output); + return m_dict->writeToDevice(*TQT_TQIODEVICE(&output)); } #include "kfile_torrent.moc" diff --git a/kfile-plugins/torrent/kfile_torrent.h b/kfile-plugins/torrent/kfile_torrent.h index c4ed73fc..203e2b55 100644 --- a/kfile-plugins/torrent/kfile_torrent.h +++ b/kfile-plugins/torrent/kfile_torrent.h @@ -38,16 +38,17 @@ class TQStringList; class KTorrentPlugin : public KFilePlugin { Q_OBJECT + TQ_OBJECT public: /** * Constructs the class, and prepares for reading info on a torrent. * - * @param parent the parent of this object + * @param tqparent the tqparent of this object * @param name the name of this object (not user-readable) * @param args unused by this class */ - KTorrentPlugin (TQObject *parent, const char *name, const TQStringList &args); + KTorrentPlugin (TQObject *tqparent, const char *name, const TQStringList &args); /** * Destructor that closes the dictionary holding the torrent information. |