|
|
|
@ -21,6 +21,8 @@
|
|
|
|
|
#include <kstdguiitem.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
|
|
/* Finding out ICEauthority path */
|
|
|
|
|
#include <kprocio.h>
|
|
|
|
|
|
|
|
|
|
Schedule::Schedule( TQWidget* parent, TQStringList filepattern, const char* name, bool modal, WFlags fl )
|
|
|
|
|
: TQDialog( parent, name, modal, fl )
|
|
|
|
@ -33,17 +35,19 @@ Schedule::Schedule( TQWidget* parent, TQStringList filepattern, const char* name
|
|
|
|
|
|
|
|
|
|
// for each user
|
|
|
|
|
// CTCronIterator i = const_cast<CTHost&>(cth).cron.begin();
|
|
|
|
|
// CTCron* ctcron((CTCron*)*i);
|
|
|
|
|
// CTCron* ctcron((CTCron*)*i);
|
|
|
|
|
|
|
|
|
|
/* Figure out where the ICEauthority file is located */
|
|
|
|
|
getICEauth();
|
|
|
|
|
|
|
|
|
|
_filepattern = filepattern;
|
|
|
|
|
//bool isRTL = TQApplication::reverseLayout();
|
|
|
|
|
TQVBoxLayout *vbox = new TQVBoxLayout(this, KDialog::marginHint(),
|
|
|
|
|
KDialog::spacingHint(), "vbox");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQGroupBox *group = new TQGroupBox("Schedule Scan of Selected Folders", this);
|
|
|
|
|
vbox->addWidget(group);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQGridLayout *layout = new TQGridLayout( group, 6, 6, KDialog::spacingHint(),
|
|
|
|
@ -371,6 +375,8 @@ TQString Schedule::createScanScript()
|
|
|
|
|
ts << " done" << "\n";
|
|
|
|
|
ts << "fi" << "\n";
|
|
|
|
|
ts << "export DCOPSERVER=`cat ${HOME}/.DCOPserver_${HOSTNAME}_${DISPLAY} | grep local`" << "\n";
|
|
|
|
|
/* This path is always the same for the current user */
|
|
|
|
|
ts << TQString("export ICEAUTHORITY=%1 # issue 21").arg(iceauth) << "\n";
|
|
|
|
|
ts << "# Execution starts here" << "\n";
|
|
|
|
|
ts << "if [ \"$1\" = \"\" ]; then" << "\n";
|
|
|
|
|
ts << " exit 1" << "\n";
|
|
|
|
@ -468,6 +474,50 @@ TQString Schedule::createStartupScript()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Schedule::getICEauth()
|
|
|
|
|
{
|
|
|
|
|
/* Code taken from freshklam.cpp */
|
|
|
|
|
TQString command=TQString("iceauth -v exit");
|
|
|
|
|
|
|
|
|
|
iceproc = new KProcIO();
|
|
|
|
|
iceproc->setUseShell(TRUE);
|
|
|
|
|
iceproc->setUsePty(KProcIO::Stdout,TRUE);
|
|
|
|
|
|
|
|
|
|
*iceproc<<command;
|
|
|
|
|
|
|
|
|
|
connect( iceproc, SIGNAL(readReady(KProcIO *)),
|
|
|
|
|
SLOT(slotICEoutput(KProcIO *)) );
|
|
|
|
|
connect( iceproc, SIGNAL(processExited(TDEProcess *)),
|
|
|
|
|
SLOT(slotICEexited()) );
|
|
|
|
|
|
|
|
|
|
iceproc->start(KProcIO::NotifyOnExit);
|
|
|
|
|
iceproc->closeWhenDone();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Schedule::slotICEexited()
|
|
|
|
|
{
|
|
|
|
|
delete iceproc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Schedule::slotICEoutput(KProcIO *)
|
|
|
|
|
{
|
|
|
|
|
TQString lineout = "";
|
|
|
|
|
int pos;
|
|
|
|
|
|
|
|
|
|
if ((pos = (iceproc->readln(lineout))) != -1) {
|
|
|
|
|
if ((pos = (lineout.find("Using authority file"))) != -1){
|
|
|
|
|
lineout = lineout.stripWhiteSpace();
|
|
|
|
|
int StartPoint = (lineout.find("Using authority file") + 20);
|
|
|
|
|
iceauth = lineout.mid(StartPoint).stripWhiteSpace();
|
|
|
|
|
// kdDebug() << "iceauth file: " << iceauth << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
iceproc->ackRead();
|
|
|
|
|
lineout = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HMSTimeWidget::HMSTimeWidget(TQWidget *parent, const char *name) :
|
|
|
|
|