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

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.



parent a730d311
<!DOCTYPE kpartgui>
<kpartgui name="konsole" version="8">
<kpartgui name="konsole" version="9">
<Menu name="file"><text>File</text>
<Action name="new-window"/>
<Action name="new-tab"/>
<Action name="clone-tab"/>
<DefineGroup name="session-tab-operations"/>
<!-- <Action name="remote-connection"/> !-->
......@@ -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->setText(i18n("New &Window"));
......@@ -394,6 +401,22 @@ void MainWindow::newTab()
emit newSessionRequest(defaultProfile , activeSessionDir() , _viewManager);
void MainWindow::cloneTab()
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
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;
Supports Markdown
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