• 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
ViewProperties.h
Go to the documentation of this file.
1 /*
2  Copyright 2007-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 VIEWPROPERTIES_H
21 #define VIEWPROPERTIES_H
22 
23 // Qt
24 #include <QtGui/QIcon>
25 #include <QtCore/QObject>
26 #include <QtCore/QHash>
27 #include <QtCore/QMimeData>
28 
29 // KDE
30 #include <KUrl>
31 
32 // Konsole
33 #include "konsole_export.h"
34 
35 namespace Konsole
36 {
44 class KONSOLEPRIVATE_EXPORT ViewProperties : public QObject
45 {
46  Q_OBJECT
47 
48 public:
49  explicit ViewProperties(QObject* parent);
50  virtual ~ViewProperties();
51 
53  QIcon icon() const;
55  QString title() const;
56 
61  virtual KUrl url() const;
62 
68  virtual QString currentDir() const;
69 
74  int identifier() const;
75 
81  virtual bool confirmClose() const {
82  return true;
83  }
84 
86  static ViewProperties* propertiesById(int id);
87 
89  static QString mimeType() {
90  return _mimeType;
91  }
92 
97  static QMimeData* createMimeData(int id) {
98  QMimeData* mimeData = new QMimeData;
99  mimeData->setData(mimeType(), QByteArray::number(id));
100  return mimeData;
101  }
102 
109  static int decodeMimeData(const QMimeData* mimeData) {
110  bool ok;
111  // we are not checking return value ok; not sure how int could be invalid
112  return mimeData->data(ViewProperties::mimeType()).toInt(&ok);
113  }
114 
115 signals:
117  void iconChanged(ViewProperties* properties);
119  void titleChanged(ViewProperties* properties);
121  void activity(ViewProperties* item);
122 
123 public slots:
128  virtual void rename();
129 
130 protected slots:
132  void fireActivity();
133 
134 protected:
139  void setTitle(const QString& title);
144  void setIcon(const QIcon& icon);
146  void setIdentifier(int id);
147 private:
148  QIcon _icon;
149  QString _title;
150  int _id;
151 
152  static QHash<int, ViewProperties*> _viewProperties;
153  static QString _mimeType;
154 };
155 }
156 
157 #endif //VIEWPROPERTIES_H
QMimeData::data
QByteArray data(const QString &mimeType) const
Konsole::ViewProperties::mimeType
static QString mimeType()
Name of mime format to use in drag-and-drop operations.
Definition: ViewProperties.h:89
QByteArray::toInt
int toInt(bool *ok, int base) const
konsole_export.h
QMimeData
Konsole::ViewProperties::createMimeData
static QMimeData * createMimeData(int id)
Returns a new QMimeData instance which represents the view with the given id (See identifier())...
Definition: ViewProperties.h:97
QHash
QObject
Konsole::ViewProperties::decodeMimeData
static int decodeMimeData(const QMimeData *mimeData)
Decodes a QMimeData instance created with createMimeData() and returns the identifier of the associat...
Definition: ViewProperties.h:109
QByteArray::number
QByteArray number(int n, int base)
QString
Konsole::ViewProperties
Encapsulates user-visible information about the terminal session currently being displayed in a view...
Definition: ViewProperties.h:44
Konsole::ViewProperties::confirmClose
virtual bool confirmClose() const
Sub-classes may re-implement this method to display a message to the user to allow them to confirm wh...
Definition: ViewProperties.h:81
KONSOLEPRIVATE_EXPORT
#define KONSOLEPRIVATE_EXPORT
Definition: konsole_export.h:33
QMimeData::setData
void setData(const QString &mimeType, const QByteArray &data)
QIcon
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