Commit 56acddac authored by Jekyll Wu's avatar Jekyll Wu

Add 'Clone Tab' action for cloning current tab

This action will create new tab/session using the same settings(command,
colors, etc) used in current tab/session.

At this moment, this action does not always clone current tab/session
100%. For example, If you change the scrollback setting of current
session temporarily through context menu or dbus method, this action
won't clone the temporary change. Another example is the tab title.

On the other hand, this action works quite well with command line
options(-e, -p, etc) and the 'konsoleprofile' utility.

FEATURE:254976
FEATURE:292518
FIXED-IN:4.9.0

REVIEW:103859

DIGEST:
parent a730d311
<!DOCTYPE kpartgui>
<kpartgui name="konsole" version="8">
<kpartgui name="konsole" version="9">
<MenuBar>
<Menu name="file"><text>File</text>
<Action name="new-window"/>
<Action name="new-tab"/>
<Action name="clone-tab"/>
<Separator/>
<DefineGroup name="session-tab-operations"/>
<!-- <Action name="remote-connection"/> !-->
<Separator/>
......
......@@ -260,6 +260,13 @@ void MainWindow::setupActions()
connect(_newTabMenuAction, SIGNAL(triggered()), this, SLOT(newTab()));
collection->addAction("new-tab", _newTabMenuAction);
action = collection->addAction("clone-tab");
action->setIcon( KIcon("tab-duplicate") );
action->setText( i18n("&Clone Tab") );
action->setShortcut( QKeySequence() );
action->setAutoRepeat( false );
connect( action , SIGNAL(triggered()) , this , SLOT(cloneTab()) );
action = collection->addAction("new-window");
action->setIcon(KIcon("window-new"));
action->setText(i18n("New &Window"));
......@@ -394,6 +401,22 @@ void MainWindow::newTab()
emit newSessionRequest(defaultProfile , activeSessionDir() , _viewManager);
}
void MainWindow::cloneTab()
{
Q_ASSERT(_pluggedController);
Session* session = _pluggedController->session();
Profile::Ptr profile = SessionManager::instance()->sessionProfile(session);
if ( profile) {
emit newSessionRequest( profile , activeSessionDir() , _viewManager);
}
else {
// something must be wrong: every session should be associated with profile
Q_ASSERT(false);
newTab();
}
}
void MainWindow::newWindow()
{
Profile::Ptr defaultProfile = SessionManager::instance()->defaultProfile();
......
......@@ -145,6 +145,7 @@ protected:
private slots:
void newTab();
void cloneTab();
void newWindow();
void showManageProfilesDialog();
void activateMenuBar();
......@@ -185,6 +186,7 @@ private:
BookmarkHandler* _bookmarkHandler;
KToggleAction* _toggleMenuBarAction;
KActionMenu* _newTabMenuAction;
KActionMenu* _cloneTabMenuAction;
QPointer<SessionController> _pluggedController;
......
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