Index: src/mainwindow.cpp =================================================================== --- src/mainwindow.cpp +++ src/mainwindow.cpp @@ -387,19 +387,31 @@ connect(selectAction, SIGNAL(triggered(int)), m_viewContainer, SLOT(changeViewCharset(int))); actionCollection()->addAction(QStringLiteral("tab_encoding"), selectAction); - QSignalMapper* tabSelectionMapper = new QSignalMapper(this); - connect(tabSelectionMapper, SIGNAL(mapped(int)), m_viewContainer, SLOT(goToView(int))); + QSignalMapper* selectionMapper = new QSignalMapper(this); + connect(selectionMapper, SIGNAL(mapped(int)), m_viewContainer, SLOT(goToChan(int))); for (uint i = 1; i <= 10; ++i) { + action = new QAction(this); + action->setText(i18n("Go to Channel %1", i)); + connect(action, SIGNAL(triggered()), selectionMapper, SLOT(map())); + actionCollection()->addAction(QString(QStringLiteral("go_to_chan_%1")).arg(i), action); + actionCollection()->setDefaultShortcut(action, QKeySequence(QString(QStringLiteral("Alt+%1")).arg(i%10))); - action=new QAction(this); - action->setText(i18n("Go to Tab %1",i)); - actionCollection()->setDefaultShortcut(action,QKeySequence(QString(QStringLiteral("Alt+%1")).arg(i%10))); - connect(action, SIGNAL(triggered()), tabSelectionMapper, SLOT(map())); - actionCollection()->addAction(QString(QStringLiteral("go_to_tab_%1")).arg(i), action); + selectionMapper->setMapping(action, i-1); + } + + selectionMapper = new QSignalMapper(this); + connect(selectionMapper, SIGNAL(mapped(int)), m_viewContainer, SLOT(goToServ(int))); + for (uint i = 1; i <= 10; ++i) + { + action = new QAction(this); + action->setText(i18n("Go to Server %1",i)); + connect(action, SIGNAL(triggered()), selectionMapper, SLOT(map())); + actionCollection()->addAction(QString(QStringLiteral("go_to_serv_%1")).arg(i), action); + actionCollection()->setDefaultShortcut(action, QKeySequence(QString(QStringLiteral("Alt+Shift+%1")).arg(i%10))); - tabSelectionMapper->setMapping(action, i-1); + selectionMapper->setMapping(action, i-1); } action=new QAction(this); Index: src/viewer/viewcontainer.h =================================================================== --- src/viewer/viewcontainer.h +++ src/viewer/viewcontainer.h @@ -143,6 +143,8 @@ void showView(ChatWindow* view); void goToView(int page); + void goToChan(int page); + void goToServ(int page); void showNextView(); void showPreviousView(); void showNextActiveView(); @@ -267,6 +269,7 @@ void updateViewActions(int index); void updateFrontView(); + void updateServerChatWindowList(); void setFrontServer(Server *); void initializeSplitterSizes(); @@ -302,6 +305,7 @@ int m_queryViewCount; QList m_activeViewOrderList; + QList m_serverChatWindowList; ViewSpringLoader* m_viewSpringLoader; }; Index: src/viewer/viewcontainer.cpp =================================================================== --- src/viewer/viewcontainer.cpp +++ src/viewer/viewcontainer.cpp @@ -1796,6 +1796,55 @@ goToView(m_tabWidget->currentIndex()-1); } +// Change the current index only in the context of the channels of the current server. +void ViewContainer::goToChan(int page) +{ + if (m_currentView == NULL || m_frontServer == NULL) + return; + + int offset = m_tabWidget->indexOf(m_frontServer->getStatusView()) + 1; + int maxIndex = m_frontServer->getChannelList().size(); + if (maxIndex == 0) + return; + int realIndex = (page % maxIndex) + offset; + + if (realIndex == m_tabWidget->currentIndex()) + return; + + if (realIndex >= 0 && realIndex < m_tabWidget->count()) + { + m_tabWidget->setCurrentIndex(realIndex); + m_popupViewIndex = -1; + } +} + +// Change the current index only in the context of the connected servers. +void ViewContainer::goToServ(int page) +{ + updateServerChatWindowList(); + + int index = page % m_serverChatWindowList.size(); + int realIndex = m_tabWidget->indexOf(m_serverChatWindowList[index]); + if (realIndex == m_tabWidget->currentIndex()) + return; + + if (realIndex >= 0 && realIndex < m_tabWidget->count()) + { + m_tabWidget->setCurrentIndex(realIndex); + m_popupViewIndex = -1; + } +} + +void ViewContainer::updateServerChatWindowList() +{ + QList serverList = Application::instance()->getConnectionManager()->getServerList(); + QList serverChatWindowList; + for (int i = 0; i < serverList.size(); ++i) + serverChatWindowList.append(serverList[i]->getStatusView()); + + m_serverChatWindowList = serverChatWindowList; +} + void ViewContainer::showNextActiveView() { if (m_window->isHidden())