Source Code (Use browser search to find items of interest.)
Class Index
kfinger'NetutilView (./kdenetwork/kfinger/kfinger.h:26)
class NetutilView : public KTMainWindow
{
Q_OBJECT
public:
NetutilView();
private slots:
void slotAuto(int a);
void stopIt();
void connRef();
void writeIt();
void save();
void loadSettings();
void button1Clicked();
void talk();
// void sliderValueChanged( int );
void timerEvent(QTimerEvent *);
void about();
void HtmlHelp();
void setup();
private:
KToolBar *toolBar;
KStatusBar *statusBar;
QString sstr;
KConfig *config;
KApplication *app;
QMultiLineEdit *le;
KMenuBar *menubar;
QLabel *msg;
bool autofinger;
FingerProtocol *protocol;
// QPushButton *pb;
int Timer,tencount,val;
//KCombo *ed2Combo,*ed3Combo;
QComboBox *ed2Combo,*ed3Combo;
// KSlider* sb;
};
kfinger'NetutilView::NetutilView() (./kdenetwork/kfinger/kfinger.C:41)
NetutilView::NetutilView()
: KTMainWindow()
{
QString url((KCmdLineArgs::parsedArgs()->count())? KCmdLineArgs::parsedArgs()->arg(0) : 0);
protocol = 0L;
app=KApplication::kApplication();
config=app->config();
menubar = new KMenuBar( this, "menubar" );
QPopupMenu *file = new QPopupMenu;
file->insertItem(i18n("F&inger Now"), this, SLOT(button1Clicked()));
file->insertItem(i18n("&Talk..."),this,SLOT(talk()));
file->insertSeparator();
file->insertItem(i18n("&Quit"), qApp, SLOT(quit()), KStdAccel::key(KStdAccel::Quit));
QPopupMenu *options = new QPopupMenu;
options->insertItem(i18n("Setup"), this, SLOT(setup()) );
options->insertItem(i18n("&Save Options"), this, SLOT(save()));
KHelpMenu *help = new KHelpMenu( this,
i18n("kfinger 0.9.0\n\n(c) Andrea Rizzi (rizzi@kde.org)"));
menubar->insertItem( i18n("&File"), file );
menubar->insertItem( i18n("&Options"), options );
menubar->insertSeparator();
menubar->insertItem( i18n("&Help"), help->menu() );
config->setGroup("Options");
statusBar = new KStatusBar(this);
statusBar->insertItem(i18n("KDE finger utility"),1);
toolBar = new KToolBar(this);
toolBar->insertButton(BarIcon("mini-connect.xpm"),0,SIGNAL(clicked()),this ,SLOT(button1Clicked()),1,i18n("Finger"),-1);
toolBar->insertButton(BarIcon("stop.xpm"),1,SIGNAL(clicked()),this ,SLOT(stopIt()),1,i18n("Stop current finger"),-1);
toolBar->setItemEnabled(1,false);
toolBar->insertButton(BarIcon("mini-ktalk.xpm"),4,SIGNAL(clicked()),this ,SLOT(talk()),1,i18n("Talk..."),-1);
toolBar->insertButton(BarIcon("mini-clock.xpm"),5,SIGNAL(toggled(int)),this ,SLOT(slotAuto(int)),1,i18n("AutoFinger On/Off"),-1);
toolBar->setToggle(5,true);
le = new QMultiLineEdit( this, "lineEdit" );
le->setGeometry( 10, 70, 420, 160 );
le->setReadOnly(1);
QFont font( "fixed", 10 );
font.setStyleHint( (QFont::StyleHint)0 );
font.setCharSet( (QFont::CharSet)0 );
le->setFont( font );
le->setText( i18n("Welcome to KDE Finger\n"));
QToolTip::add( le, i18n("Finger result" ));
QComboBox *combo = new QComboBox(true,toolBar);
toolBar->insertWidget(3,120,combo);
QComboBox *combo1 = new QComboBox(true,toolBar);
toolBar->insertWidget(2,120,combo1);
ed2Combo = combo1;
ed3Combo = combo;
connect(ed2Combo,SIGNAL(activated(const QString &)), this,SLOT(button1Clicked()));
connect(ed3Combo ,SIGNAL(activated(const QString &)), this,SLOT(button1Clicked()));
loadSettings();
if(!url.isEmpty()) {
if(url.find("@")<0)
{
ed3Combo->insertItem(url,0);
ed2Combo->insertItem("",0);
}
else
{
ed2Combo->insertItem(url.right(url.length()-url.find("@")-1),0);
ed3Combo->insertItem(url.left(url.find("@")),0);
}
}
setStatusBar(statusBar);
setMenu(menubar);
addToolBar(toolBar);
setView(le);
toolBar->show();
menubar->show();
le->show();
enableStatusBar(KStatusBar::Show);
if(!url.isEmpty()) button1Clicked();
resize(450,300);
}
kfinger'NetutilView::slotAuto() (./kdenetwork/kfinger/kfinger.C:126)
void NetutilView::slotAuto(int a)
{
autofinger=toolBar->isButtonOn(a);
config->setGroup("Options");
config->writeEntry("Time",autofinger);
}
kfinger'NetutilView::save() (./kdenetwork/kfinger/kfinger.C:133)
void NetutilView::save()
{
config->sync();
}
kfinger'NetutilView::loadSettings() (./kdenetwork/kfinger/kfinger.C:138)
void NetutilView::loadSettings()
{
int va;
config->setGroup("Options");
autofinger = config->readNumEntry("Time");
toolBar->setButton(5,autofinger);
va=(config->readNumEntry("Wait")-6) / 10;
Timer = startTimer(config->readNumEntry("Wait") * 100);
warning("%d",config->readNumEntry("Wait") * 100);
tencount = 0;
while(ed2Combo->count()>0)
ed2Combo->removeItem(0);
config->setGroup("Fserver");
for(va=1;va<=config->readNumEntry("NumFserver");va++) {
sstr.sprintf("Server%d",va);
ed2Combo->insertItem(config->readEntry(sstr));
}
if(config->readNumEntry("NumFserver")<1)
ed2Combo->insertItem("localhost");
while(ed3Combo->count()>0)
ed3Combo->removeItem(0);
config->setGroup("Fusers");
for(va=1;va<=config->readNumEntry("NumFusers");va++) {
sstr.sprintf("User%d",va);
ed3Combo->insertItem(config->readEntry(sstr));
}
if(config->readNumEntry("NumFuser")<1)
ed3Combo->insertItem(" ");
}
kfinger'NetutilView::talk() (./kdenetwork/kfinger/kfinger.C:175)
void NetutilView::talk()
{
int i,intvar;
QString sstr3;
QString sstr2;
QString user,server;
sstr3="";
sstr2="";
user="";
server="";
config->setGroup("Talk");
Talk *ta= new Talk(this,"Talk...",config->readEntry("TalkCom"));
for(i=config->readNumEntry("StartLine");i<le->numLines()-2;i++){
if(config->readNumEntry("SelectUser")==1) {
config->setGroup("FoUser");
sstr3 = le->textLine(i);
sstr3.remove(0,config->readNumEntry("O1"));
sscanf(sstr3,config->readEntry("F1"),(const char*)sstr2);
sstr3 = le->textLine(i);
sstr3.remove(0,config->readNumEntry("O2"));
sscanf(sstr3,config->readEntry("F2"),&intvar);
if(config->readNumEntry("Param")==1)sstr3.sprintf(config->readEntry("Out"),(const char*)sstr2);
if(config->readNumEntry("Param")==2)sstr3.sprintf(config->readEntry("Out"),(const char*)sstr2,intvar);
if(config->readNumEntry("Param")==3)sstr3.sprintf(config->readEntry("Out"),intvar);
if(config->readNumEntry("Param")==4)sstr3.sprintf(config->readEntry("Out"),intvar,(const char*)sstr2);
user=sstr3;
config->setGroup("Talk");
}
if(config->readNumEntry("SelectUser")==2) {
user = ed3Combo->currentText();
}
if(config->readNumEntry("SelectUser")==3) {
user=config->readEntry("UserName").copy();
}
if(config->readNumEntry("SelectServer")==1) {
config->setGroup("FoServer");
sstr2 = le->textLine(i);
sstr2.remove(0,config->readNumEntry("O1"));
sscanf(sstr2,config->readEntry("F1"),(const char*)sstr3);
sstr2 = le->textLine(i);
sstr2.remove(0,config->readNumEntry("O2"));
sscanf(sstr2,config->readEntry("F2"),&intvar);
if(config->readNumEntry("Param")==1)sstr2.sprintf(config->readEntry("Out"),(const char*)sstr3);
if(config->readNumEntry("Param")==2)sstr2.sprintf(config->readEntry("Out"),(const char*)sstr3,intvar);
if(config->readNumEntry("Param")==3)sstr2.sprintf(config->readEntry("Out"),intvar);
if(config->readNumEntry("Param")==4)sstr2.sprintf(config->readEntry("Out"),intvar,(const char*)sstr3);
sstr3 = le->textLine(i);
sstr3.remove(0,config->readNumEntry("O1"));
sscanf(sstr3,config->readEntry("F1"),(const char*)sstr2);
sstr3 = le->textLine(i);
sstr3.remove(0,config->readNumEntry("O2"));
sscanf(sstr3,config->readEntry("F2"),&intvar);
if(config->readNumEntry("Param")==1)sstr3.sprintf(config->readEntry("Out"),(const char *)sstr2);
if(config->readNumEntry("Param")==2)sstr3.sprintf(config->readEntry("Out"),(const char *)sstr2,intvar);
if(config->readNumEntry("Param")==3)sstr3.sprintf(config->readEntry("Out"),intvar);
if(config->readNumEntry("Param")==4)sstr3.sprintf(config->readEntry("Out"),intvar,(const char *)sstr2); sstr3 = le->textLine(i);
sstr3.remove(0,config->readNumEntry("O1"));
sscanf(sstr3,config->readEntry("F1"),(const char*)sstr2);
sstr3 = le->textLine(i);
sstr3.remove(0,config->readNumEntry("O2"));
sscanf(sstr3,config->readEntry("F2"),&intvar);
if(config->readNumEntry("Param")==1)sstr3.sprintf(config->readEntry("Out"),(const char *)sstr2);
if(config->readNumEntry("Param")==2)sstr3.sprintf(config->readEntry("Out"),(const char *)sstr2,intvar);
if(config->readNumEntry("Param")==3)sstr3.sprintf(config->readEntry("Out"),intvar);
if(config->readNumEntry("Param")==4)sstr3.sprintf(config->readEntry("Out"),intvar,(const char *)sstr2); sstr3 = le->textLine(i);
sstr3.remove(0,config->readNumEntry("O1"));
sscanf(sstr3,config->readEntry("F1"),(const char*)sstr2);
sstr3 = le->textLine(i);
sstr3.remove(0,config->readNumEntry("O2"));
sscanf(sstr3,config->readEntry("F2"),&intvar);
if(config->readNumEntry("Param")==1)sstr3.sprintf(config->readEntry("Out"),(const char *)sstr2);
if(config->readNumEntry("Param")==2)sstr3.sprintf(config->readEntry("Out"),(const char *)sstr2,intvar);
if(config->readNumEntry("Param")==3)sstr3.sprintf(config->readEntry("Out"),intvar);
if(config->readNumEntry("Param")==4)sstr3.sprintf(config->readEntry("Out"),intvar,(const char *)sstr2);
server=sstr3.copy();
config->setGroup("Talk");
}
if(config->readNumEntry("SelectServer")==2) {
server = ed2Combo->currentText();
}
if(config->readNumEntry("SelectServer")==3) {
server=config->readEntry("ServerName").copy(); }
user+='@';
user+=server;
ta->adduser(user);
}
ta->show();
}
kfinger'NetutilView::button1Clicked() (./kdenetwork/kfinger/kfinger.C:277)
void NetutilView::button1Clicked()
{
toolBar->setItemEnabled(0,false);
toolBar->setItemEnabled(1,true);
le->clear();
disconnect(ed2Combo,SIGNAL(activated(const QString &)), this,SLOT(button1Clicked()));
disconnect(ed3Combo ,SIGNAL(activated(const QString &)), this,SLOT(button1Clicked()));
if(protocol!=NULL)
delete protocol;
protocol = 0L;
qApp->processEvents();
qApp->flushX();
QString sstr,sstr2;
sstr2 = ed2Combo->currentText(); //server name
if (sstr2.isEmpty()) sstr2="localhost" ;
sstr.sprintf("%s\n\r",ed3Combo->currentText().data()); //user name
if (sstr[0]==0) sstr[0]=' ';
protocol=new FingerProtocol( sstr1);
connect(protocol,SIGNAL(connectionRefused()),this,SLOT(connRef()));
connect(protocol,SIGNAL(finish()),this,SLOT(stopIt()));
connect(protocol,SIGNAL(update()),this,SLOT(writeIt()));
if (!protocol->connection((const char *)sstr2,79)) // 79 : finger port
{
sstr2 = i18n("Error on server : %1").arg(ed2Combo->currentText());
statusBar->changeItem((const char*)sstr2,1);
if(protocol!=NULL)
delete protocol;
protocol = 0L;
toolBar->setItemEnabled(1,false);
toolBar->setItemEnabled(0,true);
connect(ed2Combo,SIGNAL(activated(const QString &)), this,SLOT(button1Clicked()));
connect(ed3Combo ,SIGNAL(activated(const QString &)), this,SLOT(button1Clicked()));
} else {
sstr2.sprintf("%s\n\r",(const char *)ed3Combo->currentText());
protocol->writeString(sstr2);
}
}
kfinger'NetutilView::writeIt() (./kdenetwork/kfinger/kfinger.C:322)
void NetutilView::writeIt()
{
QString sstr;
le->append(sstr1);
// QDateTime(QDateTime::currentDateTime()))
sstr = i18n("Finger %1@%2 -- %3")
.arg(ed3Combo->currentText())
.arg(ed2Combo->currentText())
.arg(QDateTime::currentDateTime().toString());
statusBar->changeItem(sstr,1);
}
kfinger'NetutilView::stopIt() (./kdenetwork/kfinger/kfinger.C:334)
void NetutilView::stopIt()
{
if(protocol!=NULL)
protocol->stopFlag=FALSE;
protocol = 0L;
toolBar->setItemEnabled(0,true);
toolBar->setItemEnabled(1,false);
connect(ed2Combo,SIGNAL(activated(const QString &)), this,SLOT(button1Clicked()));
connect(ed3Combo ,SIGNAL(activated(const QString &)), this,SLOT(button1Clicked()));
}
kfinger'NetutilView::about() (./kdenetwork/kfinger/kfinger.C:348)
void NetutilView::about()
{
QMessageBox::about(this,i18n("About"),i18n("Kfinger 0.9.0\n(c) by Andrea Rizzi\nrizzi@kde.org"));
}
kfinger'NetutilView::HtmlHelp() (./kdenetwork/kfinger/kfinger.C:353)
void NetutilView::HtmlHelp()
{
KApplication::kApplication()->invokeHTMLHelp("kfinger/kfinger.html", "");
}
kfinger'NetutilView::timerEvent() (./kdenetwork/kfinger/kfinger.C:360)
void NetutilView::timerEvent(QTimerEvent * )
{
if(protocol==0) {
tencount++;
if( (tencount==10)&&(autofinger ))
{
button1Clicked();
tencount=0;
}
}
}
kfinger'NetutilView::setup() (./kdenetwork/kfinger/kfinger.C:374)
void NetutilView::setup()
{
if(new Setup() == 0L)
warning("Could not start setup");
loadSettings();
}
kfinger'NetutilView::connRef() (./kdenetwork/kfinger/kfinger.C:381)
void NetutilView::connRef()
{
QString sstr2 = i18n("Connection refused by %1").arg(ed2Combo->currentText());
statusBar->changeItem(sstr2, 1);
}
// SETUP DIALOG