[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Patch: Invert new tab policy with shift
From: Albert Cervera Areny <albertca () jazzfree ! com>
Date: 2003-08-06 21:11:07
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
With the following patch, you hit ctrl+shift+LeftClick in a link, it will
open it in a new tab but inverting your preferred policy (in
konqueror/settings). So if you have by default new tabs to be opened in
background ctrl+shift+leftclick will open it in foreground (and viceversa).
Also, with this patch if you hit ctrl+shift+enter once you've typed a new
URL it will open it in a background tab (instead of foreground as ctrl+enter
does). This, I must say doesn't work as well as it should, though... the URL
isn't updated! Could somebody point me how it could be updated?
Note that the first (ctrl+shift+leftclick) has implied modifying the
browserextension KPart, khtml and add a couple of lines in konqueror.
This is my second patch to the kde project, so I don't know whether I'm
doing the patches right or not (haven't received an answer from the first yet
;). Please, tell me any problems you find or if this is not the right list to
post.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE/MW7uTK7ZP4pDOHcRAjzIAJ4mo8/pVKuVTk/n0TaJvCPwIrK5mQCdEXR8
Rj3ruNqsPlnsO0kWhaSQoP8=
=v5oh
-----END PGP SIGNATURE-----
["khtml-diffs" (text/x-diff)]
Index: khtml_part.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_part.cpp,v
retrieving revision 1.871
diff -u -3 -p -r1.871 khtml_part.cpp
--- khtml_part.cpp 5 Aug 2003 11:36:21 -0000 1.871
+++ khtml_part.cpp 6 Aug 2003 21:02:08 -0000
@@ -2940,7 +2940,7 @@ void KHTMLPart::urlSelected( const QStri
kdDebug( 6000 ) << "urlSelected: complete URL:" << cURL.url() << " target = " << target << endl;
- if ( button == LeftButton && ( state & ShiftButton ) )
+ if ( button == LeftButton && ( state & ShiftButton ) && !(state & ControlButton))
{
KIO::MetaData metaData;
metaData["referrer"] = d->m_referrer;
@@ -3003,7 +3003,7 @@ void KHTMLPart::urlSelected( const QStri
return;
}
- if ( state & ShiftButton)
+ if ( (state & ShiftButton) && !(state & ControlButton))
{
KParts::WindowArgs winArgs;
winArgs.lowerWindow = true;
@@ -3014,6 +3014,7 @@ void KHTMLPart::urlSelected( const QStri
if ( state & ControlButton )
{
+ args.setInvertNewTabPolicy( state & ShiftButton );
args.setNewTab(true);
emit d->m_extension->createNewWindow( cURL, args );
return;
["konqueror-diffs" (text/x-diff)]
Index: konq_mainwindow.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.cc,v
retrieving revision 1.1211
diff -u -3 -p -r1.1211 konq_mainwindow.cc
--- konq_mainwindow.cc 6 Aug 2003 15:55:56 -0000 1.1211
+++ konq_mainwindow.cc 6 Aug 2003 21:00:47 -0000
@@ -405,7 +405,7 @@ QString KonqMainWindow::detectNameFilter
return nameFilter;
}
-void KonqMainWindow::openFilteredURL( const QString & _url, bool inNewTab )
+void KonqMainWindow::openFilteredURL( const QString & _url, bool inNewTab, bool inFront )
{
QString url = _url;
QString nameFilter = detectNameFilter( url );
@@ -434,7 +434,7 @@ void KonqMainWindow::openFilteredURL( co
KonqOpenURLRequest req( _url );
req.nameFilter = nameFilter;
req.newTab = inNewTab;
- req.newTabInFront = true;
+ req.newTabInFront = inFront;
openURL( 0L, filteredURL, QString::null, req );
@@ -981,6 +981,8 @@ void KonqMainWindow::slotCreateNewWindow
KonqOpenURLRequest req;
req.newTab = true;
req.newTabInFront = config->readBoolEntry( "NewTabsInFront", false );
+ if ( args.invertNewTabPolicy() )
+ req.newTabInFront = !req.newTabInFront;
req.args = args;
openURL( 0L, url, QString::null, req );
}
@@ -2195,7 +2197,7 @@ void KonqMainWindow::slotURLEntered( con
m_bURLEnterLock = true;
- openFilteredURL( text.stripWhiteSpace(), state & ControlButton );
+ openFilteredURL( text.stripWhiteSpace(), state & ControlButton, !(state & ShiftButton) );
m_bURLEnterLock = false;
}
Index: konq_mainwindow.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.h,v
retrieving revision 1.409
diff -u -3 -p -r1.409 konq_mainwindow.h
--- konq_mainwindow.h 26 Jul 2003 10:41:24 -0000 1.409
+++ konq_mainwindow.h 6 Aug 2003 21:00:48 -0000
@@ -101,7 +101,7 @@ public:
/**
* Filters the URL and calls the main openURL method.
*/
- void openFilteredURL( const QString &_url, bool inNewTab = false );
+ void openFilteredURL( const QString &_url, bool inNewTab = false, bool inFront = true );
/**
* The main openURL method.
["kparts-diffs" (text/x-diff)]
Index: browserextension.cpp
===================================================================
RCS file: /home/kde/kdelibs/kparts/browserextension.cpp,v
retrieving revision 1.56
diff -u -3 -p -r1.56 browserextension.cpp
--- browserextension.cpp 22 Jul 2003 17:01:35 -0000 1.56
+++ browserextension.cpp 6 Aug 2003 21:02:40 -0000
@@ -70,6 +70,7 @@ struct URLArgsPrivate
redirectedRequest = false;
lockHistory = false;
newTab = false;
+ invertNewTabPolicy = false;
}
QString contentType; // for POST
QMap<QString, QString> metaData;
@@ -77,6 +78,7 @@ struct URLArgsPrivate
bool redirectedRequest;
bool lockHistory;
bool newTab;
+ bool invertNewTabPolicy;
};
}
@@ -198,6 +200,18 @@ void URLArgs::setNewTab( bool newTab )
bool URLArgs::newTab() const
{
return d ? d->newTab : false;
+}
+
+void URLArgs::setInvertNewTabPolicy( bool invert )
+{
+ if (!d)
+ d = new URLArgsPrivate;
+ d->invertNewTabPolicy = invert;
+}
+
+bool URLArgs::invertNewTabPolicy() const
+{
+ return d ? d->invertNewTabPolicy : false;
}
Index: browserextension.h
===================================================================
RCS file: /home/kde/kdelibs/kparts/browserextension.h,v
retrieving revision 1.106
diff -u -3 -p -r1.106 browserextension.h
--- browserextension.h 23 Jul 2003 14:12:27 -0000 1.106
+++ browserextension.h 6 Aug 2003 21:02:41 -0000
@@ -39,7 +39,6 @@ class QString;
namespace KParts {
class BrowserInterface;
-
struct URLArgsPrivate;
/**
@@ -126,6 +125,12 @@ struct URLArgs
*/
void setNewTab( bool newTab );
bool newTab() const;
+
+ /**
+ * Whete we invert the inFront policy
+ */
+ void setInvertNewTabPolicy( bool invert );
+ bool invertNewTabPolicy() const;
/**
* Meta-data to associate with the next KIO operation
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic