~ubuntu-branches/ubuntu/saucy/konsole/saucy-proposed

« back to all changes in this revision

Viewing changes to src/RenameTabWidget.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-06-06 14:29:24 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20120606142924-1rekqv6j25lw2k41
Tags: 4:4.8.80-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright 2010 by Kurt Hindenburg <kurt.hindenburg@gmail.com>
 
3
 
 
4
    This program is free software; you can redistribute it and/or modify
 
5
    it under the terms of the GNU General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or
 
7
    (at your option) any later version.
 
8
 
 
9
    This program is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
    GNU General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU General Public License
 
15
    along with this program; if not, write to the Free Software
 
16
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
17
    02110-1301  USA.
 
18
*/
 
19
 
 
20
// Own
 
21
#include "RenameTabWidget.h"
 
22
 
 
23
// Konsole
 
24
#include "ui_RenameTabWidget.h"
 
25
 
 
26
using Konsole::RenameTabWidget;
 
27
 
 
28
RenameTabWidget::RenameTabWidget(QWidget* parent)
 
29
    : QWidget(parent)
 
30
{
 
31
    _ui = new Ui::RenameTabWidget();
 
32
    _ui->setupUi(this);
 
33
 
 
34
    _ui->tabTitleEdit->setClearButtonShown(true);
 
35
    _ui->remoteTabTitleEdit->setClearButtonShown(true);
 
36
 
 
37
    connect(_ui->tabTitleEdit, SIGNAL(textChanged(QString)), this,
 
38
            SIGNAL(tabTitleFormatChanged(QString)));
 
39
    connect(_ui->remoteTabTitleEdit, SIGNAL(textChanged(QString)), this,
 
40
            SIGNAL(remoteTabTitleFormatChanged(QString)));
 
41
 
 
42
    _ui->tabTitleFormatButton->setContext(Session::LocalTabTitle);
 
43
    connect(_ui->tabTitleFormatButton, SIGNAL(dynamicElementSelected(QString)),
 
44
            this, SLOT(insertTabTitleText(QString)));
 
45
 
 
46
    _ui->remoteTabTitleFormatButton->setContext(Session::RemoteTabTitle);
 
47
    connect(_ui->remoteTabTitleFormatButton, SIGNAL(dynamicElementSelected(QString)),
 
48
            this, SLOT(insertRemoteTabTitleText(QString)));
 
49
}
 
50
 
 
51
RenameTabWidget::~RenameTabWidget()
 
52
{
 
53
    delete _ui;
 
54
}
 
55
 
 
56
void RenameTabWidget::focusTabTitleText()
 
57
{
 
58
    _ui->tabTitleEdit->setFocus();
 
59
}
 
60
 
 
61
void RenameTabWidget::focusRemoteTabTitleText()
 
62
{
 
63
    _ui->remoteTabTitleEdit->setFocus();
 
64
}
 
65
 
 
66
void RenameTabWidget::setTabTitleText(const QString& text)
 
67
{
 
68
    _ui->tabTitleEdit->setText(text);
 
69
}
 
70
 
 
71
void RenameTabWidget::setRemoteTabTitleText(const QString& text)
 
72
{
 
73
    _ui->remoteTabTitleEdit->setText(text);
 
74
}
 
75
 
 
76
QString RenameTabWidget::tabTitleText() const
 
77
{
 
78
    return(_ui->tabTitleEdit->text());
 
79
}
 
80
 
 
81
QString RenameTabWidget::remoteTabTitleText() const
 
82
{
 
83
    return(_ui->remoteTabTitleEdit->text());
 
84
}
 
85
 
 
86
void RenameTabWidget::insertTabTitleText(const QString& text)
 
87
{
 
88
    _ui->tabTitleEdit->insert(text);
 
89
    focusTabTitleText();
 
90
}
 
91
 
 
92
void RenameTabWidget::insertRemoteTabTitleText(const QString& text)
 
93
{
 
94
    _ui->remoteTabTitleEdit->insert(text);
 
95
    focusRemoteTabTitleText();
 
96
}
 
97