Beispiel #1
0
void SvnConsole::OnReadProcessOutput(wxCommandEvent& event)
{
    ProcessEventData *ped = (ProcessEventData *)event.GetClientData();
    if (ped) {
        m_output.Append(ped->GetData().c_str());
    }

    wxString s (ped->GetData());
    s.MakeLower();

    if (m_currCmd.printProcessOutput)
        AppendText( ped->GetData() );
    
    static wxRegEx reUsername("username[ \t]*:", wxRE_DEFAULT|wxRE_ICASE);
    wxArrayString lines = wxStringTokenize(s, wxT("\n"), wxTOKEN_STRTOK);
    if( !lines.IsEmpty() && lines.Last().StartsWith(wxT("password for '")) ) {
        m_output.Clear();
        wxString pass = wxGetPasswordFromUser(ped->GetData(), wxT("Subversion"));
        if(!pass.IsEmpty() && m_process) {
            m_process->WriteToConsole(pass);
        }
    } else if ( !lines.IsEmpty() && reUsername.IsValid() && reUsername.Matches( lines.Last() ) ) {
        // Prompt the user for "Username:"******"Subversion");
        if ( !username.IsEmpty() && m_process ) {
            m_process->Write(username + "\n");
        }
    }
    delete ped;
}
Beispiel #2
0
void MyFrame::PasswordEntry(wxCommandEvent& WXUNUSED(event))
{
    wxString pwd = wxGetPasswordFromUser(_T("Enter password:"******"Password entry dialog"),
                                         wxEmptyString,
                                         this);
    if ( !pwd.empty() )
    {
        wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd.c_str()),
                     _T("Got password"), wxOK | wxICON_INFORMATION, this);
    }
}
void TestDialog::OnButtonSelect( wxCommandEvent& event )
{
	wxString pwd = wxGetPasswordFromUser(_T("Enter password:"******"Password entry dialog"),
                                         wxEmptyString,
                                         this);
    if ( !pwd.empty() )
    {
        wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd.c_str()),
                     _T("Got password"), wxOK | wxICON_INFORMATION, this);
    }

}
Beispiel #4
0
ComicBookRAR::ComicBookRAR(wxString file, wxUint32 cacheLen, COMICAL_ZOOM zoom, long zoomLevel, bool fitOnlyOversize, COMICAL_MODE mode, FREE_IMAGE_FILTER filter, COMICAL_DIRECTION direction, wxInt32 scrollbarThickness) : ComicBook(file, cacheLen, zoom, zoomLevel, fitOnlyOversize, mode, filter, direction, scrollbarThickness)
{
	HANDLE rarFile;
	int RHCode = 0, PFCode = 0;
	struct RARHeaderDataEx header;
	struct RAROpenArchiveDataEx flags;
	wxString page, new_password;
	
	open_rar:
	
	rarFile = openRar(&flags, &header, RAR_OM_LIST);

	if (flags.Flags & 0x0080) { // if the headers are encrypted
		new_password = wxGetPasswordFromUser(
				wxT("This archive is password-protected.  Please enter the password."),
				wxT("Enter Password"));
		if (new_password.IsEmpty()) { // the dialog was cancelled, and the archive cannot be opened
			closeRar(rarFile, &flags);
			throw ArchiveException(filename, wxT("Comical could not open this file because it is password-protected."));
		}
		SetPassword(new_password.ToAscii());
	}
	if (password)
		RARSetPassword(rarFile, password);

	while ((RHCode = RARReadHeaderEx(rarFile, &header)) == 0) {
#ifdef wxUSE_UNICODE
		page = wxString(header.FileNameW);
#else
		page = wxString(header.FileName);
#endif
		if(page.Right(5).Upper() == wxT(".JPEG") || page.Right(4).Upper() == wxT(".JPG") ||
		page.Right(4).Upper() == wxT(".GIF") ||
		page.Right(4).Upper() == wxT(".PNG"))
			Filenames->Add(page);
		
		if ((PFCode = RARProcessFile(rarFile, RAR_SKIP, NULL, NULL)) != 0) {
			closeRar(rarFile, &flags);
			throw ArchiveException(filename, ProcessFileError(PFCode, page));
		}
	}

	closeRar(rarFile, &flags);
	
	// Wrong return code + needs password = wrong password given
	if (RHCode != ERAR_END_ARCHIVE && flags.Flags & 0x0080) 
		goto open_rar;

	postCtor();
	Create(); // create the wxThread
}
Beispiel #5
0
void UserWizardP2::OnAddNet(wxCommandEvent &event)
{

  wxListCtrl * listctrl = (wxListCtrl *)FindWindow(ID_U_CONFNETS);
  wxListBox * listbox = (wxListBox *)FindWindow(ID_U_ALLNETS);

  if (listbox->GetSelection() < 0)
    return;

  wxString prompt(wxT("What is your "));

  if (listbox->GetStringSelection() == wxT("ICQ"))
    prompt += wxT("UIN\non ICQ Network");
  else
  {
    prompt += wxT(" screen-name\non ");
    prompt += listbox->GetStringSelection();
    prompt += wxT(" Network?");
  }
  
  wxString screenname = wxGetTextFromUser(prompt, wxT("Contact Information"),wxT(""), this);

  if (screenname.IsEmpty())
    return;

  long fingstr = listctrl->FindItem(-1, screenname);

  if (fingstr >= 0)
  {
    if (listctrl->GetItemData(fingstr) == listbox->GetSelection())
    {
      wxMessageBox(wxT("Sorry, you can't have the same name/network twice."), wxT("Duplicate Info"), wxOK, this);
      return;
    }
  }

  wxString prompt2(wxT("Please enter the password for "));
  prompt2 += screenname;
  prompt2 += wxT(" on network ");
  prompt2 += listbox->GetStringSelection();
  wxString pw = wxGetPasswordFromUser(prompt2);

  m_pwords.insert(m_pwords.begin(), SecByteBlock((const unsigned char *)pw.c_str(), pw.length()));
  //pw = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

  listctrl->InsertItem(0, screenname);
  listctrl->SetItemData(0, listbox->GetSelection());
  listctrl->SetItem(0,1, listbox->GetStringSelection());

}
Beispiel #6
0
void KeyCardPanel::OnReadKeyCard(wxCommandEvent& evt)
{
	wxString pwd;
	pwd = wxGetPasswordFromUser(wxT("├▄┬в"),wxT("╩С╚в├▄н┐┐е├▄┬в"));
	int ret;
	ret = ks_loadcardkeys(pwd.c_str());
	if(ret)
	{
		wxMessageBox(wxT("Х┴├▄н┐┐е╩Д░▄"),wxT("┤ь╬з"));
	}
	else
	{
		ks_beep();
	}
}
Beispiel #7
0
ComicBookRAR::ComicBookRAR(wxString file, wxUint32 cacheLen, COMICAL_ZOOM zoom, long zoomLevel, bool fitOnlyOversize, COMICAL_MODE mode, FREE_IMAGE_FILTER filter, COMICAL_DIRECTION direction, wxInt32 scrollbarThickness) : ComicBook(file, cacheLen, zoom, zoomLevel, fitOnlyOversize, mode, filter, direction, scrollbarThickness)
{
	HANDLE rarFile;
	int RHCode = 0, PFCode = 0;
	struct RARHeaderDataEx header;
	struct RAROpenArchiveDataEx flags;
	wxString path, new_password;
	wxInputStream *stream;
	ComicPage *page;
	int numEntries, progress=0;
	
	open_rar:
	
	rarFile = openRar(&flags, &header, RAR_OM_LIST);

	if (flags.Flags & 0x0080) { // if the headers are encrypted
		new_password = wxGetPasswordFromUser(
				wxT("This archive is password-protected.  Please enter the password."),
				wxT("Enter Password"));
		if (new_password.IsEmpty()) { // the dialog was cancelled, and the archive cannot be opened
			closeRar(rarFile, &flags);
			throw ArchiveException(filename, wxT("Comical could not open this file because it is password-protected."));
		}
		SetPassword(new_password.ToAscii());
	}
	if (password)
		RARSetPassword(rarFile, password);

	// skip through the entire archive to count the number of entries
	for (numEntries = 0; RARReadHeaderEx(rarFile, &header) == 0; numEntries++) {
		if ((PFCode = RARProcessFile(rarFile, RAR_SKIP, NULL, NULL)) != 0) {
			closeRar(rarFile, &flags);
			throw ArchiveException(filename, ProcessFileError(PFCode, header.FileNameW));
		}
	}

	wxProgressDialog progressDlg(wxString(wxT("Opening ")) + file, wxString(), numEntries);
	progressDlg.SetMinSize(wxSize(400, -1));

	// close and re-open the archive to restart at the first header
	closeRar(rarFile, &flags);
	rarFile = openRar(&flags, &header, RAR_OM_LIST);

	while ((RHCode = RARReadHeaderEx(rarFile, &header)) == 0) {
		path = header.FileNameW;

		progressDlg.Update(progress, wxString(wxT("Scanning: ")) + path);
		progressDlg.CentreOnParent(wxHORIZONTAL);

		stream = ExtractStream(path);
		page = new ComicPage(path, stream);
		if (page->GetBitmapType() == wxBITMAP_TYPE_INVALID)
			delete page;
		else
			Pages.push_back(page);

		wxDELETE(stream);

		if ((PFCode = RARProcessFileW(rarFile, RAR_SKIP, NULL, NULL)) != 0) {
			closeRar(rarFile, &flags);
			throw ArchiveException(filename, ProcessFileError(PFCode, path));
		}

		progressDlg.Update(++progress);
	}

	closeRar(rarFile, &flags);
	
	// Wrong return code + needs password = wrong password given
	if (RHCode != ERAR_END_ARCHIVE && flags.Flags & 0x0080) 
		goto open_rar;

	postCtor();
	Create(); // create the wxThread
}
 wxString wx_GetPasswordFromUser(const wxString& message, const wxString& caption, const wxString& default_value)
 {
     return wxGetPasswordFromUser(message, caption, default_value);
 }