[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: [PATCH] Open in current window
From: jonathan_brugge <jonathan_brugge () mailcircuit ! com>
Date: 2002-04-29 19:43:55
[Download RAW message or body]
I always dislike sites that make me open way too many Konqueror-windows by
using "target=_blank" and the like when it's not needed. Now I wrote a small
patch for Konqueror, so you have the option not to open a new window but
rather open the link in the current window. I suppose I didn't use the best
way to code this, but as it's only my second look at C/C++ code I just
decided to mimic slotPopupNewTab(). At least it works and maybe someone finds
it useful. There's one (small) problem at least: the menu-option doesn't use
an icon. A good thing to implement might be to only show the 'open in current
window'-option when the link wants to open a new window, so the menu doesn't
get too cluttered with options that aren't of any use in a particular
situation.
Please tell me what's wrong with the patch if you don't like it, I don't mind
critical comments too much :).
Jonathan Brugge
["current_window_cc.diff" (text/x-diff)]
--- konq_mainwindow.cc Mon Apr 29 21:08:52 2002
+++ /home/kde3/konq_patches/konq_mainwindow.cc Mon Apr 29 21:36:13 2002
@@ -1991,6 +1991,17 @@
}
}
+void KonqMainWindow::slotOpenInCurrentWindow()
+{
+ KURL url;
+ KFileItemListIterator it ( popupItems );
+ for ( ; it.current(); ++it )
+ {
+ url = (*it)->url();
+ slotOpenURL(url);
+ }
+}
+
void KonqMainWindow::slotRemoveView()
{
// takes care of choosing the new active view
@@ -3410,12 +3421,16 @@
KAction *actNewTab = new KAction( i18n( "New Tab" ), "tab_new", 0, this, SLOT( \
slotPopupNewTab() ), &popupMenuCollection, "newtab" ); actNewTab->setStatusText( \
i18n( "Open the document in a new tab" ) );
+ KAction *actCurrentWindow = new KAction( i18n( "Current Window" ), 0, this, SLOT( \
slotOpenInCurrentWindow() ), &popupMenuCollection, "currentwindow" ); + \
actCurrentWindow->setStatusText( i18n( "Open the document in the current window" ) ); \
+ QString name;
for ( int i = 0; i < 30; i++) {
name = pPopupMenu.text(pPopupMenu.idAt(i));
if (name == i18n( "New Window" )) {
kdDebug(1202) << "Adding at index " << i+1 << endl;
actNewTab->plug( &pPopupMenu, i+1 );
+ actCurrentWindow->plug( &pPopupMenu, i+2 );
break;
}
}
["current_window_h.diff" (text/x-diff)]
--- ./konq_mainwindow.h Mon Apr 29 21:08:53 2002
+++ /home/kde3/konq_patches/konq_mainwindow.h Mon Apr 29 21:08:37 2002
@@ -370,6 +370,7 @@
void slotBreakOffTab();
void slotBreakOffTabPopup();
void slotPopupNewTab();
+ void slotOpenInCurrentWindow();
void slotRemoveView();
void slotRemoveTab();
void slotRemoveTabPopup();
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic