1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
/***************************************************************************
** xIrcMsgQuery.cpp $Revision: 1.13 $ - $Name: V2-0 $
** Dialog box to ask about Private messages
**
** Copyright (C) 1995, 1996 Joseph Croft <jcroft@unicomp.net>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 1, or (at your option)
** any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
***************************************************************************/
#include <stdio.h>
#include <qfont.h>
#include "xIrcMsgQuery.h"
static int dbg = 0;
static const char *pInitialResources[] =
{
NULL
};
/*
MessageDialog.
MessageDialog.
MessageDialog.
MessageDialog.
*/
xIrcMsgQuery::xIrcMsgQuery(xWidgetResInfo *pPRes, QWidget *pParent,
const char *pName) :
xDialog(wdtRes = new xWidgetResInfo(pPRes, QString("messagedialog"),
QString("MessageDialog")),
pParent, pName)
{
Resources->setWidgetInit(pInitialResources);
setDefPallet(this, wdtRes);
setDefFont(this, wdtRes);
initClass(pParent, pName);
}
void xIrcMsgQuery::initClass(QWidget *pParent, const char *pName)
{
if (dbg) fprintf(stdout, "xIrcMsgQuery::initClass():Enter\n");
if (dbg) fflush(stdout);
// Appease the compiler warnings
pParent = pParent;
pName = pName;
setAcceptFocus(TRUE);
pEdit = new xMultiLineEdit(wdtRes, this);
pEdit->setWidth(80);
pEdit->setHeight(7);
pEdit->setEnabled(FALSE);
pButtons = new xPshBtnFrame(wdtRes, this);
pButtons->setFrameStyle(QFrame::Panel | QFrame::Raised);
pButtons->setAlignment(xALIGN_Horz);
pButtons->setMargins(2, 2);
pButtons->addButton("Chat", QDialog::Accepted);
pButtons->addButton("Close", QDialog::Rejected);
addWidget(pEdit);
addWidget(pButtons);
setMargins(0, 0);
setWidgetSpacing(0);
initFrame();
connect(pButtons, SIGNAL(clicked(int)), this, SLOT(buttonPressed(int)));
if (dbg) fprintf(stdout, "xIrcMsgQuery::initClass():Exit\n");
if (dbg) fflush(stdout);
}
void xIrcMsgQuery::buttonPressed(int results)
{
if (dbg) fprintf(stdout, "xIrcMsgQuery::button pressed():results = %d\n", results);
if (dbg) fflush(stdout);
btnPressed = results;
if (dbg) fprintf(stdout, "xIrcMsgQuery::button pressed():signaling...\n");
if (dbg) fflush(stdout);
emit done(this);
}
void xIrcMsgQuery::add(xIrcMessage *pMsg)
{
QString strTmp;
const char *cp;
if (dbg) fprintf(stdout, "xIrcMsgQuery::setupQuery():Enter\n");
if (dbg) fflush(stdout);
msgList.append(pMsg);
QString caption("New Message From: ");
caption += pMsg->srcNick;
setCaption(caption);
strTmp = "<";
strTmp += pMsg->srcNick;
strTmp += "> ";
for (cp = pMsg->msgStr; *cp; cp++)
{
if (*cp != '\n' && *cp != '\r')
strTmp += *cp;
}
pEdit->insertLine(strTmp, -1);
if (dbg) fprintf(stdout, "xIrcMsgQuery::setupQuery():Exit\n");
if (dbg) fflush(stdout);
}
xIrcMsgQuery::~xIrcMsgQuery()
{
if (dbg) fprintf(stdout, "xIrcMsgQuery::~xIrcMsgQuery(0x%x):Enter\n",
(unsigned int)this);
if (dbg) fflush(stdout);
if (pEdit)
delete pEdit;
if (pButtons)
delete pButtons;
if (dbg) fprintf(stdout, "xIrcMsgQuery::~xIrcMsgQuery():Exit\n");
if (dbg) fflush(stdout);
}
xIrcMsgQuery *xIrcMsgQueryList::find(xIrcMessage *pMsg)
{
xIrcMsgQuery *p;
if (dbg) fprintf(stdout, "xIrcMsgQueryList::find():Enter\n");
if (dbg) fflush(stdout);
for (p = first(); p != NULL; p = next())
{
if (dbg) fprintf(stdout, "xIrcMsgQueryList::find():Testing 0x%x\n",
(unsigned int)p);
if (dbg) fflush(stdout);
if (p->is(pMsg))
break;
}
if (dbg) fprintf(stdout, "xIrcMsgQueryList::find():Exit(0x%x)\n",
(unsigned int)p);
return(p);
};
#include "xIrcMsgQuery.moc"
|