fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / kparts / historyprovider.h
blob224edcbecb05b69b850349ff3b7468e25a1385a4
1 /* This file is part of the KDE project
2 Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library 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 GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef KHISTORYPROVIDER_H
21 #define KHISTORYPROVIDER_H
23 #include <QtCore/QObject>
25 #include <kparts/kparts_export.h>
27 namespace KParts {
29 class HistoryProviderPrivate;
31 /**
32 * Basic class to manage a history of "items". This class is only meant
33 * for fast lookup, if an item is in the history or not.
35 * May be subclassed to implement a persistent history for example.
36 * For usage with khtml, just create your provider and call the
37 * HistoryProvider constructor _before_ you do any khtml stuff. That way,
38 * khtml, using the self()-method, will use your subclassed provider.
40 * @author Carsten Pfeiffer <pfeiffer@kde.org>
42 class KPARTS_EXPORT HistoryProvider : public QObject
44 Q_OBJECT
45 friend class ::KParts::HistoryProviderPrivate;
47 public:
48 static HistoryProvider * self();
50 /**
51 * @returns true if @p item is present in the history.
53 virtual bool contains( const QString& item ) const;
55 /**
56 * Inserts @p item into the history.
58 virtual void insert( const QString& item );
60 /**
61 * Removes @p item from the history.
63 virtual void remove( const QString& item );
65 /**
66 * Clears the history. The cleared() signal is emitted after clearing.
68 virtual void clear();
70 Q_SIGNALS:
71 /**
72 * Emitted after the history has been cleared.
74 void cleared();
76 /**
77 * This signal is never emitted from this class, it is only meant as an
78 * interface for subclasses. Emit this signal to notify others that the
79 * history has changed. Put those items that were added or removed from the
80 * history into @p items.
82 void updated( const QStringList& items );
84 /**
85 * Emitted after the item has been inserted
87 void inserted( const QString& item );
89 protected:
90 /**
91 * Creates a KHistoryProvider with an optional parent and name
93 HistoryProvider(QObject *parent = 0);
95 /**
96 * Destroys the provider.
98 virtual ~HistoryProvider();
100 private:
101 HistoryProviderPrivate* const d;
106 #endif // KHISTORYPROVIDER_H