@ -1,12 +1,19 @@ 
			
		
	
		
		
			
				
					
					# include  <QNetworkReply> # include  <QNetworkReply>  
			
		
	
		
		
			
				
					
					
 # include  <QHBoxLayout>  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					# include  "widgets/input.hpp" # include  "widgets/input.hpp"  
			
		
	
		
		
			
				
					
					# include  "widgets/ssh_keys.hpp" # include  "widgets/ssh_keys.hpp"  
			
		
	
		
		
			
				
					
					# include  "common/params.h" # include  "common/params.h"  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					SshControl : : SshControl ( )  :  AbstractControl ( " SSH Keys " ,  " Warning: This grants SSH access to all public keys in your GitHub settings. Never enter a GitHub username other than your own. A comma employee will NEVER ask you to add their GitHub username. " ,  " " )  { SshControl : : SshControl ( )  :  AbstractControl ( " SSH Keys " ,  " Warning: This grants SSH access to all public keys in your GitHub settings. Never enter a GitHub username other than your own. A comma employee will NEVER ask you to add their GitHub username. " ,  " " )  {  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					  // setup widget
    // setup widget
   
			
		
	
		
		
			
				
					
					  hlayout - > addStretch ( 1 ) ;   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					  username_label . setAlignment ( Qt : : AlignVCenter ) ;   
			
		
	
		
		
			
				
					
					  username_label . setStyleSheet ( " color: #aaaaaa " ) ;   
			
		
	
		
		
			
				
					
					  hlayout - > addWidget ( & username_label ) ;   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					  btn . setStyleSheet ( R " (    btn . setStyleSheet ( R " (   
			
		
	
		
		
			
				
					
					    padding :  0 ;      padding :  0 ;   
			
		
	
		
		
			
				
					
					    border - radius :  50 px ;      border - radius :  50 px ;   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -27,6 +34,7 @@ SshControl::SshControl() : AbstractControl("SSH Keys", "Warning: This grants SSH 
			
		
	
		
		
			
				
					
					        getUserKeys ( username ) ;          getUserKeys ( username ) ;   
			
		
	
		
		
			
				
					
					      }        }   
			
		
	
		
		
			
				
					
					    }  else  {      }  else  {   
			
		
	
		
		
			
				
					
					      Params ( ) . delete_db_value ( " GithubUsername " ) ;   
			
		
	
		
		
			
				
					
					      Params ( ) . delete_db_value ( " GithubSshKeys " ) ;        Params ( ) . delete_db_value ( " GithubSshKeys " ) ;   
			
		
	
		
		
			
				
					
					      refresh ( ) ;        refresh ( ) ;   
			
		
	
		
		
			
				
					
					    }      }   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -45,8 +53,10 @@ SshControl::SshControl() : AbstractControl("SSH Keys", "Warning: This grants SSH 
			
		
	
		
		
			
				
					
					void  SshControl : : refresh ( )  { void  SshControl : : refresh ( )  {  
			
		
	
		
		
			
				
					
					  QString  param  =  QString : : fromStdString ( Params ( ) . get ( " GithubSshKeys " ) ) ;    QString  param  =  QString : : fromStdString ( Params ( ) . get ( " GithubSshKeys " ) ) ;   
			
		
	
		
		
			
				
					
					  if  ( param . length ( ) )  {    if  ( param . length ( ) )  {   
			
		
	
		
		
			
				
					
					    username_label . setText ( QString : : fromStdString ( Params ( ) . get ( " GithubUsername " ) ) ) ;   
			
		
	
		
		
			
				
					
					    btn . setText ( " REMOVE " ) ;      btn . setText ( " REMOVE " ) ;   
			
		
	
		
		
			
				
					
					  }  else  {    }  else  {   
			
		
	
		
		
			
				
					
					    username_label . setText ( " " ) ;   
			
		
	
		
		
			
				
					
					    btn . setText ( " ADD " ) ;      btn . setText ( " ADD " ) ;   
			
		
	
		
		
			
				
					
					  }    }   
			
		
	
		
		
			
				
					
					  btn . setEnabled ( true ) ;    btn . setEnabled ( true ) ;   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -79,6 +89,7 @@ void SshControl::parseResponse(){ 
			
		
	
		
		
			
				
					
					    networkTimer - > stop ( ) ;      networkTimer - > stop ( ) ;   
			
		
	
		
		
			
				
					
					    QString  response  =  reply - > readAll ( ) ;      QString  response  =  reply - > readAll ( ) ;   
			
		
	
		
		
			
				
					
					    if  ( reply - > error ( )  = =  QNetworkReply : : NoError  & &  response . length ( ) )  {      if  ( reply - > error ( )  = =  QNetworkReply : : NoError  & &  response . length ( ) )  {   
			
		
	
		
		
			
				
					
					      Params ( ) . write_db_value ( " GithubUsername " ,  username . toStdString ( ) ) ;   
			
		
	
		
		
			
				
					
					      Params ( ) . write_db_value ( " GithubSshKeys " ,  response . toStdString ( ) ) ;        Params ( ) . write_db_value ( " GithubSshKeys " ,  response . toStdString ( ) ) ;   
			
		
	
		
		
			
				
					
					    }  else  if ( reply - > error ( )  = =  QNetworkReply : : NoError ) {      }  else  if ( reply - > error ( )  = =  QNetworkReply : : NoError ) {   
			
		
	
		
		
			
				
					
					      err  =  " Username ' "  +  username  +  " ' has no keys on GitHub " ;        err  =  " Username ' "  +  username  +  " ' has no keys on GitHub " ;