std::string Str_ToStr( int i ) { char buf[BUFFER]; Lsnprintf( buf, BUFFER - 1, "%i", i ); return std::string( buf ); }
void OpenHomeDir( PanelWin* p ) { #ifdef _WIN32 std::vector<unicode_t> homeUri = GetHomeUriWin(); if ( homeUri.data() ) { const std::vector<clPtr<FS>> checkFS = { p->GetFSPtr(), g_MainWin->GetOtherPanel( p )->GetFSPtr() }; FSPath path; clPtr<FS> fs = ParzeURI( homeUri.data(), path, checkFS ); if ( fs.IsNull() ) { char buf[4096]; FSString name = homeUri.data(); Lsnprintf( buf, sizeof( buf ), "bad home path: %s\n", name.GetUtf8() ); NCMessageBox( g_MainWin, "Home", buf, true ); } else { p->LoadPath( fs, path, 0, 0, PanelWin::SET ); } } #else const sys_char_t* home = (sys_char_t*) getenv( "HOME" ); if ( !home ) { return; } FSPath path( sys_charset_id, home ); p->LoadPath( new FSSys(), path, 0, 0, PanelWin::SET ); #endif }
SftpLogonDialog::SftpLogonDialog( NCDialogParent* parent, FSSftpParam& params ) : NCVertDialog( ::createDialogAsChild, 0, parent, utf8_to_unicode( _LT( "SFTP logon" ) ).data(), bListOkCancel ), iL( 16, 3 ), serverText(0, this, utf8_to_unicode(_LT("&Server:")).data(), &serverEdit), userText(0, this, utf8_to_unicode(_LT("&Login:"******"Password:"******"&Port:" ) ).data(), &portEdit ), charsetText(0, this, utf8_to_unicode(_LT("&Charset:")).data(), &charsetButton), charsetIdText( 0, this, utf8_to_unicode( "***************" ).data() ), //чтоб место забить charset( params.charset ), serverEdit ( 0, this, 0, 0, 16 ), userEdit ( 0, this, 0, 0, 16 ), // passwordEdit (this, 0, 0, 16), portEdit ( 0, this, 0, 0, 7 ), charsetButton( 0, this, utf8_to_unicode( ">" ).data() , 1000 ) { serverEdit.SetText( params.server.Data(), true ); userEdit.SetText( params.user.Data(), true ); // passwordEdit.SetText(params.pass.Data(), true); char buf[0x100]; Lsnprintf( buf, sizeof( buf ), "%i", params.port ); portEdit.SetText( utf8_to_unicode( buf ).data(), true ); bool focus = false; iL.AddWin( &serverText, 0, 0, 0, 0 ); serverText.Enable(); serverText.Show(); iL.AddWin( &serverEdit, 0, 1, 0, 1 ); serverEdit.Enable(); serverEdit.Show(); if ( !focus && !params.server.Data()[0] ) { serverEdit.SetFocus(); focus = true; } iL.AddWin( &userText, 2, 0, 2, 0 ); userText.Enable(); userText.Show(); iL.AddWin( &userEdit, 2, 1, 2 , 1 ); userEdit.Enable(); userEdit.Show(); if ( !focus && !params.user.Data()[0] ) { userEdit.SetFocus(); focus = true; } /* passwordEdit.SetPasswordMode(); iL.AddWin(&passwordText, 3, 0, 3, 0); passwordText.Enable(); passwordText.Show(); iL.AddWin(&passwordEdit, 3, 1, 3, 1); passwordEdit.Enable(); passwordEdit.Show(); if (!focus && !params.pass.Data()[0]) { passwordEdit.SetFocus(); focus = true; } */ iL.AddWin( &portText, 4, 0, 4, 0 ); portText.Enable(); portText.Show(); iL.AddWin( &portEdit, 4, 1, 4, 1 ); portEdit.Enable(); portEdit.Show(); iL.AddWin( &charsetText, 5, 0, 5, 0 ); charsetText.Enable(); charsetText.Show(); charsetIdText.SetText( utf8_to_unicode( charset_table[params.charset]->name ).data() ); iL.AddWin( &charsetIdText, 5, 1, 5, 1 ); charsetIdText.Enable(); charsetIdText.Show(); iL.AddWin( &charsetButton, 5, 2 ); charsetButton.Enable(); charsetButton.Show(); AddLayout( &iL ); SetEnterCmd( CMD_OK ); order.append( &serverEdit ); order.append( &userEdit ); // order.append(&passwordEdit); order.append( &portEdit ); order.append( &charsetButton ); SetPosition(); }