コード例 #1
0
RocketStorageAuthDialog::RocketStorageAuthDialog(RocketPlugin *plugin, const QString &storageAclCheckPath, const QString &storageBucket) :
    plugin_(plugin),
    storageAclCheckPath_(storageAclCheckPath),
    storageBucket_(storageBucket),
    restoreForeground_(false),
    s3_(0)
{
    ui_.setupUi(this);
    
    loaderAnimation_ = new QMovie(":/images/loader.gif", "GIF");
    if (loaderAnimation_->isValid())
    {
        ui_.labelAuthenticatingAnim->setMovie(loaderAnimation_);
        loaderAnimation_->setCacheMode(QMovie::CacheAll);
    }
    ui_.labelAuthenticatingAnim->setVisible(false);
    ui_.labelAuthenticating->setVisible(false);
    ui_.labelError->setVisible(false);
    
    connect(ui_.buttonAuthenticate, SIGNAL(clicked()), SLOT(TryAuthenticate()));
    connect(ui_.buttonCancel, SIGNAL(clicked()), SLOT(reject()));
    connect(this, SIGNAL(rejected()), SLOT(Cancel()));
    
    setAttribute(Qt::WA_DeleteOnClose, true);
    setWindowModality(Qt::ApplicationModal);
    setWindowFlags(Qt::SplashScreen);
    setModal(true);
    hide();
}
コード例 #2
0
void RocketStorageAuthDialog::TryAuthenticate(const QString &accessKey, const QString &secretKey)
{
    ui_.accessKeyLineEdit->setText(accessKey);
    ui_.secretKeyLineEdit->setText(secretKey);
    
    if (!accessKey.isEmpty() && !secretKey.isEmpty())
        TryAuthenticate();
    else
        Show();
}
コード例 #3
0
ファイル: KO_CONN.CPP プロジェクト: Arun-Ghosh/odbc-driver
INT_PTR CALLBACK DlgDSNCfg1Proc ( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) {
    pODBCConn pgConn = NULL;
    eGoodBad status = GOOD;
    RETCODE ret = SQL_SUCCESS;
    
    switch ( uMsg ) {
        case WM_INITDIALOG:
            // store the structure for future use
            SetWindowLongPtr ( hDlg, DWLP_USER, lParam );
            // initialize the dialog with data from conn struct
            PutDataToDlgDSNCfg1 ( ( pODBCConn ) lParam, hDlg );
            // set focus automatically
            return TRUE;
            
        case WM_COMMAND:
            switch ( LOWORD ( wParam ) ) {
                case IDC_CONNECT: {
                        HWND hwndCombo = GetDlgItem ( hDlg, IDC_COMBO1 );
                        HWND hwndOK = GetDlgItem ( hDlg, IDOK );
                        // fetch all information from controls & feed to struct
                        pgConn = ( pODBCConn ) GetWindowLongPtr ( hDlg, DWLP_USER );
                        status = GetDataFromDlgDSNCfg1 ( hDlg, pgConn );
                        
                        if ( status == BAD ) {
                            //Blank input, already popped message
                            return FALSE;
                        }
                        
                        ret = TryAuthenticate ( pgConn );
                        
                        if ( ret == SQL_ERROR ) {
                            //validation of data & other prompts goes here
                            __ODBCPopMsg ( "Username/Password not authorized, or server out of service." );
                            return FALSE;
                        }
                        
                        //passed verification
                        EnableWindow ( hwndCombo, TRUE );
                        
                        try {
                            std::vector<string> projects;
                            restListProjects ( pgConn->Server, pgConn->ServerPort, pgConn->UserName, pgConn->Password, projects );
                            
                            for ( unsigned int i = 0 ; i < projects.size(); ++i ) {
                                SendMessage ( hwndCombo, ( UINT ) CB_ADDSTRING, ( WPARAM ) 0, ( LPARAM ) projects.at ( i ).c_str() );
                            }
                            
                            SendMessage ( hwndCombo, CB_SETCURSEL, ( WPARAM ) 0, ( LPARAM ) 0 );
                        }
                        
                        catch ( exception& e ) {
                            __ODBCPopMsg ( e.what() );
                            return FALSE;
                        }
                        
                        EnableWindow ( hwndOK, TRUE );
                        return TRUE;
                    }
                    
                case IDOK: {
                        pgConn = ( pODBCConn ) GetWindowLongPtr ( hDlg, DWLP_USER );
                        HWND hwndCombo = GetDlgItem ( hDlg, IDC_COMBO1 );
                        int ItemIndex = SendMessage ( ( HWND ) hwndCombo, ( UINT ) CB_GETCURSEL,
                                                      ( WPARAM ) 0, ( LPARAM ) 0 );
                        TCHAR  projectName[256];
                        ( TCHAR ) SendMessage ( ( HWND ) hwndCombo, ( UINT ) CB_GETLBTEXT,
                                                ( WPARAM ) ItemIndex, ( LPARAM ) projectName );
                        SetConnProp ( pgConn, CONN_PROP_PROJECT, projectName );
                        //last trial with project given
                        ret = TryFetchMetadata ( pgConn );
                        
                        if ( ret == SQL_ERROR ) {
                            //validation of data & other prompts goes here
                            __ODBCPopMsg ( "Something went wrong with your selected project" );
                            return FALSE;
                        }
                        
                        EndDialog ( hDlg, wParam );
                        return TRUE;
                    }
                    
                // Fall through, do not break or return
                case IDCANCEL:
                    // indicate end with control id as return value
                    EndDialog ( hDlg, wParam );
                    return TRUE;
            }
    }
    
    return FALSE;
}