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/KoTemplates.cpp | 130 ++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 65 deletions(-) (limited to 'lib/kofficecore/KoTemplates.cpp') diff --git a/lib/kofficecore/KoTemplates.cpp b/lib/kofficecore/KoTemplates.cpp index 7fbf3a99..178c6271 100644 --- a/lib/kofficecore/KoTemplates.cpp +++ b/lib/kofficecore/KoTemplates.cpp @@ -19,9 +19,9 @@ #include -#include -#include -#include +#include +#include +#include #include #include @@ -37,31 +37,31 @@ #include -KoTemplate::KoTemplate(const QString &name, const QString &description, const QString &file, - const QString &picture, const QString &fileName, const QString &_measureSystem, +KoTemplate::KoTemplate(const TQString &name, const TQString &description, const TQString &file, + const TQString &picture, const TQString &fileName, const TQString &_measureSystem, bool hidden, bool touched) : m_name(name), m_descr(description), m_file(file), m_picture(picture), m_fileName(fileName), m_hidden(hidden), m_touched(touched), m_cached(false), m_measureSystem(_measureSystem) { } -const QPixmap &KoTemplate::loadPicture( KInstance* instance ) { +const TQPixmap &KoTemplate::loadPicture( KInstance* instance ) { if(m_cached) return m_pixmap; m_cached=true; if ( m_picture[ 0 ] == '/' ) { - // ### TODO: use the class KoPicture instead of QImage to support non-image pictures - QImage img( m_picture ); + // ### TODO: use the class KoPicture instead of TQImage to support non-image pictures + TQImage img( m_picture ); if (img.isNull()) { kdWarning() << "Couldn't find icon " << m_picture << endl; - m_pixmap=QPixmap(); + m_pixmap=TQPixmap(); return m_pixmap; } const int maxHeightWidth = 128; // ### TODO: some people would surely like to have 128x128 if (img.width() > maxHeightWidth || img.height() > maxHeightWidth) { - img = img.smoothScale( maxHeightWidth, maxHeightWidth, QImage::ScaleMax ); + img = img.smoothScale( maxHeightWidth, maxHeightWidth, TQ_ScaleMax ); } m_pixmap.convertFromImage(img); return m_pixmap; @@ -72,7 +72,7 @@ const QPixmap &KoTemplate::loadPicture( KInstance* instance ) { } -KoTemplateGroup::KoTemplateGroup(const QString &name, const QString &dir, +KoTemplateGroup::KoTemplateGroup(const TQString &name, const TQString &dir, int _sortingWeight, bool touched) : m_name(name), m_touched(touched), m_sortingWeight(_sortingWeight) { @@ -82,7 +82,7 @@ KoTemplateGroup::KoTemplateGroup(const QString &name, const QString &dir, bool KoTemplateGroup::isHidden() const { - QPtrListIterator it(m_templates); + TQPtrListIterator it(m_templates); bool hidden=true; while(it.current()!=0L && hidden) { hidden=it.current()->isHidden(); @@ -93,7 +93,7 @@ bool KoTemplateGroup::isHidden() const { void KoTemplateGroup::setHidden(bool hidden) const { - QPtrListIterator it(m_templates); + TQPtrListIterator it(m_templates); for( ; it.current()!=0L; ++it) it.current()->setHidden(hidden); m_touched=true; @@ -101,7 +101,7 @@ void KoTemplateGroup::setHidden(bool hidden) const { bool KoTemplateGroup::add(KoTemplate *t, bool force, bool touch) { - KoTemplate *myTemplate=find(t->name()); + KoTemplate *myTemplate=tqfind(t->name()); if(myTemplate==0L) { m_templates.append(t); m_touched=touch; @@ -109,9 +109,9 @@ bool KoTemplateGroup::add(KoTemplate *t, bool force, bool touch) { } else if(myTemplate && force) { //kdDebug() << "removing :" << myTemplate->fileName() << endl; - QFile::remove( myTemplate->fileName() ); - QFile::remove( myTemplate->picture() ); - QFile::remove( myTemplate->file() ); + TQFile::remove( myTemplate->fileName() ); + TQFile::remove( myTemplate->picture() ); + TQFile::remove( myTemplate->file() ); m_templates.removeRef(myTemplate); m_templates.append(t); m_touched=touch; @@ -120,16 +120,16 @@ bool KoTemplateGroup::add(KoTemplate *t, bool force, bool touch) { return false; } -KoTemplate *KoTemplateGroup::find(const QString &name) const { +KoTemplate *KoTemplateGroup::tqfind(const TQString &name) const { - QPtrListIterator it(m_templates); + TQPtrListIterator it(m_templates); while(it.current() && it.current()->name()!=name) ++it; return it.current(); } -KoTemplateTree::KoTemplateTree(const QCString &templateType, +KoTemplateTree::KoTemplateTree(const TQCString &templateType, KInstance *instance, bool readTree) : m_templateType(templateType), m_instance(instance), m_defaultGroup(0L), m_defaultTemplate(0L) { @@ -146,7 +146,7 @@ void KoTemplateTree::readTemplateTree() { } void KoTemplateTree::writeTemplateTree() { - QString localDir=m_instance->dirs()->saveLocation(m_templateType); + TQString localDir=m_instance->dirs()->saveLocation(m_templateType); for(KoTemplateGroup *group=m_groups.first(); group!=0L; group=m_groups.next()) { //kdDebug() << "---------------------------------" << endl; @@ -183,8 +183,8 @@ void KoTemplateTree::writeTemplateTree() { if(t->isHidden() && t->touched() ) { //kdDebug() << "+++ delete local template ##############" << endl; writeTemplate(t, group, localDir); - QFile::remove(t->file()); - QFile::remove(t->picture()); + TQFile::remove(t->file()); + TQFile::remove(t->picture()); } } } @@ -192,16 +192,16 @@ void KoTemplateTree::writeTemplateTree() { void KoTemplateTree::add(KoTemplateGroup *g) { - KoTemplateGroup *group=find(g->name()); + KoTemplateGroup *group=tqfind(g->name()); if(group==0L) m_groups.append(g); else group->addDir(g->dirs().first()); // "...there can be only one..." (Queen) } -KoTemplateGroup *KoTemplateTree::find(const QString &name) const { +KoTemplateGroup *KoTemplateTree::tqfind(const TQString &name) const { - QPtrListIterator it(m_groups); + TQPtrListIterator it(m_groups); while(it.current() && it.current()->name()!=name) ++it; return it.current(); @@ -209,21 +209,21 @@ KoTemplateGroup *KoTemplateTree::find(const QString &name) const { void KoTemplateTree::readGroups() { - QStringList dirs = m_instance->dirs()->resourceDirs(m_templateType); - for(QStringList::ConstIterator it=dirs.begin(); it!=dirs.end(); ++it) { + TQStringList dirs = m_instance->dirs()->resourceDirs(m_templateType); + for(TQStringList::ConstIterator it=dirs.begin(); it!=dirs.end(); ++it) { //kdDebug() << "dir: " << *it << endl; - QDir dir(*it); + TQDir dir(*it); // avoid the annoying warning if(!dir.exists()) continue; - dir.setFilter(QDir::Dirs); - QStringList templateDirs=dir.entryList(); - for(QStringList::ConstIterator tdirIt=templateDirs.begin(); tdirIt!=templateDirs.end(); ++tdirIt) { + dir.setFilter(TQDir::Dirs); + TQStringList templateDirs=dir.entryList(); + for(TQStringList::ConstIterator tdirIt=templateDirs.begin(); tdirIt!=templateDirs.end(); ++tdirIt) { if(*tdirIt=="." || *tdirIt=="..") // we don't want to check those dirs :) continue; - QDir templateDir(*it+*tdirIt); - QString name=*tdirIt; - QString defaultTab; + TQDir templateDir(*it+*tdirIt); + TQString name=*tdirIt; + TQString defaultTab; int sortingWeight = 1000; if(templateDir.exists(".directory")) { KSimpleConfig config(templateDir.absPath()+"/.directory", true); @@ -233,7 +233,7 @@ void KoTemplateTree::readGroups() { sortingWeight=config.readNumEntry("X-KDE-SortingWeight", 1000); //kdDebug() << "name: " << name <pageSize() == QPrinter::Letter) { + if(KGlobal::locale()->pageSize() == TQPrinter::Letter) { dontShow = "metric"; } - QPtrListIterator groupIt(m_groups); + TQPtrListIterator groupIt(m_groups); for( ; groupIt.current()!=0L; ++groupIt) { - QStringList dirs=groupIt.current()->dirs(); - for(QStringList::ConstIterator it=dirs.begin(); it!=dirs.end(); ++it) { - QDir d(*it); + TQStringList dirs=groupIt.current()->dirs(); + for(TQStringList::ConstIterator it=dirs.begin(); it!=dirs.end(); ++it) { + TQDir d(*it); if( !d.exists() ) continue; - QStringList files=d.entryList( QDir::Files | QDir::Readable, QDir::Name ); + TQStringList files=d.entryList( TQDir::Files | TQDir::Readable, TQDir::Name ); for(unsigned int i=0; i