• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KParts

  • kparts
historyprovider.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
3
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.
8
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.
13
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.
18*/
19
20#include "historyprovider.h"
21
22#include <QtCore/QSet>
23
24#include <kapplication.h>
25
26using namespace KParts;
27
28class KParts::HistoryProviderPrivate
29{
30public:
31 HistoryProviderPrivate()
32 : q(0)
33 {
34 }
35
36 ~HistoryProviderPrivate()
37 {
38 delete q;
39 }
40
41 QSet<QString> dict;
42 HistoryProvider *q;
43};
44
45K_GLOBAL_STATIC(HistoryProviderPrivate, historyProviderPrivate)
46
47HistoryProvider * HistoryProvider::self()
48{
49 if (!historyProviderPrivate->q) {
50 new HistoryProvider;
51 }
52
53 return historyProviderPrivate->q;
54}
55
56bool HistoryProvider::exists()
57{
58 return historyProviderPrivate->q;
59}
60
61HistoryProvider::HistoryProvider( QObject *parent )
62 : QObject( parent ), d(historyProviderPrivate)
63{
64 Q_ASSERT(!historyProviderPrivate->q);
65 historyProviderPrivate->q = this;
66 setObjectName("history provider");
67}
68
69HistoryProvider::~HistoryProvider()
70{
71 if (!historyProviderPrivate.isDestroyed() &&
72 historyProviderPrivate->q == this)
73 historyProviderPrivate->q = 0;
74}
75
76bool HistoryProvider::contains( const QString& item ) const
77{
78 return d->dict.contains( item );
79}
80
81void HistoryProvider::insert( const QString& item )
82{
83 d->dict.insert( item );
84 emit inserted( item );
85}
86
87void HistoryProvider::remove( const QString& item )
88{
89 d->dict.remove( item );
90}
91
92void HistoryProvider::clear()
93{
94 d->dict.clear();
95 emit cleared();
96}
97
98#include "historyprovider.moc"
KParts::HistoryProvider
Basic class to manage a history of "items".
Definition: historyprovider.h:43
KParts::HistoryProvider::insert
virtual void insert(const QString &item)
Inserts item into the history.
Definition: historyprovider.cpp:81
KParts::HistoryProvider::inserted
void inserted(const QString &item)
Emitted after the item has been inserted.
KParts::HistoryProvider::remove
virtual void remove(const QString &item)
Removes item from the history.
Definition: historyprovider.cpp:87
KParts::HistoryProvider::~HistoryProvider
virtual ~HistoryProvider()
Destroys the provider.
Definition: historyprovider.cpp:69
KParts::HistoryProvider::clear
virtual void clear()
Clears the history.
Definition: historyprovider.cpp:92
KParts::HistoryProvider::contains
virtual bool contains(const QString &item) const
Definition: historyprovider.cpp:76
KParts::HistoryProvider::cleared
void cleared()
Emitted after the history has been cleared.
KParts::HistoryProvider::exists
static bool exists()
Definition: historyprovider.cpp:56
KParts::HistoryProvider::HistoryProvider
HistoryProvider(QObject *parent=0)
Creates a KHistoryProvider with an optional parent and name.
Definition: historyprovider.cpp:61
QObject
QSet
K_GLOBAL_STATIC
#define K_GLOBAL_STATIC(TYPE, NAME)
historyprovider.h
kapplication.h
KParts
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KParts

Skip menu "KParts"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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