| 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 |
|
|---|
| 21 | #ifndef HISTORYDLG_H
|
|---|
| 22 | #define HISTORYDLG_H
|
|---|
| 23 |
|
|---|
| 24 | #include<qlistview.h>
|
|---|
| 25 | #include<qsimplerichtext.h>
|
|---|
| 26 | #include"xmpp.h"
|
|---|
| 27 |
|
|---|
| 28 | using namespace XMPP;
|
|---|
| 29 |
|
|---|
| 30 | class PsiEvent;
|
|---|
| 31 | class PsiAccount;
|
|---|
| 32 | class EDBItem;
|
|---|
| 33 | class EDBResult;
|
|---|
| 34 |
|
|---|
| 35 | class HistoryViewItem : public QListViewItem
|
|---|
| 36 | {
|
|---|
| 37 | public:
|
|---|
| 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;
|
|---|
| 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 addEvent(PsiEvent *, const QString &);
|
|---|
| 62 |
|
|---|
| 63 | // reimplemented
|
|---|
| 64 | void keyPressEvent(QKeyEvent *e);
|
|---|
| 65 | void resizeEvent(QResizeEvent *e);
|
|---|
| 66 |
|
|---|
| 67 | signals:
|
|---|
| 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);
|
|---|
| 75 |
|
|---|
| 76 | private:
|
|---|
| 77 | int at_id;
|
|---|
| 78 | };
|
|---|
| 79 |
|
|---|
| 80 | class HistoryDlg : public QWidget
|
|---|
| 81 | {
|
|---|
| 82 | Q_OBJECT
|
|---|
| 83 | public:
|
|---|
| 84 | HistoryDlg(const Jid &, PsiAccount *);
|
|---|
| 85 | ~HistoryDlg();
|
|---|
| 86 |
|
|---|
| 87 | // reimplemented
|
|---|
| 88 | void keyPressEvent(QKeyEvent *e);
|
|---|
| 89 | void closeEvent(QCloseEvent *e);
|
|---|
| 90 |
|
|---|
| 91 | signals:
|
|---|
| 92 | void openEvent(PsiEvent *);
|
|---|
| 93 |
|
|---|
| 94 | public slots:
|
|---|
| 95 | // reimplemented
|
|---|
| 96 | void show();
|
|---|
| 97 |
|
|---|
| 98 | private slots:
|
|---|
| 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();
|
|---|
| 107 |
|
|---|
| 108 | void edb_finished();
|
|---|
| 109 | void le_textChanged(const QString &);
|
|---|
| 110 |
|
|---|
| 111 | private:
|
|---|
| 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 | };
|
|---|
| 119 |
|
|---|
| 120 | #endif
|
|---|