| 22 | using namespace Konsole; |
| 23 | |
| 24 | CopyInputDialog::CopyInputDialog(QWidget *parent) |
| 25 | : QDialog(parent) |
| 26 | , _ui(nullptr) |
| 27 | , _model(nullptr) |
| 28 | , _masterSession(nullptr) |
| 29 | { |
| 30 | setWindowTitle(i18n("Copy Input")); |
| 31 | auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
| 32 | auto mainWidget = new QWidget(this); |
| 33 | auto mainLayout = new QVBoxLayout; |
| 34 | setLayout(mainLayout); |
| 35 | mainLayout->addWidget(mainWidget); |
| 36 | QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); |
| 37 | okButton->setDefault(true); |
| 38 | connect(buttonBox, &QDialogButtonBox::accepted, this, &CopyInputDialog::accept); |
| 39 | connect(buttonBox, &QDialogButtonBox::rejected, this, &CopyInputDialog::reject); |
| 40 | mainLayout->addWidget(buttonBox); |
| 41 | |
| 42 | setWindowModality(Qt::WindowModal); |
| 43 | |
| 44 | _ui = new Ui::CopyInputDialog(); |
| 45 | _ui->setupUi(mainWidget); |
| 46 | |
| 47 | connect(_ui->selectAllButton, &QPushButton::clicked, this, &Konsole::CopyInputDialog::selectAll); |
| 48 | connect(_ui->deselectAllButton, &QPushButton::clicked, this, &Konsole::CopyInputDialog::deselectAll); |
| 49 | |
| 50 | _ui->filterEdit->setClearButtonEnabled(true); |
| 51 | _ui->filterEdit->setFocus(); |
| 52 | |
| 53 | _model = new CheckableSessionModel(parent); |
| 54 | _model->setCheckColumn(1); |
| 55 | _model->setSessions(SessionManager::instance()->sessions()); |
| 56 | |
| 57 | auto filterProxyModel = new QSortFilterProxyModel(this); |
| 58 | filterProxyModel->setDynamicSortFilter(true); |
| 59 | filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
| 60 | filterProxyModel->setSourceModel(_model); |
| 61 | filterProxyModel->setFilterKeyColumn(-1); |
| 62 | |
| 63 | connect(_ui->filterEdit, &QLineEdit::textChanged, filterProxyModel, &QSortFilterProxyModel::setFilterFixedString); |
| 64 | |
| 65 | _ui->sessionList->setModel(filterProxyModel); |
| 66 | _ui->sessionList->setColumnHidden(0, true); // Hide number column |
| 67 | _ui->sessionList->header()->hide(); |
| 68 | } |
| 69 | |
| 70 | CopyInputDialog::~CopyInputDialog() |
| 71 | { |
nothing calls this directly
no test coverage detected