Exemple #1
0
void
PostScript::SendHeader (/*[in]*/ const char * lpszHeaderName)
{
  PathName fileName;
  if (! SessionWrapper(true)->FindFile(lpszHeaderName, FileType::PSHEADER, fileName))
  {
    FATAL_MIKTEX_ERROR (T_("PostScript::SendHeader"),
      T_("Cannot find PostScript header file."), lpszHeaderName);
  }
  tracePS->WriteFormattedLine ("libdvi", T_("Sending %s..."), Q_(fileName));
  ExecuteBatch (fileName.Get());
}
/*Importing process
Also if select a db in OB and use 'Restore from SQL dump' warning pops up
*/
void 
ImportBatch::ImportDump()
{
	MDIWindow *wnd;
	HTREEITEM	hitem = NULL;
	wyString	msg, dbname;
	wyInt32		ret = 0;

	if((SendMessage(m_hwndedit, WM_GETTEXTLENGTH, 0, 0)) > 0)
    {
		VERIFY(wnd = GetActiveWin());

		//Check whether 'Restore from SQL dump' used after selecting a db in OB
		if(m_importing == wyFalse && wnd && wnd->m_pcqueryobject && wnd->m_pcqueryobject->GetSelectionImage() == NDATABASE)
		{
			hitem = wnd->m_pcqueryobject->GetDatabaseNode();
			wnd->m_pcqueryobject->GetDatabaseName(hitem);

			dbname.SetAs(wnd->m_pcqueryobject->m_seldatabase);
		    
			//warning shows when restore from sql dump does database(to avoid confusion of USE db in dump)
			if(dbname.GetLength())
			{
				msg.Sprintf(_("The current database context is `%s`. SQL statements in the file will be executed here, unless one or more USE statement(s) specifying another database context is in the file. Do you want to continue?"),
								dbname.GetString()); 

				ret = MessageBox(wnd->m_hwnd, msg.GetAsWideChar(),pGlobals->m_appname.GetAsWideChar(), MB_ICONQUESTION | MB_YESNO);
				if(ret != IDYES)
					return;
			}
		}
		
		if(m_importing) 
        {
			/* behave as if the stop has been pushed */
//			DEBUG_LOG("stopping query");
			m_stopimport = wyTrue;
		} 
        else 
        {
//			DEBUG_LOG("executing import");
			VERIFY(wyFalse == m_importing);
			SetCursor(LoadCursor(NULL, IDC_WAIT));
			ExecuteBatch();
			SetCursor(LoadCursor(NULL, IDC_ARROW));
		}
	}
	else
		yog_message(m_hwnd, _(L"Please enter a filename"), pGlobals->m_appname.GetAsWideChar(), MB_OK | MB_ICONINFORMATION);

	return;
}