File indexing completed on 2024-04-28 04:58:11

0001 /* This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2009 David Faure <faure@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef KONQ_HISTORYENTRY_H
0008 #define KONQ_HISTORYENTRY_H
0009 
0010 #include <QDateTime>
0011 #include <QMetaType>
0012 #include <QUrl>
0013 #include "libkonq_export.h"
0014 
0015 class LIBKONQ_EXPORT KonqHistoryEntry
0016 {
0017 public:
0018     KonqHistoryEntry();
0019     KonqHistoryEntry(const KonqHistoryEntry &other);
0020     ~KonqHistoryEntry();
0021 
0022     KonqHistoryEntry &operator=(const KonqHistoryEntry &entry);
0023 
0024     QUrl url;
0025     QString typedUrl;
0026     QString title;
0027     quint32 numberOfTimesVisited;
0028     QDateTime firstVisited;
0029     QDateTime lastVisited;
0030 
0031     // Necessary for QList (on Windows)
0032     bool operator==(const KonqHistoryEntry &entry) const;
0033 
0034     enum Flags { NoFlags = 0, MarshalUrlAsStrings = 1 };
0035     void load(QDataStream &s, Flags flags);
0036     void save(QDataStream &s, Flags flags) const;
0037 
0038 private:
0039     class Private;
0040     Private *d;
0041 };
0042 
0043 #ifdef MAKE_KONQ_LIB
0044 KDE_DUMMY_QHASH_FUNCTION(KonqHistoryEntry)
0045 #endif
0046 
0047 Q_DECLARE_METATYPE(KonqHistoryEntry)
0048 
0049 class LIBKONQ_EXPORT KonqHistoryList : public QList<KonqHistoryEntry>
0050 {
0051 public:
0052     /**
0053      * Finds an entry by URL and return an iterator to it.
0054      * If no matching entry is found, end() is returned.
0055      */
0056     iterator findEntry(const QUrl &url);
0057 
0058     /**
0059      * Finds an entry by URL and return an iterator to it.
0060      * If no matching entry is found, end() is returned.
0061      */
0062     const_iterator constFindEntry(const QUrl &url) const;
0063 
0064     /**
0065      * Finds an entry by URL and removes it
0066      */
0067     void removeEntry(const QUrl &url);
0068 };
0069 
0070 #endif /* KONQ_HISTORYENTRY_H */
0071