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

List:       kde-devel
Subject:    Re: Tabbed Browsing usability issue
From:       Randy Pearson <blueboy () bamafolks ! com>
Date:       2002-08-04 21:31:50
[Download RAW message or body]

Hi All,

The attached patch adds the ability to switch between tabs in Konqueror using 
Shift+Left or Shift+Right keys.  I chose those keys since they are already 
used this way in Konsole.

I don't have CVS access (at least not yet), so if someone with CVS access 
would review and commit, I would appreciate it.

Thanks,
Randy



On Sun August 4 2002 03:08 pm, Huberto Gastal Mayer wrote:
> Em Sab 03 Ago 2002 14:14, Zack Rusin escreveu:
> ....
>
> > Yes, we will address that problem and implement them.
> >
> > Zack
>
> Continuing thread on usabilities in the konqueror:
> It would be very interesting, if when click in one link in an email in the
> kmail, this was opened in new tab of the instance of the konqueror that was
> opened, and not a new window of konq, therefore it would become much more
> fast. What they think?
>
> []s
> Huberto

["konqkeytabs.diff" (text/x-diff)]

Index: konqueror.rc
===================================================================
RCS file: /home/kdecvs/kde/kdebase/konqueror/konqueror.rc,v
retrieving revision 1.100
diff -u -3 -p -r1.100 konqueror.rc
--- konqueror.rc	3 Jul 2002 16:30:07 -0000	1.100
+++ konqueror.rc	4 Aug 2002 22:19:54 -0000
@@ -94,6 +94,8 @@
   <Action name="duplicatecurrenttab"/>
   <Action name="breakoffcurrenttab"/>
   <Action name="removecurrenttab"/>
+  <Action name="activatenexttab"/>
+  <Action name="activateprevtab"/>
   <Separator/>
   <ActionList name="toggleview" />
   <Separator/>
Index: konq_mainwindow.h
===================================================================
RCS file: /home/kdecvs/kde/kdebase/konqueror/konq_mainwindow.h,v
retrieving revision 1.365
diff -u -3 -p -r1.365 konq_mainwindow.h
--- konq_mainwindow.h	29 Jul 2002 17:32:04 -0000	1.365
+++ konq_mainwindow.h	4 Aug 2002 22:19:54 -0000
@@ -379,6 +379,8 @@ protected slots:
   void slotRemoveView();
   void slotRemoveTab();
   void slotRemoveTabPopup();
+  void slotActivateNextTab();
+  void slotActivatePrevTab();
   void slotDumpDebugInfo();
 
   void slotSaveViewProfile();
@@ -535,6 +537,8 @@ private:
   KAction *m_paBreakOffTab;
   KAction *m_paRemoveView;
   KAction *m_paRemoveTab;
+  KAction *m_paActivateNextTab;
+  KAction *m_paActivatePrevTab;
   KAction *m_paDumpDebugInfo;
 
   KAction *m_paSaveRemoveViewProfile;
Index: konq_mainwindow.cc
===================================================================
RCS file: /home/kdecvs/kde/kdebase/konqueror/konq_mainwindow.cc,v
retrieving revision 1.1034
diff -u -3 -p -r1.1034 konq_mainwindow.cc
--- konq_mainwindow.cc	1 Aug 2002 12:41:06 -0000	1.1034
+++ konq_mainwindow.cc	4 Aug 2002 22:19:56 -0000
@@ -2054,6 +2054,16 @@ void KonqMainWindow::slotRemoveTabPopup(
   m_pViewManager->removeTab( m_pWorkingTab );
 }
 
+void KonqMainWindow::slotActivateNextTab()
+{
+  m_pViewManager->activateNextTab();
+}
+
+void KonqMainWindow::slotActivatePrevTab()
+{
+  m_pViewManager->activatePrevTab();
+}
+
 void KonqMainWindow::slotDumpDebugInfo()
 {
 #ifndef NDEBUG
@@ -2891,6 +2901,8 @@ void KonqMainWindow::initActions()
   m_paBreakOffTab = new KAction( i18n( "Break Off Current Tab" ), "tab_breakoff", \
CTRL+SHIFT+Key_B, this, SLOT( slotBreakOffTab() ), actionCollection(), \
"breakoffcurrenttab" );  m_paRemoveView = new KAction( i18n( "&Remove Active View" \
),"view_remove", CTRL+SHIFT+Key_R, this, SLOT( slotRemoveView() ), \
actionCollection(), "removeview" );  m_paRemoveTab = new KAction( i18n( "Remove \
Current Tab" ), "tab_remove", CTRL+SHIFT+Key_W, this, SLOT( slotRemoveTab() ), \
actionCollection(), "removecurrenttab" ); +  m_paActivateNextTab = new KAction( i18n( \
"Activate Next Tab" ), "next", SHIFT+Key_Right, this, SLOT( slotActivateNextTab() ), \
actionCollection(), "activatenexttab" ); +  m_paActivatePrevTab = new KAction( i18n( \
"Activate Previous Tab" ), "previous", SHIFT+Key_Left, this, SLOT( \
slotActivatePrevTab() ), actionCollection(), "activateprevtab" );  #ifndef NDEBUG
   m_paDumpDebugInfo = new KAction( i18n( "Dump Debug Info" ), \
"view_dump_debug_info", 0, this, SLOT( slotDumpDebugInfo() ), actionCollection(), \
"dumpdebuginfo" );  #endif
@@ -3046,6 +3058,8 @@ void KonqMainWindow::updateViewActions()
     m_paDuplicateTab->setEnabled( false );
     m_paRemoveTab->setEnabled( false );
     m_paBreakOffTab->setEnabled( false );
+    m_paActivateNextTab->setEnabled( false );
+    m_paActivatePrevTab->setEnabled( false );
   }
   else
   {
@@ -3055,11 +3069,15 @@ void KonqMainWindow::updateViewActions()
     {
       m_paRemoveTab->setEnabled( true );
       m_paBreakOffTab->setEnabled( true );
+      m_paActivateNextTab->setEnabled( true );
+      m_paActivatePrevTab->setEnabled( true );
     }
     else
     {
       m_paRemoveTab->setEnabled( false );
       m_paBreakOffTab->setEnabled( false );
+      m_paActivateNextTab->setEnabled( false );
+      m_paActivatePrevTab->setEnabled( false );
     }
   }
 
Index: konq_viewmgr.h
===================================================================
RCS file: /home/kdecvs/kde/kdebase/konqueror/konq_viewmgr.h,v
retrieving revision 1.63
diff -u -3 -p -r1.63 konq_viewmgr.h
--- konq_viewmgr.h	29 Jul 2002 15:27:42 -0000	1.63
+++ konq_viewmgr.h	4 Aug 2002 22:19:57 -0000
@@ -126,6 +126,18 @@ public:
   void removeTab( KonqFrameBase* tab = 0L );
 
   /**
+   * Locates and activates the next tab
+   *
+   */
+  void activateNextTab();
+
+  /**
+   * Locates and activates the previous tab
+   *
+   */
+  void activatePrevTab();
+
+  /**
    * Brings the tab specified by @p view to the front of the stack
    *
    */
Index: konq_viewmgr.cc
===================================================================
RCS file: /home/kdecvs/kde/kdebase/konqueror/konq_viewmgr.cc,v
retrieving revision 1.191
diff -u -3 -p -r1.191 konq_viewmgr.cc
--- konq_viewmgr.cc	29 Jul 2002 15:27:42 -0000	1.191
+++ konq_viewmgr.cc	4 Aug 2002 22:19:57 -0000
@@ -549,6 +549,70 @@ void KonqViewManager::removeTab( KonqFra
 #endif
 }
 
+void KonqViewManager::activateNextTab()
+{
+  if (m_pDocContainer == 0L) return;
+  if (m_pDocContainer->frameType() != "Tabs") return;
+
+  KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
+  if( tabContainer->count() == 1 ) return;
+  
+  KonqFrameBase* currentFrame;
+  currentFrame = dynamic_cast<KonqFrameBase*>(tabContainer->currentPage());
+
+  QPtrList<KonqFrameBase> *frameList = tabContainer->childFrameList();
+
+  int iTab = frameList->findRef( currentFrame );
+
+  if( iTab != -1 )
+  {
+    iTab++;
+    if( iTab >= tabContainer->count() )
+      iTab = 0;
+  }
+  else
+  {
+#ifndef NDEBUG
+    kdDebug(1202) << "activateNextTab could not locate current frame!" << endl;
+#endif
+    return;
+  }
+
+  tabContainer->setCurrentPage( iTab );
+}
+
+void KonqViewManager::activatePrevTab()
+{
+  if (m_pDocContainer == 0L) return;
+  if (m_pDocContainer->frameType() != "Tabs") return;
+
+  KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
+  if( tabContainer->count() == 1 ) return;
+  
+  KonqFrameBase* currentFrame;
+  currentFrame = dynamic_cast<KonqFrameBase*>(tabContainer->currentPage());
+
+  QPtrList<KonqFrameBase> *frameList = tabContainer->childFrameList();
+
+  int iTab = frameList->findRef( currentFrame );
+
+  if( iTab != -1 )
+  {
+    iTab--;
+    if( iTab < 0 )
+      iTab = tabContainer->count() - 1;
+  }
+  else
+  {
+#ifndef NDEBUG
+    kdDebug(1202) << "activatePrevTab could not locate current frame!" << endl;
+#endif
+    return;
+  }
+  
+  tabContainer->setCurrentPage( iTab );
+}
+
 void KonqViewManager::showTab( KonqView *view )
 {
   static_cast<KonqFrameTabs*>( docContainer() )->showPage( view->frame() );


>> 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