summaryrefslogtreecommitdiffstats
path: root/quanta/components/csseditor/cssselector.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:54:04 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:54:04 +0000
commitdc6b8e72fed2586239e3514819238c520636c9d9 (patch)
tree88b200df0a0b7fab9d6f147596173556f1ed9a13 /quanta/components/csseditor/cssselector.cpp
parent6927d4436e54551917f600b706a8d6109e49de1c (diff)
downloadtdewebdev-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/components/csseditor/cssselector.cpp')
-rw-r--r--quanta/components/csseditor/cssselector.cpp190
1 files changed, 95 insertions, 95 deletions
diff --git a/quanta/components/csseditor/cssselector.cpp b/quanta/components/csseditor/cssselector.cpp
index 1425102f..73460c05 100644
--- a/quanta/components/csseditor/cssselector.cpp
+++ b/quanta/components/csseditor/cssselector.cpp
@@ -18,16 +18,16 @@
#include "cssselector.h"
#include "csseditor.h"
-#include <qlineedit.h>
-#include <qcombobox.h>
-#include <qpushbutton.h>
-#include <qtextstream.h>
-#include <qtabwidget.h>
-#include <qobjectlist.h>
-#include <qfileinfo.h>
-#include <qlabel.h>
-#include <qregexp.h>
-#include <qwhatsthis.h>
+#include <tqlineedit.h>
+#include <tqcombobox.h>
+#include <tqpushbutton.h>
+#include <tqtextstream.h>
+#include <tqtabwidget.h>
+#include <tqobjectlist.h>
+#include <tqfileinfo.h>
+#include <tqlabel.h>
+#include <tqregexp.h>
+#include <tqwhatsthis.h>
#include <kstandarddirs.h>
#include <klocale.h>
@@ -39,7 +39,7 @@
#include "stylesheetparser.h"
-CSSSelector::CSSSelector(QWidget *parent, const char* name) : CSSSelectorS (parent,name),m_orderNumber(0),m_stopProcessingStylesheet(false) {
+CSSSelector::CSSSelector(TQWidget *parent, const char* name) : CSSSelectorS (parent,name),m_orderNumber(0),m_stopProcessingStylesheet(false) {
m_currentItem = 0L;
@@ -47,15 +47,15 @@ CSSSelector::CSSSelector(QWidget *parent, const char* name) : CSSSelectorS (pare
kurApplyToFile->fileDialog()->setURL(Project::ref()->projectBaseURL().url());
kurApplyToFile->fileDialog()->setFilter( "*.html *.htm |" + i18n("HTML Files") +" (*.html *.htm)\n*.xhtml |" + i18n("XHTML Files")+" (*.xhtml)\n*.xml |" + i18n("XML Files")+" (*.xml)\n*.*|" + i18n("All Files")+" (*.*)" );
- QWhatsThis::add((QLineEdit*)(kurApplyToFile->lineEdit()),"With this line edit you can insert the URL of the file you want to use to preview the style sheet you are editing");
+ TQWhatsThis::add((TQLineEdit*)(kurApplyToFile->lineEdit()),"With this line edit you can insert the URL of the file you want to use to preview the style sheet you are editing");
- /*QString configDir = locate("appdata", "csseditor/config.xml");
- configDir = QFileInfo(configDir).dirPath() + "/";*/
+ /*TQString configDir = locate("appdata", "csseditor/config.xml");
+ configDir = TQFileInfo(configDir).dirPath() + "/";*/
- QString configDir = QFileInfo( locate("appdata", "csseditor/config.xml") ).dirPath() + "/";
+ TQString configDir = TQFileInfo( locate("appdata", "csseditor/config.xml") ).dirPath() + "/";
- QDomDocument doc;
- QFile file( configDir+"pseudo.xml" );
+ TQDomDocument doc;
+ TQFile file( configDir+"pseudo.xml" );
if ( !file.open( IO_ReadOnly ) )
return;
if ( !doc.setContent( &file ) ) {
@@ -64,11 +64,11 @@ CSSSelector::CSSSelector(QWidget *parent, const char* name) : CSSSelectorS (pare
}
file.close();
- QDomElement docElem = doc.documentElement();
+ TQDomElement docElem = doc.documentElement();
- QDomNode n = docElem.firstChild();
+ TQDomNode n = docElem.firstChild();
while( !n.isNull() ) {
- QDomElement e = n.toElement();
+ TQDomElement e = n.toElement();
if( !e.isNull() ) {
cbPseudo->insertItem(e.attribute("name"));
}
@@ -84,17 +84,17 @@ CSSSelector::CSSSelector(QWidget *parent, const char* name) : CSSSelectorS (pare
}
file.close();
- QStringList dtdNames,
+ TQStringList dtdNames,
dtdNickNames;
docElem = doc.documentElement();
n = docElem.firstChild();
while( !n.isNull() ) {
- QDomElement e = n.toElement();
+ TQDomElement e = n.toElement();
if( !e.isNull() ) {
dtdNames.append(e.attribute("name"));
dtdNickNames.append(e.attribute("nickName"));
if(e.attribute("default") == "yes") {
- QStringList tagList = QStringList::split( ',',e.text() );
+ TQStringList tagList = TQStringList::split( ',',e.text() );
tagList.sort();
cbTag->insertStringList( tagList );
cbTag->setAutoCompletion(true);
@@ -110,43 +110,43 @@ CSSSelector::~CSSSelector(){
void CSSSelector::Connect(){
- connect(cbDTD,SIGNAL(activated(const QString&)),this,SLOT(setDTDTags(const QString&)));
+ connect(cbDTD,TQT_SIGNAL(activated(const TQString&)),this,TQT_SLOT(setDTDTags(const TQString&)));
- connect(pbAddTag,SIGNAL(clicked()), this ,SLOT(addTag()));
- connect(pbAddClass,SIGNAL(clicked()), this ,SLOT(addClass()));
- connect(pbAddID,SIGNAL(clicked()), this ,SLOT(addID()));
- connect(pbAddPseudo,SIGNAL(clicked()), this ,SLOT(addPseudo()));
+ connect(pbAddTag,TQT_SIGNAL(clicked()), this ,TQT_SLOT(addTag()));
+ connect(pbAddClass,TQT_SIGNAL(clicked()), this ,TQT_SLOT(addClass()));
+ connect(pbAddID,TQT_SIGNAL(clicked()), this ,TQT_SLOT(addID()));
+ connect(pbAddPseudo,TQT_SIGNAL(clicked()), this ,TQT_SLOT(addPseudo()));
- connect(lvTags, SIGNAL(doubleClicked( QListViewItem * )), this, SLOT(openCSSEditor(QListViewItem *)));
- connect(lvClasses, SIGNAL(doubleClicked( QListViewItem * )), this, SLOT(openCSSEditor(QListViewItem *)));
- connect(lvIDs, SIGNAL(doubleClicked( QListViewItem * )), this, SLOT(openCSSEditor(QListViewItem *)));
- connect(lvPseudo, SIGNAL(doubleClicked( QListViewItem * )), this, SLOT(openCSSEditor(QListViewItem *)));
+ connect(lvTags, TQT_SIGNAL(doubleClicked( TQListViewItem * )), this, TQT_SLOT(openCSSEditor(TQListViewItem *)));
+ connect(lvClasses, TQT_SIGNAL(doubleClicked( TQListViewItem * )), this, TQT_SLOT(openCSSEditor(TQListViewItem *)));
+ connect(lvIDs, TQT_SIGNAL(doubleClicked( TQListViewItem * )), this, TQT_SLOT(openCSSEditor(TQListViewItem *)));
+ connect(lvPseudo, TQT_SIGNAL(doubleClicked( TQListViewItem * )), this, TQT_SLOT(openCSSEditor(TQListViewItem *)));
- connect(lvTags, SIGNAL(selectionChanged( QListViewItem * )), this, SLOT(setCurrentItem(QListViewItem *)));
- connect(lvClasses, SIGNAL(selectionChanged( QListViewItem * )), this, SLOT(setCurrentItem(QListViewItem *)));
- connect(lvIDs, SIGNAL(selectionChanged( QListViewItem * )), this, SLOT(setCurrentItem(QListViewItem *)));
- connect(lvPseudo, SIGNAL( selectionChanged( QListViewItem * )), this, SLOT(setCurrentItem(QListViewItem *)));
+ connect(lvTags, TQT_SIGNAL(selectionChanged( TQListViewItem * )), this, TQT_SLOT(setCurrentItem(TQListViewItem *)));
+ connect(lvClasses, TQT_SIGNAL(selectionChanged( TQListViewItem * )), this, TQT_SLOT(setCurrentItem(TQListViewItem *)));
+ connect(lvIDs, TQT_SIGNAL(selectionChanged( TQListViewItem * )), this, TQT_SLOT(setCurrentItem(TQListViewItem *)));
+ connect(lvPseudo, TQT_SIGNAL( selectionChanged( TQListViewItem * )), this, TQT_SLOT(setCurrentItem(TQListViewItem *)));
- connect(pbRemoveSelectedTag,SIGNAL(clicked()), this ,SLOT(removeSelected()));
- connect(pbRemoveSelectedClass,SIGNAL(clicked()), this ,SLOT(removeSelected()));
- connect(pbRemoveSelectedID,SIGNAL(clicked()), this ,SLOT(removeSelected()));
- connect(pbRemoveSelectedPseudo,SIGNAL(clicked()), this ,SLOT(removeSelected()));
+ connect(pbRemoveSelectedTag,TQT_SIGNAL(clicked()), this ,TQT_SLOT(removeSelected()));
+ connect(pbRemoveSelectedClass,TQT_SIGNAL(clicked()), this ,TQT_SLOT(removeSelected()));
+ connect(pbRemoveSelectedID,TQT_SIGNAL(clicked()), this ,TQT_SLOT(removeSelected()));
+ connect(pbRemoveSelectedPseudo,TQT_SIGNAL(clicked()), this ,TQT_SLOT(removeSelected()));
- connect(twSelectors,SIGNAL(currentChanged ( QWidget * )), this ,SLOT(setCurrentListView( QWidget * )));
+ connect(twSelectors,TQT_SIGNAL(currentChanged ( TQWidget * )), this ,TQT_SLOT(setCurrentListView( TQWidget * )));
- connect(pbRemoveAllTags,SIGNAL(clicked()), this ,SLOT(removeAll()));
- connect(pbRemoveAllClasses,SIGNAL(clicked()), this ,SLOT(removeAll()));
- connect(pbRemoveAllIDs,SIGNAL(clicked()), this ,SLOT(removeAll()));
- connect(pbRemoveAllPseudo,SIGNAL(clicked()), this ,SLOT(removeAll()));
+ connect(pbRemoveAllTags,TQT_SIGNAL(clicked()), this ,TQT_SLOT(removeAll()));
+ connect(pbRemoveAllClasses,TQT_SIGNAL(clicked()), this ,TQT_SLOT(removeAll()));
+ connect(pbRemoveAllIDs,TQT_SIGNAL(clicked()), this ,TQT_SLOT(removeAll()));
+ connect(pbRemoveAllPseudo,TQT_SIGNAL(clicked()), this ,TQT_SLOT(removeAll()));
}
-void CSSSelector::setDTDTags(const QString& s){
+void CSSSelector::setDTDTags(const TQString& s){
- QString configDir = QFileInfo( locate("appdata", "csseditor/config.xml") ).dirPath() + "/";
+ TQString configDir = TQFileInfo( locate("appdata", "csseditor/config.xml") ).dirPath() + "/";
- QDomDocument doc;
+ TQDomDocument doc;
- QFile file( configDir+"dtdTags.xml" );
+ TQFile file( configDir+"dtdTags.xml" );
if ( !file.open( IO_ReadOnly ) )
return;
if ( !doc.setContent( &file ) ) {
@@ -155,15 +155,15 @@ void CSSSelector::setDTDTags(const QString& s){
}
file.close();
- QStringList dtdNames;
- QDomElement docElem = doc.documentElement();
- QDomNode n = docElem.firstChild();
+ TQStringList dtdNames;
+ TQDomElement docElem = doc.documentElement();
+ TQDomNode n = docElem.firstChild();
while( !n.isNull() ) {
if( n.toElement().attribute("nickName") == s )
break;
n = n.nextSibling();
}
- QStringList tagList = QStringList::split( ',',n.toElement().text() );
+ TQStringList tagList = TQStringList::split( ',',n.toElement().text() );
tagList.sort();
cbTag->clear();
cbTag->insertStringList( tagList );
@@ -171,50 +171,50 @@ void CSSSelector::setDTDTags(const QString& s){
}
void CSSSelector::addTag(){
- QListViewItem *item = new QListViewItem(lvTags);
+ TQListViewItem *item = new TQListViewItem(lvTags);
if(!cbTag->currentText().isEmpty()){
item->setText(0,cbTag->currentText());
- QPair<QString, unsigned int> tmp(QString::null,++m_orderNumber);
+ QPair<TQString, unsigned int> tmp(TQString::null,++m_orderNumber);
m_currentStylesheetStructure[item->text(0)]=tmp;
}
}
void CSSSelector::addClass(){
- QListViewItem *item = new QListViewItem(lvClasses);
+ TQListViewItem *item = new TQListViewItem(lvClasses);
if(!leClass->text().isEmpty()){
item->setText(0,leClass->text());
- QPair<QString, unsigned int> tmp(QString::null,++m_orderNumber);
+ QPair<TQString, unsigned int> tmp(TQString::null,++m_orderNumber);
m_currentStylesheetStructure[item->text(0)]=tmp;
}
}
void CSSSelector::addID(){
- QListViewItem *item = new QListViewItem(lvIDs);
+ TQListViewItem *item = new TQListViewItem(lvIDs);
if(!leID->text().isEmpty()){
item->setText(0,leID->text());
- QPair<QString, unsigned int> tmp(QString::null,++m_orderNumber);
+ QPair<TQString, unsigned int> tmp(TQString::null,++m_orderNumber);
m_currentStylesheetStructure[item->text(0)]=tmp;
}
}
void CSSSelector::addPseudo(){
- QListViewItem *item = new QListViewItem(lvPseudo);
+ TQListViewItem *item = new TQListViewItem(lvPseudo);
item->setText(0,(lePseudoSelector->text()+":"+cbPseudo->currentText()).stripWhiteSpace());
- QPair<QString, unsigned int> tmp(QString::null,++m_orderNumber);
+ QPair<TQString, unsigned int> tmp(TQString::null,++m_orderNumber);
m_currentStylesheetStructure[item->text(0)]=tmp;
}
-void CSSSelector::openCSSEditor(QListViewItem * i){
+void CSSSelector::openCSSEditor(TQListViewItem * i){
if(!m_stopProcessingStylesheet){
- QListView *lv = i->listView();
- QListViewItem *temp;
- QString s;
- QObjectList *l = queryList( "QListView" );
- QObjectListIt it( *l ); // iterate over the listviews
- QObject *obj;
+ TQListView *lv = i->listView();
+ TQListViewItem *temp;
+ TQString s;
+ TQObjectList *l = queryList( "TQListView" );
+ TQObjectListIt it( *l ); // iterate over the listviews
+ TQObject *obj;
while ( (obj = it.current()) != 0 ) {
- QListView *lvTemp = (QListView*)obj;
+ TQListView *lvTemp = (TQListView*)obj;
if( lv != lvTemp){
temp = lvTemp->firstChild();
while(temp){
@@ -246,8 +246,8 @@ void CSSSelector::openCSSEditor(QListViewItem * i){
else {
dlg.setFileToPreview(kurApplyToFile->url(),true);
- QString tmp;
- QListViewItem *item = lvTags->firstChild();
+ TQString tmp;
+ TQListViewItem *item = lvTags->firstChild();
while( item ) {
if(i->text(0).stripWhiteSpace() != item->text(0).stripWhiteSpace())
tmp += item->text(0) + " {" + item->text(1) + "}";
@@ -283,22 +283,22 @@ void CSSSelector::openCSSEditor(QListViewItem * i){
if(dlg.exec()) {
i->setText(1,dlg.generateProperties());
- QPair<QString, unsigned int> tmp(m_currentStylesheetStructure[i->text(0)]);
+ QPair<TQString, unsigned int> tmp(m_currentStylesheetStructure[i->text(0)]);
tmp.first = dlg.generateProperties();
m_currentStylesheetStructure[i->text(0)] = tmp;
}
}
}
-void CSSSelector::setCurrentListView(QWidget* w){
- QObjectList *l = w->queryList( "QListView" );
- m_currentListView = static_cast<QListView*>(l->first());
+void CSSSelector::setCurrentListView(TQWidget* w){
+ TQObjectList *l = w->queryList( "TQListView" );
+ m_currentListView = static_cast<TQListView*>(l->first());
}
void CSSSelector::removeAll(){
- QListViewItemIterator it( m_currentListView );
+ TQListViewItemIterator it( m_currentListView );
while ( it.current() ) {
- QListViewItem *item = it.current();
+ TQListViewItem *item = it.current();
m_currentStylesheetStructure.remove(item->text(0));
++it;
}
@@ -313,30 +313,30 @@ void CSSSelector::removeSelected(){
}
}
-void CSSSelector::loadCSSContent(const QString& s){
+void CSSSelector::loadCSSContent(const TQString& s){
stylesheetParser p(s);
- connect(&p,SIGNAL(errorOccurred(const QString&)), this, SLOT(setStylesheetProcessing(const QString&)));
+ connect(&p,TQT_SIGNAL(errorOccurred(const TQString&)), this, TQT_SLOT(setStylesheetProcessing(const TQString&)));
p.parse();
m_orderNumber = p.orderNumber();
- QMap<QString, QPair<QString,unsigned int> >::Iterator it;
+ TQMap<TQString, QPair<TQString,unsigned int> >::Iterator it;
m_currentStylesheetStructure = p.stylesheetStructure();
for ( it = m_currentStylesheetStructure.begin(); it != m_currentStylesheetStructure.end(); ++it ) {
if(!it.key().startsWith("@rule") && !it.key().startsWith("/*")){
- QListViewItem *item;
+ TQListViewItem *item;
if(it.key().contains(":")){
- item = new QListViewItem(lvPseudo);
+ item = new TQListViewItem(lvPseudo);
}
else
if(it.key().contains("#")){
- item = new QListViewItem(lvIDs);
+ item = new TQListViewItem(lvIDs);
}
else
if(it.key().contains(".")){
- item = new QListViewItem(lvClasses);
+ item = new TQListViewItem(lvClasses);
}
else {
- item = new QListViewItem(lvTags);
+ item = new TQListViewItem(lvTags);
}
item->setText(0,it.key());
@@ -346,27 +346,27 @@ void CSSSelector::loadCSSContent(const QString& s){
}
}
-QString CSSSelector::generateFormattedStyleSection(){
- QMap< QString,QPair<QString,unsigned int> >::Iterator it;
- QString styleSection,tmpStr;
+TQString CSSSelector::generateFormattedStyleSection(){
+ TQMap< TQString,QPair<TQString,unsigned int> >::Iterator it;
+ TQString styleSection,tmpStr;
unsigned int indentWidth,
indentDisplacement = 2;
for ( unsigned int i=0;i<=m_orderNumber;i++ ) {
for ( it = m_currentStylesheetStructure.begin(); it != m_currentStylesheetStructure.end(); ++it ) {
- QString key = it.key();
+ TQString key = it.key();
if(it.data().second == i){
if(key.startsWith("@rule"))
styleSection += it.data().first;
else if(key.startsWith("/*"))
styleSection += it.data().first;
else {
- key.remove(QRegExp("-v[\\d]+$"));
+ key.remove(TQRegExp("-v[\\d]+$"));
styleSection += "\n" + key + " {\n";
indentWidth = indentDisplacement + 2;
- QStringList props = QStringList::split(";",it.data().first.simplifyWhiteSpace());
- QString indentStr;
+ TQStringList props = TQStringList::split(";",it.data().first.simplifyWhiteSpace());
+ TQString indentStr;
indentStr.fill(' ',indentWidth);
- for ( QStringList::Iterator it = props.begin(); it != props.end(); ++it ) {
+ for ( TQStringList::Iterator it = props.begin(); it != props.end(); ++it ) {
if((*it).startsWith(" "))
tmpStr += indentStr + (*it).remove(0,1) + ";\n";
else
@@ -374,7 +374,7 @@ QString CSSSelector::generateFormattedStyleSection(){
}
indentStr.fill(' ', indentDisplacement);
styleSection += tmpStr + indentStr + "}\n\n";
- tmpStr = QString::null;
+ tmpStr = TQString::null;
}
}
}
@@ -387,7 +387,7 @@ void CSSSelector::enableApplyToFile(){
kurApplyToFile->setEnabled(true);
}
-void CSSSelector::setStylesheetProcessing(const QString& msg) {
+void CSSSelector::setStylesheetProcessing(const TQString& msg) {
m_stopProcessingStylesheet=true;
KMessageBox::error (0L, msg );
}