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 /tools/kfile-plugins | |
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 'tools/kfile-plugins')
-rw-r--r-- | tools/kfile-plugins/abiword/kfile_abiword.cpp | 44 | ||||
-rw-r--r-- | tools/kfile-plugins/abiword/kfile_abiword.h | 9 | ||||
-rw-r--r-- | tools/kfile-plugins/gnumeric/kfile_gnumeric.cpp | 40 | ||||
-rw-r--r-- | tools/kfile-plugins/gnumeric/kfile_gnumeric.h | 9 | ||||
-rw-r--r-- | tools/kfile-plugins/koffice/kfile_koffice.cpp | 38 | ||||
-rw-r--r-- | tools/kfile-plugins/koffice/kfile_koffice.h | 11 | ||||
-rw-r--r-- | tools/kfile-plugins/ooo/kfile_ooo.cpp | 168 | ||||
-rw-r--r-- | tools/kfile-plugins/ooo/kfile_ooo.h | 49 |
8 files changed, 186 insertions, 182 deletions
diff --git a/tools/kfile-plugins/abiword/kfile_abiword.cpp b/tools/kfile-plugins/abiword/kfile_abiword.cpp index 2b1b0cad..f643a649 100644 --- a/tools/kfile-plugins/abiword/kfile_abiword.cpp +++ b/tools/kfile-plugins/abiword/kfile_abiword.cpp @@ -24,19 +24,19 @@ #include <kgenericfactory.h> #include <kfilterdev.h> -#include <qdom.h> -#include <qfile.h> -#include <qdatetime.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqdatetime.h> #include <kdebug.h> typedef KGenericFactory<AbiwordPlugin> AbiwordFactory; K_EXPORT_COMPONENT_FACTORY(kfile_abiword, AbiwordFactory( "kfile_abiword" )) -AbiwordPlugin::AbiwordPlugin(QObject *parent, const char *name, - const QStringList &args) +AbiwordPlugin::AbiwordPlugin(TQObject *tqparent, const char *name, + const TQStringList &args) - : KFilePlugin(parent, name, args) + : KFilePlugin(tqparent, name, args) { init(); } @@ -51,11 +51,11 @@ void AbiwordPlugin::init() KFileMimeTypeInfo::ItemInfo* item; - item = addItemInfo(group, "Author", i18n("Author"), QVariant::String); + item = addItemInfo(group, "Author", i18n("Author"), TQVariant::String); setHint(item, KFileMimeTypeInfo::Author); - item = addItemInfo(group, "Title", i18n("Title"), QVariant::String); + item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); setHint(item, KFileMimeTypeInfo::Name); - item = addItemInfo(group, "Abstract", i18n("Abstract"), QVariant::String); + item = addItemInfo(group, "Abstract", i18n("Abstract"), TQVariant::String); setHint(item, KFileMimeTypeInfo::Description); } @@ -65,13 +65,13 @@ bool AbiwordPlugin::readInfo( KFileMetaInfo& info, uint what) return false; //Find the last extension - QString strExt; - const int result=info.path().findRev('.'); + TQString strExt; + const int result=info.path().tqfindRev('.'); if (result>=0) { strExt=info.path().mid(result); } - QString strMime; // Mime type of the compressor (default: unknown) + TQString strMime; // Mime type of the compressor (default: unknown) if ((strExt==".gz")||(strExt==".GZ") //in case of .abw.gz (logical extension) ||(strExt==".zabw")||(strExt==".ZABW")) //in case of .zabw (extension used prioritary with AbiWord) { @@ -88,7 +88,7 @@ bool AbiwordPlugin::readInfo( KFileMetaInfo& info, uint what) } KFileMetaInfoGroup group = appendGroup(info, "DocumentInfo"); - QIODevice* in = KFilterDev::deviceForFile(info.path(),strMime); + TQIODevice* in = KFilterDev::deviceForFile(info.path(),strMime); if ( !in ) { kdError() << "Cannot create device for uncompressing! Aborting!" << endl; @@ -101,21 +101,21 @@ bool AbiwordPlugin::readInfo( KFileMetaInfo& info, uint what) delete in; return false; } - QDomDocument doc; + TQDomDocument doc; doc.setContent( in ); in->close(); - QDomElement docElem = doc.documentElement(); - QDomNode summary = docElem.namedItem("metadata"); - QDomNode m_item = summary.namedItem("m"); + TQDomElement docElem = doc.documentElement(); + TQDomNode summary = docElem.namedItem("metadata"); + TQDomNode m_item = summary.namedItem("m"); - QString author; - QString title; - QString abstract; + TQString author; + TQString title; + TQString abstract; while( !m_item.isNull() ) { kdDebug()<<" m_item.toElement().text: "<<m_item.toElement().text()<<endl; - QString key = m_item.toElement().attribute( "key" ); + TQString key = m_item.toElement().attribute( "key" ); if ( key.isEmpty() ) continue; else if ( key=="dc.creator" ) @@ -136,7 +136,7 @@ bool AbiwordPlugin::readInfo( KFileMetaInfo& info, uint what) return true; } -QString AbiwordPlugin::stringItem( const QString &name ) +TQString AbiwordPlugin::stringItem( const TQString &name ) { return name.isEmpty() ? i18n("*Unknown*") : name; } diff --git a/tools/kfile-plugins/abiword/kfile_abiword.h b/tools/kfile-plugins/abiword/kfile_abiword.h index 33ee9c63..4aa3a837 100644 --- a/tools/kfile-plugins/abiword/kfile_abiword.h +++ b/tools/kfile-plugins/abiword/kfile_abiword.h @@ -22,21 +22,22 @@ #include <kfilemetainfo.h> -class QStringList; -class QDomNode; +class TQStringList; +class TQDomNode; class AbiwordPlugin: public KFilePlugin { Q_OBJECT + TQ_OBJECT public: - AbiwordPlugin( QObject *parent, const char *name, const QStringList& args ); + AbiwordPlugin( TQObject *tqparent, const char *name, const TQStringList& args ); virtual bool readInfo( KFileMetaInfo& info, uint what); private: void init(); - QString stringItem( const QString &name ); + TQString stringItem( const TQString &name ); }; #endif diff --git a/tools/kfile-plugins/gnumeric/kfile_gnumeric.cpp b/tools/kfile-plugins/gnumeric/kfile_gnumeric.cpp index 8d4b7928..ad29c130 100644 --- a/tools/kfile-plugins/gnumeric/kfile_gnumeric.cpp +++ b/tools/kfile-plugins/gnumeric/kfile_gnumeric.cpp @@ -24,19 +24,19 @@ #include <kgenericfactory.h> #include <kfilterdev.h> -#include <qdom.h> -#include <qfile.h> -#include <qdatetime.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqdatetime.h> #include <kdebug.h> typedef KGenericFactory<GnumericPlugin> GnumericFactory; K_EXPORT_COMPONENT_FACTORY(kfile_gnumeric, GnumericFactory( "kfile_gnumeric" )) -GnumericPlugin::GnumericPlugin(QObject *parent, const char *name, - const QStringList &args) +GnumericPlugin::GnumericPlugin(TQObject *tqparent, const char *name, + const TQStringList &args) - : KFilePlugin(parent, name, args) + : KFilePlugin(tqparent, name, args) { init(); } @@ -51,11 +51,11 @@ void GnumericPlugin::init() KFileMimeTypeInfo::ItemInfo* item; - item = addItemInfo(group, "Author", i18n("Author"), QVariant::String); + item = addItemInfo(group, "Author", i18n("Author"), TQVariant::String); setHint(item, KFileMimeTypeInfo::Author); - item = addItemInfo(group, "Title", i18n("Title"), QVariant::String); + item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); setHint(item, KFileMimeTypeInfo::Name); - item = addItemInfo(group, "Abstract", i18n("Abstract"), QVariant::String); + item = addItemInfo(group, "Abstract", i18n("Abstract"), TQVariant::String); setHint(item, KFileMimeTypeInfo::Description); } @@ -65,7 +65,7 @@ bool GnumericPlugin::readInfo( KFileMetaInfo& info, uint what) return false; KFileMetaInfoGroup group = appendGroup(info, "DocumentInfo"); - QIODevice* in = KFilterDev::deviceForFile(info.path(),"application/x-gzip"); + TQIODevice* in = KFilterDev::deviceForFile(info.path(),"application/x-gzip"); if ( !in ) { kdError() << "Cannot create device for uncompressing! Aborting!" << endl; @@ -78,20 +78,20 @@ bool GnumericPlugin::readInfo( KFileMetaInfo& info, uint what) delete in; return false; } - QDomDocument doc; + TQDomDocument doc; doc.setContent( in ); in->close(); - QDomElement docElem = doc.documentElement(); - QDomNode summary = docElem.namedItem("gmr:Summary"); - QDomNode gmr_item = summary.namedItem("gmr:Item"); - QString author; - QString title; - QString abstract; + TQDomElement docElem = doc.documentElement(); + TQDomNode summary = docElem.namedItem("gmr:Summary"); + TQDomNode gmr_item = summary.namedItem("gmr:Item"); + TQString author; + TQString title; + TQString abstract; while( !gmr_item.isNull() ) { - QDomNode gmr_name = gmr_item.namedItem("gmr:name"); - QDomNode gmr_value = gmr_item.namedItem("gmr:val-string"); + TQDomNode gmr_name = gmr_item.namedItem("gmr:name"); + TQDomNode gmr_value = gmr_item.namedItem("gmr:val-string"); if (gmr_name.toElement().text() == "title") { title=gmr_value.toElement().text(); @@ -114,7 +114,7 @@ bool GnumericPlugin::readInfo( KFileMetaInfo& info, uint what) return true; } -QString GnumericPlugin::stringItem( const QString &name ) +TQString GnumericPlugin::stringItem( const TQString &name ) { return name.isEmpty() ? i18n("*Unknown*") : name; } diff --git a/tools/kfile-plugins/gnumeric/kfile_gnumeric.h b/tools/kfile-plugins/gnumeric/kfile_gnumeric.h index 2df2d200..deeb773c 100644 --- a/tools/kfile-plugins/gnumeric/kfile_gnumeric.h +++ b/tools/kfile-plugins/gnumeric/kfile_gnumeric.h @@ -22,21 +22,22 @@ #include <kfilemetainfo.h> -class QStringList; -class QDomNode; +class TQStringList; +class TQDomNode; class GnumericPlugin: public KFilePlugin { Q_OBJECT + TQ_OBJECT public: - GnumericPlugin( QObject *parent, const char *name, const QStringList& args ); + GnumericPlugin( TQObject *tqparent, const char *name, const TQStringList& args ); virtual bool readInfo( KFileMetaInfo& info, uint what); private: void init(); - QString stringItem( const QString &name ); + TQString stringItem( const TQString &name ); }; #endif diff --git a/tools/kfile-plugins/koffice/kfile_koffice.cpp b/tools/kfile-plugins/koffice/kfile_koffice.cpp index 03274251..2ca0b31e 100644 --- a/tools/kfile-plugins/koffice/kfile_koffice.cpp +++ b/tools/kfile-plugins/koffice/kfile_koffice.cpp @@ -25,18 +25,18 @@ #include <KoStore.h> #include <KoStoreDevice.h> -#include <qdom.h> -#include <qfile.h> -#include <qdatetime.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqdatetime.h> typedef KGenericFactory<KOfficePlugin> KOfficeFactory; K_EXPORT_COMPONENT_FACTORY(kfile_koffice, KOfficeFactory( "kfile_koffice" )) -KOfficePlugin::KOfficePlugin(QObject *parent, const char *name, - const QStringList &args) +KOfficePlugin::KOfficePlugin(TQObject *tqparent, const char *name, + const TQStringList &args) - : KFilePlugin(parent, name, args) + : KFilePlugin(tqparent, name, args) { makeMimeTypeInfo( "application/x-kword" ); makeMimeTypeInfo( "application/x-kpresenter" ); @@ -55,7 +55,7 @@ KOfficePlugin::KOfficePlugin(QObject *parent, const char *name, makeMimeTypeInfo( "application/vnd.kde.kontour" );*/ } -void KOfficePlugin::makeMimeTypeInfo(const QString& mimeType) +void KOfficePlugin::makeMimeTypeInfo(const TQString& mimeType) { KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType ); @@ -65,11 +65,11 @@ void KOfficePlugin::makeMimeTypeInfo(const QString& mimeType) KFileMimeTypeInfo::ItemInfo* item; - item = addItemInfo(group, "Author", i18n("Author"), QVariant::String); + item = addItemInfo(group, "Author", i18n("Author"), TQVariant::String); setHint(item, KFileMimeTypeInfo::Author); - item = addItemInfo(group, "Title", i18n("Title"), QVariant::String); + item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); setHint(item, KFileMimeTypeInfo::Name); - item = addItemInfo(group, "Abstract", i18n("Abstract"), QVariant::String); + item = addItemInfo(group, "Abstract", i18n("Abstract"), TQVariant::String); setHint(item, KFileMimeTypeInfo::Description); } @@ -81,18 +81,18 @@ bool KOfficePlugin::readInfo( KFileMetaInfo& info, uint what) KFileMetaInfoGroup group = appendGroup(info, "DocumentInfo"); KoStore* store = KoStore::createStore(info.path(), KoStore::Read); - if ( store && store->open( QString("documentinfo.xml") ) ) + if ( store && store->open( TQString("documentinfo.xml") ) ) { KoStoreDevice dev( store ); - QDomDocument doc; + TQDomDocument doc; doc.setContent( &dev ); - QDomNode authorNode = doc.namedItem("document-info").namedItem("author"); - QDomNode aboutNode = doc.namedItem("document-info").namedItem("about"); + TQDomNode authorNode = doc.namedItem("document-info").namedItem("author"); + TQDomNode aboutNode = doc.namedItem("document-info").namedItem("about"); - QString author = stringFromNode(authorNode, "full-name"); - QString title = stringFromNode(aboutNode, "title"); - QString abstract = stringFromNode(aboutNode, "abstract"); + TQString author = stringFromNode(authorNode, "full-name"); + TQString title = stringFromNode(aboutNode, "title"); + TQString abstract = stringFromNode(aboutNode, "abstract"); appendItem(group, "Author", author); appendItem(group, "Title", title); @@ -106,9 +106,9 @@ bool KOfficePlugin::readInfo( KFileMetaInfo& info, uint what) return false; } -QString KOfficePlugin::stringFromNode(const QDomNode &node, const QString &name) +TQString KOfficePlugin::stringFromNode(const TQDomNode &node, const TQString &name) { - QString value = node.namedItem(name).toElement().text(); + TQString value = node.namedItem(name).toElement().text(); return value.isEmpty() ? i18n("*Unknown*") : value; } diff --git a/tools/kfile-plugins/koffice/kfile_koffice.h b/tools/kfile-plugins/koffice/kfile_koffice.h index e5a60c1a..6139570f 100644 --- a/tools/kfile-plugins/koffice/kfile_koffice.h +++ b/tools/kfile-plugins/koffice/kfile_koffice.h @@ -22,21 +22,22 @@ #include <kfilemetainfo.h> -class QStringList; -class QDomNode; +class TQStringList; +class TQDomNode; class KOfficePlugin: public KFilePlugin { Q_OBJECT + TQ_OBJECT public: - KOfficePlugin( QObject *parent, const char *name, const QStringList& args ); + KOfficePlugin( TQObject *tqparent, const char *name, const TQStringList& args ); virtual bool readInfo( KFileMetaInfo& info, uint what); private: - void makeMimeTypeInfo(const QString& mimeType); - QString stringFromNode(const QDomNode &node, const QString &name); + void makeMimeTypeInfo(const TQString& mimeType); + TQString stringFromNode(const TQDomNode &node, const TQString &name); }; #endif diff --git a/tools/kfile-plugins/ooo/kfile_ooo.cpp b/tools/kfile-plugins/ooo/kfile_ooo.cpp index 4f16a0af..ee3a5bcc 100644 --- a/tools/kfile-plugins/ooo/kfile_ooo.cpp +++ b/tools/kfile-plugins/ooo/kfile_ooo.cpp @@ -45,12 +45,12 @@ #include <KoStoreDevice.h> #include <kzip.h> #include <ktempfile.h> -#include <qptrstack.h> +#include <tqptrstack.h> -#include <qdom.h> -#include <qfile.h> -#include <qdatetime.h> -#include <qvalidator.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqdatetime.h> +#include <tqvalidator.h> #include <kdebug.h> #include <kio/netaccess.h> @@ -123,22 +123,22 @@ static const char * metadocstat = "meta:document-statistic"; static const char * metaname = "meta:name" ; static const char * metauserdef = "meta:user-defined"; static const char * metafile = "meta.xml" ; -KOfficePlugin::KOfficePlugin(QObject *parent, const char *name, - const QStringList &args) +KOfficePlugin::KOfficePlugin(TQObject *tqparent, const char *name, + const TQStringList &args) - : KFilePlugin(parent, name, args) + : KFilePlugin(tqparent, name, args) { int i = 0; while (mimetypes[i]) makeMimeTypeInfo( mimetypes[i++] ); } -void KOfficePlugin::makeMimeTypeInfo(const QString& mimeType) +void KOfficePlugin::makeMimeTypeInfo(const TQString& mimeType) { KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType ); userdefined = addGroupInfo(info, UserDefined, i18n("User Defined")); - addVariableInfo(userdefined, QVariant::String, + addVariableInfo(userdefined, TQVariant::String, KFileMimeTypeInfo::Addable | KFileMimeTypeInfo::Removable | KFileMimeTypeInfo::Modifiable); @@ -149,7 +149,7 @@ void KOfficePlugin::makeMimeTypeInfo(const QString& mimeType) int i = 0; for (i = 0; Information[i]; i+=2){ item = addItemInfo(group, Information[i], i18n(Information[i+1]), - QVariant::String); + TQVariant::String); setAttributes(item, KFileMimeTypeInfo::Modifiable); switch (i){ case 0: @@ -165,18 +165,18 @@ void KOfficePlugin::makeMimeTypeInfo(const QString& mimeType) } item = addItemInfo(group, metakeyword, i18n("Keywords"), - QVariant::String); + TQVariant::String); setHint(item, KFileMimeTypeInfo::Description); setAttributes(item, KFileMimeTypeInfo::Modifiable); group = addGroupInfo(info, DocAdvanced, i18n("Document Advanced")); for (i = 0; Advanced[i]; i+=2){ // I should add the isDate property instead of testing the index, but it works well, who cares ? :-) - QVariant::Type typ = QVariant::String; + TQVariant::Type typ = TQVariant::String; if (i > 1 && i < 8) - typ = QVariant::DateTime; + typ = TQVariant::DateTime; if (i == 14) - typ = QVariant::String; + typ = TQVariant::String; item = addItemInfo(group, Advanced[i], i18n(Advanced[i+1]), typ); setHint(item, KFileMimeTypeInfo::Description); } @@ -184,7 +184,7 @@ void KOfficePlugin::makeMimeTypeInfo(const QString& mimeType) group = addGroupInfo(info, DocStatistics, i18n("Document Statistics")); for (i = 0; Statistics[i]; i+=2){ item = addItemInfo(group, Statistics[i], i18n(Statistics[i+1]), - QVariant::Int); + TQVariant::Int); setHint(item, KFileMimeTypeInfo::Length); } } @@ -196,7 +196,7 @@ void KOfficePlugin::makeMimeTypeInfo(const QString& mimeType) * @param the position to start to, updated to the next character NAN * @return the number parsed, 0 if number was not valid */ -int getNumber(QString &str, int * pos){ +int getNumber(TQString &str, int * pos){ int k = *pos; for (int len = str.length() ; str.at(k).isNumber() && k < len ; @@ -210,8 +210,8 @@ int getNumber(QString &str, int * pos){ } void KOfficePlugin::getEditingTime(KFileMetaInfoGroup group1, - const char * labelid, QString & txt){ - QString t; + const char * labelid, TQString & txt){ + TQString t; int days = 0; int hours = 0; int minutes = 0; @@ -241,7 +241,7 @@ void KOfficePlugin::getEditingTime(KFileMetaInfoGroup group1, int res = getNumber(txt, &pos); if (pos >= len) return; - switch (txt.at(pos).latin1()){ + switch (txt.tqat(pos).latin1()) { case 'H': hours = res; break; @@ -259,13 +259,13 @@ void KOfficePlugin::getEditingTime(KFileMetaInfoGroup group1, } hours += days * 24; appendItem(group1, labelid, - i18n("%1:%2.%3").arg(hours).arg(minutes, 2).arg(seconds,2 )); + i18n("%1:%2.%3").tqarg(hours).tqarg(minutes, 2).tqarg(seconds,2 )); } void KOfficePlugin::getDateTime(KFileMetaInfoGroup group1, - const char * labelid, QString & txt) + const char * labelid, TQString & txt) { - QDateTime dt = QDateTime::fromString( txt, Qt::ISODate); + TQDateTime dt = TQDateTime::fromString( txt, Qt::ISODate); appendItem( group1, labelid, dt); } @@ -275,20 +275,20 @@ bool KOfficePlugin::readInfo( KFileMetaInfo& info, uint /*what*/) return false; KFileMetaInfoGroup group = appendGroup(info, DocumentInfo); - QDomDocument doc = getMetaDocument(info.path()); + TQDomDocument doc = getMetaDocument(info.path()); if (doc.isNull()) return false; - QDomElement base = getBaseNode(doc).toElement(); + TQDomElement base = getBaseNode(doc).toElement(); if (base.isNull()) return false; for (int i = 0; Information[i]; i+=2) appendItem(group, Information[i], stringFromNode(base, Information[i])); // Special case for keyword - QDomNodeList keywordList = base.elementsByTagName( metakeyword ); - QString allKeywords; + TQDomNodeList keywordList = base.elementsByTagName( metakeyword ); + TQString allKeywords; for (uint i = 0; i < keywordList.length(); i++){ - QDomNode node = keywordList.item(i); + TQDomNode node = keywordList.item(i); if (node.isElement()){ if (i>0) allKeywords += ", "; @@ -300,7 +300,7 @@ bool KOfficePlugin::readInfo( KFileMetaInfo& info, uint /*what*/) KFileMetaInfoGroup group1 = appendGroup(info, DocAdvanced); for (int i = 0; Advanced[i]; i+=2){ - QString txt = stringFromNode(base, Advanced[i]); + TQString txt = stringFromNode(base, Advanced[i]); if (!txt.isEmpty()){ // A silly way to do it... switch (i){ @@ -317,66 +317,66 @@ bool KOfficePlugin::readInfo( KFileMetaInfo& info, uint /*what*/) } } - QDomNode dstat = base.namedItem(metadocstat); + TQDomNode dstat = base.namedItem(metadocstat); KFileMetaInfoGroup group2 = appendGroup(info, DocStatistics); if (!dstat.isNull() && dstat.isElement()){ - QDomElement dinfo = dstat.toElement(); + TQDomElement dinfo = dstat.toElement(); for (int i = 0; Statistics[i]; i+=2) addAttributeInfo(dinfo, group2, Statistics[i] ); } - QDomNodeList userList = base.elementsByTagName( metauserdef ); + TQDomNodeList userList = base.elementsByTagName( metauserdef ); KFileMetaInfoGroup groupuser = appendGroup(info, UserDefined); for (uint i = 0; i < userList.length(); i++){ - QDomNode node = userList.item(i); + TQDomNode node = userList.item(i); if (node.isElement()){ appendItem(groupuser, node.toElement().attribute(metaname, - QString("User %1").arg(i)), + TQString("User %1").tqarg(i)), node.toElement().text()); } } return true; } -QString KOfficePlugin::stringFromNode(const QDomNode &node, const QString &name) +TQString KOfficePlugin::stringFromNode(const TQDomNode &node, const TQString &name) { - QString value = node.namedItem(name).toElement().text(); - return value.isEmpty() ? QString::null : value; + TQString value = node.namedItem(name).toElement().text(); + return value.isEmpty() ? TQString() : value; } -void KOfficePlugin::addAttributeInfo(const QDomElement & elem, KFileMetaInfoGroup & group, const QString &attributeName) +void KOfficePlugin::addAttributeInfo(const TQDomElement & elem, KFileMetaInfoGroup & group, const TQString &attributeName) { if (!elem.hasAttribute(attributeName)){ return; } - QString m_attribute = elem.attribute(attributeName, "0"); + TQString m_attribute = elem.attribute(attributeName, "0"); if (m_attribute == "0") return; appendItem(group, attributeName, m_attribute); } -bool KOfficePlugin::writeTextNode(QDomDocument & doc, - QDomNode & parentNode, - const QString &nodeName, - const QString &value) const +bool KOfficePlugin::writeTextNode(TQDomDocument & doc, + TQDomNode & tqparentNode, + const TQString &nodeName, + const TQString &value) const { - if (parentNode.toElement().isNull()){ + if (tqparentNode.toElement().isNull()){ kdDebug(7034) << "Parent node is Null or not an Element, cannot write node " << nodeName << endl; return false; } // If the node does not exist, we create it... - if (parentNode.namedItem(nodeName).isNull()) - QDomNode ex = parentNode.appendChild(doc.createElement(nodeName)); + if (tqparentNode.namedItem(nodeName).isNull()) + TQDomNode ex = tqparentNode.appendChild(doc.createElement(nodeName)); // Now, we are sure we have a node - QDomElement nodeA = parentNode.namedItem(nodeName).toElement(); + TQDomElement nodeA = tqparentNode.namedItem(nodeName).toElement(); // Ooops... existing node were not of the good type... if (nodeA.isNull()){ @@ -385,21 +385,21 @@ bool KOfficePlugin::writeTextNode(QDomDocument & doc, return false; } - QDomText txtNode = doc.createTextNode(value); + TQDomText txtNode = doc.createTextNode(value); // If the node has already Text Child, we replace it. if (nodeA.firstChild().isNull()) nodeA.appendChild(txtNode); else - nodeA.replaceChild( txtNode, nodeA.firstChild()); + nodeA.tqreplaceChild( txtNode, nodeA.firstChild()); return true; } bool KOfficePlugin::writeInfo( const KFileMetaInfo& info) const { bool no_errors = true; - QDomDocument doc = getMetaDocument(info.path()); - QDomElement base = getBaseNode(doc).toElement(); + TQDomDocument doc = getMetaDocument(info.path()); + TQDomElement base = getBaseNode(doc).toElement(); if (base.isNull()) return false; for (int i = 0; Information[i]; i+=2) @@ -409,34 +409,34 @@ bool KOfficePlugin::writeInfo( const KFileMetaInfo& info) const // If we need a meta:keywords container, we create it. if (base.namedItem(metakeywords).isNull()) base.appendChild(doc.createElement(metakeywords)); - QDomNode metaKeyNode = base.namedItem(metakeywords); + TQDomNode metaKeyNode = base.namedItem(metakeywords); - QDomNodeList childs = doc.elementsByTagName(metakeyword); + TQDomNodeList childs = doc.elementsByTagName(metakeyword); for (int i = childs.length(); i >= 0; --i){ metaKeyNode.removeChild( childs.item(i) ); } - QStringList keywordList = QStringList::split(",", info[DocumentInfo][metakeyword].value().toString().stripWhiteSpace(), false); - for ( QStringList::Iterator it = keywordList.begin(); it != keywordList.end(); ++it ) { - QDomElement elem = doc.createElement(metakeyword); + TQStringList keywordList = TQStringList::split(",", info[DocumentInfo][metakeyword].value().toString().stripWhiteSpace(), false); + for ( TQStringList::Iterator it = keywordList.begin(); it != keywordList.end(); ++it ) { + TQDomElement elem = doc.createElement(metakeyword); metaKeyNode.appendChild(elem); elem.appendChild(doc.createTextNode((*it).stripWhiteSpace())); } // Now, we store the user-defined data - QDomNodeList theElements = base.elementsByTagName(metauserdef); + TQDomNodeList theElements = base.elementsByTagName(metauserdef); for (uint i = 0; i < theElements.length(); i++) { - QDomElement el = theElements.item(i).toElement(); + TQDomElement el = theElements.item(i).toElement(); if (el.isNull()){ kdDebug(7034) << metauserdef << " is not an Element" << endl; no_errors = false; } - QString s = info[UserDefined][el.attribute(metaname)].value().toString(); + TQString s = info[UserDefined][el.attribute(metaname)].value().toString(); if (s != el.text()){ - QDomText txt = doc.createTextNode(s); + TQDomText txt = doc.createTextNode(s); if (!el.firstChild().isNull()) - el.replaceChild(txt, el.firstChild()); + el.tqreplaceChild(txt, el.firstChild()); else el.appendChild(txt); } @@ -460,12 +460,12 @@ bool copyZipToZip( const KZip * src, KZip * dest) { KArchiveDirectory * src_dir; KArchiveFile * input_file; - QPtrStack<KArchiveDirectory> src_dirStack ; - QStringList dirEntries; - QStringList curDirName; - QStringList::Iterator it; + TQPtrStack<KArchiveDirectory> src_dirStack ; + TQStringList dirEntries; + TQStringList curDirName; + TQStringList::Iterator it; KArchiveEntry* curEntry; - QString filename = QString::null; + TQString filename = TQString(); src_dirStack.push ( src->directory() ); @@ -482,13 +482,13 @@ bool copyZipToZip( const KZip * src, KZip * dest) if (curEntry->isFile()) { input_file = dynamic_cast<KArchiveFile*>( curEntry ); - QByteArray b = input_file->data(); + TQByteArray b = input_file->data(); if (curDirName.isEmpty() || src_dir->name()=="/"){ filename = *it; } else { filename = curDirName.join("/") + "/" + *it; } - dest->writeFile(filename , QString::null, QString::null, b.count(), b.data() ); + dest->writeFile(filename , TQString(), TQString(), b.count(), b.data() ); } else if (curEntry->isDirectory()) { src_dirStack.push( dynamic_cast<KArchiveDirectory*>( curEntry ) ); @@ -503,8 +503,8 @@ bool copyZipToZip( const KZip * src, KZip * dest) return true; } -bool KOfficePlugin::writeMetaData(const QString & path, - const QDomDocument &doc) const +bool KOfficePlugin::writeMetaData(const TQString & path, + const TQDomDocument &doc) const { KTempFile tmp_file; tmp_file.setAutoDelete(true); @@ -513,11 +513,11 @@ bool KOfficePlugin::writeMetaData(const QString & path, /* To correct problem with OOo 1.1, we have to recreate the file from scratch */ if (!m_zip->open(IO_WriteOnly) || !current->open(IO_ReadOnly) ) return false; - QCString text = doc.toCString(); + TQCString text = doc.toCString(); m_zip->setCompression(KZip::DeflateCompression); if (!copyZipToZip(current, m_zip)) return false; - m_zip->writeFile(metafile, QString::null, QString::null,text.length(), + m_zip->writeFile(metafile, TQString(), TQString(),text.length(), text); delete current; delete m_zip; @@ -531,7 +531,7 @@ bool KOfficePlugin::writeMetaData(const QString & path, } -QIODevice* KOfficePlugin::getData(KArchive &m_zip, int fileMode) const +TQIODevice* KOfficePlugin::getData(KArchive &m_zip, int fileMode) const { if ( !m_zip.open(fileMode) || !m_zip.directory()) @@ -547,14 +547,14 @@ QIODevice* KOfficePlugin::getData(KArchive &m_zip, int fileMode) const return f->device(); } -QDomDocument KOfficePlugin::getMetaDocument(const QString &path) const +TQDomDocument KOfficePlugin::getMetaDocument(const TQString &path) const { - QDomDocument doc; + TQDomDocument doc; KZip m_zip(path); - QIODevice * io = getData(m_zip, IO_ReadOnly); + TQIODevice * io = getData(m_zip, IO_ReadOnly); if (!io || !io->isReadable()) return doc; - QString errorMsg; + TQString errorMsg; int errorLine, errorColumn; if ( !doc.setContent( io, &errorMsg, &errorLine, &errorColumn ) ){ kdDebug(7034) << "Error " << errorMsg.latin1() @@ -567,21 +567,21 @@ QDomDocument KOfficePlugin::getMetaDocument(const QString &path) const return doc; } -QDomNode KOfficePlugin::getBaseNode(const QDomDocument &doc) const +TQDomNode KOfficePlugin::getBaseNode(const TQDomDocument &doc) const { return doc.namedItem("office:document-meta").namedItem("office:meta"); } -QValidator * KOfficePlugin::createValidator(const QString &, /* mimetype */ - const QString & , /* group */ - const QString &key, - QObject * parent, +TQValidator * KOfficePlugin::createValidator(const TQString &, /* mimetype */ + const TQString & , /* group */ + const TQString &key, + TQObject * tqparent, const char * name ) const { if (key == dclanguage) - return new QRegExpValidator(QRegExp("[a-zA-Z-]{1,5}"), - parent, name); + return new TQRegExpValidator(TQRegExp("[a-zA-Z-]{1,5}"), + tqparent, name); return 0; } diff --git a/tools/kfile-plugins/ooo/kfile_ooo.h b/tools/kfile-plugins/ooo/kfile_ooo.h index 11bff4ac..9c2c3213 100644 --- a/tools/kfile-plugins/ooo/kfile_ooo.h +++ b/tools/kfile-plugins/ooo/kfile_ooo.h @@ -21,21 +21,22 @@ #define __KFILE_OOO_H__ #include <kfilemetainfo.h> -#include <qiodevice.h> -#include <qdom.h> +#include <tqiodevice.h> +#include <tqdom.h> #include <karchive.h> -class QStringList; -class QDomNode; -class QDomElement; +class TQStringList; +class TQDomNode; +class TQDomElement; class KOfficePlugin: public KFilePlugin { Q_OBJECT + TQ_OBJECT public: /** * Constructor */ - KOfficePlugin( QObject *parent, const char *name, const QStringList& args ); + KOfficePlugin( TQObject *tqparent, const char *name, const TQStringList& args ); /** * Read informations from files and store info in KFileMetaInfo. * We currently only parse meta.xml in OOo files. @@ -51,27 +52,27 @@ public: /** * We need a validator, for the langage */ - virtual QValidator* createValidator( const QString& mimetype, - const QString &group, - const QString &key, - QObject* parent, + virtual TQValidator* createValidator( const TQString& mimetype, + const TQString &group, + const TQString &key, + TQObject* tqparent, const char* name) const; private: - bool writeTextNode(QDomDocument & doc, - QDomNode & parentNode, - const QString &nodeName, - const QString &value) const; + bool writeTextNode(TQDomDocument & doc, + TQDomNode & tqparentNode, + const TQString &nodeName, + const TQString &value) const; KFileMimeTypeInfo::GroupInfo* userdefined; - void addAttributeInfo(const QDomElement & elem, KFileMetaInfoGroup & group, - const QString &attributeName); - QIODevice* getData(KArchive &m_zip, int fileMode) const; - bool writeMetaData(const QString & path, const QDomDocument &doc) const; - QDomDocument getMetaDocument(const QString &path) const; - QDomNode getBaseNode(const QDomDocument &doc) const; - void makeMimeTypeInfo(const QString& mimeType); - QString stringFromNode(const QDomNode &node, const QString &name); - void getEditingTime(KFileMetaInfoGroup group1, const char *, QString & txt); - void getDateTime(KFileMetaInfoGroup group1, const char *, QString & txt); + void addAttributeInfo(const TQDomElement & elem, KFileMetaInfoGroup & group, + const TQString &attributeName); + TQIODevice* getData(KArchive &m_zip, int fileMode) const; + bool writeMetaData(const TQString & path, const TQDomDocument &doc) const; + TQDomDocument getMetaDocument(const TQString &path) const; + TQDomNode getBaseNode(const TQDomDocument &doc) const; + void makeMimeTypeInfo(const TQString& mimeType); + TQString stringFromNode(const TQDomNode &node, const TQString &name); + void getEditingTime(KFileMetaInfoGroup group1, const char *, TQString & txt); + void getDateTime(KFileMetaInfoGroup group1, const char *, TQString & txt); }; #endif |