• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Konsole

  • kde-4.14
  • applications
  • konsole
  • src
CopyInputDialog.h
Go to the documentation of this file.
1 /*
2  Copyright 2008 by Robert Knight <robertknight@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 #ifndef COPYINPUTDIALOG_H
21 #define COPYINPUTDIALOG_H
22 
23 // Qt
24 #include <QtCore/QPointer>
25 #include <QtCore/QSet>
26 
27 // KDE
28 #include <KDialog>
29 
30 // Konsole
31 #include "SessionManager.h"
32 #include "Session.h"
33 #include "SessionListModel.h"
34 
35 namespace Ui
36 {
37 class CopyInputDialog;
38 }
39 
40 namespace Konsole
41 {
42 class CheckableSessionModel;
43 
50 class CopyInputDialog : public KDialog
51 {
52  Q_OBJECT
53 
54 public:
55  explicit CopyInputDialog(QWidget* parent = 0);
56  ~CopyInputDialog();
62  void setMasterSession(Session* master);
64  Session* masterSession() const;
65 
67  void setChosenSessions(const QSet<Session*>& sessions);
69  QSet<Session*> chosenSessions() const;
70 
71 private slots:
72  void selectAll() {
73  setSelectionChecked(true);
74  };
75  void deselectAll() {
76  setSelectionChecked(false);
77  };
78 
79 private:
80  // Checks or unchecks selected sessions. If there are no
81  // selected items then all sessions are checked or unchecked
82  void setSelectionChecked(bool checked);
83  void setRowChecked(int row, bool checked);
84 
85  Ui::CopyInputDialog* _ui;
86  CheckableSessionModel* _model;
87  QPointer<Session> _masterSession;
88 };
89 
95 class CheckableSessionModel : public SessionListModel
96 {
97  Q_OBJECT
98 
99 public:
100  explicit CheckableSessionModel(QObject* parent);
101 
102  void setCheckColumn(int column);
103  int checkColumn() const;
104 
109  void setCheckable(Session* session, bool checkable);
110 
112  void setCheckedSessions(const QSet<Session*> sessions);
114  QSet<Session*> checkedSessions() const;
115 
116  // reimplemented from QAbstractItemModel
117  virtual Qt::ItemFlags flags(const QModelIndex& index) const;
118  virtual QVariant data(const QModelIndex& index, int role) const;
119  virtual bool setData(const QModelIndex& index, const QVariant& value, int role);
120 
121 protected:
122  virtual void sessionRemoved(Session*);
123 
124 private:
125  QSet<Session*> _checkedSessions;
126  QSet<Session*> _fixedSessions;
127  int _checkColumn;
128 };
129 
130 inline int CheckableSessionModel::checkColumn() const
131 {
132  return _checkColumn;
133 }
134 }
135 
136 #endif // COPYINPUTDIALOG_H
137 
Session.h
QModelIndex
QWidget
Konsole::Session
Represents a terminal session consisting of a pseudo-teletype and a terminal emulation.
Definition: Session.h:78
Konsole::CopyInputDialog::setMasterSession
void setMasterSession(Session *master)
Sets the 'source' session whose input will be copied to other sessions.
Definition: CopyInputDialog.cpp:83
QPointer< Session >
Konsole::CheckableSessionModel::checkedSessions
QSet< Session * > checkedSessions() const
Returns the set of checked sessions.
Definition: CopyInputDialog.cpp:176
KDialog
Konsole::CopyInputDialog::setChosenSessions
void setChosenSessions(const QSet< Session * > &sessions)
Sets the sessions in the list which are checked.
Definition: CopyInputDialog.cpp:71
Konsole::SessionListModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
Definition: SessionListModel.cpp:136
Konsole::SessionListModel
Item-view model which contains a flat list of sessions.
Definition: SessionListModel.h:42
Konsole::CopyInputDialog::chosenSessions
QSet< Session * > chosenSessions() const
Set setChosenSessions()
Definition: CopyInputDialog.cpp:79
Konsole::CheckableSessionModel::setData
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
Definition: CopyInputDialog.cpp:152
QObject
Konsole::CheckableSessionModel::CheckableSessionModel
CheckableSessionModel(QObject *parent)
Definition: CopyInputDialog.cpp:120
Konsole::CopyInputDialog::masterSession
Session * masterSession() const
See setMasterSession()
QSet
Konsole::CheckableSessionModel::setCheckedSessions
void setCheckedSessions(const QSet< Session * > sessions)
Sets the list of sessions which are currently checked.
Definition: CopyInputDialog.cpp:171
Konsole::CheckableSessionModel::setCheckable
void setCheckable(Session *session, bool checkable)
Sets whether a session can be checked or un-checked.
Definition: CopyInputDialog.cpp:180
SessionListModel.h
Konsole::CheckableSessionModel
A list of sessions with a checkbox next to each one which allows the user to select a subset of the a...
Definition: CopyInputDialog.h:95
Konsole::CheckableSessionModel::checkColumn
int checkColumn() const
Definition: CopyInputDialog.h:130
Konsole::CheckableSessionModel::setCheckColumn
void setCheckColumn(int column)
Definition: CopyInputDialog.cpp:125
Konsole::CopyInputDialog::CopyInputDialog
CopyInputDialog(QWidget *parent=0)
Definition: CopyInputDialog.cpp:31
Konsole::CopyInputDialog
Dialog which allows the user to mark a list of sessions to copy the input from the current session to...
Definition: CopyInputDialog.h:50
SessionManager.h
Konsole::CheckableSessionModel::data
virtual QVariant data(const QModelIndex &index, int role) const
Definition: CopyInputDialog.cpp:139
QObject::parent
QObject * parent() const
Konsole::CheckableSessionModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Definition: CopyInputDialog.cpp:130
Konsole::CopyInputDialog::~CopyInputDialog
~CopyInputDialog()
Definition: CopyInputDialog.cpp:66
QVariant
Qt::ItemFlags
typedef ItemFlags
Konsole::CheckableSessionModel::sessionRemoved
virtual void sessionRemoved(Session *)
Definition: CopyInputDialog.cpp:189
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Konsole

Skip menu "Konsole"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal