summaryrefslogtreecommitdiffstats
path: root/lib/store
diff options
context:
space:
mode:
Diffstat (limited to 'lib/store')
-rw-r--r--lib/store/KoDirectoryStore.cpp38
-rw-r--r--lib/store/KoDirectoryStore.h22
-rw-r--r--lib/store/KoStore.cpp132
-rw-r--r--lib/store/KoStore.h86
-rw-r--r--lib/store/KoStoreBase.h4
-rw-r--r--lib/store/KoStoreDevice.h25
-rw-r--r--lib/store/KoStoreDrag.cpp10
-rw-r--r--lib/store/KoStoreDrag.h14
-rw-r--r--lib/store/KoTarStore.cpp26
-rw-r--r--lib/store/KoTarStore.h20
-rw-r--r--lib/store/KoXmlWriter.cpp96
-rw-r--r--lib/store/KoXmlWriter.h68
-rw-r--r--lib/store/KoZipStore.cpp32
-rw-r--r--lib/store/KoZipStore.h20
-rw-r--r--lib/store/fix_storage.pl8
-rw-r--r--lib/store/tests/storage_test.cpp38
-rw-r--r--lib/store/tests/storedroptest.cpp72
-rw-r--r--lib/store/tests/xmlwritertest.cpp40
-rw-r--r--lib/store/tests/xmlwritertest.h20
19 files changed, 390 insertions, 381 deletions
diff --git a/lib/store/KoDirectoryStore.cpp b/lib/store/KoDirectoryStore.cpp
index d5b698f0..8cf30788 100644
--- a/lib/store/KoDirectoryStore.cpp
+++ b/lib/store/KoDirectoryStore.cpp
@@ -18,16 +18,16 @@
*/
#include "KoDirectoryStore.h"
-#include <qfile.h>
-#include <qdir.h>
+#include <tqfile.h>
+#include <tqdir.h>
#include <kdebug.h>
-// HMMM... I used QFile and QDir.... but maybe this should be made network transparent?
+// HMMM... I used TQFile and TQDir.... but maybe this should be made network transparent?
-KoDirectoryStore::KoDirectoryStore( const QString& path, Mode _mode )
+KoDirectoryStore::KoDirectoryStore( const TQString& path, Mode _mode )
: m_basePath( path )
{
- const int pos = path.findRev( '/' );
+ const int pos = path.tqfindRev( '/' );
// The parameter must include "maindoc.xml" or "content.xml"
if ( pos != -1 && pos != (int)m_basePath.length()-1 )
m_basePath = m_basePath.left( pos );
@@ -45,10 +45,10 @@ KoDirectoryStore::~KoDirectoryStore()
bool KoDirectoryStore::init( Mode _mode )
{
KoStore::init( _mode );
- QDir dir( m_basePath );
+ TQDir dir( m_basePath );
if ( dir.exists() )
return true;
- dir = QDir::current();
+ dir = TQDir::current();
// Dir doesn't exist. If reading -> error. If writing -> create.
if ( _mode == Write && dir.mkdir( m_basePath ) ) {
kdDebug(s_area) << "KoDirectoryStore::init Directory created: " << m_basePath << endl;
@@ -57,22 +57,22 @@ bool KoDirectoryStore::init( Mode _mode )
return false;
}
-bool KoDirectoryStore::openReadOrWrite( const QString& name, int iomode )
+bool KoDirectoryStore::openReadOrWrite( const TQString& name, int iomode )
{
//kdDebug(s_area) << "KoDirectoryStore::openReadOrWrite m_currentPath=" << m_currentPath << " name=" << name << endl;
- int pos = name.findRev('/');
+ int pos = name.tqfindRev('/');
if ( pos != -1 ) // there are subdirs in the name -> maybe need to create them, when writing
{
pushDirectory(); // remember where we were
- enterAbsoluteDirectory( QString::null );
+ enterAbsoluteDirectory( TQString() );
//kdDebug(s_area) << "KoDirectoryStore::openReadOrWrite entering " << name.left(pos) << endl;
bool ret = enterDirectory( name.left( pos ) );
popDirectory();
if ( !ret )
return false;
}
- m_stream = new QFile( m_basePath + name );
- if ( !m_stream->open( iomode ) )
+ m_stream = TQT_TQIODEVICE(new TQFile( m_basePath + name ));
+ if ( !m_stream->tqopen( iomode ) )
{
delete m_stream;
m_stream = 0L;
@@ -83,14 +83,14 @@ bool KoDirectoryStore::openReadOrWrite( const QString& name, int iomode )
return true;
}
-bool KoDirectoryStore::enterRelativeDirectory( const QString& dirName )
+bool KoDirectoryStore::enterRelativeDirectory( const TQString& dirName )
{
- QDir origDir( m_currentPath );
+ TQDir origDir( m_currentPath );
m_currentPath += dirName;
if ( !m_currentPath.endsWith("/") )
m_currentPath += '/';
//kdDebug(s_area) << "KoDirectoryStore::enterRelativeDirectory m_currentPath now " << m_currentPath << endl;
- QDir newDir( m_currentPath );
+ TQDir newDir( m_currentPath );
if ( newDir.exists() )
return true;
// Dir doesn't exist. If reading -> error. If writing -> create.
@@ -101,17 +101,17 @@ bool KoDirectoryStore::enterRelativeDirectory( const QString& dirName )
return false;
}
-bool KoDirectoryStore::enterAbsoluteDirectory( const QString& path )
+bool KoDirectoryStore::enterAbsoluteDirectory( const TQString& path )
{
m_currentPath = m_basePath + path;
//kdDebug(s_area) << "KoDirectoryStore::enterAbsoluteDirectory " << m_currentPath << endl;
- QDir newDir( m_currentPath );
+ TQDir newDir( m_currentPath );
Q_ASSERT( newDir.exists() ); // We've been there before, therefore it must exist.
return newDir.exists();
}
-bool KoDirectoryStore::fileExists( const QString& absPath ) const
+bool KoDirectoryStore::fileExists( const TQString& absPath ) const
{
kdDebug(s_area) << "KoDirectoryStore::fileExists " << m_basePath+absPath << endl;
- return QFile::exists( m_basePath + absPath );
+ return TQFile::exists( m_basePath + absPath );
}
diff --git a/lib/store/KoDirectoryStore.h b/lib/store/KoDirectoryStore.h
index 3efaa50b..66ddb72b 100644
--- a/lib/store/KoDirectoryStore.h
+++ b/lib/store/KoDirectoryStore.h
@@ -22,33 +22,33 @@
#include "KoStoreBase.h"
-class QFile;
+class TQFile;
class KoDirectoryStore : public KoStoreBase
{
public:
- KoDirectoryStore( const QString& path, Mode _mode );
+ KoDirectoryStore( const TQString& path, Mode _mode );
~KoDirectoryStore();
protected:
virtual bool init( Mode _mode );
- virtual bool openWrite( const QString& name ) { return openReadOrWrite( name, IO_WriteOnly ); }
- virtual bool openRead( const QString& name ) { return openReadOrWrite( name, IO_ReadOnly ); }
+ virtual bool openWrite( const TQString& name ) { return openReadOrWrite( name, IO_WriteOnly ); }
+ virtual bool openRead( const TQString& name ) { return openReadOrWrite( name, IO_ReadOnly ); }
virtual bool closeRead() { return true; }
virtual bool closeWrite() { return true; }
- virtual bool enterRelativeDirectory( const QString& dirName );
- virtual bool enterAbsoluteDirectory( const QString& path );
- virtual bool fileExists( const QString& absPath ) const;
+ virtual bool enterRelativeDirectory( const TQString& dirName );
+ virtual bool enterAbsoluteDirectory( const TQString& path );
+ virtual bool fileExists( const TQString& absPath ) const;
- bool openReadOrWrite( const QString& name, int iomode );
+ bool openReadOrWrite( const TQString& name, int iomode );
private:
// Path to base directory (== the ctor argument)
- QString m_basePath;
+ TQString m_basePath;
// Path to current directory
- QString m_currentPath;
+ TQString m_currentPath;
// Current File
- QFile* m_file;
+ TQFile* m_file;
};
#endif
diff --git a/lib/store/KoStore.cpp b/lib/store/KoStore.cpp
index ec97c6a5..a027bf7e 100644
--- a/lib/store/KoStore.cpp
+++ b/lib/store/KoStore.cpp
@@ -28,9 +28,9 @@
#include "KoZipStore.h"
#include "KoDirectoryStore.h"
-#include <qfileinfo.h>
-#include <qfile.h>
-#include <qdir.h>
+#include <tqfileinfo.h>
+#include <tqfile.h>
+#include <tqdir.h>
#include <kurl.h>
#include <kdebug.h>
@@ -44,7 +44,7 @@
const int KoStore::s_area = 30002;
-KoStore::Backend KoStore::determineBackend( QIODevice* dev )
+KoStore::Backend KoStore::determineBackend( TQIODevice* dev )
{
unsigned char buf[5];
if ( dev->readBlock( (char *)buf, 4 ) < 4 )
@@ -56,21 +56,21 @@ KoStore::Backend KoStore::determineBackend( QIODevice* dev )
return DefaultFormat; // fallback
}
-KoStore* KoStore::createStore( const QString& fileName, Mode mode, const QCString & appIdentification, Backend backend )
+KoStore* KoStore::createStore( const TQString& fileName, Mode mode, const TQCString & appIdentification, Backend backend )
{
if ( backend == Auto ) {
if ( mode == KoStore::Write )
backend = DefaultFormat;
else
{
- QFileInfo inf( fileName );
+ TQFileInfo inf( fileName );
if ( inf.isDir() )
backend = Directory;
else
{
- QFile file( fileName );
+ TQFile file( fileName );
if ( file.open( IO_ReadOnly ) )
- backend = determineBackend( &file );
+ backend = determineBackend( TQT_TQIODEVICE(&file) );
else
backend = DefaultFormat; // will create a "bad" store (bad()==true)
}
@@ -90,7 +90,7 @@ KoStore* KoStore::createStore( const QString& fileName, Mode mode, const QCStrin
}
}
-KoStore* KoStore::createStore( QIODevice *device, Mode mode, const QCString & appIdentification, Backend backend )
+KoStore* KoStore::createStore( TQIODevice *device, Mode mode, const TQCString & appIdentification, Backend backend )
{
if ( backend == Auto )
{
@@ -118,12 +118,12 @@ KoStore* KoStore::createStore( QIODevice *device, Mode mode, const QCString & ap
}
}
-KoStore* KoStore::createStore( QWidget* window, const KURL& url, Mode mode, const QCString & appIdentification, Backend backend )
+KoStore* KoStore::createStore( TQWidget* window, const KURL& url, Mode mode, const TQCString & appIdentification, Backend backend )
{
if ( url.isLocalFile() )
return createStore(url.path(), mode, appIdentification, backend );
- QString tmpFile;
+ TQString tmpFile;
if ( mode == KoStore::Write )
{
if ( backend == Auto )
@@ -141,10 +141,10 @@ KoStore* KoStore::createStore( QWidget* window, const KURL& url, Mode mode, cons
}
else if ( backend == Auto )
{
- QFile file( tmpFile );
+ TQFile file( tmpFile );
if ( file.open( IO_ReadOnly ) )
{
- backend = determineBackend( &file );
+ backend = determineBackend( TQT_TQIODEVICE(&file) );
file.close();
}
}
@@ -186,7 +186,7 @@ KoStore::~KoStore()
delete m_stream;
}
-bool KoStore::open( const QString & _name )
+bool KoStore::open( const TQString & _name )
{
// This also converts from relative to absolute, i.e. merges the currentPath()
m_sName = toExternalNaming( _name );
@@ -208,7 +208,7 @@ bool KoStore::open( const QString & _name )
if ( m_mode == Write )
{
kdDebug(s_area) << "KoStore: opening for writing '" << m_sName << "'" << endl;
- if ( m_strFiles.findIndex( m_sName ) != -1 ) // just check if it's there
+ if ( m_strFiles.tqfindIndex( m_sName ) != -1 ) // just check if it's there
{
kdWarning(s_area) << "KoStore: Duplicate filename " << m_sName << endl;
//return KIO::ERR_FILE_ALREADY_EXIST;
@@ -259,7 +259,7 @@ bool KoStore::close()
return ret;
}
-QIODevice* KoStore::device() const
+TQIODevice* KoStore::device() const
{
if ( !m_bIsOpen )
kdWarning(s_area) << "KoStore: You must open before asking for a device" << endl;
@@ -268,9 +268,9 @@ QIODevice* KoStore::device() const
return m_stream;
}
-QByteArray KoStore::read( unsigned long int max )
+TQByteArray KoStore::read( unsigned long int max )
{
- QByteArray data; // Data is a QArray<char>
+ TQByteArray data; // Data is a TQArray<char>
if ( !m_bIsOpen )
{
@@ -306,12 +306,12 @@ QByteArray KoStore::read( unsigned long int max )
return data;
}
-Q_LONG KoStore::write( const QByteArray& data )
+TQ_LONG KoStore::write( const TQByteArray& data )
{
return write( data.data(), data.size() ); // see below
}
-Q_LONG KoStore::read( char *_buffer, Q_ULONG _len )
+TQ_LONG KoStore::read( char *_buffer, TQ_ULONG _len )
{
if ( !m_bIsOpen )
{
@@ -335,7 +335,7 @@ Q_LONG KoStore::read( char *_buffer, Q_ULONG _len )
return m_stream->readBlock( _buffer, _len );
}
-Q_LONG KoStore::write( const char* _data, Q_ULONG _len )
+TQ_LONG KoStore::write( const char* _data, TQ_ULONG _len )
{
if ( _len == 0L ) return 0;
@@ -357,29 +357,29 @@ Q_LONG KoStore::write( const char* _data, Q_ULONG _len )
return nwritten;
}
-QIODevice::Offset KoStore::size() const
+TQIODevice::Offset KoStore::size() const
{
if ( !m_bIsOpen )
{
kdWarning(s_area) << "KoStore: You must open before asking for a size" << endl;
- return static_cast<QIODevice::Offset>(-1);
+ return static_cast<TQIODevice::Offset>(-1);
}
if ( m_mode != Read )
{
kdWarning(s_area) << "KoStore: Can not get size from store that is opened for writing" << endl;
- return static_cast<QIODevice::Offset>(-1);
+ return static_cast<TQIODevice::Offset>(-1);
}
return m_iSize;
}
-bool KoStore::enterDirectory( const QString& directory )
+bool KoStore::enterDirectory( const TQString& directory )
{
//kdDebug(s_area) << "KoStore::enterDirectory " << directory << endl;
int pos;
bool success = true;
- QString tmp( directory );
+ TQString tmp( directory );
- while ( ( pos = tmp.find( '/' ) ) != -1 &&
+ while ( ( pos = tmp.tqfind( '/' ) ) != -1 &&
( success = enterDirectoryInternal( tmp.left( pos ) ) ) )
tmp = tmp.mid( pos + 1 );
@@ -398,16 +398,16 @@ bool KoStore::leaveDirectory()
return enterAbsoluteDirectory( expandEncodedDirectory( currentPath() ) );
}
-QString KoStore::currentDirectory() const
+TQString KoStore::currentDirectory() const
{
return expandEncodedDirectory( currentPath() );
}
-QString KoStore::currentPath() const
+TQString KoStore::currentPath() const
{
- QString path;
- QStringList::ConstIterator it = m_currentPath.begin();
- QStringList::ConstIterator end = m_currentPath.end();
+ TQString path;
+ TQStringList::ConstIterator it = m_currentPath.begin();
+ TQStringList::ConstIterator end = m_currentPath.end();
for ( ; it != end; ++it ) {
path += *it;
path += '/';
@@ -423,15 +423,15 @@ void KoStore::pushDirectory()
void KoStore::popDirectory()
{
m_currentPath.clear();
- enterAbsoluteDirectory( QString::null );
+ enterAbsoluteDirectory( TQString() );
enterDirectory( m_directoryStack.pop() );
}
-bool KoStore::addLocalFile( const QString &fileName, const QString &destName )
+bool KoStore::addLocalFile( const TQString &fileName, const TQString &destName )
{
- QFileInfo fi( fileName );
+ TQFileInfo fi( fileName );
uint size = fi.size();
- QFile file( fileName );
+ TQFile file( fileName );
if ( !file.open( IO_ReadOnly ))
{
return false;
@@ -442,7 +442,7 @@ bool KoStore::addLocalFile( const QString &fileName, const QString &destName )
return false;
}
- QByteArray data ( 8 * 1024 );
+ TQByteArray data ( 8 * 1024 );
uint total = 0;
for ( int block = 0; ( block = file.readBlock ( data.data(), data.size() ) ) > 0; total += block )
@@ -460,12 +460,12 @@ bool KoStore::addLocalFile( const QString &fileName, const QString &destName )
return true;
}
-bool KoStore::extractFile ( const QString &srcName, const QString &fileName )
+bool KoStore::extractFile ( const TQString &srcName, const TQString &fileName )
{
if ( !open ( srcName ) )
return false;
- QFile file( fileName );
+ TQFile file( fileName );
if( !file.open ( IO_WriteOnly ) )
{
@@ -473,14 +473,14 @@ bool KoStore::extractFile ( const QString &srcName, const QString &fileName )
return false;
}
- QByteArray data ( 8 * 1024 );
+ TQByteArray data ( 8 * 1024 );
uint total = 0;
for( int block = 0; ( block = read ( data.data(), data.size() ) ) > 0; total += block )
{
file.writeBlock ( data.data(), block );
}
- if( size() != static_cast<QIODevice::Offset>(-1) )
+ if( size() != static_cast<TQIODevice::Offset>(-1) )
Q_ASSERT( total == size() );
file.close();
@@ -489,25 +489,25 @@ bool KoStore::extractFile ( const QString &srcName, const QString &fileName )
return true;
}
-QStringList KoStore::addLocalDirectory( const QString &dirPath, const QString &destName )
+TQStringList KoStore::addLocalDirectory( const TQString &dirPath, const TQString &destName )
{
- QString dot = ".";
- QString dotdot = "..";
- QStringList content;
+ TQString dot = ".";
+ TQString dotdot = "..";
+ TQStringList content;
- QDir dir(dirPath);
+ TQDir dir(dirPath);
if ( !dir.exists() )
return 0;
- QStringList files = dir.entryList();
- for ( QStringList::Iterator it = files.begin(); it != files.end(); ++it )
+ TQStringList files = dir.entryList();
+ for ( TQStringList::Iterator it = files.begin(); it != files.end(); ++it )
{
if ( *it != dot && *it != dotdot )
{
- QString currentFile = dirPath + "/" + *it;
- QString dest = destName.isEmpty() ? *it : (destName + "/" + *it);
+ TQString currentFile = dirPath + "/" + *it;
+ TQString dest = destName.isEmpty() ? *it : (destName + "/" + *it);
- QFileInfo fi ( currentFile );
+ TQFileInfo fi ( currentFile );
if ( fi.isFile() )
{
addLocalFile ( currentFile, dest );
@@ -524,12 +524,12 @@ QStringList KoStore::addLocalDirectory( const QString &dirPath, const QString &d
}
-bool KoStore::at( QIODevice::Offset pos )
+bool KoStore::at( TQIODevice::Offset pos )
{
return m_stream->at( pos );
}
-QIODevice::Offset KoStore::at() const
+TQIODevice::Offset KoStore::at() const
{
return m_stream->at();
}
@@ -540,12 +540,12 @@ bool KoStore::atEnd() const
}
// See the specification for details of what this function does.
-QString KoStore::toExternalNaming( const QString & _internalNaming ) const
+TQString KoStore::toExternalNaming( const TQString & _internalNaming ) const
{
if ( _internalNaming == ROOTPART )
return expandEncodedDirectory( currentPath() ) + MAINNAME;
- QString intern;
+ TQString intern;
if ( _internalNaming.startsWith( "tar:/" ) ) // absolute reference
intern = _internalNaming.mid( 5 ); // remove protocol
else
@@ -554,22 +554,22 @@ QString KoStore::toExternalNaming( const QString & _internalNaming ) const
return expandEncodedPath( intern );
}
-QString KoStore::expandEncodedPath( QString intern ) const
+TQString KoStore::expandEncodedPath( TQString intern ) const
{
if ( m_namingVersion == NAMING_VERSION_RAW )
return intern;
- QString result;
+ TQString result;
int pos;
- if ( ( pos = intern.findRev( '/', -1 ) ) != -1 ) {
+ if ( ( pos = intern.tqfindRev( '/', -1 ) ) != -1 ) {
result = expandEncodedDirectory( intern.left( pos ) ) + '/';
intern = intern.mid( pos + 1 );
}
// Now process the filename. If the first character is numeric, we have
// a main document.
- if ( QChar(intern.at(0)).isDigit() )
+ if ( TQChar(intern.at(0)).isDigit() )
{
// If this is the first part name, check if we have a store with
// old-style names.
@@ -588,27 +588,27 @@ QString KoStore::expandEncodedPath( QString intern ) const
return result;
}
-QString KoStore::expandEncodedDirectory( QString intern ) const
+TQString KoStore::expandEncodedDirectory( TQString intern ) const
{
if ( m_namingVersion == NAMING_VERSION_RAW )
return intern;
- QString result;
+ TQString result;
int pos;
- while ( ( pos = intern.find( '/' ) ) != -1 ) {
- if ( QChar(intern.at(0)).isDigit() )
+ while ( ( pos = intern.tqfind( '/' ) ) != -1 ) {
+ if ( TQChar(intern.at(0)).isDigit() )
result += "part";
result += intern.left( pos + 1 ); // copy numbers (or "pictures") + "/"
intern = intern.mid( pos + 1 ); // remove the dir we just processed
}
- if ( QChar(intern.at(0)).isDigit() )
+ if ( TQChar(intern.at(0)).isDigit() )
result += "part";
result += intern;
return result;
}
-bool KoStore::enterDirectoryInternal( const QString& directory )
+bool KoStore::enterDirectoryInternal( const TQString& directory )
{
if ( enterRelativeDirectory( expandEncodedDirectory( directory ) ) )
{
@@ -623,7 +623,7 @@ void KoStore::disallowNameExpansion( void )
m_namingVersion = NAMING_VERSION_RAW;
}
-bool KoStore::hasFile( const QString& fileName ) const
+bool KoStore::hasFile( const TQString& fileName ) const
{
return fileExists( toExternalNaming( currentPath() + fileName ) );
}
diff --git a/lib/store/KoStore.h b/lib/store/KoStore.h
index 38409688..04ff6cdf 100644
--- a/lib/store/KoStore.h
+++ b/lib/store/KoStore.h
@@ -21,13 +21,13 @@
#ifndef __koStore_h_
#define __koStore_h_
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qiodevice.h>
-#include <qvaluestack.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqiodevice.h>
+#include <tqvaluestack.h>
#include <koffice_export.h>
-class QWidget;
+class TQWidget;
class KURL;
@@ -58,14 +58,14 @@ public:
* to be written in the file for "mime-magic" identification.
* Only meaningful if mode is Write, and if backend!=Directory.
*/
- static KoStore* createStore( const QString& fileName, Mode mode, const QCString & appIdentification = "", Backend backend = Auto );
+ static KoStore* createStore( const TQString& fileName, Mode mode, const TQCString & appIdentification = "", Backend backend = Auto );
/**
- * Create a store for any kind of QIODevice: file, memory buffer...
- * KoStore will take care of opening the QIODevice.
+ * Create a store for any kind of TQIODevice: file, memory buffer...
+ * KoStore will take care of opening the TQIODevice.
* This method doesn't support the Directory store!
*/
- static KoStore* createStore( QIODevice *device, Mode mode, const QCString & appIdentification = "", Backend backend = Auto );
+ static KoStore* createStore( TQIODevice *device, Mode mode, const TQCString & appIdentification = "", Backend backend = Auto );
/**
* Open a store (i.e. the representation on disk of a KOffice document).
@@ -87,7 +87,7 @@ public:
* @since 1.4
* @bug saving not completely implemented (fixed temporary file)
*/
- static KoStore* createStore( QWidget* window, const KURL& url, Mode mode, const QCString & appIdentification = "", Backend backend = Auto );
+ static KoStore* createStore( TQWidget* window, const KURL& url, Mode mode, const TQCString & appIdentification = "", Backend backend = Auto );
/**
* Destroys the store (i.e. closes the file on the hard disk)
@@ -100,7 +100,7 @@ public:
* If the tar:/ prefix is missing it's assumed to be a relative URI.
* @return true on success.
*/
- bool open( const QString & name );
+ bool open( const TQString & name );
/**
* Check whether a file inside the store is currently opened with open(),
@@ -120,38 +120,38 @@ public:
* (slightly faster than read() calls)
* You need to call @ref open first, and @ref close afterwards.
*/
- QIODevice* device() const;
+ TQIODevice* device() const;
/**
* Read data from the currently opened file. You can also use the streams
* for this.
*/
- QByteArray read( unsigned long int max );
+ TQByteArray read( unsigned long int max );
/**
* Write data into the currently opened file. You can also use the streams
* for this.
*/
- Q_LONG write( const QByteArray& _data );
+ TQ_LONG write( const TQByteArray& _data );
/**
* Read data from the currently opened file. You can also use the streams
* for this.
* @return size of data read, -1 on error
*/
- Q_LONG read( char *_buffer, Q_ULONG _len );
+ TQ_LONG read( char *_buffer, TQ_ULONG _len );
/**
* Write data into the currently opened file. You can also use the streams
* for this.
*/
- virtual Q_LONG write( const char* _data, Q_ULONG _len );
+ virtual TQ_LONG write( const char* _data, TQ_ULONG _len );
/**
* @return the size of the currently opened file, -1 on error.
* Can be used as an argument for the read methods, for instance
*/
- QIODevice::Offset size() const;
+ TQIODevice::Offset size() const;
/**
* @return true if an error occurred
@@ -172,7 +172,7 @@ public:
* opening a stream.
* Note: Operates on internal names
*/
- bool enterDirectory( const QString& directory );
+ bool enterDirectory( const TQString& directory );
/**
* Leaves a directory. Equivalent to "cd .."
@@ -185,13 +185,13 @@ public:
* Returns the current path including a trailing slash.
* Note: Returns a path in "internal name" style
*/
- QString currentPath() const;
+ TQString currentPath() const;
/**
* Returns the current directory.
* Note: Returns a path in "internal name" style
*/
- QString currentDirectory() const;
+ TQString currentDirectory() const;
/**
@@ -210,14 +210,14 @@ public:
* @return true if the given file exists in the current directory,
* i.e. if open(fileName) will work.
*/
- bool hasFile( const QString& fileName ) const;
+ bool hasFile( const TQString& fileName ) const;
/**
* Imports a local file into a store
* @param fileName file on hard disk
* @param destName file in the store
*/
- bool addLocalFile( const QString &fileName, const QString &destName );
+ bool addLocalFile( const TQString &fileName, const TQString &destName );
/**
* Imports a local directory
@@ -225,7 +225,7 @@ public:
* @param dest path in the store where the directory should get saved
* @return the directory index
*/
- QStringList addLocalDirectory( const QString &dirPath, const QString &dest );
+ TQStringList addLocalDirectory( const TQString &dirPath, const TQString &dest );
/**
@@ -233,12 +233,12 @@ public:
* @param srcName file in the store
* @param fileName file on a disk
*/
- bool extractFile( const QString &srcName, const QString &fileName );
+ bool extractFile( const TQString &srcName, const TQString &fileName );
//@{
- /// See QIODevice
- bool at( QIODevice::Offset pos );
- QIODevice::Offset at() const;
+ /// See TQIODevice
+ bool at( TQIODevice::Offset pos );
+ TQIODevice::Offset at() const;
bool atEnd() const;
//@}
@@ -264,7 +264,7 @@ protected:
* @param name "absolute path" (in the archive) to the file to open
* @return true on success
*/
- virtual bool openWrite( const QString& name ) = 0;
+ virtual bool openWrite( const TQString& name ) = 0;
/**
* Open the file @p name in the store, for reading.
* On success, this method must set m_stream to a stream from which we can read,
@@ -272,7 +272,7 @@ protected:
* @param name "absolute path" (in the archive) to the file to open
* @return true on success
*/
- virtual bool openRead( const QString& name ) = 0;
+ virtual bool openRead( const TQString& name ) = 0;
/**
* @return true on success
@@ -287,21 +287,21 @@ protected:
* Enter a subdirectory of the current directory.
* The directory might not exist yet in Write mode.
*/
- virtual bool enterRelativeDirectory( const QString& dirName ) = 0;
+ virtual bool enterRelativeDirectory( const TQString& dirName ) = 0;
/**
* Enter a directory where we've been before.
* It is guaranteed to always exist.
*/
- virtual bool enterAbsoluteDirectory( const QString& path ) = 0;
+ virtual bool enterAbsoluteDirectory( const TQString& path ) = 0;
/**
* Check if a file exists inside the store.
* @param absPath the absolute path inside the store, i.e. not relative to the current directory
*/
- virtual bool fileExists( const QString& absPath ) const = 0;
+ virtual bool fileExists( const TQString& absPath ) const = 0;
private:
- static Backend determineBackend( QIODevice* dev );
+ static Backend determineBackend( TQIODevice* dev );
/**
* Conversion routine
@@ -316,18 +316,18 @@ private:
*
* see specification (koffice/lib/store/SPEC) for details.
*/
- QString toExternalNaming( const QString & _internalNaming ) const;
+ TQString toExternalNaming( const TQString & _internalNaming ) const;
/**
* Expands a full path name for a stream (directories+filename)
*/
- QString expandEncodedPath( QString intern ) const;
+ TQString expandEncodedPath( TQString intern ) const;
/**
* Expands only directory names(!)
* Needed for the path handling code, as we only operate on internal names
*/
- QString expandEncodedDirectory( QString intern ) const;
+ TQString expandEncodedDirectory( TQString intern ) const;
mutable enum
{
@@ -340,28 +340,28 @@ private:
* Enter *one* single directory. Nothing like foo/bar/bleh allowed.
* Performs some checking when in Read mode
*/
- bool enterDirectoryInternal( const QString& directory );
+ bool enterDirectoryInternal( const TQString& directory );
protected:
Mode m_mode;
/// Store the filenames (with full path inside the archive) when writing, to avoid duplicates
- QStringList m_strFiles;
+ TQStringList m_strFiles;
/// The "current directory" (path)
- QStringList m_currentPath;
+ TQStringList m_currentPath;
/// Used to push/pop directories to make it easy to save/restore the state
- QValueStack<QString> m_directoryStack;
+ TQValueStack<TQString> m_directoryStack;
/// Current filename (between an open() and a close())
- QString m_sName;
+ TQString m_sName;
/// Current size of the file named m_sName
- QIODevice::Offset m_iSize;
+ TQIODevice::Offset m_iSize;
/// The stream for the current read or write operation
- QIODevice * m_stream;
+ TQIODevice * m_stream;
bool m_bIsOpen;
/// Must be set by the constructor.
diff --git a/lib/store/KoStoreBase.h b/lib/store/KoStoreBase.h
index bd4be8ac..923207c3 100644
--- a/lib/store/KoStoreBase.h
+++ b/lib/store/KoStoreBase.h
@@ -44,8 +44,8 @@ protected:
*/
KURL m_url;
FileMode m_fileMode;
- QString m_localFileName;
- QWidget* m_window;
+ TQString m_localFileName;
+ TQWidget* m_window;
};
#endif //KOSTORE_BASE_H
diff --git a/lib/store/KoStoreDevice.h b/lib/store/KoStoreDevice.h
index e76013bd..9d62b21c 100644
--- a/lib/store/KoStoreDevice.h
+++ b/lib/store/KoStoreDevice.h
@@ -23,11 +23,11 @@
#include <KoStore.h>
/**
- * This class implements a QIODevice around KoStore, so that
- * it can be used to create a QDomDocument from it, to be written or read
- * using QDataStream or to be written using QTextStream
+ * This class implements a TQIODevice around KoStore, so that
+ * it can be used to create a TQDomDocument from it, to be written or read
+ * using TQDataStream or to be written using TQTextStream
*/
-class KoStoreDevice : public QIODevice
+class KoStoreDevice : public TQIODevice
{
public:
/// Note: KoStore::open() should be called before calling this.
@@ -46,17 +46,26 @@ public:
void close() { }
void flush() { }
+#ifdef USE_QT4
+ qint64 size() const {
+#else // USE_QT4
Offset size() const {
+#endif // USE_QT4
if ( m_store->mode() == KoStore::Read )
return m_store->size();
else
return 0xffffffff;
}
- virtual Q_LONG readBlock( char *data, Q_ULONG maxlen ) { return m_store->read(data, maxlen); }
- virtual Q_LONG writeBlock( const char *data, Q_ULONG len ) { return m_store->write( data, len ); }
+ virtual TQ_LONG readBlock( char *data, TQ_ULONG maxlen ) { return m_store->read(data, maxlen); }
+ virtual TQ_LONG writeBlock( const char *data, TQ_ULONG len ) { return m_store->write( data, len ); }
// Not virtual, only to uncover shadow
- Q_LONG writeBlock( const QByteArray& data ) { return QIODevice::writeBlock( data ); }
+ TQ_LONG writeBlock( const TQByteArray& data ) { return TQIODevice::writeBlock( data ); }
+
+#ifdef USE_QT4
+ inline qint64 readData ( char * data, qint64 maxSize ) { return readBlock(data, maxSize); }
+ inline qint64 writeData ( const char * data, qint64 maxSize ) { return writeBlock(data, maxSize); }
+#endif // USE_QT4
int getch() {
char c[2];
@@ -76,7 +85,7 @@ public:
}
int ungetch( int ) { return -1; } // unsupported
- // See QIODevice
+ // See TQIODevice
virtual bool at( Offset pos ) { return m_store->at(pos); }
virtual Offset at() const { return m_store->at(); }
virtual bool atEnd() const { return m_store->atEnd(); }
diff --git a/lib/store/KoStoreDrag.cpp b/lib/store/KoStoreDrag.cpp
index ea951f53..21672e14 100644
--- a/lib/store/KoStoreDrag.cpp
+++ b/lib/store/KoStoreDrag.cpp
@@ -19,17 +19,17 @@
#include "KoStoreDrag.h"
-QCString KoStoreDrag::mimeType( const char* nativeMimeType )
+TQCString KoStoreDrag::mimeType( const char* nativeMimeType )
{
- return QCString(nativeMimeType); // + "-selection"; removed for OASIS
+ return TQCString(nativeMimeType); // + "-selection"; removed for OASIS
}
-KoStoreDrag::KoStoreDrag( const char* nativeMimeType, QWidget *dragSource, const char *name )
- : QStoredDrag( mimeType(nativeMimeType), dragSource, name )
+KoStoreDrag::KoStoreDrag( const char* nativeMimeType, TQWidget *dragSource, const char *name )
+ : TQStoredDrag( mimeType(nativeMimeType), dragSource, name )
{
}
-bool KoStoreDrag::canDecode( const char* nativeMimeType, QMimeSource* e )
+bool KoStoreDrag::canDecode( const char* nativeMimeType, TQMimeSource* e )
{
return e->provides( mimeType(nativeMimeType) );
}
diff --git a/lib/store/KoStoreDrag.h b/lib/store/KoStoreDrag.h
index 0e3939d4..cbd8c40d 100644
--- a/lib/store/KoStoreDrag.h
+++ b/lib/store/KoStoreDrag.h
@@ -20,20 +20,20 @@
#ifndef koStoreDrag_h
#define koStoreDrag_h
-#include <qdragobject.h>
+#include <tqdragobject.h>
#include <koffice_export.h>
/**
* A generic drag object that holds a store (e.g. KoZipStore) in memory.
* This allows to drag-n-drop and copy-paste complex koffice objects.
* As per usual with dragobjects, an instance of KoStoreDrag must be
* created on the "sending" side (dragging or copying). The "receiving"
- * side (dropping or pasting) only uses provides()/canDecode() and encodedData().
+ * side (dropping or pasting) only uses provides()/canDecode() and tqencodedData().
*
- * To create the data in memory, create a QBuffer,
+ * To create the data in memory, create a TQBuffer,
* then KoStore::createStore( theBuffer, .... ), save the
* data into the store and delete it. Finally, call setEncodedData().
*/
-class KOSTORE_EXPORT KoStoreDrag : public QStoredDrag
+class KOSTORE_EXPORT KoStoreDrag : public TQStoredDrag
{
public:
/** Constructor.
@@ -41,15 +41,15 @@ public:
* @param dragSource must be 0 when copying to the clipboard.
* @param name object name for this drag.
*/
- KoStoreDrag( const char* nativeMimeType, QWidget *dragSource = 0L, const char *name = 0L );
+ KoStoreDrag( const char* nativeMimeType, TQWidget *dragSource = 0L, const char *name = 0L );
- static bool canDecode( const char* nativeMimeType, QMimeSource* e );
+ static bool canDecode( const char* nativeMimeType, TQMimeSource* e );
/**
* Returns the mimetype of the clipboard data for a given application,
* depending on the application's native mimetype.
*/
- static QCString mimeType( const char* nativeMimeType );
+ static TQCString mimeType( const char* nativeMimeType );
};
#endif
diff --git a/lib/store/KoTarStore.cpp b/lib/store/KoTarStore.cpp
index fc516894..97f0b519 100644
--- a/lib/store/KoTarStore.cpp
+++ b/lib/store/KoTarStore.cpp
@@ -19,7 +19,7 @@
#include "KoTarStore.h"
-#include <qbuffer.h>
+#include <tqbuffer.h>
#include <ktar.h>
#include <kdebug.h>
@@ -27,7 +27,7 @@
#include <kdeversion.h>
#include <kio/netaccess.h>
-KoTarStore::KoTarStore( const QString & _filename, Mode _mode, const QCString & appIdentification )
+KoTarStore::KoTarStore( const TQString & _filename, Mode _mode, const TQCString & appIdentification )
{
kdDebug(s_area) << "KoTarStore Constructor filename = " << _filename
<< " mode = " << int(_mode) << endl;
@@ -40,7 +40,7 @@ KoTarStore::KoTarStore( const QString & _filename, Mode _mode, const QCString &
m_pTar->setOrigFileName( completeMagic( appIdentification ) );
}
-KoTarStore::KoTarStore( QIODevice *dev, Mode mode, const QCString & appIdentification )
+KoTarStore::KoTarStore( TQIODevice *dev, Mode mode, const TQCString & appIdentification )
{
m_pTar = new KTar( dev );
@@ -50,7 +50,7 @@ KoTarStore::KoTarStore( QIODevice *dev, Mode mode, const QCString & appIdentific
m_pTar->setOrigFileName( completeMagic( appIdentification ) );
}
-KoTarStore::KoTarStore( QWidget* window, const KURL& _url, const QString & _filename, Mode _mode, const QCString & appIdentification )
+KoTarStore::KoTarStore( TQWidget* window, const KURL& _url, const TQString & _filename, Mode _mode, const TQCString & appIdentification )
{
kdDebug(s_area) << "KoTarStore Constructor url= " << _url.prettyURL()
<< " filename = " << _filename
@@ -96,10 +96,10 @@ KoTarStore::~KoTarStore()
}
}
-QCString KoTarStore::completeMagic( const QCString& appMimetype )
+TQCString KoTarStore::completeMagic( const TQCString& appMimetype )
{
- kdDebug()<<"QCString KoTarStore::completeMagic( const QCString& appMimetype )********************\n";
- QCString res( "KOffice " );
+ kdDebug()<<"TQCString KoTarStore::completeMagic( const TQCString& appMimetype )********************\n";
+ TQCString res( "KOffice " );
res += appMimetype;
res += '\004'; // Two magic bytes to make the identification
res += '\006'; // more reliable (DF)
@@ -122,16 +122,16 @@ bool KoTarStore::init( Mode _mode )
// When reading, m_stream comes directly from KArchiveFile::device()
// When writing, m_stream buffers the data into m_byteArray
-bool KoTarStore::openWrite( const QString& /*name*/ )
+bool KoTarStore::openWrite( const TQString& /*name*/ )
{
// Prepare memory buffer for writing
m_byteArray.resize( 0 );
- m_stream = new QBuffer( m_byteArray );
+ m_stream = TQT_TQIODEVICE(new TQBuffer( m_byteArray ));
m_stream->open( IO_WriteOnly );
return true;
}
-bool KoTarStore::openRead( const QString& name )
+bool KoTarStore::openRead( const TQString& name )
{
const KTarEntry * entry = m_pTar->directory()->entry( name );
if ( entry == 0L )
@@ -166,7 +166,7 @@ bool KoTarStore::closeWrite()
return true;
}
-bool KoTarStore::enterRelativeDirectory( const QString& dirName )
+bool KoTarStore::enterRelativeDirectory( const TQString& dirName )
{
if ( m_mode == Read ) {
if ( !m_currentDir ) {
@@ -184,7 +184,7 @@ bool KoTarStore::enterRelativeDirectory( const QString& dirName )
return true;
}
-bool KoTarStore::enterAbsoluteDirectory( const QString& path )
+bool KoTarStore::enterAbsoluteDirectory( const TQString& path )
{
if ( path.isEmpty() )
{
@@ -200,7 +200,7 @@ bool KoTarStore::enterAbsoluteDirectory( const QString& path )
return true;
}
-bool KoTarStore::fileExists( const QString& absPath ) const
+bool KoTarStore::fileExists( const TQString& absPath ) const
{
return m_pTar->directory()->entry( absPath ) != 0;
}
diff --git a/lib/store/KoTarStore.h b/lib/store/KoTarStore.h
index 21ab3ac6..982c1b8d 100644
--- a/lib/store/KoTarStore.h
+++ b/lib/store/KoTarStore.h
@@ -29,26 +29,26 @@ class KURL;
class KoTarStore : public KoStoreBase
{
public:
- KoTarStore( const QString & _filename, Mode _mode, const QCString & appIdentification );
- KoTarStore( QIODevice *dev, Mode mode, const QCString & appIdentification );
+ KoTarStore( const TQString & _filename, Mode _mode, const TQCString & appIdentification );
+ KoTarStore( TQIODevice *dev, Mode mode, const TQCString & appIdentification );
/**
* KURL-constructor
* @todo saving not completely implemented (fixed temporary file)
* @since 1.4
*/
- KoTarStore( QWidget* window, const KURL& url, const QString & _filename, Mode _mode, const QCString & appIdentification );
+ KoTarStore( TQWidget* window, const KURL& url, const TQString & _filename, Mode _mode, const TQCString & appIdentification );
~KoTarStore();
protected:
virtual bool init( Mode _mode );
- virtual bool openWrite( const QString& name );
- virtual bool openRead( const QString& name );
+ virtual bool openWrite( const TQString& name );
+ virtual bool openRead( const TQString& name );
virtual bool closeWrite();
virtual bool closeRead() { return true; }
- virtual bool enterRelativeDirectory( const QString& dirName );
- virtual bool enterAbsoluteDirectory( const QString& path );
- virtual bool fileExists( const QString& absPath ) const;
+ virtual bool enterRelativeDirectory( const TQString& dirName );
+ virtual bool enterAbsoluteDirectory( const TQString& path );
+ virtual bool fileExists( const TQString& absPath ) const;
- static QCString completeMagic( const QCString& appMimetype );
+ static TQCString completeMagic( const TQCString& appMimetype );
/// The tar archive
KTar * m_pTar;
@@ -58,7 +58,7 @@ protected:
const KArchiveDirectory* m_currentDir;
/// Buffer used when writing
- QByteArray m_byteArray;
+ TQByteArray m_byteArray;
};
diff --git a/lib/store/KoXmlWriter.cpp b/lib/store/KoXmlWriter.cpp
index 2670e304..6b2bf039 100644
--- a/lib/store/KoXmlWriter.cpp
+++ b/lib/store/KoXmlWriter.cpp
@@ -21,12 +21,12 @@
#include <kglobal.h> // kMin
#include <kdebug.h>
-#include <qiodevice.h>
+#include <tqiodevice.h>
#include <float.h>
static const int s_indentBufferLength = 100;
-KoXmlWriter::KoXmlWriter( QIODevice* dev, int indentLevel )
+KoXmlWriter::KoXmlWriter( TQIODevice* dev, int indentLevel )
: m_dev( dev ), m_baseIndentLevel( indentLevel )
{
init();
@@ -67,36 +67,36 @@ void KoXmlWriter::startDocument( const char* rootElemName, const char* publicId,
void KoXmlWriter::endDocument()
{
- // just to do exactly like QDom does (newline at end of file).
+ // just to do exactly like TQDom does (newline at end of file).
writeChar( '\n' );
Q_ASSERT( m_tags.isEmpty() );
}
-// returns the value of indentInside of the parent
+// returns the value of indentInside of the tqparent
bool KoXmlWriter::prepareForChild()
{
if ( !m_tags.isEmpty() ) {
- Tag& parent = m_tags.top();
- if ( !parent.hasChildren ) {
- closeStartElement( parent );
- parent.hasChildren = true;
- parent.lastChildIsText = false;
+ Tag& tqparent = m_tags.top();
+ if ( !tqparent.hasChildren ) {
+ closeStartElement( tqparent );
+ tqparent.hasChildren = true;
+ tqparent.lastChildIsText = false;
}
- if ( parent.indentInside ) {
+ if ( tqparent.indentInside ) {
writeIndent();
}
- return parent.indentInside;
+ return tqparent.indentInside;
}
return true;
}
void KoXmlWriter::prepareForTextNode()
{
- Tag& parent = m_tags.top();
- if ( !parent.hasChildren ) {
- closeStartElement( parent );
- parent.hasChildren = true;
- parent.lastChildIsText = true;
+ Tag& tqparent = m_tags.top();
+ if ( !tqparent.hasChildren ) {
+ closeStartElement( tqparent );
+ tqparent.hasChildren = true;
+ tqparent.lastChildIsText = true;
}
}
@@ -104,10 +104,10 @@ void KoXmlWriter::startElement( const char* tagName, bool indentInside )
{
Q_ASSERT( tagName != 0 );
- // Tell parent that it has children
- bool parentIndent = prepareForChild();
+ // Tell tqparent that it has tqchildren
+ bool tqparentIndent = prepareForChild();
- m_tags.push( Tag( tagName, parentIndent && indentInside ) );
+ m_tags.push( Tag( tagName, tqparentIndent && indentInside ) );
writeChar( '<' );
writeCString( tagName );
//kdDebug() << k_funcinfo << tagName << endl;
@@ -120,7 +120,7 @@ void KoXmlWriter::addCompleteElement( const char* cstr )
}
-void KoXmlWriter::addCompleteElement( QIODevice* indev )
+void KoXmlWriter::addCompleteElement( TQIODevice* indev )
{
prepareForChild();
bool openOk = indev->open( IO_ReadOnly );
@@ -128,9 +128,9 @@ void KoXmlWriter::addCompleteElement( QIODevice* indev )
if ( !openOk )
return;
static const int MAX_CHUNK_SIZE = 8*1024; // 8 KB
- QByteArray buffer(MAX_CHUNK_SIZE);
+ TQByteArray buffer(MAX_CHUNK_SIZE);
while ( !indev->atEnd() ) {
- Q_LONG len = indev->readBlock( buffer.data(), buffer.size() );
+ TQ_LONG len = indev->readBlock( buffer.data(), buffer.size() );
if ( len <= 0 ) // e.g. on error
break;
m_dev->writeBlock( buffer.data(), len );
@@ -191,14 +191,14 @@ void KoXmlWriter::addAttribute( const char* attrName, const char* value )
void KoXmlWriter::addAttribute( const char* attrName, double value )
{
- QCString str;
+ TQCString str;
str.setNum( value, 'g', DBL_DIG );
addAttribute( attrName, str.data() );
}
void KoXmlWriter::addAttributePt( const char* attrName, double value )
{
- QCString str;
+ TQCString str;
str.setNum( value, 'g', DBL_DIG );
str += "pt";
addAttribute( attrName, str.data() );
@@ -211,10 +211,10 @@ void KoXmlWriter::writeIndent()
s_indentBufferLength ) );
}
-void KoXmlWriter::writeString( const QString& str )
+void KoXmlWriter::writeString( const TQString& str )
{
// cachegrind says .utf8() is where most of the time is spent
- QCString cstr = str.utf8();
+ TQCString cstr = str.utf8();
m_dev->writeBlock( cstr.data(), cstr.size() - 1 );
}
@@ -235,7 +235,7 @@ char* KoXmlWriter::escapeForXML( const char* source, int length = -1 ) const
// we drop the idea of using it, and we allocate a bigger buffer.
// Note that this if() can only be hit once per call to the method.
if ( length == -1 )
- length = qstrlen( source ); // expensive...
+ length = tqstrlen( source ); // expensive...
uint newLength = length * 6 + 1; // worst case. 6 is due to &quot; and &apos;
char* buffer = new char[ newLength ];
destBoundary = buffer + newLength;
@@ -280,7 +280,7 @@ char* KoXmlWriter::escapeForXML( const char* source, int length = -1 ) const
return output;
}
-void KoXmlWriter::addManifestEntry( const QString& fullPath, const QString& mediaType )
+void KoXmlWriter::addManifestEntry( const TQString& fullPath, const TQString& mediaType )
{
startElement( "manifest:file-entry" );
addAttribute( "manifest:media-type", mediaType );
@@ -288,7 +288,7 @@ void KoXmlWriter::addManifestEntry( const QString& fullPath, const QString& medi
endElement();
}
-void KoXmlWriter::addConfigItem( const QString & configName, const QString& value )
+void KoXmlWriter::addConfigItem( const TQString & configName, const TQString& value )
{
startElement( "config:config-item" );
addAttribute( "config:name", configName );
@@ -297,7 +297,7 @@ void KoXmlWriter::addConfigItem( const QString & configName, const QString& valu
endElement();
}
-void KoXmlWriter::addConfigItem( const QString & configName, bool value )
+void KoXmlWriter::addConfigItem( const TQString & configName, bool value )
{
startElement( "config:config-item" );
addAttribute( "config:name", configName );
@@ -306,61 +306,61 @@ void KoXmlWriter::addConfigItem( const QString & configName, bool value )
endElement();
}
-void KoXmlWriter::addConfigItem( const QString & configName, int value )
+void KoXmlWriter::addConfigItem( const TQString & configName, int value )
{
startElement( "config:config-item" );
addAttribute( "config:name", configName );
addAttribute( "config:type", "int");
- addTextNode(QString::number( value ) );
+ addTextNode(TQString::number( value ) );
endElement();
}
-void KoXmlWriter::addConfigItem( const QString & configName, double value )
+void KoXmlWriter::addConfigItem( const TQString & configName, double value )
{
startElement( "config:config-item" );
addAttribute( "config:name", configName );
addAttribute( "config:type", "double" );
- addTextNode( QString::number( value ) );
+ addTextNode( TQString::number( value ) );
endElement();
}
-void KoXmlWriter::addConfigItem( const QString & configName, long value )
+void KoXmlWriter::addConfigItem( const TQString & configName, long value )
{
startElement( "config:config-item" );
addAttribute( "config:name", configName );
addAttribute( "config:type", "long" );
- addTextNode( QString::number( value ) );
+ addTextNode( TQString::number( value ) );
endElement();
}
-void KoXmlWriter::addConfigItem( const QString & configName, short value )
+void KoXmlWriter::addConfigItem( const TQString & configName, short value )
{
startElement( "config:config-item" );
addAttribute( "config:name", configName );
addAttribute( "config:type", "short" );
- addTextNode( QString::number( value ) );
+ addTextNode( TQString::number( value ) );
endElement();
}
-void KoXmlWriter::addTextSpan( const QString& text )
+void KoXmlWriter::addTextSpan( const TQString& text )
{
- QMap<int, int> tabCache;
+ TQMap<int, int> tabCache;
addTextSpan( text, tabCache );
}
-void KoXmlWriter::addTextSpan( const QString& text, const QMap<int, int>& tabCache )
+void KoXmlWriter::addTextSpan( const TQString& text, const TQMap<int, int>& tabCache )
{
uint len = text.length();
int nrSpaces = 0; // number of consecutive spaces
bool leadingSpace = false;
- QString str;
+ TQString str;
str.reserve( len );
// Accumulate chars either in str or in nrSpaces (for spaces).
// Flush str when writing a subelement (for spaces or for another reason)
// Flush nrSpaces when encountering two or more consecutive spaces
for ( uint i = 0; i < len ; ++i ) {
- QChar ch = text[i];
+ TQChar ch = text[i];
if ( ch != ' ' ) {
if ( nrSpaces > 0 ) {
// For the first space we use ' '.
@@ -377,7 +377,7 @@ void KoXmlWriter::addTextSpan( const QString& text, const QMap<int, int>& tabCac
if ( nrSpaces > 0 ) { // there are more spaces
if ( !str.isEmpty() )
addTextNode( str );
- str = QString::null;
+ str = TQString();
startElement( "text:s" );
if ( nrSpaces > 1 ) // it's 1 by default
addAttribute( "text:c", nrSpaces );
@@ -387,20 +387,20 @@ void KoXmlWriter::addTextSpan( const QString& text, const QMap<int, int>& tabCac
nrSpaces = 0;
leadingSpace = false;
}
- switch ( ch.unicode() ) {
+ switch ( ch.tqunicode() ) {
case '\t':
if ( !str.isEmpty() )
addTextNode( str );
- str = QString::null;
+ str = TQString();
startElement( "text:tab" );
- if ( tabCache.contains( i ) )
+ if ( tabCache.tqcontains( i ) )
addAttribute( "text:tab-ref", tabCache[i] + 1 );
endElement();
break;
case '\n':
if ( !str.isEmpty() )
addTextNode( str );
- str = QString::null;
+ str = TQString();
startElement( "text:line-break" );
endElement();
break;
diff --git a/lib/store/KoXmlWriter.h b/lib/store/KoXmlWriter.h
index 232f9a65..5261dd5f 100644
--- a/lib/store/KoXmlWriter.h
+++ b/lib/store/KoXmlWriter.h
@@ -20,32 +20,32 @@
#ifndef XMLWRITER_H
#define XMLWRITER_H
-#include <qstring.h>
-#include <qvaluestack.h>
-#include <qmap.h>
+#include <tqstring.h>
+#include <tqvaluestack.h>
+#include <tqmap.h>
#include <koffice_export.h>
-class QIODevice;
+class TQIODevice;
/**
- * A class for writing out XML (to any QIODevice), with a special attention on performance.
+ * A class for writing out XML (to any TQIODevice), with a special attention on performance.
* The XML is being written out along the way, which avoids requiring the entire
- * document in memory (like QDom does), and avoids using QTextStream at all
- * (which in Qt3 has major performance issues when converting to utf8).
+ * document in memory (like TQDom does), and avoids using TQTextStream at all
+ * (which in TQt3 has major performance issues when converting to utf8).
*/
class KOSTORE_EXPORT KoXmlWriter
{
public:
/**
* Create a KoXmlWriter instance to write out an XML document into
- * the given QIODevice.
+ * the given TQIODevice.
*/
- KoXmlWriter( QIODevice* dev, int indentLevel = 0 );
+ KoXmlWriter( TQIODevice* dev, int indentLevel = 0 );
/// Destructor
~KoXmlWriter();
- QIODevice *device() const { return m_dev; }
+ TQIODevice *device() const { return m_dev; }
/**
* Start the XML document.
@@ -73,14 +73,14 @@ public:
* Overloaded version of addAttribute( const char*, const char* ),
* which is a bit slower because it needs to convert @p value to utf8 first.
*/
- inline void addAttribute( const char* attrName, const QString& value ) {
+ inline void addAttribute( const char* attrName, const TQString& value ) {
addAttribute( attrName, value.utf8() );
}
/**
* Add an attribute whose value is an integer
*/
inline void addAttribute( const char* attrName, int value ) {
- QCString str;
+ TQCString str;
str.setNum( value );
addAttribute( attrName, str.data() );
}
@@ -88,26 +88,26 @@ public:
* Add an attribute whose value is an unsigned integer
*/
inline void addAttribute( const char* attrName, uint value ) {
- QCString str;
+ TQCString str;
str.setNum( value );
addAttribute( attrName, str.data() );
}
/**
* Add an attribute whose value is a floating point number
* The number is written out with the highest possible precision
- * (unlike QString::number and setNum, which default to 6 digits)
+ * (unlike TQString::number and setNum, which default to 6 digits)
*/
void addAttribute( const char* attrName, double value );
/**
* Add an attribute which represents a distance, measured in pt
* The number is written out with the highest possible precision
- * (unlike QString::number and setNum, which default to 6 digits),
+ * (unlike TQString::number and setNum, which default to 6 digits),
* and the unit name ("pt") is appended to it.
*/
void addAttributePt( const char* attrName, double value );
/// Overloaded version of the one taking a const char* argument, for convenience
- inline void addAttribute( const char* attrName, const QCString& value ) {
+ inline void addAttribute( const char* attrName, const TQCString& value ) {
addAttribute( attrName, value.data() );
}
/**
@@ -123,11 +123,11 @@ public:
* Overloaded version of addTextNode( const char* ),
* which is a bit slower because it needs to convert @p str to utf8 first.
*/
- inline void addTextNode( const QString& str ) {
+ inline void addTextNode( const TQString& str ) {
addTextNode( str.utf8() );
}
/// Overloaded version of the one taking a const char* argument
- inline void addTextNode( const QCString& cstr ) {
+ inline void addTextNode( const TQCString& cstr ) {
addTextNode( cstr.data() );
}
/**
@@ -165,7 +165,7 @@ public:
* for XML already, so it will usually come from another KoXmlWriter.
* This is usually used with KTempFile.
*/
- void addCompleteElement( QIODevice* dev );
+ void addCompleteElement( TQIODevice* dev );
// #### Maybe we want to subclass KoXmlWriter for manifest files.
/**
@@ -175,23 +175,23 @@ public:
* when we add support for encrypting/signing.
* @note OASIS-specific
*/
- void addManifestEntry( const QString& fullPath, const QString& mediaType );
+ void addManifestEntry( const TQString& fullPath, const TQString& mediaType );
/**
* Special helper for writing config item into settings.xml
* @note OASIS-specific
*/
- void addConfigItem( const QString & configName, const QString& value );
+ void addConfigItem( const TQString & configName, const TQString& value );
/// @note OASIS-specific
- void addConfigItem( const QString & configName, bool value );
+ void addConfigItem( const TQString & configName, bool value );
/// @note OASIS-specific
- void addConfigItem( const QString & configName, int value );
+ void addConfigItem( const TQString & configName, int value );
/// @note OASIS-specific
- void addConfigItem( const QString & configName, double value );
+ void addConfigItem( const TQString & configName, double value );
/// @note OASIS-specific
- void addConfigItem( const QString & configName, long value );
+ void addConfigItem( const TQString & configName, long value );
/// @note OASIS-specific
- void addConfigItem( const QString & configName, short value );
+ void addConfigItem( const TQString & configName, short value );
// TODO addConfigItem for datetime and base64Binary
@@ -205,14 +205,14 @@ public:
*
* @note OASIS-specific
*/
- void addTextSpan( const QString& text );
+ void addTextSpan( const TQString& text );
/**
* Overloaded version of addTextSpan which takes an additional tabCache map.
* @param text the text to write
* @param tabCache optional map allowing to find a tab for a given character index
* @note OASIS-specific
*/
- void addTextSpan( const QString& text, const QMap<int, int>& tabCache );
+ void addTextSpan( const TQString& text, const TQMap<int, int>& tabCache );
/**
* @return the current indentation level.
@@ -226,7 +226,7 @@ private:
: tagName( t ), hasChildren( false ), lastChildIsText( false ),
openingTagClosed( false ), indentInside( ind ) {}
const char* tagName;
- bool hasChildren; ///< element or text children
+ bool hasChildren; ///< element or text tqchildren
bool lastChildIsText; ///< last child is a text node
bool openingTagClosed; ///< true once the '\>' in \<tag a="b"\> is written out
bool indentInside; ///< whether to indent the contents of this tag
@@ -237,15 +237,15 @@ private:
// writeCString is much faster than writeString.
// Try to use it as much as possible, especially with constants.
- void writeString( const QString& str );
+ void writeString( const TQString& str );
// unused and possibly incorrect if length != size
- //inline void writeCString( const QCString& cstr ) {
+ //inline void writeCString( const TQCString& cstr ) {
// m_dev->writeBlock( cstr.data(), cstr.size() - 1 );
//}
inline void writeCString( const char* cstr ) {
- m_dev->writeBlock( cstr, qstrlen( cstr ) );
+ m_dev->writeBlock( cstr, tqstrlen( cstr ) );
}
inline void writeChar( char c ) {
m_dev->putch( c );
@@ -261,8 +261,8 @@ private:
void prepareForTextNode();
void init();
- QIODevice* m_dev;
- QValueStack<Tag> m_tags;
+ TQIODevice* m_dev;
+ TQValueStack<Tag> m_tags;
int m_baseIndentLevel;
class Private;
diff --git a/lib/store/KoZipStore.cpp b/lib/store/KoZipStore.cpp
index 58aa2181..1fbe6145 100644
--- a/lib/store/KoZipStore.cpp
+++ b/lib/store/KoZipStore.cpp
@@ -19,7 +19,7 @@
#include "KoZipStore.h"
-#include <qbuffer.h>
+#include <tqbuffer.h>
#include <kzip.h>
#include <kdebug.h>
@@ -27,11 +27,11 @@
#include <kurl.h>
#include <kio/netaccess.h>
#if ! KDE_IS_VERSION( 3, 4, 1 )
-#include <qdir.h>
-#include <qfileinfo.h>
+#include <tqdir.h>
+#include <tqfileinfo.h>
#endif
-KoZipStore::KoZipStore( const QString & _filename, Mode _mode, const QCString & appIdentification )
+KoZipStore::KoZipStore( const TQString & _filename, Mode _mode, const TQCString & appIdentification )
{
kdDebug(s_area) << "KoZipStore Constructor filename = " << _filename
<< " mode = " << int(_mode)
@@ -42,8 +42,8 @@ KoZipStore::KoZipStore( const QString & _filename, Mode _mode, const QCString &
#if ! KDE_IS_VERSION( 3, 4, 1 )
// Workaround for KZip KSaveFile double deletion in kdelibs-3.4,
// when trying to write to a non-writable directory.
- QDir dir( QFileInfo( _filename ).dir() );
- if (_mode == Write && !QFileInfo( dir.path() ).isWritable() )
+ TQDir dir( TQFileInfo( _filename ).dir() );
+ if (_mode == Write && !TQFileInfo( dir.path() ).isWritable() )
{
kdWarning(s_area) << dir.path() << " isn't writable" << endl;
m_bGood = false;
@@ -57,13 +57,13 @@ KoZipStore::KoZipStore( const QString & _filename, Mode _mode, const QCString &
}
}
-KoZipStore::KoZipStore( QIODevice *dev, Mode mode, const QCString & appIdentification )
+KoZipStore::KoZipStore( TQIODevice *dev, Mode mode, const TQCString & appIdentification )
{
m_pZip = new KZip( dev );
m_bGood = init( mode, appIdentification );
}
-KoZipStore::KoZipStore( QWidget* window, const KURL & _url, const QString & _filename, Mode _mode, const QCString & appIdentification )
+KoZipStore::KoZipStore( TQWidget* window, const KURL & _url, const TQString & _filename, Mode _mode, const TQCString & appIdentification )
{
kdDebug(s_area) << "KoZipStore Constructor url" << _url.prettyURL()
<< " filename = " << _filename
@@ -107,7 +107,7 @@ KoZipStore::~KoZipStore()
}
}
-bool KoZipStore::init( Mode _mode, const QCString& appIdentification )
+bool KoZipStore::init( Mode _mode, const TQCString& appIdentification )
{
KoStore::init( _mode );
m_currentDir = 0;
@@ -129,12 +129,12 @@ bool KoZipStore::init( Mode _mode, const QCString& appIdentification )
return good;
}
-bool KoZipStore::openWrite( const QString& name )
+bool KoZipStore::openWrite( const TQString& name )
{
#if 0
// Prepare memory buffer for writing
m_byteArray.resize( 0 );
- m_stream = new QBuffer( m_byteArray );
+ m_stream = new TQBuffer( m_byteArray );
m_stream->open( IO_WriteOnly );
return true;
#endif
@@ -142,7 +142,7 @@ bool KoZipStore::openWrite( const QString& name )
return m_pZip->prepareWriting( name, "", "" /*m_pZip->rootDir()->user(), m_pZip->rootDir()->group()*/, 0 );
}
-bool KoZipStore::openRead( const QString& name )
+bool KoZipStore::openRead( const TQString& name )
{
const KArchiveEntry * entry = m_pZip->directory()->entry( name );
if ( entry == 0L )
@@ -165,7 +165,7 @@ bool KoZipStore::openRead( const QString& name )
return true;
}
-Q_LONG KoZipStore::write( const char* _data, Q_ULONG _len )
+TQ_LONG KoZipStore::write( const char* _data, TQ_ULONG _len )
{
if ( _len == 0L ) return 0;
//kdDebug(s_area) << "KoZipStore::write " << _len << endl;
@@ -200,7 +200,7 @@ bool KoZipStore::closeWrite()
#endif
}
-bool KoZipStore::enterRelativeDirectory( const QString& dirName )
+bool KoZipStore::enterRelativeDirectory( const TQString& dirName )
{
if ( m_mode == Read ) {
if ( !m_currentDir ) {
@@ -218,7 +218,7 @@ bool KoZipStore::enterRelativeDirectory( const QString& dirName )
return true;
}
-bool KoZipStore::enterAbsoluteDirectory( const QString& path )
+bool KoZipStore::enterAbsoluteDirectory( const TQString& path )
{
if ( path.isEmpty() )
{
@@ -230,7 +230,7 @@ bool KoZipStore::enterAbsoluteDirectory( const QString& path )
return m_currentDir != 0;
}
-bool KoZipStore::fileExists( const QString& absPath ) const
+bool KoZipStore::fileExists( const TQString& absPath ) const
{
const KArchiveEntry *entry = m_pZip->directory()->entry( absPath );
return entry && entry->isFile();
diff --git a/lib/store/KoZipStore.h b/lib/store/KoZipStore.h
index 9bde4fe3..db643275 100644
--- a/lib/store/KoZipStore.h
+++ b/lib/store/KoZipStore.h
@@ -29,26 +29,26 @@ class KURL;
class KoZipStore : public KoStoreBase
{
public:
- KoZipStore( const QString & _filename, Mode _mode, const QCString & appIdentification );
- KoZipStore( QIODevice *dev, Mode mode, const QCString & appIdentification );
+ KoZipStore( const TQString & _filename, Mode _mode, const TQCString & appIdentification );
+ KoZipStore( TQIODevice *dev, Mode mode, const TQCString & appIdentification );
/**
* KURL-constructor
* @todo saving not completely implemented (fixed temporary file)
* @since 1.4
*/
- KoZipStore( QWidget* window, const KURL& _url, const QString & _filename, Mode _mode, const QCString & appIdentification );
+ KoZipStore( TQWidget* window, const KURL& _url, const TQString & _filename, Mode _mode, const TQCString & appIdentification );
~KoZipStore();
- virtual Q_LONG write( const char* _data, Q_ULONG _len );
+ virtual TQ_LONG write( const char* _data, TQ_ULONG _len );
protected:
- virtual bool init( Mode _mode, const QCString& appIdentification );
- virtual bool openWrite( const QString& name );
- virtual bool openRead( const QString& name );
+ virtual bool init( Mode _mode, const TQCString& appIdentification );
+ virtual bool openWrite( const TQString& name );
+ virtual bool openRead( const TQString& name );
virtual bool closeWrite();
virtual bool closeRead() { return true; }
- virtual bool enterRelativeDirectory( const QString& dirName );
- virtual bool enterAbsoluteDirectory( const QString& path );
- virtual bool fileExists( const QString& absPath ) const;
+ virtual bool enterRelativeDirectory( const TQString& dirName );
+ virtual bool enterAbsoluteDirectory( const TQString& path );
+ virtual bool fileExists( const TQString& absPath ) const;
/// The archive
KZip * m_pZip;
diff --git a/lib/store/fix_storage.pl b/lib/store/fix_storage.pl
index 8b13a397..ba605616 100644
--- a/lib/store/fix_storage.pl
+++ b/lib/store/fix_storage.pl
@@ -62,9 +62,9 @@ sub dumpTree {
# Finds the files where we have to fix part references (->maindoc.xml)
sub findCandidates {
- my($dref, $currentdir, $parentdir) = @_;
+ my($dref, $currentdir, $tqparentdir) = @_;
my @dir = @{$dref};
- #print "current: $currentdir, parentdir: $parentdir\n";
+ #print "current: $currentdir, tqparentdir: $tqparentdir\n";
foreach(@dir) {
if(ref($_) eq 'ARRAY') {
#print $_->[0], " (", $_->[1], ")\n";
@@ -72,8 +72,8 @@ sub findCandidates {
}
else {
if($_ =~ m/maindoc\.xml/) {
- my $source = $parentdir . '/' . $currentdir . "/maindoc.xml";
- my $dest = $parentdir . '/' . $currentdir . ".xml";
+ my $source = $tqparentdir . '/' . $currentdir . "/maindoc.xml";
+ my $dest = $tqparentdir . '/' . $currentdir . ".xml";
push(@needFixing, [ $source, $dest ]);
}
}
diff --git a/lib/store/tests/storage_test.cpp b/lib/store/tests/storage_test.cpp
index 6fd03bf3..1c7269ad 100644
--- a/lib/store/tests/storage_test.cpp
+++ b/lib/store/tests/storage_test.cpp
@@ -17,8 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qfile.h>
-#include <qdir.h>
+#include <tqfile.h>
+#include <tqdir.h>
#include <kcmdlineargs.h>
#include <kapplication.h>
@@ -44,21 +44,21 @@ namespace {
const char* const unableToRead = "Couldn't read stream back!";
}
-int cleanUp( KoStore* store, const QString& testFile, const char* error )
+int cleanUp( KoStore* store, const TQString& testFile, const char* error )
{
- QFile::remove( testFile );
+ TQFile::remove( testFile );
delete store;
kdDebug() << error << endl;
return 1;
}
-int test( const char* testName, KoStore::Backend backend, const QString& testFile )
+int test( const char* testName, KoStore::Backend backend, const TQString& testFile )
{
- if ( QFile::exists( testFile ) )
- QFile::remove( testFile );
- QDir dirTest( testFile );
+ if ( TQFile::exists( testFile ) )
+ TQFile::remove( testFile );
+ TQDir dirTest( testFile );
if ( dirTest.exists() ) {
- system( QCString( "rm -rf " ) + QFile::encodeName( testFile ) ); // QDir::rmdir isn't recursive!
+ system( TQCString( "rm -rf " ) + TQFile::encodeName( testFile ) ); // TQDir::rmdir isn't recursive!
}
kdDebug() << "======================="<<testName<<"====================================" << endl;
@@ -75,7 +75,7 @@ int test( const char* testName, KoStore::Backend backend, const QString& testFil
return cleanUp( store, testFile, unableToOpen );
store->enterDirectory( testDir );
- if ( store->currentPath() != QString( testDirResult ) )
+ if ( store->currentPath() != TQString( testDirResult ) )
return cleanUp( store, testFile, brokenPath );
if ( store->open( "test2/with/a/relative/dir.txt" ) ) {
@@ -94,7 +94,7 @@ int test( const char* testName, KoStore::Backend backend, const QString& testFil
return cleanUp( store, testFile, unableToOpen );
store->enterDirectory( testDir2 );
- if ( store->currentPath() != QString( testDir2Result ) )
+ if ( store->currentPath() != TQString( testDir2Result ) )
return cleanUp( store, testFile, brokenPath );
if ( store->open( "root" ) ) {
@@ -115,7 +115,7 @@ int test( const char* testName, KoStore::Backend backend, const QString& testFil
return cleanUp( store, testFile, badStorage );
if ( store->open( "test1/with/a/relative/dir.txt" ) ) {
- QIODevice* dev = store->device();
+ TQIODevice* dev = store->device();
int i = 0, lim = strlen( test1 ), count = 0;
while ( static_cast<char>( dev->getch() ) == test1[i++] ) {
if ( i == lim ) {
@@ -131,11 +131,11 @@ int test( const char* testName, KoStore::Backend backend, const QString& testFil
return cleanUp( store, testFile, unableToOpen );
store->enterDirectory( testDir );
- if ( store->currentPath() != QString( testDirResult ) )
+ if ( store->currentPath() != TQString( testDirResult ) )
return cleanUp( store, testFile, brokenPath );
if ( store->open( "test2/with/a/relative/dir.txt" ) ) {
- QIODevice* dev = store->device();
+ TQIODevice* dev = store->device();
int i = 0, lim = strlen( test2 ), count = 0;
while ( static_cast<char>( dev->getch() ) == test2[i++] ) {
if ( i == lim ) {
@@ -155,12 +155,12 @@ int test( const char* testName, KoStore::Backend backend, const QString& testFil
while ( store->leaveDirectory() );
store->enterDirectory( testDir );
- if ( store->currentPath() != QString( testDirResult ) )
+ if ( store->currentPath() != TQString( testDirResult ) )
return cleanUp( store, testFile, brokenPath );
if ( store->open( "root" ) ) {
if ( store->size() == 22 ) {
- QIODevice* dev = store->device();
+ TQIODevice* dev = store->device();
unsigned int i = 0;
while ( static_cast<char>( dev->getch() ) == test3[i++] );
store->close();
@@ -180,7 +180,7 @@ int test( const char* testName, KoStore::Backend backend, const QString& testFil
}
store->popDirectory();
- if ( store->currentPath() != QString( testDir2Result ) )
+ if ( store->currentPath() != TQString( testDir2Result ) )
return cleanUp( store, testFile, brokenPath );
if ( store->open( "root" ) ) {
@@ -197,7 +197,7 @@ int test( const char* testName, KoStore::Backend backend, const QString& testFil
if ( store->isOpen() )
store->close();
delete store;
- QFile::remove( testFile );
+ TQFile::remove( testFile );
kdDebug() << "===========================================================" << endl;
return 0;
@@ -210,7 +210,7 @@ int main( int argc, char **argv )
// KZip (due to KSaveFile) doesn't support relative filenames
// So use $PWD as base for the paths explicitely.
- const QString testDir = QDir::currentDirPath();
+ const TQString testDir = TQDir::currentDirPath();
if ( test( "Tar", KoStore::Tar, testDir+"test.tgz" ) != 0 )
return 1;
if ( test( "Directory", KoStore::Directory, testDir+"testdir/maindoc.xml" ) != 0 )
diff --git a/lib/store/tests/storedroptest.cpp b/lib/store/tests/storedroptest.cpp
index 0510ea62..344cab54 100644
--- a/lib/store/tests/storedroptest.cpp
+++ b/lib/store/tests/storedroptest.cpp
@@ -1,25 +1,25 @@
#include <kapplication.h>
#include <kcmdlineargs.h>
#include <KoStore.h>
-#include <qtextbrowser.h>
-#include <qstringlist.h>
-#include <qbuffer.h>
-#include <qclipboard.h>
+#include <tqtextbrowser.h>
+#include <tqstringlist.h>
+#include <tqbuffer.h>
+#include <tqclipboard.h>
-class StoreDropTest : public QTextBrowser
+class StoreDropTest : public TQTextBrowser
{
public:
- StoreDropTest( QWidget* parent );
+ StoreDropTest( TQWidget* tqparent );
protected:
- virtual void contentsDragEnterEvent( QDragEnterEvent * e );
- virtual void contentsDragMoveEvent( QDragMoveEvent * e );
- virtual void contentsDropEvent( QDropEvent * e );
- virtual void keyPressEvent( QKeyEvent * e );
+ virtual void contentsDragEnterEvent( TQDragEnterEvent * e );
+ virtual void contentsDragMoveEvent( TQDragMoveEvent * e );
+ virtual void contentsDropEvent( TQDropEvent * e );
+ virtual void keyPressEvent( TQKeyEvent * e );
virtual void paste();
private:
- bool processMimeSource( QMimeSource* ev );
- void showZipContents( QByteArray data, const char* mimeType, bool oasis );
- QString loadTextFile( KoStore* store, const QString& fileName );
+ bool processMimeSource( TQMimeSource* ev );
+ void showZipContents( TQByteArray data, const char* mimeType, bool oasis );
+ TQString loadTextFile( KoStore* store, const TQString& fileName );
};
int main( int argc, char** argv )
@@ -32,46 +32,46 @@ int main( int argc, char** argv )
window->resize( 500, 500 );
window->show();
- QObject::connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
+ TQObject::connect( tqApp, TQT_SIGNAL( lastWindowClosed() ), tqApp, TQT_SLOT( quit() ) );
return app.exec();
}
-StoreDropTest::StoreDropTest( QWidget* parent )
- : QTextBrowser( parent )
+StoreDropTest::StoreDropTest( TQWidget* tqparent )
+ : TQTextBrowser( tqparent )
{
setText( "KoStore drop/paste test\nDrop or paste a selection from a KOffice application into this widget to see the ZIP contents" );
setAcceptDrops( true );
}
-void StoreDropTest::contentsDragEnterEvent( QDragEnterEvent * ev )
+void StoreDropTest::contentsDragEnterEvent( TQDragEnterEvent * ev )
{
ev->acceptAction();
}
-void StoreDropTest::contentsDragMoveEvent( QDragMoveEvent * ev )
+void StoreDropTest::contentsDragMoveEvent( TQDragMoveEvent * ev )
{
ev->acceptAction();
}
-void StoreDropTest::keyPressEvent( QKeyEvent * e )
+void StoreDropTest::keyPressEvent( TQKeyEvent * e )
{
if ( ( ( e->state() & ShiftButton ) && e->key() == Key_Insert ) ||
( ( e->state() & ControlButton ) && e->key() == Key_V ) )
paste();
//else
- // QTextBrowser::keyPressEvent( e );
+ // TQTextBrowser::keyPressEvent( e );
}
void StoreDropTest::paste()
{
qDebug( "paste" );
- QMimeSource* m = QApplication::clipboard()->data();
+ TQMimeSource* m = TQApplication::tqclipboard()->data();
if ( !m )
return;
processMimeSource( m );
}
-void StoreDropTest::contentsDropEvent( QDropEvent *ev )
+void StoreDropTest::contentsDropEvent( TQDropEvent *ev )
{
if ( processMimeSource( ev ) )
ev->acceptAction();
@@ -79,16 +79,16 @@ void StoreDropTest::contentsDropEvent( QDropEvent *ev )
ev->ignore();
}
-bool StoreDropTest::processMimeSource( QMimeSource* ev )
+bool StoreDropTest::processMimeSource( TQMimeSource* ev )
{
- const QCString acceptMimeType = "application/vnd.oasis.opendocument.";
+ const TQCString acceptMimeType = "application/vnd.oasis.opendocument.";
const char* fmt;
- QStringList formats;
+ TQStringList formats;
for (int i=0; (fmt = ev->format(i)); i++) {
formats += fmt;
- bool oasis = QString( fmt ).startsWith( acceptMimeType );
- if ( oasis || QString( fmt ) == "application/x-kpresenter" ) {
- QByteArray data = ev->encodedData( fmt );
+ bool oasis = TQString( fmt ).startsWith( acceptMimeType );
+ if ( oasis || TQString( fmt ) == "application/x-kpresenter" ) {
+ TQByteArray data = ev->tqencodedData( fmt );
showZipContents( data, fmt, oasis );
return true;
}
@@ -97,13 +97,13 @@ bool StoreDropTest::processMimeSource( QMimeSource* ev )
return false;
}
-void StoreDropTest::showZipContents( QByteArray data, const char* mimeType, bool oasis )
+void StoreDropTest::showZipContents( TQByteArray data, const char* mimeType, bool oasis )
{
if ( data.isEmpty() ) {
setText( "No data!" );
return;
}
- QBuffer buffer( data );
+ TQBuffer buffer( data );
KoStore * store = KoStore::createStore( &buffer, KoStore::Read );
if ( store->bad() ) {
setText( "Invalid ZIP!" );
@@ -111,7 +111,7 @@ void StoreDropTest::showZipContents( QByteArray data, const char* mimeType, bool
}
store->disallowNameExpansion();
- QString txt = QString( "Valid ZIP file found for format " ) + mimeType + "\n";
+ TQString txt = TQString( "Valid ZIP file found for format " ) + mimeType + "\n";
if ( oasis ) {
txt += loadTextFile( store, "content.xml" );
@@ -124,15 +124,15 @@ void StoreDropTest::showZipContents( QByteArray data, const char* mimeType, bool
setText( txt );
}
-QString StoreDropTest::loadTextFile( KoStore* store, const QString& fileName )
+TQString StoreDropTest::loadTextFile( KoStore* store, const TQString& fileName )
{
if ( !store->open( fileName ) )
- return QString( "%1 not found\n" ).arg( fileName );
+ return TQString( "%1 not found\n" ).tqarg( fileName );
- QByteArray data = store->device()->readAll();
+ TQByteArray data = store->device()->readAll();
store->close();
- QString txt = QString( "Found %1: \n" ).arg( fileName );
- txt += QString::fromUtf8( data.data(), data.size() );
+ TQString txt = TQString( "Found %1: \n" ).tqarg( fileName );
+ txt += TQString::fromUtf8( data.data(), data.size() );
txt += "\n";
return txt;
}
diff --git a/lib/store/tests/xmlwritertest.cpp b/lib/store/tests/xmlwritertest.cpp
index dad86f8f..28bd3b08 100644
--- a/lib/store/tests/xmlwritertest.cpp
+++ b/lib/store/tests/xmlwritertest.cpp
@@ -2,19 +2,19 @@
#include "KoXmlWriter.h"
-#include <qapplication.h>
-#include <qfile.h>
-#include <qdatetime.h>
+#include <tqapplication.h>
+#include <tqfile.h>
+#include <tqdatetime.h>
static const int numParagraphs = 30000;
void speedTest()
{
- QTime time;
+ TQTime time;
time.start();
- QString paragText = QString::fromUtf8( "This is the text of the paragraph. I'm including a euro sign to test encoding issues: €" );
- QCString styleName = "Heading 1";
+ TQString paragText = TQString::fromUtf8( "This is the text of the paragraph. I'm including a euro sign to test encoding issues: €" );
+ TQCString styleName = "Heading 1";
- QFile out( QString::fromLatin1( "out5.xml" ) );
+ TQFile out( TQString::tqfromLatin1( "out5.xml" ) );
if ( out.open(IO_WriteOnly) )
{
KoXmlWriter writer( &out );
@@ -35,7 +35,7 @@ void speedTest()
}
int main( int argc, char** argv ) {
- QApplication app( argc, argv, QApplication::Tty );
+ TQApplication app( argc, argv, TQApplication::Tty );
TEST_BEGIN( 0, 0 );
TEST_END( "framework test", "<r/>\n" );
@@ -78,7 +78,7 @@ int main( int argc, char** argv ) {
TEST_BEGIN( 0, 0 );
writer.startElement( "p", false /*no indent*/ );
- writer.addTextSpan( QString::fromLatin1( " \t\n foo " ) );
+ writer.addTextSpan( TQString::tqfromLatin1( " \t\n foo " ) );
writer.endElement();
TEST_END( "textspan test", "<r>\n"
" <p><text:s text:c=\"3\"/><text:tab/><text:line-break/> foo<text:s text:c=\"2\"/></p>\n"
@@ -86,9 +86,9 @@ int main( int argc, char** argv ) {
TEST_BEGIN( 0, 0 );
writer.startElement( "p", false /*no indent*/ );
- QMap<int, int> tabCache;
+ TQMap<int, int> tabCache;
tabCache.insert( 3, 0 );
- writer.addTextSpan( QString::fromUtf8( " \t\n foö " ), tabCache );
+ writer.addTextSpan( TQString::fromUtf8( " \t\n foö " ), tabCache );
writer.endElement();
TEST_END( "textspan with tabcache", "<r>\n"
" <p><text:s text:c=\"3\"/><text:tab text:tab-ref=\"1\"/><text:line-break/> foö<text:s text:c=\"2\"/></p>\n"
@@ -97,29 +97,29 @@ int main( int argc, char** argv ) {
TEST_BEGIN( 0, 0 );
writer.startElement( "p", false /*no indent*/ );
writer.addProcessingInstruction( "opendocument foobar" );
- writer.addTextSpan( QString::fromLatin1( "foo" ) );
+ writer.addTextSpan( TQString::tqfromLatin1( "foo" ) );
writer.endElement();
TEST_END( "processinginstruction test", "<r>\n"
" <p><?opendocument foobar?>foo</p>\n"
"</r>\n" );
TEST_BEGIN( 0, 0 );
- writer.addManifestEntry( QString::fromLatin1( "foo/bar/blah" ), QString::fromLatin1( "mime/type" ) );
+ writer.addManifestEntry( TQString::tqfromLatin1( "foo/bar/blah" ), TQString::tqfromLatin1( "mime/type" ) );
TEST_END( "addManifestEntry", "<r>\n <manifest:file-entry manifest:media-type=\"mime/type\" manifest:full-path=\"foo/bar/blah\"/>\n</r>\n" );
int sz = 15000; // must be more than KoXmlWriter::s_escapeBufferLen
- QCString x( sz );
+ TQCString x( sz );
x.fill( 'x', sz );
x += '&';
- QCString expected = "<r a=\"";
+ TQCString expected = "<r a=\"";
expected += x + "amp;\"/>\n";
TEST_BEGIN( 0, 0 );
writer.addAttribute( "a", x );
TEST_END( "escaping long cstring", expected.data() );
- QString longPath;
+ TQString longPath;
for ( uint i = 0 ; i < 1000 ; ++i )
- longPath += QString::fromLatin1( "M10 10L20 20 " );
+ longPath += TQString::tqfromLatin1( "M10 10L20 20 " );
expected = "<r a=\"";
expected += longPath.utf8() + "\"/>\n";
TEST_BEGIN( 0, 0 );
@@ -131,9 +131,9 @@ int main( int argc, char** argv ) {
bool val = true;
int num = 1;
double numdouble = 5.0;
- writer.addConfigItem( QString::fromLatin1( "TestConfigBool" ), val );
- writer.addConfigItem( QString::fromLatin1( "TestConfigInt" ), num );
- writer.addConfigItem( QString::fromLatin1( "TestConfigDouble" ), numdouble );
+ writer.addConfigItem( TQString::tqfromLatin1( "TestConfigBool" ), val );
+ writer.addConfigItem( TQString::tqfromLatin1( "TestConfigInt" ), num );
+ writer.addConfigItem( TQString::tqfromLatin1( "TestConfigDouble" ), numdouble );
TEST_END( "test config", "<r>\n"
" <config:config-item config:name=\"TestConfigBool\" config:type=\"boolean\">true</config:config-item>\n"
" <config:config-item config:name=\"TestConfigInt\" config:type=\"int\">1</config:config-item>\n"
diff --git a/lib/store/tests/xmlwritertest.h b/lib/store/tests/xmlwritertest.h
index c5dc76e7..b3d305ea 100644
--- a/lib/store/tests/xmlwritertest.h
+++ b/lib/store/tests/xmlwritertest.h
@@ -1,18 +1,18 @@
#ifndef XMLWRITERTEST_H
#define XMLWRITERTEST_H
-#define QT_NO_CAST_ASCII
+#define TQT_NO_CAST_ASCII
// Those macros are in a separate header file in order to share them
// with kofficecore/tests/kogenstylestest.cpp
-#include <qbuffer.h>
-#include <qregexp.h>
+#include <tqbuffer.h>
+#include <tqregexp.h>
#define TEST_BEGIN(publicId,systemId) \
{ \
- QCString cstr; \
- QBuffer buffer( cstr ); \
+ TQCString cstr; \
+ TQBuffer buffer( cstr ); \
buffer.open( IO_WriteOnly ); \
{ \
KoXmlWriter writer( &buffer ); \
@@ -24,18 +24,18 @@
writer.endDocument(); \
} \
buffer.putch( '\0' ); /*null-terminate*/ \
- QCString expectedFull( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ); \
+ TQCString expectedFull( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ); \
expectedFull += expected; \
if ( cstr == expectedFull ) \
qDebug( "%s OK", testname ); \
else { \
qDebug( "%s FAILED!", testname ); \
- QCString s1 = cstr; \
- QCString s2 = expectedFull; \
+ TQCString s1 = cstr; \
+ TQCString s2 = expectedFull; \
if ( s1.length() != s2.length() ) \
qDebug( "got length %d, expected %d", s1.length(), s2.length() ); \
- s1.replace( QRegExp( QString::fromLatin1( "[x]{1000}" ) ), "[x]*1000" ); \
- s2.replace( QRegExp( QString::fromLatin1( "[x]{1000}" ) ), "[x]*1000" ); \
+ s1.tqreplace( TQRegExp( TQString::tqfromLatin1( "[x]{1000}" ) ), "[x]*1000" ); \
+ s2.tqreplace( TQRegExp( TQString::tqfromLatin1( "[x]{1000}" ) ), "[x]*1000" ); \
qDebug( "%s", s1.data() ); \
qDebug( "Expected:\n%s", s2.data() ); \
return 1; /*exit*/ \