Beispiel #1
0
bool sCopyFile(const char *source,const char *dest,bool failifexists)
{
  sFile *sf = sOpenFile(source,sFA_Read);
  sFile *df = sOpenFile(dest,sFA_Write);
  bool ok = 0;
  if(sf && df)
  {
    uptr size = uptr(sf->GetSize());
    uptr block = 1024*1024;
    uint8 *buffer = new uint8[block];
    
    while(size>0)
    {
      uptr chunk = sMin(block,size);
      sf->Read(buffer,chunk);
      df->Write(buffer,chunk);
      size -= chunk;
    }
  }
  if(sf) if(!sf->Close()) ok = 0;
  if(df) if(!df->Close()) ok = 0;
  
  if(!ok)
    sLogF("file","failed to copy file <%s> to <%s>",source,dest);
  else
    sLogF("file","copy file <%s> to <%s>",source,dest);
  return ok;
}
Beispiel #2
0
Documents::Documents(QWidget *pParent) :
  QWidget(pParent)
{
  setupUi(this);
  
  _source = Uninitialized;
  _sourceid = -1;


  _images->addColumn(tr("Image Name"),  _itemColumn,   Qt::AlignLeft, true, "image_name" );
  _images->addColumn(tr("Description"), -1,            Qt::AlignLeft, true, "image_descrip" );
  _images->addColumn(tr("Purpose"),     _itemColumn*2, Qt::AlignLeft, true, "image_purpose" );

  _files->addColumn(tr("Title"),        _itemColumn, Qt::AlignLeft,true, "url_title");
  _files->addColumn(tr("URL"),          -1, Qt::AlignLeft,true, "url_url");

  connect(_deleteFile, SIGNAL(clicked()), this, SLOT(sDeleteFile()));
  connect(_editFile, SIGNAL(clicked()), this, SLOT(sEditFile()));
  connect(_newFile, SIGNAL(clicked()), this, SLOT(sNewFile()));
  connect(_viewFile, SIGNAL(clicked()), this, SLOT(sViewFile()));
  connect(_openFile, SIGNAL(clicked()), this, SLOT(sOpenFile()));
  
  connect(_openImage, SIGNAL(clicked()), this, SLOT(sOpenImage()));
  connect(_newImage, SIGNAL(clicked()), this, SLOT(sNewImage()));
  connect(_editImage, SIGNAL(clicked()), this, SLOT(sEditImage()));
  connect(_viewImage, SIGNAL(clicked()), this, SLOT(sViewImage()));
  connect(_printImage, SIGNAL(clicked()), this, SLOT(sPrintImage()));
  connect(_deleteImage, SIGNAL(clicked()), this, SLOT(sDeleteImage()));
  
  connect(_imagesButton, SIGNAL(toggled(bool)), this, SLOT(sImagesToggled(bool)));
  connect(_filesButton, SIGNAL(toggled(bool)), this, SLOT(sFilesToggled(bool)));
}