summaryrefslogtreecommitdiffstats
path: root/quanta/utility/tagaction.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-16 19:02:47 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-16 19:02:47 +0000
commite985f7e545f4739493965aad69bbecb136dc9346 (patch)
tree54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /quanta/utility/tagaction.cpp
parentf7670c198945adc3b95ad69a959fe5f8ae55b493 (diff)
downloadtdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz
tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/utility/tagaction.cpp')
-rw-r--r--quanta/utility/tagaction.cpp150
1 files changed, 75 insertions, 75 deletions
diff --git a/quanta/utility/tagaction.cpp b/quanta/utility/tagaction.cpp
index 9787d047..33bf5313 100644
--- a/quanta/utility/tagaction.cpp
+++ b/quanta/utility/tagaction.cpp
@@ -72,14 +72,14 @@ int MyProcess::commSetupDoneC()
return KProcess::commSetupDoneC();
}
-TagAction::TagAction( TQDomElement *element, KMainWindow *parentMainWindow, bool toggle)
+TagAction::TagAction( TQDomElement *element, KMainWindow *tqparentMainWindow, bool toggle)
: KToggleAction(element->attribute("text").isEmpty() ? TQString("") : i18n(element->attribute("text").utf8()),
- KShortcut(element->attribute("shortcut")), 0, 0, parentMainWindow->actionCollection(), element->attribute("name").ascii()),
+ KShortcut(element->attribute("shortcut")), 0, 0, tqparentMainWindow->actionCollection(), element->attribute("name").ascii()),
//disable toggle now m_toggle(toggle)
m_toggle(false)
{
setToolTip(element->attribute("tooltip"));
- m_parentMainWindow = parentMainWindow;
+ m_parentMainWindow = tqparentMainWindow;
m_modified = false;
m_useInputFile = false;
m_useOutputFile = false;
@@ -93,8 +93,8 @@ TagAction::TagAction( TQDomElement *element, KMainWindow *parentMainWindow, bool
m_file = 0L;
loopStarted = false;
#if KDE_VERSION >= KDE_MAKE_VERSION(3,4,0)
- connect(this, TQT_SIGNAL(activated(KAction::ActivationReason, Qt::ButtonState)),
- TQT_SLOT(slotActionActivated(KAction::ActivationReason, Qt::ButtonState)));
+ connect(this, TQT_SIGNAL(activated(KAction::ActivationReason, TQt::ButtonState)),
+ TQT_SLOT(slotActionActivated(KAction::ActivationReason, TQt::ButtonState)));
#else
connect(this, TQT_SIGNAL(activated()), TQT_SLOT(slotActionActivated()));
#endif
@@ -114,7 +114,7 @@ TQString TagAction::type()
}
#if KDE_VERSION >= KDE_MAKE_VERSION(3,4,0)
-bool TagAction::slotActionActivated(KAction::ActivationReason reason, Qt::ButtonState /*state*/)
+bool TagAction::slotActionActivated(KAction::ActivationReason reason, TQt::ButtonState /*state*/)
{
QuantaView *view = ViewManager::ref()->activeView();
if ( !view || !view->document())
@@ -162,7 +162,7 @@ bool TagAction::slotActionActivated(KAction::ActivationReason reason, Qt::Button
start_node = end_node = current_node;
start_offset = end_offset = current_offset;
- QTag* tag_description = QuantaCommon::tagFromDTD(KafkaDocument::ref()->getCurrentDoc()->defaultDTD(), XMLTagName());
+ TQTag* tag_description = QuantaCommon::tagFromDTD(KafkaDocument::ref()->getCurrentDoc()->defaultDTD(), XMLTagName());
scope = tag_description->scope();
// Q_ASSERT(!scope.isNull());
if(scope.isNull())
@@ -281,7 +281,7 @@ bool TagAction::slotActionActivated(KAction::ActivationReason reason, Qt::Button
s1 += " "+QuantaCommon::attrCase(attr);
if (otag.text().right(1) == ">")
{
- QTag *dtdTag = QuantaCommon::tagFromDTD(w->defaultDTD(), name);
+ TQTag *dtdTag = QuantaCommon::tagFromDTD(w->defaultDTD(), name);
if ( w->defaultDTD()->singleTagStyle == "xml" && dtdTag &&
(dtdTag->isSingle() || (!qConfig.closeOptionalTags && dtdTag->isOptional()))
)
@@ -332,16 +332,16 @@ bool TagAction::slotActionActivated(KAction::ActivationReason reason, Qt::Button
TQString fname = w->url().url();
if ( w->url().protocol() == "file")
fname = w->url().path();
- command.replace("%f", fname );
+ command.tqreplace("%f", fname );
}
pid_t pid = ::getpid();
if (kapp->inherits("KUniqueApplication"))
{
- command.replace("%pid", TQString("unique %1").arg(pid));
+ command.tqreplace("%pid", TQString("unique %1").tqarg(pid));
} else
{
- command.replace("%pid", TQString("%1").arg(pid));
+ command.tqreplace("%pid", TQString("%1").tqarg(pid));
}
TQString buffer;
TQString inputType = script.attribute("input","none");
@@ -352,9 +352,9 @@ bool TagAction::slotActionActivated(KAction::ActivationReason reason, Qt::Button
if ( inputType == "selected" && w->selectionIf) {
buffer = w->selectionIf->selection();
}
- command.replace("%input", buffer);
+ command.tqreplace("%input", buffer);
command = command.stripWhiteSpace();
- int pos = command.find(' ');
+ int pos = command.tqfind(' ');
TQString args;
if (pos != -1)
{
@@ -374,46 +374,46 @@ bool TagAction::slotActionActivated(KAction::ActivationReason reason, Qt::Button
pos = 0;
while (pos != -1 )
{
- pos = args.find("%scriptdir");
+ pos = args.tqfind("%scriptdir");
TQString scriptname;
if (pos != -1)
{
- int begin = args.findRev('"', pos);
+ int begin = args.tqfindRev('"', pos);
int end = -1;
if (begin == -1)
{
- begin = args.findRev('\'', pos);
+ begin = args.tqfindRev('\'', pos);
if (begin != -1)
- end = args.find('\'', pos);
+ end = args.tqfind('\'', pos);
} else
{
- end = args.find('"', pos);
+ end = args.tqfind('"', pos);
}
if (begin == -1 || end != -1)
{
- begin = args.findRev(' ', pos);
+ begin = args.tqfindRev(' ', pos);
if (begin == -1)
begin = 0;
- end = args.find(' ', pos);
+ end = args.tqfind(' ', pos);
if (end == -1)
end = args.length();
}
scriptname = args.mid(begin, end - begin).stripWhiteSpace();
- scriptname.replace("%scriptdir","scripts");
+ scriptname.tqreplace("%scriptdir","scripts");
// kdDebug(24000) << "Script name is: |" << scriptname << "|" << endl;
scriptname = " " + locate("appdata", scriptname);
// kdDebug(24000) << "Script found at: " << scriptname << endl;
- args.replace(begin, end - begin, scriptname);
+ args.tqreplace(begin, end - begin, scriptname);
// kdDebug(24000) << "Modified argument list: " << args << endl;
}
}
- int pos = args.find("%projectbase");
+ int pos = args.tqfind("%projectbase");
if (pos != -1)
{
TQString s;
if (Project::ref()->hasProject())
s = Project::ref()->projectBaseURL().url();
- args.replace("%projectbase", s);
+ args.tqreplace("%projectbase", s);
}
TQStringList argsList1 = TQStringList::split(' ', args);
TQStringList argsList;
@@ -461,7 +461,7 @@ bool TagAction::slotActionActivated(KAction::ActivationReason reason, Qt::Button
if (proc->start(KProcess::NotifyOnExit, KProcess::All))
{
emit clearMessages();
- emit showMessage(i18n("The \"%1\" script started.\n").arg(actionText()), false);
+ emit showMessage(i18n("The \"%1\" script started.\n").tqarg(actionText()), false);
if (!m_useInputFile)
{
if ( inputType == "current" || inputType == "selected" )
@@ -472,11 +472,11 @@ bool TagAction::slotActionActivated(KAction::ActivationReason reason, Qt::Button
proc->closeStdin();
} else
{
- KMessageBox::error(m_parentMainWindow, i18n("<qt>There was an error running <b>%1</b>.<br>Check that you have the <i>%2</i> executable installed and it is accessible.</qt>").arg(command + " " + args).arg(command), i18n("Script Not Found"));
+ KMessageBox::error(m_parentMainWindow, i18n("<qt>There was an error running <b>%1</b>.<br>Check that you have the <i>%2</i> executable installed and it is accessible.</qt>").tqarg(command + " " + args).tqarg(command), i18n("Script Not Found"));
ViewManager::ref()->activeView()->setFocus();
if (loopStarted)
{
- qApp->exit_loop();
+ tqApp->exit_loop();
loopStarted = false;
}
return false;
@@ -486,9 +486,9 @@ bool TagAction::slotActionActivated(KAction::ActivationReason reason, Qt::Button
return true;
}
#else
- // hack to compile. moc doesn't check the "#ifdef" at the declaration and the compiler complains
+ // hack to compile. tqmoc doesn't check the "#ifdef" at the declaration and the compiler complains
// of no matching function.
-bool TagAction::slotActionActivated(KAction::ActivationReason /*reason*/, Qt::ButtonState /*state*/)
+bool TagAction::slotActionActivated(KAction::ActivationReason /*reason*/, TQt::ButtonState /*state*/)
{return true;}
#endif
@@ -535,7 +535,7 @@ bool TagAction::slotActionActivated()
s1 += " "+QuantaCommon::attrCase(attr);
if (otag.text().right(1) == ">")
{
- QTag *dtdTag = QuantaCommon::tagFromDTD(w->defaultDTD(), name);
+ TQTag *dtdTag = QuantaCommon::tagFromDTD(w->defaultDTD(), name);
if ( w->defaultDTD()->singleTagStyle == "xml" && dtdTag &&
(dtdTag->isSingle() || (!qConfig.closeOptionalTags && dtdTag->isOptional()))
)
@@ -586,16 +586,16 @@ bool TagAction::slotActionActivated()
TQString fname = w->url().url();
if ( w->url().protocol() == "file")
fname = w->url().path();
- command.replace("%f", fname );
+ command.tqreplace("%f", fname );
}
pid_t pid = ::getpid();
if (kapp->inherits("KUniqueApplication"))
{
- command.replace("%pid", TQString("unique %1").arg(pid));
+ command.tqreplace("%pid", TQString("unique %1").tqarg(pid));
} else
{
- command.replace("%pid", TQString("%1").arg(pid));
+ command.tqreplace("%pid", TQString("%1").tqarg(pid));
}
TQString buffer;
TQString inputType = script.attribute("input","none");
@@ -606,9 +606,9 @@ bool TagAction::slotActionActivated()
if ( inputType == "selected" && w->selectionIf) {
buffer = w->selectionIf->selection();
}
- command.replace("%input", buffer);
+ command.tqreplace("%input", buffer);
command = command.stripWhiteSpace();
- int pos = command.find(' ');
+ int pos = command.tqfind(' ');
TQString args;
if (pos != -1)
{
@@ -628,46 +628,46 @@ bool TagAction::slotActionActivated()
pos = 0;
while (pos != -1 )
{
- pos = args.find("%scriptdir");
+ pos = args.tqfind("%scriptdir");
TQString scriptname;
if (pos != -1)
{
- int begin = args.findRev('"', pos);
+ int begin = args.tqfindRev('"', pos);
int end = -1;
if (begin == -1)
{
- begin = args.findRev('\'', pos);
+ begin = args.tqfindRev('\'', pos);
if (begin != -1)
- end = args.find('\'', pos);
+ end = args.tqfind('\'', pos);
} else
{
- end = args.find('"', pos);
+ end = args.tqfind('"', pos);
}
if (begin == -1 || end != -1)
{
- begin = args.findRev(' ', pos);
+ begin = args.tqfindRev(' ', pos);
if (begin == -1)
begin = 0;
- end = args.find(' ', pos);
+ end = args.tqfind(' ', pos);
if (end == -1)
end = args.length();
}
scriptname = args.mid(begin, end - begin).stripWhiteSpace();
- scriptname.replace("%scriptdir","scripts");
+ scriptname.tqreplace("%scriptdir","scripts");
// kdDebug(24000) << "Script name is: |" << scriptname << "|" << endl;
scriptname = " " + locate("appdata", scriptname);
// kdDebug(24000) << "Script found at: " << scriptname << endl;
- args.replace(begin, end - begin, scriptname);
+ args.tqreplace(begin, end - begin, scriptname);
// kdDebug(24000) << "Modified argument list: " << args << endl;
}
}
- int pos = args.find("%projectbase");
+ int pos = args.tqfind("%projectbase");
if (pos != -1)
{
TQString s;
if (Project::ref()->hasProject())
s = Project::ref()->projectBaseURL().url();
- args.replace("%projectbase", s);
+ args.tqreplace("%projectbase", s);
}
TQStringList argsList1 = TQStringList::split(' ', args);
TQStringList argsList;
@@ -715,7 +715,7 @@ bool TagAction::slotActionActivated()
if (proc->start(KProcess::NotifyOnExit, KProcess::All))
{
emit clearMessages();
- emit showMessage(i18n("The \"%1\" script started.\n").arg(actionText()), false);
+ emit showMessage(i18n("The \"%1\" script started.\n").tqarg(actionText()), false);
if (!m_useInputFile)
{
if ( inputType == "current" || inputType == "selected" )
@@ -726,11 +726,11 @@ bool TagAction::slotActionActivated()
proc->closeStdin();
} else
{
- KMessageBox::error(m_parentMainWindow, i18n("<qt>There was an error running <b>%1</b>.<br>Check that you have the <i>%2</i> executable installed and it is accessible.</qt>").arg(command + " " + args).arg(command), i18n("Script Not Found"));
+ KMessageBox::error(m_parentMainWindow, i18n("<qt>There was an error running <b>%1</b>.<br>Check that you have the <i>%2</i> executable installed and it is accessible.</qt>").tqarg(command + " " + args).tqarg(command), i18n("Script Not Found"));
ViewManager::ref()->activeView()->setFocus();
if (loopStarted)
{
- qApp->exit_loop();
+ tqApp->exit_loop();
loopStarted = false;
}
return false;
@@ -767,7 +767,7 @@ void TagAction::slotGetScriptOutput( KProcess *, char *buffer, int buflen )
}
w->insertTag( text );
} else
- if ( scriptOutputDest == "replace" )
+ if ( scriptOutputDest == "tqreplace" )
{
if ( firstOutput )
w->editIf->clear();
@@ -787,7 +787,7 @@ void TagAction::slotGetScriptOutput( KProcess *, char *buffer, int buflen )
if ( firstOutput )
{
emit showMessagesView();
- emit showMessage(i18n("The \"%1\" script output:\n").arg(actionText()), false);
+ emit showMessage(i18n("The \"%1\" script output:\n").tqarg(actionText()), false);
}
emit showMessage(text, true);
} else
@@ -827,7 +827,7 @@ void TagAction::slotGetScriptError( KProcess *, char *buffer, int buflen )
}
w->insertTag( text );
} else
- if ( scriptErrorDest == "replace" )
+ if ( scriptErrorDest == "tqreplace" )
{
if ( firstError )
w->editIf->clear();
@@ -847,7 +847,7 @@ void TagAction::slotGetScriptError( KProcess *, char *buffer, int buflen )
if ( firstError )
{
emit showMessagesView();
- emit showMessage(i18n("The \"%1\" script output:\n").arg(actionText()), false);
+ emit showMessage(i18n("The \"%1\" script output:\n").tqarg(actionText()), false);
}
emit showMessage(text, true);
}
@@ -874,7 +874,7 @@ void TagAction::setInputFileName(const TQString& fileName)
TQString TagAction::actionText()
{
TQString t = tag.attribute("text");
- int pos = t.find('&');
+ int pos = t.tqfind('&');
if (pos < (int)t.length()-1 && t[pos+1] != '&')
return t.remove(pos, 1);
else
@@ -925,7 +925,7 @@ TQString TagAction::openXMLTagString() const
if (otag.text().right(1) == ">")
{
Document* w = ViewManager::ref()->activeView()->document();
- QTag *dtdTag = QuantaCommon::tagFromDTD(w->defaultDTD(), name);
+ TQTag *dtdTag = QuantaCommon::tagFromDTD(w->defaultDTD(), name);
if ( w->defaultDTD()->singleTagStyle == "xml" && dtdTag &&
(dtdTag->isSingle() || (!qConfig.closeOptionalTags && dtdTag->isOptional()))
)
@@ -967,10 +967,10 @@ void TagAction::slotProcessExited(KProcess *process)
{
if (loopStarted)
{
- qApp->exit_loop();
+ tqApp->exit_loop();
loopStarted = false;
}
- emit showMessage(i18n("The \"%1\" script has exited.").arg(actionText()), false);
+ emit showMessage(i18n("The \"%1\" script has exited.").tqarg(actionText()), false);
delete process;
}
@@ -993,7 +993,7 @@ void TagAction::execute(bool blocking)
timer = new TQTimer(this);
connect(timer, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout()));
timer->start(180*1000, true);
- QExtFileInfo internalFileInfo;
+ TQExtFileInfo internalFileInfo;
loopStarted = true;
m_killCount = 0;
internalFileInfo.enter_loop();
@@ -1008,7 +1008,7 @@ void TagAction::execute(bool blocking)
/** Timeout occurred while waiting for some network function to return. */
void TagAction::slotTimeout()
{
- if ((m_killCount == 0) && (KMessageBox::questionYesNo(m_parentMainWindow, i18n("<qt>The filtering action <b>%1</b> seems to be locked.<br>Do you want to terminate it?</qt>").arg(actionText()), i18n("Action Not Responding"), i18n("Terminate"), i18n("Keep Running")) == KMessageBox::Yes))
+ if ((m_killCount == 0) && (KMessageBox::questionYesNo(m_parentMainWindow, i18n("<qt>The filtering action <b>%1</b> seems to be locked.<br>Do you want to terminate it?</qt>").tqarg(actionText()), i18n("Action Not Responding"), i18n("Terminate"), i18n("Keep Running")) == KMessageBox::Yes))
{
if (::kill(-proc->pid(), SIGTERM))
{
@@ -1021,7 +1021,7 @@ void TagAction::slotTimeout()
::kill(-proc->pid(), SIGKILL);
if (loopStarted)
{
- qApp->exit_loop();
+ tqApp->exit_loop();
loopStarted = false;
}
return;
@@ -1055,19 +1055,19 @@ void TagAction::applyTagInSelection(Node* start_node, int start_offset, Node* en
Node* nodeCursor = start_node;
Node* nodeParent = start_node;
if (nodeParent->tag->type == Tag::Text)
- nodeParent = nodeParent->parent;
+ nodeParent = nodeParent->tqparent;
- //Checking if at least one parent of node can have a Text Node as child, otherwise
+ //Checking if at least one tqparent of node can have a Text Node as child, otherwise
//it is impossible for the
- //user to add this node. In that case, try to insert the Node in the closest parent accepting it.
+ //user to add this node. In that case, try to insert the Node in the closest tqparent accepting it.
//e.g. TR : a normal insertion would require to have the caret in the TABLE Node, but it is
//impossible
- QTag* nodeQTag = QuantaCommon::tagFromDTD(w->defaultDTD(), node->tag->name);
- if (!nodeQTag) return;
+ TQTag* nodeTQTag = QuantaCommon::tagFromDTD(w->defaultDTD(), node->tag->name);
+ if (!nodeTQTag) return;
bool specialTagInsertion = false;
- TQPtrList<QTag> qTagList = nodeQTag->parents();
- QTag* qTag = 0;
+ TQPtrList<TQTag> qTagList = nodeTQTag->tqparents();
+ TQTag* qTag = 0;
for (qTag = qTagList.first(); qTag; qTag = qTagList.next())
{
if (qTag->isChild("#text", false))
@@ -1080,11 +1080,11 @@ void TagAction::applyTagInSelection(Node* start_node, int start_offset, Node* en
if (specialTagInsertion) // Attention: not smartTagInsertion
{
- //let's try to insert this node in the closest parent accepting it.
+ //let's try to insert this node in the closest tqparent accepting it.
while (nodeParent)
{
- QTag* nodeParentQTag = QuantaCommon::tagFromDTD(w->defaultDTD(), nodeParent->tag->name);
- if (nodeParentQTag && nodeParentQTag->isChild(node))
+ TQTag* nodeParentTQTag = QuantaCommon::tagFromDTD(w->defaultDTD(), nodeParent->tag->name);
+ if (nodeParentTQTag && nodeParentTQTag->isChild(node))
{
nodeCursor = kafkaCommon::createMandatoryNodeSubtree(node, w);
start_offset = 0;
@@ -1092,10 +1092,10 @@ void TagAction::applyTagInSelection(Node* start_node, int start_offset, Node* en
nodeTreeModified = true;
break;
}
- nodeParent = nodeParent->parent;
+ nodeParent = nodeParent->tqparent;
}
}
- else if(!nodeQTag->isSingle())
+ else if(!nodeTQTag->isSingle())
{
//If some text is selected in kafka, surround the selection with the new Node.
if(!start_node|| !end_node)
@@ -1248,15 +1248,15 @@ void TagAction::deapplyTagInSelection(Node* start_node, int start_offset, Node*
Node* common_parent_start_child = kafkaCommon::getCommonParentChild(start_node, tag_parent);
Node* common_parent_end_child = kafkaCommon::getCommonParentChild(end_node, tag_parent);
- Node* parent_of_tag_parent = tag_parent->parent;
+ Node* tqparent_of_tag_parent = tag_parent->tqparent;
if(common_parent_end_child == common_parent_start_child)
common_parent_end_child = 0;
if(!common_parent_start_child)
common_parent_start_child = kafkaCommon::getCommonParentChild(start_node, commonParent);
- kafkaCommon::moveNode(common_parent_start_child, parent_of_tag_parent, tag_parent, selection, modifs, true, true);
+ kafkaCommon::moveNode(common_parent_start_child, tqparent_of_tag_parent, tag_parent, selection, modifs, true, true);
if(common_parent_end_child)
- kafkaCommon::moveNode(common_parent_end_child, parent_of_tag_parent, tag_parent, selection, modifs, true, true);
+ kafkaCommon::moveNode(common_parent_end_child, tqparent_of_tag_parent, tag_parent, selection, modifs, true, true);
// Remove tag_parent node subtree if empty
if(!tag_parent->hasChildNodes())