OSDN Git Service

refactoring.
[kita/kita.git] / kita / src / threadlistview.h
1 /***************************************************************************
2 *   Copyright (C) 2003 by Hideki Ikemoto                                  *
3 *   ikemo@wakaba.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 KITATHREADLISTVIEW_H
11 #define KITATHREADLISTVIEW_H
12
13 #include "threadlistviewbase.h"
14
15 #include <klistview.h>
16 #include <kparts/browserextension.h>
17
18 enum ThreadListViewRows {
19     Col_Begin = 0,
20     Col_Mark = 0,
21     Col_ID,
22     Col_Icon,
23     Col_Subject,
24     Col_ResNum,
25     Col_Read,
26     Col_ViewPos,
27     Col_Unread,
28     Col_Since,
29     Col_Speed,
30     Col_Board,
31     Col_DatURL,
32     Col_MarkOrder,
33     Col_IDOrder,
34     Col_End = Col_IDOrder
35 };
36
37 struct Col_Attr
38 {
39     QString labelName; // for header's label
40     QString itemName; // for header's popupItem
41     QString keyName;  // for KConfig's key
42 };
43
44
45 namespace Kita
46 {
47     class Thread;
48     /**
49     @author Hideki Ikemoto
50     */
51     class ThreadListView : public Kita::ThreadListViewBase
52     {
53         Q_OBJECT
54
55     public:
56         ThreadListView( QWidget* parent = 0, const char *name = 0 );
57         ~ThreadListView();
58
59     protected:
60         static struct Col_Attr s_colAttr[];
61         QStringList m_prevquery;
62         unsigned m_nextHitIndex;
63         QValueList<KListViewItem *> m_hitList;
64
65         void insertSearchCombo();
66         QStringList parseSearchQuery( const QString& input );
67         void searchNext( const QStringList& input );
68         void searchAll( const QStringList& query );
69
70     protected slots:
71         void slotHideButton( bool on );
72         void slotMouseButtonClicked( int, QListViewItem* );
73
74     private slots:
75         void slotSearchButton();
76
77     signals:
78         void openURLRequestExt( const KURL& url, const KParts::URLArgs& args = KParts::URLArgs(),
79                                 QString mimetype = QString::null,
80                                 int usr1 = 0, int usr2 = 0,
81                                 const KURL& usrUrl1 = KURL(),
82                                 const KURL& usrUrl2 = KURL(),
83                                 const QString& usrStr1 = QString::null,
84                                 const QString& usrStr2 = QString::null );
85         void bookmarked( const QString& datURL, bool on );
86     };
87
88     class ThreadListViewItem : public KListViewItem
89     {
90     public:
91         ThreadListViewItem( QListView* parent ) : KListViewItem( parent ) {};
92         virtual ~ThreadListViewItem() {};
93
94         virtual int compare( QListViewItem* i, int col, bool ascending ) const;
95     };
96 }
97
98 #endif