diff options
Diffstat (limited to 'parts/appwizard/importdlg.cpp')
-rw-r--r-- | parts/appwizard/importdlg.cpp | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/parts/appwizard/importdlg.cpp b/parts/appwizard/importdlg.cpp index b900181d..9cb9838a 100644 --- a/parts/appwizard/importdlg.cpp +++ b/parts/appwizard/importdlg.cpp @@ -11,17 +11,17 @@ #include "importdlg.h" #include <stdlib.h> -#include <qcombobox.h> -#include <qdir.h> -#include <qfile.h> -#include <qlabel.h> -#include <qlayout.h> +#include <tqcombobox.h> +#include <tqdir.h> +#include <tqfile.h> +#include <tqlabel.h> +#include <tqlayout.h> #include <klineedit.h> -#include <qpushbutton.h> -#include <qregexp.h> -#include <qtextstream.h> -#include <qtooltip.h> -#include <qcheckbox.h> +#include <tqpushbutton.h> +#include <tqregexp.h> +#include <tqtextstream.h> +#include <tqtooltip.h> +#include <tqcheckbox.h> #include <kbuttonbox.h> #include <kdebug.h> #include <kdialog.h> @@ -51,25 +51,25 @@ #include "misc.h" -ImportDialog::ImportDialog(AppWizardPart *part, QWidget *parent, const char *name) +ImportDialog::ImportDialog(AppWizardPart *part, TQWidget *parent, const char *name) : ImportDialogBase(parent, name, true), m_part(part) { - QString author, email; + TQString author, email; AppWizardUtil::guessAuthorAndEmail(&author, &email); author_edit->setText(author); email_edit->setText(email); - QToolTip::add( urlinput_edit->button(), i18n("Choose directory to import") ); + TQToolTip::add( urlinput_edit->button(), i18n("Choose directory to import") ); urlinput_edit->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly); KStandardDirs *dirs = AppWizardFactory::instance()->dirs(); - importNames = dirs->findAllResources("appimports", QString::null, false, true); + importNames = dirs->findAllResources("appimports", TQString::null, false, true); importNames.sort(); - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for (it = importNames.begin(); it != importNames.end(); ++it) { KConfig config(KGlobal::dirs()->findResource("appimports", *it)); config.setGroup("General"); - QString type = config.readEntry("Comment"); + TQString type = config.readEntry("Comment"); project_combo->insertItem(type); if (config.hasGroup("Infrastructure")) @@ -86,12 +86,12 @@ ImportDialog::ImportDialog(AppWizardPart *part, QWidget *parent, const char *nam infrastructureBox->setEnabled(false); setProjectType("c"); - connect( name_edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotProjectNameChanged( const QString & ) ) ); + connect( name_edit, TQT_SIGNAL( textChanged ( const TQString & ) ), this, TQT_SLOT( slotProjectNameChanged( const TQString & ) ) ); // scanAvailableVCS(); - connect( fetchModuleButton, SIGNAL(clicked()), - this, SLOT(slotFetchModulesFromRepository()) ); - connect(urlinput_edit, SIGNAL(urlSelected(const QString& )), this, SLOT(dirChanged())); - connect(urlinput_edit, SIGNAL(returnPressed(const QString& )), this, SLOT(dirChanged())); + connect( fetchModuleButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotFetchModulesFromRepository()) ); + connect(urlinput_edit, TQT_SIGNAL(urlSelected(const TQString& )), this, TQT_SLOT(dirChanged())); + connect(urlinput_edit, TQT_SIGNAL(returnPressed(const TQString& )), this, TQT_SLOT(dirChanged())); slotProjectNameChanged( name_edit->text() ); } @@ -99,20 +99,20 @@ ImportDialog::ImportDialog(AppWizardPart *part, QWidget *parent, const char *nam ImportDialog::~ImportDialog() {} -void ImportDialog::slotProjectNameChanged( const QString &_text ) +void ImportDialog::slotProjectNameChanged( const TQString &_text ) { - ok_button->setEnabled( !_text.isEmpty() && !urlinput_edit->url().contains( QRegExp("\\s") ) ); + ok_button->setEnabled( !_text.isEmpty() && !urlinput_edit->url().contains( TQRegExp("\\s") ) ); } void ImportDialog::accept() { - QDir dir(urlinput_edit->url()); + TQDir dir(urlinput_edit->url()); if (urlinput_edit->url().isEmpty() || !dir.exists()) { KMessageBox::sorry(this, i18n("You have to choose a directory.")); return; } - QString projectName = name_edit->text(); + TQString projectName = name_edit->text(); if (projectName.isEmpty()) { KMessageBox::sorry(this, i18n("You have to choose a project name.")); return; @@ -127,13 +127,13 @@ void ImportDialog::accept() if (infrastructureBox->isVisible() && infrastructureBox->isChecked()) createProjectInfrastructure(); -// QString author = author_edit->text(); -// QString email = email_edit->text(); +// TQString author = author_edit->text(); +// TQString email = email_edit->text(); - QFileInfo finfo(importNames[project_combo->currentItem()]); - QDir importdir(finfo.dir()); + TQFileInfo finfo(importNames[project_combo->currentItem()]); + TQDir importdir(finfo.dir()); importdir.cdUp(); - QFile src(importdir.filePath("importfiles/" + finfo.fileName() + ".kdevelop")); + TQFile src(importdir.filePath("importfiles/" + finfo.fileName() + ".kdevelop")); kdDebug(9010) << "Import template " << src.name() << endl; if (!src.open(IO_ReadOnly)) { KMessageBox::sorry(this, i18n("Cannot open project template.")); @@ -141,10 +141,10 @@ void ImportDialog::accept() } // Read the DOM of the newly created project - QDomDocument projectDOM; + TQDomDocument projectDOM; int errorLine, errorCol; - QString errorMsg; + TQString errorMsg; bool success = projectDOM.setContent( &src, &errorMsg, &errorLine, &errorCol); src.close(); if ( !success ) @@ -165,11 +165,11 @@ void ImportDialog::accept() } // figure out what plugins we should disable by default - QString profileName = DomUtil::readEntry( projectDOM, "general/profile" ); + TQString profileName = DomUtil::readEntry( projectDOM, "general/profile" ); if ( profileName.isEmpty() ) { - QString language = DomUtil::readEntry( projectDOM, "general/primarylanguage" ); - QStringList keywords = DomUtil::readListEntry( projectDOM, "general/keywords", "keyword" ); + TQString language = DomUtil::readEntry( projectDOM, "general/primarylanguage" ); + TQStringList keywords = DomUtil::readListEntry( projectDOM, "general/keywords", "keyword" ); profileName = Settings::profileByAttributes( language, keywords ); } @@ -177,7 +177,7 @@ void ImportDialog::accept() ProfileEngine & engine = m_part->pluginController()->engine(); Profile * profile = engine.findProfile( profileName ); - QStringList disableList; + TQStringList disableList; Profile::EntryList disableEntryList = profile->list( Profile::ExplicitDisable ); for ( Profile::EntryList::const_iterator it = disableEntryList.constBegin(); it != disableEntryList.constEnd(); ++it ) { @@ -188,25 +188,25 @@ void ImportDialog::accept() // write the dom back - QFile dest(dir.filePath(projectName + ".kdevelop")); + TQFile dest(dir.filePath(projectName + ".kdevelop")); if (!dest.open(IO_WriteOnly)) { KMessageBox::sorry(this, i18n("Cannot write the project file.")); return; } - QTextStream ts( &dest ); - ts.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream ts( &dest ); + ts.setEncoding(TQTextStream::UnicodeUTF8); ts << projectDOM.toString(2); dest.close(); -// QTextStream srcstream(&src); -// QTextStream deststream(&dest); +// TQTextStream srcstream(&src); +// TQTextStream deststream(&dest); // // while (!srcstream.atEnd()) { -// QString line = srcstream.readLine(); -// line.replace(QRegExp("\\$APPNAMELC\\$"), projectName); -// line.replace(QRegExp("\\$AUTHOR\\$"), author); -// line.replace(QRegExp("\\$EMAIL\\$"), email); +// TQString line = srcstream.readLine(); +// line.replace(TQRegExp("\\$APPNAMELC\\$"), projectName); +// line.replace(TQRegExp("\\$AUTHOR\\$"), author); +// line.replace(TQRegExp("\\$EMAIL\\$"), email); // deststream << line << endl; // } // @@ -217,31 +217,31 @@ void ImportDialog::accept() kdDebug(9010) << "OPENING PROJECT: " << dir.filePath(projectName + ".kdevelop") << endl; - QDialog::accept(); + TQDialog::accept(); } // Checks if the directory dir and all of its subdirectories // (one level recursion) have files that follow patterns // patterns is comma-separated -static bool dirHasFiles(QDir &dir, const QString &patterns) +static bool dirHasFiles(TQDir &dir, const TQString &patterns) { - QStringList::ConstIterator pit, sit; + TQStringList::ConstIterator pit, sit; - QStringList patternList = QStringList::split(",", patterns); + TQStringList patternList = TQStringList::split(",", patterns); for (pit = patternList.begin(); pit != patternList.end(); ++pit) { - if (!dir.entryList(*pit, QDir::Files).isEmpty()) { + if (!dir.entryList(*pit, TQDir::Files).isEmpty()) { kdDebug(9010) << "Has files " << (*pit) << endl; return true; } } - QStringList subdirList = dir.entryList("*", QDir::Dirs); + TQStringList subdirList = dir.entryList("*", TQDir::Dirs); for (sit = subdirList.begin(); sit != subdirList.end(); ++sit) { - QDir subdir(dir); + TQDir subdir(dir); subdir.cd(*sit); for (pit = patternList.begin(); pit != patternList.end(); ++pit) { - if (!subdir.entryList(*pit, QDir::Files).isEmpty()) { + if (!subdir.entryList(*pit, TQDir::Files).isEmpty()) { kdDebug(9010) << "Has files " << (*pit) << " in " << (*sit) << endl; return true; } @@ -255,12 +255,12 @@ static bool dirHasFiles(QDir &dir, const QString &patterns) void ImportDialog::dirChanged() { kdDebug(9010) << "ImportDialog::dirChanged" << endl; - QString dirName = urlinput_edit->url(); - QDir dir(dirName); + TQString dirName = urlinput_edit->url(); + TQDir dir(dirName); if (!dir.exists()) return; - if ( dirName.contains( QRegExp("\\s") ) ) + if ( dirName.contains( TQRegExp("\\s") ) ) { ok_button->setEnabled( false ); return; @@ -270,7 +270,7 @@ void ImportDialog::dirChanged() } // KDevelop legacy project? - QStringList files = dir.entryList("*.kdevprj"); + TQStringList files = dir.entryList("*.kdevprj"); if (!files.isEmpty()) { scanLegacyKDevelopProject(dir.absFilePath(files.first())); return; @@ -290,7 +290,7 @@ void ImportDialog::dirChanged() } // Remove any characters from the dirName that would be invalid in a project name - QString projectName(dir.dirName().replace(QRegExp("[^a-zA-Z0-9_]"), "_")); + TQString projectName(dir.dirName().replace(TQRegExp("[^a-zA-Z0-9_]"), "_")); // Set the project name name_edit->setText(projectName); @@ -328,7 +328,7 @@ void ImportDialog::dirChanged() } -void ImportDialog::scanLegacyKDevelopProject(const QString &fileName) +void ImportDialog::scanLegacyKDevelopProject(const TQString &fileName) { kdDebug(9010) << "Scanning legacy KDevelop project file " << fileName << endl; @@ -338,8 +338,8 @@ void ImportDialog::scanLegacyKDevelopProject(const QString &fileName) email_edit->setText(config.readEntry("email")); name_edit->setText(config.readEntry("project_name")); - QString legacyType = config.readEntry("project_type"); - if (QStringList::split(",", "normal_kde,normal_kde2,kde2_normal,mdi_kde2").contains(legacyType)) + TQString legacyType = config.readEntry("project_type"); + if (TQStringList::split(",", "normal_kde,normal_kde2,kde2_normal,mdi_kde2").contains(legacyType)) setProjectType("kde"); else if (legacyType == "normal_gnome") setProjectType("gnome"); @@ -350,7 +350,7 @@ void ImportDialog::scanLegacyKDevelopProject(const QString &fileName) } -void ImportDialog::scanLegacyStudioProject(const QString &fileName) +void ImportDialog::scanLegacyStudioProject(const TQString &fileName) { kdDebug(9010) << "Scanning legacy studio project file " << fileName << endl; @@ -361,15 +361,15 @@ void ImportDialog::scanLegacyStudioProject(const QString &fileName) } -void ImportDialog::scanAutomakeProject(const QString &dirName) +void ImportDialog::scanAutomakeProject(const TQString &dirName) { kdDebug(9010) << "Scanning automake project directory " << dirName << endl; bool stop = false; - if (QFile::exists(dirName + "/admin/am_edit")) { + if (TQFile::exists(dirName + "/admin/am_edit")) { setProjectType("kde"); stop = true; - } else if (QFile::exists(dirName + "/macros/gnome.m4")) { + } else if (TQFile::exists(dirName + "/macros/gnome.m4")) { setProjectType("gnome"); stop = true; } else { @@ -377,13 +377,13 @@ void ImportDialog::scanAutomakeProject(const QString &dirName) } // if we get an authors file, use it. - QFile af(dirName + "/AUTHORS"); + TQFile af(dirName + "/AUTHORS"); if (af.open(IO_ReadOnly)){ - QTextStream astream(&af); + TQTextStream astream(&af); - QRegExp authorre("(.*)<(.*)>"); + TQRegExp authorre("(.*)<(.*)>"); while (!astream.atEnd()) { - QString s = astream.readLine(); + TQString s = astream.readLine(); if (authorre.search(s) != -1) { author_edit->setText(authorre.cap(1).stripWhiteSpace()); email_edit->setText(authorre.cap(2).stripWhiteSpace()); @@ -396,30 +396,30 @@ void ImportDialog::scanAutomakeProject(const QString &dirName) // we ignore old AC_INIT that had no version.. // only match the if there is a comma and at least two args.. // AC_INIT (package, version, [bug-report], [tarname]) - QRegExp ac_init("^AC_INIT\\s*\\(\\s*([^,]+),([^,\\)]+)(.*)"); + TQRegExp ac_init("^AC_INIT\\s*\\(\\s*([^,]+),([^,\\)]+)(.*)"); // AM_INIT_AUTOMAKE([OPTIONS]) // example: AM_INIT_AUTOMAKE([gnits 1.5 no-define dist-bzip2]) - QRegExp am_autoSpace("^AM_INIT_AUTOMAKE\\s{0,}\\(\\s{0,}([\\[\\s]{0,}[^\\s]+)\\s+([^\\s\\)\\]]+)(.*)"); + TQRegExp am_autoSpace("^AM_INIT_AUTOMAKE\\s{0,}\\(\\s{0,}([\\[\\s]{0,}[^\\s]+)\\s+([^\\s\\)\\]]+)(.*)"); // AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) - QRegExp am_autoComma("^AM_INIT_AUTOMAKE\\s*\\(\\s*([^,]+),([^,\\)]+)(.*)"); + TQRegExp am_autoComma("^AM_INIT_AUTOMAKE\\s*\\(\\s*([^,]+),([^,\\)]+)(.*)"); // look for version in a define. // AC_DEFINE(VERSION, "5.6") - QRegExp ac_define("^AC_DEFINE\\s*\\(\\s*[^,]+,([^\\)]+)"); - QRegExp version("(\\bversion\\b)"); + TQRegExp ac_define("^AC_DEFINE\\s*\\(\\s*[^,]+,([^\\)]+)"); + TQRegExp version("(\\bversion\\b)"); version.setCaseSensitive(FALSE); - QTextStream cstream; + TQTextStream cstream; // try for configure.in.in, configure.in, then configure.ac - QFile configInIn(dirName + "/configure.in.in"); - QFile configIn(dirName+"/configure.in"); - QFile configAc(dirName+"/configure.ac"); + TQFile configInIn(dirName + "/configure.in.in"); + TQFile configIn(dirName+"/configure.in"); + TQFile configAc(dirName+"/configure.ac"); if (configInIn.open(IO_ReadOnly)){ cstream.setDevice(&configInIn); while (!cstream.atEnd()) { - QString line = cstream.readLine(); + TQString line = cstream.readLine(); if ( ac_init.search(line) >= 0){ projectVersion=ac_init.cap(2).stripWhiteSpace(); } @@ -448,11 +448,11 @@ void ImportDialog::scanAutomakeProject(const QString &dirName) } } - QRegExp namere("\\s*AM_INIT_AUTOMAKE\\((.*),.*\\).*"); - QRegExp cppre("\\s*AC_PROG_CXX"); - QRegExp f77re("\\s*AC_PROG_F77"); + TQRegExp namere("\\s*AM_INIT_AUTOMAKE\\((.*),.*\\).*"); + TQRegExp cppre("\\s*AC_PROG_CXX"); + TQRegExp f77re("\\s*AC_PROG_F77"); while (!cstream.atEnd()) { - QString line = cstream.readLine(); + TQString line = cstream.readLine(); if ( ac_init.search(line) >= 0){ projectVersion=ac_init.cap(2).stripWhiteSpace(); } @@ -481,14 +481,14 @@ void ImportDialog::scanAutomakeProject(const QString &dirName) } -void ImportDialog::setProjectType(const QString &type) +void ImportDialog::setProjectType(const TQString &type) { kdDebug(9010) << "Setting project type " << type << endl; - QString suffix = "/" + type; + TQString suffix = "/" + type; int suffixLength = suffix.length(); int i=0; - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for (it = importNames.begin(); it != importNames.end(); ++it) { if ((*it).right(suffixLength) == suffix) { project_combo->setCurrentItem(i); @@ -512,7 +512,7 @@ void ImportDialog::scanAvailableVCS() } */ /* -void ImportDialog::slotFinishedCheckout( QString destinationDir ) +void ImportDialog::slotFinishedCheckout( TQString destinationDir ) { urlinput_edit->setURL( destinationDir ); @@ -531,8 +531,8 @@ void ImportDialog::slotFetchModulesFromRepository() setCursor( KCursor::waitCursor() ); // setEnabled( false ); - connect( vcs, SIGNAL(finishedFetching(QString)), - this, SLOT(slotFinishedCheckout(QString)) ); + connect( vcs, TQT_SIGNAL(finishedFetching(TQString)), + this, TQT_SLOT(slotFinishedCheckout(TQString)) ); //restore cursor if we can't fetch repository if ( !vcs->fetchFromRepository() ) @@ -540,7 +540,7 @@ void ImportDialog::slotFetchModulesFromRepository() } */ -void ImportDialog::projectTypeChanged( const QString &type ) +void ImportDialog::projectTypeChanged( const TQString &type ) { if (m_infrastructure[type].isOn) { @@ -561,14 +561,14 @@ void ImportDialog::createProjectInfrastructure( ) if (!cmd.isOn) return; - QDir dir (urlinput_edit->url()); - QStringList files = dir.entryList(cmd.existingPattern); + TQDir dir (urlinput_edit->url()); + TQStringList files = dir.entryList(cmd.existingPattern); if (!files.isEmpty()) { - if (KMessageBox::questionYesNo(this, i18n("Project infrastrucure already exists in target directory.\nGenerate new project infrastructure and overwrite old?"), QString::null, i18n("Generate"), i18n("Do Not Generate")) == KMessageBox::No) + if (KMessageBox::questionYesNo(this, i18n("Project infrastrucure already exists in target directory.\nGenerate new project infrastructure and overwrite old?"), TQString::null, i18n("Generate"), i18n("Do Not Generate")) == KMessageBox::No) return; } - QString command = "cd " + urlinput_edit->url() + " && " + cmd.command; + TQString command = "cd " + urlinput_edit->url() + " && " + cmd.command; kdDebug(9010) << "executing " << command.ascii() << endl; system(command.ascii()); } |