| 1 | // -*- c-basic-offset: 2 -*- |
|---|
| 2 | /* |
|---|
| 3 | * This file is part of Licq, an instant messaging client for UNIX. |
|---|
| 4 | * Copyright (C) 2007 Licq developers |
|---|
| 5 | * |
|---|
| 6 | * Licq is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * Licq is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with Licq; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #ifndef HISTORYDLG_H |
|---|
| 22 | #define HISTORYDLG_H |
|---|
| 23 | |
|---|
| 24 | #include "config.h" |
|---|
| 25 | |
|---|
| 26 | #include <QDialog> |
|---|
| 27 | |
|---|
| 28 | #include <licq_history.h> |
|---|
| 29 | |
|---|
| 30 | class QCalendarWidget; |
|---|
| 31 | class QCheckBox; |
|---|
| 32 | class QLabel; |
|---|
| 33 | class QLineEdit; |
|---|
| 34 | class QPushButton; |
|---|
| 35 | class QRegExp; |
|---|
| 36 | class QTextCodec; |
|---|
| 37 | |
|---|
| 38 | class CICQSignal; |
|---|
| 39 | class ICQEvent; |
|---|
| 40 | |
|---|
| 41 | namespace LicqQtGui |
|---|
| 42 | { |
|---|
| 43 | class Calendar; |
|---|
| 44 | class HistoryView; |
|---|
| 45 | |
|---|
| 46 | /** |
|---|
| 47 | * Dialog that displays history for a contact with search functionallity |
|---|
| 48 | */ |
|---|
| 49 | class HistoryDlg : public QDialog |
|---|
| 50 | { |
|---|
| 51 | Q_OBJECT |
|---|
| 52 | |
|---|
| 53 | public: |
|---|
| 54 | /** |
|---|
| 55 | * Constructor |
|---|
| 56 | * |
|---|
| 57 | * @param id Contact id |
|---|
| 58 | * @param ppid Contact protocol id |
|---|
| 59 | * @param parent Parent widget |
|---|
| 60 | */ |
|---|
| 61 | HistoryDlg(QString id, unsigned long ppid, QWidget* parent = 0); |
|---|
| 62 | |
|---|
| 63 | /** |
|---|
| 64 | * Desstructor |
|---|
| 65 | */ |
|---|
| 66 | ~HistoryDlg(); |
|---|
| 67 | |
|---|
| 68 | private slots: |
|---|
| 69 | /** |
|---|
| 70 | * Update history view to show the date marked in the calendar |
|---|
| 71 | */ |
|---|
| 72 | void calenderClicked(); |
|---|
| 73 | |
|---|
| 74 | /** |
|---|
| 75 | * Search forwards |
|---|
| 76 | */ |
|---|
| 77 | void findNext(); |
|---|
| 78 | |
|---|
| 79 | /** |
|---|
| 80 | * Search backwards |
|---|
| 81 | */ |
|---|
| 82 | void findPrevious(); |
|---|
| 83 | |
|---|
| 84 | /** |
|---|
| 85 | * Find the next occurence of the word in the search box |
|---|
| 86 | * |
|---|
| 87 | * @param backwards Search backwards in history |
|---|
| 88 | */ |
|---|
| 89 | void find(bool backwards); |
|---|
| 90 | |
|---|
| 91 | /** |
|---|
| 92 | * Search field has changed |
|---|
| 93 | * |
|---|
| 94 | * @param text Contents of text field |
|---|
| 95 | */ |
|---|
| 96 | void searchTextChanged(const QString& text); |
|---|
| 97 | |
|---|
| 98 | /** |
|---|
| 99 | * Popup user menu from menu button |
|---|
| 100 | */ |
|---|
| 101 | void showUserMenu(); |
|---|
| 102 | |
|---|
| 103 | /** |
|---|
| 104 | * Go to next date with activity |
|---|
| 105 | */ |
|---|
| 106 | void nextDate(); |
|---|
| 107 | |
|---|
| 108 | /** |
|---|
| 109 | * Go to previous date with activity |
|---|
| 110 | */ |
|---|
| 111 | void previousDate(); |
|---|
| 112 | |
|---|
| 113 | private slots: |
|---|
| 114 | /** |
|---|
| 115 | * A user was updated. Add to history if it was a message recieved for this user |
|---|
| 116 | * |
|---|
| 117 | * @param signal Signal from daemon |
|---|
| 118 | */ |
|---|
| 119 | void updatedUser(CICQSignal* signal); |
|---|
| 120 | |
|---|
| 121 | /** |
|---|
| 122 | * A message was sent. Add to history if it was for the current user |
|---|
| 123 | * |
|---|
| 124 | * @param event Event object for message |
|---|
| 125 | */ |
|---|
| 126 | void eventSent(const ICQEvent* event); |
|---|
| 127 | |
|---|
| 128 | private: |
|---|
| 129 | /** |
|---|
| 130 | * Add an event to the current history |
|---|
| 131 | * |
|---|
| 132 | * @param event Event to add |
|---|
| 133 | */ |
|---|
| 134 | void addMsg(const CUserEvent* event); |
|---|
| 135 | |
|---|
| 136 | /** |
|---|
| 137 | * Build a regular expression from the input fields |
|---|
| 138 | * |
|---|
| 139 | * @return A regular expression |
|---|
| 140 | */ |
|---|
| 141 | QRegExp getRegExp() const; |
|---|
| 142 | |
|---|
| 143 | /** |
|---|
| 144 | * Populate history view with entries |
|---|
| 145 | */ |
|---|
| 146 | void showHistory(); |
|---|
| 147 | |
|---|
| 148 | QString myId; |
|---|
| 149 | unsigned long myPpid; |
|---|
| 150 | bool myIsOwner; |
|---|
| 151 | QString myContactName; |
|---|
| 152 | QString myOwnerName; |
|---|
| 153 | QTextCodec* myContactCodec; |
|---|
| 154 | bool myUseHtml; |
|---|
| 155 | bool myPatternChanged; |
|---|
| 156 | |
|---|
| 157 | HistoryList myHistoryList; |
|---|
| 158 | HistoryListIter mySearchPos; |
|---|
| 159 | |
|---|
| 160 | Calendar* myCalendar; |
|---|
| 161 | HistoryView* myHistoryView; |
|---|
| 162 | QLabel* myStatusLabel; |
|---|
| 163 | QLineEdit* myPatternEdit; |
|---|
| 164 | QCheckBox* myMatchCaseCheck; |
|---|
| 165 | QCheckBox* myRegExpSearchCheck; |
|---|
| 166 | QPushButton* myFindPrevButton; |
|---|
| 167 | QPushButton* myFindNextButton; |
|---|
| 168 | }; |
|---|
| 169 | |
|---|
| 170 | } // namespace LicqQtGui |
|---|
| 171 | |
|---|
| 172 | #endif |
|---|