summaryrefslogtreecommitdiffstats
path: root/lib/kross/main/scriptguiclient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kross/main/scriptguiclient.cpp')
-rw-r--r--lib/kross/main/scriptguiclient.cpp156
1 files changed, 78 insertions, 78 deletions
diff --git a/lib/kross/main/scriptguiclient.cpp b/lib/kross/main/scriptguiclient.cpp
index 28a89015..36d81151 100644
--- a/lib/kross/main/scriptguiclient.cpp
+++ b/lib/kross/main/scriptguiclient.cpp
@@ -44,49 +44,49 @@ namespace Kross { namespace Api {
{
public:
/**
- * The \a KXMLGUIClient that is parent of the \a ScriptGUIClient
+ * The \a KXMLGUIClient that is tqparent of the \a ScriptGUIClient
* instance.
*/
KXMLGUIClient* guiclient;
/**
- * The optional parent QWidget widget.
+ * The optional tqparent TQWidget widget.
*/
- QWidget* parent;
+ TQWidget* tqparent;
/**
* Map of \a ScriptActionCollection instances the \a ScriptGUIClient
* is attached to.
*/
- QMap<QString, ScriptActionCollection*> collections;
+ TQMap<TQString, ScriptActionCollection*> collections;
};
}}
-ScriptGUIClient::ScriptGUIClient(KXMLGUIClient* guiclient, QWidget* parent)
- : QObject( parent )
+ScriptGUIClient::ScriptGUIClient(KXMLGUIClient* guiclient, TQWidget* tqparent)
+ : TQObject( tqparent )
, KXMLGUIClient( guiclient )
, d( new ScriptGUIClientPrivate() ) // initialize d-pointer class
{
- krossdebug( QString("ScriptGUIClient::ScriptGUIClient() Ctor") );
+ krossdebug( TQString("ScriptGUIClient::ScriptGUIClient() Ctor") );
d->guiclient = guiclient;
- d->parent = parent;
+ d->tqparent = tqparent;
setInstance( ScriptGUIClient::instance() );
// action to execute a scriptfile.
- new KAction(i18n("Execute Script File..."), 0, 0, this, SLOT(executeScriptFile()), actionCollection(), "executescriptfile");
+ new KAction(i18n("Execute Script File..."), 0, 0, this, TQT_SLOT(executeScriptFile()), actionCollection(), "executescriptfile");
// acion to show the ScriptManagerGUI dialog.
- new KAction(i18n("Scripts Manager..."), 0, 0, this, SLOT(showScriptManager()), actionCollection(), "configurescripts");
+ new KAction(i18n("Scripts Manager..."), 0, 0, this, TQT_SLOT(showScriptManager()), actionCollection(), "configurescripts");
// The predefined ScriptActionCollection's this ScriptGUIClient provides.
- d->collections.replace("installedscripts",
+ d->collections.tqreplace("installedscripts",
new ScriptActionCollection(i18n("Scripts"), actionCollection(), "installedscripts") );
- d->collections.replace("loadedscripts",
+ d->collections.tqreplace("loadedscripts",
new ScriptActionCollection(i18n("Loaded"), actionCollection(), "loadedscripts") );
- d->collections.replace("executedscripts",
+ d->collections.tqreplace("executedscripts",
new ScriptActionCollection(i18n("History"), actionCollection(), "executedscripts") );
reloadInstalledScripts();
@@ -94,36 +94,36 @@ ScriptGUIClient::ScriptGUIClient(KXMLGUIClient* guiclient, QWidget* parent)
ScriptGUIClient::~ScriptGUIClient()
{
- krossdebug( QString("ScriptGUIClient::~ScriptGUIClient() Dtor") );
- for(QMap<QString, ScriptActionCollection*>::Iterator it = d->collections.begin(); it != d->collections.end(); ++it)
+ krossdebug( TQString("ScriptGUIClient::~ScriptGUIClient() Dtor") );
+ for(TQMap<TQString, ScriptActionCollection*>::Iterator it = d->collections.begin(); it != d->collections.end(); ++it)
delete it.data();
delete d;
}
-bool ScriptGUIClient::hasActionCollection(const QString& name)
+bool ScriptGUIClient::hasActionCollection(const TQString& name)
{
- return d->collections.contains(name);
+ return d->collections.tqcontains(name);
}
-ScriptActionCollection* ScriptGUIClient::getActionCollection(const QString& name)
+ScriptActionCollection* ScriptGUIClient::getActionCollection(const TQString& name)
{
return d->collections[name];
}
-QMap<QString, ScriptActionCollection*> ScriptGUIClient::getActionCollections()
+TQMap<TQString, ScriptActionCollection*> ScriptGUIClient::getActionCollections()
{
return d->collections;
}
-void ScriptGUIClient::addActionCollection(const QString& name, ScriptActionCollection* collection)
+void ScriptGUIClient::addActionCollection(const TQString& name, ScriptActionCollection* collection)
{
removeActionCollection(name);
- d->collections.replace(name, collection);
+ d->collections.tqreplace(name, collection);
}
-bool ScriptGUIClient::removeActionCollection(const QString& name)
+bool ScriptGUIClient::removeActionCollection(const TQString& name)
{
- if(d->collections.contains(name)) {
+ if(d->collections.tqcontains(name)) {
ScriptActionCollection* c = d->collections[name];
d->collections.remove(name);
delete c;
@@ -138,46 +138,46 @@ void ScriptGUIClient::reloadInstalledScripts()
if(installedcollection)
installedcollection->clear();
- QCString partname = d->guiclient->instance()->instanceName();
- QStringList files = KGlobal::dirs()->findAllResources("data", partname + "/scripts/*/*.rc");
+ TQCString partname = d->guiclient->instance()->instanceName();
+ TQStringList files = KGlobal::dirs()->findAllResources("data", partname + "/scripts/*/*.rc");
//files.sort();
- for(QStringList::iterator it = files.begin(); it != files.end(); ++it)
+ for(TQStringList::iterator it = files.begin(); it != files.end(); ++it)
loadScriptConfigFile(*it);
}
-bool ScriptGUIClient::installScriptPackage(const QString& scriptpackagefile)
+bool ScriptGUIClient::installScriptPackage(const TQString& scriptpackagefile)
{
- krossdebug( QString("Install script package: %1").arg(scriptpackagefile) );
+ krossdebug( TQString("Install script package: %1").tqarg(scriptpackagefile) );
KTar archive( scriptpackagefile );
if(! archive.open(IO_ReadOnly)) {
- KMessageBox::sorry(0, i18n("Could not read the package \"%1\".").arg(scriptpackagefile));
+ KMessageBox::sorry(0, i18n("Could not read the package \"%1\".").tqarg(scriptpackagefile));
return false;
}
- QCString partname = d->guiclient->instance()->instanceName();
- QString destination = KGlobal::dirs()->saveLocation("data", partname + "/scripts/", true);
- //QString destination = KGlobal::dirs()->saveLocation("appdata", "scripts", true);
+ TQCString partname = d->guiclient->instance()->instanceName();
+ TQString destination = KGlobal::dirs()->saveLocation("data", partname + "/scripts/", true);
+ //TQString destination = KGlobal::dirs()->saveLocation("appdata", "scripts", true);
if(destination.isNull()) {
krosswarning("ScriptGUIClient::installScriptPackage() Failed to determinate location where the scriptpackage should be installed to!");
return false;
}
- QString packagename = QFileInfo(scriptpackagefile).baseName();
+ TQString packagename = TQFileInfo(scriptpackagefile).baseName();
destination += packagename; // add the packagename to the name of the destination-directory.
- if( QDir(destination).exists() ) {
+ if( TQDir(destination).exists() ) {
if( KMessageBox::warningContinueCancel(0,
- i18n("A script package with the name \"%1\" already exists. Replace this package?" ).arg(packagename),
+ i18n("A script package with the name \"%1\" already exists. Replace this package?" ).tqarg(packagename),
i18n("Replace")) != KMessageBox::Continue )
return false;
if(! KIO::NetAccess::del(destination, 0) ) {
- KMessageBox::sorry(0, i18n("Could not uninstall this script package. You may not have sufficient permissions to delete the folder \"%1\".").arg(destination));
+ KMessageBox::sorry(0, i18n("Could not uninstall this script package. You may not have sufficient permissions to delete the folder \"%1\".").tqarg(destination));
return false;
}
}
- krossdebug( QString("Copy script-package to destination directory: %1").arg(destination) );
+ krossdebug( TQString("Copy script-package to destination directory: %1").tqarg(destination) );
const KArchiveDirectory* archivedir = archive.directory();
archivedir->copyTo(destination, true);
@@ -185,40 +185,40 @@ bool ScriptGUIClient::installScriptPackage(const QString& scriptpackagefile)
return true;
}
-bool ScriptGUIClient::uninstallScriptPackage(const QString& scriptpackagepath)
+bool ScriptGUIClient::uninstallScriptPackage(const TQString& scriptpackagepath)
{
if(! KIO::NetAccess::del(scriptpackagepath, 0) ) {
- KMessageBox::sorry(0, i18n("Could not uninstall this script package. You may not have sufficient permissions to delete the folder \"%1\".").arg(scriptpackagepath));
+ KMessageBox::sorry(0, i18n("Could not uninstall this script package. You may not have sufficient permissions to delete the folder \"%1\".").tqarg(scriptpackagepath));
return false;
}
reloadInstalledScripts();
return true;
}
-bool ScriptGUIClient::loadScriptConfigFile(const QString& scriptconfigfile)
+bool ScriptGUIClient::loadScriptConfigFile(const TQString& scriptconfigfile)
{
- krossdebug( QString("ScriptGUIClient::loadScriptConfig file=%1").arg(scriptconfigfile) );
+ krossdebug( TQString("ScriptGUIClient::loadScriptConfig file=%1").tqarg(scriptconfigfile) );
- QDomDocument domdoc;
- QFile file(scriptconfigfile);
+ TQDomDocument domdoc;
+ TQFile file(scriptconfigfile);
if(! file.open(IO_ReadOnly)) {
- krosswarning( QString("ScriptGUIClient::loadScriptConfig(): Failed to read scriptconfigfile: %1").arg(scriptconfigfile) );
+ krosswarning( TQString("ScriptGUIClient::loadScriptConfig(): Failed to read scriptconfigfile: %1").tqarg(scriptconfigfile) );
return false;
}
bool ok = domdoc.setContent(&file);
file.close();
if(! ok) {
- krosswarning( QString("ScriptGUIClient::loadScriptConfig(): Failed to parse scriptconfigfile: %1").arg(scriptconfigfile) );
+ krosswarning( TQString("ScriptGUIClient::loadScriptConfig(): Failed to parse scriptconfigfile: %1").tqarg(scriptconfigfile) );
return false;
}
return loadScriptConfigDocument(scriptconfigfile, domdoc);
}
-bool ScriptGUIClient::loadScriptConfigDocument(const QString& scriptconfigfile, const QDomDocument &document)
+bool ScriptGUIClient::loadScriptConfigDocument(const TQString& scriptconfigfile, const TQDomDocument &document)
{
ScriptActionCollection* installedcollection = d->collections["installedscripts"];
- QDomNodeList nodelist = document.elementsByTagName("ScriptAction");
+ TQDomNodeList nodelist = document.elementsByTagName("ScriptAction");
uint nodelistcount = nodelist.count();
for(uint i = 0; i < nodelistcount; i++) {
ScriptAction::Ptr action = new ScriptAction(scriptconfigfile, nodelist.item(i).toElement());
@@ -244,28 +244,28 @@ bool ScriptGUIClient::loadScriptConfigDocument(const QString& scriptconfigfile,
else {
// else just print a warning and fall through (so, install the action
// and don't care any longer of the duplicated name)...
- krosswarning( QString("Kross::Api::ScriptGUIClient::loadScriptConfigDocument: There exists already a scriptaction with name \"%1\". Added anyway...").arg(action->name()) );
+ krosswarning( TQString("Kross::Api::ScriptGUIClient::loadScriptConfigDocument: There exists already a scriptaction with name \"%1\". Added anyway...").tqarg(action->name()) );
}
}
installedcollection->attach( action );
}
- connect(action.data(), SIGNAL( failed(const QString&, const QString&) ),
- this, SLOT( executionFailed(const QString&, const QString&) ));
- connect(action.data(), SIGNAL( success() ),
- this, SLOT( successfullyExecuted() ));
- connect(action.data(), SIGNAL( activated(const Kross::Api::ScriptAction*) ), SIGNAL( executionStarted(const Kross::Api::ScriptAction*)));
+ connect(action.data(), TQT_SIGNAL( failed(const TQString&, const TQString&) ),
+ this, TQT_SLOT( executionFailed(const TQString&, const TQString&) ));
+ connect(action.data(), TQT_SIGNAL( success() ),
+ this, TQT_SLOT( successfullyExecuted() ));
+ connect(action.data(), TQT_SIGNAL( activated(const Kross::Api::ScriptAction*) ), TQT_SIGNAL( executionStarted(const Kross::Api::ScriptAction*)));
}
emit collectionChanged(installedcollection);
return true;
}
-void ScriptGUIClient::setXMLFile(const QString& file, bool merge, bool setXMLDoc)
+void ScriptGUIClient::setXMLFile(const TQString& file, bool merge, bool setXMLDoc)
{
KXMLGUIClient::setXMLFile(file, merge, setXMLDoc);
}
-void ScriptGUIClient::setDOMDocument(const QDomDocument &document, bool merge)
+void ScriptGUIClient::setDOMDocument(const TQDomDocument &document, bool merge)
{
ScriptActionCollection* installedcollection = d->collections["installedscripts"];
if(! merge && installedcollection)
@@ -277,7 +277,7 @@ void ScriptGUIClient::setDOMDocument(const QDomDocument &document, bool merge)
void ScriptGUIClient::successfullyExecuted()
{
- const ScriptAction* action = dynamic_cast< const ScriptAction* >( QObject::sender() );
+ const ScriptAction* action = dynamic_cast< const ScriptAction* >( TQObject::sender() );
if(action) {
emit executionFinished(action);
ScriptActionCollection* executedcollection = d->collections["executedscripts"];
@@ -290,9 +290,9 @@ void ScriptGUIClient::successfullyExecuted()
}
}
-void ScriptGUIClient::executionFailed(const QString& errormessage, const QString& tracedetails)
+void ScriptGUIClient::executionFailed(const TQString& errormessage, const TQString& tracedetails)
{
- const ScriptAction* action = dynamic_cast< const ScriptAction* >( QObject::sender() );
+ const ScriptAction* action = dynamic_cast< const ScriptAction* >( TQObject::sender() );
if(action)
emit executionFinished(action);
if(tracedetails.isEmpty())
@@ -301,17 +301,17 @@ void ScriptGUIClient::executionFailed(const QString& errormessage, const QString
KMessageBox::detailedError(0, errormessage, tracedetails);
}
-KURL ScriptGUIClient::openScriptFile(const QString& caption)
+KURL ScriptGUIClient::openScriptFile(const TQString& caption)
{
- QStringList mimetypes;
- QMap<QString, InterpreterInfo*> infos = Manager::scriptManager()->getInterpreterInfos();
- for(QMap<QString, InterpreterInfo*>::Iterator it = infos.begin(); it != infos.end(); ++it)
+ TQStringList mimetypes;
+ TQMap<TQString, InterpreterInfo*> infos = Manager::scriptManager()->getInterpreterInfos();
+ for(TQMap<TQString, InterpreterInfo*>::Iterator it = infos.begin(); it != infos.end(); ++it)
mimetypes.append( it.data()->getMimeTypes().join(" ").stripWhiteSpace() );
KFileDialog* filedialog = new KFileDialog(
- QString::null, // startdir
+ TQString(), // startdir
mimetypes.join(" "), // filter
- 0, // parent widget
+ 0, // tqparent widget
"ScriptGUIClientFileDialog", // name
true // modal
);
@@ -329,11 +329,11 @@ bool ScriptGUIClient::loadScriptFile()
ScriptActionCollection* loadedcollection = d->collections["loadedscripts"];
if(loadedcollection) {
ScriptAction::Ptr action = new ScriptAction( url.path() );
- connect(action.data(), SIGNAL( failed(const QString&, const QString&) ),
- this, SLOT( executionFailed(const QString&, const QString&) ));
- connect(action.data(), SIGNAL( success() ),
- this, SLOT( successfullyExecuted() ));
- connect(action.data(), SIGNAL( activated(const Kross::Api::ScriptAction*) ), SIGNAL( executionStarted(const Kross::Api::ScriptAction*)));
+ connect(action.data(), TQT_SIGNAL( failed(const TQString&, const TQString&) ),
+ this, TQT_SLOT( executionFailed(const TQString&, const TQString&) ));
+ connect(action.data(), TQT_SIGNAL( success() ),
+ this, TQT_SLOT( successfullyExecuted() ));
+ connect(action.data(), TQT_SIGNAL( activated(const Kross::Api::ScriptAction*) ), TQT_SIGNAL( executionStarted(const Kross::Api::ScriptAction*)));
loadedcollection->detach(action);
loadedcollection->attach(action);
@@ -351,9 +351,9 @@ bool ScriptGUIClient::executeScriptFile()
return false;
}
-bool ScriptGUIClient::executeScriptFile(const QString& file)
+bool ScriptGUIClient::executeScriptFile(const TQString& file)
{
- krossdebug( QString("Kross::Api::ScriptGUIClient::executeScriptFile() file='%1'").arg(file) );
+ krossdebug( TQString("Kross::Api::ScriptGUIClient::executeScriptFile() file='%1'").tqarg(file) );
ScriptAction::Ptr action = new ScriptAction(file);
return executeScriptAction(action);
@@ -361,11 +361,11 @@ bool ScriptGUIClient::executeScriptFile(const QString& file)
bool ScriptGUIClient::executeScriptAction(ScriptAction::Ptr action)
{
- connect(action.data(), SIGNAL( failed(const QString&, const QString&) ),
- this, SLOT( executionFailed(const QString&, const QString&) ));
- connect(action.data(), SIGNAL( success() ),
- this, SLOT( successfullyExecuted() ));
- connect(action.data(), SIGNAL( activated(const Kross::Api::ScriptAction*) ), SIGNAL( executionStarted(const Kross::Api::ScriptAction*)));
+ connect(action.data(), TQT_SIGNAL( failed(const TQString&, const TQString&) ),
+ this, TQT_SLOT( executionFailed(const TQString&, const TQString&) ));
+ connect(action.data(), TQT_SIGNAL( success() ),
+ this, TQT_SLOT( successfullyExecuted() ));
+ connect(action.data(), TQT_SIGNAL( activated(const Kross::Api::ScriptAction*) ), TQT_SIGNAL( executionStarted(const Kross::Api::ScriptAction*)));
action->activate();
bool ok = action->hadException();
action->finalize(); // execution is done.
@@ -374,10 +374,10 @@ bool ScriptGUIClient::executeScriptAction(ScriptAction::Ptr action)
void ScriptGUIClient::showScriptManager()
{
- KDialogBase* dialog = new KDialogBase(d->parent, "", true, i18n("Scripts Manager"), KDialogBase::Close);
+ KDialogBase* dialog = new KDialogBase(d->tqparent, "", true, i18n("Scripts Manager"), KDialogBase::Close);
WdgScriptsManager* wsm = new WdgScriptsManager(this, dialog);
dialog->setMainWidget(wsm);
- dialog->resize( QSize(360, 320).expandedTo(dialog->minimumSizeHint()) );
+ dialog->resize( TQSize(360, 320).expandedTo(dialog->tqminimumSizeHint()) );
dialog->show();
}