[PATCH] open in new raised tab

Alexander Kellett kelletta at eidetica.com
Wed Jun 12 13:06:32 BST 2002


Here's a small patch to add "open raised in new tab" to Konqi which
fl0yd was interested in having. Opera's way of doing tabbing shows
that its probably that other people will use this.

Anyone against me commiting?

Alex

--
kelletta at eidetica.com           (lypanov)           http://lypanov.shacknet.nu
-------------- next part --------------
? .konq_mainwindow.h.swp
? crashlog.patch
? infront.patch
? client/download.patch
? history/Makefile
? history/Makefile.in
? keditbookmarks/TODO
? keditbookmarks/tests
? sidebar/konqsidebar.loT
Index: konq_guiclients.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_guiclients.cc,v
retrieving revision 1.48
diff -u -p -r1.48 konq_guiclients.cc
--- konq_guiclients.cc	2002/05/21 09:44:04	1.48
+++ konq_guiclients.cc	2002/06/12 11:50:25
@@ -117,6 +117,11 @@ PopupMenuGUIClient::PopupMenuGUIClient( 
   openInTabElement.setAttribute( "group", "tabhandling" );
   menu.appendChild( openInTabElement );
 
+  QDomElement openInTabFrontElement = m_doc.createElement( "action" );
+  openInTabFrontElement.setAttribute( "name", "openintabfront" );
+  openInTabFrontElement.setAttribute( "group", "tabhandling" );
+  menu.appendChild( openInTabFrontElement );
+
   setDOMDocument( m_doc );
 }
 
Index: konq_mainwindow.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.cc,v
retrieving revision 1.1010
diff -u -p -r1.1010 konq_mainwindow.cc
--- konq_mainwindow.cc	2002/06/05 14:28:29	1.1010
+++ konq_mainwindow.cc	2002/06/12 11:50:27
@@ -1983,12 +1983,23 @@ void KonqMainWindow::slotBreakOffTabPopu
   m_pViewManager->breakOffTab( m_pWorkingTab );
 }
 
+void KonqMainWindow::slotPopupNewTabAtFront()
+{
+  popupNewTab(true);
+}
+
 void KonqMainWindow::slotPopupNewTab()
 {
+  popupNewTab(false);
+}
+
+void KonqMainWindow::popupNewTab(bool infront)
+{
   KURL url;
   KFileItemListIterator it ( popupItems );
   QString mimeType, mimeComment;
   KonqView* newView = 0;
+  KonqView* lastView = 0;
   for ( ; it.current(); ++it )
   {
     newView = 0L;
@@ -1997,9 +2008,14 @@ void KonqMainWindow::slotPopupNewTab()
     mimeComment = (*it)->mimeComment();
     if (mimeType == "application/octet-stream") mimeType = mimeComment = "";
     newView = m_pViewManager->addTab(mimeType, mimeComment);
-    if (newView != 0L)
+    if (newView != 0L) 
+    {
       newView->openURL( url, url.prettyURL() );
+      lastView = newView;
+    }
   }
+  if (infront)
+    m_pViewManager->showTab(lastView);
 }
 
 void KonqMainWindow::slotRemoveView()
@@ -3389,6 +3405,8 @@ void KonqMainWindow::slotPopupMenu( KXML
 
   KAction *actNewTab = new KAction( i18n( "Open in New Tab" ), "tab_new", 0, this, SLOT( slotPopupNewTab() ), actionCollection(), "openintab" );
   actNewTab->setStatusText( i18n( "Open the document in a new tab" ) );
+  KAction *actNewTabFront = new KAction( i18n( "Open in Raised New Tab" ), "tab_new_raised", 0, this, SLOT( slotPopupNewTabAtFront() ), actionCollection(), "openintabfront" );
+  actNewTabFront->setStatusText( i18n( "Open the document in a new tab and raise" ) );
 
   if ( _items.count() == 1 )
     m_popupEmbeddingServices = KTrader::self()->query( _items.getFirst()->mimetype(),
Index: konq_mainwindow.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.h,v
retrieving revision 1.359
diff -u -p -r1.359 konq_mainwindow.h
--- konq_mainwindow.h	2002/06/05 01:35:24	1.359
+++ konq_mainwindow.h	2002/06/12 11:50:28
@@ -372,6 +372,7 @@ protected slots:
   void slotBreakOffTab();
   void slotBreakOffTabPopup();
   void slotPopupNewTab();
+  void slotPopupNewTabAtFront();
   void slotPopupPasteTo();
   void slotRemoveView();
   void slotRemoveTab();
@@ -488,6 +489,8 @@ private:
 
   void initCombo();
   void initActions();
+
+  void popupNewTab(bool infront);
 
   /**
    * Tries to find a index.html (.kde.html) file in the specified directory


More information about the kfm-devel mailing list