diff options
Diffstat (limited to 'lib/store/tests/storedroptest.cpp')
-rw-r--r-- | lib/store/tests/storedroptest.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
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; } |