KexiTableDesigner_DataView::KexiTableDesigner_DataView(QWidget *parent)
        : KexiDataTableView(parent, true/*db-aware*/)
{
    setObjectName("KexiTableDesigner_DataView");

    // setup main menu actions
    QList<QAction*> mainMenuActions;
    mainMenuActions
            << sharedAction("project_export_data_table")
            << sharedAction("edit_clear_table");

    setMainMenuActions(mainMenuActions);
}
Ejemplo n.º 2
0
KexiQueryView::KexiQueryView(QWidget *parent)
        : KexiDataTableView(parent)
        , d(new Private())
{
    // setup main menu actions
    QList<QAction*> mainMenuActions;
    mainMenuActions
            << sharedAction("project_export_data_table");
    setMainMenuActions(mainMenuActions);

    tableView()->setInsertingEnabled(false); //default
}
Ejemplo n.º 3
0
KexiView::KexiView(QWidget *parent)
        : QWidget(parent)
        , KexiActionProxy(this)
        , d(new Private(this))
{
    QWidget *wi = this;
    while ((wi = wi->parentWidget()) && !wi->inherits("KexiWindow"))
        ;
    d->window = (wi && wi->inherits("KexiWindow")) ? static_cast<KexiWindow*>(wi) : 0;
    if (d->window) {
        //init view mode number for this view (obtained from window where this view is created)
        if (d->window->supportsViewMode(d->window->creatingViewsMode()))
            d->viewMode = d->window->creatingViewsMode();
    }
    setObjectName(
        QString("%1_for_%2_object")
        .arg(Kexi::nameForViewMode(d->viewMode).replace(' ', '_'))
        .arg(d->window ? d->window->partItem()->name() : QString("??")));

    installEventFilter(this);

    // QLayout *l = layout(); -- FIXME: Not used?
    d->mainLyr = new QVBoxLayout(this);
    d->mainLyr->setContentsMargins(0, KDialog::marginHint() / 3, 0, 0);

    if (parentWidget()->inherits("KexiWindow")) {
        d->topBarHWidget = new QWidget(this);
        d->topBarHWidget->setFont(KexiUtils::smallFont());
        d->mainLyr->addWidget(d->topBarHWidget);
        QHBoxLayout *topBarHLyr = new QHBoxLayout(d->topBarHWidget); //needed unless KexiFlowLayout properly handles contents margins
        topBarHLyr->setContentsMargins(0, 0, 0, 0);
        topBarHLyr->addSpacing(KDialog::marginHint() / 2);
        d->topBarLyr = new KexiFlowLayout(topBarHLyr, KDialog::marginHint() / 2, 2);

        const bool userMode = KexiMainWindowIface::global()->userMode();

        bool addSeparator = false;
        if (userMode
                || d->window->supportedViewModes() == Kexi::DataViewMode
                || d->window->supportedViewModes() == Kexi::DesignViewMode
                || d->window->supportedViewModes() == Kexi::TextViewMode)
        {
            // nothing to do: only single view mode supported
        }
        else {
            if (parentWidget()->inherits("KexiWindow")) {
                createViewModeToggleButtons();
            }
        }

        (void)d->mainMenu();

        if (d->viewMode == Kexi::DesignViewMode || d->viewMode == Kexi::TextViewMode) {
            if (addSeparator) {
                d->topBarLyr->addWidget(new KexiToolBarSeparator(d->topBarHWidget));
                addSeparator = false;
            }

            QAction *a = sharedAction("project_save");
            d->saveDesignButton = new KexiSmallToolButton(a, d->topBarHWidget);
            d->saveDesignButton->setText(i18n("Save"));
            d->saveDesignButton->setToolTip(i18n("Save current design"));
            d->saveDesignButton->setWhatsThis(i18n("Saves changes made to the current design."));
            d->topBarLyr->addWidget(d->saveDesignButton);

            a = sharedAction("project_saveas");
            d->mainMenu()->addAction(a);
        }
        else {
            d->saveDesignButton = 0;
        }
    } else {
        // no toolbar
        d->saveDesignButton = 0;
        d->topBarHWidget = 0;
        d->topBarLyr = 0;
    }
}