diff options
Diffstat (limited to 'kspread/plugins/scripting')
-rw-r--r-- | kspread/plugins/scripting/kspreadcore/krs_cell.cpp | 72 | ||||
-rw-r--r-- | kspread/plugins/scripting/kspreadcore/krs_cell.h | 36 | ||||
-rw-r--r-- | kspread/plugins/scripting/kspreadcore/krs_doc.cpp | 30 | ||||
-rw-r--r-- | kspread/plugins/scripting/kspreadcore/krs_doc.h | 32 | ||||
-rw-r--r-- | kspread/plugins/scripting/kspreadcore/krs_sheet.cpp | 14 | ||||
-rw-r--r-- | kspread/plugins/scripting/kspreadcore/krs_sheet.h | 6 | ||||
-rw-r--r-- | kspread/plugins/scripting/kspreadcore/kspreadcoremodule.cpp | 8 | ||||
-rw-r--r-- | kspread/plugins/scripting/kspreadcore/kspreadcoremodule.h | 8 | ||||
-rw-r--r-- | kspread/plugins/scripting/scripting.cc | 26 | ||||
-rw-r--r-- | kspread/plugins/scripting/scripting.h | 3 | ||||
-rwxr-xr-x | kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py | 10 | ||||
-rwxr-xr-x | kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py | 188 |
12 files changed, 217 insertions, 216 deletions
diff --git a/kspread/plugins/scripting/kspreadcore/krs_cell.cpp b/kspread/plugins/scripting/kspreadcore/krs_cell.cpp index cabf0c50..46ee1389 100644 --- a/kspread/plugins/scripting/kspreadcore/krs_cell.cpp +++ b/kspread/plugins/scripting/kspreadcore/krs_cell.cpp @@ -59,30 +59,30 @@ Cell::Cell(KSpread::Cell* cell, KSpread::Sheet* sheet, uint col, uint row) Cell::~Cell() { } -const QString Cell::getClassName() const { +const TQString Cell::getClassName() const { return "Kross::KSpreadCore::KSpreadCell"; } -QVariant Cell::toVariant(const KSpread::Value& value) const +TQVariant Cell::toVariant(const KSpread::Value& value) const { //Should we use following value-format enums here? //fmt_None, fmt_Boolean, fmt_Number, fmt_Percent, fmt_Money, fmt_DateTime, fmt_Date, fmt_Time, fmt_String switch(value.type()) { case KSpread::Value::Empty: - return QVariant(); + return TQVariant(); case KSpread::Value::Boolean: - return QVariant( value.asBoolean() ); + return TQVariant( value.asBoolean() ); case KSpread::Value::Integer: - return static_cast<Q_LLONG>(value.asInteger()); + return static_cast<TQ_LLONG>(value.asInteger()); case KSpread::Value::Float: return (float)value.asFloat(); case KSpread::Value::String: return value.asString(); case KSpread::Value::Array: { - QValueList<QVariant> colarray; + TQValueList<TQVariant> colarray; for(uint j = 0; j < value.rows(); j++) { - QValueList<QVariant> rowarray; + TQValueList<TQVariant> rowarray; for( uint i = 0; i < value.columns(); i++) { KSpread::Value v = value.element(i,j); rowarray.append( toVariant(v) ); @@ -93,28 +93,28 @@ QVariant Cell::toVariant(const KSpread::Value& value) const } break; case KSpread::Value::CellRange: //FIXME: not yet used - return QVariant(); + return TQVariant(); case KSpread::Value::Error: - return QVariant(); + return TQVariant(); } - return QVariant(); + return TQVariant(); } -QVariant Cell::value() const { +TQVariant Cell::value() const { return toVariant( m_cell->value() ); } -bool Cell::setValue(const QVariant& value) { +bool Cell::setValue(const TQVariant& value) { KSpread::Value v = m_cell->value(); switch(value.type()) { - case QVariant::Bool: v.setValue( value.toBool() ); break; - case QVariant::ULongLong: v.setValue( (long)value.toLongLong() ); break; - case QVariant::Int: v.setValue( value.toInt() ); break; - case QVariant::Double: v.setValue( value.toDouble() ); break; - case QVariant::String: v.setValue( value.toString() ); break; - case QVariant::Date: v.setValue( value.toDate() ); break; - case QVariant::Time: v.setValue( value.toTime() ); break; - case QVariant::DateTime: v.setValue( value.toDateTime() ); break; + case TQVariant::Bool: v.setValue( value.toBool() ); break; + case TQVariant::ULongLong: v.setValue( (long)value.toLongLong() ); break; + case TQVariant::Int: v.setValue( value.toInt() ); break; + case TQVariant::Double: v.setValue( value.toDouble() ); break; + case TQVariant::String: v.setValue( value.toString() ); break; + case TQVariant::Date: v.setValue( value.toDate() ); break; + case TQVariant::Time: v.setValue( value.toTime() ); break; + case TQVariant::DateTime: v.setValue( value.toDateTime() ); break; default: return false; } return true; @@ -146,38 +146,38 @@ void Cell::setNextCell(Cell* c) { return m_cell->setNextCell(c->m_cell); } -const QString Cell::name() const { +const TQString Cell::name() const { return m_cell->name(); } -const QString Cell::fullName() const { +const TQString Cell::fullName() const { return m_cell->fullName(); } -const QString Cell::comment() const { +const TQString Cell::comment() const { return m_cell->format()->comment(m_col, m_row); } -void Cell::setComment(const QString& c) { +void Cell::setComment(const TQString& c) { return m_cell->format()->setComment(c); } -const QString Cell::getFormatString() const { +const TQString Cell::getFormatString() const { return m_cell->format()->getFormatString(m_col, m_row); } -void Cell::setFormatString(const QString& format) { +void Cell::setFormatString(const TQString& format) { m_cell->format()->setFormatString(format); } -const QString Cell::text() const { +const TQString Cell::text() const { return m_cell->text(); } -bool Cell::setText(const QString& text) { +bool Cell::setText(const TQString& text) { KSpread::ProtectedCheck prot; prot.setSheet (m_sheet); - prot.add (QPoint (m_col, m_row)); + prot.add (TQPoint (m_col, m_row)); if (prot.check()) return false; @@ -185,26 +185,26 @@ bool Cell::setText(const QString& text) { dm->setSheet (m_sheet); dm->setValue (text); dm->setParsing (true); - dm->add (QPoint (m_col, m_row)); + dm->add (TQPoint (m_col, m_row)); dm->execute (); return true; } -const QString Cell::textColor() { +const TQString Cell::textColor() { return m_cell->format()->textColor(m_col, m_row).name(); } -void Cell::setTextColor(const QString& textcolor) { - m_cell->format()->setTextColor( QColor(textcolor) ); +void Cell::setTextColor(const TQString& textcolor) { + m_cell->format()->setTextColor( TQColor(textcolor) ); } -const QString Cell::backgroundColor() { +const TQString Cell::backgroundColor() { return m_cell->format()->bgColor(m_col, m_row).name(); } -void Cell::setBackgroundColor(const QString& backgroundcolor) { - m_cell->format()->setBgColor( QColor(backgroundcolor) ); +void Cell::setBackgroundColor(const TQString& backgroundcolor) { + m_cell->format()->setBgColor( TQColor(backgroundcolor) ); } } diff --git a/kspread/plugins/scripting/kspreadcore/krs_cell.h b/kspread/plugins/scripting/kspreadcore/krs_cell.h index 5f3f221d..c69b831d 100644 --- a/kspread/plugins/scripting/kspreadcore/krs_cell.h +++ b/kspread/plugins/scripting/kspreadcore/krs_cell.h @@ -26,8 +26,8 @@ #include <api/class.h> -#include <qstring.h> -#include <qcolor.h> +#include <tqstring.h> +#include <tqcolor.h> namespace Kross { namespace KSpreadCore { @@ -52,17 +52,17 @@ class Cell : public Kross::Api::Class<Cell> public: Cell(KSpread::Cell* cell, KSpread::Sheet* sheet, uint col, uint row); virtual ~Cell(); - virtual const QString getClassName() const; + virtual const TQString getClassName() const; private: /** * Return the value of the cell. */ - QVariant value() const; + TQVariant value() const; /** * Set the value the cell has. */ - bool setValue(const QVariant& value); + bool setValue(const TQVariant& value); /** * Return the column number. @@ -94,21 +94,21 @@ class Cell : public Kross::Api::Class<Cell> * Returns the name of the cell. For example, the cell in first column * and first row is "A1". */ - const QString name() const; + const TQString name() const; /** * Returns the full name of the cell, i.e. including the worksheet name. * Example: "Sheet1!A1" */ - const QString fullName() const; + const TQString fullName() const; /** * Returns the comment for the cell. */ - const QString comment() const; + const TQString comment() const; /** * Set the comment for the cell. */ - void setComment(const QString& c); + void setComment(const TQString& c); #if 0 bool isFormula() const; @@ -118,50 +118,50 @@ class Cell : public Kross::Api::Class<Cell> /** * Returns the format of the cell, e.g. #.##0.00, dd/mmm/yyyy,... */ - const QString getFormatString() const; + const TQString getFormatString() const; /** * Sets the format of the cell, e.g. #.##0.00, dd/mmm/yyyy,... */ - void setFormatString(const QString& format); + void setFormatString(const TQString& format); /** * Return the text of the cell (the formula if there is one, * the value otherwise). This could be a value (e.g. "14.03") * or a formula (e.g. "=SUM(A1:A10)") */ - const QString text() const; + const TQString text() const; /** * Set the text of the cell. the text * will be handled as string */ - bool setText(const QString& text); + bool setText(const TQString& text); /** * Return the textcolor as RGB-value in the format "#RRGGBB". */ - const QString textColor(); + const TQString textColor(); /** * Set the textcolor to the RGB-value in the format "#RRGGBB" * where each of R, G, and B is a single hex digit. */ - void setTextColor(const QString& textcolor); + void setTextColor(const TQString& textcolor); /** * Return the backgroundcolor as RGB-value in the format "#RRGGBB". */ - const QString backgroundColor(); + const TQString backgroundColor(); /** * Set the backgroundcolor to the RGB-value in the format "#RRGGBB" * where each of R, G, and B is a single hex digit. */ - void setBackgroundColor(const QString& backgroundcolor); + void setBackgroundColor(const TQString& backgroundcolor); private: KSpread::Cell* m_cell; KSpread::Sheet* m_sheet; uint m_col, m_row; - QVariant toVariant(const KSpread::Value& value) const; + TQVariant toVariant(const KSpread::Value& value) const; }; } } diff --git a/kspread/plugins/scripting/kspreadcore/krs_doc.cpp b/kspread/plugins/scripting/kspreadcore/krs_doc.cpp index 37c87efd..0372d83f 100644 --- a/kspread/plugins/scripting/kspreadcore/krs_doc.cpp +++ b/kspread/plugins/scripting/kspreadcore/krs_doc.cpp @@ -49,7 +49,7 @@ Doc::~Doc() { } -const QString Doc::getClassName() const { +const TQString Doc::getClassName() const { return "Kross::KSpreadCore::Doc"; } @@ -58,25 +58,25 @@ Sheet* Doc::currentSheet() return new Sheet(m_doc->displaySheet(), m_doc); } -Sheet* Doc::sheetByName(const QString& name) +Sheet* Doc::sheetByName(const TQString& name) { - QPtrListIterator<KSpread::Sheet> it (m_doc->map()->sheetList()); + TQPtrListIterator<KSpread::Sheet> it (m_doc->map()->sheetList()); for( ; it.current(); ++it ) if(it.current()->sheetName() == name) return new Sheet(it.current(), m_doc); return 0; } -QStringList Doc::sheetNames() +TQStringList Doc::sheetNames() { - QStringList names; - QPtrListIterator<KSpread::Sheet> it (m_doc->map()->sheetList()); + TQStringList names; + TQPtrListIterator<KSpread::Sheet> it (m_doc->map()->sheetList()); for( ; it.current(); ++it ) names.append( it.current()->sheetName() ); return names; } -bool Doc::addSheet(const QString& sheetname) +bool Doc::addSheet(const TQString& sheetname) { KSpread::Sheet* sheet = m_doc->map()->createSheet(); if(sheet) { @@ -90,7 +90,7 @@ bool Doc::addSheet(const QString& sheetname) return false; } -bool Doc::removeSheet(const QString& sheetname) +bool Doc::removeSheet(const TQString& sheetname) { KSpread::Sheet* sheet = m_doc->map()->findSheet(sheetname); if(sheet) { @@ -100,33 +100,33 @@ bool Doc::removeSheet(const QString& sheetname) return false; } -bool Doc::loadNativeXML(const QString& xml) { - QDomDocument doc; +bool Doc::loadNativeXML(const TQString& xml) { + TQDomDocument doc; if(! doc.setContent(xml, true)) return false; return m_doc->loadXML(0, doc); } -QString Doc::saveNativeXML() { +TQString Doc::saveNativeXML() { return m_doc->saveXML().toString(2); } -bool Doc::openUrl(const QString& url) +bool Doc::openUrl(const TQString& url) { return m_doc->openURL(url); } -bool Doc::saveUrl(const QString& url) +bool Doc::saveUrl(const TQString& url) { return m_doc->saveAs(url); } -bool Doc::import(const QString& url) +bool Doc::import(const TQString& url) { return m_doc->import(url); } -bool Doc::exp0rt(const QString& url) +bool Doc::exp0rt(const TQString& url) { return m_doc->exp0rt(url); } diff --git a/kspread/plugins/scripting/kspreadcore/krs_doc.h b/kspread/plugins/scripting/kspreadcore/krs_doc.h index 28c69845..dd3df4d6 100644 --- a/kspread/plugins/scripting/kspreadcore/krs_doc.h +++ b/kspread/plugins/scripting/kspreadcore/krs_doc.h @@ -24,9 +24,9 @@ #include <api/class.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qdom.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqdom.h> namespace Kross { namespace KSpreadCore { @@ -45,7 +45,7 @@ class Doc : public Kross::Api::Class<Doc> public: explicit Doc(KSpread::Doc* doc); virtual ~Doc(); - virtual const QString getClassName() const; + virtual const TQString getClassName() const; private: /** @@ -69,7 +69,7 @@ class Doc : public Kross::Api::Class<Doc> * sheet = doc.sheetByName("foosheet") * @endcode */ - Sheet* sheetByName(const QString& name); + Sheet* sheetByName(const TQString& name); /** * This function returns an array with the sheet names @@ -81,36 +81,36 @@ class Doc : public Kross::Api::Class<Doc> * sheet = doc.sheetByName( sheetnames[0] ) * @endcode */ - QStringList sheetNames(); + TQStringList sheetNames(); /** * Add a new sheet named @p sheetname to the document. */ - bool addSheet(const QString& sheetname); + bool addSheet(const TQString& sheetname); /** * Remove the sheet named @p sheetname from the document. */ - bool removeSheet(const QString& sheetname); + bool removeSheet(const TQString& sheetname); /** * Loads the native XML document. */ - bool loadNativeXML(const QString& xml); + bool loadNativeXML(const TQString& xml); /** * Save and return the to a native document saved XML. */ - QString saveNativeXML(); + TQString saveNativeXML(); #if 0 - bool loadOpenDocXML(const QString& xml); - QString saveOpenDocXML(); + bool loadOpenDocXML(const TQString& xml); + TQString saveOpenDocXML(); #endif - bool openUrl(const QString& url); - bool saveUrl(const QString& url); - bool import(const QString& url); - bool exp0rt(const QString& url); + bool openUrl(const TQString& url); + bool saveUrl(const TQString& url); + bool import(const TQString& url); + bool exp0rt(const TQString& url); private: KSpread::Doc* m_doc; diff --git a/kspread/plugins/scripting/kspreadcore/krs_sheet.cpp b/kspread/plugins/scripting/kspreadcore/krs_sheet.cpp index 694037ed..790c2131 100644 --- a/kspread/plugins/scripting/kspreadcore/krs_sheet.cpp +++ b/kspread/plugins/scripting/kspreadcore/krs_sheet.cpp @@ -50,16 +50,16 @@ Sheet::Sheet(KSpread::Sheet* sheet, KSpread::Doc *doc) : Kross::Api::Class<Sheet Sheet::~Sheet() { } -const QString Sheet::getClassName() const { +const TQString Sheet::getClassName() const { return "Kross::KSpreadCore::Sheet"; } -const QString Sheet::name() const +const TQString Sheet::name() const { return m_sheet->sheetName(); } -void Sheet::setName(const QString& name) +void Sheet::setName(const TQString& name) { m_sheet->setSheetName(name); } @@ -78,8 +78,8 @@ Cell* Sheet::firstCell() const { } Cell* Sheet::cell(uint col, uint row) { - uint c = QMAX(uint(1), col); - uint r = QMAX(uint(1), row); + uint c = TQMAX(uint(1), col); + uint r = TQMAX(uint(1), row); return new Cell(m_sheet->cellAt(c,r),m_sheet,c,r); } @@ -92,11 +92,11 @@ bool Sheet::insertColumn(uint col) { } void Sheet::removeRow(uint row) { - m_sheet->removeRow( QMAX(uint(1), row) ); + m_sheet->removeRow( TQMAX(uint(1), row) ); } void Sheet::removeColumn(uint col) { - m_sheet->removeColumn( QMAX(uint(1), col) ); + m_sheet->removeColumn( TQMAX(uint(1), col) ); } } diff --git a/kspread/plugins/scripting/kspreadcore/krs_sheet.h b/kspread/plugins/scripting/kspreadcore/krs_sheet.h index a96e758e..bd83b6a8 100644 --- a/kspread/plugins/scripting/kspreadcore/krs_sheet.h +++ b/kspread/plugins/scripting/kspreadcore/krs_sheet.h @@ -52,17 +52,17 @@ class Sheet : public Kross::Api::Class<Sheet> public: Sheet(KSpread::Sheet* sheet, KSpread::Doc* doc = 0); virtual ~Sheet(); - virtual const QString getClassName() const; + virtual const TQString getClassName() const; private: /** * Return the name of the sheet. */ - const QString name() const; + const TQString name() const; /** * Set the name of the sheet. */ - void setName(const QString& name); + void setName(const TQString& name); /** * Return the currently maximum defined number of columns. diff --git a/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.cpp b/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.cpp index acfd0b2b..108516dc 100644 --- a/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.cpp +++ b/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.cpp @@ -45,9 +45,9 @@ using namespace Kross::KSpreadCore; KSpreadCoreModule::KSpreadCoreModule(Kross::Api::Manager* manager) : Kross::Api::Module("kspreadcore") , m_manager(manager) { - QMap<QString, Object::Ptr> children = manager->getChildren(); - kdDebug() << " there are " << children.size() << endl; - for(QMap<QString, Object::Ptr>::const_iterator it = children.begin(); it != children.end(); it++) + TQMap<TQString, Object::Ptr> tqchildren = manager->getChildren(); + kdDebug() << " there are " << tqchildren.size() << endl; + for(TQMap<TQString, Object::Ptr>::const_iterator it = tqchildren.begin(); it != tqchildren.end(); it++) { kdDebug() << it.key() << " " << it.data() << endl; } @@ -76,7 +76,7 @@ KSpreadCoreModule::~KSpreadCoreModule() } -const QString KSpreadCoreModule::getClassName() const +const TQString KSpreadCoreModule::getClassName() const { return "Kross::KSpreadCore::KSpreadCoreModule"; } diff --git a/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.h b/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.h index ffc998cc..03bde5fc 100644 --- a/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.h +++ b/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.h @@ -20,8 +20,8 @@ #ifndef KSPREAD_KROSS_KSPREADCOREMODULE_H #define KSPREAD_KROSS_KSPREADCOREMODULE_H -#include <qstring.h> -#include <qvariant.h> +#include <tqstring.h> +#include <tqvariant.h> #define KROSS_MAIN_EXPORT KDE_EXPORT @@ -51,8 +51,8 @@ namespace Kross { namespace KSpreadCore { public: KSpreadCoreModule(Kross::Api::Manager* manager); virtual ~KSpreadCoreModule(); - virtual const QString getClassName() const; - //virtual Kross::Api::Object::Ptr call(const QString& name, Kross::Api::List::Ptr arguments); + virtual const TQString getClassName() const; + //virtual Kross::Api::Object::Ptr call(const TQString& name, Kross::Api::List::Ptr arguments); private: #if 0 diff --git a/kspread/plugins/scripting/scripting.cc b/kspread/plugins/scripting/scripting.cc index 96cd1baf..e4299e26 100644 --- a/kspread/plugins/scripting/scripting.cc +++ b/kspread/plugins/scripting/scripting.cc @@ -20,7 +20,7 @@ */ #include "scripting.h" -#include <qapplication.h> +#include <tqapplication.h> #include <kdebug.h> #include <kgenericfactory.h> @@ -37,37 +37,37 @@ typedef KGenericFactory<Scripting> KSpreadScriptingFactory; K_EXPORT_COMPONENT_FACTORY( kspreadscripting, KSpreadScriptingFactory( "kspreadscripting" ) ) -Scripting::Scripting(QObject *parent, const char *name, const QStringList &) - : KParts::Plugin(parent, name) +Scripting::Scripting(TQObject *tqparent, const char *name, const TQStringList &) + : KParts::Plugin(tqparent, name) { setInstance(KSpreadScriptingFactory::instance()); kdDebug() << "Scripting plugin. Class: " - << metaObject()->className() + << tqmetaObject()->className() << ", Parent: " - << parent->metaObject()->className() + << tqparent->tqmetaObject()->className() << "\n"; - if ( parent->inherits("KSpread::View") ) + if ( tqparent->inherits("KSpread::View") ) { setInstance(Scripting::instance()); - m_view = (KSpread::View*) parent; + m_view = (KSpread::View*) tqparent; m_scriptguiclient = new Kross::Api::ScriptGUIClient( m_view, m_view ); // m_scriptguiclient ->setXMLFile(locate("data","kspreadplugins/scripting.rc"), true); kdDebug() << "Setup actions for scripting !" << endl; setXMLFile(locate("data","kspread/kpartplugins/scripting.rc"), true); - new KAction(i18n("Execute Script File..."), 0, 0, m_scriptguiclient, SLOT(executeScriptFile()), actionCollection(), "executescriptfile"); - new KAction(i18n("Script Manager..."), 0, 0, m_scriptguiclient, SLOT(showScriptManager()), actionCollection(), "configurescripts"); + new KAction(i18n("Execute Script File..."), 0, 0, m_scriptguiclient, TQT_SLOT(executeScriptFile()), actionCollection(), "executescriptfile"); + new KAction(i18n("Script Manager..."), 0, 0, m_scriptguiclient, TQT_SLOT(showScriptManager()), actionCollection(), "configurescripts"); KAction* scriptmenuaction = m_scriptguiclient->action("installedscripts"); actionCollection()->insert(scriptmenuaction); - connect(m_scriptguiclient, SIGNAL(executionFinished( const Kross::Api::ScriptAction* )), this, SLOT(executionFinished(const Kross::Api::ScriptAction*))); + connect(m_scriptguiclient, TQT_SIGNAL(executionFinished( const Kross::Api::ScriptAction* )), this, TQT_SLOT(executionFinished(const Kross::Api::ScriptAction*))); - Kross::Api::Manager::scriptManager()->addQObject(m_view->doc(), "KSpreadDocument"); - Kross::Api::Manager::scriptManager()->addQObject(m_view, "KSpreadView"); + Kross::Api::Manager::scriptManager()->addTQObject(m_view->doc(), "KSpreadDocument"); + Kross::Api::Manager::scriptManager()->addTQObject(TQT_TQOBJECT(m_view), "KSpreadView"); } } @@ -78,7 +78,7 @@ Scripting::~Scripting() void Scripting::executionFinished(const Kross::Api::ScriptAction*) { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } #include "scripting.moc" diff --git a/kspread/plugins/scripting/scripting.h b/kspread/plugins/scripting/scripting.h index 1d08bd9f..b8bd3a55 100644 --- a/kspread/plugins/scripting/scripting.h +++ b/kspread/plugins/scripting/scripting.h @@ -35,8 +35,9 @@ namespace Kross { class Scripting : public KParts::Plugin { Q_OBJECT + TQ_OBJECT public: - Scripting(QObject *parent, const char *name, const QStringList &); + Scripting(TQObject *tqparent, const char *name, const TQStringList &); virtual ~Scripting(); private slots: void executionFinished(const Kross::Api::ScriptAction*); diff --git a/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py b/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py index 2e2dfc31..d4ab99ed 100755 --- a/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py +++ b/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py @@ -21,20 +21,20 @@ except (ImportError): raise "Failed to import the required PyQt python module." class Dialog(qt.QDialog): - def __init__(self, scriptpath, parent): + def __init__(self, scriptpath, tqparent): self.scriptpath = scriptpath import krosskspreadcore self.doc = krosskspreadcore.get("KSpreadDocument") import qt - qt.QDialog.__init__(self, parent, "Dialog", 1, qt.Qt.WDestructiveClose) + qt.QDialog.__init__(self, tqparent, "Dialog", 1, qt.Qt.WDestructiveClose) self.setCaption("Export to HTML File") - layout = qt.QVBoxLayout(self) + tqlayout = qt.QVBoxLayout(self) box = qt.QVBox(self) box.setMargin(10) box.setSpacing(10) - layout.addWidget(box) + tqlayout.addWidget(box) sheetbox = qt.QHBox(box) sheetbox.setSpacing(6) @@ -173,7 +173,7 @@ if __name__ == "__main__": qtapp = qt.QApplication(sys.argv) else: scriptpath = os.path.dirname(__name__) - qtapp = qt.qApp + qtapp = qt.tqApp dialog = Dialog(scriptpath, qtapp.mainWidget()) dialog.exec_loop() diff --git a/kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py b/kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py index f015a5f1..cedc82cc 100755 --- a/kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py +++ b/kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py @@ -22,10 +22,10 @@ except (ImportError): # Samples. class Widget(qt.QHBox): - def __init__(self, parentwidget, label = None): - self.parentwidget = parentwidget + def __init__(self, tqparentwidget, label = None): + self.tqparentwidget = tqparentwidget import qt - qt.QHBox.__init__(self, parentwidget) + qt.QHBox.__init__(self, tqparentwidget) self.setMargin(4) self.setSpacing(4) if label != None: qt.QLabel(label, self) @@ -33,10 +33,10 @@ class Widget(qt.QHBox): return None class ListWidget(Widget): - def __init__(self, parentwidget, label): + def __init__(self, tqparentwidget, label): import qt global Widget - Widget.__init__(self, parentwidget, label) + Widget.__init__(self, tqparentwidget, label) self.combo = qt.QComboBox(self) self.combo.setEditable(True) self.setStretchFactor(self.combo,1) @@ -44,22 +44,22 @@ class ListWidget(Widget): return self.combo.currentText() class EditWidget(Widget): - def __init__(self, parentwidget, label): + def __init__(self, tqparentwidget, label): import qt global Widget - Widget.__init__(self, parentwidget, label) + Widget.__init__(self, tqparentwidget, label) self.edit = qt.QLineEdit(self) self.setStretchFactor(self.edit,1) def value(self): return self.edit.text() class FileWidget(Widget): - def __init__(self, parentwidget, label, filtermask, openfiledialog = True): - self.filtermask = filtermask + def __init__(self, tqparentwidget, label, filtertqmask, openfiledialog = True): + self.filtertqmask = filtertqmask self.openfiledialog = openfiledialog import qt global Widget - Widget.__init__(self, parentwidget, label) + Widget.__init__(self, tqparentwidget, label) self.edit = qt.QLineEdit(self) self.setStretchFactor(self.edit,1) btn = qt.QPushButton("...",self) @@ -68,9 +68,9 @@ class FileWidget(Widget): import qt text = str( self.edit.text() ) if self.openfiledialog: - filename = str( qt.QFileDialog.getOpenFileName(text, self.filtermask, self.parentwidget) ) + filename = str( qt.QFileDialog.getOpenFileName(text, self.filtertqmask, self.tqparentwidget) ) else: - filename = qt.QFileDialog.getSaveFileName(text, self.filtermask, self.parentwidget) + filename = qt.QFileDialog.getSaveFileName(text, self.filtertqmask, self.tqparentwidget) if filename != "": self.edit.setText( filename ) def value(self): return self.edit.text() @@ -81,33 +81,33 @@ class Samples: # KexiDB class KexiDB: - def __init__(self, parentwidget): - self.parentwidget = parentwidget + def __init__(self, tqparentwidget): + self.tqparentwidget = tqparentwidget class _ProjectWidget(FileWidget): - def __init__(self, parentwidget): + def __init__(self, tqparentwidget): global FileWidget - FileWidget.__init__(self, parentwidget, "Project File:", "*.kexi *.kexis *.kexic;;*") + FileWidget.__init__(self, tqparentwidget, "Project File:", "*.kexi *.kexis *.kexic;;*") class _DriverWidget(ListWidget): - def __init__(self, parentwidget): + def __init__(self, tqparentwidget): global ListWidget - ListWidget.__init__(self, parentwidget, "Driver:") + ListWidget.__init__(self, tqparentwidget, "Driver:") import krosskexidb for driver in krosskexidb.DriverManager().driverNames(): self.combo.insertItem(driver) class _TableWidget(ListWidget): - def __init__(self, parentwidget): + def __init__(self, tqparentwidget): global ListWidget - ListWidget.__init__(self, parentwidget, "Table:") + ListWidget.__init__(self, tqparentwidget, "Table:") class PrintDriverDetails: """ Print a the list of available KexiDB drivers and print details about one of them. """ name = "Details about a driver" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { - "DriverName" : Samples.KexiDB._DriverWidget( parent.parentwidget ), + "DriverName" : Samples.KexiDB._DriverWidget( tqparent.tqparentwidget ), } def getCode(self): return ( @@ -125,9 +125,9 @@ class Samples: class ConnectWithFile: """ Connect with a KexiDB database by using a Kexi Connection Project File. """ name = "Connect with file" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { - "ProjectFile" : Samples.KexiDB._ProjectWidget( parent.parentwidget ), + "ProjectFile" : Samples.KexiDB._ProjectWidget( tqparent.tqparentwidget ), } def getCode(self): return ( @@ -164,10 +164,10 @@ class Samples: class IterateThroughTable: """ Iterate through a table within a connected KexiDB database. """ name = "Iterate through table" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { - "ProjectFile" : Samples.KexiDB._ProjectWidget( parent.parentwidget ), - "TableName" : Samples.KexiDB._TableWidget( parent.parentwidget ), + "ProjectFile" : Samples.KexiDB._ProjectWidget( tqparent.tqparentwidget ), + "TableName" : Samples.KexiDB._TableWidget( tqparent.tqparentwidget ), } def getCode(self): return ( @@ -216,13 +216,13 @@ class Samples: # KSpread class KSpread: - def __init__(self, parentwidget): - self.parentwidget = parentwidget + def __init__(self, tqparentwidget): + self.tqparentwidget = tqparentwidget class _SheetWidget(ListWidget): - def __init__(self, parentwidget, label = "Sheet:"): + def __init__(self, tqparentwidget, label = "Sheet:"): global ListWidget - ListWidget.__init__(self, parentwidget, label) + ListWidget.__init__(self, tqparentwidget, label) try: import krosskspreadcore @@ -235,9 +235,9 @@ class Samples: print trace class _CellsWidget(ListWidget): - def __init__(self, parentwidget): + def __init__(self, tqparentwidget): global ListWidget - ListWidget.__init__(self, parentwidget, "Cells (col1:row1 - col2:row2):") + ListWidget.__init__(self, tqparentwidget, "Cells (col1:row1 - col2:row2):") self.combo.insertItem( "1:1 - %s:%s" % (5,10) ) self.combo.insertItem( "1:1 - %s:%s" % (256,256) ) self.combo.insertItem( "1:1 - %s:%s" % (32767,32767) ) @@ -245,15 +245,15 @@ class Samples: return [ [ int(i) for i in item.split(':') ] for item in str( ListWidget.value(self) ).split('-') ] class _ValueWidget(EditWidget): - def __init__(self, parentwidget): + def __init__(self, tqparentwidget): global EditWidget - EditWidget.__init__(self, parentwidget, "Value:") + EditWidget.__init__(self, tqparentwidget, "Value:") self.edit.setText("Some text") class _ColorWidget(EditWidget): - def __init__(self, parentwidget,label,color): + def __init__(self, tqparentwidget,label,color): global EditWidget - EditWidget.__init__(self, parentwidget, "%s (RGB):" % label) + EditWidget.__init__(self, tqparentwidget, "%s (RGB):" % label) self.edit.setText(color) def value(self): return "#%s" % EditWidget.value(self) @@ -261,12 +261,12 @@ class Samples: class SetTextOfCells: """ Set the text of the defined cells. """ name = "Set text of cells" - def __init__(self, parent): + def __init__(self, tqparent): pass self.widgets = { - "SheetName" : Samples.KSpread._SheetWidget( parent.parentwidget ), - "Cells" : Samples.KSpread._CellsWidget( parent.parentwidget ), - "Value" : Samples.KSpread._ValueWidget( parent.parentwidget ), + "SheetName" : Samples.KSpread._SheetWidget( tqparent.tqparentwidget ), + "Cells" : Samples.KSpread._CellsWidget( tqparent.tqparentwidget ), + "Value" : Samples.KSpread._ValueWidget( tqparent.tqparentwidget ), } def getCode(self): return ( @@ -292,13 +292,13 @@ class Samples: class SetColorsOfCells: """ Set the colors of the defined cells. """ name = "Set colors of cells" - def __init__(self, parent): + def __init__(self, tqparent): pass self.widgets = { - "SheetName" : Samples.KSpread._SheetWidget( parent.parentwidget), - "Cells" : Samples.KSpread._CellsWidget( parent.parentwidget ), - "TextColor" : Samples.KSpread._ColorWidget( parent.parentwidget, "Textcolor", "ff0000" ), - "BackgroundColor" : Samples.KSpread._ColorWidget( parent.parentwidget, "Backgroundcolor", "c0c0c0" ), + "SheetName" : Samples.KSpread._SheetWidget( tqparent.tqparentwidget), + "Cells" : Samples.KSpread._CellsWidget( tqparent.tqparentwidget ), + "TextColor" : Samples.KSpread._ColorWidget( tqparent.tqparentwidget, "Textcolor", "ff0000" ), + "BackgroundColor" : Samples.KSpread._ColorWidget( tqparent.tqparentwidget, "Backgroundcolor", "c0c0c0" ), } def getCode(self): return ( @@ -324,10 +324,10 @@ class Samples: class IterateThroughCellsWithContent: """ Iterate over all cells in a sheet that have content (aka that are not empty). """ name = "Iterate through cells" - def __init__(self, parent): + def __init__(self, tqparent): pass self.widgets = { - "SheetName" : Samples.KSpread._SheetWidget( parent.parentwidget ), + "SheetName" : Samples.KSpread._SheetWidget( tqparent.tqparentwidget ), } def getCode(self): return ( @@ -352,9 +352,9 @@ class Samples: class PrintSheetDetails: """ Print details about the current sheet. """ name = "Details about a sheet" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { - "SheetName" : Samples.KSpread._SheetWidget( parent.parentwidget ), + "SheetName" : Samples.KSpread._SheetWidget( tqparent.tqparentwidget ), } def getCode(self): return ( @@ -376,10 +376,10 @@ class Samples: class LoadDocFromNativeXML: """ Load the document from a native XML file. """ name = "Load document from native XML File" - def __init__(self, parent): + def __init__(self, tqparent): global FileWidget self.widgets = { - "FileName" : FileWidget( parent.parentwidget, "XML File:", "*.xml;;*" ), + "FileName" : FileWidget( tqparent.tqparentwidget, "XML File:", "*.xml;;*" ), } def getCode(self): return ( @@ -413,10 +413,10 @@ class Samples: class SaveDocToNativeXML: """ Save the document to a native XML file. """ name = "Save document to native XML File" - def __init__(self, parent): + def __init__(self, tqparent): global FileWidget self.widgets = { - "FileName" : FileWidget( parent.parentwidget, "XML File:", "*.xml;;*", False ), + "FileName" : FileWidget( tqparent.tqparentwidget, "XML File:", "*.xml;;*", False ), } def getCode(self): return ( @@ -451,10 +451,10 @@ class Samples: class CopySheets: """ Copy the text-content from one sheet to another. """ name = "Copy sheets" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { - "SourceSheet" : Samples.KSpread._SheetWidget( parent.parentwidget, "Source sheet:" ), - "TargetSheet" : Samples.KSpread._SheetWidget( parent.parentwidget, "Target sheet:" ), + "SourceSheet" : Samples.KSpread._SheetWidget( tqparent.tqparentwidget, "Source sheet:" ), + "TargetSheet" : Samples.KSpread._SheetWidget( tqparent.tqparentwidget, "Target sheet:" ), } def getCode(self): return ( @@ -480,10 +480,10 @@ class Samples: class LoadSheetFromCSV: """ Load the content of a CSV file into a KSpread sheet. """ name = "Load data from CSV file into sheet" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { - "Sheet" : Samples.KSpread._SheetWidget( parent.parentwidget ), - "FileName" : FileWidget( parent.parentwidget, "CSV File:", "*.csv;;*", True ), + "Sheet" : Samples.KSpread._SheetWidget( tqparent.tqparentwidget ), + "FileName" : FileWidget( tqparent.tqparentwidget, "CSV File:", "*.csv;;*", True ), } def getCode(self): return ( @@ -519,10 +519,10 @@ class Samples: class SaveSheetToCSV: """ Save the content of a KSpread sheet into a CSV file. """ name = "Save data from a sheet into a CSV file" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { - "Sheet" : Samples.KSpread._SheetWidget( parent.parentwidget ), - "FileName" : FileWidget( parent.parentwidget, "CSV File:", "*.csv;;*", False ), + "Sheet" : Samples.KSpread._SheetWidget( tqparent.tqparentwidget ), + "FileName" : FileWidget( tqparent.tqparentwidget, "CSV File:", "*.csv;;*", False ), } def getCode(self): return ( @@ -557,16 +557,16 @@ class Samples: # PyQt class PyQt: - def __init__(self, parentwidget): - self.parentwidget = parentwidget + def __init__(self, tqparentwidget): + self.tqparentwidget = tqparentwidget class OpenFileDialog: """ Show the usage of the openfile dialog with QFileDialog. """ name = "Open File Dialog" - def __init__(self, parent): + def __init__(self, tqparent): pass self.widgets = { - "FileName" : FileWidget( parent.parentwidget, "Open File:", "*.txt *.html;;*" ), + "FileName" : FileWidget( tqparent.tqparentwidget, "Open File:", "*.txt *.html;;*" ), } def getCode(self): return ( @@ -578,10 +578,10 @@ class Samples: class SaveFileDialog: """ Show the usage of the savefile dialog with QFileDialog. """ name = "Save File Dialog" - def __init__(self, parent): + def __init__(self, tqparent): pass self.widgets = { - "FileName" : FileWidget( parent.parentwidget, "Save File:", "*.txt *.html;;*", False ), + "FileName" : FileWidget( tqparent.tqparentwidget, "Save File:", "*.txt *.html;;*", False ), } def getCode(self): return ( @@ -593,7 +593,7 @@ class Samples: class CustomDialog: """ Show a custom dialog that inherits a QDialog. """ name = "Custom Dialog" - def __init__(self, parent): + def __init__(self, tqparent): pass self.widgets = { } @@ -602,9 +602,9 @@ class Samples: 'import qt', '', 'class MyDialog(qt.QDialog):', - ' def __init__(self, parent):', + ' def __init__(self, tqparent):', ' import qt', - ' qt.QDialog.__init__(self, parent, "MyDialog", 1, qt.Qt.WDestructiveClose)', + ' qt.QDialog.__init__(self, tqparent, "MyDialog", 1, qt.Qt.WDestructiveClose)', ' self.setCaption("My Dialog")', ' btn = qt.QPushButton("Click me",self)', ' qt.QObject.connect(btn, qt.SIGNAL("clicked()"), self.buttonClicked)', @@ -619,11 +619,11 @@ class Samples: class InputDialog: """ Show how to use a QInputDialog. """ name = "Input Dialog" - def __init__(self, parent): + def __init__(self, tqparent): global EditWidget self.widgets = { - "Caption" : EditWidget( parent.parentwidget, "Caption" ), - "Message" : EditWidget( parent.parentwidget, "Message" ), + "Caption" : EditWidget( tqparent.tqparentwidget, "Caption" ), + "Message" : EditWidget( tqparent.tqparentwidget, "Message" ), } def getCode(self): return ( @@ -640,13 +640,13 @@ class Samples: # DCOP class DCOP: - def __init__(self, parentwidget): - self.parentwidget = parentwidget + def __init__(self, tqparentwidget): + self.tqparentwidget = tqparentwidget class PrintClipboard: """ Print the content from the clipper via DCOP. """ name = "Clipboard content" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { } def getCode(self): @@ -657,13 +657,13 @@ class Samples: 'd = dcopext.DCOPApp(apps[0], dcopclient)', 'result,typename,data = d.appclient.call(apps[0],"klipper","getClipboardContents()","")', 'ds = qt.QDataStream(data, qt.IO_ReadOnly)', - 'print "Clipboard content:\\n%s" % kdecore.dcop_next(ds, "QString")', + 'print "Clipboard content:\\n%s" % kdecore.dcop_next(ds, TQSTRING_OBJECT_NAME_STRING)', ) class AmarokCollectionInfos: """ Fetch some collection informations from the amarok collection via DCOP. """ name = "amarok collection infos" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { } def getCode(self): @@ -688,7 +688,7 @@ class Samples: class KopeteContacts: """ Print the names of all contacts Kopete knows via DCOP. """ name = "Kopete contacts" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { } def getCode(self): @@ -704,14 +704,14 @@ class Samples: 'if not state: raise "Failed to call the kopete contacts-function"', '', 'ds = qt.QDataStream(rdata.data(), qt.IO_ReadOnly)', - 'sl = kdecore.dcop_next (ds, "QStringList")', + 'sl = kdecore.dcop_next (ds, TQSTRINGLIST_OBJECT_NAME_STRING)', 'print "contacts=%s" % [ str(s) for s in sl ]', ) class KWordSelectedText: """ Get the selected text from a KWord instance via DCOP. """ name = "KWord selected text" - def __init__(self, parent): + def __init__(self, tqparent): self.widgets = { } def getCode(self): @@ -752,22 +752,22 @@ class Samples: '', '# Get the selected text.', '(state,rtype,rdata) = d.appclient.call(appname, frameset.obj(), "selectedText()", "")', - 'print "Selected Text: %s" % dataToList( rdata,["QString"] )[0]', + 'print "Selected Text: %s" % dataToList( rdata,[TQSTRING_OBJECT_NAME_STRING] )[0]', ) #################################################################################### # Dialog implementations. class SampleDialog(qt.QDialog): - def __init__(self, parent, sampleclazz, samplechildclazz): + def __init__(self, tqparent, sampleclazz, samplechildclazz): import qt - qt.QDialog.__init__(self, parent, "SampleDialog", 1) + qt.QDialog.__init__(self, tqparent, "SampleDialog", 1) - layout = qt.QVBoxLayout(self) + tqlayout = qt.QVBoxLayout(self) box = qt.QVBox(self) box.setMargin(4) box.setSpacing(10) - layout.addWidget(box) + tqlayout.addWidget(box) self.scrollview = qt.QScrollView(box) self.scrollview.setResizePolicy(qt.QScrollView.AutoOne) @@ -813,11 +813,11 @@ class SampleDialog(qt.QDialog): widget = self.samplechild.widgets[widgetname] value = widget.value() if value != None: - code = code.replace("{%s}" % widgetname, str(value)) + code = code.tqreplace("{%s}" % widgetname, str(value)) return code class MainDialog(qt.QDialog): - def __init__(self, scriptpath, parent): + def __init__(self, scriptpath, tqparent): self.scriptpath = scriptpath if not hasattr(__main__,"scripteditorfilename"): __main__.scripteditorfilename = self.getFileName("myscript.py") @@ -826,14 +826,14 @@ class MainDialog(qt.QDialog): self.doc = krosskspreadcore.get("KSpreadDocument") import os, qt - qt.QDialog.__init__(self, parent, "MainDialog", 1, qt.Qt.WDestructiveClose) + qt.QDialog.__init__(self, tqparent, "MainDialog", 1, qt.Qt.WDestructiveClose) self.setCaption("Script Editor") - layout = qt.QVBoxLayout(self) + tqlayout = qt.QVBoxLayout(self) box = qt.QVBox(self) box.setMargin(4) box.setSpacing(10) - layout.addWidget(box) + tqlayout.addWidget(box) menu = qt.QMenuBar(box) @@ -1083,7 +1083,7 @@ if __name__ == "__main__": qtapp = qt.QApplication(sys.argv) else: scriptpath = os.path.dirname(__name__) - qtapp = qt.qApp + qtapp = qt.tqApp dialog = MainDialog(scriptpath, qtapp.mainWidget()) dialog.exec_loop() |