Exemplo n.º 1
0
bool DictViewInstance::Save()
{
  reg.SetRegKey(reg_key.c_str(), dict_view_uid_key, reg_key.c_str());
  reg.SetRegKey(reg_key.c_str(), dict_view_name_key, name.c_str());
  reg.SetFarString(reg_key.c_str(), dict_view_logic_key, logic.AsString());
  return true;
}
Exemplo n.º 2
0
void CMailViewTpl::processHeaders( IWriteSink & f )
{
  PKludges Kludges = m_origMsg->GetKludges();

  for ( int i = 0; i < Kludges->Count(); i ++ )
  {
    FarString kludge = Kludges->At( i );

    m_origMsg->DecodeKludge( kludge.GetBuffer() ); kludge.ReleaseBuffer();

    int pos = 1;

    while ( ( pos = kludge.IndexOf( '\t', pos ) ) != -1 )
    {
      FarString ss = kludge.Left( pos );
      if (ss.Length() > 0 && ss[ss.Length() - 1] == ':')
      {
        pos ++;
        continue;
      }
      f.write( ss.c_str(), ss.Length() );
      f.write( "\r\n", 2 );
      kludge = kludge.Right( kludge.Length() - pos );
    }

    f.write( kludge.c_str(), kludge.Length() );

    if ( i < Kludges->Count() - 1 )
      f.write( "\r\n", 2 );
  }
}
Exemplo n.º 3
0
void DbgMsgV( char const * const Title, char const * const Fmt, va_list argList )
{
  FarString Tmp;
  Tmp.Format( "%s\n%s", Title, Tmp.FormatV( Fmt, argList ).c_str() );

  FarMessage::Show( FMSG_WARNING|FMSG_ALLINONE|FMSG_MB_OK, NULL, (LPCSTR const*)Tmp.c_str(), 0, 0 );
}
Exemplo n.º 4
0
void CMessageTemplate::writeFormatted( const FarString& str, int len, int fill, IWriteSink & f )
{
  if ( len > 0 )
  {
    f.write( str.c_str(), min( len, str.Length() ) );

    if ( fill != 0 )
    {
      for ( int i = str.Length(); i < len; i ++ )
        f.write( (const char*)&fill, 1 );
    }
  }
  else
    f.write( str.c_str(), str.Length() );

}
Exemplo n.º 5
0
int DictViewFactory::FindDictViewId(const FarString& id, 
  const FarString& name, void* client_context)
{
  FindDictViewId_Ctx* ctx = (FindDictViewId_Ctx *)client_context;
  if (ctx->name == name) {
    ctx->uid = atoi(id.c_str()+prefix_length);
    return 0;
  } else 
    return 1;
}
Exemplo n.º 6
0
void CMailViewTpl::processText( int len, IWriteSink & f )
{
  // TODO: check File
  FarFileName bodyFile = FarFileName::MakeTemp( "mvb" );

  File::mkdirs( bodyFile.GetPath() );

  PMsgPart TextPart = m_origMsg->GetTextPart();
  if ( TextPart )
  {
    long Encoding = GetMsgEncoding( m_origMsg, TextPart, m_defaultEncoding );

    if ( len > 20 )
    {
      FarStringArray Src;
      StrPtr sp = { NULL, 0, (LPSTR)TextPart->GetContentData() };
      LPCSTR Last = sp.Nxt + TextPart->GetContentSize();
      while ( sp.Nxt )
      {
        GetStrPtr( sp.Nxt, &sp, Last );
        Src.Add( ToOEMString( FarString( sp.Str, sp.Len ), Encoding ) );
      }
      FarStringArray * Dst = WordWrapLines( Src, len, true );
      for ( int i = 0; i < Dst->Count(); i ++ )
      {
        f.write( Dst->At( i ), strlen( Dst->At( i ) ) );
        f.write( "\r\n", 2 );
      }
      delete Dst;
    }
    else
    {
      FarString s = (LPCSTR)TextPart->GetContentData();

      s.SetLength( TextPart->GetContentSize() );

      s = ToOEMString( s, Encoding );

      f.write( s.c_str(), s.Length() );
    }

    File::deleteit( bodyFile );
  }
}
Exemplo n.º 7
0
int DictViewInstance::NextUID()
{
  int uid = reg.GetRegKey(reg_key.c_str(), dict_view_last_uid_key, 100000) + 1;
  reg.SetRegKey(reg_key.c_str(), dict_view_last_uid_key, uid);
  return uid;
}
Exemplo n.º 8
0
void CMailViewTpl::processKludge( LPCSTR kludge, IWriteSink & f )
{
  FarString s = m_origMsg->GetDecodedKludge( kludge );

  f.write( s.c_str(), s.Length() );
}
Exemplo n.º 9
0
	void SetText (FarString &String)
	{
		far_assert(fItem);
		strncpy (fItem->Data, String.c_str(), sizeof (fItem->Data)-1);
	}