From f008adb5a77e094eaf6abf3fc0f36958e66896a5 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 25 Jun 2011 05:28:35 +0000 Subject: TQt4 port koffice This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- lib/kofficecore/KoDocument.cpp | 636 ++++++++++++++++++++--------------------- 1 file changed, 318 insertions(+), 318 deletions(-) (limited to 'lib/kofficecore/KoDocument.cpp') diff --git a/lib/kofficecore/KoDocument.cpp b/lib/kofficecore/KoDocument.cpp index 50003627..695599d2 100644 --- a/lib/kofficecore/KoDocument.cpp +++ b/lib/kofficecore/KoDocument.cpp @@ -49,17 +49,17 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -76,7 +76,7 @@ #define INTERNAL_PREFIX "intern:/" // Warning, keep it sync in koStore.cc and koDocumentChild.cc -QPtrList *KoDocument::s_documentList=0L; +TQPtrList *KoDocument::s_documentList=0L; using namespace std; class KoViewWrapperWidget; @@ -103,7 +103,7 @@ public: m_shouldCheckAutoSaveFile( true ), m_autoErrorHandlingEnabled( true ), m_backupFile( true ), - m_backupPath( QString::null ), + m_backupPath( TQString() ), m_doNotSaveExtDoc( false ), m_current( false ), m_storeInternal( false ), @@ -119,10 +119,10 @@ public: } } - QPtrList m_views; - QPtrList m_children; - QPtrList m_shells; - QValueList m_viewBuildDocuments; + TQPtrList m_views; + TQPtrList m_tqchildren; + TQPtrList m_shells; + TQValueList m_viewBuildDocuments; KoViewWrapperWidget *m_wrapperWidget; KoDocumentIface * m_dcopObject; @@ -133,16 +133,16 @@ public: KoFilterManager * filterManager; // The filter-manager to use when loading/saving [for the options] - QCString mimeType; // The actual mimetype of the document - QCString outputMimeType; // The mimetype to use when saving + TQCString mimeType; // The actual mimetype of the document + TQCString outputMimeType; // The mimetype to use when saving bool m_confirmNonNativeSave [2]; // used to pop up a dialog when saving for the // first time if the file is in a foreign format // (Save/Save As, Export) int m_specialOutputFlag; // See KoFileDialog in koMainWindow.cc bool m_isImporting, m_isExporting; // File --> Import/Export vs File --> Open/Save - QTimer m_autoSaveTimer; - QString lastErrorMessage; // see openFile() + TQTimer m_autoSaveTimer; + TQString lastErrorMessage; // see openFile() int m_autoSaveDelay; // in seconds, 0 to disable. int m_numOperations; bool modifiedAfterAutosave; @@ -151,45 +151,45 @@ public: bool m_shouldCheckAutoSaveFile; // usually true bool m_autoErrorHandlingEnabled; // usually true bool m_backupFile; - QString m_backupPath; + TQString m_backupPath; bool m_doNotSaveExtDoc; // makes it possible to save only internally stored child documents bool m_current; bool m_storeInternal; // Store this doc internally even if url is external bool m_bLoading; // True while loading (openURL is async) KoOpenPane* m_startUpWidget; - QString m_templateType; + TQString m_templateType; }; // Used in singleViewMode -class KoViewWrapperWidget : public QWidget +class KoViewWrapperWidget : public TQWidget { public: - KoViewWrapperWidget( QWidget *parent, const char *name ) - : QWidget( parent, name ) + KoViewWrapperWidget( TQWidget *tqparent, const char *name ) + : TQWidget( tqparent, name ) { KGlobal::locale()->insertCatalogue("koffice"); // Tell the iconloader about share/apps/koffice/icons KGlobal::iconLoader()->addAppDir("koffice"); m_view = 0L; // Avoid warning from KParts - we'll have the KoView as focus proxy anyway - setFocusPolicy( ClickFocus ); + setFocusPolicy( TQ_ClickFocus ); } virtual ~KoViewWrapperWidget() { setFocusProxy( 0 ); // to prevent a crash due to clearFocus (#53466) } - virtual void resizeEvent( QResizeEvent * ) + virtual void resizeEvent( TQResizeEvent * ) { - QObject *wid = child( 0, "QWidget" ); + TQObject *wid = child( 0, TQWIDGET_OBJECT_NAME_STRING ); if ( wid ) - static_cast(wid)->setGeometry( 0, 0, width(), height() ); + TQT_TQWIDGET(wid)->setGeometry( 0, 0, width(), height() ); } - virtual void childEvent( QChildEvent *ev ) + virtual void childEvent( TQChildEvent *ev ) { - if ( ev->type() == QEvent::ChildInserted ) + if ( ev->type() == TQEvent::ChildInserted ) resizeEvent( 0L ); } @@ -211,7 +211,7 @@ KoBrowserExtension::KoBrowserExtension( KoDocument * doc, const char * name ) void KoBrowserExtension::print() { - KoDocument * doc = static_cast( parent() ); + KoDocument * doc = static_cast( tqparent() ); KoViewWrapperWidget * wrapper = static_cast( doc->widget() ); KoView * view = wrapper->koView(); // TODO remove code duplication (KoMainWindow), by moving this to KoView @@ -222,32 +222,32 @@ void KoBrowserExtension::print() view->print( printer ); } -KoDocument::KoDocument( QWidget * parentWidget, const char *widgetName, QObject* parent, const char* name, bool singleViewMode ) - : KParts::ReadWritePart( parent, name ) +KoDocument::KoDocument( TQWidget * tqparentWidget, const char *widgetName, TQObject* tqparent, const char* name, bool singleViewMode ) + : KParts::ReadWritePart( tqparent, name ) { if(s_documentList==0L) - s_documentList=new QPtrList; + s_documentList=new TQPtrList; s_documentList->append(this); d = new Private; m_bEmpty = TRUE; - connect( &d->m_autoSaveTimer, SIGNAL( timeout() ), this, SLOT( slotAutoSave() ) ); + connect( &d->m_autoSaveTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotAutoSave() ) ); setAutoSave( s_defaultAutoSave ); d->m_bSingleViewMode = singleViewMode; - // the parent setting *always* overrides! (Simon) - if ( parent ) + // the tqparent setting *always* overrides! (Simon) + if ( tqparent ) { - if ( parent->inherits( "KoDocument" ) ) - d->m_bSingleViewMode = ((KoDocument *)parent)->isSingleViewMode(); - else if ( parent->inherits( "KParts::Part" ) ) + if ( tqparent->inherits( "KoDocument" ) ) + d->m_bSingleViewMode = ((KoDocument *)tqparent)->isSingleViewMode(); + else if ( tqparent->inherits( "KParts::Part" ) ) d->m_bSingleViewMode = true; } if ( singleViewMode ) { - d->m_wrapperWidget = new KoViewWrapperWidget( parentWidget, widgetName ); + d->m_wrapperWidget = new KoViewWrapperWidget( tqparentWidget, widgetName ); setWidget( d->m_wrapperWidget ); kdDebug(30003) << "creating KoBrowserExtension" << endl; (void) new KoBrowserExtension( this ); // ## only if embedded into a browser? @@ -264,29 +264,29 @@ KoDocument::KoDocument( QWidget * parentWidget, const char *widgetName, QObject* // A way to 'fix' the job's window, since we have no widget known to KParts if ( !singleViewMode ) - connect( this, SIGNAL( started( KIO::Job* ) ), SLOT( slotStarted( KIO::Job* ) ) ); + connect( this, TQT_SIGNAL( started( KIO::Job* ) ), TQT_SLOT( slotStarted( KIO::Job* ) ) ); } KoDocument::~KoDocument() { d->m_autoSaveTimer.stop(); - QPtrListIterator childIt( d->m_children ); + TQPtrListIterator childIt( d->m_tqchildren ); for (; childIt.current(); ++childIt ) - disconnect( childIt.current(), SIGNAL( destroyed() ), - this, SLOT( slotChildDestroyed() ) ); + disconnect( childIt.current(), TQT_SIGNAL( destroyed() ), + this, TQT_SLOT( slotChildDestroyed() ) ); // Tell our views that the document is already destroyed and // that they shouldn't try to access it. - QPtrListIterator vIt( d->m_views ); + TQPtrListIterator vIt( d->m_views ); for (; vIt.current(); ++vIt ) vIt.current()->setDocumentDeleted(); delete d->m_startUpWidget; d->m_startUpWidget = 0; - d->m_children.setAutoDelete( true ); - d->m_children.clear(); + d->m_tqchildren.setAutoDelete( true ); + d->m_tqchildren.clear(); d->m_shells.setAutoDelete( true ); d->m_shells.clear(); @@ -309,12 +309,12 @@ bool KoDocument::isSingleViewMode() const bool KoDocument::isEmbedded() const { - return dynamic_cast( parent() ) != 0; + return dynamic_cast( tqparent() ) != 0; } -KoView *KoDocument::createView( QWidget *parent, const char *name ) +KoView *KoDocument::createView( TQWidget *tqparent, const char *name ) { - KoView *view=createViewInstance(parent, name); + KoView *view=createViewInstance(tqparent, name); addView(view); return view; } @@ -334,10 +334,10 @@ bool KoDocument::exp0rt( const KURL & _url ) // non-virtual). // KURL oldURL = m_url; - QString oldFile = m_file; + TQString oldFile = m_file; bool wasModified = isModified (); - QCString oldMimeType = mimeType (); + TQCString oldMimeType = mimeType (); // save... @@ -382,12 +382,12 @@ bool KoDocument::saveFile() const bool wasModified = isModified (); // The output format is set by koMainWindow, and by openFile - QCString outputMimeType = d->outputMimeType; + TQCString outputMimeType = d->outputMimeType; //Q_ASSERT( !outputMimeType.isEmpty() ); // happens when using the DCOP method saveAs if ( outputMimeType.isEmpty() ) outputMimeType = d->outputMimeType = nativeFormatMimeType(); - QApplication::setOverrideCursor( waitCursor ); + TQApplication::setOverrideCursor( waitCursor ); if ( backupFile() ) { if ( url().isLocalFile() ) @@ -401,7 +401,7 @@ bool KoDocument::saveFile() backup = url(); else backup = d->m_backupPath +"/"+url().fileName(); - backup.setPath( backup.path() + QString::fromLatin1("~") ); + backup.setPath( backup.path() + TQString::tqfromLatin1("~") ); KFileItem item( entry, url() ); Q_ASSERT( item.name() == url().fileName() ); KIO::NetAccess::file_copy( url(), backup, item.permissions(), true /*overwrite*/, false /*resume*/, shells().current() ); @@ -418,7 +418,7 @@ bool KoDocument::saveFile() if ( !d->filterManager ) d->filterManager = new KoFilterManager( this ); - KoFilter::ConversionStatus status = d->filterManager->exp0rt( m_file, outputMimeType ); + KoFilter::ConversiontqStatus status = d->filterManager->exp0rt( m_file, outputMimeType ); ret = status == KoFilter::OK; suppressErrorDialog = (status == KoFilter::UserCancelled || status == KoFilter::BadConversionGraph ); } else { @@ -434,7 +434,7 @@ bool KoDocument::saveFile() setAutoSave( d->m_autoSaveDelay ); } - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); if ( !ret ) { if ( !suppressErrorDialog ) @@ -468,23 +468,23 @@ bool KoDocument::saveFile() return ret; } -QCString KoDocument::mimeType() const +TQCString KoDocument::mimeType() const { return d->mimeType; } -void KoDocument::setMimeType( const QCString & mimeType ) +void KoDocument::setMimeType( const TQCString & mimeType ) { d->mimeType = mimeType; } -void KoDocument::setOutputMimeType( const QCString & mimeType, int specialOutputFlag ) +void KoDocument::setOutputMimeType( const TQCString & mimeType, int specialOutputFlag ) { d->outputMimeType = mimeType; d->m_specialOutputFlag = specialOutputFlag; } -QCString KoDocument::outputMimeType() const +TQCString KoDocument::outputMimeType() const { return d->outputMimeType; } @@ -540,7 +540,7 @@ void KoDocument::slotAutoSave() { if ( isModified() && d->modifiedAfterAutosave && !d->m_bLoading ) { - connect( this, SIGNAL( sigProgress( int ) ), shells().current(), SLOT( slotProgress( int ) ) ); + connect( this, TQT_SIGNAL( sigProgress( int ) ), shells().current(), TQT_SLOT( slotProgress( int ) ) ); emit sigStatusBarMessage( i18n("Autosaving...") ); d->m_autosaving = true; bool ret = saveNativeFormat( autoSaveFile( m_file ) ); @@ -551,13 +551,13 @@ void KoDocument::slotAutoSave() } d->m_autosaving = false; emit sigClearStatusBarMessage(); - disconnect( this, SIGNAL( sigProgress( int ) ), shells().current(), SLOT( slotProgress( int ) ) ); + disconnect( this, TQT_SIGNAL( sigProgress( int ) ), shells().current(), TQT_SLOT( slotProgress( int ) ) ); if ( !ret ) emit sigStatusBarMessage( i18n("Error during autosave! Partition full?") ); } } -KAction *KoDocument::action( const QDomElement &element ) const +KAction *KoDocument::action( const TQDomElement &element ) const { // First look in the document itself KAction* act = KParts::ReadWritePart::action( element ); @@ -572,13 +572,13 @@ KAction *KoDocument::action( const QDomElement &element ) const return 0L; } -QDomDocument KoDocument::domDocument() const +TQDomDocument KoDocument::domDocument() const { // When embedded into e.g. konqueror, we want the view's GUI (hopefully a reduced one) // to be used. Q_ASSERT( d->m_bSingleViewMode ); if ( d->m_views.isEmpty() ) - return QDomDocument(); + return TQDomDocument(); else return d->m_views.getFirst()->domDocument(); } @@ -591,7 +591,7 @@ void KoDocument::setManager( KParts::PartManager *manager ) if ( manager ) { - QPtrListIterator it( d->m_children ); + TQPtrListIterator it( d->m_tqchildren ); for (; it.current(); ++it ) if ( it.current()->document() ) manager->addPart( it.current()->document(), false ); @@ -602,11 +602,11 @@ void KoDocument::setReadWrite( bool readwrite ) { KParts::ReadWritePart::setReadWrite( readwrite ); - QPtrListIterator vIt( d->m_views ); + TQPtrListIterator vIt( d->m_views ); for (; vIt.current(); ++vIt ) vIt.current()->updateReadWrite( readwrite ); - QPtrListIterator dIt( d->m_children ); + TQPtrListIterator dIt( d->m_tqchildren ); for (; dIt.current(); ++dIt ) if ( dIt.current()->document() ) dIt.current()->document()->setReadWrite( readwrite ); @@ -637,7 +637,7 @@ void KoDocument::removeView( KoView *view ) d->m_views.removeRef( view ); } -const QPtrList& KoDocument::views() const +const TQPtrList& KoDocument::views() const { return d->m_views; } @@ -651,12 +651,12 @@ void KoDocument::insertChild( KoDocumentChild *child ) { setModified( true ); - d->m_children.append( child ); + d->m_tqchildren.append( child ); - connect( child, SIGNAL( changed( KoChild * ) ), - this, SLOT( slotChildChanged( KoChild * ) ) ); - connect( child, SIGNAL( destroyed() ), - this, SLOT( slotChildDestroyed() ) ); + connect( child, TQT_SIGNAL( changed( KoChild * ) ), + this, TQT_SLOT( slotChildChanged( KoChild * ) ) ); + connect( child, TQT_SIGNAL( destroyed() ), + this, TQT_SLOT( slotChildDestroyed() ) ); // It may be that insertChild is called without the KoDocumentChild // having a KoDocument attached, yet. This happens for example @@ -681,23 +681,23 @@ void KoDocument::slotChildDestroyed() setModified( true ); const KoDocumentChild *child = static_cast( sender() ); - d->m_children.removeRef( child ); + d->m_tqchildren.removeRef( child ); } -const QPtrList& KoDocument::children() const +const TQPtrList& KoDocument::tqchildren() const { - return d->m_children; + return d->m_tqchildren; } -KParts::Part *KoDocument::hitTest( QWidget *widget, const QPoint &globalPos ) +KParts::Part *KoDocument::hitTest( TQWidget *widget, const TQPoint &globalPos ) { - QPtrListIterator it( d->m_views ); + TQPtrListIterator it( d->m_views ); for (; it.current(); ++it ) - if ( static_cast(it.current()) == widget ) + if ( static_cast(it.current()) == widget ) { KoView* view = it.current(); d->hitTestView = view; // koffice-1.x hack - QPoint canvasPos( view->canvas()->mapFromGlobal( globalPos ) ); + TQPoint canvasPos( view->canvas()->mapFromGlobal( globalPos ) ); canvasPos.rx() += view->canvasXOffset(); canvasPos.ry() += view->canvasYOffset(); @@ -715,10 +715,10 @@ KoView* KoDocument::hitTestView() return d->hitTestView; } -KoDocument* KoDocument::hitTest( const QPoint &pos, const QWMatrix &matrix ) +KoDocument* KoDocument::hitTest( const TQPoint &pos, const TQWMatrix &matrix ) { // Call KoDocumentChild::hitTest for any child document - QPtrListIterator it( d->m_children ); + TQPtrListIterator it( d->m_tqchildren ); for (; it.current(); ++it ) { KoDocument *doc = it.current()->hitTest( pos, matrix ); @@ -732,7 +732,7 @@ KoDocument* KoDocument::hitTest( const QPoint &pos, const QWMatrix &matrix ) KoDocumentChild *KoDocument::child( KoDocument *doc ) { - QPtrListIterator it( d->m_children ); + TQPtrListIterator it( d->m_tqchildren ); for (; it.current(); ++it ) if ( it.current()->document() == doc ) return it.current(); @@ -745,9 +745,9 @@ KoDocumentInfo *KoDocument::documentInfo() const return d->m_docInfo; } -void KoDocument::setViewBuildDocument( KoView *view, const QDomDocument &doc ) +void KoDocument::setViewBuildDocument( KoView *view, const TQDomDocument &doc ) { - if ( d->m_views.find( view ) == -1 ) + if ( d->m_views.tqfind( view ) == -1 ) return; uint viewIdx = d->m_views.at(); @@ -758,11 +758,11 @@ void KoDocument::setViewBuildDocument( KoView *view, const QDomDocument &doc ) d->m_viewBuildDocuments[ viewIdx ] = doc; } -QDomDocument KoDocument::viewBuildDocument( KoView *view ) +TQDomDocument KoDocument::viewBuildDocument( KoView *view ) { - QDomDocument res; + TQDomDocument res; - if ( d->m_views.find( view ) == -1 ) + if ( d->m_views.tqfind( view ) == -1 ) return res; uint viewIdx = d->m_views.at(); @@ -772,21 +772,21 @@ QDomDocument KoDocument::viewBuildDocument( KoView *view ) res = d->m_viewBuildDocuments[ viewIdx ]; - // make this entry empty. otherwise we get a segfault in QMap ;-( - d->m_viewBuildDocuments[ viewIdx ] = QDomDocument(); + // make this entry empty. otherwise we get a segfault in TQMap ;-( + d->m_viewBuildDocuments[ viewIdx ] = TQDomDocument(); return res; } -void KoDocument::paintEverything( QPainter &painter, const QRect &rect, bool transparent, KoView *view, double zoomX, double zoomY ) +void KoDocument::paintEverything( TQPainter &painter, const TQRect &rect, bool transparent, KoView *view, double zoomX, double zoomY ) { paintContent( painter, rect, transparent, zoomX, zoomY ); paintChildren( painter, rect, view, zoomX, zoomY ); } -void KoDocument::paintChildren( QPainter &painter, const QRect &/*rect*/, KoView *view, double zoomX, double zoomY ) +void KoDocument::paintChildren( TQPainter &painter, const TQRect &/*rect*/, KoView *view, double zoomX, double zoomY ) { - QPtrListIterator it( d->m_children ); + TQPtrListIterator it( d->m_tqchildren ); for (; it.current(); ++it ) { // #### todo: paint only if child is visible inside rect @@ -796,12 +796,12 @@ void KoDocument::paintChildren( QPainter &painter, const QRect &/*rect*/, KoView } } -void KoDocument::paintChild( KoDocumentChild *child, QPainter &painter, KoView *view, double zoomX, double zoomY ) +void KoDocument::paintChild( KoDocumentChild *child, TQPainter &painter, KoView *view, double zoomX, double zoomY ) { if ( child->isDeleted() ) return; - // QRegion rgn = painter.clipRegion(); + // TQRegion rgn = painter.clipRegion(); child->transform( painter ); child->document()->paintEverything( painter, child->contentRect(), child->isTransparent(), view, zoomX, zoomY ); @@ -816,9 +816,9 @@ void KoDocument::paintChild( KoDocumentChild *child, QPainter &painter, KoView * int w = int( (double)child->contentRect().width() * child->xScaling() ); int h = int( (double)child->contentRect().height() * child->yScaling() ); if ( ( manager->selectedPart() == (KParts::Part *)child->document() && - manager->selectedWidget() == (QWidget *)view ) || + manager->selectedWidget() == (TQWidget *)view ) || ( manager->activePart() == (KParts::Part *)child->document() && - manager->activeWidget() == (QWidget *)view ) ) + manager->activeWidget() == (TQWidget *)view ) ) { // painter.setClipRegion( rgn ); painter.setClipping( FALSE ); @@ -834,9 +834,9 @@ void KoDocument::paintChild( KoDocumentChild *child, QPainter &painter, KoView * painter.fillRect( w, -5, 5, h + 10, BDiagPattern ); if ( manager->selectedPart() == (KParts::Part *)child->document() && - manager->selectedWidget() == (QWidget *)view ) + manager->selectedWidget() == (TQWidget *)view ) { - QColor color; + TQColor color; if ( view->koDocument() == this ) color = black; else @@ -863,8 +863,8 @@ bool KoDocument::isModified() const //kdDebug(30003)< it( children() ); + TQPtrListIterator it( tqchildren() ); for( ; it.current(); ++it ) { KoDocument* childDoc = it.current()->document(); if (childDoc && !it.current()->isDeleted()) @@ -886,7 +886,7 @@ bool KoDocument::saveChildren( KoStore* _store ) if ( !childDoc->isStoredExtern() ) { //kdDebug(30003) << "KoDocument::saveChildren internal url: /" << i << endl; - if ( !childDoc->saveToStore( _store, QString::number( i++ ) ) ) + if ( !childDoc->saveToStore( _store, TQString::number( i++ ) ) ) return FALSE; if (!isExporting ()) @@ -900,8 +900,8 @@ bool KoDocument::saveChildren( KoStore* _store ) bool KoDocument::saveChildrenOasis( KoStore* store, KoXmlWriter* manifestWriter ) { - //kdDebug(30003)< it( children() ); + //kdDebug(30003)< it( tqchildren() ); for( ; it.current(); ++it ) { KoDocument* childDoc = it.current()->document(); if ( childDoc && !it.current()->isDeleted() ) @@ -924,9 +924,9 @@ bool KoDocument::saveExternalChildren() return true; } - //kdDebug(30003)< it = children(); + TQPtrListIterator it = tqchildren(); for (; (ch = it.current()); ++it ) { if ( !ch->isDeleted() ) @@ -935,7 +935,7 @@ bool KoDocument::saveExternalChildren() if ( doc && doc->isStoredExtern() && doc->isModified() ) { kdDebug(30003)<<" save external doc='"<setDoNotSaveExtDoc(); // Only save doc + it's internal children + doc->setDoNotSaveExtDoc(); // Only save doc + it's internal tqchildren if ( !doc->save() ) return false; // error } @@ -948,9 +948,9 @@ bool KoDocument::saveExternalChildren() return true; } -bool KoDocument::saveNativeFormat( const QString & file ) +bool KoDocument::saveNativeFormat( const TQString & file ) { - d->lastErrorMessage = QString::null; + d->lastErrorMessage = TQString(); //kdDebug(30003) << "Saving to store" << endl; KoStore::Backend backend = KoStore::Auto; @@ -971,10 +971,10 @@ bool KoDocument::saveNativeFormat( const QString & file ) else if ( d->m_specialOutputFlag == SaveAsFlatXML ) { kdDebug(30003) << "Saving as a flat XML file." << endl; - QFile f( file ); + TQFile f( file ); if ( f.open( IO_WriteOnly | IO_Translate ) ) { - bool success = saveToStream( &f ); + bool success = saveToStream( TQT_TQIODEVICE(&f) ); f.close(); return success; } @@ -984,9 +984,9 @@ bool KoDocument::saveNativeFormat( const QString & file ) kdDebug(30003) << "KoDocument::saveNativeFormat nativeFormatMimeType=" << nativeFormatMimeType() << endl; // OLD: bool oasis = d->m_specialOutputFlag == SaveAsOASIS; - // OLD: QCString mimeType = oasis ? nativeOasisMimeType() : nativeFormatMimeType(); - QCString mimeType = d->outputMimeType; - QCString nativeOasisMime = nativeOasisMimeType(); + // OLD: TQCString mimeType = oasis ? nativeOasisMimeType() : nativeFormatMimeType(); + TQCString mimeType = d->outputMimeType; + TQCString nativeOasisMime = nativeOasisMimeType(); bool oasis = !mimeType.isEmpty() && ( mimeType == nativeOasisMime || mimeType == nativeOasisMime + "-template" ); // TODO: use std::auto_ptr or create store on stack [needs API fixing], // to remove all the 'delete store' in all the branches @@ -1031,7 +1031,7 @@ bool KoDocument::saveNativeFormat( const QString & file ) } else { - d->lastErrorMessage = i18n( "Not able to write '%1'. Partition full?" ).arg( "meta.xml" ); + d->lastErrorMessage = i18n( "Not able to write '%1'. Partition full?" ).tqarg( "meta.xml" ); delete store; return false; } @@ -1039,7 +1039,7 @@ bool KoDocument::saveNativeFormat( const QString & file ) if ( store->open( "Thumbnails/thumbnail.png" ) ) { if ( !saveOasisPreview( store, manifestWriter ) || !store->close() ) { - d->lastErrorMessage = i18n( "Error while trying to write '%1'. Partition full?" ).arg( "Thumbnails/thumbnail.png" ); + d->lastErrorMessage = i18n( "Error while trying to write '%1'. Partition full?" ).tqarg( "Thumbnails/thumbnail.png" ); delete store; return false; } @@ -1047,7 +1047,7 @@ bool KoDocument::saveNativeFormat( const QString & file ) } else { - d->lastErrorMessage = i18n( "Not able to write '%1'. Partition full?" ).arg( "Thumbnails/thumbnail.png" ); + d->lastErrorMessage = i18n( "Not able to write '%1'. Partition full?" ).tqarg( "Thumbnails/thumbnail.png" ); delete store; return false; } @@ -1055,7 +1055,7 @@ bool KoDocument::saveNativeFormat( const QString & file ) // Write out manifest file if ( !oasisStore.closeManifestWriter() ) { - d->lastErrorMessage = i18n( "Error while trying to write '%1'. Partition full?" ).arg( "META-INF/manifest.xml" ); + d->lastErrorMessage = i18n( "Error while trying to write '%1'. Partition full?" ).tqarg( "META-INF/manifest.xml" ); delete store; return false; } @@ -1064,7 +1064,7 @@ bool KoDocument::saveNativeFormat( const QString & file ) } else { - // Save internal children first since they might get a new url + // Save internal tqchildren first since they might get a new url if ( !saveChildren( store ) && !oasis ) { if ( d->lastErrorMessage.isEmpty() ) @@ -1086,16 +1086,16 @@ bool KoDocument::saveNativeFormat( const QString & file ) } else { - d->lastErrorMessage = i18n( "Not able to write '%1'. Partition full?" ).arg( "maindoc.xml" ); + d->lastErrorMessage = i18n( "Not able to write '%1'. Partition full?" ).tqarg( "maindoc.xml" ); delete store; return false; } if ( store->open( "documentinfo.xml" ) ) { - QDomDocument doc = d->m_docInfo->save(); + TQDomDocument doc = d->m_docInfo->save(); KoStoreDevice dev( store ); - QCString s = doc.toCString(); // this is already Utf8! + TQCString s = doc.toCString(); // this is already Utf8! (void)dev.writeBlock( s.data(), s.size()-1 ); (void)store->close(); } @@ -1122,13 +1122,13 @@ bool KoDocument::saveNativeFormat( const QString & file ) return true; } -bool KoDocument::saveToStream( QIODevice * dev ) +bool KoDocument::saveToStream( TQIODevice * dev ) { - QDomDocument doc = saveXML(); + TQDomDocument doc = saveXML(); // Save to buffer - QCString s = doc.toCString(); // utf8 already - // We use QCString::size()-1 here, not the official QCString::length - // It works here, as we are not modifying QCString as QByteArray + TQCString s = doc.toCString(); // utf8 already + // We use TQCString::size()-1 here, not the official TQCString::length + // It works here, as we are not modifying TQCString as TQByteArray int nwritten = dev->writeBlock( s.data(), s.size()-1 ); if ( nwritten != (int)s.size()-1 ) kdWarning(30003) << "KoDocument::saveToStream wrote " << nwritten << " - expected " << s.size()-1 << endl; @@ -1136,7 +1136,7 @@ bool KoDocument::saveToStream( QIODevice * dev ) } // Called for embedded documents -bool KoDocument::saveToStore( KoStore* _store, const QString & _path ) +bool KoDocument::saveToStore( KoStore* _store, const TQString & _path ) { kdDebug(30003) << "Saving document to store " << _path << endl; @@ -1146,7 +1146,7 @@ bool KoDocument::saveToStore( KoStore* _store, const QString & _path ) else // ugly hack to pass a relative URI m_url = KURL( INTERNAL_PREFIX + _path ); - // To make the children happy cd to the correct directory + // To make the tqchildren happy cd to the correct directory _store->pushDirectory(); _store->enterDirectory( _path ); @@ -1180,8 +1180,8 @@ bool KoDocument::saveToStore( KoStore* _store, const QString & _path ) bool KoDocument::saveOasisPreview( KoStore* store, KoXmlWriter* manifestWriter ) { - const QPixmap pix = generatePreview( QSize( 128, 128 ) ); - QImage preview ( pix.convertToImage().convertDepth( 32, Qt::ColorOnly ) ); + const TQPixmap pix = generatePreview( TQSize( 128, 128 ) ); + TQImage preview ( pix.convertToImage().convertDepth( 32, Qt::ColorOnly ) ); if ( !preview.hasAlphaBuffer() ) { preview.setAlphaBuffer( true ); @@ -1200,9 +1200,9 @@ bool KoDocument::saveOasisPreview( KoStore* store, KoXmlWriter* manifestWriter ) bool KoDocument::savePreview( KoStore* store ) { - QPixmap pix = generatePreview(QSize(256, 256)); + TQPixmap pix = generatePreview(TQSize(256, 256)); // Reducing to 8bpp reduces file sizes quite a lot. - const QImage preview ( pix.convertToImage().convertDepth( 8, Qt::AvoidDither | Qt::DiffuseDither) ); + const TQImage preview ( pix.convertToImage().convertDepth( 8, Qt::AvoidDither | Qt::DiffuseDither) ); KoStoreDevice io ( store ); if ( !io.open( IO_WriteOnly ) ) return false; @@ -1212,24 +1212,24 @@ bool KoDocument::savePreview( KoStore* store ) return true; } -QPixmap KoDocument::generatePreview( const QSize& size ) +TQPixmap KoDocument::generatePreview( const TQSize& size ) { double docWidth, docHeight; - int pixmapSize = QMAX(size.width(), size.height()); + int pixmapSize = TQMAX(size.width(), size.height()); if (m_pageLayout.ptWidth > 1.0) { docWidth = m_pageLayout.ptWidth / 72 * KoGlobal::dpiX(); docHeight = m_pageLayout.ptHeight / 72 * KoGlobal::dpiY(); } else { - // If we don't have a page layout, just draw the top left hand corner + // If we don't have a page tqlayout, just draw the top left hand corner docWidth = 500.0; docHeight = 500.0; } double ratio = docWidth / docHeight; - QPixmap pix; + TQPixmap pix; int previewWidth, previewHeight; if (ratio > 1.0) { @@ -1244,22 +1244,22 @@ QPixmap KoDocument::generatePreview( const QSize& size ) pix.resize((int)docWidth, (int)docHeight); - pix.fill( QColor( 245, 245, 245 ) ); + pix.fill( TQColor( 245, 245, 245 ) ); - QRect rc(0, 0, pix.width(), pix.height()); + TQRect rc(0, 0, pix.width(), pix.height()); - QPainter p; + TQPainter p; p.begin(&pix); paintEverything(p, rc, false); p.end(); - // ### TODO: why re-convert it to a QPixmap, when mostly it will be re-converted back to a QImage in the calling function + // ### TODO: why re-convert it to a TQPixmap, when mostly it will be re-converted back to a TQImage in the calling function pix.convertFromImage(pix.convertToImage().smoothScale(previewWidth, previewHeight)); return pix; } -QString KoDocument::autoSaveFile( const QString & path ) const +TQString KoDocument::autoSaveFile( const TQString & path ) const { // set local again as it can happen that it gets resetted // so that all saved numbers have a . and not e.g a , as a @@ -1268,36 +1268,36 @@ QString KoDocument::autoSaveFile( const QString & path ) const // Using the extension allows to avoid relying on the mime magic when opening KMimeType::Ptr mime = KMimeType::mimeType( nativeFormatMimeType() ); - QString extension = mime->property( "X-KDE-NativeExtension" ).toString(); + TQString extension = mime->property( "X-KDE-NativeExtension" ).toString(); if ( path.isEmpty() ) { // Never saved? Use a temp file in $HOME then // Yes, two open unnamed docs will overwrite each other's autosave file, // but hmm, we can only do something if that's in the same process anyway... - QString ret = QDir::homeDirPath() + "/." + QString::fromLatin1(instance()->instanceName()) + ".autosave" + extension; + TQString ret = TQDir::homeDirPath() + "/." + TQString::tqfromLatin1(instance()->instanceName()) + ".autosave" + extension; return ret; } else { KURL url( path ); Q_ASSERT( url.isLocalFile() ); - QString dir = url.directory(false); - QString filename = url.fileName(); + TQString dir = url.directory(false); + TQString filename = url.fileName(); return dir + "." + filename + ".autosave" + extension; } } bool KoDocument::checkAutoSaveFile() { - QString asf = autoSaveFile( QString::null ); // the one in $HOME + TQString asf = autoSaveFile( TQString() ); // the one in $HOME //kdDebug(30003) << "asf=" << asf << endl; - if ( QFile::exists( asf ) ) + if ( TQFile::exists( asf ) ) { - QDateTime date = QFileInfo(asf).lastModified(); - QString dateStr = date.toString(Qt::LocalDate); + TQDateTime date = TQFileInfo(asf).lastModified(); + TQString dateStr = date.toString(Qt::LocalDate); int res = KMessageBox::warningYesNoCancel( 0, i18n( "An autosaved file for an unnamed document exists in %1.\nThis file is dated %2\nDo you want to open it?" ) - .arg(asf, dateStr) ); + .tqarg(asf, dateStr) ); switch(res) { case KMessageBox::Yes : { KURL url; @@ -1308,7 +1308,7 @@ bool KoDocument::checkAutoSaveFile() return ret; } case KMessageBox::No : - QFile::remove( asf ); + TQFile::remove( asf ); return false; default: // Cancel return false; @@ -1344,12 +1344,12 @@ bool KoDocument::import( const KURL & _url ) bool KoDocument::openURL( const KURL & _url ) { kdDebug(30003) << "KoDocument::openURL url=" << _url.url() << endl; - d->lastErrorMessage = QString::null; + d->lastErrorMessage = TQString(); // Reimplemented, to add a check for autosave files and to improve error reporting if ( !_url.isValid() ) { - d->lastErrorMessage = i18n( "Malformed URL\n%1" ).arg( _url.url() ); // ## used anywhere ? + d->lastErrorMessage = i18n( "Malformed URL\n%1" ).tqarg( _url.url() ); // ## used anywhere ? return false; } if ( !closeURL() ) @@ -1360,9 +1360,9 @@ bool KoDocument::openURL( const KURL & _url ) d->m_bLoading = true; if ( url.isLocalFile() && d->m_shouldCheckAutoSaveFile ) { - QString file = url.path(); - QString asf = autoSaveFile( file ); - if ( QFile::exists( asf ) ) + TQString file = url.path(); + TQString asf = autoSaveFile( file ); + if ( TQFile::exists( asf ) ) { //kdDebug(30003) << "KoDocument::openURL asf=" << asf << endl; // ## TODO compare timestamps ? @@ -1374,7 +1374,7 @@ bool KoDocument::openURL( const KURL & _url ) autosaveOpened = true; break; case KMessageBox::No : - QFile::remove( asf ); + TQFile::remove( asf ); break; default: // Cancel d->m_bLoading = false; @@ -1393,7 +1393,7 @@ bool KoDocument::openURL( const KURL & _url ) //if ( d->m_shells.isEmpty() ) // kdWarning(30003) << "KoDocument::openURL no shell yet !" << endl; // Add to recent actions list in our shells - QPtrListIterator it( d->m_shells ); + TQPtrListIterator it( d->m_shells ); for (; it.current(); ++it ) it.current()->addRecentURL( _url ); } @@ -1403,33 +1403,33 @@ bool KoDocument::openURL( const KURL & _url ) bool KoDocument::openFile() { //kdDebug(30003) << "KoDocument::openFile for " << m_file << endl; - if ( !QFile::exists(m_file) ) + if ( !TQFile::exists(m_file) ) { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); if ( d->m_autoErrorHandlingEnabled ) // Maybe offer to create a new document with that name ? - KMessageBox::error(0L, i18n("The file %1 does not exist.").arg(m_file) ); + KMessageBox::error(0L, i18n("The file %1 does not exist.").tqarg(m_file) ); d->m_bLoading = false; return false; } - QApplication::setOverrideCursor( waitCursor ); + TQApplication::setOverrideCursor( waitCursor ); d->m_specialOutputFlag = 0; - QCString _native_format = nativeFormatMimeType(); + TQCString _native_format = nativeFormatMimeType(); KURL u; u.setPath( m_file ); - QString typeName = KMimeType::findByURL( u, 0, true )->name(); + TQString typeName = KMimeType::findByURL( u, 0, true )->name(); // Allow to open backup files, don't keep the mimetype application/x-trash. if ( typeName == "application/x-trash" ) { - QString path = u.path(); - QStringList patterns = KMimeType::mimeType( typeName )->patterns(); + TQString path = u.path(); + TQStringList patterns = KMimeType::mimeType( typeName )->patterns(); // Find the extension that makes it a backup file, and remove it - for( QStringList::Iterator it = patterns.begin(); it != patterns.end(); ++it ) { - QString ext = *it; + for( TQStringList::Iterator it = patterns.begin(); it != patterns.end(); ++it ) { + TQString ext = *it; if ( !ext.isEmpty() && ext[0] == '*' ) { ext.remove(0, 1); @@ -1451,18 +1451,18 @@ bool KoDocument::openFile() } kdDebug(30003) << "KoDocument::openFile " << m_file << " type:" << typeName << endl; - QString importedFile = m_file; + TQString importedFile = m_file; if ( !isNativeFormat( typeName.latin1() ) ) { if ( !d->filterManager ) d->filterManager = new KoFilterManager( this ); - KoFilter::ConversionStatus status; + KoFilter::ConversiontqStatus status; importedFile = d->filterManager->import( m_file, status ); if ( status != KoFilter::OK ) { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); - QString msg; + TQString msg; switch( status ) { case KoFilter::OK: break; @@ -1514,9 +1514,9 @@ bool KoDocument::openFile() if( d->m_autoErrorHandlingEnabled && !msg.isEmpty()) { - QString errorMsg( i18n( "Could not open\n%2.\nReason: %1" ) ); - QString docUrl = url().prettyURL( 0, KURL::StripFileProtocol ); - KMessageBox::error( 0L, errorMsg.arg(msg).arg(docUrl) ); + TQString errorMsg( i18n( "Could not open\n%2.\nReason: %1" ) ); + TQString docUrl = url().prettyURL( 0, KURL::StripFileProtocol ); + KMessageBox::error( 0L, errorMsg.tqarg(msg).tqarg(docUrl) ); } d->m_bLoading = false; @@ -1526,7 +1526,7 @@ bool KoDocument::openFile() << "', status: " << static_cast( status ) << endl; } - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); bool ok = true; @@ -1563,7 +1563,7 @@ bool KoDocument::openFile() // remove temp file - uncomment this to debug import filters if(!importedFile.isEmpty()) { - QFile::remove( importedFile ); + TQFile::remove( importedFile ); } } @@ -1604,7 +1604,7 @@ bool KoDocument::openFile() } // shared between openFile and koMainWindow's "create new empty document" code -void KoDocument::setMimeTypeAfterLoading( const QString& mimeType ) +void KoDocument::setMimeTypeAfterLoading( const TQString& mimeType ) { d->mimeType = mimeType.latin1(); @@ -1616,18 +1616,18 @@ void KoDocument::setMimeTypeAfterLoading( const QString& mimeType ) } // The caller must call store->close() if loadAndParse returns true. -bool KoDocument::oldLoadAndParse(KoStore* store, const QString& filename, QDomDocument& doc) +bool KoDocument::oldLoadAndParse(KoStore* store, const TQString& filename, TQDomDocument& doc) { //kdDebug(30003) << "oldLoadAndParse: Trying to open " << filename << endl; if (!store->open(filename)) { kdWarning(30003) << "Entry " << filename << " not found!" << endl; - d->lastErrorMessage = i18n( "Could not find %1" ).arg( filename ); + d->lastErrorMessage = i18n( "Could not tqfind %1" ).tqarg( filename ); return false; } - // Error variables for QDomDocument::setContent - QString errorMsg; + // Error variables for TQDomDocument::setContent + TQString errorMsg; int errorLine, errorColumn; bool ok = doc.setContent( store->device(), &errorMsg, &errorLine, &errorColumn ); if ( !ok ) @@ -1636,8 +1636,8 @@ bool KoDocument::oldLoadAndParse(KoStore* store, const QString& filename, QDomDo << " In line: " << errorLine << ", column: " << errorColumn << endl << " Error message: " << errorMsg << endl; d->lastErrorMessage = i18n( "Parsing error in %1 at line %2, column %3\nError message: %4" ) - .arg( filename ).arg( errorLine ).arg( errorColumn ) - .arg( i18n ( "QXml", errorMsg.utf8() ) ); + .tqarg( filename ).tqarg( errorLine ).tqarg( errorColumn ) + .tqarg( i18n ( "TQXml", errorMsg.utf8() ) ); store->close(); return false; } @@ -1645,32 +1645,32 @@ bool KoDocument::oldLoadAndParse(KoStore* store, const QString& filename, QDomDo return true; } -bool KoDocument::loadNativeFormat( const QString & file ) +bool KoDocument::loadNativeFormat( const TQString & file ) { - QFileInfo fileInfo( file ); + TQFileInfo fileInfo( file ); if ( !fileInfo.exists() ) // check duplicated from openURL, but this is useful for templates { - d->lastErrorMessage = i18n("The file %1 does not exist.").arg(file); + d->lastErrorMessage = i18n("The file %1 does not exist.").tqarg(file); return false; } if ( !fileInfo.isFile() ) { - d->lastErrorMessage = i18n( "%1 is not a file." ).arg(file); + d->lastErrorMessage = i18n( "%1 is not a file." ).tqarg(file); return false; } - QApplication::setOverrideCursor( waitCursor ); + TQApplication::setOverrideCursor( waitCursor ); kdDebug(30003) << "KoDocument::loadNativeFormat( " << file << " )" << endl; - QFile in; + TQFile in; bool isRawXML = false; if ( d->m_specialOutputFlag != SaveAsDirectoryStore ) // Don't try to open a directory ;) { in.setName(file); if ( !in.open( IO_ReadOnly ) ) { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); d->lastErrorMessage = i18n( "Could not open the file for reading (check read permissions)." ); return false; } @@ -1679,7 +1679,7 @@ bool KoDocument::loadNativeFormat( const QString & file ) char buf[5]; if ( in.readBlock( buf, 4 ) < 4 ) { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); in.close(); d->lastErrorMessage = i18n( "Could not read the beginning of the file." ); return false; @@ -1693,16 +1693,16 @@ bool KoDocument::loadNativeFormat( const QString & file ) do { if ( in.readBlock( buf , 1 ) < 1 ) { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); in.close(); d->lastErrorMessage = i18n( "Could not read the beginning of the file." ); return false; } - } while ( QChar( buf[0] ).isSpace() ); + } while ( TQChar( buf[0] ).isSpace() ); if ( buf[0] == '<' ) { // First not-space character if ( in.readBlock( buf , 4 ) < 4 ) { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); in.close(); d->lastErrorMessage = i18n( "Could not read the beginning of the file." ); return false; @@ -1716,28 +1716,28 @@ bool KoDocument::loadNativeFormat( const QString & file ) if ( isRawXML ) { in.at(0); - QString errorMsg; + TQString errorMsg; int errorLine; int errorColumn; - QDomDocument doc; + TQDomDocument doc; bool res; if ( doc.setContent( &in, true, &errorMsg, &errorLine, &errorColumn ) ) { - res = loadXML( &in, doc ); + res = loadXML( TQT_TQIODEVICE(&in), doc ); if ( res ) res = completeLoading( 0L ); } else { - kdError (30003) << "Parsing Error! Aborting! (in KoDocument::loadNativeFormat (QFile))" << endl + kdError (30003) << "Parsing Error! Aborting! (in KoDocument::loadNativeFormat (TQFile))" << endl << " Line: " << errorLine << " Column: " << errorColumn << endl << " Message: " << errorMsg << endl; d->lastErrorMessage = i18n( "parsing error in the main document at line %1, column %2\nError message: %3" ) - .arg( errorLine ).arg( errorColumn ).arg( i18n ( errorMsg.utf8() ) ); + .tqarg( errorLine ).tqarg( errorColumn ).tqarg( i18n ( errorMsg.utf8() ) ); res=false; } - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); in.close(); m_bEmpty = false; return res; @@ -1749,16 +1749,16 @@ bool KoDocument::loadNativeFormat( const QString & file ) } } -bool KoDocument::loadNativeFormatFromStore( const QString& file ) +bool KoDocument::loadNativeFormatFromStore( const TQString& file ) { KoStore::Backend backend = (d->m_specialOutputFlag == SaveAsDirectoryStore) ? KoStore::Directory : KoStore::Auto; KoStore * store = KoStore::createStore( file, KoStore::Read, "", backend ); if ( store->bad() ) { - d->lastErrorMessage = i18n( "Not a valid KOffice file: %1" ).arg( file ); + d->lastErrorMessage = i18n( "Not a valid KOffice file: %1" ).tqarg( file ); delete store; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); return false; } @@ -1773,7 +1773,7 @@ bool KoDocument::loadNativeFormatFromStore( const QString& file ) if ( !loadOasisFromStore( store ) ) { delete store; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); return false; } @@ -1781,21 +1781,21 @@ bool KoDocument::loadNativeFormatFromStore( const QString& file ) { oasis = false; - QDomDocument doc; + TQDomDocument doc; bool ok = oldLoadAndParse( store, "root", doc ); if ( ok ) ok = loadXML( store->device(), doc ); if ( !ok ) { delete store; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); return false; } store->close(); if ( !loadChildren( store ) ) { - kdError(30003) << "ERROR: Could not load children" << endl; + kdError(30003) << "ERROR: Could not load tqchildren" << endl; // Don't abort, proceed nonetheless } @@ -1804,12 +1804,12 @@ bool KoDocument::loadNativeFormatFromStore( const QString& file ) kdError(30003) << "ERROR: No maindoc.xml" << endl; d->lastErrorMessage = i18n( "Invalid document: no file 'maindoc.xml'." ); delete store; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); return false; } if ( oasis && store->hasFile( "meta.xml" ) ) { - QDomDocument metaDoc; + TQDomDocument metaDoc; KoOasisStore oasisStore( store ); if ( oasisStore.loadAndParse( "meta.xml", metaDoc, d->lastErrorMessage ) ) { d->m_docInfo->loadOasis( metaDoc ); @@ -1817,7 +1817,7 @@ bool KoDocument::loadNativeFormatFromStore( const QString& file ) } else if ( !oasis && store->hasFile( "documentinfo.xml" ) ) { - QDomDocument doc; + TQDomDocument doc; if ( oldLoadAndParse( store, "documentinfo.xml", doc ) ) { store->close(); d->m_docInfo->load( doc ); @@ -1832,17 +1832,17 @@ bool KoDocument::loadNativeFormatFromStore( const QString& file ) bool res = completeLoading( store ); delete store; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); m_bEmpty = false; return res; } // For embedded documents -bool KoDocument::loadFromStore( KoStore* _store, const QString& url ) +bool KoDocument::loadFromStore( KoStore* _store, const TQString& url ) { if ( _store->open( url ) ) { - QDomDocument doc; + TQDomDocument doc; doc.setContent( _store->device() ); if ( !loadXML( _store->device(), doc ) ) { @@ -1865,7 +1865,7 @@ bool KoDocument::loadFromStore( KoStore* _store, const QString& url ) if ( !loadChildren( _store ) ) { - kdError(30003) << "ERROR: Could not load children" << endl; + kdError(30003) << "ERROR: Could not load tqchildren" << endl; #if 0 return false; #endif @@ -1882,14 +1882,14 @@ bool KoDocument::loadFromStore( KoStore* _store, const QString& url ) bool KoDocument::loadOasisFromStore( KoStore* store ) { KoOasisStyles oasisStyles; - QDomDocument contentDoc; - QDomDocument settingsDoc; + TQDomDocument contentDoc; + TQDomDocument settingsDoc; KoOasisStore oasisStore( store ); bool ok = oasisStore.loadAndParse( "content.xml", contentDoc, d->lastErrorMessage ); if ( !ok ) return false; - QDomDocument stylesDoc; + TQDomDocument stylesDoc; (void)oasisStore.loadAndParse( "styles.xml", stylesDoc, d->lastErrorMessage ); // Load styles from style.xml oasisStyles.createStyleMap( stylesDoc, true ); @@ -1898,7 +1898,7 @@ bool KoDocument::loadOasisFromStore( KoStore* store ) // TODO post 1.4, pass manifestDoc to the apps so that they don't have to do it themselves // (when calling KoDocumentChild::loadOasisDocument) - //QDomDocument manifestDoc; + //TQDomDocument manifestDoc; //KoOasisStore oasisStore( store ); //if ( !oasisStore.loadAndParse( "tar:/META-INF/manifest.xml", manifestDoc, d->lastErrorMessage ) ) // return false; @@ -1967,7 +1967,7 @@ void KoDocument::setModified( bool mod ) m_bEmpty = FALSE; } else { // When saving this document, all non-external child documents get saved too. - QPtrListIterator it = children(); + TQPtrListIterator it = tqchildren(); for (; it.current(); ++it ) { KoDocument *doc = it.current()->document(); @@ -1990,7 +1990,7 @@ int KoDocument::queryCloseDia() { //kdDebug(30003)<title(); @@ -2002,7 +2002,7 @@ int KoDocument::queryCloseDia() name = i18n( "Untitled" ); int res = KMessageBox::warningYesNoCancel( 0L, - i18n( "

The document '%1' has been modified.

Do you want to save it?

" ).arg(name)); + i18n( "

The document '%1' has been modified.

Do you want to save it?

" ).tqarg(name)); switch(res) { @@ -2023,9 +2023,9 @@ int KoDocument::queryCloseDia() int KoDocument::queryCloseExternalChildren() { - //kdDebug(30003)< it( children() ); + TQPtrListIterator it( tqchildren() ); for (; it.current(); ++it ) { if ( !it.current()->isDeleted() ) @@ -2053,17 +2053,17 @@ int KoDocument::queryCloseExternalChildren() return KMessageBox::Ok; } -void KoDocument::setTitleModified( const QString caption, bool mod ) +void KoDocument::setTitleModified( const TQString caption, bool mod ) { //kdDebug(30003)<( parent() ); + KoDocument *doc = dynamic_cast( tqparent() ); if ( doc ) { doc->setTitleModified( caption, mod ); return; } // we must be root doc so update caption in all related windows - QPtrListIterator it( d->m_shells ); + TQPtrListIterator it( d->m_shells ); for (; it.current(); ++it ) { it.current()->updateCaption(); @@ -2075,14 +2075,14 @@ void KoDocument::setTitleModified( const QString caption, bool mod ) void KoDocument::setTitleModified() { //kdDebug(30003)<m_current<( parent() ); - QString caption; + KoDocument *doc = dynamic_cast( tqparent() ); + TQString caption; if ( (url().isEmpty() || isStoredExtern()) && d->m_current ) { // Get caption from document info (title(), in about page) if ( documentInfo() ) { - KoDocumentInfoPage * page = documentInfo()->page( QString::fromLatin1("about") ); + KoDocumentInfoPage * page = documentInfo()->page( TQString::tqfromLatin1("about") ); if (page) caption = static_cast(page)->title(); } @@ -2124,27 +2124,27 @@ bool KoDocument::completeSaving( KoStore* ) return true; } -QDomDocument KoDocument::createDomDocument( const QString& tagName, const QString& version ) const +TQDomDocument KoDocument::createDomDocument( const TQString& tagName, const TQString& version ) const { return createDomDocument( instance()->instanceName(), tagName, version ); } //static -QDomDocument KoDocument::createDomDocument( const QString& appName, const QString& tagName, const QString& version ) +TQDomDocument KoDocument::createDomDocument( const TQString& appName, const TQString& tagName, const TQString& version ) { - QDomImplementation impl; - QString url = QString("http://www.koffice.org/DTD/%1-%1.dtd").arg(appName).arg(version); - QDomDocumentType dtype = impl.createDocumentType( tagName, - QString("-//KDE//DTD %1 %1//EN").arg(appName).arg(version), + TQDomImplementation impl; + TQString url = TQString("http://www.koffice.org/DTD/%1-%1.dtd").tqarg(appName).tqarg(version); + TQDomDocumentType dtype = impl.createDocumentType( tagName, + TQString("-//KDE//DTD %1 %1//EN").tqarg(appName).tqarg(version), url ); // The namespace URN doesn't need to include the version number. - QString namespaceURN = QString("http://www.koffice.org/DTD/%1").arg(appName); - QDomDocument doc = impl.createDocument( namespaceURN, tagName, dtype ); + TQString namespaceURN = TQString("http://www.koffice.org/DTD/%1").tqarg(appName); + TQDomDocument doc = impl.createDocument( namespaceURN, tagName, dtype ); doc.insertBefore( doc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ), doc.documentElement() ); return doc; } -KoXmlWriter* KoDocument::createOasisXmlWriter( QIODevice* dev, const char* rootElementName ) +KoXmlWriter* KoDocument::createOasisXmlWriter( TQIODevice* dev, const char* rootElementName ) { KoXmlWriter* writer = new KoXmlWriter( dev ); writer->startDocument( rootElementName ); @@ -2176,11 +2176,11 @@ KoXmlWriter* KoDocument::createOasisXmlWriter( QIODevice* dev, const char* rootE return writer; } -QDomDocument KoDocument::saveXML() +TQDomDocument KoDocument::saveXML() { kdError(30003) << "KoDocument::saveXML not implemented" << endl; d->lastErrorMessage = i18n( "Internal error: saveXML not implemented" ); - return QDomDocument(); + return TQDomDocument(); } KService::Ptr KoDocument::nativeService() @@ -2191,15 +2191,15 @@ KService::Ptr KoDocument::nativeService() return m_nativeService; } -QCString KoDocument::nativeFormatMimeType() const +TQCString KoDocument::nativeFormatMimeType() const { KService::Ptr service = const_cast(this)->nativeService(); if ( !service ) - return QCString(); - QCString nativeMimeType = service->property( "X-KDE-NativeMimeType" ).toString().latin1(); + return TQCString(); + TQCString nativeMimeType = service->property( "X-KDE-NativeMimeType" ).toString().latin1(); if ( nativeMimeType.isEmpty() ) { // shouldn't happen, let's find out why it happened - if ( !service->serviceTypes().contains( "KOfficePart" ) ) + if ( !service->serviceTypes().tqcontains( "KOfficePart" ) ) kdWarning(30003) << "Wrong desktop file, KOfficePart isn't mentionned" << endl; else if ( !KServiceType::serviceType( "KOfficePart" ) ) kdWarning(30003) << "The KOfficePart service type isn't installed!" << endl; @@ -2207,11 +2207,11 @@ QCString KoDocument::nativeFormatMimeType() const return nativeMimeType; } -QCString KoDocument::nativeOasisMimeType() const +TQCString KoDocument::nativeOasisMimeType() const { KService::Ptr service = const_cast(this)->nativeService(); if ( !service ) - return QCString(); + return TQCString(); return service->property( "X-KDE-NativeOasisMimeType" ).toString().latin1(); } @@ -2219,10 +2219,10 @@ QCString KoDocument::nativeOasisMimeType() const //static KService::Ptr KoDocument::readNativeService( KInstance *instance ) { - QString instname = instance ? instance->instanceName() : kapp->instanceName(); + TQString instname = instance ? instance->instanceName() : kapp->instanceName(); // The new way is: we look for a foopart.desktop in the kde_services dir. - QString servicepartname = instname + "part.desktop"; + TQString servicepartname = instname + "part.desktop"; KService::Ptr service = KService::serviceByDesktopPath( servicepartname ); if ( service ) kdDebug(30003) << servicepartname << " found." << endl; @@ -2233,7 +2233,7 @@ KService::Ptr KoDocument::readNativeService( KInstance *instance ) // Try by path first, so that we find the global one (which has the native mimetype) // even if the user created a kword.desktop in ~/.kde/share/applnk or any subdir of it. // If he created it under ~/.kde/share/applnk/Office/ then no problem anyway. - service = KService::serviceByDesktopPath( QString::fromLatin1("Office/%1.desktop").arg(instname) ); + service = KService::serviceByDesktopPath( TQString::tqfromLatin1("Office/%1.desktop").tqarg(instname) ); } if ( !service ) service = KService::serviceByDesktopName( instname ); @@ -2241,11 +2241,11 @@ KService::Ptr KoDocument::readNativeService( KInstance *instance ) return service; } -QCString KoDocument::readNativeFormatMimeType( KInstance *instance ) //static +TQCString KoDocument::readNativeFormatMimeType( KInstance *instance ) //static { KService::Ptr service = readNativeService( instance ); if ( !service ) - return QCString(); + return TQCString(); if ( service->property( "X-KDE-NativeMimeType" ).toString().isEmpty() ) { @@ -2253,7 +2253,7 @@ QCString KoDocument::readNativeFormatMimeType( KInstance *instance ) //static if ( KServiceType::serviceType( "KOfficePart" ) == 0L ) kdError(30003) << "The serviceType KOfficePart is missing. Check that you have a kofficepart.desktop file in the share/servicetypes directory." << endl; else { - QString instname = instance ? instance->instanceName() : kapp->instanceName(); + TQString instname = instance ? instance->instanceName() : kapp->instanceName(); if ( instname != "koshell" ) // hack for koshell kdWarning(30003) << service->desktopEntryPath() << ": no X-KDE-NativeMimeType entry!" << endl; } @@ -2262,15 +2262,15 @@ QCString KoDocument::readNativeFormatMimeType( KInstance *instance ) //static return service->property( "X-KDE-NativeMimeType" ).toString().latin1(); } -QStringList KoDocument::readExtraNativeMimeTypes( KInstance *instance ) //static +TQStringList KoDocument::readExtraNativeMimeTypes( KInstance *instance ) //static { KService::Ptr service = readNativeService( instance ); if ( !service ) - return QStringList(); + return TQStringList(); return service->property( "X-KDE-ExtraNativeMimeTypes" ).toStringList(); } -void KoDocument::setupXmlReader( QXmlSimpleReader& reader, bool namespaceProcessing ) +void KoDocument::setupXmlReader( TQXmlSimpleReader& reader, bool namespaceProcessing ) { if ( namespaceProcessing ) { @@ -2286,16 +2286,16 @@ void KoDocument::setupXmlReader( QXmlSimpleReader& reader, bool namespaceProcess } -bool KoDocument::isNativeFormat( const QCString& mimetype ) const +bool KoDocument::isNativeFormat( const TQCString& mimetype ) const { if ( mimetype == nativeFormatMimeType() ) return true; - return extraNativeMimeTypes().contains( mimetype ); + return extraNativeMimeTypes().tqcontains( mimetype ); } -QStringList KoDocument::extraNativeMimeTypes() const +TQStringList KoDocument::extraNativeMimeTypes() const { - QStringList lst; + TQStringList lst; // This implementation is temporary while we treat both koffice-1.3 and OASIS formats as native. // But it's good to have this virtual method, in case some app want to // support more than one native format. @@ -2315,7 +2315,7 @@ int KoDocument::supportedSpecialFormats() const void KoDocument::addShell( KoMainWindow *shell ) { - if ( d->m_shells.findRef( shell ) == -1 ) + if ( d->m_shells.tqfindRef( shell ) == -1 ) { //kdDebug(30003) << "addShell: shell " << (void*)shell << " added to doc " << this << endl; d->m_shells.append( shell ); @@ -2328,7 +2328,7 @@ void KoDocument::removeShell( KoMainWindow *shell ) d->m_shells.removeRef( shell ); } -const QPtrList& KoDocument::shells() const +const TQPtrList& KoDocument::shells() const { return d->m_shells; } @@ -2345,17 +2345,17 @@ DCOPObject * KoDocument::dcopObject() return d->m_dcopObject; } -QCString KoDocument::dcopObjectId() const +TQCString KoDocument::dcopObjectId() const { return const_cast(this)->dcopObject()->objId(); } -void KoDocument::setErrorMessage( const QString& errMsg ) +void KoDocument::setErrorMessage( const TQString& errMsg ) { d->lastErrorMessage = errMsg; } -QString KoDocument::errorMessage() const +TQString KoDocument::errorMessage() const { return d->lastErrorMessage; } @@ -2364,11 +2364,11 @@ void KoDocument::showSavingErrorDialog() { if ( d->lastErrorMessage.isEmpty() ) { - KMessageBox::error( 0L, i18n( "Could not save\n%1" ).arg( m_file ) ); + KMessageBox::error( 0L, i18n( "Could not save\n%1" ).tqarg( m_file ) ); } else if ( d->lastErrorMessage != "USER_CANCELED" ) { - KMessageBox::error( 0L, i18n( "Could not save %1\nReason: %2" ).arg( m_file, d->lastErrorMessage ) ); + KMessageBox::error( 0L, i18n( "Could not save %1\nReason: %2" ).tqarg( m_file, d->lastErrorMessage ) ); } } @@ -2376,11 +2376,11 @@ void KoDocument::showLoadingErrorDialog() { if ( d->lastErrorMessage.isEmpty() ) { - KMessageBox::error( 0L, i18n( "Could not open\n%1" ).arg( url().prettyURL( 0, KURL::StripFileProtocol ) ) ); + KMessageBox::error( 0L, i18n( "Could not open\n%1" ).tqarg( url().prettyURL( 0, KURL::StripFileProtocol ) ) ); } else if ( d->lastErrorMessage != "USER_CANCELED" ) { - KMessageBox::error( 0L, i18n( "Could not open %1\nReason: %2" ).arg( url().prettyURL( 0, KURL::StripFileProtocol ), d->lastErrorMessage ) ); + KMessageBox::error( 0L, i18n( "Could not open %1\nReason: %2" ).tqarg( url().prettyURL( 0, KURL::StripFileProtocol ), d->lastErrorMessage ) ); } } @@ -2397,12 +2397,12 @@ bool KoDocument::isLoading() const void KoDocument::removeAutoSaveFiles() { // Eliminate any auto-save file - QString asf = autoSaveFile( m_file ); // the one in the current dir - if ( QFile::exists( asf ) ) - QFile::remove( asf ); - asf = autoSaveFile( QString::null ); // and the one in $HOME - if ( QFile::exists( asf ) ) - QFile::remove( asf ); + TQString asf = autoSaveFile( m_file ); // the one in the current dir + if ( TQFile::exists( asf ) ) + TQFile::remove( asf ); + asf = autoSaveFile( TQString() ); // and the one in $HOME + if ( TQFile::exists( asf ) ) + TQFile::remove( asf ); } void KoDocument::setBackupFile( bool _b ) @@ -2416,12 +2416,12 @@ bool KoDocument::backupFile()const } -void KoDocument::setBackupPath( const QString & _path) +void KoDocument::setBackupPath( const TQString & _path) { d->m_backupPath = _path; } -QString KoDocument::backupPath()const +TQString KoDocument::backupPath()const { return d->m_backupPath; } @@ -2429,7 +2429,7 @@ QString KoDocument::backupPath()const void KoDocument::setCurrent( bool on ) { //kdDebug(30003)<( parent() ); + KoDocument *doc = dynamic_cast( tqparent() ); if ( doc ) { if ( !isStoredExtern() ) @@ -2442,7 +2442,7 @@ void KoDocument::setCurrent( bool on ) d->m_current = on; if ( !on ) { - doc->setCurrent( true ); // let my next external parent take over + doc->setCurrent( true ); // let my next external tqparent take over return; } doc->forceCurrent( false ); // everybody else should keep off @@ -2457,7 +2457,7 @@ void KoDocument::forceCurrent( bool on ) { //kdDebug(30003)<m_current = on; - KoDocument *doc = dynamic_cast( parent() ); + KoDocument *doc = dynamic_cast( tqparent() ); if ( doc ) { doc->forceCurrent( false ); @@ -2505,7 +2505,7 @@ static const struct { }; static const unsigned int numTN2DT = sizeof( TN2DTArray ) / sizeof( *TN2DTArray ); -QString KoDocument::tagNameToDocumentType( const QString& localName ) +TQString KoDocument::tagNameToDocumentType( const TQString& localName ) { for ( unsigned int i = 0 ; i < numTN2DT ; ++i ) if ( localName == TN2DTArray[i].localName ) @@ -2513,9 +2513,9 @@ QString KoDocument::tagNameToDocumentType( const QString& localName ) return localName; } -QValueList KoDocument::allTextDocuments() const +TQValueList KoDocument::allTextDocuments() const { - return QValueList(); + return TQValueList(); } KoPageLayout KoDocument::pageLayout(int /*pageNumber*/) const @@ -2537,16 +2537,16 @@ void KoDocument::setUnit( KoUnit::Unit unit ) } } -QString KoDocument::unitName() const +TQString KoDocument::unitName() const { return KoUnit::unitName( unit() ); } -void KoDocument::showStartUpWidget( KoMainWindow* parent, bool alwaysShow ) +void KoDocument::showStartUpWidget( KoMainWindow* tqparent, bool alwaysShow ) { if(!alwaysShow) { KConfigGroup cfgGrp( instance()->config(), "TemplateChooserDialog" ); - QString fullTemplateName = cfgGrp.readPathEntry( "AlwaysUseTemplate" ); + TQString fullTemplateName = cfgGrp.readPathEntry( "AlwaysUseTemplate" ); if( !fullTemplateName.isEmpty() ) { openTemplate( fullTemplateName ); @@ -2558,24 +2558,24 @@ void KoDocument::showStartUpWidget( KoMainWindow* parent, bool alwaysShow ) if(d->m_startUpWidget){ d->m_startUpWidget->show(); } else { - d->m_startUpWidget = createOpenPane( parent->centralWidget(), instance(), templateType() ); + d->m_startUpWidget = createOpenPane( tqparent->centralWidget(), instance(), templateType() ); } - parent->setDocToOpen( this ); - parent->factory()->container("mainToolBar", parent)->hide(); + tqparent->setDocToOpen( this ); + tqparent->factory()->container("mainToolBar", tqparent)->hide(); } -void KoDocument::openExistingFile( const QString& file ) +void KoDocument::openExistingFile( const TQString& file ) { KURL url( file ); bool ok = openURL( url ); setModified( false ); if( ok ) - QTimer::singleShot( 0, this, SLOT( deleteOpenPane() ) ); + TQTimer::singleShot( 0, this, TQT_SLOT( deleteOpenPane() ) ); } -void KoDocument::openTemplate( const QString& file ) +void KoDocument::openTemplate( const TQString& file ) { bool ok = loadNativeFormat( file ); setModified( false ); @@ -2600,31 +2600,31 @@ void KoDocument::startCustomDocument() { deleteOpenPane(); } -KoOpenPane* KoDocument::createOpenPane( QWidget* parent, KInstance* instance, - const QString& templateType ) +KoOpenPane* KoDocument::createOpenPane( TQWidget* tqparent, KInstance* instance, + const TQString& templateType ) { - KoOpenPane* openPane = new KoOpenPane( parent, instance, templateType ); - QWidget *customDoc = createCustomDocumentWidget(openPane); + KoOpenPane* openPane = new KoOpenPane( tqparent, instance, templateType ); + TQWidget *customDoc = createCustomDocumentWidget(openPane); if(customDoc) { openPane->setCustomDocumentWidget( customDoc ); - connect( customDoc, SIGNAL( documentSelected() ), this, SLOT( startCustomDocument() ) ); + connect( customDoc, TQT_SIGNAL( documentSelected() ), this, TQT_SLOT( startCustomDocument() ) ); } openPane->show(); - connect( openPane, SIGNAL( openExistingFile( const QString& ) ), - this, SLOT( openExistingFile( const QString& ) ) ); - connect( openPane, SIGNAL( openTemplate( const QString& ) ), - this, SLOT( openTemplate( const QString& ) ) ); + connect( openPane, TQT_SIGNAL( openExistingFile( const TQString& ) ), + this, TQT_SLOT( openExistingFile( const TQString& ) ) ); + connect( openPane, TQT_SIGNAL( openTemplate( const TQString& ) ), + this, TQT_SLOT( openTemplate( const TQString& ) ) ); return openPane; } -void KoDocument::setTemplateType( const QString& _templateType ) +void KoDocument::setTemplateType( const TQString& _templateType ) { d->m_templateType = _templateType; } -QString KoDocument::templateType() const +TQString KoDocument::templateType() const { return d->m_templateType; } @@ -2633,7 +2633,7 @@ void KoDocument::deleteOpenPane() { if( d->m_startUpWidget ) { d->m_startUpWidget->hide(); - QTimer::singleShot(1000, this, SLOT(deleteOpenPaneDelayed())); + TQTimer::singleShot(1000, this, TQT_SLOT(deleteOpenPaneDelayed())); shells().getFirst()->factory()->container("mainToolBar", shells().getFirst())->show(); shells().getFirst()->setRootDocument( this ); @@ -2648,20 +2648,20 @@ void KoDocument::deleteOpenPaneDelayed() d->m_startUpWidget = 0; } -QWidget* KoDocument::createCustomDocumentWidget(QWidget */*parent*/) { +TQWidget* KoDocument::createCustomDocumentWidget(TQWidget */*tqparent*/) { return 0; } -bool KoDocument::showEmbedInitDialog(QWidget* parent) +bool KoDocument::showEmbedInitDialog(TQWidget* tqparent) { - KDialogBase dlg(parent, "EmbedInitDialog", true, i18n("Embedding Object"), 0, KDialogBase::NoDefault); + KDialogBase dlg(tqparent, "EmbedInitDialog", true, i18n("Embedding Object"), 0, KDialogBase::NoDefault); KoOpenPane* pane = createOpenPane(&dlg, instance(), templateType()); - pane->layout()->setMargin(0); + pane->tqlayout()->setMargin(0); dlg.setMainWidget(pane); dlg.setInitialSize(dlg.configDialogSize("EmbedInitDialog")); - connect(this, SIGNAL(closeEmbedInitDialog()), &dlg, SLOT(slotOk())); + connect(this, TQT_SIGNAL(closeEmbedInitDialog()), &dlg, TQT_SLOT(slotOk())); - bool ok = dlg.exec() == QDialog::Accepted; + bool ok = dlg.exec() == TQDialog::Accepted; dlg.saveDialogSize("EmbedInitDialog"); -- cgit v1.2.1