| 1 | // -*- c-basic-offset: 2 -*- |
|---|
| 2 | /* |
|---|
| 3 | * This file is part of Licq, an instant messaging client for UNIX. |
|---|
| 4 | * Copyright (C) 1999-2006 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 AWAYMSGDLG_H |
|---|
| 22 | #define AWAYMSGDLG_H |
|---|
| 23 | |
|---|
| 24 | #include <QDialog> |
|---|
| 25 | |
|---|
| 26 | class QCloseEvent; |
|---|
| 27 | class QDialogButtonBox; |
|---|
| 28 | class QEvent; |
|---|
| 29 | class QMenu; |
|---|
| 30 | |
|---|
| 31 | namespace LicqQtGui |
|---|
| 32 | { |
|---|
| 33 | class MLEdit; |
|---|
| 34 | |
|---|
| 35 | class AwayMsgDlg : public QDialog |
|---|
| 36 | { |
|---|
| 37 | Q_OBJECT |
|---|
| 38 | |
|---|
| 39 | public: |
|---|
| 40 | /** |
|---|
| 41 | * Create and show away message dialog or raise it if already exists |
|---|
| 42 | * |
|---|
| 43 | * @param status Status to prompt for away message to |
|---|
| 44 | * @param autoClose True if dialog should close after a timeout |
|---|
| 45 | * @param ppid Protocol to set status for or 0 to change globaly |
|---|
| 46 | * @param invisible True if new status is also invisible |
|---|
| 47 | * @param setStatus True if status should be set when dialog is closed |
|---|
| 48 | */ |
|---|
| 49 | static void showAwayMsgDlg(unsigned short status, bool autoClose = false, |
|---|
| 50 | unsigned long ppid = 0, bool invisible = false, bool setStatus = false); |
|---|
| 51 | |
|---|
| 52 | static void showAutoResponseHints(QWidget* parent = 0); |
|---|
| 53 | |
|---|
| 54 | private: |
|---|
| 55 | static AwayMsgDlg* myInstance; |
|---|
| 56 | |
|---|
| 57 | AwayMsgDlg(QWidget* parent = 0); |
|---|
| 58 | ~AwayMsgDlg(); |
|---|
| 59 | void selectAutoResponse(unsigned short status, bool autoClose = false, |
|---|
| 60 | unsigned long ppid = 0, bool invisible = false, bool setStatus = false); |
|---|
| 61 | |
|---|
| 62 | MLEdit* myAwayMsg; |
|---|
| 63 | QMenu* myMenu; |
|---|
| 64 | QDialogButtonBox* myButtons; |
|---|
| 65 | QString myOkText; |
|---|
| 66 | |
|---|
| 67 | unsigned short myStatus; |
|---|
| 68 | bool myInvisible; |
|---|
| 69 | unsigned long myPpid; |
|---|
| 70 | bool mySetStatus; |
|---|
| 71 | short mySAR; |
|---|
| 72 | int myAutoCloseCounter; |
|---|
| 73 | |
|---|
| 74 | bool eventFilter(QObject* watched, QEvent* event); |
|---|
| 75 | |
|---|
| 76 | private slots: |
|---|
| 77 | void ok(); |
|---|
| 78 | void autoCloseTick(); |
|---|
| 79 | void autoCloseStop(); |
|---|
| 80 | void hints(); |
|---|
| 81 | void selectMessage(); |
|---|
| 82 | }; |
|---|
| 83 | |
|---|
| 84 | } // namespace LicqQtGui |
|---|
| 85 | |
|---|
| 86 | #endif |
|---|