• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kde-baseapps API Reference
  • KDE Home
  • Contact Us
 

libkonq

  • sources
  • kde-4.14
  • kde-baseapps
  • lib
  • konq
konq_historyentry.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright 2009 David Faure <faure@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Library General Public License as published
6  by the Free Software Foundation; either version 2 of the License or
7  ( at your option ) version 3 or, at the discretion of KDE e.V.
8  ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version.
9 
10  This library 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  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "konq_historyentry.h"
22 #include <kdebug.h>
23 
24 KonqHistoryEntry::KonqHistoryEntry()
25  : numberOfTimesVisited(1), d(0)
26 {
27 }
28 
29 KonqHistoryEntry::~KonqHistoryEntry()
30 {
31 }
32 
33 bool KonqHistoryEntry::operator==(const KonqHistoryEntry& entry) const
34 {
35  return url == entry.url &&
36  typedUrl == entry.typedUrl &&
37  title == entry.title &&
38  numberOfTimesVisited == entry.numberOfTimesVisited &&
39  firstVisited == entry.firstVisited &&
40  lastVisited == entry.lastVisited;
41 }
42 
43 void KonqHistoryEntry::load(QDataStream& s, Flags flags)
44 {
45  if (flags & MarshalUrlAsStrings) {
46  QString urlStr;
47  s >> urlStr;
48  url = urlStr;
49  } else {
50  s >> url;
51  }
52  s >> typedUrl;
53  s >> title;
54  s >> numberOfTimesVisited;
55  s >> firstVisited;
56  s >> lastVisited;
57 }
58 
59 void KonqHistoryEntry::save(QDataStream& s, Flags flags) const
60 {
61  if (flags & MarshalUrlAsStrings) {
62  s << url.url();
63  } else {
64  s << url;
65  }
66  s << typedUrl;
67  s << title;
68  s << numberOfTimesVisited;
69  s << firstVisited;
70  s << lastVisited;
71 }
72 
73 KonqHistoryEntry::KonqHistoryEntry(const KonqHistoryEntry& e)
74 {
75  url = e.url;
76  typedUrl = e.typedUrl;
77  title = e.title;
78  numberOfTimesVisited = e.numberOfTimesVisited;
79  firstVisited = e.firstVisited;
80  lastVisited = e.lastVisited;
81  d = 0;
82 }
83 
85 
86 KonqHistoryList::iterator KonqHistoryList::findEntry( const KUrl& url )
87 {
88  // we search backwards, probably faster to find an entry
89  KonqHistoryList::iterator it = end();
90  while ( it != begin() ) {
91  --it;
92  if ( (*it).url == url )
93  return it;
94  }
95  return end();
96 }
97 
98 KonqHistoryList::const_iterator KonqHistoryList::constFindEntry( const KUrl& url ) const
99 {
100  // we search backwards, probably faster to find an entry
101  KonqHistoryList::const_iterator it = constEnd();
102  while ( it != constBegin() ) {
103  --it;
104  if ( (*it).url == url )
105  return it;
106  }
107  return constEnd();
108 }
109 
110 void KonqHistoryList::removeEntry( const KUrl& url )
111 {
112  iterator it = findEntry( url );
113  if ( it != end() )
114  erase( it );
115 }
116 
KonqHistoryEntry::MarshalUrlAsStrings
Definition: konq_historyentry.h:47
KonqHistoryEntry::firstVisited
QDateTime firstVisited
Definition: konq_historyentry.h:39
KonqHistoryEntry::numberOfTimesVisited
quint32 numberOfTimesVisited
Definition: konq_historyentry.h:38
QDataStream
KonqHistoryList::removeEntry
void removeEntry(const KUrl &url)
Finds an entry by URL and removes it.
Definition: konq_historyentry.cpp:110
QList< KonqHistoryEntry >::erase
iterator erase(iterator pos)
KonqHistoryEntry::url
KUrl url
Definition: konq_historyentry.h:35
KonqHistoryList::findEntry
iterator findEntry(const KUrl &url)
Finds an entry by URL and return an iterator to it.
Definition: konq_historyentry.cpp:86
KonqHistoryEntry::save
void save(QDataStream &s, Flags flags) const
Definition: konq_historyentry.cpp:59
KonqHistoryEntry::title
QString title
Definition: konq_historyentry.h:37
QString
KonqHistoryEntry::load
void load(QDataStream &s, Flags flags)
Definition: konq_historyentry.cpp:43
QList< KonqHistoryEntry >::end
iterator end()
konq_historyentry.h
KonqHistoryEntry::KonqHistoryEntry
KonqHistoryEntry()
Definition: konq_historyentry.cpp:24
KonqHistoryEntry::operator==
bool operator==(const KonqHistoryEntry &entry) const
Definition: konq_historyentry.cpp:33
KonqHistoryEntry::Flags
Flags
Definition: konq_historyentry.h:47
KonqHistoryList::constFindEntry
const_iterator constFindEntry(const KUrl &url) const
Finds an entry by URL and return an iterator to it.
Definition: konq_historyentry.cpp:98
KonqHistoryEntry::typedUrl
QString typedUrl
Definition: konq_historyentry.h:36
QList< KonqHistoryEntry >::constEnd
const_iterator constEnd() const
QList< KonqHistoryEntry >::constBegin
const_iterator constBegin() const
KonqHistoryEntry::lastVisited
QDateTime lastVisited
Definition: konq_historyentry.h:40
QList< KonqHistoryEntry >::begin
iterator begin()
KonqHistoryEntry
Definition: konq_historyentry.h:29
KonqHistoryEntry::~KonqHistoryEntry
~KonqHistoryEntry()
Definition: konq_historyentry.cpp:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:07:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkonq

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

kde-baseapps API Reference

Skip menu "kde-baseapps API Reference"
  • Libraries
  •   libkonq

Search



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