summaryrefslogtreecommitdiffstats
path: root/quanta/components/csseditor/csseditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'quanta/components/csseditor/csseditor.cpp')
-rw-r--r--quanta/components/csseditor/csseditor.cpp164
1 files changed, 82 insertions, 82 deletions
diff --git a/quanta/components/csseditor/csseditor.cpp b/quanta/components/csseditor/csseditor.cpp
index 692a8edf..553d5478 100644
--- a/quanta/components/csseditor/csseditor.cpp
+++ b/quanta/components/csseditor/csseditor.cpp
@@ -16,13 +16,13 @@
***************************************************************************/
#include "csseditor.h"
-#include <qlayout.h>
-#include <qtabwidget.h>
-#include <qpushbutton.h>
-#include <qcheckbox.h>
-#include <qtextedit.h>
-#include <qtextstream.h>
-#include <qfileinfo.h>
+#include <tqlayout.h>
+#include <tqtabwidget.h>
+#include <tqpushbutton.h>
+#include <tqcheckbox.h>
+#include <tqtextedit.h>
+#include <tqtextstream.h>
+#include <tqfileinfo.h>
#include <kapplication.h>
#include <klocale.h>
@@ -47,11 +47,11 @@
-myCheckListItem::myCheckListItem(QListView * parent, const QString & text):QCheckListItem(parent, text, QCheckListItem::CheckBox),m_checkedChildren(0){
+myCheckListItem::myCheckListItem(TQListView * parent, const TQString & text):TQCheckListItem(parent, text, TQCheckListItem::CheckBox),m_checkedChildren(0){
m_sig = new QSignal;
}
-myCheckListItem::myCheckListItem(QCheckListItem * parent, const QString & text):QCheckListItem(parent, text, QCheckListItem::CheckBox),m_checkedChildren(0){
+myCheckListItem::myCheckListItem(TQCheckListItem * parent, const TQString & text):TQCheckListItem(parent, text, TQCheckListItem::CheckBox),m_checkedChildren(0){
m_sig = new QSignal;
}
@@ -59,12 +59,12 @@ myCheckListItem::~myCheckListItem(){
delete m_sig;
}
-void myCheckListItem::connect( QObject *receiver, const char *member ){
+void myCheckListItem::connect( TQObject *receiver, const char *member ){
m_sig->connect( receiver, member );
}
void myCheckListItem::activate(){
- if(isOn()) QCheckListItem::activate();
+ if(isOn()) TQCheckListItem::activate();
}
void myCheckListItem::addCheckedChild() {
@@ -75,9 +75,9 @@ void myCheckListItem::stateChange (bool b){
if(!b) {
if(childCount()) {
- QListViewItem * child = firstChild();
+ TQListViewItem * child = firstChild();
while( child ) {
- m_sig->setValue(QVariant(child->text(0)));
+ m_sig->setValue(TQVariant(child->text(0)));
m_sig->activate();
static_cast<myCheckListItem*>(child)->setOn(false);
child = child->nextSibling();
@@ -90,12 +90,12 @@ void myCheckListItem::stateChange (bool b){
while( p ) {
if( p->m_checkedChildren != 1) {
p->m_checkedChildren--;
- m_sig->setValue(QVariant(text(0)));
+ m_sig->setValue(TQVariant(text(0)));
m_sig->activate();
break;
}
else {
- m_sig->setValue(QVariant(text(0)));
+ m_sig->setValue(TQVariant(text(0)));
m_sig->activate();
p->setOn(false);
}
@@ -103,7 +103,7 @@ void myCheckListItem::stateChange (bool b){
}
}
else {
- m_sig->setValue(QVariant(text(0)));
+ m_sig->setValue(TQVariant(text(0)));
m_sig->activate();
}
}
@@ -113,29 +113,29 @@ void myCheckListItem::stateChange (bool b){
}
}
-void CSSEditor::appendSub(QDomNodeList l, myCheckListItem *cli){
+void CSSEditor::appendSub(TQDomNodeList l, myCheckListItem *cli){
unsigned int i;
for(i=0;i<l.length();i++) {
myCheckListItem *item = new myCheckListItem(cli,l.item(i).toElement().tagName());
- item->connect(this,SLOT(removeProperty(const QVariant&)));
+ item->connect(this,TQT_SLOT(removeProperty(const TQVariant&)));
if(l.item(i).toElement().attribute("hasSub") == "yes")
appendSub(l.item(i).childNodes(),item);
}
}
-void CSSEditor::buildListView(QDomNodeList l, QListView *lv){
+void CSSEditor::buildListView(TQDomNodeList l, TQListView *lv){
unsigned int i;
for(i=0;i<l.length();i++) {
myCheckListItem *item = new myCheckListItem(lv,l.item(i).toElement().tagName());
- item->connect(this,SLOT(removeProperty(const QVariant&)));
+ item->connect(this,TQT_SLOT(removeProperty(const TQVariant&)));
if(l.item(i).toElement().attribute("hasSub") == "yes") {
- QDomNodeList listSub = l.item(i).childNodes();
+ TQDomNodeList listSub = l.item(i).childNodes();
appendSub(listSub,item);
}
}
}
-void CSSEditor::setCurrentPropOn(const QString& s){
+void CSSEditor::setCurrentPropOn(const TQString& s){
if( (m_currentProp = static_cast<myCheckListItem*>(lvVisual->findItem( s,0 )) ))
m_currentProp->setOn(true);
else
@@ -161,12 +161,12 @@ void CSSEditor::setCurrentPropOn(const QString& s){
}
- void CSSEditor::addAndSetPropertyOn(const QString& property, const QString& value){
+ void CSSEditor::addAndSetPropertyOn(const TQString& property, const TQString& value){
addProperty(property,value);
setCurrentPropOn(property);
}
- void CSSEditor::setSidesOfPropertyBorderOn(const QString& s){
+ void CSSEditor::setSidesOfPropertyBorderOn(const TQString& s){
static_cast<myCheckListItem*>(lvVisual->findItem( "border-top",0 ))->setOn(true);
static_cast<myCheckListItem*>(lvVisual->findItem( "border-right",0 ))->setOn(true);
static_cast<myCheckListItem*>(lvVisual->findItem( "border-bottom",0 ))->setOn(true);
@@ -184,20 +184,20 @@ void CSSEditor::hidePreviewer(){
void CSSEditor::initialize(){
m_config = kapp->config();
- connect(pbOk, SIGNAL(clicked()), this, SLOT(toggleShortendForm()));
+ connect(pbOk, TQT_SIGNAL(clicked()), this, TQT_SLOT(toggleShortendForm()));
m_config->setGroup("CSSEditor Options");
SHckb->setChecked(m_config->readBoolEntry("Shorthand form enabled",false));
- QString configFile = locate("appdata", "csseditor/config.xml");
+ TQString configFile = locate("appdata", "csseditor/config.xml");
m_myhi = new QMyHighlighter(display);
- QBoxLayout *fPreviewLayout = new QBoxLayout(fPreview,QBoxLayout::LeftToRight);
+ TQBoxLayout *fPreviewLayout = new TQBoxLayout(fPreview,TQBoxLayout::LeftToRight);
m_previewer=new KHTMLPart(fPreview);
fPreviewLayout->addWidget(m_previewer->view());
- QFile file( configFile );
+ TQFile file( configFile );
if ( !file.open( IO_ReadOnly ) ) {
return;
}
@@ -207,11 +207,11 @@ void CSSEditor::initialize(){
}
file.close();
- QDomElement docElem = m_doc.documentElement();
+ TQDomElement docElem = m_doc.documentElement();
- QDomNode n = docElem.firstChild();
+ TQDomNode n = docElem.firstChild();
while( !n.isNull() ) {
- QDomElement e = n.toElement();
+ TQDomElement e = n.toElement();
if( !e.isNull() ) {
if( e.attribute("type") == "visual") {
lvVisual->setRootIsDecorated(true);
@@ -239,32 +239,32 @@ void CSSEditor::initialize(){
Connect();
- QBoxLayout *fEditingLayout = new QBoxLayout(fEditing,QBoxLayout::LeftToRight);
+ TQBoxLayout *fEditingLayout = new TQBoxLayout(fEditing,TQBoxLayout::LeftToRight);
m_ps = new propertySetter(fEditing);
fEditingLayout->addWidget(m_ps);
- connect(m_ps, SIGNAL(valueChanged(const QString&)), this, SLOT(checkProperty(const QString&)));
+ connect(m_ps, TQT_SIGNAL(valueChanged(const TQString&)), this, TQT_SLOT(checkProperty(const TQString&)));
- QStringList props;
- QString temp;
+ TQStringList props;
+ TQString temp;
bool normalMode = true;
if( !m_selectorName.isEmpty() ){ //the cssselector has been called
m_initialProperties = m_initialProperties.stripWhiteSpace();
- props=QStringList::split(";",m_initialProperties);
+ props=TQStringList::split(";",m_initialProperties);
temp= m_selectorName + " {\n\t" ;
}
else {
m_InlineStyleContent = m_InlineStyleContent.stripWhiteSpace();
normalMode = false;
- props=QStringList::split(";",m_InlineStyleContent);
+ props=TQStringList::split(";",m_InlineStyleContent);
temp="\n\t";
}
- for ( QStringList::Iterator it = props.begin(); it != props.end(); ++it ) {
- const QString propertyName((*it).section(":",0,0).stripWhiteSpace());
- const QString propertyValue((*it).section(":",1));
+ for ( TQStringList::Iterator it = props.begin(); it != props.end(); ++it ) {
+ const TQString propertyName((*it).section(":",0,0).stripWhiteSpace());
+ const TQString propertyValue((*it).section(":",1));
if( ShorthandFormer::SHFormList().contains(propertyName)==0 ) {
temp+= propertyName + " : " + propertyValue +";\n\t";
@@ -272,8 +272,8 @@ void CSSEditor::initialize(){
}
else{
ShorthandFormer decompressor;
- QMap<QString,QString> expandedProperties = decompressor.expand(propertyName, propertyValue );
- QMap<QString,QString>::Iterator it;
+ TQMap<TQString,TQString> expandedProperties = decompressor.expand(propertyName, propertyValue );
+ TQMap<TQString,TQString>::Iterator it;
for ( it = expandedProperties.begin(); it != expandedProperties.end(); ++it ) {
addAndSetPropertyOn( it.key(), it.data() );
@@ -296,7 +296,7 @@ void CSSEditor::toggleShortendForm()
m_config->sync();
}
-CSSEditor::CSSEditor(QListViewItem *i, QWidget *parent, const char *name) : CSSEditorS(parent, name){
+CSSEditor::CSSEditor(TQListViewItem *i, TQWidget *parent, const char *name) : CSSEditorS(parent, name){
m_selectorName = i->text(0);
m_initialProperties = i->text(1);
}
@@ -307,21 +307,21 @@ CSSEditor::~CSSEditor() {
delete m_previewer;
}
-void CSSEditor::setMiniEditors(QListViewItem* i){
+void CSSEditor::setMiniEditors(TQListViewItem* i){
m_ps->reset();
if(i->childCount()==0) {
m_currentProp = static_cast<myCheckListItem*>(i);
- QDomNodeList valueTypes = m_doc.elementsByTagName(i->text(0)).item(0).childNodes();
+ TQDomNodeList valueTypes = m_doc.elementsByTagName(i->text(0)).item(0).childNodes();
unsigned int i;
for(i=0; i<valueTypes.length(); i++) {
- QDomElement curr =valueTypes.item(i).toElement();
- QString valueTypeName(curr.tagName());
+ TQDomElement curr =valueTypes.item(i).toElement();
+ TQString valueTypeName(curr.tagName());
if(valueTypeName =="list") {
m_ps->setComboBox();
- QStringList values = QStringList::split(",",curr.attribute("value"));
+ TQStringList values = TQStringList::split(",",curr.attribute("value"));
m_ps->ComboBox()->insertStringList(values);
if(m_properties.contains(m_currentProp->text(0)) !=0 )
if( values.contains(m_currentProp->text(0)))
@@ -362,7 +362,7 @@ void CSSEditor::setMiniEditors(QListViewItem* i){
if(m_properties.contains(m_currentProp->text(0)) !=0 )
editor->setInitialValue(m_properties[m_currentProp->text(0)]);
else
- editor->setInitialValue(QString::null);
+ editor->setInitialValue(TQString::null);
m_ps->installMiniEditor(editor);
}
else
@@ -381,13 +381,13 @@ void CSSEditor::setMiniEditors(QListViewItem* i){
doubleLengthEditor *editor = new doubleLengthEditor(m_ps);
if(m_properties.contains(m_currentProp->text(0)) !=0 ){
- QString temp(m_properties[m_currentProp->text(0)].simplifyWhiteSpace()),
+ TQString temp(m_properties[m_currentProp->text(0)].simplifyWhiteSpace()),
sx(temp.section(" ",0,0)),
dx(temp.section(" ",1,1));
editor->setInitialValue(sx,dx);
}
- else editor->setInitialValue(QString::null,QString::null);
+ else editor->setInitialValue(TQString::null,TQString::null);
m_ps->installMiniEditor(editor);
}
else
@@ -395,13 +395,13 @@ void CSSEditor::setMiniEditors(QListViewItem* i){
doublePercentageEditor *editor = new doublePercentageEditor(m_ps);
if(m_properties.contains(m_currentProp->text(0)) !=0 ){
- QString temp(m_properties[m_currentProp->text(0)].simplifyWhiteSpace()),
+ TQString temp(m_properties[m_currentProp->text(0)].simplifyWhiteSpace()),
sx(temp.section(" ",0,0)),
dx(temp.section(" ",1,1));
editor->setInitialValue(sx,dx);
}
- else editor->setInitialValue(QString::null,QString::null);
+ else editor->setInitialValue(TQString::null,TQString::null);
m_ps->installMiniEditor(editor);
}
else
@@ -410,7 +410,7 @@ void CSSEditor::setMiniEditors(QListViewItem* i){
if(m_properties.contains(m_currentProp->text(0)) !=0 )
editor->setInitialValue(m_properties[m_currentProp->text(0)]);
else
- editor->setInitialValue(QString::null);
+ editor->setInitialValue(TQString::null);
m_ps->installMiniEditor(editor);
}
else
@@ -419,7 +419,7 @@ void CSSEditor::setMiniEditors(QListViewItem* i){
if(m_properties.contains(m_currentProp->text(0)) !=0 )
editor->setInitialValue(m_properties[m_currentProp->text(0)]);
else
- editor->setInitialValue(QString::null);
+ editor->setInitialValue(TQString::null);
m_ps->installMiniEditor(editor);
}
else
@@ -428,7 +428,7 @@ void CSSEditor::setMiniEditors(QListViewItem* i){
if(m_properties.contains(m_currentProp->text(0)) !=0 )
editor->setInitialValue(m_properties[m_currentProp->text(0)]);
else
- editor->setInitialValue(QString::null);
+ editor->setInitialValue(TQString::null);
m_ps->installMiniEditor(editor);
}
else
@@ -467,8 +467,8 @@ void CSSEditor::setMiniEditors(QListViewItem* i){
else
if( valueTypeName =="doubleList") {
doubleComboBoxEditor *editor = new doubleComboBoxEditor(m_ps);
- editor->cbSx()->insertStringList(QStringList::split(",",curr.firstChild().toElement().attribute("value")));
- editor->cbDx()->insertStringList(QStringList::split(",",curr.lastChild().toElement().attribute("value")));
+ editor->cbSx()->insertStringList(TQStringList::split(",",curr.firstChild().toElement().attribute("value")));
+ editor->cbDx()->insertStringList(TQStringList::split(",",curr.lastChild().toElement().attribute("value")));
m_ps->installMiniEditor(editor);
}
else
@@ -477,7 +477,7 @@ void CSSEditor::setMiniEditors(QListViewItem* i){
if(m_properties.contains(m_currentProp->text(0)) !=0 ){
editor->setInitialValue(m_properties[m_currentProp->text(0)]);
}
- else editor->setInitialValue(QString::null);
+ else editor->setInitialValue(TQString::null);
m_ps->installMiniEditor(editor);
}
}
@@ -486,7 +486,7 @@ void CSSEditor::setMiniEditors(QListViewItem* i){
}
}
-void CSSEditor::checkProperty(const QString& v){
+void CSSEditor::checkProperty(const TQString& v){
if(!m_currentProp->isOn())
m_currentProp->setOn(true);
@@ -500,7 +500,7 @@ void CSSEditor::checkProperty(const QString& v){
if(m_currentProp->text(0) =="border-style" ){
setSidesOfPropertyBorderOn("style");
- QStringList values = QStringList::split(" ",v.stripWhiteSpace());
+ TQStringList values = TQStringList::split(" ",v.stripWhiteSpace());
addProperty("border-top-style",values[0]);
switch(values.count()) {
case 1:
@@ -530,7 +530,7 @@ void CSSEditor::checkProperty(const QString& v){
else
if(m_currentProp->text(0) =="border-width" ){
setSidesOfPropertyBorderOn("width");
- QStringList values = QStringList::split(" ",v.stripWhiteSpace());
+ TQStringList values = TQStringList::split(" ",v.stripWhiteSpace());
addProperty("border-top-width",values[0]);
switch(values.count()) {
case 1:
@@ -560,7 +560,7 @@ void CSSEditor::checkProperty(const QString& v){
else
if(m_currentProp->text(0) =="border-color" ){
setSidesOfPropertyBorderOn("color");
- QStringList values = QStringList::split(" ",v.stripWhiteSpace());
+ TQStringList values = TQStringList::split(" ",v.stripWhiteSpace());
addProperty("border-top-color",values[0]);
switch(values.count()) {
case 1:
@@ -592,22 +592,22 @@ void CSSEditor::checkProperty(const QString& v){
}
void CSSEditor::Connect(){
- connect(this, SIGNAL(signalUpdatePreview()), this, SLOT(updatePreview()));
- connect(lvVisual,SIGNAL(selectionChanged ( QListViewItem * )),this,SLOT(setMiniEditors ( QListViewItem * )));
- connect(lvAll,SIGNAL( selectionChanged( QListViewItem * )),this,SLOT(setMiniEditors ( QListViewItem * )));
- connect(lvAural,SIGNAL( selectionChanged( QListViewItem * )),this,SLOT(setMiniEditors ( QListViewItem * )));
- connect(lvInteractive,SIGNAL( selectionChanged( QListViewItem * )),this,SLOT(setMiniEditors ( QListViewItem * )));
- connect(lvPaged,SIGNAL( selectionChanged( QListViewItem * )),this,SLOT(setMiniEditors ( QListViewItem * )));
+ connect(this, TQT_SIGNAL(signalUpdatePreview()), this, TQT_SLOT(updatePreview()));
+ connect(lvVisual,TQT_SIGNAL(selectionChanged ( TQListViewItem * )),this,TQT_SLOT(setMiniEditors ( TQListViewItem * )));
+ connect(lvAll,TQT_SIGNAL( selectionChanged( TQListViewItem * )),this,TQT_SLOT(setMiniEditors ( TQListViewItem * )));
+ connect(lvAural,TQT_SIGNAL( selectionChanged( TQListViewItem * )),this,TQT_SLOT(setMiniEditors ( TQListViewItem * )));
+ connect(lvInteractive,TQT_SIGNAL( selectionChanged( TQListViewItem * )),this,TQT_SLOT(setMiniEditors ( TQListViewItem * )));
+ connect(lvPaged,TQT_SIGNAL( selectionChanged( TQListViewItem * )),this,TQT_SLOT(setMiniEditors ( TQListViewItem * )));
}
-void CSSEditor::removeProperty(const QVariant& v){
+void CSSEditor::removeProperty(const TQVariant& v){
m_properties.remove(v.toString());
updatePreview();
}
-QString CSSEditor::generateProperties(){
- QString props;
- QMap<QString,QString>::Iterator it;
+TQString CSSEditor::generateProperties(){
+ TQString props;
+ TQMap<TQString,TQString>::Iterator it;
if(!SHckb->isChecked()) {
for ( it = m_properties.begin(); it != m_properties.end(); ++it )
props+= it.key() + " : " + it.data().stripWhiteSpace() + "; " ;
@@ -628,7 +628,7 @@ void CSSEditor::updatePreview(){
void CSSEditor::activatePreview() {
if(!m_isFileToPreviewExternal){
- QString testHeader,
+ TQString testHeader,
testFooter,
testBody;
@@ -641,7 +641,7 @@ void CSSEditor::activatePreview() {
testFooter = "\"" ;
}
- QMap<QString,QString>::Iterator it;
+ TQMap<TQString,TQString>::Iterator it;
for ( it = m_properties.begin(); it != m_properties.end(); ++it )
testBody+= it.key() + " : " + it.data() + ";";
@@ -652,22 +652,22 @@ void CSSEditor::activatePreview() {
}
else {
- QString tmp("{");
- QFile file(m_fileToPreview);
+ TQString tmp("{");
+ TQFile file(m_fileToPreview);
if ( file.open( IO_ReadOnly ) ) {
- QMap<QString,QString>::Iterator it;
+ TQMap<TQString,TQString>::Iterator it;
for ( it = m_properties.begin(); it != m_properties.end(); ++it )
tmp+= it.key() + " : " + it.data() + ";";
- QFileInfo fi(m_fileToPreview);
+ TQFileInfo fi(m_fileToPreview);
KParts::URLArgs a;
if(fi.extension().lower() == "xml" || fi.extension().lower() == "xhtml")
a.serviceType="text/xml";
if(fi.extension().lower() == "html" || fi.extension().lower() == "html")
a.serviceType="text/xml";
m_previewer->browserExtension()->setURLArgs(a);
- QTextStream stream( &file );
+ TQTextStream stream( &file );
m_previewer->begin(KURL(m_fileToPreview));
m_previewer->write(stream.read());
@@ -680,8 +680,8 @@ void CSSEditor::activatePreview() {
}
void CSSEditor::updateDisplay(){
- QString toDisplay;
- QMap<QString,QString>::Iterator it;
+ TQString toDisplay;
+ TQMap<TQString,TQString>::Iterator it;
for ( it = m_properties.begin(); it != m_properties.end(); ++it )
toDisplay += it.key() + " : " + it.data() + ";\n\t";