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>
32 class KONQ_TESTS_EXPORT KonqClosedItem
: public QObject
{
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;
42 KonqClosedItem(const QString
& title
, const QString
& group
, quint64 serialNumber
);
44 KConfigGroup m_configGroup
;
45 quint64 m_serialNumber
;
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
{
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
; }
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
{
72 KonqClosedWindowItem(const QString
& title
, quint64 serialNumber
, int numTabs
);
73 virtual ~KonqClosedWindowItem();
74 virtual QPixmap
icon() const;
81 class KONQ_TESTS_EXPORT KonqClosedRemoteWindowItem
: public KonqClosedWindowItem
{
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
; }
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 */