OSDN Git Service

48d859d995648206f05b6d7a7b50f95eda101308
[kita/kita.git] / kita / src / libkita / favoritethreads.h
1 /***************************************************************************
2  *   Copyright (C) 2004 by Kita Developers                                 *
3  *   ikemo@users.sourceforge.jp                                            *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  ***************************************************************************/
10 #ifndef FAVORITETHREADS_H
11 #define FAVORITETHREADS_H
12
13 #include <QtCore/QList>
14 #include <QtCore/QString>
15
16 #include <kdemacros.h>
17
18 class QDomNode;
19
20 /**
21  *@author Hideki Ikemoto
22  */
23 class FavoriteThreadItem
24 {
25 public:
26     QString m_datUrl;
27     FavoriteThreadItem();
28     FavoriteThreadItem(const QString& datUrl) { m_datUrl = datUrl; }
29     ~FavoriteThreadItem();
30
31     bool operator==(const FavoriteThreadItem& item) const;
32 };
33
34 class KDE_EXPORT FavoriteThreads
35 {
36     static FavoriteThreads* instance;
37     QList<FavoriteThreadItem> m_threadList;
38
39     FavoriteThreads();
40     ~FavoriteThreads();
41
42     const QList<FavoriteThreadItem> threadList() const;
43     static void processThreadNode(QDomNode& node);
44
45 public:
46     static FavoriteThreads* getInstance();
47
48     void insert(const QString& datUrl);
49     void remove(const QString& datUrl);
50     bool contains(const QString& datUrl);
51     const QString toXML() const;
52     static bool readFromXML(const QString& xml);
53     static void replace(const QString& fromUrl, const QString& toUrl);
54     static QString getDatUrl(int i);
55     static int count() { return getInstance() ->m_threadList.count(); }
56 };
57
58 #endif