diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:22:56 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:22:56 +0000 |
commit | 7346aee26bf190a7e70333c40fab4caca847cd27 (patch) | |
tree | 4b019b434f88dcc3eeaafe1d3f26240b4c4718e8 /kate/xmlcheck/plugin_katexmlcheck.cpp | |
parent | 23a3d3aa5b44cbdf305495919866d9dbf4f6da54 (diff) | |
download | tdeaddons-7346aee26bf190a7e70333c40fab4caca847cd27.tar.gz tdeaddons-7346aee26bf190a7e70333c40fab4caca847cd27.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1157634 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kate/xmlcheck/plugin_katexmlcheck.cpp')
-rw-r--r-- | kate/xmlcheck/plugin_katexmlcheck.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/kate/xmlcheck/plugin_katexmlcheck.cpp b/kate/xmlcheck/plugin_katexmlcheck.cpp index 120e04e..253c9d0 100644 --- a/kate/xmlcheck/plugin_katexmlcheck.cpp +++ b/kate/xmlcheck/plugin_katexmlcheck.cpp @@ -34,11 +34,11 @@ #include <cassert> #include <config.h> -#include <qfile.h> -#include <qinputdialog.h> -#include <qregexp.h> -#include <qstring.h> -#include <qtextstream.h> +#include <tqfile.h> +#include <tqinputdialog.h> +#include <tqregexp.h> +#include <tqstring.h> +#include <tqtextstream.h> #include <kaction.h> #include <kcursor.h> @@ -54,7 +54,7 @@ K_EXPORT_COMPONENT_FACTORY( katexmlcheckplugin, KGenericFactory<PluginKateXMLCheck>( "katexmlcheck" ) ) -PluginKateXMLCheck::PluginKateXMLCheck( QObject* parent, const char* name, const QStringList& ) +PluginKateXMLCheck::PluginKateXMLCheck( TQObject* parent, const char* name, const TQStringList& ) : Kate::Plugin ( (Kate::Application *)parent, name ) { } @@ -68,7 +68,7 @@ PluginKateXMLCheck::~PluginKateXMLCheck() void PluginKateXMLCheck::addView(Kate::MainWindow *win) { Kate::ToolViewManager *viewmanager = win->toolViewManager(); - QWidget *dock = viewmanager->createToolView("kate_plugin_xmlcheck_ouputview", Kate::ToolViewManager::Bottom, SmallIcon("misc"), i18n("XML Checker Output")); + TQWidget *dock = viewmanager->createToolView("kate_plugin_xmlcheck_ouputview", Kate::ToolViewManager::Bottom, SmallIcon("misc"), i18n("XML Checker Output")); PluginKateXMLCheckView *view = new PluginKateXMLCheckView (dock,win,"katexmlcheck_outputview"); view->dock = dock; @@ -94,22 +94,22 @@ void PluginKateXMLCheck::removeView(Kate::MainWindow *win) //--------------------------------- -PluginKateXMLCheckView::PluginKateXMLCheckView(QWidget *parent,Kate::MainWindow *mainwin,const char* name) - :QListView(parent,name),KXMLGUIClient(),win(mainwin) +PluginKateXMLCheckView::PluginKateXMLCheckView(TQWidget *parent,Kate::MainWindow *mainwin,const char* name) + :TQListView(parent,name),KXMLGUIClient(),win(mainwin) { m_tmp_file=0; m_proc=0; (void) new KAction ( i18n("Validate XML"), 0, this, - SLOT( slotValidate() ), actionCollection(), "xml_check" ); + TQT_SLOT( slotValidate() ), actionCollection(), "xml_check" ); // TODO?: //(void) new KAction ( i18n("Indent XML"), 0, this, - // SLOT( slotIndent() ), actionCollection(), "xml_indent" ); + // TQT_SLOT( slotIndent() ), actionCollection(), "xml_indent" ); setInstance(new KInstance("kate")); setXMLFile("plugins/katexmlcheck/ui.rc"); - setFocusPolicy(QWidget::NoFocus); + setFocusPolicy(TQWidget::NoFocus); addColumn(i18n("#"), -1); addColumn(i18n("Line"), -1); setColumnAlignment(1, AlignRight); @@ -117,8 +117,8 @@ PluginKateXMLCheckView::PluginKateXMLCheckView(QWidget *parent,Kate::MainWindow setColumnAlignment(2, AlignRight); addColumn(i18n("Message"), -1); setAllColumnsShowFocus(true); - setResizeMode(QListView::LastColumn); - connect(this, SIGNAL(clicked(QListViewItem *)), SLOT(slotClicked(QListViewItem *))); + setResizeMode(TQListView::LastColumn); + connect(this, TQT_SIGNAL(clicked(TQListViewItem *)), TQT_SLOT(slotClicked(TQListViewItem *))); /* TODO?: invalidate the listview when document has changed Kate::View *kv = application()->activeMainWindow()->viewManager()->activeView(); @@ -126,17 +126,17 @@ PluginKateXMLCheckView::PluginKateXMLCheckView(QWidget *parent,Kate::MainWindow kdDebug() << "Warning: no Kate::View" << endl; return; } - connect(kv, SIGNAL(modifiedChanged()), this, SLOT(slotUpdate())); + connect(kv, TQT_SIGNAL(modifiedChanged()), this, TQT_SLOT(slotUpdate())); */ m_proc_stderr = ""; m_proc = new KProcess(); - connect(m_proc, SIGNAL(processExited(KProcess*)), this, SLOT(slotProcExited(KProcess*))); + connect(m_proc, TQT_SIGNAL(processExited(KProcess*)), this, TQT_SLOT(slotProcExited(KProcess*))); // we currently only want errors: - //connect(m_proc, SIGNAL(receivedStdout(KProcess*,char*,int)), - // this, SLOT(receivedProcStdout(KProcess*, char*, int))); - connect(m_proc, SIGNAL(receivedStderr(KProcess*,char*,int)), - this, SLOT(slotReceivedProcStderr(KProcess*, char*, int))); + //connect(m_proc, TQT_SIGNAL(receivedStdout(KProcess*,char*,int)), + // this, TQT_SLOT(receivedProcStdout(KProcess*, char*, int))); + connect(m_proc, TQT_SIGNAL(receivedStderr(KProcess*,char*,int)), + this, TQT_SLOT(slotReceivedProcStderr(KProcess*, char*, int))); } @@ -152,7 +152,7 @@ PluginKateXMLCheckView::~PluginKateXMLCheckView() void PluginKateXMLCheckView::slotReceivedProcStderr(KProcess *, char *result, int len) { - m_proc_stderr += QString::fromLocal8Bit( QCString(result, len+1) ); + m_proc_stderr += TQString::fromLocal8Bit( TQCString(result, len+1) ); } @@ -165,29 +165,29 @@ void PluginKateXMLCheckView::slotProcExited(KProcess*) kdDebug() << "slotProcExited()" << endl; //kdDebug() << "output: " << endl << m_proc_stderr << endl << endl; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); m_tmp_file->unlink(); clear(); uint list_count = 0; uint err_count = 0; if( ! m_validating ) { // no i18n here, so we don't get an ugly English<->Non-english mixup: - QString msg; + TQString msg; if( m_dtdname.isEmpty() ) { msg = "No DOCTYPE found, will only check well-formedness."; } else { msg = "'" + m_dtdname + "' not found, will only check well-formedness."; } - (void)new QListViewItem(this, QString("1").rightJustify(4,' '), "", "", msg); + (void)new TQListViewItem(this, TQString("1").rightJustify(4,' '), "", "", msg); list_count++; } if( ! m_proc_stderr.isEmpty() ) { - QStringList lines = QStringList::split("\n", m_proc_stderr); - QListViewItem *item = 0; - QString linenumber, msg; + TQStringList lines = TQStringList::split("\n", m_proc_stderr); + TQListViewItem *item = 0; + TQString linenumber, msg; uint line_count = 0; - for(QStringList::Iterator it = lines.begin(); it != lines.end(); ++it) { - QString line = *it; + for(TQStringList::Iterator it = lines.begin(); it != lines.end(); ++it) { + TQString line = *it; line_count++; int semicolon_1 = line.find(':'); int semicolon_2 = line.find(':', semicolon_1+1); @@ -202,13 +202,13 @@ void PluginKateXMLCheckView::slotProcExited(KProcess*) if( line_count == lines.size() && caret_pos == -1 ) { msg = msg+"\n"+line; } - QString col = QString::number(caret_pos); + TQString col = TQString::number(caret_pos); if( col == "-1" ) { col = ""; } err_count++; list_count++; - item = new QListViewItem(this, QString::number(list_count).rightJustify(4,' '), linenumber, col, msg); + item = new TQListViewItem(this, TQString::number(list_count).rightJustify(4,' '), linenumber, col, msg); item->setMultiLinesEnabled(true); } else { msg = msg+"\n"+line; @@ -217,18 +217,18 @@ void PluginKateXMLCheckView::slotProcExited(KProcess*) sort(); // TODO?: insert in right order } if( err_count == 0 ) { - QString msg; + TQString msg; if( m_validating ) { msg = "No errors found, document is valid."; // no i18n here } else { msg = "No errors found, document is well-formed."; // no i18n here } - (void)new QListViewItem(this, QString::number(list_count+1).rightJustify(4,' '), "", "", msg); + (void)new TQListViewItem(this, TQString::number(list_count+1).rightJustify(4,' '), "", "", msg); } } -void PluginKateXMLCheckView::slotClicked(QListViewItem *item) +void PluginKateXMLCheckView::slotClicked(TQListViewItem *item) { kdDebug() << "slotClicked" << endl; if( item ) { @@ -285,14 +285,14 @@ bool PluginKateXMLCheckView::slotValidate() m_tmp_file=0L; return false; } - QTextStream *s = m_tmp_file->textStream(); + TQTextStream *s = m_tmp_file->textStream(); *s << kv->getDoc()->text(); bool removed = m_tmp_file->close(); if( ! removed ) { kdDebug() << "Warning (slotValidate()): temp file '" << m_tmp_file->name() << "' not deleted: " << m_tmp_file->status() << endl; } - QString exe = KStandardDirs::findExe("xmllint"); + TQString exe = KStandardDirs::findExe("xmllint"); if( exe.isEmpty() ) { exe = locate("exe", "xmllint"); } @@ -300,29 +300,29 @@ bool PluginKateXMLCheckView::slotValidate() // use catalogs for KDE docbook: if( ! getenv("SGML_CATALOG_FILES") ) { KInstance ins("katexmlcheckplugin"); - QString catalogs; + TQString catalogs; catalogs += ins.dirs()->findResource("data", "ksgmltools2/customization/catalog"); catalogs += ":"; catalogs += ins.dirs()->findResource("data", "ksgmltools2/docbook/xml-dtd-4.1.2/docbook.cat"); kdDebug() << "catalogs: " << catalogs << endl; - setenv("SGML_CATALOG_FILES", QFile::encodeName( catalogs ).data(), 1); + setenv("SGML_CATALOG_FILES", TQFile::encodeName( catalogs ).data(), 1); } //kdDebug() << "**catalogs: " << getenv("SGML_CATALOG_FILES") << endl; *m_proc << exe << "--catalogs" << "--noout"; // heuristic: assume that the doctype is in the first 10,000 bytes: - QString text_start = kv->getDoc()->text().left(10000); + TQString text_start = kv->getDoc()->text().left(10000); // remove comments before looking for doctype (as a doctype might be commented out // and needs to be ignored then): - QRegExp re("<!--.*-->"); + TQRegExp re("<!--.*-->"); re.setMinimal(true); text_start.replace(re, ""); - QRegExp re_doctype("<!DOCTYPE\\s+(.*)\\s+(?:PUBLIC\\s+[\"'].*[\"']\\s+[\"'](.*)[\"']|SYSTEM\\s+[\"'](.*)[\"'])", false); + TQRegExp re_doctype("<!DOCTYPE\\s+(.*)\\s+(?:PUBLIC\\s+[\"'].*[\"']\\s+[\"'](.*)[\"']|SYSTEM\\s+[\"'](.*)[\"'])", false); re_doctype.setMinimal(true); if( re_doctype.search(text_start) != -1 ) { - QString dtdname; + TQString dtdname; if( ! re_doctype.cap(2).isEmpty() ) { dtdname = re_doctype.cap(2); } else { @@ -348,6 +348,6 @@ bool PluginKateXMLCheckView::slotValidate() "sure that xmllint is installed. It is part of libxml2.")); return false; } - QApplication::setOverrideCursor(KCursor::waitCursor()); + TQApplication::setOverrideCursor(KCursor::waitCursor()); return true; } |