summaryrefslogtreecommitdiffstats
path: root/quanta/components
diff options
context:
space:
mode:
Diffstat (limited to 'quanta/components')
-rw-r--r--quanta/components/Makefile.am5
-rw-r--r--quanta/components/csseditor/Makefile.am18
-rw-r--r--quanta/components/csseditor/colorrequester.cpp129
-rw-r--r--quanta/components/csseditor/colorrequester.h50
-rw-r--r--quanta/components/csseditor/colorslider.cpp85
-rw-r--r--quanta/components/csseditor/colorslider.h69
-rw-r--r--quanta/components/csseditor/csseditor.cpp697
-rw-r--r--quanta/components/csseditor/csseditor.h117
-rw-r--r--quanta/components/csseditor/csseditor_globals.cpp50
-rw-r--r--quanta/components/csseditor/csseditor_globals.h63
-rw-r--r--quanta/components/csseditor/csseditors.ui411
-rw-r--r--quanta/components/csseditor/cssselector.cpp395
-rw-r--r--quanta/components/csseditor/cssselector.h74
-rw-r--r--quanta/components/csseditor/cssselectors.ui985
-rw-r--r--quanta/components/csseditor/cssshpropertyparser.cpp127
-rw-r--r--quanta/components/csseditor/cssshpropertyparser.h46
-rw-r--r--quanta/components/csseditor/data/Makefile.am3
-rw-r--r--quanta/components/csseditor/data/atrules.xml7
-rw-r--r--quanta/components/csseditor/data/config.xml609
-rw-r--r--quanta/components/csseditor/data/dtdTags.xml19
-rw-r--r--quanta/components/csseditor/data/pseudo.xml14
-rw-r--r--quanta/components/csseditor/doubleeditors.cpp120
-rw-r--r--quanta/components/csseditor/doubleeditors.h86
-rw-r--r--quanta/components/csseditor/encodingselector.cpp47
-rw-r--r--quanta/components/csseditor/encodingselector.h40
-rw-r--r--quanta/components/csseditor/encodingselectors.ui115
-rw-r--r--quanta/components/csseditor/fontfamilychooser.cpp175
-rw-r--r--quanta/components/csseditor/fontfamilychooser.h52
-rw-r--r--quanta/components/csseditor/fontfamilychoosers.ui441
-rw-r--r--quanta/components/csseditor/minieditor.h37
-rw-r--r--quanta/components/csseditor/percentageeditor.cpp38
-rw-r--r--quanta/components/csseditor/percentageeditor.h52
-rw-r--r--quanta/components/csseditor/propertysetter.cpp129
-rw-r--r--quanta/components/csseditor/propertysetter.h64
-rw-r--r--quanta/components/csseditor/qmyhighlighter.cpp65
-rw-r--r--quanta/components/csseditor/qmyhighlighter.h36
-rw-r--r--quanta/components/csseditor/shorthandformer.cpp781
-rw-r--r--quanta/components/csseditor/shorthandformer.h117
-rw-r--r--quanta/components/csseditor/specialsb.cpp127
-rw-r--r--quanta/components/csseditor/specialsb.h79
-rw-r--r--quanta/components/csseditor/styleeditor.cpp109
-rw-r--r--quanta/components/csseditor/styleeditor.h42
-rw-r--r--quanta/components/csseditor/stylesheetparser.cpp245
-rw-r--r--quanta/components/csseditor/stylesheetparser.h58
-rw-r--r--quanta/components/csseditor/tlpeditors.cpp174
-rw-r--r--quanta/components/csseditor/tlpeditors.h94
-rw-r--r--quanta/components/cvsservice/Makefile.am13
-rw-r--r--quanta/components/cvsservice/cvscommitdlgs.ui150
-rw-r--r--quanta/components/cvsservice/cvsservice.cpp555
-rw-r--r--quanta/components/cvsservice/cvsservice.h118
-rw-r--r--quanta/components/cvsservice/cvsservicedcopif.h30
-rw-r--r--quanta/components/cvsservice/cvsupdatetodlgs.ui198
-rw-r--r--quanta/components/debugger/Makefile.am25
-rw-r--r--quanta/components/debugger/backtracelistview.cpp128
-rw-r--r--quanta/components/debugger/backtracelistview.h93
-rw-r--r--quanta/components/debugger/conditionalbreakpointdialog.cpp100
-rw-r--r--quanta/components/debugger/conditionalbreakpointdialog.h56
-rw-r--r--quanta/components/debugger/conditionalbreakpointdialogs.ui329
-rw-r--r--quanta/components/debugger/dbgp/Makefile.am17
-rw-r--r--quanta/components/debugger/dbgp/dbgpnetwork.cpp314
-rw-r--r--quanta/components/debugger/dbgp/dbgpnetwork.h76
-rw-r--r--quanta/components/debugger/dbgp/dbgpsettings.cpp44
-rw-r--r--quanta/components/debugger/dbgp/dbgpsettings.h35
-rw-r--r--quanta/components/debugger/dbgp/dbgpsettingss.ui728
-rw-r--r--quanta/components/debugger/dbgp/qbytearrayfifo.cpp76
-rw-r--r--quanta/components/debugger/dbgp/qbytearrayfifo.h43
-rw-r--r--quanta/components/debugger/dbgp/quantadebuggerdbgp.cpp1042
-rw-r--r--quanta/components/debugger/dbgp/quantadebuggerdbgp.desktop44
-rw-r--r--quanta/components/debugger/dbgp/quantadebuggerdbgp.h166
-rw-r--r--quanta/components/debugger/debuggerbreakpoint.cpp181
-rw-r--r--quanta/components/debugger/debuggerbreakpoint.h85
-rw-r--r--quanta/components/debugger/debuggerbreakpointlist.cpp193
-rw-r--r--quanta/components/debugger/debuggerbreakpointlist.h58
-rw-r--r--quanta/components/debugger/debuggerbreakpointview.cpp193
-rw-r--r--quanta/components/debugger/debuggerbreakpointview.h74
-rw-r--r--quanta/components/debugger/debuggermanager.cpp850
-rw-r--r--quanta/components/debugger/debuggermanager.h128
-rw-r--r--quanta/components/debugger/debuggerui.cpp205
-rw-r--r--quanta/components/debugger/debuggerui.h90
-rw-r--r--quanta/components/debugger/debuggervariable.cpp283
-rw-r--r--quanta/components/debugger/debuggervariable.h103
-rw-r--r--quanta/components/debugger/debuggervariablesets.ui185
-rw-r--r--quanta/components/debugger/gubed/Makefile.am18
-rw-r--r--quanta/components/debugger/gubed/gubedsettings.cpp41
-rw-r--r--quanta/components/debugger/gubed/gubedsettings.h36
-rw-r--r--quanta/components/debugger/gubed/gubedsettingss.ui762
-rw-r--r--quanta/components/debugger/gubed/quantadebuggergubed.cpp1247
-rw-r--r--quanta/components/debugger/gubed/quantadebuggergubed.desktop48
-rw-r--r--quanta/components/debugger/gubed/quantadebuggergubed.h153
-rw-r--r--quanta/components/debugger/interfaces/Makefile.am17
-rw-r--r--quanta/components/debugger/interfaces/debuggerclient.cpp160
-rw-r--r--quanta/components/debugger/interfaces/debuggerclient.h115
-rw-r--r--quanta/components/debugger/interfaces/debuggerinterface.cpp26
-rw-r--r--quanta/components/debugger/interfaces/debuggerinterface.h80
-rw-r--r--quanta/components/debugger/interfaces/quantadebugger.desktop45
-rw-r--r--quanta/components/debugger/pathmapper.cpp228
-rw-r--r--quanta/components/debugger/pathmapper.h55
-rw-r--r--quanta/components/debugger/pathmapperdialog.cpp102
-rw-r--r--quanta/components/debugger/pathmapperdialog.h52
-rw-r--r--quanta/components/debugger/pathmapperdialogs.ui345
-rw-r--r--quanta/components/debugger/quantadebuggerinterface.cpp176
-rw-r--r--quanta/components/debugger/quantadebuggerinterface.h75
-rw-r--r--quanta/components/debugger/variableslistview.cpp290
-rw-r--r--quanta/components/debugger/variableslistview.h71
-rw-r--r--quanta/components/framewizard/Makefile.am9
-rw-r--r--quanta/components/framewizard/areaattributedb.cpp40
-rw-r--r--quanta/components/framewizard/areaattributedb.h49
-rw-r--r--quanta/components/framewizard/fmfpeditor.cpp111
-rw-r--r--quanta/components/framewizard/fmfpeditor.h42
-rw-r--r--quanta/components/framewizard/fmfpeditors.ui541
-rw-r--r--quanta/components/framewizard/fmrceditor.cpp34
-rw-r--r--quanta/components/framewizard/fmrceditor.h38
-rw-r--r--quanta/components/framewizard/fmrceditors.ui149
-rw-r--r--quanta/components/framewizard/framewizard.cpp120
-rw-r--r--quanta/components/framewizard/framewizard.h61
-rw-r--r--quanta/components/framewizard/framewizards.ui369
-rw-r--r--quanta/components/framewizard/fwglobal.cpp22
-rw-r--r--quanta/components/framewizard/fwglobal.h24
-rw-r--r--quanta/components/framewizard/selectablearea.cpp57
-rw-r--r--quanta/components/framewizard/selectablearea.h53
-rw-r--r--quanta/components/framewizard/treenode.cpp135
-rw-r--r--quanta/components/framewizard/treenode.h87
-rw-r--r--quanta/components/framewizard/visualframeeditor.cpp449
-rw-r--r--quanta/components/framewizard/visualframeeditor.h66
-rw-r--r--quanta/components/tableeditor/Makefile.am15
-rw-r--r--quanta/components/tableeditor/tableeditor.cpp1298
-rw-r--r--quanta/components/tableeditor/tableeditor.h132
-rw-r--r--quanta/components/tableeditor/tableeditors.ui642
-rw-r--r--quanta/components/tableeditor/tableitem.cpp94
-rw-r--r--quanta/components/tableeditor/tableitem.h56
130 files changed, 23139 insertions, 0 deletions
diff --git a/quanta/components/Makefile.am b/quanta/components/Makefile.am
new file mode 100644
index 00000000..654571d1
--- /dev/null
+++ b/quanta/components/Makefile.am
@@ -0,0 +1,5 @@
+if include_cvsservice
+CVSSERVICE = cvsservice
+endif
+
+SUBDIRS = csseditor framewizard tableeditor debugger $(CVSSERVICE)
diff --git a/quanta/components/csseditor/Makefile.am b/quanta/components/csseditor/Makefile.am
new file mode 100644
index 00000000..3b888e32
--- /dev/null
+++ b/quanta/components/csseditor/Makefile.am
@@ -0,0 +1,18 @@
+SUBDIRS = data
+
+noinst_LTLIBRARIES = libcsseditor.la
+
+libcsseditor_la_SOURCES = fontfamilychoosers.ui cssselectors.ui csseditors.ui \
+ fontfamilychooser.cpp cssselector.cpp csseditor.cpp specialsb.cpp doubleeditors.cpp \
+ qmyhighlighter.cpp colorrequester.cpp propertysetter.cpp shorthandformer.cpp colorslider.cpp \
+ csseditor_globals.cpp tlpeditors.cpp styleeditor.cpp stylesheetparser.cpp cssshpropertyparser.cpp percentageeditor.cpp
+
+libcsseditor_la_METASOURCES = AUTO
+
+AM_CPPFLAGS = -I$(top_srcdir)/quanta/src \
+ -I$(top_srcdir)/quanta/utility \
+ -I$(top_srcdir)/quanta/parsers \
+ -I$(top_srcdir)/quanta/project \
+ -I$(top_srcdir)/lib \
+ $(KMDI_INCLUDES) $(all_includes)
+noinst_HEADERS = styleeditor.h
diff --git a/quanta/components/csseditor/colorrequester.cpp b/quanta/components/csseditor/colorrequester.cpp
new file mode 100644
index 00000000..1333a48e
--- /dev/null
+++ b/quanta/components/csseditor/colorrequester.cpp
@@ -0,0 +1,129 @@
+/***************************************************************************
+ colorrequester.cpp - description
+ -------------------
+ copyright : (C) 2004 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "colorrequester.h"
+#include <klineedit.h>
+#include <kcombobox.h>
+#include <kcolordialog.h>
+#include <qtooltip.h>
+#include <qiconset.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kaccel.h>
+
+#include "propertysetter.h"
+
+class colorRequester::colorRequesterPrivate{
+ public:
+ KLineEdit *edit;
+ colorRequesterPrivate() { edit = 0L; }
+ void setText( const QString& text ) { edit->setText( text ); }
+ void connectSignals( QObject *receiver ) { connect( edit, SIGNAL( textChanged( const QString& )),receiver, SIGNAL( textChanged( const QString& ))); }
+};
+
+colorRequester::colorRequester(QWidget *parent, const char* name) : miniEditor(parent,name){
+ d = new colorRequesterPrivate;
+ init();
+}
+
+colorRequester::~colorRequester(){
+ delete myColorDialog;
+ delete d;
+}
+
+void colorRequester::connectToPropertySetter(propertySetter* p){
+ connect( this, SIGNAL(textChanged(const QString&)), p, SIGNAL(valueChanged(const QString&)));
+}
+
+void colorRequester::init()
+{
+ myColorDialog = 0L;
+
+ if ( !d->edit )
+ d->edit = new KLineEdit( this, "line edit" );
+
+ myButton = new KPushButton( this, "kfile button");
+ QIconSet iconSet = SmallIconSet(QString::fromLatin1("colorize"));
+ QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
+ myButton->setIconSet( iconSet );
+ myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
+ QToolTip::add(myButton, i18n("Open color dialog"));
+
+ setSpacing( KDialog::spacingHint() );
+
+ QWidget *widget = (QWidget*) d->edit;
+ setFocusProxy( widget );
+
+ d->connectSignals( this );
+ connect( myButton, SIGNAL( clicked() ), this, SLOT( openColorDialog() ));
+ connect( d->edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( setInitialValue(/*const QString&*/ ) ));
+
+ KAccel *accel = new KAccel( this );
+ accel->insert( KStdAccel::Open, this, SLOT( openColorDialog() ));
+ accel->readSettings();
+ }
+
+void colorRequester::openColorDialog(){
+ KColorDialog dlg(this,"dlg",true);
+ dlg.setColor(QColor(m_initialValue));
+ if(dlg.exec()){
+ QColor myColor(dlg.color());
+ d->edit->setText(myColor.name());
+ emit textChanged(myColor.name());
+ }
+}
+
+KLineEdit * colorRequester::lineEdit() const{
+ return d->edit;
+}
+#include <kdebug.h>
+void colorRequester::setInitialValue(/*const QString& s*/){
+ QString temp = d->edit->text();
+ temp.remove(" ");
+ if( temp.contains("#") != 0){
+ temp.remove("#");
+ if(temp.length() == 3) {
+ QString temp2;
+ temp2.append(temp[0]);
+ temp2.append(temp[0]);
+ temp2.append(temp[1]);
+ temp2.append(temp[1]);
+ temp2.append(temp[2]);
+ temp2.append(temp[2]);
+ temp = temp2;
+ }
+ bool ok;
+ int r = temp.left(2).toInt( &ok, 16 );
+ int g = temp.mid(2,2).toInt( &ok, 16 );
+ int b = temp.right(2).toInt( &ok, 16 );
+ m_initialValue.setRgb(r,g,b);
+ }
+ else
+
+ if( temp.contains("rgb(") != 0){
+ temp.remove("rgb(").remove(")");
+ QStringList rgbValues = QStringList::split(",",temp);
+// bool ok;
+ int r = rgbValues[0].toInt();
+ int g = rgbValues[1].toInt();
+ int b = rgbValues[2].toInt();
+ m_initialValue.setRgb(r,g,b);
+ }
+ else
+ m_initialValue.setNamedColor(d->edit->text());
+}
+
+#include "colorrequester.moc"
diff --git a/quanta/components/csseditor/colorrequester.h b/quanta/components/csseditor/colorrequester.h
new file mode 100644
index 00000000..e0b4be4f
--- /dev/null
+++ b/quanta/components/csseditor/colorrequester.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ colorrequester.h - description
+ -------------------
+ copyright : (C) 2004 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef COLORREQUESTER_H
+#define COLORREQUESTER_H
+
+#include <kpushbutton.h>
+#include <qcolor.h>
+
+#include "minieditor.h"
+
+class KLineEdit;
+class KColorDialog;
+class colorRequester : public miniEditor{
+ Q_OBJECT
+ public:
+ colorRequester(QWidget *parent, const char* name=0);
+ ~colorRequester();
+ KLineEdit * lineEdit() const;
+ KPushButton * button() const { return myButton; }
+ virtual void connectToPropertySetter(propertySetter* p);
+ //void setInitialValue(const QString&);
+ public slots:
+ void openColorDialog();
+ void setInitialValue(/*const QString&*/);
+ protected:
+ void init();
+ signals:
+ void selectedColor(QColor);
+ void textChanged(const QString&);
+ private:
+ mutable KColorDialog * myColorDialog;
+ KPushButton *myButton;
+ class colorRequesterPrivate;
+ colorRequesterPrivate *d;
+ QColor m_initialValue;
+};
+#endif
diff --git a/quanta/components/csseditor/colorslider.cpp b/quanta/components/csseditor/colorslider.cpp
new file mode 100644
index 00000000..436c7e21
--- /dev/null
+++ b/quanta/components/csseditor/colorslider.cpp
@@ -0,0 +1,85 @@
+/***************************************************************************
+ colorslider.cpp - description
+ -------------------
+ begin : lun ago 9 2004
+ copyright : (C) 2004 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qvbox.h>
+#include <qlabel.h>
+
+#include <klocale.h>
+
+#include "colorslider.h"
+#include "propertysetter.h"
+
+/**
+ *@author gulmini luciano
+ */
+
+
+
+colorSlider::colorSlider(const QString& fn,const QString& l,const QString& c,const QString& r,QWidget *parent, const char *name) : miniEditor(parent,name) {
+ m_functionName = fn;
+ QVBox *leftBox = new QVBox(this);
+ QVBox *centerBox = new QVBox(this);
+ QVBox *rightBox = new QVBox(this);
+ QLabel *leftLabel = new QLabel("<b>" + l +"</b>",leftBox);
+ QLabel *centerLabel = new QLabel(("<b>" + c +"</b>"),centerBox);
+ QLabel *rightLabel = new QLabel(("<b>" + r +"</b>"),rightBox);
+ leftLabel->setAlignment(Qt::AlignHCenter);
+ centerLabel->setAlignment(Qt::AlignHCenter);
+ rightLabel->setAlignment(Qt::AlignHCenter);
+ leftLabel->setTextFormat (Qt::RichText ) ;
+ centerLabel->setTextFormat ( Qt::RichText ) ;
+ rightLabel->setTextFormat (Qt::RichText ) ;
+ m_leftValue = new QSlider ( 0, 255, 1, 0, Qt::Horizontal , leftBox);
+ m_centerValue = new QSlider ( 0, 255, 1, 0, Qt::Horizontal , centerBox);
+ m_rightValue = new QSlider ( 0, 255, 1, 0, Qt::Horizontal , rightBox);
+ setSpacing(10);
+ connect(m_leftValue, SIGNAL(valueChanged ( int)), this, SLOT(convertLeftValue(int)));
+ connect(m_centerValue, SIGNAL(valueChanged ( int)), this, SLOT(convertCenterValue(int)));
+ connect(m_rightValue, SIGNAL(valueChanged ( int)), this, SLOT(convertRightValue(int)));
+}
+
+colorSlider::~colorSlider(){
+ //delete m_redValue;
+ //delete m_greenValue;
+ //delete m_blueValue;
+}
+
+void colorSlider::connectToPropertySetter(propertySetter* p){
+ connect( this, SIGNAL(valueChanged(const QString&)), p, SIGNAL(valueChanged(const QString&)));
+}
+
+void colorSlider::convertLeftValue(int i){
+ emit valueChanged(m_functionName + "(" + QString::number(i,10) + "," + QString::number(m_centerValue->value(),10) + "," +QString::number(m_rightValue->value(),10) +")");
+}
+
+void colorSlider::convertCenterValue(int i){
+ emit valueChanged(m_functionName + "(" + QString::number(m_leftValue->value(),10) + "," + QString::number(i,10) + "," + QString::number(m_rightValue->value(),10) +")");
+}
+
+void colorSlider::convertRightValue(int i){
+ emit valueChanged(m_functionName + "(" + QString::number(m_leftValue->value(),10) + "," + QString::number(m_centerValue->value(),10) + "," + QString::number(i,10) +")");
+}
+
+RGBcolorSlider::RGBcolorSlider(QWidget *parent, const char *name) : colorSlider("rgb",i18n("Red"),i18n("Green"),i18n("Blue"),parent,name){
+}
+
+//FOR CSS3
+/*HSLcolorSlider::HSLcolorSlider(QWidget *parent, const char *name) : colorSlider("hsl",i18n("Hue"),i18n("Saturation"),i18n("Lightness"),parent,name){
+}
+*/
+
+#include "colorslider.moc"
diff --git a/quanta/components/csseditor/colorslider.h b/quanta/components/csseditor/colorslider.h
new file mode 100644
index 00000000..41a78fa9
--- /dev/null
+++ b/quanta/components/csseditor/colorslider.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+ colorslider.h - description
+ -------------------
+ begin : lun ago 9 2004
+ copyright : (C) 2004 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef COLORSLIDER_H
+#define COLORSLIDER_H
+
+#include <qslider.h>
+
+#include "minieditor.h"
+
+
+
+/**
+ *@author gulmini luciano
+ */
+
+class colorSlider : public miniEditor {
+ Q_OBJECT
+ private :
+ QString m_functionName;
+ protected:
+ QSlider *m_leftValue,
+ *m_centerValue,
+ *m_rightValue;
+ public:
+ colorSlider(const QString& functionName,const QString& l=QString::null,const QString& c=QString::null,const QString& r=QString::null,QWidget *parent=0, const char *name=0);
+ virtual ~colorSlider();
+ virtual void connectToPropertySetter(propertySetter* p);
+
+ private slots:
+ void convertLeftValue(int i);
+ void convertCenterValue(int i);
+ void convertRightValue(int i);
+
+ signals:
+ void valueChanged(const QString&);
+};
+
+class RGBcolorSlider : public colorSlider {
+ Q_OBJECT
+ public:
+ RGBcolorSlider(QWidget *parent=0, const char *name=0);
+ ~RGBcolorSlider(){}
+};
+
+//FOR CSS3
+/*class HSLcolorSlider : public colorSlider {
+ Q_OBJECT
+ public:
+ HSLcolorSlider(QWidget *parent=0, const char *name=0);
+ ~HSLcolorSlider();
+};*/
+
+
+#endif
diff --git a/quanta/components/csseditor/csseditor.cpp b/quanta/components/csseditor/csseditor.cpp
new file mode 100644
index 00000000..692a8edf
--- /dev/null
+++ b/quanta/components/csseditor/csseditor.cpp
@@ -0,0 +1,697 @@
+/***************************************************************************
+ csseditor.cpp - description
+ -------------------
+ begin : mer lug 23 11:20:17 CEST 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#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 <kapplication.h>
+#include <klocale.h>
+#include <khtml_part.h>
+#include <khtmlview.h>
+#include <kstandarddirs.h>
+#include <klineedit.h>
+#include <kdebug.h>
+#include <kconfig.h>
+#include <kparts/browserextension.h>
+
+#include "propertysetter.h"
+#include "qmyhighlighter.h"
+#include "cssshpropertyparser.h"
+#include "shorthandformer.h"
+#include "percentageeditor.h"
+#include "colorslider.h"
+#include "tlpeditors.h"
+#include "doubleeditors.h"
+#include "specialsb.h"
+#include "colorrequester.h"
+
+
+
+myCheckListItem::myCheckListItem(QListView * parent, const QString & text):QCheckListItem(parent, text, QCheckListItem::CheckBox),m_checkedChildren(0){
+ m_sig = new QSignal;
+}
+
+myCheckListItem::myCheckListItem(QCheckListItem * parent, const QString & text):QCheckListItem(parent, text, QCheckListItem::CheckBox),m_checkedChildren(0){
+ m_sig = new QSignal;
+}
+
+myCheckListItem::~myCheckListItem(){
+ delete m_sig;
+}
+
+void myCheckListItem::connect( QObject *receiver, const char *member ){
+ m_sig->connect( receiver, member );
+}
+
+void myCheckListItem::activate(){
+ if(isOn()) QCheckListItem::activate();
+}
+
+void myCheckListItem::addCheckedChild() {
+ m_checkedChildren++;
+}
+
+void myCheckListItem::stateChange (bool b){
+
+ if(!b) {
+ if(childCount()) {
+ QListViewItem * child = firstChild();
+ while( child ) {
+ m_sig->setValue(QVariant(child->text(0)));
+ m_sig->activate();
+ static_cast<myCheckListItem*>(child)->setOn(false);
+ child = child->nextSibling();
+ }
+ m_checkedChildren = 0;
+ }
+ else {
+ if(parent()){
+ myCheckListItem *p = static_cast<myCheckListItem*>(parent());
+ while( p ) {
+ if( p->m_checkedChildren != 1) {
+ p->m_checkedChildren--;
+ m_sig->setValue(QVariant(text(0)));
+ m_sig->activate();
+ break;
+ }
+ else {
+ m_sig->setValue(QVariant(text(0)));
+ m_sig->activate();
+ p->setOn(false);
+ }
+ p = static_cast<myCheckListItem*>(p->parent());
+ }
+ }
+ else {
+ m_sig->setValue(QVariant(text(0)));
+ m_sig->activate();
+ }
+ }
+ }
+ else {
+ if(parent()) static_cast<myCheckListItem*>(parent())->addCheckedChild();
+ }
+}
+
+void CSSEditor::appendSub(QDomNodeList 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&)));
+ if(l.item(i).toElement().attribute("hasSub") == "yes")
+ appendSub(l.item(i).childNodes(),item);
+ }
+}
+
+void CSSEditor::buildListView(QDomNodeList l, QListView *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&)));
+ if(l.item(i).toElement().attribute("hasSub") == "yes") {
+ QDomNodeList listSub = l.item(i).childNodes();
+ appendSub(listSub,item);
+ }
+ }
+}
+
+void CSSEditor::setCurrentPropOn(const QString& s){
+ if( (m_currentProp = static_cast<myCheckListItem*>(lvVisual->findItem( s,0 )) ))
+ m_currentProp->setOn(true);
+ else
+ if( (m_currentProp = static_cast<myCheckListItem*>(lvAll->findItem( s,0 )) ))
+ m_currentProp->setOn(true);
+ else
+ if( (m_currentProp = static_cast<myCheckListItem*>(lvAural->findItem( s,0 )) ))
+ m_currentProp->setOn(true);
+ else
+ if( (m_currentProp = static_cast<myCheckListItem*>(lvInteractive->findItem( s,0 )) ))
+ m_currentProp->setOn(true);
+ else
+ if( (m_currentProp = static_cast<myCheckListItem*>(lvPaged->findItem( s,0 )) ))
+ m_currentProp->setOn(true);
+
+ if( m_currentProp && m_currentProp->depth() ) {
+ myCheckListItem *p = static_cast<myCheckListItem*>(m_currentProp->parent());
+ while(p) {
+ p->setOn(true);
+ p=static_cast<myCheckListItem*>(p->parent());
+ }
+ }
+}
+
+
+ void CSSEditor::addAndSetPropertyOn(const QString& property, const QString& value){
+ addProperty(property,value);
+ setCurrentPropOn(property);
+ }
+
+ void CSSEditor::setSidesOfPropertyBorderOn(const QString& 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);
+ static_cast<myCheckListItem*>(lvVisual->findItem( "border-left",0 ))->setOn(true);
+ static_cast<myCheckListItem*>(lvVisual->findItem( "border-top-"+s,0 ))->setOn(true);
+ static_cast<myCheckListItem*>(lvVisual->findItem( "border-right-"+s,0 ))->setOn(true);
+ static_cast<myCheckListItem*>(lvVisual->findItem( "border-bottom-"+s,0 ))->setOn(true);
+ static_cast<myCheckListItem*>(lvVisual->findItem( "border-left-"+s,0 ))->setOn(true);
+ }
+
+void CSSEditor::hidePreviewer(){
+ fPreview->hide();
+ }
+
+void CSSEditor::initialize(){
+
+ m_config = kapp->config();
+ connect(pbOk, SIGNAL(clicked()), this, SLOT(toggleShortendForm()));
+ m_config->setGroup("CSSEditor Options");
+ SHckb->setChecked(m_config->readBoolEntry("Shorthand form enabled",false));
+
+ QString configFile = locate("appdata", "csseditor/config.xml");
+
+ m_myhi = new QMyHighlighter(display);
+
+ QBoxLayout *fPreviewLayout = new QBoxLayout(fPreview,QBoxLayout::LeftToRight);
+ m_previewer=new KHTMLPart(fPreview);
+
+ fPreviewLayout->addWidget(m_previewer->view());
+
+ QFile file( configFile );
+ if ( !file.open( IO_ReadOnly ) ) {
+ return;
+ }
+ if ( !m_doc.setContent( &file ) ) {
+ file.close();
+ return;
+ }
+ file.close();
+
+ QDomElement docElem = m_doc.documentElement();
+
+ QDomNode n = docElem.firstChild();
+ while( !n.isNull() ) {
+ QDomElement e = n.toElement();
+ if( !e.isNull() ) {
+ if( e.attribute("type") == "visual") {
+ lvVisual->setRootIsDecorated(true);
+ buildListView(e.childNodes(), lvVisual);
+ }
+ if( e.attribute("type") == "paged") {
+ lvPaged->setRootIsDecorated(true);
+ buildListView(e.childNodes(), lvPaged);
+ }
+ if( e.attribute("type") == "interactive") {
+ lvInteractive->setRootIsDecorated(true);
+ buildListView(e.childNodes(), lvInteractive);
+ }
+ if( e.attribute("type") == "aural") {
+ lvAural->setRootIsDecorated(true);
+ buildListView(e.childNodes(), lvAural);
+ }
+ if( e.attribute("type") == "all"){
+ lvAll->setRootIsDecorated(true);
+ buildListView(e.childNodes(), lvAll);
+ }
+ }
+ n = n.nextSibling();
+ } // end while
+
+ Connect();
+
+ QBoxLayout *fEditingLayout = new QBoxLayout(fEditing,QBoxLayout::LeftToRight);
+
+ m_ps = new propertySetter(fEditing);
+ fEditingLayout->addWidget(m_ps);
+ connect(m_ps, SIGNAL(valueChanged(const QString&)), this, SLOT(checkProperty(const QString&)));
+
+ QStringList props;
+ QString temp;
+ bool normalMode = true;
+
+ if( !m_selectorName.isEmpty() ){ //the cssselector has been called
+ m_initialProperties = m_initialProperties.stripWhiteSpace();
+ props=QStringList::split(";",m_initialProperties);
+ temp= m_selectorName + " {\n\t" ;
+ }
+
+ else {
+ m_InlineStyleContent = m_InlineStyleContent.stripWhiteSpace();
+ normalMode = false;
+ props=QStringList::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));
+
+ if( ShorthandFormer::SHFormList().contains(propertyName)==0 ) {
+ temp+= propertyName + " : " + propertyValue +";\n\t";
+ addAndSetPropertyOn(propertyName,propertyValue);
+ }
+ else{
+ ShorthandFormer decompressor;
+ QMap<QString,QString> expandedProperties = decompressor.expand(propertyName, propertyValue );
+ QMap<QString,QString>::Iterator it;
+
+ for ( it = expandedProperties.begin(); it != expandedProperties.end(); ++it ) {
+ addAndSetPropertyOn( it.key(), it.data() );
+ temp += ( it.key() + " : " + it.data() + ";\n\t");
+ }
+ }
+ }
+ temp.truncate(temp.length()-1);
+ //temp.chop(1);
+ if(normalMode)//normal mode editing
+ temp+="}";
+ display->setText(temp);
+ activatePreview();
+}
+
+void CSSEditor::toggleShortendForm()
+{
+ m_config->setGroup("CSSEditor Options");
+ m_config->writeEntry("Shorthand form enabled", SHckb->isChecked());
+ m_config->sync();
+}
+
+CSSEditor::CSSEditor(QListViewItem *i, QWidget *parent, const char *name) : CSSEditorS(parent, name){
+ m_selectorName = i->text(0);
+ m_initialProperties = i->text(1);
+}
+
+CSSEditor::~CSSEditor() {
+ delete m_myhi;
+ delete m_ps;
+ delete m_previewer;
+}
+
+void CSSEditor::setMiniEditors(QListViewItem* 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();
+ unsigned int i;
+ for(i=0; i<valueTypes.length(); i++) {
+ QDomElement curr =valueTypes.item(i).toElement();
+ QString valueTypeName(curr.tagName());
+
+ if(valueTypeName =="list") {
+ m_ps->setComboBox();
+ QStringList values = QStringList::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)))
+ m_ps->ComboBox()->setCurrentText(m_properties[m_currentProp->text(0)]);
+ if(curr.attribute("editable") == "yes"){
+ m_ps->ComboBox()->setEditable(true);
+ /*if(m_properties.contains(m_currentProp->text(0)) !=0 )
+ m_ps->ComboBox()->setEditText(m_properties[m_currentProp->text(0)]); */
+ }
+ }
+ else
+
+ /*if( typeName == "spinbox") {
+ m_ps->setSpinBox("0", values.item(k).toElement().attribute("minValue"),
+ values.item(k).toElement().attribute("maxValue"),
+ values.item(k).toElement().attribute("suffix"));
+ }
+
+ else*/
+ if( valueTypeName == "number") m_ps->setLineEdit();
+ else
+ if( valueTypeName == "integer") {
+ if(m_properties.contains(m_currentProp->text(0)) !=0 ) {
+ if(!curr.attribute("minValue").isNull())
+ m_ps->setSpinBox(m_properties[m_currentProp->text(0)],curr.attribute("minValue"));
+ else
+ m_ps->setSpinBox(m_properties[m_currentProp->text(0)]);
+ }
+ else
+ if(!curr.attribute("minValue").isNull())
+ m_ps->setSpinBox("0",curr.attribute("minValue"));
+ else
+ m_ps->setSpinBox();
+ }
+ else
+ if( valueTypeName == "length") {
+ lengthEditor *editor = new lengthEditor(m_ps);
+ if(m_properties.contains(m_currentProp->text(0)) !=0 )
+ editor->setInitialValue(m_properties[m_currentProp->text(0)]);
+ else
+ editor->setInitialValue(QString::null);
+ m_ps->installMiniEditor(editor);
+ }
+ else
+ if( valueTypeName == "percentage") {
+ if(m_properties.contains(m_currentProp->text(0)) !=0 ){
+ percentageEditor *editor = new percentageEditor(m_properties[m_currentProp->text(0)],m_ps);
+ m_ps->installMiniEditor(editor);
+ }
+ else {
+ percentageEditor *editor = new percentageEditor("0",m_ps);
+ m_ps->installMiniEditor(editor);
+ }
+ }
+ else
+ if( valueTypeName == "doubleLength") {
+ doubleLengthEditor *editor = new doubleLengthEditor(m_ps);
+
+ if(m_properties.contains(m_currentProp->text(0)) !=0 ){
+ QString 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);
+ m_ps->installMiniEditor(editor);
+ }
+ else
+ if( valueTypeName == "doublePercentage") {
+ doublePercentageEditor *editor = new doublePercentageEditor(m_ps);
+
+ if(m_properties.contains(m_currentProp->text(0)) !=0 ){
+ QString 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);
+ m_ps->installMiniEditor(editor);
+ }
+ else
+ if( valueTypeName == "frequency") {
+ frequencyEditor *editor = new frequencyEditor(m_ps);
+ if(m_properties.contains(m_currentProp->text(0)) !=0 )
+ editor->setInitialValue(m_properties[m_currentProp->text(0)]);
+ else
+ editor->setInitialValue(QString::null);
+ m_ps->installMiniEditor(editor);
+ }
+ else
+ if( valueTypeName == "time") {
+ timeEditor *editor = new timeEditor(m_ps);
+ if(m_properties.contains(m_currentProp->text(0)) !=0 )
+ editor->setInitialValue(m_properties[m_currentProp->text(0)]);
+ else
+ editor->setInitialValue(QString::null);
+ m_ps->installMiniEditor(editor);
+ }
+ else
+ if( valueTypeName == "angle") {
+ angleEditor *editor = new angleEditor(m_ps);
+ if(m_properties.contains(m_currentProp->text(0)) !=0 )
+ editor->setInitialValue(m_properties[m_currentProp->text(0)]);
+ else
+ editor->setInitialValue(QString::null);
+ m_ps->installMiniEditor(editor);
+ }
+ else
+ if( valueTypeName == "freeedit") {
+ m_ps->setLineEdit();
+ }
+ else
+ if( valueTypeName == "uri") {
+ URIEditor *editor = new URIEditor(m_ps);
+
+ if(curr.attribute("mode") == "multi") editor->setMode(URIEditor::Multi);
+ else editor->setMode(URIEditor::Single);
+
+ if( curr.attribute("resourceType") == "audio") editor->setResourceType(URIEditor::audio);
+ else
+ if( curr.attribute("resourceType") == "image") editor->setResourceType(URIEditor::image);
+ else
+ if( curr.attribute("resourceType") == "mousePointer") editor->setResourceType(URIEditor::mousePointer);
+
+ m_ps->installMiniEditor(editor);
+ }
+ else
+ if( valueTypeName == "colors") {
+ RGBcolorSlider *RGBeditor = new RGBcolorSlider(m_ps);
+ colorRequester *CReditor = new colorRequester(m_ps);
+ if(m_properties.contains(m_currentProp->text(0)) !=0 ){
+ CReditor->lineEdit()->setText(m_properties[m_currentProp->text(0)]);
+ CReditor->setInitialValue();
+
+ }
+
+ m_ps->installMiniEditor(CReditor);
+ m_ps->setPredefinedColorListEditor();
+ m_ps->installMiniEditor(RGBeditor);
+ }
+ 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")));
+ m_ps->installMiniEditor(editor);
+ }
+ else
+ if( valueTypeName == "fontDialog" ){
+ fontEditor *editor = new fontEditor(m_ps);
+ if(m_properties.contains(m_currentProp->text(0)) !=0 ){
+ editor->setInitialValue(m_properties[m_currentProp->text(0)]);
+ }
+ else editor->setInitialValue(QString::null);
+ m_ps->installMiniEditor(editor);
+ }
+ }
+ m_ps->addButton();
+ m_ps->Show();
+ }
+}
+
+void CSSEditor::checkProperty(const QString& v){
+ if(!m_currentProp->isOn())
+ m_currentProp->setOn(true);
+
+ if( m_currentProp->depth() ){
+ myCheckListItem *p = static_cast<myCheckListItem*>(m_currentProp->parent());
+ while(p){
+ p->setOn(true);
+ p=static_cast<myCheckListItem*>(p->parent());
+ }
+ }
+
+ if(m_currentProp->text(0) =="border-style" ){
+ setSidesOfPropertyBorderOn("style");
+ QStringList values = QStringList::split(" ",v.stripWhiteSpace());
+ addProperty("border-top-style",values[0]);
+ switch(values.count()) {
+ case 1:
+ addProperty("border-right-style",values[0]);
+ addProperty("border-bottom-style",values[0]);
+ addProperty("border-left-style",values[0]);
+ break;
+
+ case 2:
+ addProperty("border-right-style",values[1]);
+ addProperty("border-bottom-style",values[0]);
+ addProperty("border-left-style",values[1]);
+ break;
+
+ case 3:
+ addProperty("border-right-style",values[1]);
+ addProperty("border-bottom-style",values[2]);
+ addProperty("border-left-style",values[1]);
+ break;
+
+ case 4:
+ addProperty("border-right-style",values[1]);
+ addProperty("border-bottom-style",values[2]);
+ addProperty("border-left-style",values[3]);break;
+ }
+ }
+ else
+ if(m_currentProp->text(0) =="border-width" ){
+ setSidesOfPropertyBorderOn("width");
+ QStringList values = QStringList::split(" ",v.stripWhiteSpace());
+ addProperty("border-top-width",values[0]);
+ switch(values.count()) {
+ case 1:
+ addProperty("border-right-width",values[0]);
+ addProperty("border-bottom-width",values[0]);
+ addProperty("border-left-width",values[0]);
+ break;
+
+ case 2:
+ addProperty("border-right-width",values[1]);
+ addProperty("border-bottom-width",values[0]);
+ addProperty("border-left-width",values[1]);
+ break;
+
+ case 3:
+ addProperty("border-right-width",values[1]);
+ addProperty("border-bottom-width",values[2]);
+ addProperty("border-left-width",values[1]);
+ break;
+
+ case 4:
+ addProperty("border-right-width",values[1]);
+ addProperty("border-bottom-width",values[2]);
+ addProperty("border-left-width",values[3]);break;
+ }
+ }
+ else
+ if(m_currentProp->text(0) =="border-color" ){
+ setSidesOfPropertyBorderOn("color");
+ QStringList values = QStringList::split(" ",v.stripWhiteSpace());
+ addProperty("border-top-color",values[0]);
+ switch(values.count()) {
+ case 1:
+ addProperty("border-right-color",values[0]);
+ addProperty("border-bottom-color",values[0]);
+ addProperty("border-left-color",values[0]);
+ break;
+
+ case 2:
+ addProperty("border-right-color",values[1]);
+ addProperty("border-bottom-color",values[0]);
+ addProperty("border-left-color",values[1]);
+ break;
+
+ case 3:
+ addProperty("border-right-color",values[1]);
+ addProperty("border-bottom-color",values[2]);
+ addProperty("border-left-color",values[1]);
+ break;
+
+ case 4:
+ addProperty("border-right-style",values[1]);
+ addProperty("border-bottom-style",values[2]);
+ addProperty("border-left-style",values[3]);break;
+ }
+ }
+ else addProperty(m_currentProp->text(0),v);
+ emit signalUpdatePreview();
+}
+
+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 * )));
+}
+
+void CSSEditor::removeProperty(const QVariant& v){
+ m_properties.remove(v.toString());
+ updatePreview();
+}
+
+QString CSSEditor::generateProperties(){
+ QString props;
+ QMap<QString,QString>::Iterator it;
+ if(!SHckb->isChecked()) {
+ for ( it = m_properties.begin(); it != m_properties.end(); ++it )
+ props+= it.key() + " : " + it.data().stripWhiteSpace() + "; " ;
+ props.truncate(props.length()-1);//the last white space creates some problems: better remove it
+ //props.chop(1);
+ return props;
+ }
+ else {
+ ShorthandFormer sf(m_properties);
+ return sf.compress();
+ }
+}
+
+void CSSEditor::updatePreview(){
+ updateDisplay();
+ activatePreview();
+}
+
+void CSSEditor::activatePreview() {
+ if(!m_isFileToPreviewExternal){
+ QString testHeader,
+ testFooter,
+ testBody;
+
+ if(!m_selectorName.isEmpty()) {
+ testHeader += m_selectorName + " { \n ";
+ testFooter = "\n}" + m_Selectors;
+ }
+ else {
+ testHeader += " style=\"" ;
+ testFooter = "\"" ;
+ }
+
+ QMap<QString,QString>::Iterator it;
+ for ( it = m_properties.begin(); it != m_properties.end(); ++it )
+ testBody+= it.key() + " : " + it.data() + ";";
+
+ m_previewer->begin( KURL(m_fileToPreview) );
+ m_previewer->write( m_Header + testHeader + testBody+ testFooter+ m_Footer);
+ m_previewer->end();
+
+
+ }
+ else {
+ QString tmp("{");
+ QFile file(m_fileToPreview);
+ if ( file.open( IO_ReadOnly ) ) {
+ QMap<QString,QString>::Iterator it;
+ for ( it = m_properties.begin(); it != m_properties.end(); ++it )
+ tmp+= it.key() + " : " + it.data() + ";";
+
+
+ QFileInfo 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 );
+
+ m_previewer->begin(KURL(m_fileToPreview));
+ m_previewer->write(stream.read());
+ m_previewer->end();
+ m_previewer->setUserStyleSheet(m_externalStyleSheetDefinition + " " + m_selectorName+" "+ tmp +"}");
+ file.close();
+ }
+ //else KMessageBox::sorry(this,i18n("The css file you want to edit can't be opened"));
+ }
+}
+
+void CSSEditor::updateDisplay(){
+ QString toDisplay;
+ QMap<QString,QString>::Iterator it;
+ for ( it = m_properties.begin(); it != m_properties.end(); ++it )
+ toDisplay += it.key() + " : " + it.data() + ";\n\t";
+
+ if(!m_selectorName.isEmpty()){// we're working on <style></style> block
+ toDisplay.prepend(m_selectorName +" {\n\t");
+ toDisplay+="}";
+ }
+ else toDisplay.prepend("\n\t");
+
+ display->setText(toDisplay);
+}
+
+#include "csseditor.moc"
diff --git a/quanta/components/csseditor/csseditor.h b/quanta/components/csseditor/csseditor.h
new file mode 100644
index 00000000..6994a686
--- /dev/null
+++ b/quanta/components/csseditor/csseditor.h
@@ -0,0 +1,117 @@
+/***************************************************************************
+ csseditor.h - description
+ -------------------
+ begin : mer lug 23 11:20:17 CEST 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CSSEDITOR_H
+#define CSSEDITOR_H
+
+#include <qwidget.h>
+#include "csseditors.h"
+#include <qdom.h>
+#include <qmap.h>
+#include <qlistview.h>
+#include <qsignal.h>
+
+class propertySetter;
+class KConfig;
+class KHTMLPart;
+class QListViewItem;
+class QDomNodeList;
+class QVariant;
+class QMyHighlighter;
+
+
+class myCheckListItem : public QCheckListItem
+{
+ private:
+ QSignal *m_sig;
+ unsigned int m_checkedChildren;
+
+ public :
+ myCheckListItem(QCheckListItem * parent, const QString & text);
+ myCheckListItem(QListView * parent, const QString & text);
+ ~myCheckListItem();
+ void connect( QObject *receiver, const char *member );
+ void addCheckedChild();
+
+ protected :
+ virtual void activate();
+ virtual void stateChange (bool);
+};
+
+/** CSSEditor is the base class of the project */
+class CSSEditor : public CSSEditorS
+{
+ Q_OBJECT
+ private:
+ QMyHighlighter *m_myhi;
+ propertySetter *m_ps;
+ myCheckListItem *m_currentProp;
+ KHTMLPart *m_previewer;
+ QDomDocument m_doc;
+ QMap<QString,QString> m_properties;
+ QString m_selectorName,
+ m_initialProperties,
+ m_Selectors,
+ m_Header,
+ m_Footer,
+
+ m_InlineStyleContent,
+ m_externalStyleSheetDefinition,
+ m_fileToPreview;
+
+ bool m_isFileToPreviewExternal;
+ KConfig *m_config;
+
+ //sourceFileName;
+
+ void Connect();
+ void appendSub(QDomNodeList, myCheckListItem *);
+ void buildListView(QDomNodeList, QListView *);
+ void updateDisplay();
+ void activatePreview();
+ void setCurrentPropOn(const QString& s);
+ void addProperty(const QString& property, const QString& value) { m_properties[property] = value; }
+ void addAndSetPropertyOn(const QString& property, const QString& value);
+ void setSidesOfPropertyBorderOn(const QString& s);
+
+ private slots:
+ void checkProperty(const QString&);
+ void removeProperty(const QVariant&);
+ void updatePreview();
+ void setMiniEditors(QListViewItem*);
+ void toggleShortendForm();
+
+ public:
+
+ CSSEditor(QWidget* parent=0, const char *name=0): CSSEditorS(parent, name), m_config(0L){}
+ CSSEditor( QListViewItem * i, QWidget* parent=0, const char *name=0);
+ ~CSSEditor();
+ void initialize();
+ void setSelectors( const QString& s) { m_Selectors = s; }
+ void setHeader( const QString& s) { m_Header = s; }
+ void setFooter( const QString& s) { m_Footer = s;}
+ void setInlineStyleContent( const QString& s){ m_InlineStyleContent = s; }
+ QString generateProperties();
+ void hidePreviewer();
+ void setFileToPreview(const QString& s,bool b) { m_fileToPreview = s; m_isFileToPreviewExternal = b;}
+ void setExternalStyleSheetDefinition(const QString& s) { m_externalStyleSheetDefinition = s;}
+
+ signals:
+ void signalUpdatePreview();
+};
+
+#endif
diff --git a/quanta/components/csseditor/csseditor_globals.cpp b/quanta/components/csseditor/csseditor_globals.cpp
new file mode 100644
index 00000000..a73cb876
--- /dev/null
+++ b/quanta/components/csseditor/csseditor_globals.cpp
@@ -0,0 +1,50 @@
+/***************************************************************************
+ csseditor_globals.cpp - description
+ -------------------
+ begin : dom ago 3 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlineedit.h>
+#include "csseditor_globals.h"
+
+mySpinBox::mySpinBox(QWidget * parent , const char * name ) : QSpinBox (parent, name){
+ connect( editor(), SIGNAL(textChanged(const QString&)), this, SLOT(checkSuffix( const QString & )));
+ connect( editor(), SIGNAL(textChanged(const QString&)), this, SIGNAL(valueChanged( const QString & )));
+}
+
+mySpinBox::mySpinBox( int minValue, int maxValue, int step, QWidget * parent, const char * name ) : QSpinBox( minValue, maxValue, step, parent,name ){
+ connect( editor(), SIGNAL(textChanged(const QString&)), this, SLOT(checkSuffix( const QString & )));
+ connect( editor(), SIGNAL(textChanged(const QString&)), this, SIGNAL(valueChanged( const QString & )));
+}
+
+mySpinBox::~mySpinBox(){}
+
+void mySpinBox::checkSuffix(const QString&){// check if the suffix is present and how many times : it normalizes these times to one
+ if(!suffix().isEmpty()){
+ const QString suf(suffix());
+ QString t(editor()->text());
+ if( t.contains(suf) ==0 ) {
+ editor()->setText( t + suf);
+ editor()->setCursorPosition(editor()->cursorPosition() - 1);
+ }
+ else
+ if( t.contains(suf) >1 ) {
+ editor()->setText( t.remove(suf) + suf);
+ editor()->setCursorPosition(editor()->cursorPosition() - 1);
+ }
+ }
+}
+
+
+#include "csseditor_globals.moc"
diff --git a/quanta/components/csseditor/csseditor_globals.h b/quanta/components/csseditor/csseditor_globals.h
new file mode 100644
index 00000000..fefae7c8
--- /dev/null
+++ b/quanta/components/csseditor/csseditor_globals.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ csseditor_globals.h - description
+ -------------------
+ begin : dom ago 3 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CSSEDITOR_GLOBALS_H
+#define CSSEDITOR_GLOBALS_H
+#include <qspinbox.h>
+#include <qregexp.h>
+#include <qstringlist.h>
+
+namespace CSSEditorGlobals {
+const QStringList HTMLColors(QStringList::split(",",QString("aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,"
+ "blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,"
+ "cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,"
+ "darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,"
+ "darkseagreen,darkslateblue,darkslategray,darkturquoise,darkviolet,deeppink,"
+ "deepskyblue,dimgray,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,"
+ "ghostwhite,gold,goldenrod,gray,green,greenyellow,honeydew,hotpink,indianred,"
+ "indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,"
+ "lightcyan,lightgoldenrodyellow,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,"
+ "lightskyblue,lightslategray,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,"
+ "maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,"
+ "mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,"
+ "mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,"
+ "orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,"
+ "peachpuff,peru,pink,plum,powderblue,purple,red,rosybrown,royalblue,saddlebrown,"
+ "salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,snow,"
+ "springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,"
+ "yellow,yellowgreen")));
+
+
+ const QStringList lengthUnits(QStringList::split(",",QString("cm,em,ex,in,mm,pc,pt,px")));
+ const QStringList frequencyUnits(QStringList::split(",",QString("Hz,kHz")));
+ const QStringList angleUnits(QStringList::split(",",QString("deg,rad,grad")));
+ const QStringList timeUnits(QStringList::split(",",QString("s,ms")));
+}
+
+
+class mySpinBox : public QSpinBox{
+ Q_OBJECT
+ public:
+ mySpinBox(QWidget * parent = 0, const char * name = 0 );
+ mySpinBox( int minValue, int maxValue, int step = 1, QWidget * parent = 0, const char * name = 0 );
+ ~mySpinBox();
+ public slots:
+ void checkSuffix(const QString&);
+};
+
+
+#endif
diff --git a/quanta/components/csseditor/csseditors.ui b/quanta/components/csseditor/csseditors.ui
new file mode 100644
index 00000000..de99118f
--- /dev/null
+++ b/quanta/components/csseditor/csseditors.ui
@@ -0,0 +1,411 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>CSSEditorS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>CSSEditorS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>631</width>
+ <height>490</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>CSS Editor</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>280</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="2" column="2">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbOk</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbCancel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>SHckb</cstring>
+ </property>
+ <property name="text">
+ <string>Use shorthand form</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QSplitter" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>splitter3</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>twMediaGroup</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>33</width>
+ <height>7</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>290</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Visual</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Properties</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvVisual</cstring>
+ </property>
+ <property name="cursor">
+ <cursor>13</cursor>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Paged</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Properties</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvPaged</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Properties</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvInteractive</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Aural</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Properties</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvAural</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>All</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Properties</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvAll</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>fEditing</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>fPreview</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ </widget>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>display</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32766</width>
+ <height>32766</height>
+ </size>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ <widget class="KPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>pbHelp</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>pbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>CSSEditorS</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>pbOk</sender>
+ <signal>clicked()</signal>
+ <receiver>CSSEditorS</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/quanta/components/csseditor/cssselector.cpp b/quanta/components/csseditor/cssselector.cpp
new file mode 100644
index 00000000..1425102f
--- /dev/null
+++ b/quanta/components/csseditor/cssselector.cpp
@@ -0,0 +1,395 @@
+/***************************************************************************
+ cssselector.cpp - description
+ -------------------
+ begin : mer ago 6 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#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 <kstandarddirs.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+#include <kurlrequester.h>
+#include <kfiledialog.h>
+#include "project.h"
+#include "stylesheetparser.h"
+
+
+CSSSelector::CSSSelector(QWidget *parent, const char* name) : CSSSelectorS (parent,name),m_orderNumber(0),m_stopProcessingStylesheet(false) {
+
+ m_currentItem = 0L;
+
+ Connect();
+
+ 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");
+
+ /*QString configDir = locate("appdata", "csseditor/config.xml");
+ configDir = QFileInfo(configDir).dirPath() + "/";*/
+
+ QString configDir = QFileInfo( locate("appdata", "csseditor/config.xml") ).dirPath() + "/";
+
+ QDomDocument doc;
+ QFile file( configDir+"pseudo.xml" );
+ if ( !file.open( IO_ReadOnly ) )
+ return;
+ if ( !doc.setContent( &file ) ) {
+ file.close();
+ return;
+ }
+ file.close();
+
+ QDomElement docElem = doc.documentElement();
+
+ QDomNode n = docElem.firstChild();
+ while( !n.isNull() ) {
+ QDomElement e = n.toElement();
+ if( !e.isNull() ) {
+ cbPseudo->insertItem(e.attribute("name"));
+ }
+ n = n.nextSibling();
+ }
+
+ file.setName( configDir+"dtdTags.xml" );
+ if ( !file.open( IO_ReadOnly ) )
+ return;
+ if ( !doc.setContent( &file ) ) {
+ file.close();
+ return;
+ }
+ file.close();
+
+ QStringList dtdNames,
+ dtdNickNames;
+ docElem = doc.documentElement();
+ n = docElem.firstChild();
+ while( !n.isNull() ) {
+ QDomElement 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() );
+ tagList.sort();
+ cbTag->insertStringList( tagList );
+ cbTag->setAutoCompletion(true);
+ }
+ }
+ n = n.nextSibling();
+ }
+ cbDTD->insertStringList( dtdNickNames );
+}
+
+CSSSelector::~CSSSelector(){
+}
+
+void CSSSelector::Connect(){
+
+ connect(cbDTD,SIGNAL(activated(const QString&)),this,SLOT(setDTDTags(const QString&)));
+
+ 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(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, 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(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(twSelectors,SIGNAL(currentChanged ( QWidget * )), this ,SLOT(setCurrentListView( QWidget * )));
+
+ 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()));
+}
+
+void CSSSelector::setDTDTags(const QString& s){
+
+ QString configDir = QFileInfo( locate("appdata", "csseditor/config.xml") ).dirPath() + "/";
+
+ QDomDocument doc;
+
+ QFile file( configDir+"dtdTags.xml" );
+ if ( !file.open( IO_ReadOnly ) )
+ return;
+ if ( !doc.setContent( &file ) ) {
+ file.close();
+ return;
+ }
+ file.close();
+
+ QStringList dtdNames;
+ QDomElement docElem = doc.documentElement();
+ QDomNode n = docElem.firstChild();
+ while( !n.isNull() ) {
+ if( n.toElement().attribute("nickName") == s )
+ break;
+ n = n.nextSibling();
+ }
+ QStringList tagList = QStringList::split( ',',n.toElement().text() );
+ tagList.sort();
+ cbTag->clear();
+ cbTag->insertStringList( tagList );
+ cbTag->setAutoCompletion(true);
+}
+
+void CSSSelector::addTag(){
+ QListViewItem *item = new QListViewItem(lvTags);
+ if(!cbTag->currentText().isEmpty()){
+ item->setText(0,cbTag->currentText());
+ QPair<QString, unsigned int> tmp(QString::null,++m_orderNumber);
+ m_currentStylesheetStructure[item->text(0)]=tmp;
+ }
+}
+
+void CSSSelector::addClass(){
+ QListViewItem *item = new QListViewItem(lvClasses);
+ if(!leClass->text().isEmpty()){
+ item->setText(0,leClass->text());
+ QPair<QString, unsigned int> tmp(QString::null,++m_orderNumber);
+ m_currentStylesheetStructure[item->text(0)]=tmp;
+ }
+}
+
+void CSSSelector::addID(){
+ QListViewItem *item = new QListViewItem(lvIDs);
+ if(!leID->text().isEmpty()){
+ item->setText(0,leID->text());
+ QPair<QString, unsigned int> tmp(QString::null,++m_orderNumber);
+ m_currentStylesheetStructure[item->text(0)]=tmp;
+ }
+}
+
+void CSSSelector::addPseudo(){
+ QListViewItem *item = new QListViewItem(lvPseudo);
+ item->setText(0,(lePseudoSelector->text()+":"+cbPseudo->currentText()).stripWhiteSpace());
+ QPair<QString, unsigned int> tmp(QString::null,++m_orderNumber);
+ m_currentStylesheetStructure[item->text(0)]=tmp;
+}
+
+void CSSSelector::openCSSEditor(QListViewItem * 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;
+
+ while ( (obj = it.current()) != 0 ) {
+ QListView *lvTemp = (QListView*)obj;
+ if( lv != lvTemp){
+ temp = lvTemp->firstChild();
+ while(temp){
+ s+=(temp->text(0)+" { "+temp->text(1)+" } ");
+ temp = temp->nextSibling();
+ }
+ }
+ ++it;
+ }
+ delete l; // delete the list, not the objects
+
+ temp = lv->firstChild();
+
+ while(temp){
+ if(temp != i) s+=(temp->text(0)+" { "+temp->text(1)+" } ");
+ temp = temp->nextSibling();
+ }
+
+ CSSEditor dlg(i);
+ if(m_callingFrom == "XHTML"){
+ dlg.setHeader(m_header);
+ dlg.setSelectors(s);
+ dlg.setFooter(m_footer);
+ dlg.setFileToPreview(m_fileToPreview,false);
+ }
+ else if(m_callingFrom == "CSS"){
+ if(kurApplyToFile->url().isEmpty())
+ dlg.hidePreviewer();
+ else {
+ dlg.setFileToPreview(kurApplyToFile->url(),true);
+
+ QString tmp;
+ QListViewItem *item = lvTags->firstChild();
+ while( item ) {
+ if(i->text(0).stripWhiteSpace() != item->text(0).stripWhiteSpace())
+ tmp += item->text(0) + " {" + item->text(1) + "}";
+ item = item->nextSibling();
+ }
+
+ item = lvClasses->firstChild();
+ while( item ) {
+ if(i->text(0).stripWhiteSpace() != item->text(0).stripWhiteSpace())
+ tmp += item->text(0) + " {" + item->text(1) + "}";
+ item = item->nextSibling();
+ }
+
+ item = lvIDs->firstChild();
+ while( item ) {
+ if(i->text(0).stripWhiteSpace() != item->text(0).stripWhiteSpace())
+ tmp += item->text(0) + " {" + item->text(1) + "}";
+ item = item->nextSibling();
+ }
+
+ item = lvPseudo->firstChild();
+ while( item ) {
+ if(i->text(0).stripWhiteSpace() != item->text(0).stripWhiteSpace())
+ tmp += item->text(0) + " {" + item->text(1) + "}";
+ item = item->nextSibling();
+ }
+
+ dlg.setExternalStyleSheetDefinition(tmp);
+ }
+ }
+
+ dlg.initialize();
+
+ if(dlg.exec()) {
+ i->setText(1,dlg.generateProperties());
+ QPair<QString, 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::removeAll(){
+ QListViewItemIterator it( m_currentListView );
+ while ( it.current() ) {
+ QListViewItem *item = it.current();
+ m_currentStylesheetStructure.remove(item->text(0));
+ ++it;
+ }
+ m_currentListView->clear();
+}
+
+void CSSSelector::removeSelected(){
+ if( m_currentItem ) {
+ m_currentStylesheetStructure.remove(m_currentItem->text(0));
+ delete m_currentItem;
+ m_currentItem = 0L;
+ }
+}
+
+void CSSSelector::loadCSSContent(const QString& s){
+ stylesheetParser p(s);
+ connect(&p,SIGNAL(errorOccurred(const QString&)), this, SLOT(setStylesheetProcessing(const QString&)));
+ p.parse();
+ m_orderNumber = p.orderNumber();
+
+ QMap<QString, QPair<QString,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;
+ if(it.key().contains(":")){
+ item = new QListViewItem(lvPseudo);
+ }
+ else
+ if(it.key().contains("#")){
+ item = new QListViewItem(lvIDs);
+ }
+ else
+ if(it.key().contains(".")){
+ item = new QListViewItem(lvClasses);
+ }
+ else {
+ item = new QListViewItem(lvTags);
+ }
+
+ item->setText(0,it.key());
+ item->setText(1,it.data().first);
+
+ }
+ }
+}
+
+QString CSSSelector::generateFormattedStyleSection(){
+ QMap< QString,QPair<QString,unsigned int> >::Iterator it;
+ QString 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();
+ 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]+$"));
+ styleSection += "\n" + key + " {\n";
+ indentWidth = indentDisplacement + 2;
+ QStringList props = QStringList::split(";",it.data().first.simplifyWhiteSpace());
+ QString indentStr;
+ indentStr.fill(' ',indentWidth);
+ for ( QStringList::Iterator it = props.begin(); it != props.end(); ++it ) {
+ if((*it).startsWith(" "))
+ tmpStr += indentStr + (*it).remove(0,1) + ";\n";
+ else
+ tmpStr += indentStr + (*it) + ";\n";
+ }
+ indentStr.fill(' ', indentDisplacement);
+ styleSection += tmpStr + indentStr + "}\n\n";
+ tmpStr = QString::null;
+ }
+ }
+ }
+ }
+ return "\n"+styleSection;
+}
+
+void CSSSelector::enableApplyToFile(){
+ tlApplyToFile->setEnabled(true);
+ kurApplyToFile->setEnabled(true);
+}
+
+void CSSSelector::setStylesheetProcessing(const QString& msg) {
+ m_stopProcessingStylesheet=true;
+ KMessageBox::error (0L, msg );
+}
+
+#include "cssselector.moc"
diff --git a/quanta/components/csseditor/cssselector.h b/quanta/components/csseditor/cssselector.h
new file mode 100644
index 00000000..f4d42e89
--- /dev/null
+++ b/quanta/components/csseditor/cssselector.h
@@ -0,0 +1,74 @@
+/***************************************************************************
+ cssselector.h - description
+ -------------------
+ begin : mer ago 6 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CSSSELECTOR_H
+#define CSSSELECTOR_H
+
+#include <qmap.h>
+#include <qpair.h>
+#include "cssselectors.h"
+
+class QListViewItem;
+class QStringList;
+/**
+ *@author gulmini luciano
+ */
+
+class CSSSelector : public CSSSelectorS {
+ Q_OBJECT
+
+ private:
+ QListViewItem *m_currentItem;
+ QListView *m_currentListView;
+ QString m_header,
+ m_footer,
+ m_callingFrom,
+ m_fileToPreview;
+ QMap<QString, QPair<QString,unsigned int> > m_currentStylesheetStructure;
+ unsigned int m_orderNumber;
+ bool m_stopProcessingStylesheet;
+
+ void Connect();
+
+ public:
+ CSSSelector(QWidget *parent=0, const char* name=0);
+ ~CSSSelector();
+ void loadCSSContent(const QString& s);
+ void setHeader(const QString& h) { m_header = h; }
+ void setFooter(const QString& f) { m_footer = f; }
+ void enableApplyToFile();
+ void setCallingFrom(const QString& cf){ m_callingFrom = cf ;}
+ void setFileToPreview(const QString& s){ m_fileToPreview=s;}
+ bool errorOnProcessingStylesheet() const { return m_stopProcessingStylesheet; }
+ QString generateFormattedStyleSection();
+
+ private slots:
+ void openCSSEditor(QListViewItem *);
+ void addTag();
+ void addClass();
+ void addID();
+ void addPseudo();
+ void removeAll();
+ void removeSelected();
+ void setCurrentItem(QListViewItem* i) { m_currentItem = i; }
+ void setCurrentListView(QWidget*);
+ void setDTDTags(const QString&);
+ void setStylesheetProcessing(const QString&);
+};
+
+#endif
+
diff --git a/quanta/components/csseditor/cssselectors.ui b/quanta/components/csseditor/cssselectors.ui
new file mode 100644
index 00000000..1119ccdb
--- /dev/null
+++ b/quanta/components/csseditor/cssselectors.ui
@@ -0,0 +1,985 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>CSSSelectorS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>CSSSelectorS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>621</width>
+ <height>496</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>CSS Selector Dialog</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlApplyToFile</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Apply to file:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>kurApplyToFile</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer19_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="3" column="2">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QTabWidget" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>twSelectors</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tags</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="2">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Remove Selector</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>pbRemoveSelectedTag</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Selected</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>pbRemoveAllTags</cstring>
+ </property>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>DTD Selection</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox" row="0" column="0">
+ <property name="name">
+ <cstring>cbDTD</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>24</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Add Selector</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox" row="0" column="0">
+ <property name="name">
+ <cstring>cbTag</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>pbAddTag</cstring>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Selector</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Properties</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvTags</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Minimum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>IDs</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Selector</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Properties</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvIDs</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer18</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="0" column="2">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4_2</cstring>
+ </property>
+ <property name="title">
+ <string>Remove Selector</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>pbRemoveSelectedID</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Selected</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>pbRemoveAllIDs</cstring>
+ </property>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox7_2</cstring>
+ </property>
+ <property name="title">
+ <string>Add Selector</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit" row="0" column="0">
+ <property name="name">
+ <cstring>leID</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>pbAddID</cstring>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer14</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Classes</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Selector</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Properties</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvClasses</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer19</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="0" column="2">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4_3</cstring>
+ </property>
+ <property name="title">
+ <string>Remove Selector</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>pbRemoveSelectedClass</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Selected</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>pbRemoveAllClasses</cstring>
+ </property>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox7</cstring>
+ </property>
+ <property name="title">
+ <string>Add Selector</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit" row="0" column="0">
+ <property name="name">
+ <cstring>leClass</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>pbAddClass</cstring>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Pseudo</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Selector</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Properties</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvPseudo</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="0" column="2">
+ <property name="name">
+ <cstring>layout17</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer15_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>Remove Selector</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>pbRemoveAllPseudo</cstring>
+ </property>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>pbRemoveSelectedPseudo</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Selected</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox7_3</cstring>
+ </property>
+ <property name="title">
+ <string>Add Selector</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit" row="0" column="0">
+ <property name="name">
+ <cstring>lePseudoSelector</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="0">
+ <property name="name">
+ <cstring>cbPseudo</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>pbAddPseudo</cstring>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer17</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>380</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="3" column="0">
+ <property name="name">
+ <cstring>pbHelp</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>pbOk</sender>
+ <signal>clicked()</signal>
+ <receiver>CSSSelectorS</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>pbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>CSSSelectorS</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/quanta/components/csseditor/cssshpropertyparser.cpp b/quanta/components/csseditor/cssshpropertyparser.cpp
new file mode 100644
index 00000000..d02c39a5
--- /dev/null
+++ b/quanta/components/csseditor/cssshpropertyparser.cpp
@@ -0,0 +1,127 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Gulmini Luciano *
+ * gulmini.luciano@student.unife.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#include "cssshpropertyparser.h"
+#include <qregexp.h>
+//#include <kdebug.h>
+
+CSSSHPropertyParser::CSSSHPropertyParser(const QString& s){
+ QStringList l1,
+ l2=QStringList::split(",",s);
+
+ for ( QStringList::Iterator it = l2.begin(); it != l2.end(); ++it ) {
+ QString temp;
+ temp=removeBeginningWhiteSpaces((*it));
+ temp=removeEndingWhiteSpaces(temp);
+ l1.append(temp);
+ }
+
+ m_propertyToParse = l1.join(",");// we eliminte blanks before after a comma in things like "something" , something , serif
+}
+
+CSSSHPropertyParser::~CSSSHPropertyParser(){}
+
+QString CSSSHPropertyParser::removeEndingWhiteSpaces(const QString& s){
+ int index = s.length()-1;
+ while(s[index] == ' ' ) index--;
+ return s.left(index+1);
+}
+
+QString CSSSHPropertyParser::removeBeginningWhiteSpaces(const QString& s){
+ int index = 0;
+ while(s[index] == ' ' ) index++;
+ return s.right(s.length()-index);
+}
+
+QString CSSSHPropertyParser::extractFunctionList(){
+ QRegExp functionListPattern("\\s*([a-zA-Z0-9_]*\\([\\W\\w]*\\))\\s*");
+ functionListPattern.search(m_propertyToParse);
+ return functionListPattern.cap(1);
+}
+
+QString CSSSHPropertyParser::extractQuotedStringList(){
+ QString temp;
+ bool stop = false;
+ unsigned int i=0;
+ while(!stop && i<m_propertyToParse.length() ){
+ if( m_propertyToParse[i] == ' ' ){
+ if( ( temp.contains("\"") + temp.contains("\'") )%2 == 0 ) stop = true;
+ else temp += m_propertyToParse[i];
+ }
+ else temp += m_propertyToParse[i];
+ i++;
+ }
+ return temp;
+}
+
+QString CSSSHPropertyParser::extractURIList(){//extract things like url('...') or url("..") or url("..."), url(.....
+ //kdDebug(24000) << "\n\n\nextractURIList()\n\n\n";
+ QRegExp URIListPattern("\\s*(url\\([\\W\\w]*\\))\\s*");
+ URIListPattern.search(m_propertyToParse);
+ return URIListPattern.cap(1);
+}
+
+QStringList CSSSHPropertyParser::parse(){
+ QStringList tokenList;
+ bool stop = false;
+ m_propertyToParse = removeBeginningWhiteSpaces(m_propertyToParse);
+
+ while(!stop){
+ QString temp;
+ for(unsigned int i=0;i<m_propertyToParse.length() ;i++){
+ if(m_propertyToParse[i] == ' ') break;// tokens are delimited by a blank
+ temp+=m_propertyToParse[i];
+ }
+
+ if(temp.contains("url(") !=0 ){
+ QString foundURIList = extractURIList();
+ m_propertyToParse = removeBeginningWhiteSpaces(m_propertyToParse.remove(foundURIList));
+ tokenList.append(foundURIList);
+ }
+ else
+ if(temp.contains("(")!=0){
+ QString foundFunctionList = extractFunctionList();
+ m_propertyToParse = removeBeginningWhiteSpaces(m_propertyToParse.remove(foundFunctionList));
+ tokenList.append(foundFunctionList);
+ }
+ else
+ if(temp.contains("'")!=0 || temp.contains("\"")!=0 || temp.contains(",")!=0){
+ QString foundQuotedStringList = extractQuotedStringList();
+ m_propertyToParse = removeBeginningWhiteSpaces(m_propertyToParse.remove(foundQuotedStringList));
+ tokenList.append(foundQuotedStringList);
+ }
+ else
+ if(temp.contains("/")!=0){ //treat the presence of line-height in font shorthand form
+ m_propertyToParse = removeBeginningWhiteSpaces(m_propertyToParse.remove(temp));
+ tokenList.append(temp.section("/",0,0));
+ tokenList.append("/"+temp.section("/",1,1));
+ }
+ else {
+ tokenList.append(temp);
+ int tempPos = m_propertyToParse.find(temp);
+ m_propertyToParse = removeBeginningWhiteSpaces(m_propertyToParse.remove(tempPos,temp.length()));
+ }
+ if( m_propertyToParse.isEmpty() ) stop = true;
+ }
+ return tokenList;
+}
+
+
+
+
diff --git a/quanta/components/csseditor/cssshpropertyparser.h b/quanta/components/csseditor/cssshpropertyparser.h
new file mode 100644
index 00000000..dd95eb39
--- /dev/null
+++ b/quanta/components/csseditor/cssshpropertyparser.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Gulmini Luciano *
+ * gulmini.luciano@student.unife.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef CSSSHPROPERTYPARSER_H
+#define CSSSHPROPERTYPARSER_H
+
+/**
+@author Gulmini Luciano
+*/
+#include <qstringlist.h>
+
+class CSSSHPropertyParser{
+
+ public:
+ CSSSHPropertyParser(const QString& s);
+ ~CSSSHPropertyParser();
+ QStringList parse();
+
+ private:
+ QString m_propertyToParse;
+
+ private:
+ QString extractURIList();
+ QString extractFunctionList();
+ QString extractQuotedStringList();
+ QString removeBeginningWhiteSpaces(const QString& s);
+ QString removeEndingWhiteSpaces(const QString& s);
+};
+
+#endif
diff --git a/quanta/components/csseditor/data/Makefile.am b/quanta/components/csseditor/data/Makefile.am
new file mode 100644
index 00000000..01ddeee5
--- /dev/null
+++ b/quanta/components/csseditor/data/Makefile.am
@@ -0,0 +1,3 @@
+cssxmldir= ${quanta_datadir}/csseditor
+cssxml_DATA = config.xml pseudo.xml atrules.xml dtdTags.xml
+
diff --git a/quanta/components/csseditor/data/atrules.xml b/quanta/components/csseditor/data/atrules.xml
new file mode 100644
index 00000000..4d9f0d38
--- /dev/null
+++ b/quanta/components/csseditor/data/atrules.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="iso-8859-1" ?>
+<rules version="2.1">
+ <rule name="charset"/>
+ <rule name="import"/>
+ <rule name="media"/>
+ <rule name="page"/>
+</rules>
diff --git a/quanta/components/csseditor/data/config.xml b/quanta/components/csseditor/data/config.xml
new file mode 100644
index 00000000..15fd659f
--- /dev/null
+++ b/quanta/components/csseditor/data/config.xml
@@ -0,0 +1,609 @@
+<?xml version="1.0" encoding="iso-8859-1" ?>
+<css version="2.1">
+<mediagroup type="aural">
+
+ <azimuth>
+ <list value="leftwards,rightwards,inherit"/>
+ <doubleList>
+ <leftList value="left-side,far-left,left,center-left,center,center-right,right,far-right,right-side"/>
+ <rightList value="behind"/>
+ </doubleList>
+ <angle/>
+ </azimuth>
+
+ <cue hasSub="yes">
+ <cue-after>
+ <uri mode="single" resourceType="audio"/>
+ <list value="none,inherit"/>
+ </cue-after>
+ <cue-before>
+ <uri mode="single" resourceType="audio"/>
+ <list value="none,inherit"/>
+ </cue-before>
+ </cue>
+
+ <elevation>
+ <list value="below,level,above,higher,lower,inherit"/>
+ <angle/>
+ <freeedit/>
+ </elevation>
+
+ <pitch>
+ <list value="inherit,x-low,medium,high,x-high,low"/>
+ <frequency/>
+ <freeedit/>
+ </pitch>
+
+ <pitch-range>
+ <number/>
+ <list value="inherit"/>
+ </pitch-range>
+
+ <play-during>
+ <list value="inherit,none,auto"/>
+ <uri mode="single" resourceType="audio"/>
+ </play-during>
+
+ <pause hasSub="yes">
+ <pause-after>
+ <time/>
+ <percentage/>
+ <list value="inherit"/>
+ <freeedit/>
+ </pause-after>
+ <pause-before>
+ <time/>
+ <percentage/>
+ <list value="inherit"/>
+ <freeedit/>
+ </pause-before>
+ </pause>
+
+ <richness>
+ <number/>
+ <list value="inherit"/>
+ </richness>
+
+ <speach-rate>
+ <list value="inherit,x-slow,medium,slow,fast,x-fast,faster,slower"/>
+ <number/>
+ </speach-rate>
+
+ <speak>
+ <list value="normal,none,spell-out,inherit"/>
+ </speak>
+
+ <speak-punctuation>
+ <list value="code,none,inherit"/>
+ </speak-punctuation>
+
+ <speak-header>
+ <list value="once,always,inherit"/>
+ </speak-header>
+
+ <speak-numeral>
+ <list value="digits,continuous,inherit"/>
+ </speak-numeral>
+
+ <stress>
+ <number/>
+ <list value="inherit"/>
+ </stress>
+
+ <voice-family>
+ <freeedit/>
+ <list value="inherit"/>
+ </voice-family>
+
+ <volume>
+ <list value="silent,x-soft,soft,medium,loud,x-loud,inherit"/>
+ <number/>
+ <percentage/>
+ </volume>
+
+</mediagroup>
+
+<mediagroup type="visual">
+
+ <background hasSub="yes">
+ <background-attachment>
+ <list value="scroll,fixed,inherit"/>
+ </background-attachment>
+ <background-color>
+ <colors/>
+ <list value="transparent,inherit"/>
+ </background-color>
+ <background-image>
+ <uri mode="single" resourceType="image"/>
+ <list value="none,inherit"/>
+ </background-image>
+ <background-position>
+ <doubleList>
+ <leftList value="top,center,bottom"/>
+ <rightList value="left,center,right"/>
+ </doubleList>
+ <freeedit/>
+ <doubleLength/>
+ <doublePercentage/>
+ <list value="inherit" editable="yes"/>
+ </background-position>
+ <background-repeat>
+ <list value="repeat,repeat-x,repeat-y,no-repeat,inherit"/>
+ </background-repeat>
+ </background>
+
+ <border hasSub="yes">
+ <border-collapse>
+ <list value="collapse,separate,inherit"/>
+ </border-collapse>
+ <border-color>
+ <colors/>
+ <list value="transparent,inherit" editable="yes"/>
+ </border-color>
+ <border-spacing>
+ <freeedit/>
+ <doubleLength/>
+ <list value="inherit" editable="yes"/>
+ </border-spacing>
+ <border-style>
+ <list value="none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset,inherit" editable="yes"/>
+ </border-style>
+ <border-top hasSub="yes">
+ <border-top-color>
+ <colors/>
+ <list value="transparent,inherit"/>
+ </border-top-color>
+ <border-top-style>
+ <list value="none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset,inherit"/>
+ </border-top-style>
+ <border-top-width>
+ <length/>
+ <list value="thin,medium,thick,inherit"/>
+ <freeedit/>
+ </border-top-width>
+ </border-top>
+
+ <border-left hasSub="yes">
+
+ <border-left-color>
+ <colors/>
+ <list value="transparent,inherit"/>
+ </border-left-color>
+
+ <border-left-style>
+ <list value="none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset,inherit"/>
+ </border-left-style>
+
+ <border-left-width>
+ <length/>
+ <list value="thin,medium,thick,inherit"/>
+ <freeedit/>
+ </border-left-width>
+
+ </border-left>
+
+ <border-right hasSub="yes">
+
+ <border-right-color>
+ <colors/>
+ <list value="transparent,inherit"/>
+ </border-right-color>
+
+ <border-right-style>
+ <list value="none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset,inherit"/>
+ </border-right-style>
+
+ <border-right-width>
+ <length/>
+ <list value="thin,medium,thick,inherit"/>
+ <freeedit/>
+ </border-right-width>
+
+ </border-right>
+
+ <border-bottom hasSub="yes">
+
+ <border-bottom-color>
+ <colors/>
+ <list value="transparent,inherit"/>
+ </border-bottom-color>
+
+ <border-bottom-style>
+ <list value="none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset,inherit"/>
+ </border-bottom-style>
+
+ <border-bottom-width>
+ <length/>
+ <list value="thin,medium,thick,inherit"/>
+ <freeedit/>
+ </border-bottom-width>
+
+ </border-bottom>
+
+ <border-width>
+ <edit/>
+ <list value="inherit" editable="yes"/>
+ </border-width>
+
+ </border>
+
+ <bottom>
+ <length/>
+ <percentage/>
+ <list value="auto,inherit"/>
+ <freeedit/>
+ </bottom>
+
+ <caption-side>
+ <list value="top,bottom,inherit"/>
+ </caption-side>
+
+ <clear>
+ <list value="none,left,right,both,inherit"/>
+ </clear>
+
+ <clip>
+ <list value="auto,inherit" editable="yes"/>
+ </clip>
+
+ <color>
+ <colors/>
+ <list value="inherit"/>
+ </color>
+
+ <cursor>
+ <list value="inherit,auto,crosshair,default,pointer,move,e-resize,ne-resize,nw-resize,n-resize,se-resize,sw-resize,s-resize,w-resize,text,wait,help,progress"/>
+ <uri mode="multi" resourceType="mousePointer"/>
+ </cursor>
+
+ <direction>
+ <list value="ltr,rtl,inherit"/>
+ </direction>
+
+ <empty-cells>
+ <list value="show,hide,inherit"/>
+ </empty-cells>
+
+ <float>
+ <list value="left,right,none,inherit"/>
+ </float>
+
+ <font>
+ <list value="caption,icon,menu,message-box,small-caption,status-bar"/>
+ </font>
+
+ <font hasSub="yes">
+
+ <font-family>
+ <fontDialog/>
+ </font-family>
+
+ <font-size>
+ <length/>
+ <percentage/>
+ <list value="xx-small,x-small,small,medium,large,x-large,xx-large,larger,smaller,inherit"/>
+ <freeedit/>
+ </font-size>
+
+ <font-style>
+ <list value="normal,italic,oblique,inherit"/>
+ </font-style>
+
+ <font-variant>
+ <list value="normal,small-caps,inherit"/>
+ </font-variant>
+
+ <font-weight>
+ <list value="normal,bold,bolder,lighter,100,200,300,400,500,600,700,800,900,inherit"/>
+ </font-weight>
+
+ </font>
+
+ <height>
+ <length/>
+ <percentage/>
+ <list value="auto,inherit"/>
+ <freeedit/>
+ </height>
+
+ <left>
+ <length/>
+ <percentage/>
+ <list value="auto,inherit"/>
+ <freeedit/>
+ </left>
+
+ <letter-spacing>
+ <length/>
+ <list value="normal,inherit"/>
+ <freeedit/>
+ </letter-spacing>
+
+ <line-height>
+ <length/>
+ <percentage/>
+ <number/>
+ <list value="normal,inherit"/>
+ <freeedit/>
+ </line-height>
+
+ <list-style hasSub="yes">
+ <list-style-image>
+ <uri mode="single" resourceType="image"/>
+ <list value="none,inherit"/>
+ </list-style-image>
+ <list-style-position>
+ <list value="inside,outside,inherit"/>
+ </list-style-position>
+ <list-style-type>
+ <list value="disc,circle,square,decimal,decimal-leading-zero,lower-roman,upper-roman,lower-greek,lower-alpha,lower-latin,upper-alpha,upper-latin,hebrew,armenian,georgian,cjk-ideographic,hiragana,katakana,hiragana-iroha,katakana-iroha,none,inherit"/>
+ </list-style-type>
+ </list-style>
+
+ <margin hasSub="yes">
+ <margin-left>
+ <length/>
+ <percentage/>
+ <list value="auto"/>
+ <freeedit/>
+ </margin-left>
+ <margin-bottom>
+ <length/>
+ <percentage/>
+ <list value="auto"/>
+ <freeedit/>
+ </margin-bottom>
+ <margin-right>
+ <length/>
+ <percentage/>
+ <list value="auto"/>
+ <freeedit/>
+ </margin-right>
+ <margin-top>
+ <length/>
+ <percentage/>
+ <list value="auto"/>
+ <freeedit/>
+ </margin-top>
+ </margin>
+
+ <max-height>
+ <length/>
+ <percentage/>
+ <list value="none,inherit"/>
+ <freeedit/>
+ </max-height>
+
+ <max-width>
+ <length/>
+ <percentage/>
+ <list value="none,inherit"/>
+ <freeedit/>
+ </max-width>
+
+ <min-height>
+ <length/>
+ <percentage/>
+ <list value="none,inherit"/>
+ <freeedit/>
+ </min-height>
+
+ <min-width>
+ <length/>
+ <percentage/>
+ <list value="none,inherit"/>
+ <freeedit/>
+ </min-width>
+
+ <outline hasSub="yes">
+ <outline-color>
+ <colors/>
+ <list value="invert,inherit"/>
+ </outline-color>
+ <outline-style>
+ <list value="none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset,inherit"/>
+ </outline-style>
+ <outline-width>
+ <length/>
+ <list value="thin,medium,thick,inherit"/>
+ <freeedit/>
+ </outline-width>
+ </outline>
+
+ <overflow>
+ <list value="visible,hidden,scroll,auto,inherit"/>
+ </overflow>
+
+ <padding hasSub="yes">
+ <padding-top>
+ <length/>
+ <list value="thin,medium,thick,inherit"/>
+ <freeedit/>
+ </padding-top>
+ <padding-right>
+ <length/>
+ <list value="thin,medium,thick,inherit"/>
+ <freeedit/>
+ </padding-right>
+ <padding-bottom>
+ <length/>
+ <list value="thin,medium,thick,inherit"/>
+ <freeedit/>
+ </padding-bottom>
+ <padding-left>
+ <length/>
+ <list value="thin,medium,thick,inherit"/>
+ <freeedit/>
+ </padding-left>
+ </padding>
+
+ <page>
+ <freeedit/>
+ <list value="auto"/>
+ </page>
+
+ <page-break-after>
+ <list value="auto,always,avoid,left,right,inherit"/>
+ </page-break-after>
+
+ <page-break-before>
+ <list value="auto,always,avoid,left,right,inherit"/>
+ </page-break-before>
+
+ <page-break-inside>
+ <list value="avoid,auto,inherit"/>
+ </page-break-inside>
+
+ <position>
+ <list value="static,relative,absolute,fixed,inherit"/>
+ </position>
+
+ <quotes>
+ <list value="none,inherit" editable="yes"/>
+ </quotes>
+
+ <right>
+ <length/>
+ <percentage/>
+ <list value="auto,inherit"/>
+ <freeedit/>
+ </right>
+
+ <table-layout>
+ <list value="auto,fixed,inherit"/>
+ </table-layout>
+
+ <text-align>
+ <list value="center,justify,right,left,inherit"/>
+ </text-align>
+
+ <text-decoration>
+ <list value="none,underline,overline,line-through,blink,inherit"/>
+ <doubleList>
+ <leftList value="none,underline,overline,line-through,blink,inherit"/>
+ <rightList value="none,underline,overline,line-through,blink,inherit"/>
+ </doubleList>
+ </text-decoration>
+
+ <text-indent>
+ <length/>
+ <percentage/>
+ <list value="inherit"/>
+ <freeedit/>
+ </text-indent>
+
+ <text-transform>
+ <list value="capitalize,uppercase,lowercase,none,inherit"/>
+ </text-transform>
+
+ <top>
+ <length/>
+ <percentage/>
+ <list value="auto,inherit"/>
+ <freeedit/>
+ </top>
+
+ <unicode-bidi>
+ <list value="normal,embed,bidi-override,inherit"/>
+ </unicode-bidi>
+
+ <vertical-align>
+ <list value="baseline,inherit,sub,super,top,text-top,middle,bottom,text-bottom"/>
+ <length/>
+ <percentage/>
+ <freeedit/>
+ </vertical-align>
+
+ <visibility>
+ <list value="visible,hidden,collapse,inherit"/>
+ </visibility>
+
+ <white-space>
+ <list value="normal,pre,pre-wrap,pre-line,nowrap,inherit"/>
+ </white-space>
+
+ <width>
+ <length/>
+ <percentage/>
+ <list value="auto,inherit"/>
+ <freeedit/>
+ </width>
+
+ <word-spacing>
+ <length/>
+ <list value="auto,inherit"/>
+ <freeedit/>
+ </word-spacing>
+
+ <z-index>
+ <integer minValue="-9999"/>
+ <list value="inherit,auto"/>
+ </z-index>
+
+</mediagroup>
+
+<mediagroup type="paged">
+
+ <page>
+ <list value="auto"/>
+ <freeedit/>
+ </page>
+
+ <page-break-after>
+ <list value="auto,always,avoid,left,right,inherit"/>
+ </page-break-after>
+
+ <page-break-before>
+ <list value="auto,always,avoid,left,right,inherit"/>
+ </page-break-before>
+
+ <page-break-inside>
+ <list value=",avoid,auto,inherit"/>
+ </page-break-inside>
+
+</mediagroup>
+
+<mediagroup type="interactive">
+
+ <cursor>
+ <list value="inherit,auto,crosshair,default,pointer,move,e-resize,ne-resize,nw-resize,n-resize,se-resize,sw-resize,s-resize,w-resize,text,wait,help,progress"/>
+ <uri mode="multi" resourceType="mousePointer"/>
+ </cursor>
+
+ <outline hasSub="yes">
+ <outline-color>
+ <colors/>
+ <list value="invert,inherit"/>
+ </outline-color>
+ <outline-style>
+ <list value="none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset,inherit"/>
+ </outline-style>
+ <outline-width>
+ <length/>
+ <list value="thin,medium,thick,inherit"/>
+ <freeedit/>
+ </outline-width>
+ </outline>
+
+</mediagroup>
+
+<mediagroup type="all">
+
+ <content>
+ <list value="open-quote,close-quote,no-open-quote,no-close-quote,inherit" editable="yes"/>
+ </content>
+
+ <counter-increment>
+ <list value="none,inherit" editable="yes"/>
+ </counter-increment>
+
+ <counter-reset>
+ <list value="none,inherit" editable="yes"/>
+ </counter-reset>
+
+ <display>
+ <list value="inline,inline-block,block,list-item,run-in,table,inline-table,table-row-group,table-header-group,table-footer-group,table-row,table-column-group,table-column,table-cell,table-caption,none,inherit"/>
+ </display>
+
+ </mediagroup>
+</css>
diff --git a/quanta/components/csseditor/data/dtdTags.xml b/quanta/components/csseditor/data/dtdTags.xml
new file mode 100644
index 00000000..1ce44d82
--- /dev/null
+++ b/quanta/components/csseditor/data/dtdTags.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="iso-8859-1" ?>
+<dtds>
+ <dtd default="yes" name="" nickName="HTML strict">style,link,h1,h2,h3,h4,h5,h6,ul,pre,tt,i,b,big,em,strong,dfn,code,samp,kbd,var,cite,abbr,acronym,img,br,script,map,span,bdo,select,textarea,label,button,p,dl,div,noscript,blockquote,hr,table,fieldset,body,address,a,area,object,param,small,sub,sup,q,dt,dd,ol,li,form,text,password,checkbox,radio,submit,reset,file,hidden,input,optgroup,option,legend,caption,thead,tfoot,tbody,colgroup,col,tr,th,td,head,title,base,meta,html</dtd>
+ <dtd name="-//w3c//dtd html 4.01 transitional//en" nickName="HTML transitional">a,abbr,acronym,address,applet,area,b,base,basefont,bdo,big,blockquote,body,br,button,caption,center,cite,code,col,colgroup,div,dfn,del,dl,dt,dd,dir,em,fieldset,frameset,frame,font,form,kbd,head,html,hr,h1,h2,h3,h4,h5,h6,i,iframe,img,input,ins,isindex,label,legend,li,link,map,menu,meta,noframes,noscript,object,ol,optgroup,option,p,param,pre,q,s,samp,script,select,small,span,strike,strong,style,sub,sup,table,textarea,tt,thead,tfoot,tbody,tr,th,td,title,u,ul,usemap,var</dtd>
+ <dtd name="-//W3C//DTD MathML 2.0//EN" nickName="MathML">mi,mn,mo,mtext,mspace,ms,mglyph,mrow,mfrac,msrqt,mroot,mstyle,merror,mpadded,mphantom,mfenced,menclose,msub,msup,msubsup,munder,mover,munderover,nmultiscripts,mtable,mtr,mlabeldtr,mtd,maction</dtd>
+</dtds>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/quanta/components/csseditor/data/pseudo.xml b/quanta/components/csseditor/data/pseudo.xml
new file mode 100644
index 00000000..354544ff
--- /dev/null
+++ b/quanta/components/csseditor/data/pseudo.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="iso-8859-1" ?>
+<pseudo>
+ <element name="after"/>
+ <element name="before"/>
+ <element name="first-child"/>
+ <element name="first-letter"/>
+ <element name="first-line" appliesTo="p"/>
+ <class name="active"/>
+ <class name="focus"/>
+ <class name="hover"/>
+ <class name="lang"/>
+ <class name="link"/>
+ <class name="visited"/>
+</pseudo> \ No newline at end of file
diff --git a/quanta/components/csseditor/doubleeditors.cpp b/quanta/components/csseditor/doubleeditors.cpp
new file mode 100644
index 00000000..6fab0547
--- /dev/null
+++ b/quanta/components/csseditor/doubleeditors.cpp
@@ -0,0 +1,120 @@
+/***************************************************************************
+ doubleeditors.cpp - description
+ -------------------
+ begin : dom ago 3 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+ #include "doubleeditors.h"
+ #include "specialsb.h"
+ #include <qcombobox.h>
+ #include "csseditor_globals.h"
+ #include "propertysetter.h"
+ #include <qregexp.h>
+
+
+
+doubleEditorBase::doubleEditorBase(QWidget *parent, const char *name) : miniEditor(parent,name){
+}
+
+void doubleEditorBase::sxValueSlot(const QString& v){
+ m_sxValue=v;
+ emit valueChanged( m_sxValue +" " + m_dxValue);
+}
+
+void doubleEditorBase::dxValueSlot(const QString& v){
+ m_dxValue=v;
+ emit valueChanged( m_sxValue +" " + m_dxValue);
+}
+
+ doubleLengthEditor::doubleLengthEditor(QWidget *parent, const char *name) : doubleEditorBase(parent,name){
+
+ m_ssbSx = new specialSB(this);
+ m_ssbSx->insertItem("cm");
+ m_ssbSx->insertItem("em");
+ m_ssbSx->insertItem("ex");
+ m_ssbSx->insertItem("in");
+ m_ssbSx->insertItem("mm");
+ m_ssbSx->insertItem("pc");
+ m_ssbSx->insertItem("pt");
+ m_ssbSx->insertItem("px");
+
+ m_ssbDx = new specialSB(this);
+ m_ssbDx->insertItem("cm");
+ m_ssbDx->insertItem("em");
+ m_ssbDx->insertItem("ex");
+ m_ssbDx->insertItem("in");
+ m_ssbDx->insertItem("mm");
+ m_ssbDx->insertItem("pc");
+ m_ssbDx->insertItem("pt");
+ m_ssbDx->insertItem("px");
+
+ connect(m_ssbSx, SIGNAL(valueChanged(const QString&)), this, SLOT(sxValueSlot(const QString&)));
+ connect(m_ssbDx, SIGNAL(valueChanged(const QString&)), this, SLOT(dxValueSlot(const QString&)));
+}
+
+doubleLengthEditor::~doubleLengthEditor(){
+ delete m_ssbSx;
+ delete m_ssbDx;
+}
+
+void doubleLengthEditor::connectToPropertySetter(propertySetter* p){
+ connect(this, SIGNAL(valueChanged(const QString&)), p ,SIGNAL(valueChanged(const QString&)));
+}
+
+void doubleLengthEditor::setInitialValue(const QString& sx, const QString& dx){
+ m_ssbSx->setInitialValue(sx);
+ m_ssbDx->setInitialValue(dx);
+}
+
+doubleComboBoxEditor::doubleComboBoxEditor(QWidget *parent, const char *name) : doubleEditorBase(parent,name){
+ m_cbSx = new QComboBox(this);
+ m_cbDx = new QComboBox(this);
+ connect(m_cbSx, SIGNAL(activated ( const QString & )), this, SLOT(sxValueSlot(const QString&)));
+ connect(m_cbDx, SIGNAL(activated ( const QString & )), this, SLOT(dxValueSlot(const QString&)));
+}
+
+doubleComboBoxEditor::~doubleComboBoxEditor(){
+ delete m_cbSx;
+ delete m_cbDx;
+}
+
+void doubleComboBoxEditor::connectToPropertySetter(propertySetter* p){
+ connect(this, SIGNAL(valueChanged(const QString&)), p ,SIGNAL(valueChanged(const QString&)));
+}
+
+doublePercentageEditor::doublePercentageEditor(QWidget *parent, const char *name) : doubleEditorBase(parent,name){
+ m_sbSx = new mySpinBox(this);
+ m_sbDx = new mySpinBox(this);
+ m_sbSx->setSuffix("%");
+ m_sbDx->setSuffix("%");
+ connect(m_sbSx,SIGNAL(valueChanged(const QString&)),this,SLOT(sxValueSlot(const QString&)));
+ connect(m_sbDx,SIGNAL(valueChanged(const QString&)),this,SLOT(dxValueSlot(const QString&)));
+}
+
+doublePercentageEditor::~doublePercentageEditor(){
+ delete m_sbSx;
+ delete m_sbDx;
+}
+
+void doublePercentageEditor::connectToPropertySetter(propertySetter* p){
+ connect(this, SIGNAL(valueChanged(const QString&)), p ,SIGNAL(valueChanged(const QString&)));
+}
+
+void doublePercentageEditor::setInitialValue(const QString& a_sx, const QString& a_dx){
+ QString sx = a_sx;
+ QString dx = a_dx;
+ m_sbSx->setValue(sx.remove("%").toInt());
+ m_sbDx->setValue(dx.remove("%").toInt());
+}
+
+#include "doubleeditors.moc"
diff --git a/quanta/components/csseditor/doubleeditors.h b/quanta/components/csseditor/doubleeditors.h
new file mode 100644
index 00000000..6496a6fa
--- /dev/null
+++ b/quanta/components/csseditor/doubleeditors.h
@@ -0,0 +1,86 @@
+/***************************************************************************
+ doubleeditors.h - description
+ -------------------
+ begin : dom ago 3 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+ #ifndef DOUBLEEDITORS_H
+ #define DOUBLEEDITORS_H
+ #include "minieditor.h"
+
+ class mySpinBox;
+ class specialSB;
+ class QSpinBox;
+ class QComboBox;
+
+class doubleEditorBase : public miniEditor {
+ Q_OBJECT
+ protected:
+ QString m_sxValue,
+ m_dxValue;
+
+ public:
+ doubleEditorBase(QWidget *parent=0, const char *name=0);
+ virtual ~doubleEditorBase(){}
+ virtual void setInitialValue(){}
+ virtual void connectToPropertySetter(propertySetter* /*p*/){}
+
+ public slots:
+ void sxValueSlot(const QString&);
+ void dxValueSlot(const QString&);
+
+ signals:
+ void valueChanged(const QString&);
+};
+
+class doublePercentageEditor : public doubleEditorBase {
+ Q_OBJECT
+ private:
+ mySpinBox *m_sbSx,
+ *m_sbDx;
+
+ public:
+ doublePercentageEditor(QWidget *parent=0, const char *name=0);
+ virtual ~doublePercentageEditor();
+ virtual void setInitialValue(const QString& sx, const QString& dx);
+ virtual void connectToPropertySetter(propertySetter* p);
+};
+
+class doubleComboBoxEditor : public doubleEditorBase {
+ Q_OBJECT
+ private:
+ QComboBox *m_cbSx,
+ *m_cbDx;
+
+ public:
+ doubleComboBoxEditor(QWidget *parent=0, const char *name=0);
+ virtual ~doubleComboBoxEditor();
+ QComboBox* cbSx() const { return m_cbSx;}
+ QComboBox* cbDx() const { return m_cbDx;}
+ virtual void connectToPropertySetter(propertySetter* p);
+};
+
+class doubleLengthEditor : public doubleEditorBase {
+ Q_OBJECT
+ private:
+ specialSB *m_ssbSx,
+ *m_ssbDx;
+
+ public:
+ doubleLengthEditor(QWidget *parent=0, const char *name=0);
+ virtual ~doubleLengthEditor();
+ virtual void setInitialValue(const QString& sx, const QString& dx);
+ virtual void connectToPropertySetter(propertySetter* p);
+};
+
+#endif
diff --git a/quanta/components/csseditor/encodingselector.cpp b/quanta/components/csseditor/encodingselector.cpp
new file mode 100644
index 00000000..3eeb593b
--- /dev/null
+++ b/quanta/components/csseditor/encodingselector.cpp
@@ -0,0 +1,47 @@
+/***************************************************************************
+ encodingselector.cpp - description
+ -------------------
+ begin : mer ago 6 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+
+#include "encodingselector.h"
+#include <kglobal.h>
+#include <kcharsets.h>
+#include <qtextcodec.h>
+
+/**
+ *@author gulmini luciano
+ */
+
+encodingSelector::encodingSelector(QWidget *parent, const char* name) : encodingSelectorS(parent,name){
+ QStringList encodings (KGlobal::charsets()->availableEncodingNames());
+ int insert = 0;
+ for (uint i=0; i < encodings.count(); i++) {
+ bool found = false;
+ QTextCodec *codecForEnc = KGlobal::charsets()->codecForName(encodings[i], found);
+
+ if (found){
+ cbEncoding->insertItem (encodings[i]);
+ insert++;
+ }
+ }
+}
+
+encodingSelector::~encodingSelector(){}
+
+
+
+#include "encodingselector.moc"
diff --git a/quanta/components/csseditor/encodingselector.h b/quanta/components/csseditor/encodingselector.h
new file mode 100644
index 00000000..3b10fa23
--- /dev/null
+++ b/quanta/components/csseditor/encodingselector.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ encodingselector.h - description
+ -------------------
+ begin : mer ago 6 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef ENCODINGSELECTOR_H
+#define ENCODINGSELECTOR_H
+
+
+#include "encodingselectors.h"
+#include <qcombobox.h>
+
+/**
+ *@author gulmini luciano
+ */
+
+class encodingSelector : public encodingSelectorS {
+ Q_OBJECT
+
+ public:
+ encodingSelector(QWidget *parent=0, const char* name=0);
+ ~encodingSelector();
+ QString encodingSet() const { return cbEncoding->currentText();}
+
+ };
+
+#endif
+
diff --git a/quanta/components/csseditor/encodingselectors.ui b/quanta/components/csseditor/encodingselectors.ui
new file mode 100644
index 00000000..45d269de
--- /dev/null
+++ b/quanta/components/csseditor/encodingselectors.ui
@@ -0,0 +1,115 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>encodingSelectorS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>encodingSelectorS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>228</width>
+ <height>109</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Encoding Selector</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Select encoding:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>cbEncoding</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>pbOk</sender>
+ <signal>clicked()</signal>
+ <receiver>encodingSelectorS</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>pbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>encodingSelectorS</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/quanta/components/csseditor/fontfamilychooser.cpp b/quanta/components/csseditor/fontfamilychooser.cpp
new file mode 100644
index 00000000..d42139f8
--- /dev/null
+++ b/quanta/components/csseditor/fontfamilychooser.cpp
@@ -0,0 +1,175 @@
+/***************************************************************************
+ fontfamilychooser.cpp - description
+ -------------------
+ begin : mer lug 23 11:20:17 CEST 2003
+ copyright : (C) |YEAR| by si2003 email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "fontfamilychooser.h"
+
+#include <qfontdatabase.h>
+#include <qstringlist.h>
+#include <qlistbox.h>
+#include <qfont.h>
+#include <klocale.h>
+#include <qiconset.h>
+#include <qpixmap.h>
+#include <kiconloader.h>
+#include <kpushbutton.h>
+#include <kglobalsettings.h>
+#include <qregexp.h>
+#include <qlineedit.h>
+#include <qwhatsthis.h>
+
+#include<kdebug.h>
+
+fontFamilyChooser::fontFamilyChooser(QWidget* parent, const char *name) : fontFamilyChooserS(parent,name){
+
+ QFont tmpFont( KGlobalSettings::generalFont().family(), 64, QFont::Black );
+ lePreview->setMinimumHeight( lePreview->fontMetrics().lineSpacing() );
+ lePreview->setAlignment(Qt::AlignCenter);
+ QFont font;
+ font.setPointSize(20);
+ lePreview->setFont(font);
+ lePreview->setText(i18n("The Quick Brown Fox Jumps Over The Lazy Dog"));
+
+ QFontDatabase fdb;
+ QStringList families = fdb.families();
+ for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it ) {
+ if( (*it).contains('[') !=0 )
+ it = families.remove(it);
+ }
+
+ if( families.count() != 0 ) lbAvailable->insertStringList(families);
+
+
+ QIconSet iconSet = SmallIconSet(QString::fromLatin1("forward"));
+ QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
+ pbAdd->setIconSet(iconSet);
+ pbAdd->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
+
+ iconSet = SmallIconSet(QString::fromLatin1("back"));
+ pbRemove->setIconSet(iconSet);
+ pbRemove->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
+
+ iconSet = SmallIconSet(QString::fromLatin1("up"));
+ pbMoveUp->setIconSet(iconSet);
+ pbMoveUp->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
+
+ iconSet = SmallIconSet(QString::fromLatin1("down"));
+ pbMoveDown->setIconSet(iconSet);
+ pbMoveDown->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
+
+ connect(pbAdd, SIGNAL(clicked()), this ,SLOT( addFont() ));
+ connect( lbAvailable, SIGNAL( highlighted( const QString& ) ), this, SLOT( updatePreview( const QString&) ) );
+ connect( lbAvailable, SIGNAL( highlighted( const QString& ) ), this, SLOT( setCurrentSelectedAvailableFamilyFont( const QString&) ) );
+ connect( lbGeneric, SIGNAL( highlighted( const QString& ) ), this, SLOT( updatePreview( const QString&) ) );
+ connect( lbGeneric, SIGNAL( highlighted( const QString& ) ), this, SLOT( setCurrentSelectedGenericFamilyFont( const QString&) ) );
+ connect( lbSelected, SIGNAL( highlighted( const QString& ) ), this, SLOT( updatePreview( const QString&) ) );
+ connect( lbSelected, SIGNAL( highlighted( int ) ), this, SLOT( setCurrentSelectedFont( int ) ) );
+ connect( lbSelected, SIGNAL( highlighted( const QString& ) ), this, SLOT( setCurrentSelectedFont( const QString&) ) );
+ connect( pbRemove, SIGNAL( clicked() ), this, SLOT( removeFont() ) );
+ connect( pbMoveUp, SIGNAL( clicked() ), this, SLOT( moveFontUp() ) );
+ connect( pbMoveDown, SIGNAL( clicked() ), this, SLOT( moveFontDown() ) );
+
+ QWhatsThis::add(lbAvailable,i18n("These are the names of the available fonts on your system"));
+ QWhatsThis::add(lbGeneric,i18n("These are the names of the generic fonts "));
+ QWhatsThis::add(lbSelected,i18n("These are the names of the generic fonts you have selected "));
+ QWhatsThis::add(pbAdd,i18n("Click this to add a font to your style sheet"));
+ QWhatsThis::add(pbRemove,i18n("Click this to remove a font from your style sheet"));
+ QWhatsThis::add(pbMoveUp,i18n("Click this to make the font more preferable than the preceeding one"));
+ QWhatsThis::add(pbMoveDown,i18n("Click this to make the font less preferable than the following one"));
+
+}
+
+fontFamilyChooser::~fontFamilyChooser(){}
+
+void fontFamilyChooser::updatePreview(const QString& s){
+ lePreview->setFont(QFont(s,20));
+}
+
+void fontFamilyChooser::addFont(){
+ lbSelected->insertItem( m_currentSelectedFont );
+ switch(m_fontOrigin) {
+ case available: lbAvailable->removeItem(lbAvailable->index(lbAvailable->findItem(m_currentSelectedFont)));
+ break;
+ case generic : lbGeneric->removeItem(lbGeneric->index(lbGeneric->findItem(m_currentSelectedFont)));
+ break;
+ }
+}
+
+void fontFamilyChooser::setCurrentSelectedAvailableFamilyFont(const QString& f){
+ m_fontOrigin = available;
+ m_currentSelectedFont = f;
+ m_selectedFontMap[f] = available;
+}
+
+void fontFamilyChooser::setCurrentSelectedGenericFamilyFont(const QString& f){
+ m_fontOrigin = generic;
+ m_currentSelectedFont =f;
+ m_selectedFontMap[f] = generic;
+}
+
+void fontFamilyChooser::moveFontUp(){
+ if(m_currentSelectedFontIndex == 0) return;
+ int dummyIndex = m_currentSelectedFontIndex;
+ lbSelected->insertItem( lbSelected->text(m_currentSelectedFontIndex ), dummyIndex -1);
+ lbSelected->removeItem(dummyIndex + 1);
+ lbSelected->setSelected( dummyIndex -1, true);
+}
+
+void fontFamilyChooser::moveFontDown(){
+ if((unsigned int)m_currentSelectedFontIndex == lbSelected->count()) return;
+ int dummyIndex = m_currentSelectedFontIndex;
+ lbSelected->insertItem( lbSelected->text(m_currentSelectedFontIndex ), dummyIndex + 2);
+ lbSelected->removeItem(dummyIndex);
+ lbSelected->setSelected(dummyIndex +1, true);
+}
+
+void fontFamilyChooser::removeFont(){
+ QString dummyFont(m_currentSelectedFont);// since removeItem emits highlighted signal, after
+ // removeItem call the value of m_currentSelectedFont
+ // is actually the font after m_currentSelectedFont and so
+ // we must save m_currentSelectedFont value in dummyFont
+ lbSelected->removeItem( m_currentSelectedFontIndex );
+ switch(m_selectedFontMap[dummyFont]) {
+ case available: lbAvailable->insertItem(dummyFont);
+ lbAvailable->sort();
+ break;
+ case generic : lbGeneric->insertItem(dummyFont);
+ lbGeneric->sort();
+ break;
+ }
+
+}
+
+QStringList fontFamilyChooser::fontList(){
+ QStringList list;
+ QListBoxItem *item = lbSelected->firstItem();
+ while( item != 0 ){
+ if( item->text().contains( QRegExp("\\W") ) ) list.append( "'" + item->text() + "'" );
+ else list.append( item->text() );
+ item = item->next();
+ }
+ return list;
+}
+
+void fontFamilyChooser::setInitialValue(const QString& s){
+ QStringList familyList = QStringList::split(",",s);
+ for ( QStringList::Iterator it = familyList.begin(); it != familyList.end(); ++it ) {
+ (*it).remove("'");
+ (*it).remove("\"");
+ lbSelected->insertItem((*it).stripWhiteSpace());
+ }
+}
+
+#include "fontfamilychooser.moc"
diff --git a/quanta/components/csseditor/fontfamilychooser.h b/quanta/components/csseditor/fontfamilychooser.h
new file mode 100644
index 00000000..c812e774
--- /dev/null
+++ b/quanta/components/csseditor/fontfamilychooser.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ fontfamilychooser.h - description
+ -------------------
+ begin : mer lug 23 11:20:17 CEST 2003
+ copyright : (C) |YEAR| by si2003 email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef FONTFAMILYCHOOSER_H
+#define FONTFAMILYCHOOSER_H
+
+#include "fontfamilychoosers.h"
+#include <qmap.h>
+class QStringList;
+
+class fontFamilyChooser : public fontFamilyChooserS
+{
+ Q_OBJECT
+ private:
+ enum FontOrigin { available, generic };
+ QString m_currentSelectedFont;
+ FontOrigin m_fontOrigin;
+ int m_currentSelectedFontIndex;
+ QMap<QString,FontOrigin> m_selectedFontMap;
+
+ private slots:
+ void updatePreview(const QString &);
+ void setCurrentSelectedAvailableFamilyFont(const QString&);
+ void setCurrentSelectedGenericFamilyFont(const QString&);
+ void setCurrentSelectedFont( int i) { m_currentSelectedFontIndex = i; }
+ void setCurrentSelectedFont( const QString& f ) { m_currentSelectedFont = f; }
+ void addFont();
+ void removeFont();
+ void moveFontUp();
+ void moveFontDown();
+
+ public:
+ fontFamilyChooser(QWidget* parent, const char *name=0);
+ ~fontFamilyChooser();
+ QStringList fontList();
+ void setInitialValue(const QString& s);
+};
+
+#endif
diff --git a/quanta/components/csseditor/fontfamilychoosers.ui b/quanta/components/csseditor/fontfamilychoosers.ui
new file mode 100644
index 00000000..1b846446
--- /dev/null
+++ b/quanta/components/csseditor/fontfamilychoosers.ui
@@ -0,0 +1,441 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>fontFamilyChooserS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>fontFamilyChooserS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>487</width>
+ <height>399</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>Font Family Chooser</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout42</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout40</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout39</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout36</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Available system font families:</string>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>lbAvailable</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout15</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Generic family:</string>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <item>
+ <property name="text">
+ <string>cursive</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>fantasy</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>monospace</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>sans-serif</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>serif</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>lbGeneric</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout38</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="lineWidth">
+ <number>2</number>
+ </property>
+ <property name="midLineWidth">
+ <number>0</number>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <property name="radioButtonExclusive">
+ <bool>false</bool>
+ </property>
+ <property name="selectedId" stdset="0">
+ <number>-1</number>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="KPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>pbMoveUp</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="1" column="2">
+ <property name="name">
+ <cstring>pbAdd</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>pbRemove</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>pbMoveDown</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer21</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Selected font families:</string>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>lbSelected</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>lePreview</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout41</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>313</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>pbOK</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>pbCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>pbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>fontFamilyChooserS</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>pbOK</sender>
+ <signal>clicked()</signal>
+ <receiver>fontFamilyChooserS</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/quanta/components/csseditor/minieditor.h b/quanta/components/csseditor/minieditor.h
new file mode 100644
index 00000000..773ed285
--- /dev/null
+++ b/quanta/components/csseditor/minieditor.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ minieditor.h - description
+ -------------------
+ begin : lun ago 9 2004
+ copyright : (C) 2004 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef MINIEDITOR_H
+#define MINIEDITOR_H
+
+#include <qhbox.h>
+
+/**
+ *@author gulmini luciano
+ */
+
+class propertySetter;
+
+class miniEditor : public QHBox{
+ public:
+ miniEditor(QWidget *parent=0, const char *name=0):QHBox(parent,name){}
+ ~miniEditor(){}
+ virtual void connectToPropertySetter(propertySetter* p)=0;
+};
+
+
+#endif
diff --git a/quanta/components/csseditor/percentageeditor.cpp b/quanta/components/csseditor/percentageeditor.cpp
new file mode 100644
index 00000000..0c8a9d6c
--- /dev/null
+++ b/quanta/components/csseditor/percentageeditor.cpp
@@ -0,0 +1,38 @@
+/***************************************************************************
+ percentageeditor.cpp - description
+ -------------------
+ begin : lun ago 9 2004
+ copyright : (C) 2004 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "percentageeditor.h"
+#include "propertysetter.h"
+
+percentageEditor::percentageEditor(const QString& initialValue, QWidget *parent, const char *name) : miniEditor(parent,name)
+{
+ QString temp(initialValue);
+ m_sb = new mySpinBox(0,9999,1,this);
+ m_sb->setValue(temp.remove("%").toInt());
+ m_sb->setSuffix("%");
+ connect(m_sb, SIGNAL(valueChanged ( const QString & )), this, SIGNAL(valueChanged(const QString&)));
+}
+
+percentageEditor::~percentageEditor()
+{
+ delete m_sb;
+}
+
+void percentageEditor::connectToPropertySetter(propertySetter* p){
+ connect( this, SIGNAL(valueChanged(const QString&)), p, SIGNAL(valueChanged(const QString&)));
+}
+
+#include "percentageeditor.moc"
diff --git a/quanta/components/csseditor/percentageeditor.h b/quanta/components/csseditor/percentageeditor.h
new file mode 100644
index 00000000..d6931aec
--- /dev/null
+++ b/quanta/components/csseditor/percentageeditor.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ percentageeeditor.h - description
+ -------------------
+ begin : lun ago 9 2004
+ copyright : (C) 2004 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef PERCENTAGEEDITOR_H
+#define PERCENTAGEEDITOR_H
+
+#include <qhbox.h>
+#include <qptrlist.h>
+#include "doubleeditors.h"
+#include <qcombobox.h>
+#include <qslider.h>
+
+#include "csseditor_globals.h"
+#include "minieditor.h"
+
+class KPushButton;
+
+
+/**
+ *@author gulmini luciano
+ */
+
+class propertySetter;
+
+class percentageEditor : public miniEditor {
+ Q_OBJECT
+ private:
+ mySpinBox *m_sb;
+ public:
+ percentageEditor(const QString& initialValue="0",QWidget *parent=0, const char *name=0);
+ ~percentageEditor();
+ virtual void connectToPropertySetter(propertySetter* p);
+ signals:
+ void valueChanged(const QString&);
+};
+
+
+#endif
diff --git a/quanta/components/csseditor/propertysetter.cpp b/quanta/components/csseditor/propertysetter.cpp
new file mode 100644
index 00000000..683320ae
--- /dev/null
+++ b/quanta/components/csseditor/propertysetter.cpp
@@ -0,0 +1,129 @@
+/***************************************************************************
+ propertysetter.cpp - description
+ -------------------
+ begin : gio lug 24 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "propertysetter.h"
+
+#include <qlineedit.h>
+#include <qcombobox.h>
+#include <qspinbox.h>
+#include <qlabel.h>
+#include <qtooltip.h>
+#include <qregexp.h>
+#include <qvbox.h>
+
+#include <kpushbutton.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <klineedit.h>
+
+
+#include "csseditor_globals.h"
+#include "minieditor.h"
+
+propertySetter::propertySetter(QWidget *parent, const char *name ) : QHBox(parent,name) {
+ m_ind = 0;
+ m_cb = 0L;
+ m_list.setAutoDelete(true);
+ m_pb = 0L;
+ setSpacing( KDialog::spacingHint() );
+}
+
+propertySetter::~propertySetter(){
+ reset();
+}
+
+void propertySetter::reset(){
+ if(!m_list.isEmpty()) m_list.clear();
+ if(m_pb) {
+ delete m_pb;
+ m_pb=0L;
+ }
+ m_ind=0;
+}
+
+void propertySetter::setComboBox()
+{
+ m_cb = new QComboBox(this);
+ connect(m_cb, SIGNAL(activated(const QString&)), this, SIGNAL(valueChanged(const QString&)));
+ connect(m_cb, SIGNAL(textChanged(const QString&)), this, SIGNAL(valueChanged(const QString&)));
+ m_list.append(m_cb);
+}
+
+void propertySetter::setSpinBox(const QString& initialValue, const QString& min, const QString& max, const QString& s)
+{
+ mySpinBox *editor = new mySpinBox(min.toInt(), max.toInt(), 1, this);
+ editor->setSuffix(s);
+ editor->setValue(initialValue.toInt());
+ connect(editor, SIGNAL(valueChanged(const QString&)), this ,SIGNAL(valueChanged(const QString&)));
+ m_list.append(editor);
+}
+
+void propertySetter::setLineEdit()
+{
+ QLineEdit *editor = new QLineEdit(this);
+ connect(editor,SIGNAL(textChanged ( const QString & )), this, SIGNAL(valueChanged ( const QString & )));
+ m_list.append(editor);
+}
+
+void propertySetter::setPredefinedColorListEditor()
+{
+ QComboBox *editor = new QComboBox(this);
+ editor->insertStringList(CSSEditorGlobals::HTMLColors);
+ connect(editor, SIGNAL(activated(const QString&)), this, SIGNAL(valueChanged(const QString&)));
+ m_list.append(editor);
+}
+
+void propertySetter::Show(){
+ QWidget *w;
+ for ( w = m_list.first(); w; w = m_list.next() )
+ w->hide();
+
+ m_list.at(m_ind)->show();
+
+ if(m_list.count() == 1) {
+ if(m_pb)
+ m_pb->hide();
+ }
+ else
+ if(m_ind<(m_list.count()-1)) {
+ m_ind++;
+ m_pb->show();
+ }
+ else
+ m_ind=0;
+}
+
+void propertySetter::addButton(){
+
+ m_pb = new KPushButton(this);
+ QToolTip::add(m_pb, i18n( "More..." ));
+ QIconSet iconSet = SmallIconSet(QString::fromLatin1("2rightarrow"));
+ QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
+ m_pb->setIconSet(iconSet);
+ m_pb->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
+ m_pb->hide();
+ connect(m_pb, SIGNAL(clicked()), this ,SLOT(Show()));
+}
+
+void propertySetter::installMiniEditor(miniEditor *m){
+ m->connectToPropertySetter(this);
+ m_list.append(m);
+}
+
+#include "propertysetter.moc"
diff --git a/quanta/components/csseditor/propertysetter.h b/quanta/components/csseditor/propertysetter.h
new file mode 100644
index 00000000..3f13b8ba
--- /dev/null
+++ b/quanta/components/csseditor/propertysetter.h
@@ -0,0 +1,64 @@
+/***************************************************************************
+ propertysetter.h - description
+ -------------------
+ begin : gio lug 24 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef PROPERTYSETTER_H
+#define PROPERTYSETTER_H
+
+#include <qhbox.h>
+#include <qptrlist.h>
+#include <qcombobox.h>
+
+
+class miniEditor;
+class KPushButton;
+
+
+/**
+ *@author gulmini luciano
+ */
+
+class propertySetter : public QHBox {
+ Q_OBJECT
+
+ private:
+ unsigned int m_ind;
+ QPtrList<QWidget> m_list;
+ QComboBox *m_cb;
+ KPushButton *m_pb;
+
+ public:
+ propertySetter(QWidget *parent=0, const char *name=0);
+ ~propertySetter();
+
+ void installMiniEditor(miniEditor *m);
+
+ void setComboBox();
+ void setSpinBox(const QString& initialValue="0", const QString& min="0", const QString& max="9999", const QString& s=QString::null);
+ void setLineEdit();
+ void setPredefinedColorListEditor();
+ void reset();
+ void addButton();
+ QComboBox* ComboBox() const { return m_cb; }
+
+ public slots:
+ void Show();
+
+ signals:
+ void valueChanged(const QString&);
+};
+
+#endif
diff --git a/quanta/components/csseditor/qmyhighlighter.cpp b/quanta/components/csseditor/qmyhighlighter.cpp
new file mode 100644
index 00000000..431bf6a5
--- /dev/null
+++ b/quanta/components/csseditor/qmyhighlighter.cpp
@@ -0,0 +1,65 @@
+/***************************************************************************
+ bashhighlighter.cpp - description
+ -------------------
+ begin : dom mar 16 2003
+ copyright : (C) 2003 by Emiliano Gulmini
+ email : emi_barbarossa@yahoo.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "qmyhighlighter.h"
+#include <qregexp.h>
+QMyHighlighter::QMyHighlighter(QTextEdit* Qtxt):QSyntaxHighlighter(Qtxt){
+}
+/*****************************************************************************/
+QMyHighlighter::~QMyHighlighter(){
+}
+
+/*****************************************************************************/
+int QMyHighlighter::highlightParagraph( const QString & text, int /*endStateOfLastPara*/ )
+{
+ //QRegExp pattern("\\s*\\{([\\w\\s\\d:;-\"]*)\\}\\s*");
+ QRegExp pattern("([#:\\.\\w]*)\\s*\\{");
+ int pos=pattern.search(text,0);
+ int l=int(pattern.cap(1).length());
+
+ setFormat(pos,l,QColor("red"));
+
+ if( pos== -1)
+ pos = 0;
+
+ const int npos = pos+l;
+
+ pattern.setPattern("\\s*([\\s\\w\\d-]*)\\s*:");
+ pos=npos;
+ while ( pos >= 0 ) {
+ pos = pattern.search( text, pos );
+ if ( pos > -1 ) {
+ l = pattern.matchedLength();
+
+ setFormat(pos,l,QColor("mediumvioletred"));
+ pos += pattern.matchedLength();
+ }
+ }
+ pattern.setPattern(":\\s*([\\.\\#\\w\\s\\d-\\(\\)\",%/]*)\\s*;");
+ pattern.setPattern(":\\s*([\\W\\w]*)\\s*;");
+ pos=npos;
+ while ( pos >= 0 ) {
+ pos = pattern.search( text, pos );
+ if ( pos > -1 ) {
+ l = pattern.cap(1).length();
+ setFormat(pos + 2 ,l,QColor("steelblue"));
+ pos += pattern.matchedLength();
+ }
+ }
+ return 0;
+}
+
diff --git a/quanta/components/csseditor/qmyhighlighter.h b/quanta/components/csseditor/qmyhighlighter.h
new file mode 100644
index 00000000..a75d6d00
--- /dev/null
+++ b/quanta/components/csseditor/qmyhighlighter.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+ bashhighlighter.h - description
+ -------------------
+ begin : dom mar 16 2003
+ copyright : (C) 2003 by Emiliano Gulmini
+ email : emi_barbarossa@yahoo.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef QMYHIGHLIGHTER_H
+#define QMYHIGHLIGHTER_H
+
+#include <qsyntaxhighlighter.h>
+
+/**
+ *@author Emiliano Gulmini
+ */
+
+class QMyHighlighter : public QSyntaxHighlighter {
+public:
+ QMyHighlighter(QTextEdit* Qtxt);
+
+ ~QMyHighlighter();
+ int highlightParagraph ( const QString & text, int endStateOfLastPara );
+
+};
+
+#endif
diff --git a/quanta/components/csseditor/shorthandformer.cpp b/quanta/components/csseditor/shorthandformer.cpp
new file mode 100644
index 00000000..e8b7a837
--- /dev/null
+++ b/quanta/components/csseditor/shorthandformer.cpp
@@ -0,0 +1,781 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Gulmini Luciano *
+ * gulmini.luciano@student.unife.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#include "shorthandformer.h"
+#include <qstringlist.h>
+#include "cssshpropertyparser.h"
+#include <kdebug.h>
+#include "csseditor_globals.h"
+
+QRegExp globalPercentagePattern("\\d%"),
+ globalLengthPattern("\\d(ex|em|px|cm|pt|pc|in|mm)"),
+ globalColorPattern("#[\\w\\d]*"),
+ globalNumberPattern("\\d*");
+
+static const QString borderStyleValueString("none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset,inherit");
+static const QString widthValueString("thin,medium,thick,inherit");
+static const QString listTypeValueString("disc,circle,square,decimal,decimal-leading-zero,lower-roman,upper-roman,lower-greek,lower-alpha,lower-latin,upper-alpha,upper-latin,hebrew,armenian,georgian,cjk-ideographic,hiragana,katakana,hiragana-iroha,katakana-iroha,none,inherit");
+static const QString fontSizeValueString("smaller,larger,xx-large,x-large,large,medium,small,x-small,xx-small,inherit");
+static const QString fontWeightValueString("900,800,700,600,500,400,300,200,100,lighter,bolder,normal,bold,inherit");
+static const QString fontVariantValueString("normal,small-caps,inherit");
+static const QString fontStyleValueString("oblique,italic,normal,inherit");
+static const QString backgroundRepeatValueString("repeat,repeat-x,repeat-y,no-repeat,inherit");
+
+
+static const QStringList borderStyleValueList = QStringList::split(",",borderStyleValueString);
+static const QStringList widthValueList = QStringList::split(",",widthValueString);
+static const QStringList listTypeValueList = QStringList::split(",",listTypeValueString);
+static const QStringList fontSizeValueList = QStringList::split(",",fontSizeValueString);
+static const QStringList fontWeightValueList = QStringList::split(",",fontWeightValueString);
+static const QStringList fontStyleValueList = QStringList::split(",",fontStyleValueString);
+static const QStringList fontVariantValueList = QStringList::split(",",fontVariantValueString);
+static const QStringList backgroundRepeatValueList = QStringList::split(",",backgroundRepeatValueString);
+
+
+
+ShorthandFormer::ShorthandFormer( QMap<QString,QString> m){
+
+ m_properties = m;
+ if(m_properties.contains("cue-after")){
+ cue_after= m_properties["cue-after"];
+ m_properties.remove("cue-after");
+ }
+ if(m_properties.contains("cue-before")){
+ cue_before = m_properties["cue-before"];
+ m_properties.remove("cue-before");
+ }
+ if(m_properties.contains("pause-before")){
+ pause_before= m_properties["pause-before"];
+ m_properties.remove("pause-before");
+ }
+ if(m_properties.contains("pause-after")){
+ pause_after = m_properties["pause-after"];
+ m_properties.remove("pause-after");
+ }
+ if(m_properties.contains("background-color")){
+ background_color = m_properties["background-color"];
+ m_properties.remove("background-color");
+ }
+ if(m_properties.contains("background-image")){
+ background_image = m_properties["background-image"];
+ m_properties.remove("background-image");
+ }
+ if(m_properties.contains("background-repeat")){
+ background_repeat = m_properties["background-repeat"];
+ m_properties.remove("background-repeat");
+ }
+ if(m_properties.contains("background-attachment")){
+ background_attachment = m_properties["background-attachment"];
+ m_properties.remove("background-attachment");
+ }
+ if(m_properties.contains("background-position")){
+ background_position = m_properties["background-position"];
+ m_properties.remove("background-position");
+ }
+ if(m_properties.contains("border-top-style")){
+ border_top_style = m_properties["border-top-style"];
+ m_properties.remove("border-top-style");
+ }
+ if(m_properties.contains("border-top-color")){
+ border_top_color = m_properties["border-top-color"];
+ m_properties.remove("border-top-color");
+ }
+ if(m_properties.contains("border-top-width")){
+ border_top_width = m_properties["border-top-width"];
+ m_properties.remove("border-top-width");
+ }
+ if(m_properties.contains("border-left-style")){
+ border_left_style = m_properties["border-left-style"];
+ m_properties.remove("border-left-style");
+ }
+ if(m_properties.contains("border-left-color")){
+ border_left_color = m_properties["border-left-color"];
+ m_properties.remove("border-left-color");
+ }
+ if(m_properties.contains("border-left-width")){
+ border_left_width = m_properties["border-left-width"];
+ m_properties.remove("border-left-width");
+ }
+ if(m_properties.contains("border-right-style")){
+ border_right_style = m_properties["border-right-style"];
+ m_properties.remove("border-right-style");
+ }
+ if(m_properties.contains("border-right-color")){
+ border_right_color = m_properties["border-right-color"];
+ m_properties.remove("border-right-color");
+ }
+ if(m_properties.contains("border-right-width")){
+ border_right_width= m_properties["border-right-width"];
+ m_properties.remove("border-right-width");
+ }
+ if(m_properties.contains("border-bottom-style")){
+ border_bottom_style = m_properties["border-bottom-style"];
+ m_properties.remove("border-bottom-style");
+ }
+ if(m_properties.contains("border-bottom-color")){
+ border_bottom_color = m_properties["border-bottom-color"];
+ m_properties.remove("border-bottom-color");
+ }
+ if(m_properties.contains("border-bottom-width")){
+ border_bottom_width = m_properties["border-bottom-width"];
+ m_properties.remove("border-bottom-width");
+ }
+ if(m_properties.contains("outline-style")){
+ outline_style = m_properties["outline-style"];
+ m_properties.remove("outline-style");
+ }
+ if(m_properties.contains("outline-color")){
+ outline_color = m_properties["outline-color"];
+ m_properties.remove("outline-color");
+ }
+ if(m_properties.contains("outline-width")){
+ outline_width = m_properties["outline-width"];
+ m_properties.remove("outline-width");
+ }
+ if(m_properties.contains("list-style-type")){
+ list_style_type= m_properties["list-style-type"];
+ m_properties.remove("list-style-type");
+ }
+ if(m_properties.contains("list-style-image")){
+ list_style_image = m_properties["list-style-image"];
+ m_properties.remove("list-style-image");
+ }
+ if(m_properties.contains("list-style-position")){
+ list_style_position = m_properties["list-style-position"];
+ m_properties.remove("list-style-position");
+ }
+ if(m_properties.contains("font-style")){
+ font_style = m_properties["font-style"];
+ m_properties.remove("font-style");
+ }
+ if(m_properties.contains("font-variant")){
+ font_variant = m_properties["font-variant"];
+ m_properties.remove("font-variant");
+ }
+ if(m_properties.contains("font-weight")){
+ font_weight = m_properties["font-weight"];
+ m_properties.remove("font-weight");
+ }
+ if(m_properties.contains("font-size")){
+ font_size = m_properties["font-size"];
+ m_properties.remove("font-size");
+ }
+ if(m_properties.contains("line-height")){
+ line_height= m_properties["line-height"];
+ m_properties.remove("line-height");
+ }
+ if(m_properties.contains("font-family")){
+ font_family = m_properties["font-family"];
+ m_properties.remove("font-family");
+ }
+ if(m_properties.contains("margin-top")){
+ margin_top = m_properties["margin-top"];
+ m_properties.remove("margin-top");
+ }
+ if(m_properties.contains("margin-bottom")){
+ margin_bottom = m_properties["margin-bottom"];
+ m_properties.remove("margin-bottom");
+ }
+ if(m_properties.contains("margin-left")){
+ margin_left = m_properties["margin-left"];
+ m_properties.remove("margin-left");
+ }
+ if(m_properties.contains("margin-right")){
+ margin_right = m_properties["margin-right"];
+ m_properties.remove("margin-right");
+ }
+ if(m_properties.contains("padding-top")){
+ padding_top = m_properties["padding-top"];
+ m_properties.remove("padding-top");
+ }
+ if(m_properties.contains("padding-bottom")){
+ padding_bottom = m_properties["padding-bottom"];
+ m_properties.remove("padding-bottom");
+ }
+ if(m_properties.contains("padding-left")){
+ padding_left = m_properties["padding-left"];
+ m_properties.remove("padding-left");
+ }
+ if(m_properties.contains("padding-right")){
+ padding_right = m_properties["padding-right"];
+ m_properties.remove("padding-right");
+ }
+}
+
+QString ShorthandFormer::compress(){
+ QString props;
+
+ props += compressCueProp();
+ props += compressPauseProp();
+ props += compressBackgroundProp();
+ props += compressFontProp();
+ props += compressPaddingProp();
+ props += compressMarginProp();
+ props += compressOutlineProp();
+ props += compressListStyleProp();
+ props += compressBorderProp();
+
+ QMap<QString,QString>::Iterator it;
+ for ( it = m_properties.begin(); it != m_properties.end(); ++it )
+ props += it.key() + " : " + it.data().stripWhiteSpace() + "; " ;
+
+ props.truncate(props.length()-1);//the last white space creates some problem: better remove it
+ //props.chop(1);
+ return props;
+}
+
+QString ShorthandFormer::compressBorderProp(){
+ QString props;
+
+ bool allColorSidesSet = false,
+ allStyleSidesSet = false,
+ allWidthSidesSet = false;
+
+ if(!border_left_color.isEmpty())
+ if( ( border_left_color == border_top_color ) && ( border_top_color == border_right_color ) && ( border_right_color == border_bottom_color ) )
+ allColorSidesSet = true;
+
+ if(!border_left_style.isEmpty())
+ if( ( border_left_style == border_top_style ) && ( border_top_style == border_right_style ) && ( border_right_style == border_bottom_style ) )
+ allStyleSidesSet = true;
+
+ if(!border_left_width.isEmpty())
+ if( ( border_left_width == border_top_width ) && ( border_top_width == border_right_width ) && ( border_right_width == border_bottom_width ) )
+ allWidthSidesSet = true;
+
+ if ( allColorSidesSet ) {
+ if ( allStyleSidesSet ) {
+ if ( allWidthSidesSet ) {
+ props += "border : " + border_left_color + " " + border_left_style + " " + border_left_width +"; ";
+
+ }
+ else {
+ props += "border : " + border_left_color + " " + border_left_style +"; ";
+ props += compressBorderWidthProp();
+ }
+ }
+ else {
+ if ( allWidthSidesSet ) {
+ props += "border : " + border_left_color + " " + border_left_width +"; ";
+ props += compressBorderStyleProp();
+ }
+ else {
+ props += "border : " + border_left_color +"; ";
+ props += compressBorderWidthProp();
+ props += compressBorderStyleProp();
+ }
+
+ }
+ }
+ else { // allColorSidesSet is false
+ if ( allStyleSidesSet ) {
+ if ( allWidthSidesSet ) {
+ props += "border : " + border_left_style + " " + border_left_width +"; ";
+ props += compressBorderColorProp();
+ }
+ else {
+ props += compressBorderStyleProp();
+ props += compressBorderWidthProp();
+ props += compressBorderColorProp();
+ }
+ }
+ else {
+
+ props += compressBorderStyleProp();
+ props += compressBorderWidthProp();
+ props += compressBorderColorProp();
+ }
+ }
+
+ return props;
+}
+
+QString ShorthandFormer::compressBorderStyleProp(){
+ return compressImplementation( "border-style" ,border_top_style, border_bottom_style, border_right_style, border_left_style, "none");
+}
+
+QString ShorthandFormer::compressBorderWidthProp(){
+ return compressImplementation( "border-width" ,border_top_width, border_bottom_width, border_right_width, border_left_width, "medium");
+}
+
+QString ShorthandFormer::compressBorderColorProp(){
+//because the default value of color property is browser dependant, this method doesn't compress the color value
+ QString props;
+ if( !border_top_color.isEmpty() )
+ props += "border-top-color : " + border_top_color +"; ";
+ if( !border_right_color.isEmpty() )
+ props += "border-right-color : " + border_right_color +"; ";
+ if( !border_bottom_color.isEmpty() )
+ props += "border-bottom-color : " + border_bottom_color +"; ";
+ if( !border_left_color.isEmpty() )
+ props += "border-left-color : " + border_left_color +"; ";
+ return props;
+}
+
+QString ShorthandFormer::compressFontProp(){
+ QString fontProp,
+ props;
+ //bool appendLineHeight = false;
+
+ if( font_style.isEmpty() && font_variant.isEmpty() && font_weight.isEmpty() && font_size.isEmpty() && font_family.isEmpty() ) {
+ if( !line_height.isEmpty() )
+ props += "line-height : " + line_height + "; ";
+ }
+ else {
+ if( !font_style.isEmpty() )
+ fontProp += " " + font_style;
+ if( !font_variant.isEmpty() )
+ fontProp += " " + font_variant;
+ if( !font_weight.isEmpty() )
+ fontProp += " " + font_weight;
+ if( !font_size.isEmpty() ){
+ fontProp += " " + font_size;
+ if( !line_height.isEmpty() )
+ fontProp += "/" + line_height.stripWhiteSpace() ;
+ }
+ else {
+ fontProp += ( " medium");
+ /*if( !line_height.isEmpty() )
+ appendLineHeight = true; */
+ if( !line_height.isEmpty() )
+ fontProp += ( "/" + line_height.stripWhiteSpace() );
+ }
+
+ if( !font_family.isEmpty() )
+ fontProp += ( " " + font_family);
+ else fontProp += " serif";
+ if( !fontProp.isEmpty() )
+ props += ( "font :" + fontProp + "; ");
+ /* if(appendLineHeight)
+ props += ( "line-height : " + line_height + "; ");*/
+ }
+ return props;
+}
+
+QString ShorthandFormer::compressCueProp(){
+ return compressImplementation2( "cue", cue_after, cue_before, "none");
+}
+
+QString ShorthandFormer::compressPauseProp(){
+ return compressImplementation2( "pause", pause_after, pause_before, "0");
+}
+
+QString ShorthandFormer::compressBackgroundProp(){
+ QString backgroundProp;
+ if( !background_color.isEmpty() ) backgroundProp += (" " + background_color );
+ if( !background_image.isEmpty() ) backgroundProp += (" " + background_image );
+ if( !background_repeat.isEmpty() ) backgroundProp += (" " + background_repeat );
+ if( !background_attachment.isEmpty() ) backgroundProp += (" " + background_attachment );
+ if( !background_position.isEmpty() ) backgroundProp += (" " + background_position );
+ if( !backgroundProp.isEmpty() ) return ( "background :" + backgroundProp + "; ");
+ return QString::null;
+}
+
+QString ShorthandFormer::compressPaddingProp(){
+ return compressImplementation( "padding" ,padding_top, padding_bottom, padding_right, padding_left, "0");
+}
+
+QString ShorthandFormer::compressMarginProp(){
+ return compressImplementation( "margin" ,margin_top, margin_bottom, margin_right, margin_left, "0");
+}
+
+QString ShorthandFormer::compressOutlineProp(){
+ return compressImplementation3("outline", outline_color, outline_style, outline_width);
+}
+QString ShorthandFormer::compressListStyleProp(){
+ return compressImplementation3("list-style", list_style_type, list_style_image, list_style_position);
+}
+
+QString ShorthandFormer::compressImplementation3( const QString& prop, const QString& p1, const QString& p2, const QString& p3){
+ QString props;
+ if( !p1.isEmpty() ) props += (" " + p1 );
+ if( !p2.isEmpty() ) props += (" " + p2 );
+ if( !p3.isEmpty() ) props += (" " + p3 );
+ if( !props.isEmpty() ) return ( prop + " :" + props + "; ");
+ return QString::null;
+}
+
+QString ShorthandFormer::compressImplementation2( const QString& prop, const QString& after, const QString& before, const QString& defValue){
+ QString props;
+ if(after == before){
+ if(!after.isEmpty()) props+=( prop + " : " + after + "; ");
+ }
+ else {
+ if(before.isEmpty()) props+=( prop + " : " + defValue + " " + after + "; ");
+ else
+ if(after.isEmpty()) props+=( prop + " : " + before + " " + defValue + "; ");
+ else props+=( prop + " : " + before + " " + after + "; ");
+ }
+ return props;
+}
+
+QString ShorthandFormer::compressImplementation( const QString& prop, const QString& t, const QString& b, const QString& r, const QString& l, const QString& defValue){
+
+ QString props,
+ top(t.stripWhiteSpace()),
+ bottom(b.stripWhiteSpace()),
+ left(l.stripWhiteSpace()),
+ right(r.stripWhiteSpace());
+
+ if( top.isEmpty() ) top = defValue;
+ if( bottom.isEmpty() ) bottom = defValue;
+ if( left.isEmpty() ) left = defValue;
+ if( right.isEmpty() ) right = defValue;
+
+
+ if( top == defValue && bottom == defValue && right == defValue && left == defValue)
+ return QString::null;
+
+ if( top == bottom && bottom == right && right == left )
+ return ( prop +" : " + top + "; ");
+
+ if( right == left ) {
+ if( top == bottom ) return ( prop +" : " + top + " " + right + "; ");
+ else return ( prop +" : " + top + " " + right + " " + bottom + "; ");
+ }
+ else return (prop +" : " + top + " " + right + " " + bottom + " " + left + "; ");
+}
+
+
+//+++++++++++++++++++++EXPANDING METHODS+++++++++++++++++++++++++++++++++++
+
+
+QMap<QString,QString> ShorthandFormer::expand( const QString& propertyName, const QString& propertyValue ){
+ CSSSHPropertyParser parser(propertyValue);
+ QStringList foundValues = parser.parse();
+
+ if( propertyName == "cue" ) return expandCueProp(foundValues);
+ if( propertyName == "pause") return expandPauseProp(foundValues);
+ if( propertyName == "background") return expandBackgroundProp(foundValues);
+ if( propertyName == "border-color") return expandBox("color", foundValues);
+ if( propertyName == "border-style") return expandBox("style", foundValues);
+ if( propertyName == "border-width") return expandBox("width", foundValues);
+ if( propertyName == "font") return expandFontProp(foundValues);
+ if( propertyName == "outline") return expandOutlineProp(foundValues);
+ if( propertyName == "list-style") return expandListstyleProp(foundValues);
+ if( propertyName == "border-bottom") return expandBoxSide("bottom",foundValues);
+ if( propertyName == "border-top") return expandBoxSide("top",foundValues);
+ if( propertyName == "border-left") return expandBoxSide("left",foundValues);
+ if( propertyName == "border-right") return expandBoxSide("right",foundValues);
+ if( propertyName == "border") return expandBorderProp(foundValues);
+ if( propertyName == "padding") return expandPaddingProp(foundValues);
+ if( propertyName == "margin") return expandMarginProp(foundValues);
+ return QMap<QString,QString>();//dummy instruction avoiding a pedantic warning; can never be reached
+}
+
+QMap<QString,QString> ShorthandFormer::expandCueProp(const QStringList& l){
+ return expandImplementation("cue",l);
+}
+
+QMap<QString,QString> ShorthandFormer::expandPauseProp(const QStringList& l){
+ return expandImplementation("pause",l);
+}
+
+QMap<QString,QString> ShorthandFormer::expandImplementation(const QString& propertyName, const QStringList& l){
+ QMap<QString,QString> expandedProps;
+ if( l.count()==1) {
+ expandedProps[propertyName + "-before"] = l[0] ;
+ expandedProps[propertyName + "-after"] = l[0] ;
+ return expandedProps;
+ }
+ else
+ {
+ expandedProps[propertyName + "-before"] = l[0] ;
+ expandedProps[propertyName + "-after"] = l[1] ;
+ return expandedProps;
+ }
+}
+
+QMap<QString,QString> ShorthandFormer::expandBackgroundProp(const QStringList& l){
+ QMap<QString,QString> expandedProps;
+ if(l.count()==1 && l[0] == "inherit"){ // it works also as protection against wrong single value inserted
+ expandedProps["background-color"] = l[0];
+ expandedProps["background-image"] = l[0];
+ expandedProps["background-repeat"] = l[0];
+ expandedProps["background-attachment"] =l[0];
+ expandedProps["background-position"] = l[0];
+ }
+ else {
+
+ QStringList::ConstIterator it = l.begin();
+
+ while ( it != l.end() ) {
+ QString temp((*it).stripWhiteSpace());
+ if( (*it).contains("url(") || temp == "none" || temp == "inherit" ){
+ expandedProps["background-image"] = (*it);
+ }
+ else
+ if( backgroundRepeatValueList.contains(temp)!=0 ) {
+ expandedProps["background-repeat"] = (*it);
+ }
+ else
+ if( temp == "scroll" || temp == "fixed" || temp == "inherit"){
+ expandedProps["background-attachment"] = (*it);
+ }
+ else
+ if( (*it).contains("rgb(") || (*it).contains(globalColorPattern) || CSSEditorGlobals::HTMLColors.contains((*it))!=0 || temp == "transparent" || temp == "inherit" ){
+ expandedProps["background-color"] = (*it);
+ }
+ else
+ if( temp == "top" || temp == "center" || temp == "bottom" || temp == "left" || temp == "right" || (*it).contains(globalPercentagePattern) || (*it).contains(globalLengthPattern) || temp == "inherit"){
+ if( expandedProps.contains("background-position") )
+ expandedProps["background-position"] = ( expandedProps["background-position"] + " " + (*it) );
+ else
+ expandedProps["background-position"] = (*it);
+ }
+
+ ++it;
+ }
+ }
+ return expandedProps;
+}
+
+QMap<QString,QString> ShorthandFormer::expandBox(const QString& subPropName, const QStringList& l){
+
+ QMap<QString,QString> expandedProps;
+ expandedProps["border-top-" + subPropName] = l[0];
+ switch(l.count()){
+ case 1 :
+ expandedProps["border-right-" + subPropName] = l[0];
+ expandedProps["border-bottom-" + subPropName] = l[0];
+ expandedProps["border-left-" + subPropName] = l[0];
+ break;
+ case 2 :
+ expandedProps["border-right-" + subPropName] = l[1];
+ expandedProps["border-bottom-" + subPropName] = l[0];
+ expandedProps["border-left-" + subPropName] = l[1];
+ break;
+ case 3 :
+ expandedProps["border-right-" + subPropName] = l[1];
+ expandedProps["border-bottom-" + subPropName] = l[2];
+ expandedProps["border-left-" + subPropName] = l[1];
+ break;
+ case 4 :
+ expandedProps["border-right-" + subPropName] = l[1];
+ expandedProps["border-bottom-" + subPropName] = l[2];
+ expandedProps["border-left-" + subPropName] = l[3];
+ break;
+ default:break;
+ }
+ return expandedProps;
+}
+
+QMap<QString,QString> ShorthandFormer::expandFontProp(const QStringList& l){
+ QMap<QString,QString> expandedProps;
+
+ QRegExp percentagePattern("/"+globalPercentagePattern.pattern()),
+ lengthPattern("/"+globalLengthPattern.pattern()),
+ numberPattern("/"+globalNumberPattern.pattern());
+
+ QStringList fontPseudoSHFormValues;
+ fontPseudoSHFormValues.append("caption");
+ fontPseudoSHFormValues.append("icon");
+ fontPseudoSHFormValues.append("menu");
+ fontPseudoSHFormValues.append("message-box");
+ fontPseudoSHFormValues.append("small-caption");
+ fontPseudoSHFormValues.append("status-bar");
+ if( l.count()==1 && fontPseudoSHFormValues.contains(l[0]) != 0) {
+ expandedProps["font"] = l[0];
+ return expandedProps;
+ }
+ else {
+ QStringList::ConstIterator it = l.begin();
+ while ( it != l.end() ) {
+ QString currentIt = (*it);
+ QString temp(currentIt.stripWhiteSpace());
+ if( fontStyleValueList.contains(temp)!=0 ) expandedProps["font-style"] = (*it);
+ else
+ if( fontVariantValueList.contains(temp)!=0 ) expandedProps["font-variant"] = currentIt ;
+ else
+ if( fontWeightValueList.contains(temp)!=0) expandedProps["font-weight"] = currentIt;
+ else
+ if( (fontSizeValueList.contains(temp)!=0 || currentIt.contains(globalPercentagePattern)!=0 || currentIt.contains(globalLengthPattern)!=0) && expandedProps["font-size"].isEmpty() )
+ {
+ expandedProps["font-size"] = currentIt;
+ }
+ else
+ if( currentIt.contains(percentagePattern)!=0 || currentIt.contains(numberPattern)!=0 || currentIt.contains(lengthPattern)!=0 || temp == "/normal" || temp == "/inherit" )
+ {
+ expandedProps["line-height"] = (currentIt.remove('/'));
+ }
+ else expandedProps["font-family"] = currentIt;
+ ++it;
+ }
+ return expandedProps;
+ }
+}
+
+QMap<QString,QString> ShorthandFormer::expandListstyleProp( const QStringList& l){
+ QMap<QString,QString> expandedProps;
+ if( (l.count() == 1) && (l[0] == "inherit")){
+ expandedProps["list-style-image"] ="inherit";
+ expandedProps["list-style-type"] ="inherit";
+ expandedProps["list-style-position"] ="inherit";
+ return expandedProps;
+ }
+
+ if( (l.count() == 1) && (l[0] == "none")){
+ expandedProps["list-style-image"] ="none";
+ expandedProps["list-style-type"] ="none";
+ return expandedProps;
+ }
+
+
+ QStringList::ConstIterator it = l.begin();
+ while ( it != l.end() ) {
+ QString temp((*it).stripWhiteSpace());
+ if( listTypeValueList.contains(temp)!=0) {
+ expandedProps["list-style-type"] = (*it) ;
+ }
+ else
+ if( temp == "inside" || temp == "outside" || temp == "inherit") {
+ expandedProps["list-style-position"] = (*it);
+ }
+ else
+ if( (*it).contains("url(") || temp == "none" || temp == "inherit" )
+ expandedProps["list-style-image"] = (*it);
+
+ ++it;
+ }
+ return expandedProps;
+}
+
+QMap<QString,QString> ShorthandFormer::expandOutlineProp( const QStringList& l){
+ QMap<QString,QString> expandedProps;
+ QStringList::ConstIterator it = l.begin();
+ while ( it != l.end() ) {
+ QString temp((*it).stripWhiteSpace());
+ if( borderStyleValueList.contains(temp)!=0 ) expandedProps["outline-style"] = (*it);
+ else
+ if( (*it).contains(globalColorPattern) || CSSEditorGlobals::HTMLColors.contains((*it))!=0 || temp == "invert" || temp == "inherit")
+ expandedProps["outline-color"] = (*it) ;
+ else
+ if( (*it).contains(globalLengthPattern) || widthValueList.contains(temp)!=0)
+ expandedProps["outline-width"] = (*it);
+ ++it;
+ }
+ return expandedProps;
+}
+
+QMap<QString,QString> ShorthandFormer::expandBoxSide(const QString& subPropName, const QStringList& l){
+ QMap<QString,QString> expandedProps;
+
+ QStringList::ConstIterator it = l.begin();
+ while ( it != l.end() ) {
+ QString temp((*it).stripWhiteSpace());
+ if( borderStyleValueList.contains(temp)!=0 ) expandedProps[subPropName + "-style"] = (*it);
+ else
+ if( (*it).contains(globalColorPattern) || CSSEditorGlobals::HTMLColors.contains((*it))!=0 || temp == "transparent" || temp == "inherit")
+ expandedProps[subPropName + "-color"] = (*it) ;
+ else
+ if( (*it).contains(globalLengthPattern) || widthValueList.contains(temp)!=0)
+ expandedProps[subPropName + "-width"] = (*it);
+ ++it;
+ }
+ return expandedProps;
+}
+
+QMap<QString,QString> ShorthandFormer::expandBorderProp(const QStringList& l){
+ QMap<QString,QString> expandedProps;
+ QStringList::ConstIterator it = l.begin();
+ while ( it != l.end() ) {
+ QString temp((*it).stripWhiteSpace());
+ if( borderStyleValueList.contains(temp)!=0 ){
+ expandedProps["border-top-style"] = (*it);
+ expandedProps["border-left-style"] = (*it);
+ expandedProps["border-right-style"] = (*it);
+ expandedProps["border-bottom-style"] = (*it);
+ }
+ else
+ if( (*it).contains(globalColorPattern) || CSSEditorGlobals::HTMLColors.contains((*it))!=0 || temp == "transparent" || temp == "inherit"){
+ expandedProps["border-top-color"] = (*it);
+ expandedProps["border-left-color"] = (*it);
+ expandedProps["border-right-color"] = (*it);
+ expandedProps["border-bottom-color"] = (*it);
+ }
+ else
+ if( (*it).contains(globalLengthPattern) || widthValueList.contains(temp)!=0){
+ expandedProps["border-top-width"] = (*it);
+ expandedProps["border-left-width"] = (*it);
+ expandedProps["border-right-width"] = (*it);
+ expandedProps["border-bottom-width"] = (*it);
+ }
+ ++it;
+ }
+ return expandedProps;
+}
+
+QMap<QString,QString> ShorthandFormer::expandImplementation2(const QString& propertyName, const QStringList& l){
+ QMap<QString,QString> expandedProps;
+ expandedProps[ propertyName + "-top" ] = l[0];
+ switch(l.count()){
+ case 1 :
+ expandedProps[ propertyName + "-right" ] = l[0];
+ expandedProps[ propertyName + "-bottom" ] = l[0];
+ expandedProps[ propertyName + "-left" ] = l[0];
+ break;
+ case 2 :
+ expandedProps[ propertyName + "-right" ] = l[1];
+ expandedProps[ propertyName + "-bottom" ] = l[0];
+ expandedProps[ propertyName + "-left" ] = l[1];
+ break;
+ case 3 :
+ expandedProps[ propertyName + "-right" ] = l[1];
+ expandedProps[ propertyName + "-bottom" ] = l[2];
+ expandedProps[ propertyName + "-left" ] = l[1];
+ break;
+ case 4 :
+ expandedProps[ propertyName + "-right" ] = l[1];
+ expandedProps[ propertyName + "-bottom" ] = l[2];
+ expandedProps[ propertyName + "-left" ] = l[3];
+ break;
+ default:break;
+ }
+ return expandedProps;
+ }
+
+ QMap<QString,QString> ShorthandFormer::expandPaddingProp(const QStringList& l){
+ return expandImplementation2("padding", l);
+}
+
+ QMap<QString,QString> ShorthandFormer::expandMarginProp(const QStringList& l){
+ return expandImplementation2("margin", l);
+ }
+
+QStringList ShorthandFormer::SHFormList() {
+ QStringList l;
+ l.append("cue");
+ l.append("pause");
+ l.append("font");
+ l.append("background");
+ l.append("border");
+ l.append("border-top");
+ l.append("border-bottom");
+ l.append("border-left");
+ l.append("border-right");
+ l.append("border-color");
+ l.append("border-style");
+ l.append("border-width");
+ l.append("outline");
+ l.append("list-style");
+ l.append("padding");
+ l.append("margin");
+ return l;
+}
+
diff --git a/quanta/components/csseditor/shorthandformer.h b/quanta/components/csseditor/shorthandformer.h
new file mode 100644
index 00000000..f5b0f291
--- /dev/null
+++ b/quanta/components/csseditor/shorthandformer.h
@@ -0,0 +1,117 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Gulmini Luciano *
+ * gulmini.luciano@student.unife.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef SHORTHANDFORMER_H
+#define SHORTHANDFORMER_H
+
+/**
+@author Gulmini Luciano
+*/
+#include <qmap.h>
+class QString;
+class QStringList;
+
+class ShorthandFormer{
+public:
+ ShorthandFormer(){}
+ ShorthandFormer( QMap<QString,QString> m );
+ ~ShorthandFormer(){}
+ QString compress();
+ QMap<QString,QString> expand(const QString& propertyName, const QString& propertyValue);
+ static QStringList SHFormList();
+
+private:
+ QMap<QString,QString> m_properties;
+ QString cue_after,
+ cue_before,
+ pause_before,
+ pause_after,
+ background_color,
+ background_image,
+ background_repeat,
+ background_attachment,
+ background_position,
+ border_top_style,
+ border_top_color,
+ border_top_width,
+ border_left_style,
+ border_left_color,
+ border_left_width,
+ border_right_style,
+ border_right_color,
+ border_right_width,
+ border_bottom_style,
+ border_bottom_color,
+ border_bottom_width,
+ outline_style,
+ outline_color,
+ outline_width,
+ list_style_type,
+ list_style_image,
+ list_style_position,
+ font_style,
+ font_variant,
+ font_weight,
+ font_size,
+ line_height,
+ font_family,
+ margin_top,
+ margin_bottom,
+ margin_left,
+ margin_right,
+ padding_top,
+ padding_bottom,
+ padding_left,
+ padding_right;
+
+private:
+ QString compressCueProp();
+ QString compressPauseProp();
+ QString compressPaddingProp();
+ QString compressMarginProp();
+ QString compressFontProp();
+ QString compressBackgroundProp();
+ QString compressOutlineProp();
+ QString compressListStyleProp();
+ QString compressBorderStyleProp();
+ QString compressBorderWidthProp();
+ QString compressBorderColorProp();
+ QString compressBorderProp();
+
+ QString compressImplementation( const QString& prop, const QString& t, const QString& b, const QString& r, const QString& l, const QString& defValue);
+ QString compressImplementation2( const QString& prop, const QString& after, const QString& before, const QString& defValue);
+ QString compressImplementation3( const QString& prop, const QString& p1, const QString& p2, const QString& p3);
+
+ QMap<QString,QString> expandCueProp(const QStringList& l);
+ QMap<QString,QString> expandPauseProp(const QStringList& l);
+ QMap<QString,QString> expandBackgroundProp(const QStringList& l);
+ QMap<QString,QString> expandFontProp(const QStringList& l);
+ QMap<QString,QString> expandOutlineProp(const QStringList& l);
+ QMap<QString,QString> expandListstyleProp(const QStringList& l);
+ QMap<QString,QString> expandBoxSide(const QString& subPropName, const QStringList& l);
+ QMap<QString,QString> expandBorderProp(const QStringList& l);
+ QMap<QString,QString> expandBox(const QString& subPropName, const QStringList& l);
+ QMap<QString,QString> expandPaddingProp(const QStringList& l);
+ QMap<QString,QString> expandMarginProp(const QStringList& l);
+
+ QMap<QString,QString> expandImplementation(const QString& propertyName, const QStringList& l);
+ QMap<QString,QString> expandImplementation2(const QString& propertyName, const QStringList& l);
+ };
+
+#endif
diff --git a/quanta/components/csseditor/specialsb.cpp b/quanta/components/csseditor/specialsb.cpp
new file mode 100644
index 00000000..eb26e05f
--- /dev/null
+++ b/quanta/components/csseditor/specialsb.cpp
@@ -0,0 +1,127 @@
+/***************************************************************************
+ specialsb.cpp - description
+ -------------------
+ begin : dom ago 3 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "specialsb.h"
+#include "propertysetter.h"
+#include "csseditor_globals.h"
+
+#include <klineedit.h>
+
+specialSB::specialSB(QWidget *parent, const char *name, bool useLineEdit ) : miniEditor(parent,name) {
+ if (useLineEdit)
+ {
+ m_lineEdit = new KLineEdit(this);
+ m_sb = 0L;
+ connect(m_lineEdit, SIGNAL(textChanged ( const QString & )), this, SLOT(lineEditValueSlot ( const QString & )));
+ }
+ else
+ {
+ m_sb=new mySpinBox(this);
+ connect(m_sb, SIGNAL(valueChanged ( const QString & )), this, SLOT(sbValueSlot(const QString&)));
+ m_lineEdit = 0L;
+ }
+ m_cb = new QComboBox(this);
+ connect(m_cb, SIGNAL(activated ( const QString & )), this, SLOT(cbValueSlot(const QString&)));
+}
+
+specialSB::~specialSB(){
+ delete m_cb;
+ delete m_sb;
+ delete m_lineEdit;
+}
+
+void specialSB::connectToPropertySetter(propertySetter* p){
+ connect(this, SIGNAL(valueChanged(const QString&)), p,SIGNAL(valueChanged(const QString&)));
+}
+
+
+void specialSB::cbValueSlot(const QString& s){
+ if (m_sb)
+ emit valueChanged( m_sb->text() +s );
+ else
+ emit valueChanged( m_lineEdit->text() +s );
+}
+
+void specialSB::sbValueSlot(const QString& s){
+ emit valueChanged( s + m_cb->currentText());
+}
+
+void specialSB::lineEditValueSlot(const QString& s){
+ emit valueChanged( s + m_cb->currentText());
+}
+
+void specialSB::setInitialValue(const QString& s){
+
+ QRegExp pattern("\\d("+ cbValueList().join("|")+")");
+
+ if (pattern.search(s) != -1) {
+ QString temp(s.stripWhiteSpace());
+ QString cbValue = pattern.cap(1);
+
+ if (m_sb)
+ m_sb->setValue(temp.remove(cbValue).toInt());
+ else
+ m_lineEdit->setText(temp.remove(cbValue));
+ m_cb->setCurrentText(cbValue);
+ }
+ else return;
+}
+
+QStringList specialSB::cbValueList(){
+ QStringList l;
+ for(int i=0; i<m_cb->count();i++) l.append(m_cb->text(i));
+ return l;
+}
+
+frequencyEditor::frequencyEditor(QWidget *parent, const char *name ) : specialSB(parent,name) {
+ m_cb->insertItem("Hz");
+ m_cb->insertItem("kHz");
+ m_sb->setMaxValue(9999);
+}
+
+angleEditor::angleEditor(QWidget *parent, const char *name) : specialSB(parent,name){
+ m_cb->insertItem("deg");
+ m_cb->insertItem("grad");
+ m_cb->insertItem("rad");
+ m_sb->setMaxValue(-400);
+ m_sb->setMaxValue(400);
+}
+
+timeEditor::timeEditor(QWidget *parent, const char *name ) : specialSB(parent,name) {
+ m_cb->insertItem("ms");
+ m_cb->insertItem("s");
+ m_sb->setMaxValue(99999);
+}
+
+lengthEditor::lengthEditor(QWidget *parent, const char *name ) : specialSB(parent,name, true) {
+ m_cb->insertItem("px");
+ m_cb->insertItem("em");
+ m_cb->insertItem("ex");
+ m_cb->insertItem("in");
+ m_cb->insertItem("cm");
+ m_cb->insertItem("mm");
+ m_cb->insertItem("pt");
+ m_cb->insertItem("pc");
+ if (m_sb)
+ m_sb->setMaxValue(99999);
+}
+
+
+
+
+
+#include "specialsb.moc"
diff --git a/quanta/components/csseditor/specialsb.h b/quanta/components/csseditor/specialsb.h
new file mode 100644
index 00000000..43d6273e
--- /dev/null
+++ b/quanta/components/csseditor/specialsb.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ specialsb.h - description
+ -------------------
+ begin : dom ago 3 2003
+ copyright : (C) 2003 by Gulmini Luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef SPECIALSB_H
+#define SPECIALSB_H
+
+#include "minieditor.h"
+#include <qcombobox.h>
+class mySpinBox;
+class KLineEdit;
+
+/**
+ *@author gulmini luciano
+ */
+
+class specialSB : public miniEditor {
+ Q_OBJECT
+ protected:
+ QComboBox *m_cb;
+ mySpinBox *m_sb;
+ KLineEdit *m_lineEdit;
+
+ public:
+ specialSB(QWidget *parent=0, const char *name=0, bool useLineEdit = false);
+ ~specialSB();
+ void insertItem(const QString& s){ m_cb->insertItem(s); }
+ void setInitialValue(const QString& s);
+ QStringList cbValueList();
+ virtual void connectToPropertySetter(propertySetter* p);
+
+ public slots:
+ void cbValueSlot(const QString&);
+ void sbValueSlot(const QString&);
+ void lineEditValueSlot(const QString&);
+
+ signals:
+ void valueChanged(const QString&);
+
+};
+
+class angleEditor : public specialSB {
+ Q_OBJECT
+ public:
+ angleEditor(QWidget *parent=0, const char *name=0);
+};
+
+class frequencyEditor : public specialSB {
+ Q_OBJECT
+ public:
+ frequencyEditor(QWidget *parent=0, const char *name=0);
+};
+
+class timeEditor : public specialSB {
+ Q_OBJECT
+ public:
+ timeEditor(QWidget *parent=0, const char *name=0);
+};
+
+class lengthEditor : public specialSB {
+ Q_OBJECT
+ public:
+ lengthEditor(QWidget *parent=0, const char *name=0);
+};
+
+#endif
diff --git a/quanta/components/csseditor/styleeditor.cpp b/quanta/components/csseditor/styleeditor.cpp
new file mode 100644
index 00000000..63d4af79
--- /dev/null
+++ b/quanta/components/csseditor/styleeditor.cpp
@@ -0,0 +1,109 @@
+/***************************************************************************
+ styleeditor - implementation
+ begin : Wed Apr 7 2004
+ copyright : (C) 2004 by Luciano Gulmini <gulmini.luciano@student.unife.it>
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ ***************************************************************************/
+
+//qt includes
+#include <qlineedit.h>
+#include <qtooltip.h>
+#include <qiconset.h>
+#include <qlabel.h>
+#include <qfileinfo.h>
+
+//kde includes
+#include <kdialog.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kpushbutton.h>
+#include <kurl.h>
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/viewcursorinterface.h>
+
+//app includes
+#include "parser.h"
+#include "tag.h"
+#include "node.h"
+#include "project.h"
+#include "resource.h"
+#include "document.h"
+#include "styleeditor.h"
+#include "viewmanager.h"
+#include "csseditor.h"
+
+StyleEditor::StyleEditor(QWidget *parent, const char* name) : TLPEditor(parent,name){
+ connect(m_pb, SIGNAL(clicked()), this, SLOT(openCSSEditor()));
+ setToolTip(i18n("Open css dialog"));
+ QIconSet iconSet = SmallIconSet(QString::fromLatin1("stylesheet"));
+ QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
+ m_pb->setIconSet(iconSet);
+ m_iconWidth = pixMap.width();
+ m_iconHeight = pixMap.height();
+ m_pb->setFixedSize( m_iconWidth+8, m_iconHeight+8 );
+ m_label->hide();
+}
+
+void StyleEditor::setButtonIcon(int width, int height){
+ m_pb->setFixedSize( m_iconWidth+width, m_iconHeight+height );
+}
+
+void StyleEditor::openCSSEditor(){
+ Document *w = ViewManager::ref()->activeDocument();
+ if (!w) return;
+ uint line, col;
+ int bLine, bCol, eLine, eCol;
+ bLine = bCol = eLine = eCol = 0;
+ w->viewCursorIf->cursorPositionReal(&line, &col);
+ if (line == 0 && col == 0)
+ col++;
+ //parser->rebuild(w);
+ Node *node = parser->nodeAt(line, col, false);
+ unsigned int lastLine = w->editIf->numLines() - 1;
+ unsigned int lastCol = w->editIf->lineLength(lastLine);
+ Node *styleNode = node;
+
+ if (styleNode->tag->type == Tag::XmlTagEnd && styleNode->prev)
+ styleNode = styleNode->prev;
+
+ QString fullDocument = w->editIf->text().stripWhiteSpace();
+
+ if (styleNode && (styleNode->tag->type == Tag::XmlTag || styleNode->tag->type == Tag::Empty) ) {
+ CSSEditor *dlg = new CSSEditor(this);
+ QFileInfo fi(ViewManager::ref()->currentURL());
+ dlg->setFileToPreview(Project::ref()->projectBaseURL().path() + fi.baseName(),false);
+
+ styleNode->tag->beginPos(bLine, bCol);
+ styleNode->tag->endPos(eLine, eCol);
+ dlg->setFooter(">" + w->text(eLine, eCol + 1, lastLine, lastCol));
+
+ QString temp;
+ if (styleNode->tag->hasAttribute("style")) {
+ dlg->setInlineStyleContent(styleNode->tag->attributeValue("style"));
+ Tag tempTag(*(styleNode->tag));
+ tempTag.deleteAttribute("style");
+ temp = tempTag.toString();
+ }
+ else {
+ dlg->setInlineStyleContent(QString::null);
+ temp = styleNode->tag->toString();
+ }
+
+ temp = temp.left(temp.length()-1);//remove >
+ temp = temp.right(temp.length()-1);//remove <
+ dlg->setHeader(w->text(0, 0, bLine, bCol) + temp);
+
+ dlg->initialize();
+ if( dlg->exec() ) m_le->setText(dlg->generateProperties());
+ delete dlg;
+ }
+}
+
+#include "styleeditor.moc"
diff --git a/quanta/components/csseditor/styleeditor.h b/quanta/components/csseditor/styleeditor.h
new file mode 100644
index 00000000..582ac848
--- /dev/null
+++ b/quanta/components/csseditor/styleeditor.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+ styleeditor - description
+ begin : Wed Apr 7 2004
+ copyright : (C) 2004 by Luciano Gulmini <gulmini.luciano@student.unife.it>
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ ***************************************************************************/
+
+#ifndef STYLEEDITOR_H
+#define STYLEEDITOR_H
+
+//qt includes
+#include "tlpeditors.h"
+//kde includes
+
+//app includes
+
+//forward declarations
+class propertySetter;
+class StyleEditor : public TLPEditor{
+ Q_OBJECT
+ private:
+ int m_iconWidth,
+ m_iconHeight;
+public:
+ StyleEditor(QWidget *parent=0, const char* name=0);
+ virtual void setButtonIcon(int width, int height);
+
+public slots:
+ void openCSSEditor();
+ virtual void connectToPropertySetter(propertySetter* /*p*/){}
+ virtual void setInitialValue(const QString& /*s*/){}
+};
+
+
+#endif //STYLEEDITOR_H
diff --git a/quanta/components/csseditor/stylesheetparser.cpp b/quanta/components/csseditor/stylesheetparser.cpp
new file mode 100644
index 00000000..b8cbf306
--- /dev/null
+++ b/quanta/components/csseditor/stylesheetparser.cpp
@@ -0,0 +1,245 @@
+/***************************************************************************
+ stylesheetparser.cpp - description
+ -------------------
+ begin : gio ago 19 2004
+ copyright : (C) 2004 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "stylesheetparser.h"
+#include <klocale.h>
+#include <kdebug.h>
+
+static const QString msg1(i18n("has not been closed")),
+ msg2(i18n("needs an opening parenthesis "));
+
+stylesheetParser::stylesheetParser(const QString& s){
+ m_styleSheet = s;
+ m_styleSheet=m_styleSheet.right(m_styleSheet.length()-whiteSpaces(0));
+ m_stopProcessing = false;
+ m_orderNumber = 0;
+}
+
+int stylesheetParser::whiteSpaces(int d){
+ int ws=0;
+ for( unsigned int i=d;i<m_styleSheet.length();i++){
+ QString temp;
+ if(m_styleSheet[i] == ' ' || m_styleSheet[i] == '\n' || m_styleSheet[i] == '\t' )
+ ws++;
+ else break;
+ }
+ return ws;
+}
+
+void stylesheetParser::parse(){
+ if(!m_stopProcessing){
+ if(!m_styleSheet.isEmpty()){
+ if(m_styleSheet.startsWith("/*"))
+ parseComment();
+ else if(m_styleSheet.startsWith("@page"))
+ parseAtRules1();
+ else if(m_styleSheet.startsWith("@media"))
+ parseAtRules1();
+ else if(m_styleSheet.startsWith("@import"))
+ parseAtRules2();
+ else if(m_styleSheet.startsWith("@charset"))
+ parseAtRules2();
+ else parseSelector();
+ }
+ else return;
+ }
+}
+
+void stylesheetParser::parseComment(){
+ bool stopProcessingComment=false;
+ unsigned int k;
+ for(k=2;k<m_styleSheet.length()-1;k++){
+ QString temp;
+ temp.append(m_styleSheet[k]).append(m_styleSheet[k+1]);
+ if(temp=="*/") {
+ k+=2;
+ stopProcessingComment=true;
+ break;
+ }
+ }
+
+ if(stopProcessingComment){
+ int ws=whiteSpaces(k);
+ QPair<QString,unsigned int> tmp(m_styleSheet.left(k+ws),++m_orderNumber);
+ m_stylesheetStructure["/*"+QString::number(m_orderNumber,10)]=tmp;
+ m_styleSheet=m_styleSheet.right(m_styleSheet.length()-k-ws);
+ parse();
+ }
+
+ else {
+ m_stopProcessing = true;
+ emit errorOccurred(i18n("The comment") + " :\n" +m_styleSheet.mid(0,20) + "...\n "+ msg1);
+ return;
+ }
+}
+
+unsigned int stylesheetParser::numberOfParenthesisInAParenthesisBlock(parenthesisKind p, const QString& b){
+ QChar searchFor = '{';
+ if (p == closed)
+ searchFor = '}';
+ int num = 0;
+ int len = b.length();
+ bool ignore = false;
+ for (int i = 0; i < len; i++)
+ {
+ if (b[i] == '/' && (i + 1 < len) && b[i + 1] == '*')
+ ignore = true;
+ if (b[i] == '*' && (i + 1 < len) && b[i + 1] == '/')
+ ignore = false;
+ if (!ignore && b[i] == searchFor)
+ num++;
+ }
+ return num;
+}
+
+int findParanthesis(const QString& string, const QChar &ch, int startPos = 0)
+{
+ int pos = -1;
+ int len = string.length();
+ bool ignore = false;
+ for (int i = startPos; i < len; i++)
+ {
+ if (string[i] == '/' && (i + 1 < len) && string[i + 1] == '*')
+ ignore = true;
+ if (string[i] == '*' && (i + 1 < len) && string[i + 1] == '/')
+ ignore = false;
+ if (!ignore && string[i] == ch)
+ {
+ pos = i;
+ break;
+ }
+ }
+ return pos;
+}
+
+void stylesheetParser::parseSelector(){
+ int closingParenthesisPos = findParanthesis(m_styleSheet, '}');
+ if(closingParenthesisPos==-1) {
+ m_stopProcessing = true;
+ emit errorOccurred(i18n("The selector") + " :\n" +m_styleSheet.mid(0,20) + "...\n "+ msg1);
+ return;
+ }
+
+ QString temp(m_styleSheet.left(closingParenthesisPos+1));
+
+ if(numberOfParenthesisInAParenthesisBlock(closed,temp) < numberOfParenthesisInAParenthesisBlock(opened,temp)){
+ m_stopProcessing = true;
+ emit errorOccurred(i18n("The selector") + " :\n" +m_styleSheet.mid(0,20) + "...\n "+ msg1);
+ return;
+ }
+
+ if(numberOfParenthesisInAParenthesisBlock(closed,temp) > numberOfParenthesisInAParenthesisBlock(opened,temp)){
+ m_stopProcessing = true;
+ emit errorOccurred(i18n("The selector") + " :\n" +m_styleSheet.mid(0,20) + "...\n "+ msg2);
+ return;
+ }
+
+ int closingParentheses = 1,
+ openingParentheses = 0;
+ while(true){
+ openingParentheses = numberOfParenthesisInAParenthesisBlock(closed,m_styleSheet.left(closingParenthesisPos+1)); //m_styleSheet.left(closingParenthesisPos+1).contains("{");
+
+ if(openingParentheses==closingParentheses){
+ QString selectorName=m_styleSheet.left(findParanthesis(m_styleSheet, '{')/*m_styleSheet.find("{")*/).stripWhiteSpace(),
+ selectorValue=m_styleSheet.mid(findParanthesis(m_styleSheet, '{')/*m_styleSheet.find("{")*/+1, closingParenthesisPos - m_styleSheet.find("{") -1);
+
+ selectorName.remove("\n").remove("\t");
+ selectorValue.remove("\n").remove("\t");
+ QPair<QString,unsigned int> tmp(selectorValue,++m_orderNumber);
+
+ if (m_stylesheetStructure.contains(selectorName))
+ {
+ uint i = 2;
+ QString s = selectorName + QString("-v%1").arg(i);
+ while (m_stylesheetStructure.contains(s))
+ {
+ i++;
+ s = selectorName + QString("-v%1").arg(i);
+ }
+ selectorName = s;
+ }
+ m_stylesheetStructure[selectorName]=tmp;
+ break;
+ }
+ else {
+ closingParenthesisPos = findParanthesis(m_styleSheet, '{',closingParenthesisPos+1)/*m_styleSheet.find("}",closingParenthesisPos+1)*/;
+ closingParentheses++;
+ }
+ }
+
+ int ws=whiteSpaces(closingParenthesisPos+1);
+ m_styleSheet=m_styleSheet.right(m_styleSheet.length()-closingParenthesisPos-1-ws);
+ parse();
+}
+
+void stylesheetParser::parseAtRules1(){
+//TODO this needs to be fixed : in case the at rule is not properly closed the parser hangs
+ if(m_styleSheet.find("{") == -1) {
+ m_stopProcessing = true;
+ emit errorOccurred(m_styleSheet.mid(0,20) + "...\n " + msg2);
+ return;
+ }
+
+ int closingParenthesisPos = m_styleSheet.find("}"),
+ closingParentheses = 0;
+
+ if(closingParenthesisPos==-1) return;
+ else closingParentheses = 1;
+
+ int openingParentheses=0;
+ while(true){
+ openingParentheses = m_styleSheet.left(closingParenthesisPos+1).contains("{");
+
+ if(openingParentheses==closingParentheses)
+ break;
+ else {
+ closingParenthesisPos = m_styleSheet.find("}",closingParenthesisPos+1);
+ if( closingParenthesisPos!= -1 )
+ closingParentheses++;
+ else {
+ m_stopProcessing = true;
+ emit errorOccurred(m_styleSheet.mid(0,20) + "...\n " + msg1);
+ return;
+ }
+ }
+ }
+
+ int ws=whiteSpaces(closingParenthesisPos+1);
+ QPair<QString,unsigned int> tmp(m_styleSheet.left(closingParenthesisPos+1+ws),++m_orderNumber);
+ m_stylesheetStructure["@rule"+QString::number(m_orderNumber,10)]=tmp;
+ m_styleSheet=m_styleSheet.right(m_styleSheet.length()-closingParenthesisPos-1-ws);
+ parse();
+}
+
+void stylesheetParser::parseAtRules2(){
+//TODO this needs to be fixed : in case the at rule is not properly closed the parser hangs
+ int semicolonPos = m_styleSheet.find(";");
+
+ if(semicolonPos==-1) {
+ m_stopProcessing = true;
+ emit errorOccurred(m_styleSheet.mid(0,20) + "...\n " + msg1);
+ return;
+ }
+
+ int ws=whiteSpaces(semicolonPos+1);
+ QPair<QString,unsigned int> tmp(m_styleSheet.left(semicolonPos+1+ws),++m_orderNumber);
+ m_stylesheetStructure["@rule"+QString::number(m_orderNumber,10)]=tmp;
+ m_styleSheet=m_styleSheet.right(m_styleSheet.length()-semicolonPos-1-ws);
+ parse();
+}
+
+#include "stylesheetparser.moc"
diff --git a/quanta/components/csseditor/stylesheetparser.h b/quanta/components/csseditor/stylesheetparser.h
new file mode 100644
index 00000000..26d5fa3e
--- /dev/null
+++ b/quanta/components/csseditor/stylesheetparser.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ stylesheetparser.h - description
+ -------------------
+ begin : gio ago 19 2004
+ copyright : (C) 2004 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef STYLESHEETPARSER_H
+#define STYLESHEETPARSER_H
+
+#include <qmap.h>
+#include <qpair.h>
+#include <qobject.h>
+
+/**
+ *@author gulmini luciano
+ */
+
+class stylesheetParser : public QObject{
+ Q_OBJECT
+ private:
+
+ enum parenthesisKind { opened, closed };
+ QString m_styleSheet;
+ bool m_stopProcessing;
+ unsigned int m_orderNumber;
+ QMap<QString, QPair<QString,unsigned int> > m_stylesheetStructure;
+ void parseComment();
+ void parseSelector();
+ void parseAtRules1();
+ void parseAtRules2();
+ int whiteSpaces(int);
+ unsigned int numberOfParenthesisInAParenthesisBlock(parenthesisKind p, const QString& b);
+
+ public:
+ stylesheetParser(const QString& s);
+ ~stylesheetParser(){}
+ void parse();
+
+ QMap<QString, QPair<QString,unsigned int> > stylesheetStructure() { return m_stylesheetStructure; }
+ unsigned int orderNumber() const {return m_orderNumber; }
+
+ signals:
+ void errorOccurred(const QString&);
+};
+
+#endif
+
diff --git a/quanta/components/csseditor/tlpeditors.cpp b/quanta/components/csseditor/tlpeditors.cpp
new file mode 100644
index 00000000..706ac518
--- /dev/null
+++ b/quanta/components/csseditor/tlpeditors.cpp
@@ -0,0 +1,174 @@
+/***************************************************************************
+ tlpeditors.cpp - description
+ -------------------
+ begin : gio apr 1 2004
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlineedit.h>
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+#include <kpushbutton.h>
+#include <kurl.h>
+#include <kdialog.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kfiledialog.h>
+#include <kimagefilepreview.h>
+
+#include "qextfileinfo.h"
+#include "tlpeditors.h"
+#include "fontfamilychooser.h"
+#include "project.h"
+
+TLPEditor::TLPEditor(QWidget *parent, const char* name) : miniEditor(parent,name){
+ m_label = new QLabel(this);
+ m_le = new QLineEdit(this);
+ m_pb = new KPushButton(this);
+ setSpacing( KDialog::spacingHint() );
+}
+
+TLPEditor::~TLPEditor(){
+ delete m_label;
+ delete m_le;
+ delete m_pb;
+}
+
+void TLPEditor::setButtonIcon(QString s){
+ QIconSet iconSet = SmallIconSet(QString::fromLatin1(s));
+ QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
+ m_pb->setIconSet(iconSet);
+ m_pb->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
+}
+
+void TLPEditor::setLabelText(QString s){
+ m_label->setText(s);
+}
+
+void TLPEditor::setToolTip(QString s){
+ QToolTip::add(m_pb, s);
+}
+
+void TLPEditor::setWhatsThis(QString s){
+ QWhatsThis::add(m_le,s);
+}
+
+URIEditor::URIEditor(QWidget *parent, const char* name) : TLPEditor(parent,name){
+ QString whatsthis =i18n("With this line edit you can insert the URI of the resource you want to reach");
+ setWhatsThis(whatsthis);
+ setLabelText(" Uri :");
+ setButtonIcon("fileopen");
+ setToolTip(i18n("Open the URI selector"));
+
+ connect(m_pb, SIGNAL(clicked()), this, SLOT(openFileDialog()));
+}
+
+void URIEditor::connectToPropertySetter(propertySetter* p){
+ connect(this,SIGNAL(valueChanged(const QString&)), p ,SIGNAL(valueChanged(const QString&)));
+}
+
+void URIEditor::setMode(const mode& m) {
+ m_Mode = m ;
+ if( m_Mode == Single )
+ connect(m_le, SIGNAL(textChanged ( const QString & )), this, SLOT(selectedURI(const QString&)));
+ else{
+ connect(m_le, SIGNAL(textChanged ( const QString & )), this, SLOT(selectedURIs(const QStringList&)));
+ }
+}
+
+void URIEditor::selectedURI(const QString & s){
+ KURL u;
+ u.setPath(s);
+ emit valueChanged("url(\'" + QExtFileInfo::toRelative(u, Project::ref()->projectBaseURL()).path() + "\')");
+}
+
+void URIEditor::selectedURIs(const QStringList& s){
+ KURL u;
+ QStringList selectedFiles = s,
+ selectedFilesWithURLFormat;
+ for ( QStringList::Iterator it = selectedFiles.begin(); it != selectedFiles.end(); ++it ){
+ u.setPath(*it);
+ selectedFilesWithURLFormat.append( "url(\'" + QExtFileInfo::toRelative(u, Project::ref()->projectBaseURL()).path() + "\')");
+ }
+ emit valueChanged(selectedFilesWithURLFormat.join(","));
+}
+
+void URIEditor::openFileDialog(){
+
+ KFileDialog fd( Project::ref()->projectBaseURL().url(), "*.*", this, "file dialog", true );
+ switch(m_resourceType) {
+ case image : {
+ fd.setFilter( "*.png *.gif *.jpg *.mng|" + i18n("Image Files") +" (*.png *.gif *.jpg *.mng)\n*.*|" + i18n("All Files")+(" (*.*)") );
+ KImageFilePreview *ip = new KImageFilePreview( &fd );
+ fd.setPreviewWidget( ip );
+ }
+ break;
+ case audio : {
+ fd.setFilter( "*.au *.aiff *.wav|" + i18n("Audio Files")+" (*.au *.aiff *.wav)\n*.*|" + i18n("All Files")+(" (*.*)") );
+
+
+ }
+ break;
+ //case mousePointer : fd.setFilter( "*.|" + i18n("Mouse Pointers (*.)")+"\n*.*|" + i18n("All Files (*.*)") );break;
+ case mousePointer : fd.setFilter( "*.*|" + i18n("All Files")+(" (*.*)") );break;
+
+ default:;
+ }
+
+ if( m_Mode == Single)
+ fd.setMode(KFile::File);
+ else
+ fd.setMode(KFile::Files);
+
+
+ if( fd.exec() ){
+ if( fd.mode() == KFile::File )
+ selectedURI( fd.selectedFile() );
+ else {
+ selectedURIs( fd.selectedFiles() );
+ /*QStringList selectedFiles = fd.selectedFiles();
+ KURL u;
+ for ( QStringList::Iterator it = selectedFiles.begin(); it != selectedFiles.end(); ++it ){
+ u.setPath(*it);
+ m_sFiles.append( "url(\'" + QExtFileInfo::toRelative(u, Project::ref()->projectBaseURL()).path() + "\')");
+ }
+ emit valueChanged(m_sFiles.join(","));*/
+ }
+ }
+}
+
+fontEditor::fontEditor(QWidget *parent, const char* name) : TLPEditor(parent,name), m_initialValue(QString::null){
+ QString whatsthis =i18n("With this line edit you can insert the name of the font you want to use");
+ setWhatsThis(whatsthis);
+ setLabelText(i18n("Font family:"));
+ setButtonIcon("fonts");
+ setToolTip(i18n("Open font family chooser"));
+ connect(m_pb, SIGNAL(clicked()), this, SLOT(openFontChooser()));
+ connect(m_le, SIGNAL(textChanged ( const QString & )), this, SIGNAL( valueChanged( const QString& ) ) );
+}
+
+void fontEditor::connectToPropertySetter(propertySetter* p){
+ connect(this, SIGNAL(valueChanged(const QString&)), p, SIGNAL(valueChanged(const QString&)));
+}
+
+void fontEditor::openFontChooser(){
+ fontFamilyChooser dlg( this );
+ dlg.setInitialValue(m_initialValue);
+ if( dlg.exec() )
+ emit valueChanged( dlg.fontList().join(", "));
+}
+
+#include "tlpeditors.moc"
diff --git a/quanta/components/csseditor/tlpeditors.h b/quanta/components/csseditor/tlpeditors.h
new file mode 100644
index 00000000..d0e52d37
--- /dev/null
+++ b/quanta/components/csseditor/tlpeditors.h
@@ -0,0 +1,94 @@
+/***************************************************************************
+ tlpeditors.h - description
+ -------------------
+ begin : gio apr 1 2004
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef TLPEDITORS_H
+#define TLPEDITORS_H
+
+#include "minieditor.h"
+#include "propertysetter.h"
+
+class KPushButton;
+class QLineEdit;
+class QLabel;
+/**
+ *@author gulmini luciano
+ */
+
+
+class TLPEditor : public miniEditor { //editor with a line text and a button calling a dialog
+ Q_OBJECT
+
+ protected:
+ QLineEdit *m_le;
+ QLabel *m_label;
+ KPushButton *m_pb;
+
+ public:
+ TLPEditor(QWidget *parent, const char* name=0);
+ virtual ~TLPEditor();
+ virtual void setButtonIcon(QString);
+ void setToolTip(QString);
+ void setLabelText(QString);
+ void setWhatsThis(QString);
+ QLineEdit* lineEdit() const { return m_le; }
+ KPushButton* button() const { return m_pb; }
+ virtual void setInitialValue(const QString& s)=0;
+ virtual void connectToPropertySetter(propertySetter* p)=0;
+
+ signals:
+ void valueChanged(const QString&);
+};
+
+class fontEditor : public TLPEditor{
+ Q_OBJECT
+ private:
+ QString m_initialValue;
+
+ public:
+ fontEditor(QWidget *parent, const char* name=0);
+ virtual void setInitialValue(const QString& s) { m_initialValue = s; }
+ virtual void connectToPropertySetter(propertySetter* p);
+
+ public slots:
+ void openFontChooser();
+};
+
+class URIEditor : public TLPEditor {
+ Q_OBJECT
+ public:
+ enum mode{ Multi, Single };
+ enum URIResourceType{ audio, image, mousePointer };
+
+ private:
+ mode m_Mode;
+ URIResourceType m_resourceType;
+
+ public:
+ URIEditor(QWidget *parent, const char* name=0);
+ void setMode(const mode& m);
+ void setResourceType(const URIResourceType& r) { m_resourceType = r ; }
+ virtual void setInitialValue(const QString& /*s*/){}
+ virtual void connectToPropertySetter(propertySetter* p);
+
+ public slots:
+ void selectedURI(const QString&);
+ void selectedURIs(const QStringList&);
+ void openFileDialog();
+};
+
+
+#endif
diff --git a/quanta/components/cvsservice/Makefile.am b/quanta/components/cvsservice/Makefile.am
new file mode 100644
index 00000000..79429348
--- /dev/null
+++ b/quanta/components/cvsservice/Makefile.am
@@ -0,0 +1,13 @@
+noinst_LTLIBRARIES = libcvsservice.la
+
+libcvsservice_la_SOURCES = cvsservice.cpp cvscommitdlgs.ui \
+ cvsservicedcopif.skel cvsupdatetodlgs.ui
+libcvsservice_la_METASOURCES = AUTO
+
+AM_CPPFLAGS = -I$(top_srcdir)/quanta/src \
+ -I$(top_srcdir)/quanta/utility \
+ -I$(top_srcdir)/quanta/parsers \
+ -I$(top_srcdir)/quanta/project \
+ -I$(top_srcdir)/lib \
+ $(KMDI_INCLUDES) $(all_includes)
+noinst_HEADERS = cvsservicedcopif.h
diff --git a/quanta/components/cvsservice/cvscommitdlgs.ui b/quanta/components/cvsservice/cvscommitdlgs.ui
new file mode 100644
index 00000000..ce2c9fd0
--- /dev/null
+++ b/quanta/components/cvsservice/cvscommitdlgs.ui
@@ -0,0 +1,150 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>CVSCommitDlgS</class>
+<comment>/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2 of the License. *
+ * *
+***************************************************************************/
+</comment>
+<author>(C) 2004 Andras Mantia &lt;amantia@kde.org&gt;</author>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>CVSCommitDlgS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>CVS Commit </string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListBox" row="1" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>fileList</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Commit the following files:</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="3" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>messageCombo</cstring>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Older &amp;messages:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>messageCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Log message:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>logEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QTextEdit" row="5" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>logEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="6" column="3">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="6" column="2">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="6" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>80</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CVSCommitDlgS</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CVSCommitDlgS</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>messageCombo</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>logEdit</receiver>
+ <slot>setText(const QString&amp;)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>fileList</tabstop>
+ <tabstop>messageCombo</tabstop>
+ <tabstop>logEdit</tabstop>
+ <tabstop>okButton</tabstop>
+ <tabstop>cancelButton</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klistbox.h</includehint>
+</includehints>
+</UI>
diff --git a/quanta/components/cvsservice/cvsservice.cpp b/quanta/components/cvsservice/cvsservice.cpp
new file mode 100644
index 00000000..043af54e
--- /dev/null
+++ b/quanta/components/cvsservice/cvsservice.cpp
@@ -0,0 +1,555 @@
+/***************************************************************************
+ cvsservice.cpp - description
+ ------------------------------
+ begin : Sun May 16 17:50:25 2004
+ copyright : (C) 2004, 2005 by Andras Mantia <amantia@kde.org>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2
+ *
+ ***************************************************************************/
+
+//qt include
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qradiobutton.h>
+#include <qtextedit.h>
+#include <qtextstream.h>
+#include <qtimer.h>
+
+//kde includes
+#include <kaction.h>
+#include <kapplication.h>
+#include <kcombobox.h>
+#include <kdeversion.h>
+#include <kiconloader.h>
+#include <klineedit.h>
+#include <klistbox.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpopupmenu.h>
+
+// CvsService
+#include <repository_stub.h>
+#include <cvsservice_stub.h>
+#include <cvsjob_stub.h>
+
+#include "cvsservice.h"
+#include "cvscommitdlgs.h"
+#include "cvsupdatetodlgs.h"
+
+#define CVSSERVICE_TIMEOUT 1000*60
+
+CVSService::CVSService(KActionCollection *ac)
+{
+ m_menu = new KPopupMenu();
+ KAction *action = new KAction(i18n("&Commit..."), "vcs_commit", 0, this, SLOT(slotCommit()), ac, "vcs_commit");
+ action->plug(m_menu);
+ action = new KAction(i18n("&Update"), "vcs_update", 0, this, SLOT(slotUpdate()), ac, "vcs_update");
+ action->plug(m_menu);
+ KPopupMenu *updateToMenu = new KPopupMenu(m_menu);
+ m_menu->insertItem(SmallIconSet("vcs_update"), i18n("Update &To"), updateToMenu);
+ action = new KAction(i18n("&Tag/Date..."), "vcs_update", 0, this, SLOT(slotUpdateToTag()), ac, "vcs_update_tag_date");
+ action->plug(updateToMenu);
+ action = new KAction(i18n("&HEAD"), "vcs_update", 0, this, SLOT(slotUpdateToHead()), ac, "vcs_update_head");
+ action->plug(updateToMenu);
+ action = new KAction(i18n("Re&vert"), "reload", 0, this, SLOT(slotRevert()), ac, "vcs_revert");
+ action->plug(m_menu);
+ m_menu->insertSeparator();
+ action = new KAction(i18n("&Add to Repository..."), "vcs_add", 0, this, SLOT(slotAdd()), ac, "vcs_add");
+ action->plug(m_menu);
+ action = new KAction(i18n("&Remove From Repository..."), "vcs_remove", 0, this, SLOT(slotRemove()), ac, "vcs_remove");
+ action->plug(m_menu);
+ action = new KAction(i18n("&Ignore in CVS Operations"), 0, this, SLOT(slotAddToCVSIgnore()), ac);
+ action->plug(m_menu);
+ action = new KAction(i18n("Do &Not Ignore in CVS Operations"), 0, this, SLOT(slotRemoveFromCVSIgnore()), ac);
+ action->plug(m_menu);
+
+ m_menu->insertSeparator();
+ action = new KAction(i18n("Show &Log Messages"), 0, this, SLOT(slotBrowseLog()), ac);
+ action->plug(m_menu);
+
+ m_cvsJob = 0L;
+ m_repository = 0L;
+ m_cvsService =0L;
+ m_commitDlg = new CVSCommitDlgS();
+ m_updateToDlg = new CVSUpdateToDlgS();
+ m_timer = new QTimer(this);
+ connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
+}
+
+CVSService::~CVSService()
+{
+ if (m_cvsService)
+ m_cvsService->quit();
+ delete m_cvsService;
+ delete m_menu;
+ delete m_repository;
+ m_repository = 0L;
+ m_cvsService = 0L;
+ delete m_commitDlg;
+ delete m_updateToDlg;
+}
+
+void CVSService::setAppId(const QCString &id)
+{
+ m_appId = id;
+ m_cvsService = new CvsService_stub(m_appId, "CvsService");
+ m_timer->start(CVSSERVICE_TIMEOUT, true);
+}
+
+void CVSService::setRepository(const QString &repository)
+{
+ startService();
+ delete m_repository;
+ m_repository = new Repository_stub(m_appId, "CvsRepository");
+ if (m_repository->setWorkingCopy(repository))
+ {
+ m_repositoryPath = repository;
+ if (!m_repositoryPath.endsWith("/"))
+ m_repositoryPath += "/";
+ }
+}
+
+void CVSService::slotUpdate()
+{
+ QStringList files;
+ if (!m_defaultFile.isEmpty())
+ {
+ if (m_defaultFile.startsWith(m_repositoryPath))
+ {
+ files += m_defaultFile.remove(m_repositoryPath);
+ slotUpdate(files);
+ } else
+ {
+ notInRepository();
+ }
+ }
+}
+
+void CVSService::slotUpdate(const QStringList &files)
+{
+ startService();
+ if (m_repository && !m_appId.isEmpty())
+ {
+ emit clearMessages();
+ emit showMessage(i18n("Running CVS update...") + "\n", false);
+ m_files = files;
+ m_job = m_cvsService->update(files, true, true, true, "");
+ m_cvsCommand = "update";
+ m_cvsJob = new CvsJob_stub(m_job.app(), m_job.obj());
+
+ connectDCOPSignal(m_job.app(), m_job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStdout(QString)", "slotReceivedStdout(QString)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStderr(QString)", "slotReceivedStderr(QString)", true);
+ m_cvsJob->execute();
+ }
+}
+
+void CVSService::slotUpdateToTag()
+{
+ QStringList files;
+ if (!m_defaultFile.isEmpty())
+ {
+ if (m_defaultFile.startsWith(m_repositoryPath))
+ {
+ files += m_defaultFile.remove(m_repositoryPath);
+ slotUpdateToTag(files);
+ } else
+ {
+ notInRepository();
+ }
+ }
+}
+
+void CVSService::slotUpdateToTag(const QStringList &files)
+{
+ startService();
+ if (m_repository && !m_appId.isEmpty() && m_updateToDlg->exec())
+ {
+ QString extraOpts;
+ QString commandStr;
+ if (m_updateToDlg->tagRadioButton->isChecked())
+ {
+ extraOpts = "-r " + m_updateToDlg->tagCombo->currentText();
+ commandStr = i18n("Updating to revision %1 ...").arg(m_updateToDlg->tagCombo->currentText());
+ } else
+ {
+ extraOpts = "-D " + m_updateToDlg->dateLineEdit->text();
+ commandStr = i18n("Updating to the version from %1 ...").arg(+ m_updateToDlg->dateLineEdit->text());
+ }
+ emit clearMessages();
+ emit showMessage(commandStr + "\n", false);
+ m_files = files;
+ m_job = m_cvsService->update(files, true, true, true, extraOpts);
+ m_cvsCommand = "update";
+ m_cvsJob = new CvsJob_stub(m_job.app(), m_job.obj());
+
+ connectDCOPSignal(m_job.app(), m_job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStdout(QString)", "slotReceivedStdout(QString)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStderr(QString)", "slotReceivedStderr(QString)", true);
+ m_cvsJob->execute();
+ }
+}
+
+void CVSService::slotUpdateToHead()
+{
+ QStringList files;
+ if (!m_defaultFile.isEmpty())
+ {
+ if (m_defaultFile.startsWith(m_repositoryPath))
+ {
+ files += m_defaultFile.remove(m_repositoryPath);
+ slotUpdateToHead(files);
+ } else
+ {
+ notInRepository();
+ }
+ }
+}
+
+void CVSService::slotUpdateToHead(const QStringList &files)
+{
+ startService();
+ if (m_repository && !m_appId.isEmpty())
+ {
+ emit clearMessages();
+ emit showMessage(i18n("Updating to HEAD...") + "\n", false);
+ m_files = files;
+ m_job = m_cvsService->update(files, true, true, true, "-A");
+ m_cvsCommand = "update";
+ m_cvsJob = new CvsJob_stub(m_job.app(), m_job.obj());
+
+ connectDCOPSignal(m_job.app(), m_job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStdout(QString)", "slotReceivedStdout(QString)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStderr(QString)", "slotReceivedStderr(QString)", true);
+ m_cvsJob->execute();
+ }
+}
+
+void CVSService::slotCommit()
+{
+ QStringList files;
+ if (!m_defaultFile.isEmpty())
+ {
+ if (m_defaultFile.startsWith(m_repositoryPath))
+ {
+ files += m_defaultFile.remove(m_repositoryPath);
+ slotCommit(files);
+ } else
+ {
+ notInRepository();
+ }
+ }
+}
+
+void CVSService::slotCommit(const QStringList &files)
+{
+ startService();
+ m_commitDlg->fileList->clear();
+ m_commitDlg->fileList->insertStringList(files);
+ m_commitDlg->logEdit->clear();
+ m_commitDlg->messageCombo->insertItem(i18n("Current"), 0);
+ m_commitDlg->messageCombo->setCurrentItem(0);
+
+ if (m_repository && !m_appId.isEmpty() && m_commitDlg->exec())
+ {
+ m_commitDlg->messageCombo->removeItem(0);
+ QString message = m_commitDlg->logEdit->text();
+ if (message != m_commitDlg->messageCombo->currentText())
+ m_commitDlg->messageCombo->insertItem(message, 0);
+ emit clearMessages();
+ emit showMessage(i18n("Running CVS commit...") + "\n", false);
+ m_files = files;
+ m_job = m_cvsService->commit(files, message, true);
+ m_cvsCommand = "commit";
+ m_cvsJob = new CvsJob_stub(m_job.app(), m_job.obj());
+
+ connectDCOPSignal(m_job.app(), m_job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStdout(QString)", "slotReceivedStdout(QString)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStderr(QString)", "slotReceivedStderr(QString)", true);
+ m_cvsJob->execute();
+ }
+}
+
+void CVSService::slotRevert()
+{
+ QStringList files;
+ if (!m_defaultFile.isEmpty())
+ {
+ if (m_defaultFile.startsWith(m_repositoryPath))
+ {
+ files += m_defaultFile.remove(m_repositoryPath);
+ slotRevert(files);
+ } else
+ {
+ notInRepository();
+ }
+ }
+}
+
+void CVSService::slotRevert(const QStringList &files)
+{
+ startService();
+ if (m_repository && !m_appId.isEmpty())
+ {
+ emit clearMessages();
+ emit showMessage(i18n("Reverting to the version from the repository...") + "\n", false);
+ m_files = files;
+ m_job = m_cvsService->update(files, true, true, true, "-C");
+ m_cvsCommand = "update";
+ m_cvsJob = new CvsJob_stub(m_job.app(), m_job.obj());
+
+ connectDCOPSignal(m_job.app(), m_job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStdout(QString)", "slotReceivedStdout(QString)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStderr(QString)", "slotReceivedStderr(QString)", true);
+ m_cvsJob->execute();
+ }
+}
+
+void CVSService::slotAdd()
+{
+ QStringList files;
+ if (!m_defaultFile.isEmpty())
+ {
+ if (m_defaultFile.startsWith(m_repositoryPath))
+ {
+ files += m_defaultFile.remove(m_repositoryPath);
+ slotAdd(files);
+ } else
+ {
+ notInRepository();
+ }
+ }
+}
+
+void CVSService::slotAdd(const QStringList &files)
+{
+ startService();
+ if (m_repository && !m_appId.isEmpty() && (KMessageBox::questionYesNoList(0, i18n("Add the following files to repository?"), files, i18n("CVS Add"), KStdGuiItem::add(), i18n("Do Not Add")) == KMessageBox::Yes))
+ {
+ emit clearMessages();
+ emit showMessage(i18n("Adding file to the repository...") + "\n", false);
+ m_files = files;
+ m_job = m_cvsService->add(files, false);
+ m_cvsCommand = "add";
+ m_cvsJob = new CvsJob_stub(m_job.app(), m_job.obj());
+
+ connectDCOPSignal(m_job.app(), m_job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStdout(QString)", "slotReceivedStdout(QString)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStderr(QString)", "slotReceivedStderr(QString)", true);
+ m_cvsJob->execute();
+ }
+}
+
+void CVSService::slotRemove()
+{
+ QStringList files;
+ if (!m_defaultFile.isEmpty())
+ {
+ if (m_defaultFile.startsWith(m_repositoryPath))
+ {
+ files += m_defaultFile.remove(m_repositoryPath);
+ slotRemove(files);
+ } else
+ {
+ notInRepository();
+ }
+ }
+}
+
+void CVSService::slotRemove(const QStringList &files)
+{
+ startService();
+ if (m_repository && !m_appId.isEmpty() && (KMessageBox::warningContinueCancelList(0, i18n("<qt>Remove the following files from the repository?<br>This will remove your <b>working copy</b> as well.</qt>"), files, i18n("CVS Remove")) == KMessageBox::Continue))
+ {
+ emit clearMessages();
+ emit showMessage(i18n("Removing files from the repository...") + "\n", false);
+ m_files = files;
+ m_job = m_cvsService->remove(files, true);
+ m_cvsCommand = "remove";
+ m_cvsJob = new CvsJob_stub(m_job.app(), m_job.obj());
+
+ connectDCOPSignal(m_job.app(), m_job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStdout(QString)", "slotReceivedStdout(QString)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStderr(QString)", "slotReceivedStderr(QString)", true);
+ m_cvsJob->execute();
+ }
+}
+
+void CVSService::slotBrowseLog()
+{
+ startService();
+ if (!m_defaultFile.isEmpty())
+ {
+ if (m_defaultFile.startsWith(m_repositoryPath))
+ {
+ QString file = m_defaultFile.remove(m_repositoryPath);
+ if (m_repository && !m_appId.isEmpty() )
+ {
+ emit clearMessages();
+ emit showMessage(i18n("Showing CVS log...") + "\n", false);
+ m_files += file;
+ m_job = m_cvsService->log(file);
+ m_cvsCommand = "log";
+ m_cvsJob = new CvsJob_stub(m_job.app(), m_job.obj());
+
+ connectDCOPSignal(m_job.app(), m_job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStdout(QString)", "slotReceivedStdout(QString)", true);
+ connectDCOPSignal(m_job.app(), m_job.obj(), "receivedStderr(QString)", "slotReceivedStderr(QString)", true);
+ m_cvsJob->execute();
+ }
+ } else
+ {
+ notInRepository();
+ }
+ }
+}
+
+void CVSService::slotAddToCVSIgnore()
+{
+ if (!m_defaultFile.isEmpty())
+ {
+ if (m_defaultFile.startsWith(m_repositoryPath))
+ {
+ emit clearMessages();
+ QFileInfo fInfo(m_defaultFile);
+ QFile f(fInfo.dirPath()+ "/.cvsignore");
+ if (f.open(IO_ReadWrite))
+ {
+ bool found = false;
+ QTextStream str(&f);
+ str.setEncoding(QTextStream::UnicodeUTF8);
+ QString line;
+ while (!str.atEnd())
+ {
+ line = str.readLine().stripWhiteSpace();
+ if (line == fInfo.fileName())
+ {
+ emit showMessage(i18n("\"%1\" is already in the CVS ignore list.").arg(fInfo.fileName()) + "\n", false);
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ str << fInfo.fileName() << endl;
+ emit showMessage(i18n("\"%1\" added to the CVS ignore list.").arg(fInfo.fileName()) + "\n", false);
+ }
+ f.close();
+ }
+
+ } else
+ {
+ notInRepository();
+ }
+ }
+}
+
+void CVSService::slotRemoveFromCVSIgnore()
+{
+ if (!m_defaultFile.isEmpty())
+ {
+ if (m_defaultFile.startsWith(m_repositoryPath))
+ {
+ emit clearMessages();
+ QString content;
+ QFileInfo fInfo(m_defaultFile);
+ QFile f(fInfo.dirPath()+ "/.cvsignore");
+ bool found = false;
+ if (f.open(IO_ReadWrite))
+ {
+ QTextStream str(&f);
+ str.setEncoding(QTextStream::UnicodeUTF8);
+ QString line;
+ while (!str.atEnd())
+ {
+ line = str.readLine().stripWhiteSpace();
+ if (line != fInfo.fileName())
+ {
+ content += line + "\n";
+ } else
+ found = true;
+ }
+ if (!found)
+ {
+ emit showMessage(i18n("\"%1\" is not in the CVS ignore list.").arg(fInfo.fileName()) + "\n", false);
+ }
+ f.close();
+ }
+ if (found && f.open(IO_WriteOnly))
+ {
+ QTextStream str(&f);
+ str.setEncoding(QTextStream::UnicodeUTF8);
+ str << content;
+ emit showMessage(i18n("\"%1\" removed from the CVS ignore list.").arg(fInfo.fileName()) + "\n", false);
+ f.close();
+ }
+
+ } else
+ {
+ notInRepository();
+ }
+ }
+}
+
+void CVSService::slotJobExited(bool normalExit, int exitStatus)
+{
+ if (!normalExit)
+ {
+ KMessageBox::sorry(0, i18n("<qt>The CVS command <b>%1</b> has failed. The error code was <i>%2</i>.</qt>").arg(m_cvsCommand).arg(exitStatus), i18n("Command Failed"));
+ }
+ if (exitStatus == 0)
+ {
+ emit commandExecuted(m_cvsCommand, m_files);
+ }
+ disconnectDCOPSignal(m_job.app(), m_job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)");
+ disconnectDCOPSignal(m_job.app(), m_job.obj(), "receivedStdout(QString)", "slotReceivedStdout(QString)");
+ disconnectDCOPSignal(m_job.app(), m_job.obj(), "receivedStderr(QString)", "slotReceivedStderr(QString)");
+ //delete m_cvsJob;
+ //m_cvsJob = 0L;
+ emit showMessage(i18n("CVS command finished."), false);
+ emit showMessage(" ", false);
+}
+
+void CVSService::slotReceivedStdout(QString output)
+{
+ emit showMessage(output, true);
+}
+
+void CVSService::slotReceivedStderr(QString output)
+{
+ emit showMessage(output, true);
+}
+
+void CVSService::notInRepository()
+{
+ emit clearMessages();
+ emit showMessage(i18n("Error: \"%1\" is not part of the\n\"%2\" repository.").arg(m_defaultFile).arg(m_repositoryPath) + "\n", false);
+}
+
+void CVSService::startService()
+{
+ if (!m_cvsService)
+ {
+ QString error;
+ KApplication::startServiceByDesktopName("cvsservice", QStringList(), &error,
+ &m_appId);
+ m_cvsService = new CvsService_stub(m_appId, "CvsService");
+ }
+ m_timer->start(CVSSERVICE_TIMEOUT, true);
+}
+
+void CVSService::slotTimeout()
+{
+ if (m_cvsService)
+ m_cvsService->quit();
+ delete m_cvsService;
+ m_cvsService = 0L;
+}
+
+#include "cvsservice.moc"
diff --git a/quanta/components/cvsservice/cvsservice.h b/quanta/components/cvsservice/cvsservice.h
new file mode 100644
index 00000000..ebfcb402
--- /dev/null
+++ b/quanta/components/cvsservice/cvsservice.h
@@ -0,0 +1,118 @@
+/***************************************************************************
+ cvsservice.h - description
+ ------------------------------
+ begin : Sun May 16 17:50:25 2004
+ copyright : (C) 2004, 2005 by Andras Mantia <amantia@kde.org>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2
+ *
+ ***************************************************************************/
+
+#ifndef CVSSERVICE_H
+#define CVSSERVICE_H
+
+//qt includes
+#include <qobject.h>
+
+//kde includes
+#include <dcopref.h>
+
+//own includes
+#include "cvsservicedcopif.h"
+
+class QTimer;
+class KPopupMenu;
+class KActionCollection;
+class CvsJob_stub;
+class CvsService_stub;
+class Repository_stub;
+
+class CVSCommitDlgS;
+class CVSUpdateToDlgS;
+
+/** @short This class manages the CVS repositories from withing Quanta with the help of "cvsservice"
+ *
+ */
+class CVSService : public QObject, public CVSServiceDCOPIf
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * since this class is a singleton you must use this function to access it
+ * @return the class pointer
+ */
+ static CVSService* ref(KActionCollection *ac = 0L)
+ {
+ static CVSService *m_ref;
+ if (!m_ref) m_ref = new CVSService(ac);
+ return m_ref;
+ }
+
+ ~CVSService();
+
+ void setAppId(const QCString& id);
+ /** Returns true if the cvsservice was found */
+ bool exists() {return !m_appId.isEmpty();}
+ void setRepository(const QString &repository);
+ void setCurrentFile(const QString &file) {m_defaultFile = file;}
+ KPopupMenu *menu() {return m_menu;}
+
+public slots:
+ void slotUpdate();
+ void slotUpdate(const QStringList &files);
+ void slotUpdateToTag();
+ void slotUpdateToTag(const QStringList &files);
+ void slotUpdateToHead();
+ void slotUpdateToHead(const QStringList &files);
+ void slotCommit();
+ void slotCommit(const QStringList &files);
+ void slotRevert();
+ void slotRevert(const QStringList &files);
+ void slotAdd();
+ void slotAdd(const QStringList &files);
+ void slotRemove();
+ void slotRemove(const QStringList &files);
+ void slotBrowseLog();
+ void slotAddToCVSIgnore();
+ void slotRemoveFromCVSIgnore();
+
+ virtual void slotJobExited(bool normalExit, int exitStatus);
+ virtual void slotReceivedStdout(QString output);
+ virtual void slotReceivedStderr(QString output);
+
+signals:
+ void clearMessages();
+ void showMessage(const QString &msg, bool append);
+ void commandExecuted(const QString& command, const QStringList& files);
+
+private slots:
+ void slotTimeout();
+
+private:
+ CVSService(KActionCollection *ac);
+ void notInRepository();
+ void startService();
+
+ QCString m_appId;
+ KPopupMenu *m_menu;
+ Repository_stub *m_repository;
+ CvsJob_stub *m_cvsJob;
+ CvsService_stub *m_cvsService;
+ QString m_defaultFile;
+ QString m_repositoryPath;
+ QString m_cvsCommand;
+ QStringList m_files;
+ CVSCommitDlgS *m_commitDlg;
+ CVSUpdateToDlgS *m_updateToDlg;
+ DCOPRef m_job;
+ QTimer *m_timer;
+};
+
+#endif
diff --git a/quanta/components/cvsservice/cvsservicedcopif.h b/quanta/components/cvsservice/cvsservicedcopif.h
new file mode 100644
index 00000000..75c0434a
--- /dev/null
+++ b/quanta/components/cvsservice/cvsservicedcopif.h
@@ -0,0 +1,30 @@
+/***************************************************************************
+ cvsservicedcopif.h - description
+ ------------------------------
+ begin : Sun May 16 22:50:25 2004
+ copyright : (C) 2004 by Andras Mantia <amantia@kde.org>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2
+ *
+ ***************************************************************************/
+
+#ifndef CVSSERVICEDCOPIF_H
+#define CVSSERVICEDCOPIF_H
+
+#include <qstring.h>
+#include <dcopobject.h>
+
+class CVSServiceDCOPIf : virtual public DCOPObject
+{
+ K_DCOP
+k_dcop:
+ virtual void slotJobExited( bool normalExit, int exitStatus ) = 0;
+ virtual void slotReceivedStdout( QString someOutput ) = 0;
+};
+
+#endif
diff --git a/quanta/components/cvsservice/cvsupdatetodlgs.ui b/quanta/components/cvsservice/cvsupdatetodlgs.ui
new file mode 100644
index 00000000..ef646f92
--- /dev/null
+++ b/quanta/components/cvsservice/cvsupdatetodlgs.ui
@@ -0,0 +1,198 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>CVSUpdateToDlgS</class>
+<comment>/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2 of the License. *
+ * *
+***************************************************************************/
+</comment>
+<author>(C) 2005 Andras Mantia &lt;amantia@kde.org&gt;</author>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>CVSUpdateToDlgS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>499</width>
+ <height>213</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>CVS Update</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>dateRadioButton</cstring>
+ </property>
+ <property name="text">
+ <string>Update to &amp;date ('yyyy-mm-dd'):</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>tagRadioButton</cstring>
+ </property>
+ <property name="text">
+ <string>Update to &amp;tag/branch:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>tagCombo</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>dateLineEdit</cstring>
+ </property>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ <spacer row="0" column="0">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>295</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CVSUpdateToDlgS</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CVSUpdateToDlgS</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/quanta/components/debugger/Makefile.am b/quanta/components/debugger/Makefile.am
new file mode 100644
index 00000000..f24e455d
--- /dev/null
+++ b/quanta/components/debugger/Makefile.am
@@ -0,0 +1,25 @@
+SUBDIRS = interfaces gubed dbgp
+METASOURCES = AUTO
+
+
+noinst_LTLIBRARIES = libdebuggermanager.la
+
+libdebuggermanager_la_LDFLAGS = $(all_libraries)
+libdebuggermanager_la_LIBADD = interfaces/libdebuggerinterface.la
+libdebuggermanager_la_SOURCES = debuggermanager.cpp debuggerbreakpoint.cpp \
+ quantadebuggerinterface.cpp debuggervariable.cpp debuggerui.cpp variableslistview.cpp \
+ debuggerbreakpointlist.cpp debuggervariablesets.ui debuggerbreakpointview.cpp pathmapper.cpp \
+ pathmapperdialogs.ui pathmapperdialog.cpp pathmapperdialog.h conditionalbreakpointdialogs.ui \
+ conditionalbreakpointdialog.cpp conditionalbreakpointdialog.h backtracelistview.cpp
+
+AM_CPPFLAGS = -I$(top_srcdir)/quanta/components/debuggerquanta \
+ -I$(top_srcdir)/quanta/components/debugger/interfaces \
+ -I$(top_srcdir)/quanta/project \
+ -I$(top_srcdir)/quanta/utility \
+ -I$(top_srcdir)/quanta/src \
+ -I$(top_srcdir)/quanta/parsers \
+ -I$(top_srcdir)/quanta/parts/preview \
+ -I$(top_srcdir)/quanta/messages \
+ -I$(top_srcdir)/lib \
+ $(KMDI_INCLUDES) $(all_includes)
+noinst_HEADERS = pathmapper.h backtracelistview.h
diff --git a/quanta/components/debugger/backtracelistview.cpp b/quanta/components/debugger/backtracelistview.cpp
new file mode 100644
index 00000000..aa5c8c95
--- /dev/null
+++ b/quanta/components/debugger/backtracelistview.cpp
@@ -0,0 +1,128 @@
+/***************************************************************************
+ backtracelistview.cpp
+ --------------------------
+ begin : 2005-07-31
+ copyright : (C) 2005 Linus McCabe
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// KDE Includes
+#include <klocale.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <kdeversion.h>
+#include <klistview.h>
+
+// Quanta includes
+#include "backtracelistview.h"
+#include "debuggerclient.h"
+#include "debuggermanager.h"
+#include "resource.h"
+#include "quanta.h"
+
+namespace BacktraceListviewColumns
+{
+ // The enums must correspond to the order of the columns
+ // If you change here, change the column adding
+ enum Columns
+ {
+ Level = 0,
+ Type,
+ File,
+ Line,
+ Function
+ };
+}
+
+BacktraceListviewItem::BacktraceListviewItem(BacktraceListview* view)
+ : KListViewItem(view)
+{
+}
+
+
+BacktraceListview::BacktraceListview(QWidget *parent, const char *name)
+ : KListView(parent, name)
+{
+ int charwidth = this->fontMetrics().width("0");
+ // If you change the order here, change the BacktraceListviewColumns enums above
+ addColumn("#", charwidth * 3);
+ addColumn(i18n("Type"), charwidth * 10);
+ addColumn(i18n("File"), charwidth * 60);
+ addColumn(i18n("Line"), charwidth * 6);
+ addColumn(i18n("Function"), charwidth * 30);
+
+ setSorting(BacktraceListviewColumns::Level); // Sort on the level column
+ setAllColumnsShowFocus(true);
+
+ // Jump to bt
+ connect(this, SIGNAL( doubleClicked( QListViewItem *, const QPoint &, int) ), this, SLOT(slotBacktraceDoubleClick( QListViewItem *, const QPoint &, int)));
+}
+
+
+BacktraceListview::~BacktraceListview()
+{}
+
+void BacktraceListview::backtraceShow(int level, BacktraceType type, const QString& filename, long line, const QString& func)
+{
+ BacktraceListviewItem* item = new BacktraceListviewItem(this);
+ item->setLevel(level);
+ item->setType(type);
+ item->setFilename(filename);
+ item->setLine(line);
+ item->setFunc(func);
+
+ item->setText(BacktraceListviewColumns::File, filename);
+ item->setText(BacktraceListviewColumns::Function, func);
+ item->setText(BacktraceListviewColumns::Level, QString::number(level));
+ item->setText(BacktraceListviewColumns::Line, QString::number(line + 1));
+ item->setText(BacktraceListviewColumns::Type, type == File ? i18n("File") : i18n("Eval"));
+
+ insertItem(item);
+}
+
+void BacktraceListview::keyPressEvent(QKeyEvent *e)
+{
+ if(e->key() != Qt::Key_Enter)
+ {
+ e->ignore();
+ return;
+ }
+
+ if(selectedItem())
+ jumpHistory(selectedItem());
+}
+
+void BacktraceListview::clear()
+{
+ KListView::clear();
+}
+
+void BacktraceListview::slotBacktraceDoubleClick(QListViewItem *item, const QPoint &, int )
+{
+ if(!item)
+ return;
+
+ jumpHistory(item);
+}
+
+void BacktraceListview::jumpHistory(QListViewItem *item)
+{
+ BacktraceListviewItem* btitem = dynamic_cast<BacktraceListviewItem*>(item);
+
+ if(btitem->type() == File)
+ {
+ quantaApp->gotoFileAndLine(btitem->filename(), btitem->line(), 0);
+ }
+
+}
+
+#include "backtracelistview.moc"
diff --git a/quanta/components/debugger/backtracelistview.h b/quanta/components/debugger/backtracelistview.h
new file mode 100644
index 00000000..e00d0afc
--- /dev/null
+++ b/quanta/components/debugger/backtracelistview.h
@@ -0,0 +1,93 @@
+/***************************************************************************
+ Backtracelistview.h
+ ------------------------
+ begin : 2005-07-31
+ copyright : (C) 2005 Linus McCabe
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef BACKTRACELISTVIEW_H
+#define BACKTRACELISTVIEW_H
+
+#include <klistview.h>
+#include <kpopupmenu.h>
+#include <qptrlist.h>
+
+class BacktraceListview;
+
+
+enum BacktraceType
+{
+ File = 0,
+ Eval
+};
+
+
+class BacktraceListviewItem : public KListViewItem
+{
+ private:
+ BacktraceType m_type;
+ QString m_filename;
+ QString m_func;
+ long m_line;
+ long m_level;
+
+ public:
+ BacktraceListviewItem();
+ BacktraceListviewItem(BacktraceListview* view);
+
+ // Type
+ BacktraceType type() const { return m_type; }
+ void setType(BacktraceType type) { m_type = type; }
+
+ // Filename
+ QString filename() const { return m_filename; }
+ void setFilename(const QString &filename) { m_filename = filename; }
+
+ // Function
+ QString func() const { return m_func; }
+ void setFunc(const QString &func) { m_func = func; }
+
+ // Line
+ long line() const { return m_line; }
+ void setLine(long line) { m_line= line; }
+
+ // Level
+ long level() const { return m_level; }
+ void setLevel(long level) { m_level = level; }
+
+};
+
+class BacktraceListview : public KListView
+{
+ Q_OBJECT
+
+ public:
+
+ BacktraceListview(QWidget *parent = 0, const char *name = 0);
+ ~BacktraceListview();
+
+ void backtraceShow(int level, BacktraceType type, const QString& filename, long line, const QString& func);
+
+ void clear();
+
+ public slots:
+ void slotBacktraceDoubleClick(QListViewItem *item, const QPoint &point, int column);
+
+ private:
+ void keyPressEvent(QKeyEvent *e);
+ void jumpHistory(QListViewItem *item);
+
+};
+
+#endif
diff --git a/quanta/components/debugger/conditionalbreakpointdialog.cpp b/quanta/components/debugger/conditionalbreakpointdialog.cpp
new file mode 100644
index 00000000..943c33d4
--- /dev/null
+++ b/quanta/components/debugger/conditionalbreakpointdialog.cpp
@@ -0,0 +1,100 @@
+/***************************************************************************
+ conditionalbreakpointdialog.cpp
+ --------------------
+ begin : 2005-01-08
+ copyright : (C) 2004 Linus McCabe <linus@mccabe.nu>
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#include "conditionalbreakpointdialog.h"
+#include <qlistview.h>
+#include <qlineedit.h>
+#include <qextfileinfo.h>
+#include <qcolor.h>
+#include <kcombobox.h>
+#include <kled.h>
+#include <kiconloader.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+
+#include "debuggerbreakpoint.h"
+
+ConditionalBreakpointDialog::ConditionalBreakpointDialog(const QString& expression, const QString& inFile, const QString& inClass, const QString& inFunction)
+ : ConditionalBreakpointDialogS(0, "ConditionalBreakpointDialog", false, 0)
+{
+ comboExpression->setCurrentText(expression);
+ lineFile->setText(inFile);
+ lineClass->setText(inClass);
+ lineFunction->setText(inFunction);
+
+ buttonClearFile->setPixmap(SmallIcon("clear_left"));
+ buttonClearClass->setPixmap(SmallIcon("clear_left"));
+ buttonClearFunction->setPixmap(SmallIcon("clear_left"));
+
+ connect(comboExpression, SIGNAL(textChanged(const QString&)), this, SLOT(slotExpressionChanged()));
+
+ connect(buttonClearFile, SIGNAL(pressed()), this, SLOT(slotClearFile()));
+ connect(buttonClearClass, SIGNAL(pressed()), this, SLOT(slotClearClass()));
+ connect(buttonClearFunction, SIGNAL(pressed()), this, SLOT(slotClearFunction()));
+
+ slotExpressionChanged();
+}
+
+ConditionalBreakpointDialog::~ConditionalBreakpointDialog()
+{
+}
+
+void ConditionalBreakpointDialog::slotExpressionChanged()
+{
+
+ if(comboExpression->currentText().find( QRegExp("[^=!]=[^=]"), 0 ) >= 0)
+ ledWarning->on();
+ else
+ ledWarning->off();
+
+}
+
+void ConditionalBreakpointDialog::slotClearFile()
+{
+ lineFile->setText("");
+}
+
+void ConditionalBreakpointDialog::slotClearClass()
+{
+ lineClass->setText("");
+}
+
+void ConditionalBreakpointDialog::slotClearFunction()
+{
+ lineFunction->setText("");
+}
+
+/*DebuggerBreakpoint::Types type()*/
+
+DebuggerBreakpoint *ConditionalBreakpointDialog::breakpoint()
+{
+ if(comboExpression->currentText().isEmpty())
+ return NULL;
+
+ DebuggerBreakpoint *bp = new DebuggerBreakpoint(
+ (radioOnChange->isChecked() ? DebuggerBreakpoint::ConditionalChange : DebuggerBreakpoint::ConditionalTrue),
+ comboExpression->currentText(),
+ lineFile->text(),
+ lineClass->text(),
+ lineFunction->text());
+
+ return bp;
+}
+
+
+#include "conditionalbreakpointdialog.moc"
+
diff --git a/quanta/components/debugger/conditionalbreakpointdialog.h b/quanta/components/debugger/conditionalbreakpointdialog.h
new file mode 100644
index 00000000..fdae39a3
--- /dev/null
+++ b/quanta/components/debugger/conditionalbreakpointdialog.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+ conditionalbreakpointdialog.h
+ ------------------
+ begin : 2004-04-05
+ copyright : (C) 2004 Linus McCabe <linus@mccabe.nu>
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CONDITIONALBREAKPOINTDIALOG_H
+#define CONDITIONALBREAKPOINTDIALOG_H
+
+#include "conditionalbreakpointdialogs.h"
+#include "debuggerbreakpoint.h"
+
+class ConditionalBreakpointDialog : public ConditionalBreakpointDialogS
+{
+ Q_OBJECT
+
+ public:
+ enum Break
+ {
+ OnTrue = 0,
+ OnChange
+ };
+
+ ConditionalBreakpointDialog(const QString& expression, const QString& inFile, const QString& inClass, const QString& inFunction);
+ ~ConditionalBreakpointDialog();
+
+// QString expression();
+// QString inFile();
+// QString inClass();
+// QString inFunction();
+// DebuggerBreakpoint::Types type();
+
+ DebuggerBreakpoint *breakpoint();
+
+ public slots:
+ void slotExpressionChanged();
+ void slotClearFile();
+ void slotClearClass();
+ void slotClearFunction();
+
+ private:
+
+};
+
+#endif // CONDITIONALBREAKPOINTDIALOG_H
+
diff --git a/quanta/components/debugger/conditionalbreakpointdialogs.ui b/quanta/components/debugger/conditionalbreakpointdialogs.ui
new file mode 100644
index 00000000..8e4a1bf2
--- /dev/null
+++ b/quanta/components/debugger/conditionalbreakpointdialogs.ui
@@ -0,0 +1,329 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>ConditionalBreakpointDialogS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>ConditionalBreakpointDialogS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>564</width>
+ <height>432</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add Conditional Breakpoint</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblExpression</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Expression:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Break When</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>radioOnTrue</cstring>
+ </property>
+ <property name="text">
+ <string>When expression is true</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>radioOnChange</cstring>
+ </property>
+ <property name="text">
+ <string>When expression changes</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>comboExpression</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KLed" row="0" column="2">
+ <property name="name">
+ <cstring>ledWarning</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Lit when a finding a single equal sign in expression (common error)</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>groupBox10</cstring>
+ </property>
+ <property name="title">
+ <string>Only Break In</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblValue</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>File:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblValue_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Objects of class:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>lblValue_3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Function:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>lineFile</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>lineFunction</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>buttonClearFile</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="2">
+ <property name="name">
+ <cstring>buttonClearFunction</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="2">
+ <property name="name">
+ <cstring>buttonClearClass</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>lineClass</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>ConditionalBreakpointDialogS</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>ConditionalBreakpointDialogS</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kled.h</includehint>
+</includehints>
+</UI>
diff --git a/quanta/components/debugger/dbgp/Makefile.am b/quanta/components/debugger/dbgp/Makefile.am
new file mode 100644
index 00000000..fbff3bdf
--- /dev/null
+++ b/quanta/components/debugger/dbgp/Makefile.am
@@ -0,0 +1,17 @@
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = quantadebuggerdbgp.la
+
+quantadebuggerdbgp_la_SOURCES = quantadebuggerdbgp.cpp dbgpsettingss.ui \
+ dbgpsettings.cpp dbgpnetwork.cpp qbytearrayfifo.cpp
+quantadebuggerdbgp_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+quantadebuggerdbgp_la_LIBADD = ../interfaces/libdebuggerinterface.la $(LIB_KPARTS)
+kde_services_DATA = quantadebuggerdbgp.desktop
+
+INCLUDES = -I$(top_srcdir)/quanta/components/debugger \
+ -I$(top_srcdir)/quanta/components/debugger/interfaces -I$(top_srcdir)/quanta/components/debugger/dbgp \
+ -I$(top_srcdir)/quanta/project -I$(top_srcdir)/quanta/utility $(all_includes)
+
+
+noinst_HEADERS = dbgpsettings.h quantadebuggerdbgp.h dbgpnetwork.h \
+ qbytearrayfifo.h
diff --git a/quanta/components/debugger/dbgp/dbgpnetwork.cpp b/quanta/components/debugger/dbgp/dbgpnetwork.cpp
new file mode 100644
index 00000000..87306448
--- /dev/null
+++ b/quanta/components/debugger/dbgp/dbgpnetwork.cpp
@@ -0,0 +1,314 @@
+/*
+ * Copyright (C) 2005 by Linus McCabe, <Linus@McCabe.nu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "dbgpnetwork.h"
+
+#include <kserversocket.h>
+#include <kstreamsocket.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+DBGpNetwork::DBGpNetwork()
+: QObject()
+{
+ m_socket = NULL;
+ m_server = NULL;
+ m_datalen = -1;
+ m_transaction_id = 0;
+}
+
+DBGpNetwork::~DBGpNetwork()
+{
+}
+
+void DBGpNetwork::sessionStart(bool useproxy, const QString& server, const QString & service)
+{
+
+ kdDebug(24002) << k_funcinfo << ", m_server: " << m_server << ", m_socket" << m_socket << endl;
+ m_useproxy = useproxy;
+
+ if(m_useproxy)
+ {
+ if(m_socket)
+ {
+// m_socket->setBufferSize(-1);
+ connect(m_socket, SIGNAL(gotError(int)), this, SLOT(slotError(int)));
+ connect(m_socket, SIGNAL(connected(const KResolverEntry &)), this, SLOT(slotConnected(const KNetwork::KResolverEntry &)));
+ connect(m_socket, SIGNAL(closed()), this, SLOT(slotConnectionClosed()));
+ connect(m_socket, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
+ connect(m_socket, SIGNAL(destroyed()), this, SLOT(slotSocketDestroyed()));
+ m_socket->connect();
+ emit active(false);
+ kdDebug(24002) << k_funcinfo << ", proxy:" << server << ", " << service << endl;
+ }
+ }
+ else
+ {
+ if(!m_server)
+ {
+ m_server = new KNetwork::KServerSocket(service);
+
+ m_server->setAddressReuseable(true);
+ connect(m_server, SIGNAL(readyAccept()), this, SLOT(slotReadyAccept()));
+ connect(m_server, SIGNAL(gotError(int)), this, SLOT(slotError(int)));
+
+ if(m_server->listen())
+ {
+ emit active(true);
+ emit networkError(i18n("Listening on port %1").arg(service), true);
+ }
+ else
+ {
+ delete m_server;
+ m_server = NULL;
+ emit active(false);
+ emit networkError(i18n("Unable to listen on port %1").arg(service), true);
+ }
+ }
+ }
+}
+
+
+void DBGpNetwork::sessionEnd()
+{
+ // Close socket
+ if(m_socket)
+ {
+ m_socket->flush();
+ disconnect(m_socket, SIGNAL(closed()), this, SLOT(slotConnectionClosed()));
+ if (m_socket)
+ m_socket->close();
+ delete m_socket;
+ m_socket = 0L;
+ }
+
+ // Close the server
+ if(m_server)
+ {
+ m_server->close();
+ delete m_server;
+ m_server = NULL;
+ }
+
+ // Fake a connection closed signal
+ slotConnectionClosed();
+ emit active(false);
+}
+
+
+// Socket errors
+void DBGpNetwork::slotError(int)
+{
+ kdDebug(24002) << k_funcinfo << ", m_server: " << m_server << ", m_socket" << m_socket << endl;
+ if(m_socket)
+ {
+ kdDebug(24002) << k_funcinfo << ", " << m_socket->errorString() << endl;
+ if(m_socket->error() == KNetwork::KSocketBase::RemotelyDisconnected)
+ {
+ slotConnectionClosed();
+ emit networkError(i18n("Disconnected from remote host"), true);
+ return;
+ }
+
+ if(m_socket->error())
+ {
+ emit networkError(m_socket->errorString(), true);
+ }
+ }
+
+ if(m_server && m_server->error())
+ {
+ kdDebug(24002) << k_funcinfo << ", " << m_server->errorString() << endl;
+ emit networkError(m_server->errorString(), true);
+ }
+}
+
+// slotReadyAccept
+void DBGpNetwork::slotReadyAccept()
+{
+
+ kdDebug(24002) << k_funcinfo << ", m_server: " << m_server << ", m_socket" << m_socket << endl;
+ if(!m_socket)
+ {
+ disconnect(m_server, SIGNAL(readyAccept()), this, SLOT(slotReadyAccept()));
+
+ m_socket = (KNetwork::KStreamSocket *)m_server->accept(); // KSocketServer returns a KStreamSocket (!)
+ if(m_socket)
+ {
+ kdDebug(24002) << k_funcinfo << ", ready" << ", m_socket" << m_socket << endl;
+ m_socket->enableRead(true);
+ m_socket->setAddressReuseable(true);
+// m_socket->setSocketFlags(KExtendedSocket::inetSocket | KExtendedSocket::inputBufferedSocket);
+// m_socket->setBufferSize(-1);
+ connect(m_socket, SIGNAL(gotError(int)), this, SLOT(slotError(int)));
+ connect(m_socket, SIGNAL(connected(const KResolverEntry &)), this, SLOT(slotConnected(const KResolverEntry &)));
+ connect(m_socket, SIGNAL(closed()), this, SLOT(slotConnectionClosed()));
+ connect(m_socket, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
+ connected();
+ }
+ else
+ {
+ kdDebug(24002) << k_funcinfo << ", " << m_server->errorString() << endl;
+ }
+ }
+
+}
+
+// Connection established
+void DBGpNetwork::slotConnected(const KResolverEntry &)
+{
+ connected();
+}
+
+bool DBGpNetwork::isConnected()
+{
+ return m_socket != NULL && m_socket->state() == KNetwork::KClientSocketBase::Connected;
+}
+
+bool DBGpNetwork::isActive()
+{
+ return
+ (m_socket != NULL && m_socket->state() == KNetwork::KClientSocketBase::Connected)
+ || (m_server != NULL);
+}
+
+void DBGpNetwork::connected()
+{
+
+ kdDebug(24002) << k_funcinfo << endl;
+ emit connected(true);
+// debuggerInterface()->enableAction("debug_disconnect", true);
+// debuggerInterface()->enableAction("debug_request", false);
+}
+
+// Connectio closed
+void DBGpNetwork::slotConnectionClosed()
+{
+ kdDebug(24002) << k_funcinfo << ", m_server: " << m_server << ", m_socket" << m_socket << endl;
+
+ // Check if we have more data to read
+ slotReadyRead();
+// kdDebug(24002) << k_funcinfo << "buffer: " << m_buffer << endl;
+
+ if(m_socket)
+ {
+ m_socket->flush();
+ m_socket->close();
+ delete m_socket;
+ m_socket = NULL;
+ }
+
+ if(m_server)
+ connect(m_server, SIGNAL(readyAccept()), this, SLOT(slotReadyAccept()));
+
+ // Disable all session related actions and enable connection action
+ emit connected(false);
+ emit active(m_server != NULL);
+
+}
+
+
+//called when m_socket is destroyed either by deleting it or if XDebug disconnects from the client
+void DBGpNetwork::slotSocketDestroyed()
+{
+ kdDebug(24002) << k_funcinfo << " , m_server: " << m_server << ", m_socket" << m_socket << endl;
+
+ m_socket = NULL; //m_socket is already wrong, without this the app would crash on the next m_socket->close() or delete m_socket call.
+ slotConnectionClosed();
+}
+
+
+// Data from socket
+void DBGpNetwork::slotReadyRead()
+{
+
+ // Data from dbgp
+ while(m_socket && (m_socket->bytesAvailable() > 0 || m_fifo.length() >= (unsigned long)m_datalen))
+ {
+ int bytes;
+ QString data;
+
+ if(m_socket && m_socket->bytesAvailable() > 0 )
+ {
+ // Read all available bytes from socket and append them to the buffer
+ bytes = m_socket->bytesAvailable();
+ char* buffer = new char[bytes];
+ m_socket->readBlock(buffer, bytes);
+
+ // Put it in the fifo buffer
+ m_fifo.append(buffer, bytes);
+
+ delete[] buffer;
+ }
+
+ while(1)
+ {
+ // If datalen == -1, we didnt read the size yet, otherwise we're reading data.
+ if(m_datalen == -1)
+ {
+ bytes = m_fifo.find('\0');
+ if(bytes < 0)
+ break;
+
+ data = m_fifo.retrieve();
+ m_datalen = data.toLong();
+
+ }
+ if(m_datalen != -1 && (long)m_fifo.length() >= m_datalen + 1)
+ {
+ data = m_fifo.retrieve();
+ m_datalen = -1;
+ emit command(data);
+ }
+ else
+ break;
+ }
+ }
+}
+
+long DBGpNetwork::sendCommand(const QString & command)
+{
+ return sendCommand(command, "");
+}
+
+long DBGpNetwork::sendCommand(const QString & command, const QString & arguments)
+{
+ if(!isConnected())
+ return false;
+
+ m_transaction_id++;
+ QString commandline = command + QString(" -i %1").arg(m_transaction_id) + (!arguments.isEmpty() ? " " : "") + arguments;
+
+ kdDebug(24002) << k_funcinfo << ", sending: " << commandline << endl;
+
+ m_socket->writeBlock(commandline.latin1(), commandline.length() + 1); // Send string + NULL termination
+
+ return m_transaction_id;
+}
+
+long DBGpNetwork::sendCommand( const QString & command, const QString & arguments, const QString & data )
+{
+ QByteArrayFifo buffer;
+ buffer.append(data.ascii(), data.length());
+ return sendCommand(command, arguments + " -- " + buffer.base64Encoded());
+}
+
+// #include "dbgpnetwork.moc"
+
+#include "dbgpnetwork.moc"
diff --git a/quanta/components/debugger/dbgp/dbgpnetwork.h b/quanta/components/debugger/dbgp/dbgpnetwork.h
new file mode 100644
index 00000000..0651bc08
--- /dev/null
+++ b/quanta/components/debugger/dbgp/dbgpnetwork.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2005 by Linus McCabe, <Linus@McCabe.nu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef dbgpnetwork_H
+#define dbgpnetwork_H
+
+#include <kserversocket.h>
+#include <kstreamsocket.h>
+
+#include "qbytearrayfifo.h"
+
+//using namespace KNetwork;
+class KResolverEntry;
+
+class DBGpNetwork : public QObject
+{
+ Q_OBJECT
+
+ private:
+ KNetwork::KStreamSocket *m_socket;
+ KNetwork::KServerSocket *m_server;
+ QByteArrayFifo m_fifo;
+ bool m_useproxy;
+ long m_datalen;
+ long m_transaction_id;
+
+ void connected();
+
+ signals:
+ void active(bool isOnline);
+ void connected(bool isConnected);
+ void networkError(const QString &error, bool log);
+ void command(const QString& data);
+
+ public:
+ DBGpNetwork();
+ ~DBGpNetwork();
+
+ virtual void sessionStart(bool useproxy, const QString& server, const QString & service);
+ virtual void sessionEnd();
+
+ bool isConnected();
+ bool isActive();
+
+ long sendCommand(const QString & command);
+ long sendCommand(const QString & command, const QString & arguments);
+ long sendCommand(const QString & command, const QString & arguments, const QString & data);
+
+ public slots:
+ // Socket slots
+ void slotConnected(const KResolverEntry &);
+ void slotConnectionClosed();
+ void slotError(int);
+ void slotReadyRead();
+ void slotReadyAccept();
+ void slotSocketDestroyed();
+};
+
+
+#endif // dbgpnetwork_H
diff --git a/quanta/components/debugger/dbgp/dbgpsettings.cpp b/quanta/components/debugger/dbgp/dbgpsettings.cpp
new file mode 100644
index 00000000..80b7eaf1
--- /dev/null
+++ b/quanta/components/debugger/dbgp/dbgpsettings.cpp
@@ -0,0 +1,44 @@
+/***************************************************************************
+ dbgpsettings.cpp
+ -------------------
+ begin : 2004-04-05
+ copyright : (C) 2004 Linus McCabe <linus@mccabe.nu>
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#include "qlineedit.h"
+#include "qcheckbox.h"
+#include "dbgpsettings.h"
+#include <ktextbrowser.h>
+
+DBGpSettings::DBGpSettings(const QString &protocolversion)
+ : DBGpSettingsS(0, "DBGpSettings", false, 0)
+{
+ textAbout->setText(textAbout->text().replace("%PROTOCOLVERSION%", protocolversion));
+ connect(checkLocalProject, SIGNAL(toggled(bool)), this, SLOT(slotLocalProjectToggle(bool)));
+}
+
+DBGpSettings::~DBGpSettings()
+{
+}
+
+void DBGpSettings::slotLocalProjectToggle( bool localproject)
+{
+ lineServerBasedir->setEnabled(!localproject);
+ lineLocalBasedir->setEnabled(!localproject);
+}
+
+
+
+
+#include "dbgpsettings.moc"
+
diff --git a/quanta/components/debugger/dbgp/dbgpsettings.h b/quanta/components/debugger/dbgp/dbgpsettings.h
new file mode 100644
index 00000000..4f2721ff
--- /dev/null
+++ b/quanta/components/debugger/dbgp/dbgpsettings.h
@@ -0,0 +1,35 @@
+/***************************************************************************
+ dbgpsettings.h
+ -------------------
+ begin : 2005-08-01
+ copyright : (C) 2005 Linus McCabe <linus@mccabe.nu>
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef DBGPSETTINGS_H
+#define DBGPSETTINGS_H
+
+#include "dbgpsettingss.h"
+
+class DBGpSettings : public DBGpSettingsS
+{
+ Q_OBJECT
+
+ public:
+ DBGpSettings(const QString &protocolversion);
+ ~DBGpSettings();
+
+ public slots:
+ virtual void slotLocalProjectToggle(bool localproject);
+};
+
+#endif
+
diff --git a/quanta/components/debugger/dbgp/dbgpsettingss.ui b/quanta/components/debugger/dbgp/dbgpsettingss.ui
new file mode 100644
index 00000000..2b846a7e
--- /dev/null
+++ b/quanta/components/debugger/dbgp/dbgpsettingss.ui
@@ -0,0 +1,728 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>DBGpSettingsS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>DBGpSettingsS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>569</width>
+ <height>467</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>DBGp Settings</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Ca&amp;ncel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>tabWidget2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;General</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Connection Settings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblDebuggerServerListenPort</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Listen port:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>lineServerListenPort</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>4</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblRequest</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Request URL:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>lineStartSession</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>4</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>See "What's This?" for available variables</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>%afn - Filename of the current script
+%afd - Absolute directory of the current script
+%afp - Absolute path (directory + filename) of the current script
+
+%rfpd - Directory of the current script relative to project root
+%rfpp - Path of the current script relative to project root
+
+%rfdd - Directory of the current script relative to document root
+%rfdp - Path of the current script relative to document root
+
+%apd - Project root
+%add - Document root of current script</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Directory Mapping</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>lineServerBasedir</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>4</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>lblDebuggerServerBasedir</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Server basedir:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>lineLocalBasedir</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>4</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>checkLocalProject</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>4</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblDebuggerLocalBasedir</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Local basedir:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblLocalProject</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Local project:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>groupBox3_2</cstring>
+ </property>
+ <property name="title">
+ <string>Profiling</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>lineProfilerFilename</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>4</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>See "What's This?" for available variables</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Path to the profiler output
+%a - Appid as returned from the debugger
+%c - CRC32 of the initial filepath</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblRequest_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Profiler output:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblLocalProject_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Map profiler output:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>checkProfilerMapFilename</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>4</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If this checkbox is checked, the profiler output filename will be mapped using the basedirs just like the remote script files.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>lblLocalProject_2_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Open automatically:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="1">
+ <property name="name">
+ <cstring>checkProfilerAutoOpen</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>4</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If this checkbox is checked, the profiler output will be opened automatically once the session ends.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Deb&amp;ug Behavior</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>Error Handling</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="4" column="1">
+ <property name="name">
+ <cstring>checkBreakOnUserError</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>User errors</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="5" colspan="1">
+ <property name="name">
+ <cstring>lblBreakOn</cstring>
+ </property>
+ <property name="text">
+ <string>Break on:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="1">
+ <property name="name">
+ <cstring>checkBreakOnUserWarning</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>User warnings</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="1">
+ <property name="name">
+ <cstring>checkBreakOnUserNotice</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>User notices</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>checkBreakOnNotice</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Notices</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>checkBreakOnWarning</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>W&amp;arnings</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>groupBox5</cstring>
+ </property>
+ <property name="title">
+ <string>Execution</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox" row="0" column="1" rowspan="1" colspan="3">
+ <item>
+ <property name="text">
+ <string>Pause</string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image0</pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image1</pixmap>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>comboDefaultExecutionState</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblDefaultExecutionMode</cstring>
+ </property>
+ <property name="text">
+ <string>Default mode:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer4_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;About</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;h4&gt;DBGp Plugin for Quanta +&lt;/h4&gt;</string>
+ </property>
+ </widget>
+ <widget class="KTextBrowser" row="1" column="0">
+ <property name="name">
+ <cstring>textAbout</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name="qrichtext" content="1" /&gt;&lt;/head&gt;&lt;body style="font-size:10pt;font-family:Bitstream Vera Sans"&gt;
+&lt;p&gt;&lt;span style="font-weight:600"&gt;About&lt;/span&gt;&lt;/p&gt;
+&lt;p&gt;DBGp is a debugger protocol defined by the developers of Xdebug. This plugin integrates debuggers that supports the DBGp protocol with Quanta. &lt;/p&gt;
+&lt;p&gt;In order to use this plugin for PHP debugging, you need to get a supporting debugger. Currently, only &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; is tested.&lt;/p&gt;
+&lt;p&gt;For more info about Xdebug, please visit the Xdebug website at &lt;a href="http://xdebug.org"&gt;http://xdebug.org&lt;/a&gt; &lt;/p&gt;
+&lt;p&gt;&lt;span style="font-weight:600"&gt;Technical Details&lt;/span&gt;&lt;/p&gt;
+&lt;p&gt;This version of the debugger supports version %PROTOCOLVERSION% of the DBGp protocol. &lt;/p&gt;
+&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<images>
+ <image name="image0">
+ <data format="PNG" length="696">89504e470d0a1a0a0000000d49484452000000100000001008060000001ff3ff610000027f49444154388d7d93df4b53611cc69ff73de7ccb375dcdad46d2e3269036d21c4420a0b898484e82a08a2a02238a41741dd77e14dff4074d521efbae8a61b2f6a892062604e53117165e28f864dd73adb999e3cdb79cfe9c25a9c4dfa5e3e3ccfe7fdfee02538a412830b226075c3b662804d006b9567a5d4b4d2a7d77a494d5002c81370c20075797dc7fd157804139f77445846a14898fe9a67ead38f4aff661d2031b81006a1e3a16053c7ddcb3e5c3cc5c1ebe1000046c5c6a7af3a86c776b1b2bef3c3cdb2373ebcb83a5e052406e725103a9388473a1e5d13d1e8e60f9b0c1566e1655245727a3b2f19cb5d13c3b7bfff71da43a16073c7bd4b024667b56aa0b7cb0b009858fca75deff1622367357d59d58764597e481203332238317be74ad8d7798ca2ffacbf6a4eceaa00e0d0dea554ac6feb50deaabbc15f635d3c806e9728f9fc6e865cc172b49c2b9875633c1bf34033fca00db6a495a33d3c805840a2c8692638426a00953a40a9dc0000a0820842f9180f80941987cd3c0717ef04bc598ac02354f0b80642c8c1f6096cca03d66a51b791ce37d7bd06007a45a80b7304d8370db82c3d4379564a31a350a404a0f45086a3dc0283c83358fbea5e80a5e7e8b4d2a713a60f53238b36afe630c75b54c45b5487d6eed3408d2c04333712e437b608009c93937e2634a5cec79ba3019febbf1dfc2c9631b594cb448cd19b216e2d55ddda0579245a165adf9f89f94e76b649203517b16d1be9cd5dccafa8997065f241982c4f2a8aa2395cbdf75fb5eac289218fe7c8adf6904b3ada7870b242c9c07ab6bc67e8ea48c89c7a1ee2d6161545d1809adf0800b22cbbbe99a7231a17ed21948f11d894587a26c0d273417e630b405e5194f25fff6f6493fb9b9d8e82910000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="229">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000ac49444154388ded94c10dc33008453f5637ea061ec24cd2293289976083ce440f6d2262b012da5b95277188133f7f4560e0e2039dfc4eb39e621f164097894455c30280debbdb539c0180881c25dcd15a73f2509c8588c0cc3b795a4c445b0170bf65e596158f821969f19af4e8b02bf1f7e2b3890bf09eb8f145660223b63eb6a267ad00e209b47d6cfb39143f824be42e825aab5b4f27b6f2993483db2c223a4aa3db6b0633ff14e80f79015c6574466adcb13f0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>DBGpSettingsS</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>DBGpSettingsS</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tabWidget2</tabstop>
+ <tabstop>lineLocalBasedir</tabstop>
+ <tabstop>lineServerBasedir</tabstop>
+ <tabstop>lineServerListenPort</tabstop>
+ <tabstop>checkBreakOnNotice</tabstop>
+ <tabstop>checkBreakOnWarning</tabstop>
+ <tabstop>checkBreakOnUserNotice</tabstop>
+ <tabstop>checkBreakOnUserWarning</tabstop>
+ <tabstop>checkBreakOnUserError</tabstop>
+ <tabstop>comboDefaultExecutionState</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<slots>
+ <slot>slotLocalProjectToggled(bool)</slot>
+ <slot>checkLocalProject_toggled(bool)</slot>
+ <slot>slotLocalProjectToggle(bool)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>ktextbrowser.h</includehint>
+</includehints>
+</UI>
diff --git a/quanta/components/debugger/dbgp/qbytearrayfifo.cpp b/quanta/components/debugger/dbgp/qbytearrayfifo.cpp
new file mode 100644
index 00000000..3060e43d
--- /dev/null
+++ b/quanta/components/debugger/dbgp/qbytearrayfifo.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2005 by Linus McCabe, <Linus@McCabe.nu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "qbytearrayfifo.h"
+#include <qcstring.h>
+#include <kmdcodec.h>
+
+QByteArrayFifo::QByteArrayFifo( )
+{
+ m_size = 0;
+ m_array.resize(0);
+}
+
+QString QByteArrayFifo::retrieve( )
+{
+ // See if there's a null teminator somewhere
+ QString str(m_array);
+ size_t size = str.length() + 1;
+
+ // Decrease size and move bytes to the beginning of the array
+ m_size -= size;
+ for(size_t cnt = 0; cnt < m_size; cnt++)
+ m_array[cnt] = m_array[cnt + size];
+
+ // Resize array, needed for find() to work
+ m_array.resize(m_size);
+
+ return str;
+}
+
+bool QByteArrayFifo::append(const char * chars, size_t size )
+{
+ // Resize the array, fail if not possible
+ if(!m_array.resize(m_size + size ))
+ return false;
+
+ // Copy the elements
+ for(size_t cnt = 0; cnt < size; cnt++)
+ m_array[cnt + m_size] = chars[cnt];
+
+ // Increase size var
+ m_size += size;
+
+ return true;
+}
+
+long QByteArrayFifo::find( char character )
+{
+ // If size is 0, find() outputs a warning for some reason
+ if(m_size == 0)
+ return -1;
+
+ return m_array.find(character);
+}
+
+QString QByteArrayFifo::base64Encoded()
+{
+ return KCodecs::base64Encode(m_array);
+}
+
diff --git a/quanta/components/debugger/dbgp/qbytearrayfifo.h b/quanta/components/debugger/dbgp/qbytearrayfifo.h
new file mode 100644
index 00000000..a422bc3d
--- /dev/null
+++ b/quanta/components/debugger/dbgp/qbytearrayfifo.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2005 by Linus McCabe, <Linus@McCabe.nu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef qbytearrayfifo_H
+#define qbytearrayfifo_H
+
+#include <qstring.h>
+#include <qcstring.h>
+
+class QByteArrayFifo
+{
+
+ public:
+ QByteArrayFifo();
+ bool append(const char * chars, size_t size);
+ QString retrieve();
+ QString base64Encoded();
+ long find(char character);
+ size_t length() { return m_size; }
+
+ private:
+ QByteArray m_array;
+ size_t m_size;
+
+};
+
+#endif // qbytearrayfifo_H
diff --git a/quanta/components/debugger/dbgp/quantadebuggerdbgp.cpp b/quanta/components/debugger/dbgp/quantadebuggerdbgp.cpp
new file mode 100644
index 00000000..100ec9d3
--- /dev/null
+++ b/quanta/components/debugger/dbgp/quantadebuggerdbgp.cpp
@@ -0,0 +1,1042 @@
+/***************************************************************************
+ quantadebuggerdbgp.cpp
+ -------------------
+ begin : 2004-03-12
+ copyright : (C) 2004 Linus McCabe <linus@mccabe.nu>
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <errno.h>
+#include <kdebug.h>
+#include <kdeversion.h>
+#include <kgenericfactory.h>
+#include <klocale.h>
+#include <kmdcodec.h>
+#include <kmessagebox.h>
+#include <krun.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qfile.h>
+#include <qlineedit.h>
+#include <qmap.h>
+#include <qregexp.h>
+#include <qslider.h>
+#include <qstring.h>
+
+#include <stdarg.h>
+
+#include "debuggerclient.h"
+#include "quantadebuggerdbgp.h"
+#include "debuggerinterface.h"
+#include "debuggerbreakpoint.h"
+#include "dbgpsettings.h"
+#include "debuggervariable.h"
+#include "variableslistview.h"
+#include "pathmapper.h"
+
+
+
+K_EXPORT_COMPONENT_FACTORY( quantadebuggerdbgp,
+ KGenericFactory<QuantaDebuggerDBGp>("quantadebuggerdbgp"))
+
+const char QuantaDebuggerDBGp::protocolversion[] = "1.0";
+
+QuantaDebuggerDBGp::QuantaDebuggerDBGp (QObject *parent, const char*, const QStringList&)
+ : DebuggerClient (parent, "DBGp")
+{
+ // Create a socket object and set up its signals
+ m_errormask = 1794;
+ m_supportsasync = false;
+ m_defaultExecutionState = Starting;
+ setExecutionState(m_defaultExecutionState);
+ emit updateStatus(DebuggerUI::NoSession);
+
+ connect(&m_network, SIGNAL(command(const QString&)), this, SLOT(processCommand(const QString&)));
+ connect(&m_network, SIGNAL(active(bool)), this, SLOT(slotNetworkActive(bool)));
+ connect(&m_network, SIGNAL(connected(bool)), this, SLOT(slotNetworkConnected(bool)));
+ connect(&m_network, SIGNAL(networkError(const QString &, bool)), this, SLOT(slotNetworkError(const QString &, bool)));
+
+}
+
+
+QuantaDebuggerDBGp::~QuantaDebuggerDBGp ()
+{
+
+// kdDebug(24002) << k_funcinfo << endl;
+
+ m_network.sessionEnd();
+}
+
+void QuantaDebuggerDBGp::slotNetworkActive(bool active)
+{
+ // debuggerInterface() might not be available, for example from project dialog
+ if(!debuggerInterface())
+ return;
+
+ debuggerInterface()->enableAction("debug_request", active);
+ debuggerInterface()->enableAction("debug_connect", !active);
+ debuggerInterface()->enableAction("debug_disconnect", active);
+
+ setExecutionState(m_defaultExecutionState);
+
+ if(active)
+ emit updateStatus(DebuggerUI::AwaitingConnection);
+ else
+ emit updateStatus(DebuggerUI::NoSession);
+
+}
+
+void QuantaDebuggerDBGp::slotNetworkConnected(bool connected)
+{
+ // debuggerInterface() might not be available, for example from project dialog
+ if(!debuggerInterface())
+ return;
+
+ m_active = connected;
+
+ debuggerInterface()->enableAction("debug_run", connected);
+ debuggerInterface()->enableAction("debug_leap", connected);
+ debuggerInterface()->enableAction("debug_pause", connected);
+ debuggerInterface()->enableAction("debug_kill", connected);
+
+ debuggerInterface()->enableAction("debug_stepinto", connected);
+ debuggerInterface()->enableAction("debug_stepover", connected);
+ debuggerInterface()->enableAction("debug_stepout", connected);
+
+ debuggerInterface()->setActiveLine("", 0);
+ if(connected)
+ emit updateStatus(DebuggerUI::Connected);
+ else
+ {
+ setExecutionState(m_defaultExecutionState);
+ emit updateStatus(DebuggerUI::AwaitingConnection);
+
+ profilerOpen(false);
+ }
+
+}
+
+void QuantaDebuggerDBGp::slotNetworkError(const QString &errormsg, bool log)
+{
+ debuggerInterface()->showStatus(errormsg, log);
+}
+
+
+// Try to make a connection to the dbgp server
+void QuantaDebuggerDBGp::startSession()
+{
+ kdDebug(24002) << k_funcinfo << endl;
+
+ m_network.sessionStart(m_useproxy, m_serverHost, m_useproxy ? m_serverPort : m_listenPort);
+// setExecutionState(Starting);
+}
+
+
+void QuantaDebuggerDBGp::endSession()
+{
+
+ kdDebug(24002) << k_funcinfo << endl;
+
+ // Close the socket
+ m_network.sessionEnd();
+
+// debuggerInterface()->enableAction("debug_request", false);
+// debuggerInterface()->enableAction("debug_run", false);
+// debuggerInterface()->enableAction("debug_leap", false);
+// debuggerInterface()->enableAction("debug_pause", false);
+
+}
+
+
+// Change executionstate of the script
+void QuantaDebuggerDBGp::setExecutionState( const State & state, bool forcesend )
+{
+ if(m_executionState != state || forcesend)
+ {
+ if(state == Running)
+ m_network.sendCommand("run");
+ else if (state == Break)
+ m_network.sendCommand("break");
+ }
+ m_executionState = state;
+
+ if(debuggerInterface()) {
+ // The run action will be active if we're started, stopped or paused
+ debuggerInterface()->enableAction("debug_run", m_executionState == Break || m_executionState == Starting || m_executionState == Stopped);
+
+ // The pause action will be enabled if we're running and either supports async or we're not connected (ie will start running)
+ debuggerInterface()->enableAction("debug_pause", m_executionState == Running && (m_supportsasync || !isActive())) ;
+
+ // Kill is active if we're paused, just started of the debugger supports async, as long as we have an active session
+ debuggerInterface()->enableAction("debug_kill", isActive() && (m_executionState == Break || (m_executionState == Running && m_supportsasync) || m_executionState == Starting || m_executionState == Stopping ));
+
+ // These are only activated when we have an active seesion and are paused
+ debuggerInterface()->enableAction("debug_stepinto", isActive() && (m_executionState == Break || m_executionState == Starting ));
+ debuggerInterface()->enableAction("debug_stepout", isActive() && (m_executionState == Break || m_executionState == Starting));
+ debuggerInterface()->enableAction("debug_stepover", isActive() && (m_executionState == Break || m_executionState == Starting));
+ }
+
+}
+
+// Change executionstate of the script
+void QuantaDebuggerDBGp::setExecutionState(const QString &state)
+{
+ kdDebug(24002) << k_funcinfo << state << endl;
+
+ if(state == "starting")
+ {
+ setExecutionState(Starting);
+ emit updateStatus(DebuggerUI::Paused);
+ }
+ else if(state == "stopping")
+ {
+ setExecutionState(Stopping);
+ emit updateStatus(DebuggerUI::Paused);
+ m_network.slotSocketDestroyed(); //XDebug disconnects when stopped and destroys our socket
+ }
+ else if(state == "stopped")
+ {
+ setExecutionState(Stopped);
+ emit updateStatus(DebuggerUI::Paused);
+ m_network.slotSocketDestroyed(); //XDebug disconnects when stopped and destroys our socket
+ }
+ else if(state == "running")
+ {
+ setExecutionState(Running);
+ emit updateStatus(DebuggerUI::Running);
+ }
+ else if(state == "break")
+ {
+ setExecutionState(Break);
+ emit updateStatus(DebuggerUI::Paused);
+ }
+
+}
+
+// Return capabilities of dbgp
+const uint QuantaDebuggerDBGp::supports(DebuggerClientCapabilities::Capabilities cap)
+{
+ switch(cap)
+ {
+ case DebuggerClientCapabilities::LineBreakpoints:
+// case DebuggerClientCapabilities::ConditionalBreakpoints:
+ case DebuggerClientCapabilities::StartSession:
+ case DebuggerClientCapabilities::EndSession:
+ case DebuggerClientCapabilities::Kill:
+ case DebuggerClientCapabilities::Pause:
+ case DebuggerClientCapabilities::Run:
+ //case DebuggerClientCapabilities::Skip:
+ case DebuggerClientCapabilities::StepOut:
+ case DebuggerClientCapabilities::StepInto:
+ case DebuggerClientCapabilities::StepOver:
+ case DebuggerClientCapabilities::Watches:
+ case DebuggerClientCapabilities::VariableSetValue:
+ case DebuggerClientCapabilities::ProfilerOpen:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+
+// Process a dbgp command
+void QuantaDebuggerDBGp::processCommand(const QString& datas)
+{
+ kdDebug(24002) << k_lineinfo << datas.left(50) << " (" << datas.length() << " bytes)" << endl;
+
+ QDomDocument data;
+ data.setContent(datas);
+ kdDebug(24002) << datas << endl;
+
+ // Did we get a normal response?
+ if(data.elementsByTagName("response").count() > 0)
+ {
+ QDomNode response = data.elementsByTagName("response").item(0);
+ QString command = attribute(response, "command");
+
+ // Status command
+ if(command == "status")
+ setExecutionState(attribute(response, "status"));
+
+ // Callback stack
+ else if(command == "stack_get")
+ stackShow(response);
+
+ // Reply from a user execution action
+ else if(command == "break"
+ || command == "step_over"
+ || command == "step_into"
+ || command == "step_out")
+ {
+ handleError(response);
+ // If this is the acknoledge of a step command, request the call stack
+ m_network.sendCommand("stack_get");
+ setExecutionState(attribute(response, "status"));
+ handleError(response);
+ m_network.sendCommand("feature_get", "-n profiler_filename");
+ sendWatches();
+ }
+
+ // Run
+ else if(command == "run" )
+ {
+ setExecutionState(attribute(response, "status"));
+ handleError(response);
+ m_network.sendCommand("stack_get");
+ }
+
+ // Feature get replu
+ else if(command == "feature_get")
+ checkSupport(response);
+
+ // Reply after adding a breakpoint
+ else if(command == "breakpoint_set")
+ setBreakpointKey(response);
+
+ else if(command == "typemap_get")
+ typemapSetup(response);
+
+ else if(command == "property_get")
+ showWatch(response);
+
+ else if(command == "property_set")
+ propertySetResponse(response);
+ else if(command == "stop")
+ setExecutionState("stopped");
+
+ // Unknown command...
+ else
+ {
+ kdDebug(24002) << " * Unknown command: " << command << endl;
+ }
+ }
+ else if(data.elementsByTagName("init").count() > 0)
+ {
+ QDomNode init = data.elementsByTagName("init").item(0);
+ initiateSession(init);
+ return;
+ }
+ else
+ {
+ debuggerInterface()->showStatus(i18n("Unrecognized package: '%1%2'").arg(datas.left(50)).arg(datas.length() > 50 ? "..." : ""), true);
+
+ kdDebug(24002) << datas << endl;
+ }
+
+}
+
+void QuantaDebuggerDBGp::initiateSession(const QDomNode& initpacket)
+{
+ if(attribute(initpacket, "protocol_version") != protocolversion)
+ {
+ debuggerInterface()->showStatus(
+ i18n("The debugger for %1 uses an unsupported protocol version (%2)")
+ .arg(attribute(initpacket, "language"))
+ .arg(attribute(initpacket, "protocol_version"))
+ , true);
+
+ endSession();
+ return;
+ }
+ QString path = attribute(initpacket, "fileuri");
+ if (path.startsWith("file://"))
+ {
+ path.remove(0, 7);
+ }
+ debuggerInterface()->setActiveLine(mapServerPathToLocal(path), 0);
+
+ // Store some vars
+ m_initialscript = attribute(initpacket, "fileuri");
+ m_appid = attribute(initpacket, "appid");
+
+// setExecutionState(Starting);
+// m_network.sendCommand("feature_get", "-n encoding");
+ m_network.sendCommand("feature_get", "-n supports_async");
+// m_network.sendCommand("feature_get", "-n breakpoint_types");
+// m_network.sendCommand("feature_get", "-n profiler_filename");
+ m_network.sendCommand("feature_get", "-n breakpoint_set");
+ m_network.sendCommand("feature_get", "-n supports_postmortem");
+ m_network.sendCommand("typemap_get");
+ m_network.sendCommand("feature_get", "-n quanta_initialized");
+}
+
+void QuantaDebuggerDBGp::stackShow(const QDomNode&node)
+{
+ bool foundlowlevel = false;
+ BacktraceType type;
+ QString typestr;
+
+ // Clear backtrace
+ debuggerInterface()->backtraceClear();
+
+ // Add new one
+ for(QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ // Type isnt currently correct with xdebug
+// type = (attribute(child, "type") == "file" ? File : Eval);
+ typestr = attribute(child, "filename");
+ if(typestr.find(QRegExp(".*%28[0-9]+%29%20%3A%20eval")) >= 0)
+ type = Eval;
+ else
+ type = File;
+
+// kdDebug(24002) << " * Stck " << attribute(child, "level") << ": " << attribute(child, "type") << " (" << type << ") = " << attribute(child, "filename") << ", " << attribute(child, "lineno") << endl;
+
+
+ // If this is the lowest level and the type
+ if(type == File && !foundlowlevel)
+ {
+ foundlowlevel = true;
+ debuggerInterface()->setActiveLine(mapServerPathToLocal(attribute(child, "filename")), attribute(child, "lineno").toLong() - 1);
+ }
+
+ debuggerInterface()->backtraceShow(
+ attribute(child, "level").toLong(),
+ type,
+ attribute(child, "filename"),
+ attribute(child, "lineno").toLong() - 1, // Quanta lines are 0-based, DBGp is 1 based
+ attribute(child, "where"));
+ }
+
+}
+
+void QuantaDebuggerDBGp::checkSupport( const QDomNode & node )
+{
+ QString feature = attribute(node, "feature_name");
+ QString data = node.nodeValue();
+ if(feature == "supports_async")
+ m_supportsasync = data.toLong();
+
+ // if the debugger supports breakpoints, we have to send all current ones
+ else if(feature == "breakpoint_set"/* && data.toLong()*/)
+ debuggerInterface()->refreshBreakpoints();
+
+ // Our own feature, probably not available but then we know we're done initiating
+ else if(feature == "quanta_initialized" )
+ {
+ m_network.sendCommand("stack_get");
+ if(m_executionState != Break)
+ setExecutionState(m_executionState, true);
+ }
+
+}
+
+QString QuantaDebuggerDBGp::attribute(const QDomNode&node, const QString &attribute)
+{
+ return node.attributes().namedItem(attribute).nodeValue();
+}
+
+// Turn on/off actions related to a debugging session
+void QuantaDebuggerDBGp::debuggingState(bool enable)
+{
+ debuggerInterface()->enableAction("debug_kill", enable);
+ debuggerInterface()->enableAction("debug_stepout", enable);
+ debuggerInterface()->enableAction("debug_stepinto", enable);
+ debuggerInterface()->enableAction("debug_stepover", enable);
+ debuggerInterface()->enableAction("debug_skip", enable);
+}
+
+
+void QuantaDebuggerDBGp::sendWatches()
+{
+ for(QValueList<QString>::iterator it = m_watchlist.begin(); it != m_watchlist.end(); ++it)
+ m_network.sendCommand("property_get", "-n " + (*it));
+}
+
+// Return name of debugger
+QString QuantaDebuggerDBGp::getName()
+{
+ return "DBGp"; // no i18n on the name
+}
+
+
+// Send HTTP Request
+void QuantaDebuggerDBGp::request()
+{
+ QString request;
+ request = debuggerInterface()->activeFileParts(m_startsession);
+
+ //if(request.startsWith(m_localBasedir, false))
+ // request.remove(0, m_localBasedir.length());
+
+ //request = m_startsession + request;
+ kdDebug(24002) << k_funcinfo << ", request: " << request << endl;
+ debuggerInterface()->sendRequest(request);
+}
+
+
+// Go as fast as possible and dont update current line or watches
+void QuantaDebuggerDBGp::run()
+{
+ setExecutionState(Running);
+// m_network.sendCommand("run");
+// m_network.sendCommand("status");
+}
+
+// Step into function
+void QuantaDebuggerDBGp::stepInto()
+{
+ m_network.sendCommand("step_into");
+}
+
+// Step over function
+void QuantaDebuggerDBGp::stepOver()
+{
+ if(m_executionState == Starting)
+ m_network.sendCommand("step_into");
+ else
+ m_network.sendCommand("step_over");
+}
+
+// Step out of function
+void QuantaDebuggerDBGp::stepOut()
+{
+ m_network.sendCommand("step_out");
+}
+
+
+// Kill the running script
+void QuantaDebuggerDBGp::kill()
+{
+ m_network.sendCommand("stop");
+}
+
+// Pause execution
+void QuantaDebuggerDBGp::pause()
+{
+ if(isActive())
+ setExecutionState(Break);
+ else
+ setExecutionState(Starting);
+// m_network.sendCommand("break");
+// m_network.sendCommand("status");
+}
+
+
+// Add a breakpoint
+void QuantaDebuggerDBGp::addBreakpoint (DebuggerBreakpoint* breakpoint)
+{
+ QString type;
+ if(breakpoint->type() == DebuggerBreakpoint::LineBreakpoint)
+ type = "line";
+ else if(breakpoint->type() == DebuggerBreakpoint::ConditionalTrue)
+ type = "conditional";
+ else
+ type = "watch";
+
+ long id = m_network.sendCommand(
+ "breakpoint_set",
+ "-t " + type +
+ " -f " + mapLocalPathToServer(breakpoint->filePath()) +
+ " -n " + QString::number(breakpoint->line() + 1)
+ , breakpoint->condition());
+
+ breakpoint->setKey(QString("id %1").arg(id));
+}
+
+void QuantaDebuggerDBGp::setBreakpointKey( const QDomNode & response )
+{
+ long id;
+
+ id = attribute(response, "transaction_id").toLong();
+ if(id > 0)
+ {
+ QString oldkey = QString("id %1").arg(id);
+ DebuggerBreakpoint *bp = debuggerInterface()->findDebuggerBreakpoint(oldkey);
+ if(bp)
+ debuggerInterface()->updateBreakpointKey(*bp, attribute(response, "id"));
+ }
+}
+
+
+// Clear a breakpoint
+void QuantaDebuggerDBGp::removeBreakpoint(DebuggerBreakpoint* bp)
+{
+ m_network.sendCommand("breakpoint_remove", "-d " + bp->key());
+}
+
+// A file was opened...
+void QuantaDebuggerDBGp::fileOpened(const QString&)
+{
+// sendCommand("reinitialize", 0);
+}
+
+// Watch a variable
+void QuantaDebuggerDBGp::addWatch(const QString & variable)
+{
+ if(m_watchlist.find(variable) == m_watchlist.end())
+ m_watchlist.append(variable);
+ m_network.sendCommand("property_get", "-n " + variable);
+}
+// Remove watch
+void QuantaDebuggerDBGp::removeWatch(DebuggerVariable *variable)
+{
+ if(m_watchlist.find(variable->name()) != m_watchlist.end())
+ m_watchlist.remove(m_watchlist.find(variable->name()));
+}
+
+// Show conditional breakpoint state
+void QuantaDebuggerDBGp::showCondition(const StringMap &)
+{
+
+// DebuggerBreakpoint *bp = debuggerInterface()->newDebuggerBreakpoint();
+// bp->setType(args["type"] == "true" ? DebuggerBreakpoint::ConditionalTrue : DebuggerBreakpoint::ConditionalChange);
+// bp->setCondition(args["expression"]);
+// bp->setFilePath(mapServerPathToLocal(args["filename"]));
+// bp->setClass(args["class"]);
+// bp->setFunction(args["function"]);
+// bp->setValue(args["value"]);
+//
+// bp->setState(DebuggerBreakpoint::Undefined);
+//
+// debuggerInterface()->showBreakpoint(*bp);
+}
+
+// Read configuration
+void QuantaDebuggerDBGp::readConfig(QDomNode node)
+{
+ // Server
+ QDomNode valuenode = node.namedItem("serverhost");
+ m_serverHost = valuenode.firstChild().nodeValue();
+ if(m_serverHost.isEmpty())
+ m_serverHost = "localhost";
+
+ valuenode = node.namedItem("serverport");
+ m_serverPort = valuenode.firstChild().nodeValue();
+ if(m_serverPort.isEmpty())
+ m_serverPort = "9000";
+
+ valuenode = node.namedItem("localbasedir");
+ m_localBasedir = valuenode.firstChild().nodeValue();
+ if(debuggerInterface())
+ debuggerInterface()->Mapper()->setLocalBasedir(m_localBasedir);
+
+ valuenode = node.namedItem("serverbasedir");
+ m_serverBasedir = valuenode.firstChild().nodeValue();
+ if(debuggerInterface())
+ debuggerInterface()->Mapper()->setServerBasedir(m_serverBasedir);
+
+ valuenode = node.namedItem("listenport");
+ m_listenPort = valuenode.firstChild().nodeValue();
+ if(m_listenPort.isEmpty())
+ m_listenPort = "9000";
+
+ valuenode = node.namedItem("startsession");
+ m_startsession = valuenode.firstChild().nodeValue();
+ if(m_startsession.isEmpty())
+ m_startsession = "http://localhost/%rfpp?XDEBUG_SESSION_START=1&XDEBUG_PROFILE";
+
+ valuenode = node.namedItem("defaultexecutionstate");
+ if(valuenode.firstChild().nodeValue().isEmpty())
+ m_defaultExecutionState = Starting;
+ else
+ {
+ if(valuenode.firstChild().nodeValue() == "break")
+ m_defaultExecutionState = Starting;
+ else
+ m_defaultExecutionState = Running;
+ }
+
+ valuenode = node.namedItem("useproxy");
+ m_useproxy = valuenode.firstChild().nodeValue() == "1";
+
+ valuenode = node.namedItem("errormask");
+ m_errormask = valuenode.firstChild().nodeValue().toLong();
+ kdDebug(24002) << k_funcinfo << ", m_errormask = " << m_errormask << endl;
+
+ // Profiler
+ valuenode = node.namedItem("profilerfilename");
+ m_profilerFilename = valuenode.firstChild().nodeValue();
+ if(m_profilerFilename.isEmpty())
+ m_profilerFilename = "/tmp/cachegrind.out.%a";
+
+ valuenode = node.namedItem("profiler_autoopen");
+ m_profilerAutoOpen = valuenode.firstChild().nodeValue().toLong();
+
+ valuenode = node.namedItem("profiler_mapfilename");
+ m_profilerMapFilename = valuenode.firstChild().nodeValue().toLong();
+
+
+}
+
+
+// Show configuration
+void QuantaDebuggerDBGp::showConfig(QDomNode node)
+{
+ DBGpSettings set(protocolversion);
+
+ readConfig(node);
+
+ if(m_localBasedir == "/" && m_serverBasedir == "/")
+ set.checkLocalProject->setChecked(true);
+ set.lineLocalBasedir->setText(m_localBasedir);
+ set.lineServerBasedir->setText(m_serverBasedir);
+ set.lineServerListenPort->setText(m_listenPort);
+ set.lineStartSession->setText(m_startsession);
+ if(m_defaultExecutionState == Starting)
+ set.comboDefaultExecutionState->setCurrentItem(0);
+ else
+ set.comboDefaultExecutionState->setCurrentItem(1);
+
+ set.checkBreakOnNotice->setChecked(QuantaDebuggerDBGp::Notice & m_errormask);
+ set.checkBreakOnWarning->setChecked(QuantaDebuggerDBGp::Warning & m_errormask);
+ set.checkBreakOnUserNotice->setChecked(QuantaDebuggerDBGp::User_Notice & m_errormask);
+ set.checkBreakOnUserWarning->setChecked(QuantaDebuggerDBGp::User_Warning & m_errormask);
+ set.checkBreakOnUserError->setChecked(QuantaDebuggerDBGp::User_Error & m_errormask);
+
+ set.lineProfilerFilename->setText(m_profilerFilename);
+ if(m_profilerAutoOpen)
+ set.checkProfilerAutoOpen->setChecked(true);
+ if(m_profilerMapFilename)
+ set.checkProfilerMapFilename->setChecked(true);
+
+ if(set.exec() == QDialog::Accepted )
+ {
+ QDomElement el;
+
+ el = node.namedItem("localproject").toElement();
+ if (!el.isNull())
+ el.parentNode().removeChild(el);
+ el = node.ownerDocument().createElement("localproject");
+ node.appendChild( el );
+ if(set.checkLocalProject->isChecked())
+ {
+ m_localBasedir = "/";
+ m_serverBasedir = "/";
+ }
+ else
+ {
+ m_localBasedir = set.lineLocalBasedir->text();
+ m_serverBasedir = set.lineServerBasedir->text();
+ if (!m_localBasedir.endsWith("/"))
+ m_localBasedir.append('/');
+ if (!m_serverBasedir.endsWith("/"))
+ m_serverBasedir.append('/');
+ }
+
+ el = node.namedItem("localbasedir").toElement();
+ if (!el.isNull())
+ el.parentNode().removeChild(el);
+ el = node.ownerDocument().createElement("localbasedir");
+ node.appendChild( el );
+ el.appendChild( node.ownerDocument().createTextNode(m_localBasedir) );
+ if(debuggerInterface())
+ debuggerInterface()->Mapper()->setLocalBasedir(m_localBasedir);
+
+ el = node.namedItem("serverbasedir").toElement();
+ if (!el.isNull())
+ el.parentNode().removeChild(el);
+ el = node.ownerDocument().createElement("serverbasedir");
+ node.appendChild( el );
+ if(debuggerInterface())
+ debuggerInterface()->Mapper()->setServerBasedir(m_serverBasedir);
+ el.appendChild( node.ownerDocument().createTextNode(m_serverBasedir) );
+
+ el = node.namedItem("listenport").toElement();
+ if (!el.isNull())
+ el.parentNode().removeChild(el);
+ el = node.ownerDocument().createElement("listenport");
+ node.appendChild( el );
+ m_listenPort = set.lineServerListenPort->text();
+ el.appendChild( node.ownerDocument().createTextNode(m_listenPort) );
+
+ el = node.namedItem("startsession").toElement();
+ if (!el.isNull())
+ el.parentNode().removeChild(el);
+ el = node.ownerDocument().createElement("startsession");
+ node.appendChild( el );
+ m_startsession = set.lineStartSession->text();
+ el.appendChild(node.ownerDocument().createTextNode(m_startsession));
+
+ el = node.namedItem("defaultexecutionstate").toElement();
+ if (!el.isNull())
+ el.parentNode().removeChild(el);
+ el = node.ownerDocument().createElement("defaultexecutionstate");
+ node.appendChild( el );
+ if(set.comboDefaultExecutionState->currentItem() == 0)
+ {
+ m_defaultExecutionState = Starting;
+ el.appendChild(node.ownerDocument().createTextNode("break"));
+ }
+ else
+ {
+ m_defaultExecutionState = Running;
+ el.appendChild(node.ownerDocument().createTextNode("run"));
+
+ }
+
+ el = node.namedItem("errormask").toElement();
+ if (!el.isNull())
+ el.parentNode().removeChild(el);
+ el = node.ownerDocument().createElement("errormask");
+ node.appendChild( el );
+ m_errormask = (set.checkBreakOnNotice->isChecked() ? QuantaDebuggerDBGp::Notice : 0)
+ + (set.checkBreakOnWarning->isChecked() ? QuantaDebuggerDBGp::Warning : 0)
+ + (set.checkBreakOnUserNotice->isChecked() ? QuantaDebuggerDBGp::User_Notice : 0)
+ + (set.checkBreakOnUserWarning->isChecked() ? QuantaDebuggerDBGp::User_Warning : 0)
+ + (set.checkBreakOnUserError->isChecked() ? QuantaDebuggerDBGp::User_Error : 0);
+ kdDebug(24002) << k_funcinfo << ", m_errormask = " << m_errormask << endl;
+ el.appendChild( node.ownerDocument().createTextNode(QString::number(m_errormask)));
+
+ // Profiler
+ el = node.namedItem("profilerfilename").toElement();
+ if (!el.isNull())
+ el.parentNode().removeChild(el);
+ el = node.ownerDocument().createElement("profilerfilename");
+ node.appendChild( el );
+ m_profilerFilename = set.lineProfilerFilename->text();
+ el.appendChild(node.ownerDocument().createTextNode(m_profilerFilename));
+
+ el = node.namedItem("profilerfilename_map").toElement();
+ if (!el.isNull())
+ el.parentNode().removeChild(el);
+ el = node.ownerDocument().createElement("profilerfilename_map");
+ node.appendChild( el );
+ m_profilerMapFilename = (set.checkProfilerMapFilename->isChecked() ? true : false);
+ el.appendChild(node.ownerDocument().createTextNode(m_profilerMapFilename ? "1" : "0"));
+
+ el = node.namedItem("profiler_autoopen").toElement();
+ if (!el.isNull())
+ el.parentNode().removeChild(el);
+ el = node.ownerDocument().createElement("profiler_autoopen");
+ node.appendChild( el );
+ m_profilerAutoOpen = (set.checkProfilerAutoOpen->isChecked() ? true : false);
+ el.appendChild(node.ownerDocument().createTextNode(m_profilerAutoOpen ? "1" : "0"));
+ }
+}
+
+// Map a server filepath to a local one using project settings
+QString QuantaDebuggerDBGp::mapServerPathToLocal(const QString& serverpath)
+{
+ // Translate filename from server to local
+ return debuggerInterface()->Mapper()->mapServerPathToLocal(serverpath);
+}
+
+// Map a local filepath to a server one using project settings
+QString QuantaDebuggerDBGp::mapLocalPathToServer(const QString& localpath)
+{
+ // Translate filename from local to server
+ return debuggerInterface()->Mapper()->mapLocalPathToServer(localpath);
+}
+
+void QuantaDebuggerDBGp::variableSetValue(const DebuggerVariable &variable)
+{
+ m_network.sendCommand("property_set", "-n " + variable.name(), variable.value());
+
+ for(QValueList<QString>::iterator it = m_watchlist.begin(); it != m_watchlist.end(); ++it)
+ if((*it) == variable.name())
+ {
+ m_network.sendCommand("property_get", "-n " + variable.name(), variable.value());
+ return;
+ }
+
+ return;
+}
+
+void QuantaDebuggerDBGp::profilerOpen()
+{
+ profilerOpen(true);
+}
+
+void QuantaDebuggerDBGp::profilerOpen(bool forceopen)
+{
+ QString profileroutput = m_profilerFilename;
+ profileroutput.replace("%a", m_appid);
+ profileroutput.replace("%c", m_initialscript);
+
+ if(m_profilerMapFilename)
+ profileroutput = mapServerPathToLocal( profileroutput);
+
+ bool exists = QFile::exists(profileroutput);
+ if(m_profilerAutoOpen || forceopen)
+ {
+ if(exists)
+ {
+ KRun *run = new KRun(profileroutput);
+ run->setAutoDelete(true);
+ }
+ else
+ {
+ if(forceopen)
+ KMessageBox::sorry(NULL, i18n("Unable to open profiler output (%1)").arg(profileroutput), i18n("Profiler File Error"));
+ else
+ debuggerInterface()->showStatus(i18n("Unable to open profiler output (%1)").arg(profileroutput), false);
+ }
+ }
+ else
+ {
+ debuggerInterface()->enableAction("debug_profiler_open", exists);
+ }
+}
+
+void QuantaDebuggerDBGp::typemapSetup( const QDomNode & typemapnode )
+{
+ /*
+ <map name="bool" type="bool" xsi:type="xsd:boolean"></map>
+ <map name="int" type="int" xsi:type="xsd:decimal"></map>
+ <map name="float" type="float" xsi:type="xsd:double"></map>
+ <map name="string" type="string" xsi:type="xsd:string"></map>
+ <map name="null" type="null"></map>
+ <map name="array" type="hash"></map>
+ <map name="object" type="object"></map>
+ <map name="resource" type="resource"></map>
+ */
+
+// // First defaults in case they are not sent (which seems to be the case with hash and xdebug)
+// m_variabletypes["bool"] = "bool";
+// m_variabletypes["int"] = "int";
+// m_variabletypes["float"] = "float";
+// m_variabletypes["string"] = "string";
+// m_variabletypes["null"] = "null";
+// m_variabletypes["array"] = "hash";
+// m_variabletypes["hash"] = "hash";
+// m_variabletypes["object"] = "object";
+// m_variabletypes["resource"] = "resource";
+
+ QDomNode child = typemapnode.firstChild();
+ while(!child.isNull())
+ {
+ if(child.nodeName() == "map")
+ {
+ m_variabletypes[attribute(child, "name")] = attribute(child, "type");
+ }
+ child = child.nextSibling();
+ }
+}
+
+
+void QuantaDebuggerDBGp::showWatch( const QDomNode & variablenode)
+{
+ debuggerInterface()->showVariable(buildVariable(variablenode.firstChild()));
+}
+
+void QuantaDebuggerDBGp::propertySetResponse( const QDomNode & setnode)
+{
+ if(attribute(setnode, "success") == "0")
+ {
+ debuggerInterface()->showStatus(i18n("Unable to set value of variable."), true);
+ }
+}
+
+
+DebuggerVariable* QuantaDebuggerDBGp::buildVariable( const QDomNode & variablenode)
+{
+ /*
+ Sample:
+ <property name="$arrayVar" fullname="$arrayVar" address="-1073754976" type="hash" children="1" numchildren="4">
+ <property name="birthyear" fullname="$arrayVar['birthyear']" address="135522364" type="int">
+ <![CDATA[1949]]>
+ </property>
+ <property name="songs" fullname="$arrayVar['songs']" address="135522236" type="hash" children="1" numchildren="3">
+ <property name="0" fullname="$arrayVar['songs'][0]" address="135522332" type="string" encoding="base64">
+ <![CDATA[SW5ub2NlbnQgV2hlbiBZb3UgRHJlYW0=]]>
+ </property>
+ <property name="1" fullname="$arrayVar['songs'][1]" address="135522300" type="string" encoding="base64">
+ <![CDATA[Q2hyaXN0bWFzIENhcmQgRnJvbSBBIEhvb2tlcg==]]>
+ </property>
+ </property>
+ </property>
+ */
+ QString name = attribute(variablenode, "name");
+ QString type = m_variabletypes[attribute(variablenode, "type")];
+
+ if(type == "int")
+ {
+ QString value = variablenode.firstChild().nodeValue();
+ return debuggerInterface()->newDebuggerVariable( name, value, DebuggerVariableTypes::Integer);
+ }
+ else if (type == "string")
+ {
+ QCString value = QCString(variablenode.firstChild().nodeValue());
+ value = KCodecs::base64Decode(value);
+ return debuggerInterface()->newDebuggerVariable( name, value, DebuggerVariableTypes::String);
+ }
+ else if (type == "bool")
+ {
+ QString value = variablenode.firstChild().nodeValue();
+ return debuggerInterface()->newDebuggerVariable( name, value, DebuggerVariableTypes::Boolean);
+ }
+ else if (type == "resource")
+ {
+ QString value = variablenode.firstChild().nodeValue();
+ return debuggerInterface()->newDebuggerVariable( name, value, DebuggerVariableTypes::Resource);
+ }
+ else if (type == "float")
+ {
+ QString value = variablenode.firstChild().nodeValue();
+ return debuggerInterface()->newDebuggerVariable( name, value, DebuggerVariableTypes::Float);
+ }
+ else if (type == "null")
+ {
+ QString value = variablenode.firstChild().nodeValue();
+ return debuggerInterface()->newDebuggerVariable( name, "", DebuggerVariableTypes::Undefined);
+ }
+ else if (type == "hash" || type == "array" || type == "object")
+ {
+ QDomNode child = variablenode.firstChild();
+ QPtrList<DebuggerVariable> vars ;
+ while(!child.isNull())
+ {
+ DebuggerVariable* var = buildVariable( child);
+ if(var)
+ vars.append(var);
+
+ child = child.nextSibling();
+ }
+ if(type == "object")
+ return debuggerInterface()->newDebuggerVariable(name, vars, DebuggerVariableTypes::Object);
+ else
+ return debuggerInterface()->newDebuggerVariable(name, vars, DebuggerVariableTypes::Array);
+ }
+
+ return debuggerInterface()->newDebuggerVariable(name, "", DebuggerVariableTypes::Error);;
+}
+
+void QuantaDebuggerDBGp::handleError(const QDomNode & statusnode )
+{
+
+ if(attribute(statusnode, "reason") == "error" || attribute(statusnode, "reason") == "aborted")
+ {
+ QDomNode errornode = statusnode.firstChild();
+ while(!errornode.isNull())
+ {
+ if(errornode.nodeName() == "error")
+ {
+ if(attribute(statusnode, "reason") == "error")
+ {
+ // Managable error
+ long error = attribute(errornode, "code").toLong();
+ if(!(error & m_errormask))
+ {
+ setExecutionState(Running);
+ }
+ else
+ {
+ emit updateStatus(DebuggerUI::HaltedOnError);
+ debuggerInterface()->showStatus(errornode.firstChild().nodeValue(), true);
+ }
+ break;
+ }
+ else
+ {
+ // Fatal error
+ emit updateStatus(DebuggerUI::HaltedOnError);
+ debuggerInterface()->showStatus(errornode.firstChild().nodeValue(), true);
+ }
+ }
+ errornode = errornode.nextSibling();
+ }
+ }
+
+}
+
+#include "quantadebuggerdbgp.moc"
diff --git a/quanta/components/debugger/dbgp/quantadebuggerdbgp.desktop b/quanta/components/debugger/dbgp/quantadebuggerdbgp.desktop
new file mode 100644
index 00000000..3bebcf06
--- /dev/null
+++ b/quanta/components/debugger/dbgp/quantadebuggerdbgp.desktop
@@ -0,0 +1,44 @@
+[Desktop Entry]
+Type=Service
+Name=DBGp
+Comment=DBGp debugger plugin, see http://xdebug.org
+Comment[bg]=Приставка на дебъгер DBGp, http://xdebug.org
+Comment[ca]=Connector de depuració DBGp, consulteu http://xdebug.org
+Comment[cs]=DBGp debugger plugin, viz http://xdebug.org
+Comment[da]=DBGp fejlretter-plugin, se http://xdebug.org
+Comment[de]=DBGp Debugger Plugin, siehe http://xdebug.org
+Comment[el]=Πρόσθετο αποσφαλματωτή DBGp, δείτε το http://xdebug.org
+Comment[es]=Extensión para el depurador DBGp, vea http://xdebug.org
+Comment[et]=DBGp siluri plugin, vaata http://xdebug.org
+Comment[eu]=DBGp araztailearen plugina, ikusi http://xdebug.org
+Comment[fa]=وصلۀ اشکال‌زدای DBGp، http://xdebug.org را ببینید
+Comment[fi]=DBGp-debugliitännäinen, katso http://xdebug.org
+Comment[fr]=Module de débogage DBGp, consultez http://xdebug.org
+Comment[ga]=Breiseán dífhabhtóra DBGp, féach ar http://xdebug.org
+Comment[gl]=Extensión DBGp para o depurador, vexa tamén http://xdebug.org
+Comment[hu]=DBGp nyomkövető modul, lásd: http://xdebug.org
+Comment[is]=DBGp aflúsunaríforrit. Sjá http://xdebug.org
+Comment[it]=Plugin di degub DBGp, vedi http://xdebug.org
+Comment[ja]=DBGp デバッガ プラグイン。http://xdebug.org をご覧ください。
+Comment[ka]=DBGp განბზიკვის მოდული, იხილეთ http://xdebug.org
+Comment[lt]=DBGp derintuvės priedas, žr. http://xdebug.org
+Comment[ms]=Plugin nyahpepijat DBGp, lihat http://xdebug.org
+Comment[nds]=Fehlersöök-Moduul för't DBGp, kiek bi http://xdebug.org
+Comment[ne]=DBGp त्रुटिमोचक प्लगइन, http://xdebug.org हेर्नुहोस्
+Comment[nl]=DBGp-debugger-plugin, zie http://xdebug.org
+Comment[pl]=Wtyczka debugera DBGp, patrz http://xdebug.org
+Comment[pt]='Plugin' de depuração DBGp, veja http://xdebug.org
+Comment[pt_BR]=Plugin de depuração DBGp, veja http://xdebug.org
+Comment[ru]=Модуль для отладчика DBGp, http://xdebug.org
+Comment[sk]=DBGp debuger modul, pozri http://xdebug.org
+Comment[sl]=Vstavek za razhoroščevanje DBGp, glej http://xdebug.org
+Comment[sr]=DBGp прикључак, види http://xdebug.org
+Comment[sr@Latn]=DBGp priključak, vidi http://xdebug.org
+Comment[sv]=DBGp-insticksprogram för felsökning, se http://xdebug.org
+Comment[uk]=Втулок зневаджувача DBGp, див. http://xdebug.org
+Comment[zh_CN]=DBGp 调试器插件,参看 http://xdebug.org
+Comment[zh_HK]=DBGp 除錯器外掛程式,請參閱 http://xdebug.org
+Comment[zh_TW]=DBGp 除錯器外掛程式,請參閱 http://xdebug.org
+Icon=kdbg
+ServiceTypes=Quanta/Debugger
+X-KDE-Library=quantadebuggerdbgp
diff --git a/quanta/components/debugger/dbgp/quantadebuggerdbgp.h b/quanta/components/debugger/dbgp/quantadebuggerdbgp.h
new file mode 100644
index 00000000..fd8eda22
--- /dev/null
+++ b/quanta/components/debugger/dbgp/quantadebuggerdbgp.h
@@ -0,0 +1,166 @@
+/***************************************************************************
+ phpdebugdbgp.cpp
+ -------------------
+ begin : 2004-03-12
+ copyright : (C) 2004 Linus McCabe <linus@mccabe.nu>
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef QUANTADEBUGGERGUBED_H
+#define QUANTADEBUGGERGUBED_H
+
+#include <kserversocket.h>
+#include <kstreamsocket.h>
+#include <qptrlist.h>
+#include <kurl.h>
+#include <qdom.h>
+
+#include "debuggerclient.h"
+#include "dbgpnetwork.h"
+
+typedef QValueList<QString> WatchList;
+typedef QMap<QString, QString> StringMap;
+
+class QuantaDebuggerDBGp : public DebuggerClient
+{
+ Q_OBJECT
+
+ public:
+ QuantaDebuggerDBGp(QObject *parent, const char* name, const QStringList&);
+ ~QuantaDebuggerDBGp();
+
+ // Execution states
+ enum State
+ {
+ Starting = 0,
+ Stopping,
+ Stopped,
+ Running,
+ Break
+ };
+ // Error codes
+ enum Errors
+ {
+ Warning = 2,
+ Notice = 8,
+ User_Error = 256,
+ User_Warning = 512,
+ User_Notice = 1024
+ };
+
+ // Protocol version
+ static const char protocolversion[];
+
+ // Manager interaction
+ const uint supports(DebuggerClientCapabilities::Capabilities);
+
+ // Execution control
+ void request();
+ void run();
+ void stepInto();
+ void stepOver();
+ void stepOut();
+ void pause();
+ void kill();
+ void setExecutionState(const QString &state);
+ void setExecutionState(const State &state, bool forcesend = false);
+
+ // Connection
+ void startSession();
+ void endSession();
+
+ // Return name of debugger
+ QString getName();
+
+ // Initiation
+ void checkSupport(const QDomNode&node);
+
+ // New file opened in quanta
+ void fileOpened(const QString& file);
+
+ // Settings
+ void readConfig(QDomNode node);
+ void showConfig(QDomNode node);
+
+ // Breakpoints
+ void addBreakpoint(DebuggerBreakpoint* breakpoint);
+ void removeBreakpoint(DebuggerBreakpoint* breakpoint);
+ void showCondition(const StringMap &args);
+
+ // Variables
+ void addWatch(const QString &variable);
+ void removeWatch(DebuggerVariable *var);
+ void variableSetValue(const DebuggerVariable &variable);
+ void propertySetResponse( const QDomNode & setnode);
+
+ // Call stack
+ void stackShow(const QDomNode&node);
+
+ private:
+ DBGpNetwork m_network;
+
+ QString m_serverBasedir;
+ QString m_localBasedir;
+ QString m_serverPort;
+ QString m_serverHost;
+ QString m_startsession;
+ QString m_listenPort;
+ QString m_profilerFilename;
+ QString m_appid;
+ QString m_initialscript;
+
+ bool m_useproxy;
+ bool m_profilerAutoOpen;
+ bool m_profilerMapFilename;
+ State m_executionState, m_defaultExecutionState;
+ long m_errormask;
+ long m_displaydelay;
+ bool m_supportsasync;
+
+ // Variable type mapping
+ StringMap m_variabletypes;
+
+ // Internal watchlist
+ WatchList m_watchlist;
+
+ void sendWatches();
+ void debuggingState(bool enable);
+ void connected();
+
+ void handleError(const QDomNode & statusnode );
+
+ QString mapServerPathToLocal(const QString& serverpath);
+ QString mapLocalPathToServer(const QString& localpath);
+ QString bpToDBGp(DebuggerBreakpoint* breakpoint);
+ void setBreakpointKey(const QDomNode& response);
+
+ QString attribute(const QDomNode&node, const QString &attribute);
+ void initiateSession(const QDomNode& initpacket);
+
+ void typemapSetup(const QDomNode& typemapnode);
+ void showWatch(const QDomNode& typemapnode);
+ DebuggerVariable* buildVariable(const QDomNode& typemapnode);
+
+ // Profiler
+ void profilerOpen(bool forceopen);
+ void profilerOpen();
+
+ public slots:
+ void slotNetworkActive(bool active);
+ void slotNetworkConnected(bool connected);
+ void slotNetworkError(const QString &errormsg, bool log);
+ void processCommand(const QString&);
+
+ signals:
+ void updateStatus(DebuggerUI::DebuggerStatus);
+};
+
+#endif
diff --git a/quanta/components/debugger/debuggerbreakpoint.cpp b/quanta/components/debugger/debuggerbreakpoint.cpp
new file mode 100644
index 00000000..ae8ed6cb
--- /dev/null
+++ b/quanta/components/debugger/debuggerbreakpoint.cpp
@@ -0,0 +1,181 @@
+/***************************************************************************
+ debuggerbreakpoint.cpp
+ ----------------------
+ begin : 2004-04-04
+ copyright : (C) 2004 Thiago Silva
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "debuggerbreakpoint.h"
+#include <kdebug.h>
+
+DebuggerBreakpoint::DebuggerBreakpoint()
+ : m_line(1)//, m_state(0)
+{}
+
+DebuggerBreakpoint::DebuggerBreakpoint( const DebuggerBreakpoint & bp )
+{
+ m_conditionExpr = bp.condition();
+ m_filePath = bp.filePath();
+ m_class = bp.inClass();
+ m_function = bp.inFunction();
+ m_line = bp.line();
+ m_state = bp.state();
+ m_key = bp.key();
+ m_type = bp.type();
+}
+
+DebuggerBreakpoint::DebuggerBreakpoint( const DebuggerBreakpoint * bp )
+{
+ m_conditionExpr = bp->condition();
+ m_filePath = bp->filePath();
+ m_class = bp->inClass();
+ m_function = bp->inFunction();
+ m_line = bp->line();
+ m_state = bp->state();
+ m_key = bp->key();
+ m_type = bp->type();
+}
+
+
+DebuggerBreakpoint::DebuggerBreakpoint(const QString& filePath, int line)
+{
+ m_filePath = filePath;
+ m_line = line;
+ m_type = DebuggerBreakpoint::LineBreakpoint;
+ m_state = DebuggerBreakpoint::Undefined;
+}
+
+DebuggerBreakpoint::DebuggerBreakpoint(const Types type,
+ const QString& conditionExpr, const QString& filePath,
+ const QString& inClass, const QString& inFunction)
+{
+ m_conditionExpr = conditionExpr;
+ m_filePath = filePath;
+ m_class = inClass;
+ m_function = inFunction;
+ m_line = 0;
+ m_type = type;
+ m_state = DebuggerBreakpoint::Undefined;
+}
+
+DebuggerBreakpoint::~DebuggerBreakpoint()
+{}
+
+void DebuggerBreakpoint::setFilePath(const QString& filePath)
+{
+ m_filePath = filePath;
+}
+
+void DebuggerBreakpoint::setClass(const QString& newclass)
+{
+ m_class = newclass;
+}
+
+void DebuggerBreakpoint::setFunction(const QString& function)
+{
+ m_function = function;
+}
+
+void DebuggerBreakpoint::setLine(int line)
+{
+ m_line = line;
+}
+
+void DebuggerBreakpoint::setCondition(const QString& expression)
+{
+ m_conditionExpr = expression;
+}
+
+void DebuggerBreakpoint::setValue(const QString& value)
+{
+ m_value = value;
+}
+
+void DebuggerBreakpoint::setState(int state)
+{
+ m_state = state;
+}
+
+void DebuggerBreakpoint::setType(DebuggerBreakpoint::Types type )
+{
+ m_type = type;
+}
+
+void DebuggerBreakpoint::setKey(const QString& value)
+{
+ m_key = value;
+}
+
+const QString& DebuggerBreakpoint::key() const
+{
+ return m_key;
+}
+
+const QString& DebuggerBreakpoint::filePath() const
+{
+ return m_filePath;
+}
+
+const QString& DebuggerBreakpoint::value() const
+{
+ return m_value;
+}
+
+const QString& DebuggerBreakpoint::inClass() const
+{
+ return m_class;
+}
+const QString& DebuggerBreakpoint::inFunction() const
+{
+ return m_function;
+}
+
+DebuggerBreakpoint::Types DebuggerBreakpoint::type() const
+{
+ return m_type;
+}
+
+int DebuggerBreakpoint::line() const
+{
+ return m_line;
+}
+
+const QString& DebuggerBreakpoint::condition() const
+{
+ return m_conditionExpr;
+}
+
+int DebuggerBreakpoint::state() const
+{
+ return m_state;
+}
+
+bool DebuggerBreakpoint::operator == (DebuggerBreakpoint bp) const
+{
+ // If they key matches
+ if(!m_key.isEmpty() && bp.key() == m_key)
+ return true;
+
+ // Or everything else...
+ if(bp.filePath() == m_filePath
+ && (bp.line() == m_line || m_type != DebuggerBreakpoint::LineBreakpoint)
+ && bp.type() == m_type
+ && bp.inClass() == m_class
+ && bp.inFunction() == m_function
+ && bp.condition() == m_conditionExpr
+ )
+ return true;
+ return false;
+
+}
+
diff --git a/quanta/components/debugger/debuggerbreakpoint.h b/quanta/components/debugger/debuggerbreakpoint.h
new file mode 100644
index 00000000..46e0950d
--- /dev/null
+++ b/quanta/components/debugger/debuggerbreakpoint.h
@@ -0,0 +1,85 @@
+/***************************************************************************
+ debuggerbreakpoint.h
+ --------------------
+ begin : 2004-04-04
+ copyright : (C) 2004 Thiago Silva
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef DEBUGGERBREAKPOINT_H
+#define DEBUGGERBREAKPOINT_H
+#include <qstring.h>
+
+
+class DebuggerBreakpoint
+{
+ public:
+ enum Types
+ {
+ LineBreakpoint = 0,
+ ConditionalTrue,
+ ConditionalChange
+ };
+
+ enum States
+ {
+ Undefined = 0,
+ Unfulfilled,
+ Fulfilled,
+ Error
+ };
+
+ DebuggerBreakpoint();
+ DebuggerBreakpoint(const DebuggerBreakpoint& bp);
+ DebuggerBreakpoint(const DebuggerBreakpoint* bp);
+ DebuggerBreakpoint(const QString& filePath, int line); // Line BP
+ DebuggerBreakpoint(const DebuggerBreakpoint::Types type, // Any kind
+ const QString& conditionExpr, const QString& filePath = "",
+ const QString& inClass = "", const QString& inFunction = "");
+
+ virtual ~DebuggerBreakpoint();
+
+ virtual void setFunction(const QString& filePath);
+ virtual void setClass(const QString& filePath);
+ virtual void setFilePath(const QString& filePath);
+ virtual void setLine(int line);
+ virtual void setCondition(const QString& expression);
+ virtual void setState(int state);
+ virtual void setType(Types type);
+ virtual void setValue(const QString& value);
+ virtual void setKey(const QString& value);
+
+ virtual const QString& filePath() const;
+ virtual const QString& inClass() const;
+ virtual const QString& inFunction() const;
+ virtual int line() const;
+ virtual const QString& condition() const;
+ virtual int state() const;
+ virtual DebuggerBreakpoint::Types type() const;
+ virtual const QString& value() const;
+ virtual const QString& key() const;
+
+ bool operator == (DebuggerBreakpoint) const;
+
+ protected:
+ QString m_filePath;
+ QString m_class;
+ QString m_function;
+ int m_line;
+ QString m_conditionExpr;
+ int m_state;
+ Types m_type;
+ QString m_value;
+ QString m_key;
+};
+
+#endif
diff --git a/quanta/components/debugger/debuggerbreakpointlist.cpp b/quanta/components/debugger/debuggerbreakpointlist.cpp
new file mode 100644
index 00000000..ba117965
--- /dev/null
+++ b/quanta/components/debugger/debuggerbreakpointlist.cpp
@@ -0,0 +1,193 @@
+/***************************************************************************
+ debuggerbreakpointlist.cpp
+ --------------------------
+ begin : 2004-04-04
+ copyright : (C) 2004 Thiago Silva
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qobject.h>
+#include <ktexteditor/markinterfaceextension.h>
+#include <kdebug.h>
+
+#include "debuggerbreakpointlist.h"
+#include "debuggerbreakpoint.h"
+#include "debuggerclient.h"
+#include "debuggermanager.h"
+#include "debuggerui.h"
+#include "resource.h"
+#include "quanta.h"
+
+DebuggerBreakpointList::DebuggerBreakpointList()
+ : m_current(0)
+{
+ m_breakpointList = new BreakpointList_t();
+}
+
+DebuggerBreakpointList::~DebuggerBreakpointList()
+{
+ delete m_breakpointList;
+}
+
+void DebuggerBreakpointList::add(DebuggerBreakpoint* bp)
+{
+ if(quantaApp->debugger()->UI())
+ quantaApp->debugger()->UI()->showBreakpoint(*bp);
+
+ m_breakpointList->push_front(bp);
+ if(bp->type() == DebuggerBreakpoint::LineBreakpoint)
+ quantaApp->debugger()->setMark(bp->filePath(), bp->line(), true, KTextEditor::MarkInterface::markType02);
+}
+
+void DebuggerBreakpointList::remove(DebuggerBreakpoint* bp)
+{
+ BreakpointList_t::iterator it = find(*bp);
+ if(it == m_breakpointList->end())
+ return;
+
+// DebuggerBreakpoint bp1(bp);
+
+ if(*bp == (*bp))
+ {
+ DebuggerBreakpoint* tmp;
+
+ tmp = (*it);
+ // Remove it from the bp-list
+ if(quantaApp->debugger()->UI())
+ quantaApp->debugger()->UI()->deleteBreakpoint(*bp);
+
+ // Remove editor markpoint if there is one...
+ if(bp->type() == DebuggerBreakpoint::LineBreakpoint)
+ quantaApp->debugger()->setMark(bp->filePath(), bp->line(), false, KTextEditor::MarkInterface::markType02);
+
+ it = m_breakpointList->remove(it);
+ delete tmp;
+ }
+}
+
+
+
+DebuggerBreakpoint* DebuggerBreakpointList::retrieve(const QString& filePath, int line)
+{
+ BreakpointList_t::iterator it;
+
+ for(it = m_breakpointList->begin(); it != m_breakpointList->end(); ++it)
+ {
+ if((filePath == (*it)->filePath()) &&
+ line == (*it)->line())
+ {
+ DebuggerBreakpoint* bp = new DebuggerBreakpoint(*it);
+ return bp;
+ }
+ }
+ return 0;
+}
+
+void DebuggerBreakpointList::clear()
+{
+ BreakpointList_t::iterator it;
+
+ for(it = m_breakpointList->begin(); it != m_breakpointList->end(); ++it)
+ {
+
+ // Remove it from the bp-list
+ quantaApp->debugger()->UI()->deleteBreakpoint(*(*it));
+
+ // Remove editor markpoint if there is one...
+ quantaApp->debugger()->setMark((*it)->filePath(), (*it)->line(), false, KTextEditor::MarkInterface::markType02);
+
+ if(quantaApp->debugger()->client())
+ quantaApp->debugger()->client()->removeBreakpoint((*it));
+ }
+ m_breakpointList->clear();
+}
+
+bool DebuggerBreakpointList::exists(DebuggerBreakpoint* bp)
+{
+ BreakpointList_t::iterator it = find(*bp);
+ if(it == m_breakpointList->end())
+ return false;
+
+ if(*bp == (*it))
+ return true;
+
+ return false;
+}
+
+
+BreakpointList_t::iterator DebuggerBreakpointList::find(const DebuggerBreakpoint &bp)
+{
+ BreakpointList_t::iterator it;
+
+ for(it = m_breakpointList->begin(); it != m_breakpointList->end(); ++it)
+ {
+ if(bp == (*it))
+ return it;
+ }
+ return m_breakpointList->end();
+}
+
+void DebuggerBreakpointList::rewind()
+{
+ m_current = 0;
+}
+
+DebuggerBreakpoint* DebuggerBreakpointList::next()
+{
+ if(m_current == 0)
+ {
+ m_current = m_breakpointList->begin();
+ }
+ else
+ {
+ ++m_current;
+ }
+
+ if(m_current != m_breakpointList->end())
+ {
+ return (*m_current);
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+DebuggerBreakpoint * DebuggerBreakpointList::findDebuggerBreakpoint( const QString & key )
+{
+ BreakpointList_t::iterator it;
+ for(it = m_breakpointList->begin(); it != m_breakpointList->end(); ++it)
+ {
+ if((*it)->key() == key)
+ {
+ DebuggerBreakpoint *bp = new DebuggerBreakpoint((*it));
+ return bp;
+ }
+ }
+ return NULL;
+}
+
+void DebuggerBreakpointList::updateBreakpointKey( const DebuggerBreakpoint & bp, const QString & newkey )
+{
+ //DebuggerBreakpoint *bpp = new DebuggerBreakpoint(bp);
+ BreakpointList_t::iterator it;
+ it = find(bp);
+ if(it != m_breakpointList->end())
+ {
+ (*it)->setKey(newkey);
+ }
+}
+
+size_t DebuggerBreakpointList::count( )
+{
+ return m_breakpointList->count();
+}
diff --git a/quanta/components/debugger/debuggerbreakpointlist.h b/quanta/components/debugger/debuggerbreakpointlist.h
new file mode 100644
index 00000000..4ca26a95
--- /dev/null
+++ b/quanta/components/debugger/debuggerbreakpointlist.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ debuggerbreakpointlist.h
+ ------------------------
+ begin : 2004-04-04
+ copyright : (C) 2004 Thiago Silva
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef DEBUGGERBREAKPOINTLIST_H
+#define DEBUGGERBREAKPOINTLIST_H
+
+#include <qobject.h>
+#include <qstring.h>
+#include <qvaluelist.h>
+
+class DebuggerBreakpoint;
+ typedef QValueList<DebuggerBreakpoint*> BreakpointList_t;
+
+class DebuggerBreakpointList
+{
+
+ private:
+ BreakpointList_t* m_breakpointList;
+ BreakpointList_t::iterator m_current;
+ BreakpointList_t::iterator find(const DebuggerBreakpoint &bp);
+
+ public:
+ DebuggerBreakpointList();
+ ~DebuggerBreakpointList();
+
+ void add(DebuggerBreakpoint*);
+ void remove(DebuggerBreakpoint*);
+ //int remove(QString filePath, int line);
+ void clear();
+ bool exists(DebuggerBreakpoint*);
+ //bool exists(QString filePath, int line);
+
+ DebuggerBreakpoint* retrieve(const QString& filePath, int line);
+
+ DebuggerBreakpoint * findDebuggerBreakpoint(const QString& key);
+ void updateBreakpointKey(const DebuggerBreakpoint &bp, const QString& newkey);
+
+ size_t count();
+ void rewind();
+ DebuggerBreakpoint* next();
+
+};
+
+#endif
diff --git a/quanta/components/debugger/debuggerbreakpointview.cpp b/quanta/components/debugger/debuggerbreakpointview.cpp
new file mode 100644
index 00000000..2f7eea36
--- /dev/null
+++ b/quanta/components/debugger/debuggerbreakpointview.cpp
@@ -0,0 +1,193 @@
+/***************************************************************************
+ debuggerbreakpointview.cpp
+ --------------------------
+ begin : 2004-06-27
+ copyright : (C) 2004 Linus McCabe
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// KDE Includes
+#include <klocale.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <kdeversion.h>
+#include <kinputdialog.h>
+#include <klistview.h>
+
+// Quanta includes
+#include "debuggerbreakpointview.h"
+#include "debuggerbreakpoint.h"
+#include "debuggerclient.h"
+#include "debuggermanager.h"
+#include "resource.h"
+#include "quanta.h"
+
+namespace DebuggerBreakpointViewColumns
+{
+ // The enums must correspond to the order of the columns
+ // If you change here, change the column adding
+ enum Columns
+ {
+ Expression = 0,
+ File,
+ Class,
+ Function,
+ Line,
+ Value
+ };
+}
+
+DebuggerBreakpointViewItem::DebuggerBreakpointViewItem(DebuggerBreakpointView* view)
+ : KListViewItem(view)
+{
+}
+
+
+DebuggerBreakpointView::DebuggerBreakpointView(QWidget *parent, const char *name)
+ : KListView(parent, name)
+{
+ // If you change here, change the DebuggerBreakpointViewColumns enums above
+ addColumn(i18n("Expression"));
+ addColumn(i18n("File"));
+ addColumn(i18n("Class"));
+ addColumn(i18n("Function"));
+ addColumn(i18n("Line"));
+ addColumn(i18n("Value"));
+
+ setResizeMode(QListView::AllColumns);
+ setAllColumnsShowFocus(true);
+
+ m_breakpointPopup = new KPopupMenu(this);
+ m_breakpointPopup->insertItem(SmallIcon("editdelete"), i18n("&Remove"), this, SLOT(slotRemoveSelected()));
+
+ connect(this, SIGNAL( contextMenu( KListView *, QListViewItem *, const QPoint & ) ), this, SLOT(slotBreakpointContextMenu(KListView *, QListViewItem *, const QPoint &)));
+
+ // Jump to bp
+ connect(this, SIGNAL( doubleClicked( QListViewItem *, const QPoint &, int) ), this, SLOT(slotBreakpointDoubleClick( QListViewItem *, const QPoint &, int)));
+}
+
+
+DebuggerBreakpointView::~DebuggerBreakpointView()
+{}
+
+void DebuggerBreakpointView::deleteBreakpoint(const DebuggerBreakpoint &bp)
+{
+ QListViewItem *item = findBreakpoint(bp, false);
+ if(item)
+ {
+ delete item;
+ }
+}
+
+
+void DebuggerBreakpointView::showBreakpoint(const DebuggerBreakpoint &bp)
+{
+ QListViewItem *item = findBreakpoint(bp);
+ if(!item)
+ return;
+
+ if(bp.type() == DebuggerBreakpoint::LineBreakpoint)
+ {
+ item->setText(DebuggerBreakpointViewColumns::Value, "");
+ item->setText(DebuggerBreakpointViewColumns::Line, QString::number(bp.line() + 1));
+ }
+ else
+ {
+ item->setText(DebuggerBreakpointViewColumns::Value, bp.value());
+ item->setText(DebuggerBreakpointViewColumns::Line, "");
+ }
+ item->setText(DebuggerBreakpointViewColumns::File, bp.filePath());
+ item->setText(DebuggerBreakpointViewColumns::Expression, bp.condition());
+ item->setText(DebuggerBreakpointViewColumns::Class, bp.inClass());
+ item->setText(DebuggerBreakpointViewColumns::Function, bp.inFunction());
+}
+
+QListViewItem* DebuggerBreakpointView::findBreakpoint(const DebuggerBreakpoint& bp, bool addIfNotExist)
+{
+ // Find the old item if its there
+ DebuggerBreakpointViewItem* item = dynamic_cast<DebuggerBreakpointViewItem*>(firstChild());
+ while(item)
+ {
+ if(item->breakpoint() == bp)
+ break;
+
+ item = dynamic_cast<DebuggerBreakpointViewItem*>(item->nextSibling());
+ }
+
+ // Insert a new item
+ if(!item && addIfNotExist)
+ {
+ item = new DebuggerBreakpointViewItem(this);
+ item->setBreakpoint(bp);
+ insertItem(item);
+ }
+
+ return item;
+}
+
+
+DebuggerBreakpoint DebuggerBreakpointView::selected()
+{
+ DebuggerBreakpointViewItem* bpitem = dynamic_cast<DebuggerBreakpointViewItem*>(selectedItem());
+
+ return bpitem->breakpoint();
+}
+
+void DebuggerBreakpointView::slotRemoveSelected()
+{
+ if(!selectedItem())
+ return;
+
+ DebuggerBreakpoint bp = selected();
+
+ emit removeBreakpoint(&bp);
+}
+
+void DebuggerBreakpointView::keyPressEvent(QKeyEvent *e)
+{
+ if(e->key() != Qt::Key_Delete)
+ {
+ e->ignore();
+ return;
+ }
+
+ slotRemoveSelected();
+}
+
+void DebuggerBreakpointView::clear()
+{
+ KListView::clear();
+}
+
+void DebuggerBreakpointView::slotBreakpointDoubleClick(QListViewItem *item, const QPoint &, int )
+{
+ if(!item)
+ return;
+
+ DebuggerBreakpointViewItem* bpitem = dynamic_cast<DebuggerBreakpointViewItem*>(item);
+
+ if(!bpitem->breakpoint().filePath().isEmpty())
+ {
+ quantaApp->gotoFileAndLine(bpitem->breakpoint().filePath(), bpitem->breakpoint().line(), 0);
+ }
+
+}
+
+void DebuggerBreakpointView::slotBreakpointContextMenu(KListView *, QListViewItem *, const QPoint& point)
+{
+ if(!selectedItem())
+ return;
+
+ m_breakpointPopup->exec(point);
+}
+
+#include "debuggerbreakpointview.moc"
diff --git a/quanta/components/debugger/debuggerbreakpointview.h b/quanta/components/debugger/debuggerbreakpointview.h
new file mode 100644
index 00000000..1e3ca087
--- /dev/null
+++ b/quanta/components/debugger/debuggerbreakpointview.h
@@ -0,0 +1,74 @@
+/***************************************************************************
+ Breakpoinlistview.h
+ ------------------------
+ begin : 2004-06-27
+ copyright : (C) 2004 Linus McCabe
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef DEBUGGERBREAKPOINTVIEW_H
+#define DEBUGGERBREAKPOINTVIEW_H
+
+#include <klistview.h>
+#include <kpopupmenu.h>
+#include <qptrlist.h>
+#include "debuggerbreakpoint.h"
+
+// class DebuggerBreakpoint;
+class DebuggerBreakpointView;
+
+class DebuggerBreakpointViewItem : public KListViewItem
+{
+ private:
+ DebuggerBreakpoint m_breakpoint;
+
+ public:
+ DebuggerBreakpointViewItem();
+ DebuggerBreakpointViewItem(DebuggerBreakpointView* view);
+
+ DebuggerBreakpoint breakpoint() const { return m_breakpoint; }
+ void setBreakpoint(const DebuggerBreakpoint &bp) { m_breakpoint = bp; }
+
+};
+
+class DebuggerBreakpointView : public KListView
+{
+ Q_OBJECT
+
+ public:
+ DebuggerBreakpointView(QWidget *parent = 0, const char *name = 0);
+ ~DebuggerBreakpointView();
+
+ void showBreakpoint(const DebuggerBreakpoint& bp);
+ void deleteBreakpoint(const DebuggerBreakpoint& bp);
+
+ DebuggerBreakpoint selected();
+
+ void clear();
+
+ public slots:
+ void slotRemoveSelected();
+ void slotBreakpointContextMenu(KListView *list, QListViewItem * item, const QPoint& point);
+ void slotBreakpointDoubleClick(QListViewItem *item, const QPoint &point, int column);
+
+ signals:
+ void removeBreakpoint(DebuggerBreakpoint*);
+
+ private:
+ void keyPressEvent(QKeyEvent *e);
+ QListViewItem* findBreakpoint(const DebuggerBreakpoint& bp, bool addIfNotExist = true);
+
+ KPopupMenu *m_breakpointPopup;
+};
+
+#endif
diff --git a/quanta/components/debugger/debuggermanager.cpp b/quanta/components/debugger/debuggermanager.cpp
new file mode 100644
index 00000000..bbc6336c
--- /dev/null
+++ b/quanta/components/debugger/debuggermanager.cpp
@@ -0,0 +1,850 @@
+/***************************************************************************
+ phpdebuggerinterface.cpp
+ -------------------
+ begin : 2004-03-12
+ copyright : (C) 2004 Linus McCabe <linus@mccabe.nu>
+ Based on work by Mathieu Kooiman
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <ktexteditor/document.h>
+#include <ktexteditor/markinterfaceextension.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kcombobox.h>
+#include <kparts/componentfactory.h>
+#include <kiconloader.h>
+#include <kmessagebox.h>
+#include <qextfileinfo.h>
+#include <kinputdialog.h>
+#include <qlineedit.h>
+
+#include "quanta.h"
+#include "document.h"
+#include "resource.h"
+#include "project.h"
+#include "quantadebuggerinterface.h"
+#include "debuggerclient.h"
+#include "debuggerbreakpoint.h"
+#include "debuggerbreakpointlist.h"
+#include "debuggermanager.h"
+#include "messageoutput.h"
+#include "viewmanager.h"
+#include "quantaview.h"
+#include "debuggerui.h"
+#include "debuggervariable.h"
+#include "pathmapper.h"
+#include "variableslistview.h"
+#include "conditionalbreakpointdialog.h"
+
+// dialogs
+#include "debuggervariablesets.h"
+
+DebuggerManager::DebuggerManager(QObject *myparent)
+ : QObject(myparent)
+{
+ initActions();
+
+ // Create objects
+ m_breakpointList = new DebuggerBreakpointList();
+ m_pathmapper = new PathMapper(this, "pathmapper");
+ m_debuggerui = NULL;
+ m_interface = new QuantaDebuggerInterface(this, "interface");
+ m_client = NULL;
+}
+
+void DebuggerManager::slotNewProjectLoaded(const QString &projectname, const KURL &, const KURL &)
+{
+ if(m_client)
+ {
+
+ disconnect(m_client, SIGNAL(updateStatus(DebuggerUI::DebuggerStatus)), m_debuggerui, SLOT(slotStatus(DebuggerUI::DebuggerStatus)));
+
+ delete m_client;
+ m_client = NULL;
+ }
+ enableAction("*", false);
+
+ // Remove all breakpoints
+ m_breakpointList->clear();
+
+ if(m_debuggerui)
+ {
+ delete m_debuggerui;
+ m_debuggerui = NULL;
+ }
+ //kdDebug(24002) << "DebuggerManager::slotNewProjectLoaded " << projectname << ", " << Project::ref()->debuggerClient << endl;
+
+ // Load new client
+ if(!projectname.isEmpty())
+ {
+
+ KTrader::OfferList offers = KTrader::self()->query("Quanta/Debugger");
+ KTrader::OfferList::ConstIterator iterDbg;
+ for(iterDbg = offers.begin(); iterDbg != offers.end(); ++iterDbg)
+ {
+ KService::Ptr service = *iterDbg;
+ if(Project::ref()->debuggerClient() == service->name())
+ {
+ int errCode = 0;
+//Workaround for dynamic_cast not working correctly on SUSE 10, gcc 4.0.2
+//The correct way should be a simple:
+// m_client = KParts::ComponentFactory::createInstanceFromService<DebuggerClient>(service, this, 0, QStringList(), &errCode);
+ QObject* obj = KParts::ComponentFactory::createInstanceFromService<QObject>(service, this, 0, QStringList(), &errCode);
+ if (obj && obj->inherits("DebuggerClient"))
+ m_client = static_cast<DebuggerClient *>(obj);
+
+ //kdDebug(24002) << service->name() << " (" << m_client << ")" << endl;
+
+ if(!m_client)
+ {
+ emit hideSplash();
+ KMessageBox::error(NULL, i18n("<qt>Unable to load the debugger plugin, error code %1 was returned: <b>%2</b>.</qt>").arg(errCode).arg(KLibLoader::self()->lastErrorMessage()), i18n("Debugger Error"));
+ }
+ break;
+ }
+ }
+ }
+
+ // Tell client to load its settings
+ if (m_client)
+ {
+ QDomNode nodeThisDbg;
+ QDomDocument *dom = Project::ref()->sessionDom();
+ QDomNode projectNode = dom->firstChild().firstChild();
+ QDomNode nodeDbg = projectNode.namedItem("debuggers");
+ if(nodeDbg.isNull())
+ {
+ nodeDbg = dom->createElement("debuggers");
+ projectNode.appendChild(nodeDbg);
+ }
+
+ // Load this project's mapped paths
+ m_pathmapper->readConfig();
+
+ // Load this projects debugger's settings
+ nodeThisDbg = nodeDbg.namedItem(m_client->getName());
+ if(nodeThisDbg.isNull())
+ {
+ nodeThisDbg = dom->createElement(m_client->getName());
+ nodeDbg.appendChild(nodeThisDbg);
+ }
+
+ m_client->readConfig(nodeThisDbg);
+
+ // recreate UI
+ m_debuggerui = new DebuggerUI(this, "debuggerui");
+ connect(m_client, SIGNAL(updateStatus(DebuggerUI::DebuggerStatus)), m_debuggerui, SLOT(slotStatus(DebuggerUI::DebuggerStatus)));
+
+ // Load saved breakpoints
+ if(Project::ref()->debuggerPersistentBreakpoints())
+ {
+ QDomNode nodeBreakpoints = nodeDbg.namedItem("breakpoints");
+ if(!nodeBreakpoints.isNull())
+ {
+ QDomNode child = nodeBreakpoints.firstChild();
+ while(!child.isNull())
+ {
+ DebuggerBreakpoint* bp = new DebuggerBreakpoint();
+ bp->setFilePath( child.attributes().namedItem("filepath").nodeValue());
+ bp->setClass( child.attributes().namedItem("class").nodeValue());
+ bp->setFunction( child.attributes().namedItem("function").nodeValue());
+ bp->setCondition( child.attributes().namedItem("condition").nodeValue());
+ bp->setLine( child.attributes().namedItem("line").nodeValue().toLong());
+ if(child.attributes().namedItem("type").nodeValue() == "true")
+ bp->setType(DebuggerBreakpoint::ConditionalTrue);
+ else if(child.attributes().namedItem("type").nodeValue() == "change")
+ bp->setType(DebuggerBreakpoint::ConditionalChange);
+ else
+ bp->setType(DebuggerBreakpoint::LineBreakpoint);
+
+ // Update client and ui
+ m_client->addBreakpoint(bp);
+ m_breakpointList->add(bp);
+
+ // loop
+ child = child.nextSibling();
+ }
+ }
+ }
+
+ // Load saved Watches
+ if(Project::ref()->debuggerPersistentWatches())
+ {
+ QDomNode nodeWatches = nodeDbg.namedItem("watches");
+ if(!nodeWatches.isNull())
+ {
+ QDomNode child = nodeWatches.firstChild();
+ while(!child.isNull())
+ {
+ QString watch = child.attributes().namedItem("name").nodeValue();
+ DebuggerVariable *var = new DebuggerVariable(watch, "", DebuggerVariableTypes::Undefined);
+ m_debuggerui->addVariable(var);
+ m_client->addWatch(watch);
+
+ child = child.nextSibling();
+ }
+ }
+ }
+
+ }
+
+ initClientActions();
+
+ // Disable all debugactions that need a session (ie not breakpoints, etc)
+ slotDebugStartSession();
+}
+
+void DebuggerManager::initActions()
+{
+ KAction * newaction;
+ KActionCollection *ac = quantaApp->actionCollection();
+ if(!ac)
+ return;
+
+ //Debugger, breakpoint
+ newaction = new KAction(i18n("Toggle &Breakpoint"), SmallIcon("debug_breakpoint"), Qt::CTRL+Qt::SHIFT+Qt::Key_B, this, SLOT(toggleBreakpoint()), ac, "debug_breakpoints_toggle");
+ newaction->setToolTip(i18n("Toggles a breakpoint at the current cursor location"));
+
+ newaction = new KAction(i18n("&Clear Breakpoints"), 0, this, SLOT(clearBreakpoints()), ac, "debug_breakpoints_clear");
+ newaction->setToolTip(i18n("Clears all breakpoints"));
+
+ newaction = new KAction(i18n("Break When..."), SmallIcon("math_int"), 0, this, SLOT(slotConditionalBreakpoint()), ac, "debug_conditional_break");
+ newaction->setToolTip(i18n("Adds a new conditional breakpoint"));
+
+ newaction = new KAction(i18n("Break When..."), SmallIcon("math_int"), 0, this, SLOT(slotConditionalBreakpoint()), ac, "debug_conditional_breakdialog");
+ newaction->setToolTip(i18n("Adds a new conditional breakpoint"));
+
+ // Execution
+ newaction = new KAction(i18n("Send HTTP R&equest"), SmallIcon("debug_currentline"), 0, this, SLOT(slotDebugRequest()), ac, "debug_request");
+ newaction->setToolTip(i18n("Initiate HTTP Request to the server with debugging activated"));
+
+ newaction = new KAction(i18n("&Trace"), SmallIcon("debug_run"), 0, this, SLOT(slotDebugTrace()), ac, "debug_trace");
+ newaction->setToolTip(i18n("Traces through the script. If a script is currently not being debugged, it will start in trace mode when started"));
+
+ newaction = new KAction(i18n("&Run"), SmallIcon("debug_leap"), 0, this, SLOT(slotDebugRun()), ac, "debug_run");
+ newaction->setToolTip(i18n("Runs the script. If a script is currently not being debugged, it will start in run mode when started"));
+
+ newaction = new KAction(i18n("&Step"), SmallIcon("debug_stepover"), 0, this, SLOT(slotDebugStepOver()), ac, "debug_stepover");
+ newaction->setToolTip(i18n("Executes the next line of execution, but does not step into functions or includes"));
+
+ newaction = new KAction(i18n("Step &Into"), SmallIcon("debug_stepinto"), 0, this, SLOT(slotDebugStepInto()), ac, "debug_stepinto");
+ newaction->setToolTip(i18n("Executes the next line of execution and steps into it if it is a function call or inclusion of a file"));
+
+ newaction = new KAction(i18n("S&kip"), SmallIcon("debug_skip"), 0, this, SLOT(slotDebugSkip()), ac, "debug_skip");
+ newaction->setToolTip(i18n("Skips the next command of execution and makes the next command the current one"));
+
+ newaction = new KAction(i18n("Step &Out"), SmallIcon("debug_stepout"), 0, this, SLOT(slotDebugStepOut()), ac, "debug_stepout");
+ newaction->setToolTip(i18n("Executes the rest of the commands in the current function/file and pauses when it is done (when it reaches a higher level in the backtrace)"));
+
+ newaction = new KAction(i18n("&Pause"), SmallIcon("debug_pause"), 0, this, SLOT(slotDebugPause()), ac, "debug_pause");
+ newaction->setToolTip(i18n("Pauses the scripts if it is running or tracing. If a script is currently not being debugged, it will start in paused mode when started"));
+ newaction = new KAction(i18n("Kill"), SmallIcon("debug_kill"), 0, this, SLOT(slotDebugKill()), ac, "debug_kill");
+ newaction->setToolTip(i18n("Kills the currently running script"));
+
+ newaction = new KAction(i18n("Start Session"), SmallIcon("debug_connect"), 0, this, SLOT(slotDebugStartSession()), ac, "debug_connect");
+ newaction->setToolTip(i18n("Starts the debugger internally (Makes debugging possible)"));
+
+ newaction = new KAction(i18n("End Session"), SmallIcon("debug_disconnect"), 0, this, SLOT(slotDebugEndSession()), ac, "debug_disconnect");
+ newaction->setToolTip(i18n("Stops the debugger internally (debugging not longer possible)"));
+
+ // Variables
+ newaction = new KAction(i18n("Watch Variable"), SmallIcon("math_brace"), 0, this, SLOT(slotAddWatch()), ac, "debug_addwatch");
+ newaction->setToolTip(i18n("Adds a variable to the watch list"));
+
+ newaction = new KAction(i18n("Watch Variable"), SmallIcon("math_brace"), 0, this, SLOT(slotAddWatch()), ac, "debug_addwatchdialog");
+ newaction->setToolTip(i18n("Adds a variable to the watch list"));
+
+ newaction = new KAction(i18n("Set Value of Variable"), SmallIcon("edit"), 0, this, SLOT(slotVariableSet()), ac, "debug_variable_set");
+ newaction->setToolTip(i18n("Changes the value of a variable"));
+
+ newaction = new KAction(i18n("Set Value of Variable"), SmallIcon("edit"), 0, this, SLOT(slotVariableSet()), ac, "debug_variable_setdialog");
+ newaction->setToolTip(i18n("Changes the value of a variable"));
+
+ newaction = new KAction(i18n("Open Profiler Output"), SmallIcon("launch"), 0, this, SLOT(slotProfilerOpen()), ac, "debug_profiler_open");
+ newaction->setToolTip(i18n("Opens the profiler output file"));
+
+ enableAction("*", false);
+
+}
+
+void DebuggerManager::initClientActions()
+{
+ enableAction("*", false);
+
+ if(m_client)
+ {
+ // Get actioncollection and add appropriate actions depending on capabilities of the debugger
+ if(m_client->supports(DebuggerClientCapabilities::LineBreakpoints))
+ enableAction("debug_breakpoints_toggle", true);
+ if(m_client->supports(DebuggerClientCapabilities::LineBreakpoints))
+ enableAction("debug_breakpoints_clear", true);
+ }
+}
+
+DebuggerManager::~DebuggerManager()
+{
+ delete m_breakpointList;
+ m_breakpointList = 0L;
+
+ if(m_client)
+ {
+
+ disconnect(m_client, SIGNAL(updateStatus(DebuggerUI::DebuggerStatus)), m_debuggerui, SLOT(slotStatus(DebuggerUI::DebuggerStatus)));
+
+ delete m_client;
+ m_client = 0L;
+ }
+
+ delete m_debuggerui;
+ m_debuggerui = 0L;
+ delete m_interface;
+ m_interface = 0L;
+ delete m_pathmapper;
+ m_pathmapper = 0L;
+}
+
+void DebuggerManager::enableAction(const QString& action, bool enable)
+{
+ if(action == "*")
+ {
+ // Enable/Disable all session related actions + connect/disconnect
+ enableAction("debug_request", enable);
+ enableAction("debug_run", enable);
+ enableAction("debug_trace", enable);
+ enableAction("debug_pause", enable);
+ enableAction("debug_kill", enable);
+ enableAction("debug_stepover", enable);
+ enableAction("debug_stepinto", enable);
+ enableAction("debug_stepout", enable);
+ enableAction("debug_skip", enable);
+
+ enableAction("debug_connect", enable);
+ enableAction("debug_disconnect", enable);
+
+ enableAction("debug_breakpoints_toggle", enable);
+ enableAction("debug_breakpoints_clear", enable);
+
+ enableAction("debug_profiler_open", enable);
+
+ }
+ else
+ {
+ // The action may or may not exist, depending on capabilities of the debugger plugin
+ KActionCollection *ac = quantaApp->actionCollection();
+ if(ac && ac->action(action))
+ ac->action(action)->setEnabled(enable);
+ }
+}
+
+void DebuggerManager::slotRemoveVariable(DebuggerVariable* var)
+{
+ if(!m_client)
+ return;
+
+ m_client->removeWatch(var);
+
+}
+
+void DebuggerManager::slotRemoveBreakpoint(DebuggerBreakpoint* bp)
+{
+ if(!m_client)
+ return;
+ m_breakpointList->remove(bp);
+ m_client->removeBreakpoint(bp);
+
+}
+
+
+void DebuggerManager::slotAddWatch()
+{
+ kdDebug(24002) << "DebuggerManager::slotAddWatch() " << endl;
+ if(!m_client)
+ return;
+
+
+ QString watch = KInputDialog::getText(i18n("Add Watch"), i18n("Specify variable to watch:"), quantaApp->popupWord);
+ quantaApp->popupWord = "";
+ if(!watch.isEmpty())
+ {
+ DebuggerVariable *var = new DebuggerVariable(watch, "", DebuggerVariableTypes::Undefined);
+ m_debuggerui->addVariable(var);
+ m_client->addWatch(watch);
+ }
+}
+
+void DebuggerManager::slotVariableSet()
+{
+ kdDebug(24002) << "DebuggerManager::slotVariableSet(" << quantaApp->popupWord << ") " << endl;
+ if(!m_client)
+ return;
+
+
+ DebuggerVariableSetS dlg;
+ dlg.lineVariable->setText(quantaApp->popupWord);
+ quantaApp->popupWord = "";
+ if(dlg.exec() == QDialog::Accepted)
+ {
+ DebuggerVariable var;
+ var.setName(dlg.lineVariable->text());
+ var.setValue(dlg.lineValue->text());
+ m_client->variableSetValue(var);
+ }
+}
+
+void DebuggerManager::slotConditionalBreakpoint()
+{
+ QString file;
+
+ kdDebug(24002) << "DebuggerManager::slotConditionalBreakpoint() " << quantaApp->popupWord << endl;
+ if(!m_client)
+ return;
+
+ Document *w = ViewManager::ref()->activeDocument();
+ if (w)
+ file = w->url().prettyURL(0, KURL::StripFileProtocol);
+
+ ConditionalBreakpointDialog dlg(quantaApp->popupWord, file, "", "");
+ quantaApp->popupWord = "";
+ if(dlg.exec() == QDialog::Accepted)
+ {
+ DebuggerBreakpoint * bp = dlg.breakpoint();
+ if(bp)
+ {
+ m_client->addBreakpoint(bp);
+ m_breakpointList->add(bp);
+ }
+ }
+}
+
+void DebuggerManager::slotDebugStartSession()
+{
+ if(!m_client)
+ return;
+
+ m_client->startSession();
+}
+
+void DebuggerManager::slotDebugEndSession()
+{
+ if(!m_client)
+ return;
+
+ m_client->endSession();
+}
+
+void DebuggerManager::slotDebugRequest()
+{
+ if(!m_client)
+ return;
+
+ m_client->request();
+}
+
+void DebuggerManager::slotDebugTrace()
+{
+ if(!m_client)
+ return;
+
+ m_client->trace();
+}
+
+void DebuggerManager::slotDebugRun()
+{
+ if(!m_client)
+ return;
+
+ m_client->run();
+
+}
+void DebuggerManager::slotDebugSkip()
+{
+ if(!m_client)
+ return;
+
+ m_client->skip();
+
+}
+void DebuggerManager::slotDebugStepOver()
+{
+ if(!m_client)
+ return;
+
+ m_client->stepOver();
+
+}
+void DebuggerManager::slotDebugStepInto()
+{
+ if(!m_client)
+ return;
+
+ m_client->stepInto();
+
+}
+void DebuggerManager::slotDebugPause()
+{
+ if(!m_client)
+ return;
+
+ m_client->pause();
+
+}
+void DebuggerManager::slotDebugKill()
+{
+ if(!m_client)
+ return;
+
+ m_client->kill();
+
+}
+void DebuggerManager::slotDebugStepOut()
+{
+ if(!m_client)
+ return;
+
+ m_client->stepOut();
+
+}
+
+void DebuggerManager::slotProfilerOpen( )
+{
+ if(!m_client)
+ return;
+
+ m_client->profilerOpen();
+}
+
+// A new file was opened, tell the debugger so it can tell us about breakpoints etc
+void DebuggerManager::fileOpened(const QString& file)
+{
+
+ // Set breakpoint markers if we have a bp in the file
+ m_breakpointList->rewind();
+ DebuggerBreakpoint* bp;
+ while((bp = m_breakpointList->next()))
+ {
+ if(bp->filePath() == file)
+ {
+ setMark(bp->filePath(), bp->line(), true, KTextEditor::MarkInterface::markType02);
+ }
+ }
+
+ //lets keep the eye on toggling bp's through the editor margin
+ QuantaView *view = ViewManager::ref()->isOpened(KURL::fromPathOrURL(file));
+ if (view)
+ {
+ ::Document* qdoc = view->document();
+ if(qdoc)
+ {
+ connectBreakpointSignals(qdoc);
+ }
+ }
+
+ // Also, if we have a debug-session, let the debugger know...
+ if(m_client)
+ m_client->fileOpened(file);
+}
+
+// Check with editors if breakpoints changed and send all breakpoint (again) to client
+void DebuggerManager::refreshBreakpoints()
+{
+ // Resend bps
+ m_breakpointList->rewind();
+ DebuggerBreakpoint* bp;
+ while((bp = m_breakpointList->next()))
+ {
+ m_client->addBreakpoint(bp);
+ }
+
+}
+
+
+// The debug server told us we have a breakpoint, mark it in the file
+void DebuggerManager::haveBreakpoint (const QString& file, int line)
+{
+ setMark(file, line, true, KTextEditor::MarkInterface::markType02);
+}
+
+// The debug server told us we DONT have a breakpoint, remove it
+void DebuggerManager::havenoBreakpoint (const QString& file, int line)
+{
+ DebuggerBreakpoint* br = new DebuggerBreakpoint(file, line);
+ m_breakpointList->remove(br);
+ setMark(file, line, false, KTextEditor::MarkInterface::markType02);
+ m_breakpointList->remove(br);
+}
+
+// New current line
+bool DebuggerManager::setActiveLine (const QString& file, int line )
+{
+ //Get local filename
+ QString filename = file;
+
+ // Remove old active line mark
+ setMark(m_currentFile, m_currentLine, false, KTextEditor::MarkInterface::markType05);
+
+ // Update vars with active line
+ m_currentFile = filename;
+ m_currentLine = line;
+
+ // No new current position
+ if(filename.isEmpty() || quantaApp->previewVisible())
+ return true;
+
+ // Find new position in editor
+ if(ViewManager::ref()->isOpened(filename) || QExtFileInfo::exists(filename, true, 0L))
+ quantaApp->gotoFileAndLine(filename, line, 0);
+ else
+ {
+ showStatus(i18n("Unable to open file %1, check your basedirs and mappings.").arg(filename), true);
+ }
+
+ // Add new active line mark
+ setMark(filename, line, true, KTextEditor::MarkInterface::markType05);
+ return true;
+}
+
+// Set/clear a mark in a document
+void DebuggerManager::setMark(const QString& filename, long line, bool set, int mark)
+{
+ if((!filename.isEmpty()) && ViewManager::ref()->isOpened(filename))
+ {
+ ::Document* qdoc = ViewManager::ref()->isOpened(filename)->document();
+ if(qdoc)
+ {
+ disconnectBreakpointSignals(qdoc);
+
+ KTextEditor::Document* doc = qdoc->doc();
+ if(doc)
+ {
+ KTextEditor::MarkInterface *markIf = dynamic_cast<KTextEditor::MarkInterface*>(doc);
+ if(markIf)
+ {
+ if(set)
+ markIf->addMark(line, mark);
+ else
+ markIf->removeMark(line, mark);
+ }
+ }
+ connectBreakpointSignals(qdoc);
+ }
+ }
+}
+
+void DebuggerManager::connectBreakpointSignals(Document* qdoc)
+{
+ connect(qdoc, SIGNAL(breakpointMarked(Document*, int)),
+ this, SLOT(slotBreakpointMarked(Document*, int)));
+
+ connect(qdoc, SIGNAL(breakpointUnmarked(Document*, int)),
+ this, SLOT(slotBreakpointUnmarked(Document*, int)));
+}
+
+void DebuggerManager::disconnectBreakpointSignals(Document* qdoc)
+{
+ disconnect(qdoc, SIGNAL(breakpointMarked(Document*, int)),
+ this, SLOT(slotBreakpointMarked(Document*, int)));
+
+ disconnect(qdoc, SIGNAL(breakpointUnmarked(Document*, int)),
+ this, SLOT(slotBreakpointUnmarked(Document*, int)));
+}
+
+// Show a status message and optionally put it on the log
+bool DebuggerManager::showStatus(const QString& a_message, bool log)
+{
+ QString message = a_message;
+ quantaApp->slotStatusMsg(m_client->getName() + ": " + message);
+
+ if(log)
+ {
+ if(!message.endsWith("\n"))
+ message.append("\n");
+ quantaApp->messageOutput()->showMessage(m_client->getName() + ": " + message);
+ }
+ return true;
+}
+
+
+void DebuggerManager::toggleBreakpoint ()
+{
+ Document *w = ViewManager::ref()->activeDocument();
+ if (w)
+ {
+ uint line, col;
+ w->viewCursorIf->cursorPositionReal(&line, &col);
+
+ DebuggerBreakpoint* br = m_breakpointList->retrieve(w->url().prettyURL(0, KURL::StripFileProtocol), line);
+
+ if(!br)
+ {
+ DebuggerBreakpoint* br = new DebuggerBreakpoint(w->url().prettyURL(0, KURL::StripFileProtocol), line);
+ m_breakpointList->add(br);
+// setMark(w->url().prettyURL(0, KURL::StripFileProtocol), br->line(), true, KTextEditor::MarkInterface::markType02); // FIXME Is this really needed?
+ if(m_client && m_client->isActive())
+ {
+ DebuggerBreakpoint tmpbp = *br;
+ m_client->addBreakpoint(br);
+
+ }
+ else
+ // Trigger pathmapper to make sure we have a valid translation...
+ m_pathmapper->mapLocalPathToServer(w->url().prettyURL(0, KURL::StripFileProtocol));
+ }
+ else
+ {
+ m_breakpointList->remove(br);
+// setMark(w->url().prettyURL(0, KURL::StripFileProtocol), br->line(), false, KTextEditor::MarkInterface::markType02); // FIXME Is this really needed?
+
+ if(m_client && m_client->isActive())
+ {
+ m_client->removeBreakpoint(br);
+ }
+ }
+ }
+}
+void DebuggerManager::clearBreakpoints ()
+{
+ m_breakpointList->clear();
+}
+
+void DebuggerManager::slotBreakpointMarked(Document* qdoc, int line)
+{
+ DebuggerBreakpoint* br = new DebuggerBreakpoint(qdoc->url().prettyURL(0, KURL::StripFileProtocol), line);
+
+ m_breakpointList->add(br);
+ if(m_client && m_client->isActive())
+ {
+ m_client->addBreakpoint(br);
+ }
+}
+
+void DebuggerManager::slotBreakpointUnmarked(Document* qdoc, int line)
+{
+ QString filePath = qdoc->url().prettyURL(0, KURL::StripFileProtocol);
+
+ DebuggerBreakpoint* br = m_breakpointList->retrieve(filePath, line);
+
+ if (br)
+ {
+ if(m_client && m_client->isActive())
+ {
+ m_client->removeBreakpoint(br);
+ }
+
+ m_breakpointList->remove(br);
+ }
+}
+
+void DebuggerManager::updateBreakpointKey( const DebuggerBreakpoint & bp, const QString & newkey )
+{
+ m_breakpointList->updateBreakpointKey(bp, newkey);
+
+ // Update UI
+ m_debuggerui->deleteBreakpoint(bp);
+ DebuggerBreakpoint bpnew(bp);
+ bpnew.setKey(newkey);
+ m_debuggerui->showBreakpoint(bpnew);
+
+}
+
+DebuggerBreakpoint * DebuggerManager::findDebuggerBreakpoint( const QString & key )
+{
+ return m_breakpointList->findDebuggerBreakpoint(key);
+}
+
+void DebuggerManager::saveProperties( )
+{
+
+ if (m_client)
+ {
+ QDomDocument *dom = Project::ref()->sessionDom();
+ QDomNode projectNode = dom->firstChild().firstChild();
+ QDomNode nodeDbg = projectNode.namedItem("debuggers");
+ if(nodeDbg.isNull())
+ {
+ nodeDbg = dom->createElement("debuggers");
+ projectNode.appendChild(nodeDbg);
+ }
+
+ // Save breakpoints
+ if(Project::ref()->debuggerPersistentBreakpoints())
+ {
+ // (Re)create breakpoints section
+ QDomNode nodeBreakpoints = nodeDbg.namedItem("breakpoints");
+ if(!nodeBreakpoints.isNull())
+ nodeBreakpoints.parentNode().removeChild(nodeBreakpoints);
+
+ if(m_breakpointList->count() > 0)
+ {
+ nodeBreakpoints = dom->createElement("breakpoints");
+ nodeDbg.appendChild(nodeBreakpoints);
+
+
+ // Loop breakpoints and save 'em
+ m_breakpointList->rewind();
+ DebuggerBreakpoint* bp;
+ while((bp = m_breakpointList->next()))
+ {
+ QDomElement child = dom->createElement("breakpoint");
+ child.setAttribute("filepath", bp->filePath());
+ child.setAttribute("class", bp->inClass());
+ child.setAttribute("function", bp->inFunction());
+ child.setAttribute("condition", bp->condition());
+ child.setAttribute("line", QString::number(bp->line()));
+ if(bp->type() == DebuggerBreakpoint::ConditionalTrue)
+ child.setAttribute("type", "true");
+ else if(bp->type() == DebuggerBreakpoint::ConditionalChange)
+ child.setAttribute("type", "change");
+ else
+ child.setAttribute("type", "line");
+
+ nodeBreakpoints.appendChild(child);
+ }
+ }
+ }
+
+ // Save Watches
+ if(Project::ref()->debuggerPersistentWatches())
+ {
+ // (Re)create watches section
+ QDomNode nodeWatches = nodeDbg.namedItem("watches");
+ if(!nodeWatches.isNull())
+ nodeWatches.parentNode().removeChild(nodeWatches);
+
+ if(m_debuggerui->watches()->first())
+ {
+ nodeWatches = dom->createElement("watches");
+ nodeDbg.appendChild(nodeWatches);
+
+ // Loop watches and save 'em
+ for( DebuggerVariable *v = m_debuggerui->watches()->first(); v; v = m_debuggerui->watches()->next())
+ {
+ QDomElement child = dom->createElement("watch");
+ child.setAttribute("name", v->name());
+
+ nodeWatches.appendChild(child);
+ }
+ }
+ }
+ }
+}
+
+void DebuggerManager::slotHandleEvent( const QString & event, const QString &, const QString & )
+{
+ if(event == "before_project_close")
+ saveProperties();
+}
+
+
+
+
+#include "debuggermanager.moc"
diff --git a/quanta/components/debugger/debuggermanager.h b/quanta/components/debugger/debuggermanager.h
new file mode 100644
index 00000000..f7584bdf
--- /dev/null
+++ b/quanta/components/debugger/debuggermanager.h
@@ -0,0 +1,128 @@
+/***************************************************************************
+ phpdebuggerinterface.h
+ -------------------
+ begin : 2004-03-12
+ copyright : (C) 2004 Linus McCabe <linus@mccabe.nu>
+ Based on work by Mathieu Kooiman
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef PHPDEBUGGERINTERFACE_H
+#define PHPDEBUGGERINTERFACE_H
+
+#include <qobject.h>
+#include <qstring.h>
+
+class DebuggerClient;
+class QuantaDebuggerInterface;
+class DebuggerBreakpointList;
+class DebuggerUI;
+class DebuggerVariable;
+class DebuggerBreakpoint;
+class PathMapper;
+class Document;
+
+class DebuggerManager : public QObject
+{
+ Q_OBJECT
+ private:
+ // client
+ DebuggerClient *m_client;
+ QuantaDebuggerInterface * m_interface;
+ DebuggerBreakpointList *m_breakpointList;
+ DebuggerUI * m_debuggerui;
+ PathMapper * m_pathmapper;
+
+ // Internal help functions
+ void initActions();
+ void initClientActions();
+ void saveProperties();
+
+ void connectBreakpointSignals(Document*);
+ void disconnectBreakpointSignals(Document*);
+
+ QString m_currentFile;
+ long m_currentLine;
+
+ public:
+ DebuggerManager(QObject *myparent);
+ ~DebuggerManager();
+
+ // Access to memebers
+ DebuggerUI * UI() { return m_debuggerui; };
+ DebuggerClient * client() { return m_client; };
+ PathMapper * Mapper() { return m_pathmapper; };
+
+ // Breakpoints
+ void haveBreakpoint (const QString& file, int line);
+ void havenoBreakpoint (const QString& file, int line);
+ void refreshBreakpoints();
+// DebuggerBreakpoint *newDebuggerBreakpoint();
+ DebuggerBreakpoint * findDebuggerBreakpoint(const QString& key);
+ void updateBreakpointKey(const DebuggerBreakpoint &bp, const QString& newkey);
+
+ // Public help functions
+ bool showStatus(const QString& message, bool log);
+ bool setActiveLine (const QString& file, int line);
+ void setMark(const QString& filename, long line, bool set, int mark);
+
+ void enableAction(const QString& action, bool enable);
+ void fileOpened(const QString& file);
+
+ bool hasClient() { return m_client != 0; };
+
+ public slots:
+
+ // Execution control slots
+ void slotDebugRequest();
+ void slotDebugRun();
+ void slotDebugTrace();
+ void slotDebugSkip();
+ void slotDebugStepOver();
+ void slotDebugStepInto();
+ void slotDebugStepOut();
+ void slotDebugPause();
+ void slotDebugKill();
+
+ // Breakpoint
+ void toggleBreakpoint();
+ void clearBreakpoints();
+ void slotConditionalBreakpoint();
+ void slotRemoveBreakpoint(DebuggerBreakpoint* bp);
+
+ // Watches
+ void slotAddWatch();
+ void slotRemoveVariable(DebuggerVariable* var);
+ void slotVariableSet();
+
+ // Connection related slots
+ void slotDebugStartSession();
+ void slotDebugEndSession();
+
+ // Profiler
+ void slotProfilerOpen();
+
+ // Initiation
+ void slotNewProjectLoaded(const QString &, const KURL &, const KURL &);
+
+ // Event handling
+ void slotHandleEvent(const QString &, const QString &, const QString &);
+
+ private slots:
+ void slotBreakpointMarked(Document*, int);
+ void slotBreakpointUnmarked(Document*, int);
+
+ signals:
+ void hideSplash();
+};
+
+#endif
+
diff --git a/quanta/components/debugger/debuggerui.cpp b/quanta/components/debugger/debuggerui.cpp
new file mode 100644
index 00000000..c290bd8a
--- /dev/null
+++ b/quanta/components/debugger/debuggerui.cpp
@@ -0,0 +1,205 @@
+/***************************************************************************
+ debuggerui.cpp
+ ------------------------
+ begin : 2004-04-04
+ copyright : (C) 2004 Thiago Silva
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "debuggerui.h"
+
+#include <kiconloader.h>
+#include <kdockwidget.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <qstring.h>
+#include <khtmlview.h>
+#include <kmditoolviewaccessor.h>
+#include <kstatusbar.h>
+
+#include "variableslistview.h"
+#include "debuggerbreakpointview.h"
+#include "backtracelistview.h"
+#include "debuggervariable.h"
+
+#include "quantacommon.h"
+#include "quanta.h"
+#include "resource.h"
+#include "whtmlpart.h"
+
+DebuggerUI::DebuggerUI(QObject *parent, const char *name)
+ : QObject(parent, name), m_variablesListView(0)
+{
+
+ // Variable watch tree
+ m_variablesListView = new VariablesListView(quantaApp->getMainDockWidget(), "debuggerVariables");
+ m_variablesListView->setIcon(SmallIcon("math_brace"));
+ m_variablesListView->setCaption(i18n("Variables"));
+ m_variableListViewTVA = quantaApp->addToolWindow(m_variablesListView, quantaApp->prevDockPosition(m_variablesListView, KDockWidget::DockLeft), quantaApp->getMainDockWidget());
+
+ // Breakpointlist
+ m_debuggerBreakpointView = new DebuggerBreakpointView(quantaApp->getMainDockWidget(), "debuggerBreakpoints");
+ m_debuggerBreakpointView->setIcon(SmallIcon("debug_breakpoint"));
+ m_debuggerBreakpointView->setCaption(i18n("Breakpoints"));
+ m_debuggerBreakpointViewTVA = quantaApp->addToolWindow(m_debuggerBreakpointView, quantaApp->prevDockPosition(m_debuggerBreakpointView, KDockWidget::DockBottom), quantaApp->getMainDockWidget());
+
+ // Backtrace
+ m_backtraceListview = new BacktraceListview(quantaApp->getMainDockWidget(), "debuggerBacktrace");
+ m_backtraceListview->setIcon(SmallIcon("player_playlist"));
+ m_backtraceListview->setCaption(i18n("Backtrace"));
+ m_backtraceListviewTVA = quantaApp->addToolWindow(m_backtraceListview, quantaApp->prevDockPosition(m_backtraceListview, KDockWidget::DockBottom), quantaApp->getMainDockWidget());
+
+ // Debug HTML preview
+ m_preview = new WHTMLPart(quantaApp, "debug_output", true);
+ //m_preview->view()->resize(0, 0);
+ m_preview->view()->setIcon(UserIcon("debug_run"));
+ m_preview->view()->setCaption(i18n("Debug Output"));
+ m_previewTVA = quantaApp->addToolWindow(m_preview->view(), quantaApp->prevDockPosition(m_preview->view(), KDockWidget::DockBottom), quantaApp->getMainDockWidget());
+ connect(m_preview, SIGNAL(openFile(const KURL&, const QString&, bool)), quantaApp, SLOT(slotFileOpen(const KURL&, const QString&, bool)));
+
+ // Show debugger toolbar
+ quantaApp->toolBar("debugger_toolbar")->show();
+
+ connect(m_variablesListView, SIGNAL(removeVariable(DebuggerVariable* )), parent, SLOT(slotRemoveVariable(DebuggerVariable* )));
+
+ connect(m_debuggerBreakpointView, SIGNAL(removeBreakpoint(DebuggerBreakpoint* )), parent, SLOT(slotRemoveBreakpoint(DebuggerBreakpoint* )));
+ showMenu();
+}
+
+DebuggerUI::~DebuggerUI()
+{
+ hideMenu();
+ quantaApp->toolBar("debugger_toolbar")->hide();
+
+ // Remove Variable tree
+ quantaApp->deleteToolWindow(m_variableListViewTVA);
+ m_variableListViewTVA = 0L;
+
+ // Remove breakpointlist
+ quantaApp->deleteToolWindow(m_debuggerBreakpointViewTVA);
+ m_debuggerBreakpointViewTVA = 0L;
+
+ // Remove backtrace
+ quantaApp->deleteToolWindow(m_backtraceListviewTVA);
+ m_backtraceListviewTVA = 0L;
+
+ // Remove output
+ quantaApp->deleteToolWindow(m_previewTVA);
+ m_previewTVA = 0L;
+}
+
+void DebuggerUI::showMenu()
+{
+ QPopupMenu* debuggerMenu = (QPopupMenu*)(quantaApp->guiFactory())->container("debugger_menu", quantaApp);
+ if(debuggerMenu)
+ {
+ KMenuBar *mb = quantaApp->menuBar();
+ mb->activateItemAt(-1); //needed as insertItem might crash if a menu is activated
+ m_debuggerMenuID = mb->insertItem(i18n("Deb&ug"), debuggerMenu, -1, 5);
+ }
+ else
+ m_debuggerMenuID = 0;
+
+ // Status indicator
+ quantaApp->statusBar()->insertFixedItem(i18n("Debugger Inactive"), IDS_STATUS_DEBUGGER);
+
+}
+
+void DebuggerUI::hideMenu()
+{
+ if(m_debuggerMenuID != 0)
+ {
+ KMenuBar *mb = quantaApp->menuBar();
+ mb->activateItemAt(-1); //needed as removeItem might crash if a menu is activated
+ mb->removeItem(m_debuggerMenuID);
+ }
+ m_debuggerMenuID = 0;
+
+ // Status indicator
+ quantaApp->statusBar()->removeItem(IDS_STATUS_DEBUGGER);
+
+}
+
+void DebuggerUI::addVariable(DebuggerVariable* var)
+{
+ m_variablesListView->addVariable(var);
+}
+
+void DebuggerUI::showBreakpoint(const DebuggerBreakpoint &bp)
+{
+ m_debuggerBreakpointView->showBreakpoint(bp);
+}
+void DebuggerUI::deleteBreakpoint(const DebuggerBreakpoint &bp)
+{
+ m_debuggerBreakpointView->deleteBreakpoint(bp);
+}
+
+void DebuggerUI::sendRequest(const KURL &url)
+{
+ m_preview->openURL(url);
+}
+
+void DebuggerUI::slotStatus( DebuggerStatus status )
+{
+ switch(status)
+ {
+ case NoSession:
+ quantaApp->statusBar()->changeItem(i18n("No session"), IDS_STATUS_DEBUGGER);
+ break;
+
+ case AwaitingConnection:
+ quantaApp->statusBar()->changeItem(i18n("Waiting"), IDS_STATUS_DEBUGGER);
+ break;
+
+ case Connected:
+ quantaApp->statusBar()->changeItem(i18n("Connected"), IDS_STATUS_DEBUGGER);
+ break;
+
+ case Paused:
+ quantaApp->statusBar()->changeItem(i18n("Paused"), IDS_STATUS_DEBUGGER);
+ break;
+
+ case Running:
+ quantaApp->statusBar()->changeItem(i18n("Running"), IDS_STATUS_DEBUGGER);
+ break;
+
+ case Tracing:
+ quantaApp->statusBar()->changeItem(i18n("Tracing"), IDS_STATUS_DEBUGGER);
+ break;
+
+ case HaltedOnError:
+ quantaApp->statusBar()->changeItem(i18n("On error"), IDS_STATUS_DEBUGGER);
+ break;
+
+ case HaltedOnBreakpoint:
+ quantaApp->statusBar()->changeItem(i18n("On breakpoint"), IDS_STATUS_DEBUGGER);
+ break;
+
+ default:
+ quantaApp->statusBar()->changeItem("", IDS_STATUS_DEBUGGER);
+ }
+}
+
+void DebuggerUI::backtraceClear( )
+{
+ if(m_backtraceListview)
+ m_backtraceListview->clear();
+}
+
+void DebuggerUI::backtraceShow( long level, BacktraceType type, const QString & filename, long line, const QString & func )
+{
+ if(m_backtraceListview)
+ m_backtraceListview->backtraceShow(level, type, filename, line, func);
+}
+
+
+#include "debuggerui.moc"
diff --git a/quanta/components/debugger/debuggerui.h b/quanta/components/debugger/debuggerui.h
new file mode 100644
index 00000000..a86e4706
--- /dev/null
+++ b/quanta/components/debugger/debuggerui.h
@@ -0,0 +1,90 @@
+/***************************************************************************
+ debuggerui.h
+ ------------------------
+ begin : 2004-04-04
+ copyright : (C) 2004 Thiago Silva
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef DEBUGGERUI_H
+#define DEBUGGERUI_H
+
+#include <qobject.h>
+#include <qptrlist.h>
+#include <kmditoolviewaccessor.h>
+#include "backtracelistview.h"
+
+class VariablesListView;
+class DebuggerBreakpointView;
+class BacktraceListview;
+class DebuggerBreakpoint;
+class DebuggerVariable;
+class WHTMLPart;
+class KURL;
+
+class DebuggerUI : public QObject
+{
+ Q_OBJECT
+
+ public:
+ enum DebuggerStatus
+ {
+ NoSession = 0,
+ AwaitingConnection,
+ Connected,
+ Paused,
+ Running,
+ Tracing,
+ HaltedOnError,
+ HaltedOnBreakpoint
+ };
+
+ DebuggerUI(QObject *parent = 0, const char *name = 0);
+ ~DebuggerUI();
+
+ // Watches
+ void addVariable(DebuggerVariable* var);
+ void showBreakpoint(const DebuggerBreakpoint& bp);
+ void deleteBreakpoint(const DebuggerBreakpoint& bp);
+ void parsePHPVariables(const QString &);
+ void sendRequest(const KURL &url);
+ VariablesListView* watches() { return m_variablesListView; };
+
+ void showMenu();
+ void hideMenu();
+
+ void backtraceClear();
+ void backtraceShow(long level, BacktraceType type, const QString &filename, long line, const QString& func);
+
+ private:
+ VariablesListView* m_variablesListView;
+ KMdiToolViewAccessor* m_variableListViewTVA;
+ KMdiToolViewAccessor* m_previewTVA;
+
+ DebuggerBreakpointView* m_debuggerBreakpointView;
+ KMdiToolViewAccessor* m_debuggerBreakpointViewTVA;
+
+ BacktraceListview* m_backtraceListview;
+ KMdiToolViewAccessor* m_backtraceListviewTVA;
+
+ int m_debuggerMenuID;
+
+ WHTMLPart *m_preview;
+
+ public slots:
+ // Status indication
+ void slotStatus(DebuggerUI::DebuggerStatus status);
+
+};
+
+#endif
diff --git a/quanta/components/debugger/debuggervariable.cpp b/quanta/components/debugger/debuggervariable.cpp
new file mode 100644
index 00000000..b6a4f76a
--- /dev/null
+++ b/quanta/components/debugger/debuggervariable.cpp
@@ -0,0 +1,283 @@
+/***************************************************************************
+ debuggervariable.cpp
+ ------------------------
+ begin : 2004-04-04
+ copyright : (C) 2004 Thiago Silva
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "debuggervariable.h"
+#include <kdebug.h>
+#include <klocale.h>
+
+DebuggerVariable::DebuggerVariable()
+ : m_isReference(false)
+ , m_size(0)
+ , m_type(DebuggerVariableTypes::Undefined)
+ , m_item(NULL)
+{}
+
+DebuggerVariable::DebuggerVariable(const QString& name)
+ : m_isReference(false)
+ , m_size(0)
+ , m_type(DebuggerVariableTypes::Undefined)
+ , m_item(NULL)
+{
+ m_name = name;
+}
+
+DebuggerVariable::DebuggerVariable(const QString& name, const QString& value, int type)
+ : m_isReference(false)
+ , m_size(0)
+ , m_item(NULL)
+{
+ m_name = name;
+ m_value = value;
+ m_type = type;
+ if(type == DebuggerVariableTypes::String)
+ m_size = value.length();
+}
+
+DebuggerVariable::DebuggerVariable(const QString& name, const QString& value, int type, int size)
+ : m_isReference(false)
+ , m_item(NULL)
+{
+ m_name = name;
+ m_value = value;
+ m_type = type;
+ m_size = size;
+}
+
+DebuggerVariable::DebuggerVariable(const QString& name, const ValueList_t& values, int type)
+ : m_isReference(false)
+ , m_item(NULL)
+{
+ m_name = name;
+ m_valueList = values;
+ m_type = type;
+ m_size = values.count();
+}
+
+DebuggerVariable::DebuggerVariable(DebuggerVariable* v, bool copyitem )
+{
+ m_name = v->name();
+ m_size = v->size();
+ m_value = v->value();
+ m_type = v->type();
+ m_isReference = v->isReference();
+ if(copyitem)
+ {
+ m_item = v->item();
+ v->setItem(NULL);
+ }
+ else
+ m_item = NULL;
+
+ // We cant just assign m_valuelist to v->values(), it would make a shallow copy...
+ for(DebuggerVariable * v2 = v->values().first(); v2; v2 = v->values().next())
+ m_valueList.append(new DebuggerVariable(v2, copyitem));
+}
+
+
+void DebuggerVariable::setName(const QString& name)
+{
+ m_name = name;
+}
+QString DebuggerVariable::name() const
+{
+ return m_name;
+}
+void DebuggerVariable::setValue(const QString& value)
+{
+ m_value = value;
+}
+
+QString DebuggerVariable::value() const
+{
+ if(isScalar())
+ return m_value;
+ else
+ return i18n("Non scalar value");
+}
+
+bool DebuggerVariable::isScalar() const
+{
+ switch(m_type)
+ {
+ case DebuggerVariableTypes::Reference:
+ case DebuggerVariableTypes::Resource:
+ case DebuggerVariableTypes::String:
+ case DebuggerVariableTypes::Integer:
+ case DebuggerVariableTypes::Float:
+ case DebuggerVariableTypes::Boolean:
+ case DebuggerVariableTypes::Undefined:
+ case DebuggerVariableTypes::Error:
+ return true;
+ }
+ return false;
+}
+
+void DebuggerVariable::setValues(const ValueList_t& valueList)
+{
+ m_valueList = valueList;
+}
+
+ValueList_t DebuggerVariable::values() const
+{
+ return m_valueList;
+}
+
+void DebuggerVariable::setType(int type)
+{
+ m_type = type;
+}
+
+int DebuggerVariable::type() const
+{
+ return m_type;
+}
+
+const QString DebuggerVariable::typeName() const
+{
+ switch(m_type)
+ {
+ case DebuggerVariableTypes::Array:
+ return i18n("Array");
+ case DebuggerVariableTypes::Object:
+ return i18n("Object");
+ case DebuggerVariableTypes::Reference:
+ return i18n("Reference");
+ case DebuggerVariableTypes::Resource:
+ return i18n("Resource");
+ case DebuggerVariableTypes::String:
+ return i18n("String");
+ case DebuggerVariableTypes::Integer:
+ return i18n("Integer");
+ case DebuggerVariableTypes::Float:
+ return i18n("Float");
+ case DebuggerVariableTypes::Boolean:
+ return i18n("Boolean");
+ case DebuggerVariableTypes::Undefined:
+ return i18n("Undefined");
+ case DebuggerVariableTypes::Error:
+ return i18n("Error");
+ default:
+ return i18n("Unknown");
+ }
+}
+
+
+void DebuggerVariable::setSize(long size)
+{
+ m_size = size;
+}
+
+long DebuggerVariable::size() const
+{
+ return m_size;
+}
+
+QString DebuggerVariable::sizeName() const
+{
+ switch(m_type)
+ {
+ case DebuggerVariableTypes::Reference:
+ case DebuggerVariableTypes::Resource:
+ case DebuggerVariableTypes::Integer:
+ case DebuggerVariableTypes::Float:
+ case DebuggerVariableTypes::Boolean:
+ case DebuggerVariableTypes::Undefined:
+ case DebuggerVariableTypes::Error:
+ return "";
+ }
+ return QString::number(m_size);
+}
+
+void DebuggerVariable::setReference(bool ref)
+{
+ m_isReference = ref;
+}
+bool DebuggerVariable::isReference() const
+{
+ return m_isReference;
+}
+
+
+DebuggerVariable::~DebuggerVariable()
+{
+ DebuggerVariable * v;
+ while((v = m_valueList.first()))
+ {
+ m_valueList.remove(v);
+ delete v;
+ }
+ // If this variable is shown in the treeview, remove it
+ if(m_item)
+ delete m_item;
+
+}
+
+
+void DebuggerVariable::deleteChild( DebuggerVariable * child )
+{
+
+ for(DebuggerVariable *v = m_valueList.first(); v; v = m_valueList.next())
+ {
+ if(v->name() == child->name())
+ {
+ m_valueList.remove(v);
+ delete v;
+ return;
+ }
+ }
+}
+
+DebuggerVariable* DebuggerVariable::findItem( QListViewItem * item, bool traverse )
+{
+ if(item == m_item)
+ return this;
+
+ if(!traverse)
+ return NULL;
+
+ for(DebuggerVariable * v = m_valueList.first(); v; v = m_valueList.next())
+ {
+ DebuggerVariable * v2 = v->findItem(item, true);
+ if(v2)
+ return v2;
+ }
+ return NULL;
+}
+
+void DebuggerVariable::copy( DebuggerVariable * v, bool copychildren )
+{
+ m_name = v->name();
+ m_size = (v->isScalar() || copychildren ? v->size() : m_valueList.count());
+ m_value = v->value();
+ m_type = v->type();
+ m_isReference = v->isReference();
+
+ // We cant just assign m_valuelist to v->values(), it would make a shallow copy...
+//
+ if(copychildren)
+ {
+ m_valueList.clear();
+ for(DebuggerVariable * v2 = v->values().first(); v2; v2 = v->values().next())
+ m_valueList.append(new DebuggerVariable(v2, true));
+ }
+}
+
+void DebuggerVariable::append( DebuggerVariable * v )
+{
+ m_valueList.append(v);
+}
+
diff --git a/quanta/components/debugger/debuggervariable.h b/quanta/components/debugger/debuggervariable.h
new file mode 100644
index 00000000..3c83de4b
--- /dev/null
+++ b/quanta/components/debugger/debuggervariable.h
@@ -0,0 +1,103 @@
+/***************************************************************************
+ debuggervariable.h
+ ------------------------
+ begin : 2004-04-04
+ copyright : (C) 2004 Thiago Silva
+
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef DEBUGGERVARIABLE_H
+#define DEBUGGERVARIABLE_H
+
+#include <qstring.h>
+#include <qptrlist.h>
+#include <klistview.h>
+
+namespace DebuggerVariableTypes
+{
+
+ enum VarType {
+ Object,
+ Resource,
+ Reference,
+ Array,
+ String,
+ Integer,
+ Float,
+ Boolean,
+ Error,
+ Undefined
+ };
+}
+
+class DebuggerVariable;
+typedef QPtrList<DebuggerVariable> ValueList_t;
+
+class DebuggerVariable
+{
+ public:
+ DebuggerVariable();
+ DebuggerVariable(DebuggerVariable* var, bool copyitem = false);
+ DebuggerVariable(const QString& name);
+ DebuggerVariable(const QString& name, const QString& value, int type);
+ DebuggerVariable(const QString& name, const QString& value, int type, int size);
+ DebuggerVariable(const QString& name, const ValueList_t& values, int type);
+ virtual ~DebuggerVariable();
+
+ DebuggerVariable* findItem(QListViewItem *item, bool traverse = false);
+
+ virtual void setName(const QString& name);
+ virtual QString name() const;
+
+ virtual void setValue(const QString& value);
+ virtual QString value() const;
+
+ virtual void setValues(const ValueList_t& valueList);
+ virtual ValueList_t values() const;
+
+ virtual void setType(int type);
+ virtual int type() const;
+ virtual const QString typeName() const ;
+ virtual bool isScalar() const;
+
+ virtual void setSize(long size);
+ virtual long size() const;
+ virtual QString sizeName() const;
+
+ virtual void setReference(bool ref);
+ virtual bool isReference() const;
+
+ virtual void touch() { m_touched = true;};
+ virtual bool touched() const { return m_touched;};
+
+ virtual void setItem(KListViewItem* item) { m_item = item;};
+ virtual KListViewItem* item() const{ return m_item;};
+
+ virtual void copy(DebuggerVariable* v, bool copychldren = true);
+ virtual void append(DebuggerVariable* v);
+ virtual void deleteChild(DebuggerVariable *child);
+
+
+ private:
+ ValueList_t m_valueList;
+
+ QString m_name;
+ QString m_value;
+ bool m_isReference;
+ long m_size;
+ int m_type;
+ long m_touched;
+
+ KListViewItem* m_item;
+};
+#endif
diff --git a/quanta/components/debugger/debuggervariablesets.ui b/quanta/components/debugger/debuggervariablesets.ui
new file mode 100644
index 00000000..70440ff4
--- /dev/null
+++ b/quanta/components/debugger/debuggervariablesets.ui
@@ -0,0 +1,185 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>DebuggerVariableSetS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>DebuggerVariableSetS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>414</width>
+ <height>129</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Set Value of Variable</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>lineVariable</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblVariable</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Variable:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblValue</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>New value:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>lineValue</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>DebuggerVariableSetS</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>DebuggerVariableSetS</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>lineVariable</tabstop>
+ <tabstop>lineValue</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/quanta/components/debugger/gubed/Makefile.am b/quanta/components/debugger/gubed/Makefile.am
new file mode 100644
index 00000000..755a7409
--- /dev/null
+++ b/quanta/components/debugger/gubed/Makefile.am
@@ -0,0 +1,18 @@
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = quantadebuggergubed.la
+
+quantadebuggergubed_la_SOURCES = gubedsettingss.ui quantadebuggergubed.cpp gubedsettings.cpp
+quantadebuggergubed_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+quantadebuggergubed_la_LIBADD = ../interfaces/libdebuggerinterface.la $(LIB_KPARTS)
+kde_services_DATA = quantadebuggergubed.desktop
+
+INCLUDES = -I$(top_srcdir)/quanta/components/debugger \
+ -I$(top_srcdir)/quanta/components/debugger/interfaces \
+ -I$(top_srcdir)/quanta/components/debugger/gubed \
+ -I$(top_srcdir)/quanta/project \
+ -I$(top_srcdir)/quanta/utility \
+ $(all_includes)
+
+
+noinst_HEADERS = gubedsettings.h
diff --git a/quanta/components/debugger/gubed/gubedsettings.cpp b/quanta/components/debugger/gubed/gubedsettings.cpp
new file mode 100644
index 00000000..f728d884
--- /dev/null
+++ b/quanta/components/debugger/gubed/gubedsettings.cpp
@@ -0,0 +1,41 @@
+/***************************************************************************
+ gubedsettings.cpp
+ -------------------
+ begin : 2004-04-05
+ copyright : (C) 2004 Linus McCabe <linus@mccabe.nu>
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#include "qlineedit.h"
+#include "gubedsettings.h"
+#include <ktextbrowser.h>
+
+GubedSettings::GubedSettings(const QString &protocolversion)
+ : GubedSettingsS(0, "GubedSettings", false, 0)
+{
+ textAbout->setText(textAbout->text().replace("%PROTOCOLVERSION%", protocolversion));
+}
+
+GubedSettings::~GubedSettings()
+{
+}
+
+void GubedSettings::slotUseProxyToggle( bool useproxy)
+{
+ lineServerHost->setEnabled(useproxy);
+ lineServerPort->setEnabled(useproxy);
+ lineServerListenPort->setEnabled(!useproxy);
+}
+
+
+#include "gubedsettings.moc"
+
diff --git a/quanta/components/debugger/gubed/gubedsettings.h b/quanta/components/debugger/gubed/gubedsettings.h
new file mode 100644
index 00000000..dc070f32
--- /dev/null
+++ b/quanta/components/debugger/gubed/gubedsettings.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+ gubedsettings.h
+ -------------------
+ begin : 2004-04-05
+ copyright : (C) 2004 Linus McCabe <linus@mccabe.nu>
+ ***************************************************************************/
+
+/****************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef GUBEDSETTINGS_H
+#define GUBEDSETTINGS_H
+
+#include "gubedsettingss.h"
+
+class GubedSettings : public GubedSettingsS
+{
+ Q_OBJECT
+
+ public slots:
+ virtual void slotUseProxyToggle( bool useproxy);
+
+ public:
+ GubedSettings(const QString &protocolversion);
+ ~GubedSettings();
+
+};
+
+#endif
+
diff --git a/quanta/components/debugger/gubed/gubedsettingss.ui b/quanta/components/debugger/gubed/gubedsettingss.ui
new file mode 100644
index 00000000..12125c93
--- /dev/null
+++ b/quanta/components/debugger/gubed/gubedsettingss.ui
@@ -0,0 +1,762 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>GubedSettingsS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>GubedSettingsS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>659</width>
+ <height>527</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Gubed Settings</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Ca&amp;ncel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>tabWidget2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;General</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Directory Mapping</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblDebuggerServerBasedir</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Server basedir:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblDebuggerLocalBasedir</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Local basedir:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>lineServerBasedir</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>lineLocalBasedir</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Connection Settings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>lineServerListenPort</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>lineServerPort</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>lineServerHost</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>checkUseProxy</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblDebuggerUseProxe</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Use proxy</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblDebuggerServerHost</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Proxy host:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>lblDebuggerServerPort</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Proxy port:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>lblDebuggerServerListenPort</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Listen port:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Mode</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>lineStartSession</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>See "What's This?" for available variables</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>%afn - Filename of the current script
+%afd - Absolute directory of the current script
+%afp - Absolute path (directory + filename) of the current script
+
+%rfpd - Directory of the current script relative to project root
+%rfpp - Path of the current script relative to project root
+
+%rfdd - Directory of the current script relative to document root
+%rfdp - Path of the current script relative to document root
+
+%apd - Project root
+%add - Document root of current script</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>optAddInclude</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Add include</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>optStartSession</cstring>
+ </property>
+ <property name="text">
+ <string>Start session:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Deb&amp;ug Behavior</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>Error Handling</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="4" column="1">
+ <property name="name">
+ <cstring>checkBreakOnUserError</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>User errors</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="5" colspan="1">
+ <property name="name">
+ <cstring>lblBreakOn</cstring>
+ </property>
+ <property name="text">
+ <string>Break on:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="1">
+ <property name="name">
+ <cstring>checkBreakOnUserWarning</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>User warnings</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="1">
+ <property name="name">
+ <cstring>checkBreakOnUserNotice</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>User notices</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>checkBreakOnNotice</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Notices</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>checkBreakOnWarning</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>W&amp;arnings</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer4_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>50</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>groupBox5</cstring>
+ </property>
+ <property name="title">
+ <string>Execution</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>lblDelayFast</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Fast</string>
+ </property>
+ </widget>
+ <widget class="QSlider" row="1" column="2">
+ <property name="name">
+ <cstring>sliderDisplayDelay</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>27</height>
+ </size>
+ </property>
+ <property name="maxValue">
+ <number>200</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="tickmarks">
+ <enum>Below</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="3">
+ <property name="name">
+ <cstring>lblDelaySlow</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Slow</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1" rowspan="1" colspan="3">
+ <item>
+ <property name="text">
+ <string>Pause</string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image0</pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Trace</string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image1</pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image2</pixmap>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>comboDefaultExecutionState</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblDefaultExecutionMode</cstring>
+ </property>
+ <property name="text">
+ <string>Default mode:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblDisplayDelay</cstring>
+ </property>
+ <property name="text">
+ <string>Run speed:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>A&amp;bout</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;h4&gt;Gubed PHP Debugger Plugin for Quanta +&lt;/h4&gt;</string>
+ </property>
+ </widget>