Beispiel #1
0
void CIrcWnd::OnBnClickedBnIrcconnect()
{
	if(!m_bConnected)
	{
		if( thePrefs.GetIRCNick().MakeLower() == _T("emule") || thePrefs.GetIRCNick().MakeLower().Find(_T("emuleirc")) != -1 )
		{
			InputBox inputbox;
			inputbox.SetLabels(GetResString(IDS_IRC_NEWNICK), GetResString(IDS_IRC_NEWNICKDESC), _T("eMule"));
			if (inputbox.DoModal() == IDOK)
			{
				CString input = inputbox.GetInput();
				input.Trim();
				input = input.SpanExcluding(_T(" !@#$%^&*():;<>,.?{}~`+=-"));
				if( input != "" )
					thePrefs.SetIRCNick(input.GetBuffer());
			}
		}
		//if not connected, connect..
		m_pIrcMain->Connect();
	}
	else
	{
		//If connected, disconnect..
		m_pIrcMain->Disconnect();
	}
}
Beispiel #2
0
void CPPgDirectories::OnBnClickedAddUNC()
{
	InputBox inputbox;
	inputbox.SetLabels(GetResString(IDS_UNCFOLDERS), GetResString(IDS_UNCFOLDERS), _T("\\\\Server\\Share"));
	if (inputbox.DoModal() != IDOK)
		return;
	CString unc=inputbox.GetInput();

	// basic unc-check 
	if (!PathIsUNC(unc)){
		AfxMessageBox(GetResString(IDS_ERR_BADUNC), MB_ICONERROR);
		return;
	}

	if (unc.Right(1) == _T("\\"))
		unc.Delete(unc.GetLength()-1, 1);

	for (POSITION pos = thePrefs.shareddir_list.GetHeadPosition();pos != 0;){
		if (unc.CompareNoCase(thePrefs.shareddir_list.GetNext(pos))==0)
			return;
	}
	for (int posi = 0; posi < m_ctlUncPaths.GetItemCount(); posi++){
		if (unc.CompareNoCase(m_ctlUncPaths.GetItemText(posi, 0)) == 0)
			return;
	}

	m_ctlUncPaths.InsertItem(m_ctlUncPaths.GetItemCount(), unc);
	SetModified();
}
Beispiel #3
0
void CIrcWnd::OnBnClickedIrcConnect()
{
	if (!m_bConnected)
	{
		CString sInput = thePrefs.GetIRCNick();
		sInput.Trim();
		sInput = sInput.SpanExcluding(_T(" !@#$%^&*():;<>,.?{}~`+=-"));
		sInput = sInput.Left(25);
		while (sInput.IsEmpty()
			   || sInput.CompareNoCase(_T("emule")) == 0
			   || stristr(sInput, _T("emuleirc")) != NULL)
		{
			InputBox inputBox;
			inputBox.SetLabels(GetResString(IDS_IRC_NEWNICK), GetResString(IDS_IRC_NEWNICKDESC), sInput);
			if (inputBox.DoModal() == IDOK)
			{
				sInput = inputBox.GetInput();
				sInput.Trim();
				sInput = sInput.SpanExcluding(_T(" !@#$%^&*():;<>,.?{}~`+=-"));
				sInput = sInput.Left(25);
			}
			else
				return;
		}
		thePrefs.SetIRCNick(sInput);
		//if not connected, connect..
		m_pIrcMain->Connect();
	}
	else
	{
		//If connected, disconnect..
		m_pIrcMain->Disconnect();
		m_wndChanList.ResetServerChannelList();
	}
}
Beispiel #4
0
void CPPgFiles::OnSetCleanupFilter()
{
	CString prompt = GetResString(IDS_FILTERFILENAMEWORD);
	InputBox inputbox;
	inputbox.SetLabels(GetResString(IDS_FNFILTERTITLE), prompt, thePrefs.GetFilenameCleanups());
	inputbox.DoModal();
	if (!inputbox.WasCancelled())
		thePrefs.SetFilenameCleanups(inputbox.GetInput());
}
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);
}
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);
}