Scheduler scipt: store path to ICEauthority file in script.

This hopefully resolves issue #21.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/24/head
Mavridis Philippe 4 years ago
parent 13cb4a5e7d
commit 4ffce7bb90
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -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) :

@ -43,6 +43,7 @@ class KURLRequester;
class CollectionSetup;
class TQToolButton;
class TQHBoxLayout;
class KProcIO;
class HMSTimeWidget : public KIntSpinBox
{
@ -123,11 +124,17 @@ private slots:
void slotDelete();
void slotOK();
void slotCancel();
void slotICEoutput(KProcIO *);
void slotICEexited();
private:
void setupAccel();
void setupActions();
TQString createScanScript();
TQString createStartupScript();
TQString iceauth;
void getICEauth();
private:
signals:
@ -163,6 +170,7 @@ private:
CTHost* cthost;
CTTask* cttask;
CTCron* ctcron;
KProcIO *iceproc;
};

Loading…
Cancel
Save