Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / apps / konsole / src / ViewProperties.h
blob39ad308dbeeb94eb541615bf5a6519d533bb5975
1 /*
2 Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
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.
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.
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.
20 #ifndef VIEWPROPERTIES_H
21 #define VIEWPROPERTIES_H
23 // Qt
24 #include <QtGui/QIcon>
25 #include <QtCore/QObject>
27 // KDE
28 #include <KUrl>
30 namespace Konsole
33 /**
34 * Encapsulates user-visible information about the terminal session currently being displayed in a view,
35 * such as the associated title and icon.
37 * This can be used by navigation widgets in a ViewContainer sub-class to provide a tab, label or other
38 * item for switching between views.
40 class ViewProperties : public QObject
42 Q_OBJECT
44 public:
45 ViewProperties(QObject* parent);
47 /** Returns the icon associated with a view */
48 QIcon icon() const;
49 /** Returns the title associated with a view */
50 QString title() const;
52 /**
53 * Returns the URL current associated with a view.
54 * The default implementation returns an empty URL.
56 virtual KUrl url() const;
58 /**
59 * Returns the current directory associated with a view.
60 * This may be the same as url()
62 * The default implementation returns an empty string.
64 virtual QString currentDir() const;
66 /**
67 * A unique identifier representing the data displayed by the view associated with this
68 * ViewProperties instance.
70 * TODO: Finish implementation and documentation
72 * This can be used when dragging and dropping views between windows so that [ FINISH ME ]
74 int identifier() const;
76 signals:
77 /** Emitted when the icon for a view changes */
78 void iconChanged(ViewProperties* properties);
79 /** Emitted when the title for a view changes */
80 void titleChanged(ViewProperties* properties);
81 /** Emitted when activity has occurred in this view. */
82 void activity(ViewProperties* item);
84 public slots:
85 /**
86 * Requests the renaming of this view.
88 * The default implementation does nothing.
90 virtual void rename();
92 protected slots:
93 /**
94 * Emits the activity() signal.
96 void fireActivity();
98 protected:
99 /**
100 * Subclasses may call this method to change the title. This causes
101 * a titleChanged() signal to be emitted
103 void setTitle(const QString& title);
105 * Subclasses may call this method to change the icon. This causes
106 * an iconChanged() signal to be emitted
108 void setIcon(const QIcon& icon);
110 * Subclasses may call this method to change the identifier.
112 void setIdentifier(int id);
115 private:
116 QIcon _icon;
117 QString _title;
118 int _id;
123 #endif //VIEWPROPERTIES_H