1
/*****************************************************************************
2
* This file is part of Kiten, a KDE Japanese Reference Tool *
3
* Copyright (C) 2001 Jason Katz-Brown <jason@katzbrown.com> *
4
* Copyright (C) 2006 Joseph Kerian <jkerian@gmail.com> *
5
* Copyright (C) 2006 Eric Kjeldergaard <kjelderg@gmail.com> *
7
* This library is free software; you can redistribute it and/or *
8
* modify it under the terms of the GNU Library General Public *
9
* License as published by the Free Software Foundation; either *
10
* version 2 of the License, or (at your option) any later version. *
12
* This library is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15
* Library General Public License for more details. *
17
* You should have received a copy of the GNU Library General Public License *
18
* along with this library; see the file COPYING.LIB. If not, write to *
19
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
20
* Boston, MA 02110-1301, USA. *
21
*****************************************************************************/
23
#ifndef KITEN_ENTRYLIST_H
24
#define KITEN_ENTRYLIST_H
28
#include <QStringList>
30
#include "dictquery.h"
32
#include "libkitenexport.h"
35
* EntryList is a simple container for Entry objects, and is-a QList<Entry*>
36
* A few simple overrides allow you to deal with sorting and translating.
38
class KITEN_EXPORT EntryList : public QList<Entry*>
42
* A simple overridden iterator for working with the Entries
44
typedef QListIterator<Entry*> EntryIterator;
47
* Basic constructor, create an empty EntryList
53
EntryList( const EntryList &old );
55
* Basic Destructor, does not delete Entry* objects. Please remember to call
56
* deleteAll() before deleting an EntryList.
60
* Delete all Entry objects in our list. In the future, we'll switch to a reference
61
* counting system, and this will be deprecated.
66
* Convert every element of the EntryList to a QString and return it
68
QString toString() const;
70
* Convert every element of the EntryList to a QString in HTML form and return it
72
QString toHTML() const;
75
* Convert a given range of the EntryList to a QString and return it
76
* @param start the location in the list where we should start
77
* @param length the length of the list we should generate
79
QString toString( unsigned int start, unsigned int length ) const;
81
* Convert a given range of the EntryList to a QString in HTML form and return it
82
* @param start the location in the list where we should start
83
* @param length the length of the list we should generate
85
QString toHTML( unsigned int start, unsigned int length ) const;
87
* Convert the entire list to KVTML for export to a flashcard app
88
* @param start the location in the list where we should start
89
* @param length the length of the list we should generate
91
QString toKVTML( unsigned int start, unsigned int length ) const;
94
* Sort the list according to the given fields in sortOrder, if dictionaryOrder
95
* is blank, don't order the list by dictionary, otherwise items are sorted by dictionary
96
* then by sortOrder aspects
97
* @param sortOrder the keys to sort by, this should be a list of fields to sort by, this should
98
* be the same as the fields that are returned from dictFile::listDictDisplayOptions().
99
* "--NewLine--" entries will be ignored, "Word/Kanji", "Meaning", and "Reading" entries will
100
* be accepted. An entry which has an extended attribute is considered higher ranking (sorted to
101
* a higher position) than an entry which does not have such an attribute.
102
* @param dictionaryOrder the order for the Entry objects to be sorted in, dictionary-wise. This should
103
* match the names of the dictionary objects, passed to the DictionaryManager.
105
void sort( QStringList &sortOrder, QStringList &dictionaryOrder );
108
* Append another EntryList onto this one
110
const EntryList& operator+=( const EntryList &other );
114
const EntryList& operator=( const EntryList &other );
116
* Append another EntryList onto this one
118
void appendList( const EntryList *other );
120
* Get the query that generated this list, note that if you have appended EntryLists from
121
* two different queries, the resulting DictQuery from this is undefined.
123
DictQuery getQuery() const;
125
* Set the query for this list. See getQuery() for a potential problem with this
127
void setQuery( const DictQuery &newQuery );
129
int scrollValue() const;
130
void setScrollValue( int val );