summaryrefslogtreecommitdiffstats
path: root/konq-plugins/rellinks/plugin_rellinks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'konq-plugins/rellinks/plugin_rellinks.cpp')
-rw-r--r--konq-plugins/rellinks/plugin_rellinks.cpp114
1 files changed, 57 insertions, 57 deletions
diff --git a/konq-plugins/rellinks/plugin_rellinks.cpp b/konq-plugins/rellinks/plugin_rellinks.cpp
index 212c37f..14a47a3 100644
--- a/konq-plugins/rellinks/plugin_rellinks.cpp
+++ b/konq-plugins/rellinks/plugin_rellinks.cpp
@@ -24,8 +24,8 @@
// Qt includes
-#include <qapplication.h>
-#include <qtimer.h>
+#include <tqapplication.h>
+#include <tqtimer.h>
// KDE include
#include <dom/dom_doc.h>
@@ -61,7 +61,7 @@ K_EXPORT_COMPONENT_FACTORY( librellinksplugin, RelLinksFactory("rellinks") )
#endif
/** Constructor of the plugin. */
-RelLinksPlugin::RelLinksPlugin(QObject *parent, const char *name, const QStringList &)
+RelLinksPlugin::RelLinksPlugin(TQObject *parent, const char *name, const TQStringList &)
: KParts::Plugin( parent, name ),
m_part(0),
m_viewVisible(false)
@@ -70,28 +70,28 @@ RelLinksPlugin::RelLinksPlugin(QObject *parent, const char *name, const QStringL
setInstance(RelLinksFactory::instance());
// ------------- Navigation links --------------
- kaction_map["home"] = new KAction( i18n("&Top"), "2uparrow", KShortcut("Ctrl+Alt+T"), this, SLOT(goHome()), actionCollection(), "rellinks_top" );
+ kaction_map["home"] = new KAction( i18n("&Top"), "2uparrow", KShortcut("Ctrl+Alt+T"), this, TQT_SLOT(goHome()), actionCollection(), "rellinks_top" );
kaction_map["home"]->setWhatsThis( i18n("<p>This link references a home page or the top of some hierarchy.</p>") );
- kaction_map["up"] = new KAction( i18n("&Up"), "1uparrow", KShortcut("Ctrl+Alt+U"), this, SLOT(goUp()), actionCollection(), "rellinks_up" );
+ kaction_map["up"] = new KAction( i18n("&Up"), "1uparrow", KShortcut("Ctrl+Alt+U"), this, TQT_SLOT(goUp()), actionCollection(), "rellinks_up" );
kaction_map["up"]->setWhatsThis( i18n("<p>This link references the immediate parent of the current document.</p>") );
- bool isRTL = QApplication::reverseLayout();
+ bool isRTL = TQApplication::reverseLayout();
- kaction_map["begin"] = new KAction( i18n("&First"), isRTL ? "2rightarrow" : "2leftarrow", KShortcut("Ctrl+Alt+F"), this, SLOT(goFirst()), actionCollection(), "rellinks_first" );
+ kaction_map["begin"] = new KAction( i18n("&First"), isRTL ? "2rightarrow" : "2leftarrow", KShortcut("Ctrl+Alt+F"), this, TQT_SLOT(goFirst()), actionCollection(), "rellinks_first" );
kaction_map["begin"]->setWhatsThis( i18n("<p>This link type tells search engines which document is considered by the author to be the starting point of the collection.</p>") );
- kaction_map["prev"] = new KAction( i18n("&Previous"), isRTL ? "1rightarrow" : "1leftarrow", KShortcut("Ctrl+Alt+P"), this, SLOT(goPrevious()), actionCollection(), "rellinks_previous" );
+ kaction_map["prev"] = new KAction( i18n("&Previous"), isRTL ? "1rightarrow" : "1leftarrow", KShortcut("Ctrl+Alt+P"), this, TQT_SLOT(goPrevious()), actionCollection(), "rellinks_previous" );
kaction_map["prev"]->setWhatsThis( i18n("<p>This link references the previous document in an ordered series of documents.</p>") );
- kaction_map["next"] = new KAction( i18n("&Next"), isRTL ? "1leftarrow" : "1rightarrow", KShortcut("Ctrl+Alt+N"), this, SLOT(goNext()), actionCollection(), "rellinks_next" );
+ kaction_map["next"] = new KAction( i18n("&Next"), isRTL ? "1leftarrow" : "1rightarrow", KShortcut("Ctrl+Alt+N"), this, TQT_SLOT(goNext()), actionCollection(), "rellinks_next" );
kaction_map["next"]->setWhatsThis( i18n("<p>This link references the next document in an ordered series of documents.</p>") );
- kaction_map["last"] = new KAction( i18n("&Last"), isRTL ? "2leftarrow" : "2rightarrow", KShortcut("Ctrl+Alt+L"), this, SLOT(goLast()), actionCollection(), "rellinks_last" );
+ kaction_map["last"] = new KAction( i18n("&Last"), isRTL ? "2leftarrow" : "2rightarrow", KShortcut("Ctrl+Alt+L"), this, TQT_SLOT(goLast()), actionCollection(), "rellinks_last" );
kaction_map["last"]->setWhatsThis( i18n("<p>This link references the end of a sequence of documents.</p>") );
// ------------ special items --------------------------
- kaction_map["search"] = new KAction( i18n("&Search"), "filefind", KShortcut("Ctrl+Alt+S"), this, SLOT(goSearch()), actionCollection(), "rellinks_search" );
+ kaction_map["search"] = new KAction( i18n("&Search"), "filefind", KShortcut("Ctrl+Alt+S"), this, TQT_SLOT(goSearch()), actionCollection(), "rellinks_search" );
kaction_map["search"]->setWhatsThis( i18n("<p>This link references the search.</p>") );
// ------------ Document structure links ---------------
@@ -99,39 +99,39 @@ RelLinksPlugin::RelLinksPlugin(QObject *parent, const char *name, const QStringL
m_document->setWhatsThis( i18n("<p>This menu contains the links referring the document information.</p>") );
m_document->setDelayed(false);
- kaction_map["contents"] = new KAction( i18n("Table of &Contents"), "contents", KShortcut("Ctrl+Alt+C"), this, SLOT(goContents()), actionCollection(), "rellinks_toc" );
+ kaction_map["contents"] = new KAction( i18n("Table of &Contents"), "contents", KShortcut("Ctrl+Alt+C"), this, TQT_SLOT(goContents()), actionCollection(), "rellinks_toc" );
m_document->insert(kaction_map["contents"]);
kaction_map["contents"]->setWhatsThis( i18n("<p>This link references the table of contents.</p>") );
kactionmenu_map["chapter"] = new KActionMenu( i18n("Chapters"), "fileopen", actionCollection(), "rellinks_chapters" );
m_document->insert(kactionmenu_map["chapter"]);
- connect( kactionmenu_map["chapter"]->popupMenu(), SIGNAL( activated( int ) ), this, SLOT(goChapter(int)));
+ connect( kactionmenu_map["chapter"]->popupMenu(), TQT_SIGNAL( activated( int ) ), this, TQT_SLOT(goChapter(int)));
kactionmenu_map["chapter"]->setWhatsThis( i18n("<p>This menu references the chapters of the document.</p>") );
kactionmenu_map["chapter"]->setDelayed(false);
kactionmenu_map["section"] = new KActionMenu( i18n("Sections"), "fileopen", actionCollection(), "rellinks_sections" );
m_document->insert(kactionmenu_map["section"]);
- connect( kactionmenu_map["section"]->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( goSection( int ) ) );
+ connect( kactionmenu_map["section"]->popupMenu(), TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( goSection( int ) ) );
kactionmenu_map["section"]->setWhatsThis( i18n("<p>This menu references the sections of the document.</p>") );
kactionmenu_map["section"]->setDelayed(false);
kactionmenu_map["subsection"] = new KActionMenu( i18n("Subsections"), "fileopen", actionCollection(), "rellinks_subsections" );
m_document->insert(kactionmenu_map["subsection"]);
- connect( kactionmenu_map["subsection"]->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( goSubsection( int ) ) );
+ connect( kactionmenu_map["subsection"]->popupMenu(), TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( goSubsection( int ) ) );
kactionmenu_map["subsection"]->setWhatsThis( i18n("<p>This menu references the subsections of the document.</p>") );
kactionmenu_map["subsection"]->setDelayed(false);
kactionmenu_map["appendix"] = new KActionMenu( i18n("Appendix"), "edit", actionCollection(), "rellinks_appendix" );
m_document->insert(kactionmenu_map["appendix"]);
- connect( kactionmenu_map["appendix"]->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( goAppendix( int ) ) );
+ connect( kactionmenu_map["appendix"]->popupMenu(), TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( goAppendix( int ) ) );
kactionmenu_map["appendix"]->setWhatsThis( i18n("<p>This link references the appendix.</p>") );
kactionmenu_map["appendix"]->setDelayed(false);
- kaction_map["glossary"] = new KAction( i18n("&Glossary"), "flag", KShortcut("Ctrl+Alt+G"), this, SLOT(goGlossary()), actionCollection(), "rellinks_glossary" );
+ kaction_map["glossary"] = new KAction( i18n("&Glossary"), "flag", KShortcut("Ctrl+Alt+G"), this, TQT_SLOT(goGlossary()), actionCollection(), "rellinks_glossary" );
m_document->insert(kaction_map["glossary"]);
kaction_map["glossary"]->setWhatsThis( i18n("<p>This link references the glossary.</p>") );
- kaction_map["index"] = new KAction( i18n("&Index"), "info", KShortcut("Ctrl+Alt+I"), this, SLOT(goIndex()), actionCollection(), "rellinks_index" );
+ kaction_map["index"] = new KAction( i18n("&Index"), "info", KShortcut("Ctrl+Alt+I"), this, TQT_SLOT(goIndex()), actionCollection(), "rellinks_index" );
m_document->insert(kaction_map["index"]);
kaction_map["index"]->setWhatsThis( i18n("<p>This link references the index.</p>") );
@@ -140,35 +140,35 @@ RelLinksPlugin::RelLinksPlugin(QObject *parent, const char *name, const QStringL
m_more->setWhatsThis( i18n("<p>This menu contains other important links.</p>") );
m_more->setDelayed(false);
- kaction_map["help"] = new KAction( i18n("&Help"), "help", KShortcut("Ctrl+Alt+H"), this, SLOT(goHelp()), actionCollection(), "rellinks_help" );
+ kaction_map["help"] = new KAction( i18n("&Help"), "help", KShortcut("Ctrl+Alt+H"), this, TQT_SLOT(goHelp()), actionCollection(), "rellinks_help" );
m_more->insert(kaction_map["help"]);
kaction_map["help"]->setWhatsThis( i18n("<p>This link references the help.</p>") );
- kaction_map["author"] = new KAction( i18n("&Authors"), "mail_new", KShortcut("Ctrl+Alt+A"), this, SLOT(goAuthor()), actionCollection(), "rellinks_authors" );
+ kaction_map["author"] = new KAction( i18n("&Authors"), "mail_new", KShortcut("Ctrl+Alt+A"), this, TQT_SLOT(goAuthor()), actionCollection(), "rellinks_authors" );
m_more->insert(kaction_map["author"]);
kaction_map["author"]->setWhatsThis( i18n("<p>This link references the author.</p>") );
- kaction_map["copyright"] = new KAction( i18n("Copy&right"), "signature", KShortcut("Ctrl+Alt+R"), this, SLOT(goCopyright()), actionCollection(), "rellinks_copyright" );
+ kaction_map["copyright"] = new KAction( i18n("Copy&right"), "signature", KShortcut("Ctrl+Alt+R"), this, TQT_SLOT(goCopyright()), actionCollection(), "rellinks_copyright" );
m_more->insert(kaction_map["copyright"]);
kaction_map["copyright"]->setWhatsThis( i18n("<p>This link references the copyright.</p>") );
kactionmenu_map["bookmark"] = new KActionMenu( i18n("Bookmarks"), "bookmark_folder", actionCollection(), "rellinks_bookmarks" );
m_more->insert(kactionmenu_map["bookmark"]);
kactionmenu_map["bookmark"]->setWhatsThis( i18n("<p>This menu references the bookmarks.</p>") );
- connect( kactionmenu_map["bookmark"]->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( goBookmark( int ) ) );
+ connect( kactionmenu_map["bookmark"]->popupMenu(), TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( goBookmark( int ) ) );
kactionmenu_map["bookmark"]->setDelayed(false);
kactionmenu_map["alternate"] = new KActionMenu( i18n("Other Versions"), "attach", actionCollection(), "rellinks_other_versions" );
m_more->insert(kactionmenu_map["alternate"]);
kactionmenu_map["alternate"]->setWhatsThis( i18n("<p>This link references the alternate versions of this document.</p>") );
- connect( kactionmenu_map["alternate"]->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( goAlternate( int ) ) );
+ connect( kactionmenu_map["alternate"]->popupMenu(), TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( goAlternate( int ) ) );
kactionmenu_map["alternate"]->setDelayed(false);
// Unclassified menu
m_links = new KActionMenu( i18n("Miscellaneous"), "rellinks", actionCollection(), "rellinks_links" );
kactionmenu_map["unclassified"] = m_links;
kactionmenu_map["unclassified"]->setWhatsThis( i18n("<p>Miscellaneous links.</p>") );
- connect( kactionmenu_map["unclassified"]->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( goAllElements( int ) ) );
+ connect( kactionmenu_map["unclassified"]->popupMenu(), TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( goAllElements( int ) ) );
kactionmenu_map["unclassified"]->setDelayed(false);
// We unactivate all the possible actions
@@ -179,22 +179,22 @@ RelLinksPlugin::RelLinksPlugin(QObject *parent, const char *name, const QStringL
if (!m_part)
return;
- connect( m_part, SIGNAL( docCreated() ), this, SLOT( newDocument() ) );
- connect( m_part, SIGNAL( completed() ), this, SLOT( loadingFinished() ) );
+ connect( m_part, TQT_SIGNAL( docCreated() ), this, TQT_SLOT( newDocument() ) );
+ connect( m_part, TQT_SIGNAL( completed() ), this, TQT_SLOT( loadingFinished() ) );
// create polling timer and connect it
- m_pollTimer = new QTimer(this, "polling timer");
- connect( m_pollTimer, SIGNAL( timeout() ), this, SLOT( updateToolbar() ) );
+ m_pollTimer = new TQTimer(this, "polling timer");
+ connect( m_pollTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( updateToolbar() ) );
// delay access to our part's members until it has finished its initialisation
- QTimer::singleShot(0, this, SLOT(delayedSetup()));
+ TQTimer::singleShot(0, this, TQT_SLOT(delayedSetup()));
}
/** Destructor */
RelLinksPlugin::~RelLinksPlugin() {
}
-bool RelLinksPlugin::eventFilter(QObject *watched, QEvent* event) {
+bool RelLinksPlugin::eventFilter(TQObject *watched, TQEvent* event) {
if (m_part == 0) return false;
if (watched == 0 || event == 0) return false;
@@ -203,17 +203,17 @@ bool RelLinksPlugin::eventFilter(QObject *watched, QEvent* event) {
{
switch (event->type())
{
- case QEvent::Show:
+ case TQEvent::Show:
m_viewVisible = true;
updateToolbar();
break;
- case QEvent::Hide:
+ case TQEvent::Hide:
m_viewVisible = false;
updateToolbar();
break;
- case QEvent::Close:
+ case TQEvent::Close:
m_pollTimer->stop();
m_view->removeEventFilter(this);
break;
@@ -277,11 +277,11 @@ void RelLinksPlugin::updateToolbar() {
// --- Retrieve of the relation type --
- QString rel = e.getAttribute( "rel" ).string();
+ TQString rel = e.getAttribute( "rel" ).string();
rel = rel.simplifyWhiteSpace();
if (rel.isEmpty()) {
// If the "rel" attribut is null then use the "rev" attribute...
- QString rev = e.getAttribute( "rev" ).string();
+ TQString rev = e.getAttribute( "rev" ).string();
rev = rev.simplifyWhiteSpace();
if (rev.isEmpty()) {
// if "rev" attribut is also empty => ignore
@@ -291,18 +291,18 @@ void RelLinksPlugin::updateToolbar() {
rel = transformRevToRel(rev);
}
// Determin the name used internally
- QString lrel = getLinkType(rel.lower());
+ TQString lrel = getLinkType(rel.lower());
// relation to ignore
if (lrel.isEmpty()) continue;
// kdDebug() << "lrel=" << lrel << endl;
// -- Retrieve of other usefull informations --
- QString href = e.getAttribute( "href" ).string();
+ TQString href = e.getAttribute( "href" ).string();
// if nowhere to go, ignore the link
if (href.isEmpty()) continue;
- QString title = e.getAttribute( "title" ).string();
- QString hreflang = e.getAttribute( "hreflang" ).string();
+ TQString title = e.getAttribute( "title" ).string();
+ TQString hreflang = e.getAttribute( "hreflang" ).string();
KURL ref( m_part->url(), href );
if ( title.isEmpty() )
@@ -378,23 +378,23 @@ void RelLinksPlugin::guessRelations()
// - We make sure that the number is followed by a dot, a &, or the end, we
// don't want to match stuff like that: page.html?id=A14E12FD
// - We make also sure the number is not preceded dirrectly by others number
- QRegExp rx("^(.*[=/?&][^=/?&.\\-0-9]*)([\\d]{1,3})([.&][^/0-9]{0,15})?$");
+ TQRegExp rx("^(.*[=/?&][^=/?&.\\-0-9]*)([\\d]{1,3})([.&][^/0-9]{0,15})?$");
- const QString zeros("0000");
- QString url=m_part->url().url();
+ const TQString zeros("0000");
+ TQString url=m_part->url().url();
if(rx.search(url)!=-1)
{
uint val=rx.cap(2).toUInt();
uint lenval=rx.cap(2).length();
- QString nval_str=QString::number(val+1);
+ TQString nval_str=TQString::number(val+1);
//prepend by zeros if the original also contains zeros.
if(nval_str.length() < lenval && rx.cap(2)[0]=='0')
nval_str.prepend(zeros.left(lenval-nval_str.length()));
- QString href=rx.cap(1)+ nval_str + rx.cap(3);
+ TQString href=rx.cap(1)+ nval_str + rx.cap(3);
KURL ref( m_part->url(), href );
- QString title = i18n("[Autodetected] %1").arg(ref.prettyURL());
+ TQString title = i18n("[Autodetected] %1").arg(ref.prettyURL());
DOM::Element e= m_part->document().createElement("link");
e.setAttribute("href",href);
element_map["next"][0] = e;
@@ -403,12 +403,12 @@ void RelLinksPlugin::guessRelations()
if(val>1)
{
- nval_str=QString::number(val-1);
+ nval_str=TQString::number(val-1);
if(nval_str.length() < lenval && rx.cap(2)[0]=='0')
nval_str.prepend(zeros.left(lenval-nval_str.length()));
- QString href=rx.cap(1)+ nval_str + rx.cap(3);
+ TQString href=rx.cap(1)+ nval_str + rx.cap(3);
KURL ref( m_part->url(), href );
- QString title = i18n("[Autodetected] %1").arg(ref.prettyURL());
+ TQString title = i18n("[Autodetected] %1").arg(ref.prettyURL());
e= m_part->document().createElement("link");
e.setAttribute("href",href);
element_map["prev"][0] = e;
@@ -420,16 +420,16 @@ void RelLinksPlugin::guessRelations()
/** Menu links */
-void RelLinksPlugin::goToLink(const QString & rel, int id) {
+void RelLinksPlugin::goToLink(const TQString & rel, int id) {
// have the KHTML part open it
KHTMLPart *part = dynamic_cast<KHTMLPart *>(parent());
if (!part)
return;
DOM::Element e = element_map[rel][id];
- QString href = e.getAttribute("href").string();
+ TQString href = e.getAttribute("href").string();
KURL url( part->url(), href );
- QString target = e.getAttribute("target").string();
+ TQString target = e.getAttribute("target").string();
// URL arguments
KParts::URLArgs args;
@@ -440,7 +440,7 @@ void RelLinksPlugin::goToLink(const QString & rel, int id) {
part->browserExtension()->openURLRequest(url, args);
} else {
KURL baseURL = part->baseURL();
- QString endURL = url.prettyURL();
+ TQString endURL = url.prettyURL();
KURL realURL = KURL(baseURL, endURL);
part->browserExtension()->openURLRequest(realURL, args);
}
@@ -559,14 +559,14 @@ void RelLinksPlugin::disableAll() {
}
-QString RelLinksPlugin::getLinkType(const QString &lrel) {
+TQString RelLinksPlugin::getLinkType(const TQString &lrel) {
// Relations to ignore...
if (lrel.contains("stylesheet")
|| lrel == "script"
|| lrel == "icon"
|| lrel == "shortcut icon"
|| lrel == "prefetch" )
- return QString::null;
+ return TQString::null;
// ...known relations...
if (lrel == "top" || lrel == "origin" || lrel == "start")
@@ -596,8 +596,8 @@ QString RelLinksPlugin::getLinkType(const QString &lrel) {
return lrel;
}
-QString RelLinksPlugin::transformRevToRel(const QString &rev) {
- QString altRev = getLinkType(rev);
+TQString RelLinksPlugin::transformRevToRel(const TQString &rev) {
+ TQString altRev = getLinkType(rev);
// Known relations
if (altRev == "prev")
@@ -612,7 +612,7 @@ QString RelLinksPlugin::transformRevToRel(const QString &rev) {
return getLinkType("sibling");
//...unknown inverse relation => ignore for the moment
- return QString::null;
+ return TQString::null;
}
#include "plugin_rellinks.moc"