예제 #1
0
// ****************************************************************************
//
//  Function Name:	RAlert::QueryUser( )
//
//  Description:		Ask the user a question with an Alert and Yes/No buttons.
//							Retrieve the message from a resource file.
//
//  Returns:			kAlertYes or kAlertNo
//
//  Exceptions:		None
//
// ****************************************************************************
//
YAlertValues	RAlert::QueryUser( YResourceId queryId )
	{
	RMBCString	string = GetResourceManager().GetResourceString( queryId );
#ifdef	TPSDEBUG
	char	buffer[128];
	buffer[0] = '\0';
	WinCode( wsprintf( buffer, " - %d", queryId ) );
	string += buffer;
#endif
	return QueryUser( (LPCSZ)string );
	}
예제 #2
0
void CuDlgMain::OnSelchangeComboNode2() 
{
	try
	{
		m_nAlreadyRefresh &= ~REFRESH_DATABASE2;
		m_nAlreadyRefresh &= ~REFRESH_USER2;
		int nSel = m_cComboNode2.GetCurSel();
		CaNode* pNode = (CaNode*)m_cComboNode2.GetItemDataPtr(nSel);
		if (m_bPreselectDBxUser)
		{
			if (pNode)
			{
				CString strSelectedItem = _T("");
				QueryDatabase(&m_cComboDatabase2, pNode, strSelectedItem);
				QueryUser(&m_cComboUser2, pNode, strSelectedItem);
			}
		}
		else
		{
			CString strSelectedUser = _T("");
			CaNode* pNode = (CaNode*)m_cComboNode2.GetItemDataPtr(nSel);
			if (pNode)
				QueryUser(&m_cComboUser2, pNode, strSelectedUser);
			m_cComboDatabase2.SetCurSel(-1);
			m_cComboUser2.SetCurSel(-1);
		}
		m_cComboUser2.EnableWindow(TRUE);
	}
	catch (CeSqlException e)
	{
		if (e.GetErrorCode() == -30140)
			AfxMessageBox (IDS_MSG_USER_UNAVAILABLE);
		else
			AfxMessageBox (e.GetReason());
	}
	catch(...)
	{
	}
	m_vsdaCtrl.HideFrame(1);
}
예제 #3
0
void CuDlgMain::OnDropdownComboUser2() 
{
	int nSel = m_cComboNode2.GetCurSel();
	if (nSel != CB_ERR)
	{
		CaNode* pNode = (CaNode*)m_cComboNode2.GetItemDataPtr(nSel);
		if (pNode)
		{
			CString strSelectedUser = _T("");
			QueryUser(&m_cComboUser2, pNode, strSelectedUser);
		}
	}
}
예제 #4
0
int rcmd_query(int ent, FILEHEADER *finfo, char *direct)
{
	/* XXX 看版/精華區/短箋 共用 Read(), 在這裡跳掉避免 function stack
	 * 一直長, i.e. 看版->QueryUser->短箋->QueryUse ... */
	if (in_note)
		return C_NONE;

	if (finfo->owner[0] != '#' && !strchr(finfo->owner, '.') &&
	    !strchr(finfo->owner, '@'))
	{
		QueryUser(finfo->owner, NULL);
		return C_LOAD;
	}
	msg("作者/發信人來自站外,無法查詢!");		/* lthuang */
	getkey();
	return C_NONE;
}
예제 #5
0
//-----GetLocalFileName---------------------------------------------------------
// Sets the local filename and opens the file
// returns false if the user hits cancel
bool CFileDlg::GetLocalFileName()
{
  QString f;
  bool bValid = false;

  QTextCodec *codec = UserCodec::codecForProtoUser(m_szId, m_nPPID);
  
  // Get the local filename and open it, loop until valid or cancel
  while(!bValid)
  {
#ifdef USE_KDE
    KURL u = KFileDialog::getSaveURL(
          QString(QDir::homeDirPath() + "/" + codec->toUnicode(m_sFileInfo.szName)),
          QString::null, this);
    f = u.path();
#else
    f = QFileDialog::getSaveFileName(
          QString(QDir::homeDirPath() + "/" + codec->toUnicode(m_sFileInfo.szName)),
          QString::null, this);
#endif
    if (f.isNull()) return (false);
    struct stat buf;
    int nFlags = O_WRONLY;
    m_nFilePos = 0;
    if (stat(QFile::encodeName(f), &buf) == 0)  // file already exists
    {
      if ((unsigned long)buf.st_size >= m_sFileInfo.nSize)
      {
        if(QueryUser(this, tr("File already exists and is at least as big as the incoming file."), tr("Overwrite"), tr("Cancel")))
          nFlags |= O_TRUNC;
        else
          return (false);
      }
      else
      {
        if (QueryUser(this, tr("File already exists and appears incomplete."), tr("Overwrite"), tr("Resume")))
          nFlags |= O_TRUNC;
        else
        {
          nFlags |= O_APPEND;
          m_nFilePos = buf.st_size;
        }
      }
    }
    else
    {
      nFlags |= O_CREAT;
    }

    m_nFileDesc = open (QFile::encodeName(f), nFlags, 00664);
    if (m_nFileDesc < 0)
    {
      if (!QueryUser(this, tr("Open error - unable to open file for writing."), tr("Retry"), tr("Cancel")))
        return (false);
    }
    else
      bValid = true;
  }

  nfoLocalFileName->setText(f);
  m_nBytesTransfered = 0;
  barTransfer->setTotalSteps(m_sFileInfo.nSize / 1024);
  barTransfer->setProgress(0);
  return(true);
}