~ubuntu-branches/ubuntu/feisty/psi/feisty

« back to all changes in this revision

Viewing changes to src/historydlg.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2002-04-19 02:28:44 UTC
  • Revision ID: james.westby@ubuntu.com-20020419022844-za7xgai5qyfd9xv6
Tags: upstream-0.8.5
ImportĀ upstreamĀ versionĀ 0.8.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
** historydlg.h - a dialog to show message history
 
3
** Copyright (C) 2001, 2002  Justin Karneges
 
4
**
 
5
** This program is free software; you can redistribute it and/or
 
6
** modify it under the terms of the GNU General Public License
 
7
** as published by the Free Software Foundation; either version 2
 
8
** of the License, or (at your option) any later version.
 
9
**
 
10
** This program 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
 
13
** GNU General Public License for more details.
 
14
**
 
15
** You should have received a copy of the GNU General Public License
 
16
** along with this program; if not, write to the Free Software
 
17
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
 
18
**
 
19
****************************************************************************/
 
20
 
 
21
#ifndef HISTORYDLG_H
 
22
#define HISTORYDLG_H
 
23
 
 
24
#include<qwidget.h>
 
25
#include<qstring.h>
 
26
#include<qlistview.h>
 
27
#include<qsimplerichtext.h>
 
28
#include<qcombobox.h>
 
29
#include"common.h"
 
30
#include"userlist.h"
 
31
#include"message.h"
 
32
#include"uniquewindow.h"
 
33
 
 
34
 
 
35
class HistoryViewItem : public QListViewItem
 
36
{
 
37
public:
 
38
        HistoryViewItem(Message *, int id, QListView *);
 
39
        ~HistoryViewItem();
 
40
 
 
41
        QSimpleRichText *rt;
 
42
 
 
43
        Message *msg;
 
44
        QString text;
 
45
        int id;
 
46
 
 
47
        // reimplemented
 
48
        void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int alignment);
 
49
        void setup();
 
50
        int compare(QListViewItem *xi, int column, bool ascending) const;
 
51
};
 
52
 
 
53
 
 
54
class HistoryView : public QListView
 
55
{
 
56
        Q_OBJECT
 
57
public:
 
58
        HistoryView(QWidget *parent=0, const char *name=0);
 
59
 
 
60
        void doResize();
 
61
        void addMessage(Message *);
 
62
 
 
63
        // reimplemented
 
64
        void keyPressEvent(QKeyEvent *e);
 
65
 
 
66
signals:
 
67
        void aOpenMessage(const Message &);
 
68
 
 
69
private:
 
70
        void resizeEvent(QResizeEvent *e);
 
71
        int at_id;
 
72
 
 
73
private slots:
 
74
        void doOpenMessage();
 
75
 
 
76
        void qlv_doubleclick(QListViewItem *);
 
77
        void qlv_contextPopup(QListViewItem *, const QPoint &, int);
 
78
};
 
79
 
 
80
 
 
81
class HistoryDlg : public QWidget, public UniqueWindow
 
82
{
 
83
        Q_OBJECT
 
84
public:
 
85
        HistoryDlg(UserListItem *item, QWidget *parent=0, const char *name=0);
 
86
 
 
87
        QString & jid() { return v_jid; }
 
88
 
 
89
        static HistoryDlg * find(const QString &);
 
90
 
 
91
        // reimplemented
 
92
        void keyPressEvent(QKeyEvent *e);
 
93
 
 
94
signals:
 
95
        void openMessage(const Message &);
 
96
 
 
97
public slots:
 
98
        void refresh();
 
99
 
 
100
        // reimplemented
 
101
        void show();
 
102
 
 
103
private slots:
 
104
        void comboChanged(int);
 
105
        void searchTextChanged(const QString &);
 
106
        void doSearch();
 
107
        void doRefresh();
 
108
 
 
109
        void actionOpenMessage(const Message &);
 
110
 
 
111
private:
 
112
        QString v_jid;
 
113
        HistoryView *lv;
 
114
        QLineEdit *le_search;
 
115
        QPushButton *pb_go;
 
116
        QString searchStr;
 
117
        int amountToShow;
 
118
};
 
119
 
 
120
#endif