File: xIrcNickActionQuery.cpp

package info (click to toggle)
xirc 2.0-3
  • links: PTS
  • area: contrib
  • in suites: hamm, slink
  • size: 2,624 kB
  • ctags: 2,093
  • sloc: cpp: 21,094; makefile: 1,033
file content (130 lines) | stat: -rw-r--r-- 4,346 bytes parent folder | download
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
/***************************************************************************
**    xIrcNickActionQuery.cpp  $Revision: 1.7 $ - $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 <string.h>
#include <qfont.h>
#include "xIrcNickActionQuery.h"

static int dbg = 0;

xIrcNickActionQuery::xIrcNickActionQuery(xWidgetResInfo *pPRes, 
                                         QWidget *pParent, const char *pName) :
               xDialog(wdtRes = new xWidgetResInfo(pPRes, QString("nickactiondialog"),
                                                   QString("NickActionDialog")),
                       pParent, pName)
{
   if (dbg) fprintf(stdout, "xIrcNickActionQuery::xIrcNickActionQuery():Enter\n");
   if (dbg) fflush(stdout);

   setDefPallet(this, wdtRes);
   setDefFont(this, wdtRes);

   setAcceptFocus(TRUE);   
   pNickEdit = new xLineEdit(wdtRes, this);
   pNickEdit->setLabel("Nick:");
   pNickEdit->setMargins(0, 10);
   pChanEdit = new xLineEdit(wdtRes, this);
   pChanEdit->setLabel("Channel:");
   pChanEdit->setMargins(0, 10);
   pButtons = new xPshBtnTable(wdtRes, this);
   pButtons->setFrameStyle(QFrame::Panel | QFrame::Raised);
   pButtons->addButton("Dcc Chat", DccChat);
   pButtons->addButton("WhoIs", WhoIs);
   pButtons->addButton("Ban", Ban);
   pButtons->addButton("Give Ops", GiveOps);
   pButtons->addButton("Ping", Ping);
   pButtons->addButton("Notify", Notify);

   pButtons->addButton("Priv Chat", PrivChat);
   pButtons->addButton("WhoWas", WhoWas);
   pButtons->addButton("Kick", Kick);
   pButtons->addButton("Take Ops", TakeOps);
   pButtons->addButton("Who", Who);
   pButtons->addButton("Ignore", Ignore);

   pButtons->addButton("User Info", UserInfo);
   pButtons->addButton("Finger", Finger);
   pButtons->addButton("Time", Time);
   pButtons->addButton("Version", Version);
   pButtons->addButton("Ignore", Ignore);
   pButtons->addButton("Close", Close);

   pButtons->arrangeButtons();
   addWidget(pNickEdit);
   addWidget(pChanEdit);
   addWidget(pButtons);
   setMargins(10, 10);
   setWidgetSpacing(0);
   initFrame();
   connect(pButtons, SIGNAL(clicked(int)), this, SLOT(buttonPressed(int)));
   if (dbg) fprintf(stdout, "xIrcNickActionQuery::xIrcNickActionQuery():Exit\n");
   if (dbg) fflush(stdout);   
}

xIrcNickActionQuery::~xIrcNickActionQuery()
{
   if (dbg) fprintf(stdout, "xIrcNickActionQuery::~xIrcNickActionQuery():Enter\n");
   if (dbg) fflush(stdout);
   if (pNickEdit)
      delete pNickEdit;
   if (pChanEdit)
      delete pChanEdit;
   if (pButtons)
      delete pButtons;
   if (dbg) fprintf(stdout, "xIrcNickActionQuery::~xIrcNickActionQuery():Exit\n");
   if (dbg) fflush(stdout);
}

void xIrcNickActionQuery::wakeUp(xMultiLineTextSelection text)
{
   txtSel = text;
   if (strlen(txtSel.text) > 0)
      pNickEdit->setText(text.text);
   if (strlen(txtSel.winName) > 0)
      pChanEdit->setText(text.winName);
   show();
}

void xIrcNickActionQuery::wakeUp(const char *pNick)
{
   txtSel.text = "";
   txtSel.winName = "";
   for (; *pNick != '\0' && *pNick != ' '; pNick++)
      txtSel.text += *pNick;
   txtSel.winName = "";
   if (strlen(txtSel.text) > 0)
      pNickEdit->setText(txtSel.text);
   if (strlen(txtSel.winName) > 0)
      pChanEdit->setText(txtSel.winName);
   show();
}

void xIrcNickActionQuery::buttonPressed(int id)
{
   txtSel.text = pNickEdit->text();
   txtSel.winName = pChanEdit->text();
   txtSel.iData = id;
   emit done(txtSel);
}

#include "xIrcNickActionQuery.moc"