diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
commit | aa0726b20f398264f0a2abc60215be044b106f9c (patch) | |
tree | 070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/notedrag.cpp | |
parent | d3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff) | |
download | basket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip |
TQt4 port basket
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/notedrag.cpp')
-rw-r--r-- | src/notedrag.cpp | 280 |
1 files changed, 140 insertions, 140 deletions
diff --git a/src/notedrag.cpp b/src/notedrag.cpp index 633dec2..7d3d80a 100644 --- a/src/notedrag.cpp +++ b/src/notedrag.cpp @@ -18,15 +18,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qdragobject.h> -#include <qdir.h> -#include <qpainter.h> -#include <qtextcodec.h> -#include <qbuffer.h> +#include <tqdragobject.h> +#include <tqdir.h> +#include <tqpainter.h> +#include <tqtextcodec.h> +#include <tqbuffer.h> #include <kurldrag.h> #include <kdeversion.h> #include <kapplication.h> -#include <qdesktopwidget.h> +#include <tqdesktopwidget.h> #include "basket.h" #include "notedrag.h" @@ -43,11 +43,11 @@ const char * NoteDrag::NOTE_MIME_STRING = "application/x-basket-note"; void NoteDrag::createAndEmptyCuttingTmpFolder() { Tools::deleteRecursively(Global::tempCutFolder()); - QDir dir; + TQDir dir; dir.mkdir(Global::tempCutFolder()); } -QDragObject* NoteDrag::dragObject(NoteSelection *noteList, bool cutting, QWidget *source) +TQDragObject* NoteDrag::dragObject(NoteSelection *noteList, bool cutting, TQWidget *source) { if (noteList->count() <= 0) return 0; @@ -60,23 +60,23 @@ QDragObject* NoteDrag::dragObject(NoteSelection *noteList, bool cutting, QWidget createAndEmptyCuttingTmpFolder(); // The "Native Format" Serialization: - QBuffer buffer; + TQBuffer buffer; if (buffer.open(IO_WriteOnly)) { - QDataStream stream(&buffer); + TQDataStream stream(&buffer); // First append a pointer to the basket: - stream << (Q_UINT64)(noteList->firstStacked()->note->basket()); - // Then a list of pointers to all notes, and parent groups: + stream << (TQ_UINT64)(noteList->firstStacked()->note->basket()); + // Then a list of pointers to all notes, and tqparent groups: for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked()) - stream << (Q_UINT64)(node->note); - QValueList<Note*> groups = noteList->parentGroups(); - for (QValueList<Note*>::iterator it = groups.begin(); it != groups.end(); ++it) - stream << (Q_UINT64)(*it); - stream << (Q_UINT64)0; + stream << (TQ_UINT64)(node->note); + TQValueList<Note*> groups = noteList->tqparentGroups(); + for (TQValueList<Note*>::iterator it = groups.begin(); it != groups.end(); ++it) + stream << (TQ_UINT64)(*it); + stream << (TQ_UINT64)0; // And finally the notes themselves: serializeNotes(noteList, stream, cutting); // Append the object: buffer.close(); - QStoredDrag *dragObject = new QStoredDrag(NOTE_MIME_STRING, source); + TQStoredDrag *dragObject = new TQStoredDrag(NOTE_MIME_STRING, source); dragObject->setEncodedData(buffer.buffer()); multipleDrag->addDragObject(dragObject); } @@ -98,58 +98,58 @@ QDragObject* NoteDrag::dragObject(NoteSelection *noteList, bool cutting, QWidget return multipleDrag; } -void NoteDrag::serializeNotes(NoteSelection *noteList, QDataStream &stream, bool cutting) +void NoteDrag::serializeNotes(NoteSelection *noteList, TQDataStream &stream, bool cutting) { for (NoteSelection *node = noteList; node; node = node->next) { - stream << (Q_UINT64)(node->note); + stream << (TQ_UINT64)(node->note); if (node->firstChild) { - stream << (Q_UINT64)(NoteType::Group) << (Q_UINT64)(node->note->groupWidth()) << (Q_UINT64)(node->note->isFolded()); + stream << (TQ_UINT64)(NoteType::Group) << (TQ_UINT64)(node->note->groupWidth()) << (TQ_UINT64)(node->note->isFolded()); serializeNotes(node->firstChild, stream, cutting); } else { NoteContent *content = node->note->content(); - stream << (Q_UINT64)(content->type()) << (Q_UINT64)(node->note->groupWidth()); + stream << (TQ_UINT64)(content->type()) << (TQ_UINT64)(node->note->groupWidth()); // Serialize file name, and move the file to a temporary place if the note is to be cuttted. // If note does not have file name, we append empty string to be able to easily decode the notes later: stream << content->fileName(); if (content->shouldSerializeFile()) { if (cutting) { // Move file in a temporary place: - QString fullPath = Global::tempCutFolder() + Tools::fileNameForNewFile(content->fileName(), Global::tempCutFolder()); + TQString fullPath = Global::tempCutFolder() + Tools::fileNameForNewFile(content->fileName(), Global::tempCutFolder()); KIO::move(KURL(content->fullPath()), KURL(fullPath), /*showProgressInfo=*/false); node->fullPath = fullPath; stream << fullPath; } else stream << content->fullPath(); } else - stream << QString(""); + stream << TQString(""); stream << content->note()->addedDate() << content->note()->lastModificationDate(); content->serialize(stream); State::List states = node->note->states(); for (State::List::Iterator it = states.begin(); it != states.end(); ++it) - stream << (Q_UINT64)(*it); - stream << (Q_UINT64)0; + stream << (TQ_UINT64)(*it); + stream << (TQ_UINT64)0; } } - stream << (Q_UINT64)0; // Mark the end of the notes in this group/hierarchy. + stream << (TQ_UINT64)0; // Mark the end of the notes in this group/hierarchy. } void NoteDrag::serializeText(NoteSelection *noteList, KMultipleDrag *multipleDrag) { - QString textEquivalent; - QString text; + TQString textEquivalent; + TQString text; for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked()) { text = node->note->toText(node->fullPath); // note->toText() and not note->content()->toText() because the first one will also export the tags as text. if (!text.isEmpty()) textEquivalent += (!textEquivalent.isEmpty() ? "\n" : "") + text; } if (!textEquivalent.isEmpty()) - multipleDrag->addDragObject( new QTextDrag(textEquivalent) ); + multipleDrag->addDragObject( new TQTextDrag(textEquivalent) ); } void NoteDrag::serializeHtml(NoteSelection *noteList, KMultipleDrag *multipleDrag) { - QString htmlEquivalent; - QString html; + TQString htmlEquivalent; + TQString html; for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked()) { html = node->note->content()->toHtml("", node->fullPath); if (!html.isEmpty()) @@ -157,12 +157,12 @@ void NoteDrag::serializeHtml(NoteSelection *noteList, KMultipleDrag *multipleDra } if (!htmlEquivalent.isEmpty()) { // Add HTML flavour: - QTextDrag *htmlDrag = new QTextDrag(htmlEquivalent); + TQTextDrag *htmlDrag = new TQTextDrag(htmlEquivalent); htmlDrag->setSubtype("html"); multipleDrag->addDragObject(htmlDrag); - // But also QTextEdit flavour, to be able to paste several notes to a text edit: - QByteArray byteArray = ("<!--StartFragment--><p>" + htmlEquivalent).local8Bit(); - QStoredDrag *richTextDrag = new QStoredDrag("application/x-qrichtext"); + // But also TQTextEdit flavour, to be able to paste several notes to a text edit: + TQByteArray byteArray = ("<!--StartFragment--><p>" + htmlEquivalent).local8Bit(); + TQStoredDrag *richTextDrag = new TQStoredDrag("application/x-qrichtext"); richTextDrag->setEncodedData(byteArray); multipleDrag->addDragObject(richTextDrag); } @@ -170,37 +170,37 @@ void NoteDrag::serializeHtml(NoteSelection *noteList, KMultipleDrag *multipleDra void NoteDrag::serializeImage(NoteSelection *noteList, KMultipleDrag *multipleDrag) { - QValueList<QPixmap> pixmaps; - QPixmap pixmap; + TQValueList<TQPixmap> pixmaps; + TQPixmap pixmap; for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked()) { pixmap = node->note->content()->toPixmap(); if (!pixmap.isNull()) pixmaps.append(pixmap); } if (!pixmaps.isEmpty()) { - QPixmap pixmapEquivalent; + TQPixmap pixmapEquivalent; if (pixmaps.count() == 1) pixmapEquivalent = pixmaps[0]; else { // Search the total size: int height = 0; int width = 0; - for (QValueList<QPixmap>::iterator it = pixmaps.begin(); it != pixmaps.end(); ++it) { + for (TQValueList<TQPixmap>::iterator it = pixmaps.begin(); it != pixmaps.end(); ++it) { height += (*it).height(); if ((*it).width() > width) width = (*it).width(); } // Create the image by painting all image into one big image: pixmapEquivalent.resize(width, height); - pixmapEquivalent.fill(Qt::white); - QPainter painter(&pixmapEquivalent); + pixmapEquivalent.fill(TQt::white); + TQPainter painter(&pixmapEquivalent); height = 0; - for (QValueList<QPixmap>::iterator it = pixmaps.begin(); it != pixmaps.end(); ++it) { + for (TQValueList<TQPixmap>::iterator it = pixmaps.begin(); it != pixmaps.end(); ++it) { painter.drawPixmap(0, height, *it); height += (*it).height(); } } - QImageDrag *imageDrag = new QImageDrag(pixmapEquivalent.convertToImage()); + TQImageDrag *imageDrag = new TQImageDrag(pixmapEquivalent.convertToImage()); multipleDrag->addDragObject(imageDrag); } } @@ -208,9 +208,9 @@ void NoteDrag::serializeImage(NoteSelection *noteList, KMultipleDrag *multipleDr void NoteDrag::serializeLinks(NoteSelection *noteList, KMultipleDrag *multipleDrag, bool cutting) { KURL::List urls; - QStringList titles; + TQStringList titles; KURL url; - QString title; + TQString title; for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked()) { node->note->content()->toLink(&url, &title, node->fullPath); if (!url.isEmpty()) { @@ -227,8 +227,8 @@ void NoteDrag::serializeLinks(NoteSelection *noteList, KMultipleDrag *multipleDr multipleDrag->addDragObject(urlsDrag); #else KURLDrag2 *urlsDrag = new KURLDrag2(urls); - QByteArray byteArray = urlsDrag->encodedData2("text/uri-list"); - QStoredDrag *uriListDrag = new QStoredDrag("text/uri-list"); + TQByteArray byteArray = urlsDrag->tqencodedData2("text/uri-list"); + TQStoredDrag *uriListDrag = new TQStoredDrag("text/uri-list"); uriListDrag->setEncodedData(byteArray); multipleDrag->addDragObject(uriListDrag); delete urlsDrag; @@ -237,22 +237,22 @@ void NoteDrag::serializeLinks(NoteSelection *noteList, KMultipleDrag *multipleDr // A version for Mozilla applications (convert to "theUrl\ntheTitle", into UTF-16): // FIXME: Does Mozilla support the drag of several URLs at once? // FIXME: If no, only provide that if theire is only ONE URL. - QString xMozUrl; + TQString xMozUrl; for (uint i = 0; i < urls.count(); ++i) xMozUrl += (xMozUrl.isEmpty() ? "" : "\n") + urls[i].prettyURL() + "\n" + titles[i]; /* Code for only one: =============== xMozUrl = note->title() + "\n" + note->url().prettyURL();*/ - QByteArray baMozUrl; - QTextStream stream(baMozUrl, IO_WriteOnly); - stream.setEncoding(QTextStream::RawUnicode); // It's UTF16 (aka UCS2), but with the first two order bytes + TQByteArray baMozUrl; + TQTextStream stream(baMozUrl, IO_WriteOnly); + stream.setEncoding(TQTextStream::RawUnicode); // It's UTF16 (aka UCS2), but with the first two order bytes stream << xMozUrl; - QStoredDrag *xMozUrlDrag = new QStoredDrag("text/x-moz-url"); + TQStoredDrag *xMozUrlDrag = new TQStoredDrag("text/x-moz-url"); xMozUrlDrag->setEncodedData(baMozUrl); multipleDrag->addDragObject(xMozUrlDrag); if (cutting) { - QByteArray arrayCut(2); - QStoredDrag *storedDragCut = new QStoredDrag("application/x-kde-cutselection"); + TQByteArray arrayCut(2); + TQStoredDrag *storedDragCut = new TQStoredDrag("application/x-kde-cutselection"); arrayCut[0] = '1'; arrayCut[1] = 0; storedDragCut->setEncodedData(arrayCut); @@ -263,37 +263,37 @@ void NoteDrag::serializeLinks(NoteSelection *noteList, KMultipleDrag *multipleDr void NoteDrag::setFeedbackPixmap(NoteSelection *noteList, KMultipleDrag *multipleDrag) { - QPixmap pixmap = feedbackPixmap(noteList); + TQPixmap pixmap = feedbackPixmap(noteList); if (!pixmap.isNull()) - multipleDrag->setPixmap(pixmap, QPoint(-8, -8)); + multipleDrag->setPixmap(pixmap, TQPoint(-8, -8)); } -QPixmap NoteDrag::feedbackPixmap(NoteSelection *noteList) +TQPixmap NoteDrag::feedbackPixmap(NoteSelection *noteList) { if (noteList == 0) - return QPixmap(); + return TQPixmap(); static const int MARGIN = 2; static const int SPACING = 1; - QColor textColor = noteList->firstStacked()->note->basket()->textColor(); - QColor backgroundColor = noteList->firstStacked()->note->basket()->backgroundColor().dark(NoteContent::FEEDBACK_DARKING); + TQColor textColor = noteList->firstStacked()->note->basket()->textColor(); + TQColor backgroundColor = noteList->firstStacked()->note->basket()->backgroundColor().dark(NoteContent::FEEDBACK_DARKING); - QValueList<QPixmap> pixmaps; - QValueList<QColor> backgrounds; - QValueList<bool> spaces; - QPixmap pixmap; + TQValueList<TQPixmap> pixmaps; + TQValueList<TQColor> backgrounds; + TQValueList<bool> spaces; + TQPixmap pixmap; int height = 0; int width = 0; int i = 0; bool elipsisImage = false; - QColor bgColor; + TQColor bgColor; bool needSpace; for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked(), ++i) { if (elipsisImage) { - pixmap = QPixmap(7, 2); + pixmap = TQPixmap(7, 2); pixmap.fill(backgroundColor); - QPainter painter(&pixmap); + TQPainter painter(&pixmap); painter.setPen(textColor); painter.drawPoint(1, 1); painter.drawPoint(3, 1); @@ -320,13 +320,13 @@ QPixmap NoteDrag::feedbackPixmap(NoteSelection *noteList) } } if (!pixmaps.isEmpty()) { - QPixmap result(MARGIN + width + MARGIN, MARGIN + height - SPACING + MARGIN - (spaces.last() ? 1 : 0)); - QPainter painter(&result); + TQPixmap result(MARGIN + width + MARGIN, MARGIN + height - SPACING + MARGIN - (spaces.last() ? 1 : 0)); + TQPainter painter(&result); // Draw all the images: height = MARGIN; - QValueList<QPixmap>::iterator it; - QValueList<QColor>::iterator it2; - QValueList<bool>::iterator it3; + TQValueList<TQPixmap>::iterator it; + TQValueList<TQColor>::iterator it2; + TQValueList<bool>::iterator it3; int i = 0; for (it = pixmaps.begin(), it2 = backgrounds.begin(), it3 = spaces.begin(); it != pixmaps.end(); ++it, ++it2, ++it3, ++i) { if (i != 0 && (*it3)) { @@ -362,41 +362,41 @@ QPixmap NoteDrag::feedbackPixmap(NoteSelection *noteList) painter.drawLine(1, result.height() - 2, result.width() - 2, result.height() - 2); painter.drawLine(result.width() - 2, 1, result.width() - 2, result.height() - 2); // And assign the feedback pixmap to the drag object: - //multipleDrag->setPixmap(result, QPoint(-8, -8)); + //multipleDrag->setPixmap(result, TQPoint(-8, -8)); return result; } - return QPixmap(); + return TQPixmap(); } -bool NoteDrag::canDecode(QMimeSource *source) +bool NoteDrag::canDecode(TQMimeSource *source) { return source->provides(NOTE_MIME_STRING); } -Basket* NoteDrag::basketOf(QMimeSource *source) +Basket* NoteDrag::basketOf(TQMimeSource *source) { - QBuffer buffer(source->encodedData(NOTE_MIME_STRING)); + TQBuffer buffer(source->tqencodedData(NOTE_MIME_STRING)); if (buffer.open(IO_ReadOnly)) { - QDataStream stream(&buffer); - // Get the parent basket: - Q_UINT64 basketPointer; - stream >> (Q_UINT64&)basketPointer; + TQDataStream stream(&buffer); + // Get the tqparent basket: + TQ_UINT64 basketPointer; + stream >> (TQ_UINT64&)basketPointer; return (Basket*)basketPointer; } else return 0; } -QValueList<Note*> NoteDrag::notesOf(QMimeSource *source) +TQValueList<Note*> NoteDrag::notesOf(TQMimeSource *source) { - QBuffer buffer(source->encodedData(NOTE_MIME_STRING)); + TQBuffer buffer(source->tqencodedData(NOTE_MIME_STRING)); if (buffer.open(IO_ReadOnly)) { - QDataStream stream(&buffer); - // Get the parent basket: - Q_UINT64 basketPointer; - stream >> (Q_UINT64&)basketPointer; + TQDataStream stream(&buffer); + // Get the tqparent basket: + TQ_UINT64 basketPointer; + stream >> (TQ_UINT64&)basketPointer; // Get the note list: - Q_UINT64 notePointer; - QValueList<Note*> notes; + TQ_UINT64 notePointer; + TQValueList<Note*> notes; do { stream >> notePointer; if (notePointer != 0) @@ -405,28 +405,28 @@ QValueList<Note*> NoteDrag::notesOf(QMimeSource *source) // Done: return notes; } else - return QValueList<Note*>(); + return TQValueList<Note*>(); } -Note* NoteDrag::decode(QMimeSource *source, Basket *parent, bool moveFiles, bool moveNotes) +Note* NoteDrag::decode(TQMimeSource *source, Basket *tqparent, bool moveFiles, bool moveNotes) { - QBuffer buffer(source->encodedData(NOTE_MIME_STRING)); + TQBuffer buffer(source->tqencodedData(NOTE_MIME_STRING)); if (buffer.open(IO_ReadOnly)) { - QDataStream stream(&buffer); - // Get the parent basket: - Q_UINT64 basketPointer; - stream >> (Q_UINT64&)basketPointer; + TQDataStream stream(&buffer); + // Get the tqparent basket: + TQ_UINT64 basketPointer; + stream >> (TQ_UINT64&)basketPointer; Basket *basket = (Basket*)basketPointer; // Get the note list: - Q_UINT64 notePointer; - QValueList<Note*> notes; + TQ_UINT64 notePointer; + TQValueList<Note*> notes; do { stream >> notePointer; if (notePointer != 0) notes.append((Note*)notePointer); } while (notePointer); // Decode the note hierarchy: - Note *hierarchy = decodeHierarchy(stream, parent, moveFiles, moveNotes, basket); + Note *hierarchy = decodeHierarchy(stream, tqparent, moveFiles, moveNotes, basket); // In case we moved notes from one basket to another, save the source basket where notes were removed: basket->filterAgainDelayed(); // Delayed, because if a note is moved to the same basket, the note is not at its basket->save(); // new position yet, and the call to ensureNoteVisible would make the interface flicker!! @@ -435,14 +435,14 @@ Note* NoteDrag::decode(QMimeSource *source, Basket *parent, bool moveFiles, bool return 0; } -Note* NoteDrag::decodeHierarchy(QDataStream &stream, Basket *parent, bool moveFiles, bool moveNotes, Basket *originalBasket) +Note* NoteDrag::decodeHierarchy(TQDataStream &stream, Basket *tqparent, bool moveFiles, bool moveNotes, Basket *originalBasket) { - Q_UINT64 notePointer; - Q_UINT64 type; - QString fileName; - QString fullPath; - QDateTime addedDate; - QDateTime lastModificationDate; + TQ_UINT64 notePointer; + TQ_UINT64 type; + TQString fileName; + TQString fullPath; + TQDateTime addedDate; + TQDateTime lastModificationDate; Note *firstNote = 0; // TODO: class NoteTreeChunk Note *lastInserted = 0; @@ -454,12 +454,12 @@ Note* NoteDrag::decodeHierarchy(QDataStream &stream, Basket *parent, bool moveFi Note *oldNote = (Note*)notePointer; Note *note = 0; - Q_UINT64 groupWidth; + TQ_UINT64 groupWidth; stream >> type >> groupWidth; if (type == NoteType::Group) { - note = new Note(parent); + note = new Note(tqparent); note->setGroupWidth(groupWidth); - Q_UINT64 isFolded; + TQ_UINT64 isFolded; stream >> isFolded; if (isFolded) note->toggleFolded(/*animate=*/false); @@ -468,7 +468,7 @@ Note* NoteDrag::decodeHierarchy(QDataStream &stream, Basket *parent, bool moveFi note->setY(oldNote->y()); // We just set the position of the copied group so the animation seems as if the group is the same as (or a copy of) the old. note->setHeight(oldNote->height()); // Idem: the only use of Note::setHeight() } - Note* childs = decodeHierarchy(stream, parent, moveFiles, moveNotes, originalBasket); + Note* childs = decodeHierarchy(stream, tqparent, moveFiles, moveNotes, originalBasket); if (childs) { for (Note *n = childs; n; n = n->next()) n->setParentNote(note); @@ -479,21 +479,21 @@ Note* NoteDrag::decodeHierarchy(QDataStream &stream, Basket *parent, bool moveFi if (moveNotes) { originalBasket->unplugNote(oldNote); note = oldNote; - if (note->basket() != parent) { - QString newFileName = NoteFactory::createFileForNewNote(parent, "", fileName); + if (note->basket() != tqparent) { + TQString newFileName = NoteFactory::createFileForNewNote(tqparent, "", fileName); note->content()->setFileName(newFileName); - KIO::FileCopyJob *copyJob = KIO::file_move(KURL(fullPath), KURL(parent->fullPath() + newFileName), + KIO::FileCopyJob *copyJob = KIO::file_move(KURL(fullPath), KURL(tqparent->fullPath() + newFileName), /*perms=*/-1, /*override=*/true, /*resume=*/false, /*showProgressInfo=*/false); - parent->connect( copyJob, SIGNAL(result(KIO::Job *)), - parent, SLOT(slotCopyingDone2(KIO::Job *)) ); + tqparent->connect( copyJob, TQT_SIGNAL(result(KIO::Job *)), + tqparent, TQT_SLOT(slotCopyingDone2(KIO::Job *)) ); } note->setGroupWidth(groupWidth); note->setParentNote(0); note->setPrev(0); note->setNext(0); - note->setParentBasket(parent); + note->setParentBasket(tqparent); NoteFactory::consumeContent(stream, (NoteType::Id)type); - } else if ( (note = NoteFactory::decodeContent(stream, (NoteType::Id)type, parent)) ) { + } else if ( (note = NoteFactory::decodeContent(stream, (NoteType::Id)type, tqparent)) ) { note->setGroupWidth(groupWidth); note->setAddedDate(addedDate); note->setLastModificationDate(lastModificationDate); @@ -501,17 +501,17 @@ Note* NoteDrag::decodeHierarchy(QDataStream &stream, Basket *parent, bool moveFi // Here we are CREATING a new EMPTY file, so the name is RESERVED // (while dropping several files at once a filename cannot be used by two of them). // Later on, file_copy/file_move will copy/move the file to the new location. - QString newFileName = NoteFactory::createFileForNewNote(parent, "", fileName); - note = NoteFactory::loadFile(newFileName, (NoteType::Id)type, parent); + TQString newFileName = NoteFactory::createFileForNewNote(tqparent, "", fileName); + note = NoteFactory::loadFile(newFileName, (NoteType::Id)type, tqparent); KIO::FileCopyJob *copyJob; if (moveFiles) - copyJob = KIO::file_move(KURL(fullPath), KURL(parent->fullPath() + newFileName), + copyJob = KIO::file_move(KURL(fullPath), KURL(tqparent->fullPath() + newFileName), /*perms=*/-1, /*override=*/true, /*resume=*/false, /*showProgressInfo=*/false); else - copyJob = KIO::file_copy(KURL(fullPath), KURL(parent->fullPath() + newFileName), + copyJob = KIO::file_copy(KURL(fullPath), KURL(tqparent->fullPath() + newFileName), /*perms=*/-1, /*override=*/true, /*resume=*/false, /*showProgressInfo=*/false); - parent->connect( copyJob, SIGNAL(result(KIO::Job *)), - parent, SLOT(slotCopyingDone2(KIO::Job *)) ); + tqparent->connect( copyJob, TQT_SIGNAL(result(KIO::Job *)), + tqparent, TQT_SLOT(slotCopyingDone2(KIO::Job *)) ); note->setGroupWidth(groupWidth); note->setAddedDate(addedDate); note->setLastModificationDate(lastModificationDate); @@ -519,7 +519,7 @@ Note* NoteDrag::decodeHierarchy(QDataStream &stream, Basket *parent, bool moveFi } // Retreive the states (tags) and assign them to the note: if (note && note->content()) { - Q_UINT64 statePointer; + TQ_UINT64 statePointer; do { stream >> statePointer; if (statePointer) @@ -544,22 +544,22 @@ Note* NoteDrag::decodeHierarchy(QDataStream &stream, Basket *parent, bool moveFi /** ExtendedTextDrag */ -bool ExtendedTextDrag::decode(const QMimeSource *e, QString &str) +bool ExtendedTextDrag::decode(const TQMimeSource *e, TQString &str) { - QCString subtype("plain"); + TQCString subtype("plain"); return decode(e, str, subtype); } -bool ExtendedTextDrag::decode(const QMimeSource *e, QString &str, QCString &subtype) +bool ExtendedTextDrag::decode(const TQMimeSource *e, TQString &str, TQCString &subtype) { // Get the string: - bool ok = QTextDrag::decode(e, str, subtype); + bool ok = TQTextDrag::decode(e, str, subtype); // Test if it was a UTF-16 string (from eg. Mozilla): if (str.length() >= 2) { if ((str[0] == 0xFF && str[1] == 0xFE) || (str[0] == 0xFE && str[1] == 0xFF)) { - QByteArray utf16 = e->encodedData(QString("text/" + subtype).local8Bit()); - str = QTextCodec::codecForName("utf16")->toUnicode(utf16); + TQByteArray utf16 = e->tqencodedData(TQString("text/" + subtype).local8Bit()); + str = TQTextCodec::codecForName("utf16")->toUnicode(utf16); return true; } } @@ -567,23 +567,23 @@ bool ExtendedTextDrag::decode(const QMimeSource *e, QString &str, QCString &subt // Test if it was empty (sometimes, from GNOME or Mozilla) if (str.length() == 0 && subtype == "plain") { if (e->provides("UTF8_STRING")) { - QByteArray utf8 = e->encodedData("UTF8_STRING"); - str = QTextCodec::codecForName("utf8")->toUnicode(utf8); + TQByteArray utf8 = e->tqencodedData("UTF8_STRING"); + str = TQTextCodec::codecForName("utf8")->toUnicode(utf8); return true; } - if (e->provides("text/unicode")) { // FIXME: It's UTF-16 without order bytes!!! - QByteArray utf16 = e->encodedData("text/unicode"); - str = QTextCodec::codecForName("utf16")->toUnicode(utf16); + if (e->provides("text/tqunicode")) { // FIXME: It's UTF-16 without order bytes!!! + TQByteArray utf16 = e->tqencodedData("text/tqunicode"); + str = TQTextCodec::codecForName("utf16")->toUnicode(utf16); return true; } if (e->provides("TEXT")) { // local encoding - QByteArray text = e->encodedData("TEXT"); - str = QString(text); + TQByteArray text = e->tqencodedData("TEXT"); + str = TQString(text); return true; } if (e->provides("COMPOUND_TEXT")) { // local encoding - QByteArray text = e->encodedData("COMPOUND_TEXT"); - str = QString(text); + TQByteArray text = e->tqencodedData("COMPOUND_TEXT"); + str = TQString(text); return true; } } |