diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
commit | dc6b8e72fed2586239e3514819238c520636c9d9 (patch) | |
tree | 88b200df0a0b7fab9d6f147596173556f1ed9a13 /quanta/treeviews/scripttreeview.cpp | |
parent | 6927d4436e54551917f600b706a8d6109e49de1c (diff) | |
download | tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/treeviews/scripttreeview.cpp')
-rw-r--r-- | quanta/treeviews/scripttreeview.cpp | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/quanta/treeviews/scripttreeview.cpp b/quanta/treeviews/scripttreeview.cpp index 191be51c..896ed243 100644 --- a/quanta/treeviews/scripttreeview.cpp +++ b/quanta/treeviews/scripttreeview.cpp @@ -28,15 +28,15 @@ #include <kdebug.h> //qt includes -#include <qdir.h> -#include <qdom.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qlabel.h> -#include <qlineedit.h> -#include <qregexp.h> -#include <qstringlist.h> -#include <qtextedit.h> +#include <tqdir.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqlabel.h> +#include <tqlineedit.h> +#include <tqregexp.h> +#include <tqstringlist.h> +#include <tqtextedit.h> //other includes #include <libxml/xmlmemory.h> @@ -59,7 +59,7 @@ extern int xmlLoadExtDtdDefaultValue; -ScriptTreeView::ScriptTreeView(QWidget *parent, const char *name ) +ScriptTreeView::ScriptTreeView(TQWidget *parent, const char *name ) : BaseTreeView(parent,name) { setSaveOpenFolder(true); @@ -80,28 +80,28 @@ ScriptTreeView::ScriptTreeView(QWidget *parent, const char *name ) addBranch(m_localDir); // here you define which files should not be visible for the users - const QString excludeString = ".*\\.info$|.*\\.css$|.*\\.xsl$"; + const TQString excludeString = ".*\\.info$|.*\\.css$|.*\\.xsl$"; m_globalDir->excludeFilterRx.setPattern(excludeString); m_localDir->excludeFilterRx.setPattern(excludeString); m_fileMenu = new KPopupMenu(this); - m_fileMenu->insertItem(SmallIcon("info"), i18n("&Description"), this, SLOT(slotProperties())); - m_fileMenu->insertItem(SmallIcon("run"), i18n("&Run Script"), this, SLOT(slotRun())); + m_fileMenu->insertItem(SmallIcon("info"), i18n("&Description"), this, TQT_SLOT(slotProperties())); + m_fileMenu->insertItem(SmallIcon("run"), i18n("&Run Script"), this, TQT_SLOT(slotRun())); m_fileMenu->insertSeparator(); - m_fileMenu->insertItem(i18n("&Edit Script"), this, SLOT(slotEditScript())); - m_fileMenu->insertItem(i18n("Edit in &Quanta"), this, SLOT(slotEditInQuanta())); - m_fileMenu->insertItem(i18n("Edi&t Description"), this, SLOT(slotEditDescription())); + m_fileMenu->insertItem(i18n("&Edit Script"), this, TQT_SLOT(slotEditScript())); + m_fileMenu->insertItem(i18n("Edit in &Quanta"), this, TQT_SLOT(slotEditInQuanta())); + m_fileMenu->insertItem(i18n("Edi&t Description"), this, TQT_SLOT(slotEditDescription())); m_fileMenu->insertSeparator(); - m_fileMenu->insertItem(UserIcon("ball"), i18n("&Assign Action"), this, SLOT(slotAssignAction())); - m_fileMenu->insertItem(SmallIcon("mail_send"), i18n("&Send in Email..."), this, SLOT(slotSendScriptInMail())); - m_fileMenu->insertItem(SmallIcon("network"), i18n("&Upload Script..."), this, SLOT(slotUploadScript())); + m_fileMenu->insertItem(UserIcon("ball"), i18n("&Assign Action"), this, TQT_SLOT(slotAssignAction())); + m_fileMenu->insertItem(SmallIcon("mail_send"), i18n("&Send in Email..."), this, TQT_SLOT(slotSendScriptInMail())); + m_fileMenu->insertItem(SmallIcon("network"), i18n("&Upload Script..."), this, TQT_SLOT(slotUploadScript())); m_folderMenu = new KPopupMenu(this); - m_downloadMenuId = m_folderMenu->insertItem(SmallIcon("network"), i18n("&Download Script..."), this, SIGNAL(downloadScript())); + m_downloadMenuId = m_folderMenu->insertItem(SmallIcon("network"), i18n("&Download Script..."), this, TQT_SIGNAL(downloadScript())); - connect(this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), - this, SLOT(slotMenu(KListView*, QListViewItem*, const QPoint&))); + connect(this, TQT_SIGNAL(contextMenu(KListView*, TQListViewItem*, const TQPoint&)), + this, TQT_SLOT(slotMenu(KListView*, TQListViewItem*, const TQPoint&))); restoreLayout( kapp->config(), className() ); // the restored size of the first column might be too large for the current content @@ -113,7 +113,7 @@ ScriptTreeView::~ScriptTreeView() { } -void ScriptTreeView::slotMenu(KListView *, QListViewItem *item, const QPoint &point) +void ScriptTreeView::slotMenu(KListView *, TQListViewItem *item, const TQPoint &point) { if (!item) { @@ -140,7 +140,7 @@ void ScriptTreeView::slotMenu(KListView *, QListViewItem *item, const QPoint &po } } -void ScriptTreeView::slotSelectFile(QListViewItem *item) +void ScriptTreeView::slotSelectFile(TQListViewItem *item) { if (item) { if ( !currentKFileTreeViewItem()->isDir() ) @@ -168,7 +168,7 @@ void ScriptTreeView::slotEditScript() emit showPreviewWidget(false); KURL urlToOpen = currentURL(); KURL infoUrl = infoFile(urlToOpen); - QString editApp = infoOptionValue(infoUrl, "editor"); + TQString editApp = infoOptionValue(infoUrl, "editor"); if (editApp.isEmpty()) emit openFile(urlToOpen); else @@ -187,7 +187,7 @@ void ScriptTreeView::slotRun() { KURL urlToOpen = currentURL(); KURL infoUrl = infoFile(urlToOpen); - QString execApp = infoOptionValue(infoUrl, "interpreter"); + TQString execApp = infoOptionValue(infoUrl, "interpreter"); if (execApp.isEmpty()) { KURL::List list; @@ -197,7 +197,7 @@ void ScriptTreeView::slotRun() else { KProcess *proc = new KProcess(); - QStringList argsList = QStringList::split(' ', execApp); + TQStringList argsList = TQStringList::split(' ', execApp); *proc << argsList; *proc << urlToOpen.path(); proc->start(KProcess::DontCare); @@ -222,7 +222,7 @@ void ScriptTreeView::slotAssignAction() { KURL url = currentURL(); KURL infoURL = infoFile(url); - QString execApp = infoOptionValue(infoURL, "interpreter"); + TQString execApp = infoOptionValue(infoURL, "interpreter"); if (execApp.isEmpty()) execApp = "sh"; url.setPath(url.path().replace(locateLocal("data", resourceDir + "scripts/"), "%scriptdir/")); @@ -231,7 +231,7 @@ void ScriptTreeView::slotAssignAction() } } -QString ScriptTreeView::createScriptTarball() +TQString ScriptTreeView::createScriptTarball() { KURL url = currentURL(); KURL infoURL = infoFile(url); @@ -239,7 +239,7 @@ QString ScriptTreeView::createScriptTarball() KTempDir* tempDir = new KTempDir(tmpDir); tempDir->setAutoDelete(true); tempDirList.append(tempDir); - QString tempFileName=tempDir->name() + url.fileName() + ".tgz"; + TQString tempFileName=tempDir->name() + url.fileName() + ".tgz"; //pack the .tag files and the description.rc into a .tgz file KTar tar(tempFileName, "application/x-gzip"); @@ -251,9 +251,9 @@ QString ScriptTreeView::createScriptTarball() files.append(KURL().fromPathOrURL(qConfig.globalDataDir + resourceDir + "scripts/info.xsl")); for ( KURL::List::Iterator it_f = files.begin(); it_f != files.end(); ++it_f ) { - QFile file((*it_f).path()); + TQFile file((*it_f).path()); file.open(IO_ReadOnly); - QByteArray bArray = file.readAll(); + TQByteArray bArray = file.readAll(); tar.writeFile((*it_f).fileName(), "user", "group", bArray.size(), bArray.data()); file.close(); } @@ -267,19 +267,19 @@ void ScriptTreeView::slotSendScriptInMail() if ( !currentKFileTreeViewItem()->isDir() ) { - QStringList attachmentFile; + TQStringList attachmentFile; attachmentFile += createScriptTarball(); TagMailDlg *mailDlg = new TagMailDlg( this, i18n("Send script in email")); - QString toStr; - QString message = i18n("Hi,\n This is a Quanta Plus [http://quanta.kdewebdev.org] script tarball.\n\nHave fun.\n"); - QString titleStr; - QString subjectStr; + TQString toStr; + TQString message = i18n("Hi,\n This is a Quanta Plus [http://quanta.kdewebdev.org] script tarball.\n\nHave fun.\n"); + TQString titleStr; + TQString subjectStr; mailDlg->TitleLabel->setText(i18n("Content:")); /* mailDlg->titleEdit->setFixedHeight(60); - mailDlg->titleEdit->setVScrollBarMode(QTextEdit::Auto); - mailDlg->titleEdit->setHScrollBarMode(QTextEdit::Auto);*/ + mailDlg->titleEdit->setVScrollBarMode(TQTextEdit::Auto); + mailDlg->titleEdit->setHScrollBarMode(TQTextEdit::Auto);*/ if ( mailDlg->exec() ) { if ( !mailDlg->lineEmail->text().isEmpty()) @@ -294,7 +294,7 @@ void ScriptTreeView::slotSendScriptInMail() delete mailDlg; return; } - kapp->invokeMailer(toStr, QString::null, QString::null, subjectStr, message, QString::null, attachmentFile); + kapp->invokeMailer(toStr, TQString::null, TQString::null, subjectStr, message, TQString::null, attachmentFile); } delete mailDlg; @@ -305,7 +305,7 @@ void ScriptTreeView::slotUploadScript() { if ( !currentKFileTreeViewItem()->isDir() ) { - QString fileName = createScriptTarball(); + TQString fileName = createScriptTarball(); emit uploadScript(fileName); } } @@ -313,17 +313,17 @@ void ScriptTreeView::slotUploadScript() KURL ScriptTreeView::infoFile(const KURL& url, bool htmlVersion) { KURL returnUrl = url; - QString fileName = returnUrl.fileName(); - //fileName.truncate(fileName.length() - QFileInfo(fileName).extension().length() - 1); + TQString fileName = returnUrl.fileName(); + //fileName.truncate(fileName.length() - TQFileInfo(fileName).extension().length() - 1); fileName.append(".info"); returnUrl.setFileName(fileName); - if (!QFileInfo(returnUrl.path()).exists()) + if (!TQFileInfo(returnUrl.path()).exists()) { - QFile f(returnUrl.path()); + TQFile f(returnUrl.path()); if (f.open(IO_WriteOnly)) { - QTextStream str(&f); - str.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream str(&f); + str.setEncoding(TQTextStream::UnicodeUTF8); str << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl; str << "<?xml-stylesheet type=\"text/xsl\" href=\"info.xsl\" ?>" << endl; str << "<!DOCTYPE QuantaScriptInfo>" << endl; @@ -344,13 +344,13 @@ KURL ScriptTreeView::infoFile(const KURL& url, bool htmlVersion) if (htmlVersion) { KTempFile *tempInfoFile = 0L; - if (!QFileInfo(returnUrl.path()).exists()) + if (!TQFileInfo(returnUrl.path()).exists()) { tempInfoFile = new KTempFile(tmpDir); tempInfoFile->setAutoDelete(true); returnUrl = KURL::fromPathOrURL(tempInfoFile->name()); - QTextStream str(tempInfoFile->file()); - str.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream str(tempInfoFile->file()); + str.setEncoding(TQTextStream::UnicodeUTF8); str << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl; str << "<?xml-stylesheet type=\"text/xsl\" href=\"info.xsl\" ?>" << endl; str << "<!DOCTYPE QuantaScriptInfo>" << endl; @@ -374,7 +374,7 @@ KURL ScriptTreeView::infoFile(const KURL& url, bool htmlVersion) xmlDocPtr doc, res; xmlSubstituteEntitiesDefault(1); xmlLoadExtDtdDefaultValue = 1; - QString xslFile = qConfig.globalDataDir + resourceDir + "scripts/info.xsl"; + TQString xslFile = qConfig.globalDataDir + resourceDir + "scripts/info.xsl"; cur = xsltParseStylesheetFile(xmlCharStrndup(xslFile.utf8(), xslFile.utf8().length())); doc = xmlParseFile(returnUrl.path().utf8()); res = xsltApplyStylesheet(cur, doc, 0); @@ -394,19 +394,19 @@ KURL ScriptTreeView::infoFile(const KURL& url, bool htmlVersion) return returnUrl; } -QString ScriptTreeView::infoOptionValue(const KURL& infoURL, const QString& optionName) +TQString ScriptTreeView::infoOptionValue(const KURL& infoURL, const TQString& optionName) { - QString value; - QFile f(infoURL.path()); + TQString value; + TQFile f(infoURL.path()); if (f.open(IO_ReadOnly)) { - QDomDocument doc; + TQDomDocument doc; doc.setContent(&f); f.close(); - QDomNodeList nodes = doc.elementsByTagName("options"); + TQDomNodeList nodes = doc.elementsByTagName("options"); if (nodes.count() > 0) { - QDomElement el = nodes.item(0).toElement(); + TQDomElement el = nodes.item(0).toElement(); value = el.attribute(optionName); } } |