Beispiel #1
0
LRESULT CDateTimePickerDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	SetWindowText(_T("Date"));

#if defined(_WIN32_WCE)

    SHINITDLGINFO shidi = { SHIDIM_FLAGS, m_hWnd, SHIDIF_SIZEDLGFULLSCREEN };
    RHO_ASSERT(SHInitDialog(&shidi));


    SHMENUBARINFO mbi = { sizeof(mbi), 0 };
    mbi.hwndParent = m_hWnd;
    mbi.nToolBarId = IDR_GETURL_MENUBAR;
    mbi.hInstRes = _AtlBaseModule.GetResourceInstance();
    RHO_ASSERT(SHCreateMenuBar(&mbi));

	SYSTEMTIME times[2]; // min and max times
	unsigned int flags = 0;


	if (m_min_time != 0) {
		UnixTimeToSystemTime(m_min_time, &(times[0]));
		flags = flags | GDTR_MIN;
	}
	if (m_max_time != 0) {
		UnixTimeToSystemTime(m_max_time, &(times[1]));
		flags = flags | GDTR_MAX;
	}
	DateTime_SetRange( GetDlgItem(IDC_DATE_CTRL), flags, times);


	GotoDlgCtrl(GetDlgItem(IDC_DATE_CTRL));

#else 

	CreateButtons();
	GotoDlgCtrl(m_btnOk);

#endif

	DLG_ITEM_SET_FONT_BOLD (IDC_DATE_STATIC);
	DLG_ITEM_SET_FONT_BOLD (IDC_TIME_STATIC);

	if (m_format == CDateTimeMessage::FORMAT_DATE) {
		GetDlgItem(IDC_TIME_CTRL).ShowWindow(SW_HIDE);
		GetDlgItem(IDC_TIME_STATIC).ShowWindow(SW_HIDE);
	}

    return FALSE;
}
Beispiel #2
0
bool touchmind::util::TimeUtil::JavaTimeToSystemTime(LONGLONG javaTime, SYSTEMTIME* systemTime)
{
    time_t t;
    WORD milliseconds;
    JavaTimeToUnixTime(javaTime, &t, &milliseconds);
    if (!UnixTimeToSystemTime(t, systemTime)) {
        return false;
    }
    systemTime->wMilliseconds = milliseconds;
    return true;
}
Beispiel #3
0
LRESULT CTimePickerDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	if ((m_title != NULL) && (strlen(m_title) > 0)) {
		String title = m_title;
		StringW title_w = convertToStringW(title);
		//SetWindowText(title_w.c_str());
		//GetDlgItem(IDC_TIME_CTRL).SetWindowText(title_w.c_str());
		SetDlgItemText(ID_TIME_CAPTION, title_w.c_str());
	}
	else {
		SetWindowText(_T("Date"));
	}

#if defined(_WIN32_WCE)

    SHINITDLGINFO shidi = { SHIDIM_FLAGS, m_hWnd, SHIDIF_SIZEDLGFULLSCREEN };
    RHO_ASSERT(SHInitDialog(&shidi));

    SHMENUBARINFO mbi = { sizeof(mbi), 0 };
    mbi.hwndParent = m_hWnd;
    mbi.nToolBarId = IDR_GETURL_MENUBAR;
    mbi.hInstRes = _AtlBaseModule.GetResourceInstance();
    RHO_ASSERT(SHCreateMenuBar(&mbi));
	GotoDlgCtrl(GetDlgItem(IDC_TIME_CTRL));

	SYSTEMTIME start_time;
	if (m_initialTime != 0) {
		UnixTimeToSystemTime(m_initialTime, &start_time);
		DateTime_SetSystemtime( GetDlgItem(IDC_TIME_CTRL), GDT_VALID, &start_time);
	}

#else

	CreateButtons();
	GotoDlgCtrl(m_btnOk);

#endif

	DLG_ITEM_SET_FONT_BOLD (IDC_TIME_STATIC);
	DLG_ITEM_SET_FONT_BOLD (ID_TIME_CAPTION);

    return FALSE;
}
Beispiel #4
0
SearchResult SearchHistory(MCONTACT contact, MEVENT hFirstEvent, void *searchData, int direction, int type)
{
	if (hFirstEvent == NULL){
		typedef MEVENT(__stdcall *db_event_start_t)(MCONTACT contact);
		db_event_start_t db_event_start = (direction == DIRECTION_BACK) ? db_event_last : db_event_first;
		hFirstEvent = db_event_start(contact);
	}
	int index = 0;
	MEVENT hEvent = hFirstEvent;
	void *buffer = NULL;
	TCHAR *search;
	bool found = false;
	int oldSize, newSize;
	oldSize = newSize = 0;

	DBEVENTINFO dbEvent = { 0 };
	dbEvent.cbSize = sizeof(dbEvent);

	while ((!found) && (hEvent)){
		newSize = db_event_getBlobSize(hEvent);
		if (newSize > oldSize)
		{
			buffer = (TCHAR *)realloc(buffer, newSize);
			oldSize = newSize;
		}
		dbEvent.pBlob = (PBYTE)buffer;
		dbEvent.cbBlob = newSize;
		if (db_event_get(hEvent, &dbEvent) == 0){ //successful
			switch (type)
			{
			case SEARCH_TEXT:
			{
#ifdef _UNICODE
				wchar_t TEMP[2048];
				size_t size = mir_strlen((char *)dbEvent.pBlob) + 1;
				if (size < dbEvent.cbBlob)
				{
					search = (wchar_t *)&dbEvent.pBlob[size];
				}
				else{
					MultiByteToWideChar(CP_ACP, 0, (char *)buffer, (int)size, TEMP, 2048);
					search = TEMP;
				}
#else
				search = (char *) buffer;
#endif
				TCHAR *data = (TCHAR *)searchData;
				TCHAR *tmp = _tcsstr(search, data);
				if (tmp)
				{
					found = true;
				}
				break;
			}
			case SEARCH_TIME:
			{
				SYSTEMTIME time;
				TimeSearchData *data = (TimeSearchData *)searchData;
				UnixTimeToSystemTime((time_t)dbEvent.timestamp, &time);
				found = ((data->flags & TSDF_DATE_SET) || (data->flags & TSDF_TIME_SET)) ? true : false;
				if (data->flags & TSDF_DATE_SET)
				{
					found = ((time.wYear == data->time.wYear) && (time.wMonth == data->time.wMonth) && (time.wDay == data->time.wDay));
				}
				if (data->flags & TSDF_TIME_SET)
				{
					found = found & ((time.wHour == data->time.wHour) && (time.wMinute == data->time.wMinute));
				}
				break;
			}
			}
		}
		if (!found){
			hEvent = GetNeededEvent(hEvent, 1, direction);
			index++;
		}
	}
	free(buffer);
	SearchResult sr;
	sr.index = index;
	sr.hEvent = hEvent;
	return sr;
}