diff options
| author | Mavridis Philippe <mavridisf@gmail.com> | 2021-01-13 19:30:17 +0200 | 
|---|---|---|
| committer | Mavridis Philippe <mavridisf@gmail.com> | 2021-01-13 19:30:17 +0200 | 
| commit | 357ddeb8afd82d69ef871c146f4fc8f2c67fb17e (patch) | |
| tree | dc3ef0e6fedd64f5fb177c114f72e1515a07cd1b /src/schedule.cpp | |
| parent | c6cbd71bc169ac0e927e52325dbbbcb506abbc73 (diff) | |
| download | klamav-357ddeb8afd82d69ef871c146f4fc8f2c67fb17e.tar.gz klamav-357ddeb8afd82d69ef871c146f4fc8f2c67fb17e.zip | |
Conversion Qt3->TQt
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'src/schedule.cpp')
| -rw-r--r-- | src/schedule.cpp | 134 | 
1 files changed, 67 insertions, 67 deletions
| diff --git a/src/schedule.cpp b/src/schedule.cpp index 1400f62..56c03d2 100644 --- a/src/schedule.cpp +++ b/src/schedule.cpp @@ -10,10 +10,10 @@  #include "ktview.h" -#include <qlabel.h> +#include <tqlabel.h>  #include <kurlrequester.h> -#include <qlayout.h> -#include <qlistview.h> +#include <tqlayout.h> +#include <tqlistview.h>  //#include <qlistviewitem.h>  #include <kglobalsettings.h>  #include <kdialog.h> @@ -22,8 +22,8 @@  #include <sys/stat.h> -Schedule::Schedule( QWidget* parent, QStringList filepattern, const char* name, bool modal, WFlags fl ) -    : QDialog( parent, name, modal, fl ) +Schedule::Schedule( TQWidget* parent, TQStringList filepattern, const char* name, bool modal, WFlags fl ) +    : TQDialog( parent, name, modal, fl )  {  	setCaption( i18n( "Schedule Scan" ) ); @@ -37,16 +37,16 @@ Schedule::Schedule( QWidget* parent, QStringList filepattern, const char* name,  	_filepattern = filepattern; -	//bool isRTL = QApplication::reverseLayout(); -	QVBoxLayout *vbox = new QVBoxLayout(this, KDialog::marginHint(), +	//bool isRTL = TQApplication::reverseLayout(); +	TQVBoxLayout *vbox = new TQVBoxLayout(this, KDialog::marginHint(),  			KDialog::spacingHint(), "vbox"); -	QGroupBox *group = new QGroupBox("Schedule Scan of Selected Folders", this); +	TQGroupBox *group = new TQGroupBox("Schedule Scan of Selected Folders", this);  	vbox->addWidget(group); -	QGridLayout *layout = new QGridLayout( group, 6, 6, KDialog::spacingHint(), +	TQGridLayout *layout = new TQGridLayout( group, 6, 6, KDialog::spacingHint(),  			KDialog::spacingHint(), "layout");  	layout->addRowSpacing(0, group->fontMetrics().height());  	layout->setColStretch(0, 1); @@ -54,7 +54,7 @@ Schedule::Schedule( QWidget* parent, QStringList filepattern, const char* name, -	check_combo = new QComboBox(false, group); +	check_combo = new TQComboBox(false, group);     check_combo->insertItem( i18n("When I log in to KDE"));     check_combo->insertItem( i18n("Every day at "));     check_combo->insertItem( i18n("Every day at the current time")); @@ -78,9 +78,9 @@ Schedule::Schedule( QWidget* parent, QStringList filepattern, const char* name,  	hour->setValidator(new KStrictIntValidator(0, 23, hour));  	layout->addWidget(hour, 1, 1); -	QLabel *dots1 = new QLabel(":", group); +	TQLabel *dots1 = new TQLabel(":", group);  	dots1->setMinimumWidth( 7 ); -	dots1->setAlignment( QLabel::AlignCenter ); +	dots1->setAlignment( TQLabel::AlignCenter );  	layout->addWidget(dots1, 1, 2);  	minute = new HMSTimeWidget( group ); @@ -93,14 +93,14 @@ Schedule::Schedule( QWidget* parent, QStringList filepattern, const char* name, -	QPushButton* add = new QPushButton ("Add", group); +	TQPushButton* add = new TQPushButton ("Add", group);  	layout->addWidget(add,1,5);  	//add->setFixedSize(add->sizeHint());   	connect( add, SIGNAL(clicked()),   		SLOT(slotScheduleScan()) ); -	QPushButton* del = new QPushButton ("Delete", group); +	TQPushButton* del = new TQPushButton ("Delete", group);  	layout->addWidget(del,1,6);  	//del->setFixedSize(del->sizeHint()); @@ -108,21 +108,21 @@ Schedule::Schedule( QWidget* parent, QStringList filepattern, const char* name,   		SLOT(slotDelete()) ); -	//schedulebox = new QListView(group); +	//schedulebox = new TQListView(group);  	schedulebox = new KTView(group); -	QFontMetrics rb_fm(schedulebox->fontMetrics()); +	TQFontMetrics rb_fm(schedulebox->fontMetrics());  	schedulebox->setMinimumSize(rb_fm.width("0")*55,  				rb_fm.lineSpacing()*15);  /*	//kdDebug() << ((schedulebox->width())/2) << endl;  	schedulebox->addColumn( "Paths to Scan",(group->width()));          schedulebox->addColumn( "When to Scan",(group->width())); -	schedulebox->setResizeMode(QListView::AllColumns); -	schedulebox->setSelectionMode( QListView::Extended ); +	schedulebox->setResizeMode(TQListView::AllColumns); +	schedulebox->setSelectionMode( TQListView::Extended );  	schedulebox->setAllColumnsShowFocus(true);*/  	layout->addMultiCellWidget(schedulebox, 2, 4,0,6); -	QHBoxLayout *h5 = new QHBoxLayout( vbox, KDialog::spacingHint() ); +	TQHBoxLayout *h5 = new TQHBoxLayout( vbox, KDialog::spacingHint() );  	h5->addStretch( 1 );  	// OK @@ -151,25 +151,25 @@ void Schedule::slotQueryDatePicker(int)  	if (check_combo->currentText().contains(i18n("specific date")) ){  		DatePicker *_calendar;	 -		_calendar = new DatePicker(this, QDateTime::currentDateTime().date()); +		_calendar = new DatePicker(this, TQDateTime::currentDateTime().date());  		int x = this->width() - (this->width()/2);  		int y = this->height() - (this->height()/2); -		_calendar->move(QPoint(x,y)); +		_calendar->move(TQPoint(x,y));  		_calendar->show();  		_calendar->setFocus(); -		connect( _calendar, SIGNAL(signalSelectedDate(QDate)),this, -			SLOT(slotAddDateToCombo(QDate)) ); +		connect( _calendar, SIGNAL(signalSelectedDate(TQDate)),this, +			SLOT(slotAddDateToCombo(TQDate)) );  	}  } -void Schedule::slotAddDateToCombo(QDate newdate) +void Schedule::slotAddDateToCombo(TQDate newdate)  {  	//check_combo->insertItem  	_date = newdate;  	//kdDebug() << newdate.toString() << endl; -	QString newstring = check_combo->currentText().replace("a specific date",newdate.toString()); +	TQString newstring = check_combo->currentText().replace("a specific date",newdate.toString());  	check_combo->insertItem(newstring);  	check_combo->setCurrentItem(check_combo->count()-1); @@ -194,7 +194,7 @@ void Schedule::slotScheduleScan()   	CTCron* ctcron((CTCron*)*i);	*/  	//delete cttask; -	QString command = check_combo->currentText(); +	TQString command = check_combo->currentText(); @@ -203,28 +203,28 @@ void Schedule::slotScheduleScan()  	cttask->user = "";  	if (command.contains(i18n("When I log in to KDE")) ){ -		QString startupcommand = createStartupScript(); +		TQString startupcommand = createStartupScript();  		cttask->comment = (const char *)i18n("KlamAV Scheduled Scan at KDE Login of %1").arg(_filepattern.join(" ")).local8Bit(); -		cttask->command = (const char *)QString("%1").arg(startupcommand).local8Bit(); +		cttask->command = (const char *)TQString("%1").arg(startupcommand).local8Bit();  		cttask->enabled = FALSE;  	}else{  		cttask->comment = (const char *)i18n("KlamAV Scheduled Scan of %1").arg(_filepattern.join(" ")).local8Bit(); -		cttask->command = (const char *)QString("%1 '%2'").arg(createScanScript()).arg(_filepattern.join("' '")).local8Bit(); +		cttask->command = (const char *)TQString("%1 '%2'").arg(createScanScript()).arg(_filepattern.join("' '")).local8Bit();  		cttask->enabled = TRUE;  	}  	cttask->silent = FALSE; -	int curhour = (QTime::currentTime()).hour(); -	unsigned int curmin = (QTime::currentTime()).minute(); +	int curhour = (TQTime::currentTime()).hour(); +	unsigned int curmin = (TQTime::currentTime()).minute(); -	int shour = QString(hour->text()).toInt(); -	unsigned int smin = QString(minute->text()).toInt(); +	int shour = TQString(hour->text()).toInt(); +	unsigned int smin = TQString(minute->text()).toInt();  	int sdatedayofweek = _date.dayOfWeek(); -	int todaydayofweek = QDate::currentDate().dayOfWeek(); +	int todaydayofweek = TQDate::currentDate().dayOfWeek();  	if (command.contains(i18n("at the current time")) ){ @@ -251,7 +251,7 @@ void Schedule::slotScheduleScan()  	}else if (command.contains(i18n("Every month")) ){  		if (command.contains(i18n("from now on") )) -			cttask->dayOfMonth.set(QDate::currentDate().day(), TRUE); +			cttask->dayOfMonth.set(TQDate::currentDate().day(), TRUE);  		else  			cttask->dayOfMonth.set(_date.day(), TRUE);  		for (int dw = 1; dw <= 7; dw++) @@ -291,11 +291,11 @@ void Schedule::slotScheduleScan() -	QString description = QString::fromLocal8Bit(cttask->describe().c_str());  +	TQString description = TQString::fromLocal8Bit(cttask->describe().c_str());   	CTCron* ctcron(schedulebox->getCTCron());  	if (cttask->dirty())  		ctcron->task.push_back(cttask); -		//new KTListTask(this, ctcron, cttask); // Qt will clean up +		//new KTListTask(this, ctcron, cttask); // TQt will clean up  	else  		delete cttask; @@ -303,7 +303,7 @@ void Schedule::slotScheduleScan()  	schedulebox->refresh();  	cthost->apply(); -	//QListViewItem* tm = new QListViewItem( schedulebox, _filepattern, description); +	//TQListViewItem* tm = new TQListViewItem( schedulebox, _filepattern, description);  /*	if (cthost->isError())  	{ @@ -320,7 +320,7 @@ void Schedule::slotDelete()  {  	//kdDebug() << schedulebox->currentItem()->text(1) << endl; -	QFile file(schedulebox->currentItem()->text(1).section(" ",0,0).stripWhiteSpace()); +	TQFile file(schedulebox->currentItem()->text(1).section(" ",0,0).stripWhiteSpace());  	file.remove();  	schedulebox->remove();  	cthost->apply(); @@ -337,33 +337,33 @@ void Schedule::slotCancel()  	close();  } -QString Schedule::createScanScript() +TQString Schedule::createScanScript()  { -	QString path = getenv("HOME"); +	TQString path = getenv("HOME");  	path += "/.klamav"; -	QDir klamavdir(path); +	TQDir klamavdir(path);  	if (!klamavdir.exists() && !klamavdir.mkdir(path)) -		return QString("Error"); +		return TQString("Error"); -	QTime now = QTime::currentTime(); -	QDate today = QDate::currentDate(); -	QString timestring = QString("%1%2") +	TQTime now = TQTime::currentTime(); +	TQDate today = TQDate::currentDate(); +	TQString timestring = TQString("%1%2")  		.arg(today.toString("ddMMyy"))  		.arg(now.toString("hhmmss")); -	QFile file( QString("%1/ScanWithKlamav_%2.sh").arg(path).arg(timestring )); +	TQFile file( TQString("%1/ScanWithKlamav_%2.sh").arg(path).arg(timestring ));  	if ( file.open( IO_WriteOnly ) ) { -		QTextStream ts( &file ); +		TQTextStream ts( &file ); -		QString kdedir = getenv("KDEDIR"); +		TQString kdedir = getenv("KDEDIR");  		ts << "#!/bin/bash" << "\n";  		ts << "HOSTNAME=`hostname`" << "\n";  		ts << "export HOSTNAME" << "\n"; -		ts << QString("PATH=%1").arg(QString(getenv("PATH"))) << "\n"; +		ts << TQString("PATH=%1").arg(TQString(getenv("PATH"))) << "\n";  		ts << "export PATH" << "\n";  		ts << "DCOPSERVER=`cat /home/${USER}/.DCOPserver_${HOSTNAME}_:0 | grep local`" << "\n";  		ts << "export DCOPSERVER" << "\n"; @@ -396,33 +396,33 @@ QString Schedule::createScanScript()  		chmod((const char *)file.name(), S_IWUSR | S_IRUSR | S_IEXEC );  		return file.name();  	}else -		return QString("Error"); +		return TQString("Error");  } -QString Schedule::createStartupScript() +TQString Schedule::createStartupScript()  { -	QString path = KGlobalSettings::autostartPath(); -	QDir startupdir(path); +	TQString path = KGlobalSettings::autostartPath(); +	TQDir startupdir(path);  	if (!startupdir.exists()) -		return QString("Error"); +		return TQString("Error"); -	QTime now = QTime::currentTime(); -	QDate today = QDate::currentDate(); -	QString timestring = QString("%1%2") +	TQTime now = TQTime::currentTime(); +	TQDate today = TQDate::currentDate(); +	TQString timestring = TQString("%1%2")  		.arg(today.toString("ddMMyy"))  		.arg(now.toString("hhmmss")); -	QFile file( QString("%1klamav_%2.desktop").arg(path).arg(timestring )); +	TQFile file( TQString("%1klamav_%2.desktop").arg(path).arg(timestring ));  	if ( file.open( IO_WriteOnly ) ) { -		QTextStream ts( &file ); +		TQTextStream ts( &file );  		ts << "[Desktop Entry]" << "\n";  		ts << "Encoding=UTF-8" << "\n";  		ts << "Name=Klamav" << "\n"; -		ts << QString("Exec=klamav %i %m -caption \"%c\" --scanthis '%1'").arg(_filepattern.join("' '")) << "\n"; +		ts << TQString("Exec=klamav %i %m -caption \"%c\" --scanthis '%1'").arg(_filepattern.join("' '")) << "\n";  		ts << "Icon=klamav" << "\n";  		ts << "Type=Application" << "\n";  		ts << "DocPath=klamav/klamav.html" << "\n"; @@ -462,33 +462,33 @@ QString Schedule::createStartupScript()  		chmod((const char *)file.name(), S_IWUSR | S_IRUSR | S_IEXEC );  		return file.name();  	}else -		return QString("Error"); +		return TQString("Error");  } -HMSTimeWidget::HMSTimeWidget(QWidget *parent, const char *name) : +HMSTimeWidget::HMSTimeWidget(TQWidget *parent, const char *name) :  	KIntSpinBox(parent, name)  {  } -QString HMSTimeWidget::mapValueToText(int value) +TQString HMSTimeWidget::mapValueToText(int value)  { -  QString s = QString::number(value); +  TQString s = TQString::number(value);    if( value < 10 ) {      s = "0" + s;    }    return s;  } -QValidator::State KStrictIntValidator::validate( QString & input, int & d ) const +TQValidator::State KStrictIntValidator::validate( TQString & input, int & d ) const  {    if( input.isEmpty() )      return Valid; -  State st = QIntValidator::validate( input, d ); +  State st = TQIntValidator::validate( input, d );    if( st == Intermediate )      return Invalid; | 
