コード例 #1
0
void ZGui::addtask()
{
//	ZDateModule* dlg = new ZDateModule(this, NULL, 0, ZSkinService::clsZDateModule);
//	ZDatePickerDlg* msg = new ZDatePickerDlg(dlg, this, NULL, true, 0);
//	msg->exec(); delete msg; msg = NULL;
//	QDate fecha = msg->getResultDate();

  QString minuto, hora, dia, mes, dias, tarea;

  ZConfig IDini(Idioma, false);
  QString val = IDini.readEntry(QString("CRONTAB"), QString("MINUTE"), "");
  ZSingleCaptureDlg* zscd = new ZSingleCaptureDlg( QString("Cron"), val, ZSingleCaptureDlg::normal, NULL, "ZSingleCaptureDlg", true, 0, 0);
  ZLineEdit* zle = (ZLineEdit*)zscd->getLineEdit(); zle->setEdited(true);  
  if (zscd->exec() == 1) { if ( zle->text() != "" ) { minuto=zle->text(); } } else return;

  val = IDini.readEntry(QString("CRONTAB"), QString("HOUR"), "");
  zscd = new ZSingleCaptureDlg( QString("Cron"), val, ZSingleCaptureDlg::normal, NULL, "ZSingleCaptureDlg", true, 0, 0);
  zle = (ZLineEdit*)zscd->getLineEdit(); zle->setEdited(true);  
  if (zscd->exec() == 1) { if ( zle->text() != "" ) { hora=zle->text(); } } else return;

  val = IDini.readEntry(QString("CRONTAB"), QString("DAYMONTH"), "");
  zscd = new ZSingleCaptureDlg( QString("Cron"), val, ZSingleCaptureDlg::normal, NULL, "ZSingleCaptureDlg", true, 0, 0);
  zle = (ZLineEdit*)zscd->getLineEdit(); zle->setEdited(true);  
  if (zscd->exec() == 1) { if ( zle->text() != "" ) { dia=zle->text(); } } else return;

  val = IDini.readEntry(QString("CRONTAB"), QString("MONTH"), "");
  zscd = new ZSingleCaptureDlg( QString("Cron"), val, ZSingleCaptureDlg::normal, NULL, "ZSingleCaptureDlg", true, 0, 0);
  zle = (ZLineEdit*)zscd->getLineEdit(); zle->setEdited(true);  
  if (zscd->exec() == 1) { if ( zle->text() != "" ) { mes=zle->text(); } } else return;

  val = IDini.readEntry(QString("CRONTAB"), QString("DAYWEEK"), "");
  zscd = new ZSingleCaptureDlg( QString("Cron"), val, ZSingleCaptureDlg::normal, NULL, "ZSingleCaptureDlg", true, 0, 0);
  zle = (ZLineEdit*)zscd->getLineEdit(); zle->setEdited(true);  
  if (zscd->exec() == 1) { if ( zle->text() != "" ) { dias=zle->text(); } } else return;

  qApp->processEvents();

  ZFileOpenDialog *zopen  = new ZFileOpenDialog();
  zopen->exec();
  if ( zopen->result() == 1 )
  {
    QString archivo = zopen->getFileName();
    if (archivo != "")
	{
	  system(QString("echo \"%1 %2 %3 %4 %5 %6\" >> /ezxlocal/LinXtend/usr/bin/cron/user.txt").arg(minuto).arg(hora).arg(dia).arg(mes).arg(dias).arg(archivo));
	  zllb1->clear(); CargarMenu1();
	}
  }

}
コード例 #2
0
void ZOptionItem::selected(ZSettingItem* item)
{
	if ( (ZOptionItem*)item != this )
		return;
	
	switch ( type )
	{
		case EDIT_TEXT:
		case EDIT_TEXT_NUM:
		case EDIT_FILE:
			{
			ZSingleCaptureDlg* zscd = new ZSingleCaptureDlg(title, "", ZSingleCaptureDlg::TypeLineEdit, this, "", true, 0, 0);
			ZLineEdit* zle = (ZLineEdit*)zscd->getLineEdit();
			#ifndef WITHOUT_EDIT_TEXT_NUM
			if ( type==EDIT_TEXT_NUM )
				((ZApplication*)qApp)->setInputMethod(zle, ZKB_INPUT_NUMERIC, ZKbInputField::FIELD_TYPE_NUMERIC, ""); 
			#endif
			zle->setText(text);
			if ( zscd->exec() == QDialog::Accepted )
				setText(zle->text());
			delete zle;
			delete zscd;
			}
			break;
		case EDIT_BOOL_YESNO:
		case EDIT_BOOL_ONOFF:
			{
			QStringList itemList;
			if ( type==EDIT_BOOL_ONOFF )
			{
				itemList.append(LNG_ON);
				itemList.append(LNG_OFF);
			} else
			{
				itemList.append(LNG_YES);
				itemList.append(LNG_NO);				
			}
			ZSingleSelectDlg *dlg = new ZSingleSelectDlg(title, "", this);
			dlg->addItemsList(itemList);
			dlg->getListBox()->checkItem(!n, true);
			if ( dlg->exec() == QDialog::Accepted )
				setNum(!dlg->getCheckedItemIndex());
			delete dlg;
			}
			break;
		case EDIT_NUM:
			{
			ZNumPickerDlg * dlg = new ZNumPickerDlg(2, this);
			ZNumModule* num = dlg->getNumModule();
			num->setMaxValue(max);
			num->setMinValue(min);
			num->setValue(n);
			if ( dlg->exec() == QDialog::Accepted )
				setNum( num->getValue() );
			delete num;
			delete dlg;
			}
			break;
		#ifndef WITHOUT_GAIN_VOL
		case EDIT_GAIN_VOLUME:
			{
			ZNumPickerDlg * dlg = new ZNumPickerDlg(2, this);
			ZNumModule* num = dlg->getNumModule();
			num->setMaxValue( GAIN_DEVICE_VOL_MAX );
			num->setMinValue( GAIN_DEVICE_VOL_MIN);
			num->setValue( gainTable[n] );			
			if ( dlg->exec() == QDialog::Accepted )
			{
				gainTable[n] = num->getValue();
				setSubItem(0, 1, QString::number( gainTable[n] ) );				
			}
			delete num;
			delete dlg;
			}
			break;	
		case EDIT_GAIN_EQUALOSER:
			{

			ZSingleCaptureDlg* zscd = new ZSingleCaptureDlg(title, "", ZSingleCaptureDlg::TypeLineEdit, this, "", true, 0, 0);
			ZLineEdit* zle = (ZLineEdit*)zscd->getLineEdit();
			((ZApplication*)qApp)->setInputMethod(zle, ZKB_INPUT_NUMERIC, ZKbInputField::FIELD_TYPE_NUMERIC, ""); 
			zle->setText(QString::number(u2n.num-GAIN_EQUALASER_MIN));		
			if ( zscd->exec() == QDialog::Accepted )
			{
				int num = zle->text().toInt();
				if ( num<0 )
					num=0;
				if ( num>GAIN_EQUALASER_MAX-GAIN_EQUALASER_MIN )
					num=GAIN_EQUALASER_MAX-GAIN_EQUALASER_MIN;
				
				u2n.num = num+GAIN_EQUALASER_MIN;
				memcpy(&gainTable[n], u2n.data, 2);
				setSubItem(0, 1, QString::number( u2n.num-GAIN_EQUALASER_MIN ) );				
			}
			delete zle;
			delete zscd;
			}
			break;		
		#endif	
		case EDIT_ONE_OF_LIST:
			{
			if ( list == NULL )
				return;
			ZSingleSelectDlg *dlg = new ZSingleSelectDlg(title, "", this);
			dlg->addItemsList(*list);
			dlg->getListBox()->checkItem(n, true);
			if ( dlg->exec() == QDialog::Accepted )
				setNum(dlg->getCheckedItemIndex());
			delete dlg;	
			}	
			break;
		case EDIT_INTERNET_PROFILE:
			#ifndef WITHOUT_EDIT_INTERNET_PROFILE
			{
			UINT32 profiles = NAPI_GetMaxProfiles();
			QStringList list;
			list.append(LNG_ASK);
			if(profiles != -1) 
			{
				char *buf = new char[NAPI_MAX_PROFILE_NAME_LENGTH * profiles];
				if(NAPI_ListAllProfile((INT8*)buf, &profiles) != -1) 
				{
					char *prof_ptr = buf;
					for(uint i = 0; i < profiles; i++, prof_ptr = buf + i * NAPI_MAX_PROFILE_NAME_LENGTH)
						list.append(QString::fromUtf8(prof_ptr));
				}
				delete buf;	
			}
			ZSingleSelectDlg *dlg = new ZSingleSelectDlg(title, "", this);
			dlg->addItemsList(list);
			
			int sel=0, i=0;
			for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
				if ( *it == text )
				{
					sel=i;
					break;
				} else
					i++;
			if ( sel >= 0 )
				dlg->getListBox()->checkItem(sel, true);
			if ( dlg->exec() == QDialog::Accepted )
			{
				n=dlg->getCheckedItemIndex();
				setText( (n>0)?(*(list.at(n))):"" );
			}
			delete dlg;
			}
			#endif
			break;
	}
}