summaryrefslogtreecommitdiffstats
path: root/src/projects/kostore
diff options
context:
space:
mode:
Diffstat (limited to 'src/projects/kostore')
-rw-r--r--src/projects/kostore/koStore.cc132
-rw-r--r--src/projects/kostore/koStore.h86
-rw-r--r--src/projects/kostore/koStoreBase.h4
-rw-r--r--src/projects/kostore/koStoreDevice.h25
-rw-r--r--src/projects/kostore/koZipStore.cc32
-rw-r--r--src/projects/kostore/koZipStore.h20
6 files changed, 154 insertions, 145 deletions
diff --git a/src/projects/kostore/koStore.cc b/src/projects/kostore/koStore.cc
index 5e7fd06..1b17d95 100644
--- a/src/projects/kostore/koStore.cc
+++ b/src/projects/kostore/koStore.cc
@@ -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/src/projects/kostore/koStore.h b/src/projects/kostore/koStore.h
index a22c5f3..331bc8b 100644
--- a/src/projects/kostore/koStore.h
+++ b/src/projects/kostore/koStore.h
@@ -21,16 +21,16 @@
#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>
#include <kdemacros.h>
#define KOSTORE_EXPORT KDE_EXPORT
-class QWidget;
+class TQWidget;
class KURL;
@@ -61,14 +61,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).
@@ -90,7 +90,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)
@@ -103,7 +103,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(),
@@ -123,38 +123,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
@@ -175,7 +175,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 .."
@@ -188,13 +188,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;
/**
@@ -213,14 +213,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
@@ -228,7 +228,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 );
/**
@@ -236,12 +236,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;
//@}
@@ -267,7 +267,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,
@@ -275,7 +275,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
@@ -290,21 +290,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
@@ -319,18 +319,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
{
@@ -343,28 +343,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/src/projects/kostore/koStoreBase.h b/src/projects/kostore/koStoreBase.h
index 0987577..c3792e5 100644
--- a/src/projects/kostore/koStoreBase.h
+++ b/src/projects/kostore/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/src/projects/kostore/koStoreDevice.h b/src/projects/kostore/koStoreDevice.h
index b245d60..df8cebf 100644
--- a/src/projects/kostore/koStoreDevice.h
+++ b/src/projects/kostore/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
+ 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
+
+#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 ); }
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/src/projects/kostore/koZipStore.cc b/src/projects/kostore/koZipStore.cc
index ed3fec4..4b63a4c 100644
--- a/src/projects/kostore/koZipStore.cc
+++ b/src/projects/kostore/koZipStore.cc
@@ -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/src/projects/kostore/koZipStore.h b/src/projects/kostore/koZipStore.h
index e87f5e4..557cca3 100644
--- a/src/projects/kostore/koZipStore.h
+++ b/src/projects/kostore/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;