Commit 5afe712e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Now we can move onglet (move right or left)

use CRTL+ATL+rightkey/leftkey

svn path=/trunk/kdebase/konqueror/; revision=194421
parent dc7cba88
......@@ -956,4 +956,31 @@ void KonqFrameTabs::slotCurrentChanged( QWidget* newPage )
}
}
void KonqFrameTabs::moveTabLeft(int index)
{
if ( index == 0 )
return;
KonqFrameBase* currentFrame = m_pChildFrameList->at(index );
kdDebug()<<" currentFrame :"<<currentFrame<<" index :"<<index<<endl;
removePage(currentFrame->widget());
m_pChildFrameList->remove(currentFrame);
insertChildFrame( currentFrame, index-1 );
setCurrentPage( index-1 );
}
void KonqFrameTabs::moveTabRight(int index)
{
if ( index == count()-1 )
return;
KonqFrameBase* currentFrame = m_pChildFrameList->at(index );
kdDebug()<<" currentFrame :"<<currentFrame<<" index :"<<index<<endl;
removePage(currentFrame->widget());
m_pChildFrameList->remove(currentFrame);
insertChildFrame( currentFrame, index+1 );
setCurrentPage( index+1 );
}
#include "konq_frame.moc"
......@@ -473,6 +473,10 @@ public:
virtual void reparentFrame(QWidget * parent,
const QPoint & p, bool showIt=FALSE );
void moveTabLeft(int index);
void moveTabRight(int index);
public slots:
void slotCurrentChanged( QWidget* newPage );
......
......@@ -106,7 +106,7 @@ KonqMainWindow::KonqMainWindow( const KURL &initialURL, bool openInitialURL, con
: KParts::MainWindow( name, WDestructiveClose | WStyle_ContextHelp )
{
setPreloadedFlag( false );
if ( !s_lstViews )
s_lstViews = new QPtrList<KonqMainWindow>;
......@@ -2971,6 +2971,10 @@ void KonqMainWindow::initActions()
m_paActivateNextTab = new KAction( i18n( "Activate Next Tab" ), "tab_next", CTRL+Key_BracketRight, this, SLOT( slotActivateNextTab() ), actionCollection(), "activatenexttab" );
m_paActivatePrevTab = new KAction( i18n( "Activate Previous Tab" ), "tab_previous", CTRL+Key_BracketLeft, this, SLOT( slotActivatePrevTab() ), actionCollection(), "activateprevtab" );
m_paMoveTabLeft = new KAction( i18n("Move Tab Left"), 0 , CTRL+SHIFT+Key_Left,this, SLOT( slotMoveTabLeft()),actionCollection(),"tab_move_left");
m_paMoveTabRight = new KAction( i18n("Move Tab Right"), 0 , CTRL+SHIFT+Key_Right,this, SLOT( slotMoveTabRight()),actionCollection(),"tab_move_right");
#ifndef NDEBUG
m_paDumpDebugInfo = new KAction( i18n( "Dump Debug Info" ), "view_dump_debug_info", 0, this, SLOT( slotDumpDebugInfo() ), actionCollection(), "dumpdebuginfo" );
#endif
......@@ -3096,6 +3100,18 @@ void KonqMainWindow::initActions()
m_paLinkView->setStatusText( i18n("Sets the view as 'linked'. A linked view follows directory changes made in other linked views.") );
}
void KonqMainWindow::slotMoveTabLeft()
{
kdDebug()<<" KonqMainWindow::slotMoveTabLeft() \n";
m_pViewManager->moveTabLeft();
}
void KonqMainWindow::slotMoveTabRight()
{
kdDebug()<<" KonqMainWindow::slotMoveTabRight() \n";
m_pViewManager->moveTabRight();
}
void KonqMainWindow::updateToolBarActions( bool pendingAction /*=false*/)
{
// Enables/disables actions that depend on the current view (mostly toolbar)
......
......@@ -280,7 +280,7 @@ public:
bool isMimeTypeAssociatedWithSelf( const QString &mimeType, const KService::Ptr &offer );
void resetWindow();
static void setPreloadedFlag( bool preloaded );
static bool isPreloaded() { return s_preloaded; }
static void setPreloadedWindow( KonqMainWindow* );
......@@ -442,9 +442,13 @@ protected slots:
void slotFindClosed( KonqDirPart * dirPart );
void slotIconsChanged();
virtual bool event( QEvent* );
void slotMoveTabLeft();
void slotMoveTabRight();
protected:
static QString detectNameFilter( QString & url );
......@@ -577,6 +581,11 @@ private:
KAction *m_paMoveFiles;
KAction *m_paNewDir;
KAction *m_paMoveTabLeft;
KAction *m_paMoveTabRight;
KonqLogoAction *m_paAnimatedLogo;
KBookmarkBar *m_paBookmarkBar;
......@@ -658,7 +667,7 @@ private:
bool m_urlCompletionStarted;
bool m_bBackRightClick;
static bool s_preloaded;
static KonqMainWindow* s_preloadedWindow;
......
......@@ -336,12 +336,13 @@ void KonqViewManager::revertDocContainer()
parentContainer->widget()->setUpdatesEnabled( true );
parentContainer->setActiveChild( otherFrame );
parentContainer->activateChild();
m_pDocContainer = otherFrame;
}
KonqView* KonqViewManager::addTab(const QString &serviceType, const QString &serviceName, bool passiveMode)
{
#ifndef NDEBUG
......@@ -579,6 +580,30 @@ void KonqViewManager::removeOtherTabs( KonqFrameBase* tab )
}
void KonqViewManager::moveTabLeft()
{
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();
kdDebug()<<" tabContainer->currentPageIndex(); :"<<iTab<<endl;
tabContainer->moveTabLeft(iTab);
}
void KonqViewManager::moveTabRight()
{
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();
kdDebug()<<" tabContainer->currentPageIndex(); :"<<iTab<<endl;
tabContainer->moveTabRight(iTab);
}
void KonqViewManager::activateNextTab()
{
if (m_pDocContainer == 0L) return;
......@@ -586,7 +611,7 @@ void KonqViewManager::activateNextTab()
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
if( tabContainer->count() == 1 ) return;
int iTab = tabContainer->currentPageIndex();
iTab++;
......@@ -604,7 +629,7 @@ void KonqViewManager::activatePrevTab()
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
if( tabContainer->count() == 1 ) return;
int iTab = tabContainer->currentPageIndex();
iTab--;
......
......@@ -102,6 +102,8 @@ public:
const QString &serviceName = QString::null,
bool passiveMode = false);
/**
* Duplicates the specified tab, or else the current one if none is specified
*/
......@@ -143,6 +145,10 @@ public:
*/
void activatePrevTab();
void moveTabLeft();
void moveTabRight();
/**
* Brings the tab specified by @p view to the front of the stack
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment