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

List:       kde-devel
Subject:    Re: Tabbed Browsing usability issue
From:       Doug Hanley <hanleyman () adelphia ! net>
Date:       2002-08-05 6:46:24
[Download RAW message or body]

On Sunday 04 August 2002 05:31 pm, Randy Pearson wrote:
> 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

I like the patch, but I think it would be cleaner to use currentPageIndex(), 
i've attatched a modified version that does that, your thoughts?

btw, it also takes out some error checks that were no longer needed, and 
changes the icon names in the KActions constructors.

-- Doug Hanley
["cvskonqtabs-080402.patch" (text/x-diff)]

Index: konq_mainwindow.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.cc,v
retrieving revision 1.1034
diff -u -3 -p -r1.1034 konq_mainwindow.cc
--- konq_mainwindow.cc	2002/08/01 12:41:06	1.1034
+++ konq_mainwindow.cc	2002/08/04 23:53:33
@@ -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" ), "tab_next", SHIFT+Key_Right, this, SLOT( slotActivateNextTab() \
), actionCollection(), "activatenexttab" ); +  m_paActivatePrevTab = new KAction( \
i18n( "Activate Previous Tab" ), "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_mainwindow.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.h,v
retrieving revision 1.365
diff -u -3 -p -r1.365 konq_mainwindow.h
--- konq_mainwindow.h	2002/07/29 17:32:04	1.365
+++ konq_mainwindow.h	2002/08/04 23:53:33
@@ -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_viewmgr.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_viewmgr.cc,v
retrieving revision 1.191
diff -u -3 -p -r1.191 konq_viewmgr.cc
--- konq_viewmgr.cc	2002/07/29 15:27:42	1.191
+++ konq_viewmgr.cc	2002/08/04 23:53:34
@@ -549,6 +549,42 @@ 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;
+  
+  int iTab = tabContainer->currentPageIndex();
+  
+  iTab++;
+  
+  if( iTab == tabContainer->count() )
+    iTab = 0;
+  
+  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;
+  
+  int iTab = tabContainer->currentPageIndex();
+
+  iTab--;
+  
+  if( iTab == -1 )
+    iTab = tabContainer->count() - 1;
+  
+  tabContainer->setCurrentPage( iTab );
+}
+
 void KonqViewManager::showTab( KonqView *view )
 {
   static_cast<KonqFrameTabs*>( docContainer() )->showPage( view->frame() );
Index: konq_viewmgr.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_viewmgr.h,v
retrieving revision 1.63
diff -u -3 -p -r1.63 konq_viewmgr.h
--- konq_viewmgr.h	2002/07/29 15:27:42	1.63
+++ konq_viewmgr.h	2002/08/04 23:53:34
@@ -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: konqueror.rc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konqueror.rc,v
retrieving revision 1.100
diff -u -3 -p -r1.100 konqueror.rc
--- konqueror.rc	2002/07/03 16:30:07	1.100
+++ konqueror.rc	2002/08/04 23:53:34
@@ -94,6 +94,8 @@
   <Action name="duplicatecurrenttab"/>
   <Action name="breakoffcurrenttab"/>
   <Action name="removecurrenttab"/>
+  <Action name="activatenexttab"/>
+  <Action name="activateprevtab"/>
   <Separator/>
   <ActionList name="toggleview" />
   <Separator/>


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