Beispiel #1
0
void Thesaurus::checkSection(QTextDocument *document, int startPosition, int endPosition)
{
    if (endPosition == -1 && startPosition == -1) { // standalone
        m_standAlone = true;
        if (document)
            m_word = document->toPlainText();
        m_dialog->showButton(KoDialog::Ok, false);
        m_dialog->setButtonGuiItem(KoDialog::Cancel,
                KGuiItem(i18nc("@action:button Close thesaurus dialog", "&Close"), koIconName("dialog-cancel")));
        m_replaceLineEdit->setEnabled(false);
        m_replaceLabel->setEnabled(false);
    }
    else { // called from an application, e.g. Words
        QTextCursor cursor(document);
        cursor.setPosition(startPosition);
        cursor.setPosition(endPosition, QTextCursor::KeepAnchor);
        m_word = cursor.selectedText();
        m_document = document;
        m_startPosition = startPosition;
        m_dialog->setButtonGuiItem(KoDialog::Ok,
                KGuiItem(i18n("&Replace"), koIconName("dialog-ok")));
        slotFindTerm(m_word.trimmed());
        m_replaceLineEdit->setText(m_word.trimmed());
    }
    m_dialog->show();
}
void KexiDBConnectionDialog::init(const KGuiItem& acceptButtonGuiItem)
{
    setObjectName("KexiDBConnectionDialog");
    setButtons(KDialog::User1 | KDialog::Cancel | KDialog::Help);
    setButtonGuiItem(KDialog::User1,
                     acceptButtonGuiItem.text().isEmpty()
                     ? KGuiItem(i18n("&Open"), koIconName("document-open"), i18n("Open Database Connection"))
                     : acceptButtonGuiItem
                    );
    setModal(true);

    setMainWidget(d->tabWidget);
    connect(this, SIGNAL(user1Clicked()), this, SLOT(accept()));
    connect(d->tabWidget->mainWidget, SIGNAL(saveChanges()), this, SIGNAL(saveChanges()));
    connect(d->tabWidget, SIGNAL(testConnection()), this, SIGNAL(testConnection()));

    adjustSize();
    resize(width(), d->tabWidget->height());
    if (d->tabWidget->mainWidget->connectionOnly())
        d->tabWidget->mainWidget->driversCombo()->setFocus();
    else if (d->tabWidget->mainWidget->nameCombo->currentText().isEmpty())
        d->tabWidget->mainWidget->nameCombo->setFocus();
    else if (d->tabWidget->mainWidget->userEdit->text().isEmpty())
        d->tabWidget->mainWidget->userEdit->setFocus();
    else if (d->tabWidget->mainWidget->passwordEdit->text().isEmpty())
        d->tabWidget->mainWidget->passwordEdit->setFocus();
    else //back
        d->tabWidget->mainWidget->nameCombo->setFocus();
}
Beispiel #3
0
StateShapeFactory::StateShapeFactory()
    : KoShapeFactoryBase(STATESHAPEID,
                         i18n("State Shape"))
{
    setToolTip(i18n("A state shape"));
    setIconName(koIconName("stateshape"));
    setXmlElementNames("http://kde.org/braindump", QStringList("state"));
}
KarbonCalligraphicShapeFactory::KarbonCalligraphicShapeFactory()
        : KoShapeFactoryBase(KarbonCalligraphicShapeId, i18n("A calligraphic shape"))
{
    setToolTip(i18n("Calligraphic Shape"));
    setIconName(koIconName("calligraphy"));
    setLoadingPriority(1);
    setHidden(true);
}
KoPABackgroundToolFactory::KoPABackgroundToolFactory()
    : KoToolFactoryBase("KoPABackgroundTool")
{
    setToolType("calligraflow, calligrastage");
    setActivationShapeId("flake/always");
    setIconName(koIconName("backgroundtool"));
    setPriority(3);
}
Beispiel #6
0
VideoShapeFactory::VideoShapeFactory()
    : KoShapeFactoryBase(VIDEOSHAPEID, i18n("Video"))
{
    setToolTip(i18n("Video, embedded or fullscreen"));
    setIconName(koIconName("video-x-generic"));
    setXmlElementNames(KoXmlNS::draw, QStringList("plugin"));
    setLoadingPriority(2);
}
GoToStackPageAction::GoToStackPageAction(Direction direction,
                                         KFormDesigner::Container *container,
                                         QWidget *receiver, QObject *parent)
    : QAction(QIcon::fromTheme(direction == Previous ? koIconName("go-previous") : koIconName("go-next")),
              direction == Previous ? xi18nc("Go to Previous Page of a Stacked Widget", "Go to Previous Page")
                                    : xi18nc("Go to Next Page of a Stacked Widget", "Go to Next Page"),
              parent)
    , m_direction(direction)
    , m_container(container)
    , m_receiver(receiver)
{
    connect(this, SIGNAL(triggered()), this, SLOT(slotTriggered()));
    QStackedWidget *stack = qobject_cast<QStackedWidget*>(m_receiver);
    if (!stack || !stack->widget(nextWidgetIndex())) {
        setEnabled(false);
    }
}
Beispiel #8
0
ReferencesToolFactory::ReferencesToolFactory()
        : KoToolFactoryBase("ReferencesToolFactory_ID")
{
    setToolTip(i18n("References"));
    setToolType("calligrawords,calligraauthor");
    setIconName(koIconName("tool_references"));
    setPriority(20);
    setActivationShapeId(TextShape_SHAPEID);
}
KarbonGradientToolFactory::KarbonGradientToolFactory()
        : KoToolFactoryBase("KarbonGradientTool")
{
    setToolTip(i18n("Gradient editing"));
    setToolType("karbon");
    setIconName(koIconName("gradient"));
    // or probably rather "fill-gradient", please request that icon on TechBase
    setPriority(3);
}
KoRecentDocumentsPane::KoRecentDocumentsPane(QWidget* parent, const KComponentData &_componentData,
        const QString& header)
        : KoDetailsPane(parent, _componentData, header)
        , d(new KoRecentDocumentsPanePrivate)
{
    setFocusProxy(m_documentList);
    KGuiItem openGItem(i18n("Open This Document"), koIconName("document-open"));
    m_openButton->setGuiItem(openGItem);
    m_alwaysUseCheckBox->hide();

    model()->setSortRole(0); // Disable sorting

    KConfigGroup config(componentData().config(), "RecentFiles");

    int i = 1;
    QString path;
    KFileItemList fileList;
    QStandardItem* rootItem = model()->invisibleRootItem();

    do {
        path = config.readPathEntry(QString("File%1").arg(i), QString());

        if (!path.isEmpty()) {
            QString name = config.readPathEntry(QString("Name%1").arg(i), QString());

            QUrl url(path);

            if (name.isEmpty())
                name = url.fileName();

            if (!url.isLocalFile() || QFile::exists(url.toLocalFile())) {
                KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, url);
                fileList.prepend(fileItem);
                const QIcon icon = QIcon::fromTheme(fileItem.iconName());
                KoFileListItem* item = new KoFileListItem(icon, name, fileItem);
                item->setEditable(false);
                rootItem->insertRow(0, item);
            }
        }

        i++;
    } while (!path.isEmpty() || i <= 10);


    //Select the first file
    QModelIndex firstIndex = model()->indexFromItem(model()->item(0));
    m_documentList->selectionModel()->select(firstIndex, QItemSelectionModel::Select);
    m_documentList->selectionModel()->setCurrentIndex(firstIndex, QItemSelectionModel::Select);

    QStringList availablePlugins = KIO::PreviewJob::availablePlugins();
    KIO::PreviewJob *previewJob = KIO::filePreview(fileList, QSize(IconExtent, IconExtent), &availablePlugins);

    d->m_previewJobs.append(previewJob);
    connect(previewJob, SIGNAL(result(KJob*)), SLOT(previewResult(KJob*)));
    connect(previewJob, SIGNAL(gotPreview(KFileItem,QPixmap)),
            SLOT(updateIcon(KFileItem,QPixmap)));
}
KPrAnimationToolFactory::KPrAnimationToolFactory()
    : KoToolFactoryBase("Animation Tool")
{
    setToolTip(i18n("Animation"));
    setToolType("calligrastage");
    setPriority(40);
    setIconName(koIconName("animation-stage"));
    setActivationShapeId("flake/edit");
}
Beispiel #12
0
KoPanToolFactory::KoPanToolFactory()
        : KoToolFactoryBase(KoPanTool_ID)
{
    setToolTip(i18n("Pan"));
    setToolType(navigationToolType());
    setPriority(5);
    setIconName(koIconName("hand"));
    setActivationShapeId("flake/always");
}
Beispiel #13
0
KoPathShapeFactory::KoPathShapeFactory(const QStringList&)
        : KoShapeFactoryBase(KoPathShapeId, i18n("Simple path shape"))
{
    setToolTip(i18n("A simple path shape"));
    setIconName(koIconName("pathshape"));
    QStringList elementNames;
    elementNames << "path" << "line" << "polyline" << "polygon";
    setXmlElementNames(KoXmlNS::draw, elementNames);
    setLoadingPriority(0);
}
MapBrowserFactory::MapBrowserFactory(QObject* parent, const QVariantList& args)
  : KexiDBFactoryBase(parent, "mapbrowser")
{
    Q_UNUSED(args);
    KFormDesigner::WidgetInfo *mapBrowser = new KFormDesigner::WidgetInfo(this);
    mapBrowser->setIconName(koIconName("map_browser"));
    mapBrowser->setClassName("MapBrowserWidget");
    mapBrowser->setName(i18n("Map Browser"));
    mapBrowser->setNamePrefix(i18nc("This string will be used to name widgets of this class. It must _not_ contain white "
                                     "spaces and non latin1 characters.", "mapBrowser"));
    mapBrowser->setDescription(i18n("Displays an interactive map."));
    addClass(mapBrowser);
}
Beispiel #15
0
ThreedShapeFactory::ThreedShapeFactory()
    : KoShapeFactoryBase(THREEDSHAPEID, i18n("3D Scene"))
{
    setToolTip(i18n("Shape that displays a simple 3D scene."));
    //KIconLoader::global()->addAppDir("kchart");
    setIconName(koIconName("x-shape-3d"));
    setLoadingPriority(1);

    // Tell the shape loader which tag we can store
    QList<QPair<QString, QStringList> > elementNamesList;
    elementNamesList.append(qMakePair(QString(KoXmlNS::dr3d), QStringList("scene")));
    setXmlElements(elementNamesList);
}
Beispiel #16
0
AnnotationTextShapeFactory::AnnotationTextShapeFactory() :
    KoShapeFactoryBase(AnnotationShape_SHAPEID, i18n("Annotation"))
{
    setToolTip(i18n("Annotation shape to show annotation content"));
    QList<QPair<QString, QStringList> > odfElements;
    odfElements.append(QPair<QString, QStringList>(KoXmlNS::office, QStringList("annotation")));
    setXmlElements(odfElements);

    KoShapeTemplate t;
    t.name = i18n("Annotation");
    t.iconName = koIconName("x-shape-text"); // Any icon for now :)
    t.toolTip = i18n("Annotation Shape");
    KoProperties *props = new KoProperties();
    t.properties = props;
    props->setProperty("demo", true);
    addTemplate(t);
}
Beispiel #17
0
void KisPresetDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
    painter->save();
    painter->setRenderHint(QPainter::SmoothPixmapTransform, true);

    if (! index.isValid())
        return;

    KisPaintOpPreset* preset = static_cast<KisPaintOpPreset*>(index.internalPointer());

    QImage preview = preset->image();

    if(preview.isNull()) {
        return;
    }

    QRect paintRect = option.rect.adjusted(1, 1, -1, -1);
    if (!m_showText) {
        painter->drawImage(paintRect.x(), paintRect.y(),
                           preview.scaled(paintRect.size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
    } else {
        QSize pixSize(paintRect.height(), paintRect.height());
        painter->drawImage(paintRect.x(), paintRect.y(),
                           preview.scaled(pixSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));

        painter->drawText(pixSize.width() + 10, option.rect.y() + option.rect.height() - 10, preset->name());
    }
    if (m_useDirtyPresets && preset->isPresetDirty()) {
        const QIcon icon = KisIconUtils::loadIcon(koIconName("dirty-preset"));
        QPixmap pixmap = icon.pixmap(QSize(15,15));
        painter->drawPixmap(paintRect.x() + 3, paintRect.y() + 3, pixmap);
    }

    if (!preset->settings() || !preset->settings()->isValid()) {
        const QIcon icon = KisIconUtils::loadIcon("broken-preset");
        icon.paint(painter, QRect(paintRect.x() + paintRect.height() - 25, paintRect.y() + paintRect.height() - 25, 25, 25));
    }
    if (option.state & QStyle::State_Selected) {
        painter->setCompositionMode(QPainter::CompositionMode_HardLight);
        painter->setOpacity(0.65);
        painter->fillRect(option.rect, option.palette.highlight());
    }
    painter->restore();
}
void KisCategorizedItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
    painter->resetTransform();

    if(!index.data(__CategorizedListModelBase::IsHeaderRole).toBool()) {
        QStyleOptionViewItem sovi(option);

        if (index.data(__CategorizedListModelBase::isLockableRole).toBool()) {
            bool locked = index.data(__CategorizedListModelBase::isLockedRole).toBool();
            const QIcon icon = locked ? KisIconUtils::loadIcon(koIconName("locked")) : KisIconUtils::loadIcon(koIconName("unlocked"));
            const int iconSize = qMax(16, m_minimumItemHeight - 2);

            sovi.decorationPosition = QStyleOptionViewItem::Right;
            sovi.decorationAlignment = Qt::AlignRight;
            sovi.decorationSize = QSize(iconSize, iconSize);
            sovi.features |= QStyleOptionViewItem::HasDecoration;
            sovi.icon = icon;
        }

        QStyledItemDelegate::paint(painter, sovi, index);
        painter->setOpacity(1);
    }
    else {
        QPalette palette = QApplication::palette();
        if(option.state & QStyle::State_MouseOver)
            painter->fillRect(option.rect, palette.midlight());
        else
            painter->fillRect(option.rect, palette.button());

        painter->setBrush(palette.buttonText());
        painter->drawText(option.rect, index.data().toString(), QTextOption(Qt::AlignVCenter|Qt::AlignHCenter));

        paintTriangle(
            painter,
            option.rect.x(),
            option.rect.y(),
            option.rect.height(),
            !index.data(__CategorizedListModelBase::ExpandCategoryRole).toBool()
        );
    }
    painter->resetTransform();
}
//// A dialog to load a KDE icon by its name
LoadIconDialog::LoadIconDialog(QWidget *parent)
        : KDialog(parent, "loadicon_dialog", true, i18n("Load KDE Icon by Name"), Ok | Cancel, Ok, false)
{
    QFrame *frame = makeMainWidget();
    QGridLayout *l = new QGridLayout(frame);

    // Name input
    QLabel *name = new QLabel(i18n("&Name:"), frame);
    l->addWidget(name, 0, 0);
    name->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_nameInput = new KLineEdit("kexi", frame);
    l->addWidget(m_nameInput, 0, 1);
    name->setBuddy(m_nameInput);

    // Choose size
    QLabel *size = new QLabel(i18n("&Size:"), frame);
    l->addWidget(size, 1, 0);
    size->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

    KComboBox *combo = new KComboBox(frame);
    l->addWidget(combo, 1, 1);
    size->setBuddy(combo);
    QStringList list;
    list << i18n("Small") << i18n("Medium") << i18n("Large") << i18n("Huge");
    combo->insertStringList(list);
    combo->setCurrentItem(2);
    connect(combo, SIGNAL(activated(int)), this, SLOT(changeIconSize(int)));


    // Icon chooser button
    m_button = new KIconButton(frame);
    m_button->setIcon(koIconName("calligrakexi"));
    m_button->setIconSize(KIconLoader::SizeMedium);
    l->addWidget(m_button, 0, 2, 2, 1);
    connect(m_button, SIGNAL(iconChanged(QString)), this, SLOT(updateIconName(QString)));
    connect(m_nameInput, SIGNAL(textChanged(QString)), this, SLOT(setIcon(QString)));
}
Beispiel #20
0
void KexiFormPart::initInstanceActions()
{
    //connect actions provided by widget factories
    createSharedAction(Kexi::DesignViewMode, i18n("Clear Widget Contents"),
                       koIconName("edit-clear"), KShortcut(), "formpart_clear_contents");
    createSharedAction(Kexi::DesignViewMode, i18n("Edit Tab Order..."),
                       koIconName("tab_order"), KShortcut(), "formpart_taborder");
//! @todo createSharedAction(Kexi::DesignViewMode, i18n("Edit Pixmap Collection"), koIconName("icons"), 0, "formpart_pixmap_collection");
//! @todo createSharedAction(Kexi::DesignViewMode, i18n("Edit Form Connections"), koIconName("connections"), 0, "formpart_connections");

// KFormDesigner::CreateLayoutCommand
    KAction *action = createSharedAction(Kexi::DesignViewMode, i18n("Layout Widgets"),
                                         QString(), KShortcut(), "formpart_layout_menu", "KActionMenu");
    KActionMenu *menu = static_cast<KActionMenu*>(action);

    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("&Horizontally"),
                                       QString(), KShortcut(), "formpart_layout_hbox"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("&Vertically"),
                                       QString(), KShortcut(), "formpart_layout_vbox"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("In &Grid"),
                                       QString(), KShortcut(), "formpart_layout_grid"));
#ifdef KEXI_SHOW_SPLITTER_WIDGET
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("Horizontally in &Splitter"),
                                       QString(), KShortcut(), "formpart_layout_hsplitter"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("Verti&cally in Splitter"),
                                       QString(), KShortcut(), "formpart_layout_vsplitter"));
#endif

    createSharedAction(Kexi::DesignViewMode, i18n("&Break Layout"), QString(),
                       KShortcut(), "formpart_break_layout");
    /*
      createSharedAction(Kexi::DesignViewMode, i18n("Lay Out Widgets &Horizontally"), QString(), 0, "formpart_layout_hbox");
      createSharedAction(Kexi::DesignViewMode, i18n("Lay Out Widgets &Vertically"), QString(), 0, "formpart_layout_vbox");
      createSharedAction(Kexi::DesignViewMode, i18n("Lay Out Widgets in &Grid"), QString(), 0, "formpart_layout_grid");
    */
    createSharedAction(Kexi::DesignViewMode, i18n("Bring Widget to Front"), koIconName("raise"),
                       KShortcut(), "formpart_format_raise");
    createSharedAction(Kexi::DesignViewMode, i18n("Send Widget to Back"), koIconName("lower"),
                       KShortcut(), "formpart_format_lower");

#ifdef KEXI_SHOW_UNFINISHED
    action = createSharedAction(Kexi::DesignViewMode, i18n("Other Widgets"), QString(),
                                KShortcut(), "other_widgets_menu", "KActionMenu");
#endif

    action = createSharedAction(Kexi::DesignViewMode, i18n("Align Widgets Position"),
                                koIconName("aoleft"), KShortcut(), "formpart_align_menu", "KActionMenu");
    menu = static_cast<KActionMenu*>(action);
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Left"), koIconName("aoleft"),
                                       KShortcut(), "formpart_align_to_left"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Right"), koIconName("aoright"),
                                       KShortcut(), "formpart_align_to_right"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Top"), koIconName("aotop"),
                                       KShortcut(), "formpart_align_to_top"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Bottom"), koIconName("aobottom"),
                                       KShortcut(), "formpart_align_to_bottom"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Grid"), koIconName("aopos2grid"),
                                       KShortcut(), "formpart_align_to_grid"));

    action = createSharedAction(Kexi::DesignViewMode, i18n("Adjust Widgets Size"), koIconName("aogrid"),
                                KShortcut(), "formpart_adjust_size_menu", "KActionMenu");
    menu = static_cast<KActionMenu*>(action);
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Fit"), koIconName("aofit"),
                                       KShortcut(), "formpart_adjust_to_fit"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Grid"), koIconName("aogrid"),
                                       KShortcut(), "formpart_adjust_size_grid"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Shortest"), koIconName("aoshortest"),
                                       KShortcut(), "formpart_adjust_height_small"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Tallest"), koIconName("aotallest"),
                                       KShortcut(), "formpart_adjust_height_big"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Narrowest"), koIconName("aonarrowest"),
                                       KShortcut(), "formpart_adjust_width_small"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, i18n("To Widest"), koIconName("aowidest"),
                                       KShortcut(), "formpart_adjust_width_big"));
}
KexiDBFactory::KexiDBFactory(QObject *parent, const QVariantList &)
        : KexiDBFactoryBase(parent)
        , m_assignAction(0)
{
    QByteArray parentFactory = "org.kexi-project.form.widgets.standard";
    {
        KexiDataAwareWidgetInfo *wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("form"));
        wi->setClassName("KexiDBForm");
        wi->setName(xi18nc("Form widget", "Form"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of forms. Based on that, identifiers such as "
                "form1, form2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "form"));
        wi->setDescription(xi18n("A form widget"));
        addClass(wi);
    }

    {
        // inherited
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("lineedit"));
        wi->setClassName("KexiDBLineEdit");
        wi->setParentFactoryName(parentFactory);
        wi->setInheritedClassName("QLineEdit");
        wi->addAlternateClassName("KLineEdit", true/*override*/);
        wi->setIncludeFileName("qlineedit.h");
        wi->setName(xi18nc("Text Box widget", "Text Box"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of text box widgets. Based on that, identifiers such as "
                "textBox1, textBox2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "textBox"));
        wi->setDescription(xi18n("A widget for entering and displaying line of text text"));
        wi->setInternalProperty("dontStartEditingOnInserting", true); // because we are most probably assign data source to this widget
        wi->setInlineEditingEnabledWhenDataSourceSet(false);
        addClass(wi);
    }
    {
        // inherited
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("textedit"));
        wi->setClassName("KexiDBTextEdit");
        wi->setParentFactoryName(parentFactory);
        wi->setInheritedClassName("KTextEdit");
        wi->addAlternateClassName("QTextEdit", true/*override*/);
        wi->addAlternateClassName("KTextEdit", true/*override*/);
        wi->setIncludeFileName("KTextEdit");
        wi->setName(xi18nc("Text Editor widget", "Text Editor"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of text editor widgets. Based on that, identifiers such as "
                "textEditor1, textEditor2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "textEditor"));
        wi->setDescription(xi18n("A multiline text editor"));
        wi->setInternalProperty("dontStartEditingOnInserting", true); // because we are most probably assign data source to this widget
        wi->setInlineEditingEnabledWhenDataSourceSet(false);
        addClass(wi);
    }
    {
        KFormDesigner::WidgetInfo* wi = new KFormDesigner::WidgetInfo(this);
        wi->setIconName(koIconName("frame"));
        wi->setClassName("KexiFrame");
        wi->setParentFactoryName(parentFactory);
        wi->setInheritedClassName("QFrame"); /* we are inheriting to get i18n'd strings already translated there */
        wi->addAlternateClassName("QFrame", true/*override*/);
        wi->addAlternateClassName("Q3Frame", true/*override*/);
        wi->setName(xi18nc("Frame widget", "Frame"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of frame widgets. Based on that, identifiers such as "
                "frame1, frame2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "frame"));
        wi->setDescription(xi18n("A frame widget"));
        addClass(wi);
    }
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("label"));
        wi->setClassName("KexiDBLabel");
        wi->setParentFactoryName(parentFactory);
        wi->setInheritedClassName("QLabel"); /* we are inheriting to get i18n'd strings already translated there */
        wi->addAlternateClassName("QLabel", true/*override*/);
        wi->addAlternateClassName("KexiLabel", true/*override*/); //older
        wi->setName(xi18nc("Text Label widget", "Label"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of label widgets. Based on that, identifiers such as "
                "label1, label2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "label"));
        wi->setDescription(xi18n("A widget for displaying text"));
        wi->setInlineEditingEnabledWhenDataSourceSet(false);
        addClass(wi);
    }

    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("pixmaplabel"));
        wi->setClassName("KexiDBImageBox");
        wi->setParentFactoryName(parentFactory);
        wi->setInheritedClassName("KexiPictureLabel"); /* we are inheriting to get i18n'd strings already translated there */
        wi->addAlternateClassName("KexiPictureLabel", true/*override*/);
        wi->addAlternateClassName("KexiImageBox", true/*override*/); //older
        wi->setName(xi18nc("Image Box widget", "Image Box"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of image box widgets. Based on that, identifiers such as "
                "image1, image2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "image"));
        wi->setDescription(xi18n("A widget for displaying images"));
    // wi->setCustomTypeForProperty("pixmapData", KexiCustomPropertyFactory::PixmapData);
        wi->setCustomTypeForProperty("pixmapId", KexiCustomPropertyFactory::PixmapId);
        wi->setInternalProperty("dontStartEditingOnInserting", true);
        addClass(wi);
    }

    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("combo"));
        wi->setClassName("KexiDBComboBox");
        wi->setParentFactoryName(parentFactory);
        wi->setInheritedClassName("KComboBox"); /* we are inheriting to get i18n'd strings already translated there */
        wi->addAlternateClassName("KComboBox", true/*override*/);
        wi->setName(xi18nc("Combo Box widget", "Combo Box"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of combo box widgets. Based on that, identifiers such as "
                "comboBox1, comboBox2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "comboBox"));
        wi->setDescription(xi18n("A combo box widget"));
        addClass(wi);
    }
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("check"));
        wi->setClassName("KexiDBCheckBox");
        wi->setParentFactoryName(parentFactory);
        wi->setInheritedClassName("QCheckBox"); /* we are inheriting to get i18n'd strings already translated there */
        wi->addAlternateClassName("QCheckBox", true/*override*/);
        wi->setName(xi18nc("Check Box widget", "Check Box"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of combo box widgets. Based on that, identifiers such as "
                "checkBox1, checkBox2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "checkBox"));
        wi->setDescription(xi18n("A check box with text label"));
        addClass(wi);
    }
#ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT
    {
// Unused, commented-out in Kexi 2.9 to avoid unnecessary translations:
//         KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
//         wi->setIconName(koIconName("autofield"));
//         wi->setClassName("KexiDBAutoField");
//         wi->addAlternateClassName("KexiDBFieldEdit", true/*override*/); //older
//         wi->setName(xi18n("Auto Field"));
//         wi->setNamePrefix(
//             i18nc("Widget name. This string will be used to name widgets of this class. "
//                   "It must _not_ contain white spaces and non latin1 characters", "autoField"));
//         wi->setDescription(xi18n("A widget containing an automatically selected editor "
//                                 "and a label to edit the value of a database field of any type."));
//         addClass(wi);
    }
#endif

    {
        // inherited
        KFormDesigner::WidgetInfo* wi = new KFormDesigner::WidgetInfo(this);
        wi->addAlternateClassName("KexiDBPushButton");
        wi->addAlternateClassName("KexiPushButton");
        wi->setName(xi18nc("Button widget", "Button"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of button widgets. Based on that, identifiers such as "
                "button1, button2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "button"));
        wi->setDescription(xi18n("A button for executing actions"));
        wi->setParentFactoryName(parentFactory);
        wi->setInheritedClassName("QPushButton");
        addClass(wi);
    }
    {
        KFormDesigner::WidgetInfo* wi = new KFormDesigner::WidgetInfo(this);
        wi->setClassName("KexiDBCommandLinkButton");
        wi->setIconName(koIconName("button"));
        wi->setName(xi18nc("Link Button widget", "Link Button"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of link button widgets. Based on that, identifiers such as "
                "linkButton1, linkButton2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "linkButton"));
        wi->setDescription(xi18n("A Link button for executing actions"));
        addClass(wi);
    }
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("slider"));
        wi->setClassName("KexiDBSlider");
        wi->setName(xi18nc("Slider widget", "Slider"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of slider widgets. Based on that, identifiers such as "
                "slider1, slider2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "slider"));
        wi->setDescription(xi18n("A Slider widget"));
        addClass(wi);
    }
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("progress"));
        wi->setClassName("KexiDBProgressBar");
        wi->setName(xi18nc("Progress Bar widget", "Progress Bar"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of progress bar widgets. Based on that, identifiers such as "
                "progressBar1, progressBar2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "progressBar"));
        wi->setDescription(xi18n("A Progress Bar widget"));
        addClass(wi);
    }
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("dateedit"));
        wi->setClassName("KexiDBDatePicker");
        wi->setName(xi18nc("Date Picker widget", "Date Picker"));
        wi->setNamePrefix(
            xi18nc("A prefix for identifiers of date picker widgets. Based on that, identifiers such as "
                "datePicker1, datePicker2 are generated. "
                "This string can be used to refer the widget object as variables in programming "
                "languages or macros so it must _not_ contain white spaces and non latin1 characters, "
                "should start with lower case letter and if there are subsequent words, these should "
                "start with upper case letter. Example: smallCamelCase. "
                "Moreover, try to make this prefix as short as possible.",
                "datePicker"));
        wi->setDescription(xi18n("A Date Picker widget"));
        addClass(wi);
    }

    setPropertyDescription("invertedAppearance", xi18n("Inverted"));
    setPropertyDescription("minimum", xi18n("Minimum"));
    setPropertyDescription("maximum", xi18n("Maximum"));
    setPropertyDescription("format", xi18n("Format"));
    setPropertyDescription("orientation", xi18n("Orientation"));
    setPropertyDescription("textDirection", xi18n("Text Direction"));
    setPropertyDescription("textVisible", xi18n("Text Visible"));
    setPropertyDescription("value", xi18n("Value"));
    setPropertyDescription("date", xi18n("Date"));
    setPropertyDescription("arrowVisible", xi18n("Arrow Visible"));
    setPropertyDescription("description", xi18n("Description"));
    setPropertyDescription("pageStep", xi18nc("Property of slider widgets", "Page Step"));
    setPropertyDescription("singleStep", xi18nc("Property of slider widgets", "Single Step"));
    setPropertyDescription("tickInterval", xi18nc("Property of slider widgets", "Tick Interval"));
    setPropertyDescription("tickPosition", xi18nc("Property of slider widgets", "Tick Position"));
    setPropertyDescription("showEditor", xi18n("Show Editor"));
    setPropertyDescription("formName", xi18n("Form Name"));
    setPropertyDescription("onClickAction", xi18n("On Click"));
    setPropertyDescription("onClickActionOption", xi18n("On Click Option"));
    setPropertyDescription("autoTabStops", xi18n("Auto Tab Order"));
    setPropertyDescription("checkSpellingEnabled", xi18n("Spell Checking"));
    setPropertyDescription("html", xi18nc("Widget Property", "HTML"));
    setPropertyDescription("lineWrapColumnOrWidth", xi18n("Line Wrap At"));
    setPropertyDescription("lineWrapMode", xi18n("Line Wrap Mode"));
    setPropertyDescription("spellCheckingLanguage", xi18n("Spell Checking Language"));

    setPropertyDescription("widgetType", xi18n("Editor Type"));
#ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT
    //for autofield's type: inherit i18n from KexiDB
    setValueDescription("Auto", futureI18nc("AutoField editor's type", "Auto"));
    setValueDescription("Text", KDbField::typeName(KDbField::Text));
    setValueDescription("Integer", KDbField::typeName(KDbField::Integer));
    setValueDescription("Double", KDbField::typeName(KDbField::Double));
    setValueDescription("Boolean", KDbField::typeName(KDbField::Boolean));
    setValueDescription("Date", KDbField::typeName(KDbField::Date));
    setValueDescription("Time", KDbField::typeName(KDbField::Time));
    setValueDescription("DateTime", KDbField::typeName(KDbField::DateTime));
    setValueDescription("MultiLineText", xi18nc("AutoField editor's type", "Multiline Text"));
    setValueDescription("ComboBox", xi18nc("AutoField editor's type", "Drop-Down List"));
    setValueDescription("Image", xi18nc("AutoField editor's type", "Image"));
#endif

    setValueDescription("NoTicks", xi18nc("Possible value of slider widget's \"Tick position\" property", "No Ticks"));
    setValueDescription("TicksAbove", xi18nc("Possible value of slider widget's \"Tick position\" property", "Above"));
    setValueDescription("TicksLeft", xi18nc("Possible value of slider widget's \"Tick position\" property", "Left"));
    setValueDescription("TicksBelow", xi18nc("Possible value of slider widget's \"Tick position\" property", "Below"));
    setValueDescription("TicksRight", xi18nc("Possible value of slider widget's \"Tick position\" property", "Right"));
    setValueDescription("TicksBothSides", xi18nc("Possible value of slider widget's \"Tick position\" property", "Both Sides"));

// auto field:
//    setPropertyDescription("autoCaption", futureI18n("Auto Label"));
//    setPropertyDescription("foregroundLabelColor", futureI18n("Label Text Color"));
//    setPropertyDescription("backgroundLabelColor", futureI18nc("(a property name, keep the text narrow!)",
//                                         "Label Background\nColor"));

//    setPropertyDescription("labelPosition", futureI18n("Label Position"));
//    setValueDescription("Left", futureI18nc("Label Position", "Left"));
//    setValueDescription("Top", futureI18nc("Label Position", "Top"));
//    setValueDescription("NoLabel", futureI18nc("Label Position", "No Label"));

    setPropertyDescription("sizeInternal", xi18n("Size"));
    setPropertyDescription("pixmapId", xi18n("Image"));
    setPropertyDescription("scaledContents", xi18n("Scaled Contents"));
    setPropertyDescription("smoothTransformation", xi18nc("Property: Smoothing when contents are scaled", "Smoothing"));
    setPropertyDescription("keepAspectRatio", xi18nc("Property: Keep Aspect Ratio (keep short)", "Keep Ratio"));

    //hide classes that are replaced by db-aware versions
    hideClass("KexiPictureLabel");
    hideClass("KComboBox");

    //used in labels, frames...
    setPropertyDescription("dropDownButtonVisible",
        xi18nc("Drop-Down Button for Image Box Visible (a property name, keep the text narrow!)",
              "Drop-Down\nButton Visible"));

    //for checkbox
    setValueDescription("TristateDefault", xi18nc("Value of \"Tristate\" property in checkbox: default", "Default"));
    setValueDescription("TristateOn", xi18nc("Value of \"Tristate\" property in checkbox: yes", "Yes"));
    setValueDescription("TristateOff", xi18nc("Value of \"Tristate\" property in checkbox: no", "No"));

    //for combobox
    setPropertyDescription("editable", xi18nc("Editable combobox", "Editable"));

    //for kexipushbutton
    setPropertyDescription("hyperlink" , xi18nc("Hyperlink address", "Hyperlink"));
    setPropertyDescription("hyperlinkType", xi18nc("Type of hyperlink", "Hyperlink Type"));
    setPropertyDescription("hyperlinkTool", xi18nc("Tool used for opening a hyperlink", "Hyperlink Tool"));
    setPropertyDescription("remoteHyperlink", xi18nc("Allow to open remote hyperlinks", "Remote Hyperlink"));
    setPropertyDescription("hyperlinkExecutable", xi18nc("Allow to open executables", "Executable Hyperlink"));

    setValueDescription("NoHyperlink", xi18nc("Hyperlink type, NoHyperlink", "No Hyperlink"));
    setValueDescription("StaticHyperlink", xi18nc("Hyperlink type, StaticHyperlink", "Static"));
    setValueDescription("DynamicHyperlink", xi18nc("Hyperlink type, DynamicHyperlink", "Dynamic"));

    setValueDescription("DefaultHyperlinkTool", xi18nc("Hyperlink tool, DefaultTool", "Default"));
    setValueDescription("BrowserHyperlinkTool", xi18nc("Hyperlink tool, BrowserTool", "Browser"));
    setValueDescription("MailerHyperlinkTool", xi18nc("Hyperlink tool, MailerTool", "Mailer"));
}
Beispiel #22
0
KexiDBFactory::KexiDBFactory(QObject *parent, const QVariantList &)
        : KexiDBFactoryBase(parent, "kexidb")
        , m_assignAction(0)
{
    {
        KexiDataAwareWidgetInfo *wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("form"));
        wi->setClassName("KexiDBForm");
        wi->setName(i18n("Form"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "form"));
        wi->setDescription(i18n("A data-aware form widget"));
        addClass(wi);
    }

#ifndef KEXI_NO_SUBFORM
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("subform"));
        wi->setClassName("KexiDBSubForm");
        wi->addAlternateClassName("KexiSubForm", true/*override*/); //older
        wi->setName(i18n("Sub Form"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "subForm"));
        wi->setDescription(i18n("A form widget included in another Form"));
        wi->setAutoSyncForProperty("formName", false);
        addClass(wi);
    }
#endif

    {
        // inherited
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("lineedit"));
        wi->setClassName("KexiDBLineEdit");
        wi->setParentFactoryName("stdwidgets");
        wi->setInheritedClassName("QLineEdit");
        wi->addAlternateClassName("QLineEdit", true/*override*/);
        wi->addAlternateClassName("QLineEdit", true/*override*/);
        wi->setIncludeFileName("QLineEdit");
        wi->setName(i18n("Text Box"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "textBox"));
        wi->setDescription(i18n("A widget for entering and displaying text"));
        wi->setInternalProperty("dontStartEditingOnInserting", true); // because we are most probably assign data source to this widget
        wi->setInlineEditingEnabledWhenDataSourceSet(false);
        addClass(wi);
    }
    {
        // inherited
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("textedit"));
        wi->setClassName("KexiDBTextEdit");
        wi->setParentFactoryName("stdwidgets");
        wi->setInheritedClassName("KTextEdit");
        wi->addAlternateClassName("QTextEdit", true/*override*/);
        wi->addAlternateClassName("KTextEdit", true/*override*/);
        wi->setIncludeFileName("ktextedit.h");
        wi->setName(i18n("Text Editor"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "textEditor"));
        wi->setDescription(i18n("A multiline text editor"));
        wi->setInternalProperty("dontStartEditingOnInserting", true); // because we are most probably assign data source to this widget
        wi->setInlineEditingEnabledWhenDataSourceSet(false);
        addClass(wi);
    }
    {
        KFormDesigner::WidgetInfo* wi = new KFormDesigner::WidgetInfo(this);
        wi->setIconName(koIconName("frame"));
        wi->setClassName("KexiFrame");
        wi->setParentFactoryName("containers");
        wi->setInheritedClassName("QFrame"); /* we are inheriting to get i18n'd strings already translated there */
        wi->addAlternateClassName("QFrame", true/*override*/);
        wi->addAlternateClassName("Q3Frame", true/*override*/);
        wi->setName(i18n("Frame"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "frame"));
        wi->setDescription(i18n("A simple frame widget"));
        addClass(wi);
    }
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("label"));
        wi->setClassName("KexiDBLabel");
        wi->setParentFactoryName("stdwidgets");
        wi->setInheritedClassName("QLabel"); /* we are inheriting to get i18n'd strings already translated there */
        wi->addAlternateClassName("QLabel", true/*override*/);
        wi->addAlternateClassName("KexiLabel", true/*override*/); //older
        wi->setName(i18nc("Text Label", "Label"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "label"));
        wi->setDescription(i18n("A widget for displaying text"));
        wi->setInlineEditingEnabledWhenDataSourceSet(false);
        addClass(wi);
    }

    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("pixmaplabel"));
        wi->setClassName("KexiDBImageBox");
        wi->setParentFactoryName("stdwidgets");
        wi->setInheritedClassName("KexiPictureLabel"); /* we are inheriting to get i18n'd strings already translated there */
        wi->addAlternateClassName("KexiPictureLabel", true/*override*/);
        wi->addAlternateClassName("KexiImageBox", true/*override*/); //older
        wi->setName(i18n("Image Box"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "image"));
        wi->setDescription(i18n("A widget for displaying images"));
    // wi->setCustomTypeForProperty("pixmapData", KexiCustomPropertyFactory::PixmapData);
        wi->setCustomTypeForProperty("pixmapId", KexiCustomPropertyFactory::PixmapId);
        wi->setInternalProperty("dontStartEditingOnInserting", true);
        addClass(wi);
    }

    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("combo"));
        wi->setClassName("KexiDBComboBox");
        wi->setParentFactoryName("stdwidgets");
        wi->setInheritedClassName("KComboBox"); /* we are inheriting to get i18n'd strings already translated there */
        wi->addAlternateClassName("KComboBox", true/*override*/);
        wi->setName(i18n("Combo Box"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "comboBox"));
        wi->setDescription(i18n("A combo box widget"));
        addClass(wi);
    }
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("check"));
        wi->setClassName("KexiDBCheckBox");
        wi->setParentFactoryName("stdwidgets");
        wi->setInheritedClassName("QCheckBox"); /* we are inheriting to get i18n'd strings already translated there */
        wi->addAlternateClassName("QCheckBox", true/*override*/);
        wi->setName(i18n("Check Box"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "checkBox"));
        wi->setDescription(i18n("A check box with text label"));
        addClass(wi);
    }
#ifndef KEXI_NO_AUTOFIELD_WIDGET
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("autofield"));
        wi->setClassName("KexiDBAutoField");
        wi->addAlternateClassName("KexiDBFieldEdit", true/*override*/); //older
        wi->setName(i18n("Auto Field"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters", "autoField"));
        wi->setDescription(i18n("A widget containing an automatically selected editor "
                                "and a label to edit the value of a database field of any type."));
        addClass(wi);
    }
#endif

    {
        // inherited
        KFormDesigner::WidgetInfo* wi = new KFormDesigner::WidgetInfo(this);
        wi->addAlternateClassName("KexiPushButton");
        wi->setName(i18n("Button"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "button"));
        wi->setDescription(i18n("A button for executing actions"));
        wi->setParentFactoryName("stdwidgets");
        wi->setInheritedClassName("KPushButton");
        addClass(wi);
    }
    {
        KFormDesigner::WidgetInfo* wi = new KFormDesigner::WidgetInfo(this);
        wi->setClassName("KexiDBCommandLinkButton");
        wi->setIconName(koIconName("button"));
        wi->setName(i18n("Link Button"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "linkButton"));
        wi->setDescription(i18n("A Link button for executing actions"));
        addClass(wi);
    }
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("slider"));
        wi->setClassName("KexiDBSlider");
        wi->setName(i18n("Slider"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "slider"));
        wi->setDescription(i18n("A Slider widget"));
        addClass(wi);
    }
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("progress"));
        wi->setClassName("KexiDBProgressBar");
        wi->setName(i18n("Progress Bar"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "progressBar"));
        wi->setDescription(i18n("A Progress Bar widget"));
        addClass(wi);
    }
    {
        KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this);
        wi->setIconName(koIconName("dateedit"));
        wi->setClassName("KexiDBDatePicker");
        wi->setName(i18n("Date Picker"));
        wi->setNamePrefix(
            i18nc("Widget name. This string will be used to name widgets of this class. "
                  "It must _not_ contain white spaces and non latin1 characters.", "datePicker"));
        wi->setDescription(i18n("A Date Picker widget"));
        addClass(wi);
    }

    setPropertyDescription("invertedAppearance", i18n("Inverted"));
    setPropertyDescription("minimum", i18n("Minimum"));
    setPropertyDescription("maximum", i18n("Maximum"));
    setPropertyDescription("format", i18n("Format"));
    setPropertyDescription("orientation", i18n("Orientation"));
    setPropertyDescription("textDirection", i18n("Text Direction"));
    setPropertyDescription("textVisible", i18n("Text Visible"));
    setPropertyDescription("value", i18n("Value"));
    setPropertyDescription("date", i18n("Date"));
    setPropertyDescription("arrowVisible", i18n("Arrow Visible"));
    setPropertyDescription("description", i18n("Description"));
    setPropertyDescription("pageStep", i18n("Page Step"));
    setPropertyDescription("singleStep", i18n("Single Step"));
    setPropertyDescription("tickInterval", i18n("Tick Interval"));
    setPropertyDescription("tickPosition", i18n("Tick Position"));
    setPropertyDescription("showEditor", i18n("Show Editor"));
    setPropertyDescription("formName", i18n("Form Name"));
    setPropertyDescription("onClickAction", i18n("On Click"));
    setPropertyDescription("onClickActionOption", i18n("On Click Option"));
    setPropertyDescription("autoTabStops", i18n("Auto Tab Order"));
    setPropertyDescription("shadowEnabled", i18n("Shadow Enabled"));
    setPropertyDescription("on", i18nc("On: button", "On"));

    setPropertyDescription("widgetType", i18n("Editor Type"));
    //for autofield's type: inherit i18n from KexiDB
    setValueDescription("Auto", i18nc("AutoField editor's type", "Auto"));
    setValueDescription("Text", KexiDB::Field::typeName(KexiDB::Field::Text));
    setValueDescription("Integer", KexiDB::Field::typeName(KexiDB::Field::Integer));
    setValueDescription("Double", KexiDB::Field::typeName(KexiDB::Field::Double));
    setValueDescription("Boolean", KexiDB::Field::typeName(KexiDB::Field::Boolean));
    setValueDescription("Date", KexiDB::Field::typeName(KexiDB::Field::Date));
    setValueDescription("Time", KexiDB::Field::typeName(KexiDB::Field::Time));
    setValueDescription("DateTime", KexiDB::Field::typeName(KexiDB::Field::DateTime));
    setValueDescription("MultiLineText", i18nc("AutoField editor's type", "Multiline Text"));
    setValueDescription("ComboBox", i18nc("AutoField editor's type", "Drop-Down List"));
    setValueDescription("Image", i18nc("AutoField editor's type", "Image"));

    setValueDescription("NoTicks", i18n("No Ticks"));
    setValueDescription("TicksAbove", i18n("Above"));
    setValueDescription("TicksLeft", i18n("Left"));
    setValueDescription("TicksBelow", i18n("Below"));
    setValueDescription("TicksRight", i18n("Right"));
    setValueDescription("TicksBothSides", i18n("Both Sides"));

    setPropertyDescription("autoCaption", i18n("Auto Label"));
    setPropertyDescription("foregroundLabelColor", i18n("Label Text Color"));
    setPropertyDescription("backgroundLabelColor", i18nc("(a property name, keep the text narrow!)",
                                         "Label Background\nColor"));

    setPropertyDescription("labelPosition", i18n("Label Position"));
    setValueDescription("Left", i18nc("Label Position", "Left"));
    setValueDescription("Top", i18nc("Label Position", "Top"));
    setValueDescription("NoLabel", i18nc("Label Position", "No Label"));

    setPropertyDescription("sizeInternal", i18n("Size"));
    setPropertyDescription("pixmapId", i18n("Image"));
    setPropertyDescription("scaledContents", i18n("Scaled Contents"));
    setPropertyDescription("smoothTransformation", i18nc("Smoothing when contents are scaled", "Smoothing"));
    setPropertyDescription("keepAspectRatio", i18nc("Keep Aspect Ratio (short)", "Keep Ratio"));

    //hide classes that are replaced by db-aware versions
    hideClass("KexiPictureLabel");
    hideClass("KComboBox");

    //used in labels, frames...
    setPropertyDescription("dropDownButtonVisible",
        i18nc("Drop-Down Button for Image Box Visible (a property name, keep the text narrow!)",
              "Drop-Down\nButton Visible"));

    //for checkbox
    setValueDescription("TristateDefault", i18nc("Tristate checkbox, default", "Default"));
    setValueDescription("TristateOn", i18nc("Tristate checkbox, yes", "Yes"));
    setValueDescription("TristateOff", i18nc("Tristate checkbox, no", "No"));

    //for combobox
    setPropertyDescription("editable", i18nc("Editable combobox", "Editable"));
}
Beispiel #23
0
void KexiFormPart::initInstanceActions()
{
    //connect actions provided by widget factories
    createSharedAction(Kexi::DesignViewMode, xi18n("Clear Widget Contents"),
                       koIconName("edit-clear"), QKeySequence(), "formpart_clear_contents");
    createSharedAction(Kexi::DesignViewMode, xi18n("Edit Tab Order..."),
                       koIconName("tab_order"), QKeySequence(), "formpart_taborder");
//! @todo createSharedAction(Kexi::DesignViewMode, xi18n("Edit Pixmap Collection"), koIconName("icons"), 0, "formpart_pixmap_collection");
//! @todo createSharedAction(Kexi::DesignViewMode, xi18n("Edit Form Connections"), koIconName("connections"), 0, "formpart_connections");

    createSharedAction(Kexi::DesignViewMode, xi18n("Bring Widget to Front"), koIconName("raise"),
                       QKeySequence(), "formpart_format_raise");
    createSharedAction(Kexi::DesignViewMode, xi18n("Send Widget to Back"), koIconName("lower"),
                       QKeySequence(), "formpart_format_lower");

#ifdef KEXI_SHOW_UNFINISHED
    action = createSharedAction(Kexi::DesignViewMode, futureI18n("Other Widgets"), QString(),
                                QKeySequence(), "other_widgets_menu", "KActionMenu");
#endif

    QAction *action = createSharedAction(Kexi::DesignViewMode, xi18n("Align Widgets Position"),
                                koIconName("aoleft"), QKeySequence(), "formpart_align_menu", "KActionMenu");
    KActionMenu *menu = static_cast<KActionMenu*>(action);
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Left"), koIconName("aoleft"),
                                       QKeySequence(), "formpart_align_to_left"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Right"), koIconName("aoright"),
                                       QKeySequence(), "formpart_align_to_right"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Top"), koIconName("aotop"),
                                       QKeySequence(), "formpart_align_to_top"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Bottom"), koIconName("aobottom"),
                                       QKeySequence(), "formpart_align_to_bottom"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Grid"), koIconName("aopos2grid"),
                                       QKeySequence(), "formpart_align_to_grid"));

    action = createSharedAction(Kexi::DesignViewMode, xi18n("Adjust Widgets Size"), koIconName("aogrid"),
                                QKeySequence(), "formpart_adjust_size_menu", "KActionMenu");
    menu = static_cast<KActionMenu*>(action);
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Fit"), koIconName("aofit"),
                                       QKeySequence(), "formpart_adjust_to_fit"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Grid"), koIconName("aogrid"),
                                       QKeySequence(), "formpart_adjust_size_grid"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Shortest"), koIconName("aoshortest"),
                                       QKeySequence(), "formpart_adjust_height_small"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Tallest"), koIconName("aotallest"),
                                       QKeySequence(), "formpart_adjust_height_big"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Narrowest"), koIconName("aonarrowest"),
                                       QKeySequence(), "formpart_adjust_width_small"));
    menu->addAction(createSharedAction(Kexi::DesignViewMode, xi18n("To Widest"), koIconName("aowidest"),
                                       QKeySequence(), "formpart_adjust_width_big"));
}
Beispiel #24
0
StarShapeFactory::StarShapeFactory()
    : KoShapeFactoryBase(StarShapeId, i18n("A star shape"))
{
    setToolTip(i18n("A star"));
    setIconName(koIconNameCStr("star-shape"));
    QStringList elementNames;
    elementNames << "regular-polygon" << "custom-shape";
    setXmlElementNames(KoXmlNS::draw, elementNames);
    setLoadingPriority(5);

    KoShapeTemplate t;
    t.id = KoPathShapeId;
    t.templateId = "star";
    t.name = i18n("Star");
    t.family = "geometric";
    t.toolTip = i18n("A star");
    t.iconName = koIconName("star-shape");
    KoProperties *props = new KoProperties();
    props->setProperty("corners", 5);
    QVariant v;
    v.setValue(QColor(Qt::yellow));
    props->setProperty("background", v);
    t.properties = props;
    addTemplate(t);

    t.id = KoPathShapeId;
    t.templateId = "flower";
    t.name = i18n("Flower");
    t.family = "funny";
    t.toolTip = i18n("A flower");
    t.iconName = koIconName("flower-shape");
    props = new KoProperties();
    props->setProperty("corners", 5);
    props->setProperty("baseRadius", 10.0);
    props->setProperty("tipRadius", 50.0);
    props->setProperty("baseRoundness", 0.0);
    props->setProperty("tipRoundness", 40.0);
    v.setValue(QColor(Qt::magenta));
    props->setProperty("background", v);
    t.properties = props;
    addTemplate(t);

    t.id = KoPathShapeId;
    t.templateId = "pentagon";
    t.name = i18n("Pentagon");
    t.family = "geometric";
    t.toolTip = i18n("A pentagon");
    t.iconName = koIconName("pentagon-shape");
    props = new KoProperties();
    props->setProperty("corners", 5);
    props->setProperty("convex", true);
    props->setProperty("tipRadius", 50.0);
    props->setProperty("tipRoundness", 0.0);
    v.setValue(QColor(Qt::blue));
    props->setProperty("background", v);
    t.properties = props;
    addTemplate(t);

    t.id = KoPathShapeId;
    t.templateId = "hexagon";
    t.name = i18n("Hexagon");
    t.family = "geometric";
    t.toolTip = i18n("A hexagon");
    t.iconName = koIconName("hexagon-shape");
    props = new KoProperties();
    props->setProperty("corners", 6);
    props->setProperty("convex", true);
    props->setProperty("tipRadius", 50.0);
    props->setProperty("tipRoundness", 0.0);
    v.setValue(QColor(Qt::blue));
    props->setProperty("background", v);
    t.properties = props;
    addTemplate(t);
}