Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konqueror / src / konqcloseditem.h
blobf5a6c3932af5cc7fde4d55c040e9be3739cad282
1 /* This file is part of the KDE project
2 Copyright 2007 David Faure <faure@kde.org>
3 Copyright 2007 Eduardo Robles Elvira <edulix@gmail.com>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #ifndef KONQCLOSEDITEM_H
22 #define KONQCLOSEDITEM_H
24 #include "konqprivate_export.h"
25 #include <kconfiggroup.h>
26 #include <QtDBus/QtDBus>
27 #include <QString>
28 #include <QImage>
30 class KConfig;
32 class KONQ_TESTS_EXPORT KonqClosedItem : public QObject {
33 public:
34 virtual ~KonqClosedItem();
35 virtual KConfigGroup& configGroup() { return m_configGroup; }
36 virtual const KConfigGroup& configGroup() const { return m_configGroup; }
37 quint64 serialNumber() const { return m_serialNumber; }
38 QString title() const { return m_title; }
39 virtual QPixmap icon() const = 0;
41 protected:
42 KonqClosedItem(const QString& title, const QString& group, quint64 serialNumber);
43 QString m_title;
44 KConfigGroup m_configGroup;
45 quint64 m_serialNumber;
48 /**
49 * This class stores all the needed information about a closed tab
50 * in order to be able to reopen it if requested
52 class KONQ_TESTS_EXPORT KonqClosedTabItem : public KonqClosedItem {
53 public:
54 KonqClosedTabItem(const QString& url, const QString& title, int index, quint64 serialNumber);
55 virtual ~KonqClosedTabItem();
56 virtual QPixmap icon() const;
57 QString url() const { return m_url; }
58 /// The position inside the tabbar that the tab had when it was closed
59 int pos() const { return m_pos; }
61 protected:
62 QString m_url;
63 int m_pos;
66 /**
67 * This class stores all the needed information about a closed tab
68 * in order to be able to reopen it if requested
70 class KONQ_TESTS_EXPORT KonqClosedWindowItem : public KonqClosedItem {
71 public:
72 KonqClosedWindowItem(const QString& title, quint64 serialNumber, int numTabs);
73 virtual ~KonqClosedWindowItem();
74 virtual QPixmap icon() const;
75 int numTabs() const;
77 protected:
78 int m_numTabs;
81 class KONQ_TESTS_EXPORT KonqClosedRemoteWindowItem : public KonqClosedWindowItem {
82 public:
83 KonqClosedRemoteWindowItem(const QString& title, const QString& groupName, const QString& configFileName, quint64 serialNumber, int numTabs, const QString& dbusService);
84 virtual ~KonqClosedRemoteWindowItem();
85 virtual KConfigGroup& configGroup();
86 virtual const KConfigGroup& configGroup() const;
87 bool equalsTo(const QString& groupName, const QString& configFileName) const;
88 QString dbusService() const { return m_dbusService; }
89 const QString& remoteGroupName() const { return m_remoteGroupName; }
90 const QString& remoteConfigFileName() const { return m_remoteConfigFileName; }
91 protected:
92 /**
93 * Actually reads the config file. Call to this function before calling to
94 * configGroup(). This function is const so that it can be called by
95 * configGroup() const. It's used to get delayed initialization so that
96 * we don't load the config file unless it's needed.
98 void readConfig() const;
99 QString m_remoteGroupName;
100 QString m_remoteConfigFileName;
101 QString m_dbusService;
102 mutable KConfigGroup* m_remoteConfigGroup;
103 mutable KConfig* m_remoteConfig;
106 #endif /* KONQCLOSEDITEM_H */