1 /* 2 * This file is part of Licq, an instant messaging client for UNIX. 3 * Copyright (C) 2007-2013 Licq developers <licq-dev@googlegroups.com> 4 * 5 * Licq 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 * Licq 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 Licq; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 #ifndef HISTORYDLG_H 21 #define HISTORYDLG_H 22 23 #include "config.h" 24 25 #include <QDialog> 26 27 #include <licq/contactlist/user.h> 28 #include <licq/userid.h> 29 30 class QCalendarWidget; 31 class QCheckBox; 32 class QLabel; 33 class QLineEdit; 34 class QPushButton; 35 class QRegExp; 36 37 namespace Licq 38 { 39 class Event; 40 } 41 42 namespace LicqQtGui 43 { 44 class Calendar; 45 class HistoryView; 46 47 /** 48 * Dialog that displays history for a contact with search functionallity 49 */ 50 class HistoryDlg : public QDialog 51 { 52 Q_OBJECT 53 54 public: 55 /** 56 * Constructor 57 * 58 * @param userId Contact id 59 * @param parent Parent widget 60 */ 61 HistoryDlg(const Licq::UserId& userId, 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 userId Id for affected user 118 * @param subSignal Sub signal telling what the change was 119 * @param argument Additional data, usage depend on sub signal type 120 */ 121 void updatedUser(const Licq::UserId& userId, unsigned long subSignal, int argument); 122 123 /** 124 * A message was sent. Add to history if it was for the current user 125 * 126 * @param event Event object for message 127 */ 128 void eventSent(const Licq::Event* event); 129 130 private: 131 /** 132 * Add an event to the current history 133 * 134 * @param event Event to add 135 */ 136 void addMsg(const Licq::UserEvent* event); 137 138 /** 139 * Build a regular expression from the input fields 140 * 141 * @return A regular expression 142 */ 143 QRegExp getRegExp() const; 144 145 /** 146 * Populate history view with entries 147 */ 148 void showHistory(); 149 150 /** 151 * Update window title 152 * 153 * @param @user The user object 154 */ 155 void setTitle(const Licq::User* user); 156 157 Licq::UserId myUserId; 158 QString myContactName; 159 QString myOwnerName; 160 bool myUseHtml; 161 bool myPatternChanged; 162 163 Licq::HistoryList myHistoryList; 164 Licq::HistoryList::iterator mySearchPos; 165 166 Calendar* myCalendar; 167 HistoryView* myHistoryView; 168 QLabel* myStatusLabel; 169 QLineEdit* myPatternEdit; 170 QCheckBox* myMatchCaseCheck; 171 QCheckBox* myRegExpSearchCheck; 172 QPushButton* myFindPrevButton; 173 QPushButton* myFindNextButton; 174 }; 175 176 } // namespace LicqQtGui 177 178 #endif 179