[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 83068] middle button on URL should open a new TAB in Konqueror
From:       ismail ( cartman ) donmez <ismail () kde ! org>
Date:       2010-07-01 13:57:50
Message-ID: 20100701135750.55F7E47B76 () immanuel ! kde ! org
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=83068





--- Comment #5 from ismail ( cartman ) donmez <ismail kde org>  2010-07-01 15:57:47 ---
commit cdc4d6c002c6b3f119a3d61ada1b698e3b49fb28
Author: Ä °smail DÃ ¶nmez <ismail@kde.org>
Date:   Fri Jan 28 19:30:10 2005 +0000

    Middle click on a url opens in konqueror tab if we use konqueror
    -> Doesn't play fine with preloading. Suspect a Konqi bug
    FEATURE:83068

    svn path=/trunk/kdeextragear-2/konversation/; revision=383379

diff --git a/konversation/ircview.cpp b/konversation/ircview.cpp
index bd70bc4..406c899 100644
--- a/konversation/ircview.cpp
+++ b/konversation/ircview.cpp
@@ -27,6 +27,8 @@
 #include <qmap.h>
 #include <qcolor.h>

+#include <dcopref.h>
+#include <dcopclient.h>
 #include <kmessagebox.h>
 #include <klocale.h>
 #include <kurl.h>
@@ -214,12 +216,44 @@ void IRCView::highlightedSlot(const QString& link)

 void IRCView::urlClickSlot(const QString &url)
 {
+  kdDebug() << "Called from a Qt signal " << endl;
+  urlClickSlot(url,false);
+}
+
+void IRCView::urlClickSlot(const QString &url, bool newTab)
+{
   if (!url.isEmpty() && !url.startsWith("#"))
   {
     // Always use KDE default mailer.
     if (KonversationApplication::preferences.getWebBrowserUseKdeDefault() ||
url.lower().startsWith("mailto:"))
     {
-      new KRun(KURL(url));
+      QCString konqueror_id = "";
+      
+      if(newTab)
+    {
+      QCStringList appList = kapp->dcopClient()->registeredApplications();
+      QCStringList::iterator it;
+      
+      for(it=appList.begin(); it != appList.end(); ++it)
+        {
+          kdDebug() << "Checking " << *it << endl;
+          if((*it).contains("konqueror"))
+        {
+          konqueror_id = *it;
+          kdDebug() << "Matched " << konqueror_id << endl;
+          break;
+        }
+        }
+    }
+      
+      if(!konqueror_id.isEmpty())
+    { 
+      kdDebug() << "DCOPRef" << endl;
+      DCOPRef konqueror( konqueror_id,"konqueror-mainwindow#1");
+      konqueror.call( "newTab", url );
+    }
+      else
+    new KRun(KURL(url));
     }
     else
     {
@@ -764,7 +798,7 @@ bool IRCView::eventFilter(QObject* object,QEvent* event)
     if(me->button()==QMouseEvent::MidButton)
     {
       if(copyUrlMenu) {
-        urlClickSlot(urlToCopy);
+        urlClickSlot(urlToCopy,true);
       } else {
         emit textPasted();
       }
diff --git a/konversation/ircview.h b/konversation/ircview.h
index 1ebd0b7..d45f770 100644
--- a/konversation/ircview.h
+++ b/konversation/ircview.h
@@ -98,6 +98,7 @@ class IRCView : public KTextBrowser
     void urlClickSlot(const QString &url);

   protected:
+    void urlClickSlot(const QString &url, bool newTab);
     QString filter(const QString& line,const QString& defaultColor,const
QString& who=NULL,bool doHighlight=true, bool parseURL = true);
     void doAppend(QString line, bool important = true, bool self = false);
     void replaceDecoration(QString& line,char decoration,char replacement);

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic