diff options
Diffstat (limited to 'bibletime/frontend/cdragdropmgr.cpp')
-rw-r--r-- | bibletime/frontend/cdragdropmgr.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/bibletime/frontend/cdragdropmgr.cpp b/bibletime/frontend/cdragdropmgr.cpp index c014eed..5c8cb7b 100644 --- a/bibletime/frontend/cdragdropmgr.cpp +++ b/bibletime/frontend/cdragdropmgr.cpp @@ -20,15 +20,15 @@ #include "versekey.h" //Qt includes -#include <qevent.h> -#include <qdom.h> +#include <tqevent.h> +#include <tqdom.h> -CDragDropMgr::BTDrag::BTDrag( const QString& xml, QWidget* dragSource, const char* name) -: QTextDrag(xml, dragSource, name) {} +CDragDropMgr::BTDrag::BTDrag( const TQString& xml, TQWidget* dragSource, const char* name) +: TQTextDrag(xml, dragSource, name) {} ; //static function to see whether we can decode tje given mime type -bool CDragDropMgr::BTDrag::canDecode( const QMimeSource * mime ) { +bool CDragDropMgr::BTDrag::canDecode( const TQMimeSource * mime ) { if ( mime->provides("BibleTime/DND") ) { //we can decode this type! return true; } @@ -46,37 +46,37 @@ const char* CDragDropMgr::BTDrag::format( int i ) const { return 0; }; -bool CDragDropMgr::BTDrag::decode(const QMimeSource* e, QString& str) { +bool CDragDropMgr::BTDrag::decode(const TQMimeSource* e, TQString& str) { if (canDecode(e)) { - str = QString( e->encodedData( "BibleTime/DND" ) ); + str = TQString( e->encodedData( "BibleTime/DND" ) ); return true; } return false; }; -bool CDragDropMgr::BTDrag::decode(const QMimeSource* e, QString& str, QCString& /*subtype*/) { +bool CDragDropMgr::BTDrag::decode(const TQMimeSource* e, TQString& str, TQCString& /*subtype*/) { return decode(e, str); }; -QByteArray CDragDropMgr::BTDrag::encodedData( const char* /*type*/ ) const { - return QTextDrag::encodedData("text/plain"); //hack because QTextDrag only accepts text/plainand not our BibleTime/DND type +TQByteArray CDragDropMgr::BTDrag::encodedData( const char* /*type*/ ) const { + return TQTextDrag::encodedData("text/plain"); //hack because TQTextDrag only accepts text/plainand not our BibleTime/DND type }; ///////////////////////////// new class ////////////////////// -CDragDropMgr::Item::Item( const QString& text ) +CDragDropMgr::Item::Item( const TQString& text ) : m_type(Text), -m_bookmarkModuleName(QString::null), -m_bookmarkKey(QString::null), -m_bookmarkDescription(QString::null), +m_bookmarkModuleName(TQString::null), +m_bookmarkKey(TQString::null), +m_bookmarkDescription(TQString::null), m_text(text) {} -CDragDropMgr::Item::Item( const QString& moduleName, const QString& key, const QString& description ) +CDragDropMgr::Item::Item( const TQString& moduleName, const TQString& key, const TQString& description ) : m_type(Bookmark), m_bookmarkModuleName(moduleName), m_bookmarkKey(key), m_bookmarkDescription(description), -m_text(QString::null) { +m_text(TQString::null) { //we have to make sure the key is saved in it's english representation, so we convert it if (CSwordModuleInfo* mod = CPointers::backend()->findModuleByName( moduleName )) { if (mod->type() == CSwordModuleInfo::Bible || mod->type() == CSwordModuleInfo::Commentary) { @@ -98,25 +98,25 @@ const CDragDropMgr::Item::Type& CDragDropMgr::Item::type() const { } /** Returns the text which is used by this DragDrop Item, only valid if type() == Text */ -const QString& CDragDropMgr::Item::text() const { +const TQString& CDragDropMgr::Item::text() const { // Q_ASSERT(!m_text.isEmpty()); return m_text; } /** Returns the key, ony valid if type() == Bookmark */ -const QString& CDragDropMgr::Item::bookmarkKey() const { +const TQString& CDragDropMgr::Item::bookmarkKey() const { // Q_ASSERT(!m_bookmarkKey.isEmpty()); return m_bookmarkKey; } /** Returns the bookmark module, ony valid if type() == Bookmark */ -const QString& CDragDropMgr::Item::bookmarkModule() const { +const TQString& CDragDropMgr::Item::bookmarkModule() const { // Q_ASSERT(!m_bookmarkModuleName.isEmpty()); return m_bookmarkModuleName; } /** Returns the bookmark description, ony valid if type() == Bookmark */ -const QString& CDragDropMgr::Item::bookmarkDescription() const { +const TQString& CDragDropMgr::Item::bookmarkDescription() const { // Q_ASSERT(!m_bookmarkDescription.isEmpty()); return m_bookmarkDescription; } @@ -127,23 +127,23 @@ CDragDropMgr::CDragDropMgr() {} CDragDropMgr::~CDragDropMgr() {} -const bool CDragDropMgr::canDecode( const QMimeSource* const mime ) { +const bool CDragDropMgr::canDecode( const TQMimeSource* const mime ) { if (CDragDropMgr::BTDrag::canDecode(mime)) { return true; } - else if( QTextDrag::canDecode(mime) ) { - qWarning("QTextDrag can decode this mime!"); + else if( TQTextDrag::canDecode(mime) ) { + qWarning("TQTextDrag can decode this mime!"); return true; }; return false; }; -QDragObject* const CDragDropMgr::dragObject( CDragDropMgr::ItemList& items, QWidget* dragSource ) { +TQDragObject* const CDragDropMgr::dragObject( CDragDropMgr::ItemList& items, TQWidget* dragSource ) { if ( items.count() ) { //process the items and set the data to the dragobject we return later - QDomDocument doc("DOC"); + TQDomDocument doc("DOC"); doc.appendChild( doc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) ); - QDomElement content = doc.createElement("BibleTimeDND"); + TQDomElement content = doc.createElement("BibleTimeDND"); content.setAttribute("syntaxVersion", "1.0"); doc.appendChild(content); @@ -152,7 +152,7 @@ QDragObject* const CDragDropMgr::dragObject( CDragDropMgr::ItemList& items, QWid Item item = (*it); if (item.type() == Item::Bookmark) { //a bookmark was dragged //append the XML stuff for a bookmark - QDomElement bookmark = doc.createElement("BOOKMARK"); + TQDomElement bookmark = doc.createElement("BOOKMARK"); bookmark.setAttribute("key", item.bookmarkKey()); bookmark.setAttribute("description", item.bookmarkDescription()); bookmark.setAttribute("moduleName", item.bookmarkModule()); @@ -161,7 +161,7 @@ QDragObject* const CDragDropMgr::dragObject( CDragDropMgr::ItemList& items, QWid } else if (item.type() == Item::Text) { //plain text was dragged //append the XML stuff for plain text - QDomElement plainText = doc.createElement("TEXT"); + TQDomElement plainText = doc.createElement("TEXT"); plainText.setAttribute("text", item.text()); content.appendChild(plainText); @@ -175,11 +175,11 @@ QDragObject* const CDragDropMgr::dragObject( CDragDropMgr::ItemList& items, QWid return 0; }; -CDragDropMgr::ItemList CDragDropMgr::decode( const QMimeSource* const src) { - //if the drag was started by another widget which doesn't use CDragDropMgr (a drag created by QTextDrag) - if (canDecode(src) && QTextDrag::canDecode(src)) { //if we can decode but it's a QTextDrag and not a BTDrag object - QString text; - QTextDrag::decode(src, text); +CDragDropMgr::ItemList CDragDropMgr::decode( const TQMimeSource* const src) { + //if the drag was started by another widget which doesn't use CDragDropMgr (a drag created by TQTextDrag) + if (canDecode(src) && TQTextDrag::canDecode(src)) { //if we can decode but it's a TQTextDrag and not a BTDrag object + TQString text; + TQTextDrag::decode(src, text); // qWarning(text.latin1()); CDragDropMgr::ItemList dndItems; @@ -190,7 +190,7 @@ CDragDropMgr::ItemList CDragDropMgr::decode( const QMimeSource* const src) { return CDragDropMgr::ItemList(); }; - QString xmlData; + TQString xmlData; BTDrag::decode(src, xmlData); if (xmlData.isEmpty()) { //something went wrong! @@ -204,27 +204,27 @@ CDragDropMgr::ItemList CDragDropMgr::decode( const QMimeSource* const src) { //we can handle the dropEvent and have xml data to work on! ItemList dndItems; - QDomDocument doc; + TQDomDocument doc; doc.setContent( xmlData ); - QDomElement document = doc.documentElement(); + TQDomElement document = doc.documentElement(); if( document.tagName() != "BibleTimeDND" ) { //BibleTime was used in syntax version 1.0 qWarning("DragDropMgr::decode: Missing BibleTimeDND doc"); return CDragDropMgr::ItemList(); } // see if there's a section with the name MAINWINDOW - QDomElement elem = document.firstChild().toElement(); + TQDomElement elem = document.firstChild().toElement(); while (!elem.isNull()) { if (elem.tagName() == "BOOKMARK") { //we found a bookmark! // qWarning("found a bookmark!"); - const QString key = elem.hasAttribute("key") ? elem.attribute("key") : QString::null; - const QString moduleName = elem.hasAttribute("moduleName") ? elem.attribute("moduleName") : QString::null; - const QString description = elem.hasAttribute("description") ? elem.attribute("description") : QString::null; + const TQString key = elem.hasAttribute("key") ? elem.attribute("key") : TQString::null; + const TQString moduleName = elem.hasAttribute("moduleName") ? elem.attribute("moduleName") : TQString::null; + const TQString description = elem.hasAttribute("description") ? elem.attribute("description") : TQString::null; dndItems.append( CDragDropMgr::Item(moduleName, key, description) ); } else if (elem.tagName() == "TEXT") { //we found a plain text passage! - const QString text = elem.hasAttribute("text") ? elem.attribute("text") : QString::null; + const TQString text = elem.hasAttribute("text") ? elem.attribute("text") : TQString::null; dndItems.append( CDragDropMgr::Item(text) ); }; elem = elem.nextSibling().toElement(); @@ -234,7 +234,7 @@ CDragDropMgr::ItemList CDragDropMgr::decode( const QMimeSource* const src) { }; /** Returns which type the given drop event has, if it's a mixed one (both bookmarks and plain text), which shouldn't happen, it return Item::Unknown. */ -CDragDropMgr::Item::Type CDragDropMgr::dndType( const QMimeSource* e ) { +CDragDropMgr::Item::Type CDragDropMgr::dndType( const TQMimeSource* e ) { ItemList dndItems = decode(e); if (dndItems.isEmpty()) {//wrong dropEvent or something strange return Item::Unknown; |