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
|
/***************************************************************************
** xIrcNotifyTable.cpp $Revision: 1.1 $ - $Name: V2-0 $
** Frame showing Who's on, who's not
**
** 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 <stdlib.h>
#include <xFileDialog.h>
#include <xMessageBox.h>
#include "xIrcCommands.h"
#include "xIrcConnect.h"
#include "xIrcMsgDispatch.h"
#include "xIrcNotifyTable.h"
#include "xIrcPeopleEdit.h"
#include "xDefaults.h"
static int dbg = 0;
static const char *pInitialResources[] =
{
NULL
};
xIrcNotifyTable::xIrcNotifyTable(xWidgetResInfo *pPRes, QWidget *pParent,
const char *pName) :
xDialog(wdtRes = new xWidgetResInfo(pPRes, QString("notifylist"),
QString("NotifyList")),
pParent, pName, FALSE)
{
QFontMetrics fm(fontMetrics());
if (dbg) fprintf(stdout, "xIrcNotifyTable::xNotifyTable():Enter\n");
if (dbg) fflush(stdout);
Resources->setWidgetInit(pInitialResources);
setDefPallet(this, wdtRes);
setDefFont(this, wdtRes);
setCaption("Folks Online");
mainFrame->setAutoDelete(TRUE);
pListBox = new xListBox(wdtRes, this);
pListBox->resize(fm.maxWidth() * 20, fm.lineSpacing() * 15);
pListBox->repaint(FALSE);
addWidget(pListBox);
setMargins(3,3);
setWidgetSpacing(0);
initFrame();
connect(pListBox, SIGNAL(selected(int)),
this, SLOT(haveSelection(int)));
if (dbg) fprintf(stdout, "xIrcNotifyTable::xNotifyTable():Exit\n");
if (dbg) fflush(stdout);
}
void xIrcNotifyTable::update(xIrcPeopleList *pList)
{
xIrcPeopleListIterator it(*pList);
if (dbg) fprintf(stdout, "xIrcNotifyTable::update():Enter\n");
if (dbg) fflush(stdout);
pListBox->clear();
for (; it.current() != NULL; ++it)
{
xIrcPeopleEntry *p = it.current();
QString r(p->realNick());
if (dbg) fprintf(stdout, "xIrcNotifyTable::update():Looking at %s:%s:%s\n",
(const char*)r,
(const char*)p->nick(),
(const char*)p->mask());
if (dbg) fflush(stdout);
if (dbg) fprintf(stdout, "xIrcNotifyTable::update():Looking at %s:%s:%s\n",
(const char*)r,
(const char*)p->nick(),
(const char*)p->mask());
if (dbg) fflush(stdout);
if (dbg) fprintf(stdout, "xIrcNotifyTable::update():Looking at %s:%s:%s\n",
(const char*)r,
(const char*)p->nick(),
(const char*)p->mask());
if (dbg) fflush(stdout);
if (p->state() >= 2)
{
QString t((const char*)r);
t += " (";
t += p->mask();
t += ")";
if (dbg) fprintf(stdout, "xIrcNotifyTable::update():Adding :%s:\n",
(const char*)r);
// (const char*)p->nick(),
// (const char*)p->mask());
if (dbg) fflush(stdout);
pListBox->inSort(t);
}
}
pListBox->repaint(FALSE);
if (dbg) fprintf(stdout, "xIrcNotifyTable::update():Exit\n");
if (dbg) fflush(stdout);
}
void xIrcNotifyTable::haveSelection(int x)
{
const char *cp;
cp = pListBox->text(x);
emit selected(cp);
}
#include "xIrcNotifyTable.moc"
|