diff --git a/cmake/modules/KexiAddIconsRccFile.cmake b/cmake/modules/KexiAddIconsRccFile.cmake new file mode 100644 index 000000000..1cb155226 --- /dev/null +++ b/cmake/modules/KexiAddIconsRccFile.cmake @@ -0,0 +1,81 @@ +# Copyright (C) 2016 Jarosław Staniek +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +add_custom_target(update_all_rcc + COMMENT "Updating all file lists for rcc icons files" +) + +# Builds and install an rcc file with icons. +# - resource subdirectory in the current build subdir is created +# - ${_target}.qrc is created based on icons/${_theme}/files.cmake +# - ${_target}.rcc is generated using rcc-qt5 +# - if _prefix is not empty, icons are placed in icons/${_prefix}/${_theme} path (useful for plugins) +# - dependency for the parent target ${_parent_target} is added +# - the .rcc file is installed to ${ICONS_INSTALL_DIR} +# - update_${_target} target is added for requesting update of icons/${_theme}/files.cmake +# - adds a update_all_rcc target that executes commands for all targets created with kexi_add_icons_rcc_file() +macro(kexi_add_icons_rcc_file _target _parent_target _theme _prefix) + set(_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/resource) + set(_QRC_FILE "${_BASE_DIR}/${_target}.qrc") + set(_RCC_DIR "${CMAKE_BINARY_DIR}/bin/data/icons") + set(_RCC_FILE "${_RCC_DIR}/${_target}.rcc") + include(icons/${_theme}/files.cmake) + + add_custom_target(${_target}_copy_icons + COMMAND ${CMAKE_COMMAND} -E remove_directory ${_BASE_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${_BASE_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${_RCC_DIR} + COMMAND ${CMAKE_COMMAND} -E copy_directory icons/${_theme} ${_BASE_DIR}/icons/${_prefix}/${_theme} + COMMAND ${CMAKE_COMMAND} -E remove -f ${_BASE_DIR}/CMakeLists.txt + COMMAND ${CMAKE_COMMAND} -E remove -f ${_BASE_DIR}/icons/${_prefix}/${_theme}/files.cmake + DEPENDS "${_FILES}" + SOURCES "${_FILES}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Copying icon files to ${_BASE_DIR}" + VERBATIM + ) + + add_custom_target(${_target}_build_qrc + COMMAND ${Qt5Core_RCC_EXECUTABLE} --project -o "${CMAKE_CURRENT_BINARY_DIR}/${_target}.qrc" + # avoid adding the .qrc file to rcc due to rcc misfeature + COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/${_target}.qrc" "${_QRC_FILE}" + DEPENDS "${_FILES}" + SOURCES "${_FILES}" + WORKING_DIRECTORY "${_BASE_DIR}" + COMMENT "Building Qt resource file ${_QRC_FILE}" + VERBATIM + ) + add_dependencies(${_target}_build_qrc ${_target}_copy_icons) + + add_custom_target(${_target}_build_rcc + COMMAND ${Qt5Core_RCC_EXECUTABLE} --compress 9 --threshold 0 --binary + --output "${_RCC_FILE}" "${_QRC_FILE}" + DEPENDS "${_QRC_FILE}" "${_FILES}" + WORKING_DIRECTORY "${_BASE_DIR}" + COMMENT "Building external Qt resource ${_RCC_FILE}" + VERBATIM + ) + add_dependencies(${_target}_build_rcc ${_target}_build_qrc) + + add_dependencies(${_parent_target} ${_target}_build_rcc) + + install(FILES + ${_RCC_FILE} + DESTINATION "${ICONS_INSTALL_DIR}" + ) + + add_update_file_target( + TARGET update_${_target} + COMMAND "${PROJECT_SOURCE_DIR}/cmake/modules/update_icon_list.sh" + ${_theme} icons/${_theme}/files.cmake + FILE ${_target}_files.cmake + SOURCES "${PROJECT_SOURCE_DIR}/cmake/modules/update_icon_list.sh" + ) + add_dependencies(update_all_rcc update_${_target}) + + unset(_BASE_DIR) + unset(_QRC_FILE) + unset(_RCC_FILE) +endmacro() diff --git a/cmake/modules/update_icon_list.sh b/cmake/modules/update_icon_list.sh new file mode 100755 index 000000000..f2e2405e5 --- /dev/null +++ b/cmake/modules/update_icon_list.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# +# This file is part of the KDE project +# Copyright (C) 2016 Jarosław Staniek +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with this library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# Updates list of icon files in icons/$1/ and outputs to $2. +# Used by kexi_add_icons_rcc_file() cmake macro. +# +set -e + +theme=$1 +output=$2 +if [ -z "$theme" ] ; then echo "Theme name required as first argument"; exit 1; fi +if [ -z "$output" ] ; then echo "Output .cmake file required as second argument"; exit 1; fi +script=$(basename $0) + +function content() +{ + echo "# List of project's own icon files" + echo "# This file is generated by $script" + echo "# WARNING! All changes made in this file will be lost!" + echo + echo "set(_PNG_FILES" + find icons/$theme/ -name \*png | sed "s/\.\///g" | sort + echo ")" + echo + + echo "set(_SVG_FILES" + find icons/$theme/ -name \*svg | sed "s/\.\///g" | sort + echo ")" + echo + + echo "set(_FILES \${_PNG_FILES} \${_SVG_FILES})" +} + +content > $output diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d66e42786..9d5429b1e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,99 +1,95 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) option(KEXI_MOBILE "Compile a mobile version of Kexi" OFF) check_function_exists("uname" HAVE_UNAME) option(KEXI_SHOW_UNFINISHED "Show unfinished features in Kexi. Thus is useful for testing but may confuse end-user." OFF) option(KEXI_SHOW_UNIMPLEMENTED "Forces to show menu entries and dialogs just to give impression about development plans for Kexi. Only recommended for test/development versions." OFF) # Extra GUI features option(KEXI_AUTORISE_TABBED_TOOLBAR "Experimental: Autorise the main tabbed toolbar in Kexi" OFF) # Experimental: option(KEXI_SCRIPTS_SUPPORT "Experimental: Enable scripting in Kexi" ON) # Broken: option(KEXI_FORM_CURSOR_PROPERTY_SUPPORT "Broken: Enable \"cursor\" property in the form designer" OFF) option(KEXI_SHOW_CONTEXT_HELP "Broken: Enable context help in Kexi main window" OFF) option(KEXI_QUICK_PRINTING_SUPPORT "Broken: Enable print/print preview/print setup for tables/queries in the project navigator" OFF) option(KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT "Broken: Enable \"auto field\" form widget in the form designer" OFF) # OFF because we need to replace it with QTreeWidget which uses very different API compared to Q3ListView. Re-add QTreeWidget? option(KEXI_LIST_FORM_WIDGET_SUPPORT "Broken: Enable \"list\" form widget in the form designer" OFF) option(KEXI_PIXMAP_COLLECTIONS_SUPPORT "Broken: Enable support for pixmap collections" OFF) # Not available: option(KEXI_MACROS_SUPPORT "Experimental: Enable macros in Kexi" OFF) if(KEXI_MACROS_SUPPORT) # temp. message(FATAL_ERROR "Macros are not yet available.") endif() option(KEXI_TABLE_PRINT_SUPPORT "Experimental: Enable printing of tabular view in Kexi" OFF) # broken since Kexi 2 if(KEXI_TABLE_PRINT_SUPPORT) # temp. message(FATAL_ERROR "Table printing is not yet available.") endif() option(KEXI_PROJECT_TEMPLATES "Experimental: Enable support for project templates in Kexi" OFF) # broken since Kexi 2 if(KEXI_PROJECT_TEMPLATES) # temp. message(FATAL_ERROR "Project templates are not yet available.") endif() #See commit 1e433a54cd9, left here for reference #option(KEXI_SQLITE_MIGRATION "If defined, SQLite3 migration to some newer format is possible. Users can see a suitable question on app's startup." OFF) add_definitions(-DTRANSLATION_DOMAIN=\"kexi\") -set(KEXI_PLUGIN_INSTALL_DIR ${PLUGIN_INSTALL_DIR}/kexi) -set(KEXI_FORM_WIDGETS_PLUGIN_INSTALL_DIR ${KEXI_PLUGIN_INSTALL_DIR}/forms/widgets) - - #no default: add_definitions(-DKDE_DEFAULT_DEBUG_AREA=44010) configure_file(config-kexi.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kexi.h ) configure_file(KexiVersion.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/KexiVersion.h) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/core ) add_subdirectory( kexiutils ) add_subdirectory( core ) add_subdirectory( widget ) add_subdirectory( data ) add_subdirectory( plugins ) if (BUILD_TESTING) #TODO KEXI3 add_subdirectory( tests ) endif() if(KEXI_MOBILE) else() add_subdirectory( main ) add_subdirectory( formeditor ) add_subdirectory( migration ) endif() ########### next target ############### if(KEXI_MOBILE) add_subdirectory( mobile ) else() set(kexi_SRCS main.cpp Messages.sh # non-source: ${CMAKE_SOURCE_DIR}/kexi_xgettext.sh Mainpage.dox Messages.sh ) kexi_add_app_icons(kexi_SRCS) add_executable(kexi ${kexi_SRCS}) target_link_libraries(kexi PRIVATE keximain ) install(TARGETS kexi ${INSTALL_TARGETS_DEFAULT_ARGS}) endif() add_subdirectory( pics ) diff --git a/src/formeditor/CMakeLists.txt b/src/formeditor/CMakeLists.txt index d61be85c6..65459b51b 100644 --- a/src/formeditor/CMakeLists.txt +++ b/src/formeditor/CMakeLists.txt @@ -1,65 +1,69 @@ -add_subdirectory( factories ) - -include_directories(${CMAKE_SOURCE_DIR}/src/widget ${CMAKE_SOURCE_DIR}/src/widget/utils -${CMAKE_SOURCE_DIR}/src/widget/tableview ${CMAKE_SOURCE_DIR}/src/core) - add_definitions(-DKDE_DEFAULT_DEBUG_AREA=44010) +include_directories( + ${CMAKE_SOURCE_DIR}/src/widget + ${CMAKE_SOURCE_DIR}/src/widget/utils + ${CMAKE_SOURCE_DIR}/src/widget/tableview + ${CMAKE_SOURCE_DIR}/src/widget/properties + ${CMAKE_SOURCE_DIR}/src/core + ${CMAKE_SOURCE_DIR}/src/kexiutils/style +) + # enable to add signal/slot connections # set(KFD_SIGSLOTS true) ########### next target ############### set(kformdesigner_LIB_SRCS container.cpp resizehandle.cpp widgetfactory.cpp widgetlibrary.cpp KexiFormWidgetsPluginMetaData.cpp WidgetInfo.cpp libactionwidget.cpp form.cpp form_p.cpp objecttree.cpp formIO.cpp FormWidget.cpp FormWidgetInterface.cpp WidgetTreeWidget.cpp commands.cpp events.cpp richtextdialog.cpp tabstopdialog.cpp #KEXI_LIST_FORM_WIDGET_SUPPORT: editlistviewdialog.cpp utils.cpp #todo kfdpixmapedit.cpp widgetwithsubpropertiesinterface.cpp kexiformeventhandler.cpp # from libkexiformutils kexiactionselectiondialog.cpp # from libkexiformutils ) set(kformdesigner_LIBS kexiutils kexicore kexiextendedwidgets kexiundo KDb KPropertyWidgets ) if(KFD_SIGSLOTS) add_definitions( -DKFD_SIGSLOTS=1 ) list(APPEND kformdesigner_LIB_SRCS connectiondialog.cpp) list(APPEND kformdesigner_LIBS kexiextendedwidgets kexidatatable) endif() add_library(kformdesigner SHARED ${kformdesigner_LIB_SRCS}) generate_export_header(kformdesigner) target_link_libraries(kformdesigner ${kformdesigner_LIBS}) set_target_properties(kformdesigner PROPERTIES VERSION ${GENERIC_PROJECT_LIB_VERSION} SOVERSION ${GENERIC_PROJECT_LIB_SOVERSION} ) install(TARGETS kformdesigner ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/src/formeditor/factories/CMakeLists.txt b/src/formeditor/factories/CMakeLists.txt deleted file mode 100644 index 2318beaf3..000000000 --- a/src/formeditor/factories/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -include_directories(${CMAKE_SOURCE_DIR}/src/formeditor ${CMAKE_SOURCE_DIR}/src/core) - -set(kexiforms_standardwidgetsplugin_SRCS - KexiStandardFormWidgetsFactory.cpp - KexiStandardFormWidgets.cpp - KexiStandardContainerFormWidgets.cpp -) - -add_library(kexiforms_standardwidgetsplugin MODULE ${kexiforms_standardwidgetsplugin_SRCS}) -kcoreaddons_desktop_to_json(kexiforms_standardwidgetsplugin kexiforms_standardwidgetsplugin.desktop) - -target_link_libraries(kexiforms_standardwidgetsplugin - kformdesigner - kexiundo - - Qt5::Core - Qt5::Gui - Qt5::Xml -) - -install(TARGETS kexiforms_standardwidgetsplugin DESTINATION ${KEXI_FORM_WIDGETS_PLUGIN_INSTALL_DIR}) diff --git a/src/formeditor/factories/KexiStandardFormWidgetsFactory.cpp b/src/formeditor/factories/KexiStandardFormWidgetsFactory.cpp deleted file mode 100644 index a8ab83f15..000000000 --- a/src/formeditor/factories/KexiStandardFormWidgetsFactory.cpp +++ /dev/null @@ -1,1069 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 by Lucijan Busch - Copyright (C) 2004 Cedric Pasteur - Copyright (C) 2009-2014 Jarosław Staniek - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#include "KexiStandardFormWidgetsFactory.h" -#include "KexiStandardFormWidgets.h" -#include "KexiStandardContainerFormWidgets.h" -#include "formIO.h" -#include "form.h" -#include "widgetlibrary.h" -#include "objecttree.h" -#include "WidgetInfo.h" -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -KEXI_PLUGIN_FACTORY(KexiStandardFormWidgetsFactory, "kexiforms_standardwidgetsplugin.json") - -KexiStandardFormWidgetsFactory::KexiStandardFormWidgetsFactory(QObject *parent, const QVariantList &args) - : KFormDesigner::WidgetFactory(parent) -{ - Q_UNUSED(args); - KFormDesigner::WidgetInfo *wFormWidget = new KFormDesigner::WidgetInfo(this); - wFormWidget->setIconName(KexiIconName("form")); - wFormWidget->setClassName("FormWidgetBase"); - wFormWidget->setName(xi18n("Form")); - wFormWidget->setNamePrefix( - xi18nc("A prefix for identifiers of form widgets. 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")); - wFormWidget->setDescription(xi18n("A simple form widget")); - addClass(wFormWidget); - - KFormDesigner::WidgetInfo *wCustomWidget = new KFormDesigner::WidgetInfo(this); - wCustomWidget->setIconName(KexiIconName("unknown-widget")); - wCustomWidget->setClassName("CustomWidget"); - wCustomWidget->setName(/* no i18n needed */ "Custom Widget"); - wCustomWidget->setNamePrefix(/* no i18n needed */ "customWidget"); - wCustomWidget->setDescription(/* no i18n needed */ "A custom or non-supported widget"); - addClass(wCustomWidget); - - KFormDesigner::WidgetInfo *wLabel = new KFormDesigner::WidgetInfo(this); - wLabel->setIconName(KexiIconName("label")); - wLabel->setClassName("QLabel"); - wLabel->setName(/* no i18n needed */ "Text Label"); - wLabel->setNamePrefix(/* no i18n needed */ "label"); - wLabel->setDescription(/* no i18n needed */ "A widget to display text"); - wLabel->setAutoSaveProperties(QList() << "text"); - addClass(wLabel); - - KFormDesigner::WidgetInfo *wPixLabel = new KFormDesigner::WidgetInfo(this); - wPixLabel->setIconName(KexiIconName("imagebox")); - wPixLabel->setClassName("KexiPictureLabel"); - wPixLabel->setName(/* no i18n needed */ "Picture Label"); -//! @todo Qt designer compatibility: maybe use this class when QLabel has a pixmap set...? - wPixLabel->setSavingName("KexiPictureLabel"); - wPixLabel->setNamePrefix(/* no i18n needed */ "picture"); - wPixLabel->setDescription(/* no i18n needed */ "A widget to display pictures"); - wPixLabel->setAutoSaveProperties(QList() << "pixmap"); - addClass(wPixLabel); - - KFormDesigner::WidgetInfo *wLineEdit = new KFormDesigner::WidgetInfo(this); - wLineEdit->setIconName(KexiIconName("lineedit")); - wLineEdit->setClassName("QLineEdit"); - wLineEdit->addAlternateClassName("KLineEdit"); - wLineEdit->setIncludeFileName("qlineedit.h"); - wLineEdit->setName(/* no i18n needed */ "Line Edit"); - wLineEdit->setNamePrefix(/* no i18n needed */ "lineEdit"); - wLineEdit->setDescription(/* no i18n needed */ "A widget to input text"); - addClass(wLineEdit); - - KFormDesigner::WidgetInfo *wPushButton = new KFormDesigner::WidgetInfo(this); - wPushButton->setIconName(KexiIconName("button")); - wPushButton->setClassName("QPushButton"); - wPushButton->addAlternateClassName("KPushButton"); - wPushButton->setIncludeFileName("qpushbutton.h"); - wPushButton->setName(/* no i18n needed */ "Push Button"); - wPushButton->setNamePrefix(/* no i18n needed */ "button"); - wPushButton->setDescription(/* no i18n needed */ "A simple push button to execute actions"); - wPushButton->setAutoSaveProperties(QList() << "text"); - addClass(wPushButton); - - KFormDesigner::WidgetInfo *wRadioButton = new KFormDesigner::WidgetInfo(this); - wRadioButton->setIconName(KexiIconName("radiobutton")); - wRadioButton->setClassName("QRadioButton"); - wRadioButton->setName(/* no i18n needed */ "Option Button"); - wRadioButton->setNamePrefix(/* no i18n needed */ "option"); - wRadioButton->setDescription(/* no i18n needed */ "An option button with text or pixmap label"); - addClass(wRadioButton); - - KFormDesigner::WidgetInfo *wCheckBox = new KFormDesigner::WidgetInfo(this); - wCheckBox->setIconName(KexiIconName("checkbox")); - wCheckBox->setClassName("QCheckBox"); - wCheckBox->setName(/* no i18n needed */ "Check Box"); - wCheckBox->setNamePrefix(/* no i18n needed */ "checkBox"); - wCheckBox->setDescription(/* no i18n needed */ "A check box with text or pixmap label"); - addClass(wCheckBox); - - KFormDesigner::WidgetInfo *wSpinBox = new KFormDesigner::WidgetInfo(this); - wSpinBox->setIconName(KexiIconName("spinbox")); - wSpinBox->setClassName("QSpinBox"); - wSpinBox->addAlternateClassName("KIntSpinBox"); - wSpinBox->setIncludeFileName("qspinbox.h"); - wSpinBox->setName(/* no i18n needed */ "Spin Box"); - wSpinBox->setNamePrefix(/* no i18n needed */ "spinBox"); - wSpinBox->setDescription(/* no i18n needed */ "A spin box widget"); - addClass(wSpinBox); - - KFormDesigner::WidgetInfo *wComboBox = new KFormDesigner::WidgetInfo(this); - wComboBox->setIconName(KexiIconName("combobox")); - wComboBox->setClassName("KComboBox"); - wComboBox->addAlternateClassName("QComboBox"); - wComboBox->setIncludeFileName("KComboBox"); - wComboBox->setName(/* no i18n needed */ "Combo Box"); - wComboBox->setNamePrefix(/* no i18n needed */ "comboBox"); - wComboBox->setDescription(/* no i18n needed */ "A combo box widget"); - wComboBox->setAutoSaveProperties(QList() << "list_items"); - addClass(wComboBox); - -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT -// Unused, commented-out in Kexi 2.9 to avoid unnecessary translations: -// KFormDesigner::WidgetInfo *wListBox = new KFormDesigner::WidgetInfo(this); -// wListBox->setIconName(KexiIconName("listbox")); -// wListBox->setClassName("KListBox"); -// wListBox->addAlternateClassName("QListBox"); -// wListBox->addAlternateClassName("KListBox"); -// wListBox->setIncludeFileName("qlistbox.h"); -// wListBox->setName(xi18n("List Box")); -// wListBox->setNamePrefix( -// xi18nc("Widget name. This string will be used to name widgets of this class. " -// "It must _not_ contain white spaces and non latin1 characters.", "listBox")); -// wListBox->setDescription(xi18n("A simple list widget")); -// wListBox->setAutoSaveProperties(QList() << "list_items"); -// addClass(wListBox); - -// Unused, commented-out in Kexi 2.9 to avoid unnecessary translations: -// KFormDesigner::WidgetInfo *wTreeWidget = new KFormDesigner::WidgetInfo(this); -// wTreeWidget->setIconName(KexiIconName("listwidget")); -// wTreeWidget->setClassName("QTreetWidget"); -// //? wTreeWidget->addAlternateClassName("QListView"); -// //? wTreeWidget->addAlternateClassName("KListView"); -// wTreeWidget->setIncludeFileName("qtreewidget.h"); -// wTreeWidget->setName(xi18n("List Widget")); -// wTreeWidget->setNamePrefix( -// xi18nc("Widget name. This string will be used to name widgets of this class. " -// "It must _not_ contain white spaces and non latin1 characters.", "listWidget")); -// wTreeWidget->setDescription(xi18n("A list (or tree) widget")); -// wTreeWidget->setAutoSaveProperties(QList() << "list_contents"); -// addClass(wTreeWidget); -#endif - - KFormDesigner::WidgetInfo *wTextEdit = new KFormDesigner::WidgetInfo(this); - wTextEdit->setIconName(KexiIconName("textedit")); - wTextEdit->setClassName("KTextEdit"); - wTextEdit->addAlternateClassName("QTextEdit"); - wTextEdit->setIncludeFileName("KTextEdit"); - wTextEdit->setName(/* no i18n needed */ "Text Editor"); - wTextEdit->setNamePrefix(/* no i18n needed */ "textEditor"); - wTextEdit->setDescription(/* no i18n needed */ "A simple single-page rich text editor"); - wTextEdit->setAutoSaveProperties(QList() << "text"); - addClass(wTextEdit); - - KFormDesigner::WidgetInfo *wSlider = new KFormDesigner::WidgetInfo(this); - wSlider->setIconName(KexiIconName("slider")); - wSlider->setClassName("QSlider"); - wSlider->setName(/* no i18n needed */ "Slider"); - wSlider->setNamePrefix(/* no i18n needed */ "slider"); - wSlider->setDescription(/* no i18n needed */ "A Slider widget"); - addClass(wSlider); - - KFormDesigner::WidgetInfo *wProgressBar = new KFormDesigner::WidgetInfo(this); - wProgressBar->setIconName(KexiIconName("progressbar")); - wProgressBar->setClassName("QProgressBar"); - wProgressBar->setName(/* no i18n needed */ "Progress Bar"); - wProgressBar->setNamePrefix(/* no i18n needed */ "progressBar"); - wProgressBar->setDescription(/* no i18n needed */ "A progress indicator widget"); - addClass(wProgressBar); - - KFormDesigner::WidgetInfo *wLine = new KFormDesigner::WidgetInfo(this); - wLine->setIconName(KexiIconName("line-horizontal")); - wLine->setClassName("Line"); - wLine->setName(xi18n("Line")); - wLine->setNamePrefix( - xi18nc("A prefix for identifiers of line widgets. Based on that, identifiers such as " - "line1, line2 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.", - "line")); - wLine->setDescription(xi18n("A line to be used as a separator")); - wLine->setAutoSaveProperties(QList() << "orientation"); - wLine->setInternalProperty("orientationSelectionPopup", true); - wLine->setInternalProperty("orientationSelectionPopup:horizontalIcon", KexiIconName("line-horizontal")); - wLine->setInternalProperty("orientationSelectionPopup:verticalIcon", KexiIconName("line-vertical")); - wLine->setInternalProperty("orientationSelectionPopup:horizontalText", xi18n("Insert &Horizontal Line")); - wLine->setInternalProperty("orientationSelectionPopup:verticalText", xi18n("Insert &Vertical Line")); - addClass(wLine); - - KFormDesigner::WidgetInfo *wDate = new KFormDesigner::WidgetInfo(this); - wDate->setIconName(KexiIconName("dateedit")); - wDate->setClassName("QDateEdit"); - wDate->addAlternateClassName("KDateWidget"); - wDate->setIncludeFileName("qdateedit.h"); - wDate->setName(/* no i18n needed */ "Date Widget"); - wDate->setNamePrefix(/* no i18n needed */ "dateWidget"); - wDate->setDescription(/* no i18n needed */ "A widget to input and display a date"); - wDate->setAutoSaveProperties(QList() << "date"); - addClass(wDate); - - KFormDesigner::WidgetInfo *wTime = new KFormDesigner::WidgetInfo(this); - wTime->setIconName(KexiIconName("timeedit")); - wTime->setClassName("QTimeEdit"); - wTime->addAlternateClassName("KTimeWidget"); - wTime->setIncludeFileName("qtimewidget.h"); - wTime->setName(/* no i18n needed */ "Time Widget"); - wTime->setNamePrefix(/* no i18n needed */ "timeWidget"); - wTime->setDescription(/* no i18n needed */ "A widget to input and display a time"); - wTime->setAutoSaveProperties(QList() << "time"); - addClass(wTime); - - KFormDesigner::WidgetInfo *wDateTime = new KFormDesigner::WidgetInfo(this); - wDateTime->setIconName(KexiIconName("datetimeedit")); - wDateTime->setClassName("QDateTimeEdit"); - wDateTime->addAlternateClassName("KDateTimeWidget"); - wDateTime->setIncludeFileName("qdatetimewidget.h"); - wDateTime->setName(/* no i18n needed */ "Date/Time Widget"); - wDateTime->setNamePrefix(/* no i18n needed */ "dateTimeWidget"); - wDateTime->setDescription(/* no i18n needed */ "A widget to input and display a time and a date"); - wDateTime->setAutoSaveProperties(QList() << "dateTime"); - addClass(wDateTime); - - setPropertyDescription("checkable", xi18nc("Property: Button is checkable", "On/Off")); - setPropertyDescription("autoRepeat", xi18nc("Property: Button", "Auto Repeat")); - setPropertyDescription("autoRepeatDelay", xi18nc("Property: Auto Repeat Button's Delay", "Auto Rep. Delay")); - setPropertyDescription("autoRepeatInterval", xi18nc("Property: Auto Repeat Button's Interval", "Auto Rep. Interval")); - // unused (too advanced) setPropertyDescription("autoDefault", xi18n("Auto Default")); - // unused (too advanced) setPropertyDescription("default", xi18nc("Property: Button is default", "Default")); - setPropertyDescription("flat", xi18nc("Property: Button is flat", "Flat")); - setPropertyDescription("echoMode", - xi18nc("Property: Echo mode for Line Edit widget eg. Normal, NoEcho, Password", "Echo Mode")); - setPropertyDescription("indent", xi18n("Indent")); - //line - setPropertyDescription("orientation", xi18n("Orientation")); - //checkbox - setPropertyDescription("checked", xi18nc("Property: Checked checkbox", "Checked")); - setPropertyDescription("tristate", xi18nc("Property: Tristate checkbox", "Tristate")); - - //for labels - setPropertyDescription("textFormat", xi18n("Text Format")); - setValueDescription("PlainText", xi18nc("For Text Format", "Plain")); - setValueDescription("RichText", xi18nc("For Text Format", "Hypertext")); - setValueDescription("AutoText", xi18nc("For Text Format", "Auto")); - setValueDescription("LogText", xi18nc("For Text Format", "Log")); - setPropertyDescription("openExternalLinks", xi18nc("property: Can open external links in label", "Open Ext. Links")); - - //QLineEdit - setPropertyDescription("placeholderText", xi18nc("Property: line edit's placeholder text", "Placeholder Text")); - setPropertyDescription("clearButtonEnabled", xi18nc("Property: Clear Button Enabled", "Clear Button")); - //for EchoMode - setPropertyDescription("passwordMode", xi18nc("Property: Password Mode for line edit", "Password Mode")); - setPropertyDescription("squeezedTextEnabled", xi18nc("Property: Squeezed Text Mode for line edit", "Squeezed Text")); - - //KTextEdit - setPropertyDescription("tabStopWidth", xi18n("Tab Stop Width")); - setPropertyDescription("tabChangesFocus", xi18n("Tab Changes Focus")); - setPropertyDescription("wrapPolicy", xi18n("Word Wrap Policy")); - setValueDescription("AtWordBoundary", xi18nc("Property: For Word Wrap Policy", "At Word Boundary")); - setValueDescription("Anywhere", xi18nc("Property: For Word Wrap Policy", "Anywhere")); - setValueDescription("AtWordOrDocumentBoundary", xi18nc("Property: For Word Wrap Policy", "At Word Boundary If Possible")); - setPropertyDescription("wordWrap", xi18n("Word Wrapping")); - setPropertyDescription("wrapColumnOrWidth", xi18n("Word Wrap Position")); - setValueDescription("NoWrap", xi18nc("Property: For Word Wrap Position", "None")); - setValueDescription("WidgetWidth", xi18nc("Property: For Word Wrap Position", "Widget's Width")); - setValueDescription("FixedPixelWidth", xi18nc("Property: For Word Wrap Position", "In Pixels")); - setValueDescription("FixedColumnWidth", xi18nc("Property: For Word Wrap Position", "In Columns")); - setPropertyDescription("linkUnderline", xi18n("Links Underlined")); - setPropertyDescription("horizontalScrollBarPolicy", xi18n("Horizontal Scroll Bar")); - setPropertyDescription("verticalScrollBarPolicy", xi18n("Vertical Scroll Bar")); - //ScrollBarPolicy - setValueDescription("ScrollBarAsNeeded", xi18nc("Property: Show Scroll Bar As Needed", "As Needed")); - setValueDescription("ScrollBarAlwaysOff", xi18nc("Property: Scroll Bar Always Off", "Always Off")); - setValueDescription("ScrollBarAlwaysOn", xi18nc("Property: Scroll Bar Always On", "Always On")); - setPropertyDescription("acceptRichText", xi18nc("Property: Text Edit accepts rich text", "Rich Text")); - setPropertyDescription("HTML", xi18nc("Property: HTML value of text edit", "HTML")); - - // --- containers --- - - KFormDesigner::WidgetInfo *wTabWidget = new KFormDesigner::WidgetInfo(this); - wTabWidget->setIconName(KexiIconName("tabwidget")); - wTabWidget->setClassName("KFDTabWidget"); - wTabWidget->addAlternateClassName("KTabWidget"); - wTabWidget->addAlternateClassName("QTabWidget"); - wTabWidget->setSavingName("QTabWidget"); - wTabWidget->setIncludeFileName("qtabwidget.h"); - wTabWidget->setName(xi18n("Tab Widget")); - wTabWidget->setNamePrefix( - xi18nc("A prefix for identifiers of tab widgets. Based on that, identifiers such as " - "tab1, tab2 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.", - "tabWidget")); - wTabWidget->setDescription(xi18n("A widget to display multiple pages using tabs")); - addClass(wTabWidget); - - KFormDesigner::WidgetInfo *wWidget = new KFormDesigner::WidgetInfo(this); - wWidget->setIconName(KexiIconName("frame")); - wWidget->setClassName("QWidget"); - wWidget->addAlternateClassName("ContainerWidget"); - wWidget->setName(/* no i18n needed */ "Basic container"); - wWidget->setNamePrefix(/* no i18n needed */ "container"); - wWidget->setDescription(/* no i18n needed */ "An empty container with no frame"); - addClass(wWidget); - - KFormDesigner::WidgetInfo *wGroupBox = new KFormDesigner::WidgetInfo(this); - wGroupBox->setIconName(KexiIconName("groupbox")); - wGroupBox->setClassName("QGroupBox"); - wGroupBox->addAlternateClassName("GroupBox"); - wGroupBox->setName(xi18n("Group Box")); - wGroupBox->setNamePrefix( - xi18nc("A prefix for identifiers of group box widgets. Based on that, identifiers such as " - "groupBox1, groupBox2 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.", - "groupBox")); - wGroupBox->setDescription(xi18n("A container to group some widgets")); - addClass(wGroupBox); - - KFormDesigner::WidgetInfo *wFrame = new KFormDesigner::WidgetInfo(this); - wFrame->setIconName(KexiIconName("frame")); - wFrame->setClassName("QFrame"); - wFrame->setName(/* no i18n needed */ "Frame"); - wFrame->setNamePrefix(/* no i18n needed */ "frame"); - wFrame->setDescription(/* no i18n needed */ "A simple frame container"); - addClass(wFrame); - - //groupbox - setPropertyDescription("title", xi18nc("'Title' property for group box", "Title")); - setPropertyDescription("flat", xi18nc("'Flat' property for group box", "Flat")); - - //tab widget - setPropertyDescription("tabBarAutoHide", xi18n("Auto-hide Tabs")); - setPropertyDescription("tabPosition", xi18n("Tab Position")); - setPropertyDescription("currentIndex", xi18nc("'Current page' property for tab widget", "Current Page")); - setPropertyDescription("tabShape", xi18n("Tab Shape")); - setPropertyDescription("elideMode", xi18nc("Tab Widget's Elide Mode property", "Elide Mode")); - setPropertyDescription("usesScrollButtons", - xi18nc("Tab Widget's property: true if can use scroll buttons", "Scroll Buttons")); - - setPropertyDescription("tabsClosable", xi18n("Closable Tabs")); - setPropertyDescription("movable", xi18n("Movable Tabs")); - setPropertyDescription("documentMode", xi18n("Document Mode")); - - setValueDescription("Rounded", xi18nc("Property value for Tab Shape", "Rounded")); - setValueDescription("Triangular", xi18nc("Property value for Tab Shape", "Triangular")); -} - -KexiStandardFormWidgetsFactory::~KexiStandardFormWidgetsFactory() -{ -} - -QWidget* KexiStandardFormWidgetsFactory::createWidget(const QByteArray &c, QWidget *p, const char *n, - KFormDesigner::Container *container, - CreateWidgetOptions options) -{ - QWidget *w = 0; - bool createContainer = false; - QString text(container->form()->library()->textForWidgetName(n, c)); - if (c == "QLabel") { - w = new QLabel(text, p); - } else if (c == "KexiPictureLabel") { - w = new KexiPictureLabel(koDesktopIcon("image-x-generic"), p); - } else if (c == "QLineEdit") { - w = new QLineEdit(p); - } else if (c == "QPushButton") { - w = new QPushButton(text, p); - } else if (c == "QRadioButton") { - w = new QRadioButton(text, p); - } else if (c == "QCheckBox") { - w = new QCheckBox(text, p); - } else if (c == "KIntSpinBox") { - w = new QSpinBox(p); - } else if (c == "KComboBox") { - w = new KComboBox(p); - } else if (c == "KTextEdit") { - w = new KTextEdit(text, p); -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT - } else if (c == "QTreeWidget") { - QTreeWidget *tw = new QTreeWidget(p); - w = tw; - if (container->form()->interactiveMode()) { - tw->setColumnCount(1); - tw->setHeaderItem(new QTreeWidetItem(tw)); - tw->headerItem()->setText(1, futureI18n("Column 1")); - } - lw->setRootIsDecorated(true); -#endif - } else if (c == "QSlider") { - w = new QSlider(Qt::Horizontal, p); - } else if (c == "QProgressBar") { - w = new QProgressBar(p); - } else if (c == "KDateWidget" || c == "QDateEdit") { - w = new QDateEdit(QDate::currentDate(), p); - } else if (c == "KTimeWidget" || c == "QTimeEdit") { - w = new QTimeEdit(QTime::currentTime(), p); - } else if (c == "KDateTimeWidget" || c == "QDateTimeEdit") { - w = new QDateTimeEdit(QDateTime::currentDateTime(), p); - } else if (c == "Line") { - w = new Line(options & WidgetFactory::VerticalOrientation - ? Qt::Vertical : Qt::Horizontal, p); - } // --- containers --- - else if (c == "KFDTabWidget") { - KFDTabWidget *tab = new KFDTabWidget(container, p); - w = tab; -#if defined(USE_KTabWidget) - tab->setTabReorderingEnabled(true); - connect(tab, SIGNAL(movedTab(int,int)), this, SLOT(reorderTabs(int,int))); -#endif - //qDebug() << "Creating ObjectTreeItem:"; - container->form()->objectTree()->addItem(container->objectTree(), - new KFormDesigner::ObjectTreeItem( - container->form()->library()->displayName(c), n, tab, container)); - } else if (c == "QWidget") { - w = new ContainerWidget(p); - w->setObjectName(n); - new KFormDesigner::Container(container, w, p); - return w; - } else if (c == "QGroupBox") { - QString text = container->form()->library()->textForWidgetName(n, c); - w = new GroupBox(text, p); - createContainer = true; - } else if (c == "QFrame") { - QFrame *frm = new QFrame(p); - w = frm; - frm->setLineWidth(2); - frm->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); - createContainer = true; - } else if (c == "QStackedWidget" || /* compat */ c == "QWidgetStack") { - QStackedWidget *stack = new QStackedWidget(p); - w = stack; - stack->setLineWidth(2); - stack->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); - //qDebug() << "Creating ObjectTreeItem:"; - container->form()->objectTree()->addItem(container->objectTree(), - new KFormDesigner::ObjectTreeItem( - container->form()->library()->displayName(c), n, stack, container)); - - if (container->form()->interactiveMode()) { - AddStackPageAction(container, stack, 0).trigger(); // addStackPage(); - } - } else if (c == "HBox") { - w = new HBox(p); - createContainer = true; - } else if (c == "VBox") { - w = new VBox(p); - createContainer = true; - } else if (c == "Grid") { - w = new Grid(p); - createContainer = true; - } else if (c == "HFlow") { - w = new HFlow(p); - createContainer = true; - } else if (c == "VFlow") { - w = new VFlow(p); - createContainer = true; - } - - if (w) { - w->setObjectName(n); - qDebug() << w << w->objectName() << "created"; - } - if (createContainer) { - (void)new KFormDesigner::Container(container, w, container); - } - if (c == "KFDTabWidget") { - // if we are loading, don't add this tab - if (container->form()->interactiveMode()) { - TabWidgetBase *tab = qobject_cast(w); - AddTabAction(container, tab, 0).slotTriggered(); - } - } - return w; -} - -bool KexiStandardFormWidgetsFactory::previewWidget(const QByteArray &classname, - QWidget *widget, KFormDesigner::Container *container) -{ - if (classname == "QStackedWidget" || /* compat */ classname == "QWidgetStack") { - QStackedWidget *stack = qobject_cast(widget); - KFormDesigner::ObjectTreeItem *tree = container->form()->objectTree()->lookup( - widget->objectName()); - if (!tree->modifiedProperties()->contains("frameShape")) - stack->setFrameStyle(QFrame::NoFrame); - } - return true; -} - -bool KexiStandardFormWidgetsFactory::createMenuActions(const QByteArray &classname, QWidget *w, - QMenu *menu, KFormDesigner::Container *container) -{ - QWidget *pw = w->parentWidget(); - if ((classname == "QLabel") || (classname == "KTextEdit")) { - menu->addAction( new EditRichTextAction(container, w, menu, this) ); - return true; - } -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT - else if (classname == "QTreeWidget") { - menu->addAction(koIcon("document-properties"), xi18n("Edit Contents of List Widget"), - this, SLOT(editListContents())); - return true; - } -#endif - else if (classname == "KFDTabWidget" || pw->parentWidget()->inherits("QTabWidget")) { -//! @todo KEXI3 port this: setWidget(pw->parentWidget(), m_container->toplevel()); -#if 0 - if (pw->parentWidget()->inherits("QTabWidget")) { - setWidget(pw->parentWidget(), m_container->toplevel()); - } -#endif - - TabWidgetBase *tab = qobject_cast(w); - if (tab) { - menu->addAction( new AddTabAction(container, tab, menu) ); - menu->addAction( new RenameTabAction(container, tab, menu) ); - menu->addAction( new RemoveTabAction(container, tab, menu) ); - } - return true; - } - else if ( (KexiUtils::objectIsA(pw, "QStackedWidget") || /* compat */ KexiUtils::objectIsA(pw, "QWidgetStack")) - && !pw->parentWidget()->inherits("QTabWidget") - ) - { - QStackedWidget *stack = qobject_cast(pw); -//! @todo KEXI3 port this: setWidget( pw, container->form()->objectTree()->lookup(stack->objectName())->parent()->container() ); -#if 0 - setWidget( - pw, - container->form()->objectTree()->lookup(stack->objectName())->parent()->container() - ); -#endif - KFormDesigner::Container *parentContainer - = container->form()->objectTree()->lookup(stack->objectName())->parent()->container(); - menu->addAction( new AddStackPageAction(parentContainer, pw, menu) ); - menu->addAction( new RemoveStackPageAction(parentContainer, pw, menu) ); - menu->addAction( new GoToStackPageAction(GoToStackPageAction::Previous, parentContainer, pw, menu) ); - menu->addAction( new GoToStackPageAction(GoToStackPageAction::Next, parentContainer, pw, menu) ); - return true; - } - return false; -} - -bool KexiStandardFormWidgetsFactory::startInlineEditing(InlineEditorCreationArguments& args) -{ - if (args.classname == "QLineEdit") { - QLineEdit *lineedit = static_cast(args.widget); - args.text = lineedit->text(); - args.alignment = lineedit->alignment(); - args.useFrame = true; - return true; - } - else if (args.widget->inherits("QLabel")) { - QLabel *label = static_cast(args.widget); - if (label->textFormat() == Qt::RichText) { - args.execute = false; - EditRichTextAction(args.container, label, 0, this).trigger(); -//! @todo - } else { - args.text = label->text(); - args.alignment = label->alignment(); - } - return true; - } - else if (args.classname == "QPushButton") { - QPushButton *push = static_cast(args.widget); - QStyleOption option; - option.initFrom(push); - args.text = push->text(); - const QRect r(push->style()->subElementRect( - QStyle::SE_PushButtonContents, &option, push)); - args.geometry = QRect(push->x() + r.x(), push->y() + r.y(), r.width(), r.height()); -//! @todo this is typical alignment, can we get actual from the style? - args.alignment = Qt::AlignCenter; - args.transparentBackground = true; - return true; - } - else if (args.classname == "QRadioButton") { - QRadioButton *radio = static_cast(args.widget); - QStyleOption option; - option.initFrom(radio); - args.text = radio->text(); - const QRect r(radio->style()->subElementRect( - QStyle::SE_RadioButtonContents, &option, radio)); - args.geometry = QRect( - radio->x() + r.x(), radio->y() + r.y(), r.width(), r.height()); - return true; - } - else if (args.classname == "QCheckBox") { - QCheckBox *check = static_cast(args.widget); - QStyleOption option; - option.initFrom(check); - const QRect r(args.widget->style()->subElementRect( - QStyle::SE_CheckBoxContents, &option, check)); - args.geometry = QRect( - check->x() + r.x(), check->y() + r.y(), r.width(), r.height()); - return true; - } else if (args.classname == "KComboBox" || args.classname == "QComboBox") { - QStringList list; - KComboBox *combo = qobject_cast(args.widget); - for (int i = 0; i < combo->count(); i++) { - list.append(combo->itemText(i)); - } - args.execute = false; - if (editList(args.widget, list)) { - qobject_cast(args.widget)->clear(); - qobject_cast(args.widget)->addItems(list); - } - return true; - } - else if ( args.classname == "KTextEdit" || args.classname == "KDateTimeWidget" - || args.classname == "KTimeWidget" || args.classname == "KDateWidget" - || args.classname == "KIntSpinBox") - { - args.execute = false; - disableFilter(args.widget, args.container); - return true; - } - return false; -} - -bool KexiStandardFormWidgetsFactory::clearWidgetContent(const QByteArray &classname, QWidget *w) -{ - if (classname == "QLineEdit") - qobject_cast(w)->clear(); -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT - else if (classname == "QTreeWidget") - qobject_cast(w)->clear(); -#endif - else if (classname == "KComboBox") - qobject_cast(w)->clear(); - else if (classname == "KTextEdit") - qobject_cast(w)->clear(); - else - return false; - return true; -} - -bool KexiStandardFormWidgetsFactory::changeInlineText(KFormDesigner::Form *form, QWidget *widget, - const QString &text, QString &oldText) -{ - const QByteArray n(widget->metaObject()->className()); - if (n == "KIntSpinBox") { - oldText = QString::number(qobject_cast(widget)->value()); - qobject_cast(widget)->setValue(text.toInt()); - } - else { - oldText = widget->property("text").toString(); - changeProperty(form, widget, "text", text); - } - return true; -} - -void KexiStandardFormWidgetsFactory::resizeEditor(QWidget *editor, QWidget *widget, - const QByteArray &classname) -{ - QSize s = widget->size(); - QPoint p = widget->pos(); - QRect r; - - if (classname == "QRadioButton") { - QStyleOption option; - option.initFrom(widget); - r = widget->style()->subElementRect( - QStyle::SE_RadioButtonContents, &option, widget); - p += r.topLeft(); - s.setWidth(r.width()); - } else if (classname == "QCheckBox") { - QStyleOption option; - option.initFrom(widget); - r = widget->style()->subElementRect( - QStyle::SE_CheckBoxContents, &option, widget); - p += r.topLeft(); - s.setWidth(r.width()); - } else if (classname == "QPushButton") { - QStyleOption option; - option.initFrom(widget); - r = widget->style()->subElementRect( - QStyle::SE_PushButtonContents, &option, widget); - p += r.topLeft(); - s = r.size(); - } - - editor->resize(s); - editor->move(p); - - //! @todo KEXI3 - /* from ContainerFactory::resizeEditor(QWidget *editor, QWidget *widget, const QByteArray &): - QSize s = widget->size(); - editor->move(widget->x() + 2, widget->y() - 5); - editor->resize(s.width() - 20, widget->fontMetrics().height() + 10); */ -} - -bool KexiStandardFormWidgetsFactory::saveSpecialProperty(const QByteArray &classname, - const QString &name, const QVariant &, - QWidget *w, QDomElement &parentNode, QDomDocument &domDoc) -{ - if (name == "list_items" && classname == "KComboBox") { - KComboBox *combo = qobject_cast(w); - for (int i = 0; i < combo->count(); i++) { - QDomElement item = domDoc.createElement("item"); - KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "text", combo->itemText(i)); - parentNode.appendChild(item); - } - return true; - } -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT - else if (name == "list_contents" && classname == "QTreeWidget") { - QTreeWidget *treewidget = qobject_cast(w); - // First we save the columns - QTreeWidgetItem *headerItem = treewidget->headerItem(); - if (headerItem) { - for (int i = 0; i < treewidget->columnCount(); i++) { - QDomElement item = domDoc.createElement("column"); - KFormDesigner::FormIO::savePropertyElement( - item, domDoc, "property", "text", headerItem->text(i)); - KFormDesigner::FormIO::savePropertyElement( - item, domDoc, "property", "width", treewidget->columnWidth(i)); - KFormDesigner::FormIO::savePropertyElement( - item, domDoc, "property", "resizable", treewidget->header()->isResizeEnabled(i)); - KFormDesigner::FormIO::savePropertyElement( - item, domDoc, "property", "clickable", treewidget->header()->isClickEnabled(i)); - KFormDesigner::FormIO::savePropertyElement( - item, domDoc, "property", "fullwidth", treewidget->header()->isStretchEnabled(i)); - parentNode.appendChild(item); - } - } - // Then we save the list view items - QTreeWidgetItem *item = listwidget->firstChild(); - while (item) { - saveListItem(item, parentNode, domDoc); - item = item->nextSibling(); - } - return true; - } -#endif - else if ((name == "title") && (w->parentWidget()->parentWidget()->inherits("QTabWidget"))) { - TabWidgetBase *tab = qobject_cast(w->parentWidget()->parentWidget()); - KFormDesigner::FormIO::savePropertyElement( - parentNode, domDoc, "attribute", "title", tab->tabText(tab->indexOf(w))); - } else if ((name == "stackIndex") - && (KexiUtils::objectIsA(w->parentWidget(), "QStackedWidget") - || /*compat*/ KexiUtils::objectIsA(w->parentWidget(), "QWidgetStack"))) - { - QStackedWidget *stack = qobject_cast(w->parentWidget()); - KFormDesigner::FormIO::savePropertyElement( - parentNode, domDoc, "attribute", "stackIndex", stack->indexOf(w)); - } else - return false; - return true; -} - -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT -void -KexiStandardFormWidgetsFactory::saveListItem(QListWidgetItem *item, - QDomNode &parentNode, QDomDocument &domDoc) -{ - QDomElement element = domDoc.createElement("item"); - parentNode.appendChild(element); - - // We save the text of each column - for (int i = 0; i < item->listWidget()->columns(); i++) { - KFormDesigner::FormIO::savePropertyElement( - element, domDoc, "property", "text", item->text(i)); - } - - // Then we save every sub items - QListWidgetItem *child = item->firstChild(); - while (child) { - saveListItem(child, element, domDoc); - child = child->nextSibling(); - } -} -#endif - -bool KexiStandardFormWidgetsFactory::readSpecialProperty(const QByteArray &classname, - QDomElement &node, QWidget *w, - KFormDesigner::ObjectTreeItem *item) -{ - const QString tag( node.tagName() ); - const QString name( node.attribute("name") ); - KFormDesigner::Form *form = item->container() - ? item->container()->form() : item->parent()->container()->form(); - - if ((tag == "item") && (classname == "KComboBox")) { - KComboBox *combo = qobject_cast(w); - QVariant val = KFormDesigner::FormIO::readPropertyValue( - form, node.firstChild().firstChild(), w, name); - if (val.canConvert(QVariant::Pixmap)) - combo->addItem(val.value(), QString()); - else - combo->addItem(val.toString()); - return true; - } -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT - else if (tag == "column" && classname == "QTreeWidget") { - QTreeWidget *tw = qobject_cast(w); - int id = 0; - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - QString prop = n.toElement().attribute("name"); - QVariant val = KFormDesigner::FormIO::readPropertyValue(n.firstChild(), w, name); - if (prop == "text") - id = tw->addColumn(val.toString()); - else if (prop == "width") - tw->setColumnWidth(id, val.toInt()); - else if (prop == "resizable") - tw->header()->setResizeEnabled(val.toBool(), id); - else if (prop == "clickable") - tw->header()->setClickEnabled(val.toBool(), id); - else if (prop == "fullwidth") - tw->header()->setStretchEnabled(val.toBool(), id); - } - return true; - } - else if (tag == "item" && classname == "QTreeWidget") { - QTreeWidget *tw = qobject_cast(w); - readListItem(node, 0, tw); - return true; - } -#endif - else if ((name == "title") && (item->parent()->widget()->inherits("QTabWidget"))) { - TabWidgetBase *tab = qobject_cast(w->parentWidget()); - tab->addTab(w, node.firstChild().toElement().text()); - item->addModifiedProperty("title", node.firstChild().toElement().text()); - return true; - } - else if (name == "stackIndex" - && (KexiUtils::objectIsA(w->parentWidget(), "QStackedWidget") - || /*compat*/ KexiUtils::objectIsA(w->parentWidget(), "QWidgetStack"))) - { - QStackedWidget *stack = qobject_cast(w->parentWidget()); - int index = KFormDesigner::FormIO::readPropertyValue(form, node.firstChild(), w, name).toInt(); - stack->insertWidget(index, w); - stack->setCurrentWidget(w); - item->addModifiedProperty("stackIndex", index); - return true; - } - return false; -} - -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT -void -KexiStandardFormWidgetsFactory::readTreeItem( - QDomElement &node, QTreeWidgetItem *parent, QTreeWidget *treewidget) -{ - QTreeWidgetItem *item; - if (parent) - item = new QTreeWidgetItem(parent); - else - item = new QTreeWidgetItem(treewidget); - - // We need to move the item at the end of the list - QTreeWidgetItem *last; - if (parent) - last = parent->firstChild(); - else - last = treewidget->firstChild(); - - while (last->nextSibling()) - last = last->nextSibling(); - item->moveItem(last); - - int i = 0; - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement childEl = n.toElement(); - QString prop = childEl.attribute("name"); - QString tag = childEl.tagName(); - - // We read sub items - if (tag == "item") { - item->setOpen(true); - readListItem(childEl, item, treewidget); - } - // and column texts - else if (tag == "property" && prop == "text") { - QVariant val = KFormDesigner::FormIO::readPropertyValue( - n.firstChild(), treewidget, "item"); - item->setText(i, val.toString()); - i++; - } - } -} -#endif - -bool KexiStandardFormWidgetsFactory::isPropertyVisibleInternal(const QByteArray &classname, - QWidget *w, const QByteArray &property, - bool isTopLevel) -{ - bool ok = true; - if (classname == "FormWidgetBase") { - if (property == "windowIconText" - || property == "geometry" /*nonsense for toplevel widget*/) - { - return false; - } - } - else if (classname == "CustomWidget") { - } - else if (classname == "KexiPictureLabel") { - if ( property == "text" || property == "indent" - || property == "textFormat" || property == "font" - || property == "alignment") - { - return false; - } - } else if (classname == "QLabel") { - if (property == "pixmap") - return false; - } else if (classname == "QLineEdit") { - if (property == "vAlign") - return false; - } else if (classname == "KTextEdit") - ok = KFormDesigner::WidgetFactory::advancedPropertiesVisible() || - ( property != "undoDepth" - && property != "undoRedoEnabled" //always true! - && property != "dragAutoScroll" //always true! - && property != "overwriteMode" //always false! - && property != "resizePolicy" - && property != "autoFormatting" //too complex -#ifndef KEXI_SHOW_UNFINISHED - && property != "paper" -#endif - ); - else if (classname == "Line") { - if ((property == "frameShape") || (property == "font") || (property == "margin")) - return false; - } else if (classname == "QCheckBox") { - ok = KFormDesigner::WidgetFactory::advancedPropertiesVisible() || (property != "autoRepeat"); - } else if (classname == "QRadioButton") { - ok = KFormDesigner::WidgetFactory::advancedPropertiesVisible() || (property != "autoRepeat"); - } else if (classname == "QPushButton") { -//! @todo reenable autoDefault / default if the top level window is dialog... - ok = KFormDesigner::WidgetFactory::advancedPropertiesVisible() || (property != "autoDefault" && property != "default"); - } - else if ( classname == "HBox" || classname == "VBox" || classname == "Grid" - || classname == "HFlow" || classname == "VFlow") - { - return property == "objectName" || property == "geometry"; - } - else if (classname == "QGroupBox") { - ok = -#ifndef KEXI_SHOW_UNFINISHED - /*! @todo Hidden for now in Kexi. "checkable" and "checked" props need adding - a fake properties which will allow to properly work in design mode, otherwise - child widgets become frozen when checked==true */ - (KFormDesigner::WidgetFactory::advancedPropertiesVisible() || (property != "checkable" && property != "checked")) && -#endif - true; - } else if (classname == "KFDTabWidget") { - ok = (KFormDesigner::WidgetFactory::advancedPropertiesVisible() - || (property != "tabReorderingEnabled" && property != "hoverCloseButton" - && property != "hoverCloseButtonDelayed")); - } - return ok && WidgetFactory::isPropertyVisibleInternal(classname, w, property, isTopLevel); -} - -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT -void -KexiStandardFormWidgetsFactory::editListContents() -{ - if (widget()->inherits("QTreeWidget")) - editTreeWidget(qobject_cast(widget())); -} -#endif - -void KexiStandardFormWidgetsFactory::setPropertyOptions(KPropertySet& set, - const KFormDesigner::WidgetInfo& info, - QWidget *w) -{ - Q_UNUSED(info); - Q_UNUSED(w); - - if (set.contains("indent")) { - set["indent"].setOption("min", -1); - set["indent"].setOption("minValueText", xi18nc("default indent value", "default")); - } -} - -void KexiStandardFormWidgetsFactory::reorderTabs(int oldpos, int newpos) -{ - KFDTabWidget *tabWidget = qobject_cast(sender()); - KFormDesigner::ObjectTreeItem *tab - = tabWidget->container()->form()->objectTree()->lookup(tabWidget->objectName()); - if (!tab) - return; - - tab->children()->move(oldpos, newpos); -} - -KFormDesigner::ObjectTreeItem* KexiStandardFormWidgetsFactory::selectableItem( - KFormDesigner::ObjectTreeItem* item) -{ - if (item->parent() && item->parent()->widget()) { - if (qobject_cast(item->parent()->widget())) { - // tab widget's page - return item->parent(); - } - } - return item; -} - -#include "KexiStandardFormWidgetsFactory.moc" diff --git a/src/formeditor/factories/KexiStandardFormWidgetsFactory.h b/src/formeditor/factories/KexiStandardFormWidgetsFactory.h deleted file mode 100644 index 28e9ef969..000000000 --- a/src/formeditor/factories/KexiStandardFormWidgetsFactory.h +++ /dev/null @@ -1,93 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 by Lucijan Busch - Copyright (C) 2004 Cedric Pasteur - Copyright (C) 2009 Jarosław Staniek - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#ifndef KEXISTANDARDFORMWIDGETSFACTORY_H -#define KEXISTANDARDFORMWIDGETSFACTORY_H - -#include -#include -#include -#include - -#include "widgetfactory.h" -#include "container.h" - -class QTreeWidgetItem; -class QTreeWidget; - -class KPropertySet; - -//! Factory for all basic widgets, including Spring (not containers) -class KexiStandardFormWidgetsFactory : public KFormDesigner::WidgetFactory -{ - Q_OBJECT - -public: - KexiStandardFormWidgetsFactory(QObject *parent, const QVariantList &args); - ~KexiStandardFormWidgetsFactory(); - - virtual QWidget* createWidget(const QByteArray &classname, QWidget *parent, const char *name, - KFormDesigner::Container *container, - CreateWidgetOptions options = DefaultOptions); - - virtual bool createMenuActions(const QByteArray &classname, QWidget *w, - QMenu *menu, KFormDesigner::Container *container); - virtual bool startInlineEditing(InlineEditorCreationArguments& args); - virtual bool previewWidget(const QByteArray &classname, QWidget *widget, - KFormDesigner::Container *container); - virtual bool clearWidgetContent(const QByteArray &classname, QWidget *w); - - virtual bool saveSpecialProperty(const QByteArray &classname, - const QString &name, const QVariant &value, QWidget *w, - QDomElement &parentNode, QDomDocument &parent); - virtual bool readSpecialProperty(const QByteArray &classname, QDomElement &node, - QWidget *w, KFormDesigner::ObjectTreeItem *item); - - virtual void setPropertyOptions(KPropertySet& set, const KFormDesigner::WidgetInfo& info, QWidget *w); - - //! Moved into public for EditRichTextAction - bool editRichText(QWidget *w, QString &text) const { return KFormDesigner::WidgetFactory::editRichText(w, text); } - - //! Moved into public for EditRichTextAction - void changeProperty(KFormDesigner::Form *form, QWidget *widget, const char *name, - const QVariant &value) { KFormDesigner::WidgetFactory::changeProperty(form, widget, name, value); } - -public Q_SLOTS: -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT - void editListContents(); -#endif -protected Q_SLOTS: - void reorderTabs(int oldpos, int newpos); - -protected: - KFormDesigner::ObjectTreeItem* selectableItem(KFormDesigner::ObjectTreeItem* item); - virtual bool isPropertyVisibleInternal(const QByteArray &classname, QWidget *w, - const QByteArray &property, bool isTopLevel); - virtual bool changeInlineText(KFormDesigner::Form *form, QWidget *widget, - const QString &text, QString &oldText); - virtual void resizeEditor(QWidget *editor, QWidget *widget, const QByteArray &classname); -#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT - void saveTreeItem(QTreeWidgetItem *item, QDomNode &parentNode, QDomDocument &domDoc); - void readTreeItem(QDomElement &node, QTreeWidgetItem *parent, QTreeWidget *treewidget); -#endif -}; - -#endif diff --git a/src/formeditor/factories/kexiforms_standardwidgetsplugin.desktop b/src/formeditor/factories/kexiforms_standardwidgetsplugin.desktop deleted file mode 100644 index 56c24c3b6..000000000 --- a/src/formeditor/factories/kexiforms_standardwidgetsplugin.desktop +++ /dev/null @@ -1,53 +0,0 @@ -[Desktop Entry] -Name=Standard Widgets -Name[ca]=Estris estàndards -Name[ca@valencia]=Estris estàndards -Name[cs]=Standardní widgety -Name[de]=Standardbedienelemente -Name[en_GB]=Standard Widgets -Name[es]=Elementos gráficos estándares -Name[fi]=Vakioelementit -Name[gl]=Trebellos etándar -Name[it]=Oggetti standard -Name[nl]=Standaardwidgets -Name[pl]=Standardowe elementy interfejsu -Name[pt]=Elementos-Padrão -Name[pt_BR]=Elementos padrão -Name[sk]=Štandardné widgety -Name[sv]=Standardkomponenter -Name[uk]=Стандартні віджети -Name[x-test]=xxStandard Widgetsxx -Comment=Kexi plugin providing standard form widgets -Comment[ca]=Connector del Kexi que proporciona estris estàndard de formularis -Comment[ca@valencia]=Connector del Kexi que proporciona estris estàndard de formularis -Comment[de]=Kexi-Modul, das Standard-Formularelemente bereitstellt -Comment[en_GB]=Kexi plugin providing standard form widgets -Comment[es]=Complemento de Kexi que proporciona elementos gráficos estándares para formularios -Comment[fi]=Kexi-liitännäinen, joka tarjoaa vakiolomake-elementit -Comment[gl]=Complemento de Kexi que fornece trebellos estándar para formularios. -Comment[it]=Estensione che fornisce oggetti dei moduli standard di Kexi -Comment[nl]=Kexi-plug-in levert standaard formulierwidgets -Comment[pl]=Wtyczka Kexi dostarczająca standarowe formularze -Comment[pt]='Plugin' do Kexi que oferece elementos gráficos de formulários -Comment[pt_BR]=Plugin do Kexi que oferece elementos gráficos de formulários -Comment[sk]=Kexi plugin poskytujúci štandardné widgety formulárov -Comment[sv]=Kexi insticksprogram som tillhandahåller standardkomponenter för formulär -Comment[uk]=Додаток до Kexi, що забезпечує роботу форми стандартних віджетів -Comment[x-test]=xxKexi plugin providing standard form widgetsxx -Type=Service -Icon=form -Encoding=UTF-8 - -X-KDE-Library=kexiforms_standardwidgetsplugin -X-KDE-ServiceTypes=Kexi/FormWidgets -X-KDE-PluginInfo-Author=Kexi Team -X-KDE-PluginInfo-Email=kexi@kde.org -X-KDE-PluginInfo-Name=org.kexi-project.form.widgets.standard -X-KDE-PluginInfo-Version=3.0 -X-KDE-PluginInfo-Website=http://kexi-project.org -X-KDE-PluginInfo-Category= -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=LGPL -X-KDE-PluginInfo-EnabledByDefault=true - -X-Kexi-FormWidgetsFactoryGroup= diff --git a/src/formeditor/widgetlibrary.cpp b/src/formeditor/widgetlibrary.cpp index a53b5b309..8a73ee07d 100644 --- a/src/formeditor/widgetlibrary.cpp +++ b/src/formeditor/widgetlibrary.cpp @@ -1,772 +1,782 @@ /* This file is part of the KDE project Copyright (C) 2003 Lucijan Busch Copyright (C) 2004 Cedric Pasteur Copyright (C) 2004-2015 Jarosław Staniek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "widgetlibrary.h" #include #include "WidgetInfo.h" #include "widgetfactory.h" #include "libactionwidget.h" #include "container.h" #include "form.h" #include "formIO.h" #include "FormWidgetInterface.h" #include "objecttree.h" #include "KexiJsonTrader.h" #include "KexiFormWidgetsPluginMetaData.h" #include "KexiVersion.h" #include +#include
#include #include #include #include #include namespace KFormDesigner { Q_GLOBAL_STATIC_WITH_ARGS(KexiJsonTrader, KexiFormWidgetsPluginTrader_instance, (KEXI_BASE_NAME_LOWER "/forms/widgets")) //! @internal class Q_DECL_HIDDEN WidgetLibrary::Private { public: Private(WidgetLibrary *library, const QStringList& supportedFactoryGroups) : showAdvancedProperties(true) , q(library) , m_couldNotFindAnyFormWidgetPluginsErrorDisplayed(false) , m_supportedFactoryGroups(supportedFactoryGroups.toSet()) , m_lookupDone(false) , m_loadFactoriesDone(false) { q->setMessageHandler(&messageHandler); m_advancedProperties.insert("acceptDrops"); m_advancedProperties.insert("accessibleDescription"); m_advancedProperties.insert("accessibleName"); m_advancedProperties.insert("autoMask"); m_advancedProperties.insert("backgroundOrigin"); m_advancedProperties.insert("backgroundMode");//this is rather useless m_advancedProperties.insert("baseSize"); m_advancedProperties.insert("contextMenuEnabled"); m_advancedProperties.insert("contextMenuPolicy"); m_advancedProperties.insert("cursorPosition"); m_advancedProperties.insert("cursorMoveStyle"); m_advancedProperties.insert("dragEnabled"); m_advancedProperties.insert("enableSqueezedText"); m_advancedProperties.insert("layout");// too large risk to break things m_advancedProperties.insert("layoutDirection"); m_advancedProperties.insert("locale"); m_advancedProperties.insert("mouseTracking"); /*! @todo: reenable */ m_advancedProperties.insert("palette"); m_advancedProperties.insert("sizeAdjustPolicy"); //QAbstractScrollArea m_advancedProperties.insert("sizeIncrement"); m_advancedProperties.insert("sizePolicy"); m_advancedProperties.insert("statusTip"); m_advancedProperties.insert("toolTipDuration"); m_advancedProperties.insert("trapEnterKeyEvent"); m_advancedProperties.insert("windowModality"); m_advancedProperties.insert("autoExclusive"); // by providing this in propeditor m_advancedProperties.insert("minimumSize"); m_advancedProperties.insert("maximumSize"); m_advancedProperties.insert("clickMessage"); // for backward compatibility Kexi projects created with Qt < 4.7 m_advancedProperties.insert("showClearButton"); // for backward compatibility Kexi projects created with Qt 4 #ifndef KEXI_SHOW_UNFINISHED /*! @todo reenable */ m_advancedProperties.insert("accel"); m_advancedProperties.insert("icon"); m_advancedProperties.insert("paletteBackgroundPixmap"); m_advancedProperties.insert("pixmap"); m_advancedProperties.insert("shortcut"); // renamed from "accel" in Qt 4 m_advancedProperties.insert("windowIcon"); // renamed from "icon" in Qt 4 #endif } ~Private() { qDeleteAll(m_factories); m_factories.clear(); qDeleteAll(m_pluginsMetaData); m_pluginsMetaData.clear(); } QHash widgets() { KDbMessageGuard mg(q); (void)loadFactories(); return m_widgets; } QHash factories() { KDbMessageGuard mg(q); (void)loadFactories(); return m_factories; } bool isAdvancedProperty(const QByteArray &property) const { return m_advancedProperties.contains(property); } bool showAdvancedProperties; private: //! Performs a form widget plugins lookup. @return true on success. //! @todo This method generates a few warnings, maybe we want to optionally display them somewhere (via the message handler)? bool lookup() { //! @todo Allow refreshing if (m_lookupDone) { return m_lookupResult; } m_lookupDone = true; m_lookupResult = false; q->clearResult(); QStringList serviceTypes; - serviceTypes << "Kexi/FormWidgets"; + serviceTypes << "Kexi/FormWidget"; QList offers = KexiFormWidgetsPluginTrader_instance->query(serviceTypes); foreach(const QPluginLoader *loader, offers) { QScopedPointer metaData(new KexiFormWidgetsPluginMetaData(*loader)); if (metaData->id().isEmpty()) { qWarning() << "No plugin ID specified for Kexi Form Widgets plugin" << metaData->fileName() << "-- skipping!"; continue; } // check version const QString expectedVersion = KFormDesigner::version(); if (metaData->version() != expectedVersion) { qWarning() << "Kexi Form Widgets plugin" << metaData->id() << "has version" << metaData->majorVersion() << "but required version is" << KFormDesigner::version() << "-- skipping!"; continue; } // skip duplicates if (m_pluginsMetaData.contains(metaData->id())) { qWarning() << "More than one Kexi Form Widgets plugin with ID" << metaData->id() << metaData->fileName() << "-- skipping this one"; continue; } //qDebug() << "found factory:" << ptr->name(); if (!metaData->group().isEmpty() && !m_supportedFactoryGroups.contains(metaData->group())) { qDebug() << "Factory group" << metaData->group() << "for Form Widgets plugin" << metaData->id() << metaData->fileName() << "is not supported -- skipping!"; continue; } + if (!setupPrivateIconsResourceWithMessage( + QLatin1String(KEXI_BASE_NAME_LOWER), + QString::fromLatin1("icons/%1_%2.rcc") + .arg(metaData->id()).arg(supportedIconTheme), + QtWarningMsg, + QString::fromLatin1(":/icons/%1").arg(metaData->id()))) + { + continue; + } m_pluginsMetaData.insert(metaData->id(), metaData.data()); metaData.take(); } qDeleteAll(offers); offers.clear(); if (m_pluginsMetaData.isEmpty()) { q->m_result = KDbResult(i18n("Could not find any form widget plugins.")); m_couldNotFindAnyFormWidgetPluginsErrorDisplayed = true; return false; } m_lookupResult = true; return true; } //! Loads all factory plugins bool loadFactories() { if (m_loadFactoriesDone) { if (m_couldNotFindAnyFormWidgetPluginsErrorDisplayed) { q->clearResult(); // show the warning only once } return m_loadFactoriesResult; } m_loadFactoriesDone = true; m_loadFactoriesResult = false; if (!lookup()) { return false; } foreach (KexiFormWidgetsPluginMetaData *pluginMetaData, m_pluginsMetaData) { WidgetFactory *factory = loadFactory(pluginMetaData); if (!factory) { continue; } //collect information about classes to be hidden if (factory->hiddenClasses()) { foreach (const QByteArray &c, *factory->hiddenClasses()) { m_hiddenClasses.insert(c); } } } //now we have factories instantiated: load widgets QList loadLater; foreach (WidgetFactory *factory, m_factories) { //ONE LEVEL, FLAT INHERITANCE, but works! //if this factory inherits from something, load its witgets later //! @todo improve if (factory->inheritsFactories()) loadLater.append(factory); else loadFactoryWidgets(factory); } //load now the rest foreach (WidgetFactory* f, loadLater) { loadFactoryWidgets(f); } m_loadFactoriesResult = true; return true; } //! Loads of a single factory. @return true on success WidgetFactory *loadFactory(KexiFormWidgetsPluginMetaData *pluginMetaData) { KPluginFactory *factory = qobject_cast(pluginMetaData->instantiate()); if (!factory) { q->m_result = KDbResult(ERR_CANNOT_LOAD_OBJECT, xi18nc("@info", "Could not load Kexi Form Widgets plugin file %1.", pluginMetaData->fileName())); q->setErrorMessage(pluginMetaData, q->result().message()); qWarning() << q->result().message(); return 0; } WidgetFactory *widgetFactory = factory->create(q); if (!widgetFactory) { q->m_result = KDbResult(ERR_CANNOT_LOAD_OBJECT, xi18nc("@info", "Could not open Kexi Form Widgets plugin %1.", pluginMetaData->fileName())); qWarning() << q->m_result.message(); return 0; } widgetFactory->setLibrary(q); widgetFactory->setObjectName(pluginMetaData->id()); widgetFactory->setAdvancedPropertiesVisible(showAdvancedProperties); //inherit this flag from the library m_factories.insert(pluginMetaData->id().toLatin1(), widgetFactory); return widgetFactory; } //! Loads widgets for factory @a f void loadFactoryWidgets(WidgetFactory *f) { QHash widgetsForFactory(f->classes()); foreach (WidgetInfo *w, widgetsForFactory) { if (m_hiddenClasses.contains( w->className() )) continue; //this class is hidden // check if we want to inherit a widget from a different factory if (!w->parentFactoryName().isEmpty() && !w->inheritedClassName().isEmpty()) { WidgetFactory *parentFactory = m_factories.value(w->parentFactoryName().toLower()); if (!parentFactory) { qWarning() << "class" << w->className() << ": no such parent factory" << w->parentFactoryName(); continue; } WidgetInfo* inheritedClass = parentFactory->widgetInfoForClassName(w->inheritedClassName()); if (!inheritedClass) { qWarning() << "class" << w->inheritedClassName() << " - no such class to inherit in factory" << w->parentFactoryName(); continue; } //ok: inherit properties: w->setInheritedClass( inheritedClass ); if (w->iconName().isEmpty()) w->setIconName(inheritedClass->iconName()); //ok? foreach(const QByteArray& alternateName, inheritedClass->alternateClassNames()) { w->addAlternateClassName( alternateName, inheritedClass->isOverriddenClassName(alternateName)); } if (w->includeFileName().isEmpty()) w->setIncludeFileName(inheritedClass->includeFileName()); if (w->name().isEmpty()) w->setName(inheritedClass->name()); if (w->namePrefix().isEmpty()) w->setNamePrefix(inheritedClass->namePrefix()); if (w->description().isEmpty()) w->setDescription(inheritedClass->description()); } QList cnames( w->alternateClassNames() ); cnames.prepend(w->className()); foreach (const QByteArray &wname, cnames) { WidgetInfo *widgetForClass = widgetsForFactory.value(wname); if (!widgetForClass || (widgetForClass && !widgetForClass->isOverriddenClassName(wname))) { //insert a widgetinfo, if: //1) this class has no alternate class assigned yet, or //2) this class has alternate class assigned but without 'override' flag m_widgets.insert(wname, w); } } } } WidgetLibrary *q; KexiGUIMessageHandler messageHandler; //! A map which associates a class name with a Widget class QHash m_pluginsMetaData; //!< owner bool m_couldNotFindAnyFormWidgetPluginsErrorDisplayed; QSet m_supportedFactoryGroups; QHash m_factories; //!< owner QHash m_widgets; //!< owner QSet m_advancedProperties; QSet m_hiddenClasses; bool m_lookupDone; bool m_lookupResult; bool m_loadFactoriesDone; bool m_loadFactoriesResult; }; } using namespace KFormDesigner; //------------------------------------------- WidgetLibrary::WidgetLibrary(QObject *parent, const QStringList& supportedFactoryGroups) : QObject(parent) , KDbResultable() , d(new Private(this, supportedFactoryGroups)) { } WidgetLibrary::~WidgetLibrary() { delete d; } void WidgetLibrary::createWidgetActions(ActionGroup *group) { foreach (WidgetInfo *winfo, d->widgets()) { LibActionWidget *a = new LibActionWidget(group, winfo); connect(a, SIGNAL(toggled(QByteArray)), this, SIGNAL(widgetActionToggled(QByteArray))); } } void WidgetLibrary::addCustomWidgetActions(KActionCollection *col) { if (!col) return; foreach (WidgetFactory *factory, d->factories()) { factory->createCustomActions(col); } } QWidget* WidgetLibrary::createWidget(const QByteArray &classname, QWidget *parent, const char *name, Container *c, WidgetFactory::CreateWidgetOptions options) { WidgetInfo *wclass = d->widgets().value(classname); if (!wclass) return 0; QWidget *widget = wclass->factory()->createWidget(wclass->className(), parent, name, c, options); if (!widget) { //try to instantiate from inherited class if (wclass->inheritedClass()) widget = wclass->inheritedClass()->factory()->createWidget( wclass->className(), parent, name, c, options); if (!widget) return 0; } widget->setAcceptDrops(true); if (options & WidgetFactory::DesignViewMode) { FormWidgetInterface* fwiface = dynamic_cast(widget); if (fwiface) fwiface->setDesignMode(true); } emit widgetCreated(widget); return widget; } bool WidgetLibrary::createMenuActions(const QByteArray &c, QWidget *w, QMenu *menu, KFormDesigner::Container *container) { WidgetInfo *wclass = d->widgets().value(c); if (!wclass) return false; if (wclass->factory()->createMenuActions(c, w, menu, container)) { return true; } //try from inherited class if (wclass->inheritedClass()) { return wclass->inheritedClass()->factory()->createMenuActions( wclass->className(), w, menu, container); } return false; } bool WidgetLibrary::startInlineEditing(const QByteArray &classname, QWidget *w, Container *container) { WidgetInfo *wclass = d->widgets().value(classname); if (!wclass) return false; FormWidgetInterface* fwiface = dynamic_cast(w); { KFormDesigner::WidgetFactory::InlineEditorCreationArguments args(classname, w, container); if (wclass->factory()->startInlineEditing(args)) { args.container->form()->createInlineEditor(args); if (fwiface) fwiface->setEditingMode(true); return true; } } if (wclass->inheritedClass()) { //try from inherited class KFormDesigner::WidgetFactory::InlineEditorCreationArguments args(wclass->className(), w, container); if (wclass->inheritedClass()->factory()->startInlineEditing(args)) { args.container->form()->createInlineEditor(args); if (fwiface) fwiface->setEditingMode(true); return true; } } return false; } bool WidgetLibrary::previewWidget(const QByteArray &classname, QWidget *widget, Container *container) { WidgetInfo *wclass = d->widgets().value(classname); if (!wclass) return false; FormWidgetInterface* fwiface = dynamic_cast(widget); if (fwiface) fwiface->setDesignMode(false); if (wclass->factory()->previewWidget(classname, widget, container)) return true; //try from inherited class if (wclass->inheritedClass()) return wclass->inheritedClass()->factory()->previewWidget(wclass->className(), widget, container); return false; } bool WidgetLibrary::clearWidgetContent(const QByteArray &classname, QWidget *w) { WidgetInfo *wclass = d->widgets().value(classname); if (!wclass) return false; if (wclass->factory()->clearWidgetContent(classname, w)) return true; //try from inherited class if (wclass->inheritedClass()) return wclass->inheritedClass()->factory()->clearWidgetContent(wclass->className(), w); return false; } QString WidgetLibrary::displayName(const QByteArray &classname) { WidgetInfo *wi = d->widgets().value(classname); if (wi) return wi->name(); return classname; } QString WidgetLibrary::savingName(const QByteArray &classname) { WidgetInfo *wi = d->widgets().value(classname); if (wi && !wi->savingName().isEmpty()) return wi->savingName(); return classname; } QString WidgetLibrary::namePrefix(const QByteArray &classname) { WidgetInfo *wi = d->widgets().value(classname); if (wi) return wi->namePrefix(); return classname; } QString WidgetLibrary::textForWidgetName(const QByteArray &name, const QByteArray &className) { WidgetInfo *widget = d->widgets().value(className); if (!widget) return QString(); QString newName = name; newName.remove(widget->namePrefix()); newName = widget->name() + (newName.isEmpty() ? QString() : (QLatin1String(" ") + newName)); return newName; } QByteArray WidgetLibrary::classNameForAlternate(const QByteArray &classname) { if (d->widgets().value(classname)) return classname; WidgetInfo *wi = d->widgets().value(classname); if (wi) { return wi->className(); } // widget not supported return "CustomWidget"; } QString WidgetLibrary::includeFileName(const QByteArray &classname) { WidgetInfo *wi = d->widgets().value(classname); if (wi) return wi->includeFileName(); return QString(); } QString WidgetLibrary::iconName(const QByteArray &classname) { WidgetInfo *wi = d->widgets().value(classname); if (wi) return wi->iconName(); return KexiIconName("unknown-widget"); } bool WidgetLibrary::saveSpecialProperty(const QByteArray &classname, const QString &name, const QVariant &value, QWidget *w, QDomElement &parentNode, QDomDocument &parent) { WidgetInfo *wi = d->widgets().value(classname); if (!wi) return false; if (wi->factory()->saveSpecialProperty(classname, name, value, w, parentNode, parent)) return true; //try from inherited class if (wi->inheritedClass()) return wi->inheritedClass()->factory()->saveSpecialProperty(wi->className(), name, value, w, parentNode, parent); return false; } bool WidgetLibrary::readSpecialProperty(const QByteArray &classname, QDomElement &node, QWidget *w, ObjectTreeItem *item) { WidgetInfo *wi = d->widgets().value(classname); if (!wi) return false; if (wi->factory()->readSpecialProperty(classname, node, w, item)) return true; //try from inherited class if (wi->inheritedClass()) return wi->inheritedClass()->factory()->readSpecialProperty(wi->className(), node, w, item); return false; } void WidgetLibrary::setAdvancedPropertiesVisible(bool set) { d->showAdvancedProperties = set; } bool WidgetLibrary::advancedPropertiesVisible() const { return d->showAdvancedProperties; } bool WidgetLibrary::isPropertyVisible(const QByteArray &classname, QWidget *w, const QByteArray &property, bool multiple, bool isTopLevel) { if (isTopLevel) { // no focus policy for top-level form widget... if (!d->showAdvancedProperties && property == "focusPolicy") return false; } WidgetInfo *wi = d->widgets().value(classname); if (!wi) return false; if (!d->showAdvancedProperties && d->isAdvancedProperty(property)) { //this is advanced property, should we hide it? if (!wi->internalProperty("forceShowAdvancedProperty:" + property).toBool() && (!wi->inheritedClass() || !wi->inheritedClass()->internalProperty("forceShowAdvancedProperty:" + property).toBool())) { return false; //hide it } } if (!wi->factory()->isPropertyVisible(classname, w, property, multiple, isTopLevel)) return false; //try from inherited class if (wi->inheritedClass() && !wi->inheritedClass()->factory()->isPropertyVisible(wi->className(), w, property, multiple, isTopLevel)) return false; return true; } QList WidgetLibrary::autoSaveProperties(const QByteArray &classname) { WidgetInfo *wi = d->widgets().value(classname); if (!wi) return QList(); return wi->autoSaveProperties(); } WidgetInfo* WidgetLibrary::widgetInfoForClassName(const char* classname) { return d->widgets().value(classname); } WidgetFactory* WidgetLibrary::factoryForClassName(const char* classname) { WidgetInfo *wi = widgetInfoForClassName(classname); return wi ? wi->factory() : 0; } QString WidgetLibrary::propertyDescForName(WidgetInfo *winfo, const QByteArray& propertyName) { if (!winfo || !winfo->factory()) return QString(); QString desc(winfo->factory()->propertyDescription(propertyName)); if (!desc.isEmpty()) return desc; if (winfo->parentFactoryName().isEmpty()) return QString(); //try in parent factory, if exists WidgetFactory *parentFactory = d->factories().value(winfo->parentFactoryName()); if (!parentFactory) return QString(); return parentFactory->propertyDescription(propertyName); } QString WidgetLibrary::propertyDescForValue(WidgetInfo *winfo, const QByteArray& name) { if (!winfo->factory()) return QString(); QString desc(winfo->factory()->valueDescription(name)); if (!desc.isEmpty()) return desc; if (winfo->parentFactoryName().isEmpty()) return QString(); //try in parent factory, if exists WidgetFactory *parentFactory = d->factories().value(winfo->parentFactoryName()); if (!parentFactory) return QString(); return parentFactory->valueDescription(name); } void WidgetLibrary::setPropertyOptions(KPropertySet& set, const WidgetInfo& winfo, QWidget* w) { if (!winfo.factory()) return; winfo.factory()->setPropertyOptions(set, winfo, w); if (winfo.parentFactoryName().isEmpty()) return; WidgetFactory *parentFactory = d->factories().value(winfo.parentFactoryName()); if (!parentFactory) return; parentFactory->setPropertyOptions(set, winfo, w); } WidgetFactory* WidgetLibrary::factory(const char* factoryName) const { return d->factories().value(factoryName); } QVariant WidgetLibrary::internalProperty(const QByteArray& classname, const QByteArray& property) { WidgetInfo *wclass = d->widgets().value(classname); if (!wclass) return QString(); QVariant value(wclass->internalProperty(property)); if (value.isNull() && wclass->inheritedClass()) return wclass->inheritedClass()->internalProperty(property); return value; } WidgetFactory::CreateWidgetOption WidgetLibrary::showOrientationSelectionPopup( const QByteArray &classname, QWidget* parent, const QPoint& pos) { WidgetInfo *wclass = d->widgets().value(classname); if (!wclass) return WidgetFactory::AnyOrientation; //get custom icons and strings QIcon iconHorizontal, iconVertical; QString iconName(wclass->internalProperty("orientationSelectionPopup:horizontalIcon").toString()); if (iconName.isEmpty() && wclass->inheritedClass()) iconName = wclass->inheritedClass()->internalProperty("orientationSelectionPopup:horizontalIcon").toString(); if (!iconName.isEmpty()) iconHorizontal = QIcon::fromTheme(iconName); iconName = wclass->internalProperty("orientationSelectionPopup:verticalIcon").toString(); if (iconName.isEmpty() && wclass->inheritedClass()) iconName = wclass->inheritedClass()->internalProperty("orientationSelectionPopup:verticalIcon").toString(); if (!iconName.isEmpty()) iconVertical = QIcon::fromTheme(iconName); QString textHorizontal = wclass->internalProperty("orientationSelectionPopup:horizontalText").toString(); if (textHorizontal.isEmpty() && wclass->inheritedClass()) iconName = wclass->inheritedClass()->internalProperty("orientationSelectionPopup:horizontalText").toString(); if (textHorizontal.isEmpty()) //default textHorizontal = xi18nc("Insert Horizontal Widget", "Insert Horizontal"); QString textVertical = wclass->internalProperty("orientationSelectionPopup:verticalText").toString(); if (textVertical.isEmpty() && wclass->inheritedClass()) iconName = wclass->inheritedClass()->internalProperty("orientationSelectionPopup:verticalText").toString(); if (textVertical.isEmpty()) //default textVertical = xi18nc("Insert Vertical Widget", "Insert Vertical"); QMenu popup(parent); popup.setObjectName("orientationSelectionPopup"); popup.addSection(QIcon::fromTheme(wclass->iconName()), xi18n("Insert Widget: %1", wclass->name())); QAction* horizAction = popup.addAction(iconHorizontal, textHorizontal); QAction* vertAction = popup.addAction(iconVertical, textVertical); popup.addSeparator(); popup.addAction(koIcon("dialog-cancel"), xi18n("Cancel")); QAction *a = popup.exec(pos); if (a == horizAction) return WidgetFactory::HorizontalOrientation; else if (a == vertAction) return WidgetFactory::VerticalOrientation; return WidgetFactory::AnyOrientation; //means "cancelled" } bool WidgetLibrary::propertySetShouldBeReloadedAfterPropertyChange( const QByteArray& classname, QWidget *w, const QByteArray& property) { WidgetInfo *winfo = widgetInfoForClassName(classname); if (!winfo) return false; return winfo->factory()->propertySetShouldBeReloadedAfterPropertyChange(classname, w, property); } ObjectTreeItem* WidgetLibrary::selectableItem(ObjectTreeItem* item) { //qDebug() << item->widget()->metaObject()->className(); WidgetInfo *wi = d->widgets().value(item->widget()->metaObject()->className()); if (!wi) return item; return wi->factory()->selectableItem(item); } void WidgetLibrary::setErrorMessage(KexiFormWidgetsPluginMetaData *pluginMetaData, const QString& errorMessage) { pluginMetaData->setErrorMessage(errorMessage); } diff --git a/src/plugins/forms/CMakeLists.txt b/src/plugins/forms/CMakeLists.txt index c377902db..0523f8d14 100644 --- a/src/plugins/forms/CMakeLists.txt +++ b/src/plugins/forms/CMakeLists.txt @@ -1,111 +1,89 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core ${CMAKE_SOURCE_DIR}/src/widget/utils ${CMAKE_SOURCE_DIR}/src/widget ${CMAKE_SOURCE_DIR}/src/formeditor) -if(MARBLE_FOUND) -#TODO add_subdirectory(widgets/mapbrowser) -endif() - -if(Qt5WebKitWidgets_FOUND) - add_subdirectory(widgets/webbrowser) -endif() - -# the main plugin +# the form plugin set(kexi_formplugin_SRCS kexiforms.cpp) add_library(kexi_formplugin MODULE ${kexi_formplugin_SRCS}) kcoreaddons_desktop_to_json(kexi_formplugin kexi_formplugin.desktop) target_link_libraries(kexi_formplugin kexicore kexiguiutils kexidatatable kexiextendedwidgets kformdesigner kexiformutils KPropertyWidgets ) install(TARGETS kexi_formplugin DESTINATION ${KEXI_PLUGIN_INSTALL_DIR}) -# the form widgets plugin -set(kexiforms_dbwidgetsplugin_SRCS kexidbfactory.cpp) - -add_library(kexiforms_dbwidgetsplugin MODULE ${kexiforms_dbwidgetsplugin_SRCS}) -kcoreaddons_desktop_to_json(kexiforms_dbwidgetsplugin kexiforms_dbwidgetsplugin.desktop) - -target_link_libraries(kexiforms_dbwidgetsplugin - PRIVATE - kformdesigner - kexiformutils - kexicore - kexiguiutils - kexidataviewcommon - kexidatatable - kexiextendedwidgets - - KDb - - Qt5::Gui -) - -install(TARGETS kexiforms_dbwidgetsplugin DESTINATION ${KEXI_FORM_WIDGETS_PLUGIN_INSTALL_DIR}) - # the form utils lib set(kexiformutils_LIB_SRCS # kexiformdataiteminterface.cpp kexidataawarewidgetinfo.cpp KexiFormScrollAreaWidget.cpp kexiformscrollview.cpp kexidbtextwidgetinterface.cpp kexiformmanager.cpp kexidatasourcepage.cpp kexiformpart.cpp kexiformview.cpp kexidbfactorybase.cpp widgets/kexidbutils.cpp widgets/kexidbautofield.cpp widgets/kexidbform.cpp widgets/kexidblabel.cpp widgets/kexidbimagebox.cpp widgets/KexiDBPushButton.cpp widgets/kexiframe.cpp widgets/kexidblineedit.cpp widgets/kexidbcheckbox.cpp widgets/kexidbtextedit.cpp widgets/kexidbcombobox.cpp widgets/kexidbcommandlinkbutton.cpp widgets/kexidbslider.cpp widgets/kexidbprogressbar.cpp widgets/kexidbdatepicker.cpp ) #obsolete widgets/kexidbdoublespinbox.cpp #obsolete widgets/kexidbintspinbox.cpp add_library(kexiformutils SHARED ${kexiformutils_LIB_SRCS}) generate_export_header(kexiformutils) target_link_libraries(kexiformutils PRIVATE kexicore kexiextendedwidgets kformdesigner kexiutils kexidataviewcommon kexidatatable kexiguiutils KDb KPropertyWidgets Qt5::Gui Qt5::Xml ) +set(kexiformutils_INCLUDE_DIRS + ${CMAKE_SOURCE_DIR}/src/plugins/forms + ${CMAKE_SOURCE_DIR}/src/plugins/forms/widgets +) +target_include_directories(kexiformutils + PUBLIC "$" +) set_target_properties(kexiformutils PROPERTIES VERSION ${GENERIC_PROJECT_LIB_VERSION} SOVERSION ${GENERIC_PROJECT_LIB_SOVERSION}) install(TARGETS kexiformutils ${INSTALL_TARGETS_DEFAULT_ARGS}) + +add_subdirectory(widgets) diff --git a/src/plugins/forms/kexiformmanager.cpp b/src/plugins/forms/kexiformmanager.cpp index 4b04c5ef4..cf16c0faf 100644 --- a/src/plugins/forms/kexiformmanager.cpp +++ b/src/plugins/forms/kexiformmanager.cpp @@ -1,559 +1,561 @@ /* This file is part of the KDE project Copyright (C) 2005-2011 Jarosław Staniek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "kexiformmanager.h" -#include "widgets/kexidbform.h" -#include "widgets/kexidbautofield.h" +#include "kexidbform.h" +#ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT +#include "kexidbautofield.h" +#endif #include "kexiformscrollview.h" #include "kexiformview.h" #include "kexidatasourcepage.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class KexiFormManagerPrivate { public: explicit KexiFormManagerPrivate(KexiFormManager *qq) : part(0) , q(qq) { features = KFormDesigner::Form::NoFeatures; widgetActionGroup = new KFormDesigner::ActionGroup(q); #ifdef KFD_SIGSLOTS dragConnectionAction = 0; #endif widgetTree = 0; collection = 0; } ~KexiFormManagerPrivate() { } KexiFormPart* part; KFormDesigner::WidgetLibrary* lib; KFormDesigner::ActionGroup* widgetActionGroup; KFormDesigner::WidgetTreeWidget *widgetTree; KActionCollection *collection; KFormDesigner::Form::Features features; KToggleAction *pointerAction; #ifdef KFD_SIGSLOTS KToggleAction *dragConnectionAction; #endif KToggleAction *snapToGridAction; KexiFormManager *q; }; Q_GLOBAL_STATIC(KexiFormManager, g_manager) KexiFormManager* KexiFormManager::self() { return g_manager; } KexiFormManager::KexiFormManager() : QObject() , d(new KexiFormManagerPrivate(this)) { KexiCustomPropertyFactory::init(); } KexiFormManager::~KexiFormManager() { delete d; } void KexiFormManager::init(KexiFormPart *part, KFormDesigner::WidgetTreeWidget *widgetTree) { /*! @todo add configuration for supported factory groups */ QStringList supportedFactoryGroups; supportedFactoryGroups += "kexi"; d->lib = new KFormDesigner::WidgetLibrary(this, supportedFactoryGroups); d->lib->setAdvancedPropertiesVisible(false); connect(d->lib, SIGNAL(widgetCreated(QWidget*)), this, SLOT(slotWidgetCreatedByFormsLibrary(QWidget*))); connect(d->lib, SIGNAL(widgetActionToggled(QByteArray)), this, SLOT(slotWidgetActionToggled(QByteArray))); d->part = part; KActionCollection *col = /*tmp*/ new KActionCollection(this); if (col) { createActions( col ); //connect actions provided by widget factories connect(col->action("widget_assign_action"), SIGNAL(triggered()), this, SLOT(slotAssignAction())); } d->widgetTree = widgetTree; if (d->widgetTree) { //! @todo KEXI3 Port this: connect() //! @todo KEXI3 Port code related to KFormDesigner::FormManager::m_treeview here //! @todo connect(m_propSet, SIGNAL(widgetNameChanged(QByteArray,QByteArray)), //! @todo m_treeview, SLOT(renameItem(QByteArray,QByteArray))); } } KFormDesigner::ActionGroup* KexiFormManager::widgetActionGroup() const { return d->widgetActionGroup; } void KexiFormManager::createActions(KActionCollection* collection) { d->collection = collection; d->lib->createWidgetActions(d->widgetActionGroup); //! @todo insertWidget() slot? #ifdef KFD_SIGSLOTS if (d->features & KFormDesigner::Form::EnableConnections) { // nothing } else { d->dragConnectionAction = new KToggleAction( KexiIcon("signalslot"), futureI18n("Connect Signals/Slots"), d->collection); d->dragConnectionAction->setObjectName("drag_connection"); connect(d->dragConnectionAction, SIGNAL(triggered()), this, SLOT(startCreatingConnection())); d->dragConnectionAction->setChecked(false); } #endif d->pointerAction = new KToggleAction( koIcon("tool-pointer"), xi18n("Pointer"), d->collection); d->pointerAction->setObjectName("edit_pointer"); d->widgetActionGroup->addAction(d->pointerAction); connect(d->pointerAction, SIGNAL(triggered()), this, SLOT(slotPointerClicked())); d->pointerAction->setChecked(true); d->snapToGridAction = new KToggleAction( xi18n("Snap to Grid"), d->collection); d->snapToGridAction->setObjectName("snap_to_grid"); //! @todo #if 0 // Create the Style selection action (with a combo box in toolbar and submenu items) KSelectAction *styleAction = new KSelectAction( xi18n("Style"), d->collection); styleAction->setObjectName("change_style"); connect(styleAction, SIGNAL(triggered()), this, SLOT(slotStyle())); styleAction->setEditable(false); QString currentStyle(kapp->style()->objectName().toLower()); const QStringList styles = QStyleFactory::keys(); styleAction->setItems(styles); styleAction->setCurrentItem(0); QStringList::ConstIterator endIt = styles.constEnd(); int idx = 0; for (QStringList::ConstIterator it = styles.constBegin(); it != endIt; ++it, ++idx) { if ((*it).toLower() == currentStyle) { styleAction->setCurrentItem(idx); break; } } styleAction->setToolTip(xi18n("Set the current view style.")); styleAction->setMenuAccelsEnabled(true); #endif d->lib->addCustomWidgetActions(d->collection); #ifdef KEXI_DEBUG_GUI KConfigGroup generalGroup(KSharedConfig::openConfig()->group("General")); if (generalGroup.readEntry("ShowInternalDebugger", false)) { QAction *a = new QAction(koIcon("run-build-file"), xi18n("Show Form UI Code"), this); d->collection->addAction("show_form_ui", a); a->setShortcut(Qt::CTRL + Qt::Key_U); connect(a, SIGNAL(triggered()), this, SLOT(showFormUICode())); } #endif //! @todo move elsewhere { // (from obsolete kexiformpartinstui.rc) QStringList formActions; formActions << "edit_pointer" << QString() //sep #ifndef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT << "library_widget_KexiDBAutoField" #endif << "library_widget_KexiDBLabel" << "library_widget_KexiDBLineEdit" << "library_widget_KexiDBTextEdit" << "library_widget_KexiDBComboBox" << "library_widget_KexiDBCheckBox" << "library_widget_KexiDBImageBox" << QString() //sep << "library_widget_KexiDBPushButton" << QString() //sep << "library_widget_KexiFrame" << "library_widget_QGroupBox" << "library_widget_KFDTabWidget" - << "library_widget_Line" + << "library_widget_KexiLineWidget" << QString() //sep #ifdef HAVE_QTWEBKITWIDGETS << "library_widget_WebBrowserWidget" #endif #ifdef HAVE_MARBLE << "library_widget_MapBrowserWidget" #endif << "library_widget_KexiDBSlider" << "library_widget_KexiDBProgressBar" << "library_widget_KexiDBCommandLinkButton" << "library_widget_KexiDBDatePicker" << QString() //sep ; KexiMainWindowIface *win = KexiMainWindowIface::global(); foreach( const QString& actionName_, formActions ) { QAction *a; const QString actionName(actionName_.startsWith(':') ? actionName_.mid(1) : actionName_); if (actionName.isEmpty()) { a = new QAction(this); a->setSeparator(true); } else { a = d->widgetActionGroup->action(actionName); } if (actionName_.startsWith(':')) { // icon only KexiSmallToolButton *btn = new KexiSmallToolButton(a, win->toolBar("form")); btn->setToolButtonStyle(Qt::ToolButtonIconOnly); win->appendWidgetToToolbar("form", btn); } else { win->addToolBarAction("form", a); } } QSet iconOnlyActions; const QList actions( d->collection->actions() ); foreach( QAction *a, actions ) { if (iconOnlyActions.contains(a->objectName())) { // icon only KexiSmallToolButton *btn = new KexiSmallToolButton(a, win->toolBar("form")); btn->setToolButtonStyle(Qt::ToolButtonIconOnly); win->appendWidgetToToolbar("form", btn); win->setWidgetVisibleInToolbar(btn, true); } else { win->addToolBarAction("form", a); } } } } void KexiFormManager::slotWidgetCreatedByFormsLibrary(QWidget* widget) { QList _signals(KexiUtils::methodsForMetaObject( widget->metaObject(), QMetaMethod::Signal)); if (!_signals.isEmpty()) { QByteArray handleDragMoveEventSignal = "handleDragMoveEvent(QDragMoveEvent*)"; QByteArray handleDropEventSignal = "handleDropEvent(QDropEvent*)"; KexiFormView *formView = KDbUtils::findParent(widget); foreach(const QMetaMethod& method, _signals) { if (0 == qstrcmp(method.methodSignature(), handleDragMoveEventSignal)) { //qDebug() << method.methodSignature(); if (formView) { connect(widget, SIGNAL(handleDragMoveEvent(QDragMoveEvent*)), formView, SLOT(slotHandleDragMoveEvent(QDragMoveEvent*))); } } else if (0 == qstrcmp(method.methodSignature(), handleDropEventSignal)) { //qDebug() << method.methodSignature(); if (formView) { connect(widget, SIGNAL(handleDropEvent(QDropEvent*)), formView, SLOT(slotHandleDropEvent(QDropEvent*))); } } } } } void KexiFormManager::slotWidgetActionToggled(const QByteArray& action) { KexiFormView* fv = activeFormViewWidget(); if (fv) { fv->form()->enterWidgetInsertingState(action); } } KFormDesigner::WidgetLibrary* KexiFormManager::library() const { return d->lib; } QAction* KexiFormManager::action(const char* name) { KActionCollection *col = d->part->actionCollectionForMode(Kexi::DesignViewMode); if (!col) return 0; QString n(translateName(name)); QAction *a = col->action(n); if (a) return a; if (activeFormViewWidget()) { a = KexiMainWindowIface::global()->actionCollection()->action(n); if (a) return a; } return d->collection->action(name); } KexiFormView* KexiFormManager::activeFormViewWidget() const { KexiWindow *currentWindow = KexiMainWindowIface::global()->currentWindow(); if (!currentWindow) return 0; KexiFormView *currentView = dynamic_cast(currentWindow->selectedView()); if (!currentView || currentView->viewMode()!=Kexi::DesignViewMode) { return 0; } KFormDesigner::Form *form = currentView->form(); if (!form) { return 0; } KexiDBForm *dbform = dynamic_cast(form->formWidget()); if (!dbform) { return 0; } KexiFormScrollView *scrollViewWidget = dynamic_cast(dbform->dataAwareObject()); if (!scrollViewWidget) return 0; return dynamic_cast(scrollViewWidget->parent()); } void KexiFormManager::enableAction(const char* name, bool enable) { KexiFormView* formViewWidget = activeFormViewWidget(); if (!formViewWidget) return; formViewWidget->setAvailable(translateName(name).toLatin1(), enable); } void KexiFormManager::setFormDataSource(const QString& pluginId, const QString& name) { KexiFormView* formViewWidget = activeFormViewWidget(); if (!formViewWidget) return; KexiDBForm* formWidget = dynamic_cast(formViewWidget->form()->widget()); if (!formWidget) return; QString oldDataSourcePartClass(formWidget->dataSourcePluginId()); QString oldDataSource(formWidget->dataSource()); if (pluginId != oldDataSourcePartClass || name != oldDataSource) { QHash propValues; propValues.insert("dataSource", name); propValues.insert("dataSourcePartClass", pluginId); KFormDesigner::PropertyCommandGroup *group = new KFormDesigner::PropertyCommandGroup( xi18n("Set form's data source to %1", name)); formViewWidget->form()->createPropertyCommandsInDesignMode( formWidget, propValues, group, true /*addToActiveForm*/); } } void KexiFormManager::setDataSourceFieldOrExpression( const QString& string, const QString& caption, KDbField::Type type) { KexiFormView* formViewWidget = activeFormViewWidget(); if (!formViewWidget) return; KPropertySet* set = formViewWidget->form()->propertySet(); if (!set->contains("dataSource")) return; set->property("dataSource").setValue(string); if (set->propertyValue("autoCaption", false).toBool()) { set->changePropertyIfExists("fieldCaptionInternal", caption); } if (set->propertyValue("widgetType").toString() == "Auto") { set->changePropertyIfExists("fieldTypeInternal", type); } } void KexiFormManager::insertAutoFields(const QString& sourcePartClass, const QString& sourceName, const QStringList& fields) { #ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT Q_UNUSED(sourcePartClass); Q_UNUSED(sourceName); Q_UNUSED(fields); #else KexiFormView* formViewWidget = activeFormViewWidget(); if (!formViewWidget || !formViewWidget->form() || !formViewWidget->form()->activeContainer()) return; formViewWidget->insertAutoFields(sourcePartClass, sourceName, fields, formViewWidget->form()->activeContainer()); #endif } void KexiFormManager::slotHistoryCommandExecuted(KFormDesigner::Command *command) { if (command->childCount() == 2) { KexiFormView* formViewWidget = activeFormViewWidget(); if (!formViewWidget) return; KexiDBForm* formWidget = dynamic_cast(formViewWidget->form()->widget()); if (!formWidget) return; const KFormDesigner::PropertyCommand* pc1 = dynamic_cast(command->child(0)); const KFormDesigner::PropertyCommand* pc2 = dynamic_cast(command->child(1)); if (pc1 && pc2 && pc1->propertyName() == "dataSource" && pc2->propertyName() == "dataSourcePartClass") { const QHash::const_iterator it1(pc1->oldValues().constBegin()); const QHash::const_iterator it2(pc2->oldValues().constBegin()); if (it1.key() == formWidget->objectName() && it2.key() == formWidget->objectName()) d->part->dataSourcePage()->setFormDataSource( formWidget->dataSourcePluginId(), formWidget->dataSource()); } } } void KexiFormManager::showFormUICode() { #ifdef KEXI_DEBUG_GUI KexiFormView* formView = activeFormViewWidget(); if (!formView) return; formView->form()->resetInlineEditor(); QString uiCode; const int indent = 2; if (!KFormDesigner::FormIO::saveFormToString(formView->form(), uiCode, indent)) { //! @todo show err? return; } KPageDialog uiCodeDialog; uiCodeDialog.setFaceType(KPageDialog::Tabbed); uiCodeDialog.setModal(true); uiCodeDialog.setWindowTitle(xi18nc("@title:window", "Form's UI Code")); uiCodeDialog.resize(700, 600); KTextEdit *currentUICodeDialogEditor = new KTextEdit(&uiCodeDialog); uiCodeDialog.addPage(currentUICodeDialogEditor, xi18n("Current")); currentUICodeDialogEditor->setReadOnly(true); QFont f(currentUICodeDialogEditor->font()); f.setFamily("courier"); currentUICodeDialogEditor->setFont(f); KTextEdit *originalUICodeDialogEditor = new KTextEdit(&uiCodeDialog); uiCodeDialog.addPage(originalUICodeDialogEditor, xi18n("Original")); originalUICodeDialogEditor->setReadOnly(true); originalUICodeDialogEditor->setFont(f); currentUICodeDialogEditor->setPlainText(uiCode); //indent and set our original doc as well: QDomDocument doc; doc.setContent(formView->form()->m_recentlyLoadedUICode); originalUICodeDialogEditor->setPlainText(doc.toString(indent)); uiCodeDialog.exec(); #endif } void KexiFormManager::slotAssignAction() { KexiFormView* formView = activeFormViewWidget(); if (!formView) return; KFormDesigner::Form *form = formView->form(); KexiDBForm *dbform = 0; if (form->mode() != KFormDesigner::Form::DesignMode || !(dbform = dynamic_cast(form->formWidget()))) { return; } KPropertySet* set = form->propertySet(); KexiFormEventAction::ActionData data; const KProperty &onClickActionProp = set->property("onClickAction"); if (!onClickActionProp.isNull()) data.string = onClickActionProp.value().toString(); const KProperty &onClickActionOptionProp = set->property("onClickActionOption"); if (!onClickActionOptionProp.isNull()) data.option = onClickActionOptionProp.value().toString(); KexiFormScrollView *scrollViewWidget = dynamic_cast(dbform->dataAwareObject()); if (!scrollViewWidget) return; KexiFormView* formViewWidget = dynamic_cast(scrollViewWidget->parent()); if (!formViewWidget) return; KexiActionSelectionDialog dlg(dbform, data, set->property("objectName").value().toString()); if (dlg.exec() == QDialog::Accepted) { data = dlg.currentAction(); //update property value set->changeProperty("onClickAction", data.string); set->changeProperty("onClickActionOption", data.option); } } void KexiFormManager::slotPointerClicked() { KexiFormView* formView = activeFormViewWidget(); if (!formView) return; formView->form()->enterWidgetSelectingState(); } QString KexiFormManager::translateName(const char* name) const { QString n(QString::fromLatin1(name)); // translate to our name space: if (n.startsWith("align_") || n.startsWith("adjust_") || n == "format_raise" || n == "format_lower" || n == "taborder") { n.prepend("formpart_"); } return n; } diff --git a/src/plugins/forms/kexiforms_dbwidgetsplugin.desktop b/src/plugins/forms/kexiforms_dbwidgetsplugin.desktop deleted file mode 100644 index 2c87bb7eb..000000000 --- a/src/plugins/forms/kexiforms_dbwidgetsplugin.desktop +++ /dev/null @@ -1,54 +0,0 @@ -[Desktop Entry] -Name=Database Widgets -Name[ca]=Estris de base de dades -Name[ca@valencia]=Estris de base de dades -Name[cs]=Databázové widgety -Name[de]=Datenbankbedienelemente -Name[en_GB]=Database Widgets -Name[es]=Elementos gráficos de bases de datos -Name[fi]=Tietokantaelementit -Name[gl]=Trebellos de base de datos -Name[ia]=Widgets de Base de Datos -Name[it]=Oggetti di banche dati -Name[nl]=Databasewidgets -Name[pl]=Baza danych elementów interfejsu -Name[pt]=Elementos de Bases de Dados -Name[pt_BR]=Elementos de banco de dados -Name[sk]=Databázové widgety -Name[sv]=Databaskomponenter -Name[uk]=Віджети бази даних -Name[x-test]=xxDatabase Widgetsxx -Comment=Kexi plugin providing database form widgets -Comment[ca]=Connector del Kexi que proporciona estris de formularis de bases de dades -Comment[ca@valencia]=Connector del Kexi que proporciona estris de formularis de bases de dades -Comment[de]=Kexi-Modul, das Datenbankbedienelemente bereitstellt -Comment[en_GB]=Kexi plugin providing database form widgets -Comment[es]=Complemento de Kexi que proporciona elementos gráficos para formularios de bases de datos -Comment[fi]=Kexi-liitännäinen, joka tarjoaa tietokannan lomake-elementit -Comment[gl]=Complemento de Kexi que fornece trebellos de base de datos para formularios. -Comment[it]=Estensione che fornisce oggetti dei moduli delle banche dati di Kexi -Comment[nl]=Kexi-plug-in levert formulierwidgets voor database -Comment[pl]=Wtyczka Kexi dostarczająca formularze bazodanowe -Comment[pt]='Plugin' do Kexi que oferece elementos gráficos de formulários de bases de dados -Comment[pt_BR]=Plugin do Kexi que oferece elementos gráficos de formulários de bancos de dados -Comment[sk]=Kexi plugin poskytujúci widgety databázových formulárov -Comment[sv]=Kexi-insticksprogram som tillhandahåller komponenter för databasformulär -Comment[uk]=Додаток до Kexi, що забезпечує роботу віджетів форм бази даних -Comment[x-test]=xxKexi plugin providing database form widgetsxx -Type=Service -Icon=form -Encoding=UTF-8 - -X-KDE-Library=kexiforms_dbwidgetsplugin -X-KDE-ServiceTypes=Kexi/FormWidgets -X-KDE-PluginInfo-Author=Kexi Team -X-KDE-PluginInfo-Email=kexi@kde.org -X-KDE-PluginInfo-Name=org.kexi-project.form.widgets.db -X-KDE-PluginInfo-Version=3.0 -X-KDE-PluginInfo-Website=http://kexi-project.org -X-KDE-PluginInfo-Category= -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=LGPL -X-KDE-PluginInfo-EnabledByDefault=true - -X-Kexi-FormWidgetsFactoryGroup= diff --git a/src/plugins/forms/widgets/CMakeLists.txt b/src/plugins/forms/widgets/CMakeLists.txt new file mode 100644 index 000000000..107d578a8 --- /dev/null +++ b/src/plugins/forms/widgets/CMakeLists.txt @@ -0,0 +1,20 @@ +set(KEXI_FORM_WIDGETS_PLUGIN_INSTALL_DIR ${KEXI_PLUGIN_INSTALL_DIR}/forms/widgets) + +# Convenience macro that adds icon resource for given plugin and theme. +# Icons are placed in a path that contains _plugin_target. +# For example, icons/org.kexi-project.form.widgets.web-browser/breeze/actions/16/kexiform-web-browser.svg. +# This helps to make plugins not conflicting. +macro(kexi_add_plugin_icons_rcc_file _plugin_target _theme) + kexi_add_icons_rcc_file(${_plugin_target}_${_theme} ${_plugin_target} ${_theme} ${_plugin_target}) +endmacro() + +# the main widgets plugin +add_subdirectory(main) + +if(MARBLE_FOUND) +#TODO add_subdirectory(mapbrowser) +endif() + +if(Qt5WebKitWidgets_FOUND) + add_subdirectory(webbrowser) +endif() diff --git a/src/plugins/forms/widgets/main/CMakeLists.txt b/src/plugins/forms/widgets/main/CMakeLists.txt new file mode 100644 index 000000000..93fdd08bb --- /dev/null +++ b/src/plugins/forms/widgets/main/CMakeLists.txt @@ -0,0 +1,29 @@ +# the main form widgets plugin + +set(kexiforms_mainwidgetsplugin_SRCS + KexiStandardFormWidgets.cpp + KexiStandardContainerFormWidgets.cpp + KexiMainFormWidgetsFactory.cpp + kexiforms_mainwidgetsplugin.json +) + +add_library(org.kexi-project.form.widgets.main MODULE ${kexiforms_mainwidgetsplugin_SRCS}) + +target_link_libraries(org.kexi-project.form.widgets.main + PRIVATE + kformdesigner + kexiformutils + kexicore + kexiguiutils + kexidataviewcommon + kexidatatable + kexiextendedwidgets + + KDb + + Qt5::Gui +) + +install(TARGETS org.kexi-project.form.widgets.main DESTINATION ${KEXI_FORM_WIDGETS_PLUGIN_INSTALL_DIR}) + +add_subdirectory(pics) diff --git a/src/plugins/forms/kexidbfactory.cpp b/src/plugins/forms/widgets/main/KexiMainFormWidgetsFactory.cpp similarity index 52% rename from src/plugins/forms/kexidbfactory.cpp rename to src/plugins/forms/widgets/main/KexiMainFormWidgetsFactory.cpp index 018384b57..d1aabf5fd 100644 --- a/src/plugins/forms/kexidbfactory.cpp +++ b/src/plugins/forms/widgets/main/KexiMainFormWidgetsFactory.cpp @@ -1,846 +1,1422 @@ /* This file is part of the KDE project Copyright (C) 2004 Cedric Pasteur - Copyright (C) 2004-2014 Jarosław Staniek + Copyright (C) 2004-2016 Jarosław Staniek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ -#include "kexidbfactory.h" +#include "KexiMainFormWidgetsFactory.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "kexiformview.h" -#include "widgets/kexidbautofield.h" -#include "widgets/kexidbcheckbox.h" -#include "widgets/kexidbimagebox.h" -#include "widgets/kexiframe.h" -#include "widgets/kexidblabel.h" -#include "widgets/kexidblineedit.h" -#include "widgets/kexidbtextedit.h" -#include "widgets/kexidbcombobox.h" -#include "widgets/KexiDBPushButton.h" -#include "widgets/kexidbform.h" -#include "widgets/kexidbcommandlinkbutton.h" -#include "widgets/kexidbslider.h" -#include "widgets/kexidbprogressbar.h" -#include "widgets/kexidbdatepicker.h" +#include "KexiStandardContainerFormWidgets.h" +#include "KexiStandardFormWidgets.h" +#include "kexidbcheckbox.h" +#include "kexidbimagebox.h" +#include "kexiframe.h" +#include "kexidblabel.h" +#include "kexidblineedit.h" +#include "kexidbtextedit.h" +#include "kexidbcombobox.h" +#include "KexiDBPushButton.h" +#include "kexidbform.h" +#include "kexidbcommandlinkbutton.h" +#include "kexidbslider.h" +#include "kexidbprogressbar.h" +#include "kexidbdatepicker.h" #include "kexidataawarewidgetinfo.h" #include #include +#include + #include #include +#include #include #include -////////////////////////////////////////// -KEXI_PLUGIN_FACTORY(KexiDBFactory, "kexiforms_dbwidgetsplugin.json") +KEXI_PLUGIN_FACTORY(KexiMainFormWidgetsFactory, "kexiforms_mainwidgetsplugin.json") -KexiDBFactory::KexiDBFactory(QObject *parent, const QVariantList &) +KexiMainFormWidgetsFactory::KexiMainFormWidgetsFactory(QObject *parent, const QVariantList &) : KexiDBFactoryBase(parent) , m_assignAction(0) { - QByteArray parentFactory = "org.kexi-project.form.widgets.standard"; { KexiDataAwareWidgetInfo *wi = new KexiDataAwareWidgetInfo(this); wi->setIconName(KexiIconName("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 + KFormDesigner::WidgetInfo *wi = new KFormDesigner::WidgetInfo(this); + wi->setIconName(KexiIconName("unknown-widget")); + wi->setClassName("CustomWidget"); + wi->setName(/* no i18n needed */ "Custom Widget"); + wi->setNamePrefix(/* no i18n needed */ "customWidget"); + wi->setDescription(/* no i18n needed */ "A custom or non-supported widget"); + addClass(wi); + } + + { KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this); wi->setIconName(KexiIconName("lineedit")); wi->setClassName("KexiDBLineEdit"); - wi->setParentFactoryName(parentFactory); - wi->setInheritedClassName("QLineEdit"); + wi->addAlternateClassName("QLineEdit", true/*override*/); 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(KexiIconName("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(KexiIconName("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(KexiIconName("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(KexiIconName("imagebox")); 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); + wi->setAutoSaveProperties(QList() << "pixmap"); addClass(wi); } { KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this); wi->setIconName(KexiIconName("combobox")); wi->setClassName("KexiDBComboBox"); - wi->setParentFactoryName(parentFactory); - wi->setInheritedClassName("KComboBox"); /* we are inheriting to get i18n'd strings already translated there */ + wi->addAlternateClassName("QComboBox", true/*override*/); 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(KexiIconName("checkbox")); 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(KexiIconName("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->setClassName("KexiDBPushButton"); wi->setIconName(KexiIconName("button")); wi->addAlternateClassName("KexiPushButton", true/*override*/); + wi->addAlternateClassName("QPushButton", true/*override*/); 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(KexiIconName("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); } + //! @todo radio button +#ifdef KEXI_SHOW_UNFINISHED + { + KFormDesigner::WidgetInfo *wi = new KFormDesigner::WidgetInfo(this); + wi->setIconName(KexiIconName("radiobutton")); + wi->setClassName("QRadioButton"); + wi->setName(/* no i18n needed */ "Option Button"); + wi->setNamePrefix(/* no i18n needed */ "option"); + wi->setDescription(/* no i18n needed */ "An option button with text or pixmap label"); + addClass(wi); + } + { + KFormDesigner::WidgetInfo *wi = new KFormDesigner::WidgetInfo(this); + wi->setIconName(KexiIconName("spinbox")); + wi->setClassName("QSpinBox"); + wi->addAlternateClassName("KIntSpinBox"); + wi->setName(/* no i18n needed */ "Spin Box"); + wi->setNamePrefix(/* no i18n needed */ "spinBox"); + wi->setDescription(/* no i18n needed */ "A spin box widget"); + addClass(wi); + } +#endif { KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this); - wi->setIconName(KexiIconName("slider")); wi->setClassName("KexiDBSlider"); + wi->setIconName(KexiIconName("slider")); + wi->addAlternateClassName("QSlider", true/*override*/); 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(KexiIconName("progressbar")); wi->setClassName("KexiDBProgressBar"); + wi->setIconName(KexiIconName("progressbar")); + wi->addAlternateClassName("QProgressBar", true/*override*/); 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); } + { + KFormDesigner::WidgetInfo *wi = new KFormDesigner::WidgetInfo(this); + wi->setIconName(KexiIconName("line-horizontal")); + wi->setClassName("KexiLineWidget"); + wi->addAlternateClassName("Line", true/*override*/); + wi->setName(xi18n("Line")); + wi->setNamePrefix( + xi18nc("A prefix for identifiers of line widgets. Based on that, identifiers such as " + "line1, line2 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.", + "line")); + wi->setDescription(xi18n("A line to be used as a separator")); + wi->setAutoSaveProperties(QList() << "orientation"); + wi->setInternalProperty("orientationSelectionPopup", true); + wi->setInternalProperty("orientationSelectionPopup:horizontalIcon", KexiIconName("line-horizontal")); + wi->setInternalProperty("orientationSelectionPopup:verticalIcon", KexiIconName("line-vertical")); + wi->setInternalProperty("orientationSelectionPopup:horizontalText", xi18n("Insert &Horizontal Line")); + wi->setInternalProperty("orientationSelectionPopup:verticalText", xi18n("Insert &Vertical Line")); + addClass(wi); + } { KexiDataAwareWidgetInfo* wi = new KexiDataAwareWidgetInfo(this); - wi->setIconName(KexiIconName("dateedit")); wi->setClassName("KexiDBDatePicker"); + wi->setIconName(KexiIconName("dateedit")); + wi->addAlternateClassName("QDateEdit", true/*override*/); + wi->addAlternateClassName("KDateWidget", true/*override*/); 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); } + //! @todo time edit +#ifdef KEXI_SHOW_UNFINISHED + { + KFormDesigner::WidgetInfo *wi = new KFormDesigner::WidgetInfo(this); + wi->setIconName(KexiIconName("timeedit")); + wi->setClassName("QTimeEdit"); + wi->addAlternateClassName("KTimeWidget"); + wi->setName(/* no i18n needed */ "Time Widget"); + wi->setNamePrefix(/* no i18n needed */ "timeWidget"); + wi->setDescription(/* no i18n needed */ "A widget to input and display a time"); + wi->setAutoSaveProperties(QList() << "time"); + addClass(wi); + } +#endif + //! @todo datetime edit +#ifdef KEXI_SHOW_UNFINISHED + { + KFormDesigner::WidgetInfo *wi = new KFormDesigner::WidgetInfo(this); + wi->setIconName(KexiIconName("datetimeedit")); + wi->setClassName("QDateTimeEdit"); + wi->addAlternateClassName("KDateTimeWidget"); + wi->setName(/* no i18n needed */ "Date/Time Widget"); + wi->setNamePrefix(/* no i18n needed */ "dateTimeWidget"); + wi->setDescription(/* no i18n needed */ "A widget to input and display a time and a date"); + wi->setAutoSaveProperties(QList() << "dateTime"); + addClass(wi); + } +#endif + + setPropertyDescription("echoMode", + xi18nc("Property: Echo mode for Line Edit widget eg. Normal, NoEcho, Password", "Echo Mode")); + setPropertyDescription("indent", xi18n("Indent")); 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 KDb 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 + setPropertyDescription("checked", xi18nc("Property: Checked checkbox", "Checked")); + setPropertyDescription("tristate", xi18nc("Property: Tristate checkbox", "Tristate")); 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 + //for button + setPropertyDescription("checkable", xi18nc("Property: Button is checkable", "On/Off")); + setPropertyDescription("autoRepeat", xi18nc("Property: Button", "Auto Repeat")); + setPropertyDescription("autoRepeatDelay", xi18nc("Property: Auto Repeat Button's Delay", "Auto Rep. Delay")); + setPropertyDescription("autoRepeatInterval", xi18nc("Property: Auto Repeat Button's Interval", "Auto Rep. Interval")); + // unused (too advanced) setPropertyDescription("autoDefault", xi18n("Auto Default")); + // unused (too advanced) setPropertyDescription("default", xi18nc("Property: Button is default", "Default")); + setPropertyDescription("flat", xi18nc("Property: Button is flat", "Flat")); 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")); + + //for label + setPropertyDescription("textFormat", xi18n("Text Format")); + setValueDescription("PlainText", xi18nc("For Text Format", "Plain")); + setValueDescription("RichText", xi18nc("For Text Format", "Hypertext")); + setValueDescription("AutoText", xi18nc("For Text Format", "Auto")); + setValueDescription("LogText", xi18nc("For Text Format", "Log")); + setPropertyDescription("openExternalLinks", xi18nc("property: Can open external links in label", "Open Ext. Links")); + + //for line edit + setPropertyDescription("placeholderText", xi18nc("Property: line edit's placeholder text", "Placeholder Text")); + setPropertyDescription("clearButtonEnabled", xi18nc("Property: Clear Button Enabled", "Clear Button")); + //for EchoMode + setPropertyDescription("passwordMode", xi18nc("Property: Password Mode for line edit", "Password Mode")); + setPropertyDescription("squeezedTextEnabled", xi18nc("Property: Squeezed Text Mode for line edit", "Squeezed Text")); + + // text edit + setPropertyDescription("tabStopWidth", xi18n("Tab Stop Width")); + setPropertyDescription("tabChangesFocus", xi18n("Tab Changes Focus")); + setPropertyDescription("wrapPolicy", xi18n("Word Wrap Policy")); + setValueDescription("AtWordBoundary", xi18nc("Property: For Word Wrap Policy", "At Word Boundary")); + setValueDescription("Anywhere", xi18nc("Property: For Word Wrap Policy", "Anywhere")); + setValueDescription("AtWordOrDocumentBoundary", xi18nc("Property: For Word Wrap Policy", "At Word Boundary If Possible")); + setPropertyDescription("wordWrap", xi18n("Word Wrapping")); + setPropertyDescription("wrapColumnOrWidth", xi18n("Word Wrap Position")); + setValueDescription("NoWrap", xi18nc("Property: For Word Wrap Position", "None")); + setValueDescription("WidgetWidth", xi18nc("Property: For Word Wrap Position", "Widget's Width")); + setValueDescription("FixedPixelWidth", xi18nc("Property: For Word Wrap Position", "In Pixels")); + setValueDescription("FixedColumnWidth", xi18nc("Property: For Word Wrap Position", "In Columns")); + setPropertyDescription("linkUnderline", xi18n("Links Underlined")); + setPropertyDescription("horizontalScrollBarPolicy", xi18n("Horizontal Scroll Bar")); + setPropertyDescription("verticalScrollBarPolicy", xi18n("Vertical Scroll Bar")); + //ScrollBarPolicy + setValueDescription("ScrollBarAsNeeded", xi18nc("Property: Show Scroll Bar As Needed", "As Needed")); + setValueDescription("ScrollBarAlwaysOff", xi18nc("Property: Scroll Bar Always Off", "Always Off")); + setValueDescription("ScrollBarAlwaysOn", xi18nc("Property: Scroll Bar Always On", "Always On")); + setPropertyDescription("acceptRichText", xi18nc("Property: Text Edit accepts rich text", "Rich Text")); + setPropertyDescription("HTML", xi18nc("Property: HTML value of text edit", "HTML")); + + // --- containers --- + { + KFormDesigner::WidgetInfo *wi = new KFormDesigner::WidgetInfo(this); + wi->setIconName(KexiIconName("tabwidget")); + wi->setClassName("KFDTabWidget"); + wi->addAlternateClassName("KTabWidget"); + wi->addAlternateClassName("QTabWidget"); + wi->setSavingName("QTabWidget"); + wi->setName(xi18n("Tab Widget")); + wi->setNamePrefix( + xi18nc("A prefix for identifiers of tab widgets. Based on that, identifiers such as " + "tab1, tab2 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.", + "tabWidget")); + wi->setDescription(xi18n("A widget to display multiple pages using tabs")); + addClass(wi); + } + { + KFormDesigner::WidgetInfo *wi = new KFormDesigner::WidgetInfo(this); + wi->setIconName(KexiIconName("frame")); + wi->setClassName("QWidget"); + wi->addAlternateClassName("ContainerWidget"); + wi->setName(/* no i18n needed */ "Basic container"); + wi->setNamePrefix(/* no i18n needed */ "container"); + wi->setDescription(/* no i18n needed */ "An empty container with no frame"); + addClass(wi); + } + { + KFormDesigner::WidgetInfo* wi = new KFormDesigner::WidgetInfo(this); + wi->setIconName(KexiIconName("frame")); + wi->setClassName("KexiFrame"); + 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); + } + { + KFormDesigner::WidgetInfo *wi = new KFormDesigner::WidgetInfo(this); + wi->setIconName(KexiIconName("groupbox")); + wi->setClassName("QGroupBox"); + wi->addAlternateClassName("GroupBox"); + wi->setName(xi18n("Group Box")); + wi->setNamePrefix( + xi18nc("A prefix for identifiers of group box widgets. Based on that, identifiers such as " + "groupBox1, groupBox2 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.", + "groupBox")); + wi->setDescription(xi18n("A container to group some widgets")); + addClass(wi); + } + + //groupbox + setPropertyDescription("title", xi18nc("'Title' property for group box", "Title")); + setPropertyDescription("flat", xi18nc("'Flat' property for group box", "Flat")); + + //tab widget + setPropertyDescription("tabBarAutoHide", xi18n("Auto-hide Tabs")); + setPropertyDescription("tabPosition", xi18n("Tab Position")); + setPropertyDescription("currentIndex", xi18nc("'Current page' property for tab widget", "Current Page")); + setPropertyDescription("tabShape", xi18n("Tab Shape")); + setPropertyDescription("elideMode", xi18nc("Tab Widget's Elide Mode property", "Elide Mode")); + setPropertyDescription("usesScrollButtons", + xi18nc("Tab Widget's property: true if can use scroll buttons", "Scroll Buttons")); + + setPropertyDescription("tabsClosable", xi18n("Closable Tabs")); + setPropertyDescription("movable", xi18n("Movable Tabs")); + setPropertyDescription("documentMode", xi18n("Document Mode")); + + setValueDescription("Rounded", xi18nc("Property value for Tab Shape", "Rounded")); + setValueDescription("Triangular", xi18nc("Property value for Tab Shape", "Triangular")); } -KexiDBFactory::~KexiDBFactory() +KexiMainFormWidgetsFactory::~KexiMainFormWidgetsFactory() { } QWidget* -KexiDBFactory::createWidget(const QByteArray &c, QWidget *p, const char *n, +KexiMainFormWidgetsFactory::createWidget(const QByteArray &c, QWidget *p, const char *n, KFormDesigner::Container *container, CreateWidgetOptions options) { QWidget *w = 0; - QString text(container->form()->library()->textForWidgetName(n, c)); + const QString text(container->form()->library()->textForWidgetName(n, c)); const bool designMode = options & KFormDesigner::WidgetFactory::DesignViewMode; bool createContainer = false; - if (c == "KexiDBLineEdit") { + if (c == "KexiDBLineEdit" || c == "QLineEdit") { w = new KexiDBLineEdit(p); } - else if (c == "KexiDBTextEdit") { + else if (c == "KexiDBTextEdit" || c == "KTextEdit") { w = new KexiDBTextEdit(p); } else if (c == "Q3Frame" || c == "QFrame" || c == "KexiFrame") { w = new KexiFrame(p); createContainer = true; - } else if (c == "KexiDBLabel") { + } else if (c == "KexiDBLabel" || c == "QLabel") { w = new KexiDBLabel(text, p); } - else if (c == "KexiDBImageBox") { + else if (c == "KexiDBImageBox" || c == "KexiPictureLabel") { w = new KexiDBImageBox(designMode, p); connect(w, SIGNAL(idChanged(long)), this, SLOT(slotImageBoxIdChanged(long))); } #ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT else if (c == "KexiDBAutoField") { w = new KexiDBAutoField(p); } #endif - else if (c == "KexiDBCheckBox") { + else if (c == "KexiDBCheckBox" || c == "QCheckBox") { w = new KexiDBCheckBox(text, p); } - else if (c == "KexiDBSlider") { + else if (c == "KexiDBSlider" || c == "QSlider") { w = new KexiDBSlider(p); - } else if (c == "KexiDBProgressBar") { + } else if (c == "KexiDBProgressBar" || c == "QProgressBar") { w = new KexiDBProgressBar(p); - } else if (c == "KexiDBDatePicker") { + } else if (c == "KexiDBDatePicker" || c == "KDateWidget" || c == "QDateEdit") { w = new KexiDBDatePicker(p); } - else if (c == "KexiDBComboBox") { + else if (c == "KexiDBComboBox" || c == "KComboBox") { w = new KexiDBComboBox(p); } else if (c == "QPushButton" || c == "KPushButton" || c == "KexiDBPushButton" || c == "KexiPushButton") { w = new KexiDBPushButton(text, p); } else if (c == "KexiDBCommandLinkButton" || c == "KexiCommandLinkButton") { w = new KexiDBCommandLinkButton(text, QString(), p); } +#ifdef KEXI_SHOW_UNFINISHED + else if (c == "QRadioButton") { + w = new QRadioButton(text, p); + } else if (c == "KIntSpinBox" || c == "QSpinBox") { + w = new QSpinBox(p); + } +#endif +#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT + else if (c == "QTreeWidget") { + QTreeWidget *tw = new QTreeWidget(p); + w = tw; + if (container->form()->interactiveMode()) { + tw->setColumnCount(1); + tw->setHeaderItem(new QTreeWidetItem(tw)); + tw->headerItem()->setText(1, futureI18n("Column 1")); + } + lw->setRootIsDecorated(true); + } else if (c == "KTimeWidget" || c == "QTimeEdit") { + w = new QTimeEdit(QTime::currentTime(), p); + } else if (c == "KDateTimeWidget" || c == "QDateTimeEdit") { + w = new QDateTimeEdit(QDateTime::currentDateTime(), p); + } +#endif + else if (c == "KexiLineWidget" || c == "Line") { + w = new KexiLineWidget(options & WidgetFactory::VerticalOrientation + ? Qt::Vertical : Qt::Horizontal, p); + } // --- containers --- + else if (c == "KFDTabWidget") { + KFDTabWidget *tab = new KFDTabWidget(container, p); + w = tab; +#if defined(USE_KTabWidget) + tab->setTabReorderingEnabled(true); + connect(tab, SIGNAL(movedTab(int,int)), this, SLOT(reorderTabs(int,int))); +#endif + //qDebug() << "Creating ObjectTreeItem:"; + container->form()->objectTree()->addItem(container->objectTree(), + new KFormDesigner::ObjectTreeItem( + container->form()->library()->displayName(c), n, tab, container)); + } else if (c == "QWidget") { + w = new ContainerWidget(p); + w->setObjectName(n); + (void)new KFormDesigner::Container(container, w, p); + return w; + } else if (c == "QGroupBox") { + w = new GroupBox(text, p); + createContainer = true; + } if (w) w->setObjectName(n); - if (createContainer) + if (createContainer) { (void)new KFormDesigner::Container(container, w, container); + } + if (c == "KFDTabWidget") { + // if we are loading, don't add this tab + if (container->form()->interactiveMode()) { + TabWidgetBase *tab = qobject_cast(w); + AddTabAction(container, tab, 0).slotTriggered(); + } + } return w; } -bool KexiDBFactory::createMenuActions(const QByteArray &classname, QWidget *w, QMenu *menu, - KFormDesigner::Container *) +bool KexiMainFormWidgetsFactory::createMenuActions(const QByteArray &classname, QWidget *w, + QMenu *menu, KFormDesigner::Container *container) { + QWidget *pw = w->parentWidget(); if (m_assignAction->isEnabled()) { /*! @todo also call createMenuActions() for inherited factory! */ menu->addAction(m_assignAction); return true; } else if (classname == "KexiDBImageBox") { KexiDBImageBox *imageBox = static_cast(w); imageBox->contextMenu()->updateActionsAvailability(); KActionCollection *ac = imageBox->contextMenu()->actionCollection(); QMenu *subMenu = menu->addMenu(xi18n("&Image")); //! @todo make these actions undoable/redoable subMenu->addAction(ac->action("insert")); subMenu->addAction(ac->action("file_save_as")); subMenu->addSeparator(); subMenu->addAction(ac->action("edit_cut")); subMenu->addAction(ac->action("edit_copy")); subMenu->addAction(ac->action("edit_paste")); subMenu->addAction(ac->action("delete")); if (ac->action("properties")) { subMenu->addSeparator(); subMenu->addAction(ac->action("properties")); } + } else if (classname == "KexiDBLabel" || classname == "KexiDBTextEdit") { + menu->addAction( new EditRichTextAction(container, w, menu, this) ); + return true; + } +#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT + else if (classname == "QTreeWidget") { + menu->addAction(koIcon("document-properties"), futureI18n("Edit Contents of List Widget"), + this, SLOT(editListContents())); + return true; + } +#endif + else if (classname == "KFDTabWidget" || pw->parentWidget()->inherits("QTabWidget")) { +//! @todo KEXI3 port this: setWidget(pw->parentWidget(), m_container->toplevel()); +#if 0 + if (pw->parentWidget()->inherits("QTabWidget")) { + setWidget(pw->parentWidget(), m_container->toplevel()); + } +#endif + TabWidgetBase *tab = qobject_cast(w); + if (tab) { + menu->addAction( new AddTabAction(container, tab, menu) ); + menu->addAction( new RenameTabAction(container, tab, menu) ); + menu->addAction( new RemoveTabAction(container, tab, menu) ); + } + return true; } return false; } void -KexiDBFactory::createCustomActions(KActionCollection* col) +KexiMainFormWidgetsFactory::createCustomActions(KActionCollection* col) { //this will create shared instance action for design mode (special collection is provided) col->addAction("widget_assign_action", m_assignAction = new QAction(KexiIcon("form-action"), xi18n("&Assign Action..."), this)); } bool -KexiDBFactory::startInlineEditing(InlineEditorCreationArguments& args) +KexiMainFormWidgetsFactory::startInlineEditing(InlineEditorCreationArguments& args) { const KFormDesigner::WidgetInfo* wclass = args.container->form()->library()->widgetInfoForClassName(args.classname); const KexiDataAwareWidgetInfo* wDataAwareClass = dynamic_cast(wclass); if (wDataAwareClass && !wDataAwareClass->inlineEditingEnabledWhenDataSourceSet()) { KexiFormDataItemInterface* iface = dynamic_cast(args.widget); if (iface && !iface->dataSource().isEmpty()) { //! @todo reimplement inline editing for KexiDBLineEdit using combobox with data sources return false; } } if (args.classname == "KexiDBLineEdit") { -//! @todo this code should not be copied here but -//! just inherited KexiStandardFormWidgetsFactory::startInlineEditing() should be called - QLineEdit *lineedit = static_cast(args.widget); args.text = lineedit->text(); args.alignment = lineedit->alignment(); args.useFrame = true; return true; } else if (args.classname == "KexiDBTextEdit") { -//! @todo this code should not be copied here but -//! just inherited KexiStandardFormWidgetsFactory::startInlineEditing() should be called KTextEdit *textedit = static_cast(args.widget); //! @todo rich text? args.text = textedit->toPlainText(); args.alignment = textedit->alignment(); args.useFrame = true; args.multiLine = true; //! @todo #if 0 //copy a few properties KTextEdit *ed = dynamic_cast(editor(w)); ed->setLineWrapMode(textedit->lineWrapMode()); ed->setLineWrapColumnOrWidth(textedit->lineWrapColumnOrWidth()); ed->setWordWrapMode(textedit->wordWrapMode()); ed->setTabStopWidth(textedit->tabStopWidth()); ed->setTextFormat(textedit->textFormat()); ed->setHorizontalScrollBarPolicy(textedit->horizontalScrollBarPolicy()); ed->setVerticalScrollBarPolicy(textedit->verticalScrollBarPolicy()); #endif return true; } - // KexiDBCommandLinkButton + else if (args.classname == "KexiDBPushButton") { + KexiDBPushButton *push = static_cast(args.widget); + QStyleOptionButton option; + option.initFrom(push); + args.text = push->text(); + const QRect r(push->style()->subElementRect( + QStyle::SE_PushButtonContents, &option, push)); + args.geometry = QRect(push->x() + r.x(), push->y() + r.y(), r.width(), r.height()); +//! @todo this is typical alignment, can we get actual from the style? + args.alignment = Qt::AlignCenter; + //args.transparentBackground = true; + return true; + } else if (args.classname == "KexiDBCommandLinkButton" ){ - KexiDBCommandLinkButton *linkButton=static_cast(args.widget); - QStyleOption option; + KexiDBCommandLinkButton *linkButton = static_cast(args.widget); + QStyleOptionButton option; option.initFrom(linkButton); args.text = linkButton->text(); const QRect r(linkButton->style()->subElementRect( QStyle::SE_PushButtonContents, &option, linkButton)); QFontMetrics fm(linkButton->font()); - args.geometry = QRect(linkButton->x() + linkButton->iconSize().width() + 6, linkButton->y() + r.y(), r.width() - 6, fm.height()+14); - + args.geometry = QRect(linkButton->x() + linkButton->iconSize().width() + 6, + linkButton->y() + r.y(), + r.width() - 6 - linkButton->iconSize().width(), + std::min(fm.height() + 14, linkButton->height() - 4)); return true; } +#ifdef KEXI_SHOW_UNFINISHED + else if (args.classname == "QRadioButton") { + QRadioButton *radio = static_cast(args.widget); + QStyleOptionButton option; + option.initFrom(radio); + args.text = radio->text(); + const QRect r(radio->style()->subElementRect( + QStyle::SE_RadioButtonContents, &option, radio)); + args.geometry = QRect( + radio->x() + r.x(), radio->y() + r.y(), r.width(), r.height()); + return true; + } +#endif else if (args.classname == "KexiDBLabel") { KexiDBLabel *label = static_cast(args.widget); if (label->textFormat() == Qt::RichText) { args.execute = false; - if (wclass && wclass->inheritedClass()) { - const QByteArray thisClassname = args.classname; //save - args.classname = wclass->inheritedClass()->className(); -//! @todo OK? - const bool result = wclass->inheritedClass()->factory()->startInlineEditing(args); - args.classname = thisClassname; - return result; - } - else { - return false; - } - } - else { + EditRichTextAction(args.container, label, nullptr, this).trigger(); +//! @todo + } else { args.text = label->text(); args.alignment = label->alignment(); args.multiLine = label->wordWrap(); } return true; } -#if 0 else if ( args.classname == "KexiDBDateEdit" || args.classname == "KexiDBDateTimeEdit" - || args.classname == "KexiDBTimeEdit" /*|| classname == "KexiDBIntSpinBox" || classname == "KexiDBDoubleSpinBox"*/) + /*|| args.classname == "KexiDBTimeEdit" || classname == "KexiDBIntSpinBox" || classname == "KexiDBDoubleSpinBox"*/) { - disableFilter(w, container); + disableFilter(args.widget, args.container); return true; } -#endif +#ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT else if (args.classname == "KexiDBAutoField") { if (static_cast(args.widget)->hasAutoCaption()) return false; // caption is auto, abort editing QLabel *label = static_cast(args.widget)->label(); args.text = label->text(); args.widget = label; args.geometry = label->geometry(); args.alignment = label->alignment(); return true; } +#endif else if (args.classname == "KexiDBCheckBox") { KexiDBCheckBox *cb = static_cast(args.widget); - QStyleOption option; + QStyleOptionButton option; option.initFrom(cb); QRect r(cb->geometry()); r.setLeft( r.left() + 2 + cb->style()->subElementRect(QStyle::SE_CheckBoxIndicator, &option, cb).width()); args.text = cb->text(); args.geometry = r; return true; } else if (args.classname == "KexiDBImageBox") { KexiDBImageBox *image = static_cast(args.widget); image->insertFromFile(); args.execute = false; return true; } return false; } bool -KexiDBFactory::previewWidget(const QByteArray &, QWidget *, KFormDesigner::Container *) +KexiMainFormWidgetsFactory::previewWidget(const QByteArray &, QWidget *, KFormDesigner::Container *) { return false; } bool -KexiDBFactory::clearWidgetContent(const QByteArray & /*classname*/, QWidget *w) +KexiMainFormWidgetsFactory::clearWidgetContent(const QByteArray & /*classname*/, QWidget *w) { -//! @todo this code should not be copied here but -//! just inherited KexiStandardFormWidgetsFactory::clearWidgetContent() should be called KexiFormDataItemInterface *iface = dynamic_cast(w); - if (iface) + if (iface) { iface->clear(); + } return true; } bool -KexiDBFactory::isPropertyVisibleInternal(const QByteArray& classname, QWidget *w, +KexiMainFormWidgetsFactory::isPropertyVisibleInternal(const QByteArray& classname, QWidget *w, const QByteArray& property, bool isTopLevel) { //general bool ok = true; if (classname == "KexiDBPushButton" || classname == "KexiPushButton") { ok = property != "isDragEnabled" #ifndef KEXI_SHOW_UNFINISHED && property != "onClickAction" /*! @todo reenable */ && property != "onClickActionOption" /*! @todo reenable */ && property != "iconSet" /*! @todo reenable */ && property != "iconSize" /*! @todo reenable */ && property != "stdItem" /*! @todo reenable stdItem */ #endif ; + ok = KFormDesigner::WidgetFactory::advancedPropertiesVisible() + || (ok && property != "autoDefault" && property != "default"); } else if (classname == "KexiDBCommandLinkButton") { ok = property != "isDragEnabled" && property != "default" && property != "checkable" && property != "autoDefault" && property != "autoRepeat" && property != "autoRepeatDelay" && property != "autoRepeatInterval" #ifndef KEXI_SHOW_UNFINISHED && property != "onClickAction" /*! @todo reenable */ && property != "onClickActionOption" /*! @todo reenable */ && property != "iconSet" /*! @todo reenable */ && property != "iconSize" /*! @todo reenable */ && property != "stdItem" /*! @todo reenable stdItem */ #endif ; } else if (classname == "KexiDBSlider") { ok = property != "sliderPosition" && property != "tracking"; } else if (classname == "KexiDBProgressBar") { ok = property != "focusPolicy" && property != "value"; - } else if (classname == "KexiDBLineEdit") + } else if (classname == "KexiDBLineEdit" || classname == "QLineEdit") ok = property != "urlDropsEnabled" && property != "vAlign" && property != "echoMode" && property != "clickMessage" // Replaced by placeholderText in 2.9, // kept for backward compatibility Kexi projects created with Qt < 4.7. && property != "showClearButton" // Replaced by clearButtonEnabled in 3.0, // kept for backward compatibility Kexi projects created with Qt 4. #ifndef KEXI_SHOW_UNFINISHED && property != "inputMask" && property != "maxLength" //!< we may want to integrate this with db schema #endif ; else if (classname == "KexiDBComboBox") ok = property != "autoCaption" && property != "labelPosition" && property != "widgetType" && property != "fieldTypeInternal" && property != "fieldCaptionInternal" //hide properties that come with KexiDBAutoField #ifndef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT && property != "foregroundLabelColor" && property != "backgroundLabelColor" #endif ; - else if (classname == "KexiDBTextEdit") - ok = property != "undoDepth" - && property != "undoRedoEnabled" //always true! - && property != "dragAutoScroll" //always true! - && property != "overwriteMode" //always false! - && property != "resizePolicy" - && property != "autoFormatting" //too complex - && property != "documentTitle" - && property != "cursorWidth" + else if (classname == "KexiDBTextEdit" || classname == "KTextEdit") + ok = KFormDesigner::WidgetFactory::advancedPropertiesVisible() + || (property != "undoDepth" + && property != "undoRedoEnabled" //always true! + && property != "dragAutoScroll" //always true! + && property != "overwriteMode" //always false! + && property != "resizePolicy" + && property != "autoFormatting" //too complex + && property != "documentTitle" + && property != "cursorWidth" #ifndef KEXI_SHOW_UNFINISHED - && property != "paper" + && property != "paper" #endif - && property != "textInteractionFlags" + && property != "textInteractionFlags" //! @todo support textInteractionFlags property of QLabel and QTextEdit - ; + ); else if (classname == "KexiDBForm") ok = property != "iconText" && property != "geometry" /*nonsense for toplevel widget; for size, "size" property is used*/; - else if (classname == "KexiDBLabel") + else if (classname == "KexiDBLabel" || classname == "QLabel") ok = property != "focusPolicy" - && property != "textInteractionFlags"; + && property != "textInteractionFlags" + && property != "pixmap"; //! @todo support textInteractionFlags property of QLabel + else if (classname == "KexiLineWidget" || classname == "Line") { + ok = property != "frameShape" && property != "font" && property != "margin"; + } +#ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT else if (classname == "KexiDBAutoField") { if (!isTopLevel && property == "caption") return true; //force if (property == "fieldTypeInternal" || property == "fieldCaptionInternal" //! @todo unhide in 2.0 || property == "widgetType") return false; ok = property != "text"; /* "text" is not needed as "caption" is used instead */ } - else if (classname == "KexiDBImageBox") { - ok = property != "font" && property != "wordbreak" && property != "pixmapId"; +#endif + else if (classname == "KexiDBImageBox" || classname == "KexiPictureLabel") { + ok = property != "font" && property != "wordbreak" && property != "pixmapId" + && property != "text" && property != "indent" && property != "textFormat" + && property == "alignment"; } - else if (classname == "KexiDBCheckBox") { + else if (classname == "KexiDBCheckBox" || classname == "QCheckBox") { //hide text property if the widget is a child of an autofield beause there's already "caption" for this purpose if (property == "text" && w && dynamic_cast(w->parentWidget())) return false; - ok = property != "autoRepeat"; + ok = KFormDesigner::WidgetFactory::advancedPropertiesVisible() || property != "autoRepeat"; + } +#ifdef KEXI_SHOW_UNFINISHED + else if (classname == "QRadioButton") { + ok = KFormDesigner::WidgetFactory::advancedPropertiesVisible() || (property != "autoRepeat"); } +#endif else if (classname == "KexiDBDatePicker") { ok = property != "closeButton" && property != "fontSize"; + } else if (classname == "QGroupBox") { + ok = +#ifndef KEXI_SHOW_UNFINISHED + /*! @todo Hidden for now in Kexi. "checkable" and "checked" props need adding + a fake properties which will allow to properly work in design mode, otherwise + child widgets become frozen when checked==true */ + (KFormDesigner::WidgetFactory::advancedPropertiesVisible() || (property != "checkable" && property != "checked")) && +#endif + true; + } else if (classname == "KFDTabWidget") { + ok = (KFormDesigner::WidgetFactory::advancedPropertiesVisible() + || (property != "tabReorderingEnabled" + && property != "hoverCloseButton" + && property != "hoverCloseButtonDelayed")); } - - return ok && KexiDBFactoryBase::isPropertyVisibleInternal(classname, w, property, isTopLevel); } bool -KexiDBFactory::propertySetShouldBeReloadedAfterPropertyChange(const QByteArray& classname, +KexiMainFormWidgetsFactory::propertySetShouldBeReloadedAfterPropertyChange(const QByteArray& classname, QWidget *w, const QByteArray& property) { Q_UNUSED(classname); Q_UNUSED(w); return property == "fieldTypeInternal" || property == "widgetType" || property == "paletteBackgroundColor" || property == "autoFillBackground"; } -bool KexiDBFactory::changeInlineText(KFormDesigner::Form *form, QWidget *widget, +bool KexiMainFormWidgetsFactory::changeInlineText(KFormDesigner::Form *form, QWidget *widget, const QString &text, QString &oldText) { const QByteArray n(widget->metaObject()->className()); - if (n == "KexiDBAutoField") { + if (false) { + } +#ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT + else if (n == "KexiDBAutoField") { oldText = widget->property("caption").toString(); changeProperty(form, widget, "caption", text); return true; - } else if (n == "KexiDBCommandLinkButton") { + } +#endif +#ifdef KEXI_SHOW_UNFINISHED + else if (n == "KIntSpinBox") { + oldText = QString::number(qobject_cast(widget)->value()); + qobject_cast(widget)->setValue(text.toInt()); + } +#endif + else { oldText = widget->property("text").toString(); changeProperty(form, widget, "text", text); return true; } - //! @todo check field's geometry return false; } void -KexiDBFactory::resizeEditor(QWidget *editor, QWidget *w, const QByteArray &classname) +KexiMainFormWidgetsFactory::resizeEditor(QWidget *editor, QWidget *w, const QByteArray &classname) { - if (classname == "KexiDBAutoField") + QSize s = w->size(); + QPoint p = w->pos(); + QRect r; + + if (classname == "KexiDBCheckBox") { + QStyleOptionButton option; + option.initFrom(w); + r = w->style()->subElementRect(QStyle::SE_CheckBoxContents, &option, w); + p += r.topLeft(); + s.setWidth(r.width()); + } else if (classname == "KexiDBPushButton") { + QStyleOptionButton option; + option.initFrom(w); + r = w->style()->subElementRect(QStyle::SE_PushButtonContents, &option, w); + p += r.topLeft(); + s = r.size(); + } +#ifdef KEXI_SHOW_UNFINISHED + else if (classname == "QRadioButton") { + QStyleOptionButton option; + option.initFrom(w); + r = w->style()->subElementRect( + QStyle::SE_RadioButtonContents, &option, w); + p += r.topLeft(); + s.setWidth(r.width()); +#endif + + editor->resize(s); + editor->move(p); + + //! @todo KEXI3 + /* from ContainerFactory::resizeEditor(QWidget *editor, QWidget *widget, const QByteArray &): + QSize s = w->size(); + editor->move(w->x() + 2, w->y() - 5); + editor->resize(s.width() - 20, w->fontMetrics().height() + 10); */ + +#ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT + if (classname == "KexiDBAutoField") { editor->setGeometry(static_cast(w)->label()->geometry()); + } +#endif } -void -KexiDBFactory::slotImageBoxIdChanged(KexiBLOBBuffer::Id_t id) +bool KexiMainFormWidgetsFactory::saveSpecialProperty(const QByteArray &classname, + const QString &name, const QVariant &, QWidget *w, QDomElement &parentNode, + QDomDocument &domDoc) +{ + Q_UNUSED(classname) + if (false) { + } +/* TODO + else if (name == "list_items" && classname == "KexiDBComboBox") { + KexiDBComboBox *combo = qobject_cast(w); + for (int i = 0; i < combo->row; i++) { + QDomElement item = domDoc.createElement("item"); + KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "text", combo->itemText(i)); + parentNode.appendChild(item); + } + return true; + } +*/ +#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT + else if (name == "list_contents" && classname == "QTreeWidget") { + QTreeWidget *treewidget = qobject_cast(w); + // First we save the columns + QTreeWidgetItem *headerItem = treewidget->headerItem(); + if (headerItem) { + for (int i = 0; i < treewidget->columnCount(); i++) { + QDomElement item = domDoc.createElement("column"); + KFormDesigner::FormIO::savePropertyElement( + item, domDoc, "property", "text", headerItem->text(i)); + KFormDesigner::FormIO::savePropertyElement( + item, domDoc, "property", "width", treewidget->columnWidth(i)); + KFormDesigner::FormIO::savePropertyElement( + item, domDoc, "property", "resizable", treewidget->header()->isResizeEnabled(i)); + KFormDesigner::FormIO::savePropertyElement( + item, domDoc, "property", "clickable", treewidget->header()->isClickEnabled(i)); + KFormDesigner::FormIO::savePropertyElement( + item, domDoc, "property", "fullwidth", treewidget->header()->isStretchEnabled(i)); + parentNode.appendChild(item); + } + } + // Then we save the list view items + QTreeWidgetItem *item = listwidget->firstChild(); + while (item) { + saveListItem(item, parentNode, domDoc); + item = item->nextSibling(); + } + return true; + } +#endif + else if (name == "title" && w->parentWidget()->parentWidget()->inherits("QTabWidget")) { + TabWidgetBase *tab = qobject_cast(w->parentWidget()->parentWidget()); + KFormDesigner::FormIO::savePropertyElement( + parentNode, domDoc, "attribute", "title", tab->tabText(tab->indexOf(w))); + } + return true; +} + +#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT +void KexiMainFormWidgetsFactory::saveListItem(QListWidgetItem *item, + QDomNode &parentNode, QDomDocument &domDoc) +{ + QDomElement element = domDoc.createElement("item"); + parentNode.appendChild(element); + + // We save the text of each column + for (int i = 0; i < item->listWidget()->columns(); i++) { + KFormDesigner::FormIO::savePropertyElement( + element, domDoc, "property", "text", item->text(i)); + } + + // Then we save every sub items + QListWidgetItem *child = item->firstChild(); + while (child) { + saveListItem(child, element, domDoc); + child = child->nextSibling(); + } +} + +void KexiMainFormWidgetsFactory::readTreeItem( + QDomElement &node, QTreeWidgetItem *parent, QTreeWidget *treewidget) +{ + QTreeWidgetItem *item; + if (parent) + item = new QTreeWidgetItem(parent); + else + item = new QTreeWidgetItem(treewidget); + + // We need to move the item at the end of the list + QTreeWidgetItem *last; + if (parent) + last = parent->firstChild(); + else + last = treewidget->firstChild(); + + while (last->nextSibling()) + last = last->nextSibling(); + item->moveItem(last); + + int i = 0; + for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { + QDomElement childEl = n.toElement(); + QString prop = childEl.attribute("name"); + QString tag = childEl.tagName(); + + // We read sub items + if (tag == "item") { + item->setOpen(true); + readListItem(childEl, item, treewidget); + } + // and column texts + else if (tag == "property" && prop == "text") { + QVariant val = KFormDesigner::FormIO::readPropertyValue( + n.firstChild(), treewidget, "item"); + item->setText(i, val.toString()); + i++; + } + } +} + +void KexiMainFormWidgetsFactory::editListContents() +{ + if (widget()->inherits("QTreeWidget")) + editTreeWidget(qobject_cast(widget())); +} +#endif + +bool KexiMainFormWidgetsFactory::readSpecialProperty(const QByteArray &classname, + QDomElement &node, QWidget *w, + KFormDesigner::ObjectTreeItem *item) +{ + Q_UNUSED(classname) + const QString tag(node.tagName()); + const QString name(node.attribute("name")); +// KFormDesigner::Form *form = item->container() +// ? item->container()->form() : item->parent()->container()->form(); + + if (false) { + } +/* TODO + else if (tag == "item" && classname == "KComboBox") { + KComboBox *combo = qobject_cast(w); + QVariant val = KFormDesigner::FormIO::readPropertyValue( + form, node.firstChild().firstChild(), w, name); + if (val.canConvert(QVariant::Pixmap)) + combo->addItem(val.value(), QString()); + else + combo->addItem(val.toString()); + return true; + }*/ +#ifdef KEXI_LIST_FORM_WIDGET_SUPPORT + else if (tag == "column" && classname == "QTreeWidget") { + QTreeWidget *tw = qobject_cast(w); + int id = 0; + for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { + QString prop = n.toElement().attribute("name"); + QVariant val = KFormDesigner::FormIO::readPropertyValue(n.firstChild(), w, name); + if (prop == "text") + id = tw->addColumn(val.toString()); + else if (prop == "width") + tw->setColumnWidth(id, val.toInt()); + else if (prop == "resizable") + tw->header()->setResizeEnabled(val.toBool(), id); + else if (prop == "clickable") + tw->header()->setClickEnabled(val.toBool(), id); + else if (prop == "fullwidth") + tw->header()->setStretchEnabled(val.toBool(), id); + } + return true; + } + else if (tag == "item" && classname == "QTreeWidget") { + QTreeWidget *tw = qobject_cast(w); + readListItem(node, 0, tw); + return true; + } +#endif + else if (name == "title" && item->parent()->widget()->inherits("QTabWidget")) { + TabWidgetBase *tab = qobject_cast(w->parentWidget()); + tab->addTab(w, node.firstChild().toElement().text()); + item->addModifiedProperty("title", node.firstChild().toElement().text()); + return true; + } + return false; +} + +void KexiMainFormWidgetsFactory::setPropertyOptions(KPropertySet& set, + const KFormDesigner::WidgetInfo& info, + QWidget *w) +{ + Q_UNUSED(info); + Q_UNUSED(w); + if (set.contains("indent")) { + set["indent"].setOption("min", -1); + set["indent"].setOption("minValueText", xi18nc("default indent value", "default")); + } +} + +void KexiMainFormWidgetsFactory::reorderTabs(int oldpos, int newpos) +{ + KFDTabWidget *tabWidget = qobject_cast(sender()); + KFormDesigner::ObjectTreeItem *tab + = tabWidget->container()->form()->objectTree()->lookup(tabWidget->objectName()); + if (!tab) + return; + + tab->children()->move(oldpos, newpos); +} + +KFormDesigner::ObjectTreeItem* KexiMainFormWidgetsFactory::selectableItem( + KFormDesigner::ObjectTreeItem* item) +{ + if (item->parent() && item->parent()->widget()) { + if (qobject_cast(item->parent()->widget())) { + // tab widget's page + return item->parent(); + } + } + return item; +} + +void KexiMainFormWidgetsFactory::slotImageBoxIdChanged(KexiBLOBBuffer::Id_t id) { KexiFormView *formView = KDbUtils::findParent((QWidget*)sender()); if (formView) { changeProperty(formView->form(), formView, "pixmapId", int(/*! @todo unsafe */id)); formView->setUnsavedLocalBLOB(formView->form()->selectedWidget(), id); } } -#include "kexidbfactory.moc" +#include "KexiMainFormWidgetsFactory.moc" diff --git a/src/plugins/forms/kexidbfactory.h b/src/plugins/forms/widgets/main/KexiMainFormWidgetsFactory.h similarity index 65% rename from src/plugins/forms/kexidbfactory.h rename to src/plugins/forms/widgets/main/KexiMainFormWidgetsFactory.h index 05c3d620c..2f7a45c66 100644 --- a/src/plugins/forms/kexidbfactory.h +++ b/src/plugins/forms/widgets/main/KexiMainFormWidgetsFactory.h @@ -1,68 +1,90 @@ /* This file is part of the KDE project Copyright (C) 2004 Cedric Pasteur - Copyright (C) 2004-2006 Jarosław Staniek + Copyright (C) 2004-2016 Jarosław Staniek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ -#ifndef KEXIDBFACTORY_H -#define KEXIDBFACTORY_H +#ifndef KEXIMAINFORMWIDGETSFACTORY_H +#define KEXIMAINFORMWIDGETSFACTORY_H #include "kexidbfactorybase.h" class QAction; //! Kexi Factory for data-aware widgets //! @todo merge with KexiStandardFormWidgetsFactory -class KexiDBFactory : public KexiDBFactoryBase +class KexiMainFormWidgetsFactory : public KexiDBFactoryBase { Q_OBJECT public: - KexiDBFactory(QObject *parent, const QVariantList &); - virtual ~KexiDBFactory(); + KexiMainFormWidgetsFactory(QObject *parent, const QVariantList &); + virtual ~KexiMainFormWidgetsFactory(); virtual QWidget *createWidget(const QByteArray &classname, QWidget *parent, const char *name, KFormDesigner::Container *container, CreateWidgetOptions options = DefaultOptions); virtual void createCustomActions(KActionCollection* col); virtual bool createMenuActions(const QByteArray &classname, QWidget *w, QMenu *menu, KFormDesigner::Container *container); virtual bool startInlineEditing(InlineEditorCreationArguments& args); virtual bool previewWidget(const QByteArray &, QWidget *, KFormDesigner::Container *); virtual bool clearWidgetContent(const QByteArray &classname, QWidget *w); + //! Moved into public for EditRichTextAction + bool editRichText(QWidget *w, QString &text) const + { + return KexiDBFactoryBase::editRichText(w, text); + } + + //! Moved into public for EditRichTextAction + void changeProperty(KFormDesigner::Form *form, QWidget *widget, const char *name, + const QVariant &value) + { + KexiDBFactoryBase::changeProperty(form, widget, name, value); + } + + bool readSpecialProperty(const QByteArray &classname, QDomElement &node, + QWidget *w, KFormDesigner::ObjectTreeItem *item) override; + bool saveSpecialProperty(const QByteArray &classname, const QString &name, + const QVariant &value, QWidget *w, + QDomElement &parentNode, QDomDocument &parent) override; + void setPropertyOptions(KPropertySet& set, const KFormDesigner::WidgetInfo& info, QWidget *w) override; + protected Q_SLOTS: void slotImageBoxIdChanged(long id); /*KexiBLOBBuffer::Id_t*/ + void reorderTabs(int oldpos, int newpos); protected: + KFormDesigner::ObjectTreeItem* selectableItem(KFormDesigner::ObjectTreeItem* item); virtual bool changeInlineText(KFormDesigner::Form *form, QWidget *widget, const QString &text, QString &oldText); virtual void resizeEditor(QWidget *editor, QWidget *widget, const QByteArray &classname); virtual bool isPropertyVisibleInternal(const QByteArray& classname, QWidget *w, const QByteArray& property, bool isTopLevel); //! Sometimes property sets should be reloaded when a given property value changed. //! @todo this does not seem to work in Kexi 2.x virtual bool propertySetShouldBeReloadedAfterPropertyChange(const QByteArray& classname, QWidget *w, const QByteArray& property); QAction * m_assignAction; }; #endif diff --git a/src/formeditor/factories/KexiStandardContainerFormWidgets.cpp b/src/plugins/forms/widgets/main/KexiStandardContainerFormWidgets.cpp similarity index 100% rename from src/formeditor/factories/KexiStandardContainerFormWidgets.cpp rename to src/plugins/forms/widgets/main/KexiStandardContainerFormWidgets.cpp diff --git a/src/formeditor/factories/KexiStandardContainerFormWidgets.h b/src/plugins/forms/widgets/main/KexiStandardContainerFormWidgets.h similarity index 100% rename from src/formeditor/factories/KexiStandardContainerFormWidgets.h rename to src/plugins/forms/widgets/main/KexiStandardContainerFormWidgets.h diff --git a/src/formeditor/factories/KexiStandardFormWidgets.cpp b/src/plugins/forms/widgets/main/KexiStandardFormWidgets.cpp similarity index 75% rename from src/formeditor/factories/KexiStandardFormWidgets.cpp rename to src/plugins/forms/widgets/main/KexiStandardFormWidgets.cpp index 9389feb8f..5545abf8d 100644 --- a/src/formeditor/factories/KexiStandardFormWidgets.cpp +++ b/src/plugins/forms/widgets/main/KexiStandardFormWidgets.cpp @@ -1,126 +1,102 @@ /* This file is part of the KDE project Copyright (C) 2003 by Lucijan Busch Copyright (C) 2004 Cedric Pasteur Copyright (C) 2009-2014 Jarosław Staniek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "KexiStandardFormWidgets.h" -#include "KexiStandardFormWidgetsFactory.h" +#include "KexiMainFormWidgetsFactory.h" #include #include #include #include -// Some widgets subclass to allow event filtering and some other things -KexiPictureLabel::KexiPictureLabel(const QPixmap &pix, QWidget *parent) - : QLabel(parent) -{ - setPixmap(pix); - setScaledContents(false); -} - -KexiPictureLabel::~KexiPictureLabel() -{ -} - -bool -KexiPictureLabel::setProperty(const char *name, const QVariant &value) -{ - if (0 == qstrcmp(name, "pixmap")) { - const QPixmap pm(value.value()); - resize(pm.height(), pm.width()); - } - return QLabel::setProperty(name, value); -} - -Line::Line(Qt::Orientation orient, QWidget *parent) +KexiLineWidget::KexiLineWidget(Qt::Orientation o, QWidget *parent) : QFrame(parent) { setFrameShadow(Sunken); - if (orient == Qt::Horizontal) + if (o == Qt::Horizontal) setFrameShape(HLine); else setFrameShape(VLine); } -Line::~Line() +KexiLineWidget::~KexiLineWidget() { } -void -Line::setOrientation(Qt::Orientation orient) +void KexiLineWidget::setOrientation(Qt::Orientation o) { - if (orient == Qt::Horizontal) + if (o == Qt::Horizontal) setFrameShape(HLine); else setFrameShape(VLine); } -Qt::Orientation -Line::orientation() const +Qt::Orientation KexiLineWidget::orientation() const { if (frameShape() == HLine) return Qt::Horizontal; else return Qt::Vertical; } // --- EditRichTextAction::EditRichTextAction(KFormDesigner::Container *container, QWidget *receiver, QObject *parent, - KexiStandardFormWidgetsFactory *factory) + KexiMainFormWidgetsFactory *factory) : QAction(koIcon("document-edit"), xi18nc("Edit rich text for a widget", "Edit Rich Text"), parent) , m_container(container) , m_receiver(receiver) , m_factory(factory) { connect(this, SIGNAL(triggered()), this, SLOT(slotTriggered())); } void EditRichTextAction::slotTriggered() { const QByteArray classname( m_receiver->metaObject()->className() ); QString text; if (classname == "KTextEdit") { KTextEdit* te = qobject_cast(m_receiver); if (te->acceptRichText()) { text = te->toHtml(); } else { text = te->toPlainText(); } } else if (classname == "QLabel") { text = qobject_cast(m_receiver)->text(); } if (m_factory->editRichText(m_receiver, text)) { //! @todo ok? m_factory->changeProperty(m_container->form(), m_receiver, "acceptRichText", true); m_factory->changeProperty(m_container->form(), m_receiver, "text", text); } if (classname == "QLabel") { m_receiver->resize(m_receiver->sizeHint()); } } diff --git a/src/formeditor/factories/KexiStandardFormWidgets.h b/src/plugins/forms/widgets/main/KexiStandardFormWidgets.h similarity index 73% rename from src/formeditor/factories/KexiStandardFormWidgets.h rename to src/plugins/forms/widgets/main/KexiStandardFormWidgets.h index f6f1d3d88..65e8b2812 100644 --- a/src/formeditor/factories/KexiStandardFormWidgets.h +++ b/src/plugins/forms/widgets/main/KexiStandardFormWidgets.h @@ -1,82 +1,70 @@ /* This file is part of the KDE project Copyright (C) 2003 by Lucijan Busch Copyright (C) 2004 Cedric Pasteur Copyright (C) 2009 Jarosław Staniek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KEXISTANDARDFORMWIDGETS_H #define KEXISTANDARDFORMWIDGETS_H #include #include #include #include #include "widgetfactory.h" #include "container.h" #include "FormWidgetInterface.h" class QTreeWidgetItem; class QTreeWidget; class KPropertySet; -class KexiStandardFormWidgetsFactory; - -//! A picture label widget for use within forms -class KexiPictureLabel : public QLabel, public KFormDesigner::FormWidgetInterface -{ - Q_OBJECT - -public: - explicit KexiPictureLabel(const QPixmap &pix, QWidget *parent = 0); - virtual ~KexiPictureLabel(); - - virtual bool setProperty(const char *name, const QVariant &value); -}; +class KexiMainFormWidgetsFactory; //! A line widget for use within forms -class Line : public QFrame, public KFormDesigner::FormWidgetInterface +class KexiLineWidget : public QFrame, public KFormDesigner::FormWidgetInterface { Q_OBJECT Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) public: - explicit Line(Qt::Orientation orient, QWidget *parent = 0); - virtual ~Line(); + explicit KexiLineWidget(Qt::Orientation o, QWidget *parent = nullptr); + virtual ~KexiLineWidget(); - void setOrientation(Qt::Orientation orient); + void setOrientation(Qt::Orientation o); Qt::Orientation orientation() const; }; //! Internal action of editing rich text for a label or text editor //! Keeps context expressed using container and receiver widget class EditRichTextAction : public QAction { Q_OBJECT public: EditRichTextAction(KFormDesigner::Container *container, QWidget *receiver, QObject *parent, - KexiStandardFormWidgetsFactory *factory); + KexiMainFormWidgetsFactory *factory); protected Q_SLOTS: void slotTriggered(); private: KFormDesigner::Container *m_container; QWidget *m_receiver; - KexiStandardFormWidgetsFactory *m_factory; + KexiMainFormWidgetsFactory *m_factory; }; #endif diff --git a/src/plugins/forms/widgets/main/kexiforms_mainwidgetsplugin.json b/src/plugins/forms/widgets/main/kexiforms_mainwidgetsplugin.json new file mode 100644 index 000000000..612de992f --- /dev/null +++ b/src/plugins/forms/widgets/main/kexiforms_mainwidgetsplugin.json @@ -0,0 +1,24 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "kexi@kde.org", + "Name": "Kexi Team" + } + ], + "Category": "", + "Dependencies": [], + "Description": "Kexi plugin providing database form widgets", + "EnabledByDefault": true, + "Icon": "form", + "Id": "org.kexi-project.form.widgets.main", + "License": "LGPL", + "Name": "Main form widgets", + "ServiceTypes": [ + "Kexi/FormWidget" + ], + "Version": "3.1", + "Website": "http://kexi-project.org" + }, + "X-Kexi-FormWidgetsFactoryGroup": "" +} diff --git a/src/plugins/forms/widgets/main/pics/CMakeLists.txt b/src/plugins/forms/widgets/main/pics/CMakeLists.txt new file mode 100644 index 000000000..822a03654 --- /dev/null +++ b/src/plugins/forms/widgets/main/pics/CMakeLists.txt @@ -0,0 +1 @@ +kexi_add_plugin_icons_rcc_file(org.kexi-project.form.widgets.main breeze) diff --git a/src/plugins/forms/widgets/main/pics/icons/breeze/files.cmake b/src/plugins/forms/widgets/main/pics/icons/breeze/files.cmake new file mode 100644 index 000000000..3dc22c42d --- /dev/null +++ b/src/plugins/forms/widgets/main/pics/icons/breeze/files.cmake @@ -0,0 +1,11 @@ +# List of project's own icon files +# This file is generated by update_icon_list.sh +# WARNING! All changes made in this file will be lost! + +set(_PNG_FILES +) + +set(_SVG_FILES +) + +set(_FILES ${_PNG_FILES} ${_SVG_FILES}) diff --git a/src/plugins/forms/widgets/mapbrowser/kexiforms_mapwidgetplugin.desktop b/src/plugins/forms/widgets/mapbrowser/kexiforms_mapwidgetplugin.desktop index ff62a57a9..32dd38a90 100644 --- a/src/plugins/forms/widgets/mapbrowser/kexiforms_mapwidgetplugin.desktop +++ b/src/plugins/forms/widgets/mapbrowser/kexiforms_mapwidgetplugin.desktop @@ -1,52 +1,52 @@ [Desktop Entry] Name=Map Widget Name[ca]=Estris de mapes Name[ca@valencia]=Estris de mapes Name[de]=Karten-Bedienelement Name[en_GB]=Map Widget Name[es]=Elemento gráfico de mapas Name[fi]=Karttaelementti Name[gl]=Trebello de mapa Name[it]=Oggetto mappa Name[nl]=Kaartwidget Name[pl]=Element interfejsu mapy Name[pt]=Elemento de Mapa Name[pt_BR]=Elemento de mapa Name[sk]=Widget Mapa Name[sv]=Kartkomponenter Name[uk]=Віджет карти Name[x-test]=xxMap Widgetxx Comment=Kexi plugin providing map browser form widget Comment[ca]=Connector del Kexi que proporciona estris de formularis de navegació de mapes Comment[ca@valencia]=Connector del Kexi que proporciona estris de formularis de navegació de mapes Comment[de]=Kexi-Modul, das ein Karten-Bedienelement bereitstellt Comment[en_GB]=Kexi plugin providing map browser form widget Comment[es]=Complemento de Kexi que proporciona un elemento gráfico de exploración de mapas para los formularios Comment[fi]=Kexi-liitännäinen, joka tarjoaa karttaselaimen lomake-elementin Comment[gl]=Complemento para Kexi que fornece un trebello de navegador de mapa para formularios. Comment[it]=Estensione che fornisce un oggetto del modulo di navigazione mappe di Kexi Comment[nl]=Kexi-plug-in levert formulierwidget voor kaartenbrowser Comment[pl]=Wtyczka Kexi dostarczająca formularze przeglądania map Comment[pt]='Plugin' do Kexi que oferece um elemento gráfico de formulários de navegação em mapas Comment[pt_BR]=Plugin do Kexi que oferece um elemento gráfico de formulários de navegação em mapas Comment[sk]=Kexi plugin poskytujúci prehliadač máp z widgetu Comment[sv]=Kexi-insticksprogram som tillhandahåller formulärkomponent med kartbläddrare Comment[uk]=Додаток до Kexi, що забезпечує роботу форми навігатора картою Comment[x-test]=xxKexi plugin providing map browser form widgetxx Type=Service Icon=form Encoding=UTF-8 X-KDE-Library=kexiforms_mapwidgetplugin X-KDE-ServiceTypes=Kexi/FormWidgets X-KDE-PluginInfo-Author=Kexi Team X-KDE-PluginInfo-Email=kexi@kde.org X-KDE-PluginInfo-Name=org.kexi-project.form.widgets.map -X-KDE-PluginInfo-Version=3.0 +X-KDE-PluginInfo-Version=3.1 X-KDE-PluginInfo-Website=http://kexi-project.org X-KDE-PluginInfo-Category= X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=LGPL X-KDE-PluginInfo-EnabledByDefault=true X-Kexi-FormWidgetsFactoryGroup= diff --git a/src/plugins/forms/widgets/mapbrowser/pics/icons/breeze/actions/16/kexi-form-map-browser.svg b/src/plugins/forms/widgets/mapbrowser/pics/icons/breeze/actions/16/kexi-form-map-browser.svg new file mode 100644 index 000000000..52449c5c6 --- /dev/null +++ b/src/plugins/forms/widgets/mapbrowser/pics/icons/breeze/actions/16/kexi-form-map-browser.svg @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/plugins/forms/widgets/mapbrowser/pics/icons/breeze/actions/22/kexi-form-map-browser.svg b/src/plugins/forms/widgets/mapbrowser/pics/icons/breeze/actions/22/kexi-form-map-browser.svg new file mode 100644 index 000000000..e19e6cd89 --- /dev/null +++ b/src/plugins/forms/widgets/mapbrowser/pics/icons/breeze/actions/22/kexi-form-map-browser.svg @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/src/plugins/forms/widgets/mapbrowser/pics/icons/breeze/actions/24/kexi-form-map-browser.svg b/src/plugins/forms/widgets/mapbrowser/pics/icons/breeze/actions/24/kexi-form-map-browser.svg new file mode 100644 index 000000000..f40771bab --- /dev/null +++ b/src/plugins/forms/widgets/mapbrowser/pics/icons/breeze/actions/24/kexi-form-map-browser.svg @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/src/plugins/forms/widgets/webbrowser/16-actions-web_browser.png b/src/plugins/forms/widgets/webbrowser/16-actions-web_browser.png deleted file mode 100644 index c774dfb63..000000000 Binary files a/src/plugins/forms/widgets/webbrowser/16-actions-web_browser.png and /dev/null differ diff --git a/src/plugins/forms/widgets/webbrowser/22-actions-web_browser.png b/src/plugins/forms/widgets/webbrowser/22-actions-web_browser.png deleted file mode 100644 index fe18955db..000000000 Binary files a/src/plugins/forms/widgets/webbrowser/22-actions-web_browser.png and /dev/null differ diff --git a/src/plugins/forms/widgets/webbrowser/CMakeLists.txt b/src/plugins/forms/widgets/webbrowser/CMakeLists.txt index a3d4b9695..c08ea6bcc 100644 --- a/src/plugins/forms/widgets/webbrowser/CMakeLists.txt +++ b/src/plugins/forms/widgets/webbrowser/CMakeLists.txt @@ -1,39 +1,36 @@ +# the web browser form widgets plugin + include_directories( ${CMAKE_SOURCE_DIR}/src/formeditor ${CMAKE_SOURCE_DIR}/src/core ) set(kexiforms_webbrowserwidgetplugin_SRCS WebBrowserWidget.cpp WebBrowserFactory.cpp + kexiforms_webbrowserwidgetplugin.json Messages.sh ) -add_library(kexiforms_webbrowserwidgetplugin MODULE ${kexiforms_webbrowserwidgetplugin_SRCS}) -kcoreaddons_desktop_to_json(kexiforms_webbrowserwidgetplugin kexiforms_webbrowserwidgetplugin.desktop) +add_library(org.kexi-project.form.widgets.web-browser MODULE ${kexiforms_webbrowserwidgetplugin_SRCS}) set (QT_USE_QTWEBKIT TRUE) -target_link_libraries(kexiforms_webbrowserwidgetplugin +target_link_libraries(org.kexi-project.form.widgets.web-browser kformdesigner kexicore kexiguiutils kexidatatable kexiextendedwidgets kexidataviewcommon kexiformutils Qt5::Core Qt5::Gui Qt5::WebKitWidgets Qt5::Xml ) -install(TARGETS kexiforms_webbrowserwidgetplugin DESTINATION ${KEXI_FORM_WIDGETS_PLUGIN_INSTALL_DIR}) +install(TARGETS org.kexi-project.form.widgets.web-browser DESTINATION ${KEXI_FORM_WIDGETS_PLUGIN_INSTALL_DIR}) -ecm_install_icons(ICONS - 16-actions-web_browser.png - 22-actions-web_browser.png - DESTINATION ${DATA_INSTALL_DIR}/kexi/icons - THEME hicolor -) +add_subdirectory(pics) diff --git a/src/plugins/forms/widgets/webbrowser/WebBrowserFactory.cpp b/src/plugins/forms/widgets/webbrowser/WebBrowserFactory.cpp index b50bc5082..454a97d03 100644 --- a/src/plugins/forms/widgets/webbrowser/WebBrowserFactory.cpp +++ b/src/plugins/forms/widgets/webbrowser/WebBrowserFactory.cpp @@ -1,114 +1,114 @@ /* Copyright (C) 2011 Shreya Pandit This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "WebBrowserFactory.h" #include #include #include "kexidataawarewidgetinfo.h" #include "WebBrowserWidget.h" #include #include #include #include #include #include KEXI_PLUGIN_FACTORY(WebBrowserFactory, "kexiforms_webbrowserwidgetplugin.json") WebBrowserFactory::WebBrowserFactory(QObject* parent, const QVariantList& args) : KexiDBFactoryBase(parent) { Q_UNUSED(args); KexiDataAwareWidgetInfo* webBrowser = new KexiDataAwareWidgetInfo(this); - webBrowser->setIconName(koIconName("web_browser")); + webBrowser->setIconName(KexiIconName("kexiform-web-browser")); webBrowser->setClassName("WebBrowserWidget"); webBrowser->setName(xi18n("Web Browser")); webBrowser->setNamePrefix( xi18nc("A prefix for identifiers of web browser widgets. Based on that, identifiers such as " "webBrowser1, webBrowser2 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.", "webBrowser")); webBrowser->setDescription(xi18n("Web widget with browsing features.")); webBrowser->setInlineEditingEnabledWhenDataSourceSet(false); addClass(webBrowser); setPropertyDescription("textScale", xi18n("Text Scale")); setPropertyDescription("zoomFactor", xi18n("Zoom Factor")); setPropertyDescription("url", xi18n("Url")); } WebBrowserFactory::~WebBrowserFactory() { } QWidget* WebBrowserFactory::createWidget(const QByteArray& classname, QWidget* parent, const char* name, KFormDesigner::Container* container, KFormDesigner::WidgetFactory::CreateWidgetOptions options) { Q_UNUSED(options); QWidget *w = 0; QString text(container->form()->library()->textForWidgetName(name, classname)); if (classname == "WebBrowserWidget") w = new WebBrowserWidget(parent); if (w){ w->setObjectName(name); qDebug() << w << w->objectName() << "created"; return w; } qWarning() << "w == 0"; return 0; } bool WebBrowserFactory::createMenuActions(const QByteArray &classname, QWidget *w, QMenu *menu, KFormDesigner::Container *container) { Q_UNUSED(classname); Q_UNUSED(w); Q_UNUSED(menu); Q_UNUSED(container); return false; } bool WebBrowserFactory::startInlineEditing(InlineEditorCreationArguments& args) { Q_UNUSED(args); return false; } bool WebBrowserFactory::previewWidget(const QByteArray &classname, QWidget *widget, KFormDesigner::Container *) { Q_UNUSED(classname); Q_UNUSED(widget); return true; } #include "WebBrowserFactory.moc" diff --git a/src/plugins/forms/widgets/webbrowser/kexiforms_webbrowserwidgetplugin.desktop b/src/plugins/forms/widgets/webbrowser/kexiforms_webbrowserwidgetplugin.desktop deleted file mode 100644 index dbf04f819..000000000 --- a/src/plugins/forms/widgets/webbrowser/kexiforms_webbrowserwidgetplugin.desktop +++ /dev/null @@ -1,54 +0,0 @@ -[Desktop Entry] -Name=Web Browser Widget -Name[ca]=Estri navegador web -Name[ca@valencia]=Estri navegador web -Name[cs]=Widget webového prohlížeče -Name[de]=Webbrowser-Bedienelement -Name[en_GB]=Web Browser Widget -Name[es]=Elemento gráfico de navegador web -Name[fi]=Verkkoselainelementti -Name[gl]=Trebello de navegador web -Name[ia]=Widget de Navigator Web -Name[it]=Oggetto browser web -Name[nl]=Webbrowserwidget -Name[pl]=Element interfejsu przeglądarki sieciowej -Name[pt]=Elemento de Navegador Web -Name[pt_BR]=Elemento de navegador Web -Name[sk]=Widget Webový prehliadač -Name[sv]=Webbläsarkomponent -Name[uk]=Віджет перегляду інтернету -Name[x-test]=xxWeb Browser Widgetxx -Comment=Kexi plugin providing web browser form widget -Comment[ca]=Connector del Kexi que proporciona estris de formularis de navegació web -Comment[ca@valencia]=Connector del Kexi que proporciona estris de formularis de navegació web -Comment[de]=Kexi-Modul, das ein Webbrowser-Bedienelement bereitstellt -Comment[en_GB]=Kexi plugin providing web browser form widget -Comment[es]=Complemento de Kexi que proporciona un elemento gráfico de navegación web para formularios -Comment[fi]=Kexi-liitännäinen, joka tarjoaa verkkoselaimen lomake-elementin -Comment[gl]=Complemento para Kexi que fornece un trebello de navegador web para formularios. -Comment[it]=Estensione che fornisce un oggetto del modulo del browser web di Kexi -Comment[nl]=Kexi-plug-in levert formulierwidget voor webbrowser -Comment[pl]=Wtyczka Kexi dostarczająca formularze przeglądania sieci -Comment[pt]='Plugin' do Kexi que oferece um elemento gráfico de formulários de navegação Web -Comment[pt_BR]=Plugin do Kexi que oferece um elemento gráfico de formulários de navegação na Web -Comment[sk]=Kexi plugin poskytujúci webový prehliadač z widgetu -Comment[sv]=Kexi-insticksprogram som tillhandahåller formulärkomponent med webbläsare -Comment[uk]=Додаток до Kexi, що забезпечує роботу форми віджета навігатора інтернетом -Comment[x-test]=xxKexi plugin providing web browser form widgetxx -Type=Service -Icon=form -Encoding=UTF-8 - -X-KDE-Library=kexiforms_webbrowserwidgetplugin -X-KDE-ServiceTypes=Kexi/FormWidgets -X-KDE-PluginInfo-Author=Kexi Team -X-KDE-PluginInfo-Email=kexi@kde.org -X-KDE-PluginInfo-Name=org.kexi-project.form.widgets.web -X-KDE-PluginInfo-Version=3.0 -X-KDE-PluginInfo-Website=http://kexi-project.org -X-KDE-PluginInfo-Category= -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=LGPL -X-KDE-PluginInfo-EnabledByDefault=true - -X-Kexi-FormWidgetsFactoryGroup= diff --git a/src/plugins/forms/widgets/webbrowser/kexiforms_webbrowserwidgetplugin.json b/src/plugins/forms/widgets/webbrowser/kexiforms_webbrowserwidgetplugin.json new file mode 100644 index 000000000..29ef33862 --- /dev/null +++ b/src/plugins/forms/widgets/webbrowser/kexiforms_webbrowserwidgetplugin.json @@ -0,0 +1,24 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "kexi@kde.org", + "Name": "Kexi Team" + } + ], + "Category": "", + "Dependencies": [], + "Description": "Kexi plugin providing web browser form widget", + "EnabledByDefault": true, + "Icon": "kexiform-web-browser", + "Id": "org.kexi-project.form.widgets.web-browser", + "License": "LGPL", + "Name": "Web browser widget", + "ServiceTypes": [ + "Kexi/FormWidget" + ], + "Version": "3.1", + "Website": "http://kexi-project.org" + }, + "X-Kexi-FormWidgetsFactoryGroup": "" +} diff --git a/src/plugins/forms/widgets/webbrowser/pics/CMakeLists.txt b/src/plugins/forms/widgets/webbrowser/pics/CMakeLists.txt new file mode 100644 index 000000000..62e62ad93 --- /dev/null +++ b/src/plugins/forms/widgets/webbrowser/pics/CMakeLists.txt @@ -0,0 +1 @@ +kexi_add_plugin_icons_rcc_file(org.kexi-project.form.widgets.web-browser breeze) diff --git a/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/actions/16/kexiform-web-browser.svg b/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/actions/16/kexiform-web-browser.svg new file mode 100644 index 000000000..f2a910c3c --- /dev/null +++ b/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/actions/16/kexiform-web-browser.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/actions/22/kexiform-web-browser.svg b/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/actions/22/kexiform-web-browser.svg new file mode 100644 index 000000000..840c3883e --- /dev/null +++ b/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/actions/22/kexiform-web-browser.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/actions/24/kexiform-web-browser.svg b/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/actions/24/kexiform-web-browser.svg new file mode 100644 index 000000000..42b894ef0 --- /dev/null +++ b/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/actions/24/kexiform-web-browser.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/files.cmake b/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/files.cmake new file mode 100644 index 000000000..3ddaa9a0e --- /dev/null +++ b/src/plugins/forms/widgets/webbrowser/pics/icons/breeze/files.cmake @@ -0,0 +1,14 @@ +# List of project's own icon files +# This file is generated by update_icon_list.sh +# WARNING! All changes made in this file will be lost! + +set(_PNG_FILES +) + +set(_SVG_FILES +icons/breeze/actions/16/kexiform-web-browser.svg +icons/breeze/actions/22/kexiform-web-browser.svg +icons/breeze/actions/24/kexiform-web-browser.svg +) + +set(_FILES ${_PNG_FILES} ${_SVG_FILES})