~ubuntu-branches/ubuntu/quantal/psi/quantal

« back to all changes in this revision

Viewing changes to src/historydlg.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2005-01-10 17:41:43 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050110174143-ltocv5zapl6blf5d
Tags: 0.9.3-1
* New upstream release
* Cleaned up debian/rules (some things are done by upstream Makefiles now)
* Fixed some lintian warnings:
  - removed executable bit from some .png files
  - moved psi.desktop to /usr/share/applications
* Updated menu files

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
 
****************************************************************************/
 
1
/*
 
2
 * historydlg.h - a dialog to show event 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 library; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 *
 
19
 */
20
20
 
21
21
#ifndef HISTORYDLG_H
22
22
#define HISTORYDLG_H
23
23
 
24
 
#include<qwidget.h>
25
 
#include<qstring.h>
26
24
#include<qlistview.h>
27
25
#include<qsimplerichtext.h>
28
 
#include<qcombobox.h>
29
 
#include"common.h"
30
 
#include"userlist.h"
31
 
#include"message.h"
32
 
#include"uniquewindow.h"
33
 
 
 
26
#include"xmpp.h"
 
27
 
 
28
using namespace XMPP;
 
29
 
 
30
class PsiEvent;
 
31
class PsiAccount;
 
32
class EDBItem;
 
33
class EDBResult;
34
34
 
35
35
class HistoryViewItem : public QListViewItem
36
36
{
37
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;
 
38
        HistoryViewItem(PsiEvent *, const QString &, int id, QListView *);
 
39
        ~HistoryViewItem();
 
40
 
 
41
        QSimpleRichText *rt;
 
42
        QString text;
 
43
        int id;
 
44
        PsiEvent *e;
 
45
        QString eventId;
 
46
 
 
47
        // reimplemented
 
48
        int rtti() const;
 
49
        void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int alignment);
 
50
        void setup();
 
51
        int compare(QListViewItem *, int column, bool ascending) const;
51
52
};
52
53
 
53
 
 
54
54
class HistoryView : public QListView
55
55
{
56
 
        Q_OBJECT
 
56
        Q_OBJECT
57
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);
 
58
        HistoryView(QWidget *parent=0, const char *name=0);
 
59
 
 
60
        void doResize();
 
61
        void addEvent(PsiEvent *, const QString &);
 
62
 
 
63
        // reimplemented
 
64
        void keyPressEvent(QKeyEvent *e);
 
65
        void resizeEvent(QResizeEvent *e);
65
66
 
66
67
signals:
67
 
        void aOpenMessage(const Message &);
 
68
        void aOpenEvent(PsiEvent *);
 
69
 
 
70
private slots:
 
71
        void doOpenEvent();
 
72
 
 
73
        void qlv_doubleclick(QListViewItem *);
 
74
        void qlv_contextPopup(QListViewItem *, const QPoint &, int);
68
75
 
69
76
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);
 
77
        int at_id;
78
78
};
79
79
 
80
 
 
81
 
class HistoryDlg : public QWidget, public UniqueWindow
 
80
class HistoryDlg : public QWidget
82
81
{
83
 
        Q_OBJECT
 
82
        Q_OBJECT
84
83
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);
 
84
        HistoryDlg(const Jid &, PsiAccount *);
 
85
        ~HistoryDlg();
 
86
 
 
87
        // reimplemented
 
88
        void keyPressEvent(QKeyEvent *e);
 
89
        void closeEvent(QCloseEvent *e);
93
90
 
94
91
signals:
95
 
        void openMessage(const Message &);
 
92
        void openEvent(PsiEvent *);
96
93
 
97
94
public slots:
98
 
        void refresh();
99
 
 
100
 
        // reimplemented
101
 
        void show();
 
95
        // reimplemented
 
96
        void show();
102
97
 
103
98
private slots:
104
 
        void comboChanged(int);
105
 
        void searchTextChanged(const QString &);
106
 
        void doSearch();
107
 
        void doRefresh();
 
99
        void doLatest();
 
100
        void doPrev();
 
101
        void doNext();
 
102
        void doSave();
 
103
        void doErase();
 
104
        void setButtons();
 
105
        void actionOpenEvent(PsiEvent *);
 
106
        void doFind();
108
107
 
109
 
        void actionOpenMessage(const Message &);
 
108
        void edb_finished();
 
109
        void le_textChanged(const QString &);
110
110
 
111
111
private:
112
 
        QString v_jid;
113
 
        HistoryView *lv;
114
 
        QLineEdit *le_search;
115
 
        QPushButton *pb_go;
116
 
        QString searchStr;
117
 
        int amountToShow;
 
112
        class Private;
 
113
        Private *d;
 
114
 
 
115
        void loadPage(int);
 
116
        void displayResult(const EDBResult *, int, int max=-1);
 
117
        void exportHistory(const QString &fname);
118
118
};
119
119
 
120
120
#endif