Logo Search packages:      
Sourcecode: nateon version File versions  Download package

bool KNateon::initializeLoginView (  ) 

로그인취소

KConfig의 설정을 가지고 옴.

개인 접속 정보

로그인 관련

TODO: exception

Definition at line 292 of file knateon.cpp.

References nmconfig::autologin, config, connectWithAccount(), nmconfig::hidestart, slotDisconnected(), and slotHidenLogin().

Referenced by initialize().

{

      if (!m_pLoginView)
      {
            m_pLoginView = new LoginView(this, "loginview");
            m_pLoginView->initialize();
            setCentralWidget(m_pLoginView);
            m_pLoginView->show();
            connect( m_pLoginView->hideLoginCheckBox, SIGNAL( toggled ( bool ) ), SLOT( slotHidenLogin( bool ) ) );
            connect( m_pLoginView, SIGNAL( connectWithAccount(Account*) ), SLOT(connectWithAccount(Account*) ) );
            
            /*! 로그인취소 */
            connect( m_pLoginView, SIGNAL( disconnectFromServer() ), m_pDPLcon, SLOT( closeConnection() ) );
            connect( m_pLoginView, SIGNAL( disconnectFromServer() ), SLOT( slotDisconnected() ) );
            
      }

      /// KConfig의 설정을 가지고 옴.
      if ( !config )
            config = kapp->config(); 
  
      /*! 개인 접속 정보 */
      config->setGroup( "Login" );
      m_pLoginView->kLineEdit1->setFocus();
      QString sID( config->readEntry("ID") );
      if ( sID != QString::null )
      {
            m_pLoginView->setID( sID );
            m_pLoginView->kHistoryCombo1->setFocus();
      }

      QString sDomain( config->readEntry("Domain") );
      if ( sDomain != QString::null )
      {
            m_pLoginView->setDomain( sDomain );
            m_pLoginView->kPasswordEdit1->setFocus();
      }

      /*! 로그인 관련 */
      stConfig.autologin = config->readBoolEntry("AutoLogin", false );
      m_pLoginView->setAutoLogin( stConfig.autologin );

      QString sPassword( config->readEntry("Password") );
      if (!sPassword.isEmpty())
      {
            //printf("read config [%s]\n", sPassword.ascii());
            // Decrypt
            QCString decodePasswd = KCodecs::base64Decode(sPassword.ascii());
            char decodePasswd2[128];
            memset(decodePasswd2, 0, sizeof(decodePasswd2));
            memcpy(decodePasswd2, (const char*)decodePasswd, 128);

            char plaintext[128];
            memset(plaintext, 0, sizeof(plaintext));

            // encryption
            gcry_cipher_hd_t hd;
            gcry_error_t err;

            /*! TODO: exception */
            err = gcry_cipher_open(&hd, GCRY_CIPHER_ARCFOUR, GCRY_CIPHER_MODE_STREAM, 0);
            err = gcry_cipher_setkey(hd, KNATEON_SALT_KEY, strlen(KNATEON_SALT_KEY));
            err = gcry_cipher_decrypt(hd, plaintext, sizeof(plaintext), decodePasswd2, sizeof(decodePasswd2));
            gcry_cipher_close(hd);
            sPassword = plaintext;
      }

      if ( ( sPassword != QString::null ) &&  ( stConfig.autologin ) )
      {
            m_pLoginView->setPasswd( sPassword );
      }

      stConfig.hidestart = config->readBoolEntry( "HidenLogin", false );
      m_pLoginView->hideLoginCheckBox->setChecked( stConfig.hidestart );

      if ( stConfig.autologin )
            m_pLoginView->connectToDPLserver();

      return true;
}


Generated by  Doxygen 1.6.0   Back to index