Пример #1
0
void CPPgScheduler::LoadSchedule(uint8 index) {

	Schedule_Struct* schedule=theApp.scheduler->GetSchedule(index);
	GetDlgItem(IDC_S_TITLE)->SetWindowText(schedule->title);

	//time
	CTime time=time.GetCurrentTime();
	if (schedule->time>0) time=schedule->time;
	m_time.SetTime(&time);
	
	CTime time2=time2.GetCurrentTime();
	if (schedule->time2>0) time2=schedule->time2;
	m_timeTo.SetTime(&time2);

	//time kindof (days)
	m_timesel.SetCurSel(schedule->day);

	CheckDlgButton(IDC_S_ENABLE,(schedule->enabled));
	CheckDlgButton(IDC_CHECKNOENDTIME, schedule->time2==0);

	OnDisableTime2();

	m_actions.DeleteAllItems();
	for (int i=0;i<16;i++) {
		if (schedule->actions[i]==0) break;
		m_actions.InsertItem(i,GetActionLabel(schedule->actions[i]));
		m_actions.SetItemText(i,1,schedule->values[i]);
		m_actions.SetItemData(i,schedule->actions[i]);
	}
}
Пример #2
0
void CPPgScheduler::LoadSchedule(int index) {
// MORPH START  leuk_he: Remove 2nd apply in scheduler
  bSuppressModifications=true;	
  GetDlgItem(IDC_S_TITLE)->SetWindowText(_T("")); // clear
// MORPH END leuk_he: Remove 2nd apply in scheduler
	Schedule_Struct* schedule=theApp.scheduler->GetSchedule(index);
	GetDlgItem(IDC_S_TITLE)->SetWindowText(schedule->title);

	//time
	CTime time=time.GetCurrentTime();
	if (schedule->time>0) time=schedule->time;
	m_time.SetTime(&time);
	
	CTime time2=time2.GetCurrentTime();
	if (schedule->time2>0) time2=schedule->time2;
	m_timeTo.SetTime(&time2);

	//time kindof (days)
	m_timesel.SetCurSel(schedule->day);

	CheckDlgButton(IDC_S_ENABLE,(schedule->enabled));
	CheckDlgButton(IDC_CHECKNOENDTIME, schedule->time2==0);

	OnDisableTime2();

	m_actions.DeleteAllItems();
	for (int i=0;i<16;i++) {
		if (schedule->actions[i]==0) break;
		m_actions.InsertItem(i,GetActionLabel(schedule->actions[i]));
		//MORPH START - Changed by Stulle, Show cat name for scheduler cat actions
		if(schedule->actions[i]==ACTION_CATSTOP || schedule->actions[i]==ACTION_CATRESUME)
		{
			int iCat = _tstoi(schedule->values[i]);
			CString strCatTitle;
			if(iCat == -1)
				strCatTitle = GetResString(IDS_ALL);
			else
			{
				Category_Struct* thisCat = thePrefs.GetCategory(iCat);
				if(thisCat)
					strCatTitle = thisCat->strTitle;
				else
					strCatTitle = GetResString(IDS_UNKNOWN);
			}
			m_actions.SetItemText(i,1,schedule->values[i]+L" ("+strCatTitle+L")");
		}
		else
		//MORPH END   - Changed by Stulle, Show cat name for scheduler cat actions
			m_actions.SetItemText(i,1,schedule->values[i]);
		m_actions.SetItemData(i,schedule->actions[i]);
	}
// MORPH START  leuk_he: Remove 2nd apply in scheduler
	bSuppressModifications=false;	
// MORPH END leuk_he: Remove 2nd apply in scheduler
}
Пример #3
0
BOOL CPPgScheduler::OnCommand(WPARAM wParam, LPARAM lParam)
{ 
	int item= m_actions.GetSelectionMark(); 
	// add
	if (wParam>=MP_SCHACTIONS && wParam<MP_SCHACTIONS+20 && m_actions.GetItemCount()<16)
	{
		uint8 action=wParam-MP_SCHACTIONS;
		uint8 i=m_actions.GetItemCount();
		m_actions.InsertItem(i,GetActionLabel(action));
		m_actions.SetItemData(i,action);
		m_actions.SetSelectionMark(i);
		if (action<6)
			OnCommand(MP_CAT_EDIT,0);
	}
	else if (wParam>=MP_SCHACTIONS+20 && wParam<=MP_SCHACTIONS+80)
	{
		CString newval;
		newval.Format(_T("%i"),wParam-MP_SCHACTIONS-22);
		m_actions.SetItemText(item,1,newval);
	}
	else if (wParam == ID_HELP)
	{
		OnHelp();
		return TRUE;
	}

	switch (wParam){ 
		case MP_CAT_EDIT: 
        { 
			if (item!=-1) {
				InputBox inputbox;
				// todo: differen prompts
				CString prompt;
				switch (m_actions.GetItemData(item)) {
					case 1:
					case 2:
						prompt=GetResString(IDS_SCHED_ENTERDATARATELIMIT)+_T(" (")+GetResString(IDS_KBYTESPERSEC)+_T(")");
						break;
					default: prompt=GetResString(IDS_SCHED_ENTERVAL);
				}
				inputbox.SetLabels(GetResString(IDS_SCHED_ACTCONFIG),prompt,m_actions.GetItemText(item,1));
				inputbox.DoModal();
				CString res=inputbox.GetInput();
				if (!inputbox.WasCancelled()) m_actions.SetItemText(item,1,res);
			}
			break; 
        }
		case MP_CAT_REMOVE:
		{
			// remove
			if (item!=-1) {
				int ix=m_actions.GetSelectionMark();
				if (ix!=-1) {
					m_actions.DeleteItem(ix);
				}
			}
			break;
		}
	} 
	return CPropertyPage::OnCommand(wParam, lParam);
}
Пример #4
0
BOOL CPPgScheduler::OnCommand(WPARAM wParam, LPARAM lParam)
{ 
   int item= m_actions.GetSelectionMark(); 
	// add
	if (wParam>=MP_SCHACTIONS && wParam<MP_SCHACTIONS+20 && m_actions.GetItemCount()<16)
	{
		int action=wParam-MP_SCHACTIONS;
		int i=m_actions.GetItemCount();
		m_actions.InsertItem(i,GetActionLabel(action));
    // MORPH START  leuk_he: Remove 2nd apply in scheduler
		SetModified();
    // MORPH END leuk_he: Remove 2nd apply in scheduler
		m_actions.SetItemData(i,action);
		m_actions.SetSelectionMark(i);
		if (action<6)
			OnCommand(MP_CAT_EDIT,0);
		// Mighty Knife START: parameterless schedule events
		else if (action>=ACTION_BACKUP && action<=ACTION_RELOAD) {
			// Small warning message
			if (action == ACTION_UPDIPCONF || action == ACTION_UPDFAKES || action == ACTION_UPDCOUNTRY) {
				XMessageBox (NULL,GetResString (IDS_SCHED_UPDATE_WARNING),
							 GetResString (IDS_WARNING),MB_OK | MB_ICONINFORMATION,NULL);
				m_actions.SetItemText(i,1,L"update");
			}
			else
				m_actions.SetItemText(i,1,L"-");
			CTime myTime1 ;m_time.GetTime(myTime1);  // MORPH add check for one time events
			CTime myTime2 ;m_timeTo.GetTime(myTime2);
			if ( myTime1!= myTime2) // leuk_he: warn because will be executeed every minute! 
				if(XMessageBox (NULL,GetResString(IDS_SCHED_WARNENDTIME),
				   GetResString (IDS_WARNING),MB_OKCANCEL| MB_ICONINFORMATION,NULL)== IDOK)
					 m_timeTo.SetTime(&myTime1); // On ok reset end time. 
		}
		//  Mighty Knife END
		//MORPH START - Changed by Stulle, Show cat name for scheduler cat actions
		else
			m_actions.SetItemText(i,1,L"-1 ("+GetResString(IDS_ALL)+L")");
		//MORPH END   - Changed by Stulle, Show cat name for scheduler cat actions
	}
	else if (wParam>=MP_SCHACTIONS+20 && wParam<=MP_SCHACTIONS+80)
	{
		CString newval;
		//MORPH START - Changed by Stulle, Show cat name for scheduler cat actions
		/*
		newval.Format(_T("%i"),wParam-MP_SCHACTIONS-22);
		*/
		int iCat = wParam-MP_SCHACTIONS-22;
		CString strCatTitle;
		if(iCat == -1)
			strCatTitle = GetResString(IDS_ALL);
		else
		{
			Category_Struct* thisCat = thePrefs.GetCategory(iCat);
			if(thisCat)
				strCatTitle = thisCat->strTitle;
			else // should not happen
				strCatTitle = GetResString(IDS_UNKNOWN);
		}
		newval.Format(L"%i (%s)",iCat,strCatTitle);
		//MORPH END   - Changed by Stulle, Show cat name for scheduler cat actions
		m_actions.SetItemText(item,1,newval);
		// MORPH START  leuk_he: Remove 2nd apply in scheduler
		SetModified();
		// lhane
   }
	else if (wParam == ID_HELP)
	{
		OnHelp();
		return TRUE;
	}

   switch (wParam){ 
		case MP_CAT_EDIT: 
        { 
			if (item!=-1) {
				InputBox inputbox;
				// todo: differen prompts
				CString prompt;
				switch (m_actions.GetItemData(item)) {
					case 1:
					case 2:
						prompt=GetResString(IDS_SCHED_ENTERDATARATELIMIT)+_T(" (")+GetResString(IDS_KBYTESPERSEC)+_T(")");
						break;
					default: prompt=GetResString(IDS_SCHED_ENTERVAL);
				}
				inputbox.SetLabels(GetResString(IDS_SCHED_ACTCONFIG),prompt,m_actions.GetItemText(item,1));
				inputbox.DoModal();
				CString res=inputbox.GetInput();
				if (!inputbox.WasCancelled()) m_actions.SetItemText(item,1,res);
         // MORPH START  leuk_he: Remove 2nd apply in scheduler
				SetModified();
        //MORPH END leuk_he: Remove 2nd apply in schedulerd
			}
			break; 
        }
		case MP_CAT_REMOVE:
		{
			// remove
			if (item!=-1) {
				int ix=m_actions.GetSelectionMark();
				if (ix!=-1) {
					m_actions.DeleteItem(ix);
				}
        // MORPH START  leuk_he: Remove 2nd apply in scheduler
				SetModified();
        // MORPH END leuk_he: Remove 2nd apply in scheduler
			}
			break;
		}
   } 
   return CPropertyPage::OnCommand(wParam, lParam);
}