Example #1
0
toBrowserIndexWidget::toBrowserIndexWidget(QWidget * parent)
    : toBrowserBaseWidget(parent)
{
    setObjectName("toBrowserIndexWidget");

    columnView = new toResultTableView(this);
    columnView->setObjectName("columnView");
    columnView->setSQL(SQLIndexCols);
    columnView->setReadAll(true);

    resultInfo = new toResultItem(this);
    resultInfo->setObjectName("resultInfo");
    resultInfo->setSQL(SQLIndexInfo);

    extentsView = new toResultExtent(this);
    extentsView->setObjectName("extentsView");

    extractView = new toResultCode(this);
    extractView->setObjectName("extractView");

    statisticView = new toResultTableView(this);
    statisticView->setObjectName("statisticView");
    statisticView->setSQL(SQLIndexStatistic);
    statisticView->setReadAll(true);

    changeConnection();
}
/**
* @brief Create try icon actions
*/
void MainWindow::createActions()
{
    restoreAction = new QAction(tr("&Restore"), this);
    connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal()));
    restoreAction->setIcon(QIcon(":/images/application_get.png"));

    quitAction = new QAction(tr("&Quit"), this);
    quitAction->setIcon(QIcon(":/images/close.png"));
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
	/**
	* Main menu actions
	*/
	exitAct = new QAction(tr("E&xit"), this);
    exitAct->setShortcut(tr("Ctrl+Q"));
    exitAct->setIcon(QIcon(":/images/close.png"));
    exitAct->setStatusTip(tr("Exit the application"));
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

    connectionAct = new QAction(tr("Login as"), this);
    connectionAct->setStatusTip(tr("Login as"));
    connectionAct->setShortcut(tr("Ctrl+U"));
    connect(connectionAct, SIGNAL(triggered()), this, SLOT(changeConnection()));

    chatroomsAct = new QAction(tr("Chat rooms"), this);
    chatroomsAct->setStatusTip(tr("Chat rooms"));
    chatroomsAct->setShortcut(tr("Ctrl+R"));
    connect(chatroomsAct, SIGNAL(triggered()), this, SLOT(chatRooms()));

    aboutAct = new QAction(tr("About the program"), this);
    aboutAct->setStatusTip(tr("About the program"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

}
Example #3
0
void toMain::addConnection ( toConnection *conn )
{
    int j = 0;
    for ( std::list<toConnection *>::iterator i = Connections.begin();i != Connections.end();i++, j++ ) {
        if ( ( *i ) ->description() == conn->description() ) {
            ConnectionSelection->setCurrentItem ( j );
            createDefault();
            return;
        }
    }

    Connections.insert ( Connections.end(), conn );
    ConnectionSelection->insertItem ( conn->description() );
    ConnectionSelection->setCurrentItem ( ConnectionSelection->count() - 1 );

    if ( ConnectionSelection->count() == 1 ) {
        menuBar() ->setItemEnabled ( TO_FILE_COMMIT, true );
        menuBar() ->setItemEnabled ( TO_FILE_ROLLBACK, true );
        menuBar() ->setItemEnabled ( TO_FILE_CLEARCACHE, true );
        menuBar() ->setItemEnabled ( TO_CLOSE_CONNECTION, true );
        DisconnectButton->setEnabled ( true );
    }

    checkCaching();

    changeConnection();
    emit addedConnection ( conn->description() );
    createDefault();
}
toBrowserViewWidget::toBrowserViewWidget(QWidget * parent)
        : toBrowserBaseWidget(parent)
{
    setObjectName("toBrowserViewWidget");

    columnsWidget = new toResultCols(this);
    columnsWidget->setObjectName("columnsWidget");

    resultField = new toResultField(this);
    resultField->setObjectName("resultField");
    resultField->setSQL(SQLViewSQL);

    triggersView = new toResultTableView(this);
    triggersView->setObjectName("triggersView");
    triggersView->setSQL(SQLViewTrigger);
    triggersView->setReadAll(true);

    resultData = new toResultData(this);
    resultData->setObjectName("resultData");

    grantsView = new toResultGrants(this);
    grantsView->setObjectName("grantsView");

    resultDependencies = new toResultDepend(this, "resultDependencies");
//     resultDependencies->setObjectName("resultDependencies");

    extractView = new toResultExtract(this);
    extractView->setObjectName("extractView");

    changeConnection();
}
toBrowserDirectoriesWidget::toBrowserDirectoriesWidget(QWidget * parent)
    : toBrowserBaseWidget(parent)
{
    setObjectName("toBrowserDirectoriesWidget");

    directoriesView = new toResultTableView(this);
    directoriesView->setObjectName("directoriesView");
    directoriesView->setSQL(SQLDirectoriesInfo);

    extractDirectory = new toResultCode(this);
    extractDirectory->setObjectName("extractDirecory");

    changeConnection();
}
Example #6
0
bool toMain::delConnection ( void )
{
    toConnection * conn = NULL;
    int pos = 0;
    for ( std::list<toConnection *>::iterator i = Connections.begin();i != Connections.end();i++ ) {
        if ( ConnectionSelection->currentText().startsWith ( ( *i ) ->description() ) ) {
            conn = ( *i );
            if ( conn->needCommit() ) {
                QString str ( "Commit work in session to " );
                str.append ( conn->description() );
                str.append ( " before closing it?" );
                switch ( TOMessageBox::warning ( this, "Commit work?", str, "&Yes", "&No", "&Cancel" ) ) {
                case 0:
                    conn->commit();
                    break;
                case 1:
                    conn->rollback();
                    break;
                case 2:
                    return false;
                }
            }
            if ( !conn->closeWidgets() )
                return false;
            emit removedConnection ( conn->description() );
            Connections.erase ( i );
            ConnectionSelection->removeItem ( pos );
            if ( ConnectionSelection->count() )
                ConnectionSelection->setCurrentItem ( max ( pos - 1, 0 ) );
            delete conn;
            break;
        }
        pos++;
    }
    if ( ConnectionSelection->count() == 0 ) {
        menuBar() ->setItemEnabled ( TO_FILE_COMMIT, false );
        menuBar() ->setItemEnabled ( TO_FILE_ROLLBACK, false );
        menuBar() ->setItemEnabled ( TO_FILE_CLEARCACHE, false );
        menuBar() ->setItemEnabled ( TO_CLOSE_CONNECTION, false );
        DisconnectButton->setEnabled ( false );
        for ( std::map<QToolButton *, toTool *>::iterator i = NeedConnection.begin();
                i != NeedConnection.end();i++ )
            ( *i ).first->setEnabled ( false );
        for ( std::map<int, toTool *>::iterator j = Tools.begin();j != Tools.end();j++ )
            menuBar() ->setItemEnabled ( ( *j ).first, false );
    } else
        changeConnection();
    return true;
}
toBrowserDBLinksWidget::toBrowserDBLinksWidget(QWidget * parent)
    : toBrowserBaseWidget(parent)
{
    setObjectName("toBrowserDBLinksWidget");

    resultDBLink = new toResultItem(this);
    resultDBLink->setObjectName("resultDBLink");
    resultDBLink->setSQL(SQLDBLinkInfo);

    synonymsView = new toResultTableView(this);
    synonymsView->setObjectName("synonymsView");
    synonymsView->setSQL(SQLDBLinkSynonyms);

    changeConnection();
}
toBrowserSequenceWidget::toBrowserSequenceWidget(QWidget * parent)
    : toBrowserBaseWidget(parent)
{
    setObjectName("toBrowserSequenceWidget");

    resultInfo = new toResultItem(this);
    resultInfo->setObjectName("resultInfo");
    resultInfo->setSQL(SQLSequenceInfo);

    grantsView = new toResultGrants(this);
    grantsView->setObjectName("grantsView");

    extractView = new toResultExtract(this);
    extractView->setObjectName("extractView");

    changeConnection();
}
Example #9
0
void toMain::windowActivated ( QWidget *widget )
{
    if ( toTool::globalConfig ( CONF_CHANGE_CONNECTION, "Yes" ).isEmpty() )
        return;
    toToolWidget *tool = dynamic_cast<toToolWidget *> ( widget );
    if ( tool ) {
        toConnection & conn = tool->connection();
        int pos = 0;
        for ( std::list<toConnection *>::iterator i = Connections.begin();i != Connections.end();i++ ) {
            if ( &conn == *i ) {
                ConnectionSelection->setCurrentItem ( pos );
                changeConnection();
                break;
            }
            pos++;
        }
    }
}
toBrowserAccessWidget::toBrowserAccessWidget(QWidget * parent)
    : toBrowserBaseWidget(parent)
{
    setObjectName("toBrowserAccessWidget");

#ifdef TOEXTENDED_MYSQL
    // This is propably never compiled...
    // I'm leaving this code as is
    UserPanel = new toMySQLUser(curr, TAB_ACCESS_USER);
    curr->addTab(UserPanel, tr("&User"));
    SecondMap[TAB_ACCESS] = UserPanel;
    SecondMap[TAB_ACCESS_USER] = UserPanel;

    AccessPanel = new toMySQLUserAccess(curr, TAB_ACCESS_OBJECTS);
    curr->addTab(AccessPanel, tr("&Objects"));
    SecondMap[TAB_ACCESS_OBJECTS] = UserPanel; // Yes, it should be
    // this one, it will
    // signal the
    // TAB_ACCESS_OBJECTS
    // to update.
    connect(AccessPanel, SIGNAL(hasChanged()), UserPanel, SLOT(hasChanged()));
    connect(UserPanel,
            SIGNAL(saveChanges(const QString &, const QString &)),
            AccessPanel,
            SLOT(saveChanges(const QString &, const QString &)));
    connect(UserPanel,
            SIGNAL(changeUser(const QString &)),
            AccessPanel,
            SLOT(changeUser(const QString &)));

    accessContent = new toResultData(curr, TAB_ACCESS_CONTENT);
    accessContent->setObjectName("accessContent");

#else

    accessContent = new toResultData(this);
    accessContent->setObjectName("accessContent");
    connect(accessContent, SIGNAL(changesSaved()), this, SLOT(flushPrivs()));

#endif

    changeConnection();
}
toBrowserTriggerWidget::toBrowserTriggerWidget(QWidget * parent)
    : toBrowserBaseWidget(parent)
{
    setObjectName("toBrowserTriggerWidget");

    infoView = new toResultItem(this, "infoView");
    infoView->setSQL(SQLTriggerInfo);

    codeView = new toResultField(this, "codeView");
    codeView->setSQL(SQLTriggerBody);

    columnsWidget = new toResultCols(SQLTriggerCols, this, "columnsWidget");

    grantsView = new toResultGrants(this, "grantsView");

    dependView = new toResultDepend(this, "dependView");

    extractView = new toResultCode(this);
    extractView->setObjectName("extractView");

    changeConnection();
}