From d6f8bbb45b267065a6907e71ff9c98bb6d161241 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:56:07 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- parts/filecreate/filecreate_part.cpp | 142 +++++++++++++++++------------------ 1 file changed, 71 insertions(+), 71 deletions(-) (limited to 'parts/filecreate/filecreate_part.cpp') diff --git a/parts/filecreate/filecreate_part.cpp b/parts/filecreate/filecreate_part.cpp index 3733753a..e07656b9 100644 --- a/parts/filecreate/filecreate_part.cpp +++ b/parts/filecreate/filecreate_part.cpp @@ -9,12 +9,12 @@ ***************************************************************************/ #include "filecreate_part.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -61,30 +61,30 @@ K_EXPORT_COMPONENT_FACTORY( libkdevfilecreate, FileCreateFactory( data ) ) using namespace FileCreate; -FileCreatePart::FileCreatePart(QObject *parent, const char *name, const QStringList & ) +FileCreatePart::FileCreatePart(TQObject *parent, const char *name, const TQStringList & ) // : KDevCreateFile(&data, parent, name ? name : "FileCreatePart"), m_selectedWidget(-1), m_useSideTab(true), m_subPopups(0) : KDevCreateFile(&data, parent, name ? name : "FileCreatePart"), m_subPopups(0) { setInstance(FileCreateFactory::instance()); setXMLFile("kdevpart_filecreate.rc"); - connect( core(), SIGNAL(projectOpened()), this, SLOT(slotProjectOpened()) ); - connect( core(), SIGNAL(projectClosed()), this, SLOT(slotProjectClosed()) ); + connect( core(), TQT_SIGNAL(projectOpened()), this, TQT_SLOT(slotProjectOpened()) ); + connect( core(), TQT_SIGNAL(projectClosed()), this, TQT_SLOT(slotProjectClosed()) ); _configProxy = new ConfigWidgetProxy( core() ); _configProxy->createProjectConfigPage( i18n("File Templates"), PROJECTSETTINGSPAGE, info()->icon() ); _configProxy->createGlobalConfigPage( i18n("File Templates"), GLOBALSETTINGSPAGE, info()->icon() ); - connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )), - this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) ); + connect( _configProxy, TQT_SIGNAL(insertConfigWidget(const KDialogBase*, TQWidget*, unsigned int )), + this, TQT_SLOT(insertConfigWidget(const KDialogBase*, TQWidget*, unsigned int )) ); - KToolBarPopupAction * newAction = new KToolBarPopupAction( i18n("&New"), "filenew", CTRL+Qt::Key_N, this, SLOT(slotNewFile()), actionCollection(), "file_new"); + KToolBarPopupAction * newAction = new KToolBarPopupAction( i18n("&New"), "filenew", CTRL+Qt::Key_N, this, TQT_SLOT(slotNewFile()), actionCollection(), "file_new"); newAction->setWhatsThis( i18n("New file

Creates a new file. Also adds it the project if the Add to project checkbox is turned on.") ); newAction->setToolTip( i18n("Create a new file") ); m_newPopupMenu = newAction->popupMenu(); - connect(m_newPopupMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowNewPopupMenu())); + connect(m_newPopupMenu, TQT_SIGNAL(aboutToShow()), this, TQT_SLOT(slotAboutToShowNewPopupMenu())); - QTimer::singleShot( 0, this, SLOT(slotGlobalInitialize()) ); + TQTimer::singleShot( 0, this, TQT_SLOT(slotGlobalInitialize()) ); } @@ -96,7 +96,7 @@ FileCreatePart::~FileCreatePart() delete m_subPopups; } -void FileCreatePart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber ) +void FileCreatePart::insertConfigWidget( const KDialogBase * dlg, TQWidget * page, unsigned int pagenumber ) { kdDebug() << k_funcinfo << endl; @@ -105,14 +105,14 @@ void FileCreatePart::insertConfigWidget( const KDialogBase * dlg, QWidget * page case PROJECTSETTINGSPAGE: { FCConfigWidget* w = new FCConfigWidget( this, false, page, "filecreate config widget" ); - connect( dlg, SIGNAL( okClicked( ) ), w, SLOT( accept( ) ) ); + connect( dlg, TQT_SIGNAL( okClicked( ) ), w, TQT_SLOT( accept( ) ) ); } break; case GLOBALSETTINGSPAGE: { FCConfigWidget *w = new FCConfigWidget( this, true, page, "filecreate config widget" ); - connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); + connect(dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(accept())); } break; } @@ -132,26 +132,26 @@ void FileCreatePart::slotAboutToShowNewPopupMenu() { if (filetype->subtypes().count()==0) { - QPixmap iconPix = m_iconLoader->loadIcon( + TQPixmap iconPix = m_iconLoader->loadIcon( filetype->icon(), KIcon::Desktop, KIcon::SizeSmall, KIcon::DefaultState, NULL, true); m_newPopupMenu->insertItem(iconPix, filetype->name(), this, - SLOT(slotNewFilePopup(int)), 0, ++id ); + TQT_SLOT(slotNewFilePopup(int)), 0, ++id ); m_newPopupMenu->setItemParameter( id, (long)filetype ); } else { KPopupMenu* subMenu = NULL; - QPtrList subtypes = filetype->subtypes(); + TQPtrList subtypes = filetype->subtypes(); for(FileType * subtype = subtypes.first(); subtype; subtype=subtypes.next()) { if (subtype->enabled()){ if( !subMenu ) subMenu = new KPopupMenu(0,0); - QPixmap iconPix = m_iconLoader->loadIcon( + TQPixmap iconPix = m_iconLoader->loadIcon( subtype->icon(), KIcon::Desktop, KIcon::SizeSmall, KIcon::DefaultState, NULL, true); subMenu->insertItem(iconPix, subtype->name(), this, - SLOT(slotNewFilePopup(int)), 0, ++id ); + TQT_SLOT(slotNewFilePopup(int)), 0, ++id ); subMenu->setItemParameter( id, (long)subtype ); } } @@ -159,7 +159,7 @@ void FileCreatePart::slotAboutToShowNewPopupMenu() { if( !m_subPopups ) { - m_subPopups = new QPtrList; + m_subPopups = new TQPtrList; m_subPopups->setAutoDelete(true); } m_subPopups->append( subMenu ); @@ -187,10 +187,10 @@ void FileCreatePart::slotNewFile() { } void FileCreatePart::slotProjectOpened() { - QTimer::singleShot( 0, this, SLOT(slotInitialize()) ); + TQTimer::singleShot( 0, this, TQT_SLOT(slotInitialize()) ); } -void FileCreatePart::addFileType(const QString & filename) { +void FileCreatePart::addFileType(const TQString & filename) { FileType * filetype = getType(filename); if (!filetype) { filetype = new FileType; @@ -204,14 +204,14 @@ void FileCreatePart::addFileType(const QString & filename) { void FileCreatePart::slotProjectClosed() { m_filetypes.clear(); - QTimer::singleShot( 0, this, SLOT(slotGlobalInitialize()) ); + TQTimer::singleShot( 0, this, TQT_SLOT(slotGlobalInitialize()) ); } void FileCreatePart::slotFiletypeSelected(const FileType * filetype) { KDevCreateFile::CreatedFile createdFile = createNewFile(filetype->ext(), - QString::null, - QString::null, + TQString::null, + TQString::null, filetype->subtypeRef()); openCreatedFile(createdFile); @@ -226,14 +226,14 @@ void FileCreatePart::openCreatedFile(const KDevCreateFile::CreatedFile & created } } -int FileCreatePart::readTypes(const QDomDocument & dom, QPtrList &m_filetypes, bool enable) { +int FileCreatePart::readTypes(const TQDomDocument & dom, TQPtrList &m_filetypes, bool enable) { int numRead = 0; - QDomElement fileTypes = DomUtil::elementByPath(dom,"/kdevfilecreate/filetypes"); + TQDomElement fileTypes = DomUtil::elementByPath(dom,"/kdevfilecreate/filetypes"); if (!fileTypes.isNull()) { - for(QDomNode node = fileTypes.firstChild();!node.isNull();node=node.nextSibling()) { + for(TQDomNode node = fileTypes.firstChild();!node.isNull();node=node.nextSibling()) { if (node.isElement() && node.nodeName()=="type") { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); FileType * filetype = new FileType; filetype->setName( element.attribute("name") ); filetype->setExt( element.attribute("ext") ); @@ -248,10 +248,10 @@ int FileCreatePart::readTypes(const QDomDocument & dom, QPtrList &m_fi kdDebug(9034) << "node: " << filetype->name().latin1() << endl; if (node.hasChildNodes()) { - for(QDomNode subnode = node.firstChild();!subnode.isNull();subnode=subnode.nextSibling()) { + for(TQDomNode subnode = node.firstChild();!subnode.isNull();subnode=subnode.nextSibling()) { kdDebug(9034) << "subnode: " << subnode.nodeName().latin1() << endl; if (subnode.isElement() && subnode.nodeName()=="subtype") { - QDomElement subelement = subnode.toElement(); + TQDomElement subelement = subnode.toElement(); FileType * subtype = new FileType; subtype->setExt( filetype->ext() ); subtype->setCreateMethod( filetype->createMethod() ); @@ -270,23 +270,23 @@ int FileCreatePart::readTypes(const QDomDocument & dom, QPtrList &m_fi return numRead; } -FileType * FileCreatePart::getType(const QString & ex, const QString subtRef) { +FileType * FileCreatePart::getType(const TQString & ex, const TQString subtRef) { - QString subtypeRef = subtRef; - QString ext = ex; + TQString subtypeRef = subtRef; + TQString ext = ex; int dashPos = ext.find('-'); if (dashPos>-1 && subtRef.isNull()) { ext = ex.left(dashPos); subtypeRef = ex.mid(dashPos+1); } - QPtrList filetypes = getFileTypes(); + TQPtrList filetypes = getFileTypes(); for(FileType * filetype = filetypes.first(); filetype; filetype=filetypes.next()) { if (filetype->ext()==ext) { if (subtypeRef.isNull()) return filetype; - QPtrList subtypes = filetype->subtypes(); + TQPtrList subtypes = filetype->subtypes(); for(FileType * subtype = subtypes.first(); subtype; subtype=subtypes.next()) { @@ -297,23 +297,23 @@ FileType * FileCreatePart::getType(const QString & ex, const QString subtRef) { return NULL; } -FileType * FileCreatePart::getEnabledType(const QString & ex, const QString subtRef) { +FileType * FileCreatePart::getEnabledType(const TQString & ex, const TQString subtRef) { - QString subtypeRef = subtRef; - QString ext = ex; + TQString subtypeRef = subtRef; + TQString ext = ex; int dashPos = ext.find('-'); if (dashPos>-1 && subtRef.isNull()) { ext = ex.left(dashPos); subtypeRef = ex.mid(dashPos+1); } - QPtrList filetypes = getFileTypes(); + TQPtrList filetypes = getFileTypes(); for(FileType * filetype = filetypes.first(); filetype; filetype=filetypes.next()) { if (filetype->ext()==ext) { if ( (subtypeRef.isNull()) && (filetype->enabled()) ) return filetype; - QPtrList subtypes = filetype->subtypes(); + TQPtrList subtypes = filetype->subtypes(); for(FileType * subtype = subtypes.first(); subtype; subtype=subtypes.next()) { @@ -326,7 +326,7 @@ FileType * FileCreatePart::getEnabledType(const QString & ex, const QString subt // KDevFileCreate interface -KDevCreateFile::CreatedFile FileCreatePart::createNewFile(QString ext, QString dir, QString name, QString subtype) +KDevCreateFile::CreatedFile FileCreatePart::createNewFile(TQString ext, TQString dir, TQString name, TQString subtype) { KDevCreateFile::CreatedFile result; @@ -358,10 +358,10 @@ KDevCreateFile::CreatedFile FileCreatePart::createNewFile(QString ext, QString d if (!dir.isNull()) dialog.setDirectory(dir); else if (!project()) - dialog.setDirectory(QDir::currentDirPath()); + dialog.setDirectory(TQDir::currentDirPath()); else { - QString activeDir = project()->activeDirectory(); + TQString activeDir = project()->activeDirectory(); dialog.setDirectory( project()->projectDirectory() + ( activeDir[0] == '/' ? "" : "/" ) + activeDir ); @@ -369,7 +369,7 @@ KDevCreateFile::CreatedFile FileCreatePart::createNewFile(QString ext, QString d if (!name.isNull()) dialog.setName(name); if (filetype) dialog.setCurrent(filetype); - dialog.setInitialSize(QSize(500, 200)); + dialog.setInitialSize(TQSize(500, 200)); int dialogResult = dialog.exec(); if (dialogResult == KDialogBase::Rejected) { @@ -393,11 +393,11 @@ KDevCreateFile::CreatedFile FileCreatePart::createNewFile(QString ext, QString d subtype = selectedFileType->subtypeRef(); } - QString fullPath = selectedURL.path(); + TQString fullPath = selectedURL.path(); // add appropriate extension, if not already there if ( !ext.isEmpty() && !fullPath.endsWith("." + ext)) fullPath+="." + ext; - QString filename = URLUtil::filename(fullPath); + TQString filename = URLUtil::filename(fullPath); kdDebug(9034) << "full path = " << fullPath << endl; // add in subtype, if specified @@ -410,7 +410,7 @@ KDevCreateFile::CreatedFile FileCreatePart::createNewFile(QString ext, QString d created = FileTemplate::copy(this, ext, fullPath); else { // no template, create a blank file instead - QFile f(fullPath); + TQFile f(fullPath); created = f.open( IO_WriteOnly ); f.close(); } @@ -423,8 +423,8 @@ KDevCreateFile::CreatedFile FileCreatePart::createNewFile(QString ext, QString d if (dialog.addToProject()) { // work out the path relative to the project directory -// QString relToProj = URLUtil::relativePath(projectURL, selectedURL, URLUtil::SLASH_PREFIX ); - QString relToProj; +// TQString relToProj = URLUtil::relativePath(projectURL, selectedURL, URLUtil::SLASH_PREFIX ); + TQString relToProj; if( project()->options() & KDevProject::UsesQMakeBuildSystem ) { relToProj = URLUtil::relativePathToFile( project()->projectDirectory(), fullPath ); @@ -440,7 +440,7 @@ KDevCreateFile::CreatedFile FileCreatePart::createNewFile(QString ext, QString d url.setPath(fullPath); partController()->editDocument(url); - QString fileName = URLUtil::filename(fullPath); + TQString fileName = URLUtil::filename(fullPath); kdDebug(9034) << "file name = " << filename << endl; result.filename = fileName; @@ -451,7 +451,7 @@ KDevCreateFile::CreatedFile FileCreatePart::createNewFile(QString ext, QString d } void FileCreatePart::slotNoteFiletype(const FileType * filetype) { - kdDebug(9034) << "Noting file type: " << (filetype ? filetype->ext() : QString::fromLatin1("Null") ) << endl; + kdDebug(9034) << "Noting file type: " << (filetype ? filetype->ext() : TQString::fromLatin1("Null") ) << endl; m_filedialogFiletype = filetype; } @@ -463,15 +463,15 @@ void FileCreatePart::slotInitialize( ) slotGlobalInitialize(); // read in which global templates are to be used for this project - QDomElement useGlobalTypes = + TQDomElement useGlobalTypes = DomUtil::elementByPath(*projectDom(),"/kdevfilecreate/useglobaltypes"); - for(QDomNode node = useGlobalTypes.firstChild(); + for(TQDomNode node = useGlobalTypes.firstChild(); !node.isNull();node=node.nextSibling()) { if (node.isElement() && node.nodeName()=="type") { - QDomElement element = node.toElement(); - QString ext = element.attribute("ext"); - QString subtyperef = element.attribute("subtyperef"); + TQDomElement element = node.toElement(); + TQString ext = element.attribute("ext"); + TQString subtyperef = element.attribute("subtyperef"); // if an extension has been specified as enabled, ensure it // and all its subtypes are enabled if (subtyperef.isNull()) { @@ -498,13 +498,13 @@ void FileCreatePart::slotInitialize( ) if ( project() && readTypes( *projectDom(), m_filetypes, true )==0 ) { // default by scanning the templates directory if no template info // found in project file - QDir templDir( project()->projectDirectory() + "/templates/" ); + TQDir templDir( project()->projectDirectory() + "/templates/" ); if (templDir.exists()) { - templDir.setFilter( QDir::Files ); + templDir.setFilter( TQDir::Files ); const QFileInfoList * list = templDir.entryInfoList(); if( list ){ QFileInfoListIterator it( *list ); - QFileInfo *fi; + TQFileInfo *fi; while ( (fi = it.current()) != 0 ) { addFileType(fi->fileName()); ++it; @@ -520,16 +520,16 @@ void FileCreatePart::slotInitialize( ) } } -QString FileCreatePart::findGlobalXMLFile() const +TQString FileCreatePart::findGlobalXMLFile() const { int version = 0; - QString filename; - QStringList filenames = KGlobal::instance()->dirs()->findAllResources("data", "kdevfilecreate/template-info.xml"); - for( QStringList::const_iterator it = filenames.begin(); it != filenames.end(); ++it ) + TQString filename; + TQStringList filenames = KGlobal::instance()->dirs()->findAllResources("data", "kdevfilecreate/template-info.xml"); + for( TQStringList::const_iterator it = filenames.begin(); it != filenames.end(); ++it ) { - QDomDocument globalDom; + TQDomDocument globalDom; DomUtil::openDOMFile(globalDom,*it); - QDomElement e = globalDom.documentElement(); + TQDomElement e = globalDom.documentElement(); if( !e.hasAttribute( "version" ) && e.attribute( "version" ).toInt() < version ) { continue; @@ -545,9 +545,9 @@ QString FileCreatePart::findGlobalXMLFile() const void FileCreatePart::slotGlobalInitialize( ) { // read in global template information - QString globalXMLFile = findGlobalXMLFile(); + TQString globalXMLFile = findGlobalXMLFile(); kdDebug(9034) << "Found global template info info " << globalXMLFile << endl; - QDomDocument globalDom; + TQDomDocument globalDom; if (!globalXMLFile.isNull() && DomUtil::openDOMFile(globalDom,globalXMLFile)) { kdDebug(9034) << "Reading global template info..." << endl; -- cgit v1.2.1